20303 Commits

Author SHA1 Message Date
Jovanka Gulicoska
586eeca178 driver: log missing modules as INFO, not WARN
Missing modules is a common expected scenario for most libvirt usage on
RPM distributions like Fedora, so it doesn't really warrant logging at
WARN level. Use INFO instead

https://bugzilla.redhat.com/show_bug.cgi?id=1274849
(cherry picked from commit 9a0c7f5f834185db9017c34aabc03ad99cf37bed)
2016-03-17 17:09:34 -04:00
Cole Robinson
f945ae0efe rpc: wait longer for session daemon to start up
https://bugzilla.redhat.com/show_bug.cgi?id=1271183

We only wait 0.5 seconds for the session daemon to start up and present
its socket, which isn't sufficient for many users. Bump up the sleep
interval and retry amount so we wait for a total of 5.0 seconds.

(cherry picked from commit ca0c06f4008154de55e0b3109885facd0bf02d32)
2016-03-17 16:25:09 -04:00
Cole Robinson
6c3c5c099c util: virfile: Only setuid for virFileRemove if on NFS
NFS with root-squash is the only reason we need to do setuid/setgid
crazyness in virFileRemove, so limit that behavior to the NFS case.

(cherry picked from commit adefc561cc4c6a007529769c3df286f2ed461684)
2016-03-17 16:23:10 -04:00
Cole Robinson
cb3de69f0d util: virfile: Clarify setuid usage for virFileRemove
Break these checks out into their own function, and clearly document
each one. This shouldn't change behavior

(cherry picked from commit 7cf5343709935694b76af7b134447a2c555400b6)
2016-03-17 16:22:01 -04:00
Cole Robinson
34a7476f00 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
(cherry picked from commit 81da8bc73b6bc6777632b65a0df45335f7caebe4)
2016-03-17 15:58:54 -04:00
Cole Robinson
cd199c9bf7 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
(cherry picked from commit c7be484d1136834614089c9a74a3818594852f24)
2016-03-17 15:58:49 -04:00
Cole Robinson
a6e4fe019f 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.

(cherry picked from commit 8418245a7e00f873594f1000c9606d08265088e0)
2016-03-17 15:58:42 -04:00
Cole Robinson
4dc06610fc lxc: fuse: Unindent meminfo logic
Reverse the conditional at the start so we aren't stuffing all the logic
in an 'if' block

(cherry picked from commit f65dcfcd140d0a627aeab3fa0e9dc5f74da98e6d)
2016-03-17 15:58:28 -04:00
John Ferlan
58e916ffaf virfile: Fix error path for forked virFileRemove
As it turns out the caller in this case expects a return < 0 for failure
and to get/use "errno" rather than using the negative of returned status.
Again different than the create path.

If someone "deleted" a file from the pool without using virsh vol-delete,
then the unlink/rmdir would return an error (-1) and set errno to ENOENT.
The caller checks errno for ENOENT when determining whether to throw an
error message indicating the failure.  Without the change, the error
message is:

error: Failed to delete vol $vol
error: cannot unlink file '/$pathto/$vol': Success

This patch thus allows the fork path to follow the non-fork path
where unlink/rmdir return -1 and errno.

(cherry picked from commit cb19cff468432e55366014658f405066ce06c2f2)
2016-02-11 14:37:28 -05:00
Jiri Denemark
74909e9648 security: Do not restore kernel and initrd labels
Kernel/initrd files are essentially read-only shareable images and thus
should be handled in the same way. We already use the appropriate label
for kernel/initrd files when starting a domain, but when a domain gets
destroyed we would remove the labels which would make other running
domains using the same files very unhappy.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 68acc701bd449481e3206723c25b18fcd3d261b7)
2016-01-20 19:14:06 -05:00
Cole Robinson
40df40f35a rpc: socket: Don't repeatedly attempt to launch daemon
On every socket connect(2) attempt we were re-launching session
libvirtd, up to 100 times in 5 seconds.

This understandably caused some weird load races and intermittent
qemu:///session startup failures

https://bugzilla.redhat.com/show_bug.cgi?id=1271183
(cherry picked from commit 2eb7a975756d05a5b54ab4acf60083beb6161ac6)
2016-01-20 19:13:32 -05:00
Cole Robinson
2e4d173b49 rpc: socket: Explicitly error if we exceed retry count
When we autolaunch libvirtd for session URIs, we spin in a retry
loop waiting for the daemon to start and the connect(2) to succeed.

However if we exceed the retry count, we don't explicitly raise an
error, which can yield a slew of different error messages elsewhere
in the code.

Explicitly raise the last connect(2) failure if we run out of retries.

(cherry picked from commit 8da02d528068942303923fc4f935e77cccac9c7c)
2016-01-20 19:13:25 -05:00
Cole Robinson
4a4c73d217 rpc: socket: Minor cleanups
- Add some debugging
- Make the loop dependent only on retries
- Make it explicit that connect(2) success exits the loop
- Invert the error checking logic

(cherry picked from commit f102c7146ed7f6e04af0ad3bce302476239f2502)
2016-01-20 19:13:21 -05:00
Cole Robinson
39953c18d1 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
(cherry picked from commit a1edb05c6028470aa24b74aa0f8d5fb5a181128a)
2016-01-20 19:12:18 -05:00
Ján Tomko
d5ef3cbb2c leaseshelper: fix crash when no mac is specified
If dnsmasq specified DNSMASQ_IAID (so we're dealing with an IPv6
lease) but no DNSMASQ_MAC, we skip creation of the new lease object.

Also skip adding it to the leases array.

https://bugzilla.redhat.com/show_bug.cgi?id=1202350
(cherry picked from commit df9fe124d650bc438c531673492569da87523d20)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2016-01-20 11:12:36 +01:00
Ján Tomko
fa3eb97fdc schema: interleave domain name and uuid with other elements
Allow <name> and <uuid> anywhere under <domain>, not just at the top:

error:XML document failed to validate against schema: Unable to validate
doc against /usr/share/libvirt/schemas/domain.rng
Expecting an element name, got nothing
Invalid sequence in interleave
Element domain failed to validate content

Introduced with the first RelaxNG schema in commit c642103.

https://bugzilla.redhat.com/show_bug.cgi?id=1292131
(cherry picked from commit b4e0549febe416ffefc16f389423740d6d65fa74)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2016-01-05 13:54:28 +01:00
Cole Robinson
1ab886e4fa Prep for release 1.2.18.2 v1.2.18.2 2015-12-23 19:14:59 -05:00
Daniel Veillard
9528a72494 Fix a trailing space in spec file
(cherry picked from commit bd311d3a8a1771b1f06e4fdc7eeaccb6923b4c2d)
2015-12-23 18:34:25 -05:00
Ján Tomko
3e6e96f09a 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
(cherry picked from commit 45138725cf2a14575aa5204fe55efd6668b9b03a)
2015-12-23 18:31:03 -05:00
Ján Tomko
7b977a87a7 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
(cherry picked from commit 1e6d87bdfc801d2c006a17054bd19273430dce14)
2015-12-23 18:31:03 -05:00
Jiri Denemark
c0063662e2 Enhance documentation of virDomainDetachDevice
Link it to virDomainDetachDeviceFlags.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 63fd27cfa35f39b32692b9c66e59c4d157ce8806)
2015-12-23 18:31:03 -05:00
Guido Günther
1ba74670cb apparmor: add missing qemu binaries
This adds the qemu binaries as of 1.2.4 in Debian. It also removes a
duplicate sparc64 entry.

(cherry picked from commit d8ca0cbd4b01eed79d1845ca7d734b9196d28f9d)
2015-12-23 18:31:03 -05:00
Luyao Huang
d1f13a90a5 qemu: Use live autoNodeset when numatune placement is auto
https://bugzilla.redhat.com/show_bug.cgi?id=1270715

Commit id '9deb96f' removed the code to fetch the nodeset from the
CpusetMems cgroup for a running vm in favor of using the return from
virDomainNumatuneFormatNodeset introduced by commit id '43b67f2e7'.
However, that API will return the value of the passed 'auto_nodeset'
when placement is VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO, which happens
to be NULL.

Since commit id 'c74d58ad' started using priv->autoNodeset in order
to manage the auto placement value during qemuProcessStart, it should
be passed along in order to return the correct value if the domain
requests the auto placement.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
(cherry picked from commit 4eac55238f856d29d07a60448adb2e0b2f8e28b5)
2015-12-23 18:31:03 -05:00
Shivaprasad G Bhat
76e51193e3 Close the source fd if the destination qemu exits during tunnelled migration
Tunnelled migration can hang if the destination qemu exits despite all the
ABI checks. This happens whenever the destination qemu exits before the
complete transfer is noticed by source qemu. The savevm state checks at
runtime can fail at destination and cause qemu to error out.
The source qemu cant notice it as the EPIPE is not propogated to it.
The qemuMigrationIOFunc() notices the stream being broken from virStreamSend()
and it cleans up the stream alone. The qemuMigrationWaitForCompletion() would
never get to 100% transfer completion.
The qemuMigrationWaitForCompletion() never breaks out as well since
the ssh connection to destination is healthy, and the source qemu also thinks
the migration is ongoing as the Fd to which it transfers, is never
closed or broken. So, the migration will hang forever. Even Ctrl-C on the
virsh migrate wouldn't be honoured. Close the source side FD when there is
an error in the stream. That way, the source qemu updates itself and
qemuMigrationWaitForCompletion() notices the failure.

Close the FD for all kinds of errors to be sure. The error message is not
copied for EPIPE so that the destination error is copied instead later.

Note:
Reproducible with repeated migrations between Power hosts running in different
subcores-per-core modes.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
(cherry picked from commit b39a1fe1656ee4be0d244466b474cad7ada100c8)
2015-12-23 18:21:54 -05:00
John Ferlan
5c5ec4ca9e storage: Fix incorrect format for <disk> <auth> XML
https://bugzilla.redhat.com/show_bug.cgi?id=1256999

After creating a copy of the 'authdef' in a pool -> disk translation,
unconditionally clear the 'authType' in the resulting disk auth def
structure since that's used for a storage pool and not a disk.  This
ensures virStorageAuthDefFormat will properly format the <auth> XML
for a <disk> (e.g. it won't have a <auth type='%s'.../>).

(cherry picked from commit 5275c0f4a1267c630b5c3b77fac8cbe4fcaa3adb)
2015-12-23 18:20:45 -05:00
Daniel P. Berrange
07518f77bd virt-host-validate: distinguish exists vs accessible for devices
Currently we just check that various devices are accessible.
This leads to inaccurate errors reported for /dev/kvm and
/dev/vhost-net if they exist but an unprivileged user lacks
access. Switch existing checks to look for file existance,
and add a separate check for accessibility of /dev/kvm
since some distros don't grant users access by default.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit fd6d506c50d9c885fd500627bddefe2f93ded0c2)
2015-12-23 18:20:31 -05:00
Cole Robinson
26295a0ea7 spec: Delete .git after applying patches
I'm hitting this little annoyance in fedora's package repo:

$ fedpkg prep
Downloading libvirt-1.2.20.tar.gz
...
+ /usr/bin/gzip -dc /home/crobinso/src/fedora/libvirt/libvirt-1.2.20.tar.gz
$ git clean -xdf
Removing libvirt-1.2.20.tar.gz
Skipping repository libvirt-1.2.20/

We git-ify the libvirt directory as part of applying patches in the spec
file, but 'git clean' will ignore subfolders that appear to be standalone
git repos.

Let's just delete the .git directory after we're done with it.

(cherry picked from commit 62ff210e5d6542bda3f25ed5e96c5088a840ce1b)
2015-12-23 18:19:15 -05:00
Cédric Bosdonnat
079a8dc4e6 apparmor: differentiate between error and unconfined profiles
profile_status function was not making any difference between error
cases and unconfined profiles. The problem with this approach is that
dominfo was throwing an error on unconfined domains.

(cherry picked from commit a1bdf04b27f8f28b6e96ecd10de2a8e78d80271f)
2015-12-23 18:18:25 -05:00
John Ferlan
eb9aaa26a8 storage: Adjust calculation of alloc/capacity for disk
https://bugzilla.redhat.com/show_bug.cgi?id=1247987

Calculation of the extended and logical partition values for the disk
pool is complex. As the bz points out an extended partition should have
it's allocation initialized to 0 (zero) and keep the capacity as the size
dictated by the extents read.  Then for each logical partition found,
adjust the allocation of the extended partition.

Finally, previous logic tried to avoid recalculating things if a logical
partition was deleted; however, since we now have special logic to handle
the allocation of the extended partition, just make life easier by reading
the partition table again - rather than doing the reverse adjustment.

(cherry picked from commit 1895b42114c932495c2242d6847e47c054955998)
2015-12-23 18:17:49 -05:00
Andrea Bolognani
770ffbf857 qemu: Add conditions for qemu-kvm use on ppc64
qemu-kvm can be used to run ppc64 guests on ppc64le hosts and vice
versa, since the hardware is actually the same and the endianness
is chosen by the guest kernel.

Up until now, however, libvirt didn't allow the use of qemu-kvm
to run guests if their endianness didn't match the host's.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1267882
(cherry picked from commit 938368f8382ca94c5156c44ad85a06cf9e4f8f8f)
2015-12-23 18:17:06 -05:00
Peter Krempa
f3ac5d6a6c rpc: libssh2: Fix regression in ssh host key verification
Commit 792f81a40e caused a regression in the libssh2 host key
verification code by changing the variable type of 'i' to unsigned.
Since one of the loops used -1 as a special value if the asking
callback was found the conversion made a subsequent test always fail.

The bug was stealth enough to pass review, compilers and coverity.

Refactor the condition to avoid problems.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1047861
(cherry picked from commit 9869f24d08af1f0d5f45175117953704064556c2)
2015-12-23 18:16:55 -05:00
Peter Krempa
a6584eb6f7 rpc: libssh2: Add more debugging info
(cherry picked from commit 387c316e11c0adcf7f8ed400019e044b47edf0f9)
2015-12-23 18:16:51 -05:00
Ján Tomko
9a51c50048 Update pool allocation with new values on volume creation
Since commit e0139e3, we update the pool allocation with
the user-provided allocation values.

For qcow2, the allocation is ignored for volume building,
but we still subtracted it from pool's allocation.
This can result in interesting values if the user-provided
allocation is large enough:

Capacity:       104.71 GiB
Allocation:     109.13 GiB
Available:      16.00 EiB

We already do a VolRefresh on volume creation. Also refresh
the volume after creating and use the new value to update the pool.

https://bugzilla.redhat.com/show_bug.cgi?id=1163091
(cherry picked from commit 56a4e9cb613aff9cd6f828c0a9283fba55ac5951)
2015-12-23 18:15:44 -05:00
Guido Günther
5741803ceb Use daemon log facility for journald
otherwise messages end up in /var/log/kern.log if journald forwards to
syslog.

Reference: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=799633
(cherry picked from commit fd00f0e6c75b00c3d97be8670afcd9094b823855)
2015-12-23 18:15:31 -05:00
Michal Privoznik
64be645161 virDomainCreateXML: Make domain definition transient
https://bugzilla.redhat.com/show_bug.cgi?id=871452

So, you want to create a domain from XML. The domain already
exists in libvirt's database of domains. It's okay, because name
and UUID matches. However, on domain startup, internal
representation of the domain is overwritten with your XML even
though we claim that the XML you've provided is a transient one.
The bug is to be found across nearly all the drivers.
Le sigh.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit c99b8cec82a53f091ca3de7532d305a93765b467)
2015-12-23 18:14:43 -05:00
Michal Privoznik
e89b42ccc6 virDomainCreateXML: Don't remove persistent domains on error
https://bugzilla.redhat.com/show_bug.cgi?id=871452

Okay, so we allow users to 'virsh create' an already existing
domain, providing completely different XML than the one stored in
Libvirt. Well, as long as name and UUID matches. However, in some
drivers the code that handles errors unconditionally removes the
domain that failed to start even though the domain might have
been persistent. Fortunately, the domain is removed just from the
internal list of domains and the config file is kept around.

Steps to reproduce:

1) virsh dumpxml $dom > /tmp/dom.xml
2) change XML so that it is still parse-able but won't boot, e.g.
change guest agent path to /foo/bar
3) virsh create /tmp/dom.xml
4) virsh dumpxml $dom
5) Observe "No such domain" error

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 37405b910907bd1ad338fb0d6a967bfd23529cf6)
2015-12-23 18:14:21 -05:00
Peter Krempa
c22a4bb523 qemu: Refresh memory size only on fresh starts
Qemu unfortunately doesn't update internal state right after migration
and so the actual balloon size as returned by 'query-balloon' are
invalid for a while after the CPUs are started after migration. If we'd
refresh our internal state at this point we would report invalid current
memory size until the next balloon event would arrive.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1242940
(cherry picked from commit d7a0386e229176ec67531aac1412b8a98914da8e)
2015-12-23 18:13:59 -05:00
Jiri Denemark
0099781e80 domain: Fix migratable XML with graphics/@listen
As of commit 6992994, we set graphics/@listen attribute according to the
first listen child element even if that element is of type='network'.
This was done for backward compatibility with applications which only
support the original listen attribute. However, by doing so we broke
migration to older libvirt which tried to check that the listen
attribute matches one of the listen child elements but which did not
take type='network' elements into account.

We are not concerned about compatibility with old applications when
formatting domain XML for migration for two reasons. The XML is consumed
only by libvirtd and the IP address associated with type='network'
listen address on the source host is just useless on the destination
host. Thus, we can safely avoid propagating the type='network' IP
address to graphics/@listen attribute when creating migratable XML.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit c0806dc30bda562810b0d686e33c903862e3c8f1)
2015-12-23 18:02:01 -05:00
Stefan Berger
06f7fec561 tpm: adapt sysfs cancel path for new TPM driver
This patch addresses BZ 1244895.

Adapt the sysfs TPM command cancel path for the TPM driver that
does not use a miscdevice anymore since Linux 4.0. Support old
and new paths and check their availability.

Add a mockup for the test cases to avoid the testing for
availability of the cancel path.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
(cherry picked from commit 5ed7afa9de4e8d2b7e83fee334a0c3f2bddc6a48)
2015-12-23 18:00:07 -05:00
Guido Günther
c46e1a92ce libvirt-guests: Disable shutdown timeout
Since we can't know at service start how many VMs will be running we
can't calculate an apropriate shutdown timeout. So instead of killing
off the service just let it use it's own internal timeout mechanism.

References:
    http://bugs.debian.org/803714
    https://bugzilla.redhat.com/show_bug.cgi?id=1195544

(cherry picked from commit ba08d16d6cec81656b333435650aef36a012034c)
2015-12-23 17:59:49 -05:00
Martin Kletzander
ac3dbf5a68 systemd: Escape only needed characters for machined
Machine name escaping follows the same rules as serice name escape,
except that '.' and '-' must not be escaped in machine names, due
to a bug in systemd-machined.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 0e0149ce91d84f40b98acf4c4bb0da6e29b9c15c)
2015-12-23 17:54:51 -05:00
Martin Kletzander
c0fa258b3d systemd: Escape machine name for machined
According to the documentation, CreateMachine accepts only 7bit ASCII
characters in the machinename parameter, so let's make sure we can start
machines with unicode names with systemd.  We already have a function
for that, we just forgot to use it.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit e24eda48cfae84a9003456b68eaf753a26123639)
2015-12-23 17:54:46 -05:00
Eric Blake
d035796675 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>
(cherry picked from commit 034e47c338b13a95cf02106a3af912c1c5f818d7)
2015-12-12 20:18:04 -07:00
Dominik Perpeet
4ee196bf30 docs: event impl. registration before hypervisor connection
Event implementations need to be registered before a connection to the
Hypervisor is opened, otherwise event handling can be impaired (e.g.
delayed messages). This fact is referenced in an e-mail [1], but should
also be noted in the documentation of the registration functions.

[1] https://www.redhat.com/archives/libvirt-users/2014-April/msg00011.html

(cherry picked from commit 9bf1cef7371b119cf1ad1e83daaa9cd0da893352)
2015-10-15 19:53:49 -04:00
Cole Robinson
404e42d3c6 spec: Fix some warnings with latest rpmbuild
$ rpmbuild -ba libvirt.spec
warning: Macro expanded in comment on line 5: # If neither fedora nor rhel was defined, try to guess them from %{dist}

warning: Macro %enable_autotools defined but not used within scope
warning: Macro %client_only defined but not used within scope
...

(cherry picked from commit dae1250b24404f7f21e7bd8aeeb304565d175de4)
2015-10-06 16:01:15 -04:00
Cole Robinson
ee7a60854b qemu: Fix dynamic_ownership qemu.conf setting
Commit 307fb904 (Sep 10) added a 'privileged' variable when creating
the DAC driver:

@@ -153,6 +157,7 @@ virSecurityManagerNewDAC(const char *virtDriver,
                          bool defaultConfined,
                          bool requireConfined,
                          bool dynamicOwnership,
+                         bool privileged,
                          virSecurityManagerDACChownCallback chownCallback)

But argument order is mixed up at the caller, swapping dynamicOwnership
and privileged values. This corrects the argument order

https://bugzilla.redhat.com/show_bug.cgi?id=1266628
(cherry picked from commit 68572de8228e3971174a83c227fcb018d6f684c7)
2015-10-06 15:17:00 -04:00
Cole Robinson
a267bb501b Prep for release 1.2.18.1 v1.2.18.1 2015-09-21 20:54:37 -04:00
David Mansfield
7d2cf48532 test driver: don't unlock pool after freeing it
Invalid read of size 4
    at 0x945CA30: __pthread_mutex_unlock_full (in /lib64/libpthread-2.20.so)
    by 0x4F0404B: virMutexUnlock (virthread.c:94)
    by 0x4F7161B: virStoragePoolObjUnlock (storage_conf.c:2603)
    by 0x4FE0476: testStoragePoolUndefine (test_driver.c:4328)
    by 0x4FCF086: virStoragePoolUndefine (libvirt-storage.c:656)
    by 0x15A7F5: cmdPoolUndefine (virsh-pool.c:1721)
    by 0x12F48D: vshCommandRun (vsh.c:1212)
    by 0x132AA7: main (virsh.c:943)
  Address 0xfda56a0 is 16 bytes inside a block of size 104 free'd
    at 0x4C2BA6C: free (vg_replace_malloc.c:473)
    by 0x4EA5C96: virFree (viralloc.c:582)
    by 0x4F70B69: virStoragePoolObjFree (storage_conf.c:412)
    by 0x4F7167B: virStoragePoolObjRemove (storage_conf.c:437)
    by 0x4FE0468: testStoragePoolUndefine (test_driver.c:4323)
    by 0x4FCF086: virStoragePoolUndefine (libvirt-storage.c:656)
    by 0x15A7F5: cmdPoolUndefine (virsh-pool.c:1721)
    by 0x12F48D: vshCommandRun (vsh.c:1212)
    by 0x132AA7: main (virsh.c:943)

(cherry picked from commit 03cf57a37df750da46289b0f8aeac6463d521785)
2015-09-21 20:18:06 -04:00
Chunyan Liu
e60d286b8e libxl: fix AttachDeviceConfig on hostdev type
After attach-device a <hostdev> with --config, new device doesn't
show up in dumpxml and in guest.

To fix that, set dev->data.hostdev = NULL after work so that the
pointer is not freed, since vmdef has the pointer and still need it.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
(cherry picked from commit 56945e1374bd254148643d76a98fba9be67fba15)
2015-09-21 20:18:06 -04:00
Michal Privoznik
a45823210d security_selinux: Take @privileged into account
https://bugzilla.redhat.com/show_bug.cgi?id=1124841

If running in session mode it may happen that we fail to set
correct SELinux label, but the image may still be readable to
the qemu process. Take this into account.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 00e5b967168bab252ea2bef977ad40b4155f08df)
2015-09-21 20:18:06 -04:00