]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
7 years agovz: unlock dom until resize operation
Konstantin Neumoin [Wed, 3 May 2017 11:23:35 +0000 (14:23 +0300)]
vz: unlock dom until resize operation

We have to use waitDomainJob instead of waitJob, because of it
unlock the domain until job has finished, so domain will be available
for other clients.

Signed-off-by: Konstantin Neumoin <kneumoin@virtuozzo.com>
7 years agoqemu: Properly check return value of VIR_STRDUP in qemuDomainGetBlockIoTune
Peter Krempa [Tue, 23 May 2017 15:21:56 +0000 (17:21 +0200)]
qemu: Properly check return value of VIR_STRDUP in qemuDomainGetBlockIoTune

Setting the 'group_name' for a disk would falsely trigger a error path
as in commit 4b57f76502 we did not properly check the return value of
VIR_STRDUP.

7 years agolibxl: add default controllers for USB devices
Jim Fehlig [Tue, 28 Mar 2017 23:34:16 +0000 (17:34 -0600)]
libxl: add default controllers for USB devices

Attempting to start a domain with USB hostdevs but no USB controllers
fails with the rather cryptic error

libxl: error: libxl_qmp.c:287:qmp_handle_error_response: received an
error message from QMP server: Bus 'xenusb-0.0' not found

This can be fixed by creating default USB controllers. When no USB
controllers are defined, create the number of 8 port controllers
necessary to accommodate the number of defined USB devices.

Note that USB controllers are already created as needed in the
domainAttachDevice code path. E.g. a USB controller will be created,
if necessary, when attaching a USB device with
'virsh attach-device dom usbdev.xml'.

7 years agoqemu: process: Clear priv->namespaces on VM shutdown
Peter Krempa [Mon, 22 May 2017 11:36:55 +0000 (13:36 +0200)]
qemu: process: Clear priv->namespaces on VM shutdown

Otherwise the private data entry would be kept across instances of the
same VM even if it's not configured to do so.

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

7 years agoqemu: Remove unused variables in qemuDomainUpdateDeviceConfig
Kothapally Madhu Pavan [Tue, 16 May 2017 07:45:09 +0000 (03:45 -0400)]
qemu: Remove unused variables in qemuDomainUpdateDeviceConfig

priv and qemuCaps variables are not used anymore.

Signed-off-by: Kothapally Madhu Pavan <kmp@linux.vnet.ibm.com>
7 years agoRevert "qemu: propagate bridge MTU into qemu "host_mtu" option"
Laine Stump [Thu, 18 May 2017 18:16:27 +0000 (14:16 -0400)]
Revert "qemu: propagate bridge MTU into qemu "host_mtu" option"

This reverts commit 2841e675.

It turns out that adding the host_mtu field to the PCI capabilities in
the guest bumps the length of PCI capabilities beyond the 32 byte
boundary, so the virtio-net device gets 64 bytes of ioport space
instead of 32, which offsets the address of all the other following
devices. Migration doesn't work very well when the location and length
of PCI capabilities of devices is changed between source and
destination.

This means that we need to make sure that the absence/presence of
host_mtu on the qemu commandline always matches between source and
destination, which means that we need to make setting of host_mtu an
opt-in thing (it can't happen automatically when the bridge being used
has a non-default MTU, which is what commit 2841e675 implemented).

I do want to re-implement this feature with an <mtu auto='on'/>
setting, but probably won't backport that to any stable branches, so
I'm first reverting the original commit, and that revert can be pushed
to the few releases that have been made since the original (3.1.0 -
3.3.0)

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

7 years agolibxl: add default listen address for VNC and spice
Jim Fehlig [Fri, 19 May 2017 21:52:04 +0000 (15:52 -0600)]
libxl: add default listen address for VNC and spice

If a VNC listen address is not specified in domXML, libxl
will default to 127.0.0.1, but this is never reflected in the domXML.
In the case of spice, a missing listen address resulted in listening
on all interfaces, i.e. '0.0.0.0'. If not specified, set the listen
address in virDomainGraphicsDef struct to the libxl default when
creating the frame buffer device. Additionally, set default spice
listen address to 127.0.0.1.

7 years agomaint: define a macro for IPv4 loopback address
Jim Fehlig [Fri, 19 May 2017 21:31:48 +0000 (15:31 -0600)]
maint: define a macro for IPv4 loopback address

Use a macro instead of hardcoding "127.0.0.1" throughout the
sources.

7 years agoProvide a useful README file
Daniel P. Berrange [Tue, 16 May 2017 10:48:17 +0000 (11:48 +0100)]
Provide a useful README file

The current README file contents has almost no useful info, and that
which does exist is very outdated.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agovirStreamSparseSendAll: Reset @want in each iteration
Michal Privoznik [Mon, 22 May 2017 09:44:26 +0000 (11:44 +0200)]
virStreamSparseSendAll: Reset @want in each iteration

There's a slight problem with the current function. Assume we are
currently in a data section and we have say 42 bytes until next
section. Therefore, just before (handler) is called to fill up
the buffer with data, @want is changed to 42 to match the amount
of data left in the current section. However, after hole is
processed, we are back in data section but with incredibly small
@want size. Nobody will ever reset it back. This results in
incredible data fragmentation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agodocs: Update pointer to networking information
Andrea Bolognani [Mon, 15 May 2017 12:16:54 +0000 (14:16 +0200)]
docs: Update pointer to networking information

Commit 6fb5dd4fd804 removed docs/archnetwork.html.in, but
left behind a pointer to it in docs/formatnetwork.html.in.

Update it so that it points to the wiki, which contains
more detailed and recent information anyway.

7 years agovirCapabilitiesInitCaches: Don't leak cache dir
Michal Privoznik [Mon, 22 May 2017 10:07:19 +0000 (12:07 +0200)]
virCapabilitiesInitCaches: Don't leak cache dir

To every virDirOpen we must have VIR_DIR_CLOSE otherwise FD is
leaked.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoDo not release unreserved address in qemuDomainAttachRNGDevice
Ján Tomko [Fri, 19 May 2017 12:14:32 +0000 (14:14 +0200)]
Do not release unreserved address in qemuDomainAttachRNGDevice

Only set releaseaddr to true after the address has been
reserved successfully.

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

Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: hotplug: print correct vcpu when validating hot(un)plug config
Peter Krempa [Fri, 12 May 2017 15:46:31 +0000 (17:46 +0200)]
qemu: hotplug: print correct vcpu when validating hot(un)plug config

The error message would contain first vcpu id after the list of vcpus
selected for modification. To print the proper vcpu id remember the
first vcpu selected to be modified.

7 years agoutil: Don't leak @reply in virSystemdGetMachineNameByPID
Wang King [Sat, 20 May 2017 01:31:57 +0000 (09:31 +0800)]
util: Don't leak @reply in virSystemdGetMachineNameByPID

@reply is a DBusMessage object returned by virDBusCallMethod in
get machine object call path, dereference it before calling
virDBusCallMethod again to get machine name.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agotest: fixing variable names for test suite inside configure.ac.
Julio Faracco [Sat, 20 May 2017 14:53:54 +0000 (11:53 -0300)]
test: fixing variable names for test suite inside configure.ac.

Both variables for gcov and oom have wrong names inside configure.ac.
For this reason, the Test Suite configuration is not showing the current
configuration.

Before patching:
configure:    windres: no
configure:
configure: Test suite
configure:
configure:          Coverage:
configure:         Alloc OOM:
configure:
configure: Miscellaneous

After patching (using --enable-test-coverage and --enable-test-oom):
configure:    windres: no
configure:
configure: Test suite
configure:
configure:          Coverage: yes
configure:         Alloc OOM: yes
configure:
configure: Miscellaneous

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
7 years agoxenconfig: fix handling of NULL disk source
Wim ten Have [Fri, 19 May 2017 14:38:43 +0000 (16:38 +0200)]
xenconfig: fix handling of NULL disk source

It is possible to crash libvirtd when converting xl native config to
domXML when the xl config contains an empty disk source, e.g. an empty
CDROM. Fix by checking that the disk source is non-NULL before parsing it.

Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
7 years agovirfiletest: include linux/falloc.h
Michal Privoznik [Thu, 18 May 2017 13:38:04 +0000 (15:38 +0200)]
virfiletest: include linux/falloc.h

On systems with older glibc including fcntl.h for getting
FALLOC_FL_PUNCH_HOLE defined is not enough. We must also include
linux/falloc.h.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirfiletest: Test virFileInData iff SEEK_HOLE is defined
Michal Privoznik [Thu, 18 May 2017 12:36:41 +0000 (14:36 +0200)]
virfiletest: Test virFileInData iff SEEK_HOLE is defined

Yet another place where we need to wrap code in
HAVE_DECL_SEEK_HOLE block.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirfile: Provide stub for virFileInData
Michal Privoznik [Thu, 18 May 2017 09:55:12 +0000 (11:55 +0200)]
virfile: Provide stub for virFileInData

Some older systems (such as RHEL6) lack SEEK_HOLE and SEEK_DATA
which virFileInData relies on. Provide a stub for these systems.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoconf: Don't assign value from ..TypeFromString directly to enum
Peter Krempa [Fri, 19 May 2017 08:25:00 +0000 (10:25 +0200)]
conf: Don't assign value from ..TypeFromString directly to enum

Enums are unsigned, so it's impossible to check whether the helper
returned -1 for invalid conversions.

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

7 years agoapparmor, virt-aa-helper: Explicit denies for host devices
Felix Geyer [Thu, 18 May 2017 08:53:43 +0000 (10:53 +0200)]
apparmor, virt-aa-helper: Explicit denies for host devices

Add explicit denies for disk devices to avoid cluttering dmesg with
(acceptable) denials.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Guido Günther <agx@sigxcpu.org>
7 years agoapparmor, virt-aa-helper: Allow access to libnl-3 config files
Felix Geyer [Thu, 18 May 2017 08:53:42 +0000 (10:53 +0200)]
apparmor, virt-aa-helper: Allow access to libnl-3 config files

Allow access to libnl-3 config files

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Guido Günther <agx@sigxcpu.org>
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>