Patchwork migrate: error message for ram_load size

login
register
mail settings
Submitter Doug Goldstein
Date Oct. 29, 2012, 6:16 a.m.
Message ID <1351491379-20590-1-git-send-email-cardoe@cardoe.com>
Download mbox | patch
Permalink /patch/194836/
State New
Headers show

Comments

Doug Goldstein - Oct. 29, 2012, 6:16 a.m.
Report an error when ramblock's sizes mismatch with a suggestion to the
user as to what went wrong.
---

libvirt uses migration to save the state, however when performing a
distro upgrade you might get an error starting your VMs up again without
much detail. This patch attempts to remedy that with extra error
messages.

Without patch:
$ virsh start expo
error: Failed to start domain expo
error: internal error Process exited while reading console log output: char device redirected to /dev/pts/16
qemu: warning: error while loading state for instance 0x0 of device 'ram'
load of migration failed

With patch:
$ virsh start expo
error: Failed to start domain expo
error: internal error Process exited while reading console log output: char device redirected to /dev/pts/16
qemu: warning: error ramblock '0000:00:02.0/qxl.vrom' length 16384 != 8192. Did you change the ROM/BIOS or RAM size between restarts?
qemu: warning: error while loading state for instance 0x0 of device 'ram'
load of migration failed


---
 arch_init.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Patch

diff --git a/arch_init.c b/arch_init.c
index 8c3bb0d..33f783b 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -810,6 +810,11 @@  static int ram_load(QEMUFile *f, void *opaque, int version_id)
                     QLIST_FOREACH(block, &ram_list.blocks, next) {
                         if (!strncmp(id, block->idstr, sizeof(id))) {
                             if (block->length != length) {
+                                fprintf(stderr, "qemu: warning: error ramblock "
+                                        "'%s' length %ld != %ld. Did you "
+                                        "change the ROM/BIOS or RAM size "
+                                        "between restarts?\n", id,
+                                        block->length, length);
                                 ret =  -EINVAL;
                                 goto done;
                             }