예제 #1
0
 def test_04_check_cpu_mem(self):
     for i in range(self.num_vcpus, self.max_vcpus):
         self.num_vcpus = i
         log.info("Creating VM")
         vm_handle = vm.Vminfo(self, self.hyp_handle)
         domain = vm_handle.create_vm()
         log.info("VM has been created with name %s", domain.name())
         vm_handle.wait_for_vm_boot(domain, self.credentials)
         vm_handle.vm_liveliness(domain)
         ip = vm_handle.ip_address
         mem = helper.check_vm_mem(self.credentials, ip)
         log.info("Total memory inside VM is %s" % mem)
         difference = int(self.memory) - int(mem)
         log.info(
             "Memory difference between provided memory and allocated memory is %s"
             % difference)
         tolerence = ((float(self.mem_tolerence) / float(100)) *
                      float(self.memory))
         log.info("Memory tolerence value is %s" % tolerence)
         if difference >= tolerence:
             raise Exception("Memory difference has exceed tolerence level")
         cpus = helper.check_vm_cpu_num(self.credentials, ip)
         log.info("CPUs allocated in VM is %s" % cpus)
         if self.num_vcpus != cpus:
             raise Exception(
                 "Number of CPUs provided do not match the number allocated"
             )
         helper.check_vm_health(self.credentials, ip)
         helper.delete_all_vms(self.hyp_handle)
         if self.memory <= self.max_mem:
             self.memory += 1024
예제 #2
0
 def test_02_stressng_class(self):
     log.info("Creating VM")
     vm_handle = vm.Vminfo(self, self.hyp_handle)
     domain = vm_handle.create_vm()
     log.info("VM has been created with name %s", domain.name())
     vm_handle.wait_for_vm_boot(domain, self.credentials)
     vm_handle.vm_liveliness(domain)
     ip = vm_handle.ip_address
     stressng_cmd1 = ("stress-ng --class os --all %s --timeout %s" %
                      (self.stressng_inst_num, self.stressng_timeout))
     log.info("stress-ng command is %s" % (stressng_cmd1))
     stressng_cmd2 = ("stress-ng --class io --all %s --timeout %s" %
                      (self.stressng_inst_num, self.stressng_timeout))
     log.info("stress-ng command is %s" % (stressng_cmd2))
     benchmark_helper.configure_stressng_on_vm(self.credentials, ip)
     thread_helper.start_thread(target=helper.execute_cmd_vm_output,
                                args=(
                                    stressng_cmd1,
                                    self.credentials,
                                    ip,
                                ))
     thread_helper.start_thread(target=helper.execute_cmd_vm_output,
                                args=(
                                    stressng_cmd2,
                                    self.credentials,
                                    ip,
                                ))
     thread_helper.join_all()
     helper.check_vm_health(self.credentials, ip)
예제 #3
0
 def test_11_start_vm(self):
     log.info("Creating VM")
     vm_handle = vm.Vminfo(self, self.hyp_handle)
     # Create as many VM(s) specified by num_vm
     for i in xrange(self.num_vm):
         # Create a new VM in thread
         thread_helper.start_thread(target=vm_handle.create_vm,
                                    args=("test" + str(i), ))
     # Wait for threads to finish
     thread_helper.join_all()
     log.info("%d VM(s) created" % self.num_vm)
     # Deque each domain from thread return queue and wait for them to boot
     for i in xrange(self.num_vm):
         self.domain_list.append(thread_helper.return_queue.get())
         thread_helper.start_thread(target=vm_handle.wait_for_vm_boot,
                                    args=(
                                        self.domain_list[i],
                                        self.credentials,
                                    ))
     thread_helper.join_all()
     # Store IP of each Vm created in test directory
     for i in xrange(self.num_vm):
         vm_handle.vm_liveliness(self.domain_list[i])
         self.vm_dir[self.domain_list[i].name()] = vm_handle.ip_address
     # Check VM health
     for keys, values in self.vm_dir.items():
         helper.check_vm_health(self.credentials, values)
예제 #4
0
 def test_01_start_vm(self):
     log.info("Creating VM")
     vm_handle = vm.Vminfo(self, self.hyp_handle)
     domain = vm_handle.create_vm()
     log.info("VM has been created with name %s", domain.name())
     vm_handle.wait_for_vm_boot(domain, self.credentials)
     vm_handle.vm_liveliness(domain)
     ip = vm_handle.ip_address
     helper.check_vm_health(self.credentials, ip)
예제 #5
0
 def test_10_test_kbuild(self):
     log.info("Creating VM")
     vm_handle = vm.Vminfo(self, self.hyp_handle)
     domain = vm_handle.create_vm()
     log.info("VM has been created with name %s", domain.name())
     vm_handle.wait_for_vm_boot(domain, self.credentials)
     vm_handle.vm_liveliness(domain)
     ip = vm_handle.ip_address
     benchmark_helper.cmpl_kernel_on_vm(self.credentials, ip,
                                        self.kernel_url, self.kernel_ver,
                                        self.krnl_cmp_itr)
     helper.check_vm_health(self.credentials, ip)
예제 #6
0
 def test_08_test_ltp(self):
     log.info("Creating VM")
     vm_handle = vm.Vminfo(self, self.hyp_handle)
     domain = vm_handle.create_vm()
     log.info("VM has been created with name %s", domain.name())
     vm_handle.wait_for_vm_boot(domain, self.credentials)
     vm_handle.vm_liveliness(domain)
     ip = vm_handle.ip_address
     benchmark_helper.run_ltp_on_vm(self.credentials, ip, self.log_dir,
                                    self.ltp_command)
     benchmark_helper.run_ltp_on_host(self.log_dir, self.ltp_command)
     helper.check_vm_health(self.credentials, ip)
예제 #7
0
 def test_05_on_off_cpu(self):
     log.info("Creating VM")
     vm_handle = vm.Vminfo(self, self.hyp_handle)
     domain = vm_handle.create_vm()
     log.info("VM has been created with name %s", domain.name())
     vm_handle.wait_for_vm_boot(domain, self.credentials)
     vm_handle.vm_liveliness(domain)
     ip = vm_handle.ip_address
     for i in range(1, self.num_vcpus):
         helper.check_cpu_offline_vm(str(i), self.credentials, ip)
     for i in range(1, self.num_vcpus):
         helper.check_cpu_online_vm(str(i), self.credentials, ip)
     helper.check_vm_health(self.credentials, ip)
예제 #8
0
 def test_05_on_off_cpu(self):
     log.info("Creating VM")
     vm_handle = vm.Vminfo(self, self.hyp_handle)
     domain = vm_handle.create_vm()
     log.info("VM has been created with name %s", domain.name())
     vm_handle.wait_for_vm_boot(domain, self.credentials)
     vm_handle.vm_liveliness(domain)
     ip = vm_handle.ip_address
     cpu_num = str(random.randint(1, self.num_vcpus - 1))
     log.info("CPU%s will be on/off" % cpu_num)
     for i in range(0, self.on_off_itr):
         helper.check_cpu_offline_vm(cpu_num, self.credentials, ip)
         helper.check_cpu_online_vm(cpu_num, self.credentials, ip)
     helper.check_vm_health(self.credentials, ip)
예제 #9
0
 def test_01_stressng_all(self):
     log.info("Creating VM")
     vm_handle = vm.Vminfo(self, self.hyp_handle)
     domain = vm_handle.create_vm()
     log.info("VM has been created with name %s", domain.name())
     vm_handle.wait_for_vm_boot(domain, self.credentials)
     vm_handle.vm_liveliness(domain)
     ip = vm_handle.ip_address
     stressng_cmd = ("stress-ng -a %s --timeout %s" %
                     (self.stressng_inst_num, self.stressng_timeout))
     log.info("stress-ng command is %s" % (stressng_cmd))
     benchmark_helper.configure_stressng_on_vm(self.credentials, ip)
     output = helper.execute_cmd_vm_output(stressng_cmd,
                                           self.credentials,
                                           ip,
                                           root=False)
     helper.check_vm_health(self.credentials, ip)
예제 #10
0
 def test_01_reboot_vm(self):
     log.info("Creating VM")
     vm_handle = vm.Vminfo(self, self.hyp_handle)
     domain = vm_handle.create_vm()
     log.info("VM has been created with name %s", domain.name())
     thread_helper.start_thread(target=vm_handle.wait_for_vm_boot,
                                args=(
                                    domain,
                                    self.credentials,
                                ),
                                kwargs={'reboot': True})
     vm_handle.vm_liveliness(domain)
     vm_handle.reboot_vm(domain, self.reboot_itr, self.credentials)
     ip = vm_handle.ip_address
     helper.check_vm_health(self.credentials, ip)
     helper.delete_all_vms(self.hyp_handle)
     thread_helper.join_all()
예제 #11
0
 def test_03_run_iozone(self):
     log.info("Creating VM")
     self.vm_args = "--disk path=/opt/tmpfs.img,bus=virtio,perms=rw"
     vm_handle = vm.Vminfo(self, self.hyp_handle)
     domain = vm_handle.create_vm()
     log.info("VM has been created with name %s", domain.name())
     vm_handle.wait_for_vm_boot(domain, self.credentials)
     vm_handle.vm_liveliness(domain)
     ip = vm_handle.ip_address
     log.info("Running Iozone test on host machine")
     status = benchmark_helper.run_iozone_host(self.log_dir)
     if not status:
         raise Exception("Iozone tests failed on host")
     log.info("Running Iozone test on VM")
     status = benchmark_helper.run_iozone_vm(self.credentials, self.log_dir,
                                             ip)
     if not status:
         raise Exception("Iozone tests failed on vm")
     helper.check_vm_health(self.credentials, ip)
예제 #12
0
 def test_01_run_fio(self):
     log.info("Creating VM")
     vm_handle = vm.Vminfo(self, self.hyp_handle)
     domain = vm_handle.create_vm()
     log.info("VM has been created with name %s", domain.name())
     vm_handle.wait_for_vm_boot(domain, self.credentials)
     vm_handle.vm_liveliness(domain)
     ip = vm_handle.ip_address
     block_list = []
     for i in self.block_size.split(","):
         block_list.append(i)
     log.info("block list provided is %s" % self.block_size)
     log.info("Running FIO on host now...")
     benchmark_helper.run_fio_on_host(self.log_dir, block_list,
                                      self.io_pattern, self.runtime)
     log.info("Running FIO on VM now...")
     benchmark_helper.run_fio_on_vm(self.credentials, ip, self.log_dir,
                                    block_list, self.io_pattern,
                                    self.runtime)
     helper.check_vm_health(self.credentials, ip)
예제 #13
0
 def test_05_run_dd_cmd(self):
     log.info("Creating VM")
     vm_handle = vm.Vminfo(self, self.hyp_handle)
     domain = vm_handle.create_vm()
     log.info("VM has been created with name %s", domain.name())
     vm_handle.wait_for_vm_boot(domain, self.credentials)
     vm_handle.vm_liveliness(domain)
     ip = vm_handle.ip_address
     block_list = []
     for i in self.block_size.split(","):
         block_list.append(int(i))
     cmd = ("sudo mkdir -p /mnt/dd-tests")
     output = helper.execute_cmd_vm_output(cmd, self.credentials, ip)
     log.info("Command output is %s" % output)
     for i in block_list:
         cmd = (
             "sudo time dd if=/dev/urandom of=/mnt/dd-tests/test bs=%dM count=10"
             % i)
         output = helper.execute_cmd_vm_output(cmd, self.credentials, ip)
         log.info("Command output is %s" % output)
         cmd = ("sudo rm -rf /mnt/dd-tests/test")
         output = helper.execute_cmd_vm_output(cmd, self.credentials, ip)
         log.info("Command output is %s" % output)
     helper.check_vm_health(self.credentials, ip)