From 54fd39b9c0d9e3c72e9808ec969bb5bcf5f70c81 Mon Sep 17 00:00:00 2001 From: "Edison.Su" Date: Mon, 10 Sep 2012 17:09:38 -0400 Subject: [PATCH 1/4] add build-helper to remove the local repo --- pom.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pom.xml b/pom.xml index de7f5a409f9..972d6454c79 100644 --- a/pom.xml +++ b/pom.xml @@ -208,6 +208,22 @@ ${cs.jdk.version} + + org.codehaus.mojo + build-helper-maven-plugin + 1.7 + + + remove-old-installers + + remove-project-artifact + + + true + + + + From 022af906c0597cea8036b828bd86d224b8dbdfcb Mon Sep 17 00:00:00 2001 From: "Edison.Su" Date: Mon, 10 Sep 2012 17:44:52 -0400 Subject: [PATCH 2/4] it breaks the build --- deps/pom.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/deps/pom.xml b/deps/pom.xml index f99e7feb78d..be30c9ad16a 100644 --- a/deps/pom.xml +++ b/deps/pom.xml @@ -102,11 +102,6 @@ org.apache.cloudstack cloud-awsapi ${project.version} - - - org.apache.cloudstack - cloud-testclient - ${project.version} mysql From 176c340492b1e80ce4974ce91413fe540e444967 Mon Sep 17 00:00:00 2001 From: Edison Su Date: Mon, 10 Sep 2012 16:29:38 -0700 Subject: [PATCH 3/4] fix the build, hope --- awsapi/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awsapi/pom.xml b/awsapi/pom.xml index 0d0b3e07a57..4ead0cdeead 100644 --- a/awsapi/pom.xml +++ b/awsapi/pom.xml @@ -165,7 +165,7 @@ org.opensaml opensaml - 2.2.3 + 2.5.1-1 runtime From d6b652995180b6842545cd8b4798504b563a414c Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Mon, 10 Sep 2012 14:45:39 -0700 Subject: [PATCH 4/4] Revert "CLOUDSTACK-70: Improve Network Restart Behaviour for Basic Zone: Restarting Network Fails" This reverts commit ecd1ac214c34007214557c4191a803a55ded29f5. --- .../com/cloud/network/NetworkManagerImpl.java | 54 +++++-------------- .../src/com/cloud/vm/dao/DomainRouterDao.java | 9 +--- .../com/cloud/vm/dao/DomainRouterDaoImpl.java | 7 --- .../src/com/cloud/vm/dao/VMInstanceDao.java | 9 +--- .../com/cloud/vm/dao/VMInstanceDaoImpl.java | 10 +--- ui/scripts/network.js | 12 +++-- 6 files changed, 26 insertions(+), 75 deletions(-) diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index aee9a417b86..292a25987ba 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -68,7 +68,6 @@ import com.cloud.dc.AccountVlanMapVO; import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; import com.cloud.dc.DataCenterVO; -import com.cloud.dc.HostPodVO; import com.cloud.dc.Pod; import com.cloud.dc.PodVlanMapVO; import com.cloud.dc.Vlan; @@ -78,7 +77,6 @@ import com.cloud.dc.dao.AccountVlanMapDao; import com.cloud.dc.dao.DataCenterDao; import com.cloud.dc.dao.PodVlanMapDao; import com.cloud.dc.dao.VlanDao; -import com.cloud.dc.dao.HostPodDao; import com.cloud.deploy.DataCenterDeployment; import com.cloud.deploy.DeployDestination; import com.cloud.deploy.DeploymentPlan; @@ -204,7 +202,6 @@ import com.cloud.utils.db.Transaction; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.Ip; import com.cloud.utils.net.NetUtils; -import com.cloud.vm.DomainRouterVO; import com.cloud.vm.Nic; import com.cloud.vm.NicProfile; import com.cloud.vm.NicVO; @@ -235,8 +232,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag @Inject DataCenterDao _dcDao = null; @Inject - HostPodDao _podDao = null; - @Inject VlanDao _vlanDao = null; @Inject IPAddressDao _ipAddressDao = null; @@ -245,8 +240,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag @Inject DomainDao _domainDao = null; @Inject - DomainRouterDao _domainRouterDao = null; - @Inject UserStatisticsDao _userStatsDao = null; @Inject EventDao _eventDao = null; @@ -3814,6 +3807,12 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag throw new InvalidParameterValueException("Network is not in the right state to be restarted. Correct states are: " + Network.State.Implemented + ", " + Network.State.Setup); } + // don't allow clenaup=true for the network in Basic zone + DataCenter zone = _configMgr.getZone(network.getDataCenterId()); + if (zone.getNetworkType() == NetworkType.Basic && cleanup) { + throw new InvalidParameterValueException("Cleanup can't be true when restart network in Basic zone"); + } + _accountMgr.checkAccess(callerAccount, null, true, network); boolean success = restartNetwork(networkId, callerAccount, callerUser, cleanup); @@ -3858,6 +3857,10 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag ReservationContext context = new ReservationContextImpl(null, null, callerUser, callerAccount); if (cleanup) { + if (network.getGuestType() != GuestType.Isolated) { + s_logger.warn("Only support clean up network for isolated network!"); + return false; + } // shutdown the network s_logger.debug("Shutting down the network id=" + networkId + " as a part of network restart"); @@ -3870,43 +3873,14 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag s_logger.debug("Skip the shutting down of network id=" + networkId); } + // implement the network elements and rules again + DeployDestination dest = new DeployDestination(_dcDao.findById(network.getDataCenterId()), null, null, null); + s_logger.debug("Implementing the network " + network + " elements and resources as a part of network restart"); NetworkOfferingVO offering = _networkOfferingDao.findById(network.getNetworkOfferingId()); try { - DataCenter dc = _dcDao.findById(network.getDataCenterId()); - //Pod based network restart for basic network, one VR per pod - if (dc.getNetworkType() == NetworkType.Basic) { - //Loop through all pods with running user vms and restart network - for (HostPodVO pod: _podDao.listByDataCenterId(dc.getId())) { - s_logger.debug("Trying to restart network for Pod: " + pod.getName() + ", id=" + pod.getId()); - //If cleanup is false, don't implement network on running VRs - List virtualRouters = _domainRouterDao.listByPodId(pod.getId()); - Boolean podHasSingleVR = (virtualRouters.size() == 1); - if (!podHasSingleVR) { - s_logger.warn("Pod should have only one VR in Basic Zone, please check!"); - } - if (!cleanup && virtualRouters != null && podHasSingleVR - && virtualRouters.get(0).getState() == VirtualMachine.State.Running) { - s_logger.debug("Cleanup=false: Found a running VR, skipping network implementation for the pod"); - continue; - } - //Implement network only if there are running user vms in 'pod' - List vms = _vmDao.listByPodId(pod.getId()); - for (VMInstanceVO vm: vms) { - // implement the network elements and rules again - if (vm.getType() == Type.User && vm.getState() == VirtualMachine.State.Running) { - DeployDestination dest = new DeployDestination(dc, pod, null, null); - implementNetworkElementsAndResources(dest, context, network, offering); - break; - } - } - } - } else { - // implement the network elements and rules again - DeployDestination dest = new DeployDestination(dc, null, null, null); - implementNetworkElementsAndResources(dest, context, network, offering); - } + implementNetworkElementsAndResources(dest, context, network, offering); setRestartRequired(network, true); } catch (Exception ex) { s_logger.warn("Failed to implement network " + network + " elements and resources as a part of network restart due to ", ex); diff --git a/server/src/com/cloud/vm/dao/DomainRouterDao.java b/server/src/com/cloud/vm/dao/DomainRouterDao.java index d8e8cd86f9a..01e32588007 100755 --- a/server/src/com/cloud/vm/dao/DomainRouterDao.java +++ b/server/src/com/cloud/vm/dao/DomainRouterDao.java @@ -61,14 +61,7 @@ public interface DomainRouterDao extends GenericDao { */ public List listByHostId(Long hostId); public List listByLastHostId(Long hostId); - - /** - * virtual machine routers. - * @param podId id of the pod. null if to get all. - * @return list of DomainRouterVO - */ - public List listByPodId(Long podId); - + /** * list virtual machine routers by host id. * pass in null to get all diff --git a/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java b/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java index 2948500a0d4..175d3f28d04 100755 --- a/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java +++ b/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java @@ -177,13 +177,6 @@ public class DomainRouterDaoImpl extends GenericDaoBase im return listBy(sc); } - @Override - public List listByPodId(Long podId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("podId", podId); - return listBy(sc); - } - @Override public List listIsolatedByHostId(Long hostId) { SearchCriteria sc = HostUpSearch.create(); diff --git a/server/src/com/cloud/vm/dao/VMInstanceDao.java b/server/src/com/cloud/vm/dao/VMInstanceDao.java index 9a261aa4116..2cf3d75018c 100644 --- a/server/src/com/cloud/vm/dao/VMInstanceDao.java +++ b/server/src/com/cloud/vm/dao/VMInstanceDao.java @@ -46,14 +46,7 @@ public interface VMInstanceDao extends GenericDao, StateDao< * @return list of VMInstanceVO in the specified zone */ List listByZoneId(long zoneId); - - /** - * List VMs by pod ID - * @param podId - * @return list of VMInstanceVO in the specified pod - */ - List listByPodId(long podId); - + /** * Lists non-expunged VMs by zone ID and templateId * @param zoneId diff --git a/server/src/com/cloud/vm/dao/VMInstanceDaoImpl.java b/server/src/com/cloud/vm/dao/VMInstanceDaoImpl.java index 7f1c5b2aa28..571b5d1841c 100644 --- a/server/src/com/cloud/vm/dao/VMInstanceDaoImpl.java +++ b/server/src/com/cloud/vm/dao/VMInstanceDaoImpl.java @@ -127,7 +127,6 @@ public class VMInstanceDaoImpl extends GenericDaoBase implem AllFieldsSearch.and("lastHost", AllFieldsSearch.entity().getLastHostId(), Op.EQ); AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ); AllFieldsSearch.and("zone", AllFieldsSearch.entity().getDataCenterIdToDeployIn(), Op.EQ); - AllFieldsSearch.and("pod", AllFieldsSearch.entity().getPodIdToDeployIn(), Op.EQ); AllFieldsSearch.and("type", AllFieldsSearch.entity().getType(), Op.EQ); AllFieldsSearch.and("account", AllFieldsSearch.entity().getAccountId(), Op.EQ); AllFieldsSearch.done(); @@ -231,14 +230,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase implem return listBy(sc); } - - @Override - public List listByPodId(long podId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("pod", podId); - return listBy(sc); - } - + @Override public List listByClusterId(long clusterId) { SearchCriteria sc = VMClusterSearch.create(); diff --git a/ui/scripts/network.js b/ui/scripts/network.js index d239cad43a1..d0f65c4c3c0 100644 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -604,9 +604,15 @@ success: function(json){ zoneObj = json.listzonesresponse.zone[0]; } - }); - args.$form.find('.form-item[rel=cleanup]').find('input').attr('checked', 'checked'); //checked - args.$form.find('.form-item[rel=cleanup]').css('display', 'inline-block'); //shown + }); + if(zoneObj.networktype == "Basic") { + args.$form.find('.form-item[rel=cleanup]').find('input').removeAttr('checked'); //unchecked + args.$form.find('.form-item[rel=cleanup]').hide(); //hidden + } + else { + args.$form.find('.form-item[rel=cleanup]').find('input').attr('checked', 'checked'); //checked + args.$form.find('.form-item[rel=cleanup]').css('display', 'inline-block'); //shown + } }, fields: { cleanup: {