Kami commented on a change in pull request #1558:
URL: https://github.com/apache/libcloud/pull/1558#discussion_r624758228
##########
File path: libcloud/compute/drivers/cloudsigma.py
##########
@@ -1194,19 +1207,55 @@ def create_node(self, name, size, image,
ex_metadata=None,
return node
- def destroy_node(self, node):
+ def destroy_node(self, node, delete_drives=False):
"""
Destroy the node and all the associated drives.
:return: ``True`` on success, ``False`` otherwise.
:rtype: ``bool``
"""
action = '/servers/%s/' % (node.id)
- params = {'recurse': 'all_drives'}
+ if delete_drives is True:
+ params = {'recurse': 'all_drives'}
+ else:
+ params = None
response = self.connection.request(action=action, method='DELETE',
params=params)
return response.status == httplib.NO_CONTENT
+ def reboot_node(self, node):
+ """
+ Reboot a node.
+
+ Because Cloudsigma API does not provide native reboot call,
+ it's emulated using stop and start.
+
+ :param node: Node to reboot.
+ :type node: :class:`libcloud.compute.base.Node`
+ """
+ state = node.state
+
+ if state == NodeState.RUNNING:
+ stopped = self.stop_node(node)
+ else:
+ stopped = True
+
+ if not stopped:
+ raise CloudSigmaException(
Review comment:
I guess there is no way to retrieve a better error - aka why stopping
node failes?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]