The host device hal driver can't tell when a storage device has media
available, the culprit being an incorrect return value check. The
attached patch fixes this.

Unfortunately the driver also doesn't properly detect media eject and
media inserted hal events. I've been poking at this but it's a more
involved fix.

Thanks,
Cole
    Recognize ejectable media in hostdev hal driver.

diff --git a/src/node_device_hal.c b/src/node_device_hal.c
index cb4f86b..25ae12c 100644
--- a/src/node_device_hal.c
+++ b/src/node_device_hal.c
@@ -242,8 +242,8 @@ static int gather_storage_cap(LibHalContext *ctx, const char *udi,
     (void)get_str_prop(ctx, udi, "storage.vendor", &d->storage.vendor);
     if (get_bool_prop(ctx, udi, "storage.removable", &val) == 0 && val) {
         d->storage.flags |= VIR_NODE_DEV_CAP_STORAGE_REMOVABLE;
-        if (get_bool_prop(ctx, udi,
-                          "storage.removable.media_available", &val) && val) {
+        if (get_bool_prop(ctx, udi, "storage.removable.media_available",
+                          &val) == 0 && val) {
             d->storage.flags |=
                 VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE;
             (void)get_uint64_prop(ctx, udi, "storage.removable.media_size",
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to