Exemplo n.º 1
0
 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)')
Exemplo n.º 2
0
 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')
Exemplo n.º 3
0
 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')
Exemplo n.º 4
0
 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)')
Exemplo n.º 5
0
    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}
Exemplo n.º 6
0
    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}
Exemplo n.º 7
0
 def test_bad_path(self):
     validate_virtalignscan_installed()
     scanImage("nonexistent-image-name")
Exemplo n.º 8
0
 def test_bad_path(self):
     validate_virtalignscan_installed()
     scanImage("nonexistent-image-name")