mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
conf: Add post XML parse callbacks and prepare for cleaning of virCaps
This patch adds instrumentation that will allow hypervisor drivers to fill and validate domain and device definitions after parsed by the XML parser. With this patch, after the XML is parsed, a callback to the driver is issued requesting to fill and validate driver specific details of the configuration. This allows to use sensible defaults and checks on a per driver basis at the time the XML is parsed. Two callback pointers are stored in the new virDomainXMLConf object: * virDomainDeviceDefPostParseCallback (devicesPostParseCallback) - called for a single device parsed and for every single device in a domain config. A virDomainDeviceDefPtr is passed along with the domain definition and virCaps. * virDomainDefPostParseCallback, (domainPostParseCallback) - A callback that is meant to process the domain config after it's parsed. A virDomainDefPtr is passed along with virCaps. Both types of callbacks support arbitrary opaque data passed for the callback functions. Errors may be reported in those callbacks resulting in a XML parsing failure.
This commit is contained in:
parent
e84b19316a
commit
43b99fc4c0
@ -73,6 +73,9 @@ struct _virDomainObjList {
|
||||
struct _virDomainXMLOption {
|
||||
virObject parent;
|
||||
|
||||
/* XML parser callbacks and defaults */
|
||||
virDomainDefParserConfig config;
|
||||
|
||||
/* domain private data management callbacks */
|
||||
virDomainXMLPrivateDataCallbacks privateData;
|
||||
|
||||
@ -723,6 +726,7 @@ static virClassPtr virDomainObjListClass;
|
||||
static virClassPtr virDomainXMLOptionClass;
|
||||
static void virDomainObjDispose(void *obj);
|
||||
static void virDomainObjListDispose(void *obj);
|
||||
static void virDomainXMLOptionClassDispose(void *obj);
|
||||
|
||||
static int virDomainObjOnceInit(void)
|
||||
{
|
||||
@ -741,7 +745,7 @@ static int virDomainObjOnceInit(void)
|
||||
if (!(virDomainXMLOptionClass = virClassNew(virClassForObject(),
|
||||
"virDomainXMLOption",
|
||||
sizeof(virDomainXMLOption),
|
||||
NULL)))
|
||||
virDomainXMLOptionClassDispose)))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@ -750,13 +754,24 @@ static int virDomainObjOnceInit(void)
|
||||
VIR_ONCE_GLOBAL_INIT(virDomainObj)
|
||||
|
||||
|
||||
static void
|
||||
virDomainXMLOptionClassDispose(void *obj)
|
||||
{
|
||||
virDomainXMLOptionPtr xmlopt = obj;
|
||||
|
||||
if (xmlopt->config.privFree)
|
||||
(xmlopt->config.privFree)(xmlopt->config.priv);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virDomainXMLOptionNew:
|
||||
*
|
||||
* Allocate a new domain XML configuration
|
||||
*/
|
||||
virDomainXMLOptionPtr
|
||||
virDomainXMLOptionNew(virDomainXMLPrivateDataCallbacksPtr priv,
|
||||
virDomainXMLOptionNew(virDomainDefParserConfigPtr config,
|
||||
virDomainXMLPrivateDataCallbacksPtr priv,
|
||||
virDomainXMLNamespacePtr xmlns)
|
||||
{
|
||||
virDomainXMLOptionPtr xmlopt;
|
||||
@ -770,6 +785,9 @@ virDomainXMLOptionNew(virDomainXMLPrivateDataCallbacksPtr priv,
|
||||
if (priv)
|
||||
xmlopt->privateData = *priv;
|
||||
|
||||
if (config)
|
||||
xmlopt->config = *config;
|
||||
|
||||
if (xmlns)
|
||||
xmlopt->ns = *xmlns;
|
||||
|
||||
@ -2461,6 +2479,73 @@ int virDomainDeviceInfoIterate(virDomainDefPtr def,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||
virDomainDefPtr def,
|
||||
virCapsPtr caps,
|
||||
virDomainXMLOptionPtr xmlopt)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (xmlopt && xmlopt->config.devicesPostParseCallback) {
|
||||
ret = xmlopt->config.devicesPostParseCallback(dev, def, caps,
|
||||
xmlopt->config.priv);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
struct virDomainDefPostParseDeviceIteratorData {
|
||||
virDomainDefPtr def;
|
||||
virCapsPtr caps;
|
||||
virDomainXMLOptionPtr xmlopt;
|
||||
};
|
||||
|
||||
|
||||
static int
|
||||
virDomainDefPostParseDeviceIterator(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
||||
virDomainDeviceDefPtr dev,
|
||||
virDomainDeviceInfoPtr info ATTRIBUTE_UNUSED,
|
||||
void *opaque)
|
||||
{
|
||||
struct virDomainDefPostParseDeviceIteratorData *data = opaque;
|
||||
return virDomainDeviceDefPostParse(dev, data->def, data->caps, data->xmlopt);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virDomainDefPostParse(virDomainDefPtr def,
|
||||
virCapsPtr caps,
|
||||
virDomainXMLOptionPtr xmlopt)
|
||||
{
|
||||
int ret;
|
||||
struct virDomainDefPostParseDeviceIteratorData data = {
|
||||
.def = def,
|
||||
.caps = caps,
|
||||
.xmlopt = xmlopt,
|
||||
};
|
||||
|
||||
/* call the domain config callback */
|
||||
if (xmlopt && xmlopt->config.domainPostParseCallback) {
|
||||
ret = xmlopt->config.domainPostParseCallback(def, caps,
|
||||
xmlopt->config.priv);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* iterate the devices */
|
||||
if ((ret = virDomainDeviceInfoIterate(def,
|
||||
virDomainDefPostParseDeviceIterator,
|
||||
&data)) < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void virDomainDefClearPCIAddresses(virDomainDefPtr def)
|
||||
{
|
||||
virDomainDeviceInfoIterate(def, virDomainDeviceInfoClearPCIAddress, NULL);
|
||||
@ -8386,6 +8471,7 @@ virDomainPMStateParseXML(xmlXPathContextPtr ctxt,
|
||||
|
||||
virDomainDeviceDefPtr
|
||||
virDomainDeviceDefParse(virCapsPtr caps,
|
||||
virDomainXMLOptionPtr xmlopt,
|
||||
virDomainDefPtr def,
|
||||
const char *xmlStr,
|
||||
unsigned int flags)
|
||||
@ -8472,6 +8558,10 @@ virDomainDeviceDefParse(virCapsPtr caps,
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* callback to fill driver specific device aspects */
|
||||
if (virDomainDeviceDefPostParse(dev, def, caps, xmlopt) < 0)
|
||||
goto error;
|
||||
|
||||
cleanup:
|
||||
xmlFreeDoc(xml);
|
||||
xmlXPathFreeContext(ctxt);
|
||||
@ -11029,6 +11119,10 @@ virDomainDefParseXML(virCapsPtr caps,
|
||||
if (virDomainDefAddImplicitControllers(def) < 0)
|
||||
goto error;
|
||||
|
||||
/* callback to fill driver specific domain aspects */
|
||||
if (virDomainDefPostParse(def, caps, xmlopt) < 0)
|
||||
goto error;
|
||||
|
||||
virBitmapFree(bootMap);
|
||||
|
||||
return def;
|
||||
@ -16426,6 +16520,7 @@ virDomainNetFind(virDomainDefPtr def, const char *device)
|
||||
*/
|
||||
virDomainDeviceDefPtr
|
||||
virDomainDeviceDefCopy(virCapsPtr caps,
|
||||
virDomainXMLOptionPtr xmlopt,
|
||||
const virDomainDefPtr def,
|
||||
virDomainDeviceDefPtr src)
|
||||
{
|
||||
@ -16494,7 +16589,7 @@ virDomainDeviceDefCopy(virCapsPtr caps,
|
||||
goto cleanup;
|
||||
|
||||
xmlStr = virBufferContentAndReset(&buf);
|
||||
ret = virDomainDeviceDefParse(caps, def, xmlStr, flags);
|
||||
ret = virDomainDeviceDefParse(caps, xmlopt, def, xmlStr, flags);
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(xmlStr);
|
||||
|
@ -1938,6 +1938,24 @@ typedef void (*virDomainXMLPrivateDataFreeFunc)(void *);
|
||||
typedef int (*virDomainXMLPrivateDataFormatFunc)(virBufferPtr, void *);
|
||||
typedef int (*virDomainXMLPrivateDataParseFunc)(xmlXPathContextPtr, void *);
|
||||
|
||||
typedef int (*virDomainDefPostParseCallback)(virDomainDefPtr def,
|
||||
virCapsPtr caps,
|
||||
void *opaque);
|
||||
typedef int (*virDomainDeviceDefPostParseCallback)(virDomainDeviceDefPtr dev,
|
||||
virDomainDefPtr def,
|
||||
virCapsPtr caps,
|
||||
void *opaque);
|
||||
|
||||
typedef struct _virDomainDefParserConfig virDomainDefParserConfig;
|
||||
typedef virDomainDefParserConfig *virDomainDefParserConfigPtr;
|
||||
struct _virDomainDefParserConfig {
|
||||
virDomainDefPostParseCallback domainPostParseCallback;
|
||||
virDomainDeviceDefPostParseCallback devicesPostParseCallback;
|
||||
|
||||
void *priv;
|
||||
virFreeCallback privFree;
|
||||
};
|
||||
|
||||
typedef struct _virDomainXMLPrivateDataCallbacks virDomainXMLPrivateDataCallbacks;
|
||||
typedef virDomainXMLPrivateDataCallbacks *virDomainXMLPrivateDataCallbacksPtr;
|
||||
struct _virDomainXMLPrivateDataCallbacks {
|
||||
@ -1947,9 +1965,9 @@ struct _virDomainXMLPrivateDataCallbacks {
|
||||
virDomainXMLPrivateDataParseFunc parse;
|
||||
};
|
||||
|
||||
virDomainXMLOptionPtr
|
||||
virDomainXMLOptionNew(virDomainXMLPrivateDataCallbacksPtr priv,
|
||||
virDomainXMLNamespacePtr xmlns);
|
||||
virDomainXMLOptionPtr virDomainXMLOptionNew(virDomainDefParserConfigPtr config,
|
||||
virDomainXMLPrivateDataCallbacksPtr priv,
|
||||
virDomainXMLNamespacePtr xmlns);
|
||||
|
||||
virDomainXMLNamespacePtr
|
||||
virDomainXMLOptionGetNamespace(virDomainXMLOptionPtr xmlopt)
|
||||
@ -2009,6 +2027,7 @@ void virDomainRedirdevDefFree(virDomainRedirdevDefPtr def);
|
||||
void virDomainRedirFilterDefFree(virDomainRedirFilterDefPtr def);
|
||||
void virDomainDeviceDefFree(virDomainDeviceDefPtr def);
|
||||
virDomainDeviceDefPtr virDomainDeviceDefCopy(virCapsPtr caps,
|
||||
virDomainXMLOptionPtr xmlopt,
|
||||
const virDomainDefPtr def,
|
||||
virDomainDeviceDefPtr src);
|
||||
int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
|
||||
@ -2072,6 +2091,7 @@ void virDomainObjListRemove(virDomainObjListPtr doms,
|
||||
virDomainObjPtr dom);
|
||||
|
||||
virDomainDeviceDefPtr virDomainDeviceDefParse(virCapsPtr caps,
|
||||
virDomainXMLOptionPtr xmlopt,
|
||||
virDomainDefPtr def,
|
||||
const char *xmlStr,
|
||||
unsigned int flags);
|
||||
|
@ -1100,7 +1100,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(priv->xmlopt = virDomainXMLOptionNew(NULL, NULL)))
|
||||
if (!(priv->xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL)))
|
||||
goto cleanup;
|
||||
|
||||
conn->privateData = priv;
|
||||
|
@ -1239,8 +1239,9 @@ libxlStartup(bool privileged,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!(libxl_driver->xmlopt = virDomainXMLOptionNew(&libxlDomainXMLPrivateDataCallbacks,
|
||||
NULL)))
|
||||
if (!(libxl_driver->xmlopt = virDomainXMLOptionNew(NULL,
|
||||
&libxlDomainXMLPrivateDataCallbacks,
|
||||
NULL)))
|
||||
goto error;
|
||||
|
||||
/* Load running domains first. */
|
||||
@ -3556,7 +3557,8 @@ libxlDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
priv = vm->privateData;
|
||||
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
|
||||
if (!(dev = virDomainDeviceDefParse(driver->caps, vm->def, xml,
|
||||
if (!(dev = virDomainDeviceDefParse(driver->caps, driver->xmlopt,
|
||||
vm->def, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
@ -3586,7 +3588,8 @@ libxlDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
|
||||
/* If dev exists it was created to modify the domain config. Free it. */
|
||||
virDomainDeviceDefFree(dev);
|
||||
if (!(dev = virDomainDeviceDefParse(driver->caps, vm->def, xml,
|
||||
if (!(dev = virDomainDeviceDefParse(driver->caps, driver->xmlopt,
|
||||
vm->def, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
|
@ -159,7 +159,9 @@ error:
|
||||
virDomainXMLOptionPtr
|
||||
lxcDomainXMLConfInit(void)
|
||||
{
|
||||
return virDomainXMLOptionNew(&virLXCDriverPrivateDataCallbacks, NULL);
|
||||
return virDomainXMLOptionNew(NULL,
|
||||
&virLXCDriverPrivateDataCallbacks,
|
||||
NULL);
|
||||
}
|
||||
|
||||
int lxcLoadDriverConfig(virLXCDriverPtr driver)
|
||||
|
@ -4353,7 +4353,8 @@ lxcDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
dev = dev_copy = virDomainDeviceDefParse(driver->caps, vm->def, xml,
|
||||
dev = dev_copy = virDomainDeviceDefParse(driver->caps, driver->xmlopt,
|
||||
vm->def, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
if (dev == NULL)
|
||||
goto cleanup;
|
||||
@ -4364,7 +4365,8 @@ lxcDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
* create a deep copy of device as adding
|
||||
* to CONFIG takes one instance.
|
||||
*/
|
||||
dev_copy = virDomainDeviceDefCopy(driver->caps, vm->def, dev);
|
||||
dev_copy = virDomainDeviceDefCopy(driver->caps, driver->xmlopt,
|
||||
vm->def, dev);
|
||||
if (!dev_copy)
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -174,6 +174,7 @@ static int openvzDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
|
||||
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ;
|
||||
}
|
||||
|
||||
|
||||
virCapsPtr openvzCapsInit(void)
|
||||
{
|
||||
virCapsPtr caps;
|
||||
|
@ -1453,7 +1453,7 @@ static virDrvOpenStatus openvzOpen(virConnectPtr conn,
|
||||
if (!(driver->caps = openvzCapsInit()))
|
||||
goto cleanup;
|
||||
|
||||
if (!(driver->xmlopt = virDomainXMLOptionNew(NULL, NULL)))
|
||||
if (!(driver->xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL)))
|
||||
goto cleanup;
|
||||
|
||||
if (openvzLoadDomains(driver) < 0)
|
||||
@ -2085,8 +2085,8 @@ openvzDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
&vmdef) < 0)
|
||||
goto cleanup;
|
||||
|
||||
dev = virDomainDeviceDefParse(driver->caps, vmdef, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
dev = virDomainDeviceDefParse(driver->caps, driver->xmlopt,
|
||||
vmdef, xml, VIR_DOMAIN_XML_INACTIVE);
|
||||
if (!dev)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -929,7 +929,7 @@ parallelsOpenDefault(virConnectPtr conn)
|
||||
if (!(privconn->caps = parallelsBuildCapabilities()))
|
||||
goto error;
|
||||
|
||||
if (!(privconn->xmlopt = virDomainXMLOptionNew(NULL, NULL)))
|
||||
if (!(privconn->xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL)))
|
||||
goto error;
|
||||
|
||||
if (!(privconn->domains = virDomainObjListNew()))
|
||||
|
@ -1204,7 +1204,7 @@ phypOpen(virConnectPtr conn,
|
||||
goto failure;
|
||||
}
|
||||
|
||||
if (!(phyp_driver->xmlopt = virDomainXMLOptionNew(NULL, NULL)))
|
||||
if (!(phyp_driver->xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL)))
|
||||
goto failure;
|
||||
|
||||
conn->privateData = phyp_driver;
|
||||
@ -1754,8 +1754,8 @@ phypAttachDevice(virDomainPtr domain, const char *xml)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
dev = virDomainDeviceDefParse(phyp_driver->caps, def, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
dev = virDomainDeviceDefParse(phyp_driver->caps, NULL,
|
||||
def, xml, VIR_DOMAIN_XML_INACTIVE);
|
||||
if (!dev) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -554,8 +554,9 @@ virQEMUDriverConfigPtr virQEMUDriverGetConfig(virQEMUDriverPtr driver)
|
||||
virDomainXMLOptionPtr
|
||||
virQEMUDriverCreateXMLConf(void)
|
||||
{
|
||||
return virDomainXMLOptionNew(&virQEMUDriverPrivateDataCallbacks,
|
||||
&virQEMUDriverDomainXMLNamespace);
|
||||
return virDomainXMLOptionNew(NULL,
|
||||
&virQEMUDriverPrivateDataCallbacks,
|
||||
&virQEMUDriverDomainXMLNamespace);
|
||||
}
|
||||
|
||||
|
||||
|
@ -5786,7 +5786,8 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn,
|
||||
tmp = dev->data.disk;
|
||||
dev->data.disk = orig_disk;
|
||||
|
||||
if (!(dev_copy = virDomainDeviceDefCopy(caps, vm->def, dev))) {
|
||||
if (!(dev_copy = virDomainDeviceDefCopy(caps, driver->xmlopt,
|
||||
vm->def, dev))) {
|
||||
dev->data.disk = tmp;
|
||||
goto end;
|
||||
}
|
||||
@ -6062,7 +6063,8 @@ qemuDomainChangeDiskMediaLive(virDomainObjPtr vm,
|
||||
tmp = dev->data.disk;
|
||||
dev->data.disk = orig_disk;
|
||||
|
||||
if (!(dev_copy = virDomainDeviceDefCopy(caps, vm->def, dev))) {
|
||||
if (!(dev_copy = virDomainDeviceDefCopy(caps, driver->xmlopt,
|
||||
vm->def, dev))) {
|
||||
dev->data.disk = tmp;
|
||||
goto end;
|
||||
}
|
||||
@ -6468,7 +6470,8 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
dev = dev_copy = virDomainDeviceDefParse(caps, vm->def, xml,
|
||||
dev = dev_copy = virDomainDeviceDefParse(caps, driver->xmlopt,
|
||||
vm->def, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
if (dev == NULL)
|
||||
goto endjob;
|
||||
@ -6479,7 +6482,7 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
* create a deep copy of device as adding
|
||||
* to CONFIG takes one instance.
|
||||
*/
|
||||
dev_copy = virDomainDeviceDefCopy(caps, vm->def, dev);
|
||||
dev_copy = virDomainDeviceDefCopy(caps, driver->xmlopt, vm->def, dev);
|
||||
if (!dev_copy)
|
||||
goto endjob;
|
||||
}
|
||||
|
@ -711,7 +711,7 @@ get_definition(vahControl * ctl, const char *xmlStr)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!(ctl->xmlopt = virDomainXMLOptionNew(NULL, NULL))) {
|
||||
if (!(ctl->xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL))) {
|
||||
vah_error(ctl, 0, _("Failed to create XML config object"));
|
||||
goto exit;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ testBuildXMLConfig(void)
|
||||
{
|
||||
virDomainXMLPrivateDataCallbacks priv = { .alloc = testDomainObjPrivateAlloc,
|
||||
.free = testDomainObjPrivateFree };
|
||||
return virDomainXMLOptionNew(&priv, NULL);
|
||||
return virDomainXMLOptionNew(NULL, &priv, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -505,8 +505,7 @@ umlStartup(bool privileged,
|
||||
if ((uml_driver->caps = umlCapsInit()) == NULL)
|
||||
goto out_of_memory;
|
||||
|
||||
if (!(uml_driver->xmlopt = virDomainXMLOptionNew(&privcb,
|
||||
NULL)))
|
||||
if (!(uml_driver->xmlopt = virDomainXMLOptionNew(NULL, &privcb, NULL)))
|
||||
goto error;
|
||||
|
||||
if ((uml_driver->inotifyFD = inotify_init()) < 0) {
|
||||
@ -2081,7 +2080,7 @@ static int umlDomainAttachDevice(virDomainPtr dom, const char *xml)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
dev = virDomainDeviceDefParse(driver->caps, vm->def, xml,
|
||||
dev = virDomainDeviceDefParse(driver->caps, driver->xmlopt, vm->def, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
|
||||
if (dev == NULL)
|
||||
@ -2199,7 +2198,7 @@ static int umlDomainDetachDevice(virDomainPtr dom, const char *xml) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
dev = virDomainDeviceDefParse(driver->caps, vm->def, xml,
|
||||
dev = virDomainDeviceDefParse(driver->caps, driver->xmlopt, vm->def, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
if (dev == NULL)
|
||||
goto cleanup;
|
||||
|
@ -854,7 +854,7 @@ static int vboxDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
|
||||
static virDomainXMLOptionPtr
|
||||
vboxXMLConfInit(void)
|
||||
{
|
||||
return virDomainXMLOptionNew(NULL, NULL);
|
||||
return virDomainXMLOptionNew(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -5396,8 +5396,8 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
dev = virDomainDeviceDefParse(data->caps, def, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
dev = virDomainDeviceDefParse(data->caps, data->xmlopt,
|
||||
def, xml, VIR_DOMAIN_XML_INACTIVE);
|
||||
if (dev == NULL)
|
||||
goto cleanup;
|
||||
|
||||
@ -5631,8 +5631,8 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
dev = virDomainDeviceDefParse(data->caps, def, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
dev = virDomainDeviceDefParse(data->caps, data->xmlopt,
|
||||
def, xml, VIR_DOMAIN_XML_INACTIVE);
|
||||
if (dev == NULL)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -78,7 +78,7 @@ vmwareDomainXMLConfigInit(void)
|
||||
virDomainXMLPrivateDataCallbacks priv = { .alloc = vmwareDataAllocFunc,
|
||||
.free = vmwareDataFreeFunc };
|
||||
|
||||
return virDomainXMLOptionNew(&priv, NULL);
|
||||
return virDomainXMLOptionNew(NULL, &priv, NULL);
|
||||
}
|
||||
|
||||
static virDrvOpenStatus
|
||||
|
@ -401,7 +401,7 @@ xenUnifiedOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(priv->xmlopt = virDomainXMLOptionNew(NULL, NULL)))
|
||||
if (!(priv->xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL)))
|
||||
goto fail;
|
||||
|
||||
#if WITH_XEN_INOTIFY
|
||||
|
@ -2519,7 +2519,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain,
|
||||
NULL)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(dev = virDomainDeviceDefParse(priv->caps,
|
||||
if (!(dev = virDomainDeviceDefParse(priv->caps, priv->xmlopt,
|
||||
def, xml, VIR_DOMAIN_XML_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
@ -2679,7 +2679,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain,
|
||||
NULL)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(dev = virDomainDeviceDefParse(priv->caps,
|
||||
if (!(dev = virDomainDeviceDefParse(priv->caps, priv->xmlopt,
|
||||
def, xml, VIR_DOMAIN_XML_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
@ -2786,7 +2786,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain,
|
||||
NULL)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(dev = virDomainDeviceDefParse(priv->caps,
|
||||
if (!(dev = virDomainDeviceDefParse(priv->caps, priv->xmlopt,
|
||||
def, xml, VIR_DOMAIN_XML_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
|
@ -1311,6 +1311,7 @@ xenXMDomainAttachDeviceFlags(virDomainPtr domain,
|
||||
def = entry->def;
|
||||
|
||||
if (!(dev = virDomainDeviceDefParse(priv->caps,
|
||||
priv->xmlopt,
|
||||
entry->def,
|
||||
xml, VIR_DOMAIN_XML_INACTIVE)))
|
||||
goto cleanup;
|
||||
@ -1404,6 +1405,7 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain,
|
||||
def = entry->def;
|
||||
|
||||
if (!(dev = virDomainDeviceDefParse(priv->caps,
|
||||
priv->xmlopt,
|
||||
entry->def,
|
||||
xml, VIR_DOMAIN_XML_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
@ -169,7 +169,7 @@ xenapiOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!(privP->xmlopt = virDomainXMLOptionNew(NULL, NULL))) {
|
||||
if (!(privP->xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL))) {
|
||||
xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to create XML conf object"));
|
||||
goto error;
|
||||
|
@ -18,7 +18,7 @@ static int testXenDefaultConsoleType(const char *ostype,
|
||||
virDomainXMLOptionPtr
|
||||
testXenXMLConfInit(void)
|
||||
{
|
||||
return virDomainXMLOptionNew(NULL, NULL);
|
||||
return virDomainXMLOptionNew(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
virCapsPtr testXenCapsInit(void) {
|
||||
|
@ -240,7 +240,7 @@ mymain(void)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!(xmlopt = virDomainXMLOptionNew(NULL, NULL)))
|
||||
if (!(xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL)))
|
||||
return EXIT_FAILURE;
|
||||
|
||||
ctx.opaque = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user