components/openstack/nova/files/solariszones/driver.py
branchs11u2-sru
changeset 3201 6839f7d1f036
parent 3178 77584387a894
child 3809 eb8d6ce0657e
child 4156 4b1def16fe9b
equal deleted inserted replaced
3198:46289f36c1ca 3201:6839f7d1f036
    93 ZONE_STATE_MOUNTED = 'mounted'
    93 ZONE_STATE_MOUNTED = 'mounted'
    94 
    94 
    95 # Mapping between zone state and Nova power_state.
    95 # Mapping between zone state and Nova power_state.
    96 SOLARISZONES_POWER_STATE = {
    96 SOLARISZONES_POWER_STATE = {
    97     ZONE_STATE_CONFIGURED:      power_state.NOSTATE,
    97     ZONE_STATE_CONFIGURED:      power_state.NOSTATE,
    98     ZONE_STATE_INCOMPLETE:      power_state.BUILDING,
    98     ZONE_STATE_INCOMPLETE:      power_state.NOSTATE,
    99     ZONE_STATE_UNAVAILABLE:     power_state.NOSTATE,
    99     ZONE_STATE_UNAVAILABLE:     power_state.NOSTATE,
   100     ZONE_STATE_INSTALLED:       power_state.SHUTDOWN,
   100     ZONE_STATE_INSTALLED:       power_state.SHUTDOWN,
   101     ZONE_STATE_READY:           power_state.RUNNING,
   101     ZONE_STATE_READY:           power_state.RUNNING,
   102     ZONE_STATE_RUNNING:         power_state.RUNNING,
   102     ZONE_STATE_RUNNING:         power_state.RUNNING,
   103     ZONE_STATE_SHUTTING_DOWN:   power_state.RUNNING,
   103     ZONE_STATE_SHUTTING_DOWN:   power_state.RUNNING,
   496         try:
   496         try:
   497             self._kstat_control.update()
   497             self._kstat_control.update()
   498             kstat_object = self._rad_instance.get_object(
   498             kstat_object = self._rad_instance.get_object(
   499                 kstat.Kstat(), rad.client.ADRGlobPattern(pattern))
   499                 kstat.Kstat(), rad.client.ADRGlobPattern(pattern))
   500         except Exception as reason:
   500         except Exception as reason:
   501             LOG.warning(_("Unable to retrieve kstat object '%s:%s:%s' of "
   501             LOG.info(_("Unable to retrieve kstat object '%s:%s:%s' of class "
   502                           "class '%s' via kstat(3RAD): %s")
   502                        "'%s' via kstat(3RAD): %s")
   503                         % (module, instance, name, kstat_class, reason))
   503                      % (module, instance, name, kstat_class, reason))
   504             return None
   504             return None
   505 
   505 
   506         kstat_data = {}
   506         kstat_data = {}
   507         for named in kstat_object.fresh_snapshot().data.NAMED:
   507         for named in kstat_object.fresh_snapshot().data.NAMED:
   508             kstat_data[named.name] = getattr(named.value,
   508             kstat_data[named.name] = getattr(named.value,
   725             hbas = self._get_fc_hbas()
   725             hbas = self._get_fc_hbas()
   726             if not hbas:
   726             if not hbas:
   727                 LOG.error(_("Cannot attach Fibre Channel volume '%s' because "
   727                 LOG.error(_("Cannot attach Fibre Channel volume '%s' because "
   728                           "no Fibre Channel HBA initiators were found")
   728                           "no Fibre Channel HBA initiators were found")
   729                           % (target_wwn))
   729                           % (target_wwn))
   730                 raise exception.InvalidVolume(reason="No host FC initiator")
   730                 raise exception.InvalidVolume(
       
   731                     reason="No host Fibre Channel initiator found")
   731 
   732 
   732             target_lun = data['target_lun']
   733             target_lun = data['target_lun']
   733             # If the volume was exported just a few seconds previously then
   734             # If the volume was exported just a few seconds previously then
   734             # it will probably not be visible to the local adapter yet.
   735             # it will probably not be visible to the local adapter yet.
   735             # Invoke 'fcinfo remote-port' on all local HBA ports to trigger
   736             # Invoke 'fcinfo remote-port' on all local HBA ports to trigger
  1402         name = instance['name']
  1403         name = instance['name']
  1403         zone = self._get_zone_by_name(name)
  1404         zone = self._get_zone_by_name(name)
  1404         if zone is None:
  1405         if zone is None:
  1405             raise exception.InstanceNotFound(instance_id=name)
  1406             raise exception.InstanceNotFound(instance_id=name)
  1406 
  1407 
       
  1408         if self._get_state(zone) == power_state.SHUTDOWN:
       
  1409             self._power_on(instance)
       
  1410             return
       
  1411 
  1407         try:
  1412         try:
  1408             if reboot_type == 'SOFT':
  1413             if reboot_type == 'SOFT':
  1409                 zone.shutdown(['-r'])
  1414                 zone.shutdown(['-r'])
  1410             else:
  1415             else:
  1411                 zone.reboot()
  1416                 zone.reboot()