deep_scrub_choked

This commit is contained in:
a.pivkin
2026-04-06 07:08:17 +03:00
commit 9149dc1d7f
840 changed files with 52471 additions and 0 deletions
+96
View File
@@ -0,0 +1,96 @@
#!/usr/bin/env bash
set -e
shopt -s extglob # enable extended pattern matching features
#############
# VARIABLES #
#############
stable_branch=$1
commit=$2
bkp_branch_name=$3
bkp_branch_name_prefix=bkp
bkp_branch=$bkp_branch_name-$bkp_branch_name_prefix-$stable_branch
#############
# FUNCTIONS #
#############
verify_commit () {
for com in ${commit//,/ }; do
if [[ $(git cat-file -t "$com" 2>/dev/null) != commit ]]; then
echo "$com does not exist in your tree"
echo "Run 'git fetch origin main && git pull origin main'"
exit 1
fi
done
}
git_status () {
if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
echo "It looks like you have not committed changes:"
echo ""
git status --short
echo ""
echo ""
echo "Press ENTER to continue or Ctrl+c to break."
read -r
fi
}
checkout () {
git checkout --no-track -b "$bkp_branch" origin/"$stable_branch"
}
cherry_pick () {
local x
for com in ${commit//,/ }; do
x="$x $com"
done
# Trim the first white space and use an array
# Reference: https://github.com/koalaman/shellcheck/wiki/SC2086#exceptions
x=(${x##*( )})
git cherry-pick -x -s "${x[@]}"
}
push () {
git push origin "$bkp_branch"
}
create_pr () {
hub pull-request -h ceph/ceph-ansible:"$bkp_branch" -b "$stable_branch" -F -
}
cleanup () {
echo "Moving back to previous branch"
git checkout -
git branch -D "$bkp_branch"
}
test_args () {
if [ $# -lt 3 ]; then
echo "Please run the script like this: ./contrib/backport_to_stable_branch.sh STABLE_BRANCH_NAME COMMIT_SHA1 BACKPORT_BRANCH_NAME"
echo "We accept multiple commits as soon as they are commas-separated."
echo "e.g: ./contrib/backport_to_stable_branch.sh stable-2.2 6892670d317698771be7e96ce9032bc27d3fd1e5,8756c553cc8c213fc4996fc5202c7b687eb645a3 my-work"
exit 1
fi
}
########
# MAIN #
########
test_args "$@"
git_status
verify_commit
checkout
cherry_pick
push
create_pr <<MSG
${4} Backport of ${3} in $stable_branch
Backport of #${3} in $stable_branch
MSG
cleanup
+105
View File
@@ -0,0 +1,105 @@
#!/bin/bash
set -xe
# VARIABLES
BASEDIR=$(dirname "$0")
LOCAL_BRANCH=$(cd $BASEDIR && git rev-parse --abbrev-ref HEAD)
ROLES="ceph-common ceph-mon ceph-osd ceph-mds ceph-rgw ceph-fetch-keys ceph-rbd-mirror ceph-client ceph-container-common ceph-mgr ceph-defaults ceph-config"
# FUNCTIONS
function goto_basedir {
TOP_LEVEL=$(cd $BASEDIR && git rev-parse --show-toplevel)
if [[ "$(pwd)" != "$TOP_LEVEL" ]]; then
pushd "$TOP_LEVEL"
fi
}
function check_existing_remote {
if ! git remote show "$1" &> /dev/null; then
git remote add "$1" git@github.com:/ceph/ansible-"$1".git
fi
}
function pull_origin {
git pull origin main
}
function reset_hard_origin {
# let's bring everything back to normal
git checkout "$LOCAL_BRANCH"
git fetch origin --prune
git fetch --tags
git reset --hard origin/main
}
function check_git_status {
if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
echo "It looks like the following changes haven't been committed yet"
echo ""
git status --short
echo ""
echo ""
echo "Do you really want to continue?"
echo "Press ENTER to continue or CTRL C to break"
read -r
fi
}
function compare_tags {
# compare local tags (from https://github.com/ceph/ceph-ansible/) with distant tags (from https://github.com/ceph/ansible-ceph-$ROLE)
local tag_local
local tag_remote
for tag_local in $(git tag | grep -oE '^v[2-9].[0-9]*.[0-9]*$' | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n); do
tags_array+=("$tag_local")
done
for tag_remote in $(git ls-remote --tags "$1" | grep -oE 'v[2-9].[0-9]*.[0-9]*$' | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n); do
remote_tags_array+=("$tag_remote")
done
for i in "${tags_array[@]}"; do
skip=
for j in "${remote_tags_array[@]}"; do
[[ "$i" == "$j" ]] && { skip=1; break; }
done
[[ -n $skip ]] || tag_to_apply+=("$i")
done
}
# MAIN
goto_basedir
check_git_status
trap reset_hard_origin EXIT
trap reset_hard_origin ERR
pull_origin
for ROLE in $ROLES; do
# For readability we use 2 variables with the same content
# so we always make sure we 'push' to a remote and 'filter' a role
REMOTE=$ROLE
check_existing_remote "$REMOTE"
reset_hard_origin
# First we filter branches by rewriting main with the content of roles/$ROLE
# this gives us a new commit history
for BRANCH in $(git branch --list --remotes "origin/stable-*" "origin/main" "origin/ansible-1.9" | cut -d '/' -f2); do
git checkout -B "$BRANCH" origin/"$BRANCH"
# use || true to avoid exiting in case of 'Found nothing to rewrite'
git filter-branch -f --prune-empty --subdirectory-filter roles/"$ROLE" || true
git push -f "$REMOTE" "$BRANCH"
done
reset_hard_origin
# then we filter tags starting from version 2.0 and push them
compare_tags "$ROLE"
if [[ ${#tag_to_apply[@]} == 0 ]]; then
echo "No new tag to push."
continue
fi
for TAG in "${tag_to_apply[@]}"; do
# use || true to avoid exiting in case of 'Found nothing to rewrite'
git filter-branch -f --prune-empty --subdirectory-filter roles/"$ROLE" "$TAG" || true
git push -f "$REMOTE" "$TAG"
reset_hard_origin
done
done
trap - EXIT ERR
popd &> /dev/null
+44
View File
@@ -0,0 +1,44 @@
#Package lines can be commented out with '#'
#
#boost-atomic
#boost-chrono
#boost-date-time
#boost-iostreams
#boost-program
#boost-random
#boost-regex
#boost-system
#boost-thread
#bzip2-libs
#cyrus-sasl-lib
#expat
#fcgi
#fuse-libs
#glibc
#keyutils-libs
#leveldb
#libaio
#libatomic_ops
#libattr
#libblkid
#libcap
#libcom_err
#libcurl
#libgcc
#libicu
#libidn
#libnghttp2
#libpsl
#libselinux
#libssh2
#libstdc++
#libunistring
#nss-softokn-freebl
#openldap
#openssl-libs
#pcre
#python-nose
#python-sphinx
#snappy
#systemd-libs
#zlib
+27
View File
@@ -0,0 +1,27 @@
#!/bin/bash -e
#
# Copyright (C) 2014, 2015 Red Hat <contact@redhat.com>
#
# Author: Daniel Lin <danielin@umich.edu>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
if test -f /etc/redhat-release ; then
PACKAGE_INSTALLER=yum
elif type apt-get > /dev/null 2>&1 ; then
PACKAGE_INSTALLER=apt-get
else
echo "ERROR: Package Installer could not be determined"
exit 1
fi
while read p; do
if [[ $p =~ ^#.* ]] ; then
continue
fi
$PACKAGE_INSTALLER install $p -y
done < $1
+73
View File
@@ -0,0 +1,73 @@
#!/bin/bash
create_snapshots() {
local pattern=$1
for vm in $(sudo virsh list --all | awk "/${pattern}/{print \$2}"); do
sudo virsh shutdown "${vm}"
wait_for_shutoff "${vm}"
sudo virsh snapshot-create "${vm}"
sudo virsh start "${vm}"
done
}
delete_snapshots() {
local pattern=$1
for vm in $(sudo virsh list --all | awk "/${pattern}/{print \$2}"); do
for snapshot in $(sudo virsh snapshot-list "${vm}" --name); do
echo "deleting snapshot ${snapshot} (vm: ${vm})"
sudo virsh snapshot-delete "${vm}" "${snapshot}"
done
done
}
revert_snapshots() {
local pattern=$1
for vm in $(sudo virsh list --all | awk "/${pattern}/{print \$2}"); do
echo "restoring last snapshot for ${vm}"
sudo virsh snapshot-revert "${vm}" --current
sudo virsh start "${vm}"
done
}
wait_for_shutoff() {
local vm=$1
local retries=60
local delay=2
until test "${retries}" -eq 0
do
echo "waiting for ${vm} to be shut off... #${retries}"
sleep "${delay}"
let "retries=$retries-1"
local current_state=$(sudo virsh domstate "${vm}")
test "${current_state}" == "shut off" && return
done
echo couldnt shutoff "${vm}"
exit 1
}
while :; do
case $1 in
-d|--delete)
delete_snapshots "$2"
exit
;;
-i|--interactive)
INTERACTIVE=TRUE
;;
-s|--snapshot)
create_snapshots "$2"
;;
-r|--revert)
revert_snapshots "$2"
;;
--)
shift
break
;;
*)
break
esac
shift
done
+30
View File
@@ -0,0 +1,30 @@
---
# DEPLOY CONTAINERIZED DAEMONS
docker: true
# DEFINE THE NUMBER OF VMS TO RUN
mon_vms: 1
osd_vms: 1
mds_vms: 0
rgw_vms: 0
nfs_vms: 0
rbd_mirror_vms: 0
client_vms: 0
mgr_vms: 0
# SUBNETS TO USE FOR THE VMS
public_subnet: 192.168.0
cluster_subnet: 192.168.1
# MEMORY
memory: 1024
disks: [ '/dev/sda', '/dev/sdb' ]
eth: 'enp0s8'
vagrant_box: centos/atomic-host
# The sync directory changes based on vagrant box
# Set to /home/vagrant/sync for Centos/7, /home/{ user }/vagrant for openstack and defaults to /vagrant
vagrant_sync_dir: /home/vagrant/sync
skip_tags: 'with_pkg'
+36
View File
@@ -0,0 +1,36 @@
---
vagrant_box: 'linode'
vagrant_box_url: 'https://github.com/displague/vagrant-linode/raw/master/box/linode.box'
# Set a label prefix for the machines in this cluster. (This is useful and necessary when running multiple clusters concurrently.)
#label_prefix: 'foo'
ssh_username: 'vagrant'
ssh_private_key_path: '~/.ssh/id_rsa'
cloud_distribution: 'CentOS 7'
cloud_datacenter: 'newark'
# Memory for each Linode instance, this determines price! See Linode plans.
memory: 2048
# The private network on Linode, you probably don't want to change this.
public_subnet: 192.168.0
cluster_subnet: 192.168.0
# DEFINE THE NUMBER OF VMS TO RUN
mon_vms: 3
osd_vms: 3
mds_vms: 1
rgw_vms: 0
nfs_vms: 0
rbd_mirror_vms: 0
client_vms: 0
# The sync directory changes based on vagrant box
# Set to /home/vagrant/sync for Centos/7, /home/{ user }/vagrant for openstack and defaults to /vagrant
# vagrant_sync_dir: /home/vagrant/sync
os_tuning_params:
- { name: fs.file-max, value: 26234859 }
+49
View File
@@ -0,0 +1,49 @@
---
# DEPLOY CONTAINERIZED DAEMONS
docker: true
# DEFINE THE NUMBER OF VMS TO RUN
mon_vms: 1
osd_vms: 1
mds_vms: 0
rgw_vms: 0
nfs_vms: 0
rbd_mirror_vms: 0
client_vms: 0
# SUBNET TO USE FOR THE VMS
# Use whatever private subnet your Openstack VMs are given
public_subnet: 172.17.72
cluster_subnet: 172.17.72
# For Openstack VMs, the disk will depend on what you are allocated
disks: [ '/dev/vdb' ]
# For Openstack VMs, the lan is usually eth0
eth: 'eth0'
# For Openstack VMs, choose the following box instead
vagrant_box: 'openstack'
# When using Atomic Hosts (RHEL or CentOS), uncomment the line below to skip package installation
#skip_tags: 'with_pkg'
# Set a label prefix for the machines in this cluster to differentiate
# between different concurrent clusters e.g. your OpenStack username
label_prefix: 'your-openstack-username'
# For deploying on OpenStack VMs uncomment these vars and assign values.
# You can use env vars for the values if it makes sense.
#ssh_username :
#ssh_private_key_path :
#os_openstack_auth_url :
#os_username :
#os_password :
#os_tenant_name :
#os_region :
#os_flavor :
#os_image :
#os_keypair_name :
#os_networks :
#os_floating_ip_pool :