]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agobuild: fix author of previous commit
Eric Blake [Thu, 9 Aug 2012 21:31:58 +0000 (15:31 -0600)]
build: fix author of previous commit

Stefan's attribution came through with an extra 'n' in the email address.

12 years agoesx: Implement network driver
Matthias Bolte [Sun, 5 Aug 2012 20:11:50 +0000 (22:11 +0200)]
esx: Implement network driver

An ESX server has one or more PhysicalNics that represent the actual
hardware NICs. Those can be listed via the interface driver.

A libvirt virtual network is mapped to a HostVirtualSwitch. On the
physical side a HostVirtualSwitch can be connected to PhysicalNics.
On the virtual side a HostVirtualSwitch has HostPortGroups that are
mapped to libvirt virtual network's portgroups. Typically there is
HostPortGroups named 'VM Network' that is used to connect virtual
machines to a HostVirtualSwitch. A second HostPortGroup typically
named 'Management Network' is used to connect the hypervisor itself
to the HostVirtualSwitch. This one is not mapped to a libvirt virtual
network's portgroup. There can be more HostPortGroups than those
typical two on a HostVirtualSwitch.

         +---------------+-------------------+
   ...---|               |                   |   +-------------+
         | HostPortGroup |                   |---| PhysicalNic |
         |   VM Network  |                   |   |    vmnic0   |
   ...---|               |                   |   +-------------+
         +---------------+ HostVirtualSwitch |
                         |     vSwitch0      |
         +---------------+                   |
         | HostPortGroup |                   |
   ...---|   Management  |                   |
         |    Network    |                   |
         +---------------+-------------------+

The virtual counterparts of the PhysicalNic is the HostVirtualNic for
the hypervisor and the VirtualEthernetCard for the virtual machines
that are grouped into HostPortGroups.

   +---------------------+   +---------------+---...
   | VirtualEthernetCard |---|               |
   +---------------------+   | HostPortGroup |
   +---------------------+   |   VM Network  |
   | VirtualEthernetCard |---|               |
   +---------------------+   +---------------+
                                             |
                             +---------------+
   +---------------------+   | HostPortGroup |
   |    HostVirtualNic   |---|   Management  |
   +---------------------+   |    Network    |
                             +---------------+---...

The currently implemented network driver can list, define and undefine
HostVirtualSwitches including HostPortGroups for virtual machines.
Existing HostVirtualSwitches cannot be edited yet. This will be added
in a followup patch.

12 years agoesx: Remove redundant checks for esxVI_LookupHostSystemProperties result
Matthias Bolte [Sun, 5 Aug 2012 11:47:05 +0000 (13:47 +0200)]
esx: Remove redundant checks for esxVI_LookupHostSystemProperties result

esxVI_LookupHostSystemProperties guarantees that hostSystem is non-NULL.
Remove redundant NULL checks from callers.

Also prefer esxVI_GetStringValue over open-coding the logic.

12 years agoesx: Fix dynamic deep copy
Matthias Bolte [Sat, 4 Aug 2012 17:56:17 +0000 (19:56 +0200)]
esx: Fix dynamic deep copy

The static deep copy allocates storage for the copy. The dynamic
version injected the dynamic dispatch after the allocation. This
triggered the invalid argument check in the dynamically dispatched
deep copy call. The deep copy function expects its dest parameter
to be a pointer to a NULL-pointer. This expectation wasn't met due
to the dispatching deep copy doing the allocation before the call.

Fix this by dynamically dispatching to the correct type before the
allocation.

12 years agoesx: Implement interface driver
Matthias Bolte [Sat, 4 Aug 2012 17:48:50 +0000 (19:48 +0200)]
esx: Implement interface driver

Lists available PhysicalNic devices. A PhysicalNic is always active
and can neither be defined nor undefined.

A PhysicalNic is used to bridge a HostVirtualSwitch to the physical
network.

12 years agonwfilter: remove target table before renaming it
Stefan Berger [Thu, 9 Aug 2012 20:17:13 +0000 (16:17 -0400)]
nwfilter: remove target table before renaming it

Remove the target table before renaming a table to it, i.e.,
remove table B before renaming A to B. This makes the
renaming more robust against unconnected left-over tables.

12 years agoAdd APIs for obtaining the unique ID of LVM & SCSI volumes
Daniel P. Berrange [Wed, 20 Jul 2011 09:40:53 +0000 (10:40 +0100)]
Add APIs for obtaining the unique ID of LVM & SCSI volumes

Both LVM volumes and SCSI LUNs have a globally unique
identifier associated with them. It is useful to be able
to query this identifier to then perform disk locking,
rather than try to figure out a stable pathname.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoqemu: Fix debug message in p2p migration
Jiri Denemark [Thu, 2 Aug 2012 10:11:20 +0000 (12:11 +0200)]
qemu: Fix debug message in p2p migration

When entering "confirm" phase, we are interested in the value of
cancelled rather then ret variable which was interesting before "finish"
phase and didn't change since then.

12 years agoexamples: Update strings for event details
Jiri Denemark [Wed, 8 Aug 2012 14:17:31 +0000 (16:17 +0200)]
examples: Update strings for event details

12 years agoqemu: Migrate at unlimited speed by default
Jiri Denemark [Fri, 3 Aug 2012 16:34:06 +0000 (18:34 +0200)]
qemu: Migrate at unlimited speed by default

Previously, qemu did not respond to monitor commands during migration if
the limit was too high. This prevented us from raising the limit
earlier. The qemu issue seems to be fixed (according to my testing) and
we may remove the 32Mb/s limit.

12 years agoqemu: Refactor parsing of block device IO tuning parameters.
Peter Krempa [Thu, 9 Aug 2012 07:58:05 +0000 (09:58 +0200)]
qemu: Refactor parsing of block device IO tuning parameters.

This patch refactors the JSON parsing function that extracts the block
IO tuning parameters from qemu's output. The most impacting change
concerns the error message that is returned if the reply from qemu does
not contain the needed data. The data for IO parameter tuning were added
in qemu 1.1 and the previous error message was confusing.

This patch also breaks long lines and extracts a multiple time used code
pattern to a macro.

12 years agoremote: Clean up coding style and refactor remote connection opening
Peter Krempa [Tue, 17 Jul 2012 12:25:34 +0000 (14:25 +0200)]
remote: Clean up coding style and refactor remote connection opening

Remove spaces before function calls and some other coding nits in some
parts of the remote driver and refactor getting of URI argument
components into variables used by libvirt later on.

12 years agoAllow rbd backing stores
Peter Feiner [Wed, 8 Aug 2012 21:02:24 +0000 (17:02 -0400)]
Allow rbd backing stores

Prevents libvirt from treating RBD backing stores as files. Without this
patch, creating a domain with a qcow2 overlay on an RBD would fail.

This patch essentially extends 9c7c4a4fc533598e59e9a0038ec783e61a38e664,
which allows nbd backing stores, to allow rbd backing stores.

12 years agoFix errno check, prevent spurious errors under heavy load
Peter Feiner [Wed, 8 Aug 2012 20:59:41 +0000 (16:59 -0400)]
Fix errno check, prevent spurious errors under heavy load

From man poll(2), poll does not set errno=EAGAIN on interrupt, however
it does set errno=EINTR. Have libvirt retry on the appropriate errno.

Under heavy load, a program of mine kept getting libvirt errors 'poll on
socket failed: Interrupted system call'. The signals were SIGCHLD from
processes forked by threads unrelated to those using libvirt.

12 years agoqemu:rename qemuCheckScsiControllerModel function
Guannan Ren [Wed, 8 Aug 2012 15:13:23 +0000 (23:13 +0800)]
qemu:rename qemuCheckScsiControllerModel function

12 years agorpc: fix a virObject typo error in struct _virNetServer
Guannan Ren [Wed, 8 Aug 2012 09:32:22 +0000 (17:32 +0800)]
rpc: fix a virObject typo error in struct _virNetServer

This typo will crash libvirtd when it recevies signal SIGINT

12 years agoqemu: add two qemu caps for lsi and virtio-scsi SCSI controllers
Guannan Ren [Wed, 8 Aug 2012 07:06:33 +0000 (15:06 +0800)]
qemu: add two qemu caps for lsi and virtio-scsi SCSI controllers

Rename qemuDefaultScsiControllerModel to qemuCheckScsiControllerModel.
When scsi model is given explicitly in XML(model > 0) checking if the
underlying QEMU supports it or not first, raise an error on checking
failure.
When the model is not given(mode <= 0), return LSI by default, if
the QEMU doesn't support it, raise an error.

12 years agoqemu: add capabilities flags related to scsi controller
Guannan Ren [Wed, 8 Aug 2012 06:25:24 +0000 (14:25 +0800)]
qemu: add capabilities flags related to scsi controller

  QEMU_CAPS_SCSI_LSI
    set the flag when "lsi53c895a", bus PCI, alias "lsi" in
    the output of "qemu -device ?"
    -device lsi in qemu command line

  QEMU_CAPS_VIRTIO_SCSI_PCI
    set the flag when "name "virtio-scsi-pci", bus PCI" in
    the output of qemu devices query.
    -device virtio-scsi-pci in qemu command line

12 years agoutil: include stderr in log message when an external command fails
Laine Stump [Mon, 6 Aug 2012 15:40:06 +0000 (11:40 -0400)]
util: include stderr in log message when an external command fails

This patch is in response to:

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

If a caller to virCommandRun doesn't ask for the exitstatus of the
program it's running, the virCommand functions assume that they should
log an error message and return failure if the exit code isn't
0. However, only the commandline and exit status are logged, while
potentially useful information sent by the program to stderr is
discarded.

Fortunately, virCommandRun is already checking if the caller had asked
for stderr to be saved and, if not, sets things up to save it in
*cmd->errbuf. This makes it fairly simple for virCommandWait to
include *cmd->errbuf in the error log (there are still other callers
that don't setup errbuf, and even virCommandRun won't set it up if the
command is being daemonized, so we have to check that it's non-zero).

12 years agoSet LIBVIRT_AUTOSTART=0 when running test suites
Daniel P. Berrange [Tue, 7 Aug 2012 11:02:06 +0000 (12:02 +0100)]
Set LIBVIRT_AUTOSTART=0 when running test suites

Occasionally some test cases will (accidentally) try to spawn
libvirtd. Set the LIBVIRT_AUTOSTART=0 environment variable to
ensure the remote driver never tries autostart.

12 years agoDon't check the 'connect' command in virsh-all test
Daniel P. Berrange [Tue, 7 Aug 2012 10:09:15 +0000 (11:09 +0100)]
Don't check the 'connect' command in virsh-all test

The 'virsh-all' test case will invoke each virsh command with
no args. With the 'connect' command this causes virsh to try
to connect to the default URI, which in turn tries to spawn
libvirtd. This is not something we want todo in the test suite,
so skip the 'connect' command.

12 years agoTurn virNetClient* into virObject instances
Daniel P. Berrange [Mon, 30 Jul 2012 09:14:56 +0000 (10:14 +0100)]
Turn virNetClient* into virObject instances

Make all the virNetClient* objects use virObject APIs for
reference counting

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoTurn virNetServer* into virObject instances
Daniel P. Berrange [Wed, 11 Jul 2012 13:35:52 +0000 (14:35 +0100)]
Turn virNetServer* into virObject instances

Make all the virNetServer* objects use the virObject APIs
for reference counting

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoTurn virSocket into a virObject
Daniel P. Berrange [Wed, 11 Jul 2012 13:35:51 +0000 (14:35 +0100)]
Turn virSocket into a virObject

Make virSocket use the virObject APIs for reference counting

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoTurn virKeepAlive into a virObject
Daniel P. Berrange [Wed, 11 Jul 2012 13:35:50 +0000 (14:35 +0100)]
Turn virKeepAlive into a virObject

Make virKeepAlive use the virObject APIs for reference counting

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoTurn virNetSASLContext and virNetSASLSession into virObject instances
Daniel P. Berrange [Wed, 11 Jul 2012 13:35:49 +0000 (14:35 +0100)]
Turn virNetSASLContext and virNetSASLSession into virObject instances

Make virNetSASLContext and virNetSASLSession use virObject APIs
for reference counting

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoTurn virNetTLSContext and virNetTLSSession into virObject instances
Daniel P. Berrange [Wed, 11 Jul 2012 13:35:48 +0000 (14:35 +0100)]
Turn virNetTLSContext and virNetTLSSession into virObject instances

Make virNetTLSContext and virNetTLSSession use the virObject
APIs for reference counting

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoTurn qemuAgentPtr and qemuMonitorPtr into virObjectPtr instances
Daniel P. Berrange [Wed, 11 Jul 2012 13:35:47 +0000 (14:35 +0100)]
Turn qemuAgentPtr and qemuMonitorPtr into virObjectPtr instances

Make qemuAgentPtr and qemuMonitorPtr types use the virObject APIs
for reference counting

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoTurn virDomainObjPtr into a virObjectPtr
Daniel P. Berrange [Wed, 11 Jul 2012 13:35:46 +0000 (14:35 +0100)]
Turn virDomainObjPtr into a virObjectPtr

Switch virDomainObjPtr to use the virObject APIs for reference
counting. The main change is that virObjectUnref does not return
the reference count, merely a bool indicating whether the object
still has any refs left. Checking the return value is also not
mandatory.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert public datatypes to inherit from virObject
Daniel P. Berrange [Tue, 31 Jul 2012 16:55:36 +0000 (17:55 +0100)]
Convert public datatypes to inherit from virObject

This converts the following public API datatypes to use the
virObject infrastructure:

  virConnectPtr
  virDomainPtr
  virDomainSnapshotPtr
  virInterfacePtr
  virNetworkPtr
  virNodeDevicePtr
  virNWFilterPtr
  virSecretPtr
  virStreamPtr
  virStorageVolPtr
  virStoragePoolPtr

The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.

* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
  public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
  src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
  src/qemu/qemu_process.c, src/storage/storage_driver.c,
  src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
  tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
  tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
  to use virObjectUnref/virObjectRef

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd a generic reference counted virObject type
Daniel P. Berrange [Wed, 11 Jul 2012 13:35:44 +0000 (14:35 +0100)]
Add a generic reference counted virObject type

This introduces a fairly basic reference counted virObject type
and an associated virClass type, that use atomic operations for
ref counting.

In a global initializer (recommended to be invoked using the
virOnceInit API), a virClass type must be allocated for each
object type. This requires a class name, a "dispose" callback
which will be invoked to free memory associated with the object's
fields, and the size in bytes of the object struct.

eg,

   virClassPtr  connclass = virClassNew("virConnect",
                                        sizeof(virConnect),
                                        virConnectDispose);

The struct for the object, must include 'virObject' as its
first member

eg

  struct _virConnect {
    virObject object;

    virURIPtr uri;
  };

The 'dispose' callback is only responsible for freeing
fields in the object, not the object itself. eg a suitable
impl for the above struct would be

  void virConnectDispose(void *obj) {
     virConnectPtr conn = obj;
     virURIFree(conn->uri);
  }

There is no need to reset fields to 'NULL' or '0' in the
dispose callback, since the entire object will be memset
to 0, and the klass pointer & magic integer fields will
be poisoned with 0xDEADBEEF before being free()d

When creating an instance of an object, one needs simply
pass the virClassPtr eg

   virConnectPtr conn = virObjectNew(connclass);
   if (!conn)
      return NULL;
   conn->uri = virURIParse("foo:///bar")

Object references can be manipulated with

   virObjectRef(conn)
   virObjectUnref(conn)

The latter returns a true value, if the object has been
freed (ie its ref count hit zero)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoapparmor: QEMU bridge helper policy updates
Richa Marwaha [Fri, 3 Aug 2012 20:33:07 +0000 (16:33 -0400)]
apparmor: QEMU bridge helper policy updates

This patch provides AppArmor policy updates for the QEMU bridge helper.
The QEMU bridge helper is a SUID executable exec'd by QEMU that drops
capabilities to CAP_NET_ADMIN and adds a tap device to a network bridge.

Signed-off-by: Richa Marwaha <rmarwah@linux.vnet.ibm.com>
Signed-off-by: Corey Bryant<coreyb@linux.vnet.ibm.com>
12 years agoAdd -netdev bridge support
Richa Marwaha [Fri, 3 Aug 2012 20:33:06 +0000 (16:33 -0400)]
Add -netdev bridge support

This patch adds the support to run the QEMU network helper
under unprivileged user. It also adds the support for
attach-interface option in virsh to run under unprivileged
user.

Signed-off-by: Richa Marwaha <rmarwah@linux.vnet.ibm.com>
Signed-off-by: Corey Bryant<coreyb@linux.vnet.ibm.com>
12 years agoAdd -netdev bridge capabilities
Richa Marwaha [Fri, 3 Aug 2012 20:33:05 +0000 (16:33 -0400)]
Add -netdev bridge capabilities

This patch adds the capability in libvirt to check if
-netdev bridge option is supported or not.

Signed-off-by: Richa Marwaha <rmarwah@linux.vnet.ibm.com>
Signed-off-by: Corey Bryant<coreyb@linux.vnet.ibm.com>
12 years agovirrandom: make virRandomInitialize an automatic one-shot
Eric Blake [Fri, 3 Aug 2012 23:15:00 +0000 (17:15 -0600)]
virrandom: make virRandomInitialize an automatic one-shot

All callers used the same initialization seed (well, the new
viratomictest forgot to look at getpid()); so we might as well
make this value automatic.  And while it may feel like we are
giving up functionality, I documented how to get it back in the
unlikely case that you actually need to debug with a fixed
pseudo-random sequence.  I left that crippled by default, so
that a stray environment variable doesn't cause a lack of
randomness to become a security issue.

* src/util/virrandom.c (virRandomInitialize): Rename...
(virRandomOnceInit): ...and make static, with one-shot call.
Document how to do fixed-seed debugging.
* src/util/virrandom.h (virRandomInitialize): Drop prototype.
* src/libvirt_private.syms (virrandom.h): Don't export it.
* src/libvirt.c (virInitialize): Adjust caller.
* src/lxc/lxc_controller.c (main): Likewise.
* src/security/virt-aa-helper.c (main): Likewise.
* src/util/iohelper.c (main): Likewise.
* tests/seclabeltest.c (main): Likewise.
* tests/testutils.c (virtTestMain): Likewise.
* tests/viratomictest.c (mymain): Likewise.

12 years agobuild: drop conditional use of mdns code
Eric Blake [Fri, 3 Aug 2012 19:16:42 +0000 (13:16 -0600)]
build: drop conditional use of mdns code

Commit 1f6f723 missed a step.  At first I was worried that scrubbing
the conditionals would lead to a runtime failure when compiled without
avahi, but my testing makes it appear that the runtime error will only
occur if the .conf files in /etc request mdns advertisement; and the
old behavior was to silently ignore the request, so this is actually
a better behavior of only failing when the config requests the
impossible.

* src/rpc/virnetserver.c: Drop HAVE_AVAHI conditionals; all
callers already passed NULL if mdns_adv was not configured.

12 years agoqemu: Set reasonable RSS limit on domain startup
Michal Privoznik [Tue, 17 Jul 2012 16:38:47 +0000 (18:38 +0200)]
qemu: Set reasonable RSS limit on domain startup

If there's a memory leak in qemu or qemu is exploited the host's
system will sooner or later start trashing instead of killing
the bad process. This however has impact on performance and other
guests as well. Therefore we should set a reasonable RSS limit
even when user hasn't set any. It's better to be secure by default.

12 years agovirsh: Use vshPrint instead of printf
Osier Yang [Fri, 3 Aug 2012 15:48:15 +0000 (23:48 +0800)]
virsh: Use vshPrint instead of printf

12 years agoxen-xm: Generate UUID if not specified
Jim Fehlig [Fri, 3 Aug 2012 21:10:13 +0000 (15:10 -0600)]
xen-xm: Generate UUID if not specified

Parsing xen-xm format configuration will fail if UUID is not
specified, e.g.

virsh domxml-from-native xen-xm some-config-without-uuid
error: internal error parsing xm config failed

Initially I thought to skip parsing the UUID in xenParseXM() when
not present in the configuration, but this results in a UUID of
all zeros since it is never set

virsh domxml-from-native xen-xm /tmp/jim/bug-773621_pierre-test
<domain type='xen'>
  <name>test</name>
  <uuid>00000000-0000-0000-0000-000000000000</uuid>
  ...

which certainly can't be correct since this is the UUID the xen
tools use for dom0.

This patch takes the approach of generating a UUID when it is not
specified in the configuration.

12 years agoconf: Remove console stream callback only when freeing console helper
Peter Krempa [Fri, 3 Aug 2012 09:20:29 +0000 (11:20 +0200)]
conf: Remove console stream callback only when freeing console helper

Commit ba226d334acbc49f6751b430e0c4e00f69eef6bf tried to fix crash of
the daemon when a domain with an open console was destroyed. The fix was
wrong as it tried to remove the callback also when the stream was
aborted, where at that point the fd stream driver was already freed and
removed.

This patch clears the callbacks with a helper right before the hash is
freed, so that it doesn't interfere with other codepaths where the
stream object is freed.

12 years agoclient: Free message when freeing client
Peter Krempa [Fri, 3 Aug 2012 14:50:16 +0000 (16:50 +0200)]
client: Free message when freeing client

The last message of the client was not freed leaking 4 bytes of memory
in the client when the remote daemon crashed while processing a message.

12 years agoESX: Add "Byte" datatype
Ata E Husain Bohra [Wed, 1 Aug 2012 22:15:11 +0000 (15:15 -0700)]
ESX: Add "Byte" datatype

Append "Byte" to set of predefined datatype objects.

Signed-off-by: Ata E Husain Bohra <ata.husain@hotmail.com>
12 years agoparallels: translate error message
Eric Blake [Fri, 3 Aug 2012 16:22:08 +0000 (10:22 -0600)]
parallels: translate error message

Without this patch, the English phrase 'no name' would appear
literally within the remaining translated message.

* src/parallels/parallels_driver.c (parallelsCreateVm)
(parallelsDomainDefineXML): Tweak error message.

12 years agobuild: fix "make rpm"
Laine Stump [Fri, 3 Aug 2012 04:47:38 +0000 (00:47 -0400)]
build: fix "make rpm"

make rpm was failing with the following error:

Entering directory `/home/laine/devel/libvirt/tests'
make[2]: *** No rule to make target `viratomicdata.h',
             needed by `distdir'.  Stop.

viratomicdata.h is listed in tests/Makefile.am as a dependency of
viratomictest, but doesn't exist, is never referenced, and removing
that dependency permits make rpm to complete successfully.

12 years agoExport virUUIDIsValid to libvirt internal code
Daniel P. Berrange [Fri, 3 Aug 2012 13:00:21 +0000 (14:00 +0100)]
Export virUUIDIsValid to libvirt internal code

12 years agoFix typo s/AM_CLFAGS/AM_CFLAGS/ in sanlock link
Daniel P. Berrange [Thu, 2 Aug 2012 19:10:13 +0000 (20:10 +0100)]
Fix typo s/AM_CLFAGS/AM_CFLAGS/ in sanlock link

12 years agovirsh: console: Avoid using stream after being freed.
Peter Krempa [Fri, 3 Aug 2012 11:16:24 +0000 (13:16 +0200)]
virsh: console: Avoid using stream after being freed.

The stream object wasn't set to NULL after freeing causing a double free
attempt on the cleanup path.

12 years agoremote: Fill snapshot argument in remoteDomainSnapshotListAllChildren
Peter Krempa [Fri, 3 Aug 2012 09:45:12 +0000 (11:45 +0200)]
remote: Fill snapshot argument in remoteDomainSnapshotListAllChildren

The remote driver did not fill the required snapshot parent argument in
the RPC call structure that caused a client crash when trying to use
this new API.

12 years agoqemu: Allow to attach/detach controller device persistently
Osier Yang [Mon, 23 Jul 2012 08:18:57 +0000 (16:18 +0800)]
qemu: Allow to attach/detach controller device persistently

* src/conf/domain_conf.c:
  - Add virDomainControllerFind to find controller device by type
    and index.
  - Add virDomainControllerRemove to remove the controller device
    from maintained controler list.

* src/conf/domain_conf.h:
  - Declare the two new helpers.

* src/libvirt_private.syms:
  - Expose private symbols for the two new helpers.

* src/qemu/qemu_driver.c:
  - Support attach/detach controller device persistently

* src/qemu/qemu_hotplug.c:
  - Use the two helpers to simplify the codes.

12 years agoAdded timestamps to storage volumes
Hendrik Schwartke [Wed, 25 Jul 2012 07:43:37 +0000 (09:43 +0200)]
Added timestamps to storage volumes

The access, birth, modification and change times are added to
storage volumes and corresponding xml representations.  This
shows up in the XML in this format:

<timestamps>
  <atime>1341933637.027319099</atime>
  <mtime>1341933637.027319099</mtime>
</timestamps>

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoUpdate xml schemas according to libvirt source
JĂ¡n Tomko [Thu, 2 Aug 2012 11:23:16 +0000 (13:23 +0200)]
Update xml schemas according to libvirt source

capability.rng: Guest features can be in any order.
nodedev.rng: Added <driver> element, <capability> phys_function and
virt_functions for PCI devices.
storagepool.rng: Owner or group ID can be -1.

schema tests: New capabilities and nodedev files; changed owner and
group to -1 in pool-dir.xml.
storage_conf: Print uid_t and gid_t as signed to storage pool XML.

12 years agobuild: add stubs so mdns code can be unconditionally compiled
Eric Blake [Wed, 1 Aug 2012 23:42:51 +0000 (17:42 -0600)]
build: add stubs so mdns code can be unconditionally compiled

The recent changes to the testsuite to validate exported symbols
flushed out a case of unconditionally exporting symbols that
were only conditionally compiled under HAVE_AVAHI.

* src/Makefile.am (libvirt_net_rpc_server_la_SOURCES): Compile
virnetservermdns unconditionally.
* configure.ac (HAVE_AVAHI): Drop unused automake conditional.
* src/rpc/virnetservermdns.c: Add fallbacks when Avahi is not
present.

12 years agovirsh: Switch to close callback
Michal Privoznik [Thu, 2 Aug 2012 17:15:16 +0000 (19:15 +0200)]
virsh: Switch to close callback

Since we've introduced close callbacks we can drop this SIGINT magic
(which doesn't work now neither) and fully utilize the new feature.

12 years agoqemu: Fix typo in qemuDomainModifyDeviceFlags
Michal Privoznik [Thu, 2 Aug 2012 14:25:41 +0000 (16:25 +0200)]
qemu: Fix typo in qemuDomainModifyDeviceFlags

One of our latest commits fbe87126 introduced this nasty typo:
func(vmdef, ...); where func() dereference vmdef->ncontrollers,
and vmdef was initialized to NULL. This leaves us with unconditional
immediate segfault. It should be vm->def instead.

12 years agodaemon: Portable auto-detection of driver module directory
Jiri Denemark [Thu, 2 Aug 2012 13:41:23 +0000 (15:41 +0200)]
daemon: Portable auto-detection of driver module directory

When running libvirtd from a build directory on a system with unmodified
libtool, libvirtd's binary is not renamed as "lt-libvirtd". Check for
"/daemon/.libs/libvirtd" in addition to "lt-libvirtd".

12 years agobuild: Rename security manager library
Jiri Denemark [Thu, 2 Aug 2012 10:25:51 +0000 (12:25 +0200)]
build: Rename security manager library

Security manager is not a dynamically loadable driver. Let's avoid the
confusion by renaming libvirt_driver_security library as
libvirt_security_manager.

12 years agobuild: Link security manager into libvirt.so
Jiri Denemark [Thu, 2 Aug 2012 12:10:31 +0000 (14:10 +0200)]
build: Link security manager into libvirt.so

Security manager is not a dynamically loadable driver, it's a common
infrastructure similar to util, conf, cpu, etc. used by individual
drivers. Such code is allowed to be linked into libvirt.so.

This reverts commit ec5b7bd2ecbf40ceff5b2d4fc00d5cfdfba966a4 and most of
aae5cfb69948fddef556f8f5b9f80a444f9c6125.

This patch is supposed to fix virdrivermoduletest failures for qemu and
lxc drivers as well as libvirtd's ability to load qemu and lxc drivers.

12 years agoAvoid clash of base64 symbols
Daniel P. Berrange [Thu, 2 Aug 2012 13:21:00 +0000 (14:21 +0100)]
Avoid clash of base64 symbols

On Debian/Ubuntu, one of the libraries libvirt (indirectly) links
with exports a symbol named 'base64_encode'. This takes precedence
over GNULIB's base64_encode function during linking. Unfortunately
they of course have different API semantics. To avoid this problem
use a few #defines in config.h to rename the GNULIB provided
function to have a 'libvirt_gl_' prefix

12 years agobuild: commit to 0.10.0 release naming
Eric Blake [Wed, 1 Aug 2012 17:00:35 +0000 (11:00 -0600)]
build: commit to 0.10.0 release naming

With 0.10.0-rc0 out the door, we are committed to the next version
number.

* src/libvirt_public.syms (LIBVIRT_0.9.14): Rename...
(LIBVIRT_0.10.0): ...to this.
* docs/formatdomain.html.in: Fix fallout.
* src/openvz/openvz_driver.c (openvzDriver): Likewise.
* src/remote/remote_driver.c (remote_driver): Likewise.

12 years agoRemove unused uuidstr variable from datatypes.c
Daniel P. Berrange [Tue, 31 Jul 2012 16:55:02 +0000 (17:55 +0100)]
Remove unused uuidstr variable from datatypes.c

Several APIs in src/datatypes.c were formatting an UUID to a
uuidstr variable and then not using it.

12 years agoRewrite virAtomic APIs using GLib's atomic ops code
Daniel P. Berrange [Wed, 11 Jul 2012 13:35:43 +0000 (14:35 +0100)]
Rewrite virAtomic APIs using GLib's atomic ops code

There are a few issues with the current virAtomic APIs

 - They require use of a virAtomicInt struct instead of a plain
   int type
 - Several of the methods do not implement memory barriers
 - The methods do not implement compiler re-ordering barriers
 - There is no Win32 native impl

The GLib library has a nice LGPLv2+ licensed impl of atomic
ops that works with GCC, Win32, or pthreads.h that addresses
all these problems. The main downside to their code is that
the pthreads impl uses a single global mutex, instead of
a per-variable mutex. Given that it does have a Win32 impl
though, we don't expect anyone to seriously use the pthread.h
impl, so this downside is not significant.

* .gitignore: Ignore test case
* configure.ac: Check for which atomic ops impl to use
* src/Makefile.am: Add viratomic.c
* src/nwfilter/nwfilter_dhcpsnoop.c: Switch to new atomic
  ops APIs and plain int datatype
* src/util/viratomic.h: inline impls of all atomic ops
  for GCC, Win32 and pthreads
* src/util/viratomic.c: Global pthreads mutex for atomic
  ops
* tests/viratomictest.c: Test validate to validate safety
  of atomic ops.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove manual one-shot global initializers
Daniel P. Berrange [Wed, 11 Jul 2012 13:35:42 +0000 (14:35 +0100)]
Remove manual one-shot global initializers

Remove the use of a manually run virLogStartup and
virNodeSuspendInitialize methods. Instead make sure they
are automatically run using VIR_ONCE_GLOBAL_INIT

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoqemu: Add support for "none" USB controller
Peter Krempa [Tue, 3 Jul 2012 13:43:13 +0000 (15:43 +0200)]
qemu: Add support for "none" USB controller

This patch enables the "none" USB controller for qemu guests and adds
valdiation on hot-plugged devices if the guest has USB disabled.

This patch also adds a set of tests to check parsing of domain XMLs that
use the "none" controller and some forbidden situations concerning it.

12 years agodomain_conf: Add helpers to verify if device configuration is valid
Peter Krempa [Tue, 3 Jul 2012 13:30:25 +0000 (15:30 +0200)]
domain_conf: Add helpers to verify if device configuration is valid

This patch adds helpers that validate domain's device configuration.
This will be needed later on to verify devices being hot-plugged to
guests. If the guest has no USB bus, then it's not valid to plug a USB
device to that guest.

12 years agodomain_conf: Add USB controler model "none"
Peter Krempa [Mon, 2 Jul 2012 15:28:43 +0000 (17:28 +0200)]
domain_conf: Add USB controler model "none"

Libvirt adds a USB controller to the guest even if the user does not
specify any in the XML. This is due to back-compat reasons.

To allow disabling USB for a guest this patch adds a new USB controller
type "none" that disables USB support for the guest.

12 years agoFix indentions
Osier Yang [Fri, 20 Jul 2012 14:24:51 +0000 (22:24 +0800)]
Fix indentions

Some of the macros use tab, while the left use spaces, this patch
change it to always use the spaces. And a few aligning fixes.

12 years agostorage: netfs and iscsi need option srcSpec for resource discovery
Guannan Ren [Tue, 31 Jul 2012 08:56:41 +0000 (16:56 +0800)]
storage: netfs and iscsi need option srcSpec for resource discovery

The option 'srcSpec' to virsh command find-storage-pool-sources
is optional for logical type of storage pool, but mandatory for
netfs and iscsi type.
When missing the option for netfs and iscsi, libvirt reports XML
parsing error due to null string option srcSpec.

before
error: Failed to find any netfs pool sources
error: (storage_source_specification):1: Document is empty
(null)

after:
error: pool type 'iscsi' requires option --srcSpec for source discovery

12 years agomaint: consolidate AUTHOR listings for Gerd von Egidy
Gerd v. Egidy [Mon, 30 Jul 2012 08:42:59 +0000 (10:42 +0200)]
maint: consolidate AUTHOR listings for Gerd von Egidy

12 years agogitignore: Reorder alphabetically
Michal Privoznik [Wed, 1 Aug 2012 11:40:56 +0000 (13:40 +0200)]
gitignore: Reorder alphabetically

One of our latest patches added some files to .gitignore. However,
not in the right place leaving the file not sorted. Since my git
is set up to sort these files contents, fix this issue as it keeps
showing up in git status.

12 years agospec: Remove extra () with return statement
Jiri Denemark [Wed, 1 Aug 2012 11:09:57 +0000 (13:09 +0200)]
spec: Remove extra () with return statement

12 years agobuild: Link security driver into daemon
Jiri Denemark [Wed, 1 Aug 2012 07:59:43 +0000 (09:59 +0200)]
build: Link security driver into daemon

Commit aae5cfb69948fddef556f8f5b9f80a444f9c6125 removed security driver
from libvirt_la but forgot to link it into libvirtd in case libvirt is
built without modules.

12 years agoFix rpm build failures
Daniel Veillard [Wed, 1 Aug 2012 08:10:36 +0000 (16:10 +0800)]
Fix rpm build failures

The 'make check' was rebuilding the binaries just overrided,
so for more safety also override the C program
Also daemon-conf isn't built anymore so remove it from the list

12 years agoAdd missing parallels_utils.h to Makefile.am
Daniel Veillard [Wed, 1 Aug 2012 06:12:09 +0000 (14:12 +0800)]
Add missing parallels_utils.h to Makefile.am

Otherwise the file is missing from the dist tarball and distcheck fails

12 years agoparallels: implement VM creation
Dmitry Guryanov [Tue, 31 Jul 2012 18:56:13 +0000 (22:56 +0400)]
parallels: implement VM creation

To create a new VM in Parallels Clud Server we should issue
"prlctl create" command, and give path to the directory,
where VM should be created. VM's storage will be in that
directory later. So in this first version find out location
of first VM's hard disk and create VM there.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoparallels: add storage driver
Dmitry Guryanov [Wed, 1 Aug 2012 03:46:22 +0000 (11:46 +0800)]
parallels: add storage driver

Parallels Cloud Server has one serious discrepancy with libvirt:
libvirt stores domain configuration files in one place, and storage
files in other places (with the API of storage pools and storage volumes).
Parallels Cloud Server stores all domain data in a single directory,
for example, you may have domain with name fedora-15, which will be
located in '/var/parallels/fedora-15.pvm', and it's hard disk image will be
in '/var/parallels/fedora-15.pvm/harddisk1.hdd'.

I've decided to create storage driver, which produces pseudo-volumes
(xml files with volume description), and they will be 'converted' to
real disk images after attaching to a VM.

So if someone creates VM with one hard disk using virt-manager,
at first virt-manager creates a new volume, and then defines a
domain. We can lookup a volume by path in XML domain definition
and find out location of new domain and size of its hard disk.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoparallels: implement virDomainDefineXML operation for existing domains
Dmitry Guryanov [Tue, 31 Jul 2012 18:56:11 +0000 (22:56 +0400)]
parallels: implement virDomainDefineXML operation for existing domains

Add parallelsDomainDefineXML function, it works only for existing
domains for the present.

It's too hard to convert libvirt's XML domain configuration into
Parallel's one, so I've decided to compare virDomainDef structures:
current domain definition and the one created from XML, given to
the function. And change only different parameters.

Currently only name, description, number of cpus, memory amount
and video memory can be changed.

Video device and console added, because libvirt supposes that
VM must always have one video device, if there are some
graphics and one console.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoparallels: add support of VNC remote display
Dmitry Guryanov [Tue, 31 Jul 2012 18:56:10 +0000 (22:56 +0400)]
parallels: add support of VNC remote display

Add support for reading VNC parameters of the VM.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoparallels: get info about serial ports
Dmitry Guryanov [Tue, 31 Jul 2012 18:56:09 +0000 (22:56 +0400)]
parallels: get info about serial ports

Add support of collecting information about serial
ports. This change is needed mostly as an example,
support of other devices will be added later.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoparallels: implement functions for domain life cycle management
Dmitry Guryanov [Tue, 31 Jul 2012 18:56:08 +0000 (22:56 +0400)]
parallels: implement functions for domain life cycle management

Add functions for create/shutdown/destroy and suspend/resume domain.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoparallels: add functions to list domains and get info
Dmitry Guryanov [Tue, 31 Jul 2012 18:56:07 +0000 (22:56 +0400)]
parallels: add functions to list domains and get info

Parallels driver is 'stateless', like vmware or openvz drivers.
It collects information about domains during startup using
command-line utility prlctl. VMs in Parallels are identified by UUIDs
or unique names, which can be used as respective fields in
virDomainDef structure. Currently only basic info, like
description, virtual cpus number and memory amount, is implemented.
Querying devices information will be added in the next patches.

Parallels doesn't support non-persistent domains - you can't run
a domain having only disk image, it must always be registered
in system.

Functions for querying domain info have been just copied from
test driver with some changes - they extract needed data from
previously created list of virDomainObj objects.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoadd function virCommandNewVAList
Dmitry Guryanov [Tue, 31 Jul 2012 18:56:06 +0000 (22:56 +0400)]
add function virCommandNewVAList

Add function virCommandNewVAList which is equivalent to the
virCommandNewArgList but with va_list instead of a variable number
of arguments.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoparallels: add driver skeleton
Dmitry Guryanov [Tue, 31 Jul 2012 18:56:05 +0000 (22:56 +0400)]
parallels: add driver skeleton

Parallels Cloud Server is a cloud-ready virtualization
solution that allows users to simultaneously run multiple virtual
machines and containers on the same physical server.

More information can be found here: http://www.parallels.com/products/pcs/
Also beta version of Parallels Cloud Server can be downloaded there.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoqemu: syntax fix
Marc-André Lureau [Tue, 31 Jul 2012 17:51:41 +0000 (19:51 +0200)]
qemu: syntax fix

Pushed without ack, under the trivial rule.

12 years agoOnly perform symbol check against libvirt.so
Daniel P. Berrange [Tue, 31 Jul 2012 10:03:24 +0000 (11:03 +0100)]
Only perform symbol check against libvirt.so

The 'check-symfile' test case was checking the contents of
libvirt.syms against libvirt.so + all of libvirt_driver_XXX.so
This was in fact bogus - libvirt.syms should only refer to
stuff in libvirt.so, but it had some symbols from the various
driver modules in it too. Now that libvirt.syms has been
fixed, the check-symfile test can be simplified to only
consider libvirt.so

12 years agoDon't link nwfilter or secrets driver to libvirt.so
Daniel P. Berrange [Tue, 31 Jul 2012 09:57:10 +0000 (10:57 +0100)]
Don't link nwfilter or secrets driver to libvirt.so

The nwfilter and secrets drivers are both stateful and are already
linked directly to libvirtd. Linking them to libvirt.so is thus
wrong, likewise exporting their symbols in libvirt.so is wrong

12 years agoRemove bogus libvirt_network.syms file
Daniel P. Berrange [Tue, 31 Jul 2012 09:56:11 +0000 (10:56 +0100)]
Remove bogus libvirt_network.syms file

The network driver is stateful, so it is linked directly to libvirtd,
rather than libvirt.so. Thus there are no network symbols to be exported
in libvirt.so, and libvirt_network.syms can be deleted

12 years agoqemu: fix use after free
Eric Blake [Tue, 31 Jul 2012 14:05:14 +0000 (08:05 -0600)]
qemu: fix use after free

Detected by Coverity.

* src/qemu/qemu_hotplug.c (qemuDomainAttachHostDevice): Avoid
double free of usb on failure.

12 years agobuild: Don't export xenLinuxDomainBlockStats symbol
Jiri Denemark [Tue, 31 Jul 2012 08:04:13 +0000 (10:04 +0200)]
build: Don't export xenLinuxDomainBlockStats symbol

The symbol is only used within Xen driver.

12 years agobuild: distribute virsh related source files
Guannan Ren [Tue, 31 Jul 2012 03:52:13 +0000 (11:52 +0800)]
build: distribute virsh related source files

In virsh.c, it includes multiple virsh source files, we need
to have them distributed.

12 years agobuild: fix build without HAVE_CAPNG
Eric Blake [Mon, 30 Jul 2012 17:59:25 +0000 (11:59 -0600)]
build: fix build without HAVE_CAPNG

Otherwise, a build may fail with:

lxc/lxc_conatiner.c: In function 'lxcContainerDropCapabilities':
lxc/lxc_container.c:1662:46: error: unused parameter 'keepReboot' [-Werror=unused-parameter]

* src/lxc/lxc_container.c (lxcContainerDropCapabilities): Mark
parameter unused.

12 years agodaemon: Fix crash in virTypedParameterArrayClear
Jiri Denemark [Mon, 30 Jul 2012 10:14:54 +0000 (12:14 +0200)]
daemon: Fix crash in virTypedParameterArrayClear

Daemon uses the following pattern when dispatching APIs with typed
parameters:

    VIR_ALLOC_N(params, nparams);
    virDomain*(dom, params, &nparams, flags);
    virTypedParameterArrayClear(params, nparams);

In case nparams was originally set to 0, virDomain* API would fill it
with the number of typed parameters it can provide and we would use this
number (rather than zero) to clear params. Because VIR_ALLOC* returns
non-NULL pointer even if size is 0, the code would end up walking
through random memory. If we were lucky enough and the memory contained
7 (VIR_TYPED_PARAM_STRING) at the right place, we would try to free a
random pointer and crash.

Let's make sure params stays NULL when nparams is 0.

12 years agoconf: Remove callback from stream when freeing entries in console hash
Peter Krempa [Fri, 27 Jul 2012 12:50:54 +0000 (14:50 +0200)]
conf: Remove callback from stream when freeing entries in console hash

When a domain has a active console connection and is destroyed the
callback is called on private data that no longer exist causing a
segfault.

12 years agoconf: Remove dead code from virConsoleOpen()
Peter Krempa [Fri, 27 Jul 2012 12:48:27 +0000 (14:48 +0200)]
conf: Remove dead code from virConsoleOpen()

12 years agopython: Don't generate bodies for close callback functions
Peter Krempa [Mon, 30 Jul 2012 13:33:09 +0000 (15:33 +0200)]
python: Don't generate bodies for close callback functions

Commit 6ed5a1b9bd6240b8f2736790e48dd1c284c2e0e1 adds close callback
functions to the public API but doesn't add python implementation. This
patch sets the function to be written manually (to fix the build), but
doesn't implement them yet.

12 years agoImprove error message in LXC startup with network is not active
Daniel P. Berrange [Mon, 30 Jul 2012 10:26:51 +0000 (11:26 +0100)]
Improve error message in LXC startup with network is not active

If an LXC container is using a virtual network and that network
is not active, currently the user gets a rather unhelpful
error message about tap device setup failure. Add an explicit
check for whether the network is active, in exactly the same
way as the QEMU driver

12 years agoRemove tabs from all perl files & enforce this
Daniel P. Berrange [Fri, 27 Jul 2012 12:51:28 +0000 (13:51 +0100)]
Remove tabs from all perl files & enforce this

The cfg.mk file rule to check for tab characters was not
applied to perl files. Much of our Perl code is full of
tabs as a result. Kill them, kill them all !

12 years agoAdd handling for reboots of LXC containers
Daniel P. Berrange [Mon, 23 Jul 2012 11:25:37 +0000 (12:25 +0100)]
Add handling for reboots of LXC containers

The reboot() syscall is allowed by new kernels for LXC containers.
The LXC controller can detect whether a reboot was requested
(instead of a normal shutdown) by looking at the "init" process
exit status. If a reboot was triggered, the exit status will
record SIGHUP as the kill reason.

The LXC controller has cleared all its capabilities, and the
veth network devices will no longer exist at this time. Thus
it cannot restart the container init process itself. Instead
it emits an event which is picked up by the LXC driver in
libvirtd. This will then re-create the container, using the
same configuration as it was previously running with (ie it
will not activate 'newDef').

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAllow CAP_SYS_REBOOT on new enough kernels
Daniel P. Berrange [Fri, 20 Jul 2012 21:16:19 +0000 (22:16 +0100)]
Allow CAP_SYS_REBOOT on new enough kernels

Check whether the reboot() system call is virtualized, and if
it is, then allow the container to keep CAP_SYS_REBOOT.

Based on an original patch by Serge Hallyn

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRun an RPC protocol over the LXC controller monitor
Daniel P. Berrange [Tue, 17 Jul 2012 14:54:08 +0000 (15:54 +0100)]
Run an RPC protocol over the LXC controller monitor

This defines a new RPC protocol to be used between the LXC
controller and the libvirtd LXC driver. There is only a
single RPC message defined thus far, an asynchronous "EXIT"
event that is emitted just before the LXC controller process
exits. This provides the LXC driver with details about how
the container shutdown - normally, or abnormally (crashed),
thus allowing the driver to emit better libvirt events.

Emitting the event in the LXC controller requires a few
little tricks with the RPC service. Simply calling the
virNetServiceClientSendMessage does not work, since this
merely queues the message for asynchronous processing.
In addition the main event loop is no longer running at
the point the event is emitted, so no I/O is processed.

Thus after invoking virNetServiceClientSendMessage it is
necessary to mark the client as being in "delayed close"
mode. Then the event loop is run again, until the client
completes its close - this happens only after the queued
message has been fully transmitted. The final complexity
is that it is not safe to run virNetServerQuit() from the
client close callback, since that is invoked from a
context where the server is locked. Thus a zero-second
timer is used to trigger shutdown of the event loop,
causing the controller to finally exit.

* src/Makefile.am: Add rules for generating RPC protocol
  files and dispatch methods
* src/lxc/lxc_controller.c: Emit an RPC event immediately
  before exiting
* src/lxc/lxc_domain.h: Record the shutdown reason
  given by the controller
* src/lxc/lxc_monitor.c, src/lxc/lxc_monitor.h: Register
  RPC program and event handler. Add callback to let
  driver receive EXIT event.
* src/lxc/lxc_process.c: Use monitor exit event to decide
  what kind of domain event to emit
* src/lxc/lxc_protocol.x: Define wire protocol for LXC
  controller monitor.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMake RPC code generator a little more flexible
Daniel P. Berrange [Fri, 20 Jul 2012 14:31:46 +0000 (15:31 +0100)]
Make RPC code generator a little more flexible

Update the gendispatch.pl script to get a little closer to
being able to generate code for the LXC monitor, by passing
in the struct prefix separately from the procedure prefix.
Also allow method names using virCapitalLetters instead
of vir_underscore_separator

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>