[ARVADOS] created: e9e20970bab27fbbeafd1b1b558a9ffb7da50435

git at public.curoverse.com git at public.curoverse.com
Tue Dec 15 14:02:45 EST 2015


        at  e9e20970bab27fbbeafd1b1b558a9ffb7da50435 (commit)


commit e9e20970bab27fbbeafd1b1b558a9ffb7da50435
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Dec 11 15:43:44 2015 -0500

    7454: Fix tests

diff --git a/services/nodemanager/tests/test_computenode_driver_azure.py b/services/nodemanager/tests/test_computenode_driver_azure.py
index 90fea0c..6f093af 100644
--- a/services/nodemanager/tests/test_computenode_driver_azure.py
+++ b/services/nodemanager/tests/test_computenode_driver_azure.py
@@ -45,7 +45,7 @@ class AzureComputeNodeDriverTestCase(testutil.DriverTestMixin, unittest.TestCase
         arv_node = testutil.arvados_node_mock(hostname=None)
         driver = self.new_driver()
         self.assertEqual('compute-000000000000063-zzzzz',
-                         driver.arvados_create_kwargs(arv_node)['name'])
+                         driver.arvados_create_kwargs(arv_node, testutil.MockSize(1))['name'])
 
     def check_node_tagged(self, cloud_node, expected_tags):
         tag_mock = self.driver_mock().ex_create_tags
diff --git a/services/nodemanager/tests/test_computenode_driver_ec2.py b/services/nodemanager/tests/test_computenode_driver_ec2.py
index d28a2a6..9131db9 100644
--- a/services/nodemanager/tests/test_computenode_driver_ec2.py
+++ b/services/nodemanager/tests/test_computenode_driver_ec2.py
@@ -51,13 +51,13 @@ class EC2ComputeNodeDriverTestCase(testutil.DriverTestMixin, unittest.TestCase):
         arv_node = testutil.arvados_node_mock(8)
         driver = self.new_driver()
         self.assertEqual('compute8.zzzzz.arvadosapi.com',
-                         driver.arvados_create_kwargs(arv_node)['name'])
+                         driver.arvados_create_kwargs(arv_node, testutil.MockSize(1))['name'])
 
     def test_default_hostname_from_new_arvados_node(self):
         arv_node = testutil.arvados_node_mock(hostname=None)
         driver = self.new_driver()
         self.assertEqual('dynamic.compute.zzzzz.arvadosapi.com',
-                         driver.arvados_create_kwargs(arv_node)['name'])
+                         driver.arvados_create_kwargs(arv_node, testutil.MockSize(1))['name'])
 
     def check_node_tagged(self, cloud_node, expected_tags):
         tag_mock = self.driver_mock().ex_create_tags

commit 87e1614724027f6a9da3f3dfaa163bd8bea4ce62
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Dec 11 15:37:55 2015 -0500

    7454: Add 'size' to arvados_create_kwargs so that it can be included in CustomData.

diff --git a/services/nodemanager/arvnodeman/computenode/driver/__init__.py b/services/nodemanager/arvnodeman/computenode/driver/__init__.py
index 06b532a..02dd3db 100644
--- a/services/nodemanager/arvnodeman/computenode/driver/__init__.py
+++ b/services/nodemanager/arvnodeman/computenode/driver/__init__.py
@@ -91,7 +91,7 @@ class BaseComputeNodeDriver(object):
     def list_nodes(self):
         return self.real.list_nodes(**self.list_kwargs)
 
-    def arvados_create_kwargs(self, arvados_node):
+    def arvados_create_kwargs(self, arvados_node, size):
         """Return dynamic keyword arguments for create_node.
 
         Subclasses must override this method.  It should return a dictionary
@@ -116,7 +116,7 @@ class BaseComputeNodeDriver(object):
 
     def create_node(self, size, arvados_node):
         kwargs = self.create_kwargs.copy()
-        kwargs.update(self.arvados_create_kwargs(arvados_node))
+        kwargs.update(self.arvados_create_kwargs(arvados_node, size))
         kwargs['size'] = size
         return self.real.create_node(**kwargs)
 
diff --git a/services/nodemanager/arvnodeman/computenode/driver/azure.py b/services/nodemanager/arvnodeman/computenode/driver/azure.py
index c390000..13e3c11 100644
--- a/services/nodemanager/arvnodeman/computenode/driver/azure.py
+++ b/services/nodemanager/arvnodeman/computenode/driver/azure.py
@@ -37,7 +37,7 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
             auth_kwargs, list_kwargs, create_kwargs,
             driver_class)
 
-    def arvados_create_kwargs(self, arvados_node):
+    def arvados_create_kwargs(self, arvados_node, size):
         cluster_id, _, node_id = arvados_node['uuid'].split('-')
         name = 'compute-{}-{}'.format(node_id, cluster_id)
         tags = {
@@ -47,9 +47,13 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
         tags.update(self.tags)
 
         customdata = """#!/bin/sh
-mkdir -p /var/tmp/arv-node-data/meta-data
+mkdir -p    /var/tmp/arv-node-data/meta-data
 echo "%s" > /var/tmp/arv-node-data/arv-ping-url
-""" % (tags['arv-ping-url'])
+echo "%s" > /var/tmp/arv-node-data/meta-data/instance-id
+echo "%s" > /var/tmp/arv-node-data/meta-data/instance-type
+""" % (tags['arv-ping-url'],
+       name,
+       size.id)
 
         return {
             'name': name,
diff --git a/services/nodemanager/arvnodeman/computenode/driver/dummy.py b/services/nodemanager/arvnodeman/computenode/driver/dummy.py
index 44ee715..b828824 100644
--- a/services/nodemanager/arvnodeman/computenode/driver/dummy.py
+++ b/services/nodemanager/arvnodeman/computenode/driver/dummy.py
@@ -31,7 +31,7 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
         if not node.private_ips:
             node.private_ips = ['10.10.0.{}'.format(node.id)]
 
-    def arvados_create_kwargs(self, arvados_node):
+    def arvados_create_kwargs(self, arvados_node, size):
         return {}
 
     def list_nodes(self):
diff --git a/services/nodemanager/arvnodeman/computenode/driver/ec2.py b/services/nodemanager/arvnodeman/computenode/driver/ec2.py
index c0a72b7..964667c 100644
--- a/services/nodemanager/arvnodeman/computenode/driver/ec2.py
+++ b/services/nodemanager/arvnodeman/computenode/driver/ec2.py
@@ -64,7 +64,7 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
     def _init_subnet_id(self, subnet_id):
         return 'ex_subnet', self.search_for(subnet_id, 'ex_list_subnets')
 
-    def arvados_create_kwargs(self, arvados_node):
+    def arvados_create_kwargs(self, arvados_node, size):
         return {'name': arvados_node_fqdn(arvados_node),
                 'ex_userdata': self._make_ping_url(arvados_node)}
 
diff --git a/services/nodemanager/arvnodeman/computenode/driver/gce.py b/services/nodemanager/arvnodeman/computenode/driver/gce.py
index e461ed5..db7b162 100644
--- a/services/nodemanager/arvnodeman/computenode/driver/gce.py
+++ b/services/nodemanager/arvnodeman/computenode/driver/gce.py
@@ -64,7 +64,7 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
             self.create_kwargs['ex_metadata']['sshKeys'] = (
                 'root:' + ssh_file.read().strip())
 
-    def arvados_create_kwargs(self, arvados_node):
+    def arvados_create_kwargs(self, arvados_node, size):
         cluster_id, _, node_id = arvados_node['uuid'].split('-')
         name = 'compute-{}-{}'.format(node_id, cluster_id)
         disks = [

commit 0a2b2a825b451ea1a84ab3d58396c953981173cf
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Dec 11 15:13:56 2015 -0500

    7454: use small CustomData script to set /var/tmp/arv-node-data/arv-ping-url

diff --git a/services/nodemanager/arvnodeman/computenode/driver/azure.py b/services/nodemanager/arvnodeman/computenode/driver/azure.py
index 20988c2..c390000 100644
--- a/services/nodemanager/arvnodeman/computenode/driver/azure.py
+++ b/services/nodemanager/arvnodeman/computenode/driver/azure.py
@@ -45,10 +45,16 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
             'arv-ping-url': self._make_ping_url(arvados_node)
         }
         tags.update(self.tags)
+
+        customdata = """#!/bin/sh
+mkdir -p /var/tmp/arv-node-data/meta-data
+echo "%s" > /var/tmp/arv-node-data/arv-ping-url
+""" % (tags['arv-ping-url'])
+
         return {
             'name': name,
             'ex_tags': tags,
-            'ex_customdata': tags['arv-ping-url']
+            'ex_customdata': customdata
         }
 
     def sync_node(self, cloud_node, arvados_node):

commit 0662b235357dd40b5d27efd06b60044ddcec06f6
Merge: 7212444 7d5d57a
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Dec 11 14:59:02 2015 -0500

    Merge branch 'master' into 7454-azure-custom-data


commit 72124442f128b2411b36c318d40d48cca9d39f4b
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Oct 1 22:29:38 2015 -0400

    7286: Use ex_customdata to put the ping URL on the node instead of
    ex_run_command.

diff --git a/services/nodemanager/arvnodeman/computenode/driver/azure.py b/services/nodemanager/arvnodeman/computenode/driver/azure.py
index ca6ed7c..2d18978 100644
--- a/services/nodemanager/arvnodeman/computenode/driver/azure.py
+++ b/services/nodemanager/arvnodeman/computenode/driver/azure.py
@@ -48,6 +48,7 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
         return {
             'name': name,
             'ex_tags': tags,
+            'ex_customdata': tags['arv-ping-url']
         }
 
     def sync_node(self, cloud_node, arvados_node):
@@ -61,20 +62,6 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
     def _init_image(self, urn):
         return "image", self.get_image(urn)
 
-    def post_create_node(self, cloud_node):
-        self.real.ex_run_command(cloud_node,
-                                 """bash -c '
-                                 mkdir -p /var/tmp/arv-node-data/meta-data
-                                 echo "%s" > /var/tmp/arv-node-data/arv-ping-url
-                                 echo "%s" > /var/tmp/arv-node-data/meta-data/instance-id
-                                 echo "%s" > /var/tmp/arv-node-data/meta-data/instance-type
-                                 echo "%s" > /var/tmp/arv-node-data/meta-data/local-ipv4
-                                 '""" % (cloud_node.extra["tags"]["arv-ping-url"],
-                                         cloud_node.id,
-                                         cloud_node.extra["properties"]["hardwareProfile"]["vmSize"],
-                                         cloud_node.private_ips[0]),
-                                 timestamp=int(time.time()))
-
     def list_nodes(self):
         # Azure only supports filtering node lists by resource group.
         # Do our own filtering based on tag.

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list