qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disk cache defaults


From: Stefan Hajnoczi
Subject: Re: Disk cache defaults
Date: Wed, 29 Jul 2020 14:02:45 +0100

On Wed, Jul 22, 2020 at 07:14:59AM +0100, anthony smith wrote:
> Appreciate any assistance even if the answer is just "Not possible" so I
> can at least drop this search for answers.

You can create an /etc/qemu/qemu.conf file but I don't remember if there
is syntax to set -drive cache=none.

CCing Kevin Wolf and Markus Armbruster for ideas.

The hacky "solution" is to write a wrapper script (e.g. a shell script)
that modifies QEMU command-line arguments to use cache=none if no
explicit cache= option was given:

  $ cat qemu-wrapper.sh
  #!/bin/bash
  # Add QEMU -drive cache=none

  declare -a opts

  i=0
  is_drive=0
  for opt in "$@"; do
    if [ "$is_drive" -eq 1 ]; then
      opt="$opt,cache=none" # TODO skip if cache= is already in opts?
    fi
    opts[$i]="$opt"
    if [ "$opt" = "-drive" ]; then
      is_drive=1
    else
      is_drive=0
    fi
    i=$((i + 1))
  done

  exec /usr/bin/qemu-system-x86_64 "${opts[@]}"

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]