In OpenStack Havana, when you launch a new instance via the web interface, it gives you a choice of which virtual networks to connect to the instance. (This is under Launch Instance->Networking.) The user picks one or more networks to associate with the instance.
When I try to launch instances via the EC2Connection.run_instances(), the instance always connects to all available networks, and the Instance data structure randomly chooses one of them to be the primary interface. If the wrong interface is chosen, then my program fails.
I have tried forcing the by creating a network interface specification and making it the only network interface that is passed to run_instances(), but I still get the same problem.
interface = ec2.networkinterface.NetworkInterfaceSpecification(subnet_id=subnet_id,device_index=0,
groups=['default'],
associate_public_ip_address=False)
interfaces = ec2.networkinterface.NetworkInterfaceCollection(interface)
reservation = self.ec2_connection.run_instances(image_id=image.id,min_count=number_nodes, max_count=number_nodes, key_name=self.instance_key, user_data=None, instance_type=instance_type,network_interfaces=interfaces)
Any ideas?