跳转到主内容

删除 OpenShift Virtualization VM 后,Trident 卷陷入删除状态

Views:
7
Visibility:
Public
Votes:
0
Category:
astra_trident
Specialty:
astra
Last Updated:

适用于

  • NetApp Trident 26.02
  • OpenShift Container Platform (OCP) 4.x
  • OpenShift Virtualization (OCP Virt) 4.x

问题

在 OpenShift Virtualization 中删除虚拟机 (VM) 后,一个或多个 Trident PVC 仍卡在 volumeState=deleting 中无限期停留,并且永远不会被回收。
  • tridentctl get volumes -n trident 显示处于 deleting 状态且不进展的卷。
  • Trident 控制器日志包含:
    • level=warning msg="Backend update resulted in an orphaned volume." backend=<backend-name> vol.Config.InternalName=trident_<backend>_pvc_<uuid> volume=pvc-<uuid> workflow="cr=reconcile"
    • Tridentlevel=debug msg="Updating an existing volume." volume=pvc-<uuid> volumeState=deleting volume_orphaned=true workflow="cr=reconcile"
    • level=debug msg="Attempting snapshot delete."backend=<backend-name> snapshotName=snapshot-<uuid> volumeName=pvc-<uuid>
      workflow="snapshot=delete"
    • level=warning msg="Retried locked snapshot delete, clone split timer not yet expired." logLayer=core requestID=<id> requestSource=CSI secondsBeforeSplit=86366.62 snapshot=pvc-<uuid>
  • VolumeSnapshot 对象 (vmsnapshot-*) 在 VM 删除后仍保留在命名空间中。
  • 在虚拟机创建率高的环境中,Trident 控制器的性能也可能会下降(tridentctl 响应缓慢、超时)。

原因

  • 在 OpenShift 虚拟化 (OCP Virt) 中删除 VM 时,其关联的 VolumeSnapshot 对象 (vmsnapshot-*) 不会自动删除。每个剩余的 VolumeSnapshot 都包含一个 Kubernetes 终结器链,用于阻止 Trident 卷删除级联:
          VolumeSnapshot
            → VolumeSnapshotContent (bound-protection finalizer)
              → TridentSnapshot (trident.netapp.io finalizer)
                → ONTAP snapshot
                  → TridentVolume stuck in deleting
  • 在 Trident 26.02 中,cloneSplitDelay 参数默认为 86400 秒(24 小时)。 

解决方案

    警告

    在删除快照之前,确认不再需要虚拟机。删除 VolumeSnapshot 会触发级联删除 VolumeSnapshotContent 和 TridentSnapshot,如果没有其他终结器阻塞。

     对每个卡住的卷重复以下步骤。

    1. 通过识别和删除受影响命名空间中的任何 vmsnapshot-* 对象来删除 OCP Virt VolumeSnapshot 对象(如果存在):
      1. oc get volumesnapshot -n <namespace>
      2. oc delete volumesnapshot <vmsnapshot-name> -n <namespace>
    2. 删除孤立的 ONTAP 快照:
      1. 检查 ONTAP 卷上直接剩余的快照: snapshot show -vserver <svm> -volume <trident_internal_volume_name>
      2. 删除任何 Busy=false 且没有相应 Kubernetes 对象的快照: snap delete -vserver <svm> -volume <trident_internal_volume_name> -snapshot <snapshot_name>
    3. 在 OCP Virt 工作负载使用的所有 Trident 后端配置中将 cloneSplitDelay 减少到 300 秒:(这确保克隆拆分在 5 分钟内完成,大大缩短了源 VM 删除可能触发卷停滞的时间窗口。)
      1. "cloneSplitDelay": 300
    4. 升级到 Trident 26.06(如果可用)

    合作伙伴备注

    partnerNotes_text

    追加信息

    在从模板创建 VM 期间,Trident 会为每个 PVC 创建快照和克隆;该快照预计会在克隆拆分完成后自动删除。对于 86400s 延迟,如果在拆分窗口关闭之前删除源 VM,则快照会保留,从而阻止删除链。在具有许多 VM 的环境中,这会导致大量搁浅快照,从而降低 Trident 控制器的性能。

    内部参考

    如果 ONTAP 卷和快照已消失,但卷仍处于删除状态,请从 TridentSnapshot 和 TridentVolume CRD 中删除终结器:

    • 要查找给定 PVC 的 TridentSnapshot 名称:
      • kubectl get tridentsnapshot -n trident | grep <pvc-name>
      • kubectl patch tridentsnapshot <snapshot-name> -n trident \
          -p '{"metadata":{"finalizers":[]}}' --type=merge
      • kubectl delete tridentsnapshot <snapshot-name> -n trident
        kubectl patch tridentvolume <pvc-name> -n trident \
          -p '{"metadata":{"finalizers":[]}}' --type=merge
      • kubectl delete tridentvolume <pvc-name> -n trident

    Bug TRID-19333: https://jira.ngage.netapp.com/browse/TRID-19333

    Sign in to view the entire content of this KB article.

    New to NetApp?

    Learn more about our award-winning Support

    NetApp provides no representations or warranties regarding the accuracy or reliability or serviceability of any information or recommendations provided in this publication or with respect to any results that may be obtained by the use of the information or observance of any recommendations provided herein. The information in this document is distributed AS IS and the use of this information or the implementation of any recommendations or techniques herein is a customer's responsibility and depends on the customer's ability to evaluate and integrate them into the customer's operational environment. This document and the information contained herein may be used solely in connection with the NetApp products discussed in this document.