diff --git a/nova/objects/agent.py b/nova/objects/agent.py index 6240fa369bff..260737288edb 100644 --- a/nova/objects/agent.py +++ b/nova/objects/agent.py @@ -51,7 +51,7 @@ class Agent(base.NovaPersistentObject, base.NovaObject, return cls._from_db_object(context, objects.Agent(), db_agent) @base.remotable - def create(self, context): + def create(self): updates = self.obj_get_changes() if 'id' in updates: raise exception.ObjectActionError(action='create', @@ -60,11 +60,11 @@ class Agent(base.NovaPersistentObject, base.NovaObject, self._from_db_object(self._context, self, db_agent) @base.remotable - def destroy(self, context): + def destroy(self): db.agent_build_destroy(self._context, self.id) @base.remotable - def save(self, context): + def save(self): updates = self.obj_get_changes() db.agent_build_update(self._context, self.id, updates) self.obj_reset_changes() diff --git a/nova/objects/aggregate.py b/nova/objects/aggregate.py index 5914abffce8c..d636dc602871 100644 --- a/nova/objects/aggregate.py +++ b/nova/objects/aggregate.py @@ -60,7 +60,7 @@ class Aggregate(base.NovaPersistentObject, base.NovaObject, return cls._from_db_object(context, cls(), db_aggregate) @base.remotable - def create(self, context): + def create(self): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') @@ -83,7 +83,7 @@ class Aggregate(base.NovaPersistentObject, base.NovaObject, payload) @base.remotable - def save(self, context): + def save(self): self._assert_no_hosts('save') updates = self.obj_get_changes() @@ -101,7 +101,7 @@ class Aggregate(base.NovaPersistentObject, base.NovaObject, self._from_db_object(self._context, self, db_aggregate) @base.remotable - def update_metadata(self, context, updates): + def update_metadata(self, updates): payload = {'aggregate_id': self.id, 'meta_data': updates} compute_utils.notify_about_aggregate_update(self._context, @@ -128,11 +128,11 @@ class Aggregate(base.NovaPersistentObject, base.NovaObject, self.obj_reset_changes(fields=['metadata']) @base.remotable - def destroy(self, context): + def destroy(self): db.aggregate_delete(self._context, self.id) @base.remotable - def add_host(self, context, host): + def add_host(self, host): db.aggregate_host_add(self._context, self.id, host) if self.hosts is None: self.hosts = [] @@ -140,7 +140,7 @@ class Aggregate(base.NovaPersistentObject, base.NovaObject, self.obj_reset_changes(fields=['hosts']) @base.remotable - def delete_host(self, context, host): + def delete_host(self, host): db.aggregate_host_delete(self._context, self.id, host) self.hosts.remove(host) self.obj_reset_changes(fields=['hosts']) diff --git a/nova/objects/bandwidth_usage.py b/nova/objects/bandwidth_usage.py index d340b0c3e767..dc463e18376c 100644 --- a/nova/objects/bandwidth_usage.py +++ b/nova/objects/bandwidth_usage.py @@ -54,7 +54,7 @@ class BandwidthUsage(base.NovaPersistentObject, base.NovaObject, @base.serialize_args @base.remotable - def create(self, context, uuid, mac, bw_in, bw_out, last_ctr_in, + def create(self, uuid, mac, bw_in, bw_out, last_ctr_in, last_ctr_out, start_period=None, last_refreshed=None, update_cells=True): db_bw_usage = db.bw_usage_update( diff --git a/nova/objects/base.py b/nova/objects/base.py index 7ed86369e850..049ff9362df6 100644 --- a/nova/objects/base.py +++ b/nova/objects/base.py @@ -204,7 +204,7 @@ def remotable(fn): self._changed_fields = set(updates.get('obj_what_changed', [])) return result else: - return fn(self, None, *args, **kwargs) + return fn(self, *args, **kwargs) wrapper.remotable = True wrapper.original_fn = fn diff --git a/nova/objects/block_device.py b/nova/objects/block_device.py index 6e89aeb8a0c7..2ad677c2ba91 100644 --- a/nova/objects/block_device.py +++ b/nova/objects/block_device.py @@ -140,15 +140,15 @@ class BlockDeviceMapping(base.NovaPersistentObject, base.NovaObject, context, self, create=cells_create) @base.remotable - def create(self, context): + def create(self): self._create(self._context) @base.remotable - def update_or_create(self, context): + def update_or_create(self): self._create(self._context, update_or_create=True) @base.remotable - def destroy(self, context): + def destroy(self): if not self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='destroy', reason='already destroyed') @@ -163,7 +163,7 @@ class BlockDeviceMapping(base.NovaPersistentObject, base.NovaObject, volume_id=self.volume_id) @base.remotable - def save(self, context): + def save(self): updates = self.obj_get_changes() if 'instance' in updates: raise exception.ObjectActionError(action='save', diff --git a/nova/objects/compute_node.py b/nova/objects/compute_node.py index 6a1d49a8e945..3fa7cdbb03fc 100644 --- a/nova/objects/compute_node.py +++ b/nova/objects/compute_node.py @@ -231,7 +231,7 @@ class ComputeNode(base.NovaPersistentObject, base.NovaObject, updates['pci_stats'] = jsonutils.dumps(pools.obj_to_primitive()) @base.remotable - def create(self, context): + def create(self): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') @@ -245,7 +245,7 @@ class ComputeNode(base.NovaPersistentObject, base.NovaObject, self._from_db_object(self._context, self, db_compute) @base.remotable - def save(self, context, prune_stats=False): + def save(self, prune_stats=False): # NOTE(belliott) ignore prune_stats param, no longer relevant updates = self.obj_get_changes() @@ -259,7 +259,7 @@ class ComputeNode(base.NovaPersistentObject, base.NovaObject, self._from_db_object(self._context, self, db_compute) @base.remotable - def destroy(self, context): + def destroy(self): db.compute_node_delete(self._context, self.id) @property diff --git a/nova/objects/ec2.py b/nova/objects/ec2.py index 653ce51b58b7..1029ab386287 100644 --- a/nova/objects/ec2.py +++ b/nova/objects/ec2.py @@ -38,7 +38,7 @@ class EC2InstanceMapping(base.NovaPersistentObject, base.NovaObject, return imap @base.remotable - def create(self, context): + def create(self): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') @@ -78,7 +78,7 @@ class EC2VolumeMapping(base.NovaPersistentObject, base.NovaObject, return vmap @base.remotable - def create(self, context): + def create(self): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') @@ -118,7 +118,7 @@ class EC2SnapshotMapping(base.NovaPersistentObject, base.NovaObject, return smap @base.remotable - def create(self, context): + def create(self): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') @@ -158,7 +158,7 @@ class S3ImageMapping(base.NovaPersistentObject, base.NovaObject, return s3imap @base.remotable - def create(self, context): + def create(self): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') diff --git a/nova/objects/fixed_ip.py b/nova/objects/fixed_ip.py index e84214030f86..110940511d33 100644 --- a/nova/objects/fixed_ip.py +++ b/nova/objects/fixed_ip.py @@ -175,7 +175,7 @@ class FixedIP(obj_base.NovaPersistentObject, obj_base.NovaObject, timeutils.isotime(time)) @obj_base.remotable - def create(self, context): + def create(self): updates = self.obj_get_changes() if 'id' in updates: raise exception.ObjectActionError(action='create', @@ -186,7 +186,7 @@ class FixedIP(obj_base.NovaPersistentObject, obj_base.NovaObject, self._from_db_object(self._context, self, db_fixedip) @obj_base.remotable - def save(self, context): + def save(self): updates = self.obj_get_changes() if 'address' in updates: raise exception.ObjectActionError(action='save', @@ -195,7 +195,7 @@ class FixedIP(obj_base.NovaPersistentObject, obj_base.NovaObject, self.obj_reset_changes() @obj_base.remotable - def disassociate(self, context): + def disassociate(self): db.fixed_ip_disassociate(self._context, str(self.address)) self.instance_uuid = None self.instance = None diff --git a/nova/objects/flavor.py b/nova/objects/flavor.py index 615a7aa23554..b14efdf4ea0c 100644 --- a/nova/objects/flavor.py +++ b/nova/objects/flavor.py @@ -75,7 +75,7 @@ class Flavor(base.NovaPersistentObject, base.NovaObject, return flavor @base.remotable - def _load_projects(self, context): + def _load_projects(self): self.projects = [x['project_id'] for x in db.flavor_access_get_by_flavor_id(self._context, self.flavorid)] @@ -146,7 +146,7 @@ class Flavor(base.NovaPersistentObject, base.NovaObject, expected_attrs=['extra_specs']) @base.remotable - def add_access(self, context, project_id): + def add_access(self, project_id): if 'projects' in self.obj_what_changed(): raise exception.ObjectActionError(action='add_access', reason='projects modified') @@ -154,7 +154,7 @@ class Flavor(base.NovaPersistentObject, base.NovaObject, self._load_projects() @base.remotable - def remove_access(self, context, project_id): + def remove_access(self, project_id): if 'projects' in self.obj_what_changed(): raise exception.ObjectActionError(action='remove_access', reason='projects modified') @@ -162,7 +162,7 @@ class Flavor(base.NovaPersistentObject, base.NovaObject, self._load_projects() @base.remotable - def create(self, context): + def create(self): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') @@ -177,7 +177,7 @@ class Flavor(base.NovaPersistentObject, base.NovaObject, expected_attrs=expected_attrs) @base.remotable - def save_projects(self, context, to_add=None, to_delete=None): + def save_projects(self, to_add=None, to_delete=None): """Add or delete projects. :param:to_add: A list of projects to add @@ -194,7 +194,7 @@ class Flavor(base.NovaPersistentObject, base.NovaObject, self.obj_reset_changes(['projects']) @base.remotable - def save_extra_specs(self, context, to_add=None, to_delete=None): + def save_extra_specs(self, to_add=None, to_delete=None): """Add or delete extra_specs. :param:to_add: A dict of new keys to add/update @@ -246,7 +246,7 @@ class Flavor(base.NovaPersistentObject, base.NovaObject, self.save_projects(added_projects, deleted_projects) @base.remotable - def destroy(self, context): + def destroy(self): db.flavor_destroy(self._context, self.name) diff --git a/nova/objects/floating_ip.py b/nova/objects/floating_ip.py index 49ed1455b082..e3149b168e22 100644 --- a/nova/objects/floating_ip.py +++ b/nova/objects/floating_ip.py @@ -144,7 +144,7 @@ class FloatingIP(obj_base.NovaPersistentObject, obj_base.NovaObject, return cls._get_addresses_by_instance_uuid(context, instance['uuid']) @obj_base.remotable - def save(self, context): + def save(self): updates = self.obj_get_changes() if 'address' in updates: raise exception.ObjectActionError(action='save', diff --git a/nova/objects/instance.py b/nova/objects/instance.py index e38c1e79b6b3..2db00bd4e41b 100644 --- a/nova/objects/instance.py +++ b/nova/objects/instance.py @@ -570,7 +570,7 @@ class Instance(base.NovaPersistentObject, base.NovaObject, expected_attrs) @base.remotable - def create(self, context): + def create(self): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') @@ -618,7 +618,7 @@ class Instance(base.NovaPersistentObject, base.NovaObject, self._from_db_object(self._context, self, db_inst, expected_attrs) @base.remotable - def destroy(self, context): + def destroy(self): if not self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='destroy', reason='already destroyed') @@ -737,7 +737,7 @@ class Instance(base.NovaPersistentObject, base.NovaObject, setattr(self, attr, None) @base.remotable - def save(self, context, expected_vm_state=None, + def save(self, expected_vm_state=None, expected_task_state=None, admin_state_reset=False): """Save updates to this instance @@ -856,7 +856,7 @@ class Instance(base.NovaPersistentObject, base.NovaObject, self.obj_reset_changes() @base.remotable - def refresh(self, context, use_slave=False): + def refresh(self, use_slave=False): extra = [field for field in INSTANCE_OPTIONAL_ATTRS if self.obj_attr_is_set(field)] current = self.__class__.get_by_uuid(self._context, uuid=self.uuid, @@ -1030,7 +1030,7 @@ class Instance(base.NovaPersistentObject, base.NovaObject, self.save() @base.remotable - def delete_metadata_key(self, context, key): + def delete_metadata_key(self, key): """Optimized metadata delete method. This provides a more efficient way to delete a single metadata diff --git a/nova/objects/instance_action.py b/nova/objects/instance_action.py index 86606a7c3622..1a0b05cfd5d1 100644 --- a/nova/objects/instance_action.py +++ b/nova/objects/instance_action.py @@ -87,7 +87,7 @@ class InstanceAction(base.NovaPersistentObject, base.NovaObject, return cls._from_db_object(context, cls(), db_action) @base.remotable - def finish(self, context): + def finish(self): values = self.pack_action_finish(self._context, self.instance_uuid) db_action = db.action_finish(self._context, values) self._from_db_object(self._context, self, db_action) @@ -191,7 +191,7 @@ class InstanceActionEvent(base.NovaPersistentObject, base.NovaObject, want_result=want_result) @base.remotable - def finish_with_failure(self, context, exc_val, exc_tb): + def finish_with_failure(self, exc_val, exc_tb): values = self.pack_action_event_finish(self._context, self.instance_uuid, self.event, exc_val=exc_val, @@ -200,7 +200,7 @@ class InstanceActionEvent(base.NovaPersistentObject, base.NovaObject, self._from_db_object(self._context, self, db_event) @base.remotable - def finish(self, context): + def finish(self): self.finish_with_failure(self._context, exc_val=None, exc_tb=None) diff --git a/nova/objects/instance_fault.py b/nova/objects/instance_fault.py index ac2f313eca79..e900a600c0be 100644 --- a/nova/objects/instance_fault.py +++ b/nova/objects/instance_fault.py @@ -64,7 +64,7 @@ class InstanceFault(base.NovaPersistentObject, base.NovaObject, db_faults[instance_uuid][0]) @base.remotable - def create(self, context): + def create(self): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') diff --git a/nova/objects/instance_group.py b/nova/objects/instance_group.py index 1bb1f1ca7418..ff57dfc30379 100644 --- a/nova/objects/instance_group.py +++ b/nova/objects/instance_group.py @@ -107,7 +107,7 @@ class InstanceGroup(base.NovaPersistentObject, base.NovaObject, return cls.get_by_name(context, hint) @base.remotable - def save(self, context): + def save(self): """Save updates to this instance group.""" updates = self.obj_get_changes() @@ -124,7 +124,7 @@ class InstanceGroup(base.NovaPersistentObject, base.NovaObject, "update", payload) @base.remotable - def refresh(self, context): + def refresh(self): """Refreshes the instance group.""" current = self.__class__.get_by_uuid(self._context, self.uuid) for field in self.fields: @@ -133,7 +133,7 @@ class InstanceGroup(base.NovaPersistentObject, base.NovaObject, self.obj_reset_changes() @base.remotable - def create(self, context): + def create(self): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') @@ -152,7 +152,7 @@ class InstanceGroup(base.NovaPersistentObject, base.NovaObject, "create", payload) @base.remotable - def destroy(self, context): + def destroy(self): payload = {'server_group_id': self.uuid} db.instance_group_delete(self._context, self.uuid) self.obj_reset_changes() @@ -170,7 +170,7 @@ class InstanceGroup(base.NovaPersistentObject, base.NovaObject, return list(members) @base.remotable - def get_hosts(self, context, exclude=None): + def get_hosts(self, exclude=None): """Get a list of hosts for non-deleted instances in the group This method allows you to get a list of the hosts where instances in @@ -188,7 +188,7 @@ class InstanceGroup(base.NovaPersistentObject, base.NovaObject, if instance.host])) @base.remotable - def count_members_by_user(self, context, user_id): + def count_members_by_user(self, user_id): """Count the number of instances in a group belonging to a user.""" filter_uuids = self.members filters = {'uuid': filter_uuids, 'user_id': user_id, 'deleted': False} diff --git a/nova/objects/instance_info_cache.py b/nova/objects/instance_info_cache.py index aad8f488efa2..f91620b463a0 100644 --- a/nova/objects/instance_info_cache.py +++ b/nova/objects/instance_info_cache.py @@ -86,7 +86,7 @@ class InstanceInfoCache(base.NovaPersistentObject, base.NovaObject, "cache update")) @base.remotable - def save(self, context, update_cells=True): + def save(self, update_cells=True): if 'network_info' in self.obj_what_changed(): nw_info_json = self.fields['network_info'].to_primitive( self, 'network_info', self.network_info) @@ -98,11 +98,11 @@ class InstanceInfoCache(base.NovaPersistentObject, base.NovaObject, self.obj_reset_changes() @base.remotable - def delete(self, context): + def delete(self): db.instance_info_cache_delete(self._context, self.instance_uuid) @base.remotable - def refresh(self, context): + def refresh(self): current = self.__class__.get_by_instance_uuid(self._context, self.instance_uuid) current._context = None diff --git a/nova/objects/instance_numa_topology.py b/nova/objects/instance_numa_topology.py index f7a1c0b6eac5..dad4c0eec991 100644 --- a/nova/objects/instance_numa_topology.py +++ b/nova/objects/instance_numa_topology.py @@ -154,7 +154,7 @@ class InstanceNUMATopology(base.NovaObject, # TODO(ndipanov) Remove this method on the major version bump to 2.0 @base.remotable - def create(self, context): + def create(self): self._save() # NOTE(ndipanov): We can't rename create and want to avoid version bump diff --git a/nova/objects/instance_pci_requests.py b/nova/objects/instance_pci_requests.py index 4a3e5084c001..8e74e0a19522 100644 --- a/nova/objects/instance_pci_requests.py +++ b/nova/objects/instance_pci_requests.py @@ -147,7 +147,7 @@ class InstancePCIRequests(base.NovaObject, return jsonutils.dumps(blob) @base.remotable - def save(self, context): + def save(self): blob = self.to_json() db.instance_extra_update_by_uuid(self._context, self.instance_uuid, {'pci_requests': blob}) diff --git a/nova/objects/keypair.py b/nova/objects/keypair.py index 073e899e6bb5..8ac0f0532405 100644 --- a/nova/objects/keypair.py +++ b/nova/objects/keypair.py @@ -64,7 +64,7 @@ class KeyPair(base.NovaPersistentObject, base.NovaObject, db.key_pair_destroy(context, user_id, name) @base.remotable - def create(self, context): + def create(self): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') @@ -73,7 +73,7 @@ class KeyPair(base.NovaPersistentObject, base.NovaObject, self._from_db_object(self._context, self, db_keypair) @base.remotable - def destroy(self, context): + def destroy(self): db.key_pair_destroy(self._context, self.user_id, self.name) diff --git a/nova/objects/migration.py b/nova/objects/migration.py index b11f7a81be59..ddd9b993a582 100644 --- a/nova/objects/migration.py +++ b/nova/objects/migration.py @@ -59,7 +59,7 @@ class Migration(base.NovaPersistentObject, base.NovaObject, return cls._from_db_object(context, cls(), db_migration) @base.remotable - def create(self, context): + def create(self): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') @@ -68,7 +68,7 @@ class Migration(base.NovaPersistentObject, base.NovaObject, self._from_db_object(self._context, self, db_migration) @base.remotable - def save(self, context): + def save(self): updates = self.obj_get_changes() updates.pop('id', None) db_migration = db.migration_update(self._context, self.id, updates) diff --git a/nova/objects/network.py b/nova/objects/network.py index 0b366ba7d9c8..c8e997fe5bad 100644 --- a/nova/objects/network.py +++ b/nova/objects/network.py @@ -169,7 +169,7 @@ class Network(obj_base.NovaPersistentObject, obj_base.NovaObject, return changes @obj_base.remotable - def create(self, context): + def create(self): updates = self._get_primitive_changes() if 'id' in updates: raise exception.ObjectActionError(action='create', @@ -178,13 +178,13 @@ class Network(obj_base.NovaPersistentObject, obj_base.NovaObject, self._from_db_object(self._context, self, db_network) @obj_base.remotable - def destroy(self, context): + def destroy(self): db.network_delete_safe(self._context, self.id) self.deleted = True self.obj_reset_changes(['deleted']) @obj_base.remotable - def save(self, context): + def save(self): context = self._context updates = self._get_primitive_changes() if 'netmask_v6' in updates: diff --git a/nova/objects/pci_device.py b/nova/objects/pci_device.py index 32064accd13e..96ff27b602f2 100644 --- a/nova/objects/pci_device.py +++ b/nova/objects/pci_device.py @@ -163,7 +163,7 @@ class PciDevice(base.NovaPersistentObject, base.NovaObject, return pci_device @base.remotable - def save(self, context): + def save(self): if self.status == 'removed': self.status = 'deleted' db.pci_device_destroy(self._context, self.compute_node_id, diff --git a/nova/objects/quotas.py b/nova/objects/quotas.py index ca4eeb2ce62c..a1aef29766f0 100644 --- a/nova/objects/quotas.py +++ b/nova/objects/quotas.py @@ -85,7 +85,7 @@ class Quotas(base.NovaObject, return quotas @base.remotable - def reserve(self, context, expire=None, project_id=None, user_id=None, + def reserve(self, expire=None, project_id=None, user_id=None, **deltas): reservations = quota.QUOTAS.reserve(self._context, expire=expire, project_id=project_id, @@ -97,7 +97,7 @@ class Quotas(base.NovaObject, self.obj_reset_changes() @base.remotable - def commit(self, context=None): + def commit(self): if not self.reservations: return quota.QUOTAS.commit(self._context, self.reservations, @@ -107,7 +107,7 @@ class Quotas(base.NovaObject, self.obj_reset_changes() @base.remotable - def rollback(self, context=None): + def rollback(self): """Rollback quotas.""" if not self.reservations: return diff --git a/nova/objects/security_group.py b/nova/objects/security_group.py index bd0014742e9e..0b56527556e6 100644 --- a/nova/objects/security_group.py +++ b/nova/objects/security_group.py @@ -55,11 +55,11 @@ class SecurityGroup(base.NovaPersistentObject, base.NovaObject, return cls._from_db_object(context, cls(), db_secgroup) @base.remotable - def in_use(self, context): + def in_use(self): return db.security_group_in_use(self._context, self.id) @base.remotable - def save(self, context): + def save(self): updates = self.obj_get_changes() if updates: db_secgroup = db.security_group_update(self._context, self.id, @@ -68,7 +68,7 @@ class SecurityGroup(base.NovaPersistentObject, base.NovaObject, self.obj_reset_changes() @base.remotable - def refresh(self, context): + def refresh(self): self._from_db_object(self._context, self, db.security_group_get(self._context, self.id)) diff --git a/nova/objects/security_group_rule.py b/nova/objects/security_group_rule.py index eb7c62c42bf1..da75e03738f5 100644 --- a/nova/objects/security_group_rule.py +++ b/nova/objects/security_group_rule.py @@ -64,7 +64,7 @@ class SecurityGroupRule(base.NovaPersistentObject, base.NovaObject, return rule @base.remotable - def create(self, context): + def create(self): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') diff --git a/nova/objects/service.py b/nova/objects/service.py index dd79ad6fa307..36eee38aef5c 100644 --- a/nova/objects/service.py +++ b/nova/objects/service.py @@ -157,7 +157,7 @@ class Service(base.NovaPersistentObject, base.NovaObject, return cls._from_db_object(context, cls(), db_service) @base.remotable - def create(self, context): + def create(self): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') @@ -166,14 +166,14 @@ class Service(base.NovaPersistentObject, base.NovaObject, self._from_db_object(self._context, self, db_service) @base.remotable - def save(self, context): + def save(self): updates = self.obj_get_changes() updates.pop('id', None) db_service = db.service_update(self._context, self.id, updates) self._from_db_object(self._context, self, db_service) @base.remotable - def destroy(self, context): + def destroy(self): db.service_destroy(self._context, self.id) diff --git a/nova/objects/tag.py b/nova/objects/tag.py index 7f79de772662..87a81cb85263 100644 --- a/nova/objects/tag.py +++ b/nova/objects/tag.py @@ -34,7 +34,7 @@ class Tag(base.NovaObject): return tag @base.remotable - def create(self, context): + def create(self): db_tag = db.instance_tag_add(self._context, self.resource_id, self.tag) self._from_db_object(self._context, self, db_tag) diff --git a/nova/objects/virtual_interface.py b/nova/objects/virtual_interface.py index 6c4832574bf3..be44cfcd8306 100644 --- a/nova/objects/virtual_interface.py +++ b/nova/objects/virtual_interface.py @@ -67,7 +67,7 @@ class VirtualInterface(base.NovaPersistentObject, base.NovaObject, return cls._from_db_object(context, cls(), db_vif) @base.remotable - def create(self, context): + def create(self): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') diff --git a/nova/tests/unit/objects/test_objects.py b/nova/tests/unit/objects/test_objects.py index 1c515521ac9a..fb70852e92a6 100644 --- a/nova/tests/unit/objects/test_objects.py +++ b/nova/tests/unit/objects/test_objects.py @@ -80,25 +80,25 @@ class MyObj(base.NovaPersistentObject, base.NovaObject, return obj @base.remotable - def marco(self, context): + def marco(self): return 'polo' @base.remotable - def _update_test(self, context): + def _update_test(self): self.bar = 'updated' @base.remotable - def save(self, context): + def save(self): self.obj_reset_changes() @base.remotable - def refresh(self, context): + def refresh(self): self.foo = 321 self.bar = 'refreshed' self.obj_reset_changes() @base.remotable - def modify_save_modify(self, context): + def modify_save_modify(self): self.bar = 'meow' self.save() self.foo = 42 @@ -1175,79 +1175,79 @@ class TestObjectSerializer(_BaseTestCase): # they come with a corresponding version bump in the affected # objects object_data = { - 'Agent': '1.0-c4ff8a833aee8ae44ab8aed1a171273d', + 'Agent': '1.0-cf1b002f0e50f5333e0f33588f6c2d57', 'AgentList': '1.0-31f07426a729311a42ff7f6246e76e25', - 'Aggregate': '1.1-f5d477be06150529a9b2d27cc49030b5', + 'Aggregate': '1.1-7b3f04af5342ba544955d01c9c954fa5', 'AggregateList': '1.2-4b02a285b8612bfb86a96ff80052fb0a', - 'BandwidthUsage': '1.2-a9d7c2ba54995e48ce38688c51c9416d', + 'BandwidthUsage': '1.2-e7d3b3a5c3950cc67c99bc26a1075a70', 'BandwidthUsageList': '1.2-5b564cbfd5ae6e106443c086938e7602', - 'BlockDeviceMapping': '1.8-c53f09c7f969e0222d9f6d67a950a08e', + 'BlockDeviceMapping': '1.8-c87e9c7e5cfd6a402f32727aa74aca95', 'BlockDeviceMappingList': '1.9-0faaeebdca213010c791bc37a22546e3', - 'ComputeNode': '1.10-70202a38b858977837b313d94475a26b', + 'ComputeNode': '1.10-5f8cd6948ad98fcc0c39b79d49acc4b6', 'ComputeNodeList': '1.10-4ae1f844c247029fbcdb5fdccbe9e619', 'DNSDomain': '1.0-5bdc288d7c3b723ce86ede998fd5c9ba', 'DNSDomainList': '1.0-cfb3e7e82be661501c31099523154db4', - 'EC2InstanceMapping': '1.0-627baaf4b12c9067200979bdc4558a99', - 'EC2SnapshotMapping': '1.0-26cf315be1f8abab4289d4147671c836', - 'EC2VolumeMapping': '1.0-2f8c3bf077c65a425294ec2b361c9143', - 'FixedIP': '1.9-2472964d39e50da67202109eb85cd173', + 'EC2InstanceMapping': '1.0-e9c3257badcc3aa14089b0a62f163108', + 'EC2SnapshotMapping': '1.0-a545acd0d1519d4316b9b00f30e59b4d', + 'EC2VolumeMapping': '1.0-15710aa212b5cbfdb155fdc81cce4ede', + 'FixedIP': '1.9-4e8060f91f6c94ae73d557708ec62f56', 'FixedIPList': '1.9-68ade91cf8d97053c1ef401d87eb6ecd', - 'Flavor': '1.1-096cfd023c35d07542cf732fb29b45e4', + 'Flavor': '1.1-01ed47361fbe76bf728edf667d3f45d3', 'FlavorList': '1.1-a3d5551267cb8f62ff38ded125900721', - 'FloatingIP': '1.6-27eb68b7c9c620dd5f0561b5a3be0e82', + 'FloatingIP': '1.6-24c614d2c3d4887254a679be65c11de5', 'FloatingIPList': '1.7-f376f63ed99243f9d90841b7f6732bbf', 'HVSpec': '1.0-c4d8377cc4fe519930e60c1d8265a142', - 'Instance': '1.19-e5b80cc3b734b418d5c4b9140a4d2a25', - 'InstanceAction': '1.1-6b1d0a6dbd522b5a83c20757ec659663', - 'InstanceActionEvent': '1.1-42dbdba74bd06e0619ca75cd3397cd1b', + 'Instance': '1.19-3e1d995b0fc1d109568bf6cf95abb0eb', + 'InstanceAction': '1.1-866fb0235d45ab51cc299b8726303d9c', + 'InstanceActionEvent': '1.1-538698f30974064543134784c5da6056', 'InstanceActionEventList': '1.0-1d5cc958171d6ce07383c2ad6208318e', 'InstanceActionList': '1.0-368410fdb8d69ae20c495308535d6266', 'InstanceExternalEvent': '1.0-f1134523654407a875fd59b80f759ee7', - 'InstanceFault': '1.2-313438e37e9d358f3566c85f6ddb2d3e', + 'InstanceFault': '1.2-090c74b3833c715845ec2cf24a686aaf', 'InstanceFaultList': '1.1-aeb598ffd0cd6aa61fca7adf0f5e900d', - 'InstanceGroup': '1.9-95ece99f092e8f4f88327cdbb44162c9', + 'InstanceGroup': '1.9-a77a59735d62790dcaa413a21acfaa73', 'InstanceGroupList': '1.6-c6b78f3c9d9080d33c08667e80589817', - 'InstanceInfoCache': '1.5-ef64b604498bfa505a8c93747a9d8b2f', + 'InstanceInfoCache': '1.5-ef7394dae46cff2dd560324555cb85cf', 'InstanceList': '1.16-8594a8f95e717e57ee57b4aba59c688e', 'InstanceNUMACell': '1.2-5d2dfa36e9ecca9b63f24bf3bc958ea4', - 'InstanceNUMATopology': '1.1-86b95d263c4c68411d44c6741b8d2bb0', + 'InstanceNUMATopology': '1.1-b6fab68a3f0f1dfab4c98a236d29839a', 'InstancePCIRequest': '1.1-e082d174f4643e5756ba098c47c1510f', - 'InstancePCIRequests': '1.1-bc7c6684d8579ee49d6a3b8aef756918', - 'KeyPair': '1.2-adf0be7b68e0b9f1ec011e23a9761354', + 'InstancePCIRequests': '1.1-4825b599f000538991fdc9972a92c2c6', + 'KeyPair': '1.2-b476e480f85d307711c89d0aa78b3a3f', 'KeyPairList': '1.1-152dc1efcc46014cc10656a0d0ac5bb0', - 'Migration': '1.1-67c47726c2c71422058cd9d149d6d3ed', + 'Migration': '1.1-dc2db9e6e625bd3444a5a114438b298d', 'MigrationList': '1.1-8c5f678edc72a592d591a13b35e54353', - 'MyObj': '1.6-d657ff98bce311e7925cb28f1423a8c2', + 'MyObj': '1.6-fce707f79d6fee00f0ebbac98816a380', 'MyOwnedObject': '1.0-0f3d6c028543d7f3715d121db5b8e298', - 'Network': '1.2-2ea21ede5e45bb80e7b7ac7106915c4e', - 'NetworkList': '1.2-aa4ad23f035b97a41732ea8b3445fc5e', - 'NetworkRequest': '1.1-f31192f5a725017707f989585e12d7dc', - 'NetworkRequestList': '1.1-beeab521ac9450f1f5ef4eaa945a783c', 'NUMACell': '1.2-cb9c3b08cc1c418d021492f788d04173', 'NUMAPagesTopology': '1.0-97d93f70a68625b5f29ff63a40a4f612', 'NUMATopology': '1.2-790f6bdff85bf6e5677f409f3a4f1c6a', 'NUMATopologyLimits': '1.0-201845851897940c0a300e3d14ebf04a', - 'PciDevice': '1.3-e059641df10e85d464672c5183a9473b', + 'Network': '1.2-141c797b794a4f8dbe251f929dc15268', + 'NetworkList': '1.2-aa4ad23f035b97a41732ea8b3445fc5e', + 'NetworkRequest': '1.1-f31192f5a725017707f989585e12d7dc', + 'NetworkRequestList': '1.1-beeab521ac9450f1f5ef4eaa945a783c', + 'PciDevice': '1.3-6d37f795ee934e7db75b5a6a1926def0', 'PciDeviceList': '1.1-38cbe2d3c23b9e46f7a74b486abcad85', 'PciDevicePool': '1.0-d6ed1abe611c9947345a44155abe6f11', 'PciDevicePoolList': '1.0-d31e08e0ff620a4df7cc2014b6c50da8', - 'Quotas': '1.2-36098cf2143e6535873c3fa3d6fe56f7', + 'Quotas': '1.2-615ed622082c92d938119fd49e6d84ee', 'QuotasNoOp': '1.2-164c628906b170fd946a7672e85e4935', - 'S3ImageMapping': '1.0-9225943a44a91ad0349b9fd8bd3f3ce2', - 'SecurityGroup': '1.1-bba0e72865e0953793e796571692453b', + 'S3ImageMapping': '1.0-56d23342db8131d826797c7229dc4050', + 'SecurityGroup': '1.1-cd2f3c063640723b584634fa1075be77', 'SecurityGroupList': '1.0-528e6448adfeeb78921ebeda499ab72f', - 'SecurityGroupRule': '1.1-a9175baf7664439af1a16c2010b55576', + 'SecurityGroupRule': '1.1-38290b6f9a35e416c2bcab5f18708967', 'SecurityGroupRuleList': '1.1-667fca3a9928f23d2d10e61962c55f3c', - 'Service': '1.11-2b157261ffa37b3d2675b39b6c29ce07', + 'Service': '1.11-1a34a387914f90aacc33c8c43d45d0b3', 'ServiceList': '1.9-54656820acc49b3cc0eb57b2a684b84a', - 'Tag': '1.0-a11531f4e4e3166eef6243d6d58a18bd', + 'Tag': '1.0-521693d0515aa031dff2b8ae3f86c8e0', 'TagList': '1.0-e89bf8c8055f1f1d654fb44f0abf1f53', - 'TestSubclassedObject': '1.6-4bf996f4a200eba7dcb649cd790babca', - 'VirtualInterface': '1.0-10fdac4c704102b6d57d6936d6d790d2', - 'VirtualInterfaceList': '1.0-accbf02628a8063c1d885077a2bf49b6', + 'TestSubclassedObject': '1.6-d0f7f126f87433003c4d2ced202d6c86', 'VirtCPUFeature': '1.0-3cac8c77d84a632ba79da01a4b87afb9', 'VirtCPUModel': '1.0-ae051080026849eddf7179e353673756', 'VirtCPUTopology': '1.0-fc694de72e20298f7c6bab1083fd4563', + 'VirtualInterface': '1.0-d3d14066c99b8ae4d5204059fb147279', + 'VirtualInterfaceList': '1.0-accbf02628a8063c1d885077a2bf49b6', }