https://bugzilla.redhat.com/show_bug.cgi?id=1072653
Upon successful upload of a volume, the target volume and storage pool
were not updated to reflect any changes as a result of the upload. Make
use of the existing stream close callback mechanism to force a backend
pool refresh to occur in a separate thread once the stream closes. The
separate thread should avoid potential deadlocks if the refresh needed
to wait on some event from the event loop which is used to perform
the stream callback.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Update since v1 - as discussed in original posting, use virThreadCreate to
generate a thread to handle the refresh callback:
http://www.redhat.com/archives/libvir-list/2014-July/msg01395.html
Avoid the Free callback function and have the thread do the memory free
as long as thread creation was successful. Thus a couple of changes to
function names were appropriate.
Understood that this can wait for 1.2.8 - figured to get it ready to go
NOTE: Still used pool refresh, since I found that without this patch
applied a pool-dumpxml displayed the same allocation/available before
and after the upload, so that data is not refreshed for each call as
was my concern over using refreshVol vs. refreshPool
# virsh pool-dumpxml default
...
<allocation unit='bytes'>33852141568</allocation>
<available unit='bytes'>110510419968</available>
...
# virsh vol-upload test-qcow2-4g.img test.img default
# virsh pool-dumpxml default
...
<allocation unit='bytes'>33852141568</allocation>
<available unit='bytes'>110510419968</available>
...
#
src/libvirt.c | 8 ++++
src/libvirt_private.syms | 1 +
src/storage/storage_driver.c | 103 +++++++++++++++++++++++++++++++++++++++++++
tools/virsh.pod | 3 ++
4 files changed, 115 insertions(+)