xen/tools-watchdog-support.patch

150 lines
6.7 KiB
Diff
Raw Normal View History

Index: xen-4.1.2-testing/tools/python/xen/xm/create.py
===================================================================
--- xen-4.1.2-testing.orig/tools/python/xen/xm/create.py
+++ xen-4.1.2-testing/tools/python/xen/xm/create.py
@@ -535,6 +535,21 @@ gopts.var('usbdevice', val='NAME',
fn=set_value, default='',
use="Name of USB device to add?")
+gopts.var('watchdog', val='NAME',
+ fn=set_value, default='',
+ use="Watchdog device to use. May be ib700 or i6300esb")
+
+gopts.var('watchdog_action', val='reset|shutdown|poweroff|pause|none|dump',
+ fn=set_value, default="reset",
+ use="""Action when watchdog timer expires:
+ - reset: Default, forcefully reset the guest;
+ - shutdown: Gracefully shutdown the guest (not recommended);
+ - poweroff: Forcefully power off the guest;
+ - pause: Pause the guest;
+ - none: Do nothing;
+ - dump: Automatically dump the guest;
+ """)
+
gopts.var('description', val='NAME',
fn=set_value, default='',
use="Description of a domain")
@@ -1092,6 +1107,7 @@ def configure_hvm(config_image, vals):
'usb', 'usbdevice',
'vcpus', 'vnc', 'vncconsole', 'vncdisplay', 'vnclisten',
'vncunused', 'viridian', 'vpt_align',
+ 'watchdog', 'watchdog_action',
'xauthority', 'xen_extended_power_mgmt', 'xen_platform_pci',
'memory_sharing' ]
Index: xen-4.1.2-testing/tools/python/xen/xm/xenapi_create.py
===================================================================
--- xen-4.1.2-testing.orig/tools/python/xen/xm/xenapi_create.py
+++ xen-4.1.2-testing/tools/python/xen/xm/xenapi_create.py
@@ -1113,7 +1113,9 @@ class sxp2xml:
'xen_platform_pci',
'tsc_mode'
'description',
- 'nomigrate'
+ 'nomigrate',
+ 'watchdog',
+ 'watchdog_action'
]
platform_configs = []
Index: xen-4.1.2-testing/tools/python/xen/xend/image.py
===================================================================
--- xen-4.1.2-testing.orig/tools/python/xen/xend/image.py
+++ xen-4.1.2-testing/tools/python/xen/xend/image.py
@@ -866,7 +866,8 @@ class HVMImageHandler(ImageHandler):
dmargs = [ 'boot', 'fda', 'fdb', 'soundhw',
'localtime', 'serial', 'stdvga', 'isa',
- 'acpi', 'usb', 'usbdevice', 'gfx_passthru' ]
+ 'acpi', 'usb', 'usbdevice', 'gfx_passthru',
+ 'watchdog', 'watchdog_action' ]
for a in dmargs:
v = vmConfig['platform'].get(a)
@@ -874,6 +875,7 @@ class HVMImageHandler(ImageHandler):
# python doesn't allow '-' in variable names
if a == 'stdvga': a = 'std-vga'
if a == 'keymap': a = 'k'
+ if a == 'watchdog_action': a = 'watchdog-action'
# Handle booleans gracefully
if a in ['localtime', 'std-vga', 'isa', 'usb', 'acpi']:
Index: xen-4.1.2-testing/tools/python/xen/xend/XendConfig.py
===================================================================
--- xen-4.1.2-testing.orig/tools/python/xen/xend/XendConfig.py
+++ xen-4.1.2-testing/tools/python/xen/xend/XendConfig.py
@@ -191,6 +191,8 @@ XENAPI_PLATFORM_CFG_TYPES = {
'xen_platform_pci': int,
"gfx_passthru": int,
'oos' : int,
+ 'watchdog': str,
+ 'watchdog_action': str,
}
# Xen API console 'other_config' keys.
Index: xen-4.1.2-testing/tools/libxl/libxl_dm.c
===================================================================
--- xen-4.1.2-testing.orig/tools/libxl/libxl_dm.c
+++ xen-4.1.2-testing/tools/libxl/libxl_dm.c
@@ -117,6 +117,12 @@ static char ** libxl_build_device_model_
flexarray_vappend(dm_args, "-usbdevice", info->usbdevice, NULL);
}
}
+ if (info->watchdog || info->watchdog_action) {
+ flexarray_append(dm_args, "-watchdog");
+ if (info->watchdog_action) {
+ flexarray_vappend(dm_args, "-watchdog-action", info->watchdog_action, NULL);
+ }
+ }
if (info->soundhw) {
flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
}
@@ -253,6 +259,12 @@ static char ** libxl_build_device_model_
flexarray_vappend(dm_args, "-usbdevice", info->usbdevice, NULL);
}
}
+ if (info->watchdog || info->watchdog_action) {
+ flexarray_append(dm_args, "-watchdog");
+ if (info->watchdog_action) {
+ flexarray_vappend(dm_args, "-watchdog-action", info->watchdog_action, NULL);
+ }
+ }
if (info->soundhw) {
flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
}
Index: xen-4.1.2-testing/tools/libxl/libxl.idl
===================================================================
--- xen-4.1.2-testing.orig/tools/libxl/libxl.idl
+++ xen-4.1.2-testing/tools/libxl/libxl.idl
@@ -164,6 +164,8 @@ libxl_device_model_info = Struct("device
("vcpu_avail", integer, False, "vcpus actually available"),
("xen_platform_pci", integer, False, "enable/disable the xen platform pci device"),
("extra", libxl_string_list, False, "extra parameters pass directly to qemu, NULL terminated"),
+ ("watchdog", string, False, "the watchdog device, ib700 or i6300esb"),
+ ("watchdog_action", string, False, "action to take when the watchdog timer expires"),
],
comment=
"""Device Model information.
Index: xen-4.1.2-testing/tools/libxl/xl_cmdimpl.c
===================================================================
--- xen-4.1.2-testing.orig/tools/libxl/xl_cmdimpl.c
+++ xen-4.1.2-testing/tools/libxl/xl_cmdimpl.c
@@ -365,6 +365,8 @@ static void printf_info(int domid,
printf("\t\t\t(usb %d)\n", dm_info->usb);
printf("\t\t\t(usbdevice %s)\n", dm_info->usbdevice);
printf("\t\t\t(apic %d)\n", dm_info->apic);
+ printf("\t\t\t(watchdog %s)\n", dm_info->watchdog);
+ printf("\t\t\t(watchdog_action %s)\n", dm_info->watchdog_action);
printf("\t\t)\n");
} else {
printf("\t\t(linux %d)\n", b_info->hvm);
@@ -1142,6 +1144,8 @@ skip_vfb:
xlu_cfg_replace_string (config, "soundhw", &dm_info->soundhw);
if (!xlu_cfg_get_long (config, "xen_platform_pci", &l))
dm_info->xen_platform_pci = l;
+ xlu_cfg_replace_string (config, "watchdog", &dm_info->watchdog);
+ xlu_cfg_replace_string (config, "watchdog_action", &dm_info->watchdog_action);
if (!xlu_cfg_get_list(config, "device_model_args", &dmargs, &nr_dmargs, 0))
{