]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
13 years agodocs: document correct flag name
Eric Blake [Fri, 24 Jun 2011 15:02:39 +0000 (09:02 -0600)]
docs: document correct flag name

When adding virDomainGetVcpusFlags in commit ea3f5c6, I did
enough rebasing that the doc comments in libvirt.c no longer
matched the final chosen enum names in libvirt.h.

And now we've gone ahead and deprecated the names
VIR_DOMAIN_VCPU_{LIVE,CONFIG}.

* src/libvirt.c (virDomainGetVcpusFlags): Fix comment.

13 years agoRevert "Add new API virDomainBlockPull* to headers"
Eric Blake [Thu, 23 Jun 2011 21:40:48 +0000 (15:40 -0600)]
Revert "Add new API virDomainBlockPull* to headers"

This reverts commit 7d56a16d036d9aa7292e10e884c129742036f8a7.

Conflicts:

python/generator.py
src/libvirt_public.syms

13 years agoRevert "virDomainBlockPull: Implement the main entry points"
Eric Blake [Thu, 23 Jun 2011 21:31:37 +0000 (15:31 -0600)]
Revert "virDomainBlockPull: Implement the main entry points"

This reverts commit 6419f596e114ee9f372136cc2b9eb19f1cbb7a77.

13 years agoRevert "Add virDomainBlockPull support to the remote driver"
Eric Blake [Thu, 23 Jun 2011 21:31:30 +0000 (15:31 -0600)]
Revert "Add virDomainBlockPull support to the remote driver"

This reverts commit d1693bb160ea78954592c45a40eb856190c619c8.

Conflicts:

daemon/remote.c
src/remote/remote_driver.c
src/remote/remote_protocol.x

13 years agoRevert "Implement virDomainBlockPull for the qemu driver"
Eric Blake [Thu, 23 Jun 2011 17:58:21 +0000 (11:58 -0600)]
Revert "Implement virDomainBlockPull for the qemu driver"

This reverts commit 784ee08d2220d2a77424d5fc756b6eebe8efd5fa.

13 years agoRevert "Enable the virDomainBlockPull API in virsh"
Eric Blake [Thu, 23 Jun 2011 17:57:00 +0000 (11:57 -0600)]
Revert "Enable the virDomainBlockPull API in virsh"

This reverts commit 3e2493ce28b7e20416e916fdf893a9569c267925.

13 years agoRevert "Enable virDomainBlockPull in the python API."
Eric Blake [Thu, 23 Jun 2011 17:56:54 +0000 (11:56 -0600)]
Revert "Enable virDomainBlockPull in the python API."

This reverts commit d74b86f5d6ecae3d18a391f90a918fcac75914db.

Conflicts:

python/generator.py

13 years agoRevert "Asynchronous event for BlockPull completion"
Eric Blake [Thu, 23 Jun 2011 17:54:19 +0000 (11:54 -0600)]
Revert "Asynchronous event for BlockPull completion"

This reverts commit 12cd77a0c58a80179182f7d09e8e73f9f66b4677.

Conflicts:

python/libvirt-override-virConnect.py
python/libvirt-override.c
src/remote/remote_protocol.x

13 years agobuild: avoid python 2.4 build failure
Eric Blake [Fri, 24 Jun 2011 04:17:19 +0000 (22:17 -0600)]
build: avoid python 2.4 build failure

I'm not sure when Py_ssize_t was introduced; but Fedora 14 Python 2.7
has it, while RHEL 5 Python 2.4 lacks it.  It should be easy enough
to adjust if someone runs into problems.

* python/typewrappers.h (Py_ssize_t): Define for older python.

13 years agobuild: fix NUMA build on RHEL 5
Eric Blake [Fri, 24 Jun 2011 03:53:08 +0000 (21:53 -0600)]
build: fix NUMA build on RHEL 5

Use NUMA's older nodemask_t (fixed-size map) rather than the newer
'struct bitmask' (variable-size) in order to still compile on RHEL 5,
with its numactl-devel-0.9.8.

* src/qemu/qemu_process.c [HAVE_NUMA]: Prefer back-compat mode.
(qemuProcessInitNumaMemoryPolicy): Use older nodemask_t.

13 years agoAdd Memory Device Information to virSysinfoRead() from dmidecode type 17
Minoru Usui [Fri, 24 Jun 2011 06:05:48 +0000 (14:05 +0800)]
Add Memory Device Information to virSysinfoRead() from dmidecode type 17

* src/util/sysinfo.[ch]: also parse and save all the SMBIOS informations
  about memory modules

13 years agoAdd Processor Information to virSysinfoRead() from dmidecode type 4
Minoru Usui [Fri, 24 Jun 2011 05:42:02 +0000 (13:42 +0800)]
Add Processor Information to virSysinfoRead() from dmidecode type 4

* src/util/sysinfo.c: add parsing and formatting of processor
  information data

13 years agoCleanup virSysinfoRead()
Minoru Usui [Thu, 23 Jun 2011 10:04:26 +0000 (18:04 +0800)]
Cleanup virSysinfoRead()

* src/util/sysinfo.c: Separate BIOSInfo and SystemInfo part from
                      virSysinfoRead()

13 years agoMake sure virnetprotocol.[ch] are in BUILT_SOURCES
Daniel P. Berrange [Fri, 24 Jun 2011 14:04:11 +0000 (15:04 +0100)]
Make sure virnetprotocol.[ch] are in BUILT_SOURCES

To ensure virnetprotocol.[ch] are generated before any other
files, add them to BUILT_SOURCES and MAINTAINERCLEANFILES.
At the same time, move ESX_DRIVER_GENERATED out of DISTCLEAN
and into MAINTAINERCLEANFILES, since they are included in
EXTRA_DIST

* src/Makefile.am: Add virnetprotocol.[ch] to BUILT_SOURCES

13 years agomaint: typo fixes
Eric Blake [Fri, 24 Jun 2011 14:01:10 +0000 (08:01 -0600)]
maint: typo fixes

* src/xenxs/xen_sxpr.c (xenParseSxprPCI): Comment fix.
* tests/object-locking.ml (driverTables): Likewise.
* tests/testutils.c (virtTestDifferenceBin): Likewise.

13 years agoFix some bugs in RPC protocol make rules
Daniel P. Berrange [Fri, 24 Jun 2011 13:37:25 +0000 (14:37 +0100)]
Fix some bugs in RPC protocol make rules

The Makefile.am rules for generating RPC protocol had a couple
of bugs

 - A instance of remote/rpcgen_fix.pl  was not changed
   to rpc/genprotocol.pl
 - A dep from rpc/virnetmessage.h on the generated
   rpc/virnetprotocol.h was missing
 - The generated rpc/virnetprotocol.[ch] were not listed
   in MAINTAINERCLEANFILES

* Makefile.am: Fix RPC protocol generation

13 years agoAdd missing translation of error message from QEMU reboot patch
Daniel P. Berrange [Fri, 24 Jun 2011 11:20:20 +0000 (12:20 +0100)]
Add missing translation of error message from QEMU reboot patch

* src/qemu/qemu_process.c: Add missing _(...)

13 years agoFix job type set in qemuMigrationPrepareDirect/PrepareTunnel
Daniel P. Berrange [Thu, 23 Jun 2011 09:58:18 +0000 (10:58 +0100)]
Fix job type set in qemuMigrationPrepareDirect/PrepareTunnel

The qemuMigrationPrepareDirect/PrepareTunnel methods accidentally
set the domain job to  QEMU_JOB_MIGRATION_OUT when it should have
been  QEMU_JOB_MIGRATION_IN. This didn't have any ill-effect, but
it is none-the-less wrong.

* src/qemu/qemu_migration.c: Fix job type

13 years agoAvoid high privileges taint warning for QEMU session driver
Daniel P. Berrange [Thu, 23 Jun 2011 10:40:24 +0000 (11:40 +0100)]
Avoid high privileges taint warning for QEMU session driver

The code emitting taint warnings was mistakenly thinking
that guests run from the QEMU session driver were tainted
for having high privileges. This is of course nonsense
since the session driver is always unprivileged

* src/qemu/qemu_domain.c: Don't warn for high privileges in
  non-privileged QEMU

13 years agoAllow automatic kill of guests when a connection is closed
Daniel P. Berrange [Thu, 23 Jun 2011 10:41:57 +0000 (11:41 +0100)]
Allow automatic kill of guests when a connection is closed

If an application is using libvirt + KVM as a piece of its
internal infrastructure to perform a specific task, it can
be desirable to guarentee the VM dies when the virConnectPtr
disconnects from libvirtd. This ensures the app can't leak
any VMs it was using. Adding VIR_DOMAIN_START_AUTOKILL as
a flag when starting guests enables this to be done.

* include/libvirt/libvirt.h.in: All VIR_DOMAIN_START_AUTOKILL
* src/qemu/qemu_driver.c: Support automatic killing of guests
  upon connection close
* tools/virsh.c: Add --autokill flag to 'start' and 'create'
  commands

13 years agoAutomatically kill target QEMU if migration aborts abnormally
Daniel P. Berrange [Thu, 23 Jun 2011 10:03:57 +0000 (11:03 +0100)]
Automatically kill target QEMU if migration aborts abnormally

Migration is a multi-step process

  1. Begin(src)
  2. Prepare(dst)
  3. Perform(src)
  4. Finish(dst)
  5. Confirm(src)

At step 2, a QEMU process is lauched in the destination to
accept the incoming migration. Occasionally the process
that is controlling the migration workflow aborts, and fails
to call step 4, Finish. This leaves a QEMU process running
on the target (albeit with paused CPUs). Unfortunately because
step 2 actives a job on the QEMU process, it is unkillable by
normal means.

By registering the VM for autokill against the src virConnectPtr
in step 2, we can ensure that the guest is forcefully killed off
if the connection is closed without step 4 being invoked

* src/qemu/qemu_migration.c: Register autokill in PrepareDirect
  and PrepareTunnel. Unregister autokill on successful run
  of Finish
* src/qemu/qemu_process.c: Unregister autokill when stopping a
  process

13 years agoAdd infrastructure to automatically destroy guests when a connection closes
Daniel P. Berrange [Thu, 23 Jun 2011 09:37:57 +0000 (10:37 +0100)]
Add infrastructure to automatically destroy guests when a connection closes

Sometimes it is useful to be able to automatically destroy a guest when
a connection is closed. For example, kill an incoming migration if
the client managing the migration dies. This introduces a map between
guest 'uuid' strings and virConnectPtr objects. When a connection is
closed, any associated guests are killed off.

* src/qemu/qemu_conf.h: Add autokill hash table to qemu driver
* src/qemu/qemu_process.c, src/qemu/qemu_process.h: Add APIs
  for performing autokill of guests associated with a connection
* src/qemu/qemu_driver.c: Initialize autodestroy map

13 years agoSupport reboots with the QEMU driver
Daniel P. Berrange [Wed, 15 Jun 2011 16:49:58 +0000 (17:49 +0100)]
Support reboots with the QEMU driver

For controlled shutdown we issue a 'system_powerdown' command
to the QEMU monitor. This triggers an ACPI event which (most)
guest OS wire up to a controlled shutdown. There is no equiv
ACPI event to trigger a controlled reboot. This patch attempts
to fake a reboot.

 - In qemuDomainObjPrivatePtr we have a bool fakeReboot
   flag.
 - The virDomainReboot method sets this flag and then
   triggers a normal 'system_powerdown'.
 - The QEMU process is started with '-no-shutdown'
   so that the guest CPUs pause when it powers off the
   guest
 - When we receive the 'POWEROFF' event from QEMU JSON
   monitor if fakeReboot is not set we invoke the
   qemuProcessKill command and shutdown continues
   normally
 - If fakeReboot was set, we spawn a background thread
   which issues 'system_reset' to perform a warm reboot
   of the guest hardware. Then it issues 'cont' to
   start the CPUs again

* src/qemu/qemu_command.c: Add -no-shutdown flag if
  we have JSON support
* src/qemu/qemu_domain.h: Add 'fakeReboot' flag to
  qemuDomainObjPrivate struct
* src/qemu/qemu_driver.c: Fake reboot using the
  system_powerdown command if JSON support is available
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
  src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
  binding for system_reset command
* src/qemu/qemu_process.c: Reset the guest & start CPUs if
  fakeReboot is set

13 years agoMove the RPC generator scripts into src/rpc
Daniel P. Berrange [Fri, 10 Dec 2010 12:27:33 +0000 (12:27 +0000)]
Move the RPC generator scripts into src/rpc

Move the daemon/remote_generator.pl to src/rpc/gendispatch.pl
and move the src/remote/rpcgen_fix.pl to src/rpc/genprotocol.pl

* daemon/Makefile.am: Update for new name/location of generator
* src/Makefile.am: Update for new name/location of generator

13 years agoIntroduce generic RPC client objects
Daniel P. Berrange [Wed, 1 Dec 2010 16:35:50 +0000 (16:35 +0000)]
Introduce generic RPC client objects

To facilitate creation of new clients using XDR RPC services,
pull alot of the remote driver code into a set of reusable
objects.

 - virNetClient: Encapsulates a socket connection to a
   remote RPC server. Handles all the network I/O for
   reading/writing RPC messages. Delegates RPC encoding
   and decoding to the registered programs

 - virNetClientProgram: Handles processing and dispatch
   of RPC messages for a single RPC (program,version).
   A program can register to receive async events
   from a client

 - virNetClientStream: Handles generic I/O stream
   integration to RPC layer

Each new client program now merely needs to define the list of
RPC procedures & events it wants and their handlers. It does
not need to deal with any of the network I/O functionality at
all.

13 years agoIntroduce generic RPC module for advertising via MDNS
Daniel P. Berrange [Wed, 2 Mar 2011 17:11:42 +0000 (17:11 +0000)]
Introduce generic RPC module for advertising via MDNS

Allow RPC servers to advertise themselves using MDNS,
via Avahi

* src/rpc/virnetserver.c, src/rpc/virnetserver.h: Allow
  registration of MDNS services via avahi
* src/rpc/virnetserverservice.c, src/rpc/virnetserverservice.h: Add
  API to fetch the listen port number
* src/rpc/virnetsocket.c, src/rpc/virnetsocket.h: Add API to
  fetch the local port number
* src/rpc/virnetservermdns.c, src/rpc/virnetservermdns.h: Represent
  an MDNS advertisement

13 years agoIntroduce generic RPC server objects
Daniel P. Berrange [Wed, 1 Dec 2010 16:36:40 +0000 (16:36 +0000)]
Introduce generic RPC server objects

To facilitate creation of new daemons providing XDR RPC services,
pull a lot of the libvirtd daemon code into a set of reusable
objects.

 * virNetServer: A server contains one or more services which
   accept incoming clients. It maintains the list of active
   clients. It has a list of RPC programs which can be used
   by clients. When clients produce a complete RPC message,
   the server passes this onto the corresponding program for
   handling, and queues any response back with the client.

 * virNetServerClient: Encapsulates a single client connection.
   All I/O for the client is handled, reading & writing RPC
   messages.

 * virNetServerProgram: Handles processing and dispatch of
   RPC method calls for a single RPC (program,version).
   Multiple programs can be registered with the server.

 * virNetServerService: Encapsulates socket(s) listening for
   new connections. Each service listens on a single host/port,
   but may have multiple sockets if on a dual IPv4/6 host.

Each new daemon now merely has to define the list of RPC procedures
& their handlers. It does not need to deal with any network related
functionality at all.

13 years agoIntegrate TLS/SASL directly into the socket APIs
Daniel P. Berrange [Fri, 10 Dec 2010 12:22:03 +0000 (12:22 +0000)]
Integrate TLS/SASL directly into the socket APIs

This extends the basic virNetSocket APIs to allow them to have
a handle to the TLS/SASL session objects, once established.
This ensures that any data reads/writes are automagically
passed through the TLS/SASL encryption layers if required.

* src/rpc/virnetsocket.c, src/rpc/virnetsocket.h: Wire up
  SASL/TLS encryption

13 years agoGeneric module for handling SASL authentication & encryption
Daniel P. Berrange [Fri, 10 Dec 2010 12:21:18 +0000 (12:21 +0000)]
Generic module for handling SASL authentication & encryption

This provides two modules for handling SASL

 * virNetSASLContext provides the process-wide state, currently
   just a whitelist of usernames on the server and a one time
   library init call

 * virNetTLSSession provides the per-connection state, ie the
   SASL session itself. This also include APIs for providing
   data encryption/decryption once the session is established

* src/Makefile.am: Add to libvirt-net-rpc.la
* src/rpc/virnetsaslcontext.c, src/rpc/virnetsaslcontext.h: Generic
  SASL handling code

13 years agoGeneric module for handling TLS encryption and x509 certs
Daniel P. Berrange [Tue, 23 Nov 2010 20:17:41 +0000 (20:17 +0000)]
Generic module for handling TLS encryption and x509 certs

This provides two modules for handling TLS

 * virNetTLSContext provides the process-wide state, in particular
   all the x509 credentials, DH params and x509 whitelists
 * virNetTLSSession provides the per-connection state, ie the
   TLS session itself.

The virNetTLSContext provides APIs for validating a TLS session's
x509 credentials. The virNetTLSSession includes APIs for performing
the initial TLS handshake and sending/recving encrypted data

* src/Makefile.am: Add to libvirt-net-rpc.la
* src/rpc/virnettlscontext.c, src/rpc/virnettlscontext.h: Generic
  TLS handling code

13 years agoIntroduce a generic object for using network sockets
Daniel P. Berrange [Mon, 6 Dec 2010 17:03:35 +0000 (17:03 +0000)]
Introduce a generic object for using network sockets

Introduces a simple wrapper around the raw POSIX sockets APIs
and name resolution APIs. Allows for easy creation of client
and server sockets with correct usage of name resolution APIs
for protocol agnostic socket setup.

It can listen for UNIX and TCP stream sockets.

It can connect to UNIX, TCP streams directly, or indirectly
to UNIX sockets via an SSH tunnel or external command

* src/Makefile.am: Add to libvirt-net-rpc.la
* src/rpc/virnetsocket.c, src/rpc/virnetsocket.h: Generic
  sockets APIs
* tests/Makefile.am: Add socket test
* tests/virnetsockettest.c: New test case
* tests/testutils.c: Avoid overriding LIBVIRT_DEBUG settings
* tests/ssh.c: Dumb helper program for SSH tunnelling tests

13 years agoProvide a simple object for encoding/decoding RPC messages
Daniel P. Berrange [Mon, 6 Dec 2010 17:03:22 +0000 (17:03 +0000)]
Provide a simple object for encoding/decoding RPC messages

This provides a new struct that contains a buffer for the RPC
message header+payload, as well as a decoded copy of the message
header. There is an API for applying a XDR encoding & decoding
of the message headers and payloads. There are also APIs for
maintaining a simple FIFO queue of message instances.

Expected usage scenarios are:

To send a message

   msg = virNetMessageNew()

   ...fill in msg->header fields..
   virNetMessageEncodeHeader(msg)
   ...loook at msg->header fields to determine payload filter
   virNetMessageEncodePayload(msg, xdrfilter, data)
   ...send msg->bufferLength worth of data from buffer

To receive a message

   msg = virNetMessageNew()
   ...read VIR_NET_MESSAGE_LEN_MAX of data into buffer
   virNetMessageDecodeLength(msg)
   ...read msg->bufferLength-msg->bufferOffset of data into buffer
   virNetMessageDecodeHeader(msg)
   ...look at msg->header fields to determine payload filter
   virNetMessageDecodePayload(msg, xdrfilter, data)
   ...run payload processor

* src/Makefile.am: Add to libvirt-net-rpc.la
* src/rpc/virnetmessage.c, src/rpc/virnetmessage.h: Internal
  message handling API.
* testutils.c, testutils.h: Helper for printing binary differences
* virnetmessagetest.c: Validate all XDR encoding/decoding

13 years agoDefines the basics of a generic RPC protocol in XDR
Daniel P. Berrange [Mon, 6 Dec 2010 17:03:10 +0000 (17:03 +0000)]
Defines the basics of a generic RPC protocol in XDR

This patch defines the basics of a generic RPC protocol in XDR.
This is wire ABI compatible with the original remote_protocol.x.
It takes everything except for the RPC calls / events from that
protocol

 - The basic header virNetMessageHeader (aka remote_message_header)
 - The error object virNetMessageError  (aka remote_error)
 - Two dummy objects virNetMessageDomain & virNetMessageNetwork
   sadly needed to keep virNetMessageError ABI compatible with
   the old remote_error

The RPC protocol supports method calls, async events and
bidirectional data streams as before

* src/Makefile.am: Add rules for generating RPC code from
  protocol & define a new libvirt-net-rpc.la helper library
* src/rpc/virnetprotocol.x: New generic RPC protocol

13 years agobuild: avoid python 2.4 build failure
Eric Blake [Fri, 24 Jun 2011 04:09:00 +0000 (22:09 -0600)]
build: avoid python 2.4 build failure

On RHEL 5, I got:

/usr/bin/python ./generator.py /usr/bin/python
  File "./generator.py", line 427
    "virStreamFree", # Needed in custom virStream __del__, but free shouldn't
                   ^
SyntaxError: invalid syntax

* python/generator.py (function_skip_python_impl): Use same syntax
as other skip lists.

13 years agobuild: avoid compiler failure
Eric Blake [Fri, 24 Jun 2011 03:57:58 +0000 (21:57 -0600)]
build: avoid compiler failure

GCC complained about a C99 for-loop declaration outside of C99 mode
when compiling on RHEL 5.

* src/qemu/qemu_driver.c (qemudDomainPinVcpuFlags): Avoid C99 for
loop, since gcc 4.1.2 hates it.

13 years agodocumenting the 802.1Qbh parameters of a 'direct' interface
David S. Wang [Thu, 23 Jun 2011 16:35:30 +0000 (09:35 -0700)]
documenting the 802.1Qbh parameters of a 'direct' interface

This patch adds documentation about the 802.1Qbh related parameters
of the virtualport element for 'direct' interfaces.

Signed-off-by: David S. Wang <dwang2@cisco.com>
Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: Christian Benvenuti <benve@cisco.com>
Signed-off-by: Vasanthy Kolluri <vkolluri@cisco.com>
13 years agobuild: update to latest gnulib
Eric Blake [Wed, 22 Jun 2011 14:47:11 +0000 (08:47 -0600)]
build: update to latest gnulib

Gnulib has been busy, with 397 commits; it's easier to update now
even without any known libvirt issue to be fixed, rather than
having to analyze an even larger changeset later on.

* .gnulib: Update to latest, for lots of changes.
* bootstrap: Synchronize to upstream.

13 years agobuild: fix compilation on systems missing libnl and new includes
Stefan Berger [Thu, 23 Jun 2011 15:54:11 +0000 (11:54 -0400)]
build: fix compilation on systems missing libnl and new includes

This patch fixes the compilation of netlink.c and interface.c on those
systems missing either libnl or that have an older linux/if_link.h
include file not supporting macvtap or VF_PORTS.

WITH_MACVTAP is '1' if newer include files were detected, '0' otherwise.

IFLA_PORT_MAX is defined in linux/if_link.h if yet more functionality is
supported.

13 years agoconfigure: Make libnl optional unless macvtap is required
Matthias Bolte [Thu, 23 Jun 2011 15:51:00 +0000 (11:51 -0400)]
configure: Make libnl optional unless macvtap is required

If macvtap is required then libnl has to be available, otherwise
libnl is optional.

13 years agopython: Generate virStreamFree but don't expose in bindings
Cole Robinson [Tue, 21 Jun 2011 00:06:49 +0000 (20:06 -0400)]
python: Generate virStreamFree but don't expose in bindings

Turns out I was right in removing this the first time :) This is
needed in our custom __del__ function, but the C code wasn't
being generated. Add new infrastructure to do what we want

13 years agomaint: avoid future setgid problems
Eric Blake [Wed, 22 Jun 2011 22:18:01 +0000 (16:18 -0600)]
maint: avoid future setgid problems

* cfg.mk (sc_prohibit_setuid)
(exclude_file_name_regexp--sc_prohibit_setuid): New rule.
(VC_LIST_ALWAYS_EXCLUDE_REGEX): Always exempt po files.
(exclude_file_name_regexp--sc_prohibit_asprintf): Simplify.
(exclude_file_name_regexp--sc_prohibit_can_not): Drop.
(exclude_file_name_regexp--sc_prohibit_doubled_word): Likewise.

13 years agodocs: Make virConnectClose comply to apibuild.py expectations
Matthias Bolte [Wed, 22 Jun 2011 22:38:58 +0000 (00:38 +0200)]
docs: Make virConnectClose comply to apibuild.py expectations

apibuild.py expects a sentence that starts with "Returns"
describing the return value of a function.

13 years agoutil: Fix memory leak in virJSONParserHandleStartMap
Osier Yang [Thu, 23 Jun 2011 10:16:31 +0000 (18:16 +0800)]
util: Fix memory leak in virJSONParserHandleStartMap

13 years agoqemu: Fix memory leak in qemuProcessWaitForMonitor
Osier Yang [Thu, 23 Jun 2011 10:15:25 +0000 (18:15 +0800)]
qemu: Fix memory leak in qemuProcessWaitForMonitor

Move "VIR_FREE(buf) into label "closelog", so that "buf" could be
freed before returning.

13 years agoqemu: Only check for NUMA availability if required
Jiri Denemark [Tue, 21 Jun 2011 16:37:10 +0000 (18:37 +0200)]
qemu: Only check for NUMA availability if required

We only care about NUMA availability if NUMA configuration is requested
in domain XML.

13 years agostorage: fix volDelete return when volume still being allocated
Matthew Booth [Thu, 23 Jun 2011 03:28:29 +0000 (11:28 +0800)]
storage: fix volDelete return when volume still being allocated

volDelete used to return VIR_ERR_INTERNAL_ERROR when attempting to
delete a volume which was still being allocated. It should return
VIR_ERR_OPERATION_INVALID.

* src/storage/storage_driver.c: Fix return of volDelete.

13 years agoutil: avoid PATH_MAX-sized array
Eric Blake [Wed, 22 Jun 2011 20:52:32 +0000 (14:52 -0600)]
util: avoid PATH_MAX-sized array

See previous patch for why this is good...

* src/util/pci.c (struct _pciDevice, pciGetDevice, pciFreeDevice):
Manage path dynamically.  Report snprintf overflow.
* src/util/hostusb.c (struct _usbDevice, usbGetDevice)
(usbFreeDevice): Likewise.

13 years agoxen: avoid PATH_MAX-sized array
Eric Blake [Wed, 22 Jun 2011 20:31:45 +0000 (14:31 -0600)]
xen: avoid PATH_MAX-sized array

See previous patch for why this is good...

* src/xen/xen_driver.h (xenXMConfCache): Manage filename
dynamically.
* src/xen/xm_internal.c (xenXMConfigCacheAddFile)
(xenXMConfigFree, xenXMDomainDefineXML): Likewise.

13 years agotests: avoid PATH_MAX-sized array
Eric Blake [Wed, 22 Jun 2011 20:03:30 +0000 (14:03 -0600)]
tests: avoid PATH_MAX-sized array

See previous patch for why this is good...

* src/test/test_driver.c (struct _testConn, testOpenFromFile)
(testClose): Manage path dynamically.

13 years agovirStorageVol: avoid PATH_MAX-sized array
Eric Blake [Wed, 22 Jun 2011 19:51:32 +0000 (13:51 -0600)]
virStorageVol: avoid PATH_MAX-sized array

POSIX allows implementations where PATH_MAX is undefined, leading
to compilation error.  Not to mention that even if it is defined,
it is often wasteful in relation to the amount of data being stored.

All clients of vol->key were audited, and found not to care about
whether key is static or dynamic, except for these offenders:

* src/datatypes.h (struct _virStorageVol): Manage key dynamically.
* src/datatypes.c (virReleaseStorageVol): Free key.
(virGetStorageVol): Copy key.

13 years agomaint: add omitted copyright header
Eric Blake [Wed, 22 Jun 2011 21:42:51 +0000 (15:42 -0600)]
maint: add omitted copyright header

Bug introduced in commit 6a597883.

* src/util/netlink.h: Add boilerplate.

13 years agodocs: fix docs to match behavior of virConnectClose
Eric Blake [Wed, 22 Jun 2011 16:17:04 +0000 (10:17 -0600)]
docs: fix docs to match behavior of virConnectClose

* src/libvirt.c (virConnectClose): Mention reference count return.
Reported by Michal Novotny, analyzed by Matthias Bolte.

13 years agocleanup: make several interface functions commonly available
Stefan Berger [Wed, 22 Jun 2011 18:28:57 +0000 (14:28 -0400)]
cleanup: make several interface functions commonly available

In a second cleanup step this patch makes several interface functions from macvtap.c commonly available by moving them into interface.c and prefixing their names with 'iface'. Those functions taking Linux-specific structures as parameters are only visible on Linux.

ifaceRestoreMacAddress returns the return code from the ifaceSetMacAddr call and display an error message if setting the MAC address did not work. The caller is unchanged and still ignores the return code (which is ok).

13 years agocleanup: make nlComm commonly available
Stefan Berger [Wed, 22 Jun 2011 18:17:36 +0000 (14:17 -0400)]
cleanup: make nlComm commonly available

In a first cleanup step, make nlComm from macvtap.c commonly available
for other code to use. Since nlComm uses Linux-specific structures as
parameters it's prototype is only visible on Linux.

13 years agomaint: remove syntax-check exception
Eric Blake [Wed, 22 Jun 2011 16:40:24 +0000 (10:40 -0600)]
maint: remove syntax-check exception

We weren't using the @FOO@ notation for a Makefile substitution,
but instead for a sed rule, so using [@]FOO@ instead avoids the
need to exempt this syntax check.

* cfg.mk (_makefile_at_at_check_exceptions): Delete.
* tools/Makefile.am (virt-xml-validate, virt-pki-validate): Avoid
tripping syntax-check.
Reported by Daniel P. Berrange.

13 years agoFix use-after-free in handling domain taint flags
Daniel P. Berrange [Wed, 22 Jun 2011 16:33:10 +0000 (17:33 +0100)]
Fix use-after-free in handling domain taint flags

* src/conf/domain_conf.c: Fix use after free

13 years agoRemove macvtap dependency on domain configuration
Daniel P. Berrange [Mon, 20 Jun 2011 16:08:41 +0000 (17:08 +0100)]
Remove macvtap dependency on domain configuration

Files under src/util must not depend on src/conf
Solve the macvtap problem by moving the definition
of macvtap modes from domain_conf.h into macvtap.h

* src/util/macvtap.c, src/util/macvtap.h: Add enum
  for macvtap modes
* src/conf/domain_conf.c, src/conf/domain_conf.h: Remove
  enum for macvtap modes

13 years agoutil: Correct the error prompt string
Osier Yang [Wed, 22 Jun 2011 11:33:24 +0000 (19:33 +0800)]
util: Correct the error prompt string

virCommandProcessIO: It's reading from stdout or stderr of child,
but not writing.

13 years agoqemu: Fix one memory leak
Osier Yang [Wed, 22 Jun 2011 11:32:04 +0000 (19:32 +0800)]
qemu: Fix one memory leak

* src/qemu/qemu_domain.c: (qemuDomainAppendLog)

  Free "message" in "cleanup".

13 years agoFix to python API extractor and API doc generation
Daniel Veillard [Mon, 20 Jun 2011 03:25:34 +0000 (11:25 +0800)]
Fix to python API extractor and API doc generation

This fixes a number of issues most of them raised by Eric Blake on the
generated documentation output:
   - parsing of "long long int" and similar
   - add parsing of unions within a struct
   - remove spurious " * " fron comments on structure fields and enums
   - fix concatenation of base type and name in arrays
   - extend XSLT to cope with union in structs

* docs/apibuild.py: fix and extend API extraction tool
* docs/newapi.xsl: extend the stylesheets to cope with union in
  public structures

13 years agoqemu: domain I/O asynchronous handling
Michal Privoznik [Mon, 20 Jun 2011 08:26:47 +0000 (10:26 +0200)]
qemu: domain I/O asynchronous handling

For virtio disks and interfaces, qemu allows users to enable or disable
ioeventfd feature. This means, qemu can execute domain code, while
another thread waits for I/O event. Basically, in some cases it is win,
in some loss. This feature is available via 'ioeventfd' attribute in disk
and interface <driver> element. It accepts 'on' and 'off'. Leaving this
attribute out defaults to hypervisor decision.

13 years agobuild: require newer netcf when it is available
Eric Blake [Mon, 20 Jun 2011 15:41:49 +0000 (09:41 -0600)]
build: require newer netcf when it is available

When building rpms for newer Fedora or RHEL, take advantage of the
newer netcf packaging to guarantee interface snapshot support.

* libvirt.spec.in (BuildRequires): Bump minimum version on
platforms that support netcf 0.1.8.

13 years agovirsh: avoid bogus description
Eric Blake [Mon, 20 Jun 2011 20:25:08 +0000 (14:25 -0600)]
virsh: avoid bogus description

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

Gettext reserves the empty string for internal use, and it must
not be passed through _().  We were violating this for commands
that (for whatever reason) used "" for their description.

* tools/virsh.c (vshCmddefHelp): Don't translate empty string.
Reported by Tatsuo Kawasaki.

13 years agoset and restore MAC address of a NIC when using PASSTHROUGH mode
Dirk Herrendoerfer [Tue, 21 Jun 2011 15:49:40 +0000 (11:49 -0400)]
set and restore MAC address of a NIC when using PASSTHROUGH mode

The following patch addresses the problem that when a PASSTHROUGH
mode DIRECT NIC connection is made the MAC address of the NIC is
not automatically set and reset to the configured VM MAC and
back again.

The attached patch fixes this problem by setting and resetting the MAC
while remembering the previous setting while the VM is running.
This also works if libvirtd is restarted while the VM is running.

the patch passes make syntax-check

13 years agopython: Mark event callback wrappers as private
Cole Robinson [Thu, 16 Jun 2011 00:14:45 +0000 (20:14 -0400)]
python: Mark event callback wrappers as private

These functions aren't intended to be called directly by users, so mark
them as private.

While we're at it, remove unneeded exception handling, and break some
long lines.

13 years agopython: events: Fix C->Python handle callback prototype
Cole Robinson [Thu, 16 Jun 2011 00:02:27 +0000 (20:02 -0400)]
python: events: Fix C->Python handle callback prototype

If registering our own event loop implementation written in python,
any handles or timeouts callbacks registered by libvirt C code must
be wrapped in a python function. There is some argument trickery that
makes this all work, by wrapping the user passed opaque value in
a tuple, along with the callback function.

Problem is, the current setup requires the user's event loop to know
about this trickery, rather than just treating the opaque value
as truly opaque.

Fix this in a backwards compatible manner, and adjust the example
python event loop to do things the proper way.

13 years agopython: Add bindings for virEvent*Handle/Timeout
Cole Robinson [Wed, 15 Jun 2011 23:35:44 +0000 (19:35 -0400)]
python: Add bindings for virEvent*Handle/Timeout

13 years agoevents: Correct virEventAddTimeout docs
Cole Robinson [Wed, 15 Jun 2011 23:35:19 +0000 (19:35 -0400)]
events: Correct virEventAddTimeout docs

13 years agoPromote virEvent*Handle/Timeout to public API
Cole Robinson [Wed, 15 Jun 2011 21:54:30 +0000 (17:54 -0400)]
Promote virEvent*Handle/Timeout to public API

Since we virEventRegisterDefaultImpl is now a public API, callers need
a way to invoke the default registered Handle and Timeout functions. We
already have general functions for these internally, so promote
them to the public API.

v2:
    Actually add APIs to libvirt.h

13 years agopython: Implement virStreamSend/RecvAll helpers
Cole Robinson [Wed, 15 Jun 2011 20:54:16 +0000 (16:54 -0400)]
python: Implement virStreamSend/RecvAll helpers

Pure python implementation. The handler callbacks have been altered
a bit compared to the C API: RecvAll doesn't pass length of the data read
since that can be trivially obtained from python string objects, and SendAll
requires the handler to return the string data to send rather than
store the data in a string pointer.

13 years agopython: Implement virStreamSend/Recv
Cole Robinson [Tue, 14 Jun 2011 20:07:43 +0000 (16:07 -0400)]
python: Implement virStreamSend/Recv

The return values for the python version are different that the C version
of virStreamSend: on success we return a string, an error raises an exception,
and if the stream would block we return int(-2). We need to do this
since strings aren't passed by reference in python.

13 years agoconf: Make full use of goto label
Osier Yang [Tue, 21 Jun 2011 08:20:15 +0000 (16:20 +0800)]
conf: Make full use of goto label

* virDomainDefParse: There is a goto label "no_memory", which
reports OOM error, and then fallthrough label "error". This
patch changes things like following:

    virReportOOMError();
    goto error;

into:

    goto no_memory;

13 years agoconf: Fix one memory leak
Osier Yang [Tue, 21 Jun 2011 08:03:59 +0000 (16:03 +0800)]
conf: Fix one memory leak

Free def->numatune.memory.nodemask in virDomainDefFree.

13 years agopython: Implement bindings for virStreamEventAddCallback
Cole Robinson [Tue, 14 Jun 2011 17:49:22 +0000 (13:49 -0400)]
python: Implement bindings for virStreamEventAddCallback

v2:
    Don't generate virStreamFree

13 years agopython: generator: Don't print warning if nothing to warn about
Cole Robinson [Wed, 15 Jun 2011 21:57:37 +0000 (17:57 -0400)]
python: generator: Don't print warning if nothing to warn about

13 years agopython: libvirt-override: use simpler debug
Cole Robinson [Tue, 14 Jun 2011 16:59:44 +0000 (12:59 -0400)]
python: libvirt-override: use simpler debug

In a couple instances we have to mark a debug variable as ATTRIBUTE_UNUSED
to avoid warnings.

v2:
    Use #if 0 to comment out debug define

13 years agovirsh: enhance snapshot-create-as
Eric Blake [Wed, 15 Jun 2011 22:24:40 +0000 (16:24 -0600)]
virsh: enhance snapshot-create-as

Similar to pool-create-as.

* tools/virsh.c (cmdSnapshotCreateAs): Add --print-xml.
* tools/virsh.pod: Document it.

13 years agovirsh: add snapshot-create-as command
Eric Blake [Wed, 15 Jun 2011 22:19:13 +0000 (16:19 -0600)]
virsh: add snapshot-create-as command

Producing an xml file just for name and description fields is
overkill; this makes life easier from virsh.

* tools/virsh.c (cmdSnapshotCreateAs): New command.
(snapshotCmds): Install it.
* tools/virsh.pod: Document it.

13 years agovirsh: clarify snapshot vs. save
Eric Blake [Wed, 15 Jun 2011 20:24:53 +0000 (14:24 -0600)]
virsh: clarify snapshot vs. save

* tools/virsh.c (info_snapshot_create, info_save): Clarify
description.
* tools/virsh.pod (save): Likewise.

13 years agoFix compile warnings in virsh vcpupin
Daniel P. Berrange [Mon, 20 Jun 2011 13:28:14 +0000 (14:28 +0100)]
Fix compile warnings in virsh vcpupin

The 'char *cur' variable was being assigned from a
'const char *' string, thus discarding constness.
As well as causing a compile warning, it masked a
piece of code which attempts to assign to the
previously const string.

* tools/virsh.c: Fix const-ness of 'cur' variable in vcpupin

13 years agoremote generator: Allow to annotate arrays with typecasts
Matthias Bolte [Thu, 16 Jun 2011 09:30:23 +0000 (11:30 +0200)]
remote generator: Allow to annotate arrays with typecasts

Removes special case code from the generator and handle additional
methods.

The generated version of remoteDispatchDomainPinVcpu(Flags) has no
length check, but this check was useless anyway as it was applied to
data that was already deserialized from its XDR form.

13 years agoremote: Handle functions that return optional strings
Matthias Bolte [Wed, 15 Jun 2011 18:03:45 +0000 (20:03 +0200)]
remote: Handle functions that return optional strings

13 years agoremote: Generate virDomainGetBlockPullInfo
Matthias Bolte [Wed, 15 Jun 2011 17:52:09 +0000 (19:52 +0200)]
remote: Generate virDomainGetBlockPullInfo

It was already generatable but skipped.

13 years agovcpupin: add vcpupin resetting feature to qemu driver
Taku Izumi [Fri, 10 Jun 2011 06:41:18 +0000 (15:41 +0900)]
vcpupin: add vcpupin resetting feature to qemu driver

Pinning to all physical cpus means resetting, hence it is preferable to
delete vcpupin setting of XML.

This patch changes qemu driver to delete vcpupin setting by invoking
virDomainVcpupinDel API when pinning the specified virtual cpu to
all host physical cpus.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
13 years agovcpupin: add virDomainVcpupinDel function
Taku Izumi [Fri, 10 Jun 2011 06:40:36 +0000 (15:40 +0900)]
vcpupin: add virDomainVcpupinDel function

This patch add the private API (virDomainVcpupinDel).
This API can delete the vcpupin setting of a specified virtual cpu.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
13 years agovcpupin: add reset option to virsh vcpupin command
Taku Izumi [Fri, 10 Jun 2011 06:39:38 +0000 (15:39 +0900)]
vcpupin: add reset option to virsh vcpupin command

When resetting vcpupin setting, we have to specify all host physical
cpus as a cpulist parameter of virsh vcpupin command. It's a little
tedious.

This patch changes to allow to receive the special keyword 'r' as a cpulist
parameter of virsh vcpupin command when resetting vcpupin setting.

If you set the following:

 # virsh vcpupin VM 0 r

the vcpu0 will be pinned to all physical cpus.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
13 years agovcpupin: improve vcpupin definition of virsh vcpupin
Taku Izumi [Fri, 10 Jun 2011 06:38:55 +0000 (15:38 +0900)]
vcpupin: improve vcpupin definition of virsh vcpupin

When using vcpupin command, we have to speficy comma-separated list as cpulist,
but this is tedious in case the number of phsycal cpus is large.
This patch improves this by introducing special markup "-" and "^" which are
similar to XML schema of "cpuset" attribute.

The example:

 # virsh vcpupin Guest 0 0-15,^8

 is identical to

 # virsh vcpupin Guest 0 0,1,2,3,4,5,6,7,9,10,11,12,13,14,15

NOTE: The expression is sequentially evaluated, so "0-15,^8" is not identical
to "^8,0-15".

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
13 years agoFix preprocessor indentation in nodeinfo.c
Matthias Bolte [Mon, 20 Jun 2011 08:39:09 +0000 (10:39 +0200)]
Fix preprocessor indentation in nodeinfo.c

13 years agoMove XenAPI driver to correct spec file section
Matthias Bolte [Thu, 16 Jun 2011 11:46:38 +0000 (13:46 +0200)]
Move XenAPI driver to correct spec file section

The XenAPI driver works like the ESX and PHyp driver by using its
own HTTPS based remote protocol.

13 years agonumatune: Add tests for numatune XML
Osier Yang [Mon, 20 Jun 2011 07:17:43 +0000 (15:17 +0800)]
numatune: Add tests for numatune XML

Only add tests for qemuxmlargvtest.c, as there is no qemu command line
for numatune XML, just want to make sure the XML could be validated
well.

13 years agonumatune: Support NUMA memory tuning in qemu driver
Osier Yang [Mon, 20 Jun 2011 07:16:16 +0000 (15:16 +0800)]
numatune: Support NUMA memory tuning in qemu driver

Implemented as setting NUMA policy between fork and exec as a hook,
using libnuma. Only support memory tuning on domain process currently.

For the nodemask out of range, will report soft warning instead of
hard error in libvirt layer. (Kernel will be silent as long as one
of set bit in the nodemask is valid on the host. E.g. For a host
has two NUMA nodes, kernel will be silent for nodemask "01010101").
So, soft warning is the only thing libvirt can do, as one might want
to specify the numa policy prior to a node that doesn't exist yet,
however, it may come as hotplug soon.

13 years agonumatune: Support persistent XML for numatune
Osier Yang [Mon, 20 Jun 2011 07:15:44 +0000 (15:15 +0800)]
numatune: Support persistent XML for numatune

* src/conf/domain_conf.h: Introduce one new struct for representing
NUMA tuning related stuffs.

* src/conf/domain_conf.c: Parse and format numatune XML.

13 years agonumatune: Add doc for new numatune XML
Osier Yang [Mon, 20 Jun 2011 07:15:05 +0000 (15:15 +0800)]
numatune: Add doc for new numatune XML

13 years agonumatune: Define XML schema
Osier Yang [Mon, 20 Jun 2011 07:13:25 +0000 (15:13 +0800)]
numatune: Define XML schema

Example XML:

<numatune>
  <memory mode="strict" nodeset="0-10,^4"/>
</numatune>

Please enter the commit message for your changes. Lines starting

13 years agoUpdate qemuDomainSetBlkioParameters to use flags
Hu Tao [Tue, 7 Jun 2011 06:03:09 +0000 (14:03 +0800)]
Update qemuDomainSetBlkioParameters to use flags

13 years agoupdate qemuDomainGetBlkioParameters to use flags
Hu Tao [Tue, 7 Jun 2011 06:03:08 +0000 (14:03 +0800)]
update qemuDomainGetBlkioParameters to use flags

13 years agoAdd new parameters for blkiotune
Hu Tao [Tue, 7 Jun 2011 06:03:07 +0000 (14:03 +0800)]
Add new parameters for blkiotune

Add --config, --live and --current for command blkiotune

13 years agobuild: fix building error when building without libvirtd
Wen Congyang [Mon, 20 Jun 2011 02:48:07 +0000 (10:48 +0800)]
build: fix building error when building without libvirtd

When building libvirt without libvirtd, we will receive the following error
message:

make[3]: Entering directory `/home/wency/rpmbuild/BUILD/libvirt-0.9.2/tools'
  CC     virsh-virsh.o
  CC     virsh-console.o
  GEN    virt-xml-validate
  GEN    virt-pki-validate
  CCLD   virsh
./src/.libs/libvirt.so: undefined reference to `numa_available'
./src/.libs/libvirt.so: undefined reference to `numa_max_node'
collect2: ld returned 1 exit status

The reason is that: we check numactl only when building qemu driver, and qemu
driver will not be built when bulding without libvirtd. So with_numactl's
value is check and we will not link libnuma.so.

In the other function, we call numa_available() and numa_max_node() only
when HAVE_NUMACTL is 1. We should do the same check in the function nodeGetMemoryStats().

13 years agoapparmor: implement AppArmorSetFDLabel()
Jamie Strandboge [Mon, 20 Jun 2011 03:53:24 +0000 (11:53 +0800)]
apparmor: implement AppArmorSetFDLabel()

During a savevm operation, libvirt will now use fd migration if qemu
supports it. When the AppArmor driver is enabled, AppArmorSetFDLabel()
is used but since this function simply returns '0', the dynamic AppArmor
profile is not updated and AppArmor blocks access to the save file. This
patch implements AppArmorSetFDLabel() to get the pathname of the file by
resolving the fd symlink in /proc, and then gives that pathname to
reload_profile(), which fixes 'virsh save' when AppArmor is enabled.

Reference: https://launchpad.net/bugs/795800

13 years agoAdd missing checks for NULL in domain lock manager
Daniel P. Berrange [Tue, 14 Jun 2011 08:05:54 +0000 (09:05 +0100)]
Add missing checks for NULL in domain lock manager

The domain lock manager forgot to include a bunch of checks
for NULL which could occur on OOM

* src/locking/domain_lock.c: Add checks for NULL