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

Re: [Xen-devel] [PATCH RFC 02/10] libxl: add new hotplug interface support to hotplug script callers



On Fri, 2012-12-21 at 17:00 +0000, Roger Pau Monne wrote:
> Add support to call hotplug scripts that use the new hotplug interface
> to the low-level functions in charge of calling hotplug scripts. This
> new calling convention will be used when the hotplug_version aodev
> field is 1.

Is there perhaps some way we can avoid users having to think about the
hotplug_version?

For example if we export XENBUGS_PATH as a synonym for BACKEND_PATH and
arrange that the new protocol involves calling action "add" and
"remove" (as well as the other new ones) do old scripts mostly Just Work
because they ignore the prepare/unprepare calls? (as a small sample
vif-bridge and block-nbd seem to).

Alternatively by way of backwards compat perhaps we could provide a
wrapper script? So if today you use script="/my-custom-script" you would
switch to script="/etc/xen/hotplug-compat-wrapper /my-custom-script" and
the wrapper would shim or ignore the new calls into the old?

> 
> Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx>
> ---
>  tools/libxl/libxl_device.c   |   33 +++++++++++++++++++-
>  tools/libxl/libxl_internal.h |   33 ++++++++++++++++++--
>  tools/libxl/libxl_linux.c    |   68 
> ++++++++++++++++++++++++++++++++----------
>  tools/libxl/libxl_netbsd.c   |    2 +-
>  4 files changed, 115 insertions(+), 21 deletions(-)
> 
> diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
> index 58d3f35..85c9953 100644
> --- a/tools/libxl/libxl_device.c
> +++ b/tools/libxl/libxl_device.c
> @@ -83,6 +83,35 @@ out:
>      return rc;
>  }
> 
> +char *libxl__device_hotplug_action(libxl__gc *gc,
> +                                   libxl__device_action action)
> +{

If you define libxl__device_action in
tools/libxl/libxl_types_internal.idl you'll get this for free.

[...]
> diff --git a/tools/libxl/libxl_netbsd.c b/tools/libxl/libxl_netbsd.c
> index 9587833..8061e7a 100644
> --- a/tools/libxl/libxl_netbsd.c
> +++ b/tools/libxl/libxl_netbsd.c
> @@ -62,7 +62,7 @@ out:
>  int libxl__get_hotplug_script_info(libxl__gc *gc, libxl__device *dev,
>                                     char ***args, char ***env,
>                                     libxl__device_action action,
> -                                   int num_exec)
> +                                   int num_exec, int hotplug_version)

Is it worth wrapping verison and action into a little
libxl__hotplug_action struct? 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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