Skip to content

Commit e5b775e

Browse files
committed
qcow2util: fix name in getLVInfoFromVG
Signed-off-by: Damien Thenot <damien.thenot@vates.tech>
1 parent c3b759c commit e5b775e

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎drivers/qcow2util.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,9 @@ def getInfo(
462462
) -> CowImageInfo:
463463
#TODO: handle resolveParent
464464
self._read_qcow2(path)
465-
basename = Path(path).name
466-
uuid = extractUuidFunction(basename)
465+
uuid = extractUuidFunction(path)
467466
cowinfo = CowImageInfo(uuid)
468-
cowinfo.path = basename
467+
cowinfo.path = path
469468
cowinfo.sizeVirt = self.header["virtual_disk_size"]
470469
cowinfo.sizePhys = self.getSizePhys(path)
471470
cowinfo.hidden = self.getHidden(path)
@@ -527,6 +526,7 @@ def getAllInfoFromVG(
527526
# lvinfo = lvcache.lvs[lvName]
528527
if reg.match(lvName):
529528
cowinfo = self._getInfoLV(lvcache, extractUuidFunction, vgName, lvName)
529+
cowinfo.path = lvName # Function CowUtil.getParentChain expect lvName here, otherwise blktap.{_activate,_deactivate} crashes
530530
if cowinfo is None: #We get None if the LV stopped existing in the meanwhile
531531
continue
532532
result[cowinfo.uuid] = cowinfo
@@ -538,9 +538,11 @@ def getAllInfoFromVG(
538538
parent_cowinfo = self._getInfoLV(lvcache, extractUuidFunction, vgName, parentLvName)
539539
if parent_cowinfo is None: #Parent disappeared while scanning
540540
raise util.SMException("Parent of {} wasn't found during scan".format(lvName))
541-
result[parent_cowinfo.uuid] = parent_cowinfo
542541
parentUuid = parent_cowinfo.parentUuid
543542
parentPath = parent_cowinfo.parentPath
543+
parent_cowinfo.path = parentLvName #Same reason as above, some users expect LvName here instead of path
544+
result[parent_cowinfo.uuid] = parent_cowinfo
545+
544546
return result
545547
else:
546548
pattern_p: Path = Path(pattern)

0 commit comments

Comments
 (0)