Skip to contentSkip to conversation

libxc: reset ctx->completed on each domain restore

PATCH In review Guido Günther 3 participants 4 messages Oct 5, 2011 – Oct 7, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxc: reset ctx->completed on each domain restore

Hi,
When using current libvirt git with libxenlight 4.1.1 restoring a domain the second time like:

virsh save foo foo.img
virsh restore foo.img
virsh destroy foo
virsh restore foo.img

fails like:

xc: detail: xc_domain_restore start: p2m_size = 100000
xc: debug: batch 0
xc: debug: Use old firmware ioport from the checkpoint
xc: detail: Writing 0 bytes of QEMU data to /var/lib/xen/qemu-resume.733
xc: error: error zeroing magic pages (22 = Das Argument ist ungültig): Internal error
xc: detail: Restore exit with rc=1

Note the absence of any:

xc: debug: batch 1024

lines that are there on successful resumes. The attached patch fixes this for me on 4.1.1. However current xen hg fails the same way and since the static structs are gone I wonder what's causing it there. Any ideas would be welcome!
Cheers,
-- Guido

Quoted 1 line

From 1287d8d2fbc38bb0ab507756281e8d726cf92464 Mon Sep 17 00:00:00 2001

From: Guido Guenther <[email protected]>
Date: Wed, 5 Oct 2011 19:52:11 +0200
Subject: [PATCH] xc_domain_restore: reset the completed flag

otherwise long running processes like libvirt can resume a domain only once.

---
 a/tools/libxc/xc_domain_restore.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tools/libxc/xc_domain_restore.c +1 -0
index 083927a..6edd584 100644
@@ -1145,6 +1145,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
     memset(&tailbuf, 0, sizeof(tailbuf));
     tailbuf.ishvm = hvm;
 
+    ctx->completed = 0;
     /* For info only */
     ctx->nr_pfns = 0;
 
Signature · 1 line
1.7.2.5

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

[PATCH/RFC] don't include <xen/sysctl.h> in libxl.h

Hi,
I'm unsure if libvirt qualifies as "node control tool":

In file included from /tmp/usr/include/libxl.h:137:0,

                 from libxl/libxl_conf.c:28:
/tmp/usr/include/xen/sysctl.h:31:2: error: #error "sysctl operations are intended for use by node control tools only"
In file included from /tmp/usr/include/xen/sysctl.h:35:0,
                 from /tmp/usr/include/libxl.h:137,
                 from libxl/libxl_conf.c:28:

If not it makes sense to remove the include from libxl.h and include it in xl_cmdimpl.c directly. This allows libvirt to include libxl.h again without defining __XEN_TOOLS__.

Does this look correct?
Cheers,
-- Guido

# HG changeset patch
# Parent 0b66e6450ffe6823d8b323ef4248b38fe7372d54

tools/libxl/libxl.h +0 -1
@@ -134,7 +134,6 @@
 #include <xentoollog.h>
 
 #include <xen/sched.h>
-#include <xen/sysctl.h>
 
 #include <libxl_uuid.h>
 
tools/libxl/xl_cmdimpl.c +2 -0
@@ -41,6 +41,8 @@
 #include "libxlutil.h"
 #include "xl.h"
 
+#include <xen/sysctl.h>
+
 #define CHK_ERRNO( call ) ({                                            \
         int chk_errno = (call);                                         \
         if (chk_errno < 0) {                                                \

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw

Re: [PATCH/RFC] don't include <xen/sysctl.h> in libxl.h

Guido Günther writes ("[Xen-devel] [PATCH/RFC] don't include <xen/sysctl.h> in l> Hi,

Quoted 1 line

I'm unsure if libvirt qualifies as "node control tool":

Not in this context.

Quoted 10 lines

In file included from /tmp/usr/include/libxl.h:137:0,

                 from libxl/libxl_conf.c:28:
/tmp/usr/include/xen/sysctl.h:31:2: error: #error "sysctl operations are intended for use by node control tools only"
In file included from /tmp/usr/include/xen/sysctl.h:35:0,
                 from /tmp/usr/include/libxl.h:137,
                 from libxl/libxl_conf.c:28:

If not it makes sense to remove the include from libxl.h and include it in xl_cmdimpl.c directly. This allows libvirt to include libxl.h again without defining __XEN_TOOLS__.

I think neither libxl.h nor xl_cmdimpl should drag in sysctl.h this way.

xl needs them because of this:

if (info.phys_cap & XEN_SYSCTL_PHYSCAP_hvm)
printf(" hvm");
if (info.phys_cap & XEN_SYSCTL_PHYSCAP_hvm_directio)
printf(" hvm_directio");

Either libxl should proxy these kinds of flags, or the flags should be moved to a public header file, or all libxl callers should automatically get __XEN_TOOLS__.

Ian.

#3 lore raw

Re: [PATCH/RFC] don't include <xen/sysctl.h> in libxl.h

Quoted 19 lines · Ian Jackson

Guido Günther writes ("[Xen-devel] [PATCH/RFC] don't include <xen/sysctl.h> in l> Hi,

Quoted 1 line

I'm unsure if libvirt qualifies as "node control tool":

Not in this context.

Quoted 10 lines

In file included from /tmp/usr/include/libxl.h:137:0,

                 from libxl/libxl_conf.c:28:
/tmp/usr/include/xen/sysctl.h:31:2: error: #error "sysctl operations are intended for use by node control tools only"
In file included from /tmp/usr/include/xen/sysctl.h:35:0,
                 from /tmp/usr/include/libxl.h:137,
                 from libxl/libxl_conf.c:28:

If not it makes sense to remove the include from libxl.h and include it in xl_cmdimpl.c directly. This allows libvirt to include libxl.h again without defining __XEN_TOOLS__.

I think neither libxl.h nor xl_cmdimpl should drag in sysctl.h this way.

Quoted 8 lines

xl needs them because of this:

if (info.phys_cap & XEN_SYSCTL_PHYSCAP_hvm)
printf(" hvm");
if (info.phys_cap & XEN_SYSCTL_PHYSCAP_hvm_directio)
printf(" hvm_directio");

Either libxl should proxy these kinds of flags,

I agree. I think the correct thing is for libxl to parse the raw data into separate info.hvm, info.hvm_directio etc booleans, much like we do for dominfo.

Quoted 10 lines

or the flags should be
moved to a public header file, or all libxl callers should automatically get __XEN_TOOLS__.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel