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 / fio_tutorial.sh
Created May 20, 2014 02:44
use fio to test disk io
#fio 是测试磁盘性能的最佳工具:
#1、测试顺序读性能
fio --filename=/home/test -iodepth=64 -ioengine=libaio --direct=1 --rw=read --bs=1m --size=2g --numjobs=4 --runtime=10 --group_reporting --name=test-read
#2、测试顺序写性能
fio -filename=/home/test -iodepth=64 -ioengine=libaio -direct=1 -rw=write -bs=1m -size=2g -numjobs=4 -runtime=20 -group_reporting -name=test-write
#3、测试随机读性能
fio -filename=/home/test -iodepth=64 -ioengine=libaio -direct=1 -rw=randread -bs=4k -size=2G -numjobs=64 -runtime=20 -group_reporting -name=test-rand-read
@zhanghui9700
zhanghui9700 / image-in-base-uuid.py
Created April 29, 2014 14:49
nova _base image uuid
#!/usr/bin/env python
#-*-coding=utf-8-*-
import hashlib
import sys
def chunkreadable(iter, chunk_size=65536):
"""
@zhanghui9700
zhanghui9700 / nova-resize-workflow-folsom.sh
Created April 29, 2014 10:05
nova-resize-workflow-folsom
mv /var/lib/nova/instances/instance-00000026 /var/lib/nova/instances/instance-00000026_resize
mkdir -p /var/lib/nova/instances/instance-00000026
qemu-img convert -f qcow2 -O qcow2 /var/lib/nova/instances/instance-00000026_resize/disk /var/lib/nova/instances/instance-00000026_resize/disk_rbase
mv /var/lib/nova/instances/instance-00000026_resize/disk_rbase /var/lib/nova/instances/instance-00000026/disk
qemu-img convert -f qcow2 -O qcow2 /var/lib/nova/instances/instance-00000026_resize/disk.local /var/lib/nova/instances/instance-00000026_resize/disk.local_rbase
mv /var/lib/nova/instances/instance-00000026_resize/disk.local_rbase /var/lib/nova/instances/instance-00000026/disk.local
finish_resize:
@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.
"""
@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 / 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 / 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 / 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 / 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 / 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