Exemple #1
0
 def wait_for_created_bay(self, bay_id):
     try:
         utils.wait_for_condition(lambda: self.does_bay_exist(bay_id), 10,
                                  3600)
     except Exception:
         # In error state.  Clean up the bay id
         self.delete_bay(bay_id)
         self.wait_for_bay_to_delete(bay_id)
         raise
Exemple #2
0
 def wait_for_created_bay(self, bay_id):
     try:
         utils.wait_for_condition(
             lambda: self.does_bay_exist(bay_id), 10, 3600)
     except Exception:
         # In error state.  Clean up the bay id
         self.delete_bay(bay_id)
         self.wait_for_bay_to_delete(bay_id)
         raise
Exemple #3
0
 def setUp(self):
     super(BaseK8sTest, self).setUp()
     self.kube_api_url = self.cs.bays.get(self.bay.uuid).api_address
     k8s_client = api_client.ApiClient(self.kube_api_url,
                                       key_file=self.key_file,
                                       cert_file=self.cert_file,
                                       ca_certs=self.ca_file)
     self.k8s_api = apiv_api.ApivApi(k8s_client)
     # TODO(coreypobrien) https://bugs.launchpad.net/magnum/+bug/1551824
     utils.wait_for_condition(self._is_api_ready, 5, 600)
Exemple #4
0
 def setUp(self):
     super(BaseK8sTest, self).setUp()
     self.kube_api_url = self.cs.bays.get(self.bay.uuid).api_address
     k8s_client = api_client.ApiClient(self.kube_api_url,
                                       key_file=self.key_file,
                                       cert_file=self.cert_file,
                                       ca_certs=self.ca_file)
     self.k8s_api = apiv_api.ApivApi(k8s_client)
     # TODO(coreypobrien) https://bugs.launchpad.net/magnum/+bug/1551824
     utils.wait_for_condition(self._is_api_ready, 5, 600)
Exemple #5
0
 def wait_for_created_bay(self, bay_id, delete_on_error=True):
     try:
         utils.wait_for_condition(lambda: self.does_bay_exist(bay_id), 10,
                                  1800)
     except Exception:
         # In error state.  Clean up the bay id if desired
         self.LOG.error(_LE('Bay %s entered an exception state.') % bay_id)
         if delete_on_error:
             self.LOG.error(_LE('We will attempt to delete bays now.'))
             self.delete_bay(bay_id)
             self.wait_for_bay_to_delete(bay_id)
         raise
Exemple #6
0
 def wait_for_created_bay(self, bay_id, delete_on_error=True):
     try:
         utils.wait_for_condition(
             lambda: self.does_bay_exist(bay_id), 10, 3600)
     except Exception:
         # In error state.  Clean up the bay id if desired
         self.LOG.error('Bay %s entered an exception state.' % bay_id)
         if delete_on_error:
             self.LOG.error('We will attempt to delete bays now.')
             self.delete_bay(bay_id)
             self.wait_for_bay_to_delete(bay_id)
         raise
Exemple #7
0
 def setUp(self):
     super(BaseK8sTest, self).setUp()
     self.kube_api_url = self.cs.clusters.get(self.cluster.uuid).api_address
     config = k8s_config.Configuration()
     config.host = self.kube_api_url
     config.ssl_ca_cert = self.ca_file
     config.cert_file = self.cert_file
     config.key_file = self.key_file
     k8s_client = api_client.ApiClient(configuration=config)
     self.k8s_api = core_v1_api.CoreV1Api(k8s_client)
     # TODO(coreypobrien) https://bugs.launchpad.net/magnum/+bug/1551824
     utils.wait_for_condition(self._is_api_ready, 5, 600)
 def wait_for_created_cluster(self, cluster_id, delete_on_error=True):
     try:
         utils.wait_for_condition(
             lambda: self.does_cluster_exist(cluster_id), 10, 1800)
     except Exception:
         # In error state.  Clean up the cluster id if desired
         self.LOG.error(_LE('Cluster %s entered an exception state.'),
                        cluster_id)
         if delete_on_error:
             self.LOG.error(_LE('We will attempt to delete clusters now.'))
             self.delete_cluster(cluster_id)
             self.wait_for_cluster_to_delete(cluster_id)
         raise
Exemple #9
0
 def wait_for_created_cluster(self, cluster_id, delete_on_error=True):
     try:
         utils.wait_for_condition(
             lambda: self.does_cluster_exist(cluster_id), 10, 1800)
     except Exception:
         # In error state.  Clean up the cluster id if desired
         self.LOG.error(_LE('Cluster %s entered an exception state.'),
                        cluster_id)
         if delete_on_error:
             self.LOG.error(_LE('We will attempt to delete clusters now.'))
             self.delete_cluster(cluster_id)
             self.wait_for_cluster_to_delete(cluster_id)
         raise
Exemple #10
0
    def _wait_on_status(cls, bay, wait_status, finish_status, timeout=6000):
        # Check status every 60 seconds for a total of 100 minutes

        def _check_status():
            status = cls.cs.bays.get(bay.uuid).status
            cls.LOG.debug("Bay status is %s" % status)
            if status in wait_status:
                return False
            elif status in finish_status:
                return True
            else:
                raise Exception("Unexpected Status: %s" % status)

        # sleep 1s to wait bay status changes, this will be useful for
        # the first time we wait for the status, to avoid another 59s
        time.sleep(1)
        utils.wait_for_condition(_check_status, interval=60, timeout=timeout)
Exemple #11
0
    def _wait_on_status(cls, bay, wait_status, finish_status, timeout=6000):
        # Check status every 60 seconds for a total of 100 minutes

        def _check_status():
            status = cls.cs.bays.get(bay.uuid).status
            cls.LOG.debug("Bay status is %s" % status)
            if status in wait_status:
                return False
            elif status in finish_status:
                return True
            else:
                raise Exception("Unexpected Status: %s" % status)

        # sleep 1s to wait bay status changes, this will be useful for
        # the first time we wait for the status, to avoid another 59s
        time.sleep(1)
        utils.wait_for_condition(_check_status, interval=60, timeout=timeout)
 def wait_for_final_state(self, cluster_id):
     utils.wait_for_condition(
         lambda: self.is_cluster_in_final_state(cluster_id), 10, 1800)
 def wait_for_cluster_to_delete(self, cluster_id):
     utils.wait_for_condition(
         lambda: self.does_cluster_not_exist(cluster_id), 10, 600)
Exemple #14
0
 def wait_for_cluster_to_delete(self, cluster_id):
     utils.wait_for_condition(
         lambda: self.does_cluster_not_exist(cluster_id), 10, 600)
Exemple #15
0
 def wait_for_final_state(self, bay_id):
     utils.wait_for_condition(lambda: self.is_bay_in_final_state(bay_id),
                              10, 1800)
Exemple #16
0
 def wait_for_final_state(self, cluster_id):
     utils.wait_for_condition(
         lambda: self.is_cluster_in_final_state(cluster_id), 10, 1800)
Exemple #17
0
 def wait_for_bay_to_delete(self, bay_id):
     utils.wait_for_condition(lambda: self.does_bay_not_exist(bay_id), 10,
                              600)
Exemple #18
0
 def wait_for_final_state(self, bay_id):
     utils.wait_for_condition(
         lambda: self.is_bay_in_final_state(bay_id), 10, 3600)
Exemple #19
0
 def wait_for_bay_to_delete(self, bay_id):
     utils.wait_for_condition(
         lambda: self.does_bay_not_exist(bay_id), 10, 3600)