diff options
author | Marcos Paulo de Souza <mpdesouza@suse.com> | 2020-07-20 19:48:22 -0300 |
---|---|---|
committer | Marcos Paulo de Souza <mpdesouza@suse.com> | 2020-07-20 19:48:22 -0300 |
commit | 80b31bb76560df894fc72b08a9957cd8c9058828 (patch) | |
tree | 95bef0e24255d0f22ceabbe881657d7d59c3ab7a | |
parent | ada9f8cb90408c673a4980c63277e91df0582611 (diff) | |
download | virtme-80b31bb76560df894fc72b08a9957cd8c9058828.tar.gz |
run.py: Introduce --blk-disk argument
This new argument will create a new virtio-blk device, instead of the
scsi-blk that can be created by using --disk argument, accepting the
same argument of --disk.
By using --disk-blk "disk2=file1" will create
/dev/disk/by-id/virtio-disk.
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
-rw-r--r-- | virtme/commands/run.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/virtme/commands/run.py b/virtme/commands/run.py index 2734848..d4c3233 100644 --- a/virtme/commands/run.py +++ b/virtme/commands/run.py @@ -71,6 +71,8 @@ def make_parser() -> argparse.ArgumentParser: help='Allow the host to ask the guest to release memory.') g.add_argument('--disk', action='append', default=[], metavar='NAME=PATH', help='Add a read/write virtio-scsi disk. The device node will be /dev/disk/by-id/scsi-0virtme_disk_NAME.') + g.add_argument('--blk-disk', action='append', default=[], metavar='NAME=PATH', + help='Add a read/write virtio-blk disk. The device nodes will be /dev/disk/by-id/virtio-virtme_disk_blk_NAME.') g.add_argument('--memory', action='store', default=None, help='Set guest memory and qemu -m flag.') g.add_argument('--name', action='store', default=None, @@ -410,6 +412,13 @@ def do_it() -> int: if args.memory: qemuargs.extend(['-m', args.memory]) + if args.blk_disk: + for i,d in enumerate(args.blk_disk): + driveid = 'blk-disk%d' % i + name, fn = sanitize_disk_args('--blk-disk', d) + qemuargs.extend(['-drive', 'if=none,id=%s,file=%s' % (driveid, fn), + '-device', 'virtio-blk-pci,drive=%s,serial=%s' % (driveid, name)]) + if args.disk: qemuargs.extend(['-device', '%s,id=scsi' % arch.virtio_dev_type('scsi')]) |