[PATCH V3] [Kimchi 0/3] Fix VM name conflicts with snapshot reverts
by Lucio Correia
Changes in V3:
* Use ASCII name in XML
* Fix tests
Lucio Correia (3):
Always update snapshot XML with new name and UUID
Use ASCII name in XML
Update tests to reflect new behavior
mockmodel.py | 7 +++++++
model/vms.py | 14 ++++++++++++--
tests/test_model.py | 41 ++++++++++++++++++++---------------------
3 files changed, 39 insertions(+), 23 deletions(-)
--
1.9.1
8 years, 5 months
[PATCH V2] [Wok 0/3] User Request Log improvements
by Lucio Correia
Changes in V2:
* updated logs.md
* added test cases
IMPORTANT: test will fail if old log entries are present in the system.
Lucio Correia (3):
Include user IP address in request log messages
Log time in ISO format
Add test cases for user logs
docs/API/logs.md | 1 +
src/wok/control/base.py | 10 ++++++----
src/wok/reqlogger.py | 32 ++++++++++++++++++++++++--------
src/wok/root.py | 6 ++++--
tests/test_api.py | 34 ++++++++++++++++++++++++++++++++++
5 files changed, 69 insertions(+), 14 deletions(-)
--
1.9.1
8 years, 5 months
[PATCH] [Wok] Fix for filter break for numbers formatted for locale fr-FR
by pkulkark@linux.vnet.ibm.com
From: Pooja Kulkarni <pkulkark(a)linux.vnet.ibm.com>
This patch fixes the filter breaking
issue on numbers formatted as per
fr-FR locale, by replacing the
non-breaking spaces introduced by
the formatting, with breaking spaces.
Signed-off-by: Pooja Kulkarni <pkulkark(a)linux.vnet.ibm.com>
---
ui/js/src/wok.utils.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/ui/js/src/wok.utils.js b/ui/js/src/wok.utils.js
index 1fb3c9b..76477fd 100644
--- a/ui/js/src/wok.utils.js
+++ b/ui/js/src/wok.utils.js
@@ -263,7 +263,11 @@ wok.localeConverters = {
},
"number-locale-converter":{
to: function(number){
- return wok.numberLocaleConverter(number, wok.lang.get_locale());
+ if (number == null) {
+ return 'Unknown';
+ }
+ format_value = wok.numberLocaleConverter(number, wok.lang.get_locale());
+ return format_value.toString().replace(/\s/g,' '); //replace non-breaking space with breaking space
}
}
}
--
2.1.0
8 years, 5 months
Re: [Kimchi-devel] [PATCH] [Wok 2/2] Log time in ISO format
by Aline Manera
The same I commented on patch 1.
Update the API.md as this patch also changed the API and add/change the
test cases to confirm it keeps working.
On 06/03/2016 06:40 PM, Lucio Correia wrote:
> Signed-off-by: Lucio Correia <luciojhc(a)linux.vnet.ibm.com>
> ---
> src/wok/reqlogger.py | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/src/wok/reqlogger.py b/src/wok/reqlogger.py
> index 2ec62b8..6f32c44 100644
> --- a/src/wok/reqlogger.py
> +++ b/src/wok/reqlogger.py
> @@ -23,9 +23,9 @@ import json
> import logging
> import logging.handlers
> import os.path
> +import time
>
> from cherrypy.process.plugins import BackgroundTask
> -from datetime import datetime
> from tempfile import NamedTemporaryFile
>
> from wok.config import config, get_log_download_path
> @@ -37,11 +37,12 @@ from wok.utils import ascii_dict, remove_old_files
> FILTER_FIELDS = ['app', 'date', 'download', 'ip', 'req', 'user', 'time']
> LOG_DOWNLOAD_URI = "/data/logs/%s"
> LOG_DOWNLOAD_TIMEOUT = 6
> -LOG_FORMAT = "[%(date)s %(time)s] %(req)-6s %(app)-11s %(ip)-15s %(user)s: " \
> - "%(message)s\n"
> +LOG_FORMAT = "[%(date)s %(time)s %(zone)s] %(req)-6s %(app)-11s %(ip)-15s " \
> + "%(user)s: %(message)s\n"
> RECORD_TEMPLATE_DICT = {
> 'date': '',
> 'time': '',
> + 'zone': '',
> 'req': '',
> 'app': '',
> 'ip': '',
> @@ -49,6 +50,9 @@ RECORD_TEMPLATE_DICT = {
> 'message': '',
> }
> SECONDS_PER_HOUR = 360
> +TS_DATE_FORMAT = "%Y-%m-%d"
> +TS_TIME_FORMAT = "%H:%M:%S"
> +TS_ZONE_FORMAT = "%Z"
>
> # Log handler setup
> REQUEST_LOG_FILE = "wok-req.log"
> @@ -180,10 +184,11 @@ class RequestRecord(object):
> self.message = message
> self.kwargs = kwargs
>
> - # register timestamp
> - timestamp = datetime.today()
> - self.kwargs['date'] = timestamp.strftime('%Y-%m-%d')
> - self.kwargs['time'] = timestamp.strftime('%H:%M:%S')
> + # register timestamp in local time
> + timestamp = time.localtime()
> + self.kwargs['date'] = time.strftime(TS_DATE_FORMAT, timestamp)
> + self.kwargs['time'] = time.strftime(TS_TIME_FORMAT, timestamp)
> + self.kwargs['zone'] = time.strftime(TS_ZONE_FORMAT, timestamp)
>
> def __str__(self):
> info = json.JSONEncoder().encode(self.kwargs)
8 years, 5 months
Re: [Kimchi-devel] [PATCH] [Wok] Fix for filter break for numbers formatted for locale fr-FR
by Pooja Kulkarni
Hi Aline,
Can this patch be merged?
On 05/30/2016 05:37 PM, Archana Singh wrote:
> Reviewed-By: Archana Singh <archus(a)linux.vent.ibm.com>
>
> On 5/26/2016 1:49 PM, pkulkark(a)linux.vnet.ibm.com wrote:
>> From: Pooja Kulkarni <pkulkark(a)linux.vnet.ibm.com>
>>
>> This patch fixes the filter breaking
>> issue on numbers formatted as per
>> fr-FR locale, by replacing the
>> non-breaking spaces introduced by
>> the formatting, with breaking spaces.
>>
>> Signed-off-by: Pooja Kulkarni <pkulkark(a)linux.vnet.ibm.com>
>> ---
>> ui/js/src/wok.utils.js | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/ui/js/src/wok.utils.js b/ui/js/src/wok.utils.js
>> index 1fb3c9b..76477fd 100644
>> --- a/ui/js/src/wok.utils.js
>> +++ b/ui/js/src/wok.utils.js
>> @@ -263,7 +263,11 @@ wok.localeConverters = {
>> },
>> "number-locale-converter":{
>> to: function(number){
>> - return wok.numberLocaleConverter(number,
>> wok.lang.get_locale());
>> + if (number == null) {
>> + return 'Unknown';
>> + }
>> + format_value = wok.numberLocaleConverter(number,
>> wok.lang.get_locale());
>> + return format_value.toString().replace(/\s/g,' ');
>> //replace non-breaking space with breaking space
>> }
>> }
>> }
>
8 years, 5 months
[PATCH][Wok] Issue #118: logrotate fails
by Ramon Medeiros
Create file only when server is started
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
Makefile.am | 2 --
contrib/Makefile.am | 1 -
contrib/wok.spec.fedora.in | 1 -
contrib/wok.spec.suse.in | 1 -
contrib/wokd.logrotate.in | 9 ---------
src/wok/server.py | 16 +++++++++++-----
6 files changed, 11 insertions(+), 19 deletions(-)
delete mode 100644 contrib/wokd.logrotate.in
diff --git a/Makefile.am b/Makefile.am
index 325d0c9..ac07e97 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -155,7 +155,6 @@ install-data-local:
$(INSTALL_DATA) src/dhparams.pem $(DESTDIR)/etc/wok/dhparams.pem
touch $(DESTDIR)/etc/nginx/conf.d/wok.conf
mkdir -p $(DESTDIR)/etc/logrotate.d/
- $(INSTALL_DATA) $(top_srcdir)/contrib/wokd.logrotate.in $(DESTDIR)/etc/logrotate.d/wokd.in
touch $(DESTDIR)/etc/logrotate.d/wokd
uninstall-local:
@@ -172,7 +171,6 @@ uninstall-local:
$(RM) -rf $(DESTDIR)/$(localstatedir)/log/wok
$(RM) -rf $(DESTDIR)/etc/wok
$(RM) $(DESTDIR)/etc/nginx/conf.d/wok.conf
- $(RM) $(DESTDIR)/etc/logrotate.d/wokd.in
$(RM) $(DESTDIR)/etc/logrotate.d/wokd
VERSION:
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index a82ba30..32fcfde 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -29,7 +29,6 @@ EXTRA_DIST = \
wokd-upstart.conf.debian \
wokd-upstart.conf.fedora \
make-deb.sh.in \
- wokd.logrotate.in \
$(NULL)
make-deb.sh: make-deb.sh.in $(top_builddir)/config.status
diff --git a/contrib/wok.spec.fedora.in b/contrib/wok.spec.fedora.in
index 7715e7f..fdf3484 100644
--- a/contrib/wok.spec.fedora.in
+++ b/contrib/wok.spec.fedora.in
@@ -117,7 +117,6 @@ rm -rf $RPM_BUILD_ROOT
%{_sysconfdir}/nginx/conf.d/wok.conf.in
%{_sysconfdir}/wok/wok.conf
%{_sysconfdir}/wok/
-%{_sysconfdir}/logrotate.d/wokd.in
%{_sysconfdir}/logrotate.d/wokd
%{_mandir}/man8/wokd.8.gz
diff --git a/contrib/wok.spec.suse.in b/contrib/wok.spec.suse.in
index 3d39483..70c295b 100644
--- a/contrib/wok.spec.suse.in
+++ b/contrib/wok.spec.suse.in
@@ -95,7 +95,6 @@ rm -rf $RPM_BUILD_ROOT
%{_sysconfdir}/wok/
%{_sysconfdir}/nginx/conf.d/wok.conf.in
%{_sysconfdir}/nginx/conf.d/wok.conf
-%{_sysconfdir}/logrotate.d/wokd.in
%{_sysconfdir}/logrotate.d/wokd
%{_var}/lib/wok/
%{_localstatedir}/log/wok/*
diff --git a/contrib/wokd.logrotate.in b/contrib/wokd.logrotate.in
deleted file mode 100644
index 8771d09..0000000
--- a/contrib/wokd.logrotate.in
+++ /dev/null
@@ -1,9 +0,0 @@
-${log_dir}/*log {
- daily
- nomail
- maxsize 10M
- rotate 10
- nomissingok
- compress
-}
-
diff --git a/src/wok/server.py b/src/wok/server.py
index 902d4bf..6909b16 100644
--- a/src/wok/server.py
+++ b/src/wok/server.py
@@ -45,6 +45,16 @@ LOGGING_LEVEL = {"debug": logging.DEBUG,
"warning": logging.WARNING,
"error": logging.ERROR,
"critical": logging.CRITICAL}
+LOGROTATE_TEMPLATE = """
+${log_dir}/*log {
+ daily
+ nomail
+ maxsize 10M
+ rotate 10
+ nomissingok
+ compress
+}
+"""
def set_no_cache():
@@ -141,11 +151,7 @@ class Server(object):
if paths.installed:
# redefine logrotate configuration according to wok.conf
- logrotate_file = os.path.join(paths.logrotate_dir, "wokd.in")
- with open(logrotate_file) as template:
- data = template.read()
-
- data = Template(data)
+ data = Template(LOGROTATE_TEMPLATE)
data = data.safe_substitute(log_dir=configParser.get("logging",
"log_dir"))
--
2.5.5
8 years, 5 months
[PATCH][Wok] Improve UI error codes checking
by Ramon Medeiros
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
check_ui_code_errors.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/check_ui_code_errors.sh b/check_ui_code_errors.sh
index 4d9a8bd..32353b5 100755
--- a/check_ui_code_errors.sh
+++ b/check_ui_code_errors.sh
@@ -20,7 +20,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
errors="$(cat ui/pages/i18n.json.tmpl | grep -o 'WOK[0-9A-Z]*'| sort)"
-uiErrors="$(grep -Ro 'WOK[0-9A-Z]*' ui/js/ | cut -d: -f2 | sort| uniq)"
+uiErrors="$(grep -ERo 'WOK[A-Z]{3,6}[0-9A-Z]*' ui/js/ | cut -d: -f2 | sort| uniq)"
# all errors on i18n are present in js/html files: success
if [ "$errors" == "$uiErrors" ]; then
--
2.5.5
8 years, 5 months
[PATCH v2][Kimchi 0/6] Make Kimchi able to change guest's boot order
by Ramon Medeiros
Changes:
v2:
Do not manipulate xml on model
Improve parameters checking at API.json
Increase test cases
*** BLURB HERE ***
Ramon Medeiros (6):
Add function get_bootorder_node
Create method to change bootorder of a guest
Update documentation about bootorder on vm update
Update REST API
Add function to retrieve bootorder on vm lookup
Add test to check bootorder
API.json | 23 +++++++++++++++++++++++
docs/API.md | 1 +
i18n.py | 1 +
model/vms.py | 32 ++++++++++++++++++++++++++++++--
tests/test_model.py | 13 +++++++++++++
xmlutils/bootorder.py | 19 +++++++++++++------
6 files changed, 81 insertions(+), 8 deletions(-)
--
2.5.5
8 years, 5 months
[RFC] Wok widgets as custom HTML elements or UI library
by Samuel Henrique De Oliveira Guimaraes
Hi team,
After the open discussion session on our last scrum meeting regarding Wok as an UI framework / library, I decided to list some alternatives and technologies that we could use on the next releases or Wok 3.*.
The idea is to provide a solution that allowed developers to create panels, tabs or even full plugins with minimal or no knowledge on HTML and CSS or even DOM manipulation with jQuery.
Instead of using default HTML tags, the developer could write something like this for Kimchi network tab for example:
<wok-panel collapse="false" title="Networks">
<wok-datatable filter="network.name, network.interfaces, network.address, network.type" model="kimchi.networks" sort="true" sort-by="network.name" actions="network.actions">
</wok-panel>
<wok-window model="network.add">
...
// Network modal window contents
...
</wok-window>
<wok-window model="network.edit">
...
// Network modal window contents
...
</wok-window>
This might seem too ahead of time but in fact it looks like any current MVV JavaScript framework. So here are the current alternatives with pros and cons:
1 - Custom elements API:
https://developer.mozilla.org/en-US/docs/Web/Web_Components/Custom_Elements
Current support: http://caniuse.com/#search=custom-elements
Status: Draft
Effort: minimal
In my opinion based on current structure this would be the least difficult alternative to adapt current code into a library but browser support is an obstacle.
2 - Google Polymer
https://www.polymer-project.org/1.0/docs/devguide/feature-overview
Current support: https://www.polymer-project.org/1.0/docs/browsers
Status: Stable
Effort: medium
To work like the example above it would require some time to develop and I think it would create something bigger than an UI library, check an example source code and you will see what I mean. For some native components such as form controls it would redundant. It could be developed at the same time we maintain the current code.
3 - AngularJS
https://angularjs.org/
Current support: https://docs.angularjs.org/guide/ie
Status: 1.5.x Stable, 2.0 in development
Effort: medium to high
This would definitively work like the example above and make Wok and all its plugins work like a seamless single page application (no more problems with global variables / tasks when switching tabs from different plugins) but the effort would be medium to high. Legacy code would be incompatible, we would have to drop or move almost everything that we have done with jQuery and rewrite ALL tabs, widgets and API calls and all libraries that we currently use would have to be updated to an AngularJS-like compatible version (or some could go away as Angular provides native mechanisms that we could use). The advantage here is that there's a library that uses Bootstrap SCSS so our UI assets wouldn't discarded and the users wouldn't notice anything. The negative factor is that we would have to rewrite our code to meet "AngularJS way": creating services or factories for the REST calls, directives for the UI and the logic would go to the controllers. It wouldn't make the developers lives any easier, in fact it would require a narrow and specific skillset. For example: to make Wok load plugins, we would have to write a mechanism to lazy load our plugins dynamically based on the files installed in the plugins folder.
We could also benefit from some NodeJS plugins for unit, performance and UI tests, even mock objects when developing new UI when we don't have the exact system environment, not having to worry about messing with host or VM settings.
3 - Facebook React
https://facebook.github.io/react/
Current support: https://facebook.github.io/react/docs/working-with-the-browser.html
Status: Stable
Effort: maximum
We would exchange HTML to JSX and JavaScript. I think based on our project structure it brings the worst points from Google Polymer and AngularJS analysis.
Regards,
Samuel
8 years, 5 months