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

Diff of /trunk/src/GLIStorageDevice.py

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

Revision 311 Revision 313
313 if type == "ntfs": 313 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 .\+//'")) 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 .\+//'"))
315 self._min_cylinders_for_resize = int(min_bytes / self._device._cylinder_bytes) + 1 315 self._min_cylinders_for_resize = int(min_bytes / self._device._cylinder_bytes) + 1
316 self._resizeable == True 316 self._resizeable == True
317 elif type == "ext2" or type == "ext3": 317 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\+//'")) 318 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\+//'")) 319 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) 320 free_sec = int(int(block_size) * int(free_blocks) / self._device._sector_bytes)
321 free_sec = free_sec - 2000 # just to be safe 321 free_sec = free_sec - 2000 # just to be safe
322 self._min_sectors_for_resize = (self._end - self._start + 1) - free_sec 322 self._min_sectors_for_resize = (self._end - self._start + 1) - free_sec
323 self._resizeable == True 323 self._resizeable == True
324 else: 324 else:
415 def get_blocks(self): 415 def get_blocks(self):
416 return int(self._blocks) 416 return int(self._blocks)
417 417
418 def get_min_sectors_for_resize(self): 418 def get_min_sectors_for_resize(self):
419 if self.is_extended(): 419 if self.is_extended():
420 min_size = self._start
420# for part in self._device._partitions: 421 for part in self._device._partitions:
421# if part < 5: continue 422 if part < 5: continue
422# min_size = part.get_end() 423 if part.get_end > min_size: min_size = part.get_end()
423 min_size = min([min_size] + [part.get_end() for part in self._device._partitions if part >= 5]) - self._start + 1
424 return min_size 424 return min_size
425 else: 425 else:
426 return self._min_sectors_for_resize 426 return self._min_sectors_for_resize
427 427
428 def get_max_sectors_for_resize(self): 428 def get_max_sectors_for_resize(self):

Legend:
Removed from v.311  
changed lines
  Added in v.313

  ViewVC Help
Powered by ViewVC 1.1.20