run_mon $dir a || return 1
ceph --format xml osd crush rule dump replicated_rule | \
- egrep '<op>take</op><item>[^<]+</item><item_name>default</item_name>' | \
+ grep -E '<op>take</op><item>[^<]+</item><item_name>default</item_name>' | \
grep '<op>choose_firstn</op><num>0</num><type>osd</type>' || return 1
local rule=rule0
local root=host1
ceph osd crush rule create-simple $rule $root $failure_domain 2>&1 | \
grep "$rule already exists" || return 1
ceph --format xml osd crush rule dump $rule | \
- egrep '<op>take</op><item>[^<]+</item><item_name>'$root'</item_name>' | \
+ grep -E '<op>take</op><item>[^<]+</item><item_name>'$root'</item_name>' | \
grep '<op>choose_firstn</op><num>0</num><type>'$failure_domain'</type>' || return 1
ceph osd crush rule rm $rule || return 1
}
ceph osd crush rule create-erasure $rule 2>&1 | \
grep "$rule already exists" || return 1
ceph --format xml osd crush rule dump $rule | \
- egrep '<op>take</op><item>[^<]+</item><item_name>default</item_name>' | \
+ grep -E '<op>take</op><item>[^<]+</item><item_name>default</item_name>' | \
grep '<op>chooseleaf_indep</op><num>0</num><type>host</type>' || return 1
ceph osd crush rule rm $rule || return 1
! ceph osd crush rule ls | grep $rule || return 1
for i in $(seq 0 120) ; do
[ $i -lt 60 ] || return 1
- matches=$(ceph pg $pg list_unfound | egrep "MOBJ0|MOBJ1" | wc -l)
+ matches=$(ceph pg $pg list_unfound | grep -E "MOBJ0|MOBJ1" | wc -l)
[ $matches -eq 2 ] && break
done
}
- ceph.healthy:
- exec:
osd.0:
- - egrep '(defer backfill|defer recovery)' /var/log/ceph/ceph-osd.*.log
+ - grep -E '(defer backfill|defer recovery)' /var/log/ceph/ceph-osd.*.log
By default, the cluster log is checked for errors and warnings,
and the run marked failed if any appear. You can ignore log
- entries by giving a list of egrep compatible regexes, i.e.:
+ entries by giving a list of grep -E compatible regexes, i.e.:
tasks:
- ceph:
"""
args = [
'sudo',
- 'egrep', pattern,
+ 'grep -E', pattern,
f'{log_dir}/ceph.log',
]
if excludes:
for exclude in excludes:
- args.extend([run.Raw('|'), 'egrep', '-v', exclude])
+ args.extend([run.Raw('|'), 'grep -E', '-v', exclude])
args.extend([
run.Raw('|'), 'head', '-n', '1',
])
rbd snap create test1@snap2
rbd clone test1@snap1 clone_v1 --rbd_default_clone_format=1
rbd clone test1@snap2 clone_v2 --rbd_default_clone_format=2
- rbd info clone_v1 | fgrep 'parent: rbd/test1@snap1'
- rbd info clone_v2 | fgrep 'parent: rbd/test1@snap2'
+ rbd info clone_v1 | grep -F 'parent: rbd/test1@snap1'
+ rbd info clone_v2 | grep -F 'parent: rbd/test1@snap2'
rbd info clone_v2 |grep 'op_features: clone-child'
test "$(rbd export clone_v1 - | md5sum)" = "${md5sum}"
test "$(rbd export clone_v2 - | md5sum)" = "${md5sum}"
test "$(rbd children test1@snap1)" = "rbd/clone_v1"
test "$(rbd children test1@snap2)" = "rbd/clone_v2"
rbd migration prepare test1 rbd2/test2
- rbd info clone_v1 | fgrep 'parent: rbd2/test2@snap1'
- rbd info clone_v2 | fgrep 'parent: rbd2/test2@snap2'
- rbd info clone_v2 | fgrep 'op_features: clone-child'
+ rbd info clone_v1 | grep -F 'parent: rbd2/test2@snap1'
+ rbd info clone_v2 | grep -F 'parent: rbd2/test2@snap2'
+ rbd info clone_v2 | grep -F 'op_features: clone-child'
test "$(rbd children rbd2/test2@snap1)" = "rbd/clone_v1"
test "$(rbd children rbd2/test2@snap2)" = "rbd/clone_v2"
rbd migration execute test1
test "$(rbd export clone_v1 - | md5sum)" = "${md5sum}"
test "$(rbd export clone_v2 - | md5sum)" = "${md5sum}"
rbd migration prepare rbd2/test2 test1
- rbd info clone_v1 | fgrep 'parent: rbd/test1@snap1'
- rbd info clone_v2 | fgrep 'parent: rbd/test1@snap2'
- rbd info clone_v2 | fgrep 'op_features: clone-child'
+ rbd info clone_v1 | grep -F 'parent: rbd/test1@snap1'
+ rbd info clone_v2 | grep -F 'parent: rbd/test1@snap2'
+ rbd info clone_v2 | grep -F 'op_features: clone-child'
test "$(rbd children test1@snap1)" = "rbd/clone_v1"
test "$(rbd children test1@snap2)" = "rbd/clone_v2"
rbd migration execute test1
rbd namespace create rbd2/ns1
test "$(ceph rbd trash purge schedule list)" = "{}"
- ceph rbd trash purge schedule status | fgrep '"scheduled": []'
+ ceph rbd trash purge schedule status | grep -F '"scheduled": []'
expect_fail rbd trash purge schedule ls
test "$(rbd trash purge schedule ls -R --format json)" = "[]"
# Initial empty check
test "$(ceph rbd trash purge schedule list)" = "{}"
- ceph rbd trash purge schedule status | fgrep '"scheduled": []'
+ ceph rbd trash purge schedule status | grep -F '"scheduled": []'
# Create 80 namespaces
for i in {1..80}; do
rbd mirror pool peer add rbd2 cluster1
test "$(ceph rbd mirror snapshot schedule list)" = "{}"
- ceph rbd mirror snapshot schedule status | fgrep '"scheduled_images": []'
+ ceph rbd mirror snapshot schedule status | grep -F '"scheduled_images": []'
expect_fail rbd mirror snapshot schedule ls
test "$(rbd mirror snapshot schedule ls -R --format json)" = "[]"
# Initial empty check
test "$(ceph rbd mirror snapshot schedule list)" = "{}"
- ceph rbd mirror snapshot schedule status | fgrep '"scheduled_images": []'
+ ceph rbd mirror snapshot schedule status | grep -F '"scheduled_images": []'
# Create 80 images
for i in {1..80}; do
test "$TOKEN_FSID" = "$(ceph fsid)"
test "$TOKEN_KEY" = "$(ceph auth get-key client.$TOKEN_CLIENT_ID)"
for addr in "${MON_ADDRS[@]}"; do
- fgrep "$addr" <<< "$TOKEN_MON_HOST"
+ grep -F "$addr" <<< "$TOKEN_MON_HOST"
done
- expect_fail fgrep "$BAD_MON_ADDR" <<< "$TOKEN_MON_HOST"
+ expect_fail grep -F "$BAD_MON_ADDR" <<< "$TOKEN_MON_HOST"
# check that the token does not change, including across pools
test "$(rbd mirror pool peer bootstrap create \
save_commit_position ${journal}
rbd bench --io-type write ${image} --io-size 4096 --io-threads 1 \
--io-total $((4096 * count)) --io-pattern seq
- rbd journal status --image ${image} | fgrep "tid=$((count - 1))"
+ rbd journal status --image ${image} | grep -F "tid=$((count - 1))"
restore_commit_position ${journal}
- rbd journal status --image ${image} | fgrep "positions=[]"
+ rbd journal status --image ${image} | grep -F "positions=[]"
local count1=$(rbd journal inspect --verbose ${journal} |
grep -c 'event_type.*AioWrite')
test "${count}" -eq "${count1}"
local POOL=$1
local IMAGE=$2
local SNAP=$3
- rbd device list | tail -n +2 | egrep "\s+$POOL\s+$IMAGE\s+$SNAP\s+" |
+ rbd device list | tail -n +2 | grep -E "\s+$POOL\s+$IMAGE\s+$SNAP\s+" |
awk '{print $1;}'
}
EOF
[[ $(rados -p rbd ls | grep -c rbd_data.$IMAGE_ID) -eq $num_objects_expected ]]
for ((i = 0; i < $num_objects_expected; i++)); do
- rados -p rbd stat rbd_data.$IMAGE_ID.$(printf %016x $i) | egrep "(size $((OBJECT_SIZE / 2)))|(size 0)"
+ rados -p rbd stat rbd_data.$IMAGE_ID.$(printf %016x $i) | grep -E "(size $((OBJECT_SIZE / 2)))|(size 0)"
done
}
}
function get_nbd_device_paths {
- rbd device list -t nbd | tail -n +2 | egrep "\s+rbd\s+testimg" | awk '{print $5;}'
+ rbd device list -t nbd | tail -n +2 | grep -E "\s+rbd\s+testimg" | awk '{print $5;}'
}
function clean_up_cryptsetup() {
set +e
- mount | fgrep ${TEMPDIR}/mnt && _sudo umount -f ${TEMPDIR}/mnt
+ mount | grep -F ${TEMPDIR}/mnt && _sudo umount -f ${TEMPDIR}/mnt
rm -Rf ${TEMPDIR}
if [ -n "${DEV}" ]
rbd_cache_invalidate="rbd cache invalidate ${pool}/${image}"
rbd_watch_start ${image}
-${ceph_admin} help | fgrep "${rbd_cache_flush}"
-${ceph_admin} help | fgrep "${rbd_cache_invalidate}"
+${ceph_admin} help | grep -F "${rbd_cache_flush}"
+${ceph_admin} help | grep -F "${rbd_cache_invalidate}"
rbd_watch_end ${image}
# test rbd cache commands with disabled and enabled cache
return False
def get_radosgw_endpoint():
- out = exec_cmd('sudo ss -nltp | egrep "rados|valgr|memcheck-"') # short for radosgw/valgrind
+ out = exec_cmd('sudo ss -nltp | grep -E "rados|valgr|memcheck-"') # short for radosgw/valgrind
x = out.decode('utf8').split(" ")
port = [i for i in x if ':' in i][0].split(':')[1]
log.info('radosgw port: %s' % port)
return False
def get_radosgw_endpoint():
- out = exec_cmd('sudo ss -nltp | egrep "rados|valgr|memcheck-"') # short for radosgw/valgrind
+ out = exec_cmd('sudo ss -nltp | grep -E "rados|valgr|memcheck-"') # short for radosgw/valgrind
x = out.decode('utf8').split(" ")
port = [i for i in x if ':' in i][0].split(':')[1]
log.info('radosgw port: %s' % port)
# extract list of monitors, mdss, osds, mgrs defined in startup.conf
allconf=$(for entity in \
$local \
- `$CCONF -c $conf -l mon | egrep -v '^mon$' || true` \
- `$CCONF -c $conf -l mds | egrep -v '^mds$' || true` \
- `$CCONF -c $conf -l mgr | egrep -v '^mgr$' || true` \
- `$CCONF -c $conf -l osd | egrep -v '^osd$' || true`; do
+ `$CCONF -c $conf -l mon | grep -E -v '^mon$' || true` \
+ `$CCONF -c $conf -l mds | grep -E -v '^mds$' || true` \
+ `$CCONF -c $conf -l mgr | grep -E -v '^mgr$' || true` \
+ `$CCONF -c $conf -l osd | grep -E -v '^osd$' || true`; do
echo $entity
done | sort -u)
done
;;
*)
- if ! echo " " $allconf $local " " | egrep -q "( $type$id | $type.$id )"; then
+ if ! echo " " $allconf $local " " | grep -E -q "( $type$id | $type.$id )"; then
echo "$0: $type.$id not found ($conf defines" $allconf", /var/lib/ceph defines" $local")"
exit 1
fi
do_root_cmd_okfail "mkdir -p $fs_path"
if [ "$fs_type" = "btrfs" ]; then
echo Mounting Btrfs on $host:$fs_path
- do_root_cmd_okfail "modprobe btrfs ; btrfs device scan || btrfsctl -a ; egrep -q '^[^ ]+ $fs_path ' /proc/mounts && umount $fs_path ; mount -t btrfs $fs_opt $first_dev $fs_path"
+ do_root_cmd_okfail "modprobe btrfs ; btrfs device scan || btrfsctl -a ; grep -E -q '^[^ ]+ $fs_path ' /proc/mounts && umount $fs_path ; mount -t btrfs $fs_opt $first_dev $fs_path"
else
echo Mounting $fs_type on $host:$fs_path
- do_root_cmd_okfail "modprobe $fs_type ; egrep -q '^[^ ]+ $fs_path ' /proc/mounts && umount $fs_path ; mount -t $fs_type $fs_opt $first_dev $fs_path"
+ do_root_cmd_okfail "modprobe $fs_type ; grep -E -q '^[^ ]+ $fs_path ' /proc/mounts && umount $fs_path ; mount -t $fs_type $fs_opt $first_dev $fs_path"
fi
if [ "$ERR" != "0" ]; then
EXIT_STATUS=$ERR
# check for locators (w/o namespace); we identify them by skipping
# past the empty namespace (i.e., one TAB), skipping past the oid,
- # then looking for a TAB; note we use egrep to get the '+' character
+ # then looking for a TAB; note we use grep -E to get the '+' character
# and the $ in front of the ' allows the \t to be interpreted as a TAB
log "Checking for locators"
- egrep --text $'^\t[[:graph:]]+\t' "$rados_out" >>"$rados_odd"
+ grep -E --text $'^\t[[:graph:]]+\t' "$rados_out" >>"$rados_odd"
if [ "${PIPESTATUS[0]}" -eq 0 ] ;then
log "Locator found"
locator_found=1