使用devstack安装magnum

在redhat6.5上建立个centos7的虚拟机,使用centos7安装带magnum的devstack

systemctl stop firewalld
systemctl disable firewalld
iptables -F
关闭selinux

qemu-img create -f qcow2 zhycentos.img 500G 
qemu-img amend -f qcow2 -o compat=0.10 zhycentos.img 
virsh define zhycentos.xml
virsh start zhycentos

其中zhycentos.xml
内容为:
<domain type='kvm'>  
  <name>zhycentos</name>  
  <uuid>d06d7213-9b3d-f32e-f54a-70a82115242e</uuid>  
  <memory unit='KiB'>67108864</memory>  
  <currentMemory unit='KiB'>67108864</currentMemory>  
  <vcpu placement='static'>16</vcpu>  
  <os>  
    <type arch='x86_64' machine='pc'>hvm</type>  
    <boot dev='hd'/>  
     <bootmenu enable='yes'/>  
  </os>  
  <features>  
    <acpi/>  
    <apic/>  
    <pae/>  
  </features>  
  <clock offset='utc'/>  
  <on_poweroff>destroy</on_poweroff>  
  <on_reboot>restart</on_reboot>  
  <on_crash>restart</on_crash>  
  <devices>  
    <emulator>/usr/libexec/qemu-kvm</emulator>  
    <disk type='file' device='disk'>  
      <driver name='qemu' type='qcow2' cache='none'/>  
      <source file='/home/hao/zhycentos.img'/>  
      <target dev='vda' bus='virtio'/>  
    </disk>  
    <disk type='file' device='cdrom'>  
      <driver name='qemu' type='raw'/>  
      <source file='/home/CentOS-7-x86_64-DVD-1503-01.iso'/>  
      <target dev='hdc' bus='ide'/>  
      <readonly/>  
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>  
    </disk>  
    <controller type='usb' index='0'>  
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>  
    </controller>  
    <controller type='ide' index='0'>  
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>  
    </controller>  
    <interface type='bridge'>  
      <mac address='50:50:18:aa:83:81'/>  
      <source bridge='br0'/>  
      <model type='virtio'/>  
    </interface>  
    <serial type='pty'>  
      <target port='0'/>  
    </serial>  
    <console type='pty'>  
      <target type='serial' port='0'/>  
    </console>  
    <input type='mouse' bus='ps2'/>  
    <graphics type='vnc' port='5909' autoport='no' listen='0.0.0.0'>  
      <listen type='address' address='0.0.0.0'/>  
    </graphics>  
    <sound model='ich6'>  
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>  
    </sound>  
    <video>  
      <model type='cirrus' vram='9216' heads='1'/>  
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>  
    </video>  
    <memballoon model='virtio'>  
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>  
    </memballoon>  
  </devices>  
</domain> 



安装系统后
进入系统
dhclient获取ip
selinux,iptables关闭
yum update
yum install gcc gcc-c++
#不要乱yum乱七八糟的东西,会有版本冲突。
yum install -y git  # 安装git
cd /home
git clone https://github.com/openstack-dev/devstack.git 
 
cd /home/devstack/tools/    # devstack默认不能以root身份运行
./create-stack-user.sh      # 会创建一个stack用户
chown -R stack. /home/devstack


cd /home/devstack
cp /home/devstack/sample/local.conf .


修改local.conf为
[root@magnum devstack]# cat local.conf 
[[local|localrc]]
enable_plugin magnum https://github.com/openstack/magnum master

disable_service n-net
enable_service  q-svc
enable_service  q-agt
enable_service  q-dhcp
enable_service  q-l3
enable_service  q-meta
enable_service  tempest

HOST_IP=192.168.139.221
FIXED_RANGE=10.24.0.0/24
NETWORK_GATEWAY=10.24.0.1
LOGDAYS=2
LOGDIR=$DEST/logs
LOGFILE=$LOGDIR/stack.sh.log
SCREEN_LOGDIR=$LOGDIR/screen
ADMIN_PASSWORD=haoning
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SREVICE_PASSWORD=$ADMIN_PASSWORD
SERVICE_TOKEN=haoning
[root@magnum devstack]# 


运行stack.sh
如果出现python的版本问题
sudo pip install <模块名>==<版本号>

简单测试
cd /home/devstack
source ./openrc admin admin
nova list
neutron net-list
test -f ~/.ssh/id_rsa.pub || ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
nova keypair-add --pub-key ~/.ssh/id_rsa.pub testkey
nova keypair-list

NIC_ID=$(neutron net-show public |awk '/ id / {print $4}')
magnum baymodel-create --name kubernetes --image-id fedora-21-atomic-5 --keypair-id testkey --external-network-id $NIC_ID --dns-nameserver 8.8.8.8 --flavor-id m1.small --docker-volume-size 5 --coe kubernetes

magnum bay-create --name k8s_bay --baymodel kubernetes --node-count 1

magnum bay-list   

magnum bay-show 1743df67-1da4-455c-ae43-3f66596f5964



使用devstack安装magnum_第1张图片

你可能感兴趣的:(qemu,openstack,devstack)