Mailing List Archive

[xen-unstable] xl: Allow use of /dev/null with xl create to enable command-line definition
# HG changeset patch
# User W. Michael Petullo <mike@flyn.org>
# Date 1341413175 -3600
# Node ID 328f466f9ee6b8748c8af50090bb7ed12bf83ca5
# Parent bb250383a4f57c4cd8a0b16bae8cacc686c16825
xl: Allow use of /dev/null with xl create to enable command-line definition

xm allows specifying /dev/null as the domain configuration argument to its
create option; add same functionality to xl. xl treats the configuration
argument /dev/null as a special case. This allows specifying an entire
domain configuration on the command line.

Signed-off-by: W. Michael Petullo <mike@flyn.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- ported to xen-unstable from 4.1 ]
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r bb250383a4f5 -r 328f466f9ee6 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Wed Jul 04 15:46:14 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c Wed Jul 04 15:46:15 2012 +0100
@@ -1697,10 +1697,15 @@ static int create_domain(struct domain_c

if (config_file) {
free(config_data); config_data = 0;
- ret = libxl_read_file_contents(ctx, config_file,
- &config_data, &config_len);
- if (ret) { fprintf(stderr, "Failed to read config file: %s: %s\n",
- config_file, strerror(errno)); return ERROR_FAIL; }
+ /* /dev/null represents special case (read config. from command line) */
+ if (!strcmp(config_file, "/dev/null")) {
+ config_len = 0;
+ } else {
+ ret = libxl_read_file_contents(ctx, config_file,
+ &config_data, &config_len);
+ if (ret) { fprintf(stderr, "Failed to read config file: %s: %s\n",
+ config_file, strerror(errno)); return ERROR_FAIL; }
+ }
if (!restoring && extra_config && strlen(extra_config)) {
if (config_len > INT_MAX - (strlen(extra_config) + 2 + 1)) {
fprintf(stderr, "Failed to attach extra configration\n");

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog