with session.begin():
service_ref = _service_get(context, service_id, session=session)
service_ref.update(values)
- service_ref.save(session=session)
###################
with session.begin():
quota_ref = _quota_get(context, project_id, resource, session=session)
quota_ref.hard_limit = limit
- quota_ref.save(session=session)
@require_admin_context
quota_class_ref = _quota_class_get(context, class_name, resource,
session=session)
quota_class_ref.hard_limit = limit
- quota_class_ref.save(session=session)
@require_admin_context
if delta > 0:
usages[resource].reserved += delta
- # Apply updates to the usages table
- for usage_ref in usages.values():
- usage_ref.save(session=session)
-
if unders:
LOG.warning(_("Change will make usage less than 0 for the following "
"resources: %s") % unders)
reservation.delete(session=session)
- for usage in usages.values():
- usage.save(session=session)
-
@require_context
def reservation_rollback(context, reservations, project_id=None):
reservation.delete(session=session)
- for usage in usages.values():
- usage.save(session=session)
-
@require_admin_context
def quota_destroy_all_by_project(context, project_id):
volume_ref['attach_status'] = 'attached'
volume_ref['instance_uuid'] = instance_uuid
volume_ref['attached_host'] = host_name
- volume_ref.save(session=session)
return volume_ref
session = get_session()
with session.begin():
- volume_ref.save(session=session)
+ session.add(volume_ref)
- return _volume_get(context, values['id'], session=session)
+ return _volume_get(context, values['id'], session=session)
@require_admin_context
volume_ref['instance_uuid'] = None
volume_ref['attached_host'] = None
volume_ref['attach_time'] = None
- volume_ref.save(session=session)
@require_context
volume_ref = _volume_get(context, volume_id, session=session)
volume_ref.update(values)
- volume_ref.save(session=session)
+
return volume_ref
def snapshot_create(context, values):
values['snapshot_metadata'] = _metadata_refs(values.get('metadata'),
models.SnapshotMetadata)
- snapshot_ref = models.Snapshot()
if not values.get('id'):
values['id'] = str(uuid.uuid4())
- snapshot_ref.update(values)
session = get_session()
with session.begin():
- snapshot_ref.save(session=session)
+ snapshot_ref = models.Snapshot()
+ snapshot_ref.update(values)
+ session.add(snapshot_ref)
return _snapshot_get(context, values['id'], session=session)
with session.begin():
snapshot_ref = _snapshot_get(context, snapshot_id, session=session)
snapshot_ref.update(values)
- snapshot_ref.save(session=session)
####################
models.VolumeTypeExtraSpecs)
volume_type_ref = models.VolumeTypes()
volume_type_ref.update(values)
- volume_type_ref.save(session=session)
+ session.add(volume_type_ref)
except Exception as e:
raise db_exc.DBError(e)
return volume_type_ref
values['volume_type_id'] = volume_type_id
encryption.update(values)
- encryption.save(session=session)
+ session.add(encryption)
return encryption
volume_type_id)
encryption.update(values)
- encryption.save(session=session)
return encryption
vol_glance_metadata.key = key
vol_glance_metadata.value = str(value)
- vol_glance_metadata.save(session=session)
+ session.add(vol_glance_metadata)
return
_("No backup with id %s") % backup_id)
backup.update(values)
- backup.save(session=session)
+
return backup
@require_context
def transfer_create(context, values):
- transfer = models.Transfer()
if not values.get('id'):
values['id'] = str(uuid.uuid4())
session = get_session()
LOG.error(msg)
raise exception.InvalidVolume(reason=msg)
volume_ref['status'] = 'awaiting-transfer'
+ transfer = models.Transfer()
transfer.update(values)
- transfer.save(session=session)
+ session.add(transfer)
volume_ref.update(volume_ref)
- volume_ref.save(session=session)
+
return transfer
volume_ref['project_id'] = project_id
volume_ref['updated_at'] = literal_column('updated_at')
volume_ref.update(volume_ref)
- volume_ref.save(session=session)
+
session.query(models.Transfer).\
filter_by(id=transfer_ref['id']).\
update({'deleted': True,