From 8797e93bafff6dfad1c97991d54e9a704d43d48c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Thu, 30 Jan 2020 08:54:58 +0100 Subject: [PATCH] Fix --name support in oneshot --- uncloud/oneshot/main.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/uncloud/oneshot/main.py b/uncloud/oneshot/main.py index 0e56571..4e92a5c 100644 --- a/uncloud/oneshot/main.py +++ b/uncloud/oneshot/main.py @@ -16,7 +16,7 @@ arg_parser = argparse.ArgumentParser('oneshot', add_help=False) arg_parser.add_argument('--list', action='store_true', help='list UUID and name of running VMs') arg_parser.add_argument('--start', nargs=3, - metavar=('IMAGE', 'UPSTREAM_INTERFACE', 'NETWORK'), + metavar=('NAME', 'IMAGE', 'UPSTREAM_INTERFACE', 'NETWORK'), help='start a VM using the OS IMAGE (full path), configuring networking on NETWORK IPv6 prefix') arg_parser.add_argument('--stop', metavar='UUID', help='stop a VM') @@ -95,9 +95,10 @@ def main(arguments): update_radvd_conf([network]) elif arguments['start']: # Extract from --start positional arguments. Quite fragile. - vm_config['image'] = arguments['start'][0] - vm_config['network'] = arguments['start'][1] - vm_config['upstream_interface'] = arguments['start'][2] + vm_config['name'] = arguments['start'][0] + vm_config['image'] = arguments['start'][1] + vm_config['network'] = arguments['start'][2] + vm_config['upstream_interface'] = arguments['start'][3] vm_config['tap_interface'] = "uc{}".format(len(vmm.discover())) vm = virtualmachine.VM(vmm, vm_config)