Project

General

Profile

Actions

Bug #24713

open

Host edit via api attempts to change memory of vmware guest when no such change requested

Added by Andrew Cooper over 5 years ago. Updated over 5 years ago.

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

Description

We are seeing a strange issue on 1.16.2 where we go to change operating system version on a host and the api call fails due to a vmware error. Research indicates foreman attempted to change the memory of the running vmware guest, but memory was not changed on the host parameters in foreman. From what I can tell, its almost like foreman is using the memory setting from the associated Compute Profile with the host group the host is in, vs the memory setting of the actual host.

See attached foreman debug log. Host is set to 2048 for memory, but as you can see, it somehow things memory has changed to 4096 (which is the setting for the default compute profile)

2018-08-23 16:53:29 c6edf325 [app] [I] Started PUT "/api/v2/hosts/xxxxxxx" for 172.16.225.215 at 2018-08-23 16:53:29 -0500
2018-08-23 16:53:29 c6edf325 [app] [I] Processing by Api::V2::HostsController#update as JSON
2018-08-23 16:53:29 c6edf325 [app] [I]   Parameters: {"host"=>{"operatingsystem_id"=>"33", "ptable_id"=>"98", "medium_id"=>"25"}, "apiv"=>"v2", "id"=>"xxxxxxx
2018-08-23 16:53:29 c6edf325 [app] [D] Setting current user thread-local variable to foreman_admin
2018-08-23 16:53:29 c6edf325 [app] [D] Setting current user thread-local variable to nil
2018-08-23 16:53:29 c6edf325 [app] [D] Post-login processing for admin
2018-08-23 16:53:29 c6edf325 [app] [I] Current user: foreman_admin (administrator)
2018-08-23 16:53:29 c6edf325 [app] [D] Setting current user thread-local variable to foreman_admin
2018-08-23 16:53:29 c6edf325 [app] [D] Setting current user thread-local variable to nil
2018-08-23 16:53:29 c6edf325 [app] [I] Current user: admin (administrator)
2018-08-23 16:53:29 c6edf325 [app] [D] Setting current user thread-local variable to admin
2018-08-23 16:53:29 c6edf325 [app] [I] Authorized user admin(Admin User)
2018-08-23 16:53:29 c6edf325 [app] [I] Current user: admin (administrator)
2018-08-23 16:53:29 c6edf325 [app] [D] Setting current user thread-local variable to admin
2018-08-23 16:53:29 c6edf325 [app] [D] Unpermitted parameters: format, apiv, id
2018-08-23 16:53:29 c6edf325 [app] [D] Reading from compute resource cache: networks
2018-08-23 16:53:29 c6edf325 [app] [D] Scheduling compute instance update because memory_mb changed it's value from '2048' (Fixnum) to '4096' (String)
2018-08-23 16:53:29 c6edf325 [app] [D] Detected a change is required for compute resource
2018-08-23 16:53:29 c6edf325 [app] [D] Enqueued task 'Compute resource update for portal-task-1.cloud.prod' to 'Host::Managed Main' queue
2018-08-23 16:53:29 c6edf325 [app] [D] Comparing ["00:50:56:8b:71:66", "172.28.160.4", "172.28.160.0", "pxelinux.0"] == ["00:50:56:8b:71:66", "172.28.160.4", "172.28.160.0", "pxelinux.0"]
2018-08-23 16:53:29 c6edf325 [app] [D] Comparing ["00:50:56:8b:71:66", "172.28.160.4", "172.28.160.0", "pxelinux.0"] == ["00:50:56:8b:71:66", "172.28.160.4", "172.28.160.0", "pxelinux.0"]
2018-08-23 16:53:29 c6edf325 [app] [D] Setting current organization thread-local variable to none
2018-08-23 16:53:29 c6edf325 [app] [D] Setting current location thread-local variable to none
2018-08-23 16:53:29 c6edf325 [app] [D] Setting current location thread-local variable to none
2018-08-23 16:53:29 c6edf325 [app] [D] Setting current organization thread-local variable to none
2018-08-23 16:53:29 c6edf325 [app] [D] Enqueued task 'Deploy TFTP PXEGrub2 config for xxxxxxx' to 'Host::Managed Main' queue
2018-08-23 16:53:29 c6edf325 [app] [D] Enqueued task 'Deploy TFTP PXELinux config for xxxxxx' to 'Host::Managed Main' queue
2018-08-23 16:53:29 c6edf325 [app] [D] Enqueued task 'Deploy TFTP PXEGrub config for xxxxxx' to 'Host::Managed Main' queue
2018-08-23 16:53:29 c6edf325 [app] [D] Observed update hook on xxxxxxx
2018-08-23 16:53:29 c6edf325 [app] [D] Processing task 'Compute resource update for xxxxxx' from 'Host::Managed Main'
2018-08-23 16:53:29 c6edf325 [app] [I] Update Compute instance for xxxxxxx
2018-08-23 16:53:30 c6edf325 [app] [W] Failed to update a compute VMware_vcenter65 (VMware) instance xxxxxxx: MemoryHotPlugNotSupported: Memory hot plug is not supported for this virtual machine.
2018-08-23 16:53:30 c6edf325 [app] [W] Rolling back due to a problem: [#<Orchestration::Task:0x007fc16aae1d38 @name="Compute resource update for xxxxxxx", @status="failed", @priority=7, @action=[#<Host::Managed id: 8354, name: "xxxxxxxxx", last_compile: "2018-08-23 21:33:29", last_report: "2018-08-23 21:33:26", updated_at: "2018-08-23 21:33:53", created_at: "2017-09-20 21:09:57", root_pass: "xxxxxxxxx", architecture_id: 1, operatingsystem_id: 33, environment_id: 1, ptable_id: 98, medium_id: 25, build: false, comment: "", disk: "", installed_at: "2017-09-20 21:19:14", model_id: 1, hostgroup_id: 95, owner_id: 1, owner_type: "User", enabled: true, puppet_ca_proxy_id: 14, managed: true, use_image: nil, image_file: nil, uuid: "500b35de-f410-0775-d54b-277c5ef2cdcf", compute_resource_id: 3, puppet_proxy_id: 14, certname: "xxxxxxxx", image_id: nil, organization_id: nil, location_id: nil, type: "Host::Managed", otp: nil, realm_id: nil, compute_profile_id: 26, provision_method: nil, grub_pass: "$1$ogUCIDbB$PDpdjOIdJKenxD0Qnt1ti0", discovery_rule_id: nil, global_status: 0, lookup_value_matcher: "fqdn=xxxxxxxxx", pxe_loader: "PXELinux BIOS">, :setComputeUpdate], @timestamp=2018-08-23 21:53:30 UTC>]
2018-08-23 16:53:30 c6edf325 [app] [I] Processed 1 tasks from queue 'Host::Managed Main', completed 0/4
2018-08-23 16:53:30 c6edf325 [app] [E] Task 'Compute resource update for xxxxx' *failed*
2018-08-23 16:53:30 c6edf325 [app] [E] Task 'Deploy TFTP PXEGrub2 config for xxxxx' *canceled*
2018-08-23 16:53:30 c6edf325 [app] [E] Task 'Deploy TFTP PXELinux config for xxxxxx' *canceled*
2018-08-23 16:53:30 c6edf325 [app] [E] Task 'Deploy TFTP PXEGrub config for xxxxxx' *canceled*
2018-08-23 16:53:30 c6edf325 [app] [E] Unprocessable entity Host::Managed (id: 8354):
2018-08-23 16:53:30 c6edf325 [app] [I]   Rendered api/v2/errors/unprocessable_entity.json.rabl within api/v2/layouts/error_layout (1.3ms)
2018-08-23 16:53:30 c6edf325 [app] [D] Body: {
2018-08-23 16:53:30 c6edf325 [app] [I] Completed 422 Unprocessable Entity in 1800ms (Views: 3.5ms | ActiveRecord: 33.4ms)

We have attempted to pass compute_attributes to the api PUT and it made no difference. We also attempted applying this patch [1], but it also did not make a difference.
We will gladly upgrade if this is proven to be resolved in 1.17+

[1]https://projects.theforeman.org/projects/foreman/repository/revisions/e653ec5e636ea93d09dfcb08a9de50bff1d9153f/diff/app/controllers/api/v2/hosts_controller.rb

Any help is appreciated

Actions #1

Updated by Marek Hulán over 5 years ago

  • Category set to Compute resources - VMware

did you observe the same with earlier versions of Foreman? there were also couple of other fixes in later version, could you try updating to 1.18 and see whether it helped?

Actions #2

Updated by Andrew Cooper over 5 years ago

We can confirm this worked fine in 1.15. We were waiting for this to be merged before going to 1.18 https://github.com/theforeman/foreman/pull/5993

We will attempt to try a 1.17 testbed against out vmware, etc as a next step.

Actions #3

Updated by Andrew Cooper over 5 years ago

We are unable to reproduce after upgrading to 1.17.4

Actions

Also available in: Atom PDF