20410887 Solaris Nova driver should be resilient when network info is None s11u3-sru
authorsaurabh.vyas@oracle.com
Tue, 15 Dec 2015 00:08:40 -0800
branchs11u3-sru
changeset 5409 2c588e2f06d9
parent 5408 e633765b4751
child 5410 2fe121cb8570
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
@@ -164,7 +164,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
@@ -909,7 +909,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
@@ -997,6 +997,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):