# 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.
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
07-14-2008, 04:50 PM
Cole Robinson
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