Merge "Fix 3PAR driver hiding existing host error"

This commit is contained in:
Jenkins 2013-03-14 22:59:47 +00:00 committed by Gerrit Code Review
commit 019c97c597
3 changed files with 15 additions and 1 deletions

View File

@ -470,6 +470,10 @@ class DuplicateSfVolumeNames(Duplicate):
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")

View File

@ -204,6 +204,11 @@ must be the same" % (cpg['domain'], self.configuration.hp3par_domain)
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

View File

@ -229,7 +229,12 @@ must be the same" % (cpg['domain'], self.configuration.hp3par_domain)
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