]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
8 years agoconf: don't ignore <target dev='blah'/> for macvtap interfaces
Laine Stump [Mon, 27 Mar 2017 01:57:54 +0000 (21:57 -0400)] 
conf: don't ignore <target dev='blah'/> for macvtap interfaces

The parser had been clearing out *all* suggested device names for
type='direct' (aka macvtap) interfaces. All of the code implementing
macvtap allows for a user-specified device name, so we should allow
it. In the case that an interface name starts with "macvtap" or
"macvlan" though, we do still clear it out, just as we do with "vnet"
(which is the prefix used for automatically generated tap device
names), since those are the prefixes for the names we autogenerate for
macvtap and macvlan devices.

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

8 years agoutil: make macvtap/macvlan generated name #defines available to other files
Laine Stump [Tue, 25 Apr 2017 18:09:45 +0000 (14:09 -0400)] 
util: make macvtap/macvlan generated name #defines available to other files

MACVTAP_NAME_PREFIX and MACVLAN_NAME_PREFIX could be useful to other
files if they were defined in virnetdevmacvlan.h instead of
virnetdevmacvlan.c, so do that (while slightly renaming them and also
adding yet another #define that chooses between macvlan/macvtap based
on flags).

This is a prerequisite to fix: https://bugzilla.redhat.com/1335798

8 years agonetwork: better log message when network is inactive during reconnect
Laine Stump [Tue, 25 Apr 2017 16:26:43 +0000 (12:26 -0400)] 
network: better log message when network is inactive during reconnect

If the network isn't active during networkNotifyActualDevice(), we
would log an error message stating that the bridge device didn't
exist. This patch adds a check to see if the network is active, making
the logs more useful in the case that it isn't.

Partially resolves: https://bugzilla.redhat.com/1442700

8 years agoqemu: don't kill qemu process on restart if networkNotify fails
Laine Stump [Tue, 25 Apr 2017 16:20:30 +0000 (12:20 -0400)] 
qemu: don't kill qemu process on restart if networkNotify fails

Nothing that could happen during networkNotifyActualDevice() could
justify unceremoniously killing the qemu process, but that's what we
were doing.

In particular, new code added in commit 85bcc022 (first appearred in
libvirt-3.2.0) attempts to reattach tap devices to their assigned
bridge devices when libvirtd restarts (to make it easier to recover
from a restart of a libvirt network). But if the network has been
stopped and *not* restarted, the bridge device won't exist and
networkNotifyActualDevice() will fail.

This patch changes networkNotifyActualDevice() and
qemuProcessNotifyNets() to return void, so that qemuProcessReconnect()
will soldier on regardless of what happens (any errors will still be
logged though).

Partially resolves: https://bugzilla.redhat.com/1442700

8 years agoconf: format only relevant attributes for graphics based on listen type
Pavel Hrdina [Wed, 26 Apr 2017 10:47:49 +0000 (12:47 +0200)] 
conf: format only relevant attributes for graphics based on listen type

This patch changes following output:

    ...
    <graphics type='vnc' port='-1' autoport='yes'>
      <listen type='none'/>
    </graphics>
    ...

into this output:

    ...
    <graphics type='vnc'>
      <listen type='none'/>
    </graphics>
    ...

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoiohelper: Remove unused mode
Michal Privoznik [Fri, 7 Apr 2017 14:50:31 +0000 (16:50 +0200)] 
iohelper: Remove unused mode

After 1eb6647979f8c nobody calls the iohelper with 6 arguments.
Everybody uses the other mode. Well, the only user of iohelper
after the previous commit is virFileWrapperFd really.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
8 years agovirfdstream: Drop iohelper in favour of a thread
Michal Privoznik [Thu, 6 Apr 2017 16:21:39 +0000 (18:21 +0200)] 
virfdstream: Drop iohelper in favour of a thread

Currently we use iohelper for virFDStream implementation. This is
because UNIX I/O can lie sometimes: even though a FD for a
file/block device is set as unblocking, actual read()/write() can
block. To avoid this, a pipe is created and one end is kept for
read/write while the other is handed over to iohelper to
write/read the data for us. Thus it's iohelper which gets blocked
and not our event loop.

This approach has two problems:
1) we are spawning a new process.
2) any exchange of information between daemon and iohelper can be
done only through the pipe.

Therefore, iohelper is replaced with an implementation in thread
which is created just for the stream lifetime. The data are still
transferred through pipe (for now), but both problems described
above are solved.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
8 years agovirFDStreamData: Turn into virObjectLockable
Michal Privoznik [Thu, 16 Jun 2016 10:07:41 +0000 (12:07 +0200)] 
virFDStreamData: Turn into virObjectLockable

While this is no functional change, it makes the code look a bit
nicer. Moreover, it prepares ground for future work.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
8 years agofdstream: s/struct virFDStreamData */virFDStreamDataPtr/
Michal Privoznik [Thu, 16 Jun 2016 09:54:42 +0000 (11:54 +0200)] 
fdstream: s/struct virFDStreamData */virFDStreamDataPtr/

There is really no reason why we should have to have 'struct'
everywhere.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
8 years agofdstreamtest: Print more info on read failure
Michal Privoznik [Tue, 11 Apr 2017 07:51:41 +0000 (09:51 +0200)] 
fdstreamtest: Print more info on read failure

It helps with debugging if we know what's the return value of
saferead().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
8 years agofdstreamtest: Rename tempdir
Michal Privoznik [Tue, 11 Apr 2017 07:50:26 +0000 (09:50 +0200)] 
fdstreamtest: Rename tempdir

Because of copy-paste the temporary directory used for this test
is called "fakesysdir". That's probably misleading.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: use qemu-xhci USB controller by default for ppc64 and aarch64
Pavel Hrdina [Thu, 27 Apr 2017 15:56:41 +0000 (17:56 +0200)] 
qemu: use qemu-xhci USB controller by default for ppc64 and aarch64

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Acked-by: Andrea Bolognani <abologna@redhat.com>
8 years agoqemu: add support for qemu-xhci USB controller
Pavel Hrdina [Thu, 13 Apr 2017 10:25:25 +0000 (12:25 +0200)] 
qemu: add support for qemu-xhci USB controller

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Acked-by: Andrea Bolognani <abologna@redhat.com>
8 years agoqemu: introduce QEMU_CAPS_DEVICE_QEMU_XHCI
Pavel Hrdina [Fri, 28 Apr 2017 08:44:03 +0000 (10:44 +0200)] 
qemu: introduce QEMU_CAPS_DEVICE_QEMU_XHCI

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Acked-by: Andrea Bolognani <abologna@redhat.com>
8 years agoqemu: use nec-usb-xhci as a default controller for aarch64 if available
Pavel Hrdina [Thu, 27 Apr 2017 15:53:51 +0000 (17:53 +0200)] 
qemu: use nec-usb-xhci as a default controller for aarch64 if available

This is a USB3 controller and it's a better choice than piix3-uhci.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Acked-by: Andrea Bolognani <abologna@redhat.com>
8 years agoqemu: change the logic of setting default USB controller
Pavel Hrdina [Thu, 27 Apr 2017 15:41:56 +0000 (17:41 +0200)] 
qemu: change the logic of setting default USB controller

The new logic will set the piix3-uhci if available regardless of
any architecture and it will be updated to better model based on
architecture and device existence.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Acked-by: Andrea Bolognani <abologna@redhat.com>
8 years agotests: genericxml2xml: Add test case for HTTP based disk
Peter Krempa [Mon, 24 Apr 2017 13:56:31 +0000 (15:56 +0200)] 
tests: genericxml2xml: Add test case for HTTP based disk

8 years agoconf: Extract formatting of network disk source into separate function
Peter Krempa [Mon, 24 Apr 2017 12:54:02 +0000 (14:54 +0200)] 
conf: Extract formatting of network disk source into separate function

8 years agodocs: schemas: Split up definitions for NBD and gluster
Peter Krempa [Fri, 21 Apr 2017 13:41:29 +0000 (15:41 +0200)] 
docs: schemas: Split up definitions for NBD and gluster

NBD does not mandate a "filename". Gluster can have more servers. Split
them so that we can tighten the schema.

8 years agodocs: schemas: Split out simple network protocols
Peter Krempa [Fri, 21 Apr 2017 10:19:46 +0000 (12:19 +0200)] 
docs: schemas: Split out simple network protocols

ftp/tftp/sheepdog have a mandatory filename and support only one host.
There are no additional options for them.

8 years agodocs: schemas: Extract HTTP disk source specification
Peter Krempa [Thu, 20 Apr 2017 14:41:17 +0000 (16:41 +0200)] 
docs: schemas: Extract HTTP disk source specification

Make the schema more strict for HTTP disks requiring a name and
mandating exactly one source host.

ftp/tftp entries were not moved here, since http transport also will
support cookies and other options, which will be added later.

8 years agodocs: schemas: Extract RBD-specific data
Peter Krempa [Fri, 21 Apr 2017 09:48:12 +0000 (11:48 +0200)] 
docs: schemas: Extract RBD-specific data

RBD driver supports specifying a snapshot image name or config file.
Create a define for RBD and move the specifics there.

8 years agodocs: schemas: Move the interleave definition into network disk source
Peter Krempa [Fri, 21 Apr 2017 09:43:56 +0000 (11:43 +0200)] 
docs: schemas: Move the interleave definition into network disk source

Move it to the place where actually interleaving elements can be placed.

8 years agodocs: schemas: Extract disk source host specification
Peter Krempa [Thu, 20 Apr 2017 14:20:26 +0000 (16:20 +0200)] 
docs: schemas: Extract disk source host specification

'diskSourceNetwork' schema define was rather big and it would be hard to
simplify it. Split out the host portion subelement into a separate
define.

8 years agodocs: schemas: Remove <interleave> from file/block/dir/volume disks
Peter Krempa [Thu, 20 Apr 2017 15:32:42 +0000 (17:32 +0200)] 
docs: schemas: Remove <interleave> from file/block/dir/volume disks

They don't contain any elements to interleave.

8 years agoqemu: Don't fail if physical size can't be updated in qemuDomainGetBlockInfo
Peter Krempa [Thu, 20 Apr 2017 09:16:42 +0000 (11:16 +0200)] 
qemu: Don't fail if physical size can't be updated in qemuDomainGetBlockInfo

Since commit c5f6151390 qemuDomainBlockInfo tries to update the
"physical" storage size for all network storage and not only block
devices.

Since the storage driver APIs to do this are not implemented for certain
storage types (RBD, iSCSI, ...) the code would fail to retrieve any data
since the failure of qemuDomainStorageUpdatePhysical is fatal.

Since it's desired to return data even if the total size can't be
updated we need to ignore errors from that function and return plausible
data.

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

8 years agoqemu: Move freeing of PCI address list to qemuProcessStop
Peter Krempa [Wed, 26 Apr 2017 08:27:49 +0000 (10:27 +0200)] 
qemu: Move freeing of PCI address list to qemuProcessStop

Rather than freeing the list before starting a new VM clear it after
stopping the old instance when the data becomes invalid.

8 years agoqemu: process: Clean up priv->migTLSAlias
Peter Krempa [Wed, 26 Apr 2017 10:46:03 +0000 (12:46 +0200)] 
qemu: process: Clean up priv->migTLSAlias

The alias would be leaked, since it's not freed on the vm stop path.

8 years agoqemu: process: Don't leak priv->usbaddrs after VM restart
Peter Krempa [Wed, 26 Apr 2017 07:57:39 +0000 (09:57 +0200)] 
qemu: process: Don't leak priv->usbaddrs after VM restart

Since the private data structure is not freed upon stopping a VM, the
usbaddrs pointer would be leaked:

==15388== 136 (16 direct, 120 indirect) bytes in 1 blocks are definitely lost in loss record 893 of 1,019
==15388==    at 0x4C2CF55: calloc (vg_replace_malloc.c:711)
==15388==    by 0x54BF64A: virAlloc (viralloc.c:144)
==15388==    by 0x5547588: virDomainUSBAddressSetCreate (domain_addr.c:1608)
==15388==    by 0x144D38A2: qemuDomainAssignUSBAddresses (qemu_domain_address.c:2458)
==15388==    by 0x144D38A2: qemuDomainAssignAddresses (qemu_domain_address.c:2515)
==15388==    by 0x144ED1E3: qemuProcessPrepareDomain (qemu_process.c:5398)
==15388==    by 0x144F51FF: qemuProcessStart (qemu_process.c:5979)
[...]

8 years agoqemu: process: Clean automatic NUMA/cpu pinning information on shutdown
Peter Krempa [Tue, 25 Apr 2017 13:17:34 +0000 (15:17 +0200)] 
qemu: process: Clean automatic NUMA/cpu pinning information on shutdown

Clean the stale data after shutting down the VM. Otherwise the data
would be leaked on next VM start. This happens due to the fact that the
private data object is not freed on destroy of the VM.

8 years agoxlconfigtest: add tests for 'nestedhvm' support
Wim ten Have [Mon, 24 Apr 2017 13:07:01 +0000 (15:07 +0200)] 
xlconfigtest: add tests for 'nestedhvm' support

Testing various configuration schemas targeting postive and negative
nestedhvm under libvirt <cpu mode="host-passthrough"> configuration.

Mode "host-passthrough" generates nestedhvm=1 in/from xl format where

Intel virtualization (VT-x):
<feature policy='disable' name='vmx'/>

    or

AMD virtualization (AMD-V):
<feature policy='disable' name='svm'/>

disables virtualization mode under guest domains.

Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agoxenconfig: add conversions for xen-xl
Wim ten Have [Mon, 24 Apr 2017 13:07:00 +0000 (15:07 +0200)] 
xenconfig: add conversions for xen-xl

Per xen-xl conversions from and to native under host-passthrough
mode we take care for Xen (nestedhvm = mode) applied and inherited
settings generating or processing correct feature policy:

[On Intel (VT-x) architectures]
<feature policy='disable' name='vmx'/>

or

[On AMD (AMD-V) architectures]
<feature policy='disable' name='svm'/>

It will then generate (or parse) for nestedhvm=1 in/from xl format.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
8 years agolibxl: set nestedhvm for mode host-passthrough
Wim ten Have [Mon, 24 Apr 2017 13:06:59 +0000 (15:06 +0200)] 
libxl: set nestedhvm for mode host-passthrough

Xen feature nestedhvm is the option on Xen 4.4+ which enables
nested virtualization when mode host-passthrough is applied.

nested HVM is enabled by adding below on the target domain;
<cpu mode='host-passthrough'/>

Virtualization on target domain can be disabled by specifying
such under feature policy rule on target name;

[On Intel (VT-x) architecture]
<feature policy='disable' name='vmx'/>

or:

[On AMD (AMD-V) architecture]
<feature policy='disable' name='svm'/>

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
8 years agoqemu: Add support for guest CPU cache
Jiri Denemark [Tue, 25 Apr 2017 17:07:19 +0000 (19:07 +0200)] 
qemu: Add support for guest CPU cache

This patch maps /domain/cpu/cache element into -cpu parameters:

- <cache mode='passthrough'/> is translated to host-cache-info=on
- <cache level='3' mode='emulate'/> is transformed into l3-cache=on
- <cache mode='disable'/> is turned in host-cache-info=off,l3-cache=off

Any other <cache> element is forbidden.

The tricky part is detecting whether QEMU supports the CPU properties.

The 'host-cache-info' property is introduced in v2.4.0-1389-ge265e3e480,
earlier QEMU releases enabled host-cache-info by default and had no way
to disable it. If the property is present, it defaults to 'off' for any
QEMU until at least 2.9.0.

The 'l3-cache' property was introduced later by v2.7.0-200-g14c985cffa.
Earlier versions worked as if l3-cache=off was passed. For any QEMU
until at least 2.9.0 l3-cache is 'off' by default.

QEMU 2.9.0 was the first release which supports probing both properties
by running device-list-properties with typename=host-x86_64-cpu. Older
QEMU releases did not support device-list-properties command for CPU
devices. Thus we can't really rely on probing them and we can just use
query-cpu-model-expansion QMP command as a witness.

Because the cache property probing is only reliable for QEMU >= 2.9.0
when both are already supported for quite a few releases, we let QEMU
report an error if a specific cache mode is explicitly requested. The
other mode (or both if a user requested CPU cache to be disabled) is
explicitly turned off for QEMU >= 2.9.0 to avoid any surprises in case
the QEMU defaults change. Any older QEMU already turns them off so not
doing so explicitly does not make any harm.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoAdd support for CPU cache specification
Jiri Denemark [Mon, 24 Apr 2017 13:40:07 +0000 (15:40 +0200)] 
Add support for CPU cache specification

This patch introduces

    <cache level='N' mode='emulate'/>
    <cache mode='passthrough'/>
    <cache mode='disable'/>

sub element of /domain/cpu. Currently only a single <cache> element is
allowed.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoconf: Rename mode parameter in virCPUDefParseXML
Jiri Denemark [Mon, 24 Apr 2017 13:38:41 +0000 (15:38 +0200)] 
conf: Rename mode parameter in virCPUDefParseXML

The type of this parameter is virCPUType so calling it 'mode' is pretty
strange, 'type' is a much better name.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Report VIR_DOMAIN_JOB_OPERATION
Jiri Denemark [Wed, 26 Apr 2017 10:00:09 +0000 (12:00 +0200)] 
qemu: Report VIR_DOMAIN_JOB_OPERATION

Not all async jobs are visible via virDomainGetJobStats (either they are
too fast or getting the stats is not allowed during the job), but
forcing all of them to advertise the operation is easier than hunting
the jobs for which fetching statistics is allowed. And we won't need to
think about this when we add support for getting stats for more jobs.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoAdd VIR_DOMAIN_JOB_OPERATION typed parameter
Jiri Denemark [Wed, 26 Apr 2017 09:59:59 +0000 (11:59 +0200)] 
Add VIR_DOMAIN_JOB_OPERATION typed parameter

The parameter is reported by virDomainGetJobStats API and
VIR_DOMAIN_EVENT_ID_JOB_COMPLETED event and it can be used to identify
the operation (migration, snapshot, ...) to which the reported
statistics belong.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Remove extra messages for vhost-scsi hotplug
Eric Farman [Wed, 26 Apr 2017 21:10:01 +0000 (17:10 -0400)] 
qemu: Remove extra messages for vhost-scsi hotplug

As with virtio-scsi, the "internal error" messages after
preparing a vhost-scsi hostdev overwrites more meaningful
error messages deeper in the callchain.  Remove it too.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
8 years agoqemu: Remove extra messages from virtio-scsi hotplug
Eric Farman [Wed, 26 Apr 2017 21:10:00 +0000 (17:10 -0400)] 
qemu: Remove extra messages from virtio-scsi hotplug

I tried to attach a SCSI LUN to two different guests, and forgot
to specify "shareable" in the hostdev XML.  Attaching the device
to the second guest failed, but the message was not helpful in
telling me what I was doing wrong:

  $ cat scsi_scratch_disk.xml
    <hostdev mode='subsystem' type='scsi'>
      <source>
        <adapter name='scsi_host3'/>
        <address bus='0' target='15' unit='1074151456'/>
      </source>
    </hostdev>

  $ virsh attach-device dasd_sles_d99c scsi_scratch_disk.xml
  Device attached successfully

  $ virsh attach-device dasd_fedora_0e1e scsi_scratch_disk.xml
  error: Failed to attach device from scsi_scratch_disk.xml
  error: internal error: Unable to prepare scsi hostdev: scsi_host3:0:15:1074151456

I eventually discovered my error, but thought it was weird that
Libvirt doesn't provide something more helpful in this case.
Looking over the code we had just gone through, I commented out
the "internal error" message, and got something more useful:

  $ virsh attach-device dasd_fedora_0e1e scsi_scratch_disk.xml
  error: Failed to attach device from scsi_scratch_disk.xml
  error: Requested operation is not valid: SCSI device 3:0:15:1074151456 is already in use by other domain(s) as 'non-shareable'

Looking over the error paths here, we seem to issue better
messages deeper in the callchain so these "internal error"
messages overwrite any of them.  Remove them, so that the
more detailed errors are seen.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
8 years agoqemu: Check return code from qemuHostdevPrepareSCSIDevices
Eric Farman [Wed, 26 Apr 2017 21:09:59 +0000 (17:09 -0400)] 
qemu: Check return code from qemuHostdevPrepareSCSIDevices

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
8 years agoqemu: migration: fix race on cancelling drive mirror
Nikolay Shirokovskiy [Fri, 7 Apr 2017 11:06:25 +0000 (14:06 +0300)] 
qemu: migration: fix race on cancelling drive mirror

0feebab2 adds calling qemuBlockNodeNamesDetect for completed job
on updating block jobs. This affects cancelling drive mirror logic as
this function drops vm lock. Now we have to recheck all disks
before the disk with the completed block job before going
to wait for block job events.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: take current async job into account in qemuBlockNodeNamesDetect
Nikolay Shirokovskiy [Fri, 7 Apr 2017 11:06:24 +0000 (14:06 +0300)] 
qemu: take current async job into account in qemuBlockNodeNamesDetect

Becase it can be called during migration out (namely on cancelling
blockjobs).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: numa: Don't return automatic nodeset for inactive domain
Peter Krempa [Wed, 26 Apr 2017 07:01:30 +0000 (09:01 +0200)] 
qemu: numa: Don't return automatic nodeset for inactive domain

qemuDomainGetNumaParameters would return the automatic nodeset even for
the persistent config if the domain was running. This is incorrect since
the automatic nodeset will be re-queried upon starting the vm.

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

8 years agolib: Fix c99 style comments
Michal Privoznik [Thu, 27 Apr 2017 06:47:19 +0000 (08:47 +0200)] 
lib: Fix c99 style comments

We prefer c89 style of comments.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Properly reset non-p2p migration
Jiri Denemark [Wed, 26 Apr 2017 19:46:28 +0000 (21:46 +0200)] 
qemu: Properly reset non-p2p migration

While peer-to-peer migration enters the Confirm phase even if the
Perform phase fails, the client which initiated a non-p2p migration will
never call virDomainMigrateConfirm* API if the Perform phase failed.
Thus we need to explicitly reset migration before reporting a failure
from the Perform phase API.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoutil: Drop unused var @errbuf from virPCIGetDeviceAddressFromSysfsLink
Wang King [Thu, 27 Apr 2017 01:52:52 +0000 (09:52 +0800)] 
util: Drop unused var @errbuf from virPCIGetDeviceAddressFromSysfsLink

Commit @a7035662 forgot to remove it when doing a refactor.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agolocking: Add support for sanlock_strerror
Jiri Denemark [Fri, 31 Mar 2017 19:42:22 +0000 (21:42 +0200)] 
locking: Add support for sanlock_strerror

The recently added sanlock_strerror function can be used to translate
sanlock's numeric errors into human readable strings.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Ignore missing query-migrate-parameters
Jiri Denemark [Wed, 26 Apr 2017 21:18:35 +0000 (23:18 +0200)] 
qemu: Ignore missing query-migrate-parameters

Migration with old QEMU which does not support query-migrate-parameters
would fail because the QMP command is called unconditionally since the
introduction of TLS migration. Previously it was only called if the user
explicitly requested a feature which uses QEMU migration parameters. And
even then the situation was not ideal, instead of reporting an
unsupported feature we'd just complain about missing QMP command.

Trivially no migration parameters are supported when
query-migrate-parameters QMP command is missing. There's no need to
report an error if it is missing, the callers will report better error
if needed.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: update QEMU 2.9.0 caps data to final version
Pavel Hrdina [Wed, 26 Apr 2017 17:19:50 +0000 (19:19 +0200)] 
tests: update QEMU 2.9.0 caps data to final version

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agosecret: Generate configDir during driver initialization
John Ferlan [Wed, 19 Apr 2017 20:40:45 +0000 (16:40 -0400)] 
secret: Generate configDir during driver initialization

Rather than waiting for the first save to fail, let's generate the
directory with the correct privs during initialization.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agosecret: Combine virSecretObjListAdd with Locked function
John Ferlan [Thu, 20 Apr 2017 11:33:26 +0000 (07:33 -0400)] 
secret: Combine virSecretObjListAdd with Locked function

There's no need to separate, so just have one.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agosecret: Split apart NumOfSecrets and GetUUIDs callback function
John Ferlan [Mon, 3 Apr 2017 13:03:47 +0000 (09:03 -0400)] 
secret: Split apart NumOfSecrets and GetUUIDs callback function

Rather than overloading one function - split apart the logic to have
separate interfaces and local/private structures to manage the data
for which the helper is collecting.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agosecret: Rename 'filter' to 'aclfilter'
John Ferlan [Tue, 25 Apr 2017 15:22:09 +0000 (11:22 -0400)] 
secret: Rename 'filter' to 'aclfilter'

Makes it a bit more clear what it is.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agosecret: Change variable names for list traversals
John Ferlan [Wed, 19 Apr 2017 12:34:04 +0000 (08:34 -0400)] 
secret: Change variable names for list traversals

Rather than 'nuuids' it should be 'maxuuids' and rather than 'got'
it should be 'nuuids'.  Alter the logic of the list traversal to
utilize those names.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agosecret: Alter cleanup path for virSecretObjListGetUUIDs
John Ferlan [Tue, 25 Apr 2017 13:51:29 +0000 (09:51 -0400)] 
secret: Alter cleanup path for virSecretObjListGetUUIDs

Rather than using "ret = -1" and cleanup processing, alter the return
path on failure to goto error and then just return the data.got.

In the error path, we no longer check for ret < 0, we just can free
anything added to the array and return -1 directly.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agosecret: Use virSecretDefPtr rather than deref from virSecretObjPtr
John Ferlan [Mon, 3 Apr 2017 12:11:32 +0000 (08:11 -0400)] 
secret: Use virSecretDefPtr rather than deref from virSecretObjPtr

Rather than dereferencing obj->def->X, create a local 'def' variable
that will dereference the def and use directly.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agosecret: Use consistent naming for variables
John Ferlan [Sat, 1 Apr 2017 15:46:36 +0000 (11:46 -0400)] 
secret: Use consistent naming for variables

When processing a virSecretPtr use 'secret' as a variable name.

When processing a virSecretObjPtr use 'obj' as a variable name.

When processing a virSecretDefPtr use 'def' as a variable name,
unless a distinction needs to be made with a 'newdef' such as
virSecretObjListAddLocked (which also used the VIR_STEAL_PTR macro
for the configFile and base64File).

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agosecret: Add NULL obj check to virSecretObjListRemove
John Ferlan [Tue, 25 Apr 2017 13:17:22 +0000 (09:17 -0400)] 
secret: Add NULL obj check to virSecretObjListRemove

Rather than have the caller check if !obj before calling, just check
in the function for !obj and return.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agosecret: Make some virSecretObj* functions static
John Ferlan [Wed, 5 Apr 2017 20:58:32 +0000 (16:58 -0400)] 
secret: Make some virSecretObj* functions static

Make various virSecretObjList*Locked functions static and make
virSecretObjNew static since they're only called within virtsecretobj.c.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agonwfilter: Move save of config until after successful assign
John Ferlan [Thu, 20 Apr 2017 15:51:22 +0000 (11:51 -0400)] 
nwfilter: Move save of config until after successful assign

Only save the config when using a generated UUID if we were able to
create an object for the def. There could have been "other reasons"
for the assignment to fail, so saving the config could be incorrect.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agonwfilter: Move creation of configDir to driver initialization
John Ferlan [Wed, 19 Apr 2017 20:20:27 +0000 (16:20 -0400)] 
nwfilter: Move creation of configDir to driver initialization

Rather than "wait" for the first config file to be created, force creation
of the configDir during driver state initialization.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agonwfilter: Replace virNWFilterSaveDef with virNWFilterSaveConfig
John Ferlan [Wed, 19 Apr 2017 18:19:41 +0000 (14:19 -0400)] 
nwfilter: Replace virNWFilterSaveDef with virNWFilterSaveConfig

Essentially virNWFilterSaveDef executed in a different order the same
sequence of calls, so let's just make one point of reference.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agonwfilter: Replace virNWFilterConfigFile with virFileBuildPath
John Ferlan [Wed, 19 Apr 2017 17:38:21 +0000 (13:38 -0400)] 
nwfilter: Replace virNWFilterConfigFile with virFileBuildPath

Remove open coded helper.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agonwfilter: Make a common UUID lookup function from driver
John Ferlan [Tue, 18 Apr 2017 17:47:35 +0000 (13:47 -0400)] 
nwfilter: Make a common UUID lookup function from driver

Rather than separate calls, use a common call and generate a better
error message which includes the incorrect uuidstr.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agonwfilter: Make _virNWFilterObjList private
John Ferlan [Tue, 18 Apr 2017 16:52:10 +0000 (12:52 -0400)] 
nwfilter: Make _virNWFilterObjList private

Move from virnwfilterobj.h to virnwfilterobj.c.

Create the virNWFilterObjListNew() API in order to allocate.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agonwfilter: Rename some virNWFilterObj* API's
John Ferlan [Tue, 18 Apr 2017 16:38:50 +0000 (12:38 -0400)] 
nwfilter: Rename some virNWFilterObj* API's

Prefix should have been virNWFilterObjList since the API is operating on
the list of filters.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agonwfilter: Introduce virNWFilterObjNew
John Ferlan [Thu, 20 Apr 2017 15:15:28 +0000 (11:15 -0400)] 
nwfilter: Introduce virNWFilterObjNew

Perform the object initialization in a helper rather than inline.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agonwfilter: Make _virNWFilterObjPtr private
John Ferlan [Tue, 18 Apr 2017 16:02:12 +0000 (12:02 -0400)] 
nwfilter: Make _virNWFilterObjPtr private

Move the structure to virnwfilterobj.c and create necessary accessor API's
for the various fields.

Also make virNWFilterObjFree static since there's no external callers.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agonwfilter: Convert wantRemoved to bool
John Ferlan [Tue, 18 Apr 2017 13:11:51 +0000 (09:11 -0400)] 
nwfilter: Convert wantRemoved to bool

It is what it is anyway, so let's describe it that way too.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agonwfilter: Remove unused 'active' in virNWFilterObj
John Ferlan [Tue, 18 Apr 2017 13:10:45 +0000 (09:10 -0400)] 
nwfilter: Remove unused 'active' in virNWFilterObj

It was only ever set to false, which is ironically the default.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agonwfilter: Use virNWFilterDefPtr rather than deref virNWFilterObjPtr
John Ferlan [Wed, 19 Apr 2017 02:32:32 +0000 (22:32 -0400)] 
nwfilter: Use virNWFilterDefPtr rather than deref virNWFilterObjPtr

Rather than dereferencing obj->def->XXX or nwfilters->objs[i]->X
create local virNWFilterObjPtr and virNWFilterDefPtr variables.

Future adjustments will be privatizing the object more, so this just
prepares the code for that reality.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agonwfilter: Use consistent naming for variables
John Ferlan [Wed, 19 Apr 2017 02:30:15 +0000 (22:30 -0400)] 
nwfilter: Use consistent naming for variables

When processing a virNWFilterPtr use 'nwfilter' as a variable name.

When processing a virNWFilterObjPtr use 'obj' as a variable name.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoIPv6 route check: list devices only once
Cédric Bosdonnat [Wed, 26 Apr 2017 09:45:42 +0000 (11:45 +0200)] 
IPv6 route check: list devices only once

If several RA routes are found for the same device, only list that
device once in the error message.

8 years agoUse a separate buffer for <filesystem><driver>
Ján Tomko [Mon, 22 Aug 2016 15:45:18 +0000 (17:45 +0200)] 
Use a separate buffer for <filesystem><driver>

Format the attributes in a separate buffer and only
print the element if it's not empty.

8 years agoUse a separate buffer for <controller><driver>
Ján Tomko [Mon, 22 Aug 2016 14:50:45 +0000 (16:50 +0200)] 
Use a separate buffer for <controller><driver>

Make adding new attributes easier.

8 years agoUse a separate buffer for <disk><driver>
Ján Tomko [Mon, 22 Aug 2016 13:31:35 +0000 (15:31 +0200)] 
Use a separate buffer for <disk><driver>

Eliminate the big condition at the start.
Instead use a buffer and only format the element if the buffer
is non-empty.

8 years agoUse a separate buffer for <input> subelements
Ján Tomko [Mon, 8 Aug 2016 13:38:20 +0000 (15:38 +0200)] 
Use a separate buffer for <input> subelements

Instead of figuring out upfront whether <input> will be a single
or a pair element, format the subelements into a separate buffer
and close <input/> early if this buffer is empty.

8 years agodocs: Provide a nodedev driver stub documentation
Erik Skultety [Mon, 27 Mar 2017 07:03:02 +0000 (09:03 +0200)] 
docs: Provide a nodedev driver stub documentation

There's lot more to document about the nodedev driver, besides PCI and
SR-IOV (even this might need to be extended), but let's start small-ish
and at least have a page for it linked from the drivers.html.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agodisk: Use virStorageBackendZeroPartitionTable
John Ferlan [Fri, 7 Apr 2017 13:36:05 +0000 (09:36 -0400)] 
disk: Use virStorageBackendZeroPartitionTable

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

During 'matrix' testing of all possible combinations I found that if
device is formated with "gpt" first, then an attempt is made to format
using "mac", a startup will fail.

Deeper analysis by Peter Krempa indicates that the "mac" table fits
into the first block on the disk. Since the GPT disklabel is stored
at LBA address 1 it is not overwritten at all. Thus it's apparent that
the (blkid) detection tool then prefers GPT over a older disklabel.

The GPT disklabel has also a secondary copy at the last LBA of the disk.

So, follow the same logic as the logical pool in clearing a 1MB swath
at the beginning and end of the device to avoid potential issues with
larger sector sizes for the device.

Also fixed a minor formatting nit in virStorageBackendDeviceIsEmpty call.

8 years agological: Increase the size of the data to wipe
John Ferlan [Fri, 7 Apr 2017 15:53:07 +0000 (11:53 -0400)] 
logical: Increase the size of the data to wipe

Since a sector size may be larger than 512 bytes, let's just increase
the size to wipe to 1MB rather than 2KB

8 years agological: Use virStorageBackendZeroPartitionTable
John Ferlan [Thu, 6 Apr 2017 17:29:21 +0000 (13:29 -0400)] 
logical: Use virStorageBackendZeroPartitionTable

Rather than open code it, use the new function which uses the wipe algorithm
in order to zero the front and tail of the partition.

8 years agostorage: Introduce virStorageBackendZeroPartitionTable
John Ferlan [Thu, 6 Apr 2017 17:18:16 +0000 (13:18 -0400)] 
storage: Introduce virStorageBackendZeroPartitionTable

Create a wrapper/helper that can be used to call the storage backend
wipe helper - storageBackendVolWipeLocalFile for future use by logical
and disk backends to clear out the partition table rather than having
each open code the same algorithm.

8 years agostorage: Modify storageBackendWipeLocal to allow zero from end of device
John Ferlan [Fri, 7 Apr 2017 15:23:38 +0000 (11:23 -0400)] 
storage: Modify storageBackendWipeLocal to allow zero from end of device

Add bool 'zero_end' and logic that would allow a caller to wipe specific
portions of a target device either from the beginning (the default) or
from the end when zero_end is true.

This will allow for this code to wipe out partition table information
from a device.

8 years agoUpdate keycodemapdb submodule for python2 compat fixes
Daniel P. Berrange [Wed, 26 Apr 2017 10:52:49 +0000 (11:52 +0100)] 
Update keycodemapdb submodule for python2 compat fixes

There were a few bugs in keycodemap tool that broke it
when run on python circa 2.7.5 or older, which affected
RHEL builds.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoAdd ability to generate man page describing key code names & values
Daniel P. Berrange [Fri, 3 Mar 2017 12:43:51 +0000 (12:43 +0000)] 
Add ability to generate man page describing key code names & values

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoutil: switch over to use keycodemapdb GIT submodule
Daniel P. Berrange [Thu, 2 Mar 2017 10:46:53 +0000 (10:46 +0000)] 
util: switch over to use keycodemapdb GIT submodule

A long time ago we imported the keymaps.csv file from GTK-VNC so we
can do conversions between keycode sets. Meanwhile lots of bug fixes
have gone into this CSV file and libvirt hasn't kept in sync. The
keymaps.csv file and associated generator script has been pulled out
of GTK-VNC into a dedicated GIT repo for use as a submodule. This
allows GTK-VNC, SPICE-GTK, QEMU and libvirt to share the same master
database and tools and pushing updates merely requires a submodule
commit update as with gnulib.

The test suite is updated to cover some extra boundary conditions.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agosecret: Clean up virSecretObjListExport logic
John Ferlan [Mon, 24 Apr 2017 16:50:12 +0000 (12:50 -0400)] 
secret: Clean up virSecretObjListExport logic

Shorten the time needed to keep the list lock and alter the cleanup
path to be more of an error path.

Utilize the the virObjectListFree function to handle the calls for
virObjectUnref on each list element and the VIR_FREE of the list
instead of open coding it.

Change the name of the virHashForEach callback to match the name
of the Export function with the Callback added onto it.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agosecret: Have virSecretObjNew return locked object
John Ferlan [Thu, 20 Apr 2017 15:22:21 +0000 (11:22 -0400)] 
secret: Have virSecretObjNew return locked object

Rather than have caller need to do it, have the object returned locked.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agosecret: Convert virsecretobjs.h to use "newer" formatting style
John Ferlan [Mon, 3 Apr 2017 11:47:58 +0000 (07:47 -0400)] 
secret: Convert virsecretobjs.h to use "newer" formatting style

Alter the prototypes to use the newer formatting style

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agosecret: Need to set data->error on VIR_ALLOC_N failure
John Ferlan [Fri, 14 Apr 2017 16:35:26 +0000 (12:35 -0400)] 
secret: Need to set data->error on VIR_ALLOC_N failure

Commit id 'bb1fba629' neglected to set when creating the function.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agotest: Remove unnecessary unlocks in cleanup paths
John Ferlan [Fri, 14 Apr 2017 13:24:33 +0000 (09:24 -0400)] 
test: Remove unnecessary unlocks in cleanup paths

Commit id '865f479da' altered the logic to use a common test*ObjFindByName
helpers which would lock/unlock the test driver; however, a few cleanup paths
in that cleanup missed removing the Unlock, so remove it now.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoremote: Fix possible use-after-free when sending event message
John Ferlan [Mon, 27 Mar 2017 16:47:37 +0000 (12:47 -0400)] 
remote: Fix possible use-after-free when sending event message

Based upon an idea and some research by Wang King <king.wang@huawei.com>
and xinhua.Cao <caoxinhua@huawei.com>.

Since we're assigning the 'client' to our callback event lookaside list,
it's imperative that we grab a reference to the object; otherwise, when
the object is unref'd during virNetServerProcessClients when it's determined
that the virNetServerClientIsClosed and the memory is free'd before perhaps
the object event state callbacks are run.  When a virObjectLock() is run,
before sending the message the following trace occurs;

    #0  0x00007fda223d66d8 in virClassIsDerivedFrom
        (klass=0xdeadbeef, parent=0x7fda24c81b40)
         at util/virobject.c:169
    #1  0x00007fda223d6a1e in virObjectIsClass
        (anyobj=anyobj@entry=0x7fd9e575b400, klass=<optimized out>)
         at util/virobject.c:365
    #2  0x00007fda223d6a44 in virObjectLock
        (anyobj=0x7fd9e575b400)
        at util/virobject.c:317
    #3  0x00007fda22507f71 in virNetServerClientSendMessage
        (client=client@entry=0x7fd9e575b400, msg=msg@entry=0x7fd9ec30de90)
        at rpc/virnetserverclient.c:1422
    #4  0x00007fda230d714d in remoteDispatchObjectEventSend
        (client=0x7fd9e575b400, program=0x7fda24c844e0, procnr=348,
         proc=0x7fda2310e5e0 <xdr_remote_domain_event_callback_tunable_msg>,
         data=0x7ffc3857fdb0)
        at remote.c:3803
    #5  0x00007fda230dd71b in remoteRelayDomainEventTunable
        (conn=<optimized out>, dom=0x7fda27cd7660, params=0x7fda27f3aae0,
         nparams=1,opaque=0x7fd9e6c99e00)
        at remote.c:1033
    #6  0x00007fda224484cb in virDomainEventDispatchDefaultFunc
        (conn=0x7fda27cd0120, event=0x7fda2736ea00, cb=0x7fda230dd610
         <remoteRelayDomainEventTunable>, cbopaque=0x7fd9e6c99e00)
        at conf/domain_event.c:1910
    #7  0x00007fda22446871 in virObjectEventStateDispatchCallbacks
        (callbacks=<optimized out>, callbacks=<optimized out>,
         event=0x7fda2736ea00,state=0x7fda24ca3960)
        at conf/object_event.c:722
    #8  virObjectEventStateQueueDispatch
        (callbacks=0x7fda24c65800, queue=0x7ffc3857fe90, state=0x7fda24ca3960)
        at conf/object_event.c:736
    #9  virObjectEventStateFlush (state=0x7fda24ca3960)
        at conf/object_event.c:814
    #10 virObjectEventTimer (timer=<optimized out>, opaque=0x7fda24ca3960)
        at conf/object_event.c:560
    #11 0x00007fda223ae8b9 in virEventPollDispatchTimeouts ()
        at util/vireventpoll.c:458
    #12 virEventPollRunOnce ()
        at util/vireventpoll.c:654
    #13 0x00007fda223ad1d2 in virEventRunDefaultImpl ()
        at util/virevent.c:314
    #14 0x00007fda225046cd in virNetDaemonRun (dmn=0x7fda24c775c0)
        at rpc/virnetdaemon.c:818
    #15 0x00007fda230d6351 in main (argc=<optimized out>, argv=<optimized out>)
        at libvirtd.c:1623

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agodaemon: Rework remoteClientFreeFunc cleanup loops into C macro
John Ferlan [Mon, 27 Mar 2017 16:47:36 +0000 (12:47 -0400)] 
daemon: Rework remoteClientFreeFunc cleanup loops into C macro

Rather than 'n' repetitive code segments, let's create a single macro
which will make the code easier to read.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agodaemon: Remove unnecessary goto error
Wang King [Mon, 24 Apr 2017 04:05:25 +0000 (12:05 +0800)] 
daemon: Remove unnecessary goto error

Freeing the dst is unnecessary if the VIR_STRDUP fails, and therefore
we need to remove the error label as well.

8 years agodaemon: Fix domain name leak in error path
Wang King [Mon, 24 Apr 2017 04:05:24 +0000 (12:05 +0800)] 
daemon: Fix domain name leak in error path

Domain name is duplicated in make_nonnull_domain, but not freed when
virTypedParamsSerialize returns error.

8 years agoqemu: fix argument of virDomainNetGetActualDirectMode
ZhiPeng Lu [Tue, 25 Apr 2017 06:16:20 +0000 (14:16 +0800)] 
qemu: fix argument of virDomainNetGetActualDirectMode

it should be a comparison of modes between new and old devices. So
the argument of the second virDomainNetGetActualDirectMode should be
newdev.

Signed-off-by: ZhiPeng Lu <lu.zhipeng@zte.com.cn>
8 years agoautogen.sh: Improve and generalize
Andrea Bolognani [Wed, 12 Apr 2017 11:09:08 +0000 (13:09 +0200)] 
autogen.sh: Improve and generalize

The goal is twofold: firstly, we want to extend the script so
that it can deal with more than a single git submodule, and
secondly we'd like to reduce the amount of duplicated code.
Moreover, since we're making heavy changes to the code anyway,
we might as well make sure it follows a somewhat consistent
coding style too.

To reduce code duplication, we introduce a new --dry-run
option, which can be used by third parties to figure out
whether calling autogen.sh is necessary or not: this allows
us to get rid of the reimplementation of part of the logic
in cfg.mk and guarantee they'll never get out of sync.

Other changes include: making dirty submodules checking and
cleaning entirely independent of other operations; removing
the use of 'set -e' and handling errors explicitly instead;
better parsing of command line arguments.

8 years agoFix minor typos
Yuri Chornoivan [Sat, 22 Apr 2017 19:06:20 +0000 (22:06 +0300)] 
Fix minor typos

8 years agoutil: relax virNetDevSetCoalesce() stub
Roman Bogorodskiy [Sun, 23 Apr 2017 14:53:37 +0000 (18:53 +0400)] 
util: relax virNetDevSetCoalesce() stub

Currently, virNetDevSetCoalesce() stub is always returning error. As
it's used by virNetDevTapCreateInBridgePort(), it essentially breaks
bridged networking if coalesce is not supported.

To make it work, relax the stub to trigger error only when its
coalesce argument is not NULL, otherwise report success.