From 86ceab311b70bc2f17633d1d282a6a9a8cd70f43 Mon Sep 17 00:00:00 2001 From: Helen Walsh Date: Fri, 9 Dec 2016 10:58:02 +0000 Subject: [PATCH] VMAX driver - shapshot will fail if default storage group is missing Fixed as part of: VMAX driver - Implement volume replication for VMAX Volume replication supports disaster recovery solution where there has been a catastrophic event in your data centre for the VMAX array. Change-Id: I2aafe564cdb31895756b4b8884af2635b054ae59 Implements: blueprint add-vmax-replication (cherry picked from commit 67a2178eb490e35320138bd25da650eddc9cd79a) --- .../drivers/emc/emc_vmax_provision_v3.py | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/cinder/volume/drivers/emc/emc_vmax_provision_v3.py b/cinder/volume/drivers/emc/emc_vmax_provision_v3.py index 4e1cf346a..d3cb1cded 100644 --- a/cinder/volume/drivers/emc/emc_vmax_provision_v3.py +++ b/cinder/volume/drivers/emc/emc_vmax_provision_v3.py @@ -231,6 +231,26 @@ class EMCVMAXProvisionV3(object): return volumeDict + def get_or_create_default_sg(self, conn, extraSpecs, storageSystemName): + """Get or create default storage group for a replica. + + :param conn: the connection to the ecom server + :param extraSpecs: the extra specifications + :param storageSystemName: the storage system name + :returns: sgInstanceName, instance of storage group + """ + pool = extraSpecs[self.utils.POOL] + slo = extraSpecs[self.utils.SLO] + workload = extraSpecs[self.utils.WORKLOAD] + storageGroupName, controllerConfigService, sgInstanceName = ( + self.utils.get_v3_default_sg_instance_name( + conn, pool, slo, workload, storageSystemName)) + if sgInstanceName is None: + sgInstanceName = self.create_storage_group_v3( + conn, controllerConfigService, storageGroupName, + pool, slo, workload, extraSpecs) + return sgInstanceName + def create_element_replica( self, conn, repServiceInstanceName, cloneName, syncType, sourceInstance, extraSpecs, @@ -256,11 +276,9 @@ class EMCVMAXProvisionV3(object): 'syncType': syncType, 'source': sourceInstance.path}) storageSystemName = sourceInstance['SystemName'] - __, __, sgInstanceName = ( - self.utils.get_v3_default_sg_instance_name( - conn, extraSpecs[self.utils.POOL], - extraSpecs[self.utils.SLO], - extraSpecs[self.utils.WORKLOAD], storageSystemName)) + sgInstanceName = ( + self.get_or_create_default_sg( + conn, extraSpecs, storageSystemName)) try: storageGroupInstance = conn.GetInstance(sgInstanceName) except Exception: