Skip to content

Commit f82d60b

Browse files
shwstpprLocharla, Sandeep
authored andcommitted
server: fix remove management server (apache#12147)
Fixes apache#12137 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent f014e92 commit f82d60b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -682,15 +682,15 @@
682682
import com.cloud.alert.AlertVO;
683683
import com.cloud.alert.dao.AlertDao;
684684
import com.cloud.api.ApiDBUtils;
685-
import com.cloud.api.query.dao.ManagementServerJoinDao;
686685
import com.cloud.api.query.dao.StoragePoolJoinDao;
687-
import com.cloud.api.query.vo.ManagementServerJoinVO;
688686
import com.cloud.api.query.vo.StoragePoolJoinVO;
689687
import com.cloud.capacity.Capacity;
690688
import com.cloud.capacity.CapacityVO;
691689
import com.cloud.capacity.dao.CapacityDao;
692690
import com.cloud.capacity.dao.CapacityDaoImpl.SummedCapacity;
693691
import com.cloud.cluster.ClusterManager;
692+
import com.cloud.cluster.ManagementServerHostVO;
693+
import com.cloud.cluster.dao.ManagementServerHostDao;
694694
import com.cloud.configuration.Config;
695695
import com.cloud.configuration.ConfigurationManagerImpl;
696696
import com.cloud.consoleproxy.ConsoleProxyManagementState;
@@ -791,7 +791,6 @@
791791
import com.cloud.storage.GuestOSVO;
792792
import com.cloud.storage.GuestOsCategory;
793793
import com.cloud.storage.ScopeType;
794-
import com.cloud.storage.snapshot.SnapshotManager;
795794
import com.cloud.storage.Storage;
796795
import com.cloud.storage.StorageManager;
797796
import com.cloud.storage.StoragePool;
@@ -808,6 +807,7 @@
808807
import com.cloud.storage.dao.VMTemplateDao;
809808
import com.cloud.storage.dao.VolumeDao;
810809
import com.cloud.storage.secondary.SecondaryStorageVmManager;
810+
import com.cloud.storage.snapshot.SnapshotManager;
811811
import com.cloud.tags.ResourceTagVO;
812812
import com.cloud.tags.dao.ResourceTagDao;
813813
import com.cloud.template.TemplateManager;
@@ -1046,7 +1046,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
10461046
@Inject
10471047
private BackupManager backupManager;
10481048
@Inject
1049-
protected ManagementServerJoinDao managementServerJoinDao;
1049+
protected ManagementServerHostDao managementServerHostDao;
10501050
@Inject
10511051
ClusterManager _clusterMgr;
10521052

@@ -5841,7 +5841,7 @@ public void setLockControllerListener(final LockControllerListener lockControlle
58415841
@ActionEvent(eventType = EventTypes.EVENT_MANAGEMENT_SERVER_REMOVE, eventDescription = "removing Management Server")
58425842
public boolean removeManagementServer(RemoveManagementServerCmd cmd) {
58435843
final Long id = cmd.getId();
5844-
ManagementServerJoinVO managementServer = managementServerJoinDao.findById(id);
5844+
ManagementServerHostVO managementServer = managementServerHostDao.findById(id);
58455845

58465846
if (managementServer == null) {
58475847
throw new InvalidParameterValueException(String.format("Unable to find a Management Server with ID equal to [%s].", id));
@@ -5851,8 +5851,8 @@ public boolean removeManagementServer(RemoveManagementServerCmd cmd) {
58515851
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(), managementServer.getState().name()));
58525852
}
58535853

5854-
managementServer.setRemoved(new Date());
5855-
return managementServerJoinDao.update(id, managementServer);
5854+
managementServerHostDao.remove(id);
5855+
return true;
58565856

58575857
}
58585858

0 commit comments

Comments
 (0)