summaryrefslogtreecommitdiffstats
path: root/nova/objects
Commit message (Collapse)AuthorAgeFilesLines
* Add update() method to NovaObject for dict compatibilityDan Smith2013-06-261-0/+8
| | | | | | | | | In order for objects to behave like dicts, they need to support the update() method. This patch adds that. Related to blueprint unified-object-model Change-Id: Icb3932682285cbf8e7362e5b748e42a754b17fe7
* Add obj_to_primitive() to recursively primitiveize objectsDan Smith2013-06-261-0/+17
| | | | | | | | | | Occasionally we need to recursively process a NovaObject into a representative dict or list. This patch adds a function to do that recursively, accounting for nested objects and lists of objects. Related to blueprint unified-object-model Change-Id: I6adb84f9e5a0564ec4af14200e26e838b4a5bb6e
* Make info_cache handle when network_info is NoneDan Smith2013-06-261-1/+2
| | | | | | | | | The info_cache['network_info'] data can be None, so don't string- convert it to 'None'. Related to blueprint unified-object-model Change-Id: I7a18f9189ab31beca0f8df764531387b4dd41b50
* Fix instance object's use of a db query method parameterDan Smith2013-06-261-1/+3
| | | | | | | | | The limit and marker arguments are kwargs, which need to be correct to pass some mock tests in the unit tests for api. Related to unified-object-model Change-Id: I16b45ff73a6d79313fdd4a1124309f558497ab72
* Make NovaObject support the 'in' operatorDan Smith2013-06-261-0/+7
| | | | | | | | This is needed for dict emulation. Related to unified-object-model Change-Id: I6e024dc284a353181d3ffc84329f234e16b79118
* Add Instance.faultDan Smith2013-06-261-3/+31
| | | | | | | | | | | | This makes Instance load fault as an optional attribute, if requested. I didn't implement save for this, as I'm not sure we will (want to) support setting instance faults via that interface. Related to unified-object-model Fixes bug 1192004 Change-Id: I581e1f49c4c593ece97cf32dc7cea3f7a7cbd953
* Add basic InstanceFault modelDan Smith2013-06-261-0/+61
| | | | | | | | This adds a basic InstanceFault model, list, and tests. Related to blueprint unified-objet-model Change-Id: I9226bc1f6e21d298b6d5d8694d336d38e471846d
* Make InstanceList filter non-column extra attributesDan Smith2013-06-241-3/+12
| | | | | | | | | | This is a no-op right now, but we need to avoid passing things like fault to the instance_get_all() queries. This will be used in changes to follow. Related to blueprint unified-object-model Change-Id: I66355a024b139fa6c579e04885ba52f9697381fe
* Add Instance.security_groupsDan Smith2013-06-241-4/+27
| | | | | | | | | | | | | This makes Instance load the security_groups list when it is present in the database object. It also refactors the way info_cache is saved, so that it can more easily apply to security_groups as well. Related to blueprint unified-object-model Fixes bug 1192003 Change-Id: Ifb028e17ffef7c14557e6389a650d66ce8e9b25c
* Add basic SecurityGroup modelDan Smith2013-06-242-0/+96
| | | | | | | | This adds a basic SecurityGroup model and query methods. Related to blueprint unified-object-model Change-Id: I92a18529add3e46e801a30e35cdbd4932c890a55
* Fix serialization of iterable typesDan Smith2013-06-221-2/+24
| | | | | | | | | | | | | So far, we have not supported serialization of iterable type arguments to RPC methods. However, the recent change to pass args as a tuple instead of forcing everything to kwargs means that serialization of non-keyword args is broken. This patch adds that support, as well as tests for the serializer, which should have been there in the first place. Related to blueprint unified-object-model Change-Id: Ie02fffd89d9b79b4bc8270c14b2860c0e37d7a92
* Fix orphaned instance from get_by_uuid() and _from_db_object()Dan Smith2013-06-222-7/+10
| | | | | | | | | | | | | | We need to set _context on the Instance object we create during get_by_uuid(), but more specifically during _from_db_object(). In order to properly initialize things like nested objects that themselves need a _context, we should pass it to _from_db_object() always. Same thing for InstanceInfoCache. Related to blueprint unified-object-model Change-Id: I09ab6b5d7d8961b69294536885e8432943b3a611
* Fix importing InstanceInfoCache during register_all()Dan Smith2013-06-201-0/+1
| | | | | | Related to blueprint unified-object-model Change-Id: Ib5edd0d0af46d9ba9d0fcaa14c9601ad75b8d50d
* Remove straggling use of all-kwarg object methodsDan Smith2013-06-191-1/+1
| | | | | | | | | | This removes one remaining vestige of the days of yore when nova developers were forced to always use kwargs on object methods out of fear, lest it be used over RPC. Related to blueprint unified-object-model Change-Id: Ieba76efc2f5daed08e4bde9096c0e178f1f44466
* Merge "Fill context on objects in lists"Jenkins2013-06-191-4/+8
|\
| * Fill context on objects in listsDan Smith2013-06-181-4/+8
| | | | | | | | | | | | | | | | | | This fixes object lists to not contain orphaned objects after making an RPC trip. Fixes bug 1191113 Change-Id: Ia90321da2f480835e1c7213a52eb5731840dbd6a
* | Merge "Remove unused arg from make_class_properties.getter method"Jenkins2013-06-181-1/+1
|\ \ | |/ |/|
| * Remove unused arg from make_class_properties.getter methodMatt Riedemann2013-06-131-1/+1
| | | | | | | | | | | | | | This patch simply cleans up an unused argument (typefn) from the nova.objects.base#make_class_properties.getter method. Change-Id: I6a1bd927bb799d00cc6f0b250609e90e3838fa29
* | Merge "Make NovaObject support extra attributes in items()"Jenkins2013-06-172-2/+6
|\ \
| * | Make NovaObject support extra attributes in items()Dan Smith2013-06-172-2/+6
| |/ | | | | | | | | | | | | | | | | An object could define a field as a property, which needs to get included in items() and iteritems() for dict compatibility. Related to blueprint unified-object-model Change-Id: I2ca665e70fc6d3c9664ae7a74dffd99a56f6a8c1
* / Fix instance obj refresh()Chris Behrens2013-06-172-1/+2
|/ | | | | | | | | | | | | The refresh() method pulls a fresh copy of the instance but if any fields changed when doing so, they are left marked as changes that are not yet committed. Also clarified the doc string for obj_what_changed() to state that a set is returned, not a list. This method is not used yet, so I didn't file a bug for this. Change-Id: I83fbce07936fea2bc936441c5c6594f65da443a7
* Fix obj_load() in NovaObject base classDan Smith2013-06-132-2/+2
| | | | | | | | | | | The obj_load_attr() method is correctly used in the field getter, but incorrectly provided in the base class (without the _attr suffix). Rename that and add a test for the base class that makes sure this method gets poked appropriately. Related to blueprint unified-object-model Change-Id: I3b010ef727fed2f59fbb3d7173078b1dbc4b81f6
* Merge "Fix and enable H403 tests"Jenkins2013-06-131-1/+2
|\
| * Fix and enable H403 testsDirk Mueller2013-06-121-1/+2
| | | | | | | | | | | | Multi-line doc-strings should end on a new, separate line. Change-Id: I4cf0cfe92b634ef77971863a4df41ef43531bc20
* | Add Instance.info_cacheDan Smith2013-06-073-15/+109
|/ | | | | | | | | This adds our first nested object: the InstanceInfoCache at Instance.info_cache. Related to blueprint unified-object-model Change-Id: I2dd8727bbe38eadd080e9ea1ef9feabc2fa50520
* Use Instance Objects for Start/StopDan Smith2013-06-071-0/+7
| | | | | | | | | | | | | | This patch makes the start and stop operations use the Instance object instead of passing SQLA-derived dicts over RPC. Until something more sophisticated is needed (and developed), it also adds a nova.object.register_all() function which just triggers imports of all the object models so that they are registered. When adding a new object type, that register function should be updated appropriately. Related to bp/unified-object-model Change-Id: I3c8d9cba07d34097a279502062906de802d19d1f
* Add lists of instance objectsDan Smith2013-06-071-0/+54
| | | | | | | | | | | This adds a list-of-instances object, which can house the "get all" methods for instances. It's very simple, emulates a list, but provides us an object-oriented way to get multiple instances that mirrors the model. Related to blueprint unified-object-model Change-Id: Id6579030b88b92d4cb7db13ee6718ad01db7bf63
* Add base mixin class for object listsDan Smith2013-06-071-0/+52
| | | | | | | | | | This provides a base class that provides the bulk of the common functionality that objects implementing a list of objects will need. Related to blueprint unified-object-model Change-Id: I5bc4e64cc8fe2d780251cbc43f2ee45f4e0f820a
* Add deleted flag to NovaObject baseDan Smith2013-06-072-1/+5
| | | | | | | | | This is present in NovaBase for the SQLAlchemy objects, and is expected to be in the NovaObjects as well. Related to blueprint unified-object-model Change-Id: I1698d5a986d17899dfcefb9ec65d6b2623af2da3
* Make the datetime utility function coerce to UTCDan Smith2013-06-051-2/+11
| | | | | | | | | | Getting datetime objects from existing sources (i.e. sqlalchemy) is problematic because they're "timezone naive". Make the utility function coerce these to UTC for easier conversion. Related to blueprint unified-object-model Change-Id: I61bc6b13f9bd9441d64cc6930e43e921af72a342
* Make object actions pass positional argumentsDan Smith2013-06-041-9/+18
| | | | | | | | | | | | | | This changes the Object API to also pass positional arguments to remotable methods. Previously, we required only keyword arguments to these methods in order to mirror our current RPC behavior. This is not really necessary and could be confusing. Since there are no actual users of these APIs in the tree right now, we can make this change without needing to bump any versions. Related to blueprint unified-object-model Change-Id: Ifb12843d16500d383d4e9c607121d5584400f247
* Make instance object tolerate isotime stringsDan Smith2013-06-033-6/+14
| | | | | | | | | | | | | | | | | Any time we get a db object over RPC, the datetime has been serialized to an isotime string. We have other legacy code that needs to tolerate this, and those hacks would need to be replicated in the objects transition. Instead, make the instance object type function tolerate isotime-formatted strings so that we can more easily convert RPC-transited database objects until we're fully converted, at which time we could remove the tolerance. Luckily, the objects still end up with a datetime internally, which means the rest of the code can stop needing to handle strings and datetimes gracefully. Related to blueprint unified-object-model Change-Id: I132559d3541d19353de6acc36a2740185e564105
* Add instance objectDan Smith2013-05-291-0/+238
| | | | | | | | This adds the instance object and tests. Related to bp/unified-internal-objects Change-Id: If8cf9aa20950b0f543228ca3dd86527c830790c7
* Add base object modelDan Smith2013-05-293-0/+452
This adds the base infrastructure for a unified object model in Nova. It provides a somewhat-magical metaclass which serves to automatically register objects that are capable of being remoted. Magic remoting of methods happens via two decorators, allowing a given nova service to globally declare that such actions should happen over RPC to avoid DB accesses. For more details, see blueprint unified-object-model Change-Id: Iecd54ca22666f730c41d2278f74b86d922624a4e