Skip to content

Instantly share code, notes, and snippets.

@kmadac
kmadac / stackgeek.manifest
Last active December 13, 2015 20:38
NetappNFSdriver in Folsom for StackGeek
# 'title' should be 50 characters or less, as a rule of thumb
# 'summary' will be used as the article summary on some pages instead of the article text
# 'published' is an epoch timestamp. you can convert your timestamps here: http://www.epochconverter.com/
# 'type' can be one of ['post', 'guide', 'video'] and is used for routing articles to the correct pages
title: NetappNFSdriver in Folsom
author: http://github.com/kmadac
summary: Article about using and configuration of NetappNFSdriver in Cinder in OpenStack Folsom
published: 1361101244
type: post
@kmadac
kmadac / gist:6054402
Last active December 20, 2015 02:09
Create quantum networks
quantum net-create public --router:external=True
quantum subnet-create public 192.168.122.0/24 --gateway 192.168.122.1 --allocation-pool start=192.168.122.170,end=192.168.122.180 --enable_dhcp False
quantum net-create private
quantum subnet-create net1 10.0.0.0/24 --dns_nameservers list=true 8.8.8.8
quantum net-create private_storage
quantum subnet-create net1 10.1.0.0/24
quantum router-create router1
quantum router-interface-add router1 <subnet1-uuid>
quantum router-interface-add router1 <subnet2-uuid>
quantum router-gateway-set router1 <ext-net-id>
@kmadac
kmadac / gist:6064276
Created July 23, 2013 17:25
Update dns-nameservers in quantum
quantum subnet-update subnet_id --dns_nameservers 8.8.8.8 8.8.4.4
@kmadac
kmadac / gist:6074003
Last active December 20, 2015 04:49
Create provider network
Storage provider network will be on interface eth2. I need to put eth2 to ovs bridge. I called it br-stor
root@ostack-grizzly:/etc/network# sudo ovs-vsctl add-br br-stor
root@ostack-grizzly:/etc/network# sudo ovs-vsctl add-port br-stor eth2
Storage bridge br-stor has to be mapped to physical network. I called it storage-net and network_vlan_ranges have to be set without defining vlans. Add following two lines into /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini
network_vlan_ranges = storage-net
bridge_mappings = storage-net:br-stor
.idea/*
*.pyc
@kmadac
kmadac / README
Last active August 29, 2015 13:59
backup mysql database for particlar domain by mysqldump
Script will create testing databases and creates backup of all databses which belongs to domain testdom123.sk.
Result of the script is file testdom123.sk.sql.
Restore can be done by applying the file back to mysql:
mysql -u root -plol < testdom123_sk.sql
@kmadac
kmadac / outer_var.py
Created May 28, 2014 21:52
Access variables in outer class
class Meter(object):
def __init__(self, name, parent=None):
self.name = name
self.parent = parent
def __str__(self):
return self.name
def __repr__(self):
return self.__str__()
@kmadac
kmadac / ChmMigSim.py
Last active August 29, 2015 14:03
Migration Change process simulation
__author__ = 'kmadac'
import random
from bisect import bisect
people = 5
max_changes_per_person_intime = 5
#
#change_complete_time_days = ([(14, 3), (27, 5), (41, 3), (60, 1), (90, 1)])
# real data from migration of real cluster
@kmadac
kmadac / gist:05bdbc795a4bab773857
Created July 29, 2014 12:54
OnTap 7mode audit log regexp
\w{3}\s{1,2}\d{1,2} \d\d:\d\d:\d\d (\w)+ \[.+?\]: (\w+)@\[(.+)_\d+\]:IN:ssh2 shell:(SSH INPUT COMMAND is )*(.+)
### Examples of log file:
Jul 29 09:48:39 filer1 [rshd_0: debug]: user@[10.229.144.23_46673]:IN:ssh2 shell:SSH INPUT COMMAND is rdfile /etc/rc
Jul 29 10:14:23 filer2 [telnet_0: debug]: user@[10.229.144.23_47147]:IN:ssh2 shell:ping 10.10.10.10
Jul 29 10:15:08 filer3 [filer3: rshd_0:debug]: user@[10.229.144.23_39181]:IN:ssh2 shell:SSH INPUT COMMAND is snapvault status
Jul 4 12:45:11 filer4 [filer4: rshd_0:debug]: user@[10.229.144.25_34672]:IN:ssh2 shell:SSH INPUT COMMAND is ifstat e4b
### Use in grep:
grep -P '\w{3}\s{1,2}\d{1,2} \d\d:\d\d:\d\d (\w)+ \[.+?\]: (\w+)@\[(.+)_\d+\]:IN:ssh2 shell:(SSH INPUT COMMAND is )*(.+)' auditlog
@kmadac
kmadac / ponyhostingdb.py
Last active August 29, 2015 14:07
PonyORM first try
from pony.orm import *
from datetime import date, datetime
db = Database('sqlite', ':memory:')
sql_debug(True)
class UhUser(db.Entity):
uname = PrimaryKey(unicode)
password_sha1 = Required(unicode)
email_contacts = Required(unicode)