XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login
    1. Home
    2. twaapo
    T
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 3
    • Groups 0

    twaapo

    @twaapo

    0
    Reputation
    1
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    twaapo Unfollow Follow

    Latest posts made by twaapo

    • RE: terraform: XO response: jsonrpc2: code 10 message

      @ddelnano

      2023-11-02T17:38:39.404+0200 [INFO]  provider.terraform-provider-xenorchestra_v0.25.1: 2023/11/02 17:38:39 [TRACE] Made rpc call `vm.create` with params: map[CPUs:4 VDIs:[map[$SR:7d62dcc9-3fbb-3e4d-af51-07689cb846a6 SR:7d62dcc9-3fbb-3e4d-af51-07689cb846a6 name_description:faction-root name_label:faction-root size:6442450944 type:user]] VIFs:[map[network:37975edd-c276-5539-391f-bd2c042f1876]] auto_poweron:true bootAfterCreate:true coreOs:false cpuCap:<nil> cpuWeight:<nil> existingDisks:map[] expNestedHvm:false high_availability: hvmBootFirmware:bios installation:map[method:network repository:] memoryMax:6442450944 name_description:tf-flatcar: 4C 6144MiB 6G name_label:faction tags:[] template:22d986f1-847f-c23c-8cdf-2a38fb024da9-552bce37-51b2-445d-84f2-5f33fa112d7e vga:std videoram:8] and received : result with error: jsonrpc2: code 10 message: invalid parameters: timestamp="2023-11-02T17:38:39.404+0200"
      2023-11-02T17:38:39.404+0200 [ERROR] provider.terraform-provider-xenorchestra_v0.25.1: Response contains error diagnostic: diagnostic_summary="jsonrpc2: code 10 message: invalid parameters: {\"errors\":[{\"instancePath\":\"/installation/repository\",\"schemaPath\":\"#/properties/installation/properties/repository/minLength\",\"keyword\":\"minLength\",\"params\":{\"limit\":1},\"message\":\"must NOT have fewer than 1 characters\"}]}" tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/internal/diag/diagnostics.go:58 diagnostic_severity=ERROR tf_proto_version=5.4 tf_provider_addr=provider diagnostic_detail="" tf_req_id=28a2312a-e508-5aad-50d3-e43a41d1eddf tf_resource_type=xenorchestra_vm @module=sdk.proto timestamp="2023-11-02T17:38:39.404+0200"
      2023-11-02T17:38:39.408+0200 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
      2023-11-02T17:38:39.408+0200 [ERROR] vertex "module.flatcars.xenorchestra_vm.flatcar[\"faction\"]" error: jsonrpc2: code 10 message: invalid parameters: {"errors":[{"instancePath":"/installation/repository","schemaPath":"#/properties/installation/properties/repository/minLength","keyword":"minLength","params":{"limit":1},"message":"must NOT have fewer than 1 characters"}]}
      ╷
      │ Error: jsonrpc2: code 10 message: invalid parameters: {"errors":[{"instancePath":"/installation/repository","schemaPath":"#/properties/installation/properties/repository/minLength","keyword":"minLength","params":{"limit":1},"message":"must NOT have fewer than 1 characters"}]}
      │
      │   with module.flatcars.xenorchestra_vm.flatcar["faction"],
      │   on flatcar/main.tf line 13, in resource "xenorchestra_vm" "flatcar":
      │   13: resource "xenorchestra_vm" "flatcar" {
      │
      ╵
      2023-11-02T17:38:39.412+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
      2023-11-02T17:38:39.412+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
      2023-11-02T17:38:39.412+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/local/2.4.0/linux_amd64/terraform-provider-local_v2.4.0_x5 pid=79007
      2023-11-02T17:38:39.412+0200 [DEBUG] provider: plugin exited
      2023-11-02T17:38:39.412+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.25.1/linux_amd64/terraform-provider-xenorchestra_v0.25.1 pid=78994
      2023-11-02T17:38:39.412+0200 [DEBUG] provider: plugin exited
      

      Is this enough or maybe I need to paste the whole dump somewhere? Theres a LOT of debug output.

      posted in Infrastructure as Code
      T
      twaapo
    • RE: terraform: XO response: jsonrpc2: code 10 message

      I was trying to boot flatcar linux diskless too, but then realised I probably need a disk anyway. So there is a disk on all VMs now.

      The template is just the default "Other media" diskless template that came with XO.

      # get "other" template id from pool per vm
      data "xenorchestra_template" "other" {
        for_each   = var.hosts
        name_label = "Other install media"
        pool_id    = each.value.pool_id
      }
      
      resource "xenorchestra_vm" "flatcar" {
        for_each            = var.hosts
        auto_poweron        = true
        installation_method = "network"
        name_label          = each.key
        memory_max          = each.value.memory * 1024 * 1024 * 1024
        cpus                = each.value.cores
        name_description = format("tf-flatcar: %dC %dMiB %dG",
          each.value.cores,
          each.value.memory * 1024,
        contains(keys(each.value), "disk") ? each.value.disk : 0)
        template = data.xenorchestra_template.other[each.key].id
        tags     = []
        network {
          network_id = var.net.id
        }
        lifecycle {
          ignore_changes = [
            destroy_cloud_config_vdi_after_boot,
            disk,
            template,
            vga,
            videoram,
            affinity_host,
          ]
        }
      
        # possibly support diskless flatcar in the future
        disk {
          sr_id            = contains(keys(each.value), "disk") ? var.sr.id : "xxx"
          name_label       = contains(keys(each.value), "disk") ? format("%s-root", each.key) : "xxxx"
          name_description = contains(keys(each.value), "disk") ? format("%s-root", each.key) : "xxxx"
          size             = contains(keys(each.value), "disk") ? each.value.disk * 1024 * 1024 * 1024 : 0
        }
        timeouts {}
      }
      
      variable "hosts" {
        type = map(object({
          cores   = number
          memory  = number # in G
          disk    = number # in G
          pool_id = string
        }))
      }
      
      posted in Infrastructure as Code
      T
      twaapo
    • terraform: XO response: jsonrpc2: code 10 message

      Using terraform module and creating a VM with diskless template and installation_method = "network" causes some problem. I worked around it by modifying the terraform module as follows:

      XOA: Current version: 5.86.1
      Terraform Provider version 0.25.1

      default

      vm.create
      {
        "CPUs": 4,
        ..
        "installation": {
          "method": "network",
          "repository": ""
        },
        "memoryMax": 6442450944,
        ..
      }
      {
        "code": 10,
        "data": {
          "errors": [
            {
              "instancePath": "/installation/repository",
              "schemaPath": "#/properties/installation/properties/repository/minLength",
              "keyword": "minLength",
              "params": {
                "limit": 1
              },
              "message": "must NOT have fewer than 1 characters"
            }
          ]
        },
        "message": "invalid parameters",
        "name": "XoError",
        "stack": "XoError: invalid parameters
          at Module.invalidParameters (/usr/local/lib/node_modules/xo-server/node_modules/xo-common/src/api-errors.js:21:32)
          at Xo.call (file:///usr/local/lib/node_modules/xo-server/src/xo-mixins/api.mjs:65:20)
          at Api.#callApiMethod (file:///usr/local/lib/node_modules/xo-server/src/xo-mixins/api.mjs:413:19)"
      }
      

      nulled out "repository"

      vm.create
      {
        "CPUs": 4,
        ..
        "installation": {
          "method": "network"
        },
        "memoryMax": 6442450944,
        ..
      }
      {
        "code": 10,
        "data": {
          "errors": [
            {
              "instancePath": "/installation",
              "schemaPath": "#/properties/installation/required",
              "keyword": "required",
              "params": {
                "missingProperty": "repository"
              },
              "message": "must have required property 'repository'"
            }
          ]
        },
        "message": "invalid parameters",
        "name": "XoError",
        "stack": "XoError: invalid parameters
          at Module.invalidParameters (/usr/local/lib/node_modules/xo-server/node_modules/xo-common/src/api-errors.js:21:32)
          at Xo.call (file:///usr/local/lib/node_modules/xo-server/src/xo-mixins/api.mjs:65:20)
          at Api.#callApiMethod (file:///usr/local/lib/node_modules/xo-server/src/xo-mixins/api.mjs:413:19)"
      }
      

      For some reason I typed repository: "none". In next test and that worked fine, and I dont have the log for that. I think maybe XO should accept the nulled repository field or empty string what the terraform module is producing now, if "method: network" is specified.

      posted in Infrastructure as Code
      T
      twaapo