qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Deepak C Shetty <deepakcs@linux.vnet.ibm.com>
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Few Qs related to using qemu-nbd for exporting snapshot
Date: Thu, 9 May 2013 09:40:21 +0200	[thread overview]
Message-ID: <20130509074021.GF1074@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <5189DBED.8060203@linux.vnet.ibm.com>

On Wed, May 08, 2013 at 10:30:29AM +0530, Deepak C Shetty wrote:
>     I am looking at using qemu-nbd to export an existing snapshot to a Backup virtual appliance (VA) and had the following Qs in that context...
> 
> 1) Exporting an image using unix socket (-k option) Vs using
> --connect=/dev/nbd0, which one is better / preferred ? The idea being
> once exported, the disk will be hotplugged into Backup VA which will
> then use it as a src for backup operation.

--connect=/dev/nbd0 requires that the host kernel ships the nbd.ko
driver.  RHEL doesn't support nbd.ko, other distros may or may not.

Why are you using qemu-nbd at all if the backup appliance is on the same
host?  Would it be possible to attach the image file directly to the
virtual appliance?

> 2) If i use the --connect option, it requires the nbd kernel module to
> be loaded and i also get a nice --disconnect way of terminating the nbd
> export.
> 
> Using -k option qemu-nbd doesn't need the nbd kernel module, but the
> cmdline blocks and sending SIGTERM is the only way to terminate the nbd
> export... Is there a better way to terminate qemu-nbd if using the -k
> option ? If not, i assume SIGTERM would gracefully shut down qemu-nbd ?

SIGTERM stops qemu-nbd properly.

> 3) I was not able to get qemu-nbd running without the -t (persistent)
> option. Ideally without -t would be suited, since there is only one
> client/connection per nbd export and the nbd server would nicely shut
> itself down.. but i get the below error ....
> 
> server as...
> $ qemu-nbd -k /tmp/nbds1 ./debian_lenny_i386_standard.qcow2
> 
> client as...
> $ qemu-system-x86_64 -m 1024 -drive file=nbd:unix:/tmp/nbds1
> connect(unix:/tmp/nbds1): No such file or directory
> qemu-system-x86_64: -drive file=nbd:unix:/tmp/nbds1: could not open disk
> image nbd:unix:/tmp/nbds1: No such file or directory
> 
> nbds1 is indeed there...
> srwxrwxr-x. 1 dpkshetty dpkshetty 0 May  3 14:24 /tmp/nbds1
> 
> and then the server returns to the shell.. echo $? is 0

Try -drive file=nbd:...,format=raw to prevent format probing.  Recent
QEMU versions avoid reopening the image file here.  Even this may not
help if QEMU probes the disk geometry by opening and inspecting the MBR.

Kevin can explain the current state of probing better than me.

Stefan

      reply	other threads:[~2013-05-09  7:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <51839700.7040901@linux.vnet.ibm.com>
2013-05-08  5:00 ` [Qemu-devel] Few Qs related to using qemu-nbd for exporting snapshot Deepak C Shetty
2013-05-09  7:40   ` Stefan Hajnoczi [this message]

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=20130509074021.GF1074@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=aliguori@us.ibm.com \
    --cc=deepakcs@linux.vnet.ibm.com \
    --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).