Commit Graph

28654 Commits

Author SHA1 Message Date
Andrea Bolognani
210385c3ee docs: Document pcie-root requirement for q35 guests
When you add a bunch of pcie-root-port controllers to a q35 guest
in order to have hotplug capabilities, you also need to make sure
you're adding the pcie-root controller at the same time or you
will get an error. Document this fact.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-20 09:35:48 +01:00
Laine Stump
a4b37cd0f1 tests: fix bhyve build
This file was modified in an editor buffer but not saved prior to
commit e62cb4a9b7 (which removed virMacAddr::generated), so the bhyve
build would fail.

Signed-off-by: Laine Stump <laine@laine.org>
2018-02-19 21:18:49 -05:00
Laine Stump
e62cb4a9b7 conf: move 'generated' member from virMacAddr to virDomainNetDef
Commit 7e62c4cd26 (first appearing in libvirt-3.9.0 as a resolution
to rhbz #1343919) added a "generated" attribute to virMacAddr that was
set whenever a mac address was auto-generated by libvirt. This
knowledge was used in a single place - when trying to match a NetDef
from the Domain to Delete with user-provided XML. Since the XML parser
always auto-generates a MAC address for NetDefs when none is provided,
it was previously impossible to make a search where the MAC address
isn't significant, but the addition of the "generated" attribute made
it possible for the search function to ignore auto-generated MACs.

This implementation had a problem though - it was adding a field to a
"low level" struct - virMacAddr - which is used in other places with
the assumption that it contains exactly a 6 byte MAC address and
nothing else. In particular, virNWFilterSnoopEthHdr uses virMacAddr as
part of the definition of an ethernet packet header, whose layout must
of course match an actual ethernet packet. Adding the extra bools into
virNWFilterSnoopEthHdr caused the nwfilter driver's "IP discovery via
DHCP packet snooping" functionality to mysteriously stop working.

In order to fix that behavior, and prevent potential future similar
odd behavior, this patch moves the "generated" member out of
virMacAddr (so that it is again really is just a MAC address) into
virDomainNetDef, and sets it only when virDomainNetGenerateMAC() is
called from virDomainNetDefParseXML() (which is the only time we care
about it).

Resolves: https://bugzilla.redhat.com/1529338

(It should also be applied to any maintenance branch that applies
commit 7e62c4cd26 and friends to resolve
https://bugzilla.redhat.com/1343919)

Signed-off-by: Laine Stump <laine@laine.org>
2018-02-19 13:15:00 -05:00
Andrea Bolognani
2f06f433ad docs: Fix indentation of inlined JavaScript snippet
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-02-19 17:32:20 +01:00
Daniel P. Berrangé
ffb7954f88 qemu: rename migration APIs to include Src or Dst in their name
It is very difficult while reading the migration code trying to
understand whether a particular function is being called on the src side
or the dst side, or either. Putting "Src" or "Dst" in the method names will
make this much more obvious. "Any" is used in a few helpers which can be
called from both sides.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-19 15:47:37 +00:00
Peter Krempa
8f5133f99e qemu: blockcopy: Add check for bandwidth
QEMU code does not work well with too big numbers on the JSON monitor so
our monitor code supports sending only numbers up to LLONG_MAX. Avoid a
weird error message by limiting the size of the 'bandwidth' parameter
for block copy.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-02-19 15:25:00 +01:00
Peter Krempa
ca9aac53d3 virsh: Fix internal naming of some blockjob commands
The variable names for the options and information about a command
should have an underscore in places where the virsh command has a
hyphen. The function callback name should capitalize the letter after
the hyphen. This was not used in 'blockcommit', 'blockcopy', 'blockjob',
'blockpull', and 'blockresize' commands.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-02-19 15:25:00 +01:00
Andrea Bolognani
f9159efec8 bhyve: Fix build
Commit 2d43f0a2dc dropped virDomainDiskTranslateSourcePool()'s
first argument but failed to update callers in the bhyve driver.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-02-19 14:22:07 +01:00
Daniel P. Berrangé
edda152c98 tests: remove networkRegister() call from qemuxml2argvtest
Further cleanup from

  commit 0c63c117a2
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Fri Feb 9 15:08:53 2018 +0000

    conf: reimplement virDomainNetResolveActualType in terms of public API

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-19 12:59:13 +00:00
Daniel P. Berrangé
51fdde208b tests: drop linkage to libvirt_driver_network_impl.la
The qemuxml2argvtest does not need to link to the network driver
after this commit:

  commit 0c63c117a2
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Fri Feb 9 15:08:53 2018 +0000

    conf: reimplement virDomainNetResolveActualType in terms of public API

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-19 12:11:40 +00:00
Daniel P. Berrangé
fb9557ddc1 qemu: don't export migration job APIs
These APIs are not required anywhere outside the migration code so need
not be exported to the rest of the QEMU driver.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-19 11:12:39 +00:00
Daniel P. Berrangé
82592551cb qemu: remove virConnectPtr in some migration methods
The qemuMigrationPrecreateStorage method needs a connection
to access the storage driver. Instead of passing it around,
open it at time of use.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-19 11:12:16 +00:00
Daniel P. Berrangé
a967615c4b qemu: remove virConnectPtr from some more startup code paths
There's a few places in startup code paths which pass around a
virConnectPtr which is no longer required. Specifically, the
qemuProcessStart() method now only requires a non-NULL connection if
autodestroy is requested.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-19 11:11:47 +00:00
Daniel P. Berrangé
6678a44777 qemu: stop passing in virConnectPtr for looking up networks
When setting up graphics, we sometimes need to resolve networks,
requiring the caller to pass in a virConnectPtr, except sometimes they
pass in NULL. Use virGetConnectNetwork() to acquire the connection to
the network driver when it is needed.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-19 11:11:47 +00:00
Daniel P. Berrangé
6ea0ae9619 qemu: don't pass virConnectPtr around for secrets
During domain startup there are many places where we need to acquire
secrets. Currently code passes around a virConnectPtr, except in the
places where we pass in NULL. So there are a few codepaths where ability
to start guests using secrets will fail. Change to acquire a handle to
the secret driver when needed.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-19 11:11:47 +00:00
Daniel P. Berrangé
2d43f0a2dc conf: stop passing virConnectPtr into virDomainDiskTranslateSourcePool
Rather than expecting callers to pass a virConnectPtr into the
virDomainDiskTranslateSourcePool() method, just acquire a connection
to the storage driver when needed.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-19 11:11:47 +00:00
Daniel P. Berrangé
aed679da85 qemu: stop passing virConnectPtr into qemuMonitorStartCPUs
There is a long standing hack to pass a virConnectPtr into the
qemuMonitorStartCPUs method, so that when the text monitor prompts
for a disk password, we can lookup virSecretPtr objects. This causes
us to have to pass a virConnectPtr around through countless methods
up the call chain....except some places don't have any virConnectPtr
available so have always just passed NULL. We can finally fix this
disastrous design by using virGetConnectSecret() to open a connection
to the secret driver at time of use.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-19 11:11:46 +00:00
Daniel P. Berrangé
0c63c117a2 conf: reimplement virDomainNetResolveActualType in terms of public API
Now that we have the ability to easily open connections to secondary
drivers, eg network:///system,  it is possible to reimplement the
virDomainNetResolveActualType method in terms of the public API. This
avoids the need to have the network driver provide a callback for it.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-19 11:11:46 +00:00
Daniel P. Berrangé
70854ea3bc driver: allow override of connection for secondary drivers
When the test suite is running, we don't want to be triggering the
startup of daemons for the secondary drivers. Thus we must provide a way
to set a custom connection for the secondary drivers, to override the
default logic which opens a new connection.

This will also be useful for code where we have a whole set of separate
functions calls all needing the secret driver. Currently the connection
to the secret driver is opened & closed many times in quick
succession. This will allow us to pre-open a connection temporarily,
improving the performance of startup.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-19 11:11:46 +00:00
Zhuang Yanying
fb0db76a47 news: Add support for setting Chassis SMBIOS data fields
Signed-off-by: Zhuang Yanying <ann.zhuangyanying@huawei.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-02-17 07:56:30 -05:00
Zhuang Yanying
204916d85f qemu: Generate SMBIOS Chassis strings command line
This wires up the previously added Chassis strings XML schema to be able to
generate comamnd line args for QEMU. This requires QEMU >= 2.1 release
containing this patch:

SMBIOS: Build aggregate smbios tables and entry point
https://git.qemu.org/?p=qemu.git;a=commit;h=c97294ec1b9e36887e119589d456557d72ab37b5

Signed-off-by: Zhuang Yanying <ann.zhuangyanying@huawei.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-02-17 07:36:59 -05:00
Zhuang Yanying
c8fec25692 conf: Add support for setting Chassis SMBIOS data fields
This type of information defines attributes of a system
chassis, such as SMBIOS Chassis Asset Tag.

access inside VM (for example)
Linux:   /sys/class/dmi/id/chassis_asset_tag.
Windows: (Get-WmiObject Win32_SystemEnclosure).SMBIOSAssetTag
          wirhin Windows PowerShell.

As an example, add the following to the guest XML

    <chassis>
      <entry name='manufacturer'>Dell Inc.</entry>
      <entry name='version'>2.12</entry>
      <entry name='serial'>65X0XF2</entry>
      <entry name='asset'>40000101</entry>
      <entry name='sku'>Type3Sku1</entry>
    </chassis>

Signed-off-by: Zhuang Yanying <ann.zhuangyanying@huawei.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-02-17 07:36:46 -05:00
Daniel P. Berrangé
9148293018 m4: disable gcc8 -Wcast-function-type warnings from -Wextra
The -Wextra flag bundle gained a new warning -Wcast-function-type.
This complains if you cast between two function prototypes where
the number of parameters or their data types are not compatible.
Unfortunately we need such "bad" function casts for our event
callbacks. It is possible to silence the warning by first casting
to the generic "void (*)(void)" function prototype, but that is
rather ugly to add throughout libvirt code.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-16 14:37:04 +00:00
Peter Krempa
f2f4e96060 virsh: Remove <backingStore> sub-element in virshFindDisk
Previously we've removed the data only in virshUpdateDiskXML when
changing the disk source for the CDROM since the backing store would be
invalid. Move the code into a separate function and callit from
virshFindDisk which is also used when detaching disk.

The detaching code does not necessarily need to get the full backing
chain since it will need to act on the one managed by libvirt anyways
and this also takes care of problems when parts of the backing store
were invalid due to buggy RBD detection code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-02-14 16:04:46 +01:00
Peter Krempa
28a36fe2ce util: storage: Remove detected authentication data for backing chains
We can't really detect all the authentication data in a sane manner for
disk backing chains. Since the old RBD parser parses it in some cases as
the argv->XML convertor requires it, we can't just drop it.

Instead clear any detected authentication data in the code paths related
to disk backing chain lookup and fix the tests to cope with the change.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-02-14 16:04:46 +01:00
Peter Krempa
431e73660e virsh: detach-disk: Add --print-xml switch
Similarly to other commands add an argument which allows to check the
XML which would be used to execute the operation instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-02-14 16:04:46 +01:00
Peter Krempa
d70d07eef8 virstoragetest: Add test case for NBD over unix socket with new syntax
Use the new syntax which uses the 'UnixSocket' type in qemu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-02-14 15:58:04 +01:00
Peter Krempa
a3a3de9bc7 storage: Fix formatting and parsing of qemu type 'UnixSocketAddress'
The documentation for the JSON/qapi type 'UnixSocketAddress' states that
the unix socket path field is named 'path'. Unfortunately qemu uses
'socket' in case of the gluster driver (despite documented otherwise).

Add logic which will format the correct fields while keeping support of
the old spelling.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-02-14 15:58:04 +01:00
Jiri Denemark
bc84bb9fe0 spec: Drop overlapping triggers
The postun trigger for libvirt-daemon was defined twice for overlapping
ranges of package verions if systemd support was switched off (which
happens when building on something ancient, such as RHEL-6).

Let's combine the two triggers into the one which is called when
libvirt-daemon < 1.3.0 is uninstalled. As a side effect, virtlockd and
virtlogd might be reloaded twice after an upgrade from libvirt newer
than 1.2.1 and older than 1.3.0 (by postun script from the old libvirt
and postun trigger from the new libvirt).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-14 15:55:18 +01:00
Jiri Denemark
cf555f9212 spec: Fix indentation in daemon's triggerpostun
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-14 15:55:18 +01:00
Jiri Denemark
b2ab38bfdc spec: Prepare for future RHEL
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-14 15:55:18 +01:00
Jiri Denemark
259b5ca73c spec: Drop checks for old Fedora releases
The oldest Fedora release supported by the spec file is 26. Checking for
anything older makes no sense.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-14 15:55:18 +01:00
Jiri Denemark
42188c1c65 spec: Build virt-login-shell iff LXC driver is enabled
Building virt-login-shell doesn't really make any sense without LXC and
doing so even breaks "make rpm" since the associated files are installed
but unpackaged (the login-shell sub package already depends on LXC).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-14 15:55:18 +01:00
Jiri Denemark
34783a9e6b spec: Enable fuse only if LXC is enabled
Enabling fuse without LXC does not make a lot of sense because fuse is
used only by LXC.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-14 15:55:18 +01:00
Michal Privoznik
b62b8090b2 qemu: Check for down limit of SLIRP prefix too
https://bugzilla.redhat.com/show_bug.cgi?id=1515533

We're already checking if IPv4 prefix isn't too long. But we are
not checking if it isn't too short. QEMU supports prefixes longer
than 4 (including). I haven't find anything similar related to
IPv6 in qemu sources.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-02-14 13:43:47 +01:00
Peter Krempa
9cae9c822b qemu: block: Remove misleading part of comment in qemuBlockStorageSourceBuildJSONSocketAddress
The array indexes are formatted if the JSON->commandline translator is
translating an array type. It does not at all depend on this function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-02-14 13:21:44 +01:00
Bjoern Walk
6fc33b6f37 tests: run virshtest independent of current pwd
virshtest execves the virsh binary. Make sure that it finds the binary's
location independent of the current working directory by specifying the
absolute path as determined by the build environment.

Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
2018-02-13 10:27:32 -05:00
Andrea Bolognani
e6f36ae435 tests: Clean up HPT tests
Give them better names and remove some redundancy.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-02-13 14:40:11 +01:00
Andrea Bolognani
3dd1eb3b26 conf: Improve HPT feature handling
Instead of storing separately whether the feature is enabled
or not and what resizing policy should be used, store both of
them in a single place.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-02-13 14:40:09 +01:00
Andrea Bolognani
c5a451ef21 conf: Improve IOAPIC feature handling
Instead of storing separately whether the feature is enabled
or not and what driver should be used, store both of them in
a single place.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-02-13 14:40:06 +01:00
Andrea Bolognani
132548efde qemu: Fix GIC behavior for the default case
When no GIC version is specified, we currently default to GIC v2;
however, that's not a great default, since guests will fail to
start if the hardware only supports GIC v3.

Change the behavior so that a sensible default is chosen instead.
That basically means using the same algorithm whether the user
didn't explicitly enable the GIC feature or they explicitly
enabled it but didn't specify any GIC version.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-02-13 14:40:03 +01:00
Andrea Bolognani
7500533c56 tests: Improve GIC tests
Account for the fact that the default might change based on what
GIC versions are supported by QEMU. That's not the case at the
moment, but it will be soon.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-02-13 14:40:02 +01:00
Andrea Bolognani
f3b4c98748 conf: Integrate all features ABI checks in the switch
There are a few stray checks which still live outside of the
switch in virDomainDefFeaturesCheckABIStability() for no good
reason. Move them inside the switch, and update the error
messages to be consistent while at it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-02-13 14:40:00 +01:00
Andrea Bolognani
5307206474 conf: Validate VIR_DOMAIN_FEATURE_CAPABILITIES properly
Unlike most other features, VIR_DOMAIN_FEATURE_CAPABILITIES is
of type virDomainCapabilitiesPolicy instead of virTristateSwitch,
so we need to handle it separately for the error message to make
sense.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-02-13 14:39:58 +01:00
Andrea Bolognani
a975c95967 conf: Use switch in virDomainDefFeaturesCheckABIStability()
The compiler can make sure we are handling all features.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-02-13 14:39:57 +01:00
Andrea Bolognani
f55fcb7e8f qemu: Move GIC checks to qemuDomainDefValidateFeatures()
Keep them along with other arch/machine type checks for
features instead of waiting until command line generation
time.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-02-13 14:39:55 +01:00
Andrea Bolognani
ce24802a6b qemu: Use switch in qemuDomainDefValidateFeatures()
The compiler can make sure we are handling all features.

While reworking the logic, also change error messages to a more
consistent style.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-02-13 14:39:53 +01:00
Andrea Bolognani
56ca68c3c8 qemu: Move feature verification from PostParse() to Validate()
We want to perform all feature verification in a single spot, but
some of it (eg. GIC) is currently being performed at command line
generation time, and moving it to PostParse() would cause guests
to disappear. Moving verification to Validate() allows us to
side-step the issue.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-02-13 14:39:49 +01:00
Andrea Bolognani
554a5edcb4 qemu: Fix indentation in qemuBuildControllerDevStr()
Add braces around the multi-line body as well, in compliance
with our coding style.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-02-12 18:55:38 +01:00
Daniel P. Berrangé
12bc2b817f Revert "qemu: Expose rx/tx_queue_size in qemu.conf too"
This reverts commit 038eb472a0.

On reflection adding defaults for arbitrary guest XML device config
settings to the qemu.conf is not a sustainable path. Removing the
support for rx/tx queue size so that it doesn't set a bad precedent.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-02-12 14:56:29 +00:00