qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: Steven Sistare <steven.sistare@oracle.com>
Cc: qemu-devel@nongnu.org,  Peter Xu <peterx@redhat.com>,
	 Fabiano Rosas <farosas@suse.de>,
	 Leonardo Bras <leobras@redhat.com>
Subject: Re: [PATCH V1 4/4] cpr: reboot mode
Date: Tue, 24 Oct 2023 13:13:46 +0200	[thread overview]
Message-ID: <87fs20z311.fsf@secure.mitica> (raw)
In-Reply-To: <fe0848ae-6600-4b46-bf2a-05b9dea55472@oracle.com> (Steven Sistare's message of "Mon, 23 Oct 2023 14:39:19 -0400")

Steven Sistare <steven.sistare@oracle.com> wrote:
> On 10/20/2023 3:40 PM, Juan Quintela wrote:
>> Steven Sistare <steven.sistare@oracle.com> wrote:
>>> On 10/20/2023 5:45 AM, Juan Quintela wrote:
>>>> Steve Sistare <steven.sistare@oracle.com> wrote:
>>>>> Add the cpr-reboot migration mode.  Usage:
>>>>>
>>>>> $ qemu-system-$arch -monitor stdio ...
>>>>> QEMU 8.1.50 monitor - type 'help' for more information
>>>>> (qemu) migrate_set_capability x-ignore-shared on
>>>>> (qemu) migrate_set_parameter mode cpr-reboot
>>>>> (qemu) migrate -d file:vm.state
>>>>> (qemu) info status
>>>>> VM status: paused (postmigrate)
>>>>> (qemu) quit
>>>>>
>>>>> $ qemu-system-$arch -monitor stdio -incoming defer ...
>>>>> QEMU 8.1.50 monitor - type 'help' for more information
>>>>> (qemu) migrate_set_capability x-ignore-shared on
>>>>> (qemu) migrate_set_parameter mode cpr-reboot
>>>>> (qemu) migrate_incoming file:vm.state
>>>>> (qemu) info status
>>>>> VM status: running
>>>>>
>>>>> In this mode, the migrate command saves state to a file, allowing one
>>>>> to quit qemu, reboot to an updated kernel, and restart an updated version
>>>>> of qemu.  The caller must specify a migration URI that writes to and reads
>>>>> from a file.  Unlike normal mode, the use of certain local storage options
>>>>> does not block the migration, but the caller must not modify guest block
>>>>> devices between the quit and restart.  The guest RAM memory-backend must
>>>>> be shared, and the @x-ignore-shared migration capability must be set,
>>>>> to avoid saving RAM to the file.  Guest RAM must be non-volatile across
>>>>> reboot, such as by backing it with a dax device, but this is not enforced.
>>>>> The restarted qemu arguments must match those used to initially start qemu,
>>>>> plus the -incoming option.
>>>>
>>>> Please, add this message to doc/<somewhere> instead (or additionally) to
>>>> the commit log.
>>>>
>>>>> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
>>>>> ---
>>>>>  qapi/migration.json | 16 +++++++++++++++-
>>>>>  1 file changed, 15 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/qapi/migration.json b/qapi/migration.json
>>>>> index 184fb78..2d862fa 100644
>>>>> --- a/qapi/migration.json
>>>>> +++ b/qapi/migration.json
>>>>> @@ -620,9 +620,23 @@
>>>>>  #
>>>>>  # @normal: the original form of migration. (since 8.2)
>>>>>  #
>>>>> +# @cpr-reboot: The migrate command saves state to a file, allowing one to
>>>>> +#              quit qemu, reboot to an updated kernel, and restart an updated
>>>>> +#              version of qemu.  The caller must specify a migration URI
>>>>> +#              that writes to and reads from a file.  Unlike normal mode,
>>>>> +#              the use of certain local storage options does not block the
>>>>> +#              migration, but the caller must not modify guest block devices
>>>>> +#              between the quit and restart.  The guest RAM memory-backend
>>>>> +#              must be shared, and the @x-ignore-shared migration capability
>>>>> +#              must be set, to avoid saving it to the file.  Guest RAM must
>>>>> +#              be non-volatile across reboot, such as by backing it with
>>>>> +#              a dax device, but this is not enforced.  The restarted qemu
>>>>> +#              arguments must match those used to initially start qemu, plus
>>>>> +#              the -incoming option. (since 8.2)
>>>>> +#
>>>>>  ##
>>>>>  { 'enum': 'MigMode',
>>>>> -  'data': [ 'normal' ] }
>>>>> +  'data': [ 'normal', 'cpr-reboot' ] }
>>>>>  
>>>>>  ##
>>>>>  # @BitmapMigrationBitmapAliasTransform:
>>>>
>>>> It only works with file backend, and we don't have any check for that.
>>>> Wondering how to add that check.
>>>
>>> Actually, it works for other backends, but the ram contents are saved in the
>>> state file, which is slower. I should spell that out in the json comment and
>>> in the commit message.
>> 
>> Thanks.
>>>
>>>> Additionally, you are not adding a migration test that does exactly what
>>>> you put there in the comment.
>>>
>>> I provide tests/avocado/cpr.py in the original long series.  Would you
>>> like me to add it to this series, or post it later?  Would you prefer I
>>> add a test to tests/qtest/migration-test.c?
>> 
>> test/qtest/migration-test.c
>> 
>> please.
>> 
>> Something simple like what you say in the commit should be a good start.
>
> I wrote a new test which I will submit with V2 of this series.  Turned out to be
> easy after Fabiano provided test_file_common.
>
> +static void *test_mode_reboot_start(QTestState *from, QTestState *to)
> +{
> +    migrate_set_parameter_str(from, "mode", "cpr-reboot");
> +    migrate_set_parameter_str(to, "mode", "cpr-reboot");
> +
> +    migrate_set_capability(from, "x-ignore-shared", true);
> +    migrate_set_capability(to, "x-ignore-shared", true);
> +
> +    return NULL;
> +}
> +
> +static void test_mode_reboot(void)
> +{
> +    g_autofree char *uri = g_strdup_printf("file:%s/%s", tmpfs,
> +                                           FILE_TEST_FILENAME);
> +    MigrateCommon args = {
> +        .start.use_shmem = true,
> +        .connect_uri = uri,
> +        .listen_uri = "defer",
> +        .start_hook = test_mode_reboot_start
> +    };
> +
> +    test_file_common(&args, true);
> +}
>
> - Steve

As a started, that sounds good.
When you add more features, please add tests acordingly.

Thanks again, Juan.



  reply	other threads:[~2023-10-24 11:14 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19 20:47 [PATCH V1 0/4] Live Update reboot mode Steve Sistare
2023-10-19 20:47 ` [PATCH V1 1/4] migration: mode parameter Steve Sistare
2023-10-20  9:29   ` Juan Quintela
2023-10-20 14:08     ` Steven Sistare
2023-10-20 19:38       ` Juan Quintela
2023-10-20 22:14   ` Steven Sistare
2023-10-19 20:47 ` [PATCH V1 2/4] migration: per-mode blockers Steve Sistare
2023-10-20  9:36   ` Juan Quintela
2023-10-23 12:46   ` Daniel P. Berrangé
2023-10-23 14:37     ` Steven Sistare
2023-10-23 15:02       ` Daniel P. Berrangé
2023-10-23 18:29         ` Steven Sistare
2023-10-19 20:47 ` [PATCH V1 3/4] cpr: relax some blockers Steve Sistare
2023-10-20  9:38   ` Juan Quintela
2023-10-23 15:25     ` Peter Xu
2023-10-23 12:36   ` Daniel P. Berrangé
2023-10-19 20:47 ` [PATCH V1 4/4] cpr: reboot mode Steve Sistare
2023-10-20  9:45   ` Juan Quintela
2023-10-20 14:09     ` Steven Sistare
2023-10-20 19:40       ` Juan Quintela
2023-10-23 18:39         ` Steven Sistare
2023-10-24 11:13           ` Juan Quintela [this message]
2023-10-23 15:39   ` Peter Xu
2023-10-23 18:29     ` Steven Sistare
2023-10-23 18:51       ` Steven Sistare
2023-10-23 19:05         ` Peter Xu
2023-10-23 20:06           ` Steven Sistare
2023-10-19 21:18 ` [PATCH V1 0/4] Live Update " Steven Sistare
2023-10-20  9:23   ` Juan Quintela

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=87fs20z311.fsf@secure.mitica \
    --to=quintela@redhat.com \
    --cc=farosas@suse.de \
    --cc=leobras@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=steven.sistare@oracle.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 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).