From: Erlon R. Cruz Date: Thu, 11 Dec 2014 10:46:31 +0000 (-0200) Subject: Fix HNAS driver confusing error message X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=6cc497b468ec909d5261c464826b704007fca2ee;p=openstack-build%2Fcinder-build.git Fix HNAS driver confusing error message 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 --- diff --git a/cinder/volume/drivers/hds/nfs.py b/cinder/volume/drivers/hds/nfs.py index e48af0b5d..730efd8dd 100644 --- a/cinder/volume/drivers/hds/nfs.py +++ b/cinder/volume/drivers/hds/nfs.py @@ -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 = {}