You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2015/12/09 11:19:25 UTC
[07/11] libcloud git commit: Update field name and test to include
cpu spec and memory
Update field name and test to include cpu spec and memory
Signed-off-by: Anthony Shaw <an...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/67e56941
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/67e56941
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/67e56941
Branch: refs/heads/trunk
Commit: 67e5694143ae5dbd857e5c73a4e6784852127df4
Parents: 41c02f5
Author: Anthony Shaw <an...@gmail.com>
Authored: Tue Dec 8 21:22:28 2015 +1100
Committer: Anthony Shaw <an...@gmail.com>
Committed: Wed Dec 9 21:19:14 2015 +1100
----------------------------------------------------------------------
libcloud/compute/drivers/dimensiondata.py | 5 +++--
libcloud/test/compute/test_dimensiondata.py | 9 ++++++++-
2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/67e56941/libcloud/compute/drivers/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/dimensiondata.py b/libcloud/compute/drivers/dimensiondata.py
index de8384c..27f3a66 100644
--- a/libcloud/compute/drivers/dimensiondata.py
+++ b/libcloud/compute/drivers/dimensiondata.py
@@ -152,8 +152,9 @@ class DimensionDataNodeDriver(NodeDriver):
if ex_cpu_specification is not None:
cpu = ET.SubElement(server_elm, "cpu")
cpu.set('speed', ex_cpu_specification.performance)
- cpu.set('count', ex_cpu_specification.cpu_count)
- cpu.set('coresPerSocket', ex_cpu_specification.core_per_socket)
+ cpu.set('count', str(ex_cpu_specification.cpu_count))
+ cpu.set('coresPerSocket',
+ str(ex_cpu_specification.cores_per_socket))
if ex_network is not None:
network_elm = ET.SubElement(server_elm, "network")
http://git-wip-us.apache.org/repos/asf/libcloud/blob/67e56941/libcloud/test/compute/test_dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_dimensiondata.py b/libcloud/test/compute/test_dimensiondata.py
index 6f06a0e..bbdf2b2 100644
--- a/libcloud/test/compute/test_dimensiondata.py
+++ b/libcloud/test/compute/test_dimensiondata.py
@@ -24,6 +24,7 @@ from libcloud.utils.py3 import httplib
from libcloud.common.types import InvalidCredsError
from libcloud.common.dimensiondata import DimensionDataAPIException, NetworkDomainServicePlan
+from libcloud.common.dimensiondata import DimensionDataServerCpuSpecification
from libcloud.compute.drivers.dimensiondata import DimensionDataNodeDriver as DimensionData
from libcloud.compute.base import Node, NodeAuthPassword, NodeLocation
@@ -145,11 +146,17 @@ class DimensionDataTests(unittest.TestCase, TestCaseMixin):
image = self.driver.list_images(location=location)[0]
network_domain = self.driver.ex_list_network_domains(location=location)[0]
vlan = self.driver.ex_list_vlans(location=location)[0]
+ cpu = DimensionDataServerCpuSpecification(
+ cpu_count=4,
+ cores_per_socket=1,
+ performance='HIGHPERFORMANCE'
+ )
node = self.driver.create_node(name='test2', image=image, auth=rootPw,
ex_description='test2 node',
ex_network_domain=network_domain,
ex_vlan=vlan,
- ex_is_started=False)
+ ex_is_started=False, ex_cpu_specification=cpu,
+ ex_memory_gb=4)
self.assertEqual(node.id, 'e75ead52-692f-4314-8725-c8a4f4d13a87')
self.assertEqual(node.extra['status'].action, 'DEPLOY_SERVER')