xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pygrub: always append --args
@ 2012-09-06 15:29 Olaf Hering
  2012-09-07  8:32 ` Ian Campbell
  2012-09-25 10:09 ` Ian Campbell
  0 siblings, 2 replies; 5+ messages in thread
From: Olaf Hering @ 2012-09-06 15:29 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1346945306 -7200
# Node ID 8a2eef481d3ab3ca5692dd0083c95cf314fe1da3
# Parent  19d367bf07b7687b831c212a57a70e73ea14d3b7
pygrub: always append --args

If a bootloader entry in menu.lst has no additional kernel command line
options listed and the domU.cfg has 'bootargs="--args=something"' the
additional arguments from the config file are not passed to the kernel.
The reason for that incorrect behaviour is that run_grub appends arg
only if the parsed config file has arguments listed.

Fix this by appending args from image section and the config file separatly.
To avoid adding to a NoneType initialize grubcfg['args'] to an empty string.
This does not change behaviour but simplifies the code which appends the
string.

Signed-off-by: Olaf Hering <olaf@aepfle.de>

diff -r 19d367bf07b7 -r 8a2eef481d3a tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub
+++ b/tools/pygrub/src/pygrub
@@ -615,13 +615,15 @@ def run_grub(file, entry, fs, arg):
     except IndexError:
         img = g.cf.images[0]
 
-    grubcfg = { "kernel": None, "ramdisk": None, "args": None }
+    grubcfg = { "kernel": None, "ramdisk": None, "args": "" }
 
     grubcfg["kernel"] = img.kernel[1]
     if img.initrd:
         grubcfg["ramdisk"] = img.initrd[1]
     if img.args:
-        grubcfg["args"] = img.args + " " + arg
+        grubcfg["args"] += img.args
+    if arg:
+        grubcfg["args"] += " " + args
 
     return grubcfg

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pygrub: always append --args
  2012-09-06 15:29 [PATCH] pygrub: always append --args Olaf Hering
@ 2012-09-07  8:32 ` Ian Campbell
  2012-09-07  9:14   ` Olaf Hering
  2012-09-25 10:09 ` Ian Campbell
  1 sibling, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2012-09-07  8:32 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel@lists.xen.org

On Thu, 2012-09-06 at 16:29 +0100, Olaf Hering wrote:
> # HG changeset patch
> # User Olaf Hering <olaf@aepfle.de>
> # Date 1346945306 -7200
> # Node ID 8a2eef481d3ab3ca5692dd0083c95cf314fe1da3
> # Parent  19d367bf07b7687b831c212a57a70e73ea14d3b7
> pygrub: always append --args
> 
> If a bootloader entry in menu.lst has no additional kernel command line
> options listed and the domU.cfg has 'bootargs="--args=something"' the
> additional arguments from the config file are not passed to the kernel.
> The reason for that incorrect behaviour is that run_grub appends arg
> only if the parsed config file has arguments listed.
> 
> Fix this by appending args from image section and the config file separatly.
> To avoid adding to a NoneType initialize grubcfg['args'] to an empty string.
> This does not change behaviour but simplifies the code which appends the
> string.
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>

This has to be 4.3 at this point.

> 
> diff -r 19d367bf07b7 -r 8a2eef481d3a tools/pygrub/src/pygrub
> --- a/tools/pygrub/src/pygrub
> +++ b/tools/pygrub/src/pygrub
> @@ -615,13 +615,15 @@ def run_grub(file, entry, fs, arg):
>      except IndexError:
>          img = g.cf.images[0]
>  
> -    grubcfg = { "kernel": None, "ramdisk": None, "args": None }
> +    grubcfg = { "kernel": None, "ramdisk": None, "args": "" }
>  
>      grubcfg["kernel"] = img.kernel[1]
>      if img.initrd:
>          grubcfg["ramdisk"] = img.initrd[1]
>      if img.args:

With the above change isn't this always true?

It probably should have read
	if img.args is not None
in the first place.

> -        grubcfg["args"] = img.args + " " + arg
> +        grubcfg["args"] += img.args
> +    if arg:
> +        grubcfg["args"] += " " + args

>  
>      return grubcfg
>  
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pygrub: always append --args
  2012-09-07  8:32 ` Ian Campbell
@ 2012-09-07  9:14   ` Olaf Hering
  2012-09-07  9:21     ` Ian Campbell
  0 siblings, 1 reply; 5+ messages in thread
From: Olaf Hering @ 2012-09-07  9:14 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel@lists.xen.org

On Fri, Sep 07, Ian Campbell wrote:

> >      except IndexError:
> >          img = g.cf.images[0]
> >  
> > -    grubcfg = { "kernel": None, "ramdisk": None, "args": None }
> > +    grubcfg = { "kernel": None, "ramdisk": None, "args": "" }
> >  
> >      grubcfg["kernel"] = img.kernel[1]
> >      if img.initrd:
> >          grubcfg["ramdisk"] = img.initrd[1]
> >      if img.args:
> 
> With the above change isn't this always true?

img.args comes from img = g.cf.images[sel]?

Olaf

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pygrub: always append --args
  2012-09-07  9:14   ` Olaf Hering
@ 2012-09-07  9:21     ` Ian Campbell
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Campbell @ 2012-09-07  9:21 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel@lists.xen.org

On Fri, 2012-09-07 at 10:14 +0100, Olaf Hering wrote:
> On Fri, Sep 07, Ian Campbell wrote:
> 
> > >      except IndexError:
> > >          img = g.cf.images[0]
> > >  
> > > -    grubcfg = { "kernel": None, "ramdisk": None, "args": None }
> > > +    grubcfg = { "kernel": None, "ramdisk": None, "args": "" }
> > >  
> > >      grubcfg["kernel"] = img.kernel[1]
> > >      if img.initrd:
> > >          grubcfg["ramdisk"] = img.initrd[1]
> > >      if img.args:
> > 
> > With the above change isn't this always true?
> 
> img.args comes from img = g.cf.images[sel]?

Oh sorry, for some reason I did s/grubcfg/img/ in my head in that
assignment.

Ian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pygrub: always append --args
  2012-09-06 15:29 [PATCH] pygrub: always append --args Olaf Hering
  2012-09-07  8:32 ` Ian Campbell
@ 2012-09-25 10:09 ` Ian Campbell
  1 sibling, 0 replies; 5+ messages in thread
From: Ian Campbell @ 2012-09-25 10:09 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel@lists.xen.org

On Thu, 2012-09-06 at 16:29 +0100, Olaf Hering wrote:
> # HG changeset patch
> # User Olaf Hering <olaf@aepfle.de>
> # Date 1346945306 -7200
> # Node ID 8a2eef481d3ab3ca5692dd0083c95cf314fe1da3
> # Parent  19d367bf07b7687b831c212a57a70e73ea14d3b7
> pygrub: always append --args
> 
> If a bootloader entry in menu.lst has no additional kernel command line
> options listed and the domU.cfg has 'bootargs="--args=something"' the
> additional arguments from the config file are not passed to the kernel.
> The reason for that incorrect behaviour is that run_grub appends arg
> only if the parsed config file has arguments listed.
> 
> Fix this by appending args from image section and the config file separatly.
> To avoid adding to a NoneType initialize grubcfg['args'] to an empty string.
> This does not change behaviour but simplifies the code which appends the
> string.
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> 
> diff -r 19d367bf07b7 -r 8a2eef481d3a tools/pygrub/src/pygrub
> --- a/tools/pygrub/src/pygrub
> +++ b/tools/pygrub/src/pygrub
> @@ -615,13 +615,15 @@ def run_grub(file, entry, fs, arg):
>      except IndexError:
>          img = g.cf.images[0]
>  
> -    grubcfg = { "kernel": None, "ramdisk": None, "args": None }
> +    grubcfg = { "kernel": None, "ramdisk": None, "args": "" }
>  
>      grubcfg["kernel"] = img.kernel[1]
>      if img.initrd:
>          grubcfg["ramdisk"] = img.initrd[1]
>      if img.args:
> -        grubcfg["args"] = img.args + " " + arg
> +        grubcfg["args"] += img.args
> +    if arg:
> +        grubcfg["args"] += " " + args

I don't imagine any kernel would care about the potential leading space
here so:

Acked-by: Ian Campbell <ian.campbell@citrix.com>

and applied, thanks.

>  
>      return grubcfg
>  
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-09-25 10:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-06 15:29 [PATCH] pygrub: always append --args Olaf Hering
2012-09-07  8:32 ` Ian Campbell
2012-09-07  9:14   ` Olaf Hering
2012-09-07  9:21     ` Ian Campbell
2012-09-25 10:09 ` Ian Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).