Project

General

Profile

Actions

Bug #13573

closed

Overwite with compute resource fails when provisioning via compute resource

Added by Dirk Mayer almost 9 years ago. Updated over 8 years ago.

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

Description

Issuing the following command results in a error station invalid MAC.
The problem is, creating a new VM autogenerates a MAC address. It should not be necessary to add the --MAC option, because u its unknown which mac is getting generated.

hammer --debug host create --environment-id 1 --architecture-id 1 --domain-id 1 --puppet-proxy-id 1 --operatingsystem-id 2 --hostgroup-id 4 --provision-method image --compute-resource-id 1 --interface "primary=true,provision=true,compute_type=bridge,compute_bridge=br0,compute_model=virtio,ip=172.17.31.11" --interface "compute_type=bridge,compute_bridge=br1,compute_model=virtio" --name 'host01.localdomain' --subnet-id 1 --compute-attributes "cpus=4,memory=8589934592,start=1,image_id=/var/lib/libvirt/images/win2k8-tsnode.qcow2" --volume "pool_name=virt-images,capacity=600G,format_type=qcow2,allocation=0G" --build 1 --enabled 1 --managed 1 --puppet-ca-proxy-id 1 --compute-profile '02-TsNode'

Resulting error message:

[ INFO 2016-02-05 11:51:00 Init] Initialization of Hammer CLI (0.5.1) has started...
[DEBUG 2016-02-05 11:51:00 Init] Running at ruby 1.9.3-p484
[ INFO 2016-02-05 11:51:00 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2016-02-05 11:51:00 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2016-02-05 11:51:00 Init] Configuration from the file /root/.hammer/cli.modules.d/foreman.yml has been loaded
[DEBUG 2016-02-05 11:51:00 Connection] Registered: foreman
[DEBUG 2016-02-05 11:51:00 API] Global headers: {
:content_type => "application/json",
:accept => "application/json;version=2",
"Accept-Language" => "en"
}
[ INFO 2016-02-05 11:51:00 Modules] Extension module hammer_cli_foreman (0.5.1) loaded
[DEBUG 2016-02-05 11:51:00 Init] Using locale 'en'
[DEBUG 2016-02-05 11:51:00 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1/locale'
[DEBUG 2016-02-05 11:51:00 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1/locale'
[ INFO 2016-02-05 11:51:00 HammerCLI::MainCommand] Called with options: {"option_debug"=>true}
[ INFO 2016-02-05 11:51:00 HammerCLIForeman::Host] Called with options: {}
[ INFO 2016-02-05 11:51:00 HammerCLIForeman::Host::CreateCommand] Called with options: {"option_managed"=>true, "option_build"=>true, "option_enabled"=>true, "option_overwrite"=>true, "option_compute_attributes"=>{"cpus"=>"4", "memory"=>"8589934592", "start"=>"1", "image_id"=>"/var/lib/libvirt/images/win2k8-tsnode.qcow2"}, "option_volume_list"=>[{"pool_name"=>"virt-images", "capacity"=>"600G", "format_type"=>"qcow2", "allocation"=>"0G"}], "option_interface_list"=>[{"primary"=>"true", "provision"=>"true", "compute_type"=>"bridge", "compute_bridge"=>"br0", "compute_model"=>"virtio", "ip"=>"172.17.31.11"}, {"compute_type"=>"bridge", "compute_bridge"=>"br1", "compute_model"=>"virtio"}], "option_provision_method"=>"image", "option_environment_id"=>1, "option_architecture_id"=>1, "option_domain_id"=>1, "option_operatingsystem_id"=>2, "option_subnet_id"=>1, "option_compute_resource_id"=>1, "option_hostgroup_id"=>4, "option_compute_profile_name"=>"02-TsNode", "option_name"=>"host01.localdomain", "option_puppet_proxy_id"=>1, "option_puppet_ca_proxy_id"=>1}
[ INFO 2016-02-05 11:51:00 API] GET /api/compute_profiles
[DEBUG 2016-02-05 11:51:00 API] Params: {
:search => "name = \"02-TsNode\""
}
[DEBUG 2016-02-05 11:51:00 API] Headers: {
:params => {
:search => "name = \"02-TsNode\""
}
}
[DEBUG 2016-02-05 11:51:00 API] Response: {
"total" => 5,
"subtotal" => 1,
"page" => 1,
"per_page" => 20,
"search" => "name = \"02-TsNode\"",
"sort" => {
"by" => nil,
"order" => nil
},
"results" => [
[0] {
"created_at" => "2016-02-05T09:36:46Z",
"updated_at" => "2016-02-05T09:36:46Z",
"id" => 5,
"name" => "02-TsNode"
}
]
}
[DEBUG 2016-02-05 11:51:00 API] Response headers: {
:date => "Fri, 05 Feb 2016 10:51:00 GMT",
:server => "Apache/2.4.6 (Red Hat Enterprise Linux)",
:foreman_version => "1.10.1",
:foreman_api_version => "2",
:apipie_checksum => "f0f3e47100190cdea747b2a8d62334d1",
:x_ua_compatible => "IE=Edge,chrome=1",
:cache_control => "must-revalidate, private, max-age=0",
:x_request_id => "261b16cd6302060cbea9bc8c599b59f8",
:x_runtime => "0.048916",
:x_rack_cache => "miss",
:x_powered_by => "Phusion Passenger 4.0.18",
:set_cookie => [
[0] "_session_id=a2cdd0ee4b87144b99ba30cc1121469e; path=/; secure; HttpOnly",
[1] "request_method=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT"
],
:etag => "\"022f438a217b5a3f7695f27306cfe717\"",
:status => "200 OK",
:connection => "close",
:transfer_encoding => "chunked",
:content_type => "application/json; charset=utf-8"
}
[ INFO 2016-02-05 11:51:00 API] POST /api/hosts
[DEBUG 2016-02-05 11:51:00 API] Params: {
"host" => {
"name" => "host01.localdomain",
"environment_id" => 1,
"architecture_id" => 1,
"domain_id" => 1,
"puppet_proxy_id" => 1,
"operatingsystem_id" => 2,
"subnet_id" => 1,
"compute_resource_id" => 1,
"hostgroup_id" => 4,
"puppet_ca_proxy_id" => 1,
"build" => true,
"enabled" => true,
"provision_method" => "image",
"managed" => true,
"compute_profile_id" => 5,
"compute_attributes" => {
"cpus" => "4",
"memory" => "8589934592",
"start" => "1",
"image_id" => "/var/lib/libvirt/images/win2k8-tsnode.qcow2",
"volumes_attributes" => {
"0" => {
"pool_name" => "virt-images",
"capacity" => "600G",
"format_type" => "qcow2",
"allocation" => "0G"
}
}
},
"overwrite" => true,
"host_parameters_attributes" => {},
"interfaces_attributes" => {
"0" => {
"primary" => "true",
"provision" => "true",
"ip" => "172.17.31.11",
"compute_attributes" => {
"type" => "bridge",
"bridge" => "br0",
"model" => "virtio"
}
},
"1" => {
"compute_attributes" => {
"type" => "bridge",
"bridge" => "br1",
"model" => "virtio"
}
}
}
}
}
[DEBUG 2016-02-05 11:51:00 API] Headers: {}
[DEBUG 2016-02-05 11:51:01 API] 500 Internal Server Error {
"error" => {
"message" => "Invalid MAC "
}
}
[ERROR 2016-02-05 11:51:01 Exception] Invalid MAC
Could not create the host:
Invalid MAC
[ERROR 2016-02-05 11:51:01 Exception]

RestClient::InternalServerError (500 Internal Server Error):
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!'
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:230:in `process_result'
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `block in transmit'
/opt/rh/ruby193/root/usr/share/ruby/net/http.rb:746:in `start'
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/resource.rb:67:in `post'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.14/lib/apipie_bindings/api.rb:286:in `call_client'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.14/lib/apipie_bindings/api.rb:217:in `http_call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.14/lib/apipie_bindings/api.rb:163:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.14/lib/apipie_bindings/resource.rb:14:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1/lib/hammer_cli/apipie/command.rb:43:in `send_request'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1/lib/hammer_cli_foreman/commands.rb:189:in `send_request'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1/lib/hammer_cli/apipie/command.rb:34:in `execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1/lib/hammer_cli/abstract.rb:22:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1/lib/hammer_cli/abstract.rb:22:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1/lib/hammer_cli/abstract.rb:22:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1/bin/hammer:125:in `<top (required)>'
/usr/bin/hammer:23:in `load'
/usr/bin/hammer:23:in `<main>'

OS:
RHEL 7.2, Foreman 1.10.1


Files

foreman_production.log foreman_production.log 32.9 KB foreman server side log file Dirk Mayer, 02/10/2016 11:08 AM
guest.sh guest.sh 2.55 KB reproducer script Dirk Mayer, 02/23/2016 05:15 AM
guest.log guest.log 9.39 KB output of the reproducer script Dirk Mayer, 02/23/2016 05:15 AM
production.log production.log 28.7 KB log of foreman server side Dirk Mayer, 02/23/2016 05:15 AM

Related issues 2 (0 open2 closed)

Is duplicate of Foreman - Bug #13422: creating a host on a libvirt compute resource throws an invalid MAC errorDuplicate01/27/2016Actions
Is duplicate of Foreman - Bug #5859: VM creation fails after IP conflictClosedIvan Necas05/21/2014Actions
Actions #1

Updated by Tomáš Strachota almost 9 years ago

  • Subject changed from Create a new libvirt VM via hammr failes with message Could not create the host: Invalid MAC to Create a new libvirt VM via hammer failes with message Could not create the host: Invalid MAC
  • Category changed from Hammer core to Foreman commands (obsolete)

Dirk, thank you for reporting this. --mac is not required from hammer. The action failed on server side validation. Could you please provide logs from the server too, please? The problem could as well be in the api.

Actions #2

Updated by Tomáš Strachota almost 9 years ago

  • Status changed from New to Need more information
Actions #3

Updated by Dirk Mayer almost 9 years ago

I uploaded the logfile of the foreman server side.
I don't think that it is an API issue, because if I access the API directly without hammer using a curl command without specifying a mac address explicitly, the host gets created sucessfully.

Actions #4

Updated by A P almost 9 years ago

I am facing identical issue. Is there an easy fix to it that I can try out?

Actions #5

Updated by Otavio Piske almost 9 years ago

I am also facing this problem. I am available to provide additional data or help testing this issue on my environment.

Actions #6

Updated by Tomáš Strachota over 8 years ago

  • Is duplicate of Bug #13422: creating a host on a libvirt compute resource throws an invalid MAC error added
Actions #7

Updated by Tomáš Strachota over 8 years ago

Thank you very much for the logs. It seems to be a duplicate of http://projects.theforeman.org/issues/13422 which Dominic identified as potential duplicate of http://projects.theforeman.org/issues/5859

Unfortunately I haven't been able to reproduce the issue so far. The parameters in the log files seem to be correct. May I ask you for doing the comparison of hammer and curl version of the same call (with same params) and posting the logs once again, please? Just to be sure there's really difference when you do it via hammer.

Updated by Dirk Mayer over 8 years ago

I wrote a small reproducer script. first the hammer command will be executed and after that the same parameter are used with curl to access the api.
production.log ist the debug log of foreman server side.
guest.log is the output of the reproducer script guest.sh

Im not sure about a duplicate of bug 5859, because the hammer command already worked in foreman version 1.9.3.
it broke in foreman version 1.10.1

Actions #9

Updated by Ivan Necas over 8 years ago

  • Project changed from Hammer CLI to Foreman
  • Category deleted (Foreman commands (obsolete))
  • Status changed from Need more information to Assigned
  • Assignee set to Ivan Necas

I was able to reproduce the issue, even from the UI, when trying to resolve a DHCP conflict when using compute resources, it fails with:

Net::Validations::Error in HostsController#create
Invalid MAC

The problem is we try to use the `dhcp_record`, when the mac address is not loaded from the compute resource just yet.

Actions #10

Updated by Ivan Necas over 8 years ago

  • Subject changed from Create a new libvirt VM via hammer failes with message Could not create the host: Invalid MAC to Overwite with compute resource fails when provisioning via compute resource
Actions #11

Updated by Dominic Cleal over 8 years ago

  • Is duplicate of Bug #5859: VM creation fails after IP conflict added
Actions #12

Updated by Dominic Cleal over 8 years ago

  • Status changed from Assigned to Duplicate

Thanks for confirming, then that's the same as #5859. Please use that ticket.

Actions

Also available in: Atom PDF