def test_check_timedrift_stress(self):
        '''
        :avocado: tags=test_check_timedrift_stress
        After 120 seconds stress test, if the average drift time over 1
        seconds, we are considering it as fail.
        polarion_id: RHEL7-110673
        '''
        utils_lib.run_cmd(self,
                          r"sudo cat /etc/redhat-release",
                          expect_ret=0,
                          cancel_kw="release 7,release 6",
                          msg="Only run in RHEL7 and RHEL6")

        utils_lib.run_cmd(self, "sudo systemctl stop ntpd")
        utils_lib.run_cmd(self, "sudo systemctl disable ntpd")
        utils_lib.run_cmd(self, "sudo systemctl stop chronyd")
        utils_lib.run_cmd(self, "sudo systemctl disable chronyd")
        utils_lib.run_cmd(self, "sudo timedatectl set-ntp 0")
        offset1 = aws.get_drift(self)
        stress_url = self.params.get('stress_url')
        aws.install_pkgs(self.session, stress_url)
        cpu_count = utils_lib.run_cmd(
            self, 'cat /proc/cpuinfo |grep -i "model name"|wc -l')
        utils_lib.run_cmd(self, "stress -c %s -t 120" % cpu_count, timeout=160)
        offset2 = aws.get_drift(self)

        x = decimal.Decimal(offset2) - decimal.Decimal(offset1)
        drift = math.fabs(x) * 10
        self.assertLess(drift, 10, msg="Drift is over 1 seconds")
        self.log.info("Average drift is less than 1 seconfs. %d/10" % drift)
    def test_nvme_basic(self):
        '''
        :avocado: tags=test_nvme_basic,acceptance,fast_check,outposts
        polarion_id: RHEL7-87122
        '''
        self.session.connect(timeout=self.ssh_wait_timeout)
        self.session = self.session
        aws.check_session(self)
        cmd = 'lsblk'
        out = utils_lib.run_cmd(self, cmd)
        if 'nvme' not in out:
            self.cancel('No nvme disk found!')
        aws.install_pkgs(self.session, 'pciutils')
        find_nvme_pci = 'sudo lspci|grep Non-Volatile'
        find_nvme_module = 'sudo lsmod|grep nvme'
        utils_lib.run_cmd(self,
                    find_nvme_pci,
                    expect_ret=0,
                    msg='Try to find nvme pci!')
        utils_lib.run_cmd(self,
                    find_nvme_module,
                    expect_ret=0,
                    msg='Try to find nvme module in loading drivers!')

        aws.install_pkgs(self.session, 'nvme-cli')
        nvme_list = 'sudo nvme list'
        self.log.info("CMD: %s" % nvme_list)
        output = utils_lib.run_cmd(self, nvme_list, expect_ret=0)
        search_for = re.compile(r'/dev/nvme\dn\d')
        nvme_blks = search_for.findall(output)
        if len(nvme_blks) > 0:
            self.log.info("Found nvme devices %s" % nvme_blks)
        else:
            self.fail("No nvme blks found %s" % output)
        output = utils_lib.run_cmd(self, 'lsblk', expect_ret=0)
        if 'xvda' in output:
            bootdisk = 'xvda'
        else:
            cmd = " sudo lsblk -o NAME,MOUNTPOINT|grep -w '/'"
            out = utils_lib.run_cmd(self, cmd)
            bootdisk = re.findall('nvme[0-9]+', out)[0]
        self.log.info("Boot disk is %s" % bootdisk)
        for nvme_blk in nvme_blks:
            nvme_read = 'sudo nvme read %s --data-size=10000' % nvme_blk
            utils_lib.run_cmd(self,
                        nvme_read,
                        expect_ret=0,
                        expect_kw=r'read: Success',
                        msg="%s read test" % nvme_blk)
            if bootdisk not in nvme_blk:
                nvme_write = 'echo "write test"|sudo nvme write %s \
--data-size=10000' % nvme_blk
                utils_lib.run_cmd(self,
                            nvme_write,
                            expect_ret=0,
                            expect_kw=r'write: Success',
                            msg="%s write test" % nvme_blk)
Beispiel #3
0
    def test_xe_guest_utilities(self):
        '''
        :avocado: tags=test_xe_guest_utilities,fast_check
        polarion_id:
        '''
        self.session.connect(timeout=self.ssh_wait_timeout)

        aws.run_cmd(self,
                    'lscpu',
                    expect_ret=0,
                    cancel_kw="Xen",
                    msg="Only run in xen instance")

        utils_lib.run_cmd(self, 'sudo su', expect_ret=0)
        aws.install_pkgs(self.session, 'wget')
        cmd = 'sudo wget https://kojipkgs.fedoraproject.org//packages/\
xe-guest-utilities/7.12.0/1.fc29/x86_64/xe-guest-utilities-7.12.0-1.fc29.\
x86_64.rpm'

        aws.run_cmd(self, cmd, expect_ret=0)
        cmd = 'yum localinstall -y xe-guest-utilities-7.12.0-1.fc29.x86_64.rpm'
        aws.run_cmd(self, cmd)
        cmd = 'rpm -ivh xe-guest-utilities-7.12.0-1.fc29.x86_64.rpm --force \
--nodeps'

        aws.run_cmd(self, cmd)
        xenstore_read = '/usr/libexec/xe-guest-utilities/xenstore-read'
        cmd = "%s domid" % xenstore_read
        aws.run_cmd(self, cmd, expect_ret=0)
        cmd = "%s name" % xenstore_read
        aws.run_cmd(self, cmd, expect_ret=0)
        cmd = "%s memory/target" % xenstore_read
        aws.run_cmd(self, cmd, expect_ret=0)
        if 'vif' in aws.run_cmd(self, 'ethtool -i eth0', expect_ret=0):
            cmd = "%s device/vif/0/mac" % xenstore_read
            aws.run_cmd(self, cmd, expect_ret=0)

        xenstore_list = '/usr/libexec/xe-guest-utilities/xenstore-list'
        cmd = "%s device" % xenstore_list
        aws.run_cmd(self, cmd, expect_ret=0)
        cmd = "%s control" % xenstore_list
        aws.run_cmd(self, cmd, expect_ret=0)
    def test_nvme_basic(self):
        '''
        :avocado: tags=test_nvme_basic,acceptance,fast_check,outposts
        description:
            Test basic nvme functions in RHEL on AWS. Linked case RHEL7-87122.
            Instances with nvme drivers include,
            X2gd, I3, I3en, 
            T3, T3a, T4g,
            C5, C5a, C5ad, C5d, C5n, 
            M5, M5a, M5ad, M5d, M5dn, M5n, M5zn,
            R5, R5a, R5ad, R5b, R5d, R5dn, R5n,
            A1, C6g, C6gd, C6gn, M6g, M6gd, R6g, R6gd, 
            F1, Inf1,
            D3, D3en,
            G4ad, G4dn, 
            P3dn, P4d,
            Mac1, z1d and so on.
        polarion_id:
            https://polarion.engineering.redhat.com/polarion/#/project/RedHatEnterpriseLinux7/workitems?query=title:"[AWS]StorageTest.test_nvme_basic"
        bugzilla_id: 
            n/a
        customer_case_id: 
            n/a
        maintainer: 
            xiliang
        case_priority:
            0
        case_component: 
            Storage
        key_steps:
            1. Launch an instance with nvme drivers on AWS.
            2. Check block devices information via command "$ sudo lsblk".
            3. Check nvme module is loaded via command "pciutils".
            4. Install package pciutils, and check nvme pci via command "$ sudo lspci|grep Non-Volatile"
            5. Install package nvme-cli, and check nvme devices via command "sudo nvme list".
            6. Do read and write tests with non boot nvme devices via below commands.
               "sudo nvme read /dev/nvme0n1 --data-size=10000"
               "echo "write test"|sudo nvme write /dev/nvme0n1 --data-size=10000"
        pass_criteria: 
            Basic function tests pass for nmve blockers with nvme cli.
        '''
        self.session.connect(timeout=self.ssh_wait_timeout)
        self.session = self.session
        aws.check_session(self)
        cmd = 'lsblk'
        out = utils_lib.run_cmd(self, cmd)
        if 'nvme' not in out:
            self.cancel('No nvme disk found!')
        aws.install_pkgs(self.session, 'pciutils')
        find_nvme_pci = 'sudo lspci|grep Non-Volatile'
        find_nvme_module = 'sudo lsmod|grep nvme'
        utils_lib.run_cmd(self,
                          find_nvme_pci,
                          expect_ret=0,
                          msg='Try to find nvme pci!')
        utils_lib.run_cmd(self,
                          find_nvme_module,
                          expect_ret=0,
                          msg='Try to find nvme module in loading drivers!')

        aws.install_pkgs(self.session, 'nvme-cli')
        nvme_list = 'sudo nvme list'
        self.log.info("CMD: %s" % nvme_list)
        output = utils_lib.run_cmd(self, nvme_list, expect_ret=0)
        search_for = re.compile(r'/dev/nvme\dn\d')
        nvme_blks = search_for.findall(output)
        if len(nvme_blks) > 0:
            self.log.info("Found nvme devices %s" % nvme_blks)
        else:
            self.fail("No nvme blks found %s" % output)
        output = utils_lib.run_cmd(self, 'lsblk', expect_ret=0)
        if 'xvda' in output:
            bootdisk = 'xvda'
        else:
            cmd = " sudo lsblk -o NAME,MOUNTPOINT|grep -w '/'"
            out = utils_lib.run_cmd(self, cmd)
            bootdisk = re.findall('nvme[0-9]+', out)[0]
        self.log.info("Boot disk is %s" % bootdisk)
        for nvme_blk in nvme_blks:
            nvme_read = 'sudo nvme read %s --data-size=10000' % nvme_blk
            utils_lib.run_cmd(self,
                              nvme_read,
                              expect_ret=0,
                              expect_kw=r'read: Success',
                              msg="%s read test" % nvme_blk)
            if bootdisk not in nvme_blk:
                nvme_write = 'echo "write test"|sudo nvme write %s \
--data-size=10000' % nvme_blk
                utils_lib.run_cmd(self,
                                  nvme_write,
                                  expect_ret=0,
                                  expect_kw=r'write: Success',
                                  msg="%s write test" % nvme_blk)