[PATCH 0/4 v4] [Memory HotPlug] Implements backend of memory device hotplug
by Rodrigo Trujillo
v4:
- Fix issues with tests
- Add new memory hotplug test
v3:
* Implemented sugestions from Aline's review:
- removed memory devices API;
- Improved vm update function to check if vm is running and
update memory accordingly;
- moved xml function to xmlutils;
- removed libvirt checking from attachDeviceFlags test function
- moved maxMemory to osinfo.py
* Fixed some issues with CPU update
V2
- Fix erros in tests and add a test to slots number
- Fix other minor issues with Libvirt < 1.2.14
V1
This patchset implements the backend part of memory hotplug functionality,
including:
- new feature test to check if libvirt supports memory devices
- changes the way that memory is assigned or updated in the guest xml:
* memory is now set in a basic NUMA node
- includes maxMemory element in the XML:
* which is equal the total memory of the host
* sets memory device slots. The total number of slots are equal the
maxMemory minus the memory assigned (1 slot == 1 GB )
- creates a new VM device, the memory device:
* by default, a memory device will have 1GB
* user can add the memory device with machine running or offline
- memory devices are selected according to its position in the xml (the slot)
0, 1, 2, etc
URL:
- http://localhost:8010/vms/<VM>/memdevices
- http://localhost:8010/vms/<VM>/memdevices/<MEM-DEV>
Rodrigo Trujillo (4):
[Memory HotPlug] Feature test to check support to memory devices
[Memory HotPlug] Add maxMemory into templates
[Memory HotPlug] Add maxMemory and numa configuration to guest xml
[Memory HotPlug] Fix tests, adds slot and memory hotplug tests
src/kimchi/i18n.py | 7 ++
src/kimchi/model/config.py | 3 +
src/kimchi/model/featuretests.py | 50 +++++++++++++
src/kimchi/model/vms.py | 149 +++++++++++++++++++++++++++++++++++----
src/kimchi/osinfo.py | 4 ++
src/kimchi/vmtemplate.py | 28 +++++---
src/kimchi/xmlutils/cpu.py | 60 ++++++++++++++++
tests/test_model.py | 31 +++++++-
tests/test_rest.py | 12 +++-
tests/test_vmtemplate.py | 5 +-
10 files changed, 322 insertions(+), 27 deletions(-)
create mode 100644 src/kimchi/xmlutils/cpu.py
--
2.1.0
9 years, 6 months
[PATCH] pep8 fixes
by Daniel Henrique Barboza
pep8 version 1.6.2 added a rule in which the logical operand must be
before a line break, not after:
"W503 line break before binary operator"
Signed-off-by: Daniel Henrique Barboza <dhbarboza82(a)gmail.com>
---
contrib/check_i18n.py | 4 ++--
src/kimchi/control/base.py | 4 ++--
src/kimchi/model/vms.py | 4 ++--
src/kimchi/model/vmstorages.py | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/contrib/check_i18n.py b/contrib/check_i18n.py
index a7eeef6..6a2603c 100755
--- a/contrib/check_i18n.py
+++ b/contrib/check_i18n.py
@@ -55,8 +55,8 @@ def check_obsolete_messages(path, messages):
for root, dirs, files in os.walk(path):
for f in files:
fname = os.path.join(root, f)
- if (not fname.endswith("i18n.py") and fname.endswith(".py")
- or fname.endswith(".json")):
+ if (not fname.endswith("i18n.py") and fname.endswith(".py") or
+ fname.endswith(".json")):
with open(fname) as f:
string = "".join(f.readlines())
if k in string:
diff --git a/src/kimchi/control/base.py b/src/kimchi/control/base.py
index b9520c0..006a6f7 100644
--- a/src/kimchi/control/base.py
+++ b/src/kimchi/control/base.py
@@ -112,8 +112,8 @@ class Resource(object):
action_fn = getattr(self.model, model_fn(self, action_name))
action_result = action_fn(*model_args)
if destructive is False or \
- ('persistent' in self.info.keys()
- and self.info['persistent'] is True):
+ ('persistent' in self.info.keys() and
+ self.info['persistent'] is True):
return render_fn(self, action_result)
except MissingParameter, e:
raise cherrypy.HTTPError(400, e.message)
diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index ed1500e..2ef274c 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -598,8 +598,8 @@ class VMModel(object):
expire = params['graphics'].get("passwdValidTo")
to = graphics.attrib.get('passwdValidTo')
if to is not None:
- if (time.mktime(time.strptime(to, '%Y-%m-%dT%H:%M:%S'))
- - time.time() <= 0):
+ if (time.mktime(time.strptime(to, '%Y-%m-%dT%H:%M:%S')) -
+ time.time() <= 0):
expire = expire if expire is not None else 30
if expire is not None:
diff --git a/src/kimchi/model/vmstorages.py b/src/kimchi/model/vmstorages.py
index d3d4a8b..142b177 100644
--- a/src/kimchi/model/vmstorages.py
+++ b/src/kimchi/model/vmstorages.py
@@ -97,8 +97,8 @@ class VMStoragesModel(object):
char = dev_list.pop()[2]
params['index'] = string.ascii_lowercase.index(char) + 1
- if (params['bus'] not in HOTPLUG_TYPE
- and DOM_STATE_MAP[dom.info()[0]] != 'shutoff'):
+ if (params['bus'] not in HOTPLUG_TYPE and
+ DOM_STATE_MAP[dom.info()[0]] != 'shutoff'):
raise InvalidOperation('KCHVMSTOR0011E')
if params.get('vol'):
--
2.1.0
9 years, 6 months
[PATCH v3] UI-Template Edit: Enable user to change disk format
by Rodrigo Trujillo
v3:
Implements suggestions from Aline:
- Removed loops
- Create IDs for SELECT elements
v2:
Implements suggestions from Cristian
v1:
Initial version
Rodrigo Trujillo (1):
UI-Template Edit: Enable user to change disk format
ui/css/theme-default/template-edit.css | 8 ++++++--
ui/js/src/kimchi.template_edit_main.js | 37 ++++++++++++++++++++++++++++------
ui/pages/template-edit.html.tmpl | 18 ++++++++++++++++-
3 files changed, 54 insertions(+), 9 deletions(-)
--
2.1.0
9 years, 6 months
[PATCH v4] Supress error messages while checking vm metadata
by Ramon Medeiros
The function FeatureTests.disable_libvirt_error_logging only removes the
error message that will be displayed on the console. Libvirt also logs
errors on messages log. To avoid flood messages log with metadata errors,
it will be verified manually if the xml has the tag.
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
Changes:
v4:
Fix make check-local errors
v3:
Discard all code writed before. Aline suggested me a nice workaround, check
if the xml has metadata tag.
---
src/kimchi/model/utils.py | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/kimchi/model/utils.py b/src/kimchi/model/utils.py
index 0c9d519..7f27edd 100644
--- a/src/kimchi/model/utils.py
+++ b/src/kimchi/model/utils.py
@@ -22,7 +22,6 @@ from lxml import etree, objectify
from lxml.builder import E, ElementMaker
from kimchi.exception import OperationFailed
-from kimchi.model.featuretests import FeatureTests
KIMCHI_META_URL = "https://github.com/kimchi-project/kimchi"
KIMCHI_NAMESPACE = "kimchi"
@@ -84,7 +83,8 @@ def _kimchi_set_metadata_node(dom, node):
def libvirt_get_kimchi_metadata_node(dom, mode="current"):
- FeatureTests.disable_libvirt_error_logging()
+ if not metadata_exists(dom):
+ return None
try:
xml = dom.metadata(libvirt.VIR_DOMAIN_METADATA_ELEMENT,
KIMCHI_META_URL,
@@ -92,8 +92,6 @@ def libvirt_get_kimchi_metadata_node(dom, mode="current"):
return etree.fromstring(xml)
except libvirt.libvirtError:
return None
- finally:
- FeatureTests.enable_libvirt_error_logging()
def set_metadata_node(dom, node, metadata_support, mode="all"):
@@ -151,3 +149,12 @@ def get_metadata_node(dom, tag, metadata_support, mode="current"):
if node is not None:
return etree.tostring(node)
return ""
+
+
+def metadata_exists(dom):
+ xml = dom.XMLDesc(libvirt.VIR_DOMAIN_XML_INACTIVE)
+ root = etree.fromstring(xml)
+
+ if root.find("metadata") is None:
+ return False
+ return True
--
2.1.0
9 years, 6 months
[PATCH 0/3] Removing Yum API from Kimchi
by Daniel Henrique Barboza
From: Daniel Henrique Barboza <dhbarboza82(a)gmmail.com>
The use of Yum API is causing a memory leak each time the
Host tab is loaded. This can be verified by seeing the use
of memory in $top.
To remove the Yum API, a new module named 'yumparser' was created
to manipulate Yum repositories directly from the filesystem and to
return the software update list by parsing $yum check-update command.
A new unit test file was created to verify the proper
behavior of the yumparser module.
Daniel Henrique Barboza (3):
Adding yumparser module
Unit tests for the yumparser module
Changing repositories and swupdate to use yumparser module
src/kimchi/repositories.py | 65 ++++-------
src/kimchi/swupdate.py | 16 +--
src/kimchi/yumparser.py | 271 +++++++++++++++++++++++++++++++++++++++++++++
tests/test_yumparser.py | 109 ++++++++++++++++++
4 files changed, 406 insertions(+), 55 deletions(-)
create mode 100644 src/kimchi/yumparser.py
create mode 100644 tests/test_yumparser.py
--
2.1.0
9 years, 6 months
[PATCH v3] Supress error messages while checking vm metadata
by Ramon Medeiros
The function FeatureTests.disable_libvirt_error_logging only removes the
error message that will be displayed on the console. Libvirt also logs
errors on messages log. To avoid flood messages log with metadata errors,
it will be verified manually if the xml has the tag.
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
Changes:
v3:
Discard all code writed before. Aline suggested me a nice workaround, check
if the xml has metadata tag.
---
src/kimchi/model/utils.py | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/kimchi/model/utils.py b/src/kimchi/model/utils.py
index 0c9d519..d4994d5 100644
--- a/src/kimchi/model/utils.py
+++ b/src/kimchi/model/utils.py
@@ -84,7 +84,8 @@ def _kimchi_set_metadata_node(dom, node):
def libvirt_get_kimchi_metadata_node(dom, mode="current"):
- FeatureTests.disable_libvirt_error_logging()
+ if not metadata_exists(dom):
+ return None
try:
xml = dom.metadata(libvirt.VIR_DOMAIN_METADATA_ELEMENT,
KIMCHI_META_URL,
@@ -92,8 +93,6 @@ def libvirt_get_kimchi_metadata_node(dom, mode="current"):
return etree.fromstring(xml)
except libvirt.libvirtError:
return None
- finally:
- FeatureTests.enable_libvirt_error_logging()
def set_metadata_node(dom, node, metadata_support, mode="all"):
@@ -151,3 +150,12 @@ def get_metadata_node(dom, tag, metadata_support, mode="current"):
if node is not None:
return etree.tostring(node)
return ""
+
+def metadata_exists(dom):
+ xml = dom.XMLDesc(libvirt.VIR_DOMAIN_XML_INACTIVE)
+ root = etree.fromstring(xml)
+
+ if root.find("metadata") == None:
+ return False
+ return True
+
--
2.1.0
9 years, 6 months
[PATCH V2]
by Socorro Stoppler
From: Socorro Stoppler <socorrob(a)us.ibm.com>
V1 - V2:
- The image in the tile section is no longer shifted down when VM is paused.
- Removed tabs and replaced with spaces throughout the code.
Socorro Stoppler (1):
Add support for Pause/Resume UI
ui/css/theme-default/button.css | 20 +++++
ui/css/theme-default/list.css | 24 +++++-
ui/images/theme-default/ac22_pause.png | Bin 0 -> 1219 bytes
ui/images/theme-default/ac22_pause_grey.png | Bin 0 -> 1175 bytes
ui/images/theme-default/ac24_resume.png | Bin 0 -> 1341 bytes
ui/images/theme-default/ac24_resume_grey.png | Bin 0 -> 1282 bytes
ui/js/src/kimchi.api.js | 22 ++++++
ui/js/src/kimchi.guest_main.js | 109 +++++++++++++++++++++++----
ui/pages/guest.html.tmpl | 4 +
9 files changed, 161 insertions(+), 18 deletions(-)
create mode 100644 ui/images/theme-default/ac22_pause.png
create mode 100644 ui/images/theme-default/ac22_pause_grey.png
create mode 100644 ui/images/theme-default/ac24_resume.png
create mode 100644 ui/images/theme-default/ac24_resume_grey.png
--
1.9.1
9 years, 6 months
[PATCH 0/2] Pause/resume support in UI
by Socorro Stoppler
From: Socorro Stoppler <socorrob(a)us.ibm.com>
Add support for pause/resume VM via the UI
Socorro Stoppler (2):
First changes for pause/resume UI
Add support for Pause/Resume UI
ui/css/theme-default/button.css | 20 +++++
ui/css/theme-default/list.css | 6 ++
ui/images/theme-default/ac22_pause.png | Bin 0 -> 1219 bytes
ui/images/theme-default/ac22_pause_grey.png | Bin 0 -> 1175 bytes
ui/images/theme-default/ac24_resume.png | Bin 0 -> 1341 bytes
ui/images/theme-default/ac24_resume_grey.png | Bin 0 -> 1282 bytes
ui/js/src/kimchi.api.js | 23 ++++++
ui/js/src/kimchi.guest_main.js | 114 +++++++++++++++++++++++----
ui/pages/guest.html.tmpl | 4 +
9 files changed, 152 insertions(+), 15 deletions(-)
create mode 100644 ui/images/theme-default/ac22_pause.png
create mode 100644 ui/images/theme-default/ac22_pause_grey.png
create mode 100644 ui/images/theme-default/ac24_resume.png
create mode 100644 ui/images/theme-default/ac24_resume_grey.png
--
1.9.1
9 years, 6 months
[PATCH 0/3 V2] Storage volume upload UI
by Aline Manera
V1 - V2:
- Deal with non-existing file and read permission errors
Aline Manera (3):
Storage volume upload: Keep the task tracking to update the UI
Storage volume upload: Let the 'format' parameter be an empty string
Enable storage volume upload on UI
src/kimchi/API.json | 2 +-
src/kimchi/mockmodel.py | 3 +-
src/kimchi/model/storagevolumes.py | 20 +++++--
tests/test_model_storagevolume.py | 2 +-
ui/js/src/kimchi.api.js | 25 +++++++--
ui/js/src/kimchi.storagepool_add_volume_main.js | 73 ++++++++++++++++++++++---
ui/pages/i18n.json.tmpl | 2 +
ui/pages/storagepool-add-volume.html.tmpl | 4 +-
8 files changed, 107 insertions(+), 24 deletions(-)
--
2.1.0
9 years, 6 months
[PATCH v3] Does not list non-bootable images
by Ramon Medeiros
Also fix tests that were using non-bootable isos.
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
Changes:
v3:
Fix errors listed by make check-local
v2:
Fix tests that were listing non-bootable isos
---
src/kimchi/model/storagevolumes.py | 2 +-
tests/test_rest.py | 13 ++++++++-----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/kimchi/model/storagevolumes.py b/src/kimchi/model/storagevolumes.py
index 9165946..4cc3a0d 100644
--- a/src/kimchi/model/storagevolumes.py
+++ b/src/kimchi/model/storagevolumes.py
@@ -527,7 +527,7 @@ class IsoVolumesModel(object):
for volume in volumes:
res = self.storagevolume.lookup(pool_name,
volume.decode("utf-8"))
- if res['format'] == 'iso':
+ if res['format'] == 'iso' and res['bootable']:
res['name'] = '%s' % volume
iso_volumes.append(res)
return iso_volumes
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 72ff14f..7fe6831 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -61,12 +61,15 @@ def setUpModule():
# Create fake ISO to do the tests
iso_gen.construct_fake_iso(fake_iso, True, '12.04', 'ubuntu')
+ iso_gen.construct_fake_iso("/var/lib/libvirt/images/fedora.iso", True,
+ "17", "fedora")
def tearDownModule():
test_server.stop()
os.unlink('/tmp/obj-store-test')
os.unlink(fake_iso)
+ os.unlink("/var/lib/libvirt/images/fedora.iso")
class RestTests(unittest.TestCase):
@@ -928,9 +931,9 @@ class RestTests(unittest.TestCase):
storagevolume['path'])
self.assertEquals(1073741824, storagevolume['capacity']) # 1 GiB
self.assertEquals(0, storagevolume['allocation'])
- self.assertEquals('unknown', storagevolume['os_version'])
- self.assertEquals('unknown', storagevolume['os_distro'])
- self.assertEquals(False, storagevolume['bootable'])
+ self.assertEquals('17', storagevolume['os_version'])
+ self.assertEquals('fedora', storagevolume['os_distro'])
+ self.assertEquals(True, storagevolume['bootable'])
# Create a template
# In real model os distro/version can be omitted
@@ -945,8 +948,8 @@ class RestTests(unittest.TestCase):
# Verify the template
t = json.loads(self.request('/templates/test').read())
self.assertEquals('test', t['name'])
- self.assertEquals('unknown', t['os_distro'])
- self.assertEquals('unknown', t['os_version'])
+ self.assertEquals('fedora', t['os_distro'])
+ self.assertEquals('17', t['os_version'])
self.assertEquals(get_template_default('old', 'memory'), t['memory'])
# Deactivate or destroy scan pool return 405
--
2.1.0
9 years, 6 months