Ejemplo n.º 1
0
 def _test_passed(self):
     """
     Determine if test passed
     """
     self._refresh_instance_data()
     self._refresh_customer_alarms()
     self._refresh_customer_logs()
     self._refresh_customer_alarm_history()
     success, reason = _instances.instance_has_live_migrated(
         self._instance_data, self.LOG_FILES, self._customer_alarms,
         self._customer_logs, self._customer_alarm_history, self.start_datetime,
         self.end_datetime, self._original_host, self._to_host, action=True,
         guest_hb=self._guest_hb)
     self._save_debug(success, reason)
     return success, reason
Ejemplo n.º 2
0
    def _test_passed(self):
        """
        Determine if test passed
        """
        self._refresh_host_data()
        self._refresh_instance_data()
        self._refresh_customer_alarms()
        self._refresh_customer_logs()
        self._refresh_customer_alarm_history()

        success, reason = _hosts.host_is_locked(self._host_data)
        if not success:
            self._save_debug(False, reason)
            return False, reason

        success, reason = _hosts.host_is_disabled(self._host_data)
        if not success:
            self._save_debug(False, reason)
            return False, reason

        for instance_name in self._instances:
            instance_data = self._instances[instance_name]

            success, reason = _instances.instance_has_live_migrated(
                instance_data, self.LOG_FILES, self._customer_alarms,
                self._customer_logs, self._customer_alarm_history,
                self._start_datetime, self._end_datetime, self.host_name)
            if not success:
                reason = ("instance %s failed to live-migrate to host" %
                          instance_name)
                self._save_debug(False, reason)
                return False, reason

        reason = "host locked"
        self._save_debug(True, reason)
        return True, reason
Ejemplo n.º 3
0
    def _do_setup(self):
        """
        Setup the test
        """
        self._refresh_host_data()
        self._refresh_instance_data()
        self._refresh_customer_alarms()
        self._refresh_customer_logs()
        self._refresh_customer_alarm_history()

        success, reason = _hosts.host_is_unlocked(self._host_data)
        if not success:
            DLOG.error("Test setup %s failure for host %s, reason=%s." %
                       (self._name, self.host_name, reason))
            return False, reason

        for instance_name in self._instances:
            instance_data = self._instances[instance_name]
            instance_uuid = _instances.instance_get_uuid(instance_data)
            original_host = _instances.instance_get_host(instance_data)
            success, reason = _instances.instance_on_host(
                instance_data, self.host_name)
            if not success:
                nova.live_migrate_server(self.openstack_token,
                                         instance_uuid,
                                         to_host_name=self.host_name)

                max_end_datetime = (
                    self._start_datetime +
                    datetime.timedelta(seconds=self.timeout_secs))
                while True:
                    self._refresh_instance_data(instance_name)
                    self._refresh_customer_alarms()
                    self._refresh_customer_logs()
                    self._refresh_customer_alarm_history()

                    instance_data = self._instances[instance_name]
                    self._end_datetime = datetime.datetime.now()

                    success, reason = _instances.instance_has_live_migrated(
                        instance_data,
                        self.LOG_FILES,
                        self._customer_alarms,
                        self._customer_logs,
                        self._customer_alarm_history,
                        self._start_datetime,
                        self._end_datetime,
                        original_host,
                        self.host_name,
                        action=True)
                    if success:
                        break

                    if self._end_datetime > max_end_datetime:
                        DLOG.error("Test setup %s timeout for host %s." %
                                   (self._name, self.host_name))
                        return False, ("instance %s failed to live-migrate to "
                                       "host" % instance_name)

                    time.sleep(5)

        return True, "host setup complete"