diff --git a/doc/pool_mgm/config.rst b/doc/pool_mgm/config.rst index a736ac38..d0c3d42e 100644 --- a/doc/pool_mgm/config.rst +++ b/doc/pool_mgm/config.rst @@ -78,6 +78,10 @@ Command Line Options The image ID or name to use on new nodes spun up in the Nova API + .. option:: --nova_net_id + + Specify which Neutron Network ID workers should be started with. + .. option:: --nova_image_size The flavor ID (image size ID) or name to use for new nodes spun up in diff --git a/libra/mgm/mgm.py b/libra/mgm/mgm.py index 26c8d36b..49519a84 100644 --- a/libra/mgm/mgm.py +++ b/libra/mgm/mgm.py @@ -114,6 +114,10 @@ def main(): '--nova_bypass_url', help='use a different URL to the one supplied by the service' ) + options.parser.add_argument( + '--nova_net_id', + help="The ID of the network to put loadbalancer on" + "(Required if multiple Neutron networks)") options.parser.add_argument( '--gearman', action='append', metavar='HOST:PORT', default=[], help='Gearman job servers' diff --git a/libra/mgm/nova.py b/libra/mgm/nova.py index 9bbdbecc..8c59b377 100644 --- a/libra/mgm/nova.py +++ b/libra/mgm/nova.py @@ -52,6 +52,7 @@ class Node(object): self.secgroup = args.nova_secgroup self.node_basename = args.node_basename self.az = args.nova_az_name + self.net_id = args.nova_net_id self.rm_fip_ignore_500 = args.rm_fip_ignore_500 # Replace '_' with '-' in basename @@ -144,6 +145,11 @@ class Node(object): node_name = '{0}-{1}'.format(self.node_basename, node_id) else: node_name = '{0}'.format(node_id) + + networks = [] + if self.net_id: + networks.append({"uuid": self.net_id}) + body = {"server": { "name": node_name, "imageRef": self.image, @@ -152,7 +158,7 @@ class Node(object): "max_count": 1, "min_count": 1, "availability_zone": self.az, - "networks": [], + "networks": networks, "security_groups": [{"name": self.secgroup}] }} resp, body = self.nova.post(url, body=body)