def test_nonaligned_image(self): validate_virtalignscan_installed() with tempfile.NamedTemporaryFile() as img: mkimage(img.name, aligned=False) msg = scanImage(img.name) eq_(msg[0][0], '/dev/sda1') eq_(msg[0][3], False) eq_(msg[0][4], 'bad (alignment < 4K)')
def test_aligned_image(self): validate_virtalignscan_installed() with tempfile.NamedTemporaryFile() as img: mkimage(img.name, aligned=True) msg = scanImage(img.name) eq_(msg[0][0], '/dev/sda1') eq_(msg[0][3], True) eq_(msg[0][4], 'ok')
def getDiskAlignment(self, drive): """ Returns the alignment of the disk partitions param drive: is either {"poolID": , "domainID": , "imageID": , "volumeID": } or {"GUID": } Return type: a dictionary with partition names as keys and True for aligned partitions and False for unaligned as values """ aligning = {} volPath = self.prepareVolumePath(drive) try: out = alignmentScan.scanImage(volPath) for line in out: aligning[line.partitionName] = line.alignmentScanResult finally: self.teardownVolumePath(drive) return {'status': doneCode, 'alignment': aligning}
def test_bad_path(self): validate_virtalignscan_installed() scanImage("nonexistent-image-name")