]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
14 years agoMake state driver device hotplug/update actually transient
Cole Robinson [Fri, 19 Nov 2010 18:36:29 +0000 (13:36 -0500)]
Make state driver device hotplug/update actually transient

The current semantics of non-persistent hotplug/update are confusing: the
changes will persist as long as the in memory domain definition isn't
overwritten. This means hotplug changes stay around until the domain is
redefined or libvirtd is restarted.

Call virDomainObjSetDefTransient at VM startup, so that we properly discard
hotplug changes when the VM is shutdown.

14 years agodomain_conf: Add virDomainObjSetDefTransient
Cole Robinson [Fri, 19 Nov 2010 18:34:19 +0000 (13:34 -0500)]
domain_conf: Add virDomainObjSetDefTransient

This function sets the running domain definition as transient, by reparsing
the persistent config and assigning it to newDef. This ensures that any
changes made to the running definition and not the persistent config are
discarded when the VM is shutdown.

14 years agoxend: Escape reserved sexpr characters
Cole Robinson [Fri, 19 Nov 2010 15:51:57 +0000 (10:51 -0500)]
xend: Escape reserved sexpr characters

If we don't escape ' or \ xend can't parse the generated sexpr. This
might over apply the EscapeSexpr routine, but it shouldn't hurt.

14 years agobuf: Simplify virBufferEscapeString
Cole Robinson [Mon, 22 Nov 2010 17:04:45 +0000 (12:04 -0500)]
buf: Simplify virBufferEscapeString

We are about to copy this function, so clean it up before we do.

14 years agoxend: urlencode: Properly escape '&'
Cole Robinson [Thu, 18 Nov 2010 22:52:05 +0000 (17:52 -0500)]
xend: urlencode: Properly escape '&'

Since we send the sexpr to xend via HTTP, we need to properly escape
'&'

14 years agoconf: Fix parsing python style triple quotes
Cole Robinson [Thu, 18 Nov 2010 22:35:23 +0000 (17:35 -0500)]
conf: Fix parsing python style triple quotes

An incorrect check broke matching the closing set of quotes. Update
tests to cover this case for XM config files.

14 years agoconf: Convert ParseString to use STRPREFIX
Cole Robinson [Thu, 18 Nov 2010 22:33:36 +0000 (17:33 -0500)]
conf: Convert ParseString to use STRPREFIX

14 years agoschemas: domain: Add more valid file path chars
Cole Robinson [Mon, 22 Nov 2010 16:46:13 +0000 (11:46 -0500)]
schemas: domain: Add more valid file path chars

Also, standardize path usage on 'filePath' and 'absFilePath'

14 years agoqed: Minor updates to QED support patches
Adam Litke [Mon, 22 Nov 2010 20:08:17 +0000 (14:08 -0600)]
qed: Minor updates to QED support patches

This patch makes two corrections to the newly-added QED support patch series:

 - Correct the QED header field offsets
 - Remove XML parsing for VIR_STORAGE_FILE_AUTO_SAFE

Signed-off-by: Adam Litke <agl@us.ibm.com>
14 years agodocs: removed outdated reference to virt-mem
Justin Clift [Mon, 22 Nov 2010 11:55:35 +0000 (22:55 +1100)]
docs: removed outdated reference to virt-mem

The virt-mem program is no longer shipped, but was still being
referenced at the bottom of the virsh and libvirtd man pages.

This patch removes it from those man pages, addressing
BZ# 639603:

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

14 years agonwfilter: re-order lock grabbed by IP addr. learn thread
Stefan Berger [Sat, 20 Nov 2010 01:41:25 +0000 (20:41 -0500)]
nwfilter: re-order lock grabbed by IP addr. learn thread

The IP address learning thread was causing a deadlock when it instantiated a filter while a filter update/change was ongoing. The reason for this was the ordering of locks due to the following calls

virNWFilterUnlockFilterUpdates()
virNWFilterPoolObjFindByName()

The below patch now puts the order of the locks in the above shown order when instantiating the filter from the IP address learning thread.

14 years agoSupport for probing qed image metadata
Adam Litke [Fri, 19 Nov 2010 23:19:24 +0000 (16:19 -0700)]
Support for probing qed image metadata

Implement getBackingStore() for QED images.  The header format is defined in
the QED spec: http://wiki.qemu.org/Features/QED .

Signed-off-by: Adam Litke <agl@us.ibm.com>
Cc: Stefan Hajnoczi <stefan.hajnoczi@uk.ibm.com>
Cc: Anthony Liguori <aliguori@linux.vnet.ibm.com>
14 years agostorage_file: Add a new flag to mark backing files that are safe to probe
Adam Litke [Fri, 19 Nov 2010 16:18:17 +0000 (10:18 -0600)]
storage_file: Add a new flag to mark backing files that are safe to probe

Signed-off-by: Adam Litke <agl@us.ibm.com>
14 years agoQED: Basic support for QED images
Adam Litke [Fri, 19 Nov 2010 16:18:16 +0000 (10:18 -0600)]
QED: Basic support for QED images

Add an entry in fileTypeInfo for QED image files.

Signed-off-by: Adam Litke <agl@us.ibm.com>
Cc: Stefan Hajnoczi <stefan.hajnoczi@uk.ibm.com>
Cc: Anthony Liguori <aliguori@linux.vnet.ibm.com>
14 years agoAllow probing of image formats without version information
Adam Litke [Fri, 19 Nov 2010 16:18:15 +0000 (10:18 -0600)]
Allow probing of image formats without version information

Disk image formats that wish to opt-out of version validation are supposed to
set versionOffset to -1 in their fileTypeInfo entry.

By unconditionally returning False for these formats,
virStorageFileMatchesVersion() incorrectly reports a version mismatch when the
test was actually skipped.  The correct behavior is to return True so these
formats can be successfully probed using the magic bytes alone.

Signed-off-by: Adam Litke <agl@us.ibm.com>
14 years agomaint: tighten strncmp syntax check
Eric Blake [Wed, 17 Nov 2010 23:41:31 +0000 (16:41 -0700)]
maint: tighten strncmp syntax check

Using 'int ret = strcmp(a, b)' in a qsort function is a valid use of
str[n]cmp that should _not_ be turned to STREQ, but it was falling
foul of our specific syntax-check.  Meanwhile, gnulib's maint.mk
already has a tighter bound for strcmp, so we can copy that regex and
just check for strncmp, which results in fewer false positives that
require exceptions.

* cfg.mk (sc_prohibit_strcmp_and_strncmp): Rename...
(sc_prohibit_strncmp): ...to this, and tighten, to mirror
maint.mk's sc_prohibit_strcmp's better regex.
* Makefile.am (syntax_check_exceptions): Update exception rule.
* .x-sc_prohibit_strcmp_and_strncmp: Rename...
* .x-sc_prohibit_strncmp: ...and trim.

14 years agovirExec: fix bug in setting up child stderr/out with /dev/null
Daniel P. Berrange [Tue, 25 May 2010 11:14:25 +0000 (12:14 +0100)]
virExec: fix bug in setting up child stderr/out with /dev/null

14 years agocapabilities, cpu: use new array API
Eric Blake [Tue, 17 Aug 2010 21:41:51 +0000 (15:41 -0600)]
capabilities, cpu: use new array API

* src/conf/capabilities.h (_virCaps, _virCapsHost, _virCapsGuest)
(_virCapsGuestArch): Add additional fields.
* src/conf/cpu_conf.h (_virCPUDef): Likewise.
* src/conf/capabilities.c (virCapabilitiesFormatXML): Reflect
updated type.
(virCapabilitiesAddGuest, virCapabilitiesAddHostFeature)
(virCapabilitiesAddHostMigrateTransport)
(virCapabilitiesAddHostNUMACell, virCapabilitiesAddGuestFeature)
(virCapabilitiesAddGuestDomain): Use new array APIs.
* src/conf/cpu_conf.c (virCPUDefAddFeature, virCPUDefCopy)
(virCPUDefParseXML): Likewise.
* tests/testutilsqemu.c (testQemuCapsInit): Adjust test.

14 years agodaemon: use safer memory growth macros
Eric Blake [Fri, 13 Aug 2010 22:19:54 +0000 (16:19 -0600)]
daemon: use safer memory growth macros

* daemon/libvirtd.h (qemud_server): Change types of members
tracking array sizes, and add allocation trackers.
* daemon/event.c (virEventLoop): Likewise.
(virEventAddHandleImpl, virEventAddTimeoutImpl)
(virEventCleanupTimeouts, virEventCleanupHandles): Use
VIR_RESIZE_N instead of VIR_REALLOC_N.  Tweak debug messages to
match type changes.
* daemon/libvirtd.c (qemudDispatchServer, qemudRunLoop): Likewise.

14 years agomemory: make it easier to avoid quadratic scaling of arrays
Eric Blake [Sat, 14 Aug 2010 15:42:51 +0000 (09:42 -0600)]
memory: make it easier to avoid quadratic scaling of arrays

* src/util/memory.h (VIR_RESIZE_N): New macro.
* src/util/memory.c (virResizeN): New function.
* src/libvirt_private.syms: Export new helper.
* docs/hacking.html.in: Document it.
* HACKING: Regenerate.

14 years agomemory: make it safer to expand arrays
Eric Blake [Fri, 13 Aug 2010 21:00:47 +0000 (15:00 -0600)]
memory: make it safer to expand arrays

* src/util/memory.h (VIR_REALLOC_N): Update docs.
(VIR_EXPAND_N, VIR_SHRINK_N): New macros.
(virAlloc, virAllocN, virReallocN, virAllocVar, virFree): Add some
gcc attributes.
* src/util/memory.c (virExpandN, virShrinkN): New functions.
(virReallocN): Update docs.
* src/libvirt_private.syms: Export new helpers.
* docs/hacking.html.in: Prefer newer interfaces over
VIR_REALLOC_N, since uninitialized memory can bite us.
* HACKING: Regenerate.

14 years agodoc: Add doc for missed options of migrate
Osier Yang [Thu, 18 Nov 2010 08:21:05 +0000 (16:21 +0800)]
doc: Add doc for missed options of migrate

* tools/virsh.pod (add doc for options like "--p2p", "--direct",
"--copy-storage-all", "dname", etc.)

14 years agodoc: add doc for missed parameters of attach-disk
Osier Yang [Thu, 18 Nov 2010 07:50:02 +0000 (15:50 +0800)]
doc: add doc for missed parameters of attach-disk

* tools/virsh.pod (add docs for --persistent and --sourcetype
of attach-disk, break the long lines in the meantime)

14 years agoFix a failure to restore SELinux label for character devices
Daniel Veillard [Thu, 18 Nov 2010 16:55:14 +0000 (17:55 +0100)]
Fix a failure to restore SELinux label for character devices

The code in SELinuxRestoreSecurityChardevLabel() was trying to
use SELinuxSetFilecon directly for devices or file types while
it should really use SELinuxRestoreSecurityFileLabel encapsulating
routine, which avoid various problems like resolving symlinks,
making sure he file exists and work around NFS problems

14 years agovirt-aa-helper: Fix several compile errors
Matthias Bolte [Wed, 17 Nov 2010 20:31:04 +0000 (21:31 +0100)]
virt-aa-helper: Fix several compile errors

Include locale.h for setlocale().

Revert the usage string back to it's original form.

Use puts() instead of fputs(), as fputs() expects a FILE*.

Add closing parenthesis to some vah_error() calls.

Use argv[0] instead of an undefined argv0.

14 years agobuild: fix autobuild failures on gcov upgrade
Eric Blake [Wed, 17 Nov 2010 17:38:59 +0000 (10:38 -0700)]
build: fix autobuild failures on gcov upgrade

Last time I ran ./autobuild.sh was on F13; and upgrading to F14
exposed these leftovers due to a newer gcov than what was in the stale
files, in the form of spurious messages that break 'make check':

+profiling:/home/remote/eblake/libvirt-tmp/tools/virsh-console.gcda:Version mismatch - expected 405R got 404R

and concluding with a bug in the autobuild.sh script itself:

./autobuild.sh: line 44: test: =: unary operator expected

* autobuild.sh: avoid syntax error on failed test
* tools/Makefile.am (CLEANFILES): Clean coverage files.

14 years agodoc: update virsh manual
Osier Yang [Wed, 17 Nov 2010 14:15:12 +0000 (22:15 +0800)]
doc: update virsh manual

* tools/virsh.pod (change things like "edit domain.xml" into
  "vi domain.xml", so that it's more clear for user)

14 years agomaint: avoid remaining sprintf uses
Eric Blake [Wed, 18 Aug 2010 23:31:39 +0000 (17:31 -0600)]
maint: avoid remaining sprintf uses

* cfg.mk (sc_prohibit_sprintf): New rule.
(sc_prohibit_asprintf): Avoid false positives.
* docs/hacking.html.in (Printf-style functions): Document the
policy.
* HACKING: Regenerate.
* .x-sc_prohibit_sprintf: New exemptions.
* Makefile.am (syntax_check_exceptions): Ship new file.
* src/vbox/vbox_tmpl.c (vboxStartMachine, vboxAttachUSB): Use
virAsprintf instead.
* src/uml/uml_driver.c (umlOpenMonitor): Use snprintf instead.
* tools/virsh.c (cmdDetachInterface): Likewise.
* src/security/security_selinux.c (SELinuxGenSecurityLabel):
Likewise.
* src/openvz/openvz_driver.c (openvzDomainDefineCmd): Likewise,
and ensure large enough buffer.

14 years agovirt-aa-helper: translate error messages
Eric Blake [Wed, 12 May 2010 17:23:06 +0000 (11:23 -0600)]
virt-aa-helper: translate error messages

These messages are visible to the user, so they should be
consistently translated.

* cfg.mk (msg_gen_function): Add vah_error, vah_warning.
* src/security/virt-aa-helper.c: Translate messages.
(catchXMLError): Fix capitalization.

14 years agomaint: update to latest gnulib
Eric Blake [Tue, 16 Nov 2010 19:29:09 +0000 (12:29 -0700)]
maint: update to latest gnulib

Allows bootstrap to work on FreeBSD, where gzip doesn't have a '.'
in its version; and silences false positives in the new
'make syntax-check' rule.

* .gnulib: Update to latest.
* bootstrap: Synchronize to upstream.
* .x-sc_bindtextdomain: New exemptions.
* Makefile.am (syntax_check_exceptions): Ship new file.
* .gitignore: Regenerate per latest bootstrap, anchor entries that
are only in the root directory, and consolidate entries from other
generated .gitignore files.
* build-aux/.gitignore, m4/.gitignore, po/.gitignore: Remove from
version control, since bootstrap generates them.

14 years agomaint: improve i18n on non-Linux
Eric Blake [Tue, 16 Nov 2010 19:01:37 +0000 (12:01 -0700)]
maint: improve i18n on non-Linux

Per the gettext developer:
http://lists.gnu.org/archive/html/bug-gnu-utils/2010-10/msg00019.html
http://lists.gnu.org/archive/html/bug-gnu-utils/2010-10/msg00021.html

gettext() doesn't work correctly on all platforms unless you have
called setlocale().  Furthermore, gnulib's gettext.h has provisions
for setting up a default locale, which is the preferred method for
libraries to use gettext without having to call textdomain() and
override the main program's default domain (virInitialize already
calls bindtextdomain(), but this is insufficient without the
setlocale() added in this patch; and a redundant bindtextdomain()
in this patch doesn't hurt, but serves as a good example for other
packages that need to bind a second translation domain).

This patch is needed to silence a new gnulib 'make syntax-check'
rule in the next patch.

* daemon/libvirtd.c (main): Setup locale and gettext.
* src/lxc/lxc_controller.c (main): Likewise.
* src/security/virt-aa-helper.c (main): Likewise.
* src/storage/parthelper.c (main): Likewise.
* tools/virsh.c (main): Fix exit status.
* src/internal.h (DEFAULT_TEXT_DOMAIN): Define, for gettext.h.
(_): Simplify definition accordingly.
* po/POTFILES.in: Add src/storage/parthelper.c.

14 years agomaint: use gnulib configmake rather than open-coding things
Eric Blake [Tue, 16 Nov 2010 14:54:17 +0000 (07:54 -0700)]
maint: use gnulib configmake rather than open-coding things

* bootstrap.conf (gnulib_modules): Add configmake.
* daemon/Makefile.am (libvirtd_CFLAGS): Drop defines provided by
gnulib.
* src/Makefile.am (INCLUDES): Likewise.
* tests/Makefile.am (INCLUDES): Likewise.
* tools/Makefile.am (virsh_CFLAGS): Likewise.
* daemon/libvirtd.c (qemudInitPaths, usage, main): Update
clients.
* src/cpu/cpu_map.c (CPUMAPFILE): Likewise.
* src/driver.c (DEFAULT_DRIVER_DIR): Likewise.
* src/internal.h (_): Likewise.
* src/libvirt.c (virInitialize): Likewise.
* src/lxc/lxc_conf.h (LXC_CONFIG_DIR, LXC_STATE_DIR, LXC_LOG_DIR):
Likewise.
* src/lxc/lxc_conf.c (lxcCapsInit, lxcLoadDriverConfig):
Likewise.
* src/network/bridge_driver.c (NETWORK_PID_DIR)
(NETWORK_STATE_DIR, DNSMASQ_STATE_DIR, networkStartup): Likewise.
* src/nwfilter/nwfilter_driver.c (nwfilterDriverStartup):
Likewise.
* src/qemu/qemu_conf.c (qemudLoadDriverConfig): Likewise.
* src/qemu/qemu_driver.c (qemudStartup): Likewise.
* src/remote/remote_driver.h (LIBVIRTD_PRIV_UNIX_SOCKET)
(LIBVIRTD_PRIV_UNIX_SOCKET_RO, LIBVIRTD_CONFIGURATION_FILE)
(LIBVIRT_PKI_DIR): Likewise.
* src/secret/secret_driver.c (secretDriverStartup): Likewise.
* src/security/security_apparmor.c (VIRT_AA_HELPER): Likewise.
* src/security/virt-aa-helper.c (main): Likewise.
* src/storage/storage_backend_disk.c (PARTHELPER): Likewise.
* src/storage/storage_driver.c (storageDriverStartup): Likewise.
* src/uml/uml_driver.c (TEMPDIR, umlStartup): Likewise.
* src/util/hooks.c (LIBVIRT_HOOK_DIR): Likewise.
* tools/virsh.c (main): Likewise.
* docs/hooks.html.in: Likewise.

14 years agoreplace last instances of close()
Stefan Berger [Wed, 17 Nov 2010 15:19:13 +0000 (10:19 -0500)]
replace last instances of close()

I am replacing the last instances of close() I found with VIR_CLOSE() / VIR_FORCE_CLOSE respectively.

The first part patches virsh, which I missed out on previously.

The 2nd patch I had left out intentionally to look at it more carefully:
The 'closed' variable could be easily removed since it wasn't used anywhere else. The possible race condition that could result from the filedescriptor being closed and not set to -1 (and possibly let us write into 'something' totally different if the fd was allocated by another thread) seems to be prevented by the qemuMonitorLock() already placed around the code that reads from or writes to the fd. So the change of this code as shown in the patch should not have any side-effects.

14 years agonwfilter: also purge ip(6)tables rules before detecting IP address
Stefan Berger [Wed, 17 Nov 2010 02:18:21 +0000 (21:18 -0500)]
nwfilter: also purge ip(6)tables rules before detecting IP address

Rather than only cleaning any remaining ebtables rules, also clean those applied to iptables and ip6tables when detecting the IP address of an interface. Previous applied iptables rules may hinder DHCP packets.

14 years agodeprecate fclose() and introduce VIR_{FORCE_}FCLOSE()
Stefan Berger [Wed, 17 Nov 2010 02:13:29 +0000 (21:13 -0500)]
deprecate fclose() and introduce VIR_{FORCE_}FCLOSE()

Similarly to deprecating close(), I am now deprecating fclose() and
introduce VIR_FORCE_FCLOSE() and VIR_FCLOSE(). Also, fdopen() is replaced with
VIR_FDOPEN().

Most of the files are opened in read-only mode, so usage of
VIR_FORCE_CLOSE() seemed appropriate. Others that are opened in write
mode already had the fclose()<  0 check and I converted those to
VIR_FCLOSE()<  0.

I did not find occurrences of possible double-closed files on the way.

14 years agodaemon: fix indention problem in daemon/libvirt.c
Osier Yang [Sat, 13 Nov 2010 00:24:03 +0000 (08:24 +0800)]
daemon: fix indention problem in daemon/libvirt.c

* daemon/libvirtd.c

14 years agoqemu: fix typos in qemu_monitor_text.c
Osier Yang [Fri, 12 Nov 2010 23:08:24 +0000 (07:08 +0800)]
qemu: fix typos in qemu_monitor_text.c

* src/qemu/qemu_monitor_text.c (qemuMonitorTextChangeMedia)

14 years agoqemu: record timestamp in qemu domain log
Osier Yang [Tue, 16 Nov 2010 15:39:26 +0000 (23:39 +0800)]
qemu: record timestamp in qemu domain log

Currently only support domain start and shutdown, for domain start,
record timestamp before the qemu command line, and for domain shutdown,
just say it's shutting down with timestamp.

* src/qemu/qemu_driver.c (qemudStartVMDaemon, qemudShutdownVMDaemon
  introduced two macros - START_POSTFIX, SHUTDOWN_POSTFIX)

14 years agovirsh: add net-info command
Osier Yang [Tue, 16 Nov 2010 07:48:47 +0000 (15:48 +0800)]
virsh: add net-info command

To list basic information about the network.

* tools/virsh.c
* tools/virsh.pod

14 years agonwfilter: use /bin/sh rather than requiring bash
Eric Blake [Tue, 16 Nov 2010 14:53:32 +0000 (07:53 -0700)]
nwfilter: use /bin/sh rather than requiring bash

* src/nwfilter/nwfilter_ebiptables_driver.c (CMD_EXEC): Fix syntax
error in previous patch.
Reported by Stefan Berger.

14 years agonwfilter: use /bin/sh rather than requiring bash
Eric Blake [Sat, 13 Nov 2010 21:48:02 +0000 (14:48 -0700)]
nwfilter: use /bin/sh rather than requiring bash

* src/nwfilter/nwfilter_ebiptables_driver.c
(ebiptablesWriteToTempFile): Use /bin/sh.
(bash_cmd_path): Delete.
(ebiptablesDriverInit, ebiptablesDriverShutdown): No need to
search for bash.
(CMD_EXEC): Prefer $() over ``, since we can assume POSIX.
(iptablesSetupVirtInPost): Use portable 'test' syntax.
(iptablesLinkIPTablesBaseChain): Use POSIX $(()) syntax.

14 years agointerface.rng: Make miimon and arpmon optional for bond interfaces
Laine Stump [Mon, 15 Nov 2010 18:31:31 +0000 (13:31 -0500)]
interface.rng: Make miimon and arpmon optional for bond interfaces

This has been optional in netcf for awhile, but the change hadn't been
propogated to the libvirt copy of the RNG.

14 years agomacvtap: convert send / recv function to use libnl
Stefan Berger [Mon, 15 Nov 2010 18:58:55 +0000 (13:58 -0500)]
macvtap: convert send / recv function to use libnl

In a second step I am converting the netlink send/receive functions to
use libnl.

I tested this with 802.1Qbg profiles and my test server and did not see
a regression.

Caveat: The online documentation of libnl talks about nl_socket_alloc()
but the header file provides nl_handle_alloc() -- this could be a hint
to a possible problem between libnl versions...

http://www.infradead.org/~tgr/libnl/doc/group__socket.html

versus

http://libnl.sourcearchive.com/documentation/1.1/group__socket_gf903c9ea089735b1ba8e40dae801c47d.html

14 years agoFix ipv4-addr definition in interface.rng
Laine Stump [Fri, 12 Nov 2010 21:12:55 +0000 (16:12 -0500)]
Fix ipv4-addr definition in interface.rng

Eric Blake pointed out a deficiency in this regex when it was
copy-pasted into network.rng. This is just propogating the fix back to
its origin.

14 years agoUse python discovered through env instead of hardcoding a path
Matthias Bolte [Sat, 13 Nov 2010 15:34:57 +0000 (16:34 +0100)]
Use python discovered through env instead of hardcoding a path

This is more flexible regarding the location of the python binary
but doesn't allow to pass the -u flag. The -i flag can be passed
from inside the script using the PYTHONINSPECT env variable.

This fixes a problem with the esx_vi_generator.py on FreeBSD.

14 years agoesx: Avoid warnings about breaking strict-aliasing rules on FreeBSD
Matthias Bolte [Sat, 13 Nov 2010 13:32:06 +0000 (14:32 +0100)]
esx: Avoid warnings about breaking strict-aliasing rules on FreeBSD

14 years agoMake sure struct sockaddr_in is defined on FreeBSD
Matthias Bolte [Sat, 13 Nov 2010 13:07:53 +0000 (14:07 +0100)]
Make sure struct sockaddr_in is defined on FreeBSD

14 years agoconfigure: Disable FS storage driver if mntent.h is not available
Matthias Bolte [Sat, 13 Nov 2010 11:33:44 +0000 (12:33 +0100)]
configure: Disable FS storage driver if mntent.h is not available

This is the case on FreeBSD.

14 years agodaemon: Include stdlib.h in dispatch.c
Matthias Bolte [Sat, 13 Nov 2010 11:28:48 +0000 (12:28 +0100)]
daemon: Include stdlib.h in dispatch.c

Otherwise GCC complains about malloc being unknown on FreeBSD.

14 years agodocs: updated virsh command reference with libvirt.org links
Justin Clift [Sat, 13 Nov 2010 13:00:46 +0000 (00:00 +1100)]
docs: updated virsh command reference with libvirt.org links

14 years agoconfigure: Remove bashism and replace 'test ==' with 'test ='
Matthias Bolte [Fri, 12 Nov 2010 20:38:27 +0000 (21:38 +0100)]
configure: Remove bashism and replace 'test ==' with 'test ='

This also fixes configure problems on FreeBSD, as test doesn't
understand '==' there.

14 years agovirsh: Fix compile error in VPATH build
Matthias Bolte [Thu, 11 Nov 2010 23:59:12 +0000 (00:59 +0100)]
virsh: Fix compile error in VPATH build

tools/console.c depends on daemon/event.h.

14 years agoGenerate HACKING from docs/hacking.html.in
Matthias Bolte [Fri, 12 Nov 2010 14:36:53 +0000 (15:36 +0100)]
Generate HACKING from docs/hacking.html.in

14 years agodocs: Prepare hacking.html.in to generate HACKING from it
Matthias Bolte [Fri, 12 Nov 2010 14:33:00 +0000 (15:33 +0100)]
docs: Prepare hacking.html.in to generate HACKING from it

Tweak pre tags to achieve proper indentation of their
plaintext representation. Also use more b/i/code tags.

14 years agodocs: updated csharp pages with latest info
Justin Clift [Fri, 12 Nov 2010 18:07:37 +0000 (05:07 +1100)]
docs: updated csharp pages with latest info

14 years agodocs: trivial typo fix
Justin Clift [Fri, 12 Nov 2010 17:34:26 +0000 (04:34 +1100)]
docs: trivial typo fix

14 years agodocs: added virsh command reference page.
Justin Clift [Fri, 12 Nov 2010 16:40:38 +0000 (03:40 +1100)]
docs: added virsh command reference page.

Using temporary location links for the moment, until we get a
proper place to store the files on the libvirt.org server.

14 years agorpm: Fix summary wording
Cole Robinson [Thu, 11 Nov 2010 17:21:28 +0000 (12:21 -0500)]
rpm: Fix summary wording

14 years agoqemu: Remove unnecessary quoting from the process name argument
John Morrissey [Fri, 12 Nov 2010 13:19:20 +0000 (14:19 +0100)]
qemu: Remove unnecessary quoting from the process name argument

14 years agophyp: Don't do a flags check in the storage driver
Matthias Bolte [Fri, 12 Nov 2010 12:58:16 +0000 (13:58 +0100)]
phyp: Don't do a flags check in the storage driver

This makes the storage driver fail when the connection is
opened with the VIR_CONNECT_RO flag, resulting in a read-only
connection with no storage driver.

14 years agoqemu: Add qemu-system-s390x to the emulators list
Matthias Bolte [Thu, 11 Nov 2010 18:44:20 +0000 (19:44 +0100)]
qemu: Add qemu-system-s390x to the emulators list

14 years agomacvtap: convert nl msg construction to use libnl
Stefan Berger [Fri, 12 Nov 2010 12:14:01 +0000 (07:14 -0500)]
macvtap: convert nl msg construction to use libnl

In a first step I am converting the netlink message construction in
macvtap code to use libnl. It's pretty much a 1:1 conversion except that
now the message needs to be allocated and deallocated.

14 years agoDo a better job of validating IP and MAC addresses in network.rng
Laine Stump [Thu, 11 Nov 2010 20:29:01 +0000 (15:29 -0500)]
Do a better job of validating IP and MAC addresses in network.rng

IP addresses and MAC addresses had been defined in the RNG simply as
<text/> meaning that, according to the RNG, any string could go in
there. Of course the C parsing code does a much better job of
validating, but we may as well have this describing the contents
accurately (even though it's currently only used during "make check").

14 years agore-indent network.rng following structural change
Laine Stump [Thu, 11 Nov 2010 20:17:34 +0000 (15:17 -0500)]
re-indent network.rng following structural change

This commit is whitespace changes only, do avoid obscuring actual code
changes.

14 years agoPut network.rng contents inside <grammar> for uniformity with other RNGs
Laine Stump [Thu, 11 Nov 2010 19:48:51 +0000 (14:48 -0500)]
Put network.rng contents inside <grammar> for uniformity with other RNGs

All the other RNG files in libvirt are enclosed within <grammar>. This
commit makes the syntactical changes necessary to make network.rng fit
that pattern. (This is the first step in adding some data type
definitions to network.rng for more exact validation of IP and MAC
addresses).

Formatting changes (indentation) will be done in a subsequent commit,
so that actual changes to the code won't be obscured by whitespace.

14 years agovirt-aa-helper should require <uuid> in XML
Jamie Strandboge [Thu, 11 Nov 2010 21:59:50 +0000 (14:59 -0700)]
virt-aa-helper should require <uuid> in XML

When <uuid> is not in the XML, a virUUIDGenerate() ends up being called which
is unnecessary and can lead to crashes if /dev/urandom isn't available
because virRandomInitialize() is not called within virt-aa-helper. This patch
adds verify_xpath_context() and updates caps_mockup() to use it.

Bug-Ubuntu: https://launchpad.net/bugs/672943

14 years agoesx: Support SMBIOS host mode
Matthias Bolte [Wed, 10 Nov 2010 19:05:51 +0000 (20:05 +0100)]
esx: Support SMBIOS host mode

14 years agoremote_driver.c: fix non-literal format strings w/o args
Laine Stump [Thu, 11 Nov 2010 17:05:21 +0000 (12:05 -0500)]
remote_driver.c: fix non-literal format strings w/o args

14 years agoignore SELinuxSetFilecon error in SELinuxSetSecurityFileLabel if on nfs
Laine Stump [Wed, 10 Nov 2010 19:39:43 +0000 (14:39 -0500)]
ignore SELinuxSetFilecon error in SELinuxSetSecurityFileLabel if on nfs

If virDomainAttachDevice() was called with an image that was located
on a root-squashed NFS server, and in a directory that was unreadable
by root on the machine running libvirtd, the attach would fail due to
an attempt to change the selinux label of the image with EACCES (which
isn't covered as an ignore case in SELinuxSetFilecon())

NFS doesn't support SELinux labelling anyway, so we mimic the failure
handling of commit 93a18bbafaf11729d3ca1241e11bee133d77fa77, which
just ignores the errors if the target is on an NFS filesystem (in
SELinuxSetSecurityAllLabel() only, though.)

This can be seen as a follow-on to commit
347d266c51705f4987fa5ce2a0ecb314ed8745ce, which ignores file open
failures of files on NFS that occur directly in
virDomainDiskDefForeachPath() (also necessary), but does not ignore
failures in functions that are called from there (eg
SELinuxSetSecurityFileLabel()).

14 years agoFix reference counting bug in virsh console
Daniel P. Berrange [Thu, 11 Nov 2010 15:15:46 +0000 (15:15 +0000)]
Fix reference counting bug in virsh console

The event watches need to be removed before the event loop
terminates, otherwise they cause a dangling reference to
be held on the virStreamPtr, which in turns holds a reference
on virConnectPtr, which in turn causes errors like

  "Failed to disconnect from the hypervisor"

* tools/console.c: Remove watches before event loop quits
* tools/virsh.c: Print out dangling reference count

14 years agoWire up virDomainOpenConsole for LXC, Xen and UML
Daniel P. Berrange [Fri, 22 Oct 2010 13:40:26 +0000 (14:40 +0100)]
Wire up virDomainOpenConsole for LXC, Xen and UML

Introduce implementations of the virDomainOpenConsole() API
for LXC, Xen and UML drivers.

* src/lxc/lxc_driver.c, src/lxc/lxc_driver.c,
  src/xen/xen_driver.c: Wire up virDomainOpenConsole

14 years agoFix busy-wait loop on closed file descriptor
Daniel P. Berrange [Tue, 17 Aug 2010 15:30:51 +0000 (16:30 +0100)]
Fix busy-wait loop on closed file descriptor

When closing open streams after a client quits, the event
callback was not removed. This mean that poll() was using
a closed FD and returning POLLNVAL in a busy-wait loop.

* daemon/stream.c: Disconnect stream callbacks

14 years agoRe-write virsh console to use streams
Daniel P. Berrange [Tue, 27 Jul 2010 09:40:30 +0000 (10:40 +0100)]
Re-write virsh console to use streams

This re-writes the 'virsh console' command so that it uses
the new streams API. This lets it run remotely and/or as a
non-root user. This requires that virsh be linked against
the simple event loop from libvirtd in daemon/event.c
As an added bonus, it can now connect to any console device,
not just the first one.

* tools/Makefile.am: Link to event.c
* tools/console.c, tools/console.h: Rewrite to use the
  virDomainOpenConsole() APIs with streams
* tools/virsh.c: Support choosing the console name
  via --devname $NAME

14 years agoConvert daemon/events.c to use virMutex and virThread
Daniel P. Berrange [Tue, 2 Nov 2010 15:56:44 +0000 (15:56 +0000)]
Convert daemon/events.c to use virMutex and virThread

The code currently uses pthreads APIs directly. This is not
portable to Win32 threads. Switch it over to use the portability
APIs. Also add a wrapper for pipe() which is subtely different
on Win32

* daemon/event.c: Switch to use virMutex & virThread.

14 years agoIntroduce portability APIs for creating threads
Daniel P. Berrange [Tue, 2 Nov 2010 17:17:47 +0000 (17:17 +0000)]
Introduce portability APIs for creating threads

The util/threads.c/h code already has APIs for mutexes,
condition variables and thread locals. This commit adds
in code for actually creating threads.

* src/libvirt_private.syms: Export new symbols
* src/util/threads.h: Define APIs virThreadCreate, virThreadSelf,
  virThreadIsSelf and virThreadJoin
* src/util/threads-win32.c, src/util/threads-win32.h: Win32
  impl of threads
* src/util/threads-pthread.c, src/util/threads-pthread.h: POSIX
  impl of threads

14 years agoSupport virDomainOpenConsole with QEMU
Daniel P. Berrange [Fri, 23 Jul 2010 15:00:07 +0000 (16:00 +0100)]
Support virDomainOpenConsole with QEMU

This provides an implementation of the virDomainOpenConsole
API with the QEMU driver. For the streams code, this reuses
most of the code previously added for the tunnelled migration
streams since it is generic.

* src/qemu/qemu_driver.c: Support virDomainOpenConsole

14 years agoAdd a generic internal API for handling any FD based stream
Daniel P. Berrange [Wed, 22 Sep 2010 18:32:21 +0000 (19:32 +0100)]
Add a generic internal API for handling any FD based stream

To avoid the need for duplicating implementations of virStream
drivers, provide a generic implementation that can handle any
FD based stream. This code is copied from the existing impl
in the QEMU driver, with the locking moved into the stream
impl, and addition of a read callback

The FD stream code will refuse to operate on regular files or
block devices, since those can't report EAGAIN properly when
they would block on I/O

* include/libvirt/virterror.h, include/libvirt/virterror.h: Add
  VIR_FROM_STREAM error domain
* src/qemu/qemu_driver.c: Remove code obsoleted by the new
  generic streams driver.
* src/fdstream.h, src/fdstream.c, src/fdstream.c,
  src/libvirt_private.syms: Generic reusable FD based streams

14 years agoLower logging level in remote driver streams
Daniel P. Berrange [Mon, 23 Aug 2010 13:43:11 +0000 (14:43 +0100)]
Lower logging level in remote driver streams

Now that bi-directional, non-blocking streams are supported
in the remote driver, some of the VIR_WARN statements need
to be reduced to VIR_DEBUG.

* src/remote/remote_driver.c: Lower logging level

14 years agoRemote driver client and server for virDomainOpenConsole
Daniel P. Berrange [Fri, 23 Jul 2010 12:57:14 +0000 (13:57 +0100)]
Remote driver client and server for virDomainOpenConsole

This provides an implementation of the virDomainOpenConsole
API for the remote driver client and server.

* daemon/remote.c: Server side impl
* src/remote/remote_driver.c: Client impl
* src/remote/remote_protocol.x: Wire definition

14 years agoIntroduce a virDomainOpenConsole API
Daniel P. Berrange [Fri, 23 Jul 2010 12:34:31 +0000 (13:34 +0100)]
Introduce a virDomainOpenConsole API

To enable virsh console (or equivalent) to be used remotely
it is necessary to provide remote access to the /dev/pts/XXX
pseudo-TTY associated with the console/serial/parallel device
in the guest. The virStream API provide a bi-directional I/O
stream capability that can be used for this purpose. This
patch thus introduces a virDomainOpenConsole API that uses
the stream APIs.

* src/libvirt.c, src/libvirt_public.syms,
  include/libvirt/libvirt.h.in, src/driver.h: Define the
  new virDomainOpenConsole API
* src/esx/esx_driver.c, src/lxc/lxc_driver.c,
  src/opennebula/one_driver.c, src/openvz/openvz_driver.c,
  src/phyp/phyp_driver.c, src/qemu/qemu_driver.c,
  src/remote/remote_driver.c, src/test/test_driver.c,
  src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
  src/xen/xen_driver.c, src/xenapi/xenapi_driver.c: Stub
  API entry point

14 years agoSupport callbacks on virStream APIs in remote driver client
Daniel P. Berrange [Fri, 23 Jul 2010 12:24:37 +0000 (13:24 +0100)]
Support callbacks on virStream APIs in remote driver client

The current remote driver code for streams only supports
blocking I/O mode. This is fine for the usage with migration
but is a problem for more general use cases, in particular
bi-directional streams.

This adds supported for the stream callbacks and non-blocking
I/O. with the minor caveat is that it doesn't actually do
non-blocking I/O for sending stream data, only receiving it.
A future patch will try to do non-blocking sends, but this is
quite tricky to get right.

* src/remote/remote_driver.c: Allow non-blocking I/O for
  streams and support callbacks

14 years agoFix LXC container console device setup
Daniel P. Berrange [Fri, 5 Nov 2010 13:27:34 +0000 (13:27 +0000)]
Fix LXC container console device setup

The /dev/console device inside the container must NOT map
to the real /dev/console device node, since this allows the
container control over the current host console. A fun side
effect of this is that starting a container containing a
real Fedora OS will kill off your X server.

Remove the /dev/console node, and replace it with a symlink
to the primary console TTY

* src/lxc/lxc_container.c: Replace /dev/console with a
  symlink to /dev/pty/0
* src/lxc/lxc_controller.c: Remove /dev/console from cgroups
  ACL

14 years agovirsh: supply long option for -V
Eric Blake [Tue, 9 Nov 2010 20:44:47 +0000 (13:44 -0700)]
virsh: supply long option for -V

* tools/virsh.c (vshParseArgv): Use NULL instead of 0 for pointer,
and symbolic names for has_arg.  Give --version an optional arg.
(vshUsage): Document this.
* tools/virsh.pod: Likewise.

14 years agoqemu: Add flag to force a CDROM eject
Cole Robinson [Mon, 8 Nov 2010 17:52:48 +0000 (12:52 -0500)]
qemu: Add flag to force a CDROM eject

QEMU allows forcing a CDROM eject even if the guest has locked the device.
Expose this via a new UpdateDevice flag, VIR_DOMAIN_DEVICE_MODIFY_FORCE.

This has been requested for RHEV:

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

v2: Change flag name, bool cleanups

14 years agorpm: fix /var/lib/libvirt permissions
Eric Blake [Wed, 3 Nov 2010 21:20:24 +0000 (15:20 -0600)]
rpm: fix /var/lib/libvirt permissions

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

Regression of forcing 0700 permissions (which breaks guest startup
because the qemu user can't see /var/lib/libvirt/*.monitor) was
introduced in commit 66823690e, as part of libvirt 0.8.2.

* libvirt.spec.in (%files): Drop %{_localstatedir}/lib/libvirt,
since libvirt depends on libvirt-client.
(%files client): Guarantee 755 permissions on
%(_localstatedir}/lib/libvirt, since the qemu user must be able to
do pathname resolution to a subdirectory.

14 years agoAugment bug reporting documentation
Daniel Veillard [Wed, 10 Nov 2010 12:16:37 +0000 (13:16 +0100)]
Augment bug reporting documentation

With some instruction on how to attach useful gdb backtraces

14 years agoAllow non-file disk backingStores
Adam Litke [Wed, 3 Nov 2010 15:50:11 +0000 (10:50 -0500)]
Allow non-file disk backingStores

I am trying to use a qcow image with libvirt where the backing 'file' is a
qemu-nbd server.  Unfortunately virDomainDiskDefForeachPath() assumes that
backingStore is always a real file so something like 'nbd:0:3333' is rejected
because a file with that name cannot be accessed.  Note that I am not worried
about directly using nbd images.  That would require a new disk type with XML
markup, etc.  I only want it to be permitted as a backingStore

The following patch implements danpb's suggestion:
> I think I'm inclined to push the logic for skipping NBD one stage higher.
> I'd rather expect virStorageFileGetMetadata() to return all backing
> stores, even if not files. The virDomainDiskDefForeachPath() method
> should definitely ignore non-file backing stores though.
>
> So what I'm thinking is to extend the virStorageFileMetadata struct and
> just add a 'bool isFile' field to it. Default this field to true, unless
> you see the prefix of nbd: in which case set it to false. The
> virDomainDiskDefForeachPath() method can then skip over any backing
> store with isFile == false

Signed-off-by: Adam Litke <agl@us.ibm.com>
Cc: Daniel P. Berrange <berrange@redhat.com>
14 years agoxencapstest: Don't fail when Xen is installed
Matthias Bolte [Tue, 9 Nov 2010 22:38:12 +0000 (23:38 +0100)]
xencapstest: Don't fail when Xen is installed

xencapstest calls xenHypervisorMakeCapabilitiesInternal with conn == NULL
which calls xenDaemonNodeGetTopology with conn == NULL when a recent
enough Xen was detected (sys_interface_version >= SYS_IFACE_MIN_VERS_NUMA).
But xenDaemonNodeGetTopology insists in having conn != NULL and fails,
because it expects to be able to talk to an actual xend.

We cannot do that in a 'make check' test. Therefore, only call the xend
subdriver function when conn isn't NULL.

Reported by Andy Howell and Jim Fehlig.

14 years agovirsh: fix non-literal string format
Laine Stump [Tue, 9 Nov 2010 22:37:05 +0000 (17:37 -0500)]
virsh: fix non-literal string format

These are in the newly added -V output.

14 years agobye to close(), welcome to VIR_(FORCE_)CLOSE()
Stefan Berger [Tue, 9 Nov 2010 20:48:48 +0000 (15:48 -0500)]
bye to close(), welcome to VIR_(FORCE_)CLOSE()

Using automated replacement with sed and editing I have now replaced all
occurrences of close() with VIR_(FORCE_)CLOSE() except for one, of
course. Some replacements were straight forward, others I needed to pay
attention. I hope I payed attention in all the right places... Please
have a look. This should have at least solved one more double-close
error.

14 years agoFix syntax-check error in domain.rng
Matthias Bolte [Tue, 9 Nov 2010 19:02:35 +0000 (20:02 +0100)]
Fix syntax-check error in domain.rng

Replace tab with spaces.

14 years agoesx: Add support for memtune/min_guarantee
Matthias Bolte [Sat, 6 Nov 2010 17:53:39 +0000 (18:53 +0100)]
esx: Add support for memtune/min_guarantee

Also add a test case for the VMX handling of it.

14 years agoschema: Move timer element inside clock
Jiri Denemark [Mon, 8 Nov 2010 11:27:41 +0000 (12:27 +0100)]
schema: Move timer element inside clock

Both conf/domain_conf.c and domain XML documentation have <timer>
elements inside /domain/clock. Change domain.rng schema to be consistent
with them.

14 years agoMisc test case fixes for SPICE
Daniel P. Berrange [Tue, 9 Nov 2010 13:51:21 +0000 (13:51 +0000)]
Misc test case fixes for SPICE

* docs/schemas/domain.rng: Fix merge error which left SPICE channel
  elements under VNC schema.
* tests/qemuhelptest.c: Add SPICE flag to kvm-83 test
* tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml: Add
  <memballoon> element

14 years agovirsh: Add .xml suffix to tmp files used in *edit commands
Jiri Denemark [Tue, 9 Nov 2010 09:27:09 +0000 (10:27 +0100)]
virsh: Add .xml suffix to tmp files used in *edit commands

This helps editors with detecting the temporary files as XML since the
temporary files do not contain <?xml ...?> declaration.

Requested by https://bugzilla.redhat.com/show_bug.cgi?id=602277

14 years agoSupport SPICE channel security options
Daniel P. Berrange [Fri, 9 Apr 2010 16:56:00 +0000 (17:56 +0100)]
Support SPICE channel security options

This extends the SPICE XML to allow channel security options

    <graphics type='spice' port='-1' tlsPort='-1' autoport='yes'>
      <channel name='main' mode='secure'/>
      <channel name='record' mode='insecure'/>
    </graphics>

Any non-specified channel uses the default, which allows both
secure & insecure usage

* src/conf/domain_conf.c, src/conf/domain_conf.h,
  src/libvirt_private.syms: Add XML syntax for specifying per
  channel security options for spice.
* src/qemu/qemu_conf.c: Configure channel security with spice

14 years agoSupport multiple QXL video cards
Daniel P. Berrange [Fri, 9 Apr 2010 16:26:06 +0000 (17:26 +0100)]
Support multiple QXL video cards

QEMU crashes & burns if you try multiple Cirrus video cards, but
QXL copes fine. Adapt QEMU config code to allow multiple QXL
video cards

* src/qemu/qemu_conf.c: Support multiple QXL video cards

14 years agoDefine XML syntax for password expiry
Daniel P. Berrange [Thu, 8 Apr 2010 12:43:23 +0000 (13:43 +0100)]
Define XML syntax for password expiry

This extends the XML syntax for <graphics> to allow a password
expiry time to be set

eg

  <graphics type='vnc' port='5900' autoport='yes' keymap='en-us' passwd='12345' passwdValidTo='2010-04-09T15:51:00'/>

The timestamp is in UTC.

* src/conf/domain_conf.h: Pull passwd out into separate struct
  virDomainGraphicsAuthDef to allow sharing between VNC & SPICE
* src/conf/domain_conf.c: Add parsing/formatting of new passwdValidTo
  argument
* src/opennebula/one_conf.c, src/qemu/qemu_conf.c, src/qemu/qemu_driver.c,
  src/xen/xend_internal.c, src/xen/xm_internal.c: Update for changed
  struct containing VNC password

14 years agoAdd SPICE support for QEMU driver configuration file
Daniel P. Berrange [Fri, 5 Mar 2010 20:31:50 +0000 (20:31 +0000)]
Add SPICE support for QEMU driver configuration file

In common with VNC, the QEMU driver configuration file is used
specify the host level TLS certificate location and a default
password / listen address

* src/qemu/qemu.conf: Add spice_listen, spice_tls,
  spice_tls_x509_cert_dir & spice_password config params
* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Parsing of
  spice config parameters and updating -spice arg generation
  to use them
* tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-rhel6.args,
  tests/qemuxml2argvtest.c: Expand test case to cover driver
  level configuration

14 years agoSupport automatic port number allocation for SPICE
Daniel P. Berrange [Fri, 5 Mar 2010 20:22:45 +0000 (20:22 +0000)]
Support automatic port number allocation for SPICE

* src/qemu/qemu_driver.c: Allocate the TCP ports for SPICE
  before starting guest