Commit Graph

21147 Commits

Author SHA1 Message Date
Michal Privoznik
0bfdb9cb24 wireshark: s/ep_alloc/wmem_alloc/
In wireshark, they have introduced their own memory allocator
wmem. This means that we need to adapt our code to that change
too. Notably 0ad15f88ccf434e8210ca is the wireshark commit you
want to look at. It's the one where they dropped the old API. The
new allocator has been introduced in 84cc3daa (v1.10.0), however,
was not exposed until 5c05c9e0 (v1.10.0). Since we already are
requiring 1.11.3 or higher no other change is needed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-11 17:23:41 +01:00
Michal Privoznik
d3ede96d6f wireshark: s/proto_tree_add_text/proto_tree_add_item/
In the wireshark commit e2735ecfdd7a96c they dropped
proto_tree_add_text in favor of proto_tree_add_item. Adapt to
this change.

Moreover, the proto_tree_add_item API is around for ages and we
are already using it anyway. Therefore we don't need to change
required version of wireshark.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-11 17:23:41 +01:00
Michal Privoznik
0a84286d8f qemu: Introduce QEMU_CAPS_VSERPORT_CHANGE
This capability tells if qemu is capable of vserport_change
events.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-11 17:17:52 +01:00
Michal Privoznik
d5762cc034 qemu: change qemuFindAgentConfig return type
While this is no functional change, whole channel definition is
going to be needed very soon. Moreover, while touching this obey
const correctness rule in qemuAgentOpen() - so far it was passed
regular pointer to channel config even though the function is
expected to not change pointee at all. Pass const pointer
instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-11 17:17:52 +01:00
Michal Privoznik
2f50445537 qemu: Set virtio channel state sooner
In qemu driver we listen to virtio channel events like an agent
connected to or disconnected from the guest part of socket.
However, with a little exception - when we find out that the
socket in question is the guest agent one, we connect or
disconnect guest agent which is done prior setting new state in
internal structure. Due to a bug in our code it may happen that
we got the event but failed to set it in internal structure
representing the channel.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-11 17:16:29 +01:00
Martin Kletzander
6dc0e4f171 Fix LSB requirements in service script and sync them
Commit b22344f328 mistakenly reordered
Default-* lines.  Thanks to that I noticed that we are very inconsistent
with our init scripts, so I took the liberty of synchronizing them,
updating them and making them all look shiny and new.  So apart from
fixing the LSB requirements, I also fixed the ordering, specified
runlevels and fix the link to the reference specification.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-11 15:49:13 +01:00
Michal Privoznik
506e9d6c2d virDomainGetTime: Deny on RO connections
We have a policy that if API may end up talking to a guest agent
it should require RW connection. We don't obey the rule in
virDomainGetTime().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-11 13:36:19 +01:00
Michal Privoznik
95c370f0ee virDomainInterfaceAddresses: Allow API on RO connection too
This API does not change domain state. However, we have a policy
that an API talking to a guest agent requires RW access. But that
happens only if source == VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-11 13:36:19 +01:00
Andrea Bolognani
deb3e802de virsh: Document the --timestamp option
The event, net-event and qemu-monitor-event virsh commands all
support the --timestamp option now, but such option was not
referenced in the man page.
2016-01-11 12:45:21 +01:00
Andrea Bolognani
dd4e9351ba virsh: Add timestamps to network events
Implement a --timestamp option for 'virsh net-event', similar to the
one for 'virsh event'.

When the option is used, the human-readable timestamp will be printed
before the message.
2016-01-11 12:45:21 +01:00
Andrea Bolognani
75a96e0cc4 virsh: Add timestamps to QEMU monitor events
Implement a --timestamp option for 'virsh qemu-monitor-event', similar
to the one for 'virsh event'.

When the option is used, the human-readable timestamp will be printed
before the message, and the timing information provided by QEMU will
not be displayed.
2016-01-11 12:45:21 +01:00
Martin Kletzander
8223bd22ed Don't clear libvirt-internal paths when parsing status XML
Earlier commit 7140807917 forgot to deal
properly with status XMLs where we want the libvirt-internal paths to be
kept in place and not cleared, otherwise we could end up copying a NULL
string and segfaulting th daemon.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-11 10:54:50 +01:00
Martin Kletzander
93103da84b Provide parse flags to PostParse functions
This way both Domain and Device PostParse functions can act based on the
flags.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-11 10:54:50 +01:00
Cole Robinson
fde937bda0 qemu: command: wire up usage of q35/ich9 disable s3/s4
If the q35 specific disable s3/s4 setting isn't supported, fallback to
specifying the PIIX setting, which is the previous behavior. It doesn't
have any effect, but qemu will just warn about it rather than error:

  qemu-system-x86_64: Warning: global PIIX4_PM.disable_s3=1 not used
  qemu-system-x86_64: Warning: global PIIX4_PM.disable_s4=1 not used

Since it doesn't error, I don't think we should either, since there
may be configs in the wild that already have q35 + disable_s3/4 (via
virt-manager)
2016-01-10 15:16:38 -05:00
Cole Robinson
c77fd89000 qemu: caps: check for q35/ICH9 disable S3/S4
Update test data to match
2016-01-10 14:59:53 -05:00
Cole Robinson
5900356efb qemu: caps: Rename CAPS_DISABLE_S[34] to CAPS_PIIX_DISABLE_S[34]
These settings are specific to PIIX, so clarify it
2016-01-10 14:59:53 -05:00
Cole Robinson
ab963449dc qemu: capabilities: s/Pixx/Piix/g
The chipset is called PIIX; the functions are misnamed
2016-01-10 14:59:53 -05:00
Cole Robinson
da176bf6b7 examples: Use one top level makefile
Using one Makefile per example subdirectory essentially serializes 'make'
calls. Convert to one example/Makefile that builds and distributes
all the subdir files. This reduces example/ rebuild time from about 5.8
seconds to 1.5 seconds on my machine.

One slight difference is that we no longer ship Makefile.am with the
examples in the rpm. This was virtually useless anyways since the Makefile
was very specific to libvirt infrastructure, so wasn't generically
reusable anyways.

Tested with 'make distcheck' and 'make rpm'
2016-01-09 21:14:12 -05:00
Cole Robinson
03569fda63 cfg.mk: Drop period after filename for indent failures
The period makes it more difficult to copy/paste the errant filename
for manual fixup
2016-01-09 16:33:10 -05:00
Michal Privoznik
6e2770174e virt-host-validate-common: Print warning on missing IOMMU
No only coverity warns about this, but it kind of makes sense
too. We have a test whether host supports IOMMU. Some platforms
don't have it, I know. But in that case we should print a message
that it's unknown whether platform has it or not.

Before:
  (no output)

After:
  QEMU: Checking for device assignment IOMMU support                         : WARN (Unknown if this platform has IOMMU support)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-09 18:44:44 +01:00
Michal Privoznik
b7fac9f77f virDomainMigrateUnmanagedParams: Don't blindly dereference @dconnuri
This function may be called with @dconnuri == NULL, e.g. from
virDomainMigrateToURI3() if the flags are missing
VIR_MIGRATE_PEER2PEER flag. Moreover, all later functions called
from here do wrap it into NULLSTR() so why not do the same here?

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-09 18:44:44 +01:00
Martin Kletzander
8156493d8d Fix USB model defaults for ppc64
The condition was checking for UHCI (and OHCI for ppc64) availability so
that it can specify the proper device instead of legacy usb.  However,
for ppc64, we don't need to check both OHCI and UHCI, but only OHCI as
that is the legacy default.  The condition is so big that it was just a
matter of time when someone will make a mistake there, so let's use more
lines so that it is visible what the condition checks for.

This fixes usage of -device instead of -usb for ppc64 that supports
pci-usb-ohci and does not support piix3-usb-uhci.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-09 18:39:17 +01:00
Martin Kletzander
aea47e48c4 Avoid wild securityManager pointer in tests
For some reason we are not setting the driver with memset() to zeros.
But since commit 74abc3deac
driver->securityManager is being accessed and qemuagenttest started
crashing due to that.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-09 18:28:53 +01:00
Cole Robinson
8d48ce02c3 tests: qemuxml2xml: Wire up QEMUCaps usage
Future changes will make some of these tests dependent on specific
QEMUCaps flags, so wire up the basic handling. Flags will be added
in future patches.
2016-01-08 21:21:34 -05:00
Cole Robinson
af3bd44fd6 tests: add genericxml2xmltest
For testing hypervisor independent XML handling. Right now it's just
populated with an example test case.
2016-01-08 21:21:34 -05:00
Cole Robinson
f8ce014319 tests: qemuxml2xml: drop early file loading
For the standard active/inactive XML testing, if we leave the file loading
up to the generic XML2XML infrastructure, we get the benefit of
VIR_TEST_REGENERATE_OUTPUT, at the price of a few more disk reads. Seems
worth it.
2016-01-08 21:21:34 -05:00
Cole Robinson
5770c17074 tests: Share domain XML2XML compare helper
This creates a shared function in testutils.c that consolidates all
the slightly different implementations.
2016-01-08 21:21:34 -05:00
Cole Robinson
ace4aecd5e tests: Fix running schematests directly from topdir
Previously it failed like:

$ ./tests/domainschematest
./tests/domainschematest: line 4: ./test-lib.sh: No such file or directory
2016-01-08 21:21:34 -05:00
Cole Robinson
825d357a46 tests: Add newlines with VIR_TEST_REGENERATE_OUTPUT
Since test files are formatted predictably nowadays, we can make
VIR_TEST_REGENERATE_OUTPUT handle most cases for us with a simple
replacement. test-wrap-argv.pl is still canon, but this bit makes
it easier to confirm test output changes during active development.
2016-01-08 21:21:34 -05:00
Jim Fehlig
f988ecfb34 libxl: support vif outgoing bandwidth QoS
The libxl_device_nic structure supports specifying an outgoing rate
limit based on a time interval and bytes allowed per interval. In xl
config a rate limit is specified as "<RATE>/s@<INTERVAL>". INTERVAL
is optional and defaults to 50ms.

libvirt expresses outgoing limits by average (required), peak, burst,
and floor attributes in units of KB/s. This patch supports the outgoing
bandwidth limit by converting the average KB/s to bytes per interval
based on the same default interval (50ms) used by xl.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-01-08 18:56:00 -07:00
Jim Fehlig
ec63000a62 xenconfig: support vif bandwidth in xm and xl parser and formatter
Both xm and xl config have long supported specifying vif rate
limiting, e.g.

vif = [ 'mac=00:16:3E:74:3d:76,bridge=br0,rate=10MB/s' ]

Add support for mapping rate to and from <bandwidth> in the xenconfig
parser and formatter. rate is mapped to the required 'average' attribute
of the <outbound> element, e.g.

  <interface type='bridge'>
    ...
    <bandwidth>
      <outbound average='10240'/>
    </bandwidth>
  </interface>

Also add a unit test to check the conversion logic.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-01-08 18:56:00 -07:00
Jim Fehlig
1dd34bbb4b xenconfig: support vif bandwidth in sexpr parser and formatter
The xen sexpr config format has long supported specifying vif rate
limiting, e.g.

  (device
    (vif
      (mac '00:16:3e:1b:b1:47')
      (rate '10240KB/s')
      ...
    )
  )

Add support for mapping rate to and from <bandwidth> in the xenconfig
sexpr parser and formatter. rate is mapped to the required 'average'
attribute of the <outbound> element, e.g.

  <interface type='bridge'>
    ...
    <bandwidth>
      <outbound average='10240'/>
    </bandwidth>
  </interface>

Also add unit tests to check the conversion logic.

This patch benefits both the old xen driver and the libxl driver.
Both drivers gain support for vif bandwidth when converting to/from
domXML and xen-sxpr. In addition, the old xen driver will now be
able to handle vif 'rate' setting when communicating with xend.
2016-01-08 18:56:00 -07:00
Cole Robinson
3d92a000ff qemu: Fix crash when defining XML with bogus emulator
We weren't checking for failure of qemuCaps lookup
2016-01-08 20:05:31 -05:00
Laine Stump
79ba107670 util: add missing newline
Somehow I managed to backspace over the newline between the closing
brace and goto cleanup; in commit 36e244f3.
2016-01-08 14:09:31 -05:00
Andrea Bolognani
117375ca49 tests: qemuxml2argv: Add tests for USB controller on q35 2016-01-08 19:46:43 +01:00
Cole Robinson
a4af45c065 tests: qemuxml2xml: Convert fprintf to VIR_TEST_DEBUG 2016-01-08 13:25:21 -05:00
Cole Robinson
74abc3deac qemu: Handle SecurityManagerVerify in post parse
Rather than open coding calls. I can't see any reason not to
2016-01-08 13:25:21 -05:00
Cole Robinson
a8b628e7a8 qemu: Handle CanonicalizeMachine in post parse
Rather than open coding calls. I can't see any reason not to
2016-01-08 13:25:20 -05:00
Cole Robinson
9cec6239c1 qemu: domain: split out post parse default device handling
Should be a no-op
2016-01-08 13:25:20 -05:00
Cole Robinson
ee719cdcca domain: separate out function for post parse timer validation
This should be a no-op
2016-01-08 13:25:20 -05:00
Cole Robinson
11de45bb71 domain: separate out function for post parse console compat
This should be a no-op
2016-01-08 13:25:20 -05:00
Jiri Denemark
b2334e433a qemu: Refactor qemuMigrationFinish
To get rid of a giant if-else block which is very easy to get lost in.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-01-08 18:18:58 +01:00
Jiri Denemark
eb084a733b qemu: Report more migration statistics
memory_dirty_rate corresponds to dirty-pages-rate in QEMU and
memory_iteration is what QEMU reports in dirty-sync-count.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-01-08 18:18:58 +01:00
Jiri Denemark
b638b9b35c qemu: Create a proper type for migration status enum
The enum will be called qemuMonitorMigrationStatus.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-01-08 18:18:58 +01:00
Jiri Denemark
09bbd96239 qemu: Rename qemuMonitorMigrationStatus struct
The structure actually contains migration statistics rather than just
the status as the name suggests. Renaming it as
qemuMonitorMigrationStats removes the confusion.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-01-08 18:18:58 +01:00
Jiri Denemark
5fed699a2d qemu: Reorder migration status enum
A migration is in "setup" state after it was "inactive" and before it
becomes "active". Let's reflect this in our migration status enum.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-01-08 18:18:58 +01:00
Pavel Hrdina
4921c54411 tests.nwfilterebiptablestest: swap actual and expected
Those parameters should be in opposite order.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-01-08 16:08:15 +01:00
Pavel Hrdina
c060f44c16 tests.testutils: use virTestDifferenceFull in virtTestCompareToFile
Let's use the new virTestDifferenceFull function that will regenerate
the expected output and fail the test to let developer know that there
something was updated.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-01-08 16:08:15 +01:00
Pavel Hrdina
781d70c027 tests.testutils: use VIR_TEST_REGENERATE_OUTPUT for virTestDifferenceFull
This patch enable regeneration of expected output file for
virTestDifferenceFull.  It also introduces new
virTestDifferenceFullNoRegenerate function for special cases, where we
don't want to regenerate output.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-01-08 16:08:15 +01:00
Pavel Hrdina
0104c43195 tests: add helper for VIR_TEST_REGENERATE_OUTPUT flag
When this flag is specified, some of the expected output files will be
regenerated with the actual output data.  Use helper function like for
other flags.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-01-08 16:05:26 +01:00