Nir Soffer has uploaded a new change for review.

Change subject: vm: Improve error handling in diskReplicateStart
......................................................................

vm: Improve error handling in diskReplicateStart

Move the call to Vm._setDiskReplica() just before the try block ensuring
that this is operation is reverted on errors. Previously there were some
lines before the try block, and an exception raised in these lines would
leave the disk in replication state.

Change-Id: I7b69f5be29483d174dd296feaf5970c58c13a347
Signed-off-by: Nir Soffer <[email protected]>
---
M vdsm/virt/vm.py
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/40021/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index fccfc1b..4e64728 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -3426,18 +3426,18 @@
         if srcDrive.transientDisk:
             return errCode['transientErr']
 
+        dstDiskCopy = dstDisk.copy()
+
+        # The device entry is enforced because stricly required by
+        # prepareVolumePath
+        dstDiskCopy['device'] = srcDrive.device
+
         try:
             self._setDiskReplica(srcDrive, dstDisk)
         except Exception:
             self.log.error("Unable to set the replication for disk '%s' with "
                            "destination '%s'", srcDrive.name, dstDisk)
             return errCode['replicaErr']
-
-        dstDiskCopy = dstDisk.copy()
-
-        # The device entry is enforced because stricly required by
-        # prepareVolumePath
-        dstDiskCopy['device'] = srcDrive.device
 
         try:
             dstDiskCopy['path'] = self.cif.prepareVolumePath(dstDiskCopy)


-- 
To view, visit https://gerrit.ovirt.org/40021
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b69f5be29483d174dd296feaf5970c58c13a347
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to