Ejemplo n.º 1
0
    def test_libvirt_scality_driver(self):
        tempdir = self.useFixture(fixtures.TempDir()).path
        TEST_MOUNT = os.path.join(tempdir, 'fake_mount')
        TEST_CONFIG = os.path.join(tempdir, 'fake_config')
        TEST_VOLDIR = 'volumes'
        TEST_VOLNAME = 'volume_name'
        TEST_CONN_INFO = {
            'data': {
                'sofs_path': os.path.join(TEST_VOLDIR, TEST_VOLNAME)
            }
        }
        TEST_VOLPATH = os.path.join(TEST_MOUNT, TEST_VOLDIR, TEST_VOLNAME)
        open(TEST_CONFIG, "w+").close()
        os.makedirs(os.path.join(TEST_MOUNT, 'sys'))

        def _access_wrapper(path, flags):
            if path == '/sbin/mount.sofs':
                return True
            else:
                return os.access(path, flags)

        self.stubs.Set(os, 'access', _access_wrapper)
        self.flags(scality_sofs_config=TEST_CONFIG,
                   scality_sofs_mount_point=TEST_MOUNT,
                   group='libvirt')
        driver = scality.LibvirtScalityVolumeDriver(self.fake_conn)
        driver.connect_volume(TEST_CONN_INFO, self.disk_info)

        device_path = os.path.join(TEST_MOUNT,
                                   TEST_CONN_INFO['data']['sofs_path'])
        self.assertEqual(device_path, TEST_CONN_INFO['data']['device_path'])

        conf = driver.get_config(TEST_CONN_INFO, self.disk_info)
        tree = conf.format_dom()
        self._assertFileTypeEquals(tree, TEST_VOLPATH)
Ejemplo n.º 2
0
    def setUp(self):
        super(LibvirtScalityVolumeDriverTestCase, self).setUp()

        self.scality_sofs_config = 'fake.conf'
        self.scality_sofs_mount_point = '/fake'
        self.flags(scality_sofs_config=self.scality_sofs_config,
                   scality_sofs_mount_point=self.scality_sofs_mount_point,
                   group='libvirt')

        self.drv = scality.LibvirtScalityVolumeDriver(self.fake_conn)