openstack用nfs实现live migration

来源:互联网 发布:戴隐形眼镜游泳 知乎 编辑:程序博客网 时间:2024/05/21 06:29

1,实验环境:

10.0.0.102      controller

10.0.0.103      compute1

10.0.0.104      compute2   (附加的硬盘90G在compute2节点上 /dev/vdb )

10.0.0.105   network

10.0.0.106      compute3



2,mount附加硬盘

#mkfs.ext4 /dev/vdb

#mount  /dev/vdb  /mnt


3,compute2节点需要步骤

安装nfs服务

#apt-get install nfs-kernel-server


编辑/etc/exports

加入如下命令:

/mnt *(rw,sync,fsid=0,no_root_squash)


重启nfs服务:

/etc/init.d/nfs-kernel-server restart

4,compute1和compute3节点挂载nfs

编辑/etc/fstab加入:

compute2:/ /var/lib/nova/instances nfs4 defaults 0 0

挂载目录执行:

mount –a -v

nfs挂载结果如下:

compute1节点为例

root@compute1:/var/lib# df
Filesystem                  1K-blocks    Used Available Use% Mounted on
/dev/mapper/ubuntu--vg-root   8907816 2002564   6429708  24% /
none                                4       0         4   0% /sys/fs/cgroup
udev                          4077252       8   4077244   1% /dev
tmpfs                          817692     436    817256   1% /run
none                             5120       0      5120   0% /run/lock
none                          4088444       0   4088444   0% /run/shm
none                           102400       0    102400   0% /run/user
/dev/vda1                      240972   36905    191626  17% /boot
/dev/vdb                     52403200   32928  52370272   1% /var/local/osd0
compute2:/                   92760064   75776  87949312   1% /var/lib/nova/instances


最后将权限修改为nova:

#chown -R nova:nova nova/


5,compute1和compute3节点配置

编辑 /etc/libvirt/libvirtd.conf

加入

listen_tls = 0
listen_tcp = 1
auth_tcp="none"


编辑/etc/libvirt/qemu.conf

加入

vnc_listen = "0.0.0.0"
user = "root"
group = "root"


编辑/etc/default/libvirt-bin

修改为libvirtd_opts=" -d -l"


编辑/etc/init/libvirt-bin.conf

修改为env libvirtd_opts="-d -l"


6,重启服务:

#service libvirt-bin restart

#service nova-compute restart 

这样即配置好了。

7,演示





分别在compute1和compute3查看virsh list看结果


root@compute1:/var/lib# virsh list
 Id    Name                           State
----------------------------------------------------


root@compute3:/var/lib# virsh list
 Id    Name                           State
----------------------------------------------------
 7     instance-00000014              running


在虚机中可以用ping做连续运行测试,然后发现也是成功的。












0 0
原创粉丝点击