4138: GCE fixes
authorTim Pierce <twp@curoverse.com>
Fri, 23 Jan 2015 22:24:54 +0000 (17:24 -0500)
committerBrett Smith <brett@curoverse.com>
Tue, 17 Feb 2015 22:49:23 +0000 (17:49 -0500)
The 'network_id' parameter needs to be delivered as 'location' in GCE.

The ping_url parameter is now delivered in the node metadata as
'pingUrl'.

When creating a new GCE instance, 'name' is a required parameter and
must begin with a letter. The default name is the UUID of the
corresponding Arvados node, prepended with 'arv-'.

services/nodemanager/arvnodeman/computenode/driver/gce.py
services/nodemanager/doc/gce.example.cfg

index 125a0909c4450ce48ae789768bef35916669b405..a8edc432fdc068f6d4dff5d4799102b975556205 100644 (file)
@@ -37,8 +37,11 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
                 if new_pair is not None:
                     self.create_kwargs[new_pair[0]] = new_pair[1]
 
-    def _init_image_id(self, image_id):
-        return 'image', image_id
+    def _init_image(self, image_name):
+        return 'image', image_name
+
+    def _init_location(self, location):
+        return 'location', location
 
     def _init_ping_host(self, ping_host):
         self.ping_host = ping_host
@@ -46,9 +49,6 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
     def _init_service_accounts(self, service_accounts_str):
         self.service_accounts = json.loads(service_accounts_str)
 
-    def _init_network_id(self, subnet_id):
-        return 'ex_network', subnet_id
-
     def _init_ssh_key(self, filename):
         with open(filename) as ssh_file:
             self.ssh_key = ssh_file.read().strip()
@@ -60,7 +60,7 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
             ping_url = ('https://{}/arvados/v1/nodes/{}/ping?ping_secret={}'.
                         format(self.ping_host, arvados_node['uuid'],
                                ping_secret))
-            result['ex_userdata'] = ping_url
+            result['ex_metadata']['pingUrl'] = ping_url
         if self.service_accounts is not None:
             result['ex_service_accounts'] = self.service_accounts
 
@@ -70,6 +70,13 @@ class ComputeNodeDriver(BaseComputeNodeDriver):
             result['ex_metadata']['sshKeys'] = 'root:{}'.format(self.ssh_key)
         return result
 
+    def create_node(self, size, arvados_node):
+        kwargs = self.create_kwargs.copy()
+        kwargs.update(self.arvados_create_kwargs(arvados_node))
+        kwargs.setdefault('name', 'arv-{}'.format(arvados_node['uuid']))
+        kwargs['size'] = size
+        return self.real.create_node(**kwargs)
+
     # When an Arvados node is synced with a GCE node, the Arvados hostname
     # is forwarded in a GCE tag 'hostname-foo'.
     # TODO(twp): implement an ex_set_metadata method (at least until
index d9693362619c469952fc83c732d0a4ef7b865158..0d8fbb718d63b33228c6eb9e8dccebb5505492a4 100644 (file)
@@ -104,9 +104,9 @@ ping_host = hostname:port
 
 # The GCE image name and network zone name to use when creating new nodes.
 # * Valid image aliases: https://cloud.google.com/sdk/gcloud/reference/compute/instances/create
-# * Valid network zones: https://cloud.google.com/compute/docs/zones
-image_id = debian-7
-network_id = us-central1-a
+# * Valid location (zone) names: https://cloud.google.com/compute/docs/zones
+image = debian-7
+location = us-central1-a
 
 # JSON string of service account authorizations for this cluster.
 # See http://libcloud.readthedocs.org/en/latest/compute/drivers/gce.html#specifying-service-account-scopes