Added bandwidth limiter.

This commit is contained in:
Otho 2023-01-09 01:35:38 -05:00
parent 706aab7d4f
commit 4da22952cb
Signed by: Otho
GPG Key ID: 16C720CD3BBE21D9

View File

@ -21,6 +21,7 @@ ZFS_SEND_OPTS="-vpRLe"
ZFS_SNAPSHOT_OPTS="-r"
ZFS_RECV_OPTS="-svu"
SSH_SEND_OPTS="-Ti ~/.ssh/id_rsa"
BANDWIDTH_LIMIT="100M"
read LOCAL_HOST LOCAL_USER LOCAL_PORT LOCAL_TZ SEND_COMPRESSED < $nodes_file
case $SEND_COMPRESSED in
@ -163,13 +164,15 @@ send_latest()
origin_snapshot=`get_latest_snapshot $dataset`
if [ $BG_TEST_MODE = "TRUE" ]; then
echo zfs send $ZFS_SEND_OPTS $dataset@$origin_snapshot \| \
ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr \
zfs recv $ZFS_RECV_OPTS $zroot$dataset
pv -qL $BANDWIDTH_LIMIT \| \
ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr \
zfs recv $ZFS_RECV_OPTS $zroot$dataset
else
zfs send $ZFS_SEND_OPTS $dataset@$origin_snapshot |
ssh $SSH_SEND_OPTS -o port=$ssh_port \
$user@$addr \
zfs recv $ZFS_RECV_OPTS $zroot$dataset
pv -qL $BANDWIDTH_LIMIT |
ssh $SSH_SEND_OPTS -o port=$ssh_port \
$user@$addr \
zfs recv $ZFS_RECV_OPTS $zroot$dataset
fi
done
done < sendnodes.tmp
@ -192,14 +195,16 @@ send_increment()
echo zfs send $ZFS_SEND_OPTS \
-i $dataset@$remote_snapshot \
$dataset@$origin_snapshot \| \
ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr \
zfs recv $ZFS_RECV_OPTS $zroot$dataset
pv -qL $BANDWIDTH_LIMIT \| \
ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr \
zfs recv $ZFS_RECV_OPTS $zroot$dataset
else
zfs send $ZFS_SEND_OPTS \
-i $dataset@$remote_snapshot \
$dataset@$origin_snapshot |
ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr \
zfs recv $ZFS_RECV_OPTS $zroot$dataset
pv -qL $BANDWIDTH_LIMIT |
ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr \
zfs recv $ZFS_RECV_OPTS $zroot$dataset
fi
done
done < sendnodes.tmp