[PATCH] Fix a ZeroDivisionError when starting kimchi service in Qemu.
by Jose Ricardo Ziviani
When using kimchi inside a virtual machine it's possible to get a
ZeroDivisionError exception because self.sockets is 0, so the
division self.cores_per_socket = self.cores_present/self.sockets will
fail. In this case, self.sockets is 0 because cores_present = 1 and
threads_per_core = 4, which will truncate 0.25 to 0 during the
integer division.
This is a low priority corner case since kimchi is obviously not
supposed to run under a virtual machine but for a plugin development,
which will not use any virtualization capability, it might become
handy.
Signed-off-by: Jose Ricardo Ziviani <joserz(a)linux.vnet.ibm.com>
---
src/kimchi/model/cpuinfo.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/kimchi/model/cpuinfo.py b/src/kimchi/model/cpuinfo.py
index 3411ef5..d063425 100644
--- a/src/kimchi/model/cpuinfo.py
+++ b/src/kimchi/model/cpuinfo.py
@@ -84,6 +84,8 @@ class CPUInfoModel(object):
if not rc:
self.threads_per_core = int(out.split()[-1])
self.sockets = self.cores_present/self.threads_per_core
+ if self.sockets == 0:
+ self.sockets = 1
self.cores_per_socket = self.cores_present/self.sockets
else:
# Intel or AMD
--
1.9.1
9 years, 8 months
Kimchi 1.4.1 is released!
by Aline Manera
On behalf of everyone who has worked hard on this release, I am pleased
to announce the availability of *Kimchi 1.4.1*!
This release adds many new features including:
✔ Bug fixes
✔ Add robot.txt file
✔ Disable SSLv3
✔ Recognize Arch Linux ISO image
✔ Basic ppc65el support
✔ Add man page for kimchid command
We have worked hard to ensure that Kimchi runs well on the most popular
Linux distributions including: Fedora 21, Ubuntu 14.10, openSUSE 13.2,
and RHEL 7.1. Kimchi uses standard Linux interfaces so it should run well
on many other distributions too.
You can easily grab this release in tarball format or via git:
✔https://github.com/kimchi-project/kimchi/archive/1.4.1.tar.gz <https://github.com/kimchi-project/kimchi/archive/1.4.0.tar.gz>
✔ git clonehttps://github.com/kimchi-project/kimchi.git
There are also some packages available at:
✔http://kimchi-project.github.io/kimchi/downloads/
Go ahead! Give it a try and let us know what you think!
Regards,
Aline Manera
9 years, 9 months
[kimchi-devel][PATCHv2] Fix update vcpu count: Check available vcpu count before update
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Currently we just check vcpu count does not exceed host available
count when topology specified.
Actually vcpu count also need to be checked when only vcpu specified.
Move this check outside topology check and add it to param update.
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
src/kimchi/model/cpuinfo.py | 8 ++++++--
src/kimchi/model/templates.py | 6 +++---
tests/test_model.py | 2 +-
tests/test_rest.py | 1 -
4 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/kimchi/model/cpuinfo.py b/src/kimchi/model/cpuinfo.py
index 3411ef5..54bfad4 100644
--- a/src/kimchi/model/cpuinfo.py
+++ b/src/kimchi/model/cpuinfo.py
@@ -114,11 +114,15 @@ class CPUInfoModel(object):
cores = topology['cores']
threads = topology['threads']
+ self.check_vcpus(vcpus)
+
if not self.guest_threads_enabled:
raise InvalidOperation("KCHCPUINF0003E")
if vcpus != sockets * cores * threads:
raise InvalidParameter("KCHCPUINF0002E")
- if vcpus > self.cores_available * self.threads_per_core:
- raise InvalidParameter("KCHCPUINF0001E")
if threads > self.threads_per_core:
raise InvalidParameter("KCHCPUINF0002E")
+
+ def check_vcpus(self, vcpus):
+ if vcpus > self.cores_available * self.threads_per_core:
+ raise InvalidParameter("KCHCPUINF0001E")
diff --git a/src/kimchi/model/templates.py b/src/kimchi/model/templates.py
index 6bc8aca..14e5b37 100644
--- a/src/kimchi/model/templates.py
+++ b/src/kimchi/model/templates.py
@@ -53,7 +53,7 @@ class TemplatesModel(object):
{'filename': iso, 'user': user,
'err': excp})
- cpu_info = params.get('cpu_info')
+ cpu_info = params.setdefault('cpu_info', dict())
if cpu_info:
topology = cpu_info.get('topology')
# Check, even though currently only topology
@@ -68,8 +68,8 @@ class TemplatesModel(object):
# exception if a topology is invalid.
CPUInfoModel(conn=self.conn).\
check_topology(params['cpus'], topology)
- else:
- params['cpu_info'] = dict()
+ if params.get('cpus'):
+ CPUInfoModel(conn=self.conn).check_vcpus(params['cpus'])
conn = self.conn.get()
pool_uri = params.get(u'storagepool', '')
diff --git a/tests/test_model.py b/tests/test_model.py
index 0020022..138a7da 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -577,7 +577,7 @@ class ModelTests(unittest.TestCase):
inst = model.Model(None,
objstore_loc=self.tmp_store)
- orig_params = {'name': 'test', 'memory': '1024', 'cpus': '1',
+ orig_params = {'name': 'test', 'memory': '1024', 'cpus': 1,
'cdrom': UBUNTU_ISO}
inst.templates_create(orig_params)
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 07e5733..4ecf3ce 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -932,7 +932,6 @@ class RestTests(unittest.TestCase):
task_info = model.storagevolumes_create('pool-3', params)
wait_task(self._task_lookup, task_info['id'])
-
storagevolume = json.loads(self.request(
'/storagepools/kimchi_isos/storagevolumes/').read())[0]
self.assertEquals('fedora.iso', storagevolume['name'])
--
1.9.1
9 years, 9 months
[PATCH] Fix PowerOptions availability
by Jose Ricardo Ziviani
- When we run tuned-adm without parameters it returns code 2, which
will fail our check condition and Power Options would never be
displayed. This commit add a parameter that simply list the profiles,
this will return 0.
---
models/powermanagement.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/models/powermanagement.py b/models/powermanagement.py
index 0bb3dcc..7600024 100644
--- a/models/powermanagement.py
+++ b/models/powermanagement.py
@@ -62,7 +62,7 @@ class PowerProfilesModel(object):
return profiles
def is_feature_available(self):
- output, error, returncode = run_command(['tuned-adm'])
+ output, error, returncode = run_command(['tuned-adm', 'list'])
return returncode == 0
--
1.9.1
9 years, 9 months
[PATCH v] Making urls relative
by Frédéric Bonnard
From: Frederic Bonnard <frediz(a)linux.vnet.ibm.com>
On Wed, 11 Mar 2015 12:39:48 -0300, Aline Manera <alinefm(a)linux.vnet.ibm.com> wrote
> My point is: if the main idea behind it is to allow user to connects
> > Kimchi to the external web server, why do not add an option to do it for
> > > the user?
> 2) Add an option to Kimchi config file to allow user connects to an
> > external web server.
I'm a bit confused : do you mean, why don't we add an option so that kimchi starts nginx ?
If this is your question, in a distro we would have kimchi package have a dependency
on [nginx | apache]. So when you would install kimchi, it would install a web server as well
and distros usually starts all services once installed, so, nginx would be already started.
That is why, we would need an option, not to start the web server instead.
I'm not sure I got you point :) sorry.
In the same topic, that's why I'm using the patch in thread "RFC patch to make nginx proxy optional" [1]
> And yes - we launch nginx (if we should or not do that it is other
> > discussion) and we will continue doing that until something changes what
> > > is not in our plans by now.
I'm not willing to change that default :) . It'll just be nice to have an option to change
that behaviour in other environments [1]. Default would be as it already is, but we could
specify with that option to disable launching an external webserver or specify another one like apache.
as Royce suggested [2] ?
Here follows the patch without the configuration file I put the previous time.
F.
1: http://lists.ovirt.org/pipermail/kimchi-devel/2015-February/009642.html
2: http://lists.ovirt.org/pipermail/kimchi-devel/2015-February/009655.html
Frederic Bonnard (1):
Making urls relative
src/kimchi/screenshot.py | 2 +-
ui/css/theme-default/template_add.css | 20 ++--
ui/css/theme-default/topbar.css | 2 +-
ui/js/src/kimchi.api.js | 176 +++++++++++++++++-----------------
ui/js/src/kimchi.login.js | 2 +-
ui/pages/guest.html.tmpl | 2 +-
ui/pages/help/dita-help.xsl | 4 +-
ui/pages/kimchi-ui.html.tmpl | 4 +-
ui/pages/storagepool-add.html.tmpl | 2 +-
ui/pages/tabs/storage.html.tmpl | 2 +-
ui/pages/template-add.html.tmpl | 2 +-
11 files changed, 109 insertions(+), 109 deletions(-)
--
1.9.1
9 years, 9 months
[PATCH] Update host number of cpus and total physical memory information
by Jose Ricardo Ziviani
- The number of cpus and the total physical memory information
displayed in the host section can change, so them cannot be
static. This commit updates those values whenever a GET request
hits the backend looking for host information.
Signed-off-by: Jose Ricardo Ziviani <joserz(a)linux.vnet.ibm.com>
---
src/kimchi/model/host.py | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/model/host.py b/src/kimchi/model/host.py
index 4419bb3..db14a28 100644
--- a/src/kimchi/model/host.py
+++ b/src/kimchi/model/host.py
@@ -87,8 +87,9 @@ class HostModel(object):
res['cpu_model'] = line.split(':')[1].strip()
break
- res['cpus'] = psutil.NUM_CPUS
- res['memory'] = psutil.TOTAL_PHYMEM
+ res['cpus'] = 0
+ res['memory'] = 0L
+ self._update_host_info(res)
# Include IBM PowerKVM name to supported distro names
_sup_distros = platform._supported_dists + ('ibm_powerkvm',)
@@ -101,7 +102,15 @@ class HostModel(object):
return res
+ def _update_host_info(self, host_info):
+ if not isinstance(host_info, dict):
+ return
+
+ host_info['cpus'] = psutil._psplatform.get_num_cpus()
+ host_info['memory'] = psutil.phymem_usage().total
+
def lookup(self, *name):
+ self._update_host_info(self.host_info)
return self.host_info
def swupdate(self, *name):
--
1.9.1
9 years, 9 months
[PATCH 0/3 v2] unit tests - Power arch fixes
by Daniel Henrique Barboza
v2:
- make the import change in test_osinfo.py
- changed self.kimchi_iso path in test_model.py
This patch set contains fixes to several unit tests that had
somewhat the same root cause - the differences between x86
and power/ppc64le in osinfo.py template configurations.
Daniel Henrique Barboza (3):
tests/test_osinfo.py: fixes for Power architecture
Kimchi tests: Power system fixes - removing hardcoded values
test/test_model: Power architecture fixes
src/kimchi/osinfo.py | 9 +++++++++
tests/iso_gen.py | 3 ++-
tests/test_mockmodel.py | 4 +++-
tests/test_model.py | 12 +++++++-----
tests/test_osinfo.py | 36 ++++++++++++++++++++++++++----------
tests/test_rest.py | 6 ++++--
tests/test_vmtemplate.py | 8 ++++++--
7 files changed, 57 insertions(+), 21 deletions(-)
--
1.9.3
9 years, 9 months
[PATCH] Specify user when changing VM disks permission
by Crístian Viana
Before starting a virtual machine, Kimchi updates the VM disks
permissions so libvirt can read them appropriately. However, the correct
user isn't being passed as a parameter, and the function never actually
changes the file's ACL to something useful.
Set the correct user when changing disk files' permissions.
Signed-off-by: Crístian Viana <vianac(a)linux.vnet.ibm.com>
---
src/kimchi/model/vms.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index 4c5f443..86c173f 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -33,6 +33,7 @@ from kimchi import model, vnc
from kimchi.config import READONLY_POOL_TYPE, config
from kimchi.exception import InvalidOperation, InvalidParameter
from kimchi.exception import NotFoundError, OperationFailed
+from kimchi.kvmusertests import UserTests
from kimchi.model.config import CapabilitiesModel
from kimchi.model.tasks import TaskModel
from kimchi.model.templates import TemplateModel
@@ -946,8 +947,10 @@ class VMModel(object):
xml = dom.XMLDesc(0)
xpath = "/domain/devices/disk[@device='cdrom']/source/@file"
isofiles = xpath_get_text(xml, xpath)
+
+ user = UserTests.probe_user()
for iso in isofiles:
- run_setfacl_set_attr(iso)
+ run_setfacl_set_attr(iso, user=user)
dom = self.get_vm(name, self.conn)
try:
--
2.1.0
9 years, 9 months
[PATCH] issue #518: Simplify template URL verification
by Crístian Viana
When using Kimchi via the UI, the browser checks whether the template
URL is valid using a regular expression. However, that regexp doesn't
match every valid URL out there and it causes problems on some browsers
(e.g. the latest Firefox ESR).
Use a simpler URL validation when creating new templates (i.e. only
validate the possible web protocols). Even if a non-existing/invalid
URL passes this validation, it will still be checked in the backend.
Fix issue #518 (Unable to download ISO to storage pool on Firefox 31.3.0
ESR).
Signed-off-by: Crístian Viana <vianac(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.template_add_main.js | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/ui/js/src/kimchi.template_add_main.js b/ui/js/src/kimchi.template_add_main.js
index 6223c96..46c4f84 100644
--- a/ui/js/src/kimchi.template_add_main.js
+++ b/ui/js/src/kimchi.template_add_main.js
@@ -425,19 +425,9 @@ kimchi.template_add_main = function() {
};
kimchi.template_check_url = function(url) {
- var protocols = "((https|http|ftp|ftps|tftp)?://)?",
- userinfo = "(([0-9a-z_!~*'().&=+$%-]+:)?[0-9a-z_!~*'().&=+$%-]+@)?",
- ip = "(\\d{1,3}\.){3}\\d{1,3}",
- domain = "([0-9a-z_!~*'()-]+\.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\.[a-z]{2,6}",
- port = "(:\\d{1,5})?",
- address = "(/[\\w!~*'().;?:@&=+$,%#-]+)+",
- domaintype = [ protocols, userinfo, domain, port, address ],
- ipType = [ protocols, userinfo, ip, port, address ],
- validate = function(type) {
- return new RegExp('^' + type.join('') + '$');
- };
+ var reg = /(https|http|ftp|ftps|tftp):\/\//;
if (url.constructor === String) {
- return validate(domaintype).test(url) || validate(ipType).test(url);
+ return reg.test(url);
}
return false;
};
--
2.1.0
9 years, 9 months