Example #1
0
 def _connect_to_openstack(self):
     insecure = bool(os.getenv('OS_INSECURE',True))
     self.obj = mynovaclient.Client('2',
                                    username=self.username,
                                    project_id=self.project_name,
                                    api_key=self.password,
                                    auth_url=self.auth_url,
                                    insecure=insecure,
                                    endpoint_type=self.endpoint_type,
                                    region_name=self.region_name
                                   )
     if 'keypair' not in env:
         env.keypair = dict()
     if not env.keypair.get(self.key, False):
         try:
             f = '/tmp/%s'%self.key
             lock = Lock(f)
             lock.acquire()
             env.keypair[self.key] = self._create_keypair(self.key)
         finally:
             lock.release()
     self.compute_nodes = self.get_compute_host()
     self.zones = [self.zone] if self.zone else self._list_zones()
     self.hosts_list = []
     self.hosts_dict = self._list_hosts()
Example #2
0
 def _connect_to_openstack(self):
     self.obj = mynovaclient.Client(
         '2',
         session=self.auth_h.get_session(scope='project'),
         region_name=self.region_name)
     self.hack_for_liberty_novaclient()
     if 'keypair' not in env:
         env.keypair = dict()
     if not env.keypair.get(self.key, False):
         try:
             f = '/tmp/%s' % self.key
             lock = Lock(f)
             lock.acquire()
             env.keypair[self.key] = self._create_keypair(self.key)
         finally:
             lock.release()
     self.compute_nodes = self.get_compute_host()
Example #3
0
 def _connect_to_openstack(self):
     insecure = bool(os.getenv('OS_INSECURE', True))
     self.obj = mynovaclient.Client('2',
                                    username=self.username,
                                    project_id=self.project_name,
                                    api_key=self.password,
                                    auth_url=self.auth_url,
                                    insecure=insecure,
                                    endpoint_type=self.endpoint_type)
     try:
         f = '/tmp/key%s' % self.inputs.stack_user
         lock = Lock(f)
         lock.acquire()
         self._create_keypair(self.key)
     finally:
         lock.release()
     self.compute_nodes = self.get_compute_host()
     self.zones = self._list_zones()
     self.hosts = self._list_hosts()