qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Savevm and loadvm not working


From: sridhar kulkarni
Subject: [Qemu-devel] Savevm and loadvm not working
Date: Tue, 30 Jan 2018 10:34:31 +0000 (UTC)

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. 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;
}

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

Thanks

reply via email to

[Prev in Thread] Current Thread [Next in Thread]