components/openstack/nova/files/solariszones/driver.py
branchs11u3-sru
changeset 5409 2c588e2f06d9
parent 4679 a5bb9ac1f999
child 5410 2fe121cb8570
equal deleted inserted replaced
5408:e633765b4751 5409:2c588e2f06d9
   162     Automatically opens the configuration for a zone and commits any changes
   162     Automatically opens the configuration for a zone and commits any changes
   163     before exiting
   163     before exiting
   164     """
   164     """
   165     def __init__(self, zone):
   165     def __init__(self, zone):
   166         """zone is a zonemgr object representing either a kernel zone or
   166         """zone is a zonemgr object representing either a kernel zone or
   167         non-glboal zone.
   167         non-global zone.
   168         """
   168         """
   169         self.zone = zone
   169         self.zone = zone
   170         self.editing = False
   170         self.editing = False
   171 
   171 
   172     def __enter__(self):
   172     def __enter__(self):
   907                 data = connection_info['data']
   907                 data = connection_info['data']
   908                 target_portal = data['target_portal']
   908                 target_portal = data['target_portal']
   909                 # Strip off the port number (eg. 127.0.0.1:3260)
   909                 # Strip off the port number (eg. 127.0.0.1:3260)
   910                 host = target_portal.rsplit(':', 1)
   910                 host = target_portal.rsplit(':', 1)
   911                 # Strip any enclosing '[' and ']' brackets for
   911                 # Strip any enclosing '[' and ']' brackets for
   912                 # IPV6 addresses.
   912                 # IPv6 addresses.
   913                 target_host = host[0].strip('[]')
   913                 target_host = host[0].strip('[]')
   914 
   914 
   915                 # Check if target_host is an IP or hostname matching the
   915                 # Check if target_host is an IP or hostname matching the
   916                 # connector host or IP, which would mean the provisioned
   916                 # connector host or IP, which would mean the provisioned
   917                 # iSCSI LUN is on the same host as the instance.
   917                 # iSCSI LUN is on the same host as the instance.
   994                      sc_dir):
   994                      sc_dir):
   995         """add networking information to the zone."""
   995         """add networking information to the zone."""
   996         zone = self._get_zone_by_name(name)
   996         zone = self._get_zone_by_name(name)
   997         if zone is None:
   997         if zone is None:
   998             raise exception.InstanceNotFound(instance_id=name)
   998             raise exception.InstanceNotFound(instance_id=name)
       
   999 
       
  1000         if not network_info:
       
  1001             with ZoneConfig(zone) as zc:
       
  1002                 if brand == ZONE_BRAND_SOLARIS:
       
  1003                     zc.removeresources("anet",
       
  1004                                        [zonemgr.Property("linkname", "net0")])
       
  1005                 else:
       
  1006                     zc.removeresources("anet", [zonemgr.Property("id", "0")])
       
  1007                 return
   999 
  1008 
  1000         tenant_id = None
  1009         tenant_id = None
  1001         network_plugin = neutronv2.get_client(context)
  1010         network_plugin = neutronv2.get_client(context)
  1002         for netid, network in enumerate(network_info):
  1011         for netid, network in enumerate(network_info):
  1003             if tenant_id is None:
  1012             if tenant_id is None: