Description of problem: After a vm targeted refresh user defined (miq_custom_attributes) are deleted Version-Release number of selected component (if applicable): 5.10.0 How reproducible: 100% Steps to Reproduce: 1. Create a custom attribute on a vm vm.miq_custom_set('mykey', 'myval') 2. Run a targeted refresh of the VM EmsRefresh.refresh(vm) 3. Check if the custom attribute is still there vm.miq_custom_get('mykey') Actual results: nil Expected results: 'myval'
https://github.com/ManageIQ/manageiq-providers-ovirt/pull/265
Verified on CFME-5.9.3.3/RHV-4.2.3, using the steps in the bug description: [root@..vmdb]# rails c Loading production environment (Rails 5.0.6) irb(main):001:0> v = Vm.where(name: "test-snpsh-ismm").last PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0 => #<ManageIQ::Providers::Redhat::InfraManager::Vm id: 133, vendor: "redhat", format: nil, version: nil, name: "test-snpsh-ismm", description: nil, location: "99cf57f8-a9b3-4f29-b9a9-9004b810966e.ovf", config_xml: nil, autostart: nil, host_id: 5, last_sync_on: nil, created_on: "2018-06-28 18:33:56", updated_on: "2018-07-01 11:17:51", storage_id: 12, guid: "a524fdbc-2894-40ae-98d2-163fcf93b50f", ems_id: 68, last_scan_on: nil, last_scan_attempt_on: nil, uid_ems: "99cf57f8-a9b3-4f29-b9a9-9004b810966e", retires_on: nil, retired: nil, boot_time: "2018-06-28 17:47:57", tools_status: nil, standby_action: nil, power_state: "on", state_changed_on: "2018-06-28 18:33:56", previous_state: nil, connection_state: "connected", last_perf_capture_on: nil, registered: nil, busy: nil, smart: nil, memory_reserve: 1024, memory_reserve_expand: nil, memory_limit: 8192, memory_shares: nil, memory_shares_level: nil, cpu_reserve: nil, cpu_reserve_expand: nil, cpu_limit: nil, cpu_shares: nil, cpu_shares_level: nil, cpu_affinity: nil, ems_created_on: nil, template: false, evm_owner_id: nil, ems_ref_obj: "--- \"/api/vms/99cf57f8-a9b3-4f29-b9a9-9004b810966e...", miq_group_id: 1, linked_clone: nil, fault_tolerance: nil, type: "ManageIQ::Providers::Redhat::InfraManager::Vm", ems_ref: "/api/vms/99cf57f8-a9b3-4f29-b9a9-9004b810966e", ems_cluster_id: 68, retirement_warn: nil, retirement_last_warn: nil, vnc_port: nil, flavor_id: nil, availability_zone_id: nil, cloud: false, retirement_state: nil, cloud_network_id: nil, cloud_subnet_id: nil, cloud_tenant_id: nil, raw_power_state: "up", publicly_available: nil, orchestration_stack_id: nil, retirement_requester: nil, tenant_id: 1, resource_group_id: nil, deprecated: nil, storage_profile_id: nil, cpu_hot_add_enabled: nil, cpu_hot_remove_enabled: nil, memory_hot_add_enabled: nil, memory_hot_add_limit: nil, memory_hot_add_increment: nil> irb(main):004:0> v.miq_custom_set('mykey', 'myval') => #<CustomAttribute id: 88, section: nil, name: "mykey", value: "myval", resource_type: "VmOrTemplate", resource_id: 133, source: "EVM", description: nil, value_interpolated: nil, unique_name: nil, serialized_value: "myval"> irb(main):005:0> v.miq_custom_get('mykey') => "myval" irb(main):009:0> EmsRefresh.refresh(v) Scoped order and limit are ignored, it's forced to be batch order and batch size. => {ManageIQ::Providers::Redhat::InfraManager::Refresh::Strategies::Api4=>[#<ManageIQ::Providers::Redhat::InfraManager::Vm id: 133, vendor: "redhat", format: nil, version: nil, name: "test-snpsh-ismm", description: nil, location: "99cf57f8-a9b3-4f29-b9a9-9004b810966e.ovf", config_xml: nil, autostart: nil, host_id: 5, last_sync_on: nil, created_on: "2018-06-28 18:33:56", updated_on: "2018-07-01 11:17:51", storage_id: 12, guid: "a524fdbc-2894-40ae-98d2-163fcf93b50f", ems_id: 68, last_scan_on: nil, last_scan_attempt_on: nil, uid_ems: "99cf57f8-a9b3-4f29-b9a9-9004b810966e", retires_on: nil, retired: nil, boot_time: "2018-06-28 17:47:57", tools_status: nil, standby_action: nil, power_state: "on", state_changed_on: "2018-06-28 18:33:56", previous_state: nil, connection_state: "connected", last_perf_capture_on: nil, registered: nil, busy: nil, smart: nil, memory_reserve: 1024, memory_reserve_expand: nil, memory_limit: 8192, memory_shares: nil, memory_shares_level: nil, cpu_reserve: nil, cpu_reserve_expand: nil, cpu_limit: nil, cpu_shares: nil, cpu_shares_level: nil, cpu_affinity: nil, ems_created_on: nil, template: false, evm_owner_id: nil, ems_ref_obj: "--- \"/api/vms/99cf57f8-a9b3-4f29-b9a9-9004b810966e...", miq_group_id: 1, linked_clone: nil, fault_tolerance: nil, type: "ManageIQ::Providers::Redhat::InfraManager::Vm", ems_ref: "/api/vms/99cf57f8-a9b3-4f29-b9a9-9004b810966e", ems_cluster_id: 68, retirement_warn: nil, retirement_last_warn: nil, vnc_port: nil, flavor_id: nil, availability_zone_id: nil, cloud: false, retirement_state: nil, cloud_network_id: nil, cloud_subnet_id: nil, cloud_tenant_id: nil, raw_power_state: "up", publicly_available: nil, orchestration_stack_id: nil, retirement_requester: nil, tenant_id: 1, resource_group_id: nil, deprecated: nil, storage_profile_id: nil, cpu_hot_add_enabled: nil, cpu_hot_remove_enabled: nil, memory_hot_add_enabled: nil, memory_hot_add_limit: nil, memory_hot_add_increment: nil>]} irb(main):010:0> v.miq_custom_get('mykey') => "myval"
Comment #4 was added here by mistake. It was suppose to be added the 5.9.3 cloned bug 1594833. This bug was verified on CFME-5.10.0.2/RHV-4.2.3: [root@...]# vmdb [root@...vmdb]# rails c [dry-types] Int type was renamed to Integer [dry-types] Form types were renamed to Params Loading production environment (Rails 5.0.7) irb(main):001:0> irb(main):002:0* vm = Vm.where(name: "vm1").last PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0 => #<ManageIQ::Providers::Redhat::InfraManager::Vm id: 50, vendor: "redhat", format: nil, version: nil, name: "vm1", description: nil, location: "c6837e42-73d4-4a85-876c-85787bff8efc.ovf", config_xml: nil, autostart: nil, host_id: 3, last_sync_on: nil, created_on: "2018-06-27 12:55:16", updated_on: "2018-06-27 12:55:16", storage_id: 9, guid: "71fe4cd2-3d7c-4bd3-9201-52d2256185df", ems_id: 5, last_scan_on: nil, last_scan_attempt_on: nil, uid_ems: "c6837e42-73d4-4a85-876c-85787bff8efc", retires_on: nil, retired: nil, boot_time: "2018-06-18 10:22:26", tools_status: nil, standby_action: nil, power_state: "on", state_changed_on: "2018-06-27 12:55:16", previous_state: nil, connection_state: "connected", last_perf_capture_on: nil, registered: nil, busy: nil, smart: nil, memory_reserve: 1024, memory_reserve_expand: nil, memory_limit: 4096, memory_shares: nil, memory_shares_level: nil, cpu_reserve: nil, cpu_reserve_expand: nil, cpu_limit: nil, cpu_shares: nil, cpu_shares_level: nil, cpu_affinity: nil, ems_created_on: nil, template: false, evm_owner_id: nil, ems_ref_obj: "--- \"/api/vms/c6837e42-73d4-4a85-876c-85787bff8efc...", miq_group_id: 1, linked_clone: nil, fault_tolerance: nil, type: "ManageIQ::Providers::Redhat::InfraManager::Vm", ems_ref: "/api/vms/c6837e42-73d4-4a85-876c-85787bff8efc", ems_cluster_id: 7, retirement_warn: nil, retirement_last_warn: nil, vnc_port: nil, flavor_id: nil, availability_zone_id: nil, cloud: false, retirement_state: nil, cloud_network_id: nil, cloud_subnet_id: nil, cloud_tenant_id: nil, raw_power_state: "up", publicly_available: nil, orchestration_stack_id: nil, retirement_requester: nil, tenant_id: 1, resource_group_id: nil, deprecated: nil, storage_profile_id: nil, cpu_hot_add_enabled: nil, cpu_hot_remove_enabled: nil, memory_hot_add_enabled: nil, memory_hot_add_limit: nil, memory_hot_add_increment: nil, hostname: nil> irb(main):003:0> vm.miq_custom_set('mykey', 'myval') => #<CustomAttribute id: 2, section: nil, name: "mykey", value: "myval", resource_type: "VmOrTemplate", resource_id: 50, source: "EVM", description: nil, value_interpolated: nil, unique_name: nil, serialized_value: "myval"> irb(main):005:0> EmsRefresh.refresh(vm) Scoped order and limit are ignored, it's forced to be batch order and batch size. => {ManageIQ::Providers::Redhat::InfraManager::Refresh::Strategies::Api4=>[#<ManageIQ::Providers::Redhat::InfraManager::Vm id: 50, vendor: "redhat", format: nil, version: nil, name: "vm1", description: nil, location: "c6837e42-73d4-4a85-876c-85787bff8efc.ovf", config_xml: nil, autostart: nil, host_id: 3, last_sync_on: nil, created_on: "2018-06-27 12:55:16", updated_on: "2018-06-27 12:55:16", storage_id: 9, guid: "71fe4cd2-3d7c-4bd3-9201-52d2256185df", ems_id: 5, last_scan_on: nil, last_scan_attempt_on: nil, uid_ems: "c6837e42-73d4-4a85-876c-85787bff8efc", retires_on: nil, retired: nil, boot_time: "2018-06-18 10:22:26", tools_status: nil, standby_action: nil, power_state: "on", state_changed_on: "2018-06-27 12:55:16", previous_state: nil, connection_state: "connected", last_perf_capture_on: nil, registered: nil, busy: nil, smart: nil, memory_reserve: 1024, memory_reserve_expand: nil, memory_limit: 4096, memory_shares: nil, memory_shares_level: nil, cpu_reserve: nil, cpu_reserve_expand: nil, cpu_limit: nil, cpu_shares: nil, cpu_shares_level: nil, cpu_affinity: nil, ems_created_on: nil, template: false, evm_owner_id: nil, ems_ref_obj: "--- \"/api/vms/c6837e42-73d4-4a85-876c-85787bff8efc...", miq_group_id: 1, linked_clone: nil, fault_tolerance: nil, type: "ManageIQ::Providers::Redhat::InfraManager::Vm", ems_ref: "/api/vms/c6837e42-73d4-4a85-876c-85787bff8efc", ems_cluster_id: 7, retirement_warn: nil, retirement_last_warn: nil, vnc_port: nil, flavor_id: nil, availability_zone_id: nil, cloud: false, retirement_state: nil, cloud_network_id: nil, cloud_subnet_id: nil, cloud_tenant_id: nil, raw_power_state: "up", publicly_available: nil, orchestration_stack_id: nil, retirement_requester: nil, tenant_id: 1, resource_group_id: nil, deprecated: nil, storage_profile_id: nil, cpu_hot_add_enabled: nil, cpu_hot_remove_enabled: nil, memory_hot_add_enabled: nil, memory_hot_add_limit: nil, memory_hot_add_increment: nil, hostname: nil>]} irb(main):006:0> vm.miq_custom_get('mykey') => "myval"