summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Callaghan <dcallagh@redhat.com>2014-06-24 11:43:57 +1000
committerGerrit Code Review <gerrit@beaker-project.org>2014-06-25 03:44:02 +0000
commit39512290f57f33f1aaa95a482bb6f3dd459f20bb (patch)
treefa7645d331b0564f54487b5f4ca1f2ff6acca436
parent7923883090b2a82dd43330a6e1cb4c2b666164f7 (diff)
define /boot/efi partition instead of /boot for x86 EFI systems
-rw-r--r--IntegrationTests/src/bkr/inttest/server/test_kickstart.py32
-rw-r--r--Server/bkr/server/model/inventory.py17
-rw-r--r--Server/bkr/server/snippets/rhts_partitions10
3 files changed, 58 insertions, 1 deletions
diff --git a/IntegrationTests/src/bkr/inttest/server/test_kickstart.py b/IntegrationTests/src/bkr/inttest/server/test_kickstart.py
index 08118c4..e40a575 100644
--- a/IntegrationTests/src/bkr/inttest/server/test_kickstart.py
+++ b/IntegrationTests/src/bkr/inttest/server/test_kickstart.py
@@ -11,7 +11,8 @@ import xmltramp
import crypt
from bkr.server import dynamic_virt
from bkr.server.model import session, DistroTreeRepo, LabControllerDistroTree, \
- CommandActivity, Provision, SSHPubKey, ProvisionFamily, OSMajor, Arch
+ CommandActivity, Provision, SSHPubKey, ProvisionFamily, OSMajor, Arch, \
+ Key, Key_Value_String
from bkr.server.kickstart import template_env, generate_kickstart
from bkr.server.jobs import Jobs
from bkr.server.jobxml import XmlJob
@@ -2340,6 +2341,35 @@ part /mnt/testarea2 --size=10240 --fstype btrfs
''',
recipe.rendered_kickstart.kickstart)
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1088761
+ def test_x86_efi_partition(self):
+ efi_system = data_setup.create_system(arch=u'x86_64',
+ status=u'Automated', lab_controller=self.lab_controller)
+ efi_system.key_values_string.append(Key_Value_String(
+ key=Key.by_name(u'NETBOOT_METHOD'), key_value=u'efigrub'))
+ recipe = self.provision_recipe('''
+ <job>
+ <whiteboard/>
+ <recipeSet>
+ <recipe>
+ <distroRequires>
+ <distro_name op="=" value="RHEL-6.2" />
+ <distro_variant op="=" value="Server" />
+ <distro_arch op="=" value="x86_64" />
+ </distroRequires>
+ <hostRequires/>
+ <partitions>
+ <partition fs="ext4" name="mnt" size="10" />
+ </partitions>
+ <task name="/distribution/install" />
+ </recipe>
+ </recipeSet>
+ </job>
+ ''', efi_system)
+ ks = recipe.rendered_kickstart.kickstart
+ self.assertIn('\npart /boot/efi --fstype vfat ', ks)
+ self.assertNotIn('\npart /boot ', ks)
+
def test_anamon(self):
# Test that we can override the anamon URL
recipe_xml = '''
diff --git a/Server/bkr/server/model/inventory.py b/Server/bkr/server/model/inventory.py
index 3a45b1c..595c810 100644
--- a/Server/bkr/server/model/inventory.py
+++ b/Server/bkr/server/model/inventory.py
@@ -547,6 +547,23 @@ class System(DeclarativeMappedObject, ActivityMixin):
result = result.combined_with(pfu_opts)
return result
+ @property
+ def has_efi(self):
+ """
+ Only relevant for x86 systems. Returns True if the system has EFI
+ firmware, False if the system has BIOS-compatible firmware (or EFI
+ firmware running in BIOS-compatible mode, which is effectively the same
+ thing from software's point of view).
+
+ When no information is available we return False by default, since
+ BIOS-based systems are currently much more common.
+ """
+ # Currently we just examine NETBOOT_METHOD which is a hack,
+ # this bug is about doing something better:
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1112439
+ return any(kv.key.key_name == u'NETBOOT_METHOD' and kv.key_value == u'efigrub'
+ for kv in self.key_values_string)
+
@hybrid_method
def is_free(self, user):
self._ensure_user_is_authenticated(user)
diff --git a/Server/bkr/server/snippets/rhts_partitions b/Server/bkr/server/snippets/rhts_partitions
index 7f1e2f6..a0b2222 100644
--- a/Server/bkr/server/snippets/rhts_partitions
+++ b/Server/bkr/server/snippets/rhts_partitions
@@ -21,6 +21,16 @@ part None --fstype 'PPC PReP Boot' --size 8
part /boot --size 200 --recommended --asprimary
{%- if fstype %} --fstype {{ fstype }}{% endif %}
{%- if ondisk %} --ondisk={{ ondisk }}{% endif %}
+{% elif distro_tree is arch('i386', 'x86_64') %}
+{% if system and system.has_efi %}
+{# x86 EFI #}
+part /boot/efi --fstype vfat --size 200 --recommended
+{% else %}
+{# x86 BIOS #}
+part /boot --size 200 --recommended --asprimary
+{%- if fstype %} --fstype {{ fstype }}{% endif %}
+{%- if ondisk %} --ondisk={{ ondisk }}{% endif %}
+{% endif %}
{% else %}
part /boot --size 200 --recommended --asprimary
{%- if fstype %} --fstype {{ fstype }}{% endif %}