]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix HNAS driver confusing error message
authorErlon R. Cruz <erlon.cruz@fit-tecnologia.org.br>
Thu, 11 Dec 2014 10:46:31 +0000 (08:46 -0200)
committerErlon R. Cruz <erlon.cruz@fit-tecnologia.org.br>
Mon, 15 Dec 2014 20:22:36 +0000 (18:22 -0200)
The error message shown when the parser finds a parser error
says, 'file not found' which causes confusion on the user when
he/she needs to debug the real cause o the problem. This patch fix
this by testing first if the file exist and then throwing a
proper error message.

Closes-Bug: #1402775
Change-Id: I91c7a24d5da37735787e8fc0da544c8ba8204884

cinder/volume/drivers/hds/nfs.py

index e48af0b5dd799c1cd8cd2c94f8630c1b582203f9..730efd8ddf98b2d2f399d9746358b7620f9b3ad2 100644 (file)
@@ -82,11 +82,15 @@ def _read_config(xml_config_file):
     :param xml_config_file: string filename containing XML configuration
     """
 
+    if not os.access(xml_config_file, os.R_OK):
+        raise exception.NotFound(message=_LE('Can\'t open config file: ')
+                                 + xml_config_file)
+
     try:
         root = ETree.parse(xml_config_file).getroot()
     except Exception:
-        raise exception.NotFound(message='config file not found: '
-                                 + xml_config_file)
+        raise exception.ConfigNotFound(
+            message=_LE('Error parsing config file: ') + xml_config_file)
 
     # mandatory parameters
     config = {}