• J
    qemu: Allow all query commands to be run during long jobs · 36184288
    Jiri Denemark 提交于
    Query commands are safe to be called during long running jobs (such as
    migration). This patch makes them all work without the need to
    special-case every single one of them.
    
    The patch introduces new job.asyncCond condition and associated
    job.asyncJob which are dedicated to asynchronous (from qemu monitor
    point of view) jobs that can take arbitrarily long time to finish while
    qemu monitor is still usable for other commands.
    
    The existing job.active (and job.cond condition) is used all other
    synchronous jobs (including the commands run during async job).
    
    Locking schema is changed to use these two conditions. While asyncJob is
    active, only allowed set of synchronous jobs is allowed (the set can be
    different according to a particular asyncJob) so any method that
    communicates to qemu monitor needs to check if it is allowed to be
    executed during current asyncJob (if any). Once the check passes, the
    method needs to normally acquire job.cond to ensure no other command is
    running. Since domain object lock is released during that time, asyncJob
    could have been started in the meantime so the method needs to recheck
    the first condition. Then, normal jobs set job.active and asynchronous
    jobs set job.asyncJob and optionally change the list of allowed job
    groups.
    
    Since asynchronous jobs only set job.asyncJob, other allowed commands
    can still be run when domain object is unlocked (when communicating to
    remote libvirtd or sleeping). To protect its own internal synchronous
    commands, the asynchronous job needs to start a special nested job
    before entering qemu monitor. The nested job doesn't check asyncJob, it
    only acquires job.cond and sets job.active to block other jobs.
    36184288
qemu_driver.c 265.5 KB