Skip to content

Commit 896e321

Browse files
committed
server: fix remove management server
Fixes #12137 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 671d8ad commit 896e321

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

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;
@@ -789,7 +789,6 @@
789789
import com.cloud.storage.GuestOSVO;
790790
import com.cloud.storage.GuestOsCategory;
791791
import com.cloud.storage.ScopeType;
792-
import com.cloud.storage.snapshot.SnapshotManager;
793792
import com.cloud.storage.Storage;
794793
import com.cloud.storage.StorageManager;
795794
import com.cloud.storage.StoragePool;
@@ -806,6 +805,7 @@
806805
import com.cloud.storage.dao.VMTemplateDao;
807806
import com.cloud.storage.dao.VolumeDao;
808807
import com.cloud.storage.secondary.SecondaryStorageVmManager;
808+
import com.cloud.storage.snapshot.SnapshotManager;
809809
import com.cloud.tags.ResourceTagVO;
810810
import com.cloud.tags.dao.ResourceTagDao;
811811
import com.cloud.template.TemplateManager;
@@ -1043,7 +1043,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
10431043
@Inject
10441044
private BackupManager backupManager;
10451045
@Inject
1046-
protected ManagementServerJoinDao managementServerJoinDao;
1046+
protected ManagementServerHostDao managementServerHostDao;
10471047
@Inject
10481048
ClusterManager _clusterMgr;
10491049

@@ -5772,7 +5772,7 @@ public void setLockControllerListener(final LockControllerListener lockControlle
57725772
@ActionEvent(eventType = EventTypes.EVENT_MANAGEMENT_SERVER_REMOVE, eventDescription = "removing Management Server")
57735773
public boolean removeManagementServer(RemoveManagementServerCmd cmd) {
57745774
final Long id = cmd.getId();
5775-
ManagementServerJoinVO managementServer = managementServerJoinDao.findById(id);
5775+
ManagementServerHostVO managementServer = managementServerHostDao.findById(id);
57765776

57775777
if (managementServer == null) {
57785778
throw new InvalidParameterValueException(String.format("Unable to find a Management Server with ID equal to [%s].", id));
@@ -5782,8 +5782,8 @@ public boolean removeManagementServer(RemoveManagementServerCmd cmd) {
57825782
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()));
57835783
}
57845784

5785-
managementServer.setRemoved(new Date());
5786-
return managementServerJoinDao.update(id, managementServer);
5785+
managementServerHostDao.remove(id);
5786+
return true;
57875787

57885788
}
57895789

0 commit comments

Comments
 (0)