Hide Forgot
Description of problem: The host.advanced_settings helper method is not available in automate, but is available from the rails console. Version-Release number of selected component (if applicable): cfme-5.6.1.2-1.el7cf.x86_64 cfme-gemset-5.6.1.2-1.el7cf.x86_64 cfme-appliance-5.6.1.2-1.el7cf.x86_64 rh-ruby22-rubygem-redhat_access_cfme-1.0.3-1.el7cf.noarch How reproducible: 100% of the time Steps to Reproduce: 1. Login to rails console (vmdb; bin/rails c) 2. Create a host object (host = Host.first) 3. Pull the advanced settings from the host object (host.advanced_settings) 4. Returns advanced settings objects for the host 5. Run the same .advanced_settings method from automate ($evm.root['host'].advanced_settings) 6. Fails with no_method_error Actual results: The host object from rails returns advanced_settings for ESXi hosts, but the advanced_settings helper is not available in automate. Expected results: The host object would return advanced_settings via the .advanced_settings helper whether in automate or rails. Additional info: HOST OBJECT FROM RAILS ======================= [root@cfme-01 vmdb]# bin/rails c DEPRECATION WARNING: `config.serve_static_files` is deprecated and will be removed in Rails 5.1. Please use `config.public_file_server.enabled = false` instead. (called from block in <top (required)> at /var/www/miq/vmdb/config/environments/production.rb:15) Loading production environment (Rails 5.0.0) irb(main):001:0> Host.first.advanced_settings PostgreSQLAdapter#log_after_checkout, connection_pool: size: 1, connections: 1, in use: 1, waiting_in_queue: 0 => #<ActiveRecord::Associations::CollectionProxy [#<AdvancedSetting id: 1000000000001, name: "Annotations.WelcomeMessage", display_name: "Welcome message for the Direct Console User Interf...", description: "A welcome message in the initial screen of the Dir...", value: "{}", default_value: "", min: nil, max: nil, read_only: false, resource_type: "Host", resource_id: 1000000000001, created_on: "2015-09-03 16:48:27", updated_on: "2015-09-03 16:48:27">, #<AdvancedSetting id: 1000000000002, name: "BufferCache.FlushInterval", display_name: "Flush interval", description: "Flush at this interval (milliseconds)", value: "30000", default_value: "30000", min: "100", max: "3600000", read_only: false, resource_type: "Host", resource_id: 1000000000001, created_on: "2015-09-03 16:48:27", updated_on: "2015-09-03 16:48:27">, #<AdvancedSetting id: 1000000000003, name: "BufferCache.HardMaxDirty", display_name: "Maximum dirty buffers", description: "Block writers if this many buffers are dirty (perc...", value: "95", default_value: "95", min: "0", max: "100", read_only: false, resource_type: "Host", resource_id: 1000000000001, created_on: "2015-09-03 16:48:27", updated_on: "2015-09-03 16:48:27">, #<AdvancedSetting id: 1000000000004, name: "BufferCache.PerFileHardMaxDirty", display_name: "PerFileHardMaxDirty", description: "Block writers if this many buffers of a given file...", value: "50", default_value: "50", min: "0", max: "100", read_only: false, resource_type: "Host", resource_id: 1000000000001, created_on: "2015-09-03 16:48:27", updated_on: "2015-09-03 16:48:27">, #<AdvancedSetting id: 1000000000005, name: "BufferCache.SoftMaxDirty", display_name: "Soft maximum dirty buffers", description: "Flush immediately if this many buffers are dirty (...", value: "15", default_value: "15", min: "0", max: "100", read_only: false, resource_type: "Host", resource_id: 1000000000001, created_on: "2015-09-03 16:48:27", updated_on: "2015-09-03 16:48:27">, #<AdvancedSetting id: 1000000000006, name: "CBRC.DCacheMemReserved", display_name: "DCacheMemReserved", description: "Memory consumed by CBRC Data Cache (in MB)", value: "400", default_value: "400", min: "100", max: "2048", read_only: false, resource_type: "Host", resource_id: 1000000000001, created_on: "2015-09-03 16:48:27", updated_on: "2015-09-03 16:48:27">, #<AdvancedSetting id: 1000000000007, name: "CBRC.DCacheSize", display_name: "DCacheSize", description: "Size of CBRC Data Cache in MB. This cannot be chan...", value: "2048", default_value: "2048", min: "2048", max: "2048", read_only: false, resource_type: "Host", resource_id: 1000000000001, created_on: "2015-09-03 16:48:27", updated_on: "2015-09-03 16:48:27">, #<AdvancedSetting id: 1000000000008, name: "CBRC.DigestJournalBootInterval", display_name: "DigestJournalBootInterval", description: "Interval (in minutes) for which Digest Journal is ...", value: "10", default_value: "10", min: "0", max: "10000", read_only: false, resource_type: "Host", resource_id: 1000000000001, created_on: "2015-09-03 16:48:27", updated_on: "2015-09-03 16:48:27">, #<AdvancedSetting id: 1000000000009, name: "CBRC.Enable", display_name: "Enable", description: "Enable Content Based Read Cache", value: "false", default_value: "false", min: nil, max: nil, read_only: false, resource_type: "Host", resource_id: 1000000000001, created_on: "2015-09-03 16:48:27", updated_on: "2015-09-03 16:48:27">, #<AdvancedSetting id: 1000000000010, name: "COW.COWMaxHeapSizeMB", display_name: "COWMaxHeapSizeMB", description: "Maximum size (in MB) to which the COW heap is allo...", value: "192", default_value: "192", min: "192", max: "256", read_only: false, resource_type: "Host", resource_id: 1000000000001, created_on: "2015-09-03 16:48:27", updated_on: "2015-09-03 16:48:27">, ...]> HOST OBJECT FROM AUTOMATE ========================= irb(main):002:0> $evm = MiqAeMethodService::MiqAeService.new(MiqAeEngine::MiqAeWorkspaceRuntime.new) => #<MiqAeMethodService::MiqAeService:0x0000000b6354b0 @drb_server_references=[], @inputs={}, @workspace=#<MiqAeEngine::MiqAeWorkspaceRuntime:0x0000000b635758 @readonly=false, @nodes=[], @current=[], @num_drb_methods=0, @datastore_cache={}, @class_methods={}, @dom_search=#<MiqAeEngine::MiqAeDomainSearch:0x0000000b635618 @fqns_id_cache={}, @fqns_id_class_cache={}, @partial_ns=[]>, @persist_state_hash={}, @current_state_info={}, @state_machine_objects=[], @ae_user=nil>, @preamble_lines=0, @body=[], @persist_state_hash={}> irb(main):003:0> $evm.vmdb(:host).first.advanced_settings PostgreSQLAdapter#log_after_checkin, connection_pool: size: 1, connections: 1, in use: 0, waiting_in_queue: 0 NoMethodError: PostgreSQLAdapter#log_after_checkout, connection_pool: size: 1, connections: 1, in use: 1, waiting_in_queue: 0 PostgreSQLAdapter#log_after_checkin, connection_pool: size: 1, connections: 1, in use: 0, waiting_in_queue: 0 undefined method `advanced_settings' for #<MiqAeMethodService::MiqAeServiceManageIQ_Providers_Vmware_InfraManager_HostEsx:0x0000000b5b3230> from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:200:in `method_missing' from (irb):3 from /opt/rh/cfme-gemset/gems/railties-5.0.0/lib/rails/commands/console.rb:65:in `start' from /opt/rh/cfme-gemset/gems/railties-5.0.0/lib/rails/commands/console_helper.rb:9:in `start' from /opt/rh/cfme-gemset/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:78:in `console' from /opt/rh/cfme-gemset/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:in `run_command!' from /opt/rh/cfme-gemset/gems/railties-5.0.0/lib/rails/commands.rb:18:in `<top (required)>' from bin/rails:4:in `require' from bin/rails:4:in `<main>'
Not all object/relationships in the Rails application are exposed to automate. This is by design and we expose object/relationships to automate as needed. The long-term goal is to convert automate to use the REST api to access objects and relationships. Do you have a use-case that requires this specific relationship?
The use case (from Jeff Melhorn) is PCI compliance for 400 ESXi hosts. I've looked in the Compliance Policy section and did not see these ESXi Advanced Settings exposed to 'Control', so we figured automate might be the better way to go. Perhaps this is better suited as an RFE, rather than a bug? I can re-open that way if that is the preferred method.
I took at quick look at the Host Compliance Policies screen and see that Advanced Settings is available there. Can you take a look at this screenshot to see if this is what you were looking for? http://screencast.com/t/J5MXu3jDEWS
I saw those available, however, I am looking for the advanced settings that are provided following a Smart State Analysis of a Host, the ones that are specific to ESX, like these: Annotations.WelcomeMessage {} Welcome message for the Direct Console User Interface (DCUI) A welcome message in the initial screen of the Direct Console User Interface (DCUI). Use an empty string to reset to the default message. BufferCache.FlushInterval 30000 Flush interval Flush at this interval (milliseconds) BufferCache.HardMaxDirty 95 Maximum dirty buffers Block writers if this many buffers are dirty (percent) BufferCache.PerFileHardMaxDirty 50 PerFileHardMaxDirty Block writers if this many buffers of a given file are dirtied (percent) BufferCache.SoftMaxDirty 15 Soft maximum dirty buffers Flush immediately if this many buffers are dirty (percent) CBRC.DCacheMemReserved 400 DCacheMemReserved Memory consumed by CBRC Data Cache (in MB) CBRC.DCacheSize 2048 DCacheSize Size of CBRC Data Cache in MB. This cannot be changed if CBRC.Enable is set to 1. CBRC.DigestJournalBootInterval 10 DigestJournalBootInterval Interval (in minutes) for which Digest Journal is temporarily disabled to avoid interfering with the boot process CBRC.Enable false Enable Enable Content Based Read Cache Config.Defaults.cpuidMask.mode.0.eax disable cpuidMask.mode.0.eax Controls the use of Config.Defaults.cpuidMask.val.0.eax; legal values "mask", "clobber", or "disable". Config.Defaults.cpuidMask.mode.0.ebx disable cpuidMask.mode.0.ebx Controls the use of Config.Defaults.cpuidMask.val.0.ebx; legal values "mask", "clobber", or "disable". These can be viewed from Infrastructure > Hosts > <MY_HOST> > Advanced Settings, after a Smart State Analysis of the host has occurred. They are also available from the rails console as the AdvancedSettings object. Not sure if the ones you provided are a part of the same object or not. Hope that helps. Let me know if you have further questions.
What information is needed? I do not see what info is asked of me. Are my permissions restricted to not be able to view private comments?
Created attachment 1200267 [details] policy condition using host advanced settings
You can use the host advanced settings in the policy condition as the attachment displays.
Lucy, My apologies. I do see that now. You are correct that this functionality is already available via Control Policy. I just missed it. Thank you! -Dustin