]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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>
15 years agoAdd a default log_level to qemudSetLogging to remove a build warning.
Chris Lalancette [Fri, 23 Oct 2009 06:56:21 +0000 (08:56 +0200)]
Add a default log_level to qemudSetLogging to remove a build warning.

(original patch from Charles Duffy)

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoBetter error message when libvirtd fails to start.
Chris Lalancette [Wed, 23 Sep 2009 10:38:21 +0000 (12:38 +0200)]
Better error message when libvirtd fails to start.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix potential false-positive OOM error reporting.
Matthias Bolte [Wed, 21 Oct 2009 20:27:09 +0000 (22:27 +0200)]
Fix potential false-positive OOM error reporting.

If no matching device was found (cap == NULL) then no strdup() call
was made and *wwnn and *wwpn are untouched. Checking them for NULL
in this situation may result in reporting an false-positive OOM error
because *wwnn and *wwpn may be initialized to NULL by the caller.

Only check *wwnn and *wwpn for NULL if a matching device was found
(cap != NULL) and thus strdup() was called.

* src/conf/node_device_conf.c: only report an OOM error if there
  really is one

15 years agoConsolidate virXPathNodeSet()
Daniel Veillard [Thu, 22 Oct 2009 08:32:15 +0000 (10:32 +0200)]
Consolidate virXPathNodeSet()

virXPathNodeSet() could return -1 when doing an evaluation failure
due to xmlXPathEval() from libxml2 behaviour.
* src/util/xml.c: make sure we always return 0 unless the returned
  XPath type is of the wrong type (meaning the query passed didn't
  evaluate to a node set and code must be fixed)

15 years agoSupport QEMU watchdog device.
Richard Jones [Wed, 21 Oct 2009 12:26:38 +0000 (13:26 +0100)]
Support QEMU watchdog device.

This adds simple support for configuring a guest with a QEMU/KVM
virtual hardware watchdog device.

15 years agoDo not log rotate very small logs
Dan Kenigsberg [Wed, 21 Oct 2009 11:56:04 +0000 (13:56 +0200)]
Do not log rotate very small logs

Without this, after few weeks without use, each defined domain grows a
tail of empty gzipped logs, instead of keeping just the last log of
interest.

* daemon/libvirtd.logrotate.in: only rotate when the log is over 100 KBytes

15 years ago528575 avoid libvirtd crash on LCX domain autostart
Daniel Veillard [Wed, 21 Oct 2009 11:32:20 +0000 (13:32 +0200)]
528575 avoid libvirtd crash on LCX domain autostart

https://bugzilla.redhat.com/show_bug.cgi?id=528575
virsh -c lxc:/// autostart vm1
was crashing the daemon

* src/lxc/lxc_conf.h src/lxc/lxc_conf.c: initialize the driver
  autostartDir to avoid a NULL reference and implement autostart for LXC

15 years agoFix virsh.c compilation warning
Jim Fehlig [Wed, 21 Oct 2009 10:59:43 +0000 (12:59 +0200)]
Fix virsh.c compilation warning

* tools/virsh.c: call to vshError() containing 'doexit' parameter
  sneaked in after said parameter was removed

15 years agoFix SELinux linking issues
Jim Fehlig [Wed, 21 Oct 2009 10:11:13 +0000 (12:11 +0200)]
Fix SELinux linking issues

* src/Makefile.am: add selinux CFLAGS and linker flags to security driver

15 years agoLXC implement missing macaddr assignment feature
Ryota Ozaki [Wed, 21 Oct 2009 10:04:02 +0000 (12:04 +0200)]
LXC implement missing macaddr assignment feature

Currently MAC address configuration of container veth is just ignored.
This patch implements the missing feature.

* src/lxc/veth.c, src/lxc/veth.h: add setMacAddr
* src/lxc/lxc_driver.c: set macaddr of container veth if specified

15 years agoFix a make dist error due to wrong EXTRA_DIST paths
Daniel Veillard [Wed, 21 Oct 2009 09:16:21 +0000 (11:16 +0200)]
Fix a make dist error due to wrong EXTRA_DIST paths

* tests/Makefile.am: networkpoolxml2xmlout and networkpoolxml2xmlin are
  really networkxml2xmlout and networkxml2xmlin

15 years agonode device: Break out get_wwns and get_parent_node helpers
Cole Robinson [Wed, 14 Oct 2009 19:47:10 +0000 (15:47 -0400)]
node device: Break out get_wwns and get_parent_node helpers

These will be used by the test driver, so move them to a shareable space.

15 years agonode device: Fix locking issue in virNodeDeviceDestroy
Cole Robinson [Wed, 14 Oct 2009 20:15:13 +0000 (16:15 -0400)]
node device: Fix locking issue in virNodeDeviceDestroy

Certain error paths won't unlock the node device object.

15 years agotests: Centralize VIR_TEST_DEBUG lookup, and document it
Cole Robinson [Fri, 16 Oct 2009 15:37:36 +0000 (11:37 -0400)]
tests: Centralize VIR_TEST_DEBUG lookup, and document it

Provide a simple interface for other tests to lookup the testDebug variable.
Also remove a redundant error message in interface tests.

If anyone feels inclined to change this env variable to match the existing
LIBVIRT_* format, it should now be easier to do so.

15 years agotests: Initialize virRandom in for test suite.
Cole Robinson [Thu, 8 Oct 2009 22:03:55 +0000 (18:03 -0400)]
tests: Initialize virRandom in for test suite.

Otherwise any virRandom calls will result in a segfault.

15 years agoRemove bogus const annotations to hash iterator
Daniel P. Berrange [Wed, 14 Oct 2009 10:17:24 +0000 (11:17 +0100)]
Remove bogus const annotations to hash iterator

Most of the hash iterators need to modify either payload of
data args. The const annotation prevents this.

* src/util/hash.h, src/util/hash.c: Remove const-ness from
  virHashForEach/Iterator
* src/xen/xm_internal.c: Remove bogus casts

15 years agofix virDomainMigrateToURI doc
Dan Kenigsberg [Mon, 19 Oct 2009 12:53:29 +0000 (14:53 +0200)]
fix virDomainMigrateToURI doc

* src/libvirt.c: remove reverences to non existent dconn parameter
  when using that entry point.

15 years agoLXC fix virCgroupGetValueStr problem with \n
Ryota Ozaki [Mon, 19 Oct 2009 12:29:42 +0000 (14:29 +0200)]
LXC fix virCgroupGetValueStr problem with \n

A cgroup file returns integer value terminated with '\n' and remaining
it has sometimes harmful effects, for example it leads virStrToLong_ull
to fail.
* src/util/cgroup.c: strip out terminating \n when reading a value

15 years agoRemove bashisms from schema tests.
Matthias Bolte [Fri, 16 Oct 2009 23:16:25 +0000 (01:16 +0200)]
Remove bashisms from schema tests.

Introduced in commit 39a7be470cc5477a96a4d53194291bf4c7b07185.

* tests/*schematest: replace 'source' with '.'
* tests/schematestutils.sh: remove 'function' keyword and add '()'

15 years agotests: Add storage volume XML 2 XML tests.
Cole Robinson [Fri, 9 Oct 2009 18:17:21 +0000 (14:17 -0400)]
tests: Add storage volume XML 2 XML tests.

15 years agotests: Add network XML to XML tests.
Cole Robinson [Fri, 9 Oct 2009 12:47:43 +0000 (08:47 -0400)]
tests: Add network XML to XML tests.

15 years agoschema: Update network schema.
Cole Robinson [Fri, 9 Oct 2009 12:48:22 +0000 (08:48 -0400)]
schema: Update network schema.

Make things a bit more readable, and properly handle forward mode 'route'.

15 years agotests: Add XML 2 XML tests for storage pools.
Cole Robinson [Thu, 8 Oct 2009 21:26:30 +0000 (17:26 -0400)]
tests: Add XML 2 XML tests for storage pools.

Move existing schema data to an input directory. Add extra files for more
thorough XML testing.

15 years agotests: Break out duplicate schema verification functionality.
Cole Robinson [Thu, 8 Oct 2009 22:06:59 +0000 (18:06 -0400)]
tests: Break out duplicate schema verification functionality.

All schema tests have identical functionality, so avoid the duplication.

15 years agotests: Fix text output for interface XML 2 XML
Cole Robinson [Thu, 8 Oct 2009 21:23:54 +0000 (17:23 -0400)]
tests: Fix text output for interface XML 2 XML

15 years agoDon't copy old machines from a domain which has none
Mark McLoughlin [Thu, 15 Oct 2009 11:09:17 +0000 (12:09 +0100)]
Don't copy old machines from a domain which has none

If the the qemu and kvm binaries are the same, we don't include machine
types in the kvm domain info.

However, the code which refreshes the machine types info from the
previous capabilities structure first looks at the kvm domain's info,
finds it matches and then copies the empty machine types list over
for the top-level qemu domain.

That doesn't make sense, we shouldn't copy an empty machin types list.

* src/qemu/qemu_conf.c: qemudGetOldMachinesFromInfo(): don't copy an
  empty machine types list.

15 years agoAvoid crash in virBufferEscapeString
Laine Stump [Thu, 15 Oct 2009 12:19:11 +0000 (14:19 +0200)]
Avoid crash in virBufferEscapeString

* src/util/buf.c: if virBufferEscapeString was called on a buffer that
  had 0 bytes of space, a size of -1 will be passed to snprintf, resulting
  in a segmentation fault, this preallocate some space.

15 years agoAdd ocfs2 to list of fs pool types
Jim Fehlig [Wed, 14 Oct 2009 15:03:22 +0000 (17:03 +0200)]
Add ocfs2 to list of fs pool types

* src/conf/storage_conf.c src/conf/storage_conf.h: extend the enums
  and values
* docs/schemas/storagepool.rng: add to the list of storage pool type
  formats

15 years agoLXC complement PATH environment variable
Ryota Ozaki [Wed, 14 Oct 2009 14:54:29 +0000 (16:54 +0200)]
LXC complement PATH environment variable

* src/lxc/lxc_driver.c: without PATH, the controller will definitely
  fail to call ip command

15 years agoFiner grained migration control
Chris Lalancette [Fri, 31 Jul 2009 10:10:22 +0000 (12:10 +0200)]
Finer grained migration control

Normally, when you migrate a domain from host A to host B,
the domain on host A remains defined but shutoff and the domain
on host B remains running but is a "transient".  Add a new
flag to virDomainMigrate() to allow the original domain to be
undefined on source host A, and a new flag to virDomainMigrate() to
allow the new domain to be persisted on the destination host B.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoRelease of 0.7.2
Daniel Veillard [Wed, 14 Oct 2009 09:16:13 +0000 (11:16 +0200)]
Release of 0.7.2

15 years agoFixing ca.po
Daniel Veillard [Wed, 14 Oct 2009 08:32:53 +0000 (10:32 +0200)]
Fixing ca.po

15 years agoUpdated and regenerated localizations
Daniel Veillard [Wed, 14 Oct 2009 08:30:25 +0000 (10:30 +0200)]
Updated and regenerated localizations

* de.po ja.po it.po hi.po gu.po or.po mr.po ml.po kn.po ru.po pl.po
  pa.po te.po ta.po: many updates

15 years agonetwork: Fix printing XML 'delay' attribute
Cole Robinson [Tue, 13 Oct 2009 15:31:27 +0000 (11:31 -0400)]
network: Fix printing XML 'delay' attribute

When specifying bridge delay via network XML define, we were looking for
the 'delay' attribute, but would dump the value as 'forwardDelay'. Have
the output match the expected input (and schema).

15 years agoFix virFileReadLimFD/virFileReadAll to handle EINTR
Daniel P. Berrange [Mon, 12 Oct 2009 19:32:33 +0000 (20:32 +0100)]
Fix virFileReadLimFD/virFileReadAll to handle EINTR

The fread_file_lim() function uses fread() but never handles
EINTR results, causing unexpected failures when reading QEMU
help arg info. It was unneccessarily using FILE * instead
of plain UNIX file handles, which prevented use of saferead()

* src/util/util.c: Switch fread_file_lim over to use saferead
  instead of fread, remove FILE * use, and rename

15 years agostorage: Fix generating iscsi 'auth' xml
Cole Robinson [Thu, 8 Oct 2009 22:05:36 +0000 (18:05 -0400)]
storage: Fix generating iscsi 'auth' xml

We were missing a closing tag, so the XML wasn't proper.

15 years agoschema: Update storage pool schema.
Cole Robinson [Thu, 8 Oct 2009 22:06:10 +0000 (18:06 -0400)]
schema: Update storage pool schema.

- mpath pools weren't listed
- scsi pools were missing an adapter section
- iscsi pools were missing an auth section
- Logical pools do not require a source name to be specified

15 years agoremote: Don't print a warning every time a remote call fails
Cole Robinson [Thu, 8 Oct 2009 14:58:29 +0000 (10:58 -0400)]
remote: Don't print a warning every time a remote call fails

$ sudo virsh pool-start idontexist
10:58:18.716: warning : processCallDispatchReply:7612 : Method call error
error: failed to get pool 'idontexist'
error: Storage pool not found: no pool with matching name 'idontexist'

That warning doesn't server much purpose being printed via a virsh call. So
remove the message.

15 years agostorage: Report errors in FindPoolSources
Cole Robinson [Thu, 8 Oct 2009 14:24:37 +0000 (10:24 -0400)]
storage: Report errors in FindPoolSources