libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seb...@apache.org
Subject libcloud git commit: LIBCLOUD-658_Allow-rootdisksize-parameter-in-create_node
Date Thu, 29 Jan 2015 16:28:35 GMT
Repository: libcloud
Updated Branches:
  refs/heads/trunk 9fe6643a1 -> e72e2a5a3


LIBCLOUD-658_Allow-rootdisksize-parameter-in-create_node

Signed-off-by: Sebastien Goasguen <runseb@gmail.com>

This closes #440


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

Branch: refs/heads/trunk
Commit: e72e2a5a39471806adb0b1904196848c0f2fad43
Parents: 9fe6643
Author: llambiel <loic.lambiel@exoscale.ch>
Authored: Tue Jan 27 12:44:58 2015 +0000
Committer: Sebastien Goasguen <runseb@gmail.com>
Committed: Thu Jan 29 17:28:03 2015 +0100

----------------------------------------------------------------------
 CHANGES.rst                                     |  6 ++++-
 libcloud/compute/drivers/cloudstack.py          |  7 ++++++
 .../deployVirtualMachine_rootdisksize.json      |  1 +
 .../cloudstack/listNetworks_rootdisksize.json   |  1 +
 .../listServiceOfferings_rootdisksize.json      |  1 +
 .../cloudstack/listTemplates_rootdisksize.json  |  1 +
 .../cloudstack/listVolumes_rootdisksize.json    |  1 +
 .../cloudstack/listZones_rootdisksize.json      |  1 +
 .../queryAsyncJobResult_deployrootdisksize.json |  1 +
 libcloud/test/compute/test_cloudstack.py        | 25 ++++++++++++++++++++
 10 files changed, 44 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/e72e2a5a/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 8433211..6bf5137 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -150,9 +150,13 @@ Compute
   [quilombo]
 
 - Add support for Abiquo API v3.x, remove support for now obsolete API v2.x.
-  (GUTHUB-433, LIBCLOUD-652)
+  (GITHUB-433, LIBCLOUD-652)
   [David Freedman]
 
+- Allow rootdisksize parameter in create_node CloudStack driver
+  (GITHUB-440, LIBCLOUD-658)
+  [Loic Lambiel]
+
 Storage
 ~~~~~~~
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/e72e2a5a/libcloud/compute/drivers/cloudstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudstack.py b/libcloud/compute/drivers/cloudstack.py
index f006445..5f8af35 100644
--- a/libcloud/compute/drivers/cloudstack.py
+++ b/libcloud/compute/drivers/cloudstack.py
@@ -1133,6 +1133,9 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver):
 
         :type       ex_start_vm: ``bool``
 
+        :keyword    ex_rootdisksize: String with rootdisksize for the template
+        :type       ex_rootdisksize: ``str``
+
         :rtype:     :class:`.CloudStackNode`
         """
 
@@ -1161,6 +1164,7 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver):
         ex_displayname = kwargs.get('ex_displayname', None)
         ex_ip_address = kwargs.get('ex_ip_address', None)
         ex_start_vm = kwargs.get('ex_start_vm', None)
+        ex_rootdisksize = kwargs.get('ex_rootdisksize', None)
 
         if name:
             server_params['name'] = name
@@ -1204,6 +1208,9 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver):
         if ex_ip_address:
             server_params['ipaddress'] = ex_ip_address
 
+        if ex_rootdisksize:
+            server_params['rootdisksize'] = ex_rootdisksize
+
         if ex_start_vm is not None:
             server_params['startvm'] = ex_start_vm
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/e72e2a5a/libcloud/test/compute/fixtures/cloudstack/deployVirtualMachine_rootdisksize.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/cloudstack/deployVirtualMachine_rootdisksize.json
b/libcloud/test/compute/fixtures/cloudstack/deployVirtualMachine_rootdisksize.json
new file mode 100644
index 0000000..0649027
--- /dev/null
+++ b/libcloud/test/compute/fixtures/cloudstack/deployVirtualMachine_rootdisksize.json
@@ -0,0 +1 @@
+{ "deployvirtualmachineresponse" : {"jobid":"deployrootdisksize","id":65285} }

http://git-wip-us.apache.org/repos/asf/libcloud/blob/e72e2a5a/libcloud/test/compute/fixtures/cloudstack/listNetworks_rootdisksize.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/cloudstack/listNetworks_rootdisksize.json b/libcloud/test/compute/fixtures/cloudstack/listNetworks_rootdisksize.json
new file mode 100644
index 0000000..ad0bb80
--- /dev/null
+++ b/libcloud/test/compute/fixtures/cloudstack/listNetworks_rootdisksize.json
@@ -0,0 +1 @@
+{"listnetworksresponse": { "count": 3, "network": [ { "broadcastdomaintype": "Vlan", "broadcasturi":
"vlan://1002", "displaytext": "network:192.168.2.0/24", "dns1": "8.8.8.8", "dns2": "8.8.8.8",
"domain": "ROOT", "domainid": 1623, "endip": "192.168.2.233", "gateway": "192.168.2.254",
"id": 1823, "isdefault": false, "isshared": true, "issystem": false, "name": "ROOT", "netmask":
"255.255.255.0", "networkdomain": "cs1cloud.internal", "networkofferingavailability": "Optional",
"networkofferingdisplaytext": "Direct", "networkofferingid": 7, "networkofferingname": "DefaultDirectNetworkOffering",
"related": 1823, "securitygroupenabled": false, "service": [ { "name": "UserData" }, { "capability":
[ { "name": "AllowDnsSuffixModification", "value": "true" } ], "name": "Dns" }, { "capability":
[ { "name": "SupportedProtocols", "value": "tcp, udp" }, { "name": "SupportedLbAlgorithms",
"value": "roundrobin,leastconn,source" } ], "name": "Lb" }, { "name": "Dhcp" } ], "startip":
"192.168.2.1", "s
 tate": "Setup", "traffictype": "Guest", "type": "Direct", "vlan": "1002", "zoneid": 1 },
{ "account": "testuser", "broadcastdomaintype": "Vlan", "broadcasturi": "vlan://2909", "displaytext":
"testuser-network", "dns1": "8.8.8.8", "dns2": "8.8.8.8", "domain": "ROOT", "domainid": 1623,
"id": 1547, "isdefault": true, "isshared": false, "issystem": false, "name": "testuser-network",
"networkdomain": "cs586cloud.internal", "networkofferingavailability": "Optional", "networkofferingdisplaytext":
"Virtual Vlan", "networkofferingid": 6, "networkofferingname": "DefaultVirtualizedNetworkOffering",
"related": 1547, "securitygroupenabled": false, "service": [ { "name": "UserData" }, { "capability":
[ { "name": "AllowDnsSuffixModification", "value": "true" } ], "name": "Dns" }, { "capability":
[ { "name": "SupportedProtocols", "value": "tcp, udp" }, { "name": "SupportedLbAlgorithms",
"value": "roundrobin,leastconn,source" } ], "name": "Lb" }, { "name": "Gateway" }, { "name":
"Dhcp" }, { "capabil
 ity": [ { "name": "SupportedVpnTypes", "value": "pptp,l2tp,ipsec" } ], "name": "Vpn" }, {
"capability": [ { "name": "MultipleIps", "value": "true" }, { "name": "SupportedSourceNatTypes",
"value": "per account" }, { "name": "SupportedProtocols", "value": "tcp,udp,icmp" }, { "name":
"TrafficStatistics", "value": "per public ip" }, { "name": "PortForwarding", "value": "true"
}, { "name": "StaticNat", "value": "true" } ], "name": "Firewall" } ], "state": "Implemented",
"traffictype": "Guest", "type": "Virtual", "zoneid": 2 }, { "account": "testuser", "broadcastdomaintype":
"Vlan", "broadcasturi": "vlan://3564", "displaytext": "testuser-network", "dns1": "8.8.8.8",
"dns2": "8.8.8.8", "domain": "ROOT", "domainid": 1623, "id": 1374, "isdefault": true, "isshared":
false, "issystem": false, "name": "testuser-network", "networkdomain": "cs586cloud.internal",
"networkofferingavailability": "Optional", "networkofferingdisplaytext": "Virtual Vlan", "networkofferingid":
6, "networkofferingname": 
 "DefaultVirtualizedNetworkOffering", "related": 1374, "securitygroupenabled": false, "service":
[ { "name": "UserData" }, { "capability": [ { "name": "AllowDnsSuffixModification", "value":
"true" } ], "name": "Dns" }, { "capability": [ { "name": "SupportedProtocols", "value": "tcp,
udp" }, { "name": "SupportedLbAlgorithms", "value": "roundrobin,leastconn,source" } ], "name":
"Lb" }, { "name": "Gateway" }, { "name": "Dhcp" }, { "capability": [ { "name": "SupportedVpnTypes",
"value": "pptp,l2tp,ipsec" } ], "name": "Vpn" }, { "capability": [ { "name": "MultipleIps",
"value": "true" }, { "name": "SupportedSourceNatTypes", "value": "per account" }, { "name":
"SupportedProtocols", "value": "tcp,udp,icmp" }, { "name": "TrafficStatistics", "value": "per
public ip" }, { "name": "PortForwarding", "value": "true" }, { "name": "StaticNat", "value":
"true" } ], "name": "Firewall" } ], "state": "Implemented", "traffictype": "Guest", "type":
"Virtual", "zoneid": 1 } ] } }

http://git-wip-us.apache.org/repos/asf/libcloud/blob/e72e2a5a/libcloud/test/compute/fixtures/cloudstack/listServiceOfferings_rootdisksize.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/cloudstack/listServiceOfferings_rootdisksize.json
b/libcloud/test/compute/fixtures/cloudstack/listServiceOfferings_rootdisksize.json
new file mode 100644
index 0000000..944a6f2
--- /dev/null
+++ b/libcloud/test/compute/fixtures/cloudstack/listServiceOfferings_rootdisksize.json
@@ -0,0 +1 @@
+{ "listserviceofferingsresponse" : {"count": 3, "serviceoffering": [ {"cpunumber": 2, "cpuspeed":
1600, "created": "2011-09-09T13:14:19+0900", "defaultuse": false, "displaytext": "M4", "id":
21, "issystem": false, "limitcpuuse": true, "memory": 4096, "name": "M4", "networkrate": 500,
"offerha": false, "storagetype": "shared", "tags": "Shared.auto"}, {"cpunumber": 1, "cpuspeed":
800, "created": "2011-09-09T13:17:52+0900", "defaultuse": false, "displaytext": "XS", "id":
24, "issystem": false, "limitcpuuse": true, "memory": 512, "name": "XS", "networkrate": 100,
"offerha": false, "storagetype": "shared", "tags": "Shared.auto"}, {"cpunumber": 1, "cpuspeed":
1600, "created": "2011-09-14T22:51:23+0900", "defaultuse": false, "displaytext": "S2", "id":
30, "issystem": false, "limitcpuuse": true, "memory": 2048, "name": "S2", "networkrate": 500,
"offerha": false, "storagetype": "shared", "tags": "Shared.auto"}]}}

http://git-wip-us.apache.org/repos/asf/libcloud/blob/e72e2a5a/libcloud/test/compute/fixtures/cloudstack/listTemplates_rootdisksize.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/cloudstack/listTemplates_rootdisksize.json b/libcloud/test/compute/fixtures/cloudstack/listTemplates_rootdisksize.json
new file mode 100644
index 0000000..656eb6f
--- /dev/null
+++ b/libcloud/test/compute/fixtures/cloudstack/listTemplates_rootdisksize.json
@@ -0,0 +1 @@
+{ "listtemplatesresponse" : {"count": 2, "template": [ {"account": "admin", "created": "2014-06-06T20:08:49+0900",
"crossZones": false, "displaytext": "CentOS 6.5", "domain": "ROOT", "domainid": 1, "format":
"QCOW2", "hypervisor": "KVM", "id": 8028, "isextractable": true, "isfeatured": true, "ispublic":
true, "isready": true, "name": "CentOS 6.5 64-bit", "ostypeid": 112, "ostypename": "CentOS
5.5 (64-bit)", "passwordenabled": true, "size": 16106127360, "status": "Download Complete",
"templatetype": "USER", "zoneid": 2, "zonename": "zone2"}, {"account": "admin", "created":
"2014-06-06T20:08:48+0900", "crossZones": false, "displaytext": "CentOS 6.5", "domain": "ROOT",
"domainid": 1, "format": "QCOW2", "hypervisor": "KVM", "id": 8028, "isextractable": true,
"isfeatured": true, "ispublic": true, "isready": true, "name": "CentOS 6.5 64-bit", "ostypeid":
112, "ostypename": "CentOS 5.5 (64-bit)", "passwordenabled": true, "size": 16106127360, "status":
"Download Complete", "templatetype": "
 USER", "zoneid": 1, "zonename": "zone1"} ]} }

http://git-wip-us.apache.org/repos/asf/libcloud/blob/e72e2a5a/libcloud/test/compute/fixtures/cloudstack/listVolumes_rootdisksize.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/cloudstack/listVolumes_rootdisksize.json b/libcloud/test/compute/fixtures/cloudstack/listVolumes_rootdisksize.json
new file mode 100644
index 0000000..f3bbb0a
--- /dev/null
+++ b/libcloud/test/compute/fixtures/cloudstack/listVolumes_rootdisksize.json
@@ -0,0 +1 @@
+{ "listvolumesresponse" : { "count":1 ,"volume" : [  {"id":"fe1ada16-57a0-40ae-b577-01a153690fb4","name":"ROOT-69941","zoneid":"7dbc4787-ec2f-498d-95f0-848c8c81e5da","zonename":"test","type":"ROOT","deviceid":0,"virtualmachineid":"3239ade9-fd25-405c-8eda-59f0313a3fb0","vmname":"rootdisksize","vmdisplayname":"rootdisksize","vmstate":"Stopped","size":53687091200,"created":"2013-04-16T16:25:57-0700","state":"Ready","account":"testuser","domainid":"41a4917b-7952-499d-ba7f-4c57464d3dc8","domain":"ROOT","storagetype":"local","hypervisor":"KVM","storage":"c24232.test.com","destroyed":false,"serviceofferingid":"7cc4f8c3-7c56-4155-9916-9f42072ea712","serviceofferingname":"Tiny","serviceofferingdisplaytext":"Tiny
(1 core, 1GB RAM)","isextractable":false} ] } }

http://git-wip-us.apache.org/repos/asf/libcloud/blob/e72e2a5a/libcloud/test/compute/fixtures/cloudstack/listZones_rootdisksize.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/cloudstack/listZones_rootdisksize.json b/libcloud/test/compute/fixtures/cloudstack/listZones_rootdisksize.json
new file mode 100644
index 0000000..b072749
--- /dev/null
+++ b/libcloud/test/compute/fixtures/cloudstack/listZones_rootdisksize.json
@@ -0,0 +1 @@
+{ "listzonesresponse" : { "count":2 ,"zone" : [  {"id":1,"name":"zone1","networktype":"Advanced","securitygroupsenabled":false,"allocationstate":"Enabled","zonetoken":"6a3bfa26-67cd-3ff2-867e-20e86b211bb1","dhcpprovider":"VirtualRouter"},
{"id":2,"name":"zone2","networktype":"Advanced","securitygroupsenabled":false,"allocationstate":"Enabled","zonetoken":"8366e550-542d-373d-88e3-ca7c90bc8e6c","dhcpprovider":"VirtualRouter"}
] } }

http://git-wip-us.apache.org/repos/asf/libcloud/blob/e72e2a5a/libcloud/test/compute/fixtures/cloudstack/queryAsyncJobResult_deployrootdisksize.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/cloudstack/queryAsyncJobResult_deployrootdisksize.json
b/libcloud/test/compute/fixtures/cloudstack/queryAsyncJobResult_deployrootdisksize.json
new file mode 100644
index 0000000..5ac2fe1
--- /dev/null
+++ b/libcloud/test/compute/fixtures/cloudstack/queryAsyncJobResult_deployrootdisksize.json
@@ -0,0 +1 @@
+{ "queryasyncjobresultresponse" : {"jobid":"deployrootdisksize", "jobprocstatus": 0, "jobresult":
{"virtualmachine": {"account": "testuser", "cpunumber": 2, "cpuspeed": 1600, "created": "2014-07-06T16:40:39+0900",
"displayname": "rootdisksize", "domain": "ROOT", "domainid": 1623, "guestosid": 112, "haenable":
false, "hypervisor": "KVM", "id": 65285, "memory": 4096, "name": "rootdisksize", "nic": [{"gateway":
"10.1.0.1", "id": 87320, "ipaddress": "10.1.0.128", "isdefault": true, "macaddress": "02:00:78:4a:01:9e",
"netmask": "255.255.252.0", "networkid": 1374, "traffictype": "Guest", "type": "Virtual"},
{"gateway": "192.168.2.254", "id": 87319, "ipaddress": "192.168.2.55", "isdefault": false,
"macaddress": "06:e6:50:00:70:0e", "netmask": "255.255.255.0", "networkid": 1823, "traffictype":
"Guest", "type": "Direct"}], "password": "password", "passwordenabled": true, "rootdeviceid":
0, "rootdevicetype": "VMFS", "securitygroup": [], "serviceofferingid": 21, "serviceofferingname":
"M4", "s
 tate": "Stopped" , "templatedisplaytext": "CentOS 6.5", "templateid": 8028, "templatename":
"CentOS 6.5 64-bit", "zoneid": 1, "zonename": "zone1"}}, "jobresultcode": 0, "jobresulttype":
"object", "jobstatus": 1} }

http://git-wip-us.apache.org/repos/asf/libcloud/blob/e72e2a5a/libcloud/test/compute/test_cloudstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_cloudstack.py b/libcloud/test/compute/test_cloudstack.py
index 49da109..413bdcd 100644
--- a/libcloud/test/compute/test_cloudstack.py
+++ b/libcloud/test/compute/test_cloudstack.py
@@ -150,6 +150,31 @@ class CloudStackCommonTestCase(TestCaseMixin):
         self.assertEqual(node.extra['image_id'], image.id)
         self.assertEqual(node.private_ips[0], ipaddress)
 
+    def test_create_node_ex_rootdisksize(self):
+        CloudStackMockHttp.fixture_tag = 'rootdisksize'
+        size = self.driver.list_sizes()[0]
+        image = self.driver.list_images()[0]
+        location = self.driver.list_locations()[0]
+        volumes = self.driver.list_volumes()
+        rootdisksize = '50'
+
+        networks = [nw for nw in self.driver.ex_list_networks()
+                    if str(nw.zoneid) == str(location.id)]
+
+        node = self.driver.create_node(name='rootdisksize',
+                                       location=location,
+                                       image=image,
+                                       size=size,
+                                       networks=networks,
+                                       ex_rootdisksize=rootdisksize)
+        self.assertEqual(node.name, 'rootdisksize')
+        self.assertEqual(node.extra['size_id'], size.id)
+        self.assertEqual(node.extra['zone_id'], location.id)
+        self.assertEqual(node.extra['image_id'], image.id)
+        self.assertEqual(1, len(volumes))
+        self.assertEqual('ROOT-69941', volumes[0].name)
+        self.assertEqual(53687091200, volumes[0].size)
+
     def test_create_node_ex_start_vm_false(self):
         CloudStackMockHttp.fixture_tag = 'stoppedvm'
         size = self.driver.list_sizes()[0]


Mime
View raw message