libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [05/11] libcloud git commit: Update list images functions to use the 2.1 API functionality
Date Wed, 09 Dec 2015 10:19:23 GMT
Update list images functions to use the 2.1 API functionality

Signed-off-by: Anthony Shaw <anthony.p.shaw@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/7235ccf1
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/7235ccf1
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/7235ccf1

Branch: refs/heads/trunk
Commit: 7235ccf10580144e3f6c3a0922c29a26ccec4e22
Parents: b806072
Author: Anthony Shaw <anthony.p.shaw@gmail.com>
Authored: Tue Dec 8 20:46:36 2015 +1100
Committer: Anthony Shaw <anthony.p.shaw@gmail.com>
Committed: Wed Dec 9 21:19:12 2015 +1100

----------------------------------------------------------------------
 libcloud/compute/drivers/dimensiondata.py       |  45 ++++---
 ...745_4d8a_9cbc_8dabe5a7d0e4_image_osImage.xml |  34 ++++++
 ...8a_9cbc_8dabe5a7d0e4_server_deployServer.xml |   1 -
 ...745_4d8a_9cbc_8dabe5a7d0e4_server_server.xml | 122 +++++++------------
 ...ver_e75ead52_692f_4314_8725_c8a4f4d13a87.xml |  53 ++++----
 libcloud/test/compute/test_dimensiondata.py     |  16 ++-
 6 files changed, 146 insertions(+), 125 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/7235ccf1/libcloud/compute/drivers/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/dimensiondata.py b/libcloud/compute/drivers/dimensiondata.py
index 6edf979..464e8f4 100644
--- a/libcloud/compute/drivers/dimensiondata.py
+++ b/libcloud/compute/drivers/dimensiondata.py
@@ -28,6 +28,7 @@ from libcloud.common.dimensiondata import (DimensionDataConnection,
 from libcloud.common.dimensiondata import DimensionDataNetwork
 from libcloud.common.dimensiondata import DimensionDataNetworkDomain
 from libcloud.common.dimensiondata import DimensionDataVlan
+from libcloud.common.dimensiondata import DimensionDataServerCpuSpecification
 from libcloud.common.dimensiondata import DimensionDataPublicIpBlock
 from libcloud.common.dimensiondata import DimensionDataFirewallRule
 from libcloud.common.dimensiondata import DimensionDataFirewallAddress
@@ -242,11 +243,12 @@ class DimensionDataNodeDriver(NodeDriver):
         """
         params = {}
         if location is not None:
-            params['location'] = location.id
+            params['datacenterId'] = location.id
 
         return self._to_base_images(
-            self.connection.request_api_1('base/imageWithDiskSpeed',
-                                          params=params)
+            self.connection.request_with_orgId_api_2(
+                'image/osImage',
+                params=params)
             .object)
 
     def list_sizes(self, location=None):
@@ -303,7 +305,7 @@ class DimensionDataNodeDriver(NodeDriver):
         images = []
         locations = self.list_locations()
 
-        for element in object.findall(fixxpath("image", SERVER_NS)):
+        for element in object.findall(fixxpath("osImage", TYPES_URN)):
             images.append(self._to_base_image(element, locations))
 
         return images
@@ -313,27 +315,25 @@ class DimensionDataNodeDriver(NodeDriver):
         # that parse <ServerImage> differently than <DeployedImage>.
         # DeployedImages are customer snapshot images, and ServerImages are
         # 'base' images provided by DimensionData
-        location_id = element.get('location')
+        location_id = element.get('datacenterId')
         location = list(filter(lambda x: x.id == location_id,
                                locations))[0]
+        cpu_spec = self._to_cpu_spec(element.find(fixxpath('cpu', TYPES_URN)))
 
         extra = {
-            'description': findtext(element, 'description', SERVER_NS),
-            'OS_type': findtext(element, 'operatingSystem/type', SERVER_NS),
+            'description': findtext(element, 'description', TYPES_URN),
+            'OS_type': findtext(element, 'operatingSystem/type', TYPES_URN),
             'OS_displayName': findtext(element, 'operatingSystem/displayName',
-                                       SERVER_NS),
-            'cpuCount': findtext(element, 'cpuCount', SERVER_NS),
-            'resourcePath': findtext(element, 'resourcePath', SERVER_NS),
-            'memory': findtext(element, 'memory', SERVER_NS),
-            'osStorage': findtext(element, 'osStorage', SERVER_NS),
-            'additionalStorage': findtext(element, 'additionalStorage',
-                                          SERVER_NS),
-            'created': findtext(element, 'created', SERVER_NS),
+                                       TYPES_URN),
+            'cpu': cpu_spec,
+            'memoryGb': findtext(element, 'memoryGb', TYPES_URN),
+            'osImageKey': findtext(element, 'osImageKey', TYPES_URN),
+            'created': findtext(element, 'createTime', TYPES_URN),
             'location': location,
         }
 
         return NodeImage(id=element.get('id'),
-                         name=str(findtext(element, 'name', SERVER_NS)),
+                         name=str(findtext(element, 'name', TYPES_URN)),
                          extra=extra,
                          driver=self.connection.driver)
 
@@ -1547,6 +1547,12 @@ class DimensionDataNodeDriver(NodeDriver):
                          driver=self)
         return l
 
+    def _to_cpu_spec(self, element):
+        return DimensionDataServerCpuSpecification(
+            cpu_count=int(element.get('count')),
+            cores_per_socket=int(element.get('coresPerSocket')),
+            performance=element.get('speed'))
+
     def _to_nodes(self, object):
         node_elements = object.findall(fixxpath('server', TYPES_URN))
 
@@ -1563,6 +1569,8 @@ class DimensionDataNodeDriver(NodeDriver):
         has_network_info \
             = element.find(fixxpath('networkInfo', TYPES_URN)) is not None
 
+        cpu_spec = self._to_cpu_spec(element.find(fixxpath('cpu', TYPES_URN)))
+
         extra = {
             'description': findtext(element, 'description', TYPES_URN),
             'sourceImageId': findtext(element, 'sourceImageId', TYPES_URN),
@@ -1573,10 +1581,7 @@ class DimensionDataNodeDriver(NodeDriver):
                 if has_network_info else None,
             'datacenterId': element.get('datacenterId'),
             'deployedTime': findtext(element, 'createTime', TYPES_URN),
-            'cpuCount': int(findtext(
-                element,
-                'cpuCount',
-                TYPES_URN)),
+            'cpu': cpu_spec,
             'memoryMb': int(findtext(
                 element,
                 'memoryGb',

http://git-wip-us.apache.org/repos/asf/libcloud/blob/7235ccf1/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage.xml
b/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage.xml
new file mode 100644
index 0000000..1f884a9
--- /dev/null
+++ b/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<osImages xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="47" totalCount="47"
pageSize="250">
+    <osImage id="c14b1a46-2428-44c1-9c1a-b20e6418d08c" datacenterId="NA9">
+        <name>RedHat 6 64-bit 2 CPU</name>
+        <description>RedHat 6.6 Enterprise (Santiago) 64-bit</description>
+        <operatingSystem id="REDHAT664" displayName="REDHAT6/64" family="UNIX" />
+        <cpu count="2" speed="STANDARD" coresPerSocket="1" />
+        <memoryGb>4</memoryGb>
+        <disk id="a02b7244-99d8-4889-84a5-5e4373c1bb26" scsiId="0" sizeGb="10" speed="STANDARD"
/>
+        <createTime>2015-09-17T11:23:48.000Z</createTime>
+        <osImageKey>T-RHEL-6-64-2-4-10</osImageKey>
+    </osImage>
+    <osImage id="6b4fb0c7-a57b-4f58-b59c-9958f94f971a" datacenterId="NA9">
+        <name>Win2012 DC 2 CPU</name>
+        <description>Windows 2012 Datacenter</description>
+        <operatingSystem id="WIN2012DC64" displayName="WIN2012DC/64" family="WINDOWS"
/>
+        <cpu count="2" speed="STANDARD" coresPerSocket="1" />
+        <memoryGb>4</memoryGb>
+        <disk id="f5e01854-a211-4ec6-96d6-2753b6d47877" scsiId="0" sizeGb="50" speed="STANDARD"
/>
+        <createTime>2015-09-17T11:44:43.000Z</createTime>
+        <osImageKey>T-WIN-2012-DATACTR-64-2-4-50</osImageKey>
+    </osImage>
+    <osImage id="3ebf3c0f-90fe-4a8b-8585-6e65b316592c" datacenterId="NA9">
+        <name>Win2008 Std 32-bit 2 CPU</name>
+        <description>Windows 2008 Enterprise R2 32-bit installed with Microsoft SQL
Server 2012 Standard Edition</description>
+        <operatingSystem id="WIN2008S32" displayName="WIN2008S/32" family="WINDOWS" />
+        <cpu count="2" speed="STANDARD" coresPerSocket="1" />
+        <memoryGb>4</memoryGb>
+        <disk id="6e5b5112-0eae-44eb-83cd-1bd0d58fbeab" scsiId="0" sizeGb="50" speed="STANDARD"
/>
+        <softwareLabel>MSSQL2008R2S</softwareLabel>
+        <createTime>2014-11-20T12:54:22.000Z</createTime>
+        <osImageKey>T-WIN-2008-ENT-32-2-4-50</osImageKey>
+    </osImage>
+</osImages>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/7235ccf1/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployServer.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployServer.xml
b/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployServer.xml
index 74077be..05108c5 100644
--- a/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployServer.xml
+++ b/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployServer.xml
@@ -4,6 +4,5 @@
 <responseCode>IN_PROGRESS</responseCode>
 <message>Request to deploy Server 'Production FTPS Server' has been
 accepted and is being processed.</message>
-© 2015 Dimension Data Cloud Solutions 162
 <info name="serverId" value="e75ead52-692f-4314-8725-c8a4f4d13a87"/>
 </response>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/7235ccf1/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server.xml
b/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server.xml
index 47d75cf..c3d607f 100644
--- a/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server.xml
+++ b/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server.xml
@@ -1,81 +1,49 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<servers
-xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="1"
-totalCount="2" pageSize="250">
-<server id="e75ead52-692f-4314-8725-c8a4f4d13a87" datacenterId="NA9">
-<name>test2</name>
-<description>Test Description</description>
-<operatingSystem id="REDHAT664" displayName="REDHAT6/64"
-family="UNIX"/>
-<cpuCount>1</cpuCount>
-<memoryGb>2</memoryGb>
-<disk id="338c1163-5348-4572-962d-185c97bd0d65" scsiId="0" sizeGb="10"
-speed="STANDARD" state="NORMAL"/>
-<networkInfo networkDomainId="484174a2-ae74-4658-9e56-50fc90e086cf">
-<primaryNic id="4c8d5f67-c6df-421d-b8ac-45dd1b141334"
-privateIpv4="10.0.3.11" ipv6="2607:f480:1111:1153:dee:4666:1130:7484"
-vlanId="0e56433f-d808-4669-821d-812769517ff8" vlanName="Production VLAN"
-state="NORMAL"/>
-</networkInfo>
-<sourceImageId>02250336-de2b-4e99-ab96-78511b7f8f4b</sourceImageId>
-<createTime>2015-02-17T10:59:18.000Z</createTime>
-<deployed>true</deployed>
-<started>true</started>
-<state>NORMAL</state>
-<progress>
-<action>DEPLOY_SERVER</action>
-<requestTime>2015-03-06T18:05:33.000Z</requestTime>
-<userName>myuser</userName>
-</progress>
-<machineStatus name="vmwareToolsVersionStatus" value="CURRENT"/>
-<machineStatus name="vmwareToolsRunningStatus" value="RUNNING"/>
-<machineStatus name="vmwareToolsApiVersion" value="9354"/>
-</server>
-<server id="abadbc7e-9e10-46ca-9d4a-194bcc6b6c16" datacenterId="NA9">
-<name>Production Web Server 2</name>
-<description>This server hosts our production web
-applications.</description>
-<operatingSystem id="REDHAT664" displayName="REDHAT6/64"
-family="UNIX"/>
-<cpuCount>1</cpuCount>
-<memoryGb>2</memoryGb>
-<disk id="338c1163-5348-4572-962d-185c97bd0d65" scsiId="0" sizeGb="10"
-speed="STANDARD" state="NORMAL"/>
-<networkInfo networkDomainId="484174a2-ae74-4658-9e56-50fc90e086cf">
-<primaryNic id="4c8d5f67-c6df-421d-b8ac-45dd1b141334"
-privateIpv4="10.0.3.11" ipv6="2607:f480:1111:1153:dee:4666:1130:7484"
-vlanId="0e56433f-d808-4669-821d-812769517ff8" vlanName="Production VLAN"
-state="NORMAL"/>
-</networkInfo>
-<sourceImageId>02250336-de2b-4e99-ab96-78511b7f8f4b</sourceImageId>
-<createTime>2015-02-17T10:59:18.000Z</createTime>
-<deployed>true</deployed>
-<started>true</started>
-<state>PENDING_CHANGE</state>
-<progress>
-<action>SHUTDOWN_SERVER</action>
-<requestTime>2015-03-06T18:05:33.000Z</requestTime>
-<userName>myuser</userName>
-</progress>
-<machineStatus name="vmwareToolsVersionStatus" value="CURRENT"/>
-<machineStatus name="vmwareToolsRunningStatus" value="RUNNING"/>
-<machineStatus name="vmwareToolsApiVersion" value="9354"/>
-</server>
-<server id="f07445f8-8ba3-4066-86c1-d6d0dd5518a1" datacenterId="NA5">
-        <name>us-dc1.us.aperture.cloud</name>
-        <description>Domain Controller 1 for us.aperture.cloud</description>
-        <operatingSystem id="WIN2012S64" displayName="WIN2012S/64" family="WINDOWS"/>
-        <cpuCount>2</cpuCount>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<servers xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="2" totalCount="2"
pageSize="250">
+    <!-- MCP 1.0 Server -->
+    <server id="e75ead52-692f-4314-8725-c8a4f4d13a87" datacenterId="NA1">
+        <name>Production Web Server MCP 1</name>
+        <description>nopassword0</description>
+        <operatingSystem id="REDHAT632" displayName="REDHAT6/32" family="UNIX" />
+        <cpu count="4" speed="STANDARD" coresPerSocket="1" />
         <memoryGb>2</memoryGb>
-        <disk id="628a8134-8ebf-420d-afc2-08af0c402f4e" scsiId="0" sizeGb="50" speed="STANDARD"
state="NORMAL"/>
-        <nic id="fe72eebe-7b9d-11e4-8c14-b8ca3a5d9ef8" privateIpv4="10.192.176.11" networkId="4bba37be-506f-11e3-b29c-001517c4643e"
networkName="Aperture US1" state="NORMAL"/>
-        <sourceImageId>4787337e-0f31-11e3-b29c-001517c4643e</sourceImageId>
-        <createTime>2013-12-03T07:16:44.000Z</createTime>
+        <disk id="74f81c56-96cc-4cca-b4d7-a88f641a6ea2" scsiId="0" sizeGb="10" speed="STANDARD"
state="NORMAL" />
+        <nic id="43b24e9e-c1c9-4d53-965b-89bcaa725103" privateIpv4="10.160.117.25" networkId="c550be0e-65c1-11e4-811f-005056806999"
networkName="Test1" state="NORMAL" />
+        <backup assetId="5579f3a7-4c32-4cf5-8a7e-b45c36a35c10" servicePlan="Enterprise"
state="NORMAL" />
+        <monitoring monitoringId="11049" servicePlan="ESSENTIALS" state="NORMAL" />
+        <sourceImageId>e9ec6eb4-4634-49de-b914-01eb74da5fb9</sourceImageId>
+        <createTime>2015-08-11T16:51:05.000Z</createTime>
         <deployed>true</deployed>
-        <started>false</started>
+        <started>true</started>
         <state>NORMAL</state>
-        <machineStatus name="vmwareToolsVersionStatus" value="NEED_UPGRADE"/>
-        <machineStatus name="vmwareToolsRunningStatus" value="NOT_RUNNING"/>
-        <machineStatus name="vmwareToolsApiVersion" value="9221"/>
+        <vmwareTools versionStatus="NEED_UPGRADE" runningStatus="RUNNING" apiVersion="8389"
/>
+        <virtualHardware version="vmx-08" upToDate="false" />
     </server>
-</servers>
\ No newline at end of file
+    <!-- MCP 2.0 Server -->
+    <server id="5a32d6e4-9707-4813-a269-56ab4d989f4d" datacenterId="NA9">
+        <name>Production Web Server MCP 2</name>
+        <description>Server to host our main web application.</description>
+        <operatingSystem id="WIN2008S32" displayName="WIN2008S/32" family="WINDOWS" />
+        <cpu count="2" speed="STANDARD" coresPerSocket="1" />
+        <memoryGb>4</memoryGb>
+        <disk id="c2e1f199-116e-4dbc-9960-68720b832b0a" scsiId="0" sizeGb="50" speed="STANDARD"
state="NORMAL" />
+        <networkInfo networkDomainId="553f26b6-2a73-42c3-a78b-6116f11291d0">
+            <primaryNic id="5e869800-df7b-4626-bcbf-8643b8be11fd" privateIpv4="10.0.4.8"
ipv6="2607:f480:1111:1282:2960:fb72:7154:6160" vlanId="bc529e20-dc6f-42ba-be20-0ffe44d1993f"
vlanName="Production VLAN" state="NORMAL" />
+        </networkInfo>
+        <backup assetId="91002e08-8dc1-47a1-ad33-04f501c06f87" servicePlan="Advanced"
state="NORMAL" />
+        <monitoring monitoringId="11039" servicePlan="ESSENTIALS" state="NORMAL" />
+        <softwareLabel>MSSQL2008R2S</softwareLabel>
+        <sourceImageId>3ebf3c0f-90fe-4a8b-8585-6e65b316592c</sourceImageId>
+        <createTime>2015-12-02T10:31:33.000Z</createTime>
+        <deployed>true</deployed>
+        <started>true</started>
+        <state>PENDING_CHANGE</state>
+        <progress>
+            <action>SHUTDOWN_SERVER</action>
+            <requestTime>2015-12-02T11:07:40.000Z</requestTime>
+            <userName>devuser1</userName>
+        </progress>
+        <vmwareTools versionStatus="CURRENT" runningStatus="RUNNING" apiVersion="9354"
/>
+        <virtualHardware version="vmx-08" upToDate="false" />
+    </server>
+</servers>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/7235ccf1/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87.xml
b/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87.xml
index dcdb1ae..813c43f 100644
--- a/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87.xml
+++ b/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87.xml
@@ -1,26 +1,27 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<server xmlns="urn:didata.com:api:cloud:types" id="e75ead52-692f-4314-8725-c8a4f4d13a87"
datacenterId="NA5">
-    <name>us-dc2.us.aperture.cloud</name>
-    <description>Domain Controller 2 for us.aperture.cloud.</description>
-    <operatingSystem id="WIN2012S64" displayName="WIN2012S/64" family="WINDOWS"/>
-    <cpuCount>2</cpuCount>
-    <memoryGb>2</memoryGb>
-    <disk id="931d9035-251d-432c-8f52-8e9e3e15cbbb" scsiId="0" sizeGb="50" speed="STANDARD"
state="NORMAL"/>
-    <disk id="f28de371-2b30-46d1-935d-913e1594c91c" scsiId="1" sizeGb="10" speed="STANDARD"
state="NORMAL"/>
-    <disk id="0033b75f-fb0d-4068-aa21-8fb814587ce2" scsiId="2" sizeGb="10" speed="STANDARD"
state="NORMAL"/>
-    <disk id="f0c0dacf-33e4-42d4-9d80-3ebf3c899a37" scsiId="3" sizeGb="10" speed="STANDARD"
state="NORMAL"/>
-    <nic id="fe72ee32-7b9d-11e4-8c14-b8ca3a5d9ef8" privateIpv4="10.192.176.12" networkId="4bba37be-506f-11e3-b29c-001517c4643e"
networkName="Aperture US1" state="NORMAL"/>
-    <sourceImageId>4787337e-0f31-11e3-b29c-001517c4643e</sourceImageId>
-    <createTime>2013-11-29T23:17:09.000Z</createTime>
-    <deployed>true</deployed>
-    <started>false</started>
-    <state>NORMAL</state>
-    <progress>
-    <action>DEPLOY_SERVER</action>
-    <requestTime>2015-03-06T18:05:33.000Z</requestTime>
-    <userName>myuser</userName>
-    </progress>
-    <machineStatus name="vmwareToolsVersionStatus" value="NEED_UPGRADE"/>
-    <machineStatus name="vmwareToolsRunningStatus" value="NOT_RUNNING"/>
-    <machineStatus name="vmwareToolsApiVersion" value="9221"/>
-</server>
\ No newline at end of file
+<?xml version="1.0" encoding="utf-8"?>
+<server xmlns="urn:didata.com:api:cloud:types" id="e75ead52-692f-4314-8725-c8a4f4d13a87"
datacenterId="NA9">
+        <name>Production Web Server</name>
+        <description>Server to host our main web application.</description>
+        <operatingSystem id="WIN2008S32" displayName="WIN2008S/32" family="WINDOWS" />
+        <cpu count="2" speed="STANDARD" coresPerSocket="1" />
+        <memoryGb>4</memoryGb>
+        <disk id="c2e1f199-116e-4dbc-9960-68720b832b0a" scsiId="0" sizeGb="50" speed="STANDARD"
state="NORMAL" />
+        <networkInfo networkDomainId="553f26b6-2a73-42c3-a78b-6116f11291d0">
+            <primaryNic id="5e869800-df7b-4626-bcbf-8643b8be11fd" privateIpv4="10.0.4.8"
ipv6="2607:f480:1111:1282:2960:fb72:7154:6160" vlanId="bc529e20-dc6f-42ba-be20-0ffe44d1993f"
vlanName="Production VLAN" state="NORMAL" />
+        </networkInfo>
+        <backup assetId="5579f3a7-4c32-4cf5-8a7e-b45c36a35c10" servicePlan="Enterprise"
state="NORMAL" />
+        <monitoring monitoringId="11049" servicePlan="ESSENTIALS" state="NORMAL" />
+        <softwareLabel>MSSQL2008R2S</softwareLabel>
+        <sourceImageId>3ebf3c0f-90fe-4a8b-8585-6e65b316592c</sourceImageId>
+        <createTime>2015-12-02T10:31:33.000Z</createTime>
+        <deployed>true</deployed>
+        <started>true</started>
+        <state>PENDING_CHANGE</state>
+        <progress>
+            <action>DEPLOY_SERVER</action>
+            <requestTime>2015-12-02T11:07:40.000Z</requestTime>
+            <userName>devuser1</userName>
+        </progress>
+        <vmwareTools versionStatus="CURRENT" runningStatus="RUNNING" apiVersion="9354"
/>
+        <virtualHardware version="vmx-08" upToDate="false" />
+    </server>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/7235ccf1/libcloud/test/compute/test_dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_dimensiondata.py b/libcloud/test/compute/test_dimensiondata.py
index f8527b1..49fdc82 100644
--- a/libcloud/test/compute/test_dimensiondata.py
+++ b/libcloud/test/compute/test_dimensiondata.py
@@ -68,7 +68,7 @@ class DimensionDataTests(unittest.TestCase, TestCaseMixin):
     def test_list_nodes_response(self):
         DimensionDataMockHttp.type = None
         ret = self.driver.list_nodes()
-        self.assertEqual(len(ret), 3)
+        self.assertEqual(len(ret), 2)
 
     def test_list_sizes_response(self):
         DimensionDataMockHttp.type = None
@@ -111,6 +111,15 @@ class DimensionDataTests(unittest.TestCase, TestCaseMixin):
         except DimensionDataAPIException:
             pass
 
+    def test_list_images(self):
+        images = self.driver.list_images()
+        self.assertEqual(len(images), 3)
+        self.assertEqual(images[0].name, 'RedHat 6 64-bit 2 CPU')
+        self.assertEqual(images[0].id, 'c14b1a46-2428-44c1-9c1a-b20e6418d08c')
+        self.assertEqual(images[0].extra['location'].id, 'NA9')
+        self.assertEqual(images[0].extra['cpu'].cpu_count, 2)
+        self.assertEqual(images[0].extra['OS_displayName'], 'REDHAT6/64')
+
     def test_create_node_response(self):
         rootPw = NodeAuthPassword('pass123')
         image = self.driver.list_images()[0]
@@ -919,5 +928,10 @@ class DimensionDataMockHttp(MockHttp):
             'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_changeServerMonitoringPlan.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
+    def _caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage(self, method, url, body,
headers):
+        body = self.fixtures.load(
+            'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
 if __name__ == '__main__':
     sys.exit(unittest.main())


Mime
View raw message