author | Geoffrey Hart <geoffrey.hart@oracle.com> |
Tue, 19 Jun 2012 02:42:18 -0600 | |
changeset 1716 | 0cea9255024f |
parent 1662 | b5c7fd54a90b |
child 1752 | 5c51d42f1aaf |
permissions | -rw-r--r-- |
947
29603af1b942
6999599 Missing shebang lines in python modules leads to incorrect dependency generation
Keith Mitchell <keith.mitchell@oracle.com>
parents:
872
diff
changeset
|
1 |
#!/usr/bin/python |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
2 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
4 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
8 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
13 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
19 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
21 |
# |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
22 |
# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
23 |
# |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
24 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
25 |
''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
26 |
Screens and functions to display a list of disks to the user. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
27 |
''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
28 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
29 |
import curses |
1394
7f92dd7e7416
7077329 Problem with install/textui
Karen Tung <Karen.Tung@oracle.com>
parents:
1353
diff
changeset
|
30 |
import locale |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
31 |
import logging |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
32 |
import platform |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
33 |
|
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
34 |
import osol_install.errsvc as errsvc |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
35 |
import osol_install.liberrsvc as liberrsvc |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
36 |
|
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
37 |
from bootmgmt.bootinfo import SystemFirmware |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
38 |
from solaris_install.text_install import _, RELEASE, TUI_HELP, \ |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
39 |
TARGET_DISCOVERY, TRANSFER_PREP, LOCALIZED_GB, ISCSI_LABEL, \ |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
40 |
ISCSI_TARGET_DISCOVERY |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
41 |
from solaris_install.text_install.disk_window import DiskWindow, \ |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
42 |
get_minimum_size, get_recommended_size |
1026
91b57d590dfa
6998974 Deliver System Configuration Interactive Tool
Jan Damborsky <dambi@opensolaris.org>
parents:
947
diff
changeset
|
43 |
from solaris_install.engine import InstallEngine |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
44 |
from solaris_install.logger import INSTALL_LOGGER_NAME |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
45 |
from solaris_install.target import Target |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
46 |
from solaris_install.target.controller import FALLBACK_IMAGE_SIZE |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
47 |
from solaris_install.target.physical import Disk, GPTPartition, Iscsi, \ |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
48 |
Partition, Slice |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
49 |
from solaris_install.target.size import Size |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
50 |
from solaris_install.text_install import can_use_gpt |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
51 |
from solaris_install.text_install.ti_target_utils import MAX_VTOC |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
52 |
from solaris_install.transfer.media_transfer import get_image_size |
1026
91b57d590dfa
6998974 Deliver System Configuration Interactive Tool
Jan Damborsky <dambi@opensolaris.org>
parents:
947
diff
changeset
|
53 |
from terminalui.base_screen import BaseScreen, QuitException, UIMessage |
91b57d590dfa
6998974 Deliver System Configuration Interactive Tool
Jan Damborsky <dambi@opensolaris.org>
parents:
947
diff
changeset
|
54 |
from terminalui.i18n import fit_text_truncate, textwidth, ljust_columns |
91b57d590dfa
6998974 Deliver System Configuration Interactive Tool
Jan Damborsky <dambi@opensolaris.org>
parents:
947
diff
changeset
|
55 |
from terminalui.list_item import ListItem |
91b57d590dfa
6998974 Deliver System Configuration Interactive Tool
Jan Damborsky <dambi@opensolaris.org>
parents:
947
diff
changeset
|
56 |
from terminalui.scroll_window import ScrollWindow |
91b57d590dfa
6998974 Deliver System Configuration Interactive Tool
Jan Damborsky <dambi@opensolaris.org>
parents:
947
diff
changeset
|
57 |
from terminalui.window_area import WindowArea |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
58 |
|
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
59 |
LOGGER = None |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
60 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
61 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
62 |
class TargetDiscoveryError(StandardError): |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
63 |
'''Class for target discovery related errors''' |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
64 |
pass |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
65 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
66 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
67 |
class DiskScreen(BaseScreen): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
68 |
''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
69 |
Allow the user to select a (valid) disk target for installation |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
70 |
Display the partition/slice table for the highlighted disk |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
71 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
72 |
''' |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
73 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
74 |
HEADER_TEXT = _("Disks") |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
859
diff
changeset
|
75 |
PARAGRAPH = _("Where should %(release)s be installed?") % RELEASE |
1716
0cea9255024f
7097153 Advice seems oddly small for solaris partition
Geoffrey Hart <geoffrey.hart@oracle.com>
parents:
1662
diff
changeset
|
76 |
REC_SIZE_TEXT = _("Recommended minimum: ") |
0cea9255024f
7097153 Advice seems oddly small for solaris partition
Geoffrey Hart <geoffrey.hart@oracle.com>
parents:
1662
diff
changeset
|
77 |
MIN_SIZE_TEXT = _("Minimum size: ") |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
78 |
DISK_SEEK_TEXT = _("Seeking disks on system") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
79 |
FOUND_x86 = _("The following partitions were found on the disk.") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
80 |
FOUND_SPARC = _("The following slices were found on the disk.") |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
81 |
FOUND_GPT = _("The following GPT partitions were found on the disk.") |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
82 |
PROPOSED_x86 = _("A partition table was not found. The following is " |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
83 |
"proposed.") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
84 |
PROPOSED_SPARC = _("A VTOC label was not found. The following " |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
85 |
"is proposed.") |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
86 |
PROPOSED_GPT = _("A GPT labeled disk was not found. The following is " |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
87 |
"proposed.") |
1353
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
88 |
TOO_SMALL = "<" |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
89 |
TOO_BIG = ">" |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
90 |
INVALID_DISK = "!" |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
91 |
GPT_LABELED = _("GPT labeled disk") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
92 |
NO_DISKS = _("No disks found. Additional device drivers may " |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
93 |
"be needed.") |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
859
diff
changeset
|
94 |
NO_TARGETS = _("%(release)s cannot be installed on any disk") % RELEASE |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
95 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
96 |
DISK_HEADERS = [(8, _("Type")), |
1453
dc760d706d10
7085953 one more column for displaying translation for "Size(GB)"
Karen Tung <Karen.Tung@oracle.com>
parents:
1443
diff
changeset
|
97 |
(10, _(" Size(GB)")), |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
98 |
(6, _("Boot")), |
1453
dc760d706d10
7085953 one more column for displaying translation for "Size(GB)"
Karen Tung <Karen.Tung@oracle.com>
parents:
1443
diff
changeset
|
99 |
(44, _("Device")), |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
100 |
(3, "")] # blank header for the notes column |
1353
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
101 |
VENDOR_LEN = 15 |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
102 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
103 |
SPINNER = ["\\", "|", "/", "-"] |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
104 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
105 |
DISK_WARNING_HEADER = _("Warning") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
106 |
DISK_WARNING_TOOBIG = _("Only the first %.1fTB can be used.") |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
107 |
DISK_WARNING_RELABEL = _("You have chosen a GPT labeled disk. Installing " |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
108 |
"onto this disk requires it to be relabeled as " |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
109 |
"SMI. This causes IMMEDIATE LOSS of all data " |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
110 |
"on the disk. Select Continue only if you are " |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
111 |
"prepared to erase all data on this disk now.") |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
112 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
113 |
CANCEL_BUTTON = _("Cancel") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
114 |
CONTINUE_BUTTON = _("Continue") |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
115 |
|
1026
91b57d590dfa
6998974 Deliver System Configuration Interactive Tool
Jan Damborsky <dambi@opensolaris.org>
parents:
947
diff
changeset
|
116 |
HELP_DATA = (TUI_HELP + "/%s/disks.txt", _("Disks")) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
117 |
|
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
118 |
def __init__(self, main_win, target_controller): |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
119 |
""" screen object containing the disk selection choice for the user |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
120 |
""" |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
121 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
122 |
global LOGGER |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
123 |
LOGGER = logging.getLogger(INSTALL_LOGGER_NAME) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
124 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
125 |
super(DiskScreen, self).__init__(main_win) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
126 |
if platform.processor() == "i386": |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
127 |
self.found_text = DiskScreen.FOUND_x86 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
128 |
self.proposed_text = DiskScreen.PROPOSED_x86 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
129 |
else: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
130 |
self.found_text = DiskScreen.FOUND_SPARC |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
131 |
self.proposed_text = DiskScreen.PROPOSED_SPARC |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
132 |
|
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
133 |
self.gpt_found_text = DiskScreen.FOUND_GPT |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
134 |
self.gpt_proposed_text = DiskScreen.PROPOSED_GPT |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
135 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
136 |
disk_header_text = [] |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
137 |
for header in DiskScreen.DISK_HEADERS: |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
138 |
header_str = fit_text_truncate(header[1], header[0] - 1, |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
139 |
just="left") |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
140 |
disk_header_text.append(header_str) |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
141 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
142 |
self.disk_header_text = " ".join(disk_header_text) |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
143 |
self.max_vtoc_disk_size = (Size(MAX_VTOC)).get(Size.tb_units) |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
144 |
self.disk_warning_too_big = \ |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
145 |
DiskScreen.DISK_WARNING_TOOBIG % self.max_vtoc_disk_size |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
146 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
147 |
self.disks = [] |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
148 |
self.existing_pools = [] |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
149 |
self.disk_win = None |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
150 |
self.disk_detail = None |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
151 |
self.num_targets = 0 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
152 |
self.td_handle = None |
826
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
153 |
self._size_line = None |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
154 |
self.selected_disk_index = 0 |
826
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
155 |
self._minimum_size = None |
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
156 |
self._recommended_size = None |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
157 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
158 |
self.engine = InstallEngine.get_instance() |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
159 |
self.doc = self.engine.data_object_cache |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
160 |
self.tc = target_controller |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
161 |
self._target_discovery_completed = False |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
162 |
self._target_discovery_status = InstallEngine.EXEC_SUCCESS |
1222
adf8cca6c379
7052228 BadDiskError is never caught
Karen Tung <Karen.Tung@oracle.com>
parents:
1121
diff
changeset
|
163 |
self._image_size = None |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
164 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
165 |
self.iscsi = None |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
166 |
self._iscsi_target_discovery_completed = False |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
167 |
self._iscsi_target_discovery_status = InstallEngine.EXEC_SUCCESS |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
168 |
|
826
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
169 |
def determine_minimum(self): |
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
170 |
'''Returns minimum install size, fetching first if needed''' |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
171 |
|
826
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
172 |
self.determine_size_data() |
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
173 |
return self._minimum_size |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
174 |
|
826
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
175 |
minimum_size = property(determine_minimum) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
176 |
|
826
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
177 |
def determine_recommended(self): |
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
178 |
'''Returns recommended install size, fetching first if needed''' |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
179 |
|
826
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
180 |
self.determine_size_data() |
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
181 |
return self._recommended_size |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
182 |
|
826
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
183 |
recommended_size = property(determine_recommended) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
184 |
|
826
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
185 |
def determine_size_data(self): |
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
186 |
'''Retrieve the minimum and recommended sizes and generate the string |
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
187 |
to present that information. |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
188 |
''' |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
189 |
|
826
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
190 |
if self._minimum_size is None or self._recommended_size is None: |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
191 |
self._recommended_size = get_recommended_size(self.tc) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
192 |
self._minimum_size = get_minimum_size(self.tc) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
193 |
|
826
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
194 |
def get_size_line(self): |
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
195 |
'''Returns the line of text displaying the min/recommended sizes''' |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
196 |
|
826
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
197 |
if self._size_line is None: |
1394
7f92dd7e7416
7077329 Problem with install/textui
Karen Tung <Karen.Tung@oracle.com>
parents:
1353
diff
changeset
|
198 |
rec_size_str = locale.format("%.1f", |
7f92dd7e7416
7077329 Problem with install/textui
Karen Tung <Karen.Tung@oracle.com>
parents:
1353
diff
changeset
|
199 |
self.recommended_size.get(Size.gb_units)) + LOCALIZED_GB |
7f92dd7e7416
7077329 Problem with install/textui
Karen Tung <Karen.Tung@oracle.com>
parents:
1353
diff
changeset
|
200 |
min_size_str = locale.format("%.1f", |
7f92dd7e7416
7077329 Problem with install/textui
Karen Tung <Karen.Tung@oracle.com>
parents:
1353
diff
changeset
|
201 |
self.minimum_size.get(Size.gb_units)) + LOCALIZED_GB |
1716
0cea9255024f
7097153 Advice seems oddly small for solaris partition
Geoffrey Hart <geoffrey.hart@oracle.com>
parents:
1662
diff
changeset
|
202 |
self._size_line = DiskScreen.MIN_SIZE_TEXT + min_size_str + \ |
0cea9255024f
7097153 Advice seems oddly small for solaris partition
Geoffrey Hart <geoffrey.hart@oracle.com>
parents:
1662
diff
changeset
|
203 |
" " + DiskScreen.REC_SIZE_TEXT + rec_size_str |
1394
7f92dd7e7416
7077329 Problem with install/textui
Karen Tung <Karen.Tung@oracle.com>
parents:
1353
diff
changeset
|
204 |
|
826
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
205 |
return self._size_line |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
206 |
|
826
ea293f9e4026
14442 Returning to Disk screen causes partition screen to revert to proposed partition table
Keith Mitchell <keith.mitchell@oracle.com>
parents:
773
diff
changeset
|
207 |
size_line = property(get_size_line) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
208 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
209 |
def wait_for_disks(self): |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
210 |
'''Block while waiting for target discovery to finish. Catch F9 and |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
211 |
quit if needed |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
212 |
''' |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
213 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
214 |
self.main_win.actions.pop(curses.KEY_F2, None) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
215 |
self.main_win.actions.pop(curses.KEY_F6, None) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
216 |
self.main_win.actions.pop(curses.KEY_F3, None) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
217 |
self.main_win.show_actions() |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
218 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
219 |
self.center_win.add_text(DiskScreen.DISK_SEEK_TEXT, 5, 1, |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
220 |
self.win_size_x - 3) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
221 |
self.main_win.do_update() |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
222 |
offset = textwidth(DiskScreen.DISK_SEEK_TEXT) + 2 |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
223 |
spin_index = 0 |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
224 |
self.center_win.window.timeout(250) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
225 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
226 |
while not self._target_discovery_completed: |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
227 |
input_key = self.main_win.getch() |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
228 |
if input_key == curses.KEY_F9: |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
229 |
if self.confirm_quit(): |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
230 |
raise QuitException |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
231 |
self.center_win.add_text(DiskScreen.SPINNER[spin_index], 5, offset) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
232 |
self.center_win.no_ut_refresh() |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
233 |
self.main_win.do_update() |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
234 |
spin_index = (spin_index + 1) % len(DiskScreen.SPINNER) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
235 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
236 |
self.center_win.window.timeout(-1) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
237 |
self.center_win.clear() |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
238 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
239 |
# check the result of target discovery |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
240 |
if self._target_discovery_status is not InstallEngine.EXEC_SUCCESS: |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
241 |
err_data = errsvc.get_errors_by_mod_id(TARGET_DISCOVERY)[0] |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
242 |
LOGGER.error("Target discovery failed") |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
243 |
err = err_data.error_data[liberrsvc.ES_DATA_EXCEPTION] |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
244 |
LOGGER.error(err) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
245 |
raise TargetDiscoveryError(("Unexpected error (%s) during target " |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
246 |
"discovery. See log for details.") % err) |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
247 |
|
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
248 |
def wait_for_iscsi_disk(self): |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
249 |
''' Block while waiting for iSCSI discovery to finish |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
250 |
''' |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
251 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
252 |
# check for the existence of an Iscsi object in the DOC. That object |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
253 |
# is only added when the user selects 'iSCSI' as the discovery criteria |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
254 |
self.iscsi = self.doc.volatile.get_first_child(name=ISCSI_LABEL, |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
255 |
class_type=Iscsi) |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
256 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
257 |
if not self.iscsi: |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
258 |
return |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
259 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
260 |
self.main_win.actions.pop(curses.KEY_F2, None) |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
261 |
self.main_win.actions.pop(curses.KEY_F6, None) |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
262 |
self.main_win.actions.pop(curses.KEY_F3, None) |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
263 |
self.main_win.show_actions() |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
264 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
265 |
self.center_win.add_text(DiskScreen.DISK_SEEK_TEXT, 5, 1, |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
266 |
self.win_size_x - 3) |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
267 |
self.main_win.do_update() |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
268 |
offset = textwidth(DiskScreen.DISK_SEEK_TEXT) + 2 |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
269 |
spin_index = 0 |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
270 |
self.center_win.window.timeout(250) |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
271 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
272 |
# there's an iscsi object in the DOC. Check for an existing iSCSI |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
273 |
# target discovery checkpoint. If found, update the kwargs for |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
274 |
# discovery to find all the information about the newest mapped LUN. |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
275 |
# If not, register a new checkpoint. |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
276 |
kwargs = {"search_type": "disk", "search_name": self.iscsi.ctd_list} |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
277 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
278 |
for checkpoint in self.engine._checkpoints: |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
279 |
if checkpoint.name == ISCSI_TARGET_DISCOVERY: |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
280 |
checkpoint.kwargs = kwargs |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
281 |
break |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
282 |
else: |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
283 |
# register a new iSCSI target discovery checkpoint |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
284 |
self.engine.register_checkpoint(ISCSI_TARGET_DISCOVERY, |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
285 |
"solaris_install/target/discovery", |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
286 |
"TargetDiscovery", |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
287 |
kwargs=kwargs, |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
288 |
insert_before=TRANSFER_PREP) |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
289 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
290 |
# run target discovery again against the iSCSI LUN |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
291 |
self._iscsi_target_discovery_completed = False |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
292 |
errsvc.clear_error_list() |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
293 |
self.engine.execute_checkpoints(start_from=ISCSI_TARGET_DISCOVERY, |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
294 |
pause_before=TRANSFER_PREP, |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
295 |
callback=self._iscsi_td_callback) |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
296 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
297 |
while not self._iscsi_target_discovery_completed: |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
298 |
input_key = self.main_win.getch() |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
299 |
if input_key == curses.KEY_F9: |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
300 |
if self.confirm_quit(): |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
301 |
raise QuitException |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
302 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
303 |
self.center_win.add_text(DiskScreen.SPINNER[spin_index], 5, offset) |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
304 |
self.center_win.no_ut_refresh() |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
305 |
self.main_win.do_update() |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
306 |
spin_index = (spin_index + 1) % len(DiskScreen.SPINNER) |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
307 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
308 |
self.center_win.window.timeout(-1) |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
309 |
self.center_win.clear() |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
310 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
311 |
# check the result of target discovery |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
312 |
if self._iscsi_target_discovery_status is not \ |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
313 |
InstallEngine.EXEC_SUCCESS: |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
314 |
err_data = errsvc.get_errors_by_mod_id(ISCSI_TARGET_DISCOVERY)[0] |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
315 |
LOGGER.error("iSCSI target discovery failed") |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
316 |
err = err_data.error_data[liberrsvc.ES_DATA_EXCEPTION] |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
317 |
LOGGER.error(err) |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
318 |
raise TargetDiscoveryError("Unexpected error (%s) during iSCSI " |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
319 |
"target discovery. See log for details." % err) |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
320 |
|
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
321 |
def _td_callback(self, status, errsvc): |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
322 |
'''Callback function for Target Discovery checkpoint execution. The |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
323 |
status value is saved to be interpreted later. This function sets the |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
324 |
self._target_discovery_completed value to true so the wait_for_disks() |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
325 |
function will know to stop displaying the spinner. |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
326 |
''' |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
327 |
|
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
328 |
self._target_discovery_status = status |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
329 |
self._target_discovery_completed = True |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
330 |
|
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
331 |
def _iscsi_td_callback(self, status, errsvc): |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
332 |
'''Callback function for iSCSI Target Discovery checkpoint execution. |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
333 |
The status value is saved to be interpreted later. |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
334 |
This function sets the self._iscsi_target_discovery_completed |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
335 |
value to true so the wait_for_iscsi_disk() function will know |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
336 |
to stop displaying the spinner. |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
337 |
''' |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
338 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
339 |
self._iscsi_target_discovery_status = status |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
340 |
self._iscsi_target_discovery_completed = True |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
341 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
342 |
def _show(self): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
343 |
'''Create a list of disks to choose from and create the window |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
344 |
for displaying the partition/slice information from the selected |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
345 |
disk |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
346 |
''' |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
347 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
348 |
self.wait_for_disks() |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
349 |
self.wait_for_iscsi_disk() |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
350 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
351 |
discovered_target = self.doc.persistent.get_first_child( \ |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
352 |
name=Target.DISCOVERED) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
353 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
354 |
LOGGER.debug(discovered_target) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
355 |
if discovered_target is None: |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
356 |
self.center_win.add_paragraph(DiskScreen.NO_DISKS, 1, 1, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
357 |
max_x=(self.win_size_x - 1)) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
358 |
return |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
359 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
360 |
self.disks = discovered_target.get_children(class_type=Disk) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
361 |
if not self.disks: |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
362 |
self.center_win.add_paragraph(DiskScreen.NO_TARGETS, 1, 1, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
363 |
max_x=(self.win_size_x - 1)) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
364 |
return |
1222
adf8cca6c379
7052228 BadDiskError is never caught
Karen Tung <Karen.Tung@oracle.com>
parents:
1121
diff
changeset
|
365 |
|
adf8cca6c379
7052228 BadDiskError is never caught
Karen Tung <Karen.Tung@oracle.com>
parents:
1121
diff
changeset
|
366 |
if self._image_size is None: |
adf8cca6c379
7052228 BadDiskError is never caught
Karen Tung <Karen.Tung@oracle.com>
parents:
1121
diff
changeset
|
367 |
try: |
adf8cca6c379
7052228 BadDiskError is never caught
Karen Tung <Karen.Tung@oracle.com>
parents:
1121
diff
changeset
|
368 |
self._image_size = Size(str(get_image_size(LOGGER)) + \ |
adf8cca6c379
7052228 BadDiskError is never caught
Karen Tung <Karen.Tung@oracle.com>
parents:
1121
diff
changeset
|
369 |
Size.mb_units) |
adf8cca6c379
7052228 BadDiskError is never caught
Karen Tung <Karen.Tung@oracle.com>
parents:
1121
diff
changeset
|
370 |
LOGGER.debug("Image_size: %s", self._image_size) |
adf8cca6c379
7052228 BadDiskError is never caught
Karen Tung <Karen.Tung@oracle.com>
parents:
1121
diff
changeset
|
371 |
except: |
adf8cca6c379
7052228 BadDiskError is never caught
Karen Tung <Karen.Tung@oracle.com>
parents:
1121
diff
changeset
|
372 |
# Unable to get the image size for some reason, allow |
adf8cca6c379
7052228 BadDiskError is never caught
Karen Tung <Karen.Tung@oracle.com>
parents:
1121
diff
changeset
|
373 |
# the target controller to use it's default size. |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
374 |
LOGGER.debug("Unable to get image size") |
1222
adf8cca6c379
7052228 BadDiskError is never caught
Karen Tung <Karen.Tung@oracle.com>
parents:
1121
diff
changeset
|
375 |
self._image_size = FALLBACK_IMAGE_SIZE |
adf8cca6c379
7052228 BadDiskError is never caught
Karen Tung <Karen.Tung@oracle.com>
parents:
1121
diff
changeset
|
376 |
|
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
377 |
# initialize the target controller so the min/max size for the |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
378 |
# installation can be calculated. Explicitly do not want to select an |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
379 |
# initial disk at this time in case none of the disks discovered is |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
380 |
# usable. The target controller initialization needs to be done |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
381 |
# everytime we show the disk selection screen so the desired target |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
382 |
# node in the DOC can be re-populated with information from target |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
383 |
# discovery. |
1222
adf8cca6c379
7052228 BadDiskError is never caught
Karen Tung <Karen.Tung@oracle.com>
parents:
1121
diff
changeset
|
384 |
self.tc.initialize(image_size=self._image_size, no_initial_disk=True) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
385 |
|
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
386 |
# Go through all the disks found and find ones that have enough space |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
387 |
# for installation. At the same time, see if any existing disk is the |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
388 |
# boot disk. If a boot disk is found, move it to the front of the list |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
389 |
num_usable_disks = 0 |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
390 |
boot_disk = None |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
391 |
for disk in self.disks: |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
392 |
LOGGER.debug("size: %s, min: %s" % \ |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
393 |
(disk.disk_prop.dev_size, self.minimum_size)) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
394 |
if disk.disk_prop.dev_size >= self.minimum_size: |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
395 |
if disk.is_boot_disk(): |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
396 |
boot_disk = disk |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
397 |
num_usable_disks += 1 |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
398 |
|
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
399 |
if boot_disk is not None: |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
400 |
self.disks.remove(boot_disk) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
401 |
self.disks.insert(0, boot_disk) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
402 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
403 |
if num_usable_disks == 0: |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
404 |
self.center_win.add_paragraph(DiskScreen.NO_DISKS, 1, 1, |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
405 |
max_x=(self.win_size_x - 1)) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
406 |
return |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
407 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
408 |
self.main_win.reset_actions() |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
409 |
self.main_win.show_actions() |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
410 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
411 |
y_loc = 1 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
412 |
self.center_win.add_text(DiskScreen.PARAGRAPH, y_loc, 1) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
413 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
414 |
y_loc += 1 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
415 |
self.center_win.add_text(self.size_line, y_loc, 1) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
416 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
417 |
y_loc += 2 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
418 |
self.center_win.add_text(self.disk_header_text, y_loc, 1) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
419 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
420 |
y_loc += 1 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
421 |
self.center_win.window.hline(y_loc, self.center_win.border_size[1] + 1, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
422 |
curses.ACS_HLINE, |
859 | 423 |
textwidth(self.disk_header_text)) |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
424 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
425 |
y_loc += 1 |
859 | 426 |
disk_win_area = WindowArea(4, textwidth(self.disk_header_text) + 2, |
427 |
y_loc, 0) |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
428 |
disk_win_area.scrollable_lines = len(self.disks) + 1 |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
429 |
self.disk_win = ScrollWindow(disk_win_area, window=self.center_win) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
430 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
431 |
disk_item_area = WindowArea(1, disk_win_area.columns - 2, 0, 1) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
432 |
disk_index = 0 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
433 |
len_type = DiskScreen.DISK_HEADERS[0][0] - 1 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
434 |
len_size = DiskScreen.DISK_HEADERS[1][0] - 1 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
435 |
len_boot = DiskScreen.DISK_HEADERS[2][0] - 1 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
436 |
len_dev = DiskScreen.DISK_HEADERS[3][0] - 1 |
1353
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
437 |
len_notes = DiskScreen.DISK_HEADERS[4][0] - 1 |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
438 |
for disk in self.disks: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
439 |
disk_text_fields = [] |
1353
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
440 |
dev_type = disk.disk_prop.dev_type |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
441 |
if dev_type is not None: |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
442 |
type_field = dev_type[:len_type] |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
443 |
type_field = ljust_columns(type_field, len_type) |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
444 |
else: |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
445 |
type_field = " " * len_type |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
446 |
disk_text_fields.append(type_field) |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
447 |
disk_size = disk.disk_prop.dev_size.get(Size.gb_units) |
1394
7f92dd7e7416
7077329 Problem with install/textui
Karen Tung <Karen.Tung@oracle.com>
parents:
1353
diff
changeset
|
448 |
size_field = locale.format("%*.1f", (len_size, disk_size)) |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
449 |
disk_text_fields.append(size_field) |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
450 |
if disk.is_boot_disk(): |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
451 |
bootable_field = "+".center(len_boot) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
452 |
else: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
453 |
bootable_field = " " * (len_boot) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
454 |
disk_text_fields.append(bootable_field) |
1353
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
455 |
|
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
456 |
# |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
457 |
# Information will be displayed in the device column with |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
458 |
# the following priority: |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
459 |
# |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
460 |
# First priority is to display receptacle information, |
1353
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
461 |
# if available. If receptacle information is displayed, |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
462 |
# ctd name will not be displayed. |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
463 |
# |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
464 |
# If receptacle information is not available, the ctd name |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
465 |
# will be displayed. |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
466 |
# |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
467 |
# Both items above can take as much as the 44 character wide |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
468 |
# column as needed. |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
469 |
# |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
470 |
# If the receptacle/ctd name is less than 30 characters, |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
471 |
# manufacturer information will be displayed in the left |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
472 |
# over space. There won't be a column heading for the |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
473 |
# manufacturer information. |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
474 |
# |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
475 |
|
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
476 |
device = disk.receptacle or disk.ctd |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
477 |
added_device_field = False |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
478 |
# is there enough room to display the manufacturer? |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
479 |
if (len_dev - len(device)) >= DiskScreen.VENDOR_LEN: |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
480 |
vendor = disk.disk_prop.dev_vendor |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
481 |
if vendor is not None: |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
482 |
dev_display_len = len_dev - DiskScreen.VENDOR_LEN |
1353
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
483 |
device_field = ljust_columns(device, dev_display_len) |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
484 |
disk_text_fields.append(device_field) |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
485 |
vendor_field = vendor[:DiskScreen.VENDOR_LEN - 1] |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
486 |
vendor_field = ljust_columns(vendor_field, |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
487 |
DiskScreen.VENDOR_LEN - 1) |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
488 |
disk_text_fields.append(vendor_field) |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
489 |
added_device_field = True |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
490 |
|
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
491 |
if not added_device_field: |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
492 |
device_field = device[:len_dev] |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
493 |
device_field = ljust_columns(device_field, len_dev) |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
494 |
disk_text_fields.append(device_field) |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
495 |
|
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
496 |
# display "<" or ">" if the disk is too big or too small |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
497 |
selectable = True |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
498 |
if disk.disk_prop.dev_size < self.minimum_size: |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
499 |
selectable = False |
1353
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
500 |
notes_field = DiskScreen.TOO_SMALL.center(len_notes) |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
501 |
disk_text_fields.append(notes_field) |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
502 |
elif disk.disk_prop.dev_size > Size(MAX_VTOC): |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
503 |
notes_field = DiskScreen.TOO_BIG.center(len_notes) |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
504 |
disk_text_fields.append(notes_field) |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
505 |
|
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
506 |
# check the blocksize of the disk. If it's not 512 bytes and we |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
507 |
# have an EFI firmware on x86, make the disk unselectable by the |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
508 |
# user. See PSARC 2008/769 |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
509 |
elif platform.processor() == "i386" and \ |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
510 |
disk.geometry.blocksize != 512: |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
511 |
firmware = SystemFirmware.get() |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
512 |
if firmware.fw_name == "uefi64": |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
513 |
selectable = False |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
514 |
notes_field = DiskScreen.INVALID_DISK.center(len_notes) |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
515 |
disk_text_fields.append(notes_field) |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
516 |
LOGGER.debug("marking disk %s unselectable as its " |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
517 |
"blocksize is not 512 bytes on an UEFI " |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
518 |
"firmware x86 system.", disk.ctd) |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
519 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
520 |
disk_text = " ".join(disk_text_fields) |
1353
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
521 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
522 |
disk_item_area.y_loc = disk_index |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
523 |
disk_list_item = ListItem(disk_item_area, window=self.disk_win, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
524 |
text=disk_text, add_obj=selectable) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
525 |
disk_list_item.on_make_active = on_activate |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
526 |
disk_list_item.on_make_active_kwargs["disk"] = disk |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
527 |
disk_list_item.on_make_active_kwargs["disk_select"] = self |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
528 |
disk_index += 1 |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
529 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
530 |
self.disk_win.no_ut_refresh() |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
531 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
532 |
y_loc += 7 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
533 |
disk_detail_area = WindowArea(6, 70, y_loc, 1) |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
534 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
535 |
self.disk_detail = DiskWindow(disk_detail_area, self.disks[0], |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
536 |
target_controller=self.tc, |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
537 |
window=self.center_win) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
538 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
539 |
self.main_win.do_update() |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
540 |
self.center_win.activate_object(self.disk_win) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
541 |
self.disk_win.activate_object(self.selected_disk_index, jump=True) |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
542 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
543 |
def on_prev(self): |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
544 |
''' If the user goes back a screen, teardown any existing Iscsi objects |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
545 |
and reset iSCSI target discovery |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
546 |
''' |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
547 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
548 |
if self.iscsi is not None: |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
549 |
# remove the iscsi Disk objects from the doc and from self.disks |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
550 |
if self.iscsi.ctd_list: |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
551 |
discovered_target = self.doc.persistent.get_first_child( |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
552 |
name=Target.DISCOVERED) |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
553 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
554 |
for disk in discovered_target.get_descendants(class_type=Disk): |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
555 |
if disk.ctd in self.iscsi.ctd_list: |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
556 |
disk.delete() |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
557 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
558 |
self.disks = discovered_target.get_children(class_type=Disk) |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
559 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
560 |
# tear down the Iscsi object |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
561 |
self.iscsi.teardown() |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
562 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
563 |
# reset the selected disk index to 0 |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
564 |
self.selected_disk_index = 0 |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
565 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
566 |
# reset the iscsi_discovery status |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
567 |
self._iscsi_target_discovery_completed = False |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
568 |
|
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
569 |
# reset the target controller's discovered_disk |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
570 |
self.tc._discovered_disks = None |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
571 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
572 |
def on_change_screen(self): |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
573 |
''' Save the index of the current selected object in case the user |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
574 |
returns to this screen later |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
575 |
''' |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
576 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
577 |
# Save the index of the selected object |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
578 |
self.selected_disk_index = self.disk_win.active_object |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
579 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
580 |
LOGGER.debug("disk_selection.on_change_screen, saved_index: %s", |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
581 |
self.selected_disk_index) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
582 |
LOGGER.debug(self.doc.persistent) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
583 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
584 |
def start_discovery(self): |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
585 |
# start target discovery |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
586 |
if not self._target_discovery_completed: |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
587 |
errsvc.clear_error_list() |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
588 |
self.engine.execute_checkpoints(pause_before=TRANSFER_PREP, |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
589 |
callback=self._td_callback) |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
590 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
591 |
def validate(self): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
592 |
'''Validate the size of the disk.''' |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
593 |
|
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
594 |
warning_txt = list() |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
595 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
596 |
disk = self.disk_detail.ui_obj.doc_obj |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
597 |
disk_size_gb = disk.disk_prop.dev_size.get(Size.gb_units) |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
598 |
max_vtoc_size_gb = Size(MAX_VTOC).get(Size.gb_units) |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
599 |
# Disk size warning should only be displayed if we are restricted to |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
600 |
# VTOC boot disks. |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
601 |
if not can_use_gpt and disk_size_gb > max_vtoc_size_gb: |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
602 |
warning_txt.append(self.disk_warning_too_big) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
603 |
warning_txt = " ".join(warning_txt) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
604 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
605 |
if warning_txt: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
606 |
# warn the user and give user a chance to change |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
607 |
result = self.main_win.pop_up(DiskScreen.DISK_WARNING_HEADER, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
608 |
warning_txt, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
609 |
DiskScreen.CANCEL_BUTTON, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
610 |
DiskScreen.CONTINUE_BUTTON) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
611 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
612 |
if not result: |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
613 |
raise UIMessage() # let user select different disk |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
614 |
# if user didn't quit it is always OK to ignore disk size, |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
615 |
# that will be forced less than the maximum in partitioning. |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
616 |
|
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
617 |
warning_txt = list() |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
618 |
|
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
619 |
# We also need to warn the user if we need to relabel the disk from |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
620 |
# GPT to SMI-VTOC |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
621 |
if disk.label == "GPT" and not can_use_gpt and \ |
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
622 |
disk.disk_prop.dev_type != "iSCSI": |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
623 |
warning_txt.append(DiskScreen.DISK_WARNING_RELABEL) |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
624 |
warning_txt = " ".join(warning_txt) |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
625 |
|
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
626 |
if warning_txt: |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
627 |
# warn the user and give user a chance to change |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
628 |
result = self.main_win.pop_up(DiskScreen.DISK_WARNING_HEADER, |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
629 |
warning_txt, |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
630 |
DiskScreen.CANCEL_BUTTON, |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
631 |
DiskScreen.CONTINUE_BUTTON) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
632 |
|
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
633 |
if not result: |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
634 |
raise UIMessage() # let user select different disk |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
635 |
|
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
636 |
# if user didn't Cancel it is OK to relabel the disk. |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
637 |
# This is one of the lesser known (and potentially dangerous) |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
638 |
# features of target controller: select_disk() with |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
639 |
# use_whole_disk=True can force a relabeling of the disk from GPT |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
640 |
# to VTOC is necessary for booting from the disk |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
641 |
disk = self.tc.select_disk(disk, use_whole_disk=True)[0] |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
642 |
|
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
643 |
# The DiskWindow object needs its disk reference updated too |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
644 |
self.disk_detail.set_disk_info(disk_info=disk) |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
645 |
|
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
646 |
|
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
647 |
def on_activate(disk, disk_select): |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
648 |
'''When a disk is selected, pass its data to the disk_select_screen''' |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
649 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
diff
changeset
|
650 |
max_x = disk_select.win_size_x - 1 |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
651 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
652 |
LOGGER.debug("on activate..disk=%s", disk) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
653 |
|
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
654 |
gpt_partitions = disk.get_children(class_type=GPTPartition) |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
655 |
if gpt_partitions: |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
656 |
display_text = disk_select.gpt_found_text |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
657 |
else: |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
658 |
if platform.processor() == "i386": |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
659 |
fdisk_partitions = disk.get_children(class_type=Partition) |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
660 |
if fdisk_partitions: |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
661 |
display_text = disk_select.found_text |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
662 |
else: |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
663 |
display_text = disk_select.gpt_proposed_text |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
664 |
else: |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
665 |
slices = disk.get_children(class_type=Slice) |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
666 |
if slices: |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
667 |
display_text = disk_select.found_text |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
668 |
else: |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
669 |
display_text = disk_select.gpt_proposed_text |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
670 |
|
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
671 |
# if length of display_text is shorter than max_x, pad rest of string up to |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
672 |
# max_x with white space, so, when shorter strings are displayed after |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
673 |
# longer ones, the "rest" of the longer string gets erased. |
1353
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
674 |
need_pad_len = max_x - len(display_text) |
1644
e827d1934114
PSARC/2012/023 Interactive Installation to iSCSI
Drew Fisher <drew.fisher@oracle.com>
parents:
1623
diff
changeset
|
675 |
if need_pad_len > 0: |
1353
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
676 |
display_text += " " * need_pad_len |
2a72364317be
7021428 Changes needed to Text Installer to add support for CRO information
Karen Tung <Karen.Tung@oracle.com>
parents:
1226
diff
changeset
|
677 |
|
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
678 |
# Add the selected disk to the target controller so appropriate defaults |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
679 |
# can be filled in, if necessary |
1623
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
680 |
selected_disk = disk_select.tc.select_disk(disk)[0] |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
681 |
|
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
682 |
# assume we don't want to use whole disk |
cb56a2fb4925
PSARC 2012/074 UEFI/GRUB2/Large Disk Boot (UGLDB) (Install phase II):
Niall Power <niall.power@oracle.com>
parents:
1453
diff
changeset
|
683 |
selected_disk.whole_disk = False |
1121
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
684 |
|
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
685 |
disk_select.center_win.add_paragraph(display_text, 11, 1, max_x=max_x) |
670325895b19
7004610 Update Text Installer to use CUD
Karen Tung <karen.tung@oracle.com>
parents:
1026
diff
changeset
|
686 |
disk_select.disk_detail.set_disk_info(disk_info=selected_disk) |