Exemplo n.º 1
0
    def _pre_live_migration_on_dest_legacy(self, vios_wraps, mig_data):
        # Used in case the source server is running an old nova-compute (ex.
        # Mitaka).  To be removed in Ocata or Pike.
        #
        # Need to first derive the port mappings that can be passed back
        # to the source system for the live migration call.  This tells
        # the source system what 'vfc mappings' to pass in on the live
        # migration command.
        for fabric in self._fabric_names():
            slots = jsonutils.loads(mig_data['src_npiv_fabric_slots_%s' %
                                             fabric])
            fabric_mapping = pvm_vfcm.build_migration_mappings_for_fabric(
                vios_wraps, self._fabric_ports(fabric), slots)
            mig_data['dest_npiv_fabric_mapping_%s' %
                     fabric] = (jsonutils.dumps(fabric_mapping))
            # Reverse the vios wrapper so that the other fabric will get the
            # on the second vios.
            vios_wraps.reverse()

        # Collate all of the individual fabric mappings into a single element.
        full_map = []
        for key, value in mig_data.items():
            if key.startswith('dest_npiv_fabric_mapping_'):
                full_map.extend(jsonutils.loads(value))
        mig_data['vfc_lpm_mappings'] = jsonutils.dumps(full_map)
Exemplo n.º 2
0
    def test_build_migration_mappings_for_fabric(self, mock_derive):
        vios_w = pvm_vios.VIOS.wrap(tju.load_file(VIOS_FILE).entry)
        vios_wraps = [vios_w]

        # Subset the WWPNs on that VIOS
        p_wwpns = ['10000090FA45473B', '10:00:00:90:fa:45:17:58']
        client_slots = ['1', '2']

        # The derive is non-deterministic.  That makes testing odd.  Force
        # a deterministic result.
        mock_derive.return_value = [('10000090FA451758', 'A A'),
                                    ('10000090FA45473B', 'B B')]

        # Build migration mappings success case
        resp = vfc_mapper.build_migration_mappings_for_fabric(
            vios_wraps, p_wwpns, client_slots)
        self.assertEqual(2, len(resp))
        self.assertEqual({'1/IO Server/1//fcs2', '2/IO Server/1//fcs1'},
                         set(resp))
Exemplo n.º 3
0
    def test_build_migration_mappings_for_fabric(self, mock_derive):
        vios_w = pvm_vios.VIOS.wrap(tju.load_file(VIOS_FILE).entry)
        vios_wraps = [vios_w]

        # Subset the WWPNs on that VIOS
        p_wwpns = ['10000090FA45473B', '10:00:00:90:fa:45:17:58']
        client_slots = ['1', '2']

        # The derive is non-deterministic.  That makes testing odd.  Force
        # a deterministic result.
        mock_derive.return_value = [('10000090FA451758', 'A A'),
                                    ('10000090FA45473B', 'B B')]

        # Build migration mappings success case
        resp = vfc_mapper.build_migration_mappings_for_fabric(
            vios_wraps, p_wwpns, client_slots)
        self.assertEqual(2, len(resp))
        self.assertEqual({'1/IO Server/1//fcs2', '2/IO Server/1//fcs1'},
                         set(resp))
Exemplo n.º 4
0
    def pre_live_migration_on_destination(self, mig_data):
        """Perform pre live migration steps for the volume on the target host.

        This method performs any pre live migration that is needed.

        Certain volume connectors may need to pass data from the source host
        to the target.  This may be required to determine how volumes connect
        through the Virtual I/O Servers.

        This method will be called after the pre_live_migration_on_source
        method.  The data from the pre_live call will be passed in via the
        mig_data.  This method should put its output into the dest_mig_data.

        :param mig_data: Dict of migration data for the destination server.
                         If the volume connector needs to provide
                         information to the live_migration command, it
                         should be added to this dictionary.
        """
        vios_wraps = self.stg_ftsk.feed

        # Need to first derive the port mappings that can be passed back
        # to the source system for the live migration call.  This tells
        # the source system what 'vfc mappings' to pass in on the live
        # migration command.
        for fabric in self._fabric_names():
            slots = jsonutils.loads(
                mig_data['src_npiv_fabric_slots_%s' % fabric])
            fabric_mapping = pvm_vfcm.build_migration_mappings_for_fabric(
                vios_wraps, self._fabric_ports(fabric), slots)
            mig_data['dest_npiv_fabric_mapping_%s' % fabric] = (
                jsonutils.dumps(fabric_mapping))
            # Reverse the vios wrapper so that the other fabric will get the
            # on the second vios.
            vios_wraps.reverse()

        # Collate all of the individual fabric mappings into a single element.
        full_map = []
        for key, value in mig_data.items():
            if key.startswith('dest_npiv_fabric_mapping_'):
                full_map.extend(jsonutils.loads(value))
        mig_data['vfc_lpm_mappings'] = jsonutils.dumps(full_map)
Exemplo n.º 5
0
    def pre_live_migration_on_destination(self, src_mig_data, dest_mig_data):
        """Perform pre live migration steps for the volume on the target host.

        This method performs any pre live migration that is needed.

        Certain volume connectors may need to pass data from the source host
        to the target.  This may be required to determine how volumes connect
        through the Virtual I/O Servers.

        This method will be called after the pre_live_migration_on_source
        method.  The data from the pre_live call will be passed in via the
        mig_data.  This method should put its output into the dest_mig_data.

        :param src_mig_data: The migration data from the source server.
        :param dest_mig_data: The migration data for the destination server.
                              If the volume connector needs to provide
                              information to the live_migration command, it
                              should be added to this dictionary.
        """
        vios_wraps = self.stg_ftsk.feed

        # Need to first derive the port mappings that can be passed back
        # to the source system for the live migration call.  This tells
        # the source system what 'vfc mappings' to pass in on the live
        # migration command.
        for fabric in self._fabric_names():
            slots = src_mig_data['npiv_fabric_slots_%s' % fabric]
            fabric_mapping = pvm_vfcm.build_migration_mappings_for_fabric(
                vios_wraps, self._fabric_ports(fabric), slots)
            dest_mig_data['npiv_fabric_mapping_%s' % fabric] = fabric_mapping
            # Reverse the vios wrapper so that the other fabric will get the
            # on the second vios.
            vios_wraps.reverse()

        # Collate all of the individual fabric mappings into a single element.
        full_map = []
        for key, value in dest_mig_data.items():
            if key.startswith('npiv_fabric_mapping_'):
                full_map.extend(value)
        dest_mig_data['vfc_lpm_mappings'] = full_map
Exemplo n.º 6
0
    def pre_live_migration_on_destination(self, src_mig_data, dest_mig_data):
        """Perform pre live migration steps for the volume on the target host.

        This method performs any pre live migration that is needed.

        Certain volume connectors may need to pass data from the source host
        to the target.  This may be required to determine how volumes connect
        through the Virtual I/O Servers.

        This method will be called after the pre_live_migration_on_source
        method.  The data from the pre_live call will be passed in via the
        mig_data.  This method should put its output into the dest_mig_data.

        :param src_mig_data: The migration data from the source server.
        :param dest_mig_data: The migration data for the destination server.
                              If the volume connector needs to provide
                              information to the live_migration command, it
                              should be added to this dictionary.
        """
        vios_wraps = self.stg_ftsk.feed
        mgmt_uuid = mgmt.get_mgmt_partition(self.adapter).uuid

        # Each mapping should attempt to remove itself from the management
        # partition.
        for fabric in self._fabric_names():
            npiv_port_maps = self._get_fabric_meta(fabric)

            # Need to first derive the port mappings that can be passed back
            # to the source system for the live migration call.  This tells
            # the source system what 'vfc mappings' to pass in on the live
            # migration command.
            slots = src_mig_data['npiv_fabric_slots_%s' % fabric]
            fabric_mapping = pvm_vfcm.build_migration_mappings_for_fabric(
                vios_wraps, self._fabric_ports(fabric), slots)
            dest_mig_data['npiv_fabric_mapping_%s' % fabric] = fabric_mapping

            # Next we need to remove the mappings off the mgmt partition.
            for npiv_port_map in npiv_port_maps:
                ls = [
                    LOG.info,
                    _LI("Removing mgmt NPIV mapping for instance "
                        "%(inst)s for fabric %(fabric)s."), {
                            'inst': self.instance.name,
                            'fabric': fabric
                        }
                ]
                vios_w, vfc_map = pvm_vfcm.find_vios_for_vfc_wwpns(
                    vios_wraps, npiv_port_map[1].split())

                if vios_w is not None:
                    # Add the subtask to remove the mapping from the management
                    # partition.
                    task_wrapper = self.stg_ftsk.wrapper_tasks[vios_w.uuid]
                    task_wrapper.add_functor_subtask(
                        pvm_vfcm.remove_maps,
                        mgmt_uuid,
                        client_adpt=vfc_map.client_adapter,
                        logspec=ls)
                else:
                    LOG.warn(
                        _LW("No storage connections found between the "
                            "Virtual I/O Servers and FC Fabric "
                            "%(fabric)s. The connection might be removed "
                            "already."), {'fabric': fabric})

        # TODO(thorst) Find a better place for this execute.  Works for now
        # as the stg_ftsk is all local.  Also won't do anything if there
        # happen to be no fabric changes.
        self.stg_ftsk.execute()

        # Collate all of the individual fabric mappings into a single element.
        full_map = []
        for key, value in dest_mig_data.items():
            if key.startswith('npiv_fabric_mapping_'):
                full_map.extend(value)
        dest_mig_data['vfc_lpm_mappings'] = full_map
Exemplo n.º 7
0
    def pre_live_migration_on_destination(self, src_mig_data, dest_mig_data):
        """Perform pre live migration steps for the volume on the target host.

        This method performs any pre live migration that is needed.

        Certain volume connectors may need to pass data from the source host
        to the target.  This may be required to determine how volumes connect
        through the Virtual I/O Servers.

        This method will be called after the pre_live_migration_on_source
        method.  The data from the pre_live call will be passed in via the
        mig_data.  This method should put its output into the dest_mig_data.

        :param src_mig_data: The migration data from the source server.
        :param dest_mig_data: The migration data for the destination server.
                              If the volume connector needs to provide
                              information to the live_migration command, it
                              should be added to this dictionary.
        """
        vios_wraps = self.stg_ftsk.feed
        mgmt_uuid = mgmt.get_mgmt_partition(self.adapter).uuid

        # Each mapping should attempt to remove itself from the management
        # partition.
        for fabric in self._fabric_names():
            npiv_port_maps = self._get_fabric_meta(fabric)

            # Need to first derive the port mappings that can be passed back
            # to the source system for the live migration call.  This tells
            # the source system what 'vfc mappings' to pass in on the live
            # migration command.
            slots = src_mig_data['npiv_fabric_slots_%s' % fabric]
            fabric_mapping = pvm_vfcm.build_migration_mappings_for_fabric(
                vios_wraps, self._fabric_ports(fabric), slots)
            dest_mig_data['npiv_fabric_mapping_%s' % fabric] = fabric_mapping

            # Next we need to remove the mappings off the mgmt partition.
            for npiv_port_map in npiv_port_maps:
                ls = [LOG.info, _LI("Removing mgmt NPIV mapping for instance "
                                    "%(inst)s for fabric %(fabric)s."),
                      {'inst': self.instance.name, 'fabric': fabric}]
                vios_w, vfc_map = pvm_vfcm.find_vios_for_vfc_wwpns(
                    vios_wraps, npiv_port_map[1].split())

                if vios_w is not None:
                    # Add the subtask to remove the mapping from the management
                    # partition.
                    task_wrapper = self.stg_ftsk.wrapper_tasks[vios_w.uuid]
                    task_wrapper.add_functor_subtask(
                        pvm_vfcm.remove_maps, mgmt_uuid,
                        client_adpt=vfc_map.client_adapter, logspec=ls)
                else:
                    LOG.warn(_LW("No storage connections found between the "
                                 "Virtual I/O Servers and FC Fabric "
                                 "%(fabric)s. The connection might be removed "
                                 "already."), {'fabric': fabric})

        # TODO(thorst) Find a better place for this execute.  Works for now
        # as the stg_ftsk is all local.  Also won't do anything if there
        # happen to be no fabric changes.
        self.stg_ftsk.execute()

        # Collate all of the individual fabric mappings into a single element.
        full_map = []
        for key, value in dest_mig_data.items():
            if key.startswith('npiv_fabric_mapping_'):
                full_map.extend(value)
        dest_mig_data['vfc_lpm_mappings'] = full_map