From: Wei Liu Date: Wed, 9 Sep 2015 16:11:24 +0000 (+0100) Subject: xl/libxl: disallow saving a guest with vNUMA configured X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~2544 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=fa6b5490be0bf2c0d1c17197e9c30af22e0a24e9;p=xen.git xl/libxl: disallow saving a guest with vNUMA configured This is because the migration stream does not preserve node information. Note this is not a regression for migration v2 vs legacy migration because neither of them preserves node information. Signed-off-by: Wei Liu Acked-by: Ian Campbell [ ijc -- some grammar fixes to the doc and fixed a comment ] --- diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5 index c6345b8c26..db4a163efd 100644 --- a/docs/man/xl.cfg.pod.5 +++ b/docs/man/xl.cfg.pod.5 @@ -263,6 +263,8 @@ virtual node. Note that virtual NUMA for PV guest is not yet supported, because there is an issue with cpuid handling that affects PV virtual NUMA. +Furthermore, guests with virtual NUMA cannot be saved or migrated +because the migration stream does not preserve node information. Each B is a list, which has a form of "[VNODE_CONFIG_OPTION,VNODE_CONFIG_OPTION, ... ]" (without quotes). diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index c2518a3451..b514377352 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -24,6 +24,7 @@ #include #include #include +#include libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t domid) { @@ -1602,7 +1603,7 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_suspend_state *dss) { STATE_AO_GC(dss->ao); int port; - int rc; + int rc, ret; /* Convenience aliases */ const uint32_t domid = dss->domid; @@ -1612,6 +1613,7 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_suspend_state *dss) const libxl_domain_remus_info *const r_info = dss->remus; libxl__srm_save_autogen_callbacks *const callbacks = &dss->sws.shs.callbacks.save.a; + unsigned int nr_vnodes = 0, nr_vmemranges = 0, nr_vcpus = 0; dss->rc = 0; logdirty_init(&dss->logdirty); @@ -1636,6 +1638,21 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_suspend_state *dss) | (debug ? XCFLAGS_DEBUG : 0) | (dss->hvm ? XCFLAGS_HVM : 0); + /* Disallow saving a guest with vNUMA configured because migration + * stream does not preserve node information. + * + * Reject any domain which has vnuma enabled, even if the + * configuration is empty. Only domains which have no vnuma + * configuration at all are supported. + */ + ret = xc_domain_getvnuma(CTX->xch, domid, &nr_vnodes, &nr_vmemranges, + &nr_vcpus, NULL, NULL, NULL); + if (ret != -1 || errno != XEN_EOPNOTSUPP) { + LOG(ERROR, "Cannot save a guest with vNUMA configured"); + rc = ERROR_FAIL; + goto out; + } + dss->guest_evtchn.port = -1; dss->guest_evtchn_lockfd = -1; dss->guest_responded = 0;