Exemplo n.º 1
0
    def _get_managed_pools(self, pool_conf):
        # Get the real pools from the backend storage
        real_pools = set(pool.name for pool in self.client.get_pool())

        if not pool_conf:
            LOG.debug("No storage pool is specified, so all pools in storage "
                      "system will be managed.")
            return real_pools

        matched_pools, unmanaged_pools = unity_utils.do_match(
            real_pools, pool_conf)

        if not matched_pools:
            msg = (_("All the specified storage pools to be managed "
                     "do not exist. Please check your configuration "
                     "emc_nas_pool_names in manila.conf. "
                     "The available pools in the backend are %s") %
                   ",".join(real_pools))
            raise exception.BadConfigurationException(reason=msg)

        if unmanaged_pools:
            LOG.info(
                "The following specified storage pools "
                "are not managed by the backend: "
                "%(un_managed)s. This host will only manage "
                "the storage pools: %(exist)s", {
                    'un_managed': ",".join(unmanaged_pools),
                    'exist': ",".join(matched_pools)
                })
        else:
            LOG.debug("Storage pools: %s will be managed.",
                      ",".join(matched_pools))

        return matched_pools
Exemplo n.º 2
0
    def _get_managed_pools(self, pool_conf):
        # Get the real pools from the backend storage
        real_pools = set(pool.name for pool in self.client.get_pool())

        if not pool_conf:
            LOG.debug("No storage pool is specified, so all pools in storage "
                      "system will be managed.")
            return real_pools

        matched_pools, unmanaged_pools = unity_utils.do_match(real_pools,
                                                              pool_conf)

        if not matched_pools:
            msg = (_("All the specified storage pools to be managed "
                     "do not exist. Please check your configuration "
                     "emc_nas_pool_names in manila.conf. "
                     "The available pools in the backend are %s") %
                   ",".join(real_pools))
            raise exception.BadConfigurationException(reason=msg)

        if unmanaged_pools:
            LOG.info(_LI("The following specified storage pools "
                         "are not managed by the backend: "
                         "%(un_managed)s. This host will only manage "
                         "the storage pools: %(exist)s"),
                     {'un_managed': ",".join(unmanaged_pools),
                      'exist': ",".join(matched_pools)})
        else:
            LOG.debug("Storage pools: %s will be managed.",
                      ",".join(matched_pools))

        return matched_pools
Exemplo n.º 3
0
    def _get_managed_ports(self, port_conf, sp):
        # Get the real ports from the backend storage
        real_ports = set([port.id for port in self.client.get_ip_ports(sp)])

        if not port_conf:
            LOG.debug("No ports are specified, so all ports in storage "
                      "system will be managed.")
            return real_ports

        matched_ports, unmanaged_ports = unity_utils.do_match(
            real_ports, port_conf)

        if not matched_ports:
            msg = (_("All the specified storage ports to be managed "
                     "do not exist. Please check your configuration "
                     "emc_interface_ports in manila.conf. "
                     "The available ports in the backend are %s") %
                   ",".join(real_ports))
            raise exception.BadConfigurationException(reason=msg)

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

        return matched_ports
Exemplo n.º 4
0
    def test_do_match(self, data):
        full = ['pool_1 ', ' pool_2', ' nas_server_pool ']
        matcher = data['matcher']
        expected_matched = data['matched']
        expected_not_matched = data['not_matched']

        matched, not_matched = utils.do_match(full, matcher)
        self.assertEqual(expected_matched, matched)
        self.assertEqual(expected_not_matched, not_matched)
Exemplo n.º 5
0
    def test_do_match(self, data):
        full = ['pool_1 ', ' pool_2', ' nas_server_pool ']
        matcher = data['matcher']
        expected_matched = data['matched']
        expected_not_matched = data['not_matched']

        matched, not_matched = utils.do_match(full, matcher)
        self.assertEqual(expected_matched, matched)
        self.assertEqual(expected_not_matched, not_matched)