Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error parsing VM Template instantiation with user inputs #6625

Closed
3 tasks
OpenNebulaSupport opened this issue Jun 20, 2024 · 0 comments
Closed
3 tasks

Error parsing VM Template instantiation with user inputs #6625

OpenNebulaSupport opened this issue Jun 20, 2024 · 0 comments

Comments

@OpenNebulaSupport
Copy link
Collaborator

Description
When issuing a VM Template instantiation through Sunstone, the resulting API Call is quite different compared to the one issued using the CLI. With certain VM Templates it might lead to instantiation fails due to parsing errors.

To Reproduce

Given the following VM Template

root@PC04:~# onetemplate show t54202 -j | jq .VMTEMPLATE.TEMPLATE
{
  "CONTEXT": {
    "NETWORK": "YES",
    "ONEGATE_ENDPOINT": "http://onegate.cloud4c.com:5030",
    "PASSWORD_BASE64": "SW5mMHJtYXRpMG5AMTIzNDU2",
    "REPORT_READY": "YES",
    "SOCKETS": "2",
    "TARGET": "hda",
    "USERNAME": "root",
    "VMID": "1044"
  },
  "CPU": "2",
  "CPU_MODEL": {
    "MODEL": "host-passthrough"
  },
  "CREATED_BY": "0",
  "DISK": [
    {
      "DEV_PREFIX": "sd",
      "IMAGE_ID": "17"
    },
    {
      "DEV_PREFIX": "vd",
      "IMAGE_ID": "17",
      "TM_MAD_SYSTEM": "shared",
      "VCENTER_DISK_TYPE": "thin"
    }
  ],
  "GRAPHICS": {
    "LISTEN": "0.0.0.0",
    "TYPE": "VNC"
  },
  "HOT_RESIZE": {
    "CPU_HOT_ADD_ENABLED": "NO",
    "MEMORY_HOT_ADD_ENABLED": "NO"
  },
  "HYPERVISOR": "kvm",
  "LOGO": "images/logos/ubuntu.png",
  "MEMORY": "4096",
  "MEMORY_RESIZE_MODE": "HOTPLUG",
  "MEMORY_UNIT_COST": "MB",
  "NIC": {
    "IP6_METHOD": "skip",
    "METHOD": "static",
    "MODEL": "virtio",
    "MTU": "8000",
    "NETWORK": "service",
    "SECURITY_GROUPS": "0"
  },
  "NIC_DEFAULT": {
    "MODEL": "virtio"
  },
  "PASSWORD_BASE64": "SW5mMHJtYXRpMG5AMTIzNDU2",
  "SAVED_TEMPLATE_ID": "110",
  "SCHED_ACTION": {
    "ACTION": "backup",
    "ARGS": "105",
    "END_TYPE": "2",
    "END_VALUE": "1717498380",
    "ID": "0",
    "TIME": "1717498380"
  },
  "SCHED_REQUIREMENTS": "ID=\"0\" | ID=\"1\" | ID=\"2\" | CLUSTER_ID=\"0\"",
  "SOCKETS": "2",
  "TOPOLOGY": {
    "CORES": "1",
    "PIN_POLICY": "NONE",
    "SOCKETS": "2",
    "THREADS": "1"
  },
  "USERNAME": "root",
  "USER_INPUTS": {
    "CORES": "M|number|NUMBER OF CORES| |",
    "PASSWORD_BASE64": "M|text64|INPUT YOUR PASSWORD| |",
    "SOCKETS": "M|list|NUMBER OF SOCKETS\n|2,4|",
    "USERNAME": "M|text|INPUT YOUR USERNAME| |"
  },
  "VCPU": "2"
}

Instantiating it through sunstone

image

results in the following error

hu Jun 20 16:37:35 2024 [Z0][ReM][D]: Req:1856 UID:0 IP:127.0.0.1 one.template.instantiate invoked , 104, "", false, "PASSWORD_BASE64="U1c1bU1ISnRZWFJwTUc1QU1USXpORFUy"
SOCKETS="2"
USERNAME="root"
DISK=[
  ALLOW_ORPHANS="FORMAT",
  CLONE="YES",
  CLONE_TARGET="SYSTEM",
  CLUSTER_ID="0",
  DATASTORE="default",
  DATASTORE_ID="1",
  DEV_PREFIX="sd",
  DISK_ID="0",
  DISK_SNAPSHOT_TOTAL_SIZE="0",
  DISK_TYPE="FILE",
  DRIVER="qcow2",
  FORMAT="qcow2",
  IMAGE="ttylinux",
  IMAGE_ID="17",
  IMAGE_STATE="1",
  LN_TARGET="NONE",
  READONLY="NO",
  SAVE="NO",
  SIZE="200",
  SOURCE="/var/lib/one//datastores/1/1c53f81de3cb6ba32e9a33485ae483c1",
  TM_MAD="qcow2",
  TYPE="FILE"
]
DISK=[
  ALLOW_ORPHANS="FORMAT",
  CLONE="YES",
  CLONE_TARGET="SYSTEM",
  CLUSTER_ID="0",
  DATASTORE="default",
  DATASTORE_ID="1",
  DEV_PREFIX="vd",
  DISK_ID="1",
  DISK_SNAPSHOT_TOTAL_SIZE="0",
  DISK_TYPE="FILE",
  DRIVER="qcow2",
  FORMAT="qcow2",
  IMAGE="ttylinux",
  IMAGE_ID="17",
  IMAGE_STATE="1",
  LN_TARGET="NONE",
  READONLY="NO",
  SAVE="NO",
  SIZE="200",
  SOURCE="/var/lib/one//datastores/1/1c53f81de3cb6ba32e9a33485ae483c1",
  TM_MAD="qcow2",
  TM_MAD_SYSTEM="shared",
  TYPE="FILE",
  VCENTER_DISK_TYPE="thin"
]

SCHED_REQUIREMENTS="ID=\"0\" | ID=\"1\" | ID=\"2\" | CLUSTER_ID=\"0\""
NIC=[
  IP6_METHOD="skip",
  METHOD="static",
  MODEL="virtio",
  MTU="8000",
  NETWORK_ID="7",
  SECURITY_GROUPS="0"
]

SCHED_ACTION=[
  ACTION="backup",
  ARGS="105",
  END_TYPE="2",
  END_VALUE="1717498380",
  ID="0",
  TIME="1717498380"
]

TOPOLOGY=[
  CORES="2",
  SOCKETS=,
  THREADS="1"
]

NIC_ALIAS = []
SCHED_DS_REQUIREMENTS = []", false
Thu Jun 20 16:37:35 2024 [Z0][ReM][E]: Req:1856 UID:0 one.template.instantiate result FAILURE [one.template.instantiate] Parse error: syntax error, unexpected EQUAL, expecting COMMA or CBRACKET at line 30999, columns 1459:1460

Expected behavior

When instantiating through CLI

root@PC04:~# onetemplate instantiate t54202
There are some parameters that require user input. Use the string <<EDITOR>> to launch an editor (e.g. for multi-line inputs)
  * (CORES) NUMBER OF CORES
    Integer: 2
  * (PASSWORD_BASE64) INPUT YOUR PASSWORD

  * (SOCKETS) NUMBER OF SOCKETS
    0  2
    1  4

    Please type the selection number: 0
  * (USERNAME) INPUT YOUR USERNAME
    asdf
VM ID: 113

the behavior is quite different

Thu Jun 20 16:40:08 2024 [Z0][ReM][D]: Req:8352 UID:0 IP:127.0.0.1 one.template.instantiate invoked , 104, "", false, "CORES = "2"
PASSWORD_BASE64 = ""
SOCKETS = "2"
USERNAME = "asdf"", false

The call only passed the user inputs as template appendages, not a whole new VM Template like sunstone does.

Details

  • Version: 6.8.3

Progress Status

  • Code committed
  • Testing - QA
  • Documentation (Release notes - resolved issues, compatibility, known issues)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants