Commit Graph

24119 Commits

Author SHA1 Message Date
Peter Krempa
b7a650c97c util: storage: Properly set protocol type when parsing gluster json string
Commit 2ed772cd forgot to set proper protocol. This was also present in
the test data.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1372251
2016-09-06 14:01:41 +02:00
Roman Mohr
56f09042ef docs: Add libvirt-go Go bindings to binding page
Signed-off-by: Roman Mohr <rmohr@redhat.com>
2016-09-06 13:09:37 +02:00
Nishith Shah
731ee28c5b virsh: Complete multiple options when any one option requires data
Before this patch:
    virsh # start --domain dom1 [TAB][TAB] <- offers filename completion
    virsh # start --domain [TAB][TAB] <- offers filename completion

After this patch:
    virsh # start --domain dom1 [TAB][TAB] <- offers command completion
    virsh # start --domain [TAB][TAB] <- calls domain completer if
    defined, otherwise falls back to filename completion

Signed-off-by: Nishith Shah <nishithshah.2211@gmail.com>
2016-09-05 14:16:45 +02:00
Nishith Shah
2550579669 virsh: Allow data or argument options to be completed as well
Signed-off-by: Nishith Shah <nishithshah.2211@gmail.com>
2016-09-05 14:16:45 +02:00
Nishith Shah
dcfdf341ea virsh: Introduce usage of option completers to auto-complete arguments
Call option completers if argument completion is requested using the
corresponding option completer, if it is defined.

Signed-off-by: Nishith Shah <nishithshah.2211@gmail.com>
2016-09-05 14:16:45 +02:00
Qiaowei Ren
bae660869d perf: add more perf events support
With current perf framework, this patch adds support and documentation
for more perf events, including cache misses, cache references, cpu cycles,
and instructions.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
2016-09-02 17:00:58 -04:00
Qiaowei Ren
b00d7f298b perf: Adjust the perf initialization
Introduce a static attr table and refactor virPerfEventEnable() for
general purpose usage.

This patch creates a static table/matrix that converts the VIR_PERF_EVENT_*
events into their respective "attr.type" and "attr.config" so that
virPerfEventEnable doesn't have the switch the calling function passes
by value the 'type'.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
2016-09-02 17:00:58 -04:00
John Ferlan
63358e0b87 util: Move virPerfNew and virPerfFree
Move them to the bottom under the #ifdef code.
2016-09-02 17:00:58 -04:00
John Ferlan
6a0e41519c virsh: Rework the perf event names into a table.
Should be easier to read
2016-09-02 17:00:58 -04:00
John Ferlan
29b2f253af virsh: Add a forward reference to perf command from domstats --perf
Keep the details in one place...
2016-09-02 17:00:58 -04:00
Qiaowei Ren
c2f061c861 util: Add some comment details for virPerfEventType
Add to some details for the existing enum
2016-09-02 17:00:58 -04:00
Qiaowei Ren
062f413928 perf: Remove the switch from qemuDomainGetStatsPerf
Remove the unnecessary switch since all VIR_PERF_EVENT* values are fetched
2016-09-02 17:00:58 -04:00
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