반응형
DevStack 으로 neutron 포함 설치시 방법을 공유합니다.

OS 는 Ubuntu Desktop 12.04 LTS 버전입니다.

* 최신 2014 2월 trunk 버전에서는 nova/virt/libvirt/driver.py 에서 python-libvirt 1.0.2+ 이상만 지원하므로 에러가 발생합니다. 
Ubuntu 최신 버전을 설치하세요. 

네트워크 세팅은 다음과 같습니다.

[ Single Node or Multi Node 의 경우 Controller Node 와 Compute Node 역활을 함 ]
eth0 : NAT type         192.168.75.136       Public Network
eth1 : Host-only type 192.168.230.136     Private Network

[ Multi Node 의 경우 두번째 추가 Compute Node ]
eth0 : NAT type         192.168.75.137       Public Network
eth1 : Host-only type 192.168.230.137     Private Network

[ User 선택 ]
stack 유저로 생성

[ visudo 세팅 ]
stack   ALL=(ALL:ALL) NOPASSWD:ALL

[ vi /etc/network/interfaces ]
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 192.168.75.136
        netmask 255.255.255.0
        gateway 192.168.75.2
        dns-nameservers 8.8.8.8 8.8.4.4

auto eth1
iface eth1 inet static
        address 192.168.230.136
        netmask 255.255.255.0

[ network-manager 제거 ]
sudo apt-get purge network-manager
sudo apt-get autoremove
sudo /etc/init.d/networking restart

[ proxy 사용 -> proxy 세팅 ]
sudo vi /etc/apt/apt.conf
Acquire::http::proxy "http://xx.xx.xx.xx:8080/";
Acquire::https::proxy "https://xx.xx.xx.xx:8080/";

sudo vi /etc/environment
http_proxy="http://xx.xx.xx.xx:8080/"
https_proxy="https://xx.xx.xx.xx:8080/"
no_proxy="ubuntu,localhost,127.0.0.1,192.168.75.136,192.168.230.136"

[ python import 오류 해결 ]
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

[ git 설치 및 user 세팅, proxy 사용 -> proxy 세팅 ]
sudo apt-get -y install git git-review

git config --global user.name "Stephen Ahn"
git config --global user.email "skanddh@gmail.com"
git config --global http.proxy http://xx.xx.xx.xx:8080
git config --global https.proxy https://xx.xx.xx.xx:8080
git config --list

[ remove dmidecode ]
sudo apt-get install libvirt-bin
sudo apt-get purge dmidecode
kill -9 [dmidecode process]
sudo apt-get autoremove

[ delete default virtual bridge ]
root 로 로그인하여 실행
virsh net-destroy default
virsh net-undefine default

[ Proxy 사용 -> curl 세팅 ]
curl 사용을 위해 crt 파일을 복사하고 xxx.cert 파일을 선택
cp xxx.crt  /usr/share/ca-certificates/extra
dpkg-reconfigure ca-certificates

[ Proxy 사용 -> ~/.pip/pip.conf 세팅 ]
[global]
cert = /usr/share/ca-certificates/extra/xxx.crt
index-url = http://pypi.gocept.com/simple/

[ DevStack clone ]
git clone https://github.com/openstack-dev/devstack.git

[ vi  lib/neutron_plugins/ovs_base ]
gre port 나 patch port 가 생성이 안된다는 q-agt 에러가 발생하면 Kernel 3.5.x-xx-generic 과 openvswitch 1.4.0 호환이 안되는 것이므로 다음과 같이 조치
openvswitch-datapath-dkms 대신 openvswitch-datapath-lts-raring-dkms 를 설치
 41  install_package make fakeroot dkms openvswitch-switch openvswitch-datapath-lts-raring-dkms linux-headers-$kernel_version

[ vi localrc ]
# Devstack localrc for Quantum all in one
# default
HOST_IP=192.168.230.136
SERVICE_HOST=192.168.230.136

# Compute 을 여러대 설치
MULTI_HOST=True

# Private subnet
FIXED_RANGE=10.0.0.0/24

# Nova-network service
#enable_service n-net
#FIXED_NETWORK_SIZE=256
#FLOATING_RANGE=192.168.75.192/26
#FLAT_INTERFACE=eth1
#PUBLIC_INTERFACE=eth0

# Neutron External subnet
NETWORK_GATEWAY=10.0.0.1
FLOATING_RANGE=192.168.75.0/24
PUBLIC_NETWORK_GATEWAY=192.168.75.2
Q_FLOATING_ALLOCATION_POOL=start=192.168.75.193,end=192.168.75.254

# Neutron configuration
Q_PLUGIN=ml2
Q_ML2_PLUGIN_TYPE_DRIVERS=local,flat,vlan,gre,vxlan
Q_ML2_TENANT_NETWORK_TYPE=vxlan
Q_ML2_PLUGIN_VXLAN_TYPE_OPTIONS=(vni_ranges=1001:2000)
Q_AGENT_EXTRA_AGENT_OPTS=(tunnel_types=vxlan vxlan_udp_port=8472)
Q_AGENT_EXTRA_SRV_OPTS=(local_ip=$HOST_IP)
#Q_AGENT=openvswitch
Q_ML2_PLUGIN_MECHANISM_DRIVERS=openvswitch,linuxbridge,l2population
Q_USE_NAMESPACE=True
Q_USE_SECGROUP=True

# Nova service
enable_service n-api
enable_service n-crt
enable_service n-obj
enable_service n-cpu
enable_service n-cond
enable_service n-sch
enable_service n-novnc
enable_service n-cauth

# Cinder service
enable_service cinder
enable_service c-api
enable_service c-vol
enable_service c-sch
enable_service c-bak

# Tempest service
enable_service tempest

# Neutron service
disable_service n-net
enable_service neutron
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_service q-lbaas

# Controller Node
Q_HOST=$SERVICE_HOST

# vnc
VNCSERVER_LISTEN=0.0.0.0
VNCSERVER_PROXYCLIENT_ADDRESS=$HOST_IP

# logs
DEST=/opt/stack
LOGFILE=$DEST/logs/stack.sh.log
SCREEN_LOGDIR=$DEST/logs/screen

# system password
ADMIN_PASSWORD=패스워드
MYSQL_PASSWORD=패스워드
RABBIT_PASSWORD=패스워드
SERVICE_PASSWORD=패스워드
SERVICE_TOKEN=admin

# Cinder configuration
VOLUME_GROUP="cinder-volumes"
VOLUME_NAME_PREFIX="volume-"

# Heat service
enable_service heat
enable_service h-api
enable_service h-api-cfn
enable_service h-api-cw
enable_service h-eng

# Murano service
enable_service murano
enable_service murano-api
enable_service murano-engine

# Ceilometer service
CEILOMETER_BACKEND=mongo
CEILOMETER_NOTIFICATION_TOPICS=notifications,profiler
enable_service ceilometer
enable_service ceilometer-acompute
enable_service ceilometer-acentral
enable_service ceilometer-collector
enable_service ceilometer-api
enable_service ceilometer-alarm-evaluator
enable_service ceilometer-alarm-notifier

# Swift service
enable_service s-proxy
enable_service s-object
enable_service s-container
enable_service s-account

# Trove service
enable_service trove
enable_service tr-api
enable_service tr-tmgr
enable_service tr-cond

# Images
# Use this image when creating test instances
IMAGE_URLS+=",http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img"
# Use this image when working with Orchestration (Heat)
IMAGE_URLS+=",https://download.fedoraproject.org/pub/fedora/linux/releases/23/Cloud/x86_64/Images/Fedora-Cloud-Base-23-20151030.x86_64.qcow2"

KEYSTONE_CATALOG_BACKEND=sql
API_RATE_LIMIT=False
SWIFT_HASH=testing
SWIFT_REPLICAS=1
VOLUME_BACKING_FILE_SIZE=70000M

#scheduler
SCHEDULER=nova.scheduler.filter_scheduler.FilterScheduler

# A clean install every time
#RECLONE=yes


[ Multi Node Compute 세팅 방법 ]
# vi localrc
HOST_IP=192.168.230.137
SERVICE_HOST=192.168.230.136

# Compute 을 여러대 설치
MULTI_HOST=True

# Neutron configuration
Q_PLUGIN=ml2
Q_ML2_PLUGIN_TYPE_DRIVERS=local,flat,vlan,gre,vxlan
Q_ML2_TENANT_NETWORK_TYPE=vxlan
Q_ML2_PLUGIN_VXLAN_TYPE_OPTIONS=(vni_ranges=1001:2000)
Q_AGENT_EXTRA_AGENT_OPTS=(tunnel_types=vxlan vxlan_udp_port=8472)
Q_AGENT_EXTRA_SRV_OPTS=(local_ip=$HOST_IP)
#Q_AGENT=openvswitch
Q_ML2_PLUGIN_MECHANISM_DRIVERS=openvswitch,linuxbridge,l2population
Q_USE_NAMESPACE=True
Q_USE_SECGROUP=True

# RabbitMQ, Compute
disable_all_services
enable_service rabbit
enable_service n-cpu
enable_service n-novnc

Nova-network Service
#enable_service n-net
#FIXED_RANGE=10.0.0.0/24
#FIXED_NETWORK_SIZE=256
#FLOATING_RANGE=192.168.75.192/26
#FLAT_INTERFACE=eth0
#PUBLIC_INTERFACE=eth0

Neutron L2 Service
enable_service neutron
enable_service q-agt

# Cinder service
enable_service cinder

# Cinder configuration
#enable_service c-vol
#VOLUME_GROUP="cinder-volumes"
#VOLUME_NAME_PREFIX="volume-"

# Controller Node
Q_HOST=$SERVICE_HOST
MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST

# vnc
VNCSERVER_LISTEN=0.0.0.0
VNCSERVER_PROXYCLIENT_ADDRESS=$HOST_IP

# logs
DEST=/opt/stack
LOGFILE=$DEST/logs/stack.sh.log
SCREEN_LOGDIR=$DEST/logs/screen

# system password
MYSQL_PASSWORD=패스워드
RABBIT_PASSWORD=패스워드

# A clean install every time
#RECLONE=yes

# vi /etc/nova/nova.conf 수정
neutron_admin_password = 패스워드
sql_connection = mysql://root:패스워드@192.168.230.136/nova?charset=utf8

# vi /etc/cinder/cinder.conf 수정
sql_connection = mysql://root:패스워드@192.168.230.136/cinder?charset=utf8
my_ip = 192.168.230.137




[ Murano 설치 ]
$ git clone git://git.openstack.org/openstack/murano
$ cd murano/contrib/devstack
$ cp lib/murano ${DEVSTACK_DIR}/lib
$ cp lib/murano-dashboard ${DEVSTACK_DIR}/lib
$ cp extras.d/70-murano.sh ${DEVSTACK_DIR}/extras.d


[ Heat OSprofiler enabled ]
$ echo -e "[profiler]\nprofiler_enabled = True\ntrace_sqlalchemy = True\n" >> /etc/heat/heat.conf

$ heat --profile SECRET_KEY stack-list
# it will print <Trace ID>

osprofiler trace show --html <Trace ID>


[ vi  localrc ]
git 프로토콜로 다운로드가 안될 경우 http 로 변경
GIT_BASE=http://git.openstack.org

[ devstack 설치 ]
./stack.sh


[ tempest 에러 시 해결 ]
$ wget https://pymox.googlecode.com/files/mox-0.5.3.tar.gz
$ tar xvf mox-0.5.3.tar.gz
$ cd mox-0.5.3
$ sudo python setup.py install

$ vi ~/.pydistutils.cfg
[easy_install]
index_url =  http://mirror.dfw.rax.openstack.org/pypi/simple
allow_hosts = *.openstack.org




[ public 연결 세팅 - Neutron ]
br-ex 에 gateway 192.168.75.2 가 추가되어 public ip 통신이 안되므로 삭제
VM과 외부 external 을 연결할려면 add-port 를 수행, 단 이렇게 하면 host 에서 외부연결이 안됨
sudo ip link set up br-int
sudo ip link set up br-tun
sudo ip addr del 192.168.75.2/24 dev br-ex
sudo ovs-vsctl add-port br-ex eth0
#ifconfig br-ex promisc up

[ host 와 인터넷 연결 세팅 - Neutron ]
host 에서 인터넷 연결을 할려면 del-port 를 수행
sudo ovs-vsctl del-port eth0

[ public 연결 세팅 - nova-network ]
eth1 의 host-only 네트워크에 대한 dhcp 를 끈다. 이걸 안끄면 vm 생성 시 내부 ip 가 192.168.230.x 대역을 받음
br100 은 eth1 내부 네트워크와만 연결되어야 하므로 br100 과 eth0 연결을 끊는다.
br100 이 eth0 로 부터 가져온 외부 네트워크 ip 는 eth0 에 돌려준다.
sudo brctl show br100
sudo brctl delif br100 eth0
sudo ip addr del 192.168.75.136/24 dev br100
sudo ip addr add 192.168.75.136/24 dev eth0

[ default gateway 수정 - nova-network ]
sudo route del -net 0.0.0.0/0 gw 192.168.208.2 dev br100
sudo route add -net 0.0.0.0/0 gw 192.168.208.2 dev eth0

[ cinder.conf  수정 - 메세지 호출을 위해서 ]
notification_driver=messagingv2


[ cli 호출 ]
. openrc admin demo

[ 서비스 start ]
screen -c stack-screenrc


[ default sec group rule 추가 ]
openstack security group rule create --proto icmp --src-ip 0.0.0.0/0 --dst-port -1 --ingress 5f7fe4ab-7069-490e-b95d-946a0148e523

openstack security group rule create --proto tcp --src-ip 0.0.0.0/0 --dst-port 1:65535 --ingress 5f7fe4ab-7069-490e-b95d-946a0148e523

[ nova boot ]
nova boot --flavor m1.tiny --image 32dc6f3e-83fc-4b18-ba08-c06a28bdac38 --nic net-id=7fa105b5-fcc7-4ce9-abbe-c49b867bb0b3  --key-name magnum-key --security-groups 6b84dbca-3e20-4ce5-9774-9c3128a2eb5f test-01


sudo ip netns
qrouter-0e8971de-9119-4bed-9c70-288a0ed15581
qdhcp-7fa105b5-fcc7-4ce9-abbe-c49b867bb0b3


[ vi stopnova.sh ]
서비스를 내리기 위해서 shell 작성
#!/bin/bash

rm -rf /opt/stack/status/stack/*

cd /usr/local/bin
for i in $( ls nova-* )
    do sudo kill -9 `ps aux | grep -v grep | grep $i  | awk '{print $2}'`
done

for i in $( ls cinder-* )
    do sudo kill -9 `ps aux | grep -v grep | grep $i  | awk '{print $2}'`
done

for i in $( ls keystone-* )
    do sudo kill -9 `ps aux | grep -v grep | grep $i  | awk '{print $2}'`
done

for i in $( ls glance-* )
    do sudo kill -9 `ps aux | grep -v grep | grep $i  | awk '{print $2}'`
done

for i in $( ls heat* )
    do sudo kill -9 `ps aux | grep -v grep | grep $i  | awk '{print $2}'`
done

for i in $( ls ceilometer* )
    do sudo kill -9 `ps aux | grep -v grep | grep $i  | awk '{print $2}'`
done

for i in $( ls trove* )
    do sudo kill -9 `ps aux | grep -v grep | grep $i  | awk '{print $2}'`
done

for i in $( ls neutron* )
    do sudo kill -9 `ps aux | grep -v grep | grep $i  | awk '{print $2}'`
done

for i in $( ls ovs* )
    do sudo kill -9 `ps aux | grep -v grep | grep $i  | awk '{print $2}'`
done


[ devstack 초기화 ]
./unstack.sh
./stopnova.sh

# 컴파일 소스 초기화
cd /opt/stack
find -name "*.pyc" | xargs rm

# VM 초기화
sudo rm -rf /etc/libvirt/qemu/inst*
sudo virsh list | grep inst | awk '{print $1}' | xargs -n1 virsh destroy

# br-tun 삭제
sudo ip link set dev br-tun down
sudo ovs-vsctl del-br br-tun

# vxlan device 삭제
sudo ip link delete dev vxlan_sys_4789

./clean.sh --all (필요시)
sudo apt-get purge mysql-server  (필요시)
sudo apt-get autoremove    (필요시)


[ 설치된 패키지 지우기 ]
# cd /usr/local/lib/python2.7/dist-packages
find -depth -maxdepth 1 -name "*swift*" | xargs sudo rm -rf


[ swift 가 실행안되는 오류 해결방안 ]
해당 포트로 떠 있는 프로세스를 찾아 죽인다.
netstat -apn | grep 6011
netstat -apn | grep 6012
netstat -apn | grep 6013       swift object server


[ cinder volume 없을 경우 새로 생성 ]
$ cd /opt/stack/data

$ sudo losetup -a
$ file /opt/stack/data/cinder-volumes-lvmdriver-1-backing-file

$ dd if=/dev/zero of=cinder-volumes-lvmdriver-1-backing-file bs=1 count=0 seek=10G ( 원하는 용량)
$ sudo losetup /dev/loop2 cinder-volumes-lvmdriver-1-backing-file
$ sudo fdisk /dev/loop2
#Type in the followings:
n
p
1
ENTER
ENTER
t
8e
w

$ sudo pvcreate /dev/loop2
$ vgcreate cinder-volumes-lvmdriver-1 /dev/loop2


[ br-tun, br-ex, br-int 가 ip a 로 안보일 때 ]
openvswitch restart 시킴
$ sudo service openvswitch-switch restart


[ Glance Image 가 DB 에는 보이나 file 이 Upload 되지 않았을 때 ]
$ sudo losetup -a

/dev/loop0: [2049]:1733858 (/opt/stack/data/swift/drives/images/swift.img)

/dev/loop1: [2049]:1733859 (/opt/stack/data/cinder-volumes-default-backing-file)

/dev/loop2: [2049]:1733860 (/opt/stack/data/cinder-volumes-lvmdriver-1-backing-file)


# swift 스토리지 마운트

$ sudo mount -t xfs -o loop,noatime,nodiratime,nobarrier,logbufs=8 /opt/stack/data/swift/drives/images/swift.img /opt/stack/data/swift/drives/sdb1


$ sudo losetup /dev/loop1 /opt/stack/data/cinder-volumes-default-backing-file
$ sudo losetup /dev/loop2 /opt/stack/data/cinder-volumes-lvmdriver-1-backing-file



# swift 스토리지 생성
$ mkfs.xfs -f -i size=1024 /opt/stack/data/swift/drives/images/swift.img

# image 가 없으면 image 업로드
$ . openrc
$ ./tools/upload_image.sh http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz

[ 서버가 뜰 때 자동으로 cinder-volume, swift 자동으로 연결하기 ]
$ sudo vi /etc/init.d/init-devstack

#! /bin/sh
### BEGIN INIT INFO
# Provides:          init-devstack
# Required-Start:
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Execute bind storage.
# Description:
### END INIT INFO

PATH=/sbin:/usr/sbin:/bin:/usr/bin

case "$1" in
  start)
    losetup /dev/loop1 /opt/stack/data/cinder-volumes-backing-file
    mount -t xfs -o loop,noatime,nodiratime,nobarrier,logbufs=8 /opt/stack/data/swift/drives/images/swift.img /opt/stack/data/swift/drives/sdb1
    ;;
  restart|reload|force-reload)
    echo "Error: argument '$1' not supported" >&2
    exit 3
    ;;
  stop)
    echo "Error: argument '$1' not supported" >&2
    exit 3
    ;;
  *)
    echo "Usage: $0 start" >&2
    exit 3
    ;;
esac

$ sudo  update-rc.d init-devstack defaults


[ nova-compute LOG 를 파일로 떨어뜨리고 싶을 때 ]
cd /opt/stack/nova && nohup /usr/local/bin/nova-compute > /opt/stack/logs/screen/nova-compute.log 2>&1 &



[ Ubuntu Server 14.04 Image Upload ]
이름 : Ubuntu Server 14.04 64-bit
경로 : http://uec-images.ubuntu.com/releases/14.04.2/14.04.2/ubuntu-14.04-server-cloudimg-amd64-disk1.img
포맷 : QCOW2 - QEMU Emulator
최소 디스크 : 5
최소 RAM : 1024

./tools/upload_image.sh http://uec-images.ubuntu.com/releases/14.04.2/14.04.2/ubuntu-14.04-server-cloudimg-amd64-disk1.img

glance image-update --min-disk 5 --min-ram 1024 5f1949a1-60da-475d-83a3-a4f49be35d77

아래 사이트 이미지 참고
http://cloud-images.ubuntu.com/lucid/current/lucid-server-cloudimg-amd64-disk1.img (Ubuntu Server 10.04 64-bit)
https://help.ubuntu.com/community/UEC/Images
http://uec-images.ubuntu.com/releases/


[ Source Contribution 방법 ]

# clone a project
git clone git://github.com/openstack/nova.git

# port 확인 (브라우저에서 확인)
https://review.openstack.org/ssh_info

# Testing Gerrit Connections
ssh -p 29418 StephenAhn@review.openstack.org

# Setting username
git config --global --add gitreview.username "StephenAhn"

# 단축 경로 저장
vi ~/.ssh/config
Host review
  Hostname review.openstack.org
  Port 29418
  User StephenAhn

# gerrit remote 확인
git review -s

# gerrit remote 확인 시 에러나면 remote 추가
git remote add gerrit ssh://StephenAhn@review.openstack.org:29418/openstack/nova.git

# 최신 소스로 다운받기
git remote update
git checkout master
git pull --ff-only origin master

# blueprint 채널 생성
git checkout -b bp/local-storage-volume-scheduling

# .mailmap 에 본인 email 추가
vi .mailmap
    <skanddh@gmail.com> <seungkyu.ahn@samsung.com>

# commit message 입력
git commit --amend

첫번째 라인은 50자 이내로 간단히 요약을 쓴다.
[공백라인]
설명을 적되 라인은 72자가 넘어가면 다음 라인에 쓴다.
.....
Implements: blueprint local-storage-volume-scheduling

Change-Id 는 자동으로 지정되므로 적지 않는다.

# git review 등록 (샘플 이외에 셋 중 아무거나 쓰면 됨)
# 샘플 양식
git push ssh://StephenAhn@review.openstack.org:29418/<Project Name> HEAD:refs/for/<Branch Name>

git push ssh://StephenAhn@review.openstack.org:29418/openstack/cinder HEAD:refs/for/bp/local-storage-volume-scheduling
git push review:openstack/cinder HEAD:refs/for/bp/local-storage-volume-scheduling
git review

# 아래 두 명령어가 같은 내용임
ssh -p 29418 review.openstack.org gerrit ls-projects
ssh review gerrit ls-projects



[ unittest 수행 ]
sudo apt-get install python-dev libssl-dev python-pip git-core libmysqlclient-dev libpq-dev
sudo apt-get install libxml2-dev libxslt-dev libvirt-dev
sudo apt-get install python-virtualenv testrepository


[ nova unit test ]
cd /opt/stack/nova
./run_tests.sh

# pep8 코딩 표준 테스트
./run_tests.sh -p

# netaddr>=0.7.6 에서 에러 발생 시
$ source .venv/bin/activate
$ wget https://github.com/downloads/drkjam/netaddr/netaddr-0.7.9.zip
$ unzip netaddr-0.7.9.zip
$ cd netaddr-0.7.9
$ python setup.py install

# ubuntu 12.04 에서 libvirt-python 1.2.5 설치 시 에러
ubuntu 12.04 에서는 libvirt 0.9.8 이 기본이므로 libvirt 1.2.0 으로 업그레이드 해야함
$ sudo apt-get update
sudo apt-get -y install \
    gcc \
    make \
    pkg-config \
    libxml2-dev \
    libgnutls-dev \
    libdevmapper-dev \
    libcurl4-gnutls-dev \
    python-dev \
    libpciaccess-dev \
    libxen-dev \
    libyajl-dev \
    libnl-dev

sudo mkdir -p /opt/libvirt
$ sudo chmod 00755 /opt/libvirt
$ sudo chown root:root /opt/libvirt
$ sudo chmod a+w /opt/libvirt
$ cd /opt/libvirt
$ wget http://libvirt.org/sources/libvirt-1.2.0.tar.gz
$ tar xzvf libvirt-1.2.0.tar.gz
$ mv libvirt-1.2.0 libvirt
$ cd libvirt
./configure \
    --prefix=/usr \
    --localstatedir=/var \
    --sysconfdir=/etc \
    --with-esx=yes \
    --with-xen=yes
$ make -j
$ sudo make install

$ ./run_tests.sh

[ 단위 모듈로 테스트 하기 ]
To run the tests in the cinder/tests/scheduler directory:
./run_tests.sh scheduler

To run the tests in the cinder/tests/test_libvirt.py file:
$ ./run_tests.sh test_libvirt

To run the tests in the HostStateTestCase class in cinder/tests/test_libvirt.py:
$ ./run_tests.sh test_libvirt.HostStateTestCase

To run the ToPrimitiveTestCase.test_dict test method in cinder/tests/test_utils.py:
$ ./run_tests.sh test_utils.ToPrimitiveTestCase.test_dict


[ tempest 테스트 ]

# 옛날 방식 
$ cd /opt/stack/tempest
$ nosetests tempest/scenario/test_network_basic_ops.py


# 최신 방식
$ cd /opt/stack/tempest
$ ostestr    혹은   testr


$ git clone https://github.com/openstack/tempest/
$ pip install tempest/
$ cd tempest
$ tempest init cloud-01
$ cd cloud-01
$ cp -r /opt/stack/tempest/etc/ .
$ ../run_tempest.sh -C etc/tempest.conf

# tempest.conf
[DEFAULT]
debug = True
log_file = tempest.log
use_stderr = False
use_syslog = False

[oslo_concurrency]
lock_path = /opt/stack/data/tempest

[compute]
fixed_network_name = private
ssh_connect_method = floating
flavor_ref_alt = 84
flavor_ref = 42
image_alt_ssh_user = cirros
image_ref_alt = 8bbeeb3d-fea4-43ee-8c27-5b1015693590
image_ref = 8bbeeb3d-fea4-43ee-8c27-5b1015693590
ssh_user = cirros
build_timeout = 196

[volume]
build_timeout = 196

[identity]
auth_version = v2
uri_v3 = http://192.168.230.161:5000/v3
uri = http://192.168.230.161:5000/v2.0/

[auth]
use_dynamic_credentials = True
tempest_roles = Member
admin_domain_name = Default
admin_tenant_id = b96b0deb693842b2a09a0d91832e41ea
admin_tenant_name = admin
admin_password = imsi00
admin_username = admin

[image-feature-enabled]
deactivate_image = True

[validation]
network_for_ssh = private
image_ssh_user = cirros
ssh_timeout = 196
ip_version_for_ssh = 4
run_validation = False
connect_method = floating

[compute-feature-enabled]
allow_duplicate_networks = True
attach_encrypted_volume = True
live_migrate_paused_instances = True
preserve_ports = True
api_extensions = all
block_migration_for_live_migration = False
change_password = False
live_migration = False
resize = True
max_microversion = latest

[network]
default_network = 10.0.0.0/24
public_router_id =
public_network_id = 9353aab8-5f65-4daa-8c30-d90b588ec36d
tenant_networks_reachable = false
api_version = 2.0

[network-feature-enabled]
api_extensions = all
ipv6_subnet_attributes = True
ipv6 = True

[orchestration]
stack_owner_role = _member_
build_timeout = 900
instance_type = m1.heat


[scenario]
large_ops_number = 0
img_file = cirros-0.3.4-x86_64-disk.img
aki_img_file = cirros-0.3.4-x86_64-vmlinuz
ari_img_file = cirros-0.3.4-x86_64-initrd
ami_img_file = cirros-0.3.4-x86_64-blank.img
img_dir = /home/stack/Documents/github/devstack/files/images/cirros-0.3.4-x86_64-uec

[telemetry-feature-enabled]
events = True

[object-storage-feature-enabled]
discoverable_apis = all

[volume-feature-enabled]
api_extensions = all
volume_services = True
incremental_backup_force = True

[dashboard]
dashboard_url = http://192.168.230.161/

[cli]
cli_dir = /usr/local/bin

[service_available]
trove = True
ironic = False
sahara = False
horizon = True
ceilometer = True
heat = True
swift = True
cinder = True
neutron = True
nova = True
glance = True
key = True





[ 최신 버전으로 설치 ]
# devstack 최신소스 다운로드
$ cd Git/devstack
$ git pull --ff-only origin master

# OpenStack 최신소스 다운로드
$ vi git_update.sh

#! /bin/bash

cd /opt/stack/ceilometer/
git checkout master
git pull origin master

cd /opt/stack/cinder/
git checkout master
git pull origin master

cd /opt/stack/cliff/
git checkout master
git pull origin master

cd /opt/stack/data/
git checkout master
git pull origin master

cd /opt/stack/glance/
git checkout master
git pull origin master

cd /opt/stack/heat/
git checkout master
git pull origin master

cd /opt/stack/horizon/
git checkout master
git pull origin master

cd /opt/stack/keystone/
git checkout master
git pull origin master

cd /opt/stack/logs/
git checkout master
git pull origin master

cd /opt/stack/neutron/
git checkout master
git pull origin master

cd /opt/stack/nova/
git checkout master
git pull origin master

cd /opt/stack/noVNC/
git checkout master
git pull origin master

cd /opt/stack/oslo.config/
git checkout master
git pull origin master

cd /opt/stack/oslo.messaging/
git checkout master
git pull origin master

cd /opt/stack/oslo.rootwrap/
git checkout master
git pull origin master

cd /opt/stack/oslo.vmware/
git checkout master
git pull origin master

cd /opt/stack/pbr/
git checkout master
git pull origin master

cd /opt/stack/pycadf/
git checkout master
git pull origin master

cd /opt/stack/python-ceilometerclient/
git checkout master
git pull origin master

cd /opt/stack/python-cinderclient/
git checkout master
git pull origin master

cd /opt/stack/python-glanceclient/
git checkout master
git pull origin master

cd /opt/stack/python-heatclient/
git checkout master
git pull origin master

cd /opt/stack/python-keystoneclient/
git checkout master
git pull origin master

cd /opt/stack/python-neutronclient/
git checkout master
git pull origin master

cd /opt/stack/python-novaclient/
git checkout master
git pull origin master

cd /opt/stack/python-openstackclient/
git checkout master
git pull origin master

cd /opt/stack/python-swiftclient/
git checkout master
git pull origin master

cd /opt/stack/requirements/
git checkout master
git pull origin master

cd /opt/stack/stevedore/
git checkout master
git pull origin master

cd /opt/stack/swift/
git checkout master
git pull origin master

cd /opt/stack/taskflow/
git checkout master
git pull origin master

cd /opt/stack/tempest/
git checkout master
git pull origin master


# devstack 재설치
$ ./stack.sh


[ 이전 Package 제거 ]
$ vi clean_package.sh

#! /bin/bash

cd /usr/local/lib/python2.7/dist-packages
find -depth -maxdepth 1 -name "*nova*" | xargs sudo rm -rf
find -depth -maxdepth 1 -name "*ceilometer*" | xargs sudo rm -rf
find -depth -maxdepth 1 -name "*cinder*" | xargs sudo rm -rf
find -depth -maxdepth 1 -name "*glance*" | xargs sudo rm -rf
find -depth -maxdepth 1 -name "*keystone*" | xargs sudo rm -rf
find -depth -maxdepth 1 -name "*horizon*" | xargs sudo rm -rf
find -depth -maxdepth 1 -name "*neutron*" | xargs sudo rm -rf
find -depth -maxdepth 1 -name "*oslo*" | xargs sudo rm -rf
find -depth -maxdepth 1 -name "*heat*" | xargs sudo rm -rf
find -depth -maxdepth 1 -name "*pbr*" | xargs sudo rm -rf
find -depth -maxdepth 1 -name "*pycadf*" | xargs sudo rm -rf
find -depth -maxdepth 1 -name "*openstackclient*" | xargs sudo rm -rf
find -depth -maxdepth 1 -name "*swift*" | xargs sudo rm -rf
find -depth -maxdepth 1 -name "*stevedore*" | xargs sudo rm -rf
find -depth -maxdepth 1 -name "*taskflow*" | xargs sudo rm -rf
find -depth -maxdepth 1 -name "*tempest*" | xargs sudo rm -rf



[ Volume Attach 시에 VM 안에서 Volume 을 인식 못할 때 ]
아래 명령을 수행한 후 /dev/vdb 가 보이는지 확인
# echo 1 > /sys/bus/pci/rescan 

[ root를 EBS Boot on Volume 으로 생성하면서 Volume Attach 를 할 경우 ]
# nova boot [name] --flavor [flavorid] --block-device id=[imageid],source=image,dest=volume,size=10,bootindex=0,shutdown=remove 
--block-device id=[volumeid],source=volume,dest=volume,size=100,bootindex=1

[ pip 패키지를 캐시에 다운로드만 하려고 할 때 (설치는 하지 않음) ]
# sudo pip install python-openstackclient --download=/var/cache/pip


[ cpu, memory overcommit 설정 ]
$ vi /etc/nova/nova.conf

scheduler_default_filters = RetryFilter,AvailabilityZoneFilter,CoreFilter,RamFilter,ComputeFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter
cpu_allocation_ratio = 16.0
ram_allocation_ratio = 100.0
disk_allocation_ratio = 100.0



[ vm 이 DNS를 찾는지 확인 ]
$ sudo tcpdump -i tap2404d0f1-25 -n -v udp port 53



[ vm 에 할당되는 DNS 변경 ]
$ neutron subnet-list
$ neutron subnet-update <subnet> --dns_nameservers list=true 8.8.8.8 8.8.4.4




[ Horizon 접속 시 no such table: django_session 에러가 날 때 ]
아래 명령으로 db 테이블을 생성해야 함
$ cd /opt/stack/horizon
$ python manage.py syncdb




[ Murano WordPress Package Import ]
$ export MURANO_REPO_URL=http://storage.apps.openstack.org
$ murano package-import io.murano.apps.WordPress

wordpress 접속
http://192.168.75.209/wordpress




[ OpenStack Source virtualenv pip install ]
$ mkdir -p ~/.pip
$ vi ~/.pip/pip.conf
[global]
#index-url=https://pypi.python.org/pypi/
#index-url=http://pypi.gocept.com/simple/
index-url=https://pypi.python.org/simple/

$ cd ~Documents/github/Virtualenvs
$ virtualenv mitaka
$ cd mitaka
$ . bin/activate
$ pip install -r requirements.txt --trusted-host pypi.python.org








반응형
Posted by seungkyua@gmail.com
,