7091644 Using F5 during slice selection often doesn't do anything
authorDrew Fisher <drew.fisher@oracle.com>
Thu, 03 May 2012 13:05:02 -0600
changeset 1665 5bcc6193fe7b
parent 1664 548b6996d0c6
child 1666 e9d4b6b42777
7091644 Using F5 during slice selection often doesn't do anything 7166190 USE_WHOLE_DISK defined twice in class GPTPart
usr/src/cmd/text-install/disk_window.py
usr/src/cmd/text-install/gpt_partitions.py
usr/src/cmd/text-install/partition_edit_screen.py
usr/src/cmd/text-install/ti_target_utils.py
--- a/usr/src/cmd/text-install/disk_window.py	Thu May 03 10:43:49 2012 -0700
+++ b/usr/src/cmd/text-install/disk_window.py	Thu May 03 13:05:02 2012 -0600
@@ -289,7 +289,8 @@
             if self.has_partition_data:
                 self.orig_ext_part_field = None
                 for obj in self.left_win.objects:
-                    if (obj.data_obj.is_extended()):
+                    if isinstance(obj.data_obj, UIPartition) and \
+                       obj.data_obj.is_extended():
                         self.orig_ext_part_field = obj
                         self.orig_logicals_active = True
                         break
@@ -499,7 +500,7 @@
 
         self.update_avail_space(part_info=part_info)
         if self.has_partition_data:
-            if part_info.is_extended():
+            if isinstance(part_info, UIPartition) and part_info.is_extended():
                 self.ext_part_field = part_field
 
     def _update_edit_field(self, part_info, part_field, edit_field):
--- a/usr/src/cmd/text-install/gpt_partitions.py	Thu May 03 10:43:49 2012 -0700
+++ b/usr/src/cmd/text-install/gpt_partitions.py	Thu May 03 13:05:02 2012 -0600
@@ -58,7 +58,6 @@
 
     BOOT_TEXT = _("Boot")
     HEADER_TYPE_BOOTABLE = _(" %(type)s %(bootable)s")
-    USE_WHOLE_DISK = _("Use the whole disk")
     HEADER_GPT = _("GPT Partitions: ")
     PARAGRAPH = _("%(release)s can be installed on the whole disk or a "
                   "GPT partition on the disk.") % RELEASE
--- a/usr/src/cmd/text-install/partition_edit_screen.py	Thu May 03 10:43:49 2012 -0700
+++ b/usr/src/cmd/text-install/partition_edit_screen.py	Thu May 03 13:05:02 2012 -0600
@@ -164,7 +164,7 @@
         if disk.label == "GPT":
             raise SkipException
 
-        if disk.whole_disk or disk.use_whole_segment:
+        if disk.whole_disk or getattr(disk, "use_whole_segment", False):
             LOGGER.debug("disk.whole_disk or disk.use_whole_segment is True, "
                          "skip editing")
 
--- a/usr/src/cmd/text-install/ti_target_utils.py	Thu May 03 10:43:49 2012 -0700
+++ b/usr/src/cmd/text-install/ti_target_utils.py	Thu May 03 13:05:02 2012 -0600
@@ -63,7 +63,7 @@
 UI_MIN_EMPTY_LOGICAL_PART = "0.1gb"
 UI_MIN_EMPTY_SLICE = "1gb"
 
-UI_TYPE_IN_USE = "UI Object In-use" # partition/slice in use
+UI_TYPE_IN_USE = "UI Object In-use"  # partition/slice in use
 UI_TYPE_EMPTY_SPACE = "UI Object EMPTY"   # unused components
 UI_TYPE_NOT_USED = "UI Object not-in-use" 
 
@@ -381,7 +381,7 @@
                 for i in range(MAX_PRIMARY_PARTS + MAX_EXT_PARTS + 1):
                     self.all_parts.append(UIPartition(self.tc, parent=self))
                 return
-            else: # SPARC - has to be slices
+            else:  # SPARC - has to be slices
                 for i in range(MAX_SLICES):
                     self.all_parts.append(UISlice(self.tc, parent=self))
                 return
@@ -1008,7 +1008,6 @@
                                  str(part.size))
                 except Exception, ex:
                     LOGGER.debug("UIPart: after fill unused..." + str(ex))
-                    pass
 
     def get_description(self):
         if self.ui_type == UI_TYPE_IN_USE:
@@ -1419,15 +1418,15 @@
             # try to get value from in_use dictionary
             in_use = self.doc_obj.in_use 
             if in_use is None:
-                return self.doc_obj.name 
+                return UNUSED_TEXT
 
             if in_use['used_name']:
-                return (in_use['used_name'])[0]
+                return in_use['used_name'][0]
 
             if in_use['used_by']:
-                return (in_use['used_by'])[0]
+                return in_use['used_by'][0]
 
-            return self.doc_obj.name 
+            return UNUSED_TEXT
         elif self.ui_type == UI_TYPE_EMPTY_SPACE:
             return UNUSED_TEXT
         else:
@@ -1492,7 +1491,7 @@
         return (Size(str(max_space) + Size.sector_units))
     
     def editable(self):
-        '''Returns True if it is possible to edit this partition's size'''
+        '''Returns True if it is possible to edit this slice's size'''
         if self.ui_type == UI_TYPE_IN_USE:
             if self.doc_obj.in_zpool == "rpool":
                 return True
@@ -1568,8 +1567,7 @@
 
         has_solaris_data = (self.parent.get_solaris_data() is not None)
 
-        types = set()
-        types.update(UISlice.TYPES)
+        types = set(UISlice.TYPES)
         if extra_type is not None:
             types.update(extra_type)
         types = list(types)
@@ -1608,7 +1606,7 @@
                     # because those are fake values.
                     existing_gaps = self.parent.doc_obj.get_gaps()
 
-                    if not existing_gaps:
+                    if existing_gaps:
 
                         # sort the gaps by size, largest gap will be at
                         # the end of the list.
@@ -1639,10 +1637,16 @@
                     self.parent.doc_obj.insert_children(discovered_obj)
                 else:
                     LOGGER.debug("Unable to reset to discovered value")
-                
+
             else:
                 if new_type == UISlice.UNUSED:
                     LOGGER.debug("Changing to unused, deleting")
                     LOGGER.debug("Target Call: deleting %s", self.name)
                     self.parent.doc_obj.delete_slice(self.doc_obj)
+                elif new_type == ROOT_POOL:
+                    # the slice is already carved up.  Simply set slice
+                    # attributes for root pool creation
+                    self.doc_obj.in_zpool = ROOT_POOL
+                    self.doc_obj.in_vdev = DEFAULT_VDEV_NAME
+                    self.doc_obj.tag = V_ROOT
         dump_doc("After change slice type")