Skip to contentSkip to conversation

libxl: detect support for save and restore

PATCH Eric Blake 4 participants 4 messages Jun 25, 2014 – Jun 26, 2014 2 messages not in the archive

lore
Share & tools
lore

Eric Blake

author
#1 lore raw
In reply to a message not in the archive
Quoted 15 lines · Jim Fehlig

libxl does not support save, restore, or migrate on all architectures, notably ARM. Detect whether libxl supports these operations using LIBXL_HAVE_NO_SUSPEND_RESUME. If not supported, drop advertisement of <migration_features>.

Found by Ian Campbell while improving Xen's OSSTEST infrastructure

http://lists.xen.org/archives/html/xen-devel/2014-06/msg02171.html

---

Derived from a test patch I sent to Ian Campbell

http://lists.xen.org/archives/html/xen-devel/2014-06/msg03150.html

Quoted 8 lines

Includes fixups Ian provided later in the thread.

 src/libxl/libxl_conf.c   | 4 ++++
 src/libxl/libxl_driver.c | 8 ++++++++
 2 files changed, 12 insertions(+)

+#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME

Double negative logic is hard to read. Oh well.

Review static virDriver libxlDriver = { · line 4606

Quoted 12 lines

static virDriver libxlDriver = {

(quoted diff) +2 -0
@@ -4594,10 +4598,12 @@ static virDriver libxlDriver = {
     .domainSetMemoryFlags = libxlDomainSetMemoryFlags, /* 0.9.0 */
     .domainGetInfo = libxlDomainGetInfo, /* 0.9.0 */
     .domainGetState = libxlDomainGetState, /* 0.9.2 */
+#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME
     .domainSave = libxlDomainSave, /* 0.9.2 */
     .domainSaveFlags = libxlDomainSaveFlags, /* 0.9.4 */
     .domainRestore = libxlDomainRestore, /* 0.9.2 */
     .domainRestoreFlags = libxlDomainRestoreFlags, /* 0.9.4 */
+#endif

Hmm - do we do conditional registration in any other driver based on configure-time results? I'd almost rather always provide the driver registration, and then use #ifdefs in the body of that function to either provide a sane result or else report that the compilation environment was too old, rather than omit the support altogether. Maybe get Dan's opinion on this?

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

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

#3 lore raw
In reply to a message not in the archive
Quoted 12 lines · Eric Blake
Quoted 11 lines · Jim Fehlig

libxl does not support save, restore, or migrate on all architectures, notably ARM. Detect whether libxl supports these operations using LIBXL_HAVE_NO_SUSPEND_RESUME. If not supported, drop advertisement of <migration_features>.

Found by Ian Campbell while improving Xen's OSSTEST infrastructure

http://lists.xen.org/archives/html/xen-devel/2014-06/msg02171.html

---

Quoted 5 lines
Quoted 5 lines

Derived from a test patch I sent to Ian Campbell

http://lists.xen.org/archives/html/xen-devel/2014-06/msg03150.html

Includes fixups Ian provided later in the thread.

I think it looks identical to that combination, in which case you can add my Tested-by: Ian Campbell <[email protected]> if you want.

Quoted 9 lines
Quoted 7 lines
 src/libxl/libxl_conf.c   | 4 ++++
 src/libxl/libxl_driver.c | 8 ++++++++
 2 files changed, 12 insertions(+)

+#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME

Double negative logic is hard to read. Oh well.

libxl didn't initially supply a #define (because it only supported x86 which always did migration) and when ARM came along we could only add something to new versions since obviously we can't change already released stuff, so it had to be this way, sadly.

Quoted 19 lines

Review static virDriver libxlDriver = { · line 4606

Quoted 11 lines

static virDriver libxlDriver = {

(quoted diff) +2 -0
@@ -4594,10 +4598,12 @@ static virDriver libxlDriver = {
     .domainSetMemoryFlags = libxlDomainSetMemoryFlags, /* 0.9.0 */
     .domainGetInfo = libxlDomainGetInfo, /* 0.9.0 */
     .domainGetState = libxlDomainGetState, /* 0.9.2 */
+#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME
     .domainSave = libxlDomainSave, /* 0.9.2 */
     .domainSaveFlags = libxlDomainSaveFlags, /* 0.9.4 */
     .domainRestore = libxlDomainRestore, /* 0.9.2 */
     .domainRestoreFlags = libxlDomainRestoreFlags, /* 0.9.4 */
+#endif

Hmm - do we do conditional registration in any other driver based on configure-time results? I'd almost rather always provide the driver registration, and then use #ifdefs in the body of that function to either provide a sane result or else report that the compilation environment was too old, rather than omit the support altogether. Maybe get Dan's opinion on this?

Quoted 1 line

From the Xen test harness' point of view we'd like virsh capabilities to

be accurate, FWIW.

Ian.

#4 lore raw
In reply to a message not in the archive
Quoted 44 lines · Eric Blake
Quoted 17 lines · Jim Fehlig

libxl does not support save, restore, or migrate on all architectures, notably ARM. Detect whether libxl supports these operations using LIBXL_HAVE_NO_SUSPEND_RESUME. If not supported, drop advertisement of <migration_features>.

Found by Ian Campbell while improving Xen's OSSTEST infrastructure

http://lists.xen.org/archives/html/xen-devel/2014-06/msg02171.html

---

Derived from a test patch I sent to Ian Campbell

http://lists.xen.org/archives/html/xen-devel/2014-06/msg03150.html

Includes fixups Ian provided later in the thread.

Quoted 9 lines
 src/libxl/libxl_conf.c   | 4 ++++
 src/libxl/libxl_driver.c | 8 ++++++++
 2 files changed, 12 insertions(+)

+#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME

Double negative logic is hard to read. Oh well.

Quoted 11 lines

static virDriver libxlDriver = {

(quoted diff) +1 -0
@@ -4594,10 +4598,12 @@ static virDriver libxlDriver = {
     .domainSetMemoryFlags = libxlDomainSetMemoryFlags, /* 0.9.0 */
     .domainGetInfo = libxlDomainGetInfo, /* 0.9.0 */
     .domainGetState = libxlDomainGetState, /* 0.9.2 */
+#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME
     .domainSave = libxlDomainSave, /* 0.9.2 */
     .domainSaveFlags = libxlDomainSaveFlags, /* 0.9.4 */
     .domainRestore = libxlDomainRestore, /* 0.9.2 */
     .domainRestoreFlags = libxlDomainRestoreFlags, /* 0.9.4 */
Quoted 8 lines

Review static virDriver libxlDriver = { · line 4607

Quoted 2 lines
(quoted diff) +1 -0
+#endif
 

Hmm - do we do conditional registration in any other driver based on configure-time results? I'd almost rather always provide the driver registration, and then use #ifdefs in the body of that function to either provide a sane result or else report that the compilation environment was too old, rather than omit the support altogether.

I sent a V2 which takes your preferred approach

https://www.redhat.com/archives/libvir-list/2014-June/msg01305.html

Quoted 2 lines

Maybe get Dan's opinion on this?

Ok. I lean towards V2 since it avoids the double negative.

Regards,
Jim

#5 lore raw
In reply to a message not in the archive
Quoted 39 lines · Eric Blake
Quoted 15 lines · Jim Fehlig

libxl does not support save, restore, or migrate on all architectures, notably ARM. Detect whether libxl supports these operations using LIBXL_HAVE_NO_SUSPEND_RESUME. If not supported, drop advertisement of <migration_features>.

Found by Ian Campbell while improving Xen's OSSTEST infrastructure

http://lists.xen.org/archives/html/xen-devel/2014-06/msg02171.html

---

Derived from a test patch I sent to Ian Campbell

http://lists.xen.org/archives/html/xen-devel/2014-06/msg03150.html

Quoted 8 lines

Includes fixups Ian provided later in the thread.

 src/libxl/libxl_conf.c   | 4 ++++
 src/libxl/libxl_driver.c | 8 ++++++++
 2 files changed, 12 insertions(+)

+#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME

Double negative logic is hard to read. Oh well.

Quoted 11 lines

static virDriver libxlDriver = {

(quoted diff) +1 -0
@@ -4594,10 +4598,12 @@ static virDriver libxlDriver = {
     .domainSetMemoryFlags = libxlDomainSetMemoryFlags, /* 0.9.0 */
     .domainGetInfo = libxlDomainGetInfo, /* 0.9.0 */
     .domainGetState = libxlDomainGetState, /* 0.9.2 */
+#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME
     .domainSave = libxlDomainSave, /* 0.9.2 */
     .domainSaveFlags = libxlDomainSaveFlags, /* 0.9.4 */
     .domainRestore = libxlDomainRestore, /* 0.9.2 */
     .domainRestoreFlags = libxlDomainRestoreFlags, /* 0.9.4 */
Quoted 8 lines

Review static virDriver libxlDriver = { · line 4606

Quoted 1 line
(quoted diff) +1 -0
+#endif

Hmm - do we do conditional registration in any other driver based on configure-time results? I'd almost rather always provide the driver registration, and then use #ifdefs in the body of that function to either provide a sane result or else report that the compilation environment was too old, rather than omit the support altogether. Maybe get Dan's opinion on this?

I think it'd end up pretty much the same in both cases since we'd end up using VIR_ERR_NO_SUPPORT in both cases. The argument in favour of providing the driver registration and #ifdef in the impl is that you could give a slightly more precise error report.

eg instead of "This function isn't supported" you could say "This function isn't supported on this architecture/version", but that's pretty much the only difference you'd get.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|