Automation

 View Only

Failed to create serial ports with REST API

  • 1.  Failed to create serial ports with REST API

    Posted Feb 02, 2024 01:55 PM

    Hello,

    I have a VM created by vSphere WEB UI with serial ports.

    I requested config of this VM by REST API and here is the serial ports config:

    "serial_ports": [
                {
                    "value": {
                        "start_connected": true,
                        "backing": {
                            "auto_detect": false,
                            "host_device": "/dev/char/serial/uart1",
                            "type": "HOST_DEVICE"
                        },
                        "allow_guest_control": true,
                        "yield_on_poll": true,
                        "label": "Serial port 1",
                        "state": "NOT_CONNECTED"
                    },
                    "key": "9000"
                },
                {
                    "value": {
                        "start_connected": true,
                        "backing": {
                            "auto_detect": false,
                            "host_device": "/dev/char/serial/uart0",
                            "type": "HOST_DEVICE"
                        },
                        "allow_guest_control": true,
                        "yield_on_poll": true,
                        "label": "Serial port 2",
                        "state": "NOT_CONNECTED"
                    },
                    "key": "9001"
                }]

    Now I want to create VM via REST API with the same configuration of serial ports, serial port config is:

    "serial_ports": [
        {
          "allow_guest_control": true,
          "start_connected": true,
          "yield_on_poll": true,
          "backing": {
            "type": "HOST_DEVICE",
            "host_device": "/dev/char/serial/uart1"
          }
        },
        {
          "allow_guest_control": true,
          "start_connected": true,
          "yield_on_poll": true,
          "backing": {
            "type": "HOST_DEVICE",
            "host_device": "/dev/char/serial/uart0"
          }}]

    But in response of my VM create request I got a serial ports config without any path to host_device:

    "serial_ports": {
        "9000": {
          "start_connected": true,
          "backing": {
            "auto_detect": true,
            "type": "HOST_DEVICE"
          },
          "allow_guest_control": true,
          "yield_on_poll": true,
          "label": "Serial port 1",
          "state": "NOT_CONNECTED"
        },
        "9001": {
          "start_connected": true,
          "backing": {
            "auto_detect": true,
            "type": "HOST_DEVICE"
          },
          "allow_guest_control": true,
          "yield_on_poll": true,
          "label": "Serial port 2",
          "state": "NOT_CONNECTED"
        }}

    So, as you see, I failed to create VM with requested serial ports configuration. 

    So, any ideas why I can't create VM with serial ports as I requested? 

    I looks like WEB UI works Ok but I got troubles with REST API