Skip to content

Instantly share code, notes, and snippets.

@dizz
dizz / occi.json
Created February 4, 2011 13:23
sample json renderings for OCCI
[
{
"Location": "/api/compute/123",
"Category": [
{
"term": "compute",
"scheme": "http://.../occi/infrastructure#",
"class": "kind",
"rel": "http://schemes.ogf.org/occi/core#resource",
package be.edmonds.occi;
import org.antlr.runtime.ANTLRStringStream;
import org.antlr.runtime.CharStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.RecognitionException;
import org.json.JSONException;
import org.json.JSONObject;
public class OcciRequest {
@dizz
dizz / gist:865701
Created March 11, 2011 10:23
OCCI Text to Java Datastructures via OCCI LexPar
OCCI Header format:
Category: storage; scheme="http://schemas.ogf.org/occi/infrastructure#";class="kind"; title="Storage Resource";rel="http://schemas.ogf.org/occi/core#resource";location=/storage/;attributes="occi.storage.size occi.storage.state";actions="http://schemas.ogf.org/occi/infrastructure/storage/action#resize"
Link: </storage/disk03>; rel="http://example.com/occi/resource#storage";self="/link/456-456-456";category="http://example.com/occi/link#disk_drive";com.example.drive0.interface="ide0",com.example.drive1.interface="ide1"
X-OCCI-Attribute: occi.compute.architechture="x86", occi.compute.cores=2, occi.compute.hostname="testserver", occi.compute.speed=2.66, occi.compute.memory=3.0, occi.compute.state="active"
Generated Java Datastructures (displayed using $type.toString()):
{
occi.attributes={
occi.compute.state="active",
occi.compute.hostname="testserver",
/*
Result:
Result: {occi.attributes=[], occi.categories=[[{occi.core.scheme=http://schemas.ogf.org/occi/infrastructure/compute/action#, occi.core.class=action, occi.core.term=start, occi.core.title=Start Compute Action}], [{occi.core.scheme=http://schemas.ogf.org/occi/infrastructure/compute/action#, occi.core.class=action, occi.core.term=stop, occi.core.attributes=acpioff graceful poweroff, occi.core.title=Stop Compute Action}], [{occi.core.scheme=http://schemas.ogf.org/occi/infrastructure/compute/action#, occi.core.class=action, occi.core.term=restart, occi.core.attributes=warm graceful cold, occi.core.title=Restart Compute Action}], [{occi.core.scheme=http://schemas.ogf.org/occi/infrastructure/compute/action#, occi.core.class=action, occi.core.term=suspend, occi.core.attributes=hibernate suspend, occi.core.title=Suspend Compute Action}], [{occi.core.scheme=http://schemas.ogf.org/occi/infrastructure/network/action#, occi.core.class=action, occi.core.term=up, occi.core.title=Up Network Action}], [{occi.core.
@dizz
dizz / occij.json
Created July 14, 2011 17:39
Sample OCCI JSON
[
{
"category": [
{
"term": "ie",
"scheme": "http://",
"class": "mixin",
"title": "null",
"rel": "null",
"location": "null",
@dizz
dizz / brew-install-collectd-failure
Created September 28, 2011 16:32
brew install collectd fails
==> Downloading http://collectd.org/files/collectd-5.0.0.tar.bz2
File already downloaded in /Users/andy/Library/Caches/Homebrew
/usr/bin/tar xf /Users/andy/Library/Caches/Homebrew/collectd-5.0.0.tar.bz2
==> ./configure --disable-debug --disable-dependency-tracking --with-python=/usr/local/bin/python --prefix=/usr/local/Cellar/collectd/5.0.0 --localstatedir=/usr/local/var
./configure --disable-debug --disable-dependency-tracking --with-python=/usr/local/bin/python --prefix=/usr/local/Cellar/collectd/5.0.0 --localstatedir=/usr/local/var
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
checking for nawk... no
@dizz
dizz / plugin_test.py
Created September 29, 2011 15:23
collectd python test
# Sample Python module to use python plugin
import collectd
import pika
#== Our Own Functions go here: ==#
def configure(ObjConfiguration):
collectd.info('Configuring Stuff')
def init():
@dizz
dizz / output.txt
Created February 15, 2012 12:49
OpenStack on SmartOS
./bin/nova-compute --connection_type=fake --sql_connection=mysql://root:[email protected]/nova --fake_rabbit
2012-02-15 10:38:18,332 WARNING nova.virt.libvirt.firewall [-] Libvirt module could not be loaded. NWFilterFirewall will not work correctly.
2012-02-15 10:38:18,493 AUDIT nova.service [-] Starting compute node (version 2012.1-LOCALBRANCH:LOCALREVISION)
2012-02-15 10:38:19,230 INFO nova.rpc [-] Connected to AMQP server on localhost:5672
2012-02-15 10:39:19,255 INFO nova.compute.manager [req-d718f207-a329-4ab3-b84d-af609a3e6bed None None] Updating bandwidth usage cache
2012-02-15 10:39:19,257 INFO nova.compute.manager [req-d718f207-a329-4ab3-b84d-af609a3e6bed None None] Updating host status
2012-02-15 10:40:19,258 INFO nova.rpc [-] Connected to AMQP server on localhost:5672
2012-02-15 10:41:19,302 INFO nova.compute.manager [-] Updating host status
@dizz
dizz / gist:1836730
Created February 15, 2012 15:34
occi paste config
#############
# OCCI #
#############
# For examples of declaring interceptors see above
# Some useful ones in there e.g. fault handling, rate limiting, extension loading
[composite:occiapi]
# Request routing
use = egg:Paste#urlmap
@dizz
dizz / gist:2888052
Created June 7, 2012 10:21
foreman network adapter setup
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
metric 10
auto eth1
iface eth1 inet static
address 192.168.56.2