novaclient.v2.servers
Module¶Server interface.
novaclient.v2.servers.
NetworkInterface
(manager, info, loaded=False, resp=None)¶Bases: novaclient.base.Resource
Populate and bind to a manager.
Parameters: |
|
---|
id
¶novaclient.v2.servers.
SecurityGroup
(manager, info, loaded=False, resp=None)¶Bases: novaclient.base.Resource
Populate and bind to a manager.
Parameters: |
|
---|
novaclient.v2.servers.
Server
(manager, info, loaded=False, resp=None)¶Bases: novaclient.base.Resource
Populate and bind to a manager.
Parameters: |
|
---|
HUMAN_ID
= True¶add_security_group
(security_group)¶Add a security group to an instance.
Parameters: | security_group – The name of security group to add |
---|---|
Returns: | An instance of novaclient.base.DictWithMeta |
add_tag
(obj, *args, **kwargs)¶Add single tag to an instance.
backup
(backup_name, backup_type, rotation)¶Backup a server instance.
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
change_password
(password)¶Update the admin password for a server.
Parameters: | password – string to set as the admin password on the server |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
clear_password
()¶Get password for a Server.
confirm_resize
()¶Confirm that the resize worked, thus removing the original server.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
create_image
(image_name, metadata=None)¶Create an image based on this server.
Parameters: |
|
---|
delete
()¶Delete (i.e. shut down and delete the image) this server.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
Remove all tags from an instance.
delete_tag
(obj, *args, **kwargs)¶Remove single tag from an instance.
diagnostics
()¶Diagnostics – Retrieve server diagnostics.
evacuate
(obj, *args, **kwargs)¶Evacuate an instance from failed host to specified host.
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
force_delete
()¶Force delete – Force delete a server.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
get_console_output
(length=None)¶Get text console log output from Server.
Parameters: | length – The number of lines you would like to retrieve (as int) |
---|
get_console_url
(console_type)¶Retrieve a console of a particular protocol and console_type
Parameters: | console_type – Type of console |
---|
get_mks_console
()¶Get mks console for a Server.
get_password
(private_key=None)¶Get password for a Server.
Returns the clear password of an instance if private_key is provided, returns the ciphered password otherwise.
Parameters: | private_key – Path to private key file for decryption (optional) |
---|
get_rdp_console
(console_type)¶Get rdp console for a Server.
Parameters: | console_type – Type of console (‘rdp-html5’) |
---|
get_serial_console
(console_type)¶Get serial console for a Server.
Parameters: | console_type – Type of console (‘serial’) |
---|
get_spice_console
(console_type)¶Get spice console for a Server.
Parameters: | console_type – Type of console (‘spice-html5’) |
---|
get_vnc_console
(console_type)¶Get vnc console for a Server.
Parameters: | console_type – Type of console (‘novnc’ or ‘xvpvnc’) |
---|
interface_attach
(obj, *args, **kwargs)¶Attach a network interface to an instance with an optional tag.
interface_detach
(port_id)¶Detach a network interface from an instance.
interface_list
()¶List interfaces attached to an instance.
list_security_group
()¶List security group(s) of an instance.
live_migrate
(obj, *args, **kwargs)¶Migrates a running instance to a new machine.
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
lock
()¶Lock – Lock the instance from certain operations.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
migrate
(obj, *args, **kwargs)¶Migrate a server to a new host.
Parameters: | host – (Optional) The target host. |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
networks
¶Generate a simplified list of addresses
pause
()¶Pause – Pause the running server.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
reboot
(reboot_type='SOFT')¶Reboot the server.
Parameters: | reboot_type – either REBOOT_SOFT for a software-level
reboot, or REBOOT_HARD for a virtual power cycle hard reboot. |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
rebuild
(image, password=None, preserve_ephemeral=False, **kwargs)¶Rebuild – shut down and then re-image – this server.
Parameters: |
|
---|
remove_security_group
(security_group)¶Remove a security group from an instance.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
rescue
(password=None, image=None)¶Rescue – Rescue the problematic server.
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
reset_network
()¶Reset network of an instance.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
reset_state
(state='error')¶Reset the state of an instance to active or error.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
resize
(flavor, **kwargs)¶Resize the server’s resources.
Parameters: | flavor – the Flavor (or its ID) to resize to. |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
Until a resize event is confirmed with confirm_resize()
, the old
server will be kept around and you’ll be able to roll back to the old
flavor quickly with revert_resize()
. All resizes are
automatically confirmed after 24 hours.
restore
()¶Restore – Restore a server in ‘soft-deleted’ state.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
resume
()¶Resume – Resume the suspended server.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
revert_resize
()¶Revert a previous resize, switching back to the old server.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
Set list of tags to an instance.
shelve
()¶Shelve – Shelve the server.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
shelve_offload
()¶Shelve_offload – Remove a shelved server from the compute node.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
start
()¶Start – Start the paused server.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
stop
()¶Stop – Stop the running server.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
suspend
()¶Suspend – Suspend the running server.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
tag_list
(obj, *args, **kwargs)¶Get list of tags from an instance.
trigger_crash_dump
()¶Trigger crash dump in an instance
unlock
()¶Unlock – Remove instance lock.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
unpause
()¶Unpause – Unpause the paused server.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
unrescue
()¶Unrescue – Unrescue the rescued server.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
unshelve
()¶Unshelve – Unshelve the server.
Returns: | An instance of novaclient.base.TupleWithMeta |
---|
novaclient.v2.servers.
ServerManager
(api)¶Bases: novaclient.base.BootingManagerWithFind
add_security_group
(server, security_group)¶Add a Security Group to an instance
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.DictWithMeta |
add_tag
(obj, *args, **kwargs)¶Add single tag to an instance.
backup
(server, backup_name, backup_type, rotation)¶Backup a server instance.
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta if the request microversion is < 2.45, otherwise novaclient.base.DictWithMeta. |
change_password
(server, password)¶Update the password for a server.
Parameters: | server – The Server (or its ID) for which the admin
password is to be changed |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
clear_password
(server)¶Clear the admin password of an instance
Remove the admin password for an instance from the metadata server.
Parameters: | server – The Server (or its ID) for which the admin
password is to be cleared |
---|
confirm_resize
(server)¶Confirm that the resize worked, thus removing the original server.
Parameters: | server – The Server (or its ID) to share onto. |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
create
(name, image, flavor, meta=None, files=None, reservation_id=False, min_count=None, max_count=None, security_groups=None, userdata=None, key_name=None, availability_zone=None, block_device_mapping=None, block_device_mapping_v2=None, nics=None, scheduler_hints=None, config_drive=None, disk_config=None, admin_pass=None, access_ip_v4=None, access_ip_v6=None, **kwargs)¶Create (boot) a new server.
Parameters: |
|
---|
create_image
(server, image_name, metadata=None)¶Snapshot a server.
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.StrWithMeta (The snapshot image’s UUID) |
delete
(server)¶Delete (i.e. shut down and delete the image) this server.
Parameters: | server – The Server (or its ID) to delete |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
Remove all tags from an instance.
delete_meta
(server, keys)¶Delete metadata from a server
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
delete_tag
(obj, *args, **kwargs)¶Remove single tag from an instance.
diagnostics
(server)¶Retrieve server diagnostics.
Parameters: | server – The Server (or its ID) for which
diagnostics to be returned |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
evacuate
(obj, *args, **kwargs)¶Evacuate a server instance.
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
force_delete
(server)¶Force delete the server.
Parameters: | server – The Server (or its ID) to force delete |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
get_console_output
(server, length=None)¶Get text console log output from Server.
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.StrWithMeta or novaclient.base.UnicodeWithMeta |
get_console_url
(obj, *args, **kwargs)¶Retrieve a console url of a server.
Parameters: |
|
---|
get_mks_console
(obj, *args, **kwargs)¶Get a mks console for an instance
Parameters: | server – The Server (or its ID) to get console for. |
---|---|
Returns: | An instance of novaclient.base.DictWithMeta |
get_password
(server, private_key=None)¶Get admin password of an instance
Returns the admin password of an instance in the clear if private_key is provided, returns the ciphered password otherwise.
Requires that openssl is installed and in the path
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.StrWithMeta or novaclient.base.BytesWithMeta or novaclient.base.UnicodeWithMeta |
get_rdp_console
(server, console_type)¶Get a rdp console for an instance
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.DictWithMeta |
get_serial_console
(server, console_type)¶Get a serial console for an instance
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.DictWithMeta |
get_spice_console
(server, console_type)¶Get a spice console for an instance
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.DictWithMeta |
get_vnc_console
(server, console_type)¶Get a vnc console for an instance
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.DictWithMeta |
interface_attach
(obj, *args, **kwargs)¶Attach a network_interface to an instance.
Parameters: |
|
---|
interface_detach
(server, port_id)¶Detach a network_interface from an instance.
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
interface_list
(server)¶List attached network interfaces
Parameters: | server – The Server (or its ID) to query. |
---|
ips
(server)¶Return IP Addresses associated with the server.
Often a cheaper call then getting all the details for a server.
Parameters: | server – The Server (or its ID) for which
the IP adresses are to be returned |
---|---|
Returns: | An instance of novaclient.base.DictWithMeta |
list
(detailed=True, search_opts=None, marker=None, limit=None, sort_keys=None, sort_dirs=None)¶Get a list of servers.
Parameters: |
|
---|---|
Return type: | list of |
Examples:
client.servers.list() - returns detailed list of servers
client.servers.list(search_opts={‘status’: ‘ERROR’}) - returns list of servers in error state.
client.servers.list(limit=10) - returns only 10 servers
list_security_group
(server)¶List Security Group(s) of an instance
Parameters: | server – ID of the instance. |
---|
live_migrate
(obj, *args, **kwargs)¶Migrates a running instance to a new machine.
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
lock
(server)¶Lock the server.
Parameters: | server – The Server (or its ID) to lock |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
migrate
(obj, *args, **kwargs)¶Migrate a server to a new host.
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
pause
(server)¶Pause the server.
Parameters: | server – The Server (or its ID) to pause |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
reboot
(server, reboot_type='SOFT')¶Reboot a server.
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
rebuild
(server, image, password=None, disk_config=None, preserve_ephemeral=False, name=None, meta=None, files=None, **kwargs)¶Rebuild – shut down and then re-image – a server.
Parameters: |
|
---|---|
Returns: |
remove_security_group
(server, security_group)¶Remove a Security Group to an instance
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
rescue
(server, password=None, image=None)¶Rescue the server.
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
reset_network
(server)¶Reset network of an instance.
Parameters: | server – The Server for network is to be reset |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
reset_state
(server, state='error')¶Reset the state of an instance to active or error.
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
resize
(server, flavor, disk_config=None, **kwargs)¶Resize a server’s resources.
Parameters: |
|
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
Until a resize event is confirmed with confirm_resize()
, the old
server will be kept around and you’ll be able to roll back to the old
flavor quickly with revert_resize()
. All resizes are
automatically confirmed after 24 hours.
restore
(server)¶Restore soft-deleted server.
Parameters: | server – The Server (or its ID) to restore |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
resume
(server)¶Resume the server.
Parameters: | server – The Server (or its ID) to resume |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
revert_resize
(server)¶Revert a previous resize, switching back to the old server.
Parameters: | server – The Server (or its ID) to share onto. |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
set_meta
(server, metadata)¶Set a server’s metadata
:param server: The Server
to add metadata to
:param metadata: A dict of metadata to be added to the server
set_meta_item
(server, key, value)¶Updates an item of server metadata
:param server: The Server
to add metadata to
:param key: metadata key to update
:param value: string value
Set list of tags to an instance.
shelve
(server)¶Shelve the server.
Parameters: | server – The Server (or its ID) to shelve |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
shelve_offload
(server)¶Remove a shelved instance from the compute node.
Parameters: | server – The Server (or its ID) to shelve offload |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
start
(server)¶Start the server.
Parameters: | server – The Server (or its ID) to start |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
stop
(server)¶Stop the server.
Parameters: | server – The Server (or its ID) to stop |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
suspend
(server)¶Suspend the server.
Parameters: | server – The Server (or its ID) to suspend |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
tag_list
(obj, *args, **kwargs)¶Get list of tags from an instance.
transform_userdata
(userdata)¶trigger_crash_dump
(obj, *args, **kwargs)¶Trigger crash dump in an instance
unlock
(server)¶Unlock the server.
Parameters: | server – The Server (or its ID) to unlock |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
unpause
(server)¶Unpause the server.
Parameters: | server – The Server (or its ID) to unpause |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
unrescue
(server)¶Unrescue the server.
Parameters: | server – The Server (or its ID) to unrescue |
---|---|
Returns: | An instance of novaclient.base.TupleWithMeta |
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.