]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agoReplace use of virNetError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 18:30:53 +0000 (19:30 +0100)]
Replace use of virNetError with virReportError

Update the libvirtd dispatch code to use virReportError
instead of the virNetError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of virConfError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 18:26:35 +0000 (19:26 +0100)]
Replace use of virConfError with virReportError

Update the libvirtd config handling code to use virReportError
instead of the virConfError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of nodeReportError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 18:19:23 +0000 (19:19 +0100)]
Replace use of nodeReportError with virReportError

Update the nodeinfo helper code to use virReportError instead
of the nodeReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of virSecurityReportError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 14:39:18 +0000 (15:39 +0100)]
Replace use of virSecurityReportError with virReportError

Update the security drivers to use virReportError instead of
the virSecurityReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of PHYP_ERROR with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 14:40:46 +0000 (15:40 +0100)]
Replace use of PHYP_ERROR with virReportError

Update the Power-Hypervisor driver to use virReportError
instead of the PHYP_ERROR custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of HYPERV_ERROR with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 14:29:12 +0000 (15:29 +0100)]
Replace use of HYPERV_ERROR with virReportError

Update the Hyper-V driver to use virReportError instead
of the HYPERV_ERROR custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of ESX_ERROR & ESX_VI_ERROR with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 14:25:50 +0000 (15:25 +0100)]
Replace use of ESX_ERROR & ESX_VI_ERROR with virReportError

Update the ESX driver to use virReportError instead of
the ESX_ERROR & ESX_VI_ERROR custom macros

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of virLockError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 13:37:08 +0000 (14:37 +0100)]
Replace use of virLockError with virReportError

Update the lock manager drivers to use virReportError instead
of the virLockError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of libxlError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 13:32:10 +0000 (14:32 +0100)]
Replace use of libxlError with virReportError

Update the libxl driver to use virReportError instead of
the libxlError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd missing "%s" format string to constant error messages in lock manager
Jiri Denemark [Fri, 20 Jul 2012 12:10:50 +0000 (13:10 +0100)]
Add missing "%s" format string to constant error messages in lock manager

Updates the lock manager code so that it passes "%s" as the format
string whenever raising an error message with a const string.

12 years agoAdd missing "%s" format string to constant error messages in libxl driver
Jiri Denemark [Fri, 20 Jul 2012 12:09:07 +0000 (13:09 +0100)]
Add missing "%s" format string to constant error messages in libxl driver

Updates the libxl driver code so that it passes "%s" as the format
string whenever raising an error message with a const string.

12 years agoMake the 'lxc_driver' global variable non-static
Gao feng [Fri, 20 Jul 2012 11:47:20 +0000 (12:47 +0100)]
Make the 'lxc_driver' global variable non-static

The 'lxc_driver' global variable is now used from several of
the LXC sources files. Thus it needs to be non-static to
avoid runtime linkage errors

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
12 years agoReplace use of streamsReportError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 14:49:46 +0000 (15:49 +0100)]
Replace use of streamsReportError with virReportError

Update the streams code to use virReportError instead of
the streamsReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of remoteError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 13:35:21 +0000 (14:35 +0100)]
Replace use of remoteError with virReportError

Update the remote driver to use virReportError instead of
the remoteError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of XENXS_ERROR with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 13:17:20 +0000 (14:17 +0100)]
Replace use of XENXS_ERROR with virReportError

Update the XenXS shared code to use virReportError instead
of the XENXS_ERROR custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of openvzError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 13:13:44 +0000 (14:13 +0100)]
Replace use of openvzError with virReportError

Update the OpenVZ driver to use virReportError instead of
the openvzError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix Xen driver to have sensible error messages
Daniel P. Berrange [Thu, 19 Jul 2012 15:35:11 +0000 (16:35 +0100)]
Fix Xen driver to have sensible error messages

The Xen driver had a number of error reports which passed a
constant string without format specifiers and was missing
"%s". Furthermore the errors were related to failing system
calls, but virReportSystemError was not used. So the only
useful piece of info (the errno) was being discarded

12 years agoMove LXC process management code into separate file
Daniel P. Berrange [Fri, 13 Jul 2012 11:39:29 +0000 (12:39 +0100)]
Move LXC process management code into separate file

Move all the code that manages stop/start of LXC processes
into separate lxc_process.{c,h} file to make the lxc_driver.c
file smaller

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove cgroup setup code out of lxc_controller.c
Daniel P. Berrange [Fri, 13 Jul 2012 11:21:27 +0000 (12:21 +0100)]
Move cgroup setup code out of lxc_controller.c

Move the cgroup setup code out of the lxc_controller.c file
and into lxc_cgroup.{c,h}. This reduces the size of the
lxc_controller.c file and paves the way to invoke cgroup
setup from lxc_driver.c instead of lxc_controller.c in the
future

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove LXC domain private data into separate file
Daniel P. Berrange [Fri, 13 Jul 2012 10:16:23 +0000 (11:16 +0100)]
Move LXC domain private data into separate file

Move the LXC driver code related to the virDomainObjPtr
private data into separate lxc_domain.{c,h} files
to reduce the size of lxc_driver.c

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of vmwareError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 13:22:54 +0000 (14:22 +0100)]
Replace use of vmwareError with virReportError

Update the VMWare driver to use virReportError instead of
the vmwareError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of virCPUReportError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 12:16:38 +0000 (13:16 +0100)]
Replace use of virCPUReportError with virReportError

Update the CPU helper APIs to use virReportError instead
of the virCPUReportError custom macor

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of testError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 12:12:06 +0000 (13:12 +0100)]
Replace use of testError with virReportError

Update the test driver to use virReportError instead of the
testError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of vboxError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 12:06:29 +0000 (13:06 +0100)]
Replace use of vboxError with virReportError

Update the VirtualBox driver to use virReportError instead of
the vboxError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of xenapiError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 18:25:00 +0000 (19:25 +0100)]
Replace use of xenapiError with virReportError

Update the XenAPI driver to use virReportError instead of
the xenapiError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of qemuReportError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 15:22:03 +0000 (16:22 +0100)]
Replace use of qemuReportError with virReportError

Update the QEMU driver to use virReportError instead of
the qemuReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoqemu: Add missing "%s" before translation macros
Peter Krempa [Thu, 19 Jul 2012 13:32:27 +0000 (14:32 +0100)]
qemu: Add missing "%s" before translation macros

This patch cleans up some missing "%s" before translation macros,
for strings which are const without format specifiers

12 years agoReplace use of umlReportError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 12:01:08 +0000 (13:01 +0100)]
Replace use of umlReportError with virReportError

Update the UML driver to use virReportError instead of the
umlReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd lots of internal symbols to libvirt_private.syms
Daniel P. Berrange [Wed, 18 Jul 2012 16:03:17 +0000 (17:03 +0100)]
Add lots of internal symbols to libvirt_private.syms

Make sure that libvirt_private.syms has all the internal symbols
from APIs in src/rpc/*.h and src/util/cgroup.h, since the LXC
controller/driver will shortly need them

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReset the 'quit' flag in virNetServerRun
Daniel P. Berrange [Wed, 18 Jul 2012 15:49:15 +0000 (16:49 +0100)]
Reset the 'quit' flag in virNetServerRun

To allow virNetServerRun/virNetServerQuit to be invoked multiple
times, we must reset the 'quit' flag in virNetServerRun

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoIf in delay close mode for an RPC client, don't read further data
Daniel P. Berrange [Wed, 18 Jul 2012 15:48:24 +0000 (16:48 +0100)]
If in delay close mode for an RPC client, don't read further data

In the delayed close mode, we're just waiting for final data to
be written back to the client. While waiting, we should not
bother to read more data from the client.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDon't autostart domains when reloading config
Daniel P. Berrange [Fri, 13 Jul 2012 11:49:55 +0000 (12:49 +0100)]
Don't autostart domains when reloading config

When sending SIGHUP to libvirtd, it will trigger the virStateDriver
reload operation. This is intended to reload the configuration files
for guests. For unknown historical reasons this is also triggering
autostart of all guests. Autostart is generally expected to be
something that happens on OS startup. Starting VMs on SIGHUP will
violate that expectation and potentially cause dangerous scenarios
if the admin has explicitly shutdown a misbehaving VM that has
been marked as autostart

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd missing deps on driver modules in libvirt RPM
Daniel P. Berrange [Wed, 18 Jul 2012 16:27:03 +0000 (17:27 +0100)]
Add missing deps on driver modules in libvirt RPM

Turning on the building of driver modules in libvirt.spec.in
means that installing 'libvirt' no longer pulls in all the
drivers. For upgrade compatibility we need to list all drivers
module sub-RPMs against the 'libvirt' RPM.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of networkReportError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 11:50:10 +0000 (12:50 +0100)]
Replace use of networkReportError with virReportError

Update the linux bridge driver to use virReportError instead
of the networkReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agorpc: remove trailing whitespace character in error string
Guannan Ren [Wed, 18 Jul 2012 15:02:02 +0000 (23:02 +0800)]
rpc: remove trailing whitespace character in error string

Instead of only removing the ending newline character, it is
better to remove all of standard whitespace character for the
sake of log format.

One example that we have to do this is:
After three times incorrect password input, virsh command
virsh -c qemu://remoteserver/system will report error like:

: Connection reset by peerey,gssapi-keyex,gssapi-with-mic,password).

But it should be:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
: Connection reset by peer

The reason is that we dropped the newline, but have a '\r' left.
The terminal interprets it as "move the cursor back to the start
of the current line", so the error string is messed up.

12 years agopo: avoid spurious double spaces in messages
Eric Blake [Wed, 18 Jul 2012 23:45:34 +0000 (17:45 -0600)]
po: avoid spurious double spaces in messages

Noticed during the recent error cleanups.

* src/network/bridge_driver.c (networkStartRadvd): Fix spacing.
* src/openvz/openvz_conf.c (openvzReadMemConf): Likewise.
* src/qemu/qemu_command.c (qemuNetworkIfaceConnect): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainDetachNetDevice): Likewise.
* src/qemu/qemu_process.c (qemuProcessStop): Likewise.
* src/security/virt-aa-helper.c (vah_add_file): Likewise.

12 years agobuild: fix compilation without struct ifreq
Eric Blake [Wed, 18 Jul 2012 22:46:05 +0000 (16:46 -0600)]
build: fix compilation without struct ifreq

Detected on Cygwin.  Broken in commit 387117ad.

* src/util/virnetdev.c (virNetDevValidateConfig)
(virNetDevReplaceNetConfig): Fix prototypes.
* src/util/virnetlink.c (virNetlinkEventAddClient)
(virNetlinkEventRemoveClient): Likewise.

12 years agoesx: Fix esxVI_String_Deserialize
Matthias Bolte [Wed, 18 Jul 2012 22:46:21 +0000 (00:46 +0200)]
esx: Fix esxVI_String_Deserialize

It was broken since forever as it expected a libxml2
XML_ELEMENT_NODE containing a XML_TEXT_NODE instead of
just a XML_TEXT_NODE.

This problem was not discovered for so long because
esxVI_String_Deserialize was not used until now.

Reported by Ata Bohra

12 years agonodeinfo: deal with offline cpus in a node
Eric Blake [Wed, 18 Jul 2012 01:46:29 +0000 (19:46 -0600)]
nodeinfo: deal with offline cpus in a node

Commit 80533ca forgot to think about offline cpus.  When a node
cpu is offline, then its topology/ subdirectory is not present,
leading to spurious error messages leaked to the user such as:

libvir:  error : cannot open /home/dummy/libvirt/tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu7/topology/physical_package_id: No such file or directory

Fix that, as well as test it; the test data is gathered from a
machine with one NUMA node, hyperthreading, and with 2 of the
8 cpus offline.

* src/nodeinfo.c (virNodeParseNode): Don't parse topology of
offline cpus.
* tests/nodeinfotest.c (mymain): Run new test.
* tests/nodeinfodata/linux-nodeinfo-sysfs-test-6*: New data.

12 years agomaint: add mailmap entry for Dan Walsh
Eric Blake [Wed, 18 Jul 2012 21:34:53 +0000 (15:34 -0600)]
maint: add mailmap entry for Dan Walsh

As confirmed with Dan on IRC.

* .mailmap: List Dan's preferred 'shortlog' name.

12 years agoesx: Extend esxVI_CURL_Download for partial downloads
Matthias Bolte [Thu, 12 Jul 2012 23:58:27 +0000 (01:58 +0200)]
esx: Extend esxVI_CURL_Download for partial downloads

Also ensure that the virBuffer used to store the downloaded data
does not overflow.

12 years agoReplace use of interfaceReportError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 11:46:55 +0000 (12:46 +0100)]
Replace use of interfaceReportError with virReportError

Update the netcf driver to use virReportError instead of the
interfaceReportError custom macro

12 years agoReplace use of virNWFilterReportError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 11:45:15 +0000 (12:45 +0100)]
Replace use of virNWFilterReportError with virReportError

Update the network filter driver to use virReportError instead
of the virNWFilterReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd missing "%s" with constant string error message in nwfilter_dhcpsnoop.c
Daniel P. Berrange [Wed, 18 Jul 2012 20:15:18 +0000 (21:15 +0100)]
Add missing "%s" with constant string error message in nwfilter_dhcpsnoop.c

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agolxcContainerMountCGroups also mounts a tmpfs that needs to be labeled.
Dan Walsh [Wed, 18 Jul 2012 19:36:20 +0000 (15:36 -0400)]
lxcContainerMountCGroups also mounts a tmpfs that needs to be labeled.

This patch passes down the sec_mount_options to the
lxcContainerMountCGroups function and then mounts the tmpfs with
the correct label.

12 years agoAdd a sheepdog backend for the storage driver
Sebastian Wiedenroth [Wed, 18 Jul 2012 19:06:58 +0000 (20:06 +0100)]
Add a sheepdog backend for the storage driver

This patch brings support to manage sheepdog pools and volumes to libvirt.
It uses the "collie" command-line utility that comes with sheepdog for that.

A sheepdog pool in libvirt maps to a sheepdog cluster.
It needs a host and port to connect to, which in most cases
is just going to be the default of localhost on port 7000.

A sheepdog volume in libvirt maps to a sheepdog vdi.
To create one specify the pool, a name and the capacity.
Volumes can also be resized later.

In the volume XML the vdi name has to be put into the <target><path>.
To use the volume as a disk source for virtual machines specify
the vdi name as "name" attribute of the <source>.
The host and port information from the pool are specified inside the host tag.

  <disk type='network'>
    ...
    <source protocol="sheepdog" name="vdi_name">
      <host name="localhost" port="7000"/>
    </source>
  </disk>

To work right this patch parses the output of collie,
so it relies on the raw output option. There recently was a bug which caused
size information to be reported wrong. This is fixed upstream already and
will be in the next release.

Signed-off-by: Sebastian Wiedenroth <wiedi@frubar.net>
12 years agoMount all tmpfs filesystems with correct SELinux label
Daniel J Walsh [Wed, 18 Jul 2012 18:44:47 +0000 (19:44 +0100)]
Mount all tmpfs filesystems with correct SELinux label

Basically within a Secure Linux Container (virt-sandbox) we want all content
that the process within the container can write to be labeled the same.  We
are labeling the physical disk correctly but when we create "RAM" based file
systems
libvirt is not labeling them, and they are defaulting to tmpfs_t, which will
will not allow the processes to write.  This patch labels the RAM based file
systems correctly.

12 years agoReplace use of virNodeDeviceReportError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 11:42:38 +0000 (12:42 +0100)]
Replace use of virNodeDeviceReportError with virReportError

Update the node device driver to use virReportError instead of
the virNodeDeviceReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of virSecretReportError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 11:40:16 +0000 (12:40 +0100)]
Replace use of virSecretReportError with virReportError

Update the secret driver to use virReportError instead of the
virSecretReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of virStorageReportError with virReportError
Daniel P. Berrange [Wed, 18 Jul 2012 11:38:29 +0000 (12:38 +0100)]
Replace use of virStorageReportError with virReportError

Update the storage driver to use virReportError instead of
the virStorageReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd missing "%s" format to const error message in RBD storage driver
Daniel P. Berrange [Wed, 18 Jul 2012 18:32:24 +0000 (19:32 +0100)]
Add missing "%s" format to const error message in RBD storage driver

When passing a const message string to the error reporting APIs
RBD forgot to use "%s" to avoid GCC format string warnings

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert all files in src/conf/ to use virReportError()
Daniel P. Berrange [Wed, 18 Jul 2012 10:50:44 +0000 (11:50 +0100)]
Convert all files in src/conf/ to use virReportError()

This removes all the per-file error reporting macros
from the code in src/conf/

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd missing _(...) around 2 error messages in test driver
Daniel P. Berrange [Wed, 18 Jul 2012 15:38:41 +0000 (16:38 +0100)]
Add missing _(...) around 2 error messages in test driver

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix parameter passed with VIR_ERR_INVALID_ARG in sanlock driver
Daniel P. Berrange [Wed, 18 Jul 2012 15:37:29 +0000 (16:37 +0100)]
Fix parameter passed with VIR_ERR_INVALID_ARG in sanlock driver

The VIR_ERR_INVALID_ARG is typically given the function name
via __FUNCTION__

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert all files in src/rpc/ to use virReportError()
Daniel P. Berrange [Wed, 18 Jul 2012 10:41:47 +0000 (11:41 +0100)]
Convert all files in src/rpc/ to use virReportError()

This rmoves all the per-file error reporting macros
from the code in src/rpc/

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert (nearly) all files in src/util/ to use virReportError()
Daniel P. Berrange [Wed, 18 Jul 2012 10:26:24 +0000 (11:26 +0100)]
Convert (nearly) all files in src/util/ to use virReportError()

This removes nearly all the per-file error reporting macros
from the code in src/util/. A few custom macros remain for the
case, where the file needs to report errors with a variety of
different codes or parameters

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix bogus cast to (int) in virNetServerMDNSTimeoutNew
Daniel P. Berrange [Wed, 18 Jul 2012 15:29:19 +0000 (16:29 +0100)]
Fix bogus cast to (int) in virNetServerMDNSTimeoutNew

The virNetServerMDNSTimeoutNew method was casting a long long
to an int when reporting errors. This should just be using
%lld instead of %d, avoiding the need to cast

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd missing "%s" with constant string error message in stats_linux.c
Daniel P. Berrange [Wed, 18 Jul 2012 15:25:05 +0000 (16:25 +0100)]
Add missing "%s" with constant string error message in stats_linux.c

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove newline from end of error message in virnodesuspend.c
Daniel P. Berrange [Wed, 18 Jul 2012 10:52:05 +0000 (11:52 +0100)]
Remove newline from end of error message in virnodesuspend.c

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd _(...) around two error messages in src/util/
Daniel P. Berrange [Wed, 18 Jul 2012 10:44:24 +0000 (11:44 +0100)]
Add _(...) around two error messages in src/util/

The virnetdevtap.c and viruri.c files had two error report
messages which were not annotated with _(...)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoIntroduce virReportError macro for general error reporting
Daniel P. Berrange [Wed, 18 Jul 2012 10:23:56 +0000 (11:23 +0100)]
Introduce virReportError macro for general error reporting

Nearly every source file does something like

  #define VIR_FROM_THIS VIR_FROM_FOO
  #define virFooReportErorr(code, ...) \
     virReportErrorHelper(VIR_FROM_THIS, code,  __FILE__,    \
                          __FUNCTION__, __LINE__, \
                          __VA_ARGS__)

This creates needless duplication and inconsistent error
reporting function names in each file. It is trivial to
just have virterror_internal.h provide a virReportError
macro that is equivalent

* src/util/virterror_internal.h: Define virReportError(code, ...)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoremote: Fix locking in stream APIs
Jiri Denemark [Tue, 17 Jul 2012 14:36:23 +0000 (16:36 +0200)]
remote: Fix locking in stream APIs

Remote driver needs to make sure the driver lock is released before
entering client IO loop as that may block indefinitely in poll(). As a
direct consequence of not following this in stream APIs, tunneled
migration to a destination host which becomes non-responding may block
qemu driver. Luckily, if keepalive is turned for p2p migrations, both
remote and qemu drivers will get automagically unblocked after keepalive
timeout.

12 years agoxenapi: Convert to virMacAddr
Jiri Denemark [Tue, 17 Jul 2012 15:18:36 +0000 (17:18 +0200)]
xenapi: Convert to virMacAddr

12 years agonwfilter: Convert to virMacAddrPtr not virMacAddrPtr*
Michal Privoznik [Tue, 17 Jul 2012 14:29:43 +0000 (16:29 +0200)]
nwfilter: Convert to virMacAddrPtr not virMacAddrPtr*

My previous patch wasn't complete as it converted from
(unsigned char *) to (virMacAddrPtr *). It should be
(virMacAddrPtr) only.

12 years agonwfilter: Convert to virMacAddrPtr completely
Michal Privoznik [Tue, 17 Jul 2012 14:00:34 +0000 (16:00 +0200)]
nwfilter: Convert to virMacAddrPtr completely

The previous commit (387117ad92) was incomplete leaving those
who does not use libpcap with uncompilable sources beacuse
of incomplete conversion of virNWFilterDHCPSnoopReq function.

12 years agoconfigure: rbd doesn't need -lcrypto
Cole Robinson [Sun, 15 Jul 2012 17:18:44 +0000 (13:18 -0400)]
configure: rbd doesn't need -lcrypto

See https://www.redhat.com/archives/libvir-list/2012-July/msg00493.html

Basically building against librbd doesn't seem to actually require -lcrypto.

Also report the rbd linker flags in configure output

12 years agoConvert 'raw MAC address' usages to use virMacAddr
Stefan Berger [Tue, 17 Jul 2012 12:07:59 +0000 (08:07 -0400)]
Convert 'raw MAC address' usages to use virMacAddr

Introduce new members in the virMacAddr 'class'
- virMacAddrSet: set virMacAddr from a virMacAddr
- virMacAddrSetRaw: setting virMacAddr from raw 6 byte MAC address buffer
- virMacAddrGetRaw: writing virMacAddr into raw 6 byte MAC address buffer
- virMacAddrCmp: comparing two virMacAddr
- virMacAddrCmpRaw: comparing a virMacAddr with a raw 6 byte MAC address buffer

then replace raw MAC addresses by replacing

- 'unsigned char *' with virMacAddrPtr
- 'unsigned char ... [VIR_MAC_BUFLEN]' with virMacAddr

and introduce usage of above functions where necessary.

12 years agoqemu: Do not fail virConnectCompareCPU if host CPU is not known
Jiri Denemark [Thu, 12 Jul 2012 09:49:15 +0000 (11:49 +0200)]
qemu: Do not fail virConnectCompareCPU if host CPU is not known

When host CPU could not be properly detected, virConnectCompareCPU will
just report that any CPU is incompatible with host CPU instead of
failing.

12 years agoqemu: Fix probing for guest capabilities
Jiri Denemark [Fri, 13 Jul 2012 14:30:55 +0000 (16:30 +0200)]
qemu: Fix probing for guest capabilities

Even though qemu-kvm binaries can be used in TCG mode, libvirt would
only detect them if /dev/kvm was available. Thus, one would need to make
a /usr/bin/qemu symlink to be able to use TCG mode with qemu-kvm in an
environment without KVM support.

And even though QEMU is able to make use of KVM, libvirt would not
advertise KVM support unless there was a qemu-kvm symlink available.

This patch fixes both issues.

12 years agodocs: Improve patch submission guidelines
Michal Privoznik [Mon, 9 Jul 2012 08:01:21 +0000 (10:01 +0200)]
docs: Improve patch submission guidelines

We should really advise (new) developers to send rebased patches
that apply cleanly and use git-send-email rather than all other
obscure ways.

12 years agoWire up handling for QMP's BALLOON_EVENT
Daniel P. Berrange [Thu, 12 Jul 2012 15:45:57 +0000 (23:45 +0800)]
Wire up handling for QMP's BALLOON_EVENT

If QEMU supports the BALLOON_EVENT QMP event, then we can
avoid invoking 'query-balloon' when returning XML or the
domain info.

* src/qemu/qemu_capabilities.c, src/qemu/qemu_capabilities.h:
  Add QEMU_CAPS_BALLOON_EVENT
* src/qemu/qemu_driver.c: Skip query-balloon in
  qemudDomainGetInfo and qemuDomainGetXMLDesc if we have
  QEMU_CAPS_BALLOON_EVENT set
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Check
  for BALLOON_EVENT at connect to monitor. Add callback
  for balloon change notifications
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h:
  Add handling of BALLOON_EVENT and impl 'query-events'
  check

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDefine public API for receiving guest memory balloon events
Daniel P. Berrange [Fri, 13 Jul 2012 09:05:17 +0000 (17:05 +0800)]
Define public API for receiving guest memory balloon events

When the guest changes its memory balloon applications may want
to know what the new value is, without having to periodically
poll on XML / domain info. Introduce a "balloon change" event
to let apps see this

* include/libvirt/libvirt.h.in: Define the
  virConnectDomainEventBalloonChangeCallback callback
  and VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE constant
* python/libvirt-override-virConnect.py,
  python/libvirt-override.c: Wire up helpers for new event
* daemon/remote.c: Helper for serializing balloon event
* examples/domain-events/events-c/event-test.c,
  examples/domain-events/events-python/event-test.py: Add
  example of balloon event usage
* src/conf/domain_event.c, src/conf/domain_event.h: Handling
  of balloon events
* src/remote/remote_driver.c: Add handler of balloon events
* src/remote/remote_protocol.x: Define wire protocol for
  balloon events
* src/remote_protocol-structs: Likewise.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoARMHF: CPU Support for armhf.
Chuck Short [Thu, 12 Jul 2012 15:28:17 +0000 (10:28 -0500)]
ARMHF: CPU Support for armhf.

Adding CPU encoder/decoder for armhf to avoid runtime error messages.

Signed-off-by: Chuck Short <chuck.short@canonical.com>
12 years agofix failure when building with --disable-debug
Hu Tao [Fri, 13 Jul 2012 07:50:04 +0000 (15:50 +0800)]
fix failure when building with --disable-debug

When building with --disable-debug, VIR_DEBUG expands to a nop.
But parameters to VIR_DEBUG can be variables that are passed only
to VIR_DEBUG. In the case the building system complains about unused
variables.

12 years agovirsh: remove unnecessary sleep for nodecpustats --percent
Viktor Mihajlovski [Fri, 13 Jul 2012 07:50:25 +0000 (09:50 +0200)]
virsh: remove unnecessary sleep for nodecpustats --percent

Fix for a minor issue:
the sleep(1) statement was called twice,
effectively doubling the elapsed time
execution "virsh nodecpustats --percent".

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoClarify direct migration
Jiri Denemark [Thu, 12 Jul 2012 13:27:18 +0000 (15:27 +0200)]
Clarify direct migration

When --direct is used when migrating a domain running on a hypervisor
that does not support direct migration (such as QEMU), the caller would
get the following error message:

    this function is not supported by the connection driver:
    virDomainMigrateToURI2

which is a complete nonsense since qemu driver implements
virDomainMigrateToURI2. This patch would emit a more sensible error in
this case:

    Requested operation is not valid: direct migration is not supported
    by the connection driver

12 years agoFix daemon auto-spawning
Christophe Fergeau [Thu, 12 Jul 2012 11:52:36 +0000 (13:52 +0200)]
Fix daemon auto-spawning

Commit 32a9aac switched libvirt to use the XDG base directories
to locate most of its data/config. In particular, the per-user socket
for qemu:///session is now stored in the XDG runtime directory.
This directory is located by looking at the XDG_RUNTIME_DIR environment
variable, with a fallback to ~/.cache/libvirt if this variable is not
set.

When the daemon is autospawned because a client application wants
to use qemu:///session, the daemon is ran in a clean environment
which does not contain XDG_RUNTIME_DIR. It will create its socket
in ~/.cache/libvirt. If the client application has XDG_RUNTIME_DIR
set, it will not look for the socket in the fallback place, and will
fail to connect to the autospawned daemon.

This patch adds XDG_RUNTIME_DIR to the daemon environment before
auto-starting it. I've done this in virNetSocketForkDaemon rather
than in virCommandAddEnvPassCommon as I wasn't sure we want to pass
these variables to other commands libvirt spawns. XDG_CACHE_HOME
and XDG_CONFIG_HOME are also added to the daemon env as it makes use
of those as well.

12 years agoSupport creation of sparse LVM volumes
Daniel P. Berrange [Wed, 11 Jul 2012 16:28:39 +0000 (17:28 +0100)]
Support creation of sparse LVM volumes

When calling 'lvcreate' if specifying both the '-L' and
'--virtualsize' options, the latter will be treated as
the capacity and the former as the allocation. This can
be used to support sparse volume creation. In addition,
when listing volumes it is necessary to include the 'size'
field in lvs output, so that we can detect sparse volume
allocation correctly.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove all use of virRun in storage code
Daniel P. Berrange [Wed, 11 Jul 2012 14:56:55 +0000 (15:56 +0100)]
Remove all use of virRun in storage code

To make it easier to dynamically change the command line ARGV,
switch all storage code over to use virCommandPtr APIs for
running programs

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agovirsh: remove extra space between function name and opening brace
Guido Günther [Wed, 11 Jul 2012 06:17:28 +0000 (08:17 +0200)]
virsh: remove extra space between function name and opening brace

to match our CodingStyle.

12 years agoFix directory removal in filesystem storage driver
Sascha Peilicke [Wed, 11 Jul 2012 15:34:58 +0000 (16:34 +0100)]
Fix directory removal in filesystem storage driver

Fix the virStorageBackendFileSystemVolDelete method to not use
unlink() unconditionally. It must use rmdir() for volumes which
are directories. It should also raise an error if given a volume
which has the network/block type.

12 years agostorage: Default pool permission mode to 0755
Osier Yang [Wed, 11 Jul 2012 14:40:48 +0000 (22:40 +0800)]
storage: Default pool permission mode to 0755

Per the typical use of libvirt is to fork the qemu process with
qemu:qemu. Setting the pool permission mode as 0700 by default
will prevent the guest start with permission reason.

Define macro for the default pool and vol permission modes
incidentally.

12 years agoFix shutdown of LXC controller
Daniel P. Berrange [Mon, 9 Jul 2012 13:55:31 +0000 (14:55 +0100)]
Fix shutdown of LXC controller

Since we are not yet using the virNetServerPtr object for running
the event loop, we can't use virNetServerQuit(). Instead set the
global 'quit' flag in libvirt_lxc

12 years agotest: Add test case for nodeinfotest if host machine doesn't have NUMA
Peter Krempa [Wed, 27 Jun 2012 12:48:57 +0000 (14:48 +0200)]
test: Add test case for nodeinfotest if host machine doesn't have NUMA

Test filling of nodeinfo structure if /sys/devices/system/node does not
exist. (Based on dump from a real machine)

12 years agotest: Add new test case for nodeinfotest
Peter Krempa [Wed, 27 Jun 2012 12:42:48 +0000 (14:42 +0200)]
test: Add new test case for nodeinfotest

This patch adds test data that describe a machine that has two physical
processors that don't share same core id's on their cores. On this data
the "virsh nodeinfo" reported that the machine had 10 cores per socket
while the processor had only 8. (Before fixing nodeinfo gathering code).

12 years agonodeinfo: Fix gathering of nodeinfo data structure
Peter Krempa [Mon, 9 Jul 2012 14:57:49 +0000 (16:57 +0200)]
nodeinfo: Fix gathering of nodeinfo data structure

This patch changes the way data to fill the nodeinfo structure are
gathered. We've gathere the test data by iterating processors an sockets
separately from nodes. The reported data was based solely on information
about core id. Problems arise when eg cores in mulit-processor machines
don't have same id's on both processors or maybe one physical processor
contains more NUMA nodes.

This patch changes the approach how we detect processors and nodes. Now
we start at enumerating nodes and for each node processors, sockets and
threads are enumerated separately. This approach provides acurate data
that comply to docs about the nodeinfo structure. This also enables to
get rid of hacks: see commits 10d9038b744a69c8d4bd29c2e8c012a097481586,
ac9dd4a676f21b5e3ca6dbe0526f2a6709072beb. (Those changes in nodeinfo.c
are efectively reverted by this patch).

This patch also changes output of one of the tests, as the processor
topology is now acquired more precisely.

12 years agonodeinfo_test: Enhance test data before changing nodeinfo gathering
Peter Krempa [Mon, 9 Jul 2012 14:46:54 +0000 (16:46 +0200)]
nodeinfo_test: Enhance test data before changing nodeinfo gathering

This patch adds test data needed by the new way node information will be
gathered. This patch adds symlinks to cpu cores to their corresponding
node directory.

12 years agoS390: Adding testcases for s390
Viktor Mihajlovski [Fri, 29 Jun 2012 15:02:07 +0000 (17:02 +0200)]
S390: Adding testcases for s390

Add minimal s390-virtio domain testcase and testcases for virtio serial,
net, disk for the virtio-s390 bus.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: Domain Schema for s390-virtio machines.
Viktor Mihajlovski [Fri, 29 Jun 2012 15:02:06 +0000 (17:02 +0200)]
S390: Domain Schema for s390-virtio machines.

Added s390-virtio machine type to the XML schema for domains in order
to not fail the domain schema tests.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoS390: Add support for virtio-s390 devices.
Viktor Mihajlovski [Fri, 29 Jun 2012 15:02:05 +0000 (17:02 +0200)]
S390: Add support for virtio-s390 devices.

The s390(x) architecture doesn't feature a PCI bus. For the purpose of
supporting virtio devices a virtual bus called virtio-s390 is used.
A new address type VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 is used to
distinguish the virtio devices on s390 from PCI-based virtio devices.

V3 Change: updated QEMU_CAPS_VIRTIO_S390 to fit upstream.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoqemu: Change tests to use (modified) qemuDomainAssignAddresses
Viktor Mihajlovski [Fri, 29 Jun 2012 15:02:04 +0000 (17:02 +0200)]
qemu: Change tests to use (modified) qemuDomainAssignAddresses

Rewrote the device assignment parts in tests to use qemuDomainAssignAddresses.
This way the tests will work for new device address types as they show
up in the future (like s390 device types).

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoqemu: Extended qemuDomainAssignAddresses to be callable from everywhere.
Viktor Mihajlovski [Fri, 29 Jun 2012 15:02:03 +0000 (17:02 +0200)]
qemu: Extended qemuDomainAssignAddresses to be callable from everywhere.

This is in preparation of the enablement of s390 guests with virtio devices.

The assignment of device addresses happens in different places, i.e. the
qemu driver and process modules as well as in the unit tests in slightly
different flavors. Currently, these are PPC spapr-vio and PCI
devices, virtio-s390 (not PCI based) will follow.

By optionally passing to qemuDomainAssignAddresses the domain
object and the capabilities it is now possible to call the function
from most of the places (except for hotplug) where address assignment
is done.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoopenvz: Handle domain obj hash map errors
Guido Günther [Mon, 9 Jul 2012 10:11:17 +0000 (12:11 +0200)]
openvz: Handle domain obj hash map errors

This makes the driver fail with a clear error message in case of UUID
collisions (for example if somebody copied a container configuration
without updating the UUID) and also raises an error on other hash map
failures.

OpenVZ itself doesn't complain about duplicate UUIDs since this
parameter is only used by libvirt.

12 years agoFix /domain/features setting in qemuParseCommandLine
Christophe Fergeau [Tue, 10 Jul 2012 10:02:10 +0000 (12:02 +0200)]
Fix /domain/features setting in qemuParseCommandLine

Commit 5e6ce1 moved down detection of the ACPI feature in
qemuParseCommandLine. However, when ACPI is detected, it clears
all feature flags in def->features to only set ACPI. This used to
be fine because this was the first place were def->features was set,
but after the move this is no longer necessarily true because this
block comes before the ACPI check:

if (strstr(def->emulator, "kvm")) {
    def->virtType = VIR_DOMAIN_VIRT_KVM;
    def->features |= (1 << VIR_DOMAIN_FEATURE_PAE);
}

Since def is allocated in qemuParseCommandLine using VIR_ALLOC, we
can always use |= when modifying def->features

12 years agobuild: detect all improper uses of _("%s")
Eric Blake [Tue, 10 Jul 2012 21:43:08 +0000 (15:43 -0600)]
build: detect all improper uses of _("%s")

The only useful translation of "%s" as a format string is "%s" (I
suppose you could claim "%1$s" is also valid, but why bother).  So
it is not worth translating; fixing this exposes some instances
where we were failing to translate real error messages.  This makes
the fix of commit 097da1ab more generic, as well as ensuring no
future regressions.

* cfg.mk (sc_prohibit_useless_translation): New rule.
* src/lxc/lxc_driver.c (lxcSetVcpuBWLive): Fix offender.
* src/openvz/openvz_conf.c (openvzReadFSConf): Likewise.
* src/qemu/qemu_cgroup.c (qemuSetupCgroupForVcpu): Likewise.
* src/qemu/qemu_driver.c (qemuSetVcpusBWLive): Likewise.
* src/xenapi/xenapi_utils.c (xenapiSessionErrorHandle): Likewise.

12 years agosystemd: start libvirtd after network
Jim Fehlig [Mon, 9 Jul 2012 15:52:55 +0000 (09:52 -0600)]
systemd: start libvirtd after network

Domains configured with autostart may fail to start if the host
network stack has not been started.  E.g. when using bridged
networking autostarting a domain can fail with

libvirtd[1403]: 2012-06-20 13:23:49.833+0000: 1485: error :
qemuAutostartDomain:177 : Failed to autostart VM 'test': Cannot get
interface MTU on 'br0': No such device

12 years agoutil: Use current uid and gid if they are passed as -1 for virDirCreate
Osier Yang [Thu, 21 Jun 2012 07:11:20 +0000 (15:11 +0800)]
util: Use current uid and gid if they are passed as -1 for virDirCreate

All the callers of virDirCreate are updated incidentally.

12 years agovirsh: Ensure the parents of the readline history path exists
Osier Yang [Tue, 10 Jul 2012 11:24:04 +0000 (19:24 +0800)]
virsh: Ensure the parents of the readline history path exists

Instead of changing the existed virFileMakePath to accept mode
argument and modifying a pile of its uses, this patch introduces
virFileMakePathWithMode, and use it instead of mkdir() to create
the readline history dir.

12 years agodocs: added description of the vendor_id attribute
Hendrik Schwartke [Tue, 10 Jul 2012 08:01:03 +0000 (10:01 +0200)]
docs: added description of the vendor_id attribute

12 years agoFix a string format bug in qemu_cgroup.c
tangchen [Fri, 6 Jul 2012 01:53:11 +0000 (09:53 +0800)]
Fix a string format bug in qemu_cgroup.c

Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>