qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: anthony smith <backtogeek@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: Disk cache defaults
Date: Wed, 29 Jul 2020 14:02:45 +0100	[thread overview]
Message-ID: <20200729130245.GH37763@stefanha-x1.localdomain> (raw)
In-Reply-To: <CAPf-64Wni=_9byuHt9HyFnZ6PwTF3wp17oEMF2ok-Tvk6UG0RQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 938 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-07-29 13:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22  6:14 Disk cache defaults anthony smith
2020-07-29 13:02 ` Stefan Hajnoczi [this message]
2020-07-30 15:23   ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200729130245.GH37763@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=armbru@redhat.com \
    --cc=backtogeek@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).