def execute(self, State): ''' this method write smart heap variables to mstrexec-iserver. ''' #init the variables. self.init(State) if self.logflag == True: self.logger.log(self.info) pass # 1.connect to Linux machine self = Command.getClient(self) if self.stat == self.FAILED: return self.FAILED #2. backup the files smpath = Command.checkPath(self.buildInstallPath)+self.buildNo+"/"+self.buildVersion+"/BIN/"+self.OS+"/bin/mstrexec-iserver" self = Command.backupFiles(self,smpath) if self.stat == self.FAILED: return self.FAILED # 3.read smart heap variables from config.ini configlocation = "Config\config.ini" cf = ConfigParser.ConfigParser() cf.read(configlocation) parameters=cf.items("SmartHeap") smstr = "" for item in parameters: smstr = smstr+"export "+item[0].upper()+"="+item[1]+"\\n" # 4.write smart heap variables to mstrexec-iserver smpos = "mstr_check_max_semaphore" command = "sed -i '/"+smpos+"/a "+smstr+"' "+smpath result = Command.executeSsh(command, self.client) if result != "": self.stat = self.FAILED self.info ="modify mstrexec-iserver failed." +result+command if self.logflag == True: self.logger.log(self.info) Command.restoreFiles(self,smpath) return self.FAILED if self.stat == self.FAILED: Command.restoreFiles(self,smpath) return self.FAILED else: self.stat = self.PASS self.info = "tune smart heap successfully." if self.logflag == True: self.logger.log(task.info) return self.PASS
def execute(self, State): """ configure the performance counter and log size """ self.init(State) if self.logflag == True: self.logger.log(self.info) # 1.connect to Linux machine self = Command.getClient(self) if self.stat == self.FAILED: return self.FAILED # regpath = "/build/MSITEST/Test_MSIReg.reg" self = Command.getUnixOS(self) regpath = ( Command.checkPath(self.buildInstallPath) + self.buildNo + "/" + self.buildVersion + "/BIN/" + self.OS + "/MSIReg.reg" ) # 2. backup the files self = Command.backupFiles(self, regpath) if self.stat == self.FAILED: return self.FAILED # 3. add missed counters self = Command.getMsiregInfo(self) for modi in self.msiModifyInfo["Reg"]: if modi["type"] == "append": self = Command.sedAppend(self, modi["oldstr"], modi["newstr"], regpath) if self.stat == self.FAILED: Command.restoreFiles(self, regpath) return self.FAILED elif modi["type"] == "replace": self = Command.sedReplace(self, modi["oldstr"], modi["newstr"], regpath) if self.stat == self.FAILED: Command.restoreFiles(self, regpath) return self.FAILED elif modi["type"] == "insert": self = Command.sedInsert(self, modi["oldstr"], modi["newstr"], regpath) if self.stat == self.FAILED: Command.restoreFiles(self, regpath) return self.FAILED elif modi["type"] == "update": self = Command.sedDelete(self, modi["oldstr"], modi["endstr"], regpath) self = Command.sedInsert(self, modi["nextstr"], modi["newstr"], regpath) if self.stat == self.FAILED: Command.restoreFiles(self, regpath) return self.FAILED # 4.set output log to null:sed 's/"DebugOutput"=""//g' MSIReg.reg > MSIReg.tmp self = Command.sedReplace(self, '"DebugOutput"=""', "", regpath) if self.stat == self.FAILED: Command.restoreFiles(self, regpath) return self.FAILED # 5.change size of DSSError.log:sed 's/"MaxSize"=dword:00000800/"MaxSize"=dword:00032000/g' self = Command.sedReplace(self, '"MaxSize"=dword:00000800', '"MaxSize"=dword:00032000', regpath) if self.stat == self.FAILED: Command.restoreFiles(self, regpath) return self.FAILED # 6.change size of DSSPerformance.log;sed 's/"MaxSize"=dword:000007d0/"MaxSize"=dword:00032000/g' self = Command.sedReplace(self, '"MaxSize"=dword:000007d0', '"MaxSize"=dword:00032000', regpath) if self.stat == self.FAILED: Command.restoreFiles(self, regpath) return self.FAILED # 8.set DSSPerformance counters:sed 's/"Persist"=dword:00000000/"Persist"=dword:00000001/g' for modi in self.msiModifyInfo["Perf"]: if modi["AllPerfOn"] == "true": self = Command.sedReplace(self, '"Persist"=dword:00000000', '"Persist"=dword:00000001', regpath) if self.stat == self.FAILED: Command.restoreFiles(self, regpath) return self.FAILED self.stat = self.PASS self.info = "Linux diag configure successfully" if self.logflag == True: self.logger.log(self.info) return self.PASS