def update_group(self, context, group, add_volumes=None, remove_volumes=None): opts = huawei_utils.get_group_type_params(group) hypermetro_group = any(opt for opt in opts if opt.get('hypermetro')) if hypermetro_group: hypermetro_mgr = hypermetro.HuaweiHyperMetro( self.local_cli, self.hypermetro_rmt_cli, self.configuration.hypermetro) hypermetro_mgr.update_consistencygroup(group.id, add_volumes, remove_volumes) replication_group = any(opt for opt in opts if opt.get('replication_enabled')) if replication_group: replication_mgr = replication.ReplicationManager( self.local_cli, self.replication_rmt_cli, self.configuration.replication) replication_mgr.update_group(group.id, add_volumes, remove_volumes) model_update = {'status': fields.GroupStatus.AVAILABLE} return model_update, None, None
def delete_group(self, context, group, volumes): opts = huawei_utils.get_group_type_params(group) hypermetro_group = any(opt for opt in opts if opt.get('hypermetro')) if hypermetro_group: hypermetro_mgr = hypermetro.HuaweiHyperMetro( self.local_cli, self.hypermetro_rmt_cli, self.configuration.hypermetro) hypermetro_mgr.delete_consistencygroup(group.id, volumes) replication_group = any(opt for opt in opts if opt.get('replication_enabled')) if replication_group: replication_mgr = replication.ReplicationManager( self.local_cli, self.replication_rmt_cli, self.configuration.replication) replication_mgr.delete_group(group.id, volumes) model_update = {'status': fields.GroupStatus.DELETED} volumes_model_update = [] for volume in volumes: update = {'id': volume.id} try: self.delete_volume(volume) update['status'] = 'deleted' except Exception: update['status'] = 'error_deleting' finally: volumes_model_update.append(update) return model_update, volumes_model_update