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-4mx85plan2j-vm-3696-prehook-mwqnl

      注意

      must-gather 归档文件中不包含空的或排除的日志文件。

VMware 迁移计划的 must-gather 归档结构示例

must-gather
└── namespaces
    ├── target-vm-ns
    │   ├── crs
    │   │   ├── datavolume
    │   │   │   ├── mig-plan-vm-7595-tkhdz.yaml
    │   │   │   ├── mig-plan-vm-7595-5qvqp.yaml
    │   │   │   └── mig-plan-vm-8325-xccfw.yaml
    │   │   └── virtualmachine
    │   │       ├── test-test-rhel8-2disks2nics.yaml
    │   │       └── test-x2019.yaml
    │   └── logs
    │       ├── importer-mig-plan-vm-7595-tkhdz
    │       │   └── current.log
    │       ├── importer-mig-plan-vm-7595-5qvqp
    │       │   └── current.log
    │       ├── importer-mig-plan-vm-8325-xccfw
    │       │   └── current.log
    │       ├── mig-plan-vm-7595-4glzd
    │       │   └── current.log
    │       └── mig-plan-vm-8325-4zw49
    │           └── current.log
    └── openshift-mtv
        ├── crs
        │   └── plan
        │       └── mig-plan-cold.yaml
        └── logs
            ├── forklift-controller-67656d574-w74md
            │   └── current.log
            └── forklift-must-gather-api-89fc7f4b6-hlwb6
                └── current.log
Copy to Clipboard Toggle word wrap

您可以从 Red Hat OpenShift web 控制台下载有关已完成的、失败或取消迁移计划的自定义资源(VM)的日志和信息。

流程

  1. 在 Red Hat OpenShift web 控制台中,点 Migration Plans for virtualization
  2. 点迁移计划名称旁的 Get logs
  3. Get logs 窗口中点 Get logs

    日志会被收集。此时会显示 Log collection complete 信息。

  4. Download logs 下载存档文件。
  5. 要下载迁移的虚拟机的日志,请点迁移计划名称,然后点 VM 的 Get logs

16.4.3. 从命令行访问日志和自定义资源信息

您可以使用 must-gather 工具从命令行访问自定义资源(CR)的日志和信息。您必须将 must-gather 数据文件附加到所有客户问题单。

您可以使用过滤选项收集特定命名空间、完成、失败或取消迁移的虚拟机(VM)的数据。

注意

如果您在过滤的 must-gather 命令中指定不存在的资源,则不会创建存档文件。

先决条件

  • 您必须以具有 cluster-admin 角色的用户身份登录到 OpenShift Virtualization 集群。
  • 已安装 Red Hat OpenShift CLI (oc)

流程

  1. 进入要存储 must-gather 数据的目录。
  2. 运行 oc adm must-gather 命令:

    $ oc adm must-gather --image=registry.redhat.io/migration-toolkit-virtualization/mtv-must-gather-rhel8:2.8.7
    Copy to Clipboard Toggle word wrap

    数据被保存为 /must-gather/must-gather.tar.gz。您可以将此文件上传到红帽客户门户网站中的支持问题单中。

  3. 可选:使用以下选项运行 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
      Copy to Clipboard Toggle word wrap
    • 迁移计划:

      $ 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 Toggle word wrap
    • 虚拟机:

      $ 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 Toggle word wrap
      1
      您必须指定虚拟机名称,而不是虚拟机 ID,因为它出现在 Plan CR 中。
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat