T.
Hello, Tomas,
Thanks for your reply. I’m not 100% which params you’re concerned
about… Are you worried about the literals on the compute_type, for
example, listed as VirtualVmxnet3? AFAIK those are the VMWare IDs that
are available - is there a numeric replacement that I should use?
I’ve compiled the end-to-end data. I had to filter a few details per
managerial request, but here is the back and forth from end-to-end. I
included a sample from the web UI that worked ok at the end, as well,
for comparison to the one generated by Hammer.
I’m including RPM versions, the cli, hammer, and foreman back-and-forth.
At the end, I’m adding the foreman-side of a successful create using the
web UI. Note the addition of “”
From the hammer admin side:
$ rpm -qa|grep hammer
tfm-rubygem-hammer_cli_foreman_tasks-0.0.9-1.fm1_10.el7.noarch
tfm-rubygem-hammer_cli-0.5.1-1.el7.noarch
tfm-rubygem-hammer_cli_foreman-0.5.1-1.el7.noarch
From the foreman side:
foreman-vmware-1.10.1-1.el7.noarch
foreman-console-1.10.1-1.el7.noarch
foreman-1.10.1-1.el7.noarch
tfm-rubygem-rbvmomi-1.8.2-2.el7.noarch
tfm-rubygem-fog-1.34.0-2.el7.noarch
tfm-rubygem-fog-core-1.32.1-2.el7.noarch
CLI (what I said):
$ hammer -d host create \
–environment-id=1
–architecture-id=1
–compute-resource-id=1
–domain-id=4
–operatingsystem-id=1
–partition-table-id=60
–puppet-proxy-id=2
–hostgroup-title=‘rentpath/ci_server/lax’ \
–interface=“type=‘Nic::Managed’,mac=’’,primary=true,managed=true,provision=true,domain_id=4,subnet_id=1,compute_type=VirtualVmxnet3,compute_network=‘Linux
CI Management Servers’,compute_attributes={}” \
–subnet-id=1
–compute-profile=micro
–compute-attributes="cluster=‘Equinix Los Angeles Linux
Non-Prod’,start=0,cpus=2,memory=2048,path='vm/Linux - ATL -
Non-Production’,guest_id=rhel7_64Guest,hardware_version=11,scsi_controller_type=ParaVirtualSCSIController"
\
–volume=“datastore=<>,name=‘root’,thin=false,eager_zero=1,size_gb=20”
\
–provision-method=build
–name=‘baron-test-003’
Hammer invokation (what hammer thinks I said):
[ INFO 2016-03-07 16:23:34 Modules] Extension module hammer_cli_foreman
(0.5.1) loaded
[ INFO 2016-03-07 16:23:34 HammerCLIForeman::Host::CreateCommand] Called
with options: {“option_managed”=>true, “option_build”=>true,
“option_enabled”=>true, “option_overwrite”=>true,
“option_compute_attributes”=>{“cluster”=>“Equinix Los Angeles Linux
Non-Prod”, “start”=>“0”, “cpus”=>“2”, “memory”=>“2048”,
“path”=>“vm/Linux - ATL - Non-Production”, “guest_id”=>“rhel7_64Guest”,
“hardware_version”=>“11”,
“scsi_controller_type”=>“ParaVirtualSCSIController”},
“option_volume_list”=>[{“datastore”=>"<>", “name”=>“root”,
“thin”=>“false”, “eager_zero”=>“1”, “size_gb”=>“20”}],
“option_interface_list”=>[{“type”=>“Nic::Managed”, “mac”=>"",
“primary”=>“true”, “managed”=>“true”, “provision”=>“true”,
“domain_id”=>“4”, “subnet_id”=>“1”, “compute_type”=>“VirtualVmxnet3”,
“compute_network”=>“Linux CI Management Servers”,
“compute_attributes”=>"{}"}], “option_provision_method”=>“build”,
“option_environment_id”=>1, “option_architecture_id”=>1,
“option_domain_id”=>4, “option_operatingsystem_id”=>1,
“option_ptable_id”=>60, “option_subnet_id”=>1,
“option_compute_resource_id”=>1,
“option_hostgroup_title”=>“rentpath/ci_server/lax”,
“option_compute_profile_name”=>“micro”, “option_name”=>“baron-test-003”,
“option_puppet_proxy_id”=>2}
Foreman post (what hammer told foreman to do):
[ INFO 2016-03-07 16:23:37 API] POST /api/hosts
[DEBUG 2016-03-07 16:23:37 API] Params: {
“host” => {
“name” => “baron-test-003”,
“environment_id” => 1,
“architecture_id” => 1,
“domain_id” => 4,
“puppet_proxy_id” => 2,
“operatingsystem_id” => 1,
“ptable_id” => 60,
“subnet_id” => 1,
“compute_resource_id” => 1,
“hostgroup_id” => 14,
“build” => true,
“enabled” => true,
“provision_method” => “build”,
“managed” => true,
“compute_profile_id” => 5,
“compute_attributes” => {
“cluster” => “Equinix Los Angeles Linux
Non-Prod”,
“start” => “0”,
“cpus” => “2”,
“memory” => “2048”,
“path” => “vm/Linux - ATL - Non-Production”,
“guest_id” => “rhel7_64Guest”,
“hardware_version” => “11”,
“scsi_controller_type” => “ParaVirtualSCSIController”,
“volumes_attributes” => {
“0” => {
“datastore” => “<>”,
“name” => “root”,
“thin” => “false”,
“eager_zero” => “1”,
“size_gb” => “20”
}
}
},
“overwrite” => true,
“host_parameters_attributes” => {},
“interfaces_attributes” => {
“0” => {
“type” => “Nic::Managed”,
“mac” => “”,
“primary” => “true”,
“managed” => “true”,
“provision” => “true”,
“domain_id” => “4”,
“subnet_id” => “1”,
“compute_attributes” => {
“type” => “VirtualVmxnet3”,
“network” => “Linux CI Management Servers”,
“attributes” => “{}”
}
}
}
}
}
What foreman said back:
[DEBUG 2016-03-07 16:23:37 API] Headers: {}
[DEBUG 2016-03-07 16:23:40 API] 500 Internal Server Error
{
“error” => {
“message” => "Invalid MAC "
}
}
[ERROR 2016-03-07 16:23:40 Exception] Invalid MAC
Could not create the host:
Invalid MAC
[ERROR 2016-03-07 16:23:40 Exception]
What foreman says it got:
{“host”=>{“name”=>“baron-test-003”, “environment_id”=>1,
“architecture_id”=>1, “domain_id”=>4, “puppet_proxy_id”=>2,
“operatingsystem_id”=>1, “ptable_id”=>60, “subnet_id”=>1,
“compute_resource_id”=>1, “hostgroup_id”=>14, “build”=>true,
“enabled”=>true, “provision_method”=>“build”, “managed”=>true,
“compute_profile_id”=>5, “compute_attributes”=>{“cluster”=>“Equinix Los
Angeles Linux Non-Prod”, “start”=>“0”, “cpus”=>“2”, “memory”=>“2048”,
“path”=>“vm/Linux - ATL - Non-Production”, “guest_id”=>“rhel7_64Guest”,
“hardware_version”=>“11”,
“scsi_controller_type”=>“ParaVirtualSCSIController”,
“volumes_attributes”=>{“0”=>{“datastore”=>"<>",
“name”=>“root”, “thin”=>“false”, “eager_zero”=>“1”, “size_gb”=>“20”}}},
“overwrite”=>true, “host_parameters_attributes”=>{},
“interfaces_attributes”=>{“0”=>{“type”=>“Nic::Managed”, “mac”=>"",
“primary”=>“true”, “managed”=>“true”, “provision”=>“true”,
“domain_id”=>“4”, “subnet_id”=>“1”,
“compute_attributes”=>{“type”=>“VirtualVmxnet3”, “network”=>“Linux CI
Management Servers”, “attributes”=>"{}"}}}}, “apiv”=>“v2”}
And what it threw up as a result:
2016-03-07 16:23:40 [app] [W] Action failed
Net::Validations::Error: Invalid MAC
/usr/share/foreman/lib/net/validations.rb:40:in validate_mac' /usr/share/foreman/lib/net/dhcp/record.rb:7:in
initialize’
/usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:20:in
new' /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:20:in
dhcp_record’
/usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:158:in
queue_remove_dhcp_conflicts' /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:111:in
queue_dhcp’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:468:in
`_run__1819900551699994501__validation__2955275782424232571__callbacks’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in
`__run_callback’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in
`_run_validation_callbacks’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in
`run_callbacks’
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:in
`run_validations!’
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:194:in
`valid?’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:69:in
`valid?’
/usr/share/foreman/app/models/concerns/orchestration.rb:75:in `valid?’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:300:in
`association_valid?’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:289:in
`block in validate_collection_association’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:289:in
`each’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:289:in
`validate_collection_association’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:217:in
`block in add_autosave_association_callbacks’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:161:in
`instance_eval’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:161:in
`block in define_non_cyclic_method’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:561:in
`_run__4516867619492960946__validate__2955275782424232571__callbacks’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in
`__run_callback’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in
`_run_validate_callbacks’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in
`run_callbacks’
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:227:in
`run_validations!’
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:in
`block in run_validations!’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:480:in
`_run__4516867619492960946__validation__2955275782424232571__callbacks’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_suppo
rt/callbacks.rb:405:in `__run_callback’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in
`_run_validation_callbacks’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in
`run_callbacks’
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:in
`run_validations!’
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:194:in
`valid?’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:69:in
`valid?’
/usr/share/foreman/app/models/concerns/orchestration.rb:75:in `valid?’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:77:in
`perform_validations’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:50:in
`save’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/attribute_methods/dirty.rb:22:in
`save’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:241:in
`block (2 levels) in save’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:295:in
`block in with_transaction_returning_status’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record
/connection_adapters/abstract/database_statements.rb:192:in
`transaction’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:208:in
`transaction’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:293:in
`with_transaction_returning_status’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:241:in
`block in save’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:252:in
`rollback_active_record_state!’
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:240:in
`save’
/usr/share/foreman/app/models/concerns/foreman/sti.rb:29:in
save_with_type' /usr/share/foreman/app/controllers/api/v2/hosts_controller.rb:96:in
create’
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/implicit_render.rb:4:in
`send_action’
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:in
`process_action’
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/rendering.rb:10:in
`process_action’
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:in
`block in process_action’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:584:in
`block (5 levels) in _run__798641655495113931__process_ac
tion__3605288239170632652__callbacks’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in
`block in _conditional_callback_around_8131’
/usr/share/foreman/app/controllers/api/v2/base_controller.rb:151:in
`disable_json_root’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in
`_conditional_callback_around_8131’
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbac