baselineCPU parser break unit tests in nova

Bug #1266534 reported by Bhuvan Arumugam
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Vladik Romanovsky

Bug Description

The fix for https://bugs.launchpad.net/nova/+bug/1259796 break nova unit tests. The original test nova.tests.virt.libvirt.test_libvirt.LibvirtConnTestCase.test_cpu_features_bug_1217630 and more tests that parse xml are broken. Details here:

http://paste.openstack.org/show/60471/

Revision history for this message
Vladik Romanovsky (vladik-romanovsky) wrote :

This problem is happening because features = self._conn.baselineCPU (on line 2750 in the libvirt driver) - (or baseline-cpu in libvirt) - doesn't return architecture, such as :

<cpu>
      <arch>x86_64</arch>
...
..

In general, the get_host_capabilities methods sets the self._caps variable and fills the self._caps.host.cpu as well, according to getCapabilities from libvirt.
If self._conn.baselineCPU returns anything, it will override self._caps.host.cpu, however, "ARCH" will be missing.

This is causing the driver not to setup the guest.sysinfo on line 3040:

        if CONF.libvirt.virt_type in ("kvm", "qemu"):
            caps = self.get_host_capabilities()
            if caps.host.cpu.arch in ("i686", "x86_64"):
                guest.sysinfo = self.get_guest_config_sysinfo(instance)
                guest.os_smbios = vconfig.LibvirtConfigGuestSMBIOS()

and eventually all the tests that are using _check_xml_and_uri() in test_libvirt.py will fail on line 2877, when it will try to check the sysinfo.

Vladik

Changed in nova:
assignee: nobody → Vladik Romanovsky (vladik-romanovsky)
Revision history for this message
Matt Riedemann (mriedem) wrote :

Could this be related to bug 1266711 somehow?

tags: added: libvirt
Changed in nova:
status: New → Triaged
Revision history for this message
Bhuvan Arumugam (bhuvan) wrote :

I doubt it's related to bug 1266711. That one is incompatible libvirt version installed in jenkins slaves. This issue is specific to nova unit tests, likely due to invalid libvirt xml.

Revision history for this message
Vladik Romanovsky (vladik-romanovsky) wrote :

I agree, jenkins is failing because it has been installed with a newer version, where libvirt has VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES argument. Without it, the below flow doesn't start..

It's happening because self._caps.host.cpu is being overwritten when self._conn.baselineCPU return anything.
(instead of updating it.)

baselineCPU doesn't return neither arch nor other relevant fields that are being set in LibvirtConfigCaps.

if features and features != -1:
    self._caps.host.cpu = vconfig.LibvirtConfigCPU()
    self._caps.host.cpu.parse_str(features)

because there is no arch specified, sysinfo wont be set and tests will fail, as per comment #1..

sending a patch for this now.

Thanks,
Vladik

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/65360

Changed in nova:
status: Triaged → In Progress
Revision history for this message
Dirk Mueller (dmllr) wrote :

I have already a patch pending for this for some time already here:

https://review.openstack.org/#/c/63159/

Revision history for this message
Vladik Romanovsky (vladik-romanovsky) wrote :

Hi Dirk,

I see, however, you are only fixing the tests, the problem in this bug related to the fact that
cpu configuration is being overwritten in the libvirt driver, mainly affecting all the of the tests that are using _check_xml_and_uri

I have touched other tests because, it doesn't pass tests without it.

Vladik

Revision history for this message
Matt Riedemann (mriedem) wrote :

This is something we want fixed in addition to bug 1266711 so that we can test moving up libvirt in the gate for testing, to try and see if that fixes some of the underlying race failures with intermittent libvirt connection resets like in bug 1254872 and bug 1255624.

Changed in nova:
importance: Undecided → High
Revision history for this message
Joe Gordon (jogo) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/65360
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=cd0371280dd204a10673d5d1b70ba0b9f2757a22
Submitter: Jenkins
Branch: master

commit cd0371280dd204a10673d5d1b70ba0b9f2757a22
Author: Vladik Romanovsky <email address hidden>
Date: Tue Jan 7 13:05:33 2014 -0500

    libvirt: stop overwriting LibvirtConfigCPU in get_host_capabilities

    Currently, LibvirtConfigCPU configuration is being overwritten with baselineCPU
    output. However, baselineCPU never reports the ARCH and other relevant fields,
    that is being set in LibvirtConfigCPU by the LibvirtConfigCaps.
    The absense of the arch field is causing the bug below.
    Fixing it to simply update the LibvirtConfigCPU.

    Change-Id: I9dd06fa44a232a333609fa115d05ad8822e21c0c
    Closes-Bug: #1266534

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-2
tags: added: havana-backport-potential
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to nova (master)

Reviewed: https://review.openstack.org/63159
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=dd0bc6ac2d6ce2190f7a0fe9a77194dd1db60b5e
Submitter: Jenkins
Branch: master

commit dd0bc6ac2d6ce2190f7a0fe9a77194dd1db60b5e
Author: Dirk Mueller <email address hidden>
Date: Thu Dec 19 16:33:15 2013 +0100

    Hide VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES where needed

    Running unit test against a newer libvirt fails due to
    VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES being always available.

    This was mostly hidden as the old unit test globally deleted
    the attribute during execution. Removing this side effect
    and use mocking of attributes instead where needed.

    Related-Bug: LP #1266534

    Change-Id: Id0e6d8771f1a43f402b6323f0c0df38ee23e0fa8

Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-2 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.