Skip to content

Commit b548972

Browse files
committed
scripts/run.py: allow to pass block device cache mode to qemu
Signed-off-by: Waldemar Kozaczuk <jwkozaczuk@gmail.com>
1 parent 983cdca commit b548972

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

scripts/run.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ def is_direct_io_supported(path):
9090

9191
def start_osv_qemu(options):
9292

93-
if options.unsafe_cache or not is_direct_io_supported(options.image_file):
93+
if not is_direct_io_supported(options.image_file):
9494
aio = 'cache=unsafe,aio=threads'
95+
elif options.block_device_cache != None:
96+
aio = 'cache=%s,aio=threads'% options.block_device_cache
9597
else:
9698
aio = 'cache=none,aio=native'
9799

@@ -464,8 +466,8 @@ def main(options):
464466
help="don't restart qemu automatically (allow debugger to connect on early errors)")
465467
parser.add_argument("-s", "--with-signals", action="store_true", default=False,
466468
help="qemu only. handle signals instead of passing keys to the guest. pressing ctrl+c from console will kill the emulator")
467-
parser.add_argument("-u", "--unsafe-cache", action="store_true",
468-
help="Set cache to unsafe. Use it at your own risk.")
469+
parser.add_argument("--block-device-cache", action="store", default=None,
470+
help="Set QEMU block device cache to: none, writethrough, writeback, directsync or unsafe.")
469471
parser.add_argument("-g", "--graphics", action="store_true",
470472
help="Enable graphics mode.")
471473
parser.add_argument("-V", "--verbose", action="store_true",

scripts/tests/testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def __init__(self, args, forward=[], hold_with_poweroff=False, show_output_on_er
239239
for rule in forward:
240240
args.extend(['--forward', 'tcp::%s-:%s' % rule])
241241

242-
args.extend(['--unsafe-cache'])
242+
args.extend(['--block-device-cache', 'unsafe'])
243243

244244
if _verbose_output:
245245
print('Running OSv on %s with parameters: [%s]' % (hypervisor, " ".join(args)))

scripts/upload_manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def main():
154154

155155
image_path = os.path.abspath(options.output)
156156
upload_port = find_free_port()
157-
osv = subprocess.Popen('cd ../..; scripts/run.py --vnc none -m 512 -c1 -i "%s" -u -s -e "--norandom --nomount --noinit /tools/mkfs.so; /tools/cpiod.so --prefix /zfs/zfs/; /zfs.so set compression=off osv" --forward tcp:127.0.0.1:%s-:10000' % (image_path,upload_port), shell=True, stdout=subprocess.PIPE)
157+
osv = subprocess.Popen('cd ../..; scripts/run.py --vnc none -m 512 -c1 -i "%s" --block-device-cache unsafe -s -e "--norandom --nomount --noinit /tools/mkfs.so; /tools/cpiod.so --prefix /zfs/zfs/; /zfs.so set compression=off osv" --forward tcp:127.0.0.1:%s-:10000' % (image_path,upload_port), shell=True, stdout=subprocess.PIPE)
158158

159159
upload(osv, manifest, depends, upload_port)
160160

0 commit comments

Comments
 (0)