Bug #7188
closedUnable to create libvirt VM with hammer and compute profiles
Description
I'm unable to create a new host using hammer and compute profiles. From the client:
➜ ~ hammer -d host create --hostgroup="desk_vms" --compute-resource="desk7-a" --compute-profile="desk_vm_hdd" --name="desk7-a-vm0" [ INFO 2014-08-21 10:15:24 Init] Initialization of Hammer CLI (0.1.2) has started... [DEBUG 2014-08-21 10:15:24 Init] Running at ruby 2.0.0-p481 [ INFO 2014-08-21 10:15:24 Init] Configuration from the file /Users/imordey/.hammer/cli_config.yml has been loaded [ WARN 2014-08-21 10:15:24 Modules] Legacy configuration of modules detected. Check section about configuration in user manual [DEBUG 2014-08-21 10:15:24 Connection] Registered: foreman [DEBUG 2014-08-21 10:15:24 API] Global headers: { :content_type => "application/json", :accept => "application/json;version=2", "Accept-Language" => "en_GB" } [ INFO 2014-08-21 10:15:24 Modules] Extension module hammer_cli_foreman (0.1.2) loaded [DEBUG 2014-08-21 10:15:24 Init] Using locale 'en_GB' [DEBUG 2014-08-21 10:15:24 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.1.2/locale' [DEBUG 2014-08-21 10:15:24 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/Library/Ruby/Gems/2.0.0/gems/hammer_cli_foreman-0.1.2/locale' [ INFO 2014-08-21 10:15:24 HammerCLI::MainCommand] Called with options: {"option_debug"=>true} [ INFO 2014-08-21 10:15:24 HammerCLIForeman::Host] Called with options: {} [ INFO 2014-08-21 10:15:24 HammerCLIForeman::Host::CreateCommand] Called with options: {"option_managed"=>true, "option_build"=>true, "option_enabled"=>true, "option_volume_list"=>[], "option_interface_list"=>[], "option_compute_resource_name"=>"desk7-a", "option_hostgroup_name"=>"desk_vms", "option_compute_profile_name"=>"desk_vm_hdd", "option_name"=>"desk7-a-vm0"} [ INFO 2014-08-21 10:15:24 API] GET /api/compute_resources [DEBUG 2014-08-21 10:15:24 API] Params: { :search => "name = \"desk7-a\"" } [DEBUG 2014-08-21 10:15:24 API] Headers: { :params => { :search => "name = \"desk7-a\"" } } [DEBUG 2014-08-21 10:15:24 API] Response { "total" => 16, "subtotal" => 1, "page" => 1, "per_page" => 100, "search" => "name = \"desk7-a\"", "sort" => { "by" => nil, "order" => nil }, "results" => [ [0] { "id" => 9, "name" => "desk7-a", "provider" => "Libvirt", "description" => "", "url" => "qemu+ssh://root@desk7-a.trainlab.example.com/system", "created_at" => "2014-08-13T15:15:13Z", "updated_at" => "2014-08-13T15:15:13Z", "display_type" => "VNC" } ] } [ INFO 2014-08-21 10:15:24 API] GET /api/hostgroups [DEBUG 2014-08-21 10:15:24 API] Params: { :search => "name = \"desk_vms\"" } [DEBUG 2014-08-21 10:15:24 API] Headers: { :params => { :search => "name = \"desk_vms\"" } } [DEBUG 2014-08-21 10:15:25 API] Response { "total" => 3, "subtotal" => 1, "page" => 1, "per_page" => 100, "search" => "name = \"desk_vms\"", "sort" => { "by" => nil, "order" => nil }, "results" => [ [0] { "id" => 3, "name" => "desk_vms", "title" => "desk_vms", "subnet_id" => 1, "subnet_name" => "Training Lab Subnet", "operatingsystem_id" => 1, "operatingsystem_name" => "CentOS 6.5", "domain_id" => 1, "domain_name" => "trainlab.example.com", "environment_id" => 2, "environment_name" => "production", "compute_profile_id" => 4, "compute_profile_name" => "desk_vm", "ancestry" => nil, "puppet_proxy_id" => 1, "puppet_ca_proxy_id" => 1, "ptable_id" => 11, "ptable_name" => "Kickstart VM", "medium_id" => 1, "medium_name" => "CentOS mirror", "architecture_id" => 1, "architecture_name" => "x86_64", "realm_id" => nil, "realm_name" => nil, "created_at" => "2014-08-14T10:10:07Z", "updated_at" => "2014-08-14T10:10:07Z" } ] } [ INFO 2014-08-21 10:15:25 API] GET /api/compute_profiles [DEBUG 2014-08-21 10:15:25 API] Params: { :search => "name = \"desk_vm_hdd\"" } [DEBUG 2014-08-21 10:15:25 API] Headers: { :params => { :search => "name = \"desk_vm_hdd\"" } } [DEBUG 2014-08-21 10:15:25 API] Response { "total" => 5, "subtotal" => 1, "page" => 1, "per_page" => 100, "search" => "name = \"desk_vm_hdd\"", "sort" => { "by" => nil, "order" => nil }, "results" => [ [0] { "id" => 5, "name" => "desk_vm_hdd", "created_at" => "2014-08-20T15:17:40Z", "updated_at" => "2014-08-20T15:17:40Z" } ] } [ INFO 2014-08-21 10:15:25 API] POST /api/hosts [DEBUG 2014-08-21 10:15:25 API] Params: { "host" => { "name" => "desk7-a-vm0", "compute_resource_id" => 9, "hostgroup_id" => 3, "build" => true, "enabled" => true, "managed" => true, "compute_profile_id" => 5, "compute_attributes" => { "volumes_attributes" => {} }, "host_parameters_attributes" => {}, "interfaces_attributes" => {} } } [DEBUG 2014-08-21 10:15:25 API] Headers: {} [DEBUG 2014-08-21 10:15:29 API] Response { "name" => "desk7-a-vm0.trainlab.example.com", "id" => 135, "ip" => "172.16.16.165", "environment_id" => 2, "environment_name" => "production", "last_report" => nil, "mac" => "52:54:00:b6:a8:3f", "realm_id" => nil, "realm_name" => nil, "sp_mac" => nil, "sp_ip" => nil, "sp_name" => nil, "domain_id" => 1, "domain_name" => "trainlab.example.com", "architecture_id" => 1, "architecture_name" => "x86_64", "operatingsystem_id" => 1, "operatingsystem_name" => "CentOS 6.5", "subnet_id" => 1, "subnet_name" => "Training Lab Subnet", "sp_subnet_id" => nil, "ptable_id" => 11, "ptable_name" => "Kickstart VM", "medium_id" => 1, "medium_name" => "CentOS mirror", "build" => true, "comment" => nil, "disk" => nil, "installed_at" => nil, "model_id" => nil, "model_name" => nil, "hostgroup_id" => 3, "hostgroup_name" => "desk_vms", "owner_id" => 1, "owner_type" => "User", "enabled" => true, "puppet_ca_proxy_id" => 1, "managed" => true, "use_image" => nil, "image_file" => "", "uuid" => "772b6df6-c697-9d72-1713-3a6150f2a828", "compute_resource_id" => 9, "compute_resource_name" => "desk7-a (Libvirt)", "compute_profile_id" => 5, "compute_profile_name" => "desk_vm_hdd", "capabilities" => [ [0] "build", [1] "image" ], "provision_method" => "build", "puppet_proxy_id" => 1, "certname" => "desk7-a-vm0.trainlab.example.com", "image_id" => nil, "image_name" => nil, "created_at" => "2014-08-21T09:15:28Z", "updated_at" => "2014-08-21T09:15:28Z", "last_compile" => nil, "last_freshcheck" => nil, "serial" => nil, "source_file_id" => nil, "puppet_status" => 0, "all_puppetclasses" => [ [0] { "id" => 67, "name" => "java_repo::jdk7_repo", "module_name" => "java_repo" }, [1] { "id" => 46, "name" => "packages", "module_name" => "packages" }, [2] { "id" => 109, "name" => "passwordless", "module_name" => "passwordless" } ], "parameters" => [], "interfaces" => [], "puppetclasses" => [], "config_groups" => [] } Host created
➜ ~ hammer -d host start --id=134 No permissions to create log dir /var/log/hammer File /var/log/hammer/hammer.log not writeable, won't log anything to the file! [ INFO 2014-08-21 10:14:13 Init] Initialization of Hammer CLI (0.1.2) has started... [DEBUG 2014-08-21 10:14:13 Init] Running at ruby 2.0.0-p481 [ INFO 2014-08-21 10:14:13 Init] Configuration from the file /Users/imordey/.hammer/cli_config.yml has been loaded [ WARN 2014-08-21 10:14:13 Modules] Legacy configuration of modules detected. Check section about configuration in user manual [DEBUG 2014-08-21 10:14:13 Connection] Registered: foreman [DEBUG 2014-08-21 10:14:13 API] Global headers: { :content_type => "application/json", :accept => "application/json;version=2", "Accept-Language" => "en_GB" } [ INFO 2014-08-21 10:14:14 Modules] Extension module hammer_cli_foreman (0.1.2) loaded [DEBUG 2014-08-21 10:14:14 Init] Using locale 'en_GB' [DEBUG 2014-08-21 10:14:14 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.1.2/locale' [DEBUG 2014-08-21 10:14:14 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/Library/Ruby/Gems/2.0.0/gems/hammer_cli_foreman-0.1.2/locale' [ INFO 2014-08-21 10:14:14 HammerCLI::MainCommand] Called with options: {"option_debug"=>true} [ INFO 2014-08-21 10:14:14 HammerCLIForeman::Host] Called with options: {} [ INFO 2014-08-21 10:14:14 HammerCLIForeman::Host::StartCommand] Called with options: {"option_id"=>"134"} [ INFO 2014-08-21 10:14:14 API] PUT /api/hosts/134/power [DEBUG 2014-08-21 10:14:14 API] Params: { "power_action" => :start } [DEBUG 2014-08-21 10:14:14 API] Headers: {} [ERROR 2014-08-21 10:14:14 API] 500 Internal Server Error { "error" => { "message" => "Call to virDomainCreateWithFlags failed: Cannot get interface MTU on '': No such device" } } [ERROR 2014-08-21 10:14:14 Exception] Call to virDomainCreateWithFlags failed: Cannot get interface MTU on '': No such device Call to virDomainCreateWithFlags failed: Cannot get interface MTU on '': No such device [ERROR 2014-08-21 10:14:14 Exception] RestClient::InternalServerError (500 Internal Server Error): /Library/Ruby/Gems/2.0.0/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!' /Library/Ruby/Gems/2.0.0/gems/rest-client-1.6.7/lib/restclient/request.rb:230:in `process_result' /Library/Ruby/Gems/2.0.0/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `block in transmit' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:852:in `start' /Library/Ruby/Gems/2.0.0/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit' /Library/Ruby/Gems/2.0.0/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute' /Library/Ruby/Gems/2.0.0/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute' /Library/Ruby/Gems/2.0.0/gems/rest-client-1.6.7/lib/restclient/resource.rb:76:in `put' /Library/Ruby/Gems/2.0.0/gems/apipie-bindings-0.0.8/lib/apipie_bindings/api.rb:195:in `http_call' /Library/Ruby/Gems/2.0.0/gems/apipie-bindings-0.0.8/lib/apipie_bindings/api.rb:150:in `call' /Library/Ruby/Gems/2.0.0/gems/apipie-bindings-0.0.8/lib/apipie_bindings/resource.rb:14:in `call' /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.1.2/lib/hammer_cli/apipie/command.rb:42:in `send_request' /Library/Ruby/Gems/2.0.0/gems/hammer_cli_foreman-0.1.2/lib/hammer_cli_foreman/commands.rb:164:in `send_request' /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.1.2/lib/hammer_cli/apipie/command.rb:33:in `execute' /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run' /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.1.2/lib/hammer_cli/abstract.rb:22:in `run' /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.3/lib/clamp/subcommand/execution.rb:11:in `execute' /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run' /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.1.2/lib/hammer_cli/abstract.rb:22:in `run' /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.3/lib/clamp/subcommand/execution.rb:11:in `execute' /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run' /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.1.2/lib/hammer_cli/abstract.rb:22:in `run' /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.3/lib/clamp/command.rb:125:in `run' /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.1.2/bin/hammer:106:in `<top (required)>' /usr/bin/hammer:23:in `load' /usr/bin/hammer:23:in `<main>'
Try again adding in all the attributes as suggested by Dominic in IRC:
➜ ~ hammer host create --hostgroup="desk_vms" --compute-resource="desk7-a" --compute-profile="desk_vm_hdd" --compute-attributes="cpus=1,memory=2000000000,start=1" --interface="type=bridge,bridge=br0,model=virtio" --volume="pool=nuc-hdd,capacity=90G,format_type=qcow2" --name="desk7-a-vm0" Failed to power up a compute desk7-a (Libvirt) instance desk7-a-vm0.trainlab.wandisco.com: Call to virDomainCreateWithFlags failed: Cannot get interface MTU on '': No such device
Updated by Dominic Cleal about 10 years ago
- Description updated (diff)
- Category set to Foreman commands (obsolete)
Updated by Peter Healy over 9 years ago
I have this issue as well on Foreman 1.7.5
I believe it may be due to me creating the bridge manually
Updated by Peter Healy over 9 years ago
I was getting this with the libvirt error:
error: Failed to list interfaces
error: internal error failed to get number of host interfaces: unspecified error - errors in loading some config files
see: https://access.redhat.com/solutions/787883 and https://bugzilla.redhat.com/show_bug.cgi?id=613886
After installing netcf and running ncftool -d list I was able to determine that the problem was in my ifcfg-bond0 (An unrelated interface to the bridge/libvirt set up), the OS seemed to have no issue with the file but the netcf parser that libvirt uses apparently doesn't like that I had a comment on the end of my BONDING_OPTS line.
By taking out the comment at the end of line netcf(and libvirt as a result) stopped throwing the errors and I was able to create the bridge with virt-manager
The hammer cli still doesn't work, still getting "Call to virDomainCreateWithFlags failed: Cannot get interface MTU on '': No such device"
But, at least this narrows the issue down
Updated by Peter Healy over 9 years ago
If I specify the compute resource and hostgroups by ID instead of name it works for whatever reason:
Does not succeed:
hammer host create --hostgroup=default-ct0-dev-foreman --compute-resource=server1 --compute-attributes="start=1" --name="hammer-time" --interface="primary=true,type=bridge,bridge=br0,model=virtio" --volume="pool=data,capacity=10G,format_type=qcow2"
Could not create the host:
Failed to power up a compute server1 (Libvirt) instance hammer-time.local: Call to virDomainCreateWithFlags failed: Cannot get interface MTU on '': No such device
Does succeed:
hammer host create --hostgroup-id=1 --compute-resource-id=1 --compute-attributes="start=1" --name="hammer-time" --interface="primary=true,type=bridge,bridge=br0,model=virtio" --volume="pool=data,capacity=10G,format_type=qcow2"
Host created
Updated by Peter Healy over 9 years ago
Seems related to: http://projects.theforeman.org/issues/6343
Updated by Anonymous about 8 years ago
- Related to Bug #15356: Call to virDomainCreateWithFlags failed: Cannot get interface MTU on '': No such device added
Updated by Anonymous about 8 years ago
- Related to Bug #6343: Parameters not wrapped when resolved from names added
Updated by Tomáš Strachota over 6 years ago
- Category changed from Foreman commands (obsolete) to Compute resources
Updated by Shira Maximov over 4 years ago
- Status changed from New to Closed
I'm able to create a libvirt host from the CLI using hostgroup id:
hammer -d host create --hostgroup="libvirt" --name="desk7-a-vm0" --location tlv --organization redhat
this issue seems to be resolved already, therefore I'm closing it.