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
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
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)