The heuristics used to determine which kernel versions are referenced by the bootloader configuration are no longer valid for the newer grubby-based code - now that the entries dict retorns a full kernel path, such as
/boot/vmlinuz-3.3.1-3.fc17.x86_64 We need to use the basename, then strip 'vmlinuz-', rather than just strip 'vmlinuz-' from the resulting string. This bug fixes a condition where the used kernels were being incorrectly determined, hence autotest would go and remove all kernels of a machine. Signed-off-by: Lucas Meneghel Rodrigues <[email protected]> --- client/shared/hosts/base_classes.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/shared/hosts/base_classes.py b/client/shared/hosts/base_classes.py index 0275d8a..12c0181 100644 --- a/client/shared/hosts/base_classes.py +++ b/client/shared/hosts/base_classes.py @@ -652,12 +652,15 @@ class Host(object): @param boot_dir: boot directory path string, default '/boot' """ # find all the vmlinuz images referenced by the bootloader - vmlinuz_prefix = os.path.join(boot_dir, 'vmlinuz-') boot_info = self.bootloader.get_entries() - used_kernver = [boot['kernel'][len('vmlinuz-'):] - for boot in boot_info.itervalues()] + used_kernver = [] + for boot in boot_info.itervalues(): + k = os.path.basename(boot['kernel'])[len('vmlinuz-'):] + if k not in used_kernver: + used_kernver.append(k) # find all the unused vmlinuz images in /boot + vmlinuz_prefix = os.path.join(boot_dir, 'vmlinuz-') all_vmlinuz = self.list_files_glob(vmlinuz_prefix + '*') used_vmlinuz = self.symlink_closure(vmlinuz_prefix + kernver for kernver in used_kernver) -- 1.7.10.1 _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
