Bug 1718846

Summary: [v2v] Conversion host can be removed while VMware->RHV VMs migration is still running
Product: Red Hat CloudForms Management Engine Reporter: Ilanit Stein <istein>
Component: V2VAssignee: Mike Turley <mturley>
Status: CLOSED ERRATA QA Contact: Nandini Chandra <nachandr>
Severity: low Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: low    
Version: unspecifiedCC: bthurber, fdupont, mberube, simaishi
Target Milestone: GAKeywords: ZStream
Target Release: 5.11.6Flags: pm-rhel: cfme-5.11.z+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.11.6.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-06-10 13:39:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: V2V Target Upstream Version:
Embargoed:

Description Ilanit Stein 2019-06-10 11:57:47 UTC
Description of problem:
It is possible to remove a conversion host, while it is used for v2v migration.
This should be blocked, and there should be a warning in UI, indicating that there is VM migration processed.

Version-Release number of selected component (if applicable):
CFME-5.10.5.1/RHV-4.3.4

Comment 4 Fabien Dupont 2019-06-12 15:05:59 UTC
@Marco, do you think we should prevent that ? It's possible, but maybe only for CFME 5.11 / CloudForms 5.0.

Comment 5 Marco Berube 2019-07-16 20:00:28 UTC
Ideally, it should be blocked as per the description.  But this is a low priority BZ.

Comment 6 Fabien Dupont 2020-04-10 14:13:40 UTC
@Mike, I think that can be implemented by disabling the button if the conversion host has an active task. Here's an example of the API request:

GET /api/request_tasks?expand=resources&filter[]=conversion_host_id=1&filter[]=state!=finished
{
  "name": "request_tasks",
  "count": 1,
  "subcount": 0,
  "subquery_count": 0,
  "pages": 0,
  "resources": [],
  "actions": [
    {
      "name": "cancel",
      "method": "post",
      "href": "https://10.19.2.212/api/request_tasks"
    }
  ],
  "links": {
    "self": "https://10.19.2.212/api/request_tasks?expand=resources&filter[]=conversion_host_id=1&filter[]=state!=finished&offset=0",
    "first": "https://10.19.2.212/api/request_tasks?expand=resources&filter[]=conversion_host_id=1&filter[]=state!=finished&offset=0",
    "last": "https://10.19.2.212/api/request_tasks?expand=resources&filter[]=conversion_host_id=1&filter[]=state!=finished&offset=0"
  }
}

Comment 7 Mike Turley 2020-04-13 16:34:36 UTC
https://github.com/ManageIQ/manageiq-v2v/issues/1126

Fabien, would it be possible to make that request for multiple conversion host IDs in the same request? Maybe with a POST query? Would prefer not to have a request for each conversion host on every poll.

Or, maybe the request should just be for every non-finished migration request_task, and I can match up the conversion host ids in the UI. Not sure what the filter argument would look like for that.

Comment 8 Fabien Dupont 2020-04-23 09:47:14 UTC
Yes, I think the request should be for non-finished request_task and then you can use the 'conversion_host_id' attribute to disable the remove button.
The request would be very similar as the 'conversion_host_id' is provided when expanding the resource:

GET /api/request_tasks?expand=resources&filter[]=state!=finished
{
  "name": "request_tasks",
  "count": 1,
  "subcount": 0,
  "subquery_count": 0,
  "pages": 0,
  "resources": [
    {
      [...]
      "conversion_host_id": 3,
      [...]
    },
    [...]
  ],
  "actions": [
    {
      "name": "cancel",
      "method": "post",
      "href": "https://10.19.2.212/api/request_tasks"
    }
  ],
  "links": {
    "self": "https://10.19.2.212/api/request_tasks?expand=resources&filter[]=conversion_host_id=1&filter[]=state!=finished&offset=0",
    "first": "https://10.19.2.212/api/request_tasks?expand=resources&filter[]=conversion_host_id=1&filter[]=state!=finished&offset=0",
    "last": "https://10.19.2.212/api/request_tasks?expand=resources&filter[]=conversion_host_id=1&filter[]=state!=finished&offset=0"
  }
}

I'm thinking that it covers the UI, but not the API. So a user could still remove a conversion host by mistake through API.

Comment 9 Fabien Dupont 2020-04-23 10:40:21 UTC
https://github.com/ManageIQ/manageiq/pull/20093

Comment 10 CFME Bot 2020-05-01 23:35:27 UTC
New commit detected on ManageIQ/manageiq/jansa:

https://github.com/ManageIQ/manageiq/commit/fa511cecccc4600cae5724d0bf03cf6ccc8ea0ae
commit fa511cecccc4600cae5724d0bf03cf6ccc8ea0ae
Author:     Adam Grare <agrare>
AuthorDate: Thu Apr 23 13:54:38 2020 +0000
Commit:     Adam Grare <agrare>
CommitDate: Thu Apr 23 13:54:38 2020 +0000

    Merge pull request #20093 from fdupont-redhat/v2v_bz_1718846

    [V2V] Prevent removing active conversion host

    (cherry picked from commit bd6fd318a44ea194dcaeebc37be9faa25e4e6856)

    https://bugzilla.redhat.com/show_bug.cgi?id=1718846

 app/models/conversion_host/configurations.rb | 6 +-
 spec/models/conversion_host/configurations_spec.rb | 15 +-
 2 files changed, 16 insertions(+), 5 deletions(-)

Comment 12 CFME Bot 2020-05-13 14:20:20 UTC
New commit detected on ManageIQ/manageiq/ivanchuk:

https://github.com/ManageIQ/manageiq/commit/cc1420b8e452c0ca58a8c7cf2b147aebfb7d1ba7
commit cc1420b8e452c0ca58a8c7cf2b147aebfb7d1ba7
Author:     Adam Grare <agrare>
AuthorDate: Thu Apr 23 13:54:38 2020 +0000
Commit:     Adam Grare <agrare>
CommitDate: Thu Apr 23 13:54:38 2020 +0000

    Merge pull request #20093 from fdupont-redhat/v2v_bz_1718846

    [V2V] Prevent removing active conversion host

    (cherry picked from commit bd6fd318a44ea194dcaeebc37be9faa25e4e6856)

    https://bugzilla.redhat.com/show_bug.cgi?id=1718846

 app/models/conversion_host/configurations.rb | 6 +-
 spec/models/conversion_host/configurations_spec.rb | 15 +-
 2 files changed, 16 insertions(+), 5 deletions(-)

Comment 13 CFME Bot 2020-05-13 14:26:33 UTC
New commit detected on ManageIQ/manageiq-v2v/jansa:

https://github.com/ManageIQ/manageiq-v2v/commit/9f16b18577db8dc1854df94662e8657a16805436
commit 9f16b18577db8dc1854df94662e8657a16805436
Author:     Milan Zázrivec <mzazrivec>
AuthorDate: Tue May 12 13:08:20 2020 +0000
Commit:     Milan Zázrivec <mzazrivec>
CommitDate: Tue May 12 13:08:20 2020 +0000

    Merge pull request #1132 from mturley/bz1718846-prevent-removing-active-conv-host

    [BZ#1718846] Prevent removing a conversion host when it is being used for a migration

    (cherry picked from commit 34604a07179081f978ba325f849fc8e3e91130fa)

    https://bugzilla.redhat.com/show_bug.cgi?id=1718846

 app/javascript/react/screens/App/Settings/SettingsActions.js | 12 +
 app/javascript/react/screens/App/Settings/SettingsConstants.js | 1 +
 app/javascript/react/screens/App/Settings/SettingsReducer.js | 28 +-
 app/javascript/react/screens/App/Settings/__tests__/__snapshots__/SettingsReducer.test.js.snap | 105 +
 app/javascript/react/screens/App/Settings/helpers.js | 4 +
 app/javascript/react/screens/App/Settings/screens/ConversionHostsSettings/ConversionHostsSettings.js | 14 +-
 app/javascript/react/screens/App/Settings/screens/ConversionHostsSettings/__tests__/ConversionHostsSettings.test.js | 1 +
 app/javascript/react/screens/App/Settings/screens/ConversionHostsSettings/__tests__/__snapshots__/index.test.js.snap | 3 +
 app/javascript/react/screens/App/Settings/screens/ConversionHostsSettings/components/ConversionHostWizard/__tests__/__snapshots__/index.test.js.snap | 1 +
 app/javascript/react/screens/App/Settings/screens/ConversionHostsSettings/components/ConversionHostsList.js | 4 +
 app/javascript/react/screens/App/Settings/screens/ConversionHostsSettings/components/ConversionHostsListItem.js | 8 +-
 app/javascript/react/screens/App/Settings/screens/ConversionHostsSettings/components/__tests__/ConversionHostsList.test.js | 18 +-
 app/javascript/react/screens/App/Settings/screens/ConversionHostsSettings/components/__tests__/__snapshots__/ConversionHostsList.test.js.snap | 28 +-
 app/javascript/react/screens/App/Settings/screens/ConversionHostsSettings/index.js | 4 +
 14 files changed, 223 insertions(+), 8 deletions(-)

Comment 14 Nandini Chandra 2020-06-02 14:23:25 UTC
Verified in 5.11.6

Verified that the 'Remove' button is disabled for a conversion host when it's being used by a migration task.

Comment 17 errata-xmlrpc 2020-06-10 13:39:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:2480