Пример #1
0
    def setUp(self):
        super(NetAppClusteredCIFSHelperTestCase, self).setUp()

        self.mock_context = mock.Mock()

        self.mock_client = mock.Mock()
        self.helper = cifs_cmode.NetAppCmodeCIFSHelper()
        self.helper.set_client(self.mock_client)
Пример #2
0
    def test_set_client(self):
        # The base class is abstract, so we'll use a subclass to test
        # base class functionality.
        helper = cifs_cmode.NetAppCmodeCIFSHelper()
        self.assertIsNone(helper._client)

        helper.set_client('fake_client')
        self.assertEqual('fake_client', helper._client)
    def setUp(self):
        super(NetAppClusteredCIFSHelperTestCase, self).setUp()

        # Mock loggers as themselves to allow logger arg validation
        mock_logger = log.getLogger('mock_logger')
        self.mock_object(cifs_cmode.LOG, 'error',
                         mock.Mock(side_effect=mock_logger.error))

        self.mock_context = mock.Mock()

        self.mock_client = mock.Mock()
        self.helper = cifs_cmode.NetAppCmodeCIFSHelper()
        self.helper.set_client(self.mock_client)
Пример #4
0
    def _get_helper(self, share):
        """Returns driver which implements share protocol."""
        share_protocol = share['share_proto'].lower()

        if share_protocol not in self.SUPPORTED_PROTOCOLS:
            err_msg = _("Invalid NAS protocol supplied: %s.") % share_protocol
            raise exception.NetAppException(err_msg)

        self._check_license_for_protocol(share_protocol)

        if share_protocol == 'nfs':
            return nfs_cmode.NetAppCmodeNFSHelper()
        elif share_protocol == 'cifs':
            return cifs_cmode.NetAppCmodeCIFSHelper()
Пример #5
0
 def _setup_helpers(self):
     """Initializes protocol-specific NAS drivers."""
     self._helpers = {
         'CIFS': cifs_cmode.NetAppCmodeCIFSHelper(),
         'NFS': nfs_cmode.NetAppCmodeNFSHelper()
     }