7120827 TI should check whether the current solaris2 partition size larger the recommended minimum size
authorDrew Fisher <drew.fisher@oracle.com>
Wed, 25 Apr 2012 12:35:24 -0600
changeset 1655 4e0a5494f846
parent 1654 af776f28769a
child 1656 dcba9e098fc4
7120827 TI should check whether the current solaris2 partition size larger the recommended minimum size 7164145 text-install choose "Use the whole disk" can not jump to "Network" screen directly 7120820 TI should report error if 2 solaris2 partitions existing on the system to be installed
usr/src/cmd/text-install/fdisk_partitions.py
usr/src/cmd/text-install/gpt_partitions.py
usr/src/cmd/text-install/partition_edit_screen.py
--- a/usr/src/cmd/text-install/fdisk_partitions.py	Wed Apr 25 12:34:21 2012 -0600
+++ b/usr/src/cmd/text-install/fdisk_partitions.py	Wed Apr 25 12:35:24 2012 -0600
@@ -263,6 +263,7 @@
                 LOGGER.debug("Setting whole_disk for %s", self.disk)
                 self.disk = self.tc.select_disk(self.disk,
                                                 use_whole_disk=True)[0]
+                self.disk.whole_disk = True
             else:
                 # it's a partition, set the in_zpool attribute in the object
                 # for now.  The next screen will fill in needed slices
--- a/usr/src/cmd/text-install/gpt_partitions.py	Wed Apr 25 12:34:21 2012 -0600
+++ b/usr/src/cmd/text-install/gpt_partitions.py	Wed Apr 25 12:35:24 2012 -0600
@@ -178,6 +178,7 @@
             LOGGER.debug("Setting whole_disk for %s", self.disk)
             self.use_whole_segment = True
             self.disk = self.tc.select_disk(self.disk, use_whole_disk=True)[0]
+            self.disk.whole_disk = True
         else:
             LOGGER.debug("Setting whole_disk to false")
             self.use_whole_segment = False
--- a/usr/src/cmd/text-install/partition_edit_screen.py	Wed Apr 25 12:34:21 2012 -0600
+++ b/usr/src/cmd/text-install/partition_edit_screen.py	Wed Apr 25 12:35:24 2012 -0600
@@ -104,6 +104,10 @@
                             "installation")
     SPARC_SELECTION_ERROR = _("An 'rpool' slice must be selected for "
                               "installation")
+    MULTIPLE_SOLARIS2_ERROR  = _("Invalid layout, more than one 'Solaris2' "
+                                 "partition found")
+    PART_TOO_SMALL = _("'Solaris2' partition is too small, installation "
+                       "requires at least %(size).1fGB")
     HELP_FORMAT = "    %s"
 
     def __init__(self, main_win, target_controller, x86_slice_mode=False):
@@ -249,10 +253,23 @@
         '''
 
         if self.is_x86:
+            # check for multiple Solaris2 partitions
+            desired_disk = get_desired_target_disk(self.doc)
+            solaris_list = [p.is_solaris for p in \
+                            desired_disk.get_children(class_type=Partition)]
+            if len(solaris_list) > 1:
+                raise UIMessage(PartEditScreen.MULTIPLE_SOLARIS2_ERROR)
+
             solaris_part = get_solaris_partition(self.doc)
             if solaris_part is None:
                 raise UIMessage(PartEditScreen.X86_SELECTION_ERROR)
 
+            # verify the size of the Solaris2 partition is large enough
+            min_size = self.tc.minimum_target_size
+            if min_size > solaris_part.size:
+                raise UIMessage(PartEditScreen.PART_TOO_SMALL % 
+                                {"size": min_size.get(Size.gb_units)})
+
             disk = solaris_part.parent
 
             # unset in_zpool and in_vdev on the partiton and the parent Disk.
@@ -316,6 +333,8 @@
     HEADER_GPT = _("Select GPT Partition: ")
     GPT_HELP = (TUI_HELP + "/%s/gpt_partitions_select.txt",
                 _("Select GPT Partition"))
+    PART_TOO_SMALL = _("Selected partition is too small, installation "
+                       "requires at least %(size).1fGB")
     SELECTION_ERROR = _("A 'Solaris' partition must be selected for "
                         "installation")
 
@@ -426,6 +445,12 @@
         else:
             gpt_partition = ui_object.data_obj.doc_obj
 
+        # verify the size of the selected partition is large enough
+        min_size = self.tc.minimum_target_size
+        if min_size > gpt_partition.size:
+            raise UIMessage(GPTPartEditScreen.PART_TOO_SMALL % 
+                            {"size": min_size.get(Size.gb_units)})
+
         # unset in_zpool and in_vdev on the parent Disk object
         disk.in_zpool = None
         disk.in_vdev = None