This Page

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

The nova.virt.xenapi_conn Module

A connection to XenServer or Xen Cloud Platform.

The concurrency model for this class is as follows:

All XenAPI calls are on a green thread (using eventlet’s “tpool” thread pool). They are remote calls, and so may hang for the usual reasons.

All long-running XenAPI calls (VM.start, VM.reboot, etc) are called async (using XenAPI.VM.async_start etc). These return a task, which can then be polled for completion.

This combination of techniques means that we don’t block the main thread at all, and at the same time we don’t hold lots of threads waiting for long-running operations.

FIXME: get_info currently doesn’t conform to these rules, and will block the reactor thread if the VM.get_by_name_label or VM.get_record calls block.

Related Flags

xenapi_connection_url:
 URL for connection to XenServer/Xen Cloud Platform.
xenapi_connection_username:
 Username for connection to XenServer/Xen Cloud Platform (default: root).
xenapi_connection_password:
 Password for connection to XenServer/Xen Cloud Platform.
xenapi_task_poll_interval:
 The interval (seconds) used for polling of remote tasks (Async.VM.start, etc) (default: 0.5).
target_host:the iSCSI Target Host IP address, i.e. the IP address for the nova-volume host
target_port:iSCSI Target Port, 3260 Default
iqn_prefix:IQN Prefix, e.g. ‘iqn.2010-10.org.openstack’

Variable Naming Scheme

  • suffix “_ref” for opaque references
  • suffix “_uuid” for UUIDs
  • suffix “_rec” for record objects
class nova.virt.xenapi_conn.XenAPIConnection(url, user, pw)

Bases: nova.virt.driver.ComputeDriver

A connection to XenServer or Xen Cloud Platform

attach_volume(instance_name, device_path, mountpoint)

Attach volume storage to VM instance

compare_cpu(xml)

This method is supported only by libvirt.

destroy(instance)

Destroy VM instance

detach_volume(instance_name, mountpoint)

Detach volume storage to VM instance

ensure_filtering_rules_for_instance(instance_ref)

This method is supported only libvirt.

finish_resize(instance, disk_info)

Completes a resize, turning on the migrated instance

get_ajax_console(instance)

Return link to instance’s ajax console

get_console_output(instance)

Return snapshot of console

get_console_pool_info(console_type)
get_diagnostics(instance)

Return data about VM diagnostics

get_host_ip_addr()
get_info(instance_id)

Return data about VM instance

init_host(host)
inject_file(instance, b64_path, b64_contents)

Create a file on the VM instance. The file path and contents should be base64-encoded.

inject_network_info(instance)

inject network info for specified instance

list_instances()

List VM instances

list_instances_detail()
live_migration(context, instance_ref, dest, post_method, recover_method)

This method is supported only by libvirt.

migrate_disk_and_power_off(instance, dest)

Transfers the VHD of a running instance to another host, then shuts off the instance copies over the COW disk

pause(instance, callback)

Pause VM instance

poll_rescued_instances(timeout)

Poll for rescued instances

reboot(instance)

Reboot VM instance

rescue(instance, callback)

Rescue the specified instance

reset_network(instance)

reset networking for specified instance

resume(instance, callback)

resume the specified instance

revert_resize(instance)

Reverts a resize, powering back on the instance

set_admin_password(instance, new_pass)

Set the root/admin password on the VM instance

snapshot(instance, image_id)

Create snapshot from a running VM instance

spawn(instance)

Create VM instance

suspend(instance, callback)

suspend the specified instance

unfilter_instance(instance_ref)

This method is supported only by libvirt.

unpause(instance, callback)

Unpause paused VM instance

unrescue(instance, callback)

Unrescue the specified instance

update_available_resource(ctxt, host)

This method is supported only by libvirt.

class nova.virt.xenapi_conn.XenAPISession(url, user, pw)

Bases: object

The session to invoke XenAPI SDK calls

async_call_plugin(plugin, fn, args)

Call Async.host.call_plugin on a background thread.

call_xenapi(method, *args)

Call the specified XenAPI method on a background thread.

call_xenapi_request(method, *args)

Some interactions with dom0, such as interacting with xenstore’s param record, require using the xenapi_request method of the session object. This wraps that call on a background thread.

get_imported_xenapi()

Stubout point. This can be replaced with a mock xenapi module.

get_xenapi()

Return the xenapi object

get_xenapi_host()

Return the xenapi host

wait_for_task(task, id=None)

Return the result of the given task. The task is polled until it completes. Not re-entrant.

nova.virt.xenapi_conn.get_connection(_)

Note that XenAPI doesn’t have a read-only connection mode, so the read_only parameter is ignored.