def __init__(self,
              name='',
              keys='',
              inbox=None,
              datapath=None,
              args=None,
              session=None):
     args['tenant_name'] = None
     super(PlexxiDriver, self).__init__(name, keys, inbox, datapath, args)
     self.exchange = session
     self.creds = datasource_utils.get_credentials(name, args)
     self.raw_state = {}
     self.key_index = self.create_index()
     self.name_rule = False
     self.cooldown = 0
     try:
         self.unique_names = self.string_to_bool(args['unique_names'])
     except KeyError:
         LOG.warning("unique_names has not been configured in "
                     "datasources.conf, defaulting to False.")
         self.unique_names = False
     port = str(cfg.CONF.bind_port)
     host = str(cfg.CONF.bind_host)
     self.api_address = "http://" + host + ":" + port + "/v1"
     self.initialized = True
 def get_keystone_credentials_v2(self, name, args):
     creds = datasource_utils.get_credentials(name, args)
     d = {}
     d['version'] = '2'
     d['username'] = creds['username']
     d['password'] = creds['password']
     d['auth_url'] = creds['auth_url']
     d['tenant_name'] = creds['tenant_name']
     return d
    def __init__(self, name='', keys='', inbox=None, datapath=None, args=None):
        super(GlanceV2Driver, self).__init__(name, keys, inbox, datapath, args)
        self.creds = datasource_utils.get_credentials(name, args)
        self.register_translator(GlanceV2Driver.images_translator)

        keystone = ksclient.Client(**self.creds)
        glance_endpoint = keystone.service_catalog.url_for(
            service_type='image', endpoint_type='publicURL')
        self.glance = glclient.Client(glance_endpoint,
                                      token=keystone.auth_token)
        self.initialized = True
    def __init__(self, name='', keys='', inbox=None, datapath=None, args=None):
        super(NeutronDriver, self).__init__(name, keys, inbox, datapath, args)
        self.creds = datasource_utils.get_credentials(name, args)
        self.register_translator(NeutronDriver.networks_translator)
        self.register_translator(NeutronDriver.ports_translator)
        self.register_translator(NeutronDriver.routers_translator)
        self.register_translator(NeutronDriver.security_groups_translator)
        self.neutron = neutronclient.v2_0.client.Client(**self.creds)

        # Store raw state (result of API calls) so that we can
        #   avoid re-translating and re-sending if no changes occurred.
        #   Because translation is not deterministic (we're generating
        #   UUIDs), it's hard to tell if no changes occurred
        #   after performing the translation.
        self.raw_state = {}
        self.initialized = True
Exemple #5
0
 def __init__(self,
              name='',
              keys='',
              inbox=None,
              datapath=None,
              args=None,
              session=None):
     if args is None:
         args = self.empty_credentials()
     else:
         args['tenant_name'] = None
     super(VCenterDriver, self).__init__(name, keys, inbox, datapath, args)
     self.register_translator(VCenterDriver.hosts_translator)
     self.register_translator(VCenterDriver.pnic_translator)
     self.register_translator(VCenterDriver.vnic_translator)
     self.register_translator(VCenterDriver.vms_translator)
     try:
         self.max_VMs = int(args['max_vms'])
     except (KeyError, ValueError):
         LOG.warning("max_vms has not been configured in "
                     "datasources.conf, defaulting to 999.")
         self.max_VMs = 999
     try:
         self.max_Hosts = int(args['max_hosts'])
     except (KeyError, ValueError):
         LOG.warning("max_hosts has not been configured in "
                     "datasources.conf, defaulting to 999.")
         self.max_Hosts = 999
     self.raw_state = {}
     self.creds = datasource_utils.get_credentials(name, args)
     if session is None:
         self.session = api.VMwareAPISession(self.creds['auth_url'],
                                             self.creds['username'],
                                             self.creds['password'],
                                             10,
                                             1,
                                             create_session=True)
     self.initialized = True