CentOS-PaaS-SIG / linchpin

ansible based multicloud orchestrator
http://linchpin.readthedocs.io
GNU General Public License v3.0
115 stars 70 forks source link

Bug: libvirt topology validation fail #457

Closed samvarankashyap closed 6 years ago

samvarankashyap commented 6 years ago

Branch: linchpin develop branch

error

23:46:13 Inserting img_src 23:46:13 ++ find /workDir/workspace -name untested-atomic.qcow2 23:46:13 ++ tail -n 1 23:46:13 + img_src=/workDir/workspace/ci-stage-pipeline-f27/untested-atomic.qcow2 23:46:13 + sed -i 's| image_src\:.*| image_src\: "file\:\/\//workDir/workspace/ci-stage-pipeline-f27/untested-atomic.qcow2"|' /root/linchpin_workspace/topologies/example-topology.yml 23:46:13 + echo 'Running linchpin up inside libvirt container' 23:46:13 Running linchpin up inside libvirt container 23:46:13 + linchpin -v -w /root/linchpin_workspace up 23:46:13 Topology '{'topology_name': 'libvirt', 'resource_groups': [{'resource_group_name': 'ex', 'resource_definitions': [{'count': 1, 'cloud_config': {'users': [{'name': 'admin', 'sudo': 'ALL=(ALL) NOPASSWD:ALL', 'lock_passwd': True, 'gecos': 'Admin User', 'groups': 'wheel', 'ssh-import-id': 'None'}]}, 'name': 'fedoraati', 'driver': 'qemu', 'uri': 'qemu:///system', 'networks': [{'name': 'default'}], 'vcpus': 2, 'additional_storage': '15G', 'role': 'libvirt_node', 'copy_ssh_keys': True, 'memory': 6144, 'network_bridge': 'virbr3', 'arch': 'x86_64', 'image_src': 'file:///workDir/workspace/ci-stage-pipeline-f27/untested-atomic.qcow2'}], 'resource_group_type': 'libvirt'}]}' does not validate

topolgy used in linchpin workspace

---
topology_name: libvirt
resource_groups:
  - resource_group_name: ex
    resource_group_type: libvirt
    resource_definitions:
      - role: libvirt_node
        name: fedoraati
        uri: qemu:///system
        count: 1
        image_src: file:///home/output/images/untested-atomic.qcow2
        memory: 6144
        driver: qemu
        vcpus: 2
        arch: x86_64
        copy_ssh_keys: true
        network_bridge: virbr3
        networks:
          - name: default
        additional_storage: 15G
        cloud_config:
          users:
            - name: admin
              gecos: Admin User
              groups: wheel
              sudo: ALL=(ALL) NOPASSWD:ALL
              ssh-import-id: None
              lock_passwd: true

However when i tried running this topology manually , it seems to workfine , but in a jenkins environment it fails.

samvarankashyap commented 6 years ago
 'gecos': 'Admin User', 'groups': 'wheel', 'ssh-import-id': 'None'}]}, 'name': 'fedra', 'driver': 'qemu', 'uri': 'qemu:///system', 'networks': [{'name': 'default'}], 'vcpus': 2, 'additional_storage': '15G', 'role': 'libvirt_nod
e', 'copy_ssh_keys': True, 'memory': 6144, 'network_bridge': 'virbr3', 'arch': 'x86_64', 'image_src': 'file:///workDir/testw/untested-atomic.qcow2'}], 'resource_group_type': 'libvirt'}]}' does not validate due to message Schema
 validation failed: {'res_defs': [{0: [{'anyof': ['no definitions validate', {'anyof definition 2': ['unknown field', 'unknown field', 'unknown field', 'unknown field', 'unknown field', 'unknown field', 'unknown field', 'unknow
n field', 'unknown field', 'unknown field', 'unallowed value libvirt_node', 'unknown field', 'required field', 'required field'], 'anyof definition 0': ['unknown field'], 'anyof definition 1': ['unknown field', 'unknown field',
 'unknown field', 'unknown field', 'unknown field', 'unknown field', 'unknown field', 'unknown field', 'unknown field', 'unknown field', 'unallowed value libvirt_node', 'unknown field', 'required field']}]}]}]} and execption Sc
hema validation failed: {'res_defs': [{0: [{'anyof': ['no definitions validate', {'anyof definition 2': ['unknown field', 'unknown field', 'unknown field', 'unknown field', 'unknown field', 'unknown field', 'unknown field', 'un
known field', 'unknown field', 'unknown field', 'unallowed value libvirt_node', 'unknown field', 'required field', 'required field'], 'anyof definition 0': ['unknown field'], 'anyof definition 1': ['unknown field', 'unknown fie
ld', 'unknown field', 'unknown field', 'unknown field', 'unknown field', 'unknown field', 'unknown field', 'unknown field', 'unknown field', 'unallowed value libvirt_node', 'unknown field', 'required field']}]}]}]}
samvarankashyap commented 6 years ago

surprisingly the following topology works

---
topology_name: "libvirt"
resource_groups:
  - resource_group_name: "ex"
    res_group_type: "libvirt"
    res_defs:
      - res_name: "f27test"
        res_type: "libvirt_node"
        uri: 'qemu:///system'
        count: 1
        image_src: 'file:///workDir/testw/untested-atomic.qcow2'
        memory: 3096
        vcpus: 2
        arch: x86_64
        network_bridge: 'virbr3'
        networks:
          - name: default
        additional_storage: 10G
        cloud_config:
          users:
            - name: admin
              gecos: Admin User
              groups: wheel
              sudo: ALL=(ALL) NOPASSWD:ALL
              ssh-import-id: None
              lock_passwd: true
herlo commented 6 years ago

@samvarankashyap let me give this a try...

herlo commented 6 years ago

@samvarankashyap the difference is in copy_ssh_keys. Clearly you are using this and it's not found in the role.

herlo commented 6 years ago

I should clarify that while copy_ssh_keys may have been in an older version of LinchPin, this version doesn't support it because it doesn't appear to be used anywhere in the libvirt role.