Author: hbetts
Date: Wed Dec 21 05:43:06 2011
New Revision: 1221618
URL: http://svn.apache.org/viewvc?rev=1221618&view=rev
Log:
Current OpenNebula OCCI implementation does not support a proper restart
method. Rather it suspends and resumes. Therefore, restart_node has been
removed from the OpenNebula driver.
Modified:
libcloud/trunk/CHANGES
libcloud/trunk/libcloud/compute/drivers/opennebula.py
libcloud/trunk/test/compute/test_opennebula.py
Modified: libcloud/trunk/CHANGES
URL:
http://svn.apache.org/viewvc/libcloud/trunk/CHANGES?rev=1221618&r1=1221617&r2=1221618&view=diff
==============================================================================
--- libcloud/trunk/CHANGES (original)
+++ libcloud/trunk/CHANGES Wed Dec 21 05:43:06 2011
@@ -19,6 +19,11 @@ Changes with Apache Libcloud in developm
'auth_version' is used.
[Tomaz Muraus]
+ - Current OpenNebula OCCI implementation does not support a proper
+ restart method. Rather it suspends and resumes. Therefore, restart_node
+ has been removed from the OpenNebula driver.
+ [Hutson Betts]
+
*) Storage:
- Propagate extra keyword arguments passed to the Rackspace driver
Modified: libcloud/trunk/libcloud/compute/drivers/opennebula.py
URL:
http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/opennebula.py?rev=1221618&r1=1221617&r2=1221618&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/opennebula.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/opennebula.py Wed Dec 21 05:43:06
2011
@@ -55,10 +55,34 @@ DEFAULT_API_VERSION = '3.2'
class ACTION(object):
+ # The VM is stopped, and its memory state stored to a checkpoint file.
+ # VM state, and disk image, has been transferred back to the front-end.
+ # Resuming the VM requires the VM instance to be re-scheduled.
STOP = 'STOPPED'
- PAUSE = 'SUSPENDED'
+
+ # The VM is stopped, and its memory state stored to a checkpoint file.
+ # The VM state, and disk image, are left on the host to later resume the
+ # VM there. Resuming the VM does not require the VM to be re-scheduled.
+ # Rather, after suspending, the VM resources are reserved for later
+ # resuming.
+ SUSPEND = 'SUSPENDED'
+
+ # The VM is resumed using the saved memory state from the checkpoint file,
+ # and the VM's disk image. The VM is either started immediately, or
+ # re-scheduled depending on how it was suspended.
RESUME = 'RESUME'
+ # The VM is forcibly shutdown, its memory state and disk image are deleted.
+ CANCEL = 'CANCEL'
+
+ # The VM is gracefully shutdown by sending the ACPI signal. If the VM does
+ # not shutdown, then it is considered to still be running. If successfully,
+ # shutdown, its memory state and disk image are deleted.
+ SHUTDOWN = 'SHUTDOWN'
+
+ # The VM is forcibly shutdown, its memory state and disk image are deleted.
+ DONE = 'DONE'
+
class OpenNebulaResponse(XmlResponse):
"""
@@ -294,15 +318,6 @@ class OpenNebulaNodeDriver(NodeDriver):
return resp.status == httplib.OK
- def reboot_node(self, node):
- if not self.ex_node_action(node, ACTION.STOP):
- return False
-
- if not self.ex_node_action(node, ACTION.RESUME):
- return False
-
- return True
-
def list_nodes(self):
return self._to_nodes(self.connection.request('/compute').object)
Modified: libcloud/trunk/test/compute/test_opennebula.py
URL:
http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_opennebula.py?rev=1221618&r1=1221617&r2=1221618&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_opennebula.py (original)
+++ libcloud/trunk/test/compute/test_opennebula.py Wed Dec 21 05:43:06 2011
@@ -38,6 +38,11 @@ from test.compute import TestCaseMixin
from test.secrets import OPENNEBULA_PARAMS
+class OpenNebulaCaseMixin(TestCaseMixin):
+ def test_reboot_node_response(self):
+ pass
+
+
class OpenNebula_ResponseTests(unittest.TestCase):
XML = """<?xml version="1.0" encoding="UTF-8"?><root/>"""
@@ -53,7 +58,7 @@ class OpenNebula_ResponseTests(unittest.
self.assertEqual(exceptionType, type(InvalidCredsError()))
-class OpenNebula_1_4_Tests(unittest.TestCase, TestCaseMixin):
+class OpenNebula_1_4_Tests(unittest.TestCase, OpenNebulaCaseMixin):
"""
OpenNebula.org test suite for OpenNebula v1.4.
"""
@@ -106,14 +111,6 @@ class OpenNebula_1_4_Tests(unittest.Test
ret = self.driver.destroy_node(node)
self.assertTrue(ret)
- def test_reboot_node(self):
- """
- Test reboot_node functionality.
- """
- node = Node(5, None, None, None, None, self.driver)
- ret = self.driver.reboot_node(node)
- self.assertTrue(ret)
-
def test_list_nodes(self):
"""
Test list_nodes functionality.
@@ -242,7 +239,7 @@ class OpenNebula_1_4_Tests(unittest.Test
self.assertTrue(ret)
-class OpenNebula_2_0_Tests(unittest.TestCase, TestCaseMixin):
+class OpenNebula_2_0_Tests(unittest.TestCase, OpenNebulaCaseMixin):
"""
OpenNebula.org test suite for OpenNebula v2.0 through v2.2.
"""
@@ -306,14 +303,6 @@ class OpenNebula_2_0_Tests(unittest.Test
ret = self.driver.destroy_node(node)
self.assertTrue(ret)
- def test_reboot_node(self):
- """
- Test reboot_node functionality.
- """
- node = Node(5, None, None, None, None, self.driver)
- ret = self.driver.reboot_node(node)
- self.assertTrue(ret)
-
def test_list_nodes(self):
"""
Test list_nodes functionality.
@@ -342,8 +331,10 @@ class OpenNebula_2_0_Tests(unittest.Test
self.assertEqual(node.size.id, '1')
self.assertEqual(node.size.name, 'small')
self.assertEqual(node.size.ram, 1024)
- self.assertTrue(node.size.cpu is None or isinstance(node.size.cpu,
int))
- self.assertTrue(node.size.vcpu is None or isinstance(node.size.vcpu,
int))
+ self.assertTrue(node.size.cpu is None or isinstance(node.size.cpu,
+ int))
+ self.assertTrue(node.size.vcpu is None or isinstance(node.size.vcpu,
+ int))
self.assertEqual(node.size.cpu, 1)
self.assertEqual(node.size.vcpu, None)
self.assertEqual(node.size.disk, None)
@@ -378,8 +369,10 @@ class OpenNebula_2_0_Tests(unittest.Test
self.assertEqual(node.size.id, '1')
self.assertEqual(node.size.name, 'small')
self.assertEqual(node.size.ram, 1024)
- self.assertTrue(node.size.cpu is None or isinstance(node.size.cpu,
int))
- self.assertTrue(node.size.vcpu is None or isinstance(node.size.vcpu,
int))
+ self.assertTrue(node.size.cpu is None or isinstance(node.size.cpu,
+ int))
+ self.assertTrue(node.size.vcpu is None or isinstance(node.size.vcpu,
+ int))
self.assertEqual(node.size.cpu, 1)
self.assertEqual(node.size.vcpu, None)
self.assertEqual(node.size.disk, None)
@@ -517,7 +510,7 @@ class OpenNebula_2_0_Tests(unittest.Test
self.assertEqual(network.size, '256')
-class OpenNebula_3_0_Tests(unittest.TestCase, TestCaseMixin):
+class OpenNebula_3_0_Tests(unittest.TestCase, OpenNebulaCaseMixin):
"""
OpenNebula.org test suite for OpenNebula v3.0.
"""
@@ -560,7 +553,7 @@ class OpenNebula_3_0_Tests(unittest.Test
self.assertTrue(ret)
-class OpenNebula_3_2_Tests(unittest.TestCase, TestCaseMixin):
+class OpenNebula_3_2_Tests(unittest.TestCase, OpenNebulaCaseMixin):
"""
OpenNebula.org test suite for OpenNebula v3.2.
"""