Merge "Implement extend_volume for libvirt NFS volume driver"

This commit is contained in:
Zuul 2020-07-27 15:32:58 +00:00 committed by Gerrit Code Review
commit 7d2cfc9014
2 changed files with 20 additions and 0 deletions

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)

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