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

Re: [Xen-devel] [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.



Jim Fehlig wrote:
> Ian Campbell wrote:
>   
>> Jim,
>>
>> What would be the right thing to do for this? The intention is for
>> osstest to skip migration tests when that feature is unimplemented by
>> the toolstack/xen/arch combination.
>>
>> It looks like the output of "virsh capabilities" indicates migration:
>>     <migration_features>
>>       <live/>
>>       <uri_transports>
>>         <uri_transport>tcp</uri_transport>
>>       </uri_transports>
>>     </migration_features>
>> is that the right place to look?
>>   
>>     
>
> Yes.
>
>   
>> Will this capability be automagically suppressed on ARM until we
>> implement it?
>>     
>
> Unfortunately, no :-/.  Currently, the libvirt libxl driver will include
> <migration_features> and call save, restore, and migrate regardless of arch.
>
>   
>>  FYI xl uses LIBXL_HAVE_NO_SUSPEND_RESUME to figure this
>> out...
>>   
>>     
>
> Ah, interesting.  Thanks for the tip.  I'll need to add similar logic in
> the libxl driver.
>   

Something like the attached patch (compile-tested only).  You'll need an
updated libvirt.git master to apply cleanly.

Regards,
Jim

From 5c805d24d7d78c4435b871ffaf938c3e302c7a6f Mon Sep 17 00:00:00 2001
From: Jim Fehlig <jfehlig@xxxxxxxx>
Date: Tue, 24 Jun 2014 11:10:49 -0600
Subject: [PATCH] libxl: detect support for save and restore

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

Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
---
 src/libxl/libxl_conf.c   | 4 ++++
 src/libxl/libxl_driver.c | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 4b6b5c0..8eeaf82 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1340,7 +1340,11 @@ libxlMakeCapabilities(libxl_ctx *ctx)
 {
     virCapsPtr caps;
 
+#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
+    if ((caps = virCapabilitiesNew(virArchFromHost(), 0, 0)) == NULL)
+#else
     if ((caps = virCapabilitiesNew(virArchFromHost(), 1, 1)) == NULL)
+#endif
         return NULL;
 
     if (libxlCapsInitHost(ctx, caps) < 0)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 1ea99e2..f90bf64 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1370,6 +1370,7 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, 
virDomainObjPtr vm,
     return ret;
 }
 
+#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME
 static int
 libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml,
                      unsigned int flags)
@@ -1488,6 +1489,7 @@ libxlDomainRestore(virConnectPtr conn, const char *from)
 {
     return libxlDomainRestoreFlags(conn, from, NULL, 0);
 }
+#endif /* ifndef LIBXL_HAVE_NO_SUSPEND_RESUME */
 
 static int
 libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int flags)
@@ -4594,10 +4596,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
     .domainCoreDump = libxlDomainCoreDump, /* 0.9.2 */
     .domainSetVcpus = libxlDomainSetVcpus, /* 0.9.0 */
     .domainSetVcpusFlags = libxlDomainSetVcpusFlags, /* 0.9.0 */
@@ -4650,11 +4654,13 @@ static virDriver libxlDriver = {
     .nodeDeviceDetachFlags = libxlNodeDeviceDetachFlags, /* 1.2.3 */
     .nodeDeviceReAttach = libxlNodeDeviceReAttach, /* 1.2.3 */
     .nodeDeviceReset = libxlNodeDeviceReset, /* 1.2.3 */
+#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME
     .domainMigrateBegin3Params = libxlDomainMigrateBegin3Params, /* 1.2.6 */
     .domainMigratePrepare3Params = libxlDomainMigratePrepare3Params, /* 1.2.6 
*/
     .domainMigratePerform3Params = libxlDomainMigratePerform3Params, /* 1.2.6 
*/
     .domainMigrateFinish3Params = libxlDomainMigrateFinish3Params, /* 1.2.6 */
     .domainMigrateConfirm3Params = libxlDomainMigrateConfirm3Params, /* 1.2.6 
*/
+#endif
 };
 
 static virStateDriver libxlStateDriver = {
-- 
1.8.4.5

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.