]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
9 years agoMove qemuMonitorFindObjectPath to qemu_monitor_json
Ján Tomko [Wed, 3 Jun 2015 10:22:53 +0000 (12:22 +0200)]
Move qemuMonitorFindObjectPath to qemu_monitor_json

This function is specific to the JSON monitor.

9 years agorpc: Fix reference counting around virNetSocketAddIOCallback
Daniel P. Berrange [Thu, 4 Jun 2015 17:18:56 +0000 (19:18 +0200)]
rpc: Fix reference counting around virNetSocketAddIOCallback

Ref service passed as a parameter to the callback.  And don't unref the
socket that is part of the service being passed at another point in code.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agorpc: Don't use unrelated value as privateData of client
Daniel P. Berrange [Thu, 4 Jun 2015 17:16:32 +0000 (19:16 +0200)]
rpc: Don't use unrelated value as privateData of client

Append privateData of the client only if there are any, otherwise the
previous value (socket data) will get there again.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agorpc: Make virNetServerAddClient function dynamic
Daniel P. Berrange [Thu, 4 Jun 2015 17:16:32 +0000 (19:16 +0200)]
rpc: Make virNetServerAddClient function dynamic

As opposed to 'static'; by exporting it (privately).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agomdns: Set error when failing due to missing avahi
Martin Kletzander [Thu, 4 Jun 2015 15:34:42 +0000 (17:34 +0200)]
mdns: Set error when failing due to missing avahi

When building without avahi support, we used VIR_DEBUG() to note that to
the user.  However, functions that fail because of that (return NULL/-1)
did not set the error message.  This was the only file that forgot to do
such thing.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agostorage: Add check for valid FS types in checkPool callback
John Ferlan [Tue, 2 Jun 2015 23:48:56 +0000 (19:48 -0400)]
storage: Add check for valid FS types in checkPool callback

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

The virStorageBackendFileSystemIsMounted is called from three source paths
checkPool, startPool, and stopPool. Both start and stop validate the FS
fields before calling *IsMounted; however the check path there is no call.
This could lead the code into returning a true in "isActive" if for some
reason the target path for the pool was mounted. The assumption being
that if it was mounted, then we believe we started/mounted it.

It's also of note that commit id '81165294' added an error message for
the start/mount path regarding that the target is already mounted so
fail the start. That check was adjusted by commit id '13fde7ce' to
only message if actually mounted.

At one time this led to the libvirtd restart autostart code to declare
that the pool was active even though the startPool would inhibit startup
and the stopPool would inhibit shutdown. The autostart path changed as
of commit id '2a31c5f0' as part of the keep storage pools started between
libvirtd restarts.

This patch adds the same check made prior to start/mount and stop/unmount
to ensure we have a valid configuration before attempting to see if the
target is already mounted to declare "isActive" or not. Finding an improper
configuration will now cause an error at checkPool, which should make it
so we can no longer be left in a situation where the pool was started and
we have no way to stop it.

9 years agostorage: FS backend adjust error message on error path
John Ferlan [Tue, 2 Jun 2015 20:25:58 +0000 (16:25 -0400)]
storage: FS backend adjust error message on error path

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

Currently the assumption on the error message is that there are
no source device paths defined when the number of devices check
fails, but in reality the XML could have had none or it could have
had more than the value supported. Adjust the error message accordingly
to make it clearer what the error really is.

9 years agostorage: Refactor storage pool type checks
John Ferlan [Tue, 2 Jun 2015 23:35:35 +0000 (19:35 -0400)]
storage: Refactor storage pool type checks

Refactor the code for both startPool (*Mount) and stopPool (*Unmount) code
paths by introducing virStorageBackendFileSystemIsValid.

9 years agostorage: Remove extraneous @conn from function comments
John Ferlan [Tue, 2 Jun 2015 23:58:33 +0000 (19:58 -0400)]
storage: Remove extraneous @conn from function comments

Over time the parameters changed, but the comment wasn't updated

9 years agoremote: fix odd comma operator
Eric Blake [Fri, 5 Jun 2015 03:44:48 +0000 (21:44 -0600)]
remote: fix odd comma operator

Commit 1882c0bd accidentally used ',' instead of ';'; oddly
enough, the result was still syntactically valid (yes, C is
a fun language).  But it made me do a double take; it's better
to use idiomatic syntax.

* daemon/remote.c (remoteRelayDomainEventDeviceAdded): Fix
harmless typo.

Signed-off-by: Eric Blake <eblake@redhat.com>
9 years agoqemu: Update balloon info only if job is allowed
Peter Krempa [Thu, 4 Jun 2015 11:47:02 +0000 (13:47 +0200)]
qemu: Update balloon info only if job is allowed

In qemuDomainUpdateCurrentMemorySize I misplaced the actual update of
the balloon size to a place where it may not be initialized. Move it a
few lines above.

9 years agoconf: Fix mistakes in pointer usage in virDomainObjGetDefs
Peter Krempa [Thu, 4 Jun 2015 11:20:12 +0000 (13:20 +0200)]
conf: Fix mistakes in pointer usage in virDomainObjGetDefs

Coverity rightfully determined that in commit 3d021381c71221e563182f03
I made a mistake in the first check if @persDef is not NULL is
dereferencing it rather than checking.

Additionally if the vm is online the code would set @liveDef twice
rather than modifying @persDef. Fix both mistakes.

9 years agoqemu: Check for qemu capability when calling virDomainGetBlockIoTune()
Martin Kletzander [Thu, 28 May 2015 09:38:43 +0000 (11:38 +0200)]
qemu: Check for qemu capability when calling virDomainGetBlockIoTune()

When getting block device I/O tuning data there is no check for whether
QEMU supports such options and the call fails on
qemuMonitorGetBlockIoThrottle() when getting the particular throttle
data.  So try reporting a better error when blkdeviotune is not
supported.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: Refactor qemuDomainSetVcpusFlags by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:29:06 +0000 (14:29 +0200)]
qemu: Refactor qemuDomainSetVcpusFlags by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainGetEmulatorPinInfo by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:29:06 +0000 (14:29 +0200)]
qemu: Refactor qemuDomainGetEmulatorPinInfo by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainPinEmulator by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:29:06 +0000 (14:29 +0200)]
qemu: Refactor qemuDomainPinEmulator by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainGetVcpuPinInfo by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:22:23 +0000 (14:22 +0200)]
qemu: Refactor qemuDomainGetVcpuPinInfo by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainPinVcpuFlags by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:17:35 +0000 (14:17 +0200)]
qemu: Refactor qemuDomainPinVcpuFlags by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainSetBlkioParameters by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:22:23 +0000 (14:22 +0200)]
qemu: Refactor qemuDomainSetBlkioParameters by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainChgIOThread by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:22:23 +0000 (14:22 +0200)]
qemu: Refactor qemuDomainChgIOThread by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainPinIOThread by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:22:23 +0000 (14:22 +0200)]
qemu: Refactor qemuDomainPinIOThread by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainGetIOThreadInfo by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:22:23 +0000 (14:22 +0200)]
qemu: Refactor qemuDomainGetIOThreadInfo by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainGetVcpusFlags by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:22:23 +0000 (14:22 +0200)]
qemu: Refactor qemuDomainGetVcpusFlags by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainSetMemoryStatsPeriod by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:22:23 +0000 (14:22 +0200)]
qemu: Refactor qemuDomainSetMemoryStatsPeriod by reusing virDomainObjGetDefs

9 years agoqemu: Refactor qemuDomainSetMemoryFlags by reusing virDomainObjGetDefs
Peter Krempa [Fri, 29 May 2015 12:22:23 +0000 (14:22 +0200)]
qemu: Refactor qemuDomainSetMemoryFlags by reusing virDomainObjGetDefs

9 years agoconf: Add new helpers to resolve virDomainModificationImpact to domain defs
Peter Krempa [Fri, 29 May 2015 12:37:20 +0000 (14:37 +0200)]
conf: Add new helpers to resolve virDomainModificationImpact to domain defs

virDomainLiveConfigHelperMethod that is used for this job now does
modify the flags but still requires the callers to extract the correct
definition objects.

In addition coverity and other static analyzers are usually unhappy as
they don't grasp the fact that @flags are upadted according to the
correct def to be present.

To work this issue around and simplify the calling chain let's add a new
helper that will work only on drivers that always copy the persistent
def to a transient at start of a vm. This will allow to drop a few
arguments. The new function syntax will also fill two definition
pointers rather than modifying the @flags parameter.

9 years agolibxl: Don't remove vcpu pin definition in libxlDomainCleanup
Peter Krempa [Thu, 28 May 2015 13:31:09 +0000 (15:31 +0200)]
libxl: Don't remove vcpu pin definition in libxlDomainCleanup

The vCPU pinning definition gets removed when the domain definition is
being freed later. If there is no next configuration it would remove the
configured pinning.

9 years agoRevert "cputune: Support cputune for xend driver"
Peter Krempa [Thu, 28 May 2015 12:40:30 +0000 (14:40 +0200)]
Revert "cputune: Support cputune for xend driver"

This reverts commit 01692bb167f7ab81213921ba1116d46a4651ef0e.

Quoting the original commit message:

"Not sure if it's the correct way to add cputune xml for xend driver..."

It is not. The defition created that is converted from the internal xend
structures would also be leaked since it isn't used any more.

Revert the commit since it does not make sense to keep the info
internally.

9 years agoqemu: libxl: vcpupin: Don't reset pinning when pinning to all pcpus
Peter Krempa [Mon, 25 May 2015 12:19:50 +0000 (14:19 +0200)]
qemu: libxl: vcpupin: Don't reset pinning when pinning to all pcpus

In the pre-NUMA ages pinning a vCPU to all pCPUs was eaqual to deleting
the pinning info. Now it does not entirely work that way. Pinning a vCPU
to all pCPUs might be a desired operation. Additionally removal of the
pinning will result into using the default pinning information at the
next boot which might be different from all vcpus.

This patch removes the false assumption that we should remove the
pinning after pinning to all vCPUs and tweaks the documentation for
virsh.

A later patch will implement a new flag for the virDomainPinVcpuFlags
API that will allow to remove the pinning in a sane way.

9 years agolib: virDomainPinIOThread: Remove spurious overflow check
Peter Krempa [Thu, 28 May 2015 09:44:42 +0000 (11:44 +0200)]
lib: virDomainPinIOThread: Remove spurious overflow check

Internal structures use unsigned int, so there's no need for this legacy
check that was copied from the vCPU pinning api.

9 years agoconf: Store cpu count as unsigned int
Peter Krempa [Mon, 25 May 2015 13:43:29 +0000 (15:43 +0200)]
conf: Store cpu count as unsigned int

While we probably won't see machines with more than 65536 cpus for a
while lets store the cpu count as an integer so that we can avoid quite
a lot of overflow checks in our code.

9 years agoqemu: Refactor qemuDomainGetInfo
Peter Krempa [Wed, 27 May 2015 15:33:23 +0000 (17:33 +0200)]
qemu: Refactor qemuDomainGetInfo

Since the returned structure uses "unsigned long" for memory sizes add a
few overflow checks to notify the user in case we are not able to
represent given values.

9 years agoqemu: Add helper to update domain balloon size and refactor usage places
Peter Krempa [Wed, 27 May 2015 13:51:52 +0000 (15:51 +0200)]
qemu: Add helper to update domain balloon size and refactor usage places

When qemu does not support the balloon event the current memory size
needs to be queried. Since there are two places that implement the same
logic, split it out into a function and reuse.

9 years agoqemu: process: Update current balloon state to maximum on vm startup
Peter Krempa [Wed, 27 May 2015 13:04:14 +0000 (15:04 +0200)]
qemu: process: Update current balloon state to maximum on vm startup

After libvirt issues the balloon resize command, the current balloon
size needs to be changed to the maximum memory size since the vCPUs were
not started and thus the balloon driver could not return the memory.

Since GetXMLDesc and other APIs return the balloon size without updating
it in case they are not able to obtain the job and the memory balloon
does not support the asynchronous event the sizing might be incorrect.

9 years agoAlways add 'console' matching the 'serial' device
Ján Tomko [Wed, 13 Aug 2014 11:06:04 +0000 (13:06 +0200)]
Always add 'console' matching the 'serial' device

We have been formatting the first serial device also
as a console device, but only if there were no other consoles.

If there is a <serial> device present in the XML, but no serial
<console>, or if there isn't any <console> at all but the domain
definition hasn't gone through a parse->format->parse round-trip,
the <console> device would not be formatted.

Change the code to always add the stub device for the first
serial device.

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

9 years agomaint: remove incorrect apostrophes from 'its'
Ján Tomko [Wed, 3 Jun 2015 10:10:36 +0000 (12:10 +0200)]
maint: remove incorrect apostrophes from 'its'

9 years agodocs: php: remove reference to Red Hat
Ján Tomko [Wed, 3 Jun 2015 10:08:35 +0000 (12:08 +0200)]
docs: php: remove reference to Red Hat

Also remove the redudant apostrophe from "it's".

9 years agocheck if console/channel PTY is null before attempting to open
Shivaprasad G Bhat [Sun, 31 May 2015 15:55:59 +0000 (21:25 +0530)]
check if console/channel PTY is null before attempting to open

Console/channel devices have their pty devices assigned when the emulator is
actually started. If time is spent in guest preparation, someone attempts
to open the console/channel, the libvirt crashes in virChrdevLockFilePath().
The patch attempts to fix the crash by adding a check before attempting to
open.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
9 years agovirnetdev: fix moving of 802.11 phys
Lubomir Rintel [Mon, 1 Jun 2015 18:40:23 +0000 (20:40 +0200)]
virnetdev: fix moving of 802.11 phys

There was a couple of problems with the style fixes applied to the original
patch:

1.) virFileReadAllQuiet comparison was incorrectly parenthesized when moved
into a condition, causing the len to be set to the result of comparison. This,
together with the removed underflow check would underflow the phy buffer.

2.) The logic was broken. Failure to call "ip" would abort the function, thus
the "iw" branch would never be reached.

This aims to fix the issues and work around possible style complains :)

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
9 years agoutil: process: Refactor and fix virProcessSetAffinity
Peter Krempa [Tue, 2 Jun 2015 06:34:50 +0000 (08:34 +0200)]
util: process: Refactor and fix virProcessSetAffinity

Refactor the function to return the bitmap instead of an integer and the
inner workings so that they make more sense.

This patch also fixes possible segfault on old systems that was
introduced by commit:

commit f1a43a8e4139b028257ef4ed05a81cfb5f8a8741
Author: Hu Tao <hutao@cn.fujitsu.com>
Date:   Fri Sep 14 15:46:59 2012 +0800

    use virBitmap to store cpu affinity info

9 years agoutil: Clear output broadcast address before filling it in
Martin Kletzander [Wed, 3 Jun 2015 10:46:36 +0000 (12:46 +0200)]
util: Clear output broadcast address before filling it in

Since commit 55ace7c4789c8a7408139460f4b639cee00e5125, the sockettest
fails without VIR_TEST_DEBUG set.  The problem is found by test number
42 (co-incidence?), which tests range '192.168.122.1' -
'192.168.122.255' in network '192.168.122.0/24'.  That is supposed to
fail because the end address is equal to the broadcast address.

When comparing these two in 'virSocketAddrEqual(end, &broadcast)',
there is a check for sin_addr as well as for sin_port.  That port,
however, is different when we do not enable test debugging.  With the
testing enabled, the port is 0 (correctly initialized), but without that
it has a random number there.  And that's because the structure is not
initialized anywhere.

By zeroing the structure before filling in the info, we make sure we
return only the address and not any information that was not requested.
And the test work once again.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agovirsh: Fix Ctrl-C behavior when watching a job
Jiri Denemark [Mon, 1 Jun 2015 13:06:16 +0000 (15:06 +0200)]
virsh: Fix Ctrl-C behavior when watching a job

When watching a job (save, managedsave, dump, migrate) virsh spawns a
thread to call the appropriate API and waits for the result while
watching for interruption signals (SIGINT, Ctrl-C on the terminal).
Whenever such signal is caught, virsh calls virDomainAbortJob, stops
waiting for the job, and returns the result of virDomainAbortJob.

This is wrong because the job might have finished in the meantime or it
might have been cancelled by someone else and virsh would just report
the failure to abort the job. However, we are not interested in the
virDomainAbortJob's result at all, we need to keep waiting for the main
job to finish and report its result instead.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: process: Refactor setup of memory ballooning
Peter Krempa [Wed, 27 May 2015 12:26:05 +0000 (14:26 +0200)]
qemu: process: Refactor setup of memory ballooning

Since the monitor code now supports ullongs when setting balloon size,
drop the legacy code with overflow checking.

Additionally the comment mentioning that the job is treated as a sync
job does not make sense any more since the monitor is entered
asynchronously.

9 years agoqemu: monitor: Make qemuMonitorSetBalloon operate on unsinged long long
Peter Krempa [Wed, 27 May 2015 12:03:17 +0000 (14:03 +0200)]
qemu: monitor: Make qemuMonitorSetBalloon operate on unsinged long long

9 years agomonitor: Move documentation for qemuMonitorGetBalloonInfo
Peter Krempa [Wed, 27 May 2015 11:42:32 +0000 (13:42 +0200)]
monitor: Move documentation for qemuMonitorGetBalloonInfo

Document the top level function rather than both bottom level ones. It
makes looking the docs up quicker.

9 years agoutil: Add macro to overflow check integer assignments
Peter Krempa [Wed, 27 May 2015 08:54:38 +0000 (10:54 +0200)]
util: Add macro to overflow check integer assignments

Add a macro that will allow to simplify overflow checks and make them
more universal in case data types change.

9 years agolibxl: Refactor libxlDomainGetVcpuPinInfo
Peter Krempa [Fri, 22 May 2015 12:51:18 +0000 (14:51 +0200)]
libxl: Refactor libxlDomainGetVcpuPinInfo

Reuse the approach in qemuDomainGetVcpuPinInfo.

9 years agolibxl: Unbreak vcpu pinning
Peter Krempa [Fri, 22 May 2015 08:20:55 +0000 (10:20 +0200)]
libxl: Unbreak vcpu pinning

Libxl's vcpu pinning would work only if the vcpu array was ordered and
was not sparse. Remove the condition and iterate the pinning array
properly.

9 years agolibxl: Reuse virBitmapToData in libxlDomainSetVcpuAffinities
Peter Krempa [Fri, 22 May 2015 07:53:12 +0000 (09:53 +0200)]
libxl: Reuse virBitmapToData in libxlDomainSetVcpuAffinities

9 years agoqemu: Refactor qemuDomainHelperGetVcpus by reusing virBitmapToDataBuf
Peter Krempa [Fri, 29 May 2015 12:01:32 +0000 (14:01 +0200)]
qemu: Refactor qemuDomainHelperGetVcpus by reusing virBitmapToDataBuf

Get rid of the unnecessary allocation and copying of the bitmap and
clean up some unnecesary temporary variables.

9 years agoqemu: Reuse virBitmapToDataBuf in qemuDomainGetEmulatorPinInfo
Peter Krempa [Fri, 29 May 2015 11:52:29 +0000 (13:52 +0200)]
qemu: Reuse virBitmapToDataBuf in qemuDomainGetEmulatorPinInfo

9 years agoqemu: Use virBitmapToDataBuf in qemuDomainGetVcpuPinInfo
Peter Krempa [Fri, 22 May 2015 09:07:21 +0000 (11:07 +0200)]
qemu: Use virBitmapToDataBuf in qemuDomainGetVcpuPinInfo

Reuse the function so that we can get rid of a lot of temporary
allocations.

9 years agoutil: bitmap: Add virBitmapToDataBuf that does not allocate the buffer
Peter Krempa [Thu, 21 May 2015 16:25:36 +0000 (18:25 +0200)]
util: bitmap: Add virBitmapToDataBuf that does not allocate the buffer

Since some functions can be optimized by reusing the buffers that they
already have instead of allocating and copying new ones, lets split
virBitmapToData to two functions where one only converts the data and
the second one is a wrapper that allocates the buffer if necessary.

9 years agoconf: Move pinning information definition closer to the usage place
Peter Krempa [Thu, 21 May 2015 14:16:15 +0000 (16:16 +0200)]
conf: Move pinning information definition closer to the usage place

9 years agoconf: Refactor emulatorpin handling
Peter Krempa [Thu, 21 May 2015 12:55:18 +0000 (14:55 +0200)]
conf: Refactor emulatorpin handling

Store the emulator pinning cpu mask as a pure virBitmap rather than the
virDomainPinDef since it stores only the bitmap and refactor
qemuDomainPinEmulator to do the same operations in a much saner way.

As a side effect virDomainEmulatorPinAdd and virDomainEmulatorPinDel can
be removed since they don't add any value.

9 years agoqemu: Fix possible crash in qemuProcessSetVcpuAffinities
Peter Krempa [Thu, 28 May 2015 14:22:13 +0000 (16:22 +0200)]
qemu: Fix possible crash in qemuProcessSetVcpuAffinities

In case when <vcpu ... cpuset=""> is not specified, the vcpupin array is
not guaranteed to be allocated to def->vcpus. This would cause a crash
for TCG since it does not report thread IDs for vCPUs.

9 years agoparallels: set virtType depending on driver name
Maxim Nestratov [Tue, 26 May 2015 17:12:00 +0000 (20:12 +0300)]
parallels: set virtType depending on driver name

We remember driver name in a new field 'drivername' within
private parallels connection structure. When a new domain
is defined we use this name to set corresponding virtType.
We set VIR_DOMAIN_VIRT_VZ for 'vz' driver and
VIR_DOMAIN_VIRT_PARALLELS for 'Parallels'.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: recommend to connect to vz:///system when connection fails
Maxim Nestratov [Tue, 26 May 2015 17:12:00 +0000 (20:12 +0300)]
parallels: recommend to connect to vz:///system when connection fails

Though parallels:///system is still accepted we will encourage users
to use vz:///system instead.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: increment the number of connection drivers
Maxim Nestratov [Tue, 26 May 2015 17:12:00 +0000 (20:12 +0300)]
parallels: increment the number of connection drivers

We need to do this because we have just added a vz driver.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: add a new vz connection driver and hypervisor structures
Maxim Nestratov [Tue, 26 May 2015 17:12:00 +0000 (20:12 +0300)]
parallels: add a new vz connection driver and hypervisor structures

We add this connection driver just as an exact copy with different
name to keep backward compatibility.
Vz stands for Virtuozzo, which is a new name of Parallels Cloud Server.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: accept vz as a driver uri and name
Maxim Nestratov [Tue, 26 May 2015 17:12:00 +0000 (20:12 +0300)]
parallels: accept vz as a driver uri and name

If 'parallels:///system' uri is specified then connection is made to
'Parallels' driver and domain type will be VIR_DOMAIN_VIRT_PARALLELS.
In case of 'vz:///system' connection is established to 'vz' driver
and domain type will be VIR_DOMAIN_VIRT_VZ.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: add new guest capabilities assigned to vz driver
Maxim Nestratov [Tue, 26 May 2015 17:12:00 +0000 (20:12 +0300)]
parallels: add new guest capabilities assigned to vz driver

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: use newly introduced VIR_DOMAIN_VIRT_VZ
Maxim Nestratov [Tue, 26 May 2015 17:12:00 +0000 (20:12 +0300)]
parallels: use newly introduced VIR_DOMAIN_VIRT_VZ

As soon as we keep backward compatibility we treat this constant
as synonym to VIR_DOMAIN_VIRT_PARALLELS.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: introduce vz driver constant and string
Maxim Nestratov [Tue, 26 May 2015 17:12:00 +0000 (20:12 +0300)]
parallels: introduce vz driver constant and string

This new name and constant will be used as substitutions for parallels driver one.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoqemu: Do not release device address on successful RNG attach
Luyao Huang [Sun, 31 May 2015 11:29:46 +0000 (19:29 +0800)]
qemu: Do not release device address on successful RNG attach

Commit id '980b265d' neglected to check for a successful status when
deciding whether to release the device address for the RNG attach thus
the address would be released even though the device was added.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
9 years agoqemu: Need to return status of RNG device removal
Luyao Huang [Sun, 31 May 2015 13:27:25 +0000 (21:27 +0800)]
qemu: Need to return status of RNG device removal

Commit id '862473fa' neglected to return the status from the
qemuDomainRemoveRNGDevice call in qemuDomainRemoveDevice causing
the function to always fail when receiving an RNG device unplug
event. Additionally the domain status/state would not be updated
in the processDeviceDeletedEvent path.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
9 years agoaudit: Audit number of iothreads at domain startup
Luyao Huang [Sun, 31 May 2015 14:07:58 +0000 (22:07 +0800)]
audit: Audit number of iothreads at domain startup

If the domain has IOThreads defined, then audit the number started
at domain startup time.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
9 years agobuild: silence ar warnings on rawhide
Eric Blake [Tue, 2 Jun 2015 15:17:43 +0000 (09:17 -0600)]
build: silence ar warnings on rawhide

Newer binutils 'ar' has added an option 'D' for deterministic
builds, and at least on rawhide, this option is enabled by default.
But it conflicts with the 'u' optimization where the linker only
modifies libraries based on file timestamps, but can result in
different library ordering based on which files were touched last.
Thus, it results in some noisy compilation, for every CCLD line:

  CCLD     libvirt_driver_qemu_impl.la
  ar: `u' modifier ignored since `D' is the default (see `U')

Upstream automake has decided that defaulting ARFLAGS to 'cru' is
no longer beneficial, and that switching the default to 'cr' will
both silence the noise and not penalize modern build systems.

https://lists.gnu.org/archive/html/automake-patches/2015-06/msg00000.html

But rather than wait for newer automake to propagate to all systems
that already have newer binutils, we might as well just use the new
default ourselves, even on older platforms.

* configure.ac: Default AR[_]FLAGS to 'cr', not 'cru'.

Signed-off-by: Eric Blake <eblake@redhat.com>
9 years agoutil: report all address range errors in virSocketAddrGetRange()
Laine Stump [Tue, 26 May 2015 19:44:24 +0000 (15:44 -0400)]
util: report all address range errors in virSocketAddrGetRange()

There are now many more reasons that virSocketAddrGetRange() could
fail, so it is much more informative to report the error there instead
of in the caller. (one of the two callers was previously assuming
success, which is almost surely safe based on the parsing that has
already happened to the config by that time, but it still is nicer to
account for an error "just in case")

Part of fix for: https://bugzilla.redhat.com/show_bug.cgi?id=985653

9 years agonetwork: cleanup range loop in networkDnsmasqConfContents
Laine Stump [Tue, 26 May 2015 19:32:59 +0000 (15:32 -0400)]
network: cleanup range loop in networkDnsmasqConfContents

This loop had automatic variable definitions mixed with code. This
patch moves the definitions to the top of the function and puts
cleanup for them at the bottom. No functional change.

Part of fix for: https://bugzilla.redhat.com/show_bug.cgi?id=985653

9 years agonetwork: validate DHCP ranges are completely within defined network
Laine Stump [Fri, 22 May 2015 21:32:02 +0000 (17:32 -0400)]
network: validate DHCP ranges are completely within defined network

virSocketAddrGetRange() has been updated to take the network address
and prefix, and now checks that both the start and end of the range
are within that network, thus validating that the entire range of
addresses is in the network. For IPv4, it also checks that ranges to
not start with the "network address" of the subnet, nor end with the
broadcast address of the subnet (this check doesn't apply to IPv6,
since IPv6 doesn't have a broadcast or network address)

Negative tests have been added to the network update and socket tests
to verify that bad ranges properly generate an error.

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=985653

9 years agotest: fix IP address range failure test
Laine Stump [Mon, 1 Jun 2015 16:18:01 +0000 (12:18 -0400)]
test: fix IP address range failure test

This was revealed when I made a cut-paste mistake in an upgrade to
virSocketAddrGetRange(), leading to failure to check for the end
address being outside of the defined network, but a negative test case
that should have caught the error instead returned success.

The problem was that testRange in sockettest.c was written so that
when it expected a failure, even an "unexpected success" would be
considered as an "expected failure" because of the way the check in
testRange was done. testRange had this:

 if (gotsize < 0 || gotsize != size) {
     return pass ? -1 : 0;
 } else {
     return pass ? 0 : -1;
 }

but all the tests that expected a failure give "-1" as the expected
size. So in a case where we expect a failure, we would have pass ==
false and size == -1. If virSocketAddrGetRange() was incorrectly
*successful* (returned some positive number), then "gotsize != size"
would be, e.g. "276 != -1", so we would take the if clause and, since
pass == false, we would return 0 (success i.e. expected failure).

The solution is that in the case where we expect failure, we should
just ignore size - virSocketAddrGetRange() must return -1 in order for
us to report "expected failure == success".

Part of fix for: https://bugzilla.redhat.com/show_bug.cgi?id=985653

9 years agoSimplify virNodeCountThreadSiblings
Ján Tomko [Tue, 2 Jun 2015 12:29:54 +0000 (14:29 +0200)]
Simplify virNodeCountThreadSiblings

Use a for loop instead of while.

Do not opencode c_isxdigit and virHexToBin.

9 years agoReport errors in virNodeCountThreadSiblings
Ján Tomko [Tue, 2 Jun 2015 12:24:03 +0000 (14:24 +0200)]
Report errors in virNodeCountThreadSiblings

Use virFileReadAll which reports an error when the file is larger
than the specified maximum.

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

9 years agovirsh: Move error messages inside vshCommandOpt*() functions
Andrea Bolognani [Tue, 2 Jun 2015 09:17:29 +0000 (11:17 +0200)]
virsh: Move error messages inside vshCommandOpt*() functions

9 years agovirsh: Pass vshControl to all vshCommandOpt*() calls
Andrea Bolognani [Tue, 2 Jun 2015 09:17:28 +0000 (11:17 +0200)]
virsh: Pass vshControl to all vshCommandOpt*() calls

This will allow us to use vshError() to report errors from inside
vshCommandOpt*(), instead of replicating the same logic and error
messages all over the place.

We also have more context inside the vshCommandOpt*() functions,
for example the actual value used on the command line, which means
we can produce more detailed error messages.

vshCommandOptBool() is the exception here, because it's explicitly
designed not to report any error.

9 years agovirsh: Make vshCommandOptScaledInt() use vshCommandOpt()
Andrea Bolognani [Tue, 2 Jun 2015 09:17:27 +0000 (11:17 +0200)]
virsh: Make vshCommandOptScaledInt() use vshCommandOpt()

This aligns it to the other vshCommandOpt*() functions.

9 years agovirsh: Improve vshCommandOptTimeoutToMs()
Andrea Bolognani [Tue, 2 Jun 2015 09:17:26 +0000 (11:17 +0200)]
virsh: Improve vshCommandOptTimeoutToMs()

Use vshCommandOptUInt() instead of parsing the value as a signed
integer and checking whether it's positive afterwards.

Improve comments as well.

9 years agovirsh: Use standard error messages in vshCommandOptTimeoutToMs()
Andrea Bolognani [Tue, 2 Jun 2015 09:17:25 +0000 (11:17 +0200)]
virsh: Use standard error messages in vshCommandOptTimeoutToMs()

I missed this in the first time around, thanks Michal for noticing.

9 years agotests: Add a bunch of new tests to virsh-optparse
Andrea Bolognani [Tue, 2 Jun 2015 09:17:24 +0000 (11:17 +0200)]
tests: Add a bunch of new tests to virsh-optparse

The new tests deal with numeric options of three kinds: regular,
scaled and timeouts. For each, both valid and invalid inputs
are provided, hopefully covering all cases: this should allow us
to avoid regressions when changing the relevant code in virsh.

9 years agostorage: RBD: do not return error when deleting non-existent volume
Erik Skultety [Thu, 28 May 2015 15:14:47 +0000 (17:14 +0200)]
storage: RBD: do not return error when deleting non-existent volume

RBD API returns negative value of errno, in that case we can silently
ignore if RBD tries to delete a non-existent volume, just like FS
backend does.

9 years agostorage: Don't update volume objs list before we successfully create one
Erik Skultety [Thu, 28 May 2015 15:00:01 +0000 (17:00 +0200)]
storage: Don't update volume objs list before we successfully create one

We do update pool volume object list before we actually create any
volume. If buildVol fails, we then try to delete the volume in the
storage as well as remove it from our structures. The problem is, that
any backend that supports both buildVol and deleteVol would fail in this
case which is completely unnecessary. This patch causes the update to
take place after we know a volume has been created successfully, thus no
removal in case of a buildVol failure is necessary.

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

9 years agonwfilter: Fix sscanf off-by-one error in virNWFilterSnoopLeaseFileLoad
Erik Skultety [Tue, 2 Jun 2015 07:25:04 +0000 (09:25 +0200)]
nwfilter: Fix sscanf off-by-one error in virNWFilterSnoopLeaseFileLoad

We allocate 16 bytes for IPv4 address and 55 bytes for interface
key, therefore we should read up to 15/54 bytes and let the last byte
reserved for terminating null byte in sscanf.

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

9 years agoutil: process: @pid in virProcessSetAffinity's BSD impl is not unused
Peter Krempa [Tue, 2 Jun 2015 06:36:21 +0000 (08:36 +0200)]
util: process: @pid in virProcessSetAffinity's BSD impl is not unused

9 years agomaint: update to latest gnulib
Eric Blake [Tue, 26 May 2015 23:34:10 +0000 (17:34 -0600)]
maint: update to latest gnulib

Incorporates fixes for cross-compiling to mingw on rawhide, where
gcc 5.1 changes detection of how to properly determine PRIdMAX.
Also picks up some improvements for compilation on Mac OS X.

* .gnulib: Update to latest, for at least mingw.

Signed-off-by: Eric Blake <eblake@redhat.com>
9 years agospec: fixes for recently introduced libxl conf files
Jim Fehlig [Fri, 1 May 2015 18:39:30 +0000 (12:39 -0600)]
spec: fixes for recently introduced libxl conf files

Commit 198cc1d3 introduced libxl-lockd and libxl-sanlock config
files but forgot to add them to the spec file.  Follow-up commit
62b18d98 added the files to daemon-driver-libxl, but missed adding
them to the daemon package when configuring libvirt
--without-driver-modules.  In addition, commit 62b18d98 added
libxl-sanlock to daemon-driver-libxl, but it should be included
in lock-sanlock when libvirt is configured --with-sanlock.

9 years agolibxl: load on FreeBSD
Roman Bogorodskiy [Sun, 24 May 2015 15:42:41 +0000 (18:42 +0300)]
libxl: load on FreeBSD

The libxl tries to check if it's running in dom0 by parsing
/proc/xen/capabilities and if that fails it doesn't load.

There's no procfs interface in Xen on FreeBSD, so this check always
fails.

In addition to checking procfs, check if /dev/xen/xenstored, that's enough to
check if we're running in dom0 in FreeBSD case.

9 years agovirsh: make negative values with vol-resize more convenient
Ján Tomko [Wed, 27 May 2015 14:46:01 +0000 (16:46 +0200)]
virsh: make negative values with vol-resize more convenient

When shrinking a volume by a certain size, instead of typing
  vol-resize volume 1G --delta --shrink
we allow the convience of specifying a negative value:
  vol-resize volume -1G --delta --shrink
getting the same results with one more character.

A negative value only makes sense as a delta. Imply the
--delta parameter if the value is negative.

Still require --shrink, because the operation is potentially
destructive.

9 years agoqemu: Automatically add <panic> element for pSeries guests.
Andrea Bolognani [Thu, 28 May 2015 14:39:13 +0000 (16:39 +0200)]
qemu: Automatically add <panic> element for pSeries guests.

The guest firmware provides the same functionality as the pvpanic
device, and the relevant element should always be present in the
domain XML to reflect this fact, so add it after parsing the
definition if it wasn't there already.

9 years agoqemu: Allow panic device for pSeries guests
Andrea Bolognani [Thu, 28 May 2015 14:39:12 +0000 (16:39 +0200)]
qemu: Allow panic device for pSeries guests

The guest firmware provides the same functionality as the pvpanic
device, which is not available in QEMU on pSeries, so the domain
XML should be allowed to contain the <panic> element.

On the other hand, unlike the pvpanic device, the guest firmware
can't be configured, so report an error if an address has been
provided in the XML.

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

9 years agoqemu: Improve error message for missing QEMU_CAPS_DEVICE_PANIC.
Andrea Bolognani [Thu, 28 May 2015 14:39:11 +0000 (16:39 +0200)]
qemu: Improve error message for missing QEMU_CAPS_DEVICE_PANIC.

9 years agovirsh: Fix printing of XML for pool-create-as
John Ferlan [Thu, 28 May 2015 18:29:19 +0000 (14:29 -0400)]
virsh: Fix printing of XML for pool-create-as

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

commit id 'bd00e00e' neglected to add the new adapter source options
into the if condition that allowed printing the <source> XML fields.
The <adapter type='fc_host'.../> doesn't require other options in order
to be complete.

9 years agoPost-release version bump to 1.2.17
Daniel P. Berrange [Mon, 1 Jun 2015 09:27:12 +0000 (10:27 +0100)]
Post-release version bump to 1.2.17

9 years agoRelease of libvirt-1.2.16
Daniel Veillard [Mon, 1 Jun 2015 02:30:29 +0000 (10:30 +0800)]
Release of libvirt-1.2.16

- docs/news.html.in libvirt.spec.in: update for the release
- po/*.po*: regenerate

9 years agoAllocate priv->vioserialaddrs unconditionally
Ján Tomko [Fri, 29 May 2015 13:03:24 +0000 (15:03 +0200)]
Allocate priv->vioserialaddrs unconditionally

When attempting to hotplug a virtio-serial console to a domain
that had no virtio-serial controllers (not even those that
are added by libvirt when some devices need them) at daemon startup,
report a user-friendly error:

error: Failed to attach device from console.xml
error: internal error: no virtio-serial controllers are available

instead of crashing the daemon:

Process terminating with default action of signal 11 (SIGSEGV): dumping core
 Access not within mapped region at address 0x8
   at 0x531028F: virDomainVirtioSerialAddrNext (domain_addr.c:916)
   by 0x531028F: virDomainVirtioSerialAddrAssign (domain_addr.c:1029)
   by 0x1CBF68: qemuDomainAttachChrDevice (qemu_hotplug.c:1565)
   by 0x1BCD5E: qemuDomainAttachDeviceLive (qemu_driver.c:7997)
   by 0x1BCD5E: qemuDomainAttachDeviceFlags (qemu_driver.c:8743)

Introduced in v1.2.14-30-g5903378.

9 years agoProperly free the xmlDocPtr when loading pool state
Ján Tomko [Fri, 29 May 2015 13:06:14 +0000 (15:06 +0200)]
Properly free the xmlDocPtr when loading pool state

Use xmlFreeDoc instead of plain xmlFree.

4 bytes in 1 blocks are definitely lost in loss record 9 of 1,084
    at 0x4C29F80: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x70730D6: xmlStrndup (in /usr/lib64/libxml2.so.2.9.2)
    by 0x701E3DC: xmlNewDoc (in /usr/lib64/libxml2.so.2.9.2)
    by 0x70C39F8: xmlSAX2StartDocument (in /usr/lib64/libxml2.so.2.9.2)
    by 0x7017245: xmlParseDocument (in /usr/lib64/libxml2.so.2.9.2)
    by 0x7017606: xmlDoRead (in /usr/lib64/libxml2.so.2.9.2)
    by 0x5309DAD: virXMLParseHelper (virxml.c:742)
    by 0x5367584: virStoragePoolLoadState (storage_conf.c:1863)

9 years agolibxl: support QXL video device
Jim Fehlig [Wed, 29 Apr 2015 16:50:33 +0000 (10:50 -0600)]
libxl: support QXL video device

libxl recently gained support for QXL video device.  Support
it in the libxl driver too.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agolibxl: support SPICE graphics for HVM domains
Jim Fehlig [Mon, 27 Apr 2015 22:27:52 +0000 (16:27 -0600)]
libxl: support SPICE graphics for HVM domains

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agolibxl: change reservedVNCPorts to reservedGraphicsPorts
Jim Fehlig [Tue, 28 Apr 2015 00:53:04 +0000 (18:53 -0600)]
libxl: change reservedVNCPorts to reservedGraphicsPorts

A later change will use the PortAllocator for SPICE too.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agolibxl: populate build_info vfb in separate function
Jim Fehlig [Mon, 27 Apr 2015 18:32:55 +0000 (12:32 -0600)]
libxl: populate build_info vfb in separate function

For HVM domains, vfb info must be populated in the libxl_domain_build_info
struct.  Currently this is done in the libxlMakeVfbList function, but IMO
it would be cleaner to populate the build_info vfb in a separate
libxlMakeBuildInfoVfb function.  libxlMakeVfbList would then handle only
vfb devices, simiar to the other libxlMake<device>List functions.

A future patch will extend libxlMakeBuildInfoVfb to support SPICE.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>