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: https://developer.openstack.org/api-ref/compute/#add-associate-fixed-ip-addfixedip-action-deprecated
- 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: https://developer.openstack.org/api-ref/compute/#add-security-group-to-a-server-addsecuritygroup-action
- 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: https://developer.openstack.org/api-ref/compute/#attach-a-volume-to-an-instance
- 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: https://developer.openstack.org/api-ref/compute/#change-administrative-password-changepassword-action
- check_tag_existence(server_id, tag)[source]¶
Checks tag existence on the server.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#check-tag-existence
- Parameters
tag – Check for existence of tag on specified server.
- 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: https://developer.openstack.org/api-ref/compute/#confirm-resized-server-confirmresize-action
- create_backup(server_id, **kwargs)[source]¶
Backup a server instance.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#create-server-back-up-createbackup-action
- 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_all_tags(server_id)[source]¶
Deletes all tags from the specified server.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#delete-all-tags
- 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: https://developer.openstack.org/api-ref/compute/#delete-server
- 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: https://developer.openstack.org/api-ref/compute/#delete-metadata-item
- delete_tag(server_id, tag)[source]¶
Deletes a single tag from the specified server.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#delete-a-single-tag
- Parameters
tag – Tag to be removed from the specified server.
- 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: https://developer.openstack.org/api-ref/compute/#detach-a-volume-from-an-instance
- evacuate_server(server_id, **kwargs)[source]¶
Evacuate the given server.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#evacuate-server-evacuate-action
- 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: https://developer.openstack.org/api-ref/compute/#force-delete-server-forcedelete-action
- get_console_output(server_id, **kwargs)[source]¶
Get console output.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#show-console-output-os-getconsoleoutput-action
- get_remote_console(server_id, console_type, protocol, **kwargs)[source]¶
Get a remote console.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#create-remote-console
- 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: https://developer.openstack.org/api-ref/compute/#get-vnc-console-os-getvncconsole-action-deprecated
- 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: https://developer.openstack.org/api-ref/compute/#inject-network-information-injectnetworkinfo-action
- 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: https://developer.openstack.org/api-ref/compute/#list-ips
- list_addresses_by_network(server_id, network_id)[source]¶
Lists all addresses of a specific network type for a server.
- list_security_groups_by_server(server_id)[source]¶
Lists security groups for a server.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#list-security-groups-by-server
- 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: https://developer.openstack.org/api-ref/compute/#list-all-metadata
- list_servers(detail=False, **params)[source]¶
List servers.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#list-servers https://developer.openstack.org/api-ref/compute/#list-servers-detailed
- list_tags(server_id)[source]¶
Lists all tags for a server.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#list-tags
- 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: https://developer.openstack.org/api-ref/compute/#list-volume-attachments-for-an-instance
- 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: https://developer.openstack.org/api-ref/compute/#live-migrate-server-os-migratelive-action
- lock_server(server_id, **kwargs)[source]¶
Lock the given server.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#lock-server-lock-action
- 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: https://developer.openstack.org/api-ref/compute/#migrate-server-migrate-action
- pause_server(server_id, **kwargs)[source]¶
Pause the provided server.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#pause-server-pause-action
- reboot_server(server_id, **kwargs)[source]¶
Reboot a server.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#reboot-server-reboot-action
- 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: https://developer.openstack.org/api-ref/compute/#rebuild-server-rebuild-action
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: https://developer.openstack.org/api-ref/compute/#remove-disassociate-fixed-ip-removefixedip-action-deprecated
- 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: https://developer.openstack.org/api-ref/compute/#remove-security-group-from-a-server-removesecuritygroup-action
- rescue_server(server_id, **kwargs)[source]¶
Rescue the provided server.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#rescue-server-rescue-action
- 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: https://developer.openstack.org/api-ref/compute/#reset-networking-on-a-server-resetnetwork-action
- 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: https://developer.openstack.org/api-ref/compute/#reset-server-state-os-resetstate-action
- 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: https://developer.openstack.org/api-ref/compute/#resize-server-resize-action
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: https://developer.openstack.org/api-ref/compute/#restore-soft-deleted-instance-restore-action
- 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: https://developer.openstack.org/api-ref/compute/#resume-suspended-server-resume-action
- 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: https://developer.openstack.org/api-ref/compute/#revert-resized-server-revertresize-action
- 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: https://developer.openstack.org/api-ref/compute/#replace-metadata-items
- 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: https://developer.openstack.org/api-ref/compute/#create-or-update-metadata-item
- 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: https://developer.openstack.org/api-ref/compute/#shelf-offload-remove-server-shelveoffload-action
- shelve_server(server_id, **kwargs)[source]¶
Shelve the provided server.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#shelve-server-shelve-action
- 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: https://developer.openstack.org/api-ref/compute/#show-server-details
- 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: https://developer.openstack.org/api-ref/compute/#show-metadata-item-details
- 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: https://developer.openstack.org/api-ref/compute/#show-a-detail-of-a-volume-attachment
- 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: https://developer.openstack.org/api-ref/compute/#start-server-os-start-action
- 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: https://developer.openstack.org/api-ref/compute/#stop-server-os-stop-action
- suspend_server(server_id, **kwargs)[source]¶
Suspend the provided server.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#suspend-server-suspend-action
- unlock_server(server_id, **kwargs)[source]¶
UNlock the given server.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#unlock-server-unlock-action
- 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: https://developer.openstack.org/api-ref/compute/#unpause-server-unpause-action
- unrescue_server(server_id)[source]¶
Unrescue the provided server.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#unrescue-server-unrescue-action
- 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: https://developer.openstack.org/api-ref/compute/#unshelve-restore-shelved-server-unshelve-action
- update_all_tags(server_id, tags)[source]¶
Replaces all tags on specified server with the new set of tags.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#replace-tags
- Parameters
tags – List of tags to replace current server tags with.
- 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: https://developer.openstack.org/api-ref/compute/#update-server
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: https://developer.openstack.org/api-ref/compute/#create-or-update-metadata-items
- update_tag(server_id, tag)[source]¶
Adds a single tag to the server if server has no specified tag.
For a full list of available parameters, please refer to the official API reference: https://developer.openstack.org/api-ref/compute/#add-a-single-tag
- Parameters
tag – Tag to be added to the specified server.