[PATCH v2 0/3] Fix storage volume issues
by Crístian Viana
This is the changelog between this and the previous patchset:
- Instead of removing the ISO permission check at all, update it so the file's
ACL is correctly updated before checking its permission;
Crístian Viana (3):
issue #565: Allow a template's ISO to be a block device
issue #564: Parse logical volumes to find out their actual formats
Update ISO file's ACL before checking its permission
src/kimchi/isoinfo.py | 7 +++++--
src/kimchi/model/storagevolumes.py | 19 ++++++++++++++++++-
src/kimchi/model/templates.py | 20 ++++++++++++--------
src/kimchi/vmtemplate.py | 10 ++++++++--
4 files changed, 43 insertions(+), 13 deletions(-)
--
2.1.0
9 years, 9 months
[PATCH 0/2] Fix ISO streaming and tests cases
by Aline Manera
Depends on [Kimchi-devel] [PATCH] Fix issue #597: Get the right arch when using libvirt Test driver
Aline Manera (2):
Bug fix: Consider server is being started up on servermethod function
Fix test_model.py to reset Singleton classes when initializing the
tests
src/kimchi/utils.py | 3 ++-
tests/test_model.py | 51 ++++++++++++++++++++++++++++++++++-----------------
2 files changed, 36 insertions(+), 18 deletions(-)
--
2.1.0
9 years, 9 months
[PATCH] Use the right firewall-cmd command to open Kimchi ports
by Aline Manera
When trying to open Kimchi ports following the instructions on README on
RHEL 7.1 I got the following error:
[root@rhel7-vm ~]# sudo firewall-cmd --add-port=8000 --permanent
bad port (most likely missing protocol), correct syntax is portid[-portid]/protocol
The same behavior was identified on Fedora 21.
So update the firewall-cmd commands to properly guide user on opening
Kimchi ports.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
docs/README.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/README.md b/docs/README.md
index 4b14814..5407264 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -145,9 +145,9 @@ If you cannot access Kimchi, take a look at these 2 points:
Kimchi uses by default the ports 8000, 8001 and 64667. To allow incoming connections:
For system using firewalld, do:
- sudo firewall-cmd --add-port 8000 --permanent
- sudo firewall-cmd --add-port 8001 --permanent
- sudo firewall-cmd --add-port 64667 --permanent
+ sudo firewall-cmd --add-port=8000/tcp --permanent
+ sudo firewall-cmd --add-port=8001/tcp --permanent
+ sudo firewall-cmd --add-port=64667/tcp --permanent
sudo firewall-cmd --reload
For openSUSE systems, do:
--
2.1.0
9 years, 9 months
[PATCH] Fix issue #597: Get the right arch when using libvirt Test driver
by Aline Manera
libvirt Test driver only supports i686 arch.
So fix feature tests to get the right arch according to libvirt driver.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/kimchi/model/featuretests.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/kimchi/model/featuretests.py b/src/kimchi/model/featuretests.py
index f22fada..4aac8ed 100644
--- a/src/kimchi/model/featuretests.py
+++ b/src/kimchi/model/featuretests.py
@@ -20,13 +20,13 @@
import cherrypy
import libvirt
import lxml.etree as ET
+import platform
import socket
import subprocess
import threading
from lxml.builder import E
-from kimchi import osinfo
from kimchi.rollbackcontext import RollbackContext
from kimchi.utils import kimchi_log, run_command, servermethod
@@ -102,8 +102,9 @@ class FeatureTests(object):
@staticmethod
def libvirt_supports_iso_stream(conn, protocol):
- domain_type = 'test' if conn.getType().lower() == 'test' else 'kvm'
- arch = osinfo.defaults['arch']
+ conn_type = conn.getType().lower()
+ domain_type = 'test' if conn_type == 'test' else 'kvm'
+ arch = 'i686' if conn_type == 'test' else platform.machine()
arch = 'ppc64' if arch == 'ppc64le' else arch
xml = ISO_STREAM_XML % {'name': FEATURETEST_VM_NAME,
'domain': domain_type, 'protocol': protocol,
@@ -198,8 +199,9 @@ class FeatureTests(object):
with RollbackContext() as rollback:
FeatureTests.disable_libvirt_error_logging()
rollback.prependDefer(FeatureTests.enable_libvirt_error_logging)
- domain_type = 'test' if conn.getType().lower() == 'test' else 'kvm'
- arch = osinfo.defaults['arch']
+ conn_type = conn.getType().lower()
+ domain_type = 'test' if conn_type == 'test' else 'kvm'
+ arch = 'i686' if conn_type == 'test' else platform.machine()
arch = 'ppc64' if arch == 'ppc64le' else arch
dom = conn.defineXML(SIMPLE_VM_XML % {'name': FEATURETEST_VM_NAME,
'domain': domain_type,
--
2.1.0
9 years, 9 months
[PATCH] Fix issue #617: Base URL may be an empty string when updating YUM repo
by Aline Manera
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/kimchi/i18n.py | 2 +-
src/kimchi/repositories.py | 16 +++++++++++-----
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index df5422f..e4e1a89 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -298,7 +298,7 @@ messages = {
"KCHREPOS0010E": _("GPG key must be a URL pointing to the ASCII-armored file."),
"KCHREPOS0011E": _("Could not update repository %(repo_id)s."),
"KCHREPOS0012E": _("Repository %(repo_id)s does not exist."),
- "KCHREPOS0013E": _("Specify repository base URL or mirror list in order to create a YUM repository."),
+ "KCHREPOS0013E": _("Specify repository base URL or mirror list in order to create or update a YUM repository."),
"KCHREPOS0014E": _("Repository management tool was not recognized for your system."),
"KCHREPOS0015E": _("Repository %(repo_id)s is already enabled."),
"KCHREPOS0016E": _("Repository %(repo_id)s is already disabled."),
diff --git a/src/kimchi/repositories.py b/src/kimchi/repositories.py
index f826ac9..f1e1eb3 100644
--- a/src/kimchi/repositories.py
+++ b/src/kimchi/repositories.py
@@ -1,7 +1,7 @@
#
# Project Kimchi
#
-# Copyright IBM, Corp. 2014
+# Copyright IBM, Corp. 2014-2015
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -269,19 +269,25 @@ class YumRepo(object):
if repo_id not in repos.repos.keys():
raise NotFoundError("KCHREPOS0012E", {'repo_id': repo_id})
- config = params.get('config', {})
entry = repos.getRepo(repo_id)
baseurl = params.get('baseurl', None)
+ config = params.get('config', {})
mirrorlist = config.get('mirrorlist', None)
+ if len(baseurl.strip()) == 0:
+ baseurl = None
+
+ if len(mirrorlist.strip()) == 0:
+ mirrorlist = None
+
+ if baseurl is None and mirrorlist is None:
+ raise MissingParameter("KCHREPOS0013E")
+
if baseurl is not None:
validate_repo_url(baseurl)
entry.baseurl = baseurl
- if mirrorlist == '':
- mirrorlist = None
-
if mirrorlist is not None:
validate_repo_url(mirrorlist)
entry.mirrorlist = mirrorlist
--
2.1.0
9 years, 9 months
[PATCH] Fix issue #621: Catch libvirt exception when network does not have bridge name
by Aline Manera
The bridged network does not have a bridge name (<bridge> on XML)
<network>
<name>bridged</name>
<uuid>70441e61-2f87-44c4-836b-5cc817fcf025</uuid>
<forward dev='eth0' mode='bridge'>
<interface dev='eth0'/>
</forward>
</network>
and then libvirt raises an exception when we try to get the bridge name.
File "/usr/lib64/python2.7/site-packages/libvirt.py", line 2780, in bridgeName
if ret is None: raise libvirtError ('virNetworkGetBridgeName() failed', net=self)
libvirtError: internal error: network 'bridged-eth0' does not have a bridge name.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/kimchi/model/networks.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/model/networks.py b/src/kimchi/model/networks.py
index 7265c64..92aed92 100644
--- a/src/kimchi/model/networks.py
+++ b/src/kimchi/model/networks.py
@@ -210,7 +210,17 @@ class NetworksModel(object):
br_xml = create_vlan_tagged_bridge_xml(br_name, interface, vlan_id)
conn = self.conn.get()
- if br_name in [net.bridgeName() for net in conn.listAllNetworks()]:
+ bridges = []
+ for net in conn.listAllNetworks():
+ # Bridged networks do not have a bridge name
+ # So in those cases, libvirt raises an error when trying to get
+ # the bridge name
+ try:
+ bridges.append(net.bridgeName())
+ except libvirt.libvirtError, e:
+ kimchi_log.error(e.message)
+
+ if br_name in bridges:
raise InvalidOperation("KCHNET0010E", {'iface': br_name})
with RollbackContext() as rollback:
--
2.1.0
9 years, 9 months
[PATCH] Fix issue #620: Allow use iSCSI/SCSI volume on Template
by Aline Manera
When selecting an iSCSI/SCSI volume to create a Template, the disk size is
calculated according to the selected volume.
In that case only the volume information should be used:
{
...
"disks":[
{
"volume":"unit:0:0:2",
"index":0
}
]
}
Also to get and display the disk size for user we should query the
selected volume.
This patch also created function to call GET /storagepools/<pool> API.
That way we can easily get the pool type without the need to query the information
on all pools returned by GET /storagepools API
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.api.js | 15 +++++-
ui/js/src/kimchi.template_edit_main.js | 86 ++++++++++++++++++----------------
2 files changed, 59 insertions(+), 42 deletions(-)
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 2abe8f5..838b8d3 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -1,7 +1,7 @@
/*
* Project Kimchi
*
- * Copyright IBM, Corp. 2013-2014
+ * Copyright IBM, Corp. 2013-2015
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -806,6 +806,19 @@ var kimchi = {
});
},
+ getStoragePool: function(poolName, suc, err) {
+ var url = kimchi.url + 'storagepools/' + encodeURIComponent(poolName);
+ kimchi.requestJSON({
+ url : url,
+ type : 'GET',
+ contentType : 'application/json',
+ timeout: 2000,
+ dataType : 'json',
+ success : suc,
+ error : err
+ });
+ },
+
getStoragePoolVolume: function(poolName, volumeName, suc, err) {
var url = kimchi.url + 'storagepools/' + encodeURIComponent(poolName) + '/storagevolumes/' + encodeURIComponent(volumeName);
kimchi.requestJSON({
diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
index a557ca5..85f76cd 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -89,51 +89,54 @@ kimchi.template_edit_main = function() {
$('select', '#form-template-storage').change(function() {
var selectedItem = $(this).parent().parent();
var tempStorageNameFull = $(this).val();
- var tempType;
- var tempStorageName =tempStorageNameFull.split('/')[0];
- var scsiCap;
- $.each(result, function(index, storageEntities) {
- if (tempStorageName === storageEntities.name) {
- selectedItem.find('.template-storage-type').val(storageEntities.type);
- scsiCap = storageEntities.capacity / Math.pow(1024, 3);
- tempType = storageEntities.type;
+ var tempName = tempStorageNameFull.split('/');
+ var tempStorageName = tempName[0];
+ $('.template-storage-name').val(tempStorageNameFull);
+ kimchi.getStoragePool(tempStorageName, function(info) {
+ tempType = info.type;
+ selectedItem.find('.template-storage-type').val(tempType);
+ if (tempType === 'iscsi' || tempType === 'scsi') {
+ kimchi.getStoragePoolVolume(tempStorageName, tempName[tempName.length-1], function(info) {
+ volSize = info.capacity / Math.pow(1024, 3);
+ $('.template-storage-disk', selectedItem).attr('readonly', true).val(volSize);
+ });
+ } else {
+ $('.template-storage-disk', selectedItem).attr('readonly', false);
}
});
- if (tempType === 'iscsi' || tempType === 'scsi') {
- $('.template-storage-disk', selectedItem).attr('readonly', true).val(scsiCap);
- } else {
- $('.template-storage-disk', selectedItem).attr('readonly', false);
- }
- $('.template-storage-name').val(tempStorageNameFull);
});
};
if ((origDisks && origDisks.length) && (origPool && origPool.length)) {
splitPool = origPool.split('/');
- var defaultPool;
+ var defaultPool = splitPool[splitPool.length-1];
var defaultType;
- $.each(result, function(index, poolEntities) {
- if (poolEntities.name === splitPool[splitPool.length-1]) {
- defaultType = poolEntities.type;
- defaultPool = splitPool[splitPool.length-1]
- }
- });
- if (origDisks[0]['volume']) {
- defaultPool = defaultPool + '/' + origDisks[0]['volume'];
- }
- $.each(origDisks, function(index, diskEntities) {
- var storageNodeData = {
- viewMode : '',
- editMode : 'hide',
- storageName : defaultPool,
- storageType : defaultType,
- storageDisk : diskEntities.size
- }
- addStorageItem(storageNodeData);
+
+ kimchi.getStoragePool(defaultPool, function(info) {
+ defaultType = info.type;
+ $.each(origDisks, function(index, diskEntities) {
+ var storageNodeData = {
+ viewMode : '',
+ editMode : 'hide',
+ storageName : defaultPool,
+ storageType : defaultType,
+ storageDisk : diskEntities.size
+ }
+
+ if (diskEntities.volume) {
+ kimchi.getStoragePoolVolume(defaultPool, diskEntities.volume, function(info) {
+ var volSize = info.capacity / Math.pow(1024, 3);
+ var nodeData = storageNodeData
+ nodeData.storageName = defaultPool + '/' + diskEntities.volume;
+ nodeData.storageDisk = volSize;
+ addStorageItem(nodeData);
+ $('.template-storage-disk').attr('readonly', true);
+ });
+ } else {
+ addStorageItem(storageNodeData);
+ }
+ });
});
- if(defaultType === 'iscsi' || defaultType === 'scsi') {
- $('.template-storage-disk').attr('readonly', true);
- }
}
$('#template-edit-storage-add-button').button({
@@ -249,10 +252,11 @@ kimchi.template_edit_main = function() {
//Fix me: Only support one storage pool now
var storages = $('.template-tab-body .item', '#form-template-storage');
var tempName = $('.template-storage-name', storages).val();
+ var tmpItem = $('#form-template-storage .item');
tempName = tempName.split('/');
- var tempNameHead =tempName[0];
+ var tempNameHead = tempName[0];
var tempNameTail = tempNameHead;
- if(tempNameHead === 'iscsi' || tempNameHead =='scsi') {
+ if($('.template-storage-type', tmpItem).val() === 'iscsi' || $('.template-storage-type', tmpItem).val() == 'scsi') {
tempNameTail = tempName[tempName.length-1];
}
tempName = '/storagepools/' + tempNameHead;
@@ -260,12 +264,12 @@ kimchi.template_edit_main = function() {
$.each(editableFields, function(i, field) {
/* Support only 1 disk at this moment */
if (field == 'disks') {
- var tmpItem = $('#form-template-storage .item');
- origDisks[0].size = Number($('.template-storage-disk', tmpItem).val());
- if($('.template-storage-type', tmpItem).val() === 'iscsi' || $('.template-storage-type', tmpItem).val() =='scsi') {
+ if($('.template-storage-type', tmpItem).val() === 'iscsi' || $('.template-storage-type', tmpItem).val() == 'scsi') {
+ origDisks[0]['size'] && delete origDisks[0]['size'];
origDisks[0]['volume'] = tempNameTail;
} else {
origDisks[0]['volume'] && delete origDisks[0]['volume'];
+ origDisks[0].size = Number($('.template-storage-disk', tmpItem).val());
}
data[field] = origDisks;
}
--
2.1.0
9 years, 9 months
[PATCH] Add support to recognize RHEL-LE distro and version
by Jose Ricardo Ziviani
- When creating a new template, RHEL little-endian was not
being reconized. This commit fixes the regex to support
such distro.
---
src/kimchi/isoinfo.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kimchi/isoinfo.py b/src/kimchi/isoinfo.py
index b5a1769..818ffe3 100644
--- a/src/kimchi/isoinfo.py
+++ b/src/kimchi/isoinfo.py
@@ -110,7 +110,7 @@ iso_dir = [
('opensuse', '12.2',
'openSUSE-DVD-i586-Build0167|openSUSE-DVD-x86_640167'),
('rhel', '4.8', 'RHEL/4-U8'),
- ('rhel', lambda m: m.group(1), 'RHEL[_/-](\d+\.\d+)'),
+ ('rhel', lambda m: m.group(2), 'RHEL(-LE)?[_/-](\d+\.\d+)'),
('debian', lambda m: m.group(1), 'Debian (\d+\.\d+)'),
('ubuntu', lambda m: m.group(2), '[Uu]buntu(-Server)? (\d+\.\d+)'),
('fedora', lambda m: m.group(1), 'Fedora[ -](\d+)'),
--
1.9.1
9 years, 9 months
[kimchi-devel][PATCH 0/2] Peer discovery fixes
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Royce Lv (2):
Update doc for federation
Deregister peer information when kimchid exit
docs/README-federation.md | 4 +++-
src/kimchi/model/peers.py | 12 ++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
--
1.9.1
9 years, 9 months
[PATCH] Assign HTML labels to their corresponding elements
by Crístian Viana
Somea UI form fields have labels which aren't assigned to those fields,
which makes it more difficult to click and interact with them.
Assign the labels to their corresponding elements, so when the user
clicks on a label, the element also receives the click event. Also, some
indentation levels have been changed.
The elements which have their labels assigned to are:
- The text box where the user types the file path in "New Template" >
"Local image file";
- All form elements in "Templates" > "Actions" > "Edit", tab
"Processor";
- The checkbox used to select a device in "Storage pools" > "Actions" >
"Extend";
Signed-off-by: Crístian Viana <vianac(a)linux.vnet.ibm.com>
---
ui/pages/tabs/storage.html.tmpl | 2 +-
ui/pages/template-add.html.tmpl | 4 +++-
ui/pages/template-edit.html.tmpl | 20 ++++++++++++++++----
3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/ui/pages/tabs/storage.html.tmpl b/ui/pages/tabs/storage.html.tmpl
index dbbaef9..6af7327 100644
--- a/ui/pages/tabs/storage.html.tmpl
+++ b/ui/pages/tabs/storage.html.tmpl
@@ -128,7 +128,7 @@
</script>
<script id="logicalPoolExtendTmpl" type="html/text">
<div>
- <input type="checkbox" value="{path}" name="devices">
+ <input type="checkbox" value="{path}" name="devices" id="{name}">
<label for="{name}">{path}</label>
</div>
</script>
diff --git a/ui/pages/template-add.html.tmpl b/ui/pages/template-add.html.tmpl
index eaafaa7..3b82c6c 100644
--- a/ui/pages/template-add.html.tmpl
+++ b/ui/pages/template-add.html.tmpl
@@ -130,7 +130,9 @@
<h2 class="step-title">$_("Local Image File")</h2>
</header>
<div class="body">
- <span>File Path:</span><input type="text"><button class="ui-button-primary">$_("Create")</button>
+ <label for="vm-image-local-text">File Path:</label>
+ <input type="text" id="vm-image-local-text" />
+ <button class="ui-button-primary">$_("Create")</button>
</div>
</div>
diff --git a/ui/pages/template-edit.html.tmpl b/ui/pages/template-edit.html.tmpl
index 7177bf0..3a84870 100644
--- a/ui/pages/template-edit.html.tmpl
+++ b/ui/pages/template-edit.html.tmpl
@@ -118,11 +118,23 @@
<div class="template-tab-body"></div>
</form>
<form id="form-template-processor">
- <div>$_("CPU Number"):<input type="text" value="1" id="cpus"></div>
- <div class="manual"><input type="checkbox">$_("Manually set CPU topology")</div>
+ <div>
+ <label for="cpus">$_("CPU Number"):</label>
+ <input type="text" value="1" id="cpus" />
+ </div>
+ <div class="manual">
+ <input type="checkbox" id="cpus-check" />
+ <label for="cpus-check">$_("Manually set CPU topology")</label>
+ </div>
<div class="topology hide">
- <div>$_("Cores"):<input type="text" value="1" id="cores"></div>
- <div>$_("Threads"):<select id="threads"></select></div>
+ <div>
+ <label for="cores">$_("Cores"):</label>
+ <input type="text" value="1" id="cores" />
+ </div>
+ <div>
+ <label for="threads">$_("Threads"):</label>
+ <select id="threads"></select>
+ </div>
</div>
</form>
</div>
--
2.1.0
9 years, 9 months