diff options
| author | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-06-24 04:11:54 +0100 |
|---|---|---|
| committer | andy <github@anarkystic.com> | 2010-06-24 04:11:54 +0100 |
| commit | 2cf40bb3b21d33f4025f80d175a4c2ec7a2f8414 (patch) | |
| tree | 7d38befe9ec19b6668680e40bc7491f8c52cf23c | |
| parent | 34f4fa8495bca4d971872e59d358195263e72bf7 (diff) | |
| download | nova-2cf40bb3b21d33f4025f80d175a4c2ec7a2f8414.tar.gz nova-2cf40bb3b21d33f4025f80d175a4c2ec7a2f8414.tar.xz nova-2cf40bb3b21d33f4025f80d175a4c2ec7a2f8414.zip | |
Adding mpi data
| -rw-r--r-- | nova/endpoint/cloud.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 8046d42e8..74da0eea3 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -95,8 +95,21 @@ class CloudController(object): def get_instance_by_ip(self, ip): return self.instdir.by_ip(ip) + def _get_mpi_data(self, project_id): + result = {} + for node_name, node in self.instances.iteritems(): + for instance in node.values(): + if instance['project_id'] == project_id: + line = '%s slots=%d' % (instance['private_dns_name'], instance.get('vcpus', 0)) + if instance['key_name'] in result: + result[instance['key_name']].append(line) + else: + result[instance['key_name']] = [line] + return result + def get_metadata(self, ip): i = self.get_instance_by_ip(ip) + mpi = self._get_mpi_data(i['project_id']) if i is None: return None if i['key_name']: @@ -135,7 +148,8 @@ class CloudController(object): 'public-keys' : keys, 'ramdisk-id': i.get('ramdisk_id', ''), 'reservation-id': i['reservation_id'], - 'security-groups': i.get('groups', '') + 'security-groups': i.get('groups', ''), + 'mpi': mpi } } if False: # TODO: store ancestor ids |
