Create host through api - mac required

Hi!

I'm using foreman 1.5.1 (I know… a little old) and I'm trying to
create a new host in an oVirt compute resource. I'm passing all the
required fields but it always complains about the mac being empty
though the subnet thet I'm passing has a dhcp proxy.

The detailed info of the request is:

@@@@@ request @@@@@@@@@@@@@@@@@
-------- data sent -----------------
{"host": {"comment": "", "environment_id": 1, "model_id": 1, "provision_method": "image", "compute_resource_id": 4, "puppet_status": 1, "domain_id": 12, "subnet_id": 5, "architecture_name": "x86_64", "domain_name": "phx.ovirt.org", "image_id": 5, "architecture_id": 1, "operatingsystem_id": 8, "certname": "el6-vm07.phx.ovirt.org", "puppet_ca_proxy_id": 1, "puppet_proxy_id": 1, "name": "el6-vm07.phx.ovirt.org", "enabled": true, "hostgroup_id": 2}}

··· ------------------------------------

@@@@@ response @@@@@@@@@@@@@@@@
code = 422
reason = Unprocessable Entity
--------- data received ------------
{
“error”: {“id”:null,“errors”:{“mac”:[“is invalid”,“can’t be blank”]},“full_messages”:[“MAC address is invalid”,“MAC address can’t be blank”]}
}

Is that a bug or I’m doing something wrong?


David Caro

Red Hat S.L.
Continuous Integration Engineer - EMEA ENG Virtualization R&D

Tel.: +420 532 294 605
Email: dcaro@redhat.com
Web: www.redhat.com
RHT Global #: 82-62605

Hmm, I don't see a compute_attributes hash in that call, which is
where you'd define the nics for the server. Without any nics, its
correctly saying it can't find a mac (since there won't be one). At
the very least, define a compute profile for your ovirt resource and
specify compute_profile in the hash.

HTH,
Greg

But I don't have any compute profile and I don't want to have one. I can
create hosts from the ui without defining any (unless it uses the default
without telling me). It should be able to get the nics and disks from the
image it's provisioning from right?

··· On Wednesday, December 3, 2014 12:27:14 AM UTC+1, Greg Sutcliffe wrote: > > Hmm, I don't see a compute_attributes hash in that call, which is > where you'd define the nics for the server. Without any nics, its > correctly saying it can't find a mac (since there won't be one). At > the very least, define a compute profile for your ovirt resource and > specify compute_profile in the hash. > > HTH, > Greg >