Beispiel #1
0
def _set_or_delete_marker_for_migrate_instances(context, marker=None):
    # We need to delete the old marker anyway, which no longer corresponds to
    # the last instance we checked (if there was a marker)...
    # NOTE(sbauza): delete() deletes rows that match the query and if none
    # are found, returns 0 hits.
    context.session.query(
        api_models.RequestSpec).filter_by(instance_uuid=FAKE_UUID).delete()
    if marker is not None:
        # ... but there can be a new marker to set
        db_mapping = api_models.RequestSpec()
        db_mapping.update({'instance_uuid': FAKE_UUID, 'spec': marker})
        db_mapping.save(context.session)
Beispiel #2
0
 def _create_in_db(context, updates):
     db_spec = api_models.RequestSpec()
     db_spec.update(updates)
     db_spec.save(context.session)
     return db_spec