7042607 Partition class is_solaris() check not complete
7043253 Size objects must specify a size units
--- a/usr/src/lib/install_target/physical.py Fri May 06 12:29:24 2011 -0700
+++ b/usr/src/lib/install_target/physical.py Mon May 09 17:19:12 2011 -0600
@@ -322,8 +322,8 @@
""" is_solaris() - instance property to return a Boolean value of True
if the partition is a Solaris partition
"""
- if self.part_type == 191 or self.part_type == 238 or \
- (self.part_type == 130 and not self.is_linux_swap):
+ if (self.part_type == 130 and not self.is_linux_swap) or \
+ self.part_type == 191:
return True
return False
--- a/usr/src/lib/install_target/size.py Fri May 06 12:29:24 2011 -0700
+++ b/usr/src/lib/install_target/size.py Mon May 09 17:19:12 2011 -0600
@@ -91,13 +91,22 @@
except ValueError:
value = float(size_test.group(1))
- # set the suffix, if it matched, or set it to byte_units if
- # it didn't match
- suffix = size_test.group(2) or self.byte_units
+ # set the suffix, if it matched. If it didn't match, raise an
+ # exception
+ if size_test.group(2) is None:
+ raise ValueError("no units specified for a size value " \
+ "of '%s'" % self.humanreadable)
+ else:
+ suffix = size_test.group(2)
else:
raise ValueError("unable to process a size value of '%s'" % \
self.humanreadable)
+ if suffix.lower() not in Size.units and \
+ suffix.lower() not in [Size.byte_units, Size.sector_units]:
+ raise ValueError("invalid suffix for a size value of '%s'" % \
+ self.humanreadable)
+
if suffix == Size.byte_units:
self.byte_value = long(value)
elif suffix == Size.sector_units:
--- a/usr/src/lib/install_target/test/test_target_instantiation.py Fri May 06 12:29:24 2011 -0700
+++ b/usr/src/lib/install_target/test/test_target_instantiation.py Mon May 09 17:19:12 2011 -0600
@@ -297,14 +297,14 @@
part.action = "preserve"
part.part_type = "primary"
part.bootid = Partition.ACTIVE
- part.size = Size("0")
+ part.size = Size("0b")
part.start_sector = 0
part2 = Partition(2)
part2.action = "preserve"
part2.part_type = "primary"
part2.bootid = 0
- part2.size = Size("0")
+ part2.size = Size("0b")
part2.start_sector = 0
self.disk.insert_children([part, part2])
@@ -384,13 +384,13 @@
part.action = "create"
part.part_type = "primary"
part.bootid = Partition.ACTIVE
- part.size = Size("2")
+ part.size = Size("2b")
part2 = Partition(2)
part2.action = "destroy"
part2.part_type = "primary"
part2.bootid = 0
- part2.size = Size("2")
+ part2.size = Size("2b")
self.disk.insert_children([part, part2])