VMware: 'NoneType' object has no attribute 'keys' in the driver

Bug #1372672 reported by Arnaud Legendre
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Arnaud Legendre

Bug Description

There are a couple of places in the driver where we use the keys() method without checking for None.

I have seen several times the following exception:
2014-09-22 11:45:07.312 ERROR nova.openstack.common.periodic_task [-] Error during ComputeManager.update_available_resource: 'NoneType' object has no attribute 'keys'
2014-09-22 11:45:07.312 TRACE nova.openstack.common.periodic_task Traceback (most recent call last):
2014-09-22 11:45:07.312 TRACE nova.openstack.common.periodic_task File "/opt/stack/nova/nova/openstack/common/periodic_task.py", line 198, in run_periodic_tasks
2014-09-22 11:45:07.312 TRACE nova.openstack.common.periodic_task task(self, context)
2014-09-22 11:45:07.312 TRACE nova.openstack.common.periodic_task File "/opt/stack/nova/nova/compute/manager.py", line 5909, in update_available_resource
2014-09-22 11:45:07.312 TRACE nova.openstack.common.periodic_task nodenames = set(self.driver.get_available_nodes())
2014-09-22 11:45:07.312 TRACE nova.openstack.common.periodic_task File "/opt/stack/nova/nova/virt/vmwareapi/driver.py", line 426, in get_available_nodes
2014-09-22 11:45:07.312 TRACE nova.openstack.common.periodic_task self._update_resources()
2014-09-22 11:45:07.312 TRACE nova.openstack.common.periodic_task File "/opt/stack/nova/nova/virt/vmwareapi/driver.py", line 306, in _update_resources
2014-09-22 11:45:07.312 TRACE nova.openstack.common.periodic_task added_nodes = set(self.dict_mors.keys()) - set(self._resource_keys)
2014-09-22 11:45:07.312 TRACE nova.openstack.common.periodic_task AttributeError: 'NoneType' object has no attribute 'keys'

Changed in nova:
assignee: nobody → Arnaud Legendre (arnaudleg)
importance: Undecided → Medium
Sean Dague (sdague)
Changed in nova:
status: New → Confirmed
importance: Medium → Low
description: updated
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/123287

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit aafe39cd94c7311ae6d02a6b98cfd09d70ae0b56
Author: Arnaud Legendre <email address hidden>
Date: Mon Sep 22 15:36:48 2014 -0700

    VMware: get_all_cluster_refs_by_name default to {}

    Currently get_all_cluster_refs_by_name returns None when no cluster
    is found.
    driver.py is using the keys() method without checking whether the
    object returned is None. This can potentially end up throwing an
    AttributeError.

    This patch fixes the issue by returning an empty dictionary when no
    cluster is found.

    Change-Id: I3293c916d79aaa4de8913e8ab9c609c9c0bb023e
    Closes-Bug: #1372672

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → kilo-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: kilo-1 → 2015.1.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.