[libvirt] [PATCH] Refresh /etc/xen if inotify wasn't initialized
Daniel Veillard
veillard at redhat.com
Wed Aug 5 10:05:49 UTC 2009
On Wed, Aug 05, 2009 at 10:52:03AM +0100, Daniel P. Berrange wrote:
> 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
>
Argh I missed that comment, and of course I have inotify activated,
I'm applying this separately
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/
More information about the libvir-list
mailing list