components/openstack/nova/files/solariszones/driver.py
branchs11u3-sru
changeset 5429 1ae4cfbadda9
parent 5414 1697d1e334a5
child 5430 b6b088be89d5
equal deleted inserted replaced
5424:a7324256f450 5429:1ae4cfbadda9
   167             return None
   167             return None
   168     except rad.client.ObjectError:
   168     except rad.client.ObjectError:
   169         return None
   169         return None
   170     except Exception:
   170     except Exception:
   171         raise
   171         raise
       
   172 
   172 
   173 
   173 def zonemgr_strerror(ex):
   174 def zonemgr_strerror(ex):
   174     """Format the payload from a zonemgr(3RAD) rad.client.ObjectError
   175     """Format the payload from a zonemgr(3RAD) rad.client.ObjectError
   175     exception into a sensible error string that can be logged. Newlines
   176     exception into a sensible error string that can be logged. Newlines
   176     are converted to a colon-space string to create a single line.
   177     are converted to a colon-space string to create a single line.
  1557             LOG.error(_("Unable to spawn instance '%s' via zonemgr(3RAD): %s")
  1558             LOG.error(_("Unable to spawn instance '%s' via zonemgr(3RAD): %s")
  1558                       % (name, reason))
  1559                       % (name, reason))
  1559             if installed:
  1560             if installed:
  1560                 self._uninstall(instance)
  1561                 self._uninstall(instance)
  1561             if configured:
  1562             if configured:
  1562                  self._delete_config(instance)
  1563                 self._delete_config(instance)
  1563             if connection_info is not None:
  1564             if connection_info is not None:
  1564                 self._volume_api.detach(context, volume_id)
  1565                 self._volume_api.detach(context, volume_id)
  1565                 self._volume_api.delete(context, volume_id)
  1566                 self._volume_api.delete(context, volume_id)
  1566             raise
  1567             raise
  1567         finally:
  1568         finally:
  1933         suri = self._suri_from_volume_info(connection_info)
  1934         suri = self._suri_from_volume_info(connection_info)
  1934 
  1935 
  1935         with ZoneConfig(zone) as zc:
  1936         with ZoneConfig(zone) as zc:
  1936             zc.addresource("device", [zonemgr.Property("storage", suri)])
  1937             zc.addresource("device", [zonemgr.Property("storage", suri)])
  1937 
  1938 
       
  1939         # apply the configuration to the running zone
       
  1940         zone.apply()
       
  1941 
  1938     def detach_volume(self, connection_info, instance, mountpoint,
  1942     def detach_volume(self, connection_info, instance, mountpoint,
  1939                       encryption=None):
  1943                       encryption=None):
  1940         """Detach the disk attached to the instance."""
  1944         """Detach the disk attached to the instance."""
  1941         name = instance['name']
  1945         name = instance['name']
  1942         zone = self._get_zone_by_name(name)
  1946         zone = self._get_zone_by_name(name)
  1960                         "'%s'") % (suri, name))
  1964                         "'%s'") % (suri, name))
  1961             return
  1965             return
  1962 
  1966 
  1963         with ZoneConfig(zone) as zc:
  1967         with ZoneConfig(zone) as zc:
  1964             zc.removeresources("device", [zonemgr.Property("storage", suri)])
  1968             zc.removeresources("device", [zonemgr.Property("storage", suri)])
       
  1969 
       
  1970         # apply the configuration to the running zone
       
  1971         zone.apply()
  1965 
  1972 
  1966     def swap_volume(self, old_connection_info, new_connection_info,
  1973     def swap_volume(self, old_connection_info, new_connection_info,
  1967                     instance, mountpoint, resize_to):
  1974                     instance, mountpoint, resize_to):
  1968         """Replace the disk attached to the instance.
  1975         """Replace the disk attached to the instance.
  1969 
  1976