Exemplo n.º 1
0
 def setUp(self):
     """
     Setup the device.
     """
     if 'ppc' not in platform.processor():
         self.cancel("Processor is not ppc64")
     if os.path.exists('/proc/device-tree/bmc'):
         self.cancel("Test Unsupported! on this platform")
     if cpu._list_matches(
             open('/proc/cpuinfo').readlines(), 'platform\t: pSeries\n'):
         self.power_vm = True
         for mdl in ['rpaphp', 'rpadlpar_io']:
             if not linux_modules.module_is_loaded(mdl):
                 linux_modules.load_module(mdl)
     elif cpu._list_matches(
             open('/proc/cpuinfo').readlines(), 'platform\t: PowerNV\n'):
         self.power_vm = False
         if not linux_modules.module_is_loaded("pnv_php"):
             linux_modules.load_module("pnv_php")
     self.dic = {}
     self.device = self.params.get('pci_devices', default=' ').split(" ")
     self.count = int(self.params.get('count', default='1'))
     if not self.device:
         self.cancel("PCI_address not given")
     smm = SoftwareManager()
     if not smm.check_installed("pciutils") and not smm.install("pciutils"):
         self.cancel("pciutils package is need to test")
     for pci_addr in self.device:
         if not os.path.isdir('/sys/bus/pci/devices/%s' % pci_addr):
             self.cancel("%s not present in device path" % pci_addr)
         slot = self.get_slot(pci_addr)
         if not slot:
             self.cancel("slot number not available for: %s" % pci_addr)
         self.dic[pci_addr] = slot
Exemplo n.º 2
0
    def setUp(self):
        """
        Check pre-requisites before running sensors command
        Testcase should be executed only on bare-metal environment.
        """
        s_mg = SoftwareManager()
        d_distro = distro.detect()
        if d_distro.name == "Ubuntu":
            if not s_mg.check_installed("lm-sensors") and not s_mg.install(
                    "lm-sensors"):
                self.cancel('Need sensors to run the test')
        elif d_distro.name == "SuSE":
            if not s_mg.check_installed("sensors") and not s_mg.install(
                    "sensors"):
                self.cancel('Need sensors to run the test')
        else:
            if not s_mg.check_installed("lm_sensors") and not s_mg.install(
                    "lm_sensors"):
                self.cancel('Need sensors to run the test')
        if d_distro.arch in ["ppc64", "ppc64le"]:
            if not cpu._list_matches(
                    open('/proc/cpuinfo').readlines(),
                    'platform\t: PowerNV\n'):
                self.cancel(
                    'sensors test is applicable to bare-metal environment.')

            config_check = linux_modules.check_kernel_config(
                'CONFIG_SENSORS_IBMPOWERNV')
            if config_check == 0:
                self.cancel('Config is not set')
            elif config_check == 1:
                if linux_modules.load_module('ibmpowernv'):
                    if linux_modules.module_is_loaded('ibmpowernv'):
                        self.log.info('Module Loaded Successfully')
                    else:
                        self.cancel('Module Loading Failed')
            else:
                self.log.info('Module is Built In')

        if not d_distro.name == "Ubuntu":
            try:
                process.run('service lm_sensors stop', sudo=True)
                process.run('service lm_sensors start', sudo=True)
                process.run('service lm_sensors status', sudo=True)
            except process.CmdError:
                self.error(
                    'Starting Service Failed. Make sure module is loaded')
        cmd = "yes | sudo sensors-detect"
        det_op = process.run(cmd, shell=True, ignore_status=True).stdout
        if 'no sensors were detected' in det_op:
            self.cancel('No sensors found to test !')
Exemplo n.º 3
0
 def setUp(self):
     """
     Setup the device.
     """
     if 'ppc' not in platform.processor():
         self.cancel("Processor is not ppc64")
     if os.path.exists('/proc/device-tree/bmc'):
         self.cancel("Test Unsupported! on this platform")
     cmd = "cat /proc/cpuinfo"
     if cpu._list_matches(open('/proc/cpuinfo').readlines(),
                          'platform\t: pSeries\n'):
         PowerVM = True
         for mdl in ['rpaphp', 'rpadlpar_io']:
             if not linux_modules.module_is_loaded(mdl):
                 linux_modules.load_module(mdl)
     elif cpu._list_matches(open('/proc/cpuinfo').readlines(),
                            'platform\t: PowerNV\n'):
         PowerVM = False
         if not linux_modules.module_is_loaded("pnv_php"):
             linux_modules.load_module("pnv_php")
     self.return_code = 0
     self.device = self.params.get('pci_device', default=' ')
     self.num_of_hotplug = int(self.params.get('num_of_hotplug', default='1'))
     if not os.path.isdir('/sys/bus/pci/devices/%s' % self.device):
         self.cancel("PCI device given does not exist")
     if PowerVM:
         devspec = genio.read_file("/sys/bus/pci/devices/%s/devspec"
                                   % self.device)
         self.slot = genio.read_file("/proc/device-tree/%s/ibm,loc-code"
                                     % devspec)
         self.slot = re.match(r'((\w+)[\.])+(\w+)-P(\d+)-C(\d+)|Slot(\d+)',
                              self.slot).group()
     else:
         self.slot = pci.get_pci_prop(self.device, "PhySlot")
     if not os.path.isdir('/sys/bus/pci/slots/%s' % self.slot):
         self.cancel("%s Slot not available" % self.slot)
     if not os.path.exists('/sys/bus/pci/slots/%s/power' % self.slot):
         self.cancel("%s Slot does not support hotplug" % self.slot)
 def setUp(self):
     """
     Setup the device.
     """
     cmd = "uname -p"
     if 'ppc' not in process.system_output(cmd, ignore_status=True):
         self.cancel("Processor is not ppc64")
     cmd = "cat /proc/cpuinfo"
     if cpu._list_matches(open('/proc/cpuinfo').readlines(),
                          'platform\t: pSeries\n'):
         PowerVM = True
         for mdl in ['rpaphp', 'rpadlpar_io']:
             if not linux_modules.module_is_loaded(mdl):
                 linux_modules.load_module(mdl)
     elif cpu._list_matches(open('/proc/cpuinfo').readlines(),
                            'platform\t: PowerNV\n'):
         PowerVM = False
         if not linux_modules.module_is_loaded("pnv_php"):
             linux_modules.load_module("pnv_php")
     self.return_code = 0
     self.device = self.params.get('pci_device', default=' ')
     self.num_of_hotplug = int(self.params.get('num_of_hotplug',
                               default='1'))
     if not os.path.isdir('/sys/bus/pci/devices/%s' % self.device):
         self.cancel("PCI device given does not exist")
     if PowerVM:
         devspec = genio.read_file("/sys/bus/pci/devices/%s/devspec"
                                   % self.device)
         self.slot = genio.read_file("/proc/device-tree/%s/ibm,loc-code"
                                     % devspec)
         self.slot = re.match(r'((\w+)[\.])+(\w+)-P(\d+)-C(\d+)|Slot(\d+)',
                              self.slot).group()
     else:
         self.slot = pci.get_pci_prop(self.device, "PhySlot")
     if not os.path.isdir('/sys/bus/pci/slots/%s' % self.slot):
         self.cancel("%s Slot not available" % self.slot)
     if not os.path.exists('/sys/bus/pci/slots/%s/power' % self.slot):
         self.cancel("%s Slot does not support hotplug" % self.slot)
Exemplo n.º 5
0
    def setUp(self):
        """
        Check pre-requisites before running sensors command
        Testcase should be executed only on bare-metal environment.
        """
        s_mg = SoftwareManager()
        d_distro = distro.detect()
        if d_distro.name == "Ubuntu":
            if not s_mg.check_installed("lm-sensors") and not s_mg.install(
                    "lm-sensors"):
                self.cancel('Need sensors to run the test')
        elif d_distro.name == "SuSE":
            if not s_mg.check_installed("sensors") and not s_mg.install(
                    "sensors"):
                self.cancel('Need sensors to run the test')
        else:
            if not s_mg.check_installed("lm_sensors") and not s_mg.install(
                    "lm_sensors"):
                self.cancel('Need sensors to run the test')
        if d_distro.arch in ["ppc64", "ppc64le"]:
            if not cpu._list_matches(open('/proc/cpuinfo').readlines(),
                                     'platform\t: PowerNV\n'):
                self.cancel(
                    'sensors test is applicable to bare-metal environment.')

            config_check = linux_modules.check_kernel_config(
                'CONFIG_SENSORS_IBMPOWERNV')
            if config_check == 0:
                self.cancel('Config is not set')
            elif config_check == 1:
                if linux_modules.load_module('ibmpowernv'):
                    if linux_modules.module_is_loaded('ibmpowernv'):
                        self.log.info('Module Loaded Successfully')
                    else:
                        self.cancel('Module Loading Failed')
            else:
                self.log.info('Module is Built In')

        if not d_distro.name == "Ubuntu":
            try:
                process.run('service lm_sensors stop', sudo=True)
                process.run('service lm_sensors start', sudo=True)
                process.run('service lm_sensors status', sudo=True)
            except process.CmdError:
                self.error(
                    'Starting Service Failed. Make sure module is loaded')
        cmd = "yes | sudo sensors-detect"
        det_op = process.run(cmd, shell=True, ignore_status=True).stdout
        if 'no sensors were detected' in det_op:
            self.cancel('No sensors found to test !')