On 01/25/2014 08:27 PM, Aline Manera wrote:
> On 01/23/2014 10:29 PM, Rodrigo Trujillo wrote:
>> As Kimchi supports a large range of Linux distributions and libvirt
>> versions may differ. Libvirt functionalities may not be available,
>> what requires different implementations of kimchi code. This patch
>> implements a function to help identify libvirt version.
>>
>> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
>> ---
>> src/kimchi/utils.py | 18 ++++++++++++++++--
>> 1 file changed, 16 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/kimchi/utils.py b/src/kimchi/utils.py
>> index c7ececf..0475eda 100644
>> --- a/src/kimchi/utils.py
>> +++ b/src/kimchi/utils.py
>> @@ -28,11 +28,12 @@ import urllib2
>>
>>
>> from cherrypy.lib.reprconf import Parser
>> -from kimchi.exception import TimeoutExpired
>> +from libvirt import getVersion
>> +from threading import Timer
>>
>>
>> from kimchi import config
>> -from threading import Timer
>> +from kimchi.exception import TimeoutExpired
>>
>>
>> kimchi_log = cherrypy.log.error_log
>> @@ -178,3 +179,16 @@ def patch_find_nfs_target(nfs_server):
>> target['type'] = 'nfs'
>> target['host_name'] = nfs_server
>> return targets
>> +
>> +
>
>> +def is_libvirt_version_lesser(version):
>> + """
>> + Receives an string as version (ex: '0.7.1' or '1.1.2') and
>> compares with
>> + system libvirt version.
>> + Returns booleanr: True if libvirt version lesser than given
>> version
>> + False if libvirt version is greater or equal
>> + """
>> + # Versions numbers are integers: 1000000*major + 1000*minor +
>> release
>> + ver = version.split('.')
>> + test_version = 1000000*int(ver[0]) + 1000*int(ver[1]) +
>> int(ver[2])
>> + return (cmp(getVersion(), test_version) < 0)
>
> Please, don't compare versions
> Create a feature test to check libvirt has or not support for what
> you want.
>
>
From libvirt documentation, I got the following xml:
<pool type='scsi'>
<name>poolvhba0</name>
<source>
<adapter type='fc_host' wwnn='20000000c9831b4b'
wwpn='10000000c9831b4b'/>
</source>
<target>
<path>/dev/disk/by-path</path>
</target>
</pool>
Use is in your feature test.
If you can create a pool using this xml, you know libvirt has support
for 'fc_host' adapter
Otherwise, you need to use the older libvirt xml to create the pool
From my tests:
# on libvirt 0.9.13
$ sudo virsh pool-define ../scsi-pool.xml
error: Failed to define pool from ../scsi-pool.xml
error: XML error: missing storage pool source adapter name
# on libvirt 1.1.2
virsh # pool-undefine poolvhba0
Pool poolvhba0 has been undefined
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel(a)ovirt.org
>
http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>
_______________________________________________
Kimchi-devel mailing list
Kimchi-devel(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel