/[gli]/trunk/src/GLIStorageDevice.py
Gentoo

Diff of /trunk/src/GLIStorageDevice.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 912 Revision 914
37 _parted_disk = None 37 _parted_disk = None
38 _sector_bytes = 0 38 _sector_bytes = 0
39 _total_mb = 0 39 _total_mb = 0
40 _arch = None 40 _arch = None
41 _disklabel = None 41 _disklabel = None
42 _applied_recommended = False
42 43
43 ## 44 ##
44 # Initialization function for GLIStorageDevice class 45 # Initialization function for GLIStorageDevice class
45 # @param device Device node (e.g. /dev/hda) of device being represented 46 # @param device Device node (e.g. /dev/hda) of device being represented
46 # @param arch="x86" Architecture that we're partition for (defaults to 'x86' for now) 47 # @param arch="x86" Architecture that we're partition for (defaults to 'x86' for now)
117 118
118 ## 119 ##
119 # Uses magic to apply the recommended partition layout 120 # Uses magic to apply the recommended partition layout
120 def do_recommended(self): 121 def do_recommended(self):
121 free_minor = 0 122 free_minor = 0
123 if self._applied_recommended:
124 raise GLIException("RecommendedPartitionLayoutError", "notice", "do_recommended", "You have already applied the recommended partition layout.")
122 parts = self._partitions.keys() 125 parts = self._partitions.keys()
123 parts.sort() 126 parts.sort()
124 for part in parts: 127 for part in parts:
125 if self._partitions[part].get_type() == "free" and self._partitions[part].get_mb() >= 4096: 128 if self._partitions[part].get_type() == "free" and self._partitions[part].get_mb() >= 4096:
126 free_minor = part 129 free_minor = part
129 if not self._partitions[free_minor].is_logical() and archinfo[self._arch]['extended'] and free_minor > 2: 132 if not self._partitions[free_minor].is_logical() and archinfo[self._arch]['extended'] and free_minor > 2:
130 raise GLIException("RecommendedPartitionLayoutError", "notice", "do_recommended", "You have more than 1 existing primary partition defined. Please create an extended partition in the remaining unallocated space and try again.") 133 raise GLIException("RecommendedPartitionLayoutError", "notice", "do_recommended", "You have more than 1 existing primary partition defined. Please create an extended partition in the remaining unallocated space and try again.")
131 self.add_partition(free_minor, 256, 0, 0, "ext2") 134 self.add_partition(free_minor, 256, 0, 0, "ext2")
132 self.add_partition(free_minor+1, 1024, 0, 0, "linux-swap") 135 self.add_partition(free_minor+1, 1024, 0, 0, "linux-swap")
133 self.add_partition(free_minor+2, self._partitions[free_minor+2].get_mb(), 0, 0, "ext3") 136 self.add_partition(free_minor+2, self._partitions[free_minor+2].get_mb(), 0, 0, "ext3")
137 self._applied_recommended = True
134 return True 138 return True
135 139
136 ## 140 ##
137 # Combines free space and closes gaps in minor numbers. This is used internally 141 # Combines free space and closes gaps in minor numbers. This is used internally
138 def tidy_partitions(self): 142 def tidy_partitions(self):

Legend:
Removed from v.912  
changed lines
  Added in v.914

  ViewVC Help
Powered by ViewVC 1.1.20