Example #1
0
    def _get_managed_storage_pools(self, pools):
        matched_pools = set()
        if pools:
            # Get the real pools from the backend storage
            status, backend_pools = self._get_context('StoragePool').get_all()
            if status != constants.STATUS_OK:
                message = (_("Failed to get storage pool information. "
                             "Reason: %s") % backend_pools)
                LOG.error(message)
                raise exception.EMCVnxXMLAPIError(err=message)

            real_pools = set([item for item in backend_pools])
            conf_pools = set([item.strip() for item in pools])
            matched_pools, unmatched_pools = vnx_utils.do_match_any(
                real_pools, conf_pools)

            if not matched_pools:
                msg = (_("None of the specified storage pools to be managed "
                         "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.InvalidParameterValue(err=msg)

            LOG.info(_LI("Storage pools: %s will be managed."),
                     ",".join(matched_pools))
        else:
            LOG.debug("No storage pool is specified, so all pools "
                      "in storage system will be managed.")
        return matched_pools
Example #2
0
    def _get_managed_storage_pools(self, pools):
        matched_pools = set()
        if pools:
            # Get the real pools from the backend storage
            status, backend_pools = self._get_context('StoragePool').get_all()
            if status != constants.STATUS_OK:
                message = (_("Failed to get storage pool information. "
                             "Reason: %s") % backend_pools)
                LOG.error(message)
                raise exception.EMCVnxXMLAPIError(err=message)

            real_pools = set([item for item in backend_pools])
            conf_pools = set([item.strip() for item in pools])
            matched_pools, unmatched_pools = vnx_utils.do_match_any(
                real_pools, conf_pools)

            if not matched_pools:
                msg = (_("None of the specified storage pools to be managed "
                         "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.InvalidParameterValue(err=msg)

            LOG.info(_LI("Storage pools: %s will be managed."),
                     ",".join(matched_pools))
        else:
            LOG.debug("No storage pool is specified, so all pools "
                      "in storage system will be managed.")
        return matched_pools
Example #3
0
    def get_managed_ports(self):
        # Get the real ports(devices) list from the backend storage
        real_ports = self._get_physical_devices(self.mover_name)

        if not self.port_conf:
            LOG.debug("No ports are specified, so any of the ports on the " "Data Mover can be used.")
            return real_ports

        matched_ports, unmanaged_ports = vnx_utils.do_match_any(real_ports, self.port_conf)

        if not matched_ports:
            msg = _(
                "None of the specified network ports exist. "
                "Please check your configuration emc_interface_ports "
                "in manila.conf. The available ports on the Data Mover "
                "are %s."
            ) % ",".join(real_ports)
            raise exception.BadConfigurationException(reason=msg)

        LOG.debug("Ports: %s can be used.", ",".join(matched_ports))

        return list(matched_ports)
Example #4
0
    def get_managed_ports(self):
        # Get the real ports(devices) list from the backend storage
        real_ports = self._get_physical_devices(self.mover_name)

        if not self.port_conf:
            LOG.debug("No ports are specified, so any of the ports on the "
                      "Data Mover can be used.")
            return real_ports

        matched_ports, unmanaged_ports = vnx_utils.do_match_any(
            real_ports, self.port_conf)

        if not matched_ports:
            msg = (_("None of the specified network ports exist. "
                     "Please check your configuration emc_interface_ports "
                     "in manila.conf. The available ports on the Data Mover "
                     "are %s.") % ",".join(real_ports))
            raise exception.BadConfigurationException(reason=msg)

        LOG.debug("Ports: %s can be used.", ",".join(matched_ports))

        return list(matched_ports)
Example #5
0
 def test_do_match_any(self, full, matchers, matched, unmatched):
     real_matched, real_unmatched = utils.do_match_any(
         full, matchers)
     self.assertEqual(matched, real_matched)
     self.assertEqual(unmatched, real_unmatched)