---
title: 执行机密虚拟机热迁移
description: "1. 为启用迁移功能，可在源端服务器的QEMU启动参数中添加virtcca-migration-cap=1。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengcctrustzone/tee/cVMcont/kunpengtee_16_0016.html
sourcePath: /source/zh/kunpengcctrustzone/tee/cVMcont/kunpengtee_16_0016.html
indexId: eca77550b590ac7418da9d6b4f16ca23147b0972843f178993d20f17bc8f638765
---
# 执行机密虚拟机热迁移

1. 为启用迁移功能，可在源端服务器的QEMU启动参数中添加virtcca-migration-cap=1。

```
<qemu:commandline>
<qemu:arg value='-object'/>
<qemu:arg value='tmm-guest,id=tmm0,sve-vector-length=128,num-pmu-counters=1,
virtcca-migration-cap=1
'/>
</qemu:commandline>
```


2. 启动待迁移的虚拟机。

```
virsh start <cvm-name>
```


  cvm-name为待迁移虚拟机名称。

3. 执行以下命令进行机密虚拟机热迁移。

```
virsh migrate --live --verbose --copy-storage-all <cvm-name> --cvm-miguri <远端migcvm侦听ip> qemu+ssh://<dest-ip>/system
```

其中：

  - cvm-name为待迁移虚拟机名称。
  - dest-ip为对端服务器的IP地址。
  - --copy-storage-all用于非共享存储场景，迁移过程中全量复制虚拟机镜像文件到目标节点。
  - --verbose参数用于显示迁移进度，若增加了--copy-storage-all参数，则进度为两段，第一段为文件传输进度，第二段为热迁移进度。
    非共享存储场景迁移会提示以下错误。 error: Unsafe migration: Migration without shared storage is unsafe 可通过添加--unsafe参数规避。 virsh migrate --live --verbose --unsafe --copy-storage-all <cvm-name> --cvm-miguri <远端migcvm侦听ip> qemu+ssh://<dest-ip>/system
