Commits

Mattias de Hollander committed 2809722

Added support for proxy server

  • Participants
  • Parent commits f9d42dc

Comments (0)

Files changed (2)

         if self.ud['cloud_type'] == "ec2":
             self.cloud_interface = EC2Interface(aws_access_key=self.ud['access_key'], aws_secret_key=self.ud['secret_key'], app=self)
         elif self.ud['cloud_type'] == 'opennebula':
-            self.cloud_interface = ONInterface(aws_access_key=self.ud['access_key'], aws_secret_key=self.ud['secret_key'], app=self, on_username=self.ud['on_username'], on_password=self.ud['on_password'], on_host=self.ud['on_host'])
+            self.cloud_interface = ONInterface(aws_access_key=self.ud['access_key'], aws_secret_key=self.ud['secret_key'], app=self, on_username=self.ud['on_username'], on_password=self.ud['on_password'], on_host=self.ud['on_host'], on_proxy=self.ud['on_proxy'])
         elif self.ud['cloud_type'] == 'dummy':
             self.cloud_interface = DummyInterface(aws_access_key=self.ud['access_key'], aws_secret_key=self.ud['secret_key'], app=self, on_username=self.ud['on_username'], on_password=self.ud['on_password'], on_host=self.ud['on_host'])
 

cm/clouds/opennebula.py

 
 class ONInterface(CloudInterface):
     
-    def __init__(self, aws_access_key, aws_secret_key, app=None, on_username=None, on_password=None, on_host=None):
+    def __init__(self, aws_access_key, aws_secret_key, app=None, on_username=None, on_password=None, on_host=None, on_proxy=None):
         super(ONInterface, self).__init__()
         self.aws_access_key = aws_access_key
         self.aws_secret_key = aws_secret_key
         self.on_username = on_username
         self.on_password = on_password
         self.on_host = on_host
+        self.on_proxy = on_proxy
         self.bridge = 72
 
     def _getIpAddress(self, ifname):
         if self.ec2_conn == None:
             log.debug("No OpenNebula Connection, creating a new one.")
             try:
-                self.ec2_conn = Client("%s:%s" % (self.on_username, self.on_password), self.on_host)
+                self.ec2_conn = Client("%s:%s" % (self.on_username, self.on_password), self.on_host, self.on_proxy)
                 self.ec2_conn.lookup = new.instancemethod(lookup, self.ec2_conn, self.ec2_conn.__class__)
                 self.ec2_conn.create_bucket = new.instancemethod(create_bucket, self.ec2_conn, self.ec2_conn.__class__)
 
 # Emulate EC2 objects
 
     def get_all_instances(self, filters={}, *args, **kwargs):
-        client = Client("%s:%s" % (self.on_username, self.on_password), self.on_host)
+        client = Client("%s:%s" % (self.on_username, self.on_password), self.on_host, self.on_proxy)
         vmpool = VirtualMachinePool(client)
         vmpool.info(CONNECTED)
         reservations = []