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

sureshab at linux.vnet.ibm.com sureshab at linux.vnet.ibm.com
Thu Sep 8 10:33:59 UTC 2016


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'
+
     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'
         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:
-- 
2.1.0




More information about the Kimchi-devel mailing list