libvirt迁移实验

在zstack环境下,通过virsh直接迁移虚拟机,测试不同选项对虚拟机迁移的影响。

默认迁移

默认的迁移方式即managed direct migration方式,迁移命令:

1
2
3
4
5
$ time virsh migrate 83195712b6ce4368a8bd9d6dc65e438d qemu+tcp://172.31.6.12/system

real    0m6.589s
user    0m0.007s
sys     0m0.009s
1
2
3
4
5
$ time virsh migrate 83195712b6ce4368a8bd9d6dc65e438d qemu+tcp://172.31.6.11/system

real    0m6.741s
user    0m0.011s
sys     0m0.006s

direct选项

添加--direct选项对应Unmanaged direct migration方式,迁移命令:

1
2
3
4
5
6
$ time virsh migrate 83195712b6ce4368a8bd9d6dc65e438d tcp://172.31.6.11 --direct
error: argument unsupported: direct migration is not supported by the source host

real    0m0.014s
user    0m0.006s
sys     0m0.007s

QEMU的feature中不支持direct方式迁移

p2p选项

添加--p2p选项对应managed peer to peer migration方式,迁移命令:

1
2
3
4
5
$ time virsh migrate 83195712b6ce4368a8bd9d6dc65e438d qemu+tcp://172.31.6.11/system --p2p

real    0m6.598s
user    0m0.006s
sys     0m0.009s

tunnelled选项

添加--tunnelled可使用libvirt代理迁移,可使用加密功能,迁移命令:

1
2
3
4
5
$ time virsh migrate 83195712b6ce4368a8bd9d6dc65e438d qemu+tcp://172.31.6.11/system --p2p --tunnelled

real    0m6.606s
user    0m0.006s
sys     0m0.010s

模拟zstack默认迁移方式

1
$ time virsh migrate 83195712b6ce4368a8bd9d6dc65e438d qemu+tcp://172.31.6.11/system --live --p2p --undefinesource

在不开启converge的情况下添加xbzrle压缩

1
2
virsh qemu-monitor-command uuid --hmp info migrate
virsh domjobinfo uuid

managed direct

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
    "return": {
        "status": "completed", 
        "setup-time": 43, 
        "downtime": 30, 
        "total-time": 22004, 
        "ram": {
            "total": 8594989056, 
            "postcopy-requests": 0, 
            "dirty-sync-count": 5, 
            "page-size": 4096, 
            "remaining": 0, 
            "mbps": 507.311245, 
            "transferred": 1394795636, 
            "duplicate": 1765164, 
            "dirty-pages-rate": 0, 
            "skipped": 0, 
            "normal-bytes": 1376219136, 
            "normal": 335991
        }
    }, 
    "id": "libvirt-340"
}

{
    "return": {
        "status": "completed", 
        "setup-time": 43, 
        "downtime": 507, 
        "total-time": 23166, 
        "ram": {
            "total": 8594989056, 
            "postcopy-requests": 0, 
            "dirty-sync-count": 4, 
            "page-size": 4096, 
            "remaining": 0, 
            "mbps": 480.903634, 
            "transferred": 1392012875, 
            "duplicate": 1765147, 
            "dirty-pages-rate": 0, 
            "skipped": 0, 
            "normal-bytes": 1373442048, 
            "normal": 335313
        }
    }, 
    "id": "libvirt-152"
}

p2p no tunnel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
    "return": {
        "status": "completed", 
        "setup-time": 45, 
        "downtime": 240, 
        "total-time": 12287, 
        "ram": {
            "total": 8594989056, 
            "postcopy-requests": 0, 
            "dirty-sync-count": 4, 
            "page-size": 4096, 
            "remaining": 0, 
            "mbps": 905.988418, 
            "transferred": 1390921209, 
            "duplicate": 1765153, 
            "dirty-pages-rate": 0, 
            "skipped": 0, 
            "normal-bytes": 1372352512, 
            "normal": 335047
        }
    }, 
    "id": "libvirt-322"
}

{
    "return": {
        "status": "completed",
        "setup-time": 44, 
        "downtime": 201, 
        "total-time": 13705, 
        "ram": {
            "total": 8594989056, 
            "postcopy-requests": 0, 
            "dirty-sync-count": 4, 
            "page-size": 4096, 
            "remaining": 0, 
            "mbps": 811.73078, 
            "transferred": 1390032340, 
            "duplicate": 1765324, 
            "dirty-pages-rate": 0, 
            "skipped": 0, 
            "normal-bytes": 1371463680, 
            "normal": 334830
        }
    }, 
    "id": "libvirt-335"
}

p2p tunnelled

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
    "return": {
        "status": "completed", 
        "setup-time": 44, 
        "downtime": 195, 
        "total-time": 13336, 
        "ram": {
            "total": 8594989056, 
            "postcopy-requests": 0, 
            "dirty-sync-count": 4, 
            "page-size": 4096, 
            "remaining": 0, 
            "mbps": 836.807119, 
            "transferred": 1394393445, 
            "duplicate": 1765157, 
            "dirty-pages-rate": 0, 
            "skipped": 0, 
            "normal-bytes": 1375817728, 
            "normal": 335893
        }
    }, 
    "id": "libvirt-171"
}

{
    "return": {
        "status": "completed", 
        "setup-time": 44, 
        "downtime": 238, 
        "total-time": 14090, 
        "ram": {
            "total": 8594989056, 
            "postcopy-requests": 0, 
            "dirty-sync-count": 4,
            "page-size": 4096, 
            "remaining": 0, 
            "mbps": 790.127935,
            "transferred": 1391048672, 
            "duplicate": 1765144, 
            "dirty-pages-rate": 0, 
            "skipped": 0, 
            "normal-bytes": 1372479488, 
            "normal": 335078
        }
    },
    "id": "libvirt-99"
}

umanaged direct

QEMU do not support