On Wed, May 16, 2012 at 10:21 PM, Nishanth Aravamudan
<n...@linux.vnet.ibm.com> wrote:
> When trying to run a simple job with the new boottool, I get:
>
>  Traceback (most recent call last):
>    File "/usr/local/autotest/job.py", line 1082, in _run_step_fn
>      exec('__ret = %s(*__args, **__dargs)' % fn, local_vars, local_vars)
>    File "<string>", line 1, in <module>
>    File "/usr/local/autotest/control.autoserv", line 16, in boot_kernel
>      host.cleanup_kernels()
>    File "/usr/local/autotest/shared/hosts/base_classes.py", line 656, in 
> cleanup_kernels
>      boot_info = self.bootloader.get_entries()
>    File "/usr/local/autotest/tools/boottool", line 998, in get_entries
>      entries[entry["index"]] = entry
>  KeyError: 'index'
>
> This is because boottool::get_entries() does:
>
>  raw = self.get_info()
>  ...
>  for entry_str in raw.split("\nindex"):
>
> Which doesn't split off the first entry if the raw string starts off with
> "index". This then results in "indexindex 0" being the first string, causing
> the parse error above.
>
> If I change that split to be regex based off starting with index, I get
> further, but then still error out:
>
>  Traceback (most recent call last):
>    File "/usr/local/autotest/job.py", line 1082, in _run_step_fn
>      exec('__ret = %s(*__args, **__dargs)' % fn, local_vars, local_vars)
>    File "<string>", line 1, in <module>
>    File "/usr/local/autotest/control.autoserv", line 16, in boot_kernel
>      host.cleanup_kernels()
>    File "/usr/local/autotest/shared/hosts/base_classes.py", line 658, in 
> cleanup_kernels
>      for boot in boot_info.itervalues()]
>  KeyError: 'kernel'
>
> This is because my grubby --info outputs:
>
> index=1
> non linux entry
> ...
> index=4
> non linux entry
> index=5
> non linux entry
>
> And boottool seems to assume that all entries are valid.
>
> I think it is appropriate to skip these entries explicitly.

Seems like we didn't take into account that 'non linux' entries can be
produced by grubby.

Your patch looks reasonable. I will make some further test with VMs to
double check, but I believe this is good to go.

> Signed-off-by: Nishanth Aravamudan <n...@us.ibm.com>
>
> diff --git a/client/tools/boottool b/client/tools/boottool
> index 7cfc935..78e71b4 100755
> --- a/client/tools/boottool
> +++ b/client/tools/boottool
> @@ -986,11 +986,13 @@ class Grubby(object):
>         raw = self.get_info()
>
>         entries = {}
> -        for entry_str in raw.split("\nindex"):
> +        for entry_str in re.split("^index", raw):
>             if len(entry_str.strip()) == 0:
>                 continue
>             if entry_str.startswith('boot='):
>                 continue
> +            if 'non linux entry' in entry_str:
> +                continue
>             entry = parse_entry("index" + entry_str)
>             entries[entry["index"]] = entry
>
> --
> Nishanth Aravamudan <n...@us.ibm.com>
> IBM Linux Technology Center
>
> _______________________________________________
> Autotest mailing list
> Autotest@test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest



-- 
Lucas
_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to