pycloudlib.openstack.instance module

Openstack instance type.

class pycloudlib.openstack.instance.OpenstackInstance(key_pair, instance_id, network_id, connection=None, *, username: str | None = None)[source]

Bases: BaseInstance

Openstack instance object.

__init__(key_pair, instance_id, network_id, connection=None, *, username: str | None = None)[source]

Set up the instance.

Parameters:
  • key_pair – A KeyPair for SSH interactions

  • instance_id – The instance id representing the cloud instance

  • network_id – if of the network this instance was created on

  • connection – The connection used to create this instance. If None, connection will be created.

  • username – username to use when connecting via SSH

add_network_interface(**kwargs) str[source]

Add nic to running instance.

Returns IP address in string form

console_log()[source]

Return the instance console log.

delete(wait=True) List[Exception][source]

Delete the instance.

Parameters:

wait – wait for instance to be deleted

property id: str

Return instance id.

property ip

Return IP address of instance.

property name

Return instance name.

remove_network_interface(ip_address: str)[source]

Remove nic from running instance.

shutdown(wait=True, **kwargs)[source]

Shutdown the instance.

Parameters:

wait – wait for the instance to shutdown

start(wait=True)[source]

Start the instance.

Parameters:

wait – wait for the instance to start.

wait_for_delete()[source]

Wait for instance to be deleted.

wait_for_stop(**kwargs)[source]

Wait for instance stop.