Exemplo n.º 1
0
    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_vdisk_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_name)s.",
                 {'disk_name': disk_name, 'mp_uuid': self.mp_uuid,
                  'vios_name': vios_uuid})
Exemplo n.º 2
0
    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_vdisk_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_name)s.",
                 {'disk_name': disk_name, 'mp_uuid': self.mp_uuid,
                 'vios_name': vios_uuid})
Exemplo n.º 3
0
    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_vdisk_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_name)s."
            ),
            {"disk_name": disk_name, "mp_uuid": self.mp_uuid, "vios_name": vios_uuid},
        )
Exemplo n.º 4
0
    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.
        """
        partition_id = vm.get_vm_id(self.adapter, lpar_uuid)
        return tsk_map.remove_vdisk_mapping(self.adapter, self.vios_uuid,
                                            partition_id,
                                            disk_prefixes=disk_type)
Exemplo n.º 5
0
    def _test_remove_storage_vdisk(self, *args, **kwargs):
        """Helper to test remove_storage_vdisk with various arguments."""
        # 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_vdisk_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.VDisk)
        self.assertEqual(self.v1resp.atom, vios.entry)
Exemplo n.º 6
0
    def test_remove_storage_vdisk(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_vdisk_mapping(
            self.adpt, 'fake_vios_uuid', 2, disk_names=['Ubuntu1410'])

        # 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.VDisk)