Bug 1478108 - RHEVM Target Refresh Completes Even Though Storage Domain Error is Thrown
Summary: RHEVM Target Refresh Completes Even Though Storage Domain Error is Thrown
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers
Version: 5.8.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.9.0
Assignee: Boriso
QA Contact: Ilanit Stein
URL:
Whiteboard: rhev:Target refresh
Depends On:
Blocks: 1484613
TreeView+ depends on / blocked
 
Reported: 2017-08-03 15:11 UTC by myoder
Modified: 2021-03-11 15:31 UTC (History)
9 users (show)

Fixed In Version: 5.9.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1484613 (view as bug list)
Environment:
Last Closed: 2018-03-06 14:58:36 UTC
Category: Bug
Cloudforms Team: RHEVM
Target Upstream Version:
Embargoed:
istein: needinfo+


Attachments (Terms of Use)

Comment 2 Boriso 2017-08-21 12:40:12 UTC
In addition to the reproducible the Vm has to be tagged with "lifecycle: Fully retire VM and remove from Provider" else it does not even try to run the refresh.

Comment 5 Ilanit Stein 2017-08-22 12:51:15 UTC
Ash,

What is the RHV version, used by the customer please?

Comment 13 Ilanit Stein 2017-09-03 06:44:38 UTC
Correction to comment 4:
RHV version was 3.6.10-0.1.el6, and not 4.1.6.

Comment 14 Ilanit Stein 2018-01-08 14:01:19 UTC
Boris,

I wanted to verify it using same verification steps I used for the 5.8.2 bug, mentioned here:
https://bugzilla.redhat.com/show_bug.cgi?id=1484613 , comment 6:

1) In ovirt gem, at lib/ovirt/services.rb in the method resource_verb, inside the block:
resource.send(verb, *args)
add the following lines (in the current gem version 0.17.1 its line 319 of the file):
>>>>>
if resource.url.include?("storagedomains") && resource.url.include?("disks")
  response = OpenStruct.new(code: 404)
end
<<<<<
...
However,
On CFME-5.9.0.14, the services.rb file (/opt/rh/rh-ruby23/root/usr/share/gems/gems/ovirt-engine-sdk-4.2.1/lib/ovirtsdk4/services.rb)  is different.

So I can no longer follow this step 1).

Is there an alternative change I can do in this file (or elsewhere), to achieve the desired Storage Domain Error please?

Thanks.

Comment 15 Ilanit Stein 2018-01-11 12:52:51 UTC
With Boris's help,

Verified on CFME-5.9.0.16/RHV-3.6.12-4,
Using this flow:

1) In ovirt gem, at file:  
/opt/rh/cfme-gemset/gems/ovirt-0.18.1/lib/ovirt/service.rb
in the method resource_verb, inside the block:
resource.send(verb, *args)
add the following lines (in the current gem version 0.18.1 its line 316 in this file):

   def resource_verb(path, verb, *args)
      log_header = "#{self.class.name}#resource_#{verb}"
      resource   = create_resource(path)
      logger.info "#{log_header}: Sending URL: <#{resource.url}>"
      logger.debug "#{log_header}: With args: <#{args.inspect}>"
      resource.send(verb, *args) do |response, request, result, &block|
>>>>>
        if resource.url.include?("storagedomains") && resource.url.include?("disks")
          response = OpenStruct.new(code: 404)
        end
<<<<<
        case response.code

2)     # vmdb
   vmdb# rake evm:restart

3) Added RHV-3.6 that has a VM with 2 disks.

4) In the VM details page, under "Policy"-> "Edit tags": Set the tags for the vm to be: 
"LifeCycle", "Fully retire VM and remove from Provider"

5) In the VMs page select the VM and under Lifecycle choose "retire selected items"

In rhevm.log there are only 2 related ERRORs [1],
and then such error did not repeat.

The VM was removed.

[1]

[----] E, [2018-01-11T07:17:50.184435 #63952:d8b134] ERROR -- : Ovirt::Service#parse_error_response Return from URL: <https://<RHV-FQDN>/ovirt-engine/api/storagedomains/8f5fe6de-fbd7-4b5f-a9dd-a4b3032e1185/disks/776d40ea-d16a-46dc-84a4-2ae4e290b103> Data:#<OpenStruct code=404>
[----] I, [2018-01-11T07:17:50.184931 #63952:d8b134]  INFO -- : Ovirt::Service#resource_get: Sending URL: <https://<RHV-FQDN>/ovirt-engine/api/storagedomains/8f5fe6de-fbd7-4b5f-a9dd-a4b3032e1185/disks/359d962b-2f45-4883-ad71-9bf97ee9380a>

[----] E, [2018-01-11T07:17:50.329430 #63952:d8b134] ERROR -- : Ovirt::Service#parse_error_response Return from URL: <https://<RHV-FQDN>/ovirt-engine/api/storagedomains/8f5fe6de-fbd7-4b5f-a9dd-a4b3032e1185/disks/359d962b-2f45-4883-ad71-9bf97ee9380a> Data:#<OpenStruct code=404>
[----] I, [2018-01-11T07:17:59.585753 #63924:d8b134]  INFO -- : Ovirt::Service#resource_get: Sending URL: <https://<RHV-FQDN>/ovirt-engine/api/users/0000001a-001a-001a-001a-0000000001f7>


Note You need to log in before you can comment on or make changes to this bug.