18779 Commits

Author SHA1 Message Date
Ján Tomko
be74ebccbe Clarify the meaning of version in redirdev filters
The version attribute in redirdev filters refers to the revision
of the device, not the version of the USB protocol.

Explicitly state that this is not the USB protocol and remove references
to those round version numbers that resemble USB protocol versions.

https://bugzilla.redhat.com/show_bug.cgi?id=1177237
(cherry picked from commit 76a2a5ce8ba319c63e5c5572d41d768a48d371b5)
2015-04-28 11:06:41 -04:00
John Ferlan
ac4713899b xenapi: Resolve Coverity REVERSE_INULL
Coverity notes in xenapiDomainGetXMLDesc that 'vms' is dereferenced
a few times before a "if (vms) xen_vm_set_free(vms);" call is made.
Since we'd exit out much sooner if the fetch of the vms failed, just
remove the unnecessary "if (vms)" check.

(cherry picked from commit eab968c7d7b4ee94e504499dc2a4ea70643718a0)
2015-04-28 11:06:40 -04:00
John Ferlan
2cb4b820fd xenapi: Resolve Coverity REVERSE_INULL
Coverity complains that "net_set" is compared to NULL before calling
xen_network_set_free, but used rather liberally before that.  While
I was looking at the code I also noted that if the virAsprintfQuiet
fails, then we leak our structures - so I added those too.

(cherry picked from commit 6da29e0faa44209bcbd737920d93c760104b8349)
2015-04-28 11:06:40 -04:00
John Ferlan
e4afc2a29d xenapi: Resolve Coverity NULL_RETURNS
Coverity points out that the return from virDomainDefParseString is
not checked in xenapiDomainCreateXML like it should be which could
end up in a NULL pointer dereference

(cherry picked from commit b193a1d61737fad7cf4b96e5fd9443b0ace36efc)
2015-04-28 11:06:40 -04:00
John Ferlan
2f26dccb65 xenapi: Resolve Coverity NO_EFFECT
Coverity points out that check (def->uuid) has no effect since it's not
a pointer, rather an array of characters.   Just remove the extranous check.

(cherry picked from commit 467c90590924069d64a4cd884abef17c7c2c0f24)
2015-04-28 11:06:40 -04:00
John Ferlan
2213707b6b xenapi: Resolve Coverity FORWARD_NULL
Since inception.  Coverity complains that the code checks "(record ==
NULL && !session->ok)", but doesn't check (record != NULL) before
dereferencing at "record->is_a_template"

(cherry picked from commit 500d77f1811c371598ab7a5fcc90bad45b52bafd)
2015-04-28 11:06:40 -04:00
Michal Privoznik
193b057352 RNG: Allow multiple parameters to be passed to an interface filter
Our code supports that for ages. When using a <filterref/> to an
<interface/> several parameters can be passed to the filter. Later,
when building firewall rules, parameters are substituted for their
values. However, our RNG schema allowed only one parameter to be
passed.

Reported-by: Brian Rak <brak@gameservers.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 6cc5080a099a650c6cd98662219bfc5c9af153d7)
2015-04-28 11:06:40 -04:00
Michael Chapman
3db520d9db domain_conf: fix crash in virDomainObjListFindByUUIDInternal
If a domain object is being removed and looked up concurrently we must
ensure we unlock the object before unreferencing it, since the latter
might free the object.

The flaw was introduced in commit feb1a4d792e1c35b1009e69c00bf351b39.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
(cherry picked from commit 616003d6bd5a3d87d6d529ddb6d83715979d903c)
2015-04-28 11:06:40 -04:00
Michael Chapman
2206ec869b {domain, network}_conf: disable autostart when deleting config
Undefining a running, autostarted domain removes the autostart link, but
dom->autostart is not cleared. If the domain is subsequently redefined,
libvirt thinks it is already autostarted and will not create the link
even if requested:

  # virsh dominfo example | grep Autostart
  Autostart:      enable

  # ls /etc/libvirt/qemu/autostart/example.xml
  /etc/libvirt/qemu/autostart/example.xml

  # virsh undefine example
  Domain example has been undefined

  # virsh define example.xml
  Domain example defined from example.xml

  # virsh dominfo example | grep Autostart
  Autostart:      enable

  # virsh autostart example
  Domain example marked as autostarted

  # ls /etc/libvirt/qemu/autostart/example.xml
  ls: cannot access /etc/libvirt/qemu/autostart/example.xml: No such file or directory

This commit ensures dom->autostart is cleared whenever the config and
autostart link (if present) are removed.

The bridge network driver cleared this flag itself in networkUndefine.
This commit moves this into virNetworkDeleteConfig for symmetry with
virDomainDeleteConfig, and to ensure it is not missed in future network
drivers.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
(cherry picked from commit a6ec4f472d585c0ab3df42b98926fb8c6893d6e4)
2015-04-28 11:06:39 -04:00
Luyao Huang
5f3db97168 qemu: Remove unnecessary virReportError on networkGetNetworkAddress return
Error messages are already set in all code paths returning -1 from
networkGetNetworkAddress, so we don't want to overwrite them.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
(cherry picked from commit 64595431cdf57f0a23351e8808f7c3c18e855f9f)
2015-04-28 11:06:39 -04:00
Michal Privoznik
55576d3512 virQEMUCapsInitQMP: Don't dispose locked @vm
When creating qemu capabilities, a dummy virDomainObj is created just
because our monitor code expects that. However, the object is created
locked already. Then, under cleanup label, we simply unref the object
which results in whole domain object to be disposed. The object lock
is destroyed subsequently, but hey - it's still locked:

==24845== Thread #14's call to pthread_mutex_destroy failed
==24845==    with error code 16 (EBUSY: Device or resource busy)
==24845==    at 0x4C3024E: pthread_mutex_destroy (in /usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
==24845==    by 0x531F72E: virMutexDestroy (virthread.c:83)
==24845==    by 0x5302977: virObjectLockableDispose (virobject.c:237)
==24845==    by 0x5302A89: virObjectUnref (virobject.c:265)
==24845==    by 0x1DD37866: virQEMUCapsInitQMP (qemu_capabilities.c:3397)
==24845==    by 0x1DD37CC6: virQEMUCapsNewForBinary (qemu_capabilities.c:3481)
==24845==    by 0x1DD381E2: virQEMUCapsCacheLookup (qemu_capabilities.c:3609)
==24845==    by 0x1DD30F8A: virQEMUCapsInitGuest (qemu_capabilities.c:744)
==24845==    by 0x1DD31889: virQEMUCapsInit (qemu_capabilities.c:1020)
==24845==    by 0x1DD7DD36: virQEMUDriverCreateCapabilities (qemu_conf.c:888)
==24845==    by 0x1DDC57C0: qemuStateInitialize (qemu_driver.c:803)
==24845==    by 0x53DC743: virStateInitialize (libvirt.c:777)
==24845==

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 954427c35477752a4ef1789035f298fc9e7287e9)
2015-04-28 11:06:39 -04:00
Chen Fan
0f9ee86062 qemu: fix memory leak in qemuAgentGetFSInfo
in virDomainFSInfoFree(), don't free the virDomainFSInfo data.

==10670== 80 bytes in 2 blocks are definitely lost in loss record 576 of 793
==10670==    at 0x4A06BC3: calloc (vg_replace_malloc.c:618)
==10670==    by 0x509DEBD: virAlloc (viralloc.c:144)
==10670==    by 0x19FBD558: qemuAgentGetFSInfo (qemu_agent.c:1837)
==10670==    by 0x1A03CF91: qemuDomainGetFSInfo (qemu_driver.c:19238)

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
(cherry picked from commit f276b36d65f5013425eb57524de7d919d99aba9a)
2015-04-28 11:06:39 -04:00
Pavel Hrdina
a2d4e78296 docs: add a note that spice channel is usable only with spice graphics
To prevent a confusion about missing chardev argument in qemu
command line add a note about that behavior into documentation.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 242e8c54728abc464b92d55a5ce76121803c97e4)
2015-04-28 11:06:39 -04:00
Jiri Denemark
a065bb0fe6 locking: Fix flags in virLockManagerLockDaemonNew
virLockManager*New APIs are never called with
VIR_LOCK_MANAGER_USES_STATE. Moreover, lockd driver does not maintain
any state that would need to be transferred during migration and thus it
should not mention VIR_LOCK_MANAGER_USES_STATE at all.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 6beb75d96dc596047aedaa9e79d81a042364626a)
2015-04-28 11:06:39 -04:00
Pavel Hrdina
bb1018f6b2 tests: fix qemuxml2argvtest to be arch independent
Commit 5aee81a0 introduced a new test for disk-serial.  The test fails
on i686 arch because there is no need to add "-cpu qemu32" to command
line.  To fix the test update emulator in XML to "/usr/bin/qemu" so we
don't add the "-cpu qemu32" to command while running the test on i686 or
x86_64 host.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit c2851781f1e27d04ae716787ada4e4335283ec58)
2015-04-28 11:06:38 -04:00
Martin Kletzander
87673df221 tests: Add test for virtio-mmio address type
Commit 3e4b783e fixed an issue with RNG schema where this address type
was missing, this commit adds a test for it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 6b22e0b562d4e4abf2c0f88b8705b58e5b6c632b)
2015-04-28 11:06:38 -04:00
Michal Privoznik
61ab292139 qemu: Allow spaces in disk serial
https://bugzilla.redhat.com/show_bug.cgi?id=1195660

There's been a bug report appearing on the qemu-devel list, that
libvirt is unable to pass spaces in disk serial number [1]. Not only
our RNG schema forbids that, the code is not prepared either. However,
with a bit of escaping (if needed) we can allow spaces there.

1: https://lists.gnu.org/archive/html/qemu-devel/2015-02/msg04041.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 5aee81a0cb60308b8614ee37c0b69c1dde1f00d8)
2015-04-28 11:06:38 -04:00
Erik Skultety
6ae19e709e storage: tweak condition to properly test lseek
According to the POSIX standard, off_t (returned by lseek) is defined as
signed integral type no shorter than int. Because our offset variable is defined
as unsigned long long, the original check was passed successfully if UINT64_MAX had
been used as offset value, due to implicit conversion.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1177219
(cherry picked from commit 3fde7986d6694f122ae919d68ec64eee79bd51db)
2015-04-28 11:06:38 -04:00
Erik Skultety
41fdb11391 virsh: tweak domif-getlink link state reporting message
According to docs, we only support 2 link states for an interface
up/down, 'up' being the default state if link state is unspecified in
domain's XML, so the message when no link state is provided should be
changed a little.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1141119
(cherry picked from commit d9c7f014ee7c23d25483acf4bce344fae169f1dd)
2015-04-28 11:06:38 -04:00
Shanzhi Yu
97015f2fc4 qemu: snapshot: Don't skip check for qcow2 format with network disks
When the domain's source disk type is network, if source protocol is rbd
or sheepdog, the 'if().. break' will end the current case, which lead to
miss check the driver type is raw or qcow2. Libvirt will allow to create
internal snapshot for a running domain with raw format disk which based
on rbd storage.

While both protocols support internal snapshots of the disk qemu is not
able to use it as it requires some place to store the memory image. The
check if the disk is backed by a qcow2 image needs to be executed
always.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1179533
Signed-off-by: Shanzhi Yu <shyu@redhat.com>
(cherry picked from commit f7c1410b0ee5b878e81f2eddf86c609947a9b27c)
2015-04-28 11:06:38 -04:00
Michal Privoznik
2362e98273 networkLookupByUUID: Improve error message
We have this function networkObjFromNetwork() which for given
virNetworkPtr tries to find corresponding virNetworkObjPtr. If no
object is found, a nice error message is printed out:

  no network with matching uuid '$uuid' ($name)

Let's improve the error message produced by networkLookupByUUID to
follow that logic.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit bf1afdd4911b496f12635b5bd17150f09864ee67)
2015-04-28 11:06:38 -04:00
Michal Privoznik
91cf6052de qemuProcessReconnect: Fill in pid file path
https://bugzilla.redhat.com/show_bug.cgi?id=1197600

So, libvirt uses pid file to track pid of started qemus. Whenever
a domain is started, its pid is put into corresponding pid file.
The pid file path is generated based on domain name and stored
into domain object internals. However, it's not stored in the
status XML and therefore lost on daemon restarts. Hence, later,
when domain is being shut down, the daemon does not know which
pid file to unlink, and the correct pid file is left behind. To
avoid this, lets generate the pid file path again in
qemuProcessReconnect().

Reported-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 63889e0c775010d8d70b71d25340bab995aa83ce)
2015-04-28 11:06:37 -04:00
Prerna Saxena
9aec9a46b4 tests : Add test for 'ppc64le' architecture.
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
(cherry picked from commit 8672a1e496db76c9a209a5e27c39a5000494c5f7)
2015-04-28 11:06:37 -04:00
Prerna Saxena
2e47fb1539 RNG: Add 'ppc64le' arch and newer pseries-2.* machine types
Acked-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
(cherry picked from commit 0afa6be8153518fad5862da022f63042cb72abbb)
2015-04-28 11:06:37 -04:00
Peter Krempa
e022ba7334 schema: Fix interface link state schema
In commit edd1295e1da6bfe8e4e257e5fbfad71ac0bf7c87 I've introduced an
XML element that allows to configure state of the network interface
link. Somehow the RNG schema hunk ended up in a weird place in the
network schema definition. Move it to the right place and add a test
case.

Note that the link state is set up via the monitor at VM startup so I
originally didn't think of adding a test case.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1173468
(cherry picked from commit 8eb907b8d0fd73c8f88f9cd8df1fa0e7abf40c93)
2015-04-28 11:06:37 -04:00
Martin Kletzander
d048e8ec9e conf: De-duplicate scheduling policy enums
Since adding the support for scheduler policy settings in commit
8680ea97, there are two enums with the same information.  That was
caused by rewriting the patch since first draft.

Find out thanks to clang, but there was no impact whatsoever.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 2fd5880b3b00cb6549242c613c5215617f29c428)
2015-04-28 11:06:37 -04:00
Martin Kletzander
5b3d68730d qemu: Don't crash in qemuDomainOpenChannel()
The problem here was that when opening a channel, we were checking
whether the channel given is alias (can't be NULL for running domain) or
it's name, which can be NULL (for example with spicevmc).  In case of
such domain qemuDomainOpenChannel() made the daemon crash.
STREQ_NULLABLE() is safe to use since the code in question is wrapped in
"if (name)" and is more readable, so use that instead of checking for
non-NULL "vm->def->channels[i]->target.name".

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit b3ea0a8fb86a8024538c68ca1d43a2bbc0192a0f)
2015-04-28 11:06:37 -04:00
John Ferlan
67ca910eec virsh.pod: Update find-storage-pool-sources[-as] man page
https://bugzilla.redhat.com/show_bug.cgi?id=921426

Add to the man page a more complete description of what exactly the
command expects on input and will return on output based on what is
currently supported.

Perhaps missing findPoolSources implementations are backends for
sheepdog and rbd.  Also missing any backend is zfs.

(cherry picked from commit 567bd0fa57025efe8eda8f39e48d957842e39d43)
2015-04-28 11:06:36 -04:00
John Ferlan
5696678a1e iscsi: Adjust error message for findStorageSources backend
The virStorageBackendISCSIFindPoolSources API only needs the 'host' name
in order to discover iSCSI pools, it returns the various device paths.
On input, it's also possible to further restrict a search by providing the
port attribute for the host element and the (undocumented) initiator element.

For example:

$  virsh find-storage-pool-sources-as iscsi
error: Failed to find any iscsi pool sources
error: invalid argument: hostname and device path must be specified for iscsi sources

$ virsh find-storage-pool-sources-as iscsi 192.168.122.1
<sources>
  <source>
    <host name='192.168.122.1' port='3260'/>
    <device path='iqn.2013-12.com.example:iscsi-chap-lclpool'/>
  </source>
</sources>

(cherry picked from commit 30f69ae86b888ca4b2957454d16d8e9b1501a510)
2015-04-28 11:06:36 -04:00
John Ferlan
0a19376986 virsh.pod: Add information regarding LXC for setmem, memtune, and dominfo
https://bugzilla.redhat.com/show_bug.cgi?id=1070695

Modify the virsh man page to more accurately describe which values are
set by the virsh setmem and displayed by the virsh memtune or dominfo
based on the setmem command results.

(cherry picked from commit 69db32f93d7a22e7be04c2e9dc41a357f9811404)
2015-04-28 11:06:36 -04:00
Erik Skultety
627f615a6e docs: add a note that attr 'managed' is only used by PCI devices
Our documentation isn't 100% clear about hostdev 'managed' attribute usage,
because it only makes sense to use it with PCI devices, yet we format
this attribute to all hostdev devices. By adding a note into the docs,
we can possibly avoid confusion from customer's side and also avoid a solution
using ternary logic.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1155887
(cherry picked from commit ccfe9e480986c075a6a04f7792a5b30350396d83)
2015-04-28 11:06:36 -04:00
Ján Tomko
37448a868e Check if domain is running in qemuDomainAgentIsAvailable
If the domain is not running, the agent will not respond.
Do not even try.

https://bugzilla.redhat.com/show_bug.cgi?id=872424
(cherry picked from commit 723522328f2d92e4c2d5de35b3b3ec0302bb06ac)
2015-04-28 11:06:36 -04:00
Ján Tomko
4f712a2e95 Pass virDomainObjPtr to qemuDomainAgentAvailable
Not just the DomainObj's private data.

(cherry picked from commit fbb94044eabf1853af605314da96b533f7c3d44e)
2015-04-28 11:06:36 -04:00
Ján Tomko
99680243f6 Check for qemu guest agent availability after getting the job
This way checks requiring the job can be done in qemuDomainAgentAvailable.

(cherry picked from commit c8b80b49f6db277eee1bf6caf9ff9cb8ffd91dfd)
2015-04-28 11:06:35 -04:00
Cole Robinson
5939f52a95 storage: fs: Ignore volumes that fail to open with EACCESS/EPERM
Trying to use qemu:///session to create a storage pool pointing at
/tmp will usually fail with something like:

$ virsh pool-start tmp
error: Failed to start pool tmp
error: cannot open volume '/tmp/systemd-private-c38cf0418d7a4734a66a8175996c384f-colord.service-kEyiTA': Permission denied

If any volume in an FS pool can't be opened by the daemon, the refresh
fails, and the pool can't be used.

This causes pain for virt-install/virt-manager though. Imaging a user
downloads a disk image to /tmp. virt-manager wants to import /tmp as
a storage pool, so we can detect what disk format it is, and set the
XML correctly. However this case will likely fail as explained above.

Change the logic here to skip volumes that fail to open. This could
conceivably cause user complaints along the lines of 'why doesn't
libvirt show $ROOT-OWNED-VOLUME-FOO', but figuring that currently
the pool won't even startup, I don't think there are any current
users that care about that case.

https://bugzilla.redhat.com/show_bug.cgi?id=1103308
(cherry picked from commit 56476f6a2d1564c040b749a385c3588a914921f0)
2015-04-28 09:48:36 -04:00
Cole Robinson
dc7cbdde6a domain: conf: Don't validate VM ostype/arch at daemon startup
When parsing XML, we validate the passed ostype + arch combo against
the detected hypervisor capabilities. This has led to the following
problem:

- Define x86 qemu guest
- qemu is inadvertently removed from the host
- libvirtd is restarted. fails to parse VM config since arch is removed
- 'virsh list --all' is now empty, user is wondering where their VMs went

Add a new internal flag VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS. Use
it when loading VM and snapshot configs from disk.

https://bugzilla.redhat.com/show_bug.cgi?id=1043572
(cherry picked from commit f1a89a8b6d1a1097e41a171a13b1984b06e8ab3e)
2015-04-27 20:23:35 -04:00
Cole Robinson
e8fb46f7e9 domain: conf: Better errors on bad os <type> values
If no <os><type> was specified:
  before: unknown OS type no OS type
  after : xml error: an os <type> must be specified

If an <os><type> is specified that's not in our capabiliities data:
  before: unknown OS type: $type
  after : unsupported configuration: no support found for os <type> '$type'

VIR_ERR_OS_TYPE is now unused (as it should be frankly) so drop its strings
as well to save our translators some effort.

(cherry picked from commit 3700c065cde30ff3f70cc3a029279c79c2337a54)
2015-04-27 20:23:29 -04:00
Cole Robinson
d430c9545f spec: Point fedora --with-loader-nvram at nightly firmware repo
Fedora doesn't ship OVMF/AAVMF builds in its repos due to licensing
issues, so the recommended way to consume these bits is via Gerd's
nightly repo: https://www.kraxel.org/repos

Let's teach fedora builds about the loader/nvram pairs these packages
installed, so users don't need to edit qemu.conf to get virt-manager
UEFI support.

(cherry picked from commit f93e1211297aeae0ca7ee2f0d9dd0a213f468702)
2015-04-27 20:23:02 -04:00
Cole Robinson
df0f243b0c configure: Report --with-loader-nvram value in summary
(cherry picked from commit ce452877cb27008f239cbc8a63a30150a6ebcc68)
2015-04-27 20:22:57 -04:00
Cole Robinson
931a6985a8 configure: Fix --loader-nvram typo
(cherry picked from commit 714668b506695b7902851912f58f1d8c20985e5a)
2015-04-27 20:22:54 -04:00
Jiri Denemark
22b46ad765 cpu: Add {Haswell,Broadwell}-noTSX CPU models
QEMU 2.3 adds these new models to cover Haswell and Broadwell CPUs with
updated microcode. Luckily, they also reverted former the machine type
specific changes to existing models. And since these changes were never
released, we don't need to hack around them in libvirt.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit c563b50605ae9895b981d198e11dbe9f6e18027b)
2015-04-27 20:14:49 -04:00
Michal Privoznik
6d79e8b3ac domcaps: Check for architecture more wisely
https://bugzilla.redhat.com/show_bug.cgi?id=1209948

So we have this bug. The virConnectGetDomainCapabilities() API
performs a couple of checks before it produces any result. One of
the checks is if the architecture requested by user can be run by
the binary (again user provided). However, the check is pretty
dumb. It merely compares if the default binary architecture
matches the one provided by user. However, a qemu binary can run
multiple architectures. For instance: qemu-system-ppc64 can run:
ppc, ppcle, ppc64, ppc64le and ppcemb. The default is ppc64, so
if user requested something else, like ppc64le, the check would
have failed without obvious reason.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 0af9325e6a06fd4478d4eebfcd92dfe7e2ec570c)
2015-04-27 19:57:36 -04:00
Peter Krempa
5a37b2a639 daemon: Clear fake domain def object that is used to check ACL prior to use
The fake object is used to pass the domain name and UUID to the ACL code
for events where we don't have the full domain def when dispatching
events. The rest of the entries would be left uninitialized. While this
is not a problem code-wise as the used fields are initialized it looks
ugly in the debugger.

(cherry picked from commit 6ca857c7c8a1f7b571132d6c7fff5a06301a5e9a)
2015-04-27 19:54:54 -04:00
Peter Krempa
5081142ed8 util: identity: Harden virIdentitySetCurrent()
Don't unref the old identity unless we set the new one correctly and
unref the new one on failure to set it so that we don't leak any
references or use invalid pointers.

(cherry picked from commit ad886fa6c8ebc321a0386a75c187d315111cf1f3)
2015-04-27 19:54:49 -04:00
Cole Robinson
dc7c0de587 qemu: Always refresh capabilities if no <guests> found
- Remove all qemu emulators
- Restart libvirtd
- Install qemu emulators
- Call 'virsh version' -> errors

The only thing that will force the qemu driver to refresh it's cached
capablities info is an explict API call to GetCapabilities.

However in the case when the initial caps lookup at driver connect didn't
find a single qemu emulator to poll, the driver is effectively useless
and really can't do anything until it's populated some qemu capabilities
info.

With the above steps, the user would have to either know about the
magic refresh capabilities call, or restart libvirtd to pick up the
changes.

Instead, this patch changes things so that every time a part of th
driver requests access to capabilities info, check to see if
we've previously seen any emulators. If not, force a refresh.

In the case of 'still no emulators found', this is still very quick, so
I can't think of a downside.

https://bugzilla.redhat.com/show_bug.cgi?id=1000116
(cherry picked from commit 95546c43de51a3d54f9a7f65059a6492a64d4f69)
(cherry picked from commit 9ebc1631b42aa2c4aad120d24f940771ec781852)
2015-04-27 19:45:50 -04:00
Cole Robinson
ab87fb1cbc qemu: Build nvram directory at driver startup
Similar to what was done for the channel socket in the previous commit.

(cherry picked from commit 19425d110b0ca2ea3588dbf880ce48d81edea89c)
2015-04-27 19:36:21 -04:00
Cole Robinson
9ed89d783b qemu: Build channel autosocket directory at driver startup
Rather than depend on the RPM to put it in place, since this doesn't
cover the qemu:///session case. Currently auto allocated socket path is
completely busted with qemu:///session

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

And because we chown the directory at driver startup now, this also fixes
autosocket startup failures when using user/group=root

https://bugzilla.redhat.com/show_bug.cgi?id=1044561
https://bugzilla.redhat.com/show_bug.cgi?id=1146886
(cherry picked from commit e31ab02fd049aa72bea9cfabde15b2dd17e37f98)
2015-04-27 19:36:21 -04:00
Michal Privoznik
c163111b58 virQEMUDriverGetConfig: Fix memleak
==19015== 968 (416 direct, 552 indirect) bytes in 1 blocks are definitely lost in loss record 999 of 1,049
==19015==    at 0x4C2C070: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==19015==    by 0x52ADF14: virAllocVar (viralloc.c:560)
==19015==    by 0x5302FD1: virObjectNew (virobject.c:193)
==19015==    by 0x1DD9401E: virQEMUDriverConfigNew (qemu_conf.c:164)
==19015==    by 0x1DDDF65D: qemuStateInitialize (qemu_driver.c:666)
==19015==    by 0x53E0823: virStateInitialize (libvirt.c:777)
==19015==    by 0x11E067: daemonRunStateInit (libvirtd.c:905)
==19015==    by 0x53201AD: virThreadHelper (virthread.c:206)
==19015==    by 0xA1EE1F2: start_thread (in /lib64/libpthread-2.19.so)
==19015==    by 0xA4EFC8C: clone (in /lib64/libc-2.19.so)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 225aa80246d5e4a9e3a16ebd4c482525045da3db)
2015-04-27 19:36:21 -04:00
Cole Robinson
be95a1f150 qemu: chown autoDumpPath on driver startup
Not sure if this is required, but it makes things consistent with the
rest of the directories.

(cherry picked from commit db3ccd582c94f8c5a046f2f9be92a1ad95bc4753)
2015-04-27 19:36:21 -04:00
Cole Robinson
0dea832ada qemu: conf: Clarify paths that are relative to libDir
Rather than duplicate libDir for each new path

(cherry picked from commit c19f43ae7e69103b9db59be1dcab6f8236fa1b24)
2015-04-27 19:36:21 -04:00