Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Default to 3 day warning time just to give a heads-up before a weekend
WARN_HOURS=${DNEST_WARN_HOURS:-72}
# For testing purposes, let a leading 0 signify minutes so we can warn almost immediately
if [[ "$WARN_HOURS" == 0* ]]; then
WARN_UNIT=minutes
WARN_VAL=${WARN_HOURS#0}
else
WARN_UNIT=hours

Changing OVN Image Versions in RHOSO

Overview

The OVN DB server image version is controlled by the OpenStackVersion CR via the customContainerImages field. Changing it causes the openstack-operator to update the OVNDBCluster CRs, which triggers the ovn-operator to roll the StatefulSet pods.

Finding Available Images

@otherwiseguy
otherwiseguy / drserve
Created October 12, 2021 15:35
Get a gnome "critical" notification before your devnest reservation expires
#!/bin/bash
WARN_HOURS=72
while getopts ":t:" opt; do
case ${opt} in
t)
timeout=$OPTARG
;;
esac
done
from multiprocessing.managers import BaseManager
from ovsdbapp.schema.ovn_northbound import commands
class QueueManager(BaseManager): pass
QueueManager.register('get_queue')
m = QueueManager(address=('127.0.0.1', 50000), authkey=b'password')
@otherwiseguy
otherwiseguy / WiderLaunchpdComments.js
Created March 9, 2021 19:51
Remove the width limitation on Launchpad comments
// ==UserScript==
// @name Wider Lauchpad Comments
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Make launchpad comments as wide as possible!
// @author Terry Wilson <otherwiseguy@gmail.com>
// @match https://bugs.launchpad.net/*/+bug/*
// @grant GM_addStyle
// @run-at document-start
// ==/UserScript==
@otherwiseguy
otherwiseguy / schema_test.py
Created November 12, 2020 01:26
Handle schema changes
import logging
import json
import time
from ovs.db import custom_index
from ovs.db import idl
from ovsdbapp.backend.ovs_idl import connection
from ovsdbapp.backend.ovs_idl import event
from ovsdbapp.backend.ovs_idl import vlog
@otherwiseguy
otherwiseguy / cleanup_routers.sh
Created April 14, 2020 12:44
Clean up routers and dependent objects
set -e
function remove_router {
router=$1
for subnet in $(openstack router show $router -c interfaces_info -f json|jq -r '.interfaces_info | .[] | .subnet_id'); do
for fip in $(openstack floating ip list --router $router -c ID -f value); do
echo Deleting floating ip $fip
openstack floating ip delete $fip &
done
wait
echo Removing subnet $subnet from router $router
# User specific aliases and functions
function ovs_destroy_find() {
local cmd=$1
local table=$2
local condition=$3
eval $cmd "-- destroy $table "{$(ovs-vsctl --no-headings --columns=_uuid -f csv find $table $condition|paste -sd",")}
}
alias nbdf="ovs_destroy_find ovn-nbctl"
alias sbdf="ovs_destroy_find ovn-sbctl"
import abc
import unittest
import six
### base stuff ###
@six.add_metaclass(abc.ABCMeta)
class API(object):
backend = None
import abc
import unittest
import six
### base stuff ###
@six.add_metaclass(abc.ABCMeta)
class API(object):
@abc.abstractproperty
def backend(self):