Skip to content
Snippets Groups Projects
  • Hanna Reitz's avatar
    1656324e
    qemu-img: Fix check's leak/corruption fix report · 1656324e
    Hanna Reitz authored
    
    There are two problems with qemu-img check's report on how many leaks
    and/or corruptions have been fixed:
    
    (1) ImageCheck.has_leaks_fixed and ImageCheck.has_corruptions_fixed are
    only true when ImageCheck.leaks or ImageCheck.corruptions (respectively)
    are non-zero.  qcow2's check implementation will set the latter to zero
    after it has fixed leaks and corruptions, though, so leaks-fixed and
    corruptions-fixed are actually never reported after successful repairs.
    We should always report them when they are non-zero, just like all the
    other fields of ImageCheck.
    
    (2) After something has been fixed and we run the check a second time,
    leaks_fixed and corruptions_fixed are taken from the first run; but
    has_leaks_fixed and has_corruptions_fixed are not.  The second run
    actually cannot fix anything, so with (1) fixed, has_leaks_fixed and
    has_corruptions_fixed will always be false here.  (With (1) unfixed,
    they will at least be false on successful runs, because then the number
    of leaks and corruptions found in the second run should be 0.)
    We should save has_leaks_fixed and has_corruptions_fixed just like we
    save leaks_fixed and corruptions_fixed.
    
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20200324172757.1173824-2-mreitz@redhat.com>
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    1656324e
    History
    qemu-img: Fix check's leak/corruption fix report
    Hanna Reitz authored
    
    There are two problems with qemu-img check's report on how many leaks
    and/or corruptions have been fixed:
    
    (1) ImageCheck.has_leaks_fixed and ImageCheck.has_corruptions_fixed are
    only true when ImageCheck.leaks or ImageCheck.corruptions (respectively)
    are non-zero.  qcow2's check implementation will set the latter to zero
    after it has fixed leaks and corruptions, though, so leaks-fixed and
    corruptions-fixed are actually never reported after successful repairs.
    We should always report them when they are non-zero, just like all the
    other fields of ImageCheck.
    
    (2) After something has been fixed and we run the check a second time,
    leaks_fixed and corruptions_fixed are taken from the first run; but
    has_leaks_fixed and has_corruptions_fixed are not.  The second run
    actually cannot fix anything, so with (1) fixed, has_leaks_fixed and
    has_corruptions_fixed will always be false here.  (With (1) unfixed,
    they will at least be false on successful runs, because then the number
    of leaks and corruptions found in the second run should be 0.)
    We should save has_leaks_fixed and has_corruptions_fixed just like we
    save leaks_fixed and corruptions_fixed.
    
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20200324172757.1173824-2-mreitz@redhat.com>
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>