forked from uncloud/uncloud
Fix --name support in oneshot
This commit is contained in:
parent
9e2751c41e
commit
8797e93baf
1 changed files with 5 additions and 4 deletions
|
@ -16,7 +16,7 @@ arg_parser = argparse.ArgumentParser('oneshot', add_help=False)
|
||||||
arg_parser.add_argument('--list', action='store_true',
|
arg_parser.add_argument('--list', action='store_true',
|
||||||
help='list UUID and name of running VMs')
|
help='list UUID and name of running VMs')
|
||||||
arg_parser.add_argument('--start', nargs=3,
|
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')
|
help='start a VM using the OS IMAGE (full path), configuring networking on NETWORK IPv6 prefix')
|
||||||
arg_parser.add_argument('--stop', metavar='UUID',
|
arg_parser.add_argument('--stop', metavar='UUID',
|
||||||
help='stop a VM')
|
help='stop a VM')
|
||||||
|
@ -95,9 +95,10 @@ def main(arguments):
|
||||||
update_radvd_conf([network])
|
update_radvd_conf([network])
|
||||||
elif arguments['start']:
|
elif arguments['start']:
|
||||||
# Extract from --start positional arguments. Quite fragile.
|
# Extract from --start positional arguments. Quite fragile.
|
||||||
vm_config['image'] = arguments['start'][0]
|
vm_config['name'] = arguments['start'][0]
|
||||||
vm_config['network'] = arguments['start'][1]
|
vm_config['image'] = arguments['start'][1]
|
||||||
vm_config['upstream_interface'] = arguments['start'][2]
|
vm_config['network'] = arguments['start'][2]
|
||||||
|
vm_config['upstream_interface'] = arguments['start'][3]
|
||||||
|
|
||||||
vm_config['tap_interface'] = "uc{}".format(len(vmm.discover()))
|
vm_config['tap_interface'] = "uc{}".format(len(vmm.discover()))
|
||||||
vm = virtualmachine.VM(vmm, vm_config)
|
vm = virtualmachine.VM(vmm, vm_config)
|
||||||
|
|
Loading…
Reference in a new issue