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

Diff of /trunk/src/GLIStorageDevice.py

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

Revision 112 Revision 113
53 parted_part = self._parted_disk.next_partition(parted_part) 53 parted_part = self._parted_disk.next_partition(parted_part)
54 54
55 def set_partitions_from_install_profile_structure(self, ips): 55 def set_partitions_from_install_profile_structure(self, ips):
56 for part in ips: 56 for part in ips:
57 tmppart = ips[part] 57 tmppart = ips[part]
58 existing = False
59 parted_part = self._parted_disk.get_partition(part)
60 if parted_part != None:
61 start = parted_part.geom.start / self._sectors_in_cylinder
62 end = parted_part.geom.end / self._sectors_in_cylinder
63 fs_type = ""
64 if parted_part.fs_type != None: fs_type = parted_part.fs_type.name
65 if parted_part.type == 2: fs_type = "extended"
66 if int(tmppart['start']) == int(start) and int(tmppart['end']) == int(end) and tmppart['type'] == fs_type and tmppart['format'] == False:
67 existing = True
58 self._partitions[int(part)] = Partition(self, part, '', tmppart['start'], tmppart['end'], 0, tmppart['type'], mountopts=tmppart['mountopts'], mountpoint=tmppart['mountpoint'], format=tmppart['format'], existing=(not tmppart['format'])) 68 self._partitions[int(part)] = Partition(self, part, '', tmppart['start'], tmppart['end'], 0, tmppart['type'], mountopts=tmppart['mountopts'], mountpoint=tmppart['mountpoint'], format=tmppart['format'], existing=(not tmppart['format']))
59 69
60 def get_device(self): 70 def get_device(self):
61 return self._device 71 return self._device
62 72
284 if blocks == 0: 294 if blocks == 0:
285 self._blocks = ((self._end - self._start) * self._device.get_cylinder_size()) / 512 295 self._blocks = ((self._end - self._start) * self._device.get_cylinder_size()) / 512
286 if existing: 296 if existing:
287 parted_part = device._parted_disk.get_partition(minor) 297 parted_part = device._parted_disk.get_partition(minor)
288 if type == "ntfs": 298 if type == "ntfs":
289 ntfsresize_output = commands.getoutput("ntfsresize --info " + device._device + str(minor)) 299 min_bytes = int(commands.getoutput("ntfsresize --info " + device._device + str(minor) + " | grep -e '^You might resize' | sed -e 's/You might resize at //' -e 's/ bytes or .\+//'"))
300 self._min_cylinders_for_resize = int(min_bytes / self._device._cylinder_bytes) + 1
290 self._resizeable == True 301 self._resizeable == True
291# elsif type == "ext2" or type == "ext3": 302 elif type == "ext2" or type == "ext3":
292# self._min_cylinders_for_resize = -1 303 commands.system("mkdir /mnt/freespace; mount " + device._device + str(minor) + " /mnt/freespace")
304 min_bytes = int(commands.getoutput("df -B kB " + device._device + str(minor) + " | tail -n 1 | sed -e 's:^" + device._device + str(minor) + "\s\+[0-9]\+kB\s\+::' -e 's:kB\s.\+::'")) * 1000
305 commands.system("umount /mnt/freespace; rm -rf /mnt/freespace")
306 min_bytes = min_bytes + (100 * 1024 * 1024) # Add 100M just to be safe
307 self._min_cylinders_for_resize = int(min_bytes / self._device._cylinder_bytes) + 1
293# self._resizeable == True 308 self._resizeable == True
294# elsif type == "":
295# self._min_cylinders_for_resize = self._start + 1
296# self._resizeable = True
297# elsif type == "fat16" or type == "fat32": 309 elif type == "fat16" or type == "fat32":
298# parted_part = self._device._parted_disk.get_partition(self._minor) 310 parted_part = self._device._parted_disk.get_partition(self._minor)
299# parted_fs = parted_part.geom.file_system_open() 311 parted_fs = parted_part.geom.file_system_open()
300# resize_constraint = parted_fs.get_resize_constraint() 312 resize_constraint = parted_fs.get_resize_constraint()
301# min_size = float(resize_constraint.min_size / self._device._sectors_in_cylinder) 313 min_size = float(resize_constraint.min_size / self._device._sectors_in_cylinder)
302# if int(min_size) != min_size: min_size = int(min_size) + 1 314 if int(min_size) != min_size: min_size = int(min_size) + 1
303# self._min_cylinders_for_resize = min_size 315 self._min_cylinders_for_resize = min_size
316 self._resizeable = True
317 elif type == "":
318 self._min_cylinders_for_resize = 1
319 self._resizeable = True
304 else: 320 else:
305 self._resizeable = True 321 self._resizeable = True
306 322
307 def is_extended(self): 323 def is_extended(self):
308 if self._type == "extended": 324 if self._type == "extended":

Legend:
Removed from v.112  
changed lines
  Added in v.113

  ViewVC Help
Powered by ViewVC 1.1.20