CLOUDSTACK-8672 : NCC Integration with CloudStack.

Improvements.
This commit is contained in:
Nitin Kumar Maharana 2017-06-18 19:10:55 +05:30 committed by Sateesh Chodapuneedi
parent 6535949383
commit e243a31e41
20 changed files with 366 additions and 543 deletions

View File

@ -42,7 +42,7 @@ public class AcquirePodIpCmdByAdmin extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.STRING, entityType = ZoneResponse.class, required = true, description = "the ID of the zone")
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.STRING, entityType = ZoneResponse.class, required = true, description = "the ID of the zone")
private String zoneId;
@Parameter(name = ApiConstants.POD_ID, type = CommandType.STRING, entityType = ZoneResponse.class, required = false, description = "Pod ID")
@ -86,7 +86,6 @@ public class AcquirePodIpCmdByAdmin extends BaseCmd {
@Override
public long getEntityOwnerId() {
// TODO Auto-generated method stub
return CallContext.current().getCallingAccount().getAccountId();
}

View File

@ -60,19 +60,21 @@ import com.cloud.vm.VirtualMachineProfile;
*
*/
public interface NetworkOrchestrationService {
static final String NetworkLockTimeoutCK = "network.lock.timeout";
static final String GuestDomainSuffixCK = "guest.domain.suffix";
static final String NetworkThrottlingRateCK = "network.throttling.rate";
static final String MinVRVersionCK = "minreq.sysvmtemplate.version";
String NetworkLockTimeoutCK = "network.lock.timeout";
String GuestDomainSuffixCK = "guest.domain.suffix";
String NetworkThrottlingRateCK = "network.throttling.rate";
String MinVRVersionCK = "minreq.sysvmtemplate.version";
static final ConfigKey<String> MinVRVersion = new ConfigKey<String>(String.class, MinVRVersionCK, "Advanced", "4.10.0",
ConfigKey<String> MinVRVersion = new ConfigKey<String>(String.class, MinVRVersionCK, "Advanced", "4.10.0",
"What version should the Virtual Routers report", true, ConfigKey.Scope.Zone, null);
static final ConfigKey<Integer> NetworkLockTimeout = new ConfigKey<Integer>(Integer.class, NetworkLockTimeoutCK, "Network", "600",
ConfigKey<Integer> NetworkLockTimeout = new ConfigKey<Integer>(Integer.class, NetworkLockTimeoutCK, "Network", "600",
"Lock wait timeout (seconds) while implementing network", true, Scope.Global, null);
static final ConfigKey<String> GuestDomainSuffix = new ConfigKey<String>(String.class, GuestDomainSuffixCK, "Network", "cloud.internal",
ConfigKey<String> GuestDomainSuffix = new ConfigKey<String>(String.class, GuestDomainSuffixCK, "Network", "cloud.internal",
"Default domain name for vms inside virtualized networks fronted by router", true, ConfigKey.Scope.Zone, null);
static final ConfigKey<Integer> NetworkThrottlingRate = new ConfigKey<Integer>("Network", Integer.class, NetworkThrottlingRateCK, "200",
ConfigKey<Integer> NetworkThrottlingRate = new ConfigKey<Integer>("Network", Integer.class, NetworkThrottlingRateCK, "200",
"Default data transfer rate in megabits per second allowed in network.", true, ConfigKey.Scope.Zone);
List<? extends Network> setupNetwork(Account owner, NetworkOffering offering, DeploymentPlan plan, String name, String displayText, boolean isDefault)

View File

@ -57,20 +57,22 @@ import com.cloud.vm.VirtualMachineProfile;
*/
public interface VolumeOrchestrationService {
static final ConfigKey<Long> CustomDiskOfferingMinSize = new ConfigKey<Long>("Advanced",
ConfigKey<Long> CustomDiskOfferingMinSize = new ConfigKey<Long>("Advanced",
Long.class,
"custom.diskoffering.size.min",
"1",
"Minimum size in GB for custom disk offering.",
true
);
static final ConfigKey<Long> CustomDiskOfferingMaxSize = new ConfigKey<Long>("Advanced",
ConfigKey<Long> CustomDiskOfferingMaxSize = new ConfigKey<Long>("Advanced",
Long.class,
"custom.diskoffering.size.max",
"1024",
"Maximum size in GB for custom disk offering.",
true
);
VolumeInfo moveVolume(VolumeInfo volume, long destPoolDcId, Long destPoolPodId, Long destPoolClusterId, HypervisorType dataDiskHyperType)
throws ConcurrentOperationException, StorageUnavailableException;

View File

@ -40,12 +40,12 @@ import com.cloud.vm.NicProfile;
import com.cloud.vm.VirtualMachineProfile;
public interface IpAddressManager {
static final String UseSystemPublicIpsCK = "use.system.public.ips";
static final ConfigKey<Boolean> UseSystemPublicIps = new ConfigKey<Boolean>("Advanced", Boolean.class, UseSystemPublicIpsCK, "true",
String UseSystemPublicIpsCK = "use.system.public.ips";
ConfigKey<Boolean> UseSystemPublicIps = new ConfigKey<Boolean>("Advanced", Boolean.class, UseSystemPublicIpsCK, "true",
"If true, when account has dedicated public ip range(s), once the ips dedicated to the account have been consumed ips will be acquired from the system pool",
true, ConfigKey.Scope.Account);
static final ConfigKey<Boolean> RulesContinueOnError = new ConfigKey<Boolean>("Advanced", Boolean.class, "network.rule.delete.ignoreerror", "true",
ConfigKey<Boolean> RulesContinueOnError = new ConfigKey<Boolean>("Advanced", Boolean.class, "network.rule.delete.ignoreerror", "true",
"When true, ip address delete (ipassoc) failures are ignored", true);
/**
@ -53,14 +53,11 @@ public interface IpAddressManager {
*
* @param dcId
* @param podId
* TODO
* @param owner
* @param type
* @param networkId
* @param requestedIp
* TODO
* @param allocatedBy
* TODO
* @param isSystem
* @return
* @throws InsufficientAddressCapacityException
*/
@ -72,8 +69,7 @@ public interface IpAddressManager {
*
* @param userId
* @param caller
* TODO
* @param IpAddress
* @param caller
* @return true if it did; false if it didn't
*/
boolean disassociatePublicIpAddress(long id, long userId, Account caller);
@ -82,17 +78,18 @@ public interface IpAddressManager {
throws ResourceUnavailableException;
/**
* @throws ResourceAllocationException TODO
* @throws InsufficientCapacityException
* Associates an ip address list to an account. The list of ip addresses are all addresses associated
* with the
* given vlan id.
* @param userId
* @param accountId
* @param zoneId
* @param vlanId
* @throws InsufficientAddressCapacityException
* @throws
* @param guestNetwork
* @throws InsufficientCapacityException
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
* @throws ResourceAllocationException
* Associates an ip address list to an account. The list of ip addresses are all addresses associated
* with the
* given vlan id.
*/
boolean associateIpAddressListToAccount(long userId, long accountId, long zoneId, Long vlanId, Network guestNetwork) throws InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException, ResourceAllocationException;
@ -104,7 +101,7 @@ public interface IpAddressManager {
IPAddressVO markIpAsUnavailable(long addrId);
public String acquireGuestIpAddress(Network network, String requestedIp);
String acquireGuestIpAddress(Network network, String requestedIp);
boolean applyStaticNats(List<? extends StaticNat> staticNats, boolean continueOnError, boolean forRevoke) throws ResourceUnavailableException;
@ -125,9 +122,15 @@ public interface IpAddressManager {
PublicIp assignSourceNatIpAddressToGuestNetwork(Account owner, Network guestNetwork) throws InsufficientAddressCapacityException, ConcurrentOperationException;
/**
*
* @param ipAddrId
* @param networkId
* @param releaseOnFailure TODO
* @param releaseOnFailure
* @return
* @throws ResourceAllocationException
* @throws ResourceUnavailableException
* @throws InsufficientAddressCapacityException
* @throws ConcurrentOperationException
*/
IPAddressVO associateIPToGuestNetwork(long ipAddrId, long networkId, boolean releaseOnFailure) throws ResourceAllocationException, ResourceUnavailableException,
InsufficientAddressCapacityException, ConcurrentOperationException;
@ -169,7 +172,6 @@ public interface IpAddressManager {
IpAddress allocateIp(Account ipOwner, boolean isSystem, Account caller, long callerId, DataCenter zone, Boolean displayIp) throws ConcurrentOperationException,
ResourceAllocationException, InsufficientAddressCapacityException;
PublicIp assignPublicIpAddressFromVlans(long dcId, Long podId, Account owner, VlanType type, List<Long> vlanDbIds, Long networkId, String requestedIp,
boolean isSystem) throws InsufficientAddressCapacityException;
@ -179,15 +181,12 @@ public interface IpAddressManager {
int getRuleCountForIp(Long addressId, FirewallRule.Purpose purpose, FirewallRule.State state);
public String allocateGuestIP(Network network, String requestedIp) throws InsufficientAddressCapacityException;
String allocateGuestIP(Network network, String requestedIp) throws InsufficientAddressCapacityException;
String allocatePublicIpForGuestNic(Network network, Long podId, Account ipOwner, String requestedIp) throws InsufficientAddressCapacityException;
public AcquirePodIpCmdResponse allocatePodIp(String zoneId, String podId) throws ConcurrentOperationException,
ResourceAllocationException;
public void releasePodIp(Long id) throws CloudRuntimeException;
AcquirePodIpCmdResponse allocatePodIp(String zoneId, String podId) throws ConcurrentOperationException, ResourceAllocationException;
void releasePodIp(Long id) throws CloudRuntimeException;
}

View File

@ -23,6 +23,7 @@ import java.util.Map;
import javax.inject.Inject;
import javax.persistence.EntityExistsException;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Component;
import com.cloud.network.Network;
@ -214,7 +215,8 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Lo
sc.addAnd("state", SearchCriteria.Op.EQ, NetworkOffering.State.Enabled);
sc.addAnd("servicePackageUuid", SearchCriteria.Op.EQ, uuid);
List<NetworkOfferingVO> list = this.search(sc, searchFilter);
if(list!=null && !list.isEmpty())
if(CollectionUtils.isNotEmpty(list))
return true;
return false;

View File

@ -84,13 +84,11 @@ public class DeleteNetscalerControlCenterCmd extends BaseCmd {
@Override
public String getCommandName() {
// TODO Auto-generated method stub
return s_name;
}
@Override
public long getEntityOwnerId() {
// TODO Auto-generated method stub
return CallContext.current().getCallingAccount().getId();
}

View File

@ -81,13 +81,11 @@ public class DeleteServicePackageOfferingCmd extends BaseCmd {
@Override
public String getCommandName() {
// TODO Auto-generated method stub
return s_name;
}
@Override
public long getEntityOwnerId() {
// TODO Auto-generated method stub
return CallContext.current().getCallingAccount().getId();
}

View File

@ -58,7 +58,6 @@ public class RegisterServicePackageCmd extends BaseCmd {
try {
NetScalerServicePackageResponse response = _netsclarLbService.registerNetscalerServicePackage(this);
if (response != null) {
//NetScalerServicePackageResponse response = _netsclarLbService.createNetscalerServicePackageResponse(servicePackageVO);
response.setObjectName("netscalerservicepackage");
response.setResponseName(getCommandName());
this.setResponseObject(response);

View File

@ -121,7 +121,6 @@ public class NetScalerControlCenterVO implements InternalIdentity {
@Override
public long getId() {
// TODO Auto-generated method stub
return id;
}

View File

@ -18,8 +18,6 @@ package com.cloud.network.dao;
import java.util.List;
import javax.ejb.Local;
import org.springframework.stereotype.Component;
import com.cloud.network.NetScalerControlCenterVO;
@ -27,19 +25,16 @@ import com.cloud.utils.db.DB;
import com.cloud.utils.db.GenericDaoBase;
@Component
@Local(value = NetScalerControlCenterDao.class)
@DB
public class NetScalerControlCenterDaoImpl extends GenericDaoBase<NetScalerControlCenterVO, Long> implements NetScalerControlCenterDao {
@Override
public NetScalerControlCenterVO findByPodId(long podId) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<NetScalerControlCenterVO> listByNetScalerDeviceId(long netscalerDeviceId) {
// TODO Auto-generated method stub
return null;
}

View File

@ -18,8 +18,6 @@ package com.cloud.network.dao;
import java.util.List;
import javax.ejb.Local;
import org.springframework.stereotype.Component;
import com.cloud.network.NetScalerServicePackageVO;
@ -29,7 +27,6 @@ import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
@Component
@Local(value = NetScalerServicePackageDao.class)
@DB
public class NetScalerServicePackageDaoImpl extends GenericDaoBase<NetScalerServicePackageVO, Long> implements NetScalerServicePackageDao {

View File

@ -381,7 +381,6 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl
networkDetails.put("name", guestConfig.getName());
networkPayload.put("network", networkDetails);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
@ -445,7 +444,6 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl
// multple providers available
return false;
} catch (ConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
@ -1345,19 +1343,16 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl
@Override
public NetScalerServicePackageResponse listNetscalerServicePackage(RegisterServicePackageCmd cmd) {
// TODO Auto-generated method stub
return null;
}
@Override
public NetScalerServicePackageResponse deleteNetscalerServicePackage(RegisterServicePackageCmd cmd) {
// TODO Auto-generated method stub
return null;
}
@Override
public NetScalerServicePackageResponse createNetscalerServicePackageResponse(NetScalerServicePackageVO servicePackageVO) {
// TODO Auto-generated method stub
return null;
}
@ -1515,7 +1510,6 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl
try {
resp = _netScalerVMManager.deployNsVpx(cmd.getAccount(), dest, plan, serviceOfferingId, templateId);
} catch (InsufficientCapacityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return resp;

View File

@ -214,7 +214,7 @@ public class NetScalerControlCenterResource implements ServerResource {
}
}
private synchronized String login() throws ExecutionException{// , ConfigurationException {
private synchronized String login() throws ExecutionException{
String result = null;
JSONObject jsonResponse = null;
try {
@ -317,7 +317,6 @@ public class NetScalerControlCenterResource implements ServerResource {
getHttpRequest(jsonBody.toString(), agentUri, _sessionid);
s_logger.debug("Keeping Session Alive");
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@ -360,7 +359,6 @@ public class NetScalerControlCenterResource implements ServerResource {
String errMsg = "Could not generate URI for NetScaler ControlCenter";
s_logger.error(errMsg, e);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
@ -436,7 +434,7 @@ public class NetScalerControlCenterResource implements ServerResource {
JSONArray lbstatus = res.getJSONArray("lbhealthstatus");
for(int i=0; i<lbstatus.length(); i++) {
JSONObject lbstat = lbstatus.getJSONObject(i);
LoadBalancerTO loadBalancer = null;// new LoadBalancerTO(lbstat.getString("lb_uuid"));
LoadBalancerTO loadBalancer = null;
JSONArray dest = lbstat.getJSONArray("destinations");
List<DestinationTO> listDestTo = new ArrayList<DestinationTO>();
for(int d=0; d<dest.length(); d++ ) {
@ -478,7 +476,6 @@ public class NetScalerControlCenterResource implements ServerResource {
response = getHttpRequest(jsonBody.toString(), agentUri, _sessionid);
s_logger.debug("LBHealthcheck Response :" + response);
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return response;
@ -619,10 +616,8 @@ public class NetScalerControlCenterResource implements ServerResource {
}
s_logger.debug("IPStats Response :" + response);
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
s_logger.debug("Seesion Alive" + e.getMessage());
e.printStackTrace();
}
@ -695,6 +690,10 @@ public class NetScalerControlCenterResource implements ServerResource {
return _name;
}
@Override
public void setName(String name) {
}
@Override
public boolean start() {
return true;
@ -710,34 +709,22 @@ public class NetScalerControlCenterResource implements ServerResource {
return;
}
@Override
public void setName(String name) {
// TODO Auto-generated method stub
}
@Override
public void setConfigParams(Map<String, Object> params) {
// TODO Auto-generated method stub
}
@Override
public Map<String, Object> getConfigParams() {
// TODO Auto-generated method stub
return null;
}
@Override
public int getRunLevel() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void setRunLevel(int level) {
// TODO Auto-generated method stub
}
public String getSessionID() {

View File

@ -14,6 +14,7 @@
//KIND, either express or implied. See the License for the
//specific language governing permissions and limitations
//under the License.
package com.cloud.network.vm;
import java.util.Map;
@ -27,15 +28,15 @@ import com.cloud.network.router.VirtualRouter;
import com.cloud.user.Account;
public interface NetScalerVMManager {
//RAM/CPU for the system offering used by Internal LB VMs
int DEFAULT_NETSCALER_VM_RAMSIZE = 2048; // 2048 MB
int DEFAULT_NETSCALER_VM_CPU_MHZ = 1024; // 1024 MHz
//RAM/CPU for the system offering used by Internal LB VMs
public static final int DEFAULT_NETSCALER_VM_RAMSIZE = 2048; // 2048 MB
public static final int DEFAULT_NETSCALER_VM_CPU_MHZ = 1024; // 1024 MHz
Map<String, Object> deployNetscalerServiceVm(DeployNetscalerVpxCmd cmd);
public Map<String, Object> deployNetscalerServiceVm(DeployNetscalerVpxCmd cmd);
VirtualRouter stopNetscalerServiceVm(Long id, boolean forced, Account callingAccount, long callingUserId) throws ConcurrentOperationException, ResourceUnavailableException;
public VirtualRouter stopNetscalerServiceVm(Long id, boolean forced, Account callingAccount, long callingUserId) throws ConcurrentOperationException, ResourceUnavailableException;
public Map<String, Object> deployNsVpx(Account owner, DeployDestination dest, DeploymentPlan plan, long svcOffId, long templateId) throws InsufficientCapacityException;
Map<String, Object> deployNsVpx(Account owner, DeployDestination dest, DeploymentPlan plan, long svcOffId, long templateId) throws InsufficientCapacityException;
public VirtualRouter stopNetScalerVm(Long id, boolean forced, Account callingAccount, long callingUserId);
VirtualRouter stopNetScalerVm(Long id, boolean forced, Account callingAccount, long callingUserId);
}

View File

@ -98,351 +98,351 @@ import com.cloud.vm.dao.VMInstanceDao;
@Local(value = {NetScalerVMManager.class})
public class NetScalerVMManagerImpl extends ManagerBase implements NetScalerVMManager, VirtualMachineGuru {
private static final Logger s_logger = Logger.getLogger(NetScalerVMManagerImpl.class);
static final private String NetScalerLbVmNamePrefix = "NS";
private static final Logger s_logger = Logger.getLogger(NetScalerVMManagerImpl.class);
static final private String NetScalerLbVmNamePrefix = "NS";
@Inject
IpAddressManager _ipAddrMgr;
@Inject
VirtualMachineManager _itMgr;
@Inject
DomainRouterDao _internalLbVmDao;
@Inject
ConfigurationDao _configDao;
@Inject
AgentManager _agentMgr;
@Inject
DataCenterDao _dcDao;
@Inject
VirtualRouterProviderDao _vrProviderDao;
@Inject
ApplicationLoadBalancerRuleDao _lbDao;
@Inject
NetworkModel _ntwkModel;
@Inject
LoadBalancingRulesManager _lbMgr;
@Inject
NicDao _nicDao;
@Inject
AccountManager _accountMgr;
@Inject
NetworkDao _networkDao;
@Inject
NetworkOrchestrationService _networkMgr;
@Inject
ServiceOfferingDao _serviceOfferingDao;
@Inject
PhysicalNetworkServiceProviderDao _physicalProviderDao;
@Inject
NetworkOfferingDao _networkOfferingDao;
@Inject
VMTemplateDao _templateDao;
@Inject
ResourceManager _resourceMgr;
@Inject
VMInstanceDao _vmDao;
@Inject
NetworkModel _networkModel;
@Inject
PhysicalNetworkDao _physicalNetworkDao;
@Inject
VlanDao _vlanDao;
@Inject
DomainRouterDao _routerDao;
@Inject
IpAddressManager _ipAddrMgr;
@Inject
VirtualMachineManager _itMgr;
@Inject
DomainRouterDao _internalLbVmDao;
@Inject
ConfigurationDao _configDao;
@Inject
AgentManager _agentMgr;
@Inject
DataCenterDao _dcDao;
@Inject
VirtualRouterProviderDao _vrProviderDao;
@Inject
ApplicationLoadBalancerRuleDao _lbDao;
@Inject
NetworkModel _ntwkModel;
@Inject
LoadBalancingRulesManager _lbMgr;
@Inject
NicDao _nicDao;
@Inject
AccountManager _accountMgr;
@Inject
NetworkDao _networkDao;
@Inject
NetworkOrchestrationService _networkMgr;
@Inject
ServiceOfferingDao _serviceOfferingDao;
@Inject
PhysicalNetworkServiceProviderDao _physicalProviderDao;
@Inject
NetworkOfferingDao _networkOfferingDao;
@Inject
VMTemplateDao _templateDao;
@Inject
ResourceManager _resourceMgr;
@Inject
VMInstanceDao _vmDao;
@Inject
NetworkModel _networkModel;
@Inject
PhysicalNetworkDao _physicalNetworkDao;
@Inject
VlanDao _vlanDao;
@Inject
DomainRouterDao _routerDao;
@Override
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) {
@Override
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) {
//NetScalerLB vm starts up with 3 Nics
//Nic #1 - NS IP
//Nic #2 - locallink(guest network)
//Nic #3 - public nic
//NetScalerLB vm starts up with 3 Nics
//Nic #1 - NS IP
//Nic #2 - locallink(guest network)
//Nic #3 - public nic
for (final NicProfile nic : profile.getNics()) {
if(nic.getTrafficType() == TrafficType.Control) {
nic.setTrafficType(TrafficType.Guest);
}
}
return true;
}
for (final NicProfile nic : profile.getNics()) {
if(nic.getTrafficType() == TrafficType.Control) {
nic.setTrafficType(TrafficType.Guest);
}
}
return true;
}
@Override
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
return true;
}
@Override
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context)
throws ResourceUnavailableException {
return true;
}
@Override
public boolean finalizeStart(VirtualMachineProfile profile, long hostId, Commands cmds, ReservationContext context) {
return true;
}
@Override
public boolean finalizeStart(VirtualMachineProfile profile, long hostId, Commands cmds, ReservationContext context) {
return true;
}
@Override
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) {
return true;
}
@Override
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) {
return true;
}
@Override
public void finalizeStop(VirtualMachineProfile profile, Answer answer) {
}
@Override
public void finalizeStop(VirtualMachineProfile profile, Answer answer) {
}
@Override
public void finalizeExpunge(VirtualMachine vm) {
}
@Override
public void finalizeExpunge(VirtualMachine vm) {
}
@Override
public void prepareStop(VirtualMachineProfile profile) {
}
@Override
public void prepareStop(VirtualMachineProfile profile) {
}
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
_itMgr.registerGuru(VirtualMachine.Type.NetScalerVm, this);
if (s_logger.isInfoEnabled()) {
s_logger.info(getName() + " has been configured");
}
return true;
}
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
@Override
public String getName() {
return _name;
}
_itMgr.registerGuru(VirtualMachine.Type.NetScalerVm, this);
if (s_logger.isInfoEnabled()) {
s_logger.info(getName() + " has been configured");
}
return true;
}
protected VirtualRouter stopInternalLbVm(DomainRouterVO internalLbVm, boolean forced, Account caller, long callerUserId) throws ResourceUnavailableException, ConcurrentOperationException {
s_logger.debug("Stopping internal lb vm " + internalLbVm);
try {
_itMgr.advanceStop(internalLbVm.getUuid(), forced);
return _internalLbVmDao.findById(internalLbVm.getId());
} catch (OperationTimedoutException e) {
throw new CloudRuntimeException("Unable to stop " + internalLbVm, e);
}
}
@Override
public String getName() {
return _name;
}
public VirtualRouterProvider addNetScalerLoadBalancerElement(long ntwkSvcProviderId) {
VirtualRouterProviderVO element = _vrProviderDao.findByNspIdAndType(ntwkSvcProviderId, com.cloud.network.VirtualRouterProvider.Type.NetScalerVm);
if (element != null) {
s_logger.debug("There is already an " + getName() + " with service provider id " + ntwkSvcProviderId);
return element;
}
protected VirtualRouter stopInternalLbVm(DomainRouterVO internalLbVm, boolean forced, Account caller, long callerUserId) throws ResourceUnavailableException,
ConcurrentOperationException {
s_logger.debug("Stopping internal lb vm " + internalLbVm);
try {
_itMgr.advanceStop(internalLbVm.getUuid(), forced);
return _internalLbVmDao.findById(internalLbVm.getId());
} catch (OperationTimedoutException e) {
throw new CloudRuntimeException("Unable to stop " + internalLbVm, e);
}
}
PhysicalNetworkServiceProvider provider = _physicalProviderDao.findById(ntwkSvcProviderId);
if (provider == null || !provider.getProviderName().equalsIgnoreCase(getName())) {
throw new InvalidParameterValueException("Invalid network service provider is specified");
}
public VirtualRouterProvider addNetScalerLoadBalancerElement(long ntwkSvcProviderId) {
VirtualRouterProviderVO element = _vrProviderDao.findByNspIdAndType(ntwkSvcProviderId, com.cloud.network.VirtualRouterProvider.Type.NetScalerVm);
if (element != null) {
s_logger.debug("There is already an " + getName() + " with service provider id " + ntwkSvcProviderId);
return element;
}
element = new VirtualRouterProviderVO(ntwkSvcProviderId, com.cloud.network.VirtualRouterProvider.Type.NetScalerVm);
element.setEnabled(true);
element = _vrProviderDao.persist(element);
return element;
}
PhysicalNetworkServiceProvider provider = _physicalProviderDao.findById(ntwkSvcProviderId);
if (provider == null || !provider.getProviderName().equalsIgnoreCase(getName())) {
throw new InvalidParameterValueException("Invalid network service provider is specified");
}
protected long getNetScalerLbProviderId(long physicalNetworkId) {
//final long physicalNetworkId = _ntwkModel.getPhysicalNetworkId(guestNetwork);
element = new VirtualRouterProviderVO(ntwkSvcProviderId, com.cloud.network.VirtualRouterProvider.Type.NetScalerVm);
element.setEnabled(true);
element = _vrProviderDao.persist(element);
return element;
}
final PhysicalNetworkServiceProvider provider = _physicalProviderDao.findByServiceProvider(physicalNetworkId, "Netscaler");
if (provider == null) {
throw new CloudRuntimeException("Cannot find service provider " + Provider.Netscaler.toString() + " in physical network " + physicalNetworkId);
}
protected long getNetScalerLbProviderId(long physicalNetworkId) {
//final long physicalNetworkId = _ntwkModel.getPhysicalNetworkId(guestNetwork);
//TODO: get from type
VirtualRouterProvider netScalerLbProvider = _vrProviderDao.findByNspIdAndType(provider.getId(), com.cloud.network.VirtualRouterProvider.Type.NetScalerVm);
if (netScalerLbProvider == null) {
//create the vrp for netscalerVM.
netScalerLbProvider = addNetScalerLoadBalancerElement(provider.getId());
}
final PhysicalNetworkServiceProvider provider = _physicalProviderDao.findByServiceProvider(physicalNetworkId, "Netscaler");
if (provider == null) {
throw new CloudRuntimeException("Cannot find service provider " + Provider.Netscaler.toString() + " in physical network " + physicalNetworkId);
}
return netScalerLbProvider.getId();
}
//TODO: get from type
VirtualRouterProvider netScalerLbProvider = _vrProviderDao.findByNspIdAndType(provider.getId(), com.cloud.network.VirtualRouterProvider.Type.NetScalerVm);
if (netScalerLbProvider == null) {
//create the vrp for netscalerVM.
netScalerLbProvider = addNetScalerLoadBalancerElement(provider.getId());
}
return netScalerLbProvider.getId();
}
@Override
@Override
public Map<String, Object> deployNsVpx(Account owner, DeployDestination dest, DeploymentPlan plan, long svcOffId, long templateId) throws InsufficientCapacityException {
VMTemplateVO template = _templateDao.findById(templateId) ;
long id = _vmDao.getNextInSequence(Long.class, "id");
Account systemAcct = _accountMgr.getSystemAccount();
VMTemplateVO template = _templateDao.findById(templateId) ;
long id = _vmDao.getNextInSequence(Long.class, "id");
Account systemAcct = _accountMgr.getSystemAccount();
if (template == null) {
s_logger.error(" Unable to find the NS VPX template");
throw new CloudRuntimeException("Unable to find the Template" + templateId);
}
long dataCenterId = dest.getDataCenter().getId();
DataCenterVO dc = _dcDao.findById(dest.getDataCenter().getId());
if (template == null) {
s_logger.error(" Unable to find the NS VPX template");
throw new CloudRuntimeException("Unable to find the Template" + templateId);
}
long dataCenterId = dest.getDataCenter().getId();
DataCenterVO dc = _dcDao.findById(dest.getDataCenter().getId());
String nxVpxName = VirtualMachineName.getSystemVmName(id, "Vpx", NetScalerLbVmNamePrefix);
String nxVpxName = VirtualMachineName.getSystemVmName(id, "Vpx", NetScalerLbVmNamePrefix);
ServiceOfferingVO vpxOffering = _serviceOfferingDao.findById(svcOffId); //using 2GB and 2CPU offering
if(vpxOffering.getRamSize() < 2048 && vpxOffering.getCpu() <2 ) {
throw new InvalidParameterValueException("Specified Service Offering :" + vpxOffering.getUuid() + " NS Vpx cannot be deployed. Min 2GB Ram and 2 CPU are required");
}
ServiceOfferingVO vpxOffering = _serviceOfferingDao.findById(svcOffId); //using 2GB and 2CPU offering
if(vpxOffering.getRamSize() < 2048 && vpxOffering.getCpu() <2 ) {
throw new InvalidParameterValueException("Specified Service Offering :" + vpxOffering.getUuid() + " NS Vpx cannot be deployed. Min 2GB Ram and 2 CPU are required");
}
long userId = CallContext.current().getCallingUserId();
//TODO change the os bits from 142 103 to the actual guest of bits
if(template.getGuestOSId() != 103 ) {
throw new InvalidParameterValueException("Specified Template " + template.getUuid()+ " not suitable for NS VPX Deployment. Please register the template with guest os type as unknow(64-bit)");
}
NetworkVO defaultNetwork = null;
NetworkVO defaultPublicNetwork = null;
if (dc.getNetworkType() == NetworkType.Advanced && dc.isSecurityGroupEnabled()) {
List<NetworkVO> networks = _networkDao.listByZoneSecurityGroup(dataCenterId);
if (networks == null || networks.size() == 0) {
throw new CloudRuntimeException("Can not found security enabled network in SG Zone " + dc);
}
defaultNetwork = networks.get(0);
} else {
TrafficType defaultTrafficType = TrafficType.Management;
List<NetworkVO> defaultNetworks = _networkDao.listByZoneAndTrafficType(dataCenterId, defaultTrafficType);
long userId = CallContext.current().getCallingUserId();
//TODO change the os bits from 142 103 to the actual guest of bits
if(template.getGuestOSId() != 103 ) {
throw new InvalidParameterValueException("Specified Template " + template.getUuid()+ " not suitable for NS VPX Deployment. Please register the template with guest os type as unknow(64-bit)");
}
TrafficType publicTrafficType = TrafficType.Public;
List<NetworkVO> publicNetworks = _networkDao.listByZoneAndTrafficType(dataCenterId, publicTrafficType);
NetworkVO defaultNetwork = null;
NetworkVO defaultPublicNetwork = null;
if (dc.getNetworkType() == NetworkType.Advanced && dc.isSecurityGroupEnabled()) {
List<NetworkVO> networks = _networkDao.listByZoneSecurityGroup(dataCenterId);
if (networks == null || networks.size() == 0) {
throw new CloudRuntimeException("Can not found security enabled network in SG Zone " + dc);
}
defaultNetwork = networks.get(0);
} else {
TrafficType defaultTrafficType = TrafficType.Management;
List<NetworkVO> defaultNetworks = _networkDao.listByZoneAndTrafficType(dataCenterId, defaultTrafficType);
// api should never allow this situation to happen
if (defaultNetworks.size() != 1) {
throw new CloudRuntimeException("Found " + defaultNetworks.size() + " networks of type " + defaultTrafficType + " when expect to find 1");
}
TrafficType publicTrafficType = TrafficType.Public;
List<NetworkVO> publicNetworks = _networkDao.listByZoneAndTrafficType(dataCenterId, publicTrafficType);
if (publicNetworks.size() != 1) {
throw new CloudRuntimeException("Found " + defaultNetworks.size() + " networks of type " + defaultTrafficType + " when expect to find 1");
}
defaultPublicNetwork = publicNetworks.get(0);
defaultNetwork = defaultNetworks.get(0);
}
// api should never allow this situation to happen
if (defaultNetworks.size() != 1) {
throw new CloudRuntimeException("Found " + defaultNetworks.size() + " networks of type " + defaultTrafficType + " when expect to find 1");
}
LinkedHashMap<Network, List<? extends NicProfile>> networks = new LinkedHashMap<Network, List<? extends NicProfile>>(4);
NicProfile defaultNic = new NicProfile();
defaultNic.setDefaultNic(true);
defaultNic.setDeviceId(0);
if (publicNetworks.size() != 1) {
throw new CloudRuntimeException("Found " + defaultNetworks.size() + " networks of type " + defaultTrafficType + " when expect to find 1");
}
defaultPublicNetwork = publicNetworks.get(0);
defaultNetwork = defaultNetworks.get(0);
}
networks.put(_networkMgr.setupNetwork(_accountMgr.getSystemAccount() , _networkOfferingDao.findById(defaultNetwork.getNetworkOfferingId()), plan, null, null, false).get(0),
new ArrayList<NicProfile>());
LinkedHashMap<Network, List<? extends NicProfile>> networks = new LinkedHashMap<Network, List<? extends NicProfile>>(4);
NicProfile defaultNic = new NicProfile();
defaultNic.setDefaultNic(true);
defaultNic.setDeviceId(0);
NicProfile defaultNic1 = new NicProfile();
defaultNic1.setDefaultNic(false);
defaultNic1.setDeviceId(1);
networks.put(_networkMgr.setupNetwork(_accountMgr.getSystemAccount() , _networkOfferingDao.findById(defaultNetwork.getNetworkOfferingId()), plan, null, null, false).get(0), new ArrayList<NicProfile>());
NicProfile defaultNic2 = new NicProfile();
defaultNic2.setDefaultNic(false);
defaultNic2.setDeviceId(2);
defaultNic2.setIPv4Address("");
defaultNic2.setIPv4Gateway("");
defaultNic2.setIPv4Netmask("");
String macAddress = _networkDao.getNextAvailableMacAddress(defaultPublicNetwork.getId());
defaultNic2.setMacAddress(macAddress);
NicProfile defaultNic1 = new NicProfile();
defaultNic1.setDefaultNic(false);
defaultNic1.setDeviceId(1);
networks.put(_networkMgr.setupNetwork(_accountMgr.getSystemAccount(), _networkOfferingDao.findByUniqueName(NetworkOffering.SystemPublicNetwork), plan, null, null, false).get(0),
NicProfile defaultNic2 = new NicProfile();
defaultNic2.setDefaultNic(false);
defaultNic2.setDeviceId(2);
defaultNic2.setIPv4Address("");
defaultNic2.setIPv4Gateway("");
defaultNic2.setIPv4Netmask("");
String macAddress = _networkDao.getNextAvailableMacAddress(defaultPublicNetwork.getId(), null);
defaultNic2.setMacAddress(macAddress);
networks.put(_networkMgr.setupNetwork(_accountMgr.getSystemAccount(), _networkOfferingDao.findByUniqueName(NetworkOffering.SystemPublicNetwork), plan, null, null, false).get(0),
new ArrayList<NicProfile>(Arrays.asList(defaultNic2)));
networks.put(_networkMgr.setupNetwork(_accountMgr.getSystemAccount(), _networkOfferingDao.findByUniqueName(NetworkOffering.SystemControlNetwork), plan, null, null, false).get(0),
networks.put(_networkMgr.setupNetwork(_accountMgr.getSystemAccount(), _networkOfferingDao.findByUniqueName(NetworkOffering.SystemControlNetwork), plan, null, null, false).get(0),
new ArrayList<NicProfile>());
long physicalNetworkId = _networkModel.findPhysicalNetworkId(dataCenterId, _networkOfferingDao.findById(defaultPublicNetwork.getNetworkOfferingId()).getTags(), TrafficType.Public);
// Validate physical network
PhysicalNetwork physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
if (physicalNetwork == null) {
throw new InvalidParameterValueException("Unable to find physical network with id: " + physicalNetworkId + " and tag: "
long physicalNetworkId = _networkModel.findPhysicalNetworkId(dataCenterId, _networkOfferingDao.findById(defaultPublicNetwork.getNetworkOfferingId()).getTags(), TrafficType.Public);
// Validate physical network
PhysicalNetwork physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
if (physicalNetwork == null) {
throw new InvalidParameterValueException("Unable to find physical network with id: " + physicalNetworkId + " and tag: "
+ _networkOfferingDao.findById(defaultPublicNetwork.getNetworkOfferingId()).getTags());
}
String guestvnet = physicalNetwork.getVnetString();
}
String guestvnet = physicalNetwork.getVnetString();
final List<VlanVO> vlans = _vlanDao.listByZone(dataCenterId);
List<String> pvlan = new ArrayList<String>();
for (final VlanVO vlan : vlans) {
pvlan.add(vlan.getVlanTag());
}
final List<VlanVO> vlans = _vlanDao.listByZone(dataCenterId);
List<String> pvlan = new ArrayList<String>();
for (final VlanVO vlan : vlans) {
pvlan.add(vlan.getVlanTag());
}
long netScalerProvider = getNetScalerLbProviderId(physicalNetworkId);
DomainRouterVO nsVpx = new DomainRouterVO(id, vpxOffering.getId(), netScalerProvider, nxVpxName,
long netScalerProvider = getNetScalerLbProviderId(physicalNetworkId);
DomainRouterVO nsVpx = new DomainRouterVO(id, vpxOffering.getId(), netScalerProvider, nxVpxName,
template.getId(), template.getHypervisorType(), template.getGuestOSId(), owner.getDomainId(), owner.getId(), userId, false, RedundantState.UNKNOWN, false,
false, VirtualMachine.Type.NetScalerVm, null);
nsVpx.setRole(Role.NETSCALER_VM);
nsVpx.setRole(Role.NETSCALER_VM);
nsVpx = _routerDao.persist(nsVpx);
nsVpx = _routerDao.persist(nsVpx);
VMInstanceVO vmVO= _vmDao.findVMByHostName(nxVpxName);
_itMgr.allocate(nxVpxName, template, vpxOffering, networks, plan, template.getHypervisorType());
Map<Param, Object> params = new HashMap<VirtualMachineProfile.Param, Object>(1);
try {
if (vmVO != null) {
startNsVpx(vmVO, params);
} else {
throw new NullPointerException();
}
} catch (StorageUnavailableException e) {
e.printStackTrace();
} catch (ConcurrentOperationException e) {
e.printStackTrace();
} catch (ResourceUnavailableException e) {
e.printStackTrace();
}
vmVO= _vmDao.findByUuid(nsVpx.getUuid());
Map<String, Object> deployResponse = new HashMap<String, Object>();
deployResponse.put("vm", vmVO);
deployResponse.put("guestvlan", guestvnet);
deployResponse.put("publicvlan", pvlan);
return deployResponse;
}
VMInstanceVO vmVO= _vmDao.findVMByHostName(nxVpxName);
_itMgr.allocate(nxVpxName, template, vpxOffering, networks, plan, template.getHypervisorType());
Map<Param, Object> params = new HashMap<VirtualMachineProfile.Param, Object>(1);
try {
if (vmVO != null) {
startNsVpx(vmVO, params);
} else {
throw new NullPointerException();
}
} catch (StorageUnavailableException e) {
e.printStackTrace();
} catch (ConcurrentOperationException e) {
e.printStackTrace();
} catch (ResourceUnavailableException e) {
e.printStackTrace();
}
vmVO= _vmDao.findByUuid(nsVpx.getUuid());
Map<String, Object> deployResponse = new HashMap<String, Object>();
deployResponse.put("vm", vmVO);
deployResponse.put("guestvlan", guestvnet);
deployResponse.put("publicvlan", pvlan);
protected void startNsVpx(VMInstanceVO nsVpx, Map<Param, Object> params) throws StorageUnavailableException,
InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
s_logger.debug("Starting NS Vpx " + nsVpx);
_itMgr.start(nsVpx.getUuid(), params, null, null);
}
@Override
public Map<String,Object> deployNetscalerServiceVm(DeployNetscalerVpxCmd cmd) {
DataCenter zone = _dcDao.findById(cmd.getZoneId());
DeployDestination dest = new DeployDestination(zone, null, null, null);
VMInstanceVO vmvo = null;
Map<String,Object> resp = new HashMap<String, Object>();
Long templateId = cmd.getTemplateId();
Long serviceOfferingId = cmd.getServiceOfferingId();
DeploymentPlan plan = new DataCenterDeployment(dest.getDataCenter().getId());
try {
resp = deployNsVpx(cmd.getAccount(), dest, plan, serviceOfferingId, templateId);
} catch (InsufficientCapacityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return resp;
}
protected VirtualRouter stopNetScalerVm(final long vmId, final boolean forced, final Account caller, final long callerUserId) throws ResourceUnavailableException,
ConcurrentOperationException {
final DomainRouterVO netscalerVm = _routerDao.findById(vmId);
s_logger.debug("Stopping NetScaler vm " + netscalerVm);
if (netscalerVm == null || netscalerVm.getRole() != Role.NETSCALER_VM) {
throw new InvalidParameterValueException("Can't find NetScaler vm by id specified");
}
_accountMgr.checkAccess(caller, null, true, netscalerVm);
try {
_itMgr.expunge(netscalerVm.getUuid());
return _routerDao.findById(netscalerVm.getId());
} catch (final Exception e) {
throw new CloudRuntimeException("Unable to stop " + netscalerVm, e);
}
}
@Override
public VirtualRouter stopNetscalerServiceVm(Long id, boolean forced, Account callingAccount, long callingUserId) throws ConcurrentOperationException,
ResourceUnavailableException {
return stopNetScalerVm(id, forced, callingAccount, callingUserId);
}
@Override
public VirtualRouter stopNetScalerVm(Long vmId, boolean forced, Account caller, long callingUserId) {
final DomainRouterVO netscalerVm = _routerDao.findById(vmId);
s_logger.debug("Stopping NetScaler vm " + netscalerVm);
if (netscalerVm == null || netscalerVm.getRole() != Role.NETSCALER_VM) {
throw new InvalidParameterValueException("Can't find NetScaler vm by id specified");
return deployResponse;
}
_accountMgr.checkAccess(caller, null, true, netscalerVm);
try {
_itMgr.expunge(netscalerVm.getUuid());
return _routerDao.findById(netscalerVm.getId());
} catch (final Exception e) {
throw new CloudRuntimeException("Unable to stop " + netscalerVm, e);
protected void startNsVpx(VMInstanceVO nsVpx, Map<Param, Object> params) throws StorageUnavailableException,
InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
s_logger.debug("Starting NS Vpx " + nsVpx);
_itMgr.start(nsVpx.getUuid(), params, null, null);
}
@Override
public Map<String,Object> deployNetscalerServiceVm(DeployNetscalerVpxCmd cmd) {
DataCenter zone = _dcDao.findById(cmd.getZoneId());
DeployDestination dest = new DeployDestination(zone, null, null, null);
VMInstanceVO vmvo = null;
Map<String,Object> resp = new HashMap<String, Object>();
Long templateId = cmd.getTemplateId();
Long serviceOfferingId = cmd.getServiceOfferingId();
DeploymentPlan plan = new DataCenterDeployment(dest.getDataCenter().getId());
try {
resp = deployNsVpx(cmd.getAccount(), dest, plan, serviceOfferingId, templateId);
} catch (InsufficientCapacityException e) {
e.printStackTrace();
}
return resp;
}
protected VirtualRouter stopNetScalerVm(final long vmId, final boolean forced, final Account caller, final long callerUserId) throws ResourceUnavailableException, ConcurrentOperationException {
final DomainRouterVO netscalerVm = _routerDao.findById(vmId);
s_logger.debug("Stopping NetScaler vm " + netscalerVm);
if (netscalerVm == null || netscalerVm.getRole() != Role.NETSCALER_VM) {
throw new InvalidParameterValueException("Can't find NetScaler vm by id specified");
}
_accountMgr.checkAccess(caller, null, true, netscalerVm);
try {
_itMgr.expunge(netscalerVm.getUuid());
return _routerDao.findById(netscalerVm.getId());
} catch (final Exception e) {
throw new CloudRuntimeException("Unable to stop " + netscalerVm, e);
}
}
@Override
public VirtualRouter stopNetscalerServiceVm(Long id, boolean forced, Account callingAccount, long callingUserId) throws ConcurrentOperationException, ResourceUnavailableException {
return stopNetScalerVm(id, forced, callingAccount, callingUserId);
}
@Override
public VirtualRouter stopNetScalerVm(Long vmId, boolean forced, Account caller, long callingUserId) {
final DomainRouterVO netscalerVm = _routerDao.findById(vmId);
s_logger.debug("Stopping NetScaler vm " + netscalerVm);
if (netscalerVm == null || netscalerVm.getRole() != Role.NETSCALER_VM) {
throw new InvalidParameterValueException("Can't find NetScaler vm by id specified");
}
_accountMgr.checkAccess(caller, null, true, netscalerVm);
try {
_itMgr.expunge(netscalerVm.getUuid());
return _routerDao.findById(netscalerVm.getId());
} catch (final Exception e) {
throw new CloudRuntimeException("Unable to stop " + netscalerVm, e);
}
}
}
}

View File

@ -90,7 +90,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
private static final Logger s_logger = Logger.getLogger(AlertManagerImpl.class.getName());
private static final Logger s_alertsLogger = Logger.getLogger("org.apache.cloudstack.alerts");
private static final long INITIAL_CAPACITY_CHECK_DELAY = 30L * 1000L;// thirty seconds expressed in milliseconds
private static final long INITIAL_CAPACITY_CHECK_DELAY = 30L * 1000L; // Thirty seconds expressed in milliseconds.
private static final DecimalFormat DfPct = new DecimalFormat("###.##");
private static final DecimalFormat DfWhole = new DecimalFormat("########");
@ -126,7 +126,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
protected ConfigDepot _configDepot;
private Timer _timer = null;
private long _capacityCheckPeriod = 60L * 60L * 1000L;// one hour by default
private long _capacityCheckPeriod = 60L * 60L * 1000L; // One hour by default.
private double _publicIPCapacityThreshold = 0.75;
private double _privateIPCapacityThreshold = 0.75;
private double _secondaryStorageCapacityThreshold = 0.75;
@ -249,8 +249,8 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
if (_emailAlert != null) {
_emailAlert.sendAlert(alertType, dataCenterId, podId, null, subject, body);
} else {
s_alertsLogger.warn(" alertType:: " + alertType + " // dataCenterId:: " + dataCenterId + " // podId:: " + podId +
" // message:: " + subject + " // body:: " + body);
s_alertsLogger.warn("AlertType:: " + alertType + " | dataCenterId:: " + dataCenterId + " | podId:: " + podId +
" | message:: " + subject + " | body:: " + body);
}
} catch (Exception ex) {
s_logger.error("Problem sending email alert", ex);
@ -747,8 +747,8 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
// TODO: make sure this handles SSL transport (useAuth is true) and regular
public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long clusterId, String subject, String content) throws MessagingException,
UnsupportedEncodingException {
s_alertsLogger.warn(" alertType:: " + alertType + " // dataCenterId:: " + dataCenterId + " // podId:: " +
podId + " // clusterId:: " + clusterId + " // message:: " + subject);
s_alertsLogger.warn("AlertType:: " + alertType + " | dataCenterId:: " + dataCenterId + " | podId:: " +
podId + " | clusterId:: " + clusterId + " | message:: " + subject);
AlertVO alert = null;
if ((alertType != AlertManager.AlertType.ALERT_TYPE_HOST) &&
(alertType != AlertManager.AlertType.ALERT_TYPE_USERVM) &&
@ -771,7 +771,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
newAlert.setClusterId(clusterId);
newAlert.setPodId(podId);
newAlert.setDataCenterId(dataCenterId);
newAlert.setSentCount(1);// initialize sent count to 1 since we are now sending an alert
newAlert.setSentCount(1); // Initialize sent count to 1 since we are now sending an alert.
newAlert.setLastSent(new Date());
newAlert.setName(alertType.getName());
_alertDao.persist(newAlert);

View File

@ -1281,14 +1281,11 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
if (loadBalancersToApply.size() > 0) {
int numLoadBalancersForCommand = loadBalancersToApply.size();
LoadBalancerTO[] loadBalancersForCommand = loadBalancersToApply.toArray(new LoadBalancerTO[numLoadBalancersForCommand]);
// LoadBalancerConfigCommand cmd = new
// LoadBalancerConfigCommand(loadBalancersForCommand, null);
HealthCheckLBConfigCommand cmd = new HealthCheckLBConfigCommand(loadBalancersForCommand, network.getId());
long guestVlanTag = Integer.parseInt(BroadcastDomainType.getValue(network.getBroadcastUri()));
cmd.setAccessDetail(NetworkElementCommand.GUEST_VLAN_TAG, String.valueOf(guestVlanTag));
HealthCheckLBConfigAnswer answer = (HealthCheckLBConfigAnswer) _agentMgr
.easySend(externalLoadBalancer.getId(), cmd);
HealthCheckLBConfigAnswer answer = (HealthCheckLBConfigAnswer) _agentMgr.easySend(externalLoadBalancer.getId(), cmd);
// easySend will return null on error
return answer == null ? null : answer.getLoadBalancers();
}

View File

@ -2125,7 +2125,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
boolean success = _lbDao.update(lbRuleId, lb);
// If algorithm is changed, have to reapply the lb config
if ((algorithm!= null) && (tmplbVo.getAlgorithm().compareTo(algorithm)!=0)){
if ((algorithm != null) && (tmplbVo.getAlgorithm().compareTo(algorithm) != 0)){
try {
lb.setState(FirewallRule.State.Add);
_lbDao.persist(lb);

View File

@ -328,8 +328,9 @@ public class CertServiceImpl implements CertService {
response.setFingerprint(cert.getFingerPrint());
response.setName(cert.getName());
if (cert.getChain() != null)
if (cert.getChain() != null) {
response.setCertchain(cert.getChain());
}
if (lbCertMap != null && !lbCertMap.isEmpty()) {
final List<String> lbIds = new ArrayList<String>();

View File

@ -34,12 +34,8 @@ import com.cloud.utils.db.SearchBuilder;
@DB()
public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements NetworkDao {
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#listByOwner(long)
*/
@Override
public List<NetworkVO> listByOwner(final long ownerId) {
// TODO Auto-generated method stub
return null;
}
@ -48,279 +44,151 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#listBy(long, long, long)
*/
@Override
public List<NetworkVO> listBy(final long accountId, final long offeringId, final long dataCenterId) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#listBy(long, long, java.lang.String, boolean)
*/
@Override
public List<NetworkVO> listBy(final long accountId, final long dataCenterId, final String cidr, final boolean skipVpc) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#listByZoneAndGuestType(long, long, com.cloud.network.Network.GuestType, java.lang.Boolean)
*/
@Override
public List<NetworkVO> listByZoneAndGuestType(final long accountId, final long dataCenterId, final GuestType type, final Boolean isSystem) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#persist(com.cloud.network.NetworkVO, boolean, java.util.Map)
*/
@Override
public NetworkVO persist(final NetworkVO network, final boolean gc, final Map<String, String> serviceProviderMap) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#createSearchBuilderForAccount()
*/
@Override
public SearchBuilder<NetworkAccountVO> createSearchBuilderForAccount() {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#getNetworksForOffering(long, long, long)
*/
@Override
public List<NetworkVO> getNetworksForOffering(final long offeringId, final long dataCenterId, final long accountId) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#getNextAvailableMacAddress(long)
*/
@Override
public String getNextAvailableMacAddress(final long networkConfigId, Integer zoneMacIdentifier) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#listBy(long, long)
*/
@Override
public List<NetworkVO> listBy(final long accountId, final long networkId) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#countByZoneAndUri(long, java.lang.String)
*/
@Override
public long countByZoneAndUri(final long zoneId, final String broadcastUri) {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#countByZoneUriAndGuestType(long, java.lang.String, com.cloud.network.Network.GuestType)
*/
@Override
public long countByZoneUriAndGuestType(final long zoneId, final String broadcastUri, final GuestType guestType) {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#listByZone(long)
*/
@Override
public List<NetworkVO> listByZone(final long zoneId) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#changeActiveNicsBy(long, int)
*/
@Override
public void changeActiveNicsBy(final long networkId, final int nicsCount) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#getActiveNicsIn(long)
*/
@Override
public int getActiveNicsIn(final long networkId) {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#findNetworksToGarbageCollect()
*/
@Override
public List<Long> findNetworksToGarbageCollect() {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#clearCheckForGc(long)
*/
@Override
public void clearCheckForGc(final long networkId) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#listByZoneSecurityGroup(java.lang.Long)
*/
@Override
public List<NetworkVO> listByZoneSecurityGroup(final Long zoneId) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#addDomainToNetwork(long, long, java.lang.Boolean)
*/
@Override
public void addDomainToNetwork(final long networkId, final long domainId, final Boolean subdomainAccess) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#listByPhysicalNetwork(long)
*/
@Override
public List<NetworkVO> listByPhysicalNetwork(final long physicalNetworkId) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#listSecurityGroupEnabledNetworks()
*/
@Override
public List<NetworkVO> listSecurityGroupEnabledNetworks() {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#listByPhysicalNetworkTrafficType(long, com.cloud.network.Networks.TrafficType)
*/
@Override
public List<NetworkVO> listByPhysicalNetworkTrafficType(final long physicalNetworkId, final TrafficType trafficType) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#listBy(long, long, com.cloud.network.Network.GuestType, com.cloud.network.Networks.TrafficType)
*/
@Override
public List<NetworkVO> listBy(final long accountId, final long dataCenterId, final GuestType type, final TrafficType trafficType) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#listByPhysicalNetworkAndProvider(long, java.lang.String)
*/
@Override
public List<NetworkVO> listByPhysicalNetworkAndProvider(final long physicalNetworkId, final String providerName) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#persistNetworkServiceProviders(long, java.util.Map)
*/
@Override
public void persistNetworkServiceProviders(final long networkId, final Map<String, String> serviceProviderMap) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#update(java.lang.Long, com.cloud.network.NetworkVO, java.util.Map)
*/
@Override
public boolean update(final Long networkId, final NetworkVO network, final Map<String, String> serviceProviderMap) {
// TODO Auto-generated method stub
return false;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#listByZoneAndTrafficType(long, com.cloud.network.Networks.TrafficType)
*/
@Override
public List<NetworkVO> listByZoneAndTrafficType(final long zoneId, final TrafficType trafficType) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#setCheckForGc(long)
*/
@Override
public void setCheckForGc(final long networkId) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#getNetworkCountByNetworkOffId(long)
*/
@Override
public int getNetworkCountByNetworkOffId(final long networkOfferingId) {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#countNetworksUserCanCreate(long)
*/
@Override
public long countNetworksUserCanCreate(final long ownerId) {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#listSourceNATEnabledNetworks(long, long, com.cloud.network.Network.GuestType)
*/
@Override
public List<NetworkVO> listSourceNATEnabledNetworks(final long accountId, final long dataCenterId, final GuestType type) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#getNetworkCountByVpcId(long)
*/
@Override
public int getNetworkCountByVpcId(final long vpcId) {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#listByVpc(long)
*/
@Override
public List<NetworkVO> listByVpc(final long vpcId) {
final List<NetworkVO> networks = new ArrayList<NetworkVO>();
@ -328,21 +196,13 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
return networks;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#getPrivateNetwork(java.lang.String, java.lang.String, long, long)
*/
@Override
public NetworkVO getPrivateNetwork(final String broadcastUri, final String cidr, final long accountId, final long zoneId, final Long netofferid) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#countVpcNetworks(long)
*/
@Override
public long countVpcNetworks(final long vpcId) {
// TODO Auto-generated method stub
return 0;
}
@ -351,24 +211,18 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
return true;
}
/* (non-Javadoc)
* @see com.cloud.network.dao.NetworkDao#listNetworksByAccount(long, long, com.cloud.network.Network.GuestType, boolean)
*/
@Override
public List<NetworkVO> listNetworksByAccount(final long accountId, final long zoneId, final GuestType type, final boolean isSystem) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<NetworkVO> listRedundantNetworks() {
// TODO Auto-generated method stub
return null;
}
@Override
public List<NetworkVO> listVpcNetworks() {
// TODO Auto-generated method stub
return null;
}
@ -384,7 +238,6 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
@Override
public List<NetworkVO> listNetworkVO(List<Long> idset) {
// TODO Auto-generated method stub
return null;
}
}
}