}
}
public void deleteVirtualNetwork(VirtualNetwork vnet, StringBuffer syncLogMesg) throws IOException {
final ApiConnector api = _manager.getApiConnector();
if (_manager.isSystemDefaultNetwork(vnet)) {
syncLogMesg.append("VN# System default virtual Network# VNC: " + vnet.getName() + " can not be deleted\n");
return;
}
api.read(vnet);
deleteInstanceIps(vnet.getInstanceIpBackRefs(), syncLogMesg);
List<ObjectReference<ApiPropertyBase>> fipPools = vnet.getFloatingIpPools();
if (fipPools != null && !fipPools.isEmpty()) {
FloatingIpPool floatingIpPool = (FloatingIpPool) api.findById(FloatingIpPool.class, fipPools.get(0).getUuid());
if (floatingIpPool != null ) {
deleteFloatingIps(floatingIpPool.getFloatingIps(), syncLogMesg);
}
}
deleteVirtualMachineInterfaces(vnet.getVirtualMachineInterfaceBackRefs(), syncLogMesg);
syncLogMesg.append("VN# DB: none; VNC: " + vnet.getName() + "(" + vnet.getUuid() + "); action: delete\n");
api.delete(vnet);
syncLogMesg.append("VN# VNC: " + vnet.getName() + " deleted\n");
}