mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
vcpupin: add virDomainVcpupinDel function
This patch add the private API (virDomainVcpupinDel). This API can delete the vcpupin setting of a specified virtual cpu. Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
This commit is contained in:
parent
c4a8ca71b1
commit
3711c0b051
@ -8206,6 +8206,45 @@ cleanup:
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
virDomainVcpupinDel(virDomainDefPtr def, int vcpu)
|
||||
{
|
||||
int n;
|
||||
bool deleted = false;
|
||||
virDomainVcpupinDefPtr *vcpupin_list = def->cputune.vcpupin;
|
||||
|
||||
/* No vcpupin exists yet */
|
||||
if (!def->cputune.nvcpupin) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (n = 0; n < def->cputune.nvcpupin; n++) {
|
||||
if (vcpupin_list[n]->vcpuid == vcpu) {
|
||||
VIR_FREE(vcpupin_list[n]->cpumask);
|
||||
VIR_FREE(vcpupin_list[n]);
|
||||
memmove(&vcpupin_list[n],
|
||||
&vcpupin_list[n+1],
|
||||
(def->cputune.nvcpupin - n - 1) * sizeof(virDomainVcpupinDef *));
|
||||
deleted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!deleted)
|
||||
return 0;
|
||||
|
||||
if (--def->cputune.nvcpupin == 0) {
|
||||
virDomainVcpupinDefFree(def->cputune.vcpupin, 0);
|
||||
} else {
|
||||
if (VIR_REALLOC_N(def->cputune.vcpupin, def->cputune.nvcpupin) < 0) {
|
||||
virReportOOMError();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
virDomainLifecycleDefFormat(virBufferPtr buf,
|
||||
int type,
|
||||
|
@ -1412,6 +1412,8 @@ int virDomainVcpupinAdd(virDomainDefPtr def,
|
||||
int maplen,
|
||||
int vcpu);
|
||||
|
||||
int virDomainVcpupinDel(virDomainDefPtr def, int vcpu);
|
||||
|
||||
int virDomainDiskIndexByName(virDomainDefPtr def, const char *name);
|
||||
int virDomainDiskInsert(virDomainDefPtr def,
|
||||
virDomainDiskDefPtr disk);
|
||||
|
@ -364,6 +364,7 @@ virDomainTimerTickpolicyTypeToString;
|
||||
virDomainTimerTrackTypeFromString;
|
||||
virDomainTimerTrackTypeToString;
|
||||
virDomainVcpupinAdd;
|
||||
virDomainVcpupinDel;
|
||||
virDomainVcpupinFindByVcpu;
|
||||
virDomainVcpupinIsDuplicate;
|
||||
virDomainVideoDefFree;
|
||||
|
Loading…
Reference in New Issue
Block a user