]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
7 years agolockd: Install the admin sockets
John Ferlan [Tue, 6 Feb 2018 15:51:08 +0000 (10:51 -0500)]
lockd: Install the admin sockets

Commit id 'ce7ae55e' added support for the lockd admin socket, but
forgot to add the socket to the make and spec files for installation
purposes.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
7 years agologd: Install the admin sockets
John Ferlan [Tue, 6 Feb 2018 15:57:25 +0000 (10:57 -0500)]
logd: Install the admin sockets

Commit id '85d45ff0' added support for the logd admin socket, but
forgot to add the socket to the make and spec files for installation
purposes.

NB: Includes breaking up the long %systemd_ lists across multiple lines
    for ease of reading

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
7 years agodocs: document requirement to provide Signed-off-by lines for DCO
Daniel P. Berrange [Mon, 22 Jan 2018 12:37:31 +0000 (12:37 +0000)]
docs: document requirement to provide Signed-off-by lines for DCO

Document that contributors are required to assert compliance with the
Developers Certification of Origin 1.1, by providing Signed-off-by tags
for all commit messages. The DCO is formally stating what we have long
implicitly expected of contributors in terms of their legal rights to
make the contribution. This puts the project in a stronger position
should any questions around contributions be raised going forward in the
future.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agocfg: forbid includes of headers in network and storage drivers again
Daniel P. Berrangé [Thu, 25 Jan 2018 10:53:54 +0000 (10:53 +0000)]
cfg: forbid includes of headers in network and storage drivers again

Loadable drivers must never depend on each other. Over time some usage
mistakenly crept in for the storage and network drivers, but now this is
eliminated the syntax-check rules can enforce this separation once more.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agobuild: passing the "-z defs" linker flag to prevent undefined symbols
Daniel P. Berrangé [Thu, 25 Jan 2018 09:35:58 +0000 (09:35 +0000)]
build: passing the "-z defs" linker flag to prevent undefined symbols

Undefined symbols are a bad thing in general because they can get
resolved in unexpected ways at runtime if multiple sources provide the
same symbol name. For example both glibc and libtirpc may provide XDR
symbols and we want to ensure that we resolve to libtirpc if that's what
we originally built against.

The toolchain maintainers thus strongly recommend that all applications
use the '-z defs' linker flag to prevent undefined symbols. This is
shortly becoming part of the default linker flags for RPMs. As an added
benefit this aligns Linux builds with Windows builds, where the linker
has never permitted undefined symbols.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agobuild: provide a AM_FLAGS_MOD for loadable modules
Daniel P. Berrangé [Thu, 25 Jan 2018 09:35:57 +0000 (09:35 +0000)]
build: provide a AM_FLAGS_MOD for loadable modules

Dynamic loadable modules all need a common set of linker flags

  -module -avoid-version $(AM_LDFLAGS)

Bundle those up into a $(AM_LDFLAGS_MOD) to avoid repetition.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agobuild: explicitly link all modules with libvirt.so
Daniel P. Berrangé [Thu, 25 Jan 2018 09:35:56 +0000 (09:35 +0000)]
build: explicitly link all modules with libvirt.so

The dlopened modules we currently build all use various symbols from
libvirt.so, but don't actually link to it. They rely on the libvirtd
daemon re-exporting the libvirt.so symbols. This means that at the
time the modules are linked, they contain a huge number of undefined
symbols. It also means that these undefined symbols are not versioned,
so despite us providing a LIBVIRT_PRIVATE_XXXX version that
intentionally changes on every release, the loadable modules could
actually be loaded into any libvirtd regardless of version.

This change explicitly links all modules against libvirt.so so
that they don't rely on the re-export behave and can be fully resolved
at build time. This will give us a stronger guarantee modules will
actually be loadable at runtime and that we're using modules from the
matched build.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agostorage: export virStoragePoolLookupByTargetPath as a public API
Daniel P. Berrangé [Thu, 25 Jan 2018 09:35:52 +0000 (09:35 +0000)]
storage: export virStoragePoolLookupByTargetPath as a public API

The storagePoolLookupByTargetPath() method in the storage driver is used
by the QEMU driver during block migration. If there's a valid use case
for this in the QEMU driver, then external apps likely have similar
needs. Exposing it in the public API removes the direct dependancy from
the QEMU driver to the storage driver.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoconf: move virStorageTranslateDiskSourcePool into domain conf
Daniel P. Berrangé [Thu, 25 Jan 2018 09:35:51 +0000 (09:35 +0000)]
conf: move virStorageTranslateDiskSourcePool into domain conf

The virStorageTranslateDiskSourcePool method modifies a virDomainDiskDef
to resolve any storage pool reference. For some reason this was added
into the storage driver code, despite working entirely in terms of the
public APIs. Move it into the domain conf file and rename it to match the
object it modifies.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agonetwork: remove conditional declarations
Daniel P. Berrangé [Thu, 25 Jan 2018 09:35:51 +0000 (09:35 +0000)]
network: remove conditional declarations

The networkDnsmasqConfContents() method is only used by the test suite
and that's only built with WITH_NETWORK is set. So there is no longer
any reason to conditionalize the declaration of this method.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoconf: expand network device callbacks to cover resolving NIC type
Daniel P. Berrangé [Thu, 25 Jan 2018 09:35:50 +0000 (09:35 +0000)]
conf: expand network device callbacks to cover resolving NIC type

Currently the QEMU driver will call directly into the network driver
impl to modify resolve the atual type of NICs with type=network. It
has todo this before it has allocated the actual NIC. This introduces
a callback system to allow us to decouple the QEMU driver from the
network driver.

This is a short term step, as it ought to be possible to achieve the
same end goal by simply querying XML via the public network API. The
QEMU code in question though, has no virConnectPtr conveniently
available at this time.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoqemu: replace networkGetNetworkAddress with public API calls
Daniel P. Berrangé [Thu, 25 Jan 2018 09:35:49 +0000 (09:35 +0000)]
qemu: replace networkGetNetworkAddress with public API calls

The QEMU driver calls into the network driver to get the first IP
address of the network. This information is readily available via the
formal public API by fetching the XML doc and then parsing it.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoconf: expand network device callbacks to cover bandwidth updates
Daniel P. Berrangé [Thu, 25 Jan 2018 09:35:48 +0000 (09:35 +0000)]
conf: expand network device callbacks to cover bandwidth updates

Currently the QEMU driver will call directly into the network driver
impl to modify network device bandwidth for interfaces with
type=network. This introduces a callback system to allow us to decouple
the QEMU driver from the network driver.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoconf: introduce callback registration for domain net device allocation
Daniel P. Berrangé [Thu, 25 Jan 2018 09:35:47 +0000 (09:35 +0000)]
conf: introduce callback registration for domain net device allocation

Currently virt drivers will call directly into the network driver impl
to allocate domain interface devices where type=network. This introduces
a callback system to allow us to decouple the virt drivers from the
network driver.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agobuild: link libvirt_lxc against libvirt.so
Daniel P. Berrangé [Thu, 25 Jan 2018 09:35:59 +0000 (09:35 +0000)]
build: link libvirt_lxc against libvirt.so

Rather than static linking in various of the helper libraries to
libvirt_lxc, just link against the main libvirt.so. This is more memory
and time efficient because it will already be cached in memory and
sharable between processes.

CAPNG flags need adding because the LXC code directly calls various
libcapng APIs and no longer inherits the CAPNG flags via the statically
linked .a libs.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agorpc: don't link in second copy of RPC code to libvirtd & lockd plugin
Daniel P. Berrangé [Thu, 25 Jan 2018 09:35:47 +0000 (09:35 +0000)]
rpc: don't link in second copy of RPC code to libvirtd & lockd plugin

The libvirt_driver_remote.la static library is linked into the
libvirt.so dynamic library, providing both the generic RPC layer code
and the remote protocol client driver. The libvirtd daemon the itself
links to libvirt_driver_remote.la, in order to get access to the generic
RPC layer code and the XDR functions for the remote driver. This means
we get multiple copies of the same code in libvirtd, one direct and one
indirect via libvirt.so. The same mistake affects the lockd plugin.

The libvirtd daemon should instead just link aganist the generic RPC
layer code that's in libvirt.so. This is easily doable if we add exports
for the few symbols we've previously missed, and wildcard export xdr_*
to expose the auto-generated XDR marshallers.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agostorage: move storage file backend framework into util directory
Daniel P. Berrangé [Thu, 25 Jan 2018 09:35:46 +0000 (09:35 +0000)]
storage: move storage file backend framework into util directory

The QEMU driver loadable module needs to be able to resolve all ELF
symbols it references against libvirt.so. Some of its symbols can only
be resolved against the storage_driver.so loadable module which creates
a hard dependancy between them. By moving the storage file backend
framework into the util directory, this gets included directly in the
libvirt.so library. The actual backend implementations are still done as
loadable modules, so this doesn't re-add deps on gluster libraries.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agostorage: extract storage file backend from main storage driver backend
Daniel P. Berrangé [Thu, 25 Jan 2018 09:35:44 +0000 (09:35 +0000)]
storage: extract storage file backend from main storage driver backend

The storage driver backends are serving the public storage pools API,
while the storage file backends are serving the internal QEMU driver and
/ or libvirt utility code.

To prep for moving this storage file backend framework into the utility
code, split out the backend definitions.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agofix regex to check CN from server certificate
Tiago M. Vieira [Fri, 26 Jan 2018 19:33:02 +0000 (14:33 -0500)]
fix regex to check CN from server certificate

Currently when the script validates the PKI files and
the certificate 'Subject:' field contains RDNs after
the Common Name (CN), these values are also included,
creating a false result that the CN is not correct.

A small change to the sed regex fixes this issue, by
extracting only the value for CN and nothing else. The
regex is replaced with the exact same regex used to
extract the CN value from the client certificate.

7 years agoAUTHORS: Add myself to the list of committers
Christian Ehrhardt [Thu, 8 Feb 2018 11:44:09 +0000 (12:44 +0100)]
AUTHORS: Add myself to the list of committers

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agoutil: Fix syntax-check
Andrea Bolognani [Wed, 7 Feb 2018 13:39:18 +0000 (14:39 +0100)]
util: Fix syntax-check

Broken by 759b4d1b0fe5f4d84d98b99153dfa7ac289dd167.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agovirlog: determine the hostname on startup CVE-2018-6764
Lubomir Rintel [Sat, 27 Jan 2018 22:43:58 +0000 (23:43 +0100)]
virlog: determine the hostname on startup CVE-2018-6764

At later point it might not be possible or even safe to use getaddrinfo(). It
can in turn result in a load of NSS module.

Notably, on a LXC container startup we may find ourselves with the guest
filesystem already having replaced the host one. Loading a NSS module
from the guest tree would allow a malicous guest to escape the
confinement of its container environment because libvirt will not yet
have locked it down.

7 years agoqemu: Limit refresh of CPU halted state to s390
Viktor Mihajlovski [Tue, 6 Feb 2018 10:18:56 +0000 (11:18 +0100)]
qemu: Limit refresh of CPU halted state to s390

Refreshing the halted state can cause VM performance issues. Since
s390 is currently the only architecture with a known interest in
the halted state, we're avoiding to call QEMU on other platforms.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
7 years agoqemu: domain: Store vcpu halted state as a tristate
Peter Krempa [Tue, 6 Feb 2018 15:00:45 +0000 (16:00 +0100)]
qemu: domain: Store vcpu halted state as a tristate

Since it may be possible that the state is unknown in some cases we
should store it as a tristate so that other code using it can determine
whether the state was updated.

7 years agoqemu: Remove unused 'cpuhalted' argument from qemuDomainHelperGetVcpus
Peter Krempa [Tue, 6 Feb 2018 14:55:14 +0000 (15:55 +0100)]
qemu: Remove unused 'cpuhalted' argument from qemuDomainHelperGetVcpus

The halted state is no longer extracted using this helper so the
argument can be removed.

7 years agoqemu: driver: Extract vcpu halted state directly
Peter Krempa [Tue, 6 Feb 2018 14:50:05 +0000 (15:50 +0100)]
qemu: driver: Extract vcpu halted state directly

Don't extract the halted state into a separate array, but rater access
the vcpu structures directly. We still need to call the vcpu helper to
retrieve the performance statistics though.

7 years agoconf: Check for NUMA distances in validity check
Michal Privoznik [Tue, 6 Feb 2018 16:11:40 +0000 (17:11 +0100)]
conf: Check for NUMA distances in validity check

NUMA distances are part of guest ABI (guests can read it
directly!) and therefore as such shouldn't change throughout the
lifetime of domain.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoapparmor: allow libvirt to send term signal to unconfined
Guido Günther [Wed, 17 Jan 2018 15:34:01 +0000 (16:34 +0100)]
apparmor: allow libvirt to send term signal to unconfined

Otherwise stopping domains with qemu://session fails like

[164012.338157] audit: type=1400 audit(1516202208.784:99): apparmor="DENIED" operation="signal" profile="/usr/sbin/libvirtd" pid=18835 comm="libvirtd" requested_mask="send" denied_mask="send" signal=term peer="unconfined"

7 years agovirt-aa-helper: Set the supported features
Shivaprasad G Bhat [Tue, 6 Feb 2018 13:08:14 +0000 (08:08 -0500)]
virt-aa-helper: Set the supported features

The virt-aa-helper fails to parse the xmls with the memory/cpu
hotplug features or user assigned aliases. Set the features in
xmlopt->config for the parsing to succeed.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agoqemu: Initialize @priv in qemuDomainCoreDumpWithFormat
John Ferlan [Tue, 6 Feb 2018 14:08:13 +0000 (09:08 -0500)]
qemu: Initialize @priv in qemuDomainCoreDumpWithFormat

Fix for a CI build failure

7 years agodocs: Add news article for query memory-only dump processing percentage
John Ferlan [Fri, 26 Jan 2018 19:38:21 +0000 (14:38 -0500)]
docs: Add news article for query memory-only dump processing percentage

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Allow showing the dump progress for memory only dump
John Ferlan [Mon, 20 Nov 2017 20:40:30 +0000 (15:40 -0500)]
qemu: Allow showing the dump progress for memory only dump

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

If the QEMU version running is new enough (based on the DUMP_COMPLETED
event), then we can add a 'detach' boolean to the dump-guest-memory
command in order to tell QEMU to run in a thread. This ensures that we
don't lock out other commands while the potentially long running dump
memory is completed.

This allows the usage of a qemuDumpWaitForCompletion which will wait
for the event while the qemuDomainGetJobInfoDumpStats can be used via
qemuDomainGetJobInfo in order to query QEMU to determine how far along
the job is.

Now that we have a true async job, we'll only set the dump_memory_only
flag only when @detach=false; otherwise, we note that the job is a
for stats dump this allows the opposite end for job info to determine
what to copy.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Add new parameter to qemuMonitorDumpToFd
John Ferlan [Mon, 20 Nov 2017 20:05:23 +0000 (15:05 -0500)]
qemu: Add new parameter to qemuMonitorDumpToFd

Add a @detach parameter to the API in order allow running the QEMU
code as a thread.

Reviewed-by: Jiri Denemark <jdenemar redhat com>
7 years agoqemu: Introduce qemuDomainGetJobInfoDumpStats
John Ferlan [Mon, 20 Nov 2017 20:56:17 +0000 (15:56 -0500)]
qemu: Introduce qemuDomainGetJobInfoDumpStats

Add an API to allow fetching the memory only dump statistics
for a job via the qemuDomainGetJobInfo API.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Introduce qemuMonitor[JSON]QueryDump
John Ferlan [Mon, 20 Nov 2017 20:02:59 +0000 (15:02 -0500)]
qemu: Introduce qemuMonitor[JSON]QueryDump

Add the query-dump API's in order to allow the dump-guest-memory
to be used to monitor progress. This will use the dump stats
extraction helper to fill a return buffer.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Introduce qemuProcessHandleDumpCompleted
John Ferlan [Mon, 20 Nov 2017 14:51:22 +0000 (09:51 -0500)]
qemu: Introduce qemuProcessHandleDumpCompleted

Handle a DUMP_COMPLETED event processing the status, stats, and
error string. Use the @status in order to copy the error that
was generated whilst processing the @stats data. If an error was
provided by QEMU, then use that instead.

If there's no async job, we can just ignore the data.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Add support for DUMP_COMPLETED event
John Ferlan [Mon, 20 Nov 2017 13:56:24 +0000 (08:56 -0500)]
qemu: Add support for DUMP_COMPLETED event

The event will be fired when the domain memory only dump completes.

Fill in a return buffer to store/pass along the dump statistics that
will be eventually shared by a query-dump command. Also pass along
the status of the filling and any possible error received.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Introduce QEMU_DOMAIN_JOB_STATS_TYPE_MEMDUMP
John Ferlan [Thu, 1 Feb 2018 21:07:30 +0000 (16:07 -0500)]
qemu: Introduce QEMU_DOMAIN_JOB_STATS_TYPE_MEMDUMP

Define the qemuMonitorDumpStats as a new job JobStatsType to handle
being able to get memory dump statistics. For now do nothing with
the new TYPE_MEMDUMP.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Introduce QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP
John Ferlan [Sat, 27 Jan 2018 16:01:25 +0000 (11:01 -0500)]
qemu: Introduce QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP

Add a TYPE_SAVEDUMP so that when coalescing stats for a save or
dump we don't needlessly try to get the mirror stats for a migration.
Other conditions can still use MIGRATION and SAVEDUMP interchangably
including usage of the @migStats field to fetch/store the data.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Convert jobInfo stats into a union
John Ferlan [Fri, 26 Jan 2018 17:30:50 +0000 (12:30 -0500)]
qemu: Convert jobInfo stats into a union

Convert the stats field in _qemuDomainJobInfo to be a union. This
will allow for the collection of various different types of stats
in the same field.

When starting the async job that will end up being used for stats,
set the @statsType value appropriately. The @mirrorStats are
special and are used with stats.mig in order to generate the
returned job stats for a migration.

Using the NONE should avoid the possibility that some random
async job would try to return stats for migration even though
a migration is not in progress.

For now a migration and a save job will use the same statsType

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoutil: bitmap: Note that shrinking the bitmap requires clearing of unused bits
Peter Krempa [Mon, 5 Feb 2018 13:05:05 +0000 (14:05 +0100)]
util: bitmap: Note that shrinking the bitmap requires clearing of unused bits

Note the fact that the unused portion of the last element in the bitmap
needs to be cleared, since we use functions which process only full-size
elements and don't really deal with individual bits.

7 years agoutil: bitmap: Use VIR_SHRINK_N in virBitmapShrink
Peter Krempa [Mon, 5 Feb 2018 12:50:44 +0000 (13:50 +0100)]
util: bitmap: Use VIR_SHRINK_N in virBitmapShrink

The function only reduces the size of the bitmap thus we can use the
appropriate shrinking function which also does not have any return
value.

Since virBitmapShrink now does not return any value callers need to be
fixed as well.

7 years agoutil: bitmap: Fix value of 'map_alloc' when shrinking bitmap
Peter Krempa [Mon, 5 Feb 2018 12:36:57 +0000 (13:36 +0100)]
util: bitmap: Fix value of 'map_alloc' when shrinking bitmap

The virBitmap code uses VIR_RESIZE_N to do quadratic scaling, which
means that along with the number of requested map elements we also need
to keep the number of actually allocated elements for the scaling
algorithm to work properly.

The shrinking code did not fix 'map_alloc' thus virResizeN might
actually not expand the bitmap properly after called on a previously
shrunk bitmap.

7 years agoutil: bitmap: Add comments for functions which don't have them
Peter Krempa [Mon, 5 Feb 2018 12:32:05 +0000 (13:32 +0100)]
util: bitmap: Add comments for functions which don't have them

virBitmap code is thoroughly documented. Add docs for the few functions
missing them.

7 years agoutil: bitmap: Fix function formatting and spacing
Peter Krempa [Mon, 5 Feb 2018 12:17:49 +0000 (13:17 +0100)]
util: bitmap: Fix function formatting and spacing

7 years agoutil: bitmap: Rename 'max_bit' to 'nbits'
Peter Krempa [Mon, 5 Feb 2018 10:24:05 +0000 (11:24 +0100)]
util: bitmap: Rename 'max_bit' to 'nbits'

'max_bit' is misleading as the value is set to the first invalid bit
as it's used as the number of bits in the bitmap. Rename it to a more
descriptive name.

7 years agoqemu: Refresh capabilities when creating resctrl allocation
Martin Kletzander [Fri, 2 Feb 2018 07:35:30 +0000 (08:35 +0100)]
qemu: Refresh capabilities when creating resctrl allocation

Since one of the things in capabilities (info from resctrl updated with data
about caches) can be change on the system by remounting the /sys/fs/resctrl with
different options, the capabilities need to be refreshed.  There is a better fix
in the works, but it's going to be way bigger than this (hence the XXX note
there), so for the time being let's workaround this.  And in order not to slow
down the domain starting, only get the capabilities if there are any cachetunes.

Relates-to: https://bugzilla.redhat.com/show_bug.cgi?id=1540780
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoutil: Check if kernel-provided info is consistent with itself
Martin Kletzander [Fri, 2 Feb 2018 14:05:22 +0000 (15:05 +0100)]
util: Check if kernel-provided info is consistent with itself

Just in case someone re-mounted /sys/fs/resctrl with different mount
options (cdp), add a check here.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoqemu: Add and use qemuProcessEventFree for freeing qemuProcessEvents
Marc Hartmayer [Fri, 2 Feb 2018 12:13:46 +0000 (13:13 +0100)]
qemu: Add and use qemuProcessEventFree for freeing qemuProcessEvents

Add and use qemuProcessEventFree for freeing qemuProcessEvents. This
is less error-prone as the compiler can help us make sure that for
every new enumeration value of qemuProcessEventType the
qemuProcessEventFree function has to be adapted.

All process*Event functions are *only* called by
qemuProcessHandleEvent and this function does the freeing by itself
with qemuProcessEventFree. This means that an explicit freeing of
processEvent->data is no longer required in each process*Event
handler.

The effectiveness of this change is also demonstrated by the fact that
it fixes a memory leak of the panic info data in
qemuProcessHandleGuestPanic.

Reported-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemu: Use the return value of virObjectRef directly
Marc Hartmayer [Fri, 2 Feb 2018 12:13:45 +0000 (13:13 +0100)]
qemu: Use the return value of virObjectRef directly

Use the return value of virObjectRef directly. This way, it's easier
for another reader to identify the reason why the additional reference
is required.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agonetserver: Remove ServiceToggle during ServerDispose
John Ferlan [Thu, 21 Dec 2017 15:02:00 +0000 (10:02 -0500)]
netserver: Remove ServiceToggle during ServerDispose

No sense in calling ServiceToggle for all nservices during
ServiceDispose since ServerClose calls ServiceClose which
removes the IOCallback that's being toggled via ServiceToggle.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
7 years agoqemu: Add dump completed event to the capabilities
John Ferlan [Fri, 17 Nov 2017 13:46:27 +0000 (08:46 -0500)]
qemu: Add dump completed event to the capabilities

Add the DUMP_COMPLETED check to the capabilities. This is the
mechanism used to determine whether the dump-guest-memory command
can support the "-detach" option and thus be able to wait on the
event and allow for a query of the progress of the dump.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Introduce qemuDomainGetJobInfoMigrationStats
John Ferlan [Mon, 20 Nov 2017 18:00:43 +0000 (13:00 -0500)]
qemu: Introduce qemuDomainGetJobInfoMigrationStats

Extract out the parts of qemuDomainGetJobStatsInternal that get
the migration stats. We're about to add the ability to get just
dump information.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 years agovbox: fix SEGV during dumpxml of a serial port
Laine Stump [Sun, 21 Jan 2018 02:11:05 +0000 (21:11 -0500)]
vbox: fix SEGV during dumpxml of a serial port

commit 77a12987a48 changed the "virDomainChrSourceDef source" inside
virDomainChrDef to "virDomainChrSourceDefPtr source", and started
allocating source inside virDomainChrDefNew(), but vboxDumpSerial()
was allocating a virDomainChrDef with a simple VIR_ALLOC() (i.e. never
calling virDomainChrDefNew()), so source was never initialized,
leading to a SEGV any time a serial port was present. The same problem
was created in vboxDumpParallel().

This patch changes vboxDumpSerial() and vboxDumpParallel() to use
virDomainChrDefNew() instead of VIR_ALLOC(), and changes both of those
functions to return an error if virDomainChrDef() (or any other
allocation) fails.

This resolves: https://bugzilla.redhat.com/1536649

7 years agonwfilter: Remove unnecessary UUID comparison bypass
John Ferlan [Sun, 16 Jul 2017 14:09:10 +0000 (10:09 -0400)]
nwfilter: Remove unnecessary UUID comparison bypass

Remove the unnecessary check as since commit id '46a811db07' it is
not possible to add or alter a filter using the same name, but with
a different UUID.

NB: It's not required to provide a UUID for a filter by name, but
if one is provided, then it must match the existing. If not provided,
then one is generated during ParseXML processing.

Reviewed-by: Laine Stump <laine@laine.org>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agoutil: Remove unnecessary initialization
John Ferlan [Fri, 12 Jan 2018 15:32:41 +0000 (10:32 -0500)]
util: Remove unnecessary initialization

VIR_ALLOC will already initialize, so no need to do it again.

7 years agoqemu: Use switch statement for address types in qemuBuildControllerDevStr
Marc Hartmayer [Thu, 4 Jan 2018 11:41:29 +0000 (12:41 +0100)]
qemu: Use switch statement for address types in qemuBuildControllerDevStr

Use a switch statement instead of if-else-if statements. Move the
command line building of the iothread attribute into the common path
as the SCSI controller attributes are already validated.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
7 years agoqemu: Introduce qemuDomainDeviceDefValidateControllerSATA
John Ferlan [Wed, 29 Nov 2017 13:34:28 +0000 (08:34 -0500)]
qemu: Introduce qemuDomainDeviceDefValidateControllerSATA

Move the SATA controller check from command line building to
controller def validation. This includes copying the SATA
skip check found in qemuBuildSkipController.

7 years agoqemu: Complete PCI command checks to controller def validate
John Ferlan [Tue, 28 Nov 2017 21:00:52 +0000 (16:00 -0500)]
qemu: Complete PCI command checks to controller def validate

Move the qemuCaps checks over to qemuDomainControllerDefValidatePCI.

This requires two test updates in order to set the correct capability
bit for an xml2xml test as well as setting up the similar capability
for the pseries memlocktest.

7 years agoqemu: Move more PCI command checks to controller def validate
John Ferlan [Mon, 27 Nov 2017 21:24:04 +0000 (16:24 -0500)]
qemu: Move more PCI command checks to controller def validate

Excluding the qemuCaps checks, move the remainder of the checks
that validate whether the PCI definition is valid or not into
qemuDomainControllerDefValidatePCI.

7 years agoqemu: Move PCI command modelName TypeToString to controller def validate
John Ferlan [Mon, 27 Nov 2017 20:05:49 +0000 (15:05 -0500)]
qemu: Move PCI command modelName TypeToString to controller def validate

Similar to the checking the modelName vs. NAME_NONE, let's make the
ModelNameTypeToString check more generic too within the checking done
in controller validation (with the same ignore certain models.

NB: We need to keep the ModelNameTypeToString fetch in command line
validation since we use it, but at least we can assume it returns
something valid now.

7 years agoqemu: Move PCI command modelName check to controller def validate
John Ferlan [Mon, 27 Nov 2017 19:36:22 +0000 (14:36 -0500)]
qemu: Move PCI command modelName check to controller def validate

Move the various modelName == NAME_NONE from the command line
generation into domain controller validation.  Also rather than
have multiple cases with the same check, let's make the code
more generic, but also note that it was the modelName option
that caused the failure. We also have to be sure not to check
the PCI models that we don't care about.

For the remaining checks in command line building, we can use
the field name in the error message to be more specific about
what causes the failure.

7 years agoqemu: Use virDomainPCIControllerOpts in qemuBuildControllerDevStr
John Ferlan [Mon, 27 Nov 2017 19:45:54 +0000 (14:45 -0500)]
qemu: Use virDomainPCIControllerOpts in qemuBuildControllerDevStr

Shorten up a few characters and reference the pciopts pointer

7 years agoqemu: Add missing checks for pcie-root-port options
Andrea Bolognani [Wed, 6 Dec 2017 10:15:29 +0000 (11:15 +0100)]
qemu: Add missing checks for pcie-root-port options

We format the 'chassis' and 'port' properties on the QEMU command
line later on, so we should make sure they've been set.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: Introduce qemuDomainDeviceDefValidateControllerPCI
John Ferlan [Mon, 27 Nov 2017 18:21:44 +0000 (13:21 -0500)]
qemu: Introduce qemuDomainDeviceDefValidateControllerPCI

Move PCI validation checks out of qemu_command into the proper
qemu_domain validation helper.

Since there's a lot to move, we'll start slow by replicating the
pcie-root and pci-root avoidance from qemuBuildSkipController and
the first switch found in qemuBuildControllerDevStr.

7 years agoqemu: Introduce qemuDomainDeviceDefValidateControllerSCSI
John Ferlan [Mon, 27 Nov 2017 16:16:17 +0000 (11:16 -0500)]
qemu: Introduce qemuDomainDeviceDefValidateControllerSCSI

Move SCSI validation from qemu_command into qemu_domain.

Rename/reorder the args in qemuCheckSCSIControllerIOThreads
to match the caller as well as fixing up the comments to
remove the previously removed qemuCaps arg.

7 years agoqemu: Add check for iothread attribute in validate controller
John Ferlan [Fri, 8 Dec 2017 19:03:54 +0000 (14:03 -0500)]
qemu: Add check for iothread attribute in validate controller

Let's make sure that non SCSI virtio-scsi isn't used for any type
other than a virtio-scsi controller.

7 years agoqemu: Adjust SCSI controller switch in qemuBuildControllerDevStr
John Ferlan [Fri, 8 Dec 2017 18:34:53 +0000 (13:34 -0500)]
qemu: Adjust SCSI controller switch in qemuBuildControllerDevStr

Modify the SCSI controller switch during command line building
to account for all virDomainControllerModelSCSI types rather
than using the default label.

7 years agoqemu: Move and rename qemuBuildCheckSCSIControllerModel
John Ferlan [Fri, 5 Jan 2018 23:16:36 +0000 (18:16 -0500)]
qemu: Move and rename qemuBuildCheckSCSIControllerModel

Move to qemu_domain during the validation of controller options and
rename qemuDomainCheckSCSIControllerModel.

7 years agoqemu: Introduce qemuDomainDeviceDefValidateControllerAttributes
John Ferlan [Fri, 8 Dec 2017 18:21:05 +0000 (13:21 -0500)]
qemu: Introduce qemuDomainDeviceDefValidateControllerAttributes

Move the checks that various attributes are not set on any controller
other than SCSI controller using virtio-scsi model into the common
controller validate checks.

7 years agotests: Add test for properly removing cachetune entries
Martin Kletzander [Thu, 1 Feb 2018 13:36:09 +0000 (14:36 +0100)]
tests: Add test for properly removing cachetune entries

Cachetune for unavailable vCPUs should be cleared the same way vcpupin and other
things do, so let's add tests for it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoutil: Clear unused part of the map in virBitmapShrink
Martin Kletzander [Thu, 1 Feb 2018 13:33:02 +0000 (14:33 +0100)]
util: Clear unused part of the map in virBitmapShrink

Some of the other functions depend on the fact that unused bits and longs are
always zero and it's less error-prone to clear it than fix the other functions.
It's enough to zero out one piece of the map since we're calling realloc() to
get rid of the rest (and updating map_len).

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoutil: Fix possible leak in virResctrlAllocMasksAssign
Martin Kletzander [Thu, 1 Feb 2018 13:19:42 +0000 (14:19 +0100)]
util: Fix possible leak in virResctrlAllocMasksAssign

Found by coverity.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agorpc: fix non-NULL annotations when GNUTLS is disabled
Daniel P. Berrangé [Thu, 1 Feb 2018 15:34:39 +0000 (15:34 +0000)]
rpc: fix non-NULL annotations when GNUTLS is disabled

The position of various parameters changes depending on the WITH_GNUTLS
macro.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agorpc: assume private data callbacks are always non-NULL
Daniel P. Berrangé [Thu, 1 Feb 2018 15:34:06 +0000 (15:34 +0000)]
rpc: assume private data callbacks are always non-NULL

Since we annotate the APIs are having non-NULL parameters, we can remove
the checks for NULL in the code too.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotests: validate private data / pre / post exec hooks for RPC APIs
Daniel P. Berrangé [Thu, 1 Feb 2018 15:32:49 +0000 (15:32 +0000)]
tests: validate private data / pre / post exec hooks for RPC APIs

Validate that the virNetServer(Client) RPC APIs are processing the
private data callbacks correctly by passing in non-NULL pointers.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoqemuDomainRemoveMemoryDevice: unlink() memory backing file
Michal Privoznik [Thu, 11 Jan 2018 12:02:52 +0000 (13:02 +0100)]
qemuDomainRemoveMemoryDevice: unlink() memory backing file

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

Since fec8f9c49af we try to use predictable file names for
'memory-backend-file' objects. But that made us provide full path
to qemu when hot plugging the object while previously we provided
merely a directory. But this makes qemu behave differently. If
qemu sees a path terminated with a directory it calls mkstemp()
and unlinks the file immediately. But if it sees full path it
just calls open(path, O_CREAT ..); and never unlinks the file.
Therefore it's up to libvirt to unlink the file and not leave it
behind.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemu: migration: Refresh device information after transferring state
Peter Krempa [Thu, 1 Feb 2018 14:02:17 +0000 (15:02 +0100)]
qemu: migration: Refresh device information after transferring state

In my first approach in 4b480d10768c I overlooked the comment in
qemuMigrationRunIncoming stating that during actual migration the
qemuMigrationRunIncoming does not wait until the migration is complete
but rather offloads that to the Finish phase of migration.

This means that during actual migration qemuProcessRefreshState was
called prior to qemu actually transferring the full state and thus the
queries did not get the correct information. The approach worked only
for restore, where we wait for the migration to finish during qemu
startup.

Fix the issue by calling qemuProcessRefreshState both from
qemuProcessStart if there's no incomming migration and from
qemuMigrationFinish so that the code actually works as expected.

7 years agoqemu: Expose rx/tx_queue_size in qemu.conf too
Michal Privoznik [Fri, 19 Jan 2018 10:34:54 +0000 (11:34 +0100)]
qemu: Expose rx/tx_queue_size in qemu.conf too

In 2074ef6cd4a2 and c56cdf259 (and friends) we've added two
attributes to virtio NICs: rx_queue_size and tx_queue_size.
However, sysadmins might want to set these on per-host basis but
don't necessarily have an access to domain XML (e.g. because they
are generated by some other app). So let's expose them under
qemu.conf (the settings from domain XML still take precedence as
they are more specific ones).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoblockjob: Fix a error checking of blockjob status in some case
Jie Wang [Fri, 19 Jan 2018 14:03:05 +0000 (22:03 +0800)]
blockjob: Fix a error checking of blockjob status in some case

Commit id 'bc444666f' added a check if the returned data
buffer had an error, but failed to adjust the event from
VIR_DOMAIN_BLOCK_JOB_COMPLETED to VIR_DOMAIN_BLOCK_JOB_FAILED
in order to propagate an error such as "File descriptor in bad
state" that may be returned from QEMU when both @offset and
@len are set to 0 such as is the case when performing an async
block job read on a read only filesystem.

Signed-off-by: Jie Wang <wangjie88@huawei.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agonews: Add VIR_ERR_DEVICE_MISSING change as improvements
Chen Hanxiao [Tue, 23 Jan 2018 04:24:46 +0000 (12:24 +0800)]
news: Add VIR_ERR_DEVICE_MISSING change as improvements

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Use VIR_ERR_DEVICE_MISSING for various coldplug messages
Chen Hanxiao [Tue, 23 Jan 2018 04:24:45 +0000 (12:24 +0800)]
qemu: Use VIR_ERR_DEVICE_MISSING for various coldplug messages

Use the DEVICE_MISSING error code when helpers fail to find
the requested device. This makes it easier for consumers to
key off the error code rather than the error message.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Use VIR_ERR_DEVICE_MISSING for various hotplug messages
Chen Hanxiao [Tue, 23 Jan 2018 04:24:44 +0000 (12:24 +0800)]
qemu: Use VIR_ERR_DEVICE_MISSING for various hotplug messages

Modify OPERATION_FAILED and INTERNAL_ERROR error codes to
use DEVICE_MISSING instead for failures associated with the
inability to find the device. This makes it easier for consumers
to key off the error code rather than the error message.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Introduce VIR_ERR_DEVICE_MISSING
Chen Hanxiao [Tue, 23 Jan 2018 04:24:43 +0000 (12:24 +0800)]
qemu: Introduce VIR_ERR_DEVICE_MISSING

Add new error code to be able to allow consumers (such as Nova) to be
able to key of a specific error code rather than needing to search the
error message."

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Add some more details for hotplug errors when device not found
Chen Hanxiao [Tue, 23 Jan 2018 04:24:42 +0000 (12:24 +0800)]
qemu: Add some more details for hotplug errors when device not found

More proper/detail error messages updated.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoconf: Small indentation and coding style fixes
Andrea Bolognani [Thu, 1 Feb 2018 09:34:41 +0000 (10:34 +0100)]
conf: Small indentation and coding style fixes

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoadmin: set XDR_CFLAGS when building admin server
Daniel P. Berrangé [Wed, 31 Jan 2018 19:05:32 +0000 (19:05 +0000)]
admin: set XDR_CFLAGS when building admin server

The XDR_CFLAGS variable is needed when the XDR headers are not
part of the stock glibc install

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agostorage: remove virConnectPtr from all backend functions
Daniel P. Berrangé [Fri, 26 Jan 2018 13:31:58 +0000 (13:31 +0000)]
storage: remove virConnectPtr from all backend functions

Now that we can open connections to the secondary drivers on demand,
there is no need to pass a virConnectPtr into all the backend
functions.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agostorage: open nodedev driver connection at time of use
Daniel P. Berrangé [Wed, 31 Jan 2018 16:31:57 +0000 (16:31 +0000)]
storage: open nodedev driver connection at time of use

Instead of passing around a virConnectPtr object, just open a connection
to the nodedev driver at time of use. Opening connections on demand will
be beneficial when the nodedev driver is in a separate daemon. It also
solves the problem that a number of callers just pass in a NULL
connection today which prevents nodedev lookup working at all.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agostorage: open secret driver connection at time of use
Daniel P. Berrangé [Fri, 26 Jan 2018 13:15:33 +0000 (13:15 +0000)]
storage: open secret driver connection at time of use

Instead of passing around a virConnectPtr object, just open a connection
to the secret driver at time of use. Opening connections on demand will
be beneficial when the secret driver is in a separate daemon. It also
solves the problem that a number of callers just pass in a NULL
connection today which prevents secret lookup working at all.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agodriver: add some helpers for opening secondary driver connections
Daniel P. Berrangé [Wed, 31 Jan 2018 18:21:52 +0000 (18:21 +0000)]
driver: add some helpers for opening secondary driver connections

Various parts of libvirt will want to open connections to secondary
drivers. The right URI to use will depend on the context, so rather than
duplicating that logic in various places, use some helper APIs. This
will also make it easier for us to later pre-open/cache connections to
avoid repeated opening & closing the same connectiong during autostart.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agosecret: allow opening with secret:///system and secret:///session URIs
Daniel P. Berrangé [Fri, 26 Jan 2018 11:16:00 +0000 (11:16 +0000)]
secret: allow opening with secret:///system and secret:///session URIs

Allow the possibility of opening a connection to only the secret
driver, by defining secret:///system and secret:///session URIs
and registering a fake hypervisor driver that supports them.

The hypervisor drivers can now directly open a secret driver
connection at time of need, instead of having to pass around a
virConnectPtr through many functions. This will facilitate the later
change to support separate daemons for each driver.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agonodedev: allow opening with nodedev:///system and nodedev:///session URIs
Daniel P. Berrangé [Fri, 26 Jan 2018 11:16:00 +0000 (11:16 +0000)]
nodedev: allow opening with nodedev:///system and nodedev:///session URIs

Allow the possibility of opening a connection to only the nodedev
driver, by defining nodedev:///system and nodedev:///session URIs
and registering a fake hypervisor driver that supports them.

The hypervisor drivers can now directly open a nodedev driver
connection at time of need, instead of having to pass around a
virConnectPtr through many functions. This will facilitate the later
change to support separate daemons for each driver.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agointerface: allow opening with interface:///system and interface:///session URIs
Daniel P. Berrangé [Fri, 26 Jan 2018 11:16:00 +0000 (11:16 +0000)]
interface: allow opening with interface:///system and interface:///session URIs

Allow the possibility of opening a connection to only the interface
driver, by defining interface:///system and interface:///session URIs
and registering a fake hypervisor driver that supports them.

The hypervisor drivers can now directly open a interface driver
connection at time of need, instead of having to pass around a
virConnectPtr through many functions. This will facilitate the later
change to support separate daemons for each driver.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agonwfilter: allow opening with nwfilter:///system URI
Daniel P. Berrangé [Fri, 26 Jan 2018 11:16:00 +0000 (11:16 +0000)]
nwfilter: allow opening with nwfilter:///system URI

Allow the possibility of opening a connection to only the storage
driver, by defining a nwfilter:///system URI and registering a fake
hypervisor driver that supports it.

The hypervisor drivers can now directly open a nwfilter driver
connection at time of need, instead of having to pass around a
virConnectPtr through many functions. This will facilitate the later
change to support separate daemons for each driver.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agonetwork: allow opening with network:///system and network:///session URIs
Daniel P. Berrangé [Fri, 26 Jan 2018 11:16:00 +0000 (11:16 +0000)]
network: allow opening with network:///system and network:///session URIs

Allow the possibility of opening a connection to only the network
driver, by defining network:///system and network:///session URIs
and registering a fake hypervisor driver that supports them.

The hypervisor drivers can now directly open a network driver
connection at time of need, instead of having to pass around a
virConnectPtr through many functions. This will facilitate the later
change to support separate daemons for each driver.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agonetwork: move driver registration back to end of the file
Daniel P. Berrangé [Fri, 26 Jan 2018 11:21:09 +0000 (11:21 +0000)]
network: move driver registration back to end of the file

By convention the last thing in the driver.c files should be the driver
callback table and function to register it.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agostorage: allow opening with storage:///system and storage:///session URIs
Daniel P. Berrangé [Fri, 26 Jan 2018 11:16:00 +0000 (11:16 +0000)]
storage: allow opening with storage:///system and storage:///session URIs

Allow the possibility of opening a connection to only the storage
driver, by defining storage:///system and storage:///session URIs
and registering a fake hypervisor driver that supports them.

The hypervisor drivers can now directly open a storage driver
connection at time of need, instead of having to pass around a
virConnectPtr through many functions. This will facilitate the later
change to support separate daemons for each driver.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agostorage: move driver registration back to end of the file
Daniel P. Berrangé [Fri, 26 Jan 2018 11:21:09 +0000 (11:21 +0000)]
storage: move driver registration back to end of the file

By convention the last thing in the driver.c files should be the driver
callback table and function to register it.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoutil: use union for sockaddr structs to avoid aliasing
Daniel P. Berrange [Wed, 31 Jan 2018 17:27:11 +0000 (17:27 +0000)]
util: use union for sockaddr structs to avoid aliasing

Some platforms/toolchains will complain about casting
sockaddr_storage to sockaddr_un because it breaks strict
aliasing rule

../../src/util/virutil.c: In function 'virGetUNIXSocketPath':
../../src/util/virutil.c:2005: error: dereferencing pointer 'un' does break strict-aliasing rules [-Wstrict-aliasing]

Change the code to use a union, in the same way that the
virsocketaddr.h header does.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>