# Compute API

For details on how to use compute, see Using OpenStack Compute

## The Compute Class

The compute high-level interface is available through the `compute` member of a `Connection` object. The `compute` member will only be added if the service is detected.

### Server Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  create_server(**attrs)

    Create a new server from attributes

    Parameters:

      attrs (dict) – Keyword arguments which will be used to create a `Server`, comprised of the properties on the Server class.

    Returns:

      The results of server creation

    Return type:

      `Server`

  delete_server(server, ignore_missing=True, force=False)

    Delete a server

    Parameters:

      - server – The value can be either the ID of a server or a `Server` instance.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the server does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent server

      - force (bool) – When set to `True`, the server deletion will be forced immediately.

    Returns:

      `None`

  find_server(name_or_id, ignore_missing=True, *, details=True, all_projects=False)

    Find a single server

    Parameters:

      - name_or_id – The name or ID of a server.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the resource does not exist. When set to `True`, None will be returned when attempting to find a nonexistent resource.

      - details (bool) – When set to `False` instances with only basic data will be returned. The default, `True`, will cause instances with full data to be returned.

      - all_projects (bool) – When set to `True`, search for server by name across all projects. Note that this will likely result in a higher chance of duplicates. Admin-only by default.

    Returns:

      One `Server` or None

    Raises:

      `NotFoundException` when no resource can be found.

    Raises:

      `DuplicateResource` when multiple resources are found.

  get_server(server)

    Get a single server

    Parameters:

      server – The value can be the ID of a server or a `Server` instance.

    Returns:

      One `Server`

    Raises:

      `NotFoundException` when no resource can be found.

  servers(details=True, all_projects=False, **query)

    Retrieve a generator of servers

    Parameters:

      - details (bool) – When set to `False` instances with only basic data will be returned. The default, `True`, will cause instances with full data to be returned.

      - all_projects (bool) – When set to `True`, lists servers from all projects. Admin-only by default.

      - query (kwargs) – Optional query parameters to be sent to limit the servers being returned. Available parameters can be seen under https://docs.openstack.org/api-ref/compute/#list-servers

    Returns:

      A generator of server instances.

  update_server(server, **attrs)

    Update a server

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - attrs – The attributes to update on the server represented by `server`.

    Returns:

      The updated server

    Return type:

      `Server`

  create_server_image(server, name, metadata=None, wait=False, timeout=120)

    Create an image from a server

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - name (str) – The name of the image to be created.

      - metadata (dict) – A dictionary of metadata to be set on the image.

    Returns:

      `Image` object.

  backup_server(server, name, backup_type, rotation)

    Backup a server

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - name – The name of the backup image.

      - backup_type – The type of the backup, for example, daily.

      - rotation – The rotation of the back up image, the oldest image will be removed when image count exceed the rotation count.

    Returns:

      None

  get_server_metadata(server)

    Return a dictionary of metadata for a server

    Parameters:

      server – Either the ID of a server or a `Server` or `ServerDetail` instance.

    Returns:

      A `Server` with the server’s metadata. All keys and values are Unicode text.

    Return type:

      `Server`

  set_server_metadata(server, **metadata)

    Update metadata for a server

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - metadata (kwargs) – Key/value pairs to be updated in the server’s metadata. No other metadata is modified by this call. All keys and values are stored as Unicode.

    Returns:

      A `Server` with only the server’s metadata. All keys and values are Unicode text.

    Return type:

      `Server`

  delete_server_metadata(server, keys=None)

    Delete metadata for a server

    Note: This method will do a HTTP DELETE request for every key in keys.

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - keys (list) – The keys to delete. If left empty complete metadata will be removed.

    Return type:

      `None`

  wait_for_server(server, status='ACTIVE', failures=None, interval=2, wait=120, callback=None)

    Wait for a server to be in a particular status.

    Parameters:

      - server (`Server`:) – The `Server` to wait on to reach the specified status.

      - status (str) – Desired status.

      - failures (`list`) – Statuses that would be interpreted as failures.

      - interval (int) – Number of seconds to wait before to consecutive checks. Default to 2.

      - wait – Maximum number of seconds to wait before the change. Default to 120.

      - callback (callable) – A callback function. This will be called with a single value, progress, which is a percentage value from 0-100.

    Returns:

      The resource is returned on success.

    Raises:

      `ResourceTimeout` if transition to the desired status failed to occur in specified seconds.

    Raises:

      `ResourceFailure` if the resource has transited to one of the failure statuses.

    Raises:

      `AttributeError` if the resource does not have a `status` attribute.

#### Network Actions

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  fetch_server_security_groups(server)

    Fetch security groups with details for a server.

    Parameters:

      server – Either the ID of a server or a `Server` instance.

    Returns:

      updated `Server` instance

  add_security_group_to_server(server, security_group)

    Add a security group to a server

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - security_group – Either the ID or name of a security group or a `SecurityGroup` instance.

    Returns:

      None

  remove_security_group_from_server(server, security_group)

    Remove a security group from a server

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - security_group – Either the ID or name of a security group or a `SecurityGroup` instance.

    Returns:

      None

  add_fixed_ip_to_server(server, network_id)

    Adds a fixed IP address to a server instance.

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - network_id – The ID of the network from which a fixed IP address is about to be allocated.

    Returns:

      None

  remove_fixed_ip_from_server(server, address)

    Removes a fixed IP address from a server instance.

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - address – The fixed IP address to be disassociated from the server.

    Returns:

      None

  add_floating_ip_to_server(server, address, fixed_address=None)

    Adds a floating IP address to a server instance.

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - address – The floating IP address to be added to the server.

      - fixed_address – The fixed IP address to be associated with the floating IP address. Used when the server is connected to multiple networks.

    Returns:

      None

  remove_floating_ip_from_server(server, address)

    Removes a floating IP address from a server instance.

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - address – The floating IP address to be disassociated from the server.

    Returns:

      None

#### Starting, Stopping, etc.

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  reboot_server(server, reboot_type)

    Reboot a server

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - reboot_type (str) – The type of reboot to perform. “HARD” and “SOFT” are the current options.

    Returns:

      None

  pause_server(server)

    Pauses a server and changes its status to `PAUSED`.

    Parameters:

      server – Either the ID of a server or a `Server` instance.

    Returns:

      None

  unpause_server(server)

    Unpauses a paused server and changes its status to `ACTIVE`.

    Parameters:

      server – Either the ID of a server or a `Server` instance.

    Returns:

      None

  suspend_server(server)

    Suspends a server and changes its status to `SUSPENDED`.

    Parameters:

      server – Either the ID of a server or a `Server` instance.

    Returns:

      None

  resume_server(server)

    Resumes a suspended server and changes its status to `ACTIVE`.

    Parameters:

      server – Either the ID of a server or a `Server` instance.

    Returns:

      None

  lock_server(server, locked_reason=None)

    Locks a server.

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - locked_reason – The reason behind locking the server. Limited to 255 characters in length.

    Returns:

      None

  unlock_server(server)

    Unlocks a locked server.

    Parameters:

      server – Either the ID of a server or a `Server` instance.

    Returns:

      None

  rescue_server(server, admin_pass=None, image_ref=None)

    Puts a server in rescue mode and changes it status to `RESCUE`.

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - admin_pass – The password for the rescued server. If you omit this parameter, the operation generates a new password.

      - image_ref – The image reference to use to rescue your server. This can be the image ID or its full URL. If you omit this parameter, the base image reference will be used.

    Returns:

      None

  unrescue_server(server)

    Unrescues a server and changes its status to `ACTIVE`.

    Parameters:

      server – Either the ID of a server or a `Server` instance.

    Returns:

      None

  evacuate_server(server, host=None, admin_pass=None, force=None, *, on_shared_storage=None)

    Evacuates a server from a failed host to a new host.

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - host – An optional parameter specifying the name or ID of the host to which the server is evacuated.

      - admin_pass – An optional parameter specifying the administrative password to access the evacuated or rebuilt server.

      - force – Force an evacuation by not verifying the provided destination host by the scheduler. (New in API version 2.29).

      - on_shared_storage – Whether the host is using shared storage. (Optional) (Only supported before API version 2.14)

    Returns:

      None

  start_server(server)

    Starts a stopped server and changes its state to `ACTIVE`.

    Parameters:

      server – Either the ID of a server or a `Server` instance.

    Returns:

      None

  stop_server(server)

    Stops a running server and changes its state to `SHUTOFF`.

    Parameters:

      server – Either the ID of a server or a `Server` instance.

    Returns:

      None

  restore_server(server)

    Restore a soft-deleted server.

    Parameters:

      server – Either the ID of a server or a `Server` instance.

    Returns:

      None

  shelve_server(server)

    Shelves a server.

    All associated data and resources are kept but anything still in memory is not retained. Policy defaults enable only users with administrative role or the owner of the server to perform this operation. Cloud provides could change this permission though.

    Parameters:

      server – Either the ID of a server or a `Server` instance.

    Returns:

      None

  unshelve_server(server, *, host=None, availability_zone=<openstack.types.Unset object>)

    Unshelves or restores a shelved server.

    Policy defaults enable only users with administrative role or the owner of the server to perform this operation. Cloud provides could change this permission though.

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - host – An optional parameter specifying the name the compute host to unshelve to. (New in API version 2.91).

    Returns:

      None

  migrate_server(server, *, host=None)

    Migrate a server from one host to another

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - host (str) – The host to which to migrate the server.

    Returns:

      None

  live_migrate_server(server, host=None, force=False, block_migration=None, disk_over_commit=None)

    Live migrate a server from one host to target host

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - host (str) – The host to which to migrate the server. If the Nova service is too old, the host parameter implies force=True which causes the Nova scheduler to be bypassed. On such clouds, a `ValueError` will be thrown if `host` is given without `force`.

      - force (bool) – Force a live-migration by not verifying the provided destination host by the scheduler. This is unsafe and not recommended.

      - block_migration – Perform a block live migration to the destination host by the scheduler. Can be ‘auto’, True or False. Some clouds are too old to support ‘auto’, in which case a ValueError will be thrown. If omitted, the value will be ‘auto’ on clouds that support it, and False on clouds that do not.

      - disk_over_commit – Whether to allow disk over-commit on the destination host. (Optional)

    Returns:

      None

#### Modifying a Server

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  change_server_password(server, new_password)

    Change the administrator password

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - new_password (str) – The new password to be set.

    Returns:

      None

  get_server_password(server)

    Get the administrator password

    Parameters:

      server – Either the ID of a server or a `Server` instance.

    Returns:

      encrypted password.

  reset_server_state(server, state)

    Reset the state of server

    Parameters:

      - server – The server can be either the ID of a server or a `Server`.

      - state – The state of the server to be set, active or error are valid.

    Returns:

      None

  rebuild_server(server, image, **attrs)

    Rebuild a server

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - name (str) – The name of the server

      - admin_password (str) – The administrator password

      - preserve_ephemeral (bool) – Indicates whether the server is rebuilt with the preservation of the ephemeral partition. Default: False

      - image (str) – The id of an image to rebuild with. Default: None

      - access_ipv4 (str) – The IPv4 address to rebuild with. Default: None

      - access_ipv6 (str) – The IPv6 address to rebuild with. Default: None

      - metadata (dict) – A dictionary of metadata to rebuild with. Default: None

      - personality – A list of dictionaries, each including a path and contents key, to be injected into the rebuilt server at launch. Default: None

    Returns:

      The rebuilt `Server` instance.

  resize_server(server, flavor)

    Resize a server

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - flavor – Either the ID of a flavor or a `Flavor` instance.

    Returns:

      None

  confirm_server_resize(server)

    Confirm a server resize

    Parameters:

      server – Either the ID of a server or a `Server` instance.

    Returns:

      None

  revert_server_resize(server)

    Revert a server resize

    Parameters:

      server – Either the ID of a server or a `Server` instance.

    Returns:

      None

### Image Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  delete_image(image, ignore_missing=True)

    Delete an image

    Parameters:

      - image – The value can be either the ID of an image or a `Image` instance.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the image does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent image.

    Returns:

      `None`

  find_image(name_or_id, ignore_missing=True)

    Find a single image

    Parameters:

      - name_or_id – The name or ID of a image.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the resource does not exist. When set to `True`, None will be returned when attempting to find a nonexistent resource.

    Returns:

      One `Image` or None

    Raises:

      `NotFoundException` when no resource can be found.

    Raises:

      `DuplicateResource` when multiple resources are found.

  get_image(image)

    Get a single image

    Parameters:

      image – The value can be the ID of an image or a `Image` instance.

    Returns:

      One `Image`

    Raises:

      `NotFoundException` when no resource can be found.

  images(details=True, **query)

    Return a generator of images

    Parameters:

      - details (bool) – When `True`, returns `Image` objects with all available properties, otherwise only basic properties are returned. Default: ``True``

      - query (kwargs) – Optional query parameters to be sent to limit the resources being returned.

    Returns:

      A generator of image objects

  get_image_metadata(image)

    Return a dictionary of metadata for an image

    Parameters:

      image – Either the ID of an image or a `Image` instance.

    Returns:

      A `Image` with only the image’s metadata. All keys and values are Unicode text.

    Return type:

      `Image`

  set_image_metadata(image, **metadata)

    Update metadata for an image

    Parameters:

      - image – Either the ID of an image or a `Image` instance.

      - metadata (kwargs) – Key/value pairs to be updated in the image’s metadata. No other metadata is modified by this call. All keys and values are stored as Unicode.

    Returns:

      A `Image` with only the image’s metadata. All keys and values are Unicode text.

    Return type:

      `Image`

  delete_image_metadata(image, keys=None)

    Delete metadata for an image

    Note: This method will do a HTTP DELETE request for every key in keys.

    Parameters:

      - image – Either the ID of an image or a `Image` instance.

      - keys (list) – The keys to delete. If left empty complete metadata will be removed.

    Return type:

      `None`

### Flavor Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  find_flavor(name_or_id, ignore_missing=True, *, get_extra_specs=False, **query)

    Find a single flavor

    Parameters:

      - name_or_id – The name or ID of a flavor.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the resource does not exist. When set to `True`, None will be returned when attempting to find a nonexistent resource.

      - get_extra_specs (bool) – When set to `True` and extra_specs not present in the response will invoke additional API call to fetch extra_specs.

      - query (kwargs) – Optional query parameters to be sent to limit the flavors being returned.

    Returns:

      One `Flavor` or None

    Raises:

      `NotFoundException` when no resource can be found.

    Raises:

      `DuplicateResource` when multiple resources are found.

  create_flavor(**attrs)

    Create a new flavor from attributes

    Parameters:

      attrs (dict) – Keyword arguments which will be used to create a `Flavor`, comprised of the properties on the Flavor class.

    Returns:

      The results of flavor creation

    Return type:

      `Flavor`

  delete_flavor(flavor, ignore_missing=True)

    Delete a flavor

    Parameters:

      - flavor – The value can be either the ID of a flavor or a `Flavor` instance.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the flavor does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent flavor.

    Returns:

      `None`

  get_flavor(flavor, get_extra_specs=False)

    Get a single flavor

    Parameters:

      - flavor – The value can be the ID of a flavor or a `Flavor` instance.

      - get_extra_specs (bool) – When set to `True` and extra_specs not present in the response will invoke additional API call to fetch extra_specs.

    Returns:

      One `Flavor`

    Raises:

      `NotFoundException` when no resource can be found.

  flavors(details=True, get_extra_specs=False, **query)

    Return a generator of flavors

    Parameters:

      - details (bool) – When `True`, returns `Flavor` objects, with additional attributes filled.

      - get_extra_specs (bool) – When set to `True` and extra_specs not present in the response will invoke additional API call to fetch extra_specs.

      - query (kwargs) – Optional query parameters to be sent to limit the flavors being returned.

    Returns:

      A generator of flavor objects

  flavor_add_tenant_access(flavor, tenant)

    Adds tenant/project access to flavor.

    Parameters:

      - flavor – Either the ID of a flavor or a `Flavor` instance.

      - tenant (str) – The UUID of the tenant.

    Returns:

      One `Flavor`

  flavor_remove_tenant_access(flavor, tenant)

    Removes tenant/project access to flavor.

    Parameters:

      - flavor – Either the ID of a flavor or a `Flavor` instance.

      - tenant (str) – The UUID of the tenant.

    Returns:

      One `Flavor`

  get_flavor_access(flavor)

    Lists tenants who have access to private flavor

    Parameters:

      flavor – Either the ID of a flavor or a `Flavor` instance.

    Returns:

      List of dicts with flavor_id and tenant_id attributes.

  fetch_flavor_extra_specs(flavor)

    Lists Extra Specs of a flavor

    Parameters:

      flavor – Either the ID of a flavor or a `Flavor` instance.

    Returns:

      One `Flavor`

  create_flavor_extra_specs(flavor, extra_specs)

    Lists Extra Specs of a flavor

    Parameters:

      - flavor – Either the ID of a flavor or a `Flavor` instance.

      - extra_specs (dict) – dict of extra specs

    Returns:

      One `Flavor`

  get_flavor_extra_specs_property(flavor, prop)

    Get specific Extra Spec property of a flavor

    Parameters:

      - flavor – Either the ID of a flavor or a `Flavor` instance.

      - prop (str) – Property name.

    Returns:

      String value of the requested property.

  update_flavor_extra_specs_property(flavor, prop, val)

    Update specific Extra Spec property of a flavor

    Parameters:

      - flavor – Either the ID of a flavor or a `Flavor` instance.

      - prop (str) – Property name.

      - val (str) – Property value.

    Returns:

      String value of the requested property.

  delete_flavor_extra_specs_property(flavor, prop)

    Delete specific Extra Spec property of a flavor

    Parameters:

      - flavor – Either the ID of a flavor or a `Flavor` instance.

      - prop (str) – Property name.

    Returns:

      None

### Service Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  update_service_forced_down(service, host=None, binary=None, forced=True)

    Update service forced_down information

    Parameters:

      - service – Either the ID of a service or a `Service` instance.

      - host (str) – The host where service runs.

      - binary (str) – The name of service.

      - forced (bool) – Whether or not this service was forced down manually by an administrator after the service was fenced.

    Returns:

      Updated service instance

    Return type:

      class: ~openstack.compute.v2.service.Service

  disable_service(service, host=None, binary=None, disabled_reason=None)

    Disable a service

    Parameters:

      - service – Either the ID of a service or a `Service` instance.

      - host (str) – The host where service runs.

      - binary (str) – The name of service.

      - disabled_reason (str) – The reason of force down a service.

    Returns:

      Updated service instance

    Return type:

      class: ~openstack.compute.v2.service.Service

  enable_service(service, host=None, binary=None)

    Enable a service

    Parameters:

      - service – Either the ID of a service or a `Service` instance.

      - host (str) – The host where service runs.

      - binary (str) – The name of service.

    Returns:

      Updated service instance

    Return type:

      class: ~openstack.compute.v2.service.Service

  services(**query)

    Return a generator of service

    Params dict query:

      Query parameters

    Returns:

      A generator of service

    Return type:

      class: ~openstack.compute.v2.service.Service

  find_service(name_or_id, ignore_missing=True, **query)

    Find a service from name or id to get the corresponding info

    Parameters:

      - name_or_id – The name or id of a service

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the resource does not exist. When set to `True`, None will be returned when attempting to find a nonexistent resource.

      - query (dict) – Additional attributes like ‘host’

    Returns:

      One: class:~openstack.compute.v2.service.Service or None

    Raises:

      `NotFoundException` when no resource can be found.

    Raises:

      `DuplicateResource` when multiple resources are found.

  delete_service(service, ignore_missing=True)

    Delete a service

    Parameters:

      - service – The value can be either the ID of a service or a `Service` instance.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the service does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent service.

    Returns:

      `None`

  update_service(service, **attrs)

    Update a service

    Parameters:

      - service – Either the ID of a service or a `Service` instance.

      - attrs – The attributes to update on the service represented by `service`.

    Returns:

      The updated service

    Return type:

      `Service`

### Volume Attachment Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  create_volume_attachment(server, volume=None, **attrs)

    Create a new volume attachment from attributes

    Parameters:

      - server – The value can be either the ID of a server or a `Server` instance that the volume is attached to.

      - volume – The value can be either the ID of a volume or a `Volume` instance.

      - attrs (dict) – Keyword arguments which will be used to create a `VolumeAttachment`, comprised of the properties on the VolumeAttachment class.

    Returns:

      The results of volume attachment creation

    Return type:

      `VolumeAttachment`

  update_volume_attachment(server, volume, volume_id=None, **attrs)

    Update a volume attachment

    Note that the underlying API expects a volume ID, not a volume attachment ID. There is currently no way to update volume attachments by their own ID.

    Parameters:

      - server – The value can be either the ID of a server or a `Server` instance that the volume is attached to.

      - volume – The value can be either the ID of a volume or a `Volume` instance.

      - volume_id – The ID of a volume to swap to. If this is not specified, we will default to not swapping the volume.

      - attrs – The attributes to update on the volume attachment represented by `volume_attachment`.

    Returns:

      `None`

  delete_volume_attachment(server, volume, ignore_missing=True)

    Delete a volume attachment

    Note that the underlying API expects a volume ID, not a volume attachment ID. There is currently no way to delete volume attachments by their own ID.

    Parameters:

      - server – The value can be either the ID of a server or a `Server` instance that the volume is attached to.

      - volume – The value can be the ID of a volume or a `Volume` instance.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the volume attachment does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent volume attachment.

    Returns:

      `None`

  get_volume_attachment(server, volume)

    Get a single volume attachment

    Note that the underlying API expects a volume ID, not a volume attachment ID. There is currently no way to retrieve volume attachments by their own ID.

    Parameters:

      - server – The value can be either the ID of a server or a `Server` instance that the volume is attached to.

      - volume – The value can be the ID of a volume or a `Volume` instance.

    Returns:

      One `VolumeAttachment`

    Raises:

      `NotFoundException` when no resource can be found.

  volume_attachments(server, **query)

    Return a generator of volume attachments

    Parameters:

      server – The server can be either the ID of a server or a `Server`.

    Params dict query:

      Query parameters

    Returns:

      A generator of VolumeAttachment objects

    Return type:

      `VolumeAttachment`

### Keypair Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  create_keypair(**attrs)

    Create a new keypair from attributes

    Parameters:

      attrs (dict) – Keyword arguments which will be used to create a `Keypair`, comprised of the properties on the Keypair class.

    Returns:

      The results of keypair creation

    Return type:

      `Keypair`

  delete_keypair(keypair, ignore_missing=True, user_id=None)

    Delete a keypair

    Parameters:

      - keypair – The value can be either the ID of a keypair or a `Keypair` instance.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the keypair does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent keypair.

      - user_id (str) – Optional user_id owning the keypair

    Returns:

      `None`

  get_keypair(keypair, user_id=None)

    Get a single keypair

    Parameters:

      - keypair – The value can be the ID of a keypair or a `Keypair` instance.

      - user_id (str) – Optional user_id owning the keypair

    Returns:

      One `Keypair`

    Raises:

      `NotFoundException` when no resource can be found.

  find_keypair(name_or_id, ignore_missing=True, *, user_id=None)

    Find a single keypair

    Parameters:

      - name_or_id – The name or ID of a keypair.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the resource does not exist. When set to `True`, None will be returned when attempting to find a nonexistent resource.

      - user_id (str) – Optional user_id owning the keypair

    Returns:

      One `Keypair` or None

    Raises:

      `NotFoundException` when no resource can be found.

    Raises:

      `DuplicateResource` when multiple resources are found.

  keypairs(**query)

    Return a generator of keypairs

    Parameters:

      query (kwargs) – Optional query parameters to be sent to limit the resources being returned.

    Returns:

      A generator of keypair objects

    Return type:

      `Keypair`

### Server IPs

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  server_ips(server, network_label=None)

    Return a generator of server IPs

    Parameters:

      - server – The server can be either the ID of a server or a `Server`.

      - network_label – The name of a particular network to list IP addresses from.

    Returns:

      A generator of ServerIP objects

    Return type:

      `ServerIP`

### Server Group Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  create_server_group(**attrs)

    Create a new server group from attributes

    Parameters:

      attrs (dict) – Keyword arguments which will be used to create a `ServerGroup`, comprised of the properties on the ServerGroup class.

    Returns:

      The results of server group creation

    Return type:

      `ServerGroup`

  delete_server_group(server_group, ignore_missing=True)

    Delete a server group

    Parameters:

      - server_group – The value can be either the ID of a server group or a `ServerGroup` instance.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the server group does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent server group.

    Returns:

      `None`

  find_server_group(name_or_id, ignore_missing=True, *, all_projects=False)

    Find a single server group

    Parameters:

      - name_or_id – The name or ID of a server group.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the resource does not exist. When set to `True`, None will be returned when attempting to find a nonexistent resource.

      - all_projects (bool) – When set to `True`, search for server groups by name across all projects. Note that this will likely result in a higher chance of duplicates. Admin-only by default.

    Returns:

      One `ServerGroup` or None

    Raises:

      `NotFoundException` when no resource can be found.

    Raises:

      `DuplicateResource` when multiple resources are found.

  get_server_group(server_group)

    Get a single server group

    Parameters:

      server_group – The value can be the ID of a server group or a `ServerGroup` instance.

    Returns:

      A `ServerGroup` object.

    Raises:

      `NotFoundException` when no resource can be found.

  server_groups(*, all_projects=False, **query)

    Return a generator of server groups

    Parameters:

      - all_projects (bool) – When set to `True`, lists servers groups from all projects. Admin-only by default.

      - query (kwargs) – Optional query parameters to be sent to limit the resources being returned.

    Returns:

      A generator of ServerGroup objects

    Return type:

      `ServerGroup`

### Server Interface Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  create_server_interface(server, **attrs)

    Create a new server interface from attributes

    Parameters:

      - server – The server can be either the ID of a server or a `Server` instance that the interface belongs to.

      - attrs (dict) – Keyword arguments which will be used to create a `ServerInterface`, comprised of the properties on the ServerInterface class.

    Returns:

      The results of server interface creation

    Return type:

      `ServerInterface`

  delete_server_interface(server_interface, server=None, ignore_missing=True)

    Delete a server interface

    Parameters:

      - server_interface – The value can be either the ID of a server interface or a `ServerInterface` instance.

      - server – This parameter need to be specified when ServerInterface ID is given as value. It can be either the ID of a server or a `Server` instance that the interface belongs to.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the server interface does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent server interface.

    Returns:

      `None`

  get_server_interface(server_interface, server=None)

    Get a single server interface

    Parameters:

      - server_interface – The value can be the ID of a server interface or a `ServerInterface` instance.

      - server – This parameter need to be specified when ServerInterface ID is given as value. It can be either the ID of a server or a `Server` instance that the interface belongs to.

    Returns:

      One `ServerInterface`

    Raises:

      `NotFoundException` when no resource can be found.

  server_interfaces(server, **query)

    Return a generator of server interfaces

    Parameters:

      - server – The server can be either the ID of a server or a `Server`.

      - query – Optional query parameters to be sent to limit the resources being returned.

    Returns:

      A generator of ServerInterface objects

    Return type:

      `ServerInterface`

### Server Tag Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  add_tag_to_server(server, tag)

    Add a tag to a server.

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - tag – The tag to add.

    Returns:

      None

  remove_tag_from_server(server, tag)

    Remove a tag from a server.

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - tag – The tag to remove.

    Returns:

      None

  remove_tags_from_server(server)

    Remove all tags from a server.

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - tag – The tag to remove.

    Returns:

      None

### Availability Zone Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  availability_zones(details=False)

    Return a generator of availability zones

    Parameters:

      details (bool) – Return extra details about the availability zones. This defaults to False as it generally requires extra permission.

    Returns:

      A generator of availability zone

    Return type:

      `AvailabilityZone`

### Limits Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  get_limits(**query)

    Retrieve limits that are applied to the project’s account

    Returns:

      A Limits object, including both `AbsoluteLimits` and `RateLimits`

    Return type:

      `Limits`

### Hypervisor Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  hypervisors(details=False, **query)

    Return a generator of hypervisors

    Parameters:

      - details (bool) – When set to the default, `False`, `Hypervisor` instances will be returned with only basic information populated.

      - query (kwargs) – Optional query parameters to be sent to limit the resources being returned.

    Returns:

      A generator of hypervisor

    Return type:

      class: ~openstack.compute.v2.hypervisor.Hypervisor

  find_hypervisor(name_or_id, ignore_missing=True, *, details=True)

    Find a single hypervisor

    Parameters:

      - name_or_id – The name or ID of a hypervisor

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the resource does not exist. When set to `True`, None will be returned when attempting to find a nonexistent resource.

      - details (bool) – When set to `False` instances with only basic data will be returned. The default, `True`, will cause instances with full data to be returned.

    Returns:

      One: class:~openstack.compute.v2.hypervisor.Hypervisor or None

    Raises:

      `NotFoundException` when no resource can be found.

    Raises:

      `DuplicateResource` when multiple resources are found.

  get_hypervisor(hypervisor)

    Get a single hypervisor

    Parameters:

      hypervisor – The value can be the ID of a hypervisor or a `Hypervisor` instance.

    Returns:

      A `Hypervisor` object.

    Raises:

      `NotFoundException` when no resource can be found.

  get_hypervisor_uptime(hypervisor)

    Get uptime information for hypervisor

    Parameters:

      hypervisor – The value can be the ID of a hypervisor or a `Hypervisor` instance.

    Returns:

      A `Hypervisor` object.

    Raises:

      `NotFoundException` when no resource can be found.

### Extension Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  find_extension(name_or_id, ignore_missing=True)

    Find a single extension

    Parameters:

      - name_or_id – The name or ID of an extension.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the resource does not exist. When set to `True`, None will be returned when attempting to find a nonexistent resource.

    Returns:

      One `Extension` or None

    Raises:

      `NotFoundException` when no resource can be found.

    Raises:

      `DuplicateResource` when multiple resources are found.

  extensions()

    Retrieve a generator of extensions

    Returns:

      A generator of extension instances.

    Return type:

      `Extension`

### QuotaClassSet Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  get_quota_class_set(quota_class_set='default')

    Get a single quota class set

    Only one quota class is permitted, `default`.

    Parameters:

      quota_class_set – The value can be the ID of a quota class set (only `default` is supported) or a `QuotaClassSet` instance.

    Returns:

      One `QuotaClassSet`

    Raises:

      `NotFoundException` when no resource can be found.

  update_quota_class_set(quota_class_set, **attrs)

    Update a QuotaClassSet.

    Only one quota class is permitted, `default`.

    Parameters:

      - quota_class_set – Either the ID of a quota class set (only `default` is supported) or a `QuotaClassSet` instance.

      - attrs – The attributes to update on the QuotaClassSet represented by `quota_class_set`.

    Returns:

      The updated QuotaSet

    Return type:

      `QuotaSet`

### QuotaSet Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  get_quota_set(project, usage=False, **query)

    Show QuotaSet information for the project.

    Parameters:

      - project – ID or instance of `Project` of the project for which the quota should be retrieved

      - usage (bool) – When set to `True` quota usage and reservations would be filled.

      - query (dict) – Additional query parameters to use.

    Returns:

      One `QuotaSet`

    Raises:

      `NotFoundException` when no resource can be found.

  get_quota_set_defaults(project)

    Show QuotaSet defaults for the project.

    Parameters:

      project – ID or instance of `Project` of the project for which the quota should be retrieved

    Returns:

      One `QuotaSet`

    Raises:

      `NotFoundException` when no resource can be found.

  revert_quota_set(project, **query)

    Reset Quota for the project/user.

    Parameters:

      - project – ID or instance of `Project` of the project for which the quota should be reset.

      - query (dict) – Additional parameters to be used.

    Returns:

      `None`

  update_quota_set(project, *, user=None, **attrs)

    Update a QuotaSet.

    Parameters:

      - project – ID or instance of `Project` of the project for which the quota should be reset.

      - user_id – Optional ID of the user to set quotas as.

      - attrs – The attributes to update on the QuotaSet represented by `quota_set`.

    Returns:

      The updated QuotaSet

    Return type:

      `QuotaSet`

### Server Migration Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  abort_server_migration(server_migration, server, ignore_missing=True)

    Abort an in-progress server migration

    Parameters:

      - server_migration – The value can be either the ID of a server migration or a `ServerMigration` instance.

      - server – This parameter needs to be specified when ServerMigration ID is given as value. It can be either the ID of a server or a `Server` instance that the migration belongs to.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the server migration does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent server migration.

    Returns:

      `None`

  force_complete_server_migration(server_migration, server=None)

    Force complete an in-progress server migration

    Parameters:

      - server_migration – The value can be either the ID of a server migration or a `ServerMigration` instance.

      - server – This parameter needs to be specified when ServerMigration ID is given as value. It can be either the ID of a server or a `Server` instance that the migration belongs to.

    Returns:

      `None`

  get_server_migration(server_migration, server, ignore_missing=True)

    Get a single server migration

    Parameters:

      - server_migration – The value can be the ID of a server migration or a `ServerMigration` instance.

      - server – This parameter need to be specified when ServerMigration ID is given as value. It can be either the ID of a server or a `Server` instance that the migration belongs to.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the server migration does not exist. When set to `True`, no exception will be set when attempting to delete a nonexistent server migration.

    Returns:

      One `ServerMigration`

    Raises:

      `NotFoundException` when no resource can be found.

  server_migrations(server)

    Return a generator of migrations for a server.

    Parameters:

      server – The server can be either the ID of a server or a `Server`.

    Returns:

      A generator of ServerMigration objects

    Return type:

      `ServerMigration`

### Migration Operations

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  migrations(**query)

    Return a generator of migrations for all servers.

    Parameters:

      query (kwargs) – Optional query parameters to be sent to limit the migrations being returned.

    Returns:

      A generator of Migration objects

    Return type:

      `Migration`

### Interactive Consoles

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  create_server_remote_console(server, **attrs)

    Create a remote console on the server.

    Parameters:

      server – Either the ID of a server or a `Server` instance.

    Returns:

      One `ServerRemoteConsole`

  get_server_console_url(server, console_type)

    Create a remote console on the server.

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - console_type – Type of the console connection.

    Returns:

      Dictionary with console type and url

  validate_console_auth_token(console_token)

    Lookup console connection information for a console auth token.

    Parameters:

      console_token – The console auth token as returned in the URL from get_server_console_url.

    Returns:

      Dictionary with connection details, varying by console type.

  get_server_console_output(server, length=None)

    Return the console output for a server.

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - length – Optional number of line to fetch from the end of console log. All lines will be returned if this is not specified.

    Returns:

      The console output as a dict. Control characters will be escaped to create a valid JSON string.

  create_console(server, console_type, console_protocol=None)

    Create a remote console on the server.

    When microversion supported is higher then 2.6 remote console is created, otherwise deprecated call to get server console is issued.

    Parameters:

      - server – Either the ID of a server or a `Server` instance.

      - console_type – Type of the remote console. Supported values as: * novnc * spice-html5 * rdp-html5 * serial * webmks (supported after 2.8) * spice-direct (supported after 2.99)

      - console_protocol – Optional console protocol (is respected only after microversion 2.6).

    Returns:

      Dictionary with console type, connection details (a url), and optionally protocol.

### Helpers

class openstack.compute.v2._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
  wait_for_delete(res, interval=2, wait=120, callback=None)

    Wait for a resource to be deleted.

    Parameters:

      - res – The resource to wait on to be deleted.

      - interval – Number of seconds to wait before to consecutive checks.

      - wait – Maximum number of seconds to wait before the change.

      - callback – A callback function. This will be called with a single value, progress, which is a percentage value from 0-100.

    Returns:

      The resource is returned on success.

    Raises:

      `ResourceTimeout` if transition to delete failed to occur in the specified seconds.

this page last updated: 2026-01-16 23:06:19

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