varible'version' is undefine in function'_has_cpu_policy_support'

Bug #1465927 reported by lica
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Liyingjun
Kilo
Fix Released
Undecided
Unassigned

Bug Description

My running environment is
openstack-nova-compute-2015.1.0-3.el7.noarch
python-nova-2015.1.0-3.el7.noarch
openstack-nova-novncproxy-2015.1.0-3.el7.noarch
openstack-nova-conductor-2015.1.0-3.el7.noarch
openstack-nova-api-2015.1.0-3.el7.noarch
openstack-nova-console-2015.1.0-3.el7.noarch
openstack-nova-scheduler-2015.1.0-3.el7.noarch
openstack-nova-serialproxy-2015.1.0-3.el7.noarch
openstack-nova-common-2015.1.0-3.el7.noarch

When boot a instance to a host with llibvirt version 1.2.10 and flavor key set with hw:cpu_policy=dedicated,
there is log with below:

File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 3404, in _has_cpu_policy_support

File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 524, in _version_to_string

TypeError: 'module' object is not iterable in nova/virt/libvirt/driver.py

Souce Code of K verison is below:

 def _has_cpu_policy_support(self):
        for ver in BAD_LIBVIRT_CPU_POLICY_VERSIONS:
            if self._host.has_version(ver):
                ver_ = self._version_to_string(version)
                raise exception.CPUPinningNotSupported(reason=_(
                    'Invalid libvirt version %(version)s') % {'version': ver_})
        return True

I thought this func is mistake in writing with

ver_ = self._version_to_string(version)

So when libvirt version is BAD_LIBVIRT_CPU_POLICY_VERSIONS there will be a TypeError

It should be ver_ = self._version_to_string(ver)

lica (licayun)
description: updated
tags: added: libvirt testing
Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

@lica (licayun):

Thanks for reporting this bug. There is a lack of unit tests for that code path which should have found that.

Changed in nova:
status: New → Confirmed
importance: Undecided → High
Liyingjun (liyingjun)
Changed in nova:
assignee: nobody → Liyingjun (liyingjun)
Changed in nova:
status: Confirmed → In Progress
Matt Riedemann (mriedem)
tags: added: kilo-backport-potential
Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/193286

Thierry Carrez (ttx)
Changed in nova:
milestone: none → liberty-1
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/kilo)

Reviewed: https://review.openstack.org/193286
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=199f0ab55abcd2ee3630c90cdc470be6a32c8387
Submitter: Jenkins
Branch: stable/kilo

commit 199f0ab55abcd2ee3630c90cdc470be6a32c8387
Author: liyingjun <email address hidden>
Date: Wed Jun 17 20:42:02 2015 +0800

    Fixes TypeError when libvirt version is BAD_LIBVIRT_CPU_POLICY_VERSIONS

    And add unit test for _has_cpu_policy_support

    Change-Id: Ic389672d56eab4f11cffe0de306934188a18a5a4
    Closes-bug: #1465927
    (cherry picked from commit 68fd33799ed75023567ce06081cfcfd9a407ac23)

tags: added: in-stable-kilo
Thierry Carrez (ttx)
Changed in nova:
milestone: liberty-1 → 12.0.0
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.