]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
14 years agoChange virtual network XML parsing/formatting to support IPv6
Laine Stump [Wed, 17 Nov 2010 18:36:19 +0000 (13:36 -0500)]
Change virtual network XML parsing/formatting to support IPv6

This commit adds support for IPv6 parsing and formatting to the
virtual network XML parser, including moving around data definitions
to allow for multiple <ip> elements on a single network, but only
changes the consumers of this API to accommodate for the changes in
API/structure, not to add any actual IPv6 functionality. That will
come in a later patch - this patch attempts to maintain the same final
functionality in both drivers that use the network XML parser - vbox
and "bridge" (the Linux bridge-based driver used by the qemu
hypervisor driver).

* src/libvirt_private.syms: Add new private API functions.
* src/conf/network_conf.[ch]: Change C data structure and
  parsing/formatting.
* src/network/bridge_driver.c: Update to use new parser/formatter.
* src/vbox/vbox_tmpl.c: update to use new parser/formatter
* docs/schemas/network.rng: changes to the schema -
  * there can now be more than one <ip> element.
  * ip address is now an ip-addr (ipv4 or ipv6) rather than ipv4-addr
  * new optional "prefix" attribute that can be used in place of "netmask"
  * new optional "family" attribute - "ipv4" or "ipv6"
    (will default to ipv4)
  * define data types for the above
* tests/networkxml2xml(in|out)/nat-network.xml: add multiple <ip> elements
  (including IPv6) to a single network definition to verify they are being
  correctly parsed and formatted.

14 years agomake the <dhcp> element optional in network.rng
Laine Stump [Thu, 16 Dec 2010 17:36:19 +0000 (12:36 -0500)]
make the <dhcp> element optional in network.rng

In practice this has always been optional, but the RNG has shown it as
mandatory, and since all the examples for make check had it, it was
never noticed. One of the existing test cases has been changed to
check for this.

I also noticed that the dhcp/host/ip was still defined as <text/>,
but should really be <ref name='ipv4-addr'/>

14 years agoReplace brSetInetAddress/brSetInetNetmask with brAddInetAddress
Laine Stump [Tue, 14 Dec 2010 17:14:39 +0000 (12:14 -0500)]
Replace brSetInetAddress/brSetInetNetmask with brAddInetAddress

brSetInetAddress can only set a single IP address on the bridge, and
uses a method (ioctl(SIOCSETIFADDR)) that only works for IPv4. Replace
it and brSetInetNetmask with a single function that uses the external
"ip addr add" command to add an address/prefix to the interface - this
supports IPv6, and allows adding multiple addresses to the interface.

Although it isn't currently used in the code, we also add a
brDelInetAddress for completeness' sake.

Also, while we're modifying bridge.c, we change brSetForwardDelay and
brSetEnableSTP to use the new virCommand API rather than the
deprecated virRun, and also log an error message in bridge_driver.c if
either of those fail (previously the failure would be completely
silent).

14 years agoMake virtual network netmasks optional
Laine Stump [Tue, 30 Nov 2010 20:53:17 +0000 (15:53 -0500)]
Make virtual network netmasks optional

When a netmask isn't specified for an IPv4 address, one can be implied
based on what network class range the address is in. The
virNetworkDefPrefix function does this for us, so netmask isn't
required.

14 years agoPass prefix rather than netmask into iptables functions
Laine Stump [Tue, 30 Nov 2010 19:35:58 +0000 (14:35 -0500)]
Pass prefix rather than netmask into iptables functions

IPv6 will use prefix exclusively, and IPv4 will also optionally be
able to use it, and the iptables functions really need a prefix
anyway, so use the new virNetworkDefPrefix() function to send prefixes
into iptables functions instead of netmasks.

Also, in a couple places where a netmask is actually needed, use the
new private API function for it rather than getting it directly. This
will allow for cases where no netmask or prefix is specified (it
returns the default for the current class of network.)

14 years agoConsistently return 0 on success, -1 on failure in bridge_driver.c
Laine Stump [Wed, 15 Dec 2010 06:49:29 +0000 (01:49 -0500)]
Consistently return 0 on success, -1 on failure in bridge_driver.c

Some functions in this file were returning 1 on success and 0 on
failure, and others were returning 0 on success and -1 on
failure. Switch them all to return the libvirt-preferred 0/-1.

14 years agoFix logging of failed iptables commands
Laine Stump [Tue, 14 Dec 2010 20:01:10 +0000 (15:01 -0500)]
Fix logging of failed iptables commands

The functions in iptables.c all return -1 on failure, but all their
callers (which all happen to be in bridge_driver.c) assume that they
are returning an errno, and the logging is done accordingly. This
patch fixes all the error checking and logging to assume < 0 is an
error, and nothing else.

14 years agoNew virNetworkDef utility functions
Laine Stump [Fri, 26 Nov 2010 22:20:37 +0000 (17:20 -0500)]
New virNetworkDef utility functions

Later patches will add the possibility to define a network's netmask
as a prefix (0-32, or 0-128 in the case of IPv6). To make it easier to
deal with definition of both kinds (prefix or netmask), add two new
functions:

virNetworkDefNetmask: return a copy of the netmask into a
virSocketAddr. If no netmask was specified in the XML, create a
default netmask based on the network class of the virNetworkDef's IP
address.

virNetworkDefPrefix: return the netmask as numeric prefix (or the
default prefix for the network class of the virNetworkDef's IP
address, if no netmask was specified in the XML)

14 years agoNew virSocketAddr utility functions
Laine Stump [Fri, 26 Nov 2010 18:51:44 +0000 (13:51 -0500)]
New virSocketAddr utility functions

virSocketPrefixToNetmask: Given a 'prefix', which is the number of 1
bits in a netmask, fill in a virSocketAddr object with a netmask as an
IP address (IPv6 or IPv4).

virSocketAddrMask: Mask off the host bits in one virSocketAddr
according to the netmask in another virSocketAddr.

virSocketAddrMaskByPrefix, Mask off the host bits in a virSocketAddr
according to a prefix (number of 1 bits in netmask).

VIR_SOCKET_FAMILY: return the family of a virSocketAddr

14 years agofix syntax error in configure.ac
Wen Congyang [Thu, 23 Dec 2010 09:32:33 +0000 (17:32 +0800)]
fix syntax error in configure.ac

When I run configure, I receive some syntax error.

.....
checking where to find <rpc/rpc.h>... none
checking for library containing dlopen... -ldl
/configure: line 52500: test: =: unary operator expected
/configure: line 52766: test: =: unary operator expected
checking linux/kvm.h usability... yes
checking linux/kvm.h presence... yes
.....

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
14 years agodocs: Make VMware Workstation / Player page appear in the menu
Matthias Bolte [Thu, 23 Dec 2010 15:56:11 +0000 (16:56 +0100)]
docs: Make VMware Workstation / Player page appear in the menu

By adding it to sitemap.html.in. Also <ul> can't be nested in <p>.

14 years agoqemu: Reparent children when deleting a snapshot
Matthias Bolte [Wed, 22 Dec 2010 20:44:42 +0000 (21:44 +0100)]
qemu: Reparent children when deleting a snapshot

Shorten qemuDomainSnapshotWriteSnapshotMetadata function name
and make it take a snapshot pointer instead of dealing with
the current snapshot. Update other functions accordingly.

Add a qemuDomainSnapshotReparentChildren hash iterator to
reparent the children of a snapshot that is being deleted. Use
qemuDomainSnapshotWriteMetadata to write updated metadata
to disk.

This fixes a problem where outdated parent information breaks
the snapshot tree and hinders the deletion of child snapshots.

Reported by Philipp Hahn.

14 years agoAdd info about VMware driver to the libvirt website
Jean-Baptiste Rouault [Thu, 23 Dec 2010 08:35:51 +0000 (09:35 +0100)]
Add info about VMware driver to the libvirt website

14 years agovirsh: Add --force option to update-device
Jiri Denemark [Wed, 22 Dec 2010 16:01:53 +0000 (17:01 +0100)]
virsh: Add --force option to update-device

14 years agoSet bitmap size when allocating a bitmap
Jim Fehlig [Wed, 22 Dec 2010 18:15:32 +0000 (11:15 -0700)]
Set bitmap size when allocating a bitmap

I began noticing a race when reserving VNC ports as described here

https://www.redhat.com/archives/libvir-list/2010-November/msg00379.html

Turns out that we were not initializing the size field of bitmap
struct when allocating the bitmap.  This subsequently caused
virBitmapSetBit() to fail since bitmap->size is 0, hence we never
actually reserved the port.

14 years agoesx: Add support for storage volume wiping
Matthias Bolte [Wed, 22 Dec 2010 16:24:45 +0000 (17:24 +0100)]
esx: Add support for storage volume wiping

14 years agoesx: Add support for storage volume deletion
Matthias Bolte [Wed, 22 Dec 2010 15:45:50 +0000 (16:45 +0100)]
esx: Add support for storage volume deletion

14 years agoqemu: Return SPICE ports on domain shutdown
Jiri Denemark [Wed, 22 Dec 2010 13:33:49 +0000 (14:33 +0100)]
qemu: Return SPICE ports on domain shutdown

Commit ed0d9f6c0cdd56f38ce31b8d9b5293162addaa23 added support for
automatic port allocation for SPICE but forgot to mark such ports as
unused when they are not used anymore.

14 years agovirterror: avoid API breakage with vmware
Eric Blake [Tue, 21 Dec 2010 22:06:27 +0000 (15:06 -0700)]
virterror: avoid API breakage with vmware

Fix glitch in commit cddd2a06 (thankfully post-0.8.6, so no
released version has the glitch).

Document and try to workaround glitch in commit 46e9b0f (in 0.8.0),
which invalidated 6 virErrorNumber values dating as far back as 0.7.1.

My audit did not find any other glitches until pre-0.1.0 days.  I'm
not sure how to add a syntax-check off the top of my head, but
hopefully the explicit numbering will make people think twice about
renumbering in the future.

* include/libvirt/virterror.h (virErrorDomain): Avoid inserting
new values in the middle, and add explicit numbering to help avoid
this in the future.
(virErrorNumber): Add explicit numbering, and document the snafu.
* src/remote/remote_driver.c (remoteIO): Compensate for the snafu.

14 years agoFix memory leak in virsh
Hu Tao [Wed, 22 Dec 2010 07:12:34 +0000 (15:12 +0800)]
Fix memory leak in virsh

14 years agodocs: fixed typo, added table of contents
Justin Clift [Wed, 22 Dec 2010 12:48:25 +0000 (23:48 +1100)]
docs: fixed typo, added table of contents

14 years agoDistribute libvirt_vmx.syms
Matthias Bolte [Tue, 21 Dec 2010 23:48:11 +0000 (00:48 +0100)]
Distribute libvirt_vmx.syms

This fixes the build from a tarball and makes autobuild.sh
work again.

This should actually have been part of this earlier commit:

  esx: Move VMX handling code out of the driver directory
  42b2f35d36a9e33f03e973130267c19cff910f2e

Reported by Eric Blake.

14 years agovmware: Fix undefine symbol with loadable drivers enabled
Matthias Bolte [Tue, 21 Dec 2010 21:47:35 +0000 (22:47 +0100)]
vmware: Fix undefine symbol with loadable drivers enabled

All other drivers are explicitly linked to gnulib. The VMware
driver lacked this, resulting in mdir_name being an undefine
symbol.

Explicitly link the VMware driver to gnulib to fix this.

14 years agoesx: Move VMX handling code out of the driver directory
Matthias Bolte [Tue, 21 Dec 2010 21:39:55 +0000 (22:39 +0100)]
esx: Move VMX handling code out of the driver directory

Now the VMware driver doesn't depend on the ESX driver anymore.

Add a WITH_VMX option that depends on WITH_ESX and WITH_VMWARE.
Also add a libvirt_vmx.syms file.

Move some escaping functions from esx_util.c to vmx.c.

Adapt the test suite, ESX and VMware driver to the new code layout.

14 years agoesx: Fix cluster resource lookup when connecting to a vCenter
Matthias Bolte [Mon, 20 Dec 2010 18:16:05 +0000 (19:16 +0100)]
esx: Fix cluster resource lookup when connecting to a vCenter

Connecting to a ESX(i) server that is part of a cluster failed
when the connection also involved a vCenter.

Accept ClusterComputeResource type in addition to ComputeResource
type in the object lookup function.

Reported by Guillaume Le Louët.

14 years agomaint: avoid space-tab
Eric Blake [Tue, 21 Dec 2010 15:58:03 +0000 (08:58 -0700)]
maint: avoid space-tab

* daemon/Makefile.am: Avoid spurious space before tabs.
* src/Makefile.am: Likewise.
* examples/dominfo/Makefile.am: Likewise.
* examples/domsuspend/Makefile.am: Likewise.
* tools/Makefile.am: Likewise.
* src/datatypes.h (VIR_CONNECT_MAGIC): Likewise.
* src/internal.h (TODO): Likewise.
* src/qemu/qemu_monitor.h (QEMU_MONITOR_MIGRATE): Likewise.
* src/xen/xen_hypervisor.c (XEN_V2_OP_GETAVAILHEAP): Likewise.
* src/xen/xs_internal.h: Likewise.

14 years agocommand: avoid hanging on daemon processes
Eric Blake [Tue, 21 Dec 2010 18:49:49 +0000 (11:49 -0700)]
command: avoid hanging on daemon processes

* src/util/command.c (virCommandRun): Don't capture output on
daemons.
* tests/commandtest.c (test18): Expose the bug.
Reported by Laine Stump.

14 years agobuild: skip vmware driver when building for RHEL
Eric Blake [Tue, 21 Dec 2010 17:13:50 +0000 (10:13 -0700)]
build: skip vmware driver when building for RHEL

* libvirt.spec.in: Provide vmware conditionals.

14 years agostorage: Ignore dangling symbolic link for filesystem pool
Osier Yang [Tue, 21 Dec 2010 06:45:24 +0000 (14:45 +0800)]
storage: Ignore dangling symbolic link for filesystem pool

If there is a dangling symbolic link in filesystem pool, the pool
will fail to start or refresh, this patch is to fix it by ignoring
it with a warning log.

14 years agoSkip file-based security checks for network disks
Josh Durgin [Tue, 21 Dec 2010 02:30:58 +0000 (18:30 -0800)]
Skip file-based security checks for network disks

Network disks are accessed by qemu directly, and have no
associated file on the host, so checking for file ownership etc.
is unnecessary.

Signed-off-by: Josh Durgin <joshd@hq.newdream.net>
14 years agodocs: added compiling page and significantly expanded windows page
Justin Clift [Tue, 21 Dec 2010 09:38:37 +0000 (20:38 +1100)]
docs: added compiling page and significantly expanded windows page

Also added an additional menu placement for the windows page, in
order to attract further potential testers.

14 years agobuild: make building on cygwin easier
Eric Blake [Wed, 8 Dec 2010 03:35:08 +0000 (20:35 -0700)]
build: make building on cygwin easier

* configure.ac (dlopen): Cygwin dlopen is in libc; avoid spurious
failure.
(XDR_CFLAGS): Define when needed.
* src/Makefile.am (libvirt_driver_remote_la_CFLAGS): Use it.

14 years agoqemu: use virAsprintf instead of PATH_MAX
Eric Blake [Wed, 8 Dec 2010 18:36:08 +0000 (11:36 -0700)]
qemu: use virAsprintf instead of PATH_MAX

* src/qemu/qemu_driver.c (qemudLogFD, qemudLogReadFD)
(qemudStartup, qemudGetProcessInfo): Use heap instead of stack.

14 years agotests: avoid spurious failure of nodeinfotest
Eric Blake [Wed, 15 Dec 2010 20:49:00 +0000 (13:49 -0700)]
tests: avoid spurious failure of nodeinfotest

When running 'make check' under a multi-cpu Dom0 xen machine,
nodeinfotest had a spurious failure it was reading from
/sys/devices/system/cpu, but xen has no notion of topology.  The test
was intended to be isolated from reading any real system files; the
regression was introduced in Mar 2010 with commit aa2f6f96dd.

Fix things by allowing an early exit for the testsuite.

* src/nodeinfo.c (linuxNodeInfoCPUPopulate): Add parameter.
(nodeGetInfo): Adjust caller.
* tests/nodeinfotest.c (linuxTestCompareFiles): Likewise.

14 years agotests: avoid data race
Eric Blake [Wed, 15 Dec 2010 17:23:32 +0000 (10:23 -0700)]
tests: avoid data race

I got some spurious failures when commandhelper won the race and
ran to the point of parent detection prior to the intermediate
daemonizing process getting a chance to exit.  This fixes it.

* tests/commandhelper.c (main): Checking for re-parenting to
init(1) is racy; instead check that we belong to a new session.

14 years agobuild: improve testsuite results with older automake
Eric Blake [Wed, 15 Dec 2010 00:23:22 +0000 (17:23 -0700)]
build: improve testsuite results with older automake

* tests/Makefile.am (TESTS_ENVIRONMENT, commandtest_CFLAGS)
(commandhelper_CFLAGS): Avoid $(builddir) and $(abs_builddir) in
automake 1.9.6; fixes spurious failures of commandtest.

14 years agobuild: allow older libselinux again
Eric Blake [Wed, 15 Dec 2010 00:07:52 +0000 (17:07 -0700)]
build: allow older libselinux again

* configure.ac (with_selinux): Check for <selinux/label.h>.
* src/security/security_selinux.c (getContext): New function.
(SELinuxRestoreSecurityFileLabel): Use it to restore compilation
when using older libselinux.

14 years agobuild: allow autoconf 2.59 again
Eric Blake [Tue, 14 Dec 2010 20:26:44 +0000 (13:26 -0700)]
build: allow autoconf 2.59 again

Autoconf 2.59 doesn't define ${localedir}, so libvirt was failing
to compile due to a missing LOCALEDIR until today's configmake fix.

* .gnulib: Update to latest for configmake fix.
* configure.ac (libpcap): Avoid AS_CASE.

14 years agobuild: fix typo that broke 'make dist'
Wen Congyang [Mon, 20 Dec 2010 06:01:46 +0000 (14:01 +0800)]
build: fix typo that broke 'make dist'

* src/Makefile.am (VMWARE_DRIVER_SOURCES): Fix vmware_driver.h.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
14 years agolibvirt-guests: avoid sourcing failure
Eric Blake [Sat, 18 Dec 2010 00:26:03 +0000 (17:26 -0700)]
libvirt-guests: avoid sourcing failure

* tools/libvirt-guests.init.in (libvirtd): Skip function library
if it is not present.
Suggested by Guido Günther.

14 years agobridge_driver: avoid double call to VIR_FREE
Paweł Krześniak [Mon, 20 Dec 2010 11:31:19 +0000 (12:31 +0100)]
bridge_driver: avoid double call to VIR_FREE

While not technically a double free (since VIR_FREE NULLs the
pointer), this is unnecessary extra code.

This crept in when the function was converted from virRun to virCommand.

The AUTHORS file has also been updated.

14 years agodocs: Add additional indentation to level 3 menu items
Matthias Bolte [Fri, 17 Dec 2010 21:07:23 +0000 (22:07 +0100)]
docs: Add additional indentation to level 3 menu items

formatnetwork.html has a menu item at level 3. libvirt.css
doesn't have a explicit rule for level 3 and level 3 and
level 2 items end up at the same indentation level.

Add an additional 1em indentation to level 3 menu items.

14 years agovbox: Don't leak domain names in vboxListDefinedDomains
Matthias Bolte [Thu, 16 Dec 2010 22:33:14 +0000 (23:33 +0100)]
vbox: Don't leak domain names in vboxListDefinedDomains

14 years agovbox: Don't leak arrays from XPCOM
Matthias Bolte [Thu, 16 Dec 2010 22:15:40 +0000 (23:15 +0100)]
vbox: Don't leak arrays from XPCOM

XPCOM returns an array as a pointer to an array of pointers to the
actual items. When the array isn't needed anymore the items are
released, but the actual array containing the pointers to the items
was not freed and leaked.

Free the actual array using ComUnallocMem.

This doesn't affect MSCOM as SafeArrayDestroy releases all items
and frees the array.

14 years agovbox: Handle different array representations of XPCOM and MSCOM
Matthias Bolte [Thu, 16 Dec 2010 22:05:48 +0000 (23:05 +0100)]
vbox: Handle different array representations of XPCOM and MSCOM

Add a vboxArray to hide the details from the general driver code.

14 years agovbox: Add glue layer for MSCOM on Windows
Matthias Bolte [Tue, 14 Dec 2010 22:07:57 +0000 (23:07 +0100)]
vbox: Add glue layer for MSCOM on Windows

Don't require dlopen, but link to ole32 and oleaut32 on Windows.

Don't expose g_pVBoxFuncs anymore. It was only used to get the
version of the API. Make VBoxCGlueInit return the version instead.
This simplifies the implementation of the MSCOM glue layer.

Get the VirtualBox version from the registry.

Add a dummy implementation of the nsIEventQueue to the MSCOM glue
as there seems to be no direct equivalent with MSCOM. It might be
implemented using the normal window message loop. This requires
additional investigation.

14 years agovbox: Match struct layout of the MSCOM implementation on Windows
Matthias Bolte [Tue, 14 Dec 2010 19:02:49 +0000 (20:02 +0100)]
vbox: Match struct layout of the MSCOM implementation on Windows

14 years agovbox: Use stdcall convention for all COM methods on Windows
Matthias Bolte [Tue, 14 Dec 2010 18:53:52 +0000 (19:53 +0100)]
vbox: Use stdcall convention for all COM methods on Windows

MSCOM requires stdcall convention.

14 years agoAdd VMware Workstation and Player driver
Jean-Baptiste Rouault [Fri, 17 Dec 2010 10:28:20 +0000 (11:28 +0100)]
Add VMware Workstation and Player driver

14 years agomaint: improve tests distribution
Eric Blake [Thu, 16 Dec 2010 18:24:00 +0000 (11:24 -0700)]
maint: improve tests distribution

* tests/Makefile.am (EXTRA_DIST): Sort, and add directories.
(SUBDIRS): Drop automake recursion into subdirs.
* tests/commanddata/Makefile.am: Delete.
* tests/confdata/Makefile.am: Likewise.
* tests/sexpr2xmldata/Makefile.am: Likewise.
* tests/xencapsdata/Makefile.am: Likewise.
* tests/xmconfigdata/Makefile.am: Likewise.
* tests/xml2sexprdata/Makefile.am: Likewise.

14 years agobuild: fix typo that broke 'make dist'
Eric Blake [Fri, 17 Dec 2010 18:55:00 +0000 (11:55 -0700)]
build: fix typo that broke 'make dist'

* src/Makefile.am (QEMU_DRIVER_SOURCES): Ship qemu_cgroup.h.

14 years agoUpdate QEMU test cases for new file locations & API renames
Daniel P. Berrange [Fri, 17 Dec 2010 16:41:51 +0000 (16:41 +0000)]
Update QEMU test cases for new file locations & API renames

* qemuargv2xmltest.c, qemuhelptest.c,
  qemuxml2argvtest.c, testutilsqemu.c: Update includes and
  cope with API renames

14 years agoMove QEMU hotplug helper code out of the QEMU driver
Daniel P. Berrange [Thu, 16 Dec 2010 16:10:54 +0000 (16:10 +0000)]
Move QEMU hotplug helper code out of the QEMU driver

The QEMU driver file is far too large. Move all the hotplug
helper code out into a separate file. No functional change.

* src/qemu/qemu_hotplug.c, src/qemu/qemu_hotplug.h,
  src/Makefile.am: Add hotplug helper file
* src/qemu/qemu_driver.c: Delete hotplug code

14 years agoMove QEMU domain lock / job helper code to separate file
Daniel P. Berrange [Thu, 16 Dec 2010 16:12:02 +0000 (16:12 +0000)]
Move QEMU domain lock / job helper code to separate file

To allow the APIs to be used from separate files, move the domain
lock / job helper code into qemu_domain.c

* src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add domain lock
  / job code
* src/qemu/qemu_driver.c: Remove domain lock / job code

14 years agoMove QEMU driver lock helpers to a separate file
Daniel P. Berrange [Thu, 16 Dec 2010 16:11:48 +0000 (16:11 +0000)]
Move QEMU driver lock helpers to a separate file

To allow their use from other source files, move qemuDriverLock
and qemuDriverUnlock to qemu_conf.h and make them non-static

* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Add qemuDriverLock
  qemuDriverUnlock
* src/qemu/qemu_driver.c: Remove qemuDriverLock and qemuDriverUnlock

14 years agoMove QEMU hostdev helper code out of the QEMU driver
Daniel P. Berrange [Thu, 16 Dec 2010 16:10:54 +0000 (16:10 +0000)]
Move QEMU hostdev helper code out of the QEMU driver

The QEMU driver file is far too large. Move all the hostdev
helper code out into a separate file. No functional change.

* src/qemu/qemu_hostdev.c, src/qemu/qemu_hostdev.h,
  src/Makefile.am: Add hostdev helper file
* src/qemu/qemu_driver.c: Delete hostdev code

14 years agoMove QEMU cgroup helper code out of the QEMU driver
Daniel P. Berrange [Thu, 16 Dec 2010 16:10:54 +0000 (16:10 +0000)]
Move QEMU cgroup helper code out of the QEMU driver

The QEMU driver file is far too large. Move all the cgroup
helper code out into a separate file. No functional change.

* src/qemu/qemu_cgroup.c, src/qemu/qemu_cgroup.h,
  src/Makefile.am: Add cgroup helper file
* src/qemu/qemu_driver.c: Delete cgroup code

14 years agoMove QEMU audit helper code out of the QEMU driver
Daniel P. Berrange [Thu, 16 Dec 2010 16:10:54 +0000 (16:10 +0000)]
Move QEMU audit helper code out of the QEMU driver

The QEMU driver file is far too large. Move all the audit
helper code out into a separate file. No functional change.

* src/qemu/qemu_audit.c, src/qemu/qemu_audit.h,
  src/Makefile.am: Add audit helper file
* src/qemu/qemu_driver.c: Delete audit code

14 years agoMove QEMU private data & namespace code into separate file
Daniel P. Berrange [Thu, 16 Dec 2010 15:23:41 +0000 (15:23 +0000)]
Move QEMU private data & namespace code into separate file

Move the code for handling the QEMU virDomainObjPtr private
data, and custom XML namespace into a separate file

* src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: New file
  for private data & namespace code
* src/qemu/qemu_driver.c, src/qemu/qemu_driver.h: Remove
  private data & namespace code
* src/qemu/qemu_driver.h, src/qemu/qemu_command.h: Update
  includes
* src/Makefile.am: Add src/qemu/qemu_domain.c

14 years agoMove QEMU command line management into a separate file
Daniel P. Berrange [Thu, 16 Dec 2010 15:07:07 +0000 (15:07 +0000)]
Move QEMU command line management into a separate file

The qemu_conf.c code is doing three jobs, driver config file
loading, QEMU capabilities management and QEMU command line
management. Move the command line code into its own file

* src/qemu/qemu_command.c, src/qemu/qemu_command.h: New
  command line management code
* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Delete command
  line code
* src/qemu/qemu_conf.h, src/qemu_conf.c: Adapt for API renames
* src/Makefile.am: add src/qemu/qemu_command.c
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Add
  import of qemu_command.h

14 years agoMove QEMU capabilities management into a separate file
Daniel P. Berrange [Thu, 16 Dec 2010 15:07:07 +0000 (15:07 +0000)]
Move QEMU capabilities management into a separate file

The qemu_conf.c code is doing three jobs, driver config file
loading, QEMU capabilities management and QEMU command line
management. Move the capabilities code into its own file

* src/qemu/qemu_capabilities.c, src/qemu/qemu_capabilities.h: New
  capabilities management code
* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Delete capabilities
  code
* src/qemu/qemu_conf.h: Adapt for API renames
* src/Makefile.am: add src/qemu/qemu_capabilities.c

14 years agomaint: doc fix
Eric Blake [Thu, 16 Dec 2010 18:43:08 +0000 (11:43 -0700)]
maint: doc fix

* src/libvirt.c: Avoid duplicate word.

14 years agoAdd a new function doStartCPUs
Hu Tao [Tue, 14 Dec 2010 07:40:31 +0000 (15:40 +0800)]
Add a new function doStartCPUs

14 years agoAdd a new function doStopCPUs
Hu Tao [Tue, 14 Dec 2010 07:40:26 +0000 (15:40 +0800)]
Add a new function doStopCPUs

14 years agoAdd a macro timeval_to_ms to compute micro seconds from timeval
Hu Tao [Tue, 14 Dec 2010 07:40:12 +0000 (15:40 +0800)]
Add a macro timeval_to_ms to compute micro seconds from timeval

14 years agocpu: Unify CPUID data structures
Jiri Denemark [Wed, 30 Jun 2010 11:08:57 +0000 (13:08 +0200)]
cpu: Unify CPUID data structures

So far, CPUID data were stored in two different data structures. First
of them was a structure allowing direct access for CPUID data according
to function number and the second was a plain array of struct
cpuX86cpuid. This was a silly design which resulted in converting data
from one type to the other and back again or implementing similar
functionality for both data structures.

The patch leaves only the direct access structure. This makes the code
both smaller and more maintainable since operations on different objects
can use common low-level operations.

All 57 tests for cpu subsystem still pass after this rewrite.

14 years agoutil: Fix logical error in virReportSystemErrorFull
Jiri Denemark [Mon, 13 Dec 2010 10:32:40 +0000 (11:32 +0100)]
util: Fix logical error in virReportSystemErrorFull

14 years agoutil: Fix error message in __virExec
Jiri Denemark [Mon, 13 Dec 2010 10:36:52 +0000 (11:36 +0100)]
util: Fix error message in __virExec

Remove superfluous ": %s" suffix from the error message.

14 years agodaemon: Change CWD to / before daemonizing
Jiri Denemark [Mon, 13 Dec 2010 10:18:45 +0000 (11:18 +0100)]
daemon: Change CWD to / before daemonizing

We were doing so for child processes but not for libvirtd itself.

14 years agoesx: Add support for storage volume cloning
Matthias Bolte [Mon, 6 Dec 2010 20:07:35 +0000 (21:07 +0100)]
esx: Add support for storage volume cloning

14 years agoselinux: avoid memory overhead of matchpathcon
Eric Blake [Wed, 1 Dec 2010 01:22:54 +0000 (18:22 -0700)]
selinux: avoid memory overhead of matchpathcon

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

* src/security/security_selinux.c
(SELinuxRestoreSecurityFileLabel): Use selabel_lookup instead of
matchpathcon.
Suggested by Daniel Walsh.

14 years agodaemon, threads: plug a memory leak
Eric Blake [Sat, 11 Dec 2010 00:35:58 +0000 (17:35 -0700)]
daemon, threads: plug a memory leak

* daemon/libvirtd.c (qemudStartWorker, qemudStartEventLoop): Avoid
leaking pthread_attr resources.
* src/util/threads-pthread.c (virThreadCreate): Likewise.

14 years agotests: test Fedora 14 qemu-kvm -help parsing
Eric Blake [Wed, 8 Dec 2010 17:10:51 +0000 (10:10 -0700)]
tests: test Fedora 14 qemu-kvm -help parsing

* tests/qemuhelpdata/qemu-kvm-0.13.0: New file.
* tests/qemuhelptest.c (mymain): New test from Fedora 14 qemu-kvm,
which covers some options (like -fstype passthrough) not tested elsewhere.

14 years agotests: test RHEL 6.0 qemu-kvm -help parsing
Eric Blake [Wed, 8 Dec 2010 16:29:54 +0000 (09:29 -0700)]
tests: test RHEL 6.0 qemu-kvm -help parsing

* tests/qemuhelpdata/qemu-kvm-0.12.1.2-rhel60: New file.
* tests/qemuhelptest.c (mymain): New test from RHEL 6.0 qemu-kvm,
which covers some options (like -vga=qxl) not tested elsewhere.
* .x-sc_prohibit_empty_lines_at_EOF: Exempt qemu help output.

14 years agosysinfo: convert to virCommand
Eric Blake [Fri, 3 Dec 2010 21:32:12 +0000 (14:32 -0700)]
sysinfo: convert to virCommand

* src/util/sysinfo.c (virSysinfoRead): Use virCommand instead of
virExec.

14 years agosysinfo: formatting cleanups
Eric Blake [Tue, 7 Dec 2010 19:20:46 +0000 (12:20 -0700)]
sysinfo: formatting cleanups

* src/util/sysinfo.c: Indentation and () fixups.

14 years agobuild: allow mingw compilation with virCommand
Eric Blake [Fri, 10 Dec 2010 23:46:23 +0000 (16:46 -0700)]
build: allow mingw compilation with virCommand

Allows compilation, but no creation of child processes yet.  Take it
one step at a time.

* src/util/util.c (virExecWithHook) [WIN32]: New dummy function.
* src/libvirt_private.syms: Export it.

14 years agobuild: update gnulib for pipe on mingw
Eric Blake [Fri, 10 Dec 2010 22:49:52 +0000 (15:49 -0700)]
build: update gnulib for pipe on mingw

* .gnulib: Update to latest.
* bootstrap.conf (gnulib_modules): Import pipe-posix and waitpid
for mingw.
* src/remote/remote_driver.c (pipe) [WIN32]: Drop dead macro.
* daemon/event.c (pipe) [WIN32]: Drop dead function.

14 years agotest: fix commandtest under autobuild.sh
Eric Blake [Fri, 10 Dec 2010 22:30:56 +0000 (15:30 -0700)]
test: fix commandtest under autobuild.sh

* tests/commandtest.c (mymain): Kill off any leaked-in fds.
* autobuild.sh: Don't leak fds.

Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agobuild: quote AC_LANG_PROGRAM to avoid warnings with autoconf 2.68
Diego Elio Pettenò [Mon, 13 Dec 2010 13:44:47 +0000 (14:44 +0100)]
build: quote AC_LANG_PROGRAM to avoid warnings with autoconf 2.68

14 years agobuild: properly handle ./configure --with-libpcap
Diego Elio Pettenò [Mon, 13 Dec 2010 13:44:46 +0000 (14:44 +0100)]
build: properly handle ./configure --with-libpcap

Without this fix, ./configure --with-libpcap will cause --with-libpcap=yes
to be implicitly passed down, which cause yes/bin/pcap-config to be
searched for rather than /usr/bin/pcap-config.

Also output pcap: no when pcap is not found or disabled.

14 years agoqemu: Introduce two new job types
Osier Yang [Mon, 13 Dec 2010 08:30:30 +0000 (16:30 +0800)]
qemu: Introduce two new job types

Currently, all of domain "save/dump/managed save/migration"
use the same function "qemudDomainWaitForMigrationComplete"
to wait the job finished, but the error messages are all
about "migration", e.g. when a domain saving job is canceled
by user, "migration was cancled by client" will be throwed as
an error message, which will be confused for user.

As a solution, intoduce two new job types(QEMU_JOB_SAVE,
QEMU_JOB_DUMP), and set "priv->jobActive" to "QEMU_JOB_SAVE"
before saving, to "QEMU_JOB_DUMP" before dumping, so that we
could get the real job type in
"qemudDomainWaitForMigrationComplete", and give more clear
message further.

And as It's not important to figure out what's the exact job
is in the DEBUG and WARN log, also we don't need translated
string in logs, simply repace "migration" with "job" in some
statements.

* src/qemu/qemu_driver.c

14 years agoMissing "Default-Stop" field in LSB comment in libvirt-guests
Laurent Léonard [Sun, 5 Dec 2010 18:49:39 +0000 (19:49 +0100)]
Missing "Default-Stop" field in LSB comment in libvirt-guests

The "Default-Stop" field in LSB comment in libvirt-guests is missing and should
be added. I also suggests to add runlevel 2 to the "Default-Start" field.

--
Laurent Léonard

14 years agodaemon: plug a memory leak
Eric Blake [Sat, 11 Dec 2010 00:28:58 +0000 (17:28 -0700)]
daemon: plug a memory leak

* daemon/libvirtd.c (qemudFreeClient): Avoid a leak.
(qemudDispatchServer): Avoid null dereference.

14 years ago802.1Qbh: Add support for IFLA_VF_MAC
Roopa Prabhu [Mon, 13 Dec 2010 16:07:38 +0000 (11:07 -0500)]
802.1Qbh: Add support for IFLA_VF_MAC

Current code does not pass VM mac address to a 802.1Qbh direct attach
interface using IFLA_VF_MAC.  This patch adds support in macvtap code to
send IFLA_VF_MAC netlink request during port profile association on a
802.1Qbh interface.

Stefan Cc'ed for comments because this patch changes a condition for
802.1Qbg

802.1Qbh support for IFLA_VF_MAC in enic driver has been posted and is
pending acceptance at http://marc.info/?l=linux-netdev&m=129185244410557&w=2

14 years agocommand: ease use with virBuffer, and fix qemu leak
Eric Blake [Fri, 10 Dec 2010 18:33:53 +0000 (11:33 -0700)]
command: ease use with virBuffer, and fix qemu leak

* src/util/command.h (virCommandAddArgBuffer)
(virCommandAddEnvBuffer): New prototypes.
* src/util/command.c (virCommandAddArgBuffer)
(virCommandAddEnvBuffer): Implement them.
* src/libvirt_private.syms (command.h): Export them.
* src/qemu/qemu_conf.c (qemudBuildCommandLine): Use them, plugging
a memory leak on rbd_hosts in the process.

14 years agoconf: plug memory leaks
Eric Blake [Fri, 10 Dec 2010 17:57:42 +0000 (10:57 -0700)]
conf: plug memory leaks

* src/conf/domain_conf.c (virDomainGraphicsDefParseXML)
(virDomainDeviceVirtioSerialAddressParseXML)
(virDomainDiskDefFree): Free various leaks.

14 years agotests: plug memory leaks
Eric Blake [Fri, 10 Dec 2010 18:08:23 +0000 (11:08 -0700)]
tests: plug memory leaks

* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Don't
allocate, since we don't use virDomainChrDefFree.

14 years agovirExec: avoid undefined behavior
Eric Blake [Fri, 3 Dec 2010 22:02:01 +0000 (15:02 -0700)]
virExec: avoid undefined behavior

* src/util/util.c (__virExec): Don't use FD_ISSET on out-of-bounds fd.

14 years agoConvert dhcpStartDhcpDaemon from virRun to virCommand
Laine Stump [Fri, 10 Dec 2010 18:54:48 +0000 (13:54 -0500)]
Convert dhcpStartDhcpDaemon from virRun to virCommand

This is pretty straightforward - even though dnsmasq gets daemonized
and uses a pid file, those things are both handled by the dnsmasq
binary itself. And libvirt doesn't need any of the output of the
dnsmasq command either, so we just setup the args and call
virRun(). Mainly it was just a (mostly) mechanical job of replacing
the APPEND_ARG() macro (and some other *printfs()) with
virCommandAddArg*().

14 years agoesx: Refactor storage pool type lookup into a function
Matthias Bolte [Mon, 6 Dec 2010 19:40:59 +0000 (20:40 +0100)]
esx: Refactor storage pool type lookup into a function

14 years agoesx: Improve error reporting for failed tasks
Matthias Bolte [Mon, 6 Dec 2010 12:53:36 +0000 (13:53 +0100)]
esx: Improve error reporting for failed tasks

Instead of just reporting that a task failed get the
localized message from the TaskInfo error and include
it in the reported error message.

Implement minimal deserialization support for the
MethodFault type in order to obtain the actual fault
type.

For example, this changes the reported error message
when trying to create a volume with zero size from

  Could not create volume

to

  Could not create volume: InvalidArgument - A specified parameter was not correct.

Not perfect yet, but better than before.

14 years agocommand: plug memory leak
Eric Blake [Fri, 10 Dec 2010 15:56:30 +0000 (08:56 -0700)]
command: plug memory leak

* src/util/command.c (virCommandFree): Free data from
virCommandSetInputBuffer.

14 years agobuild: distribute commandtest files
Eric Blake [Fri, 10 Dec 2010 15:09:13 +0000 (08:09 -0700)]
build: distribute commandtest files

* tests/Makefile.am (SUBDIRS): Add commanddata.
* tests/commandtest.c (checkoutput): Delete correct file.
(test4): Delete pid file.
(mymain): Delete unused variable.
* tests/commanddata/Makefile.am: New file.
* configure.ac (AC_OUTPUT): Build new makefile.
Reported by Dominik Klein.

14 years agoUpdate documentation of watchdog dump option and add test data for it
Hu Tao [Fri, 10 Dec 2010 05:52:11 +0000 (13:52 +0800)]
Update documentation of watchdog dump option and add test data for it

The xml watchdog dump option is converted to qemu watchdog pause arg
but it is not reasonable to convert it back from qemu watchdog pause
arg since there already is a xml watchdog pause option, so a test for
the dump option to convert it from arg to xml is not added.

14 years agospec: do not start libvirt-guests if that service is off
Dan Kenigsberg [Tue, 7 Dec 2010 16:05:44 +0000 (18:05 +0200)]
spec: do not start libvirt-guests if that service is off

starting a service during rpm installation is impolite. It is even worse if done
during upgrade, for a service that was explicitly turned off.

14 years agotests: Add tests for network disks
Josh Durgin [Tue, 7 Dec 2010 19:57:33 +0000 (11:57 -0800)]
tests: Add tests for network disks

Signed-off-by: Josh Durgin <joshd@hq.newdream.net>
14 years agoqemu: Add RBD support and some network disk fixes
Josh Durgin [Tue, 7 Dec 2010 19:56:34 +0000 (11:56 -0800)]
qemu: Add RBD support and some network disk fixes

Changes common to all network disks:
-Make source name optional in the domain schema, since NBD doesn't use it
-Add a hostName type to the domain schema, and use it instead of genericName, which doesn't include .
-Don't leak host names or ports
-Set the source protocol in qemuParseCommandline

Signed-off-by: Josh Durgin <joshd@hq.newdream.net>
14 years agoadd network disk support
MORITA Kazutaka [Mon, 6 Dec 2010 07:24:09 +0000 (16:24 +0900)]
add network disk support

This patch adds network disk support to libvirt/QEMU.  The currently
supported protocols are nbd, rbd, and sheepdog.  The XML syntax is like
this:

    <disk type="network" device="disk">
      <driver name="qemu" type="raw" />
      <source protocol='rbd|sheepdog|nbd' name="...some image identifier...">
        <host name="mon1.example.org" port="6000">
        <host name="mon2.example.org" port="6000">
        <host name="mon3.example.org" port="6000">
      </source>
      <target dev="vda" bus="virtio" />
    </disk>

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
14 years agocorrect the signal's name
Wen Congyang [Thu, 9 Dec 2010 06:41:03 +0000 (14:41 +0800)]
correct the signal's name

The signal's name is wrong...

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>