def disconnect_disk_from_mgmt(self, vios_uuid, disk_name): """Disconnect a disk from the management partition. :param vios_uuid: The UUID of the Virtual I/O Server serving the mapping. :param disk_name: The name of the disk to unmap. """ tsk_map.remove_lu_mapping(self.adapter, vios_uuid, self.mp_uuid, disk_names=[disk_name]) LOG.info("Unmapped boot disk %(disk_name)s from the management " "partition from Virtual I/O Server %(vios_uuid)s.", {'disk_name': disk_name, 'mp_uuid': self.mp_uuid, 'vios_uuid': vios_uuid})
def disconnect_disk_from_mgmt(self, vios_uuid, disk_name): """Disconnect a disk from the management partition. :param vios_uuid: The UUID of the Virtual I/O Server serving the mapping. :param disk_name: The name of the disk to unmap. """ tsk_map.remove_lu_mapping(self.adapter, vios_uuid, self.mp_uuid, disk_names=[disk_name]) LOG.info(_LI( "Unmapped boot disk %(disk_name)s from the management partition " "from Virtual I/O Server %(vios_uuid)s."), { 'disk_name': disk_name, 'mp_uuid': self.mp_uuid, 'vios_uuid': vios_uuid})
def disconnect_image_disk(self, context, instance, lpar_uuid, disk_type=None): """Disconnects the storage adapters from the image disk. :param context: nova context for operation :param instance: instance to disconnect the image for. :param lpar_uuid: The UUID for the pypowervm LPAR element. :param disk_type: The list of disk types to remove or None which means to remove all disks from the VM. :return: A list of all the backing storage elements that were disconnected from the I/O Server and VM. """ lpar_qps = vm.get_vm_qp(self.adapter, lpar_uuid) lpar_id = lpar_qps['PartitionID'] host_uuid = pvm_u.get_req_path_uuid( lpar_qps['AssociatedManagedSystem'], preserve_case=True) lu_set = set() # The mappings will normally be the same on all VIOSes, unless a VIOS # was down when a disk was added. So for the return value, we need to # collect the union of all relevant mappings from all VIOSes. for vios_uuid in self._vios_uuids(host_uuid=host_uuid): for lu in tsk_map.remove_lu_mapping( self.adapter, vios_uuid, lpar_id, disk_prefixes=disk_type): lu_set.add(lu) return list(lu_set)
def _test_remove_storage_lu(self, *args, **kwargs): # Mock Data self.adpt.read.return_value = self.v1resp # Validate that the mapping was removed from existing def validate_update(*kargs, **kwa): vios_w = kargs[0] self.assertEqual(4, len(vios_w.scsi_mappings)) return vios_w.entry self.adpt.update_by_path.side_effect = validate_update # Run the code vios, remel = scsi_mapper.remove_lu_mapping(*args, **kwargs) # Make sure that our validation code above was invoked self.assertEqual(1, self.adpt.update_by_path.call_count) self.assertEqual(1, len(remel)) self.assertIsInstance(remel[0], pvm_stor.LU) self.assertEqual(self.v1resp.atom, vios.entry)
def test_remove_storage_lu(self): # Mock Data self.adpt.read.return_value = tju.load_file(VIO_MULTI_MAP_FILE, self.adpt) # Validate that the mapping was removed from existing def validate_update(*kargs, **kwargs): vios_w = kargs[0] self.assertEqual(4, len(vios_w.scsi_mappings)) return vios_w.entry self.adpt.update_by_path.side_effect = validate_update # Run the code vios, remel = scsi_mapper.remove_lu_mapping( self.adpt, 'fake_vios_uuid', 2) # Make sure that our validation code above was invoked self.assertEqual(1, self.adpt.update_by_path.call_count) self.assertEqual(1, len(remel)) self.assertIsInstance(remel[0], pvm_stor.LU)