Browse Source

Merge "Implement extend_volume for libvirt NFS volume driver"

changes/12/741712/7
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
7d2cfc9014
2 changed files with 20 additions and 0 deletions
  1. +14
    -0
      nova/tests/unit/virt/libvirt/volume/test_nfs.py
  2. +6
    -0
      nova/virt/libvirt/volume/nfs.py

+ 14
- 0
nova/tests/unit/virt/libvirt/volume/test_nfs.py View File

@@ -99,3 +99,17 @@ class LibvirtNFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
['-o', 'intr,nfsvers=3'])])
self.mock_umount.assert_has_calls([mock.call(export_mnt_base)])
self.mock_rmdir.assert_has_calls([mock.call(export_mnt_base)])

def test_extend_volume(self):
libvirt_driver = nfs.LibvirtNFSVolumeDriver(self.fake_host)
export_string = '192.168.1.1:/nfs/share1'
connection_info = {'data': {'export': export_string,
'name': self.name}}
instance = mock.sentinel.instance
requested_size = 10

new_size = libvirt_driver.extend_volume(connection_info,
instance,
requested_size)

self.assertEqual(requested_size, new_size)

+ 6
- 0
nova/virt/libvirt/volume/nfs.py View File

@@ -47,3 +47,9 @@ class LibvirtNFSVolumeDriver(fs.LibvirtMountedFileSystemVolumeDriver):
options.extend(conn_options.split(' '))

return options

def extend_volume(self, connection_info, instance, requested_size):
# There is nothing to do for NFS volumes. libvirt will extend the file
# on the NFS share, and resize the disk device within the instance by
# calling virDomainBlockResize.
return requested_size

Loading…
Cancel
Save