Skip to content

Instantly share code, notes, and snippets.

@jshen28
jshen28 / build-swtpm.sh
Created July 2, 2023 02:06 — forked from Jacobboogiebear/build-swtpm.sh
A quick script to build swtpm and libtpm on Ubuntu 20.04 (created for WSL2 and WSLg)
sudo apt-get install git g++ gcc automake autoconf libtool make gcc libc-dev libssl-dev pkg-config libtasn1-6-dev libjson-glib-dev expect gawk socat libseccomp-dev -y
cd ~
git clone https://github.com/stefanberger/swtpm.git
git clone https://github.com/stefanberger/libtpms.git
cd libtpms
./autogen.sh --prefix=/usr --with-tpm2 --with-openssl
make
sudo make install
cd ../swtpm
./autogen.sh --prefix=/usr
# from a directory with some stuff 
# but still want to push to an existing repository
git init
git add -A
git commit -m "some rants"

git remote add origin <origin url>
git pull orgin <branch> --allow-unrelated-histories
@jshen28
jshen28 / netlink_demo.c
Created May 21, 2022 23:23 — forked from supermartian/netlink_demo.c
Netlink programming demo.

Simple vsock setup for QEMU

Configuration

Host Kernel: rawhide 4.13.0-0.rc6.git4.2.fc28.x86_64 (on Fedora 24)

QEMU is mainline built from sources: QEMU emulator version 2.10.50 (v2.10.0-105-g223cd0e)

Guest: clear-17460-kvm.img (which has vsock support)

@jshen28
jshen28 / ovs-cheat.md
Last active April 21, 2021 08:14 — forked from djoreilly/ovs-cheat.md
OVS cheat sheet

CTL

ovs-vsctl list open_vswitch
ovs-vsctl list interface
ovs-vsctl --columns=ofport,name list Interface
ovs-vsctl --columns=ofport,name --format=table list Interface
ovs-vsctl --format=table --columns=name,mac_in_use find Interface name=br-dpdk1
ovs-vsctl get interface vhub656c3cb-23 name/ofport

Overview

For those that are unfamiliar with the project, PyPy is an implementation of the Python language that features a JIT Compiler. I have noticed a huge performance benefit in some personal projects by switching to PyPy. I have always been curious how it would perform on a large and complex project like OpenStack, but my early experiments ran into massive roadblocks around broken dependencies.

It has been six months since I last looked, so I figured it was time to try it again. Support has come a long way and, now that lxml is working, we are close enough to get a Proof-of-Concept running. Read on for instructions on running nova with PyPy.

Preparation

Start out with a base ubuntu 12.04 (precise) install and run devstack. I won't go through the details of getting devstack running here, because there are already instructions on the devstack site.

6ee73781-6d8c-40f7-b953-ecf30f4a3309] Failed to build and run instance: libvirt.libvirtError: internal error: Process exited prior to exec: libvirt:  error : Unable to move /dev/termination-log mount to /run/libvirt/qemu/631-instance-0000c3a2.termination-log: Permission denied
2021-03-17 04:19:59.124 1255432 ERROR nova.compute.manager [instance: 6ee73781-6d8c-40f7-b953-ecf30f4a3309] Traceback (most recent call last):
2021-03-17 04:19:59.124 1255432 ERROR nova.compute.manager [instance: 6ee73781-6d8c-40f7-b953-ecf30f4a3309]   File "/var/lib/openstack/lib/python3.8/site-packages/nova/compute/manager.py", line 2394, in _build_and_run_instance
2021-03-17 04:19:59.124 1255432 ERROR nova.compute.manager [instance: 6ee73781-6d8c-40f7-b953-ecf30f4a3309]     self.driver.spawn(context, instance, image_meta,
2021-03-17 04:19:59.124 1255432 ERROR nova.compute.manager [instance: 6ee73781-6d8c-40f7-b953-ecf30f4a3309]   File "/var/lib/openstack/lib/python3.8/site-packages/nova/virt/libvirt/driver.py", line 3753, in s
@jshen28
jshen28 / route_dump.c
Created June 7, 2020 10:11 — forked from cl4u2/route_dump.c
Linux route monitoring example
/*
iflist.c : retrieve network interface information thru netlink sockets
(c) Jean Lorchat @ Internet Initiative Japan - Innovation Institute
v1.0 : initial version - Feb 19th 2010
This file was obtained at the following address :
http://www.iijlab.net/~jean/iflist.c
@jshen28
jshen28 / route_dump.c
Created June 7, 2020 10:11 — forked from cl4u2/route_dump.c
Linux route monitoring example
/*
iflist.c : retrieve network interface information thru netlink sockets
(c) Jean Lorchat @ Internet Initiative Japan - Innovation Institute
v1.0 : initial version - Feb 19th 2010
This file was obtained at the following address :
http://www.iijlab.net/~jean/iflist.c
ISO_FILE ?= ubuntu.iso
VM_NAME ?= vm06
PATH_TO_HDD ?= $(PWD)/$(VM_NAME).qcow2
.PHONY: mkiso
run: $(VM_NAME).qcow2
/usr/bin/qemu-system-x86_64 \
-m 1024 \
-vnc 0.0.0.0:41 \