def test_get_fc_targets_filtered(self):
     self.fc_driver.adapter.allowed_ports = ["58:cc:f0:98:49:23:07:02"]
     wwns = self.fc_driver.adapter._get_fc_targets()
     self.assertEqual(1, len(wwns))
     self.assertFalse(
         utils.fc_wwn_to_string("58:cc:f0:98:49:21:07:02") in wwns
     )
Esempio n. 2
0
 def test_get_fc_targets_filtered(self, mock_get_ip_pool):
     mock_get_ip_pool.return_value = self.fake_fc_wwns_response
     self.fc_driver.adapter.allowed_ports = ["58:cc:f0:98:49:23:07:02"]
     wwns = self.fc_driver.adapter._get_fc_targets("A1")
     self.assertEqual(1, len(wwns))
     self.assertFalse(
         utils.fc_wwn_to_string("58:cc:f0:98:49:21:07:02") in wwns
     )
Esempio n. 3
0
    def _get_fc_targets(self, appliance_id):
        """Get available FC WWNs for PowerStore appliance.

        :param appliance_id: PowerStore appliance id
        :return: list of FC WWNs
        """

        wwns = []
        fc_ports = self.client.get_fc_port(appliance_id)
        for port in fc_ports:
            if self._port_is_allowed(port["wwn"]):
                wwns.append(utils.fc_wwn_to_string(port["wwn"]))
        if not wwns:
            msg = _("There are no accessible Fibre Channel targets on the "
                    "system.")
            raise exception.VolumeBackendAPIException(data=msg)
        return wwns