Nir Soffer has uploaded a new change for review.

Change subject: vm: Streamline names in diskReplicateStart
......................................................................

vm: Streamline names in diskReplicateStart

When starting disk replication, we have two entities: the drive being
replicated, and the replica volume info.

We don't have a source drive and target drive, so the name "srcDrive" is
less correct then simply "drive".

The replica volume info is kept in "dstDiskCopy" which does not reveal
the intention of the code. Now this dict is named "replica".

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


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/23/40023/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 56f43a5..c747ad0 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -3416,52 +3416,51 @@
 
     def diskReplicateStart(self, srcDisk, dstDisk):
         try:
-            srcDrive = self._findDriveByUUIDs(srcDisk)
+            drive = self._findDriveByUUIDs(srcDisk)
         except LookupError:
             self.log.error("Unable to find the disk for '%s'", srcDisk)
             return errCode['imageErr']
 
-        if srcDrive.hasVolumeLeases:
+        if drive.hasVolumeLeases:
             return errCode['noimpl']
 
-        if srcDrive.transientDisk:
+        if drive.transientDisk:
             return errCode['transientErr']
 
-        dstDiskCopy = dstDisk.copy()
+        replica = dstDisk.copy()
 
         # The device entry is enforced because stricly required by
         # prepareVolumePath
-        dstDiskCopy['device'] = srcDrive.device
+        replica['device'] = drive.device
 
-        dstDiskCopy['path'] = self.cif.prepareVolumePath(dstDiskCopy)
+        replica['path'] = self.cif.prepareVolumePath(replica)
         try:
-            self._setDiskReplica(srcDrive, dstDisk)
+            self._setDiskReplica(drive, dstDisk)
 
             try:
-                self._startDriveReplication(srcDrive, dstDiskCopy)
+                self._startDriveReplication(drive, replica)
             except Exception:
                 t, v, tb = sys.exc_info()
                 try:
-                    self._delDiskReplica(srcDrive)
+                    self._delDiskReplica(drive)
                 except Exception:
                     self.log.exception("Error unsetting disk replica %s",
                                        dstDisk)
                 raise t, v, tb
         except Exception:
             self.log.exception("Unable to start replication for %s to %s",
-                               srcDrive.name, dstDiskCopy)
-            self.cif.teardownVolumePath(dstDiskCopy)
+                               drive.name, replica)
+            self.cif.teardownVolumePath(replica)
             return errCode['replicaErr']
 
-        if srcDrive.chunked:
+        if drive.chunked:
             try:
-                capacity, alloc, physical = self._dom.blockInfo(
-                    srcDrive.path, 0)
-                self.extendDriveVolume(srcDrive, srcDrive.volumeID, physical,
+                capacity, alloc, physical = self._dom.blockInfo( drive.path, 0)
+                self.extendDriveVolume(drive, drive.volumeID, physical,
                                        capacity)
             except Exception:
                 self.log.exception("Initial extension request failed for %s",
-                                   srcDrive.name)
+                                   drive.name)
 
         return {'status': doneCode}
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idc3ead0616718b1fd6dd877ad98a4fcfce9e5af2
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