7077923 Auto-install fails to create VTOC slices automatically determined to be less than min-install size default
authorMatt Keenan <matt.keenan@oracle.com>
Tue, 16 Aug 2011 18:17:08 +0100
changeset 1391 3304042aeed6
parent 1390 b05ba57bf117
7077923 Auto-install fails to create VTOC slices automatically determined to be less than min-install size
usr/src/cmd/auto-install/checkpoints/target_selection.py
usr/src/cmd/auto-install/test/test_target_selection_sparc.py
usr/src/cmd/auto-install/test/test_target_selection_x86.py
--- a/usr/src/cmd/auto-install/checkpoints/target_selection.py	Tue Aug 16 10:06:20 2011 -0600
+++ b/usr/src/cmd/auto-install/checkpoints/target_selection.py	Tue Aug 16 18:17:08 2011 +0100
@@ -1199,12 +1199,12 @@
                 if not swap_added and \
                     not logical.noswap and len(self._swap_zvol_map) == 0:
                     self.logger.warning("Failed to add default swap zvol to "
-                        "root pool")
+                        "root pool, possibly because of insufficient space.")
 
                 if not dump_added and \
                     not logical.nodump and self._dump_zvol is None:
                     self.logger.warning("Failed to add default dump zvol to "
-                        "root pool")
+                        "root pool, possibly because of insufficient space.")
 
     def __get_unique_dataset_name(self, zpool, dataset_name):
         '''
@@ -1236,7 +1236,7 @@
                zvol_name : Str zvol name
                zvol_use : Str zvol usage, "swap" or "dump"
                zvol_size : Size Object
-               create_failure_ok: indicate whether zvol creation failure 
+               create_failure_ok: indicate whether zvol creation failure
                                   can be ignored.  Only used for "dump" zvol.
         '''
         zvol = zpool.add_zvol(zvol_name, int(zvol_size.get(Size.mb_units)),
@@ -1381,10 +1381,10 @@
                             be.mountpoint = self.be_mountpoint
 
             if not logical.noswap and not found_swap:
-                raise SelectionError("At least one swap Zvol must exist.")
+                self.logger.warning("Swap zvol not being created.")
 
             if not logical.nodump and not found_dump:
-                raise SelectionError("At least one dump Zvol must exist.")
+                self.logger.warning("Dump zvol not being created.")
 
             if not found_root_pool:
                 raise SelectionError("No root pool specified.")
@@ -2265,8 +2265,6 @@
                         # Will be skipped if searching for a gap to insert a
                         # partition of a given size succeeds.
                         if largest_gap is None or \
-                           largest_gap.size < \
-                           self.controller.minimum_target_size or \
                            largest_gap.size < new_partition.size:
                             raise SelectionError("Failed to find gap on disk"
                                 " of sufficient size to put partition"
@@ -2475,8 +2473,7 @@
                         # Will be skipped if searching for a gap to insert a
                         # slice of a given size succeeds.
                         if largest_gap is None or \
-                           largest_gap.size < \
-                           self.controller.minimum_target_size:
+                           largest_gap.size < new_slice.size:
                             raise SelectionError("Failed to find gap on disk"
                                 " of sufficient size to put slice"
                                 " %s in to" % (new_slice.name))
--- a/usr/src/cmd/auto-install/test/test_target_selection_sparc.py	Tue Aug 16 10:06:20 2011 -0600
+++ b/usr/src/cmd/auto-install/test/test_target_selection_sparc.py	Tue Aug 16 18:17:08 2011 +0100
@@ -285,7 +285,7 @@
         ....<disk_keyword key="boot_disk"/>
         ....<slice name="0" action="create" force="true" is_swap="false" \
         in_zpool="ai_test_rpool" in_vdev="vdev">
-        ......<size val="143348800secs" start_sector="512"/>
+        ......<size val="143348736secs" start_sector="512"/>
         ....</slice>
         ..</disk>
         </target>
@@ -1163,7 +1163,7 @@
                 <disk_name name_type="ctd" name="c99t0d0"/>
                 <slice name="0" action="create" is_swap="false"
                  in_zpool="ai_test_rpool" in_vdev="vdev">
-                  <size val="6GB"/>
+                  <size val="10GB"/>
                 </slice>
               </disk>
               <logical>
@@ -1182,10 +1182,10 @@
         ....<zpool name="ai_test_rpool" action="create" is_root="true">
         ......<vdev name="vdev" redundancy="none"/>
         ......<zvol name="swap" action="create" use="swap">
-        ........<size val="682m"/>
+        ........<size val="\d+m"/>
         ......</zvol>
         ......<zvol name="dump" action="create" use="dump">
-        ........<size val="341m"/>
+        ........<size val="\d+m"/>
         ......</zvol>
         ......<be name="ai_test_solaris"/>
         ....</zpool>
@@ -1200,7 +1200,7 @@
         ....</slice>
         ....<slice name="0" action="create" force="false" is_swap="false" \
         in_zpool="ai_test_rpool" in_vdev="vdev">
-        ......<size val="12582912secs" start_sector="512"/>
+        ......<size val="20971520secs" start_sector="512"/>
         ....</slice>
         ..</disk>
         </target>
@@ -1397,5 +1397,53 @@
 
         self.__run_simple_test(test_manifest_xml, expected_xml)
 
+    def test_target_selection_default_small_slice_size(self):
+        '''Test Success if creating a default small sized slice'''
+        test_manifest_xml = '''
+        <auto_install>
+          <ai_instance auto_reboot="false">
+            <target>
+              <disk whole_disk="true">
+                <disk_name name="c99t1d0" name_type="ctd"/>
+                <slice name="0" action="create"
+                  is_swap="false" in_zpool="ai_test_rpool">
+                  <size val="68gb"/>
+                </slice>
+                <slice name="1" action="create"
+                  is_swap="false"/>
+              </disk>
+              <logical noswap="true" nodump="true">
+                <zpool name="ai_test_rpool" is_root="true"/>
+              </logical>
+            </target>
+          </ai_instance>
+        </auto_install>
+        '''
+
+        expected_xml = '''\
+        <target name="desired">
+        ..<logical noswap="true" nodump="true">
+        ....<zpool name="ai_test_rpool" action="create" is_root="true">
+        ......<vdev name="vdev" redundancy="none"/>
+        ......<be name="ai_test_solaris"/>
+        ....</zpool>
+        ..</logical>
+        ..<disk whole_disk="false">
+        ....<disk_name name="c99t1d0" name_type="ctd"/>
+        ....<disk_prop dev_type="scsi" dev_vendor="HITACHI" \
+        dev_size="143349312secs"/>
+        ....<slice name="0" action="create" force="false" is_swap="false" \
+        in_zpool="ai_test_rpool" in_vdev="vdev">
+        ......<size val="142605824secs" start_sector="512"/>
+        ....</slice>
+        ....<slice name="1" action="create" force="false" is_swap="false">
+        ......<size val="742400secs" start_sector="142606848"/>
+        ....</slice>
+        ..</disk>
+        </target>
+        '''
+
+        self.__run_simple_test(test_manifest_xml, expected_xml)
+
 if __name__ == '__main__':
     unittest.main()
--- a/usr/src/cmd/auto-install/test/test_target_selection_x86.py	Tue Aug 16 10:06:20 2011 -0600
+++ b/usr/src/cmd/auto-install/test/test_target_selection_x86.py	Tue Aug 16 18:17:08 2011 +0100
@@ -2767,7 +2767,7 @@
                   <partition name="1" action="create" part_type="191">
                     <slice name="0" action="create" is_swap="false"
                      in_zpool="ai_test_rpool" in_vdev="vdev">
-                    <size val="6GB"/>
+                    <size val="10GB"/>
                     </slice>
                   </partition>
               </disk>
@@ -2787,10 +2787,10 @@
         ....<zpool name="ai_test_rpool" action="create" is_root="true">
         ......<vdev name="vdev" redundancy="none"/>
         ......<zvol name="swap" action="create" use="swap">
-        ........<size val="682m"/>
+        ........<size val="\d+m"/>
         ......</zvol>
         ......<zvol name="dump" action="create" use="dump">
-        ........<size val="341m"/>
+        ........<size val="\d+m"/>
         ......</zvol>
         ......<be name="ai_test_solaris"/>
         ....</zpool>
@@ -2809,7 +2809,7 @@
         ......<size val="390714368secs" start_sector="512"/>
         ......<slice name="0" action="create" force="false" is_swap="false" \
         in_zpool="ai_test_rpool" in_vdev="vdev">
-        ........<size val="12582400secs" start_sector="512"/>
+        ........<size val="20971008secs" start_sector="512"/>
         ......</slice>
         ....</partition>
         ..</disk>
@@ -3327,5 +3327,58 @@
 
         self.__run_simple_test(test_manifest_xml, expected_xml)
 
+    def test_target_selection_default_small_slice_size(self):
+        '''Test Success if creating a default small sized slice'''
+        test_manifest_xml = '''
+        <auto_install>
+          <ai_instance auto_reboot="false">
+            <target>
+              <disk whole_disk="true">
+                <disk_name name="c97d0" name_type="ctd"/>
+                <partition action="create" name="1" part_type="191">
+                  <slice name="0" action="create"
+                    is_swap="false" in_zpool="ai_test_rpool">
+                    <size val="185gb"/>
+                  </slice>
+                  <slice name="1" action="create"
+                    is_swap="false"/>
+                </partition>
+              </disk>
+              <logical noswap="true" nodump="true">
+                <zpool name="ai_test_rpool" is_root="true"/>
+              </logical>
+            </target>
+          </ai_instance>
+        </auto_install>
+        '''
+
+        expected_xml = '''\
+        <target name="desired">
+        ..<logical noswap="true" nodump="true">
+        ....<zpool name="ai_test_rpool" action="create" is_root="true">
+        ......<vdev name="vdev" redundancy="none"/>
+        ......<be name="ai_test_solaris"/>
+        ....</zpool>
+        ..</logical>
+        ..<disk whole_disk="false">
+        ....<disk_name name="c97d0" name_type="ctd"/>
+        ....<disk_prop dev_type="FIXED" dev_size="390715392secs"/>
+        ....<disk_keyword key="boot_disk"/>
+        ....<partition action="create" name="1" part_type="191">
+        ......<size val="390714880secs" start_sector="512"/>
+        ......<slice name="0" action="create" force="false" is_swap="false" \
+        in_zpool="ai_test_rpool" in_vdev="vdev">
+        ........<size val="387972608secs" start_sector="512"/>
+        ......</slice>
+        ......<slice name="1" action="create" force="false" is_swap="false">
+        ........<size val="2741248secs" start_sector="387973632"/>
+        ......</slice>
+        ....</partition>
+        ..</disk>
+        </target>
+        '''
+
+        self.__run_simple_test(test_manifest_xml, expected_xml)
+
 if __name__ == '__main__':
     unittest.main()