24b092c virsh: Don't infloop on snapshot/storage_vol failure

Authored and Committed by ericb 5 years ago
    virsh: Don't infloop on snapshot/storage_vol failure
    
    Most of our completers used the pattern:
    if ((nITEM = virITEMListAll()) < 0)
        return NULL;
    
    but the virDomainSnapshot and virStorageVolume completers were instead
    using goto error. If the ListAll fails with -1, the cleanup label was
    running a loop of 'size_t i < int nITEM', which is an extreme waste of
    CPU cycles. Broken since their introduction in v4.1.
    
    Fixes: f81f8b62
    Fixes: 4cb4b649
    Reported-by: Ján Tomko <jtomko@redhat.com>
    Signed-off-by: Eric Blake <eblake@redhat.com>
    
        
file modified
+6 -2