提交 4a194c55 编写于 作者: P Peter Krempa

conf: Extract update of vcpu count if maxvcpus is decreased

The code can be unified into the new accessor rather than being
scattered accross the drivers.
上级 310992c3
......@@ -1288,6 +1288,9 @@ int
virDomainDefSetVcpusMax(virDomainDefPtr def,
unsigned int maxvcpus)
{
if (maxvcpus < def->vcpus)
def->vcpus = maxvcpus;
def->maxvcpus = maxvcpus;
return 0;
......
......@@ -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:
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册