]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
14 years agobuild: don't require pod2man for tarball builds
Eric Blake [Wed, 16 Feb 2011 22:43:24 +0000 (15:43 -0700)]
build: don't require pod2man for tarball builds

Right now, 'man libvirtd' includes information that depends on
configure results, so it must be generated on the fly and live
in $(builddir); however, requiring pod2man on all end user
machines is overkill.  Meanwhile, 'man virsh' doesn't mention
any configure results, so it can be built at 'make dist' time.
If that situation changes in the future, we can generate virsh.1
in the same way that we generate libvirtd.8.

* daemon/Makefile.am (libvirtd.8.in): New rule, to run pod2man in
advance of distribution.
(libvirtd.8): Use only sed from tarball.
(EXTRA_DIST): Ship new file.
(libvirtd.pod): Delete unused rule.
(man8_MANS): Let automake know which section to use.
(CLEANFILES, MAINTAINERCLEANFILES): Adjust to new files.
* tools/Makefile.am (dist_man1_MANS): Distribute pre-built man
pages, fine since they don't require any substitution.
(virt-xml-validate.1, virt-pki-validate.1): Change input source.
(virsh.1): Build into srcdir.
(CLEANFILES, MAINTAINERCLEANFILES): Adjust to new build style.
* daemon/.gitignore: Update.
Reported by Diego Elio Pettenò.

14 years agomaint: kill all remaining uses of old DEBUG macro
Eric Blake [Wed, 16 Feb 2011 23:37:57 +0000 (16:37 -0700)]
maint: kill all remaining uses of old DEBUG macro

Done mechanically with:
$ git grep -l '\bDEBUG0\? *(' | xargs -L1 sed -i 's/\bDEBUG0\? *(/VIR_&/'

followed by manual deletion of qemudDebug in daemon/libvirtd.c, along
with a single 'make syntax-check' fallout in the same file, and the
actual deletion in src/util/logging.h.

* src/util/logging.h (DEBUG, DEBUG0): Delete.
* daemon/libvirtd.h (qemudDebug): Likewise.
* global: Change remaining clients over to VIR_DEBUG counterpart.

14 years agohash: make virHashFree more free-like
Eric Blake [Fri, 18 Feb 2011 21:30:24 +0000 (14:30 -0700)]
hash: make virHashFree more free-like

Two-argument free functions are uncommon; match the style elsewhere
by caching the callback at creation.

* src/util/hash.h (virHashCreate, virHashFree): Move deallocator
argument to creation.
* cfg.mk (useless_free_options): Add virHashFree.
* src/util/hash.c (_virHashTable): Track deallocator.
(virHashCreate, virHashFree): Update to new signature.
* src/conf/domain_conf.c (virDomainObjListDeinit)
(virDomainObjListInit, virDomainDiskDefForeachPath)
(virDomainSnapshotObjListDeinit, virDomainSnapshotObjListInit):
Update callers.
* src/conf/nwfilter_params.c (virNWFilterHashTableFree)
(virNWFilterHashTableCreate): Likewise.
* src/conf/nwfilter_conf.c (virNWFilterTriggerVMFilterRebuild):
Likewise.
* src/cpu/cpu_generic.c (genericHashFeatures, genericBaseline):
Likewise.
* src/xen/xm_internal.c (xenXMOpen, xenXMClose): Likewise.
* src/nwfilter/nwfilter_learnipaddr.c (virNWFilterLearnInit)
(virNWFilterLearnShutdown): Likewise.
* src/qemu/qemu_command.c (qemuDomainPCIAddressSetCreate)
(qemuDomainPCIAddressSetFree): Likewise.
* src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Likewise.

14 years agobuild: Fix API docs generation in VPATH build
Jiri Denemark [Fri, 18 Feb 2011 11:12:28 +0000 (12:12 +0100)]
build: Fix API docs generation in VPATH build

XSLT allows for two ways of generating the output of transformation.
Either implicit, which xsltproc prints to stdout and can be redirected
to a file using -o file. Or explicit, which means the stylesheet
contains <xsl:document> element which specifies where the output should
be saved. This can be used for generating more files by a single run of
xsltproc and -o directory/ can change the directory where the output
files will be stored.

devhelp.xsl is special in that it combines both options in one
stylesheet, which doesn't work well with -o:

xsltproc --nonet -o ./devhelp/ ./devhelp/devhelp.xsl ./libvirt-api.xml

Outputs 4 *.html files into ./devhelp but then tries to write to
./devhelp/ as a file (hence the I/O error) rather than writing output to
the fifth file devhelp/libvirt.devhelp.

This patch modifies devhelp.xsl so that all files are generated using
<xsl:document> element and -o directory/ can be used to override output
directory where those files are saved.

14 years agoRemove all object hashtable caches from virConnectPtr
Daniel P. Berrange [Fri, 29 Oct 2010 11:43:34 +0000 (12:43 +0100)]
Remove all object hashtable caches from virConnectPtr

The virConnectPtr struct will cache instances of all other
objects. APIs like virDomainLookupByUUID will return a
cached object, so if you do virDomainLookupByUUID twice in
a row, you'll get the same exact virDomainPtr instance.

This does not have any performance benefit, since the actual
logic in virDomainLookupByUUID (and other APIs returning
virDomainPtr, etc instances) is not short-circuited. All
it does is to ensure there is only one single virDomainPtr
in existance for any given UUID.

The caching has a number of downsides though, all relating
to stale data. If APIs aren't careful to always overwrite
the 'id' field in virDomainPtr it may become out of data.
Likewise for the name field, if a guest is renamed, or if
a guest is deleted, and then a new one created with the
same UUID but different name.

This has been an ongoing, endless source of bugs for all
applications using libvirt from languages with garbage
collection, causing them to get virDomainPtr instances
from long ago with stale data.

The caching is also a waste of memory resources, since
both applications, and language bindings often maintain
their own hashtable caches of object instances.

This patch removes all the hash table caching, so all
APIs return brand new virDomainPtr (etc) object instances.

* src/datatypes.h: Delete all hash tables.
* src/datatypes.c: Remove all object caching code

14 years agonwfilter: enable rejection of packets
Stefan Berger [Sat, 19 Feb 2011 01:13:40 +0000 (20:13 -0500)]
nwfilter: enable rejection of packets

This patch adds the possibility to not just drop packets, but to also have them rejected where iptables at least sends an ICMP msg back to the originator. On ebtables this again maps into dropping packets since rejecting is not supported.

I am adding 'since 0.8.9' to the docs assuming this will be the next version of libvirt.

14 years agoDrop empty argument from dnsmasq call
Guido Günther [Fri, 18 Feb 2011 14:32:02 +0000 (15:32 +0100)]
Drop empty argument from dnsmasq call

since dnsmasq >= 2.56 now bails out with empty arguments. See
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=613944
for the Debian bug and
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=589885
for the upstream reasoning.

14 years agobuild: fix broken mingw cross-compilation
Eric Blake [Fri, 18 Feb 2011 19:00:47 +0000 (12:00 -0700)]
build: fix broken mingw cross-compilation

Two regressions:
Commit df1011ca broke builds for systems that lack devmapper
(non-Linux, as well as Linux with ./autogen.sh --without-libvirtd
and without the libraries present).
Commit ce6fd650 broke cross-compilation, due to a gnulib bug.

* .gnulib: Update to latest, for cross-compilation fix.
* src/util/util.c (virIsDevMapperDevice): Provide stub for
platforms not using storage driver.
* configure.ac (devmapper): Arrange to define HAVE_LIBDEVMAPPER_H.
devmapper issue reported by Wen Congyang.

14 years agoesx: Ignore malformed host UUID from BIOS
Matthias Bolte [Fri, 18 Feb 2011 09:09:32 +0000 (10:09 +0100)]
esx: Ignore malformed host UUID from BIOS

Etienne Gosset reported that libvirt fails to connect to his ESX
server because it failed to parse its malformed host UUID, that
contains an additional space and lacks one hexdigit in the last
group:

xxxxxxxx-xxxx-xxxx-xxxx- xxxxxxxxxxx

Don't treat this as a fatal error, just ignore it.

14 years agovirsh: freecell --all getting wrong NUMA nodes count
Michal Privoznik [Fri, 18 Feb 2011 11:42:21 +0000 (12:42 +0100)]
virsh: freecell --all getting wrong NUMA nodes count

Virsh freecell --all was not only getting wrong NUMA nodes count, but
even the NUMA nodes IDs. They doesn't have to be continuous, as I've
found out during testing this. Therefore a modification of
nodeGetCellsFreeMemory() error message.

14 years agobuild: speed up non-maintainer builds
Eric Blake [Fri, 11 Feb 2011 19:43:05 +0000 (12:43 -0700)]
build: speed up non-maintainer builds

* configure.ac (gl_ASSERT_NO_GNULIB_POSIXCHECK): Use to reduce
time spent in configure.

14 years agobuild: recompute symbols after changing configure options
Eric Blake [Thu, 17 Feb 2011 20:16:53 +0000 (13:16 -0700)]
build: recompute symbols after changing configure options

$ ./configure
...
$ make
...
  GEN    libvirt.syms
...
$ ./configure --with-driver-modules
...
$ make
...

libvirt.syms doesn't get regenerated but it should as it should
contain virDriverLoadModule now.

* src/Makefile.am (libvirt.syms): Depend on configure changes.
Reported by Matthias Bolte.

14 years agomaint: Expand tabs in python code
Jiri Denemark [Wed, 16 Feb 2011 15:57:50 +0000 (16:57 +0100)]
maint: Expand tabs in python code

Also cfg.mk is tweaked to force this for all future changes to *.py
files.

14 years agoRequires gettext for client package
Osier Yang [Fri, 18 Feb 2011 05:45:13 +0000 (13:45 +0800)]
Requires gettext for client package

libvirt-guests invokes functions in gettext.sh, so we need to
require gettext package in spec file.

Demo with the fix:
% rpm -q gettext
package gettext is not installed

% rpm -ivh libvirt-client-0.8.8-1.fc14.x86_64.rpm
error: Failed dependencies:
gettext is needed by libvirt-client-0.8.8-1.fc14.x86_64

* libvirt.spec.in

14 years agoDo not add drive 'boot=on' param when a kernel is specified
Jim Fehlig [Thu, 17 Feb 2011 21:22:55 +0000 (14:22 -0700)]
Do not add drive 'boot=on' param when a kernel is specified

libvirt-tck was failing several domain tests [1] with qemu 0.14, which
is now less tolerable of specifying 2 bootroms with the same boot index [2].

Drop the 'boot=on' param if kernel has been specfied.

[1] https://www.redhat.com/archives/libvir-list/2011-February/msg00559.html
[2] http://lists.nongnu.org/archive/html/qemu-devel/2011-02/msg01892.html

14 years agoremove duplicated call to reportOOMError
Christophe Fergeau [Thu, 17 Feb 2011 21:18:22 +0000 (22:18 +0100)]
remove duplicated call to reportOOMError

14 years agoremove space between function name and (
Christophe Fergeau [Thu, 17 Feb 2011 21:18:21 +0000 (22:18 +0100)]
remove space between function name and (

There were several occurrences of an extra space inserted between
a function name and the ( opening the argument list in
datatypes.c. This is not consistent with the coding style used in
the rest of this file so removing this extra space makes the
code slightly more readable.

14 years agodon't check for NULL before calling virHashFree
Christophe Fergeau [Thu, 17 Feb 2011 21:14:59 +0000 (22:14 +0100)]
don't check for NULL before calling virHashFree

virHashFree follows the convention described in HACKING that
XXXFree() functions can be called with a NULL argument.

14 years agoremove no longer needed calls to virReportOOMError
Christophe Fergeau [Thu, 17 Feb 2011 21:14:58 +0000 (22:14 +0100)]
remove no longer needed calls to virReportOOMError

Now that the virHash handling functions call virReportOOMError by
themselves when needed, users of the virHash API no longer need to
do it by themselves. Since users of the virHash API were not
consistently calling virReportOOMError after memory failures from
the virHash code, this has the added benefit of making OOM
reporting from this code more consistent and reliable.

14 years agofactor common code in virHashAddEntry and virHashUpdateEntry
Christophe Fergeau [Thu, 17 Feb 2011 21:14:57 +0000 (22:14 +0100)]
factor common code in virHashAddEntry and virHashUpdateEntry

The only difference between these 2 functions is that one errors
out when the entry is already present while the other modifies
the existing entry. Add an helper function with a boolean argument
indicating whether existing entries should be updated or not, and
use this helper in both functions.

14 years agoadd hash table rebalancing in virHashUpdateEntry
Christophe Fergeau [Thu, 17 Feb 2011 21:14:56 +0000 (22:14 +0100)]
add hash table rebalancing in virHashUpdateEntry

The code in virHashUpdateEntry and virHashAddEntry is really
similar. However, the latter rebalances the hash table when
one of its buckets contains too many elements while the former
does not. Fix this discrepancy.

14 years agohash: modernize debug code
Eric Blake [Thu, 17 Feb 2011 23:33:12 +0000 (16:33 -0700)]
hash: modernize debug code

* src/util/hash.c (virHashGrow) [DEBUG_GROW]: Use modern logging.
Reported by Christophe Fergeau.

14 years agobuild: improve 'make install' for VPATH builds
Eric Blake [Wed, 16 Feb 2011 21:47:39 +0000 (14:47 -0700)]
build: improve 'make install' for VPATH builds

This still doesn't fix {html,devhelp}/libvirt-{libvirt-virterror}.html,
but it's progress in the right direction.

* docs/Makefile.am (%.html): Build into srcdir.

14 years agocheck more error info about whether drive_add failed
Wen Congyang [Thu, 17 Feb 2011 03:32:16 +0000 (11:32 +0800)]
check more error info about whether drive_add failed

When we attach a disk, but we specify a wrong format of disk image,
qemu monitor command drive_add will fail, but libvirt does not detect
this error.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
14 years agologging: make VIR_ERROR and friends preserve errno
Eric Blake [Wed, 16 Feb 2011 23:49:15 +0000 (16:49 -0700)]
logging: make VIR_ERROR and friends preserve errno

Followup to commit 17e19add, and would have prevented the bug
independently fixed in commit 76c57a7c.

* src/util/logging.c (virLogMessage): Preserve errno, since
logging should be as unintrusive as possible.

14 years agomaint: avoid 'make syntax-check' from tarball
Eric Blake [Wed, 16 Feb 2011 21:35:42 +0000 (14:35 -0700)]
maint: avoid 'make syntax-check' from tarball

* .gnulib: update to latest gnulib for maint.mk fixes

14 years agoGive each virtual network bridge its own fixed MAC address
Laine Stump [Wed, 9 Feb 2011 08:28:12 +0000 (03:28 -0500)]
Give each virtual network bridge its own fixed MAC address

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=609463

The problem was that, since a bridge always acquires the MAC address
of the connected interface with the numerically lowest MAC, as guests
are started and stopped, it was possible for the MAC address to change
over time, and this change in the network was being detected by
Windows 7 (it sees the MAC of the default route change), so on each
reboot it would bring up a dialog box asking about this "new network".

The solution is to create a dummy tap interface with a MAC guaranteed
to be lower than any guest interface's MAC, and attach that tap to the
bridge as soon as it's created. Since all guest MAC addresses start
with 0xFE, we can just generate a MAC with the standard "0x52, 0x54,
0" prefix, and it's guaranteed to always win (physical interfaces are
never connected to these bridges, so we don't need to worry about
competing numerically with them).

Note that the dummy tap is never set to IFF_UP state - that's not
necessary in order for the bridge to take its MAC, and not setting it
to UP eliminates the clutter of having an (eg) "virbr0-nic" displayed
in the output of the ifconfig command.

I chose to not auto-generate the MAC address in the network XML
parser, as there are likely to be consumers of that API that don't
need or want to have a MAC address associated with the
bridge.

Instead, in bridge_driver.c when the network is being defined, if
there is no MAC, one is generated. To account for virtual network
configs that already exist when upgrading from an older version of
libvirt, I've added a %post script to the specfile that searches for
all network definitions in both the config directory
(/etc/libvirt/qemu/networks) and the state directory
(/var/lib/libvirt/network) that are missing a mac address, generates a
random address, and adds it to the config (and a matching address to
the state file, if there is one).

docs/formatnetwork.html.in: document <mac address.../>
docs/schemas/network.rng: add nac address to schema
libvirt.spec.in: %post script to update existing networks
src/conf/network_conf.[ch]: parse and format <mac address.../>
src/libvirt_private.syms: export a couple private symbols we need
src/network/bridge_driver.c:
    auto-generate mac address when needed,
    create dummy interface if mac address is present.
tests/networkxml2xmlin/isolated-network.xml
tests/networkxml2xmlin/routed-network.xml
tests/networkxml2xmlout/isolated-network.xml
tests/networkxml2xmlout/routed-network.xml: add mac address to some tests

14 years agoAllow brAddTap to create a tap device that is down
Laine Stump [Wed, 9 Feb 2011 06:20:39 +0000 (01:20 -0500)]
Allow brAddTap to create a tap device that is down

An upcoming patch has a use for a tap device to be created that
doesn't need to be actually put into the "up" state, and keeping it
"down" keeps the output of ifconfig from being unnecessarily cluttered
(ifconfig won't show down interfaces unless you add "-a").

bridge.[ch]: add "up" as an arg to brAddTap()
uml_conf.c, qemu_command.c: add "up" (set to "true") to brAddTap() call.

14 years agoAdd txmode attribute to interface XML for virtio backend
Laine Stump [Thu, 3 Feb 2011 20:20:01 +0000 (15:20 -0500)]
Add txmode attribute to interface XML for virtio backend

This is in response to:

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

Explanation

qemu's virtio-net-pci driver allows setting the algorithm used for tx
packets to either "bh" or "timer". This is done by adding ",tx=bh" or
",tx=timer" to the "-device virtio-net-pci" commandline option.

'bh' stands for 'bottom half'; when this is set, packet tx is all done
in an iothread in the bottom half of the driver. (In libvirt, this
option is called the more descriptive "iothread".)

'timer' means that tx work is done in qemu, and if there is more tx
data than can be sent at the present time, a timer is set before qemu
moves on to do other things; when the timer fires, another attempt is
made to send more data. (libvirt retains the name "timer" for this
option.)

The resulting difference, according to the qemu developer who added
the option is:

    bh makes tx more asynchronous and reduces latency, but potentially
    causes more processor bandwidth contention since the cpu doing the
    tx isn't necessarily the cpu where the guest generated the
    packets.

Solution

This patch provides a libvirt domain xml knob to change the option on
the qemu commandline, by adding a new attribute "txmode" to the
<driver> element that can be placed inside any <interface> element in
a domain definition. It's use would be something like this:

    <interface ...>
      ...
      <model type='virtio'/>
      <driver txmode='iothread'/>
      ...
    </interface>

I chose to put this setting as an attribute to <driver> rather than as
a sub-element to <tune> because it is specific to the virtio-net
driver, not something that is generally usable by all network drivers.
(note that this is the same placement as the "driver name=..."
attribute used to choose kernel vs. userland backend for the
virtio-net driver.)

Actually adding the tx=xxx option to the qemu commandline is only done
if the version of qemu being used advertises it in the output of

    qemu -device virtio-net-pci,?

If a particular txmode is requested in the XML, and the option isn't
listed in that help output, an UNSUPPORTED_CONFIG error is logged, and
the domain fails to start.

14 years agoRestructure domain struct interface "driver" data for easier expansion
Laine Stump [Thu, 3 Feb 2011 18:52:08 +0000 (13:52 -0500)]
Restructure domain struct interface "driver" data for easier expansion

When the <driver> element (and its "name" attribute) was added to the
domain XML's interface element, a "backend" enum was simply added to
the toplevel of the virDomainNetDef struct.

Ignoring the naming inconsistency ("name" vs. "backend"), this is fine
when there's only a single item contained in the driver element of the
XML, but doesn't scale well as we add more attributes that apply to
the backend of the virtio-net driver, or add attributes applicable to
other drivers.

This patch changes virDomainNetDef in two ways:

1) Rename the item in the struct from "backend" to "name", so that
   it's the same in the XML and in the struct, hopefully avoiding
   confusion for someone unfamiliar with the function of the
   attribute.

2) Create a "driver" union within virDomainNetDef, and a "virtio"
   struct in that struct, which contains the "name" enum value.

3) Move around the virDomainNetParse and virDomainNetFormat functions
   to allow for simple plugin of new attributes without disturbing
   existing code. (you'll note that this results in a seemingly
   redundant if() in the format function, but that will no longer be
   the case as soon as a 2nd attribute is added).

In the future, new attributes for the virtio driver backend can be
added to the "virtio" struct, and any other network device backend that
needs an attribute will have its own struct added to the "driver"
union.

14 years agobuild: Fix VPATH build
Jiri Denemark [Wed, 16 Feb 2011 14:09:09 +0000 (15:09 +0100)]
build: Fix VPATH build

Even VPATH make dist succeeds now

14 years agoMove all the QEMU migration code to a new file
Daniel P. Berrange [Mon, 31 Jan 2011 10:47:03 +0000 (10:47 +0000)]
Move all the QEMU migration code to a new file

The introduction of the v3 migration protocol, along with
support for migration cookies, will significantly expand
the size of the migration code. Move it all to a separate
file to make it more manageable

The functions are not moved 100%. The API entry points
remain in the main QEMU driver, but once the public
virDomainPtr is resolved to the internal virDomainObjPtr,
all following code is moved.

This will allow the new v3 API entry points to call into the
same shared internal migration functions

* src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add
  qemuDomainFormatXML helper method
* src/qemu/qemu_driver.c: Remove all migration code
* src/qemu/qemu_migration.c, src/qemu/qemu_migration.h: Add
  all migration code.

14 years agoSplit all QEMU process mangement code into separate file
Daniel P. Berrange [Mon, 14 Feb 2011 16:09:39 +0000 (16:09 +0000)]
Split all QEMU process mangement code into separate file

Move the qemudStartVMDaemon and qemudShutdownVMDaemon
methods into a separate file, renaming them to
qemuProcessStart, qemuProcessStop. All helper methods
called by these are also moved & renamed to match

* src/Makefile.am: Add qemu_process.c/.h
* src/qemu/qemu_command.c: Add qemuDomainAssignPCIAddresses
* src/qemu/qemu_command.h: Add VNC port min/max
* src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add
  domain event queue helpers
* src/qemu/qemu_driver.c, src/qemu/qemu_driver.h: Remove
  all QEMU process startup/shutdown functions
* src/qemu/qemu_process.c, src/qemu/qemu_process.h: Add
  all QEMU process startup/shutdown functions

14 years agostorage: Allow to delete device mapper disk partition
Osier Yang [Thu, 17 Feb 2011 07:29:07 +0000 (15:29 +0800)]
storage: Allow to delete device mapper disk partition

The name convention of device mapper disk is different, and 'parted'
can't be used to delete a device mapper disk partition. e.g.

Name                 Path
-----------------------------------------
3600a0b80005ad1d7000093604cae912fp1 /dev/mapper/3600a0b80005ad1d7000093604cae912fp1

Error: Expecting a partition number.

This patch introduces 'dmsetup' to fix it.

Changes:
  - New function "virIsDevMapperDevice" in "src/utils/utils.c"
  - remove "is_dm_device" in "src/storage/parthelper.c", use
    "virIsDevMapperDevice" instead.
  - Requires "device-mapper" for 'with-storage-disk" in "libvirt.spec.in"
  - Check "dmsetup" in 'configure.ac' for "with-storage-disk"
  - Changes on "src/Makefile.am" to link against libdevmapper
  - New entry for "virIsDevMapperDevice" in "src/libvirt_private.syms"

Changes from v1 to v3:
  - s/virIsDeviceMapperDevice/virIsDevMapperDevice/g
  - replace "virRun" with "virCommand"
  - sort the list of util functions in "libvirt_private.syms"
  - ATTRIBUTE_NONNULL(1) for virIsDevMapperDevice declaration.

e.g.

Name                 Path
-----------------------------------------
3600a0b80005ad1d7000093604cae912fp1 /dev/mapper/3600a0b80005ad1d7000093604cae912fp1

Vol /dev/mapper/3600a0b80005ad1d7000093604cae912fp1 deleted

Name                 Path
-----------------------------------------

14 years agoRelease of libvirt-0.8.8
Daniel Veillard [Thu, 17 Feb 2011 04:11:03 +0000 (12:11 +0800)]
Release of libvirt-0.8.8

* configure.ac docs/news.html.in libvirt.spec.in: bump version and add docs
* po/*.po*: updated Gujarati, Polish and Dutch localisations and regenerated

14 years agoqemu: Error prompt when saving a shutoff domain
Osier Yang [Thu, 17 Feb 2011 03:18:47 +0000 (11:18 +0800)]
qemu: Error prompt when saving a shutoff domain

"qemudDomainSaveFlag" goto wrong label "endjob", which will cause
error when security manager trying to restore label (regression).

As it's more reasonable to check if vm is shutoff immediately, and
return right away if it is, remove the checking in "qemudDomainSaveFlag",
and add checking in "qemudDomainSave".

* src/qemu/qemu_driver.c

14 years agomaint: delete unused 'make install' step
Eric Blake [Wed, 16 Feb 2011 17:21:21 +0000 (10:21 -0700)]
maint: delete unused 'make install' step

Libxml2-Logo-90x34.gif was removed from the repository in Sep 2009
(commit d6d528c) because our docs no longer reference it.

* docs/Makefile.am (install-data-local): Don't install missing file.

14 years agocgroup: preserve correct errno on failure
Eric Blake [Tue, 15 Feb 2011 23:50:34 +0000 (16:50 -0700)]
cgroup: preserve correct errno on failure

* src/util/cgroup.c (virCgroupSetValueStr, virCgroupGetValueStr)
(virCgroupRemoveRecursively): VIR_DEBUG can clobber errno.
(virCgroupRemove): Use VIR_DEBUG rather than DEBUG.

14 years agoUpdate czech localization
Zdenek Styblik [Wed, 16 Feb 2011 13:40:44 +0000 (21:40 +0800)]
Update czech localization

14 years agoqemu: Fix command line generation with faked host CPU
Jiri Denemark [Tue, 15 Feb 2011 14:23:17 +0000 (15:23 +0100)]
qemu: Fix command line generation with faked host CPU

The code expected that host CPU architecture matches the architecture on
which libvirt runs. This is normally true but not in tests, where host
CPU is faked to produce consistent results.

14 years agotests: Fake host capabilities properly
Jiri Denemark [Tue, 15 Feb 2011 14:24:39 +0000 (15:24 +0100)]
tests: Fake host capabilities properly

Since we fake host CPU we should also fake host arch instead of taking
the real architecture tests are running on.

14 years agodocs: fix typos
Eric Blake [Tue, 15 Feb 2011 20:50:28 +0000 (13:50 -0700)]
docs: fix typos

* docs/drvopenvz.html.in: Spell administrator correctly.
* docs/drvuml.html.in: Likewise.
* src/qemu/qemu.conf: Likewise.  Fix other typos, too.

14 years agoAvoid empty strings when --with-packager(-version) is not specified
Matthias Bolte [Tue, 15 Feb 2011 18:48:44 +0000 (19:48 +0100)]
Avoid empty strings when --with-packager(-version) is not specified

Make with_packager and with_packager_version default to "no". This way
--without-packager-version (as shorthand for --with-packager(-version)=no)
works correctly too.

Prior to this patch libvirt outputs a line like this when
--with-packager(-version) was not specified

# ./daemon/libvirtd
14:11:15.018: 31796: info : libvirt version: 0.8.8, package:  ()

Now the unspecified parts are correctly omitted.

Reported by Osier Yang.

14 years agobuild: address clang reports about virCommand
Eric Blake [Mon, 14 Feb 2011 22:24:08 +0000 (15:24 -0700)]
build: address clang reports about virCommand

clang had 5 reports against virCommand; three were false positives
(a NULL deref in ProcessIO solved by sa_assert, and two uninitialized
memory operations solved by adding an initializer), but two were real.

* src/util/command.c (virCommandProcessIO): Fix real bug of
possible NULL dereference.  Teach clang that buf is never NULL.
(virCommandRun): Teach clang that infd is only ever accessed when
initialized.

14 years agobuild: silence some clang warnings
Eric Blake [Mon, 14 Feb 2011 23:06:31 +0000 (16:06 -0700)]
build: silence some clang warnings

* tools/virsh.c (cmdHelp): Kill dead variables.

14 years agoqemu: don't mask real error with oom report
Eric Blake [Tue, 15 Feb 2011 16:31:39 +0000 (09:31 -0700)]
qemu: don't mask real error with oom report

* src/qemu/qemu_command.c (qemuBuildCommandLine): Don't report oom
after qemuBuildControllerDevStr, which reported its own errors.

14 years agoqemu: avoid NULL derefs
Eric Blake [Mon, 14 Feb 2011 23:51:59 +0000 (16:51 -0700)]
qemu: avoid NULL derefs

The processWatchdogEvent fix is real, although it can only trigger
on OOM, since bad things happen if doCoreDump is called with a NULL
pathname argument.  The other fixes silence clang, but aren't a real
bug because virReportErrorHelper tolerates a NULL format string even
though *printf does not.

* src/qemu/qemu_driver.c (processWatchdogEvent): Exit on OOM.
(qemuDomainIsActive, qemuDomainIsPersistent, qemuDomainIsUpdated):
Provide valid message.

14 years agovirDomainMemoryStats: avoid null dereference
Eric Blake [Mon, 14 Feb 2011 23:20:39 +0000 (16:20 -0700)]
virDomainMemoryStats: avoid null dereference

* src/libvirt.c (virDomainMemoryStats): Check domain before flags.

14 years agodocs: added link for nimbus to apps page
Justin Clift [Mon, 14 Feb 2011 15:12:56 +0000 (02:12 +1100)]
docs: added link for nimbus to apps page

14 years agoFix leak of mutex attributes in POSIX threads impl
Daniel P. Berrange [Wed, 15 Dec 2010 14:12:30 +0000 (14:12 +0000)]
Fix leak of mutex attributes in POSIX threads impl

* src/util/threads-pthread.c: Fix mutex leak

14 years agoFix leak in SCSI storage backend
Daniel P. Berrange [Fri, 10 Dec 2010 12:26:41 +0000 (12:26 +0000)]
Fix leak in SCSI storage backend

The SCSI storage backend leaks a string containing the pathname
for each block device it discovers

* src/storage/storage_backend_scsi.c: Free the device name

14 years agoOutput commandline on status != 0 in virCommandWait
Matthias Bolte [Tue, 15 Feb 2011 10:46:16 +0000 (11:46 +0100)]
Output commandline on status != 0 in virCommandWait

This helps identifying which command exited with status != 0.

14 years agoadd missing error handling to virGetDomain
Christophe Fergeau [Tue, 15 Feb 2011 03:05:38 +0000 (11:05 +0800)]
add missing error handling to virGetDomain

When creating the virDomain::snapshots hash table, virGetDomain
wasn't checking if the creation was successful. This would then
lead to failures in the vir*DomainSnapshot functions. Better to
report this error early and make virGetDomain fail if the
snapshots hash couldn't be created.
* src/datatypes.c: report failure to make a hash table

14 years agocall virReportOOMError when appropriate in hash.c
Christophe Fergeau [Tue, 15 Feb 2011 02:59:01 +0000 (10:59 +0800)]
call virReportOOMError when appropriate in hash.c

A couple of allocation were not calling virReportOOMError on allocation
errors

* src/util/hash.c: add the needed call in virHashCreate and
  virHashAddOrUpdateEntry

14 years agostorage: Create enough volumes for mpath pool
Osier Yang [Tue, 15 Feb 2011 02:12:24 +0000 (10:12 +0800)]
storage: Create enough volumes for mpath pool

"virStorageBackendCreateVols":
  "names->next" serves as condition expression for "do...while",
however, "names" was shifted before, it then results in one less
loop, and thus, one less volume will be created for mpath pool,
the patch is to fix it.

* src/storage/storage_backend_mpath.c

14 years agomaint: kill dead assignments
Eric Blake [Tue, 15 Feb 2011 00:34:14 +0000 (17:34 -0700)]
maint: kill dead assignments

* src/network/bridge_driver.c (networkStartNetworkDaemon): Delete
unused assignments.

14 years agoqemu: avoid NULL deref on error
Eric Blake [Tue, 15 Feb 2011 00:34:05 +0000 (17:34 -0700)]
qemu: avoid NULL deref on error

* src/qemu/qemu_command.c (qemuParseCommandLineDisk): Report error
before cleaning def.

14 years agobuild: silence false positive clang report
Eric Blake [Mon, 14 Feb 2011 21:23:11 +0000 (14:23 -0700)]
build: silence false positive clang report

clang complained that STREQ(group->controllers[i].mountPoint,...)  was
a NULL dereference when i==VIR_CGROUP_CONTROLLER_CPUSET, because it
assumes the worst about virCgroupPathOfController.  Marking the
argument const doesn't yet have an effect, per this clang bug:
http://llvm.org/bugs/show_bug.cgi?id=7758

So, we use sa_assert, which was designed to shut up false positives
from tools like clang.

* src/util/cgroup.c (virCgroupMakeGroup): Teach clang that there
is no NULL dereference.

14 years agoqemu: ignore failure of qemu -M ? on older qemu
Eric Blake [Mon, 14 Feb 2011 20:00:22 +0000 (13:00 -0700)]
qemu: ignore failure of qemu -M ? on older qemu

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

Regression introduced in commit 2211518.

* src/qemu/qemu_capabilities.c (qemuCapsProbeMachineTypes): Allow
non-zero exit status.

14 years agoxml: avoid compiler warning
Eric Blake [Mon, 14 Feb 2011 20:38:55 +0000 (13:38 -0700)]
xml: avoid compiler warning

Detected by clang.

* src/util/xml.c (virXPathStringLimit): Use %zd, not obsolete %Zd.

14 years agonwfilter: reorder match extensions relative to state match
Stefan Berger [Mon, 14 Feb 2011 19:10:24 +0000 (14:10 -0500)]
nwfilter: reorder match extensions relative to state match

This patch reorders the connlimit and comment match extensions relative to the state match (-m state); connlimit being most useful if found after a -m state --state NEW and not before it.

14 years agoconf: Fix XML generation for smartcards
Jiri Denemark [Mon, 14 Feb 2011 10:49:28 +0000 (11:49 +0100)]
conf: Fix XML generation for smartcards

When formatting XML for smartcard device with mode=host, libvirt
generates invalid XML if the device has address info associated:

<smartcard mode='host' <address type='ccid' controller='0' slot='1'/>

14 years agoFix cleanup on VM state after failed QEMU startup
Daniel P. Berrange [Mon, 14 Feb 2011 09:35:47 +0000 (09:35 +0000)]
Fix cleanup on VM state after failed QEMU startup

Commit 9962e406c664ed5521f5aca500c860a331cb3979 introduced a
problem where if the VM failed to startup, it would not be
correctly cleaned up. Amongst other things the SELinux
security label would not be removed, which prevents the VM
from ever starting again.

The virDomainIsActive() check at the start of qemudShutdownVMDaemon
checks for vm->def->id not being -1. By moving the assignment of the
VM id to the start of qemudStartVMDaemon, we can ensure cleanup will
occur on failure

* src/qemu/qemu_driver.c: Move initialization of 'vm->def->id'
  so that qemudShutdownVMDaemon() will process the shutdown

14 years agolibvirt-qemu: Fix enum type declaration
Jiri Denemark [Mon, 14 Feb 2011 11:04:00 +0000 (12:04 +0100)]
libvirt-qemu: Fix enum type declaration

14 years agofix OOM handling in hash routines
Christophe Fergeau [Mon, 14 Feb 2011 05:36:06 +0000 (13:36 +0800)]
fix OOM handling in hash routines

* src/util/hash.c: virHashAddEntry and virHashUpdateEntry were missing NULL
  checks on strdup
* AUTHORS: add Christophe Fergeau

14 years agoUpdate src/README
Matthias Bolte [Sat, 12 Feb 2011 16:09:28 +0000 (17:09 +0100)]
Update src/README

Add missing subdirectories.

14 years agovirsh: avoid mingw compiler warnings
Eric Blake [Sat, 12 Feb 2011 00:17:12 +0000 (17:17 -0700)]
virsh: avoid mingw compiler warnings

Compilation on mingw was warning about %lld use in fprintf, and
in the gnulib strptime module about dead labels.

* tools/virsh.c (vshPrint): Change redirect.
(vshPrintExtra): Allow use within vshPrint.  Avoid fprintf on
arbitrary formats, since we aren't using gnulib module; instead,
use virVasprintf to pre-format.
(vshError): Likewise.
* .gnulib: Update to latest, for mingw strptime warning fix.
Reported by Matthias Bolte.

14 years agobuild: avoid problems with autogen.sh runs from tarball
Eric Blake [Fri, 11 Feb 2011 17:35:54 +0000 (10:35 -0700)]
build: avoid problems with autogen.sh runs from tarball

Introduced by commit fac97c65c distributing cfg.mk, which
previously could blindly assume it was in a git checkout.

* cfg.mk (_update_required): Also check for .git.
* autogen.sh: Don't run bootstrap from a tarball.
Reported by Daniel Veillard.

14 years agodocs: Distribute XSLT files to generate HACKING
Matthias Bolte [Fri, 11 Feb 2011 10:03:31 +0000 (11:03 +0100)]
docs: Distribute XSLT files to generate HACKING

14 years agoqemu: Report a more informative error for missing cgroup controllers
Matthias Bolte [Fri, 11 Feb 2011 10:02:39 +0000 (11:02 +0100)]
qemu: Report a more informative error for missing cgroup controllers

Also use VIR_ERR_OPERATION_INVALID instead of VIR_ERR_NO_SUPPORT, as
the operation could succeed when the cgroup controller was mounted.

14 years agoxen: Prevent updating device when attaching a device
Osier Yang [Sat, 12 Feb 2011 06:29:09 +0000 (14:29 +0800)]
xen: Prevent updating device when attaching a device

When attaching a device that already exists, xend driver updates
the device with "device_configure", it causes problems (e.g. for
disk device, 'device_configure' only can be used to update device
like CDROM), on the other hand, we provide additional API
(virDomainUpdateDevice) to update device, this fix is to raise up
errors instead of updating the existed device which is not CDROM
device.

Changes from v1 to v2:
  - allow to update CDROM

* src/xen/xend_internal.c

14 years agobuild: fix cygwin strerror_r failure
Eric Blake [Fri, 11 Feb 2011 19:32:17 +0000 (12:32 -0700)]
build: fix cygwin strerror_r failure

Building the 0.8.8 release candidate on cygwin produced this compiler
warning, which is indicative of catastrophic failure on any attempt to
print an error message with errno turned to a string:

  CC       strerror_r.lo
strerror_r.c: In function 'rpl_strerror_r':
strerror_r.c:67: warning: assignment makes integer from pointer without a cast

This has been fixed in gnulib.

* .gnulib: Update to latest, for strerror_r fix.
* src/util/memory.c (includes): Satisfy 'make syntax-check'.

14 years agoqemu: Fix escape_monitor(escape_shell(command))
Philipp Hahn [Fri, 11 Feb 2011 12:59:11 +0000 (13:59 +0100)]
qemu: Fix escape_monitor(escape_shell(command))

Suspending a VM which contains shell meta characters doesn't work with
libvirt-0.8.7:
/var/log/libvirt/qemu/andreas_231-ne\ doch\ nicht.log:
  sh: -c: line 0: syntax error near unexpected token `doch'
  sh: -c: line 0: `cat | { dd bs=4096 seek=1 if=/dev/null && dd bs=1048576; }

Although target="andreas_231-ne doch nicht" contains shell meta
characters (here: blanks), they are not properly escaped by
src/qemu/qemu_monitor_{json,text}.c#qemuMonitor{JSON,Text}MigrateToFile()

First, the filename needs to be properly escaped for the shell, than
this command line has to be properly escaped for qemu again.

For this to work, remove the old qemuMonitorEscapeArg() wrapper, rename
qemuMonitorEscape() to it removing the handling for shell=TRUE, and
implement a new qemuMonitorEscapeShell() returning strings using single
quotes.

Using double quotes or escaping special shell characters with backslashes
would also be possible, but the set of special characters heavily
depends on the concrete shell (dsh, bash, zsh) and its setting (history
expansion, interactive use, ...)

Signed-off-by: Philipp Hahn <hahn@univention.de>
14 years agoImprint all logs with version + package build information
Daniel P. Berrange [Thu, 27 Jan 2011 18:11:16 +0000 (18:11 +0000)]
Imprint all logs with version + package build information

The logging functions are enhanced so that immediately prior to
the first log message being printed to any output channel, the
libvirt package version will be printed.

eg

 $ LIBVIRT_DEBUG=1 virsh
 18:13:28.013: 17536: info : libvirt version: 0.8.7
 18:13:28.013: 17536: debug : virInitialize:361 : register drivers
 ...

The 'configure' script gains two new arguments which can be
used as

   --with-packager="Fedora Project, x86-01.phx2.fedoraproject.org, 01-27-2011-18:00:10"
   --with-packager-version="1.fc14"

to allow distros to append a custom string with package specific
data.

The RPM specfile is modified so that it appends the RPM version,
the build host, the build date and the packager name.

eg

 $ LIBVIRT_DEBUG=1 virsh
 18:14:52.086: 17551: info : libvirt version: 0.8.7, package: 1.fc13 (Fedora Project, x86-01.phx2.fedoraproject.org, 01-27-2011-18:00:10)
 18:14:52.086: 17551: debug : virInitialize:361 : register drivers

Thus when distro packagers receive bug reports they can clearly
see what version was in use, even if the bug reporter mistakenly
or intentionally lies about version/builds

* src/util/logging.c: Output version data prior to first log message
* libvirt.spec.in: Include RPM release, date, hostname & packager
* configure.ac: Add --with-packager & --with-packager-version args

14 years agoqemu: fix attach-interface regression
Wen Congyang [Thu, 10 Feb 2011 02:19:38 +0000 (10:19 +0800)]
qemu: fix attach-interface regression

QEMUD_CMD_FLAG_PCI_MULTIBUS should be set in the function
qemuCapsExtractVersionInfo()

The flag QEMUD_CMD_FLAG_PCI_MULTIBUS is used in the function
qemuBuildDeviceAddressStr(). All callers get qemuCmdFlags
by the function qemuCapsExtractVersionInfo() except that
testCompareXMLToArgvFiles() in qemuxml2argvtest.c.

So we should set QEMUD_CMD_FLAG_PCI_MULTIBUS in the function
qemuCapsExtractVersionInfo() instead of qemuBuildCommandLine()
because the function qemuBuildCommandLine() does not be called
when we attach a pci device.

tests: set QEMUD_CMD_FLAG_PCI_MULTIBUS in testCompareXMLToArgvFiles()

set QEMUD_CMD_FLAG_PCI_MULTIBUS before calling qemuBuildCommandLine()
as the flags is not set by qemuCapsExtractVersionInfo().

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
14 years agoAvoid pthread_sigmask on Win32 platforms
Daniel P. Berrange [Thu, 10 Feb 2011 12:46:29 +0000 (12:46 +0000)]
Avoid pthread_sigmask on Win32 platforms

Win32 doesn't have a concept of signal masks so disable that
code. It is unclear how SIGINT is delivered (if at all) on
Win32, so this might further work to provide an alternative
to pthread_sigmask

* tools/virsh.c: Avoid pthread_sigmask on Win32

14 years agoReduce log level when cgroups aren't mounted
Daniel P. Berrange [Thu, 10 Feb 2011 10:47:46 +0000 (10:47 +0000)]
Reduce log level when cgroups aren't mounted

Quite a few hosts don't have cgroups mounted and so see warnings
from libvirt logged, which then cause bug reports, etc. Reduce
the log level to INFO so they're not visible by default

* src/qemu/qemu_driver.c: Reduce log level for cgroups

14 years agoAvoid warnings from nwfilter driver when run non-root
Daniel P. Berrange [Thu, 10 Feb 2011 10:46:21 +0000 (10:46 +0000)]
Avoid warnings from nwfilter driver when run non-root

When run non-root the nwfilter driver logs error messages about
being unable to find iptables/ebtables commands (they are in
/sbin which isn't in $PATH). The nwfilter driver can't ever work
as non-root, so simply skip it entirely thus avoiding the error
messages

* src/conf/nwfilter_conf.h, src/nwfilter/nwfilter_driver.c,
  src/nwfilter/nwfilter_gentech_driver.c,
  src/nwfilter/nwfilter_gentech_driver.h: Pass 'bool privileged'
  flag down to final driver impl
* src/nwfilter/nwfilter_ebiptables_driver.c: Skip initialization
  if not privileged

14 years agoFix typo in parsing of spice 'auth' data
Michal Privoznik [Thu, 10 Feb 2011 10:50:10 +0000 (10:50 +0000)]
Fix typo in parsing of spice 'auth' data

A typo s/spice/vnc/ caused parsing of the spice 'auth' data
to write into the wrong part of the struct, blowing away
other unrelated data.

* src/conf/domain_conf.c: s/vnc/spice/ in parsing spice auth

14 years agobuild: distribute 'make syntax-check' tweaks
Eric Blake [Tue, 1 Feb 2011 22:33:44 +0000 (15:33 -0700)]
build: distribute 'make syntax-check' tweaks

* Makefile.am (EXTRA_DIST): Distribute cfg.mk.

14 years agodocs: Add information about libvirt-php new location
Michal Novotny [Wed, 9 Feb 2011 18:44:03 +0000 (19:44 +0100)]
docs: Add information about libvirt-php new location

Signed-off-by: Michal Novotny <minovotn@redhat.com>
14 years agomaint: whitespace cleanup
Eric Blake [Fri, 4 Feb 2011 18:16:35 +0000 (11:16 -0700)]
maint: whitespace cleanup

* .dir-locals.el (html-mode): Let emacs help out.
* cfg.mk (sc_TAB_in_indentation): Check more files.
* docs/internals/command.html.in: Fix offenders.
* docs/formatdomain.html.in: Likewise.
* docs/internals.html.in: Likewise.
Reported by Jiri Denemark.

14 years agoAdjust some log levels in udev driver
Daniel P. Berrange [Wed, 9 Feb 2011 16:41:30 +0000 (16:41 +0000)]
Adjust some log levels in udev driver

Most of te VIR_INFO calls in the udev driver are only relevant
to developers so can switch to VIR_DEBUG. Failure to initialize
libpciaccess though is a fatal error

* src/node_device/node_device_udev.c: Adjust log levels

14 years agoAdd check for binary existing in machine type probe
Daniel P. Berrange [Wed, 2 Feb 2011 12:35:31 +0000 (12:35 +0000)]
Add check for binary existing in machine type probe

When probing machine types if the QEMU binary does not exist
we get a hard to diagnose error, due to the execve() in the
child failing

error: internal error Child process exited with status 1.

Add an explicit check so that we get

error: Cannot find QEMU binary /usr/libexec/qem3u-kvm: No such file or directory

* src/qemu/qemu_capabilities.c: Check for QEMU binary

14 years agoAdd a little more debugging for async events
Daniel P. Berrange [Thu, 27 Jan 2011 15:06:05 +0000 (15:06 +0000)]
Add a little more debugging for async events

To make it easier to investigate problems with async event
delivery, add two more debugging lines

* daemon/remote.c: Debug when an event is queued for dispatch
* src/remote/remote_driver.c: Debug when an event is received
  for processing

14 years agoMove connection driver modules directory
Daniel P. Berrange [Fri, 21 Jan 2011 17:42:07 +0000 (17:42 +0000)]
Move connection driver modules directory

When built as modules, the connection drivers live
in $LIBDIR/libvirt/drivers. Now we add lock manager
drivers, we need to distinguish. So move the existing
modules to 'connection-driver'

* src/Makefile.am: Move module install dir
* src/driver.c: Move module search dir

14 years agoReset logging filter function when forking
Daniel P. Berrange [Mon, 24 Jan 2011 12:07:21 +0000 (12:07 +0000)]
Reset logging filter function when forking

To ensure child processes will log all error messages, reset
the logging filter function when forking

* src/util/util.c: Reset log filter in fork

14 years agoBlock SIGPIPE around virExec hook functions
Daniel P. Berrange [Fri, 21 Jan 2011 17:48:48 +0000 (17:48 +0000)]
Block SIGPIPE around virExec hook functions

Some functionality run in virExec hooks may do I/O which
can trigger SIGPIPE. Renable SIGPIPE blocking around the
hook function

* src/util/util.c: Block SIGPIPE around hooks

14 years agoSupport SCSI RAID type & lower log level for unknown types
Daniel P. Berrange [Mon, 7 Feb 2011 17:25:06 +0000 (17:25 +0000)]
Support SCSI RAID type & lower log level for unknown types

The Linux kernel headers don't have a value for SCSI type 12,
but HAL source code shows this to be a 'raid'. Add workaround
for this type. Lower log level for unknown types since
this is not a fatal error condition. Include the device sysfs
path in the log output to allow identification of which device
has problems.

* src/node_device/node_device_udev.c: Add SCSI RAID type

14 years agoOnly initialize/cleanup libpciaccess once
Daniel P. Berrange [Mon, 7 Feb 2011 17:04:35 +0000 (17:04 +0000)]
Only initialize/cleanup libpciaccess once

libpciaccess has many bugs in its pci_system_init/cleanup
functions that makes calling them multiple times unwise.
eg it will double close() FDs, and leak other FDs.

* src/node_device/node_device_udev.c: Only initialize
  libpciaccess once

14 years agoDon't use CLONE_NEWUSER for now
Serge E. Hallyn [Wed, 9 Feb 2011 02:58:24 +0000 (20:58 -0600)]
Don't use CLONE_NEWUSER for now

Until now, user namespaces have not done much, but (for that
reason) have been innocuous to glob in with other CLONE_
flags.  Upcoming userns development, however, will make tasks
cloned with CLONE_NEWUSER far more restricted.  In particular,
for some time they will be unable to access files with anything
other than the world access perms.

This patch assumes that noone really needs the user namespaces
to be enabled.  If that is wrong, then we can try a more
baroque patch where we create a file owned by a test userid with
700 perms and, if we can't access it after setuid'ing to that
userid, then return 0.  Otherwise, assume we are using an
older, 'harmless' user namespace implementation.

Comments appreciated.  Is it ok to do this?

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
14 years agosysinfo: implement qemu support
Eric Blake [Mon, 7 Feb 2011 23:16:04 +0000 (16:16 -0700)]
sysinfo: implement qemu support

* src/qemu/qemu_driver.c (qemuGetSysinfo): New function.
(qemuDriver): Install it.

14 years agosysinfo: refactor xml formatting
Eric Blake [Mon, 7 Feb 2011 23:16:04 +0000 (16:16 -0700)]
sysinfo: refactor xml formatting

* src/util/sysinfo.h (virSysinfoFormat): New prototype.
* src/conf/domain_conf.c (virDomainSysinfoDefFormat): Move guts...
* src/util/sysinfo.c (virSysinfoFormat): ...into new function.
* src/libvirt_private.syms: Export it.

14 years agosysinfo: implement virsh support
Eric Blake [Mon, 7 Feb 2011 22:13:48 +0000 (15:13 -0700)]
sysinfo: implement virsh support

* tools/virsh.c (cmdSysinfo): New function.
(hostAndHypervisorCmds): Add it.
* tools/virsh.pod: Document it.

14 years agosysinfo: implement the remote protocol
Eric Blake [Mon, 7 Feb 2011 22:04:17 +0000 (15:04 -0700)]
sysinfo: implement the remote protocol

Done by editing the first three files, then running
'make -C src rpcgen', then editing src/remote_protocol-structs
to match.

* daemon/remote.c (remoteDispatchGetSysinfo): New function.
* src/remote/remote_driver.c (remoteGetSysinfo, remote_driver):
Client side serialization.
* src/remote/remote_protocol.x (remote_get_sysinfo_args)
(remote_get_sysinfo_ret): New types.
(REMOTE_PROC_GET_SYSINFO): New enum value.
* daemon/remote_dispatch_args.h: Regenerate.
* daemon/remote_dispatch_prototypes.h: Likewise.
* daemon/remote_dispatch_ret.h: Likewise.
* daemon/remote_dispatch_table.h: Likewise.
* src/remote/remote_protocol.c: Likewise.
* src/remote/remote_protocol.h: Likewise.
* src/remote_protocol-structs: Likewise.

14 years agosysinfo: implement the public API
Eric Blake [Mon, 7 Feb 2011 21:48:24 +0000 (14:48 -0700)]
sysinfo: implement the public API

* src/libvirt.c (virConnectGetSysinfo): New function.
* docs/formatdomain.html.in: Mention it.

14 years agosysinfo: define internal driver API
Eric Blake [Mon, 7 Feb 2011 21:14:56 +0000 (14:14 -0700)]
sysinfo: define internal driver API

* src/driver.h (virDrvGetSysinfo): New typedef.
(_virDriver): New callback member.
* src/esx/esx_driver.c (esxDriver): Add stub for driver.
* src/lxc/lxc_driver.c (lxcDriver): Likewise.
* src/opennebula/one_driver.c (oneDriver): Likewise.
* src/openvz/openvz_driver.c (openvzDriver): Likewise.
* src/phyp/phyp_driver.c (phypDriver): Likewise.
* src/qemu/qemu_driver.c (qemuDriver): Likewise.
* src/remote/remote_driver.c (remote_driver): Likewise.
* src/test/test_driver.c (testDriver): Likewise.
* src/uml/uml_driver.c (umlDriver): Likewise.
* src/vbox/vbox_tmpl.c (Driver): Likewise.
* src/vmware/vmware_driver.c (vmwareDriver): Likewise.
* src/xen/xen_driver.c (xenUnifiedDriver): Likewise.
* src/xenapi/xenapi_driver.c (xenapiDriver): Likewise.

14 years agosysinfo: expose new API
Eric Blake [Mon, 7 Feb 2011 19:52:29 +0000 (12:52 -0700)]
sysinfo: expose new API

The new virConnectGetSysinfo() API allows one to get the system
information associated to a connection host, providing the same
data as a guest that uses <os><smbios mode='host'/></os>, and in
a format that can be pasted into the guest and edited when using
<os><smbios mode='sysinfo'/></os>.

* include/libvirt/libvirt.h.in (virConnectGetSysinfo): Declare.
* src/libvirt_public.syms: Export new symbol.

14 years agoAdding Michal Novotny for previous patch
Daniel Veillard [Wed, 9 Feb 2011 02:05:19 +0000 (10:05 +0800)]
Adding Michal Novotny for previous patch

14 years agoAdd libvirt-php information page
Michal Novotny [Wed, 9 Feb 2011 01:43:09 +0000 (09:43 +0800)]
Add libvirt-php information page

This adds a ibvirt-php information page with some
basic information on libvirt-php project compilation, contribution
and other useful information.