Skip to content

Instantly share code, notes, and snippets.

View vicenteg's full-sized avatar

Vince Gonzalez vicenteg

View GitHub Profile
@vicenteg
vicenteg / fence_seamicro
Created April 17, 2013 20:10
A hack to allow power fencing to work with cobbler and a SeaMicro chassis.
#!/usr/bin/env python
import re
import sys
import os
import pwd
import grp
import subprocess
import logging
from logging import handlers
@vicenteg
vicenteg / gist:5407710
Created April 17, 2013 20:56
Complementary hack to this hack: https://gist.github.com/ecnivny/5407346 This little guy goes in /etc/cobbler/power/fence_seamicro.template
#if $power_mode == "on"
#set $power_mode = 1
#else if $power_mode == "off"
#set $power_mode = 6
#else if $power_mode == "reboot"
#set $power_mode = 2
#end if
/usr/bin/ipmitool -H $power_address -I lanplus -U $power_user -P $power_pass raw 0x2E 1 0x00 0x7d 0xab $power_mode 0 $power_id
@vicenteg
vicenteg / rename_external_storage.py
Created June 24, 2013 16:14
Rename external storage so that JBOD disks are renamed in the form: jbod-S-D/d where S == S-card slot, D == JBOD internal device (0,1,2,3), d == disk number in the internal device.
#!/usr/bin/python
import re, sys
show_storage_external_brief = sys.stdin.readlines()
pattern = re.compile(r"^\s+(?P<name>\S+)\s+(?P<device>\S+)\s+(?P<slot>\d+)")
slots_seen = { }
# trying out what happens when we sort the JBOD WWNs
for line in sorted(show_storage_external_brief):
m = pattern.match( line )
@vicenteg
vicenteg / volumes.py
Last active December 19, 2015 00:20
Generating the commands needed to create pools, volumes and then assign them to 64 servers in a SeaMicro chassis.
#!/usr/bin/python
# SSDs in slots 0-1 of each S-card.
# HDDs in slots 2-7 of each S-card.
# Application A - 16 servers
# Assign one 64GB SSD volume to vdisk 0
# Assign three whole-disk volumes to each of vdisk 1, 2, 3
# Application B - 48 servers
# Assign one 32GB SSD volume to disk 0
@vicenteg
vicenteg / README.md
Last active December 19, 2015 19:08
Example of PXE boot for ESXi on SeaMicro SM15000 server.

These instructions assume you have already set up a working netboot environment, complete with tftp server. What follows below is a doctored cobbler setup, so YMMV depending on how you manage your netboot environment. Note that running cobbler sync will clobber these files, so this is really just a temporary solution.

First, copy the contents of the ESXi 5.1 ISO to /var/lib/tftpboot/images/esxi5-x86_64. This should look something like the following for ESXi 5.1:

[vince@cobbler tftpboot]$ cd images/esxi5-x86_64/
[vince@cobbler esxi5-x86_64]$ ls
a.b00         boot.cfg      isolinux.cfg  net_enic.v00  safeboot.c32  scsi_fni.v00  scsi_rst.v00
ata_pata.v00  chardevs.b00  k.b00         net_forc.v00  sata_ahc.v00  scsi_hps.v00  s.v00
ata_pata.v01  efiboot.img   mboot.c32     net_igb.v00   sata_ata.v00  scsi_ips.v00  tboot.b00
@vicenteg
vicenteg / brocade_config
Last active December 21, 2015 02:29
Configuration stanza for a SeaMicro node that will run openstack.
ver 07.4.00bT203
!
vlan 1 name DEFAULT-VLAN by port
router-interface ve 1
!
vlan 100 name selab-atom by port
untagged ethe 26
router-interface ve 100
!
vlan 199 name openstack-deploy by port
$ ansible-playbook -i ~/Dropbox/Code/mapr/singlenode/playbooks/vgonzalez_cluster.hosts -u root playbook.yml
PLAY [fileserver] *************************************************************
GATHERING FACTS ***************************************************************
ok: [ec2-107-23-70-48.compute-1.amazonaws.com]
ok: [ec2-107-23-70-95.compute-1.amazonaws.com]
ok: [ec2-107-23-69-30.compute-1.amazonaws.com]
ok: [ec2-107-23-70-46.compute-1.amazonaws.com]
ok: [ec2-107-23-70-71.compute-1.amazonaws.com]
@vicenteg
vicenteg / disk_add.py
Last active August 29, 2015 14:02
disk add api
import requests
import logging
user = "mapr"
password = "mapr"
host = "node1"
disk_list = [ '/dev/sde', '/dev/sdf', '/dev/sdg' ]
def add_disk():
SET hive.exec.compress.output=true;
SET mapred.output.compression.codec=org.apache.hadoop.io.compress.SnappyCodec;
SET mapred.output.compression.type=BLOCK;
CREATE EXTERNAL TABLE IF NOT EXISTS X1_TEST_SNAPPY_B
LIKE yelp_business
LOCATION '/user/testsnappy/';
INSERT INTO TABLE X1_TEST_SNAPPY_B SELECT city,review_count,name,neighborhoods,business_id,full_address,hours,state,longitude,stars,latitude,attributes,open,categories FROM yelp_business;
DROP TABLE IF EXISTS yelp_business;
DROP TABLE IF EXISTS yelp_reviews;
CREATE TABLE IF NOT EXISTS yelp_business
(city STRING, review_count INT, name STRING, neighborhoods ARRAY<STRING>,
type STRING, business_id STRING, full_address STRING, hours STRING,
state STRING, longitude FLOAT, stars INT, latitude FLOAT, attributes STRING, open BOOLEAN, categories STRING)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
CREATE TABLE IF NOT EXISTS yelp_reviews