def create_metering_label(self, context, metering_label): m = metering_label['metering_label'] with context.session.begin(subtransactions=True): metering_db = metering_models.MeteringLabel( id=uuidutils.generate_uuid(), description=m['description'], tenant_id=m['tenant_id'], name=m['name'], shared=m['shared']) context.session.add(metering_db) return self._make_metering_label_dict(metering_db)
def create_metering_label(self, context, metering_label): m = metering_label['metering_label'] with db_api.context_manager.writer.using(context): metering_db = metering_models.MeteringLabel( id=uuidutils.generate_uuid(), description=m['description'], tenant_id=m['tenant_id'], name=m['name'], shared=m['shared']) context.session.add(metering_db) return self._make_metering_label_dict(metering_db)