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

Giuseppe Scrivano gscrivan at redhat.com
Mon Sep 15 10:06:30 UTC 2014


Christophe Fergeau <cfergeau at redhat.com> writes:

> 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?

yes, I've changed them after your feedback.


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

thanks, I'll wait a bit more for comments and push it later.

Regards,
Giuseppe




More information about the virt-tools-list mailing list