]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agomaint: Clean up coding style and fix error message spelling
Peter Krempa [Mon, 2 Jul 2012 15:24:09 +0000 (17:24 +0200)]
maint: Clean up coding style and fix error message spelling

This patch cleans up coding style breaks some long lines and fixes error
message spelling on various places in domain_conf.c and in the qemu
driver.

12 years agodoc: Fix time keeping example for the guest clock
Doug Goldstein [Sat, 21 Jul 2012 13:14:44 +0000 (08:14 -0500)]
doc: Fix time keeping example for the guest clock

The time keeping example was missing quotes which resulted in an error
if you copied and pasted the example into a domain's XML. Additionally
the rest of the examples use single quotes (') instead of double quotes
(") so standardized that.

12 years agoFix test failure when no IPv6 is avail
Doug Goldstein [Sun, 22 Jul 2012 17:04:16 +0000 (12:04 -0500)]
Fix test failure when no IPv6 is avail

When the system doesn't have IPv6 available (e.g. not built into the
kernel or the module isn't loaded), you can not create an IPv6 socket.
The test determines earlier on that IPv6 isn't available then goes and
creates a socket. This makes socket creation conditional on IPv6
availability.

12 years agoDesert the FSF address in copyright
Osier Yang [Sat, 21 Jul 2012 10:06:23 +0000 (18:06 +0800)]
Desert the FSF address in copyright

Per the FSF address could be changed from time to time, and GNU
recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)

  You should have received a copy of the GNU General Public License
  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.

This patch removes the explicit FSF address, and uses above instead
(of course, with inserting 'Lesser' before 'General').

Except a bunch of files for security driver, all others are changed
automatically, the copyright for securify files are not complete,
that's why to do it manually:

  src/security/security_selinux.h
  src/security/security_driver.h
  src/security/security_selinux.c
  src/security/security_apparmor.h
  src/security/security_apparmor.c
  src/security/security_driver.c

12 years agoESX: Fix ESX_VI__TEMPLATE__DYNAMIC_DEEP_COPY
Ata E Husain Bohra [Thu, 19 Jul 2012 06:14:18 +0000 (23:14 -0700)]
ESX: Fix ESX_VI__TEMPLATE__DYNAMIC_DEEP_COPY

Fix addresses two issues:
1. Fix generator code to allow deep copy operation for objects with
   Dynamic_Cast capabilities.
2. Add missing deep copy routine to Long datatype.

Signed-off-by: Ata E Husain Bohra <ata.husain@hotmail.com>
12 years agovmx: handle shared folders parsing
Jean-Baptiste Rouault [Wed, 11 Jul 2012 10:16:35 +0000 (12:16 +0200)]
vmx: handle shared folders parsing

This patch adds support for parsing vmx files with
shared folders enabled.

Update test suite accordingly.

12 years agovmx: handle shared folders formatting
Jean-Baptiste Rouault [Wed, 11 Jul 2012 10:16:34 +0000 (12:16 +0200)]
vmx: handle shared folders formatting

This patch adds support for generating vmx files with
shared folders enabled.

Update test suite accordingly.

12 years agotests: reduce length of nodeinfodata test names
Eric Blake [Fri, 20 Jul 2012 19:12:44 +0000 (13:12 -0600)]
tests: reduce length of nodeinfodata test names

Commit ddd6bef4 switched to the ustar format to fix an issue where
'make dist' fails to create a tarball because we have files with
relative names longer than 100 bytes by the time you include a
'libvirt-0.9.13' prefix.  Unfortunately, even with ustar format,
the use of 'tar -ch' tries to convert symlinks to hard links,
also with a name too long (omitting the -h works, but automake
automatically passes -h); such symlinks were added in commit
6dcf98c, which resulted in 'make dist' breaking again.  The
solution is to rename the offending symlinks to something shorter,
by shortening the entire nodeinfodata naming scheme.

* tests/nodeinfotest.c (mymain): Shorten test names.
(linuxTestNodeInfo): Accommodate new names.
* tests/nodeinfodata/*: Rename files accordingly.

12 years agotests: avoid seclabeltest crash
Eric Blake [Fri, 20 Jul 2012 20:44:54 +0000 (14:44 -0600)]
tests: avoid seclabeltest crash

Commit a56c347 introduced a use of random numbers into seclabel
handling, but failed to initialize the random number generator
in the testsuite.  Also, fail with usual status, not 255.

* tests/seclabeltest.c (main): Initialize randomness.

12 years agoopenvz: Implement domainGetHostname
Guido Günther [Tue, 10 Jul 2012 11:58:44 +0000 (13:58 +0200)]
openvz: Implement domainGetHostname

12 years agoopenvz: Add openvzVEGetStringParam
Guido Günther [Tue, 10 Jul 2012 11:57:38 +0000 (13:57 +0200)]
openvz: Add openvzVEGetStringParam

to retrieve a VEs config parameters as a single string. This will be
used by the upcoming domainGetHostname implementation.

12 years agoremote: Provide RPC call for domainGetHostname
Guido Günther [Fri, 13 Jul 2012 07:12:07 +0000 (09:12 +0200)]
remote: Provide RPC call for domainGetHostname

12 years agovirsh: Add domhostname
Guido Günther [Tue, 10 Jul 2012 10:45:30 +0000 (12:45 +0200)]
virsh: Add domhostname

to query the guest's hostname.

12 years agoAdd virDomainGetHostname
Guido Günther [Tue, 10 Jul 2012 07:34:23 +0000 (09:34 +0200)]
Add virDomainGetHostname

to query a guests's hostname. Containers like LXC and OpenVZ allow to
set a hostname different from the hosts name and QEMU's guest agent
could provide similar functionality.

12 years agoReport 'errno' in int1 field of virErrorPtr
Daniel P. Berrange [Mon, 24 Oct 2011 16:34:18 +0000 (17:34 +0100)]
Report 'errno' in int1 field of virErrorPtr

When reporting a system error (VIR_ERR_SYSTEM_ERROR) via
virReportSystemError, we should copy the errno value into
the 'int1' field of the virErrorPtr struct. This allows
callers to detect certain errno conditions & discard the
error

* src/util/virterror.c: Place errno value in int1 field

12 years agoOnly enforce check for YAJL when starting a VM
Daniel P. Berrange [Wed, 4 Jul 2012 09:44:58 +0000 (10:44 +0100)]
Only enforce check for YAJL when starting a VM

The previous check for YAJL would have many undesirable
consequences, the most important being that it caused the
capabilities XML to lose all <guest> elements. There is
no user visible feedback as to what is wrong in this respect,
merely a syslog message. The empty capabilities causes
libvirtd to then throw away all guest XML configs that are
stored.

This changes the code so that the check for YAJL is only
performed at the time we attempt to spawn a QEMU process

error: Failed to start domain vm-vnc
error: unsupported configuration: this qemu binary requires libvirt to be compiled with yajl

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoUse a hash table for storing MCS labels
Daniel P. Berrange [Thu, 24 May 2012 16:22:29 +0000 (17:22 +0100)]
Use a hash table for storing MCS labels

Instead of using an O(n) efficiency linked list for storing
MCS labels, use a hash table. Instead of having the list
be global, put it in the SELinux driver private data struct
to ensure uniqueness across different instances of the driver.
This also ensures thread safety when multiple hypervisor
drivers are used in the same libvirtd process

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix error handling when adding MCS labels
Daniel P. Berrange [Thu, 24 May 2012 15:52:18 +0000 (16:52 +0100)]
Fix error handling when adding MCS labels

When adding MCS labels, OOM was not being handled correctly.
In addition when reserving an existing label, no check was
made to see if it was already reserved

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoUse standard naming prefix for SELinux driver function names
Daniel P. Berrange [Thu, 24 May 2012 15:42:51 +0000 (16:42 +0100)]
Use standard naming prefix for SELinux driver function names

The function names in the SELinux driver all start with
SELinux or 'mcs' as a prefix. Sanitize this so that they
all use 'virSecuritySELinux' as the prefix

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDisable NWFilter driver completely when unprivileged
Daniel P. Berrange [Thu, 19 Jul 2012 14:58:45 +0000 (15:58 +0100)]
Disable NWFilter driver completely when unprivileged

Running libvirtd unprivileged results in a warning message from
the NWFilter driver

  virNWFilterSnoopLeaseFileRefresh:1882 : open("/var/run/libvirt/network/nwfilter.ltmp"): No such file or directory

Since it requires privileged network access, this driver should
not even run when unprivileged.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoReplace use of custom macros with virReportError in the Xen drivers
Daniel P. Berrange [Wed, 18 Jul 2012 13:48:05 +0000 (14:48 +0100)]
Replace use of custom macros with virReportError in the Xen drivers

Update the legacy Xen drivers to use virReportError instead of
the statsError, virXenInotifyError, virXenStoreError,
virXendError, xenUnifiedError, xenXMError custom macros

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMake sure xenHypervisorInit correctly reports errors
Daniel P. Berrange [Fri, 20 Jul 2012 13:57:39 +0000 (14:57 +0100)]
Make sure xenHypervisorInit correctly reports errors

The xenHypervisorInit method was called from two different
locations, during initial driver registration and also while
opening a Xen connection. The former can't report any useful
errors to the end user/app, so remove it. To ensure thread
safety use a VIR_ONCE_GLOBAL_INIT call to invoke
xenHypervisorInit from the xenHypervisorOpen method.

12 years agoEnsure failure to talk to Xen hypervisor is fatal when privileged
Daniel P. Berrange [Fri, 20 Jul 2012 13:52:44 +0000 (14:52 +0100)]
Ensure failure to talk to Xen hypervisor is fatal when privileged

As per the comment, the Xen hypervisor driver is considered to
be mandatory when running privileged. When it fails to open,
we should thus return an error, not ignore it.

12 years agoUsing virOnce for global initialization is desirable since it
Daniel P. Berrange [Fri, 20 Jul 2012 14:03:39 +0000 (15:03 +0100)]
Using virOnce for global initialization is desirable since it
ensures that initialization will always take place when it is
needed, and guarantees it only occurs once. The problem is that
the code to setup a global initializer with proper error
propagation is tedious. This introduces VIR_ONCE_GLOBAL_INIT
macro to simplify this.

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

Update the VMX shared code to use virReportError instead of
the VMX_ERROR custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
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>