[PATCHv1 0/5] Storagevolume upload
by lvroyce0210@gmail.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Change storage volumes create to return task so that upload and download can
fit in this frame.
Limit upload size to 4GB, update uploading progress in task message during
writing.
Royce Lv (5):
Storage volume upload: Dispatch volume create to right handler
Storage volume upload: Change storagevolumes to AsyncCollection
Storage volume upload: Parse params for upload formdata
Storage volume upload: Support file based upload
Storage volume upload: Adding progress to task message
src/kimchi/control/storagevolumes.py | 4 +--
src/kimchi/control/utils.py | 4 ++-
src/kimchi/i18n.py | 3 ++
src/kimchi/model/storagevolumes.py | 63 ++++++++++++++++++++++++++++++++++--
tests/test_model.py | 8 +++--
tests/test_rest.py | 9 ++++--
6 files changed, 81 insertions(+), 10 deletions(-)
--
1.8.3.2
10 years, 3 months
[V2] UI: List Kimchi Peers
by huoyuxin@linux.vnet.ibm.com
From: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
Signed-off-by: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
---
ui/css/theme-default/topbar.css | 36 +++++++++++++++++++++++++++++++++++-
ui/js/src/kimchi.api.js | 14 ++++++++++++++
ui/js/src/kimchi.main.js | 14 ++++++++++++++
ui/pages/kimchi-ui.html.tmpl | 10 ++++++++++
4 files changed, 73 insertions(+), 1 deletions(-)
diff --git a/ui/css/theme-default/topbar.css b/ui/css/theme-default/topbar.css
index bed4e19..127c56a 100644
--- a/ui/css/theme-default/topbar.css
+++ b/ui/css/theme-default/topbar.css
@@ -114,7 +114,7 @@
cursor: pointer;
display: block;
position: relative;
- height: 48px;
+ height: 52px;
margin: 0 12px;
}
@@ -174,3 +174,37 @@ a#btn-logout:hover {
display: none;
}
}
+
+.peers {
+ color: white;
+ cursor: pointer;
+ height: 52px;
+ margin: 0 12px;
+}
+
+.peers span {
+ margin-top: 25px;
+}
+
+.peers .arrow {
+ border: 6px solid transparent;
+ border-bottom: none;
+ border-top-color: white;
+ display: inline-block;
+ width: 0;
+}
+
+.peers .drowdown {
+ top: 45px;
+ right: 110px;
+ color: black;
+ padding: 10px 15px;
+ white-space: nowrap;
+ line-height: 12px;
+ width: inherit;
+}
+
+.peers .drowdown a {
+ display: block;
+ padding: 10px;
+}
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 4562992..8966cff 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -1098,5 +1098,19 @@ var kimchi = {
kimchi.message.error(data.responseJSON.reason);
}
});
+ },
+
+ getPeers : function(suc, err) {
+ kimchi.requestJSON({
+ url : kimchi.url + 'peers',
+ type : 'GET',
+ contentType : 'application/json',
+ dataType : 'json',
+ resend : true,
+ success : suc,
+ error : err ? err : function(data) {
+ kimchi.message.error(data.responseJSON.reason);
+ }
+ });
}
};
diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js
index ba54b26..21ffca7 100644
--- a/ui/js/src/kimchi.main.js
+++ b/ui/js/src/kimchi.main.js
@@ -20,10 +20,24 @@ kimchi.tabMode = {};
kimchi.capabilities = undefined;
kimchi.getCapabilities(function(result) {
kimchi.capabilities = result;
+ kimchi.setupPeers();
}, function() {
kimchi.capabilities = {};
});
+kimchi.setupPeers = function(){
+ if(kimchi.capabilities.federation=="on"){
+ $('#peers').removeClass('hide-content');
+ kimchi.getPeers(function(data){
+ var hints = $('p', $('.drowdown', '#peers'));
+ data.length==0 ? hints.toggleClass('hide-content'): hints.addClass('hide-content');
+ for(var i=0; i<data.length; i++){
+ $('.drowdown', '#peers').append("<a href='"+data[i]+"' target='_blank'>"+data[i]+"</a>");
+ }
+ });
+ }
+};
+
kimchi.main = function() {
kimchi.popable();
diff --git a/ui/pages/kimchi-ui.html.tmpl b/ui/pages/kimchi-ui.html.tmpl
index 7bdf441..867ee36 100644
--- a/ui/pages/kimchi-ui.html.tmpl
+++ b/ui/pages/kimchi-ui.html.tmpl
@@ -71,6 +71,16 @@
<h1 id="logo"><img alt="Project Kimchi" src="images/theme-default/logo-white.png"></h1>
<ul class="nav-top">
<li>
+ <div id="peers" class="peers hide-content popable">
+ <span>$_("Peers")</span>
+ <span class="arrow"></span>
+ <div class="drowdown popover right-side">
+ <p>$_("Searching")...</p>
+ <p class="hide-content">$_("No peers found.")</p>
+ </div>
+ </div>
+ </li>
+ <li>
<div id="user" class="popable">
<span id="user-icon"></span>
<span id="user-name" class="empty-when-logged-off"></span>
--
1.7.1
10 years, 3 months
[PATCH 0/6 V3] Discover Kimchi peers using openSLP
by Aline Manera
V2 -> V3:
- Use self.url while registering server on openSLP
V1 -> V2:
- Update docs/API.md
- Expose federation on /config/capabilities
Aline Manera (6):
Update kimchi.config values according to command line input
Delete http_port from /config API as it is not in use anymore
Add federation option to Kimchi config file
Discover Kimchi peers using openSLP
Add documentation on how to enable federation on Kimchi
Expose federation on /config/capabilities
docs/API.md | 11 ++++++++-
docs/README-federation.md | 27 +++++++++++++++++++++
src/kimchi.conf.in | 4 +++
src/kimchi/config.py.in | 1 +
src/kimchi/control/peers.py | 29 ++++++++++++++++++++++
src/kimchi/mockmodel.py | 14 ++++++++---
src/kimchi/model/config.py | 6 ++---
src/kimchi/model/peers.py | 59 +++++++++++++++++++++++++++++++++++++++++++++
src/kimchi/server.py | 1 -
src/kimchid.in | 36 +++++++++++++++++----------
tests/test_rest.py | 19 +++++++++------
11 files changed, 177 insertions(+), 30 deletions(-)
create mode 100644 docs/README-federation.md
create mode 100644 src/kimchi/control/peers.py
create mode 100644 src/kimchi/model/peers.py
--
1.9.3
10 years, 3 months
[PATCH 0/2] Fix attaching iscsi storage volume
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Iscsi volume fails to attach to vm because of its path is rejected
by previous cdrom validate logic,
and type 'unknown' forms wrong vm xml
This patchset fix the above bugs and form right vm xml in order to
start vm.
Royce Lv (2):
Guest storage: Fix attaching type judgement
Guest storage: fix volume format overwrite
src/kimchi/model/vmstorages.py | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
--
1.8.3.2
10 years, 3 months
[PATCH] Fix sample plugin configuration
by Aline Manera
Since the authorization method changed, kimchiauth() does not accept any
parameter. The admin methods should be listed on Collection and
Resource elements.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
plugins/sample/__init__.py | 2 ++
plugins/sample/sample.conf.in | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/sample/__init__.py b/plugins/sample/__init__.py
index 4aca4e0..10c244c 100644
--- a/plugins/sample/__init__.py
+++ b/plugins/sample/__init__.py
@@ -64,12 +64,14 @@ class Circles(Collection):
def __init__(self, model):
super(Circles, self).__init__(model)
self.resource = Circle
+ self.admin_methods = ['POST', 'PUT']
class Rectangles(Collection):
def __init__(self, model):
super(Rectangles, self).__init__(model)
self.resource = Rectangle
+ self.admin_methods = ['POST', 'PUT']
class Circle(Resource):
diff --git a/plugins/sample/sample.conf.in b/plugins/sample/sample.conf.in
index 6e0908b..cf42467 100644
--- a/plugins/sample/sample.conf.in
+++ b/plugins/sample/sample.conf.in
@@ -17,8 +17,6 @@ tools.kimchiauth.on = True
[/rectangles]
tools.kimchiauth.on = True
-tools.kimchiauth.admin_methods = ['POST', 'PUT']
[/circles]
tools.kimchiauth.on = True
-tools.kimchiauth.admin_methods = ['POST', 'PUT']
--
1.9.3
10 years, 3 months
[V4] UI: List iSCSI Servers & Targets
by huoyuxin@linux.vnet.ibm.com
From: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
Signed-off-by: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
---
ui/css/theme-default/form.css | 2 +-
ui/css/theme-default/storage.css | 31 +++++++++-
ui/js/src/kimchi.api.js | 20 ++++++-
ui/js/src/kimchi.storagepool_add_main.js | 95 +++++++++++++++++++++++++++++-
ui/pages/i18n.json.tmpl | 3 +
ui/pages/storagepool-add.html.tmpl | 12 +++-
6 files changed, 156 insertions(+), 7 deletions(-)
diff --git a/ui/css/theme-default/form.css b/ui/css/theme-default/form.css
index d98cf9e..9a442fb 100644
--- a/ui/css/theme-default/form.css
+++ b/ui/css/theme-default/form.css
@@ -45,7 +45,7 @@
.form-section input.invalid-field[type="text"] {
- border-color: #FF4444;
+ border-color: #FF4444!important;
}
.text-help {
diff --git a/ui/css/theme-default/storage.css b/ui/css/theme-default/storage.css
index 4f439e8..ab92de2 100644
--- a/ui/css/theme-default/storage.css
+++ b/ui/css/theme-default/storage.css
@@ -315,7 +315,7 @@
}
.hide-content {
- display: none;
+ display: none!important;
}
.volumeslist {
@@ -593,3 +593,32 @@
center no-repeat;
padding: 0 20px 0 26px;
}
+
+.storage-admin .filter-select {
+ display: inline-block;
+ position: relative;
+}
+
+#iscsiportId, .storage-admin .filter-select input {
+ border: 1px solid #CCCCCC;
+ border-radius: 1px;
+ font-size: 14px;
+ padding: 3px 3px 3px 10px;
+ height: 30px;
+}
+
+.storage-admin .filter-select input::-ms-clear {
+ display: none;
+}
+
+#iSCSIServer input {
+ width: 410px;
+}
+
+#iscsiportId {
+ width: 60px;
+}
+
+#iSCSITarget input {
+ width: 493px;
+}
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 4562992..bc43881 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -774,7 +774,9 @@ var kimchi = {
contentType : 'application/json',
dataType : 'json',
success : suc,
- error : err
+ error : err ? err : function(data) {
+ kimchi.message.error(data.responseJSON.reason);
+ }
});
},
@@ -1098,5 +1100,21 @@ var kimchi = {
kimchi.message.error(data.responseJSON.reason);
}
});
+ },
+
+ getISCSITargets : function(server, port, suc, err) {
+ server = encodeURIComponent(server);
+ port = port ? '&_server_port='+encodeURIComponent(port) : '';
+ kimchi.requestJSON({
+ url : kimchi.url + 'storageservers/'+server+'/storagetargets?_target_type=iscsi'+port,
+ type : 'GET',
+ contentType : 'application/json',
+ dataType : 'json',
+ resend : true,
+ success : suc,
+ error : err ? err : function(data) {
+ kimchi.message.error(data.responseJSON.reason);
+ }
+ });
}
};
diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js
index ecbc682..618892d 100644
--- a/ui/js/src/kimchi.storagepool_add_main.js
+++ b/ui/js/src/kimchi.storagepool_add_main.js
@@ -34,6 +34,93 @@ kimchi.storagepool_add_main = function() {
});
};
+kimchi.storageFilterSelect = function(id, isUpdate) {
+ var input = $('input', '#'+id);
+ var options = $(".option", '#'+id);
+ var filter = function(container, key){
+ container.children().each(function(){
+ $(this).css("display", $(this).text().indexOf(key)==-1 ? "none" : "");
+ });
+ };
+ if(!isUpdate){
+ input.on("keyup", function(){
+ filter(options, input.val());
+ });
+ }
+ options.children().each(function(){
+ $(this).click(function(){
+ options.children().removeClass("active");
+ input.val($(this).text());
+ input.trigger("change");
+ $(this).addClass("active");
+ filter(options, "");
+ });
+ });
+};
+
+kimchi.setupISCSI = function(){
+ var loadTargets = function(server, port, callback){
+ var isUpdate = $(".option", "#iSCSITarget").children().length > 0;
+ $(".option", "#iSCSITarget").empty();
+ $('input', "#iSCSITarget").attr("placeholder", i18n['KCHPOOL6006M']);
+ kimchi.getISCSITargets(server, port, function(data){
+ if(data.length==0){
+ $('input', "#iSCSITarget").attr("placeholder", i18n['KCHPOOL6007M']);
+ }else{
+ for(var i=0; i<data.length; i++){
+ var itemNode = $.parseHTML("<li>"+data[i].target+"</li>");
+ $(".option", "#iSCSITarget").append(itemNode);
+ }
+ $('input', "#iSCSITarget").attr("placeholder", "");
+ $(".popover", "#iSCSITarget").css("display", "block");
+ }
+ kimchi.storageFilterSelect('iSCSITarget', isUpdate);
+ $('input', "#iSCSITarget").trigger("focus");
+ callback();
+ }, function(data){
+ $('input', "#iSCSITarget").attr("placeholder", i18n['KCHPOOL6008M']);
+ callback();
+ kimchi.message.error(data.responseJSON.reason);
+ });
+ };
+ var triggerLoadTarget = function(){
+ $('input', "#iSCSITarget").val("");
+ var server = $("#iscsiserverId").val().trim();
+ var port = $("#iscsiportId").val().trim();
+ if(server!="" && !$("#iscsiserverId").hasClass("invalid-field") && !$("#iscsiportId").hasClass("invalid-field")){
+ $("#iscsiserverId").attr("disabled", true);
+ $("#iscsiportId").attr("disabled", true);
+ loadTargets(server, port, function(){
+ $("#iscsiserverId").attr("disabled", false);
+ $("#iscsiportId").attr("disabled", false);
+ });
+ }
+ };
+ $("#iscsiserverId").change(function(){
+ $('input', "#iSCSITarget").off('focus', triggerLoadTarget);
+ $('input', "#iSCSITarget").one('focus', triggerLoadTarget);
+ });
+ $("#iscsiportId").change(function(){
+ $('input', "#iSCSITarget").off('focus', triggerLoadTarget);
+ $('input', "#iSCSITarget").one('focus', triggerLoadTarget);
+ });
+ var initISCSIServers = function(){
+ kimchi.getStorageServers("iscsi", function(data){
+ for(var i=0;i<data.length;i++){
+ var itemNode = $.parseHTML("<li>"+data[i].host+"</li>");
+ $(".option", "#iSCSIServer").append(itemNode);
+ $(itemNode).click(function(){
+ $("#iscsiportId").val($(this).prop("port"));
+ $("#iscsiserverId").val($(this).text());
+ triggerLoadTarget();
+ }).prop("port", data[i].port);
+ }
+ kimchi.storageFilterSelect('iSCSIServer', false);
+ });
+ };
+ initISCSIServers();
+};
+
kimchi.initStorageAddPage = function() {
kimchi.listHostPartitions(function(data) {
if (data.length > 0) {
@@ -158,8 +245,14 @@ kimchi.initStorageAddPage = function() {
}
});
$('#iscsiportId').keyup(function(event) {
- $(this).toggleClass("invalid-field",!/^[0-9]+$/.test($(this).val()));
+ $(this).toggleClass("invalid-field",!/^[0-9]*$/.test($(this).val()));
+ });
+ $('#iscsiserverId').keyup(function(event) {
+ $(this).toggleClass("invalid-field",!kimchi.isServer($(this).val().trim()));
+ }).change(function(event) {
+ $(this).toggleClass("invalid-field",!kimchi.isServer($(this).val().trim()));
});
+ kimchi.setupISCSI();
};
/* Returns 'true' if all form fields were filled, 'false' if
diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl
index fc5d5e4..d920ae2 100644
--- a/ui/pages/i18n.json.tmpl
+++ b/ui/pages/i18n.json.tmpl
@@ -152,6 +152,9 @@
"KCHPOOL6003M": "$_("It will format your disk and you will loose any data in there, are you sure to continue? ")",
"KCHPOOL6004M": "$_("SCSI Fibre Channel")",
"KCHPOOL6005M": "$_("No SCSI adapters found.")",
+ "KCHPOOL6006M": "$_("loading targets...")",
+ "KCHPOOL6007M": "$_("no targets is got, please input one.")",
+ "KCHPOOL6008M": "$_("failed to load targets.")",
"KCHPOOL6001E": "$_("The storage pool name can not be blank.")",
"KCHPOOL6002E": "$_("The storage pool path can not be blank.")",
diff --git a/ui/pages/storagepool-add.html.tmpl b/ui/pages/storagepool-add.html.tmpl
index 1eb2029..6f1861b 100644
--- a/ui/pages/storagepool-add.html.tmpl
+++ b/ui/pages/storagepool-add.html.tmpl
@@ -23,7 +23,7 @@
<!DOCTYPE html>
<html>
<body>
- <div class="window storage-window">
+ <div class="window storage-window storage-admin">
<header>
<h1 class="title">$_("Define a New Storage Pool")</h1>
<div class="close">X</div>
@@ -111,7 +111,10 @@
<div class="field">
<p class="text-help">
$_("iSCSI server IP or hostname. It should not be empty.")</p>
- <input id="iscsiserverId" placeholder="$_("Server")" type="text" class="text storage-base-input-width">
+ <span class="filter-select popable" id="iSCSIServer">
+ <input id="iscsiserverId" type="text" placeholder="$_("Server")">
+ <div class="popover"><ul class="option select-list"></ul></div>
+ </span>
<input id="iscsiportId" placeholder="$_("Port")" type="text" class="text storage-port-width" maxlength="4">
</div>
</section>
@@ -119,7 +122,10 @@
<h2>4. $_("Target")</h2>
<div class="field">
<p class="text-help">$_("The iSCSI target on iSCSI server")</p>
- <input id="iscsiTargetId" type="text" class="text storage-base-input-width">
+ <span class="filter-select popable" id="iSCSITarget">
+ <input id="iscsiTargetId" type="text">
+ <div class="popover"><ul class="option select-list"></ul></div>
+ </span>
</div>
</section>
<section class="form-section">
--
1.7.1
10 years, 3 months
[PATCH 0/6 V2] Discover Kimchi peers using openSLP
by Aline Manera
v1 -> V2:
- Update docs/API.md
- Expose federation on /config/capabilities
Aline Manera (6):
Update kimchi.config values according to command line input
Delete http_port from /config API as it is not in use anymore
Add federation option to Kimchi config file
Discover Kimchi peers using openSLP
Add documentation on how to enable federation on Kimchi
Expose federation on /config/capabilities
docs/API.md | 11 ++++++++-
docs/README-federation.md | 27 +++++++++++++++++++++
src/kimchi.conf.in | 4 +++
src/kimchi/config.py.in | 1 +
src/kimchi/control/peers.py | 29 ++++++++++++++++++++++
src/kimchi/mockmodel.py | 14 ++++++++---
src/kimchi/model/config.py | 6 ++---
src/kimchi/model/peers.py | 59 +++++++++++++++++++++++++++++++++++++++++++++
src/kimchi/server.py | 1 -
src/kimchid.in | 36 +++++++++++++++++----------
tests/test_rest.py | 19 +++++++++------
11 files changed, 177 insertions(+), 30 deletions(-)
create mode 100644 docs/README-federation.md
create mode 100644 src/kimchi/control/peers.py
create mode 100644 src/kimchi/model/peers.py
--
1.9.3
10 years, 3 months
[PATCH] bug fix: Properly get the graphics expiration time
by Aline Manera
The data structure to graphics is:
{
graphics: {'passwd': '12345', 'passwdValidTo': 30}
}
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/kimchi/model/vms.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index fb4cf22..8045b1e 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -321,7 +321,7 @@ class VMModel(object):
if password is not None:
graphics.attrib['passwd'] = password
- expire = params.get("passwdValidTo")
+ expire = params['graphics'].get("passwdValidTo")
to = graphics.attrib.get('passwdValidTo')
if to is not None:
if (time.mktime(time.strptime(to, '%Y-%m-%dT%H:%M:%S'))
--
1.9.3
10 years, 3 months
[PATCH] model.host: changing listDevices() to listAllDevices()
by Daniel Henrique Barboza
The method listDevices() has unexpected behavior in certain
situations and architectures. According the libvirt API,
listAllDevices() delivers more control over the results and
it does not present the same problems.
For those reasons, this commit changes all the occurences of
listDevices() to use listAllDevices() instead.
Signed-off-by: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
---
src/kimchi/model/host.py | 33 ++++++++++++++++++++++++---------
1 file changed, 24 insertions(+), 9 deletions(-)
diff --git a/src/kimchi/model/host.py b/src/kimchi/model/host.py
index 39f45d8..553ad7c 100644
--- a/src/kimchi/model/host.py
+++ b/src/kimchi/model/host.py
@@ -18,6 +18,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import grp
+import libvirt
import os
import time
import platform
@@ -277,31 +278,45 @@ class PartitionModel(object):
class DevicesModel(object):
def __init__(self, **kargs):
self.conn = kargs['conn']
+ self.cap_map = \
+ {'fc_host': libvirt.VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST,
+ 'net': libvirt.VIR_CONNECT_LIST_NODE_DEVICES_CAP_NET,
+ 'pci': libvirt.VIR_CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV,
+ 'scsi': libvirt.VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI,
+ 'scsi_host': libvirt.VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_HOST,
+ 'storage': libvirt.VIR_CONNECT_LIST_NODE_DEVICES_CAP_STORAGE,
+ 'usb_device': libvirt.VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_DEV,
+ 'usb':
+ libvirt.VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_INTERFACE}
def get_list(self, _cap=None):
+ if _cap == 'fc_host':
+ return self._get_devices_fc_host()
+ return self._get_devices_with_capability(_cap)
+
+ def _get_devices_with_capability(self, cap):
conn = self.conn.get()
- if _cap is None:
- dev_names = [name.name() for name in conn.listAllDevices(0)]
- elif _cap == 'fc_host':
- dev_names = self._get_devices_fc_host()
+ if cap is None:
+ cap_flag = 0
else:
- # Get devices with required capability
- dev_names = conn.listDevices(_cap, 0)
- return dev_names
+ cap_flag = self.cap_map.get(cap)
+ if cap_flag is None:
+ return []
+ return [name.name() for name in conn.listAllDevices(cap_flag)]
def _get_devices_fc_host(self):
conn = self.conn.get()
# Libvirt < 1.0.5 does not support fc_host capability
if not CapabilitiesModel().fc_host_support:
ret = []
- scsi_hosts = conn.listDevices('scsi_host', 0)
+ scsi_hosts = self._get_devices_with_capability('scsi_host')
for host in scsi_hosts:
xml = conn.nodeDeviceLookupByName(host).XMLDesc(0)
path = '/device/capability/capability/@type'
if 'fc_host' in xmlutils.xpath_get_text(xml, path):
ret.append(host)
return ret
- return conn.listDevices('fc_host', 0)
+ return self._get_devices_with_capability('fc_host')
class DeviceModel(object):
--
1.8.3.1
10 years, 3 months
[PATCH] bug fix: Auto-generate guest console password when the passed value is an empty string
by Aline Manera
As the password will be an empty string we need to check if its value is
not None, otherwise the password will not be generated.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/kimchi/model/vms.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index e91c0ed..d8a02cd 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -312,7 +312,7 @@ class VMModel(object):
return xml
password = params['graphics'].get("passwd")
- if password and len(password.strip()) == 0:
+ if password is not None and len(password.strip()) == 0:
password = "".join(random.sample(string.ascii_letters +
string.digits, 8))
--
1.9.3
10 years, 3 months