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

[Xen-devel] [PATCH 2/3] tools/helpers: make gen_stub_json_config accept an UUID argument



If that's set, the stub is going to contain that UUID.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/helpers/init-dom-json.c        | 5 ++++-
 tools/helpers/init-dom-json.h        | 3 ++-
 tools/helpers/init-xenstore-domain.c | 2 +-
 tools/helpers/xen-init-dom0.c        | 2 +-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/helpers/init-dom-json.c b/tools/helpers/init-dom-json.c
index 704e7cb4f0..9514b3ceb6 100644
--- a/tools/helpers/init-dom-json.c
+++ b/tools/helpers/init-dom-json.c
@@ -7,7 +7,7 @@
 #include <xenctrl.h>
 #include <libxl.h>
 
-int gen_stub_json_config(uint32_t domid)
+int gen_stub_json_config(uint32_t domid, libxl_uuid *uuid)
 {
     int rc = 1;
     xentoollog_logger_stdiostream *logger;
@@ -40,6 +40,9 @@ int gen_stub_json_config(uint32_t domid)
     libxl_domain_build_info_init_type(&dom_config.b_info,
                                       dom_config.c_info.type);
 
+    if (uuid && !libxl_uuid_is_nil(uuid))
+        libxl_uuid_copy(ctx, &dom_config.c_info.uuid, uuid);
+
     json = libxl_domain_config_to_json(ctx, &dom_config);
     /* libxl-json format requires the string ends with '\0'. Code
      * snippet taken from libxl.
diff --git a/tools/helpers/init-dom-json.h b/tools/helpers/init-dom-json.h
index 58c85df157..5be88f6638 100644
--- a/tools/helpers/init-dom-json.h
+++ b/tools/helpers/init-dom-json.h
@@ -1,10 +1,11 @@
 #ifndef __INIT_DOM_JSON_H
 #define __INIT_DOM_JSON_H
 
+#include <libxl.h>
 /*
  * Generate a stub JSON config for a domain with the given domid.
  */
-int gen_stub_json_config(uint32_t domid);
+int gen_stub_json_config(uint32_t domid, libxl_uuid *uuid);
 
 #endif
 /*
diff --git a/tools/helpers/init-xenstore-domain.c 
b/tools/helpers/init-xenstore-domain.c
index 3236d14416..adb8408b63 100644
--- a/tools/helpers/init-xenstore-domain.c
+++ b/tools/helpers/init-xenstore-domain.c
@@ -382,7 +382,7 @@ int main(int argc, char** argv)
     if ( rv )
         return 1;
 
-    rv = gen_stub_json_config(domid);
+    rv = gen_stub_json_config(domid, NULL);
     if ( rv )
         return 3;
 
diff --git a/tools/helpers/xen-init-dom0.c b/tools/helpers/xen-init-dom0.c
index 9ab8468bdb..09bc0027f9 100644
--- a/tools/helpers/xen-init-dom0.c
+++ b/tools/helpers/xen-init-dom0.c
@@ -31,7 +31,7 @@ int main(int argc, char **argv)
         goto out;
     }
 
-    rc = gen_stub_json_config(0);
+    rc = gen_stub_json_config(0, NULL);
     if (rc)
         goto out;
 
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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