1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 07:59:00 +00:00

conf: Add private data for virDomainVcpuDef

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.
This commit is contained in:
Peter Krempa 2016-06-29 14:55:24 +02:00
parent 990b06de03
commit 5fe0b6b0a7
22 changed files with 87 additions and 52 deletions

@ -663,7 +663,7 @@ bhyveParseBhyveCommandLine(virDomainDefPtr def,
_("Failed to parse number of vCPUs")); _("Failed to parse number of vCPUs"));
goto error; goto error;
} }
if (virDomainDefSetVcpusMax(def, vcpus) < 0) if (virDomainDefSetVcpusMax(def, vcpus, xmlopt) < 0)
goto error; goto error;
if (virDomainDefSetVcpus(def, vcpus) < 0) if (virDomainDefSetVcpus(def, vcpus) < 0)
goto error; goto error;

@ -1307,12 +1307,23 @@ void virDomainLeaseDefFree(virDomainLeaseDefPtr def)
static virDomainVcpuDefPtr static virDomainVcpuDefPtr
virDomainVcpuDefNew(void) virDomainVcpuDefNew(virDomainXMLOptionPtr xmlopt)
{ {
virDomainVcpuDefPtr ret; virObjectPtr priv = NULL;
virDomainVcpuDefPtr ret = NULL;
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; return ret;
} }
@ -1325,13 +1336,15 @@ virDomainVcpuDefFree(virDomainVcpuDefPtr info)
virBitmapFree(info->cpumask); virBitmapFree(info->cpumask);
info->cpumask = NULL; info->cpumask = NULL;
virObjectUnref(info->privateData);
VIR_FREE(info); VIR_FREE(info);
} }
int int
virDomainDefSetVcpusMax(virDomainDefPtr def, virDomainDefSetVcpusMax(virDomainDefPtr def,
unsigned int maxvcpus) unsigned int maxvcpus,
virDomainXMLOptionPtr xmlopt)
{ {
size_t oldmax = def->maxvcpus; size_t oldmax = def->maxvcpus;
size_t i; size_t i;
@ -1344,7 +1357,7 @@ virDomainDefSetVcpusMax(virDomainDefPtr def,
return -1; return -1;
for (i = oldmax; i < def->maxvcpus; i++) { for (i = oldmax; i < def->maxvcpus; i++) {
if (!(def->vcpus[i] = virDomainVcpuDefNew())) if (!(def->vcpus[i] = virDomainVcpuDefNew(xmlopt)))
return -1; return -1;
} }
} else { } else {
@ -15465,7 +15478,8 @@ virDomainIOThreadSchedParse(xmlNodePtr node,
static int static int
virDomainVcpuParse(virDomainDefPtr def, virDomainVcpuParse(virDomainDefPtr def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt,
virDomainXMLOptionPtr xmlopt)
{ {
int n; int n;
char *tmp = NULL; char *tmp = NULL;
@ -15483,7 +15497,7 @@ virDomainVcpuParse(virDomainDefPtr def,
maxvcpus = 1; maxvcpus = 1;
} }
if (virDomainDefSetVcpusMax(def, maxvcpus) < 0) if (virDomainDefSetVcpusMax(def, maxvcpus, xmlopt) < 0)
goto cleanup; goto cleanup;
if ((n = virXPathUInt("string(./vcpu[1]/@current)", ctxt, &vcpus)) < 0) { if ((n = virXPathUInt("string(./vcpu[1]/@current)", ctxt, &vcpus)) < 0) {
@ -15952,7 +15966,7 @@ virDomainDefParseXML(xmlDocPtr xml,
&def->mem.swap_hard_limit) < 0) &def->mem.swap_hard_limit) < 0)
goto error; goto error;
if (virDomainVcpuParse(def, ctxt) < 0) if (virDomainVcpuParse(def, ctxt, xmlopt) < 0)
goto error; goto error;
/* Optional - iothreads */ /* Optional - iothreads */

@ -2037,6 +2037,8 @@ struct _virDomainVcpuDef {
virBitmapPtr cpumask; virBitmapPtr cpumask;
virDomainThreadSchedParam sched; virDomainThreadSchedParam sched;
virObjectPtr privateData;
}; };
typedef struct _virDomainBlkiotune virDomainBlkiotune; typedef struct _virDomainBlkiotune virDomainBlkiotune;
@ -2245,14 +2247,6 @@ struct _virDomainDef {
xmlNodePtr metadata; 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); unsigned long long virDomainDefGetMemoryInitial(const virDomainDef *def);
void virDomainDefSetMemoryTotal(virDomainDefPtr def, unsigned long long size); void virDomainDefSetMemoryTotal(virDomainDefPtr def, unsigned long long size);
@ -2408,6 +2402,7 @@ struct _virDomainXMLPrivateDataCallbacks {
* virDomainDefCopy and similar functions */ * virDomainDefCopy and similar functions */
virDomainXMLPrivateDataNewFunc diskNew; virDomainXMLPrivateDataNewFunc diskNew;
virDomainXMLPrivateDataNewFunc hostdevNew; virDomainXMLPrivateDataNewFunc hostdevNew;
virDomainXMLPrivateDataNewFunc vcpuNew;
virDomainXMLPrivateDataFormatFunc format; virDomainXMLPrivateDataFormatFunc format;
virDomainXMLPrivateDataParseFunc parse; virDomainXMLPrivateDataParseFunc parse;
}; };
@ -2439,6 +2434,17 @@ virDomainObjIsActive(virDomainObjPtr dom)
return dom->def->id != -1; 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) virDomainObjPtr virDomainObjNew(virDomainXMLOptionPtr caps)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);

@ -876,7 +876,8 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
def->mem.cur_balloon = memorySettingData->data->VirtualQuantity * 1024; /* megabyte to kilobyte */ def->mem.cur_balloon = memorySettingData->data->VirtualQuantity * 1024; /* megabyte to kilobyte */
if (virDomainDefSetVcpusMax(def, if (virDomainDefSetVcpusMax(def,
processorSettingData->data->VirtualQuantity) < 0) processorSettingData->data->VirtualQuantity,
NULL) < 0)
goto cleanup; goto cleanup;
if (virDomainDefSetVcpus(def, if (virDomainDefSetVcpus(def,

@ -557,7 +557,7 @@ libxlAddDom0(libxlDriverPrivatePtr driver)
def = NULL; def = NULL;
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED); 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; goto cleanup;
if (virDomainDefSetVcpus(vm->def, d_info.vcpu_online) < 0) if (virDomainDefSetVcpus(vm->def, d_info.vcpu_online) < 0)
@ -2182,7 +2182,7 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
switch (flags) { switch (flags) {
case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_CONFIG: case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_CONFIG:
if (virDomainDefSetVcpusMax(def, nvcpus) < 0) if (virDomainDefSetVcpusMax(def, nvcpus, driver->xmlopt) < 0)
goto cleanup; goto cleanup;
break; break;

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

@ -572,7 +572,7 @@ int openvzLoadDomains(struct openvz_driver *driver)
if (ret == 0 || vcpus == 0) if (ret == 0 || vcpus == 0)
vcpus = openvzGetNodeCPUs(); vcpus = openvzGetNodeCPUs();
if (virDomainDefSetVcpusMax(def, vcpus) < 0) if (virDomainDefSetVcpusMax(def, vcpus, driver->xmlopt) < 0)
goto cleanup; goto cleanup;
if (virDomainDefSetVcpus(def, vcpus) < 0) if (virDomainDefSetVcpus(def, vcpus) < 0)

@ -70,7 +70,8 @@ static int openvzGetProcessInfo(unsigned long long *cpuTime, int vpsid);
static int openvzConnectGetMaxVcpus(virConnectPtr conn, const char *type); static int openvzConnectGetMaxVcpus(virConnectPtr conn, const char *type);
static int openvzDomainGetMaxVcpus(virDomainPtr dom); static int openvzDomainGetMaxVcpus(virDomainPtr dom);
static int openvzDomainSetVcpusInternal(virDomainObjPtr vm, static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
unsigned int nvcpus); unsigned int nvcpus,
virDomainXMLOptionPtr xmlopt);
static int openvzDomainSetMemoryInternal(virDomainObjPtr vm, static int openvzDomainSetMemoryInternal(virDomainObjPtr vm,
unsigned long long memory); unsigned long long memory);
static int openvzGetVEStatus(virDomainObjPtr vm, int *status, int *reason); static int openvzGetVEStatus(virDomainObjPtr vm, int *status, int *reason);
@ -1032,7 +1033,8 @@ openvzDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int fla
goto cleanup; goto cleanup;
} }
if (virDomainDefGetVcpusMax(vm->def)) { 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", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Could not set number of vCPUs")); _("Could not set number of vCPUs"));
goto cleanup; goto cleanup;
@ -1130,7 +1132,8 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED); virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED);
if (virDomainDefGetVcpusMax(vm->def) > 0) { 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", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Could not set number of vCPUs")); _("Could not set number of vCPUs"));
goto cleanup; goto cleanup;
@ -1347,7 +1350,8 @@ static int openvzDomainGetMaxVcpus(virDomainPtr dom)
} }
static int openvzDomainSetVcpusInternal(virDomainObjPtr vm, static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
unsigned int nvcpus) unsigned int nvcpus,
virDomainXMLOptionPtr xmlopt)
{ {
char str_vcpus[32]; char str_vcpus[32];
const char *prog[] = { VZCTL, "--quiet", "set", PROGRAM_SENTINEL, const char *prog[] = { VZCTL, "--quiet", "set", PROGRAM_SENTINEL,
@ -1364,7 +1368,7 @@ static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
if (virRun(prog, NULL) < 0) if (virRun(prog, NULL) < 0)
return -1; return -1;
if (virDomainDefSetVcpusMax(vm->def, nvcpus) < 0) if (virDomainDefSetVcpusMax(vm->def, nvcpus, xmlopt) < 0)
return -1; return -1;
if (virDomainDefSetVcpus(vm->def, nvcpus) < 0) if (virDomainDefSetVcpus(vm->def, nvcpus) < 0)
@ -1402,7 +1406,7 @@ static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
goto cleanup; goto cleanup;
} }
if (openvzDomainSetVcpusInternal(vm, nvcpus) < 0) { if (openvzDomainSetVcpusInternal(vm, nvcpus, driver->xmlopt) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Could not set number of vCPUs")); _("Could not set number of vCPUs"));
goto cleanup; goto cleanup;

@ -3296,7 +3296,7 @@ phypDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
goto err; goto err;
} }
if (virDomainDefSetVcpusMax(&def, vcpus) < 0) if (virDomainDefSetVcpusMax(&def, vcpus, phyp_driver->xmlopt) < 0)
goto err; goto err;
if (virDomainDefSetVcpus(&def, vcpus) < 0) if (virDomainDefSetVcpus(&def, vcpus) < 0)

@ -4849,7 +4849,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
goto endjob; goto endjob;
} }
if (virDomainDefSetVcpusMax(persistentDef, nvcpus) < 0) if (virDomainDefSetVcpusMax(persistentDef, nvcpus, driver->xmlopt) < 0)
goto endjob; goto endjob;
} else { } else {
if (virDomainDefSetVcpus(persistentDef, nvcpus) < 0) if (virDomainDefSetVcpus(persistentDef, nvcpus) < 0)

@ -1659,7 +1659,8 @@ qemuParseCommandLineMem(virDomainDefPtr dom,
static int static int
qemuParseCommandLineSmp(virDomainDefPtr dom, qemuParseCommandLineSmp(virDomainDefPtr dom,
const char *val) const char *val,
virDomainXMLOptionPtr xmlopt)
{ {
unsigned int sockets = 0; unsigned int sockets = 0;
unsigned int cores = 0; unsigned int cores = 0;
@ -1701,7 +1702,7 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
if (maxcpus == 0) if (maxcpus == 0)
maxcpus = vcpus; maxcpus = vcpus;
if (virDomainDefSetVcpusMax(dom, maxcpus) < 0) if (virDomainDefSetVcpusMax(dom, maxcpus, xmlopt) < 0)
goto error; goto error;
if (virDomainDefSetVcpus(dom, vcpus) < 0) if (virDomainDefSetVcpus(dom, vcpus) < 0)
@ -1819,7 +1820,7 @@ qemuParseCommandLine(virCapsPtr caps,
def->id = -1; def->id = -1;
def->mem.cur_balloon = 64 * 1024; def->mem.cur_balloon = 64 * 1024;
virDomainDefSetMemoryTotal(def, def->mem.cur_balloon); virDomainDefSetMemoryTotal(def, def->mem.cur_balloon);
if (virDomainDefSetVcpusMax(def, 1) < 0) if (virDomainDefSetVcpusMax(def, 1, xmlopt) < 0)
goto error; goto error;
if (virDomainDefSetVcpus(def, 1) < 0) if (virDomainDefSetVcpus(def, 1) < 0)
goto error; goto error;
@ -1899,7 +1900,7 @@ qemuParseCommandLine(virCapsPtr caps,
goto error; goto error;
} else if (STREQ(arg, "-smp")) { } else if (STREQ(arg, "-smp")) {
WANT_VALUE(); WANT_VALUE();
if (qemuParseCommandLineSmp(def, val) < 0) if (qemuParseCommandLineSmp(def, val, xmlopt) < 0)
goto error; goto error;
} else if (STREQ(arg, "-uuid")) { } else if (STREQ(arg, "-uuid")) {
WANT_VALUE(); WANT_VALUE();

@ -2336,6 +2336,7 @@ static int
testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus, testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
unsigned int flags) unsigned int flags)
{ {
testDriverPtr driver = domain->conn->privateData;
virDomainObjPtr privdom = NULL; virDomainObjPtr privdom = NULL;
virDomainDefPtr def; virDomainDefPtr def;
virDomainDefPtr persistentDef; virDomainDefPtr persistentDef;
@ -2383,7 +2384,8 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
if (persistentDef) { if (persistentDef) {
if (flags & VIR_DOMAIN_VCPU_MAXIMUM) { if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
if (virDomainDefSetVcpusMax(persistentDef, nrCpus) < 0) if (virDomainDefSetVcpusMax(persistentDef, nrCpus,
driver->xmlopt) < 0)
goto cleanup; goto cleanup;
} else { } else {
if (virDomainDefSetVcpus(persistentDef, nrCpus) < 0) if (virDomainDefSetVcpus(persistentDef, nrCpus) < 0)

@ -3885,7 +3885,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
virDomainDefSetMemoryTotal(def, memorySize * 1024); virDomainDefSetMemoryTotal(def, memorySize * 1024);
gVBoxAPI.UIMachine.GetCPUCount(machine, &CPUCount); gVBoxAPI.UIMachine.GetCPUCount(machine, &CPUCount);
if (virDomainDefSetVcpusMax(def, CPUCount) < 0) if (virDomainDefSetVcpusMax(def, CPUCount, data->xmlopt) < 0)
goto cleanup; goto cleanup;
if (virDomainDefSetVcpus(def, CPUCount) < 0) 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.type = VIR_DOMAIN_OSTYPE_HVM;
def->dom->os.arch = virArchFromHost(); def->dom->os.arch = virArchFromHost();
gVBoxAPI.UIMachine.GetCPUCount(machine, &CPUCount); gVBoxAPI.UIMachine.GetCPUCount(machine, &CPUCount);
if (virDomainDefSetVcpusMax(def->dom, CPUCount) < 0) if (virDomainDefSetVcpusMax(def->dom, CPUCount, data->xmlopt) < 0)
goto cleanup; goto cleanup;
if (virDomainDefSetVcpus(def->dom, CPUCount) < 0) if (virDomainDefSetVcpus(def->dom, CPUCount) < 0)

@ -1457,7 +1457,7 @@ virVMXParseConfig(virVMXContext *ctx,
goto cleanup; goto cleanup;
} }
if (virDomainDefSetVcpusMax(def, numvcpus) < 0) if (virDomainDefSetVcpusMax(def, numvcpus, xmlopt) < 0)
goto cleanup; goto cleanup;
if (virDomainDefSetVcpus(def, numvcpus) < 0) if (virDomainDefSetVcpus(def, numvcpus) < 0)

@ -1309,7 +1309,8 @@ prlsdkConvertDomainState(VIRTUAL_MACHINE_STATE domainState,
static int static int
prlsdkConvertCpuInfo(PRL_HANDLE sdkdom, prlsdkConvertCpuInfo(PRL_HANDLE sdkdom,
virDomainDefPtr def) virDomainDefPtr def,
virDomainXMLOptionPtr xmlopt)
{ {
char *buf; char *buf;
int hostcpus; int hostcpus;
@ -1327,7 +1328,7 @@ prlsdkConvertCpuInfo(PRL_HANDLE sdkdom,
if (cpuCount > hostcpus) if (cpuCount > hostcpus)
cpuCount = hostcpus; cpuCount = hostcpus;
if (virDomainDefSetVcpusMax(def, cpuCount) < 0) if (virDomainDefSetVcpusMax(def, cpuCount, xmlopt) < 0)
goto cleanup; goto cleanup;
if (virDomainDefSetVcpus(def, cpuCount) < 0) if (virDomainDefSetVcpus(def, cpuCount) < 0)
@ -1706,7 +1707,7 @@ prlsdkLoadDomain(vzDriverPtr driver, virDomainObjPtr dom)
convert to Kbytes */ convert to Kbytes */
def->mem.cur_balloon = ram << 10; def->mem.cur_balloon = ram << 10;
if (prlsdkConvertCpuInfo(sdkdom, def) < 0) if (prlsdkConvertCpuInfo(sdkdom, def, driver->xmlopt) < 0)
goto error; goto error;
if (prlsdkConvertCpuMode(sdkdom, def) < 0) if (prlsdkConvertCpuMode(sdkdom, def) < 0)

@ -700,7 +700,7 @@ xenXMDomainSetVcpusFlags(virConnectPtr conn,
} }
if (flags & VIR_DOMAIN_VCPU_MAXIMUM) { if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
if (virDomainDefSetVcpusMax(entry->def, vcpus) < 0) if (virDomainDefSetVcpusMax(entry->def, vcpus, priv->xmlopt) < 0)
goto cleanup; goto cleanup;
} else { } else {
if (virDomainDefSetVcpus(entry->def, vcpus) < 0) if (virDomainDefSetVcpus(entry->def, vcpus) < 0)

@ -1505,7 +1505,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
vcpus = xenapiDomainGetMaxVcpus(dom); vcpus = xenapiDomainGetMaxVcpus(dom);
if (virDomainDefSetVcpusMax(defPtr, vcpus) < 0) if (virDomainDefSetVcpusMax(defPtr, vcpus, priv->xmlopt) < 0)
goto error; goto error;
if (virDomainDefSetVcpus(defPtr, vcpus) < 0) if (virDomainDefSetVcpus(defPtr, vcpus) < 0)

@ -483,7 +483,9 @@ xenParsePCI(virConfPtr conf, virDomainDefPtr def)
static int static int
xenParseCPUFeatures(virConfPtr conf, virDomainDefPtr def) xenParseCPUFeatures(virConfPtr conf,
virDomainDefPtr def,
virDomainXMLOptionPtr xmlopt)
{ {
unsigned long count = 0; unsigned long count = 0;
const char *str = NULL; const char *str = NULL;
@ -492,7 +494,7 @@ xenParseCPUFeatures(virConfPtr conf, virDomainDefPtr def)
if (xenConfigGetULong(conf, "vcpus", &count, 1) < 0) if (xenConfigGetULong(conf, "vcpus", &count, 1) < 0)
return -1; return -1;
if (virDomainDefSetVcpusMax(def, count) < 0) if (virDomainDefSetVcpusMax(def, count, xmlopt) < 0)
return -1; return -1;
if (virDomainDefSetVcpus(def, count) < 0) if (virDomainDefSetVcpus(def, count) < 0)
@ -502,7 +504,7 @@ xenParseCPUFeatures(virConfPtr conf, virDomainDefPtr def)
if (xenConfigGetULong(conf, "maxvcpus", &count, 0) < 0) if (xenConfigGetULong(conf, "maxvcpus", &count, 0) < 0)
return -1; return -1;
if (virDomainDefSetVcpusMax(def, count) < 0) if (virDomainDefSetVcpusMax(def, count, xmlopt) < 0)
return -1; return -1;
} }
@ -1051,7 +1053,8 @@ int
xenParseConfigCommon(virConfPtr conf, xenParseConfigCommon(virConfPtr conf,
virDomainDefPtr def, virDomainDefPtr def,
virCapsPtr caps, virCapsPtr caps,
const char *nativeFormat) const char *nativeFormat,
virDomainXMLOptionPtr xmlopt)
{ {
if (xenParseGeneralMeta(conf, def, caps) < 0) if (xenParseGeneralMeta(conf, def, caps) < 0)
return -1; return -1;
@ -1062,7 +1065,7 @@ xenParseConfigCommon(virConfPtr conf,
if (xenParseEventsActions(conf, def) < 0) if (xenParseEventsActions(conf, def) < 0)
return -1; return -1;
if (xenParseCPUFeatures(conf, def) < 0) if (xenParseCPUFeatures(conf, def, xmlopt) < 0)
return -1; return -1;
if (xenParseTimeOffset(conf, def) < 0) if (xenParseTimeOffset(conf, def) < 0)

@ -59,7 +59,8 @@ int xenConfigCopyStringOpt(virConfPtr conf,
int xenParseConfigCommon(virConfPtr conf, int xenParseConfigCommon(virConfPtr conf,
virDomainDefPtr def, virDomainDefPtr def,
virCapsPtr caps, virCapsPtr caps,
const char *nativeFormat); const char *nativeFormat,
virDomainXMLOptionPtr xmlopt);
int xenFormatConfigCommon(virConfPtr conf, int xenFormatConfigCommon(virConfPtr conf,
virDomainDefPtr def, virDomainDefPtr def,

@ -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; goto error;
vcpus = count_one_bits_l(sexpr_u64(root, "domain/vcpu_avail")); vcpus = count_one_bits_l(sexpr_u64(root, "domain/vcpu_avail"));

@ -594,7 +594,8 @@ xenParseXL(virConfPtr conf,
def->virtType = VIR_DOMAIN_VIRT_XEN; def->virtType = VIR_DOMAIN_VIRT_XEN;
def->id = -1; 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; goto cleanup;
if (xenParseXLOS(conf, def, caps) < 0) if (xenParseXLOS(conf, def, caps) < 0)

@ -447,7 +447,8 @@ xenParseXM(virConfPtr conf,
def->virtType = VIR_DOMAIN_VIRT_XEN; def->virtType = VIR_DOMAIN_VIRT_XEN;
def->id = -1; 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; goto cleanup;
if (xenParseXMOS(conf, def) < 0) if (xenParseXMOS(conf, def) < 0)