libcloud.compute.drivers.libvirt_driver module

class libcloud.compute.drivers.libvirt_driver.LibvirtNodeDriver(uri, key=None, secret=None)[source]

Bases: NodeDriver

Libvirt (http://libvirt.org/) node driver.

To enable debug mode, set LIBVIR_DEBUG environment variable.

Parameters:
  • uri (str) – Hypervisor URI (e.g. vbox:///session, qemu:///system, etc.).

  • key (str) – the username for a remote libvirtd server

  • secret – the password for a remote libvirtd server

NODE_STATE_MAP: Dict[str, NodeState] = {0: NodeState.TERMINATED, 1: NodeState.RUNNING, 2: NodeState.PENDING, 3: NodeState.TERMINATED, 4: NodeState.TERMINATED, 5: NodeState.TERMINATED, 6: NodeState.UNKNOWN, 7: NodeState.UNKNOWN}
destroy_node(node)[source]

Destroy a node.

Depending upon the provider, this may destroy all data associated with the node, including backups.

Parameters:

node (Node) – The node to be destroyed

Returns:

True if the destroy was successful, False otherwise.

Return type:

bool

ex_get_hypervisor_hostname()[source]

Return a system hostname on which the hypervisor is running.

ex_get_hypervisor_sysinfo()[source]

Retrieve hypervisor system information.

Return type:

dict

ex_get_node_by_name(name)[source]

Retrieve Node object for a domain with a provided name.

Parameters:

name (str) – Name of the domain.

ex_get_node_by_uuid(uuid)[source]

Retrieve Node object for a domain with a provided uuid.

Parameters:

uuid (str) – Uuid of the domain.

ex_resume_node(node)[source]

Resume a suspended node.

Parameters:

node (Node) – Node which should be used

Return type:

bool

ex_shutdown_node(node)[source]

Shutdown a running node.

Note: Usually this will result in sending an ACPI event to the node.

Parameters:

node (Node) – Node which should be used

Return type:

bool

ex_start_node(node)[source]

Start a stopped node.

Parameters:

node (Node) – Node which should be used

Return type:

bool

ex_suspend_node(node)[source]

Suspend a running node.

Parameters:

node (Node) – Node which should be used

Return type:

bool

ex_take_node_screenshot(node, directory, screen=0)[source]

Take a screenshot of a monitoring of a running instance.

Parameters:
  • node (libcloud.compute.base.Node) – Node to take the screenshot of.

  • directory (str) – Path where the screenshot will be saved.

  • screen (int) – ID of the monitor to take the screenshot of.

Returns:

Full path where the screenshot has been saved.

Return type:

str

list_nodes()[source]

List all nodes.

Returns:

list of node objects

Return type:

list of Node

name: str = 'Libvirt'
reboot_node(node)[source]

Reboot a node.

Parameters:

node (Node) – The node to be rebooted

Returns:

True if the reboot was successful, otherwise False

Return type:

bool

start_node(node)[source]

Start a node.

Parameters:

node (Node) – The node to be started

Returns:

True if the start was successful, otherwise False

Return type:

bool

stop_node(node)[source]

Stop a node

Parameters:

node (Node) – The node to be stopped.

Returns:

True if the stop was successful, otherwise False

Return type:

bool

type: Provider | str = 'libvirt'
website: str = 'http://libvirt.org/'