Federico Simoncelli has posted comments on this change.
Change subject: One shot prepare.
......................................................................
Patch Set 10: Code-Review-1
(6 comments)
....................................................
File vdsm/storage/blockSD.py
Line 1033: Creates a compatiblity layer for vdsm and qemu-img use.
Line 1034:
Line 1035: srcImgPath: Dir where the image volumes are.
Line 1036: """
Line 1037: sdRunDir = os.path.join("/var/run/vdsm/storage",
self.sdUUID)
This should be a constant.
Line 1038: imgRunDir = os.path.join(sdRunDir, imgUUID)
Line 1039: fileUtils.createdir(imgRunDir)
Line 1040: for volUUID in volUUIDs:
Line 1041: srcVol = os.path.join(srcImgPath, volUUID)
Line 1061: If the image is based on a template image it will be activated.
Line 1062: """
Line 1063: volUUIDs = sd.getVolsOfImage(allVols, imgUUID).keys()
Line 1064: lvm.activateLVs(self.sdUUID, volUUIDs)
Line 1065: vgDir = os.path.join("/dev", self.sdUUID)
os.path.join("/dev", ...
is already appearing so many times in this file that it makes me think that we need to
encapsulate it.
Line 1066: return self.linkRunImage(vgDir, imgUUID, volUUIDs)
Line 1067:
Line 1068: def getVolumeLease(self, imgUUID, volUUID):
Line 1069: """
....................................................
File vdsm/storage/fileSD.py
Line 423: Creates a compatiblity layer for vdsm and qemu-img use.
Line 424:
Line 425: srcImgPath: Dir where the image volumes are.
Line 426: """
Line 427: sdRunDir = os.path.join("/var/run/vdsm/storage", self.sdUUID)
This should be a constant.
Line 428: fileUtils.createdir(sdRunDir)
Line 429: imgRunDir = os.path.join(sdRunDir, imgUUID)
Line 430: try:
Line 431: os.symlink(srcImgPath, imgRunDir)
Line 430: try:
Line 431: os.symlink(srcImgPath, imgRunDir)
Line 432: except OSError as e:
Line 433: if e.errno == errno.EEXIST:
Line 434: self.log.debug("img run dir already exists: %s",
imgRunDir)
This implicitly assumes that the same storage domain cannot be accessed using different
nfs hosts (you could use vdsm.utils.forceLink).
Line 435: else:
Line 436: self.log.error("Failed to create img run dir: %s",
imgRunDir)
Line 437: raise
Line 438:
Line 435: else:
Line 436: self.log.error("Failed to create img run dir: %s",
imgRunDir)
Line 437: raise
Line 438:
Line 439: return imgRunDir
I see some code/logic duplication here in linkRunImage (same as blockSD). Maybe we can
extract it in some common method/function.
Line 440:
Line 441: def activateVolumes(self, imgUUID, allVols):
Line 442: """
Line 443: Activate all the volumes listed in volUUIDs
Line 446: # set. We have to set it here if we want qemu-kvm to write to old
Line 447: # NFS volumes. In theory it is necessary to fix the permission
Line 448: # of the leaf only but to not introduce an additional requirement
Line 449: # (ordered volUUIDs) we fix them all.
Line 450: imgDir = os.path.join(self.mountpoint, self.sdUUID, sd.DOMAIN_IMAGES,
Another solution to the "stale" symlinks would be using the
/rhev/<spuuid>/<sduuid> path here instead of self.mountpoint/<sduuid>.
Line 451: imgUUID)
Line 452: volUUIDs = sd.getVolsOfImage(allVols, imgUUID).keys()
Line 453: volPaths = tuple(os.path.join(imgDir, v) for v in volUUIDs)
Line 454: for volPath in volPaths:
--
To view, visit
http://gerrit.ovirt.org/4220
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Id47db9c53199385dd5d08586e4782ea23885eb72
Gerrit-PatchSet: 10
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Eduardo <ewarszaw(a)redhat.com>
Gerrit-Reviewer: Elad Ben Aharon <eladba1990(a)gmail.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Greg Padgett <gpadgett(a)redhat.com>
Gerrit-Reviewer: Haim Ateya <hateya(a)redhat.com>
Gerrit-Reviewer: Igor Lvovsky <ilvovsky(a)redhat.com>
Gerrit-Reviewer: Sandro Bonazzola <sbonazzo(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: Yeela Kaplan <ykaplan(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes