
On 09/08/2016 07:33 AM, sureshab@linux.vnet.ibm.com wrote:
From: Suresh Babu Angadi <sureshab@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@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.
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')
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: