diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-02-14 02:11:28 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-02-14 02:11:28 +0000 |
| commit | c657cf1a9f8603e275caa666ed73885d8bfd6755 (patch) | |
| tree | 9b3246296fa4ee5624eb1d5872b1b611f07433a4 /nova/tests | |
| parent | 0b50669946a1eda587290154118fbaf6b455b670 (diff) | |
| parent | 8cf0178165dec3eac002159fd01af6930322bebb (diff) | |
Merge "Add GlusterFS libvirt volume connector"
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/test_libvirt_volume.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/nova/tests/test_libvirt_volume.py b/nova/tests/test_libvirt_volume.py index c0fa53506..0098215b2 100644 --- a/nova/tests/test_libvirt_volume.py +++ b/nova/tests/test_libvirt_volume.py @@ -392,3 +392,31 @@ class LibvirtVolumeTestCase(test.TestCase): self.assertEqual(tree.get('type'), 'block') self.assertEqual(tree.find('./source').get('dev'), aoedevpath) libvirt_driver.disconnect_volume(connection_info, "vde") + + def test_libvirt_glusterfs_driver(self): + mnt_base = '/mnt' + self.flags(glusterfs_mount_point_base=mnt_base) + + libvirt_driver = volume.LibvirtGlusterfsVolumeDriver(self.fake_conn) + export_string = '192.168.1.1:/volume-00001' + name = 'volume-00001' + export_mnt_base = os.path.join(mnt_base, + libvirt_driver.get_hash_str(export_string)) + file_path = os.path.join(export_mnt_base, name) + + connection_info = {'data': {'export': export_string, 'name': name}} + disk_info = { + "bus": "virtio", + "dev": "vde", + "type": "disk", + } + conf = libvirt_driver.connect_volume(connection_info, disk_info) + tree = conf.format_dom() + self.assertEqual(tree.get('type'), 'file') + self.assertEqual(tree.find('./source').get('file'), file_path) + libvirt_driver.disconnect_volume(connection_info, "vde") + + expected_commands = [ + ('stat', export_mnt_base), + ('mount', '-t', 'glusterfs', export_string, export_mnt_base)] + self.assertEqual(self.executes, expected_commands) |
