use of com.cloud.agent.api.guru.TrashNetworkVspCommand in project cloudstack by apache.
the class NuageVspResourceTest method testTrashNetworkVspCommand.
@Test
public void testTrashNetworkVspCommand() throws Exception {
_resource.configure("NuageVspResource", _hostDetails);
VspNetwork vspNetwork = buildVspNetwork();
TrashNetworkVspCommand cmd = new TrashNetworkVspCommand(vspNetwork);
Answer trashNtwkAns = _resource.executeRequest(cmd);
assertTrue(trashNtwkAns.getResult());
}
use of com.cloud.agent.api.guru.TrashNetworkVspCommand in project cloudstack by apache.
the class NuageVspGuestNetworkGuru method trash.
@Override
public boolean trash(Network network, NetworkOffering offering) {
long networkId = network.getId();
network = _networkDao.acquireInLockTable(networkId, 1200);
if (network == null) {
throw new ConcurrentOperationException("Unable to acquire lock on network " + networkId);
}
try {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Handling trash() call back to delete the network " + network.getName() + " with uuid " + network.getUuid() + " from VSP");
}
VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(network);
HostVO nuageVspHost = _nuageVspManager.getNuageVspHost(network.getPhysicalNetworkId());
TrashNetworkVspCommand cmd = new TrashNetworkVspCommand(vspNetwork);
Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd);
if (answer == null || !answer.getResult()) {
s_logger.error("TrashNetworkNuageVspCommand for network " + network.getUuid() + " failed");
if ((null != answer) && (null != answer.getDetails())) {
s_logger.error(answer.getDetails());
}
return false;
}
} finally {
_networkDao.releaseFromLockTable(network.getId());
}
return super.trash(network, offering);
}
Aggregations