Skip to content

Improve the serialized SOAP error in CnsNodeVmAttachment/CnsNodeVmBatchAttachment #3663

@lubronzhan

Description

@lubronzhan

Context

VMOP consumes CnsNodeVmAttachment and CnsNodeVmBatchAttachment, sometimes the error returned inside contains serialized SOAP error, which contains things like OpIds and pointers that change on every failed reconcile attempt.

The OPID and pointers are not that useful, and if we simply add the content to VM.status.volume, then it cause unnecessary object update in every reconcile. Currently VMOP has following workaround to sanitize the error message. https://github.com/vmware-tanzu/vm-operator/blob/main/controllers/virtualmachine/volume/volume_controller.go#L1006-L1017

Example error message:

failed to attach cns volume: \"88854b48-2b1c-43f8-8889-de4b5ca2cab5\" to node vm: \"VirtualMachine:vm-42
[VirtualCenterHost: vc.vmware.com, UUID: 42080725-d6b0-c045-b24e-29c4dadca6f2, Datacenter: Datacenter
[Datacenter: Datacenter:datacenter, VirtualCenterHost: vc.vmware.com]]\".
fault: \"(*vimtypes.LocalizedMethodFault)(0xc003d9b9a0)({\\n DynamicData: (vimtypes.DynamicData)
{\\n },\\n Fault: (*vimtypes.ResourceInUse)(0xc002e69080)({\\n VimFault: (vimtypes.VimFault)
{\\n MethodFault: (vimtypes.MethodFault) {\\n FaultCause: (*vimtypes.LocalizedMethodFault)(\u003cnil\u003e),\\n
FaultMessage: ([]vimtypes.LocalizableMessage) \u003cnil\u003e\\n }\\n },\\n Type: (string) \\\"\\\",\\n Name:
(string) (len=6) \\\"volume\\\"\\n }),\\n LocalizedMessage: (string) (len=32)
\\\"The resource 'volume' is in use.\\\"\\n})\\n\". opId: \"67d69c68\""

Expectation

It would be best if CSI could sanitize the error message and remove the unnecessary opId/pointer. It might be arguable whether these things are necessary though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions