Example #1
0
 def set(self, selected, laststate):
     if (laststate != freezeType.FreezeType.defrosted) | (selected == ''):
         return False
     runner = processRunner.ProcessRunner()
     runner.run('hdparm --user-master u --security-set-pass Passwd /dev/' +
                selected).decode('utf-8')
     hdparmresult = runner.run('hdparm -I /dev/' + selected).decode('utf-8')
     return self.__isSuccessful(hdparmresult)
Example #2
0
 def __runNVMe(self, kname):
     runner = processRunner.ProcessRunner()
     nvmeresult = runner.run('nvme id-ctrl /dev/' + kname +
                             ' -H').decode('utf-8')
     nvmeresult = nvmeresult.split('\n')
     model, serial = self.__getModelSerial(nvmeresult)
     model = model.strip()
     serial = serial.strip()
     return (model, serial)
Example #3
0
 def erase(self, selected, confirm):
     if not confirm:
         return eraseType.EraseType.failed.closed
     runner = processRunner.ProcessRunner()
     eraserWaiterView.EraserWaiterView(self.__getPollingFunction(selected))
     hdparmresult = runner.run('hdparm -I /dev/' + selected).decode('utf-8')
     if self.__isSuccessful(hdparmresult):
         return eraseType.EraseType.erased
     else:
         return eraseType.EraseType.failed
Example #4
0
    def __getPollingFunction(self, selected):
        runner = processRunner.ProcessRunner()
        process = runner.asyncrun(
            'hdparm --user-master u --security-erase Passwd /dev/' + selected)

        def pollfunc():
            result = True
            if runner.isProcessEnd(process):
                result = False
            return result

        return pollfunc
Example #5
0
 def select(self):
     runner = processRunner.ProcessRunner()
     jsonoutput = runner.run(
         'lsblk -Jo model,vendor,serial,size,kname,type')
     runresult = json.loads(jsonoutput.decode())
     finder = fixedStorageFinder.FixedStorageFinder()
     findresult = finder.find(runresult)
     refiner = nvmeRefiner.NVMeRefiner()
     findresult = refiner.refine(findresult)
     selector = selectorView.SelectorView()
     selector.select(findresult)
     return selector.selected(), findresult