libxl: fix libxl_set_memory_target
authorWei Liu <wei.liu2@citrix.com>
Thu, 29 Dec 2016 16:36:31 +0000 (16:36 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 3 Jan 2017 11:49:52 +0000 (11:49 +0000)
Commit 26dbc93a ("libxl: Remove pointless hypercall from
libxl_set_memory_target") removed the call to xc_domain_getinfolist, but
it failed to notice that "info" was actually needed later.

Put that back. While at it, make the code conform to coding style
requirement.

Reported-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
tools/libxl/libxl.c

index 6fd4fe18970ee0d21db2e1aac1eda6610e14a1c8..2f83731a8b8f575166a7df7846bde31fe91e0730 100644 (file)
@@ -4308,6 +4308,13 @@ retry_transaction:
     libxl__xs_printf(gc, t, GCSPRINTF("%s/memory/target", dompath),
                      "%"PRIu64, new_target_memkb);
 
+    r = xc_domain_getinfolist(ctx->xch, domid, 1, &info);
+    if (r != 1 || info.domain != domid) {
+        abort_transaction = 1;
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
     libxl_dominfo_init(&ptr);
     xcinfo2xlinfo(ctx, &info, &ptr);
     uuid = libxl__uuid2string(gc, ptr.uuid);