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

Sunstone missbehave with context attributes filled by vm_template_contents #5578

Closed
7 tasks
baby-gnu opened this issue Oct 18, 2021 · 5 comments
Closed
7 tasks

Comments

@baby-gnu
Copy link
Contributor

Description

Sunstone:

  • duplicates prefilled attributes when instanciating a service with user or admin views
  • clear prefilled attributes when instanciating a service with cloud view

To Reproduce

  1. Import ttylinux apps
  2. Modify the ttylinux VM template with the following template
    CONTEXT = [
      CONFIG1 = "$CONFIG1",
      CONFIG2 = "$CONFIG2",
      NETWORK = "YES",
      SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" ]
    CPU = "0.1"
    DISK = [
      IMAGE_ID = "0" ]
    GRAPHICS = [
      LISTEN = "0.0.0.0",
      TYPE = "VNC" ]
    HOT_RESIZE = [
      CPU_HOT_ADD_ENABLED = "NO",
      MEMORY_HOT_ADD_ENABLED = "NO" ]
    INPUTS_ORDER = "CONFIG1,CONFIG2,SERVICE_CONFIG1,SERVICE_CONFIG2"
    LOGO = "images/logos/linux.png"
    MEMORY = "128"
    MEMORY_UNIT_COST = "MB"
    OS = [
      BOOT = "" ]
    USER_INPUTS = [
      CONFIG1 = "M|text|first config| |",
      CONFIG2 = "M|text|second config| |" ]
    
  3. Create a test-service with the following content
    {
      "name": "test-service",
      "deployment": "straight",
      "description": "",
      "roles": [
        {
          "name": "r1",
          "cardinality": 1,
          "vm_template": 0,
          "vm_template_contents": "NIC = [\n  NAME = \"_NIC0\",\n  NETWORK_ID = \"$Public\" ]\nCONFIG1 = \"foor1\"\nCONFIG2 = \"barr1\"\n ",
          "elasticity_policies": [],
          "scheduled_policies": []
        },
        {
          "name": "r2",
          "cardinality": 1,
          "vm_template": 0,
          "parents": [
            "r1"
          ],
          "vm_template_contents": "NIC = [\n  NAME = \"_NIC0\",\n  NETWORK_ID = \"$Public\" ]\nCONFIG1 = \"foor2\"\nCONFIG2 = \"barr2\"\n ",
          "elasticity_policies": [],
          "scheduled_policies": []
        },
        {
          "name": "r3",
          "cardinality": 1,
          "vm_template": 0,
          "parents": [
            "r1"
          ],
          "vm_template_contents": "NIC = [\n  NAME = \"_NIC0\",\n  NETWORK_ID = \"$Public\" ]\nCONFIG1 = \"foor3\"\nCONFIG2 = \"barr3\"\n ",
          "elasticity_policies": [],
          "scheduled_policies": []
        }
      ],
      "ready_status_gate": false,
      "automatic_deletion": false,
      "networks": {
        "Public": "M|network|Network with internet access| |id:"
      },
      "shutdown_action": "terminate-hard",
      "registration_time": 1634220409
    }
    
  4. Instanciate the service with sunstone admin or user view

The VMs have several time each attributes:

Info for role1 VM

service1-sustone-multi-attributes-role1

Info for role2 VM

service1-sustone-multi-attributes-role2

Info for role3 VM

service1-sustone-multi-attributes-role3

Expected behavior

When instanciating from command line, there is no issue here:

oneflow-template instantiate test-service
There are some networks that require user input. Use the string <<EDITOR>> to launch an editor (e.g. for multi-line inputs)
  * (Public) Network with internet access
    TYPE Existing(1), Create(2), Reserve(3). Press enter for default. 1
    VN ID. 0
ID: 8
Info for role1 VM

service1-cli-attributes-role1

Info for role2 VM

service1-cli-attributes-role2

Info for role3 VM

service1-cli-attributes-role3

Details

  • Affected Component: Sunstone
  • Hypervisor: KVM
  • Version: 6.0.0.2-1.ce on
  • OS: Debian GNU/Linux 10 (buster)

Additional context

With the cloud view, the input fields are not filled

Instanciate service with cloud view

service1-sustone-cloud-instanciate

Progress Status

  • Branch created
  • Code committed to development branch
  • Testing - QA
  • Documentation
  • Release notes - resolved issues, compatibility, known issues
  • Code committed to upstream release/hotfix branches
  • Documentation committed to upstream release/hotfix branches
@baby-gnu
Copy link
Contributor Author

My use case was to define per service INPUT to fill common values for each roles.

test-service with service wide attributes
{
  "name": "test-service",
  "deployment": "straight",
  "description": "",
  "roles": [
    {
      "name": "r1",
      "cardinality": 1,
      "vm_template": 0,
      "vm_template_contents": "NIC = [\n  NAME = \"_NIC0\",\n  NETWORK_ID = \"$Public\" ]\nCONFIG1 = \"$SERVICE_CONFIG1\"\nCONFIG2 = \"$SERVICE_CONFIG2\"\n ",
      "elasticity_policies": [],
      "scheduled_policies": []
    },
    {
      "name": "r2",
      "cardinality": 1,
      "vm_template": 0,
      "parents": [
        "r1"
      ],
      "vm_template_contents": "NIC = [\n  NAME = \"_NIC0\",\n  NETWORK_ID = \"$Public\" ]\nCONFIG1 = \"$SERVICE_CONFIG1\"\nCONFIG2 = \"$SERVICE_CONFIG2\"\n ",
      "elasticity_policies": [],
      "scheduled_policies": []
    },
    {
      "name": "r3",
      "cardinality": 1,
      "vm_template": 0,
      "parents": [
        "r1"
      ],
      "vm_template_contents": "NIC = [\n  NAME = \"_NIC0\",\n  NETWORK_ID = \"$Public\" ]\nCONFIG1 = \"$SERVICE_CONFIG1\"\nCONFIG2 = \"$SERVICE_CONFIG2\"\n ",
      "elasticity_policies": [],
      "scheduled_policies": []
    }
  ],
  "ready_status_gate": false,
  "automatic_deletion": false,
  "networks": {
    "Public": "M|network|Network with internet access| |id:"
  },
  "custom_attrs": {
    "SERVICE_CONFIG1": "M|text|Service wide value for config1| |",
    "SERVICE_CONFIG2": "M|text|Service wide value for config2| |"
  },
  "shutdown_action": "terminate-hard",
  "registration_time": 1634220409
}
instanciate the service with sunstone admin view

service2-sustone-with-vars-instanciate

role1 VM info

service2-sustone-with-vars-role1

role2 VM info

service2-sustone-with-vars-role2

role3 VM info

service2-sustone-with-vars-role3

instanciate with could view is broken

service2-sustone-with-vars-instanciate-cloud-view

instanciate from command line is OK
oneadmin@grichka:~$ oneflow-template instantiate test-service
There are some parameters that require user input. Use the string <<EDITOR>> to launch an editor (e.g. for multi-line inputs)
  * (SERVICE_CONFIG1) Service wide value for config1
    Service value for config1
  * (SERVICE_CONFIG2) Service wide value for config2
    Service value for config2
There are some networks that require user input. Use the string <<EDITOR>> to launch an editor (e.g. for multi-line inputs)
  * (Public) Network with internet access
    TYPE Existing(1), Create(2), Reserve(3). Press enter for default. 1
    VN ID. 0
ID: 12

@baby-gnu baby-gnu changed the title Sunstone missbehave with context attributees filled by vm_template_contents Sunstone missbehave with context attributes filled by vm_template_contents Oct 18, 2021
@baby-gnu
Copy link
Contributor Author

Another issue I have is:

  • define a VM template without the onegate token to make the VM usable when onegate is not enabled
  • set the TOKEN = "YES" in vm_template_contents because my service requires onegate.

To reproduce:

  1. Import ttylinux Apps

  2. Create the service template
    {
      "name": "test-service",
      "deployment": "straight",
      "description": "",
      "roles": [
        {
          "name": "r1",
          "cardinality": 1,
          "vm_template": 0,
          "vm_template_contents": "NIC = [\n  NAME = \"_NIC0\",\n  NETWORK_ID = \"$Public\" ]\nCONFIG1 = \"$SERVICE_CONFIG1\"\nCONFIG2 = \"$SERVICE_CONFIG2\"\nTOKEN = \"YES\"\n ",
          "elasticity_policies": [
    
          ],
          "scheduled_policies": [
    
          ]
        },
        {
          "name": "r2",
          "cardinality": 1,
          "vm_template": 0,
          "parents": [
            "r1"
          ],
          "vm_template_contents": "NIC = [\n  NAME = \"_NIC0\",\n  NETWORK_ID = \"$Public\" ]\nCONFIG1 = \"$SERVICE_CONFIG1\"\nCONFIG2 = \"$SERVICE_CONFIG2\"\nTOKEN = \"YES\"\n ",
          "elasticity_policies": [
    
          ],
          "scheduled_policies": [
    
          ]
        },
        {
          "name": "r3",
          "cardinality": 1,
          "vm_template": 0,
          "parents": [
            "r1"
          ],
          "vm_template_contents": "NIC = [\n  NAME = \"_NIC0\",\n  NETWORK_ID = \"$Public\" ]\nCONFIG1 = \"$SERVICE_CONFIG1\"\nCONFIG2 = \"$SERVICE_CONFIG2\"\nTOKEN = \"YES\"\n ",
          "elasticity_policies": [
    
          ],
          "scheduled_policies": [
    
          ]
        }
      ],
      "ready_status_gate": false,
      "automatic_deletion": false,
      "networks": {
        "Public": "M|network|Network with internet access| |id:"
      },
      "custom_attrs": {
        "SERVICE_CONFIG1": "M|text|Service wide value for config1| |",
        "SERVICE_CONFIG2": "M|text|Service wide value for config2| |"
      },
      "shutdown_action": "terminate-hard",
      "registration_time": 1634220409
    }
    
onevm show 46
USER TEMPLATE
CONFIG1="s-config1"
CONFIG1="$SERVICE_CONFIG1"
CONFIG2="s-config2"
CONFIG2="$SERVICE_CONFIG2"
HOT_RESIZE=[
  CPU_HOT_ADD_ENABLED="NO",
  MEMORY_HOT_ADD_ENABLED="NO" ]
HYPERVISOR="kvm"
INPUTS_ORDER="CONFIG1,CONFIG2"
LOGO="images/logos/linux.png"
MEMORY_UNIT_COST="MB"
ROLE_NAME="r1"
SERVICE_CONFIG1="s-config1"
SERVICE_CONFIG2="s-config2"
SERVICE_ID="18"
TOKEN="YES"
USER_INPUTS=[
  CONFIG1="M|text|first config| |",
  CONFIG2="M|text|second config| |" ]

VIRTUAL MACHINE TEMPLATE
AUTOMATIC_DS_REQUIREMENTS="(\"CLUSTERS/ID\" @> 0)"
AUTOMATIC_NIC_REQUIREMENTS="(\"CLUSTERS/ID\" @> 0)"
AUTOMATIC_REQUIREMENTS="(CLUSTER_ID = 0) & !(PUBLIC_CLOUD = YES) & !(PIN_POLICY = PINNED)"
CONTEXT=[
  CONFIG1="s-config1",
  CONFIG2="s-config2",
  DISK_ID="1",
  ETH0_CONTEXT_FORCE_IPV4="",
  ETH0_DNS="192.168.232.2",
  ETH0_EXTERNAL="",
  ETH0_GATEWAY="192.168.230.254",
  ETH0_GATEWAY6="",
  ETH0_IP="192.168.230.210",
  ETH0_IP6="",
  ETH0_IP6_PREFIX_LENGTH="",
  ETH0_IP6_ULA="",
  ETH0_MAC="02:00:c0:a8:e6:d2",
  ETH0_MASK="255.255.255.0",
  ETH0_METRIC="",
  ETH0_METRIC6="",
  ETH0_MTU="",
  ETH0_NETWORK="192.168.230.0",
  ETH0_SEARCH_DOMAIN="",
  ETH0_VLAN_ID="4",
  ETH0_VROUTER_IP="",
  ETH0_VROUTER_IP6="",
  ETH0_VROUTER_MANAGEMENT="",
  NETWORK="YES",
  SSH_PUBLIC_KEY="",
  TARGET="hda" ]
CPU="0.1"
GRAPHICS=[
  LISTEN="0.0.0.0",
  PORT="5946",
  TYPE="VNC" ]
MEMORY="128"
OS=[
  BOOT="",
  UUID="66bf5e6c-6b64-4066-82d7-18f130b43412" ]
TEMPLATE_ID="0"
TM_MAD_SYSTEM="ssh"
VMID="46"

@rsmontero rsmontero added this to the Release 6.2.1 milestone Oct 21, 2021
@tinova tinova modified the milestones: Release 6.2.1, Release 6.2 Oct 21, 2021
FrederickBor pushed a commit to FrederickBor/docs that referenced this issue Oct 25, 2021
Signed-off-by: Frederick Borges <fborges@opennebula.io>
FrederickBor pushed a commit to FrederickBor/docs that referenced this issue Oct 25, 2021
Signed-off-by: Frederick Borges <fborges@opennebula.io>
@FrederickBor
Copy link
Contributor

@tinova PRs to be approved:

tinova pushed a commit to OpenNebula/docs that referenced this issue Oct 25, 2021
tinova added a commit to OpenNebula/docs that referenced this issue Oct 25, 2021
Co-authored-by: Tino Vázquez <cvazquez@opennebula.io>
@tinova tinova closed this as completed Oct 25, 2021
rsmontero pushed a commit that referenced this issue Oct 29, 2021
(cherry picked from commit d4e55969c62e5abb5b1ebb38384e239c47322fed)
@FrederickBor
Copy link
Contributor

Reopening due to an error with the user inputs

@sbbarragan
Copy link

PRs to merge:

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

5 participants