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

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

 



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.

  ACK except that current code is 3s and this may be a bit short.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
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]