[PATCH] [Kimchi] Issue #1050: Rename template with existing template name
by archus@linux.vnet.ibm.com
From: Archana Singh <archus(a)linux.vnet.ibm.com>
If template name is change to update and the new template name to be
updated already exists then exception is raised stating name already exists.
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
model/templates.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/model/templates.py b/model/templates.py
index c3e24e1..e5663ad 100644
--- a/model/templates.py
+++ b/model/templates.py
@@ -231,6 +231,14 @@ class TemplateModel(object):
def update(self, name, params):
edit_template = self.lookup(name)
+ # If new name is not same as existing name
+ # and new name already exists: raise exception
+ with self.objstore as session:
+ if name != params['name'] \
+ and params['name'] in session.get_list('template'):
+ raise InvalidOperation("KCHTMPL0001E",
+ {'name': params['name']})
+
# Valid interfaces
interfaces = params.get('interfaces', [])
validate_interfaces(interfaces)
--
2.7.4
8 years
[PATCH] [Kimchi] rpmlint fixes on Fedora and Suse specs
by dhbarboza82@gmail.com
From: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
This patch changes contrib/kimchi.spec.fedora.in and
contrib/kimchi.spec.suse.in to comply with the rpm
guidelines enforced by the rpmlint tool.
After this patch, running check-local or ././check_spec_errors.sh
gives only these warnings:
contrib/kimchi_fedora.spec: W: invalid-url Source0: kimchi-2.3.0.tar.gz
0 packages and 1 specfiles checked; 0 errors, 1 warnings.
contrib/kimchi_suse.spec: W: invalid-url Source0: kimchi-2.3.0.tar.gz
0 packages and 1 specfiles checked; 0 errors, 1 warnings.
According to https://bugzilla.redhat.com/show_bug.cgi?id=566978
it is safe to ignore the 'invalid-url Source0' warning.
Signed-off-by: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
---
contrib/kimchi.spec.fedora.in | 4 ++--
contrib/kimchi.spec.suse.in | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in
index 29d4463..3b33297 100644
--- a/contrib/kimchi.spec.fedora.in
+++ b/contrib/kimchi.spec.fedora.in
@@ -46,7 +46,7 @@ Requires: spice-html5
%if 0%{?rhel} == 6
Requires: python-ordereddict
Requires: python-imaging
-BuildRequires: python-unittest2
+BuildRequires: python-unittest2
%endif
%description
@@ -54,7 +54,7 @@ Web application to manage KVM/Qemu virtual machines
%prep
-%setup
+%setup -q
%build
diff --git a/contrib/kimchi.spec.suse.in b/contrib/kimchi.spec.suse.in
index 3d0896b..94dc55e 100644
--- a/contrib/kimchi.spec.suse.in
+++ b/contrib/kimchi.spec.suse.in
@@ -36,7 +36,7 @@ BuildRequires: libxslt-tools
BuildRequires: python-lxml
%if 0%{?suse_version} == 1100
-Requires: python-ordereddict
+Requires: python-ordereddict
%endif
%if 0%{?suse_version} > 1140
@@ -47,7 +47,7 @@ Requires: python-ordereddict
Web application to manage KVM/Qemu virtual machines
%prep
-%setup
+%setup -q
%build
%configure --with-spice-html5
--
2.7.4
8 years
[PATCH V2] [Kimchi] Issue #1050: Rename template with existing template name
by archus@linux.vnet.ibm.com
From: Archana Singh <archus(a)linux.vnet.ibm.com>
If template name is change to update and the new template name to be
updated already exists then exception is raised stating name already exists.
Added unit test case for same.
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
model/templates.py | 8 ++++++++
tests/test_template.py | 16 ++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/model/templates.py b/model/templates.py
index c3e24e1..566a20c 100644
--- a/model/templates.py
+++ b/model/templates.py
@@ -231,6 +231,14 @@ class TemplateModel(object):
def update(self, name, params):
edit_template = self.lookup(name)
+ # If new name is not same as existing name
+ # and new name already exists: raise exception
+ with self.objstore as session:
+ if 'name' in params and name != params['name'] \
+ and params['name'] in session.get_list('template'):
+ raise InvalidOperation("KCHTMPL0001E",
+ {'name': params['name']})
+
# Valid interfaces
interfaces = params.get('interfaces', [])
validate_interfaces(interfaces)
diff --git a/tests/test_template.py b/tests/test_template.py
index 6845565..f1dbf2b 100644
--- a/tests/test_template.py
+++ b/tests/test_template.py
@@ -192,6 +192,22 @@ class TemplateTests(unittest.TestCase):
self.request('/plugins/kimchi/templates/test').read()
)
+ # Create another template to test update template name with one of
+ # existing template name
+ req = json.dumps({'name': 'test_new',
+ 'source_media': {'type': 'disk', 'path': MOCK_ISO}})
+ resp = self.request('/plugins/kimchi/templates', req, 'POST')
+ self.assertEquals(201, resp.status)
+ # Update name with one of existing name should fail with 400
+ req = json.dumps({'name': 'test_new'})
+ resp = self.request('/plugins/kimchi/templates/test', req, 'PUT')
+ self.assertEquals(400, resp.status)
+
+ # Delete the test1 template
+ resp = self.request('/plugins/kimchi/templates/test_new', '{}',
+ 'DELETE')
+ self.assertEquals(204, resp.status)
+
# Update name
new_name = u'kīмсhīTmpl'
new_tmpl_uri = '/plugins/kimchi/templates/%s' \
--
2.7.4
8 years
[RFC] Guest/Template CPU setup with topology
by Daniel Henrique Barboza
Hi there,
At this moment Kimchi support for guest and template CPU setup is
underwhelming. Here's what I've found that needs improving:
- edit template:
* calculation of max CPUs is wrong when considering a topology. Max CPU
is the value of sockets * cores * threads. At this moment it is
considering only
cores * threads, defaulting sockets to 1.
* There is no way to set or even see the value of sockets. Given that
this value
is used in the calculation of the max CPUs, it should be at least
visible and, in my
opinion, editable
- edit guest (not running):
* If the guest was created with a CPU topology, there is no way to edit
it. The only
way to edit a topology at this moment is on the template level.
My proposal is:
edit template:
- fix the max CPU calculation to consider the sockets.
- add a field to allow the 'sockets' to be set at will. Default value
will be retrieved
by the kimchi/host/cpuinfo API as a reference (same think as with cores
and threads
today).
edit guest:
- if the guest was created with a CPU topology, allow the topology to be
edited when
the guest is turned OFF.
Thoughts?
ps: this RFC is also related to the feedback of "Bug fix #1072 -
changing vpus
verification".
Daniel
8 years
[PATCH][Wok] Bug fix #151: Wok settings page not working when locale not set
by Ramon Medeiros
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
ui/js/src/wok.login.js | 27 +++++++++++++++++++--------
ui/pages/login.html.tmpl | 4 ++--
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/ui/js/src/wok.login.js b/ui/js/src/wok.login.js
index 0b09508..6545858 100644
--- a/ui/js/src/wok.login.js
+++ b/ui/js/src/wok.login.js
@@ -19,17 +19,28 @@
*/
wok.login_main = function() {
"use strict";
+
+ // verify if language is available
var selectedLanguage = wok.lang.get();
- $('#userLang').val(selectedLanguage);
- $('#userLang option[value="'+selectedLanguage+'"]').attr("selected", "selected");
- $('.filter-option:first').parent().attr('title',$('#userLang option[value="'+selectedLanguage+'"]').text());
- $('.filter-option:first').text($('#userLang option[value="'+selectedLanguage+'"]').text());
+ for (var i = 0; i < $('#userLang')[0].length; i++ ){
+ if ($('#userLang')[0][i] == selectedLanguage) {
+ $('#userLang').val(selectedLanguage);
+ $('#userLang option[value="'+selectedLanguage+'"]').attr("selected", "selected");
+ $('.filter-option:first').parent().attr('title',$('#userLang option[value="'+selectedLanguage+'"]').text());
+ $('.filter-option:first').text($('#userLang option[value="'+selectedLanguage+'"]').text());
+ }
+ }
+ // verify if locale is available
var selectedLocale = wok.lang.get_locale();
- $('#userLocale').val(selectedLocale);
- $('#userLocale option[value="'+selectedLocale+'"]').attr("selected", "selected");
- $('.filter-option:last').parent().attr('title',$('#userLocale option[value="'+selectedLocale+'"]').text());
- $('.filter-option:last').text($('#userLocale option[value="'+selectedLocale+'"]').text());
+ for (var i = 0; i < $('#userLocale')[0].length; i++ ){
+ if ($('#userLocale')[0][i] == selectedLocale) {
+ $('#userLocale').val(selectedLocale);
+ $('#userLocale option[value="'+selectedLocale+'"]').attr("selected", "selected");
+ $('.filter-option:last').parent().attr('title',$('#userLocale option[value="'+selectedLocale+'"]').text());
+ $('.filter-option:last').text($('#userLocale option[value="'+selectedLocale+'"]').text());
+ }
+ }
$('#userLang').on('change', function() {
diff --git a/ui/pages/login.html.tmpl b/ui/pages/login.html.tmpl
index 431806c..d74b795 100644
--- a/ui/pages/login.html.tmpl
+++ b/ui/pages/login.html.tmpl
@@ -128,7 +128,7 @@
<div class="form-group">
<label for="userLang">$_("Language")</label>
<select id="userLang" class="selectpicker col-md-12 col-lg-12">
- <option value="en_US">English (US)</option>
+ <option value="en_US" selected="selected">English (US)</option>
<option value="zh_CN">中文(简体)</option>
<option value="pt_BR">Português (Brasil)</option>
<option value="de_DE">Deutsch (Deutschland)</option>
@@ -202,7 +202,7 @@
<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-US" selected="selected">$_("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>
--
2.7.4
8 years
[PATCH V3] [Kimchi] s390x specific changes to support storage path and storage pool as disk.
by archus@linux.vnet.ibm.com
From: Archana Singh <archus(a)linux.vnet.ibm.com>
1) As on s390x, default is storage path, but if pool explicitly specified in
template.conf it takes preference. So added code to ensure that
if storage pool explicitly specified in file conf then check for default
storage pool is performed.
2) Code changes in tmpl default creation which ensure that on s390x, default
disk is path but if conf file has explicitly pool specified then defult disk
is the sepecified pool. And also ensures that disk is either pool or path
and not both.
3) Code changes in vmtemplate, to ensure that on s390x either a path disk
or a pool disk can be added to template. And if disk to add does not have
both path and pool then tmpl default storage is used.
4) Added 'path' specific to s390x only as commented in template.conf.
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
model/storagepools.py | 6 ++++--
osinfo.py | 44 +++++++++++++++++++++++++++++++++++++-------
template.conf | 5 +++++
vmtemplate.py | 33 ++++++++++++++++++++++++---------
4 files changed, 70 insertions(+), 18 deletions(-)
diff --git a/model/storagepools.py b/model/storagepools.py
index 5942b31..cc4b906 100644
--- a/model/storagepools.py
+++ b/model/storagepools.py
@@ -73,7 +73,9 @@ class StoragePoolsModel(object):
def _check_default_pools(self):
pools = {}
- if is_s390x():
+ # Don't create default pool if it's not
+ # explicitly specified in template.conf
+ if is_s390x() and 'pool' not in tmpl_defaults['disks'][0]:
return
default_pool = tmpl_defaults['disks'][0]['pool']['name']
@@ -91,7 +93,7 @@ class StoragePoolsModel(object):
error_msg = ("Storage pool %s does not exist or is not "
"active. Please, check the configuration in "
"%s/template.conf to ensure it lists only valid "
- "networks." % (pool_name, kimchiPaths.sysconf_dir))
+ "storage." % (pool_name, kimchiPaths.sysconf_dir))
try:
pool = conn.storagePoolLookupByName(pool_name)
except libvirt.libvirtError, e:
diff --git a/osinfo.py b/osinfo.py
index c51d6e0..fc34932 100644
--- a/osinfo.py
+++ b/osinfo.py
@@ -27,9 +27,10 @@ from configobj import ConfigObj
from distutils.version import LooseVersion
from wok.config import PluginPaths
+from wok.utils import wok_log
+from wok.exception import InvalidParameter
from wok.plugins.kimchi.config import kimchiPaths
-
SUPPORTED_ARCHS = {'x86': ('i386', 'i686', 'x86_64'),
'power': ('ppc', 'ppc64'),
'ppc64le': ('ppc64le'),
@@ -176,14 +177,43 @@ def _get_tmpl_defaults():
default_config = ConfigObj(tmpl_defaults)
# Load template configuration file
- if is_on_s390x:
- config_file = os.path.join(
- kimchiPaths.sysconf_dir,
- 'template_s390x.conf')
- else:
- config_file = os.path.join(kimchiPaths.sysconf_dir, 'template.conf')
+ config_file = os.path.join(kimchiPaths.sysconf_dir, 'template.conf')
config = ConfigObj(config_file)
+ # File configuration takes preference.
+ # In s390x, file configuration can have storage pool or path.
+ # Default configuration for s390x is storage path.
+ # In case file conf has storage pool then storage pool takes preference.
+ # When conf file has explicitly storage pool: "defaults" should
+ # have storage pool and default configured path should be removed,
+ # as either storage can be path or pool, cannot be both.
+ # When conf file does not explicity storage pool or have explicitly
+ # storage path: "default" should have storage path only and cannot
+ # have default pool.
+ #
+ # Check file conf has storage configured.
+ if is_on_s390x and config.get('storage').get('disk.0'):
+ # remove storage from default_config as file configuration takes
+ # preference.
+ default_config.pop('storage')
+
+ # Get storage configuration present in conf file
+ config_pool = config.get('storage').get('disk.0').get('pool')
+ config_path = config.get('storage').get('disk.0').get('path')
+
+ # If storage configured in conf file then it should have either
+ # pool or path.
+ if not config_pool and not config_path:
+ raise InvalidParameter('KCHTMPL0040E')
+
+ # On s390x if config file has both path and pool uncommented
+ # then path should take preference.
+ if config_pool and config_path:
+ wok_log.warning("Both default pool and path are specified in" +
+ " template.conf. Hence default pool is being" +
+ " ignored and only default path will be used")
+ config.get('storage').get('disk.0').pop('pool')
+
# Merge default configuration with file configuration
default_config.merge(config)
diff --git a/template.conf b/template.conf
index c4598f1..d1cbe64 100644
--- a/template.conf
+++ b/template.conf
@@ -28,6 +28,11 @@
# Storage pool used to handle the guest disk
#pool = default
+# Only Applicable for s390x. Storage path used to handle the guest disk.
+# In Each disk, pool and path are mutually exclusive parameters and
+# pool will be ignored in case of both specified.
+#path = /var/lib/libvirt/images
+
[graphics]
# Graphics type
# Valid options: vnc | spice
diff --git a/vmtemplate.py b/vmtemplate.py
index c3390fe..1acd4db 100644
--- a/vmtemplate.py
+++ b/vmtemplate.py
@@ -106,14 +106,25 @@ class VMTemplate(object):
for index, disk in enumerate(disks):
disk_info = dict(default_disk)
- # on s390x/s390 either pool or path should be present in
- # default disk.
- if is_s390x() and 'pool' not in default_disk and \
- 'path' not in default_disk:
- raise InvalidParameter('KCHTMPL0040E')
- # On s390x/s390 pool is optional attribute for disk.
- pool = disk.get('pool', default_disk.get('pool'))
+ if is_s390x():
+ # Default disk should have either pool or path.
+ if 'pool' not in default_disk and 'path' not in default_disk:
+ raise InvalidParameter('KCHTMPL0040E')
+
+ # Each disk should have either pool or path.
+ # if not then use "default_disk" configuration.
+ pool = disk.get('pool')
+ path = disk.get('path')
+ if not path and not pool:
+ # If default disk is path then set disk with default path
+ if default_disk.get('path'):
+ path = default_disk.get('path')
+ # If default disk is pool then set disk with default pool
+ elif default_disk.get('pool'):
+ pool = default_disk.get('pool')
+ else:
+ pool = disk.get('pool', default_disk.get('pool'))
if pool:
pool_type = self._get_storage_type(pool['name'])
@@ -148,8 +159,12 @@ class VMTemplate(object):
disk_info['index'] = disk_info.get('index', index)
self.info['disks'][index] = disk_info
elif is_s390x():
- # For now support 'path' only on s390x
- path = disk.get('path', default_disk.get('path'))
+ # This check is required where 'path' disk
+ # has to be added and hence default pool
+ # has to be removed during template update.
+ if 'pool' in disk_info:
+ del disk_info['pool']
+
disk_info.update(disk)
keys = sorted(disk_info.keys())
if ((keys != sorted(basic_path_disk)) and
--
2.7.4
8 years
[PATCH] [Kimchi] Edit template storage path should start with "/"
by rajgupta@linux.vnet.ibm.com
From: Rajat Gupta <rajat.triumph(a)gmail.com>
Edit template storage path should start with "/"
Signed-off-by: Rajat Gupta <rajat.triumph(a)gmail.com>
---
ui/js/src/kimchi.template_edit_main.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
index 1a6e473..758201f 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -339,7 +339,8 @@ kimchi.template_edit_main = function() {
});
$(storageRow + ' input.storage-path').on('change input keyup',function(){
- if($(storageRow + ' input.storage-path').val()){
+ var storagepath = $(storageRow + ' input.storage-path').val();
+ if( storagepath && storagepath.charAt(0) == '/'){
$(storageRow + ' span.storage-path').removeClass('has-error');
}else{
$(storageRow + ' span.storage-path').addClass('has-error');
--
2.1.0
8 years
[PATCH v3] [Kimchi 0/2] Issue #998 Not all static strings are externalized
by pkulkark@linux.vnet.ibm.com
From: Pooja Kulkarni <pkulkark(a)linux.vnet.ibm.com>
v3:
Removed 'fuzzy' messages from .po files
v2:
Rebased to latest master
v1:
This patch set externalizes all the
static string that should be externalized
to support globalization. Also contains
the updated .pot and .po files
Pooja Kulkarni (2):
Issue #998 Not all static strings are externalized
Issue #998 Updated .pot and .po files
po/POTFILES.in | 1 +
po/de_DE.po | 267 +++++++++++++++++++++++++++--
po/en_US.po | 267 +++++++++++++++++++++++++++--
po/es_ES.po | 267 +++++++++++++++++++++++++++--
po/fr_FR.po | 267 +++++++++++++++++++++++++++--
po/it_IT.po | 267 +++++++++++++++++++++++++++--
po/ja_JP.po | 267 +++++++++++++++++++++++++++--
po/kimchi.pot | 267 +++++++++++++++++++++++++++--
po/ko_KR.po | 267 +++++++++++++++++++++++++++--
po/pt_BR.po | 267 +++++++++++++++++++++++++++--
po/ru_RU.po | 267 +++++++++++++++++++++++++++--
po/zh_CN.po | 267 +++++++++++++++++++++++++++--
po/zh_TW.po | 267 +++++++++++++++++++++++++++--
ui/js/src/kimchi.guest_storage_add.main.js | 12 +-
ui/js/src/kimchi.storagepool_add_main.js | 12 +-
ui/pages/guest-edit.html.tmpl | 14 +-
ui/pages/i18n.json.tmpl | 18 ++
17 files changed, 3122 insertions(+), 139 deletions(-)
--
2.1.0
8 years
[PATCH V2] [Kimchi] Fixed issue #1074 IP address for the guest under Interfaces tab is blank
by rajgupta@linux.vnet.ibm.com
From: Rajat Gupta <rajat.triumph(a)gmail.com>
V2 :
Added condition to check if IP address array length is zero
V1 :
If IP address is not define it will show "unavailable" for the guest under Interfaces tab
Signed-off-by: Rajat Gupta <rajat.triumph(a)gmail.com>
---
ui/js/src/kimchi.guest_edit_main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index 9669d08..3261075 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -206,7 +206,7 @@ kimchi.guest_edit_main = function() {
if (data.id === -1) {
data.id = $('#form-guest-edit-interface > .body').children().size();
}
- if (data.ips === "" || data.ips === null) {
+ if (data.ips === "" || data.ips === null || data.ips === undefined || data.ips.length === 0) {
data.ips = i18n["KCHNET6001M"];
} else {
data.ips = data.ips;
--
2.1.0
8 years
[PATCH] [Kimchi] Update Kimchi code due chnages on Wok configuration parameters
by Aline Manera
Depends on Wok patch:
- [Wok 0/6] Bug fix #175: Do not generate nginx configuration file on the fly
Aline Manera (1):
Update Kimchi code due chnages on Wok configuration parameters
model/peers.py | 2 +-
tests/test_authorization.py | 14 +++------
tests/test_host.py | 15 +++-------
tests/test_livemigration.py | 12 ++------
tests/test_mock_network.py | 17 +++--------
tests/test_mock_storagepool.py | 17 +++--------
tests/test_mock_storagevolume.py | 19 ++++---------
tests/test_mockmodel.py | 30 +++++++-------------
tests/test_model.py | 60 +++++++++++++++++++++++++--------------
tests/test_model_network.py | 17 +++--------
tests/test_model_storagepool.py | 20 ++++---------
tests/test_model_storagevolume.py | 25 ++++++----------
tests/test_networkxml.py | 7 +++--
tests/test_rest.py | 20 ++++---------
tests/test_template.py | 17 +++--------
ui/js/src/kimchi.api.js | 21 ++++++--------
websocket.py | 8 +-----
17 files changed, 116 insertions(+), 205 deletions(-)
--
2.7.4
8 years