Exemplo n.º 1
0
    def setUp(self):
        super(LVMShareDriverTestCase, self).setUp()
        fake_utils.stub_out_utils_execute(self.stubs)
        self._execute = fake_utils.fake_execute
        self._context = context.get_admin_context()

        CONF.set_default('share_volume_group', 'fakevg')
        CONF.set_default('share_export_ip', '10.0.0.1')

        self._helper_cifs = mock.Mock()
        self._helper_nfs = mock.Mock()
        self.fake_conf = Configuration(None)
        self._db = mock.Mock()
        self._os = lvm.os = mock.Mock()
        self._os.path.join = os.path.join
        self._driver = lvm.LVMShareDriver(self._db,
                                          execute=self._execute,
                                          configuration=self.fake_conf)
        self._driver._helpers = {
            'CIFS': self._helper_cifs,
            'NFS': self._helper_nfs,
        }

        self.share = fake_share()
        self.access = fake_access()
        self.snapshot = fake_snapshot()

        # Used only to test compatibility with share manager
        self.share_server = "fake_share_server"
Exemplo n.º 2
0
 def setUp(self):
     super(NFSHelperTestCase, self).setUp()
     fake_utils.stub_out_utils_execute(self.stubs)
     CONF.set_default('share_export_ip', '127.0.0.1')
     self._execute = fake_utils.fake_execute
     self.fake_conf = Configuration(None)
     self._helper = lvm.NFSHelper(self._execute, self.fake_conf)
     fake_utils.fake_execute_clear_log()
Exemplo n.º 3
0
 def setUp(self):
     super(NFSHelperTestCase, self).setUp()
     fake_utils.stub_out_utils_execute(self.stubs)
     self.fake_conf = Configuration(None)
     self._ssh_exec = mock.Mock(return_value=('', ''))
     self._execute = mock.Mock(return_value=('', ''))
     self._helper = generic.NFSHelper(self._execute, self._ssh_exec,
                                      self.fake_conf)
Exemplo n.º 4
0
    def setUp(self):
        super(GenericShareDriverTestCase, self).setUp()
        self._context = context.get_admin_context()
        self._execute = mock.Mock(return_value=('', ''))

        self._helper_cifs = mock.Mock()
        self._helper_nfs = mock.Mock()
        self.fake_conf = Configuration(None)
        self._db = mock.Mock()
        self._driver = generic.GenericShareDriver(self._db,
                                                  execute=self._execute,
                                                  configuration=self.fake_conf)
        self._driver.service_tenant_id = 'service tenant id'
        self._driver.service_network_id = 'service network id'
        self._driver.compute_api = fake_compute.API()
        self._driver.volume_api = fake_volume.API()
        self._driver.share_networks_locks = {}
        self._driver.get_service_instance = mock.Mock()
        self._driver.share_networks_servers = {}
        self._driver.admin_context = self._context

        self.fake_sn = {"id": "fake_sn_id"}
        self.fake_net_info = {
            "id": "fake_srv_id",
            "share_network_id": "fake_sn_id"
        }
        fsim = fake_service_instance.FakeServiceInstanceManager()
        sim = mock.Mock(return_value=fsim)
        self._driver.instance_manager = sim
        self._driver.service_instance_manager = sim
        self.fake_server = sim._create_service_instance(
            context="fake",
            instance_name="fake",
            share_network_id=self.fake_sn["id"],
            old_server_ip="fake")

        self._driver._ssh_exec = mock.Mock(return_value=('', ''))
        self.stubs.Set(lockutils, 'synchronized',
                       mock.Mock(return_value=lambda f: f))
        self.stubs.Set(generic.os.path, 'exists', mock.Mock(return_value=True))
        self._driver._helpers = {
            'CIFS': self._helper_cifs,
            'NFS': self._helper_nfs,
        }
        self.share = fake_share()
        self.server = {
            'backend_details': {
                'ip': '1.2.3.4',
                'instance_id': 'fake'
            }
        }
        self.access = fake_access()
        self.snapshot = fake_snapshot()
Exemplo n.º 5
0
 def setUp(self):
     super(CIFSHelperTestCase, self).setUp()
     self.server_details = {
         'instance_id': 'fake',
         'ip': '1.2.3.4',
     }
     self.share_name = 'fake_share_name'
     self.fake_conf = Configuration(None)
     self._ssh_exec = mock.Mock(return_value=('', ''))
     self._execute = mock.Mock(return_value=('', ''))
     self._helper = generic.CIFSHelper(self._execute, self._ssh_exec,
                                       self.fake_conf)
Exemplo n.º 6
0
    def __init__(self, share_driver=None, service_name=None, *args, **kwargs):
        """Load the driver from args, or from flags."""
        self.configuration = Configuration(share_manager_opts,
                                           config_group=service_name)
        super(ShareManager, self).__init__(service_name='share',
                                           *args,
                                           **kwargs)

        if not share_driver:
            share_driver = self.configuration.share_driver
        self.driver = importutils.import_object(
            share_driver, self.db, configuration=self.configuration)
        self.network_api = network.API()
Exemplo n.º 7
0
 def test__try_execute(self):
     execute_mixin = driver.ExecuteMixin(configuration=Configuration(None))
     self.assertRaises(exception.ProcessExecutionError,
                       execute_mixin._try_execute)
Exemplo n.º 8
0
import mock
from oslo_config import cfg
import requests
import six

from manila.common import constants as const
from manila import context
from manila import exception
from manila.exception import TegileAPIException
from manila.share.configuration import Configuration
from manila.share.drivers.tegile import tegile
from manila import test

CONF = cfg.CONF

test_config = Configuration(None)
test_config.tegile_nas_server = 'some-ip'
test_config.tegile_nas_login = '******'
test_config.tegile_nas_password = '******'
test_config.reserved_share_percentage = 10
test_config.max_over_subscription_ratio = 30.0

test_share = {
    'host': 'node#fake_pool',
    'name': 'testshare',
    'id': 'a24c2ee8-525a-4406-8ccd-8d38688f8e9e',
    'share_proto': 'NFS',
    'size': 10,
}

test_share_cifs = {
Exemplo n.º 9
0
from oslo_config import cfg
import requests
import six

from manila.common import constants as const
from manila import context
from manila import exception
from manila.exception import TegileAPIException
from manila.share.configuration import Configuration
from manila.share.drivers.tegile import tegile
from manila import test


CONF = cfg.CONF

test_config = Configuration(None)
test_config.tegile_nas_server = 'some-ip'
test_config.tegile_nas_login = '******'
test_config.tegile_nas_password = '******'
test_config.reserved_share_percentage = 10
test_config.max_over_subscription_ratio = 30.0

test_share = {
    'host': 'node#fake_pool',
    'name': 'testshare',
    'id': 'a24c2ee8-525a-4406-8ccd-8d38688f8e9e',
    'share_proto': 'NFS',
    'size': 10,
}

test_share_cifs = {