16.4. 日志和自定义资源
您可以下载日志和自定义资源 (CR) 信息以进行故障排除。如需更多信息,请参阅详细的迁移工作流。
16.4.1. 收集日志和自定义资源信息 复制链接链接已复制到粘贴板!
您可以使用 Red Hat OpenShift Web 控制台或命令行界面(CLI)为以下目标下载日志和自定义资源(CR) yaml
文件:
- 迁移计划:Web 控制台或 CLI。
- 虚拟机:Web 控制台或 CLI.
- 命名空间:仅限 CLI。
must-gather
工具会在存档文件中收集以下日志和 CR 文件:
CR:
-
DataVolume
CR:代表在迁移的虚拟机中挂载的磁盘。 -
VirtualMachine
CR:代表一个迁移的虚拟机。 -
Plan
CR:定义 VM 和存储和网络映射。 -
Job
CR:可选:代表迁移前 hook、迁移后 hook 或两者。
-
日志:
-
Importer
pod: Disk-to-data-volume 转换日志。importer
pod 的命名格式是importer-<migration_plan>-<vm_id><5_char_id>
,例如importer-mig-plan-ed90dfc6-9a17-4a8btnfh
,其中ed90dfc6-9a17-4a8
是经过裁剪的 RHV VM ID,btnfh
是生成的 5 个字符的 ID。 -
conversion
pod:虚拟机转换日志.conversion
pod 运行virt-v2v
,它会在虚拟机的 PVC 中安装和配置设备驱动程序。conversion
pod 的命名格式是<migration_plan>-<vm_id><5_char_id>
。 -
virt-launcher
pod:VM launcher 日志.当迁移的虚拟机被开启后,virt-launcher
Pod 运行QEMU-KVM
,并附加了作为虚拟机磁盘的 PVC。 -
forklift-controller
pod:针对must-gather
命令指定的迁移计划、虚拟机或命名空间过滤日志。 -
forklift-must-gather-api
pod:日志针对must-gather
命令指定的迁移计划、虚拟机或命名空间过滤。 hook-job
pod:针对 hook 任务过滤日志。hook-job
命名约定是 <migration_plan>-<vm_id><5_char_id
>,例如plan2j-vm-3696-posthook-4mx85
或plan2j-vm-3696-prehook-mwqnl
。注意must-gather
归档文件中不包含空的或排除的日志文件。
-
VMware 迁移计划的 must-gather 归档结构示例
16.4.2. 从 web 控制台下载日志和自定义资源信息 复制链接链接已复制到粘贴板!
您可以从 Red Hat OpenShift web 控制台下载有关已完成的、失败或取消迁移计划的自定义资源(VM)的日志和信息。
流程
-
在 Red Hat OpenShift web 控制台中,点 Migration
Plans for virtualization。 - 点迁移计划名称旁的 Get logs。
在 Get logs 窗口中点 Get logs。
日志会被收集。此时会显示
Log collection complete
信息。- 点 Download logs 下载存档文件。
- 要下载迁移的虚拟机的日志,请点迁移计划名称,然后点 VM 的 Get logs。
16.4.3. 从命令行访问日志和自定义资源信息 复制链接链接已复制到粘贴板!
您可以使用 must-gather
工具从命令行访问自定义资源(CR)的日志和信息。您必须将 must-gather
数据文件附加到所有客户问题单。
您可以使用过滤选项收集特定命名空间、完成、失败或取消迁移的虚拟机(VM)的数据。
如果您在过滤的 must-gather
命令中指定不存在的资源,则不会创建存档文件。
先决条件
-
您必须以具有
cluster-admin
角色的用户身份登录到 OpenShift Virtualization 集群。 -
已安装 Red Hat OpenShift CLI (
oc
)。
流程
-
进入要存储
must-gather
数据的目录。 运行
oc adm must-gather
命令:oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.8.7
$ oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.8.7
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 数据被保存为
/must-gather/must-gather.tar.gz
。您可以将此文件上传到红帽客户门户网站中的支持问题单中。可选:使用以下选项运行
oc adm must-gather
命令来收集过滤的数据:命名空间:
oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.8.7 \ -- NS=<namespace> /usr/bin/targeted
$ oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.8.7 \ -- NS=<namespace> /usr/bin/targeted
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 迁移计划:
oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.8.7 \ -- PLAN=<migration_plan> /usr/bin/targeted
$ oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.8.7 \ -- PLAN=<migration_plan> /usr/bin/targeted
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 虚拟机:
oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.8.7 \ -- VM=<vm_name> NS=<namespace> /usr/bin/targeted
$ oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.8.7 \ -- VM=<vm_name> NS=<namespace> /usr/bin/targeted
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- 您必须指定虚拟机名称,而不是虚拟机 ID,因为它出现在
Plan
CR 中。