[PATCH V2] Fix content of the SW update list after disable a repository.
by Rodrigo Trujillo
From: Paulo Vital <pvital(a)linux.vnet.ibm.com>
Kimchi lists all RPM packages to be updated when the Host tab is
selected, but even after disable some YUM repository and refresh the
content of this tab, the previous packages from the disabled repository
are still present in list.
This patch "deletes" the YumBase object after get the list of packages
to be updated. With this, every time the Host tab is selected, a new
list will be generated.
Signed-off-by: Paulo Vital <pvital(a)linux.vnet.ibm.com>
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/swupdate.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/kimchi/swupdate.py b/src/kimchi/swupdate.py
index 85cdfd6..40af8f3 100644
--- a/src/kimchi/swupdate.py
+++ b/src/kimchi/swupdate.py
@@ -154,6 +154,7 @@ class YumUpdate(object):
yb.doLock()
self._pkgs = yb.doPackageLists('updates')
yb.doUnlock()
+ del yb
except Exception, e:
kimchiLock.release()
raise OperationFailed('KCHPKGUPD0003E', {'err': str(e)})
--
1.9.3
10 years
[PATCH V2] storagepool-add: showing Fibre Channel devices
by Rodrigo Trujillo
From: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
Fixing a problem in the JS files where getHostPCIDevices
was being used to show the FC devices.
Signed-off-by: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.api.js | 2 +-
ui/js/src/kimchi.storagepool_add_main.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index ebf826b..6ac2df3 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -1018,7 +1018,7 @@ var kimchi = {
});
},
- getHostPCIDevices: function(suc, err) {
+ getHostFCDevices: function(suc, err) {
var url = kimchi.url+'host/devices?_cap=fc_host';
kimchi.requestJSON({
url : url,
diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js
index ffe8fb6..5ef84af 100644
--- a/ui/js/src/kimchi.storagepool_add_main.js
+++ b/ui/js/src/kimchi.storagepool_add_main.js
@@ -142,7 +142,7 @@ kimchi.initStorageAddPage = function() {
$('.host-partition').addClass('text-help');
});
- kimchi.getHostPCIDevices(function(data){
+ kimchi.getHostFCDevices(function(data){
if(data.length>0){
for(var i=0;i<data.length;i++){
data[i].label = data[i].name;
--
1.9.3
10 years
[PATCH V2] Add PPC console configuration to guest XML
by Rodrigo Trujillo
When creating a VM from template, add PPC console configuration to xml.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/vmtemplate.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index 4e5806f..20df6c2 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -370,6 +370,16 @@ class VMTemplate(object):
</devices>
</domain>
""" % params
+
+ # Adding PPC console configuration
+ if params['arch'] in ['ppc', 'ppc64']:
+ ppc_console = """<memballoon model='virtio' />
+ <console type='pty'>
+ <target type='serial' port='1'/>
+ <address type='spapr-vio' reg='0x30001000'/>
+ </console>"""
+ xml = xml.replace("<memballoon model='virtio' />", ppc_console)
+
return xml
def validate(self):
--
1.9.3
10 years
[PATCH] Add PPC console configuration to guest XML
by Rodrigo Trujillo
When creating a VM from template, add PPC console configuration to xml.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/vmtemplate.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index cfc46f6..d18fc59 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -409,6 +409,16 @@ drive=drive-%(bus)s0-1-0,id=%(bus)s0-1-0'/>
</devices>
</domain>
""" % params
+
+ # Adding PPC console configuration
+ if params['arch'] in ['ppc', 'ppc64']:
+ ppc_console = """<memballoon model='virtio' />
+ <console type='pty'>
+ <target type='serial' port='1'/>
+ <address type='spapr-vio' reg='0x30001000'/>
+ </console>"""
+ xml = xml.replace("<memballoon model='virtio' />", ppc_console)
+
return xml
def validate(self):
--
1.9.3
10 years
[PATCHv2 0/7] LDAP authentication and authorization
by lvroyce0210@gmail.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Royce Lv (7):
Add configuration of LDAP
Split PAM and LDAP authentication
Add LDAP authentication
Fix test cases for authentication
Split users and groups for permission query
Move validation to user and host
change vm permission tag
contrib/DEBIAN/control.in | 1 +
contrib/kimchi.spec.fedora.in | 1 +
contrib/kimchi.spec.suse.in | 1 +
docs/README.md | 12 ++--
src/kimchi.conf.in | 17 +++++
src/kimchi/auth.py | 157 +++++++++++++++++++++++++++++++-----------
src/kimchi/config.py.in | 5 ++
src/kimchi/control/host.py | 7 ++
src/kimchi/i18n.py | 1 +
src/kimchi/model/host.py | 97 +++++++++++++++++++++++++-
src/kimchi/model/vms.py | 38 +++++-----
tests/utils.py | 43 ++++++++----
12 files changed, 303 insertions(+), 77 deletions(-)
--
1.8.3.2
10 years
[PATCH 0/3] Fixes on featuretests.py
by Aline Manera
It is needed to make mockmodel uses model with 'test:///default' URI
Aline Manera (3):
Update FeatureTests to use the same libvirt connection used by Model
Set domain type in FeatureTests according libvirt URI
Move featuretests.py to /model
src/kimchi/featuretests.py | 217 ---------------------------------------
src/kimchi/model/config.py | 12 ++-
src/kimchi/model/featuretests.py | 210 +++++++++++++++++++++++++++++++++++++
src/kimchi/model/utils.py | 2 +-
4 files changed, 218 insertions(+), 223 deletions(-)
delete mode 100644 src/kimchi/featuretests.py
create mode 100644 src/kimchi/model/featuretests.py
--
1.9.3
10 years
[PATCH] Adding 'link_detected' to netinfo.py
by Daniel Henrique Barboza
'Link_detected' returns 'yes' if the network card is attached
to a cable (or other media), 'no' if it's disconnected and
'n/a' if the link state can't be determined (if the network
interface is down).
This is an information that might be useful for some
plug-ins - Ginger, for instance - to present to the user.
Example of the updated netinfo.get_interface_info call:
$ sudo PYTHONPATH=src python
Python 2.7.5 (default, Sep 25 2014, 13:52:19)
[GCC 4.8.3 20140624 (Red Hat 4.8.3-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from kimchi import netinfo
>>> netinfo.get_interface_info('em1')
{'status': 'active', 'name': 'em1', 'ipaddr': '', 'netmask': '', 'link_detected': 'no', 'type': 'nic'}
---- with em1 interface down -----
>>> netinfo.get_interface_info('em1')
{'status': 'inactive', 'name': 'em1', 'ipaddr': '', 'netmask': '', 'link_detected': 'n/a', 'type': 'nic'}
>>>
Daniel Henrique Barboza (1):
netinfo.py: adding 'link_detected' to get_interface_info
src/kimchi/netinfo.py | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
--
1.8.3.1
10 years
[PATCH] Create common function to generate interface guest XML
by Aline Manera
And use it on vmtemplate.py and model/vmifaces.py to make sure in both
cases the same XML structure will be used.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/kimchi/model/vmifaces.py | 19 +++++-----------
src/kimchi/vmtemplate.py | 29 ++++++------------------
src/kimchi/xmlutils/interface.py | 49 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 62 insertions(+), 35 deletions(-)
create mode 100644 src/kimchi/xmlutils/interface.py
diff --git a/src/kimchi/model/vmifaces.py b/src/kimchi/model/vmifaces.py
index 721bf14..87ada6d 100644
--- a/src/kimchi/model/vmifaces.py
+++ b/src/kimchi/model/vmifaces.py
@@ -21,10 +21,10 @@ import random
import libvirt
from lxml import etree, objectify
-from lxml.builder import E
from kimchi.exception import InvalidOperation, InvalidParameter, NotFoundError
from kimchi.model.vms import DOM_STATE_MAP, VMModel
+from kimchi.xmlutils.interface import get_iface_xml
class VMIfacesModel(object):
@@ -53,22 +53,15 @@ class VMIfacesModel(object):
for iface in self.get_vmifaces(vm, self.conn))
while True:
- mac = VMIfacesModel.random_mac()
- if mac not in macs:
+ params['mac'] = VMIfacesModel.random_mac()
+ if params['mac'] not in macs:
break
- children = [E.mac(address=mac)]
- ("network" in params.keys() and
- children.append(E.source(network=params['network'])))
- ("model" in params.keys() and
- children.append(E.model(type=params['model'])))
- attrib = {"type": params["type"]}
-
- xml = etree.tostring(E.interface(*children, **attrib))
-
+ os_distro, os_version = VMModel.vm_get_os_metadata(dom)
+ xml = get_iface_xml(params, conn.getInfo()[0], os_distro, os_version)
dom.attachDeviceFlags(xml, libvirt.VIR_DOMAIN_AFFECT_CURRENT)
- return mac
+ return params['mac']
@staticmethod
def get_vmifaces(vm, conn):
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index 4e5806f..25f1994 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -23,7 +23,6 @@ import time
import urlparse
import uuid
-from distutils.version import LooseVersion
from lxml import etree
from lxml.builder import E
@@ -33,6 +32,7 @@ from kimchi.imageinfo import probe_image, probe_img_info
from kimchi.isoinfo import IsoImage
from kimchi.utils import check_url_path, pool_name_from_uri
from kimchi.xmlutils.disk import get_disk_xml
+from kimchi.xmlutils.interface import get_iface_xml
from kimchi.xmlutils.qemucmdline import get_qemucmdline_xml
@@ -239,30 +239,15 @@ class VMTemplate(object):
ret.append(info)
return ret
- def _disable_vhost(self):
- # Hack to disable vhost feature in Ubuntu LE and SLES LE (PPC)
- driver = ""
- if self.info['arch'] == 'ppc64' and \
- ((self.info['os_distro'] == 'ubuntu' and LooseVersion(
- self.info['os_version']) >= LooseVersion('14.04')) or
- (self.info['os_distro'] == 'sles' and LooseVersion(
- self.info['os_version']) >= LooseVersion('12'))):
- driver = " <driver name='qemu'/>\n "
- return driver
-
def _get_networks_xml(self):
- network = """
- <interface type='network'>
- <source network='%(network)s'/>
- <model type='%(nic_model)s'/>
- %(driver)s</interface>
- """
networks = ""
- net_info = {"nic_model": self.info['nic_model'],
- "driver": self._disable_vhost()}
+ params = {'type': 'network',
+ 'model': self.info['nic_model']}
for nw in self.info['networks']:
- net_info['network'] = nw
- networks += network % net_info
+ params['network'] = nw
+ networks += get_iface_xml(params, self.info['arch'],
+ self.info['os_distro'],
+ self.info['os_version'])
return networks
def _get_input_output_xml(self):
diff --git a/src/kimchi/xmlutils/interface.py b/src/kimchi/xmlutils/interface.py
new file mode 100644
index 0000000..c76131a
--- /dev/null
+++ b/src/kimchi/xmlutils/interface.py
@@ -0,0 +1,49 @@
+#
+# Project Kimchi
+#
+# Copyright IBM, Corp. 2014
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+import lxml.etree as ET
+
+from distutils.version import LooseVersion
+from lxml.builder import E
+
+
+def get_iface_xml(params, arch=None, os_distro=None, os_version=None):
+ """
+ <interface type='network'>
+ <source network='default'/>
+ <model type='virtio'/>
+ </interface>
+ """
+ interface = E.interface(type=params['type'])
+ interface.append(E.source(network=params['network']))
+ interface.append(E.model(type=params['model']))
+
+ mac = params.get('mac', None)
+ if mac is not None:
+ interface.append(E.mac(address=mac))
+
+ # Hack to disable vhost feature in Ubuntu LE and SLES LE (PPC)
+ if arch == 'ppc64' and \
+ ((os_distro == 'ubuntu' and
+ LooseVersion(os_version) >= LooseVersion('14.04')) or
+ (os_distro == 'sles' and
+ LooseVersion(os_version >= LooseVersion('12')))):
+ interface.append(E.driver(name='qemu'))
+
+ return ET.tostring(interface, encoding='utf-8', pretty_print=True)
--
1.9.3
10 years
[PATCH] Use lxml to generate graphics XML and update VMTemplate to use it
by Aline Manera
Create a new module xmlutils/graphics.py to generate graphics XML and
use this new function on vmtemplate.py
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/kimchi/model/vms.py | 2 +-
src/kimchi/vmtemplate.py | 25 +++++------------------
src/kimchi/xmlutils/graphics.py | 45 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 51 insertions(+), 21 deletions(-)
create mode 100644 src/kimchi/xmlutils/graphics.py
diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index f2e4ae3..942f041 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -212,7 +212,7 @@ class VMsModel(object):
if t._get_storage_type() not in ["iscsi", "scsi"]:
vol_list = t.fork_vm_storage(vm_uuid)
- graphics = params.get('graphics')
+ graphics = params.get('graphics', {})
stream_protocols = self.caps.libvirt_stream_protocols
xml = t.to_vm_xml(name, vm_uuid,
libvirt_stream_protocols=stream_protocols,
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index 4e5806f..5f7f31e 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -33,6 +33,7 @@ from kimchi.imageinfo import probe_image, probe_img_info
from kimchi.isoinfo import IsoImage
from kimchi.utils import check_url_path, pool_name_from_uri
from kimchi.xmlutils.disk import get_disk_xml
+from kimchi.xmlutils.graphics import get_graphics_xml
from kimchi.xmlutils.qemucmdline import get_qemucmdline_xml
@@ -185,24 +186,6 @@ class VMTemplate(object):
return disks_xml
- def _get_graphics_xml(self, params):
- graphics_xml = """
- <graphics type='%(type)s' autoport='yes' listen='%(listen)s'>
- </graphics>
- """
- spicevmc_xml = """
- <channel type='spicevmc'>
- <target type='virtio' name='com.redhat.spice.0'/>
- </channel>
- """
- graphics = dict(self.info['graphics'])
- if params:
- graphics.update(params)
- graphics_xml = graphics_xml % graphics
- if graphics['type'] == 'spice':
- graphics_xml = graphics_xml + spicevmc_xml
- return graphics_xml
-
def to_volume_list(self, vm_uuid):
storage_path = self._get_storage_path()
fmt = 'raw' if self._get_storage_type() in ['logical'] else 'qcow2'
@@ -312,10 +295,12 @@ class VMTemplate(object):
params['qemu-namespace'] = ''
params['cdroms'] = ''
params['qemu-stream-cmdline'] = ''
- graphics = kwargs.get('graphics')
- params['graphics'] = self._get_graphics_xml(graphics)
params['cpu_info'] = self._get_cpu_xml()
+ graphics = dict(self.info['graphics'])
+ graphics.update(kwargs.get('graphics', {}))
+ params['graphics'] = get_graphics_xml(graphics)
+
# Current implementation just allows to create disk in one single
# storage pool, so we cannot mix the types (scsi volumes vs img file)
storage_type = self._get_storage_type()
diff --git a/src/kimchi/xmlutils/graphics.py b/src/kimchi/xmlutils/graphics.py
new file mode 100644
index 0000000..4c69cd9
--- /dev/null
+++ b/src/kimchi/xmlutils/graphics.py
@@ -0,0 +1,45 @@
+#
+# Project Kimchi
+#
+# Copyright IBM, Corp. 2014
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+import lxml.etree as ET
+
+from lxml.builder import E
+
+
+def get_graphics_xml(params):
+ """
+ <graphics type='%(type)s' autoport='yes' listen='%(listen)s'/>
+
+ - For spice graphics:
+
+ <channel type='spicevmc'>
+ <target type='virtio' name='com.redhat.spice.0'/>
+ </channel>
+ """
+ graphics = E.graphics(type=params['type'], listen=params['listen'])
+ graphics_xml = ET.tostring(graphics, encoding='utf-8', pretty_print=True)
+
+ if params['type'] == 'vnc':
+ return graphics_xml
+
+ # For spice graphics, a channel also must be configured
+ channel = E.channel(type='spicevmc')
+ channel.append(E.target(type='virtio', name='com.redhat.spice.0'))
+ channel_xml = ET.tostring(channel, encoding='utf-8', pretty_print=True)
+ return graphics_xml + channel_xml
--
1.9.3
10 years