Project

General

Profile

Actions

Bug #9970

closed

Creating hosts with NICs on vmWare fails with "Unknown Network ID:"

Added by Tomáš Strachota over 9 years ago. Updated over 9 years ago.

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

Description

hammer -d host create --name dn101 --hostgroup-id 7 --compute-resource-id 2 --provision-method image --image-id 5 --enabled true --managed true --environment-id 1 --domain-id 2 --interface "compute_network=SDC1_111" --subnet-id 2 --compute-attributes "cluster=BD_LAB,memory_mb=16384,cpus=4,start=1" --volume "datastore=BDH04_DISK3,name=HDD,size_gb=100" 

Fails with:

Could not create the host:
  Failed to create a compute VC02_BIGD (VMware) instance dn101.pldc1.example.com: Unknown Network ID:

It seems that parameters being sent in the log are correct.

There is suspicious part of the code that raises the exception. The data structures changed a bit since the primary NIC extraction has been merged and it tries to compare missing data. Compute related data has been moved under a key "compute_attributes" in the interface structure. The fix is most likely just adding the "compute_attributes" key.
https://github.com/theforeman/foreman/blob/develop/app/models/compute_resources/foreman/model/vmware.rb#L305


Files

hammer.log hammer.log 4.42 KB Tomáš Strachota, 03/31/2015 08:17 AM
production.log production.log 16.7 KB Tomáš Strachota, 03/31/2015 08:17 AM

Related issues 2 (0 open2 closed)

Related to Foreman - Bug #9871: Provisioning a new vmware hosts fails with 'Invalid MAC 'Resolved03/23/2015Actions
Related to Hammer CLI - Feature #3849: Add commands for managing interfacesClosedTomáš Strachota12/11/2013Actions
Actions #1

Updated by Tomáš Strachota over 9 years ago

  • Related to Bug #9871: Provisioning a new vmware hosts fails with 'Invalid MAC ' added
Actions #2

Updated by Dominic Cleal over 9 years ago

  • Translation missing: en.field_release set to 28
Actions #3

Updated by Dominic Cleal over 9 years ago

I think this is slightly different. The code for searching for networks is OK because the add_interfaces_to_compute_attrs method in orchestration/compute.rb copies the interfaces_attributes into the compute_attributes into the right place, this all seems to be working correctly.

It appears that if you just pass:

        "interfaces_attributes": {
            "0": {
                "compute_attributes": {
                    "network": "SDC1_111" 
                }
            }
        }

into a host creation, then Host::Base creates a second, primary interface as it doesn't think there is a primary supplied. This second interface doesn't have any compute_attributes and so you get the blank network ID error.

In my test it was generating these two NICs when I passed the interfaces_attributes above:

=> [#<Nic::Managed id: nil, mac: nil, ip: nil, type: "Nic::Managed", name: nil, host_id: nil, subnet_id: nil, domain_id: nil, attrs: {}, created_at: nil, updated_at: nil, provider: nil, username: nil, password: nil, virtual: false, link: true, identifier: nil, tag: "", at
tached_to: "", managed: true, mode: "balance-rr", attached_devices: "", bond_options: "", primary: false, provision: false, compute_attributes: {"network"=>"SDC1_111"}>,
 #<Nic::Managed id: nil, mac: nil, ip: "192.168.122.118", type: "Nic::Managed", name: "dcleal-test2.example.com", host_id: nil, subnet_id: 4, domain_id: 6, attrs: {}, created_at: nil, updated_at: nil, provider: nil, username: nil, password: nil, virtual: false, link: true
, identifier: nil, tag: "", attached_to: "", managed: true, mode: "balance-rr", attached_devices: "", bond_options: "", primary: true, provision: true, compute_attributes: {}>]

When I send this, it generates only one NIC and works better:

{
    "interfaces_attributes": {
        "0": {
            "primary": 1,
            "compute_attributes": {
                "network": "SDC1_111" 
            }
        }
    }
}

Can we specify primary with Hammer, or should we improve the logic for primary NIC creation in Host::Base to merge interface_attributes into the new primary NIC if there's only one supplied?

Actions #4

Updated by Dominic Cleal over 9 years ago

  • Related to Feature #3849: Add commands for managing interfaces added
Actions #5

Updated by Dominic Cleal over 9 years ago

  • Status changed from New to Resolved

Tomas confirmed on IRC that setting the primary interface details should be something that Hammer, via #3849 should be handling.

Actions #6

Updated by Dominic Cleal over 9 years ago

  • Translation missing: en.field_release deleted (28)
Actions

Also available in: Atom PDF