Spawn on XenAPI fails if the cidr_v6 field in the networks table is null.
Error caught with:
--use_ipv6=False
--network_manager=nova.network.FlatManager
When the use_ipv6 flag is false NetworkManager.create_networks does not populate the cidr_v6 field:
if(FLAGS.use_ipv6):
cidr_v6 = "%s/%s" % (fixed_net_v6[start_v6],
significant_bits_v6)
net['cidr_v6'] = cidr_v6
project_net_v6 = IPy.IP(cidr_v6)
net['gateway_v6'] = str(project_net_v6[1])
net['netmask_v6'] = str(project_net_v6.prefixlen())
However, when network info are fetched by _get_network_info (called by _spawn_with_disk), it is assumed cidr_v6 is always not null:
def ip6_dict(ip6):
return {
--> "ip": utils.to_global_ipv6(network['cidr_v6'], <--
instance['mac_address']),
"netmask": network['netmask_v6'],
"gateway": network['gateway_v6'],
"enabled": "1"}
info = {
'label': network['label'],
'gateway': network['gateway'],
'mac': instance.mac_address,
'rxtx_cap': flavor['rxtx_cap'],
'dns': [network['dns']],
'ips': [ip_dict(ip) for ip in network_IPs],
'ip6s': [ip6_dict(ip) for ip in network_IPs]}
ip6_dict should probably be called only if use_ipv6 is True
Found on nova rev #851
Traceback:
3982) create_vbd /usr/lib/python2.6/site-packages/nova/virt/xenapi/vm_utils.py:198
2011-03-23 07:56:08,228 ERROR nova.compute.manager [EUWSVGMBPVAO1YYW7P1Y root root] Instance '187' failed to spawn. Is virtualization enabled in the BIOS?
(nova.compute.manager): TRACE: Traceback (most recent call last):
(nova.compute.manager): TRACE: File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 225, in run_instance
(nova.compute.manager): TRACE: self.driver.spawn(instance_ref)
(nova.compute.manager): TRACE: File "/usr/lib/python2.6/site-packages/nova/virt/xenapi_conn.py", line 165, in spawn
(nova.compute.manager): TRACE: self._vmops.spawn(instance)
(nova.compute.manager): TRACE: File "/usr/lib/python2.6/site-packages/nova/virt/xenapi/vmops.py", line 86, in spawn
(nova.compute.manager): TRACE: self._spawn_with_disk(instance, vdi_uuid, network_info)
(nova.compute.manager): TRACE: File "/usr/lib/python2.6/site-packages/nova/virt/xenapi/vmops.py", line 135, in _spawn_with_disk
(nova.compute.manager): TRACE: network_info = self._get_network_info(instance)
(nova.compute.manager): TRACE: File "/usr/lib/python2.6/site-packages/nova/virt/xenapi/vmops.py", line 727, in _get_network_info
(nova.compute.manager): TRACE: 'ip6s': [ip6_dict(ip) for ip in network_IPs]}
(nova.compute.manager): TRACE: File "/usr/lib/python2.6/site-packages/nova/virt/xenapi/vmops.py", line 715, in ip6_dict
(nova.compute.manager): TRACE: instance['mac_address']),
(nova.compute.manager): TRACE: File "/usr/lib/python2.6/site-packages/nova/utils.py", line 315, in to_global_ipv6
(nova.compute.manager): TRACE: maskIP = netaddr.IPNetwork(prefix).ip
(nova.compute.manager): TRACE: File "/usr/lib/python2.6/site-packages/netaddr-0.7.5-py2.6.egg/netaddr/ip/__init__.py", line 914, in __init__
(nova.compute.manager): TRACE: implicit_prefix, flags)
(nova.compute.manager): TRACE: File "/usr/lib/python2.6/site-packages/netaddr-0.7.5-py2.6.egg/netaddr/ip/__init__.py", line 806, in parse_ip_network
(nova.compute.manager): TRACE: raise TypeError('unexpected type %s for addr arg' % type(addr))
(nova.compute.manager): TRACE: TypeError: unexpected type <type 'NoneType'> for addr arg
(nova.compute.manager): TRACE:
2011-03-23 07:56:08,546 INFO nova.virt.xenapi.vm_utils [-] (VM_UTILS) xenserver vm state -> |Halted|
2011-03-23 07:56:08,547 INFO nova.virt.xenapi.vm_utils [-] (VM_UTILS) xenapi power_state -> |4|