[RFC] timeout for sessions
by Sheldon
I'd like to talk about timeout for sessions again.
Firstly, the default timeout of sessions is 60 minutes. It seems too long.
So I want to set the timeout of sessions explicitly. maybe 10 minutes
is OK.
If session got inactive for 10 minutes then it should expire automatically.
And should ask user for relogin. This is required for the security reason.
But this timeout will not take effect on guest tab and host tabs.
For guest tab, the root cause is because the front end refresh the vm
list every 5 seconds
by sending the "GET /vms" REST API call to the server.
For host tabs. the front end will also get the host info and stats all
the time.
So the session will never timeout.
There are several proposal for this problem.
1. UI set a timeout time.
if no users operations for a certain time(such as 5 seconds), UI stops
to get vms or host info and stats.
and let server close session when timeout.
2. UI log out automatically.
if no user operations for ertain time(such as 5 seconds), UI log out
automatically.
3. distinguish the user and JS requests.
Maybe there need an extra header to tell the requests from the JS
request or the USER.
We should set the User-Agent of JS requests explicitly.
such as:
User-Agent: auto-robot/1.0
I can check whether cherrypy has some user-agent filter for timeout.
even without this filter, I can set a extra data for Cherrpy Session.
and can force the session to expire with /sessions/./expire/().
or a cookie to tell the sever this is request is send by JS robot. the
similar method to User-Agent
Now the dispute is that:
1. When user is at Guests Tab, he wants to keep monitoring VM status,
and he doesn't want session to be timed out.
2. the UI may collection host info and store host info.
If these two case, that means the /host and /vms URL can not need
authentication.
--
Thanks and best regards!
Sheldon Feng(???)<shaohef(a)linux.vnet.ibm.com>
IBM Linux Technology Center
10 years, 7 months
[PATCH] Packaging: removed start of kimchid from RPM and DEB files
by Paulo Vital
It's not a good practice to start services automatically in the end of RPM
or DEB installation. So, this patch is removing any reference to start the
kimchid service automatically.
Tested on Fedora 19 and RHEL 6.5.
Signed-off-by: Paulo Vital <pvital(a)linux.vnet.ibm.com>
---
contrib/DEBIAN/postinst | 1 -
contrib/kimchi.spec.fedora.in | 6 ------
contrib/kimchi.spec.suse.in | 1 -
3 files changed, 8 deletions(-)
diff --git a/contrib/DEBIAN/postinst b/contrib/DEBIAN/postinst
index 5f7e2ff..5bca009 100755
--- a/contrib/DEBIAN/postinst
+++ b/contrib/DEBIAN/postinst
@@ -18,7 +18,6 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-service kimchid start
set +e
service firewalld status >/dev/null 2>&1
if [ $? -ne 0 ]; then
diff --git a/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in
index 558bda2..149c3a7 100644
--- a/contrib/kimchi.spec.fedora.in
+++ b/contrib/kimchi.spec.fedora.in
@@ -88,12 +88,6 @@ if [ $1 -eq 1 ] ; then
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
-%if 0%{?rhel} == 6
-start kimchid
-%else
-service kimchid start
-%endif
-
%if 0%{?with_systemd}
service firewalld status >/dev/null 2>&1
if [ $? -ne 0 ]; then
diff --git a/contrib/kimchi.spec.suse.in b/contrib/kimchi.spec.suse.in
index 97e66bc..99b4fea 100644
--- a/contrib/kimchi.spec.suse.in
+++ b/contrib/kimchi.spec.suse.in
@@ -49,7 +49,6 @@ install -Dm 0755 contrib/kimchid.sysvinit %{buildroot}%{_initrddir}/kimchid
%post
-service kimchid start
chkconfig kimchid on
%preun
--
1.8.3.1
10 years, 7 months
[PATCH 0/3] Github bug #327 - NFS workaround
by Daniel Barboza
From: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
This patch series fixes the bug described in
https://github.com/kimchi-project/kimchi/issues/327. If there
are any NFS pools created and the NFS server is unreachable,
kimchi will hang due to a malfunction of libvirt in this
specific scenario.
The proposed workaround is to avoid any libvirt operation
in the NFS pool that fits this scenario, treating the pool as
'inaccessible' and warning the UI. Trying to activate/
deactivate the nfs pool at this case will take no effect,
warning the user that the NFS server is unreachable.
Daniel Henrique Barboza (3):
Github bug #327: NFS pool workaround: i18n changes
Github bug #327: NFS pool workaround: timeout adjustments
Github bug #327: NFS pool workaround: model changes
src/kimchi/i18n.py | 2 +
src/kimchi/model/libvirtstoragepool.py | 9 ++--
src/kimchi/model/storagepools.py | 75 +++++++++++++++++++++++++++++++++-
src/kimchi/utils.py | 2 +-
4 files changed, 83 insertions(+), 5 deletions(-)
--
1.8.3.1
10 years, 7 months
[PATCH] bug fix: Properly display missing parameter
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
The exception instance was being used as the missing parameter what is
causing errors like below:
TypeError: coercing to Unicode: need string or buffer, exceptions.KeyError found
To fix use the string representation for the exception instance.
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
---
src/kimchi/mockmodel.py | 4 ++--
src/kimchi/model/storagepools.py | 2 +-
src/kimchi/model/storagevolumes.py | 2 +-
src/kimchi/root.py | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index b50bf31..b23a024 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -367,7 +367,7 @@ class MockModel(object):
pool.info['autostart'] = False
except KeyError, item:
raise MissingParameter("KCHPOOL0004E",
- {'item': item, 'name': name})
+ {'item': str(item), 'name': name})
if name in self._mock_storagepools or name in (ISO_POOL_NAME,):
raise InvalidOperation("KCHPOOL0001E", {'name': name})
@@ -428,7 +428,7 @@ class MockModel(object):
pool.info['path'], name)
except KeyError, item:
raise MissingParameter("KCHVOL0004E",
- {'item': item, 'volume': name})
+ {'item': str(item), 'volume': name})
if name in pool._volumes:
raise InvalidOperation("KCHVOL0001E", {'name': name})
diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py
index cf66a86..011feb0 100644
--- a/src/kimchi/model/storagepools.py
+++ b/src/kimchi/model/storagepools.py
@@ -90,7 +90,7 @@ class StoragePoolsModel(object):
xml = poolDef.xml.encode("utf-8")
except KeyError, item:
raise MissingParameter("KCHPOOL0004E",
- {'item': item, 'name': name})
+ {'item': str(item), 'name': name})
if name in self.get_list():
raise InvalidOperation("KCHPOOL0001E", {'name': name})
diff --git a/src/kimchi/model/storagevolumes.py b/src/kimchi/model/storagevolumes.py
index 20c65b9..6bd6ded 100644
--- a/src/kimchi/model/storagevolumes.py
+++ b/src/kimchi/model/storagevolumes.py
@@ -62,7 +62,7 @@ class StorageVolumesModel(object):
pool = StoragePoolModel.get_storagepool(pool, self.conn)
xml = vol_xml % params
except KeyError, item:
- raise MissingParameter("KCHVOL0004E", {'item': item,
+ raise MissingParameter("KCHVOL0004E", {'item': str(item),
'volume': name})
try:
diff --git a/src/kimchi/root.py b/src/kimchi/root.py
index 4a1a9cd..08056d2 100644
--- a/src/kimchi/root.py
+++ b/src/kimchi/root.py
@@ -106,7 +106,7 @@ class KimchiRoot(Root):
userid = params['userid']
password = params['password']
except KeyError, item:
- e = MissingParameter('KCHAUTH0003E', {'item': item})
+ e = MissingParameter('KCHAUTH0003E', {'item': str(item)})
raise cherrypy.HTTPError(400, e.message)
try:
--
1.7.10.4
10 years, 7 months
[PATCH] Clear out the guests list properly using jQuery
by Adam King
Clear out the guests list properlt using jQuery empty().
Setting the html to '' as previous can result in browser memory leaks.
Signed-off-by: Adam King <rak(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.guest_main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js
index b5e7af3..e350373 100644
--- a/ui/js/src/kimchi.guest_main.js
+++ b/ui/js/src/kimchi.guest_main.js
@@ -137,7 +137,7 @@ kimchi.listVmsAuto = function() {
var guestTemplate = kimchi.guestTemplate;
var currentConsoleImages = kimchi.getVmsCurrentConsoleImgs();
var openMenuGuest = kimchi.getOpenMenuVmId();
- $('#guestList').html('');
+ $('#guestList').empty();
$('#guestListField').show();
$('#noGuests').hide();
--
1.8.1.4
10 years, 7 months
[PATCH] issue #316: Only verify if path starts with '/'
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
Any character is allowed in a Linux path.
So while creating a DIR storage pool we just need to make sure the path
starts with '/' and backend will properly check if it exists on the
system.
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
---
ui/js/src/kimchi.storagepool_add_main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js
index 574cf5a..1e3e4b4 100644
--- a/ui/js/src/kimchi.storagepool_add_main.js
+++ b/ui/js/src/kimchi.storagepool_add_main.js
@@ -167,7 +167,7 @@ kimchi.validateDirForm = function () {
kimchi.message.error.code('KCHPOOL6002E');
return false;
}
- if (!/((\/([0-9a-zA-Z-_\.]+)))$/.test(path)) {
+ if (!/(^\/.*)$/.test(path)) {
kimchi.message.error.code('KCHAPI6003E');
return false;
}
--
1.7.10.4
10 years, 7 months
[PATCH 0/2] Fix vm creation on readonly pool type
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Some pool types (scsi, iscsi, mpath) do not allow create/delete
storage volume, so it is wrong to delete these volumes when vm delete.
Fix it by just delete non read only pool types.
Royce Lv (2):
Fix vm creation storage rollback clean
Prevent volume create and delete for certain pool types
src/kimchi/control/base.py | 2 ++
src/kimchi/i18n.py | 1 +
src/kimchi/model/constant.py | 24 ++++++++++++++++++++++++
src/kimchi/model/storagevolumes.py | 18 +++++++++++++++---
src/kimchi/model/vms.py | 14 ++++++--------
5 files changed, 48 insertions(+), 11 deletions(-)
create mode 100644 src/kimchi/model/constant.py
--
1.8.1.2
10 years, 7 months
[PATCH] Issue #289: catch the libvirtError when failed to start a vm
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
There are several reasons when failed to start domain.
we should catch the libvirtError.
issue:
https://github.com/kimchi-project/kimchi/issues/289
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
src/kimchi/i18n.py | 1 +
src/kimchi/model/vms.py | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index dfc1b2b..fc4b1ff 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -76,6 +76,7 @@ messages = {
"KCHVM0016E": _("Specify a template to create a virtual machine from"),
"KCHVM0017E": _("Volume list (LUNs names) not given."),
"KCHVM0018E": _("Virtual machine volumes must be a list of strings with distinct LUNs names."),
+ "KCHVM0019E": _("Unable to start virtual machine %(name)s. Details: %(err)s"),
"KCHVMIF0001E": _("Interface %(iface)s does not exist in virtual machine %(name)s"),
"KCHVMIF0002E": _("Network %(network)s specified for virtual machine %(name)s does not exist"),
diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index 9da6688..b6a42e6 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -376,7 +376,11 @@ class VMModel(object):
run_setfacl_set_attr(iso)
dom = self.get_vm(name, self.conn)
- dom.create()
+ try:
+ dom.create()
+ except libvirt.libvirtError as e:
+ raise OperationFailed("KCHVM0019E",
+ {'name': name, 'err': e.get_error_message()})
def stop(self, name):
if self._vm_exists(name):
--
1.8.4.2
10 years, 7 months
[PATCH 0/2] Fix debug report naming error
by Rodrigo Trujillo
The two patch fix a problem reported by internal test team.
Rodrigo Trujillo (2):
Fix debug report naming problem (backend)
Fix debug report naming problem (UI)
src/kimchi/API.json | 13 +++++++++++++
src/kimchi/control/base.py | 1 +
src/kimchi/i18n.py | 3 +++
ui/js/src/kimchi.report_add_main.js | 9 +++++++--
ui/pages/report-add.html.tmpl | 2 +-
5 files changed, 25 insertions(+), 3 deletions(-)
--
1.8.5.3
10 years, 7 months
[PATCH v2] Add help to user menu
by Adam King
Add a link to the help to the Kimchi user menu.
Include text for the word "Help" in the translation files.
The implementation assumes that the help file name matches the tab hash id, and does a simple mapping from one to the other.
Signed-off-by: Adam King <rak(a)linux.vnet.ibm.com>
---
po/en_US.po | 3 +++
po/kimchi.pot | 3 +++
po/pt_BR.po | 3 +++
po/zh_CN.po | 3 +++
ui/css/theme-default/topbar.css | 3 ++-
ui/js/src/kimchi.main.js | 16 ++++++++++++++++
ui/pages/kimchi-ui.html.tmpl | 5 ++++-
7 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/po/en_US.po b/po/en_US.po
index 8ac59c7..d68d8a4 100644
--- a/po/en_US.po
+++ b/po/en_US.po
@@ -304,6 +304,9 @@ msgstr "This is not a valid Server Name or IP. please, modify it."
msgid "Log out"
msgstr "Log out"
+msgid "Help"
+msgstr ""
+
msgid "Log In"
msgstr "Log In"
diff --git a/po/kimchi.pot b/po/kimchi.pot
index f7b33ee..1a748ce 100755
--- a/po/kimchi.pot
+++ b/po/kimchi.pot
@@ -296,6 +296,9 @@ msgstr ""
msgid "Log out"
msgstr ""
+msgid "Help"
+msgstr ""
+
msgid "Log In"
msgstr ""
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 0d924e3..7e521e6 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -322,6 +322,9 @@ msgstr ""
msgid "Log out"
msgstr "Sair"
+msgid "Help"
+msgstr ""
+
msgid "Log In"
msgstr "Entrar"
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 361c11a..5cc93cd 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -312,6 +312,9 @@ msgstr "这不是一个有效的服务器名或IP,请修改"
msgid "Log out"
msgstr "登出"
+msgid "Help"
+msgstr ""
+
msgid "Log In"
msgstr "登录"
diff --git a/ui/css/theme-default/topbar.css b/ui/css/theme-default/topbar.css
index c273c70..1988a6e 100644
--- a/ui/css/theme-default/topbar.css
+++ b/ui/css/theme-default/topbar.css
@@ -160,11 +160,12 @@
white-space: nowrap;
}
-#btn-logout {
+.user-menu-item {
color: black;
font-size: 14px;
}
+
a#btn-logout:hover {
text-decoration: underline;
}
diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js
index 5387495..d04c5b9 100644
--- a/ui/js/src/kimchi.main.js
+++ b/ui/js/src/kimchi.main.js
@@ -135,6 +135,8 @@ kimchi.main = function() {
});
// Perform logging out via Ajax request.
+
+
$('#btn-logout').on('click', function() {
kimchi.logout(function() {
updatePage();
@@ -142,6 +144,8 @@ kimchi.main = function() {
kimchi.message.error(err.responseJSON.reason);
});
});
+
+ $('#btn-help').on('click', kimchi.getHelp);
};
// Load i18n translation strings first and then render the page.
@@ -219,3 +223,15 @@ kimchi.getTabHtml = function(url) {
});
return tabsHtml;
};
+
+kimchi.getHelp = function(e) {
+ var url=window.location.hash;
+ url = url.replace("#tabs","/help");
+ if (url == "/help")
+ url=url+"/index.html"
+ else
+ url=url+".html";
+
+ window.open(url, "Kimchi Help");
+ e.preventDefault();
+};
diff --git a/ui/pages/kimchi-ui.html.tmpl b/ui/pages/kimchi-ui.html.tmpl
index eebe886..24e0372 100644
--- a/ui/pages/kimchi-ui.html.tmpl
+++ b/ui/pages/kimchi-ui.html.tmpl
@@ -78,7 +78,10 @@
<span id="user-name"></span>
<span class="arrow"></span>
<div class="action-panel popover right-side">
- <a id="btn-logout" href="javascript: void(0);">$_("Log out")</a>
+ <a id="btn-help" class="user-menu-item" href="javascript:void(0);">$_("Help")</a>
+ <br/>
+ <hr/>
+ <a id="btn-logout" class="user-menu-item" href="javascript: void(0);">$_("Log out")</a>
</div>
</div>
</li>
--
1.8.1.4
10 years, 7 months