Skip to content

Instantly share code, notes, and snippets.

FROM centos:7.4.1708
# Bootstrap container
RUN yum -y install git which
# Install OpenStack Ansible
ARG OSA_RELEASE
RUN git clone -b ${OSA_RELEASE} https://git.openstack.org/openstack/openstack-ansible /opt/openstack-ansible
WORKDIR /opt/openstack-ansible
RUN scripts/bootstrap-ansible.sh
@mnaser
mnaser / mitigate-meltdown.yml
Last active March 23, 2021 23:05
Ansible playbook for Meltdown mitigation (KPI for CentOS/RHEL 7)
---
- hosts: all
gather_facts: false
pre_tasks:
- name: ensure ipmi tools are installed
yum:
name: ipmitool
- name: retrieve ipmitool address
shell: >
ipmitool lan print | grep '^IP Addr' | grep -v Source | cut -d':' -f2 | xargs
@mnaser
mnaser / OpenStack_consumer_GPU_passthrough.md
Created November 21, 2017 03:25 — forked from claudiok/OpenStack_consumer_GPU_passthrough.md
Consumer-grade GPU passthrough in an OpenStack system (NVIDIA GPUs)

Consumer-grade GPUs in an OpenStack system (NVIDIA GPUs)

Assumptions

This assumes you have GTX980 cards in your system (PCI id 10de:13c0 & 10de:0fbb per card). Just add more IDs for other cards in order to make this more generic. This also assumes nova uses qemu-kvm as the virtualization hypervisor (qemu-system-x86_64). This seems to be the default on OpenStack Newton when installed using openstack-ansible.

We assume OpenStack Newton is pre-installed and that we are working on a Nova compute node. This has been tested on an Ubuntu 16.04 system where I installed OpenStack AIO version 14.0.0 (different from the git tag used in the instructions!): http://docs.openstack.org/developer/openstack-ansible/developer-docs/quickstart-aio.html

Prepare the system for GPU passthrough (set up IOMMU/vfio/...)

Note: This is heavily based on information from https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF#Enabling_IOMMU adapted for Ubuntu 16.04

Keybase proof

I hereby claim:

  • I am mnaser on github.
  • I am mnaser (https://keybase.io/mnaser) on keybase.
  • I have a public key ASD20aQ4Fni8u9S0KrqY6tU_ueo5sMg2qK7kI8oYGPNcugo

To claim this, I am signing this object:

import json
import os
import sys
path = sys.argv[1]
def generate_tree(path):
tree = []
dentries = os.listdir(path)
@mnaser
mnaser / find_nodes.py
Created January 26, 2017 22:50
Retrieve list of all VMs up longer than 24 hours
from datetime import datetime
NOW = datetime.utcnow()
import os_client_config
import prettytable
import shade
cloud_config = os_client_config.OpenStackConfig().get_all_clouds()
for config in cloud_config:
@mnaser
mnaser / check-openstack-api.rb
Created August 10, 2016 21:15
OpenStack API checks for Sensu. You can use TENANT_ID in url and it will automatically replace by tenant ID (useful for nova)
#!/opt/sensu/embedded/bin/ruby
require 'sensu-plugin/check/cli'
require 'net/http'
require 'json'
class CheckOpenStackAPI < Sensu::Plugin::Check::CLI
option :auth_url,
short: '-a AUTH-URL',
long: '--auth-url AUTH-URL',
@mnaser
mnaser / check-nova-services.rb
Created August 10, 2016 21:13
Sensu check to ensure all Nova services are up
#!/opt/sensu/embedded/bin/ruby
require 'sensu-plugin/check/cli'
require 'net/http'
require 'json'
class CheckNovaServices < Sensu::Plugin::Check::CLI
option :auth_url,
short: '-a AUTH-URL',
long: '--auth-url AUTH-URL',
@mnaser
mnaser / curlstone
Created April 21, 2016 13:46
Small cURL wrapper which retrieves a Keystone token to make requests (must have all env variables configured and openstack CLI client installed)
#!/bin/sh
TOKEN=$(openstack token issue -f value -c id)
curl -H "X-Auth-Token: $TOKEN" "$@"
@mnaser
mnaser / xstartup
Created January 8, 2014 03:08
xstartup File
#!/bin/sh
unset SESSION_MANAGER
gnome-session --session=gnome-classic &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &