Ejemplo n.º 1
0
    def step8(self):
        '''Step Details:Disconnect the PD assigned as GHS and reconnect the same
        Expected Result:Both the Events have to be displayed in MSM monitor and
        StoreLibTest. MSM GUI should also get refreshed.
        '''
        proc_state = self.mr.wait_for_event(
            event_id=MR_EVT_PD_STATE_CHANGE, background=True)
        proc_ghs = self.mr.wait_for_event(
            event_id=MR_EVT_PD_SPARE_GLOBAL_CREATED, background=True)
        time.sleep(12)  # sleep for 12 sec
        self.q_list[1].power(up=False)  # disconnect GHS PD
        time.sleep(10)

        if proc_state.is_alive():  # check ghs pd state aen
            raise SALError("AEN for PD state change was not found")
        else:
            self.log.info("AEN for PD state change found")

        self.q_list[1].power(up=True)  # reconnect the GHS PD
        time.sleep(20)

        if proc_ghs.is_alive():  # check ghs aen
            raise SALError("AEN for GHS created was not found")
        else:
            self.log.info("AEN for GHS created found")
Ejemplo n.º 2
0
    def step9(self):
        '''Step Details: Clear the controller configuration and repeat the same for
        R1E volume
        Expected Result: StoreLibTest and hence MSM monitor should show up the
        event for the same.
        '''
        proc_clear = self.mr.wait_for_event(
            event_id=MR_EVT_CFG_CLEARED, background=True)
        time.sleep(6)  # sleep for 6 sec
        self.mr.clear_config()  # clear the config
        time.sleep(5)
        if len(self.mr.get_vds()) != 0:
            raise SALError("Failed to clear the configuration!")
        else:
            self.log.info("Cleared the configuration successfully")

        for _ in xrange(120):  # wait for 10m for aen, if not raise Error
            if proc_clear.is_alive():  # check for clear config aen
                time.sleep(5)
            else:
                self.log.info("AEN for clear config was found")
                break  # break if aen found
        else:
            raise SALError("AEN for clear config was not found")

        self.raid = 11  # This will be used in step3
        self.pd_count = 3  # This will be used in step3
        self.log.info("Repeat steps 3 to 8 for R1E volume")
        self.step3()
        self.step4()
        self.step5()
        self.step6()
        self.step7()
        self.step8()
Ejemplo n.º 3
0
 def step1(self):
     """ Restore Factory Defaults"""
     self.set_value = 35
     self.default_value = 30
     self.log.info("Set CC Rate to 35 on all controllers")
     for mr in self.mrs:
         self.log.info("Set CC Rate on controller: %d", mr.ctrl_id)
         mr.cli.ccrate_set(self.set_value)
     init_val = []
     for mr in self.mrs:
         init_val.append(mr.cli.ccrate_get())
     self.log.info("Verify new CC Rate val on all controller")
     for (id, val) in enumerate(init_val):
         if val != self.set_value:
             raise SALError("CC Rate not set right on controller")
         else:
             self.log.info("Verified CC Rate on Controller: %d : %d" %
                           (id, val))
     self.log.info("Set to factory defaults on all controllers")
     for mr in self.mrs:
         self.log.info("Set to factory defaults on controller: %d, wait "
                       "for 250 secs" % (mr.ctrl_id))
         mr.cli.factory_defaults_set(restart=True)
         time.sleep(250)
     post_val = []
     for mr in self.mrs:
         post_val.append(mr.cli.ccrate_get())
     self.log.info("Verify CC Rate val on all controller after "
                   "factory defaults")
     for (id, val) in enumerate(post_val):
         if val != self.default_value:
             raise SALError("Failed to reset CC Rate on controller")
         else:
             self.log.info("Verified CC Rate reset on Controller: %d : %d" %
                           (id, val))
Ejemplo n.º 4
0
    def step4(self):
        """ Step Details: Remove one of the PD's from R1
        Expected Result: R1 should be shown as Degraded in MSM. MSM monitor
        logs should display events for VD state change.StoreLibTest also should
        show up events for the State change of the VD.
        MSM GUI should also get refreshed
        """
        self.proc_state = self.mr.wait_for_event(
            event_id=MR_EVT_PD_STATE_CHANGE, background=True)
        self.proc_deg = self.mr.wait_for_event(
            event_id=MR_EVT_LD_DEGRADED, background=True)
        time.sleep(12)
        self.q_list[0].power(up=False)  # Pull out one of the PD from R1
        time.sleep(10)

        if self.proc_deg.is_alive():  # check for VD degrade aen
            raise SALError("AEN for VD degrade was not found")
        else:
            self.log.info("AEN for VD degrade was found")

        if self.proc_state.is_alive():  # check for pd state change aen
            raise SALError("AEN for PD state change was not found")
        else:
            self.log.info("AEN for PD state change is found")

        # cross checking with storcli...
        if self.mr.cli.vd_get_info(self.vd.id)['state'] != 'DGRD':
            raise SALError("VD is not Degraded as it should be")
        else:
            self.log.info("VD:%s is Degraded" % (self.vd.id))
Ejemplo n.º 5
0
 def init(self):
     """ create mr adapter instance"""
     self.mrs = []
     if self.args.block_ctrl is not None:
         self.block_ctrl_list = self.args.block_ctrl.split(",")
         # Verify User input as per 0,1,2 format.
         if "" in self.block_ctrl_list:
             raise SALError("Invalid Input:[%s] to block controller "
                            "arguments given to scripts!!!" %
                            (self.block_ctrl_list))
     else:
         self.block_ctrl_list = ""
     # Create MR instance for controller index using --ctrl input.
     self.mrs.append(create_mradapter(ctrl_index=self.args.ctrl))
     self.ctrl_cnt = self.mrs[0].cli.controller_count()
     for index in range(0, self.ctrl_cnt):
         # Check for Block controller list.
         if str(index) not in self.block_ctrl_list:
             # Check for --Ctrl index given as arg to script.
             if index != self.args.ctrl:
                 self.log.info("Creating MR instance for Controller-%d" %
                               (index))
                 self.mrs.append(create_mradapter(ctrl_index=index))
         else:
             self.log.info("*****TC will not execute on Blocked "
                           "Controller-%d*****" % (index))
     for mr in self.mrs:
         if not mr.is_mr():
             raise SALError("This script is applicable only for MR "
                            "controller cards")
Ejemplo n.º 6
0
    def step2(self):
        """ Create multiple logical drives of different RAID levels with
            different properties"""
        self.mr_vds = []
        # Checking UGood availablity here, because after reboot cycle,
        # init will be called.
        for mr in self.mrs:
            self.log.info("Check for UGood PD's availablity on controller:%d" %
                          (mr.ctrl_id))
            pds = mr.cli.list_all_drives(pd_type="SAS",
                                         state="UGood",
                                         media_type="HDD",
                                         sector_size='512B')
            if len(pds) < 10:
                raise SALError("%d UGood HDD PD's are not available for RAID "
                               "Creation on Controller:%d" %
                               (10 - len(pds), mr.ctrl_id))
            else:
                self.log.info("Number of UGood HDD PD's available is %d on "
                              "controller:%d" % (len(pds), mr.ctrl_id))
        for mr in self.mrs:
            self.vds = []
            self.log.info("Create R0, R1, R5 with diff properties on "
                          "Controller: %d" % (mr.ctrl_id))
            self.vds.append(
                mr.cli.add_vd(raid=0,
                              vd_size="3000MB",
                              WB="WB",
                              RA='ra',
                              cache="direct"))
            self.vds.append(
                mr.cli.add_vd(raid=1,
                              vd_size="3000MB",
                              WB="WT",
                              RA='nora',
                              cache="cached"))
            self.vds.append(
                mr.cli.add_vd(raid=5,
                              vd_size="3000MB",
                              WB="WB",
                              RA='ra',
                              cache="direct"))
            for vd in self.vds:
                while True:
                    time.sleep(5)
                    if (mr.cli.init_progress(vd) == -1):
                        self.log.info("FGI completed for VD:%s" % (vd))
                        break
            for vd in self.vds:
                if mr.cli.vd_get_info(vd)['state'] != 'OPTL':
                    raise SALError("RAID-%s VD%s is not optimal" %
                                   (mr.cli.vd_get_info(vd)['raid'], vd))
                else:
                    self.log.info("RAID-%s VD%s is optimal" %
                                  (mr.cli.vd_get_info(vd)['raid'], vd))

            self.mr_vds.extend(self.vds)
            self.log.info("Created R0, R1, R5 successfully on controller: %d" %
                          (mr.ctrl_id))
Ejemplo n.º 7
0
    def step6(self):
        '''Step Details: On Rebuild completion check for LD state change
        Expected Result:MSM should automatically refresh the State change of LD
        Events related to same should be seen in both MSM and StoreLibTest.'''

        if self.proc_optimal.is_alive():  # check VD state optimal aen
            raise SALError("AEN for VD optimal was not found")
        else:
            self.log.info("AEN for VD optimal found")

        # cross checking with storcli...
        if self.mr.cli.vd_get_info(self.vd.id)['state'] != 'OPTL':
            raise SALError("VD is not optimal")
        else:
            self.log.info("VD:%s is optimal" % (self.vd.id))
Ejemplo n.º 8
0
    def step2(self):
        '''Step Details: Connect 4 UnconfiguredGood PD"s to the Controller.
        Step Expected Result: StoreLibTest should show up events for the same.
        MSM monitor should throw events about PD"s been inserted and GUI should
        refresh on inserting the PD"s.'''
        proc_pd_insert = self.mr.wait_for_event(
            event_id=MR_EVT_PD_INSERTED, background=True)
        time.sleep(6)  # sleep for 6 sec
        self.qrch = quarch.TorridonController(ip_address=self.args.quarch_ip)
        self.mod_list = self.qrch.get_modules()
        self.q_list = system.filter_devices(self.mod_list, type='dtab')

        # Make sure all PDs are pushed out
        for dtab in self.q_list:
            dtab.power(up=False)
            time.sleep(1)
        time.sleep(30)

        # Make sure all PDs are pushed in
        for dtab in self.q_list:
            dtab.power(up=True)
            time.sleep(1)
        time.sleep(30)

        if proc_pd_insert.is_alive():  # check for pds insert aen
            raise SALError("AEN for PDs insert was not found")
        else:
            self.log.info("AEN for PDs insert was found")
Ejemplo n.º 9
0
    def step1(self):
        """ Register AEN and create R1/R5 """
        self.log.info("Registering LD Created, Optimal, Init Successfull, "
                      "PD state Change Event")
        proc_create = self.mr.wait_for_event(
            event_id=MR_EVT_LD_CREATED, background=True)
        proc_optimal = self.mr.wait_for_event(
            event_id=MR_EVT_LD_OPTIMAL, background=True)
        proc_init = self.mr.wait_for_event(
            event_id=MR_EVT_LD_INIT_SUCCESSFUL, background=True)
        self.proc_state = self.mr.wait_for_event(
            event_id=MR_EVT_PD_STATE_CHANGE, background=True)
        time.sleep(30)
        self.log.info("Create RAID-1")
        self.vd = self.mr.add_vd(raid=1, absolute_space="20GB", init_state=1)
        while self.vd.fgi_running:
            time.sleep(5)  # sleep for 5 sec, as fgi is still running
        if self.vd.get_state() != 3:  # Optimal
            raise SALError("RAID-%s VD: %d is not Optimal"
                           % (self.vd.raid_level, self.vd.id))
        else:
            self.log.info("RAID-%s VD: %d created and is in Optimal state"
                          % (self.vd.raid_level, self.vd.id))
        if proc_create.is_alive():  # check for aen for vd create aen
            proc_optimal.terminate()
            raise SALError("AEN for RAID-%s VD-%d created was not found"
                           % (self.vd.raid_level, self.vd.id))
        else:
            self.log.info("AEN for RAID-%s VD-%d created found"
                          % (self.vd.raid_level, self.vd.id,))
        time.sleep(15)
        if proc_init.is_alive():  # check for init complete aen
            proc_init.terminate()
            raise SALError("AEN for VD Fastinit successful was not found")
        else:
            self.log.info("AEN for Fastinit found")

        if self.proc_state.is_alive():  # check for pd state change aen
            raise SALError("AEN for PD state change was not found")
        else:
            self.log.info("AEN for PD state change is found")

        if proc_optimal.is_alive():  # check VD state optimal aen
            proc_create.terminate()
            raise SALError("AEN for VD Optimal was not found")
        else:
            self.log.info("AEN for VD Optimal found")
Ejemplo n.º 10
0
    def step1(self):
        '''Log-in Vivaldi GUI. Open StoreLibTest as well.
        MSM should display the controller and its properties.
        StoreLibTest also displays the controller.'''
        # enableEmergencySpare = 0
        # useGlobalSparesForEmergency = 0
        # useUnconfGoodForEmergency = 0
        # maintainPdFailHistory = 0
        self.mr.set_test_defaults()  # sets above properties to defaults
        self.mr.set_ctrl_property(restoreHotSpareOnInsertion=1)
        if self.mr.get_ctrl_property()['disableAutoRebuild'] == 1:
            self.mr.set_ctrl_property(disableAutoRebuild=0)
        time.sleep(30)  # sleep for 30sec
        if self.mr.get_ctrl_property()['disableAutoRebuild'] != 0:
            raise SALError("'disableAutoRebuild' is set to 1")
        else:
            self.log.info("'disableAutoRebuild' is set to 0")

        # get controller properties from sl and cli
        ctrl_prop_sl = self.mr.get_ctrl_property()
        ctrl_prop_cli = self.mr.cli.get_all()

        if ctrl_prop_sl['BIOS'].upper() != ctrl_prop_cli['bios_version'].upper():
            raise SALError("Failed to match bios_version!")
        else:
            self.log.info("bios_version: %s" % ctrl_prop_sl['BIOS'])

        keys_sl = ['pci_subDevId', 'pci_subVendorId', 'pci_vendorId']
        keys_cli = ['subdevice_id', 'subvendor_id', 'vendor_id']

        self.log.info("*****Display details about devieID, etc*****")
        for (key1, key2) in zip(keys_sl, keys_cli):
            # convert hex to decimal and then str to compare with SL values
            if ctrl_prop_sl[key1] != str(int(ctrl_prop_cli[key2], 16)):
                raise SALError("Failed to match %s" % key1)
            else:
                self.log.info("%s : %s" % (key1, ctrl_prop_sl[key1]))

        if ctrl_prop_sl['productName'].upper() != ctrl_prop_cli['model'].upper():
            raise SALError("Failed to match product name!")
        else:
            self.log.info("Product name: %s" % ctrl_prop_sl['productName'])

        self.log.info("*****Display full controller info*****")
        for key, val in iter(sorted(ctrl_prop_sl.iteritems())):
            self.log.info("%s <====> %s" % (key, val))
Ejemplo n.º 11
0
 def step2(self):
     """ Make one of PD offline from above created VD """
     self.log.info("Registering LD Degraded event")
     self.proc_deg = self.mr.wait_for_event(
         event_id=MR_EVT_LD_DEGRADED, background=True)
     time.sleep(10)
     self.pds = self.vd.get_pds()
     self.pds[0].state = 'offline'  # make pd offline from raid1 VD
     time.sleep(15)
     if self.proc_state.is_alive():  # check for pd state change aen
         raise SALError("AEN for PD state change was not found")
     else:
         self.log.info("AEN for PD state change is found")
         self.log.info("PD ID-%d, State: %s"
                       % (self.pds[0].id, self.pds[0].state))
     if self.proc_deg.is_alive():  # check for VD degrade aen
         raise SALError("AEN for VD Degrade was not found")
     else:
         self.log.info("AEN for VD Degrade was found")
Ejemplo n.º 12
0
 def step3(self):
     """ Start a rebuild  """
     self.log.info("Registering LD Rebuild start event")
     self.proc_rbld = self.mr.wait_for_event(
         event_id=MR_EVT_PD_RBLD_START, pd=self.pds[0], background=True)
     time.sleep(15)
     self.pds[0].start_rebuild()
     time.sleep(15)
     if self.proc_rbld.is_alive():  # check for rebuild start aen
         raise SALError("AEN for PD Rebuild was not found")
     else:
         self.log.info("AEN for PD Rebuild found")
Ejemplo n.º 13
0
    def step7(self):
        '''Step Details: Assign an Unconfigured Good PD as a GlobalHotSpare
        Expected Result: GlobalHotSpare can be created without any hassles.
        MSM monitor and StoreLibTest should show events for the same.
        '''
        proc_ghs = self.mr.wait_for_event(
            event_id=MR_EVT_PD_SPARE_GLOBAL_CREATED, background=True)
        time.sleep(6)  # sleep for 6 sec
        self.q_list[1].power(up=False)
        time.sleep(10)
        pds_after_pull = self.mr.get_all_pds(state='unconfigured_good')
        self.q_list[1].power(up=True)
        time.sleep(30)
        all_pds = self.mr.get_all_pds(state='unconfigured_good')
        for pd in all_pds:
            for after_pd in pds_after_pull:
                if pd.id == after_pd.id:
                    break
            else:
                break  # Found
        self.pd_ghs = pd
        self.pd_ghs.make_hotspare()
        time.sleep(5)

        if self.pd_ghs.state != 'hot_spare':
            raise SALError("Failed to create GHS!")
        else:
            self.log.info("GHS created on PD:%s" % self.pd_ghs.id)

        if proc_ghs.is_alive():  # check ghs aen
            raise SALError("AEN for GHS created was not found")
        else:
            self.log.info("AEN for GHS created found")

        # cross checking with storcli...
        if self.mr.cli.pd_get_info(self.pd_ghs.cli)['state'] != "GHS":
            raise SALError("Failed to create GHS")
        else:
            self.log.info("GHS is created on PD: %s" % self.pd_ghs.cli)
Ejemplo n.º 14
0
 def init(self):
     """ create mr adapter instance"""
     self.mr = create_mradapter(ctrl_index=self.args.ctrl, test_script=self)
     self.log.info("Check for UGood PD's availablity on Controller:%d"
                   % (self.args.ctrl))
     pds = self.mr.get_all_pds(is_sas=True, state='unconfigured_good',
                               media_type="hdd",
                               is_foreign=False)
     if len(pds) < 5:
         raise SALError("%d UGood HDD PD's are not available for "
                        "RAID Creation" % (5 - len(pds)))
     else:
         self.log.info("Number of UGood HDD PD's available is %d"
                       % (len(pds)))
Ejemplo n.º 15
0
 def step8(self):
     """ Display the boot drive for all of the controllers at once
         (-aALL)"""
     for mr in self.mrs:
         self.log.info("Display boot drive on controller:%d" % (mr.ctrl_id))
         vd_id = mr.cli.bootdrive_vd_get()
         if (int(vd_id) == -1):  # -1 : No boot VD.
             raise SALError("Failed to verify boot drive")
         else:
             self.log.info("Verified VD ID: %d of the boot VD on "
                           "controller: %d" % (int(vd_id), mr.ctrl_id))
     for vd in self.mr_vds:
         self.mrs[0].cli.delete_vd(vd_id=vd)
     time.sleep(30)
     self.log.info("Deleted all VD's succesfully")
Ejemplo n.º 16
0
    def step10(self):
        '''Step Details: Disconnect all the 4 PD"s
        Step Expected Result: MSM monitor logs should show up the events about
        the same and the GUI should get refreshed. StoreLibTest also should
        show up the PD removal events.'''
        proc_pd_rem = self.mr.wait_for_event(
            event_id=MR_EVT_PD_REMOVED, background=True)
        time.sleep(6)  # sleep for 6 sec
        self.log.info("Delete the above created VD: %d" % self.vd.id)
        self.vd.delete()
        # Make sure all PDs are pushed out
        for dtab in self.q_list:
            dtab.power(up=False)
            time.sleep(1)
        time.sleep(30)

        if proc_pd_rem.is_alive():  # check PD state
            raise SALError("AEN for PDs removal was not found")
        else:
            self.log.info("AEN for PDs removal found")
Ejemplo n.º 17
0
 def step4(self):
     """ Monitor rebuild progress untill 100% """
     self.log.info("Registering PD Rebuild done event")
     proc_rbld2 = self.mr.wait_for_event(
         event_id=MR_EVT_PD_RBLD_DONE_PD, background=True)
     time.sleep(10)
     while True:  # Monitor rebuild progress
         prog = self.pds[0].get_progress_rebuild()
         if prog != -1:
             time.sleep(10)
             self.log.info("PD ID-%d, Rebuild Progress: %d"
                           % (self.pds[0].id, prog))
         else:
             break  # break from while when rebuild is done
     time.sleep(15)
     if proc_rbld2.is_alive():  # check for rebuild done aen
         raise SALError("AEN for Rebuild done didn't found!")
     else:
         self.log.info("AEN for PD Rebuild done is found")
     self.log.info("Delete the VD created in step1")
     self.vd.delete()
Ejemplo n.º 18
0
    def step3(self):
        """R1 is created without any error. Events related to it should be
        thrown in both MSM and StoreLibTest"""
        proc_create = self.mr.wait_for_event(
            event_id=MR_EVT_LD_CREATED, background=True)
        proc_optimal = self.mr.wait_for_event(
            event_id=MR_EVT_LD_OPTIMAL, background=True)
        proc_init = self.mr.wait_for_event(
            event_id=MR_EVT_LD_INIT_SUCCESSFUL, background=True)
        proc_state = self.mr.wait_for_event(
            event_id=MR_EVT_PD_STATE_CHANGE, background=True)
        time.sleep(30)  # sleep for 30 sec

        # Drive group 1
        self.q_list[0].power(up=False)
        time.sleep(10)
        dg1 = self.mr.get_pds(pd_count=self.pd_count, is_sas=True)
        pds_after_pull = self.mr.get_all_pds()
        self.q_list[0].power(up=True)
        time.sleep(30)
        all_pds = self.mr.get_all_pds()
        for pd in all_pds:
            for after_pd in pds_after_pull:
                if pd.id == after_pd.id:
                    break
            else:
                break  # Found
        self.pd = pd  # will be used in step5
        dg1.append(pd)
        self.vd = self.mr.add_vd(
            raid=self.raid, pd_list=dg1, absolute_space="25GB", init_state=1)

        for _ in xrange(24):  # wait for 2m for aen, if not raise Error
            if proc_create.is_alive():  # check for vd create aen
                time.sleep(5)
            else:
                self.log.info("AEN for VD created found")
                self.log.info("VD ID: %d, raid: %s" %
                              (self.vd.id, self.vd.raid_level))
                break  # break if aen found
        else:
            proc_optimal.terminate()
            raise SALError("AEN for VD created was not found")
        time.sleep(15)  # sleep for 15 sec

        for _ in xrange(24):  # wait for 2m for aen, if not raise Error
            if proc_init.is_alive():  # check for init complete aen
                time.sleep(5)
            else:
                self.log.info("AEN for VD fast init found")
                break  # break if aen found
        else:
            raise SALError("AEN for VD fast init successful was not found")

        if proc_state.is_alive():  # check for pd state change aen
            raise SALError("AEN for PD state change was not found")
        else:
            self.log.info("AEN for PD state change is found")

        if proc_optimal.is_alive():  # check VD state optimal aen
            proc_create.terminate()
            raise SALError("AEN for VD optimal was not found")
        else:
            self.log.info("AEN for VD optimal found")

        # cross checking with storcli...
        if self.mr.cli.vd_get_info(self.vd.id)['state'] != 'OPTL':
            raise SALError("VD is not optimal")
        else:
            self.log.info("VD:%s is optimal" % (self.vd.id))
Ejemplo n.º 19
0
    def step5(self):
        """ Step Details: Re-connect the PD
        Step Expected Result: PD should rebuild to completion.
        MSM and StoreLibTest should throw corresponding events.
        """
        self.proc_rbld = self.mr.wait_for_event(
            event_id=MR_EVT_PD_RBLD_START_AUTO, pd=self.pd, background=True)
        self.proc_rbld_dn = self.mr.wait_for_event(
            event_id=MR_EVT_PD_RBLD_DONE_PD, background=True)
        self.proc_optimal = self.mr.wait_for_event(
            event_id=MR_EVT_LD_OPTIMAL, background=True)
        time.sleep(20)  # sleep for 20 sec

        # Pull in the PD which was pulled out earlier
        self.q_list[0].power(up=True)
        time.sleep(10)
        if self.mr.scan_foreign_config() > 0:
            self.mr.clear_foreign_config()
            time.sleep(30)

        for _ in range(24):
            time.sleep(5)
            if self.pd.get_progress_rebuild() != -1:
                self.log.info("Rebuild kicks in automatically")
                break
        else:
            raise SALError("Rebuild do not kick in automatically!")

        # check rebuild started or not through cli
        pds = self.vd.get_pds()
        for (indx, pd) in enumerate(pds):
            if pd.id == self.pd.id:
                break  # Found vd_pd index
        else:
            raise SALError("Not found the VD_PD index")

        if self.mr.cli.rebuild_progress(vd_id=int(self.vd.id), vd_pd=indx) == -1:
            raise SALError("Failed to start rebuild!")
        else:
            self.log.info("Rebuild kicks in automatically")

        for _ in range(24):
            if self.proc_rbld.is_alive():  # check for rebuild start aen
                time.sleep(5)
            else:
                self.log.info("AEN for PD rebuild auto start was found.")
                break
        else:
            raise SALError("AEN for PD rebuild auto start wasn't found!")

        while True:  # Monitor rebuild progress
            prog = self.pd.get_progress_rebuild()
            if prog != -1:
                time.sleep(10)
                self.log.info("PD ID: %d, rebuild progress: %d"
                              % (self.pd.id, prog))
            else:
                self.log.info("Rebuild is completed successfully")
                break  # break from while when rebuild is done

        time.sleep(5)  # sleep for 5s
        # check rebuild done or not through cli
        if self.mr.cli.rebuild_progress(vd_id=int(self.vd.id), vd_pd=indx) != -1:
            raise SALError("Rebuild is not completed yet!")
        else:
            self.log.info("Rebuild is completed successfully")

        for _ in range(24):
            if self.proc_rbld_dn.is_alive():  # check for rebuild done aen
                time.sleep(5)
            else:
                self.log.info("AEN for PD rebuild done is found!")
                break
        else:
            raise SALError("AEN for PD rebuild done wasn't found!")
Ejemplo n.º 20
0
    def step1(self):
        """Connect some drives to the controller w/o enclosure
        <BR>-create some logical drives
        Step Expected Result: -Should get new Firmware version, bios version...etc.
        <BR>-Should get VendorID, SubSystemID...
        <BR>-Should print the product name info
        <BR>-Should get #PD present, #PD critical, #PD offline
        <BR>-Should get number of LD present, #LD critical, #LD failed
        <BR>-Alarm, data transfer rate
        <BR>-Memory size <BR>-Cluster info <BR>-Raid support <BR>-Support adapter option
        <BR>-Support SAS and SATA mix....
        <BR>-Rebuild rate, CC rate, INIT rate, Reconstruction rate....etc"""
        int_fw_val = self.mr.firmware_version
        self.log.info("Current FW version: %s" % int_fw_val)
        self.log.info("Flashing firmware: %s" % (self.args.new_fw_path))
        self.mr.flash_file(firmware_filename=self.args.new_fw_path)
        time.sleep(240)  # sleep for 4m
        post_fw_val = self.mr.firmware_version
        if int_fw_val == post_fw_val:
            raise SALError("Failed to change firmware version!")
        else:
            self.log.info("FW  Flashed successfully")
            self.log.info("New FW version: %s" % post_fw_val)

        # get controller properties from sl and cli
        ctrl_prop_sl = self.mr.get_ctrl_property()
        ctrl_prop_cli = self.mr.cli.get_all()

        if ctrl_prop_sl['BIOS'].upper() != ctrl_prop_cli['bios_version'].upper(
        ):
            raise SALError("Failed to match bios_version!")
        else:
            self.log.info("bios_version: %s" % ctrl_prop_sl['BIOS'])

        drv_info = self.mr.get_driver_version()  # get driver info from sl
        if drv_info['version'].strip() != ctrl_prop_cli['driver_version']:
            raise SALError("Failed to match driver_version!")
        else:
            self.log.info("driver_version: %s" % drv_info['version'].strip())

        if drv_info['name'].upper() != ctrl_prop_cli['driver_name'].upper():
            raise SALError("Failed to match driver_name!")
        else:
            self.log.info("driver_name: %s" % drv_info['name'])

        keys_sl = ['pci_subDevId', 'pci_subVendorId', 'pci_vendorId']
        keys_cli = ['subdevice_id', 'subvendor_id', 'vendor_id']

        self.log.info("*****Display details about devieID, etc*****")
        for (key1, key2) in zip(keys_sl, keys_cli):
            # convert hex to decimal and then str to compare with SL values
            if ctrl_prop_sl[key1] != str(int(ctrl_prop_cli[key2], 16)):
                raise SALError("Failed to match %s" % key1)
            else:
                self.log.info("%s : %s" % (key1, ctrl_prop_sl[key1]))

        if ctrl_prop_sl['productName'].upper() != ctrl_prop_cli['model'].upper(
        ):
            raise SALError("Failed to match product name!")
        else:
            self.log.info("Product name: %s" % ctrl_prop_sl['productName'])

        self.log.info("alarmEnable: %s" % ctrl_prop_sl['alarmEnable'])
        self.log.info("memorySize: %s" % ctrl_prop_sl['memorySize'])
        self.log.info("max_data_transfer_size: %s" %
                      ctrl_prop_cli['max_data_transfer_size'])

        # get pds from back plane, connect only one enclosure and one back
        # plane
        encl_ids_sl = self.mr.get_encls()
        pds = self.mr.get_all_pds(state='unconfigured_good')
        pds_bp = [
            pd for pd in pds
            if pd.get_info()['enclDeviceId'] != str(encl_ids_sl[0])
        ]
        if len(pds_bp) == 0:
            raise SALError("No PDs found on backplane")
        else:
            self.log.info("PD's count on backplane: %d" % len(pds_bp))
        self.vds = self.mr.add_vd(raid=0,
                                  absolute_space="10GB",
                                  pd_list=pds_bp,
                                  vd_count=2)
        for vd in self.vds:
            while vd.fgi_running:
                time.sleep(6)  # fgi is still running, sleep for 6 sec
        for vd in self.vds:
            if vd.get_state() != 3:  # Optimal
                raise SALError("The VD failed to be created optimal!")
            else:
                self.log.info("Raid %s VD: %d created." %
                              (vd.raid_level, vd.id))

        ctrl_health = self.mr.get_ctrl_health()
        self.log.info("*****Display PD health*****")
        self.log.info("pdOptimalCount:%d" % ctrl_health['pdOptimalCount'])
        self.log.info("pdPredFailCount: %d" % ctrl_health['pdPredFailCount'])
        self.log.info("pdFailedCount: %d" % ctrl_health['pdFailedCount'])

        self.log.info("*****Display LD health*****")
        if ctrl_health['ldOptimalCount'] != 2:
            raise SALError("ldOptimalCount is not matching")
        else:
            self.log.info("ldOptimalCount: %d" % ctrl_health['ldOptimalCount'])

        if ctrl_health['ldCriticalCount'] != 0:
            raise SALError("ldCriticalCount is not matching")
        else:
            self.log.info("ldCriticalCount: %d" %
                          ctrl_health['ldCriticalCount'])
        if ctrl_health['ldOfflineCount'] != 0:
            raise SALError("ldOfflineCount is not matching")
        else:
            self.log.info("ldOfflineCount: %d" % ctrl_health['ldOfflineCount'])

        # Display the cluster information
        self.log.info("*****Display cluster information*****")
        cluster_info = self.mr.get_controller_capabilities(
            group_name='cluster')
        for k, v in iter(sorted(cluster_info.iteritems())):
            self.log.info("%s : %s" % (k, v))

        rl_s = self.mr.get_controller_capabilities(group_name='raidLevels')
        for k, v in iter(sorted(rl_s.iteritems())):
            self.log.info("%s : %s" % (k, v))

        self.log.info("*****Display adapter operation information*****")
        adp_op = self.mr.get_controller_capabilities(
            group_name='adapterOperations')
        for k, v in iter(sorted(adp_op.iteritems())):
            self.log.info("%s : %s" % (k, v))

        self.log.info("*****Display pd/ld mix information*****")
        pd_mix = self.mr.get_controller_capabilities(group_name='pdMixSupport')
        for k, v in iter(sorted(pd_mix.iteritems())):
            self.log.info("%s : %s" % (k, v))

        self.log.info("*****Display Rates information*****")
        rates_sl = [
            'bgiRate', 'ccRate', 'patrolReadRate', 'rebuildRate', 'reconRate'
        ]
        rates_cl = [
            'bgi_rate_current', 'check_consistency_rate_current',
            'pr_rate_current', 'rebuild_rate_current',
            'reconstruction_rate_current'
        ]
        for (key1, key2) in zip(rates_sl, rates_cl):
            if str(ctrl_prop_sl[key1]) != ctrl_prop_cli[key2]:
                raise SALError("Failed to match %s" % key1)
            else:
                self.log.info("%s: %d" % (key1, ctrl_prop_sl[key1]))
Ejemplo n.º 21
0
    def step2(self):
        """ Connect an enclosure with some drives within enclosure.
        Issue GetControllerInfo should display device ID of enclosure
        <BR>-SAS address
        <BR>-should display what ID within enclosure.... """

        encls_ids_sl = self.mr.get_encls()
        encl_list = self.mr.get_encl_list()
        # encls_ids_cli = self.mr.cli.enclosure_list()

        if encls_ids_sl[0] != encl_list['encl0_deviceId']:
            raise SALError("Failed to match enclosure ID!")
        else:
            self.log.info("Enclosure ID: %d" % encls_ids_sl[0])
        ctrl_prop_cli = self.mr.cli.get_all(
        )  # get controller properties through cli
        self.log.info("sas_address: %s" % ctrl_prop_cli['sas_address'])
        pds = self.mr.get_all_pds(encl_id=encls_ids_sl[0])
        for pd in pds:
            pd_c = pd.get_info()['enclDeviceId'] + ':' + str(pd.slotNumber)
            info = self.mr.cli.pd_get_info(pd_string=pd_c)
            pd_size1 = int(int(info['size']) / KB)  # convert MB into GB
            pd_size2 = int(pd.size / GB)  # convert pd size bytes into GB
            size = abs(pd_size1 - pd_size2)  # get absolute value
            if size > 2:  # if size difference more than 2GB raise salerror
                raise SALError("Failed to match PD size!")
            else:
                self.log.info("PD size in GB: %d" % pd_size2)

            if info['media_type'] != pd.media_type.upper():
                raise SALError("Failed to match media_type!")
            else:
                self.log.info("PD: %s, Media type: %s" %
                              (pd_c, info['media_type']))

            if info['media_error_count'] != pd.get_info()['mediaErrCount']:
                raise SALError("Failed to match mediaErrCount!")
            else:
                self.log.info("PD: %s, mediaErrCount: %s " %
                              (pd_c, info['media_error_count']))
            if info['firmware_revision'] != pd.get_info()['revisionLevel']:
                raise SALError("Failed to match firmwware_revision!")
            else:
                self.log.info("PD: %s, firmware_revision: %s " %
                              (pd_c, info['firmware_revision']))
            sas_add_sl = pd.unique_id.split(':')[-1]
            if len(info['sas_address_0']) > 3:
                sas_add_cli = info['sas_address_0'].replace('0X', '')
                i = 0
            else:
                sas_add_cli = info['sas_address_1'].replace('0X', '')
                i = 1
            if sas_add_cli != sas_add_sl:
                raise SALError("Failed to match SAS address")
            else:
                self.log.info("PD: %s, sas_address_%s: 0X%s" %
                              (pd_c, i, sas_add_cli))
            if self.mr.cli.pd_is_sas(pd_string=pd_c):  # if pd is SATA skip
                if len(info['sas_address_0']) > 3:
                    self.log.info("PD: %s, sas_address_1: %s" %
                                  (pd_c, info['sas_address_1']))
                else:
                    self.log.info("PD: %s, sas_address_0: %s" %
                                  (pd_c, info['sas_address_0']))

        self.log.info("Delete the above created VD")
        for vd in self.vds:
            vd.delete()