Skip to content

Commit 380d621

Browse files
author
Nicole Schmidt
committed
Apply sugestions from code review
1 parent de5b6f5 commit 380d621

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;
@@ -1020,7 +1020,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
10201020
@Inject
10211021
StoragePoolTagsDao storagePoolTagsDao;
10221022
@Inject
1023-
protected ManagementServerJoinDao _managementServerJoinDao;
1023+
protected ManagementServerJoinDao managementServerJoinDao;
10241024

10251025
@Inject
10261026
private PublicIpQuarantineDao publicIpQuarantineDao;
@@ -4047,7 +4047,7 @@ public List<Class<?>> getCommands() {
40474047
cmdList.add(ListTemplateDirectDownloadCertificatesCmd.class);
40484048
cmdList.add(ProvisionTemplateDirectDownloadCertificateCmd.class);
40494049
cmdList.add(ListMgmtsCmd.class);
4050-
cmdList.add(RemoveMgmtCmd.class);
4050+
cmdList.add(RemoveManagementServerCmd.class);
40514051
cmdList.add(GetUploadParamsForIsoCmd.class);
40524052
cmdList.add(GetRouterHealthCheckResultsCmd.class);
40534053
cmdList.add(StartRollingMaintenanceCmd.class);
@@ -5562,20 +5562,20 @@ public void setLockControllerListener(final LockControllerListener lockControlle
55625562
@Override
55635563
@DB
55645564
@ActionEvent(eventType = EventTypes.EVENT_MANAGEMENT_SERVER_REMOVE, eventDescription = "removing Management Server")
5565-
public boolean removeManagementServer(RemoveMgmtCmd cmd) {
5565+
public boolean removeManagementServer(RemoveManagementServerCmd cmd) {
55665566
final Long id = cmd.getId();
5567-
ManagementServerJoinVO managementServer = _managementServerJoinDao.findById(id);
5567+
ManagementServerJoinVO managementServer = managementServerJoinDao.findById(id);
55685568

55695569
if (managementServer == null) {
55705570
throw new InvalidParameterValueException(String.format("Unable to find a Management Server with ID equal to [%s]", managementServer.getUuid()));
55715571
}
55725572

5573-
if (ManagementServerHost.State.Up.equals(managementServer.getState())) {
5573+
if (!ManagementServerHost.State.Down.equals(managementServer.getState())) {
55745574
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()));
55755575
}
55765576

55775577
managementServer.setRemoved(new Date());
5578-
return _managementServerJoinDao.update(id, managementServer);
5578+
return managementServerJoinDao.update(id, managementServer);
55795579

55805580
}
55815581

0 commit comments

Comments
 (0)