Example #1
0
    def validate_port_configuration(self, port_ids_conf):
        """Initializes the SP and ports based on the port option."""

        ports = self.client.get_file_ports()

        sp_ports_map, unmanaged_port_ids = unity_utils.match_ports(
            ports, port_ids_conf)

        if not sp_ports_map:
            msg = (_("All the specified storage ports to be managed "
                     "do not exist. Please check your configuration "
                     "unity_ethernet_ports in manila.conf. "
                     "The available ports in the backend are %s.") %
                   ",".join([port.get_id() for port in ports]))
            raise exception.BadConfigurationException(reason=msg)

        if unmanaged_port_ids:
            LOG.info(
                "The following specified ports are not managed by "
                "the backend: %(unmanaged)s. This host will only "
                "manage the storage ports: %(exist)s", {
                    'unmanaged': ",".join(unmanaged_port_ids),
                    'exist': ",".join(map(",".join, sp_ports_map.values()))
                })
        else:
            LOG.debug("Ports: %s will be managed.",
                      ",".join(map(",".join, sp_ports_map.values())))

        if len(sp_ports_map) == 1:
            LOG.info(
                "Only ports of %s are configured. Configure ports "
                "of both SPA and SPB to use both of the SPs.",
                list(sp_ports_map)[0])

        return sp_ports_map
Example #2
0
    def validate_port_configuration(self, port_ids_conf):
        """Initializes the SP and ports based on the port option."""

        ports = self.client.get_file_ports()

        sp_ports_map, unmanaged_port_ids = unity_utils.match_ports(
            ports, port_ids_conf)

        if not sp_ports_map:
            msg = (_("All the specified storage ports to be managed "
                     "do not exist. Please check your configuration "
                     "unity_ethernet_ports in manila.conf. "
                     "The available ports in the backend are %s.") %
                   ",".join([port.get_id() for port in ports]))
            raise exception.BadConfigurationException(reason=msg)

        if unmanaged_port_ids:
            LOG.info(_LI("The following specified ports are not managed by "
                         "the backend: %(unmanaged)s. This host will only "
                         "manage the storage ports: %(exist)s"),
                     {'unmanaged': ",".join(unmanaged_port_ids),
                      'exist': ",".join(map(",".join,
                                            sp_ports_map.values()))})
        else:
            LOG.debug("Ports: %s will be managed.",
                      ",".join(map(",".join, sp_ports_map.values())))

        if len(sp_ports_map) == 1:
            LOG.info(_LI("Only ports of %s are configured. Configure ports "
                         "of both SPA and SPB to use both of the SPs."),
                     list(sp_ports_map)[0])

        return sp_ports_map
Example #3
0
 def test_match_ports(self, ports, ids_conf, port_map, unmanaged):
     sp_ports_map, unmanaged_port_ids = utils.match_ports(ports, ids_conf)
     self.assertEqual(port_map, sp_ports_map)
     self.assertEqual(unmanaged, unmanaged_port_ids)
Example #4
0
 def test_match_ports(self, ports, ids_conf, port_map, unmanaged):
     sp_ports_map, unmanaged_port_ids = utils.match_ports(ports,
                                                          ids_conf)
     self.assertEqual(port_map, sp_ports_map)
     self.assertEqual(unmanaged, unmanaged_port_ids)