Merge lp:~ltrager/maas-images/centos7_uefi into lp:maas-images

Proposed by Lee Trager
Status: Merged
Merged at revision: 360
Proposed branch: lp:~ltrager/maas-images/centos7_uefi
Merge into: lp:maas-images
Diff against target: 107 lines (+10/-43)
3 files modified
conf/centos.yaml (+2/-0)
curtin/centos7/curtin-hooks.py (+7/-43)
meph2/ubuntu_info.py (+1/-0)
To merge this branch: bzr merge lp:~ltrager/maas-images/centos7_uefi
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Approve
Review via email: mp+323099@code.launchpad.net

Commit message

Fix CentOS 7 Curtin hook when deploying to a UEFI AMD64 system

Description of the change

To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote :

lgtm! Tested, works just fine!

review: Approve
Revision history for this message
Andres Rodriguez (andreserl) wrote :

Actually, questions inline:

review: Needs Information
Revision history for this message
Andres Rodriguez (andreserl) wrote :

question was answered on IRC, so i'm good with his.

12:47 < blake_r> roaksoax: you don't need that stuff
12:47 < roaksoax> blake_r: why not ?
12:47 < blake_r> roaksoax: because its now mounted by default
12:47 < roaksoax> ok, you maen grub/curtin/the os handles that ?
12:47 < blake_r> yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'conf/centos.yaml'
--- conf/centos.yaml 2016-09-17 00:28:38 +0000
+++ conf/centos.yaml 2017-04-25 08:12:18 +0000
@@ -20,6 +20,8 @@
20 # EPEL7-testing20 # EPEL7-testing
21 - https://kojipkgs.fedoraproject.org/packages/python-oauth/1.0.1/10.el7/noarch/python-oauth-1.0.1-10.el7.noarch.rpm21 - https://kojipkgs.fedoraproject.org/packages/python-oauth/1.0.1/10.el7/noarch/python-oauth-1.0.1-10.el7.noarch.rpm
22 - linux-firmware22 - linux-firmware
23 - grub2-efi-modules
24 - efibootmgr
23 centos66:25 centos66:
24 version: 6.626 version: 6.6
25 release_title: "CentOS 6.6"27 release_title: "CentOS 6.6"
2628
=== modified file 'curtin/centos7/curtin-hooks.py'
--- curtin/centos7/curtin-hooks.py 2016-05-11 18:47:46 +0000
+++ curtin/centos7/curtin-hooks.py 2017-04-25 08:12:18 +0000
@@ -9,7 +9,6 @@
9import codecs9import codecs
10import os10import os
11import sys11import sys
12import shutil
1312
14from curtin import (13from curtin import (
15 block,14 block,
@@ -72,14 +71,6 @@
72 return blocks[rootdev]71 return blocks[rootdev]
7372
7473
75def get_uefi_partition():
76 """Return the UEFI partition."""
77 for _, value in block._lsblock().items():
78 if value['LABEL'] == 'uefi-boot':
79 return value
80 return None
81
82
83def read_file(path):74def read_file(path):
84 """Returns content of a file."""75 """Returns content of a file."""
85 with codecs.open(path, encoding='utf-8') as stream:76 with codecs.open(path, encoding='utf-8') as stream:
@@ -152,36 +143,13 @@
152 in_chroot(['grub2-mkconfig', '-o', '/boot/grub2/grub.cfg'])143 in_chroot(['grub2-mkconfig', '-o', '/boot/grub2/grub.cfg'])
153144
154145
155def install_efi(target, uefi_path):146def install_uefi(target):
156 """Install the EFI data from /boot into efi partition."""147 """Install the EFI data from /boot into efi partition."""
157 # Create temp mount point for uefi partition.148 with util.RunInChroot(target) as in_chroot:
158 tmp_efi = os.path.join(target, 'boot', 'efi_part')149 in_chroot([
159 os.mkdir(tmp_efi)150 'grub2-install', '--target=x86_64-efi',
160 util.subp(['mount', uefi_path, tmp_efi])151 '--efi-directory', '/boot/efi',
161152 '--recheck'])
162 # Copy the data over.
163 try:
164 efi_path = os.path.join(target, 'boot', 'efi')
165 if os.path.exists(os.path.join(tmp_efi, 'EFI')):
166 shutil.rmtree(os.path.join(tmp_efi, 'EFI'))
167 shutil.copytree(
168 os.path.join(efi_path, 'EFI'),
169 os.path.join(tmp_efi, 'EFI'))
170 finally:
171 # Clean up tmp mount
172 util.subp(['umount', tmp_efi])
173 os.rmdir(tmp_efi)
174
175 # Mount and do grub install
176 util.subp(['mount', uefi_path, efi_path])
177 try:
178 with util.RunInChroot(target) as in_chroot:
179 in_chroot([
180 'grub2-install', '--target=x86_64-efi',
181 '--efi-directory', '/boot/efi',
182 '--recheck'])
183 finally:
184 util.subp(['umount', efi_path])
185153
186154
187def set_autorelabel(target):155def set_autorelabel(target):
@@ -315,11 +283,7 @@
315 target, extra=get_extra_kernel_parameters())283 target, extra=get_extra_kernel_parameters())
316 grub2_mkconfig(target)284 grub2_mkconfig(target)
317 if util.is_uefi_bootable():285 if util.is_uefi_bootable():
318 uefi_part = get_uefi_partition()286 install_uefi(target)
319 if uefi_part is None:
320 print('Unable to determine UEFI parition.')
321 sys.exit(1)
322 install_efi(target, uefi_part['device_path'])
323 else:287 else:
324 for dev in devices:288 for dev in devices:
325 grub2_install(target, dev)289 grub2_install(target, dev)
326290
=== modified file 'meph2/ubuntu_info.py'
--- meph2/ubuntu_info.py 2016-04-25 20:07:36 +0000
+++ meph2/ubuntu_info.py 2017-04-25 08:12:18 +0000
@@ -96,6 +96,7 @@
96 try:96 try:
97 devel = udi.devel(date=date)97 devel = udi.devel(date=date)
98 except distro_info.DistroDataOutdated as e:98 except distro_info.DistroDataOutdated as e:
99 import sys
99 sys.stderr.write(100 sys.stderr.write(
100 "WARN: distro_info.UbuntuDistroInfo() raised exception (%s). "101 "WARN: distro_info.UbuntuDistroInfo() raised exception (%s). "
101 "Using stable release as devel.\n" % e)102 "Using stable release as devel.\n" % e)

Subscribers

People subscribed via source and target branches