Commit Graph
131 Commits
Author SHA1 Message Date
Stefano Stabellini 965936bc90 More consistent error handling in libxl
Lots of places in libxl return -1 as an error which is inconsistent with
libxl error codes since that is ERROR_VERSION. Also in other places the
xc_* function to implement a command is called but the return value is
either never checked or not passed on.

This patch introduces a new internal function libxl_xc_error() which
maps xc error codes to xl error codes. Callers of libxc functions are
converted to use this when returning error codes back to libxl callers.

Also a bug is fixed where a caller depends on errno being set but is
cleared by cleanup code which calls in to library functions which modify
errno as a side-effect.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
2010-07-19 18:40:09 +01:00
Stefano Stabellini a9c189d680 Implement xl dump-core
Implements dump-core command which is similar to xm dump-core except
that it requires an additional argument which is the target filename.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
2010-07-19 15:33:38 +01:00
Stefano Stabellini 402ddf4b39 This patch introduces libxl_primary_console_exec: a new libxl function
that finds the domid and console number corresponding to the primary
console of a given vm. The domid might be different from the domid of
the VM and the console number might not be 0 when using stubdoms.
The caller (xl_cmdimpl.c in this case) has to make sure that the stubdom
is already created before calling libxl_primary_console_exec in the hvm
case. In the PV case libxl_primary_console_exec has to be called before
libxl_run_bootloader.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-07-19 12:47:53 +01:00
Stefano Stabellini 870648146f Implement "xl tmem-freeable" to match "xm tmem-freeable".
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2010-07-19 12:20:41 +01:00
Ian Jackson 2587d9aa4e libxl: add function to attach/detach a disk to/from the local VM
Useful if you need to read a guest filesystem (e.g. pygrub).

I'm not overly thrilled with the implementation WRT tap interfaces,
particularly WRT to detach. I was unable to find a way to get at the
paramters necessary to call tap_ctl_destroy so I assumed for now it
that is OK to assume that the tap device is going to be wanted for the
actual domain at some point in the immediate future and hence there is
no pressing need to destroy it.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-07-14 16:44:18 +01:00
Ian Jackson 108be15853 libxl: support mapping files rather than carrying paths around
This will allow us to map and then unlink the file and therefore
delete the process on process exit or explicit unmap.

Using the mmaped versions of these files required rewriting build_pv
to use the xc_dom builder functionality directly rather than through
the xc_linux_build "compatibility layer". (The status of the
xc_linux_build interface as a compatibility layer seems a bit dubious
since all existing callers use it but if anything is going to replace
it then libxl seems like the likely candidate).

I'm not thrilled with the definition of the maps lifecycle. This could
be solved by adding a helper function to explicitly free the toplevel
structure.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-07-14 16:43:49 +01:00
Ian Jackson adb8dd8440 libxl, xl: exec xenconsole in current process, defer decision to fork to caller
Use this to run xenconsole as the foreground process and move the
connection to the console in the "create -c" case early enough to be
able to view output from the bootloader. This behaviour is consistent
with how both "xm console" and "xm create -c" operate.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-07-14 16:40:33 +01:00
Ian Jackson bba3b1da6e libxl: add libxl_strdup convenience function
Use in preference to libxl_sprintf(..., "%s", "...")

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-07-14 16:39:43 +01:00
Ian Jackson 1304d52120 libxl: add printf attribute to libxl_xs_write and fixup resulting warnings
There is an unfortunate warning for the empty format string by default
which I workaround by adding -Wno-format-zero-length.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-07-14 16:38:47 +01:00
Ian Jackson 7182d1d11b tools/libxl: Read soundhw option and pass it on to qemu
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-07-08 17:53:19 +01:00
Ian Jackson 4f5a16eb5c libxl: Specify no nics to qemu when no emulated nics
qemu will default to one emulated NIC if no network configuration is
specified on the command-line.  If there are no emualted NICs (i.e.,
no NICs or all NICs are PV), specify no nics to avoid getting an
emulated NIC by default.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2010-06-28 17:13:43 +01:00
Ian Jackson 28d7162231 libxl: Pass bridge config info into xenstore
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2010-06-28 17:10:38 +01:00
Ian Jackson e41d0dba09 libxl: support reset file on sysfs
Recent kernels have a reset file on sysfs per PCI device, to allow PCI
device reset from userspace.
This patch adds support to libxl for resetting PCI devices using the
reset file on sysfs, in case the do_flr file is not preset.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-06-23 17:05:31 +01:00
Keir Fraser fee4ddc4c2 libxl: give reasons for ctx init failures
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-06-18 14:07:42 +01:00
Keir Fraser bbeb2b7b83 libxl: blktap2 fix
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-06-11 12:35:47 +01:00
Keir Fraser 072efe5d47 libxl: Fix blktap2 for xl cset 21586:c3c2bcafe471
Avoids a double free on automatic memory.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
2010-06-11 09:35:25 +01:00
Keir Fraser 2b70283b61 libxl: Use libblktapctl.so
Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
2010-06-10 08:28:02 +01:00
Keir Fraser e1e4abdf2a libxl/xl: implement xen_platform_pci enable/disable
Implement xen_platform_pci support in xl/libxl to allow users to
disable the xen platform pci device from the VM config file.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-06-08 08:01:04 +01:00
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 2018b98c2f xl: network2-list command
Usage: xl network2-list <Domains>

Signed-off-by: Eric Chanudet <eric.chanudet@citrix.com>
2010-06-07 07:11:15 +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 ca896d0ca6 libxl/xl: fix multivcpu handling
Signed-off-by: Stefano Stabellini<stefano.stabellini@eu.citrix.com>
2010-06-04 10:14:06 +01:00
Keir Fraser c1d7e20205 xl: adds shutdown and reboot commands
libxl : remote shutdown to work for pure hvm domains

Signed-off-by: Gihan Munasinghe <GMunasinghe@flexiant.com>
2010-06-02 10:52:17 +01:00
Keir Fraser 81c0e00a2e libxl: fix domain suspend debug typo.
Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
2010-06-01 07:06:05 +01:00
Keir Fraser e693e5f1a7 tools: Build fixes.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-05-28 09:45:50 +01:00
Keir Fraser 1fe4b0e07c libxl: Use the caller's logger (xentoollog)
We now require callers to provide a xentoollog_logger* for
libxl_ctx_init, and use that for all our own logging and also for
xc_interface_open.

Corresponding change to xl.c.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-05-28 09:34:42 +01:00
Keir Fraser 4046aa9cbe libxl: Fix up some incorrect printf formats
We need to use PRIu32 for domids, and also to pass arguments in the
right order.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-05-28 09:31:43 +01:00
Keir Fraser 5cc436c1d2 libxc: eliminate static variables, use xentoollog; API change
This patch eliminate the global variables in libxenctrl (used for
logging and error reporting).

Instead the information which was in the global variables is now in a
new xc_interface* opaque structure, which xc_interface open returns
instead of the raw file descriptor; furthermore, logging is done via
xentoollog.

There are three new parameters to xc_interface_open to control the
logging, but existing callers can just pass "0" for all three to get
the old behaviour.

All libxc callers have been adjusted accordingly.

Also update QEMU_TAG for corresponding qemu change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-05-28 09:30:19 +01:00
Keir Fraser c53944ad66 xl: fix PCI resource parsing
The parsing of PCI resources has two problems:

   1. it assumes devices are 32-bits, whereas the fields in the
      "resources" file can have full 64-bit values
   2. it only parses the first resource because the format string is
      missing a \n

Fix both of these up, which allows my Intel 82574L to work with MSI-X.

However, this should probably be using a PCI access library rather
than rummaging around in /sys/bus/pci...

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
2010-05-28 08:10:48 +01:00
Keir Fraser a8ad76437e xl: Some small fixes
- When use mem-set, I got suspicious error output:
  # xl mem-set 1 256g
  setting domid 1 memory to : 268435456
  [0] libxl.c:2535:libxl_set_memory_target: memory_dynamic_max must be
  less than or equal to memory_static_max
  : Success
- String generated by strdup() should be freed
- When using 'xl help', mem-max and mem-set's output is not as intend,
  and it also breaks bash completion, fix it.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
2010-05-26 08:13:47 +01:00
Keir Fraser 4024bae739 xl: Add subcommand 'xl dmesg'
Can be used to read and/or clear dmesg buffer.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
2010-05-26 07:45:51 +01:00
Keir Fraser 00c08b5e07 xl: Add subcommand "xl debug-keys"
Can be used to send debug keys to Xen.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
2010-05-19 12:51:16 +01:00
Keir Fraser 5c898a05f4 libxl: Add tmem support commands
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
2010-05-19 12:48:32 +01:00
Keir Fraser 7e62eca7a1 libxl: Compilation and other small fixes
* Some of the library functions such as fscanf, system, and asprintf
are declared with warn_unused_result (ubuntu server 9.10), causing
compilation errors in libxl.
* When using asprintf, the caller is responsible for freeing the
memory.
* memset takes wrong size argument in one of the places (caught by
a builtin gcc check).

Signed-off-by: Dulloor Rao <dulloor@gmail.com>
2010-05-19 08:20:46 +01:00
Keir Fraser 1efc662aba libxl: Add missing start_time entry when create and restore VMs.
Signed-off-by: Yang Hongyang<yanghy@cn.fujitsu.com>
2010-05-15 08:27:22 +01:00
Keir Fraser 9fa16606cb xl: Add "xl uptime" command, a clone of "xm uptime".
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
2010-05-14 08:01:51 +01:00
Keir Fraser 3921297ea2 libxl: Adjustments to memset/memmax handling
I think xl memset should change the memory currently used by the guest
and xl memmax should change the size of the guest's address space and
not the population.  For this reason libxl_set_memory_target should
provide a way to enforce the memory target, calling
xc_domain_setmaxmem.  On the other hand xl memmax shouldn't call
xc_domain_setmaxmem because that is the upper bound of the memory
reservation, it should just change static-max, that at the moment
wouldn't do much, but we can imagine that in the future could trigger
something useful in the guest.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Jonathan Knowles <Jonathan.Knowles@eu.citrix.com>=20
2010-05-14 07:53:16 +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 a9733d50ff xl: Implement block-list command
Signed-off-by: Eric Chanudet <eric.chanudet@citrix.com>
2010-05-13 08:51:50 +01:00
Keir Fraser 742c6e551a xl: Implement network-list command
Signed-off-by: Eric Chanudet <eric.chanudet@citrix.com>
2010-05-13 08:48:35 +01:00
Keir Fraser 1a043dad2a xl: Implement network-attach
Signed-off-by: Eric Chanudet <eric.chanudet@citrix.com>
2010-05-13 08:46:57 +01:00
Keir Fraser c0910cbc5b xl: Add check for command 'xl mem-set'
Get max memory from /local/domain/$domid/memory/static-max, and then
do value check. The value larger than static-max is invalid.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
2010-05-12 08:53:27 +01:00
Keir Fraser bf4215becc xl: Add command 'xl mem-max'
Add subcommand 'xl mem-max', can be used to set static max memory

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
2010-05-12 08:52:59 +01:00
Keir Fraser c614ef19d3 xl: Add "xl sysrq" command, a clone of "xm sysrq".
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
2010-05-12 08:52:07 +01:00
Keir Fraser 1e560df12f xl: Add "xl trigger" command, a clone of "xm trigger".
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
2010-05-11 11:23:54 +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 dd41a2dae2 xl: ignore opengl unless sdl is enabled
The "opengl" setting is documented as having no effect unless "sdl" is
set.  Make sure this is honoured.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
2010-05-10 09:21:58 +01:00
Keir Fraser 9f92203e2c libxl: fix paths for non-standard installations
Attached patch removes hardcoded pathes and corrects wrong path to
qemu-dm.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-05-07 19:16:40 +01:00
Keir Fraser b87c206038 xl: Update memory info in xenstore when use 'xl mem-set'
'xl mem-set' should update memory info in xenstore's vm info.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-05-07 18:57:30 +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