• N
    vz: handle gracefully races on undefining domain · b999ce97
    Nikolay Shirokovskiy 提交于
    Undefine procedure drops domain lock while waiting for detaching
    disks vz sdk call. Meanwhile vz sdk event domain-config-changed
    arrives, its handler finds domain and is blocked waiting for job
    condition. After undefine API call finishes event processing procedes
    and tries to refreshes domain config thru existing vz sdk domain handle.
    Domain does not exists anymore and event processing fails. Everything
    is fine we just don't want to see error message in log for this
    particular case.
    
    Fortunately domain has flag that domain is removed from list. This
    also imply that vz sdk domain is also undefined. Thus if we check
    for this flag right after domain is locked again on accuiring
    job condition we gracefully handle this situation.
    
    Actually the race can happen in other situations too. Any
    time we wait for job condition in mutualy exclusive job in
    time when we acquire it vz sdk domain can cease to exist.
    So instead of general internal error we can return domain
    not found which is easier to handle. We don't need to patch
    other places in mutually exclusive jobs where domain lock
    is dropped as if job is started domain can't be undefine
    by mutually exclusive undefine job.
    
    The code of this patch is quite similar to qemu driver checks
    for is domain is active after acquiring a job. The difference
    only while qemu domain is operational while process is active
    vz domain is operational while domain exists.
    b999ce97
vz_sdk.c 131.7 KB