On 09/08/2016 07:34 AM, sureshab(a)linux.vnet.ibm.com wrote:
From: Suresh Babu Angadi <sureshab(a)in.ibm.com>
this patch adds additional parameter 'console' to
templates for s390x architecture.
for s390x only, allow update of console to either sclp/virtio
Signed-off-by: Suresh Babu Angadi <sureshab(a)in.ibm.com>
---
control/templates.py | 1 +
model/templates.py | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/control/templates.py b/control/templates.py
index 0406c6b..ca36be3 100644
--- a/control/templates.py
+++ b/control/templates.py
@@ -76,5 +76,6 @@ class Template(Resource):
}
if os.uname()[4] in ['s390x', 's390']:
info['interfaces'] = self.info.get('interfaces', [])
+ info['console'] =
self.info.get('console', '')
Why do you need to expose that info to the API? Any plans to allow user
to change that or should that info be displayed on UI?
return info
diff --git a/model/templates.py b/model/templates.py
index 04e6626..faf1fd5 100644
--- a/model/templates.py
+++ b/model/templates.py
@@ -65,6 +65,9 @@ class TemplatesModel(object):
interfaces = params.get('interfaces', [])
validate_interfaces(interfaces)
+ if os.uname()[4] not in ['s390x', 's390'] and 'console'
in params:
+ raise InvalidParameter("KCHTMPL0040E")
+
# get source_media
source_media = params.pop("source_media")
@@ -229,6 +232,9 @@ class TemplateModel(object):
interfaces = params.get('interfaces', [])
validate_interfaces(interfaces)
+ if os.uname()[4] not in ['s390x', 's390'] and 'console'
in params:
+ raise InvalidParameter("KCHTMPL0040E")
+
# Merge graphics settings
graph_args = params.get('graphics')
if graph_args: