[libvirt] [PATCH] Remove hard dependency on DMI

Dave Allan dallan at redhat.com
Wed Mar 3 22:57:52 UTC 2010


On 03/03/2010 05:32 PM, Ed Swierk wrote:
> The udev node device driver tries to glean a few tidbits of information
> from /sys/devices/virtual/dmi/id.  If either the BIOS or the kernel does
> not support DMI, libvirtd logs the error
>
>    Failed to get udev device for syspath '/sys/devices/virtual/dmi/id' or '/sys/class/dmi/id'
>
> and refuses to start.
>
> This seems a bit extreme; information obtained from DMI, like the system
> board vendor and BIOS version, is useful but not critical to libvirt's
> operation.

Agreed.

> This patch eliminates the hard dependency on DMI.  On systems without
> DMI, libvirtd logs a warning, and leaves the "computer" node device's
> properties empty.

Although I use goto a lot, I generally try to avoid multiple labels 
within a function, just because I think it gets out of hand really 
quickly.  Although it's a slightly more invasive patch, would you 
refactor the code to look something like what I've attached?  I haven't 
even compile tested it as I'm running late, but that's the idea.

Dave


> Signed-off-by: Ed Swierk<eswierk at aristanetworks.com>
>
> ---
> Index: libvirt-0.7.6/src/node_device/node_device_udev.c
> ===================================================================
> --- libvirt-0.7.6.orig/src/node_device/node_device_udev.c
> +++ libvirt-0.7.6/src/node_device/node_device_udev.c
> @@ -1471,9 +1471,9 @@ static int udevSetupSystemDev(void)
>       if (device == NULL) {
>           device = udev_device_new_from_syspath(udev, DMI_DEVPATH_FALLBACK);
>           if (device == NULL) {
> -            VIR_ERROR("Failed to get udev device for syspath '%s' or '%s'",
> -                      DMI_DEVPATH, DMI_DEVPATH_FALLBACK);
> -            goto out;
> +            VIR_WARN("Failed to get udev device for syspath '%s' or '%s'",
> +                     DMI_DEVPATH, DMI_DEVPATH_FALLBACK);
> +            goto out2;
>           }
>       }
>
> @@ -1532,6 +1532,7 @@ static int udevSetupSystemDev(void)
>
>       udev_device_unref(device);
>
> +out2:
>       dev = virNodeDeviceAssignDef(&driverState->devs, def);
>       if (dev == NULL) {
>           VIR_ERROR("Failed to create device for '%s'", def->name);
>
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: udevdmi.patch
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100303/5205c41d/attachment-0001.ksh>


More information about the libvir-list mailing list