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

Diff of /trunk/src/GLIStorageDevice.py

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

Revision 915 Revision 916
118 118
119 ## 119 ##
120 # Uses magic to apply the recommended partition layout 120 # Uses magic to apply the recommended partition layout
121 def do_recommended(self): 121 def do_recommended(self):
122 free_minor = 0 122 free_minor = 0
123 recommended_parts = [ { 'type': "ext2", 'size': 256, 'mountpoint': "/boot" },
124 { 'type': "linux-swap", 'size': 1024, 'mountpoint': "" },
125 { 'type': "ext3", 'size': "*", 'mountpoint': "/" } ]
126 to_create = []
123 if self._applied_recommended: 127 if self._applied_recommended:
124 raise GLIException("RecommendedPartitionLayoutError", "notice", "do_recommended", "You have already applied the recommended partition layout.") 128 raise GLIException("RecommendedPartitionLayoutError", "notice", "do_recommended", "You have already applied the recommended partition layout.")
125 parts = self._partitions.keys() 129 parts = self.get_ordered_partition_list()
126 parts.sort()
127 for part in parts: 130 for part in parts:
128 if self._partitions[part].get_type() == "free" and self._partitions[part].get_mb() >= 4096: 131 if self._partitions[part].get_type() == "free" and self._partitions[part].get_mb() >= 4096:
132# if "1" in self._partitions and "2" in self._partitions and part < 4 and self.get_extended_partition():
133# continue
129 free_minor = part 134 free_minor = part
135 break
130 if not free_minor: 136 if not free_minor:
131 raise GLIException("RecommendedPartitionLayoutError", "notice", "do_recommended", "You do not have atleast 4GB of concurrent unallocated space. Please remove some partitions and try again.") 137 raise GLIException("RecommendedPartitionLayoutError", "notice", "do_recommended", "You do not have atleast 4GB of concurrent unallocated space. Please remove some partitions and try again.")
132 if not self._partitions[free_minor].is_logical() and archinfo[self._arch]['extended'] and free_minor > 2: 138# if archinfo[self._arch]['extended']:
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.") 139# if "1" in self._partitions and "2" in self._partitions and free_minor < 4 and self.get_extended_partition():
134 self.add_partition(free_minor, 256, 0, 0, "ext2") 140# raise GLIException("RecommendedPartitionLayoutError", "notice", "do_recommended", "This code is not yet robust enough to handle automatic partitioning with your current layout.")
135 self.add_partition(free_minor+1, 1024, 0, 0, "linux-swap") 141 remaining_free = self._partitions[free_minor].get_mb()
136 self.add_partition(free_minor+2, self._partitions[free_minor+2].get_mb(), 0, 0, "ext3") 142 for newpart in recommended_parts:
143 if archinfo[self._arch]['extended'] and free_minor == (3 + FREE_MINOR_FRAC_PRI):
144 if self.get_extended_partition():
145 raise GLIException("RecommendedPartitionLayoutError", "notice", "do_recommended", "This code is not yet robust enough to handle automatic partitioning with your current layout.")
146 to_create.append({ 'type': "extended", 'size': remaining_free, 'mountpoint': "", 'free_minor': free_minor })
147 free_minor = 4 + FREE_MINOR_FRAC_LOG
148 newpart['free_minor'] = free_minor
149 to_create.append(newpart)
150 free_minor = free_minor + 1
151 if not newpart['size'] == "*":
152 remaining_free = remaining_free - newpart['size']
153 for newpart in to_create:
154 if newpart['size'] == "*":
155 newpart['size'] = self._partitions[newpart['free_minor']].get_mb()
156 self.add_partition(newpart['free_minor'], newpart['size'], 0, 0, newpart['type'], mountpoint=newpart['mountpoint'])
137 self._applied_recommended = True 157 self._applied_recommended = True
138 return True 158 return True
139 159
140 ## 160 ##
141 # Combines free space and closes gaps in minor numbers. This is used internally 161 # Combines free space and closes gaps in minor numbers. This is used internally

Legend:
Removed from v.915  
changed lines
  Added in v.916

  ViewVC Help
Powered by ViewVC 1.1.20