[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] Add the command to run_command error and debug logging
by Christy Perez
I was debugging an issue and seeing rc's but not completely
sure which command they were caused by. I think it's just nice
to include what generated an rc, and also have all the output
on the same line to remove any uncertainty.
For example, instead of:
rc: -15
error:
rc: -15
error:
You'll see:
rc: -15 error: returned from cmd: /usr/bin/example-command-here
Signed-off-by: Christy Perez <christy(a)linux.vnet.ibm.com>
---
src/kimchi/utils.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/utils.py b/src/kimchi/utils.py
index 6c29e0e..11a36a4 100644
--- a/src/kimchi/utils.py
+++ b/src/kimchi/utils.py
@@ -174,9 +174,11 @@ def run_command(cmd, timeout=None):
kimchi_log.debug("out:\n%s", out)
if proc.returncode != 0:
- kimchi_log.error("rc: %s\nerror:\n%s", proc.returncode, error)
+ kimchi_log.error("rc: %s error: %s returned from cmd:".join(cmd),
+ proc.returncode, error)
elif error:
- kimchi_log.debug("error:\n%s", error)
+ kimchi_log.debug("error: %s returned from cmd: ".join(cmd),
+ error, cmd)
if timeout_flag[0]:
msg = ("subprocess is killed by signal.SIGKILL for "
--
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
[PATCH V2] add a make check-local command to verify the i18n string format
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
V1 -> V2:
move the check to top makefile.
check all i18n.py
improve the checking information.
ShaoHe Feng (1):
add a make check-local command to verify the i18n string format
Makefile.am | 8 ++++++++
1 file changed, 8 insertions(+)
--
1.8.5.3
10 years, 9 months
[PATCH] add a make check-local command to verify the i18n string format
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
When I do i18n translation, I find some string format are wrong.
So I add a check-local command to help the developer to check their
string format.
Every developers please run this command before submit your patch.
Thanks.
After you run this command, it may report some invalid string formats.
$ make -C src/kimchi/ check-local
check the invalid string format:
"KCHREPOS0018E": _("Could not write repository configuration file
%(repo_file)"),
You should check %(repo_file) is what you want.
Ref:
http://docs.python.org/2/library/string.html
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
src/kimchi/Makefile.am | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/kimchi/Makefile.am b/src/kimchi/Makefile.am
index 957d2c9..cec705a 100644
--- a/src/kimchi/Makefile.am
+++ b/src/kimchi/Makefile.am
@@ -29,6 +29,10 @@ EXTRA_DIST = \
kimchidir = $(pythondir)/kimchi
+check-local:
+ @echo "check the invalid string format:"
+ @grep -P "%\([^\)]*?\)[^0-9\.bcdeEfgGnosxX%]" i18n.py
+
install-data-local:
$(MKDIR_P) $(DESTDIR)$(kimchidir)
$(INSTALL_DATA) API.json $(DESTDIR)$(kimchidir)/API.json
--
1.8.5.3
10 years, 9 months
[PATCH 1/2] add to new function to encode the unicode passed to cherrpy.
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Then others can make use of it.
The cherrpy low version, cherrpy HTTPError accept unicode.
But the high level version, cherrpy refuse to accept unicode.
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
src/kimchi/root.py | 11 +++--------
src/kimchi/utils.py | 8 ++++++++
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/kimchi/root.py b/src/kimchi/root.py
index 9bae34a..aabae68 100644
--- a/src/kimchi/root.py
+++ b/src/kimchi/root.py
@@ -31,6 +31,7 @@ from kimchi.control import sub_nodes
from kimchi.control.base import Resource
from kimchi.control.utils import parse_request
from kimchi.exception import MissingParameter, OperationFailed
+from kimchi.utils import safe_encode
class Root(Resource):
@@ -50,19 +51,13 @@ class Root(Resource):
def error_production_handler(self, status, message, traceback, version):
data = {'code': status, 'reason': message}
res = template.render('error.html', data)
- if (type(res) is unicode and
- LooseVersion(cherrypy.__version__) < LooseVersion('3.2.5')):
- res = res.encode("utf-8")
- return res
+ return safe_encode(res)
def error_development_handler(self, status, message, traceback, version):
data = {'code': status, 'reason': message,
'call_stack': cherrypy._cperror.format_exc()}
res = template.render('error.html', data)
- if (type(res) is unicode and
- LooseVersion(cherrypy.__version__) < LooseVersion('3.2.5')):
- res = res.encode("utf-8")
- return res
+ return safe_encode(res)
def get(self):
return self.default(self.default_page)
diff --git a/src/kimchi/utils.py b/src/kimchi/utils.py
index 6c29e0e..bfad775 100644
--- a/src/kimchi/utils.py
+++ b/src/kimchi/utils.py
@@ -31,6 +31,7 @@ from multiprocessing import Process, Queue
from threading import Timer
from cherrypy.lib.reprconf import Parser
+from distutils.version import LooseVersion
from kimchi.asynctask import AsyncTask
from kimchi.config import paths, PluginPaths
@@ -41,6 +42,13 @@ kimchi_log = cherrypy.log.error_log
task_id = 0
+def safe_encode(string):
+ if (type(string) is unicode and
+ LooseVersion(cherrypy.__version__) < LooseVersion('3.2.5')):
+ return string.encode("utf-8")
+ return string
+
+
def _uri_to_name(collection, uri):
expr = '/%s/(.*?)/?$' % collection
m = re.match(expr, uri)
--
1.8.5.3
10 years, 9 months
[PATCH] Fix content of the SW update list after disable a repository.
by Paulo Vital
Kimchi lists all RPM packages to be updated when the Host tab is
selected, but even after disable some YUM repository and refresh the
content of this tab, the previous packages from the disabled repository
are still present in list.
This patch "deletes" the YumBase object after get the list of packages
to be updated. With this, every time the Host tab is selected, a new
list will be generated.
Signed-off-by: Paulo Vital <pvital(a)linux.vnet.ibm.com>
---
src/kimchi/swupdate.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/kimchi/swupdate.py b/src/kimchi/swupdate.py
index 23e3ff0..a785207 100644
--- a/src/kimchi/swupdate.py
+++ b/src/kimchi/swupdate.py
@@ -154,6 +154,7 @@ class YumUpdate(object):
yb.doLock()
self._pkgs = yb.doPackageLists('updates')
yb.doUnlock()
+ del yb
except Exception, e:
kimchiLock.release()
raise OperationFailed('KCHPKGUPD0003E', {'err': str(e)})
--
1.8.3.1
10 years, 9 months
[PATCH V4] 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 | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/kimchi/control/host.py b/src/kimchi/control/host.py
index cfc24bd..ee9fe7b 100644
--- a/src/kimchi/control/host.py
+++ b/src/kimchi/control/host.py
@@ -64,6 +64,12 @@ 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, 9 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 | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/kimchi/control/host.py b/src/kimchi/control/host.py
index cfc24bd..ee9fe7b 100644
--- a/src/kimchi/control/host.py
+++ b/src/kimchi/control/host.py
@@ -64,6 +64,12 @@ 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, 9 months