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

Diff of /trunk/src/GLIStorageDevice.py

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

Revision 312 Revision 386
213 213
214 def get_install_profile_structure(self): 214 def get_install_profile_structure(self):
215 devdic = {} 215 devdic = {}
216 for part in self._partitions: 216 for part in self._partitions:
217 tmppart = self._partitions[part] 217 tmppart = self._partitions[part]
218 devdic[part] = { 'mb': 0, 'minor': int(part), 'start': tmppart.get_start(), 'end': tmppart.get_end(), 'type': tmppart.get_type(), 'mountpoint': tmppart.get_mountpoint(), 'mountopts': tmppart.get_mountopts(), 'format': tmppart.get_format() } 218 devdic[part] = { 'mb': 0, 'minor': int(part), 'origminor': tmppart.get_orig_minor(), 'start': tmppart.get_start(), 'end': tmppart.get_end(), 'type': tmppart.get_type(), 'mountpoint': tmppart.get_mountpoint(), 'mountopts': tmppart.get_mountopts(), 'format': tmppart.get_format() }
219 return devdic 219 return devdic
220 220
221 def get_extended_partition(self): 221 def get_extended_partition(self):
222 for part in self._partitions: 222 for part in self._partitions:
223 tmppart = self._partitions[part] 223 tmppart = self._partitions[part]
281class Partition: 281class Partition:
282 "Class representing a single partition within a Device object" 282 "Class representing a single partition within a Device object"
283 283
284 _device = None 284 _device = None
285 _minor = None 285 _minor = None
286 _orig_minor = ""
286 _bootflag = None 287 _bootflag = None
287 _start = None 288 _start = None
288 _end = None 289 _end = None
289 _blocks = None 290 _blocks = None
290 _type = None 291 _type = None
295 _min_sectors_for_resize = 0 296 _min_sectors_for_resize = 0
296 297
297 def __init__(self, device, minor, bootflag, start, end, blocks, type, mountpoint='', mountopts='', format=True, existing=False): 298 def __init__(self, device, minor, bootflag, start, end, blocks, type, mountpoint='', mountopts='', format=True, existing=False):
298 self._device = device 299 self._device = device
299 self._minor = int(minor) 300 self._minor = int(minor)
301 if existing: self._orig_minor = int(minor)
300 self._bootflag = bootflag 302 self._bootflag = bootflag
301 self._start = int(start) 303 self._start = int(start)
302 self._end = int(end) 304 self._end = int(end)
303 self._blocks = int(blocks) 305 self._blocks = int(blocks)
304 if type == "": type = "unknown" 306 if type == "": type = "unknown"
313 if type == "ntfs": 315 if type == "ntfs":
314 min_bytes = int(commands.getoutput("ntfsresize -f --info " + device._device + str(minor) + " | grep -e '^You might resize' | sed -e 's/You might resize at //' -e 's/ bytes or .\+//'")) 316 min_bytes = int(commands.getoutput("ntfsresize -f --info " + device._device + str(minor) + " | grep -e '^You might resize' | sed -e 's/You might resize at //' -e 's/ bytes or .\+//'"))
315 self._min_cylinders_for_resize = int(min_bytes / self._device._cylinder_bytes) + 1 317 self._min_cylinders_for_resize = int(min_bytes / self._device._cylinder_bytes) + 1
316 self._resizeable == True 318 self._resizeable == True
317 elif type == "ext2" or type == "ext3": 319 elif type == "ext2" or type == "ext3":
318 block_size = string.strip(commands.getoutput("dumpe2fs -h " + device._device + str(minor) + " 2>&1 | grep -e '^Block size:' | sed -e 's/^Block size:\s\+//'")) 320 block_size = string.strip(commands.getoutput("dumpe2fs -h " + device._device + str(minor) + r" 2>&1 | grep -e '^Block size:' | sed -e 's/^Block size:\s\+//'"))
319 free_blocks = string.strip(commands.getoutput("dumpe2fs -h " + device._device + str(minor) + " 2>&1 | grep -e '^Free blocks:' | sed -e 's/^Free blocks:\s\+//'")) 321 free_blocks = string.strip(commands.getoutput("dumpe2fs -h " + device._device + str(minor) + r" 2>&1 | grep -e '^Free blocks:' | sed -e 's/^Free blocks:\s\+//'"))
320 free_sec = int(int(block_size) * int(free_blocks) / self._device._sector_bytes) 322 free_sec = int(int(block_size) * int(free_blocks) / self._device._sector_bytes)
321 free_sec = free_sec - 2000 # just to be safe 323 free_sec = free_sec - 2000 # just to be safe
322 self._min_sectors_for_resize = (self._end - self._start + 1) - free_sec 324 self._min_sectors_for_resize = (self._end - self._start + 1) - free_sec
323 self._resizeable == True 325 self._resizeable == True
324 else: 326 else:
391 def set_minor(self, minor): 393 def set_minor(self, minor):
392 self._minor = int(minor) 394 self._minor = int(minor)
393 395
394 def get_minor(self): 396 def get_minor(self):
395 return int(self._minor) 397 return int(self._minor)
398
399 def set_orig_minor(self, orig_minor):
400 self._orig_minor = int(orig_minor)
401
402 def get_orig_minor(self):
403 return self._orig_minor
396 404
397 def set_mountpoint(self, mountpoint): 405 def set_mountpoint(self, mountpoint):
398 self._mountpoint = mountpoint 406 self._mountpoint = mountpoint
399 407
400 def get_mountpoint(self): 408 def get_mountpoint(self):

Legend:
Removed from v.312  
changed lines
  Added in v.386

  ViewVC Help
Powered by ViewVC 1.1.20