20410887 Solaris Nova driver should be resilient when network info is None
authordavid.comay@oracle.com
Tue, 15 Dec 2015 00:08:40 -0800
changeset 5190 fc9c815fce00
parent 5189 f0a856685b0e
child 5191 1a9d78bb53a1
20410887 Solaris Nova driver should be resilient when network info is None
components/openstack/nova/files/solariszones/driver.py
--- a/components/openstack/nova/files/solariszones/driver.py	Tue Dec 15 00:08:40 2015 -0800
+++ b/components/openstack/nova/files/solariszones/driver.py	Tue Dec 15 00:08:40 2015 -0800
@@ -20,7 +20,6 @@
 """
 
 import base64
-import errno
 import glob
 import os
 import platform
@@ -69,7 +68,6 @@
 from nova.virt import event as virtevent
 from nova.virt import images
 from nova.virt.solariszones import sysconfig
-from nova import volume
 from nova.volume.cinder import API
 from nova.volume.cinder import cinderclient
 from nova.volume.cinder import get_cinder_client_version
@@ -272,7 +270,7 @@
     """
     def __init__(self, zone):
         """zone is a zonemgr object representing either a kernel zone or
-        non-glboal zone.
+        non-global zone.
         """
         self.zone = zone
         self.editing = False
@@ -1024,7 +1022,7 @@
                 # Strip off the port number (eg. 127.0.0.1:3260)
                 host = target_portal.rsplit(':', 1)
                 # Strip any enclosing '[' and ']' brackets for
-                # IPV6 addresses.
+                # IPv6 addresses.
                 target_host = host[0].strip('[]')
 
                 # Check if target_host is an IP or hostname matching the
@@ -1113,6 +1111,15 @@
         if zone is None:
             raise exception.InstanceNotFound(instance_id=name)
 
+        if not network_info:
+            with ZoneConfig(zone) as zc:
+                if brand == ZONE_BRAND_SOLARIS:
+                    zc.removeresources("anet",
+                                       [zonemgr.Property("linkname", "net0")])
+                else:
+                    zc.removeresources("anet", [zonemgr.Property("id", "0")])
+                return
+
         tenant_id = None
         network_plugin = neutronv2.get_client(context)
         for netid, network in enumerate(network_info):