def fake_create_client(self):
return FakeHP3ParClient(self.driver.configuration.hp3par_api_url)
+ def fake_get_cpg(self, volume, allowSnap=False):
+ return HP3PAR_CPG
+
def fake_set_connections(self):
return
- def fake_get_cpg(self, volume):
- return HP3PAR_CPG
-
def fake_get_domain(self, cpg):
return HP3PAR_DOMAIN
def _remove_volume_from_volume_set(self, volume_name, vvs_name):
self._cli_run('removevvset -f %s %s' % (vvs_name, volume_name), None)
- def get_cpg(self, volume):
+ def get_cpg(self, volume, allowSnap=False):
volume_name = self._get_3par_vol_name(volume['id'])
vol = self.client.getVolume(volume_name)
- return vol['userCPG']
+ if 'userCPG' in vol:
+ return vol['userCPG']
+ elif allowSnap:
+ return vol['snapCPG']
+ return None
def _get_3par_vol_comment(self, volume_name):
vol = self.client.getVolume(volume_name)
"""Creates or modifies existing 3PAR host."""
host = None
hostname = self.common._safe_hostname(connector['host'])
- cpg = self.common.get_cpg(volume)
+ cpg = self.common.get_cpg(volume, allowSnap=True)
domain = self.common.get_domain(cpg)
try:
host = self.common._get_3par_host(hostname)
# make sure we don't have the host already
host = None
hostname = self.common._safe_hostname(connector['host'])
- cpg = self.common.get_cpg(volume)
+ cpg = self.common.get_cpg(volume, allowSnap=True)
domain = self.common.get_domain(cpg)
try:
host = self.common._get_3par_host(hostname)