Skip to content

Instantly share code, notes, and snippets.

View mikemccracken's full-sized avatar

Michael McCracken mikemccracken

View GitHub Profile
self.step_pile = Pile([
Padding.center_90(HR()),
Padding.line_break(""),
Padding.center_90(Pile(self.steps)),
Padding.line_break(""),
Padding.center_20(self.buttons())
])
@mikemccracken
mikemccracken / gist:6e339dc36a1d16f05cab
Last active January 28, 2016 17:24
problem with cloud-init inside trusty containers

using lxd from ppa:ubuntu-lxc/lxd-stable on trusty is showing an issue that's new to me:

with this recent image:

ubuntu@rickross:~⟫ lxc image list
+--------+--------------+--------+--------------------------------------+--------+----------+-------------------------------+
| ALIAS  | FINGERPRINT  | PUBLIC |             DESCRIPTION              |  ARCH  |   SIZE   |          UPLOAD DATE          |
+--------+--------------+--------+--------------------------------------+--------+----------+-------------------------------+
| ubuntu | 1032903165a6 | no     | Ubuntu 14.04 LTS server (20160114.5) | x86_64 | 118.21MB | Jan 27, 2016 at 11:00pm (UTC) |
+--------+--------------+--------+--------------------------------------+--------+----------+-------------------------------+
@mikemccracken
mikemccracken / loopvgtest.sh
Last active August 29, 2015 14:25
test creating vgs
#!/bin/bash
set -ex
dev=$(losetup -f)
file=VGTEST_DELME
vg=TEST_LV
cleanup() {
vgremove -f $vg || true
@mikemccracken
mikemccracken / thin-lvcreate-vvv.txt
Created July 2, 2015 16:07
lvcreate verbose log after 129
% sudo lvcreate -vvv -kn -n density-check-lxd-00129-manualtry -s /dev/mantest_vg/04aac4257341478b49c25d22cea8a6ce0489dc6c42d835367945e7596368a37f
DEGRADED MODE. Incomplete RAID LVs will be processed.
Setting activation/monitoring to 1
Processing: lvcreate -vvv -kn -n density-check-lxd-00129-manualtry -s /dev/mantest_vg/04aac4257341478b49c25d22cea8a6ce0489dc6c42d835367945e7596368a37f
O_DIRECT will be used
Setting global/locking_type to 1
Setting global/wait_for_locks to 1
File-based locking selected.
Setting global/prioritise_write_locks to 1
Setting global/locking_dir to /run/lock/lvm
@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)
@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)
% 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 / 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
@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
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