[libvirt] [PATCH 3/4] qemu: Introduce qemuDomainMachineIsPSeries()

Laine Stump laine at laine.org
Thu Jun 23 18:13:49 UTC 2016


On 06/23/2016 04:40 AM, Andrea Bolognani wrote:
> This new function checks for both the architecture and the
> machine type, so we can use it instead of writing the same
> checks over and over again.
> ---
>   src/qemu/qemu_command.c        | 13 +++++--------
>   src/qemu/qemu_domain.c         | 19 ++++++++++++++++---
>   src/qemu/qemu_domain.h         |  1 +
>   src/qemu/qemu_domain_address.c |  9 +++------
>   src/qemu/qemu_parse_command.c  | 12 ++++--------
>   5 files changed, 29 insertions(+), 25 deletions(-)
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 10bcb1c..e2201ff 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
[...]
> @@ -4930,6 +4929,20 @@ qemuDomainMachineIsVirt(const virDomainDef *def)
>   }
>   
>   
> +bool
> +qemuDomainMachineIsPSeries(const virDomainDef *def)
> +{
> +    if (!ARCH_IS_PPC64(def->os.arch))
> +        return false;
> +
> +    if (STRNEQ(def->os.machine, "pseries") &&
> +        !STRPREFIX(def->os.machine, "pseries-"))
> +        return false;

...and you've also made sure that it will continue to work if the 
pseries machinetype is ever versioned (as all machinetypes should be).

ACK.





More information about the libvir-list mailing list