Skip to content

Instantly share code, notes, and snippets.

View dominikholler's full-sized avatar

Dominik Holler dominikholler

  • Red Hat
  • Paderborn, Germany
View GitHub Profile
def create_server(i):
volume = cloud.create_volume(size=128, bootable=True)
try:
server = {'name': get_server_name(i)}
server['flavorRef'] = cloud.get_flavor('m1.xlarge').id
server['networks'] = [{'uuid': cloud.get_network(get_network_name()).id}]
server['block_device_mapping_v2'] = [
{
'uuid': volume.id,
'boot_index': '0',
@dominikholler
dominikholler / cleanup.py
Created October 28, 2020 16:06
removes all enties on OpenStack Network API
import openstack
import logging
cloud = openstack.connect(cloud='vm-10-208')
NS = ''
def ns(name):
return NS + name
#!/bin/env python3
import openstack
import logging
import time
from functools import wraps
def timeit(f):
@wraps(f)
def wrapper(*args, **kwds):
#!/bin/env python3
import openstack
import logging
import time
from functools import wraps
def timeit(f):
@wraps(f)
def wrapper(*args, **kwds):
@dominikholler
dominikholler / add_external_network.py
Created April 29, 2020 16:43
Add an external network with subnet
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@dominikholler
dominikholler / gen_state.py
Created March 31, 2020 12:05
Performance check for nmstate
#!/usr/bin/python3
# time ./gen_state.py 100 up | nmstatectl set
# time ./gen_state.py 100 absent | nmstatectl set
import sys
header_yml = """
---
interfaces:
- name: {base}
select name, migration_is_good from (
select cluster_id,
bool_or(only_ipv4) and bool_and(only_ipv4) or
bool_or(only_ipv6) and bool_and(only_ipv6) or
bool_or(dual_stack) and bool_and(dual_stack)
as migration_is_good
from (
select addr,
ipv6_address,
network_attachment.cluster_id,
@dominikholler
dominikholler / warn_on_condition.sql
Last active February 28, 2020 14:32
bug 1788451
-- show the names of the affected mac pools to the user
select distinct mac_pools.name from
-- self join
mac_pool_ranges r1 join mac_pool_ranges r2 on
(
-- mac range which starts inside another
(r2.from_mac between r1.from_mac and r1.to_mac)
-- mac range which ends inside another
or (r2.to_mac between r1.from_mac and r1.to_mac))
-- filter out that every ranges overlaps with itself
@dominikholler
dominikholler / createCentOSStream.sh
Last active January 16, 2020 07:26
Create virt-builder style CentOS8 Stream template
#!/bin/bash
set -xe
url=http://ftp.hosteurope.de/mirror/centos.org/8-stream/BaseOS/x86_64/os
name=centos8-stream-$(date +%F)
tmpname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
img=${name}.img
rm -f $img
#!/bin/bash
set -xe
[ -n "${1}" ] || exit 1
name=$1
rootpassword=123456
#osvariant=test
#osvariant=fedora27