[virt-tools-list] [PATCH] osdict, libosinfo: use "minimum" resources when "recommended" is missing

Christophe Fergeau cfergeau at redhat.com
Mon Sep 15 09:49:43 UTC 2014


On Fri, Sep 12, 2014 at 05:50:15PM +0200, Giuseppe Scrivano wrote:
> Some OS entries in libosinfo miss the "recommended" resources block.
> In this case use the "minimum" resources when available.
> 
> Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
> ---
>  virtinst/osdict.py | 22 ++++++++++++++++------
>  1 file changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/virtinst/osdict.py b/virtinst/osdict.py
> index 9e48270..76794c3 100644
> --- a/virtinst/osdict.py
> +++ b/virtinst/osdict.py
> @@ -436,18 +436,28 @@ class _OsVariant(_OsVariantType):
>  
>      def get_recommended_resources(self, arch):
>          ret = {}
> -        def read_resource(resources, arch):
> +        def read_resource(resources, minimum, arch):
> +            # If we are reading the "minimum" block, allocate more
> +            # resources.
> +            ram_scale = minimum and 2 or 1
> +            n_cpus_scale = minimum and 2 or 1
> +            storage_scale = minimum and 2 or 1

I don't know if this is typical python, but I find this hard to read
(but I do python at most once per year, so this may be crystal clear to
people experienced with python :). I thought you had picked different
scaling factors for cpu/ram/storage?

Apart from these non-critical comments, looks good to me, ACK if I'm
allowed to give ACKs to virt-manager patches

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20140915/07a9188a/attachment.sig>


More information about the virt-tools-list mailing list