[PATCH] Bug Fix #282: Disable Start/Stop network buttons while wait backend lag
by Rodrigo Trujillo
When the user tries to Start/Stop (up/down) a network, there is a lag in
the backend, and it was possible to click on start/stop/delete again,
and again, generating errors. This patch disables the buttons and shows
loading gif to user, avoind this kind of error.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
ui/css/theme-default/network.css | 5 +++++
ui/js/src/kimchi.network.js | 14 ++++++++++----
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/ui/css/theme-default/network.css b/ui/css/theme-default/network.css
index 80640a3..67f2aa2 100644
--- a/ui/css/theme-default/network.css
+++ b/ui/css/theme-default/network.css
@@ -132,6 +132,11 @@
margin-left: 29px;
}
+.network .list .nw-loading {
+ background: #c0c0c0 url(../../images/theme-default/loading.gif)
+ center no-repeat;
+}
+
.network .list .up {
background: linear-gradient(to bottom, #BFD255 0%, #8EB92A 50%,
#72AA00 51%, #9ECB2D 100%) repeat scroll 0 0 transparent;
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index 91324ee..7cedc01 100644
--- a/ui/js/src/kimchi.network.js
+++ b/ui/js/src/kimchi.network.js
@@ -84,20 +84,26 @@ kimchi.addNetworkActions = function(network) {
$(".menu-container", "#" + network.name).toggle(false);
var menu = $(evt.currentTarget).parent();
if ($(evt.currentTarget).attr("nwAct") === "start") {
+ $(".network-state", $("#" + network.name)).switchClass("down", "nw-loading");
+ $("[nwAct='start']", menu).addClass("ui-state-disabled");
+ $("[nwAct='delete']", menu).addClass("ui-state-disabled");
+ $(":first-child", $("[nwAct='delete']", menu)).attr("disabled", true);
kimchi.toggleNetwork(network.name, true, function() {
$("[nwAct='start']", menu).addClass("hide-action-item");
+ $("[nwAct='start']", menu).removeClass("ui-state-disabled");
$("[nwAct='stop']", menu).removeClass("hide-action-item");
- $("[nwAct='delete']", menu).addClass("ui-state-disabled");
- $(":first-child", $("[nwAct='delete']", menu)).attr("disabled", true);
- $(".network-state", $("#" + network.name)).switchClass("down", "up");
+ $(".network-state", $("#" + network.name)).switchClass("nw-loading", "up");
});
} else if ($(evt.currentTarget).attr("nwAct") === "stop") {
+ $(".network-state", $("#" + network.name)).switchClass("up", "nw-loading");
+ $("[nwAct='stop']", menu).addClass("ui-state-disabled");
kimchi.toggleNetwork(network.name, false, function() {
$("[nwAct='start']", menu).removeClass("hide-action-item");
$("[nwAct='stop']", menu).addClass("hide-action-item");
+ $("[nwAct='stop']", menu).removeClass("ui-state-disabled");
$("[nwAct='delete']", menu).removeClass("ui-state-disabled");
$(":first-child", $("[nwAct='delete']", menu)).removeAttr("disabled");
- $(".network-state", $("#" + network.name)).switchClass("up", "down");
+ $(".network-state", $("#" + network.name)).switchClass("nw-loading", "down");
});
} else if ($(evt.currentTarget).attr("nwAct") === "delete") {
kimchi.confirm({
--
1.8.5.3
10 years, 10 months
[PATCHv3 0/5] Add volume reference count
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Available volumes will be tracked by volume reference count.
Add this field to storage volume,
so that storage volume/pool action validation can rely on it.
Royce Lv (5):
Fix vm disk path when it does not have source element
Add volume ref_cnt: update api.md
Add volume ref_cnt: Update controller and json schema
Add volume ref_cnt: Add model and mockmodel implementation
Add volume ref_cnt: Update test
docs/API.md | 3 +++
src/kimchi/API.json | 24 ++++++++++++++++++++++++
src/kimchi/control/storagevolumes.py | 1 +
src/kimchi/i18n.py | 3 +++
src/kimchi/mockmodel.py | 3 +++
src/kimchi/model/storagevolumes.py | 31 +++++++++++++++++++++++++++++++
src/kimchi/model/vmstorages.py | 23 +++++++++++++----------
tests/test_model.py | 4 ++++
tests/test_rest.py | 2 ++
9 files changed, 84 insertions(+), 10 deletions(-)
--
1.8.1.2
10 years, 10 months
[PATCH ] Fix screenshots and debug reports paths.
by Leonardo Garcia
From: Leonardo Garcia <lagarcia(a)br.ibm.com>
The definitions of the screenshots and debug reports paths in Cherrypy
config were pointing to a relative path that, when concatenated with the
root path defined in the [/] section, were not mapping to the correct path
when Kimchi is installed through its RPM package.
This fix removes the use of the root path in the [/] config section and
specifies the absolute path for all resources. That way we can easily
handle running Kimchi directly from the git source tree or after a
package installation --- in the later case the paths will not always be
relative to the same root path, but will rather be spread in the file system
according to the unix file system standard.
Signed-off-by: Leonardo Garcia <lagarcia(a)br.ibm.com>
---
src/kimchi/server.py | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/kimchi/server.py b/src/kimchi/server.py
index ef8e701..6c7dfc1 100644
--- a/src/kimchi/server.py
+++ b/src/kimchi/server.py
@@ -65,8 +65,6 @@ class Server(object):
CACHEEXPIRES = 31536000
configObj = {
'/': {'tools.trailing_slash.on': False,
- 'tools.staticdir.root': paths.prefix,
- 'tools.staticfile.root': paths.prefix,
'request.methods_with_bodies': ('POST', 'PUT'),
'tools.nocache.on': True,
'tools.sessions.on': True,
@@ -77,45 +75,45 @@ class Server(object):
'tools.kimchiauth.on': False},
'/css': {
'tools.staticdir.on': True,
- 'tools.staticdir.dir': 'ui/css',
+ 'tools.staticdir.dir': '%s/ui/css' % paths.prefix,
'tools.expires.on': True,
'tools.expires.secs': CACHEEXPIRES,
'tools.nocache.on': False
},
'/js': {
'tools.staticdir.on': True,
- 'tools.staticdir.dir': 'ui/js',
+ 'tools.staticdir.dir': '%s/ui/js' % paths.prefix,
'tools.expires.on': True,
'tools.expires.secs': CACHEEXPIRES,
'tools.nocache.on': False
},
'/libs': {
'tools.staticdir.on': True,
- 'tools.staticdir.dir': 'ui/libs',
+ 'tools.staticdir.dir': '%s/ui/libs' % paths.prefix,
'tools.expires.on': True,
'tools.expires.secs': CACHEEXPIRES,
'tools.nocache.on': False,
},
'/images': {
'tools.staticdir.on': True,
- 'tools.staticdir.dir': 'ui/images',
+ 'tools.staticdir.dir': '%s/ui/images' % paths.prefix,
'tools.nocache.on': False
},
'/data/screenshots': {
'tools.staticdir.on': True,
- 'tools.staticdir.dir': 'data/screenshots',
+ 'tools.staticdir.dir': config.get_screenshot_path(),
'tools.nocache.on': False
},
'/data/debugreports': {
'tools.staticdir.on': True,
- 'tools.staticdir.dir': 'data/debugreports',
+ 'tools.staticdir.dir': config.get_debugreports_path(),
'tools.nocache.on': False,
'tools.kimchiauth.on': True,
'tools.staticdir.content_types': {'xz': 'application/x-xz'}
},
'/config/ui/tabs.xml': {
'tools.staticfile.on': True,
- 'tools.staticfile.filename': 'config/ui/tabs.xml',
+ 'tools.staticfile.filename': '%s/config/ui/tabs.xml' % paths.prefix,
'tools.nocache.on': True
},
'/favicon.ico': {
@@ -124,7 +122,7 @@ class Server(object):
},
'/help': {
'tools.staticdir.on': True,
- 'tools.staticdir.dir': 'ui/pages/help',
+ 'tools.staticdir.dir': '%s/ui/pages/help' % paths.prefix,
'tools.nocache.on': False
}
}
--
1.8.5.3
10 years, 10 months
[PATCH v3] UI: Host 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.
V2 -> V3:
3a) Fixed "Update All" Button always being disabled issue
(Thanks to Paulo and Aline's comment)
3b) Update REST API for update action 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 | 6 ++++++
ui/js/src/kimchi.api.js | 5 +++--
ui/js/src/kimchi.host.js | 12 ++++++++++--
ui/pages/tabs/host.html.tmpl | 1 +
4 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/ui/css/theme-default/host.css b/ui/css/theme-default/host.css
index 1342ade..884a614 100644
--- a/ui/css/theme-default/host.css
+++ b/ui/css/theme-default/host.css
@@ -248,4 +248,10 @@
.software-update-arch {
width: 190px;
}
+
+.host-panel #software-updates-progress-textarea {
+ border: 1px solid #ddd;
+ height: 100px;
+ width: 846px;
+}
/* End of Software Updates */
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index c3a9516..abbf00e 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -745,7 +745,7 @@ var kimchi = {
});
},
- updateSoftwares : function(suc, err) {
+ updateSoftwares : function(suc, err, progress) {
var taskID = -1;
var onResponse = function(data) {
taskID = data['id'];
@@ -760,6 +760,7 @@ var kimchi = {
var taskStatus = result['status'];
switch(taskStatus) {
case 'running':
+ progress && progress(result);
setTimeout(function() {
trackTask();
}, 200);
@@ -776,7 +777,7 @@ var kimchi = {
};
kimchi.requestJSON({
- url : kimchi.url + 'host/packagesupdate/update',
+ url : kimchi.url + 'host/swupdate',
type : "POST",
contentType : "application/json",
dataType : "json",
diff --git a/ui/js/src/kimchi.host.js b/ui/js/src/kimchi.host.js
index b6a5878..d4016b5 100644
--- a/ui/js/src/kimchi.host.js
+++ b/ui/js/src/kimchi.host.js
@@ -144,9 +144,17 @@ kimchi.host_main = function() {
disabled: true,
onClick: function(event) {
var updateButton = $(this);
+ var progressArea = $('#software-updates-progress-textarea')[0];
+ $(progressArea).removeClass('hidden').text('');
+ !kimchi.isElementInViewport(progressArea) &&
+ progressArea.scrollIntoView();
$(updateButton).text(i18n['KCHUPD6007M']).prop('disabled', true);
kimchi.updateSoftwares(function(result) {
$(updateButton).text(i18n['KCHUPD6006M']).prop('disabled', false);
+ }, function() {}, function(result) {
+ $(progressArea).text(result['message']);
+ var scrollTop = $(progressArea).prop('scrollHeight');
+ $(progressArea).prop('scrollTop', scrollTop);
});
}
}],
@@ -189,8 +197,8 @@ kimchi.host_main = function() {
initSoftwareUpdatesGrid(softwareUpdates);
}
- $(softwareUpdatesGridID + '-update-button')
- .prop('disabled', softwareUpdates.length === 0);
+ var updateButton = $('#' + softwareUpdatesGridID + '-update-button');
+ $(updateButton).prop('disabled', softwareUpdates.length === 0);
});
};
diff --git a/ui/pages/tabs/host.html.tmpl b/ui/pages/tabs/host.html.tmpl
index 1de4fcd..71f72c7 100644
--- a/ui/pages/tabs/host.html.tmpl
+++ b/ui/pages/tabs/host.html.tmpl
@@ -132,6 +132,7 @@
<div class="section-row">
<div class="section-value">
<div id="software-updates-grid-container"></div>
+ <textarea id="software-updates-progress-textarea" class="hidden" readonly></textarea>
</div>
</div>
</div>
--
1.8.1.4
10 years, 10 months
sosreport bug in FC20
by Shu Ming
Hi,
When you do debugreport test on FC20, you may hit the following FC20
bug. It will cause the debugreport generation hang for a very long time.
The workaround is to add "-n networking" in your sosreport command, see
the diff below.
--- a/src/kimchi/model/debugreports.py
+++ b/src/kimchi/model/debugreports.py
@@ -65,7 +65,7 @@ class DebugReportsModel(object):
@staticmethod
def sosreport_generate(cb, name):
try:
- command = ['sosreport', '--batch', '--name=%s' % name]
+ command = ['sosreport', '-n', 'networking', '--batch', '--name=%s' % name]
output, error, retcode = run_command(command)
if retcode < 0:
The bug line in FC20
https://bugzilla.redhat.com/show_bug.cgi?id=1028102
10 years, 10 months
[PATCH V2 0/6] Fix VM error messages handling
by Rodrigo Trujillo
V2:
Fix tests
V1:
The Guest tab was not showing backend error messages properly. So user was
not able to know what happened if a VM failed to start, stop, reset or delete.
In order to fix this, both backend and frontend had to be changed.
Rodrigo Trujillo (6):
Fix vm start UI error return message
Fix VM stop error messages handling (backend/UI)
Fix VM reset (UI) error messages hnadling
Fix VM delete error message handling (UI/Backend)
Delete unsed _vm_exists funtion
Fix Kimchi vm tests according to new messages sent from backend
src/kimchi/i18n.py | 2 ++
src/kimchi/model/vms.py | 51 ++++++++++++++++++++----------------------
tests/test_model.py | 29 +++++++++++++++++++-----
ui/js/src/kimchi.guest_main.js | 26 ++++++++++-----------
ui/pages/i18n.html.tmpl | 1 +
5 files changed, 63 insertions(+), 46 deletions(-)
--
1.8.5.3
10 years, 10 months
[PATCH] Fix VM's network model template for Power systems.
by Paulo Vital
Setup the network model to 'spapr-vlan' by default in those old distro
vesions for new Power guests.
Also, setup the modern distro version for Power guests: RHEL7.0 and Fedora 19.
Signed-off-by: Paulo Vital <pvital(a)linux.vnet.ibm.com>
---
src/kimchi/osinfo.py | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/kimchi/osinfo.py b/src/kimchi/osinfo.py
index 8ce4110..e8e9a65 100644
--- a/src/kimchi/osinfo.py
+++ b/src/kimchi/osinfo.py
@@ -41,7 +41,7 @@ template_specs = {'x86': {'old': dict(common_spec, disk_bus='ide',
nic_model='virtio',
sound_model= 'ich6')},
'power': {'old': dict(common_spec, disk_bus='scsi',
- nic_model='rtl8139', cdrom_bus='scsi',
+ nic_model='spapr-vlan', cdrom_bus='scsi',
kbd_bus='usb', mouse_bus='usb'),
'modern': dict(common_spec, disk_bus='virtio',
nic_model='virtio',
@@ -49,10 +49,10 @@ template_specs = {'x86': {'old': dict(common_spec, disk_bus='ide',
mouse_bus='usb')}}
-modern_version_bases = {'debian': '6.0', 'ubuntu': '7.10', 'opensuse': '10.3',
- 'centos': '5.3', 'rhel': '6.0', 'fedora': '16',
- 'gentoo': '0'}
-
+modern_version_bases = {'x86': {'debian': '6.0', 'ubuntu': '7.10',
+ 'opensuse': '10.3', 'centos': '5.3',
+ 'rhel': '6.0', 'fedora': '16', 'gentoo': '0'},
+ 'power': {'rhel': '7.0', 'fedora': '19'}}
isolinks = {
'debian': {
@@ -97,9 +97,10 @@ def lookup(distro, version):
params['cdrom'] = isolinks.get(distro, {}).get(version, '')
arch = _get_arch()
- if distro in modern_version_bases:
+ if distro in modern_version_bases[arch]:
params['icon'] = 'images/icon-%s.png' % distro
- if LooseVersion(version) >= LooseVersion(modern_version_bases[distro]):
+ if LooseVersion(version) >= LooseVersion(
+ modern_version_bases[arch][distro]):
params.update(template_specs[arch]['modern'])
else:
params.update(template_specs[arch]['old'])
--
1.8.3.1
10 years, 10 months
[PATCH V4] Fix Add Network window
by Rodrigo Trujillo
VLans and Interfaces must only be available for selection if network
type Bridge is selected. This restriction was not implemented in the UI.
This patch fixes this problem.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.network.js | 22 +++++++++++++++++++++-
ui/pages/tabs/network.html.tmpl | 20 +++++++++++---------
2 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index fa2319c..91324ee 100644
--- a/ui/js/src/kimchi.network.js
+++ b/ui/js/src/kimchi.network.js
@@ -207,11 +207,28 @@ kimchi.openNetworkDialog = function(okCallback) {
$("#networkConfig").dialog("open");
};
+kimchi.enableBridgeOptions = function(enable) {
+ if (!enable) {
+ $("#enableVlan").prop("checked", false);
+ $("#networkVlanID").prop("disabled", true);
+ $("#networkVlanID").val("");
+ $("#networkInterface").val("");
+ $("#bridge-options").slideUp(100);
+ } else if (!$("#networkInterface").val()){
+ $("#networkInterface").prop("selectedIndex", 0);
+ $("#bridge-options").slideDown(100);
+ }
+};
+
kimchi.setDefaultNetworkType = function(isInterfaceAvail) {
$("#networkTypeBri").prop("checked", isInterfaceAvail);
$("#networkTypeBri").prop("disabled", !isInterfaceAvail);
- $("#networkInterface").prop("disabled", !isInterfaceAvail);
$("#networkTypeNat").prop("checked", !isInterfaceAvail);
+ if (!isInterfaceAvail) {
+ kimchi.enableBridgeOptions(false);
+ } else {
+ $("#bridge-options").slideDown(100);
+ }
};
kimchi.getNetworkDialogValues = function() {
@@ -247,12 +264,15 @@ kimchi.setupNetworkFormEvent = function() {
});
$("#networkTypeIso").on("click", function(event) {
$("#networkInterface").prop("disabled", true);
+ kimchi.enableBridgeOptions(false);
});
$("#networkTypeNat").on("click", function(event) {
$("#networkInterface").prop("disabled", true);
+ kimchi.enableBridgeOptions(false);
});
$("#networkTypeBri").on("click", function(event) {
$("#networkInterface").prop("disabled", false);
+ kimchi.enableBridgeOptions(true);
});
};
diff --git a/ui/pages/tabs/network.html.tmpl b/ui/pages/tabs/network.html.tmpl
index afa6274..f298516 100644
--- a/ui/pages/tabs/network.html.tmpl
+++ b/ui/pages/tabs/network.html.tmpl
@@ -68,15 +68,17 @@
<input type="radio" id="networkTypeBri" name="networkType" value="bridged">
<label for="networkTypeBri">$_("Bridged: Virtual machines are connected to physical network directly")</label>
</div>
- <div class="destination">
- <label>$_("Destination"): </label>
- <select id="networkInterface"></select>
- </div>
- <div class="VLAN">
- <label for="enableVlan">$_("Enable VLAN"): </label>
- <input id="enableVlan" type="checkbox" value=""/>
- <label>$_("VLAN ID"): </label>
- <input type="text" id="networkVlanID" disabled>
+ <div id="bridge-options">
+ <div class="destination">
+ <label for="networkInterface">$_("Destination"): </label>
+ <select id="networkInterface"></select>
+ </div>
+ <div class="VLAN">
+ <label for="enableVlan">$_("Enable VLAN"): </label>
+ <input id="enableVlan" type="checkbox" value=""/>
+ <label for="networkVlanID">$_("VLAN ID"): </label>
+ <input type="text" id="networkVlanID" disabled>
+ </div>
</div>
</div>
</div>
--
1.8.5.3
10 years, 10 months
[PATCH] Fix debug report creation in API.json
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Because debug report creation name is mandatory,
add this field to require.
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
src/kimchi/API.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index f595bbf..153162d 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -37,6 +37,7 @@
"description": "The name for the debug report file.",
"type": "string",
"pattern": "^[A-Za-z0-9-]*$",
+ "required": true,
"error": "KCHDR0007E"
}
}
--
1.8.1.2
10 years, 10 months
[PATCH V1] Add another way to download the debugreport file in the test
by Shu Ming
Two urls are provided to download the files and we need test both
---
tests/test_rest.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/test_rest.py b/tests/test_rest.py
index ca96dc0..b2f2c6b 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -1460,6 +1460,10 @@ class RestTests(unittest.TestCase):
self.assertEquals(200, resp.status)
resp = request(host, port, '/debugreports/report1/content')
self.assertEquals(200, resp.status)
+ resp = request(host, port, '/debugreports/report1')
+ debugre = json.loads(resp.read())
+ resp = request(host, port, debugre['file'])
+ self.assertEquals(200, resp.status)
def test_host(self):
resp = self.request('/host').read()
--
1.8.1.4
10 years, 10 months