Skip to content

Instantly share code, notes, and snippets.

View enakai00's full-sized avatar

Etsuji Nakai enakai00

View GitHub Profile
@enakai00
enakai00 / destroy_vols.sh
Created September 1, 2012 22:10
Remove glusterfs volumes and brick directories.
#!/bin/sh -x
function destroy_vol {
vol=$1
brick_del_cmd=$(gluster vol info $vol | awk -F':' '/Brick[0-9]+/ { print "ssh " $2 " rm -rf " $3 ";" }')
yes | gluster vol stop $vol
yes | gluster vol delete $vol
eval $brick_del_cmd
}
@enakai00
enakai00 / vncdesktop_setup.sh
Created September 5, 2012 12:26
Setting up VNC Desktop for RHEL6
#!/bin/sh -x
yum groupinstall -y "Desktop" \
"General Purpose Desktop" \
"X Window System" \
"Desktop Platform"
yum install tigervnc-server firefox
chkconfig NetworkManager off
service NetworkManager stop
@enakai00
enakai00 / gist:6152861
Last active December 20, 2015 15:19
DCK Serverを利用してプロセスをフォークする感覚でVMを複製するシェルスクリプト
#!/bin/bash -x
curl -s http://192.168.101.9:5000/dck/api/v1.0/libdck > /tmp/libdck.sh
. /tmp/libdck.sh
function child {
echo "I'm child" > /etc/motd
date >> /etc/motd
dck-poke $pid "child_setup" "true"
}
@enakai00
enakai00 / f18_bokan_setup.sh
Last active December 27, 2015 19:49
Setting up F18 RDO hands-on training environment with nested KVM.
#!/bin/bash -x
LANG=C
basepass="XXXXXXXX"
reposerver="xxx.xxx.xxx.xxx"
function prep_network {
set -x
yum -y update
yum -y groupinstall "Gnome Desktop"
@enakai00
enakai00 / prepare tmpfs bricks
Created November 16, 2013 02:43
Prepare Fedora GlusterFS nodes with tmpfs brick
#!/bin/bash -x
setenforce 0
curl http://download.gluster.org/pub/gluster/glusterfs/LATEST/Fedora/glusterfs-fedora.repo > /etc/yum.repos.d/gluster.repo
yum -y install glusterfs-server glusterfs-geo-replication
chkconfig glusterd on
service glusterd start
chkconfig iptables off
service iptables stop
mkdir -p /bricks/tmpfs
umount /bricks/tmpfs
--- mm/shmem.c.orig 2013-09-14 17:53:22.000000000 +0900
+++ mm/shmem.c 2013-11-21 11:17:00.301033262 +0900
@@ -1100,6 +1100,7 @@
spin_lock_init(&info->lock);
info->flags = flags & VM_NORESERVE;
INIT_LIST_HEAD(&info->swaplist);
+ simple_xattrs_init(&info->xattrs);
cache_no_acl(inode);
switch (mode & S_IFMT) {
--- include/linux/shmem_fs.h.orig 2013-11-20 13:46:54.609963899 +0900
+++ include/linux/shmem_fs.h 2013-11-20 14:24:31.313954190 +0900
@@ -10,6 +10,24 @@
#define SHMEM_NR_DIRECT 16
+struct simple_xattrs {
+ struct list_head head;
+ spinlock_t lock;
+};
--- kernel.spec.orig 2013-11-21 11:33:16.194683545 +0900
+++ kernel.spec 2013-11-21 11:32:40.377181703 +0900
@@ -16,6 +16,7 @@
# by setting the define to ".local" or ".bz123456"
#
# % define buildid .local
+%define buildid .tmpfshacked
%define rhel 1
%if %{rhel}
RHEL6でtmpfsでxattrが使えるようにするやっつけの手順。当然ながら、RH non-supportです。
1. カーネルソース「kernel-2.6.32-358.23.2.el6.src.rpm」を入手する。
2. SPECファイルのパッチをダウンロードする。
# rm -f /tmp/kernel.spec.patch
# wget https://gist.github.com/enakai00/7558519/raw/79c52871e08816ab262beea4e715a6f580011c23/kernel.spec.patch -O /tmp/kernel.spec.patch
3. Kernelパッケージをビルドする
@enakai00
enakai00 / hellogluster.c
Last active December 29, 2015 14:59
The simplest libgfapi example.
#include <glusterfs/api/glfs.h>
int main (int argc, char** argv) {
glfs_t *fs = NULL;
glfs_fd_t *fd = NULL;
int ret;
char *filename = "filename";
fs = glfs_new ("volume_name");
ret = glfs_set_volfile_server (fs, "tcp", "server_address", 24007);