Commit Graph

25745 Commits

Author SHA1 Message Date
Peter Krempa
8af68ea478 qemu: hotplug: Reset device removal waiting code after vCPU unplug
If the delivery of the DEVICE_DELETED event for the vCPU being deleted
would time out, the code would not call 'qemuDomainResetDeviceRemoval'.

Since the waiting thread did not unregister itself prior to stopping the
waiting the monitor code would try to wake it up instead of dispatching
it to the event worker. As a result the unplug process would not be
completed and the definition would not be updated.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1428893
          https://bugzilla.redhat.com/show_bug.cgi?id=1427801
2017-03-10 08:18:20 +01:00
Peter Krempa
d59ca12048 qemu: hotplug: Add debug log when dispatching device removal to existing thread
Note that the waiting thread is signaled in the debug logs to simplify
debugging.
2017-03-10 08:18:20 +01:00
Pavel Hrdina
c27020dd4f Revert "conf: move iothread XML validation from qemu_command"
This reverts commit c96bd78e4e.

So our code is one big mess and we modify domain definition while
building qemu_command line and our hotplug code share only part
of the parsing and command line building code.  Let's revert
that change because to fix it properly would require refactor and
move a lot of things.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1430275
2017-03-09 17:36:58 +01:00
Roman Bogorodskiy
33ae335198 configure: disable scsi stroage driver on non-Linux
Even though scsi storage driver builds fine on non-Linux, it
will not work properly because it relies on Linux procfs, so
disable that in configure if we're not building for Linux.
2017-03-09 18:46:41 +04:00
Pavel Hrdina
cba1672de8 conf: properly skip graphics listen element in migratable XML
We should skip <listen type='socket'/> only if the 'socket' path
is specified because if there is no 'socket' path we need to
keep that element in migratable XML.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-03-09 10:22:43 +01:00
Pavel Hrdina
cd4a8b9304 conf: store "autoGenerated" for graphics listen in status XML
When libvirtd is started we call qemuDomainRecheckInternalPaths
to detect whether a domain has VNC socket path generated by libvirt
based on option from qemu.conf.  However if we are parsing status XML
for running domain the existing socket path can be generated also if
the config XML uses the new <listen type='socket'/> element without
specifying any socket.

The current code doesn't make difference how the socket was generated
and always marks it as "fromConfig".  We need to store the
"autoGenerated" value in the status XML in order to preserve that
information.

The difference between "fromConfig" and "autoGenerated" is important
for migration, because if the socket is based on "fromConfig" we don't
print it into the migratable XML and we assume that user has properly
configured qemu.conf on both hosts.  However if the socket is based
on "autoGenerated" it means that a new feature was used and therefore
we need to leave the socket in migratable XML to make sure that if
this feature is not supported on destination the migration will fail.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-03-09 10:22:43 +01:00
John Ferlan
b2e5de96c7 qemu: Rename variable
Rename 'secretUsageType' to 'usageType' since it's superfluous in an
API qemu*Secret*
2017-03-08 14:37:05 -05:00
John Ferlan
52c846afbe qemu: Introduce qemuDomainGetTLSObjects
Split apart and rename qemuDomainGetChardevTLSObjects in order to make a
more generic API that can create the TLS JSON prop objects (secret and
tls-creds-x509) to be used to create the objects

Signed-off-by: John Ferlan <jferlan@redhat.com>
2017-03-08 14:31:10 -05:00
John Ferlan
684b2170b0 qemu: Move qemuDomainPrepareChardevSourceTLS call
Move the call to inside the qemuDomainAddChardevTLSObjects in order to
further converge the code.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2017-03-08 14:31:10 -05:00
John Ferlan
26bef302c6 qemu: Move qemuDomainSecretChardevPrepare call
Move the call to inside the qemuDomainAddChardevTLSObjects in order to
further converge the code.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2017-03-08 14:31:10 -05:00
John Ferlan
479b045b54 qemu: Refactor qemuDomainGetChardevTLSObjects to converge code
Create a qemuDomainAddChardevTLSObjects which will encapsulate the
qemuDomainGetChardevTLSObjects and qemuDomainAddTLSObjects so that
the callers don't need to worry about the props.

Move the dev->type and haveTLS checks in to the Add function to avoid
an unnecessary call to qemuDomainAddTLSObjects

Signed-off-by: John Ferlan <jferlan@redhat.com>
2017-03-08 14:31:10 -05:00
John Ferlan
ee4f382a9c qemu: Refactor hotplug to introduce qemuDomain{Add|Del}TLSObjects
Refactor the TLS object adding code to make two separate API's that will
handle the add/remove of the "secret" and "tls-creds-x509" objects including
the Enter/Exit monitor commands.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2017-03-08 14:31:10 -05:00
John Ferlan
e49af42c22 qemu: Move exit monitor calls in failure paths
Since qemuDomainObjExitMonitor can also generate error messages,
let's move it inside any error message saving code on error paths
for various hotplug add activities.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2017-03-08 14:31:10 -05:00
John Ferlan
7c2b7891cc qemu: Introduce qemuDomainSecretInfoTLSNew
Building upon the qemuDomainSecretInfoNew, create a helper which will
build the secret used for TLS.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2017-03-08 14:31:09 -05:00
John Ferlan
c9a7b7b6ea qemu: Introduce qemuDomainSecretInfoNew
Create a helper which will create the secinfo used for disks, hostdevs,
and chardevs.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2017-03-08 14:31:07 -05:00
Cole Robinson
0de1066fb9 tests: Add storagevol tests for format=iso
Demonstrates the bug fix in commit 0e5db76262
2017-03-08 13:22:33 -05:00
Philipp Hahn
d7dcea6f60 doc: fix writing of QEMU
QEMU should be written all upper or all lower case.
2017-03-08 17:33:07 +01:00
Philipp Hahn
6f5687498f doc: Correct the default werror policy
It's only implemented by QEMU and its default is
VIR_DOMAIN_DISK_ERROR_POLICY_ENOSPACE anyway.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2017-03-08 17:33:05 +01:00
Pavel Hrdina
bb0bffb16c qemu_process: don't probe iothreads if it's not supported by QEMU
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1430258

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-03-08 12:09:54 +01:00
Michal Privoznik
16efa11aa6 qemuTestDriverInit: Don't access live data
Some of our tests (e.g. qemuhotplugtest) call
virDomainSaveConfig(). Now the problem is, qemuTestDriverInit()
creates a fake qemu driver and fills it with some fake
configuration. At least so we hoped. The truth is, it calls
regular virQEMUDriverConfigNew() and then fix couple of paths.
Literally. Therefore our tests see regular stateDir and configDir
for the user that is running the tests. Directories, where live
domain XMLs are stored. Let's just hope our test suite hasn't
mangled any of them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-03-08 10:15:16 +01:00
Michal Privoznik
b3388de7f2 qemuDomainSaveImageUpdateDef: Don't overwrite errors from virDomainDefCheckABIStability
https://bugzilla.redhat.com/show_bug.cgi?id=1379200

When we are restoring a domain from a saved image, or just
updating its XML in the saved image - we have to make sure that
the ABI guests sees will not change. We have a function for that
which reports errors. But for some reason if this function fails,
we call it again with slightly different argument. Therefore it
might happen that we overwrite the original error and leave user
with less helpful one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-03-08 10:09:15 +01:00
Nitesh Konkar
9d60ea31dd news: Update the news.xml about perf events added
Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2017-03-07 13:51:05 -05:00
Nitesh Konkar
0265bbeee3 perf: add emulation_faults software perf event support
This patch adds support and documentation
for the emulation_faults perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2017-03-07 13:51:05 -05:00
Nitesh Konkar
6780791f18 perf: add alignment_faults software perf event support
This patch adds support and documentation
for the alignment_faults perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2017-03-07 13:51:05 -05:00
Nitesh Konkar
43a54cedf6 perf: add page_faults_maj software perf event support
This patch adds support and documentation
for the page_faults_maj perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2017-03-07 13:51:05 -05:00
Nitesh Konkar
d216e9ad77 perf: add page_faults_min software perf event support
This patch adds support and documentation
for the page_faults_min perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2017-03-07 13:51:04 -05:00
Nitesh Konkar
8110c6a567 perf: add cpu_migrations software perf event support
This patch adds support and documentation
for the cpu_migrations perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2017-03-07 13:51:04 -05:00
Nitesh Konkar
99cc3dc6a2 perf: add context_switches software perf event support
This patch adds support and documentation
for the context_switches perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2017-03-07 13:51:04 -05:00
Nitesh Konkar
6ef2c7e00f perf: add page_faults software perf event support
This patch adds support and documentation
for the page_faults perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2017-03-07 13:51:04 -05:00
Nitesh Konkar
20dc690865 perf: add task_clock software perf event support
This patch adds support and documentation for
the task_clock perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2017-03-07 13:51:04 -05:00
Nitesh Konkar
f372a862ac perf: add cpu_clock software perf event support
This patch adds support and documentation for
the cpu_clock perf event.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
2017-03-07 13:51:04 -05:00
John Ferlan
62bc956786 conf: Use consistent function name prefixes for virnwfilterobj
Use "virNWFilterObj" as a prefix for any external API in virnwfilterobj
2017-03-07 13:27:25 -05:00
John Ferlan
44242cce02 conf: Alter coding style of nwfilter function prototypes
In an effort to be consistent with the source module, alter the function
prototypes to follow the similar style of source with the "type" on one
line followed by the function name and arguments on subsequent lines with
with argument getting it's own line.
2017-03-07 13:27:25 -05:00
John Ferlan
d82aee6add conf: Adjust coding style for nwfilter conf sources
Alter the format of the code to follow more recent style guidelines of
two empty lines between functions, function decls with "[static] type"
on one line followed by function name with arguments to functions each
on one line.
2017-03-07 13:27:25 -05:00
John Ferlan
079747a36d conf: Introduce virnwfilterobj
Move all the NWFilterObj API's into their own module virnwfilterobj
from the nwfilter_conf

Purely code motion at this point, plus adjustments to cleanly build.
2017-03-07 13:27:25 -05:00
John Ferlan
cab7b8c276 conf: Change virNWFilterObjDeleteDef to virNWFilterDeleteDef
Rather than pass the nwfilter object, just pass the def to the function
2017-03-07 13:27:25 -05:00
John Ferlan
22426736b9 conf: Change virNWFilterObjSaveDef to virNWFilterSaveDef
There's no need to pass the driver pointer to nwfilter_conf, just
pass the configDir.
2017-03-07 13:27:24 -05:00
John Ferlan
15b881474b util: Avoid possible NULL dereference in virSysinfoParsePPCProcessor
Found by Coverity. Because there's an "if ((cur = strstr(base, "revision"))
 != NULL) {" followed by a "base = cur" coverity notes that 'base' could
then be NULL causing the return to the top of the "while ((tmp_base =
strstr(base, "processor")) != NULL) {" to have strstr deref a NULL 'base'
pointer because the setting of base at the bottom of the loop is unconditional.

Alter the code to set "base = cur" after processing each key. That will
"ensure" that base doesn't get set to NULL if both "cpu" and "revision"
do no follow a "processor".

While a /proc/cpuinfo file that has a "processor" key but with neither
a "cpu" nor a "revision" doesn't seem feasible, the code is written as if
it could happen, so we have to account for it.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2017-03-07 13:25:03 -05:00
John Ferlan
7744d99415 util: Resource some resource leaks in virsysinfo code
Calls to virFileReadAll after a VIR_ALLOC that return NULL all show
a memory leak since 'ret' isn't virSysinfoDefFree'd and normal path
"return ret" doesn't free outbuf.

Reported by Coverity

Signed-off-by: John Ferlan <jferlan@redhat.com>
2017-03-07 13:25:03 -05:00
Cole Robinson
ee42957bb1 libvirt: document UNDEFINE_KEEP_NVRAM in UndefineFlags docs 2017-03-07 10:58:25 -05:00
Cole Robinson
0e5db76262 storage: Don't pass 'iso' format to qemu-img
$ virsh vol-clone /tmp/test.iso new.iso
error: Failed to clone vol from test.iso
error: internal error: Child process (/bin/qemu-img convert -f iso -O iso /tmp/test.iso /tmp/new.iso) unexpected exit status 1: qemu-img: Could not open '/tmp/test.iso': Unknown driver 'iso'

Map iso->raw before sending the format value to qemu-img

https://bugzilla.redhat.com/show_bug.cgi?id=972784
https://bugzilla.redhat.com/show_bug.cgi?id=1419395
2017-03-07 10:58:25 -05:00
Pavel Hrdina
3ffea19acd qemu_domain: cleanup the controller post parse code
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-03-07 16:50:35 +01:00
Pavel Hrdina
57404ff7a7 qemu_domain: move controller post parse code into its own function
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-03-07 16:50:34 +01:00
Peter Krempa
5a54f52520 tests: sysinfo: Add test data for HP moonshot aarch64 box
Since the kernel does not report much data for that box the sysinfo
output is comparatively sparse.
2017-03-07 10:44:26 +01:00
Peter Krempa
2847cb5d9c tests: sysinfo: Run all sysinfo tests all the time
There's no reason why we should avoid running all sysinfo tests on all
platforms. Refactor the test to get rid of the conditionally compiled
cruft.
2017-03-07 10:44:26 +01:00
Peter Krempa
c58d95b7a0 tests: sysinfo: Export virSysinfoSetup via the private header
virSysinfoSetup should be used only in tests so it can be moved to the
new header file rather than using an extern declaration.
2017-03-07 10:44:26 +01:00
Peter Krempa
b38c6b6ad3 util: sysinfo: Reduce amount of conditionally compiled code
Whole implementations along with helper totalling screens of code were
conditionally compiled. That made the code totally unreadable and
untestable. Rename functions to have the architecture in the name so
that all can be compiled at the same time and introduce header to allow
testing them all.
2017-03-07 10:44:26 +01:00
Pavel Hrdina
2149d405a0 qemu_capabilities: report SATA bus in domain capabilities
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-03-07 09:11:03 +01:00
Laine Stump
3898526931 make all struct typedefs comply with proposed coding conventions
Proposed formal coding conventions encourage defining typedefs for
vir[Blah] and vir[Blah]Ptr separately from the associated struct named
_vir[Blah]:

    typedef struct _virBlah virBlah;
    typedef virBlah *virBlahPtr;
    struct _virBlah {
    ...
    };

At some point in the past, I had submitted several patches using a
more compact style that I prefer, and they were accepted:

    typedef struct _virBlah {
        ...
    } virBlah, *virBlahPtr;

Since these are by far a minority among all struct definitions, this
patch changes all those definitions to reflect the style prefered by
the proposal so that there is 100% consistency.
2017-03-06 13:00:45 -05:00
Daniel P. Berrange
ae6da06144 Add virsystemdpriv.h to UTIL_SOURCES
Ensure virsystemdpriv.h gets included in dist tarballs.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-03-06 17:30:37 +00:00