]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Catch ENODEV as well when checking if a device is available
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 12 Mar 2024 11:19:31 +0000 (12:19 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 12 Mar 2024 16:15:48 +0000 (17:15 +0100)
This triggers on kernel updates on Arch without rebooting first so
let's make sure we handle it as well.

mkosi/qemu.py

index 7de882fc3fa7403fcb999a3dd71b89a4fd7a3dda..2a54e9ac37ee7a91970d87796517c270bb7890ee 100644 (file)
@@ -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):