@@ -90,8 +90,10 @@ def is_direct_io_supported(path):
9090
9191def 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" ,
0 commit comments