src/modules/client/bootenv.py
changeset 1710 139720e2e756
parent 1516 8c950a3b4171
child 1874 f6c813bd9ea7
--- a/src/modules/client/bootenv.py	Thu Jan 28 12:20:28 2010 -0800
+++ b/src/modules/client/bootenv.py	Thu Jan 28 22:08:37 2010 -0600
@@ -319,6 +319,16 @@
 
                 self.__store_image_state()
 
+                relock = False
+                if self.img.locked:
+                        # This is necessary since the lock will
+                        # prevent the boot environment from being
+                        # unmounted during activation.  Normally,
+                        # locking for the image is handled
+                        # automatically.
+                        relock = True
+                        self.img.unlock()
+
                 caught_exception = None
                 cmd = [ "/sbin/bootadm", "update-archive", "-R" ]
                 try:
@@ -328,8 +338,17 @@
                                 activate_be(cmd)
                 except Exception, e:
                         caught_exception = e
+                        if relock:
+                                # Re-lock be image.
+                                relock = False
+                                self.img.lock()
 
                 self.__reset_image_state(failure=caught_exception)
+                if relock:
+                        # Activation was successful so the be image was
+                        # unmounted and the parent image must be re-locked.
+                        self.img.lock()
+
                 if caught_exception:
                         self.img.history.log_operation_error(error=e)
                         raise caught_exception