Revision 1de1eff5 snf-image-helper/disklabel.py
b/snf-image-helper/disklabel.py | ||
---|---|---|
515 | 515 |
parser.add_option("-l", "--list", action="store_true", dest="list", |
516 | 516 |
default=False, |
517 | 517 |
help="list the disklabel on the specified media") |
518 |
parser.add_option("--print-last", action="store_true", dest="last_part",
|
|
519 |
default=False, |
|
518 |
parser.add_option("--get-last-partition", action="store_true",
|
|
519 |
dest="last_part", default=False,
|
|
520 | 520 |
help="print the label of the last partition") |
521 |
parser.add_option("--print-last-linux", action="store_true", |
|
522 |
dest="last_linux", default=False, |
|
523 |
help="print the linux number for the last partition") |
|
524 |
parser.add_option("--print-duid", action="store_true", dest="duid", |
|
521 |
parser.add_option("--get-duid", action="store_true", dest="duid", |
|
525 | 522 |
default=False, |
526 | 523 |
help="print the disklabel unique identifier") |
527 | 524 |
parser.add_option("-d", "--enlarge-disk", type="int", dest="disk_size", |
... | ... | |
550 | 547 |
if options.last_part: |
551 | 548 |
print "%c" % chr(ord('a') + disklabel.get_last_partition_id()) |
552 | 549 |
|
553 |
if options.last_linux: |
|
554 |
part_id = disklabel.get_last_partition_id() |
|
555 |
# The linux kernel does not assign a partition for label 'c' that |
|
556 |
# describes the whole disk |
|
557 |
print part_id + (4 if part_id > 2 else 5) |
|
558 |
|
|
559 | 550 |
if options.disk_size is not None: |
560 | 551 |
disklabel.enlarge_disk(options.disk_size) |
561 | 552 |
|
Also available in: Unified diff