• Iustin Pop's avatar
    Reduce duplicate Attach() calls in bdev · cb999543
    Iustin Pop authored
    Currently, the 'public' functions of bdev (FindDevice and
    AttachOrAssemble) will call the Attach() method right after class
    instantiation.
    
    But the constructor itself calls this function, and therefore we have
    duplicate Attach() calls (which are not cheap at all).
    
    The patch introduces a new 'attached' instance attribute that tells if
    the last Attach() was successful. The public functions reuse this so
    that we only do the minimum required number of calls.
    
    Reviewed-by: imsnah
    cb999543
bdev.py 49.4 KB