[ARVADOS] created: 70f2a361c8029ee7e8616a34d61d0e45f6c29d98
git at public.curoverse.com
git at public.curoverse.com
Mon Mar 2 10:42:57 EST 2015
at 70f2a361c8029ee7e8616a34d61d0e45f6c29d98 (commit)
commit 70f2a361c8029ee7e8616a34d61d0e45f6c29d98
Author: Brett Smith <brett at curoverse.com>
Date: Mon Mar 2 10:37:42 2015 -0500
5313: Node Manager's GCE driver destroys boot disks reliably.
This more closely matches the behavior of the EC2 driver, which we
want.
* Upgrade to libcloud 0.16, which adds an ex_disk_auto_delete argument
to GCE's create_node method, with True as the default.
* Set destroy_boot_disk=True when calling destroy_node().
diff --git a/services/nodemanager/arvnodeman/computenode/driver/gce.py b/services/nodemanager/arvnodeman/computenode/driver/gce.py
index 280de98..689105c 100644
--- a/services/nodemanager/arvnodeman/computenode/driver/gce.py
+++ b/services/nodemanager/arvnodeman/computenode/driver/gce.py
@@ -84,6 +84,10 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
super(ComputeNodeDriver, self).list_nodes()
if self.node_tags.issubset(node.extra.get('tags', []))]
+ def destroy_node(self, cloud_node):
+ return super(ComputeNodeDriver, self).destroy_node(
+ cloud_node, destroy_boot_disk=True)
+
@classmethod
def _find_metadata(cls, metadata_items, key):
# Given a list of two-item metadata dictonaries, return the one with
diff --git a/services/nodemanager/setup.py b/services/nodemanager/setup.py
index 6830e80..d9fcbcf 100644
--- a/services/nodemanager/setup.py
+++ b/services/nodemanager/setup.py
@@ -25,7 +25,7 @@ setup(name='arvados-node-manager',
license='GNU Affero General Public License, version 3.0',
packages=find_packages(),
install_requires=[
- 'apache-libcloud',
+ 'apache-libcloud>=0.16',
'arvados-python-client>=0.1.20150206225333',
'pykka',
'python-daemon',
diff --git a/services/nodemanager/tests/test_computenode_driver_gce.py b/services/nodemanager/tests/test_computenode_driver_gce.py
index 080c9bb..fbb0c82 100644
--- a/services/nodemanager/tests/test_computenode_driver_gce.py
+++ b/services/nodemanager/tests/test_computenode_driver_gce.py
@@ -73,6 +73,12 @@ class GCEComputeNodeDriverTestCase(testutil.DriverTestMixin, unittest.TestCase):
driver = self.new_driver(list_kwargs={'tags': 'good, great'})
self.assertItemsEqual(['5', '6'], [n.id for n in driver.list_nodes()])
+ def test_destroy_node_destroys_disk(self):
+ driver = self.new_driver()
+ driver.destroy_node(testutil.cloud_node_mock())
+ self.assertTrue(self.driver_mock().destroy_node.call_args[1].get(
+ 'destroy_boot_disk'))
+
def build_gce_metadata(self, metadata_dict):
# Convert a plain metadata dictionary to the GCE data structure.
return {
commit a8ac39264817dddf73bf763bbafb944d44aa132c
Author: Brett Smith <brett at curoverse.com>
Date: Mon Mar 2 10:29:14 2015 -0500
5313: Rename Node Manager's `user-data` GCE tag to `arv-ping-url`.
`user-data` is an EC2-specific name. `arv-ping-url` more clearly
describes what's in it.
diff --git a/services/nodemanager/arvnodeman/computenode/driver/gce.py b/services/nodemanager/arvnodeman/computenode/driver/gce.py
index d6ea2b2..280de98 100644
--- a/services/nodemanager/arvnodeman/computenode/driver/gce.py
+++ b/services/nodemanager/arvnodeman/computenode/driver/gce.py
@@ -70,10 +70,11 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
result = {'name': 'compute-{}-{}'.format(node_id, cluster_id),
'ex_metadata': self.create_kwargs['ex_metadata'].copy(),
'ex_tags': list(self.node_tags)}
+ result['ex_metadata']['arv-ping-url'] = self._make_ping_url(
+ arvados_node)
result['ex_metadata']['booted_at'] = time.strftime(ARVADOS_TIMEFMT,
time.gmtime())
result['ex_metadata']['hostname'] = arvados_node_fqdn(arvados_node)
- result['ex_metadata']['user-data'] = self._make_ping_url(arvados_node)
return result
def list_nodes(self):
diff --git a/services/nodemanager/tests/test_computenode_driver_gce.py b/services/nodemanager/tests/test_computenode_driver_gce.py
index f995a8d..080c9bb 100644
--- a/services/nodemanager/tests/test_computenode_driver_gce.py
+++ b/services/nodemanager/tests/test_computenode_driver_gce.py
@@ -41,7 +41,7 @@ class GCEComputeNodeDriverTestCase(testutil.DriverTestMixin, unittest.TestCase):
driver = self.new_driver()
driver.create_node(testutil.MockSize(1), arv_node)
metadata = self.driver_mock().create_node.call_args[1]['ex_metadata']
- self.assertIn('ping_secret=ssshh', metadata.get('user-data'))
+ self.assertIn('ping_secret=ssshh', metadata.get('arv-ping-url'))
def test_create_sets_default_hostname(self):
driver = self.new_driver()
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list