qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: sridhar kulkarni <sridhar_kulk@yahoo.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Savevm and loadvm not working
Date: Tue, 30 Jan 2018 19:55:10 +0800	[thread overview]
Message-ID: <20180130115510.GA13988@xz-mi> (raw)
In-Reply-To: <1972503886.3523325.1517308471375@mail.yahoo.com>

On Tue, Jan 30, 2018 at 10:34:31AM +0000, sridhar kulkarni via Qemu-devel wrote:
> Hi,
> I am new bee to snapshot feature and how to use it correctly. My requirement is simple, in that I want to snapshot the running VM and save the snapshot file. Using the snapshot file, I want to boot the VM directly to snapshot state.I came across the qemu monitors "savevm" and "loadvm" commands. The following are the steps I follow to create snapshot and load the snapshot,Step 1: Launch VM using below command, 
> qemu-system-arm -M arm-machine -m 512M -name my_name -kernel main.rbx -serial pty -serial vc -serial vc -serial vc -drive if=none,format=qcow2,file=/home/sridhar/qemu_disk_image/dummy.qcow2 
> 
> Step 2: Save the snapshot (issue savevm from qemu monitor)
>         --> savevm my_snapshot
> 
> Step 3 Launch the VM using snapshot image saved in step 2,
> qemu-system-arm -M arm-machine -m 512M -name my_name -kernel main.rbx -serial pty -serial vc -serial vc -serial vc -drive if=none,format=qcow2,file=/home/sridhar/qemu_disk_image/dummy.qcow2 -loadvm my_snapshot
> With this approach, I am seeing that RAM contents are not getting saved when I issue "savevm" command.

Could I ask how do you know that RAM contents are not saved?  Is there
any error happened after your loadvm operation?

> I have copied the part of the file, when the function "ram_control_save_page" returns "RAM_SAVE_CONTROL_NOT_SUPP" and hence the page is not getting saved.
> 
> size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
>                              ram_addr_t offset, size_t size,
>                              uint64_t *bytes_sent)
> {
>     if (f->hooks && f->hooks->save_page) {
>         int ret = f->hooks->save_page(f, f->opaque, block_offset,
>                                       offset, size, bytes_sent);
> 
>         if (ret != RAM_SAVE_CONTROL_DELAYED) {
>             if (bytes_sent && *bytes_sent > 0) {
>                 qemu_update_position(f, *bytes_sent);
>             } else if (ret < 0) {
>                 qemu_file_set_error(f, ret);
>             }
>         }
> 
>         return ret;
>     }
> 
>     return RAM_SAVE_CONTROL_NOT_SUPP;

Here IMHO as long as you are not using RDMA, this function should
always return with RAM_SAVE_CONTROL_NOT_SUPP.

And I do think the name is slightly misleading.

> }
> 
> Is there anything that I am missing here in the understanding "savevm" and "loadvm" commands? 
> 
> Thanks

-- 
Peter Xu

  reply	other threads:[~2018-01-30 11:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1972503886.3523325.1517308471375.ref@mail.yahoo.com>
2018-01-30 10:34 ` [Qemu-devel] Savevm and loadvm not working sridhar kulkarni
2018-01-30 11:55   ` Peter Xu [this message]
2018-02-01 12:19     ` sridhar kulkarni
2018-02-01 12:26       ` Peter Maydell
2018-02-01 17:36         ` sridhar kulkarni
2018-02-01 18:00           ` Peter Maydell

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=20180130115510.GA13988@xz-mi \
    --to=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sridhar_kulk@yahoo.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).