libxl: do not expose libxenctrl/libxenstore headers via libxl.h
PATCH 1/1 libxl: do not expose libxenctrl/libxenstore headers via libxl.h
# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1302102848 -3600
# Node ID 3aecf852f357e921714406a1cd5b60dbe4c494bd
# Parent 3f9f254ec01528bb647a94e063cc333bc655571c
libxl: do not expose libxenctrl/libxenstore headers via libxl.h
This completely removes libxenstore from libxl users' view.
xl still needs libxenctrl directly due to the direct use of the xentoollog functionality but it is not exposed to the indirect linkage anymore.
tools/Rules.mk +1 -1
@@ -49,7 +49,7 @@ LDLIBS_libblktapctl = SHLIB_libblktapctl = endif -CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore) $(CFLAGS_xeninclude) +CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude) LDLIBS_libxenlight = -L$(XEN_XENLIGHT) $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapctl) -lxenlight SHLIB_libxenlight = -Wl,-rpath-link=$(XEN_XENLIGHT)
tools/libxl/Makefile +5 -1
@@ -13,7 +13,6 @@ XLUMINOR = 0 CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations CFLAGS += -I. -fPIC -CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) ifeq ($(CONFIG_Linux),y) LIBUUID_LIBS += -luuid
@@ -38,13 +37,18 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_c libxl_internal.o libxl_utils.o libxl_uuid.o $(LIBXL_OBJS-y) LIBXL_OBJS += _libxl_types.o +$(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) + AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o +$(LIBXLU_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h CLIENTS = xl XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o +$(XL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h +$(XL_OBJS): CFLAGS += $(CFLAGS_libxenlight) .PHONY: all all: $(CLIENTS) libxenlight.so libxenlight.a libxlutil.so libxlutil.a \
tools/libxl/libxl.c +11 -2
@@ -41,15 +41,22 @@#define STRINGIFY (x) #x#define TOSTRING (x) STRINGIFY(x) -int libxl_ctx_init (libxl_ctx *ctx,int version,xentoollog_logger *lg) +int libxl_ctx_alloc (libxl_ctx **pctx,int version,xentoollog_logger * lg) { +libxl_ctx *ctx;struct stat stat_buf;if (version !=LIBXL_VERSION )return ERROR_VERSION ; + + ctx =malloc (sizeof (*ctx)); +if (!ctx) { +LIBXL__LOG_ERRNO (ctx,LIBXL__LOG_ERROR ,"Failed to allocate context\n" ); +return ERROR_NOMEM ; + } +memset (ctx,0 ,sizeof (libxl_ctx)); ctx->lg = lg; -memset (&ctx->version_info,0 ,sizeof (libxl_version_info));if (stat (XENSTORE_PID_FILE , &stat_buf) !=0 ) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Is xenstore daemon running?\n"
@@ -73,6 +80,8 @@ int libxl_ctx_init(libxl_ctx *ctx, int vxc_interface_close (ctx->xch);return ERROR_FAIL ; } + + *pctx = ctx;return 0 ; }
tools/libxl/libxl.h +9 -14
@@ -124,13 +124,18 @@#ifndef LIBXL_H #define LIBXL_H +#include <stdbool.h> #include <stdint.h> #include <stdarg.h> +#include <errno.h> #include <netinet/in.h> -#include <xenctrl.h> -#include <xs.h> #include <sys/wait.h> /* for pid_t */ +#include <xentoollog.h> + +#include <xen/sched.h> +#include <xen/sysctl.h> +#include <libxl_uuid.h> typedef uint8_t libxl_mac [6 ];
@@ -216,17 +221,7 @@ void libxl_cpuid_destroy(libxl_cpuid_pol#include "_libxl_types.h" -typedef struct { -xentoollog_logger *lg; -xc_interface *xch; -struct xs_handle *xsh; - -/* for callers who reap children willy-nilly; caller must only -* set this after libxl_init and before any other call - or -* may leave them untouched */ -int (*waitpid_instead)(pid_t pid,int *status,int flags); -libxl_version_info version_info; -}libxl_ctx ; +typedef struct libxl__ctx libxl_ctx ;const libxl_version_info *libxl_get_version_info (libxl_ctx *ctx);
@@ -283,7 +278,7 @@ typedef struct { } libxl_domain_config;/* context functions */ -int libxl_ctx_init (libxl_ctx *ctx,int version,xentoollog_logger *); +int libxl_ctx_alloc (libxl_ctx **pctx,int version,xentoollog_logger *lg);int libxl_ctx_free (libxl_ctx *ctx);int libxl_ctx_postfork (libxl_ctx *ctx);
tools/libxl/libxl_internal.h +11 -0
@@ -82,6 +82,17 @@ _hidden void libxl__log(libxl_ctx *ctx,/* these functions preserve errno (saving and restoring) */ +struct libxl__ctx { +xentoollog_logger *lg; +xc_interface *xch; +struct xs_handle *xsh; + +/* for callers who reap children willy-nilly; caller must only +* set this after libxl_init and before any other call - or +* may leave them untouched */ +int (*waitpid_instead)(pid_t pid,int *status,int flags); +libxl_version_info version_info; +}; typedef enum { DEVICE_VIF = 1,
tools/libxl/libxlu_cfg.c +1 -0
@@ -1,3 +1,4 @@ +#include <limits.h> #include "libxlu_internal.h" #include "libxlu_cfg_y.h"
tools/libxl/xl.c +4 -3
@@ -26,6 +26,7 @@#include <fcntl.h> #include <ctype.h> #include <inttypes.h> +#include <xenctrl.h> #include "libxl.h" #include "libxl_utils.h"
@@ -111,7 +112,7 @@ int main(int argc, char **argv) logger =xtl_createlogger_stdiostream (stderr, minmsglevel,0 );if (!logger)exit (1 ); -if (libxl_ctx_init (&ctx,LIBXL_VERSION , (xentoollog_logger *)logger)) { +if (libxl_ctx_alloc (&ctx,LIBXL_VERSION , (xentoollog_logger *)logger)) {fprintf (stderr,"cannot init xl context\n" );exit (1 ); }
@@ -123,7 +124,7 @@ int main(int argc, char **argv)exit (1 ); } - ret =libxl_read_file_contents (&ctx, config_file, + ret =libxl_read_file_contents (ctx, config_file, &config_data, &config_len);if (ret) fprintf(stderr, "Failed to read config file: %s: %s\n",
@@ -147,7 +148,7 @@ int main(int argc, char **argv) ret =1 ; } -libxl_ctx_free (&ctx); +libxl_ctx_free (ctx);xtl_logger_destroy ((xentoollog_logger *)logger);return ret;
tools/libxl/xl.h +1 -1
@@ -95,7 +95,7 @@ extern int cmdtable_len;/* Look up a command in the table, allowing unambiguous truncation */ struct cmd_spec *cmdtable_lookup (const char *s); -extern libxl_ctx ctx; +extern libxl_ctx *ctx;extern xentoollog_logger_stdiostream *logger;/* global options */
tools/libxl/xl_cmdimpl.c +195 -194
1,338 lines not on this page · raw message
tools/ocaml/libs/xl/xl_stubs.c +25 -25
200 lines not on this page · raw message
tools/python/setup.py +1 -1
@@ -83,7 +83,7 @@ netlink = Extension("netlink", xl = Extension("xl", extra_compile_args = extra_compile_args, - include_dirs = [ PATH_XEN, PATH_LIBXL, PATH_LIBXC, PATH_XENSTORE, "xen/lowlevel/xl" ], + include_dirs = [ PATH_XEN, PATH_LIBXL, PATH_LIBXC, "xen/lowlevel/xl" ], library_dirs = [ PATH_LIBXL ], libraries = [ "xenlight" ], depends = [ PATH_LIBXL + "/libxenlight.so" ],
tools/python/xen/lowlevel/xl/xl.c +16 -16
@@ -370,7 +370,7 @@ PyObject *attrib__struct_in_addr_get(strtypedef struct {PyObject_HEAD ; -libxl_ctx ctx; +libxl_ctx *ctx;xentoollog_logger_stdiostream *logger;xentoollog_level minmsglevel; }XlObject ;
@@ -381,7 +381,7 @@ static PyObject *pyxl_list_domains(XlObjPyObject *list;int nr_dom, i; - info =libxl_list_domain (&self->ctx, &nr_dom); + info =libxl_list_domain (self->ctx, &nr_dom);if (NULL == info )return PyList_New (0 );
@@ -416,7 +416,7 @@ static PyObject *pyxl_domid_to_name(XlObif ( !PyArg_ParseTuple (args,"i" , &domid) )return NULL ; - domname =libxl_domid_to_name (&self->ctx, domid); + domname =libxl_domid_to_name (self->ctx, domid); ret =PyString_FromString (domname);free (domname);
@@ -428,7 +428,7 @@ static PyObject *pyxl_domain_shutdown(Xlint domid, req =0 ;if ( !PyArg_ParseTuple (args,"i|i" , &domid, &req) )return NULL ; -if (libxl_domain_shutdown (&self->ctx, domid, req) ) { +if (libxl_domain_shutdown (self->ctx, domid, req) ) {PyErr_SetString (xl_error_obj,"cannot shutdown domain" );return NULL ; }
@@ -441,7 +441,7 @@ static PyObject *pyxl_domain_destroy(XlOint domid, force =1 ;if ( !PyArg_ParseTuple (args,"i|i" , &domid, &force) )return NULL ; -if (libxl_domain_destroy (&self->ctx, domid, force) ) { +if (libxl_domain_destroy (self->ctx, domid, force) ) {PyErr_SetString (xl_error_obj,"cannot destroy domain" );return NULL ; }
@@ -454,7 +454,7 @@ static PyObject *pyxl_domain_pause(XlObjint domid;if ( !PyArg_ParseTuple (args,"i" , &domid) )return NULL ; -if (libxl_domain_pause (&self->ctx, domid) ) { +if (libxl_domain_pause (self->ctx, domid) ) {PyErr_SetString (xl_error_obj,"cannot pause domain" );return NULL ; }
@@ -467,7 +467,7 @@ static PyObject *pyxl_domain_unpause(XlOint domid;if ( !PyArg_ParseTuple (args,"i" , &domid) )return NULL ; -if (libxl_domain_unpause (&self->ctx, domid) ) { +if (libxl_domain_unpause (self->ctx, domid) ) {PyErr_SetString (xl_error_obj,"cannot unpause domain" );return NULL ; }
@@ -481,7 +481,7 @@ static PyObject *pyxl_domain_rename(XlObint domid;if ( !PyArg_ParseTuple (args,"is|s" , &domid, &new_name, &old_name) )return NULL ; -if (libxl_domain_rename (&self->ctx, domid, old_name, new_name) ) { +if (libxl_domain_rename (self->ctx, domid, old_name, new_name) ) {PyErr_SetString (xl_error_obj,"cannot rename domain" );return NULL ; }
@@ -501,7 +501,7 @@ static PyObject *pyxl_pci_add(XlObject *return NULL ; } pci = (Py_device_pci *)obj; -if (libxl_device_pci_add (&self->ctx, domid, &pci->obj) ) { +if (libxl_device_pci_add (self->ctx, domid, &pci->obj) ) {PyErr_SetString (xl_error_obj,"cannot add pci device" );return NULL ; }
@@ -522,7 +522,7 @@ static PyObject *pyxl_pci_del(XlObject *return NULL ; } pci = (Py_device_pci *)obj; -if (libxl_device_pci_remove (&self->ctx, domid, &pci->obj, force) ) { +if (libxl_device_pci_remove (self->ctx, domid, &pci->obj, force) ) {PyErr_SetString (xl_error_obj,"cannot remove pci device" );return NULL ; }
@@ -544,7 +544,7 @@ static PyObject *pyxl_pci_parse(XlObjectreturn NULL ; } -if (libxl_device_pci_parse_bdf (&self->ctx, &pci->obj, str) ) { +if (libxl_device_pci_parse_bdf (self->ctx, &pci->obj, str) ) {PyErr_SetString (xl_error_obj,"cannot parse pci device spec (BDF)" );Py_DECREF (pci);return NULL ;
@@ -559,7 +559,7 @@ static PyObject *pyxl_pci_list_assignablPyObject *list;int nr_dev, i; -if (libxl_device_pci_list_assignable (&self->ctx, &dev, &nr_dev) ) { +if (libxl_device_pci_list_assignable (self->ctx, &dev, &nr_dev) ) {PyErr_SetString (xl_error_obj,"Cannot list assignable devices" );return NULL ; }
@@ -595,7 +595,7 @@ static PyObject *pyxl_pci_list(XlObjectif ( !PyArg_ParseTuple (args,"i" , &domid) )return NULL ; -if (libxl_device_pci_list_assigned (&self->ctx, &dev, domid, &nr_dev) ) { +if (libxl_device_pci_list_assigned (self->ctx, &dev, domid, &nr_dev) ) {PyErr_SetString (xl_error_obj,"Cannot list assignable devices" );return NULL ; }
@@ -663,7 +663,7 @@ static PyObject *PyXl_new(PyTypeObject *if (self ==NULL )return NULL ; -memset (&self->ctx,0 ,sizeof (self->ctx)); + self->ctx =NULL ; self->logger =NULL ; self->minmsglevel =XTL_PROGRESS ;
@@ -679,7 +679,7 @@ PyXl_init(XlObject *self, PyObject *argsreturn -1 ; } -if (libxl_ctx_init (&self->ctx,LIBXL_VERSION , +if (libxl_ctx_alloc (&self->ctx,LIBXL_VERSION , (xentoollog_logger *)self->logger) ) {PyErr_SetString (xl_error_obj,"cannot init xl context" );return -1 ;
@@ -690,7 +690,7 @@ PyXl_init(XlObject *self, PyObject *argsstatic void PyXl_dealloc (XlObject *self) { -libxl_ctx_free (&self->ctx); +libxl_ctx_free (self->ctx);if ( self->logger )xtl_logger_destroy ((xentoollog_logger *)self->logger);
Ian Jackson
AppliedIan Campbell writes ("[Xen-devel] [PATCH] libxl: do not expose libxenctrl/libxenstore headers via libxl.h"):
Quoted 7 lines
libxl: do not expose libxenctrl/libxenstore headers via
libxl.hThis completely removes libxenstore from libxl users' view.
xl still needs libxenctrl directly due to the direct use of the xentoollog functionality but it is not exposed to the indirect linkage anymore.
Applied.
Shame about the lack of API compatibility, but really the old was too awful.
Ian.
Quoted 7 lines
Quoted 1 line
Quoted 1 line · Ian Jackson
Ian Campbell writes ("[Xen-devel] [PATCH] libxl: do not expose libxenctrl/libxenstore headers via
libxl.h"):Quoted 4 lines
libxl: do not expose libxenctrl/libxenstore headers via
libxl.hThis completely removes libxenstore from libxl users' view.
Quoted 8 lines
Quoted 3 lines
xl still needs libxenctrl directly due to the direct use of the xentoollog functionality but it is not exposed to the indirect linkage anymore.
Applied.
Shame about the lack of API compatibility, but really the old was too awful.
Shouldn't API incompatible changes lead to immediate bumping of the major version of the affected shared library?
Jan
Quoted 11 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Ian Jackson
Ian Campbell writes ("[Xen-devel] [PATCH] libxl: do not expose libxenctrl/libxenstore headers via
libxl.h"):Quoted 7 lines
libxl: do not expose libxenctrl/libxenstore headers via
libxl.hThis completely removes libxenstore from libxl users' view.
xl still needs libxenctrl directly due to the direct use of the xentoollog functionality but it is not exposed to the indirect linkage anymore.
Quoted 7 lines
Quoted 4 lines
Applied.
Shame about the lack of API compatibility, but really the old was too awful.
Shouldn't API incompatible changes lead to immediate bumping of the major version of the affected shared library?
I guess so. I must admit I thought we had the policy (however ill-advised) of tying the SONAME to the Xen version, but I see that in the case of libxenlight we do actually have an independent SONAME.
I wasn't sure which digit of the major number I was supposed to increment so I went with the first... Perhaps a comment immediately prior to the variable could describe the requirements?
Anyway:
libxl: bump SONAME after binary incompatible change.
tools/libxl/Makefile +1 -1
@@ -5,7 +5,7 @@ XEN_ROOT = $(CURDIR)/../.. include $(XEN_ROOT)/tools/Rules.mk -MAJOR = 1.0 +MAJOR = 2.0 MINOR = 0 XLUMAJOR = 1.0
Quoted 21 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 11 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Ian Jackson
Ian Campbell writes ("[Xen-devel] [PATCH] libxl: do not expose libxenctrl/libxenstore headers via
libxl.h"):Quoted 7 lines
libxl: do not expose libxenctrl/libxenstore headers via
libxl.hThis completely removes libxenstore from libxl users' view.
xl still needs libxenctrl directly due to the direct use of the xentoollog functionality but it is not exposed to the indirect linkage anymore.
Quoted 7 lines
Quoted 4 lines
Applied.
Shame about the lack of API compatibility, but really the old was too awful.
Shouldn't API incompatible changes lead to immediate bumping of the major version of the affected shared library?
Quoted 7 lines
I guess so. I must admit I thought we had the policy (however ill-advised) of tying the SONAME to the Xen version, but I see that in the case of libxenlight we do actually have an independent SONAME.
I wasn't sure which digit of the major number I was supposed to increment so I went with the first... Perhaps a comment immediately prior to the variable could describe the requirements?
Indeed, since changing either is fine from a compatibility perspective here. I rather wonder why (other than most other shared libraries) we store two numbers into SONAME in the binary.
Jan
Quoted 18 lines
Anyway:
libxl: bump SONAME after binary incompatible change.
Signed-off-by Ian Campbell <[email protected]>diff -r
21db129fe3d8tools/libxl/Makefiletools/libxl/Makefile +1
-1@@ -5,7 +5,7 @@ XEN_ROOT = $(CURDIR)/../.. include $(XEN_ROOT)/tools/Rules.mk -MAJOR = 1.0 +MAJOR = 2.0 MINOR = 0 XLUMAJOR = 1.0
Ian Campbell writes ("Re: [Xen-devel] [PATCH] libxl: do not expose libxenctrl/libxenstore headers via libxl.h"):
Quoted 3 lines
I guess so. I must admit I thought we had the policy (however ill-advised) of tying the SONAME to the Xen version, but I see that in the case of libxenlight we do actually have an independent SONAME.
In general I think it's fair enough to bump the soname online once in each release cycle. But now is as good as any.
Quoted 3 lines
I wasn't sure which digit of the major number I was supposed to increment so I went with the first... Perhaps a comment immediately prior to the variable could describe the requirements?
I would suggest 1.1. I would normally increment the 2nd number of any shared library unless it was a complete rewrite or something.
Ian.
Quoted 8 lines · Ian Jackson
Ian Campbell writes ("Re: [Xen-devel] [PATCH] libxl: do not expose libxenctrl/libxenstore headers via
libxl.h"):Quoted 3 lines
I guess so. I must admit I thought we had the policy (however ill-advised) of tying the SONAME to the Xen version, but I see that in the case of libxenlight we do actually have an independent SONAME.
In general I think it's fair enough to bump the soname online once in each release cycle. But now is as good as any.
Quoted 6 lines
Quoted 3 lines
I wasn't sure which digit of the major number I was supposed to increment so I went with the first... Perhaps a comment immediately prior to the variable could describe the requirements?
I would suggest 1.1. I would normally increment the 2nd number of any shared library unless it was a complete rewrite or something.
I agree with you on the general principle but I suspect it is going to be almost a rewrite at the end of this development cycle :-/
Stefano Stabellini writes ("Re: [Xen-devel] [PATCH] libxl: do not expose libxenctrl/libxenstore headers via libxl.h"):
Quoted 2 lines
I agree with you on the general principle but I suspect it is going to be almost a rewrite at the end of this development cycle :-/
This is a good point; I have applied Ian's patch.
Ian.
Quoted 16 lines · Stefano Stabellini
Quoted 14 lines · Ian Jackson
Ian Campbell writes ("Re: [Xen-devel] [PATCH] libxl: do not expose libxenctrl/libxenstore headers via
libxl.h"):Quoted 4 lines
I guess so. I must admit I thought we had the policy (however ill-advised) of tying the SONAME to the Xen version, but I see that in the case of libxenlight we do actually have an independent SONAME.
In general I think it's fair enough to bump the soname online once in each release cycle. But now is as good as any.
Quoted 4 lines
I wasn't sure which digit of the major number I was supposed to increment so I went with the first... Perhaps a comment immediately prior to the variable could describe the requirements?
Quoted 7 lines
Quoted 3 lines
I would suggest 1.1. I would normally increment the 2nd number of any shared library unless it was a complete rewrite or something.
I agree with you on the general principle but I suspect it is going to be almost a rewrite at the end of this development cycle :-/
:-( For clients' sake, I hope the API stabilizes in 4.2 timeframe, and no backports to 4.1 break the API in that branch. IIRC, there have been other API-incompatible libxl changes since 4.1. Seems best for clients to target new releases (4.1, 4.2, ...) and expect branch releases (4.1.1, 4.1.2, ...) to have a stable API?
Regards,
Jim
libxl API changes for 4.2 (Was: Re: [PATCH] libxl: do not expose libxenctrl/libxenstore headers via libxl.h)
Quoted 6 lines · Jim Fehlig
Quoted 3 lines · Stefano Stabellini
I agree with you on the general principle but I suspect it is going to be almost a rewrite at the end of this development cycle :-/
:-( For clients' sake, I hope the API stabilizes in 4.2 timeframe,
We're sorry about this, the API in 4.1 isn't one we are comfortable supporting as a long term thing, it has some rough edges and various inconsistencies. There's a bit of a chicken and egg situation with the clients since sometimes you need to see what users are doing in practice in order to figure out what the best long term API is.
We hope to iron it out for the 4.2 release and have a more stable interface from then, although of course the API will still evolve, but more slowly and the intention is to try and preserve compatibility where possible.
Quoted 1 line
and no backports to 4.1 break the API in that branch.
I think that's something we should be avoiding.
Quoted 2 lines
IIRC, there have been
other API-incompatible libxl changes since 4.1.
Yes, there have.
The removal of the domid field from the devices springs to mind (in many cases you can omit setting it even on 4.1 though, as it happens). So does the change of the ctx type from a struct to an opaque pointer (the parent thread of this mail).
Going forward these are the things which spring to mind for 4.2:
Some of the enum value names will also be changed to allow them to be more consistently autogenerated (although a compat.h style thing could help here).
A related change is the fixing of the TaggedUnion type in the idl into something with semantics which map onto language bindings in a sensible way.
The specification of specific hvmloader and qemu-dm binaries is also likely to be deprecated soon, the user will just need to ask for old or new qemu and libxl will figure the rest out (it will still be possible to override if desired)
I've also been wondering what can/should be done about the split between libxl_domain_create_info, libxl_domain_build_info and libxl_device_model_info now that they are all bundled together in libxl_domain_config and not exposed directly in the API (since the related functions became internal, that was before 4.1). It seems like there ought to be scope for collapsing those datastructures somewhat but I'm not sure how yet.
The topologyinfo datastructure should be a list of tuples, not a tuple of lists.
The API seems to expose a bunch of console related datastructures but not much in the way of functions to do anything with them. One of those must be wrong.
I think IanJ wants to fixup the event API as well, it's a bit barking at the moment.
IanJ is also going to be looking at the handling of storage backends, I expect that is moistly going to be internal to the library but it might have an impact on the API too.
Quoted 3 lines
Seems best for clients
to target new releases (4.1, 4.2, ...) and expect branch releases (4.1.1, 4.1.2, ...) to have a stable API?
That seems like a reasonable expectation to me.
Ian.
Re: libxl API changes for 4.2 (Was: Re: [PATCH] libxl: do not expose libxenctrl/libxenstore headers via libxl.h)
Quoted 7 lines · Ian Campbell
Quoted 4 lines · Jim Fehlig
Stefano Stabellini wrote:
Seems best for clients
to target new releases (4.1, 4.2, ...) and expect branch releases (4.1.1, 4.1.2, ...) to have a stable API?That seems like a reasonable expectation to me.
Any user of libxl should be able to ask for the API version and can have different backends for the different API versions then.
Christoph
Signature · 6 lines
---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85689 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
Re: libxl API changes for 4.2 (Was: Re: [PATCH] libxl: do not expose libxenctrl/libxenstore headers via libxl.h)
Quoted 11 lines · Christoph Egger
Quoted 7 lines · Ian Campbell
Quoted 4 lines · Jim Fehlig
Stefano Stabellini wrote:
Seems best for clients
to target new releases (4.1, 4.2, ...) and expect branch releases (4.1.1, 4.1.2, ...) to have a stable API?That seems like a reasonable expectation to me.
Any user of libxl should be able to ask for the API version and can have different backends for the different API versions then.
In an ideal world, sure. I don't think we have the manpower, test throughput, etc to implement this sort of scheme for the changes made post-4.1. Perhaps once the API stabilizes this will become more plausible.
Ian.
Re: libxl API changes for 4.2 (Was: Re: [PATCH] libxl: do not expose libxenctrl/libxenstore headers via libxl.h)
Ian Campbell writes ("Re: libxl API changes for 4.2 (Was: Re: [Xen-devel] [PATCH] libxl: do not expose libxenctrl/libxenstore headers via libxl.h)"):
Quoted 7 lines
Quoted 2 lines
Any user of libxl should be able to ask for the API version and can have different backends for the different API versions then.
In an ideal world, sure. I don't think we have the manpower, test throughput, etc to implement this sort of scheme for the changes made post-4.1. Perhaps once the API stabilizes this will become more plausible.
There is already a LIBXL_VERSION #define which could be used for this, but I agree with Ian that it's probably going to be too hard to make code which can compile against 4.1 /and/ 4.2.
Ian.
libxl API changes for 4.2 (Was: Re: [PATCH] libxl: do not expose libxenctrl/libxenstore headers via libxl.h)
In reply to Ian CampbellIan Campbell writes ("libxl API changes for 4.2 (Was: Re: [Xen-devel] [PATCH] libxl: do not expose libxenctrl/libxenstore headers via libxl.h)"):
Quoted 5 lines
We're sorry about this, the API in 4.1 isn't one we are comfortable supporting as a long term thing, it has some rough edges and various inconsistencies. There's a bit of a chicken and egg situation with the clients since sometimes you need to see what users are doing in practice in order to figure out what the best long term API is.
My apologies too.
Quoted 4 lines
We hope to iron it out for the 4.2 release and have a more stable interface from then, although of course the API will still evolve, but more slowly and the intention is to try and preserve compatibility where possible.
Indeed so.
Quoted 2 lines
I think IanJ wants to fixup the event API as well, it's a bit barking at the moment.
Yes, it's completely mad and needs to be redone.
Quoted 3 lines
IanJ is also going to be looking at the handling of storage backends, I expect that is moistly going to be internal to the library but it might have an impact on the API too.
Indeed so. It's likely to make domain creation in principle asynchronous, since we want to call out to scripts which might block.
Quoted 5 lines
Quoted 3 lines
Seems best for clients to target new releases (4.1, 4.2, ...)
and expect branch releases (4.1.1, 4.1.2, ...) to have a stable API?That seems like a reasonable expectation to me.
Yes. And, we hope the changes after 4.2 will be much smaller although it will depend on how many of our fixes we manage to get into 4.1.
Ian.
Re: libxl API changes for 4.2 (Was: Re: [PATCH] libxl: do not expose libxenctrl/libxenstore headers via libxl.h)
In reply to Ian CampbellQuoted 17 lines · Ian Campbell
Quoted 8 lines · Jim Fehlig
Quoted 4 lines · Stefano Stabellini
I agree with you on the general principle but I suspect it is going to be almost a rewrite at the end of this development cycle :-/
:-( For clients' sake, I hope the API stabilizes in 4.2 timeframe,
We're sorry about this, the API in 4.1 isn't one we are comfortable supporting as a long term thing, it has some rough edges and various inconsistencies. There's a bit of a chicken and egg situation with the clients since sometimes you need to see what users are doing in practice in order to figure out what the best long term API is.
Quoted 5 lines
We hope to iron it out for the 4.2 release and have a more stable interface from then, although of course the API will still evolve, but more slowly and the intention is to try and preserve compatibility where possible.
Great, thanks. It would be ideal for a client built against libxl4.2 to work with libxl4.3 :).
Quoted 6 lines
Quoted 3 lines
and no backports to 4.1 break the API in that branch.
I think that's something we should be avoiding.
This would be very helpful and much appreciated!
Quoted 18 lines
Quoted 4 lines
IIRC, there have been
other API-incompatible libxl changes since 4.1.Yes, there have.
The removal of the domid field from the devices springs to mind (in many cases you can omit setting it even on 4.1 though, as it happens). So does the change of the ctx type from a struct to an opaque pointer (the parent thread of this mail).
Going forward these are the things which spring to mind for 4.2:
Some of the enum value names will also be changed to allow them to be more consistently autogenerated (although a
compat.hstyle thing could help here).
Quoted 9 lines
A related change is the fixing of the TaggedUnion type in the idl into something with semantics which map onto language bindings in a sensible way.
The specification of specific hvmloader and qemu-dm binaries is also likely to be deprecated soon, the user will just need to ask for old or new qemu and libxl will figure the rest out (it will still be possible to override if desired)
Yep, ability to specify device model binary should be retained. I don't know of any users specifying a qemu-dm wrapper via device_model, but wouldn't be surprised if they exist.
Quoted 8 lines
I've also been wondering what can/should be done about the split between
libxl_domain_create_info,libxl_domain_build_infoandlibxl_device_model_infonow that they are all bundled together inlibxl_domain_configand not exposed directly in the API (since the related functions became internal, that was before 4.1). It seems like there ought to be scope for collapsing those datastructures somewhat but I'm not sure how yet.
I wonder if libxl_device_model_info even needs to be exposed? Generally speaking, the domain config consists of
metadata (name, uuid, description, etc.)
basic resources (cpu, memory, maxmemory, etc.)
OS booting info (order, loader, kernel/ramdisk) clock/timekeeping (clock offset, timer type, timer tick policy, etc.) lifecycle controls (what to do on reboot, shutdown, crash, etc.) devices (block, net, framebuffer, PCI, framebuffer, input, serial, parallel, etc.)
All of the device model info can be inferred from this configuration.
BTW, thanks for the heads up on these changes.
Regards,
Jim
Quoted 26 lines
The topologyinfo datastructure should be a list of tuples, not a tuple of lists.
The API seems to expose a bunch of console related datastructures but not much in the way of functions to do anything with them. One of those must be wrong.
I think IanJ wants to fixup the event API as well, it's a bit barking at the moment.
IanJ is also going to be looking at the handling of storage backends, I expect that is moistly going to be internal to the library but it might have an impact on the API too.
Quoted 4 lines
Seems best for clients
to target new releases (4.1, 4.2, ...) and expect branch releases (4.1.1, 4.1.2, ...) to have a stable API?That seems like a reasonable expectation to me.
Ian.
Re: libxl API changes for 4.2 (Was: Re: [PATCH] libxl: do not expose libxenctrl/libxenstore headers via libxl.h)
Quoted 11 lines · Jim Fehlig
Quoted 5 lines · Ian Campbell
The specification of specific hvmloader and qemu-dm binaries is also likely to be deprecated soon, the user will just need to ask for old or new qemu and libxl will figure the rest out (it will still be possible to override if desired)
Yep, ability to specify device model binary should be retained. I don't know of any users specifying a qemu-dm wrapper via
device_model, but wouldn't be surprised if they exist.
Although we won't be removing this functionality anyway it might be interesting to know what people use the ability to use a wrapper for. Perhaps they are things we can integrate as a more first class capability?
We could also switch to running a wrapper by default
(e.g. /etc/xen/scripts/device-model), shipping a version which just exec's the real binary but allowing folks to modify as they desire...
Quoted 20 lines
Quoted 8 lines
I've also been wondering what can/should be done about the split between
libxl_domain_create_info,libxl_domain_build_infoandlibxl_device_model_infonow that they are all bundled together inlibxl_domain_configand not exposed directly in the API (since the related functions became internal, that was before 4.1). It seems like there ought to be scope for collapsing those datastructures somewhat but I'm not sure how yet.I wonder if
libxl_device_model_infoeven needs to be exposed? Generally speaking, the domain config consists ofmetadata (name, uuid, description, etc.)
basic resources (cpu, memory, maxmemory, etc.)
OS booting info (order, loader, kernel/ramdisk) clock/timekeeping (clock offset, timer type, timer tick policy, etc.) lifecycle controls (what to do on reboot, shutdown, crash, etc.) devices (block, net, framebuffer, PCI, framebuffer, input, serial, parallel, etc.)
Quoted 1 line
All of the device model info can be inferred from this configuration.
I agree, I think there is a lot about the split between libxl_{create,build,device_model}_info and libxl_domain_build_state which can be rationalised now that the distinction is largely internal to the libxl_domain_{create,restore} functions instead of exposed via the previous libxl_domain_{create,build} API.
Quoted 1 line
BTW, thanks for the heads up on these changes.
No problems. Sorry it's such a long laundry list.
Another thing which came to mind is each device type we have exposes a different set of basic operations:
disks have add, del and a list function which returns a list of libxl_device_disk plus a libxl_device_disk_getinfo which takes a libxl_device_disk and returns libxl_diskinfo.
nics have add, del and a list function which returns a list of libxl_nicinfo directly with no way to get a list of libxl_device_nic.
vkb and vfb have add, clean_shutdown and hard_shutdown (and *_shutdown all return ERROR_NI).
PCI has add, remove and shutdown (==remove all devices) plus a couple of list functions with a different interface style to the disk/nic ones.
Console just has add. In principal the user can perhaps add additional secondary console (perhaps even hotplug them) but in practice at the moment the usage is all internal to libxl_domain_create.
The disk and nic del functions both take a wait flag which really translates into !force (wait==0 means nuke the device without cooperation from the guest, wait==1 means do a graceful/cooperative remove and wait for it to complete, there is no way to do an async graceful removal). while the pci remove function has a force parameter.
Obviously I would like to transition this to a consistent set of interfaces across all devices. Additionally the operations which can interact with the guest likely need to have asynchronous versions (or possibly only asynchronous versions, with a sync wrapper). I'm thinking along the lines of the following for the base set of operations
add: pretty much as today, but add the option to do it asynchronously.
remove: replaces del and {clean,hard}_shutdown, has forced and non-forced variants. non-forced can be async.
list: takes a domid and returns a list of libxl_device_foo.
info: takes a libxl_device_foo and fills in a libxl_fooinfo (only exists for devices where further info is available)
The existing libxl_device_pci_shutdown (remove all) functionality could be internal or we could specify such an API for all devices. Not sure how useful that really is to libxl users, currently it is only used internal during domain destruction.
Another thing I'm considering is restricting the IDL's "integer" type to a signed 31 bit type. At least one language we want to bind (ocaml) has this restriction on its native int type and I suspect it won't be the only one. The explicit {u}int{16,32,64} types will remain for cases where we explicitly need the full ranges.
Ian.
Quoted 30 lines
Regards,
JimQuoted 26 lines
The topologyinfo datastructure should be a list of tuples, not a tuple of lists.
The API seems to expose a bunch of console related datastructures but not much in the way of functions to do anything with them. One of those must be wrong.
I think IanJ wants to fixup the event API as well, it's a bit barking at the moment.
IanJ is also going to be looking at the handling of storage backends, I expect that is moistly going to be internal to the library but it might have an impact on the API too.
Quoted 4 lines
Seems best for clients
to target new releases (4.1, 4.2, ...) and expect branch releases (4.1.1, 4.1.2, ...) to have a stable API?That seems like a reasonable expectation to me.
Ian.