[PATCH] Fix some test cases on test_config.py.in for Wok and Kimchi
by Aline Manera
Some tests in plugin/kimchi/tests/test_config.py.in were related to Wok
configuration, so move those tests to Wok.
Also improve test_config.py.in on Wok to also verify the UI configuration.
And fix some test cases on Kimchi related test_config.py.in
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/wok/config.py.in | 31 ++--
src/wok/plugins/kimchi/tests/test_config.py.in | 206 +++++++------------------
tests/test_config.py.in | 115 +++++++++++++-
3 files changed, 182 insertions(+), 170 deletions(-)
diff --git a/src/wok/config.py.in b/src/wok/config.py.in
index b33fb6b..b17d1ed 100644
--- a/src/wok/config.py.in
+++ b/src/wok/config.py.in
@@ -55,6 +55,8 @@ FONTS_PATH = {
]
}
+SESSIONSTIMEOUT = 10 # session time out is 10 minutes
+
def get_object_store():
return os.path.join(paths.state_dir, 'objectstore')
@@ -88,6 +90,13 @@ class Paths(object):
self.plugins_dir = self.add_prefix('src/wok/plugins')
self.mo_dir = self.add_prefix('mo')
+ for font in FONT_FILES.keys():
+ paths = FONTS_PATH[font]
+ for path in paths:
+ font_file = os.path.join(path, FONT_FILES[font][0])
+ if os.path.exists(font_file):
+ setattr(self, '%s_dir' % font, path)
+
def get_prefix(self):
if __file__.startswith("/"):
base = os.path.dirname(__file__)
@@ -147,24 +156,20 @@ class UIConfig(dict):
'tools.expires.secs': CACHEEXPIRES})
for font, files in FONT_FILES.iteritems():
- paths = FONTS_PATH[font]
- for path in paths:
- for filename in files:
- font_file = os.path.join(path, filename)
- if os.path.exists(font_file):
- ui_configs['/fonts/%s' % filename] = {
- 'tools.staticfile.on': True,
- 'tools.staticfile.filename': font_file,
- 'tools.wokauth.on': False,
- 'tools.nocache.on': False}
+ font_dir = getattr(paths, "%s_dir" % font)
+ for filename in files:
+ font_file = os.path.join(font_dir, filename)
+ if os.path.exists(font_file):
+ ui_configs['/fonts/%s' % filename] = {
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename': font_file,
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False}
self.update(ui_configs)
class WokConfig(dict):
- # session time out is 10 minutes
- SESSIONSTIMEOUT = 10
-
wok_config = {
'/': {
'tools.trailing_slash.on': False,
diff --git a/src/wok/plugins/kimchi/tests/test_config.py.in b/src/wok/plugins/kimchi/tests/test_config.py.in
index e4db15a..fb23b5c 100644
--- a/src/wok/plugins/kimchi/tests/test_config.py.in
+++ b/src/wok/plugins/kimchi/tests/test_config.py.in
@@ -20,7 +20,8 @@
import unittest
from cherrypy.lib.reprconf import Parser
-from wok.config import Paths, PluginPaths, WokConfig
+from wok.config import CACHEEXPIRES, SESSIONSTIMEOUT
+from wok.config import Paths, PluginPaths
from wok.plugins.kimchi.config import get_debugreports_path
from wok.plugins.kimchi.config import get_screenshot_path
@@ -47,28 +48,6 @@ class ConfigTests(unittest.TestCase):
expected = usr_local + expected
self.assertEquals(actual, expected)
- def test_installed_paths(self):
- Paths.get_prefix = lambda self: '@datadir@/wok'
- paths = Paths()
- self.assertInstalledPath(paths.state_dir, '/var/lib/wok')
- self.assertInstalledPath(paths.log_dir, '/var/log/wok')
- self.assertInstalledPath(paths.conf_dir, '/etc/wok')
- self.assertInstalledPath(paths.src_dir, '@wokdir@')
- self.assertInstalledPath(paths.plugins_dir, '@wokdir@/plugins')
- self.assertInstalledPath(paths.ui_dir, '@datadir@/wok/ui')
- self.assertInstalledPath(paths.mo_dir, '@prefix@/share/locale')
-
- def test_uninstalled_paths(self):
- Paths.get_prefix = lambda self: '/home/user/wok'
- paths = Paths()
- self.assertEquals(paths.state_dir, '/home/user/wok/data')
- self.assertEquals(paths.log_dir, '/home/user/wok/log')
- self.assertEquals(paths.conf_dir, '/home/user/wok/src')
- self.assertEquals(paths.src_dir, '/home/user/wok/src/wok')
- self.assertEquals(paths.plugins_dir, '/home/user/wok/plugins')
- self.assertEquals(paths.ui_dir, '/home/user/wok/ui')
- self.assertEquals(paths.mo_dir, '/home/user/wok/mo')
-
def test_installed_plugin_paths(self):
KimchiPaths.get_prefix = lambda self: '@datadir@/wok'
paths = KimchiPaths()
@@ -81,100 +60,27 @@ class ConfigTests(unittest.TestCase):
self.assertInstalledPath(paths.mo_dir, '@prefix@/share/locale')
def test_uninstalled_plugin_paths(self):
- KimchiPaths.get_prefix = lambda self: '/home/user/wok'
paths = KimchiPaths()
- self.assertEquals(paths.conf_dir, '/home/user/wok/plugins/kimchi')
- self.assertEquals(
- paths.conf_file, '/home/user/wok/plugins/kimchi/kimchi.conf')
- self.assertEquals(paths.src_dir, '/home/user/wok/plugins/kimchi')
- self.assertEquals(paths.ui_dir, '/home/user/wok/plugins/kimchi/ui')
- self.assertEquals(paths.mo_dir, '/home/user/wok/plugins/kimchi/mo')
-
- def test_wok_config(self):
- Paths.get_prefix = PluginPaths.get_prefix = get_prefix
- paths = Paths()
- CACHEEXPIRES = 31536000
- SESSIONSTIMEOUT = 10
- configObj = {
- '/': {
- 'tools.trailing_slash.on': False,
- 'request.methods_with_bodies': ('POST', 'PUT'),
- 'tools.nocache.on': True,
- 'tools.proxy.on': True,
- 'tools.sessions.on': True,
- 'tools.sessions.name': 'wok',
- 'tools.sessions.secure': True,
- 'tools.sessions.httponly': True,
- 'tools.sessions.locking': 'explicit',
- 'tools.sessions.storage_type': 'ram',
- 'tools.sessions.timeout': SESSIONSTIMEOUT,
- 'tools.wokauth.on': False
- },
- '/base64/jquery.base64.js': {
- 'tools.staticfile.on': True,
- 'tools.staticfile.filename': '%s/base64/jquery.base64.js' %
- paths.ui_dir,
- 'tools.nocache.on': True,
- },
- '/wok-ui.html': {
- 'tools.wokauth.on': True
- },
- '/css': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': '%s/ui/css' % paths.prefix,
- 'tools.expires.on': True,
- 'tools.expires.secs': CACHEEXPIRES,
- 'tools.nocache.on': False,
- 'tools.wokauth.on': False
- },
- '/js': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': '%s/ui/js' % paths.prefix,
- 'tools.expires.on': True,
- 'tools.expires.secs': CACHEEXPIRES,
- 'tools.nocache.on': False,
- 'tools.wokauth.on': False
- },
- '/libs': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': '%s/ui/libs' % paths.prefix,
- 'tools.expires.on': True,
- 'tools.expires.secs': CACHEEXPIRES,
- 'tools.nocache.on': False,
- 'tools.wokauth.on': False
- },
- '/images': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': '%s/ui/images' % paths.prefix,
- 'tools.nocache.on': False,
- 'tools.wokauth.on': False
- },
- '/favicon.ico': {
- 'tools.staticfile.on': True,
- 'tools.staticfile.filename':
- '%s/images/logo.ico' % paths.ui_dir
- },
- '/robots.txt': {
- 'tools.staticfile.on': True,
- 'tools.staticfile.filename': '%s/robots.txt' % paths.ui_dir
- },
- }
-
- wok_config = WokConfig()
- self.assertEquals(wok_config, configObj)
+ prefix = paths.prefix
+ self.assertEquals(paths.conf_dir, '%s/src/wok/plugins/kimchi' % prefix)
+ self.assertEquals(paths.conf_file,
+ '%s/src/wok/plugins/kimchi/kimchi.conf' % prefix)
+ self.assertEquals(paths.src_dir, '%s/src/wok/plugins/kimchi' % prefix)
+ self.assertEquals(paths.ui_dir,
+ '%s/src/wok/plugins/kimchi/ui' % prefix)
+ self.assertEquals(paths.mo_dir,
+ '%s/src/wok/plugins/kimchi/mo' % prefix)
def test_kimchi_config(self):
KimchiPaths.get_prefix = PluginPaths.get_prefix = get_prefix
paths = KimchiPaths()
pluginPrefix = paths.add_prefix(paths.plugin_dir)
- CACHEEXPIRES = 31536000
- SESSIONSTIMEOUT = 10
configObj = {
'wok': {
+ 'plugin_class': 'KimchiRoot',
'enable': True,
- 'plugin_class': "KimchiRoot",
- 'uri': '/%s' % paths.plugin_dir,
- 'extra_auth_api_class': "control.sub_nodes"
+ 'uri': '/plugins/kimchi',
+ 'extra_auth_api_class': 'control.sub_nodes'
},
'/': {
'tools.trailing_slash.on': False,
@@ -191,79 +97,73 @@ class ConfigTests(unittest.TestCase):
'tools.wokauth.on': True
},
'/novnc': {
- 'tools.staticdir.on': True,
+ 'tools.wokauth.on': True,
+ 'tools.nocache.on': True,
'tools.staticdir.dir': paths.novnc_dir,
+ 'tools.staticdir.on': True
+ },
+ '/spice-html5': {
+ 'tools.wokauth.on': True,
'tools.nocache.on': True,
- 'tools.wokauth.on': True
+ 'tools.staticdir.dir': paths.spice_dir,
+ 'tools.staticdir.on': True
},
'/spice_auto.html': {
+ 'tools.wokauth.on': True,
+ 'tools.nocache.on': True,
'tools.staticfile.on': True,
'tools.staticfile.filename': paths.spice_file,
- 'tools.nocache.on': True,
- 'tools.wokauth.on': True
- },
- '/spice-html5': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': paths.spice_dir,
- 'tools.nocache.on': True
},
'/spice-html5/spice.css': {
- 'tools.staticfile.on': True,
- 'tools.staticfile.filename': paths.spice_css_file,
+ 'tools.wokauth.on': True,
'tools.nocache.on': True,
- },
- '/ui/config/tab-ext.xml': {
'tools.staticfile.on': True,
- 'tools.staticfile.filename': '%s/ui/config/tab-ext.xml' %
- pluginPrefix,
- 'tools.nocache.on': True
+ 'tools.staticfile.filename': paths.spice_css_file,
},
- '/css': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': '%s/ui/css' % pluginPrefix,
- 'tools.expires.on': True,
- 'tools.expires.secs': CACHEEXPIRES,
- 'tools.nocache.on': False,
- 'tools.wokauth.on': False
+ '/help': {
+ 'tools.nocache.on': True,
+ 'tools.staticdir.dir': '%s/ui/pages/help' % pluginPrefix,
+ 'tools.staticdir.on': True
},
'/js': {
- 'tools.staticdir.on': True,
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
'tools.staticdir.dir': '%s/ui/js' % pluginPrefix,
'tools.expires.on': True,
'tools.expires.secs': CACHEEXPIRES,
- 'tools.nocache.on': False,
- 'tools.wokauth.on': False
+ 'tools.staticdir.on': True
},
- '/libs': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': '%s/ui/libs' % pluginPrefix,
+ '/css': {
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
+ 'tools.staticdir.dir': '%s/ui/css' % pluginPrefix,
'tools.expires.on': True,
'tools.expires.secs': CACHEEXPIRES,
- 'tools.nocache.on': False,
- 'tools.wokauth.on': False,
+ 'tools.staticdir.on': True
},
'/images': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': '%s/ui/images' % pluginPrefix,
+ 'tools.wokauth.on': False,
'tools.nocache.on': False,
- 'tools.wokauth.on': False
+ 'tools.staticdir.dir': '%s/ui/images' % pluginPrefix,
+ 'tools.staticdir.on': True
},
'/data/screenshots': {
- 'tools.staticdir.on': True,
+ 'tools.nocache.on': False,
'tools.staticdir.dir': get_screenshot_path(),
- 'tools.nocache.on': False
+ 'tools.staticdir.on': True
+ },
+ '/ui/config/tab-ext.xml': {
+ 'tools.nocache.on': True,
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename': '%s/ui/config/tab-ext.xml' %
+ pluginPrefix,
},
'/data/debugreports': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': get_debugreports_path(),
- 'tools.nocache.on': False,
'tools.wokauth.on': True,
- 'tools.staticdir.content_types': {'xz': 'application/x-xz'}
- },
- '/help': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': '%s/ui/pages/help' % pluginPrefix,
- 'tools.nocache.on': True
+ 'tools.nocache.on': False,
+ 'tools.staticdir.dir': get_debugreports_path(),
+ 'tools.staticdir.content_types': {'xz': 'application/x-xz'},
+ 'tools.staticdir.on': True
}
}
diff --git a/tests/test_config.py.in b/tests/test_config.py.in
index b4b46e1..d1a8576 100644
--- a/tests/test_config.py.in
+++ b/tests/test_config.py.in
@@ -19,7 +19,7 @@
import unittest
-from wok.config import Paths, WokConfig
+from wok.config import CACHEEXPIRES, Paths, WokConfig
get_prefix = None
@@ -94,14 +94,121 @@ class ConfigTests(unittest.TestCase):
},
'/favicon.ico': {
'tools.staticfile.on': True,
- 'tools.staticfile.filename':
- '%s/images/logo.ico' % paths.ui_dir
+ 'tools.staticfile.filename': '%s/images/logo.ico' %
+ paths.ui_dir
},
'/robots.txt': {
'tools.staticfile.on': True,
'tools.staticfile.filename': '%s/robots.txt' % paths.ui_dir
},
+ '/libs': {
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
+ 'tools.staticdir.dir': '%s/ui/libs' % paths.prefix,
+ 'tools.expires.on': True,
+ 'tools.expires.secs': CACHEEXPIRES,
+ 'tools.staticdir.on': True
+ },
+ '/css': {
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
+ 'tools.staticdir.dir': '%s/ui/css' % paths.prefix,
+ 'tools.expires.on': True,
+ 'tools.expires.secs': CACHEEXPIRES,
+ 'tools.staticdir.on': True
+ },
+ '/js': {
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
+ 'tools.staticdir.dir': '%s/ui/js' % paths.prefix,
+ 'tools.expires.on': True,
+ 'tools.expires.secs': CACHEEXPIRES,
+ 'tools.staticdir.on': True
+ },
+ '/images': {
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
+ 'tools.staticdir.dir': '%s/ui/images' % paths.prefix,
+ 'tools.staticdir.on': True
+ },
+ '/fonts/fontawesome-webfont.ttf': {
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename':
+ '%s/fontawesome-webfont.ttf' % paths.fontawesome_dir
+ },
+ '/fonts/OpenSans-LightItalic.ttf': {
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename':
+ '%s/OpenSans-LightItalic.ttf' % paths.opensans_dir
+ },
+ '/fonts/OpenSans-Bold.ttf': {
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename':
+ '%s/OpenSans-Bold.ttf' % paths.opensans_dir
+ },
+ '/fonts/OpenSans-Italic.ttf': {
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename':
+ '%s/OpenSans-Italic.ttf' % paths.opensans_dir
+ },
+ '/fonts/OpenSans-Semibold.ttf': {
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename':
+ '%s/OpenSans-Semibold.ttf' % paths.opensans_dir
+ },
+ '/fonts/OpenSans-Light.ttf': {
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename':
+ '%s/OpenSans-Light.ttf' % paths.opensans_dir
+ },
+ '/fonts/OpenSans-SemiboldItalic.ttf': {
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename':
+ '%s/OpenSans-SemiboldItalic.ttf' % paths.opensans_dir
+ },
+ '/fonts/OpenSans-ExtraBold.ttf': {
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename':
+ '%s/OpenSans-ExtraBold.ttf' % paths.opensans_dir
+ },
+ '/fonts/OpenSans-BoldItalic.ttf': {
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename':
+ '%s/OpenSans-BoldItalic.ttf' % paths.opensans_dir
+ },
+ '/fonts/OpenSans-ExtraBoldItalic.ttf': {
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename':
+ '%s/OpenSans-ExtraBoldItalic.ttf' % paths.opensans_dir
+ },
+ '/fonts/OpenSans-Regular.ttf': {
+ 'tools.wokauth.on': False,
+ 'tools.nocache.on': False,
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename':
+ '%s/OpenSans-Regular.ttf' % paths.opensans_dir
+ }
}
- wok_config = WokConfig.wok_config
+ wok_config = WokConfig()
self.assertEquals(wok_config, configObj)
--
2.1.0
9 years, 2 months
[PATCH] Issue #740: Solving UI dependencies checking.
by pvital@linux.vnet.ibm.com
From: Paulo Vital <pvital(a)linux.vnet.ibm.com>
Commit 9fbb105 added pip commands on Makefile to install some Python modules
during the UI compilation. However, the compilation step of the UI files is
executed before the block where the commands were added, resulting in
compilation fail if the system doesn't have the modules installed. In addition,
pip commands need to be executed as root and, as good practice, the compilation
should be executed as normal user.
Removing from Makefile the pip commands to instal the Python modules and adding
checks in configure.ac to see if they are installed. Also, edit the README.md
to explain how to install the modules as dependencies to build Wok.
Signed-off-by: Paulo Vital <pvital(a)linux.vnet.ibm.com>
---
Makefile.am | 2 --
configure.ac | 7 +++++++
docs/README.md | 6 ++++++
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 8d2f346..3d3b5d6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -65,8 +65,6 @@ all-local:
$(MKDIR_P) $$dir ; \
ln -sf ../../../po/$$L.gmo $$dir/wok.mo ; \
done < po/LINGUAS
- pip install cython --no-input
- pip install libsass --no-input --upgrade
#
# Packaging helpers
diff --git a/configure.ac b/configure.ac
index a3a0fc2..dd3955e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,6 +38,7 @@ AM_INIT_AUTOMAKE([-Wno-portability])
AM_PATH_PYTHON([2.6])
AC_PATH_PROG([PEP8], [pep8], [/usr/bin/pep8])
AC_PYTHON_MODULE([unittest])
+AC_PYTHON_MODULE([cython], [fatal])
AC_SUBST([HAVE_PYMOD_UNITTEST])
AC_SUBST([PYTHON_VERSION])
AM_GNU_GETTEXT([external])
@@ -50,6 +51,12 @@ if test "x$PYFLAKES" = "x"; then
AC_MSG_WARN([pyflakes not found])
fi
+# Checking for libsass
+AC_PATH_PROG([LIBSASS], [sassc])
+if test "x$LIBSASS" = "x"; then
+ AC_MSG_ERROR([sassc not found. Please execute "pip install libsass"])
+fi
+
AC_ARG_ENABLE(
[sample],
[AS_HELP_STRING(
diff --git a/docs/README.md b/docs/README.md
index 650ab83..c6c5601 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -55,6 +55,8 @@ Install Dependencies
python-psutil python-ldap python-lxml \
libxslt nginx openssl python-dev python-pip
+ $ sudo pip install cython libsass
+
# If using RHEL, install the following additional packages:
$ sudo yum install python-unittest2 python-ordereddict
@@ -81,6 +83,8 @@ channel at RHN Classic or Red Hat Satellite.
python-psutil python-ldap python-lxml nginx \
libxslt openssl python-dev python-pip
+ $ sudo pip install cython libsass
+
Packages version requirement:
python-jsonschema >= 1.3.0
python-psutil >= 0.6.0
@@ -97,6 +101,8 @@ channel at RHN Classic or Red Hat Satellite.
libxslt-tools python-xml nginx openssl python-dev \
python-pip
+ $ sudo pip install cython libsass
+
Packages version requirement:
python-psutil >= 0.6.0
--
2.4.3
9 years, 2 months
[PATCH] Fix opensuse OBS Build Error in the initd file
by LiHaSo
Signed-off-by: LiHaSo <rene.linder(a)lihaso.ch>
---
contrib/kimchid.sysvinit | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/kimchid.sysvinit b/contrib/kimchid.sysvinit
index 023b34c..9b8eeb3 100644
--- a/contrib/kimchid.sysvinit
+++ b/contrib/kimchid.sysvinit
@@ -23,7 +23,7 @@
### BEGIN INIT INFO
# Provides: kimchid
# Required-Start: libvirtd
-# Required-Stop:
+# Required-Stop: libvirtd
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start the kimchid daemon
--
2.6.0
9 years, 2 months
UI Change Request - Navigation
by Jan Schneider
Hello Aline,
I refer to the latest version of the
User Interface Design Specification - Kimchi, 2014-12-23 (aka UI Design
Spec)
which defines the following structure of functionalities:
*Host* (second level navigation via panel areas)
Performance (System Statistics)
Basic Information
Repositories
Debug Report
Software Updates
*Guests*
no second level functionalities
*Templates*
no second level functionalities
*Storage*
no second level functionalities
*Networks*
no second level functionalities
*Administration* (second level navigation via collapse/expand)
Firmware Update
SEP Configuration
Power Options
Configuration Backup
Network Configuration
SAN Adapters
Sensor Monitor
*Problem Statement*
We already decided to move all Administration functionalities to Host
(currently not updated in the UI Design Spec).
We are currently facing the following problems:
1) Host now contains 12 second level functionalities, all other (Guests,
Templates, ...) none.
We need to introduce a second level navigation for Host other than
collapse/expand
2) The navigation bar elements Storage and Network (refering to
Virtualization) also exist in the Host context.
This might confuse the user.
*Proposal*
The described problems can be solved with the following changes:
1) Introducing a second level navigation
2) Changing the structure of functionalities as follows:
*Host*
Performance (System Statistics)
Basic Information
Repositories
Debug Report
Software Updates
Firmware Update
SEP Configuration
Power Options
Configuration Backup
Network Configuration
SAN Adapters
Sensor Monitor
*Virtualization*
Guests
Templates
Storage
Networks
*Containers (future extension)*
to be defined
Let's start a discussion on this.
Kind regards
Jan
9 years, 2 months
[WOK RFC] Update objectstore information while migrating to new structure.
by Paulo Ricardo Paz Vital
Hello guys.
Doing some tests in the new Wok and Kimchi (as plugin) code I
discovered something that can cause some issues for us. Let'me show a
possible user case to explain better:
The user uses some version of the current Kimchi (previous of 1.5.1 and
called for now as, Kimchi_old) totally functional and operating. The
user has a few templates created, which are stored in the the
objectstore function of Kimchi, and for each template has the
storagepool URI allocated for that template.
The storagepool information has the following properties in Kimchi-old:
"storagepool": {
"description": "Location of the storage pool",
"type": "string",
"pattern": "^/storagepools/[^/]+/?$",
"error": "KCHTMPL0015E"
}
However, the new Wok+Kimchi_plugin structure changed the URI for all
virtualization features and the pattern now is:
"^/plugins/kimchi/storagepools/[^/]+/?$"
There's an issue when getting the information of all Kimchi-old
templates from the objectstore, the URI information continues with the
older pattern and some checks in the code will fail.
My suggestion is to create an info-update process when the user upgrade
from Kimchi-old to Wok+Kimchi_plugin, modifying the storagepool
information of all templates that not follow the new pattern in the
database already created.
I'd like to know what do you guys think about and ask for more
suggestions also.
Best regards,
--
Paulo Ricardo Paz Vital <pvital(a)linux.vnet.ibm.com>
IBM Linux Technology Center
9 years, 2 months
[PATCH] Fix test cases on test_authorization.py
by Aline Manera
Some test cases were failing due the changes with Wok and Kimchi as a
plugin.
The task API is part of Wok framework and the tests were updated
accordingly.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/wok/plugins/kimchi/tests/test_authorization.py | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/wok/plugins/kimchi/tests/test_authorization.py b/src/wok/plugins/kimchi/tests/test_authorization.py
index 87d68ab..7134311 100644
--- a/src/wok/plugins/kimchi/tests/test_authorization.py
+++ b/src/wok/plugins/kimchi/tests/test_authorization.py
@@ -22,6 +22,7 @@ import os
import unittest
from functools import partial
+from wok.model.model import Model
from wok.plugins.kimchi import mockmodel
from iso_gen import construct_fake_iso
@@ -31,6 +32,7 @@ from utils import run_server, wait_task
test_server = None
model = None
+wok_model = None
host = None
port = None
ssl_port = None
@@ -38,10 +40,12 @@ fake_iso = '/tmp/fake.iso'
def setUpModule():
- global test_server, model, host, port, ssl_port
+ global test_server, model, wok_model, host, port, ssl_port
patch_auth(sudo=False)
model = mockmodel.MockModel('/tmp/obj-store-test')
+ wok_model = Model('/tmp/obj-store-test')
+
host = '127.0.0.1'
port = get_free_port('http')
ssl_port = get_free_port('https')
@@ -125,7 +129,7 @@ class AuthorizationTests(unittest.TestCase):
'name': u'test-me',
'template': '/plugins/kimchi/templates/test'
})
- wait_task(model.task_lookup, task_info['id'])
+ wait_task(wok_model.task_lookup, task_info['id'])
model.vm_update(u'test-me',
{'users': [mockmodel.fake_user.keys()[0]],
@@ -135,7 +139,7 @@ class AuthorizationTests(unittest.TestCase):
'name': u'test-usera',
'template': '/plugins/kimchi/templates/test'
})
- wait_task(model.task_lookup, task_info['id'])
+ wait_task(wok_model.task_lookup, task_info['id'])
non_root = list(set(model.users_get_list()) - set(['root']))[0]
model.vm_update(u'test-usera', {'users': [non_root], 'groups': []})
@@ -144,7 +148,7 @@ class AuthorizationTests(unittest.TestCase):
'name': u'test-groupa',
'template': '/plugins/kimchi/templates/test'
})
- wait_task(model.task_lookup, task_info['id'])
+ wait_task(wok_model.task_lookup, task_info['id'])
a_group = model.groups_get_list()[0]
model.vm_update(u'test-groupa', {'groups': [a_group]})
@@ -161,7 +165,7 @@ class AuthorizationTests(unittest.TestCase):
'name': 'kimchi-test',
'template': '/plugins/kimchi/templates/test'
})
- wait_task(model.task_lookup, task_info['id'])
+ wait_task(wok_model.task_lookup, task_info['id'])
resp = self.request('/plugins/kimchi/vms/kimchi-test', '{}', 'PUT')
self.assertEquals(403, resp.status)
resp = self.request('/plugins/kimchi/vms/kimchi-test', '{}', 'DELETE')
--
2.1.0
9 years, 2 months
[PATCH 2/2] Issue #737 : fix to remove multiple calls for resource lookup
by archus@linux.vnet.ibm.com
From: Archana Singh <archus(a)linux.vnet.ibm.com>
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
src/wok/control/base.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wok/control/base.py b/src/wok/control/base.py
index 5c5c95f..912ed16 100644
--- a/src/wok/control/base.py
+++ b/src/wok/control/base.py
@@ -163,7 +163,7 @@ class Resource(object):
self.role_key, self.admin_methods)
try:
- self.lookup()
+ self.info = {}
if not self.is_authorized():
raise UnauthorizedError('WOKAPI0009E')
--
2.1.0
9 years, 2 months
[PATCH 2/2] Issue #737: fix to remove multiple calls of resource lookup in GET
by archus@linux.vnet.ibm.com
From: Archana Singh <archus(a)linux.vnet.ibm.com>
Incase of GET lookup was called twice.Once lookup() before is_authorized() and then in self.get(). This added overhead to system when lookup() is called for each value in list from get_list() of Collection. So to avoid this overhead, lookup() should not be called before self.get(). And hence it make sense to call lookup() from get(), update(), delete() separately. And as is_authorized() used self.info, which is currently being intialized in exception section of lookup(). It make more sense to intialize it in __init__.
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
src/wok/control/base.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/wok/control/base.py b/src/wok/control/base.py
index 5c5c95f..4a4220f 100644
--- a/src/wok/control/base.py
+++ b/src/wok/control/base.py
@@ -58,6 +58,7 @@ class Resource(object):
self.model_args = (ident,)
self.role_key = None
self.admin_methods = []
+ self.info = {}
def _redirect(self, action_result, code=303):
if isinstance(action_result, list):
@@ -145,6 +146,7 @@ class Resource(object):
def delete(self):
try:
+ self.lookup()
fn = getattr(self.model, model_fn(self, 'delete'))
fn(*self.model_args)
cherrypy.response.status = 204
@@ -163,7 +165,6 @@ class Resource(object):
self.role_key, self.admin_methods)
try:
- self.lookup()
if not self.is_authorized():
raise UnauthorizedError('WOKAPI0009E')
@@ -198,6 +199,7 @@ class Resource(object):
def update(self, *args, **kargs):
try:
+ self.lookup()
update = getattr(self.model, model_fn(self, 'update'))
except AttributeError:
e = InvalidOperation('WOKAPI0003E', {'resource':
--
2.1.0
9 years, 2 months
[PATCH 0/1] Fixed kimchi.hosts.js dashboard for the new-ui
by sguimaraes943@gmail.com
From: samhenri <samuel.guimaraes(a)eldorado.org.br>
This patch fixes debug reports that weren't showing in Kimchi Hosts. It also orders Disk I/O and Network I/O dashboards series so we can see all the polylines (stripped vertical line pattern is only created for the first series in the charts).
This patch also includes the images for the storage pools that will be updated with the new-ui in the next patch.
Regards,
Samuel
samhenri (1):
Fixed kimchi.hosts.js dashboard graphs and added Storage pool images
src/wok/plugins/kimchi/ui/js/src/kimchi.host.js | 518 ++++++++++++------------
ui/images/theme-default/high.png | Bin 0 -> 812 bytes
ui/images/theme-default/low.png | Bin 0 -> 813 bytes
ui/images/theme-default/med.png | Bin 0 -> 873 bytes
4 files changed, 250 insertions(+), 268 deletions(-)
create mode 100644 ui/images/theme-default/high.png
create mode 100644 ui/images/theme-default/low.png
create mode 100644 ui/images/theme-default/med.png
--
1.9.3
9 years, 2 months