def rm_hdisk(): try: # Attempt to remove the hDisk hdisk.remove_hdisk(self.adapter, CONF.host, device_name, vio_wrap.uuid) except Exception as e: # If there is a failure, log it, but don't stop the process LOG.warn(_LW("There was an error removing the hdisk " "%(disk)s from the Virtual I/O Server."), {'disk': device_name}) LOG.warn(e)
def rm_hdisk(): LOG.info(_LI("Running remove for hdisk: '%s'") % device_name) try: # Attempt to remove the hDisk hdisk.remove_hdisk(self.adapter, CONF.host, device_name, vio_wrap.uuid) except Exception as e: # If there is a failure, log it, but don't stop the process LOG.warning( _LW("There was an error removing the hdisk " "%(disk)s from the Virtual I/O Server."), {"disk": device_name}, ) LOG.warning(e)
def rm_hdisk(): try: # Attempt to remove the hDisk hdisk.remove_hdisk(self.adapter, CONF.host, device_name, vio_wrap.uuid) except Exception as e: # If there is a failure, log it, but don't stop the process LOG.warn( _LW("There was an error removing the hdisk " "%(disk)s from the Virtual I/O Server."), {'disk': device_name}) LOG.warn(e)
def rm_hdisk(): LOG.info("Removing hdisk %(hdisk)s from Virtual I/O Server " "%(vios)s", {'hdisk': device_name, 'vios': vio_wrap.name}, instance=self.instance) try: # Attempt to remove the hDisk hdisk.remove_hdisk(self.adapter, CONF.host, device_name, vio_wrap.uuid) except Exception: # If there is a failure, log it, but don't stop the process LOG.exception("There was an error removing the hdisk " "%(disk)s from Virtual I/O Server %(vios)s.", {'disk': device_name, 'vios': vio_wrap.name}, instance=self.instance)
def disconnect_volume(self, adapter, host_uuid, vm_uuid, instance, connection_info): """Disconnect the volume. :param adapter: The pypowervm adapter. :param host_uuid: The pypowervm UUID of the host. :param vm_uuid: The powervm UUID of the VM. :param instance: The nova instance that the volume should disconnect from. :param connection_info: Comes from the BDM. Example connection_info: { 'driver_volume_type':'fibre_channel', 'serial':u'10d9934e-b031-48ff-9f02-2ac533e331c8', 'data':{ 'initiator_target_map':{ '21000024FF649105':['500507680210E522'], '21000024FF649104':['500507680210E522'], '21000024FF649107':['500507680210E522'], '21000024FF649106':['500507680210E522'] }, 'target_discovered':False, 'qos_specs':None, 'volume_id':'10d9934e-b031-48ff-9f02-2ac533e331c8', 'target_lun':0, 'access_mode':'rw', 'target_wwn':'500507680210E522' } """ volume_id = connection_info['data']['volume_id'] try: # Get VIOS feed vios_feed = vios.get_active_vioses(adapter, host_uuid, xag=_XAGS) # Iterate through host vios list to find hdisks to disconnect. for vio_wrap in vios_feed: LOG.debug("vios uuid %s" % vio_wrap.uuid) try: volume_udid = self._get_udid(instance, vio_wrap.uuid, volume_id) device_name = vio_wrap.hdisk_from_uuid(volume_udid) if not device_name: LOG.info(_LI(u"Disconnect Volume: No mapped device " "found on vios %(vios)s for volume " "%(volume_id)s. volume_uid: " "%(volume_uid)s ") % {'volume_uid': volume_udid, 'volume_id': volume_id, 'vios': vio_wrap.name}) continue except Exception as e: LOG.error(_LE(u"Disconnect Volume: Failed to find disk " "on vios %(vios_name)s for volume " "%(volume_id)s. volume_uid: %(volume_uid)s." "Error: %(error)s") % {'error': e, 'volume_uid': volume_udid, 'volume_id': volume_id, 'vios_name': vio_wrap.name}) continue # We have found the device name LOG.info(_LI(u"Disconnect Volume: Discovered the device " "%(hdisk)s on vios %(vios_name)s for volume " "%(volume_id)s. volume_uid: %(volume_uid)s.") % {'volume_uid': volume_udid, 'volume_id': volume_id, 'vios_name': vio_wrap.name, 'hdisk': device_name}) partition_id = vm.get_vm_id(adapter, vm_uuid) tsk_map.remove_pv_mapping(adapter, vio_wrap.uuid, partition_id, device_name) try: # Attempt to remove the hDisk hdisk.remove_hdisk(adapter, CONF.host, device_name, vio_wrap.uuid) except Exception as e: # If there is a failure, log it, but don't stop the process msg = (_LW("There was an error removing the hdisk " "%(disk)s from the Virtual I/O Server.") % {'disk': device_name}) LOG.warn(msg) LOG.warn(e) # Disconnect volume complete, now remove key self._delete_udid_key(instance, vio_wrap.uuid, volume_id) except Exception as e: LOG.error(_LE('Cannot detach volumes from virtual machine: %s') % vm_uuid) LOG.exception(_LE(u'Error: %s') % e) ex_args = {'backing_dev': device_name, 'instance_name': instance.name, 'reason': six.text_type(e)} raise pexc.VolumeDetachFailed(**ex_args)