diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 9702d6a47880e1aa31ffbadb366a36748de0ad4c..0451126ce3c9093deb3359126c99217d7b747d3e 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -8342,22 +8342,23 @@ class TLReplaceDisks(Tasklet): else: fn = self._ExecDrbd8DiskOnly - return fn(feedback_fn) - + result = fn(feedback_fn) finally: # Deactivate the instance disks if we're replacing them on a # down instance if activate_disks: _SafeShutdownInstanceDisks(self.lu, self.instance) - if __debug__: - # Verify owned locks - owned_locks = self.lu.context.glm.list_owned(locking.LEVEL_NODE) - assert ((self.early_release and not owned_locks) or - (not self.early_release and - set(owned_locks) == set(self.node_secondary_ip))), \ - ("Not owning the correct locks, early_release=%s, owned=%r" % - (self.early_release, owned_locks)) + if __debug__: + # Verify owned locks + owned_locks = self.lu.context.glm.list_owned(locking.LEVEL_NODE) + assert ((self.early_release and not owned_locks) or + (not self.early_release and + set(owned_locks) == set(self.node_secondary_ip))), \ + ("Not owning the correct locks, early_release=%s, owned=%r" % + (self.early_release, owned_locks)) + + return result def _CheckVolumeGroup(self, nodes): self.lu.LogInfo("Checking volume groups")