incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chipchild...@apache.org
Subject [34/50] [abbrv] git commit: CLOUDSTACK-70: Improve restart network behaviour for basic network
Date Mon, 15 Oct 2012 20:29:47 GMT
CLOUDSTACK-70: Improve restart network behaviour for basic network

If cleanup=true, network elements and resources are shutdown and
reimplemented. Else, shutdown/reimplementation is skipped. Enabled
cleanup checkbox in CS UI.

For both cases, VRs are only deployed for Pods with no running
or starting VRs and Pods having running or starting user vms.

New DAO helpers introduced:
HostPodDao: listByDataCenterIdVMTypeAndStates
DomainRouterDao: listByPodId and listByPodIdAndStates
VMInstanceDao: listByPodId and corrected definition of listByTypeAndState

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/2f1621b6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/2f1621b6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/2f1621b6

Branch: refs/heads/junit-tests
Commit: 2f1621b649d4e5fadfbdb4047d12741807d0c70a
Parents: df64dfc
Author: Rohit Yadav <bhaisaab@apache.org>
Authored: Thu Oct 11 18:30:00 2012 +0530
Committer: Chip Childers <chip.childers@gmail.com>
Committed: Mon Oct 15 16:19:15 2012 -0400

----------------------------------------------------------------------
 server/src/com/cloud/dc/dao/HostPodDao.java        |    7 +-
 server/src/com/cloud/dc/dao/HostPodDaoImpl.java    |   28 +++-
 .../src/com/cloud/network/NetworkManagerImpl.java  |   10 -
 .../router/VirtualNetworkApplianceManagerImpl.java |  155 +++++++++------
 server/src/com/cloud/vm/dao/DomainRouterDao.java   |   19 ++-
 .../src/com/cloud/vm/dao/DomainRouterDaoImpl.java  |   17 ++
 server/src/com/cloud/vm/dao/VMInstanceDao.java     |   13 +-
 server/src/com/cloud/vm/dao/VMInstanceDaoImpl.java |   12 +-
 ui/scripts/network.js                              |   12 +-
 9 files changed, 185 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2f1621b6/server/src/com/cloud/dc/dao/HostPodDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/dc/dao/HostPodDao.java b/server/src/com/cloud/dc/dao/HostPodDao.java
index f031ac9..ced3484 100644
--- a/server/src/com/cloud/dc/dao/HostPodDao.java
+++ b/server/src/com/cloud/dc/dao/HostPodDao.java
@@ -21,11 +21,14 @@ import java.util.List;
 
 import com.cloud.dc.HostPodVO;
 import com.cloud.utils.db.GenericDao;
+import com.cloud.vm.VirtualMachine;
 
 public interface HostPodDao extends GenericDao<HostPodVO, Long> {
 	public List<HostPodVO> listByDataCenterId(long id);
-	
-	public HostPodVO findByName(String name, long dcId);
+
+    public List<HostPodVO> listByDataCenterIdVMTypeAndStates(long id, VirtualMachine.Type
type, VirtualMachine.State... states);
+
+    public HostPodVO findByName(String name, long dcId);
 	
 	public HashMap<Long, List<Object>> getCurrentPodCidrSubnets(long zoneId, long
podIdToSkip);
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2f1621b6/server/src/com/cloud/dc/dao/HostPodDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/dc/dao/HostPodDaoImpl.java b/server/src/com/cloud/dc/dao/HostPodDaoImpl.java
index bec8c51..fce308a 100644
--- a/server/src/com/cloud/dc/dao/HostPodDaoImpl.java
+++ b/server/src/com/cloud/dc/dao/HostPodDaoImpl.java
@@ -31,10 +31,15 @@ import com.cloud.dc.HostPodVO;
 import com.cloud.org.Grouping;
 import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.JoinBuilder;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.Transaction;
+import com.cloud.utils.component.ComponentLocator;
+import com.cloud.vm.VMInstanceVO;
+import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.dao.VMInstanceDaoImpl;
 
 @Local(value={HostPodDao.class})
 public class HostPodDaoImpl extends GenericDaoBase<HostPodVO, Long> implements HostPodDao
{
@@ -61,7 +66,28 @@ public class HostPodDaoImpl extends GenericDaoBase<HostPodVO, Long>
implements H
 		
 	    return listBy(sc);
 	}
-	
+
+    @Override
+    public List<HostPodVO> listByDataCenterIdVMTypeAndStates(long id, VirtualMachine.Type
type, VirtualMachine.State... states) {
+        final VMInstanceDaoImpl _vmDao = ComponentLocator.inject(VMInstanceDaoImpl.class);
+        SearchBuilder<VMInstanceVO> vmInstanceSearch = _vmDao.createSearchBuilder();
+        vmInstanceSearch.and("type", vmInstanceSearch.entity().getType(), SearchCriteria.Op.EQ);
+        vmInstanceSearch.and("states", vmInstanceSearch.entity().getState(), SearchCriteria.Op.IN);
+
+        SearchBuilder<HostPodVO> podIdSearch = createSearchBuilder();
+        podIdSearch.and("dc", podIdSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        podIdSearch.select(null, SearchCriteria.Func.DISTINCT, podIdSearch.entity().getId());
+        podIdSearch.join("vmInstanceSearch", vmInstanceSearch, podIdSearch.entity().getId(),
+                vmInstanceSearch.entity().getPodIdToDeployIn(), JoinBuilder.JoinType.INNER);
+        podIdSearch.done();
+
+        SearchCriteria<HostPodVO> sc = podIdSearch.create();
+        sc.setParameters("dc", id);
+        sc.setJoinParameters("vmInstanceSearch", "type", type);
+        sc.setJoinParameters("vmInstanceSearch", "states", (Object[]) states);
+        return listBy(sc);
+    }
+
 	@Override
     public HostPodVO findByName(String name, long dcId) {
 	    SearchCriteria<HostPodVO> sc = DataCenterAndNameSearch.create();

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2f1621b6/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index 7b38c83..13a2bb1 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -3807,12 +3807,6 @@ 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);
@@ -3857,10 +3851,6 @@ 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");
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2f1621b6/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index 4400a9b..dcb630e 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1263,7 +1263,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
             boolean isRedundant, Map<Param, Object> params) throws ConcurrentOperationException,

             InsufficientCapacityException, ResourceUnavailableException {
 
-        
         List<DomainRouterVO> routers = new ArrayList<DomainRouterVO>();
         Network lock = _networkDao.acquireInLockTable(guestNetwork.getId(), _networkMgr.getNetworkLockTimeout());
         if (lock == null) {
@@ -1285,73 +1284,111 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
             boolean isPodBased = (dest.getDataCenter().getNetworkType() == NetworkType.Basic
||
                     _networkMgr.areServicesSupportedInNetwork(guestNetwork.getId(), Service.SecurityGroup))
                     && guestNetwork.getTrafficType() == TrafficType.Guest;
-        
-            Pair<DeploymentPlan, List<DomainRouterVO>> planAndRouters = getDeploymentPlanAndRouters(isPodBased,
dest, guestNetwork.getId());
-            routers = planAndRouters.second();
-        
-            // 2) Figure out required routers count
-            int routerCount = 1;
-            if (isRedundant) {
-                routerCount = 2;
-            }
-        
-            /* If old network is redundant but new is single router, then routers.size()
= 2 but routerCount = 1 */
-            if (routers.size() >= routerCount) {
-                return routers;
-            }
-        
-            if (routers.size() >= 5) {
-                s_logger.error("Too much redundant routers!");
-            }
 
-            // Check if providers are supported in the physical networks
-            VirtualRouterProviderType type = VirtualRouterProviderType.VirtualRouter;
-            Long physicalNetworkId = _networkMgr.getPhysicalNetworkId(guestNetwork);
-            PhysicalNetworkServiceProvider provider = _physicalProviderDao.findByServiceProvider(physicalNetworkId,
type.toString());
-            if (provider == null) {
-                throw new CloudRuntimeException("Cannot find service provider " + type.toString()
+ " in physical network " + physicalNetworkId);
-            }
-            VirtualRouterProvider vrProvider = _vrProviderDao.findByNspIdAndType(provider.getId(),
type);
-            if (vrProvider == null) {
-                throw new CloudRuntimeException("Cannot find virtual router provider " +
type.toString()+ " as service provider " + provider.getId());
-            }
+            // dest has pod=null, for Basic Zone findOrDeployVRs for all Pods
+            List<DeployDestination> destinations = new ArrayList<DeployDestination>();
 
-            if (_networkMgr.isNetworkSystem(guestNetwork) || guestNetwork.getGuestType()
== Network.GuestType.Shared) {
-                owner = _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM);
-            }
+            if (dest.getDataCenter().getNetworkType() == NetworkType.Basic) {
+                // Find all pods in the data center with running or starting user vms
+                long dcId = dest.getDataCenter().getId();
+                List<HostPodVO> pods = _podDao.listByDataCenterIdVMTypeAndStates(dcId,
VirtualMachine.Type.User, VirtualMachine.State.Starting, VirtualMachine.State.Running);
 
-            //Check if public network has to be set on VR
-            boolean publicNetwork = false;
-            if (_networkMgr.isProviderSupportServiceInNetwork(guestNetwork.getId(), Service.SourceNat,
Provider.VirtualRouter)) {
-                publicNetwork = true;
+                // Loop through all the pods skip those with running or starting VRs
+                for (HostPodVO pod: pods) {
+                    // Get list of VRs in starting or running state
+                    long podId = pod.getId();
+                    List<DomainRouterVO> virtualRouters = _routerDao.listByPodIdAndStates(podId,
VirtualMachine.State.Starting, VirtualMachine.State.Running);
+
+                    assert (virtualRouters.size() <= 1) : "Pod can have utmost one VR
in Basic Zone, please check!";
+
+                    // Add virtualRouters to the routers, this avoids the situation when
+                    // all routers are skipped and VirtualRouterElement throws exception
+                    routers.addAll(virtualRouters);
+
+                    // If List size is one, we already have a starting or running VR, skip
deployment
+                    if (virtualRouters.size() == 1) {
+                        s_logger.debug("Skipping VR deployment: Found a running or starting
VR in Pod "
+                                + pod.getName() + " id=" + podId);
+                        continue;
+                    }
+                    // Add new DeployDestination for this pod
+                    destinations.add(new DeployDestination(dest.getDataCenter(), pod, null,
null));
+                }
             }
-            if (isRedundant && !publicNetwork) {
-                s_logger.error("Didn't support redundant virtual router without public network!");
-                return null;
+            else {
+                // Else, just add the supplied dest
+                destinations.add(dest);
             }
 
-            Long offeringId = _networkOfferingDao.findById(guestNetwork.getNetworkOfferingId()).getServiceOfferingId();
-            if (offeringId == null) {
-                offeringId = _offering.getId();
-            }
+            // Except for Basic Zone, the for loop will iterate only once
+            for (DeployDestination destination: destinations) {
+                Pair<DeploymentPlan, List<DomainRouterVO>> planAndRouters = getDeploymentPlanAndRouters(isPodBased,
destination, guestNetwork.getId());
+                routers = planAndRouters.second();
 
-            PublicIp sourceNatIp = null;
-            if (publicNetwork) {
-                sourceNatIp = _networkMgr.assignSourceNatIpAddressToGuestNetwork(owner, guestNetwork);
-            }
+                // 2) Figure out required routers count
+                int routerCount = 1;
+                if (isRedundant) {
+                    routerCount = 2;
+                }
+
+                // If old network is redundant but new is single router, then routers.size()
= 2 but routerCount = 1
+                if (routers.size() >= routerCount) {
+                    return routers;
+                }
+
+                if (routers.size() >= 5) {
+                    s_logger.error("Too much redundant routers!");
+                }
+
+                // Check if providers are supported in the physical networks
+                VirtualRouterProviderType type = VirtualRouterProviderType.VirtualRouter;
+                Long physicalNetworkId = _networkMgr.getPhysicalNetworkId(guestNetwork);
+                PhysicalNetworkServiceProvider provider = _physicalProviderDao.findByServiceProvider(physicalNetworkId,
type.toString());
+                if (provider == null) {
+                    throw new CloudRuntimeException("Cannot find service provider " + type.toString()
+ " in physical network " + physicalNetworkId);
+                }
+                VirtualRouterProvider vrProvider = _vrProviderDao.findByNspIdAndType(provider.getId(),
type);
+                if (vrProvider == null) {
+                    throw new CloudRuntimeException("Cannot find virtual router provider
" + type.toString() + " as service provider " + provider.getId());
+                }
 
-            //3) deploy virtual router(s)
-            int count = routerCount - routers.size();
-            DeploymentPlan plan = planAndRouters.first();
-            for (int i = 0; i < count; i++) {
-                List<Pair<NetworkVO, NicProfile>> networks = createRouterNetworks(owner,
isRedundant, plan, guestNetwork,
-                        new Pair<Boolean, PublicIp>(publicNetwork, sourceNatIp));
-                //don't start the router as we are holding the network lock that needs to
be released at the end of router allocation
-                DomainRouterVO router = deployRouter(owner, dest, plan, params, isRedundant,
vrProvider, offeringId,
-                        null, networks, false, null);
+                if (_networkMgr.isNetworkSystem(guestNetwork) || guestNetwork.getGuestType()
== Network.GuestType.Shared) {
+                    owner = _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM);
+                }
+
+                // Check if public network has to be set on VR
+                boolean publicNetwork = false;
+                if (_networkMgr.isProviderSupportServiceInNetwork(guestNetwork.getId(), Service.SourceNat,
Provider.VirtualRouter)) {
+                    publicNetwork = true;
+                }
+                if (isRedundant && !publicNetwork) {
+                    s_logger.error("Didn't support redundant virtual router without public
network!");
+                    return null;
+                }
+
+                Long offeringId = _networkOfferingDao.findById(guestNetwork.getNetworkOfferingId()).getServiceOfferingId();
+                if (offeringId == null) {
+                    offeringId = _offering.getId();
+                }
+
+                PublicIp sourceNatIp = null;
+                if (publicNetwork) {
+                    sourceNatIp = _networkMgr.assignSourceNatIpAddressToGuestNetwork(owner,
guestNetwork);
+                }
 
-                _routerDao.addRouterToGuestNetwork(router, guestNetwork);
-                routers.add(router);
+                // 3) deploy virtual router(s)
+                int count = routerCount - routers.size();
+                DeploymentPlan plan = planAndRouters.first();
+                for (int i = 0; i < count; i++) {
+                    List<Pair<NetworkVO, NicProfile>> networks = createRouterNetworks(owner,
isRedundant, plan, guestNetwork,
+                            new Pair<Boolean, PublicIp>(publicNetwork, sourceNatIp));
+                    //don't start the router as we are holding the network lock that needs
to be released at the end of router allocation
+                    DomainRouterVO router = deployRouter(owner, destination, plan, params,
isRedundant, vrProvider, offeringId,
+                            null, networks, false, null);
+
+                    _routerDao.addRouterToGuestNetwork(router, guestNetwork);
+                    routers.add(router);
+                }
             }
         } finally {
             if (lock != null) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2f1621b6/server/src/com/cloud/vm/dao/DomainRouterDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/dao/DomainRouterDao.java b/server/src/com/cloud/vm/dao/DomainRouterDao.java
index 01e3258..95d1ea6 100755
--- a/server/src/com/cloud/vm/dao/DomainRouterDao.java
+++ b/server/src/com/cloud/vm/dao/DomainRouterDao.java
@@ -61,7 +61,24 @@ public interface DomainRouterDao extends GenericDao<DomainRouterVO,
Long> {
      */
     public List<DomainRouterVO> listByHostId(Long hostId);
     public List<DomainRouterVO> listByLastHostId(Long hostId);
-    
+
+    /**
+     * list virtual machine routers by pod id.  pass in null to get all
+     * virtual machine routers.
+     * @param podId id of the pod.  null if to get all.
+     * @return list of DomainRouterVO
+     */
+    public List<DomainRouterVO> listByPodId(Long podId);
+
+    /**
+     * list virtual machine routers by pod id.  pass in null to get all
+     * virtual machine routers.
+     * @param podId id of the pod.  null if to get all.
+     * @param state state of the domain router. null if to get all.
+     * @return list of DomainRouterVO
+     */
+    public List<DomainRouterVO> listByPodIdAndStates(Long podId, State... states);
+
     /**
      * list virtual machine routers by host id.
      * pass in null to get all

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2f1621b6/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java b/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
index 175d3f2..9ab3ad0 100755
--- a/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
+++ b/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
@@ -41,6 +41,7 @@ import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.db.UpdateBuilder;
 import com.cloud.vm.DomainRouterVO;
+import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachine.State;
 
 @Local(value = { DomainRouterDao.class })
@@ -66,6 +67,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO,
Long> im
         AllFieldsSearch.and("host", AllFieldsSearch.entity().getHostId(), Op.EQ);
         AllFieldsSearch.and("lastHost", AllFieldsSearch.entity().getLastHostId(), Op.EQ);
         AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ);
+        AllFieldsSearch.and("states", AllFieldsSearch.entity().getState(), Op.IN);
         SearchBuilder<RouterNetworkVO> joinRouterNetwork = _routerNetworkDao.createSearchBuilder();
         joinRouterNetwork.and("networkId", joinRouterNetwork.entity().getNetworkId(), Op.EQ);
         AllFieldsSearch.join("networkRouter", joinRouterNetwork, joinRouterNetwork.entity().getRouterId(),
AllFieldsSearch.entity().getId(), JoinType.INNER);
@@ -178,6 +180,21 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO,
Long> im
     }
 
     @Override
+    public List<DomainRouterVO> listByPodId(Long podId) {
+        SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
+        sc.setParameters("podId", podId);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<DomainRouterVO> listByPodIdAndStates(Long podId, State... states) {
+        SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
+        sc.setParameters("podId", podId);
+        sc.setParameters("states", (Object[]) states);
+        return listBy(sc);
+    }
+
+    @Override
     public List<DomainRouterVO> listIsolatedByHostId(Long hostId) {
         SearchCriteria<DomainRouterVO> sc = HostUpSearch.create();
         if (hostId != null) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2f1621b6/server/src/com/cloud/vm/dao/VMInstanceDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/dao/VMInstanceDao.java b/server/src/com/cloud/vm/dao/VMInstanceDao.java
index 2cf3d75..8b0a523 100644
--- a/server/src/com/cloud/vm/dao/VMInstanceDao.java
+++ b/server/src/com/cloud/vm/dao/VMInstanceDao.java
@@ -46,7 +46,14 @@ public interface VMInstanceDao extends GenericDao<VMInstanceVO, Long>,
StateDao<
 	 * @return list of VMInstanceVO in the specified zone
 	 */
 	List<VMInstanceVO> listByZoneId(long zoneId);
-	
+
+    /**
+     * List VMs by pod ID
+     * @param podId
+     * @return list of VMInstanceVO in the specified pod
+     */
+    List<VMInstanceVO> listByPodId(long podId);
+
 	/**
 	 * Lists non-expunged VMs by zone ID and templateId
 	 * @param zoneId
@@ -76,8 +83,8 @@ public interface VMInstanceDao extends GenericDao<VMInstanceVO, Long>,
StateDao<
     List<VMInstanceVO> listByZoneIdAndType(long zoneId, VirtualMachine.Type type);
 	List<VMInstanceVO> listUpByHostId(Long hostId);
 	List<VMInstanceVO> listByLastHostId(Long hostId);
-	
-	List<VMInstanceVO> listByTypeAndState(State state, VirtualMachine.Type type);
+
+    List<VMInstanceVO> listByTypeAndState(VirtualMachine.Type type, State state);
 
     List<VMInstanceVO> listByAccountId(long accountId);
     public Long countAllocatedVirtualRoutersForAccount(long accountId);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2f1621b6/server/src/com/cloud/vm/dao/VMInstanceDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/dao/VMInstanceDaoImpl.java b/server/src/com/cloud/vm/dao/VMInstanceDaoImpl.java
index 571b5d1..85ad5d0 100644
--- a/server/src/com/cloud/vm/dao/VMInstanceDaoImpl.java
+++ b/server/src/com/cloud/vm/dao/VMInstanceDaoImpl.java
@@ -230,14 +230,20 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO,
Long> implem
 
         return listBy(sc);
     }
-    
+
+    @Override
+    public List<VMInstanceVO> listByPodId(long podId) {
+        SearchCriteria<VMInstanceVO> sc = AllFieldsSearch.create();
+        sc.setParameters("pod", podId);
+        return listBy(sc);
+    }
+
     @Override
     public List<VMInstanceVO> listByClusterId(long clusterId) {
         SearchCriteria<VMInstanceVO> sc = VMClusterSearch.create();
         sc.setJoinParameters("hostSearch", "clusterId", clusterId);
         return listBy(sc);
     }
-
     
     @Override
     public List<VMInstanceVO> listLHByClusterId(long clusterId) {
@@ -309,7 +315,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO,
Long> implem
     }
     
     @Override
-    public List<VMInstanceVO> listByTypeAndState(State state, VirtualMachine.Type type)
{
+    public List<VMInstanceVO> listByTypeAndState(VirtualMachine.Type type, State state)
{
         SearchCriteria<VMInstanceVO> sc = AllFieldsSearch.create();
         sc.setParameters("type", type);
         sc.setParameters("state", state);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2f1621b6/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 65adf66..d3912a0 100644
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -699,15 +699,9 @@
 											success: function(json){											  
 											  zoneObj = json.listzonesresponse.zone[0];												
 											}
-										});																				
-										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
-                    }											
+										});
+                                        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: {


Mime
View raw message