]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
7 years agoqemu: monitor: Don't bother extracting vCPU halted state in text monitor
Peter Krempa [Thu, 18 May 2017 11:27:24 +0000 (13:27 +0200)]
qemu: monitor: Don't bother extracting vCPU halted state in text monitor

The code causes the 'offset' variable to be overwritten (possibly with
NULL if neither of the vCPUs is halted) which causes a crash since the
variable is still used after that part.

Additionally there's a bug, since strstr() would look up the '(halted)'
string in the whole string rather than just the currently processed line
the returned data is completely bogus.

Rather than switching to single line parsing let's remove the code
altogether since it has a commonly used JSON monitor alternative and
the data itself is not very useful to report.

The code was introduced in commit cc5e695bde

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

7 years agodatatypes: removing unnecessary return statement.
Julio Faracco [Thu, 18 May 2017 01:53:23 +0000 (22:53 -0300)]
datatypes: removing unnecessary return statement.

There is a wrong 'return' statement after a 'goto' statement inside the
function virConnectCloseCallbackDataRegister(). This commit only removes
the 'return'.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
7 years agovirStream: Forbid negative seeks
Michal Privoznik [Thu, 18 May 2017 06:27:27 +0000 (08:27 +0200)]
virStream: Forbid negative seeks

Currently, we don't assign any meaning to that. Our current view
on virStream is that it's merely a pipe. And pipes don't support
seeking.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agonews: Document sparse streams
Michal Privoznik [Thu, 18 May 2017 06:17:52 +0000 (08:17 +0200)]
news: Document sparse streams

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agonodedev: mdev: Fix build caused by symbol shadowing
Erik Skultety [Thu, 18 May 2017 12:43:05 +0000 (14:43 +0200)]
nodedev: mdev: Fix build caused by symbol shadowing

GCC 4.6 complains about a local declaration shadowing a global symbol.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agoutil: Do not leak @handles in stop netlink event service
Wang King [Thu, 18 May 2017 04:06:42 +0000 (12:06 +0800)]
util: Do not leak @handles in stop netlink event service

Commit e3ba4025 introduced srv->handles and VIR_RESIZE_N to allocate
@handles as necessary, but did not free the handles during when calling
virNetlinkEventServiceStop.

7 years agoutil: Deduplicate code in virNetlinkEventServiceStopAll
Wang King [Thu, 18 May 2017 04:06:41 +0000 (12:06 +0800)]
util: Deduplicate code in virNetlinkEventServiceStopAll

Commit 15a71e60 introduced the virNetlinkEventServiceStopAll function, and
the code in virNetlinkEventServiceStop is copied to this function, so just
call virNetlinkEventServiceStop instead.

7 years agodocs: Document the mediated devices within the nodedev driver
Erik Skultety [Wed, 29 Mar 2017 10:36:31 +0000 (12:36 +0200)]
docs: Document the mediated devices within the nodedev driver

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agonodedev: Introduce mdev capability for mediated devices
Erik Skultety [Mon, 6 Mar 2017 16:18:48 +0000 (17:18 +0100)]
nodedev: Introduce mdev capability for mediated devices

Start discovering the mediated devices on the host system and format the
attributes for the mediated device into the XML. Compared to the parent
device which reports generic information about the abstract mediated
devices types, a child device only reports the type name it has been
instantiated from and the IOMMU group number, since that's device
specific compared to the rest of the info that can be gathered about
mediated devices at the moment.
This patch introduces both the formatting and parsing routines, updates
nodedev.rng schema, adding a testcase as well.

The resulting mdev child device XML:
<device>
  <name>mdev_4b20d080_1b54_4048_85b3_a6a62d165c01</name>
  <path>/sys/devices/.../4b20d080-1b54-4048-85b3-a6a62d165c01</path>
  <parent>pci_0000_06_00_0</parent>
  <driver>
    <name>vfio_mdev</name>
  </driver>
  <capability type='mdev'>
    <type id='vendor_supplied_type_id'/>
    <iommuGroup number='NUM'/>
  <capability/>
<device/>

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agonodedev: Introduce the mdev capability to a PCI parent device
Erik Skultety [Mon, 6 Mar 2017 16:17:34 +0000 (17:17 +0100)]
nodedev: Introduce the mdev capability to a PCI parent device

The parent device needs to report the generic stuff about the supported
mediated devices types, like device API, available instances, type name,
etc. Therefore this patch introduces a new nested capability element of
type 'mdev_types' with the resulting XML of the following format:

<device>
  ...
  <capability type='pci'>
    ...
    <capability type='mdev_types'>
      <type id='vendor_supplied_id'>
        <name>optional_vendor_supplied_codename</name>
        <deviceAPI>vfio-pci</deviceAPI>
        <availableInstances>NUM</availableInstances>
      </type>
        ...
      <type>
        ...
      </type>
    </capability>
  </capability>
  ...
</device>

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agonodedev: Introduce new mdev_types and mdev nodedev capabilities
Erik Skultety [Mon, 6 Mar 2017 16:20:00 +0000 (17:20 +0100)]
nodedev: Introduce new mdev_types and mdev nodedev capabilities

The reason for introducing two capabilities, one for the device itself
(cap 'mdev') and one for the parent device listing the available types
('mdev_types'), is that we should be able to do
'virsh nodedev-list --cap' not only for existing mdev devices but also
for devices that support creation of mdev devices, since one day libvirt
might be actually able to create the mdev devices in an automated way
(just like we do for NPIV/vHBA).

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agonodedev: conf: Split PCI sub-capability parsing to separate methods
Erik Skultety [Tue, 18 Apr 2017 13:56:13 +0000 (15:56 +0200)]
nodedev: conf: Split PCI sub-capability parsing to separate methods

Since there's at least SRIOV and MDEV sub-capabilities to be parsed,
let's make the code more readable by splitting it to several logical
blocks.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agomdev: Pass a uuidstr rather than an mdev object to some util functions
Erik Skultety [Wed, 26 Apr 2017 12:47:15 +0000 (14:47 +0200)]
mdev: Pass a uuidstr rather than an mdev object to some util functions

Namely, this patch is about virMediatedDeviceGetIOMMUGroup{Dev,Num}
functions. There's no compelling reason why these functions should take
an object, on the contrary, having to create an object every time one
needs to query the IOMMU group number, discarding the object afterwards,
seems odd.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agopci: fix link maximum speed detection
Marek Marczykowski-Górecki [Tue, 16 May 2017 13:19:19 +0000 (15:19 +0200)]
pci: fix link maximum speed detection

Commit 8e09663 "pci: recognize/report GEN4 (PCIe 4.0) card 16GT/s Link
speed" introduced another speed into enum, but mistakenly also altered
field width, so one bit of link width was included there.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
7 years agovirsh: Implement sparse stream to vol-upload
Michal Privoznik [Wed, 27 Apr 2016 12:21:10 +0000 (14:21 +0200)]
virsh: Implement sparse stream to vol-upload

Similarly to previous commit, implement sparse streams feature
for vol-upload. This is, however, slightly different approach,
because we must implement a function that will tell us whether
we are in a data section or in a hole. But there's no magic
hidden in here.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirsh: Implement sparse stream to vol-download
Michal Privoznik [Tue, 12 Apr 2016 13:35:04 +0000 (15:35 +0200)]
virsh: Implement sparse stream to vol-download

Add a new --sparse switch that does nothing more than
enables the sparse streams feature for this command. Among with
the switch new helper function is introduced: virshStreamSkip().
This is the callback that is called whenever daemon sends us a
hole. In the callback we reflect the hole in underlying file by
seeking as many bytes as told.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoIntroduce virStorageVol{Download,Upload}Flags
Michal Privoznik [Fri, 8 Apr 2016 13:41:18 +0000 (15:41 +0200)]
Introduce virStorageVol{Download,Upload}Flags

These flags to APIs will tell if caller wants to use sparse
stream for storage transfer. At the same time, it's safe to
enable them in storage driver frontend and rely on our backends
checking the flags. This way we can enable specific flags only on
some specific backends, e.g. enable
VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM for filesystem backend but
not iSCSI backend.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agogendispatch: Introduce @sparseflag for our calls
Michal Privoznik [Tue, 12 Apr 2016 13:17:30 +0000 (15:17 +0200)]
gendispatch: Introduce @sparseflag for our calls

Now, not all APIs are going to support sparse streams. To some it
makes no sense at all, e.g. virDomainOpenConsole() or
virDomainOpenChannel(). To others, we will need a special flag to
indicate that client wants to enable sparse streams. Instead of
having to write RPC dispatchers by hand we can just annotate in
our .x files that a certain flag to certain RPC call enables this
feature. For instance:

     /**
      * @generate: both
      * @readstream: 1
      * @sparseflag: VIR_SPARSE_STREAM
      * @acl: storage_vol:data_read
      */
     REMOTE_PROC_DOMAIN_SOME_API = XXX,

Therefore, whenever client calls virDomainSomeAPI(..,
VIR_SPARSE_STREAM); daemon will mark that down and send stream
skips when possible.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agofdstream: Implement sparse stream
Michal Privoznik [Wed, 27 Apr 2016 08:51:46 +0000 (10:51 +0200)]
fdstream: Implement sparse stream

Basically, what is needed here is to introduce new message type
for the messages passed between the event loop callbacks and the
worker thread that does all the I/O. The idea is that instead of
a queue of read buffers we will have a queue where "hole of size
X" messages appear. That way the event loop callbacks can just
check the head of the queue and see if the worker thread is in
data or a hole section and how long the section is.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agodaemonStreamHandleRead: Wire up seekable stream
Michal Privoznik [Mon, 11 Apr 2016 09:58:19 +0000 (11:58 +0200)]
daemonStreamHandleRead: Wire up seekable stream

Whenever client is able to receive some data from stream
daemonStreamHandleRead is called. But now the behaviour of this
function needs to be changed a bit. Previously it just read data
from underlying file (of chardev or whatever) and sent those
through the stream to client. This model will not work any longer
because it does not differentiate whether underlying file is in
data or hole section. Therefore, at the beginning of this
function add code that checks this situation and acts
accordingly.
So after the this, when wanting to send some data we always check
whether we are not in a hole and if so, skip it an inform client
about its size.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoremote_driver: Implement VIR_STREAM_RECV_STOP_AT_HOLE
Michal Privoznik [Fri, 20 May 2016 14:44:22 +0000 (16:44 +0200)]
remote_driver: Implement VIR_STREAM_RECV_STOP_AT_HOLE

This is fairly trivial now that we have everything in place.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirNetClientStream: Wire up VIR_NET_STREAM_HOLE
Michal Privoznik [Fri, 20 May 2016 14:35:13 +0000 (16:35 +0200)]
virNetClientStream: Wire up VIR_NET_STREAM_HOLE

Whenever server sends a client stream packet (either regular with
actual data or stream skip one) it is queued on @st->rx. So the
list is a mixture of both types of stream packets. So now that we
have all the helpers needed we can wire their processing up. But
since virNetClientStreamRecvPacket doesn't support
VIR_STREAM_RECV_STOP_AT_HOLE flag yet, let's turn all received
skips into zeroes repeating requested times.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoremote: Implement virStreamRecvHole
Michal Privoznik [Fri, 20 May 2016 13:28:42 +0000 (15:28 +0200)]
remote: Implement virStreamRecvHole

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoIntroduce virNetClientStreamRecvHole
Michal Privoznik [Fri, 20 May 2016 13:28:29 +0000 (15:28 +0200)]
Introduce virNetClientStreamRecvHole

This function will fetch previously processed stream holes and
return their sum.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirNetClientStreamRecvPacket: Introduce @flags argument
Michal Privoznik [Fri, 20 May 2016 11:04:29 +0000 (13:04 +0200)]
virNetClientStreamRecvPacket: Introduce @flags argument

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoremote_driver: Implement virStreamSendHole
Michal Privoznik [Sun, 10 Apr 2016 13:48:27 +0000 (15:48 +0200)]
remote_driver: Implement virStreamSendHole

Now that we have RPC wrappers over VIR_NET_STREAM_HOLE we can
start wiring them up. This commit wires up situation when a
client wants to send a hole to daemon.

To keep stream offsets synchronous, upon successful call on the
daemon skip the same hole in local part of the stream.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirnetclientstream: Introduce virNetClientStreamHandleHole
Michal Privoznik [Fri, 12 May 2017 09:27:53 +0000 (11:27 +0200)]
virnetclientstream: Introduce virNetClientStreamHandleHole

This is a function that handles an incoming STREAM_HOLE packet.
Even though it is not wired up yet, it will be soon. At the
beginning do couple of checks whether server plays nicely and
sent us a STREAM_HOLE packed only after we've enabled sparse
streams. Then decodes the message payload to see how big the hole
is and stores it in passed @length argument.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agodaemon: Implement VIR_NET_STREAM_HOLE handling
Michal Privoznik [Fri, 12 May 2017 09:26:33 +0000 (11:26 +0200)]
daemon: Implement VIR_NET_STREAM_HOLE handling

Basically, whenever the new type of stream packet arrives to the
daemon call this function that decodes it and calls
virStreamSendHole(). Otherwise a regular data stream packet has
arrived and therefore continue its processing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirnetclientstream: Introduce virNetClientStreamSendHole
Michal Privoznik [Mon, 11 Apr 2016 15:23:17 +0000 (17:23 +0200)]
virnetclientstream: Introduce virNetClientStreamSendHole

While the previous commit implemented a helper for sending a
STREAM_HOLE packet for daemon, this is a client's counterpart.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agodaemon: Introduce virNetServerProgramSendStreamHole
Michal Privoznik [Mon, 11 Apr 2016 09:44:42 +0000 (11:44 +0200)]
daemon: Introduce virNetServerProgramSendStreamHole

This is just a helper function that takes in a length value,
encodes it into XDR and sends to client.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoTeach wireshark plugin about VIR_NET_STREAM_HOLE
Michal Privoznik [Wed, 13 Apr 2016 14:38:09 +0000 (16:38 +0200)]
Teach wireshark plugin about VIR_NET_STREAM_HOLE

Ideally, this would be generated, but to achieve that
corresponding XDR definitions needed to go into a different .x
file. But they belong just to the one that they are right now.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoIntroduce VIR_NET_STREAM_HOLE message type
Michal Privoznik [Mon, 4 Apr 2016 12:54:46 +0000 (14:54 +0200)]
Introduce VIR_NET_STREAM_HOLE message type

This is a special type of stream packet, that is bidirectional
and contains information regarding how many bytes each side will
be skipping in the stream.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoRPC: Introduce virNetStreamHole
Michal Privoznik [Mon, 11 Apr 2016 14:58:15 +0000 (16:58 +0200)]
RPC: Introduce virNetStreamHole

This is going to be RPC representation for virStreamSendHole.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoAdd new flag to daemonCreateClientStream and virNetClientStreamNew
Michal Privoznik [Mon, 11 Apr 2016 14:50:04 +0000 (16:50 +0200)]
Add new flag to daemonCreateClientStream and virNetClientStreamNew

Add a new argument to daemonCreateClientStream in order to allow for
future expansion to mark that a specific stream can be used to skip
data, such as the case with sparsely populated files. The new flag will
be the eventual decision point between client/server to decide whether
both ends can support and want to use sparse streams.

A new bool 'allowSkip' is added to both _virNetClientStream and
daemonClientStream in order to perform the tracking.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirNetClientStreamNew: Track origin stream
Michal Privoznik [Tue, 12 Apr 2016 09:38:12 +0000 (11:38 +0200)]
virNetClientStreamNew: Track origin stream

Add a virStreamPtr pointer to the _virNetClientStream
in order to reverse track the parent stream.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoIntroduce virStreamInData
Michal Privoznik [Sat, 21 May 2016 12:25:14 +0000 (14:25 +0200)]
Introduce virStreamInData

This is just an internal API, that calls corresponding function
in stream driver. This function will set @data = 1 if the
underlying file is in data section, or @data = 0 if it is in a
hole. At any rate, @length is set to number of bytes remaining in
the section the file currently is.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoIntroduce virStreamSparseSendAll
Michal Privoznik [Sat, 21 May 2016 13:47:39 +0000 (15:47 +0200)]
Introduce virStreamSparseSendAll

This is just a wrapper over new function that have been just
introduced: virStreamSendHole() . It's very similar to
virStreamSendAll() except it handles sparse streams well.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoIntroduce virStreamSparseRecvAll
Michal Privoznik [Sat, 21 May 2016 13:17:51 +0000 (15:17 +0200)]
Introduce virStreamSparseRecvAll

This is just a wrapper over new functions that have been just
introduced: virStreamRecvFlags(), virStreamRecvHole(). It's very
similar to virStreamRecvAll() except it handles sparse streams
well.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoIntroduce VIR_STREAM_RECV_STOP_AT_HOLE flag
Michal Privoznik [Fri, 20 May 2016 13:12:59 +0000 (15:12 +0200)]
Introduce VIR_STREAM_RECV_STOP_AT_HOLE flag

Add a new flag to virStreamRecvFlags in order to handle being able to
stop reading from the stream so that the consumer can generate a "hole"
in stream target. Generation of a hole replaces the need to receive and
handle a sequence of zero bytes for sparse stream targets.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoIntroduce virStreamRecvHole
Michal Privoznik [Fri, 20 May 2016 13:03:11 +0000 (15:03 +0200)]
Introduce virStreamRecvHole

This function is basically a counterpart for virStreamSendHole().
If one side of a stream called virStreamSendHole() the other
should call virStreamRecvHole() to get the size of the hole.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoIntroduce virStreamSendHole
Michal Privoznik [Sun, 10 Apr 2016 10:01:20 +0000 (12:01 +0200)]
Introduce virStreamSendHole

This API is used to tell the other side of the stream to skip
some bytes in the stream. This can be used to create a sparse
file on the receiving side of a stream.

It takes @length argument, which says how big the hole is. This
skipping is done from the current point of stream. Since our
streams are not rewindable like regular files, we don't need
@whence argument like seek(2) has.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoImplement virStreamRecvFlags to some drivers
Michal Privoznik [Thu, 19 May 2016 15:34:23 +0000 (17:34 +0200)]
Implement virStreamRecvFlags to some drivers

There are three virStreamDriver's currently supported:

 * virFDStream
 * remote driver
 * ESX driver

For now, backend virStreamRecvFlags support for only remote driver and
ESX driver is sufficient. Future patches will update virFDStream.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoIntroduce virStreamRecvFlags
Michal Privoznik [Thu, 19 May 2016 14:53:35 +0000 (16:53 +0200)]
Introduce virStreamRecvFlags

This patch is adding the virStreamRecvFlags as a variant to the
virStreamRecv function in order to allow for future expansion of
functionality for processing sparse streams using a @flags
argument.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoutil: Introduce virFileInData
Michal Privoznik [Thu, 16 Jun 2016 08:42:47 +0000 (10:42 +0200)]
util: Introduce virFileInData

This function takes a FD and determines whether the current
position is in data section or in a hole. In addition to that,
it also determines how much bytes are there remaining till the
current section ends.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirfdstream: Use messages instead of pipe
Michal Privoznik [Thu, 13 Apr 2017 09:49:30 +0000 (11:49 +0200)]
virfdstream: Use messages instead of pipe

One big downside of using the pipe to transfer the data is that
we can really transfer just bare data. No metadata can be carried
through unless some formatted messages are introduced. That would
be quite painful to achieve so let's use a message queue. It's
fairly easy to exchange info between threads now that iohelper is
no longer used.

The reason why we cannot use the FD for plain files directly is
that despite us setting noblock flag on the FD, any
read()/write() blocks regardless (which is a show stopper since
those parts of the code are run from the event loop) and poll()
reports such FD as always readable/writable - even though the
subsequent operation might block.

The pipe is still not gone though. It is used to signal the event
loop that an event occurred (e.g. data is available for reading
in the queue, or vice versa).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirsh: add --io when attaching disks to guests
Gordon Messmer [Fri, 12 May 2017 21:27:27 +0000 (14:27 -0700)]
virsh: add --io when attaching disks to guests

virt-install and virt-manager both default to explicitly setting
"io='native'" in the disk "driver" tag. virsh, however, does not and also
does not provide an option to specify that setting at all.  As a result,
disks use a different IO mechanism (the default, "threads") when attached
post-setup using virsh.  Adding this option allows users to keep disk
performance consistent for disks attached at install, and those attached
afterward.

7 years agoqemu: driver: Allow passing disk target as top image with block commit
Peter Krempa [Wed, 17 May 2017 15:16:15 +0000 (17:16 +0200)]
qemu: driver: Allow passing disk target as top image with block commit

Since we allow active layer block commit the users are allowed to commit
the top of the chain (e.g. vda) into the backing image. The API would
not accept that parameter, as it tried to look up the image in the
backing chain.

Add the ability to use the top level image target name explicitly as the
top image of the block commit operation.

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

7 years agonews: Update for GIC version on TCG changes
Andrea Bolognani [Fri, 12 May 2017 13:40:51 +0000 (15:40 +0200)]
news: Update for GIC version on TCG changes

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agogic: Remove VIR_GIC_VERSION_DEFAULT
Andrea Bolognani [Fri, 12 May 2017 12:38:08 +0000 (14:38 +0200)]
gic: Remove VIR_GIC_VERSION_DEFAULT

The QEMU default is GICv2, and some of the code in libvirt
relies on the exact value. Stop pretending that's not the
case and use GICv2 explicitly where needed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: Use GICv2 for aarch64/virt TCG guests
Andrea Bolognani [Fri, 12 May 2017 11:29:57 +0000 (13:29 +0200)]
qemu: Use GICv2 for aarch64/virt TCG guests

There are currently some limitations in the emulated GICv3
that make it unsuitable as a default. Use GICv2 instead.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agotests: Check default GIC version for aarch64/virt TCG guests
Andrea Bolognani [Fri, 12 May 2017 12:05:55 +0000 (14:05 +0200)]
tests: Check default GIC version for aarch64/virt TCG guests

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: Use qemuDomainMachineIsVirt() more
Andrea Bolognani [Fri, 12 May 2017 09:03:19 +0000 (11:03 +0200)]
qemu: Use qemuDomainMachineIsVirt() more

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: improve detection of UNIX path generated by libvirt
Pavel Hrdina [Thu, 11 May 2017 12:09:35 +0000 (14:09 +0200)]
qemu: improve detection of UNIX path generated by libvirt

Currently we consider all UNIX paths with specific prefix as generated
by libvirt, but that's a wrong assumption.  Let's make the detection
better by actually checking whether the whole path matches one of the
paths that we generate or generated in the past.

The UNIX path isn't stored in config XML since libvirt-1.3.1.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoremove hack for debian etch limits.h
Daniel P. Berrange [Mon, 15 May 2017 16:00:09 +0000 (17:00 +0100)]
remove hack for debian etch limits.h

The debian etch distro was end-of-life a long time ago so we no
longer need the ULLONG_MAX hack. In any case gnulib now provides
an equivalent fix by default, and so our definition now triggers
syntax-check rule failure

src/internal.h:#    define ULLONG_MAX   ULONG_LONG_MAX
maint.mk: define the above via some gnulib .h file
maint.mk:843: recipe for target 'sc_prohibit_always-defined_macros' failed

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agomaint: update to latest gnulib
Daniel P. Berrange [Thu, 11 May 2017 14:40:25 +0000 (15:40 +0100)]
maint: update to latest gnulib

This pulls in the fixes for poll() on Win32 which finally
makes the remote driver work again.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agoconf: add ABI stability checks for IOMMU options
Ján Tomko [Fri, 12 May 2017 14:59:45 +0000 (16:59 +0200)]
conf: add ABI stability checks for IOMMU options

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

7 years agoconf: split out virDomainIOMMUDefCheckABIStability
Ján Tomko [Fri, 12 May 2017 14:59:09 +0000 (16:59 +0200)]
conf: split out virDomainIOMMUDefCheckABIStability

7 years agoqemu: format caching-mode on iommu command line
Ján Tomko [Fri, 17 Mar 2017 07:28:04 +0000 (08:28 +0100)]
qemu: format caching-mode on iommu command line

Format the caching-mode option for the intel-iommu device,
based on its <driver caching> attribute value.

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

7 years agoconf: add caching_mode attribute to iommu device
Ján Tomko [Fri, 17 Mar 2017 07:27:49 +0000 (08:27 +0100)]
conf: add caching_mode attribute to iommu device

Add a new attribute to control the caching mode.

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

7 years agoqemu: format intel-iommu,intremap on the command line
Ján Tomko [Wed, 3 May 2017 13:23:12 +0000 (15:23 +0200)]
qemu: format intel-iommu,intremap on the command line

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

7 years agoconf: add <driver intremap> to <iommu>
Ján Tomko [Fri, 17 Mar 2017 07:35:22 +0000 (08:35 +0100)]
conf: add <driver intremap> to <iommu>

Add a new attribute to control interrupt remapping.

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

7 years agoqemu: format kernel_irqchip on the command line
Ján Tomko [Fri, 17 Mar 2017 07:26:49 +0000 (08:26 +0100)]
qemu: format kernel_irqchip on the command line

Add kernel_irqchip=split/on to the QEMU command line
and a capability that looks for it in query-command-line-options
output. For the 'split' option, use a version check
since it cannot be reasonably probed.

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

7 years agoconf: add <ioapic driver> to <features>
Ján Tomko [Fri, 17 Mar 2017 07:26:35 +0000 (08:26 +0100)]
conf: add <ioapic driver> to <features>

Add a new <ioapic> element with a driver attribute.

Possible values are qemu and kvm. With 'qemu', the I/O
APIC can be put in the userspace even for KVM domains.

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

7 years agoutil: conf: Don't log when adding commented out lines
Peter Krempa [Fri, 12 May 2017 14:29:15 +0000 (16:29 +0200)]
util: conf: Don't log when adding commented out lines

virConfAddEntry spams debug logs even for fully commented out lines.
Skip such messages to avoid:

2017-05-12 12:35:38.867+0000: 10820: debug : virConfAddEntry:241 : Add entry (null) (nil)
2017-05-12 12:35:38.867+0000: 10820: debug : virConfAddEntry:241 : Add entry (null) (nil)
2017-05-12 12:35:38.867+0000: 10820: debug : virConfAddEntry:241 : Add entry (null) (nil)
2017-05-12 12:35:38.867+0000: 10820: debug : virConfAddEntry:241 : Add entry (null) (nil)
2017-05-12 12:35:38.867+0000: 10820: debug : virConfAddEntry:241 : Add entry (null) (nil)
...

This also fixes NULL passed to printf.

7 years agostorage: use 0711 as the default perms for dirs
Serge Hallyn [Mon, 15 May 2017 11:05:31 +0000 (13:05 +0200)]
storage: use 0711 as the default perms for dirs

There should be no need to make dir based pools world/group readable.
So use 0711, not 0755, as the default perms for storage dirs.

Updates in v2:
 - adapt commit wording to mention dropping group readable as well

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agoDetect VMDK version 3 files
Daniel P. Berrange [Mon, 8 May 2017 09:05:09 +0000 (10:05 +0100)]
Detect VMDK version 3 files

The metadata libvirt cares about is identical for version 3
as for previous versions, so we merely need list the new
version number.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agoqemu: monitor: do not report error on shutdown
Christian Ehrhardt [Thu, 9 Mar 2017 09:54:32 +0000 (10:54 +0100)]
qemu: monitor: do not report error on shutdown

If a shutdown is expected because it was triggered via libvirt we can
also expect the monitor to close. In those cases do not report an
internal error like:
  "internal error: End of file from qemu monitor"

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agotest-wrap-argv.pl: Accept short parameter -i for --in-place
Martin Kletzander [Fri, 12 May 2017 13:08:51 +0000 (15:08 +0200)]
test-wrap-argv.pl: Accept short parameter -i for --in-place

I like to use it that way and every time I try running it I just
instinctively use '-i' (like with sed, etc.) and it makes sense, IMHO.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoutil: introduce virBufferEscapeRegex
Pavel Hrdina [Fri, 12 May 2017 12:26:09 +0000 (14:26 +0200)]
util: introduce virBufferEscapeRegex

Add a helper to escape all possible meta-characters used for
POSIX extended regular expressions.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoutil: introduce virStringMatch
Pavel Hrdina [Thu, 11 May 2017 15:16:13 +0000 (17:16 +0200)]
util: introduce virStringMatch

Simply tries to match the provided regex on a string and returns
the result.  Useful if caller don't care about the matched substring
and want to just test if some pattern patches a string.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agodocs: install html fonts and related
Nikolay Shirokovskiy [Thu, 11 May 2017 09:01:27 +0000 (12:01 +0300)]
docs: install html fonts and related

8 years agovirsh: Add --tls description for the virsh man page
John Ferlan [Wed, 10 May 2017 14:07:31 +0000 (10:07 -0400)]
virsh: Add --tls description for the virsh man page

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

Commit id '6a8d898d' neglected to update the man page.

8 years agoconf: Fix resource leak in virCapabilitiesInitCaches
John Ferlan [Fri, 12 May 2017 10:46:20 +0000 (06:46 -0400)]
conf: Fix resource leak in virCapabilitiesInitCaches

The @type from virFileReadValueString needs to be VIR_FREE each time
through the loop since it's not saved and since cleanup can be reached
prior to decoding it for @kernel_type amd bank->type, the cleanup code
needs to also have a VIR_FREE

Found by Coverity

8 years agospec: Use HTTPS instead of HTTP
Andrea Bolognani [Thu, 11 May 2017 16:31:08 +0000 (18:31 +0200)]
spec: Use HTTPS instead of HTTP

libvirt.org supports HTTPS, so might as well use it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
8 years agospec: Support maintenance releases on mingw
Andrea Bolognani [Thu, 11 May 2017 16:28:00 +0000 (18:28 +0200)]
spec: Support maintenance releases on mingw

The regular spec file contains code to deal with the fact
that maintenance releases are uploaded to their own
directory: copy it over to the mingw spec file so that it's
possible to build maintenance releases there as well.

This also switches the source URL from FTP to HTTP for
consistency with the main spec file.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
8 years agoqemu: Provide a much clearer message on device hot-plug
Erik Skultety [Thu, 11 May 2017 13:26:47 +0000 (15:26 +0200)]
qemu: Provide a much clearer message on device hot-plug

Adjust the current message to make it clear, that it is the hotplug
operation that is unsupported with the given host device type.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agotests: stub out virfilewrapper.c on Win32
Daniel P. Berrange [Thu, 11 May 2017 10:42:14 +0000 (11:42 +0100)]
tests: stub out virfilewrapper.c on Win32

The Win32 platform can not do link time overrides in the same way
that we can on POSIX / ELF based platforms, so we cannot build
the virfilewrapper.c code reliably. Just stub it out on Win32
so it is a no-op. Tests that use this file are already written
to skip on Win32.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibxl: report numa sibling distances on host capabilities
Wim ten Have [Tue, 9 May 2017 18:06:29 +0000 (20:06 +0200)]
libxl: report numa sibling distances on host capabilities

When running on a NUMA machine, populate the sibling node
and distance information using data supplied by Xen.

With locality distances information, under Xen, new host
capabilities would like:

    <topology>
      <cells num='4'>
        <cell id='0'>
          <memory unit='KiB'>263902380</memory>
          <distances>
            <sibling id='0' value='10'/>
            <sibling id='1' value='21'/>
          </distances>
          ...
        </cell>
        ...
      </cells>
      ...
    </topology>

Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
8 years agoAdd missing deps on virfilewrapper.h
Daniel P. Berrange [Wed, 10 May 2017 15:15:05 +0000 (16:15 +0100)]
Add missing deps on virfilewrapper.h

The test programs depend on virfilewrapper.h as well as the
virfilewrapper.c. Adding the dep ensures that virfilewrapper.h
gets included in the dist tarball.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoqemu: driver: Fix usage of qemuOpenFile
Peter Krempa [Wed, 10 May 2017 10:33:19 +0000 (12:33 +0200)]
qemu: driver: Fix usage of qemuOpenFile

The function returns -errno on failure, not only -1.

8 years agoqemu: driver: Document qemuOpenFile
Peter Krempa [Wed, 10 May 2017 10:28:38 +0000 (12:28 +0200)]
qemu: driver: Document qemuOpenFile

The function is nontrivial to follow and has non-standard return values.
Recent usage was buggy.

8 years agoconf: Check CPU cache for ABI stability
Jiri Denemark [Tue, 9 May 2017 14:03:19 +0000 (16:03 +0200)]
conf: Check CPU cache for ABI stability

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoDon't inline virStringTrimOptionalNewline
Daniel P. Berrange [Wed, 10 May 2017 08:16:11 +0000 (09:16 +0100)]
Don't inline virStringTrimOptionalNewline

GCC complains that inlining virStringTrimOptionalNewline is not
likely on some platforms:

  cc1: warnings being treated as errors
  ../../src/util/virfile.c: In function 'virFileReadValueBitmap':
  ../../src/util/virstring.h:292: error: inlining failed in call to 'virStringTrimOptionalNewline': call is unlikely and code size would grow [-Winline]
  ../../src/util/virfile.c:3987: error: called from here [-Winline]

Inlining this function is not going to be a measurable performance
benefit either, since the time required to execute it is going to
be dominated by running of strlen() over the string, not by the
function call overhead.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agospec: Update version check for maint Source URL
Cole Robinson [Fri, 5 May 2017 00:08:55 +0000 (20:08 -0400)]
spec: Update version check for maint Source URL

New maint release version numbers of just A.B.C format, not the old
A.B.C.D format. Adjust the check that dynamically changes the Source
URL for maint releases

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Acked-by: Andrea Bolognani <abologna@redhat.com>
8 years agoAdding POWER9 cpu model to cpu_map.xml
Kothapally Madhu Pavan [Tue, 9 May 2017 09:04:10 +0000 (05:04 -0400)]
Adding POWER9 cpu model to cpu_map.xml

As POWER9 model is not available in cpu_map.xml virsh capabilities
donot display the cpu model and vendor details. This patch
provides those details

8 years agotests: fix virfilewrapper
Roman Bogorodskiy [Tue, 9 May 2017 13:02:26 +0000 (17:02 +0400)]
tests: fix virfilewrapper

If __lxstat() and __xstat() functions are not available, build fails with:

  CC       virfilewrapper.o
virfilewrapper.c:180:5: error: no previous prototype for function '__lxstat' [-Werror,-Wmissing-prototypes]
int __lxstat(int ver, const char *path, struct stat *sb)
    ^
virfilewrapper.c:208:5: error: no previous prototype for function '__xstat' [-Werror,-Wmissing-prototypes]
int __xstat(int ver, const char *path, struct stat *sb)

Luckily, we already check presence of these functions in configure
using AC_CHECK_FUNCS, so just don't wrap these if they're not available.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
8 years agoutil: Define SYSFS_SYSTEM_PATH unconditionally in virhostcpu
Martin Kletzander [Tue, 9 May 2017 12:17:38 +0000 (14:17 +0200)]
util: Define SYSFS_SYSTEM_PATH unconditionally in virhostcpu

The code is already prepared to handle the non-existence of it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agotests: Add resctrl test for vircaps2xmltest
Martin Kletzander [Fri, 31 Mar 2017 12:36:58 +0000 (14:36 +0200)]
tests: Add resctrl test for vircaps2xmltest

Add info from yet another machine, this time with resctrl data so that
we can extend tests easily in a test-driven way.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agotests: Add support for more complicated hierarchies in vircaps2xmltest
Martin Kletzander [Fri, 31 Mar 2017 12:33:57 +0000 (14:33 +0200)]
tests: Add support for more complicated hierarchies in vircaps2xmltest

More directories will need to be mocked, so let's prepare for that.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoInit host cache info in drivers
Martin Kletzander [Wed, 29 Mar 2017 13:52:31 +0000 (15:52 +0200)]
Init host cache info in drivers

Added only in drivers that were already calling
virCapabilitiesInitNUMA().  Instead of refactoring all the callers to
behave the same way in case of error, just follow what the callers are
doing for all the functions.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoAdd host cache information in capabilities
Martin Kletzander [Thu, 30 Mar 2017 13:01:27 +0000 (15:01 +0200)]
Add host cache information in capabilities

We're only adding only info about L3 caches, we can add more
later (just by changing one line), but for now that's more than enough
without overwhelming anyone.

XML snippet of how this should look like (also seen as part of the commit):

  <cache>
    <bank id='0' level='3' type='both' size='8192' unit='KiB' cpus='0-7'/>
  </cache>

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agotests: Add missing cache data for vircaps2xmltest
Martin Kletzander [Mon, 27 Mar 2017 06:27:38 +0000 (08:27 +0200)]
tests: Add missing cache data for vircaps2xmltest

Commit a0fdd2f6f9a0cc77ae285c289e2c16d314b6a907 added some data from
the system but forgot 3 files for each cache.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agotests: Test vircaps2xmldata XMLs in virschematest
Martin Kletzander [Thu, 30 Mar 2017 12:55:12 +0000 (14:55 +0200)]
tests: Test vircaps2xmldata XMLs in virschematest

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoutil: Remove virsysfs and instead enhance virFileReadValue* functions
Martin Kletzander [Wed, 5 Apr 2017 14:13:52 +0000 (16:13 +0200)]
util: Remove virsysfs and instead enhance virFileReadValue* functions

It is no longer needed thanks to the great virfilewrapper.c.  And this
way we don't have to add a new set of functions for each prefixed
path.

While on that, add two functions that weren't there before, string and
scaled integer reading ones.  Also increase the length of the string
being read by one to accompany for the optional newline at the
end (i.e. change INT_STRLEN_BOUND to INT_BUFSIZE_BOUND).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agotests: Add virfilewrapper -- the new super "mock"
Martin Kletzander [Mon, 3 Apr 2017 12:29:45 +0000 (14:29 +0200)]
tests: Add virfilewrapper -- the new super "mock"

This mock (which is actually not mock at all, see later) can redirect
all accesses to a path into another path.  There is no need to
create mocks for particular directories, you just create a directory
with all the data a redirect the test there.

In the future, this should also be able to register callbacks for
calls/paths, e.g. when the test is going to write into anything under
"/sys/devices", call function fce();  Then in the open() call we would
add information about the fd into some structure and in write() we
would call fce() with parameters like @path to write to, @data to
be written and pointer to optional return value, so that fce() itself
could stop the call from happening or change its behaviour.  But
that's an idea for a latter day.

This is not a mock because it will not be preloaded, but compiled in
the test itself.  See future patches for usage.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agomdev: Cleanup code after commits @daf5081b and @2739a983
Erik Skultety [Thu, 4 May 2017 13:36:37 +0000 (15:36 +0200)]
mdev: Cleanup code after commits @daf5081b and @2739a983

So, because mingw is somehow OK with dereferencing a pointer within a
VIR_DEBUG macro, compared to outside of it to which it complained with a
"potential NULL pointer dereference" error (still a false positive), we
can make the code a tiny bit cleaner.

Sighed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoDon't use ceph-devel on Fedora
Daniel P. Berrange [Mon, 8 May 2017 09:54:08 +0000 (10:54 +0100)]
Don't use ceph-devel on Fedora

A previous commit changed the spec to use librbd1-devel on
RHEL-7, since this replaces ceph-devel from RHEL-6:

  commit 6cfc8834c858849cc74c3082078dc91fb1cbae38
  Author: Peter Krempa <pkrempa@redhat.com>
  Date:   Thu Mar 5 11:40:54 2015 +0100

    spec: Enable RBD storage driver in RHEL-7

    Use correct package names too as they differ.

RHEL-7 inherited this rename from Fedora though, so it should
have also made Fedora use the new names.

This was missed, because Fedora still provides a (deprecated)
back-compat RPM for ceph-devel that just pulls in librbd1-devel
(and others).

Fixing this stops libvirt pulling Java into the build root in
Fedora.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoHACKING: Document developer tooling
Andrea Bolognani [Fri, 28 Apr 2017 16:30:07 +0000 (18:30 +0200)]
HACKING: Document developer tooling

Advertise some of the useful developer tooling libvirt
integrates with out of the box.

8 years agoAdd YouCompleteMe support
Andrea Bolognani [Fri, 21 Apr 2017 14:47:02 +0000 (16:47 +0200)]
Add YouCompleteMe support

YouCompleteMe[1] is a vim plugin that implements semantic
code completion using libclang.

For non-trivial projects such as libvirt, the plugin needs
some help figuring out where to find the various header
files: generate its configuration file at configure time
so that the plugin works out of the box.

[1] http://valloric.github.io/YouCompleteMe/

8 years agoAdd color_coded support
Andrea Bolognani [Fri, 21 Apr 2017 14:05:19 +0000 (16:05 +0200)]
Add color_coded support

color_coded[1] is a vim plugin that implements semantic
syntax highlighting using libclang.

For non-trivial projects such as libvirt, the plugin needs
some help figuring out where to find the various header
files: generate its configuration file at configure time
so that the plugin works out of the box.

[1] https://github.com/jeaye/color_coded