]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
9 years agovirDomain{Get,Set}PerfEvents: Add @flags argument
Michal Privoznik [Wed, 30 Mar 2016 15:40:50 +0000 (17:40 +0200)]
virDomain{Get,Set}PerfEvents: Add @flags argument

I've noticed that these APIs are missing @flags argument. Even
though we don't have a use for them, it's our policy that every
new API must have @flags.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoremoteDomainGetPerfEvents: Re-indent
Michal Privoznik [Wed, 30 Mar 2016 15:40:10 +0000 (17:40 +0200)]
remoteDomainGetPerfEvents: Re-indent

There are few lines off the indentation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: command: Split up formatting of -numa and memory devices
Peter Krempa [Thu, 24 Mar 2016 14:56:16 +0000 (15:56 +0100)]
qemu: command: Split up formatting of -numa and memory devices

They recently were extracted to a separate function. They don't belong
together though. Since -numa formatting is pretty compact, move it to
the main function and rename qemuBuildNumaCommandLine to
qemuBuildMemoryDeviceCommandLine.

9 years agoqemu: command: Pass numad nodeset when formatting memory devices at boot
Peter Krempa [Thu, 24 Mar 2016 15:05:11 +0000 (16:05 +0100)]
qemu: command: Pass numad nodeset when formatting memory devices at boot

When starting up a VM libvirtd asks numad to place the VM in case of
automatic nodeset. The nodeset would not be passed to the memory device
formatter and the user would get an error.

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

9 years agoqemu_process: add check for hyperv features
Pavel Hrdina [Tue, 29 Mar 2016 13:17:45 +0000 (15:17 +0200)]
qemu_process: add check for hyperv features

Commit 7068b56c introduced several hyperv features.  Not all hyperv
features are supported by old enough kernels and we shouldn't allow to
start a guest if kernel doesn't support any of the hyperv feature.

There is one exception, for backward compatibility we cannot error out
if one of the RELAXED, VAPIC or SPINLOCKS isn't supported, for the same
reason we ignore invtsc, to not break restoring saved domains with older
libvirt.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: skip only cpu features
Pavel Hrdina [Tue, 29 Mar 2016 13:13:52 +0000 (15:13 +0200)]
qemu_process: skip only cpu features

This check is there to allow restore saved domain with older libvirt
where we included invtsc by default for host-passthrough model.  Don't
skip the whole function, but only the part that checks for invtsc.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agodocs: fix qemu version for hyperv features
Pavel Hrdina [Tue, 29 Mar 2016 11:10:12 +0000 (13:10 +0200)]
docs: fix qemu version for hyperv features

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agohost-validate: Fix suggestion for missing cpu cgroup
Andrea Bolognani [Tue, 29 Mar 2016 16:40:34 +0000 (18:40 +0200)]
host-validate: Fix suggestion for missing cpu cgroup

If the cpu cgroup is not found when validating an host for
LXC support, virt-host-validate will suggest to enable the
CONFIG_CGROUP_SCHED kconfig option.

The appropriate option is really CONFIG_CGROUP_CPU. The
QEMU checks already get that right, so no changes needed.

9 years agonss: FreeBSD support
Roman Bogorodskiy [Sun, 27 Mar 2016 18:07:10 +0000 (21:07 +0300)]
nss: FreeBSD support

 * tools/nss/libvirt_nss.[ch]: add BSD-comptabile wrappers and
   register via the nss_module_register() interface
 * m4/virt-nss.m4: add checks if we're building NSS for FreeBSD
 * tools/Makefile.am: handle target library name differences, as
   Linux needs libnss_libvirt.so.2 and FreeBSD needs
   nss_libvirt.so.1. Also, different syms files have to be used
   as Linux needs to export all the methods while FreeBSD
   only needs to have nss_module_register()
 * tests/nsstest.c, tests/nssmock.c: s/__linux__/NSS/
 * tests/nssmock.c: pass int instead of mode_t to va_arg() to please
   gcc 4.8
 * libvirt_nss_bsd.syms: FreeBSD syms file

9 years agolibxl: only disable domain death events in libxlDomainCleanup
Jim Fehlig [Mon, 28 Mar 2016 20:17:13 +0000 (14:17 -0600)]
libxl: only disable domain death events in libxlDomainCleanup

Remove disabling domain death events from libxlDomainStart error
path. The domain death event is already disabled in libxlDomainCleanup.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agolibxl: fix resource leaks in libxlDomainStart error paths
Chunyan Liu [Mon, 28 Mar 2016 19:55:42 +0000 (13:55 -0600)]
libxl: fix resource leaks in libxlDomainStart error paths

libxlDomainStart allocates and reserves resources that were not
being released in error paths. libxlDomainCleanup already handles
the job of releasing resources, and libxlDomainStart should call
it when encountering a failure.

Change the error handling logic to call libxlDomainCleanup on
failure. This includes acquiring the lease sooner and allowing
it to be released in libxlDomainCleanup on failure, similar to
the way other resources are reclaimed. With the lease now
released in libxlDomainCleanup, the release_dom label can be
renamed to cleanup_dom to better reflect its changed semantics.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agolibxl: rename cleanup_dom label
Jim Fehlig [Mon, 28 Mar 2016 19:47:07 +0000 (13:47 -0600)]
libxl: rename cleanup_dom label

Rename cleanup_dom label to destroy_dom, which better describes what
it does.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoconf: Remove now unused virDomainIOThreadIDMap
Peter Krempa [Mon, 21 Mar 2016 16:08:00 +0000 (17:08 +0100)]
conf: Remove now unused virDomainIOThreadIDMap

9 years agoconf: decrease iterations complexity when formatting iothreads
Peter Krempa [Mon, 21 Mar 2016 16:04:35 +0000 (17:04 +0100)]
conf: decrease iterations complexity when formatting iothreads

Create a bitmap of iothreads that have scheduler info set so that the
transformation algorithm does not have to iterate the empty bitmap many
times. By reusing self-expanding bitmaps the bitmap size does not need
to be pre-calculated.

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

9 years agoutil: bitmap: Introduce self-expanding bitmap APIs
Peter Krempa [Fri, 18 Mar 2016 14:41:59 +0000 (15:41 +0100)]
util: bitmap: Introduce self-expanding bitmap APIs

In some cases it's impractical to use the regular APIs as the bitmap
size needs to be pre-declared. These new APIs allow to use bitmaps that
self expand.

The new code adds a property to the bitmap to track the allocation of
memory so that VIR_RESIZE_N can be used.

9 years agoperf: fix build on non-Linux
Roman Bogorodskiy [Tue, 29 Mar 2016 16:23:46 +0000 (19:23 +0300)]
perf: fix build on non-Linux

 * Sync stubbed functions with prototypes
 * Add missing ATTRIBUTE_UNUSED where needed

Pushing under the build breaker rule.

9 years agoqemu: Fix /proc/**/stat parsing
Jiri Denemark [Tue, 29 Mar 2016 13:35:19 +0000 (15:35 +0200)]
qemu: Fix /proc/**/stat parsing

Since commit v1.3.2-119-g1e34a8f which enabled debug-threads in QEMU
qemuGetProcessInfo would fail to parse stats for any thread with a space
in its name.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agovirsh: blockpull: Support --bytes and scaled integers
Peter Krempa [Thu, 17 Mar 2016 12:41:00 +0000 (13:41 +0100)]
virsh: blockpull: Support --bytes and scaled integers

Use vshBlockJobOptionBandwidth to parse the bandwidth value which will
allow users to specify bandwidth in bytes or as a scaled integer.

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

9 years agovirsh: blockcopy: Support --bytes and scaled integers
Peter Krempa [Thu, 17 Mar 2016 12:40:30 +0000 (13:40 +0100)]
virsh: blockcopy: Support --bytes and scaled integers

Use vshBlockJobOptionBandwidth to parse the bandwidth value which will
allow users to specify bandwidth in bytes or as a scaled integer.

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

9 years agovirsh: blockcommit: Support --bytes and scaled integers
Peter Krempa [Thu, 17 Mar 2016 12:40:04 +0000 (13:40 +0100)]
virsh: blockcommit: Support --bytes and scaled integers

Use vshBlockJobOptionBandwidth to parse the bandwidth value which will
allow users to specify bandwidth in bytes or as a scaled integer.

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

9 years agovirsh: blockjob: Support --bytes and scaled integers as bandwidth
Peter Krempa [Tue, 29 Mar 2016 13:52:10 +0000 (15:52 +0200)]
virsh: blockjob: Support --bytes and scaled integers as bandwidth

Use vshBlockJobOptionBandwidth to parse the bandwidth value which will
allow users to specify bandwidth in bytes or as a scaled integer.

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

9 years agovsh: Introduce helper to parse --bandwidth
Peter Krempa [Tue, 29 Mar 2016 13:47:40 +0000 (15:47 +0200)]
vsh: Introduce helper to parse --bandwidth

Historically we've used 'unsigned long' and allowed wrapping of negative
numbers for bandwidth values. Add a helper that will simplify adding
support for scaled integers and support for byte granularity while
keeping the compatibility with the older approach.

9 years agovsh: Refactor vshCommandOptScaledInt
Peter Krempa [Thu, 17 Mar 2016 14:45:09 +0000 (15:45 +0100)]
vsh: Refactor vshCommandOptScaledInt

Fix control flow and spacing issues.

9 years agovsh: Tweak error message for scaled integers
Peter Krempa [Thu, 17 Mar 2016 14:40:43 +0000 (15:40 +0100)]
vsh: Tweak error message for scaled integers

It was too similar to the non-scaled alternative.

before:
error: Numeric value 'abc' for <size> option is malformed or out of range
after:
error: Scaled numeric value 'abc' for <size> option is malformed or out of range

9 years agoqemu: domain: Move and export qemuDomainDiskChainElement(Prepare|Revoke)
Peter Krempa [Mon, 29 Feb 2016 14:39:57 +0000 (15:39 +0100)]
qemu: domain: Move and export qemuDomainDiskChainElement(Prepare|Revoke)

Move the function to qemu_domain.c and export them for further use.

9 years agoqemu: Refactor qemuDomainPrepareDiskChainElement
Peter Krempa [Mon, 29 Feb 2016 14:29:32 +0000 (15:29 +0100)]
qemu: Refactor qemuDomainPrepareDiskChainElement

Now that there are only two elements in the enum, let's change it to a
bool and rename the function similarly to the one added in previous
commit.

9 years agoqemu: Split image access revoking from qemuDomainPrepareDiskChainElement
Peter Krempa [Mon, 29 Feb 2016 14:17:55 +0000 (15:17 +0100)]
qemu: Split image access revoking from qemuDomainPrepareDiskChainElement

Introduce qemuDomainDiskChainElementRevoke that revokes the access
rather than having a flag to do so.

9 years agoqemu: Kill qemuDiskPathToAlias
Peter Krempa [Fri, 26 Feb 2016 15:29:58 +0000 (16:29 +0100)]
qemu: Kill qemuDiskPathToAlias

The function has terrible semantics. Split it into two functions.

9 years agoqemu: monitor: Remove JSON impls of drive_add and drive_del
Peter Krempa [Fri, 11 Mar 2016 15:33:03 +0000 (16:33 +0100)]
qemu: monitor: Remove JSON impls of drive_add and drive_del

qemu won't ever add those functions directly to QMP. They will be
replaced with 'blockdev-add' and 'blockdev-del' eventually. At this time
there's no need to keep the stubs around.

Additionally the drive_del stub in JSON contained dead code in the
attempt to report errors. (VIR_ERR_OPERATION_UNSUPPORTED was never
reported). Since the text impl does have the same message it is reported
anyways.

9 years agoqemu: monitor: Drop qemuMonitorAttachDrive and leaves in call tree
Peter Krempa [Thu, 10 Mar 2016 14:34:37 +0000 (15:34 +0100)]
qemu: monitor: Drop qemuMonitorAttachDrive and leaves in call tree

Functions no longer required for attaching SCSI disks since
QEMU_CAPS_DEVICE is expected.

9 years agoqemu: hotplug: Assume support for -device in qemuDomainAttachSCSIDisk
Peter Krempa [Fri, 11 Mar 2016 14:51:17 +0000 (15:51 +0100)]
qemu: hotplug: Assume support for -device in qemuDomainAttachSCSIDisk

We've started to assume support for QEMU_CAPS_DEVICE. Doing so in the
SCSI disk hotplug code allows us to drop a lot of ugly legacy code.

9 years agobhyve: fix invalid hostsysinfo freeing
Maxim Nestratov [Mon, 28 Mar 2016 12:49:28 +0000 (15:49 +0300)]
bhyve: fix invalid hostsysinfo freeing

9 years agobhyve: cleanup unnecessary variables
Maxim Nestratov [Mon, 28 Mar 2016 12:24:49 +0000 (15:24 +0300)]
bhyve: cleanup unnecessary variables

9 years agovirsh: extend domstats command
Qiaowei Ren [Mon, 28 Mar 2016 13:30:33 +0000 (21:30 +0800)]
virsh: extend domstats command

This patch extend domstats command to match extended
virDomainListGetStats API in previous patch.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Message-id: 1459171833-26416-9-git-send-email-qiaowei.ren@intel.com

9 years agovirsh: implement new command to support perf
Qiaowei Ren [Mon, 28 Mar 2016 13:30:32 +0000 (21:30 +0800)]
virsh: implement new command to support perf

This patch add new perf command to enable/disable perf event
for a guest domain.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Message-id: 1459171833-26416-8-git-send-email-qiaowei.ren@intel.com

9 years agoperf: reenable perf events when libvirtd restart
Qiaowei Ren [Mon, 28 Mar 2016 13:30:31 +0000 (21:30 +0800)]
perf: reenable perf events when libvirtd restart

When libvirtd daemon restart, this patch will reenable those perf
events previously enabled.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Message-id: 1459171833-26416-7-git-send-email-qiaowei.ren@intel.com

9 years agoperf: add new xml element
Qiaowei Ren [Mon, 28 Mar 2016 13:30:30 +0000 (21:30 +0800)]
perf: add new xml element

This patch adds new xml element, and so we can have the option of
also having perf events enabled immediately at startup.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Message-id: 1459171833-26416-6-git-send-email-qiaowei.ren@intel.com

9 years agoqemu_driver: add support to perf event
Qiaowei Ren [Mon, 28 Mar 2016 13:30:29 +0000 (21:30 +0800)]
qemu_driver: add support to perf event

This patch implement the internal driver API for perf event into
qemu driver.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Message-id: 1459171833-26416-5-git-send-email-qiaowei.ren@intel.com

9 years agoperf: implement a set of util functions for perf event
Qiaowei Ren [Mon, 28 Mar 2016 13:30:28 +0000 (21:30 +0800)]
perf: implement a set of util functions for perf event

This patch implement a set of interfaces for perf event. Based on
these interfaces, we can implement internal driver API for perf,
and get the results of perf conuter you care about.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Message-id: 1459171833-26416-4-git-send-email-qiaowei.ren@intel.com

9 years agoperf: implement the remote protocol for perf event
Qiaowei Ren [Mon, 28 Mar 2016 13:30:27 +0000 (21:30 +0800)]
perf: implement the remote protocol for perf event

Add remote support for perf event.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Message-id: 1459171833-26416-3-git-send-email-qiaowei.ren@intel.com

9 years agoperf: add new public APIs for perf event
Qiaowei Ren [Mon, 28 Mar 2016 13:30:26 +0000 (21:30 +0800)]
perf: add new public APIs for perf event

API agreed on in
https://www.redhat.com/archives/libvir-list/2015-October/msg00872.html

* include/libvirt/libvirt-domain.h (virDomainGetPerfEvents,
virDomainSetPerfEvents): New declarations.
* src/libvirt_public.syms: Export new symbols.
* src/driver-hypervisor.h (virDrvDomainGetPerfEvents,
virDrvDomainSetPerfEvents): New typedefs.
* src/libvirt-domain.c: Implement virDomainGetPerfEvents and
virDomainSetPerfEvents.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Message-id: 1459171833-26416-2-git-send-email-qiaowei.ren@intel.com

9 years agodocs: Document NSS module
Michal Privoznik [Tue, 29 Mar 2016 11:19:56 +0000 (13:19 +0200)]
docs: Document NSS module

While we have a wiki page describing the feature [1] since the
feature is distributed in our .tar.gz we ought to document it. So
I went ahead, copied the wiki page and reformatted so it fits our
docs coding style.

1: http://wiki.libvirt.org/page/NSS_module

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agostorage: Initialize pool size parameters for refresh thread
Nitesh Konkar [Tue, 22 Mar 2016 08:34:50 +0000 (04:34 -0400)]
storage: Initialize pool size parameters for refresh thread

If the pool creation thread happens to detect the luns in
the scsi target, the size parameters will be calculated as
part of the refreshPool called from storagePoolCreate().

This means the virStoragePoolFCRefreshThread (commit id
'512b874') waiting to run and "refresh" the pool will
essentially double the allocation and capacity values.
A separate refresh would correct the values.

To avoid this, the FCRefreshThread needs to reinitialize
the pool size values prior to calling virStorageBackendSCSIFindLUs
which eventually calls virStorageBackendSCSINewLun and
updates the size values for each volume found.

9 years agostorage: rbd: Fix build
Peter Krempa [Tue, 29 Mar 2016 06:50:30 +0000 (08:50 +0200)]
storage: rbd: Fix build

After the recent commits the build didn't work for me. Fix it by
using size_t as the callback argument is using and the correct
formatter. The attempted fixup to use %llu as a formatter was wrong.

9 years agolibxl: remove reference to non-existent out label
Jim Fehlig [Mon, 28 Mar 2016 18:59:36 +0000 (12:59 -0600)]
libxl: remove reference to non-existent out label

Commit e6336442 changed the 'out:' label to 'cleanup'  in
libxlDomainAttachNetDevice(), but missed a comment referencing
the 'out:' label. Remove it from the comment since it is no
longer accurate anyhow.

9 years agotests: virtnettlscontexttest: Use virGetLastErrorMessage()
Cole Robinson [Fri, 18 Mar 2016 20:58:02 +0000 (16:58 -0400)]
tests: virtnettlscontexttest: Use virGetLastErrorMessage()

Use virGetLastErrorMessage() rather than open code it

9 years agodocs: website: more header spacing tweaks
Cole Robinson [Fri, 18 Mar 2016 19:57:11 +0000 (15:57 -0400)]
docs: website: more header spacing tweaks

- remove top padding for h1. this means page titles sit flush with the top
  of the side bar (like 'The virtualization API' on the front page)
- up the top padding for the remaining sections. makes it visually easier
  to tell adjacent header sections apart, especially in dense wiki pages
- use two different spacing levels for h2-h4 and h5-h6,
  gives pages some more visual flexibility
- use a slightly lower bottom padding... this makes top padding stick out
  more which makes it visually easier to differentiate between adjacent
  header sections

9 years agodocs: Update the hyperv feature qemu supported version
John Ferlan [Mon, 28 Mar 2016 14:57:55 +0000 (10:57 -0400)]
docs: Update the hyperv feature qemu supported version

In order to follow recent comments which indicate support for specific
feature bits are supported by a specific QEMU version add the version
from whence the relaxed, vapic, and spinlocks support was added.

9 years agoconf: qemu: Add support for more HyperV Enlightenment features
Maxim Nestratov [Thu, 10 Mar 2016 12:43:49 +0000 (15:43 +0300)]
conf: qemu: Add support for more HyperV Enlightenment features

This patch adds support for "vpindex", "runtime", "synic",
"stimer", and "vendor_id" features available in qemu 2.5+.

- When Hyper-V "vpindex" is on, guest can use MSR HV_X64_MSR_VP_INDEX
to get virtual processor ID.

- Hyper-V "runtime" enlightement feature allows to use MSR
HV_X64_MSR_VP_RUNTIME to get the time the virtual processor consumes
running guest code, as well as the time the hypervisor spends running
code on behalf of that guest.

- Hyper-V "synic" stands for Synthetic Interrupt Controller, which is
lapic extension controlled via MSRs.

- Hyper-V "stimer" switches on Hyper-V SynIC timers MSR's support.
Guest can setup and use fired by host events (SynIC interrupt and
appropriate timer expiration message) as guest clock events

- Hyper-V "reset" allows guest to reset VM.

- Hyper-V "vendor_id" exposes hypervisor vendor id to guest.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoconf: refactor hyperv features xml output
Nikolay Shirokovskiy [Thu, 10 Mar 2016 12:43:48 +0000 (15:43 +0300)]
conf: refactor hyperv features xml output

1. All hyperv features are tristate ones. So make tristate generating part common.
2. Reduce nesting on spinlocks.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoconf: refactor hyperv features parsing
Nikolay Shirokovskiy [Thu, 10 Mar 2016 12:43:47 +0000 (15:43 +0300)]
conf: refactor hyperv features parsing

1. All hyperv features are tristate ones. So make tristate parsing code common.
2. Reindent switch statement.
3. Reduce nesting in spinlocks parsing.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoutil: avoid getting stuck on macvtapN name created outside libvirt
Laine Stump [Mon, 28 Mar 2016 14:14:04 +0000 (10:14 -0400)]
util: avoid getting stuck on macvtapN name created outside libvirt

After the patches that added tracking of in-use macvtap names (commit
370608, first appearing in libvirt-1.3.2), if the function to allocate
a new macvtap device came to a device name created outside libvirt, it
would retry the same device name MACVLAN_MAX_ID (8191) times before
finally giving up in failure.

The problem was that virBitmapNextClearBit was always being called
with "0" rather than the value most recently checked (which would
increment each time through the loop), so it would always return the
same id (since we dutifully release that id after failing to create a
new device using it).

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

Signed-off-by: Laine Stump <laine@laine.org>
9 years agolibxl: fix hot add/remove VF from a pool
Chunyan Liu [Mon, 21 Mar 2016 08:11:40 +0000 (16:11 +0800)]
libxl: fix hot add/remove VF from a pool

For those VF allocated from a network pool, we need to set its backend
to be VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN so that later work can be
correct.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
9 years agotests: storagepoolxml2xmltest: Enable pool-rbd
Anatole Denis [Fri, 11 Mar 2016 16:50:54 +0000 (17:50 +0100)]
tests: storagepoolxml2xmltest: Enable pool-rbd

This test was commited 4 years ago, but was never enabled in
storagepoolxml2xmltest.c. This patch reactivates it, conditionnaly on RBD
storage support being enabled

9 years agotests: storagepoolxml2xmltest: Fix pool-rbd test
Anatole Denis [Fri, 11 Mar 2016 16:50:53 +0000 (17:50 +0100)]
tests: storagepoolxml2xmltest: Fix pool-rbd test

This test failed for two reasons:
* The uuid was missing from the input file
* The output file had the <name> in a different place from the actual output

9 years agoRevert "zfs: Only raw volumes are supported"
Roman Bogorodskiy [Sun, 27 Mar 2016 15:07:52 +0000 (11:07 -0400)]
Revert "zfs: Only raw volumes are supported"

This reverts commit bb5f2dc91f43f48ff726aa589bdac546738d2980.

The "if (vol->target.format != VIR_STORAGE_FILE_RAW)" check in the
createVol backend. This check is bogus because virStorageVolDefParseXML()
in conf/storage_conf.c sets target.format only if volOptions in
virStoragePoolTypeInfo has formatFromString set, and that's not the
case the zfs backend.

So the check always fails and breaks volume creation.

9 years agoRevert "logical: Only raw volumes are supported"
Roman Bogorodskiy [Sun, 27 Mar 2016 14:59:22 +0000 (10:59 -0400)]
Revert "logical: Only raw volumes are supported"

This reverts commit 6682d6219d4595b51f06867e0c30e7efd745f682.

The "if (vol->target.format != VIR_STORAGE_FILE_RAW)" check in the
createVol backend. This check is bogus because virStorageVolDefParseXML()
in conf/storage_conf.c sets target.format only if volOptions in
virStoragePoolTypeInfo has formatFromString set, and that's not the
case the logical backend.

So the check always fails and breaks volume creation.

9 years agolibxlDomainDetachDeviceLive: handle hostdev parent is network device
Chunyan Liu [Mon, 21 Mar 2016 08:11:38 +0000 (16:11 +0800)]
libxlDomainDetachDeviceLive: handle hostdev parent is network device

When hostdev parent is network device, should call
libxlDomainDetachNetDevice to detach the device from a higher level.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
9 years agolibxlDomainDetachNetDevice: cleanup codes
Chunyan Liu [Mon, 21 Mar 2016 08:11:37 +0000 (16:11 +0800)]
libxlDomainDetachNetDevice: cleanup codes

Adjust codes to make it cleaner.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
9 years agolibxlDomainAttachNetDevice: release actual deivce and remove hostdev when fail
Chunyan Liu [Mon, 21 Mar 2016 08:11:36 +0000 (16:11 +0800)]
libxlDomainAttachNetDevice: release actual deivce and remove hostdev when fail

When AttachNetDevice failed, should call networkReleaseActualDevice
to release actual device, and if actual device is hostdev, should
remove the hostdev from vm->def->hostdevs.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
9 years agonetwork: call proper start/stop functions for macvtap bridge-mode networks
Laine Stump [Fri, 25 Mar 2016 17:17:28 +0000 (13:17 -0400)]
network: call proper start/stop functions for macvtap bridge-mode networks

networkStartNetwork() and networkShutdownNetwork() were calling the
wrong type-specific function in the case of networks that were
configured for macvtap ("direct") bridge mode - they were instead
calling the functions for a tap+bridge network. Currently none of
these functions does anything (they just return 0) so it hasn't
created any problems, but that could change in the future.

9 years agonetwork: differentiate macvtap/bridge from host-bridge based networks
Laine Stump [Fri, 11 Mar 2016 15:59:19 +0000 (10:59 -0500)]
network: differentiate macvtap/bridge from host-bridge based networks

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

An attempt to simplify the code for the VIR_NETWORK_FORWARD_BRIDGE
case of networkUpdateState in commit b61db335 (first in release
1.2.14) resulted in networks based on macvtap bridge mode being
erroneously marked as inactive any time libvirtd was restarted.

The problem is that the original code had differentiated between a
network using tap devices to connect to an existing host-bridge device
(forward mode of VIR_NETWORK_FORWARD_BRIDGE and a non-NULL
def->bridge), and one using macvtap bridge mode to connect to any
ethernet device (still forward mode VIR_NETWORK_FORWARD_BRIDGE, but
null def->bridge), but the changed code assumed that all networks with
VIR_NETWORK_FORWARD_BRIDGE were tap + host-bridge networks, so a null
def->bridge was interpreted as "inactive".

This patch restores the original code in networkUpdateState

9 years agotest: Fix typo in testutils.h header guard
Christophe Fergeau [Fri, 25 Mar 2016 09:51:34 +0000 (10:51 +0100)]
test: Fix typo in testutils.h header guard

This changes __VIT_TEST_UTILS_H__ to __VIR_TEST_UTILS_H__

9 years agostorage/rbd: Use correct printf-modifier for uint64
Christophe Fergeau [Mon, 14 Mar 2016 10:41:05 +0000 (11:41 +0100)]
storage/rbd: Use correct printf-modifier for uint64

%zu is for size_t variables, not uint64 ones. This causes a warning when building on
a 32 bit linux.

9 years agovirTestSetEnvPath: Avoid clearing out PATH
Michal Privoznik [Fri, 25 Mar 2016 09:20:28 +0000 (10:20 +0100)]
virTestSetEnvPath: Avoid clearing out PATH

If the abs_builddir path already is in PATH and it's in the first
position, due to a bug in our code PATH would be cleared out.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoadmin_server: Avoid accessing unallocated memory
Michal Privoznik [Fri, 25 Mar 2016 09:18:00 +0000 (10:18 +0100)]
admin_server: Avoid accessing unallocated memory

In 68b726b93c11cc90 we tried to fix a mem leak. However, it
wasn't done quite well. Problem is, virNetDaemonGetServers() may
fail in which case virObjectListFreeCount() would be called with
-1 objects to free. But the number of elements is taken in
unsigned rather than signed integer.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: Replace some VIR_ERROR with vir*Error
Jovanka Gulicoska [Wed, 23 Mar 2016 18:32:13 +0000 (19:32 +0100)]
qemu: Replace some VIR_ERROR with vir*Error

qemuStateInitialize uses a mix of VIR_ERROR and standard vir*Error
calls. Prefer the standard vir*Error

9 years agoqemu: Don't duplicate virGetLastErrorMessage
Jovanka Gulicoska [Wed, 23 Mar 2016 18:31:50 +0000 (19:31 +0100)]
qemu: Don't duplicate virGetLastErrorMessage

These uses of virGetLastError message are just duplicating
virGetLastErrorMessage.

9 years agotestutils: Adapt to highly unlikely case
Michal Privoznik [Thu, 24 Mar 2016 13:57:42 +0000 (14:57 +0100)]
testutils: Adapt to highly unlikely case

Coverity pointed out that getenv("PATH") may return NULL. Well,
we check for that in virFindFileInPath() too. If this happens, we
will pass NULL into strstr(). Ouch.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agonsstest: Drop useless @data check
Michal Privoznik [Thu, 24 Mar 2016 13:54:58 +0000 (14:54 +0100)]
nsstest: Drop useless @data check

The variable is dereferenced prior its check for NULL. The check
itself does not make much sense anyway - it's our test, we know
we are not passing NULL.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirlog: Refactor virLogParseFilters
Erik Skultety [Wed, 16 Mar 2016 22:24:47 +0000 (23:24 +0100)]
virlog: Refactor virLogParseFilters

Patch 0b231195 refactored logging output parser to make it more readable.
This patch does similar thing to logging filter parser.

9 years agotests: Add new testcases to test parsing of log filters in virlogtest
Erik Skultety [Thu, 17 Mar 2016 08:37:24 +0000 (09:37 +0100)]
tests: Add new testcases to test parsing of log filters in virlogtest

9 years agotests: virlogtest: Fix testLogParseOutputs return value
Erik Skultety [Thu, 17 Mar 2016 09:16:19 +0000 (10:16 +0100)]
tests: virlogtest: Fix testLogParseOutputs return value

The test can return positive value even though it should have failed. It just
returns the value parser returned, which should be flipped back to -1 if
something went wrong or the result was unexpected, but it isn't.

9 years agoadmin_server: fix memory leak
Pavel Hrdina [Thu, 24 Mar 2016 09:48:30 +0000 (10:48 +0100)]
admin_server: fix memory leak

If caller of adminConnectListServers() pass NULL instead of servers we
need to free the list we've received from virNetDaemonGetServers().

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agogendispatch: Avoid comparing signed and unsigned vars
Michal Privoznik [Wed, 16 Mar 2016 09:24:38 +0000 (10:24 +0100)]
gendispatch: Avoid comparing signed and unsigned vars

The adminDispatchConnectListServers() function is generated by
our great perl script. However, it has a tiny flaw: if
adminConnectListServers() it calls fails, the control jumps onto
cleanup label where we try to free any list of servers built so
far. However, in the loop @i is unsigned (size_t) while @nresults
is signed (int). Currently, it does no harm because of the check
for @result being non-NULL. But if that ever changes in the
future, this bug will be hard to chase.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoevent-test: Check for virConnectRegisterCloseCallback return value
Michal Privoznik [Wed, 16 Mar 2016 08:32:44 +0000 (09:32 +0100)]
event-test: Check for virConnectRegisterCloseCallback return value

In an unlikely event of virConnectRegisterCloseCallback failing,
the error is ignored. This is an example file and we shouldn't
get a bad example.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoevent-test: Use goto cleanup instead of if else jungle
Michal Privoznik [Wed, 16 Mar 2016 08:55:47 +0000 (09:55 +0100)]
event-test: Use goto cleanup instead of if else jungle

Like in the rest of our code we tend to prefer 'goto' and
'cleanup' over 'if else' code structure. Do the same here.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemuxml2argvtest: Adapt to ethernet automatic tap creation
Michal Privoznik [Wed, 23 Mar 2016 15:19:26 +0000 (16:19 +0100)]
qemuxml2argvtest: Adapt to ethernet automatic tap creation

After 9c17d665fdc5 the tap device for ethernet network type is
automatically precreated before spawning qemu. Problem is, the
qemuxml2argvtest wasn't updated and thus is failing. Because of
all the APIs that new code is calling, I had to mock a lot. Also,
since the tap FDs are labeled separately from the rest of the
devices/files I had to enable NOP security driver for the test
too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoremote: Fix error message
Cole Robinson [Wed, 23 Mar 2016 20:51:59 +0000 (16:51 -0400)]
remote: Fix error message

We were printing the wrong MAX value

9 years agoqemuxml2argv: Mock virSCSIDeviceGetSgName
Michal Privoznik [Wed, 23 Mar 2016 08:57:06 +0000 (09:57 +0100)]
qemuxml2argv: Mock virSCSIDeviceGetSgName

When constructing SCSI hostdev command line for qemu, the
/sys/bus/scsi/devices/... dir is scanned. Unfortunately, even in
the tests. This is needed to determine the name of SCSI device to
passthrough to qemu, because in the domain XML we were given its
address instead. Anyway, we should not be touching live system
data in our test suite as it produced unpredictable results. The
test is regressing from 1e9a083742efe on.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoautocreate tap device for ethernet network type
Vasiliy Tolstov [Wed, 23 Mar 2016 11:37:59 +0000 (11:37 +0000)]
autocreate tap device for ethernet network type

If a user specify network type ethernet, then create it via libvirt and run
script if it provided. After this commit user does not need to
run external script to create tap device or add root permissions to qemu
process.

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
9 years agotests: hostdev: Add more tests
Andrea Bolognani [Fri, 18 Mar 2016 17:03:53 +0000 (18:03 +0100)]
tests: hostdev: Add more tests

Ensure the code behaves properly even for situations that were not
being considered before, such as simply detaching devices from the
host without attaching them to a guest and attaching devices as
managed even though they had already been manually detached from
the host.

9 years agohostdev: Use actual device when reattaching
Andrea Bolognani [Fri, 18 Mar 2016 17:03:52 +0000 (18:03 +0100)]
hostdev: Use actual device when reattaching

Instead of forcing the values for the unbind_from_stub, remove_slot
and reprobe properties, look up the actual device and use that when
calling virPCIDeviceReattach().

This ensures the device is restored to its original state after
reattach: for example, if it was not bound to any driver before
detach, it will not be bound forcefully during reattach.

9 years agohostdev: Save netdev configuration of actual device
Andrea Bolognani [Fri, 18 Mar 2016 17:03:51 +0000 (18:03 +0100)]
hostdev: Save netdev configuration of actual device

We would be just fine looking up the information in pcidevs most
of the time; however, some corner cases would not be handled
properly, so look up the actual device instead.

9 years agohostdev: Streamline device ownership tracking
Andrea Bolognani [Fri, 18 Mar 2016 17:03:50 +0000 (18:03 +0100)]
hostdev: Streamline device ownership tracking

After this patch, ownership of virPCIDevice instances is very easy
to keep track of: for each host PCI device, the only instance that
actually matters is the one inside one of the bookkeeping list.

Whenever some operation needs to be performed on a PCI device, the
actual device is looked up first; when this is not the case, a
comment explains the reason.

9 years agohostdev: Stop early if unmanaged devices have not been detached
Andrea Bolognani [Fri, 4 Mar 2016 15:16:16 +0000 (16:16 +0100)]
hostdev: Stop early if unmanaged devices have not been detached

Unmanaged devices, as the name suggests, are not detached
automatically from the host by libvirt before being attached to a
guest: it's the user's responsability to detach them manually
beforehand. If that preliminary step has not been performed, the
attach operation can't complete successfully.

Instead of relying on the lower layers to error out with cryptic
messages such as

  error: Failed to attach device from /tmp/hostdev.xml
  error: Path '/dev/vfio/12' is not accessible: No such file or directory

prevent the situation altogether and provide the user with a more
useful error message.

9 years agohostdev: Detect untracked inactive devices
Andrea Bolognani [Thu, 17 Mar 2016 16:41:31 +0000 (17:41 +0100)]
hostdev: Detect untracked inactive devices

Unmanaged devices are attached to guests in two steps: first,
the device is detached from the host and marked as inactive;
subsequently, it is marked as active and attached to the guest.

If the daemon is restarted between these two operations, we lose
track of the inactive device.

Steps 5 and 6 of virHostdevPreparePCIDevices() already subtly
take care of this situation, but some planned changes will make
it so that's no longer the case. Plus, explicit is always better
than implicit.

9 years agoqemuxml2argvtest: cleanup test
Pavel Hrdina [Tue, 15 Mar 2016 12:57:47 +0000 (13:57 +0100)]
qemuxml2argvtest: cleanup test

Use qemuProcessCreatePretendCmd instead duplicating required steps from
qemuProcessStart.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemuxml2argvtest: use driver.config and priv for qemuDomainSetPrivatePaths
Pavel Hrdina [Tue, 15 Mar 2016 12:54:24 +0000 (13:54 +0100)]
qemuxml2argvtest: use driver.config and priv for qemuDomainSetPrivatePaths

Update testutilsqemu to overwrite libDir and channelTargetDir and set
private paths using domain's privateData.  This changes is required for
following patch.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_driver: cleanup qemuConnectDomainXMLToNative
Pavel Hrdina [Thu, 17 Mar 2016 12:20:58 +0000 (13:20 +0100)]
qemu_driver: cleanup qemuConnectDomainXMLToNative

Use qemuProcessCreatePretendCmd instead duplicating required steps from
qemuProcessStart.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: introduce qemuProcessCreatePretendCmd
Pavel Hrdina [Tue, 22 Mar 2016 12:17:27 +0000 (13:17 +0100)]
qemu_process: introduce qemuProcessCreatePretendCmd

This will skip few steps from qemuProcessStart in order to create only
qemu CMD.  Use a VIR_QEMU_PROCESS_START_PRETEND for all the qemuProcess*
functions called by this one to not modify or check host.

This new function will be used later on for XMLToNative API and also for
qemuxml2argvtest to make sure that both API and test uses the same code
as qemuProcessStart.

We need also update qemuProcessInit to wrap few lines of code with check
that VIR_QEMU_PROCESS_START_PRETEND that makes sense only for
qemuProcessStart.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: move qemuDomainSetPrivatePaths to qemuProcessInit
Pavel Hrdina [Mon, 14 Mar 2016 09:31:28 +0000 (10:31 +0100)]
qemu_process: move qemuDomainSetPrivatePaths to qemuProcessInit

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: move checks to qemuProcessStartValidate
Pavel Hrdina [Thu, 17 Mar 2016 12:51:20 +0000 (13:51 +0100)]
qemu_process: move checks to qemuProcessStartValidate

Move all code that checks host and domain.  Do not check host if we use
VIR_QEMU_PROCESS_START_PRETEND flag.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu: update callers of qemuProcessStartValidate to use virDomainObjPtr
Pavel Hrdina [Thu, 17 Mar 2016 12:19:35 +0000 (13:19 +0100)]
qemu: update callers of qemuProcessStartValidate to use virDomainObjPtr

This change is required by following patches.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: introduce qemuProcessPrepareHost
Pavel Hrdina [Tue, 22 Mar 2016 12:16:05 +0000 (13:16 +0100)]
qemu_process: introduce qemuProcessPrepareHost

Move all code that modifies host system to this function.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: introduce qemuProcessPrepareDomain
Pavel Hrdina [Tue, 15 Mar 2016 12:00:59 +0000 (13:00 +0100)]
qemu_process: introduce qemuProcessPrepareDomain

Move all code that modifies only live XML to this function.  The new
VIR_QEMU_PROCESS_START_PRETEND flag will be used by qemuXMLToNative and
qemuxml2argvtest later in order to reuse the same code as
qemuProcessStart uses.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agotests: cleanup qemuxml2argvtest
Pavel Hrdina [Mon, 14 Mar 2016 09:37:40 +0000 (10:37 +0100)]
tests: cleanup qemuxml2argvtest

This removes the testFailed magic and makes the code more readable.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agonvram: generate it's path in qemuDomainDefPostParse
Pavel Hrdina [Wed, 9 Mar 2016 15:10:54 +0000 (16:10 +0100)]
nvram: generate it's path in qemuDomainDefPostParse

The postParse callback is the correct place to generate default values
that should be present in offline XML.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: check for correct return value while starting domain
Pavel Hrdina [Mon, 14 Mar 2016 15:54:03 +0000 (16:54 +0100)]
qemu_process: check for correct return value while starting domain

Function qemuProcessLaunch returns '-2' in case there was an error and
we need to cleanup labels.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu-hotplug: fix eject media
Pavel Hrdina [Thu, 17 Mar 2016 15:38:28 +0000 (16:38 +0100)]
qemu-hotplug: fix eject media

QEMU changed the error message to:

        "Tray of device 'drive-sata0-0-1' is not open"

and they may change the error massage in the future.

This updates the code to not depend on the text from the error message
but only on error itself.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>