Skip to content

Commit f39596c

Browse files
committed
refactor(cleanup.py): rename DB_VHD_BLOCKS to DB_VDI_BLOCKS
Signed-off-by: Ronan Abhamon <ronan.abhamon@vates.fr>
1 parent 1c64ea5 commit f39596c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

drivers/VDI.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ def _db_update_sm_config(self, ref, sm_config):
511511
# List of sm-config keys that should not be modifed by db_update
512512
smconfig_protected_keys = [
513513
cleanup.VDI.DB_VDI_PAUSED,
514-
cleanup.VDI.DB_VHD_BLOCKS,
514+
cleanup.VDI.DB_VDI_BLOCKS,
515515
cleanup.VDI.DB_VDI_RELINKING,
516516
cleanup.VDI.DB_VDI_ACTIVATING]
517517

drivers/cleanup.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ class VDI(object):
492492
# config keys & values
493493
DB_VDI_PARENT = "vhd-parent"
494494
DB_VDI_TYPE = "vdi_type"
495-
DB_VHD_BLOCKS = "vhd-blocks"
495+
DB_VDI_BLOCKS = "vhd-blocks"
496496
DB_VDI_PAUSED = "paused"
497497
DB_VDI_RELINKING = "relinking"
498498
DB_VDI_ACTIVATING = "activating"
@@ -512,7 +512,7 @@ class VDI(object):
512512
CONFIG_TYPE = {
513513
DB_VDI_PARENT: XAPI.CONFIG_SM,
514514
DB_VDI_TYPE: XAPI.CONFIG_SM,
515-
DB_VHD_BLOCKS: XAPI.CONFIG_SM,
515+
DB_VDI_BLOCKS: XAPI.CONFIG_SM,
516516
DB_VDI_PAUSED: XAPI.CONFIG_SM,
517517
DB_VDI_RELINKING: XAPI.CONFIG_SM,
518518
DB_VDI_ACTIVATING: XAPI.CONFIG_SM,
@@ -749,7 +749,7 @@ def getAllLeaves(self):
749749

750750
def updateBlockInfo(self) -> Optional[str]:
751751
val = base64.b64encode(self._queryVHDBlocks()).decode()
752-
self.setConfig(VDI.DB_VHD_BLOCKS, val)
752+
self.setConfig(VDI.DB_VDI_BLOCKS, val)
753753
return val
754754

755755
def rename(self, uuid) -> None:
@@ -1095,7 +1095,7 @@ def _getCoalescedSizeData(self):
10951095
upper bound)"""
10961096
# make sure we don't use stale BAT info from vdi_rec since the child
10971097
# was writable all this time
1098-
self.delConfig(VDI.DB_VHD_BLOCKS)
1098+
self.delConfig(VDI.DB_VDI_BLOCKS)
10991099
blocksChild = self.getVHDBlocks()
11001100
blocksParent = self.parent.getVHDBlocks()
11011101
numBlocks = Util.countBits(blocksChild, blocksParent)
@@ -2205,15 +2205,15 @@ def needUpdateBlockInfo(self) -> bool:
22052205
for vdi in self.vdis.values():
22062206
if vdi.scanError or len(vdi.children) == 0:
22072207
continue
2208-
if not vdi.getConfig(vdi.DB_VHD_BLOCKS):
2208+
if not vdi.getConfig(vdi.DB_VDI_BLOCKS):
22092209
return True
22102210
return False
22112211

22122212
def updateBlockInfo(self) -> None:
22132213
for vdi in self.vdis.values():
22142214
if vdi.scanError or len(vdi.children) == 0:
22152215
continue
2216-
if not vdi.getConfig(vdi.DB_VHD_BLOCKS):
2216+
if not vdi.getConfig(vdi.DB_VDI_BLOCKS):
22172217
vdi.updateBlockInfo()
22182218

22192219
def cleanupCoalesceJournals(self):
@@ -2544,7 +2544,7 @@ def _doCoalesceLeaf(self, vdi):
25442544
vdi.parent.delConfig(VDI.DB_VDI_PARENT)
25452545
if vdi.parent.vdi_type == VdiType.RAW:
25462546
vdi.parent.setConfig(VDI.DB_VDI_TYPE, VdiType.RAW)
2547-
vdi.parent.delConfig(VDI.DB_VHD_BLOCKS)
2547+
vdi.parent.delConfig(VDI.DB_VDI_BLOCKS)
25482548
util.fistpoint.activate("LVHDRT_coaleaf_after_vdirec", self.uuid)
25492549

25502550
self._updateNode(vdi)
@@ -2918,7 +2918,7 @@ def needUpdateBlockInfo(self) -> bool:
29182918
for vdi in self.vdis.values():
29192919
if vdi.scanError or not VdiType.isCowImage(vdi.vdi_type) or len(vdi.children) == 0:
29202920
continue
2921-
if not vdi.getConfig(vdi.DB_VHD_BLOCKS):
2921+
if not vdi.getConfig(vdi.DB_VDI_BLOCKS):
29222922
return True
29232923
return False
29242924

@@ -2928,7 +2928,7 @@ def updateBlockInfo(self) -> None:
29282928
for vdi in self.vdis.values():
29292929
if vdi.scanError or not VdiType.isCowImage(vdi.vdi_type) or len(vdi.children) == 0:
29302930
continue
2931-
if not vdi.getConfig(vdi.DB_VHD_BLOCKS):
2931+
if not vdi.getConfig(vdi.DB_VDI_BLOCKS):
29322932
vdi.updateBlockInfo()
29332933
numUpdated += 1
29342934
if numUpdated:

0 commit comments

Comments
 (0)