ia64/xen-unstable

changeset 19617:62ec6aae4ba9

xend: Make hotplug script timeouts configurable

In some configurations, when dom0 is busy with I/O, it may take
several minutes to complete all hotplug scripts required when a new
domain is being created. As device create timeout is set to 100
seconds, users get "hotplug scripts not working" error instead of a
new domain.

This patch makes both DEVICE_CREATE_TIMEOUT and DEVICE_DESTROY_TIMEOUT
configurable in xend-config.sxp to allow users to easily adapt hotplug
timeouts to their environment.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue May 19 02:18:48 2009 +0100 (2009-05-19)
parents 61501fa86b1b
children 780041c4a96d
files docs/man/xend-config.sxp.pod.5 tools/examples/xend-config.sxp tools/python/xen/xend/XendOptions.py tools/python/xen/xend/server/DevConstants.py
line diff
     1.1 --- a/docs/man/xend-config.sxp.pod.5	Tue May 19 02:16:37 2009 +0100
     1.2 +++ b/docs/man/xend-config.sxp.pod.5	Tue May 19 02:18:48 2009 +0100
     1.3 @@ -115,6 +115,16 @@ The name of an application or script tha
     1.4  migration, such as for example virtual TPM migration. An example
     1.5  script is I</etc/xen/scripts/external-device-migrate>.
     1.6  
     1.7 +=item I<device-create-timeout>
     1.8 +
     1.9 +Integer value that tells xend how long it should wait for a new device
    1.10 +to be created. Defaults to I<100>.
    1.11 +
    1.12 +=item I<device-destroy-timeout>
    1.13 +
    1.14 +Integer value that tells xend how long it should wait for a device to
    1.15 +be destroyed. Defaults to I<100>.
    1.16 +
    1.17  =back
    1.18  
    1.19  =head1 EXAMPLES
     2.1 --- a/tools/examples/xend-config.sxp	Tue May 19 02:16:37 2009 +0100
     2.2 +++ b/tools/examples/xend-config.sxp	Tue May 19 02:18:48 2009 +0100
     2.3 @@ -254,3 +254,9 @@
     2.4  # Path where persistent domain configuration is stored.
     2.5  # Default is /var/lib/xend/domains/
     2.6  #(xend-domains-path /var/lib/xend/domains)
     2.7 +
     2.8 +# Number of seconds xend will wait for device creation and
     2.9 +# destruction
    2.10 +#(device-create-timeout 100)
    2.11 +#(device-destroy-timeout 100)
    2.12 +
     3.1 --- a/tools/python/xen/xend/XendOptions.py	Tue May 19 02:16:37 2009 +0100
     3.2 +++ b/tools/python/xen/xend/XendOptions.py	Tue May 19 02:18:48 2009 +0100
     3.3 @@ -141,6 +141,12 @@ class XendOptions:
     3.4      """Default rotation count of qemu-dm log file."""
     3.5      qemu_dm_logrotate_count = 10
     3.6  
     3.7 +    """Default timeout for device creation."""
     3.8 +    device_create_timeout_default = 100
     3.9 +
    3.10 +    """Default timeout for device destruction."""
    3.11 +    device_destroy_timeout_default = 100
    3.12 +
    3.13      def __init__(self):
    3.14          self.configure()
    3.15  
    3.16 @@ -368,6 +374,14 @@ class XendOptions:
    3.17          return self.get_config_int("qemu-dm-logrotate-count",
    3.18                                     self.qemu_dm_logrotate_count)
    3.19  
    3.20 +    def get_device_create_timeout(self):
    3.21 +        return self.get_config_int("device-create-timeout",
    3.22 +                                   self.device_create_timeout_default)
    3.23 +
    3.24 +    def get_device_destroy_timeout(self):
    3.25 +        return self.get_config_int("device-destroy-timeout",
    3.26 +                                   self.device_destroy_timeout_default)
    3.27 +
    3.28  
    3.29  class XendOptionsFile(XendOptions):
    3.30  
     4.1 --- a/tools/python/xen/xend/server/DevConstants.py	Tue May 19 02:16:37 2009 +0100
     4.2 +++ b/tools/python/xen/xend/server/DevConstants.py	Tue May 19 02:18:48 2009 +0100
     4.3 @@ -16,8 +16,12 @@
     4.4  # Copyright (C) 2005 XenSource Ltd
     4.5  #============================================================================
     4.6  
     4.7 -DEVICE_CREATE_TIMEOUT  = 100
     4.8 -DEVICE_DESTROY_TIMEOUT = 100
     4.9 +from xen.xend import XendOptions
    4.10 +
    4.11 +xoptions = XendOptions.instance()
    4.12 +
    4.13 +DEVICE_CREATE_TIMEOUT  = xoptions.get_device_create_timeout();
    4.14 +DEVICE_DESTROY_TIMEOUT = xoptions.get_device_destroy_timeout();
    4.15  HOTPLUG_STATUS_NODE = "hotplug-status"
    4.16  HOTPLUG_ERROR_NODE  = "hotplug-error"
    4.17  HOTPLUG_STATUS_ERROR = "error"