四.创建网络
[root@controller ~]# source admin-openrc
创建flat模式的public网络,注意这个public是外出网络,必须是flat模式的
[root@controller ~]# neutron --debug net-create --shared provider --router:external True --provider:network_type flat --provider:physical_network provider
创建public网络子网,名为public-sub,网段就是192.168.0,并且IP范围是80-90(这个一般是给VM用的floating IP了),dns设置
为192.168.0.254,网关为192.168.0.254
[root@controller ~]# neutron subnet-create provider 192.168.0.0/24 --name provider-sub --allocation-pool start=192.168.0.80,end=192.168.0.90 --dns-nameserver 192.168.0.254 --gateway 192.168.0.254
创建名为private的私有网络, 网络模式为vxlan
[root@controller ~]# neutron net-create private --provider:network_type vxlan --router:external False --shared
创建名为private-subnet的私有网络子网,网段为192.168.1.0, 这个网段就是虚拟机获取的私有的IP地址
[root@controller ~]# neutron subnet-create private --name private-subnet --gateway 192.168.1.1 192.168.1.0/24
五.创建路由,我们在界面上操作,如下图所示:
创建接口
##################################comtroller#################################
1.在controller创建实例类型
[root@controller ~]# openstack flavor create m1.tiny --id 1 --ram 512 --disk 1 --vcpus 1
[root@controller ~]# openstack flavor create m1.small --id 2 --ram 2048 --disk 20 --vcpus 1
[root@controller ~]# openstack flavor create m1.medium --id 3 --ram 4096 --disk 40 --vcpus 2
[root@controller ~]# openstack flavor create m1.large --id 4 --ram 8192 --disk 80 --vcpus 4
[root@controller ~]# openstack flavor create m1.xlarge --id 5 --ram 16384 --disk 160 --vcpus 8
2.检查nova部署是否正常
[root@controller ~]# nova-manage cell_v2 simple_cell_setup
Cell0 is already setup
[root@controller ~]# nova-manage cell_v2 list_cells --verbose
[root@controller ~]# nova-status upgrade check
3.在web端创建实例
搭建过程中出现的问题:
1.创建实例是出现错误,如上图所示错误: 实例 "test" 执行所请求操作失败,实例处于错误状态。: 请稍后再试 [错误: Failed to connect socket to '/var/run/libvirt/virtlogd-sock': No such file or directory].
解决方案:
在compute节点上
[root@compute ~]# yum -y install qemu libvirt virt-manager
[root@compute ~]# vi /etc/libvirt/libvirtd.conf
85 unix_sock_group = "libvirt"
92 unix_sock_ro_perms = "0777"
102 unix_sock_rw_perms = "0770"
141 auth_unix_ro = "none"
150 auth_unix_rw = "none"
[root@compute ~]# systemctl enable virtlogd.service
[root@compute ~]# systemctl start virtlogd.service
[root@compute ~]# systemctl status virtlogd.service
● virtlogd.service - Virtual machine log manager
Loaded: loaded (/usr/lib/systemd/system/virtlogd.service; indirect; vendor preset: disabled)
Active: active (running) since Tue 2017-06-06 17:23:34 CST; 7s ago
Docs: man:virtlogd(8)
http://libvirt.org
Main PID: 9256 (virtlogd)
CGroup: /system.slice/virtlogd.service
└─9256 /usr/sbin/virtlogd
Jun 06 17:23:34 compute systemd[1]: Started Virtual machine log manager.
Jun 06 17:23:34 compute systemd[1]: Starting Virtual machine log manager...
####在此创建虚拟机,如果现实运行中表示创建成功
进入控制台查看是否可以登录新创建的系统中
2.进入控制台后出现starting up ....,无法运行,如下图所示:
在compute查看nova服务是否正常,如下图所示显示,nova服务挂了,没有起来
[root@compute ~]# systemctl status openstack-nova-compute.service
查看日志发现nova-compute.log日志中显示
[root@compute ~]# cat /var/log/nova/nova-compute.log | grep ERROR
2017-06-06 17:50:46.173 12295 ERROR nova.virt.libvirt.host libvirtError: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
2017-06-06 17:50:46.195 12295 ERROR oslo_service.service HypervisorUnavailable: Connection to the hypervisor is broken on host: compute
解决方案:
[root@compute ~]# chmod -R 777 /var/run/libvirt
然后在重启nova服务
[root@compute ~]# systemctl restart openstack-nova-compute.service
[root@compute ~]# systemctl status openstack-nova-compute.service
● openstack-nova-compute.service - OpenStack Nova Compute Server
Loaded: loaded (/usr/lib/systemd/system/openstack-nova-compute.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2017-06-06 17:51:32 CST; 1s ago
Main PID: 12381 (nova-compute)
CGroup: /system.slice/openstack-nova-compute.service ├─12381 /usr/bin/python2 /usr/bin/nova-compute
├─12412 sudo nova-rootwrap /etc/nova/rootwrap.conf privsep-helper --config-file /usr/share/nova/nova-dist.conf --config-file /etc/nova/nova.conf --privsep_context vif_plug_linux...
├─12413 /usr/bin/python2 /usr/bin/nova-rootwrap /etc/nova/rootwrap.conf privsep-helper --config-file /usr/share/nova/nova-dist.conf --config-file /etc/nova/nova.conf --privsep_c...
└─12414 /usr/bin/python2 /bin/privsep-helper --config-file /usr/share/nova/nova-dist.conf --config-file /etc/nova/nova.conf --privsep_context vif_plug_linux_bridge.privsep.vif_p...
Jun 06 17:51:21 compute systemd[1]: Starting OpenStack Nova Compute Server...
Jun 06 17:51:32 compute systemd[1]: Started OpenStack Nova Compute Server.
Jun 06 17:51:33 compute sudo[12412]: nova : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/nova-rootwrap /etc/nova/rootwrap.conf privsep-helper --config-file /usr/share/no.../privsep.sock
Hint: Some lines were ellipsized, use -l to show in full.
重新创建虚拟机后显示正常,如下图所示:
3.创建后虚拟机后绑定浮动IP地址后,分配的内网地址是不能ping通和访问的,需要添加安全组策略,选择管理规则如图所示:
选择添加规则,规则为:所有ICMP协议,然后选择添加。
添加ssh协议,选择添加。
用xshell访问,如下图所示:表示成功。
4.添加虚拟机后刷新页面创建的实例消失了,显示实例为空。
解决方案:重启controller上的nova服务
[root@controller ~]# systemctl restart openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。