The nova.objects.instance Module

class Instance(*args, **kwargs)

Bases: nova.objects.base.NovaPersistentObject, nova.objects.base.NovaObject, nova.objects.base.NovaObjectDictCompat

VERSION = '2.1'
access_ip_v4
access_ip_v6
apply_migration_context()
architecture
auto_disk_config
availability_zone
cell_name
cleaned
clear_numa_topology()
config_drive
create(*args, **kwargs)
created_at
default_ephemeral_device
default_swap_device
delete_metadata_key(*args, **kwargs)

Optimized metadata delete method.

This provides a more efficient way to delete a single metadata key, instead of just calling instance.save(). This should be called with the key still present in self.metadata, which it will update after completion.

deleted
deleted_at
destroy(*args, **kwargs)
disable_terminate
display_description
display_name
drop_migration_context(*args, **kwargs)
ec2_ids
ephemeral_gb
ephemeral_key_uuid
fault
fields = {'locked': Boolean(default=False,nullable=False), 'pci_devices': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'access_ip_v4': IPV4Address(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'instance_type_id': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'vcpu_model': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'key_name': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'cleaned': Boolean(default=False,nullable=False), 'access_ip_v6': IPV6Address(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'cell_name': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'shutdown_terminate': Boolean(default=False,nullable=False), 'id': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'system_metadata': Dict(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'task_state': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'new_flavor': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'display_name': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'ephemeral_key_uuid': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'disable_terminate': Boolean(default=False,nullable=False), 'display_description': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'flavor': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'launched_on': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'user_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'fault': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'power_state': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'root_device_name': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'vcpus': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'vm_mode': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'key_data': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'config_drive': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'locked_by': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'launched_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'project_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'auto_disk_config': Boolean(default=False,nullable=False), 'migration_context': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'tags': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'pci_requests': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'architecture': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'node': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'vm_state': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'numa_topology': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'old_flavor': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'user_data': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'ramdisk_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'terminated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'ephemeral_gb': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'deleted': Boolean(default=False,nullable=False), 'availability_zone': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'host': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'kernel_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'security_groups': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'reservation_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'deleted_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'services': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'info_cache': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'uuid': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'root_gb': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'launch_index': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'hostname': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'ec2_ids': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'image_ref': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'default_swap_device': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'memory_mb': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'metadata': Dict(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'os_type': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'default_ephemeral_device': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'progress': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True)}
flavor
classmethod get_by_id(context, *args, **kwargs)
classmethod get_by_uuid(context, *args, **kwargs)
get_flavor(namespace=None)
host
hostname
id
image_meta
image_ref
info_cache
instance_type_id
kernel_id
key_data
key_name
launch_index
launched_at
launched_on
locked
locked_by
memory_mb
metadata
migration_context
mutated_migration_context(*args, **kwds)

Context manager to temporarily apply the migration context.

Calling .save() from within the context manager means that the mutated context will be saved which can cause incorrect resource tracking, and should be avoided.

name
new_flavor
node
numa_topology
obj_extra_fields = ['name']
obj_load_attr(attrname)
obj_make_compatible(primitive, target_version)
obj_reset_changes(fields=None, recursive=False)
obj_what_changed()
old_flavor
os_type
pci_devices
pci_requests
power_state
progress
project_id
ramdisk_id
refresh(*args, **kwargs)
reservation_id
revert_migration_context()
root_device_name
root_gb
save(*args, **kwargs)

Save updates to this instance

Column-wise updates will be made based on the result of self.what_changed(). If expected_task_state is provided, it will be checked against the in-database copy of the instance before updates are made.

:param:context: Security context :param:expected_task_state: Optional tuple of valid task states for the instance to be in :param:expected_vm_state: Optional tuple of valid vm states for the instance to be in :param admin_state_reset: True if admin API is forcing setting of task_state/vm_state

security_groups
services
shutdown_terminate
skip_cells_sync(*args, **kwds)

Context manager to save an instance without syncing cells.

Temporarily disables the cells syncing logic, if enabled. This should only be used when saving an instance that has been passed down/up from another cell in order to avoid passing it back to the originator to be re-saved.

system_metadata
tags
task_state
terminated_at
updated_at
user_data
user_id
uuid
vcpu_model
vcpus
vm_mode
vm_state
class InstanceList(*args, **kwargs)

Bases: nova.objects.base.ObjectListBase, nova.objects.base.NovaObject

VERSION = '2.0'
fields = {'objects': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False)}
fill_faults()

Batch query the database for our instances’ faults.

Returns:A list of instance uuids for which faults were found.
classmethod get_active_by_window_joined(context, begin, end=None, project_id=None, host=None, expected_attrs=None, use_slave=False)

Get instances and joins active during a certain time window.

:param:context: nova request context :param:begin: datetime for the start of the time window :param:end: datetime for the end of the time window :param:project_id: used to filter instances by project :param:host: used to filter instances on a given compute host :param:expected_attrs: list of related fields that can be joined in the database layer when querying for instances :param use_slave if True, ship this query off to a DB slave :returns: InstanceList

classmethod get_all(context, *args, **kwargs)

Returns all instances on all nodes.

classmethod get_by_filters(context, *args, **kwargs)
classmethod get_by_grantee_security_group_ids(context, *args, **kwargs)
classmethod get_by_host(context, *args, **kwargs)
classmethod get_by_host_and_node(context, *args, **kwargs)
classmethod get_by_host_and_not_type(context, *args, **kwargs)
classmethod get_by_security_group(context, security_group)
classmethod get_by_security_group_id(context, *args, **kwargs)
classmethod get_hung_in_rebooting(context, *args, **kwargs)
objects

Previous topic

The nova.objects.image_meta Module

Next topic

The nova.objects.instance_action Module

Project Source

This Page