# or implied, of GRNET S.A.
from image_creator.util import get_command
-from image_creator.util import warn, progress, success, output
-from image_creator import FatalError
+from image_creator.util import warn, progress, success, output, FatalError
import stat
import os
job, args = self._cleanup_jobs.pop()
job(*args)
- def get_device(self):
- """Returns a newly created DiskDevice instance.
-
- This instance is a snapshot of the original source media of
- the Disk instance.
+ def snapshot(self):
+ """Creates a snapshot of the original source media of the Disk
+ instance.
"""
output("Examining source media `%s'..." % self.source, False)
finally:
os.unlink(table)
success('done')
- new_device = DiskDevice("/dev/mapper/%s" % snapshot)
+ return "/dev/mapper/%s" % snapshot
+
+ def get_device(self, media):
+ """Returns a newly created DiskDevice instance."""
+
+ new_device = DiskDevice(media)
self._devices.append(new_device)
new_device.enable()
return new_device
self.g.e2fsck_f(part_dev)
self.g.resize2fs_M(part_dev)
- output = self.g.tune2fs_l(part_dev)
+ out = self.g.tune2fs_l(part_dev)
block_size = int(
- filter(lambda x: x[0] == 'Block size', output)[0][1])
+ filter(lambda x: x[0] == 'Block size', out)[0][1])
block_cnt = int(
- filter(lambda x: x[0] == 'Block count', output)[0][1])
+ filter(lambda x: x[0] == 'Block count', out)[0][1])
sector_size = self.g.blockdev_getss(dev)