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

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

 



On Wed, Nov 26, 2008 at 05:08:49PM +0100, Chris Lalancette wrote:
> Instead of relying solely on polling for /dev devices to appear in libvirt, we
> really should be synchronizing against udev.  This is generally done by a call
> to udevsettle, which is exactly what this patch implements for the storage
> backends that are likely to create new /dev nodes.  I believe I've read that
> even after udevsettle, you are not guaranteed that devices are all the way
> created, so we still need the polling in the rest of the sources, but this
> should give us a much better chance of things existing as we expect.
> 
> Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx>

> 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.

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@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]