Bug 1805844

Summary: [RFE] Enhance api to allow configuration of region, zones, and servers
Product: Red Hat CloudForms Management Engine Reporter: Satoe Imaishi <simaishi>
Component: APIAssignee: Daniel Berger <dberger>
Status: CLOSED ERRATA QA Contact: Parthvi Vala <pvala>
Severity: medium Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: medium    
Version: 5.10.8CC: dberger, dmetzger, mpovolny, obarenbo, pvala
Target Milestone: GAKeywords: ZStream
Target Release: 5.11.4Flags: pm-rhel: cfme-5.11.z+
simaishi: mirror+
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.11.4.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1753806 Environment:
Last Closed: 2020-03-17 13:11:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On: 1753806    
Bug Blocks:    

Comment 2 CFME Bot 2020-02-21 22:11:42 UTC
New commits detected on ManageIQ/manageiq-api/ivanchuk:

https://github.com/ManageIQ/manageiq-api/commit/caded7e8993ee951f510d51ae90716ad7452e703
commit caded7e8993ee951f510d51ae90716ad7452e703
Author:     Libor Pichler <lpichler>
AuthorDate: Wed Oct 23 09:26:08 2019 +0000
Commit:     Libor Pichler <lpichler>
CommitDate: Wed Oct 23 09:26:08 2019 +0000

    Merge pull request #690 from djberg96/regions_post_actions

    Allow miq_regions to be edited, deleted

    (cherry picked from commit 7f3257d5a14b58d8588541a7060fa8d46b95fead)

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

 app/controllers/api/regions_controller.rb | 28 +
 config/api.yml | 14 +-
 spec/requests/regions_spec.rb | 162 +-
 3 files changed, 183 insertions(+), 21 deletions(-)


https://github.com/ManageIQ/manageiq-api/commit/97be56b07e6b6586b0921f4cf63b02464ee1b9bb
commit 97be56b07e6b6586b0921f4cf63b02464ee1b9bb
Author:     Libor Pichler <lpichler>
AuthorDate: Thu Oct 24 09:39:08 2019 +0000
Commit:     Libor Pichler <lpichler>
CommitDate: Thu Oct 24 09:39:08 2019 +0000

    Merge pull request #691 from djberg96/zones_post_actions

    Allow Zones to be edited, deleted

    (cherry picked from commit e9b1b2c93d12d09bddf8dbdead5ada5dc3af8e90)

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

 app/controllers/api/zones_controller.rb | 28 +
 config/api.yml | 11 +-
 spec/requests/zones_spec.rb | 140 +-
 3 files changed, 171 insertions(+), 8 deletions(-)


https://github.com/ManageIQ/manageiq-api/commit/37338994e6881a205c8e5c23cbdeae9147ac3961
commit 37338994e6881a205c8e5c23cbdeae9147ac3961
Author:     Libor Pichler <lpichler>
AuthorDate: Wed Nov  6 12:56:43 2019 +0000
Commit:     Libor Pichler <lpichler>
CommitDate: Wed Nov  6 12:56:43 2019 +0000

    Merge pull request #695 from djberg96/server_post_actions2

    Allow Servers to be edited and deleted

    (cherry picked from commit 57b7037eff3c3acf993613f69b80d9a03415922a)

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

 app/controllers/api/servers_controller.rb | 28 +
 config/api.yml | 14 +-
 spec/requests/servers_spec.rb | 148 +-
 3 files changed, 184 insertions(+), 6 deletions(-)

Comment 3 Parthvi Vala 2020-02-26 09:54:44 UTC
PARTIALLY FIXED. Tested on 5.11.4.0. I tested according to the comments and changes as I saw them in the PRs 690,691 and 695.

Observations:
------------------
Region:
1. Edit the Region works well. I was able to edit the description via REST, although it took 1-2 minutes before the results were reflected on UI.
2. Deleting the Region works too, but once we delete the only region on the appliance, the appliance crashes.

>>>>Steps to Reproduce:
    1. Delete the only region on the appliance. POST https://<ipaddress>/region/:region_id {"action": "delete"}
    2. Wait for 1-2 minutes and login to the appliance.
    3. Navigate to Main Configuration Page.
    Results:
    1. Delete is successful.
    2. You may or may not land in Exception Page.
    3. You will see an exception page.

Zone:
1. Creating a zone works perfectly.
2. Editing the Zone works perfectly. I was able to edit the description and name.
3. Deleting the Zone also works perfectly. I was not able to delete any of the available zones since one was a maintenance zone and another zone was named default and used by a server. I was able to delete the zone, once I unassigned the server from it and assigned it to another zone. 
In conclusion, if a zone is named `default` or is used by a server or is a maintenance zone, it cannot be deleted.

Server:
1. Editing the server works well.
2. Deleting the server also works as expected. I was not able to delete a server in use.


Moving this BZ to ASSIGNED state since there are risks involved with Region deletion.

Comment 5 CFME Bot 2020-02-27 22:47:19 UTC
New commit detected on ManageIQ/manageiq-api/ivanchuk:

https://github.com/ManageIQ/manageiq-api/commit/85bc2f7a60a8a306245d89f6c57aab145cf82890
commit 85bc2f7a60a8a306245d89f6c57aab145cf82890
Author:     Brandon Dunne <bdunne>
AuthorDate: Thu Feb 27 20:42:28 2020 +0000
Commit:     Brandon Dunne <bdunne>
CommitDate: Thu Feb 27 20:42:28 2020 +0000

    Merge pull request #758 from djberg96/regions_post_actions2

    Remove ability to delete a region

    (cherry picked from commit 1343e58a4654c1c27c8de2cb057ed66eac74aeff)

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

 app/controllers/api/regions_controller.rb | 2 +-
 config/api.yml | 9 +-
 spec/requests/regions_spec.rb | 38 +-
 3 files changed, 5 insertions(+), 44 deletions(-)

Comment 6 Daniel Berger 2020-02-28 00:41:21 UTC
Updated. You can now no longer delete a region, and further restrictions were placed on editable attributes:

https://github.com/ManageIQ/manageiq-api/pull/758

Comment 7 Parthvi Vala 2020-03-03 05:57:34 UTC
FIXED. Verified on 5.11.4.1.20200228172510_c08508d.

Comment 10 errata-xmlrpc 2020-03-17 13:11:23 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/RHBA-2020:0867