FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora/Linux Management Tools

 
 
LinkBack Thread Tools
 
Old 07-10-2008, 01:48 PM
 
Default virt-install: correct pygrub path

# HG changeset patch
# User john.levon@sun.com
# Date 1215697572 25200
# Node ID 92de696f634f80d47b9413b9db5101de0edf9b7f
# Parent 443b42b45ee6f799020a9418388440b93d9ab78c
virt-install: correct pygrub path

The path to pygrub differs between OS hosts. Properly speaking, this is a
property of the hypervisor capabilities, and we'd get it from there. However,
traditionally the loader value is empty for PV Xen hosts, so we can't rely on
it, so we hard-code it based upon the current host.

Signed-off-by: John Levon <john.levon@sun.com>

diff --git a/virtinst/DistroManager.py b/virtinst/DistroManager.py
--- a/virtinst/DistroManager.py
+++ b/virtinst/DistroManager.py
@@ -218,7 +218,7 @@
else:
self._prepare_kernel_and_initrd(guest, distro, meter)

- def _get_osblob(self, install, hvm, arch = None, loader = None):
+ def _get_osblob(self, install, hvm, arch = None, loader = None, conn = None):
osblob = ""
if install or hvm:
osblob = "<os>
"
@@ -248,7 +248,7 @@

osblob += " </os>"
else:
- osblob += "<bootloader>/usr/bin/pygrub</bootloader>"
+ osblob += "<bootloader>%s</bootloader>" % util.pygrub_path(conn)

return osblob

@@ -275,7 +275,7 @@
def prepare(self, guest, meter, distro = None):
pass

- def _get_osblob(self, install, hvm, arch = None, loader = None):
+ def _get_osblob(self, install, hvm, arch = None, loader = None, conn = None):
osblob = ""
if install or hvm:
osblob = "<os>
"
@@ -300,7 +300,7 @@

osblob += " </os>"
else:
- osblob += "<bootloader>/usr/bin/pygrub</bootloader>"
+ osblob += "<bootloader>%s</bootloader>" % util.pygrub_path(conn)

return osblob

diff --git a/virtinst/FullVirtGuest.py b/virtinst/FullVirtGuest.py
--- a/virtinst/FullVirtGuest.py
+++ b/virtinst/FullVirtGuest.py
@@ -203,7 +203,8 @@
return ret + " </features>"

def _get_osblob(self, install):
- osblob = self.installer._get_osblob(install, True, self.arch, self.loader)
+ osblob = self.installer._get_osblob(install, hvm = True,
+ arch = self.arch, loader = self.loader, conn = self.conn)
if osblob is None:
return None

diff --git a/virtinst/ImageManager.py b/virtinst/ImageManager.py
--- a/virtinst/ImageManager.py
+++ b/virtinst/ImageManager.py
@@ -106,7 +106,7 @@

guest._install_disks.append(d)

- def _get_osblob(self, install, hvm, arch = None, loader = None):
+ def _get_osblob(self, install, hvm, arch = None, loader = None, conn = None):
osblob = "<os>
"

if hvm:
@@ -136,7 +136,7 @@
osblob += " </os>"
elif self.boot_caps.loader == "pygrub" or (self.boot_caps.loader is None and self.boot_caps.type == "xen"):
osblob += " </os>
"
- osblob += " <bootloader>/usr/bin/pygrub</bootloader>"
+ osblob += " <bootloader>%s</bootloader>" % util.pygrub_path(conn)

return osblob

diff --git a/virtinst/LiveCDInstaller.py b/virtinst/LiveCDInstaller.py
--- a/virtinst/LiveCDInstaller.py
+++ b/virtinst/LiveCDInstaller.py
@@ -55,7 +55,7 @@
readOnly = True)
guest._install_disks.insert(0, disk)

- def _get_osblob(self, install, hvm, arch = None, loader = None):
+ def _get_osblob(self, install, hvm, arch = None, loader = None, conn = None):
if install:
return None

diff --git a/virtinst/ParaVirtGuest.py b/virtinst/ParaVirtGuest.py
--- a/virtinst/ParaVirtGuest.py
+++ b/virtinst/ParaVirtGuest.py
@@ -33,7 +33,7 @@
self.disknode = "xvd"

def _get_osblob(self, install):
- return self.installer._get_osblob(install, hvm = False)
+ return self.installer._get_osblob(install, hvm = False, conn = self.conn)

def get_input_device(self):
return ("mouse", "xen")
diff --git a/virtinst/util.py b/virtinst/util.py
--- a/virtinst/util.py
+++ b/virtinst/util.py
@@ -19,6 +19,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.

+import platform
import random
import os.path
import re
@@ -27,6 +28,8 @@

import libvirt
from virtinst import _virtinst as _
+from virtinst import CapabilitiesParser
+

KEYBOARD_DIR = "/etc/sysconfig/keyboard"

@@ -277,3 +280,18 @@
f.close()
return keymap

+def pygrub_path(conn=None):
+ """
+ Return the pygrub path for the current host, or connection if
+ available.
+ """
+ if conn:
+ cap = CapabilitiesParser.parse(conn.getCapabilities())
+ if (cap.host.arch == "i86pc"):
+ return "/usr/lib/xen/bin/pygrub"
+ else:
+ return "/usr/bin/pygrub"
+
+ if platform.system() == "SunOS":
+ return "/usr/lib/xen/bin/pygrub"
+ return "/usr/bin/pygrub"

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools
 
Old 07-14-2008, 04:50 PM
Cole Robinson
 
Default virt-install: correct pygrub path

john.levon@sun.com wrote:
> # HG changeset patch
> # User john.levon@sun.com
> # Date 1215697572 25200
> # Node ID 92de696f634f80d47b9413b9db5101de0edf9b7f
> # Parent 443b42b45ee6f799020a9418388440b93d9ab78c
> virt-install: correct pygrub path
>
> The path to pygrub differs between OS hosts. Properly speaking, this is a
> property of the hypervisor capabilities, and we'd get it from there. However,
> traditionally the loader value is empty for PV Xen hosts, so we can't rely on
> it, so we hard-code it based upon the current host.
>
> Signed-off-by: John Levon <john.levon@sun.com>
>


I've committed this with a couple comments to the util function specifying
that this will be deprecated by (hopefully) fixed capabilities xml.

Thanks,
Cole


_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools
 

Thread Tools




All times are GMT. The time now is 04:49 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org