mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
Don't require qemu for raw volumes, use truncate
instead
This commit is contained in:
parent
9a6975ce7d
commit
3ff1c57980
2 changed files with 6 additions and 6 deletions
|
@ -11,8 +11,8 @@ class LoopbackVolume(Volume):
|
|||
|
||||
def _before_create(self, e):
|
||||
self.image_path = e.image_path
|
||||
vol_size = str(self.size.get_qty_in('MiB')) + 'M'
|
||||
log_check_call(['qemu-img', 'create', '-f', 'raw', self.image_path, vol_size])
|
||||
size_opt = '--size={mib}M'.format(mib=self.size.get_qty_in('MiB'))
|
||||
log_check_call(['truncate', 'create', size_opt, self.image_path])
|
||||
|
||||
def _before_attach(self, e):
|
||||
[self.loop_device_path] = log_check_call(['losetup', '--show', '--find', self.image_path])
|
||||
|
|
|
@ -12,12 +12,12 @@ class AddRequiredCommands(Task):
|
|||
@classmethod
|
||||
def run(cls, info):
|
||||
from ..fs.loopbackvolume import LoopbackVolume
|
||||
if isinstance(info.volume, LoopbackVolume):
|
||||
info.host_dependencies['qemu-img'] = 'qemu-utils'
|
||||
info.host_dependencies['losetup'] = 'mount'
|
||||
from ..fs.qemuvolume import QEMUVolume
|
||||
if isinstance(info.volume, QEMUVolume):
|
||||
if type(info.volume) is LoopbackVolume:
|
||||
info.host_dependencies['losetup'] = 'mount'
|
||||
info.host_dependencies['truncate'] = 'coreutils'
|
||||
if isinstance(info.volume, QEMUVolume):
|
||||
info.host_dependencies['qemu-img'] = 'qemu-utils'
|
||||
|
||||
|
||||
class Create(Task):
|
||||
|
|
Loading…
Add table
Reference in a new issue