Skip to content

Instantly share code, notes, and snippets.

View phoracek's full-sized avatar

Petr Horacek phoracek

View GitHub Profile
@phoracek
phoracek / vdsm_helper.sh
Last active August 29, 2015 14:24
VDSM helper, EL7
#!/bin/bash
# Forked from VDSM repo.
# Useful VDSM helpers for developers. It supplies a few shorthands for common
# developer's daily tasks. This file can be imported to one's .bashrc or
# .zshrc.
VDSM_DIR=~/vdsm
_latest_version() {
ls ~/rpmbuild/RPMS/*/vdsm* -t -w 1 | head -1 | perl -pe 's|^.*?git|git|' | perl -pe 's|\..*$||'
@phoracek
phoracek / prepare_veth.sh
Last active January 17, 2018 07:11
ifcfg and brctl+dhclient routing differences
# prepare veth pair and run dnsmasq
ip link add name veth_l type veth peer name veth_r
ip -4 addr add dev veth_l 240.0.0.1/24
ip link set dev veth_l up
dnsmasq --dhcp-authoritative -p 0 --dhcp-range=240.0.0.10,240.0.0.100,2m \
--dhcp-option=3,240.0.0.254 --dhcp-option=6 -i veth_l -I lo -d \
--bind-dynamic --dhcp-range=fdb3:84e5:4ff4:55e3::a,fdb3:84e5:4ff4:55e3::64,2m
@phoracek
phoracek / getVdsStats_new_device.py
Created September 10, 2015 11:18
how long it takes to list a new device in getVdsStats
#!/bin/python
""" NOTE:
before running this script, ensure there is no dummy_1/2 listed in getVdsCaps
"""
import time
import os
import sys
from vdsm import vdscli
@phoracek
phoracek / test_for_deps.py
Last active September 11, 2015 15:27
test for needed vdsm dependencies
#!/bin/python
import os
""" Run this from the vdsm folder """
deps = set([
'autoconf',
'automake',
'autoreconf',
@phoracek
phoracek / aa.yaml
Last active September 13, 2016 08:44
swagger: '2.0'
info:
version: '0.0.1'
title: ONEM API
description: |
ONEM Network Manager is a plugin-based framework aiming on configuration
of abstractly defined networks.
## Configuration
Configuration is handled via 3 configuration tables.
### System Configuration
#!/usr/bin/env bash
#
# Run dhcp server on given network bridge with specified range. Must be
# executed from k8s-network-sandbox home directory after `lago start`.
#
# Example:
# $ ./scripts/dhcp_server.sh net0 192.168.20.2,192.168.20.254,1h 192.168.20.1/24
function _run {
@phoracek
phoracek / test_ovs_nm.sh
Last active April 26, 2017 15:55
ovs+nm
ovs-vsctl add-br br0 -- add-port br0 net1 -- set Interface net1 type=internal
nmcli device set ifname net1 managed yes
nmcli connection add type generic ifname net1 con-name ovs-net1
nmcli connection modify ovs-net1 ipv4.method static ipv4.address 10.10.10.2/24
nmcli connection up ovs-net1
ip a
# ...
# 278: net2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
# link/ether be:f2:d6:fa:36:7a brd ff:ff:ff:ff:ff:ff

Keybase proof

I hereby claim:

  • I am phoracek on github.
  • I am phoracek (https://keybase.io/phoracek) on keybase.
  • I have a public key ASCx1_6xHbVMe7aD5jBksIzZfJh8JIEqh2Yrs-o5Hbw3Hwo

To claim this, I am signing this object:

@phoracek
phoracek / setup_ovirtmgmt.sh
Created August 9, 2017 11:03
setup ovirtmgmt network with static ip via vdsm-client
echo '{"bondings": {}, "networks": {"ovirtmgmt": {"nic": "eth0", "netmask": "255.255.255.0", "ipaddr": "1.1.1.2", "gateway": "1.1.1.1", "defaultRoute": true}}, "options": {"connectivityCheck": false}}' | vdsm-client -f - Host setupNetworks
vdsm-client Host setSafeNetworkConfig
@phoracek
phoracek / sb.cmds
Last active August 10, 2017 16:39
sb
/admin
/spawnitem manipulatormodule N
/startquest '"gaterepair"'
/completequest gaterepair
/startquest '"shiprepair"'
/completequest shiprepair