]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agoqemu: command: Error on accel2d
Cole Robinson [Fri, 20 May 2016 00:02:08 +0000 (20:02 -0400)]
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

8 years agoqemu: command: Error on accel3d with non-virtio
Cole Robinson [Thu, 19 May 2016 23:58:05 +0000 (19:58 -0400)]
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'

8 years agoqemu: make monitor command API available during async jobs
Nikolay Shirokovskiy [Wed, 22 Jun 2016 13:17:50 +0000 (16:17 +0300)]
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>
8 years agoprohibit-duplicate-header: print file name and line
Ján Tomko [Wed, 22 Jun 2016 20:27:43 +0000 (22:27 +0200)]
prohibit-duplicate-header: print file name and line

This way :make syntax-check in ViM will point you at the offending line.

8 years agosyntax-check: rewrite prohibit-duplicate-header in perl
Ján Tomko [Wed, 15 Jun 2016 16:01:24 +0000 (18:01 +0200)]
syntax-check: rewrite prohibit-duplicate-header in perl

Invoke the script only once instead of once for every file.

8 years agoAllow virDomain(SG)etGuestVcpus on read-write connection only
Peter Krempa [Thu, 23 Jun 2016 07:02:29 +0000 (09:02 +0200)]
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

8 years agoDo not ignore perl scripts in build-aux
Ján Tomko [Fri, 17 Jun 2016 17:31:42 +0000 (19:31 +0200)]
Do not ignore perl scripts in build-aux

Also remove the duplicate build-aux entry from .gitignore.

8 years agoAdd newDomain parameter to qemuDomainAssignAddresses
Ján Tomko [Thu, 16 Jun 2016 15:15:53 +0000 (17:15 +0200)]
Add newDomain parameter to qemuDomainAssignAddresses

Pass 'true' if we are not dealing with a migration.

8 years agoAdd a USB hub to controller order test
Ján Tomko [Fri, 17 Jun 2016 14:50:36 +0000 (16:50 +0200)]
Add a USB hub to controller order test

The test has too many USB devices.

8 years agoconf: Remove dead console compat formatting
Cole Robinson [Wed, 22 Jun 2016 18:07:03 +0000 (14:07 -0400)]
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.

8 years agolibxl: use serial device for console when targetType is serial
Jim Fehlig [Wed, 22 Jun 2016 02:25:23 +0000 (20:25 -0600)]
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:

8 years agoUse for instead of code duplication when parsing USB port
Ján Tomko [Thu, 16 Jun 2016 13:23:23 +0000 (15:23 +0200)]
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.

8 years agoSplit out USB port parsing
Ján Tomko [Thu, 16 Jun 2016 13:00:27 +0000 (15:00 +0200)]
Split out USB port parsing

Make rewriting it easier.

8 years agoAdd a test for long USB port paths
Ján Tomko [Wed, 20 Apr 2016 13:03:57 +0000 (15:03 +0200)]
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.

8 years agoReport auto convergence throttle rate in migration stats
Jiri Denemark [Tue, 21 Jun 2016 11:40:33 +0000 (13:40 +0200)]
Report auto convergence throttle rate in migration stats

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Implement auto convergence migration parameters
Jiri Denemark [Tue, 21 Jun 2016 08:06:29 +0000 (10:06 +0200)]
qemu: Implement auto convergence migration parameters

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Add support for cpu throttling parameters
Jiri Denemark [Mon, 20 Jun 2016 15:10:32 +0000 (17:10 +0200)]
qemu: Add support for cpu throttling parameters

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Introduce qemuMigrationSetParams
Jiri Denemark [Mon, 20 Jun 2016 14:27:07 +0000 (16:27 +0200)]
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>
8 years agoAdd auto convergence migration parameters
Jiri Denemark [Mon, 20 Jun 2016 13:45:59 +0000 (15:45 +0200)]
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>
8 years agotest: Rework qemuMonitorJSONGetMigrationParams test
Jiri Denemark [Mon, 20 Jun 2016 15:07:55 +0000 (17:07 +0200)]
test: Rework qemuMonitorJSONGetMigrationParams test

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Rework qemuMonitorJSONSetMigrationParams
Jiri Denemark [Mon, 20 Jun 2016 14:55:07 +0000 (16:55 +0200)]
qemu: Rework qemuMonitorJSONSetMigrationParams

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Rework qemuMonitorJSONGetMigrationParams
Jiri Denemark [Mon, 20 Jun 2016 14:54:24 +0000 (16:54 +0200)]
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>
8 years agoqemu: Rename qemuMonitorMigrationCompression
Jiri Denemark [Mon, 20 Jun 2016 13:47:46 +0000 (15:47 +0200)]
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>
8 years agoqemu: Decouple migration parameters from compression settings
Jiri Denemark [Mon, 20 Jun 2016 13:47:28 +0000 (15:47 +0200)]
qemu: Decouple migration parameters from compression settings

Compression parameters are not the only migration parameters.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Make qemuMonitorSetMigrationCompression saner
Jiri Denemark [Mon, 20 Jun 2016 13:51:13 +0000 (15:51 +0200)]
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>
8 years agoconf: Simplify conditions in CPU parser/formatter
Jiri Denemark [Mon, 22 Jun 2015 08:27:05 +0000 (10:27 +0200)]
conf: Simplify conditions in CPU parser/formatter

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemucapsprobe: Don't put empty line at EOF
Jiri Denemark [Fri, 10 Jun 2016 15:15:25 +0000 (17:15 +0200)]
qemucapsprobe: Don't put empty line at EOF

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoconf: Remove redundant free in virCPUDefFree
Jiri Denemark [Fri, 17 Jun 2016 07:40:32 +0000 (09:40 +0200)]
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>
8 years agoqemu: Fix reference leak in qemuDomainDefPostParse
Jiri Denemark [Wed, 15 Jun 2016 10:47:07 +0000 (12:47 +0200)]
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>
8 years agoqemu: Hide virQEMUCapsNewForBinary
Jiri Denemark [Wed, 15 Jun 2016 07:23:27 +0000 (09:23 +0200)]
qemu: Hide virQEMUCapsNewForBinary

Since virQEMUCapsNewForBinaryInternal was introduced,
virQEMUCapsNewForBinary is no longer used outside qemu_capabilities.c.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Implement virDomainSetGuestVcpus
Peter Krempa [Mon, 20 Jun 2016 10:26:26 +0000 (12:26 +0200)]
qemu: Implement virDomainSetGuestVcpus

Allow modification of specific vCPU states via the guest agent.

8 years agoqemu: Implement virDomainGetGuestVcpus
Peter Krempa [Mon, 20 Jun 2016 08:56:36 +0000 (10:56 +0200)]
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.

8 years agoqemu: agent: Make setting of vcpus more robust
Peter Krempa [Mon, 20 Jun 2016 12:15:50 +0000 (14:15 +0200)]
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

8 years agovirsh: Add command 'guestvcpus' implementing virDomain(GS)etGuestVcpus
Peter Krempa [Mon, 20 Jun 2016 07:57:53 +0000 (09:57 +0200)]
virsh: Add command 'guestvcpus' implementing virDomain(GS)etGuestVcpus

Add a straightforward implementation for using the new APIs.

8 years agolib: Add API to set individual vcpu usage in the guest via guest agent
Peter Krempa [Mon, 20 Jun 2016 07:16:47 +0000 (09:16 +0200)]
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.

8 years agolib: Add API to query guest vcpu info using guest agent
Peter Krempa [Thu, 16 Jun 2016 17:15:45 +0000 (19:15 +0200)]
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.

8 years agorpcgen: Add support for generating funcs returning alloc'd typed params
Peter Krempa [Sun, 19 Jun 2016 19:30:59 +0000 (21:30 +0200)]
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.

8 years agotests: Adjust tests for encrypted storage
John Ferlan [Mon, 6 Jun 2016 12:57:38 +0000 (08:57 -0400)]
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>
8 years agostorage: Use virSecretGetSecretString
John Ferlan [Sat, 28 May 2016 12:15:23 +0000 (08:15 -0400)]
storage: Use virSecretGetSecretString

Rather than inline code secret lookup for rbd/iscsi, use the common function.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agostorage: Create helper to set options for CreateQemuImg code
John Ferlan [Thu, 2 Jun 2016 12:05:08 +0000 (08:05 -0400)]
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>
8 years agostorage: Create helper to set backing for CreateQemuImg code
John Ferlan [Thu, 2 Jun 2016 11:24:49 +0000 (07:24 -0400)]
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>
8 years agostorage: Adjust qemu-img switches check
John Ferlan [Tue, 31 May 2016 14:53:18 +0000 (10:53 -0400)]
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>
8 years agoDo not call postParse with ABI_UPDATE when parsing cmdline
Ján Tomko [Thu, 16 Jun 2016 16:25:33 +0000 (18:25 +0200)]
Do not call postParse with ABI_UPDATE when parsing cmdline

So far this is only useful for recalculating NUMA memory size,
which this function cannot parse.

This will let us generate USB addresses based on this flag.

8 years agoFix USB port in input-usbmouse test
Ján Tomko [Wed, 20 Apr 2016 12:25:47 +0000 (14:25 +0200)]
Fix USB port in input-usbmouse test

The default USB controller only has two ports.

8 years agotest-wrap-argv: add --check parameter
Ján Tomko [Wed, 15 Jun 2016 12:18:17 +0000 (14:18 +0200)]
test-wrap-argv: add --check parameter

This script can already operate on a list of files.
Add a --check parameter to check if multiple files are wrapped
correctly with a single invocation of the script.

8 years agotest-wrap-argv: add --in-place parameter
Ján Tomko [Tue, 31 May 2016 08:19:04 +0000 (10:19 +0200)]
test-wrap-argv: add --in-place parameter

If --in-place is supplied as the first argument to the script,
replace the file in-place instead of printing to stdout.

8 years agotest-wrap-argv: hold a copy of the original file in an array
Ján Tomko [Wed, 15 Jun 2016 11:04:52 +0000 (13:04 +0200)]
test-wrap-argv: hold a copy of the original file in an array

This will be useful to check if the file is wrapped already.

8 years agotest-wrap-argv: return a string in rewrap_line
Ján Tomko [Mon, 30 May 2016 17:04:32 +0000 (19:04 +0200)]
test-wrap-argv: return a string in rewrap_line

Leave the printing up to &rewrap.

8 years agotest-wrap-argv: use map and join instead of a for cycle
Ján Tomko [Mon, 30 May 2016 16:59:42 +0000 (18:59 +0200)]
test-wrap-argv: use map and join instead of a for cycle

We have a list of parameters in @args, that need to be rewrapped
and separated by a space and escaped newline: " \\\n", with the
exception of the last one, which only needs a newline.

Instead of a for cycle, rewrap the individual arguments using map,
and interleave them with escaped newlines by using join.

8 years agotest-wrap-argv: return a string in rewrap_arg
Ján Tomko [Mon, 30 May 2016 15:58:27 +0000 (17:58 +0200)]
test-wrap-argv: return a string in rewrap_arg

Do not print anything, let the caller take care of it.

8 years agotest-wrap-argv: split out rewrap_arg
Ján Tomko [Mon, 30 May 2016 15:44:58 +0000 (17:44 +0200)]
test-wrap-argv: split out rewrap_arg

Split out the code wrapping the single argument.

8 years agotest-wrap-argv: split out rewrap_line
Ján Tomko [Mon, 30 May 2016 15:20:23 +0000 (17:20 +0200)]
test-wrap-argv: split out rewrap_line

Shorten the rewrap subroutine by splitting out the code
dealing with a single line.

Also remove $file from the warning.

8 years agovsh: remove namespace poisoning
Ján Tomko [Mon, 20 Jun 2016 15:11:39 +0000 (17:11 +0200)]
vsh: remove namespace poisoning

We already have a syntax-check to prohibit direct use of these
allocation functions.

8 years agovbox: remove duplicate macros
Ján Tomko [Mon, 20 Jun 2016 14:55:59 +0000 (16:55 +0200)]
vbox: remove duplicate macros

There is a definiton of VIR_FROM_THIS just two lines above.

The rest is defined in vbox_common.h.

8 years agoRemove unused SOL_NETLINK macro
Ján Tomko [Mon, 20 Jun 2016 14:54:34 +0000 (16:54 +0200)]
Remove unused SOL_NETLINK macro

Introduced by commit d575679, unused at the time.

8 years agoconf: limit chassisNr, and busNr to a minimum value of 1, not 0
Laine Stump [Mon, 20 Jun 2016 18:24:35 +0000 (14:24 -0400)]
conf: limit chassisNr, and busNr to a minimum value of 1, not 0

In the case of chassisNr (used to set chassis_nr of a pci-bridge
controller), 0 is reserved for / used by the pci[e]-root bus. In the
base of busNr, a value of 0 would mean that the root bus had no places
available to plug in new buses, including the pxb itself (the
documentation I wrote for pxb even noted the limit of busNr as 1.254).

NB: oddly, the "chassis" attribute, which is used for pcie-root-port
and pcie-switch-downstream-port *can* be set to 0, since it's the
combination of {chassis, slot} that needs to be unique, not chassis by
itself (and slot 0 of pcie-root is reserved, while pcie-*-port can use
*only* slot 0).

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1342962

8 years agoqemu: Fix typo pci-extender-bus -> pci-expander-bus
Andrea Bolognani [Tue, 21 Jun 2016 10:48:02 +0000 (12:48 +0200)]
qemu: Fix typo pci-extender-bus -> pci-expander-bus

8 years agovirsh migrate: Fix positional parameters
Jiri Denemark [Mon, 20 Jun 2016 07:26:48 +0000 (09:26 +0200)]
virsh migrate: Fix positional parameters

Thanks to our smart option parser which automatically assigns positional
parameters the following (previously working) command fails:

    virsh migrate test qemu+ssh://1.2.3.4/system tcp://1.2.3.4/
    error: invalid argument: Unsupported compression method
    'tcp://1.2.3.4/'

We need to make sure new options are added at the end of the list rather
than where they logically belong.

Reported by Brian Rak.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoMark virsh-optparse as expensive
Ján Tomko [Fri, 17 Jun 2016 18:01:46 +0000 (20:01 +0200)]
Mark virsh-optparse as expensive

8 years agoDrop virrandomtest
Ján Tomko [Fri, 17 Jun 2016 17:37:09 +0000 (19:37 +0200)]
Drop virrandomtest

This test only checks if mocking of virRandomBytes works correctly.

Drop it to avoid infinite recursion by testing the test suite.

8 years agoRemove virsh-synopsis
Ján Tomko [Fri, 17 Jun 2016 17:35:37 +0000 (19:35 +0200)]
Remove virsh-synopsis

This tests checks that the first word after SYNOPSIS
in virsh help ${command} output is ${command}.

This was only good to check that the command option structures
are valid, which is now served by 'virsh self-test'.

8 years agoIntroduce virsh self-test
Ján Tomko [Fri, 17 Jun 2016 17:28:12 +0000 (19:28 +0200)]
Introduce virsh self-test

A new hidden command for virsh that will iterate over
all command groups and commands and print help for every single one.

This involves running vshCmddefOptParse so we can get an error if
one of the command's option structure is invalid.

8 years agotests: mock gnutls_dh_params_generate2
Ján Tomko [Thu, 16 Jun 2016 06:54:27 +0000 (08:54 +0200)]
tests: mock gnutls_dh_params_generate2

This function generates some big random numbers.

Cache the result and supply it to any subsequent generate2 calls.

8 years agoRemove virsh-all
Ján Tomko [Fri, 17 Jun 2016 17:32:24 +0000 (19:32 +0200)]
Remove virsh-all

Since e8ac4a7 this test wastes some CPU cycles by blindly trying to
run almost every virsh command, blindly throwing away the output
and the return value and returning success if 'virsh help' successfully
returned at least one command.

Drop it completely.

8 years agoutil: Make failure to get supplementary group list for a uid non-fatal
Peter Krempa [Fri, 17 Jun 2016 13:32:58 +0000 (15:32 +0200)]
util: Make failure to get supplementary group list for a uid non-fatal

Since introduction of the DAC security driver we've documented that
seclabels with a leading + can be used with numerical uid. This would
not work though with the rest of libvirt if the uid was not actually
used in the system as we'd fail when trying to get a list of
supplementary groups for the given uid. Since a uid without entry in
/etc/passwd (or other user database) will not have any supplementary
groups we can treat the failure to obtain them as such.

This patch modifies virGetGroupList to not report the error for missing
users and makes it return an empty list or just the group specified in
@gid.

All callers will grant less permissions to a user in case of failure of
this function and thus this change is safe.

8 years agoutil: Add option not to report errors in virGetUserEnt
Peter Krempa [Fri, 17 Jun 2016 11:54:52 +0000 (13:54 +0200)]
util: Add option not to report errors in virGetUserEnt

In some cases it will be necessary to ignore errors reported from this
function. This allows suppressing them to avoid spamming logs.

8 years agotools: virt-login-shell: Fix cut'n'paste mistake in error message
Peter Krempa [Fri, 17 Jun 2016 13:12:02 +0000 (15:12 +0200)]
tools: virt-login-shell: Fix cut'n'paste mistake in error message

Whine about 'allowed_users' having wrong format rather than 'shell'

8 years agotools: virt-login-shell: Fix group list bounds checking
Peter Krempa [Fri, 17 Jun 2016 12:50:44 +0000 (14:50 +0200)]
tools: virt-login-shell: Fix group list bounds checking

The list certainly isn't zero terminated and it would disallow usage of
group 'root'. Pass in the array size and match against it.

8 years agoconf: Fix label name in virDomainGraphicsListensParseXML
Peter Krempa [Mon, 20 Jun 2016 13:34:08 +0000 (15:34 +0200)]
conf: Fix label name in virDomainGraphicsListensParseXML

Use 'cleanup' since it's also used on success.

8 years agoconf: Fix memory leak in graphics XML parser
Peter Krempa [Mon, 20 Jun 2016 13:29:04 +0000 (15:29 +0200)]
conf: Fix memory leak in graphics XML parser

When loading status XMLs with following graphics definition:

  <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
    <listen type='address' address='127.0.0.1' fromConfig='1'/>
    <image compression='off'/>
  </graphics>

libvirtd would leak a few bytes:

10 bytes in 1 blocks are definitely lost in loss record 71 of 1,127
   at 0x4C2C000: malloc (vg_replace_malloc.c:299)
   by 0x6789298: xmlStrndup (in /usr/lib64/libxml2.so.2.9.4)
   by 0x552AB0A: virXMLPropString (virxml.c:479)
   by 0x5539536: virDomainGraphicsListensParseXML (domain_conf.c:11171)
   by 0x553DD5E: virDomainGraphicsDefParseXMLSpice (domain_conf.c:11414)
   by 0x553DD5E: virDomainGraphicsDefParseXML (domain_conf.c:11749)
   by 0x5566061: virDomainDefParseXML (domain_conf.c:16939)
   by 0x556953F: virDomainObjParseXML (domain_conf.c:17348)
   by 0x556953F: virDomainObjParseNode (domain_conf.c:17513)
   by 0x5569902: virDomainObjParseFile (domain_conf.c:17532)
   by 0x5571E02: virDomainObjListLoadStatus (virdomainobjlist.c:514)
   by 0x5571E02: virDomainObjListLoadAllConfigs (virdomainobjlist.c:596)
   by 0x26E0BDC8: qemuStateInitialize (qemu_driver.c:911)
   by 0x55B1FDB: virStateInitialize (libvirt.c:770)
   by 0x122039: daemonRunStateInit (libvirtd.c:960)

8 years agoutil: fix a typo
Chen Hanxiao [Mon, 20 Jun 2016 11:52:20 +0000 (19:52 +0800)]
util: fix a typo

s/succcess/success

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agodocs: virsh: Added note for the dump command
Jaroslav Suchanek [Mon, 20 Jun 2016 11:34:28 +0000 (13:34 +0200)]
docs: virsh: Added note for the dump command

Crash dump in a old kvmdump format is being obsolete and cannot be loaded and
processed by crash utility since its version 6.1.0. A --memory-only option is
required in order to produce valid ELF file which can be later processed by the
crash utility. A new note is added to the dump command description.

8 years agoAllow disjunct ranges in VIR_TEST_RANGE
Ján Tomko [Fri, 17 Jun 2016 12:09:30 +0000 (14:09 +0200)]
Allow disjunct ranges in VIR_TEST_RANGE

Use virBitmapParseUnlimited to parse the env variable.

8 years agoIntroduce virBitmapParseUnlimited
Ján Tomko [Fri, 17 Jun 2016 13:12:02 +0000 (15:12 +0200)]
Introduce virBitmapParseUnlimited

For parsing a bitmap of an unknown size.

8 years agoRemove separator argument from virBitmapParse
Ján Tomko [Fri, 17 Jun 2016 12:56:45 +0000 (14:56 +0200)]
Remove separator argument from virBitmapParse

Most the callers pass 0 in one form or another, including
vircapstest which used VIR_ARCH_NONE.

8 years agoIntroduce virBitmapParseSeparator
Ján Tomko [Fri, 17 Jun 2016 12:38:11 +0000 (14:38 +0200)]
Introduce virBitmapParseSeparator

This will be used for the caller that needs to specify a separator.
Currently identical to virBitmapParse.

Also change one test case to use the new function.

8 years agoDo not return number of set bits in virBitmapParse
Ján Tomko [Fri, 17 Jun 2016 12:11:55 +0000 (14:11 +0200)]
Do not return number of set bits in virBitmapParse

This is only used by one caller.

8 years agoqemu: Don't use legacy USB for aarch64 mach-virt guests
Andrea Bolognani [Thu, 16 Jun 2016 17:12:34 +0000 (19:12 +0200)]
qemu: Don't use legacy USB for aarch64 mach-virt guests

The '-usb' option doesn't have any effect for aarch64 mach-virt
guests, so the fact that it's currently enabled by default is not
really causing any issue.

However, that might change in the future (although unlikely), and
having it as part of the QEMU command line can cause confusion to
someone looking through the process list.

Avoid it completely, like it's already happening for q35.

8 years agoqemu_hotplug: Use a helper variable consistently
Tomasz Flendrich [Sun, 19 Jun 2016 12:46:40 +0000 (14:46 +0200)]
qemu_hotplug: Use a helper variable consistently

8 years agovirsh: Introduce pool-event command osstest/frozen/xen-4.6-testing
Jovanka Gulicoska [Thu, 16 Jun 2016 17:27:10 +0000 (19:27 +0200)]
virsh: Introduce pool-event command

Similar to 'event' and 'net-event', this prints info about incoming
storage pool events.

8 years agolibxl: add USB to hostdev domcapabilities
Jim Fehlig [Fri, 17 Jun 2016 15:47:34 +0000 (16:47 +0100)]
libxl: add USB to hostdev domcapabilities

Commit 2a58ed0b added support for creating guests with USB
hostdevs. Commit fc21d10 later added support for hotplut of
USB hostdevs. Advertise support for USB hostdevs in the
domcapabilities.

In addition add the appropriate caps for USB support on
domaincapstest when libvirt is built on a Xen with
LIBXL_HAVE_PVUSB. Otherwise domaincapstest would fail i.e.
testing the wrong domain capabilities.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
8 years agoqemu: restore non-pci hostdev labels after detach
Ján Tomko [Fri, 17 Jun 2016 11:14:56 +0000 (13:14 +0200)]
qemu: restore non-pci hostdev labels after detach

Commit 409de00 changed the logic to only match PCI devices
while moving this before Remove*HostDevice calls.

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

8 years agoRemove stray space in cmdHelp
Ján Tomko [Fri, 17 Jun 2016 17:27:08 +0000 (19:27 +0200)]
Remove stray space in cmdHelp

8 years agoqemu: Permit PCI-free aarch64 mach-virt guests
Andrea Bolognani [Thu, 16 Jun 2016 17:13:19 +0000 (19:13 +0200)]
qemu: Permit PCI-free aarch64 mach-virt guests

There has been some progress lately in enabling virtio-pci on
aarch64 guests; however, guest OS support is still spotty at best,
so most guests are going to be using virtio-mmio instead.

Currently, mach-virt guests are closely modeled after q35 guests,
and that includes always adding a dmi-to-pci-bridge that's just
impossible to get rid of. While that's acceptable (if suboptimal)
for q35, where you will always need some kind of PCI device anyway,
mach-virt guests should be allowed to avoid it.

8 years agoqemuDomainDetachDeviceConfig: Allow cold unplug of redirdevs
Michal Privoznik [Thu, 9 Jun 2016 10:06:47 +0000 (12:06 +0200)]
qemuDomainDetachDeviceConfig: Allow cold unplug of redirdevs

This is fairly simple. We lookup the device in the array of
devices and remove it. No magic.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainAttachDeviceConfig: Allow redirdev coldplug
Michal Privoznik [Thu, 9 Jun 2016 06:37:05 +0000 (08:37 +0200)]
qemuDomainAttachDeviceConfig: Allow redirdev coldplug

This is really simple, we just need to append the device into the
domain def and that's it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirDomainDeviceInfoIterateInternal: Iterate through redirdevs too
Michal Privoznik [Thu, 9 Jun 2016 08:41:13 +0000 (10:41 +0200)]
virDomainDeviceInfoIterateInternal: Iterate through redirdevs too

This is going to be important later when we received
DEVICE_DELETED event on the qemu monitor. If we do,
virDomainDefFindDevice() is called to find the device for given
device alias in the virDomainDef tree. When we enable removal for
redirdevs we need to include them in the lookup process too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirDomainRedirdevDef: Introduce find & remove routines
Michal Privoznik [Thu, 9 Jun 2016 09:17:01 +0000 (11:17 +0200)]
virDomainRedirdevDef: Introduce find & remove routines

Basically, there are just two functions introduced here:
virDomainRedirdevDefFind which looks up given redirdev in domain
definition, and virDomainRedirdevDefRemove which removes the
device at given index in the array of devices.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agodomain_conf: Validate redirdev after parsing
Michal Privoznik [Thu, 9 Jun 2016 06:35:45 +0000 (08:35 +0200)]
domain_conf: Validate redirdev after parsing

There's currently just one limitation: redirdevs that want to go
on USB bus require a USB controller, surprisingly.
At the same time, since I'm using virDomainDefHasUSB() in this
new validator function, it has to be moved a few lines up and
also its header needed to be changed a bit: it is now taking a
const pointer to domain def since it's not changing anything in
there.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoconfigure: remove definition of HAVE_GLIBC_RPCGEN
Ján Tomko [Fri, 17 Jun 2016 10:02:17 +0000 (12:02 +0200)]
configure: remove definition of HAVE_GLIBC_RPCGEN

Unused since commit fb1e8d9 in May 2011.

8 years agoconfigure: error out when asked for mpath on non-Linux
Ján Tomko [Fri, 17 Jun 2016 09:55:04 +0000 (11:55 +0200)]
configure: error out when asked for mpath on non-Linux

8 years agoconfigure: define preprocessor macros for SCSI and MPATH
Ján Tomko [Fri, 17 Jun 2016 08:59:35 +0000 (10:59 +0200)]
configure: define preprocessor macros for SCSI and MPATH

This fixes building these backends when explicitly enabled
on the command line.

Exposed by commit a659559 which started adding
--with-storage-mpath in the spec file.

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

8 years agoqemu: Fix alignment in virDomainDefAddController() call
Andrea Bolognani [Fri, 17 Jun 2016 11:05:51 +0000 (13:05 +0200)]
qemu: Fix alignment in virDomainDefAddController() call

8 years agotests: schema: Remove useless perf schema data
Peter Krempa [Fri, 17 Jun 2016 08:22:48 +0000 (10:22 +0200)]
tests: schema: Remove useless perf schema data

We have a test case that excercises the parser and formatter now which
takes part in schema checking so remove the schema-only test.

8 years agodocs: virsh: Add minimal documentation for 'mbmt' and 'mbml' perf events
Peter Krempa [Fri, 17 Jun 2016 08:20:45 +0000 (10:20 +0200)]
docs: virsh: Add minimal documentation for 'mbmt' and 'mbml' perf events

8 years agocpu_x86: Use signature in CPU detection code
Jiri Denemark [Thu, 25 Jun 2015 13:06:19 +0000 (15:06 +0200)]
cpu_x86: Use signature in CPU detection code

Our current detection code uses just the number of CPU features which
need to be added/removed from the CPU model to fully describe the CPUID
data. The smallest number wins. But this may sometimes generate wrong
results as one can see from the fixed test cases. This patch modifies
the algorithm to prefer the CPU model with matching signature even if
this model results in a longer list of additional features.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Add Skylake-Client x86 CPU model
Jiri Denemark [Wed, 1 Jun 2016 13:50:40 +0000 (15:50 +0200)]
cpu: Add Skylake-Client x86 CPU model

The CPU model was implemented in QEMU by commit f6f949e929.

The change to i7-5600U is wrong since it's a 5th generation CPU, i.e.,
Broadwell rather than Skylake, but that's just the result of our CPU
detection code (which is fixed by the following commit).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agospec: Make driver-qemu require driver-storage
Martin Kletzander [Thu, 16 Jun 2016 16:42:20 +0000 (18:42 +0200)]
spec: Make driver-qemu require driver-storage

Without that we might get similar messages in the log:

  error : virDriverLoadModule:73 : failed to load module
  /usr/lib64/libvirt/connection-driver/libvirt_driver_qemu.so
  /usr/lib64/libvirt/connection-driver/libvirt_driver_qemu.so: undefined
  symbol: virStorageFileCreate

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoconf: Rename virDomainDefGetMemoryActual to virDomainDefGetMemoryTotal
Peter Krempa [Wed, 15 Jun 2016 13:34:04 +0000 (15:34 +0200)]
conf: Rename virDomainDefGetMemoryActual to virDomainDefGetMemoryTotal

8 years agoconf: Remove pre-calculation of initial memory size
Peter Krempa [Tue, 14 Jun 2016 09:23:23 +0000 (11:23 +0200)]
conf: Remove pre-calculation of initial memory size

While we need to know the difference between the total memory stored in
<memory> and the actual size not included in the possible memory modules
we can't pre-calculate it reliably. This is due to the fact that
libvirt's XML is copied via formatting and parsing the XML and the
initial memory size can be reliably calculated only when certain
conditions are met due to backwards compatibility.

This patch removes the storage of 'initial_memory' and fixes the helpers
to recalculate the initial memory size all the time from the total
memory size. This conversion is possible when we also make sure that
memory hotplug accounts properly for the update of the total memory size
and thus the helpers for inserting and removing memory devices need to
be tweaked too.

This fixes a bug where a cold-plug and cold-remove of a memory device
would increase the size reported in <memory> in the XML by the size of
the memory device. This would happen as the persistent definition is
copied before attaching the device and this would lead to the loss of
data in 'initial_memory'.

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