Is virStoragePoolRefresh() synchronous or asynchronous?

Basically, when you call virStoragePoolRefresh(), eg to pickup any new disks that may have just been created under the pool path, when the API returns are you guaranteed that the refresh operation is completed, or might the pool still be refreshing itself? I ask because I understand this refresh operation can be 'expensive', so I'm wondering if in fact things may still be going on in the background after the API returns... - Gareth Dr. Gareth S. Bestor IBM Senior Software Engineer Systems & Technology Group - Systems Management Standards 971-285-6375 (mobile) bestor@us.ibm.com

On 08/11/2011 03:55 PM, Gareth S Bestor wrote:
Basically, when you call virStoragePoolRefresh(), eg to pickup any new disks that may have just been created under the pool path, when the API returns are you guaranteed that the refresh operation is completed, or might the pool still be refreshing itself? I ask because I understand this refresh operation can be 'expensive', so I'm wondering if in fact things may still be going on in the background after the API returns...
I can't really tell for sure due to very little knowledge of libvirt code, but I took a quick look there and nothing shows the virStoragePoolRefresh could be asynchronous. In fact, the function will fail if there are any jobs pending.
- Gareth
Dr. Gareth S. Bestor IBM Senior Software Engineer Systems & Technology Group - Systems Management Standards 971-285-6375 (mobile) bestor@us.ibm.com
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- Eduardo de Barros Lima Software Engineer, Open Virtualization Linux Technology Center - IBM/Brazil eblima@br.ibm.com

Took a quick look at libvirt's code, it seems not to create a thread for this, and in virsh.c,line 6306: static bool cmdPoolRefresh(vshControl *ctl, const vshCmd *cmd) { virStoragePoolPtr pool; bool ret = true; const char *name; if (!vshConnectionUsability(ctl, ctl->conn)) return false; if (!(pool = vshCommandOptPool(ctl, cmd, "pool", &name))) return false; if (virStoragePoolRefresh(pool, 0) == 0) { vshPrint(ctl, _("Pool %s refreshed\n"), name); } else { vshError(ctl, _("Failed to refresh pool %s"), name); ret = false; } virStoragePoolFree(pool); return ret; } this showed the calling of this API have just 2 result: succeed or fail, so I think it is synchronize calling. 于 2011-8-12 2:55, Gareth S Bestor 写道:
Basically, when you call virStoragePoolRefresh(), eg to pickup any new disks that may have just been created under the pool path, when the API returns are you guaranteed that the refresh operation is completed, or might the pool still be refreshing itself? I ask because I understand this refresh operation can be 'expensive', so I'm wondering if in fact things may still be going on in the background after the API returns...
- Gareth
Dr. Gareth S. Bestor IBM Senior Software Engineer Systems & Technology Group - Systems Management Standards 971-285-6375 (mobile) bestor@us.ibm.com
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- Best Regards Wayne Xia mail:xiawenc@linux.vnet.ibm.com tel:86-010-82450803
participants (3)
-
Eduardo Lima (Etrunko)
-
Gareth S Bestor
-
Wayne Xia