RFC - Guest memory usage
by Daniel Henrique Barboza
I was looking at the following item in the backlog:
Guests Stats: Display memory utilization (use virt-df or virt-top or ...)
If I understood it right, the idea here is to show the -inner- memory
allocation of the guest. If you have a VM with 4Gb of RAM running an
Ubuntu, we want to know how much memory the Ubuntu OS and its processes
are using.
I've done an investigation and I haven't found any tool to accomplish
this. "virt-top", "virsh dommemstat" and the libvirt API retrieves the
information of the memory usage of the guest relative to the host. In
the example mentioned before, supposing that the host has 64Gb of RAM,
all these tools would show that the VM is using 12% of the host RAM.
They do not dive in the VM and shows the actual mem usage of the Ubuntu
and its processes running there.
Haven't found anything useful in other MLs and forums. The common answer
is 'run top in a terminal inside the VM', which of course does not suit
us. My question is: any thoughts about how we can implement this
feature? Because I am starting to think that, in the end, this kind of
info is strict to the guest OS and can't be polled from the outside.
Thanks!
9 years, 2 months
[PATCH 0/6 - V2][Memory HotPlug] Implements backend of memory device hotplug
by Rodrigo Trujillo
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 (6):
[Memory HotPlug] Feature test to check support to memory devices
[Memory HotPlug] Add maxMemory and numa configuration to guest xml
[Memory HotPlug] Memory device control and model classes
[Memory HotPlug] Add parameters checking and documentation to memory
device API
[Memory HotPlug] Fix VM offline memory update and fix slots assignment
[Memory HotPlug] Fix test and adds slot test
docs/API.md | 16 +++++++
src/kimchi/API.json | 14 +++++-
src/kimchi/control/vm/memdevices.py | 47 +++++++++++++++++++
src/kimchi/i18n.py | 5 ++
src/kimchi/mockmodel.py | 7 +++
src/kimchi/model/config.py | 3 ++
src/kimchi/model/featuretests.py | 43 +++++++++++++++++
src/kimchi/model/vmmemdevices.py | 94 +++++++++++++++++++++++++++++++++++++
src/kimchi/model/vms.py | 85 ++++++++++++++++++++++++++++-----
src/kimchi/vmtemplate.py | 40 ++++++++++++----
tests/test_model.py | 2 +-
tests/test_rest.py | 4 +-
tests/test_vmtemplate.py | 5 +-
13 files changed, 338 insertions(+), 27 deletions(-)
create mode 100644 src/kimchi/control/vm/memdevices.py
create mode 100644 src/kimchi/model/vmmemdevices.py
--
2.1.0
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 v2] 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
v2:
Fix tests that were listing non-bootable isos
---
src/kimchi/model/storagevolumes.py | 2 +-
tests/test_rest.py | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/kimchi/model/storagevolumes.py b/src/kimchi/model/storagevolumes.py
index dc807e4..e88c2cb 100644
--- a/src/kimchi/model/storagevolumes.py
+++ b/src/kimchi/model/storagevolumes.py
@@ -530,7 +530,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 914b602..9e5988b 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -61,13 +61,14 @@ 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):
def _async_op(self, cb, opaque):
@@ -926,9 +927,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
@@ -943,8 +944,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
@@ -1187,7 +1188,6 @@ class RestTests(unittest.TestCase):
resp = self.request('%s/fedora-fake' % base_uri, '{}', 'DELETE')
self.assertEquals(204, resp.status)
-
class HttpsRestTests(RestTests):
"""
Run all of the same tests as above, but use https instead
--
2.1.0
9 years, 6 months
[PATCH 0/3 V4] Storage volume upload UI
by Aline Manera
V3 - V4:
- Rebase
V2 - V3:
- Adjust error handlers to work with Chrome
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 | 96 +++++++++++++++++++++----
ui/pages/i18n.json.tmpl | 2 +
ui/pages/storagepool-add-volume.html.tmpl | 4 +-
8 files changed, 126 insertions(+), 28 deletions(-)
--
2.1.0
9 years, 6 months
[PATCH] Add DESTDIR to make install
by Ramon Medeiros
Commit 04d29530 was incomplete by not using DESTDIR on installation.
This can cause trouble when creating the rpm. Also, make install now is
installing correctly service and firewall configuration files.
---
Makefile.am | 54 +++++++++++++++++++++++++++++++------------
contrib/kimchi.spec.fedora.in | 3 ---
2 files changed, 39 insertions(+), 18 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 91a0fa2..46e0e0e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -116,26 +116,50 @@ ChangeLog:
install-data-local:
@if test -d /usr/lib/systemd/system/ ; then \
- $(INSTALL_DATA) contrib/kimchid.service.fedora /usr/lib/systemd/system/kimchid.service; \
- systemctl daemon-reload; \
+ mkdir -p $(DESTDIR)/usr/lib/systemd/system/; \
+ $(INSTALL_DATA) contrib/kimchid.service.fedora $(DESTDIR)/usr/lib/systemd/system/kimchid.service; \
elif test -d /etc/systemd/system; then \
- $(INSTALL_DATA) contrib/kimchid.service.fedora /etc/systemd/system/kimchid.service; \
- systemctl daemon-reload; \
- else \
- $(INSTALL_DATA) contrib/kimchid.sysvinit /etc/init.d/kimchid; \
- chmod +x /etc/init.d/kimchid; \
- fi
+ mkdir -p $(DESTDIR)/etc/systemd/system/; \
+ $(INSTALL_DATA) contrib/kimchid.service.fedora $(DESTDIR)/etc/systemd/system/kimchid.service; \
+ else \
+ mkdir -p $(DESTDIR)/etc/init.d/ \
+ $(INSTALL_DATA) contrib/kimchid.sysvinit $(DESTDIR)/etc/init.d/kimchid; \
+ chmod +x $(DESTDIR)/etc/init.d/kimchid; \
+ if test -f /etc/fedora-release || test -f /etc/redhat-release; then \
+ $(INSTALL_DATA) contrib/kimchid-upstart.conf.fedora $(DESTDIR)/etc/init/kimchi.conf; \
+ elif test -f /etc/debian_version; then \
+ $(INSTALL_DATA) contrib/kimchid-upstart.conf.debian $(DESTDIR)/etc/init/kimchi.conf; \
+ fi; \
+ fi; \
+ if test -d /usr/lib/firewalld/services/; then \
+ mkdir -p $(DESTDIR)/usr/lib/firewalld/services/; \
+ $(INSTALL_DATA) src/firewalld.xml $(DESTDIR)/usr/lib/firewalld/services/kimchid.xml; \
+ fi; \
+ mkdir -p $(DESTDIR)/var/lib/kimchi/{debugreports,screenshots,vnc-tokens,isos}
+ touch $(DESTDIR)/var/lib/kimchi/objectstore
+ mkdir -p $(DESTDIR)/var/log/kimchi/
+ touch $(DESTDIR)/var/log/kimchi/kimchi-access.log
+ touch $(DESTDIR)/var/log/kimchi/kimchi-error.log
+ mkdir -p $(DESTDIR)/etc/kimchi/
+ touch $(DESTDIR)/etc/nginx/conf.d/kimchi.conf
uninstall-local:
@if test -f /usr/lib/systemd/system/kimchid.service; then \
- $(RM) /usr/lib/systemd/system/kimchid.service; \
- systemctl daemon-reload; \
- elif test -f /etc/systemd/system/kimchid.service; then \
- $(RM) /etc/systemd/system/kimchid.service; \
+ $(RM) $(DESTDIR)/usr/lib/systemd/system/kimchid.service; \
+ elif test -f $(DESTDIR)/etc/systemd/system/kimchid.service; then \
+ $(RM) $(DESTDIR)/etc/systemd/system/kimchid.service; \
elif test -f /etc/init.d/kimchid; then \
- $(RM) /etc/init.d/kimchid; \
- fi
-
+ $(RM) $(DESTDIR)/etc/init.d/kimchid; \
+ $(RM) $(DESTDIR)/etc/init/kimchi.conf; \
+ fi; \
+ if test -d /usr/lib/firewalld/services/; then \
+ $(RM) $(DESTDIR)/usr/lib/firewalld/services/kimchid.xml; \
+ fi; \
+ $(RM) -rf $(DESTDIR)/var/lib/kimchi
+ $(RM) -rf $(DESTDIR)/var/log/kimchi
+ $(RM) -rf $(DESTDIR)/etc/kimchi
+ $(RM) $(DESTDIR)/etc/nginx/conf.d/kimchi.conf
+
VERSION:
@if test -d .git; then \
git describe --abbrev=0 > $@; \
diff --git a/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in
index 30f8417..4e12327 100644
--- a/contrib/kimchi.spec.fedora.in
+++ b/contrib/kimchi.spec.fedora.in
@@ -98,9 +98,6 @@ touch %{buildroot}/%{_localstatedir}/log/kimchi/kimchi-error.log
mkdir -p %{buildroot}/%{_sysconfdir}/kimchi/
touch %{buildroot}/%{_sysconfdir}/nginx/conf.d/kimchi.conf
-# Install the systemd scripts
-install -Dm 0644 contrib/kimchid.service.fedora %{buildroot}%{_unitdir}/kimchid.service
-install -Dm 0640 src/firewalld.xml %{buildroot}%{_prefix}/lib/firewalld/services/kimchid.xml
%endif
%if 0%{?rhel} == 6
--
2.1.0
9 years, 6 months
[PATCH 0/3 V3] Storage volume upload UI
by Aline Manera
V2 - V3:
- Adjust error handlers to work with Chrome
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 | 96 +++++++++++++++++++++----
ui/pages/i18n.json.tmpl | 2 +
ui/pages/storagepool-add-volume.html.tmpl | 4 +-
8 files changed, 126 insertions(+), 28 deletions(-)
--
2.1.0
9 years, 7 months
[RFC PATCH] List IPs of VM Ifaces
by Christy Perez
Signed-off-by: Christy Perez <christy(a)linux.vnet.ibm.com>
---
src/kimchi/model/vmifaces.py | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/src/kimchi/model/vmifaces.py b/src/kimchi/model/vmifaces.py
index 8bf6b3d..0b1ffe3 100644
--- a/src/kimchi/model/vmifaces.py
+++ b/src/kimchi/model/vmifaces.py
@@ -25,6 +25,7 @@ from lxml import etree, objectify
from kimchi.exception import InvalidParameter, MissingParameter, NotFoundError
from kimchi.model.config import CapabilitiesModel
from kimchi.model.vms import DOM_STATE_MAP, VMModel
+from kimchi.utils import run_command
from kimchi.xmlutils.interface import get_iface_xml
@@ -122,9 +123,37 @@ 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.
+ (stdout, stderr, returncode) = run_command(['arp', '-n'])
+ if returncode == 0:
+ ips = [line.split()[0] for line in stdout.splitlines() 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.
+ try:
+ net = conn.networkLookupByName(network)
+ leases = net.DHCPLeases(mac)
+ for lease in leases:
+ ip = lease.get('ipaddr')
+ if ip not in ips:
+ ips.append(ip)
+ except libvirt.libvirtError:
+ pass
+
+ # @TODO: One other option is introspection. It is not, however,
+ # guaranteed that any host OS would have the same files & commands
+ # for storing and retreiving IPs. So, this may be as good as we can do.
+
+ return ips
+
def delete(self, vm, mac):
dom = VMModel.get_vm(vm, self.conn)
iface = self._get_vmiface(vm, mac)
--
2.1.0
9 years, 7 months
[PATCH V3 0/3] Edit guest MAC address
by Jose Ricardo Ziviani
V3:
- Updated API.json to filter mac address.
- Improved UI code.
V2:
- Updated API.json to reflect only mac address as required parameter.
- Removed input text filters.
- Updated error message.
This patchset implements a new feature in Kimchi, it allows users to view and/or edit a guest MAC address.
I have a fork of kimchi in my github, so if you prefer to use their diff tool (syntax highlight) you can check this link out:
https://github.com/kimchi-project/kimchi/compare/master...jrziviani:guest...
Jose Ricardo Ziviani (3):
Implement backend code to edit MAC address of a guest
Implement frontend code to edit MAC address of a guest
Update test cases to reflect MAC address update changes
src/kimchi/API.json | 22 ++++++++---------
src/kimchi/i18n.py | 4 +++-
src/kimchi/model/vmifaces.py | 47 +++++++++++++++++++++++--------------
tests/test_model.py | 17 +++++++++++---
tests/test_rest.py | 12 ++++++----
ui/js/src/kimchi.guest_edit_main.js | 44 +++++++++++++++++++++++-----------
ui/pages/guest-edit.html.tmpl | 6 +++--
7 files changed, 99 insertions(+), 53 deletions(-)
--
1.9.1
9 years, 7 months