Skip to content

Commit 9291a6b

Browse files
committed
fix(setParent): setParent only warn about openers
The GC in case of migration would try to setParent while tapdisk was still active but only pause/unpause the tapdisk after calling setParent to refresh it. Meaning we ended up not doing the change of parent correctly and the image would become invalid. We haven't observed corruption from changing parent and refresh tapdisk yet so we reverted to not checking opener but we kept a warning in the logs. Signed-off-by: Damien Thenot <[email protected]>
1 parent 8aa2b54 commit 9291a6b

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

drivers/qcow2util.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -583,15 +583,14 @@ def hasParent(self, path: str) -> bool:
583583
@override
584584
def setParent(self, path: str, parentPath: str, parentRaw: bool) -> None:
585585
pid_openers = util.get_openers_pid(path)
586-
if not pid_openers:
587-
parentType = QCOW2_TYPE
588-
if parentRaw:
589-
parentType = RAW_TYPE
590-
cmd = [QEMU_IMG, "rebase", "-u", "-f", QCOW2_TYPE, "-F", parentType, "-b", parentPath, path]
591-
self._ioretry(cmd)
592-
else:
593-
util.SMlog("Could not rebase because openers {}".format(pid_openers))
594-
# Maybe check the parent is already the correct one thanks to tapdisk coalesce
586+
if pid_openers:
587+
util.SMlog("Rebasing while process {} has the VDI opened".format(pid_openers))
588+
589+
parentType = QCOW2_TYPE
590+
if parentRaw:
591+
parentType = RAW_TYPE
592+
cmd = [QEMU_IMG, "rebase", "-u", "-f", QCOW2_TYPE, "-F", parentType, "-b", parentPath, path]
593+
self._ioretry(cmd)
595594

596595
@override
597596
def getHidden(self, path: str) -> bool:

0 commit comments

Comments
 (0)