summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJean-Marc Saffroy <jean.marc.saffroy@scality.com>2013-01-15 00:27:42 +0100
committerVishvananda Ishaya <vishvananda@gmail.com>2013-02-20 11:29:44 -0800
commit2ccbfd8f528f6fff2ad95f2581812cbcd04ad493 (patch)
tree02c0eb38a22d4443c402a042858b780c08b355a7 /nova/tests
parentf478fa696746ba61f3749a9b0559bbbaaf25cfa5 (diff)
Add a volume driver in Nova for Scality SOFS
Scality SOFS is a network filesystem mounted with FUSE, with most options given in a configuration file. Given a mount point and a SOFS configuration file as driver options, the Scality volume driver mounts SOFS, and then creates, accesses and deletes volumes as regular (sparse) files on SOFS. Change-Id: I84bf268e5a2c5c33b8706830e8067914fae44aed Implements: blueprint scality-volume-driver
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_libvirt_volume.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/nova/tests/test_libvirt_volume.py b/nova/tests/test_libvirt_volume.py
index 7945329f8..28d0c8088 100644
--- a/nova/tests/test_libvirt_volume.py
+++ b/nova/tests/test_libvirt_volume.py
@@ -15,6 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+import fixtures
import os
from oslo.config import cfg
@@ -547,3 +548,43 @@ class LibvirtVolumeTestCase(test.TestCase):
"/0000:05:00.3/0000:06:00.6/host2/fc_host/host2"}
pci_num = libvirt_driver._get_pci_num(hba)
self.assertEqual("0000:06:00.6", pci_num)
+
+ 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)
+ TEST_DISK_INFO = {
+ "bus": "virtio",
+ "dev": "vde",
+ "type": "disk",
+ }
+
+ 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)
+ driver = volume.LibvirtScalityVolumeDriver(self.fake_conn)
+ conf = driver.connect_volume(TEST_CONN_INFO, TEST_DISK_INFO)
+
+ tree = conf.format_dom()
+ self.assertEqual(tree.get('type'), 'file')
+ self.assertEqual(tree.find('./source').get('file'), TEST_VOLPATH)