Project

General

Profile

Actions

Bug #4408

closed

cannot provision VM using API or UI

Added by Greg Petras over 10 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
API
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

After an upgrade to Foreman 1.4, I cannot provision a VM using the API or the UI.

Previously, we would POST something like this to /api/hosts:

{
"subnet_id" : null,
"compute_attributes" : {
"interfaces_attributes" : {
"0" : {
"network" : "<network>",
"_delete" : ""
}
},
"cluster" : "<cluster>",
"volumes_attributes" : {
"1" : {
"thin" : "0",
"datastore" : "<datastore>",
"name" : "Hard disk 1",
"size_gb" : 30
}
},
"power_action" : "start",
"memory_mb" : 2048,
"path" : "<path>",
"cpus" : 1,
"start" : "1"
},
"hostgroup_id" : "81",
"environment_id" : 40,
"provision_method" : "build",
"ptable_id" : 11,
"operatingsystem_id" : null,
"domain_id" : null,
"overwrite" : "false",
"enabled" : "1",
"name" : "<fqdn>",
"build" : "1",
"architecture_id" : null,
"medium_id" : null,
"managed" : "true",
"compute_resource_id" : 2,
"puppet_proxy_id" : null
}

Now I am trying this:

{
"name" : "<fqdn>",
"build" : "1",
"hostgroup_id" : "81",
"managed" : "true",
"compute_profile_id" : 1,
"environment_id" : 40,
"provision_method" : "build",
"ptable_id" : 11,
"compute_resource_id" : 2,
"overwrite" : "false",
"enabled" : "1"
}

The error I get back from Foreman is:

{
"errors" : {
"mac" : [
"has already been taken",
"is invalid",
"can't be blank"
]
},
"full_messages" : [
"MAC address has already been taken",
"MAC address is invalid",
"MAC address can't be blank"
],
"id" : null
}

I don't see any output in the Foreman proxy logs. This is what I see in the Foreman log:

Started POST "/api/hosts" for 10.123.0.31 at 2014-02-20 21:44:17 +0000
Processing by Api::V1::HostsController#create as JSON
Parameters: {"host"=>{"name"=>"<fqdn>", "build"=>"1", "hostgroup_id"=>"81", "managed"=>"true", "compute_profile_id"=>1, "environment_id"=>40, "provision_method"=>"build", "ptable_id"=>11, "compute_resource_id"=>2, "overwrite"=>"false", "enabled"=>"1"}, "apiv"=>"v1"}
Authorized user greg.petras(Greg Petras)
Unprocessable entity Host::Managed (id: new):
MAC address has already been taken
MAC address is invalid
MAC address can't be blank

Rendered api/v1/errors/unprocessable_entity.json.rabl (2.7ms)
Completed 422 Unprocessable Entity in 2402ms (Views: 3.8ms | ActiveRecord: 32.7ms)

I've also seen the same behavior when trying to POST to /api/v2/hosts.


Files

production.log production.log 25.9 KB Greg Petras, 03/05/2014 10:13 PM
Screenshot from 2014-03-06 10_07_31.png View Screenshot from 2014-03-06 10_07_31.png 124 KB VMware networks Dominic Cleal, 03/06/2014 10:07 AM

Related issues 2 (0 open2 closed)

Related to Foreman - Feature #4250: Expose compute profiles via APIClosedJoseph Magen02/04/2014Actions
Related to Foreman - Feature #4581: Implement available_networks API for VMwareClosedGreg Petras03/06/2014Actions
Actions

Also available in: Atom PDF