From c85f641390a45d23d9fca5ec60a4bc49bfc5021d Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Mon, 22 Mar 2010 13:22:48 +0000 Subject: [PATCH] Allow parsing in device XML Expand the parser for the standalone XML format to allow inclusion of the device type * src/conf/domain_conf.h: Add virDomainGraphicsDef to the virDomainDeviceDef struct * src/conf/domain_conf.c: Wire up parser for virDomainGraphicsDef to virDomainDeviceDefParse method --- src/conf/domain_conf.c | 10 +++++++++- src/conf/domain_conf.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 55198343ed..ffbb26fbd4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -88,7 +88,8 @@ VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST, "video", "hostdev", "watchdog", - "controller") + "controller", + "graphics") VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST, "none", @@ -575,6 +576,9 @@ void virDomainDeviceDefFree(virDomainDeviceDefPtr def) case VIR_DOMAIN_DEVICE_CONTROLLER: virDomainControllerDefFree(def->data.controller); break; + case VIR_DOMAIN_DEVICE_GRAPHICS: + virDomainGraphicsDefFree(def->data.graphics); + break; } VIR_FREE(def); @@ -3299,6 +3303,10 @@ virDomainDeviceDefPtr virDomainDeviceDefParse(virCapsPtr caps, dev->type = VIR_DOMAIN_DEVICE_CONTROLLER; if (!(dev->data.controller = virDomainControllerDefParseXML(node, flags))) goto error; + } else if (xmlStrEqual(node->name, BAD_CAST "graphics")) { + dev->type = VIR_DOMAIN_DEVICE_GRAPHICS; + if (!(dev->data.graphics = virDomainGraphicsDefParseXML(node, flags))) + goto error; } else { virDomainReportError(VIR_ERR_XML_ERROR, "%s", _("unknown device type")); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 44fff0cccd..efd5db625d 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -544,6 +544,7 @@ enum virDomainDeviceType { VIR_DOMAIN_DEVICE_HOSTDEV, VIR_DOMAIN_DEVICE_WATCHDOG, VIR_DOMAIN_DEVICE_CONTROLLER, + VIR_DOMAIN_DEVICE_GRAPHICS, VIR_DOMAIN_DEVICE_LAST, }; @@ -562,6 +563,7 @@ struct _virDomainDeviceDef { virDomainVideoDefPtr video; virDomainHostdevDefPtr hostdev; virDomainWatchdogDefPtr watchdog; + virDomainGraphicsDefPtr graphics; } data; }; -- GitLab