Skip to content

Commit

Permalink
Implements #618
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed May 22, 2018
1 parent bb2279f commit cbd7681
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions IM/connectors/GCE.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,16 @@ def launch(self, inf, radl, requested_radl, num_vm, auth_data):
'external_ip': None,
'location': region}

tags = {}
if system.getValue('instance_tags'):
keypairs = system.getValue('instance_tags').split(",")
for keypair in keypairs:
parts = keypair.split("=")
key = parts[0].strip()
value = parts[1].strip()
tags[key] = value
args['ex_metadata'] = tags

# include the SSH_KEYS
username = system.getValue('disk.0.os.credentials.username')
private = system.getValue('disk.0.os.credentials.private_key')
Expand Down
10 changes: 10 additions & 0 deletions IM/connectors/OpenStack.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,16 @@ def launch(self, inf, radl, requested_radl, num_vm, auth_data):
'ex_security_groups': sgs,
'name': "%s-%s" % (name, int(time.time() * 100))}

tags = {}
if system.getValue('instance_tags'):
keypairs = system.getValue('instance_tags').split(",")
for keypair in keypairs:
parts = keypair.split("=")
key = parts[0].strip()
value = parts[1].strip()
tags[key] = value
args['ex_metadata'] = tags

keypair = None
keypair_name = None
keypair_created = False
Expand Down
1 change: 1 addition & 0 deletions test/unit/connectors/GCE.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def test_20_launch(self, save_data, get_driver):
cpu.arch='x86_64' and
cpu.count=1 and
memory.size=512m and
instance_tags='key=value,key1=value2' and
net_interface.0.connection = 'net1' and
net_interface.0.dns_name = 'test' and
net_interface.1.connection = 'net2' and
Expand Down
1 change: 1 addition & 0 deletions test/unit/connectors/OpenStack.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def test_20_launch(self, save_data, get_driver):
cpu.arch='x86_64' and
cpu.count=1 and
memory.size=512m and
instance_tags='key=value,key1=value2' and
net_interface.0.connection = 'net1' and
net_interface.0.dns_name = 'test' and
net_interface.1.connection = 'net2' and
Expand Down

0 comments on commit cbd7681

Please sign in to comment.