Documentation for the compute manager and related files. For reading about a specific virtualization backend, read Drivers.
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.
Bases: nova.manager.Manager
Manages the running instances from creation to destruction.
Notify hypervisor of change (for hypervisor pools).
Calls network_api to add new fixed_ip to instance then injects the new network info and resets instance networking.
Use hotplug to add an network adapter to an instance.
Attach a volume to an instance.
Backup an instance on this host.
Parameters: |
|
---|
Update the metadata published to the instance.
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: |
|
---|---|
Returns: | a dict containing migration info |
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: |
|
---|---|
Returns: | a dict containing migration info |
Check if the instance files are shared
Parameters: |
|
---|
Returns True if instance disks located on shared storage and False otherwise.
Detach an network adapter from an instance.
Detach a volume from an instance.
Completes the migration process.
Sets up the newly transferred disk and turns on the instance at its new host machine.
Finishes the second half of reverting a resize.
Bring the original source instance state back (active/shutoff) and revert the resized attributes in the database.
Retrieves the console host for a project on this host.
Currently this is just set in the flags for each compute host.
Retrieve diagnostics for an instance on this host.
Returns the result of calling “uptime” on the target host.
Start/Stop host maintenance window. On start, it triggers guest VMs evacuation.
Reboots, shuts down or powers up the host.
Initialization for a standalone compute service.
Write a file to the specified path in an instance on this host.
Inject network info, but don’t return the info.
Executing live migration.
Parameters: |
|
---|
Pause an instance on this host.
Post operations for live migration .
Parameters: |
|
---|
Preparations for live migration at dest host.
Parameters: |
|
---|
:param migrate_data : if not None, it is a dict which holds data required for live migration without shared storage.
After the service is initialized, but before we fully bring the service up by listening on RPC queues, make sure to update our available resources (and indirectly our available nodes).
Initiates the process of moving a running instance to another host.
Possibly changes the RAM and disk size in the process.
Reboot an instance on this host.
Tell the virtualization driver to refresh security rules for an instance.
Passes straight through to the virtualization driver.
Synchronise the call because we may still be in the middle of creating the instance.
This call passes straight through to the virtualization driver.
Tell the virtualization driver to refresh security group members.
Passes straight through to the virtualization driver.
Tell the virtualization driver to refresh security group rules.
Passes straight through to the virtualization driver.
Removes a host from a physical hypervisor pool.
Calls network_api to remove existing fixed_ip from instance by injecting the altered network info and resetting instance networking.
Remove a volume connection using the volume api.
Rescue an instance on this host. :param rescue_password: password to set on rescue instance
Reset networking on the given instance.
Starts the migration of a running instance to another host.
Restore a soft-deleted instance on this host.
Resume the given suspended instance.
Destroys the new instance on the destination machine.
Reverts the model changes, and powers on the old instance on the source machine.
Cleaning up image directory that is created pre_live_migration.
Parameters: |
|
---|
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.
Sets the specified host’s ability to accept new instances.
Shelve an instance.
This should be used when you want to take a snapshot of the instance. It also adds system_metadata that can be used by a periodic task to offload the shelved instance after a period of time.
Parameters: |
|
---|
Remove a shelved instance from the hypervisor.
This frees up those resources for use by other instances, but may lead to slower unshelve times for this instance. This method is used by volume backed instances since restoring them doesn’t involve the potentially large download of an image.
Parameters: |
|
---|
Snapshot an instance on this host.
Parameters: |
|
---|
Soft delete an instance on this host.
Starting an instance on this host.
Stopping an instance on this host.
Suspend the given instance.
Swap volume for an instance.
Terminate an instance on this host.
Unpause a paused instance on this host.
Rescue an instance on this host.
Unshelve the instance.
Parameters: |
|
---|
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 |
---|
Bases: nova.virt.virtapi.VirtAPI
Plan to wait for some events, run some code, then wait.
This context manager will first create plans to wait for the provided event_names, yield, and then wait for all the scheduled events to complete.
Note that this uses an eventlet.timeout.Timeout to bound the operation, so callers should be prepared to catch that failure and handle that situation appropriately.
If the event is not received by the specified timeout deadline, eventlet.timeout.Timeout is raised.
If the event is received but did not have a ‘completed’ status, a NovaException is raised. If an error_callback is provided, instead of raising an exception as detailed above for the failure case, the callback will be called with the event_name and instance, and can return True to continue waiting for the rest of the events, False to stop processing, or raise an exception which will bubble up to the waiter.
:param:instance: The instance for which an event is expected :param:event_names: A list of event names. Each element can be a
string event name or tuple of strings to indicate (name, tag).
:param:error_callback: A function to be called if an event arrives
Bases: object
Remove all pending events for an instance.
This will remove all events currently pending for an instance and return them (indexed by event name).
Parameters: | instance – the instance for which events should be purged |
---|---|
Returns: | a dictionary of {event_name: eventlet.event.Event} |
Remove a pending event from the wait list.
This will remove a pending event from the wait list so that it can be used to signal the waiters to wake up.
Parameters: |
|
---|---|
Returns: | the eventlet.event.Event object on which the waiters are blocked |
Prepare to receive an event for an instance.
This will register an event for the given instance that we will wait on later. This should be called before initiating whatever action will trigger the event. The resulting eventlet.event.Event object should be wait()’d on to ensure completion.
Parameters: |
|
---|---|
Returns: | an event object that should be wait()’d on |
Wraps a method that expects a new-world aggregate.
Used for snapshot related method to ensure the image created in compute.api is deleted when an error occurs.
Decorator to error out migration on failure.
Wraps a method that expects a new-world instance
This provides compatibility for callers passing old-style dict instances.
Decorator to revert task_state on failure.
Wraps a method to log the event taken on the instance, and result.
This decorator wraps a method to log the start and result of an event, as part of an action taken on an instance.
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.
Handling of VM disk images.
Convert image to other format.
Return an object containing the parsed output from qemu-img info.
Built-in instance properties.
Add flavor access for project.
Creates flavors.
Delete flavor instance_type information from instance’s system_metadata by prefix.
Marks flavor as deleted.
Create an InstanceType-like object from instance’s system_metadata information.
Get all non-deleted flavors as a dict.
Pass true as argument if you want deleted flavors returned also.
Get all non-deleted flavors as a sorted list.
Pass true as argument if you want deleted flavors returned also.
Get the default flavor.
Retrieves single flavor by id.
Retrieve flavor access list by flavor id.
Retrieve flavor by flavorid.
Raises: | FlavorNotFound |
---|
Retrieves single flavor by name.
Remove flavor access for project.
Save properties from instance_type into instance’s system_metadata, in the format of:
[prefix]instance_type_[key]
This can be used to update system_metadata in place from a type, as well as stash information about another instance_type for later use (such as during resize).
Power state is the state we get by calling virt driver on a particular domain. The hypervisor is always considered the authority on the status of a particular VM, and the power_state in the DB should be viewed as a snapshot of the VMs’s state in the (recent) past. It can be periodically updated, and should also be updated at the end of a task if the task is supposed to affect power_state.
A fake (in-memory) hypervisor+api.
Allows nova testing w/o a hypervisor. This module also documents the semantics of real hypervisor connections.
Bases: nova.virt.driver.ComputeDriver
Attach the disk to the instance at mountpoint using info.
Fake hypervisor driver.
Detach the disk attached to the instance.
Return bandwidth usage counters for each interface on each running VM.
Return usage info for volumes attached to vms on a given host.
Updates compute manager resource info on ComputeNode table.
Since we don’t have a real hypervisor, pretend we have lots of disk and ram.
Return fake Host Status of ram, disk, network.
Start/Stop host maintenance window. On start, it triggers guest VMs evacuation.
Reboots, shuts down or powers up the host.
Plug VIFs into networks.
Sets the specified host’s ability to accept new instances.
Replace the disk attached to the instance.
Removes the named VM, as if it crashed. For testing.
Unplug VIFs from networks.
Bases: object
Bases: nova.virt.virtapi.VirtAPI
Resets FakeDriver’s node list modified by set_nodes().
Usually called from tearDown().
Sets FakeDriver’s node.list.
To restore the change, call restore_nodes()