Part of libcloud.compute.base View Source View In Hierarchy
Known subclasses: libcloud.compute.drivers.cloudstack.CloudStackNode, libcloud.compute.drivers.gogrid.GoGridNode
Provide a common interface for handling nodes of all types. The Node object provides the interface in libcloud through which we can manipulate nodes in different cloud providers in the same way. Node objects don't actually do much directly themselves, instead the node driver handles the connection to the node. You don't normally create a node object yourself; instead you use a driver and then have that create the node for you. >>> from libcloud.compute.drivers.dummy import DummyNodeDriver >>> driver = DummyNodeDriver(0) >>> node = driver.create_node() >>> node.public_ips[0] '127.0.0.3' >>> node.name 'dummy-3' You can also get nodes from the driver's list_node function. >>> node = driver.list_nodes()[0] >>> node.name 'dummy-1' the node keeps a reference to its own driver which means that we can work on nodes from different providers without having to know which is which. >>> driver = DummyNodeDriver(72) >>> node2 = driver.create_node() >>> node.driver.creds 0 >>> node2.driver.creds 72 Althrough Node objects can be subclassed, this isn't normally done. Instead, any driver specific information is stored in the "extra" proproperty of the node. >>> node.extra {'foo': 'bar'}
Method | __init__ | Undocumented |
Method | reboot | Reboot this node |
Method | destroy | Destroy this node |
Method | __repr__ | Undocumented |
Method | _set_public_ips | Undocumented |
Method | _get_public_ips | Undocumented |
Method | _set_private_ips | Undocumented |
Method | _get_private_ips | Undocumented |
Inherited from UuidMixin:
Method | get_uuid | Unique hash for a node, node image, or node size |
Method | uuid | Undocumented |
Reboot this node @return: C{bool} This calls the node's driver and reboots the node >>> from libcloud.compute.drivers.dummy import DummyNodeDriver >>> driver = DummyNodeDriver(0) >>> node = driver.create_node() >>> from libcloud.compute.types import NodeState >>> node.state == NodeState.RUNNING True >>> node.state == NodeState.REBOOTING False >>> node.reboot() True >>> node.state == NodeState.REBOOTING True
Destroy this node @return: C{bool} This calls the node's driver and destroys the node >>> from libcloud.compute.drivers.dummy import DummyNodeDriver >>> driver = DummyNodeDriver(0) >>> from libcloud.compute.types import NodeState >>> node = driver.create_node() >>> node.state == NodeState.RUNNING True >>> node.destroy() True >>> node.state == NodeState.RUNNING False