You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@libcloud.apache.org by "Philip Schwartz (JIRA)" <ji...@apache.org> on 2011/05/11 19:33:47 UTC
[libcloud] [jira] [Created] (LIBCLOUD-85) Exception handling in cascaded
function call in ec2 create_node is needed.
Exception handling in cascaded function call in ec2 create_node is needed.
--------------------------------------------------------------------------
Key: LIBCLOUD-85
URL: https://issues.apache.org/jira/browse/LIBCLOUD-85
Project: Libcloud
Issue Type: Bug
Components: Compute
Affects Versions: 0.4.1, 0.5.0
Reporter: Philip Schwartz
In create_node for ec2, a call to ex_create_tags.
for node in nodes:
self.ex_create_tags(node=node, tags={'Name': kwargs['name']})
This should catch an exception and clean up the failed create if an exception is thrown. Currently when the ex_create_tags fails due to a node not being registered correctly yet (but created), an exception of node id does not exist is thrown. This cascades as a failure of the full call to any code calling create_node when in fact the node was created.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[libcloud] [jira] [Commented] (LIBCLOUD-85) Exception handling in cascaded
function call in ec2 create_node is needed.
Posted by "Philip Schwartz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LIBCLOUD-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13031959#comment-13031959 ]
Philip Schwartz commented on LIBCLOUD-85:
-----------------------------------------
To help, I have added the above as a pull request on github.
https://github.com/apache/libcloud/pull/12
> Exception handling in cascaded function call in ec2 create_node is needed.
> --------------------------------------------------------------------------
>
> Key: LIBCLOUD-85
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-85
> Project: Libcloud
> Issue Type: Bug
> Components: Compute
> Affects Versions: 0.4.1, 0.5.0
> Reporter: Philip Schwartz
>
> In create_node for ec2, a call to ex_create_tags.
> for node in nodes:
> self.ex_create_tags(node=node, tags={'Name': kwargs['name']})
> This should catch an exception and clean up the failed create if an exception is thrown. Currently when the ex_create_tags fails due to a node not being registered correctly yet (but created), an exception of node id does not exist is thrown. This cascades as a failure of the full call to any code calling create_node when in fact the node was created.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[libcloud] [jira] [Resolved] (LIBCLOUD-85) Exception handling in cascaded
function call in ec2 create_node is needed.
Posted by "Philip Schwartz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LIBCLOUD-85?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Philip Schwartz resolved LIBCLOUD-85.
-------------------------------------
Resolution: Fixed
Resolved with Patch in comments and github pull request.
> Exception handling in cascaded function call in ec2 create_node is needed.
> --------------------------------------------------------------------------
>
> Key: LIBCLOUD-85
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-85
> Project: Libcloud
> Issue Type: Bug
> Components: Compute
> Affects Versions: 0.4.1, 0.5.0
> Reporter: Philip Schwartz
>
> In create_node for ec2, a call to ex_create_tags.
> for node in nodes:
> self.ex_create_tags(node=node, tags={'Name': kwargs['name']})
> This should catch an exception and clean up the failed create if an exception is thrown. Currently when the ex_create_tags fails due to a node not being registered correctly yet (but created), an exception of node id does not exist is thrown. This cascades as a failure of the full call to any code calling create_node when in fact the node was created.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[libcloud] [jira] [Commented] (LIBCLOUD-85) Exception handling in cascaded
function call in ec2 create_node is needed.
Posted by "Philip Schwartz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LIBCLOUD-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13031957#comment-13031957 ]
Philip Schwartz commented on LIBCLOUD-85:
-----------------------------------------
>From df8a1465033da3bba18cd7cb09306e85f8a0ec34 Mon Sep 17 00:00:00 2001
From: Philip Schwartz <ph...@lexisnexis.com>
Date: Wed, 11 May 2011 14:54:39 -0400
Subject: [PATCH] LIBCLOUD-85: fixed - Added exception handling for failed call to ex_create_tags on create_node. Except block destroys the hanging node that did not create with the Name tag as requested.
---
libcloud/compute/drivers/ec2.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 7805cd0..f45921d 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -822,7 +822,11 @@ class EC2NodeDriver(NodeDriver):
nodes = self._to_nodes(object, 'instancesSet/item')
for node in nodes:
- self.ex_create_tags(node=node, tags={'Name': kwargs['name']})
+ try:
+ self.ex_create_tags(node=node, tags={'Name': kwargs['name']})
+ except Exception as err:
+ self.destroy_node(node)
+ raise Exception("Create Node failed due to call to ex_create_tags, destroying node: " + node.id)
if len(nodes) == 1:
return nodes[0]
--
1.7.0.4
> Exception handling in cascaded function call in ec2 create_node is needed.
> --------------------------------------------------------------------------
>
> Key: LIBCLOUD-85
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-85
> Project: Libcloud
> Issue Type: Bug
> Components: Compute
> Affects Versions: 0.4.1, 0.5.0
> Reporter: Philip Schwartz
>
> In create_node for ec2, a call to ex_create_tags.
> for node in nodes:
> self.ex_create_tags(node=node, tags={'Name': kwargs['name']})
> This should catch an exception and clean up the failed create if an exception is thrown. Currently when the ex_create_tags fails due to a node not being registered correctly yet (but created), an exception of node id does not exist is thrown. This cascades as a failure of the full call to any code calling create_node when in fact the node was created.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[libcloud] [jira] [Commented] (LIBCLOUD-85) Exception handling in cascaded
function call in ec2 create_node is needed.
Posted by "Tomaz Muraus (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LIBCLOUD-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13032327#comment-13032327 ]
Tomaz Muraus commented on LIBCLOUD-85:
--------------------------------------
Hey, thank you for your patch.
We have already talked about this on IRC and imo we need better mechanism for retrying calls which fail due to I/O or API error.
In this case it is also possible the that node is not destroyed because destroy_node() call fails.
I would probably be OK with a some kind of "retry" context manager which would retry a function call if it fails due to I/O API error. It should also be easy to adjust the maximum number of retries and delay between them.
> Exception handling in cascaded function call in ec2 create_node is needed.
> --------------------------------------------------------------------------
>
> Key: LIBCLOUD-85
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-85
> Project: Libcloud
> Issue Type: Bug
> Components: Compute
> Affects Versions: 0.4.1, 0.5.0
> Reporter: Philip Schwartz
>
> In create_node for ec2, a call to ex_create_tags.
> for node in nodes:
> self.ex_create_tags(node=node, tags={'Name': kwargs['name']})
> This should catch an exception and clean up the failed create if an exception is thrown. Currently when the ex_create_tags fails due to a node not being registered correctly yet (but created), an exception of node id does not exist is thrown. This cascades as a failure of the full call to any code calling create_node when in fact the node was created.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira