[libvirt] [PATCH 07/13] qemu: Simplify qemuDomainGetVcpusFlags by using virDomainObjGetOneDef
John Ferlan
jferlan at redhat.com
Wed Jun 17 20:58:00 UTC 2015
On 06/15/2015 03:47 PM, Peter Krempa wrote:
> virDomainObjGetOneDef is simpler to use than virDomainObjGetDefs
> ---
> src/qemu/qemu_driver.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
ACK - 3/13 to 7/13
although there's an "unrelated", but since I was here NIT below.
John
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index c878409..2cb0215 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -5479,7 +5479,6 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
> qemuDomainObjPrivatePtr priv;
> virDomainObjPtr vm;
> virDomainDefPtr def;
> - virDomainDefPtr persistentDef;
> int ret = -1;
> qemuAgentCPUInfoPtr cpuinfo = NULL;
> int ncpuinfo = -1;
> @@ -5498,11 +5497,11 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
> if (virDomainGetVcpusFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
> goto cleanup;
>
> - if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0)
> + if (!(def = virDomainObjGetOneDef(vm, flags)))
> goto cleanup;
>
> if (flags & VIR_DOMAIN_VCPU_GUEST) {
> - if (persistentDef) {
> + if (!virDomainObjIsActive(vm)) {
> virReportError(VIR_ERR_INVALID_ARG, "%s",
> _("vCPU count provided by the guest agent can only be "
> " requested for live domains"));
Existing, but there will be a double space in the output message...
> @@ -5543,9 +5542,6 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
> ret++;
> }
> } else {
> - if (!def)
> - def = persistentDef;
> -
> if (flags & VIR_DOMAIN_VCPU_MAXIMUM)
> ret = def->maxvcpus;
> else
>
More information about the libvir-list
mailing list