-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add API command remove management server #10325
base: main
Are you sure you want to change the base?
Conversation
api/src/main/java/org/apache/cloudstack/api/command/admin/management/RemoveMgmtCmd.java
Outdated
Show resolved
Hide resolved
api/src/main/java/org/apache/cloudstack/api/command/admin/management/RemoveMgmtCmd.java
Outdated
Show resolved
Hide resolved
api/src/main/java/org/apache/cloudstack/api/command/admin/management/RemoveMgmtCmd.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/cloud/server/ManagementServerImpl.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/cloud/server/ManagementServerImpl.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/cloud/server/ManagementServerImpl.java
Outdated
Show resolved
Hide resolved
@nicoschmdt, apparently the |
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
Co-authored-by: Bernardo De Marco Gonçalves <[email protected]>
093efee
to
f5e79d9
Compare
@blueorangutan package |
@bernardodemarco a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12343 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10325 +/- ##
============================================
- Coverage 16.02% 16.02% -0.01%
- Complexity 13146 13148 +2
============================================
Files 5658 5659 +1
Lines 496312 496345 +33
Branches 60109 60112 +3
============================================
- Hits 79537 79531 -6
- Misses 407926 407964 +38
- Partials 8849 8850 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
|
||
@APICommand(name = "removeManagementServer", description = "Removes a Management Server.", responseObject = SuccessResponse.class, | ||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = RoleType.Admin) | ||
public class RemoveMgmtCmd extends BaseCmd { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use the name of the class equal to the name of the API + cmd. This is more or less the default.
public class RemoveMgmtCmd extends BaseCmd { | |
public class RemoveManagementServerCmd extends BaseCmd { |
@@ -1011,6 +1015,8 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe | |||
UserDataManager userDataManager; | |||
@Inject | |||
StoragePoolTagsDao storagePoolTagsDao; | |||
@Inject | |||
protected ManagementServerJoinDao _managementServerJoinDao; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protected ManagementServerJoinDao _managementServerJoinDao; | |
protected ManagementServerJoinDao managementServerJoinDao; |
The underscore at the start is a legacy naming "convention" that is not used by the project anymore. The current convention is to use plain camelCase https://cwiki.apache.org/confluence/display/CLOUDSTACK/Coding+conventions
throw new InvalidParameterValueException(String.format("Unable to find a Management Server with ID equal to [%s]", managementServer.getUuid())); | ||
} | ||
|
||
if (ManagementServerHost.State.Up.equals(managementServer.getState())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (ManagementServerHost.State.Up.equals(managementServer.getState())) { | |
if (!ManagementServerHost.State.Down.equals(managementServer.getState())) { |
If it should only be removed in the Down state ( as said in the logging message below ) this condition doesn't cover all cases, as we have more states than Up and Down.
Description
This PR adds a command to mark a Management Server as removed on the database only if its status is marked as
Down
. To execute the command, it is obligatory to inform theid
of the targeted MS.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
How Has This Been Tested?
In a local lab, I added an MS through the database.
remove managementserver id=<uuid>
and verified that the MS wasn't being listed on the UI and was marked asRemoved
on the database.http://<IP>:8080/client/api?command=removeManagementServer&response=json&id=<UUID>
and verified the MS was marked as removed and wasn't being listed on the UI.