libvirt/daemon
Matthias Bolte 08d42b52f1 Add several missing vir*Free calls in libvirtd's remote code
Justin Clift reported a problem with adding virStoragePoolIsPersistent
to virsh's pool-info command, resulting in a strange problem. Here's
an example:

    virsh # pool-create-as images_dir3 dir - - - - "/home/images2"
    Pool images_dir3 created

    virsh # pool-info images_dir3
    Name:           images_dir3
    UUID:           90301885-94eb-4ca7-14c2-f30b25a29a36
    State:          running
    Capacity:       395.20 GB
    Allocation:     30.88 GB
    Available:      364.33 GB

    virsh # pool-destroy images_dir3
    Pool images_dir3 destroyed

At this point the images_dir3 pool should be gone (because it was
transient) and we should be able to create a new pool with the same name:

    virsh # pool-create-as images_dir3 dir - - - - "/home/images2"
    Pool images_dir3 created

    virsh # pool-info images_dir3
    Name:           images_dir3
    UUID:           90301885-94eb-4ca7-14c2-f30b25a29a36
    error: Storage pool not found

The new pool got the same UUID as the first one, but we didn't specify
one. libvirt should have picked a random UUID, but it didn't.

It turned out that virStoragePoolIsPersistent leaks a reference to the
storage pool object (actually remoteDispatchStoragePoolIsPersistent does).
As a result, pool-destroy doesn't remove the virStoragePool for the
"images_dir3" pool from the virConnectPtr's storagePools hash on libvirtd's
side. Then the second pool-create-as get's the stale virStoragePool object
associated with the "images_dir3" name. But this object has the old UUID.

This commit ensures that all get_nonnull_* and make_nonnull_* calls for
libvirt objects are matched properly with vir*Free calls. This fixes the
reference leaks and the reported problem.

All remoteDispatch*IsActive and remoteDispatch*IsPersistent functions were
affected. But also remoteDispatchDomainMigrateFinish2 was affected in the
success path. I wonder why that didn't surface earlier. Probably because
domainMigrateFinish2 is executed on the destination host and in the common
case this connection is opened especially for the migration and gets closed
after the migration is done. So there was no chance to run into a problem
because of the leaked reference.
2010-06-16 23:06:12 +02:00
..
.gitignore .gitignore: Add libvirt-guests.init 2010-05-21 13:59:31 -04:00
dispatch.c Fix messsage -> message. 2010-04-13 15:39:39 -04:00
dispatch.h Remote driver & daemon impl of new event API 2010-03-26 13:52:29 +00:00
event.c util: ensure safe{read,write,zero} return is checked 2010-04-15 11:40:08 -06:00
event.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
libvirt-guests.init.in Fix libvirt-guests init script 2010-05-28 18:00:53 +02:00
libvirt-guests.sysconf Init script for handling guests on shutdown/boot 2010-05-21 09:33:30 +02:00
libvirtd.aug Rename qemud/ directory to daemon/ 2009-09-21 14:41:42 +01:00
libvirtd.c Ensure UNIX domain sockets are removed on daemon shutdown 2010-06-08 15:05:37 +01:00
libvirtd.conf Expose a host UUID in the capabilities XML 2010-05-25 17:09:18 +01:00
libvirtd.h Ensure UNIX domain sockets are removed on daemon shutdown 2010-06-08 15:05:37 +01:00
libvirtd.init.in daemon: Export SDL audio environment variables 2010-05-21 12:48:34 -04:00
libvirtd.lxc.logrotate.in Change logrotate to be per-hypervisor logs 2010-03-10 11:27:02 +01:00
libvirtd.policy-0 Rename qemud/ directory to daemon/ 2009-09-21 14:41:42 +01:00
libvirtd.policy-1 Rename qemud/ directory to daemon/ 2009-09-21 14:41:42 +01:00
libvirtd.qemu.logrotate.in Change logrotate to be per-hypervisor logs 2010-03-10 11:27:02 +01:00
libvirtd.sasl Rename qemud/ directory to daemon/ 2009-09-21 14:41:42 +01:00
libvirtd.sysconf daemon: sysconf: Update comment about VNC audio 2010-05-26 10:51:36 -04:00
libvirtd.uml.logrotate.in Change logrotate to be per-hypervisor logs 2010-03-10 11:27:02 +01:00
Makefile.am build: depend on correct file 2010-06-01 15:09:25 -06:00
mdns.c Rename daemon main code 2009-09-21 14:41:45 +01:00
mdns.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
remote_dispatch_args.h remote: protocol implementation for virDomainCreateWithFlags 2010-06-15 09:37:04 -06:00
remote_dispatch_prototypes.h remote: protocol implementation for virDomainCreateWithFlags 2010-06-15 09:37:04 -06:00
remote_dispatch_ret.h remote: protocol implementation for virDomainCreateWithFlags 2010-06-15 09:37:04 -06:00
remote_dispatch_table.h remote: protocol implementation for virDomainCreateWithFlags 2010-06-15 09:37:04 -06:00
remote_generate_stubs.pl Pass remote_message_header to the dispatch functions. 2009-09-30 14:05:57 +02:00
remote.c Add several missing vir*Free calls in libvirtd's remote code 2010-06-16 23:06:12 +02:00
remote.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
stream.c Let remoteClientStream only do RX if requested. 2009-09-30 14:05:41 +02:00
stream.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
test_libvirtd.aug Rename qemud/ directory to daemon/ 2009-09-21 14:41:42 +01:00
THREADING.txt Move libvirtd event loop into background thread 2009-11-03 14:45:43 -05:00