Part of libcloud.compute.base View Source View In Hierarchy
Known subclasses: libcloud.compute.drivers.bluebox.BlueboxNodeDriver, libcloud.compute.drivers.brightbox.BrightboxNodeDriver, libcloud.compute.drivers.cloudsigma.CloudSigmaBaseNodeDriver, libcloud.compute.drivers.cloudstack.CloudStackNodeDriver, libcloud.compute.drivers.dreamhost.DreamhostNodeDriver, libcloud.compute.drivers.dummy.DummyNodeDriver, libcloud.compute.drivers.ec2.EC2NodeDriver, libcloud.compute.drivers.ecp.ECPNodeDriver, libcloud.compute.drivers.elasticstack.ElasticStackBaseNodeDriver, libcloud.compute.drivers.gandi.GandiNodeDriver, libcloud.compute.drivers.gogrid.GoGridNodeDriver, libcloud.compute.drivers.gridspot.GridspotNodeDriver, libcloud.compute.drivers.ibm_sce.IBMNodeDriver, libcloud.compute.drivers.joyent.JoyentNodeDriver, libcloud.compute.drivers.libvirt_driver.LibvirtNodeDriver, libcloud.compute.drivers.linode.LinodeNodeDriver, libcloud.compute.drivers.opennebula.OpenNebulaNodeDriver, libcloud.compute.drivers.openstack.OpenStackNodeDriver, libcloud.compute.drivers.opsource.OpsourceNodeDriver, libcloud.compute.drivers.rimuhosting.RimuHostingNodeDriver, libcloud.compute.drivers.slicehost.SlicehostNodeDriver, libcloud.compute.drivers.softlayer.SoftLayerNodeDriver, libcloud.compute.drivers.vcl.VCLNodeDriver, libcloud.compute.drivers.vcloud.VCloudNodeDriver, libcloud.compute.drivers.voxel.VoxelNodeDriver, libcloud.compute.drivers.vpsnet.VPSNetNodeDriver
This class is always subclassed by a specific driver. For examples of base behavior of most functions (except deploy node) see the dummy driver.
Method | __init__ | |
Method | create_node | Create a new node instance. |
Method | destroy_node | Destroy a node. |
Method | reboot_node | Reboot a node. |
Method | list_nodes | List all nodes @return: list of node objects @rtype: list
of Node |
Method | list_images | List images on a provider |
Method | list_sizes | List sizes on a provider |
Method | list_locations | List data centers for a provider |
Method | deploy_node | Create a new node, and start deployment. |
Method | create_volume | Create a new volume. |
Method | destroy_volume | Destroys a storage volume. |
Method | attach_volume | Attaches volume to node. |
Method | detach_volume | Detaches a volume from a node. |
Method | _wait_until_running | Block until node is fully booted and has an IP address assigned. |
Method | _ssh_client_connect | Try to connect to the remote SSH server. If a connection times out or is refused it is retried up to timeout number of seconds. |
Method | _run_deployment_script | Run the deployment script on the provided node. At this point it is assumed that SSH connection has already been established. |
Method | _get_size_price | Undocumented |
Inherited from BaseDriver:
Method | _ex_connection_class_kwargs | Return extra connection keyword arguments which are passed to the Connection class constructor. |
Unknown Field: requires | key, secret |
Parameters | name | String with a name for this new node (required) (type: str ) |
size | The size of resources allocated to this node. (required) (type: NodeSize ) | |
image | OS Image to boot on node. (required) (type: NodeImage ) | |
location | Which data center to create a node in. If empty, undefined behavoir will be
selected. (optional) (type: NodeLocation ) | |
auth | Initial authentication information for the node (optional) (type: NodeAuthSSHKey
or NodeAuthPassword ) | |
Returns | The newly created node. (type: Node ) |
Depending upon the provider, this may destroy all data associated with the node, including backups.
Parameters | node | The node to be destroyed (type: Node ) |
Returns | True if the destroy was successful, otherwise False (type: bool ) |
Parameters | node | The node to be rebooted (type: Node ) |
Returns | True if the reboot was successful, otherwise False (type: bool ) |
Returns | list of node objects (type: list of Node ) |
Parameters | location | The location at which to list images (type: NodeLocation ) |
Returns | list of node image objects (type: list of NodeImage ) |
Parameters | location | The location at which to list sizes (type: NodeLocation ) |
Returns | list of node size objects (type: list of NodeSize ) |
Returns | list of node location objects (type: list of NodeLocation ) |
Depends on a Provider Driver supporting either using a specific password or returning a generated password.
This function may raise a DeploymentException
, if a
create_node call was successful, but there is a later error (like SSH
failing or timing out). This exception includes a Node object which you
may want to destroy if incomplete deployments are not desirable.
>>> from libcloud.compute.drivers.dummy import DummyNodeDriver >>> from libcloud.compute.deployment import ScriptDeployment >>> from libcloud.compute.deployment import MultiStepDeployment >>> from libcloud.compute.base import NodeAuthSSHKey >>> driver = DummyNodeDriver(0) >>> key = NodeAuthSSHKey('...') # read from file >>> script = ScriptDeployment("yum -y install emacs strace tcpdump") >>> msd = MultiStepDeployment([key, script]) >>> def d(): ... try: ... node = driver.deploy_node(deploy=msd) ... except NotImplementedError: ... print ("not implemented for dummy driver") >>> d() not implemented for dummy driver
Deploy node is typically not overridden in subclasses. The existing implementation should be able to handle most such.
Parameters | deploy | Deployment to run once machine is online and availble to SSH. (type: Deployment ) |
ssh_username | Optional name of the account which is used when connecting to SSH server
(default is root) (type: str ) | |
ssh_port | Optional SSH server port (default is 22) (type: int ) | |
ssh_timeout | Optional SSH connection timeout in seconds (default is None) (type: float ) | |
auth | Initial authentication information for the node (optional) (type: NodeAuthSSHKey
or NodeAuthPassword ) | |
ssh_key | A path (or paths) to an SSH private key with which to attempt to
authenticate. (optional) (type: str or list of str ) | |
max_tries | How many times to retry if a deployment fails before giving up (default is
3) (type: int ) | |
ssh_interface | The interface to wait for. Default is 'public_ips', other option is
'private_ips'. (type: str ) | |
Unknown Field: inherits | NodeDriver.create_node |
Parameters | size | Size of volume in gigabytes (required) (type: int ) |
name | Name of the volume to be created (type: str ) | |
location | Which data center to create a volume in. If empty, undefined behavoir will
be selected. (optional) (type: NodeLocation ) | |
snapshot | Name of snapshot from which to create the new volume. (optional) (type: str ) | |
Returns | The newly created volume. (type: StorageVolume ) |
Parameters | volume | Volume to be destroyed (type: StorageVolume ) |
Returns | (type: bool ) |
Parameters | node | Node to attach volume to (type: Node ) |
volume | Volume to attach (type: StorageVolume ) | |
device | Where the device is exposed, e.g. '/dev/sdb (optional) (type: str ) | |
Returns | (type: bool ) |
Parameters | volume | Volume to be detached (type: StorageVolume ) |
Returns | (type: bool ) |
Parameters | node | Node instance. (type: Node ) |
wait_period | How many seconds to between each loop iteration (default is 3) (type: int ) | |
timeout | How many seconds to wait before timing out (default is 600) (type: int ) | |
ssh_interface | The interface to wait for. Default is 'public_ips', other option is
'private_ips'. (type: str ) | |
force_ipv4 | Ignore ipv6 IP addresses (default is True). (type: bool ) | |
Returns | (Node, ip_addresses) tuple of Node instance and list of
ip_address on success. |
Parameters | ssh_client | A configured SSHClient instance (type: SSHClient ) |
wait_period | How many seconds to wait between each loop iteration (default is 1.5) (type: int ) | |
timeout | How many seconds to wait before timing out (default is 600) (type: int ) | |
Returns | SSHClient on success |
Parameters | task | Deployment task to run on the node. (type: Deployment ) |
node | Node to operate one (type: Node ) | |
ssh_client | A configured and connected SSHClient instance (type: SSHClient ) | |
max_tries | How many times to retry if a deployment fails before giving up (default is
3) (type: int ) | |
Returns | Node Node instance on success. |