Commit Graph

16188 Commits

Author SHA1 Message Date
Ján Tomko
7dbbad35f2 Switch virCommandRunRegex to use virStringSplit
Instead of running the command asynchronously and reading the output
via fgets, let virCommand collect the output and split it with
virStringSplit.
2014-03-20 18:04:50 +01:00
Ján Tomko
f2cc42868e Move virStorageBackendRun to vircommand
The only storage-specific parameter is the pool object, which
is only used for passing to the callback function.
2014-03-20 18:04:50 +01:00
Ján Tomko
845255a430 Sort includes in storage_backend_iscsi.c 2014-03-20 18:04:49 +01:00
Martin Kletzander
9b7ac663ee Require K&R styled curly braces around function bodies
Although not explicitly requested, we are using K&R (or Kernel)
indentation for curly braces around functions in HACKING file and most
of the code.  Using grep -P, this patch add the syntax-check rule for
it (while skipping all the false positives with foreach constructs).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-20 17:27:17 +01:00
Martin Kletzander
95aed7febc Use K&R style for curly braces in remaining files
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-20 17:27:17 +01:00
Martin Kletzander
cd4da711a9 Use K&R style for curly braces in src/vbox/
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-20 17:16:39 +01:00
Martin Kletzander
5d734987fd Use K&R style for curly braces in src/network/bridge_driver.c
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-20 17:16:39 +01:00
Martin Kletzander
50ca2cb043 Use K&R style for curly braces in src/lxc/lxc_driver.c
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-20 17:16:39 +01:00
Martin Kletzander
969c4f0494 Use K&R style for curly braces in src/uml/
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-20 17:16:39 +01:00
Martin Kletzander
a9ed417f3a Use K&R style for curly braces in src/test/test_driver.c
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-20 17:16:39 +01:00
Martin Kletzander
58d467116b Use K&R style for curly braces in src/nwfilter/
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-20 17:16:38 +01:00
Martin Kletzander
f84e17997b Use K&R style for curly braces in src/openvz/
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-20 17:16:38 +01:00
Martin Kletzander
b6d6635ead Use K&R style for curly braces in src/storage/
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-20 17:16:38 +01:00
Martin Kletzander
b1d5f6c6cb Use K&R style for curly braces in src/qemu/
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-20 17:16:38 +01:00
Martin Kletzander
9c487f6505 Use K&R style for curly braces in src/conf/
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-20 17:16:38 +01:00
Martin Kletzander
7fa91525bd Use K&R style for curly braces in src/rpc/
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-20 17:16:38 +01:00
Martin Kletzander
daedff47ae Use K&R style for curly braces in src/util/
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-20 17:16:18 +01:00
Martin Kletzander
6e28dee258 Use K&R style for curly braces in src/xen*/
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-20 17:06:38 +01:00
Martin Kletzander
f19b3a5f0c Use K&R style for curly braces in tests/
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-20 17:06:38 +01:00
Scott Sullivan
0099a4ae2b is_selinux_enabled() returns -1 on error, account for this.
Per the documentation, is_selinux_enabled() returns -1 on error.
Account for this. Previously when -1 was being returned the condition
would still be true. I was noticing this because on my system that has
selinux disabled I was getting this in the libvirt.log every 5
seconds:

error : virIdentityGetSystem:173 : Unable to lookup SELinux process context: Invalid argument

With this patch applied, I no longer get these messages every 5
seconds. I am submitting this in case its deemed useful for inclusion.
Anyone have any comments on this change? This is a patch off current
master.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-03-20 16:26:55 +01:00
Wojciech Macek
bc93c34ef6 bhyve: host API support
New functionalities:
- connectGetMaxVcpus - on bhyve hardcode this value to 16
- nodeGetFreeMemory - do not use physmem_get on FreeBSD, since
                      it might get wrong value on systems with
                      more than 100GB of RAM
- nodeGetCPUMap - wrapper only for mapping function, currently not
                  supported by FreeBSD
- nodeSet/GetMemoryParameters - wrapper only for future improvements,
                                currently not supported by FreeBSD
2014-03-20 18:22:49 +04:00
Daniel P. Berrange
ba08c5932e Fix unitialized data in virSocketAddrMask
The virSocketAddrMask method did not initialize all fields
in the sockaddr_in6 struct. In paticular the 'sin6_scope_id'
field could contain random garbage, which would in turn
affect the result of any later virSocketAddrFormat calls.
This led to ip6tables rules in the FORWARD chain which
matched on random garbage sin6_scope_id. Fortunately these
were ACCEPT rules, so the impact was merely that desired
traffic was blocked, rather than undesired traffic allowed.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-03-20 12:15:00 +00:00
Ján Tomko
ba354048b8 Fix virQEMUCapsLoadCache leaks
Valgrind reported leaking of maxCpus and arch strings from
virXPathString, as well as the leak of the machineMaxCpus array.

Don't use 'str' for the strings we don't want to free, to allow
freeing of 'str' in the cleanup label and free machineMaxCpus
in virCapsReset too.
2014-03-20 11:05:42 +01:00
Jiri Denemark
be8701d76c daemon: Enhance documentation for changing NOFILE limit
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2014-03-20 10:55:44 +01:00
Jim Fehlig
0a840e23c2 libxl: move domain event handler to libxl_domain
Move the domain event handler and shutdown thread out of the main
driver module and into libxl_domain module

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2014-03-19 14:47:17 -06:00
Jim Fehlig
7fb36c7b8d libxl: include a pointer to the driver in libxlDomainObjPrivate
Include a pointer to the libxl driver in libxlDomainObjPrivate
object so it can be used in the domain event handler and
shutdown thread.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2014-03-19 14:47:11 -06:00
Jim Fehlig
3182448f4c libxl: move libxlVmStart to libxl_domain
Move libxlVmStart from libxl_driver to libxl_domain for
use by other libxl modules.  For consistency, rename to
libxlDomainStart.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2014-03-19 14:47:09 -06:00
Jim Fehlig
024e4bb400 libxl: move libxlFreeMem to libxl_domain
Move libxlFreeMem from libxl_driver to libxl_domain for
use by other libxl modules.  For consistency, rename to
libxlDomainFreeMem.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2014-03-19 14:47:05 -06:00
Jim Fehlig
e394d39ed8 libxl: move libxlDomainSetVcpuAffinities to libxl_domain
Move libxlDomainSetVcpuAffinities from libxl_driver to libxl_domain
for use by other libxl modules.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2014-03-19 14:46:59 -06:00
Jim Fehlig
d8d713234e libxl: move libxlDoNodeGetInfo to libxl_conf
Move libxlDoNodeGetInfo from libxl_driver to libxl_conf
for use by other libxl modules.  For consistency, rename to
libxlDriverNodeGetInfo.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2014-03-19 14:46:55 -06:00
Jim Fehlig
f1d1650176 libxl: move libxlDomainAutoCoreDump to libxl_domain
Move libxlDomainAutoCoreDump from libxl_driver to libxl_domain
for use by other libxl modules.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2014-03-19 14:46:51 -06:00
Jim Fehlig
ea88cc7683 libxl: move libxlDomEventsRegister to libxl_domain
Move libxlDomEventsRegister from libxl_driver to libxl_domain for
use by other libxl modules.  For consistency, rename to
libxlDomainEventsRegister.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2014-03-19 14:46:47 -06:00
Jim Fehlig
a0407e63f8 libxl: move libxlVmCleanup{,Job} to libxl_domain
Move libxlVmCleanup and libxlVmCleanupJob from libxl_driver to
libxl_domain for use by other libxl modules.  For consistency,
rename to libxlDomainCleanup and libxlDomainCleanupJob.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2014-03-19 14:46:43 -06:00
Jim Fehlig
7295941dea libxl: move libxlSaveImageOpen to libxl_domain
Move libxlSaveImageOpen from libxl_driver to libxl_domain for
use by other libxl modules.  For consistency, rename to
libxlDomainSaveImageOpen.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2014-03-19 14:46:40 -06:00
Jim Fehlig
11e97958ce libxl: move libxlDomainManagedSavePath to libxl_domain
Move libxlDomainManagedSavePath from libxl_driver to libxl_domain
for use by other libxl modules.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2014-03-19 14:46:36 -06:00
Jim Fehlig
62ad199cc8 libxl: move libxlDomainEventQueue to libxl_domain
Move libxlDomainEventQueue from libxl_driver to libxl_domain for
use by other libxl modules.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2014-03-19 14:46:31 -06:00
Michal Privoznik
3d4b4f5ac6 virNetClientSetTLSSession: Restore original signal mask
Currently, we use pthread_sigmask(SIG_BLOCK, ...) prior to calling
poll(). This is okay, as we don't want poll() to be interrupted.
However, then - immediately as we fall out from the poll() - we try to
restore the original sigmask - again using SIG_BLOCK. But as the man
page says, SIG_BLOCK adds signals to the signal mask:

SIG_BLOCK
      The set of blocked signals is the union of the current set and the set argument.

Therefore, when restoring the original mask, we need to completely
overwrite the one we set earlier and hence we should be using:

SIG_SETMASK
      The set of blocked signals is set to the argument set.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-03-19 18:54:51 +01:00
Stefan Berger
963dcf905c nwfilter: Fix double free of pointer
https://bugzilla.redhat.com/show_bug.cgi?id=1071181

Commit 49b59a15 fixed one problem but masks another one related to pointer
freeing.

Avoid putting of the virNWFilterSnoopReq once the thread has been started.
It belongs to the thread and the thread will call virNWFilterSnoopReqPut() on it.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2014-03-19 13:38:44 -04:00
Michal Privoznik
962abaf538 domiftune: Reword bandwidth clearing paragraph
s/of value/value of/

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-03-19 16:20:18 +01:00
Eric Blake
bbd5d83020 conf: consistent comments about disk enum usage
Before refactoring this struct, I found it helpful to track which
'int' fields really contain an enum value.

* src/conf/domain_conf.h (_virDomainDiskDef): Add comments.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-03-19 09:09:02 -06:00
Jiri Denemark
dcb69a183a build: Make sure src/util/virprobe.h is distributed
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2014-03-19 14:54:45 +01:00
Nehal J Wani
0ab0f7e3b7 qemuhotplugtest: Fix mem-leaking testcases
While running qemuhotplugtest, it was found that valgrind pointed out
the following memory leak:

==7906== 5 bytes in 1 blocks are definitely lost in loss record 7 of 121
==7906==    at 0x4A069EE: malloc (vg_replace_malloc.c:270)
==7906==    by 0x3E782A754D: xmlStrndup (in /usr/lib64/libxml2.so.2.7.6)
==7906==    by 0x4CDAE03: virDomainDeviceInfoParseXML.isra.32 (domain_conf.c:3685)
==7906==    by 0x4CE3BB9: virDomainNetDefParseXML (domain_conf.c:6707)
==7906==    by 0x4CFBA08: virDomainDefParseXML (domain_conf.c:12235)
==7906==    by 0x4CFBC1E: virDomainDefParseNode (domain_conf.c:13039)
==7906==    by 0x4CFBD95: virDomainDefParse (domain_conf.c:12981)
==7906==    by 0x41FEB4: testQemuHotplug (qemuhotplugtest.c:66)
==7906==    by 0x420F41: virtTestRun (testutils.c:201)
==7906==    by 0x41F287: mymain (qemuhotplugtest.c:422)
==7906==    by 0x4216BD: virtTestMain (testutils.c:784)
==7906==    by 0x3E6CE1ED1C: (below main) (libc-start.c:226)
...and 10 more.

Problem is, since 20745748 we do both, parse <alias/> elements from
XML files and call qemuAssignDeviceAliases(). While generating runtime
info for domain at runtime is just fine in the test, we can parse just
inactive XML and remove all <alias/>-es from the XML files.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-03-19 14:48:58 +01:00
Martin Kletzander
eeb1e80e7f build: Fix make distcheck
I forgot to delete the underscore in object_locking_SOURCES when
changing the name in one of previous cleanups.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-19 14:43:08 +01:00
Jiri Denemark
9aef4d96e0 build: Fix build with old automake
Ancient automake (such as from RHEL5) does not provide abs_srcdir and
abs_builddir variables which are used by a recent commit of mine
(e562e82).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2014-03-19 13:47:14 +01:00
Daniel P. Berrange
7b3f1f8c30 Add ability to register callback for virCommand dry run
To allow for fault injection of the virCommand dry run,
add the ability to register a callback. The callback will
be passed the argv, env and stdin buffer and is expected
to return the exit status and optionally fill stdout and
stderr buffers.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-03-19 10:47:58 +00:00
Daniel P. Berrange
df3a681c03 Change CMD_STOPONERR(1) to use true
The CMD_STOPONERR macro uses its parameter as a boolean, so should
be passed true rather than 1.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-03-19 10:47:27 +00:00
Daniel P. Berrange
7dd1c91a11 Change 'int isTempChain' to bool in nwfilter
The 'int isTempChain' parameter to various nwfilter methods
only takes two values so should be a bool type.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-03-19 10:47:27 +00:00
Daniel P. Berrange
741c855e0e Remove pointless return values in nwfilter methods
Many nwfilter methods have an int return value but only ever
return 0 and their callers never check the return value either.
These methods can all be void.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-03-19 10:47:27 +00:00
Daniel P. Berrange
2b42e17c7e Remove 'int stopOnError' parameters in nwfilter methods
Many nwfilter methods have an 'int stopOnError' parameter but
with 1 exception, the callers always pass '1'. The parameter
can therefore be removed from all except one method. That method
will be changed to 'bool stopOnError'

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-03-19 10:47:27 +00:00
Daniel P. Berrange
6c582bb9c6 Remove pointless brackets around boolean
A lot of methods have a 'bool incoming' parameter but then
do  (incoming) ? ... : .... The round brackets here add nothing
to the code so can be removed.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-03-19 10:47:27 +00:00