本次测试采用如下配置
主机名 | 配置 | IP地址 |
---|---|---|
controller | 4G4核 | 192.168.100.10 |
compute | 4G4核 | 192.168.100.20 |
# 1.编辑/etc/sysconfig/libvirtd文件
# 2.编辑/etc/libvirtd/libvirtd.conf文件
# 3.重启libvirtd服务
# 4.测试virsh链接
# 5.编辑/etc/nova/nova.conf文件
# 6.重启nova服务
# 7.开始热迁移
# 8.检查
1.编辑/etc/sysconfig/libvirtd文件
[root@controller ~]# vi /etc/sysconfig/libvirtd
# Override the default config file
# NOTE: This setting is no longer honoured if using
# systemd. Set '--config /etc/libvirt/libvirtd.conf'
# in LIBVIRTD_ARGS instead.
LIBVIRTD_CONFIG=/etc/libvirt/libvirtd.conf
# Listen for TCP/IP connections
# NB. must setup TLS/SSL keys prior to using this
LIBVIRTD_ARGS="--listen"
[root@compute ~]# vi /etc/sysconfig/libvirtd
# Override the default config file
# NOTE: This setting is no longer honoured if using
# systemd. Set '--config /etc/libvirt/libvirtd.conf'
# in LIBVIRTD_ARGS instead.
LIBVIRTD_CONFIG=/etc/libvirt/libvirtd.conf
# Listen for TCP/IP connections
# NB. must setup TLS/SSL keys prior to using this
LIBVIRTD_ARGS="--listen"
+
+
+
+
+
+
2.编辑/etc/libvirtd/libvirtd.conf文件
22 listen_tls = 0
23
24 # Listen for unencrypted TCP connections on the public TCP/IP port.
25 # NB, must pass the --listen flag to the libvirtd process for this to
26 # have any effect.
27 #
28 # Using the TCP socket requires SASL authentication by default. Only
29 # SASL mechanisms which support data encryption are allowed. This is
30 # DIGEST_MD5 and GSSAPI (Kerberos5)
31 #
32 # This is disabled by default, uncomment this to enable it.
33 listen_tcp = 1
163 auth_tcp = "none"
3.重启libvirtd服务
[root@controller ~]# systemctl restart libvirtd
[root@controller ~]# systemctl restart libvirtd
4.测试virsh链接
[root@controller ~]# virsh -c qemu+tcp://compute/system
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh #
[root@conmpute ~]# virsh -c qemu+tcp://controller/system
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh #
5.编辑/etc/nova/nova.conf文件
两个节点都需要操作
3734 live_migration_flag=VIR_MIGRATE_UNDEFINE_SOURCE, VIR_MIGRATE_PEER2PEER, VIR_MIGRATE_LIVE, VIR_MIGRATE_TUNNELLED
3735
3736 # Migration flags to be set for block migration (string value)
3737 # This option is deprecated for removal.
3738 # Its value may be silently ignored in the future.
3739 # Reason: The correct block migration flags can be inferred from the new
3740 # live_migration_tunnelled config option. block_migration_flag will be removed
3741 # to avoid potential misconfiguration.
3742 block_migration_flag=VIR_MIGRATE_UNDEFINE_SOURCE, VIR_MIGRATE_PEER2PEER, VIR_MIGRATE_LIVE, VIR_MIGRATE_NON_SHARED_INC
6重启nova服务
dd[root@controller ~]# systemctl restart openstack-nova*
[root@compute ~]# systemctl restart openstack-nova*
7.开始热迁移
查看实例ID (这里的test为实例名称)
[root@controller ~]# nova show test |awk -F '|' NR==29'{print $3}'
7a3ba94d-da58-4108-b927-29d3469da357
开始迁移(这里的test实例原本在compute节点,这里需要热迁移到controller节点)
[root@controller ~]# nova live-migration 7a3ba94d-da58-4108-b927-29d3469da357 controller
8.检查
[root@controller ~]# nova show test
+--------------------------------------+----------------------------------------------------------+
| Property | Value |
+--------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | controller |
| OS-EXT-SRV-ATTR:hostname | test |
| OS-EXT-SRV-ATTR:hypervisor_hostname | controller |
| OS-EXT-SRV-ATTR:instance_name | instance-00000004 |
| OS-EXT-SRV-ATTR:kernel_id | |
| OS-EXT-SRV-ATTR:launch_index | 0 |
| OS-EXT-SRV-ATTR:ramdisk_id | |
| OS-EXT-SRV-ATTR:reservation_id | r-coe0peip |
| OS-EXT-SRV-ATTR:root_device_name | /dev/vda |
| OS-EXT-SRV-ATTR:user_data | - |
| OS-EXT-STS:power_state | 1 |
| OS-EXT-STS:task_state | - |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2019-11-05T07:00:26.000000 |
| OS-SRV-USG:terminated_at | - |
| accessIPv4 | |
| accessIPv6 | |
| config_drive | |
| created | 2019-11-05T06:59:24Z |
| description | - |
| flavor | m1.small (2) |
| hostId | 8ffe301f6f31cde750b8a8ce296684831da56b737e0ef3580d86f305 |
| host_status | UP |
| id | 7a3ba94d-da58-4108-b927-29d3469da357 |
| image | centos7.2 (8d98c502-70ee-44d1-8c75-bfef2d1ca444) |
| int-net network | 10.0.0.6 |
| key_name | - |
| locked | False |
| metadata | {} |
| name | test |
| os-extended-volumes:volumes_attached | [] |
| progress | 0 |
| security_groups | default |
| status | ACTIVE |
| tenant_id | 01bf9902a50c4fddb601a0e3edf37c32 |
| updated | 2019-11-05T11:11:16Z |
| user_id | 8a163fbfcf80471883d1c3d34ae2aeef |
+--------------------------------------+----------------------------------------------------------+