]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agodocs: Reword virsh manpage for --uuid --name --table options
Nitesh Konkar [Thu, 5 Jan 2017 06:05:10 +0000 (11:35 +0530)]
docs: Reword virsh manpage for --uuid --name --table options

The virsh manpage lists options --uuid and --name as
mutually exclusive along option --table when actually
the option --table is mutually exclusive and can't go
with options --uuid and/or --name. This patch rewords the
virsh manpage to state the correct meaning.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agovirsh: Display perf enabled/disabled message for set operations
Nitesh Konkar [Wed, 28 Dec 2016 11:36:22 +0000 (17:06 +0530)]
virsh: Display perf enabled/disabled message for set operations

When setting perf events, the enabled/disabled perf events are not
listed. Since we know which events were changed it's possible to
print out the values on successful set, such as :

    virsh perf Domain --enable instructions --disable cache_misses
    instructions   : enabled
    cache_misses   : disabled

Created a helper to print the messages - use the vshPrintExtra to
adhere to the --quiet|-q option being set by some script. This will
cause the get code to print nothing, but will return success/failure.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agovirsh: Fix English grammar in the virsh perf manpage
Nitesh Konkar [Thu, 22 Dec 2016 14:06:15 +0000 (19:36 +0530)]
virsh: Fix English grammar in the virsh perf manpage

8 years agoUpdate remote_protocol-structs for new events
Jiri Denemark [Mon, 9 Jan 2017 18:53:55 +0000 (19:53 +0100)]
Update remote_protocol-structs for new events

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agosecret: add support for value change events
Daniel P. Berrange [Thu, 5 Jan 2017 13:51:07 +0000 (13:51 +0000)]
secret: add support for value change events

Emit an event whenever a secret value changes

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirsh: add secret lifecycle event handling
Daniel P. Berrange [Thu, 22 Dec 2016 16:39:43 +0000 (16:39 +0000)]
virsh: add secret lifecycle event handling

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoexamples: add secret events to event demo program
Daniel P. Berrange [Thu, 22 Dec 2016 16:36:40 +0000 (16:36 +0000)]
examples: add secret events to event demo program

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agosecret: add support for lifecycle events
Daniel P. Berrange [Thu, 22 Dec 2016 16:23:58 +0000 (16:23 +0000)]
secret: add support for lifecycle events

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoremote: implement secret lifecycle event APIs
Daniel P. Berrange [Thu, 22 Dec 2016 16:11:06 +0000 (16:11 +0000)]
remote: implement secret lifecycle event APIs

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoconf: simplify internal virSecretDef handling of usage
Daniel P. Berrange [Thu, 22 Dec 2016 15:40:11 +0000 (15:40 +0000)]
conf: simplify internal virSecretDef handling of usage

The public virSecret object has a single "usage_id" field
but the virSecretDef object has a different 'char *' field
for each usage type, but the code all assumes every usage
type has a corresponding single string. Get rid of the
pointless union in virSecretDef and just use "usage_id"
everywhere. This doesn't impact public XML format, only
the internal handling.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoconf: add secret event handling
Daniel P. Berrange [Thu, 22 Dec 2016 15:24:43 +0000 (15:24 +0000)]
conf: add secret event handling

Add helper APIs / objects for managing secret events

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoIntroduce secret lifecycle event APIs
Daniel P. Berrange [Thu, 22 Dec 2016 15:09:55 +0000 (15:09 +0000)]
Introduce secret lifecycle event APIs

Add public APIs to allow applications to watch for define and
undefine of secret objects.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoremote: fix struct for device removal failed event
Daniel P. Berrange [Mon, 9 Jan 2017 15:53:07 +0000 (15:53 +0000)]
remote: fix struct for device removal failed event

The handler for the device removal failed event was using
the struct for the device added event. Fortunately the
layout was the same, so this was harmless.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoAdd domain event for metadata changes
Daniel P. Berrange [Thu, 22 Dec 2016 14:41:30 +0000 (14:41 +0000)]
Add domain event for metadata changes

When changing the metadata via virDomainSetMetadata, we now
emit an event to notify the app of changes. This is useful
when co-ordinating different applications read/write of
custom metadata.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agocgroup: add virCgroupAddMachineTask stub for win32
Daniel P. Berrange [Mon, 9 Jan 2017 14:27:34 +0000 (14:27 +0000)]
cgroup: add virCgroupAddMachineTask stub for win32

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolxc: ensure libvirt_lxc and qemu-nbd move into systemd machine slice
Daniel P. Berrange [Thu, 5 Jan 2017 15:26:00 +0000 (15:26 +0000)]
lxc: ensure libvirt_lxc and qemu-nbd move into systemd machine slice

Currently when spawning containers with systemd, the container PID 1
will get moved into the systemd machine slice. Libvirt then manually
moves the libvirt_lxc and qemu-nbd processes into the cgroups associated
with the slice, but skips the systemd controller cgroup. This means that
from systemd's POV, libvirt_lxc and qemu-nbd are still part of the
libvirtd.service unit.

On systemctl daemon-reload, it will notice that libvirt_lxc & qemu-nbd
are in the libvirtd.service unit for the systemd controller, but in the
machine cgroups for resources. Systemd will thus move them back into
the libvirtd.service resource cgroups next time libvirtd is restarted.
This causes libvirtd to kill off the container due to incorrect cgroup
placement.

The solution is to ensure that when moving libvirt_lxc & qemu-nbd, we
also move the systemd cgroup controller placement. Normally this is
not something we ever want todo, but this is a special case as we are
intentionally wanting to move them to a different systemd unit.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agosecurity_selinux: s/virSecuritySELinuxSecurity/virSecuritySELinux/
Michal Privoznik [Wed, 14 Dec 2016 15:34:49 +0000 (16:34 +0100)]
security_selinux: s/virSecuritySELinuxSecurity/virSecuritySELinux/

It doesn't make much sense to have two different prefix for
functions within the same driver.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirutil: Provide non-linux impl for virGetFCHostNameByFabricWWN
Michal Privoznik [Mon, 9 Jan 2017 08:13:41 +0000 (09:13 +0100)]
virutil: Provide non-linux impl for virGetFCHostNameByFabricWWN

Currently, there's only linux implementation for
virGetFCHostNameByFabricWWN(). Since the symbol is exported in
our private symbols we ought to have implementation for other
platforms too. This also triggers compilation error on FreeBSD:

../src/.libs/libvirt_driver_storage_impl.a(libvirt_driver_storage_impl_la-storage_backend_scsi.o): In function `createVport':
/usr/home/jenkins/libvirt-master/systems/libvirt-freebsd/build/src/../../src/storage/storage_backend_scsi.c:740: undefined reference to `virGetFCHostNameByFabricWWN'

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirsh: Fix grammar - s/rather then/rather than
Chen Hanxiao [Sat, 7 Jan 2017 08:47:16 +0000 (16:47 +0800)]
virsh: Fix grammar - s/rather then/rather than

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agotests: Add "no-kvm-pit-device" testcase
Maxim Nestratov [Fri, 9 Dec 2016 14:28:06 +0000 (17:28 +0300)]
tests: Add "no-kvm-pit-device" testcase

Add a test case for when the QEMU_CAPS_NO_KVM_PIT capability is set.
This capability is mutually exclusive to QEMU_CAPS_KVM_PIT_TICK_POLICY
and results in the same output regardless of whether "discard" or
"delay" was specified in the guest XML for 'tickpolicy'.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agoqemu: Allow to specify pit timer tick policy=discard
Maxim Nestratov [Fri, 9 Dec 2016 14:28:05 +0000 (17:28 +0300)]
qemu: Allow to specify pit timer tick policy=discard

Separate out the "policy=discard" into it's own specific
qemu command line.

We'll rename "kvm-pit-device" test case to be "kvm-pit-discard"
since it has the syntax we'd be using.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agoqemu: Fix pit timer tick policy=delay
Maxim Nestratov [Fri, 9 Dec 2016 14:28:04 +0000 (17:28 +0300)]
qemu: Fix pit timer tick policy=delay

By a mistake, for the VIR_DOMAIN_TIMER_TICKPOLICY_DELAY qemu
command line creation, 'discard' was used instead of 'delay'
in commit id '1569fa14'.

Test "kvm-pit-delay" is fixed accordingly to show the correct
option being generated.

Remove the (now) redundant kvm-pit-device tests. As it turns
out there is no need to specify both QEMU_CAPS_NO_KVM_PIT and
QEMU_CAPS_KVM_PIT_TICK_POLICY since they are mutually exclusive
and "kvm-pit-device" becomes just the same as "kvm-pit-delay".

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agoiscsi: Add parent wwnn/wwpn or fabric capability for createVport
John Ferlan [Fri, 18 Nov 2016 12:08:37 +0000 (07:08 -0500)]
iscsi: Add parent wwnn/wwpn or fabric capability for createVport

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

As it turns out using only the 'parent' to achieve the goal of a
consistent vHBA parent has issues with reboots where the scsi_hostX
parent could change to scsi_hostY causing either failure to create
the vHBA or usage of the wrong HBA for our vHBA.

Thus add the ability to search for the "parent" by the parent wwnn/
wwpn values or just a fabric_name if someone only cares to ensure
usage of the same SAN for the vHBA.

8 years agoutil: Introduce virGetFCHostNameByFabricWWN
John Ferlan [Fri, 18 Nov 2016 12:36:18 +0000 (07:36 -0500)]
util: Introduce virGetFCHostNameByFabricWWN

Create a utility routine in order to read the scsi_host fabric_name files
looking for a match to a passed fabric_name

8 years agoconf: Add more fchost search fields for storage pool vHBA creation
John Ferlan [Thu, 17 Nov 2016 22:48:35 +0000 (17:48 -0500)]
conf: Add more fchost search fields for storage pool vHBA creation

Add new fields to the fchost structure to allow creation of a vHBA via
the storage pool when a parent_wwnn/parent_wwpn or parent_fabric_wwn is
supplied in the storage pool XML.

8 years agonodedev: Add the ability to create vHBA by parent wwnn/wwpn or fabric_wwn
John Ferlan [Thu, 17 Nov 2016 16:09:09 +0000 (11:09 -0500)]
nodedev: Add the ability to create vHBA by parent wwnn/wwpn or fabric_wwn

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

When creating a vHBA, the process is to feed XML to nodeDeviceCreateXML
that lists the <parent> scsi_hostX to use to create the vHBA. However,
between reboots, it's possible that the <parent> changes its scsi_hostX
to scsi_hostY and saved XML to perform the creation will either fail or
create a vHBA using the wrong parent.

So add the ability to provide "wwnn" and "wwpn" or "fabric_wwn" to
the <parent> instead of a name of the scsi_hostN that is the parent.
The allowed XML will thus be:

  <parent>scsi_host3</parent>  (current)

or

  <parent wwnn='$WWNN' wwpn='$WWPN'/>

or

  <parent fabric_wwn='$WWNN'/>

Using the wwnn/wwpn or fabric_wwn ensures the same 'scsi_hostN' is
selected between hardware reconfigs or host reboots. The fabric_wwn
Using the wwnn/wwpn pair will provide the most specific search option,
while fabric_wwn will at least ensure usage of the same SAN, but maybe
not the same scsi_hostN.

This patch will add the new fields to the nodedev.rng for input purposes
only since the input XML is essentially thrown away, no need to Format
the values since they'd already be printed as part of the scsi_host
data block.

New API virNodeDeviceGetParentHostByWWNs will take the parent "wwnn" and
"wwpn" in order to search the list of devices for matching capability
data fields wwnn and wwpn.

New API virNodeDeviceGetParentHostByFabricWWN will take the parent "fabric_wwn"
in order to search the list of devices for matching capability data field
fabric_wwn.

8 years agoqemu: command: Support new cpu feature argument syntax
Collin L. Walling [Sun, 18 Dec 2016 19:22:29 +0000 (14:22 -0500)]
qemu: command: Support new cpu feature argument syntax

Qemu has abandoned the +/-feature syntax in favor of key=value. Some
architectures (s390) do not support +/-feature. So we update libvirt to handle
both formats.

If we detect a sufficiently new Qemu (indicated by support for qmp
query-cpu-model-expansion) we use key=value else we fall back to +/-feature.

Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
8 years agotests: qemuxml2argv s390x cpu model
Jason J. Herne [Sun, 18 Dec 2016 19:22:28 +0000 (14:22 -0500)]
tests: qemuxml2argv s390x cpu model

Test cases for qemu s390x cpu model argument generation.

Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
8 years agoqemu-caps: Get host model directly from Qemu when available
Jiri Denemark [Fri, 6 Jan 2017 07:52:22 +0000 (08:52 +0100)]
qemu-caps: Get host model directly from Qemu when available

When qmp query-cpu-model-expansion is available probe Qemu for its view of the
host model. In kvm environments this can provide a more complete view of the
host model because features supported by Qemu and Kvm can be considered.

Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
8 years agoqemu: qmp query-cpu-model-expansion command
Collin L. Walling [Sun, 18 Dec 2016 19:22:26 +0000 (14:22 -0500)]
qemu: qmp query-cpu-model-expansion command

query-cpu-model-expansion is used to get a list of features for a given cpu
model name or to get the model and features of the host hardware/environment
as seen by Qemu/kvm.

Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
8 years agotests: domain capabilities: qemu 2.7 and 2.8 on s390x
Collin L. Walling [Sun, 18 Dec 2016 19:22:24 +0000 (14:22 -0500)]
tests: domain capabilities: qemu 2.7 and 2.8 on s390x

Tests domain capabilities on s390x using the Qemu 2.8 capabilities data.

Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
8 years agotest-data: Qemu caps replies and xml for s390x qemu 2.7 and 2.8
Collin L. Walling [Sun, 18 Dec 2016 19:22:23 +0000 (14:22 -0500)]
test-data: Qemu caps replies and xml for s390x qemu 2.7 and 2.8

Expected Qemu replies for versions 2.7 and 2.8 from the s390x
Qemu binary.

Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
8 years agos390-cpu: Remove nodeData and decode
Jason J. Herne [Sun, 18 Dec 2016 19:22:22 +0000 (14:22 -0500)]
s390-cpu: Remove nodeData and decode

On s390, the host's features are heavily influenced by not only the host
hardware but also by hardware microcode level, host OS version, qemu
version and kvm version. In this environment it does not make sense to
attempt to report exact host details.

Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Acked-by: Jiri Denemark <jdenemar@redhat.com>
8 years agos390: Cpu driver support for update and compare
Jason J. Herne [Sun, 18 Dec 2016 19:22:21 +0000 (14:22 -0500)]
s390: Cpu driver support for update and compare

Implement compare for s390. Required to test the guest against the host for
guest cpu model runnability checking. We always return IDENTICAL to bypass
Libvirt's checking. s390 will rely on Qemu to perform the runnability checking.

Implement update for s390. required to support use of cpu "host-model" mode.

Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Acked-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Remove /dev mount info properly
Martin Kletzander [Thu, 5 Jan 2017 15:24:55 +0000 (16:24 +0100)]
qemu: Remove /dev mount info properly

Just so it doesn't bite us in the future, even though it's unlikely.

And fix the comment above it as well.  Commit e08ee7cd3405 took the
info from the function it's calling, but that was lie itself in the
first place.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoutil: Don't lie in virFileGetMount*Subtree's docstrings
Martin Kletzander [Thu, 5 Jan 2017 15:19:08 +0000 (16:19 +0100)]
util: Don't lie in virFileGetMount*Subtree's docstrings

The resulting function virFileGetMountSubtreeImpl() just uses
virStringSortRevCompare or virStringSortCompare which uses strcmp().

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agodocs: Reference the right config option
Martin Kletzander [Thu, 5 Jan 2017 15:12:36 +0000 (16:12 +0100)]
docs: Reference the right config option

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemuDomainGetPreservedMounts: Fetch list of /dev/* mounts dynamically
Michal Privoznik [Thu, 5 Jan 2017 13:19:04 +0000 (14:19 +0100)]
qemuDomainGetPreservedMounts: Fetch list of /dev/* mounts dynamically

With my namespace patches, we are spawning qemu in its own
namespace so that we can manage /dev entries ourselves. However,
some filesystems mounted under /dev needs to be preserved in
order to be shared with the parent namespace (e.g. /dev/pts).
Currently, the list of mount points to preserve is hardcoded
which ain't right - on some systems there might be less or more
items under real /dev that on our list. The solution is to parse
/proc/mounts and fetch the list from there.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agointernal: Simplify STREQ_NULLABLE
Michal Privoznik [Fri, 9 Dec 2016 10:52:28 +0000 (11:52 +0100)]
internal: Simplify STREQ_NULLABLE

Our STREQ_NULLABLE and STRNEQ_NULLABLE macros are too
complicated. This was a result of some broken version of gcc.
However, that is long gone and therefore we can simplify the
macros.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuProcessLaunch: fix indentation
Michal Privoznik [Thu, 5 Jan 2017 13:19:21 +0000 (14:19 +0100)]
qemuProcessLaunch: fix indentation

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: snapshot: restart CPUs when recover from interrupted snapshot job
Wangjing (King, Euler) [Thu, 5 Jan 2017 09:34:17 +0000 (09:34 +0000)]
qemu: snapshot: restart CPUs when recover from interrupted snapshot job

If we restart libvirtd while VM was doing external memory snapshot, VM's
state be updated to paused as a result of running a migration-to-file
operation, and then VM will be left as paused state. In this case we must
restart the VM's CPUs to resume it.

Signed-off-by: Wang King <king.wang@huawei.com>
8 years agoutil: Remove need for extra VIR_FREE's in virGetFCHostNameByWWN
John Ferlan [Fri, 18 Nov 2016 13:55:35 +0000 (08:55 -0500)]
util: Remove need for extra VIR_FREE's in virGetFCHostNameByWWN

Rather than extraneous VIR_FREE's depending on where we are in the code,
move them to the top of the loop and in the cleanup path.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoscsi: Converge more createVport checks
John Ferlan [Tue, 3 Jan 2017 22:00:36 +0000 (17:00 -0500)]
scsi: Converge more createVport checks

Remove duplicated code - make one simple path through

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoscsi: Change order of checks in createVport
John Ferlan [Fri, 18 Nov 2016 12:44:52 +0000 (07:44 -0500)]
scsi: Change order of checks in createVport

Move the check for an already existing vHBA to the top of the function.
No sense in first decoding a provided parent if the next thing we're going
to do is fail if a provided wwnn/wwpn already exists.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoscsi: Clean up createVport exit paths
John Ferlan [Fri, 18 Nov 2016 12:19:28 +0000 (07:19 -0500)]
scsi: Clean up createVport exit paths

Use the ret = -1, goto cleanup, etc. rather than current hodgepodge.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agonodedev: Add ability to find a vport capable vHBA
John Ferlan [Wed, 16 Nov 2016 22:50:09 +0000 (17:50 -0500)]
nodedev: Add ability to find a vport capable vHBA

If a <parent> is not supplied in the XML used to create a non-persistent
vHBA, then instead of failing, let's try to find a "vports" capable node
device and use that.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agonodedev: Create helpers to search for vport capable nodedevs
John Ferlan [Thu, 17 Nov 2016 20:03:00 +0000 (15:03 -0500)]
nodedev: Create helpers to search for vport capable nodedevs

Extract out code from virNodeDeviceGetParentHost into helpers - it's
going to be reused in upcoming patches to search on more fields

Create virNodeDeviceFindVPORTCapDef in order to return a virNodeDevCapsDefPtr
of the VPORT_OPS and virNodeDeviceFindFCParentHost to use the function and
generate an error message if the device doesn't have the capability.

Also clean up the processing in virNodeDeviceGetParentHost to remove
need for goto's.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoNEWS: Remove spurious period
Andrea Bolognani [Wed, 4 Jan 2017 17:05:16 +0000 (18:05 +0100)]
NEWS: Remove spurious period

All other entries in the release notes omit the leading period,
and so should this one in order to maintain consistency.

8 years agoqemu: snapshot: Resume VM after live snapshot
Peter Krempa [Wed, 4 Jan 2017 12:23:31 +0000 (13:23 +0100)]
qemu: snapshot: Resume VM after live snapshot

Commit 4b951d1e38259ff5d03e9eedb65095eead8099e1 missed the fact that the
VM needs to be resumed after a live external checkpoint (memory
snapshot) where the cpus would be paused by the migration rather than
libvirt.

8 years agoHACKING: Reduce vertical whitespace
Andrea Bolognani [Wed, 4 Jan 2017 13:46:21 +0000 (14:46 +0100)]
HACKING: Reduce vertical whitespace

When generating the plain text version of the contributor
guidelines we add a ludicrous amount of vertical whitespace
in some spots. Tweak the XSLT stylesheet and regenerate the
now much better looking file.

8 years agoqemuDomainCreateDevice: Be more careful about device path
Michal Privoznik [Wed, 4 Jan 2017 13:24:16 +0000 (14:24 +0100)]
qemuDomainCreateDevice: Be more careful about device path

Again, not something that I'd hit, but there is a chance in
theory that this might bite us. Currently the way we decide
whether or not to create /dev entry for a device is by marching
first four characters of path with "/dev". This might be not
enough. Just imagine somebody has a disk image stored under
"/devil/path/to/disk". We ought to be matching against "/dev/".

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainAttachDeviceMknodHelper: Don't unlink() so often
Michal Privoznik [Wed, 4 Jan 2017 13:06:09 +0000 (14:06 +0100)]
qemuDomainAttachDeviceMknodHelper: Don't unlink() so often

Not that I'd encounter any bug here, but the code doesn't look
100% correct. Imagine, somebody is trying to attach a device to a
domain, and the device's /dev entry already exists in the qemu
namespace. This is handled gracefully and the control continues
with setting up ACLs and calling security manager to set up
labels. Now, if any of these steps fail, control jump on the
'cleanup' label and unlink() the file straight away. Even when it
was not us who created the file in the first place. This can be
possibly dangerous.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Handle EEXIST gracefully in qemuDomainCreateDevice
Michal Privoznik [Wed, 4 Jan 2017 12:57:06 +0000 (13:57 +0100)]
qemu: Handle EEXIST gracefully in qemuDomainCreateDevice

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

Imagine you have a domain configured in such way that you are
assigning two PCI devices that fall into the same IOMMU group.
With mount namespace enabled what happens is that for the first
PCI device corresponding /dev/vfio/X entry is created and when
the code tries to do the same for the second mknod() fails as
/dev/vfio/X already exists:

2016-12-21 14:40:45.648+0000: 24681: error :
qemuProcessReportLogError:1792 : internal error: Process exited
prior to exec: libvirt: QEMU Driver error : Failed to make device
/var/run/libvirt/qemu/windoze.dev//vfio/22: File exists

Worse, by default there are some devices that are created in the
namespace regardless of domain configuration (e.g. /dev/null,
/dev/urandom, etc.). If one of them is set as backend for some
guest device (e.g. rng, chardev, etc.) it's the same story as
described above.

Weirdly, in attach code this is already handled.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonetworkxml2conftest: Rename outxml to outconf
Martin Kletzander [Wed, 28 Dec 2016 20:21:03 +0000 (21:21 +0100)]
networkxml2conftest: Rename outxml to outconf

Just a name, I know, but it bothered me a lot since it does not refer
to XML.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agodocs: Use href_base in absolute links
Martin Kletzander [Wed, 14 Dec 2016 10:24:40 +0000 (11:24 +0100)]
docs: Use href_base in absolute links

That way all links work even if you click them in a subdirectory.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoHACKING: Regenerate
Andrea Bolognani [Wed, 4 Jan 2017 12:53:59 +0000 (13:53 +0100)]
HACKING: Regenerate

When updating the source file in commit bd4f4d168660, I forgot
that we also store the generated plain text version in git and
didn't regenerate it.

I also missed one spot that required an additional <p> tag, so
fix both mistakes in one go.

8 years agoutil: Fix syntax-check
Andrea Bolognani [Wed, 4 Jan 2017 11:47:01 +0000 (12:47 +0100)]
util: Fix syntax-check

Commit b9cc24839b75 introduced a new #define but neglected
to format it properly, thus breaking syntax-check.

8 years agodocs: Add missing <p> elements
Andrea Bolognani [Wed, 4 Jan 2017 11:14:13 +0000 (12:14 +0100)]
docs: Add missing <p> elements

Some of the <li> elements in the "General tips for contributing
patches" section were missing the corresponding inner <p> element,
so they ended up all lumped together.

8 years agoutil: Turn virFirewallAddRule() into a macro
Andrea Bolognani [Mon, 2 Jan 2017 18:15:30 +0000 (19:15 +0100)]
util: Turn virFirewallAddRule() into a macro

Clang 3.9 refuses to compile the existing code with the
following error:

  util/virfirewall.c:425:20: error: passing an object that undergoes
                             default argument promotion to 'va_start'
                             has undefined behavior [-Werror,-Wvarargs]
      va_start(args, layer);
                     ^
  util/virfirewall.c:420:37: note: parameter of type 'virFirewallLayer'
                             is declared here
                     virFirewallLayer layer,
                                      ^

This happens because 'layer' is of type virFirewallLayer, which
is an enum type and not a standard type such as eg. void* or int.

To solve the issue, turn virFirewallAddRule() from a very thin
wrapper around virFirewallAddRuleFullV() to a macro that expands
to a call to virFirewallAddRuleFull() - itself a very thin wrapper
around the aforementioned virFirewallAddRuleFullV() - with no loss
of functionality or type safety.

8 years agoqemu: Don't assume secret provided for LUKS encryption
John Ferlan [Thu, 22 Dec 2016 12:12:49 +0000 (07:12 -0500)]
qemu: Don't assume secret provided for LUKS encryption

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

If a secret was not provided for what was determined to be a LUKS
encrypted disk (during virStorageFileGetMetadata processing when
called from qemuDomainDetermineDiskChain as a result of hotplug
attach qemuDomainAttachDeviceDiskLive), then do not attempt to
look it up (avoiding a libvirtd crash) and do not alter the format
to "luks" when adding the disk; otherwise, the device_add would
fail with a message such as:

   "unable to execute QEMU command 'device_add': Property 'scsi-hd.drive'
    can't find value 'drive-scsi0-0-0-0'"

because of assumptions that when the format=luks that libvirt would have
provided the secret to decrypt the volume.

Access to unlock the volume will thus be left to the application.

8 years agobhyvexml2xmltest: Test more XMLs
Michal Privoznik [Mon, 26 Dec 2016 11:23:27 +0000 (12:23 +0100)]
bhyvexml2xmltest: Test more XMLs

Currently, bhyvexml2xmltest does only one test. We can do better.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agobhyvexml2argvdata: Add mac address to <interface/>
Michal Privoznik [Mon, 26 Dec 2016 11:35:50 +0000 (12:35 +0100)]
bhyvexml2argvdata: Add mac address to <interface/>

In the next patch we will need a stable mac address for
<interface/>.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agobhyvexml2argvdata: Fix <drive/> addresses
Michal Privoznik [Sun, 25 Dec 2016 16:56:22 +0000 (17:56 +0100)]
bhyvexml2argvdata: Fix <drive/> addresses

After c07d1c1c4f got merged it uncovered couple of broken domain
XMLs for bhyvexml2argv test. Some disk drives had incompatible
type of address configured.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonetworkxml2conftest: s/lo/lo0/ on non-Linux
Michal Privoznik [Sun, 25 Dec 2016 16:02:50 +0000 (17:02 +0100)]
networkxml2conftest: s/lo/lo0/ on non-Linux

After 478ddedc12 a bug is fixed where we wrongly presumed loopack
device name on non-Linux systems. It's lo0. However, the fix is
not reflected in the tests which are failing now.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agosrc: Build libvirt_nss.la iff WITH_NSS
Michal Privoznik [Sun, 25 Dec 2016 14:56:57 +0000 (15:56 +0100)]
src: Build libvirt_nss.la iff WITH_NSS

If the nss module is disabled we don't need to build the
supplementary library for it either.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agotests: Run nss*test iff WITH_NSS
Michal Privoznik [Sun, 25 Dec 2016 14:02:48 +0000 (15:02 +0100)]
tests: Run nss*test iff WITH_NSS

If the nss module is disabled we shouldn't run the tests that
include it either.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirt-nss: Introduce more checks before enabling NSS
Michal Privoznik [Sun, 25 Dec 2016 12:42:42 +0000 (13:42 +0100)]
virt-nss: Introduce more checks before enabling NSS

The plugin depends on more modules than we currently check for,
i.e. network driver and yajl library.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agotests: Move test_libraries a bit higher
Michal Privoznik [Sun, 25 Dec 2016 15:00:15 +0000 (16:00 +0100)]
tests: Move test_libraries a bit higher

In the Makefile in tests/ we initialize couple of variables like
test_programs, test_libraries and test_helpers. These variables
contain all the targets that we need to build in order to run
the test suite. So we initialize test_programs and test_helpers
and then conditionally add targets to them depending on what we
are building with. Then we repeat the same process with
test_libraries. It makes no sense to have two separate if-endif
sequences.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agotests: Run virmacmaptest iff WITH_YAJL
Michal Privoznik [Sun, 25 Dec 2016 09:13:31 +0000 (10:13 +0100)]
tests: Run virmacmaptest iff WITH_YAJL

Since the internal implementation relies on a json parser being
available, it make no sense to run this test if there's none
available.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirmacmap: Don't use hash table dataFree callback
Michal Privoznik [Mon, 2 Jan 2017 09:35:33 +0000 (10:35 +0100)]
virmacmap: Don't use hash table dataFree callback

Due to nature of operations we do over the string list (more
precisely due to how virStringListRemove() works), it is not the
best idea to use dataFree callback. Problem is, on MAC address
remove, the string list remove function modifies the original
list in place. Then, virHashUpdateEntry() is called which frees
all the data stored in the list rendering @newMacsList point to
freed data.

==16002== Invalid read of size 8
==16002==    at 0x50BC083: virFree (viralloc.c:582)
==16002==    by 0x513DC39: virStringListFree (virstring.c:251)
==16002==    by 0x51089B4: virMacMapHashFree (virmacmap.c:67)
==16002==    by 0x50EF30B: virHashAddOrUpdateEntry (virhash.c:352)
==16002==    by 0x50EF4FD: virHashUpdateEntry (virhash.c:415)
==16002==    by 0x5108BED: virMacMapRemoveLocked (virmacmap.c:129)
==16002==    by 0x51092D5: virMacMapRemove (virmacmap.c:346)
==16002==    by 0x402F02: testMACRemove (virmacmaptest.c:107)
==16002==    by 0x403F15: virTestRun (testutils.c:180)
==16002==    by 0x4032C4: mymain (virmacmaptest.c:205)
==16002==    by 0x405A3B: virTestMain (testutils.c:992)
==16002==    by 0x403D87: main (virmacmaptest.c:237)
==16002==  Address 0xdd5a4d0 is 0 bytes inside a block of size 24 free'd
==16002==    at 0x4C2AD6F: realloc (vg_replace_malloc.c:693)
==16002==    by 0x50BB99B: virReallocN (viralloc.c:245)
==16002==    by 0x513DC0B: virStringListRemove (virstring.c:235)
==16002==    by 0x5108BA6: virMacMapRemoveLocked (virmacmap.c:124)
==16002==    by 0x51092D5: virMacMapRemove (virmacmap.c:346)
==16002==    by 0x402F02: testMACRemove (virmacmaptest.c:107)
==16002==    by 0x403F15: virTestRun (testutils.c:180)
==16002==    by 0x4032C4: mymain (virmacmaptest.c:205)
==16002==    by 0x405A3B: virTestMain (testutils.c:992)
==16002==    by 0x403D87: main (virmacmaptest.c:237)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirmacmap: Fix variable handling
Michal Privoznik [Mon, 2 Jan 2017 08:50:24 +0000 (09:50 +0100)]
virmacmap: Fix variable handling

In virMacMapRemoveLocked() we have two variables: @macsList and
@newMacsList. Obviously, @newMacsList is supposed to hold pointer
to modified list but in fact it holds pointer to the old list.
It's confusing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agomaint: Sync bootstrap after gnulib update
Andrea Bolognani [Mon, 2 Jan 2017 11:10:26 +0000 (12:10 +0100)]
maint: Sync bootstrap after gnulib update

7fa7fe22d844 updated gnulib to the latest upstream commit,
but forgot to include the corresponding bootstrap changes.

8 years agomaint: update to latest gnulib
Michal Privoznik [Mon, 2 Jan 2017 10:44:46 +0000 (11:44 +0100)]
maint: update to latest gnulib

Required for the copyright year bump to keep 'make syntax-check'
happy, and also pulls in several portability fixes.

* .gnulib: Update to latest.
* bootstrap: Resync from upstream.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoNEWS: Update after qemu namespace fix
Michal Privoznik [Sat, 24 Dec 2016 16:55:48 +0000 (17:55 +0100)]
NEWS: Update after qemu namespace fix

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agodocs: Update docs for recently added physical adjustments
John Ferlan [Thu, 22 Dec 2016 14:44:14 +0000 (09:44 -0500)]
docs: Update docs for recently added physical adjustments

Add the description for <physical>... One is a new feature - the API
and the other is an improvement for the volume xml output.

8 years agovz: get disks statistics for CTs
Maxim Nestratov [Mon, 5 Dec 2016 13:52:56 +0000 (16:52 +0300)]
vz: get disks statistics for CTs

A CT disk statistics is reported with prefix "hdd" and we should use
it to extract data.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: set boot from disk for CT only when there is no root filesystem
Maxim Nestratov [Mon, 5 Dec 2016 13:11:15 +0000 (16:11 +0300)]
vz: set boot from disk for CT only when there is no root filesystem

Before, boot devices information for CTs was always empty and we
didn't indicate that containers can boot from disk.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: report disks either as disks or filesystems depending on original xml
Maxim Nestratov [Mon, 5 Dec 2016 13:34:52 +0000 (16:34 +0300)]
vz: report disks either as disks or filesystems depending on original xml

Virtuozzo SDK interface doesn't differ filesystems from disks and sees them as disks.
Before, we always mistakenly presented disks based on files as filesystems, which is
not completely correct. Now we are going to show either disks or filesystems depending
on a hint, which uses boot device section of VZ config. Though this information
doesn't change booting order of a CT, it is used by vz libvirt interface as a hint
for libvirt representation of disks. Since now, if we have filesystems in input xml,
then we add them to VZ booting devices list and rely on this information to show
corresponding libvirt xml.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: don't add implicit devices for CTs
Maxim Nestratov [Mon, 5 Dec 2016 13:23:21 +0000 (16:23 +0300)]
vz: don't add implicit devices for CTs

Implicit devices like controllers are confusing for CTs and
function virDomainDefAddImplicitDevices never intended to be called
for CTs.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: report "scsi" bus for disks when nothing was set explixitly
Maxim Nestratov [Mon, 5 Dec 2016 12:37:12 +0000 (15:37 +0300)]
vz: report "scsi" bus for disks when nothing was set explixitly

This is necessary to show CTs created out of libvirt correctly.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agotests: enable virpolkittest on any ELF platform
Pino Toscano [Mon, 28 Nov 2016 13:47:30 +0000 (14:47 +0100)]
tests: enable virpolkittest on any ELF platform

This tests uses preload, which should work on any ELF-based platform
(and indeed it passes on Linux, GNU/kFreeBSD, and FreeBSD).

Also remove the WITH_DBUS conditional, as the test is already built
based on that conditional.

8 years agom4/virt-arg: Rename LIBVIRT_ARG_WITH* macros
Andrea Bolognani [Thu, 22 Dec 2016 11:49:51 +0000 (12:49 +0100)]
m4/virt-arg: Rename LIBVIRT_ARG_WITH* macros

LIBVIRT_ARG_WITH_ALT is more generic than LIBVIRT_ARG_WITH, which
is tailored at switching features on and off.

Rename the macros according to their intended purpose, and add
some documentation to help developers pick between the two.

8 years agom4/virt-arg: Move LIBVIRT_ARG_* macros to their own file
Andrea Bolognani [Thu, 22 Dec 2016 11:25:26 +0000 (12:25 +0100)]
m4/virt-arg: Move LIBVIRT_ARG_* macros to their own file

They're not just used, or supposed to be just used, for
library-related arguments, so they deserve to have their
own separate file.

8 years agom4/virt-gnutls: properly backup CFLAGS and LIBS for AC_CHECK_* macros
Pavel Hrdina [Thu, 22 Dec 2016 13:09:43 +0000 (14:09 +0100)]
m4/virt-gnutls: properly backup CFLAGS and LIBS for AC_CHECK_* macros

Commit 943ddcb7120 partially fixed this bug in gnutls configure code.
However we also need to backup and modify CFLAGS and do if for
AC_CHECK_HEADERS as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoNEWS: Update after virtio console on ppc64 fix
Andrea Bolognani [Wed, 21 Dec 2016 17:36:00 +0000 (18:36 +0100)]
NEWS: Update after virtio console on ppc64 fix

8 years agom4/virt-gnutls: use AC_CHECK_FUNCS to detect availability of functions
Pavel Hrdina [Thu, 22 Dec 2016 09:13:25 +0000 (10:13 +0100)]
m4/virt-gnutls: use AC_CHECK_FUNCS to detect availability of functions

Sigh, autoconf has AC_CHECK_FUNC and AC_CHECK_FUNCS and both check
whether some function exists or not.  However in addition to the obvious
difference that the later is able to check multiple functions it also
defines HAVE_FUNCTION_NAME for each function.

Commit 680d2f49da moved the code to separate file, but also blindly
changed the macro to AC_CHECK_FUNC without confronting the
documentation.

Reported-by: John Ferlan <jferlan@redhat.com>
<https://www.redhat.com/archives/libvir-list/2016-December/msg01086.html>

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt-lib: use correct format of package name for AC_ARG_* macros
Pavel Hrdina [Wed, 21 Dec 2016 21:19:22 +0000 (22:19 +0100)]
m4/virt-lib: use correct format of package name for AC_ARG_* macros

Introduced by commit 25034b3c40 and reused by commit 4519e94b743.
This patch silences warning printed by configure:

  configure: WARNING: unrecognized options: --with-qemu-user

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agom4/virt-loader-nvram: use quotation for list of loader:nvram pairs
Pavel Hrdina [Wed, 21 Dec 2016 20:23:43 +0000 (21:23 +0100)]
m4/virt-loader-nvram: use quotation for list of loader:nvram pairs

The bug was introduced by commit 08c2d1480b.  The string must be quoted
because it is used as function argument.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoNEWS: Fix indentation
Andrea Bolognani [Wed, 21 Dec 2016 17:37:18 +0000 (18:37 +0100)]
NEWS: Fix indentation

8 years agoAllow virtio-console on PPC64
Shivaprasad G Bhat [Wed, 19 Oct 2016 13:29:02 +0000 (18:59 +0530)]
Allow virtio-console on PPC64

virQEMUCapsSupportsChardev existing checks returns true
for spapr-vty alone. Instead verify spapr-vty validity
and let the logic to return true for other device types
so that virtio-console passes.

The non-pseries machines dont have spapr-vio-bus. So, the
function always returned false for them before.

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

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
8 years agoqemu: clean out unused migrate to unix
Nikolay Shirokovskiy [Tue, 20 Dec 2016 07:05:49 +0000 (10:05 +0300)]
qemu: clean out unused migrate to unix

8 years agoconfigure: group all storage driver checks together
Pavel Hrdina [Tue, 13 Dec 2016 09:36:14 +0000 (10:36 +0100)]
configure: group all storage driver checks together

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move storage ZFS check to its own file
Pavel Hrdina [Wed, 7 Dec 2016 14:59:19 +0000 (15:59 +0100)]
configure: move storage ZFS check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move storage Gluster check to its own file
Pavel Hrdina [Wed, 7 Dec 2016 14:52:39 +0000 (15:52 +0100)]
configure: move storage Gluster check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move storage Sheepdog check to its own file
Pavel Hrdina [Wed, 7 Dec 2016 14:48:37 +0000 (15:48 +0100)]
configure: move storage Sheepdog check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move storage RBD check to its own file
Pavel Hrdina [Wed, 7 Dec 2016 14:44:08 +0000 (15:44 +0100)]
configure: move storage RBD check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move storage disk check to its own file
Pavel Hrdina [Mon, 12 Dec 2016 17:21:51 +0000 (18:21 +0100)]
configure: move storage disk check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move storage mpath check to its own file
Pavel Hrdina [Mon, 12 Dec 2016 17:21:11 +0000 (18:21 +0100)]
configure: move storage mpath check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move storage SCSI check to its own file
Pavel Hrdina [Wed, 7 Dec 2016 12:13:00 +0000 (13:13 +0100)]
configure: move storage SCSI check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoconfigure: move storage iSCSI check to its own file
Pavel Hrdina [Wed, 7 Dec 2016 12:12:31 +0000 (13:12 +0100)]
configure: move storage iSCSI check to its own file

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