mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
conf: Move vcpu count check into helper
This commit is contained in:
parent
957d597330
commit
80a8ac3c1e
@ -1315,6 +1315,13 @@ int
|
|||||||
virDomainDefSetVcpus(virDomainDefPtr def,
|
virDomainDefSetVcpus(virDomainDefPtr def,
|
||||||
unsigned int vcpus)
|
unsigned int vcpus)
|
||||||
{
|
{
|
||||||
|
if (vcpus > def->maxvcpus) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("maxvcpus must not be less than current vcpus (%u < %u)"),
|
||||||
|
vcpus, def->maxvcpus);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
def->vcpus = vcpus;
|
def->vcpus = vcpus;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -14441,13 +14448,6 @@ virDomainVcpuParse(virDomainDefPtr def,
|
|||||||
if (virDomainDefSetVcpus(def, vcpus) < 0)
|
if (virDomainDefSetVcpus(def, vcpus) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (maxvcpus < def->vcpus) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
||||||
_("maxvcpus must not be less than current vcpus "
|
|
||||||
"(%u < %u)"), maxvcpus, def->vcpus);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp = virXPathString("string(./vcpu[1]/@placement)", ctxt);
|
tmp = virXPathString("string(./vcpu[1]/@placement)", ctxt);
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
if ((def->placement_mode =
|
if ((def->placement_mode =
|
||||||
|
Loading…
Reference in New Issue
Block a user