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

Reconfiguring of compute_profiles failing #997

Closed
cmeissner opened this issue Sep 30, 2020 · 4 comments · Fixed by #1004
Closed

Reconfiguring of compute_profiles failing #997

cmeissner opened this issue Sep 30, 2020 · 4 comments · Fixed by #1004

Comments

@cmeissner
Copy link
Member

SUMMARY

We configure compute_profiles via ansible. Creation and first time configuring for compute_resources work well. If we change some data the configuration changes can't be applied.

ISSUE TYPE
  • Bug Report
ANSIBLE VERSION
ansible 2.9.10
KATELLO/FOREMAN VERSION
foreman-server 2.1.2
foreman-ansible-modules: 1.3.0
APYPIE VERSION
Version: 0.2.2
STEPS TO REPRODUCE
  1. create compute_profile
- name: Manage compute profile dcos compute
   theforeman.foreman.compute_profile:
    username: "admin"
    password: "xxx"
    server_url: "https://foreman.example.net"
    validate_certs: "False"
    name: "dcos compute"
    compute_attributes:
      - compute_resource: vsphere.example.net
        vm_attrs:
          cpus: 2
          sockets: 1
          memory_mb: '16384'
          firmware: automatic
          cluster: DC02
          resource_pool: foreman
          path: "/Datacenters/ACME DC/vm/SPOCK"
          guest_id: otherGuest64
          hardware_version: Default
          memoryHotAddEnabled: '0'
          cpuHotAddEnabled: '0'
          add_cdrom: '0'
          boot_order:
            - network
            - disk
          annotation: 'Foreman controlled vm'
          scsi_controllers:
            - type: VirtualLsiLogicController
              key: 1000
          interfaces_attributes:
            '0':
              type: VirtualE1000
              network: dvportgroup-150
          volumes_attributes:
            '0':
              name: Hard disk
              thin: true
              mode: persistent
              controller_key: 1000
              size_gb: 60
              storage_pod: DSC002    
    state: "present"
  1. change vm_attrs, e.g. cpus.
EXPECTED RESULTS

The value of e.g. cpus should be changed

ACTUAL RESULTS

We get fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to ensure entity state: 'id'"} without debug. With debug we get the following:

The full traceback is:
  File "/var/folders/dn/t64yh4j91fscbqw3rd2_frt9pq8rlt/T/ansible_theforeman.foreman.compute_profile_payload_2fmxtgb7/ansible_theforeman.foreman.compute_profile_payload.zip/ansible_collections/theforeman/foreman/plugins/module_utils/foreman_helper.py", line 81, in inner
    return f(self, *args, **kwargs)
  File "/var/folders/dn/t64yh4j91fscbqw3rd2_frt9pq8rlt/T/ansible_theforeman.foreman.compute_profile_payload_2fmxtgb7/ansible_theforeman.foreman.compute_profile_payload.zip/ansible_collections/theforeman/foreman/plugins/module_utils/foreman_helper.py", line 682, in ensure_entity
    updated_entity = self._update_entity(resource, desired_entity, current_entity, params, foreman_spec)
  File "/var/folders/dn/t64yh4j91fscbqw3rd2_frt9pq8rlt/T/ansible_theforeman.foreman.compute_profile_payload_2fmxtgb7/ansible_theforeman.foreman.compute_profile_payload.zip/ansible_collections/theforeman/foreman/plugins/module_utils/foreman_helper.py", line 778, in _update_entity
    payload['id'] = current_entity['id']
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "compute_attributes": [
                {
                    "compute_resource": {
                        "caching_enabled": false,
                        "compute_attributes": [
                            {
                                "attributes": {
                                    "add_cdrom": false,
                                    "annotation": "Foreman controlled vm",
                                    "cluster_id": "domain-c451",
                                    "cluster_name": "DC02",
                                    "cores_per_socket": null,
                                    "cpu_hot_add_enabled": false,
                                    "cpus": null,
                                    "firmware": "automatic",
                                    "folder_name": "SPOCK",
                                    "folder_path": "/Datacenters/ACME DC/vm/SPOCK",
                                    "guest_id": "otherGuest64",
                                    "guest_name": "Other Operating System (64-bit)",
                                    "hardware_version_id": "Default",
                                    "hardware_version_name": "Default",
                                    "image_id": null,
                                    "image_name": null,
                                    "interfaces_attributes": {
                                        "0": {
                                            "network_id": "dvportgroup-150",
                                            "network_name": "VIRTEST_1101",
                                            "type_id": "VirtualE1000",
                                            "type_name": "E1000"
                                        }
                                    },
                                    "memory": 2097152,
                                    "memory_hot_add_enabled": false,
                                    "resource_pool_id": "resgroup-2853",
                                    "resource_pool_name": "foreman",
                                    "scsi_controllers": {
                                        "0": {
                                            "key": 1000,
                                            "type": "VirtualLsiLogicController"
                                        }
                                    },
                                    "volumes_attributes": {
                                        "0": {
                                            "controller_key": 1000,
                                            "datastore_id": null,
                                            "datastore_name": null,
                                            "eager_zero": null,
                                            "mode": "persistent",
                                            "name": "Hard disk",
                                            "size": "10737418240",
                                            "thin": true
                                        }
                                    }
                                },
                                "compute_profile_id": 23,
                                "compute_profile_name": "generic",
                                "compute_resource_id": 14,
                                "compute_resource_name": "vspere.example.net",
                                "id": 43,
                                "name": "1 CPUs and 2048 MB memory",
                                "provider_friendly_name": "VMware",
                                "vm_attrs": {
                                    "add_cdrom": "0",
                                    "annotation": "Foreman controlled vm",
                                    "boot_order": [
                                        "network",
                                        "disk"
                                    ],
                                    "cluster": "DC02",
                                    "cores": 1,
                                    "cpuHotAddEnabled": "0",
                                    "firmware": "automatic",
                                    "guest_id": "otherGuest64",
                                    "hardware_version": "Default",
                                    "interfaces_attributes": {
                                        "0": {
                                            "network": "dvportgroup-150",
                                            "type": "VirtualE1000"
                                        }
                                    },
                                    "memoryHotAddEnabled": "0",
                                    "memory_mb": "2048",
                                    "path": "/Datacenters/ACME DC/vm/SPOCK",
                                    "resource_pool": "foreman",
                                    "scsi_controllers": [
                                        {
                                            "key": 1000,
                                            "type": "VirtualLsiLogicController"
                                        }
                                    ],
                                    "sockets": 1,
                                    "volumes_attributes": {
                                        "0": {
                                            "controller_key": 1000,
                                            "mode": "persistent",
                                            "name": "Hard disk",
                                            "size_gb": 10,
                                            "storage_pod": "ASH_DSC002",
                                            "thin": true
                                        }
                                    }
                                }
                            },
                            {
                                "attributes": {
                                    "add_cdrom": true,
                                    "annotation": "Foreman controlled vm",
                                    "cluster_id": "domain-c451",
                                    "cluster_name": "DC02",
                                    "cores_per_socket": 1,
                                    "cpu_hot_add_enabled": false,
                                    "cpus": 1,
                                    "firmware": "automatic",
                                    "folder_name": "SPOCK",
                                    "folder_path": "/Datacenters/ACME DC/vm/SPOCK",
                                    "guest_id": "otherLinux64Guest",
                                    "guest_name": "Linux (64-bit)",
                                    "hardware_version_id": "Default",
                                    "hardware_version_name": "Default",
                                    "image_id": null,
                                    "image_name": null,
                                    "interfaces_attributes": {
                                        "0": {
                                            "network_id": "dvportgroup-118",
                                            "network_name": "VIRTUALIZATION_1100",
                                            "type_id": "VirtualE1000",
                                            "type_name": "E1000"
                                        },
                                        "1": {
                                            "network_id": "dvportgroup-150",
                                            "network_name": "VIRTEST_1101",
                                            "type_id": "VirtualE1000",
                                            "type_name": "E1000"
                                        }
                                    },
                                    "memory": 2097152,
                                    "memory_hot_add_enabled": false,
                                    "resource_pool_id": "resgroup-2853",
                                    "resource_pool_name": "foreman",
                                    "scsi_controllers": {
                                        "0": {
                                            "key": 1000,
                                            "type": "VirtualLsiLogicController"
                                        }
                                    },
                                    "volumes_attributes": {
                                        "0": {
                                            "controller_key": 1000,
                                            "datastore_id": null,
                                            "datastore_name": null,
                                            "eager_zero": null,
                                            "mode": "persistent",
                                            "name": "Hard disk",
                                            "size": "10737418240",
                                            "thin": true
                                        }
                                    }
                                },
                                "compute_profile_id": 21,
                                "compute_profile_name": "bootstrap",
                                "compute_resource_id": 14,
                                "compute_resource_name": "vspere.example.net",
                                "id": 44,
                                "name": "1 CPUs and 2048 MB memory",
                                "provider_friendly_name": "VMware",
                                "vm_attrs": {
                                    "add_cdrom": "1",
                                    "annotation": "Foreman controlled vm",
                                    "boot_order": [
                                        "cdrom",
                                        "network",
                                        "disk"
                                    ],
                                    "cluster": "DC02",
                                    "corespersocket": 1,
                                    "cpuHotAddEnabled": "0",
                                    "cpus": 1,
                                    "firmware": "automatic",
                                    "guest_id": "otherLinux64Guest",
                                    "hardware_version": "Default",
                                    "interfaces_attributes": {
                                        "0": {
                                            "network": "dvportgroup-118",
                                            "type": "VirtualE1000"
                                        },
                                        "1": {
                                            "network": "dvportgroup-150",
                                            "type": "VirtualE1000"
                                        }
                                    },
                                    "memoryHotAddEnabled": "0",
                                    "memory_mb": 2048,
                                    "path": "/Datacenters/ACME DC/vm/SPOCK",
                                    "resource_pool": "foreman",
                                    "scsi_controllers": [
                                        {
                                            "key": 1000,
                                            "type": "VirtualLsiLogicController"
                                        }
                                    ],
                                    "volumes_attributes": {
                                        "0": {
                                            "controller_key": 1000,
                                            "mode": "persistent",
                                            "name": "Hard disk",
                                            "size_gb": 10,
                                            "storage_pod": "ASH_DSC002",
                                            "thin": true
                                        }
                                    }
                                }
                            },
                            {
                                "attributes": {
                                    "add_cdrom": false,
                                    "annotation": "Foreman controlled vm",
                                    "cluster_id": "domain-c451",
                                    "cluster_name": "DC02",
                                    "cores_per_socket": null,
                                    "cpu_hot_add_enabled": false,
                                    "cpus": null,
                                    "firmware": "automatic",
                                    "folder_name": "SPOCK",
                                    "folder_path": "/Datacenters/ACME DC/vm/SPOCK",
                                    "guest_id": "otherGuest64",
                                    "guest_name": "Other Operating System (64-bit)",
                                    "hardware_version_id": "Default",
                                    "hardware_version_name": "Default",
                                    "image_id": null,
                                    "image_name": null,
                                    "interfaces_attributes": {
                                        "0": {
                                            "network_id": "dvportgroup-150",
                                            "network_name": "VIRTEST_1101",
                                            "type_id": "VirtualE1000",
                                            "type_name": "E1000"
                                        }
                                    },
                                    "memory": 33554432,
                                    "memory_hot_add_enabled": false,
                                    "resource_pool_id": "resgroup-2853",
                                    "resource_pool_name": "foreman",
                                    "scsi_controllers": {
                                        "0": {
                                            "key": 1000,
                                            "type": "VirtualLsiLogicController"
                                        }
                                    },
                                    "volumes_attributes": {
                                        "0": {
                                            "controller_key": 1000,
                                            "datastore_id": null,
                                            "datastore_name": null,
                                            "eager_zero": null,
                                            "mode": "persistent",
                                            "name": "Hard disk",
                                            "size": "128849018880",
                                            "thin": true
                                        }
                                    }
                                },
                                "compute_profile_id": 28,
                                "compute_profile_name": "dcos mn",
                                "compute_resource_id": 14,
                                "compute_resource_name": "vspere.example.net",
                                "id": 45,
                                "name": "1 CPUs and 32768 MB memory",
                                "provider_friendly_name": "VMware",
                                "vm_attrs": {
                                    "add_cdrom": "0",
                                    "annotation": "Foreman controlled vm",
                                    "boot_order": [
                                        "network",
                                        "disk"
                                    ],
                                    "cluster": "DC02",
                                    "cores": 4,
                                    "cpuHotAddEnabled": "0",
                                    "firmware": "automatic",
                                    "guest_id": "otherGuest64",
                                    "hardware_version": "Default",
                                    "interfaces_attributes": {
                                        "0": {
                                            "network": "dvportgroup-150",
                                            "type": "VirtualE1000"
                                        }
                                    },
                                    "memoryHotAddEnabled": "0",
                                    "memory_mb": "32768",
                                    "path": "/Datacenters/ACME DC/vm/SPOCK",
                                    "resource_pool": "foreman",
                                    "scsi_controllers": [
                                        {
                                            "key": 1000,
                                            "type": "VirtualLsiLogicController"
                                        }
                                    ],
                                    "sockets": 1,
                                    "volumes_attributes": {
                                        "0": {
                                            "controller_key": 1000,
                                            "mode": "persistent",
                                            "name": "Hard disk",
                                            "size_gb": 120,
                                            "storage_pod": "ASH_DSC002",
                                            "thin": true
                                        }
                                    }
                                }
                            },
                            {
                                "attributes": {
                                    "add_cdrom": false,
                                    "annotation": "Foreman controlled vm",
                                    "cluster_id": "domain-c451",
                                    "cluster_name": "DC02",
                                    "cores_per_socket": null,
                                    "cpu_hot_add_enabled": false,
                                    "cpus": null,
                                    "firmware": "automatic",
                                    "folder_name": "SPOCK",
                                    "folder_path": "/Datacenters/ACME DC/vm/SPOCK",
                                    "guest_id": "otherGuest64",
                                    "guest_name": "Other Operating System (64-bit)",
                                    "hardware_version_id": "Default",
                                    "hardware_version_name": "Default",
                                    "image_id": null,
                                    "image_name": null,
                                    "interfaces_attributes": {
                                        "0": {
                                            "network_id": "dvportgroup-150",
                                            "network_name": "VIRTEST_1101",
                                            "type_id": "VirtualE1000",
                                            "type_name": "E1000"
                                        }
                                    },
                                    "memory": 16777216,
                                    "memory_hot_add_enabled": false,
                                    "resource_pool_id": "resgroup-2853",
                                    "resource_pool_name": "foreman",
                                    "scsi_controllers": {
                                        "0": {
                                            "key": 1000,
                                            "type": "VirtualLsiLogicController"
                                        }
                                    },
                                    "volumes_attributes": {
                                        "0": {
                                            "controller_key": 1000,
                                            "datastore_id": null,
                                            "datastore_name": null,
                                            "eager_zero": null,
                                            "mode": "persistent",
                                            "name": "Hard disk",
                                            "size": "64424509440",
                                            "thin": true
                                        }
                                    }
                                },
                                "compute_profile_id": 29,
                                "compute_profile_name": "dcos compute",
                                "compute_resource_id": 14,
                                "compute_resource_name": "vspere.example.net",
                                "id": 46,
                                "name": "1 CPUs and 16384 MB memory",
                                "provider_friendly_name": "VMware",
                                "vm_attrs": {
                                    "add_cdrom": "0",
                                    "annotation": "Foreman controlled vm",
                                    "boot_order": [
                                        "network",
                                        "disk"
                                    ],
                                    "cluster": "DC02",
                                    "cores": 2,
                                    "cpuHotAddEnabled": "0",
                                    "firmware": "automatic",
                                    "guest_id": "otherGuest64",
                                    "hardware_version": "Default",
                                    "interfaces_attributes": {
                                        "0": {
                                            "network": "dvportgroup-150",
                                            "type": "VirtualE1000"
                                        }
                                    },
                                    "memoryHotAddEnabled": "0",
                                    "memory_mb": "16384",
                                    "path": "/Datacenters/ACME DC/vm/SPOCK",
                                    "resource_pool": "foreman",
                                    "scsi_controllers": [
                                        {
                                            "key": 1000,
                                            "type": "VirtualLsiLogicController"
                                        }
                                    ],
                                    "sockets": 1,
                                    "volumes_attributes": {
                                        "0": {
                                            "controller_key": 1000,
                                            "mode": "persistent",
                                            "name": "Hard disk",
                                            "size_gb": 60,
                                            "storage_pod": "ASH_DSC002",
                                            "thin": true
                                        }
                                    }
                                }
                            }
                        ],
                        "created_at": "2020-09-30 12:04:19 UTC",
                        "datacenter": "ACME DC",
                        "description": null,
                        "display_type": "vmrc",
                        "id": 14,
                        "images": [],
                        "locations": [
                            {
                                "description": null,
                                "id": 19,
                                "name": "0193",
                                "title": "0193"
                            }
                        ],
                        "name": "vspere.example.net",
                        "organizations": [
                            {
                                "description": null,
                                "id": 18,
                                "name": "SPOCK",
                                "title": "SPOCK"
                            }
                        ],
                        "provider": "Vmware",
                        "provider_friendly_name": "VMware",
                        "server": "vspere.example.net",
                        "set_console_password": true,
                        "updated_at": "2020-09-30 12:04:19 UTC",
                        "url": "vspere.example.net",
                        "user": "qqsimp0"
                    },
                    "vm_attrs": {
                        "add_cdrom": "0",
                        "annotation": "Foreman controlled vm",
                        "boot_order": [
                            "network",
                            "disk"
                        ],
                        "cluster": "DC02",
                        "cpuHotAddEnabled": "0",
                        "cpus": 1,
                        "firmware": "automatic",
                        "guest_id": "otherGuest64",
                        "hardware_version": "Default",
                        "interfaces_attributes": {
                            "0": {
                                "network": "dvportgroup-150",
                                "type": "VirtualE1000"
                            }
                        },
                        "memoryHotAddEnabled": "0",
                        "memory_mb": "2048",
                        "path": "/Datacenters/ACME DC/vm/SPOCK",
                        "resource_pool": "foreman",
                        "scsi_controllers": [
                            {
                                "key": 1000,
                                "type": "VirtualLsiLogicController"
                            }
                        ],
                        "sockets": 1,
                        "volumes_attributes": {
                            "0": {
                                "controller_key": 1000,
                                "mode": "persistent",
                                "name": "Hard disk",
                                "size_gb": 10,
                                "storage_pod": "ASH_DSC002",
                                "thin": true
                            }
                        }
                    }
                }
            ],
            "name": "generic",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "server_url": "https://foreman.prod.spock.example.net",
            "state": "present",
            "updated_name": null,
            "username": "admin",
            "validate_certs": false
        }
    },
    "msg": "Failed to ensure entity state: 'id'"
}
@cmeissner
Copy link
Member Author

biggest problem is that ignore_errors does not seem to work, because the error is fatal.

@evgeni
Copy link
Member

evgeni commented Oct 1, 2020

Can you please provide the output of the playbook with --check --diff, that makes it easier to understand what it tries to update.

@evgeni
Copy link
Member

evgeni commented Oct 1, 2020

After talking on IRC: that won't help, damn.

@evgeni
Copy link
Member

evgeni commented Oct 1, 2020

Okay, I can reproduce the error locally.

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

Successfully merging a pull request may close this issue.

2 participants