## Compute Client Usage

updated: December 08, 2017

# Compute Client Usage

class `ServersClient`(auth_provider, service, region, enable_instance_password=True, **kwargs)

  Service client for the resource /servers

  `add_fixed_ip`(server_id, **kwargs)

    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

  `add_security_group`(server_id, **kwargs)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    Removes the encrypted server password from the metadata server

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

  `delete_server`(server_id)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    Get a remote console.

    For a full list of available parameters, please refer to the official API reference: TODO (markus_z) The api-ref for that isn’t yet available, update this here when the docs in Nova are updated. The old API is at http://developer.openstack.org/api-ref/compute/#get-serial-console-os-getserialconsole-action

  `get_vnc_console`(server_id, **kwargs)

    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

  `inject_network_info`(server_id, **kwargs)

    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)

    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)

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

  `list_instance_actions`(server_id)

    List the provided server action.

  `list_security_groups_by_server`(server_id)

    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)

    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)

    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)

    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_virtual_interfaces`(server_id)

    List the virtual interfaces used in an instance.

  `list_volume_attachments`(server_id)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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

  `remove_security_group`(server_id, **kwargs)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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/#create-or-replace-metadata-items

  `set_server_metadata_item`(server_id, key, meta)

    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)

    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)

    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)

    Returns the action details of the provided server.

  `show_server`(server_id)

    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)

    Get the usage data for a server.

  `show_server_metadata_item`(server_id, key)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    Swaps a volume attached to an instance for another volume

  `update_server`(server_id, **kwargs)

    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)

    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/#update-metadata-items

  `update_tag`(server_id, tag)

    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.

updated: December 08, 2017

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.

found an error? report a bug questions?