From 97052fc75a85093e8a9335c42bec8482a5976e3c Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Thu, 8 Dec 2022 17:19:53 +0100 Subject: [PATCH] tui: show the disk on which an existing installation or backup is found Adding disk vendor and model would be useful, but can take too much horizontal space, especially for good old 80x25 resolution, so we use a shorter string with just the disk size for disambiguation. Signed-off-by: Yann Dirson --- diskutil.py | 6 ++++-- tui/installer/screens.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/diskutil.py b/diskutil.py index d2943a16..616dae11 100644 --- a/diskutil.py +++ b/diskutil.py @@ -392,9 +392,11 @@ def getHumanDiskName(disk): return disk[5:] return disk -def getHumanDiskLabel(disk): +def getHumanDiskLabel(disk, short=False): (vendor, model, size) = getExtendedDiskInfo(disk) - return "%s - %s [%s %s]" % (getHumanDiskName(disk), getHumanDiskSize(size), vendor, model) + template = "{device} - {size} [{vendor} {model}]" if not short else "{device} - {size}" + return template.format(device=getHumanDiskName(disk), size=getHumanDiskSize(size), + vendor=vendor, model=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: diff --git a/tui/installer/screens.py b/tui/installer/screens.py index e83f158d..bd594a0c 100644 --- a/tui/installer/screens.py +++ b/tui/installer/screens.py @@ -218,9 +218,11 @@ def get_admin_interface_configuration(answers): def get_installation_type(answers): entries = [] for x in answers['upgradeable-products']: - entries.append(("Upgrade %s" % str(x), (x, x.settingsAvailable()))) + entries.append(("Upgrade %s on %s" % (x, diskutil.getHumanDiskLabel(x.primary_disk, short=True)), + (x, x.settingsAvailable()))) for b in answers['backups']: - entries.append(("Restore %s from backup" % str(b), (b, None))) + entries.append(("Restore %s from backup to %s" % (b, diskutil.getHumanDiskLabel(b.root_disk, short=True)), + (b, None))) entries.append( ("Perform clean installation", None) )