This fixes a problem with the 3par drivers where creating
a 3par host was failing but there was no message. The driver
would fail to find the host after the creation failed and the
log entry would show that the host didn't exist. The real
error was failing to create the host.
bug #
1154700
Change-Id: I2267d958f10cc73c6c5f34d224ea3452a4402f18
message = _("Detected more than one volume with name %(vol_name)s")
+class Duplicate3PARHost(CinderException):
+ message = _("3PAR Host already exists: %(err)s. %(info)s")
+
+
class VolumeTypeCreateFailed(CinderException):
message = _("Cannot create volume_type with "
"name %(name)s and specs %(extra_specs)s")
out = self.common._cli_run('createhost -persona %s -domain %s %s %s'
% (persona_id, domain,
hostname, " ".join(wwn)), None)
+ if out and len(out) > 1:
+ if "already used by host" in out[1]:
+ err = out[1].strip()
+ info = _("The hostname must be called '%s'") % hostname
+ raise exception.Duplicate3PARHost(err=err, info=info)
def _modify_3par_fibrechan_host(self, hostname, wwn):
# when using -add, you can not send the persona or domain options
def _create_3par_iscsi_host(self, hostname, iscsi_iqn, domain, persona_id):
cmd = 'createhost -iscsi -persona %s -domain %s %s %s' % \
(persona_id, domain, hostname, iscsi_iqn)
- self.common._cli_run(cmd, None)
+ out = self.common._cli_run(cmd, None)
+ if out and len(out) > 1:
+ if "already used by host" in out[1]:
+ err = out[1].strip()
+ info = _("The hostname must be called '%s'") % hostname
+ raise exception.Duplicate3PARHost(err=err, info=info)
def _modify_3par_iscsi_host(self, hostname, iscsi_iqn):
# when using -add, you can not send the persona or domain options