Re: RFC: PATCH 2/5: public & driver API for async jobs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jan 05, 2008 at 01:08:44AM +0000, Daniel P. Berrange wrote:
> 
>   static void testDomainSaveWorker(virJobPtr job, void *data)
>   {
>       testJobPtr privdata = data;
>       /* A 50 second ETA for saving */
>       virJobInitialize(job, 50);
> 
>       do {
>           ... do a unit of work...
> 
>           ... Check for cancellation ...
>           if (virJobFinishCancel(job))
>               return;
> 
>           ... update progress, indicating 1 second
>               of work complete, remove 1 second from
>               the ETA, and add 2% of completion state...
>           virJobUpdateRel(job, 1, -1, 2);
>       } while (...not done...);
> 
>       ... Inform world we're all done ...
>       virJobFinishSuccess(job);
>   }

Considering the Xen driver for a minute. The 'domain create',
'domain save', 'domain restore' APIs we call in XenD via the
HTTP RPC service don't have any progress information so we can't
use these APIs to give any incremental progress or ETA for
completion. This is still useful to to give cancellation of the
API calls. Baically Xen driver does an HTTP post, and then blocks
waiting for the HTTP reply. Instead of blocking on read() we 
could select() with a timeout of 500 ms, and on each timeout
check the cancellation flag. if cancelled we could drop the HTTP
connection prior to getting the response. So this could be an
incremental benefit even for existing Xen driver.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]