From: Daan De Meyer Date: Tue, 12 Mar 2024 11:19:31 +0000 (+0100) Subject: Catch ENODEV as well when checking if a device is available X-Git-Tag: v22~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d85df7ab0571d6af413db0d798e63d1796ed8fab;p=thirdparty%2Fmkosi.git Catch ENODEV as well when checking if a device is available This triggers on kernel updates on Arch without rebooting first so let's make sure we handle it as well. --- diff --git a/mkosi/qemu.py b/mkosi/qemu.py index 7de882fc3..2a54e9ac3 100644 --- a/mkosi/qemu.py +++ b/mkosi/qemu.py @@ -73,10 +73,10 @@ class QemuDeviceNode(StrEnum): try: os.close(self.open()) except OSError as e: - if e.errno not in (errno.ENOENT, errno.EPERM, errno.EACCES): + if e.errno not in (errno.ENOENT, errno.ENODEV, errno.EPERM, errno.EACCES): raise e - if log and e.errno == errno.ENOENT: + if log and e.errno in (errno.ENOENT, errno.ENODEV): logging.warning(f"{self.device()} not found. Not adding {self.description()} to the virtual machine.") if log and e.errno in (errno.EPERM, errno.EACCES):