mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: Exit on first error in qemuDomainGetMemoryParameters
There is no point in trying to fill params beyond the first error, because when qemuDomainGetMemoryParameters returns -1 then the caller cannot detect which values in params are valid.
This commit is contained in:
parent
076cf3a0bd
commit
a1109a7c7c
@ -9676,7 +9676,6 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
|
||||||
for (i = 0; i < *nparams; i++) {
|
for (i = 0; i < *nparams; i++) {
|
||||||
virMemoryParameterPtr param = ¶ms[i];
|
virMemoryParameterPtr param = ¶ms[i];
|
||||||
val = 0;
|
val = 0;
|
||||||
@ -9689,14 +9688,12 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom,
|
|||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
virReportSystemError(-rc, "%s",
|
virReportSystemError(-rc, "%s",
|
||||||
_("unable to get memory hard limit"));
|
_("unable to get memory hard limit"));
|
||||||
ret = -1;
|
goto cleanup;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if (virStrcpyStatic(param->field, VIR_DOMAIN_MEMORY_HARD_LIMIT) == NULL) {
|
if (virStrcpyStatic(param->field, VIR_DOMAIN_MEMORY_HARD_LIMIT) == NULL) {
|
||||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Field memory hard limit too long for destination"));
|
"%s", _("Field memory hard limit too long for destination"));
|
||||||
ret = -1;
|
goto cleanup;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
param->value.ul = val;
|
param->value.ul = val;
|
||||||
break;
|
break;
|
||||||
@ -9706,14 +9703,12 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom,
|
|||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
virReportSystemError(-rc, "%s",
|
virReportSystemError(-rc, "%s",
|
||||||
_("unable to get memory soft limit"));
|
_("unable to get memory soft limit"));
|
||||||
ret = -1;
|
goto cleanup;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if (virStrcpyStatic(param->field, VIR_DOMAIN_MEMORY_SOFT_LIMIT) == NULL) {
|
if (virStrcpyStatic(param->field, VIR_DOMAIN_MEMORY_SOFT_LIMIT) == NULL) {
|
||||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Field memory soft limit too long for destination"));
|
"%s", _("Field memory soft limit too long for destination"));
|
||||||
ret = -1;
|
goto cleanup;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
param->value.ul = val;
|
param->value.ul = val;
|
||||||
break;
|
break;
|
||||||
@ -9723,14 +9718,12 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom,
|
|||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
virReportSystemError(-rc, "%s",
|
virReportSystemError(-rc, "%s",
|
||||||
_("unable to get swap hard limit"));
|
_("unable to get swap hard limit"));
|
||||||
ret = -1;
|
goto cleanup;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if (virStrcpyStatic(param->field, VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT) == NULL) {
|
if (virStrcpyStatic(param->field, VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT) == NULL) {
|
||||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Field swap hard limit too long for destination"));
|
"%s", _("Field swap hard limit too long for destination"));
|
||||||
ret = -1;
|
goto cleanup;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
param->value.ul = val;
|
param->value.ul = val;
|
||||||
break;
|
break;
|
||||||
@ -9741,6 +9734,8 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (group)
|
if (group)
|
||||||
virCgroupFree(&group);
|
virCgroupFree(&group);
|
||||||
|
Loading…
Reference in New Issue
Block a user