[RFC] upgrade CherryPy version.
by Sheldon
Now there's a issue:
https://github.com/kimchi-project/kimchi/issues/333
The reason of this issue is because high level cherrpy version make some
change about set_response.
The high level cherrpy encode the unicode error message by itself.
So the kimchi do not encode the unicode error message any more.
It is right, the cherrpy should encode the unicode error message.
Now we can require the cherrypy version to solve this problem.
we can also check the cherrypy version in kimchi code as follow in order
to avoid to require the cherrypy version.
like:
if cherrypy.__version__ << 3.2.5:
return res
else:
return res.encode("utf-8")
--
Thanks and best regards!
Sheldon Feng(冯少合)<shaohef(a)linux.vnet.ibm.com>
IBM Linux Technology Center
10 years, 9 months
[PATCH 0/2] Make vms model singleton
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
When using get_list function of vms model,
Background Task will run multiple times because of started
in vm init function.
Fix this by making vms model singleton.
Royce Lv (2):
Make vm model to be a singleton
Hack test_model to support vm model singleton
src/kimchi/model/vms.py | 3 +++
tests/test_model.py | 2 ++
2 files changed, 5 insertions(+)
--
1.8.1.2
10 years, 9 months
[PATCH] bug fix: Allow extend a logical pool
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
While trying to extend a logical pool I got the following error message:
"/dev/vdb is not a valid disk/partition. Could not add it to the pool
my-logical-pool"
But the same partition "/dev/vdb" is listed on GET /host/partitions.
Then I realized the "blkid" is not the correct command to check a
partition exists for raw disks.
>From blkid man page:
It can determine the type of content (e.g. filesystem or swap) that a block
device holds, and also attributes (tokens, NAME=value pairs) from the
content metadata (e.g. LABEL or UUID fields).
Which is not useful for a raw disk.
>From lsblk man page:
lsblk lists information about all or the specified block devices.
So use "lsblk" command instead of "blkid" to verify the disk exists in
the system.
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
---
src/kimchi/model/storagepools.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py
index 76ab2d6..d012ca9 100644
--- a/src/kimchi/model/storagepools.py
+++ b/src/kimchi/model/storagepools.py
@@ -254,7 +254,7 @@ class StoragePoolModel(object):
def _update_lvm_disks(self, pool_name, disks):
# check if all the disks/partitions exists in the host
for disk in disks:
- blkid_cmd = ['blkid', disk]
+ blkid_cmd = ['lsblk', disk]
output, error, returncode = run_command(blkid_cmd)
if returncode != 0:
kimchi_log.error('%s is not a valid disk/partition. Could not '
@@ -281,6 +281,7 @@ class StoragePoolModel(object):
pool.setAutostart(1)
else:
pool.setAutostart(0)
+
if 'disks' in params:
# check if pool is type 'logical'
xml = pool.XMLDesc(0)
--
1.7.10.4
10 years, 9 months
[PATCH v2 0/4] [UI] CDROM Management in a VM
by Hongliang Wang
Allow user to manipulate CDROM(s) in a VM:
1) Attach one or more CDROM(s);
2) Replace a CDROM with another ISO file path;
3) Detach a CDROM from a VM.
Tested on Chrome.
Please apply the following patch first:
* [UI] Window - Correct Footer Height
v1 -> v2:
2a) Separate one patch into 4 small ones to make it easier to review
(Thanks to Ramon Medeiros's comment)
2b) Updated API calling to list CDROM
(Thanks to Aline's comment)
2c) Separated VM updating window into 2 parts: general and storage
(Thanks to Aline's comment)
2d) Enhanced UI to allow user trigger replace CDROM window by clicking
ISO file path text box
2e) Changed uneditable fields from readonly to disabled
2f) Removed authors infomation
(Thanks to Aline's comment)
Hongliang Wang (4):
[UI] Add CDROM-related APIs
[UI] Add i18n Variables for CDROM-related Function
[UI] Add/Edit CDROM Support
[UI] Attach/Replace/Detach a CDROM to/in/from a VM
ui/css/theme-default/guest-cdrom-add.css | 62 +++++++++++
ui/css/theme-default/guest-cdrom-edit.css | 62 +++++++++++
ui/css/theme-default/guest-edit.css | 108 +++++++++++++++---
ui/images/theme-default/guest-icon-sprite.png | Bin 0 -> 6748 bytes
ui/js/src/kimchi.api.js | 74 +++++++++++++
ui/js/src/kimchi.guest_cdrom_add_main.js | 79 +++++++++++++
ui/js/src/kimchi.guest_cdrom_edit_main.js | 87 +++++++++++++++
ui/js/src/kimchi.guest_edit_main.js | 75 ++++++++++++-
ui/pages/guest-cdrom-add.html.tmpl | 73 ++++++++++++
ui/pages/guest-cdrom-edit.html.tmpl | 73 ++++++++++++
ui/pages/guest-edit.html.tmpl | 153 +++++++++++++++++---------
ui/pages/i18n.html.tmpl | 5 +
12 files changed, 778 insertions(+), 73 deletions(-)
create mode 100644 ui/css/theme-default/guest-cdrom-add.css
create mode 100644 ui/css/theme-default/guest-cdrom-edit.css
create mode 100644 ui/images/theme-default/guest-icon-sprite.png
create mode 100644 ui/js/src/kimchi.guest_cdrom_add_main.js
create mode 100644 ui/js/src/kimchi.guest_cdrom_edit_main.js
create mode 100644 ui/pages/guest-cdrom-add.html.tmpl
create mode 100644 ui/pages/guest-cdrom-edit.html.tmpl
--
1.8.1.4
10 years, 9 months
[PATCH v5] UI: Software Update Support
by Hongliang Wang
Added UI support for software updating. The Host Tab will initially
list available updates to user if there are any; or we will disable
"Update All" Button if no updates available.
Please apply following patch first:
* [PATCH] [UI] Grid Widget - Enable/Disable Row Selection
v4 -> v5:
5a) Disable row selection in software update grid
(Thanks to Royce's comment)
v3 -> v4:
4a) Added the last update output
(Thanks to Aline's comment)
4b) Disabled horizontal resize function of output textarea
(Thanks to Aline's comment)
4c) Added "Update Progress" label to the output textarea
(Thanks to Aline's comment)
4d) Added refreshing the software grid after updating is finished
(Thanks to Aline's comment)
4e) Added software updates grid cleanup when host tab is unloaded
v2 -> v3:
3a) Fixed "Update All" Button always being disabled issue
(Thanks to Paulo and Aline's comment)
3b) Updated REST API calling according to back-end change
3c) Added in-progress message when system is being updated
(Thanks to Aline's comment)
v1 -> v2:
2a) Fixed "Update All" Button always being disabled issue
(Thanks to Paulo Ricardo Paz Vital's comment)
Signed-off-by: Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
---
ui/css/theme-default/host.css | 29 ++++++++++++++
ui/js/src/kimchi.api.js | 53 ++++++++++++++++++++++++++
ui/js/src/kimchi.host.js | 89 +++++++++++++++++++++++++++++++++++++++++++
ui/pages/i18n.html.tmpl | 10 +++++
ui/pages/tabs/host.html.tmpl | 17 +++++++++
5 files changed, 198 insertions(+)
diff --git a/ui/css/theme-default/host.css b/ui/css/theme-default/host.css
index 470ed1b..0f8b941 100644
--- a/ui/css/theme-default/host.css
+++ b/ui/css/theme-default/host.css
@@ -224,3 +224,32 @@
width: 300px;
}
/* End of Debug Report */
+
+/* Software Updates */
+.host-panel #software-updates-grid {
+ border-color: #ddd;
+ height: 300px;
+ width: 850px;
+}
+
+.software-update-id {
+ width: 30px;
+}
+
+.software-update-name,
+.software-update-repos {
+ width: 220px;
+}
+
+.software-update-version,
+.software-update-arch {
+ width: 190px;
+}
+
+.host-panel #software-updates-progress-textarea {
+ border: 1px solid #ddd;
+ height: 100px;
+ resize: vertical;
+ width: 846px;
+}
+/* End of Software Updates */
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index fdd9cfc..beaf314 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -727,5 +727,58 @@ var kimchi = {
success : suc,
error : err
});
+ },
+
+ listSoftwareUpdates : function(suc, err) {
+ kimchi.requestJSON({
+ url : kimchi.url + 'host/packagesupdate',
+ type : 'GET',
+ contentType : 'application/json',
+ dataType : 'json',
+ resend: true,
+ success : suc,
+ error : err
+ });
+ },
+
+ updateSoftwares : function(suc, err, progress) {
+ var taskID = -1;
+ var onResponse = function(data) {
+ taskID = data['id'];
+ trackTask();
+ };
+
+ var trackTask = function() {
+ kimchi.getTask(taskID, onTaskResponse, err);
+ };
+
+ var onTaskResponse = function(result) {
+ var taskStatus = result['status'];
+ switch(taskStatus) {
+ case 'running':
+ progress && progress(result);
+ setTimeout(function() {
+ trackTask();
+ }, 200);
+ break;
+ case 'finished':
+ suc(result);
+ break;
+ case 'failed':
+ err(result);
+ break;
+ default:
+ break;
+ }
+ };
+
+ kimchi.requestJSON({
+ url : kimchi.url + 'host/swupdate',
+ type : "POST",
+ contentType : "application/json",
+ dataType : "json",
+ success : onResponse,
+ error : err
+ });
}
};
diff --git a/ui/js/src/kimchi.host.js b/ui/js/src/kimchi.host.js
index 7974054..e146a75 100644
--- a/ui/js/src/kimchi.host.js
+++ b/ui/js/src/kimchi.host.js
@@ -133,6 +133,88 @@ kimchi.host_main = function() {
});
};
+ var softwareUpdatesGridID = 'software-updates-grid';
+ var softwareUpdatesGrid = null;
+ var progressAreaID = 'software-updates-progress-textarea';
+ var reloadProgressArea = function(result) {
+ var progressArea = $('#' + progressAreaID)[0];
+ $(progressArea).text(result['message']);
+ var scrollTop = $(progressArea).prop('scrollHeight');
+ $(progressArea).prop('scrollTop', scrollTop);
+ };
+
+ var initSoftwareUpdatesGrid = function(softwareUpdates) {
+ softwareUpdatesGrid = new kimchi.widget.Grid({
+ container: 'software-updates-grid-container',
+ id: softwareUpdatesGridID,
+ title: i18n['KCHUPD6001M'],
+ rowSelection: 'disabled',
+ toolbarButtons: [{
+ id: softwareUpdatesGridID + '-update-button',
+ label: i18n['KCHUPD6006M'],
+ disabled: true,
+ onClick: function(event) {
+ var updateButton = $(this);
+ var progressArea = $('#' + progressAreaID)[0];
+ $('#software-updates-progress-container').removeClass('hidden');
+ $(progressArea).text('');
+ !kimchi.isElementInViewport(progressArea) &&
+ progressArea.scrollIntoView();
+ $(updateButton).text(i18n['KCHUPD6007M']).prop('disabled', true);
+
+ kimchi.updateSoftwares(function(result) {
+ reloadProgressArea(result);
+ $(updateButton).text(i18n['KCHUPD6006M']).prop('disabled', false);
+ kimchi.topic('kimchi/softwareUpdated').publish({
+ result: result
+ });
+ }, function() {}, reloadProgressArea);
+ }
+ }],
+ frozenFields: [{
+ name: 'id',
+ label: ' ',
+ 'class': 'software-update-id'
+ }],
+ fields: [{
+ name: 'package_name',
+ label: i18n['KCHUPD6002M'],
+ 'class': 'software-update-name'
+ }, {
+ name: 'version',
+ label: i18n['KCHUPD6003M'],
+ 'class': 'software-update-version'
+ }, {
+ name: 'arch',
+ label: i18n['KCHUPD6004M'],
+ 'class': 'software-update-arch'
+ }, {
+ name: 'repository',
+ label: i18n['KCHUPD6005M'],
+ 'class': 'software-update-repos'
+ }],
+ data: softwareUpdates
+ });
+ };
+
+ var listSoftwareUpdates = function() {
+ kimchi.listSoftwareUpdates(function(softwareUpdates) {
+ $.each(softwareUpdates, function(i, item) {
+ softwareUpdates[i]['id'] = i + 1;
+ });
+
+ if(softwareUpdatesGrid) {
+ softwareUpdatesGrid.setData(softwareUpdates);
+ }
+ else {
+ initSoftwareUpdatesGrid(softwareUpdates);
+ }
+
+ var updateButton = $('#' + softwareUpdatesGridID + '-update-button');
+ $(updateButton).prop('disabled', softwareUpdates.length === 0);
+ });
+ };
+
var shutdownButtonID = '#host-button-shutdown';
var restartButtonID = '#host-button-restart';
var shutdownHost = function(params) {
@@ -191,6 +273,8 @@ kimchi.host_main = function() {
kimchi.keepMonitoringHost = this['checked'];
});
+ listSoftwareUpdates();
+
kimchi.getCapabilities(function(capabilities) {
if(!capabilities['system_report_tool']) {
return;
@@ -204,6 +288,10 @@ kimchi.host_main = function() {
listDebugReports();
});
+ kimchi.topic('kimchi/softwareUpdated').subscribe(function() {
+ listSoftwareUpdates();
+ });
+
kimchi.getHost(function(data) {
var htmlTmpl = $('#host-tmpl').html();
data['logo'] = data['logo'] || '';
@@ -469,5 +557,6 @@ kimchi.host_main = function() {
delete kimchi.hostTimer;
}
reportGrid && reportGrid.destroy();
+ softwareUpdatesGrid && softwareUpdatesGrid.destroy();
});
};
diff --git a/ui/pages/i18n.html.tmpl b/ui/pages/i18n.html.tmpl
index 38f71d9..c96f804 100644
--- a/ui/pages/i18n.html.tmpl
+++ b/ui/pages/i18n.html.tmpl
@@ -89,6 +89,16 @@ var i18n = {
'KCHDR6010M': "$_("Download")",
'KCHDR6011M': "$_("Report name should contain only letters, digits and/or hyphen ('-').")",
+
+ 'KCHUPD6001M': "$_("Software Updates")",
+ 'KCHUPD6002M': "$_("Package Name")",
+ 'KCHUPD6003M': "$_("Version")",
+ 'KCHUPD6004M': "$_("Architecture")",
+ 'KCHUPD6005M': "$_("Repository")",
+ 'KCHUPD6006M': "$_("Update All")",
+ 'KCHUPD6007M': "$_("Updating...")",
+
+
'KCHVM6001M': "$_("This will delete the virtual machine and its virtual disks. This operation cannot be undone. Would you like to continue?")",
'KCHVM6002M': "$_("Delete Confirmation")",
diff --git a/ui/pages/tabs/host.html.tmpl b/ui/pages/tabs/host.html.tmpl
index 23b9853..f6ecd47 100644
--- a/ui/pages/tabs/host.html.tmpl
+++ b/ui/pages/tabs/host.html.tmpl
@@ -120,6 +120,23 @@
</div>
</div>
</div>
+ <div id="software-update-section" class="host-section">
+ <h3 class="section-header"
+ aria-controls="content-software-update">
+ $_("Software Updates")
+ </h3>
+ <div id="content-software-update" class="section-content">
+ <div class="section-row">
+ <div class="section-value">
+ <div id="software-updates-grid-container"></div>
+ <div id="software-updates-progress-container" class="hidden">
+ <label for="software-updates-progress-textarea">$_("Update Progress")</label>
+ <textarea id="software-updates-progress-textarea" readonly></textarea>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
<div id="debug-report-section" class="host-section hidden">
<h3 class="section-header"
aria-controls="content-sys-reports">
--
1.8.1.4
10 years, 9 months
[PATCH v3 0/5] [UI] CDROM Management in a VM
by Hongliang Wang
Allow user to manipulate CDROM(s) in a VM:
1) Attach one or more CDROM(s);
2) Replace a CDROM with another ISO file path;
3) Detach a CDROM from a VM.
Tested on Chrome.
Please apply the following patch first:
* [UI] Window - Correct Footer Height
v2 -> v3:
3a) Keep the edit window silver instead of white
(Aline's comment)
3b) Added information after CDROM manipulations to avoid confusion
(Aline & Adam King's comment)
v1 -> v2:
2a) Separate one patch into 4 small ones to make it easier to review
(Thanks to Ramon Medeiros's comment)
2b) Updated API calling to list CDROM
(Thanks to Aline's comment)
2c) Separated VM updating window into 2 parts: general and storage
(Thanks to Aline's comment)
2d) Enhanced UI to allow user trigger replace CDROM window by clicking
ISO file path text box
2e) Changed uneditable fields from readonly to disabled
2f) Removed authors infomation
(Thanks to Aline's comment)
Hongliang Wang (5):
[UI] kimchi.message - Enhancement
[UI] Add CDROM-related APIs
[UI] Add i18n Variables for CDROM-related Function
[UI] Add/Edit CDROM Support
[UI] Attach/Replace/Detach a CDROM to/in/from a VM
ui/css/theme-default/guest-cdrom-add.css | 62 +++++++++++
ui/css/theme-default/guest-cdrom-edit.css | 62 +++++++++++
ui/css/theme-default/guest-edit.css | 133 +++++++++++++++++++---
ui/images/theme-default/guest-icon-sprite.png | Bin 0 -> 6748 bytes
ui/js/src/kimchi.api.js | 74 +++++++++++++
ui/js/src/kimchi.guest_cdrom_add_main.js | 79 +++++++++++++
ui/js/src/kimchi.guest_cdrom_edit_main.js | 88 +++++++++++++++
ui/js/src/kimchi.guest_edit_main.js | 86 +++++++++++++-
ui/js/src/kimchi.message.js | 27 +++--
ui/pages/guest-cdrom-add.html.tmpl | 73 ++++++++++++
ui/pages/guest-cdrom-edit.html.tmpl | 73 ++++++++++++
ui/pages/guest-edit.html.tmpl | 154 +++++++++++++++++---------
ui/pages/i18n.html.tmpl | 11 ++
13 files changed, 837 insertions(+), 85 deletions(-)
create mode 100644 ui/css/theme-default/guest-cdrom-add.css
create mode 100644 ui/css/theme-default/guest-cdrom-edit.css
create mode 100644 ui/images/theme-default/guest-icon-sprite.png
create mode 100644 ui/js/src/kimchi.guest_cdrom_add_main.js
create mode 100644 ui/js/src/kimchi.guest_cdrom_edit_main.js
create mode 100644 ui/pages/guest-cdrom-add.html.tmpl
create mode 100644 ui/pages/guest-cdrom-edit.html.tmpl
--
1.8.1.4
10 years, 9 months
[PATCH V2 0/3] template integrity verification: verify storagepool
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
V1 -> V2
rebase.
remove model test. For commit c4c093e does not allow to delete pool kimchi-test-pool
as it is associated with some templates.
Sometimes, user create a template, storagepool will change later.
So users can not create a vm from this template successfully.
It is necessary to check storagepool of a template.
ShaoHe Feng (3):
template integrity verification: verify storagepool, update API.md
template integrity verification: verify storagepool in backend
template integrity verification: update test case to verify
storagepool
docs/API.md | 1 +
src/kimchi/mockmodel.py | 3 +++
src/kimchi/model/templates.py | 5 +++++
src/kimchi/vmtemplate.py | 11 ++++++++++-
tests/test_rest.py | 15 ++++++++++++++-
5 files changed, 33 insertions(+), 2 deletions(-)
--
1.8.4.2
10 years, 9 months
[PATCH 0/3] template integrity verification: verify storagepool
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Sometimes, user create a template, storagepool will change later.
So users can not create a vm from this template successfully.
It is necessary to check storagepool of a template.
By the way storagepool, this verification does not depend on volume ref_cnt
Storagepool delete depends on volume ref_cnt
I make a mistake.
So sorry.
ShaoHe Feng (3):
template integrity verification: verify storagepool, update API.md
template integrity verification: verify storagepool in backend
template integrity verification: update test case to verify
storagepool
docs/API.md | 1 +
src/kimchi/mockmodel.py | 3 +++
src/kimchi/model/templates.py | 5 +++++
src/kimchi/vmtemplate.py | 10 ++++++++++
tests/test_model.py | 9 +++++++++
tests/test_rest.py | 13 +++++++++++++
6 files changed, 41 insertions(+)
--
1.8.4.2
10 years, 9 months
[PATCH v3 0/2] Github bug #307: Add storage pool list
by Daniel Barboza
From: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
Changelog:
v3:
- rebase with master
v2:
- Fixing message ID
These patches fixes the bug where the list of storage pool
types can take a long time to appear. The solution used here
is to detach the view of such list with the return of the
JSON that loads the partition data.
To test this patch I recomend doing the following change in
src/kimchi/model/hosts.py:
+ import time
class PartitionsModel(object):
def __init__(self, **kargs):
pass
def get_list(self):
+ time.sleep(10)
result = disks.get_partitions_names()
return result
The sleep(10) call will ensure that get_list (which returns the
partition data) will take at least 10 seconds to execute. It is
enough time to select the LOGICAL type and see how the UI is
working before and after the JSON call.
Daniel Henrique Barboza (2):
Github bug #307: add storage pool type list - JS changes
Github bug #307: storage pool type list - html and string changes
po/en_US.po | 9 +-
po/kimchi.pot | 8 +-
po/pt_BR.po | 9 +-
po/zh_CN.po | 9 +-
ui/js/src/kimchi.storagepool_add_main.js | 174 ++++++++++++++++---------------
ui/pages/i18n.html.tmpl | 5 +-
ui/pages/storagepool-add.html.tmpl | 7 +-
7 files changed, 129 insertions(+), 92 deletions(-)
--
1.8.3.1
10 years, 9 months
[PATCH] remove unused InvalidOperation instance
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Neither of these two removed InvalidOperation is used.
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
src/kimchi/auth.py | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/kimchi/auth.py b/src/kimchi/auth.py
index f8ccea1..af3b610 100644
--- a/src/kimchi/auth.py
+++ b/src/kimchi/auth.py
@@ -197,13 +197,11 @@ def kimchiauth(admin_methods=None):
debug("Entering kimchiauth...")
if check_auth_session():
if not has_permission(admin_methods):
- e = InvalidOperation('KCHAUTH0004E')
raise cherrypy.HTTPError(403)
return
if check_auth_httpba():
if not has_permission(admin_methods):
- e = InvalidOperation('KCHAUTH0004E')
raise cherrypy.HTTPError(403)
return
--
1.8.4.2
10 years, 9 months