Skip to content

Commit

Permalink
New diskutil.getHumanDiskLabel to centralize formatting of disk name …
Browse files Browse the repository at this point in the history
…for user

Signed-off-by: Yann Dirson <[email protected]>
  • Loading branch information
ydirson committed Dec 15, 2022
1 parent 8cd74ee commit fc45c60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 4 additions & 0 deletions diskutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ def getHumanDiskName(disk):
return disk[5:]
return disk

def getHumanDiskLabel(disk):
(vendor, model, size) = getExtendedDiskInfo(disk)
return "%s - %s [%s %s]" % (getHumanDiskName(disk), getHumanDiskSize(size), vendor, model)

# given a list of disks, work out which ones are part of volume
# groups that will cause a problem if we install XE to those disks:
def findProblematicVGs(disks):
Expand Down
8 changes: 2 additions & 6 deletions tui/installer/screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,7 @@ def select_primary_disk(answers):
(boot, root, state, storage, logs) = diskutil.probeDisk(de)
if storage[0]:
target_is_sr[de] = True
(vendor, model, size) = diskutil.getExtendedDiskInfo(de)
stringEntry = "%s - %s [%s %s]" % (diskutil.getHumanDiskName(de), diskutil.getHumanDiskSize(size), vendor, model)
e = (stringEntry, de)
e = (diskutil.getHumanDiskLabel(de), de)
entries.append(e)

# we should have at least one disk
Expand Down Expand Up @@ -665,9 +663,7 @@ def select_guest_disks(answers):
# Make a list of entries: (text, item)
entries = []
for de in diskEntries:
(vendor, model, size) = diskutil.getExtendedDiskInfo(de)
entry = "%s - %s [%s %s]" % (diskutil.getHumanDiskName(de), diskutil.getHumanDiskSize(size), vendor, model)
entries.append((entry, de))
entries.append((diskutil.getHumanDiskLabel(de), de))

text = TextboxReflowed(54, "Which disks would you like to use for %s storage? \n\nOne storage repository will be created that spans the selected disks. You can choose not to prepare any storage if you wish to create an advanced configuration after installation." % BRAND_GUEST)
buttons = ButtonBar(tui.screen, [('Ok', 'ok'), ('Back', 'back')])
Expand Down

0 comments on commit fc45c60

Please sign in to comment.