kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Avi Kivity <avi@redhat.com>
Cc: Antoine Martin <antoine@nagafix.co.uk>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: sharing a (mostly) read-only virtual block device
Date: Sun, 18 Oct 2009 12:32:19 +0400	[thread overview]
Message-ID: <4ADAD293.3010004@msgid.tls.msk.ru> (raw)
In-Reply-To: <4ADABD7C.50803@redhat.com>

Avi Kivity пишет:
> On 10/16/2009 07:45 PM, Antoine Martin wrote:
>> Hi,
>>
>> Is there an easy way that I have missed to share a virtual disk
>> read-only between many guests whilst still having the ability to update
>> it occasionally from the host?
> 
> That's very fragile, since the guest won't expect the disk to change 
> under its feet.  Expect oopses.

There's another way possible.  Not sure if its feasible here due to
the amount of space it requires.

The idea is to move the original _unmodified_ image out of the way but keep
it.  All guests who have it open now will keep it open and will not see the
changes.  But you now require at least 2x space - for old image and for the
new one. Or more, if you want to keep some guests running for longer so they
still refer to pre-last or pre-pre-last image version.

It can be done by preparing the new file as foo.new and moving it into place
by mv.  The old file gets removed from the directory but not removed physically
from the filesystem, till all the references to it (open by another process)
will be gone.

[]
> I suggest using a monitor, and have the host and guest coordinate the 
> change (guest unmounts, host modifies, guest mounts).

Yes that's the way to go.  Or, simpler, reboot the guest(s).

There's no need to umount the filesystem in the guest if going "my way" above.

> Alternatively, export the disk from the host using nfs.

And yes, that's also a very good idea.

/mjt

  reply	other threads:[~2009-10-18  8:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-16 10:45 sharing a (mostly) read-only virtual block device Antoine Martin
2009-10-18  7:02 ` Avi Kivity
2009-10-18  8:32   ` Michael Tokarev [this message]
2009-10-18 12:25     ` Antoine Martin
2009-10-19  1:51       ` Avi Kivity

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=4ADAD293.3010004@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=antoine@nagafix.co.uk \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.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).