Skip to content

Instantly share code, notes, and snippets.

@rmohr
rmohr / kubevirt
Last active November 5, 2021 13:41
kubevirtci-hypershift
#!/bin/bash
# Usage:
#
# git clone git@github.com:openshift/hypershift.git
# cd hypershift
# curl -o kubevirtci https://gist.githubusercontent.com/rmohr/8324bfeea7d0823ca8cb76622eb76f56/raw/6956f7ff77d218c9060d685c88a7895747f8e0d9/kubevirt
# chmod u+x kubevirtci
#
# ./kubevirtci up # start a cluster with kubevirt
@rmohr
rmohr / libvirtd.conf
Created November 8, 2019 09:07
libvirtd.conf
#
# This can be used to setup URI aliases for frequently
# used connection URIs. Aliases may contain only the
# characters a-Z, 0-9, _, -.
#
# Following the '=' may be any valid libvirt connection
# URI, including arbitrary parameters
#uri_aliases = [
# "hail=qemu+ssh://root@hail.cloud.example.com/system",
@rmohr
rmohr / test.yaml
Created September 19, 2019 08:44
fixed mac on bridge network
apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachineInstance
metadata:
name: vmi-nocloud1
spec:
domain:
devices:
disks:
- disk:
bus: virtio
@rmohr
rmohr / errors
Created August 9, 2019 10:47
startuperrors
{"component":"virt-launcher","level":"error","msg":"internal error: Unable to get DBus system bus connection: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory","pos":"virDBusGetSystemBus:108","subcomponent":"libvirt","thread":"45","timestamp":"2019-08-09T07:17:15.528000Z"}
{"component":"virt-launcher","level":"error","msg":"internal error: Unable to get DBus system bus connection: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory","pos":"virDBusGetSystemBus:108","subcomponent":"libvirt","thread":"45","timestamp":"2019-08-09T07:17:16.423000Z"}
{"component":"virt-launcher","level":"warning","msg":"DBus not available, disabling firewalld support in bridge_network_driver: internal error: Unable to get DBus system bus connection: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory","pos":"networkStateInitialize:761","subcomponent":"libvirt","thread":"45","timestamp":"2019-08-09T07:17:16.423000Z"}
{"component":"virt-la
@rmohr
rmohr / dump.md
Last active May 10, 2017 13:42
dump vm store thoughts

Covers

Store a VM for later start (maximum rest version, full client controll):

  1. Everything explicit calls (most flexibility)
 POST /apis/kubevirt.io/v1alpha1/vms/defaults
 POST /apis/kubevirt.io/v1alpha1/vms/store
 # wait for a day
 GET  /apis/kubevirt.io/v1alpha1/vms/store/runtime
@rmohr
rmohr / shared-mount.sh
Created February 17, 2017 11:14
flex volume make-shared
#!/bin/bash
# Notes:
# - Please install "jq" package before using this driver.
usage() {
err "Invalid usage. Usage: "
err "\t$0 init"
err "\t$0 attach <json params>"
err "\t$0 detach <mount device>"
err "\t$0 mount <mount dir> <mount device> <json params>"
err "\t$0 unmount <mount dir>"
@rmohr
rmohr / bootstrap-salt.sh
Created January 22, 2016 09:21
fixed salt boostrap file because of moved corp repositories
#!/bin/sh -
#======================================================================================================================
# vim: softtabstop=4 shiftwidth=4 expandtab fenc=utf-8 spell spelllang=en cc=120
#======================================================================================================================
#
# FILE: bootstrap-salt.sh
#
# DESCRIPTION: Bootstrap salt installation for various systems/distributions
#
# BUGS: https://github.com/saltstack/salt-bootstrap/issues
@rmohr
rmohr / udev.py
Last active October 15, 2015 11:08
Use pyudev to monitor cpu hotplug events
import pyudev
context = pyudev.Context()
monitor = pyudev.Monitor.from_netlink(context)
monitor.filter_by(subsystem='cpu')
for action, device in monitor:
print('CPU %s went %s ' % (device.sys_path, action))
@rmohr
rmohr / netlink.py
Created October 15, 2015 10:05
Monitor netlink kernel events for cpu hotplug
@rmohr
rmohr / simple_pam_auth.c
Last active April 22, 2024 08:03
Absolutely minimalistic pam authentication example
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <unistd.h> /* getpass */
#include <security/pam_appl.h> /* pam_start, pam_conv, pam_end, ... */
#define TRY(x) ret = (x); printf("PAM: %s\n", pam_strerror(handle, ret)); if (ret != PAM_SUCCESS) goto finally
int test_conv(int num_msg, const struct pam_message **msg,