TypeError: 'NoneType' object has no attribute '__getitem__'

Bug #1206948 reported by Philipp Noack
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Bob Ball

Bug Description

After running install_os_domU.sh (described on https://github.com/openstack-dev/devstack/blob/master/tools/xen/README.md) I receive the following error(s) when starting nova-compute. Since I am absolutely new to python I cannot fix it by myself. The only thing I can report is: when I edit /opt/stack/nova/nova/utils.py and replace the last line (1164) with "return 1" nova-compute works and connects to my controller node. But then I can't successfully create virtual machines on this xenserver node.

2013-07-31 14:51:38.658 DEBUG nova.virt.xenapi.host [-] Updating host stats from (pid=1061) update_status /opt/stack/nova/nova/virt/xenapi/host.py:149
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/eventlet/hubs/poll.py", line 97, in wait
    readers.get(fileno, noop).cb(fileno)
  File "/usr/local/lib/python2.7/dist-packages/eventlet/greenthread.py", line 194, in main
    result = function(*args, **kwargs)
  File "/opt/stack/nova/nova/openstack/common/service.py", line 65, in run_service
    service.start()
  File "/opt/stack/nova/nova/service.py", line 174, in start
    self.manager.pre_start_hook(rpc_connection=self.conn)
  File "/opt/stack/nova/nova/compute/manager.py", line 786, in pre_start_hook
    self.update_available_resource(nova.context.get_admin_context())
  File "/opt/stack/nova/nova/compute/manager.py", line 4608, in update_available_resource
    rt.update_available_resource(context)
  File "/opt/stack/nova/nova/openstack/common/lockutils.py", line 246, in inner
    return f(*args, **kwargs)
  File "/opt/stack/nova/nova/compute/resource_tracker.py", line 259, in update_available_resource
    resources = self.driver.get_available_resource(self.nodename)
  File "/opt/stack/nova/nova/virt/xenapi/driver.py", line 402, in get_available_resource
    hyper_ver = utils.convert_version_to_int(self._session.product_version)
  File "/opt/stack/nova/nova/utils.py", line 1164, in convert_version_to_int
    return version[0] * 1000000 + version[1] * 1000 + version[2]
TypeError: 'NoneType' object has no attribute '__getitem__'
Removing descriptor: 5
2013-07-31 14:51:38.995 ERROR nova.openstack.common.threadgroup [-] 'NoneType' object has no attribute '__getitem__'
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup Traceback (most recent call last):
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup File "/opt/stack/nova/nova/openstack/common/threadgroup.py", line 117, in wait
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup x.wait()
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup File "/opt/stack/nova/nova/openstack/common/threadgroup.py", line 49, in wait
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup return self.thread.wait()
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup File "/usr/local/lib/python2.7/dist-packages/eventlet/greenthread.py", line 168, in wait
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup return self._exit_event.wait()
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup File "/usr/local/lib/python2.7/dist-packages/eventlet/event.py", line 116, in wait
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup return hubs.get_hub().switch()
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup File "/usr/local/lib/python2.7/dist-packages/eventlet/hubs/hub.py", line 187, in switch
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup return self.greenlet.switch()
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup File "/usr/local/lib/python2.7/dist-packages/eventlet/greenthread.py", line 194, in main
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup result = function(*args, **kwargs)
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup File "/opt/stack/nova/nova/openstack/common/service.py", line 65, in run_service
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup service.start()
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup File "/opt/stack/nova/nova/service.py", line 174, in start
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup self.manager.pre_start_hook(rpc_connection=self.conn)
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup File "/opt/stack/nova/nova/compute/manager.py", line 786, in pre_start_hook
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup self.update_available_resource(nova.context.get_admin_context())
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup File "/opt/stack/nova/nova/compute/manager.py", line 4608, in update_available_resource
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup rt.update_available_resource(context)
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup File "/opt/stack/nova/nova/openstack/common/lockutils.py", line 246, in inner
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup return f(*args, **kwargs)
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup File "/opt/stack/nova/nova/compute/resource_tracker.py", line 259, in update_available_resource
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup resources = self.driver.get_available_resource(self.nodename)
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup File "/opt/stack/nova/nova/virt/xenapi/driver.py", line 402, in get_available_resource
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup hyper_ver = utils.convert_version_to_int(self._session.product_version)
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup File "/opt/stack/nova/nova/utils.py", line 1164, in convert_version_to_int
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup return version[0] * 1000000 + version[1] * 1000 + version[2]
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup TypeError: 'NoneType' object has no attribute '__getitem__'
2013-07-31 14:51:38.995 TRACE nova.openstack.common.threadgroup
2013-07-31 14:51:38.997 DEBUG amqp [-] Closed channel #1 from (pid=1061) _do_close /usr/local/lib/python2.7/dist-packages/amqp/channel.py:88
2013-07-31 14:51:39.032 DEBUG amqp [-] Closed channel #1 from (pid=1061) _do_close /usr/local/lib/python2.7/dist-packages/amqp/channel.py:88

Tags: xenserver
Matt Riedemann (mriedem)
tags: added: xenserver
Revision history for this message
Matt Riedemann (mriedem) wrote :

Looks like the xenapi driver is unable to get the product version from the host and when that happens there is no warning logged or anything, None is just returned:

https://github.com/openstack/nova/blob/master/nova/virt/xenapi/driver.py#L688

That sets the var that is passed to utils.convert_version_to_int.

I'm not sure why the driver can't get the product version from the host since I don't know much about the xenapi driver.

Revision history for this message
Bob Ball (bob-ball) wrote :

What version of xenserver was this? Or was this with xenserver-core? We have seen this with the 0.3.0 version of xenserver-core but this has been fixed internally to report a version.

If this was on a stock xenserver and not xenserver-core, then check "xe host-list params=all" and paste the "software-version" key from that output (or the whole output) - this is where the version is derived from.

Michael Still (mikal)
Changed in nova:
status: New → Incomplete
Revision history for this message
Mate Lakat (mate-lakat) wrote :

I think in a longer term, we would need to review where this version information is used. We had issues with the version string in the past, it's time to review if the functionality is really needed:

  fool me once, shame on you, fool me twice, shame on me

Revision history for this message
John Garbutt (johngarbutt) wrote :

it just been added, because its needed for checking which tools version are installed an instance, and filtering hosts to a list of compatible ones.

Changed in nova:
importance: Undecided → Medium
Revision history for this message
John Garbutt (johngarbutt) wrote :

Maybe its a version of XenAPI that doesn't report a good version, what are you using this with?

Revision history for this message
Philipp Noack (philipp-noack-b) wrote :

The error occured under ubuntu server 12.04.2 LTS, xen-hypervisor-4.1-amd64 and xcp-xapi 1.3.2-5ubuntu0.1.

software-version (MRO): platform_name: XCP_Kronos; platform_version: 1.6.0; build_number: 0; hostname: komainu; date: 2012-08-03; xapi: 1.3; xen: 4.1.2; linux: 3.2.0-51-generic; xencenter_min: 1.10; xencenter_max: 1.10; network_backend: bridge

Changed in nova:
assignee: nobody → Bob Ball (bob-ball)
status: Incomplete → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/42144
Committed: http://github.com/openstack/nova/commit/41fe1978abf01154b676b1979f3858972027faa4
Submitter: Jenkins
Branch: master

commit 41fe1978abf01154b676b1979f3858972027faa4
Author: Bob Ball <email address hidden>
Date: Tue Aug 13 15:09:33 2013 +0100

    XenAPI: Return platform_version if no product_version

    Nova now requires a version to be set. In the case of xapi-XCP/xenserver-core
    no product_version exists, so use the platform_version instead.

    Fixes bug 1206948

    Change-Id: I4d6008216075716c8b969493b7a2ccb7713f755d

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