You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2015/10/09 19:22:56 UTC
[1/2] libcloud git commit: Adding ex_terminate_on_shutdown to ec2
compute driver
Repository: libcloud
Updated Branches:
refs/heads/trunk b3d6d9f38 -> 24adc1e89
Adding ex_terminate_on_shutdown to ec2 compute driver
To support termination of the instance if the OS shutdown
command is called
Closes #595
Signed-off-by: Tomaz Muraus <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/317c4a34
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/317c4a34
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/317c4a34
Branch: refs/heads/trunk
Commit: 317c4a348adbf0c7aee38d425971378a22cdd1c7
Parents: b3d6d9f
Author: Kyle Long <ui...@gmail.com>
Authored: Fri Oct 9 09:55:43 2015 -0500
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Oct 9 18:01:18 2015 +0200
----------------------------------------------------------------------
libcloud/compute/drivers/ec2.py | 10 ++++++++++
libcloud/test/compute/test_ec2.py | 20 ++++++++++++++++++++
2 files changed, 30 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/317c4a34/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index dfeee7c..74c44b8 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -2321,6 +2321,13 @@ class BaseEC2NodeDriver(NodeDriver):
node returned will NOT have
the public ip assigned yet.
:type ex_assign_public_ip: ``bool``
+
+ :keyword ex_terminate_on_shutdown: Indicates if the instance
+ should be terminated instead
+ of just shut down when using
+ the operating systems command
+ for system shutdown.
+ :type ex_terminate_on_shutdown: ``bool``
"""
image = kwargs["image"]
size = kwargs["size"]
@@ -2332,6 +2339,9 @@ class BaseEC2NodeDriver(NodeDriver):
'InstanceType': size.id
}
+ if kwargs.get("ex_terminate_on_shutdown", False):
+ params["InstanceInitiatedShutdownBehavior"] = "terminate"
+
if 'ex_security_groups' in kwargs and 'ex_securitygroup' in kwargs:
raise ValueError('You can only supply ex_security_groups or'
' ex_securitygroup')
http://git-wip-us.apache.org/repos/asf/libcloud/blob/317c4a34/libcloud/test/compute/test_ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index a1ff899..3f74cec 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -136,6 +136,18 @@ class EC2Tests(LibcloudTestCase, TestCaseMixin):
ex_assign_public_ip=True,
)
+ def test_create_node_with_ex_terminate_on_shutdown(self):
+ EC2MockHttp.type = 'create_ex_terminate_on_shutdown'
+ image = NodeImage(id='ami-be3adfd7',
+ name=self.image_name,
+ driver=self.driver)
+ size = NodeSize('m1.small', 'Small Instance', None, None, None, None,
+ driver=self.driver)
+
+ # The important part about the test is asserted inside
+ # EC2MockHttp._create_ex_terminate_on_shutdown
+ self.driver.create_node(name='foo', image=image, size=size, ex_terminate_on_shutdown=True)
+
def test_create_node_with_metadata(self):
image = NodeImage(id='ami-be3adfd7',
name=self.image_name,
@@ -1276,6 +1288,14 @@ class EC2MockHttp(MockHttpTestCase):
body = self.fixtures.load('run_instances_with_subnet_and_security_group.xml')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+ def _create_ex_terminate_on_shutdown_RunInstances(self, method, url, body, headers):
+ self.assertUrlContainsQueryParams(url, {
+ 'InstanceInitiatedShutdownBehavior': 'terminate'
+ })
+
+ body = self.fixtures.load('run_instances.xml')
+ return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
def _ex_security_groups_RunInstances(self, method, url, body, headers):
self.assertUrlContainsQueryParams(url, {'SecurityGroup.1': 'group1'})
self.assertUrlContainsQueryParams(url, {'SecurityGroup.2': 'group2'})
[2/2] libcloud git commit: Update changelog.
Posted by to...@apache.org.
Update changelog.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/24adc1e8
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/24adc1e8
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/24adc1e8
Branch: refs/heads/trunk
Commit: 24adc1e892d829b9213d517d9d521dc1b70f18ef
Parents: 317c4a3
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Oct 9 18:14:15 2015 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Oct 9 18:14:15 2015 +0200
----------------------------------------------------------------------
CHANGES.rst | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/24adc1e8/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index c53945c..d6c2628 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -71,6 +71,11 @@ Compute
(GITHUB-590)
[Kyle Long]
+- Added ``ex_terminate_on_shutdown`` argument to ``create_node`` in the EC2
+ driver.
+ (GITHUB-595)
+ [Kyle Long]
+
Storage
~~~~~~~