[Kimchi-devel] [PATCH] Setting default memory of PPC to 2048
dhbarboza82 at gmail.com
dhbarboza82 at gmail.com
Fri Jul 31 18:00:14 UTC 2015
From: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
At this moment Kimchi for Power systems does not support guests
created with less that 2Gb of RAM. This patch set the default
Power template to reflect it.
Any user defined setting in template.conf will overwrite this
default. This is intended. The user must have the final
word in the customization of his/her VM templates.
Signed-off-by: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
---
src/kimchi/osinfo.py | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/src/kimchi/osinfo.py b/src/kimchi/osinfo.py
index 78eb828..6506f2d 100644
--- a/src/kimchi/osinfo.py
+++ b/src/kimchi/osinfo.py
@@ -44,28 +44,28 @@ template_specs = {'x86': {'old': dict(disk_bus='ide',
cdrom_bus='scsi',
kbd_type="kbd",
kbd_bus='usb', mouse_bus='usb',
- tablet_bus='usb', memory=1280),
+ tablet_bus='usb', memory=2048),
'modern': dict(disk_bus='virtio',
nic_model='virtio',
cdrom_bus='scsi',
kbd_bus='usb',
kbd_type="kbd",
mouse_bus='usb', tablet_bus='usb',
- memory=1280)},
+ memory=2048)},
'ppc64le': {'old': dict(disk_bus='virtio',
nic_model='virtio',
cdrom_bus='scsi',
kbd_bus='usb',
kbd_type="keyboard",
mouse_bus='usb', tablet_bus='usb',
- memory=1280),
+ memory=2048),
'modern': dict(disk_bus='virtio',
nic_model='virtio',
cdrom_bus='scsi',
kbd_bus='usb',
kbd_type="keyboard",
mouse_bus='usb', tablet_bus='usb',
- memory=1280)}}
+ memory=2048)}}
custom_specs = {'fedora': {'22': dict(video_model='qxl')}}
@@ -89,6 +89,16 @@ icon_available_distros = [icon[5:-4] for icon in glob.glob1('%s/images/'
% paths.ui_dir, 'icon-*.png')]
+def _get_arch():
+ for arch, sub_archs in SUPPORTED_ARCHS.iteritems():
+ if os.uname()[4] in sub_archs:
+ return arch
+
+
+def _get_default_template_mem(host_arch):
+ return template_specs[host_arch]['modern'].get('memory', 1024)
+
+
def _get_tmpl_defaults():
"""
ConfigObj returns a dict like below when no changes were made in the
@@ -107,7 +117,7 @@ def _get_tmpl_defaults():
# Create dict with default values
tmpl_defaults = defaultdict(dict)
tmpl_defaults['main']['networks'] = ['default']
- tmpl_defaults['main']['memory'] = 1024
+ tmpl_defaults['main']['memory'] = _get_default_template_mem(_get_arch())
tmpl_defaults['storage']['pool'] = 'default'
tmpl_defaults['storage']['disk.0'] = {'size': 10, 'format': 'qcow2'}
tmpl_defaults['processor']['cpus'] = 1
@@ -157,12 +167,6 @@ def _get_tmpl_defaults():
defaults = _get_tmpl_defaults()
-def _get_arch():
- for arch, sub_archs in SUPPORTED_ARCHS.iteritems():
- if os.uname()[4] in sub_archs:
- return arch
-
-
def get_template_default(template_type, field):
host_arch = _get_arch()
# Assuming 'power' = 'ppc64le' because lookup() does the same,
--
2.4.3
More information about the Kimchi-devel
mailing list