Commit Graph

2670 Commits

Author SHA1 Message Date
Martin Kletzander
92757d4d2d systemd: Add virSystemdGetMachineNameByPID
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-02-03 14:57:43 +01:00
Martin Kletzander
9ba2646291 Revert "systemd: Escape only needed characters for machined"
This reverts commit 0e0149ce91.

That commit was added to comply with systemd rules that were changed in
the meantime, so this patch is pointless.
2016-02-03 14:44:37 +01:00
Eric Blake
041f7c9304 tests: avoid realpath in test-lib.sh
Ever since commit ace4aecd, running 'make check' on RHEL 6 produces:

./test-lib.sh: line 21: realpath: command not found

for every shell script test, because 'realpath' was not part of
coreutils back then.

* tests/test-lib.sh (_scriptdir): Compute with only portable shell.

Signed-off-by: Eric Blake <eblake@redhat.com>
2016-02-01 13:03:28 -07:00
Andrea Bolognani
771eaeb2b3 pci: Phase out virPCIDeviceReattachInit()
The name is confusing, and there are just two uses: one is a test case,
and the other will be removed as part of an upcoming refactoring of
the hostdev code.
2016-01-28 11:31:28 +01:00
Pavel Hrdina
36785c7e77 device: cleanup input device code
The current code was a little bit odd.  At first we've removed all
possible implicit input devices from domain definition to add them later
back if there was any graphics device defined while parsing XML
description.  That's not all, while formating domain definition to XML
description we at first ignore any input devices with bus different to
USB and VIRTIO and few lines later we add implicit input devices to XML.

This seems to me as a lot of code for nothing.  This patch may look
to be more complicated than original approach, but this is a preferred
way to modify/add driver specific stuff only in those drivers and not
deal with them in common parsing/formating functions.

The update is to add those implicit input devices into config XML to
follow the real HW configuration visible by guest OS.

There was also inconsistence between our behavior and QEMU's in the way,
that in QEMU there is no way how to disable those implicit input devices
for x86 architecture and they are available always, even without graphics
device.  This applies also to XEN hypervisor.  VZ driver already does its
part by putting correct implicit devices into live XML.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-01-26 17:53:33 +01:00
Pavel Hrdina
2686e44e05 tests: add some missing tests to qemuxml2xmltest
Those tests are in qemuargv2xmltest and it makes sense to include them
also in qemuxml2xmltest and qemuxml2argvtest.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-01-26 17:53:33 +01:00
Pavel Hrdina
2d446b6eeb tests: use virtTestDifferenceFull in tests where we have output file
This will enable regenerate functionality for those tests to make
developer lives easier while updating tests.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-01-26 17:53:33 +01:00
Peter Krempa
7141fc7a27 test: Touch up error message when attempting to pin invalid vCPU
Report
error: invalid argument: requested vcpu '100' is not present in the domain
instead of
error: invalid argument: requested vcpu is higher than allocated vcpus
2016-01-25 17:53:08 +01:00
Peter Krempa
f82a8014c0 tests: qemuxml2xml: Order pinning information numerically
A future patch will refactor the storage of the pinning information in a
way where the ordering will be lost. Order them numerically to avoid
changing the tests later.
2016-01-25 17:53:07 +01:00
Michal Privoznik
35c3aab44d vmx: Adapt to emptyBackingString for cdrom-image
https://bugzilla.redhat.com/show_bug.cgi?id=1266088

We are missing this value for cdrom-image device. It seems like
there's no added value to extend this to other types of disk
devices [1].

1: https://www.redhat.com/archives/libvir-list/2016-January/msg01038.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-25 08:34:23 +01:00
Roman Bogorodskiy
ef01addb38 bhyve: bhyveload: respect boot dev and boot order
Make bhyveload respect boot order as specified by os.boot section of the
domain XML or by "boot order" for specific devices. As bhyve does not
support a real boot order specification right now, it's just about
choosing a single device to boot from.
2016-01-25 04:19:33 +03:00
Ian Campbell
daeace5c5d libxl: Support cmdline= in xl config files
... and consolidate the cmdline/extra/root parsing to facilitate doing
so.

The logic is the same as xl's parse_cmdline from the current xen.git master
branch (e6f0e099d2c17de47fd86e817b1998db903cab61).

On the formatting side switch to producing cmdline= instead of extra=.

Update a few tests and add serveral more.
  - test-cmdline is added to test the exclusive use of cmdline.
  - test-fullvirt-direct-kernel-boot.cfg is updated due to the switch
    on the formatting side and now tests the exclusive use of cmdline=.
  - Tests are added for both paravirt and fullvirt where the .cfg uses
    extra= and (paravirt only) root=. These are format (xl->xml) only
    since the inverse will generate cmdline= hence is not a round trip
    (which was already true if using root=, which used to generate
    extra= on the way back).
  - Tests are added for both paravirt and fullvirt where the .cfg
    declares cmdline= as well as bogus extra= and (paravirt only) root=
    entries which should be ignored. Again these are format only tests
    since the inverse won't include the bogus lines.

The last two bullets here required splitting the DO_TEST macro into
two halves, as is done in the xmconfigtest.c case.

In order to introduce a use of VIR_WARN for logging I had to add
virerror.h and VIR_LOG_INIT.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2016-01-21 10:48:44 -07:00
John Ferlan
4f84617078 conf: Add storage pool device attribute part_separator
Add a new storage pool source device attribute 'part_separator=[yes|no]'
in order to allow a 'disk' storage pool using a device mapper multipath
device to not add the "p" partition separator to the generated device
name when libvirt_parthelper is run.

This will allow libvirt to find device mapper multipath devices which were
configured in /etc/multipath.conf to use 'user_friendly_names' or custom
'alias' names for the LUN.
2016-01-19 13:02:59 -05:00
Michal Privoznik
7f866e54df qemuTestDriverInit: fill driver with zeroes
In the commit aea47e48c4 we have fixed a single pointer within
driver structure. Since all callers pass statically allocated
driver on stack other pointers within driver may contain random
values too. Before touching it lets overwrite it with zeroes and
thus fix all dangling pointers.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-18 13:22:14 +01:00
Cole Robinson
ebfd6f45c3 testutils: Fix coverity warning with REGENERATE_OUTPUT
- Don't double check for expectName
- actual is always non-NULL by this point, so don't check it either
2016-01-12 11:30:19 -05:00
Dmitry Andreev
981c01d419 qemu: add support of optional 'autodeflate' attribute
Autodeflate can be enabled/disabled for memballon device
of model 'virtio'.

xml:
<devices>
  <memballoon model='virtio' autodeflate='on'/>
</devices>

qemu:
qemu -device virtio-balloon-pci,...,deflate-on-oom=on

Autodeflate cannot be enabled/disabled for running domain.
2016-01-12 10:48:21 -05:00
Dmitry Andreev
3522a311ea qemu: add capability check for memballoon 'deflate-on-oom' feature
Add appropriate capability check and new virQEMUCaps flag for the new
virtio balloon feature. QEMU commit with the complete feature description:
http://git.qemu.org/?p=qemu.git;a=commit;h=e3816255bf4b6377bb405331e2ee0dc14d841b80
2016-01-12 10:48:21 -05:00
Laine Stump
bd04ad42e7 qemu: auto-add a USB2 controller set for Q35 machines
Use virDomainDefAddUSBController() to add an EHCI1+UHCI1+UHCI2+UHCI3
controller set to newly defined Q35 domains that don't have any USB
controllers defined.
2016-01-11 13:21:10 -05:00
Laine Stump
163338ec28 qemu: prefer 00:1D.x and 00:1A.x for USB2 controllers on Q35
The real Q35 machine puts the first USB controller set (EHCI+(UHCIx4))
on bus 0 slot 0x1D, and the 2nd USB controller set on bus 0 slot 0x1A,
so let's attempt to make the virtual machine match that for
controllers with auto-assigned addresses when possible.

Three test cases were added to assure that the proper addresses are
assigned - one with a single set of unaddressed USB controllers, one
with 3 (to grab both preferred slots plus one more), and one with the
order of the controller definitions reordered, to assure that the
auto-assignment isn't mixed up by order.
2016-01-11 13:04:17 -05: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
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
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
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
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
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
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
Martin Kletzander
7140807917 qemu: Don't bother user with libvirt-internal paths
If user defines a virtio channel with UNIX socket backend and doesn't
care about the path for the socket (e.g. qemu-agent channel), we still
generate it into the persistent XML.  Moreover when then user renames
the domain, due to its persistent socket path saved into the per-domain
directory, it will not start.  So let's forget about old generated paths
and also stop putting them into the persistent definition.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-07 11:29:53 +01:00
Michal Privoznik
d7db33bfe9 qemu: Specify format= iff disk source is not empty
Just recently, qemu forbade specifying format for sourceless
disks (qemu commit 39c4ae941ed992a3bb5). It kind of makes sense.
If there's no file to open, why specify its format. Anyway, I
have a domain like this:

    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

and obviously I am unable to start it. Therefore, a fix on our
side is needed too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-05 16:41:16 +01:00
Michal Privoznik
50371ed1d5 tests: Make test-wrap-argv.pl executable
While 'perl test-wrap-argv.pl' is not too long,
'./test-wrap-argv.pl' is shorter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-12-29 09:37:35 +01:00
Dmitry Mishin
53a15aed39 qemu: Process new 'append' attribute for char dev with output to a file
By default, QEMU truncates serial file on open. Sometimes, it could be weird -
for example, when we are trying to investigate some event, which occured several
restarts ago. This patch adds an ability to preserve previous content.

Signed-off-by: Dmitry Mishin <dim@virtuozzo.com>
2015-12-24 14:50:33 +00:00
Dmitry Mishin
429b4211d0 tests: add qemu 2.6 caps test
Signed-off-by: Dmitry Mishin <dim@virtuozzo.com>
2015-12-24 14:49:38 +00:00
Andrea Bolognani
6d9cdd2a57 pci: Introduce virPCIStubDriver enumeration
This replaces the virPCIKnownStubs string array that was used
internally for stub driver validation.

Advantages:

  * possible values are well-defined
  * typos in driver names will be detected at compile time
  * avoids having several copies of the same string around
  * no error checking required when setting / getting value

The names used mirror those in the
virDomainHostdevSubsysPCIBackendType enumeration.
2015-12-21 11:17:22 +01:00
Andrea Bolognani
e1b2458364 pci: Remove 'reprobe' parameter from virPCIDeviceUnbind()
The value is not inspected inside the function, so it makes more
sense for the caller to change the device's setting explicitly.
2015-12-21 11:04:37 +01:00
Jim Fehlig
5b74103b0b Xen: support maxvcpus in xm and xl config
From: Ian Campbell <ian.campbell@citrix.com>

xend prior to 4.0 understands vcpus as maxvcpus and vcpu_avail
as a bit map of which cpus are online (default is all).

xend from 4.0 onwards understands maxvcpus as maxvcpus and
vcpus as the number which are online (from 0..N-1). The
upstream commit (68a94cf528e6 "xm: Add maxvcpus support")
claims that if maxvcpus is omitted then the old behaviour
(i.e. obeying vcpu_avail) is retained, but AFAICT it was not,
in this case vcpu==maxcpus==online cpus. This is good for us
because handling anything else would be fiddly.

This patch changes parsing of the virDomainDef maxvcpus and vcpus
entries to use the corresponding 'maxvcpus' and 'vcpus' settings
from xm and xl config. It also drops use of the old Xen 3.x
'vcpu_avail' setting.

The change also removes the maxvcpus limit of MAX_VIRT_VCPUS (since
maxvcpus is simply a count, not a bit mask), which is particularly
crucial on ARM where MAX_VIRT_CPUS == 1 (since all guests are
expected to support vcpu placement, and therefore only the boot
vcpu's info lives in the shared info page).

Existing tests adjusted accordingly, and new tests added for the
'maxvcpus' setting.
2015-12-18 17:52:00 -07:00
Jim Fehlig
60ac2aa821 Xen: xenconfig: remove xendConfigVersion from public sexpr functions
Remove use of xendConfigVersion in the s-expresion config formatter/parser
in src/xenconfig/. Adjust callers in the xen and libxl drivers accordingly.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-12-17 21:28:48 -07:00
Jim Fehlig
f2b4a65728 Xen: tests: use latest XEND_CONFIG_VERSION in xml2sexpr tests
Change all xml2sexpr tests to use the latest XEND_CONFIG_VERSION
(XEND_CONFIG_VERSION_3_1_0 = 4). Fix tests that do not conform to
the latest version.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-12-17 21:22:34 -07:00