Beispiel #1
0
 def _get_switch_info(self, host_id):
     for switch_ip, attr in self._nexus_switches:
         if str(attr) == str(host_id):
             port_id = self._nexus_switches[switch_ip, attr]
             return port_id, switch_ip
     else:
         raise excep.NexusComputeHostNotConfigured(host=host_id)
    def _get_switch_info(self, host_id):
        host_connections = []
        for switch_ip, attr in self._nexus_switches:
            if str(attr) == str(host_id):
                port_id = self._nexus_switches[switch_ip, attr]
                if ':' in port_id:
                    intf_type, port = port_id.split(':')
                else:
                    intf_type, port = 'ethernet', port_id
                host_connections.append((switch_ip, intf_type, port))

        if host_connections:
            return host_connections
        else:
            raise excep.NexusComputeHostNotConfigured(host=host_id)