CloudFrames Compute Driver Documentation¶
Connecting to the CloudFrames installation¶
This will tell you how to interpret the available arguments:
key
- The username to the cloudapisecret
- The password to the cloudapisecure
- This should always be False as the cloudapi doesn’t support sslhost
- The hostname or ip address we can reach the cloudapi onport
- The port the cloudapi runs on (defaults to 80 for http)url
- As an alternative to the above, you can pass the full cloudapi url (e.g.http://admin:admin@cloudframes:80/appserver/xmlrpc
)
Examples¶
1. Creating the connection¶
You can set up the connection using either the complete url to the api.
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
CloudFrames = get_driver(Provider.CLOUDFRAMES)
driver = CloudFrames(url="http://admin:admin@cloudframes:80/appserver/xmlrpc")
Or by specifying the individual components which would make up the url.
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
CloudFrames = get_driver(Provider.CLOUDFRAMES)
driver = CloudFrames(key="admin", secret="admin", secure=False, host="cloudframes", port=80)
2. Implemented functionality¶
import uuid
from libcloud.compute.types import Provider, NodeState
from libcloud.compute.providers import get_driver
CloudFrames = get_driver(Provider.CLOUDFRAMES)
driver = CloudFrames(url="http://admin:admin@cloudframes:80/appserver/xmlrpc")
# get an available location
location = driver.list_locations()[0]
# and an image
image = driver.list_images()[0]
# as well as a size
size = driver.list_sizes()[0]
# use these to create a node
node = driver.create_node(image=image, name="TEST_%s" % uuid.uuid4(), size=size, location=location)
# snapshot a node, rollback to the snapshot and destroy the snaphost
snapshot = driver.ex_snapshot_node(node)
driver.ex_rollback_node(node, snapshot)
driver.ex_destroy_snapshot(node, snapshot)
# list running nodes
nodes = [n for n in driver.list_nodes() if n.state == NodeState.RUNNING]
# reboot node
driver.reboot_node(node)
# destroy the node
driver.destroy_node(node)