Bug #6809
closedUnstable API Create host
Description
Foreman 1.2.2
The API for creating a host displays some unstable behaviour. The same API call (see below) with exactly the same parameters sometimes succeeds, but also sometimes fails. When the API call fails, then the following error message is found in the production.log (also attached).
Error message
=============
Failed to create a compute vmware-cluster4-devops (VMWare) instance xxxxxxx.xxx.xxx.xxxxxx.xx: failed to create vm: undefined method `resourcePool' for nil:NilClass
API Call
========
curl -k -v -H "Content-Type: application/json" -X POST -d '{"host":{"name": "xxxxxxxx.xxx.xxxx.xxxxxx.xx", "compute_resource_id": "1", "hostgroup_id": "58", "environment_id": "10", "puppet_ca_proxy_id": "3", "puppet_proxy_id": "3", "managed": "true", "type": "Host::Managed", "compute_attributes": {"cpus": "1", "memory_mb": "768", "cluster": "Cluster 4", "path": "/Datacenters/CJIB/vm/Accelerate DevOPS", "interfaces_attributes": {"new_interfaces": {"network": "dvPortGroup-VMs-Shared_Services", "_delete": ""}, "0": {"network": "dvPortGroup-VMs-ATO_APP", "_delete": ""}}, "volumes_attributes": {"new_volumes": {"datastore": "P9520 CL4 P186", "name": "Hard disk", "size_gb": "10", "_delete": ""}, "0": {"datastore": "P9520 CL4 P186", "name": "Hard disk", "size_gb": "10", "_delete" : ""}, "new_1378299118398": {"datastore": "P9520 CL4 P186", "name": "Hard disk", "size_gb": "10", "_delete": ""}}, "start": "1"}, "mac": "", "domain_id": "4", "subnet_id": "7", "interfaces_attributes": {"new_interfaces": {"_destroy": "false", "type": "Nic::Managed", "mac": "", "name": "", "domain_id": "", "subnet_id": "", "ip": "", "provider": "IPMI"}}, "architecture_id": "1", "operatingsystem_id": "9", "provision_method": "build", "build": "1", "medium_id": "8", "ptable_id": "13", "disk": "", "is_owned_by": "", "enabled": "1", "comment": "", "overwrite": "false"}}' -u admin:changeme https://xxxxxxx.xxxt.xxxx.xxxxxx.xx:443/api/hosts
Files