]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
15 years agoDon't raise error message from cgroups if QEMU fails to start
Daniel P. Berrange [Wed, 3 Mar 2010 15:48:22 +0000 (15:48 +0000)]
Don't raise error message from cgroups if QEMU fails to start

The code to remove the cgroup after QEMU failed to startup could
be obscuring a real error from earlier on. It is not neccessary
to raise an error in this case, so tell cgroups to keep quiet

* src/qemu/qemu_driver.c: Don't raise cgroups error in QEMU start
  cleanup code.

15 years agoAdd missing device type check in QEMU PCI hotunplug
Daniel P. Berrange [Wed, 3 Mar 2010 15:15:21 +0000 (15:15 +0000)]
Add missing device type check in QEMU PCI hotunplug

The QEMU hotunplug code for PCI devices was looking at host
devices in the guest config without first filtering non
PCI devices. This means it was reading garbage

* src/qemu/qemu_driver.c: Filter out non-PCI devices

15 years agoAdd a define for NFS_SUPER_MAGIC
Chris Lalancette [Wed, 3 Mar 2010 16:42:08 +0000 (11:42 -0500)]
Add a define for NFS_SUPER_MAGIC

Commit 3c12a67b766cce51b47861ccde2be41de369f832 added
a dependency on the NFS_SUPER_MAGIC macro, which is
defined in linux/magic.h.  Unfortunately linux/magic.h
is not available in RHEL-5, and causes a compile error.
Just define it locally, since this is something that
can't change.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoMake domain save work on root-squash NFS
Laine Stump [Wed, 3 Mar 2010 16:07:18 +0000 (17:07 +0100)]
Make domain save work on root-squash NFS

Move *all* file operations related to creation and writing of libvirt
header to the domain save file into a hook function that is called by
virFileOperation. First try to call virFileOperation as root. If that
fails with EACCESS, and (in the case of Linux) statfs says that we're
trying to save the file on an NFS share, rerun virFileOperation,
telling it to fork a child process and setuid to the qemu user. This
is the only way we can successfully create a file on a root-squashed
NFS server.

This patch (along with setting dynamic_ownership=0 in qemu.conf)
makes qemudDomainSave work on root-squashed NFS.

* src/qemu/qemu_driver.c: provide new qemudDomainSaveFileOpHook()
  utility, use it in qemudDomainSave() if normal creation of the
  file as root failed, and after checking the filesystem type for
  the storage is NFS. In that case we also bypass the security
  driver, as this would fail on NFS.

15 years agoFix domain restore for files on root-squash NFS
Laine Stump [Wed, 3 Mar 2010 15:38:42 +0000 (16:38 +0100)]
Fix domain restore for files on root-squash NFS

If qemudDomainRestore fails to open the domain save file, create a
pipe, then fork a process that does setuid(qemu_user) and opens the
file, then reads this file and stuffs it into the pipe. the parent
libvirtd process will use the other end of the pipe as its fd, then
reap the child process after it's done reading.

This makes domain restore work on a root-squash NFS share that is only
visible to the qemu user.

* src/qemu/qemu_driver.c: add new qemudOpenAsUID() helper function,
  and use it in qemudDomainRestore() if reading as root directly failed.

15 years agoFix USB/PCI device address aliases in QEMU hotplug driver
Daniel P. Berrange [Mon, 1 Mar 2010 21:06:01 +0000 (21:06 +0000)]
Fix USB/PCI device address aliases in QEMU hotplug driver

The USB/PCI device hotplug code for the QEMU driver was forgetting
to allocate a unique device alias.

* src/qemu/qemu_driver.c: Fill in device alias for USB/PCI devices

15 years agoFix detection of errors in QEMU device_add command
Daniel P. Berrange [Tue, 2 Mar 2010 17:16:30 +0000 (17:16 +0000)]
Fix detection of errors in QEMU device_add command

The code assumed that 'device_add' returned an empty string upon
success. This is not true, it sometimes prints random debug info.
THus we need to check for an explicit fail string

* src/qemu/qemu_monitor_text.c: Fix error checking of the device_add
  monitor command

15 years agoesx: don't ignore failure on close
Eric Blake [Wed, 3 Mar 2010 10:22:46 +0000 (11:22 +0100)]
esx: don't ignore failure on close

Another warning caught by coverity.  Continue to perform best-effort
closing and resource release, but warn the caller about the failure.

* src/esx/esx_driver.c (esxClose): Return an error on failure to close.

15 years agouml: avoid crash on partial read
Eric Blake [Wed, 3 Mar 2010 00:16:05 +0000 (17:16 -0700)]
uml: avoid crash on partial read

Coverity detected a potential dereference of uninitialized memory
if recvfrom got cut short.

* src/uml/uml_driver.c (umlMonitorCommand): Validate complete read
prior to dereferencing res.

15 years agovirsh: silence compiler warning
Eric Blake [Wed, 3 Mar 2010 00:19:01 +0000 (17:19 -0700)]
virsh: silence compiler warning

gcc warns:
virsh.c:1879: warning: '0' flag ignored with '-' flag in gnu_printf format

* tools/virsh.c (cmdDomjobinfo): Delete useless flag.

15 years agoFix safezero()
Jiri Denemark [Tue, 2 Mar 2010 15:11:24 +0000 (16:11 +0100)]
Fix safezero()

Various safezero() implementations used either -1, errno or -errno
return values. This patch fixes them all to return -1 and set errno
appropriately.

There was also a bug in size parameter passed to safewrite() which could
result in an attempt to write gigabytes out of a megabyte buffer.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 years agoFix QEMU domain state after a save attempt fails
Daniel P. Berrange [Thu, 4 Feb 2010 17:19:51 +0000 (17:19 +0000)]
Fix QEMU domain state after a save attempt fails

When a VM save attempt failed, the VM would be left in a paused
state. It is neccessary to resume CPU execution upon failure
if it was running originally

* src/qemu/qemu_driver.c: Resume CPUs upon save failure

15 years agoSupport job cancellation in QEMU driver
Daniel P. Berrange [Wed, 3 Feb 2010 19:11:27 +0000 (19:11 +0000)]
Support job cancellation in QEMU driver

This supports cancellation of jobs for the QEMU driver against
the virDomainMigrate, virDomainSave and virDomainCoreDump APIs.
It is not yet supported for the virDomainRestore API, although
it is desirable.

* src/qemu/qemu_driver.c: Issue 'migrate_cancel' command if
  virDomainAbortJob is issued during a migration operation
* tools/virsh.c: Add a domjobabort command

15 years agoRemote driver implementation for the virDomainAbortJob APi
Daniel P. Berrange [Thu, 4 Feb 2010 16:18:57 +0000 (16:18 +0000)]
Remote driver implementation for the virDomainAbortJob APi

This defines the wire protocol for the new API

* src/remote/remote_protocol.x: Wire protocol definition
* src/remote/remote_driver.c,daemon/remote.c: Client and server
  side implementation
* daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h,
  daemon/remote_dispatch_table.h, src/remote/remote_protocol.c,
  src/remote/remote_protocol.h: Re-generate from remote_protocol.x

15 years agoWire up internal entry points for virDomainAbortJob API
Daniel P. Berrange [Thu, 4 Feb 2010 16:16:35 +0000 (16:16 +0000)]
Wire up internal entry points for virDomainAbortJob API

This provides the internal glue for the driver API

* src/driver.h: Internal API contract
* src/libvirt.c, src/libvirt_public.syms: Connect public API
  to driver 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: Stub out entry points

15 years agoIntroduce public API for cancelling async domain jobs
Daniel P. Berrange [Thu, 4 Feb 2010 16:12:01 +0000 (16:12 +0000)]
Introduce public API for cancelling async domain jobs

The new virDomainAbortJob() method provides a way for a second
thread to abort an ongoing job run by another thread. This
extends to any API with  which the virDomainGetJobInfo() API
is intended to work. Cancellation is not guarenteed, rather best
effort on part of the hypervisor and not required to be implmented.

* include/libvirt/libvirt.h.in: Define virDomainAbortJob()

15 years agoAdd QEMU driver support for job info on migration ops
Daniel P. Berrange [Wed, 3 Feb 2010 16:45:05 +0000 (16:45 +0000)]
Add QEMU driver support for job info on migration ops

Introduce support for  virDomainGetJobInfo in the QEMU driver. This
allows for monitoring of any API that uses the 'info migrate' monitor
command. ie virDomainMigrate, virDomainSave and virDomainCoreDump

Unfortunately QEMU does not provide a way to monitor incoming migration
so we can't wire up virDomainRestore yet.

The virsh tool gets a new command 'domjobinfo' to query status

* src/qemu/qemu_driver.c: Record virDomainJobInfo and start time
  in qemuDomainObjPrivatePtr objects. Add generic shared handler
  for calling 'info migrate' with all migration based APIs.
* src/qemu/qemu_monitor_text.c: Fix parsing of 'info migration' reply
* tools/virsh.c: add new 'domjobinfo' command to query progress

15 years agoRemote driver implmentation of job info API
Daniel P. Berrange [Wed, 3 Feb 2010 14:10:13 +0000 (14:10 +0000)]
Remote driver implmentation of job info API

* src/remote/remote_protocol.x: Define wire protocol format
  for virDomainGetJobInfo API
* src/remote/remote_driver.c, daemon/remote.c: Implement client
  and server marshalling code for virDomainGetJobInfo()
* daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h
  daemon/remote_dispatch_ret.h, daemon/remote_dispatch_table.h,
  src/remote/remote_protocol.c, src/remote/remote_protocol.h: Rebuild
  files from src/remote/remote_protocol.x

15 years agoStub out internal driver entry points for job processing
Daniel P. Berrange [Wed, 3 Feb 2010 11:32:24 +0000 (11:32 +0000)]
Stub out internal driver entry points for job processing

The internal glue layer for the new pubic API

* src/driver.h: Define internal driver API contract
* src/libvirt.c, src/libvirt_public.syms: Wire up public
  API to internal driver 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: Stub new entry point

15 years agoIntroduce public API for domain async job handling
Daniel P. Berrange [Wed, 3 Feb 2010 11:31:45 +0000 (11:31 +0000)]
Introduce public API for domain async job handling

Introduce a new public API that provides a way to get progress
info on currently running jobs on a virDomainpPtr. APIs that
are initially within scope of this idea are

 virDomainMigrate
 virDomainMigrateToURI
 virDomainSave
 virDomainRestore
 virDomainCoreDump

These all take a potentially long time and benefit from monitoring.
The virDomainJobInfo struct allows for various pieces of information
to be reported

 - Percentage completion
 - Time
 - Overall data
 - Guest memory data
 - Guest disk/file data

* include/libvirt/libvirt.h.in: Add virDomainGetJobInfo
* python/generator.py, python/libvirt-override-api.xml,
  python/libvirt-override.c: Override for virDomainGetJobInfo API
* python/typewrappers.c, python/typewrappers.h: Introduce wrapper
  for unsigned long long type

15 years agobuild: silence coverity warning in node_device
Eric Blake [Tue, 2 Mar 2010 14:51:57 +0000 (07:51 -0700)]
build: silence coverity warning in node_device

All other uses of get_str_prop in this file that ignored
failure explicitly cast to void.

* src/node_device/node_device_hal.c (dev_create): Silence coverity
warning.

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