]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
11 years agoutil: add virGetGroupList
Eric Blake [Tue, 21 May 2013 23:47:48 +0000 (17:47 -0600)]
util: add virGetGroupList

Since neither getpwuid_r() nor initgroups() are safe to call in
between fork and exec (they obtain a mutex, but if some other
thread in the parent also held the mutex at the time of the fork,
the child will deadlock), we have to split out the functionality
that is unsafe.  At least glibc's initgroups() uses getgrouplist
under the hood, so the ideal split is to expose getgrouplist for
use before a fork.  Gnulib already gives us a nice wrapper via
mgetgroups; we wrap it once more to look up by uid instead of name.

* bootstrap.conf (gnulib_modules): Add mgetgroups.
* src/util/virutil.h (virGetGroupList): New declaration.
* src/util/virutil.c (virGetGroupList): New function.
* src/libvirt_private.syms (virutil.h): Export it.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoutil: improve user lookup helper
Eric Blake [Tue, 9 Jul 2013 23:57:48 +0000 (17:57 -0600)]
util: improve user lookup helper

A future patch needs to look up pw_gid; but it is wasteful
to crawl through getpwuid_r twice for two separate pieces
of information, and annoying to copy that much boilerplate
code for doing the crawl.  The current internal-only
virGetUserEnt is also a rather awkward interface; it's easier
to just design it to let callers request multiple pieces of
data as needed from one traversal.

And while at it, I noticed that virGetXDGDirectory could deref
NULL if the getpwuid_r lookup fails.

* src/util/virutil.c (virGetUserEnt): Alter signature.
(virGetUserDirectory, virGetXDGDirectory, virGetUserName): Adjust
callers.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoqemu_hostdev: Resolve Coverity issue
John Ferlan [Thu, 11 Jul 2013 14:42:30 +0000 (10:42 -0400)]
qemu_hostdev: Resolve Coverity issue

Recent changes uncovered a possibility that 'last_processed_hostdev_vf'
was set to -1 in 'qemuPrepareHostdevPCIDevices' and would cause problems
in for loop end condition in the 'resetvfnetconfig' label if the
variable was never set to 'i' due to 'qemuDomainHostdevNetConfigReplace'
failure.

11 years agostorage_backend: Resolve Coverity issue
John Ferlan [Thu, 11 Jul 2013 14:39:23 +0000 (10:39 -0400)]
storage_backend: Resolve Coverity issue

The switch statement in 'virStorageBackendCreateQemuImgOpts' used the
for loop end condition 'VIR_STORAGE_FILE_FEATURE_LAST' as a possible value,
but since that cannot happen Coverity spits out a DEADCODE message. Adding
the Coverity tag just removes the Coverity message

11 years agovirsh-nodedev: Resolve Coverity issues
John Ferlan [Thu, 11 Jul 2013 14:33:29 +0000 (10:33 -0400)]
virsh-nodedev: Resolve Coverity issues

Recent changes uncovered FORWARD_NULL and NEGATIVE_RETURNS problems with
the processing of the 'ndevices' and its associated allocated arrays in
'vshNodeDeviceListCollect' due to the possibility of returning -1 in a
call and using the returned value as a for loop index end condition.

11 years agovirsh-interface: Resolve Coverity issues
John Ferlan [Thu, 11 Jul 2013 14:31:15 +0000 (10:31 -0400)]
virsh-interface: Resolve Coverity issues

Recent changes uncovered FORWARD_NULL and NEGATIVE_RETURNS problems with
the processing of the 'nActiveIfaces' and 'nInactiveIfaces' and their
associated allocated arrays in 'vshInterfaceListCollect' due to the
possibility of returning -1 in a call and using the return value as a
for loop index end condition.

11 years agovirsh-domain-monitor: Resolve Coverity issues
John Ferlan [Thu, 11 Jul 2013 14:28:44 +0000 (10:28 -0400)]
virsh-domain-monitor: Resolve Coverity issues

Recent changes uncovered a pair of NEGATIVE_RETURNS when processing the
'nnames' in 'vshDomainListCollect' in the for loop due to possible -1 value.

11 years agotestutils: Resolve Coverity issues
John Ferlan [Thu, 11 Jul 2013 11:22:20 +0000 (07:22 -0400)]
testutils: Resolve Coverity issues

Recent changes uncovered a NEGATIVE_RETURNS in the return from sysconf()
when processing a for loop in virtTestCaptureProgramExecChild() in
testutils.c

Code review uncovered 3 other code paths with the same condition that
weren't found by Covirity, so fixed those as well.

11 years agohellolibvirt: Resolve Coverity issues
John Ferlan [Thu, 11 Jul 2013 11:19:37 +0000 (07:19 -0400)]
hellolibvirt: Resolve Coverity issues

Recent changes uncovered a NEGATIVE_RETURNS when processing 'numNames'
in 'showDomains' in the for loop after a possible -1 return.

11 years agomaint: update to latest gnulib
Eric Blake [Thu, 11 Jul 2013 11:07:16 +0000 (05:07 -0600)]
maint: update to latest gnulib

Future patches need LGPLv2+ versions of some modules that had
recent license changes; but separating the gnulib update from
the actual use of the modules makes it easier to backport to
an older version while avoiding a submodule update (assuming,
of course, that the backport is to a system where glibc provides
adequate functionaliy without needing the gnulib module).

* .gnulib: Update to latest, for modules needed in later patches.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoqemu: Fix hot (un-)plug error codes and messages
Michal Privoznik [Thu, 11 Jul 2013 11:24:20 +0000 (13:24 +0200)]
qemu: Fix hot (un-)plug error codes and messages

With current code, error reporting for unsupported devices for hot plug,
unplug and update is total mess. The VIR_ERR_CONFIG_UNSUPPORTED error
code is reported instead of VIR_ERR_OPERATION_UNSUPPORTED. Moreover, the
error messages are not helping to find the root cause (lack of
implementation).

11 years agoconf: Rework virDomainDeviceDefParse
Michal Privoznik [Thu, 11 Jul 2013 10:18:36 +0000 (12:18 +0200)]
conf: Rework virDomainDeviceDefParse

When adding a new domain device, it is fairly easy to forget to add
corresponding piece into virDomainDeviceDefParse. However, if the
internal structure is changed to one bit switch() the compiler will warn
about not handled enum item.

11 years agoconf: Extend device types handled by virDomainDeviceDefParse
Michal Privoznik [Thu, 11 Jul 2013 09:20:34 +0000 (11:20 +0200)]
conf: Extend device types handled by virDomainDeviceDefParse

Not all device types are currently parsed in virDomainDeviceDefParse,
Since all needed functions do exist, nothing holds us back to make the
implementation complete. Similarly, the virDomainDeviceDefFree needs to
be updated as well.

11 years agoLXC: remove some incorrect setting ATTRIBUTE_UNUSED
Gao feng [Thu, 11 Jul 2013 06:05:20 +0000 (14:05 +0800)]
LXC: remove some incorrect setting ATTRIBUTE_UNUSED

these parameters shouldn't be marked as ATTRIBUTE_UNUSED.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agostorage: return -1 when fs pool can't be mounted
Ján Tomko [Thu, 11 Jul 2013 10:36:59 +0000 (12:36 +0200)]
storage: return -1 when fs pool can't be mounted

Don't reuse the return value of virStorageBackendFileSystemIsMounted.
If it's 0, we'd return it even if the mount command failed.

Also, don't report another error if it's -1, since one has already
been reported.

Introduced by 258e06c.

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

11 years agoqemu: Slightly increase memory limit
Jiri Denemark [Mon, 8 Jul 2013 13:12:27 +0000 (15:12 +0200)]
qemu: Slightly increase memory limit

For low-memory domains (roughly under 400MB) our automatic memory limit
computation comes up with a limit that's too low. This is because the
0.5 multiplication does not add enough for such small values. Let's
increase the constant part of the computation to fix this.

11 years agoutil: add rebase fix that was accidentally omitted from previous patch
Laine Stump [Thu, 11 Jul 2013 03:06:43 +0000 (23:06 -0400)]
util: add rebase fix that was accidentally omitted from previous patch

I had made the change locally, so make check and make syntax-check
were successful, but forgot to add/commit. Unfortunately, git allows a
push when the local directory is dirty, so it didn't catch my mistake.

11 years agoutil: use VIR_(APPEND|DELETE)_ELEMENT for pci/usb device lists
Laine Stump [Fri, 5 Jul 2013 18:46:35 +0000 (14:46 -0400)]
util: use VIR_(APPEND|DELETE)_ELEMENT for pci/usb device lists

Eliminate memmove() by using VIR_*_ELEMENT API instead.

In both pci and usb cases, the count that held the size of the list
was unsigned int so it had to be changed to size_t.

11 years agoPrevent use of 'int' data type & 'ii', 'jj', 'kk' var names for loops
Daniel P. Berrange [Mon, 8 Jul 2013 14:17:29 +0000 (15:17 +0100)]
Prevent use of 'int' data type & 'ii', 'jj', 'kk' var names for loops

Add two syntax-check rules

 - sc_prohibit_int_ijk - block use of 'int' as a data type
   for any variables named 'i', 'j', 'k'
 - sc_prohibit_int_iijjkk - block use of 'ii', 'jj', 'kk'
   for any variable names

11 years agoConvert 'int i' to 'size_t i' in examples/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in examples/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in python/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in python/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/cpu/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/cpu/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/hyperv/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/hyperv/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/interface/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/interface/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/network/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/network/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/libxl/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/libxl/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/locking/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/locking/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/lxc/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/lxc/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/node_device/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/node_device/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/nwfilter/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/nwfilter/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/openvz/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/openvz/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/parallels/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/parallels/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/phyp/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/phyp/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/qemu files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/qemu files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/remote/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/remote/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/rpc/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/rpc/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/secret/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/secret/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/security files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/security files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/test/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/test/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/uml/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/uml/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/vbox/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/vbox/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/storage/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/storage/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/{esx,vmx,vmware} files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/{esx,vmx,vmware} files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/{xen,xenapi,xenxs} files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/{xen,xenapi,xenxs} files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in tools/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in tools/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in tests/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in tests/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/util/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/util/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert 'int i' to 'size_t i' in src/conf/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in src/conf/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix bridge routines detection on kFreeBSD
Roman Bogorodskiy [Wed, 10 Jul 2013 09:38:06 +0000 (13:38 +0400)]
Fix bridge routines detection on kFreeBSD

In order to properly detect bridge related definitions such as
BRDGSFD, BRDGADD and BRDGDEL on kFreeBSD we need to include
<stdint.h>.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=715321

Reported by Laurent Bigonville.

11 years agoFix crash when multiple event callbacks were registered
Ján Tomko [Tue, 2 Jul 2013 13:17:09 +0000 (15:17 +0200)]
Fix crash when multiple event callbacks were registered

CVE-2013-2230

Don't overwrite the callback ID returned by
virDomainEventStateRegisterID in ret by 0.

Introduced by abf75aea.

11 years agoqemu: fix double free in qemuMigrationPrepareDirect
Ján Tomko [Wed, 10 Jul 2013 10:33:29 +0000 (12:33 +0200)]
qemu: fix double free in qemuMigrationPrepareDirect

Remove assignment of the string freed by virURIFree
to hostname, since it's not used anywhere.

Double free introduced by ddf8ad8, useless code
introduced by f03dcc5.

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

11 years agoConvert 'int i' to 'size_t i' in daemon/ files
Daniel P. Berrange [Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)]
Convert 'int i' to 'size_t i' in daemon/ files

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdapt to VIR_ALLOC and virAsprintf in tools/*
Michal Privoznik [Thu, 4 Jul 2013 10:20:45 +0000 (12:20 +0200)]
Adapt to VIR_ALLOC and virAsprintf in tools/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in tests/*
Michal Privoznik [Thu, 4 Jul 2013 10:20:21 +0000 (12:20 +0200)]
Adapt to VIR_ALLOC and virAsprintf in tests/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/*
Michal Privoznik [Thu, 4 Jul 2013 10:20:00 +0000 (12:20 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/xenxs/*
Michal Privoznik [Thu, 4 Jul 2013 10:19:27 +0000 (12:19 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/xenxs/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/xenapi/*
Michal Privoznik [Thu, 4 Jul 2013 10:19:05 +0000 (12:19 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/xenapi/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/xen/*
Michal Privoznik [Thu, 4 Jul 2013 10:18:49 +0000 (12:18 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/xen/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/vmx/*
Michal Privoznik [Thu, 4 Jul 2013 10:18:18 +0000 (12:18 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/vmx/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/vmware/*
Michal Privoznik [Thu, 4 Jul 2013 10:17:55 +0000 (12:17 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/vmware/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/vbox/*
Michal Privoznik [Thu, 4 Jul 2013 10:17:38 +0000 (12:17 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/vbox/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/util/*
Michal Privoznik [Thu, 4 Jul 2013 10:17:18 +0000 (12:17 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/util/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/uml/*
Michal Privoznik [Thu, 4 Jul 2013 10:17:01 +0000 (12:17 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/uml/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/test/*
Michal Privoznik [Thu, 4 Jul 2013 10:16:47 +0000 (12:16 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/test/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/storage/*
Michal Privoznik [Thu, 4 Jul 2013 10:16:29 +0000 (12:16 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/storage/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/security/*
Michal Privoznik [Thu, 4 Jul 2013 10:15:50 +0000 (12:15 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/security/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/secret/*
Michal Privoznik [Thu, 4 Jul 2013 10:15:29 +0000 (12:15 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/secret/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/rpc/*
Michal Privoznik [Thu, 4 Jul 2013 10:15:05 +0000 (12:15 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/rpc/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/remote/*
Michal Privoznik [Thu, 4 Jul 2013 10:14:34 +0000 (12:14 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/remote/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/qemu/*
Michal Privoznik [Thu, 4 Jul 2013 10:14:12 +0000 (12:14 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/qemu/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/phyp/*
Michal Privoznik [Thu, 4 Jul 2013 10:13:48 +0000 (12:13 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/phyp/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/parallels/*
Michal Privoznik [Thu, 4 Jul 2013 10:13:24 +0000 (12:13 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/parallels/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/openvz/*
Michal Privoznik [Thu, 4 Jul 2013 10:13:02 +0000 (12:13 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/openvz/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/nwfilter/*
Michal Privoznik [Thu, 4 Jul 2013 10:12:44 +0000 (12:12 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/nwfilter/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/network/*
Michal Privoznik [Thu, 4 Jul 2013 10:12:21 +0000 (12:12 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/network/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/node_device/*
Michal Privoznik [Thu, 4 Jul 2013 10:11:59 +0000 (12:11 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/node_device/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/lxc/*
Michal Privoznik [Thu, 4 Jul 2013 10:11:37 +0000 (12:11 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/lxc/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/locking/*
Michal Privoznik [Thu, 4 Jul 2013 10:11:02 +0000 (12:11 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/locking/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/libxl/*
Michal Privoznik [Thu, 4 Jul 2013 10:10:38 +0000 (12:10 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/libxl/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/interface/*
Michal Privoznik [Thu, 4 Jul 2013 10:10:05 +0000 (12:10 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/interface/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/hyperv/*
Michal Privoznik [Thu, 4 Jul 2013 10:09:29 +0000 (12:09 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/hyperv/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/esx/*
Michal Privoznik [Thu, 4 Jul 2013 10:05:43 +0000 (12:05 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/esx/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/cpu/*
Michal Privoznik [Thu, 4 Jul 2013 10:03:29 +0000 (12:03 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/cpu/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/conf/*
Michal Privoznik [Thu, 4 Jul 2013 10:02:00 +0000 (12:02 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/conf/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/access/*
Michal Privoznik [Thu, 4 Jul 2013 10:00:19 +0000 (12:00 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/access/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in daemon/*
Michal Privoznik [Thu, 4 Jul 2013 09:58:18 +0000 (11:58 +0200)]
Adapt to VIR_ALLOC and virAsprintf in daemon/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in docs/
Michal Privoznik [Thu, 4 Jul 2013 10:21:16 +0000 (12:21 +0200)]
Adapt to VIR_ALLOC and virAsprintf in docs/

11 years agoIntroduce OOM reporting to virAsprintf
Michal Privoznik [Fri, 7 Jun 2013 15:10:28 +0000 (17:10 +0200)]
Introduce OOM reporting to virAsprintf

Actually, I'm turning this function into a macro as filename,
function name and line number needs to be passed. The new
function virAsprintfInternal is introduced with the extended set
of arguments.

11 years agoviralloc: Report OOM error on failure
Michal Privoznik [Fri, 7 Jun 2013 08:37:25 +0000 (10:37 +0200)]
viralloc: Report OOM error on failure

Similarly to VIR_STRDUP, we want the OOM error to be reported in
VIR_ALLOC and friends.

11 years agoProperly detect VMDK with internal version 2
Martin Kletzander [Tue, 9 Jul 2013 13:16:34 +0000 (15:16 +0200)]
Properly detect VMDK with internal version 2

Initially proposed as [1], but then changed to comment fix only.  VMDK
can have internal version set to 2 when there are few features added
which do not affect us.  Thanks to Jan's commit a1ee8e18 this can be
easily fixed by adding it to list of supported versions.

[1] http://www.redhat.com/archives/libvir-list/2013-June/msg00419.html

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

11 years agobuild: honor autogen.sh --no-git
Eric Blake [Wed, 3 Jul 2013 20:43:11 +0000 (14:43 -0600)]
build: honor autogen.sh --no-git

Based on a report by Chandrashekar Shastri, at
https://bugzilla.redhat.com/show_bug.cgi?id=979360

On systems where git cannot access the outside world, a developer
can instead arrange to get a copy of gnulib at the right commit
via side channels (such as NFS share drives), set GNULIB_SRCDIR,
then use ./autogen.sh --no-git.  In this setup, we will now
avoid direct use of git.  Of course, this means no automatic
gnulib updates when libvirt.git updates its submodule, but it
is expected that any developer in such a situation is already
prepared to deal with the fallout.

* .gnulib: Update to latest, for bootstrap.
* bootstrap: Synchronize from gnulib.
* autogen.sh (no_git): Avoid git when requested.
* cfg.mk (_update_required): Skip automatic rerun of bootstrap if
we can't use git.
* docs/compiling.html.in: Document this setup.
* docs/hacking.html.in: Mention this.
* HACKING: Regenerate.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agomaint: tweak use of <a> in HACKING
Eric Blake [Mon, 8 Jul 2013 22:37:11 +0000 (16:37 -0600)]
maint: tweak use of <a> in HACKING

The previous handling of <a> tags led to some less-than-ideal
layout in HACKING (most noticeable on a mid-sentence reference
to the valgrind home page).

* docs/hacking.html.in: Slight tweaks to <a> tags.
* docs/hacking1.xsl: Move <a> handling...
* docs/hacking2.xsl: ...here.
* HACKING: Regenerate.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agomaint: fix typo in qemu error message
Eric Blake [Tue, 9 Jul 2013 17:37:36 +0000 (11:37 -0600)]
maint: fix typo in qemu error message

Introduced in commit d47eff88.

* src/qemu/qemu_driver.c (qemuDomainSetVcpusFlags): Fix spelling.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agodaemon: Fix command example in libvirtd.sasl
Cole Robinson [Tue, 9 Jul 2013 14:01:55 +0000 (10:01 -0400)]
daemon: Fix command example in libvirtd.sasl

sasldblistusers2 doesn't have a '-a' option

11 years agoLXC: hostdev: create parent directory for hostdev
Gao feng [Tue, 9 Jul 2013 10:16:20 +0000 (11:16 +0100)]
LXC: hostdev: create parent directory for hostdev

Create parent directroy for hostdev automatically when we
start a lxc domain or attach a hostdev to a lxc domain.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoLXC: hostdev: introduce lxcContainerSetupHostdevCapsMakePath
Gao feng [Tue, 9 Jul 2013 10:15:11 +0000 (11:15 +0100)]
LXC: hostdev: introduce lxcContainerSetupHostdevCapsMakePath

This helper function is used to create parent directory for
the hostdev which will be added to the container. If the
parent directory of this hostdev doesn't exist, the mknod of
the hostdev will fail. eg with /dev/net/tun

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoLXC: Create /dev/tty within a container
Richard Weinberger [Tue, 9 Jul 2013 10:05:14 +0000 (11:05 +0100)]
LXC: Create /dev/tty within a container

Many applications use /dev/tty to read from stdin.
e.g. zypper on openSUSE.

Let's create this device node to unbreak those applications.
As /dev/tty is a synonym for the current controlling terminal
it cannot harm the host or any other containers.

Signed-off-by: Richard Weinberger <richard@nod.at>
11 years agoscsi: Fix construction of sysfs device path
Viktor Mihajlovski [Mon, 8 Jul 2013 16:57:58 +0000 (18:57 +0200)]
scsi: Fix construction of sysfs device path

The device bus value was used instead of the device target when
building the sysfs device path. Trivial.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
11 years agoselinux: Always generate imagelabel
Peter Krempa [Tue, 2 Jul 2013 16:34:58 +0000 (18:34 +0200)]
selinux: Always generate imagelabel

The imagelabel SELinux label was only generated when relabeling was
enabled. This prohibited labeling of files created by libvirt that need
to be labeled even if relabeling is turned off.

The only codepath this change has direct impact on is labeling of FDs
passed to qemu which is always safe in current state.