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.
ips(session)

Get server IPs.

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.

wait_for_status(session, status='ACTIVE', failures=None, interval=5, wait=120)

Wait for the server to be in some status.

Parameters:
  • session (Session) – The session to use for making this request.
  • status – Desired status of the server.
  • failures (list) – Statuses that would indicate the transition failed such as ‘ERROR’.
  • interval – Number of seconds to wait between checks.
  • wait – Maximum number of seconds to wait for transition.
Returns:

Method returns self on success.

Raises:

ResourceTimeout transition to status failed to occur in wait seconds.

Raises:

ResourceFailure resource transitioned to one of the failure states.

get_floating_ips()

Get the floating ips associated with this server.

Table Of Contents

Previous topic

openstack.compute.v2.limits_rate

Next topic

openstack.compute.v2.server_interface

This Page