[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-ia64-devel] [PATCH 1/5] Add guest_os_type config option



   This will be sent to xen-devel if this is the way we decide to go.
This leverages much of Wing's code, but encodes the guest OS type
generically.  This also sets HVM_PARAM_GOS_TYPE across all archs.

Signed-off-by: Alex Williamson <alex.williamson@xxxxxx>
---  

diff -r 98defc4f3bf9 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Mon Nov 26 10:07:30 2007 -0700
+++ b/tools/python/xen/xend/XendConfig.py       Tue Nov 27 09:21:20 2007 -0700
@@ -129,7 +129,8 @@ XENAPI_PLATFORM_CFG = [ 'acpi', 'apic', 
                         'nographic', 'pae', 'rtc_timeoffset', 'serial', 'sdl',
                         'soundhw','stdvga', 'usb', 'usbdevice', 'vnc',
                         'vncconsole', 'vncdisplay', 'vnclisten', 'timer_mode',
-                        'vncpasswd', 'vncunused', 'xauthority', 'pci', 'vhpt']
+                        'vncpasswd', 'vncunused', 'xauthority', 'pci', 'vhpt',
+                        'guest_os_type' ]
 
 # Xen API console 'other_config' keys.
 XENAPI_CONSOLE_OTHER_CFG = ['vncunused', 'vncdisplay', 'vnclisten',
diff -r 98defc4f3bf9 tools/python/xen/xend/XendConstants.py
--- a/tools/python/xen/xend/XendConstants.py    Mon Nov 26 10:07:30 2007 -0700
+++ b/tools/python/xen/xend/XendConstants.py    Tue Nov 27 09:21:20 2007 -0700
@@ -47,6 +47,7 @@ HVM_PARAM_VHPT_SIZE    = 8
 HVM_PARAM_VHPT_SIZE    = 8
 HVM_PARAM_BUFPIOREQ_PFN = 9
 HVM_PARAM_TIMER_MODE   = 10
+HVM_PARAM_GOS_TYPE = 11
 
 restart_modes = [
     "restart",
diff -r 98defc4f3bf9 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Mon Nov 26 10:07:30 2007 -0700
+++ b/tools/python/xen/xend/image.py    Tue Nov 27 12:21:56 2007 -0700
@@ -22,6 +22,7 @@ import math
 import math
 import time
 import signal
+import struct
 
 import xen.lowlevel.xc
 from xen.xend.XendConstants import *
@@ -426,6 +427,7 @@ class HVMImageHandler(ImageHandler):
 
         self.apic = int(vmConfig['platform'].get('apic', 0))
         self.acpi = int(vmConfig['platform'].get('acpi', 0))
+        self.guest_os_type = vmConfig['platform'].get('guest_os_type')
 
     # Return a list of cmd line args to the device models based on the
     # xm config file
@@ -503,6 +505,11 @@ class HVMImageHandler(ImageHandler):
         return args
 
     def buildDomain(self):
+        # Encode OS type string into an integer w/ null padding
+        val = struct.unpack("Q",
+                            self.guest_os_type[:8].lower().ljust(8, chr(0)))[0]
+        xc.hvm_set_param(self.vm.getDomid(), HVM_PARAM_GOS_TYPE, val)
+
         store_evtchn = self.vm.getStorePort()
 
         mem_mb = self.getRequiredInitialReservation() / 1024
diff -r 98defc4f3bf9 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Mon Nov 26 10:07:30 2007 -0700
+++ b/tools/python/xen/xm/create.py     Tue Nov 27 09:21:20 2007 -0700
@@ -453,6 +453,10 @@ gopts.var('usbdevice', val='NAME',
 gopts.var('usbdevice', val='NAME',
           fn=set_value, default='',
           use="Name of USB device to add?")
+
+gopts.var('guest_os_type', val='NAME',
+          fn=set_value, default='default',
+          use="Guest OS type running in HVM")
 
 gopts.var('stdvga', val='no|yes',
           fn=set_bool, default=0,
@@ -733,7 +737,9 @@ def configure_hvm(config_image, vals):
              'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'soundhw',
              'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten',
              'sdl', 'display', 'xauthority', 'rtc_timeoffset', 'monitor',
-             'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci' ]
+             'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci',
+             'guest_os_type']
+
     for a in args:
         if a in vals.__dict__ and vals.__dict__[a] is not None:
             config_image.append([a, vals.__dict__[a]])
diff -r 98defc4f3bf9 xen/include/public/hvm/params.h
--- a/xen/include/public/hvm/params.h   Mon Nov 26 10:07:30 2007 -0700
+++ b/xen/include/public/hvm/params.h   Tue Nov 27 11:20:12 2007 -0700
@@ -75,6 +75,8 @@
 #define HVMPTM_no_delay_for_missed_ticks 1
 #define HVMPTM_no_missed_tick_accounting 2
 
-#define HVM_NR_PARAMS          11
+#define HVM_PARAM_GOS_TYPE     11
+
+#define HVM_NR_PARAMS          12
 
 #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */



_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.