[PATCH ] Fix a typo.
by Leonardo Garcia
From: Leonardo Garcia <lagarcia(a)br.ibm.com>
Signed-off-by: Leonardo Garcia <lagarcia(a)br.ibm.com>
---
src/kimchi/model/debugreports.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kimchi/model/debugreports.py b/src/kimchi/model/debugreports.py
index 6ae282a..7254b1b 100644
--- a/src/kimchi/model/debugreports.py
+++ b/src/kimchi/model/debugreports.py
@@ -117,7 +117,7 @@ class DebugReportsModel(object):
except Exception, e:
# No need to call cb to update the task status here.
- # The task object will catch the exception rasied here
+ # The task object will catch the exception raised here
# and update the task status there
log = logging.getLogger('Model')
log.warning('Exception in generating debug file: %s', e)
--
1.8.5.3
10 years, 9 months
[PATCH] bug fix: fix the string format.
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
a "s" should be subfix in string format.
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
src/kimchi/i18n.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 398d49a..de70522 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -68,7 +68,7 @@ messages = {
"KCHVM0006E": _("Screenshot not supported for virtual machine %(name)s"),
"KCHVM0007E": _("Unable to create virtual machine %(name)s. Details: %(err)s"),
"KCHVM0008E": _("Unable to rename virtual machine %(name)s. Details: %(err)s"),
- "KCHVM0009E": _("Unable to retrieve virtual machine %(name)s. Details: %(err)"),
+ "KCHVM0009E": _("Unable to retrieve virtual machine %(name)s. Details: %(err)s"),
"KCHVM0010E": _("Unable to connect to powered off machine %(name)s."),
"KCHVM0011E": _("Virtual machine name must be a string"),
"KCHVM0012E": _("Invalid template URI: %(value)s specified for virtual machine"),
@@ -173,7 +173,7 @@ messages = {
"KCHNET0007E": _("Interface should be bare NIC, bonding or bridge device."),
"KCHNET0008E": _("Unable to create network %(name)s. Details: %(err)s"),
"KCHNET0009E": _("Unable to find a free IP address for network '%(name)s'"),
- "KCHNET0010E": _("Unable to create VLAN tagged bridge using interface %(iface)s. Details: %(err)"),
+ "KCHNET0010E": _("Unable to create VLAN tagged bridge using interface %(iface)s. Details: %(err)s"),
"KCHNET0011E": _("Network name must be a string"),
"KCHNET0012E": _("Supported network types are isolated, NAT and bridge"),
"KCHNET0013E": _("Network subnet must be a string with IP address and prefix or netmask"),
--
1.8.5.3
10 years, 9 months
[PATCH] error message fix.
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
This error message is not obscure.
Fix it.
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/kimchi/i18n.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index de70522..d9d2ee7 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -29,7 +29,7 @@ messages = {
"KCHAPI0004E": _("Parameters %(params)s are not allowed to be updated in %(resource)s"),
"KCHAPI0005E": _("Create is not allowed for %(resource)s"),
"KCHAPI0006E": _("Unable to parse JSON request"),
- "KCHAPI0007E": _("This API only supports"),
+ "KCHAPI0007E": _("This API only supports JSON"),
"KCHASYNC0001E": _("Datastore is not initiated in the model object."),
--
1.8.5.3
10 years, 9 months
[PATCH] Properly display YUM exception
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
When YUM raises an error it does not set the message exception so while
using e.message we get an empty string.
Fix it by using str(e)
Also releases Kimchi lock before raises the exception.
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
---
src/kimchi/repositories.py | 2 +-
src/kimchi/swupdate.py | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/repositories.py b/src/kimchi/repositories.py
index 1c74f04..3407263 100644
--- a/src/kimchi/repositories.py
+++ b/src/kimchi/repositories.py
@@ -123,7 +123,7 @@ class YumRepo(object):
yb.doUnlock()
except Exception, e:
kimchiLock.release()
- raise OperationFailed(errcode, {'err': e.message})
+ raise OperationFailed(errcode, {'err': str(e)})
return repos
diff --git a/src/kimchi/swupdate.py b/src/kimchi/swupdate.py
index 9489900..ef77e3b 100644
--- a/src/kimchi/swupdate.py
+++ b/src/kimchi/swupdate.py
@@ -155,7 +155,8 @@ class YumUpdate(object):
self._pkgs = yb.doPackageLists('updates')
yb.doUnlock()
except Exception, e:
- raise OperationFailed('KCHPKGUPD0003E', {'err': e.message})
+ kimchiLock.release()
+ raise OperationFailed('KCHPKGUPD0003E', {'err': str(e)})
def getPackagesList(self):
"""
--
1.7.10.4
10 years, 9 months
[PATCH] fix lock for apt package manager
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Tested with:
1.Model test update/add/remove repositories.
2.UI test.
Global lock is acquired for kimchi to update/add/remove
and list package informations.
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
src/kimchi/repositories.py | 50 ++++++++++++++++++++++++++++------------------
1 file changed, 31 insertions(+), 19 deletions(-)
diff --git a/src/kimchi/repositories.py b/src/kimchi/repositories.py
index 1c74f04..98fc3de 100644
--- a/src/kimchi/repositories.py
+++ b/src/kimchi/repositories.py
@@ -310,6 +310,7 @@ class AptRepo(object):
getattr(__import__('apt_pkg'), 'init_config')()
getattr(__import__('apt_pkg'), 'init_system')()
config = getattr(__import__('apt_pkg'), 'config')
+ self.pkg_lock = getattr(__import__('apt_pkg'), 'SystemLock')
module = __import__('aptsources.sourceslist', globals(), locals(),
['SourcesList'], -1)
@@ -322,6 +323,16 @@ class AptRepo(object):
fd.write("# This file is managed by Kimchi and it must not "
"be modified manually\n")
+ def _get_repos(self):
+ try:
+ with self.pkg_lock():
+ repos = self._sourceslist()
+ repos.refresh()
+ except Exception, e:
+ raise OperationFailed('KCHREPOS0025E', {'err': e.message})
+
+ return repos
+
def _get_repo_id(self, repo):
data = urlparse.urlparse(repo.uri)
name = data.hostname or data.path
@@ -329,8 +340,7 @@ class AptRepo(object):
def _get_source_entry(self, repo_id):
kimchiLock.acquire()
- repos = self._sourceslist()
- repos.refresh()
+ repos = self._get_repos()
kimchiLock.release()
for r in repos:
@@ -354,8 +364,7 @@ class AptRepo(object):
_get_repo_id()
"""
kimchiLock.acquire()
- repos = self._sourceslist()
- repos.refresh()
+ repos = self._get_repos()
kimchiLock.release()
res = []
@@ -400,12 +409,15 @@ class AptRepo(object):
dist = config['dist']
comps = config.get('comps', [])
- kimchiLock.acquire()
- repos = self._sourceslist()
- repos.refresh()
- source_entry = repos.add('deb', uri, dist, comps, file=self.filename)
- repos.save()
- kimchiLock.release()
+ with kimchiLock:
+ try:
+ repos = self._get_repos()
+ source_entry = repos.add('deb', uri, dist, comps, file=self.filename)
+ with self.pkg_lock():
+ repos.save()
+ except Exception as e:
+ raise OperationFailed("KCHREPOS0026E", {'err': e.message})
+
return self._get_repo_id(source_entry)
@@ -430,11 +442,11 @@ class AptRepo(object):
kimchiLock.acquire()
try:
- repos = self._sourceslist()
- repos.refresh()
- repos.remove(r)
- repos.add(line, r.uri, r.dist, r.comps, file=self.filename)
- repos.save()
+ repos = self._get_repos()
+ with self.pkg_lock():
+ repos.remove(r)
+ repos.add(line, r.uri, r.dist, r.comps, file=self.filename)
+ repos.save()
except:
if enable:
raise OperationFailed("KCHREPOS0020E", {'repo_id': repo_id})
@@ -476,10 +488,10 @@ class AptRepo(object):
kimchiLock.acquire()
try:
- repos = self._sourceslist()
- repos.refresh()
- repos.remove(r)
- repos.save()
+ repos = self._get_repos()
+ with self.pkg_lock():
+ repos.remove(r)
+ repos.save()
except:
raise OperationFailed("KCHREPOS0017E", {'repo_id': repo_id})
finally:
--
1.8.3.2
10 years, 9 months
[PATCH 0/2] Fixes for apt swupdate
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Tested:
Ubuntu 13.10
Royce Lv (2):
Fix swupdate listing
Add lock in swupdate
src/kimchi/swupdate.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--
1.8.3.2
10 years, 9 months
[PATCH] Sort device paths shown when creating a logical storage pool
by Rodrigo Trujillo
This path sorts the output list of devices by their paths, improving the
user experience.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.storagepool_add_main.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js
index 10833be..97a30d1 100644
--- a/ui/js/src/kimchi.storagepool_add_main.js
+++ b/ui/js/src/kimchi.storagepool_add_main.js
@@ -26,6 +26,7 @@ kimchi.initStorageAddPage = function() {
kimchi.listHostPartitions(function(data) {
if (data.length > 0) {
var deviceHtml = $('#partitionTmpl').html();
+ data.sort(function (a, b){return a.path.localeCompare(b.path)});
var listHtml = '';
$.each(data, function(index, value) {
if (value.type === 'part' || value.type === 'disk') {
--
1.8.5.3
10 years, 9 months
[PATCH 0/3] create a VM from an iscsi pool template
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
This patch just support create vm on iscsi lun.
Now we have support iSCSI or SCSI pool.
Here we want to create volumes for VM in those pools.
The best way to do it is on template level - and not on vm level
For if we create a template just assign a iSCSI or SCSI pool,
the user still need to choose a volume for his VM.
Also as we discussion, we do not mix disks from 2 different types of
storage pools, for instance: we do not create a template with 2
disks, where one comes from a ISCSI pool and other is a .img in
a DIR pool.
ShaoHe Feng (3):
add a method to get iscsi storage pool auth information.
generate a iscsi volume disk for a guest
create a VM from an iscsi pool template.
src/kimchi/model/templates.py | 11 +++++++++++
src/kimchi/model/vms.py | 4 +++-
src/kimchi/vmtemplate.py | 37 ++++++++++++++++++++++++++++++++++++-
3 files changed, 50 insertions(+), 2 deletions(-)
--
1.8.5.3
10 years, 9 months
[PATCH V2 0/3] create a VM from an iscsi pool template
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
V1 -> V2:
address aline's comment.
storage_type = self._get_storage_type()
if storage_type == 'iscsi':
....
elif storage_type == 'scsi':
This patch just support create vm on iscsi lun.
Now we have support iSCSI or SCSI pool.
Here we want to create volumes for VM in those pools.
The best way to do it is on template level - and not on vm level
For if we create a template just assign a iSCSI or SCSI pool,
the user still need to choose a volume for his VM.
Also as we discussion, we do not mix disks from 2 different types of
storage pools, for instance: we do not create a template with 2
disks, where one comes from a ISCSI pool and other is a .img in
a DIR pool.
ShaoHe Feng (3):
add a method to get iscsi storage pool auth information.
generate a iscsi volume disk for a guest
create a VM from an iscsi pool template.
src/kimchi/model/templates.py | 11 +++++++++++
src/kimchi/model/vms.py | 4 +++-
src/kimchi/vmtemplate.py | 38 +++++++++++++++++++++++++++++++++++++-
3 files changed, 51 insertions(+), 2 deletions(-)
--
1.8.5.3
10 years, 9 months
[PATCH] create a VM from an scsi pool template
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
support to create a VM from a scsi pool template.
>From the libvirt document:
we can create a lun disk for vm by two format:
<disk type='volume' device='disk'>
<driver name='qemu' type='raw'/>
<source pool='scsi-pool' volume='unit:0:0:0' />
<target dev='vda' bus='virtio'/>
</disk>
and
<disk type='block' device='lun'>
<driver name='qemu' type='raw' cache='none'/>
<source dev='/dev/disk'/>
<target dev='sda' bus='scsi'/>
</disk>
The later, VM disk is "block" and the device "lun", except that
generic SCSI commands from the guest are accepted and passed through to
the physical device, and this will only be recognized for actual raw devices.
This is high performance than the former.
But later, disk device='lun' is only valid for block type disk source.
It does not support a volume from a pool formate like:
<source pool='scsi-pool' volume='unit:0:0:0' />
So I assign the disk source is block instead of volume from a pool
in both passthrough or non-passthrough.
1. how to test this patch:
create a scsi pool named "my-scsi" by virsh
2.get the volumes name of this pool:
$ sudo virsh vol-list my-scsi
Name Path
-----------------------------------------
unit:0:0:0 /dev/disk/by-id/wwn-0x60014056aefaef96d4e4033953d9627d
3. create a template with this pool like this:
$ curl -u <user> -H "Content-Type: application/json" \
-H "Accept: application/json" \
http://localhost:8000/templates/ -X POST -d '
{
"cpus": 1,
"cdrom":"/home/shhfeng/iso/f17.iso",
"name":"F17-SCSI",
"storagepool":"/storagepools/my-scsi",
"disks":[
{
"index":0,
"volume":"unit:0:0:0"
}
]
}'
4. create a VM with this template and start it.
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
src/kimchi/model/vms.py | 2 +-
src/kimchi/vmtemplate.py | 11 ++++++++---
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index 483b9ae..ef1d617 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -184,7 +184,7 @@ class VMsModel(object):
# If storagepool is SCSI, volumes will be LUNs and must be passed by
# the user from UI or manually.
vol_list = []
- if t._get_storage_type() == "iscsi":
+ if t._get_storage_type() in ["iscsi", "scsi"]:
vol_list = []
elif t._get_storage_type() in READONLY_POOL_TYPE:
if not params.get('volumes'):
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index 4ecba6e..e753ec2 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -181,7 +181,10 @@ class VMTemplate(object):
graphics_xml = graphics_xml + spicevmc_xml
return graphics_xml
- def _get_scsi_disks_xml(self, luns):
+ def _get_scsi_disks_xml(self):
+ luns = [disk['volume'] for disk in self.info.get('disks', {})
+ if 'volume' in disk]
+
ret = ""
# Passthrough configuration
disk_xml = """
@@ -193,8 +196,10 @@ class VMTemplate(object):
if not self.fc_host_support:
disk_xml = disk_xml.replace('volume','block')
+ pool = self._storage_validate()
# Creating disk xml for each lun passed
- for index,(lun, path) in enumerate(luns):
+ for index, lun in enumerate(luns):
+ path = pool.storageVolLookupByName(lun).path()
dev = "sd%s" % string.lowercase[index]
params = {'src': path, 'dev': dev}
ret = ret + disk_xml % params
@@ -309,7 +314,7 @@ class VMTemplate(object):
if storage_type == "iscsi":
params['disks'] = self._get_iscsi_disks_xml()
elif storage_type == "scsi":
- params['disks'] = self._get_scsi_disks_xml(kwargs.get('volumes'))
+ params['disks'] = self._get_scsi_disks_xml()
else:
params['disks'] = self._get_disks_xml(vm_uuid)
--
1.8.5.3
10 years, 9 months