Closed whipplekm closed 3 years ago
It seems like it is setting all of them as number 0. Can you elaborate on what is being done on foreman
to achieve this?
In fog-xenserver
it does pass on the data of the attributes of the model to the request as you can see here.
The device definition can be found here and its value is defined in this method.
Can you confirm which values is it defining at the creation time?
I believe that the device definition code needs some patch but we need to figure out whats it going on in your scenario before we find a solution.
EDIT My mistake. I must have bumped a backspace while trying to format for visual aesthetics. The JSON actually appears to be properly formatted and the interface indexes appear to have incremented as expected.
ORIGINAL Thank you for the information. This prompted me to look at the JSON request being submitted. It looks like the interface section is malformed.
interfaces_attributes should be a proper array, but it looks like it's missing the definition
"interfaces_attributes"=>{"0"=>{ "_destroy"=>"0", "type"=>"Nic::Managed", "identifier"=>"eth0", "name"=>"olive-hermance", "domain_id"=>"1", "subnet_id"=>"3", "ip"=>"redacted", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "execution"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{ "network"=>"redacted" } }, "1"=>{ "_destroy"=>"0", "type"=>"Nic::Managed", "identifier"=>"eth1", "name"=>"", "domain_id"=>"", "subnet_id"=>"4", "ip"=>"redacted", "ip6"=>"", "managed"=>"1", "primary"=>"0", "provision"=>"0", "execution"=>"0", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{ "network"=>"redacted" } }
Hmmmm. It is defined as a Hash
. HMMMMMMMMM
Where is this json being defined?
I could not find an _destroy
definition from within here. Maybe it is foreman's fault?
I am severely weak when it comes to Ruby, so I apologize if I'm running you around. With that being said, the linked file is from Foreman's source and appears to define the parameters for the NICs https://github.com/theforeman/foreman/blob/develop/app/controllers/api/v2/interfaces_controller.rb
This file also appears to require https://github.com/theforeman/foreman/blob/develop/app/models/nic/base.rb which I believe defined the _destroy method you inquired about.
This is the host controller which I believe controls the creation of the host; but again, my Ruby knowledge is near nonexistent. https://github.com/theforeman/foreman/blob/develop/app/controllers/hosts_controller.rb
@whipplekm It seems that foreman
is not using fog-xenserver
models at all but rather going straight to the request and defining the parameters itself.
Could you push this issue in foreman as well to see what the folks there have to say about it?
I'm feeling the code that generates the hash of data has a bug.
I have a report in with Foreman. Thank you for your help.
Sure. Let me know if i can help again!
Feel free to reopen in case something else needs to be fixed!
This error occurs when attempting to use Foreman to provision a VM with multiple network interfaces in an XCP-NG compute environment. Provisioning VMs with a single network interface works flawlessly.