Previous topic

The nova.virt.driver Module

Next topic

The nova.virt.firewall Module

This Page

Psst... hey. You're reading the latest content, but it might be out of sync with code. You can read Nova 2011.2 docs or all OpenStack docs too.

The nova.virt.fake Module

A fake (in-memory) hypervisor+api.

Allows nova testing w/o a hypervisor. This module also documents the semantics of real hypervisor connections.

class FakeConnection

Bases: nova.virt.driver.ComputeDriver

Fake hypervisor driver

agent_update(instance, url, md5hash)
attach_volume(connection_info, instance_name, mountpoint)

Attach the disk to the instance at mountpoint using info

block_stats(instance_name, disk_id)
compare_cpu(xml)

This method is supported only by libvirt.

confirm_migration(migration, instance, network_info)
destroy(instance, network_info, block_device_info=None)
detach_volume(connection_info, instance_name, mountpoint)

Detach the disk attached to the instance

ensure_filtering_rules_for_instance(instance_ref, network_info)

This method is supported only by libvirt.

finish_migration(context, migration, instance, disk_info, network_info, image_meta, resize_instance)
finish_revert_migration(instance, network_info)
get_all_bw_usage(start_time, stop_time=None)

Return bandwidth usage info for each interface on each running VM

get_console_output(instance)
get_console_pool_info(console_type)
get_diagnostics(instance_name)
get_disk_available_least()
static get_host_ip_addr()
get_host_stats(refresh=False)

Return fake Host Status of ram, disk, network.

get_info(instance)
get_instance_disk_info(instance_name)

This method is supported only by libvirt.

get_vnc_console(instance)
get_volume_connector(instance)
host_maintenance_mode(host, mode)

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

host_power_action(host, action)

Reboots, shuts down or powers up the host.

init_host(host)
inject_file(instance, b64_path, b64_contents)
classmethod instance()
interface_stats(instance_name, iface_id)
list_disks(instance_name)
list_instances()
list_instances_detail()
list_interfaces(instance_name)
live_migration(context, instance_ref, dest, post_method, recover_method, block_migration=False)

This method is supported only by libvirt.

migrate_disk_and_power_off(context, instance, dest, instance_type, network_info)
pause(instance)
plug_vifs(instance, network_info)

Plug VIFs into networks.

poll_rebooting_instances(timeout)
poll_rescued_instances(timeout)
poll_unconfirmed_resizes(resize_confirm_window)
pre_live_migration(block_device_info)

This method is supported only by libvirt.

reboot(instance, network_info, reboot_type)
refresh_provider_fw_rules()
refresh_security_group_members(security_group_id)
refresh_security_group_rules(security_group_id)
rescue(context, instance, network_info, image_meta)
resize(instance, flavor)
resume(instance)
set_admin_password(instance, new_pass)
set_host_enabled(host, enabled)

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

snapshot(context, instance, name)
spawn(context, instance, image_meta, network_info=None, block_device_info=None)
suspend(instance)
test_remove_vm(instance_name)

Removes the named VM, as if it crashed. For testing

unfilter_instance(instance_ref, network_info)

This method is supported only by libvirt.

unpause(instance)
unplug_vifs(instance, network_info)

Unplug VIFs from networks.

unrescue(instance, network_info)
update_available_resource(ctxt, 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.

update_host_status()

Return fake Host Status of ram, disk, network.

class FakeInstance(name, state)

Bases: object

get_connection(_read_only)