]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
14 years agoFix gcc 4.6 warnings
Christophe Fergeau [Thu, 14 Apr 2011 09:22:35 +0000 (11:22 +0200)]
Fix gcc 4.6 warnings

gcc 4.6 warns when a variable is initialized but isn't used afterwards:

vmware/vmware_driver.c:449:18: warning: variable 'vmxPath' set but not used [-Wunused-but-set-variable]

This patch fixes these warnings. There are still 2 offending files:

- vbox_tmpl.c: the variable is used inside an #ifdef and is assigned several
  times outside of #ifdef. Fixing the warning would have required wrapping
  all the assignment inside #ifdef which hurts readability.

vbox/vbox_tmpl.c: In function 'vboxAttachDrives':
vbox/vbox_tmpl.c:3918:22: warning: variable 'accessMode' set but not used [-Wunused-but-set-variable]

- esx_vi_types.generated.c: the name implies it's generated code and I
  didn't want to dive into the code generator

esx/esx_vi_types.generated.c: In function 'esxVI_FileQueryFlags_Free':
esx/esx_vi_types.generated.c:1203:3: warning: variable 'item' set but not used [-Wunused-but-set-variable]

14 years agoIntroduce virDomainChrDefNew()
Michal Novotny [Thu, 14 Apr 2011 16:05:14 +0000 (18:05 +0200)]
Introduce virDomainChrDefNew()

Make: passed
Make check: passed
Make syntax-check: passed

this is the commit to introduce the function to create new character
device definition for the domain as advised by Cole Robinson
<crobinso@redhat.com>.

The function is used on the relevant places and also new tests has
been added.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
14 years agoSpice: support audio, images and stream compression
Michal Privoznik [Thu, 14 Apr 2011 08:44:20 +0000 (10:44 +0200)]
Spice: support audio, images and stream compression

This extends the SPICE XML to allow variable compression settings for audio,
images and streaming:
    <graphics type='spice' port='5901' tlsPort='-1' autoport='yes'>
        <image compression='auto_glz'/>
        <jpeg compression='auto'/>
        <zlib compression='auto'/>
        <playback compression='on'/>
    </graphics>

All new elements are optional.

14 years agofree cpumask of vcpupinDef
Hu Tao [Thu, 14 Apr 2011 03:34:26 +0000 (11:34 +0800)]
free cpumask of vcpupinDef

cpumask doesn't get freed when vcpupinDef being freed, this leaks
memory.

14 years agoesx: Make the parsed URI part of the private connection data
Matthias Bolte [Sun, 10 Apr 2011 15:18:32 +0000 (17:18 +0200)]
esx: Make the parsed URI part of the private connection data

This will be used to make esxVI_Context clonable.

Also move cleanup code for esxPrivate to esxFreePrivate().

14 years agoesx: Mark error message in macros for translation
Matthias Bolte [Sun, 10 Apr 2011 11:28:29 +0000 (13:28 +0200)]
esx: Mark error message in macros for translation

14 years agoesx: Extend VI generator to cover managed object types
Matthias Bolte [Sun, 10 Apr 2011 11:27:56 +0000 (13:27 +0200)]
esx: Extend VI generator to cover managed object types

Generate lookup functions for managed object types.

14 years agoesx: Cleanup and refactor CastFromAnyType macros
Matthias Bolte [Sun, 10 Apr 2011 11:27:19 +0000 (13:27 +0200)]
esx: Cleanup and refactor CastFromAnyType macros

Add CastFromAnyType functions for the String type.

14 years agoesx: Cleanup VI generator code
Matthias Bolte [Sun, 10 Apr 2011 11:26:47 +0000 (13:26 +0200)]
esx: Cleanup VI generator code

14 years agonetwork: Fix NULL dereference during error recovery
Michal Privoznik [Thu, 14 Apr 2011 12:03:46 +0000 (14:03 +0200)]
network: Fix NULL dereference during error recovery

This fixes: https://bugzilla.redhat.com/show_bug.cgi?id=696660

While starting a network, if brSetForwardDelay() fails, we go to err1
where we want to access macTapIfName variable which was just
VIR_FREE'd a few lines above. Instead, keep macTapIfName until we are
certain of success.

14 years agodocs: Serial and parallel device target ports actually start from 0
Matthias Bolte [Sun, 10 Apr 2011 13:03:42 +0000 (15:03 +0200)]
docs: Serial and parallel device target ports actually start from 0

Reported by Igor Galić

14 years agoAdd missing checks for QEMU domain state in tunables APIs
Daniel P. Berrange [Fri, 18 Mar 2011 15:08:19 +0000 (15:08 +0000)]
Add missing checks for QEMU domain state in tunables APIs

The methods qemuDomain{Get,Set}{Memory,Blkio,Scheduler}Parameters
all forgot to do a check on virDomainIsActive(), resulting in bogus
error messages from later parts of their impl

* src/qemu/qemu_driver.c: Add missing checks on virDomainIsActive()

14 years agophyp: Fix too small buffer allocation in phypAttachDevice
Matthias Bolte [Sat, 9 Apr 2011 09:59:10 +0000 (11:59 +0200)]
phyp: Fix too small buffer allocation in phypAttachDevice

sizeof(domain->name) is the wrong thing. Instead of using strdup here
rewrite escape_specialcharacters to allocate the buffer itself.

Add a contains_specialcharacters to be used in phypOpen, as phypOpen is
not interested in the escaped version.

14 years agophyp: Don't overwrite error from virDomainDeviceDefParse by OOM error
Matthias Bolte [Sat, 9 Apr 2011 09:59:11 +0000 (11:59 +0200)]
phyp: Don't overwrite error from virDomainDeviceDefParse by OOM error

14 years agophyp: Don't try to use a string from a failed virAsprintf
Matthias Bolte [Sat, 9 Apr 2011 09:59:09 +0000 (11:59 +0200)]
phyp: Don't try to use a string from a failed virAsprintf

14 years agophyp: Reduce code duplication in error and success paths
Matthias Bolte [Sat, 9 Apr 2011 09:59:08 +0000 (11:59 +0200)]
phyp: Reduce code duplication in error and success paths

Also fix memory leaks along the way in phypCreateServerSCSIAdapter and
phypAttachDevice.

14 years agophyp: Remove stack allocating a 4kb volume key and fix related memory leaks
Matthias Bolte [Sat, 9 Apr 2011 09:59:07 +0000 (11:59 +0200)]
phyp: Remove stack allocating a 4kb volume key and fix related memory leaks

Don't pre-allocate 4kb per key, make phypVolumeGetKey allocate the memory.

Make phypBuildVolume return the volume key instead of using pre-allocated
memory to store it.

Also fix a memory leak in phypVolumeLookupByName when phypVolumeGetKey
fails. Fix another memory leak in phypVolumeLookupByPath in the success
path. Fix phypVolumeGetXMLDesc leaking voldef.key.

14 years agoRemove C99 variable declare in PHYP network driver
Daniel P. Berrange [Wed, 13 Apr 2011 18:10:52 +0000 (19:10 +0100)]
Remove C99 variable declare in PHYP network driver

Move the virInterfacePtr declaration to the top of the
function to avoid jump uninitialized variable warnings

* src/phyp/phyp_driver.c: Fix var declaration

14 years agoReplace REMOTE_DEBUG with VIR_DEBUG in daemon dispatcher
Daniel P. Berrange [Wed, 13 Apr 2011 15:10:01 +0000 (16:10 +0100)]
Replace REMOTE_DEBUG with VIR_DEBUG in daemon dispatcher

The daemon dispatcher code had an obsolete macro

  #define REMOTE_DEBUG(fmt, ...) VIR_DEBUG(fmt, __VA_ARGS__)

This can be trivially removed

* daemon/remote.c: s/REMOTE_DEBUG/VIR_DEBUG/

14 years agoAdd missing checks for whether the connection is open in dispatcher
Daniel P. Berrange [Tue, 12 Apr 2011 16:33:49 +0000 (17:33 +0100)]
Add missing checks for whether the connection is open in dispatcher

Many functions did not check for whether a connection was
open. Replace the macro which obscures control flow, with
explicit checks, and ensure all dispatcher code has checks.

* daemon/remote.c: Add connection checks

14 years agoStandard on error variable name in libvirtd dispatcher
Daniel P. Berrange [Wed, 13 Apr 2011 14:49:09 +0000 (15:49 +0100)]
Standard on error variable name in libvirtd dispatcher

Some dispatcher methods have a parameter

            remote_error *err,

Instead of the more normal

            remote_error *rerr,

* daemon/remote.c: s/err/rerr/

14 years agoRemove all whitespace before function brackets in daemon dispatcher
Daniel P. Berrange [Tue, 12 Apr 2011 16:34:30 +0000 (17:34 +0100)]
Remove all whitespace before function brackets in daemon dispatcher

A lot of code in libvirtd's dispatcher used the style

    dom = get_nonnull_domain (conn, args->dom);

Instead of the normal libvirt style

    dom = get_nonnull_domain(conn, args->dom);

* daemon/remote.c: Remove all whitelist before function brackets

14 years agoPHYP: Adding network interface
Eduardo Otubo [Mon, 28 Mar 2011 20:07:20 +0000 (17:07 -0300)]
PHYP: Adding network interface

This is the implementation of the previous patch now using virInterface*
API. Ended up this patch got much more simpler, smaller and easier to
review. Here is some details:

  * MAC size and interface name are fixed due to specifications on HMC,
    both are created automatically and CAN'T be specified from user. They
    have the following format:

     * MAC: 122980003002
     * Interface name: U9124.720.067BE8B-V3-C0

  * I did replaced all the |grep|sed following the comments Eric Blake
    did on the last patch.

  * According to my last email, It's not possible to create a network
    interface without assigning it to a specific lpar. Then, I am using
    this very minimalistic XML file for testing:

     <interface type='ethernet' name='LPAR01'>
     </interface>

    In this file I am using "name" as the lpar name which I am going to
    assign the new network interface. I couldn't find a better way to
    refer to it. Comments are welcome.

  * Regarding the fact I am sleeping one second waiting for the HMC to
    complete creation of the interface, I don't have means to check
    if the whole process is done. All I do is execute a command, wait
    until is complete (which is not enough in this case) check
    the return and the exit status. The process of actually creating
    a networking interface seems to take a little longer than just the
    return of the ssh control.

14 years agoqemu: fix a dead-lock problem
Hu Tao [Tue, 12 Apr 2011 10:29:27 +0000 (18:29 +0800)]
qemu: fix a dead-lock problem

In qemuDomainObjBeginJobWithDriver, when virCondWaitUntil timeouts,
the function tries to call qemuDriverLock with virDomainObj locked,
this causes the dead-lock problem. This patch fixes this.

14 years agoutil: Fix crash when removing entries during hash iteration
Jiri Denemark [Tue, 12 Apr 2011 15:58:22 +0000 (17:58 +0200)]
util: Fix crash when removing entries during hash iteration

Commit 9677cd33eea4c65d78ba463b46b8b45ed2da1709 made it possible to
remove current entry when iterating through all hash entries. However,
it didn't properly handle a special case of removing first entry
assigned to a given key which contains several entries in its collision
list.

14 years agoFix possible infinite loop in remote driver
Michal Privoznik [Tue, 12 Apr 2011 14:58:48 +0000 (16:58 +0200)]
Fix possible infinite loop in remote driver

When we take out completed calls from queue we might end up
in circular pointer. We don't want pointer to previous item
point to element taken out.

14 years agomaint: fix grammar errors
Eric Blake [Mon, 11 Apr 2011 22:25:25 +0000 (16:25 -0600)]
maint: fix grammar errors

Jim Meyering recently improved gnulib to catch various grammar
errors during 'make syntax-check'.

* .gnulib: Update to latest, for syntax-check improvements.
* include/libvirt/libvirt.h.in (virConnectAuthCallbackPtr): Use
cannot rather than two words.
* src/driver.c: Likewise.
* src/driver.h (VIR_SECRET_GET_VALUE_INTERNAL_CALL): Likewise.
* src/remote/remote_driver.c (initialize_gnutls): Likewise.
* src/util/pci.c (pciBindDeviceToStub): Likewise.
* src/storage/storage_backend.c (virStorageBackendCreateQemuImg):
Likewise.
(virStorageBackendUpdateVolTargetInfoFD): Avoid doubled word.
* docs/formatdomain.html.in: Likewise.
* src/qemu/qemu_process.c (qemuProcessStart): Likewise.
* cfg.mk (exclude_file_name_regexp--sc_prohibit_can_not)
(exclude_file_name_regexp--sc_prohibit_doubled_word): Exclude
existing translation problems.

14 years agodocs: document freecell --all
Eric Blake [Wed, 6 Apr 2011 17:27:06 +0000 (11:27 -0600)]
docs: document freecell --all

Based on a smaller patch developed by Moritoshi Oshiro:
https://bugzilla.redhat.com/show_bug.cgi?id=693963

* tools/virsh.pod (freecell): Mention all, and clarify that
optional cellno requires --cellno.

14 years agoxen: Remove PATH_MAX sized stack allocation from block stats code
Matthias Bolte [Sat, 9 Apr 2011 10:03:44 +0000 (12:03 +0200)]
xen: Remove PATH_MAX sized stack allocation from block stats code

14 years agosetmaxmem: add the new options to "virsh setmaxmem" command
Taku Izumi [Fri, 8 Apr 2011 05:08:52 +0000 (14:08 +0900)]
setmaxmem: add the new options to "virsh setmaxmem" command

This patch adds the new options (--live, --config, and --current) to
"virsh setmaxmem" command. The behavior of above options is the same
as that of "virsh setmem".  When the --config option is specified, a
modification is effective for the persistent domain, while the --live
option is specified, a modification is effective for an active
domain. The --current option is specified, it affects a current
domain.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
14 years agomaxmem: implement virDomainSetMaxMemory API of the qemu driver
Taku Izumi [Fri, 8 Apr 2011 05:08:13 +0000 (14:08 +0900)]
maxmem: implement virDomainSetMaxMemory API of the qemu driver

This patch implements the code to support virDomainSetMaxMemory API,
and to support VIR_DOMAIN_MEM_MAXIMUM flag in qemudDomainSetMemoryFlags function.
As a result, we can change the maximum memory size of inactive QEMU guests.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
14 years agomaxmem: introduces VIR_DOMAIN_MEM_MAXIMUM flag
Taku Izumi [Fri, 8 Apr 2011 05:07:27 +0000 (14:07 +0900)]
maxmem: introduces VIR_DOMAIN_MEM_MAXIMUM flag

This patch introduces VIR_DOMAIN_MEM_MAXIMUM flag.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
14 years agodocs: remove "returns" word from beginning of lines
Jean-Baptiste Rouault [Thu, 7 Apr 2011 08:47:44 +0000 (10:47 +0200)]
docs: remove "returns" word from beginning of lines

Move "returns" keyword from beginning of API doc lines
when it does not describe return values.
Maybe the API doc extractor could be changed to look for
"returns: " to avoid such confusion.

14 years agobuild: really fix mingw startup
Eric Blake [Fri, 8 Apr 2011 19:00:09 +0000 (13:00 -0600)]
build: really fix mingw startup

Aargh; commit 8ae5dfd still didn't fix the mingw problem, because
gnulib defined O_NONBLOCK to 0 for just mingw.  I've now fixed
that in gnulib, but we need the latest pipe2 for libvirt to work.

* .gnulib: Update to latest, for pipe2 fixes.

14 years agobuild: fix mingw build
Eric Blake [Fri, 8 Apr 2011 15:08:53 +0000 (09:08 -0600)]
build: fix mingw build

Commit 02c39a2 introduced a mingw build regression, due to a
regression in gnulib's areadlink module:

../../../gnulib/lib/careadlinkat.c: In function 'careadlinkat':
../../../gnulib/lib/careadlinkat.c:143:39: error: 'const struct allocator' has no member named 'malloc'

* .gnulib: Update to latest, for careadlinkat fix.

14 years agodocs: tweak virsh restore warning
Eric Blake [Thu, 7 Apr 2011 15:01:18 +0000 (09:01 -0600)]
docs: tweak virsh restore warning

* tools/virsh.pod: Fix grammar, and clarify wording.
* src/qemu/qemu_driver.c (qemudDomainObjStart): Drop redundant
condition.

14 years agodo not build libvirt_iohelper when building without libvirtd
Wen Congyang [Fri, 8 Apr 2011 03:26:47 +0000 (11:26 +0800)]
do not build libvirt_iohelper when building without libvirtd

The libexec program libvirt_iohelper is only for libvirtd. If we build rpm
without libvirtd, we will receive the following messages:

Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/wency/rpmbuild/BUILDROOT/libvirt-0.9.0-1.el6.x86_64
error: Installed (but unpackaged) file(s) found:
   /usr/libexec/libvirt_iohelper

14 years agonwfilters: support for TCP flags evaluation
Stefan Berger [Fri, 8 Apr 2011 00:13:38 +0000 (20:13 -0400)]
nwfilters: support for TCP flags evaluation

This patch adds support for the evaluation of TCP flags in nwfilters.

It adds documentation to the web page and extends the tests as well.
Also, the nwfilter schema is extended.

The following are some example for rules using the tcp flags:

<rule action='accept' direction='in'>
    <tcp state='NONE' flags='SYN/ALL' dsptportstart='80'/>
</rule>
<rule action='drop' direction='in'>
    <tcp state='NONE' flags='SYN/ALL'/>
</rule>

14 years agosetmem: add --current option to virsh setmem command
Taku Izumi [Wed, 23 Mar 2011 05:49:28 +0000 (14:49 +0900)]
setmem: add --current option to virsh setmem command

This patch adds the new option (--current) to the "virsh setmem" command.
When --current option is specified, it affects a "current" domain.
The word "current" denotes that if a domain is running, it affects
a running domain only; otherwise it affects a persistent domain.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
14 years agosetmem: add VIR_DOMAIN_MEM_CURRENT support to qemu
Taku Izumi [Wed, 23 Mar 2011 05:48:24 +0000 (14:48 +0900)]
setmem: add VIR_DOMAIN_MEM_CURRENT support to qemu

This patch adds virDomainSetMemoryFlags(,,VIR_DOMAIN_MEM_CURRENT) support
code to qemu driver.

Also, change virDomainObjIsActive to return bool, given its usage.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
14 years agosetmem: introduce VIR_DOMAIN_MEM_CURRENT flag
Taku Izumi [Wed, 23 Mar 2011 05:47:21 +0000 (14:47 +0900)]
setmem: introduce VIR_DOMAIN_MEM_CURRENT flag

This patch introduces VIR_DOMAIN_MEM_CURRENT flag and
modifies virDomainSetMemoryFlags function to support it.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
14 years agobuild: Install libxenlight log dir
Jim Fehlig [Thu, 7 Apr 2011 22:01:58 +0000 (16:01 -0600)]
build: Install libxenlight log dir

Add $localstatedir/log/libvirt/libxl when building libxenlight driver

14 years agosetmaxmem: remove the code to invoke virDomainSetMemory in cmdSetmaxmem
Taku Izumi [Wed, 16 Mar 2011 08:58:57 +0000 (17:58 +0900)]
setmaxmem: remove the code to invoke virDomainSetMemory in cmdSetmaxmem

When the new maximum memory size becomes less than the current memory size,
I think it is not the libvirt client but the each driver that decides the behavior
(reject the operation or shrink the current memory size).

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
14 years agovirsh: fix mingw startup
Eric Blake [Wed, 6 Apr 2011 14:10:28 +0000 (08:10 -0600)]
virsh: fix mingw startup

* .gnulib: Update to latest, for pipe2.
* bootstrap.conf (gnulib_modules): Add pipe2.
* src/util/event_poll.c (virEventPollInit): Use it, to avoid
problematic virSetCloseExec on mingw.

14 years agobuild: fix gitignore sorting
Eric Blake [Tue, 5 Apr 2011 19:06:31 +0000 (13:06 -0600)]
build: fix gitignore sorting

Make it so we don't have to 'git add -f' particular files like
po/POTFILES.in all the time (tested by fixing one of our
special-case files as part of the patch).

* .gnulib: Update to latest.
* bootstrap: Resync from coreutils.
* .gitignore: Sort whitelist entries correctly, including ignoring
files rather than directories.
* m4/virt-compile-warnings.m4: Convert tabs to space.

14 years agodocs: add an IPv6 address to network XML examples
Laine Stump [Thu, 7 Apr 2011 14:50:43 +0000 (10:50 -0400)]
docs: add an IPv6 address to network XML examples

It was just pointed out that, although I added documentation for the
IPv6 additions to the network XML, I neglected to use those additions
in the examples. This patch adds an IPv6 address to each of the
examples except for the "default" network, since that is a faithful
reproduction of the default network config that's automatically
installed, which doesn't include any IPv6 address (for good reason -
because there is no such thing as IPv6 NAT, there is no one IPv6
address that would work for all installations).

14 years agoAdd domainSet/GetSchedulerParameters to libxl driver
Markus Groß [Wed, 6 Apr 2011 08:58:40 +0000 (10:58 +0200)]
Add domainSet/GetSchedulerParameters to libxl driver

Libxenlight currently only supports the credit scheduler.
Therefore setting or getting a parameter of other
schedulers raise an error (for now).

14 years agoqemu: Remove the managed state file only if restoring succeeded
Osier Yang [Thu, 7 Apr 2011 08:58:26 +0000 (16:58 +0800)]
qemu: Remove the managed state file only if restoring succeeded

1) Both "qemuDomainStartWithFlags" and "qemuAutostartDomain" try to
restore the domain from managedsave'ed image if it exists (by
invoking "qemuDomainObjRestore"), but it unlinks the image even
if restoring fails, which causes data loss. (This problem exists
for "virsh managedsave dom; virsh start dom").

The fix for is to unlink the managed state file only if restoring
succeeded.

2) For "virsh save dom; virsh restore dom;", it can cause data
corruption if one reuse the saved state file for restoring. Add
doc to tell user about it.

3) In "qemuDomainObjStart", if "managed_save" is NULL, we shouldn't
fallback to start the domain, skipping it to cleanup as a incidental
fix. Discovered by Eric.

14 years agoreattach pci devices when qemuPrepareHostdevPCIDevices() failed
Wen Congyang [Mon, 28 Mar 2011 07:01:19 +0000 (15:01 +0800)]
reattach pci devices when qemuPrepareHostdevPCIDevices() failed

Reattach all pci devices that we detached when qemuPrepareHostdevPCIDevices()
failed.

14 years agoreattach pci device when pciBindDeviceToStub() failed
Wen Congyang [Wed, 6 Apr 2011 07:13:14 +0000 (15:13 +0800)]
reattach pci device when pciBindDeviceToStub() failed

We should bind pci device to original driver when pciBindDeviceToStub() failed.
If the pci device is not bound to any driver before calling pciBindDeviceToStub(),
we should only unbind it from pci-stub. If it is bound to pci-stub, we should not
unbind it from pci-stub.

14 years agorename pciUnBindDeviceFromStub() to pciUnbindDeviceFromStub() and float it up
Wen Congyang [Wed, 6 Apr 2011 07:13:10 +0000 (15:13 +0800)]
rename pciUnBindDeviceFromStub() to pciUnbindDeviceFromStub() and float it up

This patch do the following things:
1. rename the function as 'Unbind' is better than 'UnBind'.
2. pciUnbindDeviceFromStub() will be used in the function pciBindDeviceToStub() in
   next patch. Float it up, instead of having to have a forward declaration

14 years agoremove devices from driver->activePciHostdevs when qemuPrepareHostdevPCIDevices(...
Wen Congyang [Mon, 28 Mar 2011 07:01:14 +0000 (15:01 +0800)]
remove devices from driver->activePciHostdevs when qemuPrepareHostdevPCIDevices() failed

We should not mark pci devices as active when qemuPrepareHostdevPCIDevices()
failed.

14 years agopci: avoid invalid free, init path to NULL
Wen Congyang [Wed, 6 Apr 2011 06:21:00 +0000 (14:21 +0800)]
pci: avoid invalid free, init path to NULL

This bug was introduce by commit 57162db8, and it will cause libvirtd crashed.

14 years agobuild: avoid compiler warning on cygwin
Eric Blake [Wed, 6 Apr 2011 23:02:53 +0000 (17:02 -0600)]
build: avoid compiler warning on cygwin

In file included from util/threads.c:31:
util/threads-pthread.c: In function 'virThreadSelfID':
util/threads-pthread.c:214: warning: cast from function call of type 'pthread_t' to non-matching type 'int' [-Wbad-function-cast]

* src/util/threads-pthread.c (virThreadSelfID) [!SYS_gettid]:
Add intermediate cast to silence gcc.

14 years agoAdd domainIsUpdated to libxl driver
Markus Groß [Wed, 6 Apr 2011 08:58:39 +0000 (10:58 +0200)]
Add domainIsUpdated to libxl driver

14 years agoFix build for older gcc
Jim Fehlig [Wed, 6 Apr 2011 21:05:45 +0000 (15:05 -0600)]
Fix build for older gcc

With gcc 4.3.4 I'm seeing the following warning failure

cc1: warnings being treated as errors
cc1: error: -funit-at-a-time is required for inlining of functions
that are only called once [-Wdisabled-optimization]

Add -funit-at-a-time to WARN_CFLAGS.

14 years agoChange locking for udev monitor and callbacks
Serge Hallyn [Tue, 5 Apr 2011 21:14:17 +0000 (16:14 -0500)]
Change locking for udev monitor and callbacks

We're seeing bugs apparently resulting from thread unsafety of
libpciaccess, such as
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/726099
To prevent those, as suggested by danpb on irc, move the
nodeDeviceLock(driverState) higher into the callers.  In
particular:

  udevDeviceMonitorStartup should hold the lock while calling
  udevEnumerateDevices(), and udevEventHandleCallback should hold it
  over its entire execution.

It's not clear to me whether it is ok to hold the
nodeDeviceLock while taking the virNodeDeviceObjLock(dev) on a
device.  If not, then the lock will need to be dropped around
the calling of udevSetupSystemDev(), and udevAddOneDevice()
may not actually be safe to call from higher layers with the
driverstate lock held.

libvirt 0.8.8 with this patch on it seems to work fine for me.
Assuming it looks ok and I haven't done anything obviously dumb,
I'll ask the bug submitters to try this patch.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
14 years agotests: fix recent test failures
Eric Blake [Wed, 6 Apr 2011 16:05:14 +0000 (10:05 -0600)]
tests: fix recent test failures

* tests/qemuxml2argvdata/qemuxml2argv-*.args: Reflect reserved VGA
port change.

14 years agoqemu: Support for overriding NPROC limit
Jiri Denemark [Tue, 5 Apr 2011 12:17:28 +0000 (14:17 +0200)]
qemu: Support for overriding NPROC limit

This patch adds max_processes option to qemu.conf which can be used to
override system default limit on number of processes that are allowed to
be running for qemu user.

14 years agoqemu: Always reserves slot 0x02 for primary VGA.
Osier Yang [Tue, 5 Apr 2011 13:49:58 +0000 (21:49 +0800)]
qemu: Always reserves slot 0x02 for primary VGA.

To address https://bugzilla.redhat.com/show_bug.cgi?id=692355

This fix is to reserve slot 0x02 for primary VGA even if there
is no "video" specified in domain XML to avoid the problem.

14 years agolibxl: avoid compiler warning
Eric Blake [Tue, 5 Apr 2011 16:07:57 +0000 (10:07 -0600)]
libxl: avoid compiler warning

cc1: warnings being treated as errors
libxl/libxl_driver.c: In function 'libxlDomainSetVcpusFlags':
libxl/libxl_driver.c:1570:14: error: cast from function call of type 'double' to non-matching type 'unsigned int' [-Wbad-function-cast]
libxl/libxl_driver.c:1578:15: error: cast from function call of type 'double' to non-matching type 'unsigned int' [-Wbad-function-cast]

This was the only use of floor() and ceil(), and floating-point
is overkill for power-of-two manipulations.

* src/libxl/libxl_driver.c (libxlDomainSetVcpusFlags): Avoid -lm
for trivial computations.

14 years agoFix typo in systemtap tapset directory name
Daniel P. Berrange [Tue, 5 Apr 2011 15:18:37 +0000 (16:18 +0100)]
Fix typo in systemtap tapset directory name

The systemtap directory for tapsets is called

  /usr/share/systemtap/tapset

Not

 /usr/share/systemtap/tapsets

* daemon/Makefile.am,libvirt.spec.in: s/tapsets/tapset/

14 years agoDon't try to enable stack protector on Win32
Daniel P. Berrange [Tue, 5 Apr 2011 15:00:58 +0000 (16:00 +0100)]
Don't try to enable stack protector on Win32

The GCC Win32 compiler will claim to support -fstack-protector,
but if it actually gets triggered by a suitable code pattern,
linking will fail. Other non-Linux OS likely suffer the same
way with gcc.

* m4/virt-compile-warnings.m4: Only use stack protector when
  the build target is Linux.

14 years agoAvoid compiler warnings about int -> void * casts
Daniel P. Berrange [Tue, 5 Apr 2011 14:59:17 +0000 (15:59 +0100)]
Avoid compiler warnings about int -> void * casts

GCC is a little confused about the cast of beginthread/beginthreadex
from unsigned long -> void *. Go via an intermediate variable avoids
the bogus warning, and makes the code a little cleaner

* src/util/threads-win32.c: Avoid compiler warning in cast

14 years agoImprove SCSI volume key generation
Daniel P. Berrange [Fri, 12 Nov 2010 15:49:40 +0000 (15:49 +0000)]
Improve SCSI volume key generation

The SCSI volumes get a better 'key' field based on the fully
qualified volume path. All SCSI volumes have a unique serial
available in hardware which can be obtained by sending a
suitable SCSI command. Call out to udev's 'scsi_id' command
to fetch this value

* src/storage/storage_backend_scsi.c: Improve volume key
  field value stability and uniqueness

14 years agoqemu: Ignore unusable binaries
Jiri Denemark [Mon, 4 Apr 2011 13:01:22 +0000 (15:01 +0200)]
qemu: Ignore unusable binaries

When initializing qemu guest capabilities, we should ignore qemu
binaries that we are not able to extract version/help info from since
they will be unusable for creating domains anyway. Ignoring them is also
much better than letting initialization of qemu driver fail.

14 years agoqemu: Rewrite LOOKUP_PTYS macro into a function
Jiri Denemark [Wed, 30 Mar 2011 09:07:59 +0000 (11:07 +0200)]
qemu: Rewrite LOOKUP_PTYS macro into a function

The macro is huge and gives us nothing but headache when maintaining it.

14 years agoEnable use of -Wold-style-definition compiler flag
Daniel P. Berrange [Fri, 16 Jul 2010 16:30:00 +0000 (17:30 +0100)]
Enable use of -Wold-style-definition compiler flag

A couple of functions were declared using the old style foo()
for no-parameters, instead of foo(void)

* src/xen/xen_hypervisor.c, tests/testutils.c: Replace () with (void)
  in some function declarations
* m4/virt-compile-warnings.m4: Enable -Wold-style-definition

14 years agoEnable use of -Wmissing-noreturn
Daniel P. Berrange [Fri, 16 Jul 2010 16:16:19 +0000 (17:16 +0100)]
Enable use of -Wmissing-noreturn

* src/internal.h: Define a ATTRIBUTE_NO_RETURN annotation
* src/lxc/lxc_container.c: Annotate lxcContainerDummyChild
  with ATTRIBUTE_NO_RETURN
* tests/eventtest.c: Mark async thread as ATTRIBUTE_NO_RETURN
* m4/virt-compile-warnings.m4: Enable -Wmissing-noreturn

14 years agoEnable -Wmissing-format-attribute warning
Daniel P. Berrange [Fri, 16 Jul 2010 15:38:10 +0000 (16:38 +0100)]
Enable -Wmissing-format-attribute warning

Add a couple of missing ATTRIBUTE_FMT_PRINTF annotations

* tools/virsh.c, tests/testutils.c: Add printf format attribute
* m4/virt-compile-warnings.m4: Enable -Wmissing-format-attribute

14 years agoRemove acinclude.m4 file
Daniel P. Berrange [Mon, 4 Apr 2011 13:40:34 +0000 (14:40 +0100)]
Remove acinclude.m4 file

Split the bit acinclude.m4 file into smaller pieces named
as m4/virt-XXXXX.m4

* .gitignore: Ignore gettext related files
* acinclude.m4: Delete
* m4/virt-compile-warnings.m4: Checks for GCC compiler flags
* m4/virt-pkgconfig-back-compat.m4: Backcompat check for
  pkgconfig program

14 years agoUse gnulib's manywarnings & warnings modules
Daniel P. Berrange [Fri, 16 Jul 2010 15:04:05 +0000 (16:04 +0100)]
Use gnulib's manywarnings & warnings modules

Remove custom code for checking compiler warnings, using
gl_WARN_ADD instead. Don't list all flags ourselves, use
gnulib's gl_MANYWARN_ALL_GCC to get all possible GCC flags,
then turn off the ones we don't want yet.

* acinclude.m4: Rewrite to use gl_WARN_ADD and gl_MANYWARN_ALL_GCC
* bootstrap.conf: Add warnings & manywarnings
* configure.ac: Switch to gl_WARN_ADD
* m4/compiler-flags.m4: Obsoleted by gl_WARN_ADD

14 years agoRemove possible uninitialized variable in openvz driver
Daniel P. Berrange [Tue, 5 Apr 2011 09:54:59 +0000 (10:54 +0100)]
Remove possible uninitialized variable in openvz driver

* src/openvz/openvz_driver.c: Initialize saveptr variable

14 years agoUse virBufferPtr for sexpr2string instead of manual buffer handling
Matthias Bolte [Sun, 3 Apr 2011 09:21:33 +0000 (11:21 +0200)]
Use virBufferPtr for sexpr2string instead of manual buffer handling

Removes 4kb stack allocation in the XenD subdriver.

14 years agoxend: Remove 4kb stack allocation
Matthias Bolte [Sun, 3 Apr 2011 09:21:32 +0000 (11:21 +0200)]
xend: Remove 4kb stack allocation

14 years agouml: Remove PATH_MAX sized stack allocation from /proc parsing code
Matthias Bolte [Sun, 3 Apr 2011 09:21:31 +0000 (11:21 +0200)]
uml: Remove PATH_MAX sized stack allocation from /proc parsing code

14 years agostorage: Remove PATH_MAX sized stack allocation from iSCSI backend
Matthias Bolte [Sun, 3 Apr 2011 09:21:30 +0000 (11:21 +0200)]
storage: Remove PATH_MAX sized stack allocation from iSCSI backend

14 years agoqemu: Remove PATH_MAX sized stack allocation used in commandline building
Matthias Bolte [Sun, 3 Apr 2011 09:21:28 +0000 (11:21 +0200)]
qemu: Remove PATH_MAX sized stack allocation used in commandline building

14 years agoRemove PATH_MAX sized stack allocation from virFileOpenTtyAt
Matthias Bolte [Sun, 3 Apr 2011 09:21:27 +0000 (11:21 +0200)]
Remove PATH_MAX sized stack allocation from virFileOpenTtyAt

14 years agoopenvz: Remove several larger stack allocations
Matthias Bolte [Sun, 3 Apr 2011 09:21:26 +0000 (11:21 +0200)]
openvz: Remove several larger stack allocations

Replace openvz_readline with getline in several places to get rid of stack
allocated buffers to hold lines.

openvzReadConfigParam allocates memory for return values instead of
expecting a preexisting buffer.

14 years agodaemon: Remove 4kb stack allocation of security label
Matthias Bolte [Sun, 3 Apr 2011 09:21:25 +0000 (11:21 +0200)]
daemon: Remove 4kb stack allocation of security label

14 years agovirsh: Remove two 4kb stack allocations
Matthias Bolte [Sun, 3 Apr 2011 09:21:23 +0000 (11:21 +0200)]
virsh: Remove two 4kb stack allocations

14 years agoUse virFileAbsPath instead of manually creating the absolute path
Matthias Bolte [Sun, 3 Apr 2011 09:21:22 +0000 (11:21 +0200)]
Use virFileAbsPath instead of manually creating the absolute path

Removes multiple 4kb stack allocations.

Removes TODO comments as suggested by Daniel P. Berrange.

14 years agoxenxs: Remove PATH_MAX sized stack allocation in XM script parsing
Matthias Bolte [Sun, 3 Apr 2011 09:21:21 +0000 (11:21 +0200)]
xenxs: Remove PATH_MAX sized stack allocation in XM script parsing

14 years agosasl: Remove stack allocated 8kb temporary buffers
Matthias Bolte [Sun, 3 Apr 2011 09:21:20 +0000 (11:21 +0200)]
sasl: Remove stack allocated 8kb temporary buffers

Move the buffers to the heap allocated client/private data structs.

14 years agoqemu: Use heap allocated memory to read the monitor greeting
Matthias Bolte [Sun, 3 Apr 2011 09:21:19 +0000 (11:21 +0200)]
qemu: Use heap allocated memory to read the monitor greeting

Removing a 4kb stack allocation.

Reduce stack buffer for virStrerror to the common 1kb instead of 4kb.

14 years agophyp: Remove 16kb stack allocation
Matthias Bolte [Sun, 3 Apr 2011 09:21:18 +0000 (11:21 +0200)]
phyp: Remove 16kb stack allocation

Allocate on the heap instead.

14 years agovirt-aa-helper: Remove PATH_MAX sized stack allocations
Matthias Bolte [Sun, 3 Apr 2011 09:21:17 +0000 (11:21 +0200)]
virt-aa-helper: Remove PATH_MAX sized stack allocations

14 years agoebtables: Remove PATH_MAX sized stack allocation
Matthias Bolte [Sun, 3 Apr 2011 09:21:16 +0000 (11:21 +0200)]
ebtables: Remove PATH_MAX sized stack allocation

14 years agopci: Remove PATH_MAX sized stack allocations
Matthias Bolte [Sun, 3 Apr 2011 09:21:15 +0000 (11:21 +0200)]
pci: Remove PATH_MAX sized stack allocations

Use virAsprintf instead of snprintf.

14 years agoRemove PATH_MAX sized stack allocations related to virFileBuildPath
Matthias Bolte [Sun, 3 Apr 2011 09:21:14 +0000 (11:21 +0200)]
Remove PATH_MAX sized stack allocations related to virFileBuildPath

Make virFileBuildPath operate on the heap instead of the stack. It
allocates a buffer instead of expecting a preexisting buffer.

14 years agovmx: Use case-insensitive compare functions for all content
Matthias Bolte [Sun, 3 Apr 2011 12:19:14 +0000 (14:19 +0200)]
vmx: Use case-insensitive compare functions for all content

14 years agovmx: Support persistent CPU shares
Matthias Bolte [Sun, 3 Apr 2011 12:43:55 +0000 (14:43 +0200)]
vmx: Support persistent CPU shares

14 years agoAdd autostart support to libxl driver
Markus Groß [Mon, 28 Mar 2011 10:49:22 +0000 (12:49 +0200)]
Add autostart support to libxl driver

The domainSetAutostart function is nearly identical to the one from qemu.

14 years agoAllow relative path for qemu backing file
Jesse Cook [Mon, 28 Mar 2011 01:30:14 +0000 (20:30 -0500)]
Allow relative path for qemu backing file

This patch enables the relative backing file path support provided by
qemu-img create.

If a relative path is specified for the backing file, it is converted
to an absolute path using the storage pool path. The absolute path is
used to verify that the backing file exists. If the backing file exists,
the relative path is allowed and will be provided to qemu-img create.

14 years agobuild: detect potentential uninitialized variables
Eric Blake [Fri, 1 Apr 2011 15:41:45 +0000 (09:41 -0600)]
build: detect potentential uninitialized variables

Even with -Wuninitialized (which is part of autobuild.sh
--enable-compile-warnings=error), gcc does NOT catch this
use of an uninitialized variable:

{
  if (cond)
    goto error;
  int a = 1;
error:
  printf("%d", a);
}

which prints 0 (supposing the stack started life wiped) if
cond was true.  Clang will catch it, but we don't use clang
as often.  Using gcc -Wjump-misses-init catches it, but also
gives false positives:

{
  if (cond)
    goto error;
  int a = 1;
  return a;
error:
  return 0;
}

Here, a was never used in the scope of the error block, so
declaring it after goto is technically fine (and clang agrees).
However, given that our HACKING already documents a preference
to C89 decl-before-statement, the false positive warning is
enough of a prod to comply with HACKING.

[Personally, I'd _really_ rather use C99 decl-after-statement
to minimize scope, but until gcc can efficiently and reliably
catch scoping and uninitialized usage bugs, I'll settle with
the compromise of enforcing a coding standard that happens to
reject false positives if it can also detect real bugs.]

* acinclude.m4 (LIBVIRT_COMPILE_WARNINGS): Add -Wjump-misses-init.
* src/util/util.c (__virExec): Adjust offenders.
* src/conf/domain_conf.c (virDomainTimerDefParseXML): Likewise.
* src/remote/remote_driver.c (doRemoteOpen): Likewise.
* src/phyp/phyp_driver.c (phypGetLparNAME, phypGetLparProfile)
(phypGetVIOSFreeSCSIAdapter, phypVolumeGetKey)
(phypGetStoragePoolDevice)
(phypVolumeGetPhysicalVolumeByStoragePool)
(phypVolumeGetPath): Likewise.
* src/vbox/vbox_tmpl.c (vboxNetworkUndefineDestroy)
(vboxNetworkCreate, vboxNetworkDumpXML)
(vboxNetworkDefineCreateXML): Likewise.
* src/xenapi/xenapi_driver.c (getCapsObject)
(xenapiDomainDumpXML): Likewise.
* src/xenapi/xenapi_utils.c (createVMRecordFromXml): Likewise.
* src/security/security_selinux.c (SELinuxGenNewContext):
Likewise.
* src/qemu/qemu_command.c (qemuBuildCommandLine): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainChangeEjectableMedia):
Likewise.
* src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Likewise.
* src/qemu/qemu_monitor_text.c (qemuMonitorTextGetPtyPaths):
Likewise.
* src/qemu/qemu_driver.c (qemudDomainShutdown)
(qemudDomainBlockStats, qemudDomainMemoryPeek): Likewise.
* src/storage/storage_backend_iscsi.c
(virStorageBackendCreateIfaceIQN): Likewise.
* src/node_device/node_device_udev.c (udevProcessPCI): Likewise.

14 years agoRelease of libvirt-0.9.0
Daniel Veillard [Mon, 4 Apr 2011 12:15:45 +0000 (20:15 +0800)]
Release of libvirt-0.9.0

* configure.ac docs/news.html.in libvirt.spec.in: update for the release
* po/*.po*: update polish translation and regenerate

14 years agofix memory leak in qemuProcessHandleGraphics()
Wen Congyang [Wed, 30 Mar 2011 07:46:41 +0000 (15:46 +0800)]
fix memory leak in qemuProcessHandleGraphics()

If strdup("x509dname") or strdup("saslUsername") success, but
strdup(x509dname) or strdup(saslUsername) failed, subject->nidentity
is not the num elements of subject->identities, and we will leak some
memory.

14 years agodo not lock vm while allocating memory
Wen Congyang [Wed, 30 Mar 2011 07:46:33 +0000 (15:46 +0800)]
do not lock vm while allocating memory

There is no need to lock vm while allocating memory. If allocating
memory failed, we forgot to unlock vm.

14 years agodocs: fix typo
Eric Blake [Fri, 1 Apr 2011 22:18:18 +0000 (16:18 -0600)]
docs: fix typo

* docs/formatdomain.html.in: Fix KVM name.