[libvirt] [PATCH 07/11] conf: Add private data for virDomainVcpuDef

Peter Krempa pkrempa at redhat.com
Thu Jul 7 13:41:04 UTC 2016


Allow to store driver specific data on a per-vcpu basis.

Move of the virDomainDef*Vcpus* functions was necessary as
virDomainXMLOptionPtr was declared below this block and I didn't want to
split the function headers.
---
 src/conf/domain_conf.c        | 28 +++++++++++++++++++++-------
 src/conf/domain_conf.h        | 22 ++++++++++++++--------
 src/hyperv/hyperv_driver.c    |  3 ++-
 src/libxl/libxl_driver.c      |  4 ++--
 src/lxc/lxc_native.c          |  2 +-
 src/openvz/openvz_conf.c      |  2 +-
 src/openvz/openvz_driver.c    | 16 ++++++++++------
 src/phyp/phyp_driver.c        |  2 +-
 src/qemu/qemu_driver.c        |  2 +-
 src/qemu/qemu_parse_command.c |  9 +++++----
 src/test/test_driver.c        |  4 +++-
 src/vbox/vbox_common.c        |  4 ++--
 src/vmx/vmx.c                 |  2 +-
 src/xen/xm_internal.c         |  2 +-
 src/xenapi/xenapi_driver.c    |  2 +-
 src/xenconfig/xen_common.c    | 13 ++++++++-----
 src/xenconfig/xen_common.h    |  3 ++-
 src/xenconfig/xen_sxpr.c      |  2 +-
 src/xenconfig/xen_xl.c        |  3 ++-
 src/xenconfig/xen_xm.c        |  3 ++-
 20 files changed, 81 insertions(+), 47 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c2d7259..e660f8e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1307,12 +1307,23 @@ void virDomainLeaseDefFree(virDomainLeaseDefPtr def)


 static virDomainVcpuDefPtr
-virDomainVcpuDefNew(void)
+virDomainVcpuDefNew(virDomainXMLOptionPtr xmlopt)
 {
+    virObjectPtr priv = NULL;
     virDomainVcpuDefPtr ret;

-    ignore_value(VIR_ALLOC(ret));
+    if (xmlopt && xmlopt->privateData.vcpuNew &&
+        !(priv = xmlopt->privateData.vcpuNew()))
+        goto cleanup;
+
+    if (VIR_ALLOC(ret) < 0)
+        goto cleanup;
+
+    ret->privateData = priv;
+    priv = NULL;

+ cleanup:
+    virObjectUnref(priv);
     return ret;
 }

@@ -1325,13 +1336,15 @@ virDomainVcpuDefFree(virDomainVcpuDefPtr info)

     virBitmapFree(info->cpumask);
     info->cpumask = NULL;
+    virObjectUnref(info->privateData);
     VIR_FREE(info);
 }


 int
 virDomainDefSetVcpusMax(virDomainDefPtr def,
-                        unsigned int maxvcpus)
+                        unsigned int maxvcpus,
+                        virDomainXMLOptionPtr xmlopt)
 {
     size_t oldmax = def->maxvcpus;
     size_t i;
@@ -1344,7 +1357,7 @@ virDomainDefSetVcpusMax(virDomainDefPtr def,
             return -1;

         for (i = oldmax; i < def->maxvcpus; i++) {
-            if (!(def->vcpus[i] = virDomainVcpuDefNew()))
+            if (!(def->vcpus[i] = virDomainVcpuDefNew(xmlopt)))
                 return -1;
         }
     } else {
@@ -15465,7 +15478,8 @@ virDomainIOThreadSchedParse(xmlNodePtr node,

 static int
 virDomainVcpuParse(virDomainDefPtr def,
-                   xmlXPathContextPtr ctxt)
+                   xmlXPathContextPtr ctxt,
+                   virDomainXMLOptionPtr xmlopt)
 {
     int n;
     char *tmp = NULL;
@@ -15483,7 +15497,7 @@ virDomainVcpuParse(virDomainDefPtr def,
         maxvcpus = 1;
     }

-    if (virDomainDefSetVcpusMax(def, maxvcpus) < 0)
+    if (virDomainDefSetVcpusMax(def, maxvcpus, xmlopt) < 0)
         goto cleanup;

     if ((n = virXPathUInt("string(./vcpu[1]/@current)", ctxt, &vcpus)) < 0) {
@@ -15952,7 +15966,7 @@ virDomainDefParseXML(xmlDocPtr xml,
                                   &def->mem.swap_hard_limit) < 0)
         goto error;

-    if (virDomainVcpuParse(def, ctxt) < 0)
+    if (virDomainVcpuParse(def, ctxt, xmlopt) < 0)
         goto error;

     /* Optional - iothreads */
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3fd6c07..c34fc50 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2037,6 +2037,8 @@ struct _virDomainVcpuDef {
     virBitmapPtr cpumask;

     virDomainThreadSchedParam sched;
+
+    virObjectPtr privateData;
 };

 typedef struct _virDomainBlkiotune virDomainBlkiotune;
@@ -2245,14 +2247,6 @@ struct _virDomainDef {
     xmlNodePtr metadata;
 };

-int virDomainDefSetVcpusMax(virDomainDefPtr def, unsigned int vcpus);
-bool virDomainDefHasVcpusOffline(const virDomainDef *def);
-unsigned int virDomainDefGetVcpusMax(const virDomainDef *def);
-int virDomainDefSetVcpus(virDomainDefPtr def, unsigned int vcpus);
-unsigned int virDomainDefGetVcpus(const virDomainDef *def);
-virBitmapPtr virDomainDefGetOnlineVcpumap(const virDomainDef *def);
-virDomainVcpuDefPtr virDomainDefGetVcpu(virDomainDefPtr def, unsigned int vcpu)
-    ATTRIBUTE_RETURN_CHECK;

 unsigned long long virDomainDefGetMemoryInitial(const virDomainDef *def);
 void virDomainDefSetMemoryTotal(virDomainDefPtr def, unsigned long long size);
@@ -2408,6 +2402,7 @@ struct _virDomainXMLPrivateDataCallbacks {
      * virDomainDefCopy and similar functions */
     virDomainXMLPrivateDataNewFunc    diskNew;
     virDomainXMLPrivateDataNewFunc    hostdevNew;
+    virDomainXMLPrivateDataNewFunc    vcpuNew;
     virDomainXMLPrivateDataFormatFunc format;
     virDomainXMLPrivateDataParseFunc  parse;
 };
@@ -2439,6 +2434,17 @@ virDomainObjIsActive(virDomainObjPtr dom)
     return dom->def->id != -1;
 }

+int virDomainDefSetVcpusMax(virDomainDefPtr def,
+                            unsigned int vcpus,
+                            virDomainXMLOptionPtr xmlopt);
+bool virDomainDefHasVcpusOffline(const virDomainDef *def);
+unsigned int virDomainDefGetVcpusMax(const virDomainDef *def);
+int virDomainDefSetVcpus(virDomainDefPtr def, unsigned int vcpus);
+unsigned int virDomainDefGetVcpus(const virDomainDef *def);
+virBitmapPtr virDomainDefGetOnlineVcpumap(const virDomainDef *def);
+virDomainVcpuDefPtr virDomainDefGetVcpu(virDomainDefPtr def, unsigned int vcpu)
+    ATTRIBUTE_RETURN_CHECK;
+
 virDomainObjPtr virDomainObjNew(virDomainXMLOptionPtr caps)
     ATTRIBUTE_NONNULL(1);

diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 9c7faf0..b642a02 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -876,7 +876,8 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
     def->mem.cur_balloon = memorySettingData->data->VirtualQuantity * 1024; /* megabyte to kilobyte */

     if (virDomainDefSetVcpusMax(def,
-                                processorSettingData->data->VirtualQuantity) < 0)
+                                processorSettingData->data->VirtualQuantity,
+                                NULL) < 0)
         goto cleanup;

     if (virDomainDefSetVcpus(def,
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 0e762f3..f153f69 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -557,7 +557,7 @@ libxlAddDom0(libxlDriverPrivatePtr driver)
     def = NULL;

     virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED);
-    if (virDomainDefSetVcpusMax(vm->def, d_info.vcpu_max_id + 1))
+    if (virDomainDefSetVcpusMax(vm->def, d_info.vcpu_max_id + 1, driver->xmlopt))
         goto cleanup;

     if (virDomainDefSetVcpus(vm->def, d_info.vcpu_online) < 0)
@@ -2182,7 +2182,7 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,

     switch (flags) {
     case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_CONFIG:
-        if (virDomainDefSetVcpusMax(def, nvcpus) < 0)
+        if (virDomainDefSetVcpusMax(def, nvcpus, driver->xmlopt) < 0)
             goto cleanup;
         break;

diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index acbc20b..a34204e 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -1020,7 +1020,7 @@ lxcParseConfigString(const char *config,

     /* Value not handled by the LXC driver, setting to
      * minimum required to make XML parsing pass */
-    if (virDomainDefSetVcpusMax(vmdef, 1) < 0)
+    if (virDomainDefSetVcpusMax(vmdef, 1, xmlopt) < 0)
         goto error;

     if (virDomainDefSetVcpus(vmdef, 1) < 0)
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 50f4902..99ce95c 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -572,7 +572,7 @@ int openvzLoadDomains(struct openvz_driver *driver)
         if (ret == 0 || vcpus == 0)
             vcpus = openvzGetNodeCPUs();

-        if (virDomainDefSetVcpusMax(def, vcpus) < 0)
+        if (virDomainDefSetVcpusMax(def, vcpus, driver->xmlopt) < 0)
             goto cleanup;

         if (virDomainDefSetVcpus(def, vcpus) < 0)
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 844193a..f9a89cf 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -70,7 +70,8 @@ static int openvzGetProcessInfo(unsigned long long *cpuTime, int vpsid);
 static int openvzConnectGetMaxVcpus(virConnectPtr conn, const char *type);
 static int openvzDomainGetMaxVcpus(virDomainPtr dom);
 static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
-                                        unsigned int nvcpus);
+                                        unsigned int nvcpus,
+                                        virDomainXMLOptionPtr xmlopt);
 static int openvzDomainSetMemoryInternal(virDomainObjPtr vm,
                                          unsigned long long memory);
 static int openvzGetVEStatus(virDomainObjPtr vm, int *status, int *reason);
@@ -1032,7 +1033,8 @@ openvzDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int fla
         goto cleanup;
     }
     if (virDomainDefGetVcpusMax(vm->def)) {
-        if (openvzDomainSetVcpusInternal(vm, virDomainDefGetVcpusMax(vm->def)) < 0) {
+        if (openvzDomainSetVcpusInternal(vm, virDomainDefGetVcpusMax(vm->def),
+                                         driver->xmlopt) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("Could not set number of vCPUs"));
              goto cleanup;
@@ -1130,7 +1132,8 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
     virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED);

     if (virDomainDefGetVcpusMax(vm->def) > 0) {
-        if (openvzDomainSetVcpusInternal(vm, virDomainDefGetVcpusMax(vm->def)) < 0) {
+        if (openvzDomainSetVcpusInternal(vm, virDomainDefGetVcpusMax(vm->def),
+                                         driver->xmlopt) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("Could not set number of vCPUs"));
             goto cleanup;
@@ -1347,7 +1350,8 @@ static int openvzDomainGetMaxVcpus(virDomainPtr dom)
 }

 static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
-                                        unsigned int nvcpus)
+                                        unsigned int nvcpus,
+                                        virDomainXMLOptionPtr xmlopt)
 {
     char        str_vcpus[32];
     const char *prog[] = { VZCTL, "--quiet", "set", PROGRAM_SENTINEL,
@@ -1364,7 +1368,7 @@ static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
     if (virRun(prog, NULL) < 0)
         return -1;

-    if (virDomainDefSetVcpusMax(vm->def, nvcpus) < 0)
+    if (virDomainDefSetVcpusMax(vm->def, nvcpus, xmlopt) < 0)
         return -1;

     if (virDomainDefSetVcpus(vm->def, nvcpus) < 0)
@@ -1402,7 +1406,7 @@ static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
         goto cleanup;
     }

-    if (openvzDomainSetVcpusInternal(vm, nvcpus) < 0) {
+    if (openvzDomainSetVcpusInternal(vm, nvcpus, driver->xmlopt) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Could not set number of vCPUs"));
         goto cleanup;
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index dce20bc..3dd8927 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -3296,7 +3296,7 @@ phypDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
         goto err;
     }

-    if (virDomainDefSetVcpusMax(&def, vcpus) < 0)
+    if (virDomainDefSetVcpusMax(&def, vcpus, phyp_driver->xmlopt) < 0)
         goto err;

     if (virDomainDefSetVcpus(&def, vcpus) < 0)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b993995..28ef5aa 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4849,7 +4849,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
                 goto endjob;
             }

-            if (virDomainDefSetVcpusMax(persistentDef, nvcpus) < 0)
+            if (virDomainDefSetVcpusMax(persistentDef, nvcpus, driver->xmlopt) < 0)
                 goto endjob;
         } else {
             if (virDomainDefSetVcpus(persistentDef, nvcpus) < 0)
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index 09bd09a..3f7e445 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -1659,7 +1659,8 @@ qemuParseCommandLineMem(virDomainDefPtr dom,

 static int
 qemuParseCommandLineSmp(virDomainDefPtr dom,
-                        const char *val)
+                        const char *val,
+                        virDomainXMLOptionPtr xmlopt)
 {
     unsigned int sockets = 0;
     unsigned int cores = 0;
@@ -1701,7 +1702,7 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
     if (maxcpus == 0)
         maxcpus = vcpus;

-    if (virDomainDefSetVcpusMax(dom, maxcpus) < 0)
+    if (virDomainDefSetVcpusMax(dom, maxcpus, xmlopt) < 0)
         goto error;

     if (virDomainDefSetVcpus(dom, vcpus) < 0)
@@ -1819,7 +1820,7 @@ qemuParseCommandLine(virCapsPtr caps,
     def->id = -1;
     def->mem.cur_balloon = 64 * 1024;
     virDomainDefSetMemoryTotal(def, def->mem.cur_balloon);
-    if (virDomainDefSetVcpusMax(def, 1) < 0)
+    if (virDomainDefSetVcpusMax(def, 1, xmlopt) < 0)
         goto error;
     if (virDomainDefSetVcpus(def, 1) < 0)
         goto error;
@@ -1899,7 +1900,7 @@ qemuParseCommandLine(virCapsPtr caps,
                 goto error;
         } else if (STREQ(arg, "-smp")) {
             WANT_VALUE();
-            if (qemuParseCommandLineSmp(def, val) < 0)
+            if (qemuParseCommandLineSmp(def, val, xmlopt) < 0)
                 goto error;
         } else if (STREQ(arg, "-uuid")) {
             WANT_VALUE();
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 6853626..61f0207 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2336,6 +2336,7 @@ static int
 testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
                         unsigned int flags)
 {
+    testDriverPtr driver = domain->conn->privateData;
     virDomainObjPtr privdom = NULL;
     virDomainDefPtr def;
     virDomainDefPtr persistentDef;
@@ -2383,7 +2384,8 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,

     if (persistentDef) {
         if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
-            if (virDomainDefSetVcpusMax(persistentDef, nrCpus) < 0)
+            if (virDomainDefSetVcpusMax(persistentDef, nrCpus,
+                                        driver->xmlopt) < 0)
                 goto cleanup;
         } else {
             if (virDomainDefSetVcpus(persistentDef, nrCpus) < 0)
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 8e49268..a14ab67 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -3885,7 +3885,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
     virDomainDefSetMemoryTotal(def, memorySize * 1024);

     gVBoxAPI.UIMachine.GetCPUCount(machine, &CPUCount);
-    if (virDomainDefSetVcpusMax(def, CPUCount) < 0)
+    if (virDomainDefSetVcpusMax(def, CPUCount, data->xmlopt) < 0)
         goto cleanup;

     if (virDomainDefSetVcpus(def, CPUCount) < 0)
@@ -6044,7 +6044,7 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
         def->dom->os.type = VIR_DOMAIN_OSTYPE_HVM;
         def->dom->os.arch = virArchFromHost();
         gVBoxAPI.UIMachine.GetCPUCount(machine, &CPUCount);
-        if (virDomainDefSetVcpusMax(def->dom, CPUCount) < 0)
+        if (virDomainDefSetVcpusMax(def->dom, CPUCount, data->xmlopt) < 0)
             goto cleanup;

         if (virDomainDefSetVcpus(def->dom, CPUCount) < 0)
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index d443dd0..0f557a8 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1457,7 +1457,7 @@ virVMXParseConfig(virVMXContext *ctx,
         goto cleanup;
     }

-    if (virDomainDefSetVcpusMax(def, numvcpus) < 0)
+    if (virDomainDefSetVcpusMax(def, numvcpus, xmlopt) < 0)
         goto cleanup;

     if (virDomainDefSetVcpus(def, numvcpus) < 0)
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 3c34652..8335078 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -700,7 +700,7 @@ xenXMDomainSetVcpusFlags(virConnectPtr conn,
     }

     if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
-        if (virDomainDefSetVcpusMax(entry->def, vcpus) < 0)
+        if (virDomainDefSetVcpusMax(entry->def, vcpus, priv->xmlopt) < 0)
             goto cleanup;
     } else {
         if (virDomainDefSetVcpus(entry->def, vcpus) < 0)
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 676ed5b..9a861c1 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -1505,7 +1505,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)

     vcpus = xenapiDomainGetMaxVcpus(dom);

-    if (virDomainDefSetVcpusMax(defPtr, vcpus) < 0)
+    if (virDomainDefSetVcpusMax(defPtr, vcpus, priv->xmlopt) < 0)
         goto error;

     if (virDomainDefSetVcpus(defPtr, vcpus) < 0)
diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index f62a5b1..8365a2c 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -483,7 +483,9 @@ xenParsePCI(virConfPtr conf, virDomainDefPtr def)


 static int
-xenParseCPUFeatures(virConfPtr conf, virDomainDefPtr def)
+xenParseCPUFeatures(virConfPtr conf,
+                    virDomainDefPtr def,
+                    virDomainXMLOptionPtr xmlopt)
 {
     unsigned long count = 0;
     const char *str = NULL;
@@ -492,7 +494,7 @@ xenParseCPUFeatures(virConfPtr conf, virDomainDefPtr def)
     if (xenConfigGetULong(conf, "vcpus", &count, 1) < 0)
         return -1;

-    if (virDomainDefSetVcpusMax(def, count) < 0)
+    if (virDomainDefSetVcpusMax(def, count, xmlopt) < 0)
         return -1;

     if (virDomainDefSetVcpus(def, count) < 0)
@@ -502,7 +504,7 @@ xenParseCPUFeatures(virConfPtr conf, virDomainDefPtr def)
         if (xenConfigGetULong(conf, "maxvcpus", &count, 0) < 0)
             return -1;

-        if (virDomainDefSetVcpusMax(def, count) < 0)
+        if (virDomainDefSetVcpusMax(def, count, xmlopt) < 0)
             return -1;
     }

@@ -1051,7 +1053,8 @@ int
 xenParseConfigCommon(virConfPtr conf,
                      virDomainDefPtr def,
                      virCapsPtr caps,
-                     const char *nativeFormat)
+                     const char *nativeFormat,
+                     virDomainXMLOptionPtr xmlopt)
 {
     if (xenParseGeneralMeta(conf, def, caps) < 0)
         return -1;
@@ -1062,7 +1065,7 @@ xenParseConfigCommon(virConfPtr conf,
     if (xenParseEventsActions(conf, def) < 0)
         return -1;

-    if (xenParseCPUFeatures(conf, def) < 0)
+    if (xenParseCPUFeatures(conf, def, xmlopt) < 0)
         return -1;

     if (xenParseTimeOffset(conf, def) < 0)
diff --git a/src/xenconfig/xen_common.h b/src/xenconfig/xen_common.h
index 1c74bee..9055692 100644
--- a/src/xenconfig/xen_common.h
+++ b/src/xenconfig/xen_common.h
@@ -59,7 +59,8 @@ int xenConfigCopyStringOpt(virConfPtr conf,
 int xenParseConfigCommon(virConfPtr conf,
                          virDomainDefPtr def,
                          virCapsPtr caps,
-                         const char *nativeFormat);
+                         const char *nativeFormat,
+                         virDomainXMLOptionPtr xmlopt);

 int xenFormatConfigCommon(virConfPtr conf,
                           virDomainDefPtr def,
diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c
index ea6c177..40dc53c 100644
--- a/src/xenconfig/xen_sxpr.c
+++ b/src/xenconfig/xen_sxpr.c
@@ -1233,7 +1233,7 @@ xenParseSxpr(const struct sexpr *root,
         }
     }

-    if (virDomainDefSetVcpusMax(def, sexpr_int(root, "domain/vcpus")) < 0)
+    if (virDomainDefSetVcpusMax(def, sexpr_int(root, "domain/vcpus"), xmlopt) < 0)
         goto error;

     vcpus = count_one_bits_l(sexpr_u64(root, "domain/vcpu_avail"));
diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index d524a82..dcd4849 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -594,7 +594,8 @@ xenParseXL(virConfPtr conf,
     def->virtType = VIR_DOMAIN_VIRT_XEN;
     def->id = -1;

-    if (xenParseConfigCommon(conf, def, caps, XEN_CONFIG_FORMAT_XL) < 0)
+    if (xenParseConfigCommon(conf, def, caps, XEN_CONFIG_FORMAT_XL,
+                             xmlopt) < 0)
         goto cleanup;

     if (xenParseXLOS(conf, def, caps) < 0)
diff --git a/src/xenconfig/xen_xm.c b/src/xenconfig/xen_xm.c
index 1023ed2..124c94a 100644
--- a/src/xenconfig/xen_xm.c
+++ b/src/xenconfig/xen_xm.c
@@ -447,7 +447,8 @@ xenParseXM(virConfPtr conf,
     def->virtType = VIR_DOMAIN_VIRT_XEN;
     def->id = -1;

-    if (xenParseConfigCommon(conf, def, caps, XEN_CONFIG_FORMAT_XM) < 0)
+    if (xenParseConfigCommon(conf, def, caps, XEN_CONFIG_FORMAT_XM,
+                             xmlopt) < 0)
         goto cleanup;

     if (xenParseXMOS(conf, def) < 0)
-- 
2.9.0




More information about the libvir-list mailing list