[PATCH] Fix hardcoded storage bus assignment in vmstorage
by Rodrigo Trujillo
There is an error when a user tries to change the midia path in "Manage
Midia" at Guest tab. If the midia was created with SCSI bus, Kimchi is
going to try replace it by IDE bus, causing the following error:
No device with bus 'ide' and target 'sdc'
Bus IDE was hardcoded. This patch retrieves the original midia bus and
pass the value as parameter in order to create the right XML.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/model/vmstorages.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/model/vmstorages.py b/src/kimchi/model/vmstorages.py
index c1c90ce..ee83155 100644
--- a/src/kimchi/model/vmstorages.py
+++ b/src/kimchi/model/vmstorages.py
@@ -55,7 +55,11 @@ def _get_storage_xml(params):
source.set(DEV_TYPE_SRC_ATTR_MAP[src_type], params.get('path'))
disk.append(source)
- disk.append(E.target(dev=params.get('dev'), bus='ide'))
+ dev_bus = params.get('bus')
+ if dev_bus is None:
+ dev_bus = 'ide'
+
+ disk.append(E.target(dev=params.get('dev'), bus=dev_bus))
return ET.tostring(disk)
@@ -164,6 +168,7 @@ class VMStorageModel(object):
raise NotFoundError("KCHCDROM0007E", {'dev_name': dev_name,
'vm_name': vm_name})
path = ""
+ dev_bus = None
try:
source = disk.source
if source is not None:
@@ -175,12 +180,15 @@ class VMStorageModel(object):
host.attrib['port'] + source.attrib['name'])
else:
path = source.attrib[DEV_TYPE_SRC_ATTR_MAP[src_type]]
+ # Retrieve storage bus type
+ dev_bus = disk.target.attrib['bus']
except:
pass
dev_type = disk.attrib['device']
return {'dev': dev_name,
'type': dev_type,
- 'path': path}
+ 'path': path,
+ 'bus': dev_bus}
def delete(self, vm_name, dev_name):
# Get storage device xml
--
1.8.5.3
10 years, 8 months
[PATCH V2] Sort device paths shown when creating a logical storage pool
by Rodrigo Trujillo
This patch 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 f347747..7a751aa 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, 8 months
[PATCH V5] Sort device paths shown when creating a logical storage pool
by Rodrigo Trujillo
This patch sorts the host partitions list returned by backend by
partition path. Then UI is going to show paths sorted, improving
the user experience.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/control/host.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/kimchi/control/host.py b/src/kimchi/control/host.py
index cfc24bd..a0818c7 100644
--- a/src/kimchi/control/host.py
+++ b/src/kimchi/control/host.py
@@ -64,6 +64,13 @@ class Partitions(Collection):
super(Partitions, self).__init__(model)
self.resource = Partition
+ # Defining get_resources in order to return list of partitions in UI
+ # sorted by their path
+ def _get_resources(self, flag_filter):
+ res_list = super(Partitions, self)._get_resources(flag_filter)
+ res_list.sort(key=lambda x: x.info['path'])
+ return res_list
+
class Partition(Resource):
def __init__(self, model, id):
--
1.8.5.3
10 years, 8 months
[PATCH v2] Add template clone support
by Adam King
Add support for cloning templates to the clone tab.
Signed-off-by: Adam King <rak(a)linux.vnet.ibm.com>
---
ui/css/theme-default/template_list.css | 4 ++++
ui/js/src/kimchi.api.js | 11 +++++++++++
ui/js/src/kimchi.template_main.js | 16 ++++++++++++++--
ui/pages/tabs/templates.html.tmpl | 1 +
4 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/ui/css/theme-default/template_list.css b/ui/css/theme-default/template_list.css
index c0d51e0..df84a8f 100644
--- a/ui/css/theme-default/template_list.css
+++ b/ui/css/theme-default/template_list.css
@@ -253,3 +253,7 @@ template-hidden {
text-overflow: ellipsis;
white-space: nowrap;
}
+
+.processing {
+ cursor: wait;
+}
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 0c5c790..376bc86 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -143,6 +143,17 @@ var kimchi = {
});
},
+ cloneTemplate : function(tem, suc, err) {
+ kimchi.requestJSON({
+ url : kimchi.url + 'templates/' + encodeURIComponent(tem) + "/clone",
+ type : 'POST',
+ contentType : 'application/json',
+ dataType : 'json',
+ success : suc,
+ error : err
+ });
+ },
+
listTemplates : function(suc, err) {
kimchi.requestJSON({
url : kimchi.url + 'templates',
diff --git a/ui/js/src/kimchi.template_main.js b/ui/js/src/kimchi.template_main.js
index 5de6e8c..160ecc8 100644
--- a/ui/js/src/kimchi.template_main.js
+++ b/ui/js/src/kimchi.template_main.js
@@ -25,22 +25,34 @@ kimchi.doListTemplates = function() {
listHtml += kimchi.template(templateHtml, value);
});
$('#templateList').html(listHtml);
- kimchi.bindClick();
+ kimchi.templateBindClick();
} else {
$('#templateList').html('');
$('#noTemplates').show();
}
+ $('html').removeClass('processing');
}, function(err) {
kimchi.message.error(err.responseJSON.reason);
+ $('html').removeClass('processing');
});
};
-kimchi.bindClick = function() {
+kimchi.templateBindClick = function() {
$('.template-edit').on('click', function(event) {
var templateName = $(this).data('template');
kimchi.selectedTemplate = templateName;
kimchi.window.open("template-edit.html");
});
+ $('.template-clone').on('click', function(event) {
+ kimchi.selectedTemplate = $(this).data('template');
+ $('html').addClass('processing');
+ kimchi.cloneTemplate(kimchi.selectedTemplate, function() {
+ kimchi.doListTemplates();
+ }, function(err) {
+ kimchi.message.error(err.responseJSON.reason);
+ kimchi.doListTemplates();
+ });
+ });
$('.template-delete').on('click', function(event) {
var $template = $(this);
var settings = {
diff --git a/ui/pages/tabs/templates.html.tmpl b/ui/pages/tabs/templates.html.tmpl
index b6edbaf..6ae6640 100644
--- a/ui/pages/tabs/templates.html.tmpl
+++ b/ui/pages/tabs/templates.html.tmpl
@@ -43,6 +43,7 @@
<span class="text">$_("Actions")</span><span class="arrow"></span>
<div class="popover actionsheet right-side" style="width: 250px">
<a class="button-big template-edit" data-template='{name}'>$_("Edit")</a>
+ <a class="button-big template-clone" data-template='{name}'>$_("Clone")</a>
<a class="button-big red template-delete" data-template='{name}'>$_("Delete")</a>
</div>
</div>
--
1.8.1.4
10 years, 8 months
[PATCH 1/3] Fix pep8 in src/kimchi/vmtemplate.py
by Rodrigo Trujillo
Fixes minor pep8 issues
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/vmtemplate.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index 26f7d89..d127cec 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import os
import string
@@ -33,6 +33,7 @@ from lxml.builder import E
QEMU_NAMESPACE = "xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'"
+
class VMTemplate(object):
_bus_to_dev = {'ide': 'hd', 'virtio': 'vd', 'scsi': 'sd'}
@@ -152,7 +153,8 @@ class VMTemplate(object):
dev = "%s%s" % (self._bus_to_dev[self.info['disk_bus']],
string.lowercase[index])
fmt = 'raw' if self._get_storage_type() in ['logical'] else 'qcow2'
- params = {'src': src, 'dev': dev, 'bus': self.info['disk_bus'], 'type': fmt}
+ params = {'src': src, 'dev': dev, 'bus': self.info['disk_bus'],
+ 'type': fmt}
ret += """
<disk type='file' device='disk'>
<driver name='qemu' type='%(type)s' cache='none'/>
@@ -193,7 +195,7 @@ class VMTemplate(object):
<target dev='%(dev)s' bus='scsi'/>
</disk>"""
if not self.fc_host_support:
- disk_xml = disk_xml.replace('volume','block')
+ disk_xml = disk_xml.replace('volume', 'block')
pool = self._storage_validate()
# Creating disk xml for each lun passed
@@ -323,7 +325,7 @@ class VMTemplate(object):
qemu_stream_dns)
if not urlparse.urlparse(self.info['cdrom']).scheme in \
- libvirt_stream_protocols and params.get('iso_stream', False):
+ libvirt_stream_protocols and params.get('iso_stream', False):
params['qemu-namespace'] = QEMU_NAMESPACE
params['qemu-stream-cmdline'] = cdrom_xml
else:
--
1.8.5.3
10 years, 8 months
[PATCH V2 0/4] Fix pep8 in multiple files
by Rodrigo Trujillo
V2:
- Add files to PEP8 whitelist
V1:
- Fixes minor issues
Rodrigo Trujillo (4):
Fix pep8 in src/kimchi/vmtemplate.py
Fix pep8 in src/kimchi/template.py
Fix pep8 issues in src/kimchi/objectstore.py
Fix pep8: add files to whitelist of Makefile.am
Makefile.am | 3 +++
src/kimchi/objectstore.py | 6 +++---
src/kimchi/template.py | 13 ++++++++-----
src/kimchi/vmtemplate.py | 16 ++++++++++------
4 files changed, 24 insertions(+), 14 deletions(-)
--
1.8.5.3
10 years, 8 months
[PATCH] Plugins UI: Correctly Load Plugin Tabs
by zhshzhou@linux.vnet.ibm.com
From: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
In ui/js/src/kimchi.main.js we fetch all plugin tabs and concat them to
the tabs array. However array.concat does not work in place, it creates
a new array to store the result, so it does not correctly update the
tabs array. The plugin tabs are not loaded at all.
This patch fixes the problem by using tabs.push.apply(tabs, pluginTabs) .
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js
index 9b0acbf..78206bf 100644
--- a/ui/js/src/kimchi.main.js
+++ b/ui/js/src/kimchi.main.js
@@ -72,7 +72,7 @@ kimchi.main = function() {
var url = kimchi.template(pluginConfigUrl, {
plugin: p
});
- tabs.concat(retrieveTabs(url));
+ tabs.push.apply(tabs, retrieveTabs(url));
});
var firstTabPath = tabs[0] && tabs[0]['path'];
--
1.8.5.3
10 years, 8 months
[PATCH V5 0/5] Fix 'disk full' issue
by Rodrigo Trujillo
V5:
- Fix minor issues with pep8 and commit sha
V4:
- Fix pep8 issues
V3:
- Fix issues with tests
- Rebase with 1.2
V2:
Address Aline's comments:
- Change error message
- Aggregate 'if's
V1:
If the disk where objectstore (Kimchi database) is full, then a lot of
errors will be raised without any special treatment. This can lead the
system to an unexpected state.
This patchset modifies kimchi in order to give the right treatment to
exceptions, showing the error to the user or hidding when possible.
Rodrigo Trujillo (5):
Fix 'disk full' issue: Change objectstore exception handling
Fix 'disk full' issue: Fix Templates db store/delete error handling
Fix 'disk full' issue: Fix storage volume error handling
Fix 'disk full' issue: Fix storagepool and asynctasks error handling
Fix 'disk full' issue: Fix vms/screenshot db store/delete error
handling
src/kimchi/asynctask.py | 7 ++--
src/kimchi/i18n.py | 5 +++
src/kimchi/model/storagepools.py | 7 ++--
src/kimchi/model/storagevolumes.py | 49 +++++++++++++++++----------
src/kimchi/model/templates.py | 27 +++++++++++----
src/kimchi/model/vms.py | 69 +++++++++++++++++++++++++++-----------
src/kimchi/objectstore.py | 7 ++++
7 files changed, 123 insertions(+), 48 deletions(-)
--
1.8.5.3
10 years, 8 months
[BUG]Kimchi fail to start on opensuse13.1
by Royce Lv
Kimchi depends on 2 packages: libvirt-daemon-driver-storage and
python-parted,
conflict with depending on same package: libparted0, of different versions.
Tried two solutions:
1.Breaking the dependency of python-parted will result in
python-parted unavailable, only create a symlink won't fix, the .so is
diappeared in higher version.
2.Downgrade libvirt-daemon-driver-storage and change its to
architect i586, whole libvirt package chain needs to change, which is
not good.
I will try to find an alternative of python-parted, suggestions are welcome.
10 years, 8 months
[PATCH] Add template clone support
by Adam King
Add support for cloning templates to the clone tab.
Signed-off-by: Adam King <rak(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.api.js | 11 +++++++++++
ui/js/src/kimchi.template_main.js | 16 ++++++++++++++--
ui/pages/tabs/templates.html.tmpl | 1 +
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 0c5c790..376bc86 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -143,6 +143,17 @@ var kimchi = {
});
},
+ cloneTemplate : function(tem, suc, err) {
+ kimchi.requestJSON({
+ url : kimchi.url + 'templates/' + encodeURIComponent(tem) + "/clone",
+ type : 'POST',
+ contentType : 'application/json',
+ dataType : 'json',
+ success : suc,
+ error : err
+ });
+ },
+
listTemplates : function(suc, err) {
kimchi.requestJSON({
url : kimchi.url + 'templates',
diff --git a/ui/js/src/kimchi.template_main.js b/ui/js/src/kimchi.template_main.js
index 5de6e8c..9f19a5c 100644
--- a/ui/js/src/kimchi.template_main.js
+++ b/ui/js/src/kimchi.template_main.js
@@ -25,22 +25,34 @@ kimchi.doListTemplates = function() {
listHtml += kimchi.template(templateHtml, value);
});
$('#templateList').html(listHtml);
- kimchi.bindClick();
+ kimchi.templateBindClick();
} else {
$('#templateList').html('');
$('#noTemplates').show();
}
+ $('html').css('cursor', 'auto');
}, function(err) {
kimchi.message.error(err.responseJSON.reason);
+ $('html').css('cursor', 'auto');
});
};
-kimchi.bindClick = function() {
+kimchi.templateBindClick = function() {
$('.template-edit').on('click', function(event) {
var templateName = $(this).data('template');
kimchi.selectedTemplate = templateName;
kimchi.window.open("template-edit.html");
});
+ $('.template-clone').on('click', function(event) {
+ kimchi.selectedTemplate = $(this).data('template');
+ $('html').css('cursor', 'wait');
+ kimchi.cloneTemplate(kimchi.selectedTemplate , function() {
+ kimchi.doListTemplates();
+ }, function(err) {
+ kimchi.message.error(err.responseJSON.reason);
+ kimchi.doListTemplates();
+ });
+ });
$('.template-delete').on('click', function(event) {
var $template = $(this);
var settings = {
diff --git a/ui/pages/tabs/templates.html.tmpl b/ui/pages/tabs/templates.html.tmpl
index b6edbaf..6ae6640 100644
--- a/ui/pages/tabs/templates.html.tmpl
+++ b/ui/pages/tabs/templates.html.tmpl
@@ -43,6 +43,7 @@
<span class="text">$_("Actions")</span><span class="arrow"></span>
<div class="popover actionsheet right-side" style="width: 250px">
<a class="button-big template-edit" data-template='{name}'>$_("Edit")</a>
+ <a class="button-big template-clone" data-template='{name}'>$_("Clone")</a>
<a class="button-big red template-delete" data-template='{name}'>$_("Delete")</a>
</div>
</div>
--
1.8.1.4
10 years, 8 months