Skip to content

wish instance-ensure body was not logged in a completely unusable way #1057

@hawkw

Description

@hawkw

when propolis-server receives an InstanceEnsure request, we appear to log it by...formatting the Rust struct as a string, and then debug-printing the string, so that all of the newlines in the thing that ultimately gets logged are escaped, but the quoted strings inside the fmt::Debug output are not escaped, meaning that it's really annoying to actually turn the weird illegible trash that gets logged in one giant line into something that a person can actually reasonably interpret.. for example, in my terminal, it looks like this:

Image

here is the actual ASCII text of the log line but again, be advised that this is going to be one extremely long line:

21:24:58.187Z INFO propolis-server (vm_state_driver): initializing new VM
    bootrom = /opt/oxide/propolis-server/blob/OVMF_CODE.fd
    properties = InstanceProperties {\n    id: 713603af-116a-42fc-bb75-e34734d4452d,\n    name: "my-computer",\n    description: "Omicron-managed VM",\n    metadata: InstanceMetadata {\n        silo_id: 7bd7623a-68ed-4636-8ecb-b59e3b068787,\n        project_id: 50d839b4-2d18-49c0-94cf-7d6883e00178,\n        sled_id: dd83e75a-1edf-4aa1-89a0-cd8b2091a7cd,\n        sled_serial: "BRM42220016",\n        sled_revision: 6,\n        sled_model: "913-0000019",\n    },\n}
    spec = Spec {\n    board: Board {\n        cpus: 2,\n        memory_mb: 8192,\n        chipset: I440Fx(\n            I440Fx {\n                enable_pcie: false,\n            },\n        ),\n        guest_hv_interface: Bhyve,\n    },\n    cpuid: CpuidSet {\n        map: CpuidMap(\n            {\n                0: Absent(\n                    CpuidValues {\n                        eax: 13,\n                        ebx: 1752462657,\n                        ecx: 1145913699,\n                        edx: 1769238117,\n                    },\n                ),\n                1: Absent(\n                    CpuidValues {\n                        eax: 10489617,\n                        ebx: 2048,\n                        ecx: 4141363715,\n                        edx: 126614527,\n                    },\n                ),\n                5: Absent(\n                    CpuidValues {\n                        eax: 0,\n                        ebx: 0,\n                        ecx: 0,\n                        edx: 0,\n                    },\n                ),\n                6: Absent(\n                    CpuidValues {\n                        eax: 4,\n                        ebx: 0,\n                        ecx: 0,\n                        edx: 0,\n                    },\n                ),\n                7: Present(\n                    {\n                        0: CpuidValues {\n                            eax: 0,\n                            ebx: 563610537,\n                            ecx: 1536,\n                            edx: 16,\n                        },\n                        1: CpuidValues {\n                            eax: 0,\n                            ebx: 0,\n                            ecx: 0,\n                            edx: 0,\n                        },\n                    },\n                ),\n                13: Present(\n                    {\n                        0: CpuidValues {\n                            eax: 7,\n                            ebx: 832,\n                            ecx: 832,\n                            edx: 0,\n                        },\n                        1: CpuidValues {\n                  eax: 7,\n                            ebx: 832,\n                            ecx: 0,\n                            edx: 0,\n                        },\n                        2: CpuidValues {\n                            eax: 256,\n                            ebx: 576,\n                            ecx: 0,\n                            edx: 0,\n                        },\n                    },\n                ),\n                2147483648: Absent(\n                    CpuidValues {\n                        eax: 2147483681,\n                        ebx: 1752462657,\n                        ecx: 1145913699,\n                        edx: 1769238117,\n                    },\n                ),\n                2147483649: Absent(\n                    CpuidValues {\n                        eax: 10489617,\n                        ebx: 1073741824,\n                        ecx: 1145045497,\n                        edx: 634649599,\n                    },\n                ),\n                2147483650: Absent(\n                    CpuidValues {\n   eax: 541347137,\n                        ebx: 1129926725,\n                        ecx: 825702176,\n                        edx: 908087347,\n                    },\n                ),\n                2147483651: Absent(\n                    CpuidValues {\n                        eax: 1866673460,\n                        ebx: 1344300402,\n                        ecx: 1701015410,\n                        edx: 1919906675,\n                    },\n                ),\n                2147483652: Absent(\n                    CpuidValues {\n                        eax: 538976288,\n                        ebx: 538976288,\n                        ecx: 538976288,\n                        edx: 2105376,\n                    },\n                ),\n                2147483653: Absent(\n                    CpuidValues {\n                        eax: 4282449728,\n                        ebx: 4282449728,\n                        ecx: 537395520,\n                        edx: 537395520,\n                    },\n                ),\n                2147483654: Absent(\n                    CpuidValues {\n                        eax: 1207968256,\n                        ebx: 1744847360,\n                        ecx: 33579328,\n                        edx: 134254912,\n                    },\n                ),\n                2147483655: Absent(\n                    CpuidValues {\n                        eax: 0,\n                        ebx: 0,\n                        ecx: 0,\n                        edx: 256,\n                    },\n                ),\n                2147483656: Absent(\n                    CpuidValues {\n                        eax: 12336,\n                        ebx: 5,\n                        ecx: 0,\n                        edx: 0,\n                    },\n                ),\n                2147483658: Absent(\n                    CpuidValues {\n                        eax: 0,\n                        ebx: 0,\n                        ecx: 0,\n                        edx: 0,\n                    },\n                ),\n                2147483673: Absent(\n                    CpuidValues {\n                        eax: 4030787648,\n                 ebx: 4030726144,\n                        ecx: 0,\n                        edx: 0,\n                    },\n                ),\n                2147483674: Absent(\n                    CpuidValues {\n                        eax: 6,\n                        ebx: 0,\n                        ecx: 0,\n                        edx: 0,\n                    },\n                ),\n                2147483675: Absent(\n                    CpuidValues {\n                        eax: 0,\n                        ebx: 0,\n                        ecx: 0,\n                        edx: 0,\n                    },\n                ),\n                2147483676: Absent(\n                    CpuidValues {\n                        eax: 0,\n                        ebx: 0,\n                        ecx: 0,\n                        edx: 0,\n                    },\n                ),\n                2147483677: Present(\n                    {\n                        0: CpuidValues {\n                            eax: 289,\n                            ebx: 63,\n     ecx: 0,\n                            edx: 0,\n                        },\n                        1: CpuidValues {\n                            eax: 323,\n                            ebx: 63,\n                            ecx: 0,\n                            edx: 0,\n                        },\n                        2: CpuidValues {\n                            eax: 355,\n                            ebx: 63,\n                            ecx: 0,\n                            edx: 0,\n                        },\n                    },\n                ),\n                2147483678: Absent(\n                    CpuidValues {\n                        eax: 0,\n                        ebx: 256,\n                        ecx: 0,\n                        edx: 0,\n                    },\n                ),\n                2147483679: Absent(\n                    CpuidValues {\n                        eax: 0,\n                        ebx: 0,\n                        ecx: 0,\n                        edx: 0,\n                    },\n                ),\n                2147483681: Absent(\n                    CpuidValues {\n                        eax: 69,\n                        ebx: 0,\n                        ecx: 0,\n                        edx: 0,\n                    },\n                ),\n            },\n        ),\n        vendor: Amd,\n    },\n    disks: {\n        Name(\n            "70208419-564e-44a7-b1d5-6df61797d11f:device",\n        ): Disk {\n            device_spec: Nvme(\n                NvmeDisk {\n                    backend_id: Uuid(\n                        70208419-564e-44a7-b1d5-6df61797d11f,\n                    ),\n                    pci_path: PciPath {\n                        bus: 0,\n                        device: 16,\n                        function: 0,\n                    },\n                    serial_number: [\n                        109,\n                        121,\n                        45,\n                        99,\n                        111,\n                        109,\n                        112,\n                        117,\n                        116,\n                        101,\n             114,\n                        45,\n                        118,\n                        109,\n                        45,\n                        97,\n                        116,\n                        116,\n                        101,\n                        115,\n                    ],\n                },\n            ),\n            backend_spec: Crucible(\n                CrucibleStorageBackend {\n                    request_json: "<redacted>",\n                    readonly: true,\n                },\n            ),\n        },\n        Name(\n            "cloud-init-dev",\n        ): Disk {\n            device_spec: Virtio(\n                VirtioDisk {\n                    backend_id: Name(\n                        "cloud-init-backend",\n                    ),\n                    pci_path: PciPath {\n                        bus: 0,\n                        device: 24,\n                        function: 0,\n                    },\n                },\n            ),\n            backend_spec: Blob(\n                BlobStorageBackend {\n      base64: "<redacted>",\n                    readonly: true,\n                },\n            ),\n        },\n    },\n    nics: {},\n    boot_settings: Some(\n        BootSettings {\n            name: Name(\n                "boot-settings",\n            ),\n            order: [\n                BootOrderEntry {\n                    device_id: Name(\n                        "70208419-564e-44a7-b1d5-6df61797d11f:device",\n                    ),\n                },\n            ],\n        },\n    ),\n    serial: {\n        Name(\n            "com1",\n        ): SerialPort {\n            num: Com1,\n            device: Uart,\n        },\n        Name(\n            "com2",\n        ): SerialPort {\n            num: Com2,\n            device: Uart,\n        },\n        Name(\n            "com3",\n        ): SerialPort {\n            num: Com3,\n            device: Uart,\n        },\n        Name(\n            "com4",\n        ): SerialPort {\n            num: Com4,\n            device: Uart,\n        },\n    },\n    pci_pci_bridges: {},\n    pvpanic: Some(\n        QemuPvpanic {\n            id: Name(\n                "pvpanic",\n            ),\n            spec: QemuPvpanic {\n                enable_isa: true,\n            },\n        },\n    ),\n    smbios_type1_input: None,\n}
    use_reservoir = true
21:24:58.239Z INFO propolis-server (vm_state_driver): Creating storage device
    device_id = 70208419-564e-44a7-b1d5-6df61797d11f:device
    spec = Nvme(NvmeDisk { backend_id: Uuid(70208419-564e-44a7-b1d5-6df61797d11f), pci_path: PciPath { bus: 0, device: 16, function: 0 }, serial_number: [109, 121, 45, 99, 111, 109, 112, 117, 116, 101, 114, 45, 118, 109, 45, 97, 116, 116, 101, 115] })

i really don't like this and wish that we printed this out in...pretty much any possible format that isn't this specific one.

Metadata

Metadata

Assignees

Labels

bugSomething that isn't working.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions