]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
node_device_udev: Also process ID_TYPE=cd/dvd in udevProcessStorage()
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 31 May 2021 14:42:13 +0000 (16:42 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 2 Jun 2021 08:12:49 +0000 (10:12 +0200)
When processing node devices, the udevProcessStorage() will be
called if the device is some form of storage. In here, ID_TYPE
attribute is queried and depending on its value one of more
specialized helper functions is called. For instance, for
ID_TYPE=="cd" the udevProcessCDROM() is called, for
ID_TYPE=="disk" the udevProcessDisk() is called, and so on.

But there's a problem with ID_TYPE and its values. Coming from
udev, we are not guaranteed that ID_TYPE will contain "cd" for
CDROM devices. In fact, there's a rule installed by sg3_utils
that will overwrite ID_TYPE to "cd/dvd" leaving us with an
unhandled type. Fortunately, this was fixed in their upstream,
but there are still versions out there, on OS platforms that we
aim to support that contain the problematic rule. Therefore, we
should accept both strings.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1848875
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/node_device/node_device_udev.c

index a43e06c23134f86f9b7ff7fba8aaf272164df8c6..f99578414d2a6b022137b6a0c8873cc6b59c2659 100644 (file)
@@ -971,7 +971,8 @@ udevProcessStorage(struct udev_device *device,
             goto cleanup;
     }
 
-    if (STREQ(def->caps->data.storage.drive_type, "cd")) {
+    if (STREQ(def->caps->data.storage.drive_type, "cd") ||
+        STREQ(def->caps->data.storage.drive_type, "cd/dvd")) {
         rv = udevProcessCDROM(device, def);
     } else if (STREQ(def->caps->data.storage.drive_type, "disk")) {
         rv = udevProcessDisk(device, def);