Merge pull request #1160 from ogayot/fix-kvm-test-drive

Fix -drive option and -append option from kvm-test.sh
This commit is contained in:
Dan Bungert 2022-01-13 12:40:17 -07:00 committed by GitHub
commit 2fb74e5e03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -20,6 +20,7 @@ import socket
import subprocess
import sys
import tempfile
from typing import Tuple
import yaml
@ -307,7 +308,8 @@ def create_seed(cloudconfig, tempdir):
return seed
def drive(path, format='qcow2'):
def drive(path, format='qcow2') -> Tuple[str, str]:
""" Return a tuple (-drive, <options>) that can be passed to kvm """
kwargs = []
serial = None
cparam = 'writethrough'
@ -318,7 +320,7 @@ def drive(path, format='qcow2'):
if serial:
kwargs.append(f'serial={serial}')
return ['-drive', ','.join(kwargs)]
return ('-drive', ','.join(kwargs))
class PortFinder:
@ -429,8 +431,7 @@ def install(ctx):
# kernel / initrd
kvm.extend(('-kernel', f'{mntdir}/casper/vmlinuz'))
kvm.extend(('-initrd', get_initrd(mntdir)))
toappend = ' '.join(appends)
kvm.extend(('-append', f'"{toappend}"'))
kvm.extend(('-append', ' '.join(appends)))
run(kvm)
else:
run(kvm)