| … | |
… | |
| 110 | # for part in self._partitions: |
110 | # for part in self._partitions: |
| 111 | # if part.get_minor() == minor: |
111 | # if part.get_minor() == minor: |
| 112 | # return part |
112 | # return part |
| 113 | # return None |
113 | # return None |
| 114 | return self._partitions[idx] |
114 | return self._partitions[idx] |
|
|
115 | |
|
|
116 | def get_partition_idx_from_part(self, part): |
|
|
117 | for idx, tmppart in enumerate(self._partitions): |
|
|
118 | if tmppart['start'] == part['start'] and tmppart['end'] == part['end']: |
|
|
119 | return idx |
|
|
120 | else: |
|
|
121 | return -1 |
|
|
122 | |
|
|
123 | def get_partition_idx_from_minor(self, minor): |
|
|
124 | for idx, tmppart in enumerate(self._partitions): |
|
|
125 | if tmppart['minor'] == minor: |
|
|
126 | return idx |
|
|
127 | else: |
|
|
128 | return -1 |
|
|
129 | |
|
|
130 | def get_partition_idx_from_start_end(self, start, end): |
|
|
131 | for idx, tmppart in enumerate(self._partitions): |
|
|
132 | if tmppart['start'] == start and tmppart['end'] == end: |
|
|
133 | return idx |
|
|
134 | else: |
|
|
135 | return -1 |
| 115 | |
136 | |
| 116 | def get_partition_position(self, minor): |
137 | def get_partition_position(self, minor): |
| 117 | for i, part in enumerate(self._partitions): |
138 | for i, part in enumerate(self._partitions): |
| 118 | if part['minor'] == minor: |
139 | if part['minor'] == minor: |
| 119 | return i |
140 | return i |
| … | |
… | |
| 261 | cmd = "%s %s" % (cmdname, devnode) |
282 | cmd = "%s %s" % (cmdname, devnode) |
| 262 | ret = GLIUtility.spawn(cmd) |
283 | ret = GLIUtility.spawn(cmd) |
| 263 | if not GLIUtility.exitsuccess(ret): |
284 | if not GLIUtility.exitsuccess(ret): |
| 264 | raise GLIException("PartitionFormatError", 'fatal', '_partition_format_step', "Could not create %s filesystem on %s" % (fstype, devnode)) |
285 | raise GLIException("PartitionFormatError", 'fatal', '_partition_format_step', "Could not create %s filesystem on %s" % (fstype, devnode)) |
| 265 | self.set_partitions_from_disk() |
286 | self.set_partitions_from_disk() |
|
|
287 | newidx = self.get_partition_idx_from_start_end(parted_newpart.geom.start, parted_newpart.geom.end) |
|
|
288 | return newidx |
| 266 | |
289 | |
| 267 | ## |
290 | ## |
| 268 | # Removes partition from partition info |
291 | # Removes partition from partition info |
| 269 | # @param minor Minor of partition to remove |
292 | # @param minor Minor of partition to remove |
| 270 | def delete_partition(self, partidx): |
293 | def delete_partition(self, partidx): |