Compute Client Usage

class ServersClient(auth_provider, service, region, enable_instance_password=True, **kwargs)[source]

Service client for the resource /servers

add_fixed_ip(server_id, **kwargs)[source]

Add a fixed IP to server instance.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#addFixedIp

add_security_group(server_id, **kwargs)[source]

Add a security group to the server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#addSecurityGroup

attach_volume(server_id, **kwargs)[source]

Attaches a volume to a server instance.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#attachVolume

change_password(server_id, **kwargs)[source]

Change the root password for the server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#changePassword

confirm_resize_server(server_id, **kwargs)[source]

Confirm the flavor change for a server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#confirmResize

create_backup(server_id, **kwargs)[source]

Backup a server instance.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#createBackup

create_server(**kwargs)[source]

Create server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref/compute/#create-server

Parameters:
  • name -- Server name
  • imageRef -- Image reference (UUID)
  • flavorRef -- Flavor reference (UUID or full URL)

Most parameters except the following are passed to the API without any changes. :param disk_config: The name is changed to OS-DCF:diskConfig :param scheduler_hints: The name is changed to os:scheduler_hints and the parameter is set in the same level as the parameter 'server'.

delete_password(server_id)[source]

Removes the encrypted server password from the metadata server

Note that this does not actually change the instance server password.

delete_server(server_id)[source]

Delete server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#deleteServer

delete_server_metadata_item(server_id, key)[source]

Deletes a metadata item, by key, from a server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#deleteServerMetadataItem

detach_volume(server_id, volume_id)[source]

Detaches a volume from a server instance.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#deleteVolumeAttachment

force_delete_server(server_id, **kwargs)[source]

Force delete a server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#forceDelete

get_console_output(server_id, **kwargs)[source]

Get console output.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#getConsoleOutput

get_vnc_console(server_id, **kwargs)[source]

Get URL of VNC console.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#getVNCConsole

inject_network_info(server_id, **kwargs)[source]

Inject the Network Info into server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#injectNetworkInfo

list_addresses(server_id)[source]

Lists all addresses for a server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#list-ips

list_addresses_by_network(server_id, network_id)[source]

Lists all addresses of a specific network type for a server.

list_instance_actions(server_id)[source]

List the provided server action.

list_server_metadata(server_id)[source]

Lists all metadata for a server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#listServerMetadata

list_servers(detail=False, **params)[source]

List servers.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#listServers http://developer.openstack.org/api-ref-compute-v2.1.html#listDetailServers

list_virtual_interfaces(server_id)[source]

List the virtual interfaces used in an instance.

list_volume_attachments(server_id)[source]

Returns the list of volume attachments for a given instance.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#listVolumeAttachments

live_migrate_server(server_id, **kwargs)[source]

This should be called with administrator privileges.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#migrateLive

lock_server(server_id, **kwargs)[source]

Lock the given server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#lock

migrate_server(server_id, **kwargs)[source]

Migrate a server to a new host.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#migrate

pause_server(server_id, **kwargs)[source]

Pause the provided server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#pause

reboot_server(server_id, **kwargs)[source]

Reboot a server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#reboot

rebuild_server(server_id, image_ref, **kwargs)[source]

Rebuild a server with a new image.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#rebuild

Most parameters except the following are passed to the API without any changes. :param disk_config: The name is changed to OS-DCF:diskConfig

remove_fixed_ip(server_id, **kwargs)[source]

Remove input fixed IP from input server instance.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#removeFixedIp

remove_security_group(server_id, **kwargs)[source]

Remove a security group from the server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#removeSecurityGroup

rescue_server(server_id, **kwargs)[source]

Rescue the provided server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#rescue

reset_network(server_id, **kwargs)[source]

Reset the Network of a server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#resetNetwork

reset_state(server_id, **kwargs)[source]

Reset the state of a server to active/error.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#resetState

resize_server(server_id, flavor_ref, **kwargs)[source]

Change the flavor of a server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#resize

Most parameters except the following are passed to the API without any changes. :param disk_config: The name is changed to OS-DCF:diskConfig

restore_soft_deleted_server(server_id, **kwargs)[source]

Restore a soft-deleted server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#restore

resume_server(server_id, **kwargs)[source]

Un-suspend the provided server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#resume

revert_resize_server(server_id, **kwargs)[source]

Revert a server back to its original flavor.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#revertResize

set_server_metadata(server_id, meta, no_metadata_field=False)[source]

Sets one or more metadata items for a server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#createServerMetadata

set_server_metadata_item(server_id, key, meta)[source]

Sets a metadata item, by key, for a server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#setServerMetadataItem

shelve_offload_server(server_id, **kwargs)[source]

Shelve-offload the provided server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#shelveOffload

shelve_server(server_id, **kwargs)[source]

Shelve the provided server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#shelve

show_instance_action(server_id, request_id)[source]

Returns the action details of the provided server.

show_server(server_id)[source]

Get server details.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#showServer

show_server_diagnostics(server_id)[source]

Get the usage data for a server.

show_server_metadata_item(server_id, key)[source]

Shows details for a metadata item, by key, for a server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#showServerMetadataItem

show_volume_attachment(server_id, volume_id)[source]

Return details about the given volume attachment.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#getVolumeAttachmentDetails

start_server(server_id, **kwargs)[source]

Starts a stopped server and changes its status to ACTIVE.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#start

stop_server(server_id, **kwargs)[source]

Stops a running server and changes its status to SHUTOFF.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#stop

suspend_server(server_id, **kwargs)[source]

Suspend the provided server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#suspend

unlock_server(server_id, **kwargs)[source]

UNlock the given server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#unlock

unpause_server(server_id, **kwargs)[source]

Un-pause the provided server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#unpause

unrescue_server(server_id)[source]

Unrescue the provided server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#unrescue

unshelve_server(server_id, **kwargs)[source]

Un-shelve the provided server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#unshelve

update_attached_volume(server_id, attachment_id, **kwargs)[source]

Swaps a volume attached to an instance for another volume

update_server(server_id, **kwargs)[source]

Update server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#updateServer

Most parameters except the following are passed to the API without any changes. :param disk_config: The name is changed to OS-DCF:diskConfig

update_server_metadata(server_id, meta)[source]

Updates one or more metadata items for a server.

For a full list of available parameters, please refer to the official API reference: http://developer.openstack.org/api-ref-compute-v2.1.html#updateServerMetadata