[Kimchi-devel] [PATCH] [Kimchi] Clean FEATURETEST_VM effectively.
Rodrigo Trujillo
rodrigo.trujillo at linux.vnet.ibm.com
Tue Jun 7 17:55:12 UTC 2016
Reviewed-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
Tested-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
On 06/06/2016 04:45 PM, pvital at linux.vnet.ibm.com wrote:
> From: Paulo Vital <pvital at linux.vnet.ibm.com>
>
> FEATURETEST_VM is defined at Kimchi start up to check if few QEMU and Libvirt
> features are enabled in the host system. Some bugs reported the existence of
> this VM running in the system, even after the Kimchi Feature Tests have
> completed.
>
> This patch adds a cleaning step before start the Kimchi Feature Tests. In
> addition, modified the has_mem_hotplug_support() to not use RollbackContext and
> guarantee that FEATURETEST_VM will be undefined.
>
> Signed-off-by: Paulo Vital <pvital at linux.vnet.ibm.com>
> ---
> model/config.py | 3 +++
> model/featuretests.py | 33 +++++++++++++++++----------------
> 2 files changed, 20 insertions(+), 16 deletions(-)
>
> diff --git a/model/config.py b/model/config.py
> index fc4b285..78cdaeb 100644
> --- a/model/config.py
> +++ b/model/config.py
> @@ -57,6 +57,9 @@ class CapabilitiesModel(object):
> self.mem_hotplug_support = False
> self.libvirtd_running = False
>
> + # make sure there're no Kimchi leftovers from previous executions
> + self._clean_leftovers()
> +
> # run feature tests
> self._set_capabilities()
>
> diff --git a/model/featuretests.py b/model/featuretests.py
> index 2b680c3..fca152d 100644
> --- a/model/featuretests.py
> +++ b/model/featuretests.py
> @@ -24,7 +24,6 @@ import platform
> import subprocess
> from lxml.builder import E
>
> -from wok.rollbackcontext import RollbackContext
> from wok.utils import run_command, servermethod, wok_log
>
>
> @@ -220,22 +219,24 @@ class FeatureTests(object):
> # Libvirt < 1.2.14 does not support memory devices, so try to attach a
> # device. Then check if QEMU (>= 2.1) supports memory hotplug, starting
> # the guest These steps avoid errors with Libvirt 'test' driver for KVM
> - with RollbackContext() as rollback:
> + 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 = None
> + try:
> FeatureTests.disable_libvirt_error_logging()
> - rollback.prependDefer(FeatureTests.enable_libvirt_error_logging)
> - 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(MAXMEM_VM_XML % {'name': FEATURETEST_VM_NAME,
> 'domain': domain_type,
> 'arch': arch})
> - rollback.prependDefer(dom.undefine)
> - try:
> - dom.attachDeviceFlags(DEV_MEM_XML,
> - libvirt.VIR_DOMAIN_MEM_CONFIG)
> - dom.create()
> - rollback.prependDefer(dom.destroy)
> - return True
> - except libvirt.libvirtError:
> - return False
> + dom.attachDeviceFlags(DEV_MEM_XML, libvirt.VIR_DOMAIN_MEM_CONFIG)
> + dom.create()
> + except libvirt.libvirtError:
> + return False
> + finally:
> + if (dom and dom.isActive() == 1):
> + dom.destroy()
> + dom is None or dom.undefine()
> + FeatureTests.enable_libvirt_error_logging()
> + return True
> --
> 2.5.5
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>
More information about the Kimchi-devel
mailing list