Foreman attempts to reconfigure VM when a parameter is added to the host


When I execute:

hammer host update --name --parameters "foo=bar"

I get this error:

2018-07-20T17:15:53 0a968600 [app] [I] Started PUT "/api/hosts/5654" for at 2018-07-20 17:15:53 +0000
2018-07-20T17:15:53 0a968600 [app] [I] Processing by Api::V2::HostsController#update as JSON
2018-07-20T17:15:53 0a968600 [app] [I]   Parameters: {"host"=>{"name"=>"", "compute_attributes"=>{"volumes_attributes"=>{}}, "host_parameters_attributes"=>[{"name"=>"foo", "value"=>"[FILTERED]"}], "interfaces_attributes"=>{}}, "apiv"=>"v2", "id"=>"5654"}
... [ user authorization removed ]
2018-07-20T17:15:53 0a968600 [app] [I] Update Compute instance for
2018-07-20T17:15:54 0a968600 [app] [W] Failed to update a compute ABC (VMware) instance NotSupported: The operation is not supported on the object.
 | RbVmomi::Fault: NotSupported: The operation is not supported on the object.
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/rbvmomi-1.11.7/lib/rbvmomi/vim/Task.rb:14:in `wait_for_completion'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.0/lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb:10:in `vm_reconfig_hardware'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.0/lib/fog/vsphere/requests/compute/vm_reconfig_memory.rb:9:in `vm_reconfig_memory'
 | /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-vsphere-2.1.0/lib/fog/vsphere/models/compute/server.rb:80:in `vm_reconfig_memory'
 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:462:in `save_vm'
 | /usr/share/foreman/app/models/concerns/orchestration/compute.rb:203:in `setComputeUpdate'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:220:in `execute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:145:in `block in process'

Expected outcome:

The host’s parameter is updated.

Foreman and Proxy versions:


Foreman and Proxy plugin versions:

Other relevant data:

Tested with hammer 0.8.0, and 0.11.0 (latest).

Updating a host parameter via the UI works but seems to send the complete list of parameters via PATCH, not PUT.

I have two other foreman instances running the same version where hammer host update works. The contents of Parameters have exactly the same fields in all three cases. Unfortunately this is the production instance so my ability to experiment is nonexistent.

Based on the stack trace it looks like it is trying to update the VMs memory. Why? I will try to increase the logging level to get more details but I’m putting this out there in case anybody has experienced something similar or has other debugging tips.

I should add that successfully retrieves the VM’s properties from vcenter.

I’m guessing the PUT over the API is including VM parameters which would normally be absent. Can you do the hammer calls again using “-d” to get the exact API call it’s making? Ideally with both the working and not-working calls.

The cause of this behavior is Bug #6342: Compute profile should be used when empty volumes and interfaces passed in compute_attributes - Foreman

The host uses a compute profile memory set to 1024MB but it was overriden to 2048MB for this host.

hammer host update --parameters "foo=bar" results in the profile values being applied. The vmware compute does not support modifying the memory of a vm.

Seems like a bug.

1 Like