git clone git://43.254.90.134
git pull 更新 进入git 目录
Vcenter -------->ESXI
路由转发功能 [root@room9pc01 ~]# cat /proc/sys/net/ipv4/ip_forward
virsh 虚拟机管理
– list [--all] 列出虚拟机
– start|shutdown|reboot 虚拟机启动,停止,重启
– destroy 强制停止虚拟机
– define|undefine 根据 xml 文件 创建/删除 虚拟机
– console 连接虚拟机的 console
– edit 修改虚拟机的配置
– autostart 设置虚拟机自启动
– domiflist 查看虚拟机网卡信息
– domblklist 查看虚拟机硬盘信息
– blockresize --path [绝对路径] --size 50G openstack
virsh 虚拟网络管理
– net-list [--all] 列出虚拟网络
– net-start
启动虚拟交换机
– net-destroy 强制停止虚拟交换机
– net-define 根据 xml 文件 创建虚拟网络
– net-undefine 删除一个虚拟网络设备
– net-edit
修改虚拟交换机的配置
– net-autostart 设置虚拟交换机机自启动
[root@room9pc01 ~]# lsmod | grep -i kvm
[root@room9pc01 nsd1902]# virsh list 查看正在运行虚拟机列表
[root@room9pc01 nsd1902]# virsh list --all 查看所有的
1.创建一台虚拟机
base-vm 虚拟机名称
2 启动虚拟机
virsh start 虚拟机名称 (启动虚拟机)
virsh console 虚拟机名称 (登录虚拟机)
virsh domblklist 虚拟机名称
qemu-img info 快设备
3 扩容磁盘
virsh blockresize --path 磁盘路径 --size 50G 虚拟机名称
[root@room9pc01 qemu]# virsh blockresize --path /var/lib/libvirt/images/b1.img --size 50G b1
4 分区扩容
进入虚拟机
]# LANG=C
]#growpart /dev/vda 1
6 扩容文件系统:
]# xfs_growfs /
原始盘 (后端盘) 918M 不能修改
前端盘
如果后端盘发生改变,则所有前端盘都需要重建。
[root@room9pc01 images]# qemu-img info tedu_node05.img
image: tedu_node05.img
file format: qcow2
virtual size: 30G (32212254720 bytes)
disk size: 320M
cluster_size: 65536
backing file: /var/lib/libvirt/images/.node_tedu.qcow2 # 后端文件
Format specific information:
compat: 1.1
lazy refcounts: false
[root@room9pc01 images]# ll -h /var/lib/libvirt/images/.node_tedu.qcow2
-rw-r--r--+ 1 qemu qemu 461M 4月 13 15:28 /var/lib/libvirt/images/.node_tedu.qcow2
virsh edit a1
<memory unit='KiB'>1488282</memory> 限制虚拟机使用的最大内存
<currentMemory unit='KiB'>1488282</currentMemory>
vbr 虚拟交换机
cd /var/lib/libvirt/images/
[root@room9pc01 images]# cd /etc/libvirt/qemu/
虚拟机的创建 nsd 1902
拷贝配置文件:
[root@room9pc01 qemu]# cp /var/lib/libvirt/images/.node_base.xml /etc/libvirt/qemu/nsd1902.xml
创建磁盘文件:
cd /var/lib/libvirt/images
root@room9pc01 images]# qemu-img create -f qcow2 -b .node_base.qcow2 nsd1902.img 30G
修改配置 名称 cpu 内存 硬盘 网卡
]#vim /etc/libvirt/qemu/nsd1902.xml
<name>nsd1902</name>
<source file='/var/lib/libvirt/images/nsd1902.img'/>
创建虚拟机
[root@room9pc01 images]# virsh define /etc/libvirt/qemu/nsd1902.xml
启动虚拟机
[root@room9pc01 images]# virsh start nsd1902
[root@room9pc01 images]# virsh console nsd1902
磁盘 img
配置文件 .xml
openstack管理虚拟机,, 虚拟机在重新创建虚拟机
真机 两个虚拟机 两个虚拟机里面创建两个虚拟机
openstack
glance 相当于yum 服务器
swift 数据的快速转发\
创建openstack
base-vm openstack
virsh domblklist openstack
virsh start openstack
337 virsh blockresize --path /var/lib/libvirt/images/openstack.img --size 50G openstack
338 virsh console openstack
virsh edit openstack
进入虚拟机
hostnamectl set-hostname openstack
]# LANG=C
]#growpart /dev/vda 1
扩容文件系统:
]# xfs_growfs /
[root@openstack ~]# free -m
[root@openstack ~]# cat /etc/resolv.conf
; generated by /usr/sbin/dhclient-script
nameserver 192.168.1.254
主机名要一直
[root@openstack ~]# cat /etc/host
192.168.1.10 openstack
192.168.1.11 nova01
192.168.1.12 nova02
[root@openstack ~]# vim /etc/chrony.conf
[root@openstack ~]# chronyc sources -v
真机操作:
]#/linux-soft/04/openstack
]#cd /var/ftp/
]#mkdir openstack
]#mkdir extras
]#mount /linux-soft/04/openstack/RHEL7OSP-10.iso openstack/
]#mount /linux-soft/04/openstack/RHEL7-extras.iso extras/
虚拟机配置yum源
[root@navo02 ~]# curl ftp://192.168.1.254/extras/
dr-xr-xr-x 2 0 0 14336 Mar 08 2017 Packages
-r--r--r-- 1 0 0 104 Mar 08 2017 comps.xml
dr-xr-xr-x 2 0 0 2048 Mar 08 2017 repodata
-r--r--r-- 1 0 0 9 Mar 08 2017 version.txt
[root@nova01 ~]# cat /etc/yum.repos.d/extras.repo
[extras_repo]
name= extras
baseurl="ftp://192.168.1.254/extras/"
enabled=1
gpgcheck=0
[root@openstack ~]# cat /etc/yum.repos.d/open1.repo
[open1_repo]
name= open1
baseurl="ftp://192.168.1.254/openstack/rhel-7-server-openstack-10-devtools-rpms/"
enabled=1
gpgcheck=0
[root@openstack ~]# cat /etc/yum.repos.d/open2.repo
[open2_repo]
name= open2
baseurl="ftp://192.168.1.254/openstack/rhel-7-server-openstack-10-rpms/"
enabled=1
gpgcheck=0
yum install -y qemu-kvm libvirt-client libvirt-
daemon libvirt-daemon-driver-qemu python-setuptools
检查环境
grep ssse3 /proc/cpuinfo
grep vmx /proc/cpuinfo
# yum install -y openstack-packstack
[root@openstack ~]# packstack --help | grep answer
[root@openstack ~]# packstack --gen-answer-file=answer.ini
vim answer.ini
• 修改应答文件
[root@openstack ~]# vim answer.ini
42: CONFIG_SWIFT_INSTALL=n
45: CONFIG_CEILOMETER_INSTALL=n
49: CONFIG_AODH_INSTALL=n
53: CONFIG_GNOCCHI_INSTALL=n
75: CONFIG_NTP_SERVERS=192.168.1.254
98: CONFIG_COMPUTE_HOSTS=192.168.1.11
102: CONFIG_NETWORK_HOSTS=192.168.1.10,192.168.1.11
333: CONFIG_KEYSTONE_ADMIN_PW=a
840: CONFIG_NEUTRON_ML2_TYPE_DRIVERS=flat,vxlan
910: CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=physnet1:br-ex
921: CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-ex:eth0
1179: CONFIG_PROVISION_DEMO=n
CONFIG_COMPUTE_HOSTS=192.168.1.11 在那台 nova1
CONFIG_NETWORK_HOSTS=192.168.1.10 , 11 nova网络
CONFIG_KEYSTONE_ADMIN_USERNAME=admin 用户
840 CONFIG_NEUTRON_ML2_TYPE_DRIVERS=flat,vxlan 支持什么协议 扁平网络
910 CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS= 定义虚拟交换机 三层的
920 # =br-ex:eth0
921 CONFIG_NEUTRON_OVS_BRIDGE_IFACES=
[root@openstack ~]# packstack --answer-file=answer.ini
**** Installation completed successfully ******
[root@openstack ~]# cd /etc/sysconfig/network-scripts/
[root@openstack ~]# ifconfig
br-ex: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 虚拟交换机
[root@openstack network-scripts]# cat ifcfg-br-ex
ONBOOT="yes"
NM_CONTROLLED="no"
IPADDR="192.168.1.10"
NETMASK="255.255.255.0"
GATEWAY="192.168.1.254"
DEVICE=br-ex
NAME=br-ex
DEVICETYPE=ovs
OVSBOOTPROTO="static"
TYPE=OVSBridge
[root@openstack network-scripts]# cat ifcfg-eth0
DEVICE=eth0
NAME=eth0
DEVICETYPE=ovs
TYPE=OVSPort
OVS_BRIDGE=br-ex
[root@openstack network-scripts]# ovs-vsctl show
[root@openstack ~]# cat keystonerc_admin
unset OS_SERVICE_TOKEN
export OS_USERNAME=admin
export OS_PASSWORD=a
export OS_AUTH_URL=http://192.168.1.10:5000/v2.0
export PS1='[\u@\h \W(keystone_admin)]\$ '
export OS_TENANT_NAME=admin
export OS_REGION_NAME=RegionOne
修改/etc/httpd/conf.d/15-horizon_vhost.conf 配置文
件,使其可以成功登录openstack
– /etc/httpd/conf.d/15-horizon_vhost.conf
threads=10 user=apache
WSGIProcessGroup apache
WSGIApplicationGroup %{GLOBAL} 添加这一行
[root@openstack ~]# openstack user list
Missing value auth-url required for auth plugin password
[root@openstack ~]# ls
answer.ini keystonerc_admin
[root@openstack ~]# bash
[root@openstack ~]# source keystonerc_admin
[root@openstack ~(keystone_admin)]#
[root@openstack ~(keystone_admin)]# openstack user list
openstack 修改已经创建用户的密码
[root@openstack ~(keystone_admin)]# openstack user set --password redhat uu
内部网络
名称 : wan
Flat 直连网络
物理网络
physnet1
)]# vim answer.ini
910 CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=physnet1:br-ex
外部网络:
切用户 uu