mirror of https://github.com/apache/cloudstack.git
fix warnings in NetworkServiceImpl: removed unused code and add cases to switches
Signed-off-by: Sheng Yang <sheng.yang@citrix.com>
This commit is contained in:
parent
0f539b4ce1
commit
ff803f4131
|
|
@ -547,7 +547,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
long callerUserId = UserContext.current().getCallerUserId();
|
||||
DataCenter zone = _configMgr.getZone(zoneId);
|
||||
|
||||
if ((networkId == null && vpcId == null) && (networkId != null && vpcId != null)) {
|
||||
if ((networkId == null && vpcId == null) || (networkId != null && vpcId != null)) {
|
||||
throw new InvalidParameterValueException("One of Network id or VPC is should be passed");
|
||||
}
|
||||
|
||||
|
|
@ -651,7 +651,6 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
throw new InvalidParameterValueException("The nic is not belongs to user vm");
|
||||
}
|
||||
|
||||
Nic nic = _nicDao.findById(nicId);
|
||||
VirtualMachine vm = _userVmDao.findById(nicVO.getInstanceId());
|
||||
if (vm == null) {
|
||||
throw new InvalidParameterValueException("There is no vm with the nic");
|
||||
|
|
@ -671,7 +670,6 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
NetworkOfferingVO ntwkOff = _networkOfferingDao.findById(network.getNetworkOfferingId());
|
||||
|
||||
DataCenter dc = _dcDao.findById(network.getDataCenterId());
|
||||
Long id = nicVO.getInstanceId();
|
||||
|
||||
DataCenter zone = _configMgr.getZone(zoneId);
|
||||
if (zone == null) {
|
||||
|
|
@ -3337,12 +3335,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
boolean update = false;
|
||||
|
||||
if (state != null) {
|
||||
if (state == PhysicalNetworkServiceProvider.State.Shutdown) {
|
||||
throw new InvalidParameterValueException("Updating the provider state to 'Shutdown' is not supported");
|
||||
}
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("updating state of the service provider id=" + id + " on physical network: " + provider.getPhysicalNetworkId() + " to state: " + stateStr);
|
||||
s_logger.debug("trying to update the state of the service provider id=" + id + " on physical network: " + provider.getPhysicalNetworkId() + " to state: " + stateStr);
|
||||
}
|
||||
switch (state) {
|
||||
case Enabled:
|
||||
|
|
@ -3358,6 +3352,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
provider.setState(PhysicalNetworkServiceProvider.State.Disabled);
|
||||
update = true;
|
||||
break;
|
||||
case Shutdown:
|
||||
throw new InvalidParameterValueException("Updating the provider state to 'Shutdown' is not supported");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3565,6 +3561,9 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
case Control:
|
||||
xenLabel = "cloud_link_local_network";
|
||||
break;
|
||||
case Vpn:
|
||||
case None:
|
||||
break;
|
||||
}
|
||||
return xenLabel;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue