Michal Privoznik via Devel wrote:

> From: Michal Privoznik <[email protected]>
> 
> Use freshly introduced qemuAgentGetGuestDeviceInfo() to implement
> support of VIR_DOMAIN_GUEST_INFO_DEVICES type of
> virDomainGetGuestInfo() API in the QEMU driver.

s/QEMU/bhyve/

> 
> Signed-off-by: Michal Privoznik <[email protected]>
> ---

<snip>

>  
> +    if (supportedTypes & VIR_DOMAIN_GUEST_INFO_DEVICES) {
> +        rc = qemuAgentGetGuestDeviceInfo(agent, &devices, 
> report_unsupported);
> +        if (rc == -1)
> +            goto exitagent;
> +        if (rc >= 0)
> +            ndevices = rc;
> +    }
> +
>      bhyveDomainObjExitAgent(vm, agent);
>      virDomainObjEndAgentJob(vm);
>  
> @@ -3016,6 +3027,8 @@ bhyveDomainGetGuestInfo(virDomainPtr domain,
>          virTypedParamListAddDouble(list, load15m, 
> VIR_DOMAIN_GUEST_INFO_LOAD_15M);
>      }
>  
> +    qemuAgentGuestDeviceInfoFormatParams(devices, ndevices, list);
> +

I wonder if we should call qemuAgentGuestDeviceInfoFormatParams() only
if qemuAgentGetGuestDeviceInfo() succeeds?

For example, qemu guest agent on FreeBSD does not support
'guest-get-devices', so running `guestinfo --devices <domain>` fails
with "error: guest agent command failed: ...". However, when running
`guestinfo <domain>`, it works fine, but prints:

device.count        : 0

I guess it would be better to omit this line in this case.

I think this applies to the QEMU driver too.

Reply via email to