mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-25 14:05:18 +00:00
qemu: hotplug: Disallow modification of vcpu 0 in inactive config
vcpu 0 must be always enabled and non-hotpluggable, thus you can't modify it using the vcpu hotplug APIs. Disallow it so that users can't create invalid configurations. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1459785
This commit is contained in:
parent
0f0c0921e6
commit
b183f17d76
@ -5884,18 +5884,17 @@ qemuDomainFilterHotplugVcpuEntities(virDomainDefPtr def,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
qemuDomainVcpuValidateConfig(virDomainDefPtr def,
|
qemuDomainVcpuValidateConfig(virDomainDefPtr def,
|
||||||
virBitmapPtr map,
|
virBitmapPtr map)
|
||||||
bool state)
|
|
||||||
{
|
{
|
||||||
virDomainVcpuDefPtr vcpu;
|
virDomainVcpuDefPtr vcpu;
|
||||||
size_t maxvcpus = virDomainDefGetVcpusMax(def);
|
size_t maxvcpus = virDomainDefGetVcpusMax(def);
|
||||||
ssize_t next;
|
ssize_t next;
|
||||||
ssize_t firstvcpu = -1;
|
ssize_t firstvcpu = -1;
|
||||||
|
|
||||||
/* vcpu 0 can't be disabled */
|
/* vcpu 0 can't be modified */
|
||||||
if (!state && virBitmapIsBitSet(map, 0)) {
|
if (virBitmapIsBitSet(map, 0)) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("vCPU '0' must be enabled"));
|
_("vCPU '0' can't be modified"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5959,7 +5958,7 @@ qemuDomainSetVcpuInternal(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (persistentDef) {
|
if (persistentDef) {
|
||||||
if (qemuDomainVcpuValidateConfig(persistentDef, map, state) < 0)
|
if (qemuDomainVcpuValidateConfig(persistentDef, map) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user