[libvirt] [PATCH] Refresh /etc/xen if inotify wasn't initialized
Daniel P. Berrange
berrange at redhat.com
Wed Aug 5 09:52:03 UTC 2009
On Tue, Aug 04, 2009 at 12:29:02PM -0400, Cole Robinson wrote:
> If libvirt was built against inotify, but an API user isn't using domain
> events (virsh, virt-manager), the xen xm driver doesn't poll /etc/xen
> for new config files. This means that domains created or deleted on
> other libvirt connections aren't reflected in the original connection
> (but they will show up for all newly opened connections). This causes
> newly created VMs to disappear from virt-manager < 0.8.0 once they are
> shutdown, since VMs were installed on a separate connection.
>
> The attached patch refreshes /etc/xen in all cases, unless inotify was
> successfully initialized (user is using domain events).
>
> Thanks,
> Cole
> diff --git a/src/xm_internal.c b/src/xm_internal.c
> index 9d021eb..c1188fe 100644
> --- a/src/xm_internal.c
> +++ b/src/xm_internal.c
> @@ -122,6 +122,19 @@ struct xenUnifiedDriver xenXMDriver = {
> virReportErrorHelper(conn, VIR_FROM_XENXM, code, __FILE__, \
> __FUNCTION__, __LINE__, fmt)
>
> +static int xenInotifyActive(virConnectPtr conn)
> +{
> + int ret;
> +#ifndef WITH_XEN_INOTIFY
> + ret = 0;
> +#else
> + xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;
> + ret = (priv->inotifyWatch > 0);
> +#endif
> +
> + return ret;
> +}
THis will generate an unused variable warning on 'conn'. I'd prefer
to have the conditional outside the fucntion, eg
#ifndef WITH_XEN_INOTIFY
static int xenInotifyActive(virConnectPtr conn ATTRIBUTE_UNUSED)
{
return 0;
}
#else
static int xenInotifyActive(virConnectPtr conn)
{
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;
return priv->inotifyWatch > 0;
}
#endif
ACK to the rest of the patch
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 :|
More information about the libvir-list
mailing list