aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_utils.c
Commit message (Collapse)AuthorAgeFilesLines
* libxl: introduce libxl_node_to_cpumapDario Faggioli2013-10-101-0/+22
| | | | | | | | As an helper for the special case (of libxl_nodemap_to_cpumap) when one wants the cpumap for just one node. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: correctly handle libxl_get_cpu_topology failure in libxl_{cpu, ↵Matthew Daley2013-10-031-2/+2
| | | | | | | | | | | | | node}map_to_{node, cpu}map Initialize nr_cpus to 0 so that if it is unchanged by a failing libxl_get_cpu_topology, libxl_cputopology_list_free still works OK afterward. Coverity-ID: 1055294 Coverity-ID: 1055295 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
* tools/libxl: fix array subscript has type 'char'Christoph Egger2013-05-311-1/+1
| | | | Signed-off-by: Christoph Egger <chegger@amazon.de>
* libxl: postpone backend name resolutionDaniel De Graaf2013-04-171-0/+19
| | | | | | | | | | | | | | | | | | | | This adds a backend_domname field in libxl devices that contain a backend_domid field, allowing either a domid or a domain name to be specified in the configuration structures. The domain name is resolved into a domain ID in the _setdefault function when adding the device. This change allows the backend of the block devices to be specified (which previously required passing the libxl_ctx down into the block device parser), and will simplify specification of backend domains in other users of libxl. The check on run_hotplug_scripts in parse_config_data is removed because it is a duplicate of the one in libxl__device_nic_setdefault, and is removed here because it no longer has the resolved domain ID to check. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> [ ijc -- reran flex ]
* libxl: add vtpm supportMatthew Fioravante2012-11-131-0/+43
| | | | | | | | | | | | This patch adds vtpm support to libxl. It adds vtpm parsing to config files and 3 new xl commands: vtpm-attach vtpm-detach vtpm-list Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* xl: do not leak cpupool names.Ian Campbell2012-09-141-0/+11
| | | | | | | | | | | | | | | | | | | | Valgrind reports: ==3076== 7 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==3076== at 0x402458C: malloc (vg_replace_malloc.c:270) ==3076== by 0x406F86D: libxl_cpupoolid_to_name (libxl_utils.c:102) ==3076== by 0x8058742: parse_config_data (xl_cmdimpl.c:639) ==3076== by 0x805BD56: create_domain (xl_cmdimpl.c:1838) ==3076== by 0x805DAED: main_create (xl_cmdimpl.c:3903) ==3076== by 0x804D39D: main (xl.c:285) And indeed there are several places where xl uses libxl_cpupoolid_to_name as a boolean to test if the pool name is valid and leaks the name if it is. Introduce an is_valid helper and use that instead. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Juergen Gross<juergen.gross@ts.fujitsu.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: introduce some node map helpersDario Faggioli2012-07-061-0/+44
| | | | | | | | | | | To allow for allocating a node specific libxl_bitmap (as it is for cpu number and maps). Helper unctions to convert a node map it its coresponding cpu map and vice versa are also implemented. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: expand the libxl_bitmap API a bitDario Faggioli2012-07-061-0/+30
| | | | | | | | By adding copying and *_is_full/*_is_empty facilities. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: rename libxl_cpumap to libxl_bitmapDario Faggioli2012-07-061-38/+29
| | | | | | | | | | | | | | | | | | | | | | | | And leave to the caller the burden of knowing and remembering what kind of bitmap each instance of libxl_bitmap is. This is basically just some s/libxl_cpumap/libxl_bitmap/ (and some other related interface name substitution, e.g., libxl_for_each_cpu) in a bunch of files, with no real functional change involved. A specific allocation helper is introduced, besides libxl_bitmap_alloc(). It is called libxl_cpu_bitmap_alloc() and is meant at substituting the old libxl_cpumap_alloc(). It is just something easier to use in cases where one wants to allocate a libxl_bitmap that is going to serve as a cpu map. This is because we want to be able to deal with both cpu and NUMA node maps, but we don't want to duplicate all the various helpers and wrappers. While at it, add the usual initialization function, common to all libxl data structures. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.eu.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl,libxc: introduce libxl_get_numainfo()Dario Faggioli2012-07-061-0/+13
| | | | | | | | | | | | | Make some NUMA node information available to the toolstack. Achieve this by means of xc_numainfo(), which exposes memory size and amount of free memory of each node, as well as the relative distances of each node to all the others. For properly exposing distances we need the IDL to support arrays. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: Do not pass NULL as gc_opt; introduce NOGCIan Jackson2012-06-281-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 25182:6c3345d7e9d9 the practice of passing NULL to gc-using memory allocation functions was introduced. However, the arrangements there were not correct as committed, because the error handling and logging depends on getting a ctx from the gc - so an allocation error would in fact result in libxl dereferencing NULL. Instead, provide a special dummy gc in the ctx, called `nogc_gc'. It is marked out specially by having alloc_maxsize==-1, which is otherwise invalid. Functions which need to actually look into the gc use the new test function gc_is_real (whose purpose is mainly clarity of the code) to check whether the gc is the dummy one, and do nothing if it is. And we provide a helper macro NOGC which uses the in-scope real gc to find the ctx and hence the dummy gc (and which replaces the previous #define NOGC NULL). Change all callers which pass 0 or NULL to an allocation function to use NOGC or &ctx->nogc_gc, as applicable in the context. We add a comment near the definition of LIBXL_INIT_GC pointing out that it isn't any more the only place a libxl__gc struct is initialised, for the benefit of anyone changing the contents of gc's in the future. Also, actually document that libxl__ptr_add is legal with ptr==NULL, and change a couple of calls not to check for NULL argument. Reported-by: Bamvor Jian Zhang <bjzhang@suse.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Bamvor Jian Zhang <bjzhang@suse.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: Add a gc to libxl_cpumap_alloc, ..._to_hex_stringIan Jackson2012-06-281-8/+20
| | | | | | | | | | | | | | | | | | | | | | | In the next patch we are going to change the definition of NOGC to require a local variable libxl__gc *gc. And this means that passing 0 to libxl__calloc is going to be wrong. libxl_cpumap_alloc doesn't have a gc but passes 0 to libxl_calloc Fix this by: - introducing an `out' label and an rc variable - replacing the returns with rc = ERROR_BLAH; goto out; - adding uses of GC_INIT and GC_FREE. - changing NULL to NOGC in the call to libxl__calloc Likewise fix libxl_cpumap_to_hex_string by: - adding a libxl_ctx* parameter and updating the one call site - adding uses of GC_INIT and GC_FREE. - changing NULL to NOGC in the call to libxl__zalloc Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Dario Faggioli <raistlin@linux.it> Acked-by: Roger Pau Monne <roger.pau@entel.upc.edu> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: allow setting more than 31 vcpusYang Zhang2012-06-281-1/+26
| | | | | | | | | | | | In current implementation, it uses integer to record current avail cpus and this only allows user to specify 31 vcpus. In following patch, it uses cpumap instead integer which make more sense than before. Also there is no limit to the max vcpus. Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: allow to allocate cpumap with specific sizeYang Zhang2012-06-281-6/+6
| | | | | | | | | | | | Currently, libxl_cpumap_alloc()allocate the cpumap with size of number of physical cpus. In some place, we may want to allocate specific size of cpumap. This patch allow to pass a argument to specific the size that you want to allocate. If pass 0, it means the size is equal to number of physical cpus. Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: add internal function to get a domain's schedulerIan Campbell2012-06-011-2/+9
| | | | | | | | | | | | | | | This takes into account cpupools. Add a helper to get the info for a single cpu pool, refactor libxl_list_cpupool t use this. While there fix the leaks due to not disposing the partial list on realloc failure in that function. Fix the failure of sched_domain_output to free the poolinfo list. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: add qdisk to libxl_string_to_backendStefano Stabellini2012-05-291-0/+2
| | | | | | Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: introduce libxl_vcpuinfo_list_freeDario Faggioli2012-05-291-0/+8
| | | | | | | And fix a leak due to it being missing. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* xl: Make clear distinction between "filename" and "data source"George Dunlap2012-05-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Many places in xl there's a variable or element named "filename" which does not contain a filename, but the source of the data for reporting purposes. Worse, there are variables which are sometimes actually used or interpreted as a filename depending on what other variables are set. This makes it difficult to tell when a string is purely cosmetic, and when another bit of code may actually attempt to call "open" with the string. This patch makes a consistent distinction between "filename" (which always refers to the name of an actual file, and may be interpreted as such at some point) and "source" (which may be a filename, or may be another data source such as a migration stream or saved data). This does add some variables and reshuffle where assignments happen; most notably, the "restore_filename" element of struct domain_create is now only set when restoring from a file. But at a high level, there should be no funcitonal changes. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: child processes cleanupsIan Jackson2012-05-111-21/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Abolish libxl_fork. Its only callers were in xl. Its functionality is now moved elsewhere, as follows: * The "logging version of fork", which is what it was billed as, is now xl_fork, which also dies on failure. * Closing the xenstore handle in the child is now done in libxl__ev_child_fork, which is the only remaining place where fork is called in libxl. * We provide a new function libxl__ev_child_xenstore_reopen for in-libxl children to make the ctx useable for xenstore again. * Consequently libxl__spawn_record_pid now no longer needs to mess about with its own xenstore handle. As a bonus it can now just use libxl__xs_write. Also, since we have now converted all the forkers in libxl, we can always honour the fork_replacement childproc hook - so do so. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: make libxl_create_logfile const-correctIan Jackson2012-05-111-1/+1
| | | | | | Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: Introduce libxl__sendmsg_fds and libxl__recvmsg_fdsIan Jackson2012-05-111-0/+104
| | | | | | | | | | | | Provide functions for sending and receiving fds. There used to be fd-sending functionality in libxl_qmp.c before 25298:84ae90427c54, which this implementation is partially derived from. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: provide libxl__remove_file et al.Ian Jackson2012-05-111-0/+79
| | | | | | | | | These utility functions cope with EINTR AND ENOENT, do error logging, and we provide a recursive version to delete whole directory trees. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: abolish libxl_ctx_postforkIan Jackson2012-04-111-7/+0
| | | | | | | | | | | | | libxl's task has become too complicated (particularly in the presence of both forking and multithreading) to support reuse of the same libxl_ctx after fork. So abolish libxl_ctx_fork. xl instead simply initialises a new libxl_ctx. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: generate a _dispose function for all Aggregate typesIan Campbell2012-03-011-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't special case types which we happen to know do not contain allocated data such that in the future if this changes we do not need to add an API. Although there is likely to be latent bugs in callers due to this having the API in old libraries mean that when callers are fixed they will not need to make special arrangements to handle old and new versions of the library. Adds dispose functions for: - libxl_dominfo - libxl_cpupoolinfo - libxl_physinfo - libxl_sched_credit - libxl_sched_credit2 I have attempted to fix any latent bugs in xl by inspection but have not bothered with libxl (on the basis that internally the library is allowed to make these sorts of assumptions and because it was looking like a very invasive job and that more would only creep in anyway). Several callsites use libxl_domain_info to check for the presence of a domain and throw away the actual info. As a convenience accept a NULL info pointer and just return the status. Also fix a memory leak in libxl_domain_list. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: Remove xen/sched.h from public interfaceIan Campbell2012-03-011-0/+7
| | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: remove sysctl.h from public interfaceIan Campbell2012-03-011-34/+0
| | | | | | | | | Using sysctl.h is restricted to "node control tools only" and requires magic defines. Therefore make its use internal to libxl. Also removes an indirect include of domctl.h which has the same restrction. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: drop libxl_cpuarray -- topology was the only user.Ian Campbell2012-01-311-24/+0
| | | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: expose cpu topology as a single list of cpu->{node,core,socket} maps.Ian Campbell2012-01-311-0/+8
| | | | | | | | | Rather than the previous tripple list which is more complicated to work with and harder for language bindings. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: move a lot more includes into libxl_internal.hIan Jackson2012-01-131-13/+2
| | | | | | | | | | | | | | | | | Move a lot of #include <stdfoo.h> from individual files into libxl_internal.h. This helps avoid portability mistakes where necessary system headers are omitted from individual files, and is also of course a convenience when developing. Also add #include "libxl_osdeps.h" /* must come before any other headers */ to the top of most libxl*.c files, so that anyone who adds any headers before libxl_internal.h will put the in the right place. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: Use GC_INIT and GC_FREE everywhereIan Jackson2011-12-121-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | Replace libxl__gc gc = LIBXL_INIT_GC(ctx); ... libxl__free_all(&gc); with GC_INIT(ctx); ... GC_FREE; throughout with a couple of perl runes. We must then adjust uses of the resulting gc for pointerness, which is mostly just replacing all occurrences of "&gc" with "gc". Also a couple of unusual uses of LIBXL_INIT_GC needed to be fixed up by hand. Here are those runes: perl -i -pe 's/\Q libxl__gc gc = LIBXL_INIT_GC(ctx);/ GC_INIT(ctx);/' tools/libxl/*.c perl -i -pe 's/\Q libxl__free_all(&gc);/ GC_FREE;/' tools/libxl/*.c Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: Rationalise #includesIan Jackson2011-12-121-1/+0
| | | | | | | | | | | | | | | | | | | | libxl_internal.h now #includes libxl.h and various system headers. This 1. makes the order of header inclusion more predictable 2. explicitly allows libxl_internal.h to use objects defined in libxl.h 3. removes the need for individual files to include these headers Also - remove some unnecessary #includes of libxl_utils.h, flexarray.h, etc. in some libxl*.c files, - include libxl_osdeps.h at the top of libxl_internal.h - add missing includes of libxl_osdeps.h to a couple of files - change libxl.h to libxl_internal.h in a couple of files Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: reimplement devid->disk in terms of from_xs_be function.Ian Campbell2011-10-181-44/+0
| | | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* libxl: reimplement devid->nic in terms of from_xs_be function.Ian Campbell2011-10-181-35/+0
| | | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* libxl: update nic list API to use common device API styleIan Campbell2011-10-181-9/+9
| | | | | | | | | libxl_device_nic_list returns an array of libxl_device_nic and libxl_device_nic_getinfo retrieves further information. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* libxl: idl: use "dispose" rather than "destroy" for function to free IDL typesIan Campbell2011-10-181-4/+4
| | | | | | | | | | | Destroy is an overloaded term which would commonly like to be used for actual destructive operations, such as destroying a domain etc. Dispose isn't a great term but it does the job. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* libxl: fixup incorrect indentationIan Campbell2011-10-121-0/+8
| | | | | | | | | Several places which were previsously indented using hard tabs are now incorrectly indented. Fix them up. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: fixup incorrect indentationIan Campbell2011-10-111-2/+2
| | | | | | | | | Several places which were previsously indented using hard tabs are now incorrectly indented. Fix them up. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: expand hard tab stopsIan Campbell2011-10-111-2/+2
| | | | | | | | | | | | | | | I ran the following and committed the result. ^I is an actual hard tab for i in $(grep -l --exclude=*_[ly].\[ch\] '^I' tools/libxl/*.[ch]) ; do cat $i | expand | sponge $i done There are some actually wrong indentations too, I'll fix those up manually. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: fix libxl_mac_to_device_nicIan Campbell2011-10-061-9/+5
| | | | | | | | | | | I think I broke this back in 22041:4c9ef5ec9146, using i as both the inner and outer loop iterator. I've added libxl__compare_macs which helps keep things clean. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: add and use parse_mac helper functionIan Campbell2011-10-061-15/+11
| | | | | | | | rather than open coding a bunch it a bunch of times. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: clean up trailing whitespaces in code.Wei Liu2011-07-191-1/+1
| | | | | | | | | Commit exactly the results of running find \! -iname '*.txt' -type f -print0 | xargs -0 perl -p -i.bak -E 's/\s+\n/\n/' Signed-off-by: Wei Liu <liuw@liuw.name> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: Accept disk name in libxl_devid_to_device_diskMarek Marczykowski2011-06-271-4/+4
| | | | | | | | | Accept disk name in xl block-detach. Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl> Acked-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: Allocate memory for strings in libxl_device_diskMarek Marczykowski2011-06-271-2/+4
| | | | | | | | | | | | Memory for strings in libxl_device_disk must be allocated from outside of libxl__gc to not be freed at the end of function (by libxl__free_all). Fixes xl block-detach Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl> Acked-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: autogenerate to_string and from_string functions for Enumerations.Ian Campbell2011-06-211-0/+14
| | | | | | | | | | | | The generated strings are the lower case enum value names, with underscores. Accepted string for parsing are the same but are case insensitive. We provide a table of strings->value for each Enumeration as well as a convenience function to perform a lookup. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: disks: rename disk param "unpluggable" to "removable"Ian Jackson2011-06-021-1/+1
| | | | | | | | | | | This property corresponds to what is called "removable" in xenstore, and is the conventional meaning of "removable": ie, the _media_ can be removed even as the _device_ remains present. "unpluggable" is a misleading name for this. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* tools: libxl: move all enum values into the libxl namespaceIan Campbell2011-04-201-5/+5
| | | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* tools: libxl: hide selection of device-model by default.Ian Campbell2011-04-201-83/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This should never have been exposed to users as something they are required to think about, unless they want to. At the libxl API level: * Add libxl_device_model_info.device_model_version allowing the user to say which qemu version (e.g. old qemu-xen or qemu upstream) they want for a domain. * Add libxl_device_model_info.device_model_stubdomain allowing the user to select stub or non-stub device model * Default both the device_model field to NULL and DTRT when building a domain with that value in those fields, but still allow libxl users to specify something explicit if they want. * Note that libxl_device_model_info.device_model, if specified, must now be a complete path. At the xl level: * Support a new "device_model_version" option which sets the new libxl_device_model_info.device_model_version field. This option is mandatory if device_model_override is used. * Support a new "device_model_stubdomain_override" option which allows the user to request stubdomain if desired. * WARN if an HVM guest cfg uses the "device_model" config option, and direct users to the "device_model_override" option if they really do not want the default. If the "device_model" directive contains "stubdom-db" then direct users to the "device_model_stubdomain_override" directive. The default qemu remains the existing qemu-xen based qemu-dm and stubdomain defaults to off. I chose the name "qemu-xen traditional" to refer to the existing Xen fork of qemu and simply "qemu-xen" to refer to the new device model based on qemu upstream. I suspect that the vast majority of users only have these config options because they've copied them from somewhere and they normally have no interest in which device model is used. Renaming the fields and warning when they are used makes these decisions internal. This will allow us to make decisions at a platform level regarding the preferred hvmloader, device model, stub domain etc without requiring everyone to change their configuration files. Adding a device model version to the API is intended to make it easy for users to select what they need without having to know about the paths to specific binaries etc. Most importantly it gets rid of the parsing of the output of qemu -h... It's not clear where upstream qemu will eventually be installed, I went with /usr/bin/qemu for now. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* libxl: drop domid field from libxl_device_*Ian Campbell2011-04-081-2/+0
| | | | | | | | | | | | | | | | | | All functions which add a device to a domain already take a domid argument and the callers typically write the same value to the structure right before making the call. Functions which delete a device typically do not but adding this field makes the interface more consistent anyway and all callers have the domid to hand. All functions which return a libxl device structure are given a domid as a paramter and the caller therefore already knows which domain it is dealing with. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl/xl: drop support for netchannel2Ian Campbell2011-04-081-69/+0
| | | | | | | | | | | | | | | | | netchannel2 was never widely deployed and no supported kernel includes either the front- or back-ends. The last known kernel with this support was the xen.git 2.6.31 branch which has been unsupported for ages. xl will warn the user if it spots a "vif2" configration item but otherwise support is completely removed. Work is ongoing to add the interesting features of netchannel2 as protocol extensions to netchannel1. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: Make all hidden/static functions take a gc not a ctxIan Campbell2011-03-151-3/+5
| | | | | | | | | | | | | | | | Also ensure that static and hidden functions use the libxl__ prefix not just libxl_ (in the case of static functions only when they use a libxl prefix to start with). This follows the policy described in libxl.h "libxl memory management". Based on a manual audit of: grep ^static tools/libxl/libxl*.[ch]| grep libxl_ctx grep libxl__ tools/libxl/*.h| grep libxl_ctx Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>