KeyError: 'gateway6' - caused by unchecked hash key reference

Bug #807764 reported by Kenneth Jiang
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Adam Gandelman

Bug Description

I followed the "scripted installation" and got debian nova packages installed with version 2011.3~d3~20110706.1245-0ubuntu0ppa1~lucid1.

When euca-run-instances was fired to create a new instance, there was error in /var/log/nova/nova-compute.log:

011-07-06 08:51:39,649 DEBUG nova.utils [-] Running cmd (subprocess): qemu-img create -f qcow2 -o cluster_size=2M,backing_file=/var/lib/nova/instances/_base/da4b9237bacccdf19c0760cab7aec4a8359010b0_sm /var/lib/nova/instances/instance-00000001/disk from (pid=8215) execute /usr/lib/pymodules/python2.6/nova/utils.py:143
2011-07-06 08:51:40,603 ERROR nova.exception [-] Uncaught exception
(nova.exception): TRACE: Traceback (most recent call last):
(nova.exception): TRACE: File "/usr/lib/pymodules/python2.6/nova/exception.py", line 87, in _wrap
(nova.exception): TRACE: return f(*args, **kw)
(nova.exception): TRACE: File "/usr/lib/pymodules/python2.6/nova/virt/libvirt/connection.py", line 590, in spawn
(nova.exception): TRACE: block_device_mapping=block_device_mapping)
(nova.exception): TRACE: File "/usr/lib/pymodules/python2.6/nova/virt/libvirt/connection.py", line 894, in _create_image
(nova.exception): TRACE: 'gateway6': mapping['gateway6'],
(nova.exception): TRACE: KeyError: 'gateway6'
(nova.exception): TRACE:
2011-07-06 08:51:40,605 ERROR nova.compute.manager [-] Instance '1' failed to spawn. Is virtualization enabled in the BIOS? Details: 'gateway6'
(nova.compute.manager): TRACE: Traceback (most recent call last):
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/compute/manager.py", line 311, in _run_instance
(nova.compute.manager): TRACE: self.driver.spawn(instance, network_info, bd_mapping)
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/exception.py", line 93, in _wrap
(nova.compute.manager): TRACE: raise Error(str(e))
(nova.compute.manager): TRACE: Error: 'gateway6'
(nova.compute.manager): TRACE:

I digged in and found unchecked key reference in file: nova/virt/libvirt/connection.py
'gateway6': mapping['gateway6'],

Attached is the patch file I submitted to fix this unchecked key reference.

Related branches

Revision history for this message
Kenneth Jiang (kenneth-jiang) wrote :
Revision history for this message
Dave Spano (sysadmin-optogenics) wrote :

Thanks for finding this! I ran into the same bug.

Revision history for this message
Rohit Karajgi (rohitk) wrote :

This bug also breaks a couple of libvirt unit-tests. A fix would be good.

Revision history for this message
clayg (clay-gerrard) wrote :

+1

I had to be make similar patching:

$ bzr diff nova/virt/libvirt/connection.py
=== modified file 'nova/virt/libvirt/connection.py'
--- nova/virt/libvirt/connection.py 2011-07-13 18:19:32 +0000
+++ nova/virt/libvirt/connection.py 2011-07-18 20:22:25 +0000
@@ -881,6 +881,7 @@
             address = mapping['ips'][0]['ip']
             netmask = mapping['ips'][0]['netmask']
             address_v6 = None
+ netmask_v6 = None
             if FLAGS.use_ipv6:
                 address_v6 = mapping['ip6s'][0]['ip']
                 netmask_v6 = mapping['ip6s'][0]['netmask']
@@ -891,7 +892,7 @@
                    'broadcast': mapping['broadcast'],
                    'dns': mapping['dns'],
                    'address_v6': address_v6,
- 'gateway6': mapping['gateway6'],
+ 'gateway6': mapping.get('gateway6'),
                    'netmask_v6': netmask_v6}
             nets.append(net_info)

Changed in nova:
status: New → Confirmed
Thierry Carrez (ttx)
Changed in nova:
assignee: nobody → Adam Gandelman (gandelman-a)
importance: Undecided → Medium
status: Confirmed → In Progress
Thierry Carrez (ttx)
Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → diablo-3
Thierry Carrez (ttx)
Changed in nova:
milestone: diablo-3 → 2011.3
status: Fix Committed → Fix Released
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.