Ejemplo n.º 1
0
 def power_on(self,
              context,
              instance,
              network_info,
              block_device_info=None):
     inst = vm.PartitionInstance(instance, self._cpc)
     inst.power_on_vm()
Ejemplo n.º 2
0
    def test_get_fc_boot_props(self, mock_block_device,
                               mock_get_partition_wwpns, mock_get_partition):

        inst = vm.PartitionInstance(mock.Mock(), mock.Mock())
        target_wwpn, lun = self.dpmdriver.get_fc_boot_props(mock.Mock(), inst)
        self.assertEqual(target_wwpn, '500507680B214AC1')
        self.assertEqual(lun, '0')
Ejemplo n.º 3
0
 def reboot(self,
            context,
            instance,
            network_info,
            reboot_type,
            block_device_info=None,
            bad_volumes_callback=None):
     inst = vm.PartitionInstance(instance, self._cpc)
     inst.reboot_vm()
Ejemplo n.º 4
0
 def test_get_fc_boot_props_ignore_list(self, mock_block_device,
                                        mock_get_partition_wwpns,
                                        mock_get_partition):
     self.flags(group="dpm", target_wwpn_ignore_list=["500507680B214AC1"])
     self.dpmdriver.init_host(None)
     inst = vm.PartitionInstance(mock.Mock(), mock.Mock())
     target_wwpn, lun = self.dpmdriver.get_fc_boot_props(mock.Mock(), inst)
     self.assertEqual(target_wwpn, '500507680B244AC0')
     self.assertEqual(lun, '0')
Ejemplo n.º 5
0
    def prep_for_spawn(self, context, instance, flavor=None):
        if not flavor:
            context = context_object.get_admin_context(read_deleted='yes')
            flavor = (flavor_object.Flavor.get_by_id(
                context, instance.instance_type_id))
        LOG.debug("Flavor = %(flavor)s" % {'flavor': flavor})

        inst = vm.PartitionInstance(instance, self._cpc, flavor)
        inst.create(inst.properties())

        inst.attach_hbas()
Ejemplo n.º 6
0
 def destroy(self,
             context,
             instance,
             network_info,
             block_device_info=None,
             destroy_disks=True,
             migrate_data=None):
     inst = vm.PartitionInstance(instance, self._cpc)
     # Need to save wwpns before deletion of the partition
     # Because after driver.destroy function driver.get_volume_connector
     # will be called which required hbas wwpns of partition.
     self.deleted_instance_wwpns_mapping[
         instance.uuid] = inst.get_partition_wwpns()
     inst.destroy()
Ejemplo n.º 7
0
    def spawn(self,
              context,
              instance,
              image_meta,
              injected_files,
              admin_password,
              network_info=None,
              block_device_info=None,
              flavor=None):

        inst = vm.PartitionInstance(instance, self._cpc)

        # The creation of NICs is limited in DPM by the partitions
        # boot-os-specific-parameters property. It is used to pass additional
        # network configuration data into the partitions Operating System
        if len(network_info) > constants.MAX_NICS_PER_PARTITION:
            # TODO(andreas_s): How to handle cleanup?
            # TODO(andreas_s): Not sure about the naming. Should we use
            # "NIC" or "Port"?
            raise exceptions.MaxAmountOfInstancePortsExceededError(
                _("Exceeded the maximum number of Ports per Instance. A single "
                  "DPM Instance can only be attached to {max_ports} Ports, but "
                  "{current_ports} Ports have been requested.").format(
                      max_ports=constants.MAX_NICS_PER_PARTITION,
                      current_ports=len(network_info)))
        nic_boot_string = ""
        for vif in network_info:
            nic = inst.attach_nic(vif)
            nic_boot_string += self._get_nic_string_for_guest_os(nic, vif)
        inst.set_boot_os_specific_parameters(nic_boot_string)

        hba_uri = inst.get_boot_hba_uri()

        LOG.debug("HBA boot uri %(uri)s for the instance %(name)s" % {
            'uri': hba_uri,
            'name': instance.hostname
        })

        target_wwpn, lun = self.get_fc_boot_props(block_device_info, inst)

        inst.set_boot_properties(target_wwpn, lun, hba_uri)
        inst.launch()
Ejemplo n.º 8
0
    def get_volume_connector(self, instance):
        """Get connector information for the instance for attaching to volumes.

        Connector information is a dictionary representing the initiator WWPNs
        and a unique identifier of the partition.
            {
                'wwpns': list of wwpns,
                'host': UUID of instance
            }

        Cinder creates a corresponding "host" on the Storage Subsystem,
        representing the Instance and discovers the instances LUNs
        to see which storage paths are active.
        """
        props = {}
        # 'get_volume_connector' will be invoked during creation
        # of the partition and during deletion of the partition.
        # But 'wwpns' we can access only when partition is available.
        # During spawn flow 'get_volume_connector' function will be called
        # before 'spawn' function so to get 'wwpns' we first creating
        # the partition using 'prep_for_spawn' function so that
        # we can access 'wwpns'.(i.e - else part)
        # But during deletion 'get_volume_connector' will be called
        # after 'destroy' function which will delete the partition so
        # after that we can not get the 'wwpns'
        # In order to get 'wwpns' after 'destroy' function we are
        # saving 'wwpns' before deleting partition in 'destroy' function
        # in 'deleted_instance_wwpns_mapping' variable and using these 'wwpns'
        # in 'get_volume_connector'(i.e - if part)
        # after using these 'wwpns' we are removing these 'wwpns' from
        # 'deleted_instance_wwpns_mapping' variable because
        # we are not going to use these 'wwpns' any more after this.
        if instance.uuid in self.deleted_instance_wwpns_mapping:
            props['wwpns'] = self.deleted_instance_wwpns_mapping.pop(
                instance.uuid)
        else:
            inst = vm.PartitionInstance(instance, self._cpc)
            props['wwpns'] = inst.get_partition_wwpns()

        props['host'] = instance.uuid

        return props
Ejemplo n.º 9
0
 def power_off(self, instance, timeout=0, retry_interval=0):
     inst = vm.PartitionInstance(instance, self._cpc)
     inst.power_off_vm()