[PATCH V6 0/3] add a make check-local command to verify the i18n string formatting
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
V5 -> V6:
use ZhengSheng's expression pattern.
V4 -> V5:
improve the regular expression pattern.
remove glob
V3 -> V4:
use python script to check the i18n string formatting
For discuss with ZhengSheng, we should extend the check.
We should check the string are obsolete or they are statement but not define in i18n.py
V2 -> V3:
improve the regular expression pattern.
V1 -> V2:
move the check to top makefile.
check all i18n.py
improve the checking information.
ShaoHe Feng (3):
add a make check-local command to verify the i18n string formatting
remove obsolete i18n strings which are no longer in use
add a method to check the i18n strings are obsolete
Makefile.am | 5 +++
contrib/check_i18n.py | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++
plugins/sample/i18n.py | 1 -
src/kimchi/i18n.py | 4 ---
4 files changed, 87 insertions(+), 5 deletions(-)
create mode 100755 contrib/check_i18n.py
--
1.8.5.3
10 years, 8 months
[PATCH 0/2 V3] Issue #363: Fix
by Rodrigo Trujillo
V3:
This patch set is a merge of previous patches from Rodrigo and Sheldon.
This patch set address comments from Aline:
- encodes pool and volume names;
- saves disk or volume disk size in template data;
- set disk size to default value (10GB) when changing to a new pool, or
uses previous saved disk value;
Rodrigo Trujillo (2):
Issue #363: Add new rest api function - getStoragePoolVolume
Issue #363: Fix data/information consistence in edit template window
ui/js/src/kimchi.api.js | 13 ++++++++++++
ui/js/src/kimchi.template_edit_main.js | 37 ++++++++++++++++++++++++++++++++--
2 files changed, 48 insertions(+), 2 deletions(-)
--
1.9.0
10 years, 8 months
[PATCH V7 0/3] add a make check-local command to verify the i18n string formatting
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
V6 -> V7:
remove "?" for BAD_PATTERN
V5 -> V6:
use ZhengSheng's expression pattern.
V4 -> V5:
improve the regular expression pattern.
remove glob
V3 -> V4:
use python script to check the i18n string formatting
For discuss with ZhengSheng, we should extend the check.
We should check the string are obsolete or they are statement but not define in i18n.py
V2 -> V3:
improve the regular expression pattern.
V1 -> V2:
move the check to top makefile.
check all i18n.py
improve the checking information.
ShaoHe Feng (3):
add a make check-local command to verify the i18n string formatting
remove obsolete i18n strings which are no longer in use
add a method to check the i18n strings are obsolete
Makefile.am | 5 +++
contrib/check_i18n.py | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++
plugins/sample/i18n.py | 1 -
src/kimchi/i18n.py | 4 ---
4 files changed, 87 insertions(+), 5 deletions(-)
create mode 100755 contrib/check_i18n.py
--
1.8.5.3
10 years, 8 months
[PATCH] Choose available address for ide disk
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Tested:
1.make check
2.adding more than 4 cdroms report error
3.less than 4 cdroms successful boot and see all cdroms.
4.When a vm does not have cdrom, adding succeed.
When we only assign source and target type, bus information,
libvirt may generate another controller for ide disk appending,
this will be conflict with libvirt's limitation of 1 ide controller.
This patch choose available bus_id and unit_id for ide disk
to make sure we can reach the limit of 4 ide devices per vm.
Address of 4 ide devices are:
<address type='drive' controller='0' bus='1' target='0' unit='1'/>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
src/kimchi/i18n.py | 1 +
src/kimchi/model/vmstorages.py | 58 ++++++++++++++++++++++++++++++++----------
2 files changed, 45 insertions(+), 14 deletions(-)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 86ab5d6..2443b3e 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -230,6 +230,7 @@ messages = {
"KCHCDROM0011E": _("Do not support guest CDROM hot plug attachment"),
"KCHCDROM0012E": _("Specify type and path to add a new virtual machine disk"),
"KCHCDROM0013E": _("Specify path to update virtual machine disk"),
+ "KCHCDROM0014E": _("Controller type %(type)s limitation of %(limit)s devices reached"),
"KCHREPOS0001E": _("YUM Repository ID must be one word only string."),
"KCHREPOS0002E": _("Repository URL must be an http://, ftp:// or file:// URL."),
diff --git a/src/kimchi/model/vmstorages.py b/src/kimchi/model/vmstorages.py
index 3b5f99e..1cffa84 100644
--- a/src/kimchi/model/vmstorages.py
+++ b/src/kimchi/model/vmstorages.py
@@ -37,6 +37,16 @@ DEV_TYPE_SRC_ATTR_MAP = {'file': 'file',
'block': 'dev'}
+def _get_device_xml(dom, dev_name):
+ # Get VM xml and then devices xml
+ xml = dom.XMLDesc(0)
+ devices = objectify.fromstring(xml).devices
+ disk = devices.xpath("./disk/target[@dev='%s']/.." % dev_name)
+ if not disk:
+ return None
+ return disk[0]
+
+
def _get_storage_xml(params):
src_type = params.get('src_type')
disk = E.disk(type=src_type, device=params.get('type'))
@@ -56,6 +66,12 @@ def _get_storage_xml(params):
disk.append(source)
disk.append(E.target(dev=params.get('dev'), bus=params.get('bus', 'ide')))
+ if params.get('address'):
+ # ide disk target id is always '0'
+ disk.append(E.address(
+ type='drive', controller=params['address']['controller'],
+ bus=params['address']['bus'], target='0',
+ unit=params['address']['unit']))
return ET.tostring(disk)
@@ -89,6 +105,29 @@ class VMStoragesModel(object):
def __init__(self, **kargs):
self.conn = kargs['conn']
+ def _get_available_ide_address(self, vm_name):
+ # libvirt limitation of just 1 ide controller
+ # each controller have at most 2 buses and each bus 2 units.
+ dom = VMModel.get_vm(vm_name, self.conn)
+ disks = self.get_list(vm_name)
+ valid_id = [('0', '0'), ('0', '1'), ('1', '0'), ('1', '1')]
+ controller_id = '0'
+ for dev_name in disks:
+ disk = _get_device_xml(dom, dev_name)
+ if disk.target.attrib['bus'] == 'ide':
+ controller_id = disk.address.attrib['controller']
+ bus_id = disk.address.attrib['bus']
+ unit_id = disk.address.attrib['unit']
+ if (bus_id, unit_id) in valid_id:
+ valid_id.remove((bus_id, unit_id))
+ continue
+ if not valid_id:
+ raise OperationFailed('KCHCDROM0014E', {'type': 'ide', 'limit': 4})
+ else:
+ address = {'controller': controller_id,
+ 'bus': valid_id[0][0], 'unit': valid_id[0][1]}
+ return dict(address=address)
+
def create(self, vm_name, params):
dom = VMModel.get_vm(vm_name, self.conn)
if DOM_STATE_MAP[dom.info()[0]] != 'shutoff':
@@ -109,8 +148,7 @@ class VMStoragesModel(object):
path = params['path']
params['src_type'] = _check_cdrom_path(path)
- # Check if path is an url
-
+ params.update(self._get_available_ide_address(vm_name))
# Add device to VM
dev_xml = _get_storage_xml(params)
try:
@@ -147,19 +185,10 @@ class VMStorageModel(object):
def __init__(self, **kargs):
self.conn = kargs['conn']
- def _get_device_xml(self, vm_name, dev_name):
- # Get VM xml and then devices xml
- dom = VMModel.get_vm(vm_name, self.conn)
- xml = dom.XMLDesc(0)
- devices = objectify.fromstring(xml).devices
- disk = devices.xpath("./disk/target[@dev='%s']/.." % dev_name)
- if not disk:
- return None
- return disk[0]
-
def lookup(self, vm_name, dev_name):
# Retrieve disk xml and format return dict
- disk = self._get_device_xml(vm_name, dev_name)
+ dom = VMModel.get_vm(vm_name, self.conn)
+ disk = _get_device_xml(dom, dev_name)
if disk is None:
raise NotFoundError("KCHCDROM0007E", {'dev_name': dev_name,
'vm_name': vm_name})
@@ -188,7 +217,8 @@ class VMStorageModel(object):
def delete(self, vm_name, dev_name):
# Get storage device xml
- disk = self._get_device_xml(vm_name, dev_name)
+ dom = VMModel.get_vm(vm_name, self.conn)
+ disk = _get_device_xml(dom, dev_name)
if disk is None:
raise NotFoundError("KCHCDROM0007E",
{'dev_name': dev_name,
--
1.8.3.2
10 years, 8 months
[PATCH 0/4] implement reset API
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Reset VM emulates the power reset button on a machine.
There is a risk of data loss caused by reset without the guest OS shutdown.
Also add a reset confirmation in UI.
ShaoHe Feng (4):
reset VM: update API.md
reset VM in backend.
reset vm in UI
add confirmation for reset a VM
docs/API.md | 3 +++
src/kimchi/control/vms.py | 1 +
src/kimchi/i18n.py | 1 +
src/kimchi/mockmodel.py | 3 +++
src/kimchi/model/vms.py | 8 ++++++++
ui/js/src/kimchi.api.js | 13 ++-----------
ui/js/src/kimchi.guest_main.js | 21 +++++++++++++++------
ui/pages/i18n.html.tmpl | 3 +++
8 files changed, 36 insertions(+), 17 deletions(-)
--
1.8.5.3
10 years, 8 months
[RESEND][PATCH 0/4] implement reset API
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Rebase.
Reset VM emulates the power reset button on a machine.
There is a risk of data loss caused by reset without the guest OS shutdown.
Also add a reset confirmation in UI.
ShaoHe Feng (4):
reset VM: update API.md
reset VM in backend.
reset vm in UI
add confirmation for reset a VM
docs/API.md | 3 +++
src/kimchi/control/vms.py | 1 +
src/kimchi/i18n.py | 1 +
src/kimchi/mockmodel.py | 3 +++
src/kimchi/model/vms.py | 8 ++++++++
ui/js/src/kimchi.api.js | 13 ++-----------
ui/js/src/kimchi.guest_main.js | 21 +++++++++++++++------
ui/pages/i18n.html.tmpl | 3 +++
8 files changed, 36 insertions(+), 17 deletions(-)
--
1.8.5.3
10 years, 8 months
[PATCH] Bug fix #357 - Error when creating template from ISO
by Ramon Medeiros
Support psutil > 2.0 changes in kvmusertests. The main change is that a
variable becomes a method. So, a check was added, to use the method on
psutil 2.0 version and high.
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
src/kimchi/kvmusertests.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/kvmusertests.py b/src/kimchi/kvmusertests.py
index 1914a94..b378a04 100644
--- a/src/kimchi/kvmusertests.py
+++ b/src/kimchi/kvmusertests.py
@@ -55,7 +55,15 @@ class UserTests(object):
with open('/var/run/libvirt/qemu/%s.pid' % self.vm_name) as f:
pidStr = f.read()
p = psutil.Process(int(pidStr))
- user = p.username
+
+ # bug fix #357
+ # in psutil 2.0 and above versions, username will be a method,
+ # not a string
+ if callable(p.username):
+ user = p.username()
+ else:
+ user = p.username
+
return user
--
1.8.3.1
10 years, 8 months
[PATCH] Fix backend error when creating multiple templates
by Rodrigo Trujillo
Backend fails when user tries to create multiple templetes using local
isos. The error occurs when Kimchi verifies if qemu has access to the
local iso. Kimchi creates a tmp VM for each iso, but, they have same
name and uuid, what causes the error.
This patch changes the uuid for each VM, fixing the problem.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/kvmusertests.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kimchi/kvmusertests.py b/src/kimchi/kvmusertests.py
index 1914a94..fac61de 100644
--- a/src/kimchi/kvmusertests.py
+++ b/src/kimchi/kvmusertests.py
@@ -39,7 +39,7 @@ class UserTests(object):
</domain>"""
def __init__(self):
- self.vm_uuid = uuid.uuid3(uuid.NAMESPACE_DNS, 'vm-test.kimchi.org')
+ self.vm_uuid = uuid.uuid1()
self.vm_name = "kimchi_test_%s" % self.vm_uuid
def probe_user(self):
--
1.9.0
10 years, 8 months
[PATCH] Fix typo while processing request data
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
While trying to create multiple templates we got an error:
ReferenceError: result is not defined
result[key]=tmpArray;
Fix it.
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
---
ui/js/src/kimchi.object.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/js/src/kimchi.object.js b/ui/js/src/kimchi.object.js
index 3f2ccb9..57ec8d7 100644
--- a/ui/js/src/kimchi.object.js
+++ b/ui/js/src/kimchi.object.js
@@ -62,7 +62,7 @@ Object.defineProperty(Object.prototype, "setDeepValue", {
var tmpArray=[]
tmpArray.push(this[key]);
tmpArray.push(val);
- result[key]=tmpArray;
+ this[key]=tmpArray;
}
}
else {
--
1.7.10.4
10 years, 8 months