All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] migration: adding migration to/from a file
Date: Tue, 20 Jan 2009 11:53:47 +0000	[thread overview]
Message-ID: <20090120115347.GK6004@redhat.com> (raw)
In-Reply-To: <4975B648.5050104@redhat.com>

On Tue, Jan 20, 2009 at 01:32:24PM +0200, Uri Lublin wrote:
> Anthony Liguori wrote:
> >Uri Lublin wrote:
> >>Migration to file, reuses migration-to-fd.
> >>Migration from file, uses qemu-fopen directly.
> >>
> >>The saved state-file should be used only once and removed (or used
> >>with -snapshot, or a the disk-image should be copied), as the
> >>disk image is not saved, only the VM state.
> >>
> >>Also there is not point of doing a _live_ migration to file (except
> >>for debugging migration code), so I recommend to stop the VM before 
> >>migrating its state to a file.
> >>
> >>An advantage migration-to-file over savevm/loadvm is that for the latter
> >>a qcow2 is a requirement, while the former works for any image-format.
> >>
> >>Signed-off-by: Uri Lublin <uril@redhat.com>
> >>---
> 
> >>+
> >>+MigrationState *file_start_outgoing_migration(const char *filename,
> >>+                                              int64_t bandwidth_limit,
> >>+                                              int async)
> >>+{
> >>+    FdMigrationState *s;
> >>+    int fd;
> >>+
> >>+    s = qemu_mallocz(sizeof(*s));
> >>+    if (s == NULL) {
> >>+        perror("file_migration: qemu_mallocz failed");
> >>+        term_printf("file_migration: qemu_mallocz failed");
> >>+        goto err1;
> >>+    }
> >>+
> >>+    fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);
> >>+    if (fd < 0) {
> >>+        perror("file_migration: failed to open filename");
> >>+        term_printf("file_migration: failed to open filename %s\n", 
> >>filename);
> >>+        goto err2;
> >>+    }
> >>  
> >
> >The migration code assumes that the file descriptor used is 
> >non-blocking.  In general, open() on a file system cannot produce a 
> >non-blocking file descriptor.
> 
> I can call fcntl with F_SETFL and O_NONBLOCK.

IIRC that doesn't have any effect on plain files - they'll still potentially
block on write.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

  reply	other threads:[~2009-01-20 11:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-19  0:18 [Qemu-devel] [PATCH] migration: adding migration to/from a file Uri Lublin
2009-01-19  0:55 ` Paul Brook
2009-01-20 11:05   ` Uri Lublin
2009-01-20 14:06     ` Ian Jackson
2009-01-19 15:11 ` Anthony Liguori
2009-01-20 11:15   ` Daniel P. Berrange
2009-01-20 12:15     ` Uri Lublin
2009-01-20 16:24     ` Anthony Liguori
2009-01-20 11:32   ` Uri Lublin
2009-01-20 11:53     ` Daniel P. Berrange [this message]
2009-01-20 16:26       ` Anthony Liguori

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=20090120115347.GK6004@redhat.com \
    --to=berrange@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.