From 50be507e6f2ff0bf5098d3f1d57cc405b1c88510 Mon Sep 17 00:00:00 2001 From: Ken'ichi Ohmichi Date: Mon, 17 Oct 2016 12:30:58 -0700 Subject: [PATCH] Add current status to error msg in reserve_volume We are testing negative cases of attach-volume on Nova API. Cinder returns InvalidInput responses in these cases but the responses don't contain current volume status and it is a little hard to debug on Tempest test: I594566704b9794457d224031802d9cbf132e765f This patch adds current volume status on the message. Change-Id: Id7d2abde4c4124c556f46eaa8b95a641a70602b1 --- cinder/volume/api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cinder/volume/api.py b/cinder/volume/api.py index 66f707e0c..bfeb859c9 100644 --- a/cinder/volume/api.py +++ b/cinder/volume/api.py @@ -620,7 +620,9 @@ class API(base.Base): if not result: expected_status = utils.build_or_str(expected['status']) - msg = _('Volume status must be %s to reserve.') % expected_status + msg = _('Volume status must be %(expected)s to reserve, but the ' + 'status is %(current)s.') % {'expected': expected_status, + 'current': volume.status} LOG.error(msg) raise exception.InvalidVolume(reason=msg)