openstack.compute.v2.server

openstack.compute.v2.server

The Server Class

The Server class inherits from Resource.

class openstack.compute.v2.server.Server(_synchronized=False, connection=None, **attrs)

The base resource

Parameters
  • _synchronized (bool) – This is not intended to be used directly. See new() and existing().

  • connection (openstack.connection.Connection) – Reference to the Connection being used. Defaults to None to allow Resource objects to be used without an active Connection, such as in unit tests. Use of self._connection in Resource code should protect itself with a check for None.

A list of dictionaries holding links relevant to this server.

addresses

A dictionary of addresses this server can be accessed through. The dictionary contains keys such as private and public, each containing a list of dictionaries for addresses of that type. The addresses are contained in a dictionary with keys addr and version, which is either 4 or 6 depending on the protocol of the IP address. Type: dict

admin_password

When a server is first created, it provides the administrator password.

attached_volumes

A list of an attached volumes. Each item in the list contains at least an “id” key to identify the specific volumes.

availability_zone

The name of the availability zone this server is a part of.

block_device_mapping

Enables fine grained control of the block device mapping for an instance. This is typically used for booting servers from volumes.

config_drive

Indicates whether or not a config drive was used for this server.

compute_host

The name of the compute host on which this instance is running. Appears in the response for administrative users only.

created_at

Timestamp of when the server was created.

description

The description of the server. Before microversion 2.19 this was set to the server name.

disk_config

The disk configuration. Either AUTO or MANUAL.

flavor_id

The flavor reference, as a ID or full URL, for the flavor to use for this server.

flavor

The flavor property as returned from server.

has_config_drive

Indicates whether a configuration drive enables metadata injection. Not all cloud providers enable this feature.

host_id

An ID representing the host of this server.

host_status

The host status.

hostname

The hostname set on the instance when it is booted. By default, it appears in the response for administrative users only.

hypervisor_hostname

The hypervisor host name. Appears in the response for administrative users only.

image_id

The image reference, as a ID or full URL, for the image to use for this server.

image

The image property as returned from server.

instance_name

The instance name. The Compute API generates the instance name from the instance name template. Appears in the response for administrative users only.

interface_ip

The address to use to connect to this server from the current calling context. This will be set to public_ipv6 if the calling host has routable ipv6 addresses, and to private_ipv4 if the Connection was created with private=True. Otherwise it will be set to public_ipv4.

kernel_id

The UUID of the kernel image when using an AMI. Will be null if not. By default, it appears in the response for administrative users only.

key_name

The name of an associated keypair

launch_index

When servers are launched via multiple create, this is the sequence in which the servers were launched. By default, it appears in the response for administrative users only.

launched_at

The timestamp when the server was launched.

max_count

The maximum number of servers to create.

min_count

The minimum number of servers to create.

networks

A networks object. Required parameter when there are multiple networks defined for the tenant. When you do not specify the networks parameter, the server attaches to the only network created for the current tenant.

power_state

The power state of this server.

progress

While the server is building, this value represents the percentage of completion. Once it is completed, it will be 100. Type: int

project_id

The ID of the project this server is associated with.

private_v4

The private IPv4 address of this server

private_v6

The private IPv6 address of this server

public_v4

The public IPv4 address of this server

public_v6

The public IPv6 address of this server

ramdisk_id

The UUID of the ramdisk image when using an AMI. Will be null if not. By default, it appears in the response for administrative users only.

reservation_id

The reservation id for the server. This is an id that can be useful in tracking groups of servers created with multiple create, that will all have the same reservation_id. By default, it appears in the response for administrative users only.

root_device_name

The root device name for the instance By default, it appears in the response for administrative users only.

scheduler_hints

The dictionary of data to send to the scheduler.

security_groups

A list of applicable security groups. Each group contains keys for description, name, id, and rules.

server_groups

The UUIDs of the server groups to which the server belongs. Currently this can contain at most one entry.

status

The state this server is in. Valid values include ACTIVE, BUILDING, DELETED, ERROR, HARD_REBOOT, PASSWORD, PAUSED, REBOOT, REBUILD, RESCUED, RESIZED, REVERT_RESIZE, SHUTOFF, SOFT_DELETED, STOPPED, SUSPENDED, UNKNOWN, or VERIFY_RESIZE.

task_state

The task state of this server.

terminated_at

The timestamp when the server was terminated (if it has been).

trusted_image_certificates

A list of trusted certificate IDs, that were used during image signature verification to verify the signing certificate.

updated_at

Timestamp of when this server was last updated.

user_data

Configuration information or scripts to use upon launch. Must be Base64 encoded.

user_id

The ID of the owners of this server.

vm_state

The VM state of this server.

change_password(session, new_password)

Change the administrator password to the given password.

get_password(session)

Get the encrypted administrator password.

reboot(session, reboot_type)

Reboot server where reboot_type might be ‘SOFT’ or ‘HARD’.

force_delete(session)

Force delete a server.

rebuild(session, image, name=None, admin_password=None, preserve_ephemeral=None, access_ipv4=None, access_ipv6=None, metadata=None, user_data=None)

Rebuild the server with the given arguments.

resize(session, flavor)

Resize server to flavor reference.

confirm_resize(session)

Confirm the resize of the server.

revert_resize(session)

Revert the resize of the server.

create_image(session, name, metadata=None)

Create image from server.

fetch_security_groups(session)

Fetch security groups of a server.

Returns

Updated Server instance.

Creative Commons Attribution 3.0 License

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