def handle(self, request, data): try: message = _('Creating group "%s".') % data['name'] group = cinder.group_create_from_source( request, data['name'], group_snapshot_id=data['vg_snapshot_id'], description=data['description']) messages.info(request, message) return group except Exception: redirect = reverse("horizon:project:vg_snapshots:index") msg = (_('Unable to create group "%s" from snapshot.') % data['name']) exceptions.handle(request, msg, redirect=redirect)
def handle(self, request, data): group_id = self.initial['group_id'] try: message = _('Creating consistency group "%s".') % data['name'] group = cinder.group_create_from_source( request, data['name'], source_group_id=group_id, description=data['description']) messages.info(request, message) return group except Exception: redirect = reverse("horizon:project:volume_groups:index") msg = _('Unable to clone group.') search_opts = {'group_id': group_id} volumes = cinder.volume_list(request, search_opts=search_opts) if len(volumes) == 0: msg = _('Unable to clone empty group.') exceptions.handle(request, msg, redirect=redirect)
def handle(self, request, data): group_id = self.initial['group_id'] try: message = _('Cloning volume group "%s".') % data['name'] group = cinder.group_create_from_source( request, data['name'], source_group_id=group_id, description=data['description']) messages.info(request, message) return group except Exception: redirect = reverse("horizon:project:volume_groups:index") msg = _('Unable to clone group.') search_opts = {'group_id': group_id} volumes = cinder.volume_list(request, search_opts=search_opts) if not volumes: msg = _('Unable to clone empty group.') exceptions.handle(request, msg, redirect=redirect)