All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hailiang Zhang <zhang.zhanghailiang@huawei.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: peter.huangpeng@huawei.com, qemu-devel@nongnu.org,
	aarcange@redhat.com, quintela@redhat.com, amit.shah@redhat.com,
	hanweidong@huawei.com, Benoit Canet <benoit.canet@gmail.com>
Subject: Re: [Qemu-devel] [RFC 02/13] migration: Allow the migrate command to work on file: urls
Date: Thu, 14 Jul 2016 13:27:17 +0800	[thread overview]
Message-ID: <578722B5.6000207@huawei.com> (raw)
In-Reply-To: <20160713161230.GE4573@work-vm>

On 2016/7/14 0:12, Dr. David Alan Gilbert wrote:
> * zhanghailiang (zhang.zhanghailiang@huawei.com) wrote:
>> Usage:
>> (qemu) migrate file:/path/to/vm_statefile
>>
>> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
>> Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
>> ---
>> - With this patch, we can easily test memory snapshot
>> - Rebase on qemu 2.5
>> ---
>>   include/migration/migration.h |  6 +++++-
>>   migration/fd.c                | 19 +++++++++++++++++--
>>   migration/migration.c         |  4 +++-
>>   3 files changed, 25 insertions(+), 4 deletions(-)
>
> Even if the rest of this series takes some time to finish; it might be
> best to post this patch separately - it just a nice bit of simplification.
> Of course now you have to rewrite using qio_channel_file_new_path
> but I guess it's simple.
>
> (I've tended to use migrate "exec:cat > file" but a file:  would be nice)
>

OK, if you need this, i will send it as a single patch.

Thanks.

> Dave
>
>> diff --git a/include/migration/migration.h b/include/migration/migration.h
>> index 4c80939..bf4f8e9 100644
>> --- a/include/migration/migration.h
>> +++ b/include/migration/migration.h
>> @@ -193,7 +193,11 @@ void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **
>>
>>   void fd_start_incoming_migration(const char *path, Error **errp);
>>
>> -void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp);
>> +void fd_start_outgoing_migration(MigrationState *s, const char *fdname,
>> +                                 int outfd, Error **errp);
>> +
>> +void file_start_outgoing_migration(MigrationState *s, const char *filename,
>> +                                   Error **errp);
>>
>>   void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp);
>>
>> diff --git a/migration/fd.c b/migration/fd.c
>> index 3e4bed0..b62161f 100644
>> --- a/migration/fd.c
>> +++ b/migration/fd.c
>> @@ -42,9 +42,10 @@ static bool fd_is_socket(int fd)
>>       return S_ISSOCK(stat.st_mode);
>>   }
>>
>> -void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp)
>> +void fd_start_outgoing_migration(MigrationState *s, const char *fdname,
>> +                                 int outfd, Error **errp)
>>   {
>> -    int fd = monitor_get_fd(cur_mon, fdname, errp);
>> +    int fd = fdname ? monitor_get_fd(cur_mon, fdname, errp) : outfd;
>>       if (fd == -1) {
>>           return;
>>       }
>> @@ -58,6 +59,20 @@ void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **
>>       migrate_fd_connect(s);
>>   }
>>
>> +void file_start_outgoing_migration(MigrationState *s, const char *filename,
>> +                                   Error **errp)
>> +{
>> +    int fd;
>> +
>> +    fd = qemu_open(filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
>> +    if (fd < 0) {
>> +        error_setg_errno(errp, errno, "Failed to open file: %s", filename);
>> +        return;
>> +    }
>> +    fd_start_outgoing_migration(s, NULL, fd, errp);
>> +}
>> +
>> +
>>   static void fd_accept_incoming_migration(void *opaque)
>>   {
>>       QEMUFile *f = opaque;
>> diff --git a/migration/migration.c b/migration/migration.c
>> index c842499..3ec3b85 100644
>> --- a/migration/migration.c
>> +++ b/migration/migration.c
>> @@ -1021,7 +1021,9 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
>>       } else if (strstart(uri, "unix:", &p)) {
>>           unix_start_outgoing_migration(s, p, &local_err);
>>       } else if (strstart(uri, "fd:", &p)) {
>> -        fd_start_outgoing_migration(s, p, &local_err);
>> +        fd_start_outgoing_migration(s, p, -1, &local_err);
>> +    } else if (strstart(uri, "file:", &p)) {
>> +        file_start_outgoing_migration(s, p,  &local_err);
>>   #endif
>>       } else {
>>           error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "uri",
>> --
>> 1.8.3.1
>>
>>
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
>
> .
>

  reply	other threads:[~2016-07-14  5:27 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-07 12:19 [Qemu-devel] [RFC 00/13] Live memory snapshot based on userfaultfd zhanghailiang
2016-01-07 12:19 ` [Qemu-devel] [RFC 01/13] postcopy/migration: Split fault related state into struct UserfaultState zhanghailiang
2016-01-07 12:19 ` [Qemu-devel] [RFC 02/13] migration: Allow the migrate command to work on file: urls zhanghailiang
2016-07-13 16:12   ` Dr. David Alan Gilbert
2016-07-14  5:27     ` Hailiang Zhang [this message]
2016-01-07 12:19 ` [Qemu-devel] [RFC 03/13] migration: Allow -incoming " zhanghailiang
2016-01-11 20:02   ` Dr. David Alan Gilbert
2016-01-12 13:04     ` Hailiang Zhang
2016-01-07 12:19 ` [Qemu-devel] [RFC 04/13] migration: Create a snapshot thread to realize saving memory snapshot zhanghailiang
2016-01-07 12:20 ` [Qemu-devel] [RFC 05/13] migration: implement initialization work for snapshot zhanghailiang
2016-01-07 12:20 ` [Qemu-devel] [RFC 06/13] QEMUSizedBuffer: Introduce two help functions for qsb zhanghailiang
2016-01-07 12:20 ` [Qemu-devel] [RFC 07/13] savevm: Split qemu_savevm_state_complete_precopy() into two helper functions zhanghailiang
2016-01-07 12:20 ` [Qemu-devel] [RFC 08/13] snapshot: Save VM's device state into snapshot file zhanghailiang
2016-01-07 12:20 ` [Qemu-devel] [RFC 09/13] migration/postcopy-ram: fix some helper functions to support userfaultfd write-protect zhanghailiang
2016-01-07 12:20 ` [Qemu-devel] [RFC 10/13] snapshot: Enable the write-protect notification capability for VM's RAM zhanghailiang
2016-01-07 12:20 ` [Qemu-devel] [RFC 11/13] snapshot/migration: Save VM's RAM into snapshot file zhanghailiang
2016-01-07 12:20 ` [Qemu-devel] [RFC 12/13] migration/ram: Fix some helper functions' parameter to use PageSearchStatus zhanghailiang
2016-01-11 17:55   ` Dr. David Alan Gilbert
2016-01-12 12:59     ` Hailiang Zhang
2016-01-07 12:20 ` [Qemu-devel] [RFC 13/13] snapshot: Remove page's write-protect and copy the content during setup stage zhanghailiang
2016-07-13 17:52   ` Dr. David Alan Gilbert
2016-07-14  8:02     ` Hailiang Zhang
2016-07-04 12:22 ` [Qemu-devel] [RFC 00/13] Live memory snapshot based on userfaultfd Baptiste Reynal
2016-07-05  1:49   ` Hailiang Zhang
2016-07-05  9:57     ` Baptiste Reynal
2016-07-05 10:27       ` Hailiang Zhang
2016-08-18 15:56         ` Andrea Arcangeli
2016-08-20  6:31           ` Hailiang Zhang
2017-02-27 15:37             ` Christian Pinto
2017-02-28  1:48               ` Hailiang Zhang
2017-02-28  8:30                 ` Christian Pinto
2017-02-28 16:14                 ` Andrea Arcangeli
2017-03-01  1:08                   ` Hailiang Zhang
2017-03-09 11:34             ` [Qemu-devel] [RFC PATCH 0/4] ARM/ARM64 fixes for live " Christian Pinto
2017-03-09 11:34               ` [Qemu-devel] [RFC PATCH 1/4] migration/postcopy-ram: check pagefault flags in userfaultfd thread Christian Pinto
2017-03-09 11:34               ` [Qemu-devel] [RFC PATCH 2/4] migration/ram: Fix for ARM/ARM64 page size Christian Pinto
2017-03-09 11:34               ` [Qemu-devel] [RFC PATCH 3/4] migration: snapshot thread Christian Pinto
2017-03-09 11:34               ` [Qemu-devel] [RFC PATCH 4/4] migration/postcopy-ram: ram_set_pages_wp fix Christian Pinto
2017-03-09 17:46               ` [Qemu-devel] [RFC PATCH 0/4] ARM/ARM64 fixes for live memory snapshot based on userfaultfd Dr. David Alan Gilbert
2017-03-10  8:15                 ` Christian Pinto
2016-09-06  3:39           ` [Qemu-devel] [RFC 00/13] Live " Hailiang Zhang
2016-09-18  2:14             ` Hailiang Zhang
2016-12-08 12:45               ` Hailiang Zhang
2016-07-05 14:59       ` Andrea Arcangeli
2016-07-13 18:02 ` Dr. David Alan Gilbert
2016-07-14 10:24   ` Hailiang Zhang
2016-07-14 11:43     ` Dr. David Alan Gilbert
2016-07-19  6:53       ` Hailiang Zhang

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=578722B5.6000207@huawei.com \
    --to=zhang.zhanghailiang@huawei.com \
    --cc=aarcange@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=benoit.canet@gmail.com \
    --cc=dgilbert@redhat.com \
    --cc=hanweidong@huawei.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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.