[libvirt] [PATCH 2/7] qemu: Add qemuProcessVerifyCPU

Pavel Hrdina phrdina at redhat.com
Wed Jul 12 13:14:20 UTC 2017


On Wed, Jul 12, 2017 at 02:56:48PM +0200, Jiri Denemark wrote:
> Separated from qemuProcessUpdateLiveGuestCPU. The function makes sure
> a guest CPU provides all features required by a domain definition.
> 
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---
>  src/qemu/qemu_process.c | 35 ++++++++++++++++++++++++++++-------
>  1 file changed, 28 insertions(+), 7 deletions(-)
> 
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index b2d27b6be..198f68d93 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -3986,6 +3986,31 @@ qemuProcessFetchGuestCPU(virQEMUDriverPtr driver,
>  
>  
>  static int
> +qemuProcessVerifyCPU(virDomainObjPtr vm,
> +                     virCPUDataPtr cpu)
> +{
> +    virDomainDefPtr def = vm->def;
> +
> +    if (!cpu)
> +        return 0;
> +
> +    if (qemuProcessVerifyKVMFeatures(def, cpu) < 0 ||
> +        qemuProcessVerifyHypervFeatures(def, cpu) < 0)
> +        return -1;
> +
> +    if (!def->cpu ||
> +        (def->cpu->mode == VIR_CPU_MODE_CUSTOM &&
> +         !def->cpu->model))

This condition is now on two places, it would be worth to create a
macro/function with some description why this specific condition.

> +        return 0;
> +
> +    if (qemuProcessVerifyCPUFeatures(def, cpu) < 0)
> +        return -1;
> +
> +    return 0;
> +}
> +

Reviewed-by: Pavel Hrdina <phrdina at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170712/27308c24/attachment-0001.sig>


More information about the libvir-list mailing list