Skip to content

Instantly share code, notes, and snippets.

View jcpowermac's full-sized avatar

Joseph Callen jcpowermac

  • Red Hat
  • Paw Paw, Michigan
View GitHub Profile
@jcpowermac
jcpowermac / map.sh
Last active December 27, 2015 18:39
#!/bin/bash
#http://docs.openstack.org/network-admin/admin/content/figures/2/figures/under-the-hood-scenario-2-ovs-compute.png
#http://www.markhneedham.com/blog/2013/06/26/unixawk-extracting-substring-using-a-regular-expression-with-capture-groups/
ACTIVE_INSTANCE_IDS=`nova list --all-tenants | grep ACTIVE | awk '{print $2}'`
length=115
printf -v line '%*s' "$length"
echo ${line// /-}
@jcpowermac
jcpowermac / map.py
Last active December 28, 2015 02:59
OpenStack: Interfaces for instance connectivity from tap to ovsbridge.
#Sources:
# http://effbot.org/zone/element-xpath.htm
# http://eli.thegreenplace.net/2012/03/15/processing-xml-in-python-with-elementtree/
# http://wiki.libvirt.org/page/SSHSetup
# http://docs.python.org/2/tutorial/datastructures.html#dictionaries
# http://libvirt.org/git/?p=libvirt.git;a=blob;f=tools/virsh-domain-monitor.c
# http://www.linuxproblem.org/art_9.html
# http://j2labs.tumblr.com/post/4477180133/ssh-with-pythons-paramiko
__author__ = 'jcallen'
@jcpowermac
jcpowermac / map_router.py
Last active December 28, 2015 08:09
Extension of the map.py, adds locating the router_id to quickly find the namespace. Usage: /usr/bin/python2.7 /home/jcallen/PycharmProjects/map/map.py --hostname 10.53.253.70 --os-username admin --os-password foo --os-tenant-name admin --username foouser --priv-key /home/foouser.ssh/id_rsa
#Sources:
# http://effbot.org/zone/element-xpath.htm
# http://eli.thegreenplace.net/2012/03/15/processing-xml-in-python-with-elementtree/
# http://wiki.libvirt.org/page/SSHSetup
# http://docs.python.org/2/tutorial/datastructures.html#dictionaries
# http://libvirt.org/git/?p=libvirt.git;a=blob;f=tools/virsh-domain-monitor.c
# http://www.linuxproblem.org/art_9.html
# http://j2labs.tumblr.com/post/4477180133/ssh-with-pythons-paramiko
__author__ = 'jcallen'
@jcpowermac
jcpowermac / esxtop.sh
Created December 11, 2013 17:32
esxtop starts new every five minutes
#!/bin/sh
# Each run is 5 minutes
j=18
for i in `seq $j` ; do
let min=$i*5;echo "New esxtop is running - Total $min minutes";esxtop -a -b -d 2 -n 150 | gzip -9c > `hostname -s`-`date +"%Y%m%d-%H%M%S"`.csv.gz;
done
@jcpowermac
jcpowermac / detached.sh
Created December 11, 2013 17:34
Detached LUN Fix
naa=`esxcli storage core device detached list | awk 'NR > 2 {print $1}'`
for n in $naa ; do
`esxcli storage core device detached remove -d $n`
done
@jcpowermac
jcpowermac / replica_lock.txt
Created December 11, 2013 17:36
Replica lock
2013-01-08T20:14:02.132Z cpu24:5867805)DLX: 3901: vol 'View-Replica-31': [Req mode: 2] Not free; Lock [PhoenixDTaaS:type 10c00001 offset 216922112 v 1179, hb offset 319897
gen 619, mode 1, owner 508951c0-5359e3be-36b6-0025b5020a0e mtime 12190974 nHld 0 nOvf 0]
2013-01-08T20:14:02.435Z cpu24:5867805)DLX: 3394: vol 'View-Replica-31': PhoenixDTaaS:Req mode 2 Checking liveness of [PhoenixDTaaS:type 10c00001 offset 216922112 v 1179, hb offset 3
gen 619, mode 1, owner 508951c0-5359e3be-36b6-0025b5020a0e mtime 12190974 nHld 0 nOvf 0]
#!/bin/sh
path=/vmfs/volumes/View-Replica-31/replica-3faf9959-a2e8-4a8a-9dde-908577cb73a2/
@jcpowermac
jcpowermac / fixdvsbug.ps1
Created December 11, 2013 17:44
vSphere 5.0 DVS port issue
function Set-PortIdAdvanced {
Param([object] $VmView, [object] $PortId )
$netdev = ($VmView.Config.Hardware.Device | Where {$_.MacAddress})
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.deviceChange = New-Object VMware.Vim.VirtualDeviceConfigSpec[] (1)
$spec.deviceChange[0] = New-Object VMware.Vim.VirtualDeviceConfigSpec
$spec.deviceChange[0].operation = "edit"
@jcpowermac
jcpowermac / powerpath_check.ps1
Created December 11, 2013 18:43
PowerPath for vSphere check
### SCRIPT TO CHECK PATHS ON VDI CLUSTER ###
Get-Vmhost | % {
$vmhostname = $_.Name.ToString().split('.')[0];
rpowermt display host=$vmhostname dev=all >> c:\emc\ppve\vdi.txt
}
@jcpowermac
jcpowermac / powerpath_license.ps1
Created December 11, 2013 18:43
Add PowerPath License
### SCRIPT TO ADD POWERPATH LICENSES TO VDI HOSTS ####
Get-Vmhost | % {
rpowermt setup add_host host=$_ username=root password=
rpowermt register host=$_
$vmhostname = $_.Name.ToString().split('.')[0];
rpowermt check_registration host=$vmhostname
}
### END ###
@jcpowermac
jcpowermac / pci_passthru.ps1
Created December 11, 2013 18:46
vSphere ESXi PCI Passthru
$vmhosts = Get-VMHost
foreach( $vmhost in $vmhosts )
{
$hcv = $vmhost | Get-View | Select Config
$hcmv = $vmhost | Get-View | Select ConfigManager
$pci = Get-View -Id $hcmv.ConfigManager.PciPassthruSystem
$pci.Refresh();