def tearDown(self): if "create_snapshot" in self.name.name: if self.snap.delete(): self.log.info("Delete snaphot after test!") else: self.log.info("Delete snapshot failed after test!") if "test_boot_debugkernel" in self.name.name: aws.cleanup_stored(self.teststmpdir, self.params, resource_id=self.vm.res_id) if "test_boot_nr_cpus" in self.name.name: for cpu in range(1, 3): cmd = 'sudo grubby --update-kernel=ALL --remove-args="nr_cpus={}"'.format( cpu) utils_lib.run_cmd(self, cmd, msg='remove nr_cpus={}'.format(cpu)) self.log.info('Reboot system!') self.vm.reboot(wait=True) if 'metal' in self.vm.instance_type: self.log.info("Wait {}".format(self.ssh_wait_timeout)) time.sleep(self.ssh_wait_timeout) else: self.log.info("Wait 60s") time.sleep(60) if self.session.session.is_responsive( ) is not None and self.vm.is_started(): aws.gcov_get(self) aws.get_memleaks(self) self.session.close()
def test_delete_vm(self): ''' :avocado: tags=test_delete_vm description: Test terminal RHEL instance on AWS. Linked case RHEL7-103637. polarion_id: https://polarion.engineering.redhat.com/polarion/#/project/RedHatEnterpriseLinux7/workitems?query=title:"[AWS]LifeCycleTest.test_delete_vm" bugzilla_id: n/a customer_case_id: n/a maintainer: xiliang case_priority: 0 case_component: LifeCycle key_steps: 1. Launch an instance on AWS EC2. 2. From AWS console, AWS cli or API, terminal the instance. pass_criteria: Instance is in stopping and then terminated state, ssh connect to the instance losts. ''' if not self.vm.delete(wait=True, loops=1): self.fail("Delete VM error: VM still exists") else: self.log.info("Cleanup previous saved vm info!") aws.cleanup_stored(self.teststmpdir, self.params, resource_id=self.vm.instance_id)
def test_cleanupall(self): ''' :avocado: tags=test_cleanupall ''' self.log.info("Cleanup previous saved resources!") aws.cleanup_stored(self.teststmpdir, self.params) self.log.info("Repeat again as some disk may be attached to \ instance at first time") aws.cleanup_stored(self.teststmpdir, self.params)
def test_delete_vm(self): ''' :avocado: tags=test_delete_vm polarion_id: RHEL7-103637 ''' if not self.vm.delete(wait=True, loops=1): self.fail("Delete VM error: VM still exists") else: self.log.info("Cleanup previous saved vm info!") aws.cleanup_stored(self.teststmpdir, self.params, resource_id=self.vm.instance_id)
def tearDown(self): aws.done_test(self) if self.vm.is_created: if "test_boot_mitigations" in self.name.name: cmd = 'sudo grubby --update-kernel=ALL --remove-args="mitigations=auto,nosmt"' utils_lib.run_cmd(self, cmd, msg='Remove "mitigations=auto,nosmt"') self.log.info('Reboot system!') self.vm.reboot(wait=True) if 'metal' in self.vm.instance_type: self.log.info("Wait {}".format(self.ssh_wait_timeout)) time.sleep(self.ssh_wait_timeout) else: self.log.info("Wait 60s") time.sleep(60) if "create_snapshot" in self.name.name: if self.snap.delete(): self.log.info("Delete snaphot after test!") else: self.log.info("Delete snapshot failed after test!") if "test_boot_debugkernel" in self.name.name: aws.cleanup_stored(self.teststmpdir, self.params, resource_id=self.vm.res_id) if "test_boot_nr_cpus" in self.name.name: for cpu in range(1,3): cmd = 'sudo grubby --update-kernel=ALL --remove-args="nr_cpus={}"'.format(cpu) utils_lib.run_cmd(self, cmd, msg='remove nr_cpus={}'.format(cpu)) self.log.info('Reboot system!') self.vm.reboot(wait=True) if 'metal' in self.vm.instance_type: self.log.info("Wait {}".format(self.ssh_wait_timeout)) time.sleep(self.ssh_wait_timeout) else: self.log.info("Wait 60s") time.sleep(60) if "test_boot_usbcore_quirks" in self.name.name: option = 'usbcore.quirks=quirks=0781:5580:bk,0a5c:5834:gij' cmd = 'sudo grubby --update-kernel=ALL --args="{}"'.format(option) utils_lib.run_cmd(self, cmd, msg='Remove "{}"'.format(option)) self.log.info('Reboot system!') self.vm.reboot(wait=True) if 'metal' in self.vm.instance_type: self.log.info("Wait {}".format(self.ssh_wait_timeout)) time.sleep(self.ssh_wait_timeout) else: self.log.info("Wait 60s") time.sleep(60) if "test_boot_hpet_mmap_enabled" in self.name.name: cmd = 'sudo grubby --update-kernel=ALL --remove-args="hpet_mmap=1"' utils_lib.run_cmd(self, cmd, msg='Remove "hpet_mmap=1"') self.log.info('Reboot system!') self.vm.reboot(wait=True) if 'metal' in self.vm.instance_type: self.log.info("Wait {}".format(self.ssh_wait_timeout)) time.sleep(self.ssh_wait_timeout) else: self.log.info("Wait 60s") time.sleep(60) if self.session.session.is_responsive( ) is not None and self.vm.is_started(): aws.gcov_get(self) aws.get_memleaks(self) self.session.close()