]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
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.

14 years agodocs: correct invalid xml
Eric Blake [Fri, 1 Apr 2011 22:02:10 +0000 (16:02 -0600)]
docs: correct invalid xml

* docs/internals.html.in: Fix xml errors.
* docs/formatstorageencryption.html.in: Likewise.
* docs/drvesx.html.in: Likewise.
* docs/archnetwork.html.in: Likewise.
* docs/logging.html.in: Likewise.
* docs/drvvmware.html.in: Likewise.
* docs/api.html.in: Likewise.
* docs/formatnwfilter.html.in: Likewise.
* docs/formatdomain.html.in: Likewise.
* docs/windows.html.in: Likewise.

14 years agovirsh: fix mingw failure on creating nonblocking pipe
Eric Blake [Thu, 31 Mar 2011 22:00:20 +0000 (16:00 -0600)]
virsh: fix mingw failure on creating nonblocking pipe

* .gnulib: Update to latest, for nonblocking module.
* bootstrap.conf (gnulib_modules): Add nonblocking.
* src/util/util.c (virSetBlocking): Defer to gnulib.

14 years agoFix libxl driver startup
Daniel Veillard [Fri, 1 Apr 2011 11:30:53 +0000 (19:30 +0800)]
Fix libxl driver startup

  When you happen to have a libvirtd binary compiled with the
libxenlight driver (say you have installed xen-4.1 libraries)
but not running a xen enabled system, then libvirtd fails to start.

The cause is that libxlStartup() returns -1 when failing to initialize
the library, and this propagates to virStateInitialize() which consider
this a failure. We should only exit libxlStartup with an error code
if something like an allocation error occurs, not if the driver failed
to initialize.

* src/libxl/libxl_driver.c: fix libxlStartup() to not return -1
  when failing to initialize the libxenlight library

14 years agovirsh: Fix documentation for memtune command
Jiri Denemark [Thu, 31 Mar 2011 09:48:17 +0000 (11:48 +0200)]
virsh: Fix documentation for memtune command

Commit 78ba748ef14c520ff1c4af2b5b0a44586ac49c8c claims to fix
documentation for swap_hard_limit virsh memtune option but it only fixes
documentation in formatdomain.html and libvirt.h. This patch completes
the task by fixing "virsh help memtune" output and memtune section of
virsh man page.

14 years agoMake check_fc_host() and check_vport_capable() usable as rvalues
Guido Günther [Thu, 31 Mar 2011 20:40:34 +0000 (22:40 +0200)]
Make check_fc_host() and check_vport_capable() usable as rvalues

as needed on non linux ports using HAL.

14 years agoqemu: Ignore libvirt debug messages in qemu log
Jiri Denemark [Wed, 30 Mar 2011 11:57:27 +0000 (13:57 +0200)]
qemu: Ignore libvirt debug messages in qemu log

qemu driver uses a 4K buffer for reading qemu log file. This is enough
when only qemu's output is present in the log file. However, when
debugging messages are turned on, intermediate libvirt process fills the
log with a bunch of debugging messages before it executes qemu binary.
In such a case the buffer may become too small. However, we are not
really interested in libvirt messages so they can be filtered out from
the buffer.

14 years agoqemu: Fix improper logic of qemuCgroupSetup
Osier Yang [Fri, 1 Apr 2011 03:41:33 +0000 (11:41 +0800)]
qemu: Fix improper logic of qemuCgroupSetup

It throws errors as long as the cgroup controller is not available,
regardless of whether we really want to use it to do setup or not,
which is not what we want, fixing it with throwing error when need
to use the controller.

And change "VIR_WARN" to "qemuReportError" for memory controller
incidentally.

14 years agofree tmp after unlinking it
Wen Congyang [Thu, 31 Mar 2011 03:28:21 +0000 (11:28 +0800)]
free tmp after unlinking it

We create a temporary file to save memory, and we will remove it after reading
memory to buffer. But we free the variable that contains the temporary filename
before we remove it. So we should free tmp after unlinking it.

14 years agoFix several formatting mistakes in doc
Michal Privoznik [Thu, 31 Mar 2011 11:14:03 +0000 (13:14 +0200)]
Fix several formatting mistakes in doc

14 years agoRemove iohelper on Win32 since it is not required
Daniel P. Berrange [Thu, 31 Mar 2011 16:41:51 +0000 (17:41 +0100)]
Remove iohelper on Win32 since it is not required

The iohelper binary is not required on Win32, although it compiles
without trouble. Simply remove it from the RPM.

* mingw32-libvirt.spec.in: Remove iohelper

14 years agoFix domain events C example on Win32
Daniel P. Berrange [Tue, 29 Mar 2011 10:26:55 +0000 (11:26 +0100)]
Fix domain events C example on Win32

printf on Win32 does not necessarily support %lld and we don't
have GNULIBs wrapper for printf(). Switch to use asprintf() for
which we do have a gnulib wrapper with %lld support

* examples/domain-events/events-c/event-test.c: Fix formatting
  of %lld on Win32
* cfg.mk: Don't require use of virAsprintf since this is an
  example app for out of tree users to follow

14 years agomaint: avoid locale-sensitivity in string case comparisons
Eric Blake [Thu, 31 Mar 2011 02:26:27 +0000 (20:26 -0600)]
maint: avoid locale-sensitivity in string case comparisons

strcase{cmp/str} have the drawback of being sensitive to the global
locale; this is unacceptable in a library setting.  Prefer a
hard-coded C locale alternative for all but virsh, which is user
facing and where the global locale isn't changing externally.

* .gnulib: Update to latest, for c-strcasestr change.
* bootstrap.conf (gnulib_modules): Drop strcasestr, add c-strcase
and c-strcasestr.
* cfg.mk (sc_avoid_strcase): New rule.
(exclude_file_name_regexp--sc_avoid_strcase): New exception.
* src/internal.h (STRCASEEQ, STRCASENEQ, STRCASEEQLEN)
(STRCASENEQLEN): Adjust offenders.
* src/qemu/qemu_monitor_text.c (qemuMonitorTextEjectMedia):
Likewise.
* tools/virsh.c (namesorter): Document exception.

14 years agodocs: mention C89 syntax preferences
Eric Blake [Wed, 30 Mar 2011 15:48:51 +0000 (09:48 -0600)]
docs: mention C89 syntax preferences

* docs/hacking.html.in (Code formatting): Document that // comment
and declaration-after-statement are discouraged.
* HACKING: Regenerate.

14 years agoqemu: Fix media eject with qemu-0.12.*
Jiri Denemark [Mon, 28 Mar 2011 19:34:08 +0000 (21:34 +0200)]
qemu: Fix media eject with qemu-0.12.*

In qemu-0.12.* "device '...' is locked" message was changed to "Device
..." so libvirt was no longer detecting this as an error.

14 years agoThe next release is 0.9.0 not 0.8.9
Daniel Veillard [Wed, 30 Mar 2011 13:30:54 +0000 (21:30 +0800)]
The next release is 0.9.0 not 0.8.9

Fix this which went into documentation

14 years agocheck whether qemuMonitorJSONHMP() failed
Wen Congyang [Wed, 30 Mar 2011 01:48:29 +0000 (09:48 +0800)]
check whether qemuMonitorJSONHMP() failed

If qemu quited unexpectedly when we call qemuMonitorJSONHMP(),
libvirt will crash.
Steps to reproduce this bug:
1. use gdb to attach libvirtd, and set a breakpoint in the function
   qemuMonitorSetCapabilities()
2. start a vm
3. let the libvirtd to run until qemuMonitorJSONSetCapabilities() returns.
4. kill the qemu process
5. continue running libvirtd

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
14 years agodo not send monitor command after monitor meet error
Wen Congyang [Wed, 30 Mar 2011 01:43:25 +0000 (09:43 +0800)]
do not send monitor command after monitor meet error

If the monitor met a error, and we will call qemuProcessHandleMonitorEOF().
But we may try to send monitor command after qemuProcessHandleMonitorEOF()
returned. Then libvirtd will be blocked in qemuMonitorSend().

Steps to reproduce this bug:
1. use gdb to attach libvirtd, and set a breakpoint in the function
   qemuConnectMonitor()
2. start a vm
3. let the libvirtd to run until qemuMonitorOpen() returns.
4. kill the qemu process
5. continue running libvirtd

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
14 years agoqemu: unlock qemu driver before return from domain save
Hu Tao [Wed, 30 Mar 2011 02:34:16 +0000 (10:34 +0800)]
qemu: unlock qemu driver before return from domain save

qemuDriverUnlock() wasn't called on 2 exit paths
* src/qemu/qemu_driver.c: fix qemudDomainSave() to always unlock
  the driver before exiting on error

14 years agoextend logging to record configuration-related changes
Naoya Horiguchi [Wed, 30 Mar 2011 01:19:47 +0000 (09:19 +0800)]
extend logging to record configuration-related changes

Currently libvirt's default logging is limited and it is difficult to
determine what was happening when a proglem occurred (especially on a
machines where one don't know the detail.)  This patch helps to do that
by making additional logging available for the following events:

  creating/defining/undefining domains
  creating/defining/undefining/starting/stopping networks
  creating/defining/undefining/starting/stopping storage pools
  creating/defining/undefining/starting/stopping storage volumes.

* AUTHORS: add Naoya Horiguchi
* src/network/bridge_driver.c src/qemu/qemu_driver.c
  src/storage/storage_driver.c: provide more VIR_INFO logging

14 years agoAdd libvirt_iohelper to spec file
Daniel Veillard [Wed, 30 Mar 2011 00:54:23 +0000 (08:54 +0800)]
Add libvirt_iohelper to spec file

The new iohelper binary was missing from the packaging spec

14 years agocputune: New tests for cputune XML
Osier Yang [Tue, 29 Mar 2011 13:44:14 +0000 (21:44 +0800)]
cputune: New tests for cputune XML

v1 - v2:
  * Add missed tests/qemuxml2argvdata/qemuxml2argv-cputune.args

14 years agocputune: Support cputune for xend driver
Osier Yang [Tue, 29 Mar 2011 13:43:41 +0000 (21:43 +0800)]
cputune: Support cputune for xend driver

Not sure if it's the correct way to add cputune xml for xend driver,
and besides, seems "xm driver" and "xen hypervisor" also support
vcpu affinity, do we need to add support for them too?

14 years agocputune: Support cputune for lxc driver
Osier Yang [Tue, 29 Mar 2011 13:42:54 +0000 (21:42 +0800)]
cputune: Support cputune for lxc driver

LXC driver doesn't support vcpu affinity yet, so just need
to modify it to support cpu shares.

14 years agocputune: Support cputune for qemu driver
Osier Yang [Tue, 29 Mar 2011 13:41:25 +0000 (21:41 +0800)]
cputune: Support cputune for qemu driver

When domain startup, setting cpu affinity and cpu shares according
to the cputune xml specified in domain xml.

Modify "qemudDomainPinVcpu" to update domain config for vcpupin,
and modify "qemuSetSchedulerParameters" to update domain config
for cpu shares.

v1 - v2:
   * Use "VIR_ALLOC_N" instead of "VIR_ALLOC_VAR"
   * But keep raising error when it fails on adding vcpupin xml
     entry, as I still don't have a better idea yet.

14 years agocputune: Implementations of parsing and formating cputune xml
Osier Yang [Tue, 29 Mar 2011 13:34:18 +0000 (21:34 +0800)]
cputune: Implementations of parsing and formating cputune xml

Implementations of following functions:
  virDomainVcpupinIsDuplicate
  virDomainVcpupinFindByVcpu
  virDomainVcpupinAdd

Update "virDomainDefParseXML" to parse, and "virDomainDefFormatXML"
to build cputune xml, also implementations of new internal helper
functions.

v1 - v2:
  * Resolve potential crash bug of "virDomainVcpupinAdd"

14 years agocputune: Add data structures presenting cputune XML
Osier Yang [Tue, 29 Mar 2011 13:33:36 +0000 (21:33 +0800)]
cputune: Add data structures presenting cputune XML

Also related new functions' declaration, and expose the new introduced
functions in libvirt_private.syms.

v1 - v2:
  Don't expose "virAllocVar" in libvirt_private.syms

14 years agocputune: Add document for cputune XML
Osier Yang [Tue, 29 Mar 2011 13:04:21 +0000 (21:04 +0800)]
cputune: Add document for cputune XML

v1 - v3:
  * More clear document for "cpu shares", adopted suggestions from
    Matthias Bottle and Daniel Veillard.

14 years agocputune: Add XML schema for cputune xml
Osier Yang [Tue, 29 Mar 2011 13:01:57 +0000 (21:01 +0800)]
cputune: Add XML schema for cputune xml

v1 - v2:
  * Remove upper limit of cpu shares. (Suggested by Matthias Bottle)

14 years agoqemu: fix regression with fd labeling on migration
Eric Blake [Mon, 28 Mar 2011 21:50:22 +0000 (15:50 -0600)]
qemu: fix regression with fd labeling on migration

My earlier testing for commit 34fa0de0 was done while starting
just-built libvirt from an unconfined_t shell, where the fds happened
to work when transferring to qemu.  But when installed and run under
virtd_t, failure to label the raw file (with no compression) or the
pipe (with compression) triggers SELinux failures when passing fds
over SCM_RIGHTS to svirt_t qemu.

* src/qemu/qemu_migration.c (qemuMigrationToFile): When passing
FDs, make sure they are labeled.

14 years agoqemu: improve error message on failed fd transfer
Eric Blake [Mon, 28 Mar 2011 21:14:15 +0000 (15:14 -0600)]
qemu: improve error message on failed fd transfer

First fallout of fd: migration - it looks like SELinux enforcing
_does_ require fd labeling (running uninstalled libvirtd from an
unconstrained shell had no problems, but once faked out by doing
 chcon `stat -c %C /usr/sbin/libvirtd` daemon/libvirtd
 run_init $PWD/daemon/libvirtd
to run it with the same context as an init script service, and with
SELinux enforcing, I got a rather confusing failure:
error: Failed to save domain fedora_12 to fed12.img
error: internal error unable to send TAP file handle: No file descriptor supplied via SCM_RIGHTS

This fixes the error message, then I need to figure out a subsequent
patch that does the fsetfilecon() necessary to keep things happy.
It also appears that libvirtd hangs on a failed fd transfer; I don't
know if that needs an independent fix.

* src/qemu/qemu_monitor_text.c (qemuMonitorTextSendFileHandle):
Improve message, since TAP is no longer only client.

14 years agomaint: ignore new built file
Eric Blake [Tue, 29 Mar 2011 13:05:12 +0000 (07:05 -0600)]
maint: ignore new built file

* .gitignore: Exclude libvirt_iohelper.

14 years agoAdd domainSuspend/Resume to libxl driver
Markus Groß [Tue, 29 Mar 2011 12:55:38 +0000 (20:55 +0800)]
Add domainSuspend/Resume to libxl driver

* src/libxl/libxl_driver.c: implements libxlDomainSuspend and
  libxlDomainResume

14 years agoAdd domainGetOSType to libxl driver
Markus Groß [Tue, 29 Mar 2011 12:49:43 +0000 (20:49 +0800)]
Add domainGetOSType to libxl driver

* src/libxl/libxl_driver.c: implements libxlDomainGetOSType

14 years agoAdd domainGetSchedulerType to libxl driver
Markus Groß [Tue, 29 Mar 2011 12:46:55 +0000 (20:46 +0800)]
Add domainGetSchedulerType to libxl driver

* src/libxl/libxl_driver.c: implements libxlDomainGetSchedulerType

14 years agoImplements domainXMLTo/FromNative in libxl driver
Markus Groß [Tue, 29 Mar 2011 12:39:18 +0000 (20:39 +0800)]
Implements domainXMLTo/FromNative in libxl driver

* src/Makefile.am src/libvirt_private.syms configure.ac: share and
  reuse the sexpr routines from sexpr.h of the old xen driver
* src/libxl/libxl_driver.c: implements libxlDomainXMLFromNative and
  libxlDomainXMLToNative

14 years agoAdd vcpu functions to libxl driver
Markus Groß [Tue, 29 Mar 2011 12:31:45 +0000 (20:31 +0800)]
Add vcpu functions to libxl driver

Hook the virtual cpu functions to their libxenlight counterparts

* src/libxl/libxl_driver.c: implements libxlDomainSetVcpus,
  libxlDomainGetVcpus, libxlDomainSetVcpusFlags,
  libxlDomainGetVcpusFlags and libxlDomainPinVcpu

14 years agoList authors in copyright headers
Markus Groß [Tue, 29 Mar 2011 12:24:05 +0000 (20:24 +0800)]
List authors in copyright headers

* src/libxl/libxl_conf.[ch] src/libxl/libxl_driver.[ch]: add authors
  after the licence template

14 years agoAdd event callbacks to libxl driver
Markus Groß [Tue, 29 Mar 2011 12:18:24 +0000 (20:18 +0800)]
Add event callbacks to libxl driver

* src/libxl/libxl_conf.h: add the necessary fields to the driver
  private structure
* src/libxl/libxl_driver.c: add lifecycle event support and entry
  points for event(de)register(any)