]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
15 years agophyp: memcpy/memmove/memset can't fail, so don't check for error
Matthias Bolte [Fri, 6 Nov 2009 01:28:05 +0000 (02:28 +0100)]
phyp: memcpy/memmove/memset can't fail, so don't check for error

Also reset UUID to all 0 instead of all 48 (== '0') in phypUUIDTable_RemLpar()

15 years agophyp: Make generic domain listing functions return -1 in case of error
Matthias Bolte [Fri, 6 Nov 2009 01:15:19 +0000 (02:15 +0100)]
phyp: Make generic domain listing functions return -1 in case of error

phypNumDomainsGeneric() and phypListDomainsGeneric() return 0 in case
of an error. This makes it impossible to distinguish between an actual
error and no domains being defined on the hypervisor. It also turn the
no domains situation into an error. Return -1 in case of an error to
fix this problem.

15 years agophyp: Break potential infinite loops
Matthias Bolte [Fri, 6 Nov 2009 00:53:24 +0000 (01:53 +0100)]
phyp: Break potential infinite loops

15 years agophyp: Fix memory/session leaks and potential invalid frees
Matthias Bolte [Thu, 5 Nov 2009 23:19:16 +0000 (00:19 +0100)]
phyp: Fix memory/session leaks and potential invalid frees

15 years agoFix configure check for libssh2
Matthias Bolte [Thu, 5 Nov 2009 22:38:07 +0000 (23:38 +0100)]
Fix configure check for libssh2

* configure.in: add -L$libssh2_path to LIBS for the AC_TRY_LINK check

15 years ago524280 pass max lease option to dnsmasq
Daniel Veillard [Fri, 6 Nov 2009 16:53:45 +0000 (17:53 +0100)]
524280 pass max lease option to dnsmasq

* src/network/bridge_driver.c: when exec'ing dnsmaq, if there are
  DHCP ranges defined, then compute and pass the --dhcp-lease-max
  deriving the maximum number of leases

15 years agoStore the range size when adding a DHCP range
Daniel Veillard [Fri, 6 Nov 2009 16:50:54 +0000 (17:50 +0100)]
Store the range size when adding a DHCP range

* src/conf/network_conf.h: extend the structure to store the range
* src/conf/network_conf.c: before adding a range parse the IP addresses
  do some checking and keep the size

15 years agoRepair getIPv4Addr after the ntohl conversion
Daniel Veillard [Fri, 6 Nov 2009 16:47:45 +0000 (17:47 +0100)]
Repair getIPv4Addr after the ntohl conversion

* src/util/network.c: getIPv4Addr() got broken when the input
  network address value got converted from network to host byte order

15 years agoqemu: Allow cpu pinning for all logical CPUs, not just physical
Cole Robinson [Thu, 5 Nov 2009 15:21:33 +0000 (10:21 -0500)]
qemu: Allow cpu pinning for all logical CPUs, not just physical

This is what virsh already expects when printing output, and what
'man cpuset' claims to support.

15 years agoqemu: Use same create/define overwrite logic for migration prepare.
Cole Robinson [Mon, 2 Nov 2009 19:10:36 +0000 (14:10 -0500)]
qemu: Use same create/define overwrite logic for migration prepare.

15 years agoqemu: Break out function to check if we can create/define/restore
Cole Robinson [Mon, 2 Nov 2009 18:37:38 +0000 (13:37 -0500)]
qemu: Break out function to check if we can create/define/restore

Use this function in the qemu, uml, lxc, and test drivers.

15 years agoCleanup whitespace in docs
Matthew Booth [Fri, 6 Nov 2009 15:04:19 +0000 (16:04 +0100)]
Cleanup whitespace in docs

This patch is the result of running the following command in the docs
directory: sed -i 's/\t/        /g; s/\s*$//' *.html.in

* docs/*.html.in:convert tabs into 8 spaces and remove trailing whitespace

15 years agoUse virBuffer when building QEMU char dev command line
Matthew Booth [Fri, 6 Nov 2009 13:44:25 +0000 (14:44 +0100)]
Use virBuffer when building QEMU char dev command line

* src/qemu/qemu_conf.c: Update qemudBuildCommandLineChrDevStr to use a
  virBuffer

15 years agoCleanup virBuffer usage in qemdBuildCommandLine
Matthew Booth [Fri, 6 Nov 2009 11:19:21 +0000 (12:19 +0100)]
Cleanup virBuffer usage in qemdBuildCommandLine

* src/qemu_qemu_conf.c: Cleanup usage of virBuffer in qemudBuildCommandLine

15 years agoAdd sentinel attribute for NULL terminated arg lists
Paolo Bonzini [Fri, 6 Nov 2009 09:39:13 +0000 (10:39 +0100)]
Add sentinel attribute for NULL terminated arg lists

* src/internal.h (ATTRIBUTE_SENTINEL): New, it's a ggc feature and
  protected as such
* src/util/buf.c (virBufferStrcat): Use it.
* src/util/ebtables.c (ebtablesAddRemoveRule): Use it.
* src/util/iptables.c (iptableAddRemoveRule: Use it.
* src/util/qparams.h (new_qparam_set, append_qparams): Use it.
* docs/apibuild.py: avoid breaking the API generator with that new
  internal keyword macro

15 years agotest: Update inactive guest config on shutdown
Cole Robinson [Tue, 3 Nov 2009 21:42:02 +0000 (16:42 -0500)]
test: Update inactive guest config on shutdown

This matches the expected behavior of state drivers such as QEMU.

15 years agotest: Add testDomainShutdownState helper
Cole Robinson [Tue, 3 Nov 2009 17:06:00 +0000 (12:06 -0500)]
test: Add testDomainShutdownState helper

Performs changes needed when stopping a VM (which are currently duplicated
in several places, and forgotten in others).

15 years agoFix some cut-and-paste error in migration code
Paolo Bonzini [Thu, 5 Nov 2009 17:06:31 +0000 (18:06 +0100)]
Fix some cut-and-paste error in migration code

* src/qemu/qemu_driver.c: in qemudDomainMigratePerform call
  doPeer2PeerMigrate for VIR_MIGRATE_PEER2PEER.

15 years agoProperly convert port numbers to/from network byte order
Matthew Booth [Thu, 5 Nov 2009 16:56:08 +0000 (17:56 +0100)]
Properly convert port numbers to/from network byte order

* src/util/network.c: Add htons and ntohs in virSocket(Get|Set)Port

15 years agoPOWER add create() and destroy() support
Eduardo Otubo [Thu, 5 Nov 2009 16:18:07 +0000 (17:18 +0100)]
POWER add create() and destroy() support

* src/phyp/phyp_driver.[ch]: add new entry points and a number of
  cleanups

15 years agoEnsure guestfwd address is IPv4 and various cleanups
Matthew Booth [Thu, 5 Nov 2009 15:04:34 +0000 (16:04 +0100)]
Ensure guestfwd address is IPv4 and various cleanups

* include/libvirt/virterror.h src/util/virterror.c: add a new error
  VIR_ERR_CONFIG_UNSUPPORTED for valid but unsupported configuration options
* src/conf/domain_conf.c: Throw an error if guestfwd address isn't IPv4
  and cleanup a number of parsing return error values.

15 years agoForgot test case on previous commit
Daniel Veillard [Thu, 5 Nov 2009 14:45:53 +0000 (15:45 +0100)]
Forgot test case on previous commit

15 years agoSupport for <channel> in domain and QEmu backend
Matthew Booth [Thu, 5 Nov 2009 14:31:03 +0000 (15:31 +0100)]
Support for <channel> in domain and QEmu backend

allows the following to be specified in a domain:
<channel type='pipe'>
  <source path='/tmp/guestfwd'/>
  <target type='guestfwd' address='10.0.2.1' port='4600'/>
</channel>

* proxy/Makefile.am: add network.c as dep of domain_conf.c
* docs/schemas/domain.rng src/conf/domain_conf.[ch]: extend the domain
  schemas and the parsing/serialization side for the new construct

QEmu support will add the following on the qemu command line:
 -chardev pipe,id=channel0,path=/tmp/guestfwd
 -net user,guestfwd=tcp:10.0.2.1:4600-chardev:channel0

* src/qemu/qemu_conf.c: Add argument output for channel
* tests/qemuxml2(argv|xml)test.c: Add test for <channel> domain syntax

15 years agoDetect availability of QEMU -chardev CLI option
Matthew Booth [Thu, 5 Nov 2009 13:41:24 +0000 (14:41 +0100)]
Detect availability of QEMU -chardev CLI option

* src/qemu/qemu_conf.h: defines a new QEMUD_CMD_FLAG_CHARDEV flag
* src/qemu/qemu_conf.c: parse the output for -chardev and set flag
  appropriately

15 years agoAllow character devices to have different target types
Matthew Booth [Thu, 5 Nov 2009 13:19:14 +0000 (14:19 +0100)]
Allow character devices to have different target types

A character device's target (it's interface in the guest) had only a
single property: port. This patch is in preparation for adding targets
which require other properties.
Since this changes the conf type for character devices this affects
a number of drivers:

* src/conf/domain_conf.[ch] src/esx/esx_vmx.c src/qemu/qemu_conf.c
  src/qemu/qemu_driver.c src/uml/uml_conf.c src/uml/uml_driver.c
  src/vbox/vbox_tmpl.c src/xen/xend_internal.c src/xen/xm_internal.c:
  target properties are moved into a union in virDomainChrDef, and a
  targetType field is added to identify which union member should be
  used. All current code which touches a virDomainChrDef is updated both
  to use the new union field, and to populate targetType if necessary.

15 years agoLXC allow container to have ethN interfaces
Ryota Ozaki [Thu, 5 Nov 2009 13:11:30 +0000 (14:11 +0100)]
LXC allow container to have ethN interfaces

Current implementation of lxc driver creates vethN named
interface(s) in the host and passes as it is to a container.
The reason why it doesn't use ethN is due to the limitation
that one namespace cannot have multiple iterfaces that have
an identical name so that we give up creating ethN named
interface in the host for the container.

However, we should be able to allow the container to have
ethN by changing the name after clone(CLONE_NEWNET).

* src/lxc/lxc_container.c src/lxc/veth.c src/lxc/veth.h: do the clone
  and then renames interfaces eth0 ... ethN to keep the interface names
  familiar in the domain

15 years agoLXC cleanup deep indentation in lxcDomainSetAutostart
Ryota Ozaki [Thu, 5 Nov 2009 12:41:14 +0000 (13:41 +0100)]
LXC cleanup deep indentation in lxcDomainSetAutostart

* src/lxc/lxc_driver.c: refactor lxcDomainSetAutostart() to avoid deep
  indentation of the code

15 years agoLXC messages cleanup and fix lxcError
Ryota Ozaki [Thu, 5 Nov 2009 12:39:09 +0000 (13:39 +0100)]
LXC messages cleanup and fix lxcError

* src/lxc/lxc_container.c src/lxc/lxc_controller.c src/lxc/lxc_driver.c
  src/lxc/veth.c: most of cleanups are just capitalizing their messages
  though, some fixes wrong error messages and awkward indentations, and
  improves error messages.

15 years agoLXC fix wrong or out-of-date function descriptions
Ryota Ozaki [Thu, 5 Nov 2009 12:35:13 +0000 (13:35 +0100)]
LXC fix wrong or out-of-date function descriptions

* src/lxc/lxc_container.c src/lxc/lxc_controller.c src/lxc/lxc_driver.c
  src/lxc/veth.c: fix broken function comments

15 years agodocs: <clock> property is 'offset', not 'sync'
Cole Robinson [Wed, 4 Nov 2009 18:26:28 +0000 (13:26 -0500)]
docs: <clock> property is 'offset', not 'sync'

15 years agoadd MAC address based port filtering to qemu
Gerhard Stenzel [Tue, 3 Nov 2009 22:41:23 +0000 (23:41 +0100)]
add MAC address based port filtering to qemu

* src/qemu/qemu.conf src/qemu/qemu_conf.c src/qemu/qemu_conf.h: there is
  a new config type option for mac filtering
* src/qemu/qemu_bridge_filter.[ch]: new module for the ebtable entry points
* src/qemu/qemu_driver.c: plug the MAC filtering at the right places
  in the domain life cycle
* src/Makefile.am po/POTFILES.in: add the new module

15 years agoNew ebtables module wrapper
Gerhard Stenzel [Tue, 3 Nov 2009 22:11:01 +0000 (23:11 +0100)]
New ebtables module wrapper

* configure.in: look for ebtables binary location if present
* src/Makefile.am: add the new module
* src/util/ebtables.[ch]: new module and internal APIs around
  the ebtables binary
* src/libvirt_private.syms: export the symbols only internally

15 years agotest: Implement virDomainPinVcpu
Cole Robinson [Tue, 27 Oct 2009 22:25:38 +0000 (18:25 -0400)]
test: Implement virDomainPinVcpu

15 years agotest: Implement virDomainGetVcpus
Cole Robinson [Wed, 21 Oct 2009 19:04:14 +0000 (15:04 -0400)]
test: Implement virDomainGetVcpus

15 years agotest: Update vcpu runtime info in SetVcpus
Cole Robinson [Tue, 27 Oct 2009 22:02:14 +0000 (18:02 -0400)]
test: Update vcpu runtime info in SetVcpus

15 years agotest: Use privateData to track running VM vcpu state
Cole Robinson [Tue, 27 Oct 2009 18:06:30 +0000 (14:06 -0400)]
test: Use privateData to track running VM vcpu state

15 years agotest: Break out wrapper for setting up started domain state.
Cole Robinson [Tue, 27 Oct 2009 17:15:44 +0000 (13:15 -0400)]
test: Break out wrapper for setting up started domain state.

This should be a no op for now, but we will use this function to set up
transient state in the future.

15 years agotest: Fixes for SetVcpus
Cole Robinson [Tue, 27 Oct 2009 22:00:02 +0000 (18:00 -0400)]
test: Fixes for SetVcpus

- Implement DomainGetMaxVCPUs
- Use GetMaxVCPUs to validate requested CPU amount
- Deny the 'hotplug' for a running domain.

15 years agoqemu: Remove compiled out localhost migration support
Cole Robinson [Mon, 2 Nov 2009 18:49:44 +0000 (13:49 -0500)]
qemu: Remove compiled out localhost migration support

Pretty sure this would deadlock now that we have proper locking, so
remove the code.

15 years agostorage: conf: Fix memory leak in encryption parsing
Cole Robinson [Wed, 28 Oct 2009 18:22:45 +0000 (14:22 -0400)]
storage: conf: Fix memory leak in encryption parsing

15 years agoVarious error reporting fixes
Cole Robinson [Tue, 27 Oct 2009 16:20:22 +0000 (12:20 -0400)]
Various error reporting fixes

- Don't duplicate SystemError
- Use proper error code in domain_conf
- Fix a broken error call in qemu_conf
- Don't use VIR_ERR_ERROR in security driver (isn't a valid code in this case)

15 years agoImprove error reporting for virConnectGetHostname calls
Cole Robinson [Fri, 23 Oct 2009 17:01:22 +0000 (13:01 -0400)]
Improve error reporting for virConnectGetHostname calls

All drivers have copy + pasted inadequate error reporting which wraps
util.c:virGetHostname. Move all error reporting to this function, and improve
what we report.

Changes from v1:
  Drop the driver wrappers around virGetHostname. This means we still need
  to keep the new conn argument to virGetHostname, but I think it's worth
  it.

15 years agoFix improper error return in virInterfaceDefParseProtoIPvX
Laine Stump [Tue, 3 Nov 2009 20:01:32 +0000 (21:01 +0100)]
Fix improper error return in virInterfaceDefParseProtoIPvX

* src/conf/interface_conf.c: the code was erronously returning -1
  in the two functions if <dhcp> is not provided

15 years agoMake monitor type (miimon/arpmon) optional in bond xml
Laine Stump [Tue, 3 Nov 2009 19:15:38 +0000 (20:15 +0100)]
Make monitor type (miimon/arpmon) optional in bond xml

* src/conf/interface_conf.c: lack of one of these in the live xml output
  was causing the parse in virInterfaceDefParseBond() to fail

15 years agoFix virInterfaceIpDefPtr leak during virInterfaceIpDefFree
Laine Stump [Tue, 3 Nov 2009 19:02:52 +0000 (20:02 +0100)]
Fix virInterfaceIpDefPtr leak during virInterfaceIpDefFree

* src/conf/interface_conf.c: forgot to free the structure itself

15 years agoSupport for IPv6 / multiple addresses per interfaces
Laine Stump [Wed, 28 Oct 2009 13:13:18 +0000 (14:13 +0100)]
Support for IPv6 / multiple addresses per interfaces

This patch updates the xml parsing and formatting, and the associated
virInterfaceDef data structure to support IPv6, along the way adding
support for multiple protocols per interface, and multiple IP
addresses per protocol.
* src/conf/interface_conf.[ch]: update the structures, code for parsing
  and serialization

15 years agoSupport reporting live interface IP/netmask
Laine Stump [Wed, 28 Oct 2009 09:40:54 +0000 (10:40 +0100)]
Support reporting live interface IP/netmask

This patch adds the flag VIR_INTERFACE_XML_INACTIVE to
virInterfaceGetXMLDesc's flags. When it is*not* set (the default), the
live interface info will be returned in the XML (in particular, the IP
address(es) and netmask(s) will be retrieved by querying the interface
directly, rather than  reporting what's in the config file). The
backend of this is in netcf's ncf_if_xml_state() function.

* configure.in libvirt.spec.in: requires netcf >= 0.1.3
* include/libvirt/libvirt.h.in: adds flag VIR_INTERFACE_XML_INACTIVE
* src/conf/interface_conf.c src/interface/netcf_driver.c src/libvirt.c:
  update the parsing and backend routines accordingly
* tools/virsh.c: change interface edit to inactive definition and
  adds the inactive flag for interface dump

15 years agoMake startmode optional in toplevel interface definition
Laine Stump [Wed, 28 Oct 2009 08:55:33 +0000 (09:55 +0100)]
Make startmode optional in toplevel interface definition

The minimal XML returned from ncf_if_xml_state() doesn't contain this
attribute (which makes no sense in the case of reporting current
status of the interface), and it was preventing it from passing
through the parse/format step.

* src/conf/interface_conf.[ch]: add a new virInterfaceStartMode value
  and modify loading/saving accordingly

15 years agoMove libvirtd event loop into background thread
Daniel P. Berrange [Fri, 16 Oct 2009 15:34:37 +0000 (16:34 +0100)]
Move libvirtd event loop into background thread

The virStateInitialize() call for starting up stateful drivers
may require that the event loop is running already. This it is
neccessary to start the event loop before this call. At the
same time, network clients must not be processed until afte
virStateInitialize has completed.

The qemudListenUnix() and remoteListenTCP() methods must
therefore not register file handle watches, merely open the
network sockets & listen() on them. This means clients can
connected and are queued, pending completion of initialization

The qemudRunLoop() method is moved into a background thread
that is started early to allow access to the event loop during
driver initialization. The main process thread leader pretty
much does nothing once the daemon is running, merely waits
for the event loop thread to quit

* daemon/libvirtd.c, daemon/libvirtd.h: Move event loop into
  a background thread
* daemon/THREADING.txt: Rewrite docs to better reflect reality

15 years agogive up python interpreter lock before calling cb
Dan Kenigsberg [Tue, 3 Nov 2009 17:42:16 +0000 (18:42 +0100)]
give up python interpreter lock before calling cb

suggested by danpb on irc, patch by danken fixed for proper C syntax

* python/libvirt-override.c: on event callback release the python
  interpreter lock and take it again when coming back so that the
  callback can reinvoke libvirt.

15 years agoAllow NULL mac address in virGetInterface
Laine Stump [Tue, 3 Nov 2009 15:42:53 +0000 (16:42 +0100)]
Allow NULL mac address in virGetInterface

There are places where an interface will not have a mac address, and netcf
returns this as a NULL pointer rather than a pointer to an empty string.
Rather than checking for this all over the place in libvirt, just save it
in the virInterface object as an empty string.

* src/datatypes.c: allow NULL mac in virGetInterface()

15 years agoFix compilation problems
Daniel Veillard [Tue, 3 Nov 2009 15:24:46 +0000 (16:24 +0100)]
Fix compilation problems

introduced on commit 9231aa7d9563745c64e4f69afabca65d28bfae25
* src/qemu/qemu_driver.c: in qemudRemoveDomainStatus fix a reference
  to an undefined variable buf and free up an allocated string

15 years agoFix up NLS warnings.
Chris Lalancette [Tue, 3 Nov 2009 12:30:47 +0000 (13:30 +0100)]
Fix up NLS warnings.

When building with --disable-nls, I got a few messages like this:

storage/storage_backend.c: In function 'virStorageBackendCreateQemuImg':
storage/storage_backend.c:571: warning: format not a string literal and no format arguments

Fix these up.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoRemove redundant virFileDeletePID() call
Chris Lalancette [Sat, 22 Aug 2009 21:56:33 +0000 (23:56 +0200)]
Remove redundant virFileDeletePID() call

qemudShutdownVMDaemon() calls qemudRemoveDomainStatus(), which
then calls virFileDeletePID().  qemudShutdownVMDaemon() then
unnecessarily calls virFileDeletePID() again.  Remove this second
usage of it, and also slightly refactor qemudRemoveDomainStatus()
to VIR_WARN appropriate error messages.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix return value in virStateInitialize impl for LXC
Daniel P. Berrange [Mon, 2 Nov 2009 23:18:19 +0000 (18:18 -0500)]
Fix return value in virStateInitialize impl for LXC

The LXC driver was mistakenly returning -1 for lxcStartup()
in scenarios that are not an error. This caused the libvirtd
to quit for unprivileged users. This fixes the return code
of LXC driver, and also adds a "name" field to the virStateDriver
struct and logging to make it easier to find these problems
in the future

* src/driver.h: Add a 'name' field to state driver to allow
  easy identification during failures
* src/libvirt.c: Log name of failed driver for virStateInit
  failures
* src/lxc/lxc_driver.c: Don't return a failure code for
  lxcStartup() if LXC is not available on this host, simply
  disable the driver.
* src/network/bridge_driver.c, src/node_device/node_device_devkit.c,
  src/node_device/node_device_hal.c, src/opennebula/one_driver.c,
  src/qemu/qemu_driver.c, src/remote/remote_driver.c,
  src/secret/secret_driver.c, src/storage/storage_driver.c,
  src/uml/uml_driver.c, src/xen/xen_driver.c: Fill in name
  field in virStateDriver struct

15 years agoESX: Fix memory leak in list handling functions.
Matthias Bolte [Thu, 22 Oct 2009 07:47:51 +0000 (09:47 +0200)]
ESX: Fix memory leak in list handling functions.

If an error occurs between the allocation of an item and appending it
to the list, the item leaks. Free such orphaned items in error cases.

* src/esx/esx_vi.c: free orphaned items in error cases

15 years agoESX: Don't automatically follow redirects.
Matthias Bolte [Wed, 21 Oct 2009 18:25:22 +0000 (20:25 +0200)]
ESX: Don't automatically follow redirects.

The default transport for the VI API is HTTPS. If the server redirects
from HTTPS to HTTP the driver would silently follow that redirection.
The user assumes to communicate with the server over a secure transport
but isn't.

This patch disables automatical redirection following. The driver reports
an error if the server tries to redirect.

* src/esx/esx_vi.c: refactor the call to curl_easy_perform() into a
  function and do error handling there, disable automatical redirection
  following for curl
* src/esx/esx_vi.h: change the type of responseCode to int

15 years agoESX: Unify naming of VI API utility and convenience functions.
Matthias Bolte [Sun, 18 Oct 2009 19:31:46 +0000 (21:31 +0200)]
ESX: Unify naming of VI API utility and convenience functions.

Unified function naming scheme:
- 'lookup' functions query the ESX or vCenter for information
- 'get' functions return information from a local object

* src/esx/esx_driver.c, src/esx/esx_vi.[ch]: unify function naming

15 years agoESX: Change disk selection for datastore detection.
Matthias Bolte [Sun, 18 Oct 2009 19:21:46 +0000 (21:21 +0200)]
ESX: Change disk selection for datastore detection.

In order to register a new virtual machine the ESX driver needs to upload
a VMX file to a datastore. Try to put this file beside the main VMDK file
of the virtual machine. Change the disk selection for datastore detection
to choose the first file-based harddisk instead of just the first disk.
The first disk may be a CDROM disk and ISO images are normaly not located
in the virtual machine's directory.

* src/esx/esx_driver.c: change disk selection for datastore detection

15 years agoESX: Fallback to the preliminary name if the datastore cannot be found.
Matthias Bolte [Fri, 16 Oct 2009 23:42:05 +0000 (01:42 +0200)]
ESX: Fallback to the preliminary name if the datastore cannot be found.

This allows to use domain-xml-from-native with VMX files that reference
unavailable datastores.

* src/esx/esx_vmx.c: fallback to the preliminary name if the datastore
  cannot be found

15 years agoRename internal APis
Daniel P. Berrange [Tue, 20 Oct 2009 14:51:03 +0000 (15:51 +0100)]
Rename internal APis

Rename virDomainIsActive to virDomainObjIsActive, and
virInterfaceIsActive to virInterfaceObjIsActive and finally
virNetworkIsActive to virNetworkObjIsActive.

* src/conf/domain_conf.c, src/conf/domain_conf.h,
  src/conf/interface_conf.h, src/conf/network_conf.c,
  src/conf/network_conf.h, src/lxc/lxc_driver.c,
  src/network/bridge_driver.c, src/opennebula/one_driver.c,
  src/openvz/openvz_driver.c, src/qemu/qemu_driver.c,
  src/test/test_driver.c, src/uml/uml_driver.c: Update for
  renamed APIs.

15 years agoFix --with-init-script configure option
Matthew Booth [Mon, 2 Nov 2009 16:55:40 +0000 (17:55 +0100)]
Fix --with-init-script configure option

* configure.in daemon/Makefile.am: the --with-init-script configure
  option was broken, and always defaulted based on the existence of
  /etc/redhat-release. This was a systematic typo based on
  mixed use of init-script and init-scripts.

15 years agoDon't let parent of daemon exit until basic initialization is done
Daniel P. Berrange [Fri, 16 Oct 2009 11:14:54 +0000 (12:14 +0100)]
Don't let parent of daemon exit until basic initialization is done

The daemonizing code lets the parent exit almost immediately. This
means that it may think it has successfully started even when
important failures occur like not being able to acquire the PID
file. It also means network sockets are not yet open.

To address this when daemonizing the parent passes an open pipe
file descriptor to the child. The child does its basic initialization
and then writes a status code to the pipe indicating either success,
or failure. This ensures that when daemonizing, the parent does not
exit until the pidfile is acquired & basic network sockets are open.

Initialization of the libvirt drivers is still done asynchronously
since this may take a very long time.

* daemon/libvirtd.c: Force parent to stay around until basic config
  file, pidfile & network socket init is completed

15 years agoPull signal setup code out into separate method
Daniel P. Berrange [Fri, 16 Oct 2009 10:48:50 +0000 (11:48 +0100)]
Pull signal setup code out into separate method

* daemon/libvirtd.c: Introduce a daemonSetupSignals() method
  and put all signal handling code there
* daemon/libvirtd.h: Add sigread/sigwrite to qemud_server type

15 years agoSet KMEMSIZE for OpenVZ domains being defined
Yuji NISHIDA [Mon, 2 Nov 2009 16:39:46 +0000 (17:39 +0100)]
Set KMEMSIZE for OpenVZ domains being defined

* src/openvz/openvz_driver.c: add a new openvzDomainSetMemoryInternal()
  function, used to initialize the KMEMSIZE parameter of a container.

15 years agoFix duplicating logging of errors in libvirtd
Daniel P. Berrange [Mon, 19 Oct 2009 17:28:28 +0000 (18:28 +0100)]
Fix duplicating logging of errors in libvirtd

The libvirt default error handling callback will print all errors
to stderr. The libvirtd default logging callback will do the same.
Set a no-op error handling callback in libvirtd to prevent this
duplication

* daemon/libvirtd.c: Register a no-op error handling function

15 years agoFix initialization order bugs
Daniel P. Berrange [Fri, 16 Oct 2009 10:29:01 +0000 (11:29 +0100)]
Fix initialization order bugs

virInitialize must be the first libvirt function called to ensure
threads, error handling & random number generator are all setup.

Move UNIX socket directory permissions change to place of use

15 years agoMisc cleanup to network socket init
Daniel P. Berrange [Fri, 16 Oct 2009 10:24:01 +0000 (11:24 +0100)]
Misc cleanup to network socket init

* daemon/libvirtd.c: Change qemudNetworkInit() so that it doesn't try
to free its argument, leaving the caller todo cleanup as is normal
practice. Add missing policykit cleanup to qemudCleanup, and remove
server watch if set. Remove duplicated call to listen() on TCP sockets

15 years agoAnnotate many methods with ATTRIBUTE_RETURN_CHECK & fix problems
Daniel P. Berrange [Fri, 16 Oct 2009 10:09:13 +0000 (11:09 +0100)]
Annotate many methods with ATTRIBUTE_RETURN_CHECK & fix problems

Nearly all of the methods in src/util/util.h have error codes that
must be checked by the caller to correct detect & report failure.
Add ATTRIBUTE_RETURN_CHECK to ensure compile time validation of
this

* daemon/libvirtd.c: Add explicit check on return value of virAsprintf
* src/conf/domain_conf.c: Add missing check on virParseMacAddr return
  value status & report error
* src/network/bridge_driver.c: Add missing OOM check on virAsprintf
  and report error
* src/qemu/qemu_conf.c: Add missing check on virParseMacAddr return
  value status & report error
* src/security/security_selinux.c: Remove call to virRandomInitialize
  that's done in libvirt.c already
* src/storage/storage_backend_logical.c: Add check & log on virRun
  return status
* src/util/util.c: Add missing checks on virAsprintf/Run status
* src/util/util.h: Annotate all methods with ATTRIBUTE_RETURN_CHECK
  if they return an error status code
* src/vbox/vbox_tmpl.c: Add missing check on virParseMacAddr
* src/xen/xm_internal.c: Add missing checks on virAsprintf
* tests/qemuargv2xmltest.c: Remove bogus call to virRandomInitialize()

15 years agoAllow for a driver specific private data blob in virDomainObjPtr
Daniel P. Berrange [Tue, 6 Oct 2009 11:50:58 +0000 (12:50 +0100)]
Allow for a driver specific private data blob in virDomainObjPtr

The virDomainObjPtr object stores state about a running domain.
This object is shared across all drivers so it is not appropriate
to include driver specific state here. This patch adds the ability
to request a blob of private data per domain object instance. The
driver must provide a allocator & deallocator for this purpose

THis patch abuses the virCapabilitiesPtr structure for storing the
allocator/deallocator callbacks, since it is already being abused
for other internal things relating to parsing. This should be moved
out into a separate object at some point.

* src/conf/capabilities.h: Add privateDataAllocFunc and
  privateDataFreeFunc fields
* src/conf/domain_conf.c: Invoke the driver allocators / deallocators
  when creating/freeing virDomainObjPtr instances.
* src/conf/domain_conf.h: Pass virCapsPtr into virDomainAssignDef
  to allow access to the driver specific allocator function
* src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
  src/openvz/openvz_driver.c, src/qemu/qemu_driver.c,
  src/test/test_driver.c, src/uml/uml_driver.c: Update for
  change in virDomainAssignDef contract

15 years agoDon't use private struct member names of in6_addr
Matthias Bolte [Mon, 2 Nov 2009 14:45:05 +0000 (15:45 +0100)]
Don't use private struct member names of in6_addr

__in6_u.__u6_addr16 is the private name for this struct member,
s6_addr16 is the public one
* src/util/network.c: dont use the private field, but the public one.

15 years agoMore network utility functions
Matthew Booth [Mon, 2 Nov 2009 14:42:47 +0000 (15:42 +0100)]
More network utility functions

* src/util/network.[ch] Add functions for address->text and get/set
  port number
* src/libvirt_private.syms: add new entry points

15 years agoFix typo in network.c function comments
Matthew Booth [Fri, 30 Oct 2009 15:39:57 +0000 (16:39 +0100)]
Fix typo in network.c function comments

* src/util/network.c: fix a few typo

15 years agoAdd symbols from new network.h module
Daniel Veillard [Fri, 30 Oct 2009 15:36:04 +0000 (16:36 +0100)]
Add symbols from new network.h module

* src/libvirt_private.syms: keep all symbols from network.h private

15 years agoSet of new network related utilities
Daniel Veillard [Thu, 22 Oct 2009 14:34:43 +0000 (16:34 +0200)]
Set of new network related utilities

* src/util/network.h src/util/network.c: utilities to parse network
  addresses, check netmask and compute ranges

15 years agoFix configure detection of device mapper
Pritesh Kothari [Fri, 30 Oct 2009 13:44:50 +0000 (14:44 +0100)]
Fix configure detection of device mapper

* configure.in: the PKG_CHECK_MODULES() for it would not work on
  Ubuntu and SuSE, so add a direct check fallback

15 years agoRemote code caught EINTR making it ininterruptable
Daniel Veillard [Fri, 30 Oct 2009 11:08:26 +0000 (12:08 +0100)]
Remote code caught EINTR making it ininterruptable

John Levon raised the issue that remoteIOEventLoop() poll call was
reissued after EINTR was caught making it uninterruptible.
* src/remote/remote_driver.c: catch EAGAIN instead as suggested by
  Richard Jones

15 years agoConvert virDomainObjListPtr to use a hash of domain objects
Daniel P. Berrange [Fri, 9 Oct 2009 11:33:51 +0000 (12:33 +0100)]
Convert virDomainObjListPtr to use a hash of domain objects

The current virDomainObjListPtr object stores domain objects in
an array. This means that to find a particular objects requires
O(n) time, and more critically acquiring O(n) mutex locks.

The new impl replaces the array with a virHashTable, keyed off
UUID. Finding a object based on UUID is now O(1) time, and only
requires a single mutex lock. Finding by name/id is unchanged
in complexity.

In changing this, all code which iterates over the array had
to be updated to use a hash table iterator function callback.
Several of the functions which were identically duplicating
across all drivers were pulled into domain_conf.c

* src/conf/domain_conf.h, src/conf/domain_conf.c: Change
  virDomainObjListPtr to use virHashTable. Add a initializer
  method virDomainObjListInit, and rename virDomainObjListFree
  to virDomainObjListDeinit, since its not actually freeing
  the container, only its contents. Also add some convenient
  methods virDomainObjListGetInactiveNames,
  virDomainObjListGetActiveIDs and virDomainObjListNumOfDomains
  which can be used to implement the correspondingly named
  public API entry points in drivers
* src/libvirt_private.syms: Export new methods from domain_conf.h
* src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
  src/openvz/openvz_conf.c, src/openvz/openvz_driver.c,
  src/qemu/qemu_driver.c, src/test/test_driver.c,
  src/uml/uml_driver.c, src/vbox/vbox_tmpl.c: Update all code
  to deal with hash tables instead of arrays for domains

15 years agolibvirt-devel should only require libvirt-client
Mark McLoughlin [Wed, 28 Oct 2009 17:23:34 +0000 (17:23 +0000)]
libvirt-devel should only require libvirt-client

There's a long known issue where if you install libvirt in a guest,
the default virtual network will conflict with the default virtual
network in the host.

That's one of the reasons we have the libvirt-client RPM - it allows
you to install the client library without having the host side
installed.

Rich Jones points out that if you install libvirt-devel in a guest,
then you get libvirtd installed and the network conflict:

  https://bugzilla.redhat.com/531200

libvirt-devel should only require libvirt-client - e.g. nothing in
the devel package pertains to anything in the libvirt RPM. The Fedora
packaging guidelines say:

  https://fedoraproject.org/wiki/Packaging/Guidelines#Devel_Packages

  Devel packages must require the base package using a fully versioned
  dependency ...

But for all intents and purposes, libvirt-client is our base RPM.

* libvirt.spec.in: make libvirt-devel require libvirt-client

15 years agovirterror: Add a missing 'break' for VIR_ERR_INVALID_SECRET
Cole Robinson [Tue, 27 Oct 2009 14:01:06 +0000 (10:01 -0400)]
virterror: Add a missing 'break' for VIR_ERR_INVALID_SECRET

15 years agoqemu: migrate: Don't require manual URI to specify a port
Cole Robinson [Mon, 26 Oct 2009 20:08:23 +0000 (16:08 -0400)]
qemu: migrate: Don't require manual URI to specify a port

The xen driver will generate a migration port if only a hostname is passed
in the optional migrate URI, so let's do the same in qemu.

15 years agoFix p2p migration without a passed uri.
Cole Robinson [Thu, 22 Oct 2009 18:51:30 +0000 (14:51 -0400)]
Fix p2p migration without a passed uri.

15 years agoqemu: Fix an error message in GetVcpus
Cole Robinson [Wed, 21 Oct 2009 19:03:58 +0000 (15:03 -0400)]
qemu: Fix an error message in GetVcpus

15 years agotest: Support virStorageFindPoolSources
Cole Robinson [Fri, 16 Oct 2009 08:35:05 +0000 (04:35 -0400)]
test: Support virStorageFindPoolSources

The results are hardcoded into the test driver, no option to read from a
testfile is implemented at this time.

15 years agostorage: Add ParseSourceString function for use with FindPoolSources.
Cole Robinson [Thu, 15 Oct 2009 15:58:35 +0000 (11:58 -0400)]
storage: Add ParseSourceString function for use with FindPoolSources.

This will simplify adding FindPoolSources support to more pool backends in
the future (as well as the test driver).

15 years agostorage: Break out function to add pool source to a SourceList.
Cole Robinson [Thu, 15 Oct 2009 15:41:53 +0000 (11:41 -0400)]
storage: Break out function to add pool source to a SourceList.

Similar in theory to *AssignDef type functions, this duplicate functionality
will be used by an future FindPoolSources implementations.

15 years agostorage: Break out pool source parsing to a separate function.
Cole Robinson [Thu, 15 Oct 2009 14:55:19 +0000 (10:55 -0400)]
storage: Break out pool source parsing to a separate function.

We need to parse a source XML block for FindPoolSources, so this is a step
in sharing the parsing. The new storage pool XML 2 XML tests cover this area
pretty well to ensure we aren't causing regressions.

15 years agoUpdate the documentation for virDomainMigrateToURI
Chris Lalancette [Fri, 23 Oct 2009 07:38:32 +0000 (09:38 +0200)]
Update the documentation for virDomainMigrateToURI

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoAdd support for an external TFTP boot server
Paolo Bonzini [Wed, 28 Oct 2009 14:57:49 +0000 (15:57 +0100)]
Add support for an external TFTP boot server

This patch adds an optional attribute to the <bootp> tag, that
allows to specify a TFTP server address other than the address of
the DHCP server itself.

This can be used to forward the BOOTP settings of the host down to the
guest.  This is something that configurations such as Xen's default
network achieve naturally, but must be done manually for NAT.

* docs/formatnetwork.html.in: Document new attribute.
* docs/schemas/network.rng: Add it to schema.
* src/conf/network_conf.h: Add it to struct.
* src/conf/network_conf.c: Add it to parser and pretty printer.
* src/network/bridge_driver.c: Put it in the dnsmasq command line.
* tests/networkxml2xmlin/netboot-proxy-network.xml
  tests/networkxml2xmlout/netboot-proxy-network.xml
  tests/networkxml2xmltest.c: add new tests

15 years agotest: Support virNodeDeviceCreate and virNodeDeviceDestroy
Cole Robinson [Wed, 14 Oct 2009 20:16:10 +0000 (16:16 -0400)]
test: Support virNodeDeviceCreate and virNodeDeviceDestroy

15 years agoFix some typos in comments
Dan Kenigsberg [Mon, 26 Oct 2009 23:02:46 +0000 (00:02 +0100)]
Fix some typos in comments

15 years agoFix problems in the Xen inotify driver.
Matthias Bolte [Sat, 24 Oct 2009 17:20:33 +0000 (19:20 +0200)]
Fix problems in the Xen inotify driver.

In xenInotifyXendDomainsDirLookup() the wrong UUID variable is used
to search in the config info list.

In xenInotifyEvent() the event is dispatched if it's NULL.

Both were introduced in bc898df2c74fe3c8efedfbbd430737bac950e65e.

15 years agoFix error message in qemudLoadDriverConfig()
Matthias Bolte [Thu, 22 Oct 2009 15:41:57 +0000 (17:41 +0200)]
Fix error message in qemudLoadDriverConfig()

* src/qemu/qemu_conf.c: change the error message to refer to
  'cgroup_controllers' instead of 'cgroup_device_acl'

15 years agoAdd a new syntax-check rule for gethostname.
Chris Lalancette [Fri, 23 Oct 2009 10:13:20 +0000 (12:13 +0200)]
Add a new syntax-check rule for gethostname.

We should always be using virGetHostname in place of
gethostname; thus add in a new syntax-check rule to make
sure no new uses creep in.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoVarious syntax-check fixes.
Chris Lalancette [Fri, 23 Oct 2009 10:10:38 +0000 (12:10 +0200)]
Various syntax-check fixes.

Make a pass over the syntax-check files, tightening up regex's,
un-ignoring certain files, and cleaning things up.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoTighten up nonreentrant syntax-check.
Chris Lalancette [Fri, 23 Oct 2009 10:07:17 +0000 (12:07 +0200)]
Tighten up nonreentrant syntax-check.

We can slightly tighten up the regex's used to detect the use of
nonreentrant functions.  We can also check src/util/virterror.c
by modifying a comment; I think it's worth it to get the additional
coverage.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoReplace a gethostname by virGetHostname in libvirtd.c
Chris Lalancette [Fri, 23 Oct 2009 10:05:01 +0000 (12:05 +0200)]
Replace a gethostname by virGetHostname in libvirtd.c

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoReplace two strcmp() by STREQ() in qemu_driver.c
Chris Lalancette [Fri, 23 Oct 2009 10:04:10 +0000 (12:04 +0200)]
Replace two strcmp() by STREQ() in qemu_driver.c

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoReplace gethostname by virGetHostname in xend_internal.c
Chris Lalancette [Fri, 23 Oct 2009 10:02:46 +0000 (12:02 +0200)]
Replace gethostname by virGetHostname in xend_internal.c

15 years agoRemove a completely bogus reference increment in the Xen driver.
Chris Lalancette [Fri, 23 Oct 2009 06:57:03 +0000 (08:57 +0200)]
Remove a completely bogus reference increment in the Xen driver.

xenUnifiedDomainEventRegister() calls out to
virDomainEventCallbackListAdd(), which increments the reference
count on the connection.  That is fine, but then
xenUnifiedDomainEventRegister() increments the usage count again,
leading to a usage count leak.  Remove the increment in the xen
register, and the UnrefConnect in the xen unregister.

Signed-off-by: Chris Lalancette <clalance@redhat.com>