From 0787030220762b59d94a368f6e0bbf20f606cb48 Mon Sep 17 00:00:00 2001 From: Kurt Martin Date: Mon, 19 Aug 2013 11:14:42 -0700 Subject: [PATCH] Removed need for domain in 3PAR drivers The 3PAR drivers need to support CPGs that are not part of a virtual domain on the 3PAR backend. This patch removes the need for the CPG to be part of a domain and changes a few of the commands that took the domain as an option. DocImpact Change-Id: I7e472e19e484e837c9216ea01455a4b8a85b19e5 Fixes: bug #1212328 --- cinder/volume/drivers/san/hp/hp_3par_common.py | 9 +++------ cinder/volume/drivers/san/hp/hp_3par_fc.py | 7 +++++-- cinder/volume/drivers/san/hp/hp_3par_iscsi.py | 8 ++++++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/cinder/volume/drivers/san/hp/hp_3par_common.py b/cinder/volume/drivers/san/hp/hp_3par_common.py index 20235800b..9cce016bc 100644 --- a/cinder/volume/drivers/san/hp/hp_3par_common.py +++ b/cinder/volume/drivers/san/hp/hp_3par_common.py @@ -199,12 +199,9 @@ class HP3PARCommon(object): LOG.error(err) raise exception.InvalidInput(reason=err) - domain = cpg['domain'] - if not domain: - err = (_("CPG (%s) must be in a domain") % cpg_name) - LOG.error(err) - raise exception.InvalidInput(reason=err) - return domain + if 'domain' in cpg: + return cpg['domain'] + return None def extend_volume(self, volume, new_size): volume_name = self._get_3par_vol_name(volume['id']) diff --git a/cinder/volume/drivers/san/hp/hp_3par_fc.py b/cinder/volume/drivers/san/hp/hp_3par_fc.py index 521a88c47..300c96680 100644 --- a/cinder/volume/drivers/san/hp/hp_3par_fc.py +++ b/cinder/volume/drivers/san/hp/hp_3par_fc.py @@ -205,8 +205,11 @@ class HP3PARFCDriver(cinder.volume.driver.FibreChannelDriver): the same wwn but with a different hostname, return the hostname used by 3PAR. """ - command = ['createhost', '-persona', persona_id, '-domain', domain, - hostname] + if domain is not None: + command = ['createhost', '-persona', persona_id, '-domain', domain, + hostname] + else: + command = ['createhost', '-persona', persona_id, hostname] for wwn in wwns: command.append(wwn) diff --git a/cinder/volume/drivers/san/hp/hp_3par_iscsi.py b/cinder/volume/drivers/san/hp/hp_3par_iscsi.py index f542227f0..94670299e 100644 --- a/cinder/volume/drivers/san/hp/hp_3par_iscsi.py +++ b/cinder/volume/drivers/san/hp/hp_3par_iscsi.py @@ -264,8 +264,12 @@ class HP3PARISCSIDriver(cinder.volume.driver.ISCSIDriver): the same iqn but with a different hostname, return the hostname used by 3PAR. """ - cmd = ['createhost', '-iscsi', '-persona', persona_id, '-domain', - domain, hostname, iscsi_iqn] + if domain is not None: + cmd = ['createhost', '-iscsi', '-persona', persona_id, '-domain', + domain, hostname, iscsi_iqn] + else: + cmd = ['createhost', '-iscsi', '-persona', persona_id, hostname, + iscsi_iqn] out = self.common._cli_run(cmd) if out and len(out) > 1: return self.common.parse_create_host_error(hostname, out) -- 2.45.2