Handles all requests relating to instances (guest vms).
-
class nova.compute.api.API(image_service=None, network_api=None, volume_api=None, hostname_factory=<function generate_default_hostname at 0xa0837d4>, **kwargs)
Bases: nova.db.base.Base
API for interacting with the compute manager.
-
associate_floating_ip(context, instance_id, address)
Associate a floating ip with an instance.
-
attach_volume(context, instance_id, volume_id, device)
Attach an existing volume to an existing instance.
-
confirm_resize(context, instance_id)
Confirms a migration/resize and deletes the ‘old’ instance.
-
create(context, instance_type, image_id, kernel_id=None, ramdisk_id=None, min_count=1, max_count=1, display_name='', display_description='', key_name=None, key_data=None, security_group='default', availability_zone=None, user_data=None, metadata=[], injected_files=None)
Create the number and type of instances requested.
Verifies that quota and other arguments are valid.
-
delete(*args, **kwargs)
-
delete_instance_metadata(context, instance_id, key)
Delete the given metadata item from an instance.
-
detach_volume(context, volume_id)
Detach a volume from an instance.
-
ensure_default_security_group(context)
Ensure that a context has a security group.
Creates a security group for the security context if it does not
already exist.
Parameters: |
- context – the security context
|
-
get(context, instance_id)
Get a single instance with the given instance_id.
-
get_actions(context, instance_id)
Retrieve actions for the given instance.
-
get_ajax_console(context, instance_id)
Get a url to an AJAX Console.
-
get_all(context, project_id=None, reservation_id=None, fixed_ip=None)
Get all instances filtered by one of the given parameters.
If there is no filter and the context is an admin, it will retreive
all instances in the system.
-
get_console_output(context, instance_id)
Get console output for an an instance.
-
get_diagnostics(*args, **kwargs)
-
get_instance_metadata(context, instance_id)
Get all metadata associated with an instance.
-
get_lock(context, instance_id)
Return the boolean state of given instance’s lock.
-
get_network_topic(context, instance_id)
Get the network topic for an instance.
-
get_vnc_console(context, instance_id)
Get a url to a VNC Console.
-
has_finished_migration(context, instance_id)
Returns true if an instance has a finished migration.
-
inject_file(context, instance_id)
Write a file to the given instance.
-
inject_network_info(context, instance_id)
Inject network info for the instance.
-
lock(context, instance_id)
Lock the given instance.
-
pause(*args, **kwargs)
-
reboot(context, instance_id)
Reboot the given instance.
-
rescue(*args, **kwargs)
-
reset_network(context, instance_id)
Reset networking on the instance.
-
resize(context, instance_id, flavor_id)
Resize a running instance.
-
resume(*args, **kwargs)
-
revert_resize(context, instance_id)
Reverts a resize, deleting the ‘new’ instance in the process.
-
routing_get(*args, **kwargs)
-
set_admin_password(context, instance_id, password=None)
Set the root/admin password for the given instance.
-
snapshot(context, instance_id, name)
Snapshot the given instance.
Returns: | A dict containing image metadata |
-
suspend(*args, **kwargs)
-
trigger_security_group_members_refresh(context, group_id)
Called when a security group gains a new or loses a member.
Sends an update request to each compute node for whom this is
relevant.
-
trigger_security_group_rules_refresh(context, security_group_id)
Called when a rule is added to or removed from a security_group.
-
unlock(context, instance_id)
Unlock the given instance.
-
unpause(*args, **kwargs)
-
unrescue(*args, **kwargs)
-
update(context, instance_id, **kwargs)
Updates the instance in the datastore.
Parameters: |
- context – The security context
- instance_id – ID of the instance to update
- kwargs – All additional keyword args are treated
as data fields of the instance to be
updated
|
Returns: | None
|
-
update_or_create_instance_metadata(context, instance_id, metadata)
Updates or creates instance metadata.
-
nova.compute.api.generate_default_hostname(instance_id)
Default function to generate a hostname given an instance reference.