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

Re: [PATCH v20210111 34/39] tools: adjust libxl_domain_suspend to receive a struct props


  • To: Olaf Hering <olaf@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Christian Lindig <christian.lindig@xxxxxxxxxx>
  • Date: Tue, 12 Jan 2021 09:17:26 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0ilOrODlSRn8qe2BJ4bDsOnWpXL19hvG+wiVa6NULLE=; b=LRMySDGgPEOy2YkztZK04pxh0EfpyZDUoKTPu4kfvt+dieKxoGOm3KBU2lXyU77UNbVs8f9sWOD8XVSf874K0y3ExAWxFrxEa9aV3HjGQmXW9PwsT26Jpx3I/haID+Uy8OtXgqNrwF5oY3PtMTJa0VcxLtwSUBiRzLiogTgeMs9Yq3OovFXTA0Epi8MgSx9fVbzMHL0E3TSijFzgJt0/GW0jInUv4lx04BRHpCNKe4yt1WD+Utt5Qvp2XPBDQt5kIJW2vGs2bkEAcYNYfxquDaDfEPnGRuwhulKE1EJ6DFNba3b/xZ/Px684M119XVfvhpvnVcD8mBFp73t64z0HCA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kQ7CXDMufYaXmwDJo65mryviYxUhIUmipbm+/8zdSl2jNKlz/35w4ym65u03XdQ3V20bcKQBuzUoEKyDa7d2QeX2oOj2S3pHWAwob4kqy1S85TTd0HODRJWJN/1n6aASQrEkD4J+v7vOCc0XU9BSvtUN+flTBLn5GpXLshH31iB1PkFJ95aqvaRbo3DniUhmFjWlxUmI5v6Fyfc654DThWgEaDhWA3tHTvAMzI91wx/RQx5yGgixaXT2PHqI+IWnwt3jRg9vUMVFHC6dXLJRFx/phhV4eb5d0sB8BrsdPajGtS5WnYwZncm3nWeGKqmhLbAMEVkFDs/8OkvMnqsblg==
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, David Scott <dave@xxxxxxxxxx>
  • Delivery-date: Tue, 12 Jan 2021 09:17:51 +0000
  • Ironport-sdr: 0szDs+QY9sfhkyoFWYk01YUHy3eFSUATouAqYkmgOD44G5DOQAk8FNSH/2qK9SWOzC+Y4fkKNN zU+qXXHf8LPHW8nEYJTXeeuQbWDHDCmAaqq/t/obFfL1FAjyR809kgWYHy7nvRhliLAi0xGM3m HJwQrzaSZuT+jhUgRHXP/n0yuSfaKZN77LbTlOrwRVK/oqlNmekG05rXu9yR1Y71rjbkiDj295 3Rx9cHn9T/gjqfq4xCWlJKet9oR5uCRNYwllijKDaII/EV16TQDEjXiJR+kLl6ufZSBIRAniDz fsU=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHW6EE9ZXoBywRVqUWT1eISSICrC6ojtq6M
  • Thread-topic: [PATCH v20210111 34/39] tools: adjust libxl_domain_suspend to receive a struct props

> Upcoming changes will pass more knobs down to xc_domain_save.
> Adjust the libxl_domain_suspend API to allow easy adding of additional knobs.

Acked-by: Christian Lindig <christian.lindig@xxxxxxxxxx>

________________________________________
From: Olaf Hering <olaf@xxxxxxxxx>
Sent: 11 January 2021 17:42
To: xen-devel@xxxxxxxxxxxxxxxxxxxx
Cc: Olaf Hering; Ian Jackson; Wei Liu; Anthony Perard; Christian Lindig; David 
Scott
Subject: [PATCH v20210111 34/39] tools: adjust libxl_domain_suspend to receive 
a struct props

Upcoming changes will pass more knobs down to xc_domain_save.
Adjust the libxl_domain_suspend API to allow easy adding of additional knobs.

No change in behavior intented.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
---
 tools/include/libxl.h                | 26 +++++++++++++++++++++++---
 tools/libs/light/libxl_domain.c      |  7 ++++---
 tools/ocaml/libs/xl/xenlight_stubs.c |  3 ++-
 tools/xl/xl_migrate.c                |  9 ++++++---
 tools/xl/xl_saverestore.c            |  3 ++-
 5 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 6546dcd819..94b8f1095f 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -1667,12 +1667,32 @@ static inline int 
libxl_retrieve_domain_configuration_0x041200(
     libxl_retrieve_domain_configuration_0x041200
 #endif

+/*
+ * LIBXL_HAVE_DOMAIN_SUSPEND_PROPS indicates that the
+ * libxl_domain_suspend_props() function takes a props struct.
+ */
+#define LIBXL_HAVE_DOMAIN_SUSPEND_PROPS 1
+
+typedef struct {
+    uint32_t flags; /* LIBXL_SUSPEND_* */
+} libxl_domain_suspend_props;
+#define LIBXL_SUSPEND_DEBUG 1
+#define LIBXL_SUSPEND_LIVE 2
+
 int libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, int fd,
-                         int flags, /* LIBXL_SUSPEND_* */
+                         libxl_domain_suspend_props *props,
                          const libxl_asyncop_how *ao_how)
                          LIBXL_EXTERNAL_CALLERS_ONLY;
-#define LIBXL_SUSPEND_DEBUG 1
-#define LIBXL_SUSPEND_LIVE 2
+#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION < 0x041500
+static inline int libxl_domain_suspend_0x041400(libxl_ctx *ctx, uint32_t domid,
+                         int fd, int flags, /* LIBXL_SUSPEND_* */
+                         const libxl_asyncop_how *ao_how)
+{
+    libxl_domain_suspend_props props = { .flags = flags, };
+    return libxl_domain_suspend(ctx, domid, fd, &props, ao_how);
+}
+#define libxl_domain_suspend libxl_domain_suspend_0x041400
+#endif

 /*
  * Only suspend domain, do not save its state to file, do not destroy it.
diff --git a/tools/libs/light/libxl_domain.c b/tools/libs/light/libxl_domain.c
index 5d4ec90711..45e0c57c3a 100644
--- a/tools/libs/light/libxl_domain.c
+++ b/tools/libs/light/libxl_domain.c
@@ -505,7 +505,8 @@ static void domain_suspend_cb(libxl__egc *egc,

 }

-int libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, int fd, int flags,
+int libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, int fd,
+                         libxl_domain_suspend_props *props,
                          const libxl_asyncop_how *ao_how)
 {
     AO_CREATE(ctx, domid, ao_how);
@@ -526,8 +527,8 @@ int libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, 
int fd, int flags,
     dss->domid = domid;
     dss->fd = fd;
     dss->type = type;
-    dss->live = flags & LIBXL_SUSPEND_LIVE;
-    dss->debug = flags & LIBXL_SUSPEND_DEBUG;
+    dss->live = props->flags & LIBXL_SUSPEND_LIVE;
+    dss->debug = props->flags & LIBXL_SUSPEND_DEBUG;
     dss->checkpointed_stream = LIBXL_CHECKPOINTED_STREAM_NONE;

     rc = libxl__fd_flags_modify_save(gc, dss->fd,
diff --git a/tools/ocaml/libs/xl/xenlight_stubs.c 
b/tools/ocaml/libs/xl/xenlight_stubs.c
index 352a00134d..eaf7bce35a 100644
--- a/tools/ocaml/libs/xl/xenlight_stubs.c
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c
@@ -614,10 +614,11 @@ value stub_libxl_domain_suspend(value ctx, value domid, 
value fd, value async, v
        int ret;
        uint32_t c_domid = Int_val(domid);
        int c_fd = Int_val(fd);
+    libxl_domain_suspend_props props = {};
        libxl_asyncop_how *ao_how = aohow_val(async);

        caml_enter_blocking_section();
-       ret = libxl_domain_suspend(CTX, c_domid, c_fd, 0, ao_how);
+       ret = libxl_domain_suspend(CTX, c_domid, c_fd, &props, ao_how);
        caml_leave_blocking_section();

        free(ao_how);
diff --git a/tools/xl/xl_migrate.c b/tools/xl/xl_migrate.c
index 856a6e2be1..fc9f69bf06 100644
--- a/tools/xl/xl_migrate.c
+++ b/tools/xl/xl_migrate.c
@@ -188,7 +188,10 @@ static void migrate_domain(uint32_t domid, int 
preserve_domid,
     char *away_domname;
     char rc_buf;
     uint8_t *config_data;
-    int config_len, flags = LIBXL_SUSPEND_LIVE;
+    int config_len;
+    libxl_domain_suspend_props props = {
+        .flags = LIBXL_SUSPEND_LIVE,
+        };
     unsigned xtl_flags = XTL_STDIOSTREAM_HIDE_PROGRESS;

     save_domain_core_begin(domid, preserve_domid, override_config_file,
@@ -210,8 +213,8 @@ static void migrate_domain(uint32_t domid, int 
preserve_domid,
     xtl_stdiostream_adjust_flags(logger, xtl_flags, 0);

     if (debug)
-        flags |= LIBXL_SUSPEND_DEBUG;
-    rc = libxl_domain_suspend(ctx, domid, send_fd, flags, NULL);
+        props.flags |= LIBXL_SUSPEND_DEBUG;
+    rc = libxl_domain_suspend(ctx, domid, send_fd, &props, NULL);
     if (rc) {
         fprintf(stderr, "migration sender: libxl_domain_suspend failed"
                 " (rc=%d)\n", rc);
diff --git a/tools/xl/xl_saverestore.c b/tools/xl/xl_saverestore.c
index 953d791d1a..476d4d9a6a 100644
--- a/tools/xl/xl_saverestore.c
+++ b/tools/xl/xl_saverestore.c
@@ -130,6 +130,7 @@ static int save_domain(uint32_t domid, int preserve_domid,
     int fd;
     uint8_t *config_data;
     int config_len;
+    libxl_domain_suspend_props props = {};

     save_domain_core_begin(domid, preserve_domid, override_config_file,
                            &config_data, &config_len);
@@ -146,7 +147,7 @@ static int save_domain(uint32_t domid, int preserve_domid,

     save_domain_core_writeconfig(fd, filename, config_data, config_len);

-    int rc = libxl_domain_suspend(ctx, domid, fd, 0, NULL);
+    int rc = libxl_domain_suspend(ctx, domid, fd, &props, NULL);
     close(fd);

     if (rc < 0) {



 


Rackspace

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