[PATCH v2][Kimchi 1/2] Issue #838: Extend memory hotplug feature test
by Rodrigo Trujillo
If QEMU version is < 2.1, qemu is not going to start guest which have
maxmemory tag configured in the XML. Kimchi adds this tag by default in
order to allow memory hotplug.
In other words, in order to allow memory hotplug, versions must be
libvirt >= 1.2.14 and qemu >= 2.1. Libvirt was already being tested by
the feature test, but qemu did not. Distros as Red Hat 7 and CentOS
still are in qemu 1.5.
This patch extend the feature test and do not create maxmemory tag in
order to avoid problems in those distros.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
i18n.py | 2 +-
model/featuretests.py | 20 +++++++++++++-------
model/vms.py | 11 ++++++++++-
tests/test_model.py | 5 +++--
vmtemplate.py | 4 +++-
5 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/i18n.py b/i18n.py
index beefeb5..6214687 100644
--- a/i18n.py
+++ b/i18n.py
@@ -99,7 +99,7 @@ messages = {
"KCHVM0043E": _("Only increase memory is allowed in active VMs"),
"KCHVM0044E": _("For live memory update, new memory value must be equal old memory value plus multiples of 1024 Mib"),
"KCHVM0045E": _("There are not enough free slots of 1024 Mib in the guest."),
- "KCHVM0046E": _("Host's libvirt version does not support memory devices. Libvirt must be >= 1.2.14"),
+ "KCHVM0046E": _("Host's libvirt or qemu version does not support memory devices and memory hotplug. Libvirt must be >= 1.2.14 and QEMU must be >= 2.1."),
"KCHVM0047E": _("Error attaching memory device. Details: %(error)s"),
"KCHVM0048E": _("Cannot start %(name)s. Virtual machine is already running."),
"KCHVM0049E": _("Cannot power off %(name)s. Virtual machine is shut off."),
diff --git a/model/featuretests.py b/model/featuretests.py
index 378335a..ba728e1 100644
--- a/model/featuretests.py
+++ b/model/featuretests.py
@@ -72,6 +72,14 @@ MAXMEM_VM_XML = """
<type arch='%(arch)s'>hvm</type>
<boot dev='hd'/>
</os>
+ <cpu>
+ <numa>
+ <cell id='0' cpus='0' memory='10240' unit='KiB'/>
+ </numa>
+ </cpu>
+ <features>
+ <acpi/>
+ </features>
</domain>"""
DEV_MEM_XML = """
@@ -209,13 +217,9 @@ class FeatureTests(object):
A memory device can be hot-plugged or hot-unplugged since libvirt
version 1.2.14.
'''
- # Libvirt < 1.2.14 does not support memory devices, so firstly, check
- # its version, then try to attach a device. These steps avoid errors
- # with Libvirt 'test' driver for KVM
- version = 1000000*1 + 1000*2 + 14
- if libvirt.getVersion() < version:
- return False
-
+ # Libvirt < 1.2.14 does not support memory devices, so try to attach a
+ # device. Then check if QEMU (>= 2.1) supports memory hotplug, starting
+ # the guest These steps avoid errors with Libvirt 'test' driver for KVM
with RollbackContext() as rollback:
FeatureTests.disable_libvirt_error_logging()
rollback.prependDefer(FeatureTests.enable_libvirt_error_logging)
@@ -230,6 +234,8 @@ class FeatureTests(object):
try:
dom.attachDeviceFlags(DEV_MEM_XML,
libvirt.VIR_DOMAIN_MEM_CONFIG)
+ dom.create()
+ rollback.prependDefer(dom.destroy)
return True
except libvirt.libvirtError:
return False
diff --git a/model/vms.py b/model/vms.py
index 03ffdae..e3bc266 100644
--- a/model/vms.py
+++ b/model/vms.py
@@ -170,7 +170,8 @@ class VMsModel(object):
stream_protocols = self.caps.libvirt_stream_protocols
xml = t.to_vm_xml(name, vm_uuid,
libvirt_stream_protocols=stream_protocols,
- graphics=graphics)
+ graphics=graphics,
+ mem_hotplug_support = self.caps.mem_hotplug_support)
cb('Defining new VM')
try:
@@ -809,6 +810,14 @@ class VMModel(object):
return (nonascii_name if nonascii_name is not None else vm_name, dom)
def _update_memory_config(self, xml, params):
+ # Cannot pass max memory if there is not support to memory hotplug
+ # Then set max memory as memory, just to continue with the update
+ if not self.caps.mem_hotplug_support:
+ if 'maxmemory' in params['memory']:
+ raise InvalidOperation("KCHVM0046E")
+ else:
+ params['memory']['maxmemory'] = params['memory']['current']
+
root = ET.fromstring(xml)
# MiB to KiB
hasMem = 'current' in params['memory']
diff --git a/tests/test_model.py b/tests/test_model.py
index b461172..c91ba8f 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -912,13 +912,14 @@ class ModelTests(unittest.TestCase):
# rename and increase memory when vm is not running
params = {'name': u'пeω-∨м',
- 'memory': {'current': 2048,
- 'maxmemory': 2048}}
+ 'memory': {'current': 2048}}
inst.vm_update('kimchi-vm1', params)
rollback.prependDefer(utils.rollback_wrapper, inst.vm_delete,
u'пeω-∨м')
self.assertEquals(info['uuid'], inst.vm_lookup(u'пeω-∨м')['uuid'])
info = inst.vm_lookup(u'пeω-∨м')
+ # Max memory is returned, add to test
+ params['memory']['maxmemory'] = 2048
for key in params.keys():
self.assertEquals(params[key], info[key])
diff --git a/vmtemplate.py b/vmtemplate.py
index 4bcf324..653ad02 100644
--- a/vmtemplate.py
+++ b/vmtemplate.py
@@ -376,7 +376,9 @@ class VMTemplate(object):
# Rearrange memory parameters
params['memory'] = self.info['memory'].get('current')
params['max_memory'] = ""
- if memory != maxmemory:
+ # if there is not support to memory hotplug in Libvirt or qemu, we
+ # cannot add the tag maxMemory
+ if memory != maxmemory and kwargs.get('mem_hotplug_support', True):
maxmem_xml = "<maxMemory slots='%s' unit='MiB'>%s</maxMemory>"
params['max_memory'] = maxmem_xml % (slots, maxmemory)
--
2.1.0
8 years, 8 months
[PATCH][Kimchi 0/6] Use a single field to create a template
by Ramon Medeiros
Instead of specify if the media is cdrom or disk, use source_media to create a template
Ramon Medeiros (6):
Create a single field to pass the installation media
Method to retrieve stored templates at object store
Fix checking duplicate template before creating it
Identify installation media while creating template
Only use source_media as boot media
Update tests
API.json | 5 ++
i18n.py | 2 +-
model/templates.py | 13 ++--
tests/test_authorization.py | 4 +-
tests/test_livemigration.py | 7 +-
tests/test_mockmodel.py | 14 ++--
tests/test_model.py | 69 ++++++++++++--------
tests/test_rest.py | 32 ++++------
tests/test_template.py | 39 +++++-------
tests/test_vmtemplate.py | 24 +++----
utils.py | 30 +++++++++
vmtemplate.py | 152 ++++++++++++++++++++++++++++++++++++++++----
12 files changed, 279 insertions(+), 112 deletions(-)
--
2.5.0
8 years, 8 months
[PATCH] [Kimchi] Adding wok version dependency
by dhbarboza82@gmail.com
From: Daniel Henrique Barboza <dhbarboza82(a)gmail.com>
This patch adds WoK dependency >= 2.1.0 for the upcoming
Kimchi 2.1.0 release packaging.
Signed-off-by: Daniel Henrique Barboza <dhbarboza82(a)gmail.com>
---
contrib/DEBIAN/control.in | 2 +-
contrib/kimchi.spec.fedora.in | 2 +-
contrib/kimchi.spec.suse.in | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/contrib/DEBIAN/control.in b/contrib/DEBIAN/control.in
index b6acdaf..6cfd8ee 100644
--- a/contrib/DEBIAN/control.in
+++ b/contrib/DEBIAN/control.in
@@ -3,7 +3,7 @@ Version: @PACKAGE_VERSION@
Section: base
Priority: optional
Architecture: all
-Depends: wok,
+Depends: wok (>= 2.1.0),
ginger-base,
python-imaging,
python-configobj,
diff --git a/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in
index 292ad03..29d4463 100644
--- a/contrib/kimchi.spec.fedora.in
+++ b/contrib/kimchi.spec.fedora.in
@@ -7,7 +7,7 @@ BuildArch: noarch
Group: System Environment/Base
License: LGPL/ASL2
Source0: %{name}-%{version}.tar.gz
-Requires: wok
+Requires: wok >= 2.1.0
Requires: ginger-base
Requires: qemu-kvm
Requires: gettext
diff --git a/contrib/kimchi.spec.suse.in b/contrib/kimchi.spec.suse.in
index 7a57538..c12bcab 100644
--- a/contrib/kimchi.spec.suse.in
+++ b/contrib/kimchi.spec.suse.in
@@ -7,7 +7,7 @@ BuildArch: noarch
Group: System Environment/Base
License: LGPL/ASL2
Source0: %{name}-%{version}.tar.gz
-Requires: wok
+Requires: wok >= 2.1.0
Requires: ginger-base
Requires: kvm
Requires: gettext-tools
--
2.5.0
8 years, 8 months
[PATCH][Kimchi 1/2] Issue #838: Extend memory hotplug feature test
by Rodrigo Trujillo
If QEMU version is < 2.1, qemu is not going to start guest which have
maxmemory tag configured in the XML. Kimchi adds this tag by default in
order to allow memory hotplug.
In other words, in order to allow memory hotplug, versions must be
libvirt >= 1.2.14 and qemu >= 2.1. Libvirt was already being tested by
the feature test, but qemu did not. Distros as Red Hat 7 and CentOS
still are in qemu 1.5.
This patch extend the feature test and do not create maxmemory tag in
order to avoid problems in those distros.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
i18n.py | 2 +-
model/featuretests.py | 20 +++++++++++++-------
model/vms.py | 8 ++++++++
vmtemplate.py | 7 ++++++-
4 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/i18n.py b/i18n.py
index beefeb5..6214687 100644
--- a/i18n.py
+++ b/i18n.py
@@ -99,7 +99,7 @@ messages = {
"KCHVM0043E": _("Only increase memory is allowed in active VMs"),
"KCHVM0044E": _("For live memory update, new memory value must be equal old memory value plus multiples of 1024 Mib"),
"KCHVM0045E": _("There are not enough free slots of 1024 Mib in the guest."),
- "KCHVM0046E": _("Host's libvirt version does not support memory devices. Libvirt must be >= 1.2.14"),
+ "KCHVM0046E": _("Host's libvirt or qemu version does not support memory devices and memory hotplug. Libvirt must be >= 1.2.14 and QEMU must be >= 2.1."),
"KCHVM0047E": _("Error attaching memory device. Details: %(error)s"),
"KCHVM0048E": _("Cannot start %(name)s. Virtual machine is already running."),
"KCHVM0049E": _("Cannot power off %(name)s. Virtual machine is shut off."),
diff --git a/model/featuretests.py b/model/featuretests.py
index 378335a..ba728e1 100644
--- a/model/featuretests.py
+++ b/model/featuretests.py
@@ -72,6 +72,14 @@ MAXMEM_VM_XML = """
<type arch='%(arch)s'>hvm</type>
<boot dev='hd'/>
</os>
+ <cpu>
+ <numa>
+ <cell id='0' cpus='0' memory='10240' unit='KiB'/>
+ </numa>
+ </cpu>
+ <features>
+ <acpi/>
+ </features>
</domain>"""
DEV_MEM_XML = """
@@ -209,13 +217,9 @@ class FeatureTests(object):
A memory device can be hot-plugged or hot-unplugged since libvirt
version 1.2.14.
'''
- # Libvirt < 1.2.14 does not support memory devices, so firstly, check
- # its version, then try to attach a device. These steps avoid errors
- # with Libvirt 'test' driver for KVM
- version = 1000000*1 + 1000*2 + 14
- if libvirt.getVersion() < version:
- return False
-
+ # Libvirt < 1.2.14 does not support memory devices, so try to attach a
+ # device. Then check if QEMU (>= 2.1) supports memory hotplug, starting
+ # the guest These steps avoid errors with Libvirt 'test' driver for KVM
with RollbackContext() as rollback:
FeatureTests.disable_libvirt_error_logging()
rollback.prependDefer(FeatureTests.enable_libvirt_error_logging)
@@ -230,6 +234,8 @@ class FeatureTests(object):
try:
dom.attachDeviceFlags(DEV_MEM_XML,
libvirt.VIR_DOMAIN_MEM_CONFIG)
+ dom.create()
+ rollback.prependDefer(dom.destroy)
return True
except libvirt.libvirtError:
return False
diff --git a/model/vms.py b/model/vms.py
index 03ffdae..557d37a 100644
--- a/model/vms.py
+++ b/model/vms.py
@@ -809,6 +809,14 @@ class VMModel(object):
return (nonascii_name if nonascii_name is not None else vm_name, dom)
def _update_memory_config(self, xml, params):
+ # Cannot pass max memory if there is not support to memory hotplug
+ # Then set max memory as memory, just to continue with the update
+ if not self.caps.mem_hotplug_support:
+ if 'maxmemory' in params['memory']:
+ raise InvalidOperation("KCHVM0046E")
+ else:
+ params['memory']['maxmemory'] = params['memory']['current']
+
root = ET.fromstring(xml)
# MiB to KiB
hasMem = 'current' in params['memory']
diff --git a/vmtemplate.py b/vmtemplate.py
index 4bcf324..535efd7 100644
--- a/vmtemplate.py
+++ b/vmtemplate.py
@@ -32,6 +32,7 @@ from wok.exception import MissingParameter, OperationFailed
from wok.plugins.kimchi import imageinfo
from wok.plugins.kimchi import osinfo
from wok.plugins.kimchi.isoinfo import IsoImage
+from wok.plugins.kimchi.model.config import CapabilitiesModel
from wok.plugins.kimchi.utils import check_url_path, pool_name_from_uri
from wok.plugins.kimchi.xmlutils.cpu import get_cpu_xml
from wok.plugins.kimchi.xmlutils.disk import get_disk_xml
@@ -118,6 +119,8 @@ class VMTemplate(object):
disk_info['index'] = disk_info.get('index', index)
self.info['disks'][index] = disk_info
+ self.caps = CapabilitiesModel()
+
def _get_os_info(self, args, scan):
distro = version = 'unknown'
@@ -376,7 +379,9 @@ class VMTemplate(object):
# Rearrange memory parameters
params['memory'] = self.info['memory'].get('current')
params['max_memory'] = ""
- if memory != maxmemory:
+ # if there is not support to memory hotplug in Libvirt or qemu, we
+ # cannot add the tag maxMemory
+ if memory != maxmemory and self.caps.mem_hotplug_support:
maxmem_xml = "<maxMemory slots='%s' unit='MiB'>%s</maxMemory>"
params['max_memory'] = maxmem_xml % (slots, maxmemory)
--
2.1.0
8 years, 8 months
[PATCH] [Wok] Issue #41: encode of ident should only happen if it is of type unicode.
by archus@linux.vnet.ibm.com
From: Archana Singh <archus(a)linux.vnet.ibm.com>
Added isinstance unicode check of ident before encoding it.
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
src/wok/control/base.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/wok/control/base.py b/src/wok/control/base.py
index be2e35e..25f6522 100644
--- a/src/wok/control/base.py
+++ b/src/wok/control/base.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
#
# Project Wok
#
@@ -69,7 +70,9 @@ class Resource(object):
self.admin_methods = []
self.log_map = {}
self.log_args = {
- 'ident': self.ident.encode('utf-8') if self.ident else '',
+ 'ident': self.ident.encode('utf-8')
+ if isinstance(self.ident, unicode)
+ else self.ident if self.ident else '',
}
def _redirect(self, action_result, code=303):
--
2.5.0
8 years, 8 months
[RFC] VEPA Network UI and multiple selection
by Samuel Henrique De Oliveira Guimaraes
Hi team,
I was looking into Bootstrap-Select that is already implemented on Wok and it does allows multiple option selection, which means we can use it to select more than one interface when creating a new Vepa network. But instead of looking like a default multi-select input, it keeps the default style and puts the selected items separated by comma:
https://silviomoreto.github.io/bootstrap-select/examples/#multiple-select...
In the other hand, this is what a multiple select looks like with native HTML controls:
http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select_multiple
IMO the default html control looks better and it delivers a better user experience than a dropdown. We can "destroy" Bootstrap-Select style and widget if a VEPA network type is selected and customize the default html control with CSS3 to look like other form elements. However, what if there are hundreds of interfaces? In this case I propose we keep Bootstrap-Select with a search/filter on top, which would work like this jsfiddle:
https://jsfiddle.net/4yvgnx9e/
Any thoughts or comments?
Regards,
Samuel
8 years, 8 months
Gap between the scss/css file's
by Chandra Shekhar Reddy Potula
Hi All,
I see a gap between scss and css always in the upstream code. For sure
during the development we always re-compile and get the latest style
sheets.
My suggestion would be whenever there is a change in the scss file's
request to upstream, will it be good idea to ask developer who want scss
changes to upstream push corresponding css file changes too ie
re-compiled code ?
This will some times eliminate the gap between the css and scss files,
which I suppose mostly taken care by the maintainer at present ?
Just a thought, let me know your views on this !!!
Thanks and Regards
Chandra
8 years, 8 months
[PATCH v2][Kimchi 0/2] Makes Kimchi better use /etc
by Rodrigo Trujillo
v2:
- Apply review changes
v1:
- Kimchi package version was not looking at /etc/kimchi
- Moves template.conf to /etc
Rodrigo Trujillo (2):
Fix issue #840: Change distros.d internal path
Move 'template.conf' to /etc
Makefile.am | 7 +++++--
config.py.in | 5 ++++-
contrib/kimchi.spec.fedora.in | 1 -
contrib/kimchi.spec.suse.in | 1 -
model/config.py | 4 ++++
model/networks.py | 4 ++--
model/storagepools.py | 5 ++---
osinfo.py | 3 ++-
tests/test_model.py | 8 ++++----
9 files changed, 23 insertions(+), 15 deletions(-)
--
2.1.0
8 years, 8 months
[PATCH][Kimchi 0/2] Makes Kimchi better use /etc
by Rodrigo Trujillo
- Kimchi package version was not looking at /etc/kimchi
- Moves template.conf to /etc
Rodrigo Trujillo (2):
Fix issue #840: Change distros.d internal path
Move 'template.conf' to /etc
Makefile.am | 7 +++++--
config.py.in | 7 ++++++-
contrib/kimchi.spec.fedora.in | 1 -
contrib/kimchi.spec.suse.in | 1 -
model/config.py | 4 ++++
model/networks.py | 4 ++--
model/storagepools.py | 5 ++---
osinfo.py | 3 ++-
tests/test_model.py | 8 ++++----
9 files changed, 25 insertions(+), 15 deletions(-)
--
2.1.0
8 years, 8 months