Skip to content

Instantly share code, notes, and snippets.

View zhanghui9700's full-sized avatar
🎯
Focusing

pysharp zhanghui9700

🎯
Focusing
  • beijing
View GitHub Profile
@zhanghui9700
zhanghui9700 / create-user-ceph-to-many-host
Last active August 29, 2015 13:57
create ceph user and change passwd without shell interactive
#!/bin/bash
#coding=utf-8
for host in "$@"
do
echo $host
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@$host "useradd -d /home/ceph -m ceph; echo password | passwd ceph; echo 'ceph ALL = (root) NOPASSWD:ALL' | tee /etc/sudoers.d/ceph; chmod 0440 /etc/sudoers.d/ceph;"
done
echo "usage: create_ceph_user.sh host1 host2 host3"
@zhanghui9700
zhanghui9700 / vagrantfile.rb
Last active August 29, 2015 13:57
vagrant file for a multi host develop environment
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define :node1 do |node1|
node1.vm.box = "centos65"
@zhanghui9700
zhanghui9700 / ceph config for openstack glance and cinder.sh
Last active August 29, 2015 13:57
ceph config for openstack glance and cinder
ceph-deploy disk list ceph-client
ceph-deploy disk zap ceph-client:/dev/sdb
ceph-deploy disk prepare ceph-client:/dev/sdb
ceph-deploy disk activate ceph-client:/dev/sdb
---
ceph osd lspools
ceph auth list
ceph auth get-key client.images
@zhanghui9700
zhanghui9700 / vagrantfile for test keepalived.rb
Last active August 29, 2015 13:57
vagrantfile for test keepalived
http://blog.csdn.net/k_james/article/details/12994145
VM1: 192.168.1.11
VM2: 192.168.1.13
VIP: 192.168.1.201
VM1: /etc/keepalived/keepalived.conf
vrrp_instance VI_NODE {
state MASTER
interface eth2
@zhanghui9700
zhanghui9700 / my vimrc.sh
Last active August 29, 2015 13:57
my vimrc
syntax on
set tabstop=4
set softtabstop=4
set shiftwidth=4
set nu
set autoindent
set laststatus=2
set list listchars=tab:>-,trail:-
set hlsearch
set smartindent
@zhanghui9700
zhanghui9700 / config-ceph-with-openstack.sh
Last active June 26, 2023 19:41
install ceph and config openstack glance/cinder to use ceph as it's backend
---
##prapare to install
# for all nodes
sudo useradd -d /home/ceph -m ceph
sudo passwd ceph
echo "ceph ALL = (root) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/ceph
sudo chmod 0440 /etc/sudoers.d/ceph
##admin-node node(ceph and root)
ssh-keygen
@zhanghui9700
zhanghui9700 / direct-access-meta-data.py
Last active August 29, 2015 13:58
direct access meta-data api in havana
expected_signature = hmac.new(
CONF.neutron_metadata_proxy_shared_secret,
instance_id,
hashlib.sha256).hexdigest()
# grep shared_secret /etc/nova/nova.conf
neutron_metadata_proxy_shared_secret=deadbeef2eb84d8d
Python 2.7.5 (default, Nov 12 2013, 16:18:42)
[GCC 4.8.2 20131017 (Red Hat 4.8.2-1)] on linux2
@zhanghui9700
zhanghui9700 / havana-install.sh
Last active August 29, 2015 13:58
openstack havana install by manual
== Initial ==
On controller node (192.168.122.163):
$ yum install openstack-keystone openstack-utils dnsmasq-utils -y
$ yum install openstack-glance openstack-cinder openstack-neutron \
openstack-neutron-openvswitch -y
$ yum install openstack-nova -y
On compute (192.168.122.100):
@zhanghui9700
zhanghui9700 / allways_cache_import_exception.py
Created April 14, 2014 02:17
cache import error and try fixed it
#!/usr/bin/python
import os, sys
try:
import packstack
except ImportError:
# packstack isn't installed, running from source checkout
sys.path.insert(0, os.path.join(os.path.split(sys.argv[0])[0], ".."))
import packstack
@zhanghui9700
zhanghui9700 / packstack-utils-network.py
Created April 21, 2014 07:21
packstack gen-answer-file get localhost ip
# -*- coding: utf-8 -*-
import re
import socket
def get_localhost_ip():
"""
Returns IP address of localhost.
"""