Merge branch 'bqin'

This commit is contained in:
Peng Zhihui
2013-12-27 15:37:13 +08:00

View File

@@ -122,16 +122,8 @@ class Partition:
''' each disk '''
for d in Partition.get_disks():
_device = _ped.device_get(d)
try:
_disk = _ped.Disk(_device)
except:
continue
_part = _disk.next_partition()
''' free partition number '''
fn = 0
''' partition sequence number '''
sn = 0
''' each partition '''
dev = _device.path
''' algorithm from parted.c do_print() '''
disk_start = _device.unit_format (0)
@@ -141,8 +133,42 @@ class Partition:
disk_size = disk_end
try:
_disk = _ped.Disk(_device)
except Exception, message:
m_p = re.compile('.*: unrecognised disk label')
dev = _device.path
''' process partition table is empty '''
if m_p.match(str(message)):
Partition(dev, # device name
disk_size, # disk size
' ', # partition_table
'yes', # disk from os
' ', # partition sequence number
' ', # partition
' ', # num
' ', # start
' ', # end
' ', # size
' ', # type
' ', # file system
' ', # flags
'yes', # partition from os
' ', # whether format
' ' # mount point
)
continue
''' free partition number '''
fn = 0
''' partition sequence number '''
sn = 0
partition_table = _disk.type.name
dev = _device.path
''' each partition '''
_part = _disk.next_partition()
if DEBUG:
print dev