Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

mount+edit warning message is getting lost, take #2

  • Loading branch information...
commit 85642a5944aa79fa88ee34e8e9d44f1d8b72fb25 1 parent e3d2a74
@timf timf authored
Showing with 33 additions and 24 deletions.
  1. +33 −24 control/src/python/workspacecontrol/defaults/ImageEditing.py
View
57 control/src/python/workspacecontrol/defaults/ImageEditing.py
@@ -412,33 +412,43 @@ def _doMountCopyTasks(self, imagepath, vm_name, mnttask_list, hdimage):
def _doOneMountCopyTask(self, imagepath, src, dst, mntpath, hdimage):
- warning = None
- error = None
if not hdimage:
cmd = "%s %s one %s %s %s %s" % (self.sudo_path, self.mounttool_path, imagepath, mntpath, src, dst)
error = self._doOneMountCopyInnerTask(src, cmd)
+ if error:
+ raise error
+ else:
+ return
+
+ # Some hard disk formats actually mount like partitions, for example
+ # the KVM 'raw' format. We attempt to do partition like mounting
+ # first and then if that fails, try the full blown fdisk + mount
+ # mechanism.
+
+ cmd = "%s %s one %s %s %s %s" % (self.sudo_path, self.mounttool_path, imagepath, mntpath, src, dst)
+ warning = self._doOneMountCopyInnerTask(src, cmd)
- else:
- # Some hard disk formats actually mount like partitions, for example
- # the KVM 'raw' format. We attempt to do partition like mounting
- # first and then if that fails, try the full blown fdisk + mount
- # mechanism.
- cmd = "%s %s one %s %s %s %s" % (self.sudo_path, self.mounttool_path, imagepath, mntpath, src, dst)
- warning = self._doOneMountCopyInnerTask(src, cmd)
- if warning:
- try:
- offsetint = self._guess_offset(imagepath)
- cmd = "%s %s hdone %s %s %s %s %d" % (self.sudo_path, self.mounttool_path, imagepath, mntpath, src, dst, offsetint)
- error = self._doOneMountCopyInnerTask(src, cmd)
- except Exception,e:
- error = e
- if not error:
- return # if there is a warning, it is discarded
if not warning:
- self.c.log.error(error.msg)
- raise error
- elif warning:
- combined = """
+ # success with partition-style edit
+ return
+
+ error = None
+ try:
+ offsetint = self._guess_offset(imagepath)
+ cmd = "%s %s hdone %s %s %s %s %d" % (self.sudo_path, self.mounttool_path, imagepath, mntpath, src, dst, offsetint)
+ error = self._doOneMountCopyInnerTask(src, cmd)
+ except Exception,e:
+ error = e
+
+ # warning is always present ('true') at this point
+
+ if not error:
+ # success with HD-image-style edit
+ return
+
+ # error AND warning are present, print both
+
+ combined = """
===========================================================================
Tried multiple methods of mounting the image file.
@@ -456,8 +466,7 @@ def _doOneMountCopyTask(self, imagepath, src, dst, mntpath, hdimage):
%s
===========================================================================
""" % (warning.msg, error.msg)
- self.c.log.error(combined)
- raise IncompatibleEnvironment(combined)
+ raise IncompatibleEnvironment(combined)
def _doOneMountCopyInnerTask(self, src, cmd):
if self.c.dryrun:
Please sign in to comment.
Something went wrong with that request. Please try again.