]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Improve error message for missing NFS share config
authorEric Harney <eharney@redhat.com>
Mon, 21 Jan 2013 21:50:31 +0000 (16:50 -0500)
committerEric Harney <eharney@redhat.com>
Mon, 21 Jan 2013 22:39:54 +0000 (17:39 -0500)
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

index e47c5714f776dae5ae7740b98d96d482370d96f7..1d757cbfbd2b74a817b688864703b14ae770f3ae 100644 (file)
@@ -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)