Skip to content

Instantly share code, notes, and snippets.

View gibizer's full-sized avatar

Balazs Gibizer gibizer

View GitHub Profile
import unittest
from unittest import mock
class System:
def __init__(self):
self.counter1 = 0
self.counter2 = 0
def foo(self):
// ==UserScript==
// @name opendev gerrit CI table
// @namespace http://tampermonkey.net/
// @version 0.3
// @description
// @author gibi
// @match https://review.opendev.org/c/*
// @grant none
// ==/UserScript==
import openstack
def main():
cloud = openstack.connect()
projects = cloud.list_projects()
for project in projects:
print('project_id:', project['id'])
floating_ips = cloud.list_floating_ips(
filters={"project_id": project["id"]},
heat_template_version: wallaby
resources:
net0:
type: OS::Neutron::ProviderNet
properties:
name: net0
network_type: vlan
physical_network: physnet0
segmentation_id: 100
# This will fail is used as an update over https://gist.github.com/gibizer/a0c4e5dc4a59ed3217f64c04a8f207a4 as
# neutron does not support changing a qos rule if that is used by a bound port
heat_template_version: wallaby
resources:
net0:
type: OS::Neutron::ProviderNet
properties:
name: net0
network_type: vlan
# This will succeed if applied as an update over https://gist.github.com/gibizer/a0c4e5dc4a59ed3217f64c04a8f207a4
# if there are still free resource on the compute as neutron allows replacing a qos policy on a bound port and does
# the necessary allocation update in placement.
heat_template_version: wallaby
resources:
net0:
type: OS::Neutron::ProviderNet
properties:
name: net0
INST=f996ef6b-4417-4eb3-aeb7-9f66d8c4d2c5
PORT=46ceed9e-1262-47c2-b7dc-335a31f78b71
rg \
"\
instance: $INST\] Unshelving|\
instance: $INST\] Swapping old allocation on .* held by migration .* for instance|\
instance: $INST\] Starting finish_revert_migration|\
Updating port $PORT with attributes|\
instance: $INST\] Preparing to wait for external event network-vif-plugged|\
# change placement conf
# [api]
# auh_strategy = noauth2
sudo apt install jq parallel --yes
sudo mysql -uroot -padmin -e "DROP DATABASE IF EXISTS placement;"
sudo mysql -uroot -padmin -e "CREATE DATABASE placement CHARACTER SET utf8;"
placement-manage db sync
sudo systemctl restart devstack@placement-*
@gibizer
gibizer / nested-pci-passthrough-with-libvirt.txt
Created May 27, 2022 14:16
Passing a PCI device from the host to L2 VM with libvirt
## host(with a real PCI dev) ---libvirt/qemu---> L1 VM (running devstack) ---nova/libvirt/qemu---> L2 VM
## host
# Enable iommu in the kernel
$ grep iommu /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on"
# the PCI device needs to be in a separate IOMMU group
import random
import time
import eventlet
from oslo_concurrency import lockutils
eventlet.monkey_patch()
LOCK = "my-lock"