19.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.9.4
$ oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.9.4
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.9.4 \ -- NS=<namespace> /usr/bin/targeted
$ oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.9.4 \ -- 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.9.4 \ -- PLAN=<migration_plan> /usr/bin/targeted
$ oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.9.4 \ -- 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.9.4 \ -- VM=<vm_name> NS=<namespace> /usr/bin/targeted
$ oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.9.4 \ -- VM=<vm_name> NS=<namespace> /usr/bin/targeted
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- 您必须指定虚拟机名称,而不是虚拟机 ID,因为它出现在
Plan
CR 中。