]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
13 years agovirsh: enhance snapshot-create-as
Eric Blake [Wed, 15 Jun 2011 22:24:40 +0000 (16:24 -0600)]
virsh: enhance snapshot-create-as

Similar to pool-create-as.

* tools/virsh.c (cmdSnapshotCreateAs): Add --print-xml.
* tools/virsh.pod: Document it.

13 years agovirsh: add snapshot-create-as command
Eric Blake [Wed, 15 Jun 2011 22:19:13 +0000 (16:19 -0600)]
virsh: add snapshot-create-as command

Producing an xml file just for name and description fields is
overkill; this makes life easier from virsh.

* tools/virsh.c (cmdSnapshotCreateAs): New command.
(snapshotCmds): Install it.
* tools/virsh.pod: Document it.

13 years agovirsh: clarify snapshot vs. save
Eric Blake [Wed, 15 Jun 2011 20:24:53 +0000 (14:24 -0600)]
virsh: clarify snapshot vs. save

* tools/virsh.c (info_snapshot_create, info_save): Clarify
description.
* tools/virsh.pod (save): Likewise.

13 years agoFix compile warnings in virsh vcpupin
Daniel P. Berrange [Mon, 20 Jun 2011 13:28:14 +0000 (14:28 +0100)]
Fix compile warnings in virsh vcpupin

The 'char *cur' variable was being assigned from a
'const char *' string, thus discarding constness.
As well as causing a compile warning, it masked a
piece of code which attempts to assign to the
previously const string.

* tools/virsh.c: Fix const-ness of 'cur' variable in vcpupin

13 years agoremote generator: Allow to annotate arrays with typecasts
Matthias Bolte [Thu, 16 Jun 2011 09:30:23 +0000 (11:30 +0200)]
remote generator: Allow to annotate arrays with typecasts

Removes special case code from the generator and handle additional
methods.

The generated version of remoteDispatchDomainPinVcpu(Flags) has no
length check, but this check was useless anyway as it was applied to
data that was already deserialized from its XDR form.

13 years agoremote: Handle functions that return optional strings
Matthias Bolte [Wed, 15 Jun 2011 18:03:45 +0000 (20:03 +0200)]
remote: Handle functions that return optional strings

13 years agoremote: Generate virDomainGetBlockPullInfo
Matthias Bolte [Wed, 15 Jun 2011 17:52:09 +0000 (19:52 +0200)]
remote: Generate virDomainGetBlockPullInfo

It was already generatable but skipped.

13 years agovcpupin: add vcpupin resetting feature to qemu driver
Taku Izumi [Fri, 10 Jun 2011 06:41:18 +0000 (15:41 +0900)]
vcpupin: add vcpupin resetting feature to qemu driver

Pinning to all physical cpus means resetting, hence it is preferable to
delete vcpupin setting of XML.

This patch changes qemu driver to delete vcpupin setting by invoking
virDomainVcpupinDel API when pinning the specified virtual cpu to
all host physical cpus.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
13 years agovcpupin: add virDomainVcpupinDel function
Taku Izumi [Fri, 10 Jun 2011 06:40:36 +0000 (15:40 +0900)]
vcpupin: add virDomainVcpupinDel function

This patch add the private API (virDomainVcpupinDel).
This API can delete the vcpupin setting of a specified virtual cpu.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
13 years agovcpupin: add reset option to virsh vcpupin command
Taku Izumi [Fri, 10 Jun 2011 06:39:38 +0000 (15:39 +0900)]
vcpupin: add reset option to virsh vcpupin command

When resetting vcpupin setting, we have to specify all host physical
cpus as a cpulist parameter of virsh vcpupin command. It's a little
tedious.

This patch changes to allow to receive the special keyword 'r' as a cpulist
parameter of virsh vcpupin command when resetting vcpupin setting.

If you set the following:

 # virsh vcpupin VM 0 r

the vcpu0 will be pinned to all physical cpus.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
13 years agovcpupin: improve vcpupin definition of virsh vcpupin
Taku Izumi [Fri, 10 Jun 2011 06:38:55 +0000 (15:38 +0900)]
vcpupin: improve vcpupin definition of virsh vcpupin

When using vcpupin command, we have to speficy comma-separated list as cpulist,
but this is tedious in case the number of phsycal cpus is large.
This patch improves this by introducing special markup "-" and "^" which are
similar to XML schema of "cpuset" attribute.

The example:

 # virsh vcpupin Guest 0 0-15,^8

 is identical to

 # virsh vcpupin Guest 0 0,1,2,3,4,5,6,7,9,10,11,12,13,14,15

NOTE: The expression is sequentially evaluated, so "0-15,^8" is not identical
to "^8,0-15".

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
13 years agoFix preprocessor indentation in nodeinfo.c
Matthias Bolte [Mon, 20 Jun 2011 08:39:09 +0000 (10:39 +0200)]
Fix preprocessor indentation in nodeinfo.c

13 years agoMove XenAPI driver to correct spec file section
Matthias Bolte [Thu, 16 Jun 2011 11:46:38 +0000 (13:46 +0200)]
Move XenAPI driver to correct spec file section

The XenAPI driver works like the ESX and PHyp driver by using its
own HTTPS based remote protocol.

13 years agonumatune: Add tests for numatune XML
Osier Yang [Mon, 20 Jun 2011 07:17:43 +0000 (15:17 +0800)]
numatune: Add tests for numatune XML

Only add tests for qemuxmlargvtest.c, as there is no qemu command line
for numatune XML, just want to make sure the XML could be validated
well.

13 years agonumatune: Support NUMA memory tuning in qemu driver
Osier Yang [Mon, 20 Jun 2011 07:16:16 +0000 (15:16 +0800)]
numatune: Support NUMA memory tuning in qemu driver

Implemented as setting NUMA policy between fork and exec as a hook,
using libnuma. Only support memory tuning on domain process currently.

For the nodemask out of range, will report soft warning instead of
hard error in libvirt layer. (Kernel will be silent as long as one
of set bit in the nodemask is valid on the host. E.g. For a host
has two NUMA nodes, kernel will be silent for nodemask "01010101").
So, soft warning is the only thing libvirt can do, as one might want
to specify the numa policy prior to a node that doesn't exist yet,
however, it may come as hotplug soon.

13 years agonumatune: Support persistent XML for numatune
Osier Yang [Mon, 20 Jun 2011 07:15:44 +0000 (15:15 +0800)]
numatune: Support persistent XML for numatune

* src/conf/domain_conf.h: Introduce one new struct for representing
NUMA tuning related stuffs.

* src/conf/domain_conf.c: Parse and format numatune XML.

13 years agonumatune: Add doc for new numatune XML
Osier Yang [Mon, 20 Jun 2011 07:15:05 +0000 (15:15 +0800)]
numatune: Add doc for new numatune XML

13 years agonumatune: Define XML schema
Osier Yang [Mon, 20 Jun 2011 07:13:25 +0000 (15:13 +0800)]
numatune: Define XML schema

Example XML:

<numatune>
  <memory mode="strict" nodeset="0-10,^4"/>
</numatune>

Please enter the commit message for your changes. Lines starting

13 years agoUpdate qemuDomainSetBlkioParameters to use flags
Hu Tao [Tue, 7 Jun 2011 06:03:09 +0000 (14:03 +0800)]
Update qemuDomainSetBlkioParameters to use flags

13 years agoupdate qemuDomainGetBlkioParameters to use flags
Hu Tao [Tue, 7 Jun 2011 06:03:08 +0000 (14:03 +0800)]
update qemuDomainGetBlkioParameters to use flags

13 years agoAdd new parameters for blkiotune
Hu Tao [Tue, 7 Jun 2011 06:03:07 +0000 (14:03 +0800)]
Add new parameters for blkiotune

Add --config, --live and --current for command blkiotune

13 years agobuild: fix building error when building without libvirtd
Wen Congyang [Mon, 20 Jun 2011 02:48:07 +0000 (10:48 +0800)]
build: fix building error when building without libvirtd

When building libvirt without libvirtd, we will receive the following error
message:

make[3]: Entering directory `/home/wency/rpmbuild/BUILD/libvirt-0.9.2/tools'
  CC     virsh-virsh.o
  CC     virsh-console.o
  GEN    virt-xml-validate
  GEN    virt-pki-validate
  CCLD   virsh
./src/.libs/libvirt.so: undefined reference to `numa_available'
./src/.libs/libvirt.so: undefined reference to `numa_max_node'
collect2: ld returned 1 exit status

The reason is that: we check numactl only when building qemu driver, and qemu
driver will not be built when bulding without libvirtd. So with_numactl's
value is check and we will not link libnuma.so.

In the other function, we call numa_available() and numa_max_node() only
when HAVE_NUMACTL is 1. We should do the same check in the function nodeGetMemoryStats().

13 years agoapparmor: implement AppArmorSetFDLabel()
Jamie Strandboge [Mon, 20 Jun 2011 03:53:24 +0000 (11:53 +0800)]
apparmor: implement AppArmorSetFDLabel()

During a savevm operation, libvirt will now use fd migration if qemu
supports it. When the AppArmor driver is enabled, AppArmorSetFDLabel()
is used but since this function simply returns '0', the dynamic AppArmor
profile is not updated and AppArmor blocks access to the save file. This
patch implements AppArmorSetFDLabel() to get the pathname of the file by
resolving the fd symlink in /proc, and then gives that pathname to
reload_profile(), which fixes 'virsh save' when AppArmor is enabled.

Reference: https://launchpad.net/bugs/795800

13 years agoAdd missing checks for NULL in domain lock manager
Daniel P. Berrange [Tue, 14 Jun 2011 08:05:54 +0000 (09:05 +0100)]
Add missing checks for NULL in domain lock manager

The domain lock manager forgot to include a bunch of checks
for NULL which could occur on OOM

* src/locking/domain_lock.c: Add checks for NULL

13 years agoFix errno return in safezero()
Daniel P. Berrange [Tue, 14 Jun 2011 08:07:39 +0000 (09:07 +0100)]
Fix errno return in safezero()

Most of the safezero() implementations return -1 on error,
setting errno. The safezero() impl using posix_fallocate()
though returned a positive errno value on error (due to
the unusual API contract of posix_fallocate() compared to
most syscall APIs).

* src/util/util.c: Ensure safezero() returns -1 and sets
  errno on error.
* src/storage/storage_backend.c: Change safezero != 0 to
  < 0 for detecting errors

13 years agoAdd missing error reporting when loading mac filter config for QEMU
Daniel P. Berrange [Tue, 14 Jun 2011 08:11:31 +0000 (09:11 +0100)]
Add missing error reporting when loading mac filter config for QEMU

If the 'mac_filter' configuration parameter is enabled, and there
is a failure to enable filtering, no error is reported back to
the caller. Also fix some bogus whitespace indentation for
hugetlbfs_mount

* src/qemu/qemu_conf.c: Add missing error reporting

13 years agovirsh: Add support for virDomainGetControlInfo
Jiri Denemark [Tue, 31 May 2011 16:21:58 +0000 (18:21 +0200)]
virsh: Add support for virDomainGetControlInfo

13 years agoqemu: Implement virDomainGetControlInfo
Jiri Denemark [Tue, 31 May 2011 16:34:20 +0000 (18:34 +0200)]
qemu: Implement virDomainGetControlInfo

13 years agoWire protocol and remote driver for virDomainGetControlInfo
Jiri Denemark [Tue, 31 May 2011 15:37:00 +0000 (17:37 +0200)]
Wire protocol and remote driver for virDomainGetControlInfo

13 years agoIntroduce virDomainGetControlInfo API
Jiri Denemark [Tue, 24 May 2011 08:28:50 +0000 (11:28 +0300)]
Introduce virDomainGetControlInfo API

The API can be used to query current state of an interface to VMM used
to control a domain. In QEMU world this translates into monitor
connection.

13 years agoFix documentation of virStreamRecv
Matthias Bolte [Wed, 15 Jun 2011 16:38:26 +0000 (18:38 +0200)]
Fix documentation of virStreamRecv

virStreamRecv is for reading.

Also add some missing punctuation to virStreamSend's documentation.

13 years agosendkey: use consistent API convention
Eric Blake [Wed, 15 Jun 2011 16:33:59 +0000 (10:33 -0600)]
sendkey: use consistent API convention

Even though rpc uses 'unsigned int' for the _len parameter that
passes the length of item<length>, the public libvirt APIs all
use 'int' and filter out lengths < 0, except for virDomainSendKey.

* include/libvirt/libvirt.h.in (virDomainSendKey): All other APIs
use int for array length.
* src/libvirt.c (virDomainSendKey): Adjust.
* src/driver.h (virDrvDomainSendKey): Likewise.
* daemon/remote_generator.pl: Likewise.

13 years agobuild: export correct function names
Eric Blake [Wed, 15 Jun 2011 17:23:51 +0000 (11:23 -0600)]
build: export correct function names

Detected by autobuild.sh, when targetting mingw.
Introduced in commit 98bfdff.

* src/libvirt_private.syms: Fix typos.

13 years agobuild: avoid compiler warning on non-Linux
Eric Blake [Wed, 15 Jun 2011 17:21:28 +0000 (11:21 -0600)]
build: avoid compiler warning on non-Linux

Detected by autobuild.sh when cross-building for mingw.
Introduced in commits ce76e85 and af35cec.

* src/nodeinfo.c (nodeGetCPUStats, nodeGetMemoryStats): Mark
parameters as potentially unused.

13 years agoremote generator: Handle struct returning functions better (part 2)
Matthias Bolte [Wed, 15 Jun 2011 15:34:19 +0000 (17:34 +0200)]
remote generator: Handle struct returning functions better (part 2)

Commit 64000eabedf2 is part 1, that only covered the daemon side by
accident. Part 2 covers the client side too.

13 years agoFix apibuild.py warnings about missing comment headers
Matthias Bolte [Wed, 15 Jun 2011 10:32:19 +0000 (12:32 +0200)]
Fix apibuild.py warnings about missing comment headers

Also improve wording of some comments.

13 years agoremote generator: Handle struct returning functions better
Matthias Bolte [Wed, 15 Jun 2011 13:38:31 +0000 (15:38 +0200)]
remote generator: Handle struct returning functions better

The position of the struct parameter in the function signature
differs. Instead of hardcoding the handling for this add an annotation
to the .x file to define the position.

13 years agosupport for Xen HVM Viridian (Hyper-V) enlightenment interface
Daniel Gollub [Wed, 15 Jun 2011 13:27:43 +0000 (15:27 +0200)]
support for Xen HVM Viridian (Hyper-V) enlightenment interface

Introduce libvirt support for Xen HVM Viridian (Hyper-V) enlightenment
interface guest feature.

 src/conf/domain_conf.c     |    3 ++-
 src/conf/domain_conf.h     |    1 +
 src/xen/xen_hypervisor.c   |   11 +++++++++++
 src/xenapi/xenapi_driver.c |    2 ++
 src/xenapi/xenapi_utils.c  |    2 ++
 src/xenxs/xen_sxpr.c       |    4 ++++
 src/xenxs/xen_xm.c         |   12 +++++++++++-
 7 files changed, 33 insertions(+), 2 deletions(-)

13 years agovirsh: reduce complexity in argv iteration
Eric Blake [Tue, 14 Jun 2011 17:26:20 +0000 (11:26 -0600)]
virsh: reduce complexity in argv iteration

This reduces things from O(n^2) to O(n).

* tools/virsh.c (vshCommandOptArgv): Change signature.
(cmdEcho): Update caller.
Based on a patch by Lai Jiangshan.

13 years agoAdd support for network filter code in LXC driver
Daniel P. Berrange [Tue, 7 Jun 2011 13:29:08 +0000 (14:29 +0100)]
Add support for network filter code in LXC driver

The LXC driver networking uses veth device pairs. These can
be easily hooked into the network filtering code.

* src/lxc/lxc_driver.c: Add calls to setup/teardown nwfilter

13 years agoFix allocation of veth's to not skip an index
Daniel P. Berrange [Tue, 7 Jun 2011 13:26:48 +0000 (14:26 +0100)]
Fix allocation of veth's to not skip an index

The algorithm for autoassigning vethXXX devices, was always
skipping over the starting dev index when finding a free
name for the guest device. This should only be done if the host
device was autoallocated.

* src/lxc/veth.c: Don't skip over veth indexes

13 years agoqemu: Translate boot config into bootindex if possible
Jiri Denemark [Thu, 26 May 2011 14:15:01 +0000 (17:15 +0300)]
qemu: Translate boot config into bootindex if possible

Prefer bootindex=N option for -device over the old way -boot ORDER
possibly accompanied with boot=on option for -drive. This gives us full
control over which device will actually be used for booting guest OS.
Moreover, if qemu doesn't support boot=on, this is the only way to boot
of certain disks in some configurations (such as virtio disks when used
together IDE disks) without transforming domain XML to use per device
boot elements.

13 years agoAsynchronous event for BlockPull completion
Adam Litke [Tue, 14 Jun 2011 14:36:53 +0000 (09:36 -0500)]
Asynchronous event for BlockPull completion

When an operation started by virDomainBlockPullAll completes (either with
success or with failure), raise an event to indicate the final status.  This
allows an API user to avoid polling on virDomainBlockPullInfo if they would
prefer to use the event mechanism.

* daemon/remote.c: Dispatch events to client
* include/libvirt/libvirt.h.in: Define event ID and callback signature
* src/conf/domain_event.c, src/conf/domain_event.h,
  src/libvirt_private.syms: Extend API to handle the new event
* src/qemu/qemu_driver.c: Connect to the QEMU monitor event
  for block_stream completion and emit a libvirt block pull event
* src/remote/remote_driver.c: Receive and dispatch events to application
* src/remote/remote_protocol.x: Wire protocol definition for the event
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c: Watch for BLOCK_STREAM_COMPLETED event
  from QEMU monitor

Signed-off-by: Adam Litke <agl@us.ibm.com>
13 years agoEnable virDomainBlockPull in the python API.
Adam Litke [Tue, 14 Jun 2011 14:36:52 +0000 (09:36 -0500)]
Enable virDomainBlockPull in the python API.

virDomainBlockPullAll and virDomainBlockPullAbort are handled automatically.
virDomainBlockPull and virDomainBlockPullInfo require manual overrides since
they return a custom type.

* python/generator.py: reenable bindings for this entry point
* python/libvirt-override-api.xml python/libvirt-override.c:
  manual overrides

Signed-off-by: Adam Litke <agl@us.ibm.com>
Acked-by: Daniel P. Berrange <berrange@redhat.com>
13 years agoEnable the virDomainBlockPull API in virsh
Adam Litke [Tue, 14 Jun 2011 14:36:51 +0000 (09:36 -0500)]
Enable the virDomainBlockPull API in virsh

Define two new virsh commands:
 * blockpull: Perform block pull operations (incremental plus start
              and stop continuous streams)
 * blockpullinfo: Retrieve progress info for continuous block pull

Share print_job_progress() with the migration code.

* tools/virsh.c: implement the new commands

Signed-off-by: Adam Litke <agl@us.ibm.com>
13 years agoImplement virDomainBlockPull for the qemu driver
Adam Litke [Tue, 14 Jun 2011 14:36:50 +0000 (09:36 -0500)]
Implement virDomainBlockPull for the qemu driver

The virDomainBlockPull* family of commands are enabled by the
'block_stream' and 'info block_stream' qemu monitor commands.

* src/qemu/qemu_driver.c src/qemu/qemu_monitor_text.[ch]: implement disk
  streaming by using the stream and info stream text monitor commands
* src/qemu/qemu_monitor_json.[ch]: implement commands using the qmp monitor

Signed-off-by: Adam Litke <agl@us.ibm.com>
Acked-by: Daniel P. Berrange <berrange@redhat.com>
13 years agoAdd virDomainBlockPull support to the remote driver
Adam Litke [Tue, 14 Jun 2011 14:36:49 +0000 (09:36 -0500)]
Add virDomainBlockPull support to the remote driver

The generator can handle DomainBlockPullAll and DomainBlockPullAbort.
DomainBlockPull and DomainBlockPullInfo must be written by hand.

* src/remote/remote_protocol.x: provide defines for the new entry points
* src/remote/remote_driver.c daemon/remote.c: implement the client and
  server side
* src/remote_protocol-structs: structure definitions for protocol verification

Signed-off-by: Adam Litke <agl@us.ibm.com>
13 years agovirDomainBlockPull: Implement the main entry points
Adam Litke [Tue, 14 Jun 2011 14:36:48 +0000 (09:36 -0500)]
virDomainBlockPull: Implement the main entry points

* src/libvirt.c: implement the main entry points

Signed-off-by: Adam Litke <agl@us.ibm.com>
Acked-by: Daniel P. Berrange <berrange@redhat.com>
13 years agoAdd new API virDomainBlockPull* to headers
Adam Litke [Thu, 9 Jun 2011 17:10:07 +0000 (12:10 -0500)]
Add new API virDomainBlockPull* to headers

Set up the types for the block pull functions and insert them into the
virDriver structure definition.  Symbols are exported in this patch to prevent
documentation compile failures.

* include/libvirt/libvirt.h.in: new API
* src/driver.h: add the new entry to the driver structure
* python/generator.py: fix compiler errors, the actual python bindings are
  implemented later
* src/libvirt_public.syms: export symbols

Signed-off-by: Adam Litke <agl@us.ibm.com>
13 years agospice: add <clipboard copypaste='yes|no'> option
Marc-André Lureau [Tue, 14 Jun 2011 11:35:48 +0000 (13:35 +0200)]
spice: add <clipboard copypaste='yes|no'> option

From a security pov copy and paste between the guest and the client is not
always desirable. So we need to be able to enable/disable this. The best place
to do this from an administration pov is on the hypervisor, so the qemu cmdline
is getting a spice disable-copy-paste option, see bug 693645. Example qemu
invocation:
qemu -spice port=5932,disable-ticketing,disable-copy-paste

https://bugzilla.redhat.com/show_bug.cgi?id=693661

13 years agovirNodeGetMemoryStats: Implement linux support
Minoru Usui [Tue, 7 Jun 2011 01:11:17 +0000 (10:11 +0900)]
virNodeGetMemoryStats: Implement linux support

Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
13 years agovirNodeGetMemoryStats: Implement virsh support
Minoru Usui [Tue, 7 Jun 2011 01:09:15 +0000 (10:09 +0900)]
virNodeGetMemoryStats: Implement virsh support

Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
13 years agovirNodeGetMemoryStats: Implement remote protocol
Minoru Usui [Tue, 7 Jun 2011 01:05:40 +0000 (10:05 +0900)]
virNodeGetMemoryStats: Implement remote protocol

Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
13 years agovirNodeGetMemoryStats: Implement public API
Minoru Usui [Tue, 7 Jun 2011 01:04:54 +0000 (10:04 +0900)]
virNodeGetMemoryStats: Implement public API

Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
13 years agovirNodeGetMemoryStats: Define internal driver API
Minoru Usui [Tue, 7 Jun 2011 01:04:12 +0000 (10:04 +0900)]
virNodeGetMemoryStats: Define internal driver API

Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
13 years agovirNodeGetMemoryStats: Expose new API
Minoru Usui [Tue, 7 Jun 2011 01:03:36 +0000 (10:03 +0900)]
virNodeGetMemoryStats: Expose new API

Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
13 years agovirNodeGetCPUStats: Implement linux support
Minoru Usui [Tue, 7 Jun 2011 01:02:55 +0000 (10:02 +0900)]
virNodeGetCPUStats: Implement linux support

Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
13 years agovirNodeGetCPUStats: Implement virsh support
Minoru Usui [Tue, 7 Jun 2011 01:02:13 +0000 (10:02 +0900)]
virNodeGetCPUStats: Implement virsh support

Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
13 years agovirNodeGetCPUStats: Implement remote protocol
Minoru Usui [Tue, 7 Jun 2011 01:01:12 +0000 (10:01 +0900)]
virNodeGetCPUStats: Implement remote protocol

Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
13 years agovirNodeGetCPUTime: Implement public API
Minoru Usui [Tue, 7 Jun 2011 01:00:23 +0000 (10:00 +0900)]
virNodeGetCPUTime: Implement public API

Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
13 years agovirNodeGetCPUStats: Define internal driver API
Minoru Usui [Tue, 7 Jun 2011 00:59:44 +0000 (09:59 +0900)]
virNodeGetCPUStats: Define internal driver API

Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
13 years agovirNodeGetCPUStats: Expose new API
Minoru Usui [Tue, 7 Jun 2011 00:58:47 +0000 (09:58 +0900)]
virNodeGetCPUStats: Expose new API

Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
13 years agoSkip nodeinfo test on non intel architectures
Guido Günther [Sun, 12 Jun 2011 19:57:01 +0000 (21:57 +0200)]
Skip nodeinfo test on non intel architectures

since the testfiles assume a /proc/cpuinfo specific to this
architecture. We e.g. can't parse the number of cores on other
architectures.

13 years agoFix autostart flag when loading running domains
Michael Chapman [Mon, 13 Jun 2011 03:05:45 +0000 (13:05 +1000)]
Fix autostart flag when loading running domains

Drivers load running persistent and transient domain configs before
inactive persistent domain configs, however only the latter would set a
domain's autostart flag. This mismatch between the loaded and on-disk
state could later cause problems with "virsh autostart":

  # virsh autostart example
  error: Failed to mark domain example as autostarted
  error: Failed to create symlink '/etc/libvirt/qemu/autostart/example.xml to '/etc/libvirt/qemu/example.xml': File exists

This patch ensures the autostart flag is set correctly even when the
domain is already defined.

Fixes:

  https://bugzilla.redhat.com/show_bug.cgi?id=632100
  https://bugzilla.redhat.com/show_bug.cgi?id=675319

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
13 years agosend-key: Implementing the remote protocol
Lai Jiangshan [Tue, 7 Jun 2011 09:11:15 +0000 (17:11 +0800)]
send-key: Implementing the remote protocol

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
13 years agosend-key: Implementing the public API
Lai Jiangshan [Tue, 7 Jun 2011 09:11:14 +0000 (17:11 +0800)]
send-key: Implementing the public API

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
13 years agosend-key: Defining the internal API
Lai Jiangshan [Tue, 7 Jun 2011 09:11:13 +0000 (17:11 +0800)]
send-key: Defining the internal API

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
13 years agosend-key: Defining the public API
Lai Jiangshan [Tue, 7 Jun 2011 09:11:12 +0000 (17:11 +0800)]
send-key: Defining the public API

Add public virDomainSendKey() and enum libvirt_keycode_set
for the @codeset.

Python version of virDomainSendKey() has not been implemented yet,
it will be done soon.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
13 years agoremote generator: Handle (unsigned) int arrays
Lai Jiangshan [Tue, 7 Jun 2011 09:11:11 +0000 (17:11 +0800)]
remote generator: Handle (unsigned) int arrays

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
13 years agoadd VSH_OFLAG_REQ_OPT options
Lai Jiangshan [Tue, 7 Jun 2011 09:11:10 +0000 (17:11 +0800)]
add VSH_OFLAG_REQ_OPT options

A VSH_OFLAG_REQ_OPT option means --optionname is required when used.
It will kill any ambiguity, even a !VSH_OFLAG_REQ option listed before
a VSH_OFLAG_REQ option, if the !VSH_OFLAG_REQ option is a
VSH_OFLAG_REQ_OPT option.

It will help us use optional argument with VSH_OT_ARGV argument.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
13 years agoallow name for VSH_OT_ARGV options
Lai Jiangshan [Tue, 7 Jun 2011 09:11:08 +0000 (17:11 +0800)]
allow name for VSH_OT_ARGV options

A name will improve the usege, example

# virsh help echo
  NAME
    echo - echo arguments

  SYNOPSIS
    echo [--shell] [--xml] [<string>]...

  DESCRIPTION
    Echo back arguments, possibly with quoting.

  OPTIONS
    --shell          escape for shell use
    --xml            escape for XML use
    <string>         arguments to echo

"[<string>]..." is added to SYNOPSIS.
"<string>         arguments to echo" is added to OPTIONS.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
13 years agodocs: updated list of applications using libvirt.
Ohad Levy [Tue, 14 Jun 2011 16:17:09 +0000 (19:17 +0300)]
docs: updated list of applications using libvirt.

Added:
* Virt ruby bindings
* Foreman for provisioning and webui.

13 years agostorage: avoid an intermediate malloc
Eric Blake [Mon, 13 Jun 2011 22:17:46 +0000 (16:17 -0600)]
storage: avoid an intermediate malloc

Suggested here:
https://www.redhat.com/archives/libvir-list/2011-May/msg00594.html

* src/storage/storage_backend.c (virStorageBackendCreateQemuImg):
Generate size inline.

13 years agocommand: avoid double close
Eric Blake [Mon, 13 Jun 2011 21:47:45 +0000 (15:47 -0600)]
command: avoid double close

Previously, the parent process opened 'null' to /dev/null, then
the child process closes 'null' as well as 'childout'.  But if
childout was set to be null, then this is a double close.  At
least the double close was confined to the child process after a
fork, and therefore there is no risk of another thread opening
an fd of the same value to be bitten by the double close, but it
is always better to avoid double-close to begin with.

Additionally, if all three fds were specified, then opening
'null' was wasted.

This patch fixes things to lazily open null on the first use,
then guarantees it gets closed exactly once.

* src/util/command.c (getDevNull): New helper function.
(virExecWithHook): Use it to avoid spurious opens and double close.

13 years agocommand: reduce duplicated debug messages
Eric Blake [Mon, 13 Jun 2011 21:20:03 +0000 (15:20 -0600)]
command: reduce duplicated debug messages

This also reduces malloc pressure for invoking a child when
VIR_DEBUG is enabled.

* src/util/command.c (virExecWithHook): Drop debug, since the only
caller (virCommandRunAsync) also prints debug info.

13 years agodocs: improve VIR_DOMAIN_AFFECT_CURRENT description
Eric Blake [Fri, 3 Jun 2011 16:06:33 +0000 (10:06 -0600)]
docs: improve VIR_DOMAIN_AFFECT_CURRENT description

* include/libvirt/libvirt.h.in (virDomainModificationImpact): Reword.

13 years agoqemu: Fix parsing 'info chardev'
Cole Robinson [Wed, 8 Jun 2011 16:25:11 +0000 (12:25 -0400)]
qemu: Fix parsing 'info chardev'

If qemu supports -chardev, our char frontend aliases are ex. 'charserial0'
not just 'serial0'. Typically we don't use this code path because the
pty's are scraped from stdout.

13 years agoqemu: Scrape stdout for virtio console pty
Cole Robinson [Wed, 8 Jun 2011 16:27:18 +0000 (12:27 -0400)]
qemu: Scrape stdout for virtio console pty

Currently we forget to do this and have to fallback to info chardev (which
also fails, see following patch)

13 years agovirsh: Add daemon version reporting
Michal Privoznik [Thu, 2 Jun 2011 13:59:02 +0000 (15:59 +0200)]
virsh: Add daemon version reporting

'virsh version' might report against which version of libvirtd is
running.

13 years agonodeinfo: remove superflous braces
Guido Günther [Sat, 11 Jun 2011 16:10:40 +0000 (18:10 +0200)]
nodeinfo: remove superflous braces

that break compilation on non intel architectures:

mips:
https://buildd.debian.org/status/fetch.php?pkg=libvirt&arch=mips&ver=0.9.2-1&stamp=1307570195
powerpc:
https://buildd.debian.org/status/fetch.php?pkg=libvirt&arch=powerpc&ver=0.9.2-1&stamp=1307550913
s390:
https://buildd.debian.org/status/fetch.php?pkg=libvirt&arch=s390&ver=0.9.2-1&stamp=1307641748
sparc:
https://buildd.debian.org/status/fetch.php?pkg=libvirt&arch=sparc&ver=0.9.2-1&stamp=1307552926

13 years agoutil: Cleanup indention problem in virterror.c
Osier Yang [Tue, 14 Jun 2011 07:03:12 +0000 (15:03 +0800)]
util: Cleanup indention problem in virterror.c

Push under trivial rule.

13 years agoqemu: Parse current balloon value returned by query_balloon
Osier Yang [Tue, 14 Jun 2011 03:21:35 +0000 (11:21 +0800)]
qemu: Parse current balloon value returned by query_balloon

Qemu once supported following memory stats which will returned by
"query_balloon":

    stat_put(dict, "actual", actual);
    stat_put(dict, "mem_swapped_in", dev->stats[VIRTIO_BALLOON_S_SWAP_IN]);
    stat_put(dict, "mem_swapped_out", dev->stats[VIRTIO_BALLOON_S_SWAP_OUT]);
    stat_put(dict, "major_page_faults", dev->stats[VIRTIO_BALLOON_S_MAJFLT]);
    stat_put(dict, "minor_page_faults", dev->stats[VIRTIO_BALLOON_S_MINFLT]);
    stat_put(dict, "free_mem", dev->stats[VIRTIO_BALLOON_S_MEMFREE]);
    stat_put(dict, "total_mem", dev->stats[VIRTIO_BALLOON_S_MEMTOT]);

But it later disabled all the stats except "actual" by commit
07b0403dfc2b2ac179ae5b48105096cc2d03375a.

libvirt doesn't parse "actual", so user will always see a empty result
with "virsh dommemstat $domain". Even qemu haven't disabled the stats,
we should support parsing "actual".

13 years agovcpupin: Fix cpu affinity setting bug of qemu driver
Taku Izumi [Tue, 14 Jun 2011 03:13:11 +0000 (11:13 +0800)]
vcpupin: Fix cpu affinity setting bug of qemu driver

There is the case where cpu affinites for vcpu of qemu doesn't work
correctly. For example, if only one vcpupin setting entry is provided
and its setting is not for vcpu0, it doesn't work.

   # virsh dumpxml VM
   ...
   <vcpu>4</vcpu>
   <cputune>
     <vcpupin vcpu='3' cpuset='9-11'/>
   </cputune>
   ...

   # virsh start VM
   Domain VM started

   # virsh vcpuinfo VM
   VCPU:           0
   CPU:            31
   State:          running
   CPU time:       2.5s
   CPU Affinity:   yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

   VCPU:           1
   CPU:            12
   State:          running
   CPU time:       0.9s
   CPU Affinity:   yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

   VCPU:           2
   CPU:            30
   State:          running
   CPU time:       1.5s
   CPU Affinity:   yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

   VCPU:           3
   CPU:            13
   State:          running
   CPU time:       1.7s
   CPU Affinity:   yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

This patch fixes this problem.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
13 years agoFix dlopen dependency
Matthias Bolte [Thu, 9 Jun 2011 19:47:43 +0000 (21:47 +0200)]
Fix dlopen dependency

Since the addition of the lock manager framework in 6a943419c528fdd7
dlopen is always required, but the checks in configure wasn't changed
to reflect that. This didn't show up directly because the VirtualBox
driver linking dlopen in covered it. But disabling the VirtualBox
driver makes the build fail due to missing dlopen.

Change the dlopen check in configure to pick up dlopen when available.

Reported by Ruben Kerkhof.

13 years agoDeprecate several CURRENT/LIVE/CONFIG enums
Hu Tao [Wed, 8 Jun 2011 06:33:33 +0000 (14:33 +0800)]
Deprecate several CURRENT/LIVE/CONFIG enums

This patch deprecates following enums:

VIR_DOMAIN_MEM_CURRENT
VIR_DOMAIN_MEM_LIVE
VIR_DOMAIN_MEM_CONFIG

VIR_DOMAIN_VCPU_LIVE
VIR_DOMAIN_VCPU_CONFIG

VIR_DOMAIN_DEVICE_MODIFY_CURRENT
VIR_DOMAIN_DEVICE_MODIFY_LIVE
VIR_DOMAIN_DEVICE_MODIFY_CONFIG

And modify internal codes to use virDomainModificationImpact.

13 years agoqemu: Faster response time to qemu startup errors
Stefan Berger [Mon, 13 Jun 2011 19:59:58 +0000 (15:59 -0400)]
qemu: Faster response time to qemu startup errors

The below patch decreases the response time of libvirt to errors reported by Qemu upon startup by checking whether the qemu process is still alive while polling for the local socket to show up.

This patch also introduces a special handling of signal for the Win32 part of virKillProcess.

13 years agobuild: update to latest gnulib
Eric Blake [Wed, 8 Jun 2011 13:15:00 +0000 (07:15 -0600)]
build: update to latest gnulib

* .gnulib: Update to latest, for more strerror_r fixes.

13 years agovcpupin: add the new option to "virsh vcpupin" command
Taku Izumi [Mon, 13 Jun 2011 15:51:04 +0000 (23:51 +0800)]
vcpupin: add the new option to "virsh vcpupin" command

This patch adds the new option (--live, --config and --current) to
"virsh vcpupin" command. The behavior of above aption is the same as
that of "virsh setmem", "virsh setvcpus", and whatnot.
When the --config option is specified, the command affects a persistent
domain, while --live option is specified, it affects a running (live) domain.
The --current option cannot be used with --config or --live at the same
time, and when --current is specified, it affects a "current" domain.

13 years agovcpupin: implement the remote protocol to address the new API
Taku Izumi [Mon, 13 Jun 2011 15:45:29 +0000 (23:45 +0800)]
vcpupin: implement the remote protocol to address the new API

This patch implements the remote protocol for the new API
(virDomainPinVcpuFlags).

13 years agovcpupin: implement the code to address the new API in the qemu driver
Taku Izumi [Mon, 13 Jun 2011 15:42:09 +0000 (23:42 +0800)]
vcpupin: implement the code to address the new API in the qemu driver

This patch implements the new API (virDomainPinVcpuFlags) in the qemu
driver.

13 years agovcpupin: introduce a new libvirt API (virDomainPinVcpuFlags)
Taku Izumi [Mon, 13 Jun 2011 15:35:54 +0000 (23:35 +0800)]
vcpupin: introduce a new libvirt API (virDomainPinVcpuFlags)

This patch introduces a new libvirt API virDomainPinVcpuFlags,
a direct extension from the existing virDomainPinVcpu

13 years agoUse virTimeMs when appropriate
Jiri Denemark [Wed, 1 Jun 2011 10:35:18 +0000 (12:35 +0200)]
Use virTimeMs when appropriate

13 years agoIntroduce virTimeMs for getting current time in ms
Jiri Denemark [Wed, 1 Jun 2011 09:38:56 +0000 (11:38 +0200)]
Introduce virTimeMs for getting current time in ms

13 years agotest: Remove unused timeval
Jiri Denemark [Wed, 1 Jun 2011 11:47:33 +0000 (13:47 +0200)]
test: Remove unused timeval

13 years agotests: add a test for multi function PCI device
Wen Congyang [Wed, 8 Jun 2011 04:34:04 +0000 (12:34 +0800)]
tests: add a test for multi function PCI device

13 years agosupport multifunction PCI device
Wen Congyang [Mon, 23 May 2011 06:42:21 +0000 (14:42 +0800)]
support multifunction PCI device

If qemu supports multi function PCI device, the format of the PCI address passed
to qemu is "bus=pci.0,multifunction=on,addr=slot.function".

If qemu does not support multi function PCI device, the format of the PCI address
passed to qemu is "bus=pci.0,addr=slot".

13 years agothe hotplugged PCI device should use the whole slot
Wen Congyang [Mon, 23 May 2011 07:43:35 +0000 (15:43 +0800)]
the hotplugged PCI device should use the whole slot

Hot pluging/unpluging multi PCI device is not supported now. So the function
of hotplugged PCI device must be 0. When we hot unplug it, we should set release
all functions in the slot.

13 years agoassign the whole slot to the PCI device that has no address
Wen Congyang [Mon, 23 May 2011 07:50:13 +0000 (15:50 +0800)]
assign the whole slot to the PCI device that has no address

If user does not specify the PCI address, we should auto assign an unused slot.

13 years agoReimplement qemuDomainPCIAddressReserveSlot(): reserve all functions in the slot
Wen Congyang [Tue, 24 May 2011 05:23:39 +0000 (13:23 +0800)]
Reimplement qemuDomainPCIAddressReserveSlot(): reserve all functions in the slot

We will support multi function PCI device. So we should reserve all functions in
the slot if we want to reserve a slot.

13 years agothe key of hash table should include the function value
Wen Congyang [Mon, 23 May 2011 03:22:54 +0000 (11:22 +0800)]
the key of hash table should include the function value

We save all used PCI address in the hash table. The key is generated by domain,
bus and slot now. We will support multi function PCI device, so the key should
be generated by domain, bus, slot and function.