From 3a20db0a739bc15e1beeb41910a6977381fd12f6 Mon Sep 17 00:00:00 2001 From: "Walter A. Boring IV" Date: Fri, 22 Mar 2013 14:31:15 -0700 Subject: [PATCH] Fix bug with 3PAR host entry in wrong domain This patch exposes a more acurate exception message when a user has created a manual host entry on a 3PAR system that is in an incorrect 3PAR domain than the domain that is configured for the 3PAR driver. The bug complained that it couldn't find a VLUN, when the actual problem was the host existed in the wrong 3PAR domain. Fixes bug #1158991 Change-Id: I3f92e59ae43a10a0788d97d987785b6520f9f1be --- cinder/exception.py | 4 ++++ cinder/volume/drivers/san/hp/hp_3par_common.py | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cinder/exception.py b/cinder/exception.py index ccbaad114a6..bec31fb1b3e 100644 --- a/cinder/exception.py +++ b/cinder/exception.py @@ -474,6 +474,10 @@ class Duplicate3PARHost(CinderException): message = _("3PAR Host already exists: %(err)s. %(info)s") +class Invalid3PARDomain(CinderException): + message = _("Invalid 3PAR Domain: %(err)s") + + class VolumeTypeCreateFailed(CinderException): message = _("Cannot create volume_type with " "name %(name)s and specs %(extra_specs)s") diff --git a/cinder/volume/drivers/san/hp/hp_3par_common.py b/cinder/volume/drivers/san/hp/hp_3par_common.py index cd1d9ee770d..ea37b89f54b 100644 --- a/cinder/volume/drivers/san/hp/hp_3par_common.py +++ b/cinder/volume/drivers/san/hp/hp_3par_common.py @@ -272,7 +272,12 @@ def _delete_3par_host(self, hostname): self._cli_run('removehost %s' % hostname, None) def _create_3par_vlun(self, volume, hostname): - self._cli_run('createvlun %s auto %s' % (volume, hostname), None) + out = self._cli_run('createvlun %s auto %s' % (volume, hostname), None) + if out and len(out) > 1: + if "must be in the same domain" in out[0]: + err = out[0].strip() + err = err + " " + out[1].strip() + raise exception.Invalid3PARDomain(err=err) def _safe_hostname(self, hostname): """