ServersΒΆ

Server interface.

class novaclient.v3.servers.Server(manager, info, loaded=False)

Bases: novaclient.openstack.common.apiclient.base.Resource

Server.HUMAN_ID = True
Server.add_fixed_ip(network_id)

Add an IP address on a network.

Parameters:network_id – The ID of the network the IP should be on.
Server.backup(backup_name, backup_type, rotation)

Backup a server instance.

Parameters:
  • backup_name – Name of the backup image
  • backup_type – The backup type, like ‘daily’ or ‘weekly’
  • rotation – Int parameter representing how many backups to keep around.
Server.change_password(password)

Update the password for a server.

Server.clear_password()

Get password for a Server.

Server.confirm_resize()

Confirm that the resize worked, thus removing the original server.

Server.create_image(image_name, metadata=None)

Create an image based on this server.

Parameters:
  • image_name – The name to assign the newly create image.
  • metadata – Metadata to assign to the image.
Server.delete()

Delete (i.e. shut down and delete the image) this server.

Server.diagnostics()

Diagnostics – Retrieve server diagnostics.

Server.evacuate(host, on_shared_storage, password=None)

Evacuate an instance from failed host to specified host.

Parameters:
  • host – Name of the target host
  • on_shared_storage – Specifies whether instance files located on shared storage
  • password – string to set as password on the evacuated server.
Server.force_delete()

Force delete – Force delete a server.

Server.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)
Server.get_password(private_key)

Get password for a Server.

Parameters:private_key – Path to private key file for decryption
Server.get_spice_console(console_type)

Get spice console for a Server.

Parameters:console_type – Type of console (‘spice-html5’)
Server.get_vnc_console(console_type)

Get vnc console for a Server.

Parameters:console_type – Type of console (‘novnc’ or ‘xvpvnc’)
Server.interface_attach(port_id, net_id, fixed_ip)

Attach a network interface to an instance.

Server.interface_detach(port_id)

Detach a network interface from an instance.

Server.interface_list()

List interfaces attached to an instance.

Server.live_migrate(host=None, block_migration=False, disk_over_commit=False)

Migrates a running instance to a new machine.

Server.lock()

Lock – Lock the instance from certain operations.

Server.migrate()

Migrate a server to a new host.

Server.networks

Generate a simplified list of addresses

Server.pause()

Pause – Pause the running server.

Server.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.
Server.rebuild(image, password=None, **kwargs)

Rebuild – shut down and then re-image – this server.

Parameters:
  • image – the Image (or its ID) to re-image with.
  • password – string to set as password on the rebuilt server.
Server.remove_fixed_ip(address)

Remove an IP address.

Parameters:address – The IP address to remove.
Server.remove_floating_ip(address)

Remove floating IP from an instance

Parameters:address – The ip address or FloatingIP to remove
Server.rescue()

Rescue – Rescue the problematic server.

Server.reset_network()

Reset network of an instance.

Server.reset_state(state='error')

Reset the state of an instance to active or error.

Server.resize(flavor, **kwargs)

Resize the server’s resources.

Parameters:flavor – the Flavor (or its ID) to resize to.

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.

Server.restore()

Restore – Restore a server in ‘soft-deleted’ state.

Server.resume()

Resume – Resume the suspended server.

Server.revert_resize()

Revert a previous resize, switching back to the old server.

Server.shelve()

Shelve – Shelve the server.

Server.shelve_offload()

Shelve_offload – Remove a shelved server from the compute node.

Server.start()

Start – Start the paused server.

Server.stop()

Stop – Stop the running server.

Server.suspend()

Suspend – Suspend the running server.

Server.unlock()

Unlock – Remove instance lock.

Server.unpause()

Unpause – Unpause the paused server.

Server.unrescue()

Unrescue – Unrescue the rescued server.

Server.unshelve()

Unshelve – Unshelve the server.

Server.update(name=None)

Update the name or the password for this server.

Parameters:
  • name – Update the server’s name.
  • password – Update the root password.
class novaclient.v3.servers.ServerManager(api)

Bases: novaclient.base.BootingManagerWithFind

ServerManager.add_fixed_ip(server, network_id)

Add an IP address on a network.

Parameters:
  • server – The Server (or its ID) to add an IP to.
  • network_id – The ID of the network the IP should be on.
ServerManager.backup(server, backup_name, backup_type, rotation)

Backup a server instance.

Parameters:
  • server – The Server (or its ID) to share onto.
  • backup_name – Name of the backup image
  • backup_type – The backup type, like ‘daily’ or ‘weekly’
  • rotation – Int parameter representing how many backups to keep around.
ServerManager.change_password(server, password)

Update the password for a server.

ServerManager.clear_password(server)

Clear password for an instance

Parameters:server – The Server (or its ID) to add an IP to.
ServerManager.confirm_resize(server)

Confirm that the resize worked, thus removing the original server.

Parameters:server – The Server (or its ID) to share onto.
ServerManager.create(name, image, flavor, meta=None, files=None, reservation_id=None, 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, **kwargs)

Create (boot) a new server.

Parameters:
  • name – Something to name the server.
  • image – The Image to boot with.
  • flavor – The Flavor to boot onto.
  • meta – A dict of arbitrary key/value metadata to store for this server. A maximum of five entries is allowed, and both keys and values must be 255 characters or less.
  • files – A dict of files to overrwrite on the server upon boot. Keys are file names (i.e. /etc/passwd) and values are the file contents (either as a string or as a file-like object). A maximum of five entries is allowed, and each file must be 10k or less.
  • userdata – user data to pass to be exposed by the metadata server this can be a file type object as well or a string.
  • reservation_id – a UUID for the set of servers being requested.
  • key_name – (optional extension) name of previously created keypair to inject into the instance.
  • availability_zone – Name of the availability zone for instance placement.
  • block_device_mapping – (optional extension) A dict of block device mappings for this server.
  • block_device_mapping_v2 – (optional extension) A dict of block device mappings for this server.
  • nics – (optional extension) an ordered list of nics to be added to this server, with information about connected networks, fixed ips, port etc.
  • scheduler_hints – (optional extension) arbitrary key-value pairs specified by the client to help boot an instance
  • config_drive – (optional extension) value for config drive either boolean, or volume-id
ServerManager.create_image(server, image_name, metadata=None)

Snapshot a server.

Parameters:
  • server – The Server (or its ID) to share onto.
  • image_name – Name to give the snapshot image
  • meta – Metadata to give newly-created image entity
ServerManager.delete(server)

Delete (i.e. shut down and delete the image) this server.

ServerManager.delete_meta(server, keys)

Delete metadata from an server :param server: The Server to add metadata to :param keys: A list of metadata keys to delete from the server

ServerManager.diagnostics(server)

Retrieve server diagnostics.

ServerManager.evacuate(server, host, on_shared_storage, password=None)

Evacuate a server instance.

Parameters:
  • server – The Server (or its ID) to share onto.
  • host – Name of the target host.
  • on_shared_storage – Specifies whether instance files located on shared storage
  • password – string to set as password on the evacuated server.
ServerManager.force_delete(server)

Force delete the server.

ServerManager.get(server)

Get a server.

Parameters:server – ID of the Server to get.
Return type:Server
ServerManager.get_console_output(server, length=None)

Get text console log output from Server.

Parameters:
  • server – The Server (or its ID) whose console output you would like to retrieve.
  • length – The number of tail loglines you would like to retrieve.
ServerManager.get_password(server, private_key)

Get password for an instance

Requires that openssl is installed and in the path

Parameters:
  • server – The Server (or its ID) to add an IP to.
  • private_key – The private key to decrypt password
ServerManager.get_spice_console(server, console_type)

Get a spice console for an instance

Parameters:
  • server – The Server (or its ID) to add an IP to.
  • console_type – Type of spice console to get (‘spice-html5’)
ServerManager.get_vnc_console(server, console_type)

Get a vnc console for an instance

Parameters:
  • server – The Server (or its ID) to add an IP to.
  • console_type – Type of vnc console to get (‘novnc’ or ‘xvpvnc’)
ServerManager.interface_attach(server, port_id, net_id, fixed_ip)

Attach a network_interface to an instance.

Parameters:
  • server – The Server (or its ID) to attach to.
  • port_id – The port to attach.
ServerManager.interface_detach(server, port_id)

Detach a network_interface from an instance.

Parameters:
  • server – The Server (or its ID) to detach from.
  • port_id – The port to detach.
ServerManager.interface_list(server)

List attached network interfaces

Parameters:server – The Server (or its ID) to query.
ServerManager.list(detailed=True, search_opts=None, marker=None, limit=None)

Get a list of servers.

Parameters:
  • detailed – Whether to return detailed server info (optional).
  • search_opts – Search options to filter out servers (optional).
  • marker – Begin returning servers that appear later in the server list than that represented by this server id (optional).
  • limit – Maximum number of servers to return (optional).
Return type:

list of Server

ServerManager.live_migrate(server, host, block_migration, disk_over_commit)

Migrates a running instance to a new machine.

Parameters:
  • server – instance id which comes from nova list.
  • host – destination host name.
  • block_migration – if True, do block_migration.
  • disk_over_commit – if True, Allow overcommit.
ServerManager.lock(server)

Lock the server.

ServerManager.migrate(server)

Migrate a server to a new host.

Parameters:server – The Server (or its ID).
ServerManager.pause(server)

Pause the server.

ServerManager.reboot(server, reboot_type='SOFT')

Reboot a server.

Parameters:
  • server – The Server (or its ID) to share onto.
  • reboot_type – either REBOOT_SOFT for a software-level reboot, or REBOOT_HARD for a virtual power cycle hard reboot.
ServerManager.rebuild(server, image, password=None, **kwargs)

Rebuild – shut down and then re-image – a server.

Parameters:
  • server – The Server (or its ID) to share onto.
  • image – the Image (or its ID) to re-image with.
  • password – string to set as password on the rebuilt server.
ServerManager.remove_fixed_ip(server, address)

Remove an IP address.

Parameters:
  • server – The Server (or its ID) to add an IP to.
  • address – The IP address to remove.
ServerManager.rescue(server)

Rescue the server.

ServerManager.reset_network(server)

Reset network of an instance.

ServerManager.reset_state(server, state='error')

Reset the state of an instance to active or error.

Parameters:
  • server – ID of the instance to reset the state of.
  • state – Desired state; either ‘active’ or ‘error’. Defaults to ‘error’.
ServerManager.resize(server, flavor, **kwargs)

Resize a server’s resources.

Parameters:
  • server – The Server (or its ID) to share onto.
  • flavor – the Flavor (or its ID) to resize to.

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.

ServerManager.resource_class

alias of Server

ServerManager.restore(server)

Restore soft-deleted server.

ServerManager.resume(server)

Resume the server.

ServerManager.revert_resize(server)

Revert a previous resize, switching back to the old server.

Parameters:server – The Server (or its ID) to share onto.
ServerManager.set_meta(server, metadata)

Set a servers metadata :param server: The Server to add metadata to :param metadata: A dict of metadata to add to the server

ServerManager.shelve(server)

Shelve the server.

ServerManager.shelve_offload(server)

Remove a shelved instance from the compute node.

ServerManager.start(server)

Start the server.

ServerManager.stop(server)

Stop the server.

ServerManager.suspend(server)

Suspend the server.

ServerManager.unlock(server)

Unlock the server.

ServerManager.unpause(server)

Unpause the server.

ServerManager.unrescue(server)

Unrescue the server.

ServerManager.unshelve(server)

Unshelve the server.

ServerManager.update(server, name=None)

Update the name or the password for a server.

Parameters:
  • server – The Server (or its ID) to update.
  • name – Update the server’s name.

Previous topic

Quotas_classes

Next topic

Services

This Page