• Iustin Pop's avatar
    Rework the DRBD8 device status computation · 6b90c22e
    Iustin Pop authored
    Currently, compute the status of a drbd8 device in GetSyncStatus and
    return only the values that we need (and fit in the framework of
    GetSyncStatus). However, the full status details are useful (and needed)
    in other places, so the patch attempts to improve this situation.
    
    We abstract the status of a device outside in a separate class, that
    knows how to parse contents from /proc/drbd and set easily accessible
    attributes. We then simplify the GetSyncStatus to use this and return
    the values that it needs, and add a separate method that returns the
    full status object.
    
    The move to a separate class cleans up a little bit the old
    sync-progress computation from GetSyncStatus, but it's still many
    regexes.
    
    The patch also adds unittests for a few statuses, and modifies one
    BaseDRBD call to accept a custom filename instead of '/proc/drbd' to
    ease unittests.
    
    Reviewed-by: imsnah
    6b90c22e
bdev.py 49.2 KB