[PATCH] [Wok] Bug fix: Use WatchedFileHandler instead of RotatingFileHandler for user log files
by Aline Manera
The log files under /var/log/wok are managed by logrotate (check
contrib/wokd.logrotate.in for more details). So use WatchedFileHandler instead
of RotatingFileHandler to avoid issues while accessing the log file.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/wok/reqlogger.py | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/wok/reqlogger.py b/src/wok/reqlogger.py
index 1145dbd..272a753 100644
--- a/src/wok/reqlogger.py
+++ b/src/wok/reqlogger.py
@@ -18,6 +18,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
+import glob
import json
import logging
import logging.handlers
@@ -40,8 +41,6 @@ LOG_FORMAT = "[%(date)s %(time)s] %(req)-6s %(app)-11s %(user)s: %(message)s\n"
SECONDS_PER_HOUR = 360
# Log handler setup
-MAX_FILE_SIZE = 3072000
-NUM_BACKUP_FILES = 1
REQUEST_LOG_FILE = "wok-req.log"
WOK_REQUEST_LOGGER = "wok_request_logger"
@@ -49,9 +48,7 @@ WOK_REQUEST_LOGGER = "wok_request_logger"
class RequestLogger(object):
def __init__(self):
log = os.path.join(config.get("logging", "log_dir"), REQUEST_LOG_FILE)
- h = logging.handlers.RotatingFileHandler(log, 'a',
- maxBytes=MAX_FILE_SIZE,
- backupCount=NUM_BACKUP_FILES)
+ h = logging.handlers.WatchedFileHandler(log, 'a')
h.setFormatter(logging.Formatter('%(message)s'))
self.handler = h
self.logger = logging.getLogger(WOK_REQUEST_LOGGER)
@@ -101,8 +98,7 @@ class RequestParser(object):
def getRecords(self):
records = self.getRecordsFromFile(self.baseFile)
- for count in range(NUM_BACKUP_FILES):
- filename = ".".join([self.baseFile, str(count + 1)])
+ for filename in glob.glob(self.baseFile + "-*[!.gz]"):
records.extend(self.getRecordsFromFile(filename))
# Return ordered by latest events first
--
2.5.5
8 years, 7 months
[WOK] [RFC} Checking Bootstrap 4 compatibility + dropping jQuery Bootgrid
by Samuel Henrique De Oliveira Guimaraes
Hi team,
Last year Twitter announced the new version of Bootstrap. Wok currently uses a customized version of Bootstrap 3 Sass / SCSS files and looking at the Alpha code it seems that porting Wok to the new version won't be difficult:
http://v4-alpha.getbootstrap.com/migration/
-Browser Support: Ok!
-SCSS environment: Ok!
-Dropped glyphicons: Ok! We already use Font-Awesome
- Non-responsive usage of Bootstrap is no longer supported: Ok!
I recognize some classes from this document and I think that a minor drawback would be with the Media Queries that were already implemented throughout the application and some changes with the classes names. Ginger uses a lot of "panel-" classes that were replaced by "cards", the "btn-default" button was renamed to "btn-secondary" and etc.
The major issue is with jQuery Bootgrid plugin. It seems that they're not planning to port to Bootstrap 4 until it gets stable. I think we should port our jQuery Bootgrid code to Datatables.net, since it has a vast documentation and it already supports Bootstrap 4:
https://datatables.net/examples/styling/bootstrap4.html
Any comments?
Samuel
8 years, 7 months
[PATCH][Wok] UI: Remove notification array and make notifications persistent
by Rodrigo Trujillo
There is an issue in frontend that does not allow notification messages
to be showed more than once if the problem happens again.
When user clicks on message close ("X") button, the notification message
is only removed from backend, but not from the UI array.
This patch changes functions to not use the array anymore, instead, it
checks if the message is being displayed by its message code, then shows
if necessary.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
ui/js/src/wok.main.js | 1 -
ui/js/src/wok.utils.js | 8 ++++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/ui/js/src/wok.main.js b/ui/js/src/wok.main.js
index 2146b3d..cf5b6a2 100644
--- a/ui/js/src/wok.main.js
+++ b/ui/js/src/wok.main.js
@@ -19,7 +19,6 @@
*/
wok.NOTIFICATION_INTERVAL = 5000
-wok.postedNotifications = []
wok.tabMode = {};
wok.config = undefined;
diff --git a/ui/js/src/wok.utils.js b/ui/js/src/wok.utils.js
index 1fb3c9b..3759cbe 100644
--- a/ui/js/src/wok.utils.js
+++ b/ui/js/src/wok.utils.js
@@ -209,12 +209,12 @@ wok.notificationsLoop = function notificationsLoop() {
function(notifications){
if(notifications && notifications.length > 0) {
$.each(notifications, function(i, notif) {
- if (wok.postedNotifications.indexOf(notif.message) == -1) {
+ // Check if notification is being displayed
+ if (($("#alert-container").contents().find("div:contains('" + notif.code + "')").length) == 0) {
wok.message.notify(notif, '#message-container-area');
- wok.postedNotifications.push(notif.message);
}
- })
- };
+ });
+ }
setTimeout(notificationsLoop, wok.NOTIFICATION_INTERVAL);
},
function(data){
--
2.1.0
8 years, 7 months
Re: [Kimchi-devel] [PATCH] [Wok] Added extended locale list arranged it in alphabetic order.
by Aline Manera
On 05/23/2016 09:07 AM, archus(a)linux.vnet.ibm.com wrote:
> From: Archana Singh <archus(a)linux.vnet.ibm.com>
>
> Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
> ---
> ui/pages/login.html.tmpl | 194 +++++++++++++++++++++++++++++++++++++++++------
> 1 file changed, 172 insertions(+), 22 deletions(-)
>
> diff --git a/ui/pages/login.html.tmpl b/ui/pages/login.html.tmpl
> index 52b81fd..81b4e7a 100644
> --- a/ui/pages/login.html.tmpl
> +++ b/ui/pages/login.html.tmpl
> @@ -138,28 +138,178 @@
> <div class="form-group">
> <label for="userLocale">$_("Locale")</label>
> <select id="userLocale" class="selectpicker col-md-12 col-lg-12">
> - <option value="af-NA">Afrikaans (Namibia)</option>
> - <option value="ar-DZ">Arabic (Algeria)</option>
> - <option value="az-AZ">Azerbaijani (Azerbaijan)</option>
> - <option value="en-US">English (US)</option>
> - <option value="hy-AM">Armenian (Armenia)</option>
> - <option value="hi-IN">Hindi (India)</option>
> - <option value="nl-BE">Dutch (Belgium)</option>
> - <option value="ms-MY">Malay (Malaysia)</option>
> - <option value="no-NO">Norwegian (Norway)</option>
> - <option value="sq-AL">Albanian (Albania)</option>
> - <option value="sv-SE">Swedish (Sweden)</option>
> - <option value="uz-UZ">Uzbek (Uzbekistan)</option>
> - <option value="zh-CN">中文(简体)</option>
> - <option value="pt-BR">Português (Brasil)</option>
> - <option value="de-DE">Deutsch (Deutschland)</option>
> - <option value="es-ES">Español (España)</option>
> - <option value="fr-FR">Français (France)</option>
> - <option value="it-IT">Italiano (Italia)</option>
> - <option value="ja-JP">日本語 (日本)</option>
> - <option value="ko-KR">한국어 (대한민국)</option>
> - <option value="ru-RU">Русский (Россия)</option>
> - <option value="zh-TW">中文(繁體)</option>
> + <option value="af-ZA">Afrikaans (South Africa)</option>
> + <option value="sq-AL">Albanian (Albania)</option>
> + <option value="am-ET">Amharic (Ethiopia)</option>
> + <option value="ar-DZ">Arabic (Algeria)</option>
> + <option value="ar-BH">Arabic (Bahrain)</option>
> + <option value="ar-EG">Arabic (Egypt)</option>
> + <option value="ar-IQ">Arabic (Iraq)</option>
> + <option value="ar-JO">Arabic (Jordan)</option>
> + <option value="ar-KW">Arabic (Kuwait)</option>
> + <option value="ar-LB">Arabic (Lebanon)</option>
> + <option value="ar-LY">Arabic (Libya)</option>
> + <option value="ar-MR">Arabic (Mauritania)</option>
> + <option value="ar-MA">Arabic (Morocco)</option>
> + <option value="ar-OM">Arabic (Oman)</option>
> + <option value="ar-QA">Arabic (Qatar)</option>
> + <option value="ar-SA">Arabic (Saudi Arabia)</option>
> + <option value="ar-SY">Arabic (Syria)</option>
> + <option value="ar-TN">Arabic (Tunisia)</option>
> + <option value="ar-AE">Arabic (United Arab Emirates)</option>
> + <option value="ar-YE">Arabic (Yemen)</option>
> + <option value="hy-AM">Armenian (Armenia)</option>
> + <option value="as-IN">Assamese (India)</option>
> + <option value="az-AZ">Azerbaijani (Azerbaijan)</option>
> + <option value="eu-ES">Basque (Spain)</option>
> + <option value="be-BY">Belarusian (Belarus)</option>
> + <option value="bn-BD">Bengali (Bangladesh)</option>
> + <option value="bn-IN">Bengali (India)</option>
> + <option value="bs-BA">Bosnian (Bosnia)</option>
> + <option value="bg-BG">Bulgarian (Bulgaria)</option>
> + <option value="my-MM">Burmese (Myanmar)</option>
> + <option value="ca-ES">Catalan (Spain)</option>
> + <option value="zh-CN">Chinese-simplified (China)</option>
> + <option value="zh-SG">Chinese-simplified (Singapore)</option>
> + <option value="zh-HK">Chinese-traditional (Hong Kong S.A.R. of China)</option>
> + <option value="zh-MO">Chinese-traditional (Macao)</option>
> + <option value="zh-TW">Chinese-traditional (Taiwan)</option>
> + <option value="hr-HR">Croatian (Croatia)</option>
> + <option value="cs-CZ">Czech (Czech Republic)</option>
> + <option value="da-DK">Danish (Denmark)</option>
> + <option value="nl-BE">Dutch (Belgium)</option>
> + <option value="nl-NL">Dutch (The Netherlands)</option>
> + <option value="en-AU">English (Australia)</option>
> + <option value="en-BE">English (Belgium)</option>
> + <option value="en-CM">English (Cameroon)</option>
> + <option value="en-CA">English (Canada)</option>
> + <option value="en-GH">English (Ghana)</option>
> + <option value="en-HK">English (Hong Kong S.A.R. of China)</option>
> + <option value="en-IN">English (India)</option>
> + <option value="en-IE">English (Ireland)</option>
> + <option value="en-KE">English (Kenya)</option>
> + <option value="en-MU">English (Mauritius)</option>
> + <option value="en-NZ">English (New Zealand)</option>
> + <option value="en-NG">English (Nigeria)</option>
> + <option value="en-PH">English (Philippines)</option>
> + <option value="en-SG">English (Singapore)</option>
> + <option value="en-ZA">English (South Africa)</option>
> + <option value="en-TZ">English (Tanzania)</option>
> + <option value="en-GB">English (United Kingdom)</option>
> + <option value="en-US">English (United States)</option>
> + <option value="en-ZM">English (Zambia)</option>
> + <option value="et-EE">Estonian (Estonia)</option>
> + <option value="tl-PH">Filipino (Philippines)</option>
> + <option value="fi-FI">Finnish (Finland)</option>
> + <option value="fr-DZ">French (Algeria)</option>
> + <option value="fr-CM">French (Cameroon)</option>
> + <option value="fr-CD">French (Democratic Republic of the Congo)</option>
> + <option value="fr-BE">French (Belgium)</option>
> + <option value="fr-CA">French (Canada)</option>
> + <option value="fr-FR">French (France)</option>
> + <option value="fr-CI">French (Ivory Coast [Côte d’Ivoire])</option>
> + <option value="fr-LU">French (Luxembourg)</option>
> + <option value="fr-MR">French (Mauritania)</option>
> + <option value="fr-MU">French (Mauritius)</option>
> + <option value="fr-MA">French (Morocco)</option>
> + <option value="fr-SN">French (Senegal)</option>
> + <option value="fr-CH">French (Switzerland)</option>
> + <option value="fr-TN">French (Tunisia)</option>
> + <option value="gl-ES">Galician (Spain)</option>
> + <option value="lg-UG">Ganda (Uganda)</option>
> + <option value="ka-GE">Georgian (Georgia)</option>
> + <option value="de-AT">German (Austria)</option>
> + <option value="de-DE">German (Germany)</option>
> + <option value="de-LU">German (Luxembourg)</option>
> + <option value="de-CH">German (Switzerland)</option>
> + <option value="el-GR">Greek (Greece)</option>
> + <option value="gu-IN">Gujarati (India)</option>
> + <option value="ha-NG">Hausa (Nigeria)</option>
> + <option value="he-IL">Hebrew (Israel)</option>
> + <option value="hi-IN">Hindi (India)</option>
> + <option value="hu-HU">Hungarian (Hungary)</option>
> + <option value="is-IS">Icelandic (Iceland)</option>
> + <option value="ig-NG">Igbo (Nigeria)</option>
> + <option value="id-ID">Indonesian (Indonesia)</option>
> + <option value="it-IT">Italian (Italy)</option>
> + <option value="it-CH">Italian (Switzerland)</option>
> + <option value="ja-JP">Japanese (Japan)</option>
> + <option value="kn-IN">Kannada (India)</option>
> + <option value="kk-KZ">Kazakh (Kazakhstan)</option>
> + <option value="km-KH">Khmer (Cambodia)</option>
> + <option value="rw-RW">Kinyarwanda (Rwanda)</option>
> + <option value="kok-IN">Konkani (India)</option>
> + <option value="ko-KR">Korean (India)</option>
> + <option value="lo-LA">Lao (Korea, South)</option>
> + <option value="lv-LV">Latvian (Latvia)</option>
> + <option value="lt-LT">Lithuanian (Lithuania)</option>
> + <option value="mk-MK">Macedonian (Macedonia)</option>
> + <option value="ms-MY">Malay-Latin (Malaysia)</option>
> + <option value="ml-IN">Malayalam (India)</option>
> + <option value="mt-MT">Maltese (Malta)</option>
> + <option value="mr-IN">Marathi (India)</option>
> + <option value="mn-Cyrl-MN">Mongolian-Cyrillic (Mongolia)</option>
> + <option value="ne-IN">Nepali (India)</option>
> + <option value="ne-NP">Nepali (Nepal)</option>
> + <option value="nb-NO">Norwegian Bokmål (Norway)</option>
> + <option value="nn-NO">Norwegian Nynorsk (Norway)</option>
> + <option value="or-IN">Oriya [aka, Odia] (India)</option>
> + <option value="om-ET">Oromo (Ethiopia)</option>
> + <option value="pl-PL">Polish (Poland)</option>
> + <option value="pt-AO">Portuguese Bokmål (Angola)</option>
> + <option value="pt-BR">Portuguese Nynorsk (Brazil)</option>
> + <option value="pt-MO">Portuguese (Macao)</option>
> + <option value="pt-MZ">Portuguese (Mozambique)</option>
> + <option value="pt-PT">Portuguese (Portugal)</option>
> + <option value="pa-IN">Punjabi (India)</option>
> + <option value="ro-RO">Romanian (Romania)</option>
There are 2 spaces between the Language and Location. I will fix it
before applying upstream.
> + <option value="ru-RU">Russian (Russia)</option>
> + <option value="sr-RS">Serbian-Cyrillic (Serbia)</option>
> + <option value="sr-ME">Serbian-Latin (Montenegro)</option>
> + <option value="sr-Latn-RS">Serbian-Latin (Serbia)</option>
> + <option value="si-LK">Sinhala (Sri Lanka)</option>
> + <option value="sk-SK">Slovak (Slovakia)</option>
> + <option value="sl-SI">Slovenian (Slovenia)</option>
> + <option value="es-AR">Spanish (Argentina)</option>
> + <option value="es-BO">Spanish (Bolivia)</option>
> + <option value="es-CL">Spanish (Chile)</option>
> + <option value="es-CO">Spanish (Colombia)</option>
> + <option value="en-CR">Spanish (Costa Rica)</option>
> + <option value="es-DO">Spanish (Dominican Republic)</option>
> + <option value="es-EC">Spanish (Ecuador)</option>
> + <option value="es-SV">Spanish (El Salvador)</option>
> + <option value="es-GT">Spanish (Guatemala)</option>
> + <option value="en-HN">Spanish (Honduras)</option>
> + <option value="es-MX">Spanish (Mexico)</option>
> + <option value="es-NI">Spanish (Nicaragua)</option>
> + <option value="es-PA">Spanish (Panama)</option>
> + <option value="es-PY">Spanish (Paraguay)</option>
> + <option value="en-PE">Spanish (Peru)</option>
> + <option value="es-PR">Spanish (Puerto Rico)</option>
> + <option value="es-ES">Spanish (Spain)</option>
> + <option value="es-US">Spanish (United States)</option>
> + <option value="es-UY">Spanish (Uruguay)</option>
> + <option value="es-VE">Spanish (Venezuela)</option>
> + <option value="sw-KE">Swahili (Kenya)</option>
> + <option value="sw-TZ">Swahili (Tanzania)</option>
> + <option value="sv-SE">Swedish (Sweden)</option>
> + <option value="ta-IN">Tamil (India)</option>
> + <option value="te-IN">Telugu (Venezuela)</option>
> + <option value="th-TH">Thai (Thailand)</option>
> + <option value="tr-TR">Turkish (Turkey)</option>
> + <option value="uk-UA">Ukrainian (Ukraine)</option>
> + <option value="ur-IN">Urdu (India)</option>
> + <option value="ur-PK">Urdu (Pakistan)</option>
> + <option value="uz-Cyrl-UZ">Uzbek-Cyrillic (Uzbekistan)</option>
> + <option value="uz-Latn-UZ">Uzbek-Latin (Uzbekistan)</option>
> + <option value="vi-VN">Vietnamese (Vietnam)</option>
> + <option value="cy-GB">Welsh (United Kingdom)</option>
> + <option value="yo-NG">Yoruba (Nigeria)</option>
> + <option value="ZU-ZA">Zulu (South Africa)</option>
> + <option value="az-AZ">Azerbaijani-Latin (Azerbaijan)</option>
> + <option value="sr-CS">Serbian-Cyrillic ()</option>
> + <option value="sr-Cyrl-CS">Serbian-Cyrillic (Serbia and Montenegro)</option>
> + <option value="sr-Latn-CS">Serbian-Latin (Serbia and Montenegro)</option>
> </select>
> </div>
> </form>
8 years, 7 months
Re: [Kimchi-devel] [PATCH] [Wok 0/2] Fix for Issues #101 and #115
by Aline Manera
Hi Archana,
I will apply only the first patch as the second one needs s v2.
On 05/23/2016 05:13 AM, archus(a)linux.vnet.ibm.com wrote:
> From: Archana Singh <archus(a)linux.vnet.ibm.com>
>
> 1) Enabling UTF-8 characters support in command output.
> 2) Fix for _get_resources wok_log.error result into unicode error.
>
> Archana Singh (2):
> Issue #101: In runcommand, enabling UTF-8 characters support in
> command output.
> Issue #115: _get_resources wok_log.error result into unicode error
>
> src/wok/control/base.py | 8 ++++++--
> src/wok/utils.py | 4 ++--
> 2 files changed, 8 insertions(+), 4 deletions(-)
>
8 years, 7 months
[PATCH v2] [Kimchi 0/2] Implement multi-function pci hotplug
by Jose Ricardo Ziviani
v1 -> v2:
Include the pci address in the guest xml even for function > 0.
This patchset implements multi-function pci hotplug for Kimchi. The
special point in it is the need to attach all functions at once (one xml
containing all devices) sorted (in reverse, the function 0 is the last
one). This logic also applies to hot unplug.
How to test the backend:
- hotplug
curl -u username -H "Content-Type: application/json" -H "Accept: application/json" https://host:8001/plugins/kimchi/vms/0fed23/hostdevs -X POST -d '{"name": "pci_0001_05_00_1"}'
- hotunplug
curl -u username -H "Content-Type: application/json" -H "Accept: application/json" https://host:8001/plugins/kimchi/vms/0fed23/hostdevs/pci_0001_05_00_0 -X DELETE
Note: it doesn't matter the function is chosen (pci_0001_05_00_0 or
pci_0001_05_00_1 in this case), both functions will be attached/detached accordingly.
Note2: attach/detach are async methods but UI is not reflecting it, it's
necessary to close/reopen the Edit window to see the PCI list updated.
Jose Ricardo Ziviani (2):
Enable hot-plug multi-function pci on front-end
Implement multi-function pci hotplug support
model/vmhostdevs.py | 100 ++++++++++++++++++++++++++++++++----
ui/js/src/kimchi.guest_edit_main.js | 2 +-
2 files changed, 92 insertions(+), 10 deletions(-)
--
2.7.4
8 years, 7 months
Re: [Kimchi-devel] [PATCH] [Wok 2/2] Issue #115: _get_resources wok_log.error result into unicode error
by Aline Manera
Hi Archana,
Seems encode_value() is not defined:
make[2]: Entering directory '/home/alinefm/wok'
PYTHONPATH=src contrib/check_i18n.py src/wok/plugins/*/i18n.py
src/wok/i18n.py
Checking for invalid i18n string...
Checking for invalid i18n string successfully
*./src/wok/control/base.py:382: undefined name 'encode_value'*
Makefile:930: recipe for target 'check-local' failed
make[2]: *** [check-local] Error 1
make[2]: Leaving directory '/home/alinefm/wok'
Makefile:797: recipe for target 'check-am' failed
make[1]: *** [check-am] Error 2
make[1]: Leaving directory '/home/alinefm/wok'
Makefile:509: recipe for target 'check-recursive' failed
make: *** [check-recursive] Error 1
Could you fix it and resend?
Thanks,
Aline Manera
On 05/23/2016 05:13 AM, archus(a)linux.vnet.ibm.com wrote:
> From: Archana Singh <archus(a)linux.vnet.ibm.com>
>
> As ident is in encoded value but e.message is in unicode value,
> combination of which result into unicode value having encoded ident value.
> So when wok_log.error try to encode(encoded value) it result into error.
>
> This patch fix the unicode error by encoding e.message.
>
> Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
> ---
> src/wok/control/base.py | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/wok/control/base.py b/src/wok/control/base.py
> index be5f618..d4fd4e4 100644
> --- a/src/wok/control/base.py
> +++ b/src/wok/control/base.py
> @@ -373,9 +373,13 @@ class Collection(object):
> res.lookup()
> except Exception as e:
> # In case of errors when fetching a resource info, pass and
> - # log the error, so, other resources are returned
> + # log the error, so, other resources are returned.
> + # Encoding error message as ident is also encoded value.
> + # This has to be done to avoid unicode error,
> + # as combination of encoded and unicode value results into
> + # unicode error.
> wok_log.error("Problem in lookup of resource '%s'. "
> - "Detail: %s" % (ident, e.message))
> + "Detail: %s" % (ident, encode_value(e.message)))
> continue
> res_list.append(res)
> return res_list
8 years, 7 months