Skip to content

Instantly share code, notes, and snippets.

View jschmid1's full-sized avatar

Joshua Schmid jschmid1

View GitHub Profile
@jschmid1
jschmid1 / gist:4bf2970e8748bcf02bd7120b3c550f46
Last active January 28, 2020 11:45
c-v --format json vs plain
admin:~ # ceph-volume inventory
stderr: unable to read label for /dev/vda2: (2) No such file or directory
stderr: unable to read label for /dev/vda3: (2) No such file or directory
stderr: unable to read label for /dev/vda1: (2) No such file or directory
stderr: unable to read label for /dev/vda: (2) No such file or directory
stderr: unable to read label for /dev/vdb: (2) No such file or directory
stderr: unable to read label for /dev/vdc: (2) No such file or directory
stderr: unable to read label for /dev/vdd: (2) No such file or directory
stderr: unable to read label for /dev/vde: (2) No such file or directory
stderr: unable to read label for /dev/vdf: (2) No such file or directory
@jschmid1
jschmid1 / buffer1.txt
Last active May 29, 2020 13:40
ceph orchestrator spec CLI proposal
Proposal:
Make the CLI more `spec` centric.
`ceph orch spec <operation> <--service-type>|<--service-name>`
Examples:
`ceph orch spec ls`
Workflow examples:
Note: The depicted workflow starts after the initial deployment with bin/cephadm.
Task 0:
Add available hosts to cephadm:
ceph orch host add host{1..20}
@jschmid1
jschmid1 / dg_to_osdspec.py
Last active August 3, 2020 13:35
migrate old dg to cephadm osdspecs
deepsea_drive_group = """
drive_group_default:
target: 'dc-north'
data_devices:
model: SSD-123-foo
db_devices:
model: MC-55-44-XZ
format: bluestore
encryption: True
---
inventory:
version: 1
# the version of the inventory store structure
unique_hostname:
# hostnames need to be unique in a cluster, we can use it as the key with values
# being the attributes
attributes:
# here we store arbitrary information about the host like
# fqdn, kernel version, os-name etc
# this opens up the possibility for node inspection (cpu/ram consumption etc)
specs:
- spec:
# service_name, service_type
key1: val
key3: val
# random k-v pairs on a spec level (created_at) would be a candidate
key1: val
# versioning
version: 1
import json
import pprint
import time
import yaml
from typing import *
def _load_inventory_struct():
with open('inventory_schema.yaml', 'rb') as _fd:
return yaml.safe_load(_fd)
import json
import pprint
import time
import yaml
from typing import *
def _load_inventory_struct():
with open('inventory_schema.yaml', 'rb') as _fd:
return yaml.safe_load(_fd)
@jschmid1
jschmid1 / tmux_window_fuzzy_search.sh
Created November 19, 2021 09:31
Fuzzy search tmux windows
# add this to ~/.bashrc | ~/.zshrc
# put this in ~/.tmux.conf
# bind-key W run "tmux split-window -v 'bash -ci ftpane'"
# to enable it
# This does a couple of things
# mod+W opens a tmux split window with a list of existing windows
# selecting an existing one will bring you there. If the window does
# not exist it will create one with the provided name and switch to it
-- in a it/describe block you can do this to simulate a side-effect
-- similar to python-unittest's side_effect https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock.side_effect
local called = false
local side_effect = function()
-- adding a side_effect that causes to fail the `request_uri` the first time
-- but succeed the second time.
if not called then
called = true
return false, "err"