Previous topic

The nova.virt.xenapi.volumeops Module

Next topic

The nova.vnc.xvp_proxy 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.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.

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.
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 XenAPIConnection(url, user, pw)

Bases: nova.virt.driver.ComputeDriver

A connection to XenServer or Xen Cloud Platform

add_to_aggregate(context, aggregate, host, **kwargs)

Add a compute host to an aggregate.

attach_volume(connection_info, instance_name, mountpoint)

Attach volume storage to VM instance

compare_cpu(xml)

This method is supported only by libvirt.

confirm_migration(migration, instance, network_info)

Confirms a resize, destroying the source VM

destroy(instance, network_info, block_device_info=None)

Destroy VM instance

detach_volume(connection_info, instance_name, mountpoint)

Detach volume storage to VM instance

ensure_filtering_rules_for_instance(instance_ref, network_info)

This method is supported only libvirt.

finish_migration(context, migration, instance, disk_info, network_info, image_meta, resize_instance=False)

Completes a resize, turning on the migrated instance

finish_revert_migration(instance, network_info)

Finish reverting a resize, powering back on the instance

get_all_bw_usage(start_time, stop_time=None)

Return bandwidth usage info for each interface on each running VM

get_console_output(instance)

Return snapshot of console

get_console_pool_info(console_type)
get_diagnostics(instance)

Return data about VM diagnostics

static get_host_ip_addr()
get_host_stats(refresh=False)

Return the current state of the host. If ‘refresh’ is True, run the update first.

get_info(instance)

Return data about VM instance

get_vnc_console(instance)

Return link to instance’s VNC console

get_volume_connector(_instance)

Return volume connector information

host_maintenance_mode(host, mode)

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

host_power_action(host, action)

The only valid values for ‘action’ on XenServer are ‘reboot’ or ‘shutdown’, even though the API also accepts ‘startup’. As this is not technically possible on XenServer, since the host is the same physical machine as the hypervisor, if this is requested, we need to raise an exception.

host_state
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, network_info)

inject network info for specified instance

list_instances()

List VM instances

list_instances_detail()
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)

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

pause(instance)

Pause VM instance

plug_vifs(instance_ref, network_info)

Plug VIFs into networks.

poll_rebooting_instances(timeout)

Poll for rebooting instances

poll_rescued_instances(timeout)

Poll for rescued instances

poll_unconfirmed_resizes(resize_confirm_window)

Poll for unconfirmed resizes

power_off(instance)

Power off the specified instance

power_on(instance)

Power on the specified instance

reboot(instance, network_info, reboot_type)

Reboot VM instance

refresh_provider_fw_rules()
refresh_security_group_members(security_group_id)

Updates security group rules for all instances associated with a given security group Invoked when instances are added/removed to a security group

refresh_security_group_rules(security_group_id)

Updates security group rules for all instances associated with a given security group Invoked when security group rules are updated

remove_from_aggregate(context, aggregate, host, **kwargs)

Remove a compute host from an aggregate.

rescue(context, instance, network_info, image_meta)

Rescue the specified instance

reset_network(instance)

reset networking for specified instance

resume(instance)

resume the specified instance

set_admin_password(instance, new_pass)

Set the root/admin password on the VM instance

set_host_enabled(host, enabled)

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

snapshot(context, instance, image_id)

Create snapshot from a running VM instance

spawn(context, instance, image_meta, network_info=None, block_device_info=None)

Create VM instance

suspend(instance)

suspend the specified instance

unfilter_instance(instance_ref, network_info)

Removes security groups configured for an instance.

unpause(instance)

Unpause paused VM instance

unplug_vifs(instance_ref, network_info)

Unplug VIFs from networks.

unrescue(instance, network_info)

Unrescue the specified instance

update_available_resource(ctxt, host)

Updates compute manager resource info on ComputeNode table.

This method is called when nova-compute launches, and whenever admin executes “nova-manage service update_resource”.

Parameters:
  • ctxt – security context
  • host – hostname that compute manager is currently running
update_host_status()

Update the status info of the host, and return those values to the calling program.

class XenAPISession(url, user, pw)

Bases: object

The session to invoke XenAPI SDK calls

call_plugin(plugin, fn, args)

Call 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_product_version()

Return a tuple of (major, minor, rev) for the host version

get_session_id()

Return a string session_id. Used for vnc consoles.

get_xenapi_host()

Return the xenapi host on which nova-compute runs on.

get_connection(_read_only)

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