本文整理了Java中com.cloud.resource.ResourceManager.deleteHost
方法的一些代码示例,展示了ResourceManager.deleteHost
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceManager.deleteHost
方法的具体详情如下:
包路径:com.cloud.resource.ResourceManager
类名称:ResourceManager
方法名:deleteHost
暂无
代码示例来源:origin: apache/cloudstack
@Override
public boolean deleteTrafficMonitor(DeleteTrafficMonitorCmd cmd) {
long hostId = cmd.getId();
HostVO trafficMonitor = _hostDao.findById(hostId);
if (trafficMonitor == null) {
throw new InvalidParameterValueException("Could not find an traffic monitor with ID: " + hostId);
}
if (_resourceMgr.deleteHost(hostId, false, false)) {
return true;
} else {
return false;
}
}
代码示例来源:origin: apache/cloudstack
@Override
public boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
PhysicalNetwork pNtwk = _physicalNetworkDao.findById(provider.getPhysicalNetworkId());
Host host = getGloboDnsHost(pNtwk.getDataCenterId());
if (host != null) {
_resourceMgr.deleteHost(host.getId(), true, false);
}
return true;
}
代码示例来源:origin: apache/cloudstack
@Override
public boolean deleteExternalFirewall(Long hostId) {
HostVO externalFirewall = _hostDao.findById(hostId);
if (externalFirewall == null) {
throw new InvalidParameterValueException("Could not find an external firewall with ID: " + hostId);
}
DetailVO fwHostDetails = _hostDetailDao.findDetail(hostId, ApiConstants.FIREWALL_DEVICE_ID);
long fwDeviceId = Long.parseLong(fwHostDetails.getValue());
// check if any networks are using this balancer device
List<NetworkExternalFirewallVO> networks = _networkExternalFirewallDao.listByFirewallDeviceId(fwDeviceId);
if ((networks != null) && !networks.isEmpty()) {
throw new CloudRuntimeException("Delete can not be done as there are networks using the firewall device ");
}
try {
// put the host in maintenance state in order for it to be deleted
externalFirewall.setResourceState(ResourceState.Maintenance);
_hostDao.update(hostId, externalFirewall);
_resourceMgr.deleteHost(hostId, false, false);
// delete the external load balancer entry
_externalFirewallDeviceDao.remove(fwDeviceId);
return true;
} catch (Exception e) {
s_logger.debug("Failed to delete external firewall device due to " + e.getMessage());
return false;
}
}
代码示例来源:origin: apache/cloudstack
@Override
public boolean deleteBigSwitchBcfDevice(DeleteBigSwitchBcfDeviceCmd cmd) {
Long bigswitchBcfDeviceId = cmd.getBigSwitchBcfDeviceId();
BigSwitchBcfDeviceVO bigswitchBcfDevice = _bigswitchBcfDao.findById(bigswitchBcfDeviceId);
if (bigswitchBcfDevice == null) {
throw new InvalidParameterValueException("Could not find a BigSwitch Controller with id " + bigswitchBcfDevice);
}
HostVO bigswitchHost = _hostDao.findById(bigswitchBcfDevice.getHostId());
Long hostId = bigswitchHost.getId();
bigswitchHost.setResourceState(ResourceState.Maintenance);
_hostDao.update(hostId, bigswitchHost);
_resourceMgr.deleteHost(hostId, false, false);
_bigswitchBcfDao.remove(bigswitchBcfDeviceId);
return true;
}
代码示例来源:origin: apache/cloudstack
_resourceMgr.deleteHost(hostId, false, false);
代码示例来源:origin: apache/cloudstack
_resourceMgr.deleteHost(ncc.getId(), false, false);
} catch (Exception e) {
s_logger.debug(e);
代码示例来源:origin: apache/cloudstack
_resourceMgr.deleteHost(hostId, false, false);
代码示例来源:origin: apache/cloudstack
resourceMgr.deleteHost(hostId, false, false);
代码示例来源:origin: apache/cloudstack
@Override
public void deleteController(DeleteOpenDaylightControllerCmd cmd) throws InvalidParameterValueException {
OpenDaylightControllerVO controller = openDaylightControllerMappingDao.findById(cmd.getId());
if (controller == null) {
throw new InvalidParameterValueException("No ODL Controller with id " + cmd.getId());
}
// Find the physical network we work for
Long physicalNetworkId = controller.getPhysicalNetworkId();
PhysicalNetworkVO physicalNetwork = physicalNetworkDao.findById(physicalNetworkId);
if (physicalNetwork != null) {
// Lets see if there are networks that use us
List<NetworkVO> networkList = networkDao.listByPhysicalNetwork(physicalNetworkId);
if (networkList != null) {
// Networks with broadcast type lswitch are ours
for (NetworkVO network : networkList) {
if (network.getBroadcastDomainType() == Networks.BroadcastDomainType.OpenDaylight) {
if ((network.getState() != Network.State.Shutdown) && (network.getState() != Network.State.Destroy)) {
throw new CloudRuntimeException("This Controller can not be deleted as there are one or more logical networks provisioned by cloudstack.");
}
}
}
}
}
HostVO host = hostDao.findById(controller.getHostId());
Long hostId = host.getId();
host.setResourceState(ResourceState.Maintenance);
hostDao.update(hostId, host);
resourceManager.deleteHost(hostId, false, false);
openDaylightControllerMappingDao.remove(cmd.getId());
}
代码示例来源:origin: apache/cloudstack
_resourceMgr.deleteHost(hostId, false, false);
内容来源于网络,如有侵权,请联系作者删除!