Merge lp:~nuclearbob/utah/desktop-kernel-detect into lp:utah

Proposed by Max Brustkern
Status: Merged
Merged at revision: 742
Proposed branch: lp:~nuclearbob/utah/desktop-kernel-detect
Merge into: lp:utah
Diff against target: 44 lines (+26/-1)
1 file modified
utah/provisioning/provisioning.py (+26/-1)
To merge this branch: bzr merge lp:~nuclearbob/utah/desktop-kernel-detect
Reviewer Review Type Date Requested Status
Joe Talbott (community) Approve
Review via email: mp+134188@code.launchpad.net

Description of the change

This branch checks the bootloader configuration files on a desktop image and chooses the kernel that is most referenced by those (but not the memtest kernel.) This should fix the raring-desktop-amd64 image problems.

To post a comment you must log in.
Revision history for this message
Joe Talbott (joetalbott) wrote :

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'utah/provisioning/provisioning.py'
--- utah/provisioning/provisioning.py 2012-10-25 20:07:44 +0000
+++ utah/provisioning/provisioning.py 2012-11-13 20:12:25 +0000
@@ -821,7 +821,31 @@
821 kernelpath = 'linux'821 kernelpath = 'linux'
822 elif self.installtype == 'desktop':822 elif self.installtype == 'desktop':
823 self.logger.debug('Desktop image detected')823 self.logger.debug('Desktop image detected')
824 kernelpath = './casper/vmlinuz'824 # Setup the old default kernel path in case none are found
825 kernels = {'casper/vmlinuz':0}
826 # Scan bootloader config files to find kernel images
827 cfgfiles = ['isolinux/txt.cfg', 'isolinux/rqtxt.cfg',
828 'boot/grub/grub.cfg', 'boot/grub/loopback.cfg']
829 for cfgfile in cfgfiles:
830 if cfgfile in self.image.listfiles(returnlist=True):
831 stdout = self.image.dump(cfgfile).communicate()[0]
832 for line in stdout.splitlines():
833 if 'kernel' in line or 'linux' in line:
834 newkernel = line.split()[1].strip('./')
835 if 'mt86plus' in newkernel:
836 self.logger.debug('Rejecting '
837 'memtest kernel')
838 else:
839 self.logger.debug('Found kernel: '
840 + newkernel)
841 if newkernel in kernels:
842 kernels[newkernel] += 1
843 else:
844 kernels[newkernel] = 1
845 # Now we have a list of kernel paths and the number of times
846 # each once occurs. We'll use the one that occurs most.
847 kernelpath = sorted([[kernels[kernel], kernel]
848 for kernel in kernels], reverse=True)[0][1]
825 kernel = os.path.join(tmpdir, 'kernel')849 kernel = os.path.join(tmpdir, 'kernel')
826 self.image.extract(kernelpath, outfile=kernel)850 self.image.extract(kernelpath, outfile=kernel)
827 else:851 else:
@@ -847,6 +871,7 @@
847 initrdpath = 'initrd.gz'871 initrdpath = 'initrd.gz'
848 elif self.installtype == 'desktop':872 elif self.installtype == 'desktop':
849 self.logger.debug('Desktop image detected')873 self.logger.debug('Desktop image detected')
874 # TODO: scan for this like desktop
850 initrdpath = './casper/initrd.lz'875 initrdpath = './casper/initrd.lz'
851 initrd = os.path.join(tmpdir, os.path.basename(initrdpath))876 initrd = os.path.join(tmpdir, os.path.basename(initrdpath))
852 self.image.extract(initrdpath, outfile=initrd)877 self.image.extract(initrdpath, outfile=initrd)

Subscribers

People subscribed via source and target branches