mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
0ff027ae2c
Fix a bug in _stats_set_aux() that causes bogus data to appear in the 'userdata' field of stats reports when previously grouped regions are ungrouped: /var/tmp/File With Spaces: Created new group with 1 region(s) as group ID 0. Removed group ID 0 on fedora-root Name GrpID RgID ObjType RgStart RgSize #Areas ArSize ProgID UserData fedora-root - 0 region 6.39g 100.00m 1 100.00m dmstats #- ^^ This is the aux_data separator character followed by empty user data. The _stats_set_aux() function should only emit the separator if there is a valid group descriptor for the region.
44 lines
1.2 KiB
Bash
44 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Copyright (C) 2023 Red Hat, Inc. All rights reserved.
|
|
#
|
|
# This copyrighted material is made available to anyone wishing to use,
|
|
# modify, copy, or redistribute it subject to the terms and conditions
|
|
# of the GNU General Public License v.2.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
SKIP_WITH_LVMPOLLD=1
|
|
SKIP_WITH_LVMLOCKD=1
|
|
|
|
. lib/inittest
|
|
|
|
# Don't attempt to test stats with driver < 4.33.00
|
|
aux driver_at_least 4 33 || skip
|
|
|
|
# ensure we can create devices (uses dmsetup, etc)
|
|
aux prepare_devs 1
|
|
|
|
GROUP_NAME="group0"
|
|
USERDATA="foo"
|
|
|
|
# Create a region and make it part of a group with an alias
|
|
dmstats create "$dev1" --userdata "$USERDATA"
|
|
dmstats group --alias "$GROUP_NAME" --regions 0 "$dev1"
|
|
dmstats list -ostats_name |& tee out
|
|
grep "$GROUP_NAME" out
|
|
dmstats list -ouserdata |& tee out
|
|
grep "$USERDATA" out
|
|
|
|
# Ungroup the regions then remove them
|
|
dmstats ungroup --groupid 0 "$dev1"
|
|
|
|
# Verify userdata is still valid
|
|
dmstats list -ouserdata |& tee out
|
|
grep "$USERDATA" out
|
|
|
|
# Clean up
|
|
dmstats delete --allregions "$dev1"
|