[PATCH v2] On Ubuntu, current libvirt library requires <os><type arch= specification

From: Thierry FAUCK - IBM LTC <thierry@linux.vnet.ibm.com> On Ubuntu, current libvirt library requires <os><type arch='' specification to avoid a failure in virDomainDefineXML() and messages like - libvirtError: internal error: no supported rchitecture for os type 'hvm' on x86_64 arch - libvirtError: XML error: No PCI buses available on ppc64el arch Signed-off-by: Thierry FAUCK - IBM LTC <thierry@linux.vnet.ibm.com> modified: src/kimchi/kvmusertests.py modified: src/kimchi/model/featuretests.py --- src/kimchi/kvmusertests.py | 15 ++++++++++----- src/kimchi/model/featuretests.py | 14 ++++++++++---- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/kimchi/kvmusertests.py b/src/kimchi/kvmusertests.py index 2326727..2624f73 100644 --- a/src/kimchi/kvmusertests.py +++ b/src/kimchi/kvmusertests.py @@ -16,24 +16,25 @@ # 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 platform import psutil import uuid - import libvirt from kimchi.rollbackcontext import RollbackContext +from kimchi.utils import kimchi_log class UserTests(object): SIMPLE_VM_XML = """ <domain type='kvm'> - <name>%s</name> - <uuid>%s</uuid> + <name>%(vm_name)s</name> + <uuid>%(vm_uuid)s</uuid> <memory unit='KiB'>262144</memory> <os> - <type>hvm</type> + <type arch='%(arch)s'>hvm</type> <boot dev='hd'/> </os> </domain>""" @@ -46,8 +47,12 @@ class UserTests(object): vm_uuid = uuid.uuid1() vm_name = "kimchi_test_%s" % vm_uuid + arch='ppc64' if platform.machine() == 'ppc64le' else platform.machine() - xml = cls.SIMPLE_VM_XML % (vm_name, vm_uuid) + xml = cls.SIMPLE_VM_XML % {'vm_name':vm_name, 'vm_uuid':vm_uuid, + 'arch': arch } + kimchi_log.warning("DEBUG XML %s",xml) + with RollbackContext() as rollback: conn = libvirt.open(None) rollback.prependDefer(conn.close) diff --git a/src/kimchi/model/featuretests.py b/src/kimchi/model/featuretests.py index c187f86..e6b133a 100644 --- a/src/kimchi/model/featuretests.py +++ b/src/kimchi/model/featuretests.py @@ -20,6 +20,7 @@ import cherrypy import libvirt import lxml.etree as ET +import platform import socket import subprocess import threading @@ -37,7 +38,7 @@ ISO_STREAM_XML = """ <name>ISO_STREAMING</name> <memory unit='KiB'>1048576</memory> <os> - <type>hvm</type> + <type arch='%(arch)s'>hvm</type> <boot dev='cdrom'/> </os> <devices> @@ -59,7 +60,7 @@ SIMPLE_VM_XML = """ <name>A_SIMPLE_VM</name> <memory unit='KiB'>10240</memory> <os> - <type>hvm</type> + <type arch='%(arch)s'>hvm</type> <boot dev='hd'/> </os> </domain>""" @@ -102,7 +103,9 @@ class FeatureTests(object): @staticmethod def libvirt_supports_iso_stream(conn, protocol): domain_type = 'test' if conn.getType().lower() == 'test' else 'kvm' - xml = ISO_STREAM_XML % {'domain': domain_type, 'protocol': protocol} + arch='ppc64' if platform.machine() == 'ppc64le' else platform.machine() + xml = ISO_STREAM_XML % {'domain': domain_type, 'protocol': protocol , + 'arch': arch } try: FeatureTests.disable_libvirt_error_logging() dom = conn.defineXML(xml) @@ -190,7 +193,10 @@ class FeatureTests(object): FeatureTests.disable_libvirt_error_logging() rollback.prependDefer(FeatureTests.enable_libvirt_error_logging) domain_type = 'test' if conn.getType().lower() == 'test' else 'kvm' - dom = conn.defineXML(SIMPLE_VM_XML % {'domain': domain_type}) + arch='ppc64' if platform.machine() == 'ppc64le' \ + else platform.machine() + dom = conn.defineXML(SIMPLE_VM_XML % {'domain': domain_type , + 'arch': arch}) rollback.prependDefer(dom.undefine) try: dom.setMetadata(libvirt.VIR_DOMAIN_METADATA_ELEMENT, -- 1.7.9.5

Please, run "make check-local" to fix the pep8 style. alinefm@alinefm:~/kimchi$ sudo make check-local PYTHONPATH=src contrib/check_i18n.py plugins/*/i18n.py src/kimchi/i18n.py Checking for invalid i18n string... Checking for invalid i18n string successfully find . -path './.git' -prune -type f -o \ -name '*.py' -o -name '*.py.in' | xargs /usr/bin/pyflakes | \ grep -w -v "\./src/kimchi/websocket\.py" | \ while read LINE; do echo "$LINE"; false; done /usr/bin/pep8 --version 1.5.6 /usr/bin/pep8 --filename '*.py,*.py.in' --exclude="*src/kimchi/config.py,*src/kimchi/i18n.py,*tests/test_config.py" . ./src/kimchi/kvmusertests.py:50:13: E225 missing whitespace around operator ./src/kimchi/kvmusertests.py:52:45: E231 missing whitespace after ':' ./src/kimchi/kvmusertests.py:52:64: E231 missing whitespace after ':' ./src/kimchi/kvmusertests.py:53:1: E101 indentation contains mixed spaces and tabs ./src/kimchi/kvmusertests.py:53:1: W191 indentation contains tabs ./src/kimchi/kvmusertests.py:53:8: E128 continuation line under-indented for visual indent ./src/kimchi/kvmusertests.py:53:20: E202 whitespace before '}' ./src/kimchi/kvmusertests.py:54:1: E101 indentation contains mixed spaces and tabs ./src/kimchi/kvmusertests.py:54:42: E231 missing whitespace after ',' ./src/kimchi/kvmusertests.py:55:1: W293 blank line contains whitespace ./src/kimchi/model/featuretests.py:106:13: E225 missing whitespace around operator ./src/kimchi/model/featuretests.py:107:76: E203 whitespace before ',' ./src/kimchi/model/featuretests.py:108:45: E202 whitespace before '}' ./src/kimchi/model/featuretests.py:196:17: E225 missing whitespace around operator ./src/kimchi/model/featuretests.py:197:13: E122 continuation line missing indentation or outdented ./src/kimchi/model/featuretests.py:198:72: E203 whitespace before ',' Makefile:828: recipe for target 'check-local' failed make: *** [check-local] Error 1 On 29/01/2015 08:25, thierry@linux.vnet.ibm.com wrote:
From: Thierry FAUCK - IBM LTC <thierry@linux.vnet.ibm.com>
On Ubuntu, current libvirt library requires <os><type arch='' specification to avoid a failure in virDomainDefineXML() and messages like - libvirtError: internal error: no supported rchitecture for os type 'hvm' on x86_64 arch - libvirtError: XML error: No PCI buses available on ppc64el arch
Signed-off-by: Thierry FAUCK - IBM LTC <thierry@linux.vnet.ibm.com>
modified: src/kimchi/kvmusertests.py modified: src/kimchi/model/featuretests.py --- src/kimchi/kvmusertests.py | 15 ++++++++++----- src/kimchi/model/featuretests.py | 14 ++++++++++---- 2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/src/kimchi/kvmusertests.py b/src/kimchi/kvmusertests.py index 2326727..2624f73 100644 --- a/src/kimchi/kvmusertests.py +++ b/src/kimchi/kvmusertests.py @@ -16,24 +16,25 @@ # 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 platform import psutil import uuid
- import libvirt
from kimchi.rollbackcontext import RollbackContext +from kimchi.utils import kimchi_log
class UserTests(object): SIMPLE_VM_XML = """ <domain type='kvm'> - <name>%s</name> - <uuid>%s</uuid> + <name>%(vm_name)s</name> + <uuid>%(vm_uuid)s</uuid> <memory unit='KiB'>262144</memory> <os> - <type>hvm</type> + <type arch='%(arch)s'>hvm</type> <boot dev='hd'/> </os> </domain>""" @@ -46,8 +47,12 @@ class UserTests(object):
vm_uuid = uuid.uuid1() vm_name = "kimchi_test_%s" % vm_uuid + arch='ppc64' if platform.machine() == 'ppc64le' else platform.machine()
- xml = cls.SIMPLE_VM_XML % (vm_name, vm_uuid) + xml = cls.SIMPLE_VM_XML % {'vm_name':vm_name, 'vm_uuid':vm_uuid, + 'arch': arch } + kimchi_log.warning("DEBUG XML %s",xml) + with RollbackContext() as rollback: conn = libvirt.open(None) rollback.prependDefer(conn.close) diff --git a/src/kimchi/model/featuretests.py b/src/kimchi/model/featuretests.py index c187f86..e6b133a 100644 --- a/src/kimchi/model/featuretests.py +++ b/src/kimchi/model/featuretests.py @@ -20,6 +20,7 @@ import cherrypy import libvirt import lxml.etree as ET +import platform import socket import subprocess import threading @@ -37,7 +38,7 @@ ISO_STREAM_XML = """ <name>ISO_STREAMING</name> <memory unit='KiB'>1048576</memory> <os> - <type>hvm</type> + <type arch='%(arch)s'>hvm</type> <boot dev='cdrom'/> </os> <devices> @@ -59,7 +60,7 @@ SIMPLE_VM_XML = """ <name>A_SIMPLE_VM</name> <memory unit='KiB'>10240</memory> <os> - <type>hvm</type> + <type arch='%(arch)s'>hvm</type> <boot dev='hd'/> </os> </domain>""" @@ -102,7 +103,9 @@ class FeatureTests(object): @staticmethod def libvirt_supports_iso_stream(conn, protocol): domain_type = 'test' if conn.getType().lower() == 'test' else 'kvm' - xml = ISO_STREAM_XML % {'domain': domain_type, 'protocol': protocol} + arch='ppc64' if platform.machine() == 'ppc64le' else platform.machine() + xml = ISO_STREAM_XML % {'domain': domain_type, 'protocol': protocol , + 'arch': arch } try: FeatureTests.disable_libvirt_error_logging() dom = conn.defineXML(xml) @@ -190,7 +193,10 @@ class FeatureTests(object): FeatureTests.disable_libvirt_error_logging() rollback.prependDefer(FeatureTests.enable_libvirt_error_logging) domain_type = 'test' if conn.getType().lower() == 'test' else 'kvm' - dom = conn.defineXML(SIMPLE_VM_XML % {'domain': domain_type}) + arch='ppc64' if platform.machine() == 'ppc64le' \ + else platform.machine() + dom = conn.defineXML(SIMPLE_VM_XML % {'domain': domain_type , + 'arch': arch}) rollback.prependDefer(dom.undefine) try: dom.setMetadata(libvirt.VIR_DOMAIN_METADATA_ELEMENT,
participants (2)
-
Aline Manera
-
thierry@linux.vnet.ibm.com