1.保证节点的nova用户id gid相同

  1. [root@compute ~]# id nova
  2. uid=162(nova) gid=162(nova) groups=162(nova),99(nobody),107(qemu)
  3. [root@controller ~]# id nova
  4. uid=162(nova) gid=162(nova) groups=162(nova),99(nobody),107(qemu)
  5. 如果不相同着修改uidgid
  6. # [root@compute ~]# usermod -u uid nova XXX
  7. # [root@compute ~]# gropumod -g gid nova XXX

2.修改libvirt配置文件

  1. vim /etc/sysconfig/libvirtd
  2. LIBVIRTD_CONFIG=/etc/libvirt/libvirtd.conf
  3. LIBVIRTD_ARGS="--listen"
  4. vim /etc/libvirt/libvirtd.conf
  5. listen_tls = 0
  6. listen_tcp = 1
  7. auth_tcp = "none"
  8. grep -vE '^#|^$' /etc/libvirt/libvirtd.conf
  9. 两个节点都重启服务:systemctl restart libvirtd.service
  10. 两个节点都检查端口:ss -ntl | grep 16509
  11. 再来测试下可否无密连接
  12. virsh -c qemu+tcp://compute/system

3.修改nova.conf配置文件,使其允许迁移。

  1. vi /etc/nova/nova.conf
  2. [libvirt]
  3. inject_key = True
  4. live_migration_flag = VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_TUNNELLED
  5. block_migration_flag = VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_NON_SHARED_INC
  6. live_migration_downtime = 500
  7. live_migration_downtime_steps = 10
  8. live_migration_downtime_delay = 75
  9. systemctl restart openstack-nova-compute libvirtd.service

4.开始迁移

  1. nova show test
  2. nova live-migration 02e0808d-dae1-42e9-ae91-0e0a00f0f524 compute