Skip to content

Instantly share code, notes, and snippets.

View dosaboy's full-sized avatar

Edward Hope-Morley dosaboy

View GitHub Profile
#!/bin/bash -eux
#
# Test for SRU of https://bugs.launchpad.net/os-brick/+bug/1524989
#
#!/bin/bash -eux
read -aVMS<<<`nova list| awk '$6=="ACTIVE" {print $2}'`
NUM=${#VMS[@]}
for ((i=0;i<$NUM;i++)); do
for ((j=0;j<5;j++)); do
((`cinder list| grep vm${i}-vol| wc -l` < 5)) || break
#!/bin/bash -eu
#
# Given an rbd volume id and a pool, display its OSD map.
#
(($#>1)) || { echo "USAGE: `basename $0` <pool> <rbdimage>"; exit 1; }
pool=$1
rbdimage=$2
poolnum=`ceph osd dump| grep $pool| awk '{print $2}'`
obj=$(rados -p $pool ls| grep `rbd -p $pool info $rbdimage| grep block_name_prefix:| sed 's/\sblock_name_prefix\://g'| tr -d ' '`| tail -n 4|head -n1)
ceph osd getmap > /tmp/osd.map
#!/bin/bash -eu
#
# Authors:
# [email protected]
#
# Given an osd path, this script will display:
# * pg object info such as largest/smallest object in a pg
# * osd pg filesytem usage such as smallest/largest pg in an osd
#
OSD_DIR=$1
#!/bin/bash -eux
# Backup juju agent.conf on all machines
cat << 'EOF' > /tmp/backup-agents.sh
jujuagents=/var/lib/juju/agents
backup_dir=/var/lib/juju/agents_backups
for d in $(find $jujuagents -name 'agent.conf' -printf '%P\0' | xargs -0 -n1 dirname)
do
sudo mkdir -p ${backup_dir}/${d}
sudo cp ${jujuagents}/${d}/agent.conf ${backup_dir}/${d}/
done
#!/bin/bash -eu
# THE FOLLOWING PROCEDURE TO REFORMAT AN OSD AND ITS JOURNAL HAS BEEN TESTED
# ON UBUNTU TRUSTY WITH CEPH 0.94.8-0ubuntu0.15.04.1~cloud0 FROM KILO UCA.
OSD_ID=48
OSD=osd.$OSD_ID
BLK_DEV=/dev/vdb
JOURNAL_UUID=`cat /var/lib/ceph/osd/ceph-$OSD_ID/journal_uuid`
@dosaboy
dosaboy / os_upgrade.py
Last active March 29, 2017 14:42
Juju 2.x Openstack Charms Action Managed Upgrade Tool
#!/usr/bin/env python2
# Author: Edward Hope-Morley ([email protected])
# Description: Juju 2.x Openstack Charms Action Managed Upgrade Tool.
# Copyright (C) 2017 Edward Hope-Morley
#
# License:
#
# os_upgrade.py is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#!/bin/bash -eu
# Author: Edward Hope-Morley ([email protected])
# Description: Swift Object Store Ring Checker Tool
# Copyright (C) 2017-2018 Edward Hope-Morley
#
# License:
#
# swift-ring-checker is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#!/bin/bash -u
# Author: [email protected]
# Origin: https://gist.github.com/dosaboy
# Description:
# Runs pylint recursively (defaults to warning only)
#
# Requires: pylint
#
# Text Format
CSI='\033['
#!/bin/bash -eu
sudo apt-get update
sudo apt-get install python-pip
sudo pip install pbr
PKGS=(
build-essential
python-dev
git-core
pkg-config
libssl-dev
read -a socks<<<`netstat -planex | grep apache | grep ACC| awk '{print $10}'`; for s in ${socks[@]}; do
echo -n "Queue $s backlog is: "
netstat -pane| grep $s| grep CONN| wc -l
echo "Queue $s has listeners:"
lsof $s
done