Example #1
0
                    def worker(mig_data):
                        vm = env.get_vm("vm1")
                        session = vm.wait_for_login(timeout=self.login_timeout)

                        install_cpuflags_test_on_vm(vm, install_path)

                        Flags = check_cpuflags_work(vm, install_path,
                                                    flags.all_possible_guest_flags)
                        logging.info("Woking CPU flags: %s", str(Flags[0]))
                        logging.info("Not working CPU flags: %s",
                                     str(Flags[1]))
                        logging.warning("Flags works even if not defined on"
                                        " guest cpu flags: %s",
                                        str(Flags[0] - flags.guest_flags))
                        logging.warning("Not tested CPU flags: %s",
                                        str(Flags[2]))
                        session.sendline("nohup dd if=/dev/[svh]da of=/tmp/"
                                         "stressblock bs=10MB count=100 &")

                        cmd = ("nohup %s/cpuflags-test --stress  %s%s &" %
                               (os.path.join(install_path, "src"),
                                smp,
                                cpu.kvm_flags_to_stresstests(Flags[0] &
                                                             flags.guest_flags)))
                        logging.debug("Guest_flags: %s",
                                      str(flags.guest_flags))
                        logging.debug("Working_flags: %s", str(Flags[0]))
                        logging.debug("Start stress on guest: %s", cmd)
                        session.sendline(cmd)
Example #2
0
 def run_stress(vm, timeout, guest_flags):
     """
     Run stress on vm for timeout time.
     """
     ret = False
     install_path = "/tmp"
     install_cpuflags_test_on_vm(vm, install_path)
     flags = check_cpuflags_work(vm, install_path, guest_flags)
     dd_session = vm.wait_for_login()
     stress_session = vm.wait_for_login()
     dd_session.sendline("dd if=/dev/[svh]da of=/tmp/stressblock"
                         " bs=10MB count=100 &")
     try:
         stress_session.cmd("%s/cpuflags-test --stress %s%s" %
                            (os.path.join(install_path, "src"), smp,
                             cpu.kvm_flags_to_stresstests(flags[0])),
                            timeout=timeout)
     except aexpect.ShellTimeoutError:
         ret = True
     stress_session.close()
     dd_session.close()
     return ret
Example #3
0
        def test(self):
            cpu_model, extra_flags = parse_cpu_model()

            flags = HgFlags(cpu_model, extra_flags)

            logging.debug("Cpu mode flags %s.",
                          str(flags.quest_cpu_model_flags))
            logging.debug("Added flags %s.",
                          str(flags.cpumodel_unsupport_flags))
            cpuf_model = cpu_model

            # Add unsupported flags.
            for fadd in flags.cpumodel_unsupport_flags:
                cpuf_model += ",+" + str(fadd)

            for fdel in flags.host_unsupported_flags:
                cpuf_model += ",-" + str(fdel)

            (self.vm, _) = start_guest_with_cpuflags(cpuf_model, smp)

            install_path = "/tmp"
            install_cpuflags_test_on_vm(self.vm, install_path)
            flags = check_cpuflags_work(self.vm, install_path,
                                        flags.guest_flags)
            test.assertTrue(flags[0], "No cpuflags passed the check: %s"
                            % str(flags))
            test.assertFalse(flags[1], "Some cpuflags failed the check: %s"
                             % str(flags))
            dd_session = self.vm.wait_for_login()
            stress_session = self.vm.wait_for_login()

            dd_session.sendline("nohup dd if=$(echo /dev/[svh]da) of=/tmp/"
                                "stressblock bs=10MB count=100 &")
            cmd = ("nohup %s/cpuflags-test --stress  %s%s &" %
                   (os.path.join(install_path, "src"), smp,
                    cpu.kvm_flags_to_stresstests(flags[0])))
            stress_session.sendline(cmd)

            time.sleep(5)

            qemu_migration.set_speed(self.vm, mig_speed)
            self.clone = self.vm.migrate(
                mig_timeout, mig_protocol, offline=False,
                not_wait_for_migration=True)

            time.sleep(5)

            try:
                self.vm.wait_for_migration(10)
            except virt_vm.VMMigrateTimeoutError:
                qemu_migration.set_downtime(self.vm, 1)
                self.vm.wait_for_migration(mig_timeout)

            self.clone.resume()
            self.vm.destroy(gracefully=False)

            stress_session = self.clone.wait_for_login()

            # If cpuflags-test hang up during migration test raise exception
            try:
                stress_session.cmd('killall cpuflags-test')
            except aexpect.ShellCmdError:
                test.fail("Stress cpuflags-test should be still "
                          "running after migration.")
            try:
                stress_session.cmd("ls /tmp/stressblock && "
                                   "rm -f /tmp/stressblock")
            except aexpect.ShellCmdError:
                test.fail("Background 'dd' command failed to "
                          "produce output file.")