]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
9 years agoconf: add caps to virDomainDefFormat*
Joao Martins [Wed, 3 Feb 2016 21:40:35 +0000 (21:40 +0000)]
conf: add caps to virDomainDefFormat*

And use the newly added caps->host.netprefix (if it exists) for
interface names that match the autogenerated target names.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
9 years agoconf: add prefix in virDomainNetDefParseXML
Joao Martins [Wed, 3 Feb 2016 21:40:34 +0000 (21:40 +0000)]
conf: add prefix in virDomainNetDefParseXML

And use the newly added caps->host.netprefix for free interface
names that match the autogenerated target names.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
9 years agoconf: add net device prefix to capabilities
Joao Martins [Wed, 3 Feb 2016 21:40:33 +0000 (21:40 +0000)]
conf: add net device prefix to capabilities

In the reverted commit d2e5538b1, the libxl driver was changed to copy
interface names autogenerated by libxl to the corresponding network def
in the domain's virDomainDef object. The copied name is freed when the
domain transitions to the shutoff state. But when migrating a domain,
the autogenerated name is included in the XML sent to the destination
host.  It is possible an interface with the same name already exists on
the destination host, causing migration to fail.

This patch defines a new capability for setting the network device
prefix that will be used in the driver. Valid prefixes are
VIR_NET_GENERATED_PREFIX or the one announced by the driver.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
9 years agovirsh: display if ZFS storage backend is enabled
Roman Bogorodskiy [Sun, 3 Jan 2016 02:25:35 +0000 (05:25 +0300)]
virsh: display if ZFS storage backend is enabled

Make 'virsh -V' list ZFS storage backend if it's enabled.

9 years agoconfigure: zfs: enable on Linux
Roman Bogorodskiy [Thu, 4 Feb 2016 00:13:10 +0000 (03:13 +0300)]
configure: zfs: enable on Linux

ZFS-on-Linux implementation of ZFS starting with version 0.6.4
contains all the features we use. Additionally, as we support
'volmode' option handling that's not available on ZoL but is
available on FreeBSD, there is no need to block ZFS storage driver
on Linux anymore.

So un-mark zfs storage driver as FreeBSD-only.

9 years agostorage: zfs: flexible use of 'volmode' option
Roman Bogorodskiy [Thu, 4 Feb 2016 00:03:12 +0000 (03:03 +0300)]
storage: zfs: flexible use of 'volmode' option

There are slight differences in various ZFS implementations.
Specifically, ZFS on FreeBSD requires to set value of 'volmode'
option to 'dev' to expose volumes as raw disk device (that's what
we need) rather than geom provides, for example.

With ZFS on Linux, however, such option is not available and
volumes exposed like we need by default.

To make our implementation more flexible, only pass 'volmode'
when it's supported. Support is checked by parsing usage
information of the 'zfs get' command.

9 years agoutil: Export remoteSerializeTypedParameters internally via util
Erik Skultety [Tue, 2 Feb 2016 13:13:15 +0000 (14:13 +0100)]
util: Export remoteSerializeTypedParameters internally via util

Same as for deserializer, this method might get handy for admin one day.
The major reason for this patch is to stay consistent with idea, i.e.
when deserializer can be shared, why not serializer as well. The only
problem to be solved was that the daemon side serializer uses a code
snippet which handles sparse arrays returned by some APIs as well as
removes any string parameters that can't be returned to older clients.
This patch makes of the new virTypedParameterRemote datatype introduced
by one of the pvious patches.

9 years agoutil: Export remoteFreeTypedParameters internally via util
Erik Skultety [Tue, 2 Feb 2016 12:19:35 +0000 (13:19 +0100)]
util: Export remoteFreeTypedParameters internally via util

Since the method is static to remote_driver, it can't even be used by our
daemon. Other than that, it would be useful to be able to use it with admin as
well. This patch uses the new virTypedParameterRemote datatype introduced in
one of previous patches.

9 years agoutil: Export remoteDeserializeTypedParameters internally via util
Erik Skultety [Thu, 28 Jan 2016 16:27:42 +0000 (17:27 +0100)]
util: Export remoteDeserializeTypedParameters internally via util

Currently, the deserializer is hardcoded into remote_driver which makes
it impossible for admin to use it. One way to achieve a shared implementation
(besides moving the code to another module) would be pass @ret_params_val as a
void pointer as opposed to the remote_typed_param pointer and add a new extra
argument specifying which of those two protocols is being used and typecast
the pointer at the function entry. An example from remote_protocol:

struct remote_typed_param_value {
        int type;
        union {
                int i;
                u_int ui;
                int64_t l;
                uint64_t ul;
                double d;
                int b;
                remote_nonnull_string s;
        } remote_typed_param_value_u;
};
typedef struct remote_typed_param_value remote_typed_param_value;

struct remote_typed_param {
        remote_nonnull_string field;
        remote_typed_param_value value;
};

That would leave us with a bunch of if-then-elses that needed to be used across
the method. This patch takes the other approach using the new datatype
introduced in one of earlier commits.

9 years agoutil: Introduce virTypedParameterRemote datatype
Erik Skultety [Tue, 2 Feb 2016 14:33:30 +0000 (15:33 +0100)]
util: Introduce virTypedParameterRemote datatype

Both admin and remote protocols define their own types
(remote_typed_param vs admin_typed_param). Because of the naming convention,
admin typed params wouldn't be able to reuse the serialization/deserialization
methods, which are tailored for use by remote protocol, even if those method
were exported properly. In that case, introduce a new internal data type
structurally copying both admin and remote protocols which, eventually, would
allow serializer and deserializer to be used in a more generic way.

9 years agoqemu: qemuDomainRename and virDomainObjListNumOfDomains ABBA deadlock fix
Nikolay Shirokovskiy [Mon, 1 Feb 2016 09:33:45 +0000 (12:33 +0300)]
qemu: qemuDomainRename and virDomainObjListNumOfDomains ABBA deadlock fix

A pretty nasty deadlock occurs while trying to rename a VM in parallel
with virDomainObjListNumOfDomains.
The short description of the problem is as follows:

Thread #1:

qemuDomainRename:
    ------> aquires domain lock by qemuDomObjFromDomain
       ---------> waits for domain list lock in any of the listed functions:
          - virDomainObjListFindByName
          - virDomainObjListRenameAddNew
          - virDomainObjListRenameRemove

Thread #2:

virDomainObjListNumOfDomains:
    ------> aquires domain list lock
       ---------> waits for domain lock in virDomainObjListCount

Introduce generic virDomainObjListRename function for renaming domains.
It aquires list lock in right order to avoid deadlock. Callback is used
to make driver specific domain updates.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agosystemd: Add virSystemdGetMachineNameByPID
Martin Kletzander [Tue, 2 Feb 2016 18:45:55 +0000 (19:45 +0100)]
systemd: Add virSystemdGetMachineNameByPID

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoRevert "systemd: Escape only needed characters for machined"
Martin Kletzander [Mon, 1 Feb 2016 15:28:29 +0000 (16:28 +0100)]
Revert "systemd: Escape only needed characters for machined"

This reverts commit 0e0149ce91d84f40b98acf4c4bb0da6e29b9c15c.

That commit was added to comply with systemd rules that were changed in
the meantime, so this patch is pointless.

9 years agoSimplify virDomainParseMemory
Ján Tomko [Fri, 29 Jan 2016 17:00:13 +0000 (18:00 +0100)]
Simplify virDomainParseMemory

Do not store the return value of virDomainParseScaledValue,
it was overwritten anyway.

Delete the cleanup label, there is nothing to clean up.

9 years agoconf: Split out logic to determine whether cpupin was provided
Peter Krempa [Mon, 4 Jan 2016 18:39:02 +0000 (19:39 +0100)]
conf: Split out logic to determine whether cpupin was provided

9 years agoqemu: domain: Prepare qemuDomainDetectVcpuPids for reuse
Peter Krempa [Thu, 17 Dec 2015 15:04:23 +0000 (16:04 +0100)]
qemu: domain: Prepare qemuDomainDetectVcpuPids for reuse

Free the old vcpupids array in case when this function is called again
during the run of the VM. It will be later reused in the vCPU hotplug
code. The function now returns the number of detected VCPUs.

9 years agoqemu: Move and rename qemuProcessDetectVcpuPIDs to qemuDomainDetectVcpuPids
Peter Krempa [Tue, 15 Dec 2015 13:45:33 +0000 (14:45 +0100)]
qemu: Move and rename qemuProcessDetectVcpuPIDs to qemuDomainDetectVcpuPids

Future patches will tweak and reuse the function in different places so
move it separately first.

9 years agoqemu: cpu hotplug: Set vcpu state directly in the new structure
Peter Krempa [Thu, 17 Dec 2015 12:19:54 +0000 (13:19 +0100)]
qemu: cpu hotplug: Set vcpu state directly in the new structure

Avoid using virDomainDefSetVcpus when we can set it directly in the
structure.

9 years agoconf: Add helper to retrieve bitmap of active vcpus for a definition
Peter Krempa [Mon, 7 Dec 2015 05:36:37 +0000 (06:36 +0100)]
conf: Add helper to retrieve bitmap of active vcpus for a definition

In some cases it may be better to have a bitmap representing state of
individual vcpus rather than iterating the definition. The new helper
creates a bitmap representing the state from the domain definition.

9 years agocgroup: Clean up virCgroupGetPercpuStats
Peter Krempa [Mon, 7 Dec 2015 06:39:34 +0000 (07:39 +0100)]
cgroup: Clean up virCgroupGetPercpuStats

Use 'ret' for return variable name, clarify use of 'param_idx' and avoid
unnecessary 'success' label. No functional changes. Also document the
function.

9 years agoqemu: Don't crash when create fails early
Martin Kletzander [Tue, 2 Feb 2016 21:08:59 +0000 (22:08 +0100)]
qemu: Don't crash when create fails early

Since commit 714080791778e3dfbd484ccb3953bffd820b8ba9 we are generating
socket path later than before -- when starting a domain.  That makes one
particular inconsistent state of a chardev, which was not possible
before, currently valid.  However, SELinux security driver forgot to
guard the main restoring function by a check for NULL-paths.  So make it
no-op for NULL paths, as in the DAC driver.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agocfg.mk: Adjust sc_prohibit_int_ijk to support 'exempt from syntax-check'
Erik Skultety [Thu, 28 Jan 2016 15:46:32 +0000 (16:46 +0100)]
cfg.mk: Adjust sc_prohibit_int_ijk to support 'exempt from syntax-check'

There might be cases, like with typed params, where triggering this check isn't
desirable. But including the whole module in the exception regex is not always
to right way of doing things. By adding an option to manually disable this check
on a specific occurrence, the module itself will still be checked against the
rule.

9 years agoqemuDomainResume: allow to resume domain with guest panicked
Dmitry Andreev [Sat, 23 Jan 2016 16:08:45 +0000 (19:08 +0300)]
qemuDomainResume: allow to resume domain with guest panicked

In case of guest panicked, preserved crashed domain has stopped CPUs.
It's not possible to use tools like WinDbg for the problem investigation
until we start CPUs back.

9 years agoqemu: return -1 on error paths in qemuDomainSaveImageStartVM
Nikolay Shirokovskiy [Mon, 1 Feb 2016 13:28:40 +0000 (16:28 +0300)]
qemu: return -1 on error paths in qemuDomainSaveImageStartVM

Error paths after sending the event that domain is started written as if ret = -1
which is set at the beginning of the function. It's common idioma to keep 'ret'
equal to -1 until the end of function where it is set to 0. But here we use ret
to keep result of restore operation too and thus breaks the idioma and its users :)

Let's use different variable to hold restore result.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agological: Clean up allocation when building regex on the fly
John Ferlan [Mon, 1 Feb 2016 15:26:02 +0000 (10:26 -0500)]
logical: Clean up allocation when building regex on the fly

Rather than a loop reallocating space to build the regex, just allocate
it once up front, then if there's more than 1 nextent, append a comma and
another regex_unit string.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agological: Use 'stripes' value for mirror/raid segtype
John Ferlan [Mon, 1 Feb 2016 14:59:44 +0000 (09:59 -0500)]
logical: Use 'stripes' value for mirror/raid segtype

The 'stripes' value is described as the "Number of stripes or mirrors in
a logical volume". So add "mirror" and anything that starts with "raid"
to the list of segtypes that can have an 'nextents' value greater than one.
Use of raid segtypes (raid1, raid4, raid5*, raid6*, and raid10) is favored
over mirror in more recent lvm code.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agological: Use VIR_APPEND_ELEMENT instead of VIR_REALLOC_N
John Ferlan [Mon, 1 Feb 2016 14:39:00 +0000 (09:39 -0500)]
logical: Use VIR_APPEND_ELEMENT instead of VIR_REALLOC_N

Rather than preallocating a set number of elements, then walking through
the extents and adjusting the specific element in place, use the APPEND
macros to handle that chore.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoinclude: Handle case when builddir == srcdir
Michal Privoznik [Mon, 1 Feb 2016 11:24:58 +0000 (12:24 +0100)]
include: Handle case when builddir == srcdir

In my previous commit a70f3b1c779120129 I've tried to fix case
when building from VPATH and a file wasn't being installed.
However, my fix broke non-VPATH build.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agotests: avoid realpath in test-lib.sh
Eric Blake [Mon, 1 Feb 2016 18:43:32 +0000 (11:43 -0700)]
tests: avoid realpath in test-lib.sh

Ever since commit ace4aecd, running 'make check' on RHEL 6 produces:

./test-lib.sh: line 21: realpath: command not found

for every shell script test, because 'realpath' was not part of
coreutils back then.

* tests/test-lib.sh (_scriptdir): Compute with only portable shell.

Signed-off-by: Eric Blake <eblake@redhat.com>
9 years agovirsh: improve waiting for block job readiness
Michael Chapman [Wed, 27 Jan 2016 02:24:54 +0000 (13:24 +1100)]
virsh: improve waiting for block job readiness

After a block job hits 100%, we only need to apply a timeout waiting for
a block job event if exactly one of the BLOCK_JOB or BLOCK_JOB_2
callbacks were able to be registered.

If neither callback could be registered, there's clearly no need for a
timeout.

If both callbacks were registered, then we're guaranteed to eventually
get one of the events. The path being used by virsh must be exactly the
source path or target device in the domain's disk definition, and these
are the respective strings sent back in these two events.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
9 years agovirsh: ensure SIGINT action is reset on all errors
Michael Chapman [Wed, 27 Jan 2016 02:24:53 +0000 (13:24 +1100)]
virsh: ensure SIGINT action is reset on all errors

If virTimeMillisNow() fails, the SIGINT action must be reset back to
its previous state.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
9 years agovirsh: be consistent with style of loop exit
Michael Chapman [Wed, 27 Jan 2016 02:24:52 +0000 (13:24 +1100)]
virsh: be consistent with style of loop exit

When waiting for a block job, the various statuses (COMPLETED, READY,
CANCELED, etc.) should all be treated consistently by having the loop be
exited with "break". Use "goto cleanup" for the error cases only, when
no block job status is available.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
9 years agovirsh: avoid unnecessary progress updates
Michael Chapman [Wed, 27 Jan 2016 02:24:51 +0000 (13:24 +1100)]
virsh: avoid unnecessary progress updates

There is no need to call virshPrintJobProgress() unless the block job's
cur or end cursors have changed since the last iteration.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
9 years agoqemu: Mark some functions as static
Cole Robinson [Thu, 28 Jan 2016 20:05:54 +0000 (15:05 -0500)]
qemu: Mark some functions as static

9 years agofdstream: Realign
Michal Privoznik [Tue, 8 Dec 2015 10:00:34 +0000 (11:00 +0100)]
fdstream: Realign

Some lines in this file are misaligned which fires up my OCD.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: Align dump options for watchdog and on_crash events
Boris Fiuczynski [Wed, 20 Jan 2016 12:13:45 +0000 (13:13 +0100)]
qemu: Align dump options for watchdog and on_crash events

Having on_crash set to either coredump-destroy or coredump-restart
creates core dumps with option memory-only in the directory specified
by auto_dump_path. When a watchdog is triggered with the action dump
the core dump is also placed into the directory specified by auto_dump_path
but is created without the option memory-only.

This patch sets the option memory-only also for core dumps created by the
watchdog event.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com>
9 years agoincludes: Install libvirt-common.h
Michal Privoznik [Sat, 30 Jan 2016 10:55:45 +0000 (11:55 +0100)]
includes: Install libvirt-common.h

The libvirt-common.h is build time generated file from .in.
Obviously, it's generated into builddir and not srcdir. Problem
is, the list of header files to install, virinc_HEADERS contains
only $(srcdir)/*.h and this misses libvirt-common.h. This problem
is pretty obvious when doing a VPATH build.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agological: Create helper virStorageBackendLogicalParseVolExtents
John Ferlan [Fri, 22 Jan 2016 17:02:18 +0000 (12:02 -0500)]
logical: Create helper virStorageBackendLogicalParseVolExtents

Create a helper routine in order to parse any extents information
including the extent size, length, and the device string contained
within the generated 'lvs' output string.

A future patch would then be able to avoid the code more cleanly

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agorbd: Open in Read-Only mode when refreshing a volume
Wido den Hollander [Thu, 28 Jan 2016 10:20:23 +0000 (11:20 +0100)]
rbd: Open in Read-Only mode when refreshing a volume

By opening a RBD volume in Read-Only we do not register a
watcher on the header object inside the Ceph cluster.

Refreshing a volume only calls rbd_stat() which is a operation
which does not write to a RBD image.

This allows us to use a cephx user which has no write
permissions if we would want to use the libvirt storage pool
for informational purposes only.

It also saves us a write into the Ceph cluster which should
speed up refreshing a RBD pool.

rbd_open_read_only() is available in all librbd versions which
also support rbd_open().

Signed-off-by: Wido den Hollander <wido@widodh.nl>
9 years agorbd: Implement buildVolFrom using RBD cloning
Wido den Hollander [Wed, 27 Jan 2016 10:20:09 +0000 (11:20 +0100)]
rbd: Implement buildVolFrom using RBD cloning

RBD supports cloning by creating a snapshot, protecting it and create
a child image based on that snapshot afterwards.

The RBD storage driver will try to find a snapshot with zero deltas between
the current state of the original volume and the snapshot.

If such a snapshot is found a clone/child image will be created using
the rbd_clone2() function from librbd.

rbd_clone2() is available in librbd since Ceph version Dumpling (0.67) which
dates back to August 2013.

It will use the same features, strip size and stripe count as the parent image.

This implementation will only create a single snapshot on the parent image if
never changes. This reduces the amount of snapshots created for that RBD image
which benefits the performance of the Ceph cluster.

During build the decision will be made to use either rbd_diff_iterate() or
rbd_diff_iterate2().

The latter is faster, but only available on Ceph versions after 0.94 (Hammer).

Cloning is only supported if RBD format 2 is used. All images created by libvirt
are already format 2.

If a RBD format 1 image is used as the original volume the backend will report
a VIR_ERR_OPERATION_UNSUPPORTED error.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
9 years agorbd: Add support for wiping RBD volumes using TRIM.
Wido den Hollander [Wed, 27 Jan 2016 10:20:08 +0000 (11:20 +0100)]
rbd: Add support for wiping RBD volumes using TRIM.

Using VIR_STORAGE_VOL_WIPE_ALG_TRIM a RBD volume can be trimmed down
to 0 bytes using rbd_discard()

Effectively all the data on the volume will be lost/gone, but the volume
remains available for use afterwards.

Starting at offset 0 the storage pool will call rbd_discard() in stripe
size * count increments which is usually 4MB. Stripe size being 4MB and
count 1.

rbd_discard() is available since Ceph version Dumpling (0.67) which dates
back to August 2013.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
9 years agostorage: Add TRIM algorithm to storage volume API
Wido den Hollander [Wed, 27 Jan 2016 10:20:07 +0000 (11:20 +0100)]
storage: Add TRIM algorithm to storage volume API

This new algorithm adds support for wiping volumes using TRIM.

It does not overwrite all the data in a volume, but it tells the
backing storage pool/driver that all bytes in a volume can be
discarded.

It depends on the backing storage pool how this is handled.

A SCSI backend might send UNMAP commands to remove all data present
on a LUN.

A Ceph backend might use rbd_discard() to instruct the Ceph cluster
that all data on that RBD volume can be discarded.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
9 years agorbd: Add support for wiping RBD volumes
Wido den Hollander [Wed, 27 Jan 2016 10:20:06 +0000 (11:20 +0100)]
rbd: Add support for wiping RBD volumes

When wiping the RBD image will be filled with zeros started
at offset 0 and until the end of the volume.

This will result in the RBD volume growing to it's full allocation
on the Ceph cluster. All data on the volume will be overwritten
however, making it unavailable.

It does NOT take any RBD snapshots into account. The original data
might still be in a snapshot of that RBD volume.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
9 years agostorage: Adjust fix virStorageBackendVolWipeLocal switch
Wido den Hollander [Fri, 29 Jan 2016 12:35:35 +0000 (07:35 -0500)]
storage: Adjust fix virStorageBackendVolWipeLocal switch

Use the cast of (virStorageVolWipeAlgorithm) adding the missing case:'s
(VIR_STORAGE_VOL_WIPE_ALG_ZERO and VIR_STORAGE_VOL_WIPE_ALG_LAST).

Additionally, the old code would also still run the SCRUB command on
default since it didn't go to cleanup when a invalid flag was supplied.
We now go to cleanup and exit if a invalid flag would be provided.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
9 years agological: Fix comment examples for virStorageBackendLogicalFindLVs
John Ferlan [Fri, 22 Jan 2016 16:01:05 +0000 (11:01 -0500)]
logical: Fix comment examples for virStorageBackendLogicalFindLVs

When commit id '82c1740a' made changes to the output format (changing from
using a ',' separator to '#'), the examples in the lvs output from the
comments weren't changed.

Additionally, the two new fields added ('segtype' and 'stripes') were
not included in the output, leaving it well confusing.

This patch fixes the sample output, adds a 'striped' example, and makes
other comment related adjustments for long line and spacing between followup
'NB' remarks (while I'm there).

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agopci: Use bool return type for some virPCIDeviceGet*() functions
Andrea Bolognani [Thu, 28 Jan 2016 08:21:43 +0000 (09:21 +0100)]
pci: Use bool return type for some virPCIDeviceGet*() functions

The affected functions are:

  virPCIDeviceGetManaged()
  virPCIDeviceGetUnbindFromStub()
  virPCIDeviceGetRemoveSlot()
  virPCIDeviceGetReprobe()

Change their return type from unsigned int to bool: the corresponding
members in struct _virPCIDevice are defined as bool, and even the
corresponding virPCIDeviceSet*() functions take a bool value as input
so there's no point in these functions having unsigned int as return
type.

Suggested-by: John Ferlan <jferlan@redhat.com>
9 years agogendispatch: Don't output spaces on empty line
Michal Privoznik [Thu, 28 Jan 2016 14:20:17 +0000 (15:20 +0100)]
gendispatch: Don't output spaces on empty line

In our generator for some code we put empty lines in the output
to separate blocks of code. However, in some cases we put couple
of spaces on the empty line too. It's not bug, it just isn't
nice.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agopci: Add debug messages when unbinding from stub driver
Andrea Bolognani [Fri, 15 Jan 2016 10:57:26 +0000 (11:57 +0100)]
pci: Add debug messages when unbinding from stub driver

Unbinding a PCI device from the stub driver can require several steps,
and it can be useful for debugging to be able to trace which of these
steps are performed and which are skipped for each device.

9 years agopci: Phase out virPCIDeviceReattachInit()
Andrea Bolognani [Tue, 19 Jan 2016 14:58:31 +0000 (15:58 +0100)]
pci: Phase out virPCIDeviceReattachInit()

The name is confusing, and there are just two uses: one is a test case,
and the other will be removed as part of an upcoming refactoring of
the hostdev code.

9 years agoqemu: don't iterate vcpus using priv->nvcpupids in qemuProcessSetSchedParams
Peter Krempa [Fri, 4 Dec 2015 13:30:01 +0000 (14:30 +0100)]
qemu: don't iterate vcpus using priv->nvcpupids in qemuProcessSetSchedParams

This should be the last offender.

9 years agoconf: disallow empty cpuset for emulatorpin
Peter Krempa [Wed, 6 Jan 2016 15:07:42 +0000 (16:07 +0100)]
conf: disallow empty cpuset for emulatorpin

It's disallowed in the API.

9 years agoconf: disallow empty cpusets for vcpu pinning when parsing XML
Peter Krempa [Wed, 6 Jan 2016 14:34:13 +0000 (15:34 +0100)]
conf: disallow empty cpusets for vcpu pinning when parsing XML

They are disallowed in the pinning API and as default cpuset.

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

9 years agoqemu: Don't use priv->ncpus to iterate cgroup setting
Peter Krempa [Tue, 8 Dec 2015 14:14:16 +0000 (15:14 +0100)]
qemu: Don't use priv->ncpus to iterate cgroup setting

Iterate over all cpus skipping inactive ones.

9 years agovirnetdevopenvswitch: Don't call strlen() twice on the same string
Andrea Bolognani [Wed, 27 Jan 2016 09:35:17 +0000 (10:35 +0100)]
virnetdevopenvswitch: Don't call strlen() twice on the same string

Commit 871e10f fixed a memory corruption error, but called strlen()
twice on the same string to do so. Even though the compiler is
probably smart enough to optimize the second call away, having a
single invocation makes the code slightly cleaner.

Suggested-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirnetdevmacvlan: Provide stubs for build without macvtap
Michal Privoznik [Wed, 27 Jan 2016 08:49:54 +0000 (09:49 +0100)]
virnetdevmacvlan: Provide stubs for build without macvtap

In 370608b4c76f we have introduced two new internal APIs.
However, there are no stubs for build without macvtap. Therefore
build on systems lacking macvtap support (e.g. mingw or freebds)
fails when trying to link.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoFix libvirtd free() segfault when migrating guest with deleted open vswitch port
Jason J. Herne [Tue, 26 Jan 2016 18:25:17 +0000 (13:25 -0500)]
Fix libvirtd free() segfault when migrating guest with deleted open vswitch port

libvirtd crashes on free()ing portData for an open vswitch port if that port
was deleted.  To reproduce:

ovs-vsctl del-port vnet0
virsh migrate --live kvm1 qemu+ssh://dstHost/system

Error message:
libvirtd: *** Error in `/usr/sbin/libvirtd': free(): invalid pointer: 0x000003ff90001e20 ***

The problem is that virCommandRun can return an empty string in the event that
the port being queried does not exist. When this happens then we are
unconditionally overwriting a newline character at position strlen()-1. When
strlen is 0, we overwrite memory that does not belong to the string.

The fix: Only overwrite the newline if the string is not empty.

Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
9 years agoutil: keep/use a bitmap of in-use macvtap devices
Laine Stump [Tue, 19 Jan 2016 19:20:54 +0000 (14:20 -0500)]
util: keep/use a bitmap of in-use macvtap devices

This patch creates two bitmaps, one for macvlan device names and one
for macvtap. The bitmap position is used to indicate that libvirt is
currently using a device with the name macvtap%d/macvlan%d, where %d
is the position in the bitmap. When requested to create a new
macvtap/macvlan device, libvirt will now look for the first clear bit
in the appropriate bitmap and derive the device name from that rather
than just starting at 0 and counting up until one works.

When libvirtd is restarted, the qemu driver code that reattaches to
active domains calls the appropriate function to "re-reserve" the
device names as it is scanning the status of running domains.

Note that it may seem strange that the retry counter now starts at
8191 instead of 5. This is because we now don't do a "pre-check" for
the existence of a device once we've reserved it in the bitmap - we
move straight to creating it; although very unlikely, it's possible
that someone has a running system where they have a large number of
network devices *created outside libvirt* named "macvtap%d" or
"macvlan%d" - such a setup would still allow creating more devices
with the old code, while a low retry max in the new code would cause a
failure. Since the objective of the retry max is just to prevent an
infinite loop, and it's highly unlikely to do more than 1 iteration
anyway, having a high max is a reasonable concession in order to
prevent lots of new failures.

9 years agoutil: increase libnl buffer size
Leno Hou [Mon, 11 Jan 2016 06:59:00 +0000 (14:59 +0800)]
util: increase libnl buffer size

In the following cases nl_recv() was returning the error "No buffer
space available":

* When switching CPUs to offline/online in a system more than 128 cpus
* When using virsh to destroy domain in a system with many interfaces

This patch sets the buffer size for all netlink sockets created by
libnl to 128K and turns on message peeking for nl_recv(). This
eliminates the "No buffer space available" errors seen in the cases
above, and also preempts other future errors the smaller buffers could
have caused.

Signed-off-by: Leno Hou <houqy@linux.vnet.ibm.com>
Signed-off-by: Laine Stump <laine@laine.org>
9 years agodevice: cleanup input device code
Pavel Hrdina [Mon, 11 Jan 2016 11:40:32 +0000 (12:40 +0100)]
device: cleanup input device code

The current code was a little bit odd.  At first we've removed all
possible implicit input devices from domain definition to add them later
back if there was any graphics device defined while parsing XML
description.  That's not all, while formating domain definition to XML
description we at first ignore any input devices with bus different to
USB and VIRTIO and few lines later we add implicit input devices to XML.

This seems to me as a lot of code for nothing.  This patch may look
to be more complicated than original approach, but this is a preferred
way to modify/add driver specific stuff only in those drivers and not
deal with them in common parsing/formating functions.

The update is to add those implicit input devices into config XML to
follow the real HW configuration visible by guest OS.

There was also inconsistence between our behavior and QEMU's in the way,
that in QEMU there is no way how to disable those implicit input devices
for x86 architecture and they are available always, even without graphics
device.  This applies also to XEN hypervisor.  VZ driver already does its
part by putting correct implicit devices into live XML.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agotests: add some missing tests to qemuxml2xmltest
Pavel Hrdina [Fri, 8 Jan 2016 14:48:06 +0000 (15:48 +0100)]
tests: add some missing tests to qemuxml2xmltest

Those tests are in qemuargv2xmltest and it makes sense to include them
also in qemuxml2xmltest and qemuxml2argvtest.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agotests: use virtTestDifferenceFull in tests where we have output file
Pavel Hrdina [Thu, 10 Dec 2015 13:12:13 +0000 (14:12 +0100)]
tests: use virtTestDifferenceFull in tests where we have output file

This will enable regenerate functionality for those tests to make
developer lives easier while updating tests.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agovircgroup: Finish renaming of virCgroupIsolateMount
Michal Privoznik [Tue, 26 Jan 2016 16:37:29 +0000 (17:37 +0100)]
vircgroup: Finish renaming of virCgroupIsolateMount

In dc576025c360 we renamed virCgroupIsolateMount function to
virCgroupBindMount. However, we forgot about one occurrence in
section of the code which provides stubs for platforms without
support for CGroups like *BSD for instance.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agolxc: don't try to hide parent cgroups inside container
Daniel P. Berrange [Fri, 22 Jan 2016 16:07:18 +0000 (16:07 +0000)]
lxc: don't try to hide parent cgroups inside container

On the host when we start a container, it will be
placed in a cgroup path of

   /machine.slice/machine-lxc\x2ddemo.scope

under /sys/fs/cgroup/*

Inside the containers' namespace we need to setup
/sys/fs/cgroup mounts, and currently will bind
mount /machine.slice/machine-lxc\x2ddemo.scope on
the host to appear as / in the container.

While this may sound nice, it confuses applications
dealing with cgroups, because /proc/$PID/cgroup
now does not match the directory in /sys/fs/cgroup

This particularly causes problems for systems and
will make it create repeated path components in
the cgroup for apps run in the container eg

  /machine.slice/machine-lxc\x2ddemo.scope/machine.slice/machine-lxc\x2ddemo.scope/user.slice/user-0.slice/session-61.scope

This also causes any systemd service that uses
sd-notify to fail to start, because when systemd
receives the notification it won't be able to
identify the corresponding unit it came from.
In particular this break rabbitmq-server startup

Future kernels will provide proper cgroup namespacing
which will handle this problem, but until that time
we should not try to play games with hiding parent
cgroups.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoqemu: add reporting of vCPU wait time
Daniel P. Berrange [Thu, 10 Dec 2015 14:37:01 +0000 (14:37 +0000)]
qemu: add reporting of vCPU wait time

The VIR_DOMAIN_STATS_VCPU flag to virDomainListGetStats
enables reporting of stats about vCPUs. Currently we
only report the cumulative CPU running time and the
execution state.

This adds reporting of the wait time - time the vCPU
wants to run, but the host scheduler has something else
running ahead of it.

The data is reported per-vCPU eg

$ virsh domstats --vcpu demo
 Domain: 'demo'
   vcpu.current=4
   vcpu.maximum=4
   vcpu.0.state=1
   vcpu.0.time=1420000000
   vcpu.0.wait=18403928
   vcpu.1.state=1
   vcpu.1.time=130000000
   vcpu.1.wait=10612111
   vcpu.2.state=1
   vcpu.2.time=110000000
   vcpu.2.wait=12759501
   vcpu.3.state=1
   vcpu.3.time=90000000
   vcpu.3.wait=21825087

In implementing this I notice our reporting of CPU execute
time has very poor granularity, since we are getting it
from /proc/$PID/stat. As a future enhancement we should
prefer to get CPU execute time from /proc/$PID/schedstat
or /proc/$PID/sched (if either exist on the running kernel)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agovirsh: fix cpu-stats command output format issue
Luyao Huang [Tue, 26 Jan 2016 02:25:05 +0000 (10:25 +0800)]
virsh: fix cpu-stats command output format issue

After commit 57177f1, the cpu-stats command format change to:

CPU0:
    cpu_time         14401.507878990 seconds
    vcpu_time    14378732785511

vcpu_time is not user friendly. After this patch, it will
change back:
CPU0:
    cpu_time         14401.507878990 seconds
    vcpu_time        14378.732785511 seconds

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

Signed-off-by: Luyao Huang <lhuang@redhat.com>
9 years agoutil: buffer: Sanitize comment for virBufferAddBuffer
Peter Krempa [Thu, 7 Jan 2016 13:18:21 +0000 (14:18 +0100)]
util: buffer: Sanitize comment for virBufferAddBuffer

Idioms are usually weird and obscure when translated literally.

9 years agotest: Touch up error message when attempting to pin invalid vCPU
Peter Krempa [Mon, 4 Jan 2016 18:46:31 +0000 (19:46 +0100)]
test: Touch up error message when attempting to pin invalid vCPU

Report
error: invalid argument: requested vcpu '100' is not present in the domain
instead of
error: invalid argument: requested vcpu is higher than allocated vcpus

9 years agotests: qemuxml2xml: Order pinning information numerically
Peter Krempa [Mon, 4 Jan 2016 16:00:51 +0000 (17:00 +0100)]
tests: qemuxml2xml: Order pinning information numerically

A future patch will refactor the storage of the pinning information in a
way where the ordering will be lost. Order them numerically to avoid
changing the tests later.

9 years agovirsh: cpu-stats: Remove unneeded flags
Peter Krempa [Mon, 7 Dec 2015 11:49:12 +0000 (12:49 +0100)]
virsh: cpu-stats: Remove unneeded flags

virDomainGetCPUStats doesn't support flags so there's no need to carry
the 'flags' variable around. Additionally since the API is poorly
designed I doubt that it will be extended.

9 years agovirsh: cpu-stats: Extract common printing code into a function
Peter Krempa [Mon, 7 Dec 2015 08:21:08 +0000 (09:21 +0100)]
virsh: cpu-stats: Extract common printing code into a function

Simplify the code by extracting a common code path.

9 years ago(qemu|lxc)DomainGetCPUStats: Clean up
Peter Krempa [Mon, 7 Dec 2015 04:48:46 +0000 (05:48 +0100)]
(qemu|lxc)DomainGetCPUStats: Clean up

Remove unnecessary condition and variable.

9 years agovz: Fix invalid iteration of def->cputune.vcpupin
Peter Krempa [Fri, 18 Dec 2015 15:55:01 +0000 (16:55 +0100)]
vz: Fix invalid iteration of def->cputune.vcpupin

The array doesn't necessarily have the same cardinality as the count of
vCPUs for a domain. Iterating it can cause access beyond the end of the
array.

9 years agoqemu: process: Disallow VMs with 0 vcpus
Peter Krempa [Wed, 6 Jan 2016 15:27:45 +0000 (16:27 +0100)]
qemu: process: Disallow VMs with 0 vcpus

Counterintuitively the user would end up with a VM with maximum number
of vCPUs available.

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

9 years agoqemu: process: refactor and rename qemuValidateCpuMax to qemuValidateCpuCount
Peter Krempa [Wed, 6 Jan 2016 15:22:10 +0000 (16:22 +0100)]
qemu: process: refactor and rename qemuValidateCpuMax to qemuValidateCpuCount

Next patch will add minimum checking, so use a more generic name.
Refactor return values to the commonly used semantics.

9 years agovirt-host-validate: Fix error level for user namespace check
Michal Privoznik [Mon, 25 Jan 2016 06:57:21 +0000 (07:57 +0100)]
virt-host-validate: Fix error level for user namespace check

From the code it seems to me that we need user namespace if
configured in domain XML. Otherwise we don't use it at all.
However our tool is more strict about that. Fix this discrepancy.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirt-host-validate: Check those CGroups that we actually use
Michal Privoznik [Sun, 24 Jan 2016 14:11:32 +0000 (15:11 +0100)]
virt-host-validate: Check those CGroups that we actually use

Since the introduction of virt-host-validate tool the set of
cgroup controllers we use has changed so the tool is checking for
some cgroups that we don't need (e.g. net_cls, although I doubt
we have ever used that one) and is not checking for those we
actually use (e.g. cpuset).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirsh: Correctly detect inserted media in change-media command
Michal Privoznik [Wed, 13 Jan 2016 16:32:05 +0000 (17:32 +0100)]
virsh: Correctly detect inserted media in change-media command

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

It all works like this. The change-media command dumps domain
XML, finds the corresponding cdrom device we want to change media
in and returns it in the xmlNodePtr form. This way we don't have
to bother with keeping all the subelements or attributes that we
don't care about in the XML that is fed back to libvirt for the
update API.

Now, the problem is we try to be clever here and detect if disk
already has a source (indicated by <source/> subelement).
However, bare fact that the element is there does not mean disk
has source. Make our clever check better.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovmx: Adapt to emptyBackingString for cdrom-image
Michal Privoznik [Thu, 7 Jan 2016 08:51:55 +0000 (09:51 +0100)]
vmx: Adapt to emptyBackingString for cdrom-image

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

We are missing this value for cdrom-image device. It seems like
there's no added value to extend this to other types of disk
devices [1].

1: https://www.redhat.com/archives/libvir-list/2016-January/msg01038.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: snapshot: Correctly report qemu error on 'savevm'
Peter Krempa [Fri, 15 Jan 2016 12:01:30 +0000 (13:01 +0100)]
qemu: snapshot: Correctly report qemu error on 'savevm'

Since 'savevm' was not converted to QMP libvirt has to parse for error
strings in the text monitor output. One of the unhandled errors is
produced when qemu treats a device as unmigratable.

As current qemu actually does support AHCI migration this bug is
applicable only to older versions of qemu.

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

9 years agoqemu: monitor: Refactor error handling for 'savevm'
Peter Krempa [Fri, 15 Jan 2016 11:53:30 +0000 (12:53 +0100)]
qemu: monitor: Refactor error handling for 'savevm'

Unify few error conditions into a single error reporting case.

9 years agobhyve: bhyveload: respect boot dev and boot order
Roman Bogorodskiy [Sun, 13 Dec 2015 03:17:15 +0000 (06:17 +0300)]
bhyve: bhyveload: respect boot dev and boot order

Make bhyveload respect boot order as specified by os.boot section of the
domain XML or by "boot order" for specific devices. As bhyve does not
support a real boot order specification right now, it's just about
choosing a single device to boot from.

9 years agoconf: expose virDomainBootType(From|To)String
Roman Bogorodskiy [Sat, 2 Jan 2016 18:36:40 +0000 (21:36 +0300)]
conf: expose virDomainBootType(From|To)String

These functions are going to be used by the Bhyve driver.

9 years agoutil: reset MAC address of macvtap passthrough physdev after disassociate
Laine Stump [Thu, 21 Jan 2016 19:19:56 +0000 (14:19 -0500)]
util: reset MAC address of macvtap passthrough physdev after disassociate

libvirt always resets the MAC address of the physdev used for macvtap
passthrough when the guest is finished with it. This was happening
prior to the 802.1Qb[gh] DISASSOCIATE command, and was quite often
failing, presumably because the driver wouldn't allow the MAC address
to be reset while the association was still active, with a log message
like this:

virNetDevSetMAC:168 : Cannot set interface MAC to 00:00:00:00:00:00 on 'eth13': Cannot assign requested address

This patch changes the order - we now do the 802.1Qb[gh] disassociate
and delete the macvtap interface first, then and reset the MAC
address.

9 years agolxc: fuse: Stub out Slab bits in /proc/meminfo
Cole Robinson [Thu, 21 Jan 2016 18:33:50 +0000 (13:33 -0500)]
lxc: fuse: Stub out Slab bits in /proc/meminfo

'free' on fedora23 wants to use the Slab field for calculated used
memory. The equation is:

used = MemTotal - MemFree - (Cached + Slab) - Buffers

We already set Cached and Buffers to 0, do the same for Slab and its
related values

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

9 years agolxc: fuse: Fill in MemAvailable for /proc/meminfo
Cole Robinson [Thu, 21 Jan 2016 18:18:04 +0000 (13:18 -0500)]
lxc: fuse: Fill in MemAvailable for /proc/meminfo

'free' on Fedora 23 will use MemAvailable to calculate its 'available'
field, but we are passing through the host's value. Set it to match
MemFree, which is what 'free' will do for older linux that don't have
MemAvailable

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

9 years agolxc: fuse: Fix /proc/meminfo size calculation
Cole Robinson [Thu, 21 Jan 2016 18:14:54 +0000 (13:14 -0500)]
lxc: fuse: Fix /proc/meminfo size calculation

We virtualize bits of /proc/meminfo by replacing host values with
values specific to the container.

However for calculating the final size of the returned data, we are
using the size of the original file and not the altered copy, which
could give garbelled output.

9 years agolxc: fuse: Unindent meminfo logic
Cole Robinson [Thu, 21 Jan 2016 18:06:03 +0000 (13:06 -0500)]
lxc: fuse: Unindent meminfo logic

Reverse the conditional at the start so we aren't stuffing all the logic
in an 'if' block

9 years agolibxl: Support cmdline= in xl config files
Ian Campbell [Thu, 21 Jan 2016 12:29:29 +0000 (12:29 +0000)]
libxl: Support cmdline= in xl config files

... and consolidate the cmdline/extra/root parsing to facilitate doing
so.

The logic is the same as xl's parse_cmdline from the current xen.git master
branch (e6f0e099d2c17de47fd86e817b1998db903cab61).

On the formatting side switch to producing cmdline= instead of extra=.

Update a few tests and add serveral more.
  - test-cmdline is added to test the exclusive use of cmdline.
  - test-fullvirt-direct-kernel-boot.cfg is updated due to the switch
    on the formatting side and now tests the exclusive use of cmdline=.
  - Tests are added for both paravirt and fullvirt where the .cfg uses
    extra= and (paravirt only) root=. These are format (xl->xml) only
    since the inverse will generate cmdline= hence is not a round trip
    (which was already true if using root=, which used to generate
    extra= on the way back).
  - Tests are added for both paravirt and fullvirt where the .cfg
    declares cmdline= as well as bogus extra= and (paravirt only) root=
    entries which should be ignored. Again these are format only tests
    since the inverse won't include the bogus lines.

The last two bullets here required splitting the DO_TEST macro into
two halves, as is done in the xmconfigtest.c case.

In order to introduce a use of VIR_WARN for logging I had to add
virerror.h and VIR_LOG_INIT.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
9 years agolibxl: dispose libxl_dominfo after libxl_domain_info()
Joao Martins [Thu, 21 Jan 2016 10:21:10 +0000 (10:21 +0000)]
libxl: dispose libxl_dominfo after libxl_domain_info()

As suggested in a previous thread [0] this patch adds some missing calls
to libxl_dominfo_{init,dispose} when doing some of the libxl_domain_info
operations which would otherwise lead to memory leaks.

[0]
https://www.redhat.com/archives/libvir-list/2015-September/msg00519.html

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
9 years agoXen: add XENXL to virErrorDomain enum
Jim Fehlig [Wed, 20 Jan 2016 18:51:55 +0000 (11:51 -0700)]
Xen: add XENXL to virErrorDomain enum

Add "Xen XL Config" to the virErrorDomain enum and use it in
src/xenconfig/xen_xl.c.

9 years agoXen: VIR_FROM_THIS cleanup
Jim Fehlig [Wed, 20 Jan 2016 18:36:26 +0000 (11:36 -0700)]
Xen: VIR_FROM_THIS cleanup

The virErrorDomain enum has VIR_FROM_XEN, VIR_FROM_XEND,
VIR_FROM_XENSTORE, VIR_FROM_SEXPR, and VIR_FROM_XENXM. Use
these elements in the corresponding .c files. While at it,
remove the VIR_FROM_THIS define in src/xenconfig/xenxs_private.h.

9 years agoqemu: Add support for migration iteration event
Jiri Denemark [Tue, 8 Dec 2015 14:23:35 +0000 (15:23 +0100)]
qemu: Add support for migration iteration event

The corresponding event in QEMU is called MIGRATION_PASS.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoIntroduce migration iteration event
Jiri Denemark [Thu, 10 Dec 2015 15:09:09 +0000 (16:09 +0100)]
Introduce migration iteration event

The VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION event will be triggered
whenever VIR_DOMAIN_JOB_MEMORY_ITERATION changes its value, i.e.,
whenever a new iteration over guest memory pages is started during
migration.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemuDomainReboot: use fakeReboot=true only for acpi mode
Dmitry Andreev [Wed, 20 Jan 2016 13:10:09 +0000 (16:10 +0300)]
qemuDomainReboot: use fakeReboot=true only for acpi mode

When acpi is used to reboot/shutdown qemu domain, qemu emits
SHUTDOWN event. Libvirt uses fakeReboot variable in order to
differentiate reboot or shutdown. fakeReboot value is reseted
to false after domain restart/reset.

When mode=agent is used to reboot qemu domain, qemu doesn't emit
SHUTDOWN event and libvirt doesn't reset fakeReboot value to false.
In this case next 'shutdown -h now' performs reboot. That's why
we don't need to set fakeReboot=true for mode=agent.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agovirsh: Don't fetch status for all domains in cmdList
Michal Privoznik [Wed, 20 Jan 2016 14:44:45 +0000 (15:44 +0100)]
virsh: Don't fetch status for all domains in cmdList

We are getting the list of domains and after that we iterate over
the list and try to get status for each domain hoping it will
skip over domains that disappeared meanwhile. However, this
solution to race is bogus - domain may disappear right after we
have checked its state and before we exec another API over it
(e.g. virDomainHasManagedSaveImage()). Also, when printing just
names or uuids (list --name / --uuid) we issue APIs to obtain the
values, however these require no RPC call as all requested info
is in virDomain object that client already has.
Therefore move the status obtaining only to the place that really
needs it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agodocs: fix syntax-check long line error
Cole Robinson [Wed, 20 Jan 2016 15:27:24 +0000 (10:27 -0500)]
docs: fix syntax-check long line error

9 years agobuild: predictably generate systemtap tapsets (bz 1173641)
Cole Robinson [Wed, 20 Jan 2016 03:19:56 +0000 (22:19 -0500)]
build: predictably generate systemtap tapsets (bz 1173641)

The generated output is dependent on perl hashtable ordering, which
gives different results for i686 and x86_64. Fix this by sorting
the hash keys before iterating over them

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

9 years agodocs: fix generation of docs from VPATH build
Daniel P. Berrange [Wed, 20 Jan 2016 12:22:19 +0000 (12:22 +0000)]
docs: fix generation of docs from VPATH build

When generating docs in a VPATH build we get a failure to
create a file due to the 'internals' subdir not existing:

  Generating internals/locking.html.tmp
  /bin/sh: line 3: internals/locking.html.tmp: No such file or directory
  rm: cannot remove ‘internals/locking.html.tmp’: No such file or directory
  Makefile:2229: recipe for target 'internals/locking.html.tmp' failed
  make: *** [internals/locking.html.tmp] Error 1

For some reason, make has decided to run the target

  %.html.tmp: %.html.in site.xsl page.xsl sitemap.html.in $(acl_generated)

instead of the target

  internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in

Removing '$(acl_generated)' from the first target, inexplicably
causes make to now run the correct target for the internals/
files.

Rather than figure this out, lets just combine the two targets
into one.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoleaseshelper: reduce indentation level in virLeaseReadCustomLeaseFile
Ján Tomko [Fri, 15 Jan 2016 08:07:17 +0000 (09:07 +0100)]
leaseshelper: reduce indentation level in virLeaseReadCustomLeaseFile

Instead of nested ifs, jump out early.

Mostly whitespace changes.

9 years agoleaseshelper: remove useless comparison
Ján Tomko [Thu, 14 Jan 2016 15:49:56 +0000 (16:49 +0100)]
leaseshelper: remove useless comparison

We do not care if the mac was specified in the delete section,
we are going to delete the record anyway.