Skip to content

Instantly share code, notes, and snippets.

View smurugap's full-sized avatar

Senthilnathan Murugappan smurugap

View GitHub Profile
fab -Rcompute -- "for core in \$(ls /var/crashes); do gdb /root/contrail-vrouter-agent /var/crashes/\$core -ex 'bt' --batch; done"
1) From VM to the Vrf of the VN (only first pkt would be punted to create flow table entry)
2) From VN VRF to ip-fabric VRF (sent via vhost0 with dst port as the proxy service port(which is 51819 in our case))
3) Agent would receive the packet and change the src/dst ip/port and forward it out
4) Reply would be received back by the same proxy service hosted in agent
5) Agent would again change back the 4 tuples and send it in vhost0
6) vrouter would receive the same in fabric-vrf and do the reverse flow lookup
sshpass -p c0ntrail123 ssh -T -N -L 8085:localhost:8085 99.1.1.11 -g -l root
ssh -L 9143:10.2.4.27:8143 root@10.87.74.74
from lxml import etree
class XmlDrv(object):
def load(self, url):
return etree.fromstring(requests.get(url).text)
class inspect(object):
def __init__(self, ip, port, drv=XmlDrv, **kwargs):
super(inspect, self).__init__()
self.ip = ip
find . -name '*.py' -printf "%T+\t%p\n" | sort
sudo -u contrail jmap -histo:live <pid>
Source: https://albertomolina.wordpress.com/2016/12/02/shrinking-qcow2-images/
virt-df -h image.raw
Filesystem Size Used Available Use%
image.raw:/dev/sda1 1.9G 1020M 837M 52%
guestfish
><fs> add image.raw
><fs> run
><fs> list-filesystems
Execute backdoor script to set password auth:
./backdoor-image --user msenthil --password contrail123 --password-auth xenial-server-cloudimg-amd64-disk1.img
moved to https://gist.github.com/smoser/8c65b8771d5ab1d99c44c285323dfff6
Install packages:
# yum install -y libguestfs-tools qemu-img
Create the target image
# qemu-img create -f qcow2 target.qcow2 256G
Expand the new image and resize the partitions
# virt-resize --expand /dev/sda1 ubuntu.qcow2 target.qcow2
If CentOS, do xfs_growfs inside the VM after boot
@smurugap
smurugap / Remote python debugging
Last active February 1, 2018 22:36
Remote python debugging
#pip install remote_pdb
import remote_pdb
remote_pdb.set_trace() # you'll see the port number in the logs
remote_pdb.RemotePdb('127.0.0.1', 4444).set_trace()