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

2009-03-02 Thread Jim Meyering
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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


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

2009-03-02 Thread Daniel P. Berrange
On Fri, Feb 27, 2009 at 11:12:12AM -0500, 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.

ACK

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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


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

2009-03-02 Thread Cole Robinson
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.
 

Committed now.

Thanks,
Cole

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


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

2009-02-27 Thread Cole Robinson
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