Entering code freeze for Kimchi 1.5
by Aline Manera
Hi all,
We are entering the code freeze phase for 1.5 release.
That means only bug fixes will be merged from now on until the release
announcement.
Please, any help for testing Kimchi in the various Linux distributions
is more than welcome.
The test matrix is already updated:
https://github.com/kimchi-project/kimchi/wiki/Testing-1.5
Please, update it according to your tests.
I'd also want to ask your help to update the translations files.
Regards,
Aline Manera
9 years, 6 months
[PATCH 0/4 v3][Memory HotPlug] Implements backend of memory device hotplug
by Rodrigo Trujillo
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 test and adds slot test
src/kimchi/i18n.py | 7 ++
src/kimchi/model/config.py | 3 +
src/kimchi/model/featuretests.py | 43 +++++++++++
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 | 2 +-
tests/test_rest.py | 4 +-
tests/test_vmtemplate.py | 5 +-
10 files changed, 279 insertions(+), 26 deletions(-)
create mode 100644 src/kimchi/xmlutils/cpu.py
--
2.1.0
9 years, 6 months
[PATCH V2] Resize Actions button
by Socorro Stoppler
From: Socorro Stoppler <socorrob(a)us.ibm.com>
V1 - V2:
Changed Actions button width to span all 3 buttons above it
Socorro Stoppler (1):
Change button behavior for pause/resume VM
ui/css/theme-default/list.css | 2 +-
ui/js/src/kimchi.guest_main.js | 4 +++-
ui/pages/guest.html.tmpl | 10 +++++-----
3 files changed, 9 insertions(+), 7 deletions(-)
--
1.9.1
9 years, 6 months
[PATCH] Bug fix: Allow user creates multiple templates
by Aline Manera
While trying to create multiple templates I got the following error on
console:
[08/Jun/2015:12:57:23] HTTP Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 670, in respond
response.body = self.handler()
File "/usr/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 217, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 61, in __call__
return self.callable(*self.args, **self.kwargs)
File "/home/alinefm/kimchi/src/kimchi/control/base.py", line 330, in index
return self.create(parse_request(), *args)
File "/home/alinefm/kimchi/src/kimchi/control/base.py", line 262, in create
name = create(*args)
File "/home/alinefm/kimchi/src/kimchi/model/templates.py", line 48, in create
user = UserTests().probe_user()
File "/home/alinefm/kimchi/src/kimchi/kvmusertests.py", line 55, in probe_user
flags=libvirt.VIR_DOMAIN_START_AUTODESTROY)
File "/usr/lib/python2.7/dist-packages/libvirt.py", line 3424, in createXML
if ret is None:raise libvirtError('virDomainCreateXML() failed', conn=self)
libvirtError: operation failed: domain 'KVMUSERTEST_VM' already exists
with uuid 2be4b2e8-f57a-4f87-8c24-5ac59d4bb4af
The error happens because of a race condition while trying to get the kvm user
(to validate the ISO file permissions). To avoid this problem, a lock
was added to ensure the code is run once at a time.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/kimchi/kvmusertests.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/kvmusertests.py b/src/kimchi/kvmusertests.py
index 37a80d7..315354e 100644
--- a/src/kimchi/kvmusertests.py
+++ b/src/kimchi/kvmusertests.py
@@ -18,6 +18,7 @@
import platform
import psutil
+import threading
import libvirt
@@ -36,18 +37,21 @@ class UserTests(object):
<boot dev='hd'/>
</os>
</domain>"""
+ lock = threading.Lock()
user = None
@classmethod
def probe_user(cls):
- if cls.user:
- return cls.user
+ with cls.lock:
+ if cls.user:
+ return cls.user
arch = 'ppc64' if platform.machine() == 'ppc64le' \
else platform.machine()
xml = cls.SIMPLE_VM_XML % {'name': KVMUSERTEST_VM_NAME, 'arch': arch}
+ cls.lock.acquire()
with RollbackContext() as rollback:
conn = libvirt.open(None)
rollback.prependDefer(conn.close)
@@ -67,6 +71,7 @@ class UserTests(object):
else:
cls.user = p.username
+ cls.lock.release()
return cls.user
--
2.1.0
9 years, 6 months
[PATCH] List IPs of VM Ifaces
by Christy Perez
Signed-off-by: Christy Perez <christy(a)linux.vnet.ibm.com>
---
docs/API.md | 1 +
src/kimchi/mockmodel.py | 9 +++++++++
src/kimchi/model/vmifaces.py | 28 ++++++++++++++++++++++++++++
tests/test_rest.py | 6 ++++++
4 files changed, 44 insertions(+)
diff --git a/docs/API.md b/docs/API.md
index e022c9e..10e80ac 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -299,6 +299,7 @@ A interface represents available network interface on VM.
* bridge *(optional)*: the name of resource bridge, only be available when the
interface type is bridge.
* mac: Media Access Control Address of the VM interface.
+ * ips: A list of IP addresses associated with this MAC.
* model *(optional)*: model of emulated network interface card. It will be one of these models:
ne2k_pci, i82551, i82557b, i82559er, rtl8139, e1000, pcnet and virtio.
* network *(optional)*: the name of resource network, only be available when the
diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index aaf1af2..3f74b80 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -24,6 +24,7 @@ import random
import time
import kimchi.model.cpuinfo
+import kimchi.model.vmifaces
from lxml import objectify
from lxml.builder import E
@@ -76,6 +77,7 @@ class MockModel(Model):
kimchi.model.cpuinfo.get_topo_capabilities = \
MockModel.get_topo_capabilities
+ kimchi.model.vmifaces.getDHCPLeases = MockModel.getDHCPLeases
libvirt.virConnect.defineXML = MockModel.domainDefineXML
libvirt.virDomain.XMLDesc = MockModel.domainXMLDesc
libvirt.virDomain.undefine = MockModel.undefineDomain
@@ -235,6 +237,13 @@ class MockModel(Model):
pool = vol.storagePoolLookupByVolume()
pool.createXML(new_xml)
+ @staticmethod
+ def getDHCPLeases(net, mac):
+ return [{'iface': 'virbr1', 'ipaddr': '192.168.0.167',
+ 'hostname': 'kimchi', 'expirytime': 1433285036L,
+ 'prefix': 24, 'clientid': '01:%s' % mac,
+ 'mac': mac, 'iaid': None, 'type': 0}]
+
def _probe_image(self, path):
return ('unknown', 'unknown')
diff --git a/src/kimchi/model/vmifaces.py b/src/kimchi/model/vmifaces.py
index 93a769b..630e4dc 100644
--- a/src/kimchi/model/vmifaces.py
+++ b/src/kimchi/model/vmifaces.py
@@ -29,6 +29,14 @@ from kimchi.model.vms import DOM_STATE_MAP, VMModel
from kimchi.xmlutils.interface import get_iface_xml
+def getDHCPLeases(net, mac):
+ try:
+ leases = net.DHCPLeases(mac)
+ return leases
+ except libvirt.libvirtError:
+ return []
+
+
class VMIfacesModel(object):
def __init__(self, **kargs):
self.conn = kargs['conn']
@@ -132,9 +140,29 @@ class VMIfaceModel(object):
info['network'] = iface.source.get('network')
if info['type'] == 'bridge':
info['bridge'] = iface.source.get('bridge')
+ info['ips'] = self._get_ips(info['mac'], info['network'])
return info
+ def _get_ips(self, mac, network):
+ ips = []
+ conn = self.conn.get()
+ # An iface may have multiple IPs
+ # An IP could have been assigned without libvirt.
+ # First check the ARP cache.
+ with open('/proc/net/arp') as f:
+ ips = [line.split()[0] for line in f.xreadlines() if mac in line]
+ # Some ifaces may be inactive, so if the ARP cache didn't have them,
+ # and they happen to be assigned via DHCP, we can check there too.
+ net = conn.networkLookupByName(network)
+ leases = getDHCPLeases(net, mac)
+ for lease in leases:
+ ip = lease.get('ipaddr')
+ if ip not in ips:
+ ips.append(ip)
+
+ return ips
+
def delete(self, vm, mac):
dom = VMModel.get_vm(vm, self.conn)
iface = self._get_vmiface(vm, mac)
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 7fe6831..2145d00 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -707,6 +707,7 @@ class RestTests(unittest.TestCase):
self.assertEquals(17, len(res['mac']))
self.assertEquals(get_template_default('old', 'nic_model'),
res['model'])
+ self.assertTrue('ips' in res)
# try to attach an interface without specifying 'model'
req = json.dumps({'type': 'network'})
@@ -737,6 +738,11 @@ class RestTests(unittest.TestCase):
newMacAddr).read())
self.assertEquals(newMacAddr, iface['mac'])
+ # Check for an IP address
+ iface = json.loads(self.request('/vms/test-vm/ifaces/%s' %
+ newMacAddr).read())
+ self.assertTrue(len(iface['ips']) > 0)
+
# detach network interface from vm
resp = self.request('/vms/test-vm/ifaces/%s' % iface['mac'],
'{}', 'DELETE')
--
2.1.0
9 years, 6 months
[PATCH 0/3 v3] Removing Yum API from Kimchi
by Daniel Henrique Barboza
x3:
- skipping yumparser tests in Ubuntu
- make check-local fixes
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 | 111 +++++++++++++++++++
4 files changed, 408 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 0/4 v5] [Memory HotPlug] Implements backend of memory device hotplug
by Rodrigo Trujillo
v5:
- Fix vmtemplate test in PPC
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 | 9 ++-
10 files changed, 326 insertions(+), 27 deletions(-)
create mode 100644 src/kimchi/xmlutils/cpu.py
--
2.1.0
9 years, 6 months
[PATCH 0/3 v2] Removing Yum API from Kimchi
by Daniel Henrique Barboza
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] Fix issue: Kimchi always create qcow2 disk images
by Rodrigo Trujillo
If the user change disk format in template.conf, templates are going to
be created correctly and vm xml as well. But, when the disk is created,
the format is always qcow2.
Removing the line:
"fmt = 'raw' if self._get_storage_type() in ['logical'] else 'qcow2'"
fixes the issue, since same checking is being done in __init__ in line
78.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/vmtemplate.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index e047228..e73c487 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -192,7 +192,6 @@ class VMTemplate(object):
def to_volume_list(self, vm_uuid):
storage_path = self._get_storage_path()
- fmt = 'raw' if self._get_storage_type() in ['logical'] else 'qcow2'
ret = []
for i, d in enumerate(self.info['disks']):
index = d.get('index', i)
@@ -200,11 +199,11 @@ class VMTemplate(object):
info = {'name': volume,
'capacity': d['size'],
- 'format': fmt,
+ 'format': d['format'],
'path': '%s/%s' % (storage_path, volume)}
if 'logical' == self._get_storage_type() or \
- fmt not in ['qcow2', 'raw']:
+ d['format'] not in ['qcow2', 'raw']:
info['allocation'] = info['capacity']
else:
info['allocation'] = 0
--
2.1.0
9 years, 6 months