[libvirt] [PATCH] look for DMI information in /sys/class too

Daniel Veillard veillard at redhat.com
Thu Jan 21 14:47:48 UTC 2010


On Mon, Jan 11, 2010 at 04:15:45PM -0500, Dave Allan wrote:
> On 01/11/2010 06:53 AM, Guido Günther wrote:
> >On Fri, Jan 08, 2010 at 11:50:17AM +0100, Daniel Veillard wrote:
> >>   Looks safe to me, assuming the kernel information are exported in the
> >>   same way,
> >Yes, it seems to be the same. Pushed now.
> >Cheers,
> >  -- Guido
> >
> >--
> >Libvir-list mailing list
> >Libvir-list at redhat.com
> >https://www.redhat.com/mailman/listinfo/libvir-list
> 
>      if (device == NULL) {
>          VIR_ERROR("Failed to get udev device for syspath '%s'\n",
> DMI_DEVPATH);
> 
> I don't think we want to log this message unless the device is not
> found either place.
> 
> -        goto out;
> +
> +        device = udev_device_new_from_syspath(udev, DMI_DEVPATH_FALLBACK);
> +        if (device == NULL) {
> +            VIR_ERROR("Failed to get udev device for syspath
> '%s'\n", DMI_DEVPATH_FALLBACK);
> +            goto out;
> +        }
>      }

  Actually that patch while applied doesn't seem to do the expected
if not found in DMI_DEVPATH but found in DMI_DEVPATH_FALLBACK, you will
still emit the
  VIR_ERROR("Failed to get udev device for syspath '%s'", DMI_DEVPATH);

so I'm suppressing that one and modify

  VIR_ERROR("Failed to get udev device for syspath '%s'", DMI_DEVPATH_FALLBACK);

into

  VIR_ERROR("Failed to get udev device for syspath '%s' or '%s'", 
            DMI_DEVPATH, DMI_DEVPATH_FALLBACK);

  I'm pushing the enclosed patch,

   thanks !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/
-------------- next part --------------
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 78d7ae3..2e459d1 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1454,11 +1454,10 @@ static int udevSetupSystemDev(void)
     udev = udev_monitor_get_udev(DRV_STATE_UDEV_MONITOR(driverState));
     device = udev_device_new_from_syspath(udev, DMI_DEVPATH);
     if (device == NULL) {
-        VIR_ERROR("Failed to get udev device for syspath '%s'", DMI_DEVPATH);
-
         device = udev_device_new_from_syspath(udev, DMI_DEVPATH_FALLBACK);
         if (device == NULL) {
-            VIR_ERROR("Failed to get udev device for syspath '%s'", DMI_DEVPATH_FALLBACK);
+            VIR_ERROR("Failed to get udev device for syspath '%s' or '%s'",
+                      DMI_DEVPATH, DMI_DEVPATH_FALLBACK);
             goto out;
         }
     }


More information about the libvir-list mailing list