[Kimchi-devel] [PATCH] [Kimchi 1/4] adding 'console' parameter for s390x arch

Suresh Babu Angadi sureshab at linux.vnet.ibm.com
Tue Sep 13 06:45:27 UTC 2016



On 09/13/2016 02:16 AM, Aline Manera wrote:
>
>
> On 09/08/2016 07:33 AM, sureshab at linux.vnet.ibm.com wrote:
>> From: Suresh Babu Angadi <sureshab at in.ibm.com>
>>
>> for s390x, console can be either virtio/sclp
>> this patch sets virtio as default console for s390x
>>
>> Signed-off-by: Suresh Babu Angadi <sureshab at in.ibm.com>
>> ---
>>   osinfo.py          | 4 ++++
>>   xmlutils/serial.py | 6 +++++-
>>   2 files changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/osinfo.py b/osinfo.py
>> index 3e56d97..6069c46 100644
>> --- a/osinfo.py
>> +++ b/osinfo.py
>> @@ -163,6 +163,10 @@ def _get_tmpl_defaults():
>>       tmpl_defaults['processor']['maxvcpus'] = 1
>>       tmpl_defaults['graphics'] = {'type': 'vnc', 'listen': '127.0.0.1'}
>
>> +    # for s390x architecture, set default console as sclp
>> +    if host_arch in ['s390x', 's390']:
>> +        tmpl_defaults['console'] = 'virtio'
>> +
>
> This should be added to the modern/old dicts.
this is configurable parameter, adding in tmpl_defaults makes more 
sense. old/modren dict contains constants such as type of disk bus, 
interface model etc.
>
>>       default_config = ConfigObj(tmpl_defaults)
>>
>>       # Load template configuration file
>> diff --git a/xmlutils/serial.py b/xmlutils/serial.py
>> index c823ee6..a25bf23 100644
>> --- a/xmlutils/serial.py
>> +++ b/xmlutils/serial.py
>> @@ -38,6 +38,7 @@ def get_serial_xml(params):
>>        </console>
>>
>>       For s390x
>> +    target type can be sclp/virtio
>>       <console type='pty'>
>>         <target type='sclp' port='0'/>
>>       </console>
>> @@ -50,8 +51,11 @@ def get_serial_xml(params):
>>           return ET.tostring(console, encoding='utf-8', 
>> pretty_print=True)
>>       # for s390x
>>       elif params["arch"] in ["s390x"]:
>
>> +        # if params doesn't have console parameter, use virtio as 
>> default
>> +        console_type = params.get('console') \
>> +            if params.get('console') else 'virtio'
>
> The default type, from previous code, is sclp.
>
> So you only need to do:
>
> console_type = params.get('console', 'sclp')
the hypervisor default value for console is 'virtio', hence will make it 
console_type = params.get('console', 'virtio')
>
>>           console = E.console(type="pty")
>> -        console.append(E.target(type="sclp", port='0'))
>> +        console.append(E.target(type=console_type, port='0'))
>>           return ET.tostring(console, encoding='utf-8', 
>> pretty_print=True)
>>       # for x
>>       else:
>

-- 
Regards,
Suresh Babu Angadi




More information about the Kimchi-devel mailing list