]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
libxl: don't set gnttab limits in soft reset case
authorJuergen Gross <jgross@suse.com>
Thu, 17 Jan 2019 16:40:59 +0000 (16:40 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Tue, 5 Feb 2019 11:42:34 +0000 (11:42 +0000)
In case of soft reset the gnttab limit setting will fail, so omit it.
Setting of max vcpu count is pointless in this case, too, so we can
drop that as well.

Without this patch soft reset will fail with:

libxl: error: libxl_dom.c:363:libxl__build_pre: Couldn't set grant table limits

Reported-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Tested-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
tools/libxl/libxl_create.c
tools/libxl/libxl_dom.c
tools/libxl/libxl_internal.h

index b5e27a7766273dae14cf17d3e6b2945b426f5d23..5c9dd4cd21800493bb87052c6db577e930ac3b37 100644 (file)
@@ -442,7 +442,7 @@ int libxl__domain_build(libxl__gc *gc,
     struct timeval start_time;
     int i, ret;
 
-    ret = libxl__build_pre(gc, domid, d_config, state);
+    ret = libxl__build_pre(gc, domid, d_config, state, false);
     if (ret)
         goto out;
 
@@ -1117,7 +1117,8 @@ static void domcreate_bootloader_done(libxl__egc *egc,
         goto out;
     }
 
-    rc = libxl__build_pre(gc, domid, d_config, state);
+    rc = libxl__build_pre(gc, domid, d_config, state,
+                          dcs->domid_soft_reset != INVALID_DOMID);
     if (rc)
         goto out;
 
index f0fd5fd3a3d0600e315262065ae022ee07b2bbe0..13054a32cc0beda4fedb34c8558cfb78611c4c28 100644 (file)
@@ -345,7 +345,8 @@ static void hvm_set_conf_params(xc_interface *handle, uint32_t domid,
 }
 
 int libxl__build_pre(libxl__gc *gc, uint32_t domid,
-              libxl_domain_config *d_config, libxl__domain_build_state *state)
+              libxl_domain_config *d_config, libxl__domain_build_state *state,
+              bool is_reset)
 {
     libxl_domain_build_info *const info = &d_config->b_info;
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -353,15 +354,17 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
     int rc;
     uint64_t size;
 
-    if (xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus) != 0) {
-        LOG(ERROR, "Couldn't set max vcpu count");
-        return ERROR_FAIL;
-    }
+    if (!is_reset) {
+        if (xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus) != 0) {
+            LOG(ERROR, "Couldn't set max vcpu count");
+            return ERROR_FAIL;
+        }
 
-    if (xc_domain_set_gnttab_limits(ctx->xch, domid, info->max_grant_frames,
-                                    info->max_maptrack_frames) != 0) {
-        LOG(ERROR, "Couldn't set grant table limits");
-        return ERROR_FAIL;
+        if (xc_domain_set_gnttab_limits(ctx->xch, domid, info->max_grant_frames,
+                                        info->max_maptrack_frames) != 0) {
+            LOG(ERROR, "Couldn't set grant table limits");
+            return ERROR_FAIL;
+        }
     }
 
     /*
index c5828945891488bfdfa7ff335f7c36069d762c30..ad536b7e89ef1af520fc2dd3384eb4e6d644635d 100644 (file)
@@ -1154,7 +1154,7 @@ typedef struct {
 
 _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid,
               libxl_domain_config * const d_config,
-              libxl__domain_build_state *state);
+              libxl__domain_build_state *state, bool is_reset);
 _hidden int libxl__build_post(libxl__gc *gc, uint32_t domid,
                libxl_domain_build_info *info, libxl__domain_build_state *state,
                char **vms_ents, char **local_ents);