Discussion:
[Xen-changelog] [xen staging] tools/helpers: make gen_stub_json_config accept an UUID argument
p***@xen.org
2018-11-20 14:55:15 UTC
Permalink
commit 0a1eb2b43879787257e2a56ebb7f614f0f32ac70
Author: Wei Liu <***@citrix.com>
AuthorDate: Wed Nov 14 18:17:31 2018 +0000
Commit: Wei Liu <***@citrix.com>
CommitDate: Tue Nov 20 14:43:39 2018 +0000

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 <***@citrix.com>
Acked-by: Andrew Cooper <***@citrix.com>
Acked-by: Ian Jackson <***@eu.citrix.com>
---
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;

--
generated by git-patchbot for /home/xen/git/xen.git#staging

Loading...