Commit Graph
26 Commits
Author SHA1 Message Date
Keir Fraser 2d50cfa6e1 xl: network2-detach command
Usage: xl network2-detach <Domain> <DevId>

Signed-off-by: Eric Chanudet <eric.chanudet@citrix.com>
2010-06-07 07:12:20 +01:00
Keir Fraser 1742e2a8ea xl: network2-attach command
Usage: xl network2-attach <Domain> [front_mac=<mac>]
[back_mac=<mac>]
[backend=<BackDomain>] [trusted=<0|1>] [back_trusted=<0|1>]
[bridge=<bridge>] [filter_mac=<0|1>] [front_filter_mac=<0|1>]
[pdev=<PDEV>] [max_bypasses=n]

Signed-off-by: Eric Chanudet <eric.chanudet@citrix.com>
2010-06-07 07:09:41 +01:00
Keir Fraser eac0f64d80 libxl: Check return codes of write/asprintf/daemon consistently.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-05-13 09:35:05 +01:00
Keir Fraser f4de8d0315 xl: Implement block-detach command
Signed-off-by: Eric Chanudet <eric.chanudet@citrix.com>
2010-05-13 08:52:47 +01:00
Keir Fraser d32239ba6e xl: Implement network-detach command
Signed-off-by: Eric Chanudet <eric.chanudet@citrix.com>
2010-05-13 08:49:41 +01:00
Keir Fraser 0e13089b14 libxl: More cpupool fixes.
Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
2010-05-11 08:39:01 +01:00
Keir Fraser c4826676c4 libxl: Support cpupools
Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
2010-05-07 09:36:58 +01:00
Keir Fraser e5f63f2ca9 xl: Remove some duplicated boilerplate. (Improves logging slightly.)
We remove six lines of boilerplate from the top of each function, and
instead have a single struct libxl_ctx which is initialised once at
the top of main.

Likewise we wrap domain_qualifier_to_domid in a new function
find_domain, which does the error handling, and stores the domid and
the specified name (if applicable).

This reduces the size of xl.c by 7% (!)

As a beneficial side effect, the earlier call to libxl_ctx_set_log in
main makes some lost messages appear.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-04-12 17:44:47 +01:00
Keir Fraser aa8978e2d9 xenstore,libxl: cleanup of xenstore connections across fork()
Provide a new function xs_daemon_destroy_postfork which can be called
by a libxenstore user who has called fork, to close the fd for the
connection to xenstored and free the memory, without trying to do
anything to any threads which libxenstore may have created.

Use this new function in libxl_fork, to avoid accidental use of a
xenstore connection in both parent and child.

Also, fix the doc comment for libxl_spawn_spawn to have the success
return codes the right way round.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-04-12 17:41:58 +01:00
Keir Fraser 25887df0de libxl: Expose functions for helping with subprocesses.
* Expose libxl_fork in libxl_utils.h
 * Expose libxl_pipe in libxl_utils.h
 * Make libxl_exec put SIGPIPE back (so that libxl callers may
    have SIGPIPE ignored)

xl would like to use libxl_fork (which is like fork(2) except that it
logs errors) and also a similar function libxl_pipe.  So put these in
libxl_utils.[ch] and use them in libxl.c as appropriate, to avoid
having to duplicate code between xl and libxl.

Also, make sure that subprocesses spawned by libxl have SIGPIPE set
back to SIG_DFL as they are entitled to expect.  This means that a
libxl caller which sets SIGPIPE to SIG_IGN is no longer buggy.  (This
is relevant for xl migration, because xl would like to be such a
caller.)

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-04-12 17:41:05 +01:00
Keir Fraser eb67817b17 libxl: New utility functions in for reading and writing files.
We introduce these functions in libxl_utils.h:

  int libxl_read_file_contents(struct libxl_ctx *ctx, const char
  *filename,
                               void **data_r, int *datalen_r);
  int libxl_read_exactly(struct libxl_ctx *ctx, int fd, void *data,
  ssize_t sz,
                         const char *filename, const char *what);
  int libxl_write_exactly(struct libxl_ctx *ctx, int fd, const void
  *data,
                          ssize_t sz, const char *filename, const char
  *what);

They will be needed by the following patches.  They have to be in
libxl.a rather than libxutil.a because they will be used, amongst
other places, in libxl itself.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-04-12 17:39:29 +01:00
Keir Fraser 4f7fb69661 libxl: Report error if logfile rotation fails
Check the return values from renames and errors from stat in
libxl_create_logfile (which, misleadingly, does not actually create
the logfile).

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-04-12 17:38:42 +01:00
Keir Fraser 24cdde59ca libxenlight: separate logically list_vm and list_domain
previously list_domain was something between listing VM and domains.
provide 2 separates API calls to list domains and list vms.  the list
vms API filters utility domains like stubdomains, and domain 0

change is_stubdom to properly check the integer and also return a
boolean value.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
2010-01-17 18:05:03 +00:00
Keir Fraser 0b5e4f99ae libxenlight: fix name to domid conversion.
also simplify massively the function that iterate over all domains to
find the corresponding domid to a name.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
2010-01-14 09:42:40 +00:00
Keir Fraser 696b09d8dd libxenlight: remove any uuid dependancies from xl
uuid handles in create and now create_device_model need to fill the
uuid field by client. the uuid field happens to be the exact same size
as the standard uuid (sixteen 8 bits values).

stubdom need to have a uuid when created, so using the one in
create_device_model.

this permits the client library to generate the uuid in any way it see
fits (even if it's not compliant to any standard), and simplify
installation of the libxenlight header.

xl converted from libuuid generated uuid to generated through random()
C call.  need to be fixed if anyone plan to use xl for anything
seriously apart from developing libxl.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
2010-01-05 08:39:40 +00:00
Keir Fraser 7b4effff89 libxenlight: implement cdrom insert/eject
This patch implements functions in libxenlight to change the cdrom in
a VM at run time and to handle cdrom eject requests from guests.

This patch adds two new commands to xl: cd-insert and cd-eject; it
also modifies xl to handle cdrom eject requests coming from guests
(actually coming from qemu).

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-12-08 07:47:52 +00:00
Keir Fraser 07443ee6da libxenlight: write stubdoms logs to file
It turns out that there is a better way to write stubdoms logs to file
than using libxl_console_attach: qemu is the one that provides the
console backend for stubdoms and qemu is able to redirect a serial to
file, so we can use this feature to make sure the first stubdom
console is always redirected to a logfile.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-12-02 08:45:16 +00:00
Keir Fraser f20744517f libxenlight: two small fixes
- set the domid of the guest and not the one of the stubdom in the
libxl_device_model_starting returned to the user;

- check that the length of the two strings matches in
libxl_name_to_domid, otherwise we can get a match for two different
domains that have the same initial part of the name.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-12-02 08:44:40 +00:00
Keir Fraser ca2b264d69 libxenlight: fix uuid code
- Use proper constants
- Use functions from the uuid library
- Fix broken pointer handling in libxl_dominfo

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.com>
2009-12-01 13:45:45 +00:00
Keir Fraser 1a2c608279 libxenlight: move logging macros to the public header
This patch moves the logging macros to the public header so that they
can be reused by the client of the library.  It also refactors the
code to create the qemu logfile into a generic function that can be
reused to create generic xen logfiles under /var/log/xen.  Finally xl
is changed to log to file when running in background.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-11-25 14:19:50 +00:00
Keir Fraser 24d568bab3 libxenlight: implement stubdom support
this patch implements stubdom support for libxenlight:

- it adds two functions to find the stubdom domid of a domain and to
figure out if a certain domain is actually a stubdom;

- it moves all the device init functions from xl.c to libxl.c because
they are needed to setup the devices of stubdoms;

- it fixes some bugs in the pci setup that prevented pci passthrough
from working correctly with stubdoms.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-11-25 14:11:37 +00:00
Keir Fraser cbc97d570c libxenlight: fix memory leaks
In particular:

- all the temporary flexarrays allocated in the create
  device functions must be freed;

- all the strings that don't need to be modified can be added as they
  are
  to these temporary flexarrays instead of duplicating them;

- any data returned to the user shouldn't be added to the global
  memory tracker so that the user can free it whenever he wishes.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-11-23 07:04:54 +00:00
Keir Fraser af7af769b9 libxenlight: correct broken osdeps.[ch] and make #includes consistent
osdeps.[hc] previously mistakenly declared and defined [v]asprintf.
These functions are available in the libc on most platforms.  Also,
osdeps.h is used by xc.c but xc.c is not part of the library, so
osdeps.h is part of the public interface and should have a better
name.

So now, instead:

 * osdeps.h is libxl_osdeps.h.

 * _GNU_SOURCE is #defined in libxl_osdeps.h so that we get the system
   [v]asprintf (and various other functions)

 * libxl_osdeps.h is included first in every libxl*.c file (it needs
   to be before any system headers so that _GNU_SOURCE) takes effect.

 * osdeps.[hc] only provide their own reimplementation of [v]asprintf
   if NEED_OWN_ASPRINTF is defined.  Currently it is not ever defined
   but this is provided for any platform which needs it.

 * While I was editing the #includes in each .c file, I put them all
   into the same order: "libxl_osdeps.h", then system headers,
   then local headers.

 * xs.h is included in libxl.h.  This is needed for "bool"; it has to
   not be typedefed in libxl.h because otherwise we get a duplicate
   definition when including xs.h.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2009-11-23 07:00:08 +00:00
Keir Fraser 35c1498503 libxenlight: fix name to domid conversion
This patch makes sure that the domain name to domid conversion is
correct, cross referencing the information found on xenstore with the
list of running domains.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-11-13 15:30:24 +00:00
Keir Fraser 66cc31ec35 tools: Make build again on netbsd
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-11-10 13:01:09 +00:00
Keir Fraser c5c301ac77 libxenlight: initial libxenlight implementation under tools/libxl
Signed-off-by: Vincent Hanquez <Vincent.Hanquez@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-11-09 19:54:28 +00:00