7171070 text-install should update the error messages for invalid slice size
authorDrew Fisher <drew.fisher@oracle.com>
Thu, 31 May 2012 14:13:29 -0600
changeset 1694 5b79a70d83e9
parent 1693 f1af33034951
child 1695 7e11a6b0de11
7171070 text-install should update the error messages for invalid slice size 7173030 text-install Installation Failed because of "/usr/sbin/swap -d /dev/dsk/c8t0d0swap" failed
usr/src/cmd/text-install/disk_window.py
usr/src/lib/install_target/physical.py
--- a/usr/src/cmd/text-install/disk_window.py	Thu May 31 11:10:04 2012 -0700
+++ b/usr/src/cmd/text-install/disk_window.py	Thu May 31 14:13:29 2012 -0600
@@ -807,17 +807,18 @@
     text = edit_field.get_text().lstrip()
     radixchar = locale.localeconv()['decimal_point']
     if text.endswith(" "):
-        raise UIMessage(_('Only the digits 0-9 and %s are valid.') % radixchar)
+        raise UIMessage(_('Only the digits 0-9 and "%s" are valid.') % 
+                          radixchar)
     vals = text.split(radixchar)
     if len(vals) > 2:
-        raise UIMessage(_('A number can only have one %s') % radixchar)
+        raise UIMessage(_('A number can only have one "%s"') % radixchar)
     try:
         if len(vals[0]) > 0:
             int(vals[0])
         if len(vals) > 1 and len(vals[1]) > 0:
             int(vals[1])
     except ValueError:
-        raise UIMessage(_('Only the digits 0-9 and %s are valid.')
+        raise UIMessage(_('Only the digits 0-9 and "%s" are valid.')
                         % radixchar)
     if len(vals) > 1 and len(vals[1]) > 1:
         raise UIMessage(_("Size can be specified to only one decimal place."))
--- a/usr/src/lib/install_target/physical.py	Thu May 31 11:10:04 2012 -0700
+++ b/usr/src/lib/install_target/physical.py	Thu May 31 14:13:29 2012 -0600
@@ -2716,21 +2716,16 @@
                     cmd = [UMOUNT, "-f", disk_dev]
                     run(cmd)
 
-    def _release_swap(self):
-        """ method to release all swap devices associated
-            with a given disk
+    def _release_ufs_swap(self):
+        """ method to release all UFS swap devices associated on this disk
         """
-        disk_dev = "/dev/dsk/%s" % self.ctd
         # get a list of all swap devices on the system
         cmd = [SWAP, "-l"]
         p = run(cmd, check_result=Popen.ANY)
-
-        # remove the header and trailing newline
-        swap_list = p.stdout.split("\n")[1:-1]
-        for swap in swap_list:
-            swap_dev = swap.split()[0]
-            if swap_dev.startswith(disk_dev):
-                cmd = [SWAP, "-d", disk_dev + "swap"]
+        for line in p.stdout.splitlines():
+            if self.ctd in line:
+                swap_dev = line.split()[0]
+                cmd = [SWAP, "-d", swap_dev]
                 run(cmd)
 
     def _create_ufs_swap(self, swap_slice_list, dry_run):
@@ -2765,7 +2760,7 @@
         # release ufs swap.
         if not dry_run:
             # release ufs swap
-            self._release_swap()
+            self._release_ufs_swap()
             # unmount ufs filesystems
             self._unmount_ufs_filesystems()