Adam Litke has uploaded a new change for review.
Change subject: storage: Rename getParent to getParentId
......................................................................
storage: Rename getParent to getParentId
The Volume and VolumeMetadata classes have functions to return the
parent UUID and parent volume instance. It's a bit unclear that
getParent returns the ID so let's make this more explicit by renaming
getParent to getParentId.
Change-Id: Ie310d731709ebf1ba3589e92a7ae506ccdc8ae22
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/storage/blockVolume.py
M vdsm/storage/fileVolume.py
M vdsm/storage/image.py
M vdsm/storage/sp.py
M vdsm/storage/volume.py
5 files changed, 20 insertions(+), 20 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/47/44047/1
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index 23e636e..0168d64 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -167,7 +167,7 @@
def getParentMeta(self):
return self.getMetaParam(volume.PUUID)
- def getParent(self):
+ def getParentId(self):
"""
Return parent volume UUID
"""
@@ -490,7 +490,7 @@
try:
# We need to blank parent record in our metadata
# for parent to become leaf successfully.
- puuid = self.getParent()
+ puuid = self.getParentId()
self.setParent(volume.BLANK_UUID)
if puuid and puuid != volume.BLANK_UUID:
pvol = BlockVolume(self.repoPath, self.sdUUID, self.imgUUID,
diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index c5b8667..2dad91f 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -150,7 +150,7 @@
return out
- def getParent(self):
+ def getParentId(self):
"""
Return parent volume UUID
"""
@@ -452,7 +452,7 @@
try:
# We need to blank parent record in our metadata
# for parent to become leaf successfully.
- puuid = self.getParent()
+ puuid = self.getParentId()
self.setParent(volume.BLANK_UUID)
if puuid and puuid != volume.BLANK_UUID:
pvol = FileVolume(self.repoPath, self.sdUUID,
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index fa0770c..43e08e5 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -232,7 +232,7 @@
chain.insert(0, srcVol)
seen.add(srcVol.volUUID)
- parentUUID = srcVol.getParent()
+ parentUUID = srcVol.getParentId()
if parentUUID == volume.BLANK_UUID:
break
@@ -578,7 +578,7 @@
raise se.VolumeNotSparse()
srcVolume = self._getSparsifyVolume(tmpSdUUID, tmpImgUUID,
- tmpVolume.getParent())
+ tmpVolume.getParentId())
tmpVolume.prepare()
try:
@@ -898,7 +898,7 @@
successor = chain[-1]
tmpVol = volclass(self.repoPath, sdDom.sdUUID, imgUUID, successor)
dstParent = volclass(self.repoPath, sdDom.sdUUID, imgUUID,
- ancestor).getParent()
+ ancestor).getParentId()
# Mark all volumes as illegal
while tmpVol and dstParent != tmpVol.volUUID:
@@ -926,7 +926,7 @@
successor = chain[-1]
srcVol = volclass(self.repoPath, sdUUID, imgUUID, successor)
dstParent = volclass(self.repoPath, sdUUID, imgUUID,
- ancestor).getParent()
+ ancestor).getParentId()
while srcVol and dstParent != srcVol.volUUID:
try:
@@ -953,7 +953,7 @@
successor = chain[-1]
srcVol = volclass(self.repoPath, sdDom.sdUUID, imgUUID, successor)
dstParent = volclass(self.repoPath, sdDom.sdUUID, imgUUID,
- ancestor).getParent()
+ ancestor).getParentId()
while srcVol and dstParent != srcVol.volUUID:
self.log.info("Remove volume %s from image %s", srcVol.volUUID,
@@ -1143,12 +1143,12 @@
"""
chain = []
accumulatedChainSize = 0
- endVolName = vols[ancestor].getParent() # TemplateVolName or None
+ endVolName = vols[ancestor].getParentId() # TemplateVolName or None
currVolName = successor
while (currVolName != endVolName):
chain.insert(0, currVolName)
accumulatedChainSize += vols[currVolName].getVolumeSize()
- currVolName = vols[currVolName].getParent()
+ currVolName = vols[currVolName].getParentId()
return accumulatedChainSize, chain
@@ -1169,7 +1169,7 @@
self.log.debug("unlinking subchain: %s" % subChain)
sdDom = sdCache.produce(sdUUID=sdUUID)
- dstParent = sdDom.produceVolume(imgUUID, subChain[0]).getParent()
+ dstParent = sdDom.produceVolume(imgUUID, subChain[0]).getParentId()
subChainTailVol = sdDom.produceVolume(imgUUID, subChain[-1])
if subChainTailVol.isLeaf():
self.log.debug("Leaf volume is being removed from the chain. "
@@ -1247,10 +1247,10 @@
srcVolParams = srcVol.getVolumeParams()
srcVolParams['children'] = []
for vName, vol in vols.iteritems():
- if vol.getParent() == successor:
+ if vol.getParentId() == successor:
srcVolParams['children'].append(vol)
dstVol = vols[ancestor]
- dstParentUUID = dstVol.getParent()
+ dstParentUUID = dstVol.getParentId()
if dstParentUUID != sd.BLANK_UUID:
volParams = vols[dstParentUUID].getVolumeParams()
else:
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 8574bac..b92f107 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -1838,7 +1838,7 @@
volUUID=srcVolUUID)
if not srcVol.isShared():
- if srcVol.getParent() == volume.BLANK_UUID:
+ if srcVol.getParentId() == volume.BLANK_UUID:
with rmanager.acquireResource(imageResourcesNamespace,
srcImgUUID,
rm.LockType.exclusive):
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index 951efe0..691d3b9 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -250,7 +250,7 @@
"disktype": meta.get(DISKTYPE, ""),
"voltype": meta.get(VOLTYPE, ""),
"size": int(meta.get(SIZE, "0")),
- "parent": self.getParent(),
+ "parent": self.getParentId(),
"description": meta.get(DESCRIPTION, ""),
"pool": meta.get(sd.DMDK_POOLS, ""),
"domain": meta.get(DOMAIN, ""),
@@ -310,7 +310,7 @@
volParams['size'] = self.getSize()
volParams['apparentsize'] = self.getVolumeSize(bs=bs)
volParams['truesize'] = self.getVolumeTrueSize(bs=bs)
- volParams['parent'] = self.getParent()
+ volParams['parent'] = self.getParentId()
volParams['descr'] = self.getDescription()
volParams['legality'] = self.getLegality()
return volParams
@@ -494,7 +494,7 @@
"""
Return parent volume object
"""
- puuid = self.getParent()
+ puuid = self.getParentId()
if puuid and puuid != BLANK_UUID:
return sdCache.produce(self.sdUUID).produceVolume(self.imgUUID,
puuid)
@@ -571,11 +571,11 @@
"""
return self.md.getMetadata(metaId)
- def getParent(self):
+ def getParentId(self):
"""
Return parent volume UUID
"""
- return self.md.getParent()
+ return self.md.getParentId()
def getChildren(self):
""" Return children volume UUIDs.
--
To view, visit
https://gerrit.ovirt.org/44047
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie310d731709ebf1ba3589e92a7ae506ccdc8ae22
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>