From 6cc497b468ec909d5261c464826b704007fca2ee Mon Sep 17 00:00:00 2001 From: "Erlon R. Cruz" Date: Thu, 11 Dec 2014 08:46:31 -0200 Subject: [PATCH] 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 --- cinder/volume/drivers/hds/nfs.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 = {} -- 2.45.2