Skip to content

Commit 84fe078

Browse files
author
Nicole Schmidt
committed
Apply sugestions from code review
1 parent 12783bf commit 84fe078

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

api/src/main/java/com/cloud/server/ManagementService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import org.apache.cloudstack.api.command.admin.guest.UpdateGuestOsMappingCmd;
3636
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
3737
import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
38-
import org.apache.cloudstack.api.command.admin.management.RemoveMgmtCmd;
38+
import org.apache.cloudstack.api.command.admin.management.RemoveManagementServerCmd;
3939
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
4040
import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd;
4141
import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
@@ -482,6 +482,6 @@ VirtualMachine upgradeSystemVM(ScaleSystemVMCmd cmd) throws ResourceUnavailableE
482482

483483
Pair<Boolean, String> patchSystemVM(PatchSystemVMCmd cmd);
484484

485-
boolean removeManagementServer(RemoveMgmtCmd cmd);
485+
boolean removeManagementServer(RemoveManagementServerCmd cmd);
486486

487487
}

api/src/main/java/org/apache/cloudstack/api/command/admin/management/RemoveMgmtCmd.java renamed to api/src/main/java/org/apache/cloudstack/api/command/admin/management/RemoveManagementServerCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
@APICommand(name = "removeManagementServer", description = "Removes a Management Server.", responseObject = SuccessResponse.class,
3838
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = RoleType.Admin)
39-
public class RemoveMgmtCmd extends BaseCmd {
39+
public class RemoveManagementServerCmd extends BaseCmd {
4040

4141
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ManagementServerResponse.class, required = true, description = "the ID of the Management Server")
4242
private Long id;

server/src/main/java/com/cloud/server/ManagementServerImpl.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
import org.apache.cloudstack.api.command.admin.iso.RegisterIsoCmdByAdmin;
128128
import org.apache.cloudstack.api.command.admin.loadbalancer.ListLoadBalancerRuleInstancesCmdByAdmin;
129129
import org.apache.cloudstack.api.command.admin.management.ListMgmtsCmd;
130-
import org.apache.cloudstack.api.command.admin.management.RemoveMgmtCmd;
130+
import org.apache.cloudstack.api.command.admin.management.RemoveManagementServerCmd;
131131
import org.apache.cloudstack.api.command.admin.network.AddNetworkDeviceCmd;
132132
import org.apache.cloudstack.api.command.admin.network.AddNetworkServiceProviderCmd;
133133
import org.apache.cloudstack.api.command.admin.network.CreateManagementNetworkIpRangeCmd;
@@ -1016,7 +1016,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
10161016
@Inject
10171017
StoragePoolTagsDao storagePoolTagsDao;
10181018
@Inject
1019-
protected ManagementServerJoinDao _managementServerJoinDao;
1019+
protected ManagementServerJoinDao managementServerJoinDao;
10201020

10211021
@Inject
10221022
private PublicIpQuarantineDao publicIpQuarantineDao;
@@ -4001,7 +4001,7 @@ public List<Class<?>> getCommands() {
40014001
cmdList.add(ListTemplateDirectDownloadCertificatesCmd.class);
40024002
cmdList.add(ProvisionTemplateDirectDownloadCertificateCmd.class);
40034003
cmdList.add(ListMgmtsCmd.class);
4004-
cmdList.add(RemoveMgmtCmd.class);
4004+
cmdList.add(RemoveManagementServerCmd.class);
40054005
cmdList.add(GetUploadParamsForIsoCmd.class);
40064006
cmdList.add(GetRouterHealthCheckResultsCmd.class);
40074007
cmdList.add(StartRollingMaintenanceCmd.class);
@@ -5503,20 +5503,20 @@ public void setLockControllerListener(final LockControllerListener lockControlle
55035503
@Override
55045504
@DB
55055505
@ActionEvent(eventType = EventTypes.EVENT_MANAGEMENT_SERVER_REMOVE, eventDescription = "removing Management Server")
5506-
public boolean removeManagementServer(RemoveMgmtCmd cmd) {
5506+
public boolean removeManagementServer(RemoveManagementServerCmd cmd) {
55075507
final Long id = cmd.getId();
5508-
ManagementServerJoinVO managementServer = _managementServerJoinDao.findById(id);
5508+
ManagementServerJoinVO managementServer = managementServerJoinDao.findById(id);
55095509

55105510
if (managementServer == null) {
55115511
throw new InvalidParameterValueException(String.format("Unable to find a Management Server with ID equal to [%s]", managementServer.getUuid()));
55125512
}
55135513

5514-
if (ManagementServerHost.State.Up.equals(managementServer.getState())) {
5514+
if (!ManagementServerHost.State.Down.equals(managementServer.getState())) {
55155515
throw new InvalidParameterValueException(String.format("Unable to remove Management Server with ID [%s]. It can only be removed when it is in the [%s] state, however currently it is in the [%s] state", managementServer.getUuid(), ManagementServerHost.State.Down.name(), ManagementServerHost.State.Up.name()));
55165516
}
55175517

55185518
managementServer.setRemoved(new Date());
5519-
return _managementServerJoinDao.update(id, managementServer);
5519+
return managementServerJoinDao.update(id, managementServer);
55205520

55215521
}
55225522

0 commit comments

Comments
 (0)