Revision c408053f image_creator/disk.py
b/image_creator/disk.py | ||
---|---|---|
59 | 59 |
|
60 | 60 |
def get_device(self): |
61 | 61 |
"""Returns a newly created DiskDevice instance. |
62 |
|
|
62 |
|
|
63 | 63 |
This instance is a snapshot of the original source media of |
64 | 64 |
the Disk instance. |
65 | 65 |
""" |
... | ... | |
195 | 195 |
start = last_partition['part_start'] / sector_size |
196 | 196 |
end = start + (block_size * block_cnt) / sector_size - 1 |
197 | 197 |
|
198 |
self.g.part_del(dev, last_partition['part_num']) |
|
199 |
self.g.part_add(dev, 'p', start, end) |
|
200 |
|
|
198 | 201 |
return (end + 1) * sector_size |
199 | 202 |
|
203 |
def size(self): |
|
204 |
"""Returns the "payload" size of the device. |
|
205 |
|
|
206 |
The size returned by this method is the size of the space occupied by |
|
207 |
the partitions (including the space before the first partition). |
|
208 |
""" |
|
209 |
dev = self.g.part_to_dev(self.root) |
|
210 |
last = self.g.part_list(dev)[-1] |
|
211 |
|
|
212 |
return last['part_end'] |
|
200 | 213 |
|
201 | 214 |
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai : |
Also available in: Unified diff