diff options
author | Rafi Khardalian <rafi@metacloud.com> | 2013-02-02 01:34:53 +0000 |
---|---|---|
committer | Rafi Khardalian <rafi@metacloud.com> | 2013-02-03 16:48:20 +0000 |
commit | bffa08e758e52c6bad4faae128daa0214637631f (patch) | |
tree | 8d290a65e5f461d71d566b032db9728a41a43b8c | |
parent | ee955d272ab4eef2e8371f2e460454058ce7e46c (diff) | |
download | nova-bffa08e758e52c6bad4faae128daa0214637631f.tar.gz nova-bffa08e758e52c6bad4faae128daa0214637631f.tar.xz nova-bffa08e758e52c6bad4faae128daa0214637631f.zip |
Allow for specifying nfs mount options
Fixes bug 1113042
Adds a new config option:
nfs_mount_options=None (Default)
When not None, anything set here will be passed as -o <options> to
the mount command. The default behavior is to do exactly as we are
doing today and relying on the OS/kernel defaults.
Change-Id: I935ae6f4d96c20904b7132fe8c6dfd3cbe089e51
Flags: DocImpact
-rwxr-xr-x | nova/virt/libvirt/volume_nfs.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/nova/virt/libvirt/volume_nfs.py b/nova/virt/libvirt/volume_nfs.py index 7f721a534..fc10863b5 100755 --- a/nova/virt/libvirt/volume_nfs.py +++ b/nova/virt/libvirt/volume_nfs.py @@ -33,6 +33,10 @@ volume_opts = [ cfg.StrOpt('nfs_mount_point_base', default=paths.state_path_def('mnt'), help='Base dir where nfs expected to be mounted on compute'), + cfg.StrOpt('nfs_mount_options', + default=None, + help='Mount options passed to the nfs client. See section ' + 'of the nfs man page for details'), ] CONF = cfg.CONF CONF.register_opts(volume_opts) @@ -70,9 +74,14 @@ class NfsVolumeDriver(volume.LibvirtBaseVolumeDriver): if not self._path_exists(mount_path): utils.execute('mkdir', '-p', mount_path) + # Construct the NFS mount command. + nfs_cmd = ['mount', '-t', 'nfs'] + if CONF.nfs_mount_options is not None: + nfs_cmd.extend(['-o', CONF.nfs_mount_options]) + nfs_cmd.extend([nfs_share, mount_path]) + try: - utils.execute('mount', '-t', 'nfs', nfs_share, mount_path, - run_as_root=True) + utils.execute(*nfs_cmd, run_as_root=True) except exception.ProcessExecutionError as exc: if ensure and 'already mounted' in exc.message: LOG.warn(_("%s is already mounted"), nfs_share) |