mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
Convert virDomainPinDefPtr->vcpuid to virDomainPinDefPtr->id
Since we're not specifically a vcpu related structure anymore...
This commit is contained in:
parent
59ba70237a
commit
a9f528ab29
@ -2015,7 +2015,7 @@ virDomainVcpuPinDefCopy(virDomainPinDefPtr *src, int nvcpupin)
|
||||
for (i = 0; i < nvcpupin; i++) {
|
||||
if (VIR_ALLOC(ret[i]) < 0)
|
||||
goto error;
|
||||
ret[i]->vcpuid = src[i]->vcpuid;
|
||||
ret[i]->id = src[i]->id;
|
||||
if ((ret[i]->cpumask = virBitmapNewCopy(src[i]->cpumask)) == NULL)
|
||||
goto error;
|
||||
}
|
||||
@ -12796,7 +12796,7 @@ virDomainVcpuPinDefParseXML(xmlNodePtr node,
|
||||
goto error;
|
||||
}
|
||||
|
||||
def->vcpuid = vcpuid;
|
||||
def->id = vcpuid;
|
||||
}
|
||||
|
||||
if (iothreads && (tmp = virXPathString("string(./@iothread)", ctxt))) {
|
||||
@ -12823,8 +12823,7 @@ virDomainVcpuPinDefParseXML(xmlNodePtr node,
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Rather than creating our own structure we are reusing the vCPU */
|
||||
def->vcpuid = iothreadid;
|
||||
def->id = iothreadid;
|
||||
}
|
||||
|
||||
if (!(tmp = virXMLPropString(node, "cpuset"))) {
|
||||
@ -13532,14 +13531,14 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
|
||||
if (virDomainVcpuPinIsDuplicate(def->cputune.vcpupin,
|
||||
def->cputune.nvcpupin,
|
||||
vcpupin->vcpuid)) {
|
||||
vcpupin->id)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("duplicate vcpupin for same vcpu"));
|
||||
virDomainVcpuPinDefFree(vcpupin);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (vcpupin->vcpuid >= def->vcpus) {
|
||||
if (vcpupin->id >= def->vcpus) {
|
||||
/* To avoid the regression when daemon loading
|
||||
* domain confs, we can't simply error out if
|
||||
* <vcpupin> nodes greater than current vcpus,
|
||||
@ -13576,7 +13575,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
goto error;
|
||||
}
|
||||
virBitmapCopy(vcpupin->cpumask, def->cpumask);
|
||||
vcpupin->vcpuid = i;
|
||||
vcpupin->id = i;
|
||||
def->cputune.vcpupin[def->cputune.nvcpupin++] = vcpupin;
|
||||
}
|
||||
}
|
||||
@ -13624,7 +13623,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
|
||||
if (virDomainVcpuPinIsDuplicate(def->cputune.iothreadspin,
|
||||
def->cputune.niothreadspin,
|
||||
iothreadpin->vcpuid)) {
|
||||
iothreadpin->id)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("duplicate iothreadpin for same iothread"));
|
||||
virDomainVcpuPinDefFree(iothreadpin);
|
||||
@ -16734,7 +16733,7 @@ virDomainDefAddImplicitControllers(virDomainDefPtr def)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check if vcpupin with same vcpuid already exists.
|
||||
/* Check if vcpupin with same id already exists.
|
||||
* Return 1 if exists, 0 if not. */
|
||||
int
|
||||
virDomainVcpuPinIsDuplicate(virDomainPinDefPtr *def,
|
||||
@ -16747,7 +16746,7 @@ virDomainVcpuPinIsDuplicate(virDomainPinDefPtr *def,
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < nvcpupin; i++) {
|
||||
if (def[i]->vcpuid == vcpu)
|
||||
if (def[i]->id == vcpu)
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -16765,7 +16764,7 @@ virDomainVcpuPinFindByVcpu(virDomainPinDefPtr *def,
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < nvcpupin; i++) {
|
||||
if (def[i]->vcpuid == vcpu)
|
||||
if (def[i]->id == vcpu)
|
||||
return def[i];
|
||||
}
|
||||
|
||||
@ -16788,7 +16787,7 @@ virDomainVcpuPinAdd(virDomainPinDefPtr **vcpupin_list,
|
||||
*nvcpupin,
|
||||
vcpu);
|
||||
if (vcpupin) {
|
||||
vcpupin->vcpuid = vcpu;
|
||||
vcpupin->id = vcpu;
|
||||
virBitmapFree(vcpupin->cpumask);
|
||||
vcpupin->cpumask = virBitmapNewData(cpumap, maplen);
|
||||
if (!vcpupin->cpumask)
|
||||
@ -16802,7 +16801,7 @@ virDomainVcpuPinAdd(virDomainPinDefPtr **vcpupin_list,
|
||||
if (VIR_ALLOC(vcpupin) < 0)
|
||||
goto error;
|
||||
|
||||
vcpupin->vcpuid = vcpu;
|
||||
vcpupin->id = vcpu;
|
||||
vcpupin->cpumask = virBitmapNewData(cpumap, maplen);
|
||||
if (!vcpupin->cpumask)
|
||||
goto error;
|
||||
@ -16824,7 +16823,7 @@ virDomainVcpuPinDel(virDomainDefPtr def, int vcpu)
|
||||
virDomainPinDefPtr *vcpupin_list = def->cputune.vcpupin;
|
||||
|
||||
for (n = 0; n < def->cputune.nvcpupin; n++) {
|
||||
if (vcpupin_list[n]->vcpuid == vcpu) {
|
||||
if (vcpupin_list[n]->id == vcpu) {
|
||||
virBitmapFree(vcpupin_list[n]->cpumask);
|
||||
VIR_FREE(vcpupin_list[n]);
|
||||
VIR_DELETE_ELEMENT(def->cputune.vcpupin, n, def->cputune.nvcpupin);
|
||||
@ -16845,7 +16844,7 @@ virDomainEmulatorPinAdd(virDomainDefPtr def,
|
||||
if (VIR_ALLOC(emulatorpin) < 0)
|
||||
return -1;
|
||||
|
||||
emulatorpin->vcpuid = -1;
|
||||
emulatorpin->id = -1;
|
||||
emulatorpin->cpumask = virBitmapNewData(cpumap, maplen);
|
||||
if (!emulatorpin->cpumask) {
|
||||
virDomainVcpuPinDefFree(emulatorpin);
|
||||
@ -16894,7 +16893,7 @@ virDomainIOThreadsPinAdd(virDomainPinDefPtr **iothreadspin_list,
|
||||
*niothreadspin,
|
||||
iothread_id);
|
||||
if (iothreadpin) {
|
||||
iothreadpin->vcpuid = iothread_id;
|
||||
iothreadpin->id = iothread_id;
|
||||
virBitmapFree(iothreadpin->cpumask);
|
||||
iothreadpin->cpumask = virBitmapNewData(cpumap, maplen);
|
||||
if (!iothreadpin->cpumask)
|
||||
@ -16908,7 +16907,7 @@ virDomainIOThreadsPinAdd(virDomainPinDefPtr **iothreadspin_list,
|
||||
if (VIR_ALLOC(iothreadpin) < 0)
|
||||
goto error;
|
||||
|
||||
iothreadpin->vcpuid = iothread_id;
|
||||
iothreadpin->id = iothread_id;
|
||||
iothreadpin->cpumask = virBitmapNewData(cpumap, maplen);
|
||||
if (!iothreadpin->cpumask)
|
||||
goto error;
|
||||
@ -16931,7 +16930,7 @@ virDomainIOThreadsPinDel(virDomainDefPtr def,
|
||||
virDomainPinDefPtr *iothreadspin_list = def->cputune.iothreadspin;
|
||||
|
||||
for (i = 0; i < def->cputune.niothreadspin; i++) {
|
||||
if (iothreadspin_list[i]->vcpuid == iothread_id) {
|
||||
if (iothreadspin_list[i]->id == iothread_id) {
|
||||
virBitmapFree(iothreadspin_list[i]->cpumask);
|
||||
VIR_DELETE_ELEMENT(def->cputune.iothreadspin, i,
|
||||
def->cputune.niothreadspin);
|
||||
@ -20103,7 +20102,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
continue;
|
||||
|
||||
virBufferAsprintf(buf, "<vcpupin vcpu='%u' ",
|
||||
def->cputune.vcpupin[i]->vcpuid);
|
||||
def->cputune.vcpupin[i]->id);
|
||||
|
||||
if (!(cpumask = virBitmapFormat(def->cputune.vcpupin[i]->cpumask)))
|
||||
goto error;
|
||||
@ -20130,7 +20129,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
continue;
|
||||
|
||||
virBufferAsprintf(buf, "<iothreadpin iothread='%u' ",
|
||||
def->cputune.iothreadspin[i]->vcpuid);
|
||||
def->cputune.iothreadspin[i]->id);
|
||||
|
||||
if (!(cpumask = virBitmapFormat(def->cputune.iothreadspin[i]->cpumask)))
|
||||
goto error;
|
||||
|
@ -1903,7 +1903,7 @@ struct _virDomainClockDef {
|
||||
typedef struct _virDomainPinDef virDomainPinDef;
|
||||
typedef virDomainPinDef *virDomainPinDefPtr;
|
||||
struct _virDomainPinDef {
|
||||
int vcpuid;
|
||||
int id;
|
||||
virBitmapPtr cpumask;
|
||||
};
|
||||
|
||||
|
@ -1084,7 +1084,7 @@ libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver, virDomainObjPtr vm)
|
||||
cpumaplen = VIR_CPU_MAPLEN(VIR_NODEINFO_MAXCPUS(nodeinfo));
|
||||
|
||||
for (vcpu = 0; vcpu < def->cputune.nvcpupin; ++vcpu) {
|
||||
if (vcpu != def->cputune.vcpupin[vcpu]->vcpuid)
|
||||
if (vcpu != def->cputune.vcpupin[vcpu]->id)
|
||||
continue;
|
||||
|
||||
if (VIR_ALLOC_N(cpumap, cpumaplen) < 0)
|
||||
|
@ -2095,7 +2095,7 @@ libxlDomainGetVcpuPinInfo(virDomainPtr dom, int ncpumaps,
|
||||
/* if vcpupin setting exists, there may be unused pcpus */
|
||||
for (n = 0; n < targetDef->cputune.nvcpupin; n++) {
|
||||
vcpupin_list = targetDef->cputune.vcpupin;
|
||||
vcpu = vcpupin_list[n]->vcpuid;
|
||||
vcpu = vcpupin_list[n]->id;
|
||||
cpumask = vcpupin_list[n]->cpumask;
|
||||
cpumap = VIR_GET_CPUMAP(cpumaps, maplen, vcpu);
|
||||
for (pcpu = 0; pcpu < maxcpu; pcpu++) {
|
||||
|
@ -948,7 +948,7 @@ qemuSetupCgroupVcpuPin(virCgroupPtr cgroup,
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < nvcpupin; i++) {
|
||||
if (vcpuid == vcpupin[i]->vcpuid)
|
||||
if (vcpuid == vcpupin[i]->id)
|
||||
return qemuSetupCgroupEmulatorPin(cgroup, vcpupin[i]->cpumask);
|
||||
}
|
||||
|
||||
@ -964,7 +964,7 @@ qemuSetupCgroupIOThreadsPin(virCgroupPtr cgroup,
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < niothreadspin; i++) {
|
||||
if (iothreadid == iothreadspin[i]->vcpuid)
|
||||
if (iothreadid == iothreadspin[i]->id)
|
||||
return qemuSetupCgroupEmulatorPin(cgroup, iothreadspin[i]->cpumask);
|
||||
}
|
||||
|
||||
@ -1059,7 +1059,7 @@ qemuSetupCgroupForVcpu(virDomainObjPtr vm)
|
||||
/* find the right CPU to pin, otherwise
|
||||
* qemuSetupCgroupVcpuPin will fail. */
|
||||
for (j = 0; j < def->cputune.nvcpupin; j++) {
|
||||
if (def->cputune.vcpupin[j]->vcpuid != i)
|
||||
if (def->cputune.vcpupin[j]->id != i)
|
||||
continue;
|
||||
|
||||
if (qemuSetupCgroupVcpuPin(cgroup_vcpu,
|
||||
@ -1236,7 +1236,7 @@ qemuSetupCgroupForIOThreads(virDomainObjPtr vm)
|
||||
* qemuSetupCgroupIOThreadsPin will fail. */
|
||||
for (j = 0; j < def->cputune.niothreadspin; j++) {
|
||||
/* IOThreads are numbered/named 1..n */
|
||||
if (def->cputune.iothreadspin[j]->vcpuid != i + 1)
|
||||
if (def->cputune.iothreadspin[j]->id != i + 1)
|
||||
continue;
|
||||
|
||||
if (qemuSetupCgroupIOThreadsPin(cgroup_iothread,
|
||||
|
@ -4751,7 +4751,7 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
|
||||
|
||||
vcpupin->cpumask = virBitmapNew(VIR_DOMAIN_CPUMASK_LEN);
|
||||
virBitmapCopy(vcpupin->cpumask, vm->def->cpumask);
|
||||
vcpupin->vcpuid = i;
|
||||
vcpupin->id = i;
|
||||
if (VIR_APPEND_ELEMENT_COPY(vm->def->cputune.vcpupin,
|
||||
vm->def->cputune.nvcpupin, vcpupin) < 0) {
|
||||
virBitmapFree(vcpupin->cpumask);
|
||||
|
Loading…
x
Reference in New Issue
Block a user