← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1154175] Re: Powervm spawn fails with index out of range when network is not set

 

** Changed in: nova
       Status: In Progress => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1154175

Title:
  Powervm spawn fails with index out of range when network is not set

Status in OpenStack Compute (Nova):
  Invalid

Bug description:
  Spawn assumes there is at least one network interface defines when
  making this call in nova.virt.powervm.operator:

  mac = network_info[0]['address']

  Suggest to check for network_info length and default slot id to 5
  (which is in the allowed range in powervm) in that scenario.

  virtual_eth_mac_base_value should also be defaulted to None in lpar
  definition, this will let VIOS generate a mac for the interface

  Current code:

          mac = network_info[0]['address']
          mac_base_value = (mac[:-2]).replace(':', '')
          eth_id = self._operator.get_virtual_eth_adapter_id()
          slot_id = int(mac[-2:], 16)
          virtual_eth_adapters = ('%(slot_id)s/0/%(eth_id)s//0/0' %
                                  locals()) 

  Suggested code:

           slot_id = 5
          mac_base_value = None
          eth_id = self._operator.get_virtual_eth_adapter_id()

          if len(network_info) > 0:
              mac = network_info[0]['address']
              mac_base_value = (mac[:-2]).replace(':', '')        
              slot_id = int(mac[-2:], 16)

          virtual_eth_adapters = ('%(slot_id)s/0/%(eth_id)s//0/0' %
                                  locals())

  
  Here is the stack trace:

  2013-03-06 11:28:56.159 ERROR nova.compute.manager [req-49ba4eef-459b-4857-9d43-87b0cb270728 cf62d17147d640fb8d8c2531c1697b66 bef70326d8964d439db1e05ebb27f251] [instance: c0e0880f-5a54-4da8-93cb-67e36747dcda] Instance failed to spawn
  2013-03-06 11:28:56.159 7940 TRACE nova.compute.manager [instance: c0e0880f-5a54-4da8-93cb-67e36747dcda] Traceback (most recent call last):
  2013-03-06 11:28:56.159 7940 TRACE nova.compute.manager [instance: c0e0880f-5a54-4da8-93cb-67e36747dcda]   File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 1052, in _spawn
  2013-03-06 11:28:56.159 7940 TRACE nova.compute.manager [instance: c0e0880f-5a54-4da8-93cb-67e36747dcda]     block_device_info)
  2013-03-06 11:28:56.159 7940 TRACE nova.compute.manager [instance: c0e0880f-5a54-4da8-93cb-67e36747dcda]   File "/usr/lib/python2.6/site-packages/nova/virt/powervm/driver.py", line 103, in spawn
  2013-03-06 11:28:56.159 7940 TRACE nova.compute.manager [instance: c0e0880f-5a54-4da8-93cb-67e36747dcda]     self._powervm.spawn(context, instance, image_meta['id'], network_info)
  2013-03-06 11:28:56.159 7940 TRACE nova.compute.manager [instance: c0e0880f-5a54-4da8-93cb-67e36747dcda]   File "/usr/lib/python2.6/site-packages/nova/virt/powervm/operator.py", line 325, in spawn
  2013-03-06 11:28:56.159 7940 TRACE nova.compute.manager [instance: c0e0880f-5a54-4da8-93cb-67e36747dcda]     network_info, host_stats)
  2013-03-06 11:28:56.159 7940 TRACE nova.compute.manager [instance: c0e0880f-5a54-4da8-93cb-67e36747dcda]   File "/usr/lib/python2.6/site-packages/nova/virt/powervm/operator.py", line 507, in _create_lpar_instance
  2013-03-06 11:28:56.159 7940 TRACE nova.compute.manager [instance: c0e0880f-5a54-4da8-93cb-67e36747dcda]     mac = network_info[0]['address']
  2013-03-06 11:28:56.159 7940 TRACE nova.compute.manager [instance: c0e0880f-5a54-4da8-93cb-67e36747dcda] IndexError: list index out of range
  2013-03-06 11:28:56.159 7940 TRACE nova.compute.manager [instance: c0e0880f-5a54-4da8-93cb-67e36747dcda]
  2013-03-06 11:28:58.187 ERROR nova.compute.manager [req-49ba4eef-459b-4857-9d43-87b0cb270728 cf62d17147d640fb8d8c2531c1697b66 bef70326d8964d439db1e05ebb27f251] [instance: c0e0880f-5a54-4da8-93cb-67e36747dcda] Error: ['Traceback (most recent call last):\n', '  File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 775, in _run_instance\n    injected_files, admin_password)\n', '  File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 1052, in _spawn\n    block_device_info)\n', '  File "/usr/lib/python2.6/site-packages/nova/virt/powervm/driver.py", line 103, in spawn\n    self._powervm.spawn(context, instance, image_meta[\'id\'], network_info)\n', '  File "/usr/lib/python2.6/site-packages/nova/virt/powervm/operator.py", line 325, in spawn\n    network_info, host_stats)\n', '  File "/usr/lib/python2.6/site-packages/nova/virt/powervm/operator.py", line 507, in _create_lpar_instance\n    mac = network_info[0][\'address\']\n', 'IndexError: list index out of range\n']

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1154175/+subscriptions