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

Diff of /trunk/src/GLIStorageDevice.py

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

Revision 1290 Revision 1291
109 for part in ips: 109 for part in ips:
110 tmppart = ips[part] 110 tmppart = ips[part]
111 existing = False 111 existing = False
112 if tmppart['origminor'] and not tmppart['format']: 112 if tmppart['origminor'] and not tmppart['format']:
113 existing = True 113 existing = True
114 self._partitions[tmppart['minor']] = Partition(self, tmppart['minor'], tmppart['mb'], tmppart['start'], tmppart['end'], tmppart['type'], format=tmppart['format'], origminor=tmppart['origminor'], existing=existing, mountpoint=tmppart['mountpoint'], mountopts=tmppart['mountopts'], mkfsopts=tmppart['mkfsopts']) 114 self._partitions[tmppart['minor']] = Partition(self, tmppart['minor'], tmppart['mb'], tmppart['start'], tmppart['end'], tmppart['type'], format=tmppart['format'], origminor=tmppart['origminor'], existing=existing, mountpoint=tmppart['mountpoint'], mountopts=tmppart['mountopts'], mkfsopts=tmppart['mkfsopts'], resized=(existing and tmppart['resized']))
115 115
116 ## 116 ##
117 # Returns name of device (e.g. /dev/hda) being represented 117 # Returns name of device (e.g. /dev/hda) being represented
118 def get_device(self): 118 def get_device(self):
119 return self._device 119 return self._device
328 # Returns partition info in a format suitable for passing to install_profile.set_partition_tables() 328 # Returns partition info in a format suitable for passing to install_profile.set_partition_tables()
329 def get_install_profile_structure(self): 329 def get_install_profile_structure(self):
330 devdic = {} 330 devdic = {}
331 for part in self._partitions: 331 for part in self._partitions:
332 tmppart = self._partitions[part] 332 tmppart = self._partitions[part]
333 devdic[part] = { 'mb': tmppart.get_mb(), 'minor': float(part), 'origminor': tmppart.get_orig_minor(), 'type': tmppart.get_type(), 'mountpoint': tmppart.get_mountpoint(), 'mountopts': tmppart.get_mountopts(), 'format': tmppart.get_format(), 'mkfsopts': tmppart.get_mkfsopts(), 'start': 0, 'end': 0 } 333 devdic[part] = { 'mb': tmppart.get_mb(), 'minor': float(part), 'origminor': tmppart.get_orig_minor(), 'type': tmppart.get_type(), 'mountpoint': tmppart.get_mountpoint(), 'mountopts': tmppart.get_mountopts(), 'format': tmppart.get_format(), 'mkfsopts': tmppart.get_mkfsopts(), 'start': 0, 'end': 0, 'resized': tmppart.get_resized() }
334 return devdic 334 return devdic
335 335
336 ## 336 ##
337 # Returns the minor of the extended partition, if any 337 # Returns the minor of the extended partition, if any
338 def get_extended_partition(self): 338 def get_extended_partition(self):
422 _format = None 422 _format = None
423 _resizeable = None 423 _resizeable = None
424 _min_mb_for_resize = 0 424 _min_mb_for_resize = 0
425 _mb = "" 425 _mb = ""
426 _mkfsopts = None 426 _mkfsopts = None
427 _resized = False
427 428
428 ## 429 ##
429 # Initialization function for the Partition class 430 # Initialization function for the Partition class
430 # @param device Parent GLIStorageDevice object 431 # @param device Parent GLIStorageDevice object
431 # @param minor Minor of partition 432 # @param minor Minor of partition
436 # @param mountpoint='' Mountpoint of partition 437 # @param mountpoint='' Mountpoint of partition
437 # @param mountopts='' Mount options of partition 438 # @param mountopts='' Mount options of partition
438 # @param mkfsopts='' Additional mkfs options 439 # @param mkfsopts='' Additional mkfs options
439 # @param format=True Format partition 440 # @param format=True Format partition
440 # @param existing=False This partition exists on disk 441 # @param existing=False This partition exists on disk
441 def __init__(self, device, minor, mb, start, end, type, mountpoint='', mountopts='', format=True, existing=False, origminor=0, mkfsopts=''): 442 def __init__(self, device, minor, mb, start, end, type, mountpoint='', mountopts='', format=True, existing=False, origminor=0, mkfsopts='', resized=False):
442 self._device = device 443 self._device = device
443 self._minor = float(minor) 444 self._minor = float(minor)
444 self._start = long(start) 445 self._start = long(start)
445 self._end = long(end) 446 self._end = long(end)
446 self._type = type or "unknown" 447 self._type = type or "unknown"
449 self._format = format 450 self._format = format
450 self._mb = mb 451 self._mb = mb
451 self._orig_minor = origminor 452 self._orig_minor = origminor
452 self._mkfsopts = mkfsopts 453 self._mkfsopts = mkfsopts
453 self._resizeable = False 454 self._resizeable = False
455 self._resized = resized
454 if type != "free": 456 if type != "free":
455 if existing and not origminor: 457 if existing and not origminor:
456 self._orig_minor = self._minor 458 self._orig_minor = self._minor
457 self._minor = int(self._minor) 459 self._minor = int(self._minor)
458 self._orig_minor = int(self._orig_minor) 460 self._orig_minor = int(self._orig_minor)
632 # Returns the mount options for the partition 634 # Returns the mount options for the partition
633 def get_mountopts(self): 635 def get_mountopts(self):
634 return self._mountopts 636 return self._mountopts
635 637
636 ## 638 ##
637 # Set whether to format the partition 639 # Returns whether to partition is resized
638 # @param format Format this partition (True/False)
639 def set_format(self, format):
640 self._format = format
641
642 ##
643 # Returns whether to format the partition
644 def get_format(self): 640 def get_resized(self):
645 return self._format 641 return self._resized
646 642
647 ## 643 ##
648 # Returns whether the partition is resizeable 644 # Returns whether the partition is resizeable
649 def is_resizeable(self): 645 def is_resizeable(self):
650 return self._resizeable 646 return self._resizeable
701 self._mb = mb 697 self._mb = mb
702 elif mb > self._mb: 698 elif mb > self._mb:
703 # Growing 699 # Growing
704 self._device._partitions[free_minor]._mb = mb - self._mb 700 self._device._partitions[free_minor]._mb = mb - self._mb
705 self._mb = mb 701 self._mb = mb
702 self._resized = True
706 703
707## 704##
708# Returns a list of detected partitionable devices 705# Returns a list of detected partitionable devices
709def detect_devices(): 706def detect_devices():
710 devices = [] 707 devices = []

Legend:
Removed from v.1290  
changed lines
  Added in v.1291

  ViewVC Help
Powered by ViewVC 1.1.20