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

linchpin libvirt provisioning fails during 'define node template' task with UndefinedVariable: 'int object' has no attribute 'memory'" error #1425

Closed
mcornea opened this issue Oct 23, 2019 · 1 comment
Labels
Milestone

Comments

@mcornea
Copy link
Contributor

mcornea commented Oct 23, 2019

Describe the bug
linchpin libvirt provisioning fails during 'define node template' task with UndefinedVariable: 'int object' has no attribute 'memory'" error:

TASK [libvirt : define node template] ********************************************************************************************************************************************************************************************************
failed: [localhost] (item=[{u'cloud_config': {u'run_commands': [], u'virt_type': u'cloud-init', u'users': [{u'sudo': u'ALL=(ALL) NOPASSWD:ALL', u'gecos': u'Admin User', u'name': u'kni', u'groups': u'wheel', u'lock_passwd': False}]}, u'domain': u'example.com', u'driver': u'kvm', u'ssh_key': u'id_rsa', u'network_bridge': u'', u'disk_type': u'virtio_scsi', u'arch': u'x86_64', u'networks': [{u'name': u'baremetal'}, {u'dhcp': False, u'name': u'provisioning'}], u'count': 3, u'remote_user': u'root', u'name': u'rhhi-node-master', u'name_separator': u'-', u'storage': [{u'units': u'G', u'disk_type': u'virtio_scsi', u'name': u'osd0', u'device': u'sdb', u'cache': u'unsafe', u'size': 8}, {u'units': u'G', u'disk_type': u'virtio_scsi', u'name': u'osd1', u'device': u'sdc', u'cache': u'unsafe', u'size': 8}, {u'units': u'G', u'disk_type': u'virtio_scsi', u'name': u'osd2', u'device': u'sdd', u'cache': u'unsafe', u'size': 8}, {u'units': u'G', u'disk_type': u'virtio_scsi', u'name': u'osd3', u'device': u'sde', u'cache': u'unsafe', u'size': 8}], u'uri': u'qemu:///system', u'cpu_mode': u'host-passthrough', u'vcpus': 16, u'additional_storage': u'42G', u'role': u'libvirt_node', u'disk_cache': u'none', u'memory': 32768, u'boot_dev': u'hd', u'image_src': u'http://download.eng.bos.redhat.com/brewroot/packages/rhel-guest-image/8.0/1876/images/rhel-guest-image-8.0-1876.x86_64.qcow2'}, 0, u'/var/lib/libvirt/images/linchpin/', u'qcow2', u'-', u'none', u'host-passthrough', u'virtio_scsi']) => {"ansible_loop_var": "definition", "changed": false, "definition": [{"additional_storage": "42G", "arch": "x86_64", "boot_dev": "hd", "cloud_config": {"run_commands": [], "users": [{"gecos": "Admin User", "groups": "wheel", "lock_passwd": false, "name": "kni", "sudo": "ALL=(ALL) NOPASSWD:ALL"}], "virt_type": "cloud-init"}, "count": 3, "cpu_mode": "host-passthrough", "disk_cache": "none", "disk_type": "virtio_scsi", "domain": "example.com", "driver": "kvm", "image_src": "http://download.eng.bos.redhat.com/brewroot/packages/rhel-guest-image/8.0/1876/images/rhel-guest-image-8.0-1876.x86_64.qcow2", "memory": 32768, "name": "rhhi-node-master", "name_separator": "-", "network_bridge": "", "networks": [{"name": "baremetal"}, {"dhcp": false, "name": "provisioning"}], "remote_user": "root", "role": "libvirt_node", "ssh_key": "id_rsa", "storage": [{"cache": "unsafe", "device": "sdb", "disk_type": "virtio_scsi", "name": "osd0", "size": 8, "units": "G"}, {"cache": "unsafe", "device": "sdc", "disk_type": "virtio_scsi", "name": "osd1", "size": 8, "units": "G"}, {"cache": "unsafe", "device": "sdd", "disk_type": "virtio_scsi", "name": "osd2", "size": 8, "units": "G"}, {"cache": "unsafe", "device": "sde", "disk_type": "virtio_scsi", "name": "osd3", "size": 8, "units": "G"}], "uri": "qemu:///system", "vcpus": 16}, 0, "/var/lib/libvirt/images/linchpin/", "qcow2", "-", "none", "host-passthrough", "virtio_scsi"], "msg": "AnsibleUndefinedVariable: 'int object' has no attribute 'memory'"}
failed: [localhost] (item=[{u'cloud_config': {u'run_commands': [], u'virt_type': u'cloud-init', u'users': [{u'sudo': u'ALL=(ALL) NOPASSWD:ALL', u'gecos': u'Admin User', u'name': u'kni', u'groups': u'wheel', u'lock_passwd': False}]}, u'domain': u'example.com', u'driver': u'kvm', u'ssh_key': u'id_rsa', u'network_bridge': u'', u'disk_type': u'virtio_scsi', u'arch': u'x86_64', u'networks': [{u'name': u'baremetal'}, {u'dhcp': False, u'name': u'provisioning'}], u'count': 3, u'remote_user': u'root', u'name': u'rhhi-node-master', u'name_separator': u'-', u'storage': [{u'units': u'G', u'disk_type': u'virtio_scsi', u'name': u'osd0', u'device': u'sdb', u'cache': u'unsafe', u'size': 8}, {u'units': u'G', u'disk_type': u'virtio_scsi', u'name': u'osd1', u'device': u'sdc', u'cache': u'unsafe', u'size': 8}, {u'units': u'G', u'disk_type': u'virtio_scsi', u'name': u'osd2', u'device': u'sdd', u'cache': u'unsafe', u'size': 8}, {u'units': u'G', u'disk_type': u'virtio_scsi', u'name': u'osd3', u'device': u'sde', u'cache': u'unsafe', u'size': 8}], u'uri': u'qemu:///system', u'cpu_mode': u'host-passthrough', u'vcpus': 16, u'additional_storage': u'42G', u'role': u'libvirt_node', u'disk_cache': u'none', u'memory': 32768, u'boot_dev': u'hd', u'image_src': u'http://download.eng.bos.redhat.com/brewroot/packages/rhel-guest-image/8.0/1876/images/rhel-guest-image-8.0-1876.x86_64.qcow2'}, 1, u'/var/lib/libvirt/images/linchpin/', u'qcow2', u'-', u'none', u'host-passthrough', u'virtio_scsi']) => {"ansible_loop_var": "definition", "changed": false, "definition": [{"additional_storage": "42G", "arch": "x86_64", "boot_dev": "hd", "cloud_config": {"run_commands": [], "users": [{"gecos": "Admin User", "groups": "wheel", "lock_passwd": false, "name": "kni", "sudo": "ALL=(ALL) NOPASSWD:ALL"}], "virt_type": "cloud-init"}, "count": 3, "cpu_mode": "host-passthrough", "disk_cache": "none", "disk_type": "virtio_scsi", "domain": "example.com", "driver": "kvm", "image_src": "http://download.eng.bos.redhat.com/brewroot/packages/rhel-guest-image/8.0/1876/images/rhel-guest-image-8.0-1876.x86_64.qcow2", "memory": 32768, "name": "rhhi-node-master", "name_separator": "-", "network_bridge": "", "networks": [{"name": "baremetal"}, {"dhcp": false, "name": "provisioning"}], "remote_user": "root", "role": "libvirt_node", "ssh_key": "id_rsa", "storage": [{"cache": "unsafe", "device": "sdb", "disk_type": "virtio_scsi", "name": "osd0", "size": 8, "units": "G"}, {"cache": "unsafe", "device": "sdc", "disk_type": "virtio_scsi", "name": "osd1", "size": 8, "units": "G"}, {"cache": "unsafe", "device": "sdd", "disk_type": "virtio_scsi", "name": "osd2", "size": 8, "units": "G"}, {"cache": "unsafe", "device": "sde", "disk_type": "virtio_scsi", "name": "osd3", "size": 8, "units": "G"}], "uri": "qemu:///system", "vcpus": 16}, 1, "/var/lib/libvirt/images/linchpin/", "qcow2", "-", "none", "host-passthrough", "virtio_scsi"], "msg": "AnsibleUndefinedVariable: 'int object' has no attribute 'memory'"}
failed: [localhost] (item=[{u'cloud_config': {u'run_commands': [], u'virt_type': u'cloud-init', u'users': [{u'sudo': u'ALL=(ALL) NOPASSWD:ALL', u'gecos': u'Admin User', u'name': u'kni', u'groups': u'wheel', u'lock_passwd': False}]}, u'domain': u'example.com', u'driver': u'kvm', u'ssh_key': u'id_rsa', u'network_bridge': u'', u'disk_type': u'virtio_scsi', u'arch': u'x86_64', u'networks': [{u'name': u'baremetal'}, {u'dhcp': False, u'name': u'provisioning'}], u'count': 3, u'remote_user': u'root', u'name': u'rhhi-node-master', u'name_separator': u'-', u'storage': [{u'units': u'G', u'disk_type': u'virtio_scsi', u'name': u'osd0', u'device': u'sdb', u'cache': u'unsafe', u'size': 8}, {u'units': u'G', u'disk_type': u'virtio_scsi', u'name': u'osd1', u'device': u'sdc', u'cache': u'unsafe', u'size': 8}, {u'units': u'G', u'disk_type': u'virtio_scsi', u'name': u'osd2', u'device': u'sdd', u'cache': u'unsafe', u'size': 8}, {u'units': u'G', u'disk_type': u'virtio_scsi', u'name': u'osd3', u'device': u'sde', u'cache': u'unsafe', u'size': 8}], u'uri': u'qemu:///system', u'cpu_mode': u'host-passthrough', u'vcpus': 16, u'additional_storage': u'42G', u'role': u'libvirt_node', u'disk_cache': u'none', u'memory': 32768, u'boot_dev': u'hd', u'image_src': u'http://download.eng.bos.redhat.com/brewroot/packages/rhel-guest-image/8.0/1876/images/rhel-guest-image-8.0-1876.x86_64.qcow2'}, 2, u'/var/lib/libvirt/images/linchpin/', u'qcow2', u'-', u'none', u'host-passthrough', u'virtio_scsi']) => {"ansible_loop_var": "definition", "changed": false, "definition": [{"additional_storage": "42G", "arch": "x86_64", "boot_dev": "hd", "cloud_config": {"run_commands": [], "users": [{"gecos": "Admin User", "groups": "wheel", "lock_passwd": false, "name": "kni", "sudo": "ALL=(ALL) NOPASSWD:ALL"}], "virt_type": "cloud-init"}, "count": 3, "cpu_mode": "host-passthrough", "disk_cache": "none", "disk_type": "virtio_scsi", "domain": "example.com", "driver": "kvm", "image_src": "http://download.eng.bos.redhat.com/brewroot/packages/rhel-guest-image/8.0/1876/images/rhel-guest-image-8.0-1876.x86_64.qcow2", "memory": 32768, "name": "rhhi-node-master", "name_separator": "-", "network_bridge": "", "networks": [{"name": "baremetal"}, {"dhcp": false, "name": "provisioning"}], "remote_user": "root", "role": "libvirt_node", "ssh_key": "id_rsa", "storage": [{"cache": "unsafe", "device": "sdb", "disk_type": "virtio_scsi", "name": "osd0", "size": 8, "units": "G"}, {"cache": "unsafe", "device": "sdc", "disk_type": "virtio_scsi", "name": "osd1", "size": 8, "units": "G"}, {"cache": "unsafe", "device": "sdd", "disk_type": "virtio_scsi", "name": "osd2", "size": 8, "units": "G"}, {"cache": "unsafe", "device": "sde", "disk_type": "virtio_scsi", "name": "osd3", "size": 8, "units": "G"}], "uri": "qemu:///system", "vcpus": 16}, 2, "/var/lib/libvirt/images/linchpin/", "qcow2", "-", "none", "host-passthrough", "virtio_scsi"], "msg": "AnsibleUndefinedVariable: 'int object' has no attribute 'memory'"}

PLAY RECAP ***********************************************************************************************************************************************************************************************************************************
localhost                  : ok=35   changed=2    unreachable=0    failed=1    skipped=12   rescued=0    ignored=1 

To Reproduce
Steps to reproduce the behavior:

linchpin --template-data @hooks/ansible/rhhi-setup/extravars.yaml -v up libvirt-network libvirt-new

Pinfile:

#jinja2:lstrip_blocks: True
---
libvirt-network:
  topology: libvirt-network.yml
  hooks:
    predestroy:
      - name: rhhi-setup
        type: ansible
        context: True
        actions:
          - playbook: requirements.yaml

cfgs:
  libvirt:
    __IP__: name
    __ADDRESS__: ip

libvirt-new:
  topology: libvirt-new.yml
  layout: libvirt-new.yml
  hooks:
    postdestroy:
      - name: rhhi-setup
        type: ansible
        context: True
        actions:
          - playbook: vbmc.yaml
            extra_vars: { "action": "cleanup" }
    postup:
      - name: rhhi-setup
        type: ansible
        context: True
        actions:
          - playbook: dns_update.yaml
            vars: extravars.yaml
          - playbook: nic_adjust.yaml
            vars: extravars.yaml
{% if not use_dev_scripts %}
          - playbook: install_slim_iso.yaml
            vars: extravars.yaml
{% endif %}
          - playbook: vbmc.yaml
            extra_vars: { "action": "install" }

beaker-specific-host:
  topology: beaker-specific-host.yml
  layout: beaker-layout.yml

beaker-qe-dedicated:
  topology: beaker-qe-dedicated.yml
  layout: beaker-layout.yml

beaker-ci-pool:
  topology: beaker-ci-pool.yml
  layout: beaker-layout.yml

openstack-target:
  topology: openstack-topology.yml
  layout: openstack-layout.yml

bmiso-target:
  topology: bmiso-topology.yml
  layout: bmiso-layout.yml

libvirt-new.yml:

---
topology_name: rhhi
resource_groups:
  - resource_group_name: rhhi-node-master
    resource_group_type: libvirt
    resource_definitions:
      - role: libvirt_node
        name: rhhi-node-master
        uri: qemu:///system
        count: 3
        image_src: http://download.eng.bos.redhat.com/brewroot/packages/rhel-guest-image/8.0/1876/images/rhel-guest-image-8.0-1876.x86_64.qcow2
        cpu_mode: host-passthrough
        memory: {{ node_memory }}
        vcpus: {{ node_vcpus }}
        arch: x86_64
        ssh_key: id_rsa
        additional_storage: 42G
        disk_type: virtio_scsi
        name_separator: '-'
        cloud_config:
          users:
            - name: kni
              gecos: Admin User
              groups: wheel
              sudo: ALL=(ALL) NOPASSWD:ALL
              lock_passwd: false
        networks:
          - name: baremetal
          - name: provisioning
            dhcp: false
        storage:
          - name: osd0
            size: {{ osd_disk_size }}
            cache: unsafe
            units: G
            disk_type: virtio_scsi
            device: sdb
          - name: osd1
            size: {{ osd_disk_size }}
            cache: unsafe
            units: G
            disk_type: virtio_scsi
            device: sdc
          - name: osd2
            size: {{ osd_disk_size }}
            cache: unsafe
            units: G
            disk_type: virtio_scsi
            device: sdd
          - name: osd3
            size: {{ osd_disk_size }}
            cache: unsafe
            units: G
            disk_type: virtio_scsi
            device: sde
  - resource_group_name: rhhi-node-worker
    resource_group_type: libvirt
    resource_definitions:
      - role: libvirt_node
        name: rhhi-node-worker
        uri: qemu:///system
        count: {{ node_count|int - 3 }} # If this results in count <= 0, I am quite sure linchpin up will fail
        memory: {{ node_memory }}
        vcpus: {{ node_vcpus }}
        image_src: http://rhos-qe-mirror-rdu2.usersys.redhat.com/brewroot/packages/rhel-guest-image/8.0/1854/images/rhel-guest-image-8.0-1854.x86_64.qcow2
        cpu_mode: host-passthrough
        arch: x86_64
        ssh_key: id_rsa
        additional_storage: 42G
        disk_type: virtio_scsi
        name_separator: '-'
        cloud_config:
          users:
            - name: kni
              gecos: Admin User
              groups: wheel
              sudo: ALL=(ALL) NOPASSWD:ALL
              lock_passwd: false
        networks:
          - name: baremetal
          - name: provisioning
            dhcp: false
        storage:
          - name: osd0
            size: {{ osd_disk_size }}
            cache: unsafe
            units: G
            disk_type: virtio_scsi
            device: sdb
          - name: osd1
            size: {{ osd_disk_size }}
            cache: unsafe
            units: G
            disk_type: virtio_scsi
            device: sdc
          - name: osd2
            size: {{ osd_disk_size }}
            cache: unsafe
            units: G
            disk_type: virtio_scsi
            device: sdd
          - name: osd3
            size: {{ osd_disk_size }}
            cache: unsafe
            units: G
            disk_type: virtio_scsi
            device: sde

libvirt-network.yml:

---
topology_name: "libvirt_network"
resource_groups:
  - resource_group_name: baremetal_net
    resource_group_type: libvirt
    resource_definitions:
      - name: baremetal
        role: libvirt_network
        uri: qemu:///system
        forward_mode: nat
        ip: 192.168.123.1
        dhcp_start: 192.168.123.100
        dhcp_end: 192.168.123.150
        delete_on_destroy: yes
        domain: {{ cluster_domain }}
        bridge: baremetal
        dns:
          forwarders:
            - domain: apps.{{ cluster_domain }}
              addr: 127.0.0.1
          hosts:
            - ip: 192.168.123.5
              hostnames:
                - api

  - resource_group_name: provisioning_net
    resource_group_type: libvirt
    resource_definitions:
      - name: provisioning
        role: libvirt_network
        uri: qemu:///system
        bridge: provisioning
        delete_on_destroy: yes
@14rcole 14rcole added this to the v1.9.0 milestone Oct 25, 2019
mcornea added a commit to mcornea/linchpin that referenced this issue Oct 25, 2019
This is a continuation for PR#1429 to provide a fix for CentOS-PaaS-SIG#1425.
mcornea added a commit to mcornea/linchpin that referenced this issue Oct 25, 2019
This is a continuation for PR#1429 to provide a fix for CentOS-PaaS-SIG#1425.
@samvarankashyap
Copy link
Contributor

Fixed by #1430 #1429
Please do reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants