Exemplo n.º 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 deffined 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, "test_cpu_flags"),
                                smp,
                                virt_utils.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)
Exemplo n.º 2
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 deffined 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, "test_cpu_flags"),
                            smp,
                            virt_utils.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)
Exemplo n.º 3
0
 def run_stress(timeout, flags, smp):
     """
     Run stress on vm for timeout time.
     """
     ret = False
     flags = check_cpuflags_work(flags)
     try:
         utils.run("./cpuflags-test --stress %s%s" %
                   (smp, virt_utils.kvm_flags_to_stresstests(flags[0])),
                   timeout)
     except error.CmdError:
         ret = True
     return ret
Exemplo n.º 4
0
 def run_stress(timeout, flags, smp):
     """
     Run stress on vm for timeout time.
     """
     ret = False
     flags = check_cpuflags_work(flags)
     try:
         utils.run(
             "./cpuflags-test --stress %s%s" %
             (smp, virt_utils.kvm_flags_to_stresstests(flags[0])),
             timeout)
     except error.CmdError:
         ret = True
     return ret
Exemplo n.º 5
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)
            dd_session = self.vm.wait_for_login()
            stress_session = self.vm.wait_for_login()

            dd_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, "test_cpu_flags"), smp,
                   virt_utils.kvm_flags_to_stresstests(flags[0])))
            stress_session.sendline(cmd)

            time.sleep(5)

            self.vm.monitor.migrate_set_speed(mig_speed)
            self.vm.migrate(mig_timeout, mig_protocol, offline=False)

            time.sleep(5)

            #If cpuflags-test hang up during migration test raise exception
            try:
                stress_session.cmd('killall cpuflags-test')
            except aexpect.ShellCmdError:
                raise error.TestFail("Cpuflags-test should work after"
                                     " migration.")
Exemplo n.º 6
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, "test_cpu_flags"), smp, virt_utils.kvm_flags_to_stresstests(flags[0])),
             timeout=timeout,
         )
     except aexpect.ShellTimeoutError:
         ret = True
     stress_session.close()
     dd_session.close()
     return ret
Exemplo n.º 7
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, "test_cpu_flags"), smp,
                      virt_utils.kvm_flags_to_stresstests(flags[0])),
                     timeout=timeout)
     except aexpect.ShellTimeoutError:
         ret = True
     stress_session.close()
     dd_session.close()
     return ret