Commit Graph

24057 Commits

Author SHA1 Message Date
Qiaowei Ren
f52b24d837 perf: rename qemuDomainGetStatsPerfRdt()
This patch rename qemuDomainGetStatsPerfRdt() to
qemuDomainGetStatsPerfOneEvent()

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
2016-09-02 17:00:58 -04:00
Nikolay Shirokovskiy
c62e79c8ca qemu: Filter cur_balloon ABI check for certain transactions
Since the domain lock is not held during preparation of an external XML
config, it is possible that the value can change resulting in unexpected
failures during ABI consistency checking for some save and migrate
operations.

This patch adds a new flag to skip the checking of the cur_balloon value
and then sets the destination value to the source value to ensure
subsequent checks without the skip flag will succeed.

This way it is protected from forges and is keeped up to date too.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-09-02 16:54:42 -04:00
Bob Liu
90e9817e85 xmconfigdata: drop tests for multi serial
xen-xm doesn't support mult serial devices at all, so these tests are
meaningless.

Signed-off-by: Bob Liu <bob.liu@oracle.com>
2016-09-02 12:46:03 -06:00
Bob Liu
b43f5e63d2 xlconfigdata: add tests for multi serial
Adding tests for domXML <-> xl.cfg conversions containing multiple
serial devices.

Signed-off-by: Bob Liu <bob.liu@oracle.com>
2016-09-02 12:46:02 -06:00
Bob Liu
faaebe1795 xenconfig: rm format/parse multi serial for xen-xm
xen-xm doesn't support multi serial at all, this patch drop the
domXML <-> xl.cfg conversions.

Signed-off-by: Bob Liu <bob.liu@oracle.com>
2016-09-02 12:46:02 -06:00
Bob Liu
846a1c6473 libxl: support serial list
Add support for multi serial devices, after this patch virsh can be used to
connect different serial devices of running domains. E.g.
vish # console <xxx> --devname serial<xxx>

Note:
This depends on a xen/libxl bug fix to have libxl_console_get_tty(...) correctly
returning the tty path (as opposed to always returning the first one).
[0] https://lists.xen.org/archives/html/xen-devel/2016-08/msg00438.html

Signed-off-by: Bob Liu <bob.liu@oracle.com>
2016-09-02 12:46:02 -06:00
Jim Fehlig
70f83f9d52 virpci: support driver_override sysfs interface
libvirt uses the new_id PCI sysfs interface to bind a PCI stub driver
to a PCI device. The new_id interface is known to be buggy and racey,
hence a more deterministic interface was introduced in the 3.12 kernel:
driver_override. For more details see

https://www.redhat.com/archives/libvir-list/2016-June/msg02124.html

For more details about the driver_override interface and examples of
its usage, see

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/pci/pci-driver.c?h=v3.12&id=782a985d7af26db39e86070d28f987cad21313c0

This patch adds support for the driver_override interface by

- adding new virPCIDevice{BindTo,UnbindFrom}StubWithOverride functions
  that use the driver_override interface
- renames the existing virPCIDevice{BindTo,UnbindFrom}Stub functions
  to virPCIDevice{BindTo,UnbindFrom}StubWithNewid to perserve existing
  behavior on new_id interface
- changes virPCIDevice{BindTo,UnbindFrom}Stub function to call one of
  the above depending on availability of driver_override

The patch includes a bit of duplicate code, but allows for easily
dropping the new_id code once support for older kernels is no
longer desired.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-09-02 11:47:23 -06:00
Cédric Bosdonnat
e01d300bb1 libxl: allow vendor/product addressing for USB hostdevs
libxl only has API to address the host USB devices by bus/device.
Find the bus/device if the user only provided the vendor/product
of the USB device.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-09-02 17:38:15 +02:00
Cédric Bosdonnat
ea46e00f12 Add virHostdevFindUSBDevice to private symbols
Finding an USB device from the vendor/device values will be needed
by libxl driver to convert from vendor/device to bus/dev addresses.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-09-02 17:38:09 +02:00
Xian Han Yu
f7658da6b3 conf: Fix initialization value of 'multi' in PCI address
The 'multi' element in PCI address struct used as 'virTristateSwitch',
and its default value is 'VIR_TRISTATE_SWITCH_ABSENT'. Current PCI
process use 'false' to initialization 'multi', which is ambiguously
for assignment or comparison. This patch use '{0}' to initialize
the whole PCI address struct, which fix the 'multi' initialization
and makes code more simplify and explicitly.

Signed-off-by: Xian Han Yu <xhyubj@linux.vnet.ibm.com>
2016-09-02 16:43:00 +02:00
Martin Kletzander
4c3b3ea399 Post-release version bump to 2.3.0
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-09-02 16:42:59 +02:00
Daniel Veillard
255f35e124 Release of libvirt-2.2.0
* docs/news.html.in: update for release
* po/*po*: regenerate
2016-09-02 15:28:51 +02:00
Kothapally Madhu Pavan
04597a7038 Make --postcopy flag mandatory with --postcopy-after-precopy
--postcopy-after-precopy is just an aditional flag for
postcopy migration.

Signed-off-by: Kothapally Madhu Pavan <kmp@linux.vnet.ibm.com>
2016-09-02 14:42:53 +02:00
Michal Privoznik
8540301b78 tools: Don't list virsh-* under EXTRA_DIST
When we wanted to break huge and unmaintainable virsh into
smaller files first thing we did was to just move funcs into
virsh-.c files and then #include them from virsh. Having it done
this way we also needed to have them listed under EXTRA_DIST.
However, things got changed since then and now all the virsh-*.c
files are proper source files. Therefore they are listed under
virsh_SOURCES too. But for some reason we forgot to remove them
from EXTRA_DIST.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-08-31 12:52:11 +02:00
Jim Fehlig
36f57ad7d7 libxl: advertise support for migration V3
The libxl driver has long supported migration V3 but has never
indicated so in the connectSupportsFeature API. As a result, apps
such as virt-manager that use the more generic virDomainMigrate API
fail with

libvirtError: this function is not supported by the connection driver:
virDomainMigrate

Add VIR_DRV_FEATURE_MIGRATION_V3 to the list of features marked as
supported in the connectSupportsFeature API.
2016-08-29 10:08:01 -06:00
Roman Bogorodskiy
6114807477 tests: fix segfault in objecteventtest
Test 12 from objecteventtest (createXML add event) segaults on FreeBSD
with bus error.

At some point it calls testNodeDeviceDestroy() from the test driver. And
it fails when it tries to unlock the device in the "out:" label of this
function.

Unlocking fails because the previous step was a call to
virNodeDeviceObjRemove from conf/node_device_conf.c. This function
removes the given device from the device list and cleans up the object,
including destroying of its mutex. However, it does not nullify the pointer
that was given to it.

As a result, we end up in testNodeDeviceDestroy() here:

 out:
    if (obj)
        virNodeDeviceObjUnlock(obj);

And instead of skipping this, we try to do Unlock and fail because of
malformed mutex.

Change virNodeDeviceObjRemove to use double pointer and set pointer to
NULL.
2016-08-29 13:51:56 +03:00
Roman Bogorodskiy
25ee22bdbc bhyve: fix disks address allocation
As bhyve currently doesn't use controller addressing and simply
uses 1 implicit controller for 1 disk device, the scheme looks the
following:

 pci addrees -> (implicit controller) -> disk device

So in fact we identify disk devices by pci address of implicit
controller and just pass it this way to bhyve in a form:

 -s pci_addr,ahci-(cd|hd),/path/to/disk

Therefore, we cannot use virDeviceInfoPCIAddressWanted() because it
does not expect that disk devices might need PCI address assignment.

As a result, if a disk was specified without address, it will not be
generated and domain will to start.

Until proper controller addressing is implemented in the bhyve
driver, force each disk to have PCI address generated if it was not
specified by user.
2016-08-29 09:37:06 +03:00
Kothapally Madhu Pavan
67af358d11 Check for --live flag for postcopy-after-precopy migration
Unlike postcopy migration there is no --live flag check for
postcopy-after-precopy.

Signed-off-by: Kothapally Madhu Pavan <kmp@linux.vnet.ibm.com>
2016-08-26 21:38:11 +02:00
Christophe Fergeau
2ff85c28a0 docs: Add missing / to closing tag
The iothread example for virtio-scsi should be
<driver iothread='4'/> rather than <driver iothread='4'>
for the XML to be valid.
2016-08-26 14:58:00 -04:00
Peter Krempa
9cf086be6d conf: Fix build with picky GCC
../../src/conf/domain_conf.c:4425:21: error: potential null pointer dereference [-Werror=null-dereference]
         switch (vcpu->hotpluggable) {
                 ~~~~^~~~~~~~~~~~~~
2016-08-26 11:32:38 -04:00
Peter Krempa
802fac97ec qemu: driver: Validate configuration when setting maximum vcpu count
Setting vcpu count when cpu topology is specified may result into an
invalid configuration. Since the topology can't be modified, reject the
setting if it doesn't match the requested topology. This will allow
fixing the topology in case it was broken.

Partially fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1370066
2016-08-26 11:30:17 -04:00
Peter Krempa
c9cb35c255 conf: Don't validate vcpu count in XML parser
Validating the vcpu count is more intricate and doing it in the XML
parser will make previously valid configs (with older qemus) vanish.

Now that we have a very similar check in the qemu domain validation
callback we can do it in a more appropriate place.

This basically reverts commit b54de0830a.

Partially resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1370066
2016-08-26 11:26:59 -04:00
Peter Krempa
54147fd9be doc: clarify documentation for vcpu order
Make it clear that vcpu order is valid for online vcpus only and state
that it has to be specified for all vcpus or not provided at all.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1370043
2016-08-26 11:23:00 -04:00
Peter Krempa
9b6e947b01 qemu: driver: Fix qemuDomainHelperGetVcpus for sparse vcpu topologies
ce43cca0e refactored the helper to prepare it for sparse topologies but
forgot to fix the iterator used to fill the structures. This would
result into a weirdly sparse populated array and possible out of bounds
access and crash once sparse vcpu topologies were allowed.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1369988
2016-08-26 11:23:00 -04:00
Peter Krempa
64f26276bf virsh: vcpuinfo: Report vcpu number from the structure rather than it's position
virVcpuInfo contains the vcpu number that the data refers to. Report
what's returned by the daemon rather than the sequence number as with
sparse vcpu topologies they won't match.
2016-08-26 11:23:00 -04:00
Mikhail Feoktistov
0c3e499c78 vz: getting bus type for containers
We should query bus type for containers too, like for VM.
In openstack we add volume disk like SCSI, so we can't
hardcode SATA bus.
2016-08-26 17:48:55 +03:00
Nikolay Shirokovskiy
836a2c78ca vz: update domain cache after device updates 2016-08-26 17:48:29 +03:00
Olga Krishtal
3a6cf6fc16 vz: fixed race in vzDomainAttach/DettachDevice
While dettaching/attaching device in OpenStack, nova
calls vzDomainDettachDevice twice, because the update of the internal
configuration of the ct comes a bit latter than the update event.
As the result, we suffer from the second call to dettach the same device.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
2016-08-26 17:48:12 +03:00
Pavel Glushchak
2354266acf vz: added VIR_MIGRATE_PARAM_BANDWIDTH param handling
libvirt-python passes parameter bandwidth = 0
by default. This means that bandwidth is unlimited.
VZ driver doesn't support bandwidth rate limiting,
but we still need to handle it and fail if bandwidth > 0.

Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
2016-08-26 14:59:22 +03:00
Pavel Glushchak
d7af2218b6 vz: implicitly support additional migration flags
* Added VIR_MIGRATE_LIVE, VIR_MIGRATE_UNDEFINE_SOURCE and
  VIR_MIGRATE_PERSIST_DEST to supported migration flags

Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
2016-08-26 14:59:13 +03:00
Laine Stump
0726222123 qemu: set tap device online for type='ethernet'
When support for auto-creating tap devices was added to <interface
type='ethernet'> in commit 9c17d6, the code assumed that
virNetDevTapCreate() would honor the VIR_NETDEV_TAP__CREATE_IFUP flag
that is supported by virNetDevTapCreateInBridgePort(). That isn't the
case - the latter function performs several operations, and one of
them is setting the tap device online. But virNetDevTapCreate() *only*
creates the tap device, and relies on the caller to do everything
else, so qemuInterfaceEthernetConnect() needs to call
virNetDevSetOnline() after the device is successfully created.
2016-08-25 18:54:01 -04:00
Laine Stump
dbb7903932 qemu: remove unnecessary setting of tap device online state
The linkstate setting of an <interface> is only meant to change the
online status reported to the guest system by the emulated network
device driver in qemu, but when support for auto-creating tap devices
for <interface type='ethernet'> was added in commit 9717d6, a chunk of
code was also added to qemuDomainChangeNetLinkState() that sets the
online status of the tap device (i.e. the *host* side of the
interface) for type='ethernet'. This was never done for tap devices
used in type='bridge' or type='network' interfaces, nor was it done in
the past for tap devices created by external scripts for
type='ethernet', so we shouldn't be doing it now.

This patch removes the bit of code in qemuDomainChangeNetLinkState()
that modifies online status of the tap device.
2016-08-25 18:51:51 -04:00
Vasiliy Tolstov
5f243153c5 qemu: fix ethernet network type ip/route assign
The call to virNetDevIPInfoAddToDev() that sets up tap device IP
addresses and routes was somehow incorrectly placed in
qemuInterfaceStopDevice() instead of qemuInterfaceStartDevice() in
commit fe8567f6.  This fixes that error by moving the call to
virNetDevIPInfoAddToDev() to qemuInterfaceStartDevice().

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
2016-08-25 18:51:12 -04:00
Peter Krempa
e3229f6e44 qemu: hotplug: Add support for VCPU unplug
This patch removes the old vcpu unplug code completely and replaces it
with the new code using device_del. The old hotplug code basically never
worked with any recent qemu and thus is useless.

As the new code is using device_del all the implications of using it
are present. Contrary to the device deletion code, the vcpu deletion
code fails if the unplug request is not executed in time.
2016-08-24 15:44:47 -04:00
Peter Krempa
00990d9f4c qemu: hotplug: Allow marking unplugged devices by alias
Add a overlay function that takes the alias directly rather than
extracting it from a device info.
2016-08-24 15:44:47 -04:00
Peter Krempa
6d4ee77d75 qemu: Use modern vcpu hotplug approach if possible
To allow unplugging the vcpus, hotplugging of vcpus on platforms which
require to plug multiple logical vcpus at once or plugging them in an
arbitrary order it's necessary to use the new device_add interface for
vcpu hotplug.

This patch adds support for the device_add interface using the old
setvcpus API by implementing an algorithm to select the appropriate
entities to plug in.
2016-08-24 15:44:47 -04:00
Peter Krempa
9eb9106ea5 qemu: command: Add support for sparse vcpu topologies
Add support for using the new approach to hotplug vcpus using device_add
during startup of qemu to allow sparse vcpu topologies.

There are a few limitations imposed by qemu on the supported
configuration:
- vcpu0 needs to be always present and not hotpluggable
- non-hotpluggable cpus need to be ordered at the beginning
- order of the vcpus needs to be unique for every single hotpluggable
  entity

Qemu also doesn't really allow to query the information necessary to
start a VM with the vcpus directly on the commandline. Fortunately they
can be hotplugged during startup.

The new hotplug code uses the following approach:
- non-hotpluggable vcpus are counted and put to the -smp option
- qemu is started
- qemu is queried for the necessary information
- the configuration is checked
- the hotpluggable vcpus are hotplugged
- vcpus are started

This patch adds a lot of checking code and enables the support to
specify the individual vcpu element with qemu.
2016-08-24 15:44:47 -04:00
Peter Krempa
20ef1232ec qemu: process: Copy final vcpu order information into the vcpu definition
The vcpu order information is extracted only for hotpluggable entities,
while vcpu definitions belonging to the same hotpluggable entity need
to all share the order information.

We also can't overwrite it right away in the vcpu info detection code as
the order is necessary to add the hotpluggable vcpus enabled on boot in
the correct order.

The helper will store the order information in places where we are
certain that it's necessary.
2016-08-24 15:44:47 -04:00
Peter Krempa
8807f28b85 qemu: command: Add helper to convert vcpu definition to JSON props
For use on the monitor we need to format certain parts of the vcpu
private definition into a JSON object. Add a helper.
2016-08-24 15:44:47 -04:00
Peter Krempa
48e3d42889 qemu: migration: Prepare for non-contiguous vcpu configurations
Introduce a new migration cookie flag that will be used for any
configurations that are not compatible with libvirt that would not
support the specific vcpu hotplug approach. This will make sure that old
libvirt does not fail to reproduce the configuration correctly.
2016-08-24 15:44:47 -04:00
Peter Krempa
5847bc5c64 conf: Add XML for individual vCPU hotplug
Individual vCPU hotplug requires us to track the state of any vCPU. To
allow this add the following XML:

<domain>
  ...
  <vcpu current='2'>3</vcpu>
  <vcpus>
    <vcpu id='0' enabled='yes' hotpluggable='no' order='1'/>
    <vcpu id='1' enabled='yes' hotpluggable='yes' order='2'/>
    <vcpu id='1' enabled='no' hotpluggable='yes'/>
  </vcpus>
  ...

The 'enabled' attribute allows to control the state of the vcpu.
'hotpluggable' controls whether given vcpu can be hotplugged and 'order'
allows to specify the order to add the vcpus.
2016-08-24 15:44:47 -04:00
Peter Krempa
c84c2cb389 util: Extract and rename qemuDomainDelCgroupForThread to virCgroupDelThread 2016-08-24 15:44:47 -04:00
Peter Krempa
133be0a9e2 qemu: domain: Prepare for VCPUs vanishing while libvirt is not running
Similarly to devices the guest may allow unplug of the VCPU if libvirt
is down. To avoid problems, refresh the vcpu state on reconnect. Don't
mess with the vcpu state otherwise.
2016-08-24 15:44:47 -04:00
Peter Krempa
6b4a23ff6c qemu: domain: Extract cpu-hotplug related data
Now that the monitor code gathers all the data we can extract it to
relevant places either in the definition or the private data of a vcpu.

As only thread id is broken for TCG guests we may extract the rest of
the data and just skip assigning of the thread id. In case where qemu
would allow cpu hotplug in TCG mode this will make it work eventually.
2016-08-24 15:44:47 -04:00
Peter Krempa
04fce1d496 tests: cpu-hotplug: Add data for ppc64 without threads enabled
The reported data is unusual so add it to the test suite.
2016-08-24 15:44:47 -04:00
Peter Krempa
1c455c4743 tests: cpu-hotplug: Add data for ppc64 out-of-order hotplug
Test the algorithm that extracts the order in which the vcpu entries
were plugged in on a sample of data created by plugging in vcpus
arbitrarily.
2016-08-24 15:44:47 -04:00
Peter Krempa
d1145aad0b tests: cpu-hotplug: Add data for ppc64 platform including hotplug
Power 8 platform's basic hotpluggable unit is a core rather than a
thread for x86_64 family. This introduces most of the complexity of the
matching code and thus needs to be tested.

The test data contain data captured from in-order cpu hotplug and
unplug operations.
2016-08-24 15:44:47 -04:00
Peter Krempa
22e3bb332e tests: cpu-hotplug: Add data for x86 hotplug with 11+ vcpus
During review it was reported that adding at least 11 vcpus creates a
collision of prefixes in the monitor matching algorithm. Add a test case
to verify that the problem won't happen.
2016-08-24 15:44:47 -04:00
Peter Krempa
f8638471d7 tests: Add test infrastructure for qemuMonitorGetCPUInfo
As the combination algorithm is rather complex and ugly it's necessary
to make sure it works properly. Add test suite infrastructure for
testing it along with a basic test based on x86_64 platform.
2016-08-24 15:44:47 -04:00
Peter Krempa
9bbbc88a8f qemu: monitor: Add algorithm for combining query-(hotpluggable-)-cpus data
For hotplug purposes it's necessary to retrieve data using
query-hotpluggable-cpus while the old query-cpus API report thread IDs
and order of hotplug.

This patch adds code that merges the data using a rather non-trivial
algorithm and fills the data to the qemuMonitorCPUInfo structure for
adding to appropriate place in the domain definition.
2016-08-24 15:44:47 -04:00