openstack.compute.v2.server

The Server Class

The Server class inherits from Resource.

class openstack.compute.v2.server.Server(attrs=None, loaded=False)

Construct a Resource to interact with a service’s REST API.

The Resource class offers two class methods to construct resource objects, which are preferrable to entering through this initializer. See Resource.new() and Resource.existing().

Parameters:
  • attrs (dict) – The attributes to set when constructing this Resource.
  • loaded (bool) – True if this Resource exists on the server, False if it does not.
addresses = None

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

created_at = None

Timestamp of when the server was created.

flavor_id = None

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

host_id = None

An ID representing the host of this server.

image_id = None

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

A list of dictionaries holding links relevant to this server.

metadata = None

Metadata stored for this server. Type: dict

name = None

The name of this server.

progress = None

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

project_id = None

The ID of the project this server is associated with.

status = None

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.

updated_at = None

Timestamp of when this server was last updated.

user_id = None

The user ID associated with this server.

action(session, body)

Preform server actions given the message body.

change_password(session, new_password)

Change the administrator password to the given password.

reboot(session, reboot_type)

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

rebuild(session, name, image_href, admin_password, access_ipv4=None, access_ipv6=None, metadata=None, personality=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.

get_floating_ips()

Get the floating ips associated with this server.