[GH-ISSUE #11] cloudinit can't config ifconfig #2

Closed
opened 2026-02-28 00:40:07 +03:00 by kerem · 3 comments
Owner

Originally created by @huangmingyou on GitHub (Oct 16, 2018).
Original GitHub issue: https://github.com/Telmate/proxmox-api-go/issues/11

get error like this.

{"data":{"upid":"UPID:r7208:003377E3:0C58F6D4:5BC59E4D:qmclone:9999:hmy@pam:","pid":3373027,"user":"hmy@pam","id":"9999","status":"stopped","starttime":1539677773,"exitstatus":"OK","pstart":207156948,"node":"r7208","type":"qmclone"}})
2018/10/16 16:16:34 >>>>>>>>>> REQUEST:
%!(EXTRA string=POST /api2/json/nodes/r7201/qemu/10000/config HTTP/1.1
Host: wxpve1.vphotos.cn:8006
User-Agent: Go-http-client/1.1
Content-Length: 85
Accept: application/json
Content-Type: application/x-www-form-urlencoded
Cookie: PVEAuthCookie=PVE:hmy@pam:5BC59E4D::ZeFGuZeV9nNeulIzdWBXu/tJPdEsv/cFm2IKH7+JAqzUHraqgzxgvNM94zo3OgvWkOg1JEQZvIynSBdM6KCsCtXaeIh/lro4wDs5U6D2zBqB4lcP8Y22297bKbrd1GX4mwWdB2Tw/aafKxTwYNU0jejc8lvQ9yhhGMlNR8uf/yjc6AKfrXM566EpFigZ6PYOO6aMc10U+Il+jqPTyKsO8LCr6JQpz4hpbEHUDeGSPGYbbaINplBxwJ6j69/QmRhnemMG5XOdlHmAmRL0lSorSlm/Y5JETwSTlC78oB/tsVLIouWF6wm3YsRc2vWSfWCeH53bo0TGg2Dpeat1r51opA==
Csrfpreventiontoken: 5BC59E4D:X4cwA1Q/KgXsFfebliU/6+AmcUc
Accept-Encoding: gzip

cores=2&description=Test+proxmox-api-go+clone&memory=2048&net0=%2Cbridge%3D&sockets=1)
2018/10/16 16:16:34 <<<<<<<<<< RESULT:
%!(EXTRA string=HTTP/1.1 400 Parameter verification failed.
Connection: close
Content-Length: 97
Cache-Control: max-age=0
Content-Type: application/json;charset=UTF-8
Date: Tue, 16 Oct 2018 08:16:34 GMT
Expires: Tue, 16 Oct 2018 08:16:34 GMT
Pragma: no-cache
Server: pve-api-daemon/3.0

{"errors":{"net0":"invalid format - missing key in comma-separated list property\n"},"data":null})
2018/10/16 16:16:34 Complete
2018/10/16 16:16:34

Originally created by @huangmingyou on GitHub (Oct 16, 2018). Original GitHub issue: https://github.com/Telmate/proxmox-api-go/issues/11 get error like this. {"data":{"upid":"UPID:r7208:003377E3:0C58F6D4:5BC59E4D:qmclone:9999:hmy@pam:","pid":3373027,"user":"hmy@pam","id":"9999","status":"stopped","starttime":1539677773,"exitstatus":"OK","pstart":207156948,"node":"r7208","type":"qmclone"}}) 2018/10/16 16:16:34 >>>>>>>>>> REQUEST: %!(EXTRA string=POST /api2/json/nodes/r7201/qemu/10000/config HTTP/1.1 Host: wxpve1.vphotos.cn:8006 User-Agent: Go-http-client/1.1 Content-Length: 85 Accept: application/json Content-Type: application/x-www-form-urlencoded Cookie: PVEAuthCookie=PVE:hmy@pam:5BC59E4D::ZeFGuZeV9nNeulIzdWBXu/tJPdEsv/cFm2IKH7+JAqzUHraqgzxgvNM94zo3OgvWkOg1JEQZvIynSBdM6KCsCtXaeIh/lro4wDs5U6D2zBqB4lcP8Y22297bKbrd1GX4mwWdB2Tw/aafKxTwYNU0jejc8lvQ9yhhGMlNR8uf/yjc6AKfrXM566EpFigZ6PYOO6aMc10U+Il+jqPTyKsO8LCr6JQpz4hpbEHUDeGSPGYbbaINplBxwJ6j69/QmRhnemMG5XOdlHmAmRL0lSorSlm/Y5JETwSTlC78oB/tsVLIouWF6wm3YsRc2vWSfWCeH53bo0TGg2Dpeat1r51opA== Csrfpreventiontoken: 5BC59E4D:X4cwA1Q/KgXsFfebliU/6+AmcUc Accept-Encoding: gzip cores=2&description=Test+proxmox-api-go+clone&memory=2048&net0=%2Cbridge%3D&sockets=1) 2018/10/16 16:16:34 <<<<<<<<<< RESULT: %!(EXTRA string=HTTP/1.1 400 Parameter verification failed. Connection: close Content-Length: 97 Cache-Control: max-age=0 Content-Type: application/json;charset=UTF-8 Date: Tue, 16 Oct 2018 08:16:34 GMT Expires: Tue, 16 Oct 2018 08:16:34 GMT Pragma: no-cache Server: pve-api-daemon/3.0 {"errors":{"net0":"invalid format - missing key in comma-separated list property\n"},"data":null}) 2018/10/16 16:16:34 Complete 2018/10/16 16:16:34 <nil>
kerem closed this issue 2026-02-28 00:40:07 +03:00
Author
Owner

@ghost commented on GitHub (Jul 16, 2019):

Today, I encountered the same situation. The error occured after subsequent terraform apply runs. The first iteration of apply runs just fine.

I fixed it by supplying a MAC address manually, see also https://github.com/Telmate/terraform-provider-proxmox/issues/47#issuecomment-494627802.

Let me try to explain the situation if no MAC is defined (correct me if I'm wrong). After the first apply, a random MAC will be generated by proxmox-api-go. All subsequent apply attempts leave the terraform.tfstate in an inconsistent state. The local state will have two network interfaces defined, whereas the remote/API state registered just one interface. If your plan or apply preview shows similar to the following output, supplying the MAC manually can fix this problem:

# run `terraform plan` or `terraform apply`
  .. (abbreviated output)
       + network {
          + bridge    = "vmbr0"
          + firewall  = false
          + id        = 0
          + link_down = false
          + model     = "virtio"
          + queues    = -1
          + rate      = -1
          + tag       = -1
        }
      - network {
          - bridge    = "vmbr0" -> null
          - firewall  = false -> null
          - id        = 0 -> null
          - link_down = false -> null
          - macaddr   = "A2:15:1C:5C:D8:31" -> null
          - model     = "virtio" -> null
          - queues    = -1 -> null
          - rate      = -1 -> null
          - tag       = -1 -> null
        }
      + network {
          + macaddr = "A2:15:1C:5C:D8:31"
        }
  .. (abbreviated output)

You can see here, that after all subsequent applys, Terraform will split the interface into two parts which will result in an error in proxmox-api-go, because macaddr is null in one interface. After you hit apply a second time, you can examine the corrupt state in terraform.tfstate as well:

# `cat terraform.tfstate`
  .. (abbreviated output)
           "network": [
              {
                "bridge": "vmbr0",
                "firewall": false,
                "id": 0,
                "link_down": false,
                "macaddr": "",
                "model": "virtio",
                "queues": -1,
                "rate": -1,
                "tag": -1
              },
              {
                "bridge": null,
                "firewall": null,
                "id": null,
                "link_down": null,
                "macaddr": "A2:15:1C:5C:D8:31",
                "model": null,
                "queues": null,
                "rate": null,
                "tag": null
              }
            ],
  .. (abbreviated output)
<!-- gh-comment-id:511994227 --> @ghost commented on GitHub (Jul 16, 2019): Today, I encountered the same situation. The error occured after subsequent `terraform apply` runs. The first iteration of `apply` runs just fine. I fixed it by **supplying a MAC address manually**, see also https://github.com/Telmate/terraform-provider-proxmox/issues/47#issuecomment-494627802. Let me try to explain the situation if **no** MAC is defined (correct me if I'm wrong). After the first `apply`, a random MAC will be generated by `proxmox-api-go`. All subsequent `apply` attempts leave the `terraform.tfstate` in an inconsistent state. The local state will have **two network interfaces** defined, whereas the remote/API state registered just one interface. If your `plan` or `apply` preview shows similar to the following output, supplying the MAC manually can fix this problem: ``` # run `terraform plan` or `terraform apply` .. (abbreviated output) + network { + bridge = "vmbr0" + firewall = false + id = 0 + link_down = false + model = "virtio" + queues = -1 + rate = -1 + tag = -1 } - network { - bridge = "vmbr0" -> null - firewall = false -> null - id = 0 -> null - link_down = false -> null - macaddr = "A2:15:1C:5C:D8:31" -> null - model = "virtio" -> null - queues = -1 -> null - rate = -1 -> null - tag = -1 -> null } + network { + macaddr = "A2:15:1C:5C:D8:31" } .. (abbreviated output) ``` You can see here, that after all subsequent `apply`s, Terraform will split the interface into two parts which will result in an error in `proxmox-api-go`, because `macaddr` is `null` in one interface. After you hit `apply` a second time, you can examine the corrupt state in `terraform.tfstate` as well: ``` # `cat terraform.tfstate` .. (abbreviated output) "network": [ { "bridge": "vmbr0", "firewall": false, "id": 0, "link_down": false, "macaddr": "", "model": "virtio", "queues": -1, "rate": -1, "tag": -1 }, { "bridge": null, "firewall": null, "id": null, "link_down": null, "macaddr": "A2:15:1C:5C:D8:31", "model": null, "queues": null, "rate": null, "tag": null } ], .. (abbreviated output) ```
Author
Owner

@davidchua commented on GitHub (Aug 11, 2019):

@in0rdr I am having the same issue as OP, I've supplied a manual macaddr:

ie.

    network {
      id = 1 
      model = "virtio"
      bridge = "vmbr0"
      macaddr = "A2:15:1C:5C:D8:32"
    }

When I plan, I still see 2 macaddr generated:

      + network {                          
          + bridge    = "vmbr0" 
          + firewall  = false
          + id        = 1 
          + link_down = false
          + macaddr   = "A2:15:1C:5C:D8:32"
          + model     = "virtio"
          + queues    = -1               
          + rate      = -1
          + tag       = -1
        }
      + network {                         
          + macaddr = "16:58:F0:DF:D9:8C"
        }                                                               
    }

Not sure how to get past this.

<!-- gh-comment-id:520222231 --> @davidchua commented on GitHub (Aug 11, 2019): @in0rdr I am having the same issue as OP, I've supplied a manual macaddr: ie. ``` network { id = 1 model = "virtio" bridge = "vmbr0" macaddr = "A2:15:1C:5C:D8:32" } ``` When I plan, I still see 2 macaddr generated: ``` + network { + bridge = "vmbr0" + firewall = false + id = 1 + link_down = false + macaddr = "A2:15:1C:5C:D8:32" + model = "virtio" + queues = -1 + rate = -1 + tag = -1 } + network { + macaddr = "16:58:F0:DF:D9:8C" } } ``` Not sure how to get past this.
Author
Owner

@ghost commented on GitHub (Aug 13, 2019):

@davidchua What is the version of the code you are using? I fail to reproduce this behavior with the following versions:

  • proxmox-api-go at master commit #6c97b76
  • terraform-provider-proxmox at master commit #17f3cea

The output of plan stays identical for the network section in my setup.
However, I start with id=0, not id=1.

<!-- gh-comment-id:520945049 --> @ghost commented on GitHub (Aug 13, 2019): @davidchua What is the version of the code you are using? I fail to reproduce this behavior with the following versions: * proxmox-api-go at master commit #6c97b76 * terraform-provider-proxmox at master commit #17f3cea The output of plan stays identical for the network section in my setup. However, I start with `id=0`, not `id=1`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxmox-api-go#2
No description provided.