Skip to content

Commit 224fa01

Browse files
committed
Fix lvutil.extractUuid
It's not supposed to return SR UUID but is used for parsing path like this "VG_XenStorage--a6f308d1--764f--f50c--dcda--0d9c0be2d710-VHD--cd1d86c1--f379--400c--b1f4--5a73f74119d3" instead. Replace its usage to obtain SR UUID in qcow2util by the same log instead. Signed-off-by: Damien Thenot <damien.thenot@vates.tech>
1 parent 9cd804f commit 224fa01

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

drivers/lvmcowutil.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,7 @@ def extractUuid(path: str) -> str:
229229
if uuid.startswith(VG_PREFIX):
230230
# we are dealing with realpath
231231
uuid = uuid.replace("--", "-")
232-
uuid = uuid.replace(VG_PREFIX, "")
233-
return uuid
232+
234233
for prefix in LV_PREFIX.values():
235234
if uuid.find(prefix) != -1:
236235
uuid = uuid.split(prefix)[-1]

drivers/qcow2util.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from blktap2 import TapCtl
1515
from cowutil import CowUtil, CowImageInfo
1616
from lvmcache import LVMCache
17-
from LVMSR import NS_PREFIX_LVM
17+
from constants import NS_PREFIX_LVM, VG_PREFIX
1818

1919
MAX_QCOW_CHAIN_LENGTH: Final = 30
2020

@@ -495,12 +495,14 @@ def _getInfoLV(
495495
return None
496496

497497
vdiUuid = extractUuidFunction(lvPath)
498-
srUuid = extractUuidFunction(vgName)
499-
lvcache.activate(NS_PREFIX_LVM + srUuid, vdiUuid, lvName, False)
498+
srUuid = vgName.replace(VG_PREFIX, "")
499+
500+
ns = NS_PREFIX_LVM + srUuid
501+
lvcache.activate(ns, vdiUuid, lvName, False)
500502
try:
501503
cowinfo = self.getInfo(lvPath, extractUuidFunction)
502504
finally:
503-
lvcache.deactivate(NS_PREFIX_LVM + srUuid, vdiUuid, lvName, False)
505+
lvcache.deactivate(ns, vdiUuid, lvName, False)
504506
return cowinfo
505507

506508
@override

0 commit comments

Comments
 (0)