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.ibm_sbc.IBMNodeDriver, 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.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. @return: bool True if the reboot was
successful, otherwise False |
Method | list_nodes | List all nodes @return: list of Node objects |
Method | list_images | List images on a provider @return: list of NodeImage
objects |
Method | list_sizes | List sizes on a provider @return: list of NodeSize
objects |
Method | list_locations | List data centers for a provider @return: list of NodeLocation
objects |
Method | deploy_node | Create a new node, and start deployment. |
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. |
Parameters | key | API key or username to used (type: str) |
secret | Secret password to be used (type: str) | |
secure | Weither to use HTTPS or HTTP. Note: Some providers only support HTTPS, and it is on by default. (type: bool) | |
host | Override hostname used for connections. (type: str) | |
port | Override port used for connections. (type: int) | |
api_version | Optional API version. Only used by drivers which support multiple API versions. (type: str) |
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 . |
Depending upon the provider, this may destroy all data associated with the node, including backups.
Returns | bool True if the destroy was successful, otherwise False |
Returns | bool True if the reboot was successful, otherwise False |
Returns | list of Node objects |
Returns | list of NodeImage
objects |
Returns | list of NodeSize
objects |
Returns | list of NodeLocation
objects |
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.
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
See >>> from libcloud.compute.drivers.dummy import DummyNodeDriver >>> from libcloud.deployment import ScriptDeployment >>> from libcloud.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 | 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 ) | |
Returns | Node Node instance on success. |
Parameters | ssh_client | A configured SSHClient instance (type: SSHClient ) |
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. |