Commit Graph

23366 Commits

Author SHA1 Message Date
Ján Tomko
b914530d62 Do not save errno in virUSBDeviceSearch
The virUSBDeviceFind* callers do not check errno after calling
this function.
2016-06-23 21:37:32 +02:00
Peter Krempa
cb049b9ad4 tests: utils: Fail XML file comparison if input file doesn't exist
In cases where we expect parse failure of the test input file the
testsuite can't differentiate if the parser failed when parsing or when
opening the file. Add a call to virFileExists and error out on missing
input files.

Missing output files are partially expected when regenerating test
output.
2016-06-23 21:11:32 +02:00
Peter Krempa
dabf1c5b12 tests: genericxml2xml: Fix test file name
Commit b1fc6a7b added a test file but used a different name in the
actual test.
2016-06-23 21:11:32 +02:00
John Ferlan
dc428f450a qemu: Add new secret info type
Add 'encinfo' to the extended disk structure. This will contain the
encryption secret (if present).

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-23 12:30:28 -04:00
John Ferlan
42510c5199 util: Introduce virSecretLookupFormatSecret
Add utility to format the virSecretLookupTypeDefPtr in XML

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-23 12:30:28 -04:00
John Ferlan
ecd45ced0e util: Move and rename virStorageAuthDefParseSecret
Move to virsecret.c and rename to virSecretLookupParseSecret. Also convert
to usage xmlNodePtr and virXMLPropString rather than virXPathString.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-23 12:30:28 -04:00
John Ferlan
1eca5f6581 secret: Move virStorageSecretType and rename
Move the enum into a new src/util/virsecret.h, rename it to be
virSecretLookupType. Add a src/util/virsecret.h in order to perform
a couple of simple operations on the secret XML and virSecretLookupTypeDef
for clearing and copying.

This includes quite a bit of collateral damage, but the goal is to remove
the "virStorage*" and replace with the virSecretLookupType so that it's
easier to to add new lookups that aren't necessarily storage pool related.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-23 12:30:27 -04:00
Cole Robinson
e808d3f227 storage: Remove redundant refreshPool check
Every driver provides a refreshPool impl, and many other critical
places in the code unconditionally call it without checking if
it exists, so this check is pointless
2016-06-23 09:29:54 -04:00
Cole Robinson
7490fdec92 qemu: command: Error on accel2d
qemu doesn't have any accel2d support wired up. Explicitly error
if a user tries it out, or typos the accel3d option
2016-06-23 09:29:18 -04:00
Cole Robinson
9a4703a3f0 qemu: command: Error on accel3d with non-virtio
We should be raising an error if accel3d is present for any
non-virtio video as well, incase someone tries it for say 'qxl'
2016-06-23 09:29:18 -04:00
Nikolay Shirokovskiy
6606ea96a1 qemu: make monitor command API available during async jobs
One can not issue monitor commands manually during async calls thru
designated API while this could be useful for testing/debugging purposes.
qemuDomainQemuMonitorCommand uses job of type QEMU_JOB_MODIFY and any async
call disable parallel execution of this type of job. The only state that is
changed is taint variable. AFAIU the only place we can mess is resetting
taint flag in qemuProcessStop routine under some async job. But this can not
happen thanx to both virDomainObjIsActive check in qemuDomainQemuMonitorCommand
and resetting active status in qemuProcessStop before taint flag.

  Change job type to QEMU_JOB_QUERY and thus make the API call available for
most of async jobs.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-23 15:18:31 +02:00
Ján Tomko
43d2b6f2aa prohibit-duplicate-header: print file name and line
This way :make syntax-check in ViM will point you at the offending line.
2016-06-23 12:48:40 +02:00
Ján Tomko
a9179d78bf syntax-check: rewrite prohibit-duplicate-header in perl
Invoke the script only once instead of once for every file.
2016-06-23 12:48:40 +02:00
Peter Krempa
dfeb19ff60 Allow virDomain(SG)etGuestVcpus on read-write connection only
Guest agent interaction is considered privileged.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1349272
2016-06-23 09:41:52 +02:00
Ján Tomko
21b56a6055 Do not ignore perl scripts in build-aux
Also remove the duplicate build-aux entry from .gitignore.
2016-06-23 09:38:13 +02:00
Ján Tomko
8b04ce598d Add newDomain parameter to qemuDomainAssignAddresses
Pass 'true' if we are not dealing with a migration.
2016-06-23 07:45:31 +02:00
Ján Tomko
b3ee621e94 Add a USB hub to controller order test
The test has too many USB devices.
2016-06-23 07:45:31 +02:00
Cole Robinson
03ce132808 conf: Remove dead console compat formatting
This code was attempting to handle some implicit <console> XML
formatting for manually assembled DomainDef, since previously the
console<->serial compat copying was only done at XML parse time.

Nowadays it's done via virDomainDefPostParse ->
virDomainDefAddConsoleCompat, which all manual DomainDef builders
already call, so we can drop this workaround.
2016-06-22 20:14:31 -04:00
Jim Fehlig
76d5871648 libxl: use serial device for console when targetType is serial
When domXML contains only <console type='pty'> and no corresponding
<serial>, the console is "stolen" [1] and used as the first <serial>
device. When this "stolen" console is accessed from the libxl driver
(in libxlConsoleCallback and libxlDomainOpenConsole), check if the
targetType is VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL, and use the
"stolen" device in def->serials[0] instead. Prior to this change,
creating a domain with input XML containing only a <console> device
and subsequently attempting to access its console with
'virsh console' would fail

error: internal error: character device <null> is not using a PTY

[1] See comments associated with virDomainDefAddConsoleCompat() in
    $LIBVIRT-SRC/src/conf/domain_conf.c:
2016-06-22 15:06:27 -06:00
Ján Tomko
a921699ad9 Use for instead of code duplication when parsing USB port
We are done if the string ends and move to another nesting
level if we find a dot.
2016-06-22 21:33:57 +02:00
Ján Tomko
0956d9b2a3 Split out USB port parsing
Make rewriting it easier.
2016-06-22 21:33:57 +02:00
Ján Tomko
e9843279cc Add a test for long USB port paths
We support up to four levels of nested USB devices in the guest.

Add a test for a domain using all four and a negative test for a domain
using five.
2016-06-22 21:33:57 +02:00
Jiri Denemark
d85c3a5451 Report auto convergence throttle rate in migration stats
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
445853e1ba qemu: Implement auto convergence migration parameters
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
abaa11006f qemu: Add support for cpu throttling parameters
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
8d58952bed qemu: Introduce qemuMigrationSetParams
Several places in the code update qemuMonitorMigrationParams structure
and qemuMigrationSetParams is then used to set them all at once.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
f6e12b4029 Add auto convergence migration parameters
They can be used to tune auto-convergence algorithm (which is enabled
with VIR_MIGRATE_AUTO_CONVERGE).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
15f42cba7e test: Rework qemuMonitorJSONGetMigrationParams test
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
bd3da51697 qemu: Rework qemuMonitorJSONSetMigrationParams
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
eb3e018414 qemu: Rework qemuMonitorJSONGetMigrationParams
We should not require any parameters to be present. After all we have
the *_set bools to express that some parameters were not set.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
b1473708d8 qemu: Rename qemuMonitorMigrationCompression
qemuMonitorMigrationParams is a better name for a structure which
contains various migration parameters. While doing that, we should use
full names for individual parameters.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
dbcbc86648 qemu: Decouple migration parameters from compression settings
Compression parameters are not the only migration parameters.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
5a235947c2 qemu: Make qemuMonitorSetMigrationCompression saner
Checking whether the function has anything to do is better done in the
function rather then requiring callers to do that.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 15:54:21 +02:00
Jiri Denemark
0966f0d7e0 conf: Simplify conditions in CPU parser/formatter
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 12:16:19 +02:00
Jiri Denemark
423015137a qemucapsprobe: Don't put empty line at EOF
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 10:45:28 +02:00
Jiri Denemark
70a576899a conf: Remove redundant free in virCPUDefFree
vendor_id is (and always was) already freed in virCPUDefFreeModel.

This effectively reverts commit fb49ffc3.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 10:38:52 +02:00
Jiri Denemark
0b224cce8b qemu: Fix reference leak in qemuDomainDefPostParse
The function gets a reference on virQEMUDriverConfig which needs to be
released before returning.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 10:29:15 +02:00
Jiri Denemark
cf32a69ae1 qemu: Hide virQEMUCapsNewForBinary
Since virQEMUCapsNewForBinaryInternal was introduced,
virQEMUCapsNewForBinary is no longer used outside qemu_capabilities.c.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-22 10:25:53 +02:00
Peter Krempa
66acbe603b qemu: Implement virDomainSetGuestVcpus
Allow modification of specific vCPU states via the guest agent.
2016-06-22 09:26:08 +02:00
Peter Krempa
a24edc48c3 qemu: Implement virDomainGetGuestVcpus
Allow gathering available vcpu ids, their state and offlinability via
the qemu guest agent. The maximum id was chosen arbitrarily and ought
to be enough for everybody.
2016-06-22 09:26:08 +02:00
Peter Krempa
b1aa91e140 qemu: agent: Make setting of vcpus more robust
Documentation for the "guest-set-vcpus" command describes a proper
algorithm how to set vcpus. This patch makes the following changes:

- state of cpus that has not changed is not updated
- if the command was partially successful the command is re-tried with
  the rest of the arguments to get a proper error message
- code is more robust against malicious guest agent
- fix testsuite to the new semantics
2016-06-22 09:26:08 +02:00
Peter Krempa
69e0cd3397 virsh: Add command 'guestvcpus' implementing virDomain(GS)etGuestVcpus
Add a straightforward implementation for using the new APIs.
2016-06-22 09:26:08 +02:00
Peter Krempa
3ebf7ca07e lib: Add API to set individual vcpu usage in the guest via guest agent
To allow finer-grained control of vcpu state using guest agent this API
can be used to individually set the state of the vCPU.

This will allow to better control NUMA enabled guests and/or test
various vCPU configurations.
2016-06-22 09:25:47 +02:00
Peter Krempa
800244faf3 lib: Add API to query guest vcpu info using guest agent
Add a rather universal API implemented via typed params that will allow
to query the guest agent for the state and possibly other aspects of
guest vcpus.
2016-06-22 08:16:31 +02:00
Peter Krempa
830f9b624d rpcgen: Add support for generating funcs returning alloc'd typed params
Since it's rather tedious to write the dispatchers for functions that
return an array of typed parameters (which are rather common) let's add
some rpcgen code to generate them.
2016-06-22 08:15:45 +02:00
John Ferlan
f06e45d578 tests: Adjust tests for encrypted storage
Make them work again...  The xml2xml had been working, but the xml2argv
were not working. Making the xml2argv work required a few adjustments to
the xml to update to more recent times.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-21 14:31:19 -04:00
John Ferlan
35f6abef6b storage: Use virSecretGetSecretString
Rather than inline code secret lookup for rbd/iscsi, use the common function.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-21 14:31:19 -04:00
John Ferlan
7df631b66a storage: Create helper to set options for CreateQemuImg code
Create a helper virStorageBackendCreateQemuImgSetOptions to set either
the qemu-img -o options or the previous mechanism using -F

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-21 14:31:19 -04:00
John Ferlan
d12a64f310 storage: Create helper to set backing for CreateQemuImg code
Create a helper virStorageBackendCreateQemuImgSetBacking to perform the
backing store set

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-21 14:31:19 -04:00
John Ferlan
f6a92f8e20 storage: Adjust qemu-img switches check
Since we support QEMU 0.12 and later, checking for support of specific flags
added prior to that isn't necessary.

Thus start with the base of having the "-o options" available for the
qemu-img create option and then determine whether we have the compat
option for qcow2 files (which would be necessary up through qemu 2.0
where the default changes to compat 0.11).

Adjust test to no long check for NONE and FLAG options as well was removing
results of tests that would use that option.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-21 14:31:19 -04:00