Skip to content

Instantly share code, notes, and snippets.

View mikemccracken's full-sized avatar

Michael McCracken mikemccracken

View GitHub Profile
@mikemccracken
mikemccracken / gist:7749fd18bfc2cd561761
Created May 22, 2014 20:18
HOWTO run cloud installer with juju debug level set
make install-dependencies
make deb
sudo dpkg -i ../cloud-installer*deb
sudo dpkg -i ../cloud-install-single*deb
sudo apt-get -yy install -f
# cloud-install -i does everything but run cloud-status
sudo cloud-install -i
@mikemccracken
mikemccracken / setup-virtual-maas-nodes.py
Last active August 29, 2015 14:04
Quick script to discover virsh nodes named 'maas-node-*' and slurp them into maas.
#!/usr/bin/python
from __future__ import unicode_literals
import getpass
import libvirt
import urllib2
import gzip
import json
import StringIO
@mikemccracken
mikemccracken / gist:8c1228668d71a2fea99f
Created July 20, 2014 20:45
Errors building whalesong with Racket 6.0
% make
raco planet link dyoo whalesong.plt 1 19 .
racket make-launcher.rkt
raco setup --no-docs -P dyoo whalesong.plt 1 19
raco setup: version: 6.0.1 [3m]
raco setup: installation name: 6.0.1
raco setup: variants: 3m
raco setup: main collects: /Users/mmccrack/Source/Racket v6.0.1/collects
raco setup: collects paths:
raco setup: /Users/mmccrack/Library/Racket/6.0.1/collects
@mikemccracken
mikemccracken / make-launcher.rkt
Created July 20, 2014 20:47
whalesong make-launcher.rkt that works with 6.0
#lang racket/base
(require launcher/launcher)
(require racket/runtime-path)
(define-runtime-path whalesong-path "whalesong.rkt")
(define-runtime-path whalesong-gui-path "whalesong-gui.rkt")
(make-racket-launcher (list (path->string whalesong-path))
"whalesong"
git clone https://github.com/Ubuntu-Solutions-Engineering/openstack-installer
cd openstack-installer
sudo make install-dependencies
sudo make install
USE_LXC_IMAGE_CACHE=1 sudo -E openstack-install
@mikemccracken
mikemccracken / swap-sync-charm.sh
Last active August 29, 2015 14:15
a script to swap out the glance-simplestreams-sync charm and deploy a new one
#!/bin/bash
# TO use this to TEST:
# 1. run cloud-installer and wait until everything is up, including letting the default charm pull down an image (or an error if you require proxies)
# 2. connect to the install host (multi) or top container (single)
# 3. juju ssh nova-cloud-controller/0
# 3a. source /tmp/openstack-admin*
# 3b. glance image-list (there should be one or zero)
# 3c. if there's an image, glance image-delete <that image's ID>
# 4. clone this script on the juju host
@mikemccracken
mikemccracken / gist:a28381db3820a2000f23
Last active August 29, 2015 14:21
cleaning up loop mounted volume groups
create_vg() {
# loopback file for PV:
pvfile=$LXD_DIR/lvm-pv.img
fallocate -l 1GB $pvfile
pvloopdev=$(losetup -f)
losetup $pvloopdev $pvfile
#vgcreate will create a PV for us
vgcreate lxd_test_vg $pvloopdev
% sudo -E $GOPATH/bin/lxd --group sudo --debug
2015/06/26 11:49:52 looking for existing certificates: /var/lib/lxd/server.crt /var/lib/lxd/server.key
2015/06/26 11:49:52 Default uid/gid map:
2015/06/26 11:49:52 - u 0 100000 65536
2015/06/26 11:49:52 - g 0 100000 65536
2015/06/26 11:49:53 LXD isn't socket activated.
2015/06/26 11:49:53 fingering the daemon
2015/06/26 11:49:53 Detected old but dead unix socket, deleting it...
error: listen unix /var/lib/lxd/devlxd/sock: bind: address already in use
@mikemccracken
mikemccracken / yamlcheck.py
Last active August 29, 2015 14:24
check a yaml file to see if it loads
#!python3
import yaml
import sys
with open(sys.argv[1]) as yf:
y = yaml.load(yf)
print(y)
@mikemccracken
mikemccracken / test-bare-snapshot-limit.sh
Created July 2, 2015 15:42
Test for scalability of creating thin snapshots of a thin LV containing a rootfs
#!/bin/bash
NUM_LVS=200
mkdir -p test-mounts
loop_count=0
while true; do
[ $loop_count -ge $NUM_LVS ] && break;
echo "Creating lv $loop_count"
start=$(date +%s)