提交 c85f6413 编写于 作者: D Daniel P. Berrange

Allow parsing <graphics> in device XML

Expand the parser for the standalone <device> XML format to
allow inclusion of the <graphics> 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
上级 ced154cb
...@@ -88,7 +88,8 @@ VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST, ...@@ -88,7 +88,8 @@ VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST,
"video", "video",
"hostdev", "hostdev",
"watchdog", "watchdog",
"controller") "controller",
"graphics")
VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST, VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
"none", "none",
...@@ -575,6 +576,9 @@ void virDomainDeviceDefFree(virDomainDeviceDefPtr def) ...@@ -575,6 +576,9 @@ void virDomainDeviceDefFree(virDomainDeviceDefPtr def)
case VIR_DOMAIN_DEVICE_CONTROLLER: case VIR_DOMAIN_DEVICE_CONTROLLER:
virDomainControllerDefFree(def->data.controller); virDomainControllerDefFree(def->data.controller);
break; break;
case VIR_DOMAIN_DEVICE_GRAPHICS:
virDomainGraphicsDefFree(def->data.graphics);
break;
} }
VIR_FREE(def); VIR_FREE(def);
...@@ -3299,6 +3303,10 @@ virDomainDeviceDefPtr virDomainDeviceDefParse(virCapsPtr caps, ...@@ -3299,6 +3303,10 @@ virDomainDeviceDefPtr virDomainDeviceDefParse(virCapsPtr caps,
dev->type = VIR_DOMAIN_DEVICE_CONTROLLER; dev->type = VIR_DOMAIN_DEVICE_CONTROLLER;
if (!(dev->data.controller = virDomainControllerDefParseXML(node, flags))) if (!(dev->data.controller = virDomainControllerDefParseXML(node, flags)))
goto error; 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 { } else {
virDomainReportError(VIR_ERR_XML_ERROR, virDomainReportError(VIR_ERR_XML_ERROR,
"%s", _("unknown device type")); "%s", _("unknown device type"));
......
...@@ -544,6 +544,7 @@ enum virDomainDeviceType { ...@@ -544,6 +544,7 @@ enum virDomainDeviceType {
VIR_DOMAIN_DEVICE_HOSTDEV, VIR_DOMAIN_DEVICE_HOSTDEV,
VIR_DOMAIN_DEVICE_WATCHDOG, VIR_DOMAIN_DEVICE_WATCHDOG,
VIR_DOMAIN_DEVICE_CONTROLLER, VIR_DOMAIN_DEVICE_CONTROLLER,
VIR_DOMAIN_DEVICE_GRAPHICS,
VIR_DOMAIN_DEVICE_LAST, VIR_DOMAIN_DEVICE_LAST,
}; };
...@@ -562,6 +563,7 @@ struct _virDomainDeviceDef { ...@@ -562,6 +563,7 @@ struct _virDomainDeviceDef {
virDomainVideoDefPtr video; virDomainVideoDefPtr video;
virDomainHostdevDefPtr hostdev; virDomainHostdevDefPtr hostdev;
virDomainWatchdogDefPtr watchdog; virDomainWatchdogDefPtr watchdog;
virDomainGraphicsDefPtr graphics;
} data; } data;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册