From mboxrd@z Thu Jan 1 00:00:00 1970 From: "W. Michael Petullo" Subject: Using "xl create" without domain config file Date: Wed, 30 May 2012 23:50:41 -0500 Message-ID: <20120531045040.GA16124@imp.flyn.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="k+w/mQv8wyuph6w0" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I found it useful to use xm without a domain configuration file: xm create /dev/null kernel=... The xl command does not support this. See a previous thread I started: http://lists.xen.org/archives/html/xen-devel/2011-08/msg00330.html I just found the time to modify xl so that it works without a domain configuration file. For example: xl create kernel=\"...\" ... Would it be possible to add this feature? The xl command already supports augmenting a domain configuration file with additional information from the command line. My changes just modify xl so that the entire configuration may be specified on the command line. To test this patch, run: 1. xl create -c /path/to/config 2. xl create -c /path/to/config someAdditionalDomainParam=\"value\" 3. xl create -c kernel=\"/path/to/kernel\" The third test covers the new case. -- Mike :wq --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="xen-4.1.2-xl-command-line-domain-def.patch" diff -u --recursive --new-file xen-4.1.2-vanilla/tools/libxl/xl_cmdimpl.c xen-4.1.2/tools/libxl/xl_cmdimpl.c --- xen-4.1.2-vanilla/tools/libxl/xl_cmdimpl.c 2011-10-20 12:05:43.000000000 -0500 +++ xen-4.1.2/tools/libxl/xl_cmdimpl.c 2012-05-30 23:37:51.261948881 -0500 @@ -1442,30 +1442,32 @@ &config_data, &config_len); if (ret) { fprintf(stderr, "Failed to read config file: %s: %s\n", config_file, strerror(errno)); return ERROR_FAIL; } - if (!restore_file && extra_config && strlen(extra_config)) { - if (config_len > INT_MAX - (strlen(extra_config) + 2 + 1)) { - fprintf(stderr, "Failed to attach extra configration\n"); - return ERROR_FAIL; - } - /* allocate space for the extra config plus two EOLs plus \0 */ - config_data = realloc(config_data, config_len - + strlen(extra_config) + 2 + 1); - if (!config_data) { - fprintf(stderr, "Failed to realloc config_data\n"); - return ERROR_FAIL; - } - config_len += sprintf(config_data + config_len, "\n%s\n", - extra_config); - } } else { - if (!config_data) { - fprintf(stderr, "Config file not specified and" + if (!config_data && !extra_config) { + fprintf(stderr, "Domain config file not specified," + " none on command line, and" " none in save file\n"); return ERROR_INVAL; } config_file = ""; } + if (!restore_file && extra_config && strlen(extra_config)) { + if (config_len > INT_MAX - (strlen(extra_config) + 2 + 1)) { + fprintf(stderr, "Failed to attach extra configration\n"); + return ERROR_FAIL; + } + /* allocate space for the extra config plus two EOLs plus \0 */ + config_data = realloc(config_data, config_len + + strlen(extra_config) + 2 + 1); + if (!config_data) { + fprintf(stderr, "Failed to realloc config_data\n"); + return ERROR_FAIL; + } + config_len += sprintf(config_data + config_len, "\n%s\n", + extra_config); + } + if (!dom_info->quiet) printf("Parsing config file %s\n", config_file); --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --k+w/mQv8wyuph6w0--