From ecf5a746f16fcbe8bb1e77c8463455d0e6c85e46 Mon Sep 17 00:00:00 2001 From: "W. Michael Petullo" Date: Wed, 4 Jul 2012 15:46:15 +0100 Subject: [PATCH] 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 Acked-by: Ian Campbell [ ijc -- ported to xen-unstable from 4.1 ] Committed-by: Ian Campbell --- tools/libxl/xl_cmdimpl.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 155d1839c7..6fef819a42 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -1697,10 +1697,15 @@ static int create_domain(struct domain_create *dom_info) 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"); -- 2.30.2