diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-05-29 21:12:29 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-05-29 21:12:29 +0000 |
| commit | 84f2a0438e34258c82f6e99cc2d5bb757bbde7da (patch) | |
| tree | 5f2d9629d5398d111109844b2e497e17476d06eb /nova/tests | |
| parent | 5a1e8e15d7f79bbdbe135315bf5be3b7ce6563af (diff) | |
| parent | a6306bd05ca523e98cb7a834c2e312e602452763 (diff) | |
Merge "Support Cinder mount options for NFS/GlusterFS"
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/virt/libvirt/test_libvirt_volume.py | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/nova/tests/virt/libvirt/test_libvirt_volume.py b/nova/tests/virt/libvirt/test_libvirt_volume.py index 59e7d7fea..c96bc8dda 100644 --- a/nova/tests/virt/libvirt/test_libvirt_volume.py +++ b/nova/tests/virt/libvirt/test_libvirt_volume.py @@ -448,6 +448,39 @@ class LibvirtVolumeTestCase(test.TestCase): ('mount', '-t', 'nfs', export_string, export_mnt_base)] self.assertEqual(self.executes, expected_commands) + def test_libvirt_nfs_driver_with_opts(self): + mnt_base = '/mnt' + self.flags(nfs_mount_point_base=mnt_base) + + libvirt_driver = volume.LibvirtNFSVolumeDriver(self.fake_conn) + export_string = '192.168.1.1:/nfs/share1' + name = 'volume-00001' + options = '-o intr,nfsvers=3' + 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, + 'options': options}} + 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 = [ + ('mkdir', '-p', export_mnt_base), + ('mount', '-t', 'nfs', '-o', 'intr,nfsvers=3', + export_string, export_mnt_base) + ] + self.assertEqual(self.executes, expected_commands) + def aoe_connection(self, shelf, lun): return { 'driver_volume_type': 'aoe', @@ -504,6 +537,40 @@ class LibvirtVolumeTestCase(test.TestCase): ('mount', '-t', 'glusterfs', export_string, export_mnt_base)] self.assertEqual(self.executes, expected_commands) + def test_libvirt_glusterfs_driver_with_opts(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' + options = '-o backupvolfile-server=192.168.1.2' + 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, + 'options': options}} + 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 = [ + ('mkdir', '-p', export_mnt_base), + ('mount', '-t', 'glusterfs', + '-o', 'backupvolfile-server=192.168.1.2', + export_string, export_mnt_base)] + self.assertEqual(self.executes, expected_commands) + def fibrechan_connection(self, volume, location, wwn): return { 'driver_volume_type': 'fibrechan', |
