diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 91b045d04a1e8aae4bec303158c6f258306945f0..5370a089f11f67676d57118f96e566c4c3d970a3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1288,6 +1288,9 @@ int virDomainDefSetVcpusMax(virDomainDefPtr def, unsigned int maxvcpus) { + if (maxvcpus < def->vcpus) + def->vcpus = maxvcpus; + def->maxvcpus = maxvcpus; return 0; diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 80f5907375ba31447e7236b13914abdaff2ae8c6..f65cfb221a2def7cdd1c27b17149f70f158b38c6 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -2188,9 +2188,6 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_CONFIG: if (virDomainDefSetVcpusMax(def, nvcpus) < 0) goto cleanup; - - if (nvcpus < def->vcpus) - def->vcpus = nvcpus; break; case VIR_DOMAIN_VCPU_CONFIG: diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5dc72436b57c46d8b60175b0f48d76408c644d94..6b59687f714dd71918addbc287761848778be96f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4981,9 +4981,6 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, if (flags & VIR_DOMAIN_VCPU_MAXIMUM) { if (virDomainDefSetVcpusMax(persistentDef, nvcpus) < 0) goto endjob; - - if (nvcpus < persistentDef->vcpus) - persistentDef->vcpus = nvcpus; } else { persistentDef->vcpus = nvcpus; } diff --git a/src/test/test_driver.c b/src/test/test_driver.c index de0043adf298b724818ddb7771325625952fd4e9..d4d8e56840fd768a7bd6179ef56e903a70122e80 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2379,9 +2379,6 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus, if (flags & VIR_DOMAIN_VCPU_MAXIMUM) { if (virDomainDefSetVcpusMax(persistentDef, nrCpus) < 0) goto cleanup; - - if (nrCpus < persistentDef->vcpus) - persistentDef->vcpus = nrCpus; } else { persistentDef->vcpus = nrCpus; } diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c index 7b0c30518b72171fc954b4440d1fb4d7daba53cd..c324fdc2c4a67f48c7707c881abda31ddf05007f 100644 --- a/src/xen/xm_internal.c +++ b/src/xen/xm_internal.c @@ -706,9 +706,6 @@ xenXMDomainSetVcpusFlags(virConnectPtr conn, if (flags & VIR_DOMAIN_VCPU_MAXIMUM) { if (virDomainDefSetVcpusMax(entry->def, vcpus) < 0) goto cleanup; - - if (entry->def->vcpus > vcpus) - entry->def->vcpus = vcpus; } else { entry->def->vcpus = vcpus; }