[node-patches] Change in ovirt-node[master]: add grub2_available function to simplify install module
jboggs at redhat.com
jboggs at redhat.com
Mon Feb 11 18:44:02 UTC 2013
Joey Boggs has uploaded a new change for review.
Change subject: add grub2_available function to simplify install module
......................................................................
add grub2_available function to simplify install module
Change-Id: I74e68bc015fbeb5ed43693298fcceca5e7a67f1d
Signed-off-by: Joey Boggs <jboggs at redhat.com>
---
M scripts/ovirtnode/install.py
M scripts/ovirtnode/ovirtfunctions.py
2 files changed, 12 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/40/11940/1
diff --git a/scripts/ovirtnode/install.py b/scripts/ovirtnode/install.py
index 25c3bb6..fed311e 100755
--- a/scripts/ovirtnode/install.py
+++ b/scripts/ovirtnode/install.py
@@ -80,7 +80,7 @@
self.grub_dir = "/liveos/grub"
self.grub_prefix = "/grub"
- if os.path.exists("/sbin/grub2-install"):
+ if _functions.grub2_available():
self.grub_prefix = self.grub_prefix + "2"
self.grub_dir = self.grub_dir + "2"
self.grub_config_file = "%s/grub.cfg" % self.grub_dir
@@ -204,7 +204,6 @@
linux /vmlinuz0 root=live:LABEL=RootBackup %(bootparams)s
initrd /initrd0.img
} """
- logger.info("efi not detected, installing grub2 configuraton")
if _functions.is_iscsi_install():
disk = re.sub("p[1,2,3]$", "", \
_functions.findfs(self.boot_candidate))
@@ -228,7 +227,7 @@
grub_results = grub_setup.stdout.read()
logger.info(grub_results)
if grub_setup.wait() != 0 or "Error" in grub_results:
- logger.error("GRUB efi setup failed")
+ logger.error("grub2-install Failed")
return False
else:
logger.debug("Generating Grub2 Templates")
@@ -296,14 +295,14 @@
f=open(grub_config_file)
oldgrub=f.read()
f.close()
- if _functions.is_efi_boot() or "grub.cfg" in grub_config_file:
+ if _functions.grub2_available():
m=re.search("^menuentry (.*)$", oldgrub, re.MULTILINE)
else:
m=re.search("^title (.*)$", oldgrub, re.MULTILINE)
if m is not None:
self.oldtitle=m.group(1)
# strip off extra title characters
- if _functions.is_efi_boot() or "grub.cfg" in grub_config_file:
+ if _functions.grub2_available():
self.oldtitle = self.oldtitle.replace('"','').strip(" {")
_functions.system("umount /liveos/efi")
_functions.system("umount /liveos")
@@ -378,7 +377,7 @@
logger.info(self.disk)
# grub2 starts at part 1
self.partN = int(self.disk[-1:])
- if not os.path.exists("/sbin/grub2-install"):
+ if not _functions.grub2_available():
self.partN = self.partN - 1
except:
logger.debug(traceback.format_exc())
@@ -502,7 +501,7 @@
key, value = line.split("=")
self.grub_dict["release"] = value.strip()
- if os.path.exists("/sbin/grub2-install"):
+ if _functions.grub2_available():
if not self.grub2_install():
logger.error("Grub2 Installation Failed ")
return False
diff --git a/scripts/ovirtnode/ovirtfunctions.py b/scripts/ovirtnode/ovirtfunctions.py
index 9e5d038..1dda341 100644
--- a/scripts/ovirtnode/ovirtfunctions.py
+++ b/scripts/ovirtnode/ovirtfunctions.py
@@ -1711,6 +1711,12 @@
system(cmd)
return
+def grub2_available():
+ if os.path.exists("/sbin/grub2-install"):
+ return True
+ else:
+ return False
+
class PluginBase(object):
"""Base class for pluggable Hypervisor configuration options.
--
To view, visit http://gerrit.ovirt.org/11940
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I74e68bc015fbeb5ed43693298fcceca5e7a67f1d
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