提交 46971d5e 编写于 作者: G Guido Günther

pass flags argument to all virDomain*DefParse* functions

上级 88053456
Thu Jan 8 14:41:55 CET 2009 Guido Günther <agx@sigxcpu.org>
pass flags argument to all virDomain*DefParse* functions
* src/domain_conf.c (virDomainDiskDefParseXML,
virDomainFSDefParseXML, virDomainNetDefParseXML,
virDomainChrDefParseXML, virDomainSoundDefParseXML,
virDomainHostdevSubsysUsbDefParseXML, virDomainHostdevDefParseXML,
virDomainDefParseString): Add and pass on flags argument
* src/domain_conf.h (virDomainDeviceDefParse,
virDomainDefParseString): Add flags argument
* src/lxc_driver.c (lxcDomainDefine): Pass VIR_DOMAIN_XML_INACTIVE
* src/openvz_driver.c (openvzDomainDefineXML): Likewise
* src/qemu_driver.c (qemudDomainCreate, qemudDomainRestore,
qemudDomainDefine, qemudDomainAttachDevice): Likewise
* src/test.c (testOpenDefault, testDomainCreateXML, testDomainRestore,
testDomainDefineXML): Likewise
* src/uml_driver.c (umlDomainCreate, umlDomainDefine): Likewise
* src/xend_internal.c (xenDaemonCreateXML, xenDaemonDomainCreateXML):
Likewise
* tests/qemuxml2xmltest.c (testCompareXMLToXMLFiles): Likewise
Thu Jan 8 09:48:04 CET 2009 Daniel P. Berrange <berrange@redhat.com> Thu Jan 8 09:48:04 CET 2009 Daniel P. Berrange <berrange@redhat.com>
poll: don't return uninitialized poll: don't return uninitialized
......
...@@ -534,7 +534,8 @@ int virDomainDiskCompare(virDomainDiskDefPtr a, ...@@ -534,7 +534,8 @@ int virDomainDiskCompare(virDomainDiskDefPtr a,
*/ */
static virDomainDiskDefPtr static virDomainDiskDefPtr
virDomainDiskDefParseXML(virConnectPtr conn, virDomainDiskDefParseXML(virConnectPtr conn,
xmlNodePtr node) { xmlNodePtr node,
int flags ATTRIBUTE_UNUSED) {
virDomainDiskDefPtr def; virDomainDiskDefPtr def;
xmlNodePtr cur; xmlNodePtr cur;
char *type = NULL; char *type = NULL;
...@@ -721,7 +722,8 @@ cleanup: ...@@ -721,7 +722,8 @@ cleanup:
*/ */
static virDomainFSDefPtr static virDomainFSDefPtr
virDomainFSDefParseXML(virConnectPtr conn, virDomainFSDefParseXML(virConnectPtr conn,
xmlNodePtr node) { xmlNodePtr node,
int flags ATTRIBUTE_UNUSED) {
virDomainFSDefPtr def; virDomainFSDefPtr def;
xmlNodePtr cur; xmlNodePtr cur;
char *type = NULL; char *type = NULL;
...@@ -807,7 +809,8 @@ cleanup: ...@@ -807,7 +809,8 @@ cleanup:
static virDomainNetDefPtr static virDomainNetDefPtr
virDomainNetDefParseXML(virConnectPtr conn, virDomainNetDefParseXML(virConnectPtr conn,
virCapsPtr caps, virCapsPtr caps,
xmlNodePtr node) { xmlNodePtr node,
int flags ATTRIBUTE_UNUSED) {
virDomainNetDefPtr def; virDomainNetDefPtr def;
xmlNodePtr cur; xmlNodePtr cur;
char *macaddr = NULL; char *macaddr = NULL;
...@@ -1038,7 +1041,8 @@ error: ...@@ -1038,7 +1041,8 @@ error:
*/ */
static virDomainChrDefPtr static virDomainChrDefPtr
virDomainChrDefParseXML(virConnectPtr conn, virDomainChrDefParseXML(virConnectPtr conn,
xmlNodePtr node) { xmlNodePtr node,
int flags ATTRIBUTE_UNUSED) {
xmlNodePtr cur; xmlNodePtr cur;
char *type = NULL; char *type = NULL;
char *bindHost = NULL; char *bindHost = NULL;
...@@ -1257,7 +1261,8 @@ error: ...@@ -1257,7 +1261,8 @@ error:
static virDomainInputDefPtr static virDomainInputDefPtr
virDomainInputDefParseXML(virConnectPtr conn, virDomainInputDefParseXML(virConnectPtr conn,
const char *ostype, const char *ostype,
xmlNodePtr node) { xmlNodePtr node,
int flags ATTRIBUTE_UNUSED) {
virDomainInputDefPtr def; virDomainInputDefPtr def;
char *type = NULL; char *type = NULL;
char *bus = NULL; char *bus = NULL;
...@@ -1436,7 +1441,8 @@ error: ...@@ -1436,7 +1441,8 @@ error:
static virDomainSoundDefPtr static virDomainSoundDefPtr
virDomainSoundDefParseXML(virConnectPtr conn, virDomainSoundDefParseXML(virConnectPtr conn,
const xmlNodePtr node) { const xmlNodePtr node,
int flags ATTRIBUTE_UNUSED) {
char *model; char *model;
virDomainSoundDefPtr def; virDomainSoundDefPtr def;
...@@ -1467,7 +1473,8 @@ error: ...@@ -1467,7 +1473,8 @@ error:
static int static int
virDomainHostdevSubsysUsbDefParseXML(virConnectPtr conn, virDomainHostdevSubsysUsbDefParseXML(virConnectPtr conn,
const xmlNodePtr node, const xmlNodePtr node,
virDomainHostdevDefPtr def) { virDomainHostdevDefPtr def,
int flags ATTRIBUTE_UNUSED) {
int ret = -1; int ret = -1;
xmlNodePtr cur; xmlNodePtr cur;
...@@ -1667,7 +1674,8 @@ out: ...@@ -1667,7 +1674,8 @@ out:
static virDomainHostdevDefPtr static virDomainHostdevDefPtr
virDomainHostdevDefParseXML(virConnectPtr conn, virDomainHostdevDefParseXML(virConnectPtr conn,
const xmlNodePtr node) { const xmlNodePtr node,
int flags) {
xmlNodePtr cur; xmlNodePtr cur;
virDomainHostdevDefPtr def; virDomainHostdevDefPtr def;
...@@ -1709,7 +1717,8 @@ virDomainHostdevDefParseXML(virConnectPtr conn, ...@@ -1709,7 +1717,8 @@ virDomainHostdevDefParseXML(virConnectPtr conn,
if (xmlStrEqual(cur->name, BAD_CAST "source")) { if (xmlStrEqual(cur->name, BAD_CAST "source")) {
if (def->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && if (def->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) { def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) {
if (virDomainHostdevSubsysUsbDefParseXML(conn, cur, def) < 0) if (virDomainHostdevSubsysUsbDefParseXML(conn, cur,
def, flags) < 0)
goto error; goto error;
} }
if (def->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && if (def->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
...@@ -1763,7 +1772,8 @@ static int virDomainLifecycleParseXML(virConnectPtr conn, ...@@ -1763,7 +1772,8 @@ static int virDomainLifecycleParseXML(virConnectPtr conn,
virDomainDeviceDefPtr virDomainDeviceDefParse(virConnectPtr conn, virDomainDeviceDefPtr virDomainDeviceDefParse(virConnectPtr conn,
virCapsPtr caps, virCapsPtr caps,
const virDomainDefPtr def, const virDomainDefPtr def,
const char *xmlStr) const char *xmlStr,
int flags)
{ {
xmlDocPtr xml; xmlDocPtr xml;
xmlNodePtr node; xmlNodePtr node;
...@@ -1790,27 +1800,28 @@ virDomainDeviceDefPtr virDomainDeviceDefParse(virConnectPtr conn, ...@@ -1790,27 +1800,28 @@ virDomainDeviceDefPtr virDomainDeviceDefParse(virConnectPtr conn,
if (xmlStrEqual(node->name, BAD_CAST "disk")) { if (xmlStrEqual(node->name, BAD_CAST "disk")) {
dev->type = VIR_DOMAIN_DEVICE_DISK; dev->type = VIR_DOMAIN_DEVICE_DISK;
if (!(dev->data.disk = virDomainDiskDefParseXML(conn, node))) if (!(dev->data.disk = virDomainDiskDefParseXML(conn, node, flags)))
goto error; goto error;
} else if (xmlStrEqual(node->name, BAD_CAST "filesystem")) { } else if (xmlStrEqual(node->name, BAD_CAST "filesystem")) {
dev->type = VIR_DOMAIN_DEVICE_FS; dev->type = VIR_DOMAIN_DEVICE_FS;
if (!(dev->data.fs = virDomainFSDefParseXML(conn, node))) if (!(dev->data.fs = virDomainFSDefParseXML(conn, node, flags)))
goto error; goto error;
} else if (xmlStrEqual(node->name, BAD_CAST "interface")) { } else if (xmlStrEqual(node->name, BAD_CAST "interface")) {
dev->type = VIR_DOMAIN_DEVICE_NET; dev->type = VIR_DOMAIN_DEVICE_NET;
if (!(dev->data.net = virDomainNetDefParseXML(conn, caps, node))) if (!(dev->data.net = virDomainNetDefParseXML(conn, caps, node, flags)))
goto error; goto error;
} else if (xmlStrEqual(node->name, BAD_CAST "input")) { } else if (xmlStrEqual(node->name, BAD_CAST "input")) {
dev->type = VIR_DOMAIN_DEVICE_INPUT; dev->type = VIR_DOMAIN_DEVICE_INPUT;
if (!(dev->data.input = virDomainInputDefParseXML(conn, def->os.type, node))) if (!(dev->data.input = virDomainInputDefParseXML(conn, def->os.type,
node, flags)))
goto error; goto error;
} else if (xmlStrEqual(node->name, BAD_CAST "sound")) { } else if (xmlStrEqual(node->name, BAD_CAST "sound")) {
dev->type = VIR_DOMAIN_DEVICE_SOUND; dev->type = VIR_DOMAIN_DEVICE_SOUND;
if (!(dev->data.sound = virDomainSoundDefParseXML(conn, node))) if (!(dev->data.sound = virDomainSoundDefParseXML(conn, node, flags)))
goto error; goto error;
} else if (xmlStrEqual(node->name, BAD_CAST "hostdev")) { } else if (xmlStrEqual(node->name, BAD_CAST "hostdev")) {
dev->type = VIR_DOMAIN_DEVICE_HOSTDEV; dev->type = VIR_DOMAIN_DEVICE_HOSTDEV;
if (!(dev->data.hostdev = virDomainHostdevDefParseXML(conn, node))) if (!(dev->data.hostdev = virDomainHostdevDefParseXML(conn, node, flags)))
goto error; goto error;
} else { } else {
virDomainReportError(conn, VIR_ERR_XML_ERROR, virDomainReportError(conn, VIR_ERR_XML_ERROR,
...@@ -2090,7 +2101,8 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn, ...@@ -2090,7 +2101,8 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
goto no_memory; goto no_memory;
for (i = 0 ; i < n ; i++) { for (i = 0 ; i < n ; i++) {
virDomainDiskDefPtr disk = virDomainDiskDefParseXML(conn, virDomainDiskDefPtr disk = virDomainDiskDefParseXML(conn,
nodes[i]); nodes[i],
flags);
if (!disk) if (!disk)
goto error; goto error;
...@@ -2110,7 +2122,8 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn, ...@@ -2110,7 +2122,8 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
goto no_memory; goto no_memory;
for (i = 0 ; i < n ; i++) { for (i = 0 ; i < n ; i++) {
virDomainFSDefPtr fs = virDomainFSDefParseXML(conn, virDomainFSDefPtr fs = virDomainFSDefParseXML(conn,
nodes[i]); nodes[i],
flags);
if (!fs) if (!fs)
goto error; goto error;
...@@ -2129,7 +2142,8 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn, ...@@ -2129,7 +2142,8 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
for (i = 0 ; i < n ; i++) { for (i = 0 ; i < n ; i++) {
virDomainNetDefPtr net = virDomainNetDefParseXML(conn, virDomainNetDefPtr net = virDomainNetDefParseXML(conn,
caps, caps,
nodes[i]); nodes[i],
flags);
if (!net) if (!net)
goto error; goto error;
...@@ -2149,7 +2163,8 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn, ...@@ -2149,7 +2163,8 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
for (i = 0 ; i < n ; i++) { for (i = 0 ; i < n ; i++) {
virDomainChrDefPtr chr = virDomainChrDefParseXML(conn, virDomainChrDefPtr chr = virDomainChrDefParseXML(conn,
nodes[i]); nodes[i],
flags);
if (!chr) if (!chr)
goto error; goto error;
...@@ -2168,7 +2183,8 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn, ...@@ -2168,7 +2183,8 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
for (i = 0 ; i < n ; i++) { for (i = 0 ; i < n ; i++) {
virDomainChrDefPtr chr = virDomainChrDefParseXML(conn, virDomainChrDefPtr chr = virDomainChrDefParseXML(conn,
nodes[i]); nodes[i],
flags);
if (!chr) if (!chr)
goto error; goto error;
...@@ -2179,7 +2195,8 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn, ...@@ -2179,7 +2195,8 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
if ((node = virXPathNode(conn, "./devices/console[1]", ctxt)) != NULL) { if ((node = virXPathNode(conn, "./devices/console[1]", ctxt)) != NULL) {
virDomainChrDefPtr chr = virDomainChrDefParseXML(conn, virDomainChrDefPtr chr = virDomainChrDefParseXML(conn,
node); node,
flags);
if (!chr) if (!chr)
goto error; goto error;
...@@ -2217,7 +2234,8 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn, ...@@ -2217,7 +2234,8 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
for (i = 0 ; i < n ; i++) { for (i = 0 ; i < n ; i++) {
virDomainInputDefPtr input = virDomainInputDefParseXML(conn, virDomainInputDefPtr input = virDomainInputDefParseXML(conn,
def->os.type, def->os.type,
nodes[i]); nodes[i],
flags);
if (!input) if (!input)
goto error; goto error;
...@@ -2292,7 +2310,8 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn, ...@@ -2292,7 +2310,8 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
for (i = 0 ; i < n ; i++) { for (i = 0 ; i < n ; i++) {
int collision = 0, j; int collision = 0, j;
virDomainSoundDefPtr sound = virDomainSoundDefParseXML(conn, virDomainSoundDefPtr sound = virDomainSoundDefParseXML(conn,
nodes[i]); nodes[i],
flags);
if (!sound) if (!sound)
goto error; goto error;
...@@ -2319,7 +2338,9 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn, ...@@ -2319,7 +2338,9 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
if (n && VIR_ALLOC_N(def->hostdevs, n) < 0) if (n && VIR_ALLOC_N(def->hostdevs, n) < 0)
goto no_memory; goto no_memory;
for (i = 0 ; i < n ; i++) { for (i = 0 ; i < n ; i++) {
virDomainHostdevDefPtr hostdev = virDomainHostdevDefParseXML(conn, nodes[i]); virDomainHostdevDefPtr hostdev = virDomainHostdevDefParseXML(conn,
nodes[i],
flags);
if (!hostdev) if (!hostdev)
goto error; goto error;
...@@ -2363,7 +2384,8 @@ catchXMLError (void *ctx, const char *msg ATTRIBUTE_UNUSED, ...) ...@@ -2363,7 +2384,8 @@ catchXMLError (void *ctx, const char *msg ATTRIBUTE_UNUSED, ...)
virDomainDefPtr virDomainDefParseString(virConnectPtr conn, virDomainDefPtr virDomainDefParseString(virConnectPtr conn,
virCapsPtr caps, virCapsPtr caps,
const char *xmlStr) const char *xmlStr,
int flags)
{ {
xmlParserCtxtPtr pctxt; xmlParserCtxtPtr pctxt;
xmlDocPtr xml = NULL; xmlDocPtr xml = NULL;
...@@ -2394,8 +2416,7 @@ virDomainDefPtr virDomainDefParseString(virConnectPtr conn, ...@@ -2394,8 +2416,7 @@ virDomainDefPtr virDomainDefParseString(virConnectPtr conn,
goto cleanup; goto cleanup;
} }
def = virDomainDefParseNode(conn, caps, xml, root, def = virDomainDefParseNode(conn, caps, xml, root, flags);
VIR_DOMAIN_XML_INACTIVE);
cleanup: cleanup:
xmlFreeParserCtxt (pctxt); xmlFreeParserCtxt (pctxt);
......
...@@ -525,10 +525,12 @@ void virDomainRemoveInactive(virDomainObjListPtr doms, ...@@ -525,10 +525,12 @@ void virDomainRemoveInactive(virDomainObjListPtr doms,
virDomainDeviceDefPtr virDomainDeviceDefParse(virConnectPtr conn, virDomainDeviceDefPtr virDomainDeviceDefParse(virConnectPtr conn,
virCapsPtr caps, virCapsPtr caps,
const virDomainDefPtr def, const virDomainDefPtr def,
const char *xmlStr); const char *xmlStr,
int flags);
virDomainDefPtr virDomainDefParseString(virConnectPtr conn, virDomainDefPtr virDomainDefParseString(virConnectPtr conn,
virCapsPtr caps, virCapsPtr caps,
const char *xmlStr); const char *xmlStr,
int flags);
virDomainDefPtr virDomainDefParseFile(virConnectPtr conn, virDomainDefPtr virDomainDefParseFile(virConnectPtr conn,
virCapsPtr caps, virCapsPtr caps,
const char *filename, const char *filename,
......
...@@ -275,7 +275,8 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char *xml) ...@@ -275,7 +275,8 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char *xml)
virDomainPtr dom = NULL; virDomainPtr dom = NULL;
lxcDriverLock(driver); lxcDriverLock(driver);
if (!(def = virDomainDefParseString(conn, driver->caps, xml))) if (!(def = virDomainDefParseString(conn, driver->caps, xml,
VIR_DOMAIN_XML_INACTIVE)))
goto cleanup; goto cleanup;
if ((def->nets != NULL) && !(driver->have_netns)) { if ((def->nets != NULL) && !(driver->have_netns)) {
...@@ -1002,7 +1003,8 @@ lxcDomainCreateAndStart(virConnectPtr conn, ...@@ -1002,7 +1003,8 @@ lxcDomainCreateAndStart(virConnectPtr conn,
virDomainPtr dom = NULL; virDomainPtr dom = NULL;
lxcDriverLock(driver); lxcDriverLock(driver);
if (!(def = virDomainDefParseString(conn, driver->caps, xml))) if (!(def = virDomainDefParseString(conn, driver->caps, xml,
VIR_DOMAIN_XML_INACTIVE)))
goto cleanup; goto cleanup;
if ((def->nets != NULL) && !(driver->have_netns)) { if ((def->nets != NULL) && !(driver->have_netns)) {
......
...@@ -657,7 +657,8 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml) ...@@ -657,7 +657,8 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
prog[0] = NULL; prog[0] = NULL;
openvzDriverLock(driver); openvzDriverLock(driver);
if ((vmdef = virDomainDefParseString(conn, driver->caps, xml)) == NULL) if ((vmdef = virDomainDefParseString(conn, driver->caps, xml,
VIR_DOMAIN_XML_INACTIVE)) == NULL)
goto cleanup; goto cleanup;
if (vmdef->os.init == NULL && if (vmdef->os.init == NULL &&
...@@ -733,7 +734,8 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml, ...@@ -733,7 +734,8 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
progcreate[0] = NULL; progcreate[0] = NULL;
openvzDriverLock(driver); openvzDriverLock(driver);
if ((vmdef = virDomainDefParseString(conn, driver->caps, xml)) == NULL) if ((vmdef = virDomainDefParseString(conn, driver->caps, xml,
VIR_DOMAIN_XML_INACTIVE)) == NULL)
goto cleanup; goto cleanup;
if (vmdef->os.init == NULL && if (vmdef->os.init == NULL &&
......
...@@ -1689,7 +1689,8 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml, ...@@ -1689,7 +1689,8 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
virDomainEventPtr event = NULL; virDomainEventPtr event = NULL;
qemuDriverLock(driver); qemuDriverLock(driver);
if (!(def = virDomainDefParseString(conn, driver->caps, xml))) if (!(def = virDomainDefParseString(conn, driver->caps, xml,
VIR_DOMAIN_XML_INACTIVE)))
goto cleanup; goto cleanup;
vm = virDomainFindByName(&driver->domains, def->name); vm = virDomainFindByName(&driver->domains, def->name);
...@@ -2574,7 +2575,8 @@ static int qemudDomainRestore(virConnectPtr conn, ...@@ -2574,7 +2575,8 @@ static int qemudDomainRestore(virConnectPtr conn,
} }
/* Create a domain from this XML */ /* Create a domain from this XML */
if (!(def = virDomainDefParseString(conn, driver->caps, xml))) { if (!(def = virDomainDefParseString(conn, driver->caps, xml,
VIR_DOMAIN_XML_INACTIVE))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
"%s", _("failed to parse XML")); "%s", _("failed to parse XML"));
goto cleanup; goto cleanup;
...@@ -2761,7 +2763,8 @@ static virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) { ...@@ -2761,7 +2763,8 @@ static virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) {
int newVM = 1; int newVM = 1;
qemuDriverLock(driver); qemuDriverLock(driver);
if (!(def = virDomainDefParseString(conn, driver->caps, xml))) if (!(def = virDomainDefParseString(conn, driver->caps, xml,
VIR_DOMAIN_XML_INACTIVE)))
goto cleanup; goto cleanup;
vm = virDomainFindByName(&driver->domains, def->name); vm = virDomainFindByName(&driver->domains, def->name);
...@@ -3223,9 +3226,8 @@ static int qemudDomainAttachDevice(virDomainPtr dom, ...@@ -3223,9 +3226,8 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
goto cleanup; goto cleanup;
} }
dev = virDomainDeviceDefParse(dom->conn, dev = virDomainDeviceDefParse(dom->conn, driver->caps, vm->def, xml,
driver->caps, VIR_DOMAIN_XML_INACTIVE);
vm->def, xml);
qemuDriverUnlock(driver); qemuDriverUnlock(driver);
if (dev == NULL) if (dev == NULL)
goto cleanup; goto cleanup;
...@@ -3361,7 +3363,8 @@ static int qemudDomainDetachDevice(virDomainPtr dom, ...@@ -3361,7 +3363,8 @@ static int qemudDomainDetachDevice(virDomainPtr dom,
goto cleanup; goto cleanup;
} }
dev = virDomainDeviceDefParse(dom->conn, driver->caps, vm->def, xml); dev = virDomainDeviceDefParse(dom->conn, driver->caps, vm->def, xml,
VIR_DOMAIN_XML_INACTIVE);
qemuDriverUnlock(driver); qemuDriverUnlock(driver);
if (dev == NULL) if (dev == NULL)
goto cleanup; goto cleanup;
...@@ -3997,7 +4000,8 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn, ...@@ -3997,7 +4000,8 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
} }
/* Parse the domain XML. */ /* Parse the domain XML. */
if (!(def = virDomainDefParseString(dconn, driver->caps, dom_xml))) { if (!(def = virDomainDefParseString(dconn, driver->caps, dom_xml,
VIR_DOMAIN_XML_INACTIVE))) {
qemudReportError (dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED, qemudReportError (dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
"%s", _("failed to parse XML")); "%s", _("failed to parse XML"));
goto cleanup; goto cleanup;
......
...@@ -242,7 +242,9 @@ static int testOpenDefault(virConnectPtr conn) { ...@@ -242,7 +242,9 @@ static int testOpenDefault(virConnectPtr conn) {
privconn->nextDomID = 1; privconn->nextDomID = 1;
if (!(domdef = virDomainDefParseString(conn, privconn->caps, defaultDomainXML))) if (!(domdef = virDomainDefParseString(conn, privconn->caps,
defaultDomainXML,
VIR_DOMAIN_XML_INACTIVE)))
goto error; goto error;
if (!(domobj = virDomainAssignDef(conn, &privconn->domains, domdef))) { if (!(domobj = virDomainAssignDef(conn, &privconn->domains, domdef))) {
virDomainDefFree(domdef); virDomainDefFree(domdef);
...@@ -719,7 +721,8 @@ testDomainCreateXML(virConnectPtr conn, const char *xml, ...@@ -719,7 +721,8 @@ testDomainCreateXML(virConnectPtr conn, const char *xml,
virDomainObjPtr dom = NULL; virDomainObjPtr dom = NULL;
testDriverLock(privconn); testDriverLock(privconn);
if ((def = virDomainDefParseString(conn, privconn->caps, xml)) == NULL) if ((def = virDomainDefParseString(conn, privconn->caps, xml,
VIR_DOMAIN_XML_INACTIVE)) == NULL)
goto cleanup; goto cleanup;
if ((dom = virDomainAssignDef(conn, &privconn->domains, if ((dom = virDomainAssignDef(conn, &privconn->domains,
...@@ -1211,7 +1214,8 @@ static int testDomainRestore(virConnectPtr conn, ...@@ -1211,7 +1214,8 @@ static int testDomainRestore(virConnectPtr conn,
xml[len] = '\0'; xml[len] = '\0';
testDriverLock(privconn); testDriverLock(privconn);
def = virDomainDefParseString(conn, privconn->caps, xml); def = virDomainDefParseString(conn, privconn->caps, xml,
VIR_DOMAIN_XML_INACTIVE);
if (!def) if (!def)
goto cleanup; goto cleanup;
...@@ -1491,7 +1495,8 @@ static virDomainPtr testDomainDefineXML(virConnectPtr conn, ...@@ -1491,7 +1495,8 @@ static virDomainPtr testDomainDefineXML(virConnectPtr conn,
virDomainObjPtr dom = NULL; virDomainObjPtr dom = NULL;
testDriverLock(privconn); testDriverLock(privconn);
if ((def = virDomainDefParseString(conn, privconn->caps, xml)) == NULL) if ((def = virDomainDefParseString(conn, privconn->caps, xml,
VIR_DOMAIN_XML_INACTIVE)) == NULL)
goto cleanup; goto cleanup;
if ((dom = virDomainAssignDef(conn, &privconn->domains, if ((dom = virDomainAssignDef(conn, &privconn->domains,
......
...@@ -1199,7 +1199,8 @@ static virDomainPtr umlDomainCreate(virConnectPtr conn, const char *xml, ...@@ -1199,7 +1199,8 @@ static virDomainPtr umlDomainCreate(virConnectPtr conn, const char *xml,
virDomainPtr dom = NULL; virDomainPtr dom = NULL;
umlDriverLock(driver); umlDriverLock(driver);
if (!(def = virDomainDefParseString(conn, driver->caps, xml))) if (!(def = virDomainDefParseString(conn, driver->caps, xml,
VIR_DOMAIN_XML_INACTIVE)))
goto cleanup; goto cleanup;
vm = virDomainFindByName(&driver->domains, def->name); vm = virDomainFindByName(&driver->domains, def->name);
...@@ -1574,7 +1575,8 @@ static virDomainPtr umlDomainDefine(virConnectPtr conn, const char *xml) { ...@@ -1574,7 +1575,8 @@ static virDomainPtr umlDomainDefine(virConnectPtr conn, const char *xml) {
virDomainPtr dom = NULL; virDomainPtr dom = NULL;
umlDriverLock(driver); umlDriverLock(driver);
if (!(def = virDomainDefParseString(conn, driver->caps, xml))) if (!(def = virDomainDefParseString(conn, driver->caps, xml,
VIR_DOMAIN_XML_INACTIVE)))
goto cleanup; goto cleanup;
if (!(vm = virDomainAssignDef(conn, if (!(vm = virDomainAssignDef(conn,
......
...@@ -3772,7 +3772,8 @@ xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc, ...@@ -3772,7 +3772,8 @@ xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc,
if (!(def = virDomainDefParseString(conn, if (!(def = virDomainDefParseString(conn,
priv->caps, priv->caps,
xmlDesc))) xmlDesc,
VIR_DOMAIN_XML_INACTIVE)))
return (NULL); return (NULL);
if (!(sexpr = xenDaemonFormatSxpr(conn, def, priv->xendConfigVersion))) { if (!(sexpr = xenDaemonFormatSxpr(conn, def, priv->xendConfigVersion))) {
...@@ -4248,7 +4249,8 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) { ...@@ -4248,7 +4249,8 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) {
if (priv->xendConfigVersion < 3) if (priv->xendConfigVersion < 3)
return(NULL); return(NULL);
if (!(def = virDomainDefParseString(conn, priv->caps, xmlDesc))) { if (!(def = virDomainDefParseString(conn, priv->caps, xmlDesc,
VIR_DOMAIN_XML_INACTIVE))) {
virXendError(conn, VIR_ERR_XML_ERROR, virXendError(conn, VIR_ERR_XML_ERROR,
"%s", _("failed to parse domain description")); "%s", _("failed to parse domain description"));
return (NULL); return (NULL);
......
...@@ -32,7 +32,8 @@ static int testCompareXMLToXMLFiles(const char *xml) { ...@@ -32,7 +32,8 @@ static int testCompareXMLToXMLFiles(const char *xml) {
if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0) if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0)
goto fail; goto fail;
if (!(vmdef = virDomainDefParseString(NULL, driver.caps, xmlData))) if (!(vmdef = virDomainDefParseString(NULL, driver.caps, xmlData,
VIR_DOMAIN_XML_INACTIVE)))
goto fail; goto fail;
if (!(actual = virDomainDefFormat(NULL, vmdef, 0))) if (!(actual = virDomainDefFormat(NULL, vmdef, 0)))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册