]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
9 years agoutil: cgroups do not implicitly add task to new machine cgroup
Henning Schild [Wed, 9 Dec 2015 16:58:10 +0000 (17:58 +0100)]
util: cgroups do not implicitly add task to new machine cgroup

virCgroupNewMachine used to add the pidleader to the newly created
machine cgroup. Do not do this implicit anymore.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
9 years agovirNetDevMacVLanTapSetup: Drop @multiqueue argument
Michal Privoznik [Sun, 13 Dec 2015 06:54:46 +0000 (07:54 +0100)]
virNetDevMacVLanTapSetup: Drop @multiqueue argument

Firstly, there's a bug (or typo) in the only place where we call
this function: @multiqueue is set whenever @tapfdSize is greater
than zero, while in fact the condition should have been 'greater
than one'.
Then, secondly, since the condition depends on just one
variable, that we are even passing down to the function, we can
move the condition into the function and drop useless argument.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: Warn when using vhost-user without shared memory
Martin Kletzander [Tue, 8 Dec 2015 13:15:47 +0000 (14:15 +0100)]
qemu: Warn when using vhost-user without shared memory

When user configures vhost-user interface and forgets to also configure
any shared memory, the search for the root cause of non-operational
interface might take unpleasantly long time.  Let's enhance user
experience by emitting a warning in the logs.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agovirNetDevMacVLanTapSetup: Work around older systems
Michal Privoznik [Sat, 12 Dec 2015 07:05:17 +0000 (08:05 +0100)]
virNetDevMacVLanTapSetup: Work around older systems

Some older systems, e.g. RHEL-6 do not have IFF_MULTI_QUEUE flag
which we use to enable multiqueue feature. Therefore one gets the
following compile error there:

  CC     util/libvirt_util_la-virnetdevmacvlan.lo
util/virnetdevmacvlan.c: In function 'virNetDevMacVLanTapSetup':
util/virnetdevmacvlan.c:338: error: 'IFF_MULTI_QUEUE' undeclared (first use in this function)
util/virnetdevmacvlan.c:338: error: (Each undeclared identifier is reported only once
util/virnetdevmacvlan.c:338: error: for each function it appears in.)
make[3]: *** [util/libvirt_util_la-virnetdevmacvlan.lo] Error 1

So, whenever user wants us to enable the feature on such systems,
we will just throw a runtime error instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoCVE-2015-5313: storage: don't allow '/' in filesystem volume names
Eric Blake [Wed, 9 Dec 2015 00:46:31 +0000 (17:46 -0700)]
CVE-2015-5313: storage: don't allow '/' in filesystem volume names

The libvirt file system storage driver determines what file to
act on by concatenating the pool location with the volume name.
If a user is able to pick names like "../../../etc/passwd", then
they can escape the bounds of the pool.  For that matter,
virStoragePoolListVolumes() doesn't descend into subdirectories,
so a user really shouldn't use a name with a slash.

Normally, only privileged users can coerce libvirt into creating
or opening existing files using the virStorageVol APIs; and such
users already have full privilege to create any domain XML (so it
is not an escalation of privilege).  But in the case of
fine-grained ACLs, it is feasible that a user can be granted
storage_vol:create but not domain:write, and it violates
assumptions if such a user can abuse libvirt to access files
outside of the storage pool.

Therefore, prevent all use of volume names that contain "/",
whether or not such a name is actually attempting to escape the
pool.

This changes things from:

$ virsh vol-create-as default ../../../../../../etc/haha --capacity 128
Vol ../../../../../../etc/haha created
$ rm /etc/haha

to:

$ virsh vol-create-as default ../../../../../../etc/haha --capacity 128
error: Failed to create vol ../../../../../../etc/haha
error: Requested operation is not valid: volume name '../../../../../../etc/haha' cannot contain '/'

Signed-off-by: Eric Blake <eblake@redhat.com>
9 years agoutil: Fixup virnetdevmacvlan.h ATTRIBUTE_NONNULL's
John Ferlan [Fri, 11 Dec 2015 11:37:48 +0000 (06:37 -0500)]
util: Fixup virnetdevmacvlan.h ATTRIBUTE_NONNULL's

Commit id '56e2171c6' removed a variable from the argument list, but
neglected to update the ATTRIBUTE_NONNULL values, so when commit id
'08da97bfb' added a couple of arguments, the values were off.

9 years agotest: qemuxml2argv: Mock virMemoryMaxValue to remove 32/64 bit difference
Peter Krempa [Thu, 10 Dec 2015 13:36:51 +0000 (14:36 +0100)]
test: qemuxml2argv: Mock virMemoryMaxValue to remove 32/64 bit difference

Always return LLONG_MAX even on 32 bit systems. The limitation
originates from our use of "unsigned long" in several APIs. The internal
data type is unsigned long long. Make the test suite deterministic by
removing the architecture difference.

Flaw was introduced in 645881139b3d2c86acf9d644c3a1471520bc9e57 where
I've added a test that uses too large numbers.

9 years agoqemu: Enable multiqueue for macvtaps
Michal Privoznik [Fri, 4 Dec 2015 10:47:22 +0000 (11:47 +0100)]
qemu: Enable multiqueue for macvtaps

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

Ta-da! Now that we know how to open a macvtap device multiple
times, we can finally enable the multiqueue feature. Everything
else is already prepared (e.g. command line generation) from the
previous iteration where the feature was implemented for
TUN/TAP devices.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirNetDevMacVLanCreateWithVPortProfile: Rework to support multiple FDs
Michal Privoznik [Fri, 4 Dec 2015 10:31:17 +0000 (11:31 +0100)]
virNetDevMacVLanCreateWithVPortProfile: Rework to support multiple FDs

For the multiqueue on macvtaps we are going to need to open
the device multiple times. Currently, this is not supported.
Rework the function, so that upper layers can be reworked too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirNetDevMacVLanTapSetup: Allow enabling of IFF_MULTI_QUEUE
Michal Privoznik [Tue, 8 Dec 2015 12:17:26 +0000 (13:17 +0100)]
virNetDevMacVLanTapSetup: Allow enabling of IFF_MULTI_QUEUE

Like we are doing for TUN/TAP devices, we should do the same for
macvtaps. Although, it's not as critical as in that case, we
should do it for the consistency.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirNetDevMacVLanTapSetup: Rework to support multiple FDs
Michal Privoznik [Fri, 4 Dec 2015 10:19:32 +0000 (11:19 +0100)]
virNetDevMacVLanTapSetup: Rework to support multiple FDs

For the multiqueue on macvtaps we are going to need to open
the device multiple times. Currently, this is not supported.
Rework the function, so that upper layers can be reworked too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirNetDevMacVLanTapOpen: Rework to support multiple FDs
Michal Privoznik [Fri, 4 Dec 2015 08:39:02 +0000 (09:39 +0100)]
virNetDevMacVLanTapOpen: Rework to support multiple FDs

For the multiqueue on macvtaps we are going to need to open
the device multiple times. Currently, this is not supported.
Rework the function, so that upper layers can be reworked too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirNetDevMacVLanTapOpen: Slightly rework
Michal Privoznik [Fri, 4 Dec 2015 09:55:49 +0000 (10:55 +0100)]
virNetDevMacVLanTapOpen: Slightly rework

There are few outdated things. Firstly, we don't need to undergo
the torture of fopen, fscanf and fclose just to get the interface
index when we have nice wrapper over that: virNetDevGetIndex.
Secondly, we don't need to have statically allocated buffer for
the path we are opening.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirNetDevMacVLanCreateWithVPortProfile: Turn vnet_hdr into flag
Michal Privoznik [Thu, 3 Dec 2015 10:33:55 +0000 (11:33 +0100)]
virNetDevMacVLanCreateWithVPortProfile: Turn vnet_hdr into flag

So yet again one of integer arguments that we use as a boolean.
Since the argument count of the function is unbearably long
enough, lets turn those booleans into flags.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agolog: include hostname in initial log message
Daniel P. Berrange [Fri, 4 Dec 2015 17:35:54 +0000 (17:35 +0000)]
log: include hostname in initial log message

On the very first log message we send to any output, we include
the libvirt version number and package string. In some bug reports
we have been given libvirtd.log files that came from a different
host than the corresponding /var/log/libvirt/qemu log files. So
extend the initial log message to include the hostname too.

eg on first log message we would now see:

 $ libvirtd
 2015-12-04 17:35:36.610+0000: 20917: info : libvirt version: 1.3.0
 2015-12-04 17:35:36.610+0000: 20917: info : hostname: dhcp-1-180.lcy.redhat.com
 2015-12-04 17:35:36.610+0000: 20917: error : qemuMonitorIO:687 : internal error: End of file from monitor

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agostorage: Ignore block devices that fail format detection
John Ferlan [Fri, 30 Oct 2015 14:29:46 +0000 (10:29 -0400)]
storage: Ignore block devices that fail format detection

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

Prior to commit id '98322052' failure to saferead the block device would
cause an error to be logged and the device to be skipped while attempting
to discover/create a stable target path for a new LUN (NPIV).

This was because virStorageBackendSCSIFindLUs ignored errors from
processLU and virStorageBackendSCSINewLun.

Ignoring the failure allowed a multipath device with an "active" and
"ghost" to be present on the host with the "ghost" block device being
ignored. This patch will return a -2 to the caller indicating the desire
to ignore the block device since it cannot be used directly rather than
fail the pool startup.

9 years agostorage: Add debug message
John Ferlan [Tue, 24 Nov 2015 14:23:46 +0000 (09:23 -0500)]
storage: Add debug message

I found this useful while processing a volume that wouldn't end up
showing up in the resulting list of block volumes. In this case, the
partition type wasn't found in the disk_types table.

9 years agostorage: Handle readflags errors
John Ferlan [Tue, 24 Nov 2015 16:15:53 +0000 (11:15 -0500)]
storage: Handle readflags errors

Similar to the openflags VIR_STORAGE_VOL_OPEN_NOERROR processing, if some
read processing operation fails, check the readflags for the corresponding
error flag being set. If so, rather then causing an error - use VIR_WARN
to flag the error, but return -2 which some callers can use to perform
specific actions. Use a new VIR_STORAGE_VOL_READ_NOERROR flag in a new
VolReadErrorMode enum.

9 years agostorage: Set ret = -1 on failures in virStorageBackendUpdateVolTargetInfo
John Ferlan [Fri, 4 Dec 2015 15:40:06 +0000 (10:40 -0500)]
storage: Set ret = -1 on failures in virStorageBackendUpdateVolTargetInfo

While processing the volume for lseek, virFileReadHeaderFD, and
virStorageFileGetMetadataFromBuf - failure would cause an error,
but ret would not be set. That would result in an error message being
sent, but successful status being returned.

9 years agostorage: Add comments for backend APIs
John Ferlan [Tue, 24 Nov 2015 15:41:07 +0000 (10:41 -0500)]
storage: Add comments for backend APIs

Just so it's clearer what to expect upon input and what types of return
values could be generated.  These were loosely copied from existing
virStorageBackendUpdateVolTargetInfoFD.

9 years agostorage: Add readflags for backend error processing
John Ferlan [Tue, 24 Nov 2015 15:08:29 +0000 (10:08 -0500)]
storage: Add readflags for backend error processing

Similar to the openflags which allow VIR_STORAGE_VOL_OPEN_NOERROR to be
passed to avoid open errors, add a 'readflags' variable so that in the
future read failures could also be ignored.

9 years agotests: scsihost: Use fakerootdir instead of fakesysfsdir
Andrea Bolognani [Fri, 4 Dec 2015 13:12:33 +0000 (14:12 +0100)]
tests: scsihost: Use fakerootdir instead of fakesysfsdir

This updates the test program to make it consistent with recent changes
to the mock libraries, and also opens up the possibility of mocking more
than just /sys in the future.

9 years agotests: Use more specific names for variables
Andrea Bolognani [Fri, 4 Dec 2015 13:51:08 +0000 (14:51 +0100)]
tests: Use more specific names for variables

Instead of fakesysfsdir, which is very generic, use fakesysfspcidir and
fakesysfscgroupdir. This makes it explicit what part of the fake sysfs
filesystem they're referring to, and also leaves open the possibility of
handling files in two unrelated parts of the fake sysfs filesystem.

No functional changes.

9 years agotests: Rename LIBVIRT_FAKE_SYSFS_DIR to LIBVIRT_FAKE_ROOT_DIR
Andrea Bolognani [Fri, 4 Dec 2015 12:38:16 +0000 (13:38 +0100)]
tests: Rename LIBVIRT_FAKE_SYSFS_DIR to LIBVIRT_FAKE_ROOT_DIR

The old name is no longer accurate, since now we're using its value as
the root of the fake filesystem.

No functional changes.

9 years agotests: cgroupmock: Use the temporary directory as fake root
Andrea Bolognani [Fri, 4 Dec 2015 09:54:29 +0000 (10:54 +0100)]
tests: cgroupmock: Use the temporary directory as fake root

We might need to mock files living outside SYSFS_PREFIX later on,
so it's better to treat the temporary directory we are passed via
the environment as the root of the fake filesystem and create
SYSFS_PREFIX inside it.

The environment variable name will be changed to reflect the new use
we're making of it in a later commit.

9 years agotests: pcimock: Use the temporary directory as fake root
Andrea Bolognani [Fri, 4 Dec 2015 09:05:56 +0000 (10:05 +0100)]
tests: pcimock: Use the temporary directory as fake root

We might need to mock files living outside PCI_SYSFS_PREFIX later on,
so it's better to treat the temporary directory we are passed via
the environment as the root of the fake filesystem and create
PCI_SYSFS_PREFIX inside it.

The environment variable name will be changed to reflect the new use
we're making of it in a later commit.

9 years agotests: pcimock: Remove check for fakesysfsdir
Andrea Bolognani [Thu, 3 Dec 2015 14:27:28 +0000 (15:27 +0100)]
tests: pcimock: Remove check for fakesysfsdir

init_env() will return right away if fakesysfsdir is already
initialized, so this check is redundant.

9 years agotests: scsihost: Don't set LIBVIRT_FAKE_SYSFS_DIR
Andrea Bolognani [Fri, 4 Dec 2015 12:45:17 +0000 (13:45 +0100)]
tests: scsihost: Don't set LIBVIRT_FAKE_SYSFS_DIR

The test program is not preloading any of the mock libraries that read
that environment variable, so setting it is pointless.

9 years agoqemu: cgroup: Don't use priv->ncpupids to iterate domain vCPUs
Peter Krempa [Fri, 20 Nov 2015 15:10:04 +0000 (16:10 +0100)]
qemu: cgroup: Don't use priv->ncpupids to iterate domain vCPUs

Use the proper data structures for the iteration since ncpupids will be
made private later.

9 years agoqemu: driver: Refactor qemuDomainHelperGetVcpus
Peter Krempa [Fri, 20 Nov 2015 15:02:54 +0000 (16:02 +0100)]
qemu: driver: Refactor qemuDomainHelperGetVcpus

Change some of the control structures and switch to using the new vcpu
structure.

9 years agoqemu: Add helper to retrieve vCPU pid
Peter Krempa [Thu, 12 Nov 2015 15:45:12 +0000 (16:45 +0100)]
qemu: Add helper to retrieve vCPU pid

Instead of directly accessing the array add a helper to do this.

9 years agoqemu: Replace checking for vcpu<->pid mapping availability with a helper
Peter Krempa [Wed, 11 Nov 2015 13:20:04 +0000 (14:20 +0100)]
qemu: Replace checking for vcpu<->pid mapping availability with a helper

Add qemuDomainHasVCpuPids to do the checking and replace in place checks
with it.

We no longer need checking whether the thread contains fake data
(vcpupids[0] == vm->pid) as in b07f3d821dfb11a118ee75ea275fd6ab737d9500
and 65686e5a81d654d834d338fceeaf0229b2ca4f0d this was removed.

9 years agoqemu: Drop checking vcpu threads in emulator bandwidth getter/setter
Peter Krempa [Thu, 12 Nov 2015 14:14:38 +0000 (15:14 +0100)]
qemu: Drop checking vcpu threads in emulator bandwidth getter/setter

The vCPU threads make sense in the counterparts that set the vCPU
bandwidth/quota, not in the emulator one. The emulator tunables are set
all the time anyways.

Drop the extra check and remove the now unneeded vm argument.

9 years agoqemu: cgroup: Remove now unreachable check
Peter Krempa [Wed, 11 Nov 2015 09:28:47 +0000 (10:28 +0100)]
qemu: cgroup: Remove now unreachable check

Since commit 0c04906fa the check for priv->cgroup doesn't make sense as
the calls to virCgroupHasController return the same information. Remove
it and move it's comment partially to the new check.

The already spurious check was also later copied to the iothreads code.

9 years agoconf: Add helper to get pointer to a certain vCPU definition
Peter Krempa [Tue, 3 Nov 2015 07:47:23 +0000 (08:47 +0100)]
conf: Add helper to get pointer to a certain vCPU definition

Once more stuff will be moved into the vCPU data structure it will be
necessary to get a specific one in some ocasions. Add a helper that will
simplify this task.

9 years agoconf: ABI: Split up and improve vcpu info ABI checking
Peter Krempa [Wed, 5 Aug 2015 13:06:04 +0000 (15:06 +0200)]
conf: ABI: Split up and improve vcpu info ABI checking

Extract the checking code into a separate function and prepare the
infrastructure for checking the new structure type.

9 years agoconf: turn def->vcpus into a structure
Peter Krempa [Fri, 23 Oct 2015 07:38:01 +0000 (09:38 +0200)]
conf: turn def->vcpus into a structure

To allow collecting all relevant data at one place let's make def->vcpus
a structure and then we can start moving stuff into it.

9 years agoqemu: refactor qemuDomainHotunplugVcpus
Peter Krempa [Fri, 30 Oct 2015 15:29:45 +0000 (16:29 +0100)]
qemu: refactor qemuDomainHotunplugVcpus

Refactor the code flow so that 'exit_monitor:' can be removed.

This patch moves the auditing functions into places where it's certain
that hotunplug was or was not successful and reports errors from
qemuMonitorGetCPUInfo properly.

9 years agoqemu: Refactor qemuDomainHotplugVcpus
Peter Krempa [Fri, 30 Oct 2015 11:46:33 +0000 (12:46 +0100)]
qemu: Refactor qemuDomainHotplugVcpus

Refactor the code flow so that 'exit_monitor:' can be removed.

This patch also moves the auditing and setting of the new vCPU count
right to the place where the hotplug happens, since it's possible that
the hotplug succeeds and adds a cpu while other stuff fails.

Lastly, failures of qemuMonitorGetCPUInfo are now reported rather than
ignored. The function retuns 0 if it "successfully" detected 0 threads.

9 years agoqemu: cpu hotplug: Move loops to qemuDomainSetVcpusFlags
Peter Krempa [Fri, 30 Oct 2015 08:36:27 +0000 (09:36 +0100)]
qemu: cpu hotplug: Move loops to qemuDomainSetVcpusFlags

qemuDomainHotplugVcpus/qemuDomainHotunplugVcpus are complex enough in
regards of adding one CPU. Additionally it will be desired to reuse
those functions later with specific vCPU hotplug.

Move the loops for adding vCPUs into qemuDomainSetVcpusFlags so that the
helpers can be made simpler and more straightforward.

9 years agoqemu: monitor: Remove weird return values from qemuMonitorSetCPU
Peter Krempa [Tue, 27 Oct 2015 13:26:03 +0000 (14:26 +0100)]
qemu: monitor: Remove weird return values from qemuMonitorSetCPU

Let the function report errors internally and change it to return
standard return codes.

9 years agoqemu: cpu hotplug: Fix error handling logic
Peter Krempa [Thu, 29 Oct 2015 14:49:26 +0000 (15:49 +0100)]
qemu: cpu hotplug: Fix error handling logic

The cpu hotplug helper functions used negative error handling in a part
of them, although some code that was added later didn't properly set the
error codes in some cases. This would cause improper error messages in
cases where we couldn't modify the numa cpu mask and a few other cases.

Fix the logic by converting it to the regularly used pattern.

9 years agoqemu: Split up vCPU hotplug and hotunplug
Peter Krempa [Tue, 27 Oct 2015 12:23:16 +0000 (13:23 +0100)]
qemu: Split up vCPU hotplug and hotunplug

There's only very little common code among the two operations. Split the
functions so that the internals are easier to understand and refactor
later.

9 years agoqemu: qemuDomainSetVcpusAgent: re-check agent before calling it the again
Peter Krempa [Tue, 27 Oct 2015 06:29:53 +0000 (07:29 +0100)]
qemu: qemuDomainSetVcpusAgent: re-check agent before calling it the again

With a very unfortunate timing, the agent might vanish before we do the
second call while the locks were down. Re-check that the agent is
available before attempting it again.

9 years agoqemu: Extract vCPU onlining/offlining via agent into a separate function
Peter Krempa [Tue, 27 Oct 2015 06:17:53 +0000 (07:17 +0100)]
qemu: Extract vCPU onlining/offlining via agent into a separate function

Separate the code so that qemuDomainSetVcpusFlags contains only code
relevant to hardware hotplug/unplug.

9 years agoqemu: domain: Add helper to access vm->privateData->agent
Peter Krempa [Tue, 27 Oct 2015 06:09:00 +0000 (07:09 +0100)]
qemu: domain: Add helper to access vm->privateData->agent

As in commit 88dc7e0c2fb, the helper can be used in cases where the
function actually does not access anyting in the private data besides
the agent.

9 years agoconf: Turn def->maxvcpus into size_t
Peter Krempa [Mon, 26 Oct 2015 14:16:58 +0000 (15:16 +0100)]
conf: Turn def->maxvcpus into size_t

Later on this will also be used to track size of the vcpu data array.
Use size_t so that we can utilize the memory allocation helpers.

9 years agoconf: Replace read accesses to def->vcpus with accessor
Peter Krempa [Thu, 22 Oct 2015 12:59:03 +0000 (14:59 +0200)]
conf: Replace read accesses to def->vcpus with accessor

9 years agoconf: Move vcpu count check into helper
Peter Krempa [Thu, 22 Oct 2015 09:05:36 +0000 (11:05 +0200)]
conf: Move vcpu count check into helper

9 years agoconf: Replace writes to def->vcpus with accessor
Peter Krempa [Thu, 22 Oct 2015 08:52:05 +0000 (10:52 +0200)]
conf: Replace writes to def->vcpus with accessor

9 years agoconf: Replace read access to def->maxvcpus with accessor
Peter Krempa [Mon, 19 Oct 2015 17:21:24 +0000 (19:21 +0200)]
conf: Replace read access to def->maxvcpus with accessor

Finalize the refactor by adding the 'virDomainDefGetVCpusMax' getter and
reusing it accross libvirt.

9 years agoconf: Add helper to check whether domain has offline vCPUs
Peter Krempa [Mon, 19 Oct 2015 16:23:23 +0000 (18:23 +0200)]
conf: Add helper to check whether domain has offline vCPUs

The new helper will simplify checking whether the domain config contains
inactive vCPUs.

9 years agoconf: Extract update of vcpu count if maxvcpus is decreased
Peter Krempa [Mon, 19 Oct 2015 11:36:08 +0000 (13:36 +0200)]
conf: Extract update of vcpu count if maxvcpus is decreased

The code can be unified into the new accessor rather than being
scattered accross the drivers.

9 years agoconf: Use local copy of maxvcpus in virDomainVcpuParse
Peter Krempa [Mon, 19 Oct 2015 12:01:22 +0000 (14:01 +0200)]
conf: Use local copy of maxvcpus in virDomainVcpuParse

Use the local variable rather than getting it all the time from the
struct. This will simplify further refactors.

9 years agoconf: Replace writes to def->maxvcpus with accessor
Peter Krempa [Fri, 16 Oct 2015 14:10:27 +0000 (16:10 +0200)]
conf: Replace writes to def->maxvcpus with accessor

To support further refactors replace all write access to def->maxvcpus
with a accessor function.

9 years agolibxl: copy persistent domain definition while starting a guest
Pavel Hrdina [Thu, 3 Dec 2015 12:38:56 +0000 (13:38 +0100)]
libxl: copy persistent domain definition while starting a guest

We should make a copy of current definition to preserve a persistent
definition, because we later update the definition with live changes.
The live definition is discarded on domain shutdown and replaced by the
copy we make before starting the domain.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoxen: fix timer bug found by updated test
Pavel Hrdina [Sat, 28 Nov 2015 06:18:29 +0000 (07:18 +0100)]
xen: fix timer bug found by updated test

Only 'tsc' timer allows set mode and track is valid only for 'rtc' and
'platform' timers.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoxen: use virDomainDefPostParse for parsing XM/XL/SEXPR cofings
Pavel Hrdina [Sat, 28 Nov 2015 04:33:55 +0000 (05:33 +0100)]
xen: use virDomainDefPostParse for parsing XM/XL/SEXPR cofings

This change ensures to call driver specific post-parse code to modify
domain definition after parsing hypervisor config the same way we do
after parsing XML.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agolxc: use virDomainDefPostParse for parsing LXC config string
Pavel Hrdina [Sun, 29 Nov 2015 02:55:32 +0000 (03:55 +0100)]
lxc: use virDomainDefPostParse for parsing LXC config string

This change ensures to call driver specific post-parse code to modify
domain definition after parsing hypervisor config the same way we do
after parsing XML.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agovmware/vmx: use virDomainDefPostParse after parsing vmx config
Pavel Hrdina [Sat, 28 Nov 2015 04:12:33 +0000 (05:12 +0100)]
vmware/vmx: use virDomainDefPostParse after parsing vmx config

This change ensures to call driver specific post-parse code to modify
domain definition after parsing hypervisor config the same way we do
after parsing XML.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agovirsh: rename vshCommandOptString to vshCommandOptStringQuiet
Ján Tomko [Thu, 3 Dec 2015 12:47:56 +0000 (13:47 +0100)]
virsh: rename vshCommandOptString to vshCommandOptStringQuiet

This function does not set an error. Make it obvious in its name
to discourage its usage without reporting an error in the caller.

9 years agosecurity_selinux: fix indentation
Ján Tomko [Fri, 20 Nov 2015 09:29:21 +0000 (10:29 +0100)]
security_selinux: fix indentation

9 years agosecurity_dac: check if virSecurityDACGetIds returns negative
Ján Tomko [Fri, 20 Nov 2015 07:26:00 +0000 (08:26 +0100)]
security_dac: check if virSecurityDACGetIds returns negative

Use the customary check '< 0' instead of checking for non-zero.

No functional change.

9 years agoPost-release version bump to 1.3.1
Ján Tomko [Wed, 9 Dec 2015 09:43:37 +0000 (10:43 +0100)]
Post-release version bump to 1.3.1

9 years agoRelease of libvirt-1.3.0
Daniel Veillard [Wed, 9 Dec 2015 09:13:48 +0000 (17:13 +0800)]
Release of libvirt-1.3.0

* docs/news.html.in libvirt.spec.in: update for release
* po/*.po*: regenerated

9 years agoRevert "libxl: implement virDomainInterfaceStats"
Jim Fehlig [Tue, 8 Dec 2015 15:04:40 +0000 (08:04 -0700)]
Revert "libxl: implement virDomainInterfaceStats"

This reverts commit d2e5538b16e325d9095f3ccb0dac88bbd9fc98f0.

A migration regression was introduced by this commit. When migrating
a domain, its active XML is sent to the destination libvirtd, where
it is parsed as inactive XML. d2e5538b copied the libxl generated
interface name into the active config, which was being passed to the
migration destination and being parsed into inactive config. Attempting
to start the config could result in failure if an interface with the
same generated name already exists.

The qemu driver behaves similarly, but the parser contains a hack to
skip interface names starting with 'vnet' when parsing inactive XML.
We could extend the hack to skip names starting with 'vif' too, but a
better fix would be to expose these hypervisor-specific interface name
prefixes in capabilities. See the following discussion thread for more
details

https://www.redhat.com/archives/libvir-list/2015-December/msg00262.html

For the pending 1.3.0 release, it is best to revert d2e5538b. It can
be added again post release, after moving the prefix to capabilities.

9 years agorpm: explicitly enable & start virtlogd on install
Daniel P. Berrange [Mon, 7 Dec 2015 12:48:04 +0000 (12:48 +0000)]
rpm: explicitly enable & start virtlogd on install

When installing the libvirt-daemon RPM, we have a %post rule to
enable the libvirtd.service, virtlockd.socket and virtlogd.socket
files. This is only done, however, when the RPM is first installed,
not when upgrading RPMs. So virtlogd will not get activated on
upgrading, which is a problem as libvirt qemu driver will expect
it to be available by default.

This adds a trigger that is run when uninstalling libvirt-daemon
older than 1.3.0 that will enable & start virtlogd.socket if
libvirtd is enabled and/or started. Using the trigger rather
than %post ensures that it only runs once, allowing admins to
disable it explicitly thereafter without future upgrades
re-enabling it.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agolibvirtd: enable virtlockd/virtlogd socket activation on install
Daniel P. Berrange [Mon, 7 Dec 2015 12:46:27 +0000 (12:46 +0000)]
libvirtd: enable virtlockd/virtlogd socket activation on install

When someone does 'systemctl enable libvirtd.service' we should
also enable virtlockd.socket/virtlogd.socket, so that they can
be auto-activated if libvirtd tries to access the sockets.

Without this, people have to manually enable the units themselves
via 'systemctl enable virtdlogd.socket'.

This also ensures that if distros uses  'systemctl preset' for
enabling 'libvirtd.service', then the virtdlogd.socket gets
enabled without having to wait for the distro to update their
presets file.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agologging: validate flags passed from client in virtlogd
Daniel P. Berrange [Fri, 4 Dec 2015 15:37:04 +0000 (15:37 +0000)]
logging: validate flags passed from client in virtlogd

The virtlogd RPC messages all have a flags parameter. For
sake of future error reporting we should be verifying
these are all 0 for now.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agologging: change log protocol to be more reusable
Daniel P. Berrange [Thu, 3 Dec 2015 17:20:35 +0000 (17:20 +0000)]
logging: change log protocol to be more reusable

The current virtlogd RPC protocol provides the ability to
handle log files associated with QEMU stdout/err. The log
protocol messages take the virt driver, domain name and
use that to form a log file path. This is quite restrictive
as it prevents us re-using the same RPC protocol messages
for logging to char device backends where the filename
can be arbitrarily user specified. It is also bad because
it means we have 2 separate locations which have to decide
on logfile name.

This change alters the RPC protocol so that we pass the
desired log file path along when opening the log file
initially. Now the virt driver is exclusively in charge
of deciding the log filename

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agologging: preserve driver, dom name & uuid against log file
Daniel P. Berrange [Thu, 3 Dec 2015 17:27:17 +0000 (17:27 +0000)]
logging: preserve driver, dom name & uuid against log file

The virt driver, dom name and uuid associated with a log
file are important pieces of metadata to keep around for
sake of future enhancements to virtlogd. Currently we
discard them after opening the log file, but we should
preserve them, even across restarts.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoqemu: fix memory leak in opening log file
Daniel P. Berrange [Thu, 3 Dec 2015 17:24:10 +0000 (17:24 +0000)]
qemu: fix memory leak in opening log file

The qemuDomainLogContextNew method leaks the "logfile" path
on the non-virtlogd code path.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agolibvirt: Update virDomainSetMemory description
Nikolay Shirokovskiy [Thu, 12 Nov 2015 07:23:16 +0000 (10:23 +0300)]
libvirt: Update virDomainSetMemory description

virDomainSetMemory is documented to change only runtime configuration of
running domain. However, that's not true of all hypervisors supported.
Seems as though when commit id '0f2e50be5' added the current flag, the
function description should have been updated similar to when commit id
'c1795c52' updated the virDomainSetMaxMemory description. Especially since
commit id '80427f1d' updated the virsh 'setmem' description to indicate
"behavior is different depending on hypervisor."

This patch will update the description to match current functionality.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agoqemu: Automatic SCSI controller creation in SCSI disk hotplug broken
Boris Fiuczynski [Mon, 30 Nov 2015 11:06:01 +0000 (12:06 +0100)]
qemu: Automatic SCSI controller creation in SCSI disk hotplug broken

When a SCSI disk is hotplugged to a domain that does not have the required
SCSI controller already defined and loaded the following internal error occurs

error: Failed to attach device from scsi_disk.xml
error: internal error: Could not find scsi controller with index 0 required for device

Commit 0260506c added in method qemuBuildDriveDevStr a lookup of the controller
alias. The internal error occurs because in method qemuDomainAttachSCSIDisk
the automatic creation of the potentially missing SCSI controller occurs after
calling qemuBuildDriveDevStr.

This patch reverses the calling sequence.

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 agoqemu: include hostname in QEMU log files
Daniel P. Berrange [Fri, 4 Dec 2015 17:25:22 +0000 (17:25 +0000)]
qemu: include hostname in QEMU log files

Often when debugging bug reports one is given a copy of the file
from /var/log/libvirt/qemu/$NAME.log along with other supporting
files. In a number of cases I've been given sets of files which
were from different machines. Including the hostname in the QEMU
log file will help identify when the bug reporter is providing
bad information.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agorotatingfile: mark log files as close-on-exec
Daniel P. Berrange [Fri, 4 Dec 2015 17:23:15 +0000 (17:23 +0000)]
rotatingfile: mark log files as close-on-exec

The log file descriptor associated with the virRotatingFile
struct should be marked close-on-exec, as even when virtlogd
re-exec's itself it expect to open the log file fresh. It
does not need to preserve the logfile handles, only the network
client FDs.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agolibvirtd: require virtlogd to start before libvirtd
Guido Günther [Fri, 4 Dec 2015 13:52:55 +0000 (14:52 +0100)]
libvirtd: require virtlogd to start before libvirtd

In the non-systemd case, without socket activation, we need to proper
ordering.

9 years agoqemu: domain: Prevent overflows in memory alignment code
Peter Krempa [Tue, 1 Dec 2015 13:08:37 +0000 (14:08 +0100)]
qemu: domain: Prevent overflows in memory alignment code

Since libvirt for dubious historical reasons stores memory size as
kibibytes, it's possible that the alignments done in the qemu code
overflow the the maximum representable size in bytes. The XML parser
code handles them in bytes in some stages. Prevent this by doing
overflow checks when alinging the size and add a test case.

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

9 years agoschema: Allow > UINT_MAX KiB of memory for NUMA nodes
Peter Krempa [Tue, 1 Dec 2015 13:59:47 +0000 (14:59 +0100)]
schema: Allow > UINT_MAX KiB of memory for NUMA nodes

Using more than 4TiB of memory per NUMA node would not be possible to
express in the XML without violating the schema. Not that such boxes
would be common, but we should use a longer type at this point.

The pattern is not necessary since libvirt redefines the type already in
basictypes.rng with the same pattern.

9 years agoconf: Revert some code to resolve issues for hostdev hotplug
Boris Fiuczynski [Mon, 30 Nov 2015 11:05:59 +0000 (12:05 +0100)]
conf: Revert some code to resolve issues for hostdev hotplug

This patch reverts parts of commits 0d8b24f6b and 0785966d dealing with
the addition of a controller during virDomainHostdevAssignAddress. This
caused a regression for the hostdev hotplug path which assumes the
qemuDomainFindOrCreateSCSIDiskController will add the new controller
during qemuDomainAttachHostSCSIDevice to both the running domain and
the domain def controller list when the controller doesn't yet exist
(whether due to no SCSI controllers existing or the addition of a new
controller because existing ones are full).

Since commit id 0d8b24f6 will call virDomainHostdevAssignAddress during
virDomainDeviceDefPostParseInternal which is called either during domain
definition post processing (via an iterator during virDomainDefPostParse)
or directly from virDomainDeviceDefParse during hotplug, the change
broke the "side effect" of being able to add both a hostdev and controller
to the running domain.

The regression would only be seen if the running domain didn't have a
SCSI controller already defined or if the existing SCSI controller was
"full" of devices and a new controller needed to be created.

This patch will also add some extra comments to the code to avoid a
similar future change.

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 agovirsh: remove custom error for cpulist from cmdIOThreadPin
Ján Tomko [Thu, 3 Dec 2015 12:44:43 +0000 (13:44 +0100)]
virsh: remove custom error for cpulist from cmdIOThreadPin

Instead of the custom error:
error: iothreadpin: invalid cpulist.

use vshCommandOptStringReq and let it report a more specific error:
error: Failed to get option 'cpulist': Option argument is empty

9 years agovirsh: report errors for empty strings
Ján Tomko [Thu, 3 Dec 2015 12:42:35 +0000 (13:42 +0100)]
virsh: report errors for empty strings

Several callers were using vshCommandOptString without setting an error.
Use vshCommandOptStringReq which sets the error.

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

9 years agobridge: check for invalid MAC in networkGetDHCPLeases
Ján Tomko [Thu, 3 Dec 2015 08:47:23 +0000 (09:47 +0100)]
bridge: check for invalid MAC in networkGetDHCPLeases

Instead of comparing garbage strings against real MAC addresses,
introduce an error mesage for unparsable ones:

$ virsh net-dhcp-leases default  --mac t12
error: Failed to get leases info for default
error: invalid MAC address: t12

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

9 years agolibxl: implement virDomainInterfaceStats
Joao Martins [Mon, 23 Nov 2015 18:57:00 +0000 (18:57 +0000)]
libxl: implement virDomainInterfaceStats

Introduce support for domainInterfaceStats API call for querying
network interface statistics. Consequently it also enables the
use of `virsh domifstat <dom> <interface name>` command plus
seeing the interfaces names instead of "-" when doing
`virsh domiflist <dom>`.

After successful guest creation we fill the network
interfaces names based on domain, device id and append suffix
if it's emulated in the following form: vif<domid>.<devid>[-emu].
We extract the network interfaces info from the libxl_domain_config
object in libxlDomainCreateIfaceNames() to generate ifname. On domain
cleanup we also clear ifname, in case it was set by libvirt (i.e.
being prefixed with "vif"). We also skip these two steps in case the name
of the interface was manually inserted by the adminstrator.

For getting the interface statistics we resort to virNetInterfaceStats
and let libvirt handle the platform specific nits. Note that the latter
is not yet supported in FreeBSD.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
9 years agonetwork: selectively disable -Wcast-align in virNetDevParseDadStatus
Ian Campbell [Thu, 26 Nov 2015 15:10:12 +0000 (15:10 +0000)]
network: selectively disable -Wcast-align in virNetDevParseDadStatus

Commit 0f7436ca54c9 "network: wait for DAD to finish for bridge IPv6 addresses"
results in:

 CC     util/libvirt_util_la-virnetdevmacvlan.lo
util/virnetdev.c: In function 'virNetDevParseDadStatus':
util/virnetdev.c:1319:188: error: cast increases required alignment of target type [-Werror=cast-align]
util/virnetdev.c:1332:41: error: cast increases required alignment of target type [-Werror=cast-align]
util/virnetdev.c:1334:92: error: cast increases required alignment of target type [-Werror=cast-align]
cc1: all warnings being treated as errors

on at least ARM platforms.

The three macros involved (NLMSG_NEXT, IFA_RTA and RTA_NEXT) all appear to
correctly take care of alignment, therefore suppress Wcast-align around their
uses.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Maxim Perevedentsev <mperevedentsev@virtuozzo.com>
Cc: Laine Stump <laine@laine.org>
Cc: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Jim Fehlig <jfehlig@suse.com>
9 years agolog_manager: Include configmake.h last
Michal Privoznik [Tue, 1 Dec 2015 15:43:56 +0000 (16:43 +0100)]
log_manager: Include configmake.h last

The problem is that in some mingw header DATADIR is used but
gnulib defines it too. This leads to the following compile error:

  CC       locking/libvirt_driver_la-lock_manager.lo
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/objbase.h:66:0,
                 from /usr/i686-w64-mingw32/sys-root/mingw/include/ole2.h:17,
                 from /usr/i686-w64-mingw32/sys-root/mingw/include/wtypes.h:12,
                 from /usr/i686-w64-mingw32/sys-root/mingw/include/winscard.h:10,
                 from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:97,
                 from /usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:23,
                 from ../gnulib/lib/unistd.h:48,
                 from ../../src/util/virutil.h:29,
                 from ../../src/logging/log_manager.c:30:
/usr/i686-w64-mingw32/sys-root/mingw/include/objidl.h:12275:2: error: expected identifier or '(' before string constant
 } DATADIR;
  ^
Makefile:7888: recipe for target 'logging/libvirt_driver_la-log_manager.lo' failed

The fix is to include configmake.h at the end of includes.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agotests: Run virnetdaemontest iff WITH_YAJL
Michal Privoznik [Tue, 1 Dec 2015 10:54:08 +0000 (11:54 +0100)]
tests: Run virnetdaemontest iff WITH_YAJL

The test itself and daemon require a JSON parsing library. If not
present, skip the test.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoadmin: Distribute libvirt-admin.conf
Martin Kletzander [Tue, 1 Dec 2015 10:36:37 +0000 (11:36 +0100)]
admin: Distribute libvirt-admin.conf

Commit 48cd3dfa668e5033b02dd029c2e6de558a3c4583 introduced configuration
file for libvirt-admin but forgot to distribute it.  Also the change
made to libvirt.conf in commit dbecb87f94e8f1591e3c471b34ae48a7203c9cb3
should've been removed thanks to introduction of separate config file.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoadmin: Rename virAdmConnect to virAdmDaemon
Martin Kletzander [Wed, 25 Nov 2015 15:59:30 +0000 (16:59 +0100)]
admin: Rename virAdmConnect to virAdmDaemon

virAdmConnect was named after virConnect, but after some discussions,
most of the APIs called will be working with remote daemon and starting
them virAdmDaemon will make more sense.  Only possibly controversal name
is CloseCallback (de)registration, and connecting to the daemon (which
will still be Open/Close), but even this makes sense if one thinks about
the daemon being opened and closed, e.g. as file, etc.

This way all the APIs working with the daemon will start with
virAdmDaemon prefix, they will accept virAdmDaemonPtr as first parameter
and that will better suit with other namings as well (virDomain*,
virAdmServer*, etc.).

Because in virt-admin, the connection name does not refer to a struct
that would have a connect in its name, also adjust 'connname' in
clients.  And because it is not used anywhere in the vsh code, move it
from there into each client.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agospec: Temporarily disable new admin-related files
Martin Kletzander [Tue, 1 Dec 2015 10:07:59 +0000 (11:07 +0100)]
spec: Temporarily disable new admin-related files

The virt-admin binary and its man page should not yet be distributed,
but we need libvirt-common.h.  RPM build fails without specifying these.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoadmin: Include admin_remote.c in the dist package
Martin Kletzander [Tue, 1 Dec 2015 07:58:02 +0000 (08:58 +0100)]
admin: Include admin_remote.c in the dist package

Otherwise all builds from the package will fail.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu_agent: fix deadlock in qemuProcessHandleAgentEOF
Wang Yufei [Sat, 26 Sep 2015 12:18:03 +0000 (20:18 +0800)]
qemu_agent: fix deadlock in qemuProcessHandleAgentEOF

If VM A is shutdown a by qemu agent at appoximately the same time
an agent EOF of VM A happened, there's a chance that deadlock may occur:

qemuProcessHandleAgentEOF in main thread
A)  priv->agent = NULL; //A happened before B

    //deadlock when we get agent lock which's held by worker thread
    qemuAgentClose(agent);

qemuDomainObjExitAgent called by qemuDomainShutdownFlags in worker thread
B)  hasRefs = virObjectUnref(priv->agent); // priv->agent is NULL,
                                           // return false
    if (hasRefs)
        virObjectUnlock(priv->agent); //agent lock will not be released here

In order to resolve, during EOF close the agent first, then set priv->agent
to NULL to fix the deadlock.

This essentially reverts commit id '1020a504'. It's also of note that commit
id '362d0477' notes a possible/rare deadlock similar to what was seen in
the monitor in commit id '25f582e3'. However, it seems interceding changes
including commit id 'd960d06f' should remove the deadlock issue.

With this change, if EOF is called:

    Get VM lock
    Check if !priv->agent || priv->beingDestroyed, then unlock VM
    Call qemuAgentClose
    Unlock VM

When qemuAgentClose is called
    Get Agent lock
    If Agent->fd open, close it
    Unlock Agent
    Unref Agent

qemuDomainObjEnterAgent
    Enter with VM lock
    Get Agent lock
    Increase Agent refcnt
    Unlock VM

After running agent command, calling qemuDomainObjExitAgent
    Enter with Agent lock
    Unref Agent
    If not last reference, unlock Agent
    Get VM lock

If we were in the middle of an EnterAgent, call Agent command, and
ExitAgent sequence and the EOF code is triggered, then the EOF code
can get the VM lock, make it's checks against !priv->agent ||
priv->beingDestroyed, and call qemuAgentClose. The CloseAgent
would wait to get agent lock. The other thread then will eventually
call ExitAgent, release the Agent lock and unref the Agent. Once
ExitAgent releases the Agent lock, AgentClose will get the Agent
Agent lock, close the fd, unlock the agent, and unref the agent.
The final unref would cause deletion of the agent.

Signed-off-by: Wang Yufei <james.wangyufei@huawei.com>
Reviewed-by: Ren Guannan <renguannan@huawei.com>
9 years agobuild: Create needed folders without dependency tracking
Martin Kletzander [Mon, 30 Nov 2015 09:52:43 +0000 (10:52 +0100)]
build: Create needed folders without dependency tracking

The parameter --disable-dependency-tracking is supposed to speed up
one-time build due to the fact that it disables some dependency
extractors that, apparently, take longer time to execute.  That is a
problem for code that is generated into builddir (especially some
specific subdirectory) because the directory it should be installed to
does not exists in VPATH and without the dependency tracking is not
created.  Generating such file hence fails with -ENOENT.  In order to
keep generating files into builddir instead of srcdir, we must create
the directory ourselves.  This should finally fix the problem that is
being fixed multiple times since its introduction in commit a9fe62037214
and let us continue with cleaning those parts of Makefiles that depend
on generating files into the srcdir rather than builddir as it should
be.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoinclude: Install libvirt-common.h
Martin Kletzander [Mon, 30 Nov 2015 14:37:19 +0000 (15:37 +0100)]
include: Install libvirt-common.h

Otherwise nobody will be able to include libvirt.h.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoutil: Avoid variable named 'truncate' shadowing global declaration
Martin Kletzander [Mon, 30 Nov 2015 14:30:33 +0000 (15:30 +0100)]
util: Avoid variable named 'truncate' shadowing global declaration

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agotools: fix output of list with state-shutoff
Wei Jiangang [Mon, 30 Nov 2015 10:08:40 +0000 (18:08 +0800)]
tools: fix output of list with state-shutoff

Due to the default of flags is VIR_CONNECT_LIST_DOMAINS_ACTIVE,
It doesn't show the domains that have been shutdown when we use
'virsh list' with only --state-shutoff.

Signed-off-by: Wei Jiangang <weijg.fnst@cn.fujitsu.com>
9 years agoconf: Split virDomainObjList into a separate file
Michal Privoznik [Fri, 17 Jul 2015 09:11:23 +0000 (11:11 +0200)]
conf: Split virDomainObjList into a separate file

Our domain_conf.* files are big enough. Not only they contain XML
parsing code, but they served as a storage of all functions whose
name is virDomain prefixed. This is just wrong as it gathers not
related functions (and modules) into one big file which is then
harder to maintain. Split virDomainObjList module into a separate
file called virdomainobjlist.[ch].

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: build command line for virtio-input-host device
Ján Tomko [Fri, 20 Nov 2015 07:57:16 +0000 (08:57 +0100)]
qemu: build command line for virtio-input-host device

<input type='passthrough' bus='virtio'>
  <source evdev='/dev/input/event1234'/>
</input>

results in:

-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234

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

9 years agoqemu: add passed-through input devs to cgroup ACL
Ján Tomko [Thu, 19 Nov 2015 13:32:22 +0000 (14:32 +0100)]
qemu: add passed-through input devs to cgroup ACL

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

9 years agosecurity: label the evdev for input device passthrough
Ján Tomko [Fri, 20 Nov 2015 07:25:41 +0000 (08:25 +0100)]
security: label the evdev for input device passthrough

Add functions for setting and restoring the label of input devices
to DAC and SELinux drivers.

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