Fix --accel parameter for oneshot

This commit is contained in:
fnux 2020-01-30 08:47:23 +01:00
parent 3171ab8ccb
commit 17d0c61407
2 changed files with 3 additions and 5 deletions

View file

@ -40,7 +40,7 @@ arg_parser.add_argument('--threads', type=int,
help='Number of threads to allocate (--start)') help='Number of threads to allocate (--start)')
arg_parser.add_argument('--image-format', choices=['raw', 'qcow2'], arg_parser.add_argument('--image-format', choices=['raw', 'qcow2'],
help='Format of OS image (--start)') help='Format of OS image (--start)')
arg_parser.add_argument('--accel', choices=['kvm', 'tcg'], default='tcg', arg_parser.add_argument('--accel', choices=['kvm', 'tcg'], default='kvm',
help='QEMU acceleration to use (--start)') help='QEMU acceleration to use (--start)')
arg_parser.add_argument('--upstream-interface', default='eth0', arg_parser.add_argument('--upstream-interface', default='eth0',
help='Name of upstream interface (--start)') help='Name of upstream interface (--start)')
@ -74,7 +74,7 @@ def main(arguments):
vm_config = {} vm_config = {}
vm_options = [ vm_options = [
'mac', 'memory', 'cores', 'threads', 'image', 'image_format', 'mac', 'memory', 'cores', 'threads', 'image', 'image_format',
'--upstream_interface', 'upstream_interface', 'network' '--upstream_interface', 'upstream_interface', 'network', 'accel'
] ]
for option in vm_options: for option in vm_options:
if arguments.get(option): if arguments.get(option):

View file

@ -18,15 +18,13 @@ class VM(object):
self.image = config.get('image') self.image = config.get('image')
self.uuid = config.get('uuid', str(uuid.uuid4())) self.uuid = config.get('uuid', str(uuid.uuid4()))
self.mac = config.get('mac') self.mac = config.get('mac')
self.accel = config.get('accel', 'kvm')
self.net_id = config.get('net_id', 0) self.net_id = config.get('net_id', 0)
self.upstream_interface = config.get('upstream_interface', 'eth0') self.upstream_interface = config.get('upstream_interface', 'eth0')
self.tap_interface = config.get('tap_interface', 'uc0') self.tap_interface = config.get('tap_interface', 'uc0')
self.network = config.get('network') self.network = config.get('network')
# Harcoded & generated values.
self.accel = 'kvm'
def get_qemu_args(self): def get_qemu_args(self):
command = ( command = (
"-uuid {uuid} -name {name} -machine pc,accel={accel}" "-uuid {uuid} -name {name} -machine pc,accel={accel}"