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

Re: [libvirt] [PATCH 12/15] Allow timeouts waiting for QEMU job lock



On Wed, Nov 04, 2009 at 06:35:03PM +0100, Daniel Veillard wrote:
> On Tue, Nov 03, 2009 at 02:50:06PM -0500, Daniel P. Berrange wrote:
> > Some monitor commands may take a very long time to complete. It is
> > not desirable to block other incoming API calls forever. With this
> > change, if an existing API call is holding the job lock, additional
> > API calls will not wait forever. They will time out after a short
> > period of time, allowing application to retry later.
> > 
> > * include/libvirt/virterror.h, src/util/virterror.c: Add new
> >   VIR_ERR_OPERATION_TIMEOUT error code
> > * src/qemu/qemu_driver.c: Change to a timed condition variable
> >   wait for acquiring the monitor job lock
> [...]
> > +/* Give up waiting for mutex after 30 seconds */
> > +//#define QEMU_JOB_WAIT_TIME (1000ull * 30)
> > +#define QEMU_JOB_WAIT_TIME (1000ull * 3)
> >  static int qemuDomainObjBeginJob(virDomainObjPtr obj) ATTRIBUTE_RETURN_CHECK;
> >  static int qemuDomainObjBeginJob(virDomainObjPtr obj)
> >  {
> >      qemuDomainObjPrivatePtr priv = obj->privateData;
> > +    struct timeval now;
> > +    unsigned long long then;
> > +
> > +    if (gettimeofday(&now, NULL) < 0) {
> > +        virReportSystemError(NULL, errno, "%s",
> > +                             _("cannot get time of day"));
> > +        return -1;
> > +    }
> > +    then = (now.tv_sec * 1000ull) + (now.tv_usec / 1000);
> > +    then += QEMU_JOB_WAIT_TIME;
> 
>   Unless I'm mistaken looks to me that at this point
>     then = now + 3s , not now + 30s
> unless the this is modified in the comment.

Ha, yes I changed it to 3s for testing & forgot to change it back to 30
before posting the patch

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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