[openstack-dev] [nova] Consistency, efficiency, and safety of NovaObject.save()

Matthew Booth mbooth at redhat.com
Thu Nov 13 10:12:04 UTC 2014


On 12/11/14 23:23, Mike Bayer wrote:
> 
>> On Nov 12, 2014, at 10:56 AM, Matthew Booth <mbooth at redhat.com> wrote:
>>
>> For brevity, I have conflated what happens in object.save() with what
>> happens in db.api. Where the code lives isn't relevant here: I'm only
>> looking at what happens.
>>
>> Specifically, the following objects refresh themselves on save:
>>
>> Aggregate
>> BlockDeviceMapping
>> ComputeNode
> 
>> Excluding irrelevant complexity, the general model for objects which
>> refresh on update is:
>>
>> object = <select row from object table>
>> object.update()
>> object.save()
>> return <select row from object table again>
>>
>> Some objects skip out the second select and return the freshly saved
>> object. That is, a save involves an update + either 1 or 2 selects.
> 
> If I may inquire as to the irrelevant complexity, I’m trying to pinpoint where you see this happening.

The irrelevant complexity is mostly munging values before they are
inserted into the db. While this needs to be there, I don't think it's
important to the post.

Matt

-- 
Matthew Booth
Red Hat Engineering, Virtualisation Team

Phone: +442070094448 (UK)
GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490



More information about the OpenStack-dev mailing list