Skip to content

Commit 9ddb039

Browse files
committed
qcow2util: use tap-ctl to identify tapdisk for a path
Signed-off-by: Damien Thenot <damien.thenot@vates.tech>
1 parent e5464bb commit 9ddb039

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

‎drivers/qcow2util.py‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -713,14 +713,11 @@ def _getTapdisk(self, path: str) -> Tuple[int, int]:
713713
"""
714714
Return a tuple of (PID, Minor) for the given path
715715
"""
716-
pid_openers = util.get_openers_pid(path)
717-
if pid_openers:
718-
if len(pid_openers) > 1:
719-
raise xs_errors.XenError("Multiple openers for {}".format(path)) # TODO: There might be multiple PID? Yes, we can have the chain enabled for multiple leaf (i.e. after a clone), taken into account in cleanup.py
720-
pid = pid_openers[0]
721-
tapdiskList = TapCtl.list(pid=pid)
722-
if len(tapdiskList) > 1: #TODO: There might more than one minor for this blktap?
716+
tapdiskList = TapCtl.list(path=path) #TODO: do we want to use realpath here to have the whole path?
717+
if tapdiskList:
718+
if len(tapdiskList) > 1: #TODO: There might more than one minor or pid for this path?
723719
raise xs_errors.XenError("TapdiskAlreadyRunning", "There is multiple minor for this tapdisk process")
720+
pid = tapdiskList[0]["pid"]
724721
minor = tapdiskList[0]["minor"]
725722
return (pid, minor)
726723
raise xs_errors.XenError("TapdiskFailed", "No tapdisk process found for {}".format(path))

0 commit comments

Comments
 (0)