[node-patches] Change in ovirt-node[master]: installer: Detect installation on EFI systems

jboggs at redhat.com jboggs at redhat.com
Mon Jan 28 15:54:15 UTC 2013


Joey Boggs has uploaded a new change for review.

Change subject: installer: Detect installation on EFI systems
......................................................................

installer: Detect installation on EFI systems

rhbz#901473

Signed-off-by: Joey Boggs <jboggs at redhat.com>
Change-Id: I96f3924e9349e6e3f7687278c9118fcd597bdf65
---
M scripts/ovirtnode/install.py
M scripts/ovirtnode/ovirtfunctions.py
2 files changed, 21 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/71/11471/1

diff --git a/scripts/ovirtnode/install.py b/scripts/ovirtnode/install.py
index b1e3dbc..95be9cc 100755
--- a/scripts/ovirtnode/install.py
+++ b/scripts/ovirtnode/install.py
@@ -90,7 +90,6 @@
                 self.grub_config_file = "%s/grub.conf" % self.grub_dir
             else:
                 self.grub_config_file = "/liveos/efi/EFI/redhat/grub.conf"
-                _functions.mount_efi()
 
     def grub_install(self):
         if _functions.is_iscsi_install():
@@ -261,11 +260,8 @@
         grub_config_file = None
         _functions.mount_liveos()
         if os.path.ismount("/liveos"):
-            if _functions.is_efi_boot():
-                _functions.mount_efi()
             if os.path.exists("/liveos/vmlinuz0") and os.path.exists("/liveos/initrd0.img"):
                 grub_config_file = self.grub_config_file
-
         elif not _functions.is_firstboot():
             if os.path.ismount("/dev/.initramfs/live"):
                 grub_config_file = "/dev/.initramfs/live/grub/grub.conf"
@@ -274,7 +270,13 @@
             if is_upgrade():
                 mount_liveos()
                 grub_config_file = "/liveos/grub/grub.conf"
-
+        system("umount /liveos")
+        if is_efi_boot():
+            logger.debug(str(os.listdir("/liveos")))
+            grub_config_file = "/liveos/EFI/redhat/grub.conf"
+            mount_efi(target="/liveos")
+        logger.debug("Grub config file is: %s" % grub_config_file)
+        logger.debug("Grub config file exists: " + str(os.path.exists(grub_config_file)))
         if not grub_config_file is None and os.path.exists(grub_config_file):
             f=open(grub_config_file)
             oldgrub=f.read()
diff --git a/scripts/ovirtnode/ovirtfunctions.py b/scripts/ovirtnode/ovirtfunctions.py
index e59a265..e03a3b4 100644
--- a/scripts/ovirtnode/ovirtfunctions.py
+++ b/scripts/ovirtnode/ovirtfunctions.py
@@ -495,13 +495,25 @@
                     system("ln -s \"/dev/mapper/" + dev + "\" /dev/disk/by-label/Root")
                     if system("mount LABEL=Root /liveos"):
                         return True
+                    else:
+                        if os.path.ismount("/dev/.initramfs/live"):
+                            system_closefds("mount -o bind /dev/.initramfs/live /liveos")
+                        elif os.path.ismount("/run/initramfs/live"):
+                            system_closefds("mount -o bind /run/initramfs/live /liveos")
+                        else:
+                            return False
         else:
             return True
 
-def mount_efi():
+def mount_efi(target="/liveos/efi"):
+    if os.path.ismount(target):
+        return True
     efi_part = findfs("Root")
     efi_part = efi_part[:-1] + "1"
-    if system_closefds("mount -t vfat " + efi_part + " /liveos/efi"):
+    if not os.path.exists(target):
+        if not system("mkdir -v -p %s" % target):
+            logger.warning("Unable to create mount target for EFI partition")
+    if system("mount -t vfat %s %s" % (efi_part, target)):
         return True
     else:
         logger.error("Unable to mount EFI partition")


--
To view, visit http://gerrit.ovirt.org/11471
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I96f3924e9349e6e3f7687278c9118fcd597bdf65
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Joey Boggs <jboggs at redhat.com>



More information about the node-patches mailing list