devices/loopback: better log message

It is more interesting which loopback device was used by which
host service instead of the file descriptor. Log that instead.
This commit is contained in:
Christian Kellner 2021-07-31 18:44:31 -04:00 committed by Tom Gundersen
parent b26d33910a
commit f280cfff18

View file

@ -88,13 +88,14 @@ class LoopbackService(devices.DeviceService):
path = os.path.join(tree, filename.lstrip("/"))
self.fd = os.open(path, os.O_RDWR | os.O_CLOEXEC)
print(f"file '{filename}' opened as {self.fd}")
try:
self.lo = self.make_loop(self.fd, start, size, lock)
except Exception as error: # pylint: disable: broad-except
self.close()
raise error from None
print(f"{self.lo.devname} acquired (locked: {lock})")
dir_fd = -1
try:
dir_fd = os.open(devpath, os.O_CLOEXEC | os.O_PATH)