Example #1
0
    def _parted_dev_test(self):
        cmd = ['parted', '-s', self.devPath, 'mktable', 'gpt']
        rc, out, err = utils.execCmd(cmd)
        self.assertEquals(rc, 0)
        cmd = [
            'parted', '-s', self.devPath, 'mkpart', 'primary', '0',
            '%sMB' % PART_SIZE_MB
        ]
        rc, out, err = utils.execCmd(cmd)
        self.assertEquals(rc, 0)
        cmd = ['parted', '-s', self.devPath, 'set', '1', 'boot', 'on']
        rc, out, err = utils.execCmd(cmd)
        self.assertEquals(rc, 0)
        time.sleep(1)  # wait for syncing

        info = putils.getDevicePartedInfo(self.devPath)
        self.assertTrue(info['sectorSize'] >= 0)
        self.assertEquals(info['type'], 'gpt')
        self.assertTrue(info['freeSpaceRegions'][0][3] >= FREE_SIZE)
        partName = '%sp1' % self.devPath
        partInfo = info['partitions'].get(partName)
        self.assertTrue(partInfo)
        self.assertIn(partInfo[0], (['boot'], ['boot', 'esp']))
        self.assertTrue(partInfo[1] >= 0)
        self.assertTrue((partInfo[2] * info['sectorSize']) >= PART_END_SIZE)
Example #2
0
    def _parted_dev_test(self):
        cmd = ['parted', '-s', self.devPath, 'mktable', 'gpt']
        rc, out, err = utils.execCmd(cmd)
        self.assertEquals(rc, 0)
        cmd = ['parted', '-s', self.devPath,
               'mkpart', 'primary', '0', '%sMB' % PART_SIZE_MB]
        rc, out, err = utils.execCmd(cmd)
        self.assertEquals(rc, 0)
        cmd = ['parted', '-s', self.devPath, 'set', '1', 'boot', 'on']
        rc, out, err = utils.execCmd(cmd)
        self.assertEquals(rc, 0)
        time.sleep(1)  # wait for syncing

        info = putils.getDevicePartedInfo(self.devPath)
        self.assertTrue(info['sectorSize'] >= 0)
        self.assertEquals(info['type'], 'gpt')
        self.assertTrue(info['freeSpaceRegions'][0][3] >= FREE_SIZE)
        partName = '%sp1' % self.devPath
        partInfo = info['partitions'].get(partName)
        self.assertTrue(partInfo)
        self.assertIn(partInfo[0], (['boot'], ['boot', 'esp']))
        self.assertTrue(partInfo[1] >= 0)
        self.assertTrue((partInfo[2] * info['sectorSize']) >= PART_END_SIZE)
Example #3
0
 def _blank_dev_test(self):
     info = putils.getDevicePartedInfo(self.devPath)
     self.assertTrue(info['sectorSize'] >= 0)
     self.assertFalse(info['type'])
     self.assertFalse(info['partitions'])
     self.assertFalse(info['freeSpaceRegions'])
Example #4
0
 def _empty_test(self):
     self.assertFalse(putils.getDevicePartedInfo('/dev/abcdef'))
Example #5
0
 def _blank_dev_test(self):
     info = putils.getDevicePartedInfo(self.devPath)
     self.assertTrue(info['sectorSize'] >= 0)
     self.assertFalse(info['type'])
     self.assertFalse(info['partitions'])
     self.assertFalse(info['freeSpaceRegions'])
Example #6
0
 def _empty_test(self):
     self.assertFalse(putils.getDevicePartedInfo('/dev/abcdef'))