Skip to content

Instantly share code, notes, and snippets.

View vishvananda's full-sized avatar

Vish (Ishaya) Abrams vishvananda

  • Heroku
  • United States
View GitHub Profile
apt-get update
apt-get install -y linux-headers-virtual
apt-get install -y openvswitch-datapath-dkms
apt-get install -y openvswitch-switch openvswitch-controller openvswitch-brcompat
/etc/init.d/openvswitch-switch start
ovs-vsctl add-br br0
sudo ovs-vsctl add-port br0 gre0 -- set interface gre0 type=gre options:remote_ip=10.8.0.3
sudo ovs-vsctl add-port br0 gre1 -- set interface gre1 type=gre options:remote_ip=10.8.0.5
ovs-vsctl add-port br0 test -- set interface test type=internal
ifconfig test 172.24.16.1/24 up
@vishvananda
vishvananda / translator.py
Created August 11, 2012 16:48
Translator to translate a python program into an equivalent program with a very limited set of characters
import os
with open('in.py') as infile:
data = infile.read()
def encode(char, sym):
return'+'.join([sym] * ord(char))
def write(outfile, wrap, boc, eoc, sep, sym='1'):
text = sep.join([boc + encode(char, sym) + eoc for char in data])
diff --git a/nova/virt/disk/api.py b/nova/virt/disk/api.py
index e55b54f..c733045 100644
--- a/nova/virt/disk/api.py
+++ b/nova/virt/disk/api.py
@@ -294,7 +294,7 @@ def setup_container(image, container_dir=None, use_cow=False):
raise exception.NovaException(img.errors)
-def destroy_container(img):
+def destroy_container(image, container_dir=None, use_cow=False):
# Note, make sure to run nova-manage db sync first to create a sqlite database
from nova import db
from nova.db.sqlalchemy import models
from nova.db.sqlalchemy import session as sess
from nova import context
from sqlalchemy.orm import joinedload
def instance_get_joined(uuid, session):
with session.begin():
val = session.query(models.Instance).filter_by(deleted=False).options(joinedload('instance_type')).filter_by(uuid=uuid).first()
diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py
index 42fb9cc..a30c767 100644
--- a/nova/network/linux_net.py
+++ b/nova/network/linux_net.py
@@ -136,6 +136,14 @@ class IptablesTable(object):
self.chains = set()
self.unwrapped_chains = set()
+ def __eq__(self, other):
+ return ((self.rules == other.rules) and
@vishvananda
vishvananda / bp.sh
Last active October 2, 2015 07:58
Script for backporting OpenStack branches
#!/usr/bin/env bash
# This little script is to make backporting patches easier.
# Instructions
# ------------
# Make sure that <btranch> exists:
# git branch -D <branch>
# git checkout -b <branch> origin/<branch>
# Grab the file and stick it in your <project> directory:
# curl -OL https://raw.github.com/gist/2206428/bp.sh
# Make sure the script is runnable:
diff --git a/nova/testing/fake/__init__.py b/nova/testing/fake/__init__.py
index d9eebbd..5cdad47 100644
--- a/nova/testing/fake/__init__.py
+++ b/nova/testing/fake/__init__.py
@@ -1,2 +1 @@
-import memcache
import rabbit
diff --git a/nova/api/openstack/compute/contrib/extended_server_attributes.py b/nova/api/openstack/compute/contrib/extended_server_attributes.py
index c1c85c6..a4794d7 100644
--- a/nova/api/openstack/compute/contrib/extended_server_attributes.py
+++ b/nova/api/openstack/compute/contrib/extended_server_attributes.py
@@ -69,7 +69,7 @@ class ExtendedServerAttributesController(wsgi.Controller):
context = req.environ['nova.context']
if authorize(context):
# Attach our slave template to the response object
- resp_obj.attach(xml=ExtendedServerAttributesTemplate())
+ resp_obj.attach(xml=ExtendedServerAttributeTemplate())
diff --git a/nova/api/openstack/compute/contrib/extended_server_attributes.py b/nova/api/openstack/compute/contrib/extended_server_attributes.py
index c1c85c6..a4794d7 100644
--- a/nova/api/openstack/compute/contrib/extended_server_attributes.py
+++ b/nova/api/openstack/compute/contrib/extended_server_attributes.py
@@ -69,7 +69,7 @@ class ExtendedServerAttributesController(wsgi.Controller):
context = req.environ['nova.context']
if authorize(context):
# Attach our slave template to the response object
- resp_obj.attach(xml=ExtendedServerAttributesTemplate())
+ resp_obj.attach(xml=ExtendedServerAttributeTemplate())
diff --git a/nova/api/openstack/compute/contrib/extended_server_attributes.py b/nova/api/openstack/compute/contrib/extended_server_attributes.py
index c1c85c6..aef578f 100644
--- a/nova/api/openstack/compute/contrib/extended_server_attributes.py
+++ b/nova/api/openstack/compute/contrib/extended_server_attributes.py
@@ -69,7 +69,7 @@ class ExtendedServerAttributesController(wsgi.Controller):
context = req.environ['nova.context']
if authorize(context):
# Attach our slave template to the response object
- resp_obj.attach(xml=ExtendedServerAttributesTemplate())
+ resp_obj.attach(xml=ExtendedServerAttributeTemplate())