[libvirt] [PATCH] Support QEMU/KVM watchdog device

Daniel Veillard veillard at redhat.com
Wed Oct 21 14:42:06 UTC 2009


On Wed, Oct 21, 2009 at 01:32:49PM +0100, Richard W.M. Jones wrote:
> Time to brush off this old patch.  This adds simple support for the
> QEMU/KVM emulated hardware watchdog device (qemu commit
> 9dd986ccf68f142aaafe543d80cf877716d91d4e).
> 
> Event notification isn't supported.  This just lets you configure a
> domain with a <watchdog.../> device, select the model and action.
[...]
> +    /* analysis of the watchdog devices */
> +    def->watchdog = NULL;
> +    if ((n = virXPathNodeSet(conn, "./devices/watchdog", ctxt, &nodes)) < 0) {
> +        virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
> +                             "%s", _("cannot extract watchdog devices"));
> +        goto error;
> +    }

  Hum, I'm afraid this will lead to errros for any defintition without a
watchdog ! Since that's completely optional we really should not error
there IMHO and just skip it.

> +    if (n > 1) {
> +        virDomainReportError (conn, VIR_ERR_INTERNAL_ERROR,
> +                              "%s", _("only a single watchdog device is supported"));
> +        goto error;
> +    }
> +    if (n > 0) {
> +        virDomainWatchdogDefPtr watchdog =
> +            virDomainWatchdogDefParseXML (conn, nodes[0], flags);
> +        if (!watchdog)
> +            goto error;
> +
> +        def->watchdog = watchdog;
> +        VIR_FREE(nodes);
> +    }

  It looks a bit more complex than it should but rereading it that's
  right.

  ACK when the previous parsing problem is fixed or verified, it would
be good to get some regression tests to verify the XML parsing, saving
and QEmu command line generation.
  As well as extending the domain.rng as you raised on IRC :-)

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