mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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@citrix.com> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
1 parent
cb278ebdb8
commit
0a1eb2b438
4 files changed
+8
-4
No files matched your search
@@ -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.
|
||||
|
||||
@@ -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
|
||||
/*
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||