Re: [openstack-dev] [Nova] Detect changes in object model
Hi Dan, are you going to cook a patch to expand the base class? Or we can do that ourselves? Yeah, I'll try to get to that today. --Dan ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [Nova] Detect changes in object model
Hi Dan, I was actually thinking of changes to the list itself rather than the objects in the list. To try and be clear, I actually mean the following: ObjectListBase has a field called objects that is typed fields.ListOfObjectsField('NovaObject'). I can see methods for count and index, and I guess you are talking about adding a method for are any of your contents changed here. I don't see other list operations (like append, insert, remove, pop) that modify the list. If these were included they would have to mark the list as changed so it is picked up when looking for changes. Do you see these belonging here or would you expect those to go in a sub-class if they were wanted? Paul. -Original Message- From: Dan Smith [mailto:d...@danplanet.com] Sent: 10 January 2014 16:22 To: Murray, Paul (HP Cloud Services); Wang, Shane; OpenStack Development Mailing List (not for usage questions) Cc: Lee, Alexis; Tan, Lin Subject: Re: [Nova] Detect changes in object model Sounds good to me. The list base objects don't have methods to make changes to the list - so it would be a case of iterating looking at each object in the list. That would be ok. Hmm? You mean for NovaObjects that are lists? I hesitate to expose lists as changed when one of the objects inside has changed because I think that sends the wrong message. However, I think it makes sense to have a different method on lists for are any of your contents changed? I'll cook up a patch to implement what I'm talking about so you can take a look. --Dan ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [Nova] Detect changes in object model
ObjectListBase has a field called objects that is typed fields.ListOfObjectsField('NovaObject'). I can see methods for count and index, and I guess you are talking about adding a method for are any of your contents changed here. I don't see other list operations (like append, insert, remove, pop) that modify the list. If these were included they would have to mark the list as changed so it is picked up when looking for changes. Do you see these belonging here or would you expect those to go in a sub-class if they were wanted? Well, I've been trying to avoid implying the notion that a list of things represents the content of the database. Meaning, I don't think it makes sense for someone to get a list of Foo objects, add another Foo to the list and then call save() on the list. I think that ends up with the assumption that the list matches the contents of the database, and if I add or remove things from the list, I can save() the contents to the database atomically. That definitely isn't something we can or would want to support. That said, if we make the parent object consider the child to be dirty if any of its contents are dirty or the list itself is dirty (i.e. the list of objects has changed) that should give us the desired behavior for change tracking, right? --Dan ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [Nova] Detect changes in object model
Yes, I agree. Actually, I am trying to infer what the programming model for this is as we go along. Personally I would have been happy with only marking the fields when they are set. Then, if a you want to change a list somehow you would get it and then set it again, e.g.: mylist = object.alist do something to mylist object.alist = mylist object.save() Having said that, it can be convenient to use the data structures in place. In which case we need all these means to track the changes and they should go in the base classes so they are used consistently. So in short, I am happy with your dirty children :) Paul. -Original Message- From: Dan Smith [mailto:d...@danplanet.com] Sent: 13 January 2014 15:26 To: Murray, Paul (HP Cloud Services); Wang, Shane; OpenStack Development Mailing List (not for usage questions) Cc: Lee, Alexis; Tan, Lin Subject: Re: [Nova] Detect changes in object model ObjectListBase has a field called objects that is typed fields.ListOfObjectsField('NovaObject'). I can see methods for count and index, and I guess you are talking about adding a method for are any of your contents changed here. I don't see other list operations (like append, insert, remove, pop) that modify the list. If these were included they would have to mark the list as changed so it is picked up when looking for changes. Do you see these belonging here or would you expect those to go in a sub-class if they were wanted? Well, I've been trying to avoid implying the notion that a list of things represents the content of the database. Meaning, I don't think it makes sense for someone to get a list of Foo objects, add another Foo to the list and then call save() on the list. I think that ends up with the assumption that the list matches the contents of the database, and if I add or remove things from the list, I can save() the contents to the database atomically. That definitely isn't something we can or would want to support. That said, if we make the parent object consider the child to be dirty if any of its contents are dirty or the list itself is dirty (i.e. the list of objects has changed) that should give us the desired behavior for change tracking, right? --Dan ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [Nova] Detect changes in object model
Hi Dan, are you going to cook a patch to expand the base class? Or we can do that ourselves? For the list, I also agree your dirty assumption. -- Shane -Original Message- From: Dan Smith [mailto:d...@danplanet.com] Sent: Friday, January 10, 2014 10:42 PM To: Wang, Shane; OpenStack Development Mailing List (not for usage questions) Cc: pmur...@hp.com; alex...@hp.com; Tan, Lin Subject: Re: [Nova] Detect changes in object model If an object A contains another object or object list (called sub-object), any change happened in the sub-object can't be detected by obj_what_changed() in object A. Well, like the Instance object does, you can override obj_what_changed() to expose that fact to the caller. However, I think it might be good to expand the base class to check, for any NovaObject fields, for the obj_what_changed() of the child. How does that sound? --Dan ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [Nova] Detect changes in object model
If an object A contains another object or object list (called sub-object), any change happened in the sub-object can't be detected by obj_what_changed() in object A. Well, like the Instance object does, you can override obj_what_changed() to expose that fact to the caller. However, I think it might be good to expand the base class to check, for any NovaObject fields, for the obj_what_changed() of the child. How does that sound? --Dan ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [Nova] Detect changes in object model
Sounds good to me. The list base objects don't have methods to make changes to the list - so it would be a case of iterating looking at each object in the list. That would be ok. Do we need the contents of the lists to be modified without assigning a new list? - that would need a little more work to allow the changes and to track them there too. Paul. -Original Message- From: Dan Smith [mailto:d...@danplanet.com] Sent: 10 January 2014 14:42 To: Wang, Shane; OpenStack Development Mailing List (not for usage questions) Cc: Murray, Paul (HP Cloud Services); Lee, Alexis; Tan, Lin Subject: Re: [Nova] Detect changes in object model If an object A contains another object or object list (called sub-object), any change happened in the sub-object can't be detected by obj_what_changed() in object A. Well, like the Instance object does, you can override obj_what_changed() to expose that fact to the caller. However, I think it might be good to expand the base class to check, for any NovaObject fields, for the obj_what_changed() of the child. How does that sound? --Dan ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [Nova] Detect changes in object model
Sounds good to me. The list base objects don't have methods to make changes to the list - so it would be a case of iterating looking at each object in the list. That would be ok. Hmm? You mean for NovaObjects that are lists? I hesitate to expose lists as changed when one of the objects inside has changed because I think that sends the wrong message. However, I think it makes sense to have a different method on lists for are any of your contents changed? I'll cook up a patch to implement what I'm talking about so you can take a look. --Dan ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev