]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
15 years agoFix error messages when parsing USB devices in QEMU
Rolf Eike Beer [Mon, 1 Mar 2010 21:00:37 +0000 (21:00 +0000)]
Fix error messages when parsing USB devices in QEMU

A number of the error messages raised when parsing USB devices
refered to PCI devices by mistake

* src/qemu/qemu_conf.c: s/PCI/USB/ in qemuParseCommandLineUSB()

15 years agoFix USB hotplug device string in QEMU driver
Rolf Eike Beer [Mon, 1 Mar 2010 20:59:05 +0000 (20:59 +0000)]
Fix USB hotplug device string in QEMU driver

The USB hotplug method was mistakenly generating a PCI address
string

* src/qemu/qemu_driver.c: Fix USB hotplug device string

15 years agoUse device_del to remove SCSI controllers
Wolfgang Mauerer [Tue, 2 Mar 2010 08:40:51 +0000 (09:40 +0100)]
Use device_del to remove SCSI controllers

when the underlying qemu supports the drive/device model and the
controller has been added this way.
* src/qemu/qemu_driver.c: use qemuMonitorDelDevice() when detaching
  PCI controller and if supported
* src/qemu/qemu_monitor.[ch]: add new qemuMonitorDelDevice() function
* src/qemu/qemu_monitor_json.[ch]: JSON backend for DelDevice command
* src/qemu/qemu_monitor_text.[ch]: Text backend for DelDevice command

15 years agoFix PCI address handling when controllers are deleted
Wolfgang Mauerer [Tue, 2 Mar 2010 08:28:26 +0000 (09:28 +0100)]
Fix PCI address handling when controllers are deleted

* src/qemu/qemu_driver.c: in qemudDomainDetachPciControllerDevice()
  when a controller is not present in the system anymore, the PCI
  address must be deleted from libvirt's hashtable because it can
  be re-used for other purposes.

15 years agoFix data structure handling when controllers are attached
Wolfgang Mauerer [Tue, 2 Mar 2010 08:24:59 +0000 (09:24 +0100)]
Fix data structure handling when controllers are attached

* src/qemu/qemu_driver.c: in qemudDomainAttachDevice(), one must not
  delete the data part when the operation succeeds because it is
  required later on. The correct pattern to handlethe parsed
  representation of the device information on success
  is dev->data.controller = NULL; virDomainDeviceDefFree(dev);,
  which leaves the structure pointed at by data in memory.

15 years agoTiny spelling fix
Wolfgang Mauerer [Tue, 2 Mar 2010 08:21:48 +0000 (09:21 +0100)]
Tiny spelling fix

15 years agolibvirtd: avoid false-positive NULL-deref warning from clang
Eric Blake [Mon, 1 Mar 2010 18:59:43 +0000 (11:59 -0700)]
libvirtd: avoid false-positive NULL-deref warning from clang

* daemon/libvirtd.c (qemudWorker): Rewrite loop to silence a
warning.

15 years agox86Decode: avoid NULL-dereference upon questionable input
Jim Meyering [Sun, 28 Feb 2010 12:34:06 +0000 (13:34 +0100)]
x86Decode: avoid NULL-dereference upon questionable input

* src/cpu/cpu_x86.c (x86Decode): Don't dereference NULL when passed
a NULL "models" pointer, or when passed a nonzero "nmodels" value
and a corresponding NULL models[i].

15 years agophypUUIDTable_Push: do not corrupt output stream upon partial write
Jim Meyering [Mon, 1 Mar 2010 20:26:59 +0000 (21:26 +0100)]
phypUUIDTable_Push: do not corrupt output stream upon partial write

* src/phyp/phyp_driver.c (phypUUIDTable_Push): Move incr/decr
of ptr/nread into the loop where those variables are used.
Also, remove "exit" label and just-preceding "goto".

15 years agoopenvzDomainDefineCmd: remove useless increment
Jim Meyering [Mon, 1 Mar 2010 20:38:06 +0000 (21:38 +0100)]
openvzDomainDefineCmd: remove useless increment

* src/openvz/openvz_driver.c (openvzDomainDefineCmd): Remove
useless increment of "max_veid".

15 years agomaint: disallow TAB-in-indentation also in *.rng files
Jim Meyering [Mon, 1 Mar 2010 19:05:06 +0000 (20:05 +0100)]
maint: disallow TAB-in-indentation also in *.rng files

* cfg.mk (sc_TAB_in_indentation): Also check .rng files.

15 years agomaint: convert leading TABs in *.rng files to equivalent spaces
Jim Meyering [Mon, 1 Mar 2010 19:09:26 +0000 (20:09 +0100)]
maint: convert leading TABs in *.rng files to equivalent spaces

* docs/schemas/capability.rng: Likewise.
* docs/schemas/network.rng: Likewise.
* docs/schemas/nodedev.rng: Likewise.
* docs/schemas/storagepool.rng: Likewise.
* docs/schemas/storagevol.rng: Likewise.
Use these commands:
t=$'\t'
git ls-files | grep '\.rng$' | xargs grep -lE "^ *$t" \
  | xargs perl -MText::Tabs -ni -le \
    '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'

15 years agoExpand docs about clock modes
Daniel P. Berrange [Tue, 2 Feb 2010 18:46:52 +0000 (18:46 +0000)]
Expand docs about clock modes

* formatdomain.html.in: Document new clock options

15 years agoAllow configurable timezones with QEMU
Daniel P. Berrange [Tue, 2 Feb 2010 18:37:33 +0000 (18:37 +0000)]
Allow configurable timezones with QEMU

Allow an arbitrary timezone with QEMU by setting the $TZ environment
variable when launching QEMU

* src/qemu/qemu_conf.c: Set TZ environment variable if a timezone
  is requested
* tests/qemuxml2argvtest.c: Add test case for timezones
* tests/qemuxml2argvdata/qemuxml2argv-clock-france.xml,
  tests/qemuxml2argvdata/qemuxml2argv-clock-france.args: Data
  for timezone tests

15 years agoAllow a timezone to be specified instead of sync to host timezone
Daniel P. Berrange [Tue, 2 Feb 2010 18:28:44 +0000 (18:28 +0000)]
Allow a timezone to be specified instead of sync to host timezone

This extends the XML to allow for

  <clock offset='timezone' timezone='Europe/Paris'/>

This is useful if the admin has not configured any timezone on the
host OS, but still wants to synchronize a guest to a specific one.

* src/conf/domain_conf.h, src/conf/domain_conf.c: Support extra
  'timezone' attribute on clock configuration
* docs/schemas/domain.rng: Add 'timezone' attribute
* src/xen/xend_internal.c, src/xen/xm_internal.c: Reject configs
  with a configurable timezone

15 years agoSupport variable clock offset mode in QEMU
Daniel P. Berrange [Tue, 2 Feb 2010 18:07:12 +0000 (18:07 +0000)]
Support variable clock offset mode in QEMU

This allows QEMU guests to be started with an arbitrary clock
offset

The test case can't actually be enabled, since QEMU argv expects
an absolute timestring, and this will obviously change every
time the test runs :-( Hopefully QEMU will allow a relative
time offset in the future.

* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Use the -rtc arg
  if available to support variable clock offset mode
* tests/qemuhelptest.c: Add QEMUD_CMD_FLAG_RTC for qemu 0.12.1
* qemuxml2argvdata/qemuxml2argv-clock-variable.args,
  qemuxml2argvdata/qemuxml2argv-clock-variable.xml,
  qemuxml2argvtest.c: Test case, except we can't actually enable
  it yet.

15 years agoAdd new clock mode allowing variable adjustments
Daniel P. Berrange [Tue, 2 Feb 2010 17:49:09 +0000 (17:49 +0000)]
Add new clock mode allowing variable adjustments

This introduces a third option for clock offset synchronization,
that allows an arbitrary / variable adjustment to be set. In
essence the XML contains the time delta in seconds, relative to
UTC.

  <clock offset='variable' adjustment='123465'/>

The difference from 'utc' mode, is that management apps should
track adjustments and preserve them at next reboot.

* docs/schemas/domain.rng: Schema for new clock mode
* src/conf/domain_conf.c, src/conf/domain_conf.h: Parse
  new clock time delta
* src/libvirt_private.syms, src/util/xml.c, src/util/xml.h: Add
  virXPathLongLong() method

15 years agoChange the internal domain conf representation of localtime/utc
Daniel P. Berrange [Tue, 2 Feb 2010 17:22:03 +0000 (17:22 +0000)]
Change the internal domain conf representation of localtime/utc

The XML will soon be extended to allow more than just a simple
localtime/utc boolean flag. This change replaces the plain
'int localtime' with a separate struct to prepare for future
extension

* src/conf/domain_conf.c, src/conf/domain_conf.h: Add a new
  virDomainClockDef structure
* src/libvirt_private.syms: Export virDomainClockOffsetTypeToString
  and virDomainClockOffsetTypeFromString
* src/qemu/qemu_conf.c, src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
  src/xen/xm_internal.c: Updated to use new structure for localtime

15 years agoudevEnumerateDevices: remove dead code
Jim Meyering [Mon, 1 Mar 2010 15:14:35 +0000 (16:14 +0100)]
udevEnumerateDevices: remove dead code

* src/node_device/node_device_udev.c (udevEnumerateDevices): Remove
unnecessary call to udev_list_entry_get_name.

15 years agoqemudNetworkIfaceConnect: remove dead store
Jim Meyering [Mon, 1 Mar 2010 14:59:42 +0000 (15:59 +0100)]
qemudNetworkIfaceConnect: remove dead store

* src/qemu/qemu_conf.c (qemudNetworkIfaceConnect): Remove extraneous
virSaveLastError call, whose result was unused.

15 years agocmdPoolDiscoverSources: initialize earlier to avoid FP from clang
Jim Meyering [Mon, 1 Mar 2010 14:41:15 +0000 (15:41 +0100)]
cmdPoolDiscoverSources: initialize earlier to avoid FP from clang

* tools/virsh.c (cmdPoolDiscoverSources): Always initialize srcSpec.
Otherwise, clang would report that srcSpec could be used uninitialized
in the call to virConnectFindStoragePoolSources.

15 years agoqemu: avoid null dereference on failed migration
Eric Blake [Mon, 1 Mar 2010 14:34:33 +0000 (15:34 +0100)]
qemu: avoid null dereference on failed migration

* src/qemu/qemu_monitor_text.c: qemuMonitorTextGetMigrationStatus: Check for
  failed strchr, to silence a coverity warning.

15 years agoFree the macvtap mode string
Stefan Berger [Mon, 1 Mar 2010 12:09:42 +0000 (13:09 +0100)]
Free the macvtap mode string

* src/conf/domain_conf.c: forgot to free the attribute value in
  virDomainNetDefParseXML()

15 years agoUpdate of indian, spanish and russian translations
Daniel Veillard [Mon, 1 Mar 2010 11:14:23 +0000 (12:14 +0100)]
Update of indian, spanish and russian translations

and regeneration of the po/pot files

15 years agoRevert fs pool formatting
David Allan [Fri, 26 Feb 2010 08:32:17 +0000 (03:32 -0500)]
Revert fs pool formatting

* We are reverting this patch pending a discussion of the right way to implement.

15 years agobuild: update gnulib submodule to latest
Jim Meyering [Fri, 26 Feb 2010 16:14:01 +0000 (17:14 +0100)]
build: update gnulib submodule to latest

* .gnulib: Update to latest.
Commit 89bdf84bcd9c6032e37 inadvertently rewound the .gnulib
submodule by 51 commits.  This corrects it.
Spotted by Eric Blake.

15 years agobuild: avoid warning about return-with-value in void function
Jim Meyering [Fri, 26 Feb 2010 10:50:34 +0000 (11:50 +0100)]
build: avoid warning about return-with-value in void function

* tools/virsh.c: Just "return;", not "return NULL;".

15 years agolibvirtd: do not ignore failure to set group ID in privileged mode
Jim Meyering [Fri, 26 Feb 2010 09:42:14 +0000 (10:42 +0100)]
libvirtd: do not ignore failure to set group ID in privileged mode

* daemon/libvirtd.c (qemudListenUnix): Diagnose and fail upon
failure to set or restore group-ID.

15 years agoOnly build virDomainObjFormat if not building proxy.
Chris Lalancette [Wed, 24 Feb 2010 20:45:16 +0000 (15:45 -0500)]
Only build virDomainObjFormat if not building proxy.

While building under RHEL-5, I got a compile warning because
virDomainObjFormat was defined but not used.  That came about
because in RHEL-5 we build with "#define PROXY", and
virDomainObjFormat is only used with !PROXY.  Move the
define.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoopenvzGetVEID: don't leak (memory + file descriptor)
Jim Meyering [Thu, 25 Feb 2010 18:24:50 +0000 (19:24 +0100)]
openvzGetVEID: don't leak (memory + file descriptor)

* src/openvz/openvz_conf.c (openvzGetVEID): Always call fclose.
Diagnose parse failure also when vzlist output is empty.
If somehow we read a -1, diagnose that (albeit as a parse failure).

15 years agoUse standard spacing for user/pass prompt
Cole Robinson [Wed, 24 Feb 2010 19:19:28 +0000 (14:19 -0500)]
Use standard spacing for user/pass prompt

Kind of minor, but it annoys me that the default auth callback
doesn't put a space between the prompt and the input, like a typical
terminal, ssh, etc. This patch changes the current prompt:

Please enter your authentication name:myuser

to

Please enter your authentication name: myuser

15 years agolibvirtd: Better initscript error reporting
Cole Robinson [Tue, 23 Feb 2010 23:17:56 +0000 (18:17 -0500)]
libvirtd: Better initscript error reporting

From time to time I bork my install, and hate it when the initscript
returns no info. This patch removes the sanity check, which lets
the shell give us 'command not found' or 'permission denied' errors.

15 years agoqemu: Report binary path if error parsing -help
Cole Robinson [Wed, 24 Feb 2010 16:44:36 +0000 (11:44 -0500)]
qemu: Report binary path if error parsing -help

15 years agoremote: Improve daemon startup error reporting
Cole Robinson [Wed, 24 Feb 2010 16:29:35 +0000 (11:29 -0500)]
remote: Improve daemon startup error reporting

If I toggle enable_tcp in libvirtd.conf and add --listen in
/etc/init.d/libvirtd, I get the unhelpful error:

Starting libvirtd daemon: error: Unable to initialize network sockets.

Running without --daemon provides much more useful info:

sudo libvirtd --listen
11:29:26.117: error : remoteCheckCertFile:270 : Cannot access CA certificate '/etc/pki/CA/cacert.pem': No such file or directory

The daemon architecture makes it difficult to report this useful
info if daemonized, so point users to /var/log/messages and
dropping the --daemon flag if they want more info.

15 years agovirsh: Show errors reported by nonAPI functions
Cole Robinson [Wed, 24 Feb 2010 16:13:00 +0000 (11:13 -0500)]
virsh: Show errors reported by nonAPI functions

Only API calls trigger the error callback, which is required for
proper virsh error reporting. Since we use non API functions from
util/, make sure we properly report these errors.

Fixes lack of error message from 'virsh create idontexit.xml'

15 years agoremote: Improve error message when libvirtd isn't running
Cole Robinson [Wed, 24 Feb 2010 13:26:11 +0000 (08:26 -0500)]
remote: Improve error message when libvirtd isn't running

While this could lead people in the wrong direction, people most commonly
hit this error when libvirtd isn't running, so let's mention a possible
fix.

15 years agobuild: avoid warning about unused variables
Jim Meyering [Thu, 25 Feb 2010 13:19:33 +0000 (14:19 +0100)]
build: avoid warning about unused variables

* tools/virsh.c (cmdCPUBaseline): Remove declarations of unused
variables, p and cur.

15 years agobuild: avoid "make rpm" failure in docs/
Jim Meyering [Thu, 25 Feb 2010 09:35:20 +0000 (10:35 +0100)]
build: avoid "make rpm" failure in docs/

Add missing rule to build html/libvirt-libvirt.html.
Use a GNU Make pattern rule to avoid running apibuild.py once
for each out-of-date target, in a parallel build.
* docs/Makefile.am

15 years agobuild: teach apibuild.py to work in a non-srcdir build
Jim Meyering [Wed, 24 Feb 2010 21:51:47 +0000 (22:51 +0100)]
build: teach apibuild.py to work in a non-srcdir build

* docs/Makefile.am (libvirt-api.xml libvirt-refs.xml): Generalize
apibuild.py to work in a non-srcdir build.  Pass "srcdir" to it.
* docs/apibuild.py (rebuild): Honor the $srcdir envvar.

15 years agobuild: avoid non-srcdir "make distcheck" failures (CLEANFILES)
Jim Meyering [Thu, 25 Feb 2010 08:28:51 +0000 (09:28 +0100)]
build: avoid non-srcdir "make distcheck" failures (CLEANFILES)

* docs/Makefile.am (MAINTAINERCLEANFILES): Use this variable
for generated-and-distributed files, not "CLEANFILES".
Besides, "make clean" and "make distclean" should not delete
distributed files.

15 years agobuild: make git submodule checking more reliable
Jim Meyering [Wed, 24 Feb 2010 11:01:09 +0000 (12:01 +0100)]
build: make git submodule checking more reliable

* cfg.mk (_curr_status): Accommodate leading "+" or "-" in the output
of git submodule status.
* autogen.sh: Likewise.

15 years agobuild: avoid non-srcdir "make distcheck" failures (srcdir vs wildcard)
Jim Meyering [Wed, 24 Feb 2010 14:18:51 +0000 (15:18 +0100)]
build: avoid non-srcdir "make distcheck" failures (srcdir vs wildcard)

* tests/xencapsdata/Makefile.am: Use $(wildcard in $(srcdir)-aware manner
* tests/xmconfigdata/Makefile.am: Likewise.
* tests/xml2sexprdata/Makefile.am: Likewise.
* tests/sexpr2xmldata/Makefile.am (EXTRA_DIST): Likewise.
* Makefile.am (XML_EXAMPLES): Use $(wildcard in $(srcdir)-aware manner.

15 years agobuild: avoid non-srcdir "make distcheck" failure (test_conf.sh)
Jim Meyering [Wed, 24 Feb 2010 14:01:11 +0000 (15:01 +0100)]
build: avoid non-srcdir "make distcheck" failure (test_conf.sh)

* tests/confdata/Makefile.am (EXTRA_DIST): Apply $(wildcard... to
$(srcdir)/..., and then remove the prefix.

15 years agobuild: avoid non-srcdir installation failure (sitemap.html.in)
Jim Meyering [Wed, 24 Feb 2010 13:15:26 +0000 (14:15 +0100)]
build: avoid non-srcdir installation failure (sitemap.html.in)

* docs/Makefile.am (EXTRA_DIST): Add sitemap.html.in.

15 years agobuild: avoid non-srcdir installation failure (apibuild.py)
Jim Meyering [Wed, 24 Feb 2010 13:18:40 +0000 (14:18 +0100)]
build: avoid non-srcdir installation failure (apibuild.py)

* docs/Makefile.am (libvirt-api.xml): Insert missing "$(srcdir)/".
Also, remove unnecessary sub-shell.

15 years agobuild: fix typos in makefile variable names
Jim Meyering [Wed, 24 Feb 2010 11:04:27 +0000 (12:04 +0100)]
build: fix typos in makefile variable names

* configure.ac: Fix typos:
s/DRIVER_MODULES_CFLAGS/DRIVER_MODULE_CFLAGS/
s/DRIVER_MODULES_LIBS/DRIVER_MODULE_LIBS/

15 years agobuild: ensure that MKINSTALLDIRS is AC_SUBST-defined
Jim Meyering [Wed, 24 Feb 2010 09:53:44 +0000 (10:53 +0100)]
build: ensure that MKINSTALLDIRS is AC_SUBST-defined

since we're using gettext-0.14.1, which uses that now-obsolete
automake symbol.  Otherwise, make distcheck would fails like this:

    make[2]: Entering directory `/t/libvirt-0.7.6/_build/po'
    /bin/sh @MKINSTALLDIRS@ /t/libvirt-0.7.6/_inst/share
    /bin/sh: @MKINSTALLDIRS@: No such file or directory
    make[2]: *** [install-data-yes] Error 127

* configure.ac (MKINSTALLDIRS): Define.
For reference, we're currently hamstrung by our desire
to support RHEL5, which still uses gettext-0.14:
http://bugzilla.redhat.com/523713

15 years agomaint: relax git minimum version
Eric Blake [Wed, 24 Feb 2010 18:38:44 +0000 (11:38 -0700)]
maint: relax git minimum version

Requiring git 1.6.4, just for the optional GNULIB_SRCDIR support,
was too harsh.  Resynchronize from gnulib.

* .gnulib: Import from latest gnulib.
* bootstrap: Re-synchronize from .gnulib/build-aux.
* bootstrap.conf: Drop git to 1.5.5.
* README-hacking: Document use of GNULIB_SRCDIR.

15 years agoIgnore SIGWINCH in remote client call to poll(2) (RHBZ#567931).
Richard Jones [Wed, 24 Feb 2010 12:55:17 +0000 (12:55 +0000)]
Ignore SIGWINCH in remote client call to poll(2) (RHBZ#567931).

In bug 567931 we found that virt-top would exit occasionally
when the terminal window was resized.  Tracking this down it
turned out that SIGWINCH was being delivered to the process at
exactly the point where the libvirt remote driver was calling
poll(2) waiting for a reply from libvirtd.

This caused the poll(2) call to be interrupted (returning errno
EINTR).  However handling EINTR the same way as EAGAIN was not
the solution to this problem since we found previously that this
would break Ctrl-C handling (commit 47fec8eac2bb3).

The correct solution is to mask out SIGWINCH for the duration
of the poll(2) system call.  The per-thread mask is changed and
restored immediately after the call.  Since we are using
pthread_sigmask, this should not affect other threads, and
since we restore the signal mask immediately afterwards it should
not affect the current thread visibly either.  Other possibly
problematic signals are SIGCHLD and SIGPIPE and these are
masked too.

Note use of ignore_value: It's not fatal if we cannot mask out
SIGWINCH, and in any case pthread_sigmask never fails on Linux
as long as you supply the correct arguments.

I tested this patch and it cures the original problem with
virt-top.

15 years agoAdd descriptions for macvtap direct type interfaces
Stefan Berger [Wed, 24 Feb 2010 09:29:23 +0000 (10:29 +0100)]
Add descriptions for macvtap direct type interfaces

This adds a description about the 'direct' type of interface recently
added for macvtap device type support on the host.

15 years agoFormat FS pools on creation
Dave Allan [Wed, 24 Feb 2010 08:51:34 +0000 (09:51 +0100)]
Format FS pools on creation

Create the filesystem on the partition used by the pool
* configure.ac: check for mkfs availability
* libvirt.spec.in: add extra require on util-linux for mkfs
* src/storage/storage_backend_fs.c: run mkfs with the expected
  fs type when creating a filesystem pool

15 years agomaint: sort .gitignore
Eric Blake [Tue, 23 Feb 2010 00:01:34 +0000 (17:01 -0700)]
maint: sort .gitignore

Fallout from the new bootstrap.

* .gitignore: Commit sorting done by bootstrap.
* build-aux/.gitignore: Likewise.
* po/.gitignore: Likewise.

15 years agomaint: import modern bootstrap
Eric Blake [Tue, 23 Feb 2010 00:01:33 +0000 (17:01 -0700)]
maint: import modern bootstrap

Copy the latest gnulib bootstrap, which runs autoreconf and
generates po/Makevars for us.  Other improvements include some
improved prerequisite tool checking.

This also fixes a bug in the .pot files, regarding the copyright holder.

* bootstrap: Update to version in .gnulib/build-aux.
* bootstrap.conf (MSGID_BUGS_ADDRESS, COPYRIGHT_HOLDER, SKIP_PO)
(gnulib_mk, ACLOCAL, bootstrap_epilogue): Provide overrides.
* autogen.sh (autoreconf): Avoid redundant autoreconf if bootstrap
was run.
* po/Makevars: Delete, now that bootstrap creates it.
* po/.gitignore: Update.

15 years agomaint: start factoring bootstrap
Eric Blake [Tue, 23 Feb 2010 00:01:32 +0000 (17:01 -0700)]
maint: start factoring bootstrap

Borrow ideas from gnulib/build-aux/bootstrap, in order to factor the
specifics of libvirt into bootstrap.conf, while allowing future
upgrades of bootstrap to happen with less effort.

* bootstrap (gnulib_tool): Update invocation to be closer to
gnulib's version.  Move libvirt specifics...
* bootstrap.conf: ...into new file.

15 years agomaint: fix quoting in autogen.sh
Eric Blake [Tue, 23 Feb 2010 00:01:31 +0000 (17:01 -0700)]
maint: fix quoting in autogen.sh

* autogen.sh (srcdir, THEDIR, OBJ_DIR): Use proper quoting.
(.git-module-status): Abort if bootstrap fails.

15 years agobuild: update gnulib submodule to latest
Jim Meyering [Tue, 23 Feb 2010 16:54:32 +0000 (17:54 +0100)]
build: update gnulib submodule to latest

* cfg.mk (local-checks-to-skip): Disable sc_prohibit_hash_without_use
for now, since it fails with a false-positive match.

15 years agovirFork: placate static analyzers: ignore pthread_sigmask return value
Jim Meyering [Fri, 19 Feb 2010 17:40:14 +0000 (18:40 +0100)]
virFork: placate static analyzers: ignore pthread_sigmask return value

* src/util/util.c: Include "ignore-value.h".
(virFork): We really do want to ignore pthread_sigmask failure.

15 years agodocs: Fix syntax warnings from recent changes.
Cole Robinson [Tue, 23 Feb 2010 15:25:17 +0000 (10:25 -0500)]
docs: Fix syntax warnings from recent changes.

15 years agodocs: network: Document <domain> element
Cole Robinson [Mon, 22 Feb 2010 21:39:55 +0000 (16:39 -0500)]
docs: network: Document <domain> element

15 years agodocs: network: Document STP and delay attributes
Cole Robinson [Mon, 22 Feb 2010 21:26:44 +0000 (16:26 -0500)]
docs: network: Document STP and delay attributes

15 years agodocs: domain: Document <description> element
Cole Robinson [Mon, 22 Feb 2010 21:06:04 +0000 (16:06 -0500)]
docs: domain: Document <description> element

15 years agodocs: storage: Document multipath pools
Cole Robinson [Mon, 22 Feb 2010 22:02:08 +0000 (17:02 -0500)]
docs: storage: Document multipath pools

15 years agodocs: storage: Document SCSI pools
Cole Robinson [Mon, 22 Feb 2010 21:50:04 +0000 (16:50 -0500)]
docs: storage: Document SCSI pools

15 years agodocs: storage: Fix backingStore <format> docs
Cole Robinson [Mon, 22 Feb 2010 21:01:12 +0000 (16:01 -0500)]
docs: storage: Fix backingStore <format> docs

15 years agodocs: storage: <volume><key> is always generated.
Cole Robinson [Mon, 22 Feb 2010 20:54:06 +0000 (15:54 -0500)]
docs: storage: <volume><key> is always generated.

15 years agodocs: storage: Document capacity/alloc 'unit'
Cole Robinson [Mon, 22 Feb 2010 20:52:14 +0000 (15:52 -0500)]
docs: storage: Document capacity/alloc 'unit'

15 years agostorage: conf: Correctly calculate exabyte unit
Cole Robinson [Mon, 22 Feb 2010 20:49:27 +0000 (15:49 -0500)]
storage: conf: Correctly calculate exabyte unit

We were using 'Y' to mean exabyte, when the correct abbreviation would be
'E' ('Y' is yettabyte, which is exabyte * 1024 * 1024). While it isn't
strictly backwards compatible, I highly doubt anyone was actually using
this broken behavior, so I don't see any harm in in dropping 'Y' handling.

15 years agovirsh.c: avoid all leaks in OOM path in cmdCPUBaseline
Jiri Denemark [Tue, 23 Feb 2010 11:01:20 +0000 (12:01 +0100)]
virsh.c: avoid all leaks in OOM path in cmdCPUBaseline

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 years agoCreate raw storage files with O_DSYNC (again)
Jiri Denemark [Mon, 22 Feb 2010 11:24:02 +0000 (12:24 +0100)]
Create raw storage files with O_DSYNC (again)

Recently we introduced O_DSYNC flag when creating raw storage files to
avoid filling all disk cache with dirty pages. However, the patch got
lost when virStorageBackendCreateRaw was reworked using
virFileOperation. Let's use O_DSYNC again.

15 years agoFixed reference count in virsh pool-build command
David Allan [Sun, 21 Feb 2010 14:28:34 +0000 (15:28 +0100)]
Fixed reference count in virsh pool-build command

* tools/virsh.c: call virStoragePoolFree() in the main path too

15 years agodocs: add 3 missing spaces
Dan Kenigsberg [Sun, 21 Feb 2010 13:56:23 +0000 (14:56 +0100)]
docs: add 3 missing spaces

15 years agoFix daemon-conf invalid failures
David Allan [Fri, 19 Feb 2010 17:37:00 +0000 (18:37 +0100)]
Fix daemon-conf invalid failures

The daemon-conf test would fail on my system if there was a system libvirtd
running.  In the course of troubleshooting that problem, I discovered that the
daemon-conf script would always fail if run by itself because it found the line:

\# that each "PARAMETER = VALUE" line in this file have the parameter

which it mistook for a line containing a parameter.  I have changed the test to
avoid mistaking a line containing \"PARAMETER = VALUE\" for a parameter line.

The corrupted config tests turned out to be failing because the test daemon was
discovering the pid file from the running daemon and exiting before it processed
the test config file.  Specifying the pid file for the corrupt config tests in
the same way as for the valid config test solved that problem.

15 years agovirsh.c: avoid leak on OOM error path
Jim Meyering [Fri, 19 Feb 2010 17:03:41 +0000 (18:03 +0100)]
virsh.c: avoid leak on OOM error path

* tools/virsh.c (cmdCPUBaseline): Also free "buffer" and "list" upon OOM.

15 years agovirBufferVSprintf: do not omit va_end(argptr) call
Jim Meyering [Thu, 18 Feb 2010 20:25:01 +0000 (21:25 +0100)]
virBufferVSprintf: do not omit va_end(argptr) call

* src/util/buf.c (virBufferVSprintf): Do not omit va_end(argptr).
Improved-by: Daniel Veillard.
15 years agoxend_internal.c: don't dereference NULL for unexpected input
Jim Meyering [Fri, 19 Feb 2010 16:45:41 +0000 (17:45 +0100)]
xend_internal.c: don't dereference NULL for unexpected input

* src/xen/xend_internal.c (xenDaemonDomainSetAutostart): Avoid a NULL
dereference upon non-SEXPR_VALUE'd on_xend_start.  This bug was
introduced by commit 37ce5600c0bb1aed9e2f2888922388de4340ebd3.

15 years agoUse virFileOperation hook function in virStorageBackendFileSystemVolBuild
Laine Stump [Fri, 19 Feb 2010 17:12:01 +0000 (18:12 +0100)]
Use virFileOperation hook function in virStorageBackendFileSystemVolBuild

There were a few operations on the storage volume file that were still
being done as root, which will fail if the file is on a root-squashed
NFS share. The result was that attempts to create a storage volume of
type "raw" on a root-squashed NFS share would fail.

This patch uses the newly introduced "hook" function in
virFileOperation to execute all those file operations in the child
process that's run under the uid that owns the file (and, presumably,
has permission to write to the NFS share)

* src/storage/storage_backend.c: use virFileOperation() in
  virStorageBackendCreateRaw, turning virStorageBackendCreateRaw()
  into a new createRawFileOpHook() hook

15 years agoRename virFileCreate to virFileOperation, add hook function
Laine Stump [Fri, 19 Feb 2010 16:43:22 +0000 (17:43 +0100)]
Rename virFileCreate to virFileOperation, add hook function

It turns out it is also useful to be able to perform other operations
on a file created while running as a different uid (eg, write things
to that file), and possibly to do this to a file that already
exists. This patch adds an optional hook function to the renamed (for
more accuracy of purpose) virFileOperation; the hook will be called
after the file has been opened (possibly created) and gid/mode
checked/set, before closing it.

As with the other operations on the file, if the VIR_FILE_OP_AS_UID
flag is set, this hook function will be called in the context of a
child process forked from the process that called virFileOperation.
The implication here is that, while all data in memory is available to
this hook function, any modification to that data will not be seen by
the caller - the only indication in memory of what happened in the
hook will be the return value (which the hook should set to 0 on
success, or one of the standard errno values on failure).

Another piece of making the function more flexible was to add an
"openflags" argument. This arg should contain exactly the flags to be
passed to open(2), eg O_RDWR | O_EXCL, etc.

In the process of adding the hook to virFileOperation, I also realized
that the bits to fix up file owner/group/mode settings after creation
were being done in the parent process, which could fail, so I moved
them to the child process where they should be.

* src/util/util.[ch]: rename and rework virFileCreate-->virFileOperation,
  and redo flags in virDirCreate
* storage/storage_backend.c, storage/storage_backend_fs.c: update the
  calls to virFileOperation/virDirCreate to reflect changes in the API,
  but don't yet take advantage of the hook.

15 years agoqemu: Check for IA64 kvm
Dustin Xiong [Thu, 18 Feb 2010 15:48:51 +0000 (10:48 -0500)]
qemu: Check for IA64 kvm

ACPI feature bit dropped: I asked internally if the -no-acpi option
had any meaning for IA64, and was told 'probably not'.

15 years agoremote: Print ssh stderr on connection failure
Cole Robinson [Thu, 11 Feb 2010 22:39:38 +0000 (17:39 -0500)]
remote: Print ssh stderr on connection failure

15 years agofix multiple veth problem for OpenVZ
Yuji NISHIDA [Fri, 19 Feb 2010 15:49:56 +0000 (16:49 +0100)]
fix multiple veth problem for OpenVZ

Fix multiple veth problem.
NETIF setting was overwritten after first CT because any CT could not be
found by name.
* src/openvz/openvz_conf.c src/openvz/openvz_conf.h: add the
  openvzGetVEID lookup function
* src/openvz/openvz_driver.c: use it in openvzDomainSetNetwork()

15 years agoBetter error reporting for failed migration
Chris Lalancette [Fri, 19 Feb 2010 15:15:21 +0000 (16:15 +0100)]
Better error reporting for failed migration

If the hostname as returned by "gethostname" resolves
to "localhost" (as it does with the broken Fedora-12
installer), then live migration will fail because the
source will try to migrate to itself.  Detect this
situation up-front and abort the live migration before
we do any real work.

* src/util/util.h src/util/util.c: add a new virGetHostnameLocalhost
  with an optional localhost check, and rewire virGetHostname() to use
  it
* src/libvirt_private.syms: expose the new function
* src/qemu/qemu_driver.c: use it in qemudDomainMigratePrepare2()

15 years agoMake virDomainObjFormat static
Chris Lalancette [Fri, 19 Feb 2010 15:06:08 +0000 (16:06 +0100)]
Make virDomainObjFormat static

* src/conf/domain_conf.c: make function static
* src/conf/domain_conf.h: remove it from header

15 years agoMake an error message in PCI util code clearer
Chris Lalancette [Fri, 19 Feb 2010 15:04:35 +0000 (16:04 +0100)]
Make an error message in PCI util code clearer

* src/util/pci.c: update 2 message on pciRead errors

15 years agomacvtap mac_filter support
Stefan Berger [Fri, 19 Feb 2010 14:41:30 +0000 (15:41 +0100)]
macvtap mac_filter support

This patch adds the mac_filter support to the macvtap device.

15 years agovirsh: be careful to return "FALSE" upon OOM
Jim Meyering [Thu, 18 Feb 2010 10:05:38 +0000 (11:05 +0100)]
virsh: be careful to return "FALSE" upon OOM

* tools/virsh.c (cmdCPUBaseline): Add an explicit "return" statement
after the "no_memory:" label.

15 years agovirBufferStrcat: do not skip va_end
Jim Meyering [Thu, 18 Feb 2010 19:46:24 +0000 (20:46 +0100)]
virBufferStrcat: do not skip va_end

* src/util/buf.c (virBufferStrcat): Do not skip va_end due to
an early return.

15 years agoqparams.c: do not skip va_end, twice
Jim Meyering [Thu, 18 Feb 2010 19:27:22 +0000 (20:27 +0100)]
qparams.c: do not skip va_end, twice

* src/util/qparams.c (new_qparam_set, append_qparams): Do not skip
va_end due to an early return.

15 years agoxenDaemonDomainSetAutostart: avoid appearance of impropriety
Jim Meyering [Wed, 17 Feb 2010 21:14:25 +0000 (22:14 +0100)]
xenDaemonDomainSetAutostart: avoid appearance of impropriety

* src/xen/xend_internal.c (xenDaemonDomainSetAutostart): Rewrite to
avoid dereferencing the result of sexpr_lookup.  While in this
particular case, it was guaranteed never to be NULL, due to the
preceding "if sexpr_node(...)" guard, it's cleaner to skip the
sexpr_node call altogether, and also saves a lookup.

15 years agomacvtap IFF_VNET_HDR configuration
Stefan Berger [Fri, 19 Feb 2010 10:38:57 +0000 (11:38 +0100)]
macvtap IFF_VNET_HDR configuration

This patch sets or unsets the IFF_VNET_HDR flag depending on what device
is used in the VM. The manipulation of the flag is done in the open
function and is only fatal if the IFF_VNET_HDR flag could not be cleared
although it has to be (or if an ioctl generally fails). In that case the
macvtap tap is closed again and the macvtap interface torn.

* src/qemu/qemu_conf.c src/qemu/qemu_conf.h: pass qemuCmdFlags to
  qemudPhysIfaceConnect()
* src/util/macvtap.c src/util/macvtap.h: add vnet_hdr boolean to
  openMacvtapTap(), and private function configMacvtapTap()
* src/qemu/qemu_driver.c: add extra qemuCmdFlags when calling
  qemudPhysIfaceConnect()

15 years agoUse virFork() in __virExec(), virFileCreate() and virDirCreate()
Laine Stump [Thu, 18 Feb 2010 21:20:07 +0000 (22:20 +0100)]
Use virFork() in __virExec(), virFileCreate() and virDirCreate()

For __virExec() this is a semantic NOP except for when fork()
fails. __virExec() would previously forget to restore the signal mask
in this case; virFork() corrects this behavior.

virFileCreate() and virDirCreate() gain the code to reset the logging
and properly deal with the signal handling race condition.

This also removes a log message that had a typo ("cannot fork o create
file '%s'") - this error is now logged in a more generic manner in
virFork() (more generic, but really just as informative, since the
fact that it's forking to create a file is immaterial to the fact that
it simply can't fork)

* src/util/util.c: use the generic virFork() in the 3 functions

15 years agoAdd virFork() function to utils
Laine Stump [Thu, 18 Feb 2010 21:13:48 +0000 (22:13 +0100)]
Add virFork() function to utils

virFork() contains bookkeeping that must be done any time a process
forks. Currently this includes:

1) Call virLogLock() prior to fork() and virLogUnlock() just after,
   to avoid a deadlock if some other thread happens to hold that lock
   during the fork.

2) Reset the logging hooks and send all child process log messages to
   stderr.

3) Block all signals prior to fork(), then either a) reset the signal
   mask for the parent process, or b) clear the signal mask for the
   child process.

Note that the signal mask handling in __virExec erroneously fails to
restore the signal mask when fork() fails. virFork() fixes this
problem.

Other than this, it attempts to behave as closely to fork() as
possible (including preserving errno for the caller), with a couple
exceptions:

1) The return value is 0 (success) or -1 (failure), while the pid is
   returned via the pid_t* argument. Like fork(), if pid < 0 there is
   no child process, otherwise both the child and the parent will
   return to the caller, and both should look at the return value,
   which will indicate if some of the extra processing outlined above
   encountered an error.

2) If virFork() returns with pid < 0 or with a return value < 0
   indicating an error condition, the error has already been
   reported. You can log an additional message if you like, but it
   isn't necessary, and may be awkwardly extraneous.

Note that virFork()'s child process will *never* call _exit() - if a
child process is created, it will return to the caller.

* util.c util.h: add virFork() function, based on what is currently
                 done in __virExec().

15 years agoAdd QEMU support for virtio channel
Matthew Booth [Thu, 18 Feb 2010 16:56:50 +0000 (17:56 +0100)]
Add QEMU support for virtio channel

Support virtio-serial controller and virtio channel in QEMU backend.
Will output
the following for virtio-serial controller:

-device
virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x4,max_ports=16,vectors=4

and the following for a virtio channel:

-chardev pty,id=channel0 \
-device
virtserialport,bus=virtio-serial0.0,chardev=channel0,name=org.linux-kvm.port.0

* src/qemu/qemu_conf.c: Add argument output for virtio
* tests/qemuxml2argvtest.c
  tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.args: Add test for
  QEMU command line generation

15 years agoAdd domain support for virtio channel
Matthew Booth [Thu, 18 Feb 2010 16:52:03 +0000 (17:52 +0100)]
Add domain support for virtio channel

Add support for virtio-serial by defining a new 'virtio' channel target type
and a virtio-serial controller. Allows the following to be specified in a
domain:

<controller type='virtio-serial' index='0' ports='16' vectors='4'/>
<channel type='pty'>
  <target type='virtio' name='org.linux-kvm.port.0'/>
  <address type='virtio-serial' controller='0' bus='0'/>
</channel>

* docs/schemas/domain.rng: Add virtio-serial controller and virtio
  channel type.
* src/conf/domain_conf.[ch]: Domain parsing/serialization for
  virtio-serial controller and virtio channel.
* tests/qemuxml2xmltest.c
  tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.xml: add domain xml
  parsing test
* src/libvirt_private.syms src/qemu/qemu_conf.c:
  virDomainDefAddDiskControllers() renamed to
  virDomainDefAddImplicitControllers()

15 years agoRemove unused functions from domain_conf
Matthew Booth [Thu, 18 Feb 2010 15:45:18 +0000 (16:45 +0100)]
Remove unused functions from domain_conf

Remove virDomainDevicePCIAddressEqual and virDomainDeviceDriveAddressEqual,
which are defined but not used anywhere.

* src/conf/domain_conf.[ch] src/libvirt_private.syms: Remove
  virDomainDevicePCIAddressEqual and virDomainDeviceDriveAddressEqual.

15 years agoFix typo in comment
Matthew Booth [Thu, 18 Feb 2010 15:40:48 +0000 (16:40 +0100)]
Fix typo in comment

* src/qemu/qemu_driver.c: qemudStartVMDaemon() fix typo in comment

15 years agoget_virtual_functions_linux: would mistakenly always return zero
Jim Meyering [Thu, 18 Feb 2010 10:12:17 +0000 (11:12 +0100)]
get_virtual_functions_linux: would mistakenly always return zero

* src/node_device/node_device_linux_sysfs.c(get_virtual_functions_linux):
Return "ret", rather than always returning 0.

15 years agoqemu: Explicitly error if guest virtual network is inactive
Cole Robinson [Tue, 16 Feb 2010 18:11:27 +0000 (13:11 -0500)]
qemu: Explicitly error if guest virtual network is inactive

Currently we just error with ex. 'virbr0: No such device'.

Since we are using public API calls here, we need to ensure that any
raised error is properly saved and restored, since API entry points
always reset messages.

15 years agonetwork: bridge: Fix IsActive, IsPersistent
Cole Robinson [Tue, 16 Feb 2010 18:09:31 +0000 (13:09 -0500)]
network: bridge: Fix IsActive, IsPersistent

We were accessing the wrong private data structure, which would
cause a segfault.

15 years agovirterror: Make SetError work if no previous error was set
Cole Robinson [Tue, 16 Feb 2010 18:07:31 +0000 (13:07 -0500)]
virterror: Make SetError work if no previous error was set

virGetLastError returns NULL if no error has been set, not on
allocation error like virSetError assumed. Use virLastErrorObject
instead. This fixes virSetError when no error is currently stored.

15 years agolibvirt: Update docs for hotplug only commands
Cole Robinson [Tue, 16 Feb 2010 18:59:21 +0000 (13:59 -0500)]
libvirt: Update docs for hotplug only commands

The commands updated are SetMem, SetMaxMem, SetVcpus, and PinVcpu.