Adam Litke has uploaded a new change for review.
Change subject: storage: Rename getParentVolume* to produceParent
......................................................................
storage: Rename getParentVolume* to produceParent
The Volume object provides getParentVolume and the VolumeMetadata object
provides getParentVolumeMetadata. Both of these functions return an
instance of their same type which represents this volume's parent.
Since the logic is the same and both object types implement compatible
interfaces let's unify around the name produceParent. Once complete,
consumers of these objects can use either type without additional
modifications.
Change-Id: I4553e5bcc8a576abc6fb472148f744c66e5012ef
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/storage/image.py
M vdsm/storage/resourceFactories.py
M vdsm/storage/volume.py
3 files changed, 16 insertions(+), 16 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/44048/1
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index 43e08e5..bd79f6e 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -168,7 +168,7 @@
"""
chain = self.getChain(sdUUID, imgUUID, volUUID)
newsize = 0
- template = chain[0].getParentVolume()
+ template = chain[0].produceParent()
if template:
newsize = template.getVolumeSize()
for vol in chain:
@@ -241,7 +241,7 @@
imgUUID, srcVol.volUUID, parentUUID)
raise se.ImageIsNotLegalChain(imgUUID)
- srcVol = srcVol.getParentVolume()
+ srcVol = srcVol.produceParent()
self.log.info("sdUUID=%s imgUUID=%s chain=%s ", sdUUID, imgUUID,
chain)
return chain
@@ -254,7 +254,7 @@
# Find all volumes of image (excluding template)
chain = self.getChain(sdUUID, imgUUID)
# check if the chain is build above a template, or it is a standalone
- pvol = chain[0].getParentVolume()
+ pvol = chain[0].produceParent()
if pvol:
tmpl = pvol
elif chain[0].isShared():
@@ -351,7 +351,7 @@
fakeTemplate = False
pimg = volume.BLANK_UUID # standalone chain
# check if the chain is build above a template, or it is a standalone
- pvol = srcChain[0].getParentVolume()
+ pvol = srcChain[0].produceParent()
if pvol:
# find out parent volume parameters
volParams = pvol.getVolumeParams()
@@ -454,7 +454,7 @@
srcFormat = volume.fmt2str(srcVol.getFormat())
dstFormat = volume.fmt2str(dstVol.getFormat())
- parentVol = dstVol.getParentVolume()
+ parentVol = dstVol.produceParent()
if parentVol is not None:
backing = volume.getBackingVolumePath(
@@ -731,7 +731,7 @@
raise se.ImageIsNotLegalChain(imgUUID)
chain = self.getChain(sdUUID, imgUUID)
# check if the chain is build above a template, or it is a standalone
- pvol = chain[0].getParentVolume()
+ pvol = chain[0].produceParent()
if pvol:
if not pvol.isLegal() or pvol.isFake():
raise se.ImageIsNotLegalChain(imgUUID)
@@ -902,7 +902,7 @@
# Mark all volumes as illegal
while tmpVol and dstParent != tmpVol.volUUID:
- vol = tmpVol.getParentVolume()
+ vol = tmpVol.produceParent()
tmpVol.setLegality(volume.ILLEGAL_VOL)
tmpVol = vol
@@ -932,7 +932,7 @@
try:
self.log.info("Teardown volume %s from image %s",
srcVol.volUUID, imgUUID)
- vol = srcVol.getParentVolume()
+ vol = srcVol.produceParent()
srcVol.teardown(sdUUID=srcVol.sdUUID, volUUID=srcVol.volUUID,
justme=True)
srcVol = vol
@@ -958,7 +958,7 @@
while srcVol and dstParent != srcVol.volUUID:
self.log.info("Remove volume %s from image %s", srcVol.volUUID,
imgUUID)
- vol = srcVol.getParentVolume()
+ vol = srcVol.produceParent()
srcVol.delete(postZero=postZero, force=True)
chain.remove(srcVol.volUUID)
srcVol = vol
@@ -1321,7 +1321,7 @@
def _activateVolumeForImportExport(self, domain, imgUUID, volUUID=None):
chain = self.getChain(domain.sdUUID, imgUUID, volUUID)
- template = chain[0].getParentVolume()
+ template = chain[0].produceParent()
if template or len(chain) > 1:
self.log.error("Importing and exporting an image with more "
diff --git a/vdsm/storage/resourceFactories.py b/vdsm/storage/resourceFactories.py
index 98c362b..fb2522d 100644
--- a/vdsm/storage/resourceFactories.py
+++ b/vdsm/storage/resourceFactories.py
@@ -126,7 +126,7 @@
return []
# check if the chain is build above a template, or it is a standalone
- pvol = chain[0].getParentVolume()
+ pvol = chain[0].produceParent()
if pvol:
template = pvol.volUUID
elif chain[0].isShared():
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index 691d3b9..a098eb7 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -490,7 +490,7 @@
"""
pass # Do not remove this method or the V3 upgrade will fail.
- def getParentVolume(self):
+ def produceParent(self):
"""
Return parent volume object
"""
@@ -659,7 +659,7 @@
Rebase volume on top of new backing volume
"""
if rollback:
- pvol = self.getParentVolume()
+ pvol = self.produceParent()
if not pvol:
self.log.warn("Can't rebase volume %s, parent missing",
self.volUUID)
@@ -787,7 +787,7 @@
"volUUID=%s imageDir=%s" %
(repoPath, sdUUID, imgUUID, volUUID, imageDir))
vol = sdCache.produce(sdUUID).produceVolume(imgUUID, volUUID)
- pvol = vol.getParentVolume()
+ pvol = vol.produceParent()
# Remove volume
vol.delete(postZero=False, force=True)
if len(cls.getImageVolumes(repoPath, sdUUID, imgUUID)):
@@ -1120,7 +1120,7 @@
try:
if justme:
return True
- pvol = self.getParentVolume()
+ pvol = self.produceParent()
if pvol:
pvol.prepare(rw=chainrw, justme=False,
chainrw=chainrw, setrw=setrw)
@@ -1149,7 +1149,7 @@
def getInfo(self):
return self.md.getInfo()
- def getParentVolume(self):
+ def produceParent(self):
"""
Return parent volume object
"""
--
To view, visit
https://gerrit.ovirt.org/44048
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4553e5bcc8a576abc6fb472148f744c66e5012ef
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>