[PATCH] [UI] Software Update: Make Update Progress Area Collapsible
by Hongliang Wang
Take advantage of jQuery UI to make update progress area collapsible.
Signed-off-by: Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
---
ui/css/theme-default/host.css | 4 +++-
ui/js/src/kimchi.host.js | 3 +++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ui/css/theme-default/host.css b/ui/css/theme-default/host.css
index 0f8b941..e1e83ee 100644
--- a/ui/css/theme-default/host.css
+++ b/ui/css/theme-default/host.css
@@ -248,8 +248,10 @@
.host-panel #software-updates-progress-textarea {
border: 1px solid #ddd;
+ box-sizing: border-box;
height: 100px;
+ padding: .2em .5em;
resize: vertical;
- width: 846px;
+ width: 852px;
}
/* End of Software Updates */
diff --git a/ui/js/src/kimchi.host.js b/ui/js/src/kimchi.host.js
index 6300f37..f9696ea 100644
--- a/ui/js/src/kimchi.host.js
+++ b/ui/js/src/kimchi.host.js
@@ -276,6 +276,9 @@ kimchi.host_main = function() {
initSoftwareUpdatesGrid();
kimchi.topic('kimchi/softwareUpdated')
.subscribe(listSoftwareUpdates);
+ $('#software-updates-progress-container').accordion({
+ collapsible: true
+ });
}
if(capabilities['system_report_tool']) {
--
1.8.1.4
10 years, 8 months
[PATCH] Set virt_use_nfs when NFS pool is added.
by Christy Perez
selinux has a special boolean to make it easier for disk images
to be stored on a remote NFS server. Set this to true when a user
adds an NFS storage pool.
Most virtualzation documentation recommends that this be set
to true. For example:
http://www.ovirt.org/Troubleshooting_NFS_Storage_Issues
http://fedoraproject.org/wiki/How_to_debug_Virtualization_problems
This will leave it set to true, even if
the user removes NFS storage pools. It is not a security risk, and
we should not set it to False in case it had already been set by the
user for another non-kimchi use.
Signed-off-by: Christy Perez <christy(a)linux.vnet.ibm.com>
---
src/kimchi/i18n.py | 2 ++
src/kimchi/model/storagepools.py | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index d45f607..8ade7d7 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -144,6 +144,8 @@ messages = {
"KCHPOOL0034E": _("Unable to deactivate pool %(name)s as it is associated with some templates"),
"KCHPOOL0035E": _("Unable to delete pool %(name)s as it is associated with some templates"),
"KCHPOOL0036E": _("A volume group named '%(name)s' already exists. Please, choose another name to create the logical pool."),
+ "KCHPOOL0037E": _("Unable to set selinux bool virt_use_nfs for NFS pool usage. Depending on \
+ your NFS config, this may prevent the pool from being used."),
"KCHVOL0001E": _("Storage volume %(name)s already exists"),
"KCHVOL0002E": _("Storage volume %(name)s does not exist in storage pool %(pool)s"),
diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py
index 92b2496..d279ffa 100644
--- a/src/kimchi/model/storagepools.py
+++ b/src/kimchi/model/storagepools.py
@@ -126,6 +126,11 @@ class StoragePoolsModel(object):
kimchi_log.error("Problem creating Storage Pool: %s", e)
raise OperationFailed("KCHPOOL0007E",
{'name': name, 'err': e.get_error_message()})
+ if params['type'] == 'netfs':
+ output, error, returncode = run_command(['setsebool', '-P',
+ 'virt_use_nfs=1'])
+ if error or returncode:
+ kimchi_log.error('KCHPOOL0037E')
return name
def _clean_scan(self, pool_name):
--
1.8.5.3
10 years, 8 months
[PATCH 0/3] Create and use jQuery form extensions
by Adam King
Extend base classes to support form processing
Extend jQuery form
Make use of the new forms handling capabilities
Adam King (3):
Extend base classes to support form processing
Extend jQuery form
Make use of the new forms handling capabilities
ui/js/src/kimchi.form.js | 76 +++++++++-------------------
ui/js/src/kimchi.grid.js | 2 +-
ui/js/src/kimchi.object.js | 85 ++++++++++++++++++++++++++++++++
ui/js/src/kimchi.repository_edit_main.js | 31 +-----------
ui/js/src/kimchi.string.js | 45 +++++++++++++++++
5 files changed, 154 insertions(+), 85 deletions(-)
create mode 100644 ui/js/src/kimchi.object.js
create mode 100644 ui/js/src/kimchi.string.js
--
1.8.1.4
10 years, 8 months
[PATCH v2] PEP8 for mockmodel.py
by Adam King
Updated mockmodel.py and makefile.am per Sheldon's comments.
Adam King (1):
PEP8 for mockmodel.py
Makefile.am | 1 +
src/kimchi/mockmodel.py | 69 ++++++++++++++++++++++++++++---------------------
2 files changed, 40 insertions(+), 30 deletions(-)
--
1.8.1.4
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 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 V3 0/5] Fix 'disk full' issue
by Rodrigo Trujillo
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 | 8 +++--
src/kimchi/model/storagevolumes.py | 49 ++++++++++++++++----------
src/kimchi/model/templates.py | 27 +++++++++++----
src/kimchi/model/vms.py | 70 +++++++++++++++++++++++++++-----------
src/kimchi/objectstore.py | 7 ++++
7 files changed, 123 insertions(+), 50 deletions(-)
--
1.8.5.3
10 years, 8 months
[PATCH] Issue#343 & #353: Improve&Correct UI Init Logic Flow
by Hongliang Wang
Fixed the 2 issues:
1) When refreshing (F5) a plugin tab, default tab will be redirected then;
2) tabs.xml is requested twice.
Signed-off-by: Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.main.js | 127 +++++++++++++++++++++++++++--------------------
1 file changed, 72 insertions(+), 55 deletions(-)
diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js
index aac7e28..9b0acbf 100644
--- a/ui/js/src/kimchi.main.js
+++ b/ui/js/src/kimchi.main.js
@@ -16,10 +16,75 @@
* limitations under the License.
*/
kimchi.main = function() {
- var tabUrl = "/config/ui/tabs.xml";
- var DEFAULT_HASH = kimchi.getDefaultPage(tabUrl);
kimchi.popable();
+ var genTabs = function(tabs) {
+ var tabsHtml = [];
+ $(tabs).each(function(i, tab) {
+ var title = tab['title'];
+ var path = tab['path'];
+ tabsHtml.push(
+ '<li>',
+ '<a class="item" href="', path, '">',
+ title,
+ '</a>',
+ '</li>'
+ );
+ });
+ return tabsHtml.join('');
+ };
+
+ var parseTabs = function(xmlData) {
+ var tabs = [];
+ $(xmlData).find('tab').each(function() {
+ var $tab = $(this);
+ var titleKey = $tab.find('title').text();
+ var title = i18n[titleKey];
+ var path = $tab.find('path').text();
+ tabs.push({
+ title: title,
+ path: path
+ });
+ });
+
+ return tabs;
+ };
+
+ var retrieveTabs = function(url) {
+ var tabs;
+ $.ajax({
+ url : url,
+ async : false,
+ success : function(xmlData) {
+ tabs = parseTabs(xmlData);
+ }
+ });
+ return tabs;
+ };
+
+ var tabConfigUrl = '/config/ui/tabs.xml';
+ var pluginConfigUrl = '/plugins/{plugin}/ui/config/tab-ext.xml';
+ var DEFAULT_HASH;
+ var buildTabs = function(callback) {
+ var tabs = retrieveTabs(tabConfigUrl);
+ kimchi.listPlugins(function(plugins) {
+ $(plugins).each(function(i, p) {
+ var url = kimchi.template(pluginConfigUrl, {
+ plugin: p
+ });
+ tabs.concat(retrieveTabs(url));
+ });
+
+ var firstTabPath = tabs[0] && tabs[0]['path'];
+ DEFAULT_HASH = firstTabPath &&
+ firstTabPath.substring(0, firstTabPath.length - 5);
+
+ $('#nav-menu').append(genTabs(tabs));
+
+ callback && callback();
+ });
+ };
+
var onLanguageChanged = function(lang) {
kimchi.lang.set(lang);
location.reload();
@@ -132,8 +197,6 @@ kimchi.main = function() {
});
// Perform logging out via Ajax request.
-
-
$('#btn-logout').on('click', function() {
kimchi.logout(function() {
updatePage();
@@ -145,9 +208,7 @@ kimchi.main = function() {
$('#btn-help').on('click', kimchi.getHelp);
};
- // Load i18n translation strings first and then render the page.
- $('#main').load('i18n.html', function() {
- kimchi.addTabs(tabUrl);
+ var initUI = function() {
$(document).bind('ajaxError', function(event, jqXHR, ajaxSettings, errorThrown) {
if (!ajaxSettings['kimchi']) {
return;
@@ -175,56 +236,12 @@ kimchi.main = function() {
kimchi.user.showUser(true);
initListeners();
updatePage();
- });
-};
-
-kimchi.addTabs = function(url) {
- var tabsHtml = kimchi.getTabHtml(url);
- $('#nav-menu').prepend(tabsHtml);
- kimchi.addExtTabs();
-};
-
-kimchi.addExtTabs = function() {
- kimchi.listPlugins(function(results) {
- for ( var i = 0; i < results.length; i++) {
- var tabsHtml = kimchi.getTabHtml("/plugins/" + results[i] + "/ui/config/tab-ext.xml");
- $('#nav-menu').append(tabsHtml);
- }
- });
-};
-
-kimchi.getDefaultPage = function(url) {
- var defautLocation = "";
- $.ajax({
- url : url,
- async : false,
- success : function(xmlData) {
- var tab = $(xmlData).find('tab').first();
- var path = tab.find('path').text();
- if (path) {
- defautLocation = path.substring(0, path.length - 5);
- }
- }
- });
- return defautLocation;
-};
+ };
-kimchi.getTabHtml = function(url) {
- var tabsHtml = "";
- $.ajax({
- url : url,
- async : false,
- success : function(xmlData) {
- $(xmlData).find('tab').each(function() {
- var $tab = $(this);
- var titleKey = $tab.find('title').text();
- var title = i18n[titleKey];
- var path = $tab.find('path').text();
- tabsHtml += "<li><a class='item' href=" + path + ">" + title + "</a></li>";
- });
- }
+ // Load i18n translation strings first and then render the page.
+ $('#main').load('i18n.html', function() {
+ buildTabs(initUI);
});
- return tabsHtml;
};
kimchi.getHelp = function(e) {
--
1.8.1.4
10 years, 8 months
[PATCH V4 0/3] Fix non persistent network handling
by Rodrigo Trujillo
V4:
Fixes error in tests
V3:
Changes mockmodel and tests (Royce suggestion)
V2:
Address Ming comments:
- Updates API.md
- remove useless comments and return
V1:
Kimchi networks have the same problem storage had. Non persistent
networks are not stop, they are removed by libvirt and this causes
an error in Kimchi.
Rodrigo Trujillo (3):
Fix non persistent network handling (backend)
Fix non persistent network handling (frontend)
Fix non persistent network handling (mockmodel/tests)
docs/API.md | 2 ++
src/kimchi/control/networks.py | 3 ++-
src/kimchi/mockmodel.py | 7 +++++-
src/kimchi/model/networks.py | 3 ++-
tests/test_model.py | 1 +
tests/test_rest.py | 1 +
ui/js/src/kimchi.network.js | 55 ++++++++++++++++++++++++++++--------------
ui/pages/i18n.html.tmpl | 1 +
8 files changed, 52 insertions(+), 21 deletions(-)
--
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 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 | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/control/host.py b/src/kimchi/control/host.py
index cfc24bd..d4387f4 100644
--- a/src/kimchi/control/host.py
+++ b/src/kimchi/control/host.py
@@ -20,7 +20,7 @@
import cherrypy
from kimchi.control.base import Collection, Resource
-from kimchi.control.utils import UrlSubNode, validate_method
+from kimchi.control.utils import UrlSubNode, validate_method, model_fn
from kimchi.exception import OperationFailed
from kimchi.template import render
@@ -64,6 +64,24 @@ 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):
+ try:
+ get_list = getattr(self.model, model_fn(self, 'get_list'))
+ idents = get_list(*self.model_args, **flag_filter)
+ res_list = []
+ for ident in idents:
+ # internal text, get_list changes ident to unicode for sorted
+ args = self.resource_args + [ident]
+ res = self.resource(self.model, *args)
+ res.lookup()
+ res_list.append(res)
+ # Sort by partition path
+ res_list.sort(key=lambda x: x.info['path'])
+ return res_list
+ except AttributeError:
+ return []
class Partition(Resource):
def __init__(self, model, id):
--
1.8.5.3
10 years, 8 months