Updated Branches:
  refs/heads/CS-2163 2c176ab9e -> a3958cda9

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3958cda/server/src/com/cloud/vm/dao/UserVmDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/dao/UserVmDaoImpl.java 
b/server/src/com/cloud/vm/dao/UserVmDaoImpl.java
index 4922828..9dc74a3 100755
--- a/server/src/com/cloud/vm/dao/UserVmDaoImpl.java
+++ b/server/src/com/cloud/vm/dao/UserVmDaoImpl.java
@@ -1,60 +1,60 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.vm.dao;
-
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.PostConstruct;
-import javax.ejb.Local;
-import javax.inject.Inject;
-
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import com.cloud.configuration.Resource;
-import com.cloud.server.ResourceTag.TaggedResourceType;
-import com.cloud.tags.dao.ResourceTagDao;
-import com.cloud.tags.dao.ResourceTagsDaoImpl;
-import com.cloud.user.Account;
-
-import com.cloud.utils.db.Attribute;
-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.Func;
-import com.cloud.utils.db.Transaction;
-import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.vm.NicVO;
-import com.cloud.vm.UserVmVO;
-import com.cloud.vm.VirtualMachine;
-import com.cloud.vm.VirtualMachine.State;
-import com.cloud.vm.dao.UserVmData.NicData;
-import com.cloud.vm.dao.UserVmData.SecurityGroupData;
-
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.vm.dao;
+
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.configuration.Resource;
+import com.cloud.server.ResourceTag.TaggedResourceType;
+import com.cloud.tags.dao.ResourceTagDao;
+import com.cloud.tags.dao.ResourceTagsDaoImpl;
+import com.cloud.user.Account;
+
+import com.cloud.utils.db.Attribute;
+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.Func;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.vm.NicVO;
+import com.cloud.vm.UserVmVO;
+import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.VirtualMachine.State;
+import com.cloud.vm.dao.UserVmData.NicData;
+import com.cloud.vm.dao.UserVmData.SecurityGroupData;
+
 
 @Local(value={UserVmDao.class})
 public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements 
UserVmDao {
@@ -73,14 +73,14 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, 
Long> implements Use
     protected SearchBuilder<UserVmVO> DestroySearch;
     protected SearchBuilder<UserVmVO> AccountDataCenterVirtualSearch;
     protected GenericSearchBuilder<UserVmVO, Long> CountByAccountPod;
-    protected GenericSearchBuilder<UserVmVO, Long> CountByAccount;
-    protected GenericSearchBuilder<UserVmVO, Long> PodsHavingVmsForAccount;
-
-    protected SearchBuilder<UserVmVO> UserVmSearch;
-    protected SearchBuilder<UserVmVO> UserVmByIsoSearch;
-    protected Attribute _updateTimeAttr;
-    // ResourceTagsDaoImpl _tagsDao = 
ComponentLocator.inject(ResourceTagsDaoImpl.class);
-    @Inject ResourceTagDao _tagsDao;
+    protected GenericSearchBuilder<UserVmVO, Long> CountByAccount;
+    protected GenericSearchBuilder<UserVmVO, Long> PodsHavingVmsForAccount;
+
+    protected SearchBuilder<UserVmVO> UserVmSearch;
+    protected SearchBuilder<UserVmVO> UserVmByIsoSearch;
+    protected Attribute _updateTimeAttr;
+    // ResourceTagsDaoImpl _tagsDao = 
ComponentLocator.inject(ResourceTagsDaoImpl.class);
+    @Inject ResourceTagDao _tagsDao;
    
     private static final String LIST_PODS_HAVING_VMS_FOR_ACCOUNT = "SELECT 
pod_id FROM cloud.vm_instance WHERE data_center_id = ? AND account_id = ? AND 
pod_id IS NOT NULL AND (state = 'Running' OR state = 'Stopped') " +
                "GROUP BY pod_id HAVING count(id) > 0 ORDER BY count(id) DESC";
@@ -119,90 +119,90 @@ public class UserVmDaoImpl extends 
GenericDaoBase<UserVmVO, Long> implements Use
     @Inject protected NicDao _nicDao;
     
     public UserVmDaoImpl() {
-    }
-    
-    @PostConstruct
-    void init() {
-        AccountSearch = createSearchBuilder();
-        AccountSearch.and("account", AccountSearch.entity().getAccountId(), 
SearchCriteria.Op.EQ);
-        AccountSearch.done();
-        
-        HostSearch = createSearchBuilder();
-        HostSearch.and("host", HostSearch.entity().getHostId(), 
SearchCriteria.Op.EQ);
-        HostSearch.done();
-        
-        LastHostSearch = createSearchBuilder();
-        LastHostSearch.and("lastHost", 
LastHostSearch.entity().getLastHostId(), SearchCriteria.Op.EQ);
-        LastHostSearch.and("state", LastHostSearch.entity().getState(), 
SearchCriteria.Op.EQ);
-        LastHostSearch.done();
-        
-        HostUpSearch = createSearchBuilder();
-        HostUpSearch.and("host", HostUpSearch.entity().getHostId(), 
SearchCriteria.Op.EQ);
-        HostUpSearch.and("states", HostUpSearch.entity().getState(), 
SearchCriteria.Op.NIN);
-        HostUpSearch.done();
-        
-        HostRunningSearch = createSearchBuilder();
-        HostRunningSearch.and("host", HostRunningSearch.entity().getHostId(), 
SearchCriteria.Op.EQ);
-        HostRunningSearch.and("state", HostRunningSearch.entity().getState(), 
SearchCriteria.Op.EQ);
-        HostRunningSearch.done();
-        
-        AccountPodSearch = createSearchBuilder();
-        AccountPodSearch.and("account", 
AccountPodSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
-        AccountPodSearch.and("pod", 
AccountPodSearch.entity().getPodIdToDeployIn(), SearchCriteria.Op.EQ);
-        AccountPodSearch.done();
-
-        AccountDataCenterSearch = createSearchBuilder();
-        AccountDataCenterSearch.and("account", 
AccountDataCenterSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
-        AccountDataCenterSearch.and("dc", 
AccountDataCenterSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
-        AccountDataCenterSearch.done();
-
-        StateChangeSearch = createSearchBuilder();
-        StateChangeSearch.and("id", StateChangeSearch.entity().getId(), 
SearchCriteria.Op.EQ);
-        StateChangeSearch.and("states", StateChangeSearch.entity().getState(), 
SearchCriteria.Op.EQ);
-        StateChangeSearch.and("host", StateChangeSearch.entity().getHostId(), 
SearchCriteria.Op.EQ);
-        StateChangeSearch.and("update", 
StateChangeSearch.entity().getUpdated(), SearchCriteria.Op.EQ);
-        StateChangeSearch.done();
-        
-        DestroySearch = createSearchBuilder();
-        DestroySearch.and("state", DestroySearch.entity().getState(), 
SearchCriteria.Op.IN);
-        DestroySearch.and("updateTime", 
DestroySearch.entity().getUpdateTime(), SearchCriteria.Op.LT);
-        DestroySearch.done();
-
-        AccountHostSearch = createSearchBuilder();
-        AccountHostSearch.and("accountId", 
AccountHostSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
-        AccountHostSearch.and("hostId", 
AccountHostSearch.entity().getHostId(), SearchCriteria.Op.EQ);
-        AccountHostSearch.done();
-
-        CountByAccountPod = createSearchBuilder(Long.class);
-        CountByAccountPod.select(null, Func.COUNT, null);
-        CountByAccountPod.and("account", 
CountByAccountPod.entity().getAccountId(), SearchCriteria.Op.EQ);
-        CountByAccountPod.and("pod", 
CountByAccountPod.entity().getPodIdToDeployIn(), SearchCriteria.Op.EQ);
-        CountByAccountPod.done();
-
-        CountByAccount = createSearchBuilder(Long.class);
-        CountByAccount.select(null, Func.COUNT, null);
-        CountByAccount.and("account", CountByAccount.entity().getAccountId(), 
SearchCriteria.Op.EQ);
-        CountByAccount.and("type", CountByAccount.entity().getType(), 
SearchCriteria.Op.EQ);
-        CountByAccount.and("state", CountByAccount.entity().getState(), 
SearchCriteria.Op.NIN);        
-        CountByAccount.done();
-        
-        
-        SearchBuilder<NicVO> nicSearch = _nicDao.createSearchBuilder();
-        nicSearch.and("networkId", nicSearch.entity().getNetworkId(), 
SearchCriteria.Op.EQ);
-        nicSearch.and("ip4Address", nicSearch.entity().getIp4Address(), 
SearchCriteria.Op.NNULL);
-
-        AccountDataCenterVirtualSearch = createSearchBuilder();
-        AccountDataCenterVirtualSearch.and("account", 
AccountDataCenterVirtualSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
-        AccountDataCenterVirtualSearch.and("dc", 
AccountDataCenterVirtualSearch.entity().getDataCenterId(), 
SearchCriteria.Op.EQ);
-        AccountDataCenterVirtualSearch.join("nicSearch", nicSearch, 
AccountDataCenterVirtualSearch.entity().getId(), 
nicSearch.entity().getInstanceId(), JoinBuilder.JoinType.INNER);
-        AccountDataCenterVirtualSearch.done();
-
-        UserVmByIsoSearch = createSearchBuilder();
-        UserVmByIsoSearch.and("isoId", UserVmByIsoSearch.entity().getIsoId(), 
SearchCriteria.Op.EQ);
-        UserVmByIsoSearch.done();
-
-        _updateTimeAttr = _allAttributes.get("updateTime");
-        assert _updateTimeAttr != null : "Couldn't get this updateTime 
attribute";
+    }
+    
+    @PostConstruct
+    void init() {
+        AccountSearch = createSearchBuilder();
+        AccountSearch.and("account", AccountSearch.entity().getAccountId(), 
SearchCriteria.Op.EQ);
+        AccountSearch.done();
+        
+        HostSearch = createSearchBuilder();
+        HostSearch.and("host", HostSearch.entity().getHostId(), 
SearchCriteria.Op.EQ);
+        HostSearch.done();
+        
+        LastHostSearch = createSearchBuilder();
+        LastHostSearch.and("lastHost", 
LastHostSearch.entity().getLastHostId(), SearchCriteria.Op.EQ);
+        LastHostSearch.and("state", LastHostSearch.entity().getState(), 
SearchCriteria.Op.EQ);
+        LastHostSearch.done();
+        
+        HostUpSearch = createSearchBuilder();
+        HostUpSearch.and("host", HostUpSearch.entity().getHostId(), 
SearchCriteria.Op.EQ);
+        HostUpSearch.and("states", HostUpSearch.entity().getState(), 
SearchCriteria.Op.NIN);
+        HostUpSearch.done();
+        
+        HostRunningSearch = createSearchBuilder();
+        HostRunningSearch.and("host", HostRunningSearch.entity().getHostId(), 
SearchCriteria.Op.EQ);
+        HostRunningSearch.and("state", HostRunningSearch.entity().getState(), 
SearchCriteria.Op.EQ);
+        HostRunningSearch.done();
+        
+        AccountPodSearch = createSearchBuilder();
+        AccountPodSearch.and("account", 
AccountPodSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AccountPodSearch.and("pod", 
AccountPodSearch.entity().getPodIdToDeployIn(), SearchCriteria.Op.EQ);
+        AccountPodSearch.done();
+
+        AccountDataCenterSearch = createSearchBuilder();
+        AccountDataCenterSearch.and("account", 
AccountDataCenterSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AccountDataCenterSearch.and("dc", 
AccountDataCenterSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        AccountDataCenterSearch.done();
+
+        StateChangeSearch = createSearchBuilder();
+        StateChangeSearch.and("id", StateChangeSearch.entity().getId(), 
SearchCriteria.Op.EQ);
+        StateChangeSearch.and("states", StateChangeSearch.entity().getState(), 
SearchCriteria.Op.EQ);
+        StateChangeSearch.and("host", StateChangeSearch.entity().getHostId(), 
SearchCriteria.Op.EQ);
+        StateChangeSearch.and("update", 
StateChangeSearch.entity().getUpdated(), SearchCriteria.Op.EQ);
+        StateChangeSearch.done();
+        
+        DestroySearch = createSearchBuilder();
+        DestroySearch.and("state", DestroySearch.entity().getState(), 
SearchCriteria.Op.IN);
+        DestroySearch.and("updateTime", 
DestroySearch.entity().getUpdateTime(), SearchCriteria.Op.LT);
+        DestroySearch.done();
+
+        AccountHostSearch = createSearchBuilder();
+        AccountHostSearch.and("accountId", 
AccountHostSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AccountHostSearch.and("hostId", 
AccountHostSearch.entity().getHostId(), SearchCriteria.Op.EQ);
+        AccountHostSearch.done();
+
+        CountByAccountPod = createSearchBuilder(Long.class);
+        CountByAccountPod.select(null, Func.COUNT, null);
+        CountByAccountPod.and("account", 
CountByAccountPod.entity().getAccountId(), SearchCriteria.Op.EQ);
+        CountByAccountPod.and("pod", 
CountByAccountPod.entity().getPodIdToDeployIn(), SearchCriteria.Op.EQ);
+        CountByAccountPod.done();
+
+        CountByAccount = createSearchBuilder(Long.class);
+        CountByAccount.select(null, Func.COUNT, null);
+        CountByAccount.and("account", CountByAccount.entity().getAccountId(), 
SearchCriteria.Op.EQ);
+        CountByAccount.and("type", CountByAccount.entity().getType(), 
SearchCriteria.Op.EQ);
+        CountByAccount.and("state", CountByAccount.entity().getState(), 
SearchCriteria.Op.NIN);        
+        CountByAccount.done();
+        
+        
+        SearchBuilder<NicVO> nicSearch = _nicDao.createSearchBuilder();
+        nicSearch.and("networkId", nicSearch.entity().getNetworkId(), 
SearchCriteria.Op.EQ);
+        nicSearch.and("ip4Address", nicSearch.entity().getIp4Address(), 
SearchCriteria.Op.NNULL);
+
+        AccountDataCenterVirtualSearch = createSearchBuilder();
+        AccountDataCenterVirtualSearch.and("account", 
AccountDataCenterVirtualSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AccountDataCenterVirtualSearch.and("dc", 
AccountDataCenterVirtualSearch.entity().getDataCenterId(), 
SearchCriteria.Op.EQ);
+        AccountDataCenterVirtualSearch.join("nicSearch", nicSearch, 
AccountDataCenterVirtualSearch.entity().getId(), 
nicSearch.entity().getInstanceId(), JoinBuilder.JoinType.INNER);
+        AccountDataCenterVirtualSearch.done();
+
+        UserVmByIsoSearch = createSearchBuilder();
+        UserVmByIsoSearch.and("isoId", UserVmByIsoSearch.entity().getIsoId(), 
SearchCriteria.Op.EQ);
+        UserVmByIsoSearch.done();
+
+        _updateTimeAttr = _allAttributes.get("updateTime");
+        assert _updateTimeAttr != null : "Couldn't get this updateTime 
attribute";
     }
     
     @Override
@@ -224,10 +224,11 @@ public class UserVmDaoImpl extends 
GenericDaoBase<UserVmVO, Long> implements Use
     }
     
     @Override
-    public void updateVM(long id, String displayName, boolean enable, Long 
osTypeId, String userData) {
+    public void updateVM(long id, String displayName, boolean enable, Long 
osTypeId, String userData, boolean isDisplayVmEnabled) {
         UserVmVO vo = createForUpdate();
         vo.setDisplayName(displayName);
         vo.setHaEnabled(enable);
+        vo.setDisplayVm(isDisplayVmEnabled);
         vo.setGuestOSId(osTypeId);
         vo.setUserData(userData);
         update(id, vo);
@@ -253,20 +254,20 @@ public class UserVmDaoImpl extends 
GenericDaoBase<UserVmVO, Long> implements Use
     public List<UserVmVO> listByHostId(Long id) {
         SearchCriteria<UserVmVO> sc = HostSearch.create();
         sc.setParameters("host", id);
-
-        return listBy(sc);
-    }
-
-    @Override
-    public List<UserVmVO> listByIsoId(Long isoId) {
-        SearchCriteria<UserVmVO> sc = UserVmByIsoSearch.create();
-        sc.setParameters("isoId", isoId);
-        return listBy(sc);
-    }
-
-    @Override
-    public List<UserVmVO> listUpByHostId(Long hostId) {
-        SearchCriteria<UserVmVO> sc = HostUpSearch.create();
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<UserVmVO> listByIsoId(Long isoId) {
+        SearchCriteria<UserVmVO> sc = UserVmByIsoSearch.create();
+        sc.setParameters("isoId", isoId);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<UserVmVO> listUpByHostId(Long hostId) {
+        SearchCriteria<UserVmVO> sc = HostUpSearch.create();
         sc.setParameters("host", hostId);
         sc.setParameters("states", new Object[] {State.Destroyed, 
State.Stopped, State.Expunging});
         return listBy(sc);
@@ -297,9 +298,9 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, 
Long> implements Use
         if (UserVmSearch == null) {
             SearchBuilder<NicVO> nicSearch = _nicDao.createSearchBuilder();
             nicSearch.and("networkId", nicSearch.entity().getNetworkId(), 
SearchCriteria.Op.EQ);
-            nicSearch.and().op("ip4Address", 
nicSearch.entity().getIp4Address(), SearchCriteria.Op.NNULL);
-            nicSearch.or("ip6Address", nicSearch.entity().getIp6Address(), 
SearchCriteria.Op.NNULL);
-            nicSearch.cp();
+            nicSearch.and().op("ip4Address", 
nicSearch.entity().getIp4Address(), SearchCriteria.Op.NNULL);
+            nicSearch.or("ip6Address", nicSearch.entity().getIp6Address(), 
SearchCriteria.Op.NNULL);
+            nicSearch.cp();
 
             UserVmSearch = createSearchBuilder();
             UserVmSearch.and("states", UserVmSearch.entity().getState(), 
SearchCriteria.Op.IN);
@@ -571,15 +572,15 @@ public class UserVmDaoImpl extends 
GenericDaoBase<UserVmVO, Long> implements Use
                sc.setParameters("state", new Object[] {State.Destroyed, 
State.Error, State.Expunging});
         return customSearch(sc, null).get(0);
     }
-    
-    @Override
-    public boolean remove(Long id) {
-        Transaction txn = Transaction.currentTxn();
-        txn.start();
-        _tagsDao.removeByIdAndType(id, TaggedResourceType.UserVm);
-        boolean result = super.remove(id);
-        txn.commit();
-        return result;
+    
+    @Override
+    public boolean remove(Long id) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        _tagsDao.removeByIdAndType(id, TaggedResourceType.UserVm);
+        boolean result = super.remove(id);
+        txn.commit();
+        return result;
     }
     
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3958cda/server/test/com/cloud/network/MockNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/MockNetworkManagerImpl.java 
b/server/test/com/cloud/network/MockNetworkManagerImpl.java
index 6da48ec..a8c9fd7 100755
--- a/server/test/com/cloud/network/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/network/MockNetworkManagerImpl.java
@@ -23,11 +23,11 @@ import java.util.Set;
 import javax.ejb.Local;
 import javax.naming.ConfigurationException;
 
+import com.cloud.exception.*;
+import com.cloud.vm.*;
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import 
org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
-import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
-import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
-import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
+import org.apache.cloudstack.api.command.user.network.*;
 import org.springframework.stereotype.Component;
 import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
 
@@ -37,12 +37,6 @@ import com.cloud.dc.Vlan.VlanType;
 import com.cloud.deploy.DataCenterDeployment;
 import com.cloud.deploy.DeployDestination;
 import com.cloud.deploy.DeploymentPlan;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientAddressCapacityException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.network.Network.Provider;
 import com.cloud.network.Network.Service;
 import com.cloud.network.Networks.TrafficType;
@@ -62,17 +56,7 @@ import com.cloud.offerings.NetworkOfferingVO;
 import com.cloud.user.Account;
 import com.cloud.user.User;
 import com.cloud.utils.Pair;
-import com.cloud.utils.component.Manager;
 import com.cloud.utils.component.ManagerBase;
-import com.cloud.vm.Nic;
-import com.cloud.vm.NicProfile;
-import com.cloud.vm.NicSecondaryIp;
-import com.cloud.vm.NicVO;
-import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VMInstanceVO;
-import com.cloud.vm.VirtualMachine;
-import com.cloud.vm.VirtualMachineProfile;
-import com.cloud.vm.VirtualMachineProfileImpl;
 
 @Component
 @Local(value = { NetworkManager.class, NetworkService.class })
@@ -185,7 +169,7 @@ public class MockNetworkManagerImpl extends ManagerBase 
implements NetworkManage
 
     @Override
     public List<NetworkVO> setupNetwork(Account owner, NetworkOffering 
offering, Network predefined, DeploymentPlan plan, String name, String 
displayText, boolean errorIfAlreadySetup, Long domainId,
-            ACLType aclType, Boolean subdomainAccess, Long vpcId) throws 
ConcurrentOperationException {
+            ACLType aclType, Boolean subdomainAccess, Long vpcId, Boolean 
isDisplayNetworkEnabled) throws ConcurrentOperationException {
         // TODO Auto-generated method stub
         return null;
     }
@@ -256,7 +240,7 @@ public class MockNetworkManagerImpl extends ManagerBase 
implements NetworkManage
 
     @Override
     public Network createGuestNetwork(long networkOfferingId, String name, 
String displayText, String gateway, String cidr, String vlanId, String 
networkDomain, Account owner, Long domainId,
-            PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, 
Boolean subdomainAccess, Long vpcId, String gatewayv6, String cidrv6) throws 
ConcurrentOperationException, InsufficientCapacityException, 
ResourceAllocationException {
+                                      PhysicalNetwork physicalNetwork, long 
zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String gatewayv6, 
String cidrv6, Boolean displayNetworkEnabled) throws 
ConcurrentOperationException, InsufficientCapacityException, 
ResourceAllocationException {
         // TODO Auto-generated method stub
         return null;
     }
@@ -573,7 +557,7 @@ public class MockNetworkManagerImpl extends ManagerBase 
implements NetworkManage
      */
     @Override
     public Network updateGuestNetwork(long networkId, String name, String 
displayText, Account callerAccount,
-            User callerUser, String domainSuffix, Long networkOfferingId, 
Boolean changeCidr, String guestVmCidr) {
+                                      User callerUser, String domainSuffix, 
Long networkOfferingId, Boolean changeCidr, String guestVmCidr, Boolean 
displayNetwork) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -888,4 +872,23 @@ public class MockNetworkManagerImpl extends ManagerBase 
implements NetworkManage
         // TODO Auto-generated method stub
         return null;
     }
+
+
+    @Override
+    public void addNicDetail(AddNicDetailCmd cmd){
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNicDetail(UpdateNicDetailCmd cmd){
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void removeNicDetail(RemoveNicDetailCmd removeNicDetailCmd) {
+        //To change body of implemented methods use File | Settings | File 
Templates.
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3958cda/server/test/com/cloud/vm/MockUserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/MockUserVmManagerImpl.java 
b/server/test/com/cloud/vm/MockUserVmManagerImpl.java
index dd8dd83..040a7c4 100644
--- a/server/test/com/cloud/vm/MockUserVmManagerImpl.java
+++ b/server/test/com/cloud/vm/MockUserVmManagerImpl.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import javax.ejb.Local;
 import javax.naming.ConfigurationException;
 
+import com.cloud.hypervisor.Hypervisor;
 import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
 import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
 import org.apache.cloudstack.api.command.user.vm.*;
@@ -273,6 +274,21 @@ public class MockUserVmManagerImpl extends ManagerBase 
implements UserVmManager,
     }
 
     @Override
+    public UserVm createBasicSecurityGroupVirtualMachine(DataCenter 
dataCenter, ServiceOffering serviceOffering, VirtualMachineTemplate 
virtualMachineTemplate, List<Long> longs, Account account, String s, String s2, 
Long aLong, Long aLong2, String s3, HypervisorType hypervisorType, String s4, 
String s5, Map<Long, IpAddresses> longIpAddressesMap, IpAddresses ipAddresses, 
Boolean aBoolean, String s6) throws InsufficientCapacityException, 
ConcurrentOperationException, ResourceUnavailableException, 
StorageUnavailableException, ResourceAllocationException {
+        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+    }
+
+    @Override
+    public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter 
dataCenter, ServiceOffering serviceOffering, VirtualMachineTemplate 
virtualMachineTemplate, List<Long> longs, List<Long> longs2, Account account, 
String s, String s2, Long aLong, Long aLong2, String s3, HypervisorType 
hypervisorType, String s4, String s5, Map<Long, IpAddresses> 
longIpAddressesMap, IpAddresses ipAddresses, Boolean aBoolean, String s6) 
throws InsufficientCapacityException, ConcurrentOperationException, 
ResourceUnavailableException, StorageUnavailableException, 
ResourceAllocationException {
+        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+    }
+
+    @Override
+    public UserVm createAdvancedVirtualMachine(DataCenter dataCenter, 
ServiceOffering serviceOffering, VirtualMachineTemplate virtualMachineTemplate, 
List<Long> longs, Account account, String s, String s2, Long aLong, Long 
aLong2, String s3, HypervisorType hypervisorType, String s4, String s5, 
Map<Long, IpAddresses> longIpAddressesMap, IpAddresses ipAddresses, Boolean 
aBoolean, String s6) throws InsufficientCapacityException, 
ConcurrentOperationException, ResourceUnavailableException, 
StorageUnavailableException, ResourceAllocationException {
+        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+    }
+
+    @Override
     public UserVm startVirtualMachine(DeployVMCmd cmd) throws 
InsufficientCapacityException, ConcurrentOperationException, 
ResourceUnavailableException {
         // TODO Auto-generated method stub
         return null;
@@ -328,32 +344,6 @@ public class MockUserVmManagerImpl extends ManagerBase 
implements UserVmManager,
     }
 
     @Override
-    public UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, 
ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> 
securityGroupIdList, Account owner,
-            String hostName, String displayName, Long diskOfferingId, Long 
diskSize, String group, HypervisorType hypervisor, String userData, String 
sshKeyPair, Map<Long, IpAddresses> requestedIps,
-            IpAddresses defaultIp, String keyboard) throws 
InsufficientCapacityException, ConcurrentOperationException, 
ResourceUnavailableException, StorageUnavailableException,
-            ResourceAllocationException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, 
ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> 
networkIdList,
-            List<Long> securityGroupIdList, Account owner, String hostName, 
String displayName, Long diskOfferingId, Long diskSize, String group, 
HypervisorType hypervisor, String userData,
-            String sshKeyPair, Map<Long, IpAddresses> requestedIps, 
IpAddresses defaultIps, String keyboard) throws InsufficientCapacityException, 
ConcurrentOperationException, ResourceUnavailableException,
-            StorageUnavailableException, ResourceAllocationException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public UserVm createAdvancedVirtualMachine(DataCenter zone, 
ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> 
networkIdList, Account owner, String hostName,
-            String displayName, Long diskOfferingId, Long diskSize, String 
group, HypervisorType hypervisor, String userData, String sshKeyPair, Map<Long, 
IpAddresses> requestedIps, IpAddresses defaultIps,
-            String keyboard) throws InsufficientCapacityException, 
ConcurrentOperationException, ResourceUnavailableException, 
StorageUnavailableException, ResourceAllocationException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
     public VirtualMachine migrateVirtualMachine(Long vmId, Host 
destinationHost) throws ResourceUnavailableException, 
ConcurrentOperationException, ManagementServerException,
     VirtualMachineMigrationException {
         // TODO Auto-generated method stub

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3958cda/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java 
b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
index d96e831..f7e3d6c 100644
--- a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
@@ -72,13 +72,11 @@ import com.cloud.offering.NetworkOffering;
 import com.cloud.offering.NetworkOffering.Availability;
 import com.cloud.offering.ServiceOffering;
 import com.cloud.offerings.NetworkOfferingVO;
-import com.cloud.offerings.dao.NetworkOfferingDao;
 import com.cloud.offerings.dao.NetworkOfferingDaoImpl;
 import com.cloud.org.Grouping.AllocationState;
 import com.cloud.service.ServiceOfferingVO;
 import com.cloud.storage.DiskOfferingVO;
 import com.cloud.user.Account;
-import com.cloud.utils.component.Manager;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.vm.VirtualMachine.Type;
 
@@ -508,7 +506,7 @@ public class MockConfigurationManagerImpl extends 
ManagerBase implements Configu
      */
     @Override
     public Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long 
physicalNetworkId, boolean forVirtualNetwork, Long podId, String startIP, 
String endIP, String vlanGateway, String vlanNetmask, String vlanId,
-            Account vlanOwner, String startIPv6, String endIPv6, String 
vlanGatewayv6, String vlanCidrv6) throws InsufficientCapacityException, 
ConcurrentOperationException, InvalidParameterValueException {
+                                           Account vlanOwner, String 
startIPv6, String endIPv6, String vlanGatewayv6, String vlanCidrv6) throws 
InsufficientCapacityException, ConcurrentOperationException, 
InvalidParameterValueException {
         // TODO Auto-generated method stub
         return null;
     }
@@ -595,10 +593,10 @@ public class MockConfigurationManagerImpl extends 
ManagerBase implements Configu
     }
 
     /* (non-Javadoc)
-     * @see 
com.cloud.configuration.ConfigurationManager#createDiskOffering(java.lang.Long, 
java.lang.String, java.lang.String, java.lang.Long, java.lang.String, boolean, 
boolean)
+     * @see 
com.cloud.configuration.ConfigurationManager#createDiskOffering(java.lang.Long, 
java.lang.String, java.lang.String, java.lang.Long, java.lang.String, boolean, 
boolean, boolean)
      */
     @Override
-    public DiskOfferingVO createDiskOffering(Long domainId, String name, 
String description, Long numGibibytes, String tags, boolean isCustomized, 
boolean localStorageRequired) {
+    public DiskOfferingVO createDiskOffering(Long domainId, String name, 
String description, Long numGibibytes, String tags, boolean isCustomized, 
boolean localStorageRequired, boolean isDisplayOfferingEnabled) {
         // TODO Auto-generated method stub
         return null;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3958cda/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java 
b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
index ead0051..d8f6740 100644
--- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
@@ -26,9 +26,7 @@ import javax.naming.ConfigurationException;
 
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import 
org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
-import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
-import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
-import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
+import org.apache.cloudstack.api.command.user.network.*;
 import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
@@ -58,7 +56,6 @@ import com.cloud.network.PhysicalNetwork;
 import com.cloud.network.PhysicalNetworkServiceProvider;
 import com.cloud.network.PhysicalNetworkTrafficType;
 import com.cloud.network.PublicIpAddress;
-import com.cloud.network.UserIpv6Address;
 import com.cloud.network.addr.PublicIp;
 import com.cloud.network.dao.IPAddressVO;
 import com.cloud.network.dao.NetworkServiceMapDao;
@@ -78,17 +75,14 @@ import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
 import com.cloud.user.Account;
 import com.cloud.user.User;
 import com.cloud.utils.Pair;
-import com.cloud.utils.component.Manager;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.vm.Nic;
 import com.cloud.vm.NicProfile;
-import com.cloud.vm.NicSecondaryIp;
 import com.cloud.vm.NicVO;
 import com.cloud.vm.ReservationContext;
 import com.cloud.vm.VMInstanceVO;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
-import com.cloud.vm.VirtualMachineProfileImpl;
 
 @Component
 @Local(value = { NetworkManager.class, NetworkService.class })
@@ -307,7 +301,7 @@ public class MockNetworkManagerImpl extends ManagerBase 
implements NetworkManage
      */
     @Override
     public Network updateGuestNetwork(long networkId, String name, String 
displayText, Account callerAccount,
-            User callerUser, String domainSuffix, Long networkOfferingId, 
Boolean changeCidr, String guestVmCidr) {
+                                      User callerUser, String domainSuffix, 
Long networkOfferingId, Boolean changeCidr, String guestVmCidr, Boolean 
displayNetwork) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -683,7 +677,7 @@ public class MockNetworkManagerImpl extends ManagerBase 
implements NetworkManage
     @Override
     public List<NetworkVO> setupNetwork(Account owner, NetworkOffering 
offering, Network predefined,
             DeploymentPlan plan, String name, String displayText, boolean 
errorIfAlreadySetup, Long domainId,
-            ACLType aclType, Boolean subdomainAccess, Long vpcId) throws 
ConcurrentOperationException {
+            ACLType aclType, Boolean subdomainAccess, Long vpcId, Boolean 
isNetworkDisplayEnabled) throws ConcurrentOperationException {
         // TODO Auto-generated method stub
         return null;
     }
@@ -847,8 +841,8 @@ public class MockNetworkManagerImpl extends ManagerBase 
implements NetworkManage
      */
     @Override
     public Network createGuestNetwork(long networkOfferingId, String name, 
String displayText, String gateway,
-            String cidr, String vlanId, String networkDomain, Account owner, 
Long domainId,
-            PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, 
Boolean subdomainAccess, Long vpcId, String gatewayv6, String cidrv6)
+                                      String cidr, String vlanId, String 
networkDomain, Account owner, Long domainId,
+                                      PhysicalNetwork physicalNetwork, long 
zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String gatewayv6, 
String cidrv6, Boolean displayNetworkEnabled)
             throws ConcurrentOperationException, 
InsufficientCapacityException, ResourceAllocationException {
         // TODO Auto-generated method stub
         return null;
@@ -1387,8 +1381,20 @@ public class MockNetworkManagerImpl extends ManagerBase 
implements NetworkManage
         return null;
     }
 
+    @Override
+    public void addNicDetail(AddNicDetailCmd addNicDetailCmd) {
+        //To change body of implemented methods use File | Settings | File 
Templates.
+    }
 
+    @Override
+    public void updateNicDetail(UpdateNicDetailCmd updateNicDetailCmd) {
+        //To change body of implemented methods use File | Settings | File 
Templates.
+    }
 
+    @Override
+    public void removeNicDetail(RemoveNicDetailCmd removeNicDetailCmd) {
+        //To change body of implemented methods use File | Settings | File 
Templates.
+    }
 
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3958cda/server/test/com/cloud/vpc/MockVpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockVpcManagerImpl.java 
b/server/test/com/cloud/vpc/MockVpcManagerImpl.java
index e6c6520..f6136f3 100644
--- a/server/test/com/cloud/vpc/MockVpcManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockVpcManagerImpl.java
@@ -53,7 +53,6 @@ import com.cloud.offering.NetworkOffering;
 import com.cloud.user.Account;
 import com.cloud.user.User;
 import com.cloud.utils.Pair;
-import com.cloud.utils.component.Manager;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.vm.DomainRouterVO;
 import com.cloud.vpc.dao.MockVpcDaoImpl;
@@ -390,7 +389,7 @@ public class MockVpcManagerImpl extends ManagerBase 
implements VpcManager {
      */
     @Override
     public Network createVpcGuestNetwork(long ntwkOffId, String name, String 
displayText, String gateway, String cidr, String vlanId, String networkDomain, 
Account owner, Long domainId, PhysicalNetwork pNtwk,
-            long zoneId, ACLType aclType, Boolean subdomainAccess, long vpcId, 
Account caller) throws ConcurrentOperationException, 
InsufficientCapacityException, ResourceAllocationException {
+                                         long zoneId, ACLType aclType, Boolean 
subdomainAccess, long vpcId, Account caller, Boolean displayNetworkEnabled) 
throws ConcurrentOperationException, InsufficientCapacityException, 
ResourceAllocationException {
         // TODO Auto-generated method stub
         return null;
     }
@@ -459,8 +458,8 @@ public class MockVpcManagerImpl extends ManagerBase 
implements VpcManager {
     }
 
        @Override
-       public Network updateVpcGuestNetwork(long networkId, String name,  
String displayText, Account callerAccount, User callerUser,
-                       String domainSuffix, Long ntwkOffId, Boolean 
changeCidr,        String guestVmCidr) {
+       public Network updateVpcGuestNetwork(long networkId, String name, 
String displayText, Account callerAccount, User callerUser,
+                                         String domainSuffix, Long ntwkOffId, 
Boolean changeCidr, String guestVmCidr, Boolean displayNetwork) {
                // TODO Auto-generated method stub
                return null;
        }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3958cda/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index f1e24fa..b4f6396 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -210,6 +210,58 @@ ALTER TABLE `cloud`.`external_load_balancer_devices` ADD 
COLUMN `gslb_site_publi
 
 ALTER TABLE `cloud`.`external_load_balancer_devices` ADD COLUMN 
`gslb_site_privateip` varchar(255) DEFAULT NULL COMMENT 'GSLB service Provider 
site private ip';
 
+ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `display_vm` tinyint(1) NOT NULL 
DEFAULT 1 COMMENT 'Should vm instance be displayed to the end user';
+
+ALTER TABLE `cloud`.`user_vm_details` ADD COLUMN `display_detail` tinyint(1) 
NOT NULL DEFAULT 1 COMMENT 'Should vm detail instance be displayed to the end 
user';
+
+ALTER TABLE `cloud`.`volumes` ADD COLUMN `display_volume` tinyint(1) NOT NULL 
DEFAULT 1 COMMENT 'Should volume be displayed to the end user';
+
+ALTER TABLE `cloud`.`networks` ADD COLUMN `display_network` tinyint(1) NOT 
NULL DEFAULT 1 COMMENT 'Should network be displayed to the end user';
+
+ALTER TABLE `cloud`.`nics` ADD COLUMN `display_nic` tinyint(1) NOT NULL 
DEFAULT 1 COMMENT 'Should nic be displayed to the end user';
+
+ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `display_offering` tinyint(1) 
NOT NULL DEFAULT 1 COMMENT 'Should disk offering be displayed to the end user';
+
+CREATE TABLE `cloud`.`volume_details` (
+  `id` bigint unsigned NOT NULL auto_increment,
+  `volume_id` bigint unsigned NOT NULL COMMENT 'volume id',
+  `name` varchar(255) NOT NULL,
+  `value` varchar(1024) NOT NULL,
+  `display_detail` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should detail be 
displayed to the end user',
+  PRIMARY KEY (`id`),
+  CONSTRAINT `fk_volume_details__volume_id` FOREIGN KEY 
`fk_volume_details__volume_id`(`volume_id`) REFERENCES `volumes`(`id`) ON 
DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `cloud`.`network_details` (
+  `id` bigint unsigned NOT NULL auto_increment,
+  `network_id` bigint unsigned NOT NULL COMMENT 'network id',
+  `name` varchar(255) NOT NULL,
+  `value` varchar(1024) NOT NULL,
+  `display_detail` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should detail be 
displayed to the end user',
+  PRIMARY KEY (`id`),
+  CONSTRAINT `fk_network_details__network_id` FOREIGN KEY 
`fk_network_details__network_id`(`network_id`) REFERENCES `networks`(`id`) ON 
DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `cloud`.`nic_details` (
+  `id` bigint unsigned NOT NULL auto_increment,
+  `nic_id` bigint unsigned NOT NULL COMMENT 'nic id',
+  `name` varchar(255) NOT NULL,
+  `value` varchar(1024) NOT NULL,
+  `display_detail` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should detail be 
displayed to the end user',
+  PRIMARY KEY (`id`),
+  CONSTRAINT `fk_nic_details__nic_id` FOREIGN KEY 
`fk_nic_details__nic_id`(`nic_id`) REFERENCES `nics`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `cloud`.`disk_offering_details` (
+  `id` bigint unsigned NOT NULL auto_increment,
+  `offering_id` bigint unsigned NOT NULL COMMENT 'offering id',
+  `name` varchar(255) NOT NULL,
+  `value` varchar(1024) NOT NULL,
+  `display_detail` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should detail be 
displayed to the end user',
+  PRIMARY KEY (`id`),
+  CONSTRAINT `fk_offering_details__offering_id` FOREIGN KEY 
`fk_offering_details__offering_id`(`offering_id`) REFERENCES 
`disk_offering`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
 CREATE TABLE `cloud`.`global_load_balancing_rules` (
   `id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
   `uuid` varchar(40),
@@ -390,3 +442,302 @@ CREATE VIEW `cloud`.`account_view` AS
         `cloud`.`async_job` ON async_job.instance_id = account.id
             and async_job.instance_type = 'Account'
             and async_job.job_status = 0;
+
+DROP VIEW IF EXISTS `cloud`.`disk_offering_view`;
+CREATE VIEW `cloud`.`disk_offering_view` AS
+    select
+        disk_offering.id,
+        disk_offering.uuid,
+        disk_offering.name,
+        disk_offering.display_text,
+        disk_offering.disk_size,
+        disk_offering.created,
+        disk_offering.tags,
+        disk_offering.customized,
+        disk_offering.removed,
+        disk_offering.use_local_storage,
+        disk_offering.system_use,
+        disk_offering.sort_key,
+        disk_offering.type,
+       disk_offering.display_offering,
+        domain.id domain_id,
+        domain.uuid domain_uuid,
+        domain.name domain_name,
+        domain.path domain_path
+    from
+        `cloud`.`disk_offering`
+            left join
+        `cloud`.`domain` ON disk_offering.domain_id = domain.id;
+
+DROP VIEW IF EXISTS `cloud`.`user_vm_view`;
+CREATE VIEW `cloud`.`user_vm_view` AS
+    select
+        vm_instance.id id,
+        vm_instance.name name,
+        user_vm.display_name display_name,
+        user_vm.user_data user_data,
+        account.id account_id,
+        account.uuid account_uuid,
+        account.account_name account_name,
+        account.type account_type,
+        domain.id domain_id,
+        domain.uuid domain_uuid,
+        domain.name domain_name,
+        domain.path domain_path,
+        projects.id project_id,
+        projects.uuid project_uuid,
+        projects.name project_name,
+        instance_group.id instance_group_id,
+        instance_group.uuid instance_group_uuid,
+        instance_group.name instance_group_name,
+        vm_instance.uuid uuid,
+        vm_instance.last_host_id last_host_id,
+        vm_instance.vm_type type,
+        vm_instance.vnc_password vnc_password,
+        vm_instance.limit_cpu_use limit_cpu_use,
+        vm_instance.created created,
+        vm_instance.state state,
+        vm_instance.removed removed,
+        vm_instance.ha_enabled ha_enabled,
+        vm_instance.hypervisor_type hypervisor_type,
+        vm_instance.instance_name instance_name,
+        vm_instance.guest_os_id guest_os_id,
+        vm_instance.display_vm display_vm,
+        guest_os.uuid guest_os_uuid,
+        vm_instance.pod_id pod_id,
+        host_pod_ref.uuid pod_uuid,
+        vm_instance.private_ip_address private_ip_address,
+        vm_instance.private_mac_address private_mac_address,
+        vm_instance.vm_type vm_type,
+        data_center.id data_center_id,
+        data_center.uuid data_center_uuid,
+        data_center.name data_center_name,
+        data_center.is_security_group_enabled security_group_enabled,
+        host.id host_id,
+        host.uuid host_uuid,
+        host.name host_name,
+        vm_template.id template_id,
+        vm_template.uuid template_uuid,
+        vm_template.name template_name,
+        vm_template.display_text template_display_text,
+        vm_template.enable_password password_enabled,
+        iso.id iso_id,
+        iso.uuid iso_uuid,
+        iso.name iso_name,
+        iso.display_text iso_display_text,
+        service_offering.id service_offering_id,
+        disk_offering.uuid service_offering_uuid,
+        service_offering.cpu cpu,
+        service_offering.speed speed,
+        service_offering.ram_size ram_size,
+        disk_offering.name service_offering_name,
+        storage_pool.id pool_id,
+        storage_pool.uuid pool_uuid,
+        storage_pool.pool_type pool_type,
+        volumes.id volume_id,
+        volumes.uuid volume_uuid,
+        volumes.device_id volume_device_id,
+        volumes.volume_type volume_type,
+        security_group.id security_group_id,
+        security_group.uuid security_group_uuid,
+        security_group.name security_group_name,
+        security_group.description security_group_description,
+        nics.id nic_id,
+        nics.uuid nic_uuid,
+        nics.network_id network_id,
+        nics.ip4_address ip_address,
+        nics.ip6_address ip6_address,
+        nics.ip6_gateway ip6_gateway,
+        nics.ip6_cidr ip6_cidr,
+        nics.default_nic is_default_nic,
+        nics.gateway gateway,
+        nics.netmask netmask,
+        nics.mac_address mac_address,
+        nics.broadcast_uri broadcast_uri,
+        nics.isolation_uri isolation_uri,
+        vpc.id vpc_id,
+        vpc.uuid vpc_uuid,
+        networks.uuid network_uuid,
+        networks.name network_name,
+        networks.traffic_type traffic_type,
+        networks.guest_type guest_type,
+        user_ip_address.id public_ip_id,
+        user_ip_address.uuid public_ip_uuid,
+        user_ip_address.public_ip_address public_ip_address,
+        ssh_keypairs.keypair_name keypair_name,
+        resource_tags.id tag_id,
+        resource_tags.uuid tag_uuid,
+        resource_tags.key tag_key,
+        resource_tags.value tag_value,
+        resource_tags.domain_id tag_domain_id,
+        resource_tags.account_id tag_account_id,
+        resource_tags.resource_id tag_resource_id,
+        resource_tags.resource_uuid tag_resource_uuid,
+        resource_tags.resource_type tag_resource_type,
+        resource_tags.customer tag_customer,
+        async_job.id job_id,
+        async_job.uuid job_uuid,
+        async_job.job_status job_status,
+        async_job.account_id job_account_id
+    from
+        `cloud`.`user_vm`
+            inner join
+        `cloud`.`vm_instance` ON vm_instance.id = user_vm.id
+            and vm_instance.removed is NULL
+            inner join
+        `cloud`.`account` ON vm_instance.account_id = account.id
+            inner join
+        `cloud`.`domain` ON vm_instance.domain_id = domain.id
+            left join
+        `cloud`.`guest_os` ON vm_instance.guest_os_id = guest_os.id
+            left join
+        `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id
+            left join
+        `cloud`.`projects` ON projects.project_account_id = account.id
+            left join
+        `cloud`.`instance_group_vm_map` ON vm_instance.id = 
instance_group_vm_map.instance_id
+            left join
+        `cloud`.`instance_group` ON instance_group_vm_map.group_id = 
instance_group.id
+            left join
+        `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id
+            left join
+        `cloud`.`host` ON vm_instance.host_id = host.id
+            left join
+        `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id
+            left join
+        `cloud`.`vm_template` iso ON iso.id = user_vm.iso_id
+            left join
+        `cloud`.`service_offering` ON vm_instance.service_offering_id = 
service_offering.id
+            left join
+        `cloud`.`disk_offering` ON vm_instance.service_offering_id = 
disk_offering.id
+            left join
+        `cloud`.`volumes` ON vm_instance.id = volumes.instance_id
+            left join
+        `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id
+            left join
+        `cloud`.`security_group_vm_map` ON vm_instance.id = 
security_group_vm_map.instance_id
+            left join
+        `cloud`.`security_group` ON security_group_vm_map.security_group_id = 
security_group.id
+            left join
+        `cloud`.`nics` ON vm_instance.id = nics.instance_id
+            left join
+        `cloud`.`networks` ON nics.network_id = networks.id
+            left join
+        `cloud`.`vpc` ON networks.vpc_id = vpc.id
+            left join
+        `cloud`.`user_ip_address` ON user_ip_address.vm_id = vm_instance.id
+            left join
+        `cloud`.`user_vm_details` ON user_vm_details.vm_id = vm_instance.id
+            and user_vm_details.name = 'SSH.PublicKey'
+            left join
+        `cloud`.`ssh_keypairs` ON ssh_keypairs.public_key = 
user_vm_details.value
+            left join
+        `cloud`.`resource_tags` ON resource_tags.resource_id = vm_instance.id
+            and resource_tags.resource_type = 'UserVm'
+            left join
+        `cloud`.`async_job` ON async_job.instance_id = vm_instance.id
+            and async_job.instance_type = 'VirtualMachine'
+            and async_job.job_status = 0;
+
+DROP VIEW IF EXISTS `cloud`.`volume_view`;
+CREATE VIEW `cloud`.`volume_view` AS
+    select
+        volumes.id,
+        volumes.uuid,
+        volumes.name,
+        volumes.device_id,
+        volumes.volume_type,
+        volumes.size,
+        volumes.created,
+        volumes.state,
+        volumes.attached,
+        volumes.removed,
+        volumes.pod_id,
+       volumes.display_volume,
+        account.id account_id,
+        account.uuid account_uuid,
+        account.account_name account_name,
+        account.type account_type,
+        domain.id domain_id,
+        domain.uuid domain_uuid,
+        domain.name domain_name,
+        domain.path domain_path,
+        projects.id project_id,
+        projects.uuid project_uuid,
+        projects.name project_name,
+        data_center.id data_center_id,
+        data_center.uuid data_center_uuid,
+        data_center.name data_center_name,
+        vm_instance.id vm_id,
+        vm_instance.uuid vm_uuid,
+        vm_instance.name vm_name,
+        vm_instance.state vm_state,
+        vm_instance.vm_type,
+        user_vm.display_name vm_display_name,
+        volume_host_ref.size volume_host_size,
+        volume_host_ref.created volume_host_created,
+        volume_host_ref.format,
+        volume_host_ref.download_pct,
+        volume_host_ref.download_state,
+        volume_host_ref.error_str,
+        disk_offering.id disk_offering_id,
+        disk_offering.uuid disk_offering_uuid,
+        disk_offering.name disk_offering_name,
+        disk_offering.display_text disk_offering_display_text,
+        disk_offering.use_local_storage,
+        disk_offering.system_use,
+        storage_pool.id pool_id,
+        storage_pool.uuid pool_uuid,
+        storage_pool.name pool_name,
+        cluster.hypervisor_type,
+        vm_template.id template_id,
+        vm_template.uuid template_uuid,
+        vm_template.extractable,
+        vm_template.type template_type,
+        resource_tags.id tag_id,
+        resource_tags.uuid tag_uuid,
+        resource_tags.key tag_key,
+        resource_tags.value tag_value,
+        resource_tags.domain_id tag_domain_id,
+        resource_tags.account_id tag_account_id,
+        resource_tags.resource_id tag_resource_id,
+        resource_tags.resource_uuid tag_resource_uuid,
+        resource_tags.resource_type tag_resource_type,
+        resource_tags.customer tag_customer,
+        async_job.id job_id,
+        async_job.uuid job_uuid,
+        async_job.job_status job_status,
+        async_job.account_id job_account_id
+    from
+        `cloud`.`volumes`
+            inner join
+        `cloud`.`account` ON volumes.account_id = account.id
+            inner join
+        `cloud`.`domain` ON volumes.domain_id = domain.id
+            left join
+        `cloud`.`projects` ON projects.project_account_id = account.id
+            left join
+        `cloud`.`data_center` ON volumes.data_center_id = data_center.id
+            left join
+        `cloud`.`vm_instance` ON volumes.instance_id = vm_instance.id
+            left join
+        `cloud`.`user_vm` ON user_vm.id = vm_instance.id
+            left join
+        `cloud`.`volume_host_ref` ON volumes.id = volume_host_ref.volume_id
+            and volumes.data_center_id = volume_host_ref.zone_id
+            left join
+        `cloud`.`disk_offering` ON volumes.disk_offering_id = disk_offering.id
+            left join
+        `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id
+            left join
+        `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id
+            left join
+        `cloud`.`vm_template` ON volumes.template_id = vm_template.id
+            left join
+        `cloud`.`resource_tags` ON resource_tags.resource_id = volumes.id
+            and resource_tags.resource_type = 'Volume'
+            left join
+        `cloud`.`async_job` ON async_job.instance_id = volumes.id
+            and async_job.instance_type = 'Volume'
+            and async_job.job_status = 0;
+

Reply via email to