/[gli]/trunk/src/templates/x86ArchitectureTemplate.py
Gentoo

Diff of /trunk/src/templates/x86ArchitectureTemplate.py

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

Revision 496 Revision 497
1""" 1"""
2Gentoo Linux Installer 2Gentoo Linux Installer
3 3
4$Id: x86ArchitectureTemplate.py,v 1.27 2005/03/30 05:33:48 agaffney Exp $ 4$Id: x86ArchitectureTemplate.py,v 1.28 2005/04/11 19:59:20 agaffney Exp $
5Copyright 2004 Gentoo Technologies Inc. 5Copyright 2004 Gentoo Technologies Inc.
6 6
7 7
8This fills in x86 specific functions. 8This fills in x86 specific functions.
9""" 9"""
10 10
11import GLIUtility, string 11import GLIUtility, string
12from GLIArchitectureTemplate import ArchitectureTemplate 12from GLIArchitectureTemplate import ArchitectureTemplate
13from GLIException import * 13from GLIException import *
14import parted 14import parted
15from decimal import Decimal
16import GLIStorageDevice
15 17
16class x86ArchitectureTemplate(ArchitectureTemplate): 18class x86ArchitectureTemplate(ArchitectureTemplate):
17 def __init__(self,configuration=None, install_profile=None, client_controller=None): 19 def __init__(self,configuration=None, install_profile=None, client_controller=None):
18 ArchitectureTemplate.__init__(self, configuration, install_profile, client_controller) 20 ArchitectureTemplate.__init__(self, configuration, install_profile, client_controller)
19 self._architecture_name = 'x86' 21 self._architecture_name = 'x86'
20 self._kernel_bzimage = "arch/i386/boot/bzImage" 22 self._kernel_bzimage = "arch/i386/boot/bzImage"
21 23
22 def install_bootloader(self): 24 def install_bootloader(self):
54 newpart = disk.partition_new(types[type], fstype, start, end) 56 newpart = disk.partition_new(types[type], fstype, start, end)
55 constraint = disk.dev.constraint_any() 57 constraint = disk.dev.constraint_any()
56 disk.add_partition(newpart, constraint) 58 disk.add_partition(newpart, constraint)
57 59
58 def partition(self): 60 def partition(self):
59 import GLIStorageDevice
60 import pprint
61
62 MEGABYTE = 1024 * 1024 61 MEGABYTE = 1024 * 1024
63 devices_old = {}
64 parts_old = {} 62 parts_old = {}
65 parts_new = self._install_profile.get_partition_tables() 63 parts_new = self._install_profile.get_partition_tables()
66 drives = GLIStorageDevice.detect_devices() 64 detected_devices = GLIStorageDevice.detect_devices()
67 drives.sort() 65 for device in detected_devices:
68 for drive in drives:
69 devices_old[drive] = GLIStorageDevice.Device(drive) 66 tmpdevice = GLIStorageDevice.Device(device)
70 devices_old[drive].set_partitions_from_disk() 67 tmpdevice.set_partitions_from_disk()
71 for part in devices_old.keys(): parts_old[part] = devices_old[part].get_install_profile_structure() 68 parts_old[device] = tmpdevice.get_install_profile_structure()
72 69
73# pp = pprint.PrettyPrinter(indent=4)
74# pp.pprint(parts_old)
75# pp.pprint(parts_new)
76
77 for dev in parts_old.keys(): 70 for device in parts_new.keys():
71 # Skip this device in parts_new if device isn't detected on current system
72 if not device in detected_devices:
73 self._logger.log("There is no physical device " + device + " detected to match the entry in the install profile...skipping")
74 continue
75
76 # Check to see if the old and new partition table structures are the same
77 table_changed = 0
78 for part in parts_new[device]:
79 oldpart = parts_old[device][part]
80 newpart = parts_new[device][part]
81 if oldpart['type'] == newpart['type'] and oldpart['start'] == newpart['start'] and oldpart['end'] == newpart['end'] and newpart['format'] == False:
82 continue
83 else:
84 table_changed = 1
85 break
86 # Skip this device if they are they same
87 if not table_changed:
88 self._logger.log("Partition table for " + device + " is unchanged...skipping")
89 continue
90
91 # Create pyparted objects for this device
78 parted_dev = parted.PedDevice.get(dev) 92 parted_dev = parted.PedDevice.get(device)
79 parted_disk = parted.PedDisk.new(parted_dev) 93 parted_disk = parted.PedDisk.new(parted_dev)
80 if not parts_new.has_key(dev) or not parts_new[dev]: 94 new_part_list = parts_new[device].keys()
81 self._logger.log("Partition table for " + dev + " does not exist in install profile") 95 new_part_list.sort()
82 #print "Partition table for " + dev + " does not exist in install profile" 96 device_sectors = parted_dev.length
83 continue 97
98 # Iterate through new partitions and check for 'origminor' and 'format' == False
99 for part in parts_new[device].keys():
100 tmppart_new = parts_new[device][part]
101 if not tmppart_new['origminor'] or tmppart_new['format']: continue
102 tmppart_old = parts_existing[device][tmppart_new['origminor']]
103 # This partition in parts_new corresponds with an existing partitions, so we save the start/end sector and flags
104 for flag in range(0, 10):
105 # The 10 is completely arbitrary. If flags seem to be missed, this number should be increased
106 parted_part = parted_disk.get_partition(part)
107 if not parted_part: break
108 if parted_part.is_flag_available(flag) and parted_part.get_flag(flag):
109 if not "flags" in tmppart_new: tmppart_new['flags'] = []
110 tmppart_new['flags'].append(flag)
111 if tmppart_old['mb'] == tmppart_new['mb']:
112 tmppart_new['start'] = tmppart_old['start']
113 tmppart_new['end'] = tmppart_old['end']
114 else:
115 tmppart_new['start'] = tmppart_old['start']
116 tmppart_new['end'] = 0
117
84 if parts_new[dev][parts_new[dev].keys()[0]]['mb']: 118# if parts_new[dev][parts_new[dev].keys()[0]]['mb']:
85 # Change MB/%/* into sectors 119# # Change MB/%/* into sectors
86 total_sectors = parted_dev.length 120# total_sectors = parted_dev.length
87 sector_size = parted_dev.sector_size 121# sector_size = parted_dev.sector_size
88 total_mb = float(total_sectors * sector_size) / MEGABYTE 122# total_mb = float(total_sectors * sector_size) / MEGABYTE
89 start_sector = 63 123# start_sector = 0
90 mb_left = total_mb 124# mb_left = total_mb
91 for part in parts_new[dev]: 125# for part in parts_new[dev]:
92 tmppart = parts_new[dev][part] 126# tmppart = parts_new[dev][part]
93 if tmppart['type'] == "extended": continue 127# if tmppart['type'] == "extended": continue
94 if tmppart['mb'][-1] == "%": 128# if tmppart['mb'][-1] == "%":
95 tmppart['mb'] = float(tmppart['mb'][:-1]) / 100 * total_mb 129# tmppart['mb'] = float(tmppart['mb'][:-1]) / 100 * total_mb
96 mb_left = mb_left - float(tmppart['mb']) 130# mb_left = mb_left - float(tmppart['mb'])
97 partlist = parts_new.keys() 131# partlist = parts_new.keys()
98 partlist.sort() 132# partlist.sort()
99 for part in partlist: 133# for part in partlist:
100 if part > 4: continue 134# if part > 4: continue
101 tmppart = parts_new[dev][part] 135# tmppart = parts_new[dev][part]
102 if tmppart['type'] == "extended": 136# if tmppart['type'] == "extended":
103 for part_log in partlist: 137# for part_log in partlist:
104 if part < 5: continue 138# if part < 5: continue
105 tmppart_log = parts_new[dev][part_log] 139# tmppart_log = parts_new[dev][part_log]
106 if not tmppart['start']: 140# if not tmppart['start']:
107 tmppart['start'] = start_sector 141# tmppart['start'] = start_sector
108 if tmppart_log['mb'] == "*": 142# if tmppart_log['mb'] == "*":
109 tmppart_log['mb'] = mb_left 143# tmppart_log['mb'] = mb_left
110 part_bytes = int(tmppart_log['mb'] * MEGABYTE) 144# part_bytes = int(tmppart_log['mb'] * MEGABYTE)
111 part_sectors = round(part_bytes / sector_size) 145# part_sectors = round(part_bytes / sector_size)
112 tmppart_log['start'] = start_sector 146# tmppart_log['start'] = start_sector
113 tmppart_log['end'] = start_sector + part_sectors - 1 147# tmppart_log['end'] = start_sector + part_sectors - 1
114 tmppart['end'] = tmppart_log['end'] 148# tmppart['end'] = tmppart_log['end']
115 start_sector = start_sector + part_sectors 149# start_sector = start_sector + part_sectors
116 continue 150# continue
117 if tmppart['mb'] == "*": 151# if tmppart['mb'] == "*":
118 tmppart['mb'] = mb_left 152# tmppart['mb'] = mb_left
119 part_bytes = int(tmppart['mb'] * MEGABYTE) 153# part_bytes = int(tmppart['mb'] * MEGABYTE)
120 part_sectors = round(part_bytes / sector_size) 154# part_sectors = round(part_bytes / sector_size)
121 tmppart['start'] = start_sector 155# tmppart['start'] = start_sector
122 tmppart['end'] = start_sector + part_sectors - 1 156# tmppart['end'] = start_sector + part_sectors - 1
123 start_sector = start_sector + part_sectors 157# start_sector = start_sector + part_sectors
124 else: 158# else:
125 table_changed = 1 159
126 for part in parts_old[dev]:
127 oldpart = parts_old[dev][part]
128 newpart = parts_new[dev][part]
129 if oldpart['type'] == newpart['type'] and oldpart['start'] == newpart['start'] and oldpart['end'] == newpart['end'] and newpart['format'] == False:
130 table_changed = 0
131 else:
132 table_changed = 1
133 break
134 if not table_changed:
135 self._logger.log("Partition table for " + dev + " is unchanged")
136 #print "Partition table for " + dev + " is unchanged"
137 continue
138 parts_active = []
139 parts_lba = []
140 self._logger.log("Processing "+dev+"...")
141 #print "\nProcessing " + dev + "..."
142 # First pass to delete old partitions that aren't resized 160 # First pass to delete old partitions that aren't resized
161 self._logger.log("partitioning: Processing " + device + "...")
143 for part in parts_old[dev]: 162 for part in parts_old[device]:
144 if part > 4: continue
145 oldpart = parts_old[dev][part] 163 oldpart = parts_old[device][part]
146 matchingminor = 0 164 # Replace 'x86' with call function to get arch from CC
165 if (GLIStorageDevice.archinfo['x86']['extended'] and part > 4) or oldpart['type'] == "free": continue
147 delete = 0 166 delete = 0
148 if oldpart['type'] == "extended": 167 if oldpart['type'] == "extended":
149 logical_to_resize = 0 168 logical_to_resize = 0
150 for part_log in parts_old[dev]: 169 for part_log in parts_old[device]:
151 if part_log < 5: continue 170 if part_log < 5 or parts_old[device][part_log]['type'] == "free": continue
152 matchingminor = 0
153 delete_log = 0 171 delete_log = 0
154 for new_part in parts_new[dev]: 172 for new_part in parts_new[device]:
155 if new_part < 5: continue 173 if new_part < 5: continue
156 tmppart = parts_new[dev][new_part] 174 tmppart = parts_new[device][new_part]
157 if int(tmppart['start']) == int(oldpart['start']) and tmppart['format'] == False and tmppart['type'] == oldpart['type'] and int(tmppart['end']) == int(oldpart['end']): 175 # This partition is unchanged in the new layout
158 matchingminor = new_part 176 if tmppart['origminor'] == part_log and tmppart['start'] and tmppart['end']:
159 self._logger.log(" Deleting old minor " + str(part_log) + " to be recreated later") 177 self._logger.log(" Deleting old minor " + str(part_log) + " to be recreated later")
160 #print " Deleting old minor " + str(part_log) + " to be recreated later"
161 delete_log = 1 178 delete_log = 1
162 break 179 break
163 if int(tmppart['start']) == int(oldpart['start']) and tmppart['format'] == False and tmppart['type'] == oldpart['type'] and int(tmppart['end']) != int(oldpart['end']): 180 # This partition is resized with the data preserved in the new layout
164 matchingminor = new_part 181 if tmppart['origminor'] == part_log and tmppart['start'] and not tmppart['end']:
165 self._logger.log(" Ignoring old minor " + str(part_log) + " to resize later") 182 self._logger.log(" Ignoring old minor " + str(part_log) + " to resize later")
166 #print " Ignoring old minor " + str(part_log) + " to resize later"
167 logical_to_resize = 1 183 logical_to_resize = 1
168 break 184 break
169 if not matchingminor: 185 if delete_log:
170 self._logger.log(" No match found...deleting partition " + str(part_log)) 186 self._logger.log(" No match found...deleting partition " + str(part_log))
171 #print " No match found...deleting partition " + str(part_log)
172 parted_disk.delete_partition(parted_disk.get_partition(part_log)) 187 parted_disk.delete_partition(parted_disk.get_partition(part_log))
173 else:
174 if parted_disk.get_partition(part_log).get_flag(1): # Active/boot
175 self._logger.log(" Partition " + str(part_log) + " was active...noted")
176 #print " Partition " + str(part_log) + " was active...noted"
177 parts_active.append(int(matchingminor))
178 if parted_disk.get_partition(part_log).get_flag(7): # LBA
179 self._logger.log(" Partition " + str(part_log) + " was LBA...noted")
180 #print " Partition " + str(part_log) + " was LBA...noted"
181 parts_lba.append(int(matchingminor))
182 if delete_log:
183 parted_disk.delete_partition(parted_disk.get_partition(part_log))
184 if not logical_to_resize: 188 if not logical_to_resize:
185 self._logger.log(" Deleting old minor " + str(part)) 189 self._logger.log(" Deleting extended partition with minor " + str(part))
186 #print " Deleting old minor " + str(part)
187 parted_disk.delete_partition(parted_disk.get_partition(part)) 190 parted_disk.delete_partition(parted_disk.get_partition(part))
188 continue 191 continue
189 for new_part in parts_new[dev]: 192 for new_part in parts_new[device]:
190 tmppart = parts_new[dev][new_part] 193 tmppart = parts_new[device][new_part]
191 if int(tmppart['start']) == int(oldpart['start']) and tmppart['format'] == False and tmppart['type'] == oldpart['type'] and int(tmppart['end']) == int(oldpart['end']): 194 if tmppart['origminor'] == part and tmppart['start'] and tmppart['end']:
192 matchingminor = new_part
193 self._logger.log(" Deleting old minor " + str(part) + " to be recreated later") 195 self._logger.log(" Deleting old minor " + str(part) + " to be recreated later")
194 #print " Deleting old minor " + str(part) + " to be recreated later"
195 delete = 1 196 delete = 1
196 break 197 break
197 if int(tmppart['start']) == int(oldpart['start']) and tmppart['format'] == False and tmppart['type'] == oldpart['type'] and int(tmppart['end']) != int(oldpart['end']): 198 if tmppart['origminor'] == part and tmppart['start'] and not tmppart['end']:
198 matchingminor = new_part
199 self._logger.log(" Ignoring old minor " + str(part) + " to resize later") 199 self._logger.log(" Ignoring old minor " + str(part) + " to resize later")
200 #print " Ignoring old minor " + str(part) + " to resize later"
201 break 200 break
202 if not matchingminor: 201 if delete:
203 self._logger.log(" No match found...deleting partition " + str(part)) 202 self._logger.log(" No match found...deleting partition " + str(part))
204 #print " No match found...deleting partition " + str(part)
205 parted_disk.delete_partition(parted_disk.get_partition(part)) 203 parted_disk.delete_partition(parted_disk.get_partition(part))
206 else:
207 if parted_disk.get_partition(part).get_flag(1): # Active/boot
208 self._logger.log(" Partition " + str(part) + " was active...noted")
209 #print " Partition " + str(part) + " was active...noted"
210 parts_active.append(int(matchingminor))
211 if parted_disk.get_partition(part).get_flag(7): # LBA
212 self._logger.log(" Partition " + str(part) + " was LBA...noted")
213 #print " Partition " + str(part) + " was LBA...noted"
214 parts_lba.append(int(matchingminor))
215 if delete:
216 parted_disk.delete_partition(parted_disk.get_partition(part))
217 parted_disk.commit() 204 parted_disk.commit()
205
218 # Second pass to resize old partitions that need to be resized 206 # Second pass to resize old partitions that need to be resized
219 self._logger.log("Partitioning: Second pass...") 207 self._logger.log("Partitioning: Second pass...")
220 #print " Second pass..."
221 for part in parts_old[dev]: 208 for part in parts_old[device]:
222 oldpart = parts_old[dev][part] 209 oldpart = parts_old[device][part]
223 for new_part in parts_new[dev]: 210 for new_part in parts_new[device]:
224 tmppart = parts_new[dev][new_part] 211 tmppart = parts_new[device][new_part]
225 if int(tmppart['start']) == int(oldpart['start']) and tmppart['format'] == False and tmppart['type'] == oldpart['type'] and int(tmppart['end']) != int(oldpart['end']): 212 if tmppart['origminor'] == part and tmppart['start'] and not tmppart['end']:
226 self._logger.log(" Resizing old minor " + str(part) + " from " + str(oldpart['start']) + "-" + str(oldpart['end'])+ " to " + str(tmppart['start']) + "-" + str(tmppart['end'])) 213 self._logger.log(" Resizing old minor " + str(part) + " from " + str(oldpart['start']) + "-" + str(oldpart['end'])+ " to " + str(tmppart['start']) + "-" + str(tmppart['end']))
227 #print " Resizing old minor " + str(part) + " from " + str(oldpart['start']) + "-" + str(oldpart['end'])+ " to " + str(tmppart['start']) + "-" + str(tmppart['end'])
228 type = tmppart['type'] 214 type = tmppart['type']
229 device = dev
230 minor = part 215 minor = part
231 start = tmppart['start'] 216 start = tmppart['start']
232 end = tmppart['end'] 217 # Replace 512 with code to retrieve bytes per sector for device
218 end = start + (int(tmppart['mb']) * MEGABYTE / 512)
219 for i in new_part_list:
220 if i <= new_part: continue
221 if parts_new[device][i]['start'] and end >= parts_new[device][i]['start']:
222 end = parts_new[device][i]['start'] - 1
223 elif end >= device_sectors:
224 end = device_sectors - 1
225 break
233 if type == "ext2" or type == "ext3": 226 if type == "ext2" or type == "ext3":
234 total_sectors = end - start + 1 227 total_sectors = end - start + 1
235 ret = GLIUtility.spawn("resize2fs " + device + str(minor) + " " + str(total_sectors) + "s") 228 ret = GLIUtility.spawn("resize2fs " + device + str(minor) + " " + str(total_sectors) + "s")
236 if ret: # Resize error 229 if ret: # Resize error
237 raise GLIException("PartitionResizeError", 'fatal', 'partition', "could not resize " + dev + str(minor)) 230 raise GLIException("PartitionResizeError", 'fatal', 'partition', "could not resize " + device + str(minor))
238 elif type == "ntfs": 231 elif type == "ntfs":
239 total_sectors = end - start + 1 232 total_sectors = end - start + 1
240 total_bytes = int(total_sectors) * 512 233 total_bytes = int(total_sectors) * 512
241 ret = GLIUtility.spawn("ntfsresize --size " + str(total_bytes) + " " + device + str(minor)) 234 ret = GLIUtility.spawn("ntfsresize --size " + str(total_bytes) + " " + device + str(minor))
242 if ret: # Resize error 235 if ret: # Resize error
243 raise GLIException("PartitionResizeError", 'fatal', 'partition', "could not resize " + dev + str(minor)) 236 raise GLIException("PartitionResizeError", 'fatal', 'partition', "could not resize " + device + str(minor))
244 else: 237 elif type == "linux-swap" or type == "fat32":
245 parted_fs = parted_disk.get_partition(part).geom.file_system_open() 238 parted_fs = parted_disk.get_partition(part).geom.file_system_open()
246 resize_constraint = parted_fs.get_resize_constraint() 239 resize_constraint = parted_fs.get_resize_constraint()
247 if end < (start + resize_constraint.min_size) or start != resize_constraint.start_range.start: 240 if end < (start + resize_constraint.min_size) or start != resize_constraint.start_range.start:
248 raise GLIException("PartitionError", 'fatal', 'partition', "New size specified for " + dev + str(minor) + " is not within allowed boundaries") 241 raise GLIException("PartitionError", 'fatal', 'partition', "New size specified for " + device + str(minor) + " is not within allowed boundaries")
249 new_geom = resize_constraint.start_range.duplicate() 242 new_geom = resize_constraint.start_range.duplicate()
250 new_geom.set_start(start) 243 new_geom.set_start(start)
251 new_geom.set_end(end) 244 new_geom.set_end(end)
252 try: 245 try:
253 parted_fs.resize(new_geom) 246 parted_fs.resize(new_geom)
254 except: 247 except:
255 raise GLIException("PartitionResizeError", 'fatal', 'partition', "could not resize " + dev + str(minor)) 248 raise GLIException("PartitionResizeError", 'fatal', 'partition', "could not resize " + device + str(minor))
256 self._logger.log(" Deleting old minor " + str(part) + " to be recreated in 3rd pass") 249 self._logger.log(" Deleting old minor " + str(part) + " to be recreated in 3rd pass")
257 #print " Deleting old minor " + str(part) + " to be recreated in 3rd pass"
258 parted_disk.delete_partition(parted_disk.get_partition(part)) 250 parted_disk.delete_partition(parted_disk.get_partition(part))
259 break 251 break
260 parted_disk.delete_all() 252 parted_disk.delete_all()
261 parted_disk.commit() 253 parted_disk.commit()
254
262 # Third pass to create new partition table 255 # Third pass to create new partition table
263 self._logger.log("Partitioning: Third pass.") 256 self._logger.log("Partitioning: Third pass....creating partitions")
264 #print " Third pass..." 257 start = 0
258 extended_end = 0
265 for part in parts_new[dev]: 259 for part in parts_new[device]:
266 newpart = parts_new[dev][part] 260 newpart = parts_new[device][part]
267 new_start, new_end = newpart['start'], newpart['end'] 261# new_start, new_end = newpart['start'], newpart['end']
262 end = start + (int(tmppart['mb']) * MEGABYTE / 512)
263 for i in new_part_list:
264 if i <= part: continue
265 if parts_new[device][i]['start'] and end >= parts_new[device][i]['start']:
266 end = parts_new[device][i]['start'] - 1
267 elif end >= device_sectors:
268 end = device_sectors - 1
269 break
270 if newpart['type'] == "free":
271 # Nothing to be done for this type
272 pass
268 if newpart['type'] == "extended": 273 elif newpart['type'] == "extended":
269 self._logger.log(" Adding extended partition from " + str(newpart['start']) + " to " + str(newpart['end'])) 274 self._logger.log(" Adding extended partition from " + str(newpart['start']) + " to " + str(newpart['end']))
270 #print " Adding extended partition from " + str(newpart['start']) + " to " + str(newpart['end'])
271 self._add_partition(parted_disk, new_start, new_end, "extended", "") 275 self._add_partition(parted_disk, new_start, new_end, "extended", "")
272 elif int(part) < 5: 276 elif part < 5:
273 self._logger.log(" Adding primary partition from " + str(newpart['start']) + " to " + str(newpart['end'])) 277 self._logger.log(" Adding primary partition from " + str(newpart['start']) + " to " + str(newpart['end']))
274 #print " Adding primary partition from " + str(newpart['start']) + " to " + str(newpart['end'])
275 self._add_partition(parted_disk, new_start, new_end, "primary", newpart['type']) 278 self._add_partition(parted_disk, new_start, new_end, "primary", newpart['type'])
276 elif int(part) > 4: 279 elif GLIStorageDevice.archinfo['x86']['extended'] and part > 4:
277 self._logger.log(" Adding logical partition from " + str(newpart['start']) + " to " + str(newpart['end'])) 280 self._logger.log(" Adding logical partition from " + str(newpart['start']) + " to " + str(newpart['end']))
278 #print " Adding logical partition from " + str(newpart['start']) + " to " + str(newpart['end']) 281 if part == new_part_list[-1] and end > extended_end:
282 end = extended_end
279 self._add_partition(parted_disk, new_start, new_end, "logical", newpart['type']) 283 self._add_partition(parted_disk, new_start, new_end, "logical", newpart['type'])
280 if int(part) in parts_active and not newpart['format']: 284 if "flags" in newpart:
281 self._logger.log(" Partition was previously active...setting") 285 for flag in newpart['flags'] and parted_disk.get_partition(part).is_flag_available(flag):
282 #print " Partition was previously active...setting"
283 parted_disk.get_partition(part).set_flag(1) 286 parted_disk.get_partition(part).set_flag(flag)
284 if int(part) in parts_lba and not newpart['format']:
285 self._logger.log(" Partition was previously LBA...setting")
286 #print " Partition was previously LBA...setting"
287 parted_disk.get_partition(part).set_flag(7)
288 parted_disk.commit() 287 parted_disk.commit()
289 if newpart['format']: 288 if newpart['format']:
290 if newpart['type'] == "ext2": 289 if newpart['type'] == "ext2":
291 if GLIUtility.spawn("mke2fs " + dev + str(part)): 290 if GLIUtility.spawn("mke2fs " + device + str(part)):
292 raise GLIException("PartitionFormatError", 'fatal', 'partition', "could't create ext2 filesystem on " + dev + str(part)) 291 raise GLIException("PartitionFormatError", 'fatal', 'partition', "could't create ext2 filesystem on " + device + str(part))
293 elif newpart['type'] == "ext3": 292 elif newpart['type'] == "ext3":
294 if GLIUtility.spawn("mke2fs -j " + dev + str(part)): 293 if GLIUtility.spawn("mke2fs -j " + device + str(part)):
295 raise GLIException("PartitionFormatError", 'fatal', 'partition', "could't create ext3 filesystem on " + dev + str(part)) 294 raise GLIException("PartitionFormatError", 'fatal', 'partition', "could't create ext3 filesystem on " + device + str(part))
296 elif newpart['type'] == "linux-swap": 295 elif newpart['type'] == "linux-swap":
297 if GLIUtility.spawn("mkswap " + dev + str(part)): 296 if GLIUtility.spawn("mkswap " + device + str(part)):
298 raise GLIException("PartitionFormatError", 'fatal', 'partition', "could't create swap on " + dev + str(part)) 297 raise GLIException("PartitionFormatError", 'fatal', 'partition', "could't create swap on " + device + str(part))
299 elif newpart['type'] == "fat32": 298 elif newpart['type'] == "fat32":
300 if GLIUtility.spawn("mkfs.vfat -F 32 " + dev + str(part)): 299 if GLIUtility.spawn("mkfs.vfat -F 32 " + device + str(part)):
301 raise GLIException("PartitionFormatError", 'fatal', 'partition', "could't create fat32 filesystem on " + dev + str(part)) 300 raise GLIException("PartitionFormatError", 'fatal', 'partition', "could't create fat32 filesystem on " + device + str(part))
302 elif newpart['type'] == "ntfs": 301 elif newpart['type'] == "ntfs":
303 if GLIUtility.spawn("mkntfs " + dev + str(part)): 302 if GLIUtility.spawn("mkntfs " + device + str(part)):
304 raise GLIException("PartitionFormatError", 'fatal', 'partition', "could't create ntfs filesystem on " + dev + str(part)) 303 raise GLIException("PartitionFormatError", 'fatal', 'partition', "could't create ntfs filesystem on " + device + str(part))
305 304
306 def _install_grub(self): 305 def _install_grub(self):
307 boot_device = "" 306 boot_device = ""
308 boot_minor = "" 307 boot_minor = ""
309 root_device = "" 308 root_device = ""

Legend:
Removed from v.496  
changed lines
  Added in v.497

  ViewVC Help
Powered by ViewVC 1.1.20