]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
14 years agotests: handle backspace-newline pairs in test input files
Juerg Haefliger [Mon, 31 Jan 2011 11:42:57 +0000 (06:42 -0500)]
tests: handle backspace-newline pairs in test input files

This patch teaches testutil how to read multi-line input files with
backspace-newline line continuation markers.

The patch also breaks up all the single-line arguments test input files into
multi-line files with lines shorter than 80 characters.

14 years agoqemu: More clear error parsing domain def failure of tunneled migration
Osier Yang [Mon, 31 Jan 2011 09:12:46 +0000 (17:12 +0800)]
qemu: More clear error parsing domain def failure of tunneled migration

* src/qemu/qemu_driver.c

14 years agoInitialization error of controller in QEmu SCSI hotplug
Wen Congyang [Mon, 31 Jan 2011 07:55:40 +0000 (15:55 +0800)]
Initialization error of controller in QEmu SCSI hotplug

Bug manifests itself by:

1. # virsh attach-disk --target sdb ...
2. # virsh attach-disk --target sdh ...
   error: Failed to attach disk
   error: operation failed: target scsi:0 already exists

sdh uses scsi:1, rather than scsi:0.

* src/qemu/qemu_hotplug.c: properly set controller idx in
  qemuDomainFindOrCreateSCSIDiskController()

14 years agoOsier get commit rights
Daniel Veillard [Mon, 31 Jan 2011 01:31:33 +0000 (09:31 +0800)]
Osier get commit rights

14 years agomaint: reject raw close, popen in 'make syntax-check'
Eric Blake [Thu, 27 Jan 2011 22:16:14 +0000 (15:16 -0700)]
maint: reject raw close, popen in 'make syntax-check'

commit f1fe9671e was supposed to make sure we use files.h
macros to avoid double close, but it didn't work.

Meanwhile, virCommand is vastly superior to system(), fork(),
and popen() (also to virExec, but we haven't completed that
conversion), so enforce that, too.

* cfg.mk (sc_prohibit_close): Fix typo that excluded close, and
add pclose.
(sc_prohibit_fork_wrappers): New rule, for fork, system, and popen.
* .x-sc_prohibit_close: More exemptions.
* .x-sc_prohibit_fork_wrappers: New file.
* Makefile.am (syntax_check_exceptions): Ship new file.
* src/datatypes.c (virReleaseConnect): Tweak comment to avoid
false positive.
* src/util/files.h (VIR_CLOSE): Likewise.

14 years agobuild: avoid close, system
Eric Blake [Fri, 28 Jan 2011 21:22:39 +0000 (14:22 -0700)]
build: avoid close, system

* src/fdstream.c (virFDStreamOpenFile, virFDStreamCreateFile):
Use VIR_FORCE_CLOSE instead of close.
* tests/commandtest.c (mymain): Likewise.
* tools/virsh.c (editFile): Use virCommand instead of system.
* src/util/util.c (__virExec): Special case preservation of std
file descriptors to child.

14 years agoPrefer C style comments over C++ ones
Matthias Bolte [Fri, 28 Jan 2011 21:38:06 +0000 (22:38 +0100)]
Prefer C style comments over C++ ones

Pure cosmetic change.

14 years agoesx: Ensure max-memory has 4 megabyte granularity
Matthias Bolte [Fri, 28 Jan 2011 20:19:59 +0000 (21:19 +0100)]
esx: Ensure max-memory has 4 megabyte granularity

14 years agoAdd VIR_DIV_UP to divide memory or storage request sizes with round up
Matthias Bolte [Fri, 28 Jan 2011 21:03:24 +0000 (22:03 +0100)]
Add VIR_DIV_UP to divide memory or storage request sizes with round up

Use it in all places where a memory or storage request size is converted
to a larger granularity. This avoids requesting too small memory or storage
sizes that could result from the truncation done by a simple division.

This extends the round up fix in 6002e0406c338668ea0ecbfeb6c1ef20a8b67efe
to the whole codebase.

Instead of reporting errors for odd values in the VMX code round them up.

Update the QEMU Argv tests accordingly as the original memory size 219200
isn't a even multiple of 1024 and is rounded up to 215 megabyte now. Change
it to 219100 and 219136. Use two different values intentionally to make
sure that rounding up works.

Update virsh.pod accordingly, as rounding down and rejecting are replaced
by rounding up.

14 years agoqemu: fix augeas support for vnc_auto_unix_socket
Eric Blake [Fri, 28 Jan 2011 20:52:20 +0000 (13:52 -0700)]
qemu: fix augeas support for vnc_auto_unix_socket

Fixes test failure that was overlooked after commit 1e1f7a8950.

* daemon/Makefile.am (check-local): Let 'make check' fail on error.
* daemon/test_libvirtd.aug: Move qemu-specific option...
* src/qemu/test_libvirtd_qemu.aug: ...into correct test.
* src/qemu/libvirtd_qemu.aug: Parse new option.

14 years agovirsh: added --all flag to freecell command
Michal Privoznik [Fri, 28 Jan 2011 18:21:57 +0000 (19:21 +0100)]
virsh: added --all flag to freecell command

This will iterate over all NUMA nodes, showing
free memory for each and sum at the end.
Existing default behavior is not changed.

14 years agoesx: Don't try to change max-memory of an active domain
Matthias Bolte [Thu, 27 Jan 2011 21:01:43 +0000 (22:01 +0100)]
esx: Don't try to change max-memory of an active domain

Report an VIR_ERR_OPERATION_INVALID error in that case instead of letting
the SOAP call fail with an VIR_ERR_INTERNAL_ERROR error.

14 years agoqemu aio: enable support
Eric Blake [Wed, 21 Apr 2010 14:28:21 +0000 (16:28 +0200)]
qemu aio: enable support

qemu allows the user to choose what io storage api should be used,
either the default (threads) or native (linux aio) which in the latter
case can result in better performance.

Based on a patch originally by Matthias Dahl.

Red Hat Bugzilla #591703
Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agoqemu aio: parse aio support from qemu -help
Matthias Dahl [Wed, 21 Apr 2010 14:28:21 +0000 (16:28 +0200)]
qemu aio: parse aio support from qemu -help

Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agoqemu aio: add XML parsing
Matthias Dahl [Wed, 21 Apr 2010 14:28:21 +0000 (16:28 +0200)]
qemu aio: add XML parsing

Allows io={threads|native} as an optional attribute to <driver>.

Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agodocs: replace CRLF with LF
Juerg Haefliger [Fri, 28 Jan 2011 12:52:18 +0000 (13:52 +0100)]
docs: replace CRLF with LF

14 years agoRemove bogus log warning lines when launching QEMU
Daniel P. Berrange [Thu, 27 Jan 2011 18:39:53 +0000 (18:39 +0000)]
Remove bogus log warning lines when launching QEMU

The refactoring of QEMU command startup was comitted with
a couple of VIR_WARN lines left in from debugging.

* src/qemu/qemu_driver.c: Remove log warning lines

14 years agoRemove double close of qemu monitor
Daniel P. Berrange [Thu, 27 Jan 2011 18:28:15 +0000 (18:28 +0000)]
Remove double close of qemu monitor

When qemuMonitorSetCapabilities() fails, there is no need to
call qemuMonitorClose(), because the caller will already see
the error code and tear down the entire VM. The extra call to
qemuMonitorClose resulted in a double-free due to it removing
a ref count prematurely.

* src/qemu/qemu_driver.c: Remove premature close of monitor

14 years agoPrevent overfilling of self-pipe in python event loop
Daniel P. Berrange [Thu, 27 Jan 2011 12:54:27 +0000 (12:54 +0000)]
Prevent overfilling of self-pipe in python event loop

If the event loop takes a very long time todo something, it is
possible for the 'self pipe' buffer to become full at which
point the entire event loop + remote driver deadlock. Use a
boolean flag to ensure we have strict one-in, one-out behaviour
on writes/reads of the 'self pipe'

14 years agodocs: Add docs for new extra parameter pkipath
Osier Yang [Thu, 27 Jan 2011 14:08:25 +0000 (22:08 +0800)]
docs: Add docs for new extra parameter pkipath

* docs/remote.html.in

14 years agoqemu: fix error messages
Eric Blake [Fri, 28 Jan 2011 03:39:44 +0000 (20:39 -0700)]
qemu: fix error messages

Regression in commit caa805ea let a lot of bad messages slip in.

* cfg.mk (msg_gen_function): Fix function name.
* src/qemu/qemu_cgroup.c (qemuRemoveCgroup): Fix fallout from
'make syntax-check'.
* src/qemu/qemu_driver.c (qemudDomainGetInfo)
(qemuDomainWaitForMigrationComplete, qemudStartVMDaemon)
(qemudDomainSaveFlag, qemudDomainAttachDevice)
(qemuDomainUpdateDeviceFlags): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachHostUsbDevice)
(qemuDomainDetachPciDiskDevice, qemuDomainDetachSCSIDiskDevice):
Likewise.

14 years agoqemu: Report more accurate error on failure to attach device.
Hu Tao [Thu, 27 Jan 2011 07:21:42 +0000 (15:21 +0800)]
qemu: Report more accurate error on failure to attach device.

When attaching device from a xml file and the device is mis-configured,
virsh gives mis-leading message "out of memory". This patch fixes this.

Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agoForce guest suspend at timeout
Wen Congyang [Tue, 25 Jan 2011 10:14:45 +0000 (18:14 +0800)]
Force guest suspend at timeout

If the memory of guest OS is changed constantly, the live migration
can not be ended ever for ever.

We can use the command 'virsh migrate-setmaxdowntime' to control the
live migration. But the value of maxdowntime is diffcult to calculate
because it depends on the transfer speed of network and constantly
changing memroy size. We need a easy way to control the live migration.

This patch adds the support of forcing guest to suspend at timeout.
With this patch, when we migrate the guest OS, we can specify a
timeout. If the live migration timeouts, auto-suspend the guest OS,
where the migration will complete offline.

14 years agoShow migration progress.
Wen Congyang [Tue, 25 Jan 2011 10:33:06 +0000 (18:33 +0800)]
Show migration progress.

Show migration progress if `migrate --verbose'.

14 years agoCancel migration if user presses Ctrl-C when migration is in progress
Hu Tao [Tue, 25 Jan 2011 10:14:28 +0000 (18:14 +0800)]
Cancel migration if user presses Ctrl-C when migration is in progress

While migration is in progress and virsh is waiting for its
completion, user may want to terminate the progress by pressing
Ctrl-C. But virsh just exits on user's Ctrl-C leaving migration
in background that user isn't even aware of. It's not reasonable.

This patch changes the behaviour for migration. For other
commands Ctrl-C still terminates virsh itself.

14 years agoqemu: use separate alias for chardev and associated device
Eric Blake [Tue, 25 Jan 2011 21:59:50 +0000 (14:59 -0700)]
qemu: use separate alias for chardev and associated device

* src/qemu/qemu_command.c (qemuBuildChrChardevStr): Alter the
chardev alias.
(qemuBuildCommandLine): Output an id for the chardev counterpart.
* tests/qemuxml2argvdata/*: Update tests to match.
Reported by Daniel P. Berrange.

14 years agoavoid vm to be deleted if qemuConnectMonitor failed
Wen Congyang [Tue, 25 Jan 2011 06:43:43 +0000 (14:43 +0800)]
avoid vm to be deleted if qemuConnectMonitor failed

Steps to reproduce this bug:
1. service libvirtd start
2. virsh start <domain>
3. kill -STOP $(cat /var/run/libvirt/qemu/<domain>.pid)
4. service libvirtd restart
5. kill -9 $(cat /var/run/libvirt/qemu/<domain>.pid)

Then libvirtd will core dump or be in deadlock state.

Make sure that json is built into libvirt and the version
of qemu is newer than 0.13.0.

The reason of libvirtd cores dump is that:
We add vm->refs when we alloc the memory, and decrease it
in the function qemuHandleMonitorEOF() in other thread.

We add vm->refs in the function qemuConnectMonitor() and
decrease it when the vm is inactive.

The libvirtd will block in the function qemuMonitorSetCapabilities()
because the vm is stopped by signal SIGSTOP. Now the vm->refs is 2.

Then we kill the vm by signal SIGKILL. The function
qemuMonitorSetCapabilities() failed, and then we will decrease vm->refs
in the function qemuMonitorClose().
In another thread, mon->fd is broken and the function
qemuHandleMonitorEOF() is called.

If qemuHandleMonitorEOF() decreases vm->refs before qemuConnectMonitor()
returns, vm->refs will be decrease to 0 and the memory is freed.

We will call qemudShutdownVMDaemon() as qemuConnectMonitor() failed.
The memory has been freed, so qemudShutdownVMDaemon() is too dangerous.

We will reference NULL pointer in the function virDomainConfVMNWFilterTeardown():
=============
void
virDomainConfVMNWFilterTeardown(virDomainObjPtr vm) {
    int i;

    if (nwfilterDriver != NULL) {
        for (i = 0; i < vm->def->nnets; i++)
            virDomainConfNWFilterTeardown(vm->def->nets[i]);
    }
}
============
vm->def->nnets is not 0 but vm->def->nets is NULL(We don't set vm->def->nnets
to 0 when we free vm).

We should add an extra reference of vm to avoid vm to be deleted if
qemuConnectMonitor() failed.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
14 years agotests: Fix virtio channel tests
Jiri Denemark [Thu, 27 Jan 2011 18:00:36 +0000 (19:00 +0100)]
tests: Fix virtio channel tests

As noticed by Eric, commit 8e28c5d40200b4c5d483bd585d237b9d870372e5,
which fixed generation of virtio-serial port numbers, forgot to adjust
test files which resulted in make check failure.

14 years agodocs: expand the man page text for virsh setmaxmem
Justin Clift [Thu, 27 Jan 2011 16:29:26 +0000 (03:29 +1100)]
docs: expand the man page text for virsh setmaxmem

Addresses BZ # 622534:

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

14 years agoevent: fix event-handling allocation crash
Eric Blake [Fri, 21 Jan 2011 19:57:03 +0000 (12:57 -0700)]
event: fix event-handling allocation crash

Regression introduced in commit e6b68d7 (Nov 2010).

Prior to that point, handlesAlloc was always a multiple of
EVENT_ALLOC_EXTENT (10), and was an int (so even if the subtraction
had been able to wrap, a negative value would be less than the count
not try to free the handles array).  But after that point,
VIR_RESIZE_N made handlesAlloc grow geometrically (with a pattern of
10, 20, 30, 45 for the handles array) but still freed in multiples of
EVENT_ALLOC_EXTENT; and the count changed to size_t.  Which means that
after 31 handles have been created, then 30 handles destroyed,
handlesAlloc is 5 while handlesCount is 1, and since (size_t)(1 - 5)
is indeed greater than 1, this then tried to free 10 elements, which
had the awful effect of nuking the handles array while there were
still live handles.

Nuking live handles puts libvirtd in an inconsistent state, and was
easily reproducible by starting and then stopping 60 faqemu guests.

* daemon/event.c (virEventCleanupTimeouts, virEventCleanupHandles):
Avoid integer wrap-around causing us to delete the entire array
while entries are still active.
* tests/eventtest.c (mymain): Expose the bug.

14 years agodocs: fix incorrect XML element mentioned by setmem text
Justin Clift [Thu, 27 Jan 2011 11:57:18 +0000 (22:57 +1100)]
docs: fix incorrect XML element mentioned by setmem text

14 years agoremote: Add extra parameter pkipath for URI
Osier Yang [Thu, 27 Jan 2011 08:34:54 +0000 (16:34 +0800)]
remote: Add extra parameter pkipath for URI

This new parameter allows user specifies where the client
cerficate, client key, CA certificate of x509 is, instead of
hardcoding it. If 'pkipath' is not specified, and the user
is not root, try to find files in $HOME/.pki/libvirt, as long
as one of client cerficate, client key, CA certificate can
not be found, use default global location (LIBVIRT_CACERT,
LIBVIRT_CLIENTCERT, LIBVIRT_CLIENTKEY, see
src/remote/remote_driver.h)

Example of use:

[root@Osier client]# virsh -c qemu+tls://10.66.93.111/system?pkipath=/tmp/pki/client
error: Cannot access CA certificate '/tmp/pki/client/cacert.pem': No such file
or directory
error: failed to connect to the hypervisor
[root@Osier client]# ls -l
total 24
-rwxrwxr-x. 1 root root 6424 Jan 24 21:35 a.out
-rw-r--r--. 1 root root 1245 Jan 23 19:04 clientcert.pem
-rw-r--r--. 1 root root  132 Jan 23 19:04 client.info
-rw-r--r--. 1 root root 1679 Jan 23 19:04 clientkey.pem

[root@Osier client]# cp /tmp/cacert.pem .
[root@Osier client]# virsh -c qemu+tls://10.66.93.111/system?pkipath=/tmp/pki/client
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
'quit' to quit

virsh #

* src/remote/remote_driver.c: adds support for the new pkipath URI parameter

14 years agostorage: Round up capacity for LVM volume creation
Osier Yang [Thu, 27 Jan 2011 08:28:19 +0000 (16:28 +0800)]
storage: Round up capacity for LVM volume creation

If vol->capacity is odd, the capacity will be rounded down
by devision, this patch is to round it up instead of rounding
down, to be safer in case of one writes to the volume with the
size he used to create.

- src/storage/storage_backend_logical.c: make sure size is not rounded down

14 years agoUpdate localization files from Fedora i10n
Daniel Veillard [Thu, 27 Jan 2011 05:33:45 +0000 (13:33 +0800)]
Update localization files from Fedora i10n

14 years agoDo not use virtio-serial port 0 for generic ports
David Allan [Mon, 24 Jan 2011 20:47:52 +0000 (15:47 -0500)]
Do not use virtio-serial port 0 for generic ports

Per the discussion in:

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

The port numbering should start from 1, not 0.  We assign maxport + 1,
so start maxport at 0.

14 years agoManually kill gzip if restore fails before starting qemu
Laine Stump [Mon, 24 Jan 2011 16:58:15 +0000 (11:58 -0500)]
Manually kill gzip if restore fails before starting qemu

If a guest image is saved in compressed format, and the restore fails
in some way after the intermediate process used to uncompress the
image has been started, but before qemu has been started to hook up to
the uncompressor, libvirt will endlessly wait for the uncompressor to
finish, but it never will because it's still waiting to have something
hooked up to drain its output.

The solution is to close the pipes on both sides of the uncompressor,
then send a SIGTERM before calling waitpid on it (only if the restore
has failed, of course).

14 years agoFix setup of lib directory with autogen.sh --system
Daniel P. Berrange [Wed, 19 Jan 2011 12:24:26 +0000 (12:24 +0000)]
Fix setup of lib directory with autogen.sh --system

On x86_64 hosts, /usr/lib64 must be used instead of /usr/lib
Rather than attempt to whitelist architectures, just check
for existance of /usr/lib64

* autogen.sh: Fix to use /usr/lib64 if it exists

14 years agoAdd check for poll error events in monitor
Daniel P. Berrange [Mon, 13 Dec 2010 16:05:41 +0000 (16:05 +0000)]
Add check for poll error events in monitor

Handle poll errors in the same way as hangup event

* src/qemu/qemu_monitor.c: Handle error events

14 years agoFilter out certain expected error messages from libvirtd
Daniel P. Berrange [Fri, 21 Jan 2011 17:25:01 +0000 (17:25 +0000)]
Filter out certain expected error messages from libvirtd

Add a hook to the error reporting APIs to allow specific
error messages to be filtered out. Wire up libvirtd to
remove VIR_ERR_NO_DOMAIN & similar error codes from the
logs. They are still logged at DEBUG level.

* daemon/libvirtd.c: Filter VIR_ERR_NO_DOMAIN and friends
* src/libvirt_private.syms, src/util/virterror.c,
  src/util/virterror_internal.h: Hook for changing error
  reporting level

14 years agoRevert all previous error log priority hacks
Daniel P. Berrange [Fri, 21 Jan 2011 16:46:16 +0000 (16:46 +0000)]
Revert all previous error log priority hacks

This reverts the additions in commit

  abff683f78ffd01df5005fb7a457c0b38b8eb6e1

taking us back to state where all errors are fully logged
in both libvirtd and normal clients.

THe intent was to stop VIR_ERR_NO_DOMAIN (No such domain
with UUID XXXX) messages from client apps polluting syslog
The change affected all error codes, but more seriously,
it also impacted errors from internal libvirtd infrastructure
For example guest autostart no longer logged errors. The
libvirtd network code no longer logged some errors. This
makes debugging incredibly hard

* daemon/libvirtd.c: Remove error log priority filter
* src/util/virterror.c, src/util/virterror_internal.h: Remove
  callback for overriding log priority

14 years agoCleanup code style in logging APIs
Daniel P. Berrange [Fri, 21 Jan 2011 16:30:17 +0000 (16:30 +0000)]
Cleanup code style in logging APIs

Remove use of brackets around following return statement.
Fix indentation of two switch statements

14 years agoSet SELinux context label of pipes used for qemu migration
Laine Stump [Sun, 23 Jan 2011 21:09:40 +0000 (16:09 -0500)]
Set SELinux context label of pipes used for qemu migration

This patch is a partial resolution to the following bug:

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

(to complete the fix, an updated selinux-policy package is required,
to add the policy that allows libvirt to set the context of a fifo,
which was previously not allowed).

Explanation : When an incoming migration is over a pipe (for example,
if the image was compressed and is being fed through gzip, or was on a
root-squash nfs server, so needed to be opened by a child process
running as a different uid), qemu cannot read it unless the selinux
context label for the pipe has been set properly.

The solution is to check the fd used as the source of the migration
just before passing it to qemu; if it's a fifo (implying that it's a
pipe), we call the newly added virSecurityManagerSetFDLabel() function
to set the context properly.

14 years agoAdd a function to the security driver API that sets the label of an open fd.
Laine Stump [Sun, 23 Jan 2011 21:02:42 +0000 (16:02 -0500)]
Add a function to the security driver API that sets the label of an open fd.

A need was found to set the SELinux context label on an open fd (a
pipe, as a matter of fact). This patch adds a function to the security
driver API that will set the label on an open fd to secdef.label. For
all drivers other than the SELinux driver, it's a NOP. For the SElinux
driver, it calls fsetfilecon().

If the return is a failure, it only returns error up to the caller if
1) the desired label is different from the existing label, 2) the
destination fd is of a type that supports setting the selinux context,
and 3) selinux is in enforcing mode. Otherwise it will return
success. This follows the pattern of the existing function
SELinuxSetFilecon().

14 years agodocs: add a link to the bindings page under the downloads menu item
Justin Clift [Wed, 26 Jan 2011 05:00:33 +0000 (16:00 +1100)]
docs: add a link to the bindings page under the downloads menu item

So people looking to download the language bindings, but don't know
they're under the "Docs" area.

14 years agovirsh: require --mac to avoid detach-interface ambiguity
Michal Privoznik [Tue, 25 Jan 2011 17:31:00 +0000 (18:31 +0100)]
virsh: require --mac to avoid detach-interface ambiguity

bugfix for https://bugzilla.redhat.com/show_bug.cgi?id=671050

virsh simply refutes to detach-interface in case when multiple
interfaces are attached and --mac is not specified.

14 years agodispatch error before return
Wen Congyang [Tue, 25 Jan 2011 09:56:39 +0000 (17:56 +0800)]
dispatch error before return

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
14 years agoqemu: Error prompt when managed save a shutoff domain
Osier Yang [Tue, 25 Jan 2011 07:49:51 +0000 (15:49 +0800)]
qemu: Error prompt when managed save a shutoff domain

The problem was introduced by commit 4303c91, which removed the checking
of domain state, this patch is to fix it.

Otherwise, improper error will be thrown, e.g.

error: Failed to save domain rhel6 state
error: cannot resolve symlink /var/lib/libvirt/qemu/save/rhel6.save: No such
file or directory

14 years agobuild: avoid corrupted gnulib/tests/Makefile
Eric Blake [Tue, 25 Jan 2011 00:14:19 +0000 (17:14 -0700)]
build: avoid corrupted gnulib/tests/Makefile

Running 'make check' can sometimes fail in the gnulib/tests
subdirectory, when doing an incremental build, because
./bootstrap generates a Makefile.am that tries to refer to
../../.. instead of ../.., and gets lost.

This may be an upstream gnulib bug, where a more elegant
solution will present itself in the future:
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/24898

But in the meantime, I was able to reproduce both the issue,
and this solution to work around it.

* bootstrap.conf (bootstrap_epilogue): Ensure that no stray
../../.. components remain in gnulib/tests/Makefile.in.
Reported by Serge Hallyn.

14 years agoqemu: sound: Support intel 'ich6' model
Cole Robinson [Thu, 13 Jan 2011 14:15:11 +0000 (09:15 -0500)]
qemu: sound: Support intel 'ich6' model

In QEMU, the card itself is a PCI device, but it requires a codec
(either -device hda-output or -device hda-duplex) to actually output
sound. Specifying <sound model='ich6'/> gives us -device intel-hda
-device hda-duplex I think it's important that a simple <sound model='ich6'/>
sets up a useful codec, to have consistent behavior with all other sound cards.

This is basically Dan's proposal of

    <sound model='ich6'>
        <codec type='output' slot='0'/>
        <codec type='duplex' slot='3'/>
    </sound>

without the codec bits implemented.

The important thing is to keep a consistent API here, we don't want some
<sound> devs require tweaking codecs but not others. Steps I see to
accomplishing this:

    - every <sound> device has a <codec type='default'/> (unless codecs are
        manually specified)
    - <codec type='none'/> is required to specify 'no codecs'
    - new audio settings like mic=on|off could then be exposed in
        <sound> or <codec> in a consistent manner for all sound models

v2:
    Use model='ich6'

v3:
    Use feature detection, from eblake
    Set codec id, bus, and cad values

v4:
    intel-hda isn't supported if -device isn't available

v5:
    Comment spelling fixes

14 years agovmx: Use VIR_ERR_CONFIG_UNSUPPORTED when appropriated
Matthias Bolte [Fri, 21 Jan 2011 08:15:43 +0000 (09:15 +0100)]
vmx: Use VIR_ERR_CONFIG_UNSUPPORTED when appropriated

14 years agoevent: fix event-handling data race
Eric Blake [Fri, 21 Jan 2011 19:57:03 +0000 (12:57 -0700)]
event: fix event-handling data race

This bug has been present since before the time that commit
f8a519 (Dec 2008) tried to make the dispatch loop re-entrant.

Dereferencing eventLoop.handles outside the lock risks crashing, since
any other thread could have reallocated the array in the meantime.
It's a narrow race window, however, and one that would have most
likely resulted in passing bogus data to the callback rather than
actually causing a segv, which is probably why it has gone undetected
this long.

* daemon/event.c (virEventDispatchHandles): Cache data while
inside the lock, as the array might be reallocated once outside.

14 years agobuild: fix 'make check' with older git
Eric Blake [Fri, 21 Jan 2011 22:40:46 +0000 (15:40 -0700)]
build: fix 'make check' with older git

* .gnulib: Update to latest, for maintainer-makefile fix.
Reported by Matthias Bolte.

14 years agoPush unapplied fixups for previous patch
Cole Robinson [Fri, 21 Jan 2011 21:18:54 +0000 (16:18 -0500)]
Push unapplied fixups for previous patch

- Add augeas tests
- Clarify vnc_auto_unix_socket precedence in qemu.conf

14 years agoqemu: Add conf option to auto setup VNC unix sockets
Cole Robinson [Wed, 12 Jan 2011 04:44:11 +0000 (23:44 -0500)]
qemu: Add conf option to auto setup VNC unix sockets

If vnc_auto_unix_socket is enabled, any VNC devices without a hardcoded
listen or socket value will be setup to serve over a unix socket in
/var/lib/libvirt/qemu/$vmname.vnc.

We store the generated socket path in the transient VM definition at
CLI build time.

14 years agoqemu: Allow serving VNC over a unix domain socket
Cole Robinson [Fri, 7 Jan 2011 21:03:07 +0000 (16:03 -0500)]
qemu: Allow serving VNC over a unix domain socket

QEMU supports serving VNC over a unix domain socket rather than traditional
TCP host/port. This is specified with:

<graphics type='vnc' socket='/foo/bar/baz'/>

This provides better security access control than VNC listening on
127.0.0.1, but will cause issues with tools that rely on the lax security
(virt-manager in fedora runs as regular user by default, and wouldn't be
able to access a socket owned by 'qemu' or 'root').

Also not currently supported by any clients, though I have patches for
virt-manager, and virt-viewer should be simple to update.

v2:
    schema: Make listen vs. socket a <choice>

14 years agoqemu: Set domain def transient at beginning of startup process
Cole Robinson [Wed, 12 Jan 2011 06:04:33 +0000 (01:04 -0500)]
qemu: Set domain def transient at beginning of startup process

This will allow us to record transient runtime state in vm->def, like
default VNC parameters. Accomplish this by adding an extra 'live' parameter
to SetDefTransient, with similar semantics to the 'live' flag for
AssignDef.

14 years agomaint: support --no-git option during autogen.sh
Eric Blake [Fri, 21 Jan 2011 16:34:35 +0000 (09:34 -0700)]
maint: support --no-git option during autogen.sh

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

Also, fixes gnulib bug in dealing with strerror_r from glibc 2.13.

* .gnulib: Update to latest, for improved bootstrap.
* bootstrap: Resync from gnulib.
* autogen.sh (bootstrap): Add --bootstrap-sync, to make it easier
to keep bootstrap up-to-date.  Pass optional --no-git through.
Reported by Aleksey Avdeev.

14 years ago[v2] qemu: Retry JSON monitor cont cmd on MigrationExpected error
Jim Fehlig [Thu, 13 Jan 2011 19:52:23 +0000 (12:52 -0700)]
[v2] qemu: Retry JSON monitor cont cmd on MigrationExpected error

When restoring a saved qemu instance via JSON monitor, the vm is
left in a paused state.  Turns out the 'cont' cmd was failing with
"MigrationExpected" error class and "An incoming migration is
expected before this command can be executed" error description
due to migration (restore) not yet complete.

Detect if 'cont' cmd fails with "MigrationExpecte" error class and
retry 'cont' cmd.

V2: Fix potential double-free noted by Laine Stump

14 years agoqemu: report more proper error for unsupported graphics
Osier Yang [Fri, 21 Jan 2011 07:20:50 +0000 (15:20 +0800)]
qemu: report more proper error for unsupported graphics

Report VIR_ERR_CONFIG_UNSUPPORTED instead of VIR_ERR_INTERNAL_ERROR,
as it's valid in our domain schema, just unsupported by hypervisor
here.

* src/qemu/qemu_command.c

14 years agoFix startup with VNC password expiry on old QEMU
Daniel P. Berrange [Tue, 18 Jan 2011 18:37:45 +0000 (18:37 +0000)]
Fix startup with VNC password expiry on old QEMU

The code which set VNC passwords correctly had fallback for
the set_password command, but was lacking it for the
expire_password command. This made it impossible to start
a guest. It also failed to check whether QEMU was still
running after the initial 'set_password' command completed

* src/qemu/qemu_hotplug.c: Fix error handling when
  password expiry fails
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Fix
  return code for missing expire_password command

14 years agoFix error reporting when machine type probe fails
Daniel P. Berrange [Tue, 18 Jan 2011 18:00:31 +0000 (18:00 +0000)]
Fix error reporting when machine type probe fails

Avoid overwriting the real error message with a generic
OOM failure message, when machine type probe fails

* src/qemu/qemu_driver.c: Don't overwrite error

14 years agoAvoid crash in security driver if model is NULL
Daniel P. Berrange [Tue, 18 Jan 2011 18:01:10 +0000 (18:01 +0000)]
Avoid crash in security driver if model is NULL

If the XML security model is NULL, it is assumed that the current
model will be used with dynamic labelling. The verify step is
meaningless and potentially crashes if dereferencing NULL

* src/security/security_manager.c: Skip NULL model on verify

14 years agoqemu: Fix a possible deadlock in p2p migration
Wen Congyang [Fri, 21 Jan 2011 08:28:07 +0000 (16:28 +0800)]
qemu: Fix a possible deadlock in p2p migration

The function virUnrefConnect() may call virReleaseConnect() to release
the dest connection, and the function virReleaseConnect() will call
conn->driver->close().

So the function virUnrefConnect() should be surrounded by
qemuDomainObjEnterRemoteWithDriver() and
qemuDomainObjExitRemoteWithDriver() to prevent possible deadlock between
two communicating libvirt daemons.

See commit f0c8e1cb3774d6f09e2681ca1988bf235a343007 for further details.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
14 years agodocs: document <controller> element
Eric Blake [Mon, 17 Jan 2011 21:33:00 +0000 (14:33 -0700)]
docs: document <controller> element

* docs/formatdomain.html.in: Talk about <controller> and <address>
throughout.

14 years agodocs: move the apps page to the top level as its good promo
Justin Clift [Thu, 20 Jan 2011 06:17:41 +0000 (17:17 +1100)]
docs: move the apps page to the top level as its good promo

14 years agodocs: added new entries to apps page, plus adjusted a few existing
Justin Clift [Thu, 20 Jan 2011 01:52:21 +0000 (12:52 +1100)]
docs: added new entries to apps page, plus adjusted a few existing

Added new entries for Hudson, LCFG, Tivoli Provisioning Manager,
virt-what, and Zenoss.  Adjusted the existing entries for BuildBot
and vmware2libvirt.

14 years agoqemu: Avoid sending STOPPED event twice
Jiri Denemark [Tue, 18 Jan 2011 11:07:13 +0000 (12:07 +0100)]
qemu: Avoid sending STOPPED event twice

In some circumstances, libvirtd would issue two STOPPED events after it
stopped a domain. This was because an EOF event can arrive after a qemu
process is killed but before qemuMonitorClose() is called.

qemuHandleMonitorEOF() should ignore EOF when the domain is not running.

I wasn't able to reproduce this bug directly, only after adding an
artificial sleep() into qemudShutdownVMDaemon().

14 years agoqemu: Fail if per-device boot is used but deviceboot is not supported
Jiri Denemark [Tue, 18 Jan 2011 09:04:21 +0000 (10:04 +0100)]
qemu: Fail if per-device boot is used but deviceboot is not supported

14 years agospec: Start libvirt-guests only if it's on in current runlevel
Jiri Denemark [Tue, 18 Jan 2011 08:49:10 +0000 (09:49 +0100)]
spec: Start libvirt-guests only if it's on in current runlevel

14 years agoRemove redundant brackets around return values
Daniel P. Berrange [Fri, 7 Jan 2011 17:39:43 +0000 (17:39 +0000)]
Remove redundant brackets around return values

A large number of return values used 'return (0)' instead
of simply 'return 0'. Remove all these redundant brackets
so the style is consistent throughout the file

* src/libvirt.c: Remove redundant brackets

14 years agoIncrease size of driver table to make UML work again
Daniel P. Berrange [Fri, 7 Jan 2011 17:36:33 +0000 (17:36 +0000)]
Increase size of driver table to make UML work again

The driver table only has 10 slots, but there are potentially
11 drivers that need activating. Improve the error message
when driver registration fails

* src/libvirt.c: Increase driver table size & improve errors

14 years agoTurn libvirt.c error reporting functions into macros
Daniel P. Berrange [Fri, 7 Jan 2011 17:31:36 +0000 (17:31 +0000)]
Turn libvirt.c error reporting functions into macros

The virLibConnError() function (and related ones) do not correctly
report line number info. Turn them all into macros so line numbers
are reported correctly. Drop the connection object in all of them
since it is no longer used.

Also from the virLibConnWarning() equivalents completely. Now
that the Xen driver is running 100% inside libvirtd, those
codepaths for secondary drivers cannot be reached.

* src/libvirt.c: Replace error functions with macros

14 years agodocs: document <sysinfo> and <smbios> elements
Eric Blake [Tue, 18 Jan 2011 20:41:55 +0000 (13:41 -0700)]
docs: document <sysinfo> and <smbios> elements

* docs/formatdomain.html.in: Talk about <sysinfo> throughout.

14 years agobuild: use more gnulib modules for simpler code
Eric Blake [Fri, 24 Dec 2010 02:26:15 +0000 (19:26 -0700)]
build: use more gnulib modules for simpler code

* .gnulib: Update to latest, for sigpipe and sigaction modules.
* bootstrap.conf (gnulib_modules): Add siaction, sigpipe, strerror_r.
* tools/virsh.c (vshSetupSignals) [!SIGPIPE]: Delete, now that
gnulib guarantees it.
(SA_SIGINFO): Define for mingw fallback.
* src/util/virterror.c (virStrerror): Simplify, now that gnulib
guarantees the POSIX interface.
* configure.ac (AC_CHECK_FUNCS_ONCE): Drop redundant check.
(AM_PROG_CC_STDC): Move earlier, to keep autoconf happy.

14 years agoRemove two unused PATH_MAX-sized char arrays from the stack
Matthias Bolte [Sat, 15 Jan 2011 16:38:57 +0000 (17:38 +0100)]
Remove two unused PATH_MAX-sized char arrays from the stack

14 years agoUse VIR_ERR_OPERATION_INVALID when appropriated
Matthias Bolte [Sat, 15 Jan 2011 15:57:33 +0000 (16:57 +0100)]
Use VIR_ERR_OPERATION_INVALID when appropriated

VIR_ERR_OPERATION_INVALID means that the operation is not valid
for the current state of the involved object.

14 years agoFix misuse of VIR_ERR_INVALID_* error code
Matthias Bolte [Sat, 15 Jan 2011 15:31:29 +0000 (16:31 +0100)]
Fix misuse of VIR_ERR_INVALID_* error code

VIR_ERR_INVALID_* is meant for invalid pointers only.

14 years agoSimplify "NWFilterPool" to "NWFilter"
Matthias Bolte [Sat, 15 Jan 2011 15:06:52 +0000 (16:06 +0100)]
Simplify "NWFilterPool" to "NWFilter"

The public object is called NWFilter but the corresponding private
object is called NWFilterPool. I don't see compelling reasons for this
Pool suffix. One might argue that an NWFilter is a "pool" of rules, etc.

Remove the Pool suffix from NWFilterPool. No functional change included.

14 years agodatatypes: Fix outdated function names in the documentation
Matthias Bolte [Sat, 15 Jan 2011 14:42:22 +0000 (15:42 +0100)]
datatypes: Fix outdated function names in the documentation

14 years agoAdd documentation for VIR_DOMAIN_MEMORY_PARAM_UNLIMITED
Matthias Bolte [Sat, 15 Jan 2011 14:03:08 +0000 (15:03 +0100)]
Add documentation for VIR_DOMAIN_MEMORY_PARAM_UNLIMITED

Otherwise apibuild.py complains about it.

14 years agodatatypes: Get virSecretFreeName in sync with the other free functions
Matthias Bolte [Sat, 15 Jan 2011 13:54:19 +0000 (14:54 +0100)]
datatypes: Get virSecretFreeName in sync with the other free functions

14 years agodocs: Move the "Network Filtering" page one level up in the hierarchy
Matthias Bolte [Sat, 15 Jan 2011 13:47:11 +0000 (14:47 +0100)]
docs: Move the "Network Filtering" page one level up in the hierarchy

"Network Filtering" is not directly related to "Networks".

Suggested by Daniel P. Berrange.

14 years agodocs: add buildbot to the apps page
Justin Clift [Tue, 18 Jan 2011 21:40:08 +0000 (08:40 +1100)]
docs: add buildbot to the apps page

14 years agoqemu: don't fail capabilities check on 0.12.x
Eric Blake [Tue, 18 Jan 2011 16:47:30 +0000 (09:47 -0700)]
qemu: don't fail capabilities check on 0.12.x

Fixes regression introduced in commit 2211518, where all qemu 0.12.x
fails to start, as does qemu 0.13.x lacking the pci-assign device.
Prior to 2211518, the code was just ignoring a non-zero exit status
from the qemu child, but the virCommand code checked this to avoid
masking any other issues, which means the real bug of provoking
non-zero exit status has been latent for a longer time.

* src/qemu/qemu_capabilities.c (qemuCapsExtractVersionInfo): Check
for -device driver,? support.
(qemuCapsExtractDeviceStr): Avoid failure if all probed devices
are unsupported.
Reported by Ken Congyang.

14 years agodocs: add new conversion heading to the apps listing
Justin Clift [Tue, 18 Jan 2011 21:21:03 +0000 (08:21 +1100)]
docs: add new conversion heading to the apps listing

14 years agodocs: updated windows page for new 0.8.7 installer
Justin Clift [Tue, 18 Jan 2011 18:00:44 +0000 (05:00 +1100)]
docs: updated windows page for new 0.8.7 installer

14 years agoqemu: use -incoming fd:n to avoid qemu holding fd indefinitely
Eric Blake [Wed, 22 Dec 2010 22:13:29 +0000 (15:13 -0700)]
qemu: use -incoming fd:n to avoid qemu holding fd indefinitely

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

When using -incoming stdio or -incoming exec:, qemu keeps the
stdin fd open long after the migration is complete.  Not to
mention that exec:cat is horribly inefficient, by doubling the
I/O and going through a popen interface in qemu.

The new -incoming fd: of qemu 0.12.0 closes the fd after using
it, and allows us to bypass an intermediary cat process for
less I/O.

* src/qemu/qemu_command.h (qemuBuildCommandLine): Add parameter.
* src/qemu/qemu_command.c (qemuBuildCommandLine): Support
migration via fd: when possible.  Consolidate migration handling
into one spot, now that it is more complex.
* src/qemu/qemu_driver.c (qemudStartVMDaemon): Update caller.
* tests/qemuxml2argvtest.c (mymain): Likewise.
* tests/qemuxml2argvdata/qemuxml2argv-restore-v2-fd.args: New file.
* tests/qemuxml2argvdata/qemuxml2argv-restore-v2-fd.xml: Likewise.

14 years agotests: Add tests for per-device boot elements
Jiri Denemark [Thu, 13 Jan 2011 10:46:43 +0000 (11:46 +0100)]
tests: Add tests for per-device boot elements

14 years agoqemu: Support per-device boot ordering
Jiri Denemark [Wed, 12 Jan 2011 10:33:34 +0000 (11:33 +0100)]
qemu: Support per-device boot ordering

Support for this is included in qemu and seabios from upstream git.

14 years agoIntroduce per-device boot element
Jiri Denemark [Wed, 12 Jan 2011 14:19:34 +0000 (15:19 +0100)]
Introduce per-device boot element

Currently, boot order can be specified per device class but there is no
way to specify exact disk/NIC device to boot from.

This patch adds <boot order='N'/> element which can be used inside
<disk/> and <interface/>. This is incompatible with the older os/boot
element. Since not all hypervisors support per-device boot
specification, new deviceboot flag is included in capabilities XML for
hypervisors which understand the new boot element. Presence of the flag
allows (but doesn't require) users to use the new style boot order
specification.

14 years agoconf: Move boot parsing into a separate function
Jiri Denemark [Wed, 12 Jan 2011 07:44:54 +0000 (08:44 +0100)]
conf: Move boot parsing into a separate function

14 years agobuild: let xgettext see strings in libvirt-guests
Eric Blake [Thu, 6 Jan 2011 19:00:30 +0000 (12:00 -0700)]
build: let xgettext see strings in libvirt-guests

* tools/libvirt-guests.init.in: Rename...
* tools/libvirt-guests.init.sh: ...so that xgettext's language
detection via suffix will work.
* po/POTFILES.in: Update all references.
* tools/Makefile.am (EXTRA_DIST, libvirt-guests.init): Likewise.

14 years agolibvirt-guests: remove bashisms
Laurent Léonard [Tue, 4 Jan 2011 18:13:56 +0000 (19:13 +0100)]
libvirt-guests: remove bashisms

* tools/libvirt-guests.init.sh: Use only POSIX shell features, which
includes using gettext.sh for translation rather than $"".
* tools/Makefile.am (libvirt-guests.init): Supply a few more substitutions.
* po/POTFILES.in: Mark that libvirt-guests.init needs translation.

Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agoA couple of fixes for the search PHP code
Daniel Veillard [Mon, 17 Jan 2011 08:55:41 +0000 (16:55 +0800)]
A couple of fixes for the search PHP code

14 years agotests: Remove obsolete secaatest
Matthias Bolte [Fri, 14 Jan 2011 21:37:55 +0000 (22:37 +0100)]
tests: Remove obsolete secaatest

Before the security driver was refactored in d6623003 seclabeltest and
secaatest were basically the same. seclabeltest was meant for SELinux
and secaatest for AppArmor. Both tests exited early when the specific
security driver backend wasn't enabled.

With the new security manager trying to initialize a disabled security
driver backend is an error that can't be distinguished from other errors
anymore. Therefore, the updated seclabeltest just asks for the first
available backend as this will always work even with SELinux and AppArmor
backend being disabled due to the new Nop backend.

Remove the obsolete secaatest and compile and run the seclabeltest
unconditional.

This fixes make check on systems that support AppArmor.

14 years agovirsh: Use WITH_SECDRIVER_APPARMOR to detect AppArmor support
Matthias Bolte [Fri, 14 Jan 2011 21:00:55 +0000 (22:00 +0100)]
virsh: Use WITH_SECDRIVER_APPARMOR to detect AppArmor support

There is no ENABLE_SECDRIVER_APPARMOR.

14 years agomemtune: Let virsh know the unlimited value for memory tunables
Nikunj A. Dadhania [Thu, 13 Jan 2011 09:18:11 +0000 (14:48 +0530)]
memtune: Let virsh know the unlimited value for memory tunables

Display or set unlimited values for memory parameters. Unlimited is
represented by INT64_MAX in memory cgroup.

Signed-off-by: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
Reported-by: Justin Clift <jclift@redhat.com>
14 years agomaint: improve sc_prohibit_strncmp syntax check
Eric Blake [Fri, 7 Jan 2011 00:17:32 +0000 (17:17 -0700)]
maint: improve sc_prohibit_strncmp syntax check

* .gnulib: Update, for sc_prohibit_strcmp fix.
* cfg.mk: Adjust copyright; the only FSF portions come from when
this file was copied from coreutils.
(sc_prohibit_strncmp): Copy bug-fixes from sc_prohibit_strcmp.
* .x-sc_prohibit_strcmp: Delete, now that rule is smarter.
* .x-sc_prohibit_strncmp: Likewise.
* Makefile.am (syntax_check_exceptions): Track deletion.

14 years agodatatypes: avoid redundant __FUNCTION__
Eric Blake [Wed, 12 May 2010 02:57:56 +0000 (20:57 -0600)]
datatypes: avoid redundant __FUNCTION__

virLibConnError already includes __FUNCTION__ in its output, so we
were redundant.  Furthermore, clang warns that __FUNCTION__ is not
a string literal (at least __FUNCTION__ will never contain %, so
it was not a security risk).

* src/datatypes.c: Replace __FUNCTION__ with a descriptive string.

14 years agoEnable tuning of qemu network tap device "sndbuf" size
Laine Stump [Wed, 12 Jan 2011 19:38:01 +0000 (14:38 -0500)]
Enable tuning of qemu network tap device "sndbuf" size

This is in response to a request in:

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

In short, under heavy load, it's possible for qemu's networking to
lock up due to the tap device's default 1MB sndbuf being
inadequate. adding "sndbuf=0" to the qemu commandline -netdevice
option will alleviate this problem (sndbuf=0 actually sets it to
0xffffffff).

Because we must be able to explicitly specify "0" as a value, the
standard practice of "0 means not specified" won't work here. Instead,
virDomainNetDef also has a sndbuf_specified, which defaults to 0, but
is set to 1 if some value was given.

The sndbuf value is put inside a <tune> element of each <interface> in
the domain. The intent is that further tunable settings will also be
placed inside this element.

     <interface type='network'>
       ...
       <tune>
         <sndbuf>0</sndbuf>
       ...
       </tune>
     </interface>