The nova.compute.manager Module

Handles all processes relating to instances (guest vms).

The ComputeManager class is a nova.manager.Manager that handles RPC calls relating to creating instances. It is responsible for building a disk image, launching it via the underlying virtualization driver, responding to calls to check its state, attaching persistent storage, and terminating it.

Related Flags

instances_path:Where instances are kept on disk
base_dir_name:Where cached images are stored under instances_path
compute_driver:Name of class that is used to handle virtualization, loaded by nova.openstack.common.importutils.import_object()
class ComputeManager(compute_driver=None, *args, **kwargs)

Bases: nova.manager.SchedulerDependentManager

Manages the running instances from creation to destruction.

RPC_API_VERSION = '1.44'
add_aggregate_host(*args, **kw)

Notify hypervisor of change (for hypervisor pools).

add_fixed_ip_to_instance(*args, **kw)

Calls network_api to add new fixed_ip to instance then injects the new network info and resets instance networking.

attach_volume(*args, **kw)

Attach a volume to an instance.

change_instance_metadata(*args, **kw)

Update the metadata published to the instance.

check_can_live_migrate_destination(*args, **kw)

Check if it is possible to execute live migration.

This runs checks on the destination host, and then calls back to the source host to check the results.

Parameters:
  • context – security context
  • instance – dict of instance data
  • instance_id – (deprecated and only supplied if no instance passed in) nova.db.sqlalchemy.models.Instance.Id
  • block_migration – if true, prepare for block migration
  • disk_over_commit – if true, allow disk over commit

Returns a mapping of values required in case of block migration and None otherwise.

check_can_live_migrate_source(*args, **kw)

Check if it is possible to execute live migration.

This checks if the live migration can succeed, based on the results from check_can_live_migrate_destination.

Parameters:
  • context – security context
  • instance – dict of instance data
  • instance_id – (deprecated and only supplied if no instance passed in) nova.db.sqlalchemy.models.Instance.Id
  • dest_check_data – result of check_can_live_migrate_destination
check_shared_storage_test_file(*args, **kw)
cleanup_shared_storage_test_file(*args, **kw)
compare_cpu(*args, **kw)
confirm_resize(*args, **kw)

Destroys the source instance.

create_shared_storage_test_file(*args, **kw)
detach_volume(*args, **kw)

Detach a volume from an instance.

finish_resize(*args, **kw)

Completes the migration process.

Sets up the newly transferred disk and turns on the instance at its new host machine.

finish_revert_resize(*args, **kw)

Finishes the second half of reverting a resize.

Power back on the source instance and revert the resized attributes in the database.

get_console_output(*args, **kw)

Send the console output for the given instance.

get_console_pool_info(context, console_type)
get_console_topic(context, **kwargs)

Retrieves the console host for a project on this host.

Currently this is just set in the flags for each compute host.

get_diagnostics(*args, **kw)

Retrieve diagnostics for an instance on this host.

get_host_uptime(*args, **kw)

Returns the result of calling “uptime” on the target host.

get_instance_disk_info(context, instance_name)

Getting information of instance’s current disk.

DEPRECATED: This method is no longer used by any current code, but it is left here to provide backwards compatibility in the rpcapi.

Implementation nova.virt.libvirt.connection.

Parameters:
  • context – security context
  • instance_name – instance name
get_vnc_console(*args, **kw)

Return connection information for a vnc console.

host_maintenance_mode(*args, **kw)

Start/Stop host maintenance window. On start, it triggers guest VMs evacuation.

host_power_action(*args, **kw)

Reboots, shuts down or powers up the host.

init_host()

Initialization for a standalone compute service.

inject_file(*args, **kw)

Write a file to the specified path in an instance on this host.

inject_network_info(context, *args, **kwargs)

Inject network info, but don’t return the info.

live_migration(context, dest, block_migration=False, instance=None, instance_id=None, migrate_data=None)

Executing live migration.

Parameters:
  • context – security context
  • instance_id – (deprecated) nova.db.sqlalchemy.models.Instance.Id
  • instance – instance dict
  • dest – destination host
  • block_migration – if true, prepare for block migration
  • migrate_data – implementation specific params
lock_instance(*args, **kw)

Lock the given instance.

This isn’t actually used in the current code. The same thing is now done directly in nova.compute.api. This must stay here for backwards compatibility of the rpc API.

pause_instance(*args, **kw)

Pause an instance on this host.

post_live_migration_at_destination(context, instance=None, instance_id=None, block_migration=False)

Post operations for live migration .

Parameters:
  • context – security context
  • instance_id – nova.db.sqlalchemy.models.Instance.Id
  • block_migration – if true, prepare for block migration
power_off_instance(*args, **kw)

Power off an instance on this host.

power_on_instance(*args, **kw)

Power on an instance on this host.

pre_live_migration(context, instance=None, instance_id=None, block_migration=False, disk=None)

Preparations for live migration at dest host.

Parameters:
  • context – security context
  • instance_id – nova.db.sqlalchemy.models.Instance.Id
  • block_migration – if true, prepare for block migration
prep_resize(*args, **kw)

Initiates the process of moving a running instance to another host.

Possibly changes the RAM and disk size in the process.

reboot_instance(*args, **kw)

Reboot an instance on this host.

rebuild_instance(*args, **kw)

Destroy and re-make this instance.

A ‘rebuild’ effectively purges all existing data from the system and remakes the VM with given ‘metadata’ and ‘personalities’.

Parameters:
  • contextnova.RequestContext object
  • instance_uuid – (Deprecated) Instance Identifier (UUID)
  • instance – Instance dict
  • orig_image_ref – Original image_ref before rebuild
  • image_ref – New image_ref for rebuild
  • injected_files – Files to inject
  • new_pass – password to set on rebuilt instance
refresh_instance_security_rules(*args, **kw)

Tell the virtualization driver to refresh security rules for an instance.

Passes straight through to the virtualization driver.

refresh_provider_fw_rules(*args, **kw)

This call passes straight through to the virtualization driver.

refresh_security_group_members(*args, **kw)

Tell the virtualization driver to refresh security group members.

Passes straight through to the virtualization driver.

refresh_security_group_rules(*args, **kw)

Tell the virtualization driver to refresh security group rules.

Passes straight through to the virtualization driver.

remove_aggregate_host(*args, **kw)

Removes a host from a physical hypervisor pool.

remove_fixed_ip_from_instance(*args, **kw)

Calls network_api to remove existing fixed_ip from instance by injecting the altered network info and resetting instance networking.

remove_volume_connection(*args, **kw)

Remove a volume connection using the volume api

rescue_instance(*args, **kw)

Rescue an instance on this host. :param rescue_password: password to set on rescue instance

reserve_block_device_name(*args, **kw)
reset_network(context, *args, **kwargs)

Reset networking on the given instance.

resize_instance(*args, **kw)

Starts the migration of a running instance to another host.

resume_instance(*args, **kw)

Resume the given suspended instance.

revert_resize(*args, **kw)

Destroys the new instance on the destination machine.

Reverts the model changes, and powers on the old instance on the source machine.

rollback_live_migration(context, instance_ref, dest, block_migration)

Recovers Instance/volume state from migrating -> running.

Parameters:
  • context – security context
  • instance_ref – nova.db.sqlalchemy.models.Instance
  • dest – This method is called from live migration src host. This param specifies destination host.
  • block_migration – if true, prepare for block migration
rollback_live_migration_at_destination(context, instance=None, instance_id=None)

Cleaning up image directory that is created pre_live_migration.

Parameters:
  • context – security context
  • instance_id – (deprecated) nova.db.sqlalchemy.models.Instance.Id
  • instance – an Instance dict sent over rpc
run_instance(*args, **kw)
set_admin_password(*args, **kw)

Set the root/admin password for an instance on this host.

This is generally only called by API password resets after an image has been built.

set_host_enabled(*args, **kw)

Sets the specified host’s ability to accept new instances.

snapshot_instance(*args, **kw)

Snapshot an instance on this host.

Parameters:
  • context – security context
  • instance_uuid – (deprecated) db.sqlalchemy.models.Instance.Uuid
  • instance – an Instance dict
  • image_id – glance.db.sqlalchemy.models.Image.Id
  • image_type – snapshot | backup
  • backup_type – daily | weekly
  • rotation – int representing how many backups to keep around; None if rotation shouldn’t be used (as in the case of snapshots)
start_instance(*args, **kw)

Starting an instance on this host.

Alias for power_on_instance for compatibility

stop_instance(*args, **kw)

Stopping an instance on this host.

Alias for power_off_instance for compatibility

suspend_instance(*args, **kw)

Suspend the given instance.

terminate_instance(*args, **kw)

Terminate an instance on this host.

unlock_instance(*args, **kw)

Unlock the given instance.

This isn’t actually used in the current code. The same thing is now done directly in nova.compute.api. This must stay here for backwards compatibility of the rpc API.

unpause_instance(*args, **kw)

Unpause a paused instance on this host.

unrescue_instance(*args, **kw)

Rescue an instance on this host.

update_available_resource(context)

See driver.get_available_resource()

Periodic process that keeps that the compute host’s understanding of resource availability and usage in sync with the underlying hypervisor.

Parameters:context – security context
checks_instance_lock(function)

Decorator to prevent action against locked instances for non-admins.

publisher_id(host=None)
reverts_task_state(function)

Decorator to revert task_state on failure

wrap_instance_fault(function)

Wraps a method to catch exceptions related to instances.

This decorator wraps a method to catch any exceptions having to do with an instance that may get thrown. It then logs an instance fault in the db.

Previous topic

The nova.compute.instance_types Module

Next topic

The nova.compute.power_state Module

This Page