Re: [libvirt] [PATCH] Recognize available media in nodedev hal driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cole Robinson wrote:

> 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) {

ACK.
Obviously correct.
get_bool_prop sets *val only when it returns zero.

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]