From cf84ef1690e01e6a8a4a15f608085d473a42d593 Mon Sep 17 00:00:00 2001 From: Sengor Kusturica Date: Sun, 15 Sep 2013 11:13:01 +1000 Subject: [PATCH] Issue LIBCLOUD-397: Add an IBM SCE Windows node example to documentation --- docs/compute/examples.rst | 12 +++++++++++ .../compute/create_ibm_sce_windows_node.py | 23 ++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 docs/examples/compute/create_ibm_sce_windows_node.py diff --git a/docs/compute/examples.rst b/docs/compute/examples.rst index 86f1efd..1176795 100644 --- a/docs/compute/examples.rst +++ b/docs/compute/examples.rst @@ -116,3 +116,15 @@ This example demonstrates how to use OpenStack's floating IPs. .. literalinclude:: /examples/compute/openstack_floating_ips.py :language: python + +Create an IBM SCE Windows node using generic provider +----------------------------------------------------- + +.. note:: + + ex_configurationData is the key component of this example. + +This example shows how to create a Windows node using IBM SmartCloud Enterpiese. + +.. literalinclude:: /examples/compute/create_ibm_sce_windows_node.py + :language: python diff --git a/docs/examples/compute/create_ibm_sce_windows_node.py b/docs/examples/compute/create_ibm_sce_windows_node.py new file mode 100644 index 0000000..bb940e8 --- /dev/null +++ b/docs/examples/compute/create_ibm_sce_windows_node.py @@ -0,0 +1,23 @@ +from libcloud.compute.types import Provider +from libcloud.compute.providers import get_driver + +Driver = get_driver(Provider.IBM) +conn = Driver("user@name.com", "ibm_sce_password") + +images = conn.list_images() +image = [i for i in images if i.id == '20014110'][0] + +locations = conn.list_locations() +location = [l for l in locations if l.id == '82'][0] + +sizes = conn.list_sizes() +size = [s for s in sizes if s.id == 'COP32.1/2048/60'][0] + +node = conn.create_node(name="windows box", + image=image, + size=size, + ex_configurationData={ + 'UserName': 'someone', + 'Password': 'Wind0wsPass'}, + location=location) +print(conn.list_nodes()) -- 1.8.1.2