[libvirt] [PATCH 2/2]: Call udevsettle in the appropriate places

Chris Lalancette clalance at redhat.com
Thu Nov 27 07:53:49 UTC 2008


Daniel P. Berrange wrote:
>> Index: src/storage_backend.c
>> ===================================================================
>> RCS file: /data/cvs/libvirt/src/storage_backend.c,v
>> retrieving revision 1.29
>> diff -u -r1.29 storage_backend.c
>> --- a/src/storage_backend.c	17 Nov 2008 11:19:33 -0000	1.29
>> +++ b/src/storage_backend.c	26 Nov 2008 12:40:19 -0000
>> @@ -270,6 +270,20 @@
>>      return 0;
>>  }
>>  
>> +void virStorageBackendWaitForDevices(virConnectPtr conn)
>> +{
>> +    const char *const settleprog[] = { UDEVSETTLE, NULL };
>> +    int exitstatus;
>> +
>> +    /*
>> +     * NOTE: we ignore errors here; this is just to make sure that any device
>> +     * nodes that are being created finish before we try to
>> +     * scan them.  If this fails (udevsettle exits badly, or doesn't exist
>> +     * at all), then we still have a fallback mechanism anyway.
>> +     */
>> +    virRun(conn, settleprog, &exitstatus);
>> +}
> 
> If we know it doesn't exist, we should not try to run it.
> 
> 
>> Index: configure.in
>> ===================================================================
>> RCS file: /data/cvs/libvirt/configure.in,v
>> retrieving revision 1.187
>> diff -u -r1.187 configure.in
>> --- a/configure.in	25 Nov 2008 15:48:11 -0000	1.187
>> +++ b/configure.in	26 Nov 2008 12:40:19 -0000
>> @@ -115,11 +115,15 @@
>>  	[/sbin:/usr/sbin:/usr/local/sbin:$PATH])
>>  AC_PATH_PROG([BRCTL], [brctl], [brctl],
>>  	[/sbin:/usr/sbin:/usr/local/sbin:$PATH])
>> +AC_PATH_PROG([UDEVSETTLE], [udevsettle], [udevsettle],
>> +	[/sbin:/usr/sbin:/usr/local/sbin:$PATH])
> 
> This will set UDEVSETTLE=udevsettle even if it doesn't exist. This will
> result in us running it on every OS we build on. We should not set this
> variable if its not found.

Right, both points make sense.  I think the following patch should address it; I
only conditionally set the UDEVADM variable if I find it.  So, for machines
without it, the meat of virStorageBackendWaitForDevices is compiled out.  In
places where I've found it on the build machine, I then do "access" for
executable at runtime, and only if that succeeds do I run it.  Does that seem
correct?  In addition, based on the comment from Guido, I changed it over to use
"udevadm settle" instead of "udevsettle".

Signed-off-by: Chris Lalancette <clalance at redhat.com>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libvirt-storage-udevsettle-v3.patch
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20081127/911c5fad/attachment-0001.ksh>


More information about the libvir-list mailing list