[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH LIBVIRT] libxl: Support cmdline= in xl config files



I went to ping this but noticed that I had sent it to "jimfehlig" (i.e. no
domain), so no wonder there was no reply!

To: line fixed here, let me know if you would prefer a resend.

Ian.

On Wed, 2015-12-16 at 12:09 +0000, Ian Campbell wrote:
> ... and consolidate the cmdline/extra/root parsing to facilitate doing
> so.
> 
> The logic is the same as xl's parse_cmdline from the current xen.git master
> branch (e6f0e099d2c17de47fd86e817b1998db903cab61), except I was unable
> to figure out how/where to route the warning about ignoring
> root+extra if cmdline was specified.
> 
> Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> ---
> Âsrc/xenconfig/xen_xl.c | 62 ++++++++++++++++++++++++++++++------------
> --------
> Â1 file changed, 37 insertions(+), 25 deletions(-)
> 
> diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
> index 91cdff6..ba8b938 100644
> --- a/src/xenconfig/xen_xl.c
> +++ b/src/xenconfig/xen_xl.c
> @@ -58,11 +58,45 @@ extern int xlu_disk_parse(XLU_Config *cfg,
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂlibxl_device_disk *disk);
> Â#endif
> Â
> +static int xenParseCmdline(virConfPtr conf, char **r_cmdline)
> +{
> +ÂÂÂÂchar *cmdline = NULL;
> +ÂÂÂÂconst char *root = NULL, *extra = NULL, *buf = NULL;
> +
> +ÂÂÂÂif (xenConfigGetString(conf, "cmdline", &buf, NULL) < 0)
> +ÂÂÂÂÂÂÂÂreturn -1;
> +
> +ÂÂÂÂif (xenConfigGetString(conf, "root", &root, NULL) < 0)
> +ÂÂÂÂÂÂÂÂreturn -1;
> +
> +ÂÂÂÂif (xenConfigGetString(conf, "extra", &extra, NULL) < 0)
> +ÂÂÂÂÂÂÂÂreturn -1;
> +
> +ÂÂÂÂif (buf) {
> +ÂÂÂÂÂÂÂÂif (VIR_STRDUP(cmdline, buf) < 0)
> +ÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
> +ÂÂÂÂÂÂÂÂ/* root or extra are ignored in this case. */
> +ÂÂÂÂ} else {
> +ÂÂÂÂÂÂÂÂif (root && extra) {
> +ÂÂÂÂÂÂÂÂÂÂÂÂif (virAsprintf(&cmdline, "root=%s %s", root, extra) < 0)
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
> +ÂÂÂÂÂÂÂÂ} else if (root) {
> +ÂÂÂÂÂÂÂÂÂÂÂÂif (virAsprintf(&cmdline, "root=%s", root) < 0)
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
> +ÂÂÂÂÂÂÂÂ} else if (extra) {
> +ÂÂÂÂÂÂÂÂÂÂÂÂif (VIR_STRDUP(cmdline, extra) < 0)
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
> +ÂÂÂÂÂÂÂÂ}
> +ÂÂÂÂ}
> +
> +ÂÂÂÂ*r_cmdline = cmdline;
> +ÂÂÂÂreturn 0;
> +}
> +
> Âstatic int
> ÂxenParseXLOS(virConfPtr conf, virDomainDefPtr def, virCapsPtr caps)
> Â{
> ÂÂÂÂÂsize_t i;
> -ÂÂÂÂconst char *extra, *root;
> Â
> ÂÂÂÂÂif (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
> ÂÂÂÂÂÂÂÂÂconst char *boot;
> @@ -84,19 +118,8 @@ xenParseXLOS(virConfPtr conf, virDomainDefPtr def,
> virCapsPtr caps)
> ÂÂÂÂÂÂÂÂÂif (xenConfigCopyStringOpt(conf, "ramdisk", &def->os.initrd) <
> 0)
> ÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
> Â
> -ÂÂÂÂÂÂÂÂif (xenConfigGetString(conf, "extra", &extra, NULL) < 0)
> -ÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
> -
> -ÂÂÂÂÂÂÂÂif (xenConfigGetString(conf, "root", &root, NULL) < 0)
> +ÂÂÂÂÂÂÂÂif (xenParseCmdline(conf, &def->os.cmdline) < 0)
> ÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
> -
> -ÂÂÂÂÂÂÂÂif (root) {
> -ÂÂÂÂÂÂÂÂÂÂÂÂif (virAsprintf(&def->os.cmdline, "root=%s %s", root, extra)
> < 0)
> -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
> -ÂÂÂÂÂÂÂÂ} else {
> -ÂÂÂÂÂÂÂÂÂÂÂÂif (VIR_STRDUP(def->os.cmdline, extra) < 0)
> -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
> -ÂÂÂÂÂÂÂÂ}
> Â#endif
> Â
> ÂÂÂÂÂÂÂÂÂif (xenConfigGetString(conf, "boot", &boot, "c") < 0)
> @@ -132,19 +155,8 @@ xenParseXLOS(virConfPtr conf, virDomainDefPtr def,
> virCapsPtr caps)
> ÂÂÂÂÂÂÂÂÂif (xenConfigCopyStringOpt(conf, "ramdisk", &def->os.initrd) <
> 0)
> ÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
> Â
> -ÂÂÂÂÂÂÂÂif (xenConfigGetString(conf, "extra", &extra, NULL) < 0)
> -ÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
> -
> -ÂÂÂÂÂÂÂÂif (xenConfigGetString(conf, "root", &root, NULL) < 0)
> +ÂÂÂÂÂÂÂÂif (xenParseCmdline(conf, &def->os.cmdline) < 0)
> ÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
> -
> -ÂÂÂÂÂÂÂÂif (root) {
> -ÂÂÂÂÂÂÂÂÂÂÂÂif (virAsprintf(&def->os.cmdline, "root=%s %s", root, extra)
> < 0)
> -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
> -ÂÂÂÂÂÂÂÂ} else {
> -ÂÂÂÂÂÂÂÂÂÂÂÂif (VIR_STRDUP(def->os.cmdline, extra) < 0)
> -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
> -ÂÂÂÂÂÂÂÂ}
> ÂÂÂÂÂ}
> Â
> ÂÂÂÂÂreturn 0;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.