From bf6f0d5f368dd79e8e5a8883b9bb0d24d7434cf4 Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Mon, 21 Jan 2013 16:50:31 -0500 Subject: [PATCH] Improve error message for missing NFS share config If FLAGS.nfs_share_config is not defined, the error will reference the name of the config option to set. If the nfs_share_config path doesn't exist, the error will reference the path that was configured. This will hopefully simplify troubleshooting of NFS configuration. Change-Id: Ica6a60a63330554dc880f36962f3a081926ce5cf --- cinder/volume/drivers/nfs.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cinder/volume/drivers/nfs.py b/cinder/volume/drivers/nfs.py index e47c5714f..1d757cbfb 100644 --- a/cinder/volume/drivers/nfs.py +++ b/cinder/volume/drivers/nfs.py @@ -57,9 +57,12 @@ class NfsDriver(driver.VolumeDriver): config = FLAGS.nfs_shares_config if not config: - LOG.warn(_("There's no NFS config file configured ")) - if not config or not os.path.exists(config): - msg = _("NFS config file doesn't exist") + msg = (_("There's no NFS config file configured (%s)") % + 'nfs_shares_config') + LOG.warn(msg) + raise exception.NfsException(msg) + if not os.path.exists(config): + msg = _("NFS config file at %(config)s doesn't exist") % locals() LOG.warn(msg) raise exception.NfsException(msg) -- 2.45.2