]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agotests: Rename virtTest00MActive to virTest00MActive.
Tomáš Ryšavý [Thu, 26 May 2016 15:01:56 +0000 (17:01 +0200)]
tests: Rename virtTest00MActive to virTest00MActive.

This function doesn't follow our convention of naming functions.

8 years agotests: Rename virtTestClearCommandPath to virTestClearCommandPath.
Tomáš Ryšavý [Thu, 26 May 2016 15:01:55 +0000 (17:01 +0200)]
tests: Rename virtTestClearCommandPath to virTestClearCommandPath.

This function doesn't follow our convention of naming functions.

8 years agoRename virtTestDifferenceFull to virTestDifferenceFull.
Tomáš Ryšavý [Thu, 26 May 2016 15:01:54 +0000 (17:01 +0200)]
Rename virtTestDifferenceFull to virTestDifferenceFull.

This function doesn't follow our convention of naming functions.

8 years agotests: Rename virtTestCompareToFile to virTestCompareToFile.
Tomáš Ryšavý [Thu, 26 May 2016 15:01:53 +0000 (17:01 +0200)]
tests: Rename virtTestCompareToFile to virTestCompareToFile.

This function doesn't follow our convention of naming functions.

8 years agoRename virtTestLoadFile to virTestLoadFile.
Tomáš Ryšavý [Thu, 26 May 2016 15:01:52 +0000 (17:01 +0200)]
Rename virtTestLoadFile to virTestLoadFile.

This function doesn't follow our convention of naming functions.

8 years agoRename virtTestDifference to virTestDifference.
Tomáš Ryšavý [Thu, 26 May 2016 15:01:51 +0000 (17:01 +0200)]
Rename virtTestDifference to virTestDifference.

This function doesn't follow our convention of naming functions.

8 years agotests: Rename virtTestRun to virTestRun.
Tomáš Ryšavý [Thu, 26 May 2016 15:01:50 +0000 (17:01 +0200)]
tests: Rename virtTestRun to virTestRun.

This function doesn't follow our convention of naming functions.

8 years agovirschematest: call va_end even on OOM
Ján Tomko [Wed, 8 Jun 2016 14:33:26 +0000 (16:33 +0200)]
virschematest: call va_end even on OOM

Jump to cleanup if virAsprintf fails.

8 years agonode_device: Replace VIR_ERROR with standard vir*Error in state driver init
Jovanka Gulicoska [Wed, 8 Jun 2016 13:20:27 +0000 (15:20 +0200)]
node_device: Replace VIR_ERROR with standard vir*Error in state driver init

8 years agovirsh-network: Avoid possible NULL deref in cmdNetworkDHCPLeases
Michal Privoznik [Wed, 8 Jun 2016 09:32:09 +0000 (11:32 +0200)]
virsh-network: Avoid possible NULL deref in cmdNetworkDHCPLeases

Problem is, localtime_r() returns a pointer to converted time or
NULL in case of an error. But checking the glibc sources, error
will occur iff a NULL has been passed as an either of arguments
the function takes. But GCC fails to see that:

../../tools/virsh-network.c: In function 'cmdNetworkDHCPLeases':
../../tools/virsh-network.c:1370:12: error: potential null pointer dereference [-Werror=null-dereference]
         ts = *localtime_r(&expirytime_tmp, &ts);
         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agolxc: simplify lxcDomainGetBlkioParameters
Ján Tomko [Mon, 30 May 2016 13:33:29 +0000 (15:33 +0200)]
lxc: simplify lxcDomainGetBlkioParameters

Replace all the repetitive code by using
virDomainGetBlkioParametersAssignFromDef, similar to what commit 9f50f6e
did in the qemu driver.

8 years agoExport virDomainGetBlkioParametersAssignFromDef
Ján Tomko [Mon, 30 May 2016 13:15:23 +0000 (15:15 +0200)]
Export virDomainGetBlkioParametersAssignFromDef

Move qemuDomainGetBlkioParametersAssignFromDef into domain_conf
and export it, to allow reuse in the LXC driver.

8 years agoUse virDomainObjGetDefs in lxcDomainGetBlkioParameters
Ján Tomko [Mon, 30 May 2016 11:19:36 +0000 (13:19 +0200)]
Use virDomainObjGetDefs in lxcDomainGetBlkioParameters

8 years agoUse virDomainObjGetDefs in lxcDomainSetBlkioParameters
Ján Tomko [Mon, 30 May 2016 11:08:30 +0000 (13:08 +0200)]
Use virDomainObjGetDefs in lxcDomainSetBlkioParameters

Remove yet another usage of virDomainLiveConfigHelperMethod
along with an sa_assert that helped clang understand the code flow.

8 years agoUse virDomainObjGetDefs in lxcDomainGetMemoryParameters
Ján Tomko [Sat, 28 May 2016 11:24:50 +0000 (13:24 +0200)]
Use virDomainObjGetDefs in lxcDomainGetMemoryParameters

Instead of virDomainLiveConfigHelperMethod.

8 years agoUse virDomainObjGetDefs in lxcDomainGetSchedulerParametersFlags
Ján Tomko [Thu, 26 May 2016 12:29:33 +0000 (14:29 +0200)]
Use virDomainObjGetDefs in lxcDomainGetSchedulerParametersFlags

On LXC domain startup we have already called virDomainObjSetDefTransient
to fill vm->newDef.

There is no need to call virDomainLiveConfigHelperMethod which has the
ability to fill newDef if it's NULL.

8 years agoUse virDomainObjGetDefs in lxcDomainSetSchedulerParametersFlags
Ján Tomko [Thu, 26 May 2016 12:29:33 +0000 (14:29 +0200)]
Use virDomainObjGetDefs in lxcDomainSetSchedulerParametersFlags

On LXC domain startup we have already called virDomainObjSetDefTransient
to fill vm->newDef.

There is no need to call virDomainLiveConfigHelperMethod which has the
ability to fill newDef if it's NULL.

8 years agoUse virDomainObjGetDefs in lxcDomainSetMemoryFlags
Ján Tomko [Thu, 26 May 2016 12:29:33 +0000 (14:29 +0200)]
Use virDomainObjGetDefs in lxcDomainSetMemoryFlags

On LXC domain startup we have already called virDomainObjSetDefTransient
to fill vm->newDef.

There is no need to call virDomainLiveConfigHelperMethod which has the
ability to fill newDef if it's NULL.

8 years agolxc: rename vmdef to persistentDef
Ján Tomko [Sat, 28 May 2016 11:45:18 +0000 (13:45 +0200)]
lxc: rename vmdef to persistentDef

A few functions using virDomainLiveConfigHelperMethod use the generic
name 'vmdef' to point to the persistent definition.

Use persistentDef and/or persistentDefCopy to make its purpose obvious.

8 years agoUse @SYSTEM priority for TLS on Fedora >= 21
Daniel P. Berrange [Mon, 6 Jun 2016 15:02:22 +0000 (16:02 +0100)]
Use @SYSTEM priority for TLS on Fedora >= 21

In Fedora >= 21, there is a new crypto priority framework
that sets TLS policies globally for all apps. To activate
this with GNUTLS we must request "@SYSTEM" instead of
the traditional "NORMAL" string. The '@' causes gnutls todo
a lookup in its config file for the 'SYSTEM' keyword entry.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoremote: allow TLS priority to be customized
Daniel P. Berrange [Fri, 3 Jun 2016 17:20:27 +0000 (18:20 +0100)]
remote: allow TLS priority to be customized

Support reading the TLS priority from the client configuration
file via the "tls_priority" config option, eg

 $ cat $HOME/.config/libvirt/libvirt.conf
 tls_priority="NORMAL:-VERS-SSL3.0"

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoPass config file object through to driver open methods
Daniel P. Berrange [Fri, 3 Jun 2016 17:01:27 +0000 (18:01 +0100)]
Pass config file object through to driver open methods

The virConnectOpenInternal method opens the libvirt client
config file and uses it to resolve things like URI aliases.

There may be driver specific things that are useful to
store in the config file too, so rather than have them
re-parse the same file, pass the virConfPtr down to the
drivers.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoremote: allow TLS protocol/cipher priority override in URI
Daniel P. Berrange [Mon, 6 Jun 2016 14:41:01 +0000 (15:41 +0100)]
remote: allow TLS protocol/cipher priority override in URI

Add support for a "tls_priority" URI parameter in remote
driver URIs. eg

 qemu+tls://localhost/session?tls_priority=NORMAL:-VERS-SSL3.0

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirtd: add config option for TLS priority
Daniel P. Berrange [Fri, 3 Jun 2016 16:53:18 +0000 (17:53 +0100)]
libvirtd: add config option for TLS priority

Add a "tls_priority" config option to /etc/libvirt/libvirtd.conf
to allow the administrator to override the built-in default
setting. This only affects the server side configuration.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agorpc: allow priority string to be passed to TLS context
Daniel P. Berrange [Fri, 3 Jun 2016 16:44:55 +0000 (17:44 +0100)]
rpc: allow priority string to be passed to TLS context

Extend the virNetTLSContextNew* constructors to allow
the TLS priority string to be passed in, overriding the
compile time default.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoconfigure: allow setting default TLS priority string
Daniel P. Berrange [Fri, 3 Jun 2016 16:31:48 +0000 (17:31 +0100)]
configure: allow setting default TLS priority string

Currently libvirt calls gnutls_set_default_priority()
which on old systems resolves to "NORMAL" while new
systems it resolves to "@SYSTEM". Either way, this
is a global default that is identical across all apps.

We want to allow distros to flexibility to define a
custom default string for libvirt priority, so add
a --tls-priority=STRING  flag to configure to enable
this to be set.

It is expected that distros would use this when creating
RPM/Deb/etc packages, according to their preferred crypto
handling policies.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agorpc: set gnutls log function at global init time
Daniel P. Berrange [Fri, 3 Jun 2016 16:20:19 +0000 (17:20 +0100)]
rpc: set gnutls log function at global init time

Currently we set the gnutls log function when creating a
TLS context, however, the setting is in fact global, not
per context. So we should be setting it when we first call
gnutls_global_init() instead.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agotls: remove support for gnutls 1.x.x, require 2.2.0
Daniel P. Berrange [Mon, 6 Jun 2016 09:17:25 +0000 (10:17 +0100)]
tls: remove support for gnutls 1.x.x, require 2.2.0

We need to use the gnutls_priority_set_direct method which
was not introduced until 2.1.7, so bump version to 2.2.0
which is the first stable release with it included. This
release dates from Dec 2007 so it is reasonable to ditch
support for the 1.x.x series for gnutls releases entirely.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirsh: domdisplay: if listen is 0.0.0.0 or [::] print address from URI
Pavel Hrdina [Mon, 30 May 2016 14:35:17 +0000 (16:35 +0200)]
virsh: domdisplay: if listen is 0.0.0.0 or [::] print address from URI

Currently if a guest has listen address 0.0.0.0 or [::] and you run
"virsh domdisplay $domain" you always get "spice://localhost:$port".

We want to print better address if someone is connected from a different
computer using "virsh -c qemu+ssh://some.host/system".  This patch fixes the
behavior of virsh to print in this case "spice://some.host:$port".

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_process: don't print empty line if qemu exits without any error
Pavel Hrdina [Wed, 8 Jun 2016 10:03:38 +0000 (12:03 +0200)]
qemu_process: don't print empty line if qemu exits without any error

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_monitor: rephrase error message if qemu closes monitor
Pavel Hrdina [Wed, 8 Jun 2016 09:59:57 +0000 (11:59 +0200)]
qemu_monitor: rephrase error message if qemu closes monitor

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agovirschematest: Link with libxml2
Michal Privoznik [Wed, 8 Jun 2016 11:25:08 +0000 (13:25 +0200)]
virschematest: Link with libxml2

We use libxml2 APIs in the test (e.g. xmlFreeDoc) but not link
with -lxml2 which can cause problems:

/usr/bin/ld: virschematest.o: undefined reference to symbol 'xmlFreeDoc@@LIBXML2_2.4.30'
//usr/lib/x86_64-linux-gnu/libxml2.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:4702: recipe for target 'virschematest' failed

Reported-by: Katerina Koukiou <k.koukiou@googlemail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirschematest: Access the right directory containing XMLs
Michal Privoznik [Wed, 8 Jun 2016 09:04:04 +0000 (11:04 +0200)]
virschematest: Access the right directory containing XMLs

So the story goes like this. The testSchemaDirs() function is
called with: a) the schema file, b) list of the directories that
contains XMLs documents that should be checked against the schema
file from a). However, the directories in the list are really
just their names and it's up to testSchemaDirs to construct the
absolute path and call testSchemaDir() which then does the actual
validation. The absolute path is constructed, but never actually
used (maybe due to a typo). Thus a VPATH build is broken.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoIntroduce virschematest
Ján Tomko [Tue, 7 Jun 2016 16:54:43 +0000 (18:54 +0200)]
Introduce virschematest

Instead of calling xmllint via a shell script, use our virXMLValidator
API to do it directly via libxml.

8 years agoIntroduce virXMLValidatorValidate
Ján Tomko [Tue, 7 Jun 2016 16:58:02 +0000 (18:58 +0200)]
Introduce virXMLValidatorValidate

Split out the code for XML validation into a new function.

8 years agoIntroduce virXMLValidatorInit
Ján Tomko [Tue, 7 Jun 2016 16:56:23 +0000 (18:56 +0200)]
Introduce virXMLValidatorInit

Split out all the code initializing the validator
to a separate function.

8 years agoIntroduce virXMLValidatorFree
Ján Tomko [Tue, 7 Jun 2016 16:57:29 +0000 (18:57 +0200)]
Introduce virXMLValidatorFree

Split out the code cleaning up the validator.

8 years agoIntroduce virXMLValidator structure
Ján Tomko [Tue, 7 Jun 2016 16:55:28 +0000 (18:55 +0200)]
Introduce virXMLValidator structure

Store all the data related to RNG validation in one structure to
allow splitting virXMLValidateAgainstSchema.

8 years agoqemu: process: Call disk startup policy check after cloning domain def
Peter Krempa [Thu, 2 Jun 2016 13:32:00 +0000 (15:32 +0200)]
qemu: process: Call disk startup policy check after cloning domain def

In commit 1e38ef72 the disk startup policy check was moved prior to the
call to virDomainObjSetDefTransient which dropped the disk from the
config rather than the def to be started which is a bug.

Additionally we'd not report the disk change event for this since the
disk aliases were not set at that point.

Finally 'volume' based disks would not work with startup policy too.

Fix it by moving it back after the definition is copied, aliases are
assigned and disk sources are translated.

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

8 years agoqemu: domain: Sanitize return value handling in disk presence checker
Peter Krempa [Thu, 2 Jun 2016 13:20:40 +0000 (15:20 +0200)]
qemu: domain: Sanitize return value handling in disk presence checker

One of the functions is returning always 0 and the second one uses
unnecessary labels.

8 years agoqemu: driver: Unset log file watcher after restoring a VM save file
Peter Krempa [Fri, 3 Jun 2016 13:18:48 +0000 (15:18 +0200)]
qemu: driver: Unset log file watcher after restoring a VM save file

qemuProcessStart does not unset the infrastructure that retrieves errors
from the qemu log file in case of migration. As this wasn't handled
properly in qemuDomainSaveImageStartVM we kept the logging context/fd
open for the lifetime of the VM rather than closing it after it's not
needed.

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

8 years agotest: Remove executable permission from Xen xm files
Philipp Hahn [Thu, 19 May 2016 06:24:57 +0000 (08:24 +0200)]
test: Remove executable permission from Xen xm files

The configuration files are not directly executable as they don't have
as hash-bang line.

8 years agoxen: test for driver=tap2 sub-type in xen-xm
Philipp Hahn [Thu, 19 May 2016 06:24:56 +0000 (08:24 +0200)]
xen: test for driver=tap2 sub-type in xen-xm

tap2 only handles 'aio', but not 'raw', which must be explicitly given:

XML:raw needs to be translated to XM:aio for 'tap' and 'tap2' Xen
drivers.

8 years agoxen: Also add sub-type for driver=tap2 in xen-xm
Philipp Hahn [Thu, 19 May 2016 06:24:55 +0000 (08:24 +0200)]
xen: Also add sub-type for driver=tap2 in xen-xm

tap2 only handles 'aio', but not 'raw', which must be explicitly given:

| $ virsh domxml-to-native yyy.xml > yyy.xm
| $ xm new yyy.xm
| Error: tap:/srv/xen/xxx.img not a valid disk type
| $ sed -i -e 's/tap2:/&aio:/' yyy.xm
| $ xm new yyy.xm

Fix reading and writing "xen-xm" format for "tap2" by handling it the
same as "tap".

8 years agoqemu: Replace VIR_ERROR with standard vir*Error in state driver init
Jovanka Gulicoska [Tue, 7 Jun 2016 15:59:57 +0000 (17:59 +0200)]
qemu: Replace VIR_ERROR with standard vir*Error in state driver init

8 years agoxen: Replace VIR_ERROR with standard vir*Error in state driver init
Jovanka Gulicoska [Tue, 7 Jun 2016 15:59:58 +0000 (17:59 +0200)]
xen: Replace VIR_ERROR with standard vir*Error in state driver init

8 years agouml: Replace VIR_ERROR with standard vir*Error in state driver init
Jovanka Gulicoska [Tue, 7 Jun 2016 15:59:56 +0000 (17:59 +0200)]
uml: Replace VIR_ERROR with standard vir*Error in state driver init

8 years agoqemu: migration: Add VM log entry on start of migration
Peter Krempa [Tue, 7 Jun 2016 15:02:14 +0000 (17:02 +0200)]
qemu: migration: Add VM log entry on start of migration

Note the start of migration of a qemu process to the VM log file for
possible debug purposes.

8 years agoqemu: process: Append the "shutting down" message using the new APIs
Peter Krempa [Tue, 7 Jun 2016 14:31:15 +0000 (16:31 +0200)]
qemu: process: Append the "shutting down" message using the new APIs

Use qemuDomainLogAppendMessage rather than attempting to open a new
logging context with file descriptors. The new approach allows to log
the message even if qemu is still running at that point which appens
during migration finish phase where qemuProcessStop is killing qemu.

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

8 years agoqemu: domain: Implement helper for one-shot log entries to the VM log file
Peter Krempa [Tue, 7 Jun 2016 14:19:03 +0000 (16:19 +0200)]
qemu: domain: Implement helper for one-shot log entries to the VM log file

Along with the virtlogd addition of the log file appending API implement
a helper for logging one-shot entries to the log file including the
fallback approach of using direct file access.

This will be used for noting the shutdown of the qemu proces and
possibly other actions such as VM migration and other critical VM
lifecycle events.

8 years agolog: daemon: Add remote protocol handling for the log appending API
Peter Krempa [Tue, 7 Jun 2016 14:15:22 +0000 (16:15 +0200)]
log: daemon: Add remote protocol handling for the log appending API

Implement the RPC dispatcher and caller for the new API.

8 years agolog: handler: Add new API to append to logging files
Peter Krempa [Tue, 7 Jun 2016 14:09:09 +0000 (16:09 +0200)]
log: handler: Add new API to append to logging files

For logging one-shot entries to the VM log file it's quite a waste to
hold open the file descriptor for logging that is provided by the
current API.

This new API will be ideal for logging one-shot entries to the file
e.g. at the point when we shut the VM down rather than having to add the
whole file-descriptor infrastructure.

Additionally this will allow to add the messages even after restart of
libvirtd since virtlogd doesn't allow to obtain a regular context with
filedescriptors while the VM is still active.

8 years agoutil: Perform proper virRandomBytes return value checking
John Ferlan [Tue, 7 Jun 2016 11:24:31 +0000 (07:24 -0400)]
util: Perform proper virRandomBytes return value checking

Document the return value of virRandomBytes as 0 or some errno value and
then make sure all callers make the proper checks.

8 years agoReindent virNetDevSendEthtoolIoctl
Ján Tomko [Tue, 7 Jun 2016 12:00:22 +0000 (14:00 +0200)]
Reindent virNetDevSendEthtoolIoctl

8 years agoReuse the socket in virNetDevGetFeatures
Ján Tomko [Fri, 3 Jun 2016 18:46:05 +0000 (20:46 +0200)]
Reuse the socket in virNetDevGetFeatures

This speeds up node_device_udev driver startup 11x.

8 years agoReturn bool in virNetDevFeatureAvailable
Ján Tomko [Fri, 3 Jun 2016 18:44:23 +0000 (20:44 +0200)]
Return bool in virNetDevFeatureAvailable

Simplify the logic

8 years agoSplit out virNetDevGetEthtoolGFeatures
Ján Tomko [Fri, 3 Jun 2016 18:25:21 +0000 (20:25 +0200)]
Split out virNetDevGetEthtoolGFeatures

Move out the code depending on HAVE_DECL_ETHTOOL_GFEATURES.

8 years agoSplit out virNetDevGetEthtoolFeatures
Ján Tomko [Fri, 3 Jun 2016 18:18:25 +0000 (20:18 +0200)]
Split out virNetDevGetEthtoolFeatures

Split out the features that we probe via various ethtool commands
and ETHTOOL_GFLAGS.

8 years agoMove struct elem out of virNetDevGetFeatures
Ján Tomko [Fri, 3 Jun 2016 18:01:44 +0000 (20:01 +0200)]
Move struct elem out of virNetDevGetFeatures

Rename struct elem to virNetDevEthtoolFeatureCmd and move it
out of the function to allow reusing it.

8 years agoReindent comment of virNetDevFeatureAvailable
Ján Tomko [Tue, 7 Jun 2016 12:06:24 +0000 (14:06 +0200)]
Reindent comment of virNetDevFeatureAvailable

8 years agoqemu: process: Allow VIR_QEMU_PROCESS_START_NEW in qemuProcessLaunch
Peter Krempa [Tue, 7 Jun 2016 11:52:16 +0000 (13:52 +0200)]
qemu: process: Allow VIR_QEMU_PROCESS_START_NEW in qemuProcessLaunch

The new flag was not added to virCheckFlags in commit '0d1c17aa' causing
a regression where VMs were not able to start.

8 years agoutil: Alter virCryptoEncryptData for non GNUTLS builds
John Ferlan [Sun, 22 May 2016 14:07:47 +0000 (10:07 -0400)]
util: Alter virCryptoEncryptData for non GNUTLS builds

Rather than intermixing the ATTRIBUTE_UNUSED - use HAVE_GNUTLS_CIPHER_ENCRYPT
for the whole function instead.

8 years agoAdd nomatch filters when enumerating udev devices
Ján Tomko [Thu, 2 Jun 2016 16:09:56 +0000 (18:09 +0200)]
Add nomatch filters when enumerating udev devices

Filter out some subsystems we are not interested in.

8 years agonode_device_udev: rename labels to cleanup
Ján Tomko [Fri, 3 Jun 2016 17:40:45 +0000 (19:40 +0200)]
node_device_udev: rename labels to cleanup

Instead of the custom out and out_unlock.

8 years agonode_device_udev: remove unnecessary ret variables
Ján Tomko [Fri, 3 Jun 2016 17:37:06 +0000 (19:37 +0200)]
node_device_udev: remove unnecessary ret variables

Remove ret variables and labels from functions where there is no cleanup
to be done.

8 years agoqemu: Move check that validates 'min_guarantee' to qemuDomainDefValidate
Peter Krempa [Tue, 17 May 2016 13:56:51 +0000 (15:56 +0200)]
qemu: Move check that validates 'min_guarantee' to qemuDomainDefValidate

Introduce a validation callback for qemu and move checking of
min_guarantee to the new callback.

8 years agoconf: Move validation of disk LUN device to the appropriate place
Peter Krempa [Thu, 26 May 2016 16:00:57 +0000 (18:00 +0200)]
conf: Move validation of disk LUN device to the appropriate place

Now with the proper domain config validation infrastructure the check
can be moved to a place that doesn't make domains vanish.

8 years agoconf: Move disk info validator to the domain conf validator
Peter Krempa [Fri, 27 May 2016 10:34:14 +0000 (12:34 +0200)]
conf: Move disk info validator to the domain conf validator

Since it will not be called from outside of conf we can unexport it too
if we move it to the appropriate place.

Test suite change is necessary since the error will be reported sooner
now.

8 years agoqemu: process: Call the domain config validator when starting a new VM
Peter Krempa [Fri, 27 May 2016 11:54:26 +0000 (13:54 +0200)]
qemu: process: Call the domain config validator when starting a new VM

To avoid duplicating all the checks when starting a fresh VM from a
possibly unchecked config, call the domain def validator.

8 years agoqemu: process: Convert multiple boolean args to a single flag
Peter Krempa [Fri, 27 May 2016 11:45:05 +0000 (13:45 +0200)]
qemu: process: Convert multiple boolean args to a single flag

Validation of qemu process startup requires to know whether the process
is used for a fresh VM or whether it's reloaded from a
snapshot/migration. Pass this information in via a flag rather than
calculating it from a bunch of bools.

8 years agoqemu: process: Unexport qemuProcessStartValidate
Peter Krempa [Fri, 27 May 2016 11:42:24 +0000 (13:42 +0200)]
qemu: process: Unexport qemuProcessStartValidate

8 years agoconf: Add device def validation callback
Peter Krempa [Fri, 27 May 2016 08:56:56 +0000 (10:56 +0200)]
conf: Add device def validation callback

Similarly to the domain definition validator add a device validator. The
change to the prototype of the domain validator is necessary as
virDomainDeviceInfoIterateInternal requires a non-const pointer.

8 years agoconf: drop 'def' from struct virDomainDefPostParseDeviceIteratorData
Peter Krempa [Thu, 26 May 2016 15:43:33 +0000 (17:43 +0200)]
conf: drop 'def' from struct virDomainDefPostParseDeviceIteratorData

It's passed to all places along with the structure.

8 years agoconf: Add infrastructure for adding configuration validation
Peter Krempa [Thu, 26 May 2016 13:58:53 +0000 (15:58 +0200)]
conf: Add infrastructure for adding configuration validation

Until now we weren't able to add checks that would reject configuration
once accepted by the parser. This patch adds a new callback and
infrastructure to add such checks. In this patch all the places where
rejecting a now-invalid configuration wouldn't be a good idea are marked
with a new parser flag.

8 years agoconf: Rename VIR_DOMAIN_DEF_PARSE_VALIDATE to VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA
Peter Krempa [Tue, 24 May 2016 15:20:20 +0000 (17:20 +0200)]
conf: Rename VIR_DOMAIN_DEF_PARSE_VALIDATE to VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA

Make it obvious that the flag is controlling RNG schema validation.

8 years agonode_device_udev: remove yoda condition
Ján Tomko [Fri, 3 Jun 2016 17:41:43 +0000 (19:41 +0200)]
node_device_udev: remove yoda condition

8 years agoudevSetupSystemDev: return if allocation fails
Ján Tomko [Fri, 3 Jun 2016 17:42:11 +0000 (19:42 +0200)]
udevSetupSystemDev: return if allocation fails

There is no cleanup to be done.

8 years agoReformat udevProcessRemoveableMedia
Ján Tomko [Fri, 3 Jun 2016 17:38:59 +0000 (19:38 +0200)]
Reformat udevProcessRemoveableMedia

Remove unnecessary ret variable and return early if we have no media
to save on indentation.

8 years agoudevProcessStorage: trim all whitespace from model and vendor
Ján Tomko [Fri, 3 Jun 2016 17:33:05 +0000 (19:33 +0200)]
udevProcessStorage: trim all whitespace from model and vendor

Use virTrimSpaces instead of a custom implementation.

8 years agonode_device_udev: switch to using virReportError
Ján Tomko [Fri, 3 Jun 2016 17:03:38 +0000 (19:03 +0200)]
node_device_udev: switch to using virReportError

Also use the more common "Unable to initialize mutex" string
and virReportSystemError instead of virStrerror.

8 years agoRemove PROPERTY_* constants
Ján Tomko [Fri, 3 Jun 2016 16:54:43 +0000 (18:54 +0200)]
Remove PROPERTY_* constants

They are no longer used.

8 years agoOnly return two values in udevGetUintSysfsAttr
Ján Tomko [Fri, 3 Jun 2016 16:49:40 +0000 (18:49 +0200)]
Only return two values in udevGetUintSysfsAttr

Open code the call to udev_device_get_sysattr_value
in the one place where it's needed.

8 years agoOnly return two values in udevGetIntSysfsAttr
Ján Tomko [Fri, 3 Jun 2016 15:39:39 +0000 (17:39 +0200)]
Only return two values in udevGetIntSysfsAttr

Callers only check for an error or a specific integer value.

8 years agoOnly return two values in udevGetStringSysfsAttr
Ján Tomko [Fri, 3 Jun 2016 15:27:48 +0000 (17:27 +0200)]
Only return two values in udevGetStringSysfsAttr

The callers only care for an error, and a missing attribute
is simply NULL.

8 years agoRemove extra allocation in udevGetDeviceSysfsAttr
Ján Tomko [Fri, 3 Jun 2016 15:13:39 +0000 (17:13 +0200)]
Remove extra allocation in udevGetDeviceSysfsAttr

Most of the code paths free it right after converting it to
an integer.

8 years agoOnly return two values in udevGetUintProperty
Ján Tomko [Fri, 3 Jun 2016 14:10:21 +0000 (16:10 +0200)]
Only return two values in udevGetUintProperty

We only care about the failure, not a missing property.

8 years agoOnly return two values in udevGetStringProperty
Ján Tomko [Fri, 3 Jun 2016 13:54:19 +0000 (15:54 +0200)]
Only return two values in udevGetStringProperty

There is no need to differentiate between PROPERTY_FOUND
and PROPERTY_MISSING - we can just look if the string is non-NULL.

8 years agoqemu: Add support to QXL's max_outputs parameter
Martin Kletzander [Fri, 11 Dec 2015 13:43:10 +0000 (14:43 +0100)]
qemu: Add support to QXL's max_outputs parameter

Historically, we added heads=1 to videos, but for example for qxl, we
did not reflect that on the command line.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: Check for qxl's max_outputs parameter
Martin Kletzander [Fri, 11 Dec 2015 13:26:24 +0000 (14:26 +0100)]
qemu: Check for qxl's max_outputs parameter

Add capabilities for both qxl and qxl-vga devices.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoRewrite disk type checking in udevProcessStorage
Ján Tomko [Fri, 3 Jun 2016 16:24:43 +0000 (18:24 +0200)]
Rewrite disk type checking in udevProcessStorage

Error out on parsing errors and use a local const char pointer
instead of chained ifs to check whether we found a match.

8 years agoFix the return value in udevKludgeStorageType
Ján Tomko [Fri, 3 Jun 2016 16:04:23 +0000 (18:04 +0200)]
Fix the return value in udevKludgeStorageType

Since the switch to VIR_STRDUP this function returns 1 on success,
but the caller treats any non-zero value as failure.

8 years agoudevProcessFloppy; remove unnecessary allocation
Ján Tomko [Fri, 3 Jun 2016 13:51:28 +0000 (15:51 +0200)]
udevProcessFloppy; remove unnecessary allocation

Use udevHasDeviceProperty instead of udevGetStringProperty.
We do not need to copy the string since we do not need it.

Also add braces around the if body, since the change made
syntax check complain.

8 years agoMove udevHasDeviceProperty earlier
Ján Tomko [Fri, 3 Jun 2016 14:36:35 +0000 (16:36 +0200)]
Move udevHasDeviceProperty earlier

8 years agoDo not VIR_STRDUP the string in udevGetDeviceProperty
Ján Tomko [Fri, 3 Jun 2016 13:25:22 +0000 (15:25 +0200)]
Do not VIR_STRDUP the string in udevGetDeviceProperty

Two out of three callers free it right after converting it to a number.

Also change the comment at the beginning of the function, because
the comment inside the function told me to.

8 years agoRemove udevStrToLong_i
Ján Tomko [Fri, 3 Jun 2016 12:58:51 +0000 (14:58 +0200)]
Remove udevStrToLong_i

Open code the error message.

8 years agoRemove udevStrToLong_ui
Ján Tomko [Fri, 3 Jun 2016 12:49:21 +0000 (14:49 +0200)]
Remove udevStrToLong_ui

Remove the debug message, open code the error in the two udevGetUint
callers and use a more specific error in SCSI and PCI processing.

8 years agoRemove udevStrToLong_ull
Ján Tomko [Fri, 3 Jun 2016 11:56:09 +0000 (13:56 +0200)]
Remove udevStrToLong_ull

The wrapper adds an error message or a debug log.

Since we already log the properties we get from udev as strings,
there is no much use for the debug logs.

Open code the error message and delete the function.

8 years agoRewrite usage of StrToLong_ui in udevProcess{PCI,SCSI}
Ján Tomko [Fri, 3 Jun 2016 12:54:03 +0000 (14:54 +0200)]
Rewrite usage of StrToLong_ui in udevProcess{PCI,SCSI}

Use virStrToLong_ui instead of udevStrToLong_ui, reformat the code
and report a more specific error message.

8 years agoudevProcessSCSIHost: use STRSKIP
Ján Tomko [Fri, 3 Jun 2016 12:41:28 +0000 (14:41 +0200)]
udevProcessSCSIHost: use STRSKIP

Instead of separating it into STRPEFIX and str + strlen.

8 years agoudevGetDMIData: remove unused variable
Ján Tomko [Fri, 3 Jun 2016 11:43:25 +0000 (13:43 +0200)]
udevGetDMIData: remove unused variable

A variable without use is pointless.

Remove it, since we have no use for it.