whew. sorted out a lot of gi/BD and fallback inconsistencies...

This commit is contained in:
brent s
2019-11-05 05:52:46 -05:00
parent 46351329b8
commit 37124f066a
6 changed files with 417 additions and 201 deletions

View File

@@ -1,7 +1,7 @@
import re
##
import parted # Do I need this if I can have libblockdev's mounts API? Is there a way to get current mounts?
import psutil
import parted
import psutil # Do I need this if I can have libblockdev's mounts API? Is there a way to get current mounts?
##
import aif.constants
import aif.utils
@@ -24,8 +24,8 @@ class Partition(object):
self.id = part_xml.attrib['id']
self.table_type = getattr(_BlockDev.PartTableType, tbltype.upper())
if tbltype == 'msdos':
# Could technically be _BlockDev.PartTypeReq.NEXT buuuut that doesn't *quite* work
# with our project's structure.
# Could technically be _BlockDev.PartTypeReq.NEXT BUT that doesn't *quite* work
# with this project's structure.
if part_type == 'primary':
self.part_type = _BlockDev.PartTypeReq.NORMAL
elif part_type == 'extended':
@@ -50,7 +50,7 @@ class Partition(object):
'must be one of: {1}').format(self.xml.attrib['fsType'],
', '.join(sorted(aif.constants.PARTED_FSTYPES))))
self.disk = diskobj
self.device = self.disk.device # TODO: how to get this in libblockdev?
self.device = self.disk.path
self.devpath = '{0}{1}'.format(self.device.path, partnum)
self.is_hiformatted = False
sizes = {}