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

Diff of /trunk/src/GLIStorageDevice.py

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

Revision 851 Revision 912
13# the values were chosen to represent perfect floating point representations 13# the values were chosen to represent perfect floating point representations
14FREE_MINOR_FRAC_PRI = 1.0/32.0 14FREE_MINOR_FRAC_PRI = 1.0/32.0
15FREE_MINOR_FRAC_LOG = 1.0/8.0 15FREE_MINOR_FRAC_LOG = 1.0/8.0
16 16
17archinfo = { 'sparc': { 'fixedparts': [ { 'minor': 3, 'type': "wholedisk" } ], 'disklabel': 'sun', 'extended': False }, 17archinfo = { 'sparc': { 'fixedparts': [ { 'minor': 3, 'type': "wholedisk" } ], 'disklabel': 'sun', 'extended': False },
18 'hppa': { 'fixedparts': [ { 'minor': 1, 'type': "boot" } ], 'disklabel': 'msdos', 'extended': False }, 18 'hppa': { 'fixedparts': [ { 'minor': 1, 'type': "palo" } ], 'disklabel': 'msdos', 'extended': True },
19 'x86': { 'fixedparts': [], 'disklabel': 'msdos', 'extended': True }, 19 'x86': { 'fixedparts': [], 'disklabel': 'msdos', 'extended': True },
20 'amd64': { 'fixedparts': [], 'disklabel': 'msdos', 'extended': True }, 20 'amd64': { 'fixedparts': [], 'disklabel': 'msdos', 'extended': True },
21 'ppc': { 'fixedparts': [ { 'minor': 1, 'type': "metadata" } ], 'disklabel': 'mac', 'extended': False } 21 'ppc': { 'fixedparts': [ { 'minor': 1, 'type': "metadata" } ], 'disklabel': 'mac', 'extended': False }
22 } 22 }
23 23
112 112
113 ## 113 ##
114 # Returns name of device (e.g. /dev/hda) being represented 114 # Returns name of device (e.g. /dev/hda) being represented
115 def get_device(self): 115 def get_device(self):
116 return self._device 116 return self._device
117
118 ##
119 # Uses magic to apply the recommended partition layout
120 def do_recommended(self):
121 free_minor = 0
122 parts = self._partitions.keys()
123 parts.sort()
124 for part in parts:
125 if self._partitions[part].get_type() == "free" and self._partitions[part].get_mb() >= 4096:
126 free_minor = part
127 if not free_minor:
128 raise GLIException("RecommendedPartitionLayoutError", "notice", "do_recommended", "You do not have atleast 4GB of concurrent unallocated space. Please remove some partitions and try again.")
129 if not self._partitions[free_minor].is_logical() and archinfo[self._arch]['extended'] and free_minor > 2:
130 raise GLIException("RecommendedPartitionLayoutError", "notice", "do_recommended", "You have more than 1 existing primary partition defined. Please create an extended partition in the remaining unallocated space and try again.")
131 self.add_partition(free_minor, 256, 0, 0, "ext2")
132 self.add_partition(free_minor+1, 1024, 0, 0, "linux-swap")
133 self.add_partition(free_minor+2, self._partitions[free_minor+2].get_mb(), 0, 0, "ext3")
134 return True
117 135
118 ## 136 ##
119 # Combines free space and closes gaps in minor numbers. This is used internally 137 # Combines free space and closes gaps in minor numbers. This is used internally
120 def tidy_partitions(self): 138 def tidy_partitions(self):
121 last_minor = 0 139 last_minor = 0

Legend:
Removed from v.851  
changed lines
  Added in v.912

  ViewVC Help
Powered by ViewVC 1.1.20