You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ni...@apache.org on 2013/05/13 14:25:31 UTC

[01/57] [abbrv] [partial] merge master

Updated Branches:
  refs/heads/master 052c24c4d -> f84b6abde


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
new file mode 100755
index 0000000..25ae933
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
@@ -0,0 +1,1136 @@
+// 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.storage.dao;
+
+import static com.cloud.utils.StringUtils.join;
+import static com.cloud.utils.db.DbUtil.closeResources;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateEvent;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.configuration.dao.ConfigurationDao;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.domain.DomainVO;
+import com.cloud.domain.dao.DomainDao;
+import com.cloud.host.Host;
+import com.cloud.host.HostVO;
+import com.cloud.host.dao.HostDao;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.projects.Project.ListProjectResourcesCriteria;
+import com.cloud.server.ResourceTag.TaggedResourceType;
+import com.cloud.storage.Storage;
+import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.storage.Storage.TemplateType;
+import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
+import com.cloud.storage.VMTemplateVO;
+import com.cloud.storage.VMTemplateZoneVO;
+import com.cloud.tags.ResourceTagVO;
+import com.cloud.tags.dao.ResourceTagDao;
+import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
+import com.cloud.user.Account;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.Filter;
+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.SearchCriteria.Op;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.UpdateBuilder;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Component
+@Local(value={VMTemplateDao.class})
+public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implements VMTemplateDao {
+    private static final Logger s_logger = Logger.getLogger(VMTemplateDaoImpl.class);
+
+    @Inject
+    VMTemplateZoneDao _templateZoneDao;
+    @Inject
+    VMTemplateDetailsDao _templateDetailsDao;
+
+    @Inject
+    ConfigurationDao  _configDao;
+    @Inject
+    HostDao   _hostDao;
+    @Inject
+    DomainDao _domainDao;
+    @Inject
+    DataCenterDao _dcDao;
+    private final String SELECT_TEMPLATE_HOST_REF = "SELECT t.id, h.data_center_id, t.unique_name, t.name, t.public, t.featured, t.type, t.hvm, t.bits, t.url, t.format, t.created, t.account_id, " +
+    								"t.checksum, t.display_text, t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones, t.hypervisor_type FROM vm_template t";
+
+    private final String SELECT_TEMPLATE_ZONE_REF = "SELECT t.id, tzr.zone_id, t.unique_name, t.name, t.public, t.featured, t.type, t.hvm, t.bits, t.url, t.format, t.created, t.account_id, " +
+									"t.checksum, t.display_text, t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones, t.hypervisor_type FROM vm_template t INNER JOIN template_zone_ref tzr on (t.id = tzr.template_id) ";
+
+    private final String SELECT_TEMPLATE_SWIFT_REF = "SELECT t.id, t.unique_name, t.name, t.public, t.featured, t.type, t.hvm, t.bits, t.url, t.format, t.created, t.account_id, "
+            + "t.checksum, t.display_text, t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones, t.hypervisor_type FROM vm_template t";
+
+    private final String SELECT_TEMPLATE_S3_REF = "SELECT t.id, t.unique_name, t.name, t.public, t.featured, t.type, t.hvm, t.bits, t.url, t.format, t.created, t.account_id, "
+            + "t.checksum, t.display_text, t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones, t.hypervisor_type FROM vm_template t";
+
+    private static final String SELECT_S3_CANDIDATE_TEMPLATES = "SELECT t.id, t.unique_name, t.name, t.public, t.featured, " +
+        "t.type, t.hvm, t.bits, t.url, t.format, t.created, t.account_id, t.checksum, t.display_text, " +
+        "t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones, t.hypervisor_type " +
+        "FROM vm_template t JOIN template_host_ref r ON t.id=r.template_id JOIN host h ON h.id=r.host_id " +
+        "WHERE t.hypervisor_type IN (SELECT hypervisor_type FROM host) AND r.download_state = 'DOWNLOADED' AND " +
+        "r.template_id NOT IN (SELECT template_id FROM template_s3_ref) AND r.destroyed = 0 AND t.type <> 'PERHOST'";
+
+    protected SearchBuilder<VMTemplateVO> TemplateNameSearch;
+    protected SearchBuilder<VMTemplateVO> UniqueNameSearch;
+    protected SearchBuilder<VMTemplateVO> tmpltTypeSearch;
+    protected SearchBuilder<VMTemplateVO> tmpltTypeHyperSearch;
+    protected SearchBuilder<VMTemplateVO> tmpltTypeHyperSearch2;
+
+    protected SearchBuilder<VMTemplateVO> AccountIdSearch;
+    protected SearchBuilder<VMTemplateVO> NameSearch;
+    protected SearchBuilder<VMTemplateVO> TmpltsInZoneSearch;
+    private SearchBuilder<VMTemplateVO> PublicSearch;
+    private SearchBuilder<VMTemplateVO> NameAccountIdSearch;
+    private SearchBuilder<VMTemplateVO> PublicIsoSearch;
+    private SearchBuilder<VMTemplateVO> UserIsoSearch;
+    private GenericSearchBuilder<VMTemplateVO, Long> CountTemplatesByAccount;
+    private SearchBuilder<VMTemplateVO> updateStateSearch;
+
+    @Inject ResourceTagDao _tagsDao;
+
+
+    private String routerTmpltName;
+    private String consoleProxyTmpltName;
+
+    public VMTemplateDaoImpl() {
+    }
+
+    @Override
+    public List<VMTemplateVO> listByPublic() {
+	SearchCriteria<VMTemplateVO> sc = PublicSearch.create();
+    	sc.setParameters("public", 1);
+	    return listBy(sc);
+	}
+
+	@Override
+	public VMTemplateVO findByName(String templateName) {
+		SearchCriteria<VMTemplateVO> sc = UniqueNameSearch.create();
+		sc.setParameters("uniqueName", templateName);
+		return findOneIncludingRemovedBy(sc);
+	}
+
+	@Override
+	public VMTemplateVO findByTemplateName(String templateName) {
+		SearchCriteria<VMTemplateVO> sc = NameSearch.create();
+		sc.setParameters("name", templateName);
+		return findOneIncludingRemovedBy(sc);
+	}
+
+    @Override
+    public List<VMTemplateVO> publicIsoSearch(Boolean bootable, boolean listRemoved, Map<String, String> tags){
+
+        SearchBuilder<VMTemplateVO> sb = null;
+        if (tags == null || tags.isEmpty()) {
+            sb = PublicIsoSearch;
+        } else {
+            sb = createSearchBuilder();
+            sb.and("public", sb.entity().isPublicTemplate(), SearchCriteria.Op.EQ);
+            sb.and("format", sb.entity().getFormat(), SearchCriteria.Op.EQ);
+            sb.and("type", sb.entity().getTemplateType(), SearchCriteria.Op.EQ);
+            sb.and("bootable", sb.entity().isBootable(), SearchCriteria.Op.EQ);
+            sb.and("removed", sb.entity().getRemoved(), SearchCriteria.Op.EQ);
+
+            SearchBuilder<ResourceTagVO> tagSearch = _tagsDao.createSearchBuilder();
+            for (int count=0; count < tags.size(); count++) {
+                tagSearch.or().op("key" + String.valueOf(count), tagSearch.entity().getKey(), SearchCriteria.Op.EQ);
+                tagSearch.and("value" + String.valueOf(count), tagSearch.entity().getValue(), SearchCriteria.Op.EQ);
+                tagSearch.cp();
+            }
+            tagSearch.and("resourceType", tagSearch.entity().getResourceType(), SearchCriteria.Op.EQ);
+            sb.groupBy(sb.entity().getId());
+            sb.join("tagSearch", tagSearch, sb.entity().getId(), tagSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER);
+        }
+
+        SearchCriteria<VMTemplateVO> sc = sb.create();
+
+    	sc.setParameters("public", 1);
+    	sc.setParameters("format", "ISO");
+    	sc.setParameters("type", TemplateType.PERHOST.toString());
+    	if (bootable != null) {
+    	    sc.setParameters("bootable", bootable);
+    	}
+
+    	if (!listRemoved) {
+    		sc.setParameters("removed", (Object)null);
+    	}
+
+    	if (tags != null && !tags.isEmpty()) {
+            int count = 0;
+            sc.setJoinParameters("tagSearch", "resourceType", TaggedResourceType.ISO.toString());
+            for (String key : tags.keySet()) {
+                sc.setJoinParameters("tagSearch", "key" + String.valueOf(count), key);
+                sc.setJoinParameters("tagSearch", "value" + String.valueOf(count), tags.get(key));
+                count++;
+            }
+        }
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<VMTemplateVO> userIsoSearch(boolean listRemoved){
+
+        SearchBuilder<VMTemplateVO> sb = null;
+        sb = UserIsoSearch;
+        SearchCriteria<VMTemplateVO> sc = sb.create();
+
+        sc.setParameters("format", Storage.ImageFormat.ISO);
+        sc.setParameters("type", TemplateType.USER.toString());
+
+        if (!listRemoved) {
+            sc.setParameters("removed", (Object)null);
+        }
+
+        return listBy(sc);
+    }
+	@Override
+	public List<VMTemplateVO> listAllSystemVMTemplates() {
+		SearchCriteria<VMTemplateVO> sc = tmpltTypeSearch.create();
+		sc.setParameters("templateType", Storage.TemplateType.SYSTEM);
+
+		Filter filter = new Filter(VMTemplateVO.class, "id", false, null, null);
+		return listBy(sc, filter);
+	}
+
+    @Override
+    public List<Long> listPrivateTemplatesByHost(Long hostId) {
+
+        String sql = "select * from template_host_ref as thr INNER JOIN vm_template as t ON t.id=thr.template_id "
+            + "where thr.host_id=? and t.public=0 and t.featured=0 and t.type='USER' and t.removed is NULL";
+
+        List<Long> l = new ArrayList<Long>();
+
+        Transaction txn = Transaction.currentTxn();
+
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql);
+            pstmt.setLong(1, hostId);
+            ResultSet rs = pstmt.executeQuery();
+            while (rs.next()) {
+                l.add(rs.getLong(1));
+            }
+        } catch (SQLException e) {
+        } catch (Throwable e) {
+        }
+        return l;
+    }
+
+	@Override
+	public List<VMTemplateVO> listReadyTemplates() {
+		SearchCriteria<VMTemplateVO> sc = createSearchCriteria();
+		sc.addAnd("ready", SearchCriteria.Op.EQ, true);
+		sc.addAnd("format", SearchCriteria.Op.NEQ, Storage.ImageFormat.ISO);
+		return listIncludingRemovedBy(sc);
+	}
+
+	@Override
+	public List<VMTemplateVO> findIsosByIdAndPath(Long domainId, Long accountId, String path) {
+		SearchCriteria<VMTemplateVO> sc = createSearchCriteria();
+		sc.addAnd("iso", SearchCriteria.Op.EQ, true);
+		if (domainId != null) {
+            sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId);
+        }
+		if (accountId != null) {
+            sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
+        }
+		if (path != null) {
+            sc.addAnd("path", SearchCriteria.Op.EQ, path);
+        }
+		return listIncludingRemovedBy(sc);
+	}
+
+	@Override
+	public List<VMTemplateVO> listByAccountId(long accountId) {
+        SearchCriteria<VMTemplateVO> sc = AccountIdSearch.create();
+        sc.setParameters("accountId", accountId);
+        return listBy(sc);
+	}
+
+	@Override
+    public List<VMTemplateVO> listByHypervisorType(List<HypervisorType> hyperTypes) {
+		SearchCriteria<VMTemplateVO> sc = createSearchCriteria();
+        hyperTypes.add(HypervisorType.None);
+        sc.addAnd("hypervisorType", SearchCriteria.Op.IN, hyperTypes.toArray());
+		return listBy(sc);
+	}
+
+	@Override
+	public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+		boolean result = super.configure(name, params);
+
+	    PublicSearch = createSearchBuilder();
+	    PublicSearch.and("public", PublicSearch.entity().isPublicTemplate(), SearchCriteria.Op.EQ);
+
+		routerTmpltName = (String)params.get("routing.uniquename");
+
+		s_logger.debug("Found parameter routing unique name " + routerTmpltName);
+		if (routerTmpltName==null) {
+			routerTmpltName="routing";
+		}
+
+		consoleProxyTmpltName = (String)params.get("consoleproxy.uniquename");
+		if(consoleProxyTmpltName == null) {
+            consoleProxyTmpltName = "routing";
+        }
+		if(s_logger.isDebugEnabled()) {
+            s_logger.debug("Use console proxy template : " + consoleProxyTmpltName);
+        }
+
+		UniqueNameSearch = createSearchBuilder();
+		UniqueNameSearch.and("uniqueName", UniqueNameSearch.entity().getUniqueName(), SearchCriteria.Op.EQ);
+		NameSearch = createSearchBuilder();
+		NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ);
+
+		NameAccountIdSearch = createSearchBuilder();
+		NameAccountIdSearch.and("name", NameAccountIdSearch.entity().getName(), SearchCriteria.Op.EQ);
+		NameAccountIdSearch.and("accountId", NameAccountIdSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+
+		PublicIsoSearch = createSearchBuilder();
+		PublicIsoSearch.and("public", PublicIsoSearch.entity().isPublicTemplate(), SearchCriteria.Op.EQ);
+		PublicIsoSearch.and("format", PublicIsoSearch.entity().getFormat(), SearchCriteria.Op.EQ);
+		PublicIsoSearch.and("type", PublicIsoSearch.entity().getTemplateType(), SearchCriteria.Op.EQ);
+		PublicIsoSearch.and("bootable", PublicIsoSearch.entity().isBootable(), SearchCriteria.Op.EQ);
+		PublicIsoSearch.and("removed", PublicIsoSearch.entity().getRemoved(), SearchCriteria.Op.EQ);
+
+		UserIsoSearch = createSearchBuilder();
+		UserIsoSearch.and("format", UserIsoSearch.entity().getFormat(), SearchCriteria.Op.EQ);
+		UserIsoSearch.and("type", UserIsoSearch.entity().getTemplateType(), SearchCriteria.Op.EQ);
+		UserIsoSearch.and("removed", UserIsoSearch.entity().getRemoved(), SearchCriteria.Op.EQ);
+
+		tmpltTypeHyperSearch = createSearchBuilder();
+		tmpltTypeHyperSearch.and("templateType", tmpltTypeHyperSearch.entity().getTemplateType(), SearchCriteria.Op.EQ);
+		SearchBuilder<HostVO> hostHyperSearch = _hostDao.createSearchBuilder();
+		hostHyperSearch.and("type", hostHyperSearch.entity().getType(), SearchCriteria.Op.EQ);
+		hostHyperSearch.and("zoneId", hostHyperSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+		hostHyperSearch.groupBy(hostHyperSearch.entity().getHypervisorType());
+
+		tmpltTypeHyperSearch.join("tmplHyper", hostHyperSearch, hostHyperSearch.entity().getHypervisorType(), tmpltTypeHyperSearch.entity().getHypervisorType(), JoinBuilder.JoinType.INNER);
+		hostHyperSearch.done();
+		tmpltTypeHyperSearch.done();
+
+		tmpltTypeHyperSearch2 = createSearchBuilder();
+		tmpltTypeHyperSearch2.and("templateType", tmpltTypeHyperSearch2.entity().getTemplateType(), SearchCriteria.Op.EQ);
+		tmpltTypeHyperSearch2.and("hypervisorType", tmpltTypeHyperSearch2.entity().getHypervisorType(), SearchCriteria.Op.EQ);
+        tmpltTypeHyperSearch2.and("templateName", tmpltTypeHyperSearch2.entity().getName(), SearchCriteria.Op.EQ);
+
+
+		tmpltTypeSearch = createSearchBuilder();
+        tmpltTypeSearch.and("removed", tmpltTypeSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
+		tmpltTypeSearch.and("templateType", tmpltTypeSearch.entity().getTemplateType(), SearchCriteria.Op.EQ);
+
+		AccountIdSearch = createSearchBuilder();
+		AccountIdSearch.and("accountId", AccountIdSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AccountIdSearch.and("publicTemplate", AccountIdSearch.entity().isPublicTemplate(), SearchCriteria.Op.EQ);
+		AccountIdSearch.done();
+
+		SearchBuilder<VMTemplateZoneVO> tmpltZoneSearch = _templateZoneDao.createSearchBuilder();
+		tmpltZoneSearch.and("removed", tmpltZoneSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
+		tmpltZoneSearch.and("zoneId", tmpltZoneSearch.entity().getZoneId(), SearchCriteria.Op.EQ);
+
+		TmpltsInZoneSearch = createSearchBuilder();
+		TmpltsInZoneSearch.and("removed", TmpltsInZoneSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
+		TmpltsInZoneSearch.and().op("avoidtype", TmpltsInZoneSearch.entity().getTemplateType(), SearchCriteria.Op.NEQ);
+		TmpltsInZoneSearch.or("templateType", TmpltsInZoneSearch.entity().getTemplateType(), SearchCriteria.Op.NULL);
+		TmpltsInZoneSearch.cp();
+		TmpltsInZoneSearch.join("tmpltzone", tmpltZoneSearch, tmpltZoneSearch.entity().getTemplateId(), TmpltsInZoneSearch.entity().getId(), JoinBuilder.JoinType.INNER);
+		tmpltZoneSearch.done();
+		TmpltsInZoneSearch.done();
+
+		CountTemplatesByAccount = createSearchBuilder(Long.class);
+		CountTemplatesByAccount.select(null, Func.COUNT, null);
+		CountTemplatesByAccount.and("account", CountTemplatesByAccount.entity().getAccountId(), SearchCriteria.Op.EQ);
+		CountTemplatesByAccount.and("removed", CountTemplatesByAccount.entity().getRemoved(), SearchCriteria.Op.NULL);
+		CountTemplatesByAccount.done();
+
+        updateStateSearch = this.createSearchBuilder();
+        updateStateSearch.and("id", updateStateSearch.entity().getId(), Op.EQ);
+        updateStateSearch.and("state", updateStateSearch.entity().getState(), Op.EQ);
+        updateStateSearch.and("updatedCount", updateStateSearch.entity().getUpdatedCount(), Op.EQ);
+        updateStateSearch.done();
+
+		return result;
+	}
+
+	@Override
+	public String getRoutingTemplateUniqueName() {
+		return routerTmpltName;
+	}
+
+    @Override
+    public Set<Pair<Long, Long>> searchSwiftTemplates(String name, String keyword, TemplateFilter templateFilter, boolean isIso, List<HypervisorType> hypers, Boolean bootable, DomainVO domain,
+            Long pageSize, Long startIndex, Long zoneId, HypervisorType hyperType, boolean onlyReady, boolean showDomr, List<Account> permittedAccounts, Account caller, Map<String, String> tags) {
+
+        StringBuilder builder = new StringBuilder();
+        if (!permittedAccounts.isEmpty()) {
+            for (Account permittedAccount : permittedAccounts) {
+                builder.append(permittedAccount.getAccountId() + ",");
+            }
+        }
+
+        String permittedAccountsStr = builder.toString();
+
+        if (permittedAccountsStr.length() > 0) {
+            // chop the "," off
+            permittedAccountsStr = permittedAccountsStr.substring(0, permittedAccountsStr.length() - 1);
+        }
+
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+
+        Set<Pair<Long, Long>> templateZonePairList = new HashSet<Pair<Long, Long>>();
+        PreparedStatement pstmt = null;
+        ResultSet rs = null;
+        String sql = SELECT_TEMPLATE_SWIFT_REF;
+        try {
+            String joinClause = "";
+            String whereClause = " WHERE t.removed IS NULL";
+
+            if (isIso) {
+                whereClause += " AND t.format = 'ISO'";
+                if (!hyperType.equals(HypervisorType.None)) {
+                    joinClause = " INNER JOIN guest_os guestOS on (guestOS.id = t.guest_os_id) INNER JOIN guest_os_hypervisor goh on ( goh.guest_os_id = guestOS.id) ";
+                    whereClause += " AND goh.hypervisor_type = '" + hyperType.toString() + "'";
+                }
+            } else {
+                whereClause += " AND t.format <> 'ISO'";
+                if (hypers.isEmpty()) {
+                    return templateZonePairList;
+                } else {
+                    StringBuilder relatedHypers = new StringBuilder();
+                    for (HypervisorType hyper : hypers) {
+                        relatedHypers.append("'");
+                        relatedHypers.append(hyper.toString());
+                        relatedHypers.append("'");
+                        relatedHypers.append(",");
+                    }
+                    relatedHypers.setLength(relatedHypers.length() - 1);
+                    whereClause += " AND t.hypervisor_type IN (" + relatedHypers + ")";
+                }
+            }
+            joinClause += " INNER JOIN  template_swift_ref tsr on (t.id = tsr.template_id)";
+            if (keyword != null) {
+                whereClause += " AND t.name LIKE \"%" + keyword + "%\"";
+            } else if (name != null) {
+                whereClause += " AND t.name LIKE \"%" + name + "%\"";
+            }
+
+            if (bootable != null) {
+                whereClause += " AND t.bootable = " + bootable;
+            }
+
+            if (!showDomr) {
+                whereClause += " AND t.type != '" + Storage.TemplateType.SYSTEM.toString() + "'";
+            }
+
+            if (templateFilter == TemplateFilter.featured) {
+                whereClause += " AND t.public = 1 AND t.featured = 1";
+            } else if ((templateFilter == TemplateFilter.self || templateFilter == TemplateFilter.selfexecutable) && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
+                if (caller.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN || caller.getType() == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) {
+                    joinClause += " INNER JOIN account a on (t.account_id = a.id) INNER JOIN domain d on (a.domain_id = d.id)";
+                    whereClause += "  AND d.path LIKE '" + domain.getPath() + "%'";
+                } else {
+                    whereClause += " AND t.account_id IN (" + permittedAccountsStr + ")";
+                }
+            } else if ((templateFilter == TemplateFilter.shared || templateFilter == TemplateFilter.sharedexecutable) && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
+                if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL) {
+                    joinClause += " LEFT JOIN launch_permission lp ON t.id = lp.template_id WHERE" + " (t.account_id IN (" + permittedAccountsStr + ") OR" + " lp.account_id IN ("
+                            + permittedAccountsStr + "))";
+                } else {
+                    joinClause += " INNER JOIN account a on (t.account_id = a.id) ";
+                }
+            } else if (templateFilter == TemplateFilter.executable && !permittedAccounts.isEmpty()) {
+                whereClause += " AND (t.public = 1 OR t.account_id IN (" + permittedAccountsStr + "))";
+            } else if (templateFilter == TemplateFilter.community) {
+                whereClause += " AND t.public = 1 AND t.featured = 0";
+            } else if (templateFilter == TemplateFilter.all && caller.getType() == Account.ACCOUNT_TYPE_ADMIN) {
+            } else if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
+                return templateZonePairList;
+            }
+
+            sql += joinClause + whereClause + getOrderByLimit(pageSize, startIndex);
+            pstmt = txn.prepareStatement(sql);
+            rs = pstmt.executeQuery();
+            while (rs.next()) {
+                Pair<Long, Long> templateZonePair = new Pair<Long, Long>(rs.getLong(1), -1L);
+                templateZonePairList.add(templateZonePair);
+            }
+
+        } catch (Exception e) {
+            s_logger.warn("Error listing templates", e);
+        } finally {
+            try {
+                if (rs != null) {
+                    rs.close();
+                }
+                if (pstmt != null) {
+                    pstmt.close();
+                }
+                txn.commit();
+            } catch (SQLException sqle) {
+                s_logger.warn("Error in cleaning up", sqle);
+            }
+        }
+
+        return templateZonePairList;
+    }
+
+
+	@Override
+	public Set<Pair<Long, Long>> searchTemplates(String name, String keyword, TemplateFilter templateFilter,
+	        boolean isIso, List<HypervisorType> hypers, Boolean bootable, DomainVO domain, Long pageSize, Long startIndex,
+	        Long zoneId, HypervisorType hyperType, boolean onlyReady, boolean showDomr,List<Account> permittedAccounts,
+	        Account caller, ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags, String zoneType) {
+        StringBuilder builder = new StringBuilder();
+        if (!permittedAccounts.isEmpty()) {
+            for (Account permittedAccount : permittedAccounts) {
+                builder.append(permittedAccount.getAccountId() + ",");
+            }
+        }
+
+        String permittedAccountsStr = builder.toString();
+
+        if (permittedAccountsStr.length() > 0) {
+            //chop the "," off
+            permittedAccountsStr = permittedAccountsStr.substring(0, permittedAccountsStr.length()-1);
+        }
+
+	    Transaction txn = Transaction.currentTxn();
+        txn.start();
+
+        /* Use LinkedHashSet here to guarantee iteration order */
+        Set<Pair<Long, Long>> templateZonePairList = new LinkedHashSet<Pair<Long, Long>>();
+        PreparedStatement pstmt = null;
+        ResultSet rs = null;
+        StringBuilder relatedDomainIds = new StringBuilder();
+        String sql = SELECT_TEMPLATE_ZONE_REF;
+        String groupByClause = "";
+        try {
+        	//short accountType;
+        	//String accountId = null;
+        	String guestOSJoin = "";
+        	StringBuilder templateHostRefJoin = new StringBuilder();
+        	String dataCenterJoin = "", lpjoin = "";
+        	String tagsJoin = "";
+
+        	if (isIso && !hyperType.equals(HypervisorType.None)) {
+        		guestOSJoin = " INNER JOIN guest_os guestOS on (guestOS.id = t.guest_os_id) INNER JOIN guest_os_hypervisor goh on ( goh.guest_os_id = guestOS.id) ";
+        	}
+        	if (onlyReady){
+        		templateHostRefJoin.append(" INNER JOIN  template_host_ref thr on (t.id = thr.template_id) INNER JOIN host h on (thr.host_id = h.id)");
+        		sql = SELECT_TEMPLATE_HOST_REF;
+                groupByClause = " GROUP BY t.id, h.data_center_id ";
+        	}
+        	if ((templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.community)) {
+        	    dataCenterJoin = " INNER JOIN data_center dc on (h.data_center_id = dc.id)";
+        	}
+        	
+        	if (zoneType != null) {
+        	    dataCenterJoin = " INNER JOIN template_host_ref thr on (t.id = thr.template_id) INNER JOIN host h on (thr.host_id = h.id)";
+                dataCenterJoin += " INNER JOIN data_center dc on (h.data_center_id = dc.id)";
+            }
+        	
+        	if (templateFilter == TemplateFilter.sharedexecutable || templateFilter == TemplateFilter.shared ){
+        	    lpjoin = " INNER JOIN launch_permission lp ON t.id = lp.template_id ";
+        	}
+
+        	if (tags != null && !tags.isEmpty()) {
+        	    tagsJoin = " INNER JOIN resource_tags r ON t.id = r.resource_id ";
+        	}
+
+        	sql +=  guestOSJoin + templateHostRefJoin + dataCenterJoin + lpjoin + tagsJoin;
+        	String whereClause = "";
+
+        	//All joins have to be made before we start setting the condition settings
+        	if ((listProjectResourcesCriteria == ListProjectResourcesCriteria.SkipProjectResources
+        			|| (!permittedAccounts.isEmpty() && !(templateFilter == TemplateFilter.community || templateFilter == TemplateFilter.featured))) &&
+        			!(caller.getType() != Account.ACCOUNT_TYPE_NORMAL && templateFilter == TemplateFilter.all)) {
+        		whereClause += " INNER JOIN account a on (t.account_id = a.id)";
+        		if ((templateFilter == TemplateFilter.self || templateFilter == TemplateFilter.selfexecutable) && (caller.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN || caller.getType() == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN)) {
+            		 whereClause += " INNER JOIN domain d on (a.domain_id = d.id) WHERE d.path LIKE '" + domain.getPath() + "%'";
+             		if (listProjectResourcesCriteria == ListProjectResourcesCriteria.SkipProjectResources) {
+            			whereClause += " AND a.type != " + Account.ACCOUNT_TYPE_PROJECT;
+            		}
+        		} else
+        			if (listProjectResourcesCriteria == ListProjectResourcesCriteria.SkipProjectResources) {
+        				whereClause += " WHERE a.type != " + Account.ACCOUNT_TYPE_PROJECT;
+        		}
+        	}
+
+            if (!permittedAccounts.isEmpty()) {
+                for (Account account : permittedAccounts) {
+                    //accountType = account.getType();
+                    //accountId = Long.toString(account.getId());
+                    DomainVO accountDomain = _domainDao.findById(account.getDomainId());
+
+                    // get all parent domain ID's all the way till root domain
+                    DomainVO domainTreeNode = accountDomain;
+                    while (true) {
+                        relatedDomainIds.append(domainTreeNode.getId());
+                        relatedDomainIds.append(",");
+                        if (domainTreeNode.getParent() != null) {
+                            domainTreeNode = _domainDao.findById(domainTreeNode.getParent());
+                        } else {
+                            break;
+                        }
+                    }
+
+                    // get all child domain ID's
+                    if (isAdmin(account.getType()) ) {
+                        List<DomainVO> allChildDomains = _domainDao.findAllChildren(accountDomain.getPath(), accountDomain.getId());
+                        for (DomainVO childDomain : allChildDomains) {
+                            relatedDomainIds.append(childDomain.getId());
+                            relatedDomainIds.append(",");
+                        }
+                    }
+                    relatedDomainIds.setLength(relatedDomainIds.length()-1);
+                }
+            }
+
+            String attr = " AND ";
+            if (whereClause.endsWith(" WHERE ")) {
+            	attr += " WHERE ";
+            }
+
+            if (!isIso) {
+        	    if ( hypers.isEmpty() ) {
+        	        return templateZonePairList;
+        	    } else {
+        	        StringBuilder relatedHypers = new StringBuilder();
+        	        for (HypervisorType hyper : hypers ) {
+        	            relatedHypers.append("'");
+        	            relatedHypers.append(hyper.toString());
+                        relatedHypers.append("'");
+        	            relatedHypers.append(",");
+        	        }
+        	        relatedHypers.setLength(relatedHypers.length()-1);
+                    whereClause += attr + " t.hypervisor_type IN (" + relatedHypers + ")";
+        	    }
+        	}
+
+            if (!permittedAccounts.isEmpty() && !(templateFilter == TemplateFilter.featured ||
+                    templateFilter == TemplateFilter.community || templateFilter == TemplateFilter.executable
+                    || templateFilter == TemplateFilter.shared || templateFilter == TemplateFilter.sharedexecutable)  && !isAdmin(caller.getType()) ) {
+            	whereClause += attr + "t.account_id IN (" + permittedAccountsStr + ")";
+            }
+
+        	if (templateFilter == TemplateFilter.featured) {
+            	whereClause += attr + "t.public = 1 AND t.featured = 1";
+            	if (!permittedAccounts.isEmpty()) {
+            	    whereClause += attr + "(dc.domain_id IN (" + relatedDomainIds + ") OR dc.domain_id is NULL)";
+            	}
+            } else if (templateFilter == TemplateFilter.self || templateFilter == TemplateFilter.selfexecutable) {
+                whereClause += " AND t.account_id IN (" + permittedAccountsStr + ")";
+            } else if (templateFilter == TemplateFilter.sharedexecutable || templateFilter == TemplateFilter.shared ) {
+            		whereClause += " AND " +
+                	" (t.account_id IN (" + permittedAccountsStr + ") OR" +
+                	" lp.account_id IN (" + permittedAccountsStr + "))";
+            } else if (templateFilter == TemplateFilter.executable && !permittedAccounts.isEmpty()) {
+            	whereClause += attr + "(t.public = 1 OR t.account_id IN (" + permittedAccountsStr + "))";
+            } else if (templateFilter == TemplateFilter.community) {
+            	whereClause += attr + "t.public = 1 AND t.featured = 0";
+            	if (!permittedAccounts.isEmpty()) {
+            	    whereClause += attr + "(dc.domain_id IN (" + relatedDomainIds + ") OR dc.domain_id is NULL)";
+            	}
+            } else if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN && !isIso) {
+            	return templateZonePairList;
+            }
+
+        	if (tags != null && !tags.isEmpty()) {
+        	    whereClause += " AND (";
+        	    boolean first = true;
+        	    for (String key : tags.keySet()) {
+        	        if (!first) {
+        	            whereClause += " OR ";
+        	        }
+        	        whereClause += "(r.key=\"" + key + "\" and r.value=\"" + tags.get(key) + "\")";
+        	        first = false;
+        	    }
+        	    whereClause += ")";
+        	}
+
+            if (whereClause.equals("")) {
+            	whereClause += " WHERE ";
+            } else if (!whereClause.equals(" WHERE ")) {
+            	whereClause += " AND ";
+            }
+
+            sql += whereClause + getExtrasWhere(templateFilter, name, keyword, isIso, bootable, hyperType, zoneId,
+                    onlyReady, showDomr, zoneType) + groupByClause + getOrderByLimit(pageSize, startIndex);
+
+            pstmt = txn.prepareStatement(sql);
+            rs = pstmt.executeQuery();
+
+            while (rs.next()) {
+               Pair<Long, Long> templateZonePair = new Pair<Long, Long>(rs.getLong(1), rs.getLong(2));
+                               templateZonePairList.add(templateZonePair);
+            }
+           //for now, defaulting pageSize to a large val if null; may need to revisit post 2.2RC2
+           if(isIso && templateZonePairList.size() < (pageSize != null ? pageSize : 500)
+                   && templateFilter != TemplateFilter.community
+                   && !(templateFilter == TemplateFilter.self && !BaseCmd.isRootAdmin(caller.getType())) ){ //evaluates to true If root admin and filter=self
+
+               List<VMTemplateVO> publicIsos = publicIsoSearch(bootable, false, tags);
+               List<VMTemplateVO> userIsos = userIsoSearch(false);
+
+               //Listing the ISOs according to the page size.Restricting the total no. of ISOs on a page
+               //to be less than or equal to the pageSize parameter
+
+               int i=0;
+
+               if (startIndex > userIsos.size()) {
+                   i=(int) (startIndex - userIsos.size());
+               }
+
+               for (; i < publicIsos.size(); i++) {
+                   if(templateZonePairList.size() >= pageSize){
+                        break;
+                        } else {
+                        if (keyword != null && publicIsos.get(i).getName().contains(keyword)) {
+                            templateZonePairList.add(new Pair<Long,Long>(publicIsos.get(i).getId(), null));
+                            continue;
+                        } else if (name != null && publicIsos.get(i).getName().contains(name)) {
+                            templateZonePairList.add(new Pair<Long,Long>(publicIsos.get(i).getId(), null));
+                            continue;
+                        } else if (keyword == null && name == null){
+                            templateZonePairList.add(new Pair<Long,Long>(publicIsos.get(i).getId(), null));
+                        }
+                      }
+                    }
+                }
+        } catch (Exception e) {
+            s_logger.warn("Error listing templates", e);
+        } finally {
+        	try {
+        		if (rs != null) {
+        			rs.close();
+        		}
+        		if (pstmt != null) {
+        			pstmt.close();
+        		}
+        		txn.commit();
+        	} catch( SQLException sqle) {
+        		s_logger.warn("Error in cleaning up", sqle);
+        	}
+        }
+
+        return templateZonePairList;
+	}
+
+	private String getExtrasWhere(TemplateFilter templateFilter, String name, String keyword, boolean isIso, Boolean bootable, HypervisorType hyperType, Long zoneId, boolean onlyReady, boolean showDomr, String zoneType) {
+	    String sql = "";
+        if (keyword != null) {
+            sql += " t.name LIKE \"%" + keyword + "%\" AND";
+        } else if (name != null) {
+            sql += " t.name LIKE \"%" + name + "%\" AND";
+        }
+
+        if (isIso) {
+            sql += " t.format = 'ISO'";
+            if (!hyperType.equals(HypervisorType.None)) {
+            	sql += " AND goh.hypervisor_type = '" + hyperType.toString() + "'";
+            }
+        } else {
+            sql += " t.format <> 'ISO'";
+            if (!hyperType.equals(HypervisorType.None)) {
+            	sql += " AND t.hypervisor_type = '" + hyperType.toString() + "'";
+            }
+        }
+
+        if (bootable != null) {
+        	sql += " AND t.bootable = " + bootable;
+        }
+
+        if (onlyReady){
+        	sql += " AND thr.download_state = '" +Status.DOWNLOADED.toString() + "'" + " AND thr.destroyed=0 ";
+        	if (zoneId != null){
+        		sql += " AND h.data_center_id = " +zoneId;
+            }
+        }else if (zoneId != null){
+        	sql += " AND tzr.zone_id = " +zoneId+ " AND tzr.removed is null" ;        	     	
+        }else{
+        	sql += " AND tzr.removed is null ";
+        }
+        
+        if (zoneType != null){            
+            sql += " AND dc.networktype = '" + zoneType + "'";
+        }   
+        
+        if (!showDomr){
+        	sql += " AND t.type != '" +Storage.TemplateType.SYSTEM.toString() + "'";
+        }
+
+        sql += " AND t.removed IS NULL";
+
+        return sql;
+	}
+
+	private String getOrderByLimit(Long pageSize, Long startIndex) {
+    	Boolean isAscending = Boolean.parseBoolean(_configDao.getValue("sortkey.algorithm"));
+    	isAscending = (isAscending == null ? true : isAscending);
+
+		String sql;
+		if (isAscending) {
+			sql = " ORDER BY t.sort_key ASC";
+		} else {
+			sql = " ORDER BY t.sort_key DESC";
+		}
+
+        if ((pageSize != null) && (startIndex != null)) {
+            sql += " LIMIT " + startIndex.toString() + "," + pageSize.toString();
+        }
+        return sql;
+	}
+
+	@Override
+	@DB
+	public long addTemplateToZone(VMTemplateVO tmplt, long zoneId) {
+		Transaction txn = Transaction.currentTxn();
+		txn.start();
+		VMTemplateVO tmplt2 = findById(tmplt.getId());
+		if (tmplt2 == null){
+			if (persist(tmplt) == null) {
+				throw new CloudRuntimeException("Failed to persist the template " + tmplt);
+			}
+			if(tmplt.getDetails() != null) {
+				_templateDetailsDao.persist(tmplt.getId(), tmplt.getDetails());
+			}
+		}
+		VMTemplateZoneVO tmpltZoneVO = _templateZoneDao.findByZoneTemplate(zoneId, tmplt.getId());
+		if (tmpltZoneVO == null ) {
+		    tmpltZoneVO = new VMTemplateZoneVO(zoneId, tmplt.getId(), new Date());
+		    _templateZoneDao.persist(tmpltZoneVO);
+		} else {
+		    tmpltZoneVO.setRemoved(null);
+		    tmpltZoneVO.setLastUpdated(new Date());
+		    _templateZoneDao.update(tmpltZoneVO.getId(), tmpltZoneVO);
+		}
+		txn.commit();
+
+		return tmplt.getId();
+	}
+
+	@Override
+	@DB
+	public List<VMTemplateVO> listAllInZone(long dataCenterId) {
+		SearchCriteria<VMTemplateVO> sc = TmpltsInZoneSearch.create();
+		sc.setParameters("avoidtype", TemplateType.PERHOST.toString());
+		sc.setJoinParameters("tmpltzone", "zoneId", dataCenterId);
+		return listBy(sc);
+	}
+
+	@Override
+	public List<VMTemplateVO> listDefaultBuiltinTemplates() {
+		SearchCriteria<VMTemplateVO> sc = tmpltTypeSearch.create();
+		sc.setParameters("templateType", Storage.TemplateType.BUILTIN);
+		return listBy(sc);
+	}
+
+	@Override
+	public VMTemplateVO findSystemVMTemplate(long zoneId) {
+		SearchCriteria<VMTemplateVO> sc = tmpltTypeHyperSearch.create();
+		sc.setParameters("templateType", Storage.TemplateType.SYSTEM);
+		sc.setJoinParameters("tmplHyper",  "type", Host.Type.Routing);
+		sc.setJoinParameters("tmplHyper", "zoneId", zoneId);
+
+		//order by descending order of id and select the first (this is going to be the latest)
+		List<VMTemplateVO> tmplts = listBy(sc, new Filter(VMTemplateVO.class, "id", false, null, 1l));
+
+		if (tmplts.size() > 0) {
+			return tmplts.get(0);
+		} else {
+			return null;
+		}
+	}
+
+	public VMTemplateVO findSystemVMTemplate(long zoneId, HypervisorType hType) {
+	    SearchCriteria<VMTemplateVO> sc = tmpltTypeHyperSearch.create();
+	    sc.setParameters("templateType", Storage.TemplateType.SYSTEM);
+	    sc.setJoinParameters("tmplHyper",  "type", Host.Type.Routing);
+	    sc.setJoinParameters("tmplHyper", "zoneId", zoneId);
+
+	    //order by descending order of id
+	    List<VMTemplateVO> tmplts = listBy(sc, new Filter(VMTemplateVO.class, "id", false, null, null));
+
+	    for (VMTemplateVO tmplt: tmplts) {
+	        if (tmplt.getHypervisorType() == hType) {
+	            return tmplt;
+	        }
+	    }
+	    if (tmplts.size() > 0 && hType == HypervisorType.Any) {
+	        return tmplts.get(0);
+	    }
+	    return null;
+	}
+
+	@Override
+	public VMTemplateVO findRoutingTemplate(HypervisorType hType, String templateName) {
+	    SearchCriteria<VMTemplateVO> sc = tmpltTypeHyperSearch2.create();
+        sc.setParameters("templateType", Storage.TemplateType.SYSTEM);
+        sc.setParameters("hypervisorType", hType);
+        if (templateName != null) {
+            sc.setParameters("templateName", templateName);
+        }
+
+        //order by descending order of id and select the first (this is going to be the latest)
+        List<VMTemplateVO> tmplts = listBy(sc, new Filter(VMTemplateVO.class, "id", false, null, 1l));
+
+        if (tmplts.size() > 0) {
+            return tmplts.get(0);
+        } else {
+            return null;
+        }
+	}
+
+    @Override
+    public Long countTemplatesForAccount(long accountId) {
+    	SearchCriteria<Long> sc = CountTemplatesByAccount.create();
+        sc.setParameters("account", accountId);
+        return customSearch(sc, null).get(0);
+    }
+
+    @Override
+    @DB
+    public boolean remove(Long id) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        VMTemplateVO template = createForUpdate();
+        template.setRemoved(new Date());
+
+        VMTemplateVO vo = findById(id);
+        if (vo != null) {
+            if (vo.getFormat() == ImageFormat.ISO) {
+                _tagsDao.removeByIdAndType(id, TaggedResourceType.ISO);
+            } else {
+                _tagsDao.removeByIdAndType(id, TaggedResourceType.Template);
+            }
+        }
+
+        boolean result = update(id, template);
+        txn.commit();
+        return result;
+    }
+
+    private boolean isAdmin(short accountType) {
+	    return ((accountType == Account.ACCOUNT_TYPE_ADMIN) ||
+	    	    (accountType == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) ||
+	            (accountType == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) ||
+	            (accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
+	}
+
+    @Override
+    public List<VMTemplateVO> findTemplatesToSyncToS3() {
+        return executeList(SELECT_S3_CANDIDATE_TEMPLATES, new Object[] {});
+    }
+
+    @Override
+    public Set<Pair<Long, Long>> searchS3Templates(final String name,
+            final String keyword, final TemplateFilter templateFilter,
+            final boolean isIso, final List<HypervisorType> hypers,
+            final Boolean bootable, final DomainVO domain, final Long pageSize,
+            final Long startIndex, final Long zoneId,
+            final HypervisorType hyperType, final boolean onlyReady,
+            final boolean showDomr, final List<Account> permittedAccounts,
+            final Account caller, final Map<String, String> tags) {
+
+        final String permittedAccountsStr = join(",", permittedAccounts);
+
+        final Transaction txn = Transaction.currentTxn();
+        txn.start();
+
+        Set<Pair<Long, Long>> templateZonePairList = new HashSet<Pair<Long, Long>>();
+        PreparedStatement pstmt = null;
+        ResultSet rs = null;
+        try {
+
+            final StringBuilder joinClause = new StringBuilder();
+            final StringBuilder whereClause = new StringBuilder(" WHERE t.removed IS NULL");
+
+            if (isIso) {
+                whereClause.append(" AND t.format = 'ISO'");
+                if (!hyperType.equals(HypervisorType.None)) {
+                    joinClause.append(" INNER JOIN guest_os guestOS on (guestOS.id = t.guest_os_id) INNER JOIN guest_os_hypervisor goh on ( goh.guest_os_id = guestOS.id) ");
+                    whereClause.append(" AND goh.hypervisor_type = '");
+                    whereClause.append(hyperType);
+                    whereClause.append("'");
+                }
+            } else {
+                whereClause.append(" AND t.format <> 'ISO'");
+                if (hypers.isEmpty()) {
+                    return templateZonePairList;
+                } else {
+                    final StringBuilder relatedHypers = new StringBuilder();
+                    for (HypervisorType hyper : hypers) {
+                        relatedHypers.append("'");
+                        relatedHypers.append(hyper.toString());
+                        relatedHypers.append("'");
+                        relatedHypers.append(",");
+                    }
+                    relatedHypers.setLength(relatedHypers.length() - 1);
+                    whereClause.append(" AND t.hypervisor_type IN (");
+                    whereClause.append(relatedHypers);
+                    whereClause.append(")");
+                }
+            }
+
+            joinClause.append(" INNER JOIN  template_s3_ref tsr on (t.id = tsr.template_id)");
+
+            whereClause.append("AND t.name LIKE \"%");
+            whereClause.append(keyword == null ? keyword : name);
+            whereClause.append("%\"");
+
+            if (bootable != null) {
+                whereClause.append(" AND t.bootable = ");
+                whereClause.append(bootable);
+            }
+
+            if (!showDomr) {
+                whereClause.append(" AND t.type != '");
+                whereClause.append(Storage.TemplateType.SYSTEM);
+                whereClause.append("'");
+            }
+
+            if (templateFilter == TemplateFilter.featured) {
+                whereClause.append(" AND t.public = 1 AND t.featured = 1");
+            } else if ((templateFilter == TemplateFilter.self || templateFilter == TemplateFilter.selfexecutable)
+                    && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
+                if (caller.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN
+                        || caller.getType() == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) {
+                    joinClause.append(" INNER JOIN account a on (t.account_id = a.id) INNER JOIN domain d on (a.domain_id = d.id)");
+                    whereClause.append("  AND d.path LIKE '");
+                    whereClause.append(domain.getPath());
+                    whereClause.append("%'");
+                } else {
+                    whereClause.append(" AND t.account_id IN (");
+                    whereClause.append(permittedAccountsStr);
+                    whereClause.append(")");
+                }
+            } else if (templateFilter == TemplateFilter.sharedexecutable
+                    && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
+                if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL) {
+                    joinClause.append(" LEFT JOIN launch_permission lp ON t.id = lp.template_id WHERE (t.account_id IN (");
+                    joinClause.append(permittedAccountsStr);
+                    joinClause.append(") OR lp.account_id IN (");
+                    joinClause.append(permittedAccountsStr);
+                    joinClause.append("))");
+                } else {
+                    joinClause.append(" INNER JOIN account a on (t.account_id = a.id) ");
+                }
+            } else if (templateFilter == TemplateFilter.executable
+                    && !permittedAccounts.isEmpty()) {
+                whereClause.append(" AND (t.public = 1 OR t.account_id IN (");
+                whereClause.append(permittedAccountsStr);
+                whereClause.append("))");
+            } else if (templateFilter == TemplateFilter.community) {
+                whereClause.append(" AND t.public = 1 AND t.featured = 0");
+            } else if (templateFilter == TemplateFilter.all
+                    && caller.getType() == Account.ACCOUNT_TYPE_ADMIN) {
+            } else if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
+                return templateZonePairList;
+            }
+
+            final StringBuilder sql = new StringBuilder(SELECT_TEMPLATE_S3_REF);
+            sql.append(joinClause);
+            sql.append(whereClause);
+            sql.append(getOrderByLimit(pageSize, startIndex));
+
+            pstmt = txn.prepareStatement(sql.toString());
+            rs = pstmt.executeQuery();
+            while (rs.next()) {
+                final Pair<Long, Long> templateZonePair = new Pair<Long, Long>(
+                        rs.getLong(1), -1L);
+                templateZonePairList.add(templateZonePair);
+            }
+            txn.commit();
+        } catch (Exception e) {
+            s_logger.warn("Error listing S3 templates", e);
+            if (txn != null) {
+                txn.rollback();
+            }
+        } finally {
+            closeResources(pstmt, rs);
+            if (txn != null) {
+                txn.close();
+            }
+        }
+
+        return templateZonePairList;
+    }
+
+    @Override
+    public boolean updateState(TemplateState currentState, TemplateEvent event,
+            TemplateState nextState, VMTemplateVO vo, Object data) {
+        Long oldUpdated = vo.getUpdatedCount();
+        Date oldUpdatedTime = vo.getUpdated();
+
+
+        SearchCriteria<VMTemplateVO> sc = updateStateSearch.create();
+        sc.setParameters("id", vo.getId());
+        sc.setParameters("state", currentState);
+        sc.setParameters("updatedCount", vo.getUpdatedCount());
+
+        vo.incrUpdatedCount();
+
+        UpdateBuilder builder = getUpdateBuilder(vo);
+        builder.set(vo, "state", nextState);
+        builder.set(vo, "updated", new Date());
+
+        int rows = update((VMTemplateVO) vo, sc);
+        if (rows == 0 && s_logger.isDebugEnabled()) {
+            VMTemplateVO dbVol = findByIdIncludingRemoved(vo.getId());
+            if (dbVol != null) {
+                StringBuilder str = new StringBuilder("Unable to update ").append(vo.toString());
+                str.append(": DB Data={id=").append(dbVol.getId()).append("; state=").append(dbVol.getState()).append("; updatecount=").append(dbVol.getUpdatedCount()).append(";updatedTime=")
+                        .append(dbVol.getUpdated());
+                str.append(": New Data={id=").append(vo.getId()).append("; state=").append(nextState).append("; event=").append(event).append("; updatecount=").append(vo.getUpdatedCount())
+                        .append("; updatedTime=").append(vo.getUpdated());
+                str.append(": stale Data={id=").append(vo.getId()).append("; state=").append(currentState).append("; event=").append(event).append("; updatecount=").append(oldUpdated)
+                        .append("; updatedTime=").append(oldUpdatedTime);
+            } else {
+                s_logger.debug("Unable to update objectIndatastore: id=" + vo.getId() + ", as there is no such object exists in the database anymore");
+            }
+        }
+        return rows > 0;
+    }
+}


[42/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java
index 39fac13..b3fca5a 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java
@@ -31,6 +31,7 @@ import org.apache.cloudstack.api.response.VirtualRouterProviderResponse;
 import org.apache.log4j.Logger;
 
 import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.exception.ResourceAllocationException;
 import com.cloud.network.VirtualRouterProvider;
 import com.cloud.network.VirtualRouterProvider.VirtualRouterProviderType;
@@ -52,6 +53,9 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
 
     @Parameter(name=ApiConstants.NETWORK_SERVICE_PROVIDER_ID, type=CommandType.UUID, entityType = ProviderResponse.class, required=true, description="the network service provider ID of the virtual router element")
     private Long nspId;
+    
+    @Parameter(name=ApiConstants.PROVIDER_TYPE, type=CommandType.UUID, entityType = ProviderResponse.class, description="The provider type. Supported types are VirtualRouter (default) and VPCVirtualRouter")
+    private String providerType;
 
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
@@ -61,16 +65,27 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
         this.nspId = nspId;
     }
 
-
-
     public Long getNspId() {
         return nspId;
     }
+    
+    public VirtualRouterProviderType getProviderType() {
+        if (providerType != null) {
+            if (providerType.equalsIgnoreCase(VirtualRouterProviderType.VirtualRouter.toString())) {
+                return VirtualRouterProviderType.VirtualRouter;
+            } else if (providerType.equalsIgnoreCase(VirtualRouterProviderType.VPCVirtualRouter.toString())) {
+                return VirtualRouterProviderType.VPCVirtualRouter;
+            } else throw new InvalidParameterValueException("Invalid providerType specified");
+        } 
+        return VirtualRouterProviderType.VirtualRouter;
+    }
 
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////
 
+
+
     @Override
     public String getCommandName() {
         return s_name;
@@ -96,7 +111,7 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
 
     @Override
     public void create() throws ResourceAllocationException {
-        VirtualRouterProvider result = _service.get(0).addElement(getNspId(), VirtualRouterProviderType.VirtualRouter);
+        VirtualRouterProvider result = _service.get(0).addElement(getNspId(), getProviderType());
         if (result != null) {
             setEntityId(result.getId());
             setEntityUuid(result.getUuid());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
index d2b26c0..78c3554 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
@@ -31,6 +31,7 @@ import org.apache.cloudstack.api.response.ZoneResponse;
 import org.apache.log4j.Logger;
 
 import com.cloud.async.AsyncJob;
+import com.cloud.network.router.VirtualRouter.Role;
 
 @APICommand(name = "listRouters", description="List routers.", responseObject=DomainRouterResponse.class)
 public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
@@ -64,6 +65,9 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
             description="the Zone ID of the router")
     private Long zoneId;
 
+    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+    private String zoneType;
+    
     @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType=NetworkResponse.class,
             description="list by network id")
     private Long networkId;
@@ -74,7 +78,7 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
 
     @Parameter(name=ApiConstants.FOR_VPC, type=CommandType.BOOLEAN, description="if true is passed for this parameter, list only VPC routers")
     private Boolean forVpc;
-
+    
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -103,6 +107,10 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
         return zoneId;
     }
 
+    public String getZoneType() {
+        return zoneType;
+    }
+    
     public Long getNetworkId() {
         return networkId;
     }
@@ -114,6 +122,10 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
     public Boolean getForVpc() {
         return forVpc;
     }
+    
+    public String getRole() {
+        return Role.VIRTUAL_ROUTER.toString();
+    }
 
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java
index 1d3930b..ad0461e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java
@@ -29,8 +29,10 @@ import com.cloud.async.AsyncJob;
 import com.cloud.event.EventTypes;
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.network.router.VirtualRouter;
+import com.cloud.network.router.VirtualRouter.Role;
 import com.cloud.user.Account;
 import com.cloud.user.UserContext;
 
@@ -100,7 +102,13 @@ public class StartRouterCmd extends BaseAsyncCmd {
     @Override
     public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
         UserContext.current().setEventDetails("Router Id: "+getId());
-        VirtualRouter result = _routerService.startRouter(id);
+        VirtualRouter result = null;
+        VirtualRouter router = _routerService.findRouter(getId());
+        if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) {
+            throw new InvalidParameterValueException("Can't find router by id");
+        } else {
+            result = _routerService.startRouter(getId());
+        }
         if (result != null){
             DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(result);
             routerResponse.setResponseName(getCommandName());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java
index 60dd938..94473cf 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java
@@ -28,8 +28,10 @@ import org.apache.log4j.Logger;
 import com.cloud.async.AsyncJob;
 import com.cloud.event.EventTypes;
 import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.network.router.VirtualRouter;
+import com.cloud.network.router.VirtualRouter.Role;
 import com.cloud.user.Account;
 import com.cloud.user.UserContext;
 
@@ -103,7 +105,14 @@ public class StopRouterCmd extends BaseAsyncCmd {
     @Override
     public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
         UserContext.current().setEventDetails("Router Id: "+getId());
-        VirtualRouter result = _routerService.stopRouter(getId(), isForced());
+        VirtualRouter result = null;
+        VirtualRouter router = _routerService.findRouter(getId());
+        if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) {
+            throw new InvalidParameterValueException("Can't find router by id");
+        } else {
+            result = _routerService.stopRouter(getId(), isForced());
+        }
+        
         if (result != null) {
             DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
             response.setResponseName(getCommandName());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
index f230a20..b5a0f3f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
@@ -74,6 +74,9 @@ public class ListSystemVMsCmd extends BaseListCmd {
             description="the storage ID where vm's volumes belong to", since="3.0.1")
     private Long storageId;
 
+    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+    private String zoneType;
+    
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -110,6 +113,10 @@ public class ListSystemVMsCmd extends BaseListCmd {
         return storageId;
     }
 
+    public String getZoneType() {
+        return zoneType;
+    }
+    
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
index 9fd736f..2055695 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
@@ -69,6 +69,11 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
             required=true, description="the VPC network belongs to")
     private Long vpcId;
 
+    @Parameter(name=ApiConstants.SOURCE_NAT_SUPPORTED, type=CommandType.BOOLEAN, required=false,
+            description="source NAT supported value. Default value false. If 'true' source NAT is enabled on the private gateway" +
+                    " 'false': sourcenat is not supported")
+    private Boolean isSourceNat;
+
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -97,6 +102,13 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
         return vpcId;
     }
 
+    public Boolean getIsSourceNat () {
+        if (isSourceNat == null) {
+            return false;
+        }
+        return true;
+    }
+
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////
@@ -111,7 +123,7 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
         PrivateGateway result = null;
         try {
             result = _vpcService.createVpcPrivateGateway(getVpcId(), getPhysicalNetworkId(),
-                    getVlan(), getStartIp(), getGateway(), getNetmask(), getEntityOwnerId());
+                    getVlan(), getStartIp(), getGateway(), getNetmask(), getEntityOwnerId(), getIsSourceNat());
         } catch (InsufficientCapacityException ex){
             s_logger.info(ex);
             s_logger.trace(ex);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
index 3219601..f872c12 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
@@ -78,6 +78,9 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
             description="the ID of the zone")
     private Long zoneId;
 
+    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+    private String zoneType;
+    
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -115,6 +118,10 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
         return zoneId;
     }
 
+    public String getZoneType() {
+        return zoneType;
+    }
+    
     public boolean listInReadyState() {
         Account account = UserContext.current().getCaller();
         // It is account specific if account is admin type and domainId and accountName are not null

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
new file mode 100644
index 0000000..17ae959
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
@@ -0,0 +1,218 @@
+// 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 org.apache.cloudstack.api.command.user.loadbalancer;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
+import org.apache.log4j.Logger;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InsufficientAddressCapacityException;
+import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.Network;
+import com.cloud.network.rules.LoadBalancerContainer.Scheme;
+import com.cloud.user.UserContext;
+import com.cloud.utils.net.NetUtils;
+
+@APICommand(name = "createLoadBalancer", description="Creates a Load Balancer", responseObject=ApplicationLoadBalancerResponse.class, since="4.2.0")
+public class CreateApplicationLoadBalancerCmd extends BaseAsyncCreateCmd {
+    public static final Logger s_logger = Logger.getLogger(CreateApplicationLoadBalancerCmd.class.getName());
+
+    private static final String s_name = "createloadbalancerresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="name of the Load Balancer")
+    private String loadBalancerName;
+    
+    @Parameter(name=ApiConstants.DESCRIPTION, type=CommandType.STRING, description="the description of the Load Balancer", length=4096)
+    private String description;
+    
+    @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, required=true, entityType = NetworkResponse.class,
+            description="The guest network the Load Balancer will be created for")
+    private Long networkId;
+    
+    @Parameter(name=ApiConstants.SOURCE_PORT, type=CommandType.INTEGER, required=true, description="the source port the network traffic will be load balanced from")
+    private Integer sourcePort;
+
+    @Parameter(name=ApiConstants.ALGORITHM, type=CommandType.STRING, required=true, description="load balancer algorithm (source, roundrobin, leastconn)")
+    private String algorithm;
+
+    @Parameter(name=ApiConstants.INSTANCE_PORT, type=CommandType.INTEGER, required=true, description="the TCP port of the virtual machine where the network traffic will be load balanced to")
+    private Integer instancePort;
+
+    @Parameter(name=ApiConstants.SOURCE_IP, type=CommandType.STRING, description="the source ip address the network traffic will be load balanced from")
+    private String sourceIp;
+    
+    @Parameter(name=ApiConstants.SOURCE_IP_NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class, required=true,
+            description="the network id of the source ip address")
+    private Long sourceIpNetworkId;
+    
+    @Parameter(name=ApiConstants.SCHEME, type=CommandType.STRING, required=true, description="the load balancer scheme. Supported value in this release is Internal")
+    private String scheme;
+
+
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getAlgorithm() {
+        return algorithm;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public String getLoadBalancerName() {
+        return loadBalancerName;
+    }
+
+    public Integer getPrivatePort() {
+        return instancePort;
+    }
+
+    public long getNetworkId() {
+        return networkId;
+    }
+
+    public String getName() {
+        return loadBalancerName;
+    }
+    
+    public Integer getSourcePort() {
+        return sourcePort.intValue();
+    }
+
+    public String getProtocol() {
+        return NetUtils.TCP_PROTO;
+    }
+
+    public long getAccountId() {
+        //get account info from the network object
+        Network ntwk = _networkService.getNetwork(networkId);
+        if (ntwk == null) {
+            throw new InvalidParameterValueException("Invalid network id specified");
+        }
+       
+        return ntwk.getAccountId();
+        
+    }
+
+    public int getInstancePort() {
+        return instancePort.intValue();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_LOAD_BALANCER_CREATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "creating load balancer: " + getName() + " account: " + getAccountId();
+
+    }
+
+    @Override
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.LoadBalancerRule;
+    }
+    
+    public String getSourceIp() {
+        return sourceIp;
+    }
+
+    public long getSourceIpNetworkId() {
+        return sourceIpNetworkId;
+    }
+
+    public Scheme getScheme() {
+        if (scheme.equalsIgnoreCase(Scheme.Internal.toString())) {
+            return Scheme.Internal;
+        } else {
+            throw new InvalidParameterValueException("Invalid value for scheme. Supported value is Internal");
+        }
+    }
+    
+    @Override
+    public long getEntityOwnerId() {
+       return getAccountId();
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public void execute() throws ResourceAllocationException, ResourceUnavailableException {
+        ApplicationLoadBalancerRule rule = null;
+        try {
+            UserContext.current().setEventDetails("Load Balancer Id: " + getEntityId());
+            // State might be different after the rule is applied, so get new object here
+            rule = _entityMgr.findById(ApplicationLoadBalancerRule.class, getEntityId());
+            ApplicationLoadBalancerResponse lbResponse = _responseGenerator.createLoadBalancerContainerReponse(rule, _lbService.getLbInstances(getEntityId()));
+            setResponseObject(lbResponse);
+            lbResponse.setResponseName(getCommandName());
+        } catch (Exception ex) {
+            s_logger.warn("Failed to create Load Balancer due to exception ", ex);
+        } finally {
+            if (rule == null) {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Load Balancer");
+            }
+        }
+    }
+
+    @Override
+    public void create() {
+        try {
+            
+            ApplicationLoadBalancerRule result = _appLbService.createApplicationLoadBalancer(getName(), getDescription(), getScheme(),
+                    getSourceIpNetworkId(), getSourceIp(), getSourcePort(), getInstancePort(), getAlgorithm(), getNetworkId(), getEntityOwnerId());
+            this.setEntityId(result.getId());
+            this.setEntityUuid(result.getUuid());
+        }catch (NetworkRuleConflictException e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
+        } catch (InsufficientAddressCapacityException e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, e.getMessage());
+        } catch (InsufficientVirtualNetworkCapcityException e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, e.getMessage());
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
index 5f1d97b..f6cc1f1 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
@@ -148,7 +148,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd  /*implements
     }
 
 
-    public Long getNetworkId() {
+    public long getNetworkId() {
         if (networkId != null) {
             return networkId;
         }
@@ -278,7 +278,9 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd  /*implements
             throw new InvalidParameterValueException("Parameter cidrList is deprecated; if you need to open firewall rule for the specific cidr, please refer to createFirewallRule command");
         }
         try {
-            LoadBalancer result = _lbService.createLoadBalancerRule(this, getOpenFirewall());
+            LoadBalancer result = _lbService.createPublicLoadBalancerRule(getXid(), getName(), getDescription(), 
+                    getSourcePortStart(), getSourcePortEnd(), getDefaultPortStart(), getDefaultPortEnd(), getSourceIpAddressId(), getProtocol(), getAlgorithm(),
+                    getNetworkId(), getEntityOwnerId(), getOpenFirewall());
             this.setEntityId(result.getId());
             this.setEntityUuid(result.getUuid());
         } catch (NetworkRuleConflictException e) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java
new file mode 100644
index 0000000..bc6cd09
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java
@@ -0,0 +1,116 @@
+// 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 org.apache.cloudstack.api.command.user.loadbalancer;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
+import org.apache.log4j.Logger;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.user.UserContext;
+
+@APICommand(name = "deleteLoadBalancer", description="Deletes a load balancer", responseObject=SuccessResponse.class, since="4.2.0")
+public class DeleteApplicationLoadBalancerCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(DeleteApplicationLoadBalancerCmd.class.getName());
+    private static final String s_name = "deleteloadbalancerresponse";
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = FirewallRuleResponse.class,
+            required=true, description="the ID of the Load Balancer")
+    private Long id;
+
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        ApplicationLoadBalancerRule lb = _entityMgr.findById(ApplicationLoadBalancerRule.class, getId());
+        if (lb != null) {
+            return lb.getAccountId();
+        } else {
+            throw new InvalidParameterValueException("Can't find load balancer by id specified");
+        }
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_LOAD_BALANCER_DELETE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "deleting load balancer: " + getId();
+    }
+
+    @Override
+    public void execute(){
+        UserContext.current().setEventDetails("Load balancer Id: " + getId());
+        boolean result = _appLbService.deleteApplicationLoadBalancer(getId());
+
+        if (result) {
+            SuccessResponse response = new SuccessResponse(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete load balancer");
+        }
+    }
+
+    @Override
+    public String getSyncObjType() {
+        return BaseAsyncCmd.networkSyncObject;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        ApplicationLoadBalancerRule lb = _appLbService.getApplicationLoadBalancer(id);
+        if(lb == null){
+            throw new InvalidParameterValueException("Unable to find load balancer by id ");
+        }
+        return lb.getNetworkId();
+    }
+
+    @Override
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.FirewallRule;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java
new file mode 100644
index 0000000..8e5df31
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java
@@ -0,0 +1,131 @@
+// 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 org.apache.cloudstack.api.command.user.loadbalancer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
+import org.apache.log4j.Logger;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.rules.LoadBalancerContainer.Scheme;
+import com.cloud.utils.Pair;
+
+@APICommand(name = "listLoadBalancers", description = "Lists Load Balancers", responseObject = ApplicationLoadBalancerResponse.class, since="4.2.0")
+public class ListApplicationLoadBalancersCmd extends BaseListTaggedResourcesCmd {
+    public static final Logger s_logger = Logger.getLogger(ListApplicationLoadBalancersCmd.class.getName());
+
+    private static final String s_name = "listloadbalancerssresponse";
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class,
+            description = "the ID of the Load Balancer")
+    private Long id;
+
+    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the Load Balancer")
+    private String loadBalancerName;
+    
+    @Parameter(name = ApiConstants.SOURCE_IP, type = CommandType.STRING, description = "the source ip address of the Load Balancer")
+    private String sourceIp;
+
+    @Parameter(name=ApiConstants.SOURCE_IP_NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class, 
+            description="the network id of the source ip address")
+    private Long sourceIpNetworkId;
+    
+    @Parameter(name = ApiConstants.SCHEME, type = CommandType.STRING, description = "the scheme of the Load Balancer. Supported value is Internal in the current release")
+    private String scheme;
+    
+    @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class, 
+            description="the network id of the Load Balancer")
+    private Long networkId;
+
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getLoadBalancerRuleName() {
+        return loadBalancerName;
+    }
+
+    public String getLoadBalancerName() {
+        return loadBalancerName;
+    }
+
+    public String getSourceIp() {
+        return sourceIp;
+    }
+
+    public Long getSourceIpNetworkId() {
+        return sourceIpNetworkId;
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+    
+    public Scheme getScheme() {
+        if (scheme != null) {
+            if (scheme.equalsIgnoreCase(Scheme.Internal.toString())) {
+                return Scheme.Internal;
+            } else {
+                throw new InvalidParameterValueException("Invalid value for scheme. Supported value is Internal");
+            }
+        }
+        return null;
+    }
+    
+    public Long getNetworkId() {
+        return networkId;
+    }
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public void execute() {
+        Pair<List<? extends ApplicationLoadBalancerRule>, Integer> loadBalancers = _appLbService.listApplicationLoadBalancers(this);
+        ListResponse<ApplicationLoadBalancerResponse> response = new ListResponse<ApplicationLoadBalancerResponse>();
+        List<ApplicationLoadBalancerResponse> lbResponses = new ArrayList<ApplicationLoadBalancerResponse>();
+        for (ApplicationLoadBalancerRule loadBalancer : loadBalancers.first()) {
+            ApplicationLoadBalancerResponse lbResponse = _responseGenerator.createLoadBalancerContainerReponse(loadBalancer, _lbService.getLbInstances(loadBalancer.getId()));
+            lbResponse.setObjectName("loadbalancer");
+            lbResponses.add(lbResponse);
+        }
+        response.setResponses(lbResponses, loadBalancers.second());
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
index a0ec68e..902dbae 100644
--- a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
@@ -120,7 +120,7 @@ public class EnableStaticNatCmd extends BaseCmd{
     @Override
     public void execute() throws ResourceUnavailableException{
         try {
-            boolean result = _rulesService.enableStaticNat(ipAddressId, virtualMachineId, getNetworkId(), false, getVmSecondaryIp());
+            boolean result = _rulesService.enableStaticNat(ipAddressId, virtualMachineId, getNetworkId(), getVmSecondaryIp());
             if (result) {
                 SuccessResponse response = new SuccessResponse(getCommandName());
                 this.setResponseObject(response);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
index afce092..d25e2c0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
@@ -48,6 +48,9 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
             description="the Zone ID of the network")
     private Long zoneId;
 
+    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+    private String zoneType;
+    
     @Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the type of the network. Supported values are: Isolated and Shared")
     private String guestIpType;
 
@@ -96,6 +99,10 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
         return zoneId;
     }
 
+    public String getZoneType() {
+        return zoneType;
+    }
+    
     public String getGuestIpType() {
         return guestIpType;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
index 95d7659..0b33f56 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
@@ -163,6 +163,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
 
     @Override
     public void execute() {
+        s_logger.info("VOLSS: createSnapshotCmd starts:" + System.currentTimeMillis());
         UserContext.current().setEventDetails("Volume Id: "+getVolumeId());
         Snapshot snapshot = _snapshotService.createSnapshot(getVolumeId(), getPolicyId(), getEntityId(), _accountService.getAccount(getEntityOwnerId()));
         if (snapshot != null) {
@@ -172,6 +173,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
         } else {
             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId);
         }
+        s_logger.info("VOLSS:  backupSnapshotCmd finishes:" + System.currentTimeMillis());
     }
 
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
index 17f20ae..d7e6bc8 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
@@ -58,6 +58,9 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
     @Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.UUID, entityType = VolumeResponse.class,
             description="the ID of the disk volume")
     private Long volumeId;
+    
+    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+    private String zoneType;
 
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
@@ -83,6 +86,10 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
         return volumeId;
     }
 
+    public String getZoneType() {
+        return zoneType;
+    }
+    
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
index aeb76f5..f0fc241 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
@@ -68,6 +68,10 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
     @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
             description="list templates by zoneId")
     private Long zoneId;
+    
+    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+    private String zoneType;
+    
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -92,6 +96,10 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
         return zoneId;
     }
 
+    public String getZoneType() {
+        return zoneType;
+    }
+    
     public boolean listInReadyState() {
 
         Account account = UserContext.current().getCaller();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
index df6b399..ae5482b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
@@ -16,6 +16,7 @@
 // under the License.
 package org.apache.cloudstack.api.command.user.vm;
 
+import com.cloud.vm.NicSecondaryIp;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.APICommand;
@@ -146,6 +147,7 @@ public class AddIpToVmNicCmd extends BaseAsyncCmd {
 
         UserContext.current().setEventDetails("Nic Id: " + getNicId() );
         String ip;
+        NicSecondaryIp result;
         String secondaryIp = null;
         if ((ip = getIpaddress()) != null) {
             if (!NetUtils.isValidIp(ip)) {
@@ -154,12 +156,13 @@ public class AddIpToVmNicCmd extends BaseAsyncCmd {
         }
 
         try {
-            secondaryIp =  _networkService.allocateSecondaryGuestIP(_accountService.getAccount(getEntityOwnerId()),  getZoneId(), getNicId(), getNetworkId(), getIpaddress());
+            result =  _networkService.allocateSecondaryGuestIP(_accountService.getAccount(getEntityOwnerId()),  getZoneId(), getNicId(), getNetworkId(), getIpaddress());
         } catch (InsufficientAddressCapacityException e) {
             throw new InvalidParameterValueException("Allocating guest ip for nic failed");
         }
 
-        if (secondaryIp != null) {
+        if (result != null) {
+            secondaryIp = result.getIp4Address();
             if (getNetworkType() == NetworkType.Basic) {
                 // add security group rules for the secondary ip addresses
                 boolean success = false;
@@ -171,7 +174,7 @@ public class AddIpToVmNicCmd extends BaseAsyncCmd {
 
             s_logger.info("Associated ip address to NIC : " + secondaryIp);
             NicSecondaryIpResponse response = new NicSecondaryIpResponse();
-            response = _responseGenerator.createSecondaryIPToNicResponse(secondaryIp, getNicId(), getNetworkId());
+            response = _responseGenerator.createSecondaryIPToNicResponse(result);
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } else {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
index 4fc65c3..4f2ac75 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
@@ -22,11 +22,12 @@ import com.cloud.user.UserContext;
 import com.cloud.uservm.UserVm;
 import org.apache.cloudstack.api.*;
 import org.apache.cloudstack.api.response.ServiceOfferingResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
 import org.apache.cloudstack.api.response.UserVmResponse;
 import org.apache.log4j.Logger;
 
 
-@APICommand(name = "scaleVirtualMachine", description="Scales the virtual machine to a new service offering.", responseObject=UserVmResponse.class)
+@APICommand(name = "scaleVirtualMachine", description="Scales the virtual machine to a new service offering.", responseObject=SuccessResponse.class)
 public class ScaleVMCmd extends BaseCmd {
     public static final Logger s_logger = Logger.getLogger(ScaleVMCmd.class.getName());
     private static final String s_name = "scalevirtualmachineresponse";
@@ -83,7 +84,7 @@ public class ScaleVMCmd extends BaseCmd {
     @Override
     public void execute(){
         //UserContext.current().setEventDetails("Vm Id: "+getId());
-        UserVm result = null;
+        boolean result;
         try {
             result = _userVmService.upgradeVirtualMachine(this);
         } catch (ResourceUnavailableException ex) {
@@ -99,9 +100,8 @@ public class ScaleVMCmd extends BaseCmd {
             s_logger.warn("Exception: ", ex);
             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
         }
-        if (result != null){
-            UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
-            response.setResponseName(getCommandName());
+        if (result){
+            SuccessResponse response = new SuccessResponse(getCommandName());
             this.setResponseObject(response);
         } else {
             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale vm");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.java
deleted file mode 100644
index ea7bf60..0000000
--- a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.java
+++ /dev/null
@@ -1,92 +0,0 @@
-// 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 org.apache.cloudstack.api.command.user.vmsnapshot;
-
-import java.util.logging.Logger;
-
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.UserVmResponse;
-import org.apache.cloudstack.api.response.VMSnapshotResponse;
-
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-import com.cloud.uservm.UserVm;
-import com.cloud.vm.snapshot.VMSnapshot;
-
-@APICommand(name = "revertToSnapshot",description = "Revert VM from a vmsnapshot.", responseObject = UserVmResponse.class, since="4.2.0")
-public class RevertToSnapshotCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger
-            .getLogger(RevertToSnapshotCmd.class.getName());
-    private static final String s_name = "reverttosnapshotresponse";
-
-    @Parameter(name = ApiConstants.VM_SNAPSHOT_ID, type = CommandType.UUID, required = true,entityType=VMSnapshotResponse.class,description = "The ID of the vm snapshot")
-    private Long vmSnapShotId;
-
-    public Long getVmSnapShotId() {
-        return vmSnapShotId;
-    }
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        VMSnapshot vmSnapshot = _entityMgr.findById(VMSnapshot.class, getVmSnapShotId());
-        if (vmSnapshot != null) {
-            return vmSnapshot.getAccountId();
-        }
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-    @Override
-    public void execute() throws  ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, ConcurrentOperationException {
-        UserContext.current().setEventDetails(
-                "vmsnapshot id: " + getVmSnapShotId());
-        UserVm result = _vmSnapshotService.revertToSnapshot(getVmSnapShotId());
-        if (result != null) {
-            UserVmResponse response = _responseGenerator.createUserVmResponse(
-                    "virtualmachine", result).get(0);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"Failed to revert VM snapshot");
-        }
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "Revert from VM snapshot: " + getVmSnapShotId();
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_VM_SNAPSHOT_REVERT;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java
new file mode 100644
index 0000000..f6d8b2c
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java
@@ -0,0 +1,92 @@
+// 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 org.apache.cloudstack.api.command.user.vmsnapshot;
+
+import java.util.logging.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VMSnapshotResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@APICommand(name = "revertToVMSnapshot",description = "Revert VM from a vmsnapshot.", responseObject = UserVmResponse.class, since="4.2.0")
+public class RevertToVMSnapshotCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger
+            .getLogger(RevertToVMSnapshotCmd.class.getName());
+    private static final String s_name = "reverttovmsnapshotresponse";
+
+    @Parameter(name = ApiConstants.VM_SNAPSHOT_ID, type = CommandType.UUID, required = true,entityType=VMSnapshotResponse.class,description = "The ID of the vm snapshot")
+    private Long vmSnapShotId;
+
+    public Long getVmSnapShotId() {
+        return vmSnapShotId;
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        VMSnapshot vmSnapshot = _entityMgr.findById(VMSnapshot.class, getVmSnapShotId());
+        if (vmSnapshot != null) {
+            return vmSnapshot.getAccountId();
+        }
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute() throws  ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, ConcurrentOperationException {
+        UserContext.current().setEventDetails(
+                "vmsnapshot id: " + getVmSnapShotId());
+        UserVm result = _vmSnapshotService.revertToSnapshot(getVmSnapShotId());
+        if (result != null) {
+            UserVmResponse response = _responseGenerator.createUserVmResponse(
+                    "virtualmachine", result).get(0);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"Failed to revert VM snapshot");
+        }
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Revert from VM snapshot: " + getVmSnapShotId();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_SNAPSHOT_REVERT;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java b/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java
index bbfb598..ed31037 100644
--- a/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java
@@ -23,6 +23,7 @@ import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseListCmd;
 import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.BaseCmd.CommandType;
 import org.apache.cloudstack.api.response.DomainResponse;
 import org.apache.cloudstack.api.response.ListResponse;
 import org.apache.cloudstack.api.response.ServiceOfferingResponse;
@@ -56,6 +57,9 @@ public class ListZonesByCmd extends BaseListCmd {
     @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the zone")
     private String name;
 
+    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+    private String zoneType;
+    
     @Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the zones")
     private Boolean showCapacities;
 
@@ -79,6 +83,10 @@ public class ListZonesByCmd extends BaseListCmd {
         return name;
     }
 
+    public String getZoneType() {
+        return zoneType;
+    }
+    
     public Boolean getShowCapacities() {
         return showCapacities;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java b/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java
new file mode 100644
index 0000000..2d6614d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java
@@ -0,0 +1,63 @@
+// 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 org.apache.cloudstack.api.response;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * 
+ * Load Balancer instance is the User Vm instance participating in the Load Balancer
+ *
+ */
+
+@SuppressWarnings("unused")
+public class ApplicationLoadBalancerInstanceResponse extends BaseResponse{
+    
+    @SerializedName(ApiConstants.ID) @Param(description = "the instance ID")
+    private String id;
+    
+    @SerializedName(ApiConstants.NAME) @Param(description = "the name of the instance")
+    private String name;
+    
+    @SerializedName(ApiConstants.STATE) @Param(description="the state of the instance")
+    private String state;
+    
+    @SerializedName(ApiConstants.IP_ADDRESS)
+    @Param(description="the ip address of the instance")
+    private String ipAddress;
+    
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public void setIpAddress(String ipAddress) {
+        this.ipAddress = ipAddress;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java b/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java
new file mode 100644
index 0000000..de9bce6
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java
@@ -0,0 +1,142 @@
+// 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 org.apache.cloudstack.api.response;
+
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@SuppressWarnings("unused")
+public class ApplicationLoadBalancerResponse extends BaseResponse implements ControlledEntityResponse{
+    @SerializedName(ApiConstants.ID) @Param(description = "the Load Balancer ID")
+    private String id;
+
+    @SerializedName(ApiConstants.NAME) @Param(description = "the name of the Load Balancer")
+    private String name;
+
+    @SerializedName(ApiConstants.DESCRIPTION) @Param(description = "the description of the Load Balancer")
+    private String description;
+    
+    @SerializedName(ApiConstants.ALGORITHM) @Param(description = "the load balancer algorithm (source, roundrobin, leastconn)")
+    private String algorithm;
+    
+    @SerializedName(ApiConstants.NETWORK_ID) @Param(description="Load Balancer network id")
+    private String networkId;
+    
+    @SerializedName(ApiConstants.SOURCE_IP) @Param(description="Load Balancer source ip")
+    private String sourceIp;
+    
+    @SerializedName(ApiConstants.SOURCE_IP_NETWORK_ID) @Param(description="Load Balancer source ip network id")
+    private String sourceIpNetworkId;
+    
+    @SerializedName(ApiConstants.ACCOUNT)
+    @Param(description = "the account of the Load Balancer")
+    private String accountName;
+
+    @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the Load Balancer")
+    private String projectId;
+
+    @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the Load Balancer")
+    private String projectName;
+
+    @SerializedName(ApiConstants.DOMAIN_ID)
+    @Param(description = "the domain ID of the Load Balancer")
+    private String domainId;
+    
+    @SerializedName(ApiConstants.DOMAIN)
+    @Param(description = "the domain of the Load Balancer")
+    private String domainName;
+    
+    @SerializedName("loadbalancerrule")  @Param(description="the list of rules associated with the Load Balancer", responseObject = ApplicationLoadBalancerRuleResponse.class)
+    private List<ApplicationLoadBalancerRuleResponse> lbRules;
+    
+    @SerializedName("loadbalancerinstance")  @Param(description="the list of instances associated with the Load Balancer", responseObject = ApplicationLoadBalancerInstanceResponse.class)
+    private List<ApplicationLoadBalancerInstanceResponse> lbInstances;
+    
+    @SerializedName(ApiConstants.TAGS)  @Param(description="the list of resource tags associated with the Load Balancer", responseObject = ResourceTagResponse.class)
+    private List<ResourceTagResponse> tags;
+
+    public void setAccountName(String accountName) {
+        this.accountName = accountName;
+    }
+
+    @Override
+    public void setDomainId(String domainId) {
+        this.domainId = domainId;
+    }
+
+    public void setDomainName(String domainName) {
+        this.domainName = domainName;
+    }
+    
+    @Override
+    public void setProjectId(String projectId) {
+        this.projectId = projectId;
+    }
+
+    @Override
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public void setTags(List<ResourceTagResponse> tags) {
+        this.tags = tags;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public void setAlgorithm(String algorithm) {
+        this.algorithm = algorithm;
+    }
+
+    public void setNetworkId(String networkId) {
+        this.networkId = networkId;
+    }
+
+    public void setSourceIp(String sourceIp) {
+        this.sourceIp = sourceIp;
+    }
+
+    public void setSourceIpNetworkId(String sourceIpNetworkId) {
+        this.sourceIpNetworkId = sourceIpNetworkId;
+    }
+
+    public void setLbRules(List<ApplicationLoadBalancerRuleResponse> lbRules) {
+        this.lbRules = lbRules;
+    }
+
+    public void setLbInstances(List<ApplicationLoadBalancerInstanceResponse> lbInstances) {
+        this.lbInstances = lbInstances;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerRuleResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerRuleResponse.java b/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerRuleResponse.java
new file mode 100644
index 0000000..ffc64d5
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/ApplicationLoadBalancerRuleResponse.java
@@ -0,0 +1,51 @@
+// 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 org.apache.cloudstack.api.response;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Subobject of the load balancer container response
+ */
+@SuppressWarnings("unused")
+public class ApplicationLoadBalancerRuleResponse extends BaseResponse{
+    @SerializedName(ApiConstants.SOURCE_PORT) @Param(description = "source port of the load balancer rule")
+    private Integer sourcePort;
+    
+    @SerializedName(ApiConstants.INSTANCE_PORT) @Param(description = "instance port of the load balancer rule")
+    private Integer instancePort;
+    
+    @SerializedName(ApiConstants.STATE) @Param(description = "the state of the load balancer rule")
+    private String state;
+
+    public void setSourcePort(Integer sourcePort) {
+        this.sourcePort = sourcePort;
+    }
+
+    public void setInstancePort(Integer instancePort) {
+        this.instancePort = instancePort;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/ConfigurationResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/ConfigurationResponse.java b/api/src/org/apache/cloudstack/api/response/ConfigurationResponse.java
index 176c47a..fa0d4b4 100644
--- a/api/src/org/apache/cloudstack/api/response/ConfigurationResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ConfigurationResponse.java
@@ -35,6 +35,9 @@ public class ConfigurationResponse extends BaseResponse {
     @SerializedName(ApiConstants.SCOPE) @Param(description="scope(zone/cluster/pool/account) of the parameter that needs to be updated")
     private String scope;
 
+    @SerializedName(ApiConstants.ID) @Param(description="the value of the configuration")
+    private Long id;
+
     @SerializedName(ApiConstants.DESCRIPTION) @Param(description="the description of the configuration")
     private String description;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java b/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java
index 79c8596..852d988 100644
--- a/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java
@@ -153,8 +153,11 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
     @SerializedName("scriptsversion") @Param(description="the version of scripts")
     private String scriptsVersion;
 
-    @SerializedName(ApiConstants.VPC_ID) @Param(description="VPC the network belongs to")
+    @SerializedName(ApiConstants.VPC_ID) @Param(description="VPC the router belongs to")
     private String vpcId;
+    
+    @SerializedName(ApiConstants.ROLE) @Param(description="role of the domain router")
+    private String role;
 
     @SerializedName("nic")  @Param(description="the list of nics associated with the router",
             responseObject = NicResponse.class, since="4.0")
@@ -164,15 +167,11 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
         nics = new LinkedHashSet<NicResponse>();
     }
 
-
-
     @Override
     public String getObjectId() {
         return this.getId();
     }
 
-
-
     public String getId() {
         return id;
     }
@@ -372,4 +371,8 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
 	public void setIp6Dns2(String ip6Dns2) {
 		this.ip6Dns2 = ip6Dns2;
 	}
+	
+	public void setRole(String role) {
+        this.role = role;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/GuestVlanRangeResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/GuestVlanRangeResponse.java b/api/src/org/apache/cloudstack/api/response/GuestVlanRangeResponse.java
new file mode 100644
index 0000000..bf19688
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/GuestVlanRangeResponse.java
@@ -0,0 +1,94 @@
+// 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 org.apache.cloudstack.api.response;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.network.GuestVlan;
+
+@EntityReference(value=GuestVlan.class)
+@SuppressWarnings("unused")
+public class GuestVlanRangeResponse extends BaseResponse implements ControlledEntityResponse {
+    @SerializedName(ApiConstants.ID) @Param(description="the ID of the guest VLAN range")
+    private String id;
+
+    @SerializedName(ApiConstants.ACCOUNT) @Param(description="the account of the guest VLAN range")
+    private String accountName;
+
+    @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID of the guest VLAN range")
+    private String domainId;
+
+    @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the guest VLAN range")
+    private String domainName;
+
+    @SerializedName(ApiConstants.GUEST_VLAN_RANGE) @Param(description="the guest VLAN range")
+    private String guestVlanRange;
+
+    @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the guest vlan range")
+    private String projectId;
+
+    @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the guest vlan range")
+    private String projectName;
+
+    @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network of the guest vlan range")
+    private Long physicalNetworkId;
+
+    @SerializedName(ApiConstants.ZONE_ID) @Param(description="the zone of the guest vlan range")
+    private Long zoneId;
+
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public void setAccountName(String accountName) {
+        this.accountName = accountName;
+    }
+
+    public void setDomainId(String domainId) {
+        this.domainId = domainId;
+    }
+
+    public void setDomainName(String domainName) {
+        this.domainName = domainName;
+    }
+
+    public void setGuestVlanRange(String guestVlanRange) {
+        this.guestVlanRange = guestVlanRange;
+    }
+
+    public void setProjectId(String projectId) {
+        this.projectId = projectId;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public void setPhysicalNetworkId(Long physicalNetworkId) {
+        this.physicalNetworkId = physicalNetworkId;
+    }
+
+    public void setZoneId(Long zoneId) {
+        this.zoneId = zoneId;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/InternalLoadBalancerElementResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/InternalLoadBalancerElementResponse.java b/api/src/org/apache/cloudstack/api/response/InternalLoadBalancerElementResponse.java
new file mode 100644
index 0000000..b7e8634
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/InternalLoadBalancerElementResponse.java
@@ -0,0 +1,51 @@
+// 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 org.apache.cloudstack.api.response;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.network.VirtualRouterProvider;
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@EntityReference(value=VirtualRouterProvider.class)
+@SuppressWarnings("unused")
+public class InternalLoadBalancerElementResponse extends BaseResponse {
+    @SerializedName(ApiConstants.ID) @Param(description="the id of the internal load balancer element")
+    private String id;
+
+    @SerializedName(ApiConstants.NSP_ID) @Param(description="the physical network service provider id of the element")
+    private String nspId;
+
+    @SerializedName(ApiConstants.ENABLED) @Param(description="Enabled/Disabled the element")
+    private Boolean enabled;
+
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public void setNspId(String nspId) {
+        this.nspId = nspId;
+    }
+
+    public void setEnabled(Boolean enabled) {
+        this.enabled = enabled;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/IsolationMethodResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/IsolationMethodResponse.java b/api/src/org/apache/cloudstack/api/response/IsolationMethodResponse.java
new file mode 100644
index 0000000..3aaa7a4
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/IsolationMethodResponse.java
@@ -0,0 +1,33 @@
+// 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 org.apache.cloudstack.api.response;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@SuppressWarnings("unused")
+public class IsolationMethodResponse extends BaseResponse{
+    @SerializedName(ApiConstants.NAME) @Param(description="Network isolation method name")
+    private String name;
+
+    public void setIsolationMethodName(String isolationMethodName) {
+        this.name = isolationMethodName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java
index b1dcd42..7a7e371 100644
--- a/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java
@@ -18,6 +18,7 @@ package org.apache.cloudstack.api.response;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseResponse;
@@ -83,6 +84,10 @@ public class NetworkOfferingResponse extends BaseResponse {
 
     @SerializedName(ApiConstants.IS_PERSISTENT) @Param(description="true if network offering supports persistent networks, false otherwise")
     private Boolean isPersistent;
+    
+    @SerializedName(ApiConstants.DETAILS) @Param(description="additional key/value details tied with network offering", since="4.2.0")
+    private Map details;
+
 
     public void setId(String id) {
         this.id = id;
@@ -156,5 +161,9 @@ public class NetworkOfferingResponse extends BaseResponse {
     public void setIsPersistent(Boolean isPersistent) {
         this.isPersistent = isPersistent;
     }
+    
+    public void setDetails(Map details) {
+        this.details = details;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java b/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java
index 4123477..ca76062 100644
--- a/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java
@@ -76,6 +76,10 @@ public class PrivateGatewayResponse extends BaseResponse implements ControlledEn
     private String state;
 
 
+    @SerializedName(ApiConstants.SOURCE_NAT_SUPPORTED) @Param(description = "Souce Nat enable status")
+    private Boolean sourceNat;
+
+
     @Override
     public String getObjectId() {
         return this.id;
@@ -145,5 +149,11 @@ public class PrivateGatewayResponse extends BaseResponse implements ControlledEn
     public void setState(String state) {
         this.state = state;
     }
+
+    public void setSourceNat(Boolean sourceNat) {
+        this.sourceNat = sourceNat;
+    }
+
+
 }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java b/api/src/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java
index 92d9a1d..de355bd 100644
--- a/api/src/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java
@@ -25,6 +25,7 @@ import com.cloud.serializer.Param;
 import com.google.gson.annotations.SerializedName;
 
 @EntityReference(value=VirtualRouterProvider.class)
+@SuppressWarnings("unused")
 public class VirtualRouterProviderResponse extends BaseResponse implements ControlledEntityResponse {
     @SerializedName(ApiConstants.ID) @Param(description="the id of the router")
     private String id;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/network/element/InternalLoadBalancerElementService.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/network/element/InternalLoadBalancerElementService.java b/api/src/org/apache/cloudstack/network/element/InternalLoadBalancerElementService.java
new file mode 100644
index 0000000..33a0c64
--- /dev/null
+++ b/api/src/org/apache/cloudstack/network/element/InternalLoadBalancerElementService.java
@@ -0,0 +1,56 @@
+// 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 org.apache.cloudstack.network.element;
+
+import java.util.List;
+
+
+import com.cloud.network.VirtualRouterProvider;
+import com.cloud.utils.component.PluggableService;
+
+public interface InternalLoadBalancerElementService extends PluggableService{
+    /**
+     * Configures existing Internal Load Balancer Element (enables or disables it)
+     * @param id
+     * @param enable
+     * @return
+     */
+    VirtualRouterProvider configureInternalLoadBalancerElement(long id, boolean enable);
+    
+    /**
+     * Adds Internal Load Balancer element to the Network Service Provider
+     * @param ntwkSvcProviderId
+     * @return
+     */
+    VirtualRouterProvider addInternalLoadBalancerElement(long ntwkSvcProviderId);
+    
+    /**
+     * Retrieves existing Internal Load Balancer element
+     * @param id
+     * @return
+     */
+    VirtualRouterProvider getInternalLoadBalancerElement(long id);
+    
+    /**
+     * Searches for existing Internal Load Balancer elements based on parameters passed to the call
+     * @param id
+     * @param ntwkSvsProviderId
+     * @param enabled
+     * @return
+     */
+    List<? extends VirtualRouterProvider> searchForInternalLoadBalancerElements(Long id, Long ntwkSvsProviderId, Boolean enabled);
+}


[22/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/vm/VMInstanceVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/VMInstanceVO.java b/core/src/com/cloud/vm/VMInstanceVO.java
deleted file mode 100644
index 5f93019..0000000
--- a/core/src/com/cloud/vm/VMInstanceVO.java
+++ /dev/null
@@ -1,494 +0,0 @@
-// 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;
-
-import java.util.Date;
-import java.util.Map;
-import java.util.Random;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.DiscriminatorColumn;
-import javax.persistence.DiscriminatorType;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.Id;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.utils.db.Encrypt;
-import com.cloud.utils.db.GenericDao;
-import com.cloud.utils.db.StateMachine;
-import com.cloud.utils.fsm.FiniteStateObject;
-import com.cloud.vm.VirtualMachine.State;
-
-@Entity
-@Table(name="vm_instance")
-@Inheritance(strategy=InheritanceType.JOINED)
-@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32)
-public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, VirtualMachine.Event> {
-    @Id
-    @TableGenerator(name="vm_instance_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="vm_instance_seq", allocationSize=1)
-    @Column(name="id", updatable=false, nullable = false)
-    protected long id;
-
-    @Column(name="name", updatable=false, nullable=false, length=255)
-    protected String hostName = null;
-
-    @Encrypt
-    @Column(name="vnc_password", updatable=true, nullable=false, length=255)
-    protected String vncPassword;
-
-    @Column(name="proxy_id", updatable=true, nullable=true)
-    protected Long proxyId;
-
-    @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="proxy_assign_time", updatable=true, nullable=true)
-    protected Date proxyAssignTime;
-
-    /**
-     * Note that state is intentionally missing the setter.  Any updates to
-     * the state machine needs to go through the DAO object because someone
-     * else could be updating it as well.
-     */
-    @Enumerated(value=EnumType.STRING)
-    @StateMachine(state=State.class, event=Event.class)
-    @Column(name="state", updatable=true, nullable=false, length=32)
-    protected State state = null;
-
-    @Column(name="private_ip_address", updatable=true)
-    protected String privateIpAddress;
-
-    @Column(name="instance_name", updatable=true, nullable=false)
-    protected String instanceName;
-
-    @Column(name="vm_template_id", updatable=true, nullable=true, length=17)
-    protected Long templateId = new Long(-1);
-
-    @Column(name="guest_os_id", nullable=false, length=17)
-    protected long guestOSId;
-
-    @Column(name="host_id", updatable=true, nullable=true)
-    protected Long hostId;
-
-    @Column(name="last_host_id", updatable=true, nullable=true)
-    protected Long lastHostId;
-
-    @Column(name="pod_id", updatable=true, nullable=false)
-    protected Long podIdToDeployIn;
-
-    @Column(name="private_mac_address", updatable=true, nullable=true)
-    protected String privateMacAddress;
-
-    @Column(name="data_center_id", updatable=true, nullable=false)
-    protected long dataCenterId;
-
-    @Column(name="vm_type", updatable=false, nullable=false, length=32)
-    @Enumerated(value=EnumType.STRING)
-    protected Type type;
-
-    @Column(name="ha_enabled", updatable=true, nullable=true)
-    protected boolean haEnabled;
-
-    @Column(name="display_vm", updatable=true, nullable=false)
-    protected boolean displayVm = true;
-
-    @Column(name="limit_cpu_use", updatable=true, nullable=true)
-    private boolean limitCpuUse;
-
-    @Column(name="update_count", updatable = true, nullable=false)
-    protected long updated;	// This field should be updated everytime the state is updated.  There's no set method in the vo object because it is done with in the dao code.
-
-    @Column(name=GenericDao.CREATED_COLUMN)
-    protected Date created;
-
-    @Column(name=GenericDao.REMOVED_COLUMN)
-    protected Date removed;
-
-    @Column(name="update_time", updatable=true)
-    @Temporal(value=TemporalType.TIMESTAMP)
-    protected Date updateTime;
-
-    @Column(name="domain_id")
-    protected long domainId;
-
-    @Column(name="account_id")
-    protected long accountId;
-
-    @Column(name="service_offering_id")
-    protected long serviceOfferingId;
-
-    @Column(name="reservation_id")
-    protected String reservationId;
-
-    @Column(name="hypervisor_type")
-    @Enumerated(value=EnumType.STRING)
-    protected HypervisorType hypervisorType;
-
-/*
-    @Column(name="tags")
-    protected String tags;
-*/
-    
-    @Transient
-    Map<String, String> details;
-
-    @Column(name="uuid")
-    protected String uuid = UUID.randomUUID().toString();
-    ;
-
-    @Column(name="disk_offering_id")
-    protected Long diskOfferingId;
-    
-    public VMInstanceVO(long id,
-            long serviceOfferingId,
-            String name,
-            String instanceName,
-            Type type,
-            Long vmTemplateId,
-            HypervisorType hypervisorType,
-            long guestOSId,
-            long domainId,
-            long accountId,
-            boolean haEnabled) {
-        this.id = id;
-        this.hostName = name != null ? name : this.uuid;
-        if (vmTemplateId != null) {
-            this.templateId = vmTemplateId;
-        }
-        this.instanceName = instanceName;
-        this.type = type;
-        this.guestOSId = guestOSId;
-        this.haEnabled = haEnabled;
-        this.vncPassword = Long.toHexString(new Random().nextLong());
-        this.state = State.Stopped;
-        this.accountId = accountId;
-        this.domainId = domainId;
-        this.serviceOfferingId = serviceOfferingId;
-        this.hypervisorType = hypervisorType;
-        this.limitCpuUse = false;
-    }
-
-    public VMInstanceVO(long id,
-            long serviceOfferingId,
-            String name,
-            String instanceName,
-            Type type,
-            Long vmTemplateId,
-            HypervisorType hypervisorType,
-            long guestOSId,
-            long domainId,
-            long accountId,
-            boolean haEnabled,
-            boolean limitResourceUse, Long diskOfferingId) {
-        this(id, serviceOfferingId, name, instanceName, type, vmTemplateId, hypervisorType, guestOSId, domainId, accountId, haEnabled);
-        this.limitCpuUse = limitResourceUse;
-        this.diskOfferingId = diskOfferingId;
-    }
-
-    protected VMInstanceVO() {
-    }
-
-    public Date getRemoved() {
-        return removed;
-    }
-
-    @Override
-    public long getDomainId() {
-        return domainId;
-    }
-
-    @Override
-    public long getAccountId() {
-        return accountId;
-    }
-
-    @Override
-    public Type getType() {
-        return type;
-    }
-
-    public long getUpdated() {
-        return updated;
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-
-    @Override
-    public String getUuid() {
-        return uuid;
-    }
-
-    public void setUuid(String uuid) {
-        this.uuid = uuid;
-    }
-
-    @Override
-    public HypervisorType getHypervisorType() {
-        return hypervisorType;
-    }
-
-    @Override
-    public Date getCreated() {
-        return created;
-    }
-
-    public Date getUpdateTime() {
-        return updateTime;
-    }
-
-    @Override
-    public long getDataCenterId() {
-        return dataCenterId;
-    }
-
-    @Override
-    public String getHostName() {
-        return hostName;
-    }
-
-    @Override
-    public String getInstanceName() {
-        return instanceName;
-    }
-
-    @Override
-    public State getState() {
-        return state;
-    }
-
-    // don't use this directly, use VM state machine instead, this method is added for migration tool only
-    @Override
-    public void setState(State state) {
-        this.state = state;
-    }
-
-    @Override
-    public String getPrivateIpAddress() {
-        return privateIpAddress;
-    }
-
-    public void setPrivateIpAddress(String address) {
-        privateIpAddress = address;
-    }
-
-    public void setVncPassword(String vncPassword) {
-        this.vncPassword = vncPassword;
-    }
-
-    @Override
-    public String getVncPassword() {
-        return vncPassword;
-    }
-
-    @Override
-    public long getServiceOfferingId() {
-        return serviceOfferingId;
-    }
-
-    public Long getProxyId() {
-        return proxyId;
-    }
-
-    public void setProxyId(Long proxyId) {
-        this.proxyId = proxyId;
-    }
-
-    public Date getProxyAssignTime() {
-        return this.proxyAssignTime;
-    }
-
-    public void setProxyAssignTime(Date time) {
-        this.proxyAssignTime = time;
-    }
-
-    @Override
-    public long getTemplateId() {
-        if (templateId == null) {
-            return -1;
-        } else {
-            return templateId;
-        }
-    }
-
-    public void setTemplateId(Long templateId) {
-        this.templateId = templateId;
-    }
-
-    @Override
-    public long getGuestOSId() {
-        return guestOSId;
-    }
-
-    public void setGuestOSId(long guestOSId) {
-        this.guestOSId = guestOSId;
-    }
-
-    public void incrUpdated() {
-        updated++;
-    }
-
-    public void decrUpdated() {
-        updated--;
-    }
-
-    @Override
-    public Long getHostId() {
-        return hostId;
-    }
-
-    @Override
-    public Long getLastHostId() {
-        return lastHostId;
-    }
-
-    public void setLastHostId(Long lastHostId) {
-        this.lastHostId = lastHostId;
-    }
-
-    public void setHostId(Long hostId) {
-        this.hostId = hostId;
-    }
-
-    @Override
-    public boolean isHaEnabled() {
-        return haEnabled;
-    }
-
-    public boolean isDisplayVm() {
-        return displayVm;
-    }
-
-    public void setDisplayVm(boolean displayVm) {
-        this.displayVm = displayVm;
-    }
-
-    @Override
-    public boolean limitCpuUse() {
-        return limitCpuUse;
-    }
-
-    public void setLimitCpuUse(boolean value) {
-        limitCpuUse = value;
-    }
-
-    @Override
-    public String getPrivateMacAddress() {
-        return privateMacAddress;
-    }
-
-    @Override
-    public Long getPodIdToDeployIn() {
-        return podIdToDeployIn;
-    }
-
-    public void setPodId(long podId) {
-        this.podIdToDeployIn = podId;
-    }
-
-    public void setPrivateMacAddress(String privateMacAddress) {
-        this.privateMacAddress = privateMacAddress;
-    }
-
-    public void setDataCenterId(long dataCenterId) {
-        this.dataCenterId = dataCenterId;
-    }
-
-    public boolean isRemoved() {
-        return removed != null;
-    }
-
-    public void setHaEnabled(boolean value) {
-        haEnabled = value;
-    }
-
-    public void setReservationId(String reservationId) {
-        this.reservationId = reservationId;
-    }
-
-    public String getReservationId() {
-        return this.reservationId;
-    }
-
-    @Override
-    public Map<String, String> getDetails() {
-        return details;
-    }
-
-    public void setDetail(String name, String value) {
-        assert (details != null) : "Did you forget to load the details?";
-
-        details.put(name, value);
-    }
-
-    public void setDetails(Map<String, String> details) {
-        this.details = details;
-    }
-
-    transient String toString;
-    @Override
-    public String toString() {
-        if (toString == null) {
-            toString = new StringBuilder("VM[").append(type.toString()).append("|").append(hostName).append("]").toString();
-        }
-        return toString;
-    }
-
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + (int) (id ^ (id >>> 32));
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj)
-            return true;
-        if (obj == null)
-            return false;
-        if (getClass() != obj.getClass())
-            return false;
-        VMInstanceVO other = (VMInstanceVO) obj;
-        if (id != other.id)
-            return false;
-        return true;
-    }
-
-
-    public void setServiceOfferingId(long serviceOfferingId) {
-        this.serviceOfferingId = serviceOfferingId;
-    }
-
-	@Override
-	public Long getDiskOfferingId() {
-		return diskOfferingId;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/vm/VirtualDisk.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/VirtualDisk.java b/core/src/com/cloud/vm/VirtualDisk.java
deleted file mode 100644
index ad7bb43..0000000
--- a/core/src/com/cloud/vm/VirtualDisk.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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;
-
-import com.cloud.storage.Storage;
-
-/**
- * VirtualDisk describes the disks that are plugged into
- * the virtual machine.
- *
- */
-public class VirtualDisk {
-    public Storage.ImageFormat format;
-    public String url;
-    public boolean bootable;
-    public long size;
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/vm/VirtualMachineName.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/VirtualMachineName.java b/core/src/com/cloud/vm/VirtualMachineName.java
deleted file mode 100755
index 81838b9..0000000
--- a/core/src/com/cloud/vm/VirtualMachineName.java
+++ /dev/null
@@ -1,190 +0,0 @@
-// 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;
-
-import java.util.Formatter;
-
-import com.cloud.dc.Vlan;
-
-/**
- * VM Name. 
- */
-public class VirtualMachineName {
-    public static final String SEPARATOR = "-";
-    
-    public static String getVnetName(long vnetId) {
-        StringBuilder vnet = new StringBuilder();
-        Formatter formatter = new Formatter(vnet);
-        formatter.format("%04x", vnetId);
-        return vnet.toString();
-    }
-    
-    public static boolean isValidVmName(String vmName) {
-        return isValidVmName(vmName, null);
-    }
-    
-    public static boolean isValidVmName(String vmName, String instance) {
-        String[] tokens = vmName.split(SEPARATOR);
-        /*Some vms doesn't have vlan/vnet id*/
-        if (tokens.length != 5 && tokens.length != 4) {
-            return false;
-        }
-
-        if (!tokens[0].equals("i")) {
-            return false;
-        }
-        
-        try {
-            Long.parseLong(tokens[1]);
-            Long.parseLong(tokens[2]);
-            if (tokens.length == 5 && !Vlan.UNTAGGED.equalsIgnoreCase(tokens[4])) {
-            	Long.parseLong(tokens[4], 16);
-            }
-        } catch (NumberFormatException e) {
-            return false;
-        }
-        
-        return instance == null || instance.equals(tokens[3]);
-    }
-    
-    public static String getVmName(long vmId, long userId, String instance) {
-        StringBuilder vmName = new StringBuilder("i");
-        vmName.append(SEPARATOR).append(userId).append(SEPARATOR).append(vmId);
-        vmName.append(SEPARATOR).append(instance);
-        return vmName.toString();
-    }
-    
-    public static long getVmId(String vmName) {
-        int begin = vmName.indexOf(SEPARATOR);
-        begin = vmName.indexOf(SEPARATOR, begin + SEPARATOR.length());
-        int end = vmName.indexOf(SEPARATOR, begin + SEPARATOR.length());
-        return Long.parseLong(vmName.substring(begin + 1, end));
-    }
-    
-    public static long getRouterId(String routerName) {
-        int begin = routerName.indexOf(SEPARATOR);
-        int end = routerName.indexOf(SEPARATOR, begin + SEPARATOR.length());
-        return Long.parseLong(routerName.substring(begin + 1, end));
-    }
-    
-    public static long getConsoleProxyId(String vmName) {
-        int begin = vmName.indexOf(SEPARATOR);
-        int end = vmName.indexOf(SEPARATOR, begin + SEPARATOR.length());
-        return Long.parseLong(vmName.substring(begin + 1, end));
-    }
-    
-    public static long getSystemVmId(String vmName) {
-        int begin = vmName.indexOf(SEPARATOR);
-        int end = vmName.indexOf(SEPARATOR, begin + SEPARATOR.length());
-        return Long.parseLong(vmName.substring(begin + 1, end));
-    }
-    
-    public static String getVnet(String vmName) {
-        return vmName.substring(vmName.lastIndexOf(SEPARATOR) + SEPARATOR.length());
-    }
-    
-    public static String getRouterName(long routerId, String instance) {
-        StringBuilder builder = new StringBuilder("r");
-        builder.append(SEPARATOR).append(routerId).append(SEPARATOR).append(instance);
-        return builder.toString();
-    }
-    
-    public static String getConsoleProxyName(long vmId, String instance) {
-        StringBuilder builder = new StringBuilder("v");
-        builder.append(SEPARATOR).append(vmId).append(SEPARATOR).append(instance);
-        return builder.toString();
-    }
-    
-    public static String getSystemVmName(long vmId, String instance, String prefix) {
-        StringBuilder builder = new StringBuilder(prefix);
-        builder.append(SEPARATOR).append(vmId).append(SEPARATOR).append(instance);
-        return builder.toString();
-    }
-    
-    public static String attachVnet(String name, String vnet) {
-        return name + SEPARATOR + vnet;
-    }
-    
-    public static boolean isValidRouterName(String name) {
-        return isValidRouterName(name, null);
-    }
-    
-    public static boolean isValidRouterName(String name, String instance) {
-        String[] tokens = name.split(SEPARATOR);
-        if (tokens.length != 3 && tokens.length != 4 ) {
-            return false;
-        }
-        
-        if (!tokens[0].equals("r")) {
-            return false;
-        }
-        
-        try {
-            Long.parseLong(tokens[1]);
-        } catch (NumberFormatException ex) {
-            return false;
-        }
-        
-        return instance == null || tokens[2].equals(instance);
-    }
-    
-    public static boolean isValidConsoleProxyName(String name) {
-    	return isValidConsoleProxyName(name, null);
-    }
-    
-    public static boolean isValidConsoleProxyName(String name, String instance) {
-        String[] tokens = name.split(SEPARATOR);
-        if (tokens.length != 3) {
-            return false;
-        }
-        
-        if (!tokens[0].equals("v")) {
-            return false;
-        }
-        
-        try {
-            Long.parseLong(tokens[1]);
-        } catch (NumberFormatException ex) {
-            return false;
-        }
-        
-        return instance == null || tokens[2].equals(instance);
-    }
-    
-    public static boolean isValidSecStorageVmName(String name, String instance) {
-    	return isValidSystemVmName(name, instance, "s");
-    }
-    
-    public static boolean isValidSystemVmName(String name, String instance, String prefix) {
-        String[] tokens = name.split(SEPARATOR);
-        if (tokens.length != 3) {
-            return false;
-        }
-        
-        if (!tokens[0].equals(prefix)) {
-            return false;
-        }
-        
-        try {
-            Long.parseLong(tokens[1]);
-        } catch (NumberFormatException ex) {
-            return false;
-        }
-        
-        return instance == null || tokens[2].equals(instance);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/vm/VmDetailConstants.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/VmDetailConstants.java b/core/src/com/cloud/vm/VmDetailConstants.java
deleted file mode 100644
index 5ff3ce0..0000000
--- a/core/src/com/cloud/vm/VmDetailConstants.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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;
-
-public interface VmDetailConstants {
-	public static final String KEYBOARD = "keyboard";
-	public static final String NIC_ADAPTER = "nicAdapter";
-	public static final String ROOK_DISK_CONTROLLER = "rootDiskController";
-	public static final String NESTED_VIRTUALIZATION_FLAG = "nestedVirtualizationFlag";
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/vm/snapshot/VMSnapshotVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/snapshot/VMSnapshotVO.java b/core/src/com/cloud/vm/snapshot/VMSnapshotVO.java
deleted file mode 100644
index 03d4945..0000000
--- a/core/src/com/cloud/vm/snapshot/VMSnapshotVO.java
+++ /dev/null
@@ -1,224 +0,0 @@
-// 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.snapshot;
-
-import java.util.Date;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import com.cloud.utils.db.GenericDao;
-
-@Entity
-@Table(name = "vm_snapshots")
-public class VMSnapshotVO implements VMSnapshot {
-    @Id
-    @TableGenerator(name = "vm_snapshots_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "vm_snapshots_seq", allocationSize = 1)
-    @GeneratedValue(strategy = GenerationType.TABLE)
-    @Column(name = "id")
-    long id;
-
-    @Column(name = "uuid")
-    String uuid = UUID.randomUUID().toString();
-
-    @Column(name = "name")
-    String name;
-
-    @Column(name = "display_name")
-    String displayName;
-
-    @Column(name = "description")
-    String description;
-
-    @Column(name = "vm_id")
-    long vmId;
-
-    @Column(name = "account_id")
-    long accountId;
-
-    @Column(name = "domain_id")
-    long domainId;
-
-    @Column(name = "vm_snapshot_type")
-    @Enumerated(EnumType.STRING)
-    VMSnapshot.Type type;
-
-    @Column(name = "state", updatable = true, nullable = false)
-    @Enumerated(value = EnumType.STRING)
-    private State state;
-
-    @Column(name = GenericDao.CREATED_COLUMN)
-    Date created;
-
-    @Column(name = GenericDao.REMOVED_COLUMN)
-    Date removed;
-
-    @Column(name = "current")
-    Boolean current;
-    
-    @Column(name = "parent")
-    Long parent;
-    
-    @Column(name = "updated")
-    @Temporal(value = TemporalType.TIMESTAMP)
-    Date updated;
-    
-    @Column(name="update_count", updatable = true, nullable=false)
-    protected long updatedCount;
-    
-    public Long getParent() {
-		return parent;
-	}
-
-	public void setParent(Long parent) {
-		this.parent = parent;
-	}
-
-	public VMSnapshotVO() {
-
-    }
-
-    public Date getRemoved() {
-        return removed;
-    }
-
-    public VMSnapshotVO(Long accountId, Long domainId, Long vmId,
-            String description, String vmSnapshotName, String vsDisplayName,
-            Long serviceOfferingId, Type type, Boolean current) {
-        this.accountId = accountId;
-        this.domainId = domainId;
-        this.vmId = vmId;
-        this.state = State.Allocated;
-        this.description = description;
-        this.name = vmSnapshotName;
-        this.displayName = vsDisplayName;
-        this.type = type;
-        this.current = current;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public Date getCreated() {
-        return created;
-    }
-
-    public void setCreated(Date created) {
-        this.created = created;
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-
-    @Override
-    public Long getVmId() {
-        return vmId;
-    }
-
-    public void setVmId(Long vmId) {
-        this.vmId = vmId;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    @Override
-    public State getState() {
-        return state;
-    }
-
-    public void setState(State state) {
-        this.state = state;
-    }
-
-    @Override
-    public String getUuid() {
-        return uuid;
-    }
-
-    @Override
-    public long getAccountId() {
-        return accountId;
-    }
-
-    @Override
-    public long getDomainId() {
-        return domainId;
-    }
-
-    @Override
-    public String getDisplayName() {
-        return displayName;
-    }
-
-    public void setDisplayName(String displayName) {
-        this.displayName = displayName;
-    }
-
-	public Boolean getCurrent() {
-		return current;
-	}
-
-	public void setCurrent(Boolean current) {
-		this.current = current;
-	}
-
-    @Override
-    public long getUpdatedCount() {
-        return updatedCount;
-    }
-
-    @Override
-    public void incrUpdatedCount() {
-        this.updatedCount++;
-    }
-
-    @Override
-    public Date getUpdated() {
-        return updated;
-    }
-
-    @Override
-    public Type getType() {
-        return type;
-    }
-    
-    public void setRemoved(Date removed) {
-        this.removed = removed;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/AgentControlAnswerTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/AgentControlAnswerTest.java b/core/test/org/apache/cloudstack/api/agent/test/AgentControlAnswerTest.java
new file mode 100644
index 0000000..d0e8b4c
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/AgentControlAnswerTest.java
@@ -0,0 +1,35 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertFalse;
+
+import org.junit.Test;
+
+import com.cloud.agent.api.AgentControlAnswer;
+import com.cloud.agent.api.AgentControlCommand;
+
+public class AgentControlAnswerTest {
+    AgentControlCommand acc = new AgentControlCommand();
+    AgentControlAnswer aca = new AgentControlAnswer(acc);
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = acc.executeInSequence();
+        assertFalse(b);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/AgentControlCommandTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/AgentControlCommandTest.java b/core/test/org/apache/cloudstack/api/agent/test/AgentControlCommandTest.java
new file mode 100644
index 0000000..24d0fe5
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/AgentControlCommandTest.java
@@ -0,0 +1,33 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertFalse;
+
+import org.junit.Test;
+
+import com.cloud.agent.api.AgentControlCommand;
+
+public class AgentControlCommandTest {
+    AgentControlCommand acc = new AgentControlCommand();
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = acc.executeInSequence();
+        assertFalse(b);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/AnswerTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/AnswerTest.java b/core/test/org/apache/cloudstack/api/agent/test/AnswerTest.java
new file mode 100644
index 0000000..343a3ce
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/AnswerTest.java
@@ -0,0 +1,73 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.cloud.agent.api.AgentControlCommand;
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.UnsupportedAnswer;
+
+public class AnswerTest {
+    AgentControlCommand acc = new AgentControlCommand();
+    Answer a = new Answer(acc, true, "details");
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = a.executeInSequence();
+        assertFalse(b);
+    }
+
+    @Test
+    public void testGetResult() {
+        boolean b = a.getResult();
+        assertTrue(b);
+    }
+
+    @Test
+    public void testGetDetails() {
+        String d = a.getDetails();
+        assertTrue(d.equals("details"));
+    }
+
+    @Test
+    public void testCreateUnsupportedCommandAnswer() {
+        UnsupportedAnswer usa = Answer.createUnsupportedCommandAnswer(acc);
+        boolean b = usa.executeInSequence();
+        assertFalse(b);
+
+        b = usa.getResult();
+        assertFalse(b);
+
+        String d = usa.getDetails();
+        assertTrue(d.equals("Unsupported command issued:" + acc.toString()
+                + ".  Are you sure you got the right type of server?"));
+
+        usa = Answer.createUnsupportedVersionAnswer(acc);
+        b = usa.executeInSequence();
+        assertFalse(b);
+
+        b = usa.getResult();
+        assertFalse(b);
+
+        d = usa.getDetails();
+        assertTrue(d.equals("Unsuppored Version."));
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/AttachIsoCommandTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/AttachIsoCommandTest.java b/core/test/org/apache/cloudstack/api/agent/test/AttachIsoCommandTest.java
new file mode 100644
index 0000000..d189d9c
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/AttachIsoCommandTest.java
@@ -0,0 +1,80 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.cloud.agent.api.AttachIsoCommand;
+
+public class AttachIsoCommandTest {
+    AttachIsoCommand aic = new AttachIsoCommand("vmname", "isopath", false);
+
+    @Test
+    public void testGetVmName() {
+        String vmName = aic.getVmName();
+        assertTrue(vmName.equals("vmname"));
+    }
+
+    @Test
+    public void testGetIsoPath() {
+        String isoPath = aic.getIsoPath();
+        assertTrue(isoPath.equals("isopath"));
+    }
+
+    @Test
+    public void testIsAttach() {
+        boolean b = aic.isAttach();
+        assertFalse(b);
+    }
+
+    @Test
+    public void testGetStoreUrl() {
+        aic.setStoreUrl("http://incubator.apache.org/cloudstack/");
+        String url = aic.getStoreUrl();
+        assertTrue(url.equals("http://incubator.apache.org/cloudstack/"));
+    }
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = aic.executeInSequence();
+        assertTrue(b);
+    }
+
+    @Test
+    public void testAllowCaching() {
+        boolean b = aic.allowCaching();
+        assertTrue(b);
+    }
+
+    @Test
+    public void testGetWait() {
+        int b;
+        aic.setWait(5);
+        b = aic.getWait();
+        assertEquals(b, 5);
+        aic.setWait(-3);
+        b = aic.getWait();
+        assertEquals(b, -3);
+        aic.setWait(0);
+        b = aic.getWait();
+        assertEquals(b, 0);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java b/core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java
new file mode 100644
index 0000000..251a6cb
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java
@@ -0,0 +1,65 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.cloud.agent.api.AttachVolumeAnswer;
+import com.cloud.agent.api.AttachVolumeCommand;
+import com.cloud.storage.Storage.StoragePoolType;
+
+public class AttachVolumeAnswerTest {
+    AttachVolumeCommand avc = new AttachVolumeCommand(true, "vmname",
+            StoragePoolType.Filesystem, "vFolder", "vPath", "vName",
+            123456789L, "chainInfo");
+    AttachVolumeAnswer ava1 = new AttachVolumeAnswer(avc);
+    String results = "";
+    AttachVolumeAnswer ava2 = new AttachVolumeAnswer(avc, results);
+    Long deviceId = 10L;
+    AttachVolumeAnswer ava3 = new AttachVolumeAnswer(avc, deviceId);
+
+    @Test
+    public void testGetDeviceId() {
+        Long dId = ava1.getDeviceId();
+        assertTrue(dId == null);
+
+        dId = ava2.getDeviceId();
+        assertTrue(dId == null);
+
+        dId = ava3.getDeviceId();
+        Long expected = 10L;
+        assertEquals(expected, dId);
+    }
+
+    @Test
+    public void testGetChainInfo() {
+        ava1.setChainInfo("chainInfo");
+        String chainInfo = ava1.getChainInfo();
+        assertTrue(chainInfo.equals("chainInfo"));
+
+        ava2.setChainInfo("chainInfo");
+        chainInfo = ava2.getChainInfo();
+        assertTrue(chainInfo.equals("chainInfo"));
+
+        ava3.setChainInfo("chainInfo");
+        chainInfo = ava3.getChainInfo();
+        assertTrue(chainInfo.equals("chainInfo"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java b/core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java
new file mode 100644
index 0000000..1ec416a
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java
@@ -0,0 +1,120 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.cloud.agent.api.AttachVolumeCommand;
+import com.cloud.storage.Storage.StoragePoolType;
+
+public class AttachVolumeCommandTest {
+    AttachVolumeCommand avc = new AttachVolumeCommand(true, "vmname",
+            StoragePoolType.Filesystem, "vFolder", "vPath", "vName",
+            123456789L, "chainInfo");
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = avc.executeInSequence();
+        assertTrue(b);
+    }
+
+    @Test
+    public void testGetAttach() {
+        boolean b = avc.getAttach();
+        assertTrue(b);
+    }
+
+    @Test
+    public void testGetVmName() {
+        String vmName = avc.getVmName();
+        assertTrue(vmName.equals("vmname"));
+    }
+
+    @Test
+    public void testGetPooltype() {
+        StoragePoolType pt = avc.getPooltype();
+        assertTrue(pt.equals(StoragePoolType.Filesystem));
+
+        avc.setPooltype(StoragePoolType.NetworkFilesystem);
+        pt = avc.getPooltype();
+        assertTrue(pt.equals(StoragePoolType.NetworkFilesystem));
+
+        avc.setPooltype(StoragePoolType.IscsiLUN);
+        pt = avc.getPooltype();
+        assertTrue(pt.equals(StoragePoolType.IscsiLUN));
+
+        avc.setPooltype(StoragePoolType.Iscsi);
+        pt = avc.getPooltype();
+        assertTrue(pt.equals(StoragePoolType.Iscsi));
+    }
+
+    @Test
+    public void testGetVolumeFolder() {
+        String vFolder = avc.getVolumeFolder();
+        assertTrue(vFolder.equals("vFolder"));
+    }
+
+    @Test
+    public void testGetVolumePath() {
+        String vPath = avc.getVolumePath();
+        assertTrue(vPath.equals("vPath"));
+    }
+
+    @Test
+    public void testGetVolumeName() {
+        String vName = avc.getVolumeName();
+        assertTrue(vName.equals("vName"));
+    }
+
+    @Test
+    public void testGetDeviceId() {
+        Long dId = avc.getDeviceId();
+        Long expected = 123456789L;
+        assertEquals(expected, dId);
+
+        avc.setDeviceId(5L);
+        dId = avc.getDeviceId();
+        expected = 5L;
+        assertEquals(expected, dId);
+
+        avc.setDeviceId(0L);
+        dId = avc.getDeviceId();
+        expected = 0L;
+        assertEquals(expected, dId);
+
+        avc.setDeviceId(-5L);
+        dId = avc.getDeviceId();
+        expected = -5L;
+        assertEquals(expected, dId);
+    }
+
+    @Test
+    public void testGetPoolUuid() {
+        avc.setPoolUuid("420fa39c-4ef1-a83c-fd93-46dc1ff515ae");
+        String pUuid = avc.getPoolUuid();
+        assertTrue(pUuid.equals("420fa39c-4ef1-a83c-fd93-46dc1ff515ae"));
+    }
+
+    @Test
+    public void testGetWait() {
+        String cInfo = avc.getChainInfo();
+        assertTrue(cInfo.equals("chainInfo"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/BackupSnapshotAnswerTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/BackupSnapshotAnswerTest.java b/core/test/org/apache/cloudstack/api/agent/test/BackupSnapshotAnswerTest.java
new file mode 100644
index 0000000..7fd6e0b
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/BackupSnapshotAnswerTest.java
@@ -0,0 +1,75 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import com.cloud.agent.api.BackupSnapshotAnswer;
+import com.cloud.agent.api.BackupSnapshotCommand;
+import com.cloud.storage.StoragePool;
+
+public class BackupSnapshotAnswerTest {
+    private BackupSnapshotCommand bsc;
+    private BackupSnapshotAnswer bsa;
+
+    @Before
+    public void setUp() {
+
+        StoragePool pool = Mockito.mock(StoragePool.class);
+
+        bsc = new BackupSnapshotCommand(
+                "secondaryStoragePoolURL", 101L, 102L, 103L, 104L, 105L,
+                "volumePath", pool, "snapshotUuid", "snapshotName",
+                "prevSnapshotUuid", "prevBackupUuid", false, "vmName", 5);
+        bsa = new BackupSnapshotAnswer(bsc, true, "results", "bussname", false);
+    }
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = bsa.executeInSequence();
+        assertFalse(b);
+    }
+
+    @Test
+    public void testIsFull() {
+        boolean b = bsa.isFull();
+        assertFalse(b);
+    }
+
+    @Test
+    public void testGetBackupSnapshotName() {
+        String name = bsa.getBackupSnapshotName();
+        assertTrue(name.equals("bussname"));
+    }
+
+    @Test
+    public void testGetResult() {
+        boolean b = bsa.getResult();
+        assertTrue(b);
+    }
+
+    @Test
+    public void testDetails() {
+        String details = bsa.getDetails();
+        assertTrue(details.equals("results"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/BackupSnapshotCommandTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/BackupSnapshotCommandTest.java b/core/test/org/apache/cloudstack/api/agent/test/BackupSnapshotCommandTest.java
new file mode 100644
index 0000000..44d53aa
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/BackupSnapshotCommandTest.java
@@ -0,0 +1,301 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.junit.Test;
+
+import com.cloud.agent.api.BackupSnapshotCommand;
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.agent.api.to.SwiftTO;
+import com.cloud.storage.Storage.StoragePoolType;
+import com.cloud.storage.StoragePool;
+import com.cloud.storage.StoragePoolStatus;
+
+public class BackupSnapshotCommandTest {
+    public StoragePool pool = new StoragePool() {
+        @Override
+        public long getId() {
+            return 1L;
+        };
+
+        @Override
+        public String getName() {
+            return "name";
+        };
+
+        @Override
+        public String getUuid() {
+            return "bed9f83e-cac3-11e1-ac8a-0050568b007e";
+        };
+
+        @Override
+        public StoragePoolType getPoolType() {
+            return StoragePoolType.Filesystem;
+        };
+
+        @Override
+        public Date getCreated() {
+            Date date = null;
+            try {
+                date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
+                .parse("01/01/1970 12:12:12");
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            return date;
+        }
+
+        @Override
+        public Date getUpdateTime() {
+            return new Date();
+        };
+
+        @Override
+        public long getDataCenterId() {
+            return 0L;
+        };
+
+        @Override
+        public long getCapacityBytes() {
+            return 0L;
+        };
+
+        @Override
+        public long getAvailableBytes() {
+            return 0L;
+        };
+
+        @Override
+        public Long getClusterId() {
+            return 0L;
+        };
+
+        @Override
+        public String getHostAddress() {
+            return "hostAddress";
+        };
+
+        @Override
+        public String getPath() {
+            return "path";
+        };
+
+        @Override
+        public String getUserInfo() {
+            return "userInfo";
+        };
+
+        @Override
+        public boolean isShared() {
+            return false;
+        };
+
+        @Override
+        public boolean isLocal() {
+            return false;
+        };
+
+        @Override
+        public StoragePoolStatus getStatus() {
+            return StoragePoolStatus.Up;
+        };
+
+        @Override
+        public int getPort() {
+            return 25;
+        };
+
+        @Override
+        public Long getPodId() {
+            return 0L;
+        }
+
+        @Override
+        public String getStorageProviderName() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        @Override
+        public boolean isInMaintenance() {
+            // TODO Auto-generated method stub
+            return false;
+        };
+    };
+
+    BackupSnapshotCommand bsc = new BackupSnapshotCommand(
+            "http://secondary.Storage.Url",
+            101L, 102L, 103L, 104L, 105L, "vPath", pool,
+            "420fa39c-4ef1-a83c-fd93-46dc1ff515ae", "sName",
+            "9012793e-0657-11e2-bebc-0050568b0057",
+            "7167e0b2-f5b0-11e1-8414-0050568b0057", false, "vmName", 5);
+
+    BackupSnapshotCommand bsc1 = new BackupSnapshotCommand(
+            "http://secondary.Storage.Url",
+            101L, 102L, 103L, 104L, 105L,"vPath", pool,
+            "420fa39c-4ef1-a83c-fd93-46dc1ff515ae", "sName",
+            "9012793e-0657-11e2-bebc-0050568b0057",
+            "7167e0b2-f5b0-11e1-8414-0050568b0057", false, "vmName", 5);
+
+    @Test
+    public void testGetPrimaryStoragePoolNameLabel() {
+        String label = bsc.getPrimaryStoragePoolNameLabel();
+        assertTrue(label.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e"));
+    }
+
+    @Test
+    public void testGetSecondaryStorageUrl() {
+        String url = bsc.getSecondaryStorageUrl();
+        assertTrue(url.equals("http://secondary.Storage.Url"));
+    }
+
+    @Test
+    public void testGetDataCenterId() {
+        Long dcId = bsc.getDataCenterId();
+        Long expected = 101L;
+        assertEquals(expected, dcId);
+    }
+
+    @Test
+    public void testGetAccountId() {
+        Long aId = bsc.getAccountId();
+        Long expected = 102L;
+        assertEquals(expected, aId);
+    }
+
+    @Test
+    public void testGetVolumeId() {
+        Long vId = bsc.getVolumeId();
+        Long expected = 103L;
+        assertEquals(expected, vId);
+    }
+
+    @Test
+    public void testGetSnapshotId() {
+        Long ssId = bsc.getSnapshotId();
+        Long expected = 104L;
+        assertEquals(expected, ssId);
+    }
+
+    @Test
+    public void testGetPool() {
+        StorageFilerTO pool = bsc.getPool();
+
+        Long id = pool.getId();
+        Long expectedL = 1L;
+        assertEquals(expectedL, id);
+
+        String uuid = pool.getUuid();
+        assertTrue(uuid.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e"));
+
+        String host = pool.getHost();
+        assertTrue(host.equals("hostAddress"));
+
+        String path = pool.getPath();
+        assertTrue(path.equals("path"));
+
+        String userInfo = pool.getUserInfo();
+        assertTrue(userInfo.equals("userInfo"));
+
+        Integer port = pool.getPort();
+        Integer expectedI = 25;
+        assertEquals(expectedI, port);
+
+        StoragePoolType type = pool.getType();
+        assertEquals(StoragePoolType.Filesystem, type);
+
+        String str = pool.toString();
+        assertTrue(str.equals("Pool[" + id.toString() + "|" + host + ":"
+                + port.toString() + "|" + path + "]"));
+    }
+
+    @Test
+    public void testGetCreated() {
+        try {
+            Date date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
+            .parse("01/01/1970 12:12:12");
+            Date d = pool.getCreated();
+            assertTrue(d.compareTo(date) == 0);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testGetSwift() {
+        SwiftTO s1 = new SwiftTO();
+        bsc.setSwift(s1);
+        SwiftTO s2 = bsc.getSwift();
+        assertEquals(s1, s2);
+    }
+
+    @Test
+    public void testGetSnapshotName() {
+        String ssName = bsc.getSnapshotName();
+        assertTrue(ssName.equals("sName"));
+    }
+
+    @Test
+    public void testGetSnapshotUuid() {
+        String uuid = bsc.getSnapshotUuid();
+        assertTrue(uuid.equals("420fa39c-4ef1-a83c-fd93-46dc1ff515ae"));
+    }
+
+    @Test
+    public void testGetPrevSnapshotUuid() {
+        String uuid = bsc.getPrevSnapshotUuid();
+        assertTrue(uuid.equals("9012793e-0657-11e2-bebc-0050568b0057"));
+    }
+
+    @Test
+    public void testGetPrevBackupUuid() {
+        String uuid = bsc.getPrevBackupUuid();
+        assertTrue(uuid.equals("7167e0b2-f5b0-11e1-8414-0050568b0057"));
+    }
+
+    @Test
+    public void testGetVolumePath() {
+        String path = bsc.getVolumePath();
+        assertTrue(path.equals("vPath"));
+
+        bsc.setVolumePath("vPath1");
+        path = bsc.getVolumePath();
+        assertTrue(path.equals("vPath1"));
+
+        bsc1.setVolumePath("vPath2");
+        path = bsc1.getVolumePath();
+        assertTrue(path.equals("vPath2"));
+    }
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = bsc.executeInSequence();
+        assertFalse(b);
+
+        b = bsc1.executeInSequence();
+        assertFalse(b);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/BumpUpPriorityCommandTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/BumpUpPriorityCommandTest.java b/core/test/org/apache/cloudstack/api/agent/test/BumpUpPriorityCommandTest.java
new file mode 100644
index 0000000..f5f5985
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/BumpUpPriorityCommandTest.java
@@ -0,0 +1,83 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.cloud.agent.api.BumpUpPriorityCommand;
+import com.cloud.agent.api.routing.NetworkElementCommand;
+
+public class BumpUpPriorityCommandTest {
+
+    BumpUpPriorityCommand bupc = new BumpUpPriorityCommand();
+
+    // test super class
+    @Test
+    public void testSuperGetAccessDetail() {
+        String value;
+        bupc.setAccessDetail(NetworkElementCommand.ACCOUNT_ID, "accountID");
+        value = bupc.getAccessDetail(NetworkElementCommand.ACCOUNT_ID);
+        assertTrue(value.equals("accountID"));
+
+        bupc.setAccessDetail(NetworkElementCommand.GUEST_NETWORK_CIDR,
+                "GuestNetworkCIDR");
+        value = bupc.getAccessDetail(NetworkElementCommand.GUEST_NETWORK_CIDR);
+        assertTrue(value.equals("GuestNetworkCIDR"));
+
+        bupc.setAccessDetail(NetworkElementCommand.GUEST_NETWORK_GATEWAY,
+                "GuestNetworkGateway");
+        value = bupc
+                .getAccessDetail(NetworkElementCommand.GUEST_NETWORK_GATEWAY);
+        assertTrue(value.equals("GuestNetworkGateway"));
+
+        bupc.setAccessDetail(NetworkElementCommand.GUEST_VLAN_TAG,
+                "GuestVlanTag");
+        value = bupc.getAccessDetail(NetworkElementCommand.GUEST_VLAN_TAG);
+        assertTrue(value.equals("GuestVlanTag"));
+
+        bupc.setAccessDetail(NetworkElementCommand.ROUTER_NAME, "RouterName");
+        value = bupc.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
+        assertTrue(value.equals("RouterName"));
+
+        bupc.setAccessDetail(NetworkElementCommand.ROUTER_IP, "RouterIP");
+        value = bupc.getAccessDetail(NetworkElementCommand.ROUTER_IP);
+        assertTrue(value.equals("RouterIP"));
+
+        bupc.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP,
+                "RouterGuestIP");
+        value = bupc.getAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP);
+        assertTrue(value.equals("RouterGuestIP"));
+
+        bupc.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE,
+                "ZoneNetworkType");
+        value = bupc.getAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE);
+        assertTrue(value.equals("ZoneNetworkType"));
+
+        bupc.setAccessDetail(NetworkElementCommand.GUEST_BRIDGE, "GuestBridge");
+        value = bupc.getAccessDetail(NetworkElementCommand.GUEST_BRIDGE);
+        assertTrue(value.equals("GuestBridge"));
+    }
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = bupc.executeInSequence();
+        assertFalse(b);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/CancelCommandTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/CancelCommandTest.java b/core/test/org/apache/cloudstack/api/agent/test/CancelCommandTest.java
new file mode 100644
index 0000000..19827fd
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/CancelCommandTest.java
@@ -0,0 +1,46 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.cloud.agent.api.CancelCommand;
+
+public class CancelCommandTest {
+    CancelCommand cc = new CancelCommand(123456789L, "goodreason");
+
+    @Test
+    public void testGetSequence() {
+        Long s = cc.getSequence();
+        assertTrue(123456789L == s);
+    }
+
+    @Test
+    public void testGetReason() {
+        String r = cc.getReason();
+        assertTrue(r.equals("goodreason"));
+    }
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = cc.executeInSequence();
+        assertFalse(b);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/ChangeAgentAnswerTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/ChangeAgentAnswerTest.java b/core/test/org/apache/cloudstack/api/agent/test/ChangeAgentAnswerTest.java
new file mode 100644
index 0000000..8933e6e
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/ChangeAgentAnswerTest.java
@@ -0,0 +1,44 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.cloud.agent.api.ChangeAgentAnswer;
+import com.cloud.agent.api.ChangeAgentCommand;
+import com.cloud.host.Status.Event;
+
+public class ChangeAgentAnswerTest {
+    ChangeAgentCommand cac = new ChangeAgentCommand(123456789L,
+            Event.AgentConnected);
+    ChangeAgentAnswer caa = new ChangeAgentAnswer(cac, true);
+
+    @Test
+    public void testGetResult() {
+        boolean b = caa.getResult();
+        assertTrue(b);
+    }
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = caa.executeInSequence();
+        assertFalse(b);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/ChangeAgentCommandTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/ChangeAgentCommandTest.java b/core/test/org/apache/cloudstack/api/agent/test/ChangeAgentCommandTest.java
new file mode 100644
index 0000000..d0c2bf8
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/ChangeAgentCommandTest.java
@@ -0,0 +1,50 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.cloud.agent.api.ChangeAgentCommand;
+import com.cloud.host.Status.Event;
+
+public class ChangeAgentCommandTest {
+
+    ChangeAgentCommand cac = new ChangeAgentCommand(123456789L,
+            Event.AgentConnected);
+
+    @Test
+    public void testGetAgentId() {
+        Long aid = cac.getAgentId();
+        assertTrue(123456789L == aid);
+    }
+
+    @Test
+    public void testGetEvent() {
+        Event e = cac.getEvent();
+        assertEquals(Event.AgentConnected, e);
+    }
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = cac.executeInSequence();
+        assertFalse(b);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/CheckHealthAnswerTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/CheckHealthAnswerTest.java b/core/test/org/apache/cloudstack/api/agent/test/CheckHealthAnswerTest.java
new file mode 100644
index 0000000..6fa94f9
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/CheckHealthAnswerTest.java
@@ -0,0 +1,49 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.cloud.agent.api.CheckHealthAnswer;
+import com.cloud.agent.api.CheckHealthCommand;
+
+public class CheckHealthAnswerTest {
+    CheckHealthCommand chc = new CheckHealthCommand();
+    CheckHealthAnswer cha = new CheckHealthAnswer(chc, true);
+
+    @Test
+    public void testGetResult() {
+        boolean r = cha.getResult();
+        assertTrue(r);
+    }
+
+    @Test
+    public void testGetDetails() {
+        String d = cha.getDetails();
+        boolean r = cha.getResult();
+        assertTrue(d.equals("resource is " + (r ? "alive" : "not alive")));
+    }
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = cha.executeInSequence();
+        assertFalse(b);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/CheckHealthCommandTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/CheckHealthCommandTest.java b/core/test/org/apache/cloudstack/api/agent/test/CheckHealthCommandTest.java
new file mode 100644
index 0000000..1b565a5
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/CheckHealthCommandTest.java
@@ -0,0 +1,40 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.cloud.agent.api.CheckHealthCommand;
+
+public class CheckHealthCommandTest {
+    CheckHealthCommand chc = new CheckHealthCommand();
+
+    @Test
+    public void testGetWait() {
+        int wait = chc.getWait();
+        assertTrue(wait == 50);
+    }
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = chc.executeInSequence();
+        assertFalse(b);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/CheckNetworkAnswerTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/CheckNetworkAnswerTest.java b/core/test/org/apache/cloudstack/api/agent/test/CheckNetworkAnswerTest.java
new file mode 100644
index 0000000..1853d39
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/CheckNetworkAnswerTest.java
@@ -0,0 +1,62 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import com.cloud.agent.api.CheckNetworkAnswer;
+import com.cloud.agent.api.CheckNetworkCommand;
+
+public class CheckNetworkAnswerTest {
+    CheckNetworkCommand cnc;
+    CheckNetworkAnswer cna;
+
+    @Before
+    public void setUp() {
+        cnc = Mockito.mock(CheckNetworkCommand.class);
+        cna = new CheckNetworkAnswer(cnc, true, "details", true);
+    }
+
+    @Test
+    public void testGetResult() {
+        boolean b = cna.getResult();
+        assertTrue(b);
+    }
+
+    @Test
+    public void testGetDetails() {
+        String d = cna.getDetails();
+        assertTrue(d.equals("details"));
+    }
+
+    @Test
+    public void testNeedReconnect() {
+        boolean b = cna.needReconnect();
+        assertTrue(b);
+    }
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = cna.executeInSequence();
+        assertFalse(b);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/CheckNetworkCommandTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/CheckNetworkCommandTest.java b/core/test/org/apache/cloudstack/api/agent/test/CheckNetworkCommandTest.java
new file mode 100644
index 0000000..0b87b58
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/CheckNetworkCommandTest.java
@@ -0,0 +1,53 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import com.cloud.agent.api.CheckNetworkCommand;
+import com.cloud.network.PhysicalNetworkSetupInfo;
+
+public class CheckNetworkCommandTest {
+    CheckNetworkCommand cnc;
+
+    @Before
+    public void setUp() {
+        @SuppressWarnings("unchecked")
+        List<PhysicalNetworkSetupInfo> net = Mockito.mock(List.class);
+        cnc = new CheckNetworkCommand(net);
+    }
+
+    @Test
+    public void testGetPhysicalNetworkInfoList() {
+        List<PhysicalNetworkSetupInfo> networkInfoList = cnc
+                .getPhysicalNetworkInfoList();
+        assertEquals(0, networkInfoList.size());
+    }
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = cnc.executeInSequence();
+        assertTrue(b);
+    }
+}


[23/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/VolumeVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/VolumeVO.java b/core/src/com/cloud/storage/VolumeVO.java
deleted file mode 100755
index 1699afd..0000000
--- a/core/src/com/cloud/storage/VolumeVO.java
+++ /dev/null
@@ -1,466 +0,0 @@
-// 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.storage;
-
-import java.util.Date;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-
-import com.cloud.storage.Storage.StoragePoolType;
-import com.cloud.utils.NumbersUtil;
-import com.cloud.utils.db.GenericDao;
-
-@Entity
-@Table(name = "volumes")
-public class VolumeVO implements Volume {
-    @Id
-    @TableGenerator(name = "volume_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "volume_seq", allocationSize = 1)
-    @GeneratedValue(strategy = GenerationType.TABLE)
-    @Column(name = "id")
-    long id;
-
-    @Column(name = "name")
-    String name;
-
-    @Column(name = "pool_id")
-    Long poolId;
-    
-    @Column(name = "last_pool_id")
-    Long lastPoolId;
-    
-    @Column(name = "account_id")
-    long accountId;
-
-    @Column(name = "domain_id")
-    long domainId;
-
-    @Column(name = "instance_id")
-    Long instanceId = null;
-
-    @Column(name = "device_id")
-    Long deviceId = null;
-
-    @Column(name = "size")
-    Long size;
-
-    @Column(name = "folder")
-    String folder;
-
-    @Column(name = "path")
-    String path;
-
-    @Column(name = "pod_id")
-    Long podId;
-
-    @Column(name = "created")
-    Date created;
-
-    @Column(name = "attached")
-    @Temporal(value = TemporalType.TIMESTAMP)
-    Date attached;
-
-    @Column(name = "data_center_id")
-    long dataCenterId;
-
-    @Column(name = "host_ip")
-    String hostip;
-
-    @Column(name = "disk_offering_id")
-    long diskOfferingId;
-
-    @Column(name = "template_id")
-    Long templateId;
-
-    @Column(name = "first_snapshot_backup_uuid")
-    String firstSnapshotBackupUuid;
-
-    @Column(name = "volume_type")
-    @Enumerated(EnumType.STRING)
-    Type volumeType = Volume.Type.UNKNOWN;
-
-    @Column(name = "pool_type")
-    @Enumerated(EnumType.STRING)
-    StoragePoolType poolType;
-
-    @Column(name = GenericDao.REMOVED_COLUMN)
-    Date removed;
-
-    @Column(name = "updated")
-    @Temporal(value = TemporalType.TIMESTAMP)
-    Date updated;
-    
-    @Column(name="update_count", updatable = true, nullable=false)
-    protected long updatedCount;	// This field should be updated everytime the state is updated.  There's no set method in the vo object because it is done with in the dao code.
-
-    @Column(name = "recreatable")
-    boolean recreatable;
-
-    @Column(name = "state")
-    @Enumerated(value = EnumType.STRING)
-    private State state;
-
-    @Column(name = "chain_info")
-    String chainInfo;
-
-    @Column(name = "uuid")
-    String uuid;
-
-    @Column(name="display_volume", updatable=true, nullable=false)
-    protected boolean displayVolume;
-
-    @Transient
-    // @Column(name="reservation")
-    String reservationId;
-    
-    // Real Constructor
-    public VolumeVO(Type type, String name, long dcId, long domainId, long accountId, long diskOfferingId, long size) {
-        this.volumeType = type;
-        this.name = name;
-        this.dataCenterId = dcId;
-        this.accountId = accountId;
-        this.domainId = domainId;
-        this.size = size;
-        this.diskOfferingId = diskOfferingId;
-        this.state = State.Allocated;
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    public VolumeVO(String name, long dcId, long podId, long accountId, long domainId, Long instanceId, String folder, String path, long size, Volume.Type vType) {
-        this.name = name;
-        this.accountId = accountId;
-        this.domainId = domainId;
-        this.instanceId = instanceId;
-        this.folder = folder;
-        this.path = path;
-        this.size = size;
-        this.podId = podId;
-        this.dataCenterId = dcId;
-        this.volumeType = vType;
-        this.state = Volume.State.Allocated;
-        this.recreatable = false;
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    // Copy Constructor
-    public VolumeVO(Volume that) {
-        this(that.getName(), that.getDataCenterId(), that.getPodId(), that.getAccountId(), that.getDomainId(), that.getInstanceId(), that.getFolder(), that.getPath(), that.getSize(), that
-                .getVolumeType());
-        this.recreatable = that.isRecreatable();
-        this.state = that.getState();
-        this.size = that.getSize();
-        this.diskOfferingId = that.getDiskOfferingId();
-        this.poolId = that.getPoolId();
-        this.attached = that.getAttached();
-        this.chainInfo = that.getChainInfo();
-        this.templateId = that.getTemplateId();
-        this.deviceId = that.getDeviceId();
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    @Override
-    public long getUpdatedCount() {
-    	return this.updatedCount;
-    }
-    
-    @Override
-    public void incrUpdatedCount() {
-    	this.updatedCount++;
-    }
-    
-    public void decrUpdatedCount() {
-    	this.updatedCount--;
-    }
-    
-    @Override
-    public boolean isRecreatable() {
-        return recreatable;
-    }
-
-    public void setRecreatable(boolean recreatable) {
-        this.recreatable = recreatable;
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-
-    @Override
-    public Long getPodId() {
-        return podId;
-    }
-
-    @Override
-    public long getDataCenterId() {
-        return dataCenterId;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public long getAccountId() {
-        return accountId;
-    }
-
-    public void setPoolType(StoragePoolType poolType) {
-        this.poolType = poolType;
-    }
-
-    public StoragePoolType getPoolType() {
-        return poolType;
-    }
-
-    @Override
-    public long getDomainId() {
-        return domainId;
-    }
-
-    @Override
-    public String getFolder() {
-        return folder;
-    }
-
-    @Override
-    public String getPath() {
-        return path;
-    }
-
-    protected VolumeVO() {
-    }
-
-    @Override
-    public Long getSize() {
-        return size;
-    }
-
-    public void setSize(Long size) {
-        this.size = size;
-    }
-
-    @Override
-    public Long getInstanceId() {
-        return instanceId;
-    }
-
-    @Override
-    public Long getDeviceId() {
-        return deviceId;
-    }
-
-    public void setDeviceId(Long deviceId) {
-        this.deviceId = deviceId;
-    }
-
-    @Override
-    public Type getVolumeType() {
-        return volumeType;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public void setFolder(String folder) {
-        this.folder = folder;
-    }
-
-    public void setAccountId(long accountId) {
-        this.accountId = accountId;
-    }
-
-    public void setDomainId(long domainId) {
-        this.domainId = domainId;
-    }
-
-    public void setInstanceId(Long instanceId) {
-        this.instanceId = instanceId;
-    }
-
-    public void setPath(String path) {
-        this.path = path;
-    }
-
-    public String getHostIp() {
-        return hostip;
-    }
-
-    public void setHostIp(String hostip) {
-        this.hostip = hostip;
-    }
-
-    public void setPodId(Long podId) {
-        this.podId = podId;
-    }
-
-    public void setDataCenterId(long dataCenterId) {
-        this.dataCenterId = dataCenterId;
-    }
-
-    public void setVolumeType(Type type) {
-        volumeType = type;
-    }
-
-    @Override
-    public Date getCreated() {
-        return created;
-    }
-
-    public Date getRemoved() {
-        return removed;
-    }
-
-    public void setRemoved(Date removed) {
-        this.removed = removed;
-    }
-
-    @Override
-    public long getDiskOfferingId() {
-        return diskOfferingId;
-    }
-
-    public void setDiskOfferingId(long diskOfferingId) {
-        this.diskOfferingId = diskOfferingId;
-    }
-
-    @Override
-    public Long getTemplateId() {
-        return templateId;
-    }
-
-    public void setTemplateId(Long templateId) {
-        this.templateId = templateId;
-    }
-
-    public String getFirstSnapshotBackupUuid() {
-        return firstSnapshotBackupUuid;
-    }
-
-    public void setFirstSnapshotBackupUuid(String firstSnapshotBackupUuid) {
-        this.firstSnapshotBackupUuid = firstSnapshotBackupUuid;
-    }
-
-    @Override
-    public Long getPoolId() {
-        return poolId;
-    }
-
-    public void setPoolId(Long poolId) {
-        this.poolId = poolId;
-    }
-
-    @Override
-    public Date getUpdated() {
-        return updated;
-    }
-
-    @Override
-    public State getState() {
-        return state;
-    }
-
-    public void setUpdated(Date updated) {
-        this.updated = updated;
-    }
-
-    @Override
-    public String toString() {
-        return new StringBuilder("Vol[").append(id).append("|vm=").append(instanceId).append("|").append(volumeType).append("]").toString();
-    }
-
-    @Override
-    public Date getAttached() {
-        return this.attached;
-    }
-
-    public void setAttached(Date attached) {
-        this.attached = attached;
-    }
-
-    @Override
-    public String getChainInfo() {
-        return this.chainInfo;
-    }
-
-    public void setChainInfo(String chainInfo) {
-        this.chainInfo = chainInfo;
-    }
-    
-    public Long getLastPoolId() {
-    	return this.lastPoolId;
-    }
-    
-    public void setLastPoolId(Long poolId) {
-    	this.lastPoolId = poolId;
-    }
-
-    @Override
-    public int hashCode() {
-        return NumbersUtil.hash(id);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof VolumeVO) {
-            return id == ((VolumeVO) obj).id;
-        } else {
-            return false;
-        }
-    }
-    
-    @Override
-    public String getReservationId() {
-    	return this.reservationId;
-    }
-    
-    @Override
-    public void setReservationId(String reserv) {
-    	this.reservationId = reserv;
-    }
-    
-    @Override
-    public String getUuid() {
-    	return this.uuid;
-    }
-    
-    public void setUuid(String uuid) {
-    	this.uuid = uuid;
-    }
-
-
-    public boolean isDisplayVolume() {
-        return displayVolume;
-    }
-
-    public void setDisplayVolume(boolean displayVolume) {
-        this.displayVolume = displayVolume;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/resource/StoragePoolResource.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/resource/StoragePoolResource.java b/core/src/com/cloud/storage/resource/StoragePoolResource.java
index 5d352b0..fccfd0f 100644
--- a/core/src/com/cloud/storage/resource/StoragePoolResource.java
+++ b/core/src/com/cloud/storage/resource/StoragePoolResource.java
@@ -21,6 +21,8 @@ import com.cloud.agent.api.storage.CopyVolumeAnswer;
 import com.cloud.agent.api.storage.CopyVolumeCommand;
 import com.cloud.agent.api.storage.CreateAnswer;
 import com.cloud.agent.api.storage.CreateCommand;
+import com.cloud.agent.api.storage.CreateVolumeOVAAnswer;
+import com.cloud.agent.api.storage.CreateVolumeOVACommand;
 import com.cloud.agent.api.storage.DestroyCommand;
 import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
 import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
@@ -34,5 +36,7 @@ public interface StoragePoolResource {
     
     CopyVolumeAnswer execute(CopyVolumeCommand cmd);
     
+    CreateVolumeOVAAnswer execute(CreateVolumeOVACommand cmd);
+
     CreateAnswer execute(CreateCommand cmd);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/snapshot/SnapshotSchedule.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/snapshot/SnapshotSchedule.java b/core/src/com/cloud/storage/snapshot/SnapshotSchedule.java
deleted file mode 100644
index 6f3d2ce..0000000
--- a/core/src/com/cloud/storage/snapshot/SnapshotSchedule.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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.storage.snapshot;
-
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
-
-import java.util.Date;
-
-public interface SnapshotSchedule extends InternalIdentity, Identity {
-
-    Long getVolumeId();
-
-    Long getPolicyId();
-
-    void setPolicyId(long policyId);
-
-    /**
-     * @return the scheduledTimestamp
-     */
-    Date getScheduledTimestamp();
-
-    void setScheduledTimestamp(Date scheduledTimestamp);
-
-    Long getAsyncJobId();
-
-    void setAsyncJobId(Long asyncJobId);
-
-    Long getSnapshotId();
-
-    void setSnapshotId(Long snapshotId);
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/user/AccountVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/user/AccountVO.java b/core/src/com/cloud/user/AccountVO.java
deleted file mode 100644
index 77110ae..0000000
--- a/core/src/com/cloud/user/AccountVO.java
+++ /dev/null
@@ -1,189 +0,0 @@
-// 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.user;
-
-import java.util.Date;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import com.cloud.utils.db.GenericDao;
-
-@Entity
-@Table(name="account")
-public class AccountVO implements Account {
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private long id;
-
-    @Column(name="account_name")
-    private String accountName = null;
-
-    @Column(name="type")
-    private short type = ACCOUNT_TYPE_NORMAL;
-
-    @Column(name="domain_id")
-    private long domainId;
-
-    @Column(name="state")
-    @Enumerated(value=EnumType.STRING)
-    private State state;
-
-    @Column(name=GenericDao.REMOVED_COLUMN)
-    private Date removed;
-
-    @Column(name="cleanup_needed")
-    private boolean needsCleanup = false;
-
-    @Column(name="network_domain")
-    private String networkDomain;
-
-    @Column(name="uuid")
-    private String uuid;
-
-    @Column(name="default_zone_id")
-    private Long defaultZoneId = null;
-    
-    @Column(name = "default")
-    boolean isDefault;
-
-    public AccountVO() {
-    	this.uuid = UUID.randomUUID().toString();
-    }
-
-    public AccountVO(long id) {
-        this.id = id;
-    	this.uuid = UUID.randomUUID().toString();
-    }
-    
-    public AccountVO(String accountName, long domainId, String networkDomain, short type, String uuid) {
-        this.accountName = accountName;
-        this.domainId = domainId;
-        this.networkDomain = networkDomain;
-        this.type = type;
-        this.state = State.enabled;
-        this.uuid = uuid;
-    }
-
-    public void setNeedsCleanup(boolean value) {
-    	needsCleanup = value;
-    }
-
-    public boolean getNeedsCleanup() {
-    	return needsCleanup;
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-
-    public void setId(long id) {
-		this.id = id;
-	}
-
-	@Override
-    public String getAccountName() {
-        return accountName;
-    }
-
-    public void setAccountName(String accountName) {
-        this.accountName = accountName;
-    }
-
-    @Override
-    public short getType() {
-        return type;
-    }
-
-    public void setType(short type) {
-        this.type = type;
-    }
-
-    @Override
-    public long getDomainId() {
-        return domainId;
-    }
-
-    public void setDomainId(long domainId) {
-        this.domainId = domainId;
-    }
-
-    @Override
-    public Long getDefaultZoneId() {
-    	return defaultZoneId;
-    }
-
-    public void setDefaultZoneId(Long defaultZoneId) {
-    	this.defaultZoneId = defaultZoneId;
-    }
-
-    @Override
-    public State getState() {
-        return state;
-    }
-
-    public void setState(State state) {
-        this.state = state;
-    }
-
-    @Override
-    public Date getRemoved() {
-        return removed;
-    }
-
-    @Override
-    public long getAccountId() {
-        return id;
-    }
-
-    @Override
-    public String toString() {
-        return new StringBuilder("Acct[").append(id).append("-").append(accountName).append("]").toString();
-    }
-
-    @Override
-    public String getNetworkDomain() {
-        return networkDomain;
-    }
-
-    public void setNetworkDomain(String networkDomain) {
-        this.networkDomain = networkDomain;
-    }
-
-    @Override
-    public String getUuid() {
-    	return this.uuid;
-    }
-
-    public void setUuid(String uuid) {
-    	this.uuid = uuid;
-    }
-
-    @Override
-    public boolean isDefault() {
-        return isDefault;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/user/SSHKeyPairVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/user/SSHKeyPairVO.java b/core/src/com/cloud/user/SSHKeyPairVO.java
deleted file mode 100644
index ab7eb8e..0000000
--- a/core/src/com/cloud/user/SSHKeyPairVO.java
+++ /dev/null
@@ -1,119 +0,0 @@
-// 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.user;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-
-@Entity
-@Table(name="ssh_keypairs")
-public class SSHKeyPairVO implements SSHKeyPair {
-	
-	@Id
-	@GeneratedValue(strategy=GenerationType.IDENTITY)
-	@Column(name="id")
-	private Long id = null;
-	
-	@Column(name="account_id")
-	private long accountId;
-	
-    @Column(name="domain_id")
-    private long domainId;
-    
-    @Column(name="keypair_name")
-    private String name;
-    
-    @Column(name="fingerprint")
-    private String fingerprint;
-    
-    @Column(name="public_key", length=5120)
-    private String publicKey;
-    
-    @Transient
-    private String privateKey;
-
-	@Override
-	public long getId() {
-		return id;
-	}
-	
-	@Override
-	public long getAccountId() {
-		return accountId;
-	}
-
-	@Override
-	public long getDomainId() {
-		return domainId;
-	}
-	
-	@Override
-	public String getFingerprint() {
-		return fingerprint;
-	}
-
-	@Override
-	public String getName() {
-		return name;
-	}
-
-	@Override
-	public String getPublicKey() {
-		return publicKey;
-	}
-	
-	@Override
-	public String getPrivateKey() {
-		return privateKey;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	public void setAccountId(long accountId) {
-		this.accountId = accountId;
-	}
-
-	public void setDomainId(long domainId) {
-		this.domainId = domainId;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public void setFingerprint(String fingerprint) {
-		this.fingerprint = fingerprint;
-	}
-
-	public void setPublicKey(String publicKey) {
-		this.publicKey = publicKey;
-	}
-	
-	public void setPrivateKey(String privateKey) {
-		this.privateKey = privateKey;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/user/UserAccountVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/user/UserAccountVO.java b/core/src/com/cloud/user/UserAccountVO.java
deleted file mode 100644
index cfad617..0000000
--- a/core/src/com/cloud/user/UserAccountVO.java
+++ /dev/null
@@ -1,284 +0,0 @@
-// 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.user;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.PrimaryKeyJoinColumn;
-import javax.persistence.SecondaryTable;
-import javax.persistence.Table;
-
-import com.cloud.utils.db.Encrypt;
-import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="user")
-@SecondaryTable(name="account",
-pkJoinColumns={@PrimaryKeyJoinColumn(name="account_id", referencedColumnName="id")})
-public class UserAccountVO implements UserAccount, InternalIdentity {
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private Long id = null;
-
-    @Column(name="username")
-    private String username = null;
-
-    @Column(name="password")
-    private String password = null;
-
-    @Column(name="firstname")
-    private String firstname = null;
-
-    @Column(name="lastname")
-    private String lastname = null;
-
-    @Column(name="account_id")
-    private long accountId;
-
-    @Column(name="email")
-    private String email = null;
-
-    @Column(name="state")
-    private String state;
-
-    @Column(name="api_key")
-    private String apiKey = null;
-
-    @Encrypt
-    @Column(name="secret_key")
-    private String secretKey = null;
-
-    @Column(name=GenericDao.CREATED_COLUMN)
-    private Date created;
-
-    @Column(name=GenericDao.REMOVED_COLUMN)
-    private Date removed;
-
-    @Column(name="timezone")
-    private String timezone;
-
-    @Column(name="registration_token")
-    private String registrationToken = null;
-
-    @Column(name="is_registered")
-    boolean registered;
-
-    @Column (name="incorrect_login_attempts")
-    int loginAttempts;
-
-    @Column(name="account_name", table="account", insertable=false, updatable=false)
-    private String accountName = null;
-
-    @Column(name="type", table="account", insertable=false, updatable=false)
-    private short type;
-
-    @Column(name="domain_id", table="account", insertable=false, updatable=false)
-    private Long domainId = null;
-
-    @Column(name="state", table="account", insertable=false, updatable=false)
-    private String accountState;
-
-    public UserAccountVO() {}
-
-    @Override
-    public long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    @Override
-    public String getUsername() {
-        return username;
-    }
-
-    public void setUsername(String username) {
-        this.username = username;
-    }
-
-    @Override
-    public String getPassword() {
-        return password;
-    }
-
-    public void setPassword(String password) {
-        this.password = password;
-    }
-
-    @Override
-    public String getFirstname() {
-        return firstname;
-    }
-
-    public void setFirstname(String firstname) {
-        this.firstname = firstname;
-    }
-
-    @Override
-    public String getLastname() {
-        return lastname;
-    }
-
-    public void setLastname(String lastname) {
-        this.lastname = lastname;
-    }
-
-    @Override
-    public long getAccountId() {
-        return accountId;
-    }
-
-    public void setAccountId(long accountId) {
-        this.accountId = accountId;
-    }
-
-    @Override
-    public String getEmail() {
-        return email;
-    }
-
-    public void setEmail(String email) {
-        this.email = email;
-    }
-
-    @Override
-    public String getState() {
-        return state;
-    }
-
-    public void setState(String state) {
-        this.state = state;
-    }
-
-    @Override
-    public String getApiKey() {
-        return apiKey;
-    }
-
-    public void setApiKey(String apiKey) {
-        this.apiKey = apiKey;
-    }
-
-    @Override
-    public String getSecretKey() {
-        return secretKey;
-    }
-
-    public void setSecretKey(String secretKey) {
-        this.secretKey = secretKey;
-    }
-
-    @Override
-    public Date getCreated() {
-        return created;
-    }
-
-//    public void setCreated(Date created) {
-//        this.created = created;
-//    }
-
-    @Override
-    public Date getRemoved() {
-        return removed;
-    }
-
-    public void setRemoved(Date removed) {
-        this.removed = removed;
-    }
-
-    @Override
-    public String getAccountName() {
-        return accountName;
-    }
-
-    public void setAccountName(String accountName) {
-        this.accountName = accountName;
-    }
-
-    @Override
-    public short getType() {
-        return type;
-    }
-
-    public void setType(short type) {
-        this.type = type;
-    }
-
-    @Override
-    public Long getDomainId() {
-        return domainId;
-    }
-
-    public void setDomainId(Long domainId) {
-        this.domainId = domainId;
-    }
-
-    @Override
-    public String getAccountState() {
-        return accountState;
-    }
-
-    public void setAccountDisabled(String accountState) {
-        this.accountState = accountState;
-    }
-
-    @Override
-    public String getTimezone(){
-        return timezone;
-    }
-
-    public void setTimezone(String timezone)
-    {
-        this.timezone = timezone; 
-    }
-
-    @Override
-    public String getRegistrationToken(){
-        return registrationToken;
-    }
-
-    public void setRegistrationToken(String registrationToken)
-    {
-        this.registrationToken = registrationToken; 
-    }
-
-    @Override 
-    public boolean isRegistered() {
-        return registered;
-    }
-
-    public void setRegistered(boolean registered) {
-        this.registered = registered;
-    }
-
-    public void setLoginAttempts(int loginAttempts) {
-        this.loginAttempts = loginAttempts;
-    }
-
-    public int getLoginAttempts() {
-        return loginAttempts;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/user/UserStatisticsVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/user/UserStatisticsVO.java b/core/src/com/cloud/user/UserStatisticsVO.java
deleted file mode 100644
index eb59a74..0000000
--- a/core/src/com/cloud/user/UserStatisticsVO.java
+++ /dev/null
@@ -1,165 +0,0 @@
-// 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.user;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name="user_statistics")
-public class UserStatisticsVO implements InternalIdentity {
-	@Id
-	@GeneratedValue(strategy=GenerationType.IDENTITY)
-	@Column(name="id")
-	private Long id;
-	
-	@Column(name="data_center_id", updatable=false)
-	private long dataCenterId;
-	
-	@Column(name="account_id", updatable=false)
-	private long accountId;
-	
-	@Column(name="public_ip_address")
-	private String publicIpAddress;
-	
-	@Column(name="device_id")
-	private Long deviceId;
-	
-	@Column(name="device_type")
-	private String deviceType;
-	
-	@Column(name="network_id")
-	private Long networkId;
-
-	
-	@Column(name="net_bytes_received")
-	private long netBytesReceived;
-	
-	@Column(name="net_bytes_sent")
-	private long netBytesSent;
-	
-	@Column(name="current_bytes_received")
-	private long currentBytesReceived;
-	
-	@Column(name="current_bytes_sent")
-	private long currentBytesSent;
-	
-	@Column(name="agg_bytes_received")
-	private long aggBytesReceived;
-	
-	@Column(name="agg_bytes_sent")
-	private long aggBytesSent;
-	
-	protected UserStatisticsVO() {
-	}
-	
-	public UserStatisticsVO(long accountId, long dcId, String publicIpAddress, Long deviceId, String deviceType, Long networkId) {
-		this.accountId = accountId;
-		this.dataCenterId = dcId;
-		this.publicIpAddress = publicIpAddress;
-		this.deviceId = deviceId;
-		this.deviceType = deviceType;
-		this.networkId = networkId;
-		this.netBytesReceived = 0;
-		this.netBytesSent = 0;
-		this.currentBytesReceived = 0;
-		this.currentBytesSent = 0;
-	}
-
-	public long getAccountId() {
-		return accountId;
-	}
-
-	public long getId() {
-        return id;
-    }
-
-    public long getDataCenterId() {
-        return dataCenterId;
-    }
-    
-    public String getPublicIpAddress() {
-    	return publicIpAddress;
-    }
-    
-    public Long getDeviceId() {
-    	return deviceId;
-    }
-
-    public String getDeviceType() {
-        return deviceType;
-    }
-    
-    public Long getNetworkId() {
-        return networkId;
-    }
-    
-    public long getCurrentBytesReceived() {
-        return currentBytesReceived;
-    }
-
-    public void setCurrentBytesReceived(long currentBytesReceived) {
-        this.currentBytesReceived = currentBytesReceived;
-    }
-
-    public long getCurrentBytesSent() {
-        return currentBytesSent;
-    }
-
-    public void setCurrentBytesSent(long currentBytesSent) {
-        this.currentBytesSent = currentBytesSent;
-    }
-
-    public long getNetBytesReceived() {
-		return netBytesReceived;
-	}
-
-	public long getNetBytesSent() {
-		return netBytesSent;
-	}
-
-	public void setNetBytesReceived(long netBytesReceived) {
-		this.netBytesReceived = netBytesReceived;
-	}
-
-	public void setNetBytesSent(long netBytesSent) {
-		this.netBytesSent = netBytesSent;
-	}
-
-	public long getAggBytesReceived() {
-		return aggBytesReceived;
-	}
-
-	public void setAggBytesReceived(long aggBytesReceived) {
-		this.aggBytesReceived = aggBytesReceived;
-	}
-
-	public long getAggBytesSent() {
-		return aggBytesSent;
-	}
-
-	public void setAggBytesSent(long aggBytesSent) {
-		this.aggBytesSent = aggBytesSent;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/user/UserStatsLogVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/user/UserStatsLogVO.java b/core/src/com/cloud/user/UserStatsLogVO.java
deleted file mode 100644
index 6f97795..0000000
--- a/core/src/com/cloud/user/UserStatsLogVO.java
+++ /dev/null
@@ -1,132 +0,0 @@
-// 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.user;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-@Entity
-@Table(name="op_user_stats_log")
-public class UserStatsLogVO {
-	@Id
-	@Column(name="user_stats_id")
-	private long userStatsId;
-	
-	@Column(name="net_bytes_received")
-	private long netBytesReceived;
-	
-	@Column(name="net_bytes_sent")
-	private long netBytesSent;
-	
-	@Column(name="current_bytes_received")
-	private long currentBytesReceived;
-	
-	@Column(name="current_bytes_sent")
-	private long currentBytesSent;
-	
-	@Column(name="agg_bytes_received")
-	private long aggBytesReceived;
-	
-	@Column(name="agg_bytes_sent")
-	private long aggBytesSent;
-	
-	@Column(name="updated")
-	@Temporal(value=TemporalType.TIMESTAMP)
-	private Date updatedTime;
-	
-	public UserStatsLogVO(){
-	}
-	
-	public UserStatsLogVO(long userStatsId, long netBytesReceived, long netBytesSent, long currentBytesReceived, long currentBytesSent, 
-							long aggBytesReceived, long aggBytesSent, Date updatedTime) {
-		this.userStatsId = userStatsId;
-		this.netBytesReceived = netBytesReceived;
-		this.netBytesSent = netBytesSent;
-		this.currentBytesReceived = currentBytesReceived;
-		this.currentBytesSent = currentBytesSent;
-		this.aggBytesReceived = aggBytesReceived;
-		this.aggBytesSent = aggBytesSent;
-		this.updatedTime = updatedTime;
-	}
-
-	public Long getUserStatsId() {
-        return userStatsId;
-    }
-    
-    public long getCurrentBytesReceived() {
-        return currentBytesReceived;
-    }
-
-    public void setCurrentBytesReceived(long currentBytesReceived) {
-        this.currentBytesReceived = currentBytesReceived;
-    }
-
-    public long getCurrentBytesSent() {
-        return currentBytesSent;
-    }
-
-    public void setCurrentBytesSent(long currentBytesSent) {
-        this.currentBytesSent = currentBytesSent;
-    }
-
-    public long getNetBytesReceived() {
-		return netBytesReceived;
-	}
-
-	public long getNetBytesSent() {
-		return netBytesSent;
-	}
-
-	public void setNetBytesReceived(long netBytesReceived) {
-		this.netBytesReceived = netBytesReceived;
-	}
-
-	public void setNetBytesSent(long netBytesSent) {
-		this.netBytesSent = netBytesSent;
-	}
-
-	public long getAggBytesReceived() {
-		return aggBytesReceived;
-	}
-
-	public void setAggBytesReceived(long aggBytesReceived) {
-		this.aggBytesReceived = aggBytesReceived;
-	}
-
-	public long getAggBytesSent() {
-		return aggBytesSent;
-	}
-
-	public void setAggBytesSent(long aggBytesSent) {
-		this.aggBytesSent = aggBytesSent;
-	}
-
-	public Date getUpdatedTime() {
-		return updatedTime;
-	}
-
-	public void setUpdatedTime(Date updatedTime) {
-		this.updatedTime = updatedTime;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/user/UserVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/user/UserVO.java b/core/src/com/cloud/user/UserVO.java
deleted file mode 100644
index 2a85758..0000000
--- a/core/src/com/cloud/user/UserVO.java
+++ /dev/null
@@ -1,274 +0,0 @@
-// 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.user;
-
-import java.util.Date;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
-
-import com.cloud.user.Account.State;
-import com.cloud.utils.db.Encrypt;
-import com.cloud.utils.db.GenericDao;
-
-/**
- * A bean representing a user
- * 
- */
-@Entity
-@Table(name = "user")
-public class UserVO implements User, Identity, InternalIdentity {
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Column(name = "id")
-    private long id;
-
-    @Column(name = "username")
-    private String username = null;
-
-    @Column(name = "password")
-    private String password = null;
-
-    @Column(name = "firstname")
-    private String firstname = null;
-
-    @Column(name = "lastname")
-    private String lastname = null;
-
-    @Column(name = "account_id")
-    private long accountId;
-
-    @Column(name = "email")
-    private String email = null;
-
-    @Column(name = "state")
-    @Enumerated(value=EnumType.STRING)
-    private State state;
-
-    @Column(name = "api_key")
-    private String apiKey = null;
-
-    @Encrypt
-    @Column(name = "secret_key")
-    private String secretKey = null;
-
-    @Column(name = GenericDao.CREATED_COLUMN)
-    private Date created;
-
-    @Column(name = GenericDao.REMOVED_COLUMN)
-    private Date removed;
-
-    @Column(name = "timezone")
-    private String timezone;
-
-    @Column(name="registration_token")
-    private String registrationToken = null;
-
-    @Column(name="is_registered")
-    boolean registered;
-
-    @Column(name="uuid")
-    private String uuid;
-    
-    @Column(name = "default")
-    boolean isDefault;
-
-    public UserVO() {
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    public UserVO(long id) {
-        this.id = id;
-        this.uuid = UUID.randomUUID().toString();
-    }
-    
-    public UserVO(long accountId, String username, String password, String firstName, String lastName, String email, String timezone, String uuid) {
-        this.accountId = accountId;
-        this.username = username;
-        this.password = password;
-        this.firstname = firstName;
-        this.lastname = lastName;
-        this.email = email;
-        this.timezone = timezone;
-        this.state = State.enabled;
-    	this.uuid = uuid;
-    }
-    
-    @Override
-    public long getId() {
-        return id;
-    }
-
-    @Override
-    public Date getCreated() {
-        return created;
-    }
-
-    @Override
-    public Date getRemoved() {
-        return removed;
-    }
-
-    @Override
-    public String getUsername() {
-        return username;
-    }
-
-    @Override
-    public void setUsername(String username) {
-        this.username = username;
-    }
-
-    @Override
-    public String getPassword() {
-        return password;
-    }
-
-    @Override
-    public void setPassword(String password) {
-        this.password = password;
-    }
-
-    @Override
-    public String getFirstname() {
-        return firstname;
-    }
-
-    @Override
-    public void setFirstname(String firstname) {
-        this.firstname = firstname;
-    }
-
-    @Override
-    public String getLastname() {
-        return lastname;
-    }
-
-    @Override
-    public void setLastname(String lastname) {
-        this.lastname = lastname;
-    }
-
-    @Override
-    public long getAccountId() {
-        return accountId;
-    }
-
-    @Override
-    public void setAccountId(long accountId) {
-        this.accountId = accountId;
-    }
-
-    @Override
-    public String getEmail() {
-        return email;
-    }
-
-    @Override
-    public void setEmail(String email) {
-        this.email = email;
-    }
-
-    @Override
-    public State getState() {
-        return state;
-    }
-
-    @Override
-    public void setState(State state) {
-        this.state = state;
-    }
-
-    @Override
-    public String getApiKey() {
-        return apiKey;
-    }
-
-    @Override
-    public void setApiKey(String apiKey) {
-        this.apiKey = apiKey;
-    }
-
-    @Override
-    public String getSecretKey() {
-        return secretKey;
-    }
-
-    @Override
-    public void setSecretKey(String secretKey) {
-        this.secretKey = secretKey;
-    }
-
-    @Override
-    public String getTimezone() {
-        return timezone;
-    }
-
-    @Override
-    public void setTimezone(String timezone) {
-        this.timezone = timezone;
-    }
-
-    @Override
-    public String getRegistrationToken(){
-        return registrationToken;
-    }
-
-    public void setRegistrationToken(String registrationToken)
-    {
-        this.registrationToken = registrationToken; 
-    }
-
-    @Override 
-    public boolean isRegistered() {
-        return registered;
-    }
-
-    public void setRegistered(boolean registered) {
-        this.registered = registered;
-    }
-
-    @Override
-    public String toString() {
-        return new StringBuilder("User[").append(id).append("-").append(username).append("]").toString();
-    }
-
-    @Override
-    public String getUuid() {
-        return this.uuid;
-    }
-
-    public void setUuid(String uuid) {
-        this.uuid = uuid;
-    }
-    
-    @Override
-    public boolean isDefault() {
-        return isDefault;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/vm/ConsoleProxy.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/ConsoleProxy.java b/core/src/com/cloud/vm/ConsoleProxy.java
deleted file mode 100644
index 1d4fcb1..0000000
--- a/core/src/com/cloud/vm/ConsoleProxy.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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;
-
-/**
- *  ConsoleProxy is a system VM instance that is used 
- *  to proxy VNC traffic
- */
-public interface ConsoleProxy extends SystemVm {
-    public int getActiveSession();
-    public byte[] getSessionDetails();
-}
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/vm/ConsoleProxyVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/ConsoleProxyVO.java b/core/src/com/cloud/vm/ConsoleProxyVO.java
deleted file mode 100644
index c57b44f..0000000
--- a/core/src/com/cloud/vm/ConsoleProxyVO.java
+++ /dev/null
@@ -1,151 +0,0 @@
-// 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;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.Entity;
-import javax.persistence.PrimaryKeyJoinColumn;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-
-/**
- * ConsoleProxyVO domain object
- */
-
-@Entity
-@Table(name = "console_proxy")
-@PrimaryKeyJoinColumn(name = "id")
-@DiscriminatorValue(value = "ConsoleProxy")
-public class ConsoleProxyVO extends VMInstanceVO implements ConsoleProxy {
-
-    @Column(name = "public_ip_address", nullable = false)
-    private String publicIpAddress;
-
-    @Column(name = "public_mac_address", nullable = false)
-    private String publicMacAddress;
-
-    @Column(name = "public_netmask", nullable = false)
-    private String publicNetmask;
-
-    @Column(name = "active_session", updatable = true, nullable = false)
-    private int activeSession;
-
-    @Temporal(TemporalType.TIMESTAMP)
-    @Column(name = "last_update", updatable = true, nullable = true)
-    private Date lastUpdateTime;
-
-    @Column(name = "session_details", updatable = true, nullable = true)
-    private byte[] sessionDetails;
-
-    @Transient
-    private boolean sslEnabled = false;
-
-    @Transient
-    private int port;
-
-    /**
-     * Correct constructor to use.
-     * 
-     */
-    public ConsoleProxyVO(long id, long serviceOfferingId, String name, long templateId, HypervisorType hypervisorType, long guestOSId, long dataCenterId, long domainId, long accountId,
-            int activeSession, boolean haEnabled) {
-        super(id, serviceOfferingId, name, name, Type.ConsoleProxy, templateId, hypervisorType, guestOSId, domainId, accountId, haEnabled);
-        this.activeSession = activeSession;
-    }
-
-    protected ConsoleProxyVO() {
-        super();
-    }
-
-    public void setPublicIpAddress(String publicIpAddress) {
-        this.publicIpAddress = publicIpAddress;
-    }
-
-    public void setPublicNetmask(String publicNetmask) {
-        this.publicNetmask = publicNetmask;
-    }
-
-    public void setPublicMacAddress(String publicMacAddress) {
-        this.publicMacAddress = publicMacAddress;
-    }
-
-    public void setActiveSession(int activeSession) {
-        this.activeSession = activeSession;
-    }
-
-    public void setLastUpdateTime(Date time) {
-        this.lastUpdateTime = time;
-    }
-
-    public void setSessionDetails(byte[] details) {
-        this.sessionDetails = details;
-    }
-
-    @Override
-    public String getPublicIpAddress() {
-        return this.publicIpAddress;
-    }
-
-    @Override
-    public String getPublicNetmask() {
-        return this.publicNetmask;
-    }
-
-    @Override
-    public String getPublicMacAddress() {
-        return this.publicMacAddress;
-    }
-
-    @Override
-    public int getActiveSession() {
-        return this.activeSession;
-    }
-
-    @Override
-    public Date getLastUpdateTime() {
-        return this.lastUpdateTime;
-    }
-
-    @Override
-    public byte[] getSessionDetails() {
-        return this.sessionDetails;
-    }
-
-    public boolean isSslEnabled() {
-        return sslEnabled;
-    }
-
-    public void setSslEnabled(boolean sslEnabled) {
-        this.sslEnabled = sslEnabled;
-    }
-
-    public void setPort(int port) {
-        this.port = port;
-    }
-
-    public int getPort() {
-        return port;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/vm/DomainRouterVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/DomainRouterVO.java b/core/src/com/cloud/vm/DomainRouterVO.java
deleted file mode 100755
index 2cc9364..0000000
--- a/core/src/com/cloud/vm/DomainRouterVO.java
+++ /dev/null
@@ -1,246 +0,0 @@
-// 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;
-
-import javax.persistence.Column;
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.PrimaryKeyJoinColumn;
-import javax.persistence.Table;
-
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.network.router.VirtualRouter;
-
-/**
- */
-@Entity
-@Table(name="domain_router")
-@PrimaryKeyJoinColumn(name="id")
-@DiscriminatorValue(value="DomainRouter")
-public class DomainRouterVO extends VMInstanceVO implements VirtualRouter {
-    @Column(name="element_id")
-    private long elementId;
-
-    @Column(name="public_ip_address")
-    private String publicIpAddress;
-
-    @Column(name="public_mac_address")
-    private String publicMacAddress;
-
-    @Column(name="public_netmask")
-    private String publicNetmask;
-
-    @Column(name="is_redundant_router")
-    boolean isRedundantRouter;
-
-    @Column(name="priority")
-    int priority;
-
-    @Column(name="is_priority_bumpup")
-    boolean isPriorityBumpUp;
-
-    @Column(name="redundant_state")
-    @Enumerated(EnumType.STRING)
-    private RedundantState redundantState;
-
-    @Column(name="stop_pending")
-    boolean stopPending;
-
-    @Column(name="role")
-    @Enumerated(EnumType.STRING)
-    private Role role = Role.VIRTUAL_ROUTER;
-
-    @Column(name="template_version")
-    private String templateVersion;
-
-    @Column(name="scripts_version")
-    private String scriptsVersion;
-
-    @Column(name="vpc_id")
-    private Long vpcId;
-
-    public DomainRouterVO(long id,
-            long serviceOfferingId,
-            long elementId,
-            String name,
-            long templateId,
-            HypervisorType hypervisorType,
-            long guestOSId,
-            long domainId,
-            long accountId,
-            boolean isRedundantRouter,
-            int priority,
-            boolean isPriorityBumpUp,
-            RedundantState redundantState,
-            boolean haEnabled,
-            boolean stopPending, Long vpcId) {
-        super(id, serviceOfferingId, name, name, Type.DomainRouter, templateId, hypervisorType, guestOSId, domainId, accountId, haEnabled);
-        this.elementId = elementId;
-        this.isRedundantRouter = isRedundantRouter;
-        this.priority = priority;
-        this.redundantState = redundantState;
-        this.isPriorityBumpUp = isPriorityBumpUp;
-        this.stopPending = stopPending;
-        this.vpcId = vpcId;
-    }
-
-    public DomainRouterVO(long id,
-            long serviceOfferingId,
-            long elementId,
-            String name,
-            long templateId,
-            HypervisorType hypervisorType,
-            long guestOSId,
-            long domainId,
-            long accountId,
-            boolean isRedundantRouter,
-            int priority,
-            boolean isPriorityBumpUp,
-            RedundantState redundantState,
-            boolean haEnabled,
-            boolean stopPending,
-            VirtualMachine.Type vmType, Long vpcId) {
-        super(id, serviceOfferingId, name, name, vmType, templateId, hypervisorType, guestOSId, domainId, accountId, haEnabled);
-        this.elementId = elementId;
-        this.isRedundantRouter = isRedundantRouter;
-        this.priority = priority;
-        this.redundantState = redundantState;
-        this.isPriorityBumpUp = isPriorityBumpUp;
-        this.stopPending = stopPending;
-        this.vpcId = vpcId;
-    }
-
-    public long getElementId() {
-        return elementId;
-    }
-
-    public void setPublicIpAddress(String publicIpAddress) {
-        this.publicIpAddress = publicIpAddress;
-    }
-
-    public void setPublicMacAddress(String publicMacAddress) {
-        this.publicMacAddress = publicMacAddress;
-    }
-
-    public void setPublicNetmask(String publicNetmask) {
-        this.publicNetmask = publicNetmask;
-    }
-
-    @Override
-    public long getDataCenterId() {
-        return dataCenterId;
-    }
-
-    public String getPublicNetmask() {
-        return publicNetmask;
-    }
-
-    public String getPublicMacAddress() {
-        return publicMacAddress;
-    }
-
-    protected DomainRouterVO() {
-        super();
-    }
-
-    @Override
-    public String getPublicIpAddress() {
-        return publicIpAddress;
-    }
-
-    @Override
-    public Role getRole() {
-        return role;
-    }
-
-    public void setRole(Role role) {
-        this.role = role;
-    }
-
-    @Override
-    public boolean getIsRedundantRouter() {
-        return this.isRedundantRouter;
-    }
-
-    public void setIsRedundantRouter(boolean isRedundantRouter) {
-        this.isRedundantRouter = isRedundantRouter;
-    }
-
-    @Override
-    public long getServiceOfferingId() {
-        return serviceOfferingId;
-    }
-
-    public int getPriority() {
-        return this.priority;
-    }
-
-    public void setPriority(int priority) {
-        this.priority = priority;
-    }
-
-    @Override
-    public RedundantState getRedundantState() {
-        return this.redundantState;
-    }
-
-    public void setRedundantState(RedundantState redundantState) {
-        this.redundantState = redundantState;
-    }
-
-    public boolean getIsPriorityBumpUp() {
-        return this.isPriorityBumpUp;
-    }
-
-    public void setIsPriorityBumpUp(boolean isPriorityBumpUp) {
-        this.isPriorityBumpUp = isPriorityBumpUp;
-    }
-
-    @Override
-    public boolean isStopPending() {
-        return this.stopPending;
-    }
-
-    @Override
-    public void setStopPending(boolean stopPending) {
-        this.stopPending = stopPending;
-    }
-
-    public String getTemplateVersion() {
-        return this.templateVersion;
-    }
-
-    public void setTemplateVersion(String templateVersion) {
-        this.templateVersion = templateVersion;
-    }
-
-    public String getScriptsVersion() {
-        return this.scriptsVersion;
-    }
-
-    public void setScriptsVersion(String scriptsVersion) {
-        this.scriptsVersion = scriptsVersion;
-    }
-
-    @Override
-    public Long getVpcId() {
-        return vpcId;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/vm/InstanceGroupVMMapVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/InstanceGroupVMMapVO.java b/core/src/com/cloud/vm/InstanceGroupVMMapVO.java
deleted file mode 100644
index 996655d..0000000
--- a/core/src/com/cloud/vm/InstanceGroupVMMapVO.java
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.PrimaryKeyJoinColumn;
-import javax.persistence.SecondaryTable;
-import javax.persistence.SecondaryTables;
-import javax.persistence.Table;
-
-@Entity
-@Table(name=("instance_group_vm_map"))
-@SecondaryTables({
-@SecondaryTable(name="user_vm",
-        pkJoinColumns={@PrimaryKeyJoinColumn(name="instance_id", referencedColumnName="id")}),      
-@SecondaryTable(name="instance_group", 
-		pkJoinColumns={@PrimaryKeyJoinColumn(name="group_id", referencedColumnName="id")})
-		})
-public class InstanceGroupVMMapVO implements InternalIdentity {
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private Long id;
-
-    @Column(name="group_id")
-    private long groupId;
-
-    @Column(name="instance_id")
-    private long instanceId;
-    
-
-    public InstanceGroupVMMapVO() { }
-
-    public InstanceGroupVMMapVO(long groupId, long instanceId) {
-        this.groupId = groupId;
-        this.instanceId = instanceId;
-    }
-
-    public long getId() {
-        return id;
-    }
-
-    public long getGroupId() {
-        return groupId;
-    }
-
-    public long getInstanceId() {
-        return instanceId;
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/vm/InstanceGroupVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/InstanceGroupVO.java b/core/src/com/cloud/vm/InstanceGroupVO.java
deleted file mode 100644
index ad66b5a..0000000
--- a/core/src/com/cloud/vm/InstanceGroupVO.java
+++ /dev/null
@@ -1,120 +0,0 @@
-// 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;
-
-import java.util.Date;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.PrimaryKeyJoinColumn;
-import javax.persistence.SecondaryTable;
-import javax.persistence.Table;
-
-import org.apache.cloudstack.api.Identity;
-import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="instance_group")
-@SecondaryTable(name="account",
-        pkJoinColumns={@PrimaryKeyJoinColumn(name="account_id", referencedColumnName="id")})
-public class InstanceGroupVO implements InstanceGroup {
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private long id;
-    
-    @Column(name="name")
-    String name;
-    
-    @Column(name="account_id")
-    private long accountId;
-    
-    @Column(name="domain_id", table="account", insertable=false, updatable=false)
-    private long domainId;
-    
-    @Column(name=GenericDao.REMOVED_COLUMN)
-    private Date removed;
-
-    @Column(name=GenericDao.CREATED_COLUMN)
-    private Date created;
-
-    @Column(name="uuid")
-    private String uuid;
-    
-	@Column(name="type", table="account", insertable=false, updatable=false)
-	private short accountType;
-    
-    public InstanceGroupVO(String name, long accountId) {
-        this.name = name;
-        this.accountId = accountId;
-        this.uuid = UUID.randomUUID().toString();
-    }
-    
-    protected InstanceGroupVO() {
-        super();
-    }
-    
-    @Override
-    public long getId() {
-    	return id;
-    }
-    
-    @Override
-    public String getName() {
-    	return name; 
-    }
-    
-    @Override
-    public long getAccountId() {
-        return accountId;
-    }
-    
-    public long getDomainId() {
-        return domainId;
-    }
-    
-    public Date getRemoved() {
-        return removed;
-    }
-    
-	public Date getCreated() {
-		return created;
-	}
-    
-    public void setName(String name) {
-    	this.name = name;
-    }
-
-    @Override
-    public String getUuid() {
-    	return this.uuid;
-    }
-    
-    public void setUuid(String uuid) {
-    	this.uuid = uuid;
-    }
-    
-	@Override
-	public Short getAccountType() {
-		return accountType;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/vm/SecondaryStorageVm.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/SecondaryStorageVm.java b/core/src/com/cloud/vm/SecondaryStorageVm.java
deleted file mode 100644
index 9acff14..0000000
--- a/core/src/com/cloud/vm/SecondaryStorageVm.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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;
-
-/**
- *  Secondary Storage VM is a system VM instance that is used 
- *  to interface the management server to secondary storage
- */
-public interface SecondaryStorageVm extends SystemVm {
-	enum Role { templateProcessor, commandExecutor } 
-}
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/vm/SecondaryStorageVmVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/SecondaryStorageVmVO.java b/core/src/com/cloud/vm/SecondaryStorageVmVO.java
deleted file mode 100644
index aa2efa5..0000000
--- a/core/src/com/cloud/vm/SecondaryStorageVmVO.java
+++ /dev/null
@@ -1,135 +0,0 @@
-// 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;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.PrimaryKeyJoinColumn;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-
-/**
- * SecondaryStorageVmVO domain object
- */
-
-@Entity
-@Table(name = "secondary_storage_vm")
-@PrimaryKeyJoinColumn(name = "id")
-@DiscriminatorValue(value = "SecondaryStorageVm")
-public class SecondaryStorageVmVO extends VMInstanceVO implements SecondaryStorageVm {
-
-    @Column(name = "public_ip_address", nullable = false)
-    private String publicIpAddress;
-
-    @Column(name = "public_mac_address", nullable = false)
-    private String publicMacAddress;
-
-    @Column(name = "public_netmask", nullable = false)
-    private String publicNetmask;
-
-    @Column(name = "guid", nullable = false)
-    private String guid;
-
-    @Column(name = "nfs_share", nullable = false)
-    private String nfsShare;
-
-    @Column(name = "role", nullable = false)
-    @Enumerated(value = EnumType.STRING)
-    private Role role;
-
-    @Temporal(TemporalType.TIMESTAMP)
-    @Column(name = "last_update", updatable = true, nullable = true)
-    private Date lastUpdateTime;
-
-    public SecondaryStorageVmVO(long id, long serviceOfferingId, String name, long templateId, HypervisorType hypervisorType, long guestOSId, long dataCenterId, long domainId, long accountId,
-            Role role, boolean haEnabled) {
-        super(id, serviceOfferingId, name, name, Type.SecondaryStorageVm, templateId, hypervisorType, guestOSId, domainId, accountId, haEnabled);
-        this.role = role;
-    }
-
-    protected SecondaryStorageVmVO() {
-        super();
-    }
-
-    public void setPublicIpAddress(String publicIpAddress) {
-        this.publicIpAddress = publicIpAddress;
-    }
-
-    public void setPublicNetmask(String publicNetmask) {
-        this.publicNetmask = publicNetmask;
-    }
-
-    public void setPublicMacAddress(String publicMacAddress) {
-        this.publicMacAddress = publicMacAddress;
-    }
-
-    public void setLastUpdateTime(Date time) {
-        this.lastUpdateTime = time;
-    }
-
-    @Override
-    public String getPublicIpAddress() {
-        return this.publicIpAddress;
-    }
-
-    @Override
-    public String getPublicNetmask() {
-        return this.publicNetmask;
-    }
-
-    @Override
-    public String getPublicMacAddress() {
-        return this.publicMacAddress;
-    }
-
-    @Override
-    public Date getLastUpdateTime() {
-        return this.lastUpdateTime;
-    }
-
-    public void setGuid(String guid) {
-        this.guid = guid;
-    }
-
-    public String getGuid() {
-        return guid;
-    }
-
-    public void setNfsShare(String nfsShare) {
-        this.nfsShare = nfsShare;
-    }
-
-    public String getNfsShare() {
-        return nfsShare;
-    }
-
-    public Role getRole() {
-        return this.role;
-    }
-
-    public void setRole(Role role) {
-        this.role = role;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/vm/SystemVm.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/SystemVm.java b/core/src/com/cloud/vm/SystemVm.java
deleted file mode 100644
index a697d08..0000000
--- a/core/src/com/cloud/vm/SystemVm.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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;
-
-import java.util.Date;
-
-public interface SystemVm extends VirtualMachine {
-    public String getPublicIpAddress();
-    public String getPublicNetmask();
-    public String getPublicMacAddress();
-    public Date getLastUpdateTime();
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/vm/UserVmCloneSettingVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/UserVmCloneSettingVO.java b/core/src/com/cloud/vm/UserVmCloneSettingVO.java
deleted file mode 100644
index 24bb1e8..0000000
--- a/core/src/com/cloud/vm/UserVmCloneSettingVO.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-
-@Entity
-@Table(name="user_vm_clone_setting")
-public class UserVmCloneSettingVO {
-
-    @Column(name="vm_id")
-    private Long vmId;
-
-    @Column(name="clone_type")
-    private String cloneType;
-
-    public UserVmCloneSettingVO() {
-
-    }
-
-    public UserVmCloneSettingVO(long id,
-            String cloneType) {
-        this.vmId = id;
-        this.cloneType = cloneType;
-    }
-
-    public long getVmId() {
-        return this.vmId;
-    }
-
-    public String getCloneType() {
-        return this.cloneType;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/vm/UserVmDetailVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/UserVmDetailVO.java b/core/src/com/cloud/vm/UserVmDetailVO.java
deleted file mode 100644
index 245b577..0000000
--- a/core/src/com/cloud/vm/UserVmDetailVO.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// 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;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name="user_vm_details")
-public class UserVmDetailVO implements InternalIdentity {
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private long id;
-    
-    @Column(name="vm_id")
-    private long vmId;
-    
-    @Column(name="name")
-    private String name;
-    
-    @Column(name="value", length=1024)
-    private String value;
-    
-    public UserVmDetailVO() {}
-    
-    public UserVmDetailVO(long vmId, String name, String value) {
-    	this.vmId = vmId;
-    	this.name = name;
-    	this.value = value;
-    }
-
-	public long getId() {
-		return id;
-	}
-
-	public long getVmId() {
-		return vmId;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public String getValue() {
-		return value;
-	}
-
-	public void setId(long id) {
-		this.id = id;
-	}
-
-	public void setVmId(long vmId) {
-		this.vmId = vmId;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public void setValue(String value) {
-		this.value = value;
-	}
-	
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/vm/UserVmVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/UserVmVO.java b/core/src/com/cloud/vm/UserVmVO.java
deleted file mode 100755
index 2e9bdf5..0000000
--- a/core/src/com/cloud/vm/UserVmVO.java
+++ /dev/null
@@ -1,141 +0,0 @@
-// 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;
-
-import java.util.HashMap;
-
-import javax.persistence.Basic;
-import javax.persistence.Column;
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.PrimaryKeyJoinColumn;
-import javax.persistence.Table;
-
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.uservm.UserVm;
-
-@Entity
-@Table(name="user_vm")
-@DiscriminatorValue(value="User")
-@PrimaryKeyJoinColumn(name="id")
-public class UserVmVO extends VMInstanceVO implements UserVm {
-
-    @Column(name="iso_id", nullable=true, length=17)
-    private Long isoId = null;
-    
-    @Column(name="user_data", updatable=true, nullable=true, length=32768)
-    @Basic(fetch = FetchType.LAZY)
-    private String userData;
-    
-    @Column(name="display_name", updatable=true, nullable=true)
-    private String displayName;
-    
-    @Column(name="update_parameters", updatable=true)
-    protected boolean updateParameters = true;
-    
-    transient String password;
-
-    @Override
-    public String getPassword() {
-        return password;
-    }
-    
-    public void setPassword(String password) {
-        this.password = password;
-    }
-
-    @Override
-    public Long getIsoId() {
-        return isoId;
-    }
-    
-    @Override
-    public long getServiceOfferingId() {
-        return serviceOfferingId;
-    }
-
-    public UserVmVO(long id,
-                    String instanceName,
-                    String displayName,
-                    long templateId,
-                    HypervisorType hypervisorType,
-                    long guestOsId,
-                    boolean haEnabled,
-                    boolean limitCpuUse,
-                    long domainId,
-                    long accountId,
-                    long serviceOfferingId,
-                    String userData,
-                    String name, Long diskOfferingId) {
-        super(id, serviceOfferingId, name, instanceName, Type.User, templateId, hypervisorType, guestOsId, domainId, accountId, haEnabled, limitCpuUse, diskOfferingId);
-        this.userData = userData;
-        this.displayName = displayName;
-    	this.details = new HashMap<String, String>();
-    }
-    
-    protected UserVmVO() {
-        super();
-    }
-
-	public void setIsoId(Long id) {
-	    this.isoId = id;
-	}
-	
-    @Override
-	public void setUserData(String userData) {
-		this.userData = userData;
-	}
-
-    @Override
-	public String getUserData() {
-		return userData;
-	}
-	
-	@Override
-	public String getDisplayName() {
-	    return displayName;
-	}
-	
-	public void setDisplayName(String displayName) {
-	    this.displayName = displayName;
-	}
-	
-    @Override
-    public String getDetail(String name) {
-        assert (details != null) : "Did you forget to load the details?";
-        
-        return details != null ? details.get(name) : null;
-    }
-    
-    @Override
-    public void setAccountId(long accountId){
-        this.accountId = accountId;
-    }
-    
-    public void setDomainId(long domainId){
-        this.domainId = domainId;
-    }
-
-    public void setUpdateParameters(boolean updateParameters) {
-        this.updateParameters = updateParameters;
-    }
-
-    public boolean isUpdateParameters() {
-        return updateParameters;
-    }
-}


[11/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java b/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java
new file mode 100755
index 0000000..73f310f
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java
@@ -0,0 +1,376 @@
+// 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.network.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Date;
+import java.util.List;
+
+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.dc.Vlan.VlanType;
+import com.cloud.dc.VlanVO;
+import com.cloud.dc.dao.VlanDao;
+import com.cloud.dc.dao.VlanDaoImpl;
+import com.cloud.network.IpAddress.State;
+import com.cloud.server.ResourceTag.TaggedResourceType;
+import com.cloud.tags.dao.ResourceTagDao;
+import com.cloud.tags.dao.ResourceTagsDaoImpl;
+import com.cloud.utils.db.DB;
+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.SearchCriteria.Op;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.net.Ip;
+
+@Component
+@Local(value = { IPAddressDao.class })
+@DB
+public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implements IPAddressDao {
+    private static final Logger s_logger = Logger.getLogger(IPAddressDaoImpl.class);
+
+    protected SearchBuilder<IPAddressVO> AllFieldsSearch;
+    protected SearchBuilder<IPAddressVO> VlanDbIdSearchUnallocated;
+    protected GenericSearchBuilder<IPAddressVO, Integer> AllIpCount;
+    protected GenericSearchBuilder<IPAddressVO, Integer> AllocatedIpCount;
+    protected GenericSearchBuilder<IPAddressVO, Integer> AllIpCountForDashboard;    
+    protected GenericSearchBuilder<IPAddressVO, Long> AllocatedIpCountForAccount;    
+    @Inject protected VlanDao _vlanDao;
+    protected GenericSearchBuilder<IPAddressVO, Long> CountFreePublicIps;
+    @Inject ResourceTagDao _tagsDao;
+
+    // make it public for JUnit test
+    public IPAddressDaoImpl() {
+    }
+
+    @PostConstruct
+    public void init() {
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ);
+        AllFieldsSearch.and("dataCenterId", AllFieldsSearch.entity().getDataCenterId(), Op.EQ);
+        AllFieldsSearch.and("ipAddress", AllFieldsSearch.entity().getAddress(), Op.EQ);
+        AllFieldsSearch.and("vlan", AllFieldsSearch.entity().getVlanId(), Op.EQ);
+        AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAllocatedToAccountId(), Op.EQ);
+        AllFieldsSearch.and("sourceNat", AllFieldsSearch.entity().isSourceNat(), Op.EQ);
+        AllFieldsSearch.and("network", AllFieldsSearch.entity().getAssociatedWithNetworkId(), Op.EQ);
+        AllFieldsSearch.and("associatedWithVmId", AllFieldsSearch.entity().getAssociatedWithVmId(), Op.EQ);
+        AllFieldsSearch.and("oneToOneNat", AllFieldsSearch.entity().isOneToOneNat(), Op.EQ);
+        AllFieldsSearch.and("sourcenetwork", AllFieldsSearch.entity().getSourceNetworkId(), Op.EQ);
+        AllFieldsSearch.and("physicalNetworkId", AllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        AllFieldsSearch.and("vpcId", AllFieldsSearch.entity().getVpcId(), Op.EQ);
+        AllFieldsSearch.and("associatedVmIp", AllFieldsSearch.entity().getVmIp(), Op.EQ);
+        AllFieldsSearch.done();
+
+        VlanDbIdSearchUnallocated = createSearchBuilder();
+        VlanDbIdSearchUnallocated.and("allocated", VlanDbIdSearchUnallocated.entity().getAllocatedTime(), Op.NULL);
+        VlanDbIdSearchUnallocated.and("vlanDbId", VlanDbIdSearchUnallocated.entity().getVlanId(), Op.EQ);
+        VlanDbIdSearchUnallocated.done();
+
+        AllIpCount = createSearchBuilder(Integer.class);
+        AllIpCount.select(null, Func.COUNT, AllIpCount.entity().getAddress());
+        AllIpCount.and("dc", AllIpCount.entity().getDataCenterId(), Op.EQ);
+        AllIpCount.and("vlan", AllIpCount.entity().getVlanId(), Op.EQ);
+        AllIpCount.done();
+
+        AllocatedIpCount = createSearchBuilder(Integer.class);
+        AllocatedIpCount.select(null, Func.COUNT, AllocatedIpCount.entity().getAddress());
+        AllocatedIpCount.and("dc", AllocatedIpCount.entity().getDataCenterId(), Op.EQ);
+        AllocatedIpCount.and("vlan", AllocatedIpCount.entity().getVlanId(), Op.EQ);
+        AllocatedIpCount.and("allocated", AllocatedIpCount.entity().getAllocatedTime(), Op.NNULL);
+        AllocatedIpCount.done();              
+
+        AllIpCountForDashboard = createSearchBuilder(Integer.class);
+        AllIpCountForDashboard.select(null, Func.COUNT, AllIpCountForDashboard.entity().getAddress());
+        AllIpCountForDashboard.and("dc", AllIpCountForDashboard.entity().getDataCenterId(), Op.EQ);        
+        AllIpCountForDashboard.and("state", AllIpCountForDashboard.entity().getState(), SearchCriteria.Op.NEQ);                
+
+        SearchBuilder<VlanVO> virtaulNetworkVlan = _vlanDao.createSearchBuilder();
+        virtaulNetworkVlan.and("vlanType", virtaulNetworkVlan.entity().getVlanType(), SearchCriteria.Op.EQ);
+
+        AllIpCountForDashboard.join("vlan", virtaulNetworkVlan, virtaulNetworkVlan.entity().getId(),
+                AllIpCountForDashboard.entity().getVlanId(), JoinBuilder.JoinType.INNER);
+        virtaulNetworkVlan.done();
+        AllIpCountForDashboard.done();
+
+        AllocatedIpCountForAccount = createSearchBuilder(Long.class);
+        AllocatedIpCountForAccount.select(null, Func.COUNT, AllocatedIpCountForAccount.entity().getAddress());
+        AllocatedIpCountForAccount.and("account", AllocatedIpCountForAccount.entity().getAllocatedToAccountId(), Op.EQ);
+        AllocatedIpCountForAccount.and("allocated", AllocatedIpCountForAccount.entity().getAllocatedTime(), Op.NNULL);
+        AllocatedIpCountForAccount.and("network", AllocatedIpCountForAccount.entity().getAssociatedWithNetworkId(), Op.NNULL);        
+        AllocatedIpCountForAccount.done();
+
+        CountFreePublicIps = createSearchBuilder(Long.class);
+        CountFreePublicIps.select(null, Func.COUNT, null);
+        CountFreePublicIps.and("state", CountFreePublicIps.entity().getState(), SearchCriteria.Op.EQ);
+        CountFreePublicIps.and("networkId", CountFreePublicIps.entity().getSourceNetworkId(), SearchCriteria.Op.EQ);
+        SearchBuilder<VlanVO> join = _vlanDao.createSearchBuilder();
+        join.and("vlanType", join.entity().getVlanType(), Op.EQ);
+        CountFreePublicIps.join("vlans", join, CountFreePublicIps.entity().getVlanId(), join.entity().getId(), JoinBuilder.JoinType.INNER);
+        CountFreePublicIps.done();
+    }
+
+    @Override
+    public boolean mark(long dcId, Ip ip) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("dataCenterId", dcId);
+        sc.setParameters("ipAddress", ip);
+
+        IPAddressVO vo = createForUpdate();
+        vo.setAllocatedTime(new Date());
+        vo.setState(State.Allocated);
+
+        return update(vo, sc) >= 1;
+    }
+
+    @Override
+    public void unassignIpAddress(long ipAddressId) {
+        IPAddressVO address = createForUpdate();
+        address.setAllocatedToAccountId(null);
+        address.setAllocatedInDomainId(null);
+        address.setAllocatedTime(null);
+        address.setSourceNat(false);
+        address.setOneToOneNat(false);
+        address.setAssociatedWithVmId(null);
+        address.setState(State.Free);
+        address.setAssociatedWithNetworkId(null);
+        address.setVpcId(null);
+        address.setSystem(false);
+        update(ipAddressId, address);
+    }
+
+    @Override
+    public List<IPAddressVO> listByAccount(long accountId) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("accountId", accountId);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<IPAddressVO> listByVlanId(long vlanId) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("vlan", vlanId);
+        return listBy(sc);
+    }
+
+    @Override
+    public IPAddressVO findByIpAndSourceNetworkId(long networkId, String ipAddress) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("sourcenetwork", networkId);
+        sc.setParameters("ipAddress", ipAddress);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public IPAddressVO findByIpAndNetworkId(long networkId, String ipAddress) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("network", networkId);
+        sc.setParameters("ipAddress", ipAddress);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public IPAddressVO findByIpAndDcId(long dcId, String ipAddress) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("dataCenterId", dcId);
+        sc.setParameters("ipAddress", ipAddress);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public List<IPAddressVO> listByDcId(long dcId) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("dataCenterId", dcId);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<IPAddressVO> listByDcIdIpAddress(long dcId, String ipAddress) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("dataCenterId", dcId);
+        sc.setParameters("ipAddress", ipAddress);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<IPAddressVO> listByAssociatedNetwork(long networkId, Boolean isSourceNat) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("network", networkId);
+
+        if (isSourceNat != null) {
+            sc.setParameters("sourceNat", isSourceNat);
+        }
+
+        return listBy(sc);
+    }
+
+    @Override 
+    public List<IPAddressVO> listStaticNatPublicIps(long networkId) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("network", networkId);
+        sc.setParameters("oneToOneNat", true);
+        return listBy(sc);        
+    }
+
+    @Override
+    public IPAddressVO findByAssociatedVmId(long vmId) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("associatedWithVmId", vmId);
+
+        return findOneBy(sc);
+    }
+
+    @Override
+    public IPAddressVO findByVmIp(String vmIp) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("associatedVmIp", vmIp);
+        return findOneBy(sc);
+    }
+    @Override
+    public int countIPs(long dcId, long vlanId, boolean onlyCountAllocated) {
+        SearchCriteria<Integer> sc = onlyCountAllocated ? AllocatedIpCount.create() : AllIpCount.create();
+        sc.setParameters("dc", dcId);
+        sc.setParameters("vlan", vlanId);
+
+        return customSearch(sc, null).get(0);
+    }
+
+    @Override
+    public int countIPsForNetwork(long dcId, boolean onlyCountAllocated, VlanType vlanType) {
+        SearchCriteria<Integer> sc = AllIpCountForDashboard.create();
+        sc.setParameters("dc", dcId);
+        if (onlyCountAllocated){
+            sc.setParameters("state", State.Free);
+        }
+        sc.setJoinParameters("vlan", "vlanType", vlanType.toString());
+        return customSearch(sc, null).get(0);
+    }
+
+
+    @Override
+    @DB
+    public int countIPs(long dcId, Long accountId, String vlanId, String vlanGateway, String vlanNetmask) {
+        Transaction txn = Transaction.currentTxn();
+        int ipCount = 0;
+        try {
+            String sql = "SELECT count(*) FROM user_ip_address u INNER JOIN vlan v on (u.vlan_db_id = v.id AND v.data_center_id = ? AND v.vlan_id = ? AND v.vlan_gateway = ? AND v.vlan_netmask = ? AND u.account_id = ?)";
+
+            PreparedStatement pstmt = txn.prepareAutoCloseStatement(sql);
+            pstmt.setLong(1, dcId);
+            pstmt.setString(2, vlanId);
+            pstmt.setString(3, vlanGateway);
+            pstmt.setString(4, vlanNetmask);
+            pstmt.setLong(5, accountId);
+            ResultSet rs = pstmt.executeQuery();
+
+            if (rs.next()) {
+                ipCount = rs.getInt(1);
+            }
+        } catch (Exception e) {
+            s_logger.warn("Exception counting IP addresses", e);
+        }
+
+        return ipCount;
+    }
+
+    @Override @DB
+    public IPAddressVO markAsUnavailable(long ipAddressId) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("id", ipAddressId);
+
+        IPAddressVO ip = createForUpdate();
+        ip.setState(State.Releasing);
+        if (update(ip, sc) != 1) {
+            return null;
+        }
+
+        return findOneBy(sc);
+    }
+
+    @Override
+    public long countAllocatedIPsForAccount(long accountId) {
+        SearchCriteria<Long> sc = AllocatedIpCountForAccount.create();
+        sc.setParameters("account", accountId);
+        return customSearch(sc, null).get(0);
+    }
+
+    @Override
+    public List<IPAddressVO> listByPhysicalNetworkId(long physicalNetworkId) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        return listBy(sc);
+    }
+
+    @Override
+    public long countFreePublicIPs() {
+        SearchCriteria<Long> sc = CountFreePublicIps.create();
+        sc.setParameters("state", State.Free);
+        sc.setJoinParameters("vlans", "vlanType", VlanType.VirtualNetwork);
+        return customSearch(sc, null).get(0);       
+    }
+
+    @Override
+    public List<IPAddressVO> listByAssociatedVpc(long vpcId, Boolean isSourceNat) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("vpcId", vpcId);
+
+        if (isSourceNat != null) {
+            sc.setParameters("sourceNat", isSourceNat);
+        }
+
+        return listBy(sc);
+    }
+
+    @Override
+    public long countFreeIPsInNetwork(long networkId) {
+        SearchCriteria<Long> sc = CountFreePublicIps.create();
+        sc.setParameters("state", State.Free);
+        sc.setParameters("networkId", networkId);
+        return customSearch(sc, null).get(0);       
+    }
+
+    @Override
+    @DB
+    public boolean remove(Long id) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        IPAddressVO entry = findById(id);
+        if (entry != null) {
+            _tagsDao.removeByIdAndType(id, TaggedResourceType.SecurityGroup);
+        }
+        boolean result = super.remove(id);
+        txn.commit();
+        return result;
+    }
+
+    @Override
+    public IPAddressVO findByAssociatedVmIdAndVmIp(long vmId, String vmIp) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("associatedWithVmId", vmId);
+        sc.setParameters("associatedVmIp", vmIp);
+        return findOneBy(sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/IPAddressVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/IPAddressVO.java b/engine/schema/src/com/cloud/network/dao/IPAddressVO.java
new file mode 100644
index 0000000..ae27e95
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/IPAddressVO.java
@@ -0,0 +1,308 @@
+// 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.network.dao;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import com.cloud.network.IpAddress;
+import com.cloud.utils.net.Ip;
+
+/**
+ * A bean representing a public IP Address
+ *
+ */
+@Entity
+@Table(name=("user_ip_address"))
+public class IPAddressVO implements IpAddress {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+
+	@Column(name="account_id")
+	private Long allocatedToAccountId = null;
+
+    @Column(name="domain_id")
+    private Long allocatedInDomainId = null;
+
+	@Id
+	@Column(name="public_ip_address")
+	@Enumerated(value=EnumType.STRING)
+	private Ip address = null;
+
+	@Column(name="data_center_id", updatable=false)
+	private long dataCenterId;
+
+	@Column(name="source_nat")
+	private boolean sourceNat;
+
+	@Column(name="allocated")
+	@Temporal(value=TemporalType.TIMESTAMP)
+	private Date allocatedTime;
+
+	@Column(name="vlan_db_id")
+	private long vlanId;
+
+	@Column(name="one_to_one_nat")
+	private boolean oneToOneNat;
+
+	@Column(name="vm_id")
+    private Long associatedWithVmId;
+
+	@Column(name="state")
+	private State state;
+
+	@Column(name="mac_address")
+	private long macAddress;
+
+	@Column(name="source_network_id")
+    private Long sourceNetworkId;
+
+	@Column(name="network_id")
+	private Long associatedWithNetworkId;
+
+	@Column(name="uuid")
+	private String uuid;
+
+    @Column(name="physical_network_id")
+    private Long physicalNetworkId;
+
+    @Column(name="is_system")
+    private boolean system;
+
+	@Column(name="account_id")
+	@Transient
+	private Long accountId = null;
+
+	@Transient
+    @Column(name="domain_id")
+    private Long domainId = null;
+
+    @Column(name="vpc_id")
+    private Long vpcId;
+
+    @Column(name="dnat_vmip")
+    private String vmIp;
+
+
+	protected IPAddressVO() {
+		this.uuid = UUID.randomUUID().toString();
+	}
+
+	@Override
+    public boolean readyToUse() {
+	    return state == State.Allocated;
+	}
+
+	public IPAddressVO(Ip address, long dataCenterId, long macAddress, long vlanDbId, boolean sourceNat) {
+		this.address = address;
+		this.dataCenterId = dataCenterId;
+		this.vlanId = vlanDbId;
+		this.sourceNat = sourceNat;
+		this.allocatedInDomainId = null;
+		this.allocatedToAccountId = null;
+		this.allocatedTime = null;
+		this.state = State.Free;
+		this.macAddress = macAddress;
+		this.uuid = UUID.randomUUID().toString();
+	}
+
+    public long getMacAddress() {
+	    return macAddress;
+	}
+
+	@Override
+    public long getDataCenterId() {
+	    return dataCenterId;
+	}
+
+	@Override
+    public Ip getAddress() {
+		return address;
+	}
+
+	@Override
+    public Long getAllocatedToAccountId() {
+		return allocatedToAccountId;
+	}
+
+    @Override
+    public Long getAllocatedInDomainId() {
+        return allocatedInDomainId;
+    }
+
+	@Override
+	public Long getAssociatedWithNetworkId() {
+	    return associatedWithNetworkId;
+	}
+
+	public void setAssociatedWithNetworkId(Long networkId) {
+	    this.associatedWithNetworkId = networkId;
+	}
+
+	@Override
+    public Long getAssociatedWithVmId() {
+        return associatedWithVmId;
+    }
+
+    public void setAssociatedWithVmId(Long associatedWithVmId) {
+        this.associatedWithVmId = associatedWithVmId;
+    }
+
+	@Override
+    public Date getAllocatedTime() {
+		return allocatedTime;
+	}
+
+    public void setAllocatedToAccountId(Long accountId) {
+		this.allocatedToAccountId = accountId;
+	}
+
+    public void setAllocatedInDomainId(Long domainId) {
+        this.allocatedInDomainId = domainId;
+    }
+
+    public void setSourceNat(boolean sourceNat) {
+		this.sourceNat = sourceNat;
+	}
+
+	@Override
+    public boolean isSourceNat() {
+		return sourceNat;
+	}
+
+    public void setAllocatedTime(Date allocated) {
+		this.allocatedTime = allocated;
+	}
+
+	@Override
+    public long getVlanId() {
+		return this.vlanId;
+	}
+
+    public void setVlanId(long vlanDbId) {
+		this.vlanId = vlanDbId;
+	}
+
+	@Override
+    public boolean isOneToOneNat() {
+		return oneToOneNat;
+	}
+
+    public void setOneToOneNat(boolean oneToOneNat) {
+		this.oneToOneNat = oneToOneNat;
+	}
+
+    @Override
+    public long getDomainId() {
+        return allocatedInDomainId == null ? -1 : allocatedInDomainId;
+    }
+
+    @Override
+    public long getAccountId() {
+        return allocatedToAccountId == null ? -1 : allocatedToAccountId;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    public void setState(State state) {
+        this.state = state;
+    }
+
+	@Override
+    public String toString() {
+	    return new StringBuilder("Ip[").append(address).append("-").append(dataCenterId).append("]").toString();
+	}
+
+	@Override
+    public long getId() {
+        return id;
+    }
+
+    public Long getSourceNetworkId() {
+        return sourceNetworkId;
+    }
+
+    public void setSourceNetworkId(Long sourceNetworkId) {
+        this.sourceNetworkId = sourceNetworkId;
+    }
+
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+
+    public Long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public void setPhysicalNetworkId(Long physicalNetworkId) {
+        this.physicalNetworkId = physicalNetworkId;
+    }
+
+    @Override
+	public boolean getSystem() {
+		return system;
+	}
+
+	public void setSystem(boolean isSystem) {
+		this.system = isSystem;
+	}
+
+	@Override
+    public Long getVpcId() {
+        return vpcId;
+    }
+
+    public void setVpcId(Long vpcId) {
+        this.vpcId = vpcId;
+    }
+
+    @Override
+    public String getVmIp() {
+        return vmIp;
+    }
+
+    public void setVmIp(String vmIp) {
+        this.vmIp = vmIp;
+    }
+
+    @Override
+    public Long getNetworkId() {
+        return sourceNetworkId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/InlineLoadBalancerNicMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/InlineLoadBalancerNicMapDao.java b/engine/schema/src/com/cloud/network/dao/InlineLoadBalancerNicMapDao.java
new file mode 100644
index 0000000..36a8eef
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/InlineLoadBalancerNicMapDao.java
@@ -0,0 +1,24 @@
+// 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.network.dao;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface InlineLoadBalancerNicMapDao extends GenericDao<InlineLoadBalancerNicMapVO, Long> {
+	InlineLoadBalancerNicMapVO findByPublicIpAddress(String publicIpAddress);
+	InlineLoadBalancerNicMapVO findByNicId(long nicId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/InlineLoadBalancerNicMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/InlineLoadBalancerNicMapDaoImpl.java b/engine/schema/src/com/cloud/network/dao/InlineLoadBalancerNicMapDaoImpl.java
new file mode 100644
index 0000000..f3f04ed
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/InlineLoadBalancerNicMapDaoImpl.java
@@ -0,0 +1,46 @@
+// 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.network.dao;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value={InlineLoadBalancerNicMapDao.class})
+public class InlineLoadBalancerNicMapDaoImpl extends GenericDaoBase<InlineLoadBalancerNicMapVO, Long> implements InlineLoadBalancerNicMapDao {
+
+    @Override
+    public InlineLoadBalancerNicMapVO findByPublicIpAddress(String publicIpAddress) {
+        SearchCriteria<InlineLoadBalancerNicMapVO> sc = createSearchCriteria();
+        sc.addAnd("publicIpAddress", SearchCriteria.Op.EQ, publicIpAddress);
+
+        return findOneBy(sc);
+    }
+    
+    @Override
+    public InlineLoadBalancerNicMapVO findByNicId(long nicId) {
+    	SearchCriteria<InlineLoadBalancerNicMapVO> sc = createSearchCriteria();
+    	sc.addAnd("nicId", SearchCriteria.Op.EQ, nicId);
+    	
+    	return findOneBy(sc);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/InlineLoadBalancerNicMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/InlineLoadBalancerNicMapVO.java b/engine/schema/src/com/cloud/network/dao/InlineLoadBalancerNicMapVO.java
new file mode 100644
index 0000000..35aeefa
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/InlineLoadBalancerNicMapVO.java
@@ -0,0 +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.network.dao;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name=("inline_load_balancer_nic_map"))
+public class InlineLoadBalancerNicMapVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="public_ip_address")
+    private String publicIpAddress;
+
+    @Column(name="nic_id")
+    private long nicId;
+
+    public InlineLoadBalancerNicMapVO() { }
+
+    public InlineLoadBalancerNicMapVO(String publicIpAddress, long nicId) {
+        this.publicIpAddress = publicIpAddress;
+        this.nicId = nicId;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public String getPublicIpAddress() {
+    	return publicIpAddress;
+    }
+
+    public long getNicId() {
+    	return nicId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/LBHealthCheckPolicyDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/LBHealthCheckPolicyDao.java b/engine/schema/src/com/cloud/network/dao/LBHealthCheckPolicyDao.java
new file mode 100644
index 0000000..42a9e42
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/LBHealthCheckPolicyDao.java
@@ -0,0 +1,35 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.network.LBHealthCheckPolicyVO;
+import com.cloud.utils.db.GenericDao;
+
+
+public interface LBHealthCheckPolicyDao extends
+        GenericDao<LBHealthCheckPolicyVO, Long> {
+    void remove(long loadBalancerId);
+
+    void remove(long loadBalancerId, Boolean pending);
+
+    List<LBHealthCheckPolicyVO> listByLoadBalancerId(long loadBalancerId);
+
+    List<LBHealthCheckPolicyVO> listByLoadBalancerId(long loadBalancerId,
+            boolean revoke);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/LBHealthCheckPolicyDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/LBHealthCheckPolicyDaoImpl.java b/engine/schema/src/com/cloud/network/dao/LBHealthCheckPolicyDaoImpl.java
new file mode 100644
index 0000000..65e0689
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/LBHealthCheckPolicyDaoImpl.java
@@ -0,0 +1,71 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.LBHealthCheckPolicyVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchCriteria;
+
+
+@Component
+@Local(value = { LBHealthCheckPolicyDao.class })
+public class LBHealthCheckPolicyDaoImpl extends
+        GenericDaoBase<LBHealthCheckPolicyVO, Long> implements
+        LBHealthCheckPolicyDao {
+
+    @Override
+    public void remove(long loadBalancerId) {
+        SearchCriteria<LBHealthCheckPolicyVO> sc = createSearchCriteria();
+        sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
+
+        expunge(sc);
+    }
+
+    @Override
+    public void remove(long loadBalancerId, Boolean revoke) {
+        SearchCriteria<LBHealthCheckPolicyVO> sc = createSearchCriteria();
+        sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
+        sc.addAnd("revoke", SearchCriteria.Op.EQ, revoke);
+
+        expunge(sc);
+    }
+
+    @Override
+    public List<LBHealthCheckPolicyVO> listByLoadBalancerId(long loadBalancerId) {
+        SearchCriteria<LBHealthCheckPolicyVO> sc = createSearchCriteria();
+        sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<LBHealthCheckPolicyVO> listByLoadBalancerId(long loadBalancerId,
+            boolean pending) {
+        SearchCriteria<LBHealthCheckPolicyVO> sc = createSearchCriteria();
+        sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
+        sc.addAnd("revoke", SearchCriteria.Op.EQ, pending);
+
+        return listBy(sc);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/LBStickinessPolicyDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/LBStickinessPolicyDao.java b/engine/schema/src/com/cloud/network/dao/LBStickinessPolicyDao.java
new file mode 100644
index 0000000..9a25c1a
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/LBStickinessPolicyDao.java
@@ -0,0 +1,34 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.utils.db.GenericDao;
+
+
+public interface LBStickinessPolicyDao extends
+        GenericDao<LBStickinessPolicyVO, Long> {
+    void remove(long loadBalancerId);
+
+    void remove(long loadBalancerId, Boolean pending);
+
+    List<LBStickinessPolicyVO> listByLoadBalancerId(long loadBalancerId);
+
+    List<LBStickinessPolicyVO> listByLoadBalancerId(long loadBalancerId,
+            boolean revoke);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/LBStickinessPolicyDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/LBStickinessPolicyDaoImpl.java b/engine/schema/src/com/cloud/network/dao/LBStickinessPolicyDaoImpl.java
new file mode 100644
index 0000000..43b4669
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/LBStickinessPolicyDaoImpl.java
@@ -0,0 +1,69 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value = { LBStickinessPolicyDao.class })
+public class LBStickinessPolicyDaoImpl extends
+        GenericDaoBase<LBStickinessPolicyVO, Long> implements
+        LBStickinessPolicyDao {
+
+    @Override
+    public void remove(long loadBalancerId) {
+        SearchCriteria<LBStickinessPolicyVO> sc = createSearchCriteria();
+        sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
+
+        expunge(sc);
+    }
+
+    @Override
+    public void remove(long loadBalancerId, Boolean revoke) {
+        SearchCriteria<LBStickinessPolicyVO> sc = createSearchCriteria();
+        sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
+        sc.addAnd("revoke", SearchCriteria.Op.EQ, revoke);
+
+        expunge(sc);
+    }
+
+    @Override
+    public List<LBStickinessPolicyVO> listByLoadBalancerId(long loadBalancerId) {
+        SearchCriteria<LBStickinessPolicyVO> sc = createSearchCriteria();
+        sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<LBStickinessPolicyVO> listByLoadBalancerId(long loadBalancerId,
+            boolean pending) {
+        SearchCriteria<LBStickinessPolicyVO> sc = createSearchCriteria();
+        sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
+        sc.addAnd("revoke", SearchCriteria.Op.EQ, pending);
+
+        return listBy(sc);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/LBStickinessPolicyVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/LBStickinessPolicyVO.java b/engine/schema/src/com/cloud/network/dao/LBStickinessPolicyVO.java
new file mode 100644
index 0000000..3fbba68
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/LBStickinessPolicyVO.java
@@ -0,0 +1,145 @@
+// 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.network.dao;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+import com.cloud.network.rules.StickinessPolicy;
+import com.cloud.utils.Pair;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = ("load_balancer_stickiness_policies"))
+@PrimaryKeyJoinColumn(name = "load_balancer_id", referencedColumnName = "id")
+public class LBStickinessPolicyVO implements StickinessPolicy {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "load_balancer_id")
+    private long loadBalancerId;
+
+    @Column(name = "name")
+    private String name;
+
+    @Column(name = "description")
+    private String description;
+
+    @Column(name = "method_name")
+    private String methodName;
+
+    @Column(name = "params")
+    private String paramsInDB;
+
+    @Column(name = "uuid")
+    private String uuid;
+    
+    @Column(name = "revoke")
+    private boolean revoke = false;
+    protected LBStickinessPolicyVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+/*  get the params in Map format and converts in to string format and stores in DB
+ *  paramsInDB represent the string stored in database :
+ *  Format :  param1=value1&param2=value2&param3=value3& 
+ *  Example for App cookie method:  "name=cookapp&length=12&holdtime=3h" . Here 3 parameters name,length and holdtime with corresponding values.
+ *  getParams function is used to get in List<Pair<string,String>> Format.
+ *           - API response use Map format
+ *           - In database plain String with DB_PARM_DELIMITER 
+ *           - rest of the code uses List<Pair<string,String>> 
+ */
+    public LBStickinessPolicyVO(long loadBalancerId, String name, String methodName, Map paramList, String description) {
+        this.loadBalancerId = loadBalancerId;
+        this.name = name;
+        this.methodName = methodName;
+        StringBuilder sb = new StringBuilder("");
+
+        if (paramList != null) {
+            Iterator<HashMap<String, String>> iter = paramList.values().iterator();
+            while (iter.hasNext())  {
+                HashMap<String, String>  paramKVpair =  iter.next();
+                String paramName = paramKVpair.get("name");
+                String paramValue =  paramKVpair.get("value");
+                sb.append(paramName + "=" + paramValue + "&");
+            }
+        } 
+        paramsInDB = sb.toString();
+        this.description = description;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public List<Pair<String, String>> getParams() {
+        List<Pair<String, String>> paramsList = new ArrayList<Pair<String, String>>();
+        String[] params = paramsInDB.split("[=&]");
+ 
+        for (int i = 0; i < (params.length - 1); i = i + 2) {
+            paramsList.add(new Pair<String, String>(params[i], params[i + 1]));
+        }
+        return paramsList;
+    }
+    
+    public long getId() {
+        return id;
+    }
+
+    public long getLoadBalancerId() {
+        return loadBalancerId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public String getMethodName() {
+        return methodName;
+    }
+    
+    public boolean isRevoke() {
+        return revoke;
+    }
+
+    public void setRevoke(boolean revoke) {
+        this.revoke = revoke;
+    }
+    
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+    
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/LoadBalancerDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/LoadBalancerDao.java b/engine/schema/src/com/cloud/network/dao/LoadBalancerDao.java
new file mode 100644
index 0000000..331f755
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/LoadBalancerDao.java
@@ -0,0 +1,32 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.network.rules.LoadBalancerContainer.Scheme;
+import com.cloud.utils.db.GenericDao;
+
+public interface LoadBalancerDao extends GenericDao<LoadBalancerVO, Long> {
+
+    List<LoadBalancerVO> listByIpAddress(long ipAddressId);
+
+    List<LoadBalancerVO> listByNetworkIdAndScheme(long networkId, Scheme scheme);
+
+    List<LoadBalancerVO> listInTransitionStateByNetworkIdAndScheme(long networkId, Scheme scheme);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/LoadBalancerDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/LoadBalancerDaoImpl.java b/engine/schema/src/com/cloud/network/dao/LoadBalancerDaoImpl.java
new file mode 100644
index 0000000..c20d8b2
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/LoadBalancerDaoImpl.java
@@ -0,0 +1,79 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.rules.FirewallRule.State;
+import com.cloud.network.rules.LoadBalancerContainer.Scheme;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value = { LoadBalancerDao.class })
+public class LoadBalancerDaoImpl extends GenericDaoBase<LoadBalancerVO, Long> implements LoadBalancerDao {
+    private final SearchBuilder<LoadBalancerVO> ListByIp;
+    protected final SearchBuilder<LoadBalancerVO> TransitionStateSearch;
+
+    @Inject protected FirewallRulesCidrsDao _portForwardingRulesCidrsDao;
+
+    protected LoadBalancerDaoImpl() {
+        ListByIp = createSearchBuilder();
+        ListByIp.and("ipAddressId", ListByIp.entity().getSourceIpAddressId(), SearchCriteria.Op.EQ);
+        ListByIp.and("networkId", ListByIp.entity().getNetworkId(), SearchCriteria.Op.EQ);
+        ListByIp.and("scheme", ListByIp.entity().getScheme(), SearchCriteria.Op.EQ);
+        ListByIp.done();
+
+        TransitionStateSearch = createSearchBuilder();
+        TransitionStateSearch.and("networkId", TransitionStateSearch.entity().getNetworkId(), Op.EQ);
+        TransitionStateSearch.and("state", TransitionStateSearch.entity().getState(), Op.IN);
+        TransitionStateSearch.and("scheme", TransitionStateSearch.entity().getScheme(), Op.EQ);
+        TransitionStateSearch.done();
+    }
+    
+    @Override
+    public List<LoadBalancerVO> listByIpAddress(long ipAddressId) {
+        SearchCriteria<LoadBalancerVO> sc = ListByIp.create();
+        sc.setParameters("ipAddressId", ipAddressId);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<LoadBalancerVO> listByNetworkIdAndScheme(long networkId, Scheme scheme) {
+        SearchCriteria<LoadBalancerVO> sc = ListByIp.create();
+        sc.setParameters("networkId", networkId);
+        sc.setParameters("scheme", scheme);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<LoadBalancerVO> listInTransitionStateByNetworkIdAndScheme(long networkId, Scheme scheme) {
+        SearchCriteria<LoadBalancerVO> sc = TransitionStateSearch.create();
+        sc.setParameters("networkId", networkId);
+        sc.setParameters("state", State.Add.toString(), State.Revoke.toString());
+        sc.setParameters("scheme", scheme);
+        return listBy(sc);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/LoadBalancerVMMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/LoadBalancerVMMapDao.java b/engine/schema/src/com/cloud/network/dao/LoadBalancerVMMapDao.java
new file mode 100644
index 0000000..e122d0a
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/LoadBalancerVMMapDao.java
@@ -0,0 +1,31 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface LoadBalancerVMMapDao extends GenericDao<LoadBalancerVMMapVO, Long> {
+    void remove(long loadBalancerId);
+    void remove(long loadBalancerId, List<Long> instanceIds, Boolean pending);
+    List<LoadBalancerVMMapVO> listByInstanceId(long instanceId);
+    List<LoadBalancerVMMapVO> listByLoadBalancerId(long loadBalancerId);
+    List<LoadBalancerVMMapVO> listByLoadBalancerId(long loadBalancerId, boolean revoke);
+    LoadBalancerVMMapVO findByLoadBalancerIdAndVmId(long loadBalancerId, long instanceId);
+    boolean isVmAttachedToLoadBalancer(long loadBalancerId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/LoadBalancerVMMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/LoadBalancerVMMapDaoImpl.java b/engine/schema/src/com/cloud/network/dao/LoadBalancerVMMapDaoImpl.java
new file mode 100644
index 0000000..8f979cd
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/LoadBalancerVMMapDaoImpl.java
@@ -0,0 +1,97 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
+
+@Component
+@Local(value={LoadBalancerVMMapDao.class})
+public class LoadBalancerVMMapDaoImpl extends GenericDaoBase<LoadBalancerVMMapVO, Long> implements LoadBalancerVMMapDao {
+
+    @Override
+    public void remove(long loadBalancerId) {
+        SearchCriteria<LoadBalancerVMMapVO> sc = createSearchCriteria();
+        sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
+
+        expunge(sc);
+    }
+
+    @Override
+    public void remove(long loadBalancerId, List<Long> instanceIds, Boolean revoke) {
+        SearchCriteria<LoadBalancerVMMapVO> sc = createSearchCriteria();
+        sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
+        sc.addAnd("instanceId", SearchCriteria.Op.IN, instanceIds.toArray());
+        if (revoke != null) {
+            sc.addAnd("revoke", SearchCriteria.Op.EQ, revoke);
+        }
+
+        expunge(sc);
+    }
+
+    @Override
+    public List<LoadBalancerVMMapVO> listByInstanceId(long instanceId) {
+        SearchCriteria<LoadBalancerVMMapVO> sc = createSearchCriteria();
+        sc.addAnd("instanceId", SearchCriteria.Op.EQ, instanceId);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<LoadBalancerVMMapVO> listByLoadBalancerId(long loadBalancerId) {
+        SearchCriteria<LoadBalancerVMMapVO> sc = createSearchCriteria();
+        sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<LoadBalancerVMMapVO> listByLoadBalancerId(long loadBalancerId, boolean pending) {
+        SearchCriteria<LoadBalancerVMMapVO> sc = createSearchCriteria();
+        sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
+        sc.addAnd("revoke", SearchCriteria.Op.EQ, pending);
+
+        return listBy(sc);
+    }
+    
+    @Override
+    public LoadBalancerVMMapVO findByLoadBalancerIdAndVmId(long loadBalancerId, long instanceId) {
+        SearchCriteria<LoadBalancerVMMapVO> sc = createSearchCriteria();
+        sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
+        sc.addAnd("instanceId", SearchCriteria.Op.EQ, instanceId);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public boolean isVmAttachedToLoadBalancer(long loadBalancerId) {
+        GenericSearchBuilder<LoadBalancerVMMapVO, Long> CountByAccount = createSearchBuilder(Long.class);
+        CountByAccount.select(null, Func.COUNT, null);
+        CountByAccount.and("loadBalancerId", CountByAccount.entity().getLoadBalancerId(), SearchCriteria.Op.EQ);
+
+        SearchCriteria<Long> sc = CountByAccount.create();
+        sc.setParameters("loadBalancerId", loadBalancerId);
+        return customSearch(sc, null).get(0) > 0;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/LoadBalancerVMMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/LoadBalancerVMMapVO.java b/engine/schema/src/com/cloud/network/dao/LoadBalancerVMMapVO.java
new file mode 100644
index 0000000..852302e
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/LoadBalancerVMMapVO.java
@@ -0,0 +1,89 @@
+// 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.network.dao;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name=("load_balancer_vm_map"))
+public class LoadBalancerVMMapVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="load_balancer_id")
+    private long loadBalancerId;
+
+    @Column(name="instance_id")
+    private long instanceId;
+
+    @Column(name = "revoke")
+    private boolean revoke = false;
+
+    @Column(name = "state")
+    private String state;
+
+    public LoadBalancerVMMapVO() {
+    }
+
+    public LoadBalancerVMMapVO(long loadBalancerId, long instanceId) {
+        this.loadBalancerId = loadBalancerId;
+        this.instanceId = instanceId;
+    }
+
+    public LoadBalancerVMMapVO(long loadBalancerId, long instanceId, boolean revoke) {
+        this.loadBalancerId = loadBalancerId;
+        this.instanceId = instanceId;
+        this.revoke = revoke;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getLoadBalancerId() {
+        return loadBalancerId;
+    }
+
+    public long getInstanceId() {
+        return instanceId;
+    }
+
+    public boolean isRevoke() {
+        return revoke;
+    }
+
+    public void setRevoke(boolean revoke) {
+        this.revoke = revoke;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/LoadBalancerVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/LoadBalancerVO.java b/engine/schema/src/com/cloud/network/dao/LoadBalancerVO.java
new file mode 100644
index 0000000..fee88cf
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/LoadBalancerVO.java
@@ -0,0 +1,116 @@
+// 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.network.dao;
+
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+
+import com.cloud.network.rules.FirewallRuleVO;
+import com.cloud.network.rules.LoadBalancer;
+import com.cloud.utils.net.NetUtils;
+
+/**
+ * This VO represent Public Load Balancer
+ * It references source ip address by its Id. 
+ * To get the VO for Internal Load Balancer rule, please refer to LoadBalancerRuleVO
+ *
+ */
+@Entity
+@Table(name=("load_balancing_rules"))
+@DiscriminatorValue(value="LoadBalancing")
+@PrimaryKeyJoinColumn(name="id")
+public class LoadBalancerVO extends FirewallRuleVO implements LoadBalancer {
+    
+    @Column(name="name")
+    private String name;
+
+    @Column(name="description", length=4096)
+    private String description;
+
+    @Column(name="algorithm")
+    private String algorithm;
+
+    @Column(name="default_port_start")
+    private int defaultPortStart;
+    
+    @Column(name="default_port_end")
+    private int defaultPortEnd;
+    
+    @Enumerated(value=EnumType.STRING)
+    @Column(name="scheme")
+    Scheme scheme = Scheme.Public;
+
+    public LoadBalancerVO() { 
+    }
+
+    public LoadBalancerVO(String xId, String name, String description, long srcIpId, int srcPort, int dstPort, String algorithm, long networkId, long accountId, long domainId) {
+        super(xId, srcIpId, srcPort, NetUtils.TCP_PROTO, networkId, accountId, domainId, Purpose.LoadBalancing, null, null, null, null);
+        this.name = name;
+        this.description = description;
+        this.algorithm = algorithm;
+        this.defaultPortStart = dstPort;
+        this.defaultPortEnd = dstPort;
+        this.scheme = Scheme.Public;
+    }
+    
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    @Override
+    public String getAlgorithm() {
+        return algorithm;
+    }
+    
+    @Override
+    public int getDefaultPortStart() { 
+        return defaultPortStart;
+    }
+
+    @Override
+    public int getDefaultPortEnd() {
+        return defaultPortEnd;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setAlgorithm(String algorithm) {
+        this.algorithm = algorithm;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Override
+    public Scheme getScheme() {
+        return scheme;
+    }  
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkAccountDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkAccountDao.java b/engine/schema/src/com/cloud/network/dao/NetworkAccountDao.java
new file mode 100644
index 0000000..c4435c8
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkAccountDao.java
@@ -0,0 +1,22 @@
+// 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.network.dao;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface NetworkAccountDao extends GenericDao<NetworkAccountVO, Long> {
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkAccountDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkAccountDaoImpl.java b/engine/schema/src/com/cloud/network/dao/NetworkAccountDaoImpl.java
new file mode 100644
index 0000000..0947905
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkAccountDaoImpl.java
@@ -0,0 +1,29 @@
+// 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.network.dao;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.db.GenericDaoBase;
+
+@Component
+public class NetworkAccountDaoImpl extends GenericDaoBase<NetworkAccountVO, Long> implements NetworkAccountDao {
+    public NetworkAccountDaoImpl() {
+        super();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkAccountVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkAccountVO.java b/engine/schema/src/com/cloud/network/dao/NetworkAccountVO.java
new file mode 100644
index 0000000..afce805
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkAccountVO.java
@@ -0,0 +1,72 @@
+// 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.network.dao;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.user.OwnedBy;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="account_network_ref")
+public class NetworkAccountVO implements OwnedBy, InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    long id;
+    
+    @Column(name="account_id")
+    long accountId;
+    
+    @Column(name="network_id")
+    long networkId;
+    
+    @Column(name="is_owner")
+    boolean owner;
+
+    protected NetworkAccountVO() {
+    }
+    
+    public NetworkAccountVO(long networkId, long accountId, boolean owner) {
+        this.networkId = networkId;
+        this.accountId = accountId;
+        this.owner = owner;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+    
+    public long getNetworkId() {
+        return networkId;
+    }
+    
+    public boolean isOwner() {
+        return owner;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkDao.java b/engine/schema/src/com/cloud/network/dao/NetworkDao.java
new file mode 100644
index 0000000..1d3f0b8
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkDao.java
@@ -0,0 +1,114 @@
+// 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.network.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import com.cloud.network.Network;
+import com.cloud.network.Network.GuestType;
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.network.Network.State;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.fsm.StateDao;
+
+public interface NetworkDao extends GenericDao<NetworkVO, Long> , StateDao<State, Network.Event, Network> {
+
+    List<NetworkVO> listByOwner(long ownerId);
+
+    List<NetworkVO> listBy(long accountId, long offeringId, long dataCenterId);
+
+    List<NetworkVO> listBy(long accountId, long dataCenterId, String cidr, boolean skipVpc);
+
+    List<NetworkVO> listByZoneAndGuestType(long accountId, long dataCenterId, Network.GuestType type, Boolean isSystem);
+
+    NetworkVO persist(NetworkVO network, boolean gc, Map<String, String> serviceProviderMap);
+
+    SearchBuilder<NetworkAccountVO> createSearchBuilderForAccount();
+
+    List<NetworkVO> getNetworksForOffering(long offeringId, long dataCenterId, long accountId);
+
+    @Override
+    @Deprecated
+    NetworkVO persist(NetworkVO vo);
+
+    /**
+     * Retrieves the next available mac address in this network configuration.
+     * 
+     * @param networkConfigId
+     *            id
+     * @return mac address if there is one. null if not.
+     */
+    String getNextAvailableMacAddress(long networkConfigId);
+
+    List<NetworkVO> listBy(long accountId, long networkId);
+
+    long countByZoneAndUri(long zoneId, String broadcastUri);
+    
+    long countByZoneUriAndGuestType(long zoneId, String broadcastUri, GuestType guestType);
+
+    List<NetworkVO> listByZone(long zoneId);
+
+    void changeActiveNicsBy(long networkId, int nicsCount);
+
+    int getActiveNicsIn(long networkId);
+
+    List<Long> findNetworksToGarbageCollect();
+
+    void clearCheckForGc(long networkId);
+
+    List<NetworkVO> listByZoneSecurityGroup(Long zoneId);
+
+    void addDomainToNetwork(long networkId, long domainId, Boolean subdomainAccess);
+
+    List<NetworkVO> listByPhysicalNetwork(long physicalNetworkId);
+
+    List<NetworkVO> listSecurityGroupEnabledNetworks();
+
+    List<NetworkVO> listByPhysicalNetworkTrafficType(long physicalNetworkId, TrafficType trafficType);
+
+    List<NetworkVO> listBy(long accountId, long dataCenterId, Network.GuestType type, TrafficType trafficType);
+
+    List<NetworkVO> listByPhysicalNetworkAndProvider(long physicalNetworkId, String providerName);
+
+    void persistNetworkServiceProviders(long networkId, Map<String, String> serviceProviderMap);
+
+    boolean update(Long networkId, NetworkVO network, Map<String, String> serviceProviderMap);
+
+    List<NetworkVO> listByZoneAndTrafficType(long zoneId, TrafficType trafficType);
+
+    void setCheckForGc(long networkId);
+    
+    int getNetworkCountByNetworkOffId(long networkOfferingId);
+    
+    long countNetworksUserCanCreate(long ownerId);
+
+    List<NetworkVO> listSourceNATEnabledNetworks(long accountId, long dataCenterId, GuestType type);
+    
+    int getNetworkCountByVpcId(long vpcId);
+    
+    List<NetworkVO> listByVpc(long vpcId);
+    
+    NetworkVO getPrivateNetwork(String broadcastUri, String cidr, long accountId, long zoneId);
+    
+    long countVpcNetworks(long vpcId);
+
+    List<NetworkVO> listNetworksByAccount(long accountId, long zoneId, Network.GuestType type, boolean isSystem);
+
+    List<NetworkVO> listRedundantNetworks();
+}


[27/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/CreateCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/CreateCommand.java b/core/src/com/cloud/agent/api/storage/CreateCommand.java
new file mode 100644
index 0000000..fd0375a
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/CreateCommand.java
@@ -0,0 +1,96 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.StoragePool;
+import com.cloud.vm.DiskProfile;
+
+public class CreateCommand extends Command {
+    private long volId;
+    private StorageFilerTO pool;
+    private DiskProfile diskCharacteristics;
+    private String templateUrl;
+
+    protected CreateCommand() {
+        super();
+    }
+
+    /**
+     * Construction for template based volumes.
+     *
+     * @param vol
+     * @param vm
+     * @param diskCharacteristics
+     * @param templateUrl
+     * @param pool
+     */
+    public CreateCommand(DiskProfile diskCharacteristics, String templateUrl, StorageFilerTO pool) {
+        this(diskCharacteristics, pool);
+        this.templateUrl = templateUrl;
+    }
+
+    /**
+     * Construction for regular volumes.
+     *
+     * @param vol
+     * @param vm
+     * @param diskCharacteristics
+     * @param pool
+     */
+    public CreateCommand(DiskProfile diskCharacteristics, StorageFilerTO pool) {
+        this.volId = diskCharacteristics.getVolumeId();
+        this.diskCharacteristics = diskCharacteristics;
+        this.pool = pool;
+        this.templateUrl = null;
+    }
+
+    public CreateCommand(DiskProfile diskCharacteristics, String templateUrl, StoragePool pool) {
+        this(diskCharacteristics, templateUrl, new StorageFilerTO(pool));
+    }
+
+    public CreateCommand(DiskProfile diskCharacteristics, StoragePool pool) {
+        this(diskCharacteristics, new StorageFilerTO(pool));
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    public String getTemplateUrl() {
+        return templateUrl;
+    }
+
+    public StorageFilerTO getPool() {
+        return pool;
+    }
+
+    public DiskProfile getDiskCharacteristics() {
+        return diskCharacteristics;
+    }
+
+    public long getVolumeId() {
+        return volId;
+    }
+
+    @Deprecated
+    public String getInstanceName() {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java b/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java
new file mode 100644
index 0000000..808a67f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java
@@ -0,0 +1,37 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Answer;
+
+public class CreateEntityDownloadURLAnswer extends Answer{
+
+    String resultString;
+    short resultCode;
+    public static final short RESULT_SUCCESS = 1;
+    public static final short RESULT_FAILURE = 0;
+
+    public CreateEntityDownloadURLAnswer(String resultString, short resultCode) {
+        super();
+        this.resultString = resultString;
+        this.resultCode = resultCode;
+    }
+
+    public CreateEntityDownloadURLAnswer(){
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java b/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java
new file mode 100755
index 0000000..d928e0c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java
@@ -0,0 +1,72 @@
+// 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.agent.api.storage;
+
+
+public class CreateEntityDownloadURLCommand extends AbstractDownloadCommand {
+
+    public CreateEntityDownloadURLCommand(String parent, String installPath, String uuid) { // this constructor is for creating template download url
+        super();
+        this.parent = parent; // parent is required as not the template can be child of one of many parents
+        this.installPath = installPath;
+        this.extractLinkUUID = uuid;
+    }
+
+    public CreateEntityDownloadURLCommand(String installPath, String uuid) {
+        super();
+        this.parent = parent;
+        this.installPath = installPath;
+        this.extractLinkUUID = uuid;
+    }
+
+    public CreateEntityDownloadURLCommand() {
+    }
+
+    private String installPath;
+    private String parent;
+    private String extractLinkUUID;
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public String getInstallPath() {
+        return installPath;
+    }
+
+    public void setInstallPath(String installPath) {
+        this.installPath = installPath;
+    }
+
+    public String getParent() {
+        return parent;
+    }
+
+    public void setParent(String parent) {
+        this.parent = parent;
+    }
+
+	public String getExtractLinkUUID() {
+		return extractLinkUUID;
+	}
+
+	public void setExtractLinkUUID(String extractLinkUUID) {
+		this.extractLinkUUID = extractLinkUUID;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java b/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java
new file mode 100644
index 0000000..83db84d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java
@@ -0,0 +1,77 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+import com.cloud.storage.Storage.ImageFormat;
+
+public class CreatePrivateTemplateAnswer extends Answer {
+    private String _path;
+    private long _virtualSize;
+    private long _physicalSize;
+    private String _uniqueName;
+    private ImageFormat _format;
+
+    public CreatePrivateTemplateAnswer() {}
+
+    public CreatePrivateTemplateAnswer(Command cmd, boolean success, String result, String path, long virtualSize,
+            long physicalSize, String uniqueName, ImageFormat format) {
+        super(cmd, success, result);
+        _path = path;
+        _virtualSize = virtualSize;
+        _physicalSize = physicalSize;
+        _uniqueName = uniqueName;
+        _format = format;
+    }
+
+    public CreatePrivateTemplateAnswer(Command cmd, boolean success, String result) {
+        super(cmd, success, result);
+    }
+
+    public String getPath() {
+        return _path;
+    }
+
+    public void setPath(String path) {
+        _path = path;
+    }
+
+    public long getVirtualSize() {
+    	return _virtualSize;
+    }
+
+    public void setVirtualSize(long virtualSize) {
+    	_virtualSize = virtualSize;
+    }
+
+    public void setphysicalSize(long _physicalSize) {
+        this._physicalSize = _physicalSize;
+    }
+
+    public long getphysicalSize() {
+        return _physicalSize;
+    }
+
+    public String getUniqueName() {
+    	return _uniqueName;
+    }
+
+    public ImageFormat getImageFormat() {
+    	return _format;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java b/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java
new file mode 100644
index 0000000..d392a89
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java
@@ -0,0 +1,90 @@
+// 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.agent.api.storage;
+
+public class CreatePrivateTemplateCommand extends StorageCommand {
+    private String _snapshotFolder;
+    private String _snapshotPath;
+    private String _userFolder;
+    private String _userSpecifiedName;
+    private String _uniqueName;
+    private long _templateId;
+    private long _accountId;
+
+    // For XenServer
+    private String _secondaryStorageURL;
+    private String _snapshotName;
+
+    public CreatePrivateTemplateCommand() {}
+
+    public CreatePrivateTemplateCommand(String secondaryStorageURL, long templateId, long accountId, String userSpecifiedName, String uniqueName, String snapshotFolder, String snapshotPath, String snapshotName, String userFolder) {
+    	_secondaryStorageURL = secondaryStorageURL;
+    	_templateId = templateId;
+    	_accountId = accountId;
+    	_userSpecifiedName = userSpecifiedName;
+        _uniqueName = uniqueName;
+        _snapshotFolder = snapshotFolder;
+        _snapshotPath = snapshotPath;
+        _snapshotName = snapshotName;
+        _userFolder = userFolder;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public String getSecondaryStorageURL() {
+    	return _secondaryStorageURL;
+    }
+
+    public String getTemplateName() {
+        return _userSpecifiedName;
+    }
+
+    public String getUniqueName() {
+        return _uniqueName;
+    }
+
+    public String getSnapshotFolder() {
+        return _snapshotFolder;
+    }
+
+    public String getSnapshotPath() {
+        return _snapshotPath;
+    }
+
+    public String getSnapshotName() {
+    	return _snapshotName;
+    }
+
+    public String getUserFolder() {
+        return _userFolder;
+    }
+
+    public long getTemplateId() {
+    	return _templateId;
+    }
+
+    public long getAccountId() {
+    	return _accountId;
+    }
+
+    public void setTemplateId(long templateId) {
+    	_templateId = templateId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLAnswer.java b/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLAnswer.java
new file mode 100644
index 0000000..c6fdf3c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLAnswer.java
@@ -0,0 +1,37 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Answer;
+
+public class DeleteEntityDownloadURLAnswer  extends Answer{
+
+    String resultString;
+    short resultCode;
+    public static final short RESULT_SUCCESS = 1;
+    public static final short RESULT_FAILURE = 0;
+
+    public DeleteEntityDownloadURLAnswer(String resultString, short resultCode) {
+        super();
+        this.resultString = resultString;
+        this.resultCode = resultCode;
+    }
+
+    public DeleteEntityDownloadURLAnswer(){
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java b/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java
new file mode 100755
index 0000000..fbfacb9
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java
@@ -0,0 +1,72 @@
+// 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.agent.api.storage;
+
+import com.cloud.storage.Upload;
+
+public class DeleteEntityDownloadURLCommand extends AbstractDownloadCommand {
+
+    private String path;
+    private String extractUrl;
+    private Upload.Type type;
+    private String parentPath;
+
+    public DeleteEntityDownloadURLCommand(String path, Upload.Type type, String url, String parentPath) {
+        super();
+        this.path = path;
+        this.type = type;
+        this.extractUrl = url;
+        this.parentPath = parentPath;
+    }
+
+    public DeleteEntityDownloadURLCommand() {
+        super();
+    }
+
+    public String getPath() {
+        return path;
+    }
+
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    public Upload.Type getType() {
+        return type;
+    }
+
+    public void setType(Upload.Type type) {
+        this.type = type;
+    }
+
+	public String getExtractUrl() {
+		return extractUrl;
+	}
+
+	public void setExtractUrl(String extractUrl) {
+		this.extractUrl = extractUrl;
+	}
+
+	public String getParentPath() {
+		return parentPath;
+	}
+
+	public void setParentPath(String parentPath) {
+		this.parentPath = parentPath;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java b/core/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java
new file mode 100644
index 0000000..69f465c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java
@@ -0,0 +1,40 @@
+// 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.agent.api.storage;
+
+
+public class DeleteTemplateCommand extends ssCommand {
+	private String templatePath;
+
+
+	public DeleteTemplateCommand() {
+	}
+
+	public DeleteTemplateCommand(String secUrl, String templatePath) {
+	    this.setSecUrl(secUrl);
+    	this.templatePath = templatePath;
+    }
+
+	@Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+	public String getTemplatePath() {
+		return templatePath;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java b/core/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java
new file mode 100755
index 0000000..949af01
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java
@@ -0,0 +1,38 @@
+// 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.agent.api.storage;
+
+public class DeleteVolumeCommand extends ssCommand {
+	private String volumePath;
+
+	public DeleteVolumeCommand() {
+	}
+
+	public DeleteVolumeCommand(String secUrl, String volumePath) {
+	    this.setSecUrl(secUrl);
+    	this.volumePath = volumePath;
+    }
+
+	@Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+	public String getVolumePath() {
+		return volumePath;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DestroyAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DestroyAnswer.java b/core/src/com/cloud/agent/api/storage/DestroyAnswer.java
new file mode 100644
index 0000000..ac60015
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DestroyAnswer.java
@@ -0,0 +1,31 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Answer;
+
+public class DestroyAnswer extends Answer {
+    public DestroyAnswer(DestroyCommand cmd, boolean result, String details) {
+        super(cmd, result, details);
+    }
+
+    // Constructor for gson.
+    protected DestroyAnswer() {
+        super();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DestroyCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DestroyCommand.java b/core/src/com/cloud/agent/api/storage/DestroyCommand.java
new file mode 100755
index 0000000..6732ea5
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DestroyCommand.java
@@ -0,0 +1,55 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.storage.StoragePool;
+import com.cloud.storage.VMTemplateStorageResourceAssoc;
+import com.cloud.storage.Volume;
+
+public class DestroyCommand extends StorageCommand {
+	// in VMware, things are designed around VM instead of volume, we need it the volume VM context if the volume is attached
+	String vmName;
+    VolumeTO volume;
+
+    protected DestroyCommand() {
+    }
+
+    public DestroyCommand(StoragePool pool, Volume volume, String vmName) {
+         this.volume = new VolumeTO(volume, pool);
+         this.vmName = vmName;
+    }
+
+    public DestroyCommand(StoragePool pool, VMTemplateStorageResourceAssoc templatePoolRef) {
+        volume = new VolumeTO(templatePoolRef.getId(), null, pool.getPoolType(), pool.getUuid(),
+        		null, pool.getPath(), templatePoolRef.getInstallPath(),
+        		templatePoolRef.getTemplateSize(), null);
+    }
+
+    public VolumeTO getVolume() {
+    	return volume;
+    }
+
+    public String getVmName() {
+    	return vmName;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DownloadAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DownloadAnswer.java b/core/src/com/cloud/agent/api/storage/DownloadAnswer.java
new file mode 100755
index 0000000..bb7b8a9
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DownloadAnswer.java
@@ -0,0 +1,141 @@
+// 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.agent.api.storage;
+
+import java.io.File;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+import com.cloud.storage.VMTemplateStorageResourceAssoc;
+import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
+
+public class DownloadAnswer extends Answer  {
+	private String jobId;
+	private int downloadPct;
+	private String errorString;
+	private VMTemplateStorageResourceAssoc.Status downloadStatus;
+	private String downloadPath;
+	private String installPath;
+	private long templateSize = 0L;
+	private long templatePhySicalSize = 0L;
+	private String checkSum;
+
+	public String getCheckSum() {
+		return checkSum;
+	}
+
+	public int getDownloadPct() {
+		return downloadPct;
+	}
+	public String getErrorString() {
+		return errorString;
+	}
+
+	public String getDownloadStatusString() {
+		return downloadStatus.toString();
+	}
+
+	public VMTemplateStorageResourceAssoc.Status getDownloadStatus() {
+		return downloadStatus;
+	}
+
+	public String getDownloadPath() {
+		return downloadPath;
+	}
+	protected DownloadAnswer() {
+
+	}
+
+	public String getJobId() {
+		return jobId;
+	}
+	public void setJobId(String jobId) {
+		this.jobId = jobId;
+	}
+
+    public DownloadAnswer(String errorString, Status status) {
+        super();
+        this.downloadPct = 0;
+        this.errorString = errorString;
+        this.downloadStatus = status;
+        this.details = errorString;
+    }
+
+	public DownloadAnswer(String jobId, int downloadPct, String errorString,
+			Status downloadStatus, String fileSystemPath, String installPath, long templateSize, long templatePhySicalSize, String checkSum) {
+		super();
+		this.jobId = jobId;
+		this.downloadPct = downloadPct;
+		this.errorString = errorString;
+		this.details = errorString;
+		this.downloadStatus = downloadStatus;
+		this.downloadPath = fileSystemPath;
+		this.installPath = fixPath(installPath);
+		this.templateSize = templateSize;
+		this.templatePhySicalSize = templatePhySicalSize;
+		this.checkSum = checkSum;
+	}
+
+   public DownloadAnswer(String jobId, int downloadPct, Command command,
+            Status downloadStatus, String fileSystemPath, String installPath) {
+        super(command);
+        this.jobId = jobId;
+        this.downloadPct = downloadPct;
+        this.downloadStatus = downloadStatus;
+        this.downloadPath = fileSystemPath;
+        this.installPath = installPath;
+    }
+
+	private static String fixPath(String path){
+		if (path == null) {
+            return path;
+        }
+		if (path.startsWith(File.separator)) {
+			path=path.substring(File.separator.length());
+		}
+		if (path.endsWith(File.separator)) {
+			path=path.substring(0, path.length()-File.separator.length());
+		}
+		return path;
+	}
+
+	public void setDownloadStatus(VMTemplateStorageResourceAssoc.Status downloadStatus) {
+		this.downloadStatus = downloadStatus;
+	}
+
+	public String getInstallPath() {
+		return installPath;
+	}
+	public void setInstallPath(String installPath) {
+		this.installPath = fixPath(installPath);
+	}
+
+	public void setTemplateSize(long templateSize) {
+		this.templateSize = templateSize;
+	}
+
+	public Long getTemplateSize() {
+		return templateSize;
+	}
+    public void setTemplatePhySicalSize(long templatePhySicalSize) {
+        this.templatePhySicalSize = templatePhySicalSize;
+    }
+    public long getTemplatePhySicalSize() {
+        return templatePhySicalSize;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DownloadCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DownloadCommand.java b/core/src/com/cloud/agent/api/storage/DownloadCommand.java
new file mode 100644
index 0000000..c6ffe45
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DownloadCommand.java
@@ -0,0 +1,219 @@
+// 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.agent.api.storage;
+
+import java.net.URI;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.storage.Volume;
+import com.cloud.template.VirtualMachineTemplate;
+
+
+public class DownloadCommand extends AbstractDownloadCommand implements InternalIdentity {
+	public static class PasswordAuth {
+		String userName;
+		String password;
+		public PasswordAuth() {
+
+		}
+		public PasswordAuth(String user, String password) {
+			this.userName = user;
+			this.password = password;
+		}
+		public String getUserName() {
+			return userName;
+		}
+		public String getPassword() {
+			return password;
+		}
+	}
+
+    public static enum ResourceType {
+        VOLUME, TEMPLATE
+    }
+
+	public static class Proxy {
+		private String _host;
+		private int _port;
+		private String _userName;
+		private String _password;
+
+		public Proxy() {
+
+		}
+
+		public Proxy(String host, int port, String userName, String password) {
+			this._host = host;
+			this._port = port;
+			this._userName = userName;
+			this._password = password;
+		}
+
+		public Proxy(URI uri) {
+			this._host = uri.getHost();
+			this._port = uri.getPort() == -1 ? 3128 : uri.getPort();
+			String userInfo = uri.getUserInfo();
+			if (userInfo != null) {
+				String[] tokens = userInfo.split(":");
+				if (tokens.length == 1) {
+					this._userName = userInfo;
+					this._password = "";
+				} else if (tokens.length == 2) {
+					this._userName = tokens[0];
+					this._password = tokens[1];
+				}
+			}
+		}
+
+		public String getHost() {
+			return _host;
+		}
+
+		public int getPort() {
+			return _port;
+		}
+
+		public String getUserName() {
+			return _userName;
+		}
+
+		public String getPassword() {
+			return _password;
+		}
+	}
+	private boolean hvm;
+	private String description;
+	private String checksum;
+	private PasswordAuth auth;
+	private Proxy _proxy;
+	private Long maxDownloadSizeInBytes = null;
+	private long id;
+	private ResourceType resourceType = ResourceType.TEMPLATE;
+
+	protected DownloadCommand() {
+	}
+
+
+	public DownloadCommand(DownloadCommand that) {
+	    super(that);
+	    this.hvm = that.hvm;
+	    this.checksum = that.checksum;
+	    this.id = that.id;
+	    this.description = that.description;
+	    this.auth = that.getAuth();
+	    this.setSecUrl(that.getSecUrl());
+	    this.maxDownloadSizeInBytes = that.getMaxDownloadSizeInBytes();
+	    this.resourceType = that.resourceType;
+	}
+
+	public DownloadCommand(String secUrl, VirtualMachineTemplate template, Long maxDownloadSizeInBytes) {
+	    super(template.getUniqueName(), template.getUrl(), template.getFormat(), template.getAccountId());
+	    this.hvm = template.isRequiresHvm();
+	    this.checksum = template.getChecksum();
+	    this.id = template.getId();
+	    this.description = template.getDisplayText();
+	    this.setSecUrl(secUrl);
+	    this.maxDownloadSizeInBytes = maxDownloadSizeInBytes;
+	}
+
+	public DownloadCommand(String secUrl, Volume volume, Long maxDownloadSizeInBytes, String checkSum, String url, ImageFormat format) {
+	    super(volume.getName(), url, format, volume.getAccountId());
+	    //this.hvm = volume.isRequiresHvm();
+	    this.checksum = checkSum;
+	    this.id = volume.getId();
+	    this.setSecUrl(secUrl);
+	    this.maxDownloadSizeInBytes = maxDownloadSizeInBytes;
+	    this.resourceType = ResourceType.VOLUME;
+	}
+
+	public DownloadCommand(String secUrl, String url, VirtualMachineTemplate template, String user, String passwd, Long maxDownloadSizeInBytes) {
+	    super(template.getUniqueName(), url, template.getFormat(), template.getAccountId());
+        this.hvm = template.isRequiresHvm();
+        this.checksum = template.getChecksum();
+        this.id = template.getId();
+        this.description = template.getDisplayText();
+        this.setSecUrl(secUrl);
+        this.maxDownloadSizeInBytes = maxDownloadSizeInBytes;
+		auth = new PasswordAuth(user, passwd);
+	}
+
+	public long getId() {
+	    return id;
+	}
+
+	public void setHvm(boolean hvm) {
+		this.hvm = hvm;
+	}
+
+	public boolean isHvm() {
+		return hvm;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	public String getChecksum() {
+		return checksum;
+	}
+
+    public void setDescription(String description) {
+		this.description = description;
+	}
+
+	public void setChecksum(String checksum) {
+		this.checksum = checksum;
+	}
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+
+	public PasswordAuth getAuth() {
+		return auth;
+	}
+
+	public void setCreds(String userName, String passwd) {
+		auth = new PasswordAuth(userName, passwd);
+	}
+
+	public Proxy getProxy() {
+		return _proxy;
+	}
+
+	public void setProxy(Proxy proxy) {
+		_proxy = proxy;
+	}
+
+	public Long getMaxDownloadSizeInBytes() {
+		return maxDownloadSizeInBytes;
+	}
+
+
+	public ResourceType getResourceType() {
+		return resourceType;
+	}
+
+
+	public void setResourceType(ResourceType resourceType) {
+		this.resourceType = resourceType;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DownloadProgressCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DownloadProgressCommand.java b/core/src/com/cloud/agent/api/storage/DownloadProgressCommand.java
new file mode 100644
index 0000000..835847b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DownloadProgressCommand.java
@@ -0,0 +1,48 @@
+// 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.agent.api.storage;
+
+
+
+public class DownloadProgressCommand extends DownloadCommand {
+	public static enum RequestType {GET_STATUS, ABORT, RESTART, PURGE, GET_OR_RESTART}
+	private String jobId;
+	private RequestType request;
+
+	protected DownloadProgressCommand() {
+		super();
+	}
+
+	public DownloadProgressCommand(DownloadCommand cmd, String jobId, RequestType req) {
+	    super(cmd);
+
+		this.jobId = jobId;
+		this.setRequest(req);
+	}
+
+	public String getJobId() {
+		return jobId;
+	}
+
+	public void setRequest(RequestType request) {
+		this.request = request;
+	}
+
+	public RequestType getRequest() {
+		return request;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ListTemplateAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ListTemplateAnswer.java b/core/src/com/cloud/agent/api/storage/ListTemplateAnswer.java
new file mode 100644
index 0000000..a4e2e25
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ListTemplateAnswer.java
@@ -0,0 +1,53 @@
+// 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.agent.api.storage;
+
+import java.util.Map;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.storage.template.TemplateInfo;
+
+public class ListTemplateAnswer extends Answer  {
+    private String secUrl;
+    private Map<String, TemplateInfo> templateInfos;
+
+	public ListTemplateAnswer() {
+
+	}
+
+	public ListTemplateAnswer(String secUrl, Map<String, TemplateInfo> templateInfos) {
+	    super(null, true, "success");
+	    this.setSecUrl(secUrl);
+	    this.templateInfos = templateInfos;
+	}
+
+	public Map<String, TemplateInfo> getTemplateInfo() {
+	    return templateInfos;
+	}
+
+	public void setTemplateInfo(Map<String, TemplateInfo> templateInfos) {
+	    this.templateInfos = templateInfos;
+	}
+
+    public void setSecUrl(String secUrl) {
+        this.secUrl = secUrl;
+    }
+
+    public String getSecUrl() {
+        return secUrl;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ListTemplateCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ListTemplateCommand.java b/core/src/com/cloud/agent/api/storage/ListTemplateCommand.java
new file mode 100644
index 0000000..da25ed5
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ListTemplateCommand.java
@@ -0,0 +1,54 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.LogLevel;
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.agent.api.to.SwiftTO;
+
+public class ListTemplateCommand extends StorageCommand {
+    private String secUrl;
+    @LogLevel(Log4jLevel.Off)
+    private SwiftTO swift;
+
+    public ListTemplateCommand() {
+    }
+
+	public ListTemplateCommand(String secUrl) {
+	    this.secUrl = secUrl;
+        this.swift = null;
+	}
+
+    public ListTemplateCommand(SwiftTO swift) {
+        this.secUrl = null;
+        this.swift = swift;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    public String getSecUrl() {
+        return secUrl;
+    }
+
+    public SwiftTO getSwift() {
+        return swift;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ListVolumeAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ListVolumeAnswer.java b/core/src/com/cloud/agent/api/storage/ListVolumeAnswer.java
new file mode 100755
index 0000000..6bbb2e8
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ListVolumeAnswer.java
@@ -0,0 +1,53 @@
+// 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.agent.api.storage;
+
+import java.util.Map;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.storage.template.TemplateInfo;
+
+public class ListVolumeAnswer extends Answer {
+	private String secUrl;
+    private Map<Long, TemplateInfo> templateInfos;
+
+	public ListVolumeAnswer() {
+
+	}
+
+	public ListVolumeAnswer(String secUrl, Map<Long, TemplateInfo> templateInfos) {
+	    super(null, true, "success");
+	    this.setSecUrl(secUrl);
+	    this.templateInfos = templateInfos;
+	}
+
+	public Map<Long, TemplateInfo> getTemplateInfo() {
+	    return templateInfos;
+	}
+
+	public void setTemplateInfo(Map<Long, TemplateInfo> templateInfos) {
+	    this.templateInfos = templateInfos;
+	}
+
+    public void setSecUrl(String secUrl) {
+        this.secUrl = secUrl;
+    }
+
+    public String getSecUrl() {
+        return secUrl;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ListVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ListVolumeCommand.java b/core/src/com/cloud/agent/api/storage/ListVolumeCommand.java
new file mode 100755
index 0000000..63c5b62
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ListVolumeCommand.java
@@ -0,0 +1,40 @@
+// 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.agent.api.storage;
+
+
+public class ListVolumeCommand extends StorageCommand {
+
+    private String secUrl;
+
+    public ListVolumeCommand() {
+    }
+
+	public ListVolumeCommand(String secUrl) {
+	    this.secUrl = secUrl;
+	}
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    public String getSecUrl() {
+        return secUrl;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java b/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java
new file mode 100644
index 0000000..edd2830
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java
@@ -0,0 +1,31 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+
+public class ManageVolumeAvailabilityAnswer extends Answer {
+
+	protected ManageVolumeAvailabilityAnswer() {
+    }
+
+	public ManageVolumeAvailabilityAnswer(Command command, boolean success, String details) {
+		super(command, success, details);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.java b/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.java
new file mode 100644
index 0000000..1a7d480
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.java
@@ -0,0 +1,54 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Command;
+
+public class ManageVolumeAvailabilityCommand extends Command {
+
+	boolean attach;
+	String primaryStorageSRUuid;
+	String volumeUuid;
+
+
+	public ManageVolumeAvailabilityCommand() {
+	}
+
+	public ManageVolumeAvailabilityCommand(boolean attach, String primaryStorageSRUuid, String volumeUuid) {
+    	this.attach = attach;
+    	this.primaryStorageSRUuid = primaryStorageSRUuid;
+        this.volumeUuid = volumeUuid;
+    }
+
+	@Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+	public boolean getAttach() {
+		return attach;
+	}
+
+	public String getPrimaryStorageSRUuid() {
+		return primaryStorageSRUuid;
+	}
+
+	public String getVolumeUuid() {
+		return volumeUuid;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.java b/core/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.java
new file mode 100644
index 0000000..d5efa95
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.java
@@ -0,0 +1,38 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+
+public class MigrateVolumeAnswer extends Answer {
+    private String volumePath;
+
+    public MigrateVolumeAnswer(Command command, boolean success, String details, String volumePath) {
+        super(command, success, details);
+        this.volumePath = volumePath;
+    }
+
+    public MigrateVolumeAnswer(Command command) {
+        super(command);
+        this.volumePath = null;
+    }
+
+    public String getVolumePath() {
+        return volumePath;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java b/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java
new file mode 100644
index 0000000..b82d848
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java
@@ -0,0 +1,51 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.StoragePool;
+
+public class MigrateVolumeCommand extends Command {
+
+    long volumeId;
+    String volumePath;
+    StorageFilerTO pool;
+
+    public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool) {
+        this.volumeId = volumeId;
+        this.volumePath = volumePath;
+        this.pool = new StorageFilerTO(pool);
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    public String getVolumePath() {
+        return volumePath;
+    }
+
+    public long getVolumeId() {
+        return volumeId;
+    }
+
+    public StorageFilerTO getPool() {
+        return pool;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.java b/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.java
new file mode 100644
index 0000000..a5a6c49
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.java
@@ -0,0 +1,54 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Answer;
+
+public class PrimaryStorageDownloadAnswer extends Answer  {
+	private String installPath;
+    private long templateSize = 0L;
+
+	protected PrimaryStorageDownloadAnswer() {
+	}
+
+    public PrimaryStorageDownloadAnswer(String detail) {
+        super(null, false, detail);
+    }
+
+	public PrimaryStorageDownloadAnswer(String installPath, long templateSize ) {
+        super(null);
+		this.installPath = installPath;
+		this.templateSize = templateSize;
+	}
+
+	public String getInstallPath() {
+		return installPath;
+	}
+
+	public void setInstallPath(String installPath) {
+		this.installPath = installPath;
+    }
+
+    public void setTemplateSize(long templateSize) {
+        this.templateSize = templateSize;
+    }
+
+    public Long getTemplateSize() {
+        return templateSize;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java b/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java
new file mode 100644
index 0000000..8d955bb
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java
@@ -0,0 +1,87 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.storage.StoragePool;
+
+/**
+ *
+ */
+public class PrimaryStorageDownloadCommand extends AbstractDownloadCommand {
+	String localPath;
+	String poolUuid;
+	long poolId;
+
+    StorageFilerTO primaryPool;
+
+	String secondaryStorageUrl;
+	String primaryStorageUrl;
+
+    protected PrimaryStorageDownloadCommand() {
+	}
+
+    public PrimaryStorageDownloadCommand(String name, String url, ImageFormat format, long accountId, StoragePool pool, int wait) {
+        super(name, url, format, accountId);
+        this.poolId = pool.getId();
+        this.poolUuid = pool.getUuid();
+        this.primaryPool = new StorageFilerTO(pool);
+        setWait(wait);
+    }
+
+    public String getPoolUuid() {
+        return poolUuid;
+    }
+
+    public long getPoolId() {
+        return poolId;
+    }
+
+    public StorageFilerTO getPool() {
+        return primaryPool;
+    }
+    
+    public void setLocalPath(String path) {
+    	this.localPath = path;
+    }
+
+    public String getLocalPath() {
+    	return localPath;
+    }
+
+    public void setSecondaryStorageUrl(String url) {
+    	secondaryStorageUrl = url;
+    }
+
+    public String getSecondaryStorageUrl() {
+    	return secondaryStorageUrl;
+    }
+
+    public void setPrimaryStorageUrl(String url) {
+    	primaryStorageUrl = url;
+    }
+
+    public String getPrimaryStorageUrl() {
+    	return primaryStorageUrl;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java b/core/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java
new file mode 100644
index 0000000..3434b98
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java
@@ -0,0 +1,40 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Answer;
+
+public class ResizeVolumeAnswer extends Answer {
+    private long newSize;
+
+    protected ResizeVolumeAnswer() {
+
+    }
+
+    public ResizeVolumeAnswer(ResizeVolumeCommand cmd, boolean result, String details, long newSize) {
+        super(cmd, result, details);
+        this.newSize = newSize;
+    }
+
+    public ResizeVolumeAnswer(ResizeVolumeCommand cmd, boolean result, String details) {
+        super(cmd, result, details);
+    }
+
+    public long getNewSize() {
+        return newSize;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java b/core/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
new file mode 100644
index 0000000..82d3ae7
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
@@ -0,0 +1,85 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.to.StorageFilerTO;
+
+public class ResizeVolumeCommand extends Command {
+    private String path;
+    private StorageFilerTO pool;
+    private String vmInstance;
+    private Long newSize;
+    private Long currentSize;
+    private boolean shrinkOk;
+    
+    protected ResizeVolumeCommand() {
+        
+    }
+    
+    public ResizeVolumeCommand(String path,
+                           StorageFilerTO pool,
+                           Long currentSize,
+                           Long newSize,
+                           boolean shrinkOk,
+                           String vmInstance) 
+    {
+        this.path = path;
+        this.pool = pool;
+        this.vmInstance = vmInstance;
+        this.currentSize = currentSize;
+        this.newSize = newSize;
+        this.shrinkOk = shrinkOk;
+    }
+
+    public String getPath() {
+    	return path;
+    }
+
+    public String getPoolUuid() {
+        return pool.getUuid();
+    }
+
+    public StorageFilerTO getPool() {
+        return pool;
+    }
+    
+    public long getNewSize() {
+        return newSize;
+    }
+
+    public long getCurrentSize() {
+        return currentSize;
+    }
+
+    public boolean getShrinkOk() {
+        return shrinkOk;
+    }
+
+    public String getInstanceName() {
+        return vmInstance;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/StorageCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/StorageCommand.java b/core/src/com/cloud/agent/api/storage/StorageCommand.java
new file mode 100644
index 0000000..270143b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/StorageCommand.java
@@ -0,0 +1,26 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Command;
+
+public abstract class StorageCommand extends Command {
+    protected StorageCommand() {
+        super();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java b/core/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java
new file mode 100644
index 0000000..9660136
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java
@@ -0,0 +1,29 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+
+public class UpgradeDiskAnswer extends Answer {
+
+    public UpgradeDiskAnswer() {}
+
+    public UpgradeDiskAnswer(Command cmd, boolean success, String details) {
+        super(cmd, success, details);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/UpgradeDiskCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/UpgradeDiskCommand.java b/core/src/com/cloud/agent/api/storage/UpgradeDiskCommand.java
new file mode 100644
index 0000000..f8363e1
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/UpgradeDiskCommand.java
@@ -0,0 +1,50 @@
+// 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.agent.api.storage;
+
+
+public class UpgradeDiskCommand extends StorageCommand {
+
+    private String _imagePath;
+    private String _newSize;
+
+    public UpgradeDiskCommand() {}
+
+    public UpgradeDiskCommand(String imagePath, String newSize) {
+        _imagePath = imagePath;
+        _newSize = newSize;
+    }
+
+    public String getImagePath() {
+        return _imagePath;
+    }
+    public void setImagePath(String imagePath) {
+        _imagePath = imagePath;
+    }
+
+    public String getNewSize() {
+        return _newSize;
+    }
+    public void setNewSize(String newSize) {
+        _newSize = newSize;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/UploadAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/UploadAnswer.java b/core/src/com/cloud/agent/api/storage/UploadAnswer.java
new file mode 100755
index 0000000..f2d9788
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/UploadAnswer.java
@@ -0,0 +1,123 @@
+// 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.agent.api.storage;
+
+import java.io.File;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+import com.cloud.storage.Upload;
+
+public class UploadAnswer extends Answer {
+
+
+	private String jobId;
+	private int uploadPct;
+	private String errorString;
+	private Upload.Status uploadStatus;
+	private String uploadPath;
+	private String installPath;
+	public Long templateSize = 0L;
+
+	public int getUploadPct() {
+		return uploadPct;
+	}
+	public String getErrorString() {
+		return errorString;
+	}
+
+	public String getUploadStatusString() {
+		return uploadStatus.toString();
+	}
+
+	public Upload.Status getUploadStatus() {
+		return uploadStatus;
+	}
+
+	public String getUploadPath() {
+		return uploadPath;
+	}
+	protected UploadAnswer() {
+
+	}
+
+	public void setErrorString(String errorString) {
+        this.errorString = errorString;
+    }
+    public String getJobId() {
+		return jobId;
+	}
+	public void setJobId(String jobId) {
+		this.jobId = jobId;
+	}
+
+	public UploadAnswer(String jobId, int uploadPct, String errorString,
+			Upload.Status uploadStatus, String fileSystemPath, String installPath, long templateSize) {
+		super();
+		this.jobId = jobId;
+		this.uploadPct = uploadPct;
+		this.errorString = errorString;
+		this.details = errorString;
+		this.uploadStatus = uploadStatus;
+		this.uploadPath = fileSystemPath;
+		this.installPath = fixPath(installPath);
+		this.templateSize = templateSize;
+	}
+
+   public UploadAnswer(String jobId, int uploadPct, Command command,
+		   Upload.Status uploadStatus, String fileSystemPath, String installPath) {
+	    super(command);
+        this.jobId = jobId;
+        this.uploadPct = uploadPct;
+        this.uploadStatus = uploadStatus;
+        this.uploadPath = fileSystemPath;
+        this.installPath = installPath;
+    }
+
+	private static String fixPath(String path){
+		if (path == null) {
+            return path;
+        }
+		if (path.startsWith(File.separator)) {
+			path=path.substring(File.separator.length());
+		}
+		if (path.endsWith(File.separator)) {
+			path=path.substring(0, path.length()-File.separator.length());
+		}
+		return path;
+	}
+
+	public void setUploadStatus(Upload.Status uploadStatus) {
+		this.uploadStatus = uploadStatus;
+	}
+
+	public String getInstallPath() {
+		return installPath;
+	}
+	public void setInstallPath(String installPath) {
+		this.installPath = fixPath(installPath);
+	}
+
+	public void setTemplateSize(long templateSize) {
+		this.templateSize = templateSize;
+	}
+
+	public Long getTemplateSize() {
+		return templateSize;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/UploadCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/UploadCommand.java b/core/src/com/cloud/agent/api/storage/UploadCommand.java
new file mode 100644
index 0000000..473bd5b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/UploadCommand.java
@@ -0,0 +1,145 @@
+// 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.agent.api.storage;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import com.cloud.agent.api.storage.DownloadCommand.PasswordAuth;
+import com.cloud.agent.api.to.TemplateTO;
+import com.cloud.storage.Upload.Type;
+import com.cloud.template.VirtualMachineTemplate;
+
+
+public class UploadCommand extends AbstractUploadCommand implements InternalIdentity {
+
+	private TemplateTO template;
+	private String url;
+	private String installPath;
+	private boolean hvm;
+	private String description;
+	private String checksum;
+	private PasswordAuth auth;
+	private long templateSizeInBytes;
+	private long id;
+	private Type type;
+
+	public UploadCommand(VirtualMachineTemplate template, String url, String installPath, long sizeInBytes) {
+
+		this.template = new TemplateTO(template);
+		this.url = url;
+		this.installPath = installPath;
+		this.checksum = template.getChecksum();
+		this.id = template.getId();
+		this.templateSizeInBytes = sizeInBytes;
+
+	}
+
+	public UploadCommand(String url, long id, long sizeInBytes, String installPath, Type type){
+		this.template = null;
+		this.url = url;
+		this.installPath = installPath;
+		this.id = id;
+		this.type = type;
+		this.templateSizeInBytes = sizeInBytes;
+	}
+
+	protected UploadCommand() {
+	}
+
+	public UploadCommand(UploadCommand that) {
+		this.template = that.template;
+		this.url = that.url;
+		this.installPath = that.installPath;
+		this.checksum = that.getChecksum();
+		this.id = that.id;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+
+	public TemplateTO getTemplate() {
+		return template;
+	}
+
+	public void setTemplate(TemplateTO template) {
+		this.template = template;
+	}
+
+	@Override
+    public String getUrl() {
+		return url;
+	}
+
+	@Override
+    public void setUrl(String url) {
+		this.url = url;
+	}
+
+	public boolean isHvm() {
+		return hvm;
+	}
+
+	public void setHvm(boolean hvm) {
+		this.hvm = hvm;
+	}
+
+	public PasswordAuth getAuth() {
+		return auth;
+	}
+
+	public void setAuth(PasswordAuth auth) {
+		this.auth = auth;
+	}
+
+	public Long getTemplateSizeInBytes() {
+		return templateSizeInBytes;
+	}
+
+	public void setTemplateSizeInBytes(Long templateSizeInBytes) {
+		this.templateSizeInBytes = templateSizeInBytes;
+	}
+
+	public long getId() {
+		return id;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public void setInstallPath(String installPath) {
+		this.installPath = installPath;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	public void setChecksum(String checksum) {
+		this.checksum = checksum;
+	}
+
+	public String getInstallPath() {
+		return installPath;
+	}
+
+	public String getChecksum() {
+		return checksum;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/UploadProgressCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/UploadProgressCommand.java b/core/src/com/cloud/agent/api/storage/UploadProgressCommand.java
new file mode 100644
index 0000000..7f6d584
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/UploadProgressCommand.java
@@ -0,0 +1,48 @@
+// 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.agent.api.storage;
+
+public class UploadProgressCommand extends UploadCommand {
+
+	public static enum RequestType {GET_STATUS, ABORT, RESTART, PURGE, GET_OR_RESTART}
+	private String jobId;
+	private RequestType request;
+
+	protected UploadProgressCommand() {
+		super();
+	}
+
+	public UploadProgressCommand(UploadCommand cmd, String jobId, RequestType req) {
+	    super(cmd);
+
+		this.jobId = jobId;
+		this.setRequest(req);
+	}
+
+	public String getJobId() {
+		return jobId;
+	}
+
+	public void setRequest(RequestType request) {
+		this.request = request;
+	}
+
+	public RequestType getRequest() {
+		return request;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ssCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ssCommand.java b/core/src/com/cloud/agent/api/storage/ssCommand.java
new file mode 100644
index 0000000..c218a8d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ssCommand.java
@@ -0,0 +1,48 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Command;
+
+public abstract class ssCommand extends Command {
+    private String secUrl;
+
+
+	public ssCommand() {
+	}
+
+    protected ssCommand(ssCommand that) {
+        this.secUrl = that.secUrl;
+    }
+	public ssCommand(String secUrl) {
+	    this.secUrl = secUrl;
+    }
+
+	@Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    public String getSecUrl() {
+        return secUrl;
+    }
+
+    public void setSecUrl(String secUrl) {
+        this.secUrl = secUrl;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
index 7148e07..b9bda4d 100755
--- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
+++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
@@ -863,13 +863,16 @@ public class VirtualRoutingResource implements Manager {
     }
 
     public void assignVpcIpToRouter(final String routerIP, final boolean add, final String pubIP,
-            final String nicname, final String gateway, final String netmask, final String subnet) throws InternalErrorException {
+                                    final String nicname, final String gateway, final String netmask, final String subnet, boolean sourceNat) throws InternalErrorException {
         String args = "";
+        String snatArgs = "";
 
         if (add) {
             args += " -A ";
+            snatArgs += " -A ";
         } else {
             args += " -D ";
+            snatArgs += " -D ";
         }
 
         args += " -l ";
@@ -887,6 +890,16 @@ public class VirtualRoutingResource implements Manager {
         if (result != null) {
             throw new InternalErrorException("KVM plugin \"vpc_ipassoc\" failed:"+result);
         }
+        if (sourceNat) {
+            snatArgs += " -l " + pubIP;
+            snatArgs += " -c " + nicname;
+
+            result = routerProxy("vpc_privateGateway.sh", routerIP, snatArgs);
+            if (result != null) {
+                throw new InternalErrorException("KVM plugin \"vpc_privateGateway\" failed:"+result);
+            }
+
+        }
     }
 
     private SetStaticRouteAnswer execute(SetStaticRouteCommand cmd) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/alert/AlertAdapter.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/alert/AlertAdapter.java b/core/src/com/cloud/alert/AlertAdapter.java
deleted file mode 100644
index c04776a..0000000
--- a/core/src/com/cloud/alert/AlertAdapter.java
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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.alert;
-
-import com.cloud.utils.component.Adapter;
-
-public interface AlertAdapter extends Adapter {
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/alert/AlertManager.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/alert/AlertManager.java b/core/src/com/cloud/alert/AlertManager.java
deleted file mode 100755
index b6d005a..0000000
--- a/core/src/com/cloud/alert/AlertManager.java
+++ /dev/null
@@ -1,58 +0,0 @@
-// 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.alert;
-
-import com.cloud.capacity.CapacityVO;
-import com.cloud.utils.component.Manager;
-
-public interface AlertManager extends Manager {
-    public static final short ALERT_TYPE_MEMORY = CapacityVO.CAPACITY_TYPE_MEMORY;
-    public static final short ALERT_TYPE_CPU = CapacityVO.CAPACITY_TYPE_CPU;
-    public static final short ALERT_TYPE_STORAGE = CapacityVO.CAPACITY_TYPE_STORAGE;
-    public static final short ALERT_TYPE_STORAGE_ALLOCATED = CapacityVO.CAPACITY_TYPE_STORAGE_ALLOCATED;
-    public static final short ALERT_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = CapacityVO.CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP;
-    public static final short ALERT_TYPE_PRIVATE_IP = CapacityVO.CAPACITY_TYPE_PRIVATE_IP;
-    public static final short ALERT_TYPE_SECONDARY_STORAGE = CapacityVO.CAPACITY_TYPE_SECONDARY_STORAGE;
-    public static final short ALERT_TYPE_HOST = 7;
-    public static final short ALERT_TYPE_USERVM = 8;
-    public static final short ALERT_TYPE_DOMAIN_ROUTER = 9;
-    public static final short ALERT_TYPE_CONSOLE_PROXY = 10;
-    public static final short ALERT_TYPE_ROUTING = 11; // lost connection to default route (to the gateway)
-    public static final short ALERT_TYPE_STORAGE_MISC = 12; // lost connection to default route (to the gateway)
-    public static final short ALERT_TYPE_USAGE_SERVER = 13; // lost connection to default route (to the gateway)
-    public static final short ALERT_TYPE_MANAGMENT_NODE = 14; // lost connection to default route (to the gateway)
-    public static final short ALERT_TYPE_DOMAIN_ROUTER_MIGRATE = 15;
-    public static final short ALERT_TYPE_CONSOLE_PROXY_MIGRATE = 16;
-    public static final short ALERT_TYPE_USERVM_MIGRATE = 17;
-    public static final short ALERT_TYPE_VLAN = 18;
-    public static final short ALERT_TYPE_SSVM = 19;
-    public static final short ALERT_TYPE_USAGE_SERVER_RESULT = 20; // Usage job result
-    public static final short ALERT_TYPE_STORAGE_DELETE = 21;
-    public static final short ALERT_TYPE_UPDATE_RESOURCE_COUNT = 22; // Generated when we fail to update the resource
-    // count
-    public static final short ALERT_TYPE_USAGE_SANITY_RESULT = 23;
-    public static final short ALERT_TYPE_DIRECT_ATTACHED_PUBLIC_IP = 24;
-    public static final short ALERT_TYPE_LOCAL_STORAGE = 25;
-    public static final short ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED = 26; // Generated when the resource limit exceeds the limit. Currently used for recurring snapshots only
-
-
-    void clearAlert(short alertType, long dataCenterId, long podId);
-
-    void sendAlert(short alertType, long dataCenterId, Long podId, String subject, String body);
-
-    void recalculateCapacity();
-}


[04/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/service/ServiceOfferingVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/service/ServiceOfferingVO.java b/engine/schema/src/com/cloud/service/ServiceOfferingVO.java
new file mode 100755
index 0000000..94a7351
--- /dev/null
+++ b/engine/schema/src/com/cloud/service/ServiceOfferingVO.java
@@ -0,0 +1,211 @@
+// 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.service;
+
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import com.cloud.offering.ServiceOffering;
+import com.cloud.storage.DiskOfferingVO;
+import com.cloud.vm.VirtualMachine;
+
+@Entity
+@Table(name="service_offering")
+@DiscriminatorValue(value="Service")
+@PrimaryKeyJoinColumn(name="id")
+public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering {
+    @Column(name="cpu")
+	private int cpu;
+
+    @Column(name="speed")
+    private int speed;
+
+    @Column(name="ram_size")
+	private int ramSize;
+
+    @Column(name="nw_rate")
+    private Integer rateMbps;
+
+    @Column(name="mc_rate")
+    private Integer multicastRateMbps;
+
+    @Column(name="ha_enabled")
+    private boolean offerHA;
+
+    @Column(name="limit_cpu_use")
+    private boolean limitCpuUse;
+
+    @Column(name="is_volatile")
+    private boolean volatileVm;
+
+    @Column(name="host_tag")
+    private String hostTag;
+
+    @Column(name="default_use")
+    private boolean default_use;
+
+    @Column(name="vm_type")
+    private String vm_type;
+
+    @Column(name="sort_key")
+    int sortKey;
+
+    protected ServiceOfferingVO() {
+        super();
+    }
+
+    public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, boolean defaultUse) {
+        super(name, displayText, false, tags, recreatable, useLocalStorage, systemUse, true);
+        this.cpu = cpu;
+        this.ramSize = ramSize;
+        this.speed = speed;
+        this.rateMbps = rateMbps;
+        this.multicastRateMbps = multicastRateMbps;
+        this.offerHA = offerHA;
+        this.limitCpuUse = false;
+        this.volatileVm = false;
+        this.default_use = defaultUse;
+        this.vm_type = vm_type == null ? null : vm_type.toString().toLowerCase();
+    }
+
+    public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitCpuUse, boolean volatileVm, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId) {
+        super(name, displayText, false, tags, recreatable, useLocalStorage, systemUse, true, domainId);
+        this.cpu = cpu;
+        this.ramSize = ramSize;
+        this.speed = speed;
+        this.rateMbps = rateMbps;
+        this.multicastRateMbps = multicastRateMbps;
+        this.offerHA = offerHA;
+        this.limitCpuUse = limitCpuUse;
+        this.volatileVm = volatileVm;
+        this.vm_type = vm_type == null ? null : vm_type.toString().toLowerCase();
+    }
+
+    public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitResourceUse, boolean volatileVm, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId, String hostTag) {
+        this(name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, limitResourceUse, volatileVm, displayText, useLocalStorage, recreatable, tags, systemUse, vm_type, domainId);
+        this.hostTag = hostTag;
+    }
+
+    @Override
+	public boolean getOfferHA() {
+	    return offerHA;
+	}
+
+	public void setOfferHA(boolean offerHA) {
+		this.offerHA = offerHA;
+	}
+
+    @Override
+	public boolean getLimitCpuUse() {
+	    return limitCpuUse;
+	}
+
+	public void setLimitResourceUse(boolean limitCpuUse) {
+		this.limitCpuUse = limitCpuUse;
+	}
+
+	@Override
+    public boolean getDefaultUse() {
+        return default_use;
+    }
+
+	@Override
+    @Transient
+	public String[] getTagsArray() {
+	    String tags = getTags();
+	    if (tags == null || tags.length() == 0) {
+	        return new String[0];
+	    }
+
+	    return tags.split(",");
+	}
+
+	@Override
+	public int getCpu() {
+	    return cpu;
+	}
+
+	public void setCpu(int cpu) {
+		this.cpu = cpu;
+	}
+
+	public void setSpeed(int speed) {
+		this.speed = speed;
+	}
+
+	public void setRamSize(int ramSize) {
+		this.ramSize = ramSize;
+	}
+
+	@Override
+	public int getSpeed() {
+	    return speed;
+	}
+
+	@Override
+	public int getRamSize() {
+	    return ramSize;
+	}
+
+	public void setRateMbps(Integer rateMbps) {
+		this.rateMbps = rateMbps;
+	}
+
+	@Override
+    public Integer getRateMbps() {
+		return rateMbps;
+	}
+
+	public void setMulticastRateMbps(Integer multicastRateMbps) {
+		this.multicastRateMbps = multicastRateMbps;
+	}
+
+	@Override
+    public Integer getMulticastRateMbps() {
+		return multicastRateMbps;
+	}
+
+	public void setHostTag(String hostTag) {
+		this.hostTag = hostTag;
+	}
+
+	public String getHostTag() {
+		return hostTag;
+	}
+
+	public String getSystemVmType(){
+	    return vm_type;
+	}
+
+	public void setSortKey(int key) {
+		sortKey = key;
+	}
+
+	public int getSortKey() {
+		return sortKey;
+	}
+
+    @Override
+    public boolean getVolatileVm() {
+        return volatileVm;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/service/dao/ServiceOfferingDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDao.java b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDao.java
new file mode 100644
index 0000000..589de7c
--- /dev/null
+++ b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDao.java
@@ -0,0 +1,34 @@
+// 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.service.dao;
+
+import java.util.List;
+
+import com.cloud.service.ServiceOfferingVO;
+import com.cloud.utils.db.GenericDao;
+
+/*
+ * Data Access Object for service_offering table
+ */
+public interface ServiceOfferingDao extends GenericDao<ServiceOfferingVO, Long> {
+    ServiceOfferingVO findByName(String name);
+    ServiceOfferingVO persistSystemServiceOffering(ServiceOfferingVO vo);
+	List<ServiceOfferingVO> findPublicServiceOfferings();
+	List<ServiceOfferingVO> findServiceOfferingByDomainId(Long domainId);
+    List<ServiceOfferingVO> findSystemOffering(Long domainId, Boolean isSystem, String vm_type);
+    ServiceOfferingVO persistDeafultServiceOffering(ServiceOfferingVO offering);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java
new file mode 100644
index 0000000..062103e
--- /dev/null
+++ b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java
@@ -0,0 +1,157 @@
+// 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.service.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.persistence.EntityExistsException;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.service.ServiceOfferingVO;
+import com.cloud.storage.DiskOfferingVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value={ServiceOfferingDao.class}) @DB(txn=false)
+public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Long> implements ServiceOfferingDao {
+    protected static final Logger s_logger = Logger.getLogger(ServiceOfferingDaoImpl.class);
+
+    protected final SearchBuilder<ServiceOfferingVO> UniqueNameSearch;
+    protected final SearchBuilder<ServiceOfferingVO> ServiceOfferingsByDomainIdSearch;
+    protected final SearchBuilder<ServiceOfferingVO> SystemServiceOffering;
+    protected final SearchBuilder<ServiceOfferingVO> ServiceOfferingsByKeywordSearch;
+    protected final SearchBuilder<ServiceOfferingVO> PublicServiceOfferingSearch;
+    
+    public ServiceOfferingDaoImpl() {
+        super();
+        
+        UniqueNameSearch = createSearchBuilder();
+        UniqueNameSearch.and("name", UniqueNameSearch.entity().getUniqueName(), SearchCriteria.Op.EQ);
+        UniqueNameSearch.and("system", UniqueNameSearch.entity().getSystemUse(), SearchCriteria.Op.EQ);
+        UniqueNameSearch.done();
+        
+        ServiceOfferingsByDomainIdSearch = createSearchBuilder();
+        ServiceOfferingsByDomainIdSearch.and("domainId", ServiceOfferingsByDomainIdSearch.entity().getDomainId(), SearchCriteria.Op.EQ);
+        ServiceOfferingsByDomainIdSearch.done();
+        
+        SystemServiceOffering = createSearchBuilder();
+        SystemServiceOffering.and("domainId", SystemServiceOffering.entity().getDomainId(), SearchCriteria.Op.EQ);
+        SystemServiceOffering.and("system", SystemServiceOffering.entity().getSystemUse(), SearchCriteria.Op.EQ);
+        SystemServiceOffering.and("vm_type", SystemServiceOffering.entity().getSpeed(), SearchCriteria.Op.EQ);
+        SystemServiceOffering.and("removed", SystemServiceOffering.entity().getRemoved(), SearchCriteria.Op.NULL);
+        SystemServiceOffering.done();
+        
+        
+        PublicServiceOfferingSearch = createSearchBuilder();
+        PublicServiceOfferingSearch.and("domainId", PublicServiceOfferingSearch.entity().getDomainId(), SearchCriteria.Op.NULL);
+        PublicServiceOfferingSearch.and("system", PublicServiceOfferingSearch.entity().getSystemUse(), SearchCriteria.Op.EQ);
+        PublicServiceOfferingSearch.and("removed", PublicServiceOfferingSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
+        PublicServiceOfferingSearch.done();
+        
+        ServiceOfferingsByKeywordSearch = createSearchBuilder();
+        ServiceOfferingsByKeywordSearch.or("name", ServiceOfferingsByKeywordSearch.entity().getName(), SearchCriteria.Op.EQ);        
+        ServiceOfferingsByKeywordSearch.or("displayText", ServiceOfferingsByKeywordSearch.entity().getDisplayText(), SearchCriteria.Op.EQ);
+        ServiceOfferingsByKeywordSearch.done();
+    }
+    
+    @Override
+    public ServiceOfferingVO findByName(String name) {
+        SearchCriteria<ServiceOfferingVO> sc = UniqueNameSearch.create();
+        sc.setParameters("name", name);
+        sc.setParameters("system", true);
+        List<ServiceOfferingVO> vos = search(sc, null, null, false);
+        if (vos.size() == 0) {
+            return null;
+        }
+        
+        return vos.get(0);
+    }
+    
+    @Override @DB
+    public ServiceOfferingVO persistSystemServiceOffering(ServiceOfferingVO offering) {
+        assert offering.getUniqueName() != null : "how are you going to find this later if you don't set it?";
+        ServiceOfferingVO vo = findByName(offering.getUniqueName());
+        if (vo != null) {
+        	// check invalid CPU speed in system service offering, set it to default value of 500 Mhz if 0 CPU speed is found
+        	if(vo.getSpeed() <= 0) {
+        		vo.setSpeed(500);
+        		update(vo.getId(), vo);
+        	}
+            return vo;
+        }
+        try {
+            return persist(offering);
+        } catch (EntityExistsException e) {
+            // Assume it's conflict on unique name
+            return findByName(offering.getUniqueName());
+        }
+    }
+    
+    @Override
+    public List<ServiceOfferingVO> findServiceOfferingByDomainId(Long domainId){
+    	SearchCriteria<ServiceOfferingVO> sc = ServiceOfferingsByDomainIdSearch.create();
+    	sc.setParameters("domainId", domainId);
+        return listBy(sc);    	
+    }
+    
+
+    @Override
+    public List<ServiceOfferingVO> findSystemOffering(Long domainId, Boolean isSystem, String vm_type){
+        SearchCriteria<ServiceOfferingVO> sc = SystemServiceOffering.create();
+        sc.setParameters("domainId", domainId);
+        sc.setParameters("system", isSystem);
+        sc.setParameters("vm_type", vm_type);
+        return listBy(sc);      
+    }
+    
+    @Override
+    public List<ServiceOfferingVO> findPublicServiceOfferings(){
+    	SearchCriteria<ServiceOfferingVO> sc = PublicServiceOfferingSearch.create();
+    	sc.setParameters("system", false);
+        return listBy(sc);    	
+    }
+    
+    @Override @DB
+    public ServiceOfferingVO persistDeafultServiceOffering(ServiceOfferingVO offering) {
+        assert offering.getUniqueName() != null : "unique name should be set for the service offering";
+        ServiceOfferingVO vo = findByName(offering.getUniqueName());
+        if (vo != null) {
+            return vo;
+        }
+        try {
+            return persist(offering);
+        } catch (EntityExistsException e) {
+            // Assume it's conflict on unique name
+            return findByName(offering.getUniqueName());
+        }
+    }
+    
+    @Override
+    public boolean remove(Long id) {
+        ServiceOfferingVO offering = createForUpdate();
+        offering.setRemoved(new Date());
+
+        return update(id, offering);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/DiskOfferingVO.java b/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
new file mode 100755
index 0000000..909d7fe
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
@@ -0,0 +1,330 @@
+// 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.storage;
+
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.DiscriminatorType;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.offering.DiskOffering;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="disk_offering")
+@Inheritance(strategy=InheritanceType.JOINED)
+@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32)
+public class DiskOfferingVO implements DiskOffering {
+    public enum Type {
+        Disk,
+        Service
+    };
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+
+    @Column(name="domain_id")
+    Long domainId;
+
+    @Column(name="unique_name")
+    private String uniqueName;
+
+    @Column(name="name")
+    private String name = null;
+
+    @Column(name="display_text", length=4096)
+    private String displayText = null;
+
+    @Column(name="disk_size")
+    long diskSize;
+
+    @Column(name="tags", length=4096)
+    String tags;
+
+    @Column(name="type")
+    Type type;
+
+    @Column(name=GenericDao.REMOVED)
+    @Temporal(TemporalType.TIMESTAMP)
+    private Date removed;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    private Date created;
+
+    @Column(name="recreatable")
+    private boolean recreatable;
+
+    @Column(name="use_local_storage")
+    private boolean useLocalStorage;
+
+    @Column(name="system_use")
+    private boolean systemUse;
+
+    @Column(name="customized")
+    private boolean customized;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    @Column(name="sort_key")
+    int sortKey;
+
+    @Column(name="display_offering")
+    boolean displayOffering;
+
+    public DiskOfferingVO() {
+    	this.uuid = UUID.randomUUID().toString();
+    }
+
+    public DiskOfferingVO(Long domainId, String name, String displayText, long diskSize, String tags, boolean isCustomized) {
+        this.domainId = domainId;
+        this.name = name;
+        this.displayText = displayText;
+        this.diskSize = diskSize;
+        this.tags = tags;
+        this.recreatable = false;
+        this.type = Type.Disk;
+        this.useLocalStorage = false;
+        this.customized = isCustomized;
+    	this.uuid = UUID.randomUUID().toString();
+    }
+
+    public DiskOfferingVO(String name, String displayText, boolean mirrored, String tags, boolean recreatable, boolean useLocalStorage, boolean systemUse, boolean customized) {
+        this.domainId = null;
+        this.type = Type.Service;
+        this.name = name;
+        this.displayText = displayText;
+        this.tags = tags;
+        this.recreatable = recreatable;
+        this.useLocalStorage = useLocalStorage;
+        this.systemUse = systemUse;
+        this.customized = customized;
+    	this.uuid = UUID.randomUUID().toString();
+    }
+
+    //domain specific offerings constructor (null domainId implies public offering)
+    public DiskOfferingVO(String name, String displayText, boolean mirrored, String tags, boolean recreatable, boolean useLocalStorage, boolean systemUse, boolean customized, Long domainId) {
+        this.type = Type.Service;
+        this.name = name;
+        this.displayText = displayText;
+        this.tags = tags;
+        this.recreatable = recreatable;
+        this.useLocalStorage = useLocalStorage;
+        this.systemUse = systemUse;
+        this.customized = customized;
+        this.domainId = domainId;
+    	this.uuid = UUID.randomUUID().toString();
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public boolean isCustomized() {
+		return customized;
+	}
+
+	public void setCustomized(boolean customized) {
+		this.customized = customized;
+	}
+
+	@Override
+    public String getUniqueName() {
+        return uniqueName;
+    }
+
+    @Override
+    public boolean getUseLocalStorage() {
+        return useLocalStorage;
+    }
+
+    @Override
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public Type getType() {
+        return type;
+    }
+
+    public boolean isRecreatable() {
+        return recreatable;
+    }
+
+    public void setDomainId(Long domainId) {
+        this.domainId = domainId;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+
+    @Override
+    public boolean getSystemUse() {
+        return systemUse;
+    }
+
+    public void setSystemUse(boolean systemUse) {
+        this.systemUse = systemUse;
+    }
+
+    @Override
+    public String getDisplayText() {
+        return displayText;
+    }
+    public void setDisplayText(String displayText) {
+        this.displayText = displayText;
+    }
+
+    @Override
+    public long getDiskSize(){
+    	return diskSize;
+    }
+
+    @Override
+    public void setDiskSize(long diskSize) {
+        this.diskSize = diskSize;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+	@Override
+    public Date getCreated() {
+		return created;
+	}
+
+    protected void setTags(String tags) {
+        this.tags = tags;
+    }
+
+    @Override
+    public String getTags() {
+        return tags;
+    }
+
+    public void setUniqueName(String name) {
+        this.uniqueName = name;
+    }
+
+    @Override
+    @Transient
+    public String[] getTagsArray() {
+        String tags = getTags();
+        if (tags == null || tags.isEmpty()) {
+            return new String[0];
+        }
+
+        return tags.split(",");
+    }
+
+    @Transient
+    public boolean containsTag(String... tags) {
+        if (this.tags == null) {
+            return false;
+        }
+
+        for (String tag : tags) {
+            if (!this.tags.matches(tag)) {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    @Transient
+    public void setTagsArray(List<String> newTags) {
+        if (newTags.isEmpty()) {
+            setTags(null);
+            return;
+        }
+
+        StringBuilder buf = new StringBuilder();
+        for (String tag : newTags) {
+            buf.append(tag).append(",");
+        }
+
+        buf.delete(buf.length() - 1, buf.length());
+
+        setTags(buf.toString());
+    }
+
+	public void setUseLocalStorage(boolean useLocalStorage) {
+		this.useLocalStorage = useLocalStorage;
+	}
+
+    public void setRemoved(Date removed) {
+        this.removed = removed;
+    }
+
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+
+    public void setSortKey(int key) {
+    	sortKey = key;
+    }
+
+    public int getSortKey() {
+    	return sortKey;
+    }
+    
+    public void setRecreatable(boolean recreatable) {
+    	this.recreatable = recreatable;
+    }
+
+
+    public boolean getDisplayOffering() {
+        return displayOffering;
+    }
+
+    public void setDisplayOffering(boolean displayOffering) {
+        this.displayOffering = displayOffering;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/GuestOSCategoryVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/GuestOSCategoryVO.java b/engine/schema/src/com/cloud/storage/GuestOSCategoryVO.java
new file mode 100644
index 0000000..03a7479
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/GuestOSCategoryVO.java
@@ -0,0 +1,68 @@
+// 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.storage;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="guest_os_category")
+public class GuestOSCategoryVO implements GuestOsCategory {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+
+    @Column(name="name")
+    String name;
+
+    @Column(name="uuid")
+    String uuid = UUID.randomUUID().toString();
+
+    @Override
+    public long getId() {
+    	return id;
+    }
+
+    @Override
+    public String getName() {
+    	return name;
+    }
+
+    @Override
+    public void setName(String name) {
+    	this.name = name;
+    }
+
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/GuestOSVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/GuestOSVO.java b/engine/schema/src/com/cloud/storage/GuestOSVO.java
new file mode 100644
index 0000000..49e136d
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/GuestOSVO.java
@@ -0,0 +1,90 @@
+// 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.storage;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="guest_os")
+public class GuestOSVO implements GuestOS {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+
+    @Column(name="category_id")
+    private long categoryId;
+
+    @Column(name="name")
+    String name;
+
+    @Column(name="display_name")
+    String displayName;
+
+    @Column(name="uuid")
+    String uuid = UUID.randomUUID().toString();
+
+    @Override
+    public long getId() {
+    	return id;
+    }
+
+    public long getCategoryId() {
+    	return categoryId;
+    }
+
+    public void setCategoryId(long categoryId) {
+    	this.categoryId = categoryId;
+    }
+
+    @Override
+    public String getName() {
+    	return name;
+    }
+
+    public void setName(String name) {
+    	this.name = name;
+    }
+
+    @Override
+    public String getDisplayName() {
+    	return displayName;
+    }
+
+    public void setDisplayName(String displayName) {
+    	this.displayName = displayName;
+    }
+
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/LaunchPermissionVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/LaunchPermissionVO.java b/engine/schema/src/com/cloud/storage/LaunchPermissionVO.java
new file mode 100644
index 0000000..992bac2
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/LaunchPermissionVO.java
@@ -0,0 +1,57 @@
+// 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.storage;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="launch_permission")
+public class LaunchPermissionVO implements InternalIdentity {
+    @Id
+    @Column(name="id")
+    private Long id;
+
+    @Column(name="template_id")
+    private long templateId;
+
+    @Column(name="account_id")
+    private long accountId;
+
+    public LaunchPermissionVO() { }
+
+    public LaunchPermissionVO(long templateId, long accountId) {
+        this.templateId = templateId;
+        this.accountId = accountId;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getTemplateId() {
+        return templateId;
+    }
+
+    public long getAccountId() {
+        return accountId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/S3VO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/S3VO.java b/engine/schema/src/com/cloud/storage/S3VO.java
new file mode 100644
index 0000000..ec49bc9
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/S3VO.java
@@ -0,0 +1,209 @@
+/*
+ * 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.storage;
+
+import com.cloud.agent.api.to.S3TO;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.util.Date;
+
+@Entity
+@Table(name = "s3")
+public class S3VO implements S3 {
+
+    public static final String ID_COLUMN_NAME = "id";
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = ID_COLUMN_NAME)
+    private long id;
+
+    @Column(name = "uuid")
+    private String uuid;
+
+    @Column(name = "access_key")
+    private String accessKey;
+
+    @Column(name = "secret_key")
+    private String secretKey;
+
+    @Column(name = "end_point")
+    private String endPoint;
+
+    @Column(name = "bucket")
+    private String bucketName;
+
+    @Column(name = "https")
+    private Integer httpsFlag;
+
+    @Column(name = "connection_timeout")
+    private Integer connectionTimeout;
+
+    @Column(name = "max_error_retry")
+    private Integer maxErrorRetry;
+
+    @Column(name = "socket_timeout")
+    private Integer socketTimeout;
+
+    @Column(name = GenericDao.CREATED_COLUMN)
+    private Date created;
+
+    public S3VO() {
+        super();
+    }
+
+    public S3VO(final String uuid, final String accessKey,
+            final String secretKey, final String endPoint,
+            final String bucketName, final Boolean httpsFlag,
+            final Integer connectionTimeout, final Integer maxErrorRetry,
+            final Integer socketTimeout, final Date created) {
+
+        super();
+
+        this.uuid = uuid;
+        this.accessKey = accessKey;
+        this.secretKey = secretKey;
+        this.endPoint = endPoint;
+        this.bucketName = bucketName;
+
+        Integer value = null;
+        if (httpsFlag != null) {
+            value = httpsFlag == false ? 0 : 1;
+        }
+        this.httpsFlag = value;
+
+        this.connectionTimeout = connectionTimeout;
+        this.maxErrorRetry = maxErrorRetry;
+        this.socketTimeout = socketTimeout;
+        this.created = created;
+
+    }
+
+    @Override
+    public S3TO toS3TO() {
+
+        Boolean httpsFlag = null;
+        if (this.httpsFlag != null) {
+            httpsFlag = this.httpsFlag == 0 ? false : true;
+        }
+
+        return new S3TO(this.id, this.uuid, this.accessKey, this.secretKey,
+                this.endPoint, this.bucketName, httpsFlag,
+                this.connectionTimeout, this.maxErrorRetry, this.socketTimeout,
+                this.created);
+
+    }
+
+    public long getId() {
+        return this.id;
+    }
+
+    public void setId(final long id) {
+        this.id = id;
+    }
+
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    public void setUuid(final String uuid) {
+        this.uuid = uuid;
+    }
+
+    public String getAccessKey() {
+        return this.accessKey;
+    }
+
+    public void setAccessKey(final String accessKey) {
+        this.accessKey = accessKey;
+    }
+
+    public String getSecretKey() {
+        return this.secretKey;
+    }
+
+    public void setSecretKey(final String secretKey) {
+        this.secretKey = secretKey;
+    }
+
+    public String getEndPoint() {
+        return this.endPoint;
+    }
+
+    public void setEndPoint(final String endPoint) {
+        this.endPoint = endPoint;
+    }
+
+    public String getBucketName() {
+        return this.bucketName;
+    }
+
+    public void setBucketName(final String bucketName) {
+        this.bucketName = bucketName;
+    }
+
+    public Integer getHttpsFlag() {
+        return this.httpsFlag;
+    }
+
+    public void setHttpsFlag(final Integer httpsFlag) {
+        this.httpsFlag = httpsFlag;
+    }
+
+    public Integer getConnectionTimeout() {
+        return this.connectionTimeout;
+    }
+
+    public void setConnectionTimeout(final int connectionTimeout) {
+        this.connectionTimeout = connectionTimeout;
+    }
+
+    public Integer getMaxErrorRetry() {
+        return this.maxErrorRetry;
+    }
+
+    public void setMaxErrorRetry(final int maxErrorRetry) {
+        this.maxErrorRetry = maxErrorRetry;
+    }
+
+    public Integer getSocketTimeout() {
+        return this.socketTimeout;
+    }
+
+    public void setSocketTimeout(final int socketTimeout) {
+        this.socketTimeout = socketTimeout;
+    }
+
+    public Date getCreated() {
+        return this.created;
+    }
+
+    public void setCreated(final Date created) {
+        this.created = created;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/SnapshotPolicyVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/SnapshotPolicyVO.java b/engine/schema/src/com/cloud/storage/SnapshotPolicyVO.java
new file mode 100644
index 0000000..4eb4916
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/SnapshotPolicyVO.java
@@ -0,0 +1,133 @@
+// 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.storage;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.storage.snapshot.SnapshotPolicy;
+import com.cloud.utils.DateUtil.IntervalType;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="snapshot_policy")
+public class SnapshotPolicyVO implements SnapshotPolicy {
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+
+    @Column(name="volume_id")
+    long volumeId;
+
+    @Column(name="schedule")
+    String schedule;
+
+    @Column(name="timezone")
+    String timezone;
+
+    @Column(name="interval")
+    private short interval;
+
+    @Column(name="max_snaps")
+    private int maxSnaps;
+
+    @Column(name="active")
+    boolean active = false;
+
+    @Column(name="uuid")
+    String uuid;
+
+    public SnapshotPolicyVO() {
+    	this.uuid = UUID.randomUUID().toString();
+    }
+
+    public SnapshotPolicyVO(long volumeId, String schedule, String timezone, IntervalType intvType, int maxSnaps) {
+    	this.volumeId = volumeId;
+        this.schedule = schedule;
+        this.timezone = timezone;
+        this.interval = (short)intvType.ordinal();
+        this.maxSnaps = maxSnaps;
+        this.active = true;
+    	this.uuid = UUID.randomUUID().toString();
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getVolumeId() {
+		return volumeId;
+	}
+
+	public void setSchedule(String schedule) {
+        this.schedule = schedule;
+    }
+
+    public String getSchedule() {
+        return schedule;
+    }
+
+    public void setInterval(short interval) {
+        this.interval = interval;
+    }
+
+    public void setTimezone(String timezone) {
+        this.timezone = timezone;
+    }
+
+    public String getTimezone() {
+        return timezone;
+    }
+
+    public short getInterval() {
+        return interval;
+    }
+
+    public void setMaxSnaps(int maxSnaps) {
+        this.maxSnaps = maxSnaps;
+    }
+
+    public int getMaxSnaps() {
+        return maxSnaps;
+    }
+
+    public boolean isActive() {
+        return active;
+    }
+
+    public void setActive(boolean active) {
+        this.active = active;
+    }
+
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/SnapshotScheduleVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/SnapshotScheduleVO.java b/engine/schema/src/com/cloud/storage/SnapshotScheduleVO.java
new file mode 100644
index 0000000..75757c6
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/SnapshotScheduleVO.java
@@ -0,0 +1,125 @@
+// 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.storage;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.storage.snapshot.SnapshotSchedule;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="snapshot_schedule")
+public class SnapshotScheduleVO implements SnapshotSchedule {
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+	@Column(name="id")
+	long id;
+
+    // DB constraint: For a given volume and policyId, there will only be one entry in this table.
+    @Column(name="volume_id")
+    long volumeId;
+
+    @Column(name="policy_id")
+    long policyId;
+
+    @Column(name="scheduled_timestamp")
+    @Temporal(value=TemporalType.TIMESTAMP)
+    Date scheduledTimestamp;
+
+    @Column(name="async_job_id")
+    Long asyncJobId;
+
+    @Column(name="snapshot_id")
+    Long snapshotId;
+
+    @Column(name="uuid")
+    String uuid = UUID.randomUUID().toString();
+
+    public SnapshotScheduleVO() { }
+
+    public SnapshotScheduleVO(long volumeId, long policyId, Date scheduledTimestamp) {
+        this.volumeId = volumeId;
+        this.policyId = policyId;
+        this.scheduledTimestamp = scheduledTimestamp;
+        this.snapshotId = null;
+        this.asyncJobId = null;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public Long getVolumeId() {
+        return volumeId;
+    }
+
+    public Long getPolicyId() {
+        return policyId;
+    }
+
+	public void setPolicyId(long policyId) {
+        this.policyId = policyId;
+    }
+
+    /**
+	 * @return the scheduledTimestamp
+	 */
+	public Date getScheduledTimestamp() {
+		return scheduledTimestamp;
+	}
+
+	public void setScheduledTimestamp(Date scheduledTimestamp) {
+        this.scheduledTimestamp = scheduledTimestamp;
+    }
+
+    public Long getAsyncJobId() {
+	    return asyncJobId;
+	}
+
+	public void setAsyncJobId(Long asyncJobId) {
+	    this.asyncJobId = asyncJobId;
+	}
+
+	public Long getSnapshotId() {
+	    return snapshotId;
+	}
+
+	public void setSnapshotId(Long snapshotId) {
+	    this.snapshotId = snapshotId;
+	}
+
+	@Override
+	public String getUuid() {
+		return this.uuid;
+	}
+
+	public void setUuid(String uuid) {
+		this.uuid = uuid;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/SnapshotVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/SnapshotVO.java b/engine/schema/src/com/cloud/storage/SnapshotVO.java
new file mode 100644
index 0000000..78b96ec
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/SnapshotVO.java
@@ -0,0 +1,298 @@
+// 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.storage;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.utils.db.GenericDao;
+import com.google.gson.annotations.Expose;
+
+import javax.persistence.*;
+import java.util.Date;
+import java.util.UUID;
+
+@Entity
+@Table(name="snapshots")
+public class SnapshotVO implements Snapshot {
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="data_center_id")
+    long dataCenterId;
+
+    @Column(name="account_id")
+    long accountId;
+
+    @Column(name="domain_id")
+    long domainId;
+
+    @Column(name="volume_id")
+    Long volumeId;
+
+    @Column(name="disk_offering_id")
+    Long diskOfferingId;
+
+    @Expose
+    @Column(name="path")
+    String path;
+
+    @Expose
+    @Column(name="name")
+    String name;
+
+    @Expose
+    @Column(name="status", updatable = true, nullable=false)
+    @Enumerated(value=EnumType.STRING)
+    private State state;
+
+    @Column(name="snapshot_type")
+    short snapshotType;
+
+    @Column(name="type_description")
+    String typeDescription;
+
+    @Column(name="size")
+    long size;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    Date created;
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    Date removed;
+
+    @Column(name="backup_snap_id")
+    String backupSnapshotId;
+
+    @Column(name="swift_id")
+    Long swiftId;
+
+    @Column(name="s3_id")
+    Long s3Id;
+
+    @Column(name="sechost_id")
+    Long secHostId;
+
+    @Column(name="prev_snap_id")
+    long prevSnapshotId;
+
+    @Column(name="hypervisor_type")
+    @Enumerated(value=EnumType.STRING)
+    HypervisorType  hypervisorType;
+
+    @Expose
+    @Column(name="version")
+    String version;
+
+    @Column(name="uuid")
+    String uuid;
+
+    public SnapshotVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public SnapshotVO(long dcId, long accountId, long domainId, Long volumeId, Long diskOfferingId, String path, String name, short snapshotType, String typeDescription, long size, HypervisorType hypervisorType ) {
+        this.dataCenterId = dcId;
+        this.accountId = accountId;
+        this.domainId = domainId;
+        this.volumeId = volumeId;
+        this.diskOfferingId = diskOfferingId;
+        this.path = path;
+        this.name = name;
+        this.snapshotType = snapshotType;
+        this.typeDescription = typeDescription;
+        this.size = size;
+        this.state = State.Allocated;
+        this.prevSnapshotId = 0;
+        this.hypervisorType = hypervisorType;
+        this.version = "2.2";
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    public long getDataCenterId() {
+        return dataCenterId;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public long getVolumeId() {
+        return volumeId;
+    }
+
+    public long getDiskOfferingId() {
+        return diskOfferingId;
+    }
+
+    public void setVolumeId(Long volumeId) {
+        this.volumeId = volumeId;
+    }
+
+    @Override
+    public String getPath() {
+        return path;
+    }
+
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+    @Override
+    public short getsnapshotType() {
+        return snapshotType;
+    }
+
+    @Override
+    public Type getRecurringType() {
+        if (snapshotType < 0 || snapshotType >= Type.values().length) {
+            return null;
+        }
+        return Type.values()[snapshotType];
+    }
+
+    public Long getSwiftId() {
+        return swiftId;
+    }
+
+    public void setSwiftId(Long swiftId) {
+        this.swiftId = swiftId;
+    }
+
+    public Long getSecHostId() {
+        return secHostId;
+    }
+
+    public void setSecHostId(Long secHostId) {
+        this.secHostId = secHostId;
+    }
+
+    @Override
+    public HypervisorType getHypervisorType() {
+        return hypervisorType;
+    }
+
+    public void setSnapshotType(short snapshotType) {
+        this.snapshotType = snapshotType;
+    }
+
+    @Override
+    public boolean isRecursive(){
+        if ( snapshotType >= Type.HOURLY.ordinal() && snapshotType <= Type.MONTHLY.ordinal() ) {
+            return true;
+        }
+        return false;
+    }
+
+    public long getSize() {
+        return size;
+    }
+
+    public String getTypeDescription() {
+        return typeDescription;
+    }
+    public void setTypeDescription(String typeDescription) {
+        this.typeDescription = typeDescription;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    @Override
+    public Date getCreated() {
+        return created;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+
+	public void setState(State state) {
+        this.state = state;
+    }
+
+    public String getBackupSnapshotId(){
+        return backupSnapshotId;
+    }
+
+    public long getPrevSnapshotId(){
+        return prevSnapshotId;
+    }
+
+    public void setBackupSnapshotId(String backUpSnapshotId){
+        this.backupSnapshotId = backUpSnapshotId;
+    }
+
+    public void setPrevSnapshotId(long prevSnapshotId){
+        this.prevSnapshotId = prevSnapshotId;
+    }
+
+    public static Type getSnapshotType(String snapshotType) {
+        for ( Type type : Type.values()) {
+            if ( type.equals(snapshotType)) {
+                return type;
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    public Long getS3Id() {
+        return s3Id;
+    }
+
+    public void setS3Id(Long s3Id) {
+        this.s3Id = s3Id;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/StoragePoolHostAssoc.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/StoragePoolHostAssoc.java b/engine/schema/src/com/cloud/storage/StoragePoolHostAssoc.java
new file mode 100644
index 0000000..34326d9
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/StoragePoolHostAssoc.java
@@ -0,0 +1,35 @@
+// 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.storage;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import java.util.Date;
+
+public interface StoragePoolHostAssoc extends InternalIdentity {
+	
+	long getHostId();
+	
+	long getPoolId();
+	
+	String getLocalPath();
+
+	Date getCreated();
+
+	Date getLastUpdated();
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/StoragePoolHostVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/StoragePoolHostVO.java b/engine/schema/src/com/cloud/storage/StoragePoolHostVO.java
new file mode 100644
index 0000000..1b02f6d
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/StoragePoolHostVO.java
@@ -0,0 +1,109 @@
+// 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.storage;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import com.cloud.utils.db.GenericDaoBase;
+
+/**
+ * Join table for storage pools and hosts
+ *
+ */
+@Entity
+@Table(name="storage_pool_host_ref")
+public class StoragePoolHostVO implements StoragePoolHostAssoc {
+	@Id
+	@GeneratedValue(strategy=GenerationType.IDENTITY)
+	private Long id;
+
+	@Column(name="pool_id")
+	private long poolId;
+
+	@Column(name="host_id")
+	private long hostId;
+
+	@Column(name="local_path")
+	private String localPath;
+
+	@Column(name=GenericDaoBase.CREATED_COLUMN)
+    private Date created = null;
+
+	@Column(name="last_updated")
+	@Temporal(value=TemporalType.TIMESTAMP)
+    private Date lastUpdated = null;
+
+
+	public StoragePoolHostVO() {
+		super();
+	}
+
+
+	public StoragePoolHostVO(long poolId, long hostId, String localPath) {
+		this.poolId = poolId;
+		this.hostId = hostId;
+		this.localPath = localPath;
+	}
+
+
+	@Override
+	public long getHostId() {
+		return hostId;
+	}
+
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+
+    @Override
+	public String getLocalPath() {
+		return localPath;
+	}
+
+	@Override
+	public long getPoolId() {
+		return poolId;
+	}
+
+	@Override
+	public Date getCreated() {
+		return created;
+	}
+
+	@Override
+	public Date getLastUpdated() {
+		return lastUpdated;
+	}
+
+
+	public void setLocalPath(String localPath) {
+		this.localPath = localPath;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/StoragePoolWorkVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/StoragePoolWorkVO.java b/engine/schema/src/com/cloud/storage/StoragePoolWorkVO.java
new file mode 100644
index 0000000..440065d
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/StoragePoolWorkVO.java
@@ -0,0 +1,118 @@
+// 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.storage;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="storage_pool_work")
+public class StoragePoolWorkVO implements InternalIdentity {
+    
+    public long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getPoolId() {
+        return poolId;
+    }
+
+
+    public void setPoolId(Long poolId) {
+        this.poolId = poolId;
+    }
+
+
+    public boolean isStoppedForMaintenance() {
+        return stoppedForMaintenance;
+    }
+
+
+    public void setStoppedForMaintenance(boolean stoppedForMaintenance) {
+        this.stoppedForMaintenance = stoppedForMaintenance;
+    }
+
+
+    public boolean isStartedAfterMaintenance() {
+        return startedAfterMaintenance;
+    }
+
+    public void setStartedAfterMaintenance(boolean startedAfterMaintenance) {
+        this.startedAfterMaintenance = startedAfterMaintenance;
+    }
+
+    public Long getVmId() {
+        return vmId;
+    }
+
+    public void setVmId(Long vmId) {
+        this.vmId = vmId;
+    }
+    
+    public Long getManagementServerId() {
+        return managementServerId;
+    }
+
+    public void setManagementServerId(Long managementServerId) {
+        this.managementServerId = managementServerId;
+    }
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private Long id;
+    
+    @Column(name="pool_id")
+    private Long poolId;
+
+    @Column(name="vm_id")
+    private Long vmId;
+    
+    @Column(name="stopped_for_maintenance")
+    private boolean stoppedForMaintenance;
+    
+    @Column(name="started_after_maintenance")
+    private boolean startedAfterMaintenance;
+
+    @Column(name="mgmt_server_id")
+    private Long managementServerId;
+    
+
+    public StoragePoolWorkVO(long vmId, long poolId, boolean stoppedForMaintenance, boolean startedAfterMaintenance, long mgmtServerId) {
+        super();
+        this.vmId = vmId;
+        this.poolId = poolId;
+        this.stoppedForMaintenance = stoppedForMaintenance;
+        this.startedAfterMaintenance = startedAfterMaintenance;
+        this.managementServerId = mgmtServerId;
+    }
+    
+    public StoragePoolWorkVO() {
+        
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/SwiftVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/SwiftVO.java b/engine/schema/src/com/cloud/storage/SwiftVO.java
new file mode 100644
index 0000000..c99f0ef
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/SwiftVO.java
@@ -0,0 +1,108 @@
+// 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.storage;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.agent.api.to.SwiftTO;
+import org.apache.cloudstack.api.Identity;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="swift")
+public class SwiftVO implements Swift, InternalIdentity {
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="url")
+    String url;
+
+    @Column(name="account")
+    String account;
+
+    @Column(name="username")
+    String userName;
+
+    @Column(name="key")
+    String key;
+
+    @Column(name="uuid")
+    String uuid = UUID.randomUUID().toString();
+
+    @Column(name = GenericDao.CREATED_COLUMN)
+    private Date created;
+
+    public SwiftVO() { }
+
+    public SwiftVO(String url, String account, String userName, String key) {
+        this.url = url;
+        this.account = account;
+        this.userName = userName;
+        this.key = key;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+    @Override
+    public String getUrl() {
+        return url;
+    }
+    @Override
+    public String getAccount() {
+        return account;
+    }
+    @Override
+    public String getUserName() {
+        return userName;
+    }
+    @Override
+    public String getKey() {
+        return key;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    @Override
+    public SwiftTO toSwiftTO() {
+        return new SwiftTO(getId(), getUrl(), getAccount(), getUserName(), getKey());
+    }
+
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/UploadVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/UploadVO.java b/engine/schema/src/com/cloud/storage/UploadVO.java
new file mode 100755
index 0000000..d761bf1
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/UploadVO.java
@@ -0,0 +1,268 @@
+// 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.storage;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.db.GenericDaoBase;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="upload")
+public class UploadVO implements Upload {
+	@Id
+	@GeneratedValue(strategy=GenerationType.IDENTITY)
+	long id;
+
+    @Column(name="uuid")
+	private String uuid;
+
+	@Column(name="host_id")
+	private long hostId;
+
+	@Column(name="type_id")
+	private long typeId;
+
+	@Column(name=GenericDaoBase.CREATED_COLUMN)
+	private Date created = null;
+
+	@Column(name="last_updated")
+	@Temporal(value=TemporalType.TIMESTAMP)
+	private Date lastUpdated = null;
+
+	@Column (name="upload_pct")
+	private int uploadPercent;
+
+	@Column (name="type")
+	@Enumerated(EnumType.STRING)
+	private Type type;
+
+	@Column (name="mode")
+    @Enumerated(EnumType.STRING)
+    private Mode mode = Mode.FTP_UPLOAD;
+
+	@Column (name="upload_state")
+	@Enumerated(EnumType.STRING)
+	private Status uploadState;
+
+	@Column (name="error_str")
+	private String errorString;
+
+	@Column (name="job_id")
+	private String jobId;
+
+	@Column (name="url")
+	private String uploadUrl;
+
+	@Column (name="install_path")
+	private String installPath;
+
+	@Override
+    public long getHostId() {
+		return hostId;
+	}
+
+	public void setHostId(long hostId) {
+		this.hostId = hostId;
+	}
+
+	@Override
+    public long getId() {
+		return id;
+	}
+
+
+	public String getUuid() {
+        return uuid;
+    }
+
+    @Override
+    public Date getCreated() {
+		return created;
+	}
+
+	@Override
+    public Date getLastUpdated() {
+		return lastUpdated;
+	}
+
+	public void setLastUpdated(Date date) {
+	    lastUpdated = date;
+	}
+
+	public UploadVO(long hostId, long templateId) {
+		super();
+		this.hostId = hostId;
+		this.typeId = templateId;
+		this.uuid = UUID.randomUUID().toString();
+	}
+
+	public UploadVO(long hostId, long typeId, Date lastUpdated,
+			Status uploadState, Type type,
+			String uploadUrl, Mode mode) {
+		super();
+		this.hostId = hostId;
+		this.typeId = typeId;
+		this.lastUpdated = lastUpdated;
+		this.uploadState = uploadState;
+		this.mode = mode;
+		this.type = type;
+		this.uploadUrl = uploadUrl;
+        this.uuid = UUID.randomUUID().toString();
+	}
+
+	public UploadVO(long hostId, long typeId, Date lastUpdated,
+            Status uploadState, int uploadPercent, Type type,
+            Mode mode) {
+        super();
+        this.hostId = hostId;
+        this.typeId = typeId;
+        this.lastUpdated = lastUpdated;
+        this.uploadState = uploadState;
+        this.uploadPercent = uploadPercent;
+        this.type = type;
+        this.mode = mode;
+        this.uuid = UUID.randomUUID().toString();
+
+    }
+
+	protected UploadVO() {
+	}
+
+	public UploadVO(Long uploadId) {
+		this.id = uploadId;
+	}
+
+	public void setErrorString(String errorString) {
+		this.errorString = errorString;
+	}
+
+	@Override
+    public String getErrorString() {
+		return errorString;
+	}
+
+	public void setJobId(String jobId) {
+		this.jobId = jobId;
+	}
+
+	@Override
+    public String getJobId() {
+		return jobId;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (obj instanceof UploadVO) {
+			UploadVO other = (UploadVO)obj;
+		   return (this.typeId==other.getTypeId() && this.hostId==other.getHostId() && this.type == other.getType());
+		}
+		return false;
+	}
+
+	@Override
+	public int hashCode() {
+		return NumbersUtil.hash(id);
+	}
+
+	@Override
+    public int getUploadPercent() {
+		return uploadPercent;
+	}
+
+	public void setUploadPercent(int uploadPercent) {
+		this.uploadPercent = uploadPercent;
+	}
+
+	@Override
+    public Status getUploadState() {
+		return uploadState;
+	}
+
+	public void setUploadState(Status uploadState) {
+		this.uploadState = uploadState;
+	}
+
+	@Override
+    public long getTypeId() {
+		return typeId;
+	}
+
+	public void setTypeId(long typeId) {
+		this.typeId = typeId;
+	}
+
+	@Override
+    public Type getType() {
+		return type;
+	}
+
+	public void setType(Type type) {
+		this.type = type;
+	}
+
+	@Override
+    public Mode getMode() {
+        return mode;
+    }
+
+    public void setMode(Mode mode) {
+        this.mode = mode;
+    }
+
+    @Override
+    public String getUploadUrl() {
+		return uploadUrl;
+	}
+
+	public void setUploadUrl(String uploadUrl) {
+		this.uploadUrl = uploadUrl;
+	}
+
+	@Override
+    public void setId(Long id) {
+		this.id = id;
+	}
+
+	@Override
+    public void setCreated(Date created) {
+		this.created = created;
+	}
+
+    @Override
+    public String getInstallPath() {
+        return installPath;
+    }
+
+    @Override
+    public void setInstallPath(String installPath) {
+        this.installPath = installPath;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/VMTemplateDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/VMTemplateDetailVO.java b/engine/schema/src/com/cloud/storage/VMTemplateDetailVO.java
new file mode 100644
index 0000000..c007802
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/VMTemplateDetailVO.java
@@ -0,0 +1,84 @@
+// 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.storage;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="vm_template_details")
+public class VMTemplateDetailVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+    @Column(name="template_id")
+    private long templateId;
+    
+    @Column(name="name")
+    private String name;
+    
+    @Column(name="value", length=1024)
+    private String value;
+	
+    public VMTemplateDetailVO() {}
+    
+    public VMTemplateDetailVO(long templateId, String name, String value) {
+    	this.templateId = templateId;
+    	this.name = name;
+    	this.value = value;
+    }
+
+	public long getId() {
+		return id;
+	}
+
+	public long getTemplateId() {
+		return templateId;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public String getValue() {
+		return value;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public void setTemplateId(long templateId) {
+		this.templateId = templateId;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public void setValue(String value) {
+		this.value = value;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/VMTemplateHostVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/VMTemplateHostVO.java b/engine/schema/src/com/cloud/storage/VMTemplateHostVO.java
new file mode 100755
index 0000000..b8dfc41
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/VMTemplateHostVO.java
@@ -0,0 +1,322 @@
+// 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.storage;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
+
+import com.cloud.utils.db.GenericDaoBase;
+
+/**
+ * Join table for storage hosts and templates
+ *
+ */
+@Entity
+@Table(name="template_host_ref")
+public class VMTemplateHostVO implements VMTemplateStorageResourceAssoc, DataObjectInStore {
+	@Id
+	@GeneratedValue(strategy=GenerationType.IDENTITY)
+	Long id;
+	
+	@Column(name="host_id")
+	private long hostId;
+	
+	@Column(name="template_id")
+	private long templateId;
+	
+	@Column(name=GenericDaoBase.CREATED_COLUMN)
+	private Date created = null;
+	
+	@Column(name="last_updated")
+	@Temporal(value=TemporalType.TIMESTAMP)
+	private Date lastUpdated = null;
+	
+	@Column (name="download_pct")
+	private int downloadPercent;
+	
+	@Column (name="size")
+	private long size;
+	
+	@Column (name="physical_size")
+	private long physicalSize;
+	
+	@Column (name="download_state")
+	@Enumerated(EnumType.STRING)
+	private Status downloadState;
+	
+	@Column (name="local_path")
+	private String localDownloadPath;
+	
+	@Column (name="error_str")
+	private String errorString;
+	
+	@Column (name="job_id")
+	private String jobId;	
+	
+	@Column (name="install_path")
+    private String installPath;
+	
+	@Column (name="url")
+	private String downloadUrl;
+
+	@Column(name="is_copy")
+	private boolean isCopy = false;
+    
+    @Column(name="destroyed")
+    boolean destroyed = false;
+    
+    @Column(name="update_count", updatable = true, nullable=false)
+    protected long updatedCount;
+    
+    @Column(name = "updated")
+    @Temporal(value = TemporalType.TIMESTAMP)
+    Date updated;
+    
+    @Column(name = "state")
+    @Enumerated(EnumType.STRING)
+    ObjectInDataStoreStateMachine.State state;
+    
+    
+	@Override
+    public String getInstallPath() {
+		return installPath;
+	}
+
+	public long getHostId() {
+		return hostId;
+	}
+
+	public void setHostId(long hostId) {
+		this.hostId = hostId;
+	}
+
+	@Override
+    public long getTemplateId() {
+		return templateId;
+	}
+
+	@Override
+    public void setTemplateId(long templateId) {
+		this.templateId = templateId;
+	}
+
+	@Override
+    public int getDownloadPercent() {
+		return downloadPercent;
+	}
+
+	@Override
+    public void setDownloadPercent(int downloadPercent) {
+		this.downloadPercent = downloadPercent;
+	}
+
+	@Override
+    public void setDownloadState(Status downloadState) {
+		this.downloadState = downloadState;
+	}
+
+	@Override
+    public long getId() {
+		return id;
+	}
+
+	@Override
+    public Date getCreated() {
+		return created;
+	}
+
+	@Override
+    public Date getLastUpdated() {
+		return lastUpdated;
+	}
+	
+	@Override
+    public void setLastUpdated(Date date) {
+	    lastUpdated = date;
+	}
+	
+	@Override
+    public void setInstallPath(String installPath) {
+	    this.installPath = installPath;
+	}
+
+	@Override
+    public Status getDownloadState() {
+		return downloadState;
+	}
+
+	public VMTemplateHostVO(long hostId, long templateId) {
+		super();
+		this.hostId = hostId;
+		this.templateId = templateId;
+		this.state = ObjectInDataStoreStateMachine.State.Allocated;
+	}
+
+	public VMTemplateHostVO(long hostId, long templateId, Date lastUpdated,
+			int downloadPercent, Status downloadState,
+			String localDownloadPath, String errorString, String jobId,
+			String installPath, String downloadUrl) {
+		super();
+		this.hostId = hostId;
+		this.templateId = templateId;
+		this.lastUpdated = lastUpdated;
+		this.downloadPercent = downloadPercent;
+		this.downloadState = downloadState;
+		this.localDownloadPath = localDownloadPath;
+		this.errorString = errorString;
+		this.jobId = jobId;
+		this.installPath = installPath;
+		this.setDownloadUrl(downloadUrl);
+	}
+
+	protected VMTemplateHostVO() {
+		
+	}
+
+	@Override
+    public void setLocalDownloadPath(String localPath) {
+		this.localDownloadPath = localPath;
+	}
+
+	@Override
+    public String getLocalDownloadPath() {
+		return localDownloadPath;
+	}
+
+	@Override
+    public void setErrorString(String errorString) {
+		this.errorString = errorString;
+	}
+
+	@Override
+    public String getErrorString() {
+		return errorString;
+	}
+
+	@Override
+    public void setJobId(String jobId) {
+		this.jobId = jobId;
+	}
+
+	@Override
+    public String getJobId() {
+		return jobId;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (obj instanceof VMTemplateHostVO) {
+			VMTemplateHostVO other = (VMTemplateHostVO)obj;
+			return (this.templateId==other.getTemplateId() && this.hostId==other.getHostId());		   
+		}
+		return false;
+	}
+
+	@Override
+	public int hashCode() {
+		Long tid = new Long(templateId);
+		Long hid = new Long(hostId);
+		return tid.hashCode()+hid.hashCode();
+	}
+
+    public void setSize(long size) {
+        this.size = size;
+    }
+
+    public long getSize() {
+        return size;
+    }
+	
+    
+    public void setPhysicalSize(long physicalSize) {
+        this.physicalSize = physicalSize;
+    }
+
+    public long getPhysicalSize() {
+        return physicalSize;
+    }
+
+    public void setDestroyed(boolean destroyed) {
+    	this.destroyed = destroyed;
+    }
+
+    public boolean getDestroyed() {
+    	return destroyed;
+    }
+
+	public void setDownloadUrl(String downloadUrl) {
+		this.downloadUrl = downloadUrl;
+	}
+
+	public String getDownloadUrl() {
+		return downloadUrl;
+	}
+
+	public void setCopy(boolean isCopy) {
+		this.isCopy = isCopy;
+	}
+
+	public boolean isCopy() {
+		return isCopy;
+	}
+	
+	@Override
+    public long getTemplateSize() {
+	    return -1;
+	}
+	
+	@Override
+    public String toString() {
+	    return new StringBuilder("TmplHost[").append(id).append("-").append(templateId).append("-").append(hostId).append(installPath).append("]").toString();
+	}
+
+    @Override
+    public ObjectInDataStoreStateMachine.State getState() {
+        // TODO Auto-generated method stub
+        return this.state;
+    }
+    
+    public long getUpdatedCount() {
+        return this.updatedCount;
+    }
+    
+    public void incrUpdatedCount() {
+        this.updatedCount++;
+    }
+
+    public void decrUpdatedCount() {
+        this.updatedCount--;
+    }
+    
+    public Date getUpdated() {
+        return updated;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/VMTemplateS3VO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/VMTemplateS3VO.java b/engine/schema/src/com/cloud/storage/VMTemplateS3VO.java
new file mode 100644
index 0000000..02f3ff5
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/VMTemplateS3VO.java
@@ -0,0 +1,204 @@
+/*
+ * 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.storage;
+
+import com.cloud.utils.db.GenericDaoBase;
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import java.text.DateFormat;
+import java.util.Date;
+
+@Entity
+@Table(name = "template_s3_ref")
+public class VMTemplateS3VO implements InternalIdentity {
+
+    public static final String S3_ID_COLUMN_NAME = "s3_id";
+
+    public static final String TEMPLATE_ID_COLUMN_NAME = "template_id";
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private long id;
+
+    @Column(name = S3_ID_COLUMN_NAME)
+    private long s3Id;
+
+    @Column(name = TEMPLATE_ID_COLUMN_NAME)
+    private long templateId;
+
+    @Column(name = GenericDaoBase.CREATED_COLUMN)
+    private Date created;
+
+    @Column(name = "size")
+    private Long size;
+
+    @Column(name = "physical_size")
+    private Long physicalSize;
+
+    public VMTemplateS3VO() {
+        super();
+    }
+
+    public VMTemplateS3VO(final long s3Id, final long templateId,
+            final Date created, final Long size, final Long physicalSize) {
+
+        super();
+
+        this.s3Id = s3Id;
+        this.templateId = templateId;
+        this.created = created;
+        this.size = size;
+        this.physicalSize = physicalSize;
+
+    }
+
+    @Override
+    public boolean equals(final Object thatObject) {
+
+        if (this == thatObject) {
+            return true;
+        }
+
+        if (thatObject == null || getClass() != thatObject.getClass()) {
+            return false;
+        }
+
+        final VMTemplateS3VO thatVMTemplateS3VO = (VMTemplateS3VO) thatObject;
+
+        if (this.id != thatVMTemplateS3VO.id) {
+            return false;
+        }
+
+        if (this.s3Id != thatVMTemplateS3VO.s3Id) {
+            return false;
+        }
+
+        if (this.templateId != thatVMTemplateS3VO.templateId) {
+            return false;
+        }
+
+        if (this.created != null ? !created.equals(thatVMTemplateS3VO.created)
+                : thatVMTemplateS3VO.created != null) {
+            return false;
+        }
+
+        if (this.physicalSize != null ? !physicalSize
+                .equals(thatVMTemplateS3VO.physicalSize)
+                : thatVMTemplateS3VO.physicalSize != null) {
+            return false;
+        }
+
+        if (this.size != null ? !size.equals(thatVMTemplateS3VO.size)
+                : thatVMTemplateS3VO.size != null) {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+
+        int result = (int) (this.id ^ (this.id >>> 32));
+
+        result = 31 * result + (int) (this.s3Id ^ (this.s3Id >>> 32));
+        result = 31 * result
+                + (int) (this.templateId ^ (this.templateId >>> 32));
+        result = 31 * result
+                + (this.created != null ? this.created.hashCode() : 0);
+        result = 31 * result + (this.size != null ? this.size.hashCode() : 0);
+        result = 31
+                * result
+                + (this.physicalSize != null ? this.physicalSize.hashCode() : 0);
+
+        return result;
+
+    }
+
+    public long getId() {
+        return this.id;
+    }
+
+    public void setId(final long id) {
+        this.id = id;
+    }
+
+    public long getS3Id() {
+        return this.s3Id;
+    }
+
+    public void setS3Id(final long s3Id) {
+        this.s3Id = s3Id;
+    }
+
+    public long getTemplateId() {
+        return this.templateId;
+    }
+
+    public void setTemplateId(final long templateId) {
+        this.templateId = templateId;
+    }
+
+    public Date getCreated() {
+        return this.created;
+    }
+
+    public void setCreated(final Date created) {
+        this.created = created;
+    }
+
+    public Long getSize() {
+        return this.size;
+    }
+
+    public void setSize(final Long size) {
+        this.size = size;
+    }
+
+    public Long getPhysicalSize() {
+        return this.physicalSize;
+    }
+
+    public void setPhysicalSize(final Long physicalSize) {
+        this.physicalSize = physicalSize;
+    }
+
+    @Override
+    public String toString() {
+
+        final StringBuilder stringBuilder = new StringBuilder(
+                "VMTemplateS3VO [ id: ").append(id).append(", created: ")
+                .append(DateFormat.getDateTimeInstance().format(created))
+                .append(", physicalSize: ").append(physicalSize)
+                .append(", size: ").append(size).append(", templateId: ")
+                .append(templateId).append(", s3Id: ").append(s3Id)
+                .append(" ]");
+
+        return stringBuilder.toString();
+
+    }
+
+}


[08/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnDao.java b/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnDao.java
new file mode 100644
index 0000000..6e3b483
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnDao.java
@@ -0,0 +1,30 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.network.RemoteAccessVpn;
+import com.cloud.utils.db.GenericDao;
+
+public interface RemoteAccessVpnDao extends GenericDao<RemoteAccessVpnVO, Long> {
+    RemoteAccessVpnVO findByPublicIpAddress(long ipAddressId);
+    RemoteAccessVpnVO findByPublicIpAddressAndState(long ipAddressId, RemoteAccessVpn.State state);
+    RemoteAccessVpnVO findByAccountAndNetwork(Long accountId, Long zoneId);
+    List<RemoteAccessVpnVO> findByAccount(Long accountId);
+    List<RemoteAccessVpnVO> listByNetworkId(Long networkId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnDaoImpl.java b/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnDaoImpl.java
new file mode 100644
index 0000000..ed732d8
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnDaoImpl.java
@@ -0,0 +1,84 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.RemoteAccessVpn;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value={RemoteAccessVpnDao.class})
+public class RemoteAccessVpnDaoImpl extends GenericDaoBase<RemoteAccessVpnVO, Long> implements RemoteAccessVpnDao {
+    private static final Logger s_logger = Logger.getLogger(RemoteAccessVpnDaoImpl.class);
+    
+    private final SearchBuilder<RemoteAccessVpnVO> AllFieldsSearch;
+
+
+    protected RemoteAccessVpnDaoImpl() {
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("networkId", AllFieldsSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("ipAddress", AllFieldsSearch.entity().getServerAddressId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+    }
+
+    @Override
+    public RemoteAccessVpnVO findByPublicIpAddress(long ipAddressId) {
+        SearchCriteria<RemoteAccessVpnVO> sc = AllFieldsSearch.create();
+        sc.setParameters("ipAddress", ipAddressId);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public RemoteAccessVpnVO findByAccountAndNetwork(Long accountId, Long networkId) {
+        SearchCriteria<RemoteAccessVpnVO> sc = AllFieldsSearch.create();
+        sc.setParameters("accountId", accountId);
+        sc.setParameters("networkId", networkId);
+        return findOneBy(sc);
+    }
+
+	@Override
+	public List<RemoteAccessVpnVO> findByAccount(Long accountId) {
+		SearchCriteria<RemoteAccessVpnVO> sc = AllFieldsSearch.create();
+        sc.setParameters("accountId", accountId);
+        return listBy(sc);
+	}
+	
+	@Override
+	public RemoteAccessVpnVO findByPublicIpAddressAndState(long ipAddressId, RemoteAccessVpn.State state) {
+	    SearchCriteria<RemoteAccessVpnVO> sc = AllFieldsSearch.create();
+        sc.setParameters("ipAddress", ipAddressId);
+        sc.setParameters("state", state);
+        return findOneBy(sc);
+	}
+	
+	@Override
+	public List<RemoteAccessVpnVO> listByNetworkId(Long networkId) {
+	    SearchCriteria<RemoteAccessVpnVO> sc = AllFieldsSearch.create();
+        sc.setParameters("networkId", networkId);
+        return listBy(sc);
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnVO.java b/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnVO.java
new file mode 100644
index 0000000..2e8ee91
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnVO.java
@@ -0,0 +1,142 @@
+// 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.network.dao;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.network.RemoteAccessVpn;
+
+@Entity
+@Table(name=("remote_access_vpn"))
+public class RemoteAccessVpnVO implements RemoteAccessVpn {
+    @Column(name="account_id")
+    private long accountId;
+
+    @Column(name="network_id")
+    private long networkId;
+    
+    @Column(name="domain_id")
+    private long domainId;
+
+    @Column(name="vpn_server_addr_id")
+    private long serverAddressId;
+    
+    @Column(name="local_ip")
+    private String localIp;
+
+    @Column(name="ip_range")
+    private String ipRange;
+
+    @Column(name="ipsec_psk")
+    private String ipsecPresharedKey;
+    
+    @Column(name="state")
+    private State state;
+    
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+    @Column(name="uuid")
+    private String uuid;
+
+    public RemoteAccessVpnVO() { 
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public RemoteAccessVpnVO(long accountId, long domainId, long networkId, long publicIpId, String localIp, String ipRange,  String presharedKey) {
+        this.accountId = accountId;
+        this.serverAddressId = publicIpId;
+        this.ipRange = ipRange;
+        this.ipsecPresharedKey = presharedKey;
+        this.localIp = localIp;
+        this.domainId = domainId;
+        this.networkId = networkId;
+        this.state = State.Added;
+        this.uuid = UUID.randomUUID().toString();
+    }
+    
+    @Override
+    public State getState() {
+        return state;
+    }
+    
+    public void setState(State state) {
+        this.state = state;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+    
+    @Override
+	public long getServerAddressId() {
+        return serverAddressId;
+    }
+
+    @Override
+    public String getIpRange() {
+		return ipRange;
+	}
+
+    public void setIpRange(String ipRange) {
+		this.ipRange = ipRange;
+	}
+
+	@Override
+    public String getIpsecPresharedKey() {
+		return ipsecPresharedKey;
+	}
+
+    public void setIpsecPresharedKey(String ipsecPresharedKey) {
+		this.ipsecPresharedKey = ipsecPresharedKey;
+	}
+
+	@Override
+    public String getLocalIp() {
+		return localIp;
+	}
+
+	@Override
+    public long getDomainId() {
+		return domainId;
+	}
+	
+	@Override
+    public long getNetworkId() {
+	    return networkId;
+	}
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public String getUuid() {
+        return uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/RouterNetworkDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/RouterNetworkDao.java b/engine/schema/src/com/cloud/network/dao/RouterNetworkDao.java
new file mode 100644
index 0000000..bd275bd
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/RouterNetworkDao.java
@@ -0,0 +1,26 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface RouterNetworkDao extends GenericDao<RouterNetworkVO, Long> {
+    public List<Long> getRouterNetworks(long routerId); 
+    public RouterNetworkVO findByRouterAndNetwork (long routerId, long networkId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/RouterNetworkDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/RouterNetworkDaoImpl.java b/engine/schema/src/com/cloud/network/dao/RouterNetworkDaoImpl.java
new file mode 100644
index 0000000..b0b633c
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/RouterNetworkDaoImpl.java
@@ -0,0 +1,62 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+public class RouterNetworkDaoImpl extends GenericDaoBase<RouterNetworkVO, Long> implements RouterNetworkDao {
+    protected final GenericSearchBuilder<RouterNetworkVO, Long> RouterNetworksSearch;
+    protected final SearchBuilder<RouterNetworkVO> AllFieldsSearch;
+
+    public RouterNetworkDaoImpl() {
+        super();
+
+        RouterNetworksSearch = createSearchBuilder(Long.class);
+        RouterNetworksSearch.selectField(RouterNetworksSearch.entity().getNetworkId());
+        RouterNetworksSearch.and("routerId", RouterNetworksSearch.entity().getRouterId(), Op.EQ);
+        RouterNetworksSearch.done();
+        
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("routerId", AllFieldsSearch.entity().getRouterId(), Op.EQ);
+        AllFieldsSearch.and("networkId", AllFieldsSearch.entity().getNetworkId(), Op.EQ);
+        AllFieldsSearch.done();
+    }
+    
+    public List<Long> getRouterNetworks(long routerId) {
+        SearchCriteria<Long> sc = RouterNetworksSearch.create();
+        sc.setParameters("routerId", routerId);
+        return customSearch(sc, null);
+    }
+    
+    public RouterNetworkVO findByRouterAndNetwork (long routerId, long networkId) {
+        SearchCriteria<RouterNetworkVO> sc = AllFieldsSearch.create();
+        sc.setParameters("routerId", routerId);
+        sc.setParameters("networkId", networkId);
+        return findOneBy(sc);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/RouterNetworkVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/RouterNetworkVO.java b/engine/schema/src/com/cloud/network/dao/RouterNetworkVO.java
new file mode 100644
index 0000000..c4fe9a5
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/RouterNetworkVO.java
@@ -0,0 +1,75 @@
+// 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.network.dao;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.network.Network;
+import com.cloud.network.Network.GuestType;
+import org.apache.cloudstack.api.InternalIdentity;
+
+
+@Entity
+@Table(name="router_network_ref")
+public class RouterNetworkVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    long id;
+    
+    @Column(name="router_id")
+    long routerId;
+    
+    @Column(name="network_id")
+    long networkId;
+    
+    @Column(name="guest_type")
+    @Enumerated(value=EnumType.STRING)
+    Network.GuestType guestType;
+
+    protected RouterNetworkVO() {
+    }
+    
+    public RouterNetworkVO(long routerId, long networkId, GuestType guestType) {
+        this.networkId = networkId;
+        this.routerId = routerId;
+        this.guestType = guestType;
+    }
+    
+    
+    public long getRouterId() {
+        return routerId;
+    }
+    
+    public long getNetworkId() {
+        return networkId;
+    }
+
+    public Network.GuestType getGuestType() {
+        return guestType;
+    }
+
+    public long getId() {
+        return id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java b/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java
new file mode 100644
index 0000000..20ef12d
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java
@@ -0,0 +1,27 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface Site2SiteCustomerGatewayDao extends GenericDao<Site2SiteCustomerGatewayVO, Long> {
+    Site2SiteCustomerGatewayVO findByGatewayIp(String ip);
+    Site2SiteCustomerGatewayVO findByNameAndAccountId(String name, long accountId);
+    List<Site2SiteCustomerGatewayVO> listByAccountId(long accountId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java b/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java
new file mode 100644
index 0000000..fcb533a
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java
@@ -0,0 +1,66 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value={Site2SiteCustomerGatewayDao.class})
+public class Site2SiteCustomerGatewayDaoImpl extends GenericDaoBase<Site2SiteCustomerGatewayVO, Long> implements Site2SiteCustomerGatewayDao {
+    private static final Logger s_logger = Logger.getLogger(Site2SiteCustomerGatewayDaoImpl.class);
+    
+    private final SearchBuilder<Site2SiteCustomerGatewayVO> AllFieldsSearch;
+
+    protected Site2SiteCustomerGatewayDaoImpl() {
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("gatewayIp", AllFieldsSearch.entity().getGatewayIp(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("name", AllFieldsSearch.entity().getName(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+    }
+    
+    @Override
+    public Site2SiteCustomerGatewayVO findByGatewayIp(String ip) {
+        SearchCriteria<Site2SiteCustomerGatewayVO> sc = AllFieldsSearch.create();
+        sc.setParameters("gatewayIp", ip);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public Site2SiteCustomerGatewayVO findByNameAndAccountId(String name, long accountId) {
+        SearchCriteria<Site2SiteCustomerGatewayVO> sc = AllFieldsSearch.create();
+        sc.setParameters("name", name);
+        sc.setParameters("accountId", accountId);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public List<Site2SiteCustomerGatewayVO> listByAccountId(long accountId) {
+        SearchCriteria<Site2SiteCustomerGatewayVO> sc = AllFieldsSearch.create();
+        sc.setParameters("accountId", accountId);
+        return listBy(sc, null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayVO.java b/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayVO.java
new file mode 100644
index 0000000..80130ef
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/Site2SiteCustomerGatewayVO.java
@@ -0,0 +1,206 @@
+// 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.network.dao;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.network.Site2SiteCustomerGateway;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name=("s2s_customer_gateway"))
+public class Site2SiteCustomerGatewayVO implements Site2SiteCustomerGateway {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    @Column(name="name")
+    private String name;
+
+    @Column(name="gateway_ip")
+    private String gatewayIp;
+
+    @Column(name="guest_cidr_list")
+    private String guestCidrList;
+
+    @Column(name="ipsec_psk")
+    private String ipsecPsk;
+
+    @Column(name="ike_policy")
+    private String ikePolicy;
+
+    @Column(name="esp_policy")
+    private String espPolicy;
+
+    @Column(name="ike_lifetime")
+    private long ikeLifetime;
+
+    @Column(name="esp_lifetime")
+    private long espLifetime;
+
+    @Column(name="dpd")
+    private boolean dpd;
+
+    @Column(name="domain_id")
+    private Long domainId;
+    
+    @Column(name="account_id")
+    private Long accountId;
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+
+    public Site2SiteCustomerGatewayVO() { }
+
+    public Site2SiteCustomerGatewayVO(String name, long accountId, long domainId, String gatewayIp, String guestCidrList, String ipsecPsk, String ikePolicy, String espPolicy,
+            long ikeLifetime, long espLifetime, boolean dpd) {
+        this.name = name;
+        this.gatewayIp = gatewayIp;
+        this.guestCidrList = guestCidrList;
+        this.ipsecPsk = ipsecPsk;
+        this.ikePolicy = ikePolicy;
+        this.espPolicy = espPolicy;
+        this.ikeLifetime = ikeLifetime;
+        this.espLifetime = espLifetime;
+        this.dpd = dpd;
+        this.uuid = UUID.randomUUID().toString();
+        this.accountId = accountId;
+        this.domainId = domainId;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String getGatewayIp() {
+        return gatewayIp;
+    }
+
+    public void setGatewayIp(String gatewayIp) {
+        this.gatewayIp = gatewayIp;
+    }
+
+    @Override
+    public String getGuestCidrList() {
+        return guestCidrList;
+    }
+
+    public void setGuestCidrList(String guestCidrList) {
+        this.guestCidrList = guestCidrList;
+    }
+
+    @Override
+    public String getIpsecPsk() {
+        return ipsecPsk;
+    }
+
+    public void setIpsecPsk(String ipsecPsk) {
+        this.ipsecPsk = ipsecPsk;
+    }
+
+    @Override
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public void setRemoved(Date removed) {
+        this.removed = removed;
+    }
+
+    @Override
+    public Long getIkeLifetime() {
+        return ikeLifetime;
+    }
+
+    public void setIkeLifetime(long ikeLifetime) {
+        this.ikeLifetime = ikeLifetime;
+    }
+
+    @Override
+    public Long getEspLifetime() {
+        return espLifetime;
+    }
+
+    public void setEspLifetime(long espLifetime) {
+        this.espLifetime = espLifetime;
+    }
+
+    @Override
+    public String getIkePolicy() {
+        return ikePolicy;
+    }
+
+    public void setIkePolicy(String ikePolicy) {
+        this.ikePolicy = ikePolicy;
+    }
+
+    @Override
+    public String getEspPolicy() {
+        return espPolicy;
+    }
+
+    public void setEspPolicy(String espPolicy) {
+        this.espPolicy = espPolicy;
+    }
+
+    @Override
+    public Boolean getDpd() {
+        return dpd;
+    }
+
+    public void setDpd(boolean dpd) {
+        this.dpd = dpd;
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+    
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionDao.java b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionDao.java
new file mode 100644
index 0000000..66d5a4a
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionDao.java
@@ -0,0 +1,29 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface Site2SiteVpnConnectionDao extends GenericDao<Site2SiteVpnConnectionVO, Long> {
+    List<Site2SiteVpnConnectionVO> listByCustomerGatewayId(long id);
+    List<Site2SiteVpnConnectionVO> listByVpnGatewayId(long id);
+    List<Site2SiteVpnConnectionVO> listByVpcId(long vpcId);
+    Site2SiteVpnConnectionVO findByVpnGatewayIdAndCustomerGatewayId(long vpnId, long customerId);
+    Site2SiteVpnConnectionVO findByCustomerGatewayId(long customerId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionDaoImpl.java b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionDaoImpl.java
new file mode 100644
index 0000000..4745f9a
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionDaoImpl.java
@@ -0,0 +1,97 @@
+// 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.network.dao;
+
+import java.util.List;
+
+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.utils.db.GenericDaoBase;
+import com.cloud.utils.db.JoinBuilder.JoinType;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value={Site2SiteVpnConnectionDao.class})
+public class Site2SiteVpnConnectionDaoImpl extends GenericDaoBase<Site2SiteVpnConnectionVO, Long> implements Site2SiteVpnConnectionDao {
+    private static final Logger s_logger = Logger.getLogger(Site2SiteVpnConnectionDaoImpl.class);
+
+    @Inject protected IPAddressDao _addrDao;
+    @Inject protected Site2SiteVpnGatewayDao _vpnGatewayDao;
+
+    private SearchBuilder<Site2SiteVpnConnectionVO> AllFieldsSearch;
+    private SearchBuilder<Site2SiteVpnConnectionVO> VpcSearch;
+    private SearchBuilder<Site2SiteVpnGatewayVO> VpnGatewaySearch;
+
+    public Site2SiteVpnConnectionDaoImpl() {
+    }
+
+    @PostConstruct
+    protected void init() {
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("customerGatewayId", AllFieldsSearch.entity().getCustomerGatewayId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("vpnGatewayId", AllFieldsSearch.entity().getVpnGatewayId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+
+        VpcSearch = createSearchBuilder();
+        VpnGatewaySearch = _vpnGatewayDao.createSearchBuilder();
+        VpnGatewaySearch.and("vpcId", VpnGatewaySearch.entity().getVpcId(), SearchCriteria.Op.EQ);
+        VpcSearch.join("vpnGatewaySearch", VpnGatewaySearch, VpnGatewaySearch.entity().getId(), VpcSearch.entity().getVpnGatewayId(), JoinType.INNER);
+        VpcSearch.done();
+    }
+
+    @Override
+    public List<Site2SiteVpnConnectionVO> listByCustomerGatewayId(long id) {
+        SearchCriteria<Site2SiteVpnConnectionVO> sc = AllFieldsSearch.create();
+        sc.setParameters("customerGatewayId", id);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<Site2SiteVpnConnectionVO> listByVpnGatewayId(long id) {
+        SearchCriteria<Site2SiteVpnConnectionVO> sc = AllFieldsSearch.create();
+        sc.setParameters("vpnGatewayId", id);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<Site2SiteVpnConnectionVO> listByVpcId(long vpcId) {
+        SearchCriteria<Site2SiteVpnConnectionVO> sc = VpcSearch.create();
+        sc.setJoinParameters("vpnGatewaySearch", "vpcId", vpcId);
+        return listBy(sc);
+    }
+
+    @Override
+    public Site2SiteVpnConnectionVO findByVpnGatewayIdAndCustomerGatewayId(long vpnId, long customerId) {
+        SearchCriteria<Site2SiteVpnConnectionVO> sc = AllFieldsSearch.create();
+        sc.setParameters("vpnGatewayId", vpnId);
+        sc.setParameters("customerGatewayId", customerId);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public Site2SiteVpnConnectionVO findByCustomerGatewayId(long customerId) {
+        SearchCriteria<Site2SiteVpnConnectionVO> sc = AllFieldsSearch.create();
+        sc.setParameters("customerGatewayId", customerId);
+        return findOneBy(sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java
new file mode 100644
index 0000000..f8eeb8a
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java
@@ -0,0 +1,143 @@
+// 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.network.dao;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.network.Site2SiteVpnConnection;
+import com.cloud.network.Site2SiteVpnConnection.State;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name=("s2s_vpn_connection"))
+public class Site2SiteVpnConnectionVO implements Site2SiteVpnConnection, InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+	@Column(name="uuid")
+	private String uuid;    
+    
+    @Column(name="vpn_gateway_id")
+    private long vpnGatewayId;
+    
+    @Column(name="customer_gateway_id")
+    private long customerGatewayId;
+
+    @Column(name="state")
+    @Enumerated(value=EnumType.STRING)
+    private State state;
+    
+    @Column(name="domain_id")
+    private Long domainId;
+    
+    @Column(name="account_id")
+    private Long accountId;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    private Date created;
+    
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+    
+    public Site2SiteVpnConnectionVO() { }
+
+    public Site2SiteVpnConnectionVO(long accountId, long domainId, long vpnGatewayId, long customerGatewayId) {
+        this.uuid = UUID.randomUUID().toString();
+        this.setVpnGatewayId(vpnGatewayId);
+        this.setCustomerGatewayId(customerGatewayId);
+        this.setState(State.Pending);
+        this.accountId = accountId;
+        this.domainId = domainId;
+    }
+    
+    @Override
+    public long getId() {
+        return id;
+    }
+    
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    public void setState(State state) {
+        this.state = state;
+    }
+
+    @Override
+    public long getVpnGatewayId() {
+        return vpnGatewayId;
+    }
+
+    public void setVpnGatewayId(long vpnGatewayId) {
+        this.vpnGatewayId = vpnGatewayId;
+    }
+
+    @Override
+    public long getCustomerGatewayId() {
+        return customerGatewayId;
+    }
+
+    public void setCustomerGatewayId(long customerGatewayId) {
+        this.customerGatewayId = customerGatewayId;
+    }
+
+    @Override
+    public Date getCreated() {
+        return created;
+    }
+
+    public void setCreated(Date created) {
+        this.created = created;
+    }
+
+    @Override
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public void setRemoved(Date removed) {
+        this.removed = removed;
+    }
+    
+    public String getUuid() {
+        return uuid;
+    }
+    
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayDao.java b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayDao.java
new file mode 100644
index 0000000..9b393e6
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayDao.java
@@ -0,0 +1,23 @@
+// 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.network.dao;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface Site2SiteVpnGatewayDao extends GenericDao<Site2SiteVpnGatewayVO, Long> {
+    Site2SiteVpnGatewayVO findByVpcId(long vpcId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayDaoImpl.java b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayDaoImpl.java
new file mode 100644
index 0000000..fa4a9fa
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayDaoImpl.java
@@ -0,0 +1,50 @@
+// 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.network.dao;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value={Site2SiteVpnGatewayDao.class})
+public class Site2SiteVpnGatewayDaoImpl extends GenericDaoBase<Site2SiteVpnGatewayVO, Long> implements Site2SiteVpnGatewayDao {
+    @Inject protected IPAddressDao _addrDao;
+
+    private static final Logger s_logger = Logger.getLogger(Site2SiteVpnGatewayDaoImpl.class);
+
+    private final SearchBuilder<Site2SiteVpnGatewayVO> AllFieldsSearch;
+
+    protected Site2SiteVpnGatewayDaoImpl() {
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("vpcId", AllFieldsSearch.entity().getVpcId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+    }
+
+    @Override
+    public Site2SiteVpnGatewayVO findByVpcId(long vpcId) {
+        SearchCriteria<Site2SiteVpnGatewayVO> sc = AllFieldsSearch.create();
+        sc.setParameters("vpcId", vpcId);
+        return findOneBy(sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java
new file mode 100644
index 0000000..1e12971
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java
@@ -0,0 +1,114 @@
+// 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.network.dao;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.network.Site2SiteVpnGateway;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name=("s2s_vpn_gateway"))
+public class Site2SiteVpnGatewayVO implements Site2SiteVpnGateway {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+	@Column(name="uuid")
+	private String uuid;    
+    
+    @Column(name="addr_id")
+    private long addrId;
+
+    @Column(name="vpc_id")
+    private long vpcId;
+
+    @Column(name="domain_id")
+    private Long domainId;
+    
+    @Column(name="account_id")
+    private Long accountId;
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+    
+    public Site2SiteVpnGatewayVO() { }
+
+    public Site2SiteVpnGatewayVO(long accountId, long domainId, long addrId, long vpcId) {
+        this.uuid = UUID.randomUUID().toString();
+        this.setAddrId(addrId);
+        this.setVpcId(vpcId);
+        this.accountId = accountId;
+        this.domainId = domainId;
+    }
+    
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public long getVpcId() {
+        return vpcId;
+    }
+    
+    public void setVpcId(long vpcId) {
+        this.vpcId = vpcId;
+    }
+
+    @Override
+    public long getAddrId() {
+        return addrId;
+    }
+
+    public void setAddrId(long addrId) {
+        this.addrId = addrId;
+    }
+
+    @Override
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public void setRemoved(Date removed) {
+        this.removed = removed;
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+    
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/UserIpv6AddressDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/UserIpv6AddressDao.java b/engine/schema/src/com/cloud/network/dao/UserIpv6AddressDao.java
new file mode 100644
index 0000000..555b7f6
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/UserIpv6AddressDao.java
@@ -0,0 +1,41 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.network.Network;
+import com.cloud.network.UserIpv6AddressVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface UserIpv6AddressDao extends GenericDao<UserIpv6AddressVO, Long> {
+	List<UserIpv6AddressVO> listByAccount(long accountId);
+	
+	List<UserIpv6AddressVO> listByVlanId(long vlanId);
+	
+	List<UserIpv6AddressVO> listByDcId(long dcId); 
+	
+	List<UserIpv6AddressVO> listByNetwork(long networkId);
+	
+	public UserIpv6AddressVO findByNetworkIdAndIp(long networkId, String ipAddress);
+
+	List<UserIpv6AddressVO> listByPhysicalNetworkId(long physicalNetworkId);
+
+	long countExistedIpsInNetwork(long networkId);
+
+	long countExistedIpsInVlan(long vlanId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/UserIpv6AddressDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/UserIpv6AddressDaoImpl.java b/engine/schema/src/com/cloud/network/dao/UserIpv6AddressDaoImpl.java
new file mode 100644
index 0000000..c9f38ec
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/UserIpv6AddressDaoImpl.java
@@ -0,0 +1,122 @@
+// 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.network.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.Network;
+import com.cloud.network.UserIpv6AddressVO;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.SearchCriteria2;
+
+@Component
+@Local(value=UserIpv6AddressDao.class)
+public class UserIpv6AddressDaoImpl extends GenericDaoBase<UserIpv6AddressVO, Long> implements UserIpv6AddressDao {
+    private static final Logger s_logger = Logger.getLogger(IPAddressDaoImpl.class);
+
+    protected final SearchBuilder<UserIpv6AddressVO> AllFieldsSearch;
+    protected GenericSearchBuilder<UserIpv6AddressVO, Long> CountFreePublicIps;
+    
+    public UserIpv6AddressDaoImpl() {
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ);
+        AllFieldsSearch.and("dataCenterId", AllFieldsSearch.entity().getDataCenterId(), Op.EQ);
+        AllFieldsSearch.and("ipAddress", AllFieldsSearch.entity().getAddress(), Op.EQ);
+        AllFieldsSearch.and("vlan", AllFieldsSearch.entity().getVlanId(), Op.EQ);
+        AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), Op.EQ);
+        AllFieldsSearch.and("network", AllFieldsSearch.entity().getNetworkId(), Op.EQ);
+        AllFieldsSearch.and("physicalNetworkId", AllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        AllFieldsSearch.done();
+        
+        CountFreePublicIps = createSearchBuilder(Long.class);
+        CountFreePublicIps.select(null, Func.COUNT, null);
+        CountFreePublicIps.and("networkId", CountFreePublicIps.entity().getSourceNetworkId(), SearchCriteria.Op.EQ);
+        CountFreePublicIps.and("vlanId", CountFreePublicIps.entity().getVlanId(), SearchCriteria.Op.EQ);
+        CountFreePublicIps.done();
+    }
+
+	@Override
+	public List<UserIpv6AddressVO> listByAccount(long accountId) {
+        SearchCriteria<UserIpv6AddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("accountId", accountId);
+        return listBy(sc);
+	}
+
+	@Override
+	public List<UserIpv6AddressVO> listByVlanId(long vlanId) {
+        SearchCriteria<UserIpv6AddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("vlan", vlanId);
+        return listBy(sc);
+	}
+
+	@Override
+	public List<UserIpv6AddressVO> listByDcId(long dcId) {
+        SearchCriteria<UserIpv6AddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("dataCenterId", dcId);
+        return listBy(sc);
+	}
+
+	@Override
+	public List<UserIpv6AddressVO> listByNetwork(long networkId) {
+        SearchCriteria<UserIpv6AddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("network", networkId);
+        return listBy(sc);
+	}
+
+	@Override
+	public UserIpv6AddressVO findByNetworkIdAndIp(long networkId, String ipAddress) {
+        SearchCriteria<UserIpv6AddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("networkId", networkId);
+        sc.setParameters("ipAddress", ipAddress);
+        return findOneBy(sc);
+	}
+
+	@Override
+	public List<UserIpv6AddressVO> listByPhysicalNetworkId(long physicalNetworkId) {
+        SearchCriteria<UserIpv6AddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        return listBy(sc);
+	}
+
+	@Override
+	public long countExistedIpsInNetwork(long networkId) {
+        SearchCriteria<Long> sc = CountFreePublicIps.create();
+        sc.setParameters("networkId", networkId);
+        return customSearch(sc, null).get(0);       
+	}
+
+	@Override
+	public long countExistedIpsInVlan(long vlanId) {
+        SearchCriteria<Long> sc = CountFreePublicIps.create();
+        sc.setParameters("vlanId", vlanId);
+        return customSearch(sc, null).get(0);       
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/VirtualRouterProviderDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/VirtualRouterProviderDao.java b/engine/schema/src/com/cloud/network/dao/VirtualRouterProviderDao.java
new file mode 100644
index 0000000..d929293
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/VirtualRouterProviderDao.java
@@ -0,0 +1,31 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.network.VirtualRouterProvider;
+import com.cloud.network.element.VirtualRouterProviderVO;
+import com.cloud.network.VirtualRouterProvider.VirtualRouterProviderType;
+import com.cloud.utils.db.GenericDao;
+
+public interface VirtualRouterProviderDao extends GenericDao<VirtualRouterProviderVO, Long> {
+    public VirtualRouterProviderVO findByNspIdAndType(long nspId, VirtualRouterProviderType type);
+    public List<VirtualRouterProviderVO> listByEnabledAndType(boolean enabled, VirtualRouterProviderType type);
+    public VirtualRouterProviderVO findByIdAndEnabledAndType(long id, boolean enabled, VirtualRouterProviderType type);
+    public List<VirtualRouterProviderVO> listByType(VirtualRouterProviderType type);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/VirtualRouterProviderDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/VirtualRouterProviderDaoImpl.java b/engine/schema/src/com/cloud/network/dao/VirtualRouterProviderDaoImpl.java
new file mode 100644
index 0000000..dba835f
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/VirtualRouterProviderDaoImpl.java
@@ -0,0 +1,79 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.element.VirtualRouterProviderVO;
+import com.cloud.network.VirtualRouterProvider.VirtualRouterProviderType;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value=VirtualRouterProviderDao.class) @DB(txn=false)
+public class VirtualRouterProviderDaoImpl extends GenericDaoBase<VirtualRouterProviderVO, Long> implements VirtualRouterProviderDao {
+    final SearchBuilder<VirtualRouterProviderVO> AllFieldsSearch;
+    
+    public VirtualRouterProviderDaoImpl() {
+        super();
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("nsp_id", AllFieldsSearch.entity().getNspId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("uuid", AllFieldsSearch.entity().getUuid(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("type", AllFieldsSearch.entity().getType(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("enabled", AllFieldsSearch.entity().isEnabled(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+    }
+
+    @Override
+    public VirtualRouterProviderVO findByNspIdAndType(long nspId, VirtualRouterProviderType type) {
+        SearchCriteria<VirtualRouterProviderVO> sc = AllFieldsSearch.create();
+        sc.setParameters("nsp_id", nspId);
+        sc.setParameters("type", type);
+        return findOneBy(sc);
+    }
+    
+    @Override
+    public List<VirtualRouterProviderVO> listByEnabledAndType(boolean enabled, VirtualRouterProviderType type) {
+        SearchCriteria<VirtualRouterProviderVO> sc = AllFieldsSearch.create();
+        sc.setParameters("enabled", enabled);
+        sc.setParameters("type", type);
+        return listBy(sc);
+    }
+    
+    @Override
+    public VirtualRouterProviderVO findByIdAndEnabledAndType(long id, boolean enabled, VirtualRouterProviderType type) {
+        SearchCriteria<VirtualRouterProviderVO> sc = AllFieldsSearch.create();
+        sc.setParameters("id", id);
+        sc.setParameters("enabled", enabled);
+        sc.setParameters("type", type);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public List<VirtualRouterProviderVO> listByType(VirtualRouterProviderType type) {
+        SearchCriteria<VirtualRouterProviderVO> sc = AllFieldsSearch.create();
+        sc.setParameters("type", type);
+        return listBy(sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/VpnUserDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/VpnUserDao.java b/engine/schema/src/com/cloud/network/dao/VpnUserDao.java
new file mode 100644
index 0000000..8ba742a
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/VpnUserDao.java
@@ -0,0 +1,28 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.network.VpnUserVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface VpnUserDao extends GenericDao<VpnUserVO, Long> {
+    List<VpnUserVO> listByAccount(Long accountId);
+    VpnUserVO findByAccountAndUsername(Long acccountId, String userName);
+    long getVpnUserCount(Long accountId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/VpnUserDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/VpnUserDaoImpl.java b/engine/schema/src/com/cloud/network/dao/VpnUserDaoImpl.java
new file mode 100644
index 0000000..cd3de79
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/VpnUserDaoImpl.java
@@ -0,0 +1,87 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.VpnUser.State;
+import com.cloud.network.VpnUserVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
+
+@Component
+@Local(value={VpnUserDao.class})
+public class VpnUserDaoImpl extends GenericDaoBase<VpnUserVO, Long> implements VpnUserDao {
+    private final SearchBuilder<VpnUserVO> AccountSearch;
+    private final SearchBuilder<VpnUserVO> AccountNameSearch;
+    private final GenericSearchBuilder<VpnUserVO, Long> VpnUserCount;
+
+
+    protected VpnUserDaoImpl() {
+
+        AccountSearch = createSearchBuilder();
+        AccountSearch.and("accountId", AccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AccountSearch.done();
+        
+        AccountNameSearch = createSearchBuilder();
+        AccountNameSearch.and("accountId", AccountNameSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AccountNameSearch.and("username", AccountNameSearch.entity().getUsername(), SearchCriteria.Op.EQ);
+        AccountNameSearch.done();
+        
+        VpnUserCount = createSearchBuilder(Long.class);
+        VpnUserCount.and("accountId", VpnUserCount.entity().getAccountId(), SearchCriteria.Op.EQ);
+        VpnUserCount.and("state", VpnUserCount.entity().getState(), SearchCriteria.Op.NEQ);
+        VpnUserCount.select(null, Func.COUNT, null);
+        VpnUserCount.done();
+    }
+
+    @Override
+    public List<VpnUserVO> listByAccount(Long accountId) {
+        SearchCriteria<VpnUserVO> sc = AccountSearch.create();
+        sc.setParameters("accountId", accountId);
+        return listBy(sc);
+    }
+
+	@Override
+	public VpnUserVO findByAccountAndUsername(Long accountId, String userName) {
+		SearchCriteria<VpnUserVO> sc = AccountNameSearch.create();
+        sc.setParameters("accountId", accountId);
+        sc.setParameters("username", userName);
+
+        return findOneBy(sc);
+	}
+
+	@Override
+	public long getVpnUserCount(Long accountId) {
+		SearchCriteria<Long> sc = VpnUserCount.create();
+		sc.setParameters("accountId", accountId);
+		sc.setParameters("state", State.Revoke);
+		List<Long> rs = customSearch(sc, null);
+		if (rs.size() == 0) {
+            return 0;
+        }
+        
+        return rs.get(0);
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/element/VirtualRouterProviderVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/element/VirtualRouterProviderVO.java b/engine/schema/src/com/cloud/network/element/VirtualRouterProviderVO.java
new file mode 100644
index 0000000..ff2b621
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/element/VirtualRouterProviderVO.java
@@ -0,0 +1,120 @@
+// 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.network.element;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.network.VirtualRouterProvider;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name=("virtual_router_providers"))
+public class VirtualRouterProviderVO implements VirtualRouterProvider {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+    
+    @Column(name="type")
+    @Enumerated(EnumType.STRING)
+    private VirtualRouterProviderType type;
+    
+    @Column(name="enabled")
+    private boolean enabled;
+    
+    @Column(name="nsp_id")
+    private long nspId;
+    
+    @Column(name="uuid")
+    private String uuid;
+    
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    Date removed;
+
+    public VirtualRouterProviderVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+    
+    public VirtualRouterProviderVO(long nspId, VirtualRouterProviderType type) {
+        this.nspId = nspId;
+        this.type = type;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    @Override
+    public long getNspId() {
+        return nspId;
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public VirtualRouterProviderType getType() {
+        return this.type;
+    }
+    
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public void setRemoved(Date removed) {
+        this.removed = removed;
+    }
+
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    @Override
+    public boolean isEnabled() {
+        return this.enabled;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public void setType(VirtualRouterProviderType type) {
+        this.type = type;
+    }
+
+    public void setNspId(long nspId) {
+        this.nspId = nspId;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/rules/FirewallRuleVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/rules/FirewallRuleVO.java b/engine/schema/src/com/cloud/network/rules/FirewallRuleVO.java
new file mode 100644
index 0000000..9f73029
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/rules/FirewallRuleVO.java
@@ -0,0 +1,268 @@
+// 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.network.rules;
+
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.DiscriminatorType;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.net.NetUtils;
+
+@Entity
+@Table(name="firewall_rules")
+@Inheritance(strategy=InheritanceType.JOINED)
+@DiscriminatorColumn(name="purpose", discriminatorType=DiscriminatorType.STRING, length=32)
+public class FirewallRuleVO implements FirewallRule {
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+
+    @GeneratedValue(strategy=GenerationType.AUTO)
+    @Column(name=GenericDao.XID_COLUMN)
+    String xId;
+
+    @Column(name="domain_id", updatable=false)
+    long domainId;
+
+    @Column(name="account_id", updatable=false)
+    long accountId;
+
+    @Column(name="ip_address_id", updatable=false)
+    Long sourceIpAddressId;
+
+    @Column(name="start_port", updatable=false)
+    Integer sourcePortStart;
+
+    @Column(name="end_port", updatable=false)
+    Integer sourcePortEnd;
+
+    @Column(name="protocol", updatable=false)
+    String protocol = NetUtils.TCP_PROTO;
+
+    @Enumerated(value=EnumType.STRING)
+    @Column(name="purpose")
+    Purpose purpose;
+
+    @Enumerated(value=EnumType.STRING)
+    @Column(name="state")
+    State state;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    Date created;
+
+    @Column(name="network_id")
+    Long networkId;
+
+    @Column(name="icmp_code")
+    Integer icmpCode;
+
+    @Column(name="icmp_type")
+    Integer icmpType;
+
+
+    @Column(name="related")
+    Long related;
+
+    @Column(name="type")
+    @Enumerated(value=EnumType.STRING)
+    FirewallRuleType type;
+
+    @Column(name="traffic_type")
+    @Enumerated(value=EnumType.STRING)
+    TrafficType trafficType;
+
+
+    // This is a delayed load value.  If the value is null,
+    // then this field has not been loaded yet.
+    // Call firewallrules dao to load it.
+    @Transient
+    List<String> sourceCidrs;
+
+    @Column(name="uuid")
+    String uuid;
+
+    public void setSourceCidrList(List<String> sourceCidrs) {
+        this.sourceCidrs=sourceCidrs;
+    }
+
+    @Override
+    public List<String> getSourceCidrList() {
+        return sourceCidrs;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public String getXid() {
+        return xId;
+    }
+
+    @Override
+    public Long getSourceIpAddressId() {
+        return sourceIpAddressId;
+    }
+
+    @Override
+    public Integer getSourcePortStart() {
+        return sourcePortStart;
+    }
+
+    @Override
+    public Integer getSourcePortEnd() {
+        return sourcePortEnd;
+    }
+
+    @Override
+    public String getProtocol() {
+        return protocol;
+    }
+
+    public void setState(State state) {
+        this.state = state;
+    }
+
+    @Override
+    public Purpose getPurpose() {
+        return purpose;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    @Override
+    public long getNetworkId() {
+        return networkId;
+    }
+
+    @Override
+    public FirewallRuleType getType() {
+        return type;
+    }
+    public Date getCreated() {
+        return created;
+    }
+
+    protected FirewallRuleVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public FirewallRuleVO(String xId, Long ipAddressId, Integer portStart, Integer portEnd, String protocol, 
+            long networkId, long accountId, long domainId, Purpose purpose, List<String> sourceCidrs, Integer icmpCode,
+            Integer icmpType, Long related, TrafficType trafficType) {
+        this.xId = xId;
+        if (xId == null) {
+            this.xId = UUID.randomUUID().toString();
+        }
+        this.accountId = accountId;
+        this.domainId = domainId;
+        this.sourceIpAddressId = ipAddressId;
+        this.sourcePortStart = portStart;
+        this.sourcePortEnd = portEnd;
+        this.protocol = protocol;
+        this.purpose = purpose;
+        this.networkId = networkId;
+        this.state = State.Staged;
+        this.icmpCode = icmpCode;
+        this.icmpType = icmpType;
+        this.sourceCidrs = sourceCidrs;
+
+        if (related != null) {
+            assert (purpose == Purpose.Firewall) : "related field can be set for rule of purpose " + Purpose.Firewall + " only";
+        }
+
+        this.related = related;
+        this.uuid = UUID.randomUUID().toString();
+        this.type = FirewallRuleType.User;
+        this.trafficType = trafficType;
+    }
+
+
+    public FirewallRuleVO(String xId, long ipAddressId, int port, String protocol, long networkId, long accountId, 
+            long domainId, Purpose purpose, List<String> sourceCidrs, Integer icmpCode, Integer icmpType, Long related) {
+        this(xId, ipAddressId, port, port, protocol, networkId, accountId, domainId, purpose, sourceCidrs, icmpCode, icmpType, related, null);
+    }
+
+    @Override
+    public String toString() {
+        return new StringBuilder("Rule[").append(id).append("-").append(purpose).append("-").append(state).append("]").toString();
+    }
+
+    @Override
+    public Integer getIcmpCode() {
+        return icmpCode;
+    }
+
+    @Override
+    public Integer getIcmpType() {
+        return icmpType;
+    }
+
+    @Override
+    public Long getRelated() {
+        return related;
+    }
+
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    public void setType(FirewallRuleType type) {
+        this.type = type;
+    }
+
+    @Override
+    public TrafficType getTrafficType() {
+        return trafficType;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/rules/PortForwardingRuleVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/rules/PortForwardingRuleVO.java b/engine/schema/src/com/cloud/network/rules/PortForwardingRuleVO.java
new file mode 100644
index 0000000..0bd78ff
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/rules/PortForwardingRuleVO.java
@@ -0,0 +1,96 @@
+// 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.network.rules;
+
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+
+import com.cloud.utils.net.Ip;
+
+@Entity
+@Table(name=("port_forwarding_rules"))
+@DiscriminatorValue(value="PortForwarding")
+@PrimaryKeyJoinColumn(name="id")
+public class PortForwardingRuleVO extends FirewallRuleVO implements PortForwardingRule {
+
+    @Enumerated(value=EnumType.STRING)
+    @Column(name="dest_ip_address")
+    private Ip destinationIpAddress = null;
+
+    @Column(name="dest_port_start")
+    private int destinationPortStart;
+    
+    @Column(name="dest_port_end")
+    private int destinationPortEnd;
+    
+    @Column(name="instance_id")
+    private long virtualMachineId;
+    
+    public PortForwardingRuleVO() {
+    }
+
+    public PortForwardingRuleVO(String xId, long srcIpId, int srcPortStart, int srcPortEnd, Ip dstIp, int dstPortStart, int dstPortEnd, String protocol, long networkId, long accountId, long domainId, long instanceId) {
+        super(xId, srcIpId, srcPortStart, srcPortEnd, protocol, networkId, accountId, domainId, Purpose.PortForwarding, null, null, null, null, null);
+        this.destinationIpAddress = dstIp;
+        this.virtualMachineId = instanceId;
+        this.destinationPortStart = dstPortStart;
+        this.destinationPortEnd = dstPortEnd;
+    }
+    
+    public PortForwardingRuleVO(String xId, long srcIpId, int srcPort, Ip dstIp, int dstPort, String protocol, List<String> sourceCidrs, long networkId, long accountId, long domainId, long instanceId) {
+        this(xId, srcIpId, srcPort, srcPort, dstIp, dstPort, dstPort, protocol.toLowerCase(), networkId, accountId, domainId, instanceId);
+    }
+
+    @Override
+    public Ip getDestinationIpAddress() {
+        return destinationIpAddress;
+    }
+    
+    @Override
+    public void setDestinationIpAddress(Ip destinationIpAddress) {
+    	this.destinationIpAddress = destinationIpAddress;
+    }
+
+    @Override
+    public int getDestinationPortStart() {
+        return destinationPortStart;
+    }
+    
+    @Override
+    public int getDestinationPortEnd() {
+        return destinationPortEnd;
+    }
+    
+    @Override
+    public long getVirtualMachineId() {
+        return virtualMachineId;
+    }
+    
+    @Override
+    public Long getRelated() {
+        return null;
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/rules/dao/PortForwardingRulesDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/rules/dao/PortForwardingRulesDao.java b/engine/schema/src/com/cloud/network/rules/dao/PortForwardingRulesDao.java
new file mode 100644
index 0000000..682a941
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/rules/dao/PortForwardingRulesDao.java
@@ -0,0 +1,47 @@
+// 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.network.rules.dao;
+
+import java.util.List;
+
+import com.cloud.network.rules.PortForwardingRuleVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface PortForwardingRulesDao extends GenericDao<PortForwardingRuleVO, Long> {
+    List<PortForwardingRuleVO> listForApplication(long ipId);
+    
+    /**
+     * Find all port forwarding rules for the ip address that have not been revoked.
+     * 
+     * @param ip ip address 
+     * @return List of PortForwardingRuleVO
+     */
+    List<PortForwardingRuleVO> listByIpAndNotRevoked(long ipId);
+    
+    List<PortForwardingRuleVO> listByNetworkAndNotRevoked(long networkId);
+    
+    List<PortForwardingRuleVO> listByIp(long ipId);
+
+    List<PortForwardingRuleVO> listByVm(Long vmId);
+    
+    List<PortForwardingRuleVO> listByNetwork(long networkId);
+    
+    List<PortForwardingRuleVO> listByAccount(long accountId);
+
+    List<PortForwardingRuleVO> listByDestIpAddr(String ip4Address);
+    
+}


[46/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/baremetal/PreparePxeServerAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/baremetal/PreparePxeServerAnswer.java b/api/src/com/cloud/agent/api/baremetal/PreparePxeServerAnswer.java
deleted file mode 100644
index d8f0529..0000000
--- a/api/src/com/cloud/agent/api/baremetal/PreparePxeServerAnswer.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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.agent.api.baremetal;
-
-import com.cloud.agent.api.Answer;
-
-public class PreparePxeServerAnswer extends Answer {
-	public PreparePxeServerAnswer(PreparePxeServerCommand cmd) {
-		super(cmd, true, "SUCCESS");
-	}
-
-	public PreparePxeServerAnswer(PreparePxeServerCommand cmd, String details) {
-		super(cmd, false, details);
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/baremetal/PreparePxeServerCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/baremetal/PreparePxeServerCommand.java b/api/src/com/cloud/agent/api/baremetal/PreparePxeServerCommand.java
deleted file mode 100644
index 6c73563..0000000
--- a/api/src/com/cloud/agent/api/baremetal/PreparePxeServerCommand.java
+++ /dev/null
@@ -1,80 +0,0 @@
-// 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.agent.api.baremetal;
-
-import com.cloud.agent.api.Command;
-
-public class PreparePxeServerCommand extends Command {
-
-	String ip;
-	String mac;
-	String netMask;
-	String gateway;
-	String dns;
-	String template;
-	String vmName;
-	String hostName;
-
-	@Override
-	public boolean executeInSequence() {
-		return true;
-	}
-
-	public PreparePxeServerCommand(String ip, String mac, String netMask, String gateway, String dns, String template, String vmName, String hostName) {
-		this.ip = ip;
-		this.mac = mac;
-		this.netMask = netMask;
-		this.gateway = gateway;
-		this.dns = dns;
-		this.template = template;
-		this.vmName = vmName;
-		this.hostName = hostName;
-	}
-
-	public String getIp() {
-		return ip;
-	}
-
-	public String getMac() {
-		return mac;
-	}
-
-	public String getNetMask() {
-		return netMask;
-	}
-
-	public String getGateWay() {
-		return gateway;
-	}
-
-	public String getDns() {
-		return dns;
-	}
-
-	public String getTemplate() {
-		return template;
-	}
-
-	public String getVmName() {
-		return vmName;
-	}
-
-	public String getHostName() {
-		return hostName;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/baremetal/prepareCreateTemplateCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/baremetal/prepareCreateTemplateCommand.java b/api/src/com/cloud/agent/api/baremetal/prepareCreateTemplateCommand.java
deleted file mode 100644
index b187420..0000000
--- a/api/src/com/cloud/agent/api/baremetal/prepareCreateTemplateCommand.java
+++ /dev/null
@@ -1,66 +0,0 @@
-// 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.agent.api.baremetal;
-
-import com.cloud.agent.api.Command;
-
-public class prepareCreateTemplateCommand extends Command {
-    String ip;
-    String mac;
-    String netMask;
-    String gateway;
-    String dns;
-    String template;
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public prepareCreateTemplateCommand(String ip, String mac, String netMask, String gateway, String dns, String template) {
-        this.ip = ip;
-        this.mac = mac;
-        this.netMask = netMask;
-        this.gateway = gateway;
-        this.dns = dns;
-        this.template = template;
-    }
-
-    public String getIp() {
-        return ip;
-    }
-
-    public String getMac() {
-        return mac;
-    }
-
-    public String getNetMask() {
-        return netMask;
-    }
-
-    public String getGateWay() {
-        return gateway;
-    }
-
-    public String getDns() {
-        return dns;
-    }
-
-    public String getTemplate() {
-        return template;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/check/CheckSshAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/check/CheckSshAnswer.java b/api/src/com/cloud/agent/api/check/CheckSshAnswer.java
deleted file mode 100644
index 3414eb0..0000000
--- a/api/src/com/cloud/agent/api/check/CheckSshAnswer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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.agent.api.check;
-
-import com.cloud.agent.api.Answer;
-
-public class CheckSshAnswer extends Answer {
-    protected CheckSshAnswer() {
-
-    }
-
-    public CheckSshAnswer(CheckSshCommand cmd) {
-        super(cmd, true, null);
-    }
-
-    public CheckSshAnswer(CheckSshCommand cmd, String details) {
-        super(cmd, false, details);
-    }
-
-    public CheckSshAnswer(CheckSshCommand cmd, Throwable th) {
-        super(cmd, false, th.getMessage());
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/check/CheckSshCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/check/CheckSshCommand.java b/api/src/com/cloud/agent/api/check/CheckSshCommand.java
deleted file mode 100644
index e384983..0000000
--- a/api/src/com/cloud/agent/api/check/CheckSshCommand.java
+++ /dev/null
@@ -1,65 +0,0 @@
-// 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.agent.api.check;
-
-import com.cloud.agent.api.Command;
-
-public class CheckSshCommand extends Command {
-    String ip;
-    int port;
-    int interval;
-    int retries;
-    String name;
-
-    protected CheckSshCommand() {
-        super();
-    }
-
-    public CheckSshCommand(String instanceName, String ip, int port) {
-        super();
-        this.ip = ip;
-        this.port = port;
-        this.interval = 6;
-        this.retries = 100;
-        this.name = instanceName;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public String getIp() {
-        return ip;
-    }
-
-    public int getPort() {
-        return port;
-    }
-
-    public int getInterval() {
-        return interval;
-    }
-
-    public int getRetries() {
-        return retries;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/downloadSnapshotFromSwiftCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/downloadSnapshotFromSwiftCommand.java b/api/src/com/cloud/agent/api/downloadSnapshotFromSwiftCommand.java
deleted file mode 100644
index a2ae611..0000000
--- a/api/src/com/cloud/agent/api/downloadSnapshotFromSwiftCommand.java
+++ /dev/null
@@ -1,60 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-import com.cloud.agent.api.to.SwiftTO;
-
-/**
- * This currently assumes that both primary and secondary storage are mounted on the XenServer.
- */
-public class downloadSnapshotFromSwiftCommand extends SnapshotCommand {
-    @LogLevel(Log4jLevel.Off)
-    private SwiftTO _swift;
-
-    private String _parent;
-
-    protected downloadSnapshotFromSwiftCommand() {
-
-    }
-
-    public downloadSnapshotFromSwiftCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long volumeId, String parent, String BackupUuid, int wait) {
-
-        super(null, secondaryStorageUrl, BackupUuid, "", dcId, accountId, volumeId);
-        setParent(parent);
-        setSwift(swift);
-        setWait(wait);
-    }
-
-
-    public SwiftTO getSwift() {
-        return this._swift;
-    }
-
-    public void setSwift(SwiftTO swift) {
-        this._swift = swift;
-    }
-
-    public String getParent() {
-        return _parent;
-    }
-
-    public void setParent(String parent) {
-        this._parent = parent;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/downloadTemplateFromSwiftToSecondaryStorageCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/downloadTemplateFromSwiftToSecondaryStorageCommand.java b/api/src/com/cloud/agent/api/downloadTemplateFromSwiftToSecondaryStorageCommand.java
deleted file mode 100644
index 8229065..0000000
--- a/api/src/com/cloud/agent/api/downloadTemplateFromSwiftToSecondaryStorageCommand.java
+++ /dev/null
@@ -1,90 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-import com.cloud.agent.api.to.SwiftTO;
-
-/**
- *
- *
- */
-
-public class downloadTemplateFromSwiftToSecondaryStorageCommand extends Command {
-    @LogLevel(Log4jLevel.Off)
-    private SwiftTO swift;
-    private String secondaryStorageUrl;
-
-    private Long dcId;
-    private Long accountId;
-    private Long templateId;
-    private String path;
-
-    protected downloadTemplateFromSwiftToSecondaryStorageCommand() {
-
-    }
-
-    public downloadTemplateFromSwiftToSecondaryStorageCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long templateId, String path, int wait) {
-
-        this.swift = swift;
-        this.secondaryStorageUrl = secondaryStorageUrl;
-        this.dcId = dcId;
-        this.accountId = accountId;
-        this.templateId = templateId;
-        this.path = path;
-        setWait(wait);
-    }
-
-    public SwiftTO getSwift() {
-        return this.swift;
-    }
-
-    public void setSwift(SwiftTO swift) {
-        this.swift = swift;
-    }
-
-    public String getSecondaryStorageUrl() {
-        return secondaryStorageUrl;
-    }
-
-    public Long getDcId() {
-        return dcId;
-    }
-
-    public Long getAccountId() {
-        return accountId;
-    }
-
-    public Long getTemplateId() {
-        return templateId;
-    }
-
-    public String getPath() {
-        return path;
-    }
-
-    public void setPath(String path) {
-        this.path = path;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        // TODO Auto-generated method stub
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/proxy/CheckConsoleProxyLoadCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/proxy/CheckConsoleProxyLoadCommand.java b/api/src/com/cloud/agent/api/proxy/CheckConsoleProxyLoadCommand.java
deleted file mode 100644
index 7582b0d..0000000
--- a/api/src/com/cloud/agent/api/proxy/CheckConsoleProxyLoadCommand.java
+++ /dev/null
@@ -1,60 +0,0 @@
-// 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.agent.api.proxy;
-
-
-/**
- * CheckConsoleProxyLoadCommand implements one-shot console proxy load-scan command
- */
-public class CheckConsoleProxyLoadCommand extends ProxyCommand {
-
-	private long proxyVmId;
-	private String proxyVmName;
-	private String proxyManagementIp;
-	private int proxyCmdPort;
-
-	public CheckConsoleProxyLoadCommand() {
-	}
-
-	public CheckConsoleProxyLoadCommand(long proxyVmId, String proxyVmName, String proxyManagementIp, int proxyCmdPort) {
-		this.proxyVmId = proxyVmId;
-		this.proxyVmName = proxyVmName;
-		this.proxyManagementIp = proxyManagementIp;
-		this.proxyCmdPort = proxyCmdPort;
-	}
-
-	public long getProxyVmId() {
-		return proxyVmId;
-	}
-
-	public String getProxyVmName() {
-		return proxyVmName;
-	}
-
-	public String getProxyManagementIp() {
-		return proxyManagementIp;
-	}
-
-	public int getProxyCmdPort() {
-		return proxyCmdPort;
-	}
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/proxy/ConsoleProxyLoadAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/proxy/ConsoleProxyLoadAnswer.java b/api/src/com/cloud/agent/api/proxy/ConsoleProxyLoadAnswer.java
deleted file mode 100644
index ae93f51..0000000
--- a/api/src/com/cloud/agent/api/proxy/ConsoleProxyLoadAnswer.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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.agent.api.proxy;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-
-public class ConsoleProxyLoadAnswer extends Answer {
-
-	private long proxyVmId;
-	private String proxyVmName;
-
-	protected ConsoleProxyLoadAnswer() {
-	}
-
-	public ConsoleProxyLoadAnswer(Command command, long proxyVmId, String proxyVmName, boolean success, String details) {
-		super(command, success, details);
-
-		this.proxyVmId = proxyVmId;
-		this.proxyVmName = proxyVmName;
-	}
-
-	public long getProxyVmId() {
-		return proxyVmId;
-	}
-
-	public String getProxyVmName() {
-		return proxyVmName;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/proxy/ProxyCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/proxy/ProxyCommand.java b/api/src/com/cloud/agent/api/proxy/ProxyCommand.java
deleted file mode 100644
index b283eb8..0000000
--- a/api/src/com/cloud/agent/api/proxy/ProxyCommand.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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.agent.api.proxy;
-
-import com.cloud.agent.api.Command;
-
-public abstract class ProxyCommand extends Command {
-    protected ProxyCommand() {
-        super();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/proxy/StartConsoleProxyAgentHttpHandlerCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/proxy/StartConsoleProxyAgentHttpHandlerCommand.java b/api/src/com/cloud/agent/api/proxy/StartConsoleProxyAgentHttpHandlerCommand.java
deleted file mode 100644
index 3befc2f..0000000
--- a/api/src/com/cloud/agent/api/proxy/StartConsoleProxyAgentHttpHandlerCommand.java
+++ /dev/null
@@ -1,68 +0,0 @@
-// 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.agent.api.proxy;
-
-import com.cloud.agent.api.Command;
-import com.cloud.agent.api.LogLevel;
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-
-public class StartConsoleProxyAgentHttpHandlerCommand extends Command {
-    @LogLevel(Log4jLevel.Off)
-	private byte[] keystoreBits;
-    @LogLevel(Log4jLevel.Off)
-	private String keystorePassword;
-    @LogLevel(Log4jLevel.Off)
-	private String encryptorPassword;
-
-	public StartConsoleProxyAgentHttpHandlerCommand() {
-		super();
-	}
-
-	public StartConsoleProxyAgentHttpHandlerCommand(byte[] ksBits, String ksPassword) {
-		this.keystoreBits = ksBits;
-		this.keystorePassword = ksPassword;
-	}
-
-	@Override
-	public boolean executeInSequence() {
-		return true;
-	}
-
-	public byte[] getKeystoreBits() {
-		return keystoreBits;
-	}
-
-	public void setKeystoreBits(byte[] keystoreBits) {
-		this.keystoreBits = keystoreBits;
-	}
-
-	public String getKeystorePassword() {
-		return keystorePassword;
-	}
-
-	public void setKeystorePassword(String keystorePassword) {
-		this.keystorePassword = keystorePassword;
-	}
-
-	public String getEncryptorPassword() {
-		return encryptorPassword;
-	}
-
-	public void setEncryptorPassword(String encryptorPassword) {
-		this.encryptorPassword = encryptorPassword;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/proxy/WatchConsoleProxyLoadCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/proxy/WatchConsoleProxyLoadCommand.java b/api/src/com/cloud/agent/api/proxy/WatchConsoleProxyLoadCommand.java
deleted file mode 100644
index ef4a549..0000000
--- a/api/src/com/cloud/agent/api/proxy/WatchConsoleProxyLoadCommand.java
+++ /dev/null
@@ -1,65 +0,0 @@
-// 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.agent.api.proxy;
-
-import com.cloud.agent.api.CronCommand;
-
-public class WatchConsoleProxyLoadCommand extends ProxyCommand implements CronCommand {
-
-	private long proxyVmId;
-	private String proxyVmName;
-	private String proxyManagementIp;
-	private int proxyCmdPort;
-	int interval;
-
-    public WatchConsoleProxyLoadCommand(int interval, long proxyVmId, String proxyVmName,
-    	String proxyManagementIp, int proxyCmdPort) {
-        this.interval = interval;
-    	this.proxyVmId = proxyVmId;
-		this.proxyVmName = proxyVmName;
-		this.proxyManagementIp = proxyManagementIp;
-		this.proxyCmdPort = proxyCmdPort;
-    }
-
-	protected WatchConsoleProxyLoadCommand() {
-	}
-
-	public long getProxyVmId() {
-		return proxyVmId;
-	}
-
-	public String getProxyVmName() {
-		return proxyVmName;
-	}
-
-	public String getProxyManagementIp() {
-		return proxyManagementIp;
-	}
-
-	public int getProxyCmdPort() {
-		return proxyCmdPort;
-	}
-
-	public int getInterval() {
-	    return interval;
-	}
-
-	@Override
-    public boolean executeInSequence() {
-	    return false;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/CreateLoadBalancerApplianceCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/CreateLoadBalancerApplianceCommand.java b/api/src/com/cloud/agent/api/routing/CreateLoadBalancerApplianceCommand.java
deleted file mode 100644
index dc7f1a1..0000000
--- a/api/src/com/cloud/agent/api/routing/CreateLoadBalancerApplianceCommand.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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.agent.api.routing;
-
-/** NetworkElementCommand to spin a load balancer appliance */
-
-public class CreateLoadBalancerApplianceCommand extends NetworkElementCommand {
-
-    String ip;
-    String netmask;
-    String gateway;
-    String username;
-    String password;
-    String publicInterface;
-    String privateInterface;
-
-    public CreateLoadBalancerApplianceCommand(String ip, String netmask, String gateway) {
-        this.ip = ip;
-        this.netmask = netmask;
-        this.gateway = gateway;
-    }
-
-    public String getLoadBalancerIP() {
-        return ip;
-    }
-
-    public String getNetmask() {
-        return netmask;
-    }
-
-    public String getGateway() {
-        return gateway;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/DestroyLoadBalancerApplianceCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/DestroyLoadBalancerApplianceCommand.java b/api/src/com/cloud/agent/api/routing/DestroyLoadBalancerApplianceCommand.java
deleted file mode 100644
index 5f46d82..0000000
--- a/api/src/com/cloud/agent/api/routing/DestroyLoadBalancerApplianceCommand.java
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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.
-/** NetworkElementCommand to destroy a VPX instance on the Netscaler SDX load balancer appliance */
-//TODO: fill in the Nitro API parameters required
-package com.cloud.agent.api.routing;
-
-public class DestroyLoadBalancerApplianceCommand extends NetworkElementCommand {
-
-    String ip;
-
-    public DestroyLoadBalancerApplianceCommand(String ip) {
-        this.ip = ip;
-    }
-
-    public String getLoadBalancerIP() {
-        return ip;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java b/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
deleted file mode 100644
index fd8d84c..0000000
--- a/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
+++ /dev/null
@@ -1,142 +0,0 @@
-// 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.agent.api.routing;
-
-
-public class DhcpEntryCommand extends NetworkElementCommand {
-
-    String vmMac;
-    String vmIpAddress;
-    String vmName;
-    String dns;
-    String gateway;
-    String nextServer;
-    String defaultRouter;
-    String staticRoutes;
-    String defaultDns;
-    String vmIp6Address;
-    String ip6Gateway;
-    String duid;
-    private boolean isDefault;
-
-    protected DhcpEntryCommand() {
-
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String vmIp6Address) {
-        this.vmMac = vmMac;
-        this.vmIpAddress = vmIpAddress;
-        this.vmName = vmName;
-        this.vmIp6Address = vmIp6Address;
-        this.setDefault(true);
-    }
-
-    public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String vmIp6Address, String dns, String gateway, String ip6Gateway) {
-        this(vmMac, vmIpAddress, vmName, vmIp6Address);
-        this.dns = dns;
-        this.gateway = gateway;
-    }
-
-    public String getDns() {
-        return dns;
-    }
-
-    public String getGateway() {
-        return gateway;
-    }
-
-    public String getVmMac() {
-        return vmMac;
-    }
-
-    public String getVmIpAddress() {
-        return vmIpAddress;
-    }
-
-    public String getVmName() {
-        return vmName;
-    }
-
-    public void setNextServer(String ip) {
-        nextServer = ip;
-    }
-
-    public String getNextServer() {
-        return nextServer;
-    }
-
-    public String getDefaultRouter() {
-        return defaultRouter;
-    }
-
-    public void setDefaultRouter(String defaultRouter) {
-        this.defaultRouter = defaultRouter;
-    }
-
-    public String getStaticRoutes() {
-        return staticRoutes;
-    }
-
-    public void setStaticRoutes(String staticRoutes) {
-        this.staticRoutes = staticRoutes;
-    }
-
-	public String getDefaultDns() {
-		return defaultDns;
-	}
-
-	public void setDefaultDns(String defaultDns) {
-		this.defaultDns = defaultDns;
-	}
-
-	public String getIp6Gateway() {
-		return ip6Gateway;
-	}
-
-	public void setIp6Gateway(String ip6Gateway) {
-		this.ip6Gateway = ip6Gateway;
-	}
-
-	public String getDuid() {
-		return duid;
-	}
-
-	public void setDuid(String duid) {
-		this.duid = duid;
-	}
-
-	public String getVmIp6Address() {
-		return vmIp6Address;
-	}
-
-	public void setVmIp6Address(String ip6Address) {
-		this.vmIp6Address = ip6Address;
-	}
-
-	public boolean isDefault() {
-		return isDefault;
-	}
-
-	public void setDefault(boolean isDefault) {
-		this.isDefault = isDefault;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigAnswer.java b/api/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigAnswer.java
deleted file mode 100644
index e5167fe..0000000
--- a/api/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigAnswer.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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.agent.api.routing;
-
-import com.cloud.agent.api.Answer;
-
-public class GlobalLoadBalancerConfigAnswer extends Answer{
-
-    public GlobalLoadBalancerConfigAnswer(boolean success, String details) {
-        this.result = success;
-        this.details = details;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigCommand.java b/api/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigCommand.java
deleted file mode 100644
index b3603c8..0000000
--- a/api/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigCommand.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// 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.agent.api.routing;
-
-import com.cloud.agent.api.Command;
-
-import java.util.List;
-
-/**
- * GlobalLoadBalancerConfigCommand used for sending the GSLB configuration to GSLB service provider
- */
-public class GlobalLoadBalancerConfigCommand extends Command {
-
-    // FQDN that represents the globally load balanced service
-    String domainName;
-
-    // type of the globally load balanced service
-    String serviceType;
-
-    // load balancing method to distribute traffic across the sites participating in global service load balancing
-    String lbMethod;
-
-    // session persistence type
-    String persistenceType;
-
-    // unique Id given per gslb rule, that is uniquely represents glsb rule on all participant sites
-    long gslbId;
-
-    // true if global load balancer rule is being deleted
-    boolean revoked;
-
-    // list of the site details that are participating in the GSLB service
-    List<SiteLoadBalancerConfig> siteLoadBalancers;
-
-    public GlobalLoadBalancerConfigCommand(String domainName,
-                                                 String lbMethod,
-                                                 String persistenceType,
-                                                 String serviceType,
-                                                 long gslbId,
-                                                 boolean revoked) {
-        this.domainName = domainName;
-        this.serviceType = serviceType;
-        this.lbMethod = lbMethod;
-        this.persistenceType = persistenceType;
-        this.gslbId = gslbId;
-        this.revoked = revoked;
-    }
-
-    public List<SiteLoadBalancerConfig> getSiteDetails() {
-        return siteLoadBalancers;
-    }
-
-    public void setSiteLoadBalancers(List<SiteLoadBalancerConfig> siteLoadBalancers) {
-        this.siteLoadBalancers = siteLoadBalancers;
-    }
-
-    public String getServiceType() {
-        return serviceType;
-    }
-
-    public String getLoadBalancerMethod() {
-        return lbMethod;
-    }
-
-    public String getPersistenceType() {
-        return persistenceType;
-    }
-
-    public long getGslbId() {
-        return this.gslbId;
-    }
-
-    public String getDomainName() {
-        return domainName;
-    }
-
-    public boolean isForRevoke() {
-        return revoked;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/HealthCheckLBConfigAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/HealthCheckLBConfigAnswer.java b/api/src/com/cloud/agent/api/routing/HealthCheckLBConfigAnswer.java
deleted file mode 100644
index dfca4ab..0000000
--- a/api/src/com/cloud/agent/api/routing/HealthCheckLBConfigAnswer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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.agent.api.routing;
-
-import java.util.List;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.to.LoadBalancerTO;
-import com.cloud.agent.api.to.NicTO;
-
-/**
- * LoadBalancerConfigCommand sends the load balancer configuration
- */
-public class HealthCheckLBConfigAnswer extends Answer {
-    List<LoadBalancerTO> loadBalancers;
-
-    protected HealthCheckLBConfigAnswer() {
-    }
-
-    public HealthCheckLBConfigAnswer(List<LoadBalancerTO> loadBalancers) {
-        this.loadBalancers = loadBalancers;
-    }
-
-    public List<LoadBalancerTO> getLoadBalancers() {
-        return loadBalancers;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/HealthCheckLBConfigCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/HealthCheckLBConfigCommand.java b/api/src/com/cloud/agent/api/routing/HealthCheckLBConfigCommand.java
deleted file mode 100644
index f705f6c..0000000
--- a/api/src/com/cloud/agent/api/routing/HealthCheckLBConfigCommand.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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.agent.api.routing;
-
-import com.cloud.agent.api.to.LoadBalancerTO;
-import com.cloud.agent.api.to.NicTO;
-
-/**
- * LoadBalancerConfigCommand sends the load balancer configuration
- */
-public class HealthCheckLBConfigCommand extends NetworkElementCommand {
-    LoadBalancerTO[] loadBalancers;
-
-    protected HealthCheckLBConfigCommand() {
-    }
-
-    public HealthCheckLBConfigCommand(LoadBalancerTO[] loadBalancers) {
-        this.loadBalancers = loadBalancers;
-    }
-
-    public LoadBalancerTO[] getLoadBalancers() {
-        return loadBalancers;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/IpAssocAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/IpAssocAnswer.java b/api/src/com/cloud/agent/api/routing/IpAssocAnswer.java
deleted file mode 100644
index 194923c..0000000
--- a/api/src/com/cloud/agent/api/routing/IpAssocAnswer.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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.agent.api.routing;
-
-import com.cloud.agent.api.Answer;
-
-public class IpAssocAnswer extends Answer{
-    String[] results;
-
-    public static final String errorResult = "Failed";
-
-    protected IpAssocAnswer() {
-        super();
-    }
-
-    public IpAssocAnswer(IpAssocCommand cmd, String[] results) {
-
-        boolean finalResult = true;
-        for (String result : results) {
-            if (result.equals(errorResult)) {
-                finalResult = false;
-                break;
-            }
-        }
-        this.result = finalResult;
-        this.details = null;
-        assert(cmd.getIpAddresses().length == results.length) : "Shouldn't the results match the commands?";
-        this.results = results;
-    }
-
-    String[] getResults() {
-        return results;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/IpAssocCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/IpAssocCommand.java b/api/src/com/cloud/agent/api/routing/IpAssocCommand.java
deleted file mode 100644
index 5cdc2da..0000000
--- a/api/src/com/cloud/agent/api/routing/IpAssocCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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.agent.api.routing;
-
-import com.cloud.agent.api.to.IpAddressTO;
-
-public class IpAssocCommand extends NetworkElementCommand {
-
-	IpAddressTO[] ipAddresses;
-
-	protected IpAssocCommand() {
-	}
-
-	public IpAssocCommand(IpAddressTO[] ips) {
-		this.ipAddresses = ips;
-	}
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-    public IpAddressTO[] getIpAddresses() {
-        return ipAddresses;
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/IpAssocVpcCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/IpAssocVpcCommand.java b/api/src/com/cloud/agent/api/routing/IpAssocVpcCommand.java
deleted file mode 100644
index e5c900d..0000000
--- a/api/src/com/cloud/agent/api/routing/IpAssocVpcCommand.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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.agent.api.routing;
-
-import com.cloud.agent.api.to.IpAddressTO;
-
-public class IpAssocVpcCommand extends IpAssocCommand{
-    protected IpAssocVpcCommand() {
-        super();
-    }
-
-    public IpAssocVpcCommand(IpAddressTO[] ips) {
-        super(ips);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java b/api/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java
deleted file mode 100644
index 1c1fb91..0000000
--- a/api/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java
+++ /dev/null
@@ -1,66 +0,0 @@
-// 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.agent.api.routing;
-
-import com.cloud.agent.api.to.LoadBalancerTO;
-import com.cloud.agent.api.to.NicTO;
-
-/**
- * LoadBalancerConfigCommand sends the load balancer configuration
- */
-public class LoadBalancerConfigCommand extends NetworkElementCommand {
-    LoadBalancerTO[] loadBalancers;
-    public String lbStatsVisibility = "guest-network";
-    public String lbStatsPublicIP; /* load balancer listen on this ips for stats */
-    public String lbStatsPrivateIP; /* load balancer listen on this ips for stats */
-    public String lbStatsGuestIP; /* load balancer listen on this ips for stats */
-    public String lbStatsPort = "8081"; /*load balancer listen on this port for stats */
-    public String lbStatsSrcCidrs = "0/0" ; /* TODO : currently there is no filtering based on the source ip */
-    public String lbStatsAuth = "admin1:AdMiN123";
-    public String lbStatsUri = "/admin?stats";
-    NicTO nic;
-    Long vpcId;
-
-    protected LoadBalancerConfigCommand() {
-    }
-
-    public LoadBalancerConfigCommand(LoadBalancerTO[] loadBalancers, Long vpcId) {
-    	this.loadBalancers = loadBalancers;
-    	this.vpcId = vpcId;
-    }
-
-    public LoadBalancerConfigCommand(LoadBalancerTO[] loadBalancers,String PublicIp,String GuestIp,String PrivateIp, NicTO nic, Long vpcId) {
-    	this.loadBalancers = loadBalancers;
-    	this.lbStatsPublicIP = PublicIp;
-    	this.lbStatsPrivateIP = PrivateIp;
-    	this.lbStatsGuestIP = GuestIp;
-    	this.nic = nic;
-    	this.vpcId = vpcId;
-    }
-
-    public NicTO getNic() {
-        return nic;
-    }
-
-	public LoadBalancerTO[] getLoadBalancers() {
-        return loadBalancers;
-    }
-
-    public Long getVpcId() {
-        return vpcId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/NetworkElementCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/NetworkElementCommand.java b/api/src/com/cloud/agent/api/routing/NetworkElementCommand.java
deleted file mode 100644
index 41ae80f..0000000
--- a/api/src/com/cloud/agent/api/routing/NetworkElementCommand.java
+++ /dev/null
@@ -1,53 +0,0 @@
-// 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.agent.api.routing;
-
-import java.util.HashMap;
-
-import com.cloud.agent.api.Command;
-
-public abstract class NetworkElementCommand extends Command {
-    HashMap<String, String> accessDetails = new HashMap<String, String>(0);
-
-    public static final String ACCOUNT_ID = "account.id";
-    public static final String GUEST_NETWORK_CIDR = "guest.network.cidr";
-    public static final String GUEST_NETWORK_GATEWAY = "guest.network.gateway";
-    public static final String GUEST_VLAN_TAG = "guest.vlan.tag";
-    public static final String ROUTER_NAME = "router.name";
-    public static final String ROUTER_IP = "router.ip";
-    public static final String ROUTER_GUEST_IP = "router.guest.ip";
-    public static final String ZONE_NETWORK_TYPE = "zone.network.type";
-    public static final String GUEST_BRIDGE = "guest.bridge";
-
-    protected NetworkElementCommand() {
-        super();
-    }
-
-    public void setAccessDetail(String name, String value) {
-        accessDetails.put(name, value);
-    }
-
-    public String getAccessDetail(String name) {
-        return accessDetails.get(name);
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java b/api/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java
deleted file mode 100644
index 68d7caf..0000000
--- a/api/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java
+++ /dev/null
@@ -1,78 +0,0 @@
-// 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.agent.api.routing;
-
-
-public class RemoteAccessVpnCfgCommand extends NetworkElementCommand {
-
-	boolean create;
-    String vpnServerIp;
-    String ipRange;
-    String presharedKey;
-    String localIp;
-
-    protected RemoteAccessVpnCfgCommand() {
-    	this.create = false;
-    }
-
-    public boolean isCreate() {
-		return create;
-	}
-
-	@Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-
-	public RemoteAccessVpnCfgCommand(boolean create, String vpnServerAddress, String localIp, String ipRange, String ipsecPresharedKey) {
-		this.vpnServerIp = vpnServerAddress;
-		this.ipRange  = ipRange;
-		this.presharedKey = ipsecPresharedKey;
-		this.localIp = localIp;
-		this.create = create;
-	}
-
-	public String getVpnServerIp() {
-		return vpnServerIp;
-	}
-
-	public void setVpnServerIp(String vpnServerIp) {
-		this.vpnServerIp = vpnServerIp;
-	}
-
-	public String getIpRange() {
-		return ipRange;
-	}
-
-	public void setIpRange(String ipRange) {
-		this.ipRange = ipRange;
-	}
-
-	public String getPresharedKey() {
-		return presharedKey;
-	}
-
-	public void setPresharedKey(String presharedKey) {
-		this.presharedKey = presharedKey;
-	}
-
-	public String getLocalIp() {
-		return localIp;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/SavePasswordCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/SavePasswordCommand.java b/api/src/com/cloud/agent/api/routing/SavePasswordCommand.java
deleted file mode 100644
index 6dac148..0000000
--- a/api/src/com/cloud/agent/api/routing/SavePasswordCommand.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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.agent.api.routing;
-
-
-public class SavePasswordCommand extends NetworkElementCommand {
-
-    String password;
-    String vmIpAddress;
-    String vmName;
-
-    protected SavePasswordCommand() {
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public SavePasswordCommand(String password, String vmIpAddress, String vmName) {
-        this.password = password;
-        this.vmIpAddress = vmIpAddress;
-        this.vmName = vmName;
-    }
-
-	public String getPassword() {
-		return password;
-	}
-
-	public String getVmIpAddress() {
-		return vmIpAddress;
-	}
-
-    public String getVmName() {
-        return vmName;
-    }
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/SetFirewallRulesAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/SetFirewallRulesAnswer.java b/api/src/com/cloud/agent/api/routing/SetFirewallRulesAnswer.java
deleted file mode 100644
index 5268c3d..0000000
--- a/api/src/com/cloud/agent/api/routing/SetFirewallRulesAnswer.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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.agent.api.routing;
-
-import com.cloud.agent.api.Answer;
-
-public class SetFirewallRulesAnswer extends Answer {
-    String[] results;
-
-    protected SetFirewallRulesAnswer() {
-    }
-
-    public SetFirewallRulesAnswer(SetFirewallRulesCommand cmd, boolean success, String[] results) {
-        super(cmd, success, null);
-        assert (cmd.getRules().length == results.length) : "rules and their results should be the same length don't you think?";
-        this.results = results;
-    }
-
-    public String[] getResults() {
-        return results;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/SetFirewallRulesCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/SetFirewallRulesCommand.java b/api/src/com/cloud/agent/api/routing/SetFirewallRulesCommand.java
deleted file mode 100644
index 3841bd7..0000000
--- a/api/src/com/cloud/agent/api/routing/SetFirewallRulesCommand.java
+++ /dev/null
@@ -1,98 +0,0 @@
-// 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.agent.api.routing;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import com.cloud.agent.api.to.FirewallRuleTO;
-
-/**
- *
- * AccessDetails allow different components to put in information about
- * how to access the components inside the command.
- */
-public class SetFirewallRulesCommand extends NetworkElementCommand {
-    FirewallRuleTO[] rules;
-
-    protected SetFirewallRulesCommand() {
-    }
-
-    public SetFirewallRulesCommand(List<FirewallRuleTO> rules) {
-        this.rules = rules.toArray(new FirewallRuleTO[rules.size()]);
-    }
-
-    public FirewallRuleTO[] getRules() {
-        return rules;
-    }
-
-	public String[][] generateFwRules() {
-		String [][] result = new String [2][];
-		Set<String> toAdd = new HashSet<String>();
-
-
-		for (FirewallRuleTO fwTO: rules) {
-		/* example  :  172.16.92.44:tcp:80:80:0.0.0.0/0:,200.16.92.44:tcp:220:220:0.0.0.0/0:,
-		 *  each entry format      <ip>:protocol:srcport:destport:scidr:
-		 *  reverted entry format  <ip>:reverted:0:0:0:
-		 */
-			if (fwTO.revoked() == true)
-			{
-				StringBuilder sb = new StringBuilder();
-				/* This entry is added just to make sure atleast there will one entry in the list to get the ipaddress */
-				sb.append(fwTO.getSrcIp()).append(":reverted:0:0:0:");
-				String fwRuleEntry = sb.toString();
-				toAdd.add(fwRuleEntry);
-				continue;
-			}
-
-			List<String> cidr;
-			StringBuilder sb = new StringBuilder();
-			sb.append(fwTO.getSrcIp()).append(":").append(fwTO.getProtocol()).append(":");
-			if ("icmp".compareTo(fwTO.getProtocol()) == 0)
-			{
-				sb.append(fwTO.getIcmpType()).append(":").append(fwTO.getIcmpCode()).append(":");
-
-			}else if (fwTO.getStringSrcPortRange() == null)
-				sb.append("0:0").append(":");
-			else
-			    sb.append(fwTO.getStringSrcPortRange()).append(":");
-
-			cidr = fwTO.getSourceCidrList();
-			if (cidr == null || cidr.isEmpty())
-			{
-				sb.append("0.0.0.0/0");
-			}else{
-				Boolean firstEntry = true;
-	            for (String tag : cidr) {
-	            	if (!firstEntry) sb.append("-");
-	        	   sb.append(tag);
-	        	   firstEntry = false;
-	            }
-			}
-			sb.append(":");
-			String fwRuleEntry = sb.toString();
-
-			toAdd.add(fwRuleEntry);
-
-		}
-		result[0] = toAdd.toArray(new String[toAdd.size()]);
-
-		return result;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/SetNetworkACLAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/SetNetworkACLAnswer.java b/api/src/com/cloud/agent/api/routing/SetNetworkACLAnswer.java
deleted file mode 100644
index dc192ad..0000000
--- a/api/src/com/cloud/agent/api/routing/SetNetworkACLAnswer.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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.agent.api.routing;
-
-import com.cloud.agent.api.Answer;
-
-public class SetNetworkACLAnswer extends Answer {
-    String[] results;
-
-    protected SetNetworkACLAnswer() {
-    }
-
-    public SetNetworkACLAnswer(SetNetworkACLCommand cmd, boolean success, String[] results) {
-        super(cmd, success, null);
-        assert (cmd.getRules().length == results.length) : "ACLs and their results should be the same length";
-        this.results = results;
-    }
-
-    public String[] getResults() {
-        return results;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java b/api/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java
deleted file mode 100644
index dba7354..0000000
--- a/api/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java
+++ /dev/null
@@ -1,97 +0,0 @@
-// 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.agent.api.routing;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import com.cloud.agent.api.to.NetworkACLTO;
-import com.cloud.agent.api.to.NicTO;
-
-public class SetNetworkACLCommand extends NetworkElementCommand{
-    NetworkACLTO[] rules;
-    NicTO nic;
-
-    protected SetNetworkACLCommand() {
-    }
-
-    public SetNetworkACLCommand(List<NetworkACLTO> rules, NicTO nic) {
-        this.rules = rules.toArray(new NetworkACLTO[rules.size()]);
-        this.nic = nic;
-    }
-
-    public NetworkACLTO[] getRules() {
-        return rules;
-    }
-    public String[][] generateFwRules() {
-        String [][] result = new String [2][];
-        Set<String> toAdd = new HashSet<String>();
-
-
-        for (NetworkACLTO aclTO: rules) {
-        /*  example  :  Ingress:tcp:80:80:0.0.0.0/0:,Egress:tcp:220:220:0.0.0.0/0:,
-         *  each entry format      Ingress/Egress:protocol:start port: end port:scidrs:
-         *  reverted entry format  Ingress/Egress:reverted:0:0:0:
-         */
-            if (aclTO.revoked() == true)
-            {
-                StringBuilder sb = new StringBuilder();
-                /* This entry is added just to make sure atleast there will one entry in the list to get the ipaddress */
-                sb.append(aclTO.getTrafficType().toString()).append(":reverted:0:0:0:");
-                String aclRuleEntry = sb.toString();
-                toAdd.add(aclRuleEntry);
-                continue;
-            }
-
-            List<String> cidr;
-            StringBuilder sb = new StringBuilder();
-            sb.append(aclTO.getTrafficType().toString()).append(":").append(aclTO.getProtocol()).append(":");
-            if ("icmp".compareTo(aclTO.getProtocol()) == 0)
-            {
-                sb.append(aclTO.getIcmpType()).append(":").append(aclTO.getIcmpCode()).append(":");
-            } else {
-                sb.append(aclTO.getStringPortRange()).append(":");
-            }
-            cidr = aclTO.getSourceCidrList();
-            if (cidr == null || cidr.isEmpty())
-            {
-                sb.append("0.0.0.0/0");
-            }else{
-                Boolean firstEntry = true;
-                for (String tag : cidr) {
-                    if (!firstEntry) sb.append("-");
-                   sb.append(tag);
-                   firstEntry = false;
-                }
-            }
-            sb.append(":");
-            String aclRuleEntry = sb.toString();
-
-            toAdd.add(aclRuleEntry);
-
-        }
-        result[0] = toAdd.toArray(new String[toAdd.size()]);
-
-        return result;
-    }
-
-    public NicTO getNic() {
-        return nic;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/SetPortForwardingRulesAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/SetPortForwardingRulesAnswer.java b/api/src/com/cloud/agent/api/routing/SetPortForwardingRulesAnswer.java
deleted file mode 100644
index 15306fb..0000000
--- a/api/src/com/cloud/agent/api/routing/SetPortForwardingRulesAnswer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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.agent.api.routing;
-
-import com.cloud.agent.api.Answer;
-
-public class SetPortForwardingRulesAnswer extends Answer {
-    String[] results;
-    protected SetPortForwardingRulesAnswer() {
-        super();
-    }
-
-    public SetPortForwardingRulesAnswer(SetPortForwardingRulesCommand cmd, String[] results, boolean success) {
-        super(cmd, success, null);
-
-        assert(cmd.getRules().length == results.length) : "Shouldn't the results match the commands?";
-        this.results = results;
-    }
-
-    String[] getResults() {
-        return results;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/SetPortForwardingRulesCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/SetPortForwardingRulesCommand.java b/api/src/com/cloud/agent/api/routing/SetPortForwardingRulesCommand.java
deleted file mode 100644
index a7bf37f..0000000
--- a/api/src/com/cloud/agent/api/routing/SetPortForwardingRulesCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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.agent.api.routing;
-
-import java.util.List;
-
-import com.cloud.agent.api.to.PortForwardingRuleTO;
-
-public class SetPortForwardingRulesCommand extends NetworkElementCommand {
-    PortForwardingRuleTO[] rules;
-
-    protected SetPortForwardingRulesCommand() {
-    }
-
-    public SetPortForwardingRulesCommand(List<? extends PortForwardingRuleTO> pfRules) {
-        rules = new PortForwardingRuleTO[pfRules.size()];
-        int i = 0;
-        for (PortForwardingRuleTO rule : pfRules) {
-            rules[i++] = rule;
-        }
-    }
-
-    public PortForwardingRuleTO[] getRules() {
-        return rules;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/SetPortForwardingRulesVpcCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/SetPortForwardingRulesVpcCommand.java b/api/src/com/cloud/agent/api/routing/SetPortForwardingRulesVpcCommand.java
deleted file mode 100644
index 7228457..0000000
--- a/api/src/com/cloud/agent/api/routing/SetPortForwardingRulesVpcCommand.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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.agent.api.routing;
-
-import java.util.List;
-
-import com.cloud.agent.api.to.PortForwardingRuleTO;
-
-public class SetPortForwardingRulesVpcCommand extends SetPortForwardingRulesCommand{
-    protected SetPortForwardingRulesVpcCommand() {
-    }
-
-    public SetPortForwardingRulesVpcCommand(List<? extends PortForwardingRuleTO> pfRules) {
-        super(pfRules);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/SetSourceNatAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/SetSourceNatAnswer.java b/api/src/com/cloud/agent/api/routing/SetSourceNatAnswer.java
deleted file mode 100644
index 655f363..0000000
--- a/api/src/com/cloud/agent/api/routing/SetSourceNatAnswer.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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.agent.api.routing;
-
-import com.cloud.agent.api.Answer;
-
-public class SetSourceNatAnswer extends Answer{
-    public SetSourceNatAnswer() {}
-
-    public SetSourceNatAnswer(SetSourceNatCommand cmd, boolean success, String result) {
-        super(cmd, success, result);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/SetSourceNatCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/SetSourceNatCommand.java b/api/src/com/cloud/agent/api/routing/SetSourceNatCommand.java
deleted file mode 100644
index 96aa001..0000000
--- a/api/src/com/cloud/agent/api/routing/SetSourceNatCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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.agent.api.routing;
-
-import com.cloud.agent.api.to.IpAddressTO;
-
-public class SetSourceNatCommand extends NetworkElementCommand{
-    IpAddressTO ipAddress;
-    boolean add;
-
-    protected SetSourceNatCommand() {
-    }
-
-    public SetSourceNatCommand(IpAddressTO ip, boolean add) {
-        this.ipAddress = ip;
-        this.add = add;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-    public IpAddressTO getIpAddress() {
-        return ipAddress;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/SetStaticNatRulesAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/SetStaticNatRulesAnswer.java b/api/src/com/cloud/agent/api/routing/SetStaticNatRulesAnswer.java
deleted file mode 100644
index 9b5d09b..0000000
--- a/api/src/com/cloud/agent/api/routing/SetStaticNatRulesAnswer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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.agent.api.routing;
-
-import com.cloud.agent.api.Answer;
-
-public class SetStaticNatRulesAnswer extends Answer {
-    String[] results;
-    protected SetStaticNatRulesAnswer() {
-        super();
-    }
-
-    public SetStaticNatRulesAnswer(SetStaticNatRulesCommand cmd, String[] results, boolean success) {
-        super(cmd, success, null);
-
-        assert(cmd.getRules().length == results.length) : "Shouldn't the results match the commands?";
-        this.results = results;
-    }
-
-    String[] getResults() {
-        return results;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/SetStaticNatRulesCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/SetStaticNatRulesCommand.java b/api/src/com/cloud/agent/api/routing/SetStaticNatRulesCommand.java
deleted file mode 100644
index 852d161..0000000
--- a/api/src/com/cloud/agent/api/routing/SetStaticNatRulesCommand.java
+++ /dev/null
@@ -1,47 +0,0 @@
-// 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.agent.api.routing;
-
-import java.util.List;
-
-import com.cloud.agent.api.to.StaticNatRuleTO;
-
-public class SetStaticNatRulesCommand extends NetworkElementCommand{
-
-    StaticNatRuleTO[] rules;
-    Long vpcId;
-
-    protected SetStaticNatRulesCommand() {
-    }
-
-    public SetStaticNatRulesCommand(List<? extends StaticNatRuleTO> staticNatRules, Long vpcId) {
-        rules = new StaticNatRuleTO[staticNatRules.size()];
-        int i = 0;
-        for (StaticNatRuleTO rule : staticNatRules) {
-            rules[i++] = rule;
-        }
-        this.vpcId = vpcId;
-    }
-
-    public StaticNatRuleTO[] getRules() {
-        return rules;
-    }
-
-    public Long getVpcId() {
-        return vpcId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java b/api/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java
deleted file mode 100644
index 76f5bb9..0000000
--- a/api/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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.agent.api.routing;
-
-import com.cloud.agent.api.Answer;
-
-public class SetStaticRouteAnswer extends Answer{
-    String[] results;
-
-    protected SetStaticRouteAnswer() {
-    }
-
-    public SetStaticRouteAnswer(SetStaticRouteCommand cmd, boolean success, String[] results) {
-        super(cmd, success, null);
-        assert (cmd.getStaticRoutes().length == results.length) : "Static routes and their results should be the same length";
-        this.results = results;
-    }
-
-    public String[] getResults() {
-        return results;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/SetStaticRouteCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/SetStaticRouteCommand.java b/api/src/com/cloud/agent/api/routing/SetStaticRouteCommand.java
deleted file mode 100644
index c9c2056..0000000
--- a/api/src/com/cloud/agent/api/routing/SetStaticRouteCommand.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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.agent.api.routing;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import com.cloud.network.vpc.StaticRoute;
-import com.cloud.network.vpc.StaticRouteProfile;
-import com.cloud.utils.net.NetUtils;
-
-public class SetStaticRouteCommand extends NetworkElementCommand{
-    StaticRouteProfile[] staticRoutes;
-
-    protected SetStaticRouteCommand() {
-    }
-
-    public SetStaticRouteCommand(List<StaticRouteProfile> staticRoutes) {
-        this.staticRoutes = staticRoutes.toArray(new StaticRouteProfile[staticRoutes.size()]);
-    }
-
-    public StaticRouteProfile[] getStaticRoutes() {
-        return staticRoutes;
-    }
-
-    public String[][] generateSRouteRules() {
-        String [][] result = new String [2][];
-        Set<String> toAdd = new HashSet<String>();
-        for (StaticRouteProfile route: staticRoutes) {
-            /*  example  :  ip:gateway:cidr,
-             */
-            String cidr = route.getCidr();
-            String subnet = NetUtils.getCidrSubNet(cidr);
-            String cidrSize = cidr.split("\\/")[1];
-            String entry;
-            if (route.getState() == StaticRoute.State.Active || route.getState() == StaticRoute.State.Add) {
-                entry = route.getIp4Address() + ":" + route.getGateway() + ":" + subnet + "/" + cidrSize;
-            } else {
-                entry = "Revoke:" + route.getGateway() + ":" + subnet + "/" + cidrSize;
-            }
-            toAdd.add(entry);
-        }
-        result[0] = toAdd.toArray(new String[toAdd.size()]);
-        return result;
-    }
-}


[35/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/WEB-INF/classes/resources/messages_it_IT.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_it_IT.properties b/client/WEB-INF/classes/resources/messages_it_IT.properties
index c6bc2db..78323b0 100644
--- a/client/WEB-INF/classes/resources/messages_it_IT.properties
+++ b/client/WEB-INF/classes/resources/messages_it_IT.properties
@@ -15,6 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
+
 changed.item.properties=Elementi delle propriet\u00e0 modificati
 confirm.enable.s3=Si prega di inserire i valori richiesti per abilitare il supporto per il Secondary Storage di tipo S3
 confirm.enable.swift=Si prega di inserire i valori richiesti per abilitare il supporto per Swift
@@ -432,7 +433,6 @@ label.zone.name=Nome Zona
 label.zones=Zone
 label.zone.type=Tipo di Zona
 label.zoneWizard.trafficType.guest=Guest\: Traffico di rete tra le virtual machine dell\\'utente finale
-label.zoneWizard.trafficType.management=Management\: Traffico di rete tra le risorse interne di CloudStack, incluso qualsiasi componente che comunichi con il Management Server, come ad esempio gli host e le VM di Sistema di CloudStack
 label.zoneWizard.trafficType.public=Public\: Traffico di rete tra la rete internet e le virtual machine nell\\'infrastruttura cloud.
 label.zoneWizard.trafficType.storage=Storage\: Traffico di rete tra i server di primary e secondary storage, come ad esempio i template delle VM e le operazioni di snapshot
 message.acquire.new.ip=Si prega di confermare di voler acquisire un nuovo indirizzo IP per questa rete.


[55/57] [abbrv] git commit: updated refs/heads/master to f84b6ab

Posted by ni...@apache.org.
license check


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

Branch: refs/heads/master
Commit: 941a9a5fb7b688e557e5d02d07db21a18ce8e9cb
Parents: 5f0f100
Author: Nitin Mehta <ni...@citrix.com>
Authored: Sun May 12 14:42:59 2013 +0530
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Sun May 12 14:42:59 2013 +0530

----------------------------------------------------------------------
 .../cloud/metadata/ResourceMetaDataManager.java    |   25 ++++++++++----
 1 files changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/941a9a5f/server/src/com/cloud/metadata/ResourceMetaDataManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/metadata/ResourceMetaDataManager.java b/server/src/com/cloud/metadata/ResourceMetaDataManager.java
index b91fddf..8ec8d23 100644
--- a/server/src/com/cloud/metadata/ResourceMetaDataManager.java
+++ b/server/src/com/cloud/metadata/ResourceMetaDataManager.java
@@ -1,11 +1,22 @@
+/*
+ * 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.metadata;
 
-/**
- * Created with IntelliJ IDEA.
- * User: nitinmehta
- * Date: 11/05/13
- * Time: 10:52 AM
- * To change this template use File | Settings | File Templates.
- */
 public interface ResourceMetaDataManager {
 }


[24/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/SnapshotPolicyVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/SnapshotPolicyVO.java b/core/src/com/cloud/storage/SnapshotPolicyVO.java
deleted file mode 100644
index 4eb4916..0000000
--- a/core/src/com/cloud/storage/SnapshotPolicyVO.java
+++ /dev/null
@@ -1,133 +0,0 @@
-// 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.storage;
-
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.apache.cloudstack.api.Identity;
-import com.cloud.storage.snapshot.SnapshotPolicy;
-import com.cloud.utils.DateUtil.IntervalType;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="snapshot_policy")
-public class SnapshotPolicyVO implements SnapshotPolicy {
-
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    long id;
-
-    @Column(name="volume_id")
-    long volumeId;
-
-    @Column(name="schedule")
-    String schedule;
-
-    @Column(name="timezone")
-    String timezone;
-
-    @Column(name="interval")
-    private short interval;
-
-    @Column(name="max_snaps")
-    private int maxSnaps;
-
-    @Column(name="active")
-    boolean active = false;
-
-    @Column(name="uuid")
-    String uuid;
-
-    public SnapshotPolicyVO() {
-    	this.uuid = UUID.randomUUID().toString();
-    }
-
-    public SnapshotPolicyVO(long volumeId, String schedule, String timezone, IntervalType intvType, int maxSnaps) {
-    	this.volumeId = volumeId;
-        this.schedule = schedule;
-        this.timezone = timezone;
-        this.interval = (short)intvType.ordinal();
-        this.maxSnaps = maxSnaps;
-        this.active = true;
-    	this.uuid = UUID.randomUUID().toString();
-    }
-
-    public long getId() {
-        return id;
-    }
-
-    public long getVolumeId() {
-		return volumeId;
-	}
-
-	public void setSchedule(String schedule) {
-        this.schedule = schedule;
-    }
-
-    public String getSchedule() {
-        return schedule;
-    }
-
-    public void setInterval(short interval) {
-        this.interval = interval;
-    }
-
-    public void setTimezone(String timezone) {
-        this.timezone = timezone;
-    }
-
-    public String getTimezone() {
-        return timezone;
-    }
-
-    public short getInterval() {
-        return interval;
-    }
-
-    public void setMaxSnaps(int maxSnaps) {
-        this.maxSnaps = maxSnaps;
-    }
-
-    public int getMaxSnaps() {
-        return maxSnaps;
-    }
-
-    public boolean isActive() {
-        return active;
-    }
-
-    public void setActive(boolean active) {
-        this.active = active;
-    }
-
-    @Override
-    public String getUuid() {
-    	return this.uuid;
-    }
-
-    public void setUuid(String uuid) {
-    	this.uuid = uuid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/SnapshotScheduleVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/SnapshotScheduleVO.java b/core/src/com/cloud/storage/SnapshotScheduleVO.java
deleted file mode 100644
index 75757c6..0000000
--- a/core/src/com/cloud/storage/SnapshotScheduleVO.java
+++ /dev/null
@@ -1,125 +0,0 @@
-// 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.storage;
-
-import java.util.Date;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import org.apache.cloudstack.api.Identity;
-import com.cloud.storage.snapshot.SnapshotSchedule;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="snapshot_schedule")
-public class SnapshotScheduleVO implements SnapshotSchedule {
-
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-	@Column(name="id")
-	long id;
-
-    // DB constraint: For a given volume and policyId, there will only be one entry in this table.
-    @Column(name="volume_id")
-    long volumeId;
-
-    @Column(name="policy_id")
-    long policyId;
-
-    @Column(name="scheduled_timestamp")
-    @Temporal(value=TemporalType.TIMESTAMP)
-    Date scheduledTimestamp;
-
-    @Column(name="async_job_id")
-    Long asyncJobId;
-
-    @Column(name="snapshot_id")
-    Long snapshotId;
-
-    @Column(name="uuid")
-    String uuid = UUID.randomUUID().toString();
-
-    public SnapshotScheduleVO() { }
-
-    public SnapshotScheduleVO(long volumeId, long policyId, Date scheduledTimestamp) {
-        this.volumeId = volumeId;
-        this.policyId = policyId;
-        this.scheduledTimestamp = scheduledTimestamp;
-        this.snapshotId = null;
-        this.asyncJobId = null;
-    }
-
-    public long getId() {
-        return id;
-    }
-
-    public Long getVolumeId() {
-        return volumeId;
-    }
-
-    public Long getPolicyId() {
-        return policyId;
-    }
-
-	public void setPolicyId(long policyId) {
-        this.policyId = policyId;
-    }
-
-    /**
-	 * @return the scheduledTimestamp
-	 */
-	public Date getScheduledTimestamp() {
-		return scheduledTimestamp;
-	}
-
-	public void setScheduledTimestamp(Date scheduledTimestamp) {
-        this.scheduledTimestamp = scheduledTimestamp;
-    }
-
-    public Long getAsyncJobId() {
-	    return asyncJobId;
-	}
-
-	public void setAsyncJobId(Long asyncJobId) {
-	    this.asyncJobId = asyncJobId;
-	}
-
-	public Long getSnapshotId() {
-	    return snapshotId;
-	}
-
-	public void setSnapshotId(Long snapshotId) {
-	    this.snapshotId = snapshotId;
-	}
-
-	@Override
-	public String getUuid() {
-		return this.uuid;
-	}
-
-	public void setUuid(String uuid) {
-		this.uuid = uuid;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/SnapshotVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/SnapshotVO.java b/core/src/com/cloud/storage/SnapshotVO.java
deleted file mode 100644
index 78b96ec..0000000
--- a/core/src/com/cloud/storage/SnapshotVO.java
+++ /dev/null
@@ -1,298 +0,0 @@
-// 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.storage;
-
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.utils.db.GenericDao;
-import com.google.gson.annotations.Expose;
-
-import javax.persistence.*;
-import java.util.Date;
-import java.util.UUID;
-
-@Entity
-@Table(name="snapshots")
-public class SnapshotVO implements Snapshot {
-
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private long id;
-
-    @Column(name="data_center_id")
-    long dataCenterId;
-
-    @Column(name="account_id")
-    long accountId;
-
-    @Column(name="domain_id")
-    long domainId;
-
-    @Column(name="volume_id")
-    Long volumeId;
-
-    @Column(name="disk_offering_id")
-    Long diskOfferingId;
-
-    @Expose
-    @Column(name="path")
-    String path;
-
-    @Expose
-    @Column(name="name")
-    String name;
-
-    @Expose
-    @Column(name="status", updatable = true, nullable=false)
-    @Enumerated(value=EnumType.STRING)
-    private State state;
-
-    @Column(name="snapshot_type")
-    short snapshotType;
-
-    @Column(name="type_description")
-    String typeDescription;
-
-    @Column(name="size")
-    long size;
-
-    @Column(name=GenericDao.CREATED_COLUMN)
-    Date created;
-
-    @Column(name=GenericDao.REMOVED_COLUMN)
-    Date removed;
-
-    @Column(name="backup_snap_id")
-    String backupSnapshotId;
-
-    @Column(name="swift_id")
-    Long swiftId;
-
-    @Column(name="s3_id")
-    Long s3Id;
-
-    @Column(name="sechost_id")
-    Long secHostId;
-
-    @Column(name="prev_snap_id")
-    long prevSnapshotId;
-
-    @Column(name="hypervisor_type")
-    @Enumerated(value=EnumType.STRING)
-    HypervisorType  hypervisorType;
-
-    @Expose
-    @Column(name="version")
-    String version;
-
-    @Column(name="uuid")
-    String uuid;
-
-    public SnapshotVO() {
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    public SnapshotVO(long dcId, long accountId, long domainId, Long volumeId, Long diskOfferingId, String path, String name, short snapshotType, String typeDescription, long size, HypervisorType hypervisorType ) {
-        this.dataCenterId = dcId;
-        this.accountId = accountId;
-        this.domainId = domainId;
-        this.volumeId = volumeId;
-        this.diskOfferingId = diskOfferingId;
-        this.path = path;
-        this.name = name;
-        this.snapshotType = snapshotType;
-        this.typeDescription = typeDescription;
-        this.size = size;
-        this.state = State.Allocated;
-        this.prevSnapshotId = 0;
-        this.hypervisorType = hypervisorType;
-        this.version = "2.2";
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-
-    public long getDataCenterId() {
-        return dataCenterId;
-    }
-
-    @Override
-    public long getAccountId() {
-        return accountId;
-    }
-
-    @Override
-    public long getDomainId() {
-        return domainId;
-    }
-
-    @Override
-    public long getVolumeId() {
-        return volumeId;
-    }
-
-    public long getDiskOfferingId() {
-        return diskOfferingId;
-    }
-
-    public void setVolumeId(Long volumeId) {
-        this.volumeId = volumeId;
-    }
-
-    @Override
-    public String getPath() {
-        return path;
-    }
-
-    public void setPath(String path) {
-        this.path = path;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-    @Override
-    public short getsnapshotType() {
-        return snapshotType;
-    }
-
-    @Override
-    public Type getRecurringType() {
-        if (snapshotType < 0 || snapshotType >= Type.values().length) {
-            return null;
-        }
-        return Type.values()[snapshotType];
-    }
-
-    public Long getSwiftId() {
-        return swiftId;
-    }
-
-    public void setSwiftId(Long swiftId) {
-        this.swiftId = swiftId;
-    }
-
-    public Long getSecHostId() {
-        return secHostId;
-    }
-
-    public void setSecHostId(Long secHostId) {
-        this.secHostId = secHostId;
-    }
-
-    @Override
-    public HypervisorType getHypervisorType() {
-        return hypervisorType;
-    }
-
-    public void setSnapshotType(short snapshotType) {
-        this.snapshotType = snapshotType;
-    }
-
-    @Override
-    public boolean isRecursive(){
-        if ( snapshotType >= Type.HOURLY.ordinal() && snapshotType <= Type.MONTHLY.ordinal() ) {
-            return true;
-        }
-        return false;
-    }
-
-    public long getSize() {
-        return size;
-    }
-
-    public String getTypeDescription() {
-        return typeDescription;
-    }
-    public void setTypeDescription(String typeDescription) {
-        this.typeDescription = typeDescription;
-    }
-
-    public String getVersion() {
-        return version;
-    }
-
-    public void setVersion(String version) {
-        this.version = version;
-    }
-
-    @Override
-    public Date getCreated() {
-        return created;
-    }
-
-    public Date getRemoved() {
-        return removed;
-    }
-
-    @Override
-    public State getState() {
-        return state;
-    }
-
-
-	public void setState(State state) {
-        this.state = state;
-    }
-
-    public String getBackupSnapshotId(){
-        return backupSnapshotId;
-    }
-
-    public long getPrevSnapshotId(){
-        return prevSnapshotId;
-    }
-
-    public void setBackupSnapshotId(String backUpSnapshotId){
-        this.backupSnapshotId = backUpSnapshotId;
-    }
-
-    public void setPrevSnapshotId(long prevSnapshotId){
-        this.prevSnapshotId = prevSnapshotId;
-    }
-
-    public static Type getSnapshotType(String snapshotType) {
-        for ( Type type : Type.values()) {
-            if ( type.equals(snapshotType)) {
-                return type;
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public String getUuid() {
-        return this.uuid;
-    }
-
-    public void setUuid(String uuid) {
-        this.uuid = uuid;
-    }
-
-    public Long getS3Id() {
-        return s3Id;
-    }
-
-    public void setS3Id(Long s3Id) {
-        this.s3Id = s3Id;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/StoragePoolDiscoverer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/StoragePoolDiscoverer.java b/core/src/com/cloud/storage/StoragePoolDiscoverer.java
deleted file mode 100644
index c7dd362..0000000
--- a/core/src/com/cloud/storage/StoragePoolDiscoverer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// 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.storage;
-
-import java.net.URI;
-import java.util.Map;
-
-import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
-
-import com.cloud.exception.DiscoveryException;
-import com.cloud.utils.component.Adapter;
-
-/**
- * Discoverer to find new Storage Pools.
- */
-public interface StoragePoolDiscoverer extends Adapter {
-
-    Map<StoragePoolVO, Map<String, String>> find(long dcId, Long podId, URI uri, Map<String, String> details) throws DiscoveryException;
-    
-    Map<StoragePoolVO, Map<String, String>> find(long dcId, Long podId, URI uri, Map<String, String> details, String username, String password) throws DiscoveryException;
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/StoragePoolHostAssoc.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/StoragePoolHostAssoc.java b/core/src/com/cloud/storage/StoragePoolHostAssoc.java
deleted file mode 100644
index 34326d9..0000000
--- a/core/src/com/cloud/storage/StoragePoolHostAssoc.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// 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.storage;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import java.util.Date;
-
-public interface StoragePoolHostAssoc extends InternalIdentity {
-	
-	long getHostId();
-	
-	long getPoolId();
-	
-	String getLocalPath();
-
-	Date getCreated();
-
-	Date getLastUpdated();
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/StoragePoolHostVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/StoragePoolHostVO.java b/core/src/com/cloud/storage/StoragePoolHostVO.java
deleted file mode 100644
index a8a2bac..0000000
--- a/core/src/com/cloud/storage/StoragePoolHostVO.java
+++ /dev/null
@@ -1,109 +0,0 @@
-// 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.storage;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import com.cloud.utils.db.GenericDaoBase;
-import org.apache.cloudstack.api.InternalIdentity;
-
-/**
- * Join table for storage pools and hosts
- *
- */
-@Entity
-@Table(name="storage_pool_host_ref")
-public class StoragePoolHostVO implements StoragePoolHostAssoc {
-	@Id
-	@GeneratedValue(strategy=GenerationType.IDENTITY)
-	private Long id;
-	
-	@Column(name="pool_id")
-	private long poolId;
-	
-	@Column(name="host_id")
-	private long hostId;
-	
-	@Column(name="local_path")
-	private String localPath;
-	
-	@Column(name=GenericDaoBase.CREATED_COLUMN)
-	private Date created = null;
-	
-	@Column(name="last_updated")
-	@Temporal(value=TemporalType.TIMESTAMP)
-	private Date lastUpdated = null;
-	
-	
-	public StoragePoolHostVO() {
-		super();
-	}
-
-
-	public StoragePoolHostVO(long poolId, long hostId, String localPath) {
-		this.poolId = poolId;
-		this.hostId = hostId;
-		this.localPath = localPath;
-	}
-
-
-	@Override
-	public long getHostId() {
-		return hostId;
-	}
-
-
-    public long getId() {
-        return id;
-    }
-
-
-    @Override
-	public String getLocalPath() {
-		return localPath;
-	}
-
-	@Override
-	public long getPoolId() {
-		return poolId;
-	}
-
-	@Override
-	public Date getCreated() {
-		return created;
-	}
-
-	@Override
-	public Date getLastUpdated() {
-		return lastUpdated;
-	}
-
-
-	public void setLocalPath(String localPath) {
-		this.localPath = localPath;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/StoragePoolWorkVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/StoragePoolWorkVO.java b/core/src/com/cloud/storage/StoragePoolWorkVO.java
deleted file mode 100644
index 440065d..0000000
--- a/core/src/com/cloud/storage/StoragePoolWorkVO.java
+++ /dev/null
@@ -1,118 +0,0 @@
-// 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.storage;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name="storage_pool_work")
-public class StoragePoolWorkVO implements InternalIdentity {
-    
-    public long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public Long getPoolId() {
-        return poolId;
-    }
-
-
-    public void setPoolId(Long poolId) {
-        this.poolId = poolId;
-    }
-
-
-    public boolean isStoppedForMaintenance() {
-        return stoppedForMaintenance;
-    }
-
-
-    public void setStoppedForMaintenance(boolean stoppedForMaintenance) {
-        this.stoppedForMaintenance = stoppedForMaintenance;
-    }
-
-
-    public boolean isStartedAfterMaintenance() {
-        return startedAfterMaintenance;
-    }
-
-    public void setStartedAfterMaintenance(boolean startedAfterMaintenance) {
-        this.startedAfterMaintenance = startedAfterMaintenance;
-    }
-
-    public Long getVmId() {
-        return vmId;
-    }
-
-    public void setVmId(Long vmId) {
-        this.vmId = vmId;
-    }
-    
-    public Long getManagementServerId() {
-        return managementServerId;
-    }
-
-    public void setManagementServerId(Long managementServerId) {
-        this.managementServerId = managementServerId;
-    }
-
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private Long id;
-    
-    @Column(name="pool_id")
-    private Long poolId;
-
-    @Column(name="vm_id")
-    private Long vmId;
-    
-    @Column(name="stopped_for_maintenance")
-    private boolean stoppedForMaintenance;
-    
-    @Column(name="started_after_maintenance")
-    private boolean startedAfterMaintenance;
-
-    @Column(name="mgmt_server_id")
-    private Long managementServerId;
-    
-
-    public StoragePoolWorkVO(long vmId, long poolId, boolean stoppedForMaintenance, boolean startedAfterMaintenance, long mgmtServerId) {
-        super();
-        this.vmId = vmId;
-        this.poolId = poolId;
-        this.stoppedForMaintenance = stoppedForMaintenance;
-        this.startedAfterMaintenance = startedAfterMaintenance;
-        this.managementServerId = mgmtServerId;
-    }
-    
-    public StoragePoolWorkVO() {
-        
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/SwiftVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/SwiftVO.java b/core/src/com/cloud/storage/SwiftVO.java
deleted file mode 100644
index c99f0ef..0000000
--- a/core/src/com/cloud/storage/SwiftVO.java
+++ /dev/null
@@ -1,108 +0,0 @@
-// 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.storage;
-
-import java.util.Date;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import com.cloud.agent.api.to.SwiftTO;
-import org.apache.cloudstack.api.Identity;
-import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="swift")
-public class SwiftVO implements Swift, InternalIdentity {
-
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private long id;
-
-    @Column(name="url")
-    String url;
-
-    @Column(name="account")
-    String account;
-
-    @Column(name="username")
-    String userName;
-
-    @Column(name="key")
-    String key;
-
-    @Column(name="uuid")
-    String uuid = UUID.randomUUID().toString();
-
-    @Column(name = GenericDao.CREATED_COLUMN)
-    private Date created;
-
-    public SwiftVO() { }
-
-    public SwiftVO(String url, String account, String userName, String key) {
-        this.url = url;
-        this.account = account;
-        this.userName = userName;
-        this.key = key;
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-    @Override
-    public String getUrl() {
-        return url;
-    }
-    @Override
-    public String getAccount() {
-        return account;
-    }
-    @Override
-    public String getUserName() {
-        return userName;
-    }
-    @Override
-    public String getKey() {
-        return key;
-    }
-
-    public Date getCreated() {
-        return created;
-    }
-
-    @Override
-    public SwiftTO toSwiftTO() {
-        return new SwiftTO(getId(), getUrl(), getAccount(), getUserName(), getKey());
-    }
-
-    @Override
-    public String getUuid() {
-    	return this.uuid;
-    }
-
-    public void setUuid(String uuid) {
-    	this.uuid = uuid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/UploadVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/UploadVO.java b/core/src/com/cloud/storage/UploadVO.java
deleted file mode 100755
index d761bf1..0000000
--- a/core/src/com/cloud/storage/UploadVO.java
+++ /dev/null
@@ -1,268 +0,0 @@
-// 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.storage;
-
-import java.util.Date;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import com.cloud.utils.NumbersUtil;
-import com.cloud.utils.db.GenericDaoBase;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="upload")
-public class UploadVO implements Upload {
-	@Id
-	@GeneratedValue(strategy=GenerationType.IDENTITY)
-	long id;
-
-    @Column(name="uuid")
-	private String uuid;
-
-	@Column(name="host_id")
-	private long hostId;
-
-	@Column(name="type_id")
-	private long typeId;
-
-	@Column(name=GenericDaoBase.CREATED_COLUMN)
-	private Date created = null;
-
-	@Column(name="last_updated")
-	@Temporal(value=TemporalType.TIMESTAMP)
-	private Date lastUpdated = null;
-
-	@Column (name="upload_pct")
-	private int uploadPercent;
-
-	@Column (name="type")
-	@Enumerated(EnumType.STRING)
-	private Type type;
-
-	@Column (name="mode")
-    @Enumerated(EnumType.STRING)
-    private Mode mode = Mode.FTP_UPLOAD;
-
-	@Column (name="upload_state")
-	@Enumerated(EnumType.STRING)
-	private Status uploadState;
-
-	@Column (name="error_str")
-	private String errorString;
-
-	@Column (name="job_id")
-	private String jobId;
-
-	@Column (name="url")
-	private String uploadUrl;
-
-	@Column (name="install_path")
-	private String installPath;
-
-	@Override
-    public long getHostId() {
-		return hostId;
-	}
-
-	public void setHostId(long hostId) {
-		this.hostId = hostId;
-	}
-
-	@Override
-    public long getId() {
-		return id;
-	}
-
-
-	public String getUuid() {
-        return uuid;
-    }
-
-    @Override
-    public Date getCreated() {
-		return created;
-	}
-
-	@Override
-    public Date getLastUpdated() {
-		return lastUpdated;
-	}
-
-	public void setLastUpdated(Date date) {
-	    lastUpdated = date;
-	}
-
-	public UploadVO(long hostId, long templateId) {
-		super();
-		this.hostId = hostId;
-		this.typeId = templateId;
-		this.uuid = UUID.randomUUID().toString();
-	}
-
-	public UploadVO(long hostId, long typeId, Date lastUpdated,
-			Status uploadState, Type type,
-			String uploadUrl, Mode mode) {
-		super();
-		this.hostId = hostId;
-		this.typeId = typeId;
-		this.lastUpdated = lastUpdated;
-		this.uploadState = uploadState;
-		this.mode = mode;
-		this.type = type;
-		this.uploadUrl = uploadUrl;
-        this.uuid = UUID.randomUUID().toString();
-	}
-
-	public UploadVO(long hostId, long typeId, Date lastUpdated,
-            Status uploadState, int uploadPercent, Type type,
-            Mode mode) {
-        super();
-        this.hostId = hostId;
-        this.typeId = typeId;
-        this.lastUpdated = lastUpdated;
-        this.uploadState = uploadState;
-        this.uploadPercent = uploadPercent;
-        this.type = type;
-        this.mode = mode;
-        this.uuid = UUID.randomUUID().toString();
-
-    }
-
-	protected UploadVO() {
-	}
-
-	public UploadVO(Long uploadId) {
-		this.id = uploadId;
-	}
-
-	public void setErrorString(String errorString) {
-		this.errorString = errorString;
-	}
-
-	@Override
-    public String getErrorString() {
-		return errorString;
-	}
-
-	public void setJobId(String jobId) {
-		this.jobId = jobId;
-	}
-
-	@Override
-    public String getJobId() {
-		return jobId;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (obj instanceof UploadVO) {
-			UploadVO other = (UploadVO)obj;
-		   return (this.typeId==other.getTypeId() && this.hostId==other.getHostId() && this.type == other.getType());
-		}
-		return false;
-	}
-
-	@Override
-	public int hashCode() {
-		return NumbersUtil.hash(id);
-	}
-
-	@Override
-    public int getUploadPercent() {
-		return uploadPercent;
-	}
-
-	public void setUploadPercent(int uploadPercent) {
-		this.uploadPercent = uploadPercent;
-	}
-
-	@Override
-    public Status getUploadState() {
-		return uploadState;
-	}
-
-	public void setUploadState(Status uploadState) {
-		this.uploadState = uploadState;
-	}
-
-	@Override
-    public long getTypeId() {
-		return typeId;
-	}
-
-	public void setTypeId(long typeId) {
-		this.typeId = typeId;
-	}
-
-	@Override
-    public Type getType() {
-		return type;
-	}
-
-	public void setType(Type type) {
-		this.type = type;
-	}
-
-	@Override
-    public Mode getMode() {
-        return mode;
-    }
-
-    public void setMode(Mode mode) {
-        this.mode = mode;
-    }
-
-    @Override
-    public String getUploadUrl() {
-		return uploadUrl;
-	}
-
-	public void setUploadUrl(String uploadUrl) {
-		this.uploadUrl = uploadUrl;
-	}
-
-	@Override
-    public void setId(Long id) {
-		this.id = id;
-	}
-
-	@Override
-    public void setCreated(Date created) {
-		this.created = created;
-	}
-
-    @Override
-    public String getInstallPath() {
-        return installPath;
-    }
-
-    @Override
-    public void setInstallPath(String installPath) {
-        this.installPath = installPath;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/VMTemplateDetailVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/VMTemplateDetailVO.java b/core/src/com/cloud/storage/VMTemplateDetailVO.java
deleted file mode 100644
index c007802..0000000
--- a/core/src/com/cloud/storage/VMTemplateDetailVO.java
+++ /dev/null
@@ -1,84 +0,0 @@
-// 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.storage;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name="vm_template_details")
-public class VMTemplateDetailVO implements InternalIdentity {
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private long id;
-    
-    @Column(name="template_id")
-    private long templateId;
-    
-    @Column(name="name")
-    private String name;
-    
-    @Column(name="value", length=1024)
-    private String value;
-	
-    public VMTemplateDetailVO() {}
-    
-    public VMTemplateDetailVO(long templateId, String name, String value) {
-    	this.templateId = templateId;
-    	this.name = name;
-    	this.value = value;
-    }
-
-	public long getId() {
-		return id;
-	}
-
-	public long getTemplateId() {
-		return templateId;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public String getValue() {
-		return value;
-	}
-
-	public void setId(long id) {
-		this.id = id;
-	}
-
-	public void setTemplateId(long templateId) {
-		this.templateId = templateId;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public void setValue(String value) {
-		this.value = value;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/VMTemplateHostVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/VMTemplateHostVO.java b/core/src/com/cloud/storage/VMTemplateHostVO.java
deleted file mode 100755
index b8dfc41..0000000
--- a/core/src/com/cloud/storage/VMTemplateHostVO.java
+++ /dev/null
@@ -1,322 +0,0 @@
-// 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.storage;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
-
-import com.cloud.utils.db.GenericDaoBase;
-
-/**
- * Join table for storage hosts and templates
- *
- */
-@Entity
-@Table(name="template_host_ref")
-public class VMTemplateHostVO implements VMTemplateStorageResourceAssoc, DataObjectInStore {
-	@Id
-	@GeneratedValue(strategy=GenerationType.IDENTITY)
-	Long id;
-	
-	@Column(name="host_id")
-	private long hostId;
-	
-	@Column(name="template_id")
-	private long templateId;
-	
-	@Column(name=GenericDaoBase.CREATED_COLUMN)
-	private Date created = null;
-	
-	@Column(name="last_updated")
-	@Temporal(value=TemporalType.TIMESTAMP)
-	private Date lastUpdated = null;
-	
-	@Column (name="download_pct")
-	private int downloadPercent;
-	
-	@Column (name="size")
-	private long size;
-	
-	@Column (name="physical_size")
-	private long physicalSize;
-	
-	@Column (name="download_state")
-	@Enumerated(EnumType.STRING)
-	private Status downloadState;
-	
-	@Column (name="local_path")
-	private String localDownloadPath;
-	
-	@Column (name="error_str")
-	private String errorString;
-	
-	@Column (name="job_id")
-	private String jobId;	
-	
-	@Column (name="install_path")
-    private String installPath;
-	
-	@Column (name="url")
-	private String downloadUrl;
-
-	@Column(name="is_copy")
-	private boolean isCopy = false;
-    
-    @Column(name="destroyed")
-    boolean destroyed = false;
-    
-    @Column(name="update_count", updatable = true, nullable=false)
-    protected long updatedCount;
-    
-    @Column(name = "updated")
-    @Temporal(value = TemporalType.TIMESTAMP)
-    Date updated;
-    
-    @Column(name = "state")
-    @Enumerated(EnumType.STRING)
-    ObjectInDataStoreStateMachine.State state;
-    
-    
-	@Override
-    public String getInstallPath() {
-		return installPath;
-	}
-
-	public long getHostId() {
-		return hostId;
-	}
-
-	public void setHostId(long hostId) {
-		this.hostId = hostId;
-	}
-
-	@Override
-    public long getTemplateId() {
-		return templateId;
-	}
-
-	@Override
-    public void setTemplateId(long templateId) {
-		this.templateId = templateId;
-	}
-
-	@Override
-    public int getDownloadPercent() {
-		return downloadPercent;
-	}
-
-	@Override
-    public void setDownloadPercent(int downloadPercent) {
-		this.downloadPercent = downloadPercent;
-	}
-
-	@Override
-    public void setDownloadState(Status downloadState) {
-		this.downloadState = downloadState;
-	}
-
-	@Override
-    public long getId() {
-		return id;
-	}
-
-	@Override
-    public Date getCreated() {
-		return created;
-	}
-
-	@Override
-    public Date getLastUpdated() {
-		return lastUpdated;
-	}
-	
-	@Override
-    public void setLastUpdated(Date date) {
-	    lastUpdated = date;
-	}
-	
-	@Override
-    public void setInstallPath(String installPath) {
-	    this.installPath = installPath;
-	}
-
-	@Override
-    public Status getDownloadState() {
-		return downloadState;
-	}
-
-	public VMTemplateHostVO(long hostId, long templateId) {
-		super();
-		this.hostId = hostId;
-		this.templateId = templateId;
-		this.state = ObjectInDataStoreStateMachine.State.Allocated;
-	}
-
-	public VMTemplateHostVO(long hostId, long templateId, Date lastUpdated,
-			int downloadPercent, Status downloadState,
-			String localDownloadPath, String errorString, String jobId,
-			String installPath, String downloadUrl) {
-		super();
-		this.hostId = hostId;
-		this.templateId = templateId;
-		this.lastUpdated = lastUpdated;
-		this.downloadPercent = downloadPercent;
-		this.downloadState = downloadState;
-		this.localDownloadPath = localDownloadPath;
-		this.errorString = errorString;
-		this.jobId = jobId;
-		this.installPath = installPath;
-		this.setDownloadUrl(downloadUrl);
-	}
-
-	protected VMTemplateHostVO() {
-		
-	}
-
-	@Override
-    public void setLocalDownloadPath(String localPath) {
-		this.localDownloadPath = localPath;
-	}
-
-	@Override
-    public String getLocalDownloadPath() {
-		return localDownloadPath;
-	}
-
-	@Override
-    public void setErrorString(String errorString) {
-		this.errorString = errorString;
-	}
-
-	@Override
-    public String getErrorString() {
-		return errorString;
-	}
-
-	@Override
-    public void setJobId(String jobId) {
-		this.jobId = jobId;
-	}
-
-	@Override
-    public String getJobId() {
-		return jobId;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (obj instanceof VMTemplateHostVO) {
-			VMTemplateHostVO other = (VMTemplateHostVO)obj;
-			return (this.templateId==other.getTemplateId() && this.hostId==other.getHostId());		   
-		}
-		return false;
-	}
-
-	@Override
-	public int hashCode() {
-		Long tid = new Long(templateId);
-		Long hid = new Long(hostId);
-		return tid.hashCode()+hid.hashCode();
-	}
-
-    public void setSize(long size) {
-        this.size = size;
-    }
-
-    public long getSize() {
-        return size;
-    }
-	
-    
-    public void setPhysicalSize(long physicalSize) {
-        this.physicalSize = physicalSize;
-    }
-
-    public long getPhysicalSize() {
-        return physicalSize;
-    }
-
-    public void setDestroyed(boolean destroyed) {
-    	this.destroyed = destroyed;
-    }
-
-    public boolean getDestroyed() {
-    	return destroyed;
-    }
-
-	public void setDownloadUrl(String downloadUrl) {
-		this.downloadUrl = downloadUrl;
-	}
-
-	public String getDownloadUrl() {
-		return downloadUrl;
-	}
-
-	public void setCopy(boolean isCopy) {
-		this.isCopy = isCopy;
-	}
-
-	public boolean isCopy() {
-		return isCopy;
-	}
-	
-	@Override
-    public long getTemplateSize() {
-	    return -1;
-	}
-	
-	@Override
-    public String toString() {
-	    return new StringBuilder("TmplHost[").append(id).append("-").append(templateId).append("-").append(hostId).append(installPath).append("]").toString();
-	}
-
-    @Override
-    public ObjectInDataStoreStateMachine.State getState() {
-        // TODO Auto-generated method stub
-        return this.state;
-    }
-    
-    public long getUpdatedCount() {
-        return this.updatedCount;
-    }
-    
-    public void incrUpdatedCount() {
-        this.updatedCount++;
-    }
-
-    public void decrUpdatedCount() {
-        this.updatedCount--;
-    }
-    
-    public Date getUpdated() {
-        return updated;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/VMTemplateS3VO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/VMTemplateS3VO.java b/core/src/com/cloud/storage/VMTemplateS3VO.java
deleted file mode 100644
index 02f3ff5..0000000
--- a/core/src/com/cloud/storage/VMTemplateS3VO.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * 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.storage;
-
-import com.cloud.utils.db.GenericDaoBase;
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import java.text.DateFormat;
-import java.util.Date;
-
-@Entity
-@Table(name = "template_s3_ref")
-public class VMTemplateS3VO implements InternalIdentity {
-
-    public static final String S3_ID_COLUMN_NAME = "s3_id";
-
-    public static final String TEMPLATE_ID_COLUMN_NAME = "template_id";
-
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    private long id;
-
-    @Column(name = S3_ID_COLUMN_NAME)
-    private long s3Id;
-
-    @Column(name = TEMPLATE_ID_COLUMN_NAME)
-    private long templateId;
-
-    @Column(name = GenericDaoBase.CREATED_COLUMN)
-    private Date created;
-
-    @Column(name = "size")
-    private Long size;
-
-    @Column(name = "physical_size")
-    private Long physicalSize;
-
-    public VMTemplateS3VO() {
-        super();
-    }
-
-    public VMTemplateS3VO(final long s3Id, final long templateId,
-            final Date created, final Long size, final Long physicalSize) {
-
-        super();
-
-        this.s3Id = s3Id;
-        this.templateId = templateId;
-        this.created = created;
-        this.size = size;
-        this.physicalSize = physicalSize;
-
-    }
-
-    @Override
-    public boolean equals(final Object thatObject) {
-
-        if (this == thatObject) {
-            return true;
-        }
-
-        if (thatObject == null || getClass() != thatObject.getClass()) {
-            return false;
-        }
-
-        final VMTemplateS3VO thatVMTemplateS3VO = (VMTemplateS3VO) thatObject;
-
-        if (this.id != thatVMTemplateS3VO.id) {
-            return false;
-        }
-
-        if (this.s3Id != thatVMTemplateS3VO.s3Id) {
-            return false;
-        }
-
-        if (this.templateId != thatVMTemplateS3VO.templateId) {
-            return false;
-        }
-
-        if (this.created != null ? !created.equals(thatVMTemplateS3VO.created)
-                : thatVMTemplateS3VO.created != null) {
-            return false;
-        }
-
-        if (this.physicalSize != null ? !physicalSize
-                .equals(thatVMTemplateS3VO.physicalSize)
-                : thatVMTemplateS3VO.physicalSize != null) {
-            return false;
-        }
-
-        if (this.size != null ? !size.equals(thatVMTemplateS3VO.size)
-                : thatVMTemplateS3VO.size != null) {
-            return false;
-        }
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-
-        int result = (int) (this.id ^ (this.id >>> 32));
-
-        result = 31 * result + (int) (this.s3Id ^ (this.s3Id >>> 32));
-        result = 31 * result
-                + (int) (this.templateId ^ (this.templateId >>> 32));
-        result = 31 * result
-                + (this.created != null ? this.created.hashCode() : 0);
-        result = 31 * result + (this.size != null ? this.size.hashCode() : 0);
-        result = 31
-                * result
-                + (this.physicalSize != null ? this.physicalSize.hashCode() : 0);
-
-        return result;
-
-    }
-
-    public long getId() {
-        return this.id;
-    }
-
-    public void setId(final long id) {
-        this.id = id;
-    }
-
-    public long getS3Id() {
-        return this.s3Id;
-    }
-
-    public void setS3Id(final long s3Id) {
-        this.s3Id = s3Id;
-    }
-
-    public long getTemplateId() {
-        return this.templateId;
-    }
-
-    public void setTemplateId(final long templateId) {
-        this.templateId = templateId;
-    }
-
-    public Date getCreated() {
-        return this.created;
-    }
-
-    public void setCreated(final Date created) {
-        this.created = created;
-    }
-
-    public Long getSize() {
-        return this.size;
-    }
-
-    public void setSize(final Long size) {
-        this.size = size;
-    }
-
-    public Long getPhysicalSize() {
-        return this.physicalSize;
-    }
-
-    public void setPhysicalSize(final Long physicalSize) {
-        this.physicalSize = physicalSize;
-    }
-
-    @Override
-    public String toString() {
-
-        final StringBuilder stringBuilder = new StringBuilder(
-                "VMTemplateS3VO [ id: ").append(id).append(", created: ")
-                .append(DateFormat.getDateTimeInstance().format(created))
-                .append(", physicalSize: ").append(physicalSize)
-                .append(", size: ").append(size).append(", templateId: ")
-                .append(templateId).append(", s3Id: ").append(s3Id)
-                .append(" ]");
-
-        return stringBuilder.toString();
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/VMTemplateStoragePoolVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/VMTemplateStoragePoolVO.java b/core/src/com/cloud/storage/VMTemplateStoragePoolVO.java
deleted file mode 100644
index 9b76176..0000000
--- a/core/src/com/cloud/storage/VMTemplateStoragePoolVO.java
+++ /dev/null
@@ -1,275 +0,0 @@
-// 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.storage;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
-import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.State;
-
-import com.cloud.utils.db.GenericDaoBase;
-
-/**
- * Join table for storage pools and templates
- *
- */
-@Entity
-@Table(name="template_spool_ref")
-public class VMTemplateStoragePoolVO implements VMTemplateStorageResourceAssoc, DataObjectInStore {
-	@Id
-	@GeneratedValue(strategy=GenerationType.IDENTITY)
-	long id;
-	
-	@Column(name="pool_id")
-	private long poolId;
-	
-	@Column(name="template_id") long templateId;
-	
-	@Column(name=GenericDaoBase.CREATED_COLUMN) Date created = null;
-	
-	@Column(name="last_updated")
-	@Temporal(value=TemporalType.TIMESTAMP) Date lastUpdated = null;
-	
-	@Column (name="download_pct") int downloadPercent;
-	
-	@Column (name="download_state")
-	@Enumerated(EnumType.STRING) Status downloadState;
-	
-	@Column (name="local_path") String localDownloadPath;
-	
-	@Column (name="error_str") String errorString;
-	
-	@Column (name="job_id") String jobId;
-	
-	@Column (name="install_path") String installPath;
-	
-	@Column (name="template_size") long templateSize;
-	
-	@Column (name="marked_for_gc") boolean markedForGC;
-
-	@Column(name="update_count", updatable = true, nullable=false)
-	protected long updatedCount;
-
-	@Column(name = "updated")
-	@Temporal(value = TemporalType.TIMESTAMP)
-	Date updated;
-
-	@Column(name = "state")
-	@Enumerated(EnumType.STRING)
-	ObjectInDataStoreStateMachine.State state;
-
-	@Override
-    public String getInstallPath() {
-		return installPath;
-	}
-	
-	@Override
-    public long getTemplateSize() {
-		return templateSize;
-	}
-
-	public long getPoolId() {
-		return poolId;
-	}
-
-	public void setpoolId(long poolId) {
-		this.poolId = poolId;
-	}
-
-	@Override
-    public long getTemplateId() {
-		return templateId;
-	}
-
-	@Override
-    public void setTemplateId(long templateId) {
-		this.templateId = templateId;
-	}
-
-	@Override
-    public int getDownloadPercent() {
-		return downloadPercent;
-	}
-
-	@Override
-    public void setDownloadPercent(int downloadPercent) {
-		this.downloadPercent = downloadPercent;
-	}
-
-	@Override
-    public void setDownloadState(Status downloadState) {
-		this.downloadState = downloadState;
-	}
-
-	@Override
-    public long getId() {
-		return id;
-	}
-
-	@Override
-    public Date getCreated() {
-		return created;
-	}
-
-	@Override
-    public Date getLastUpdated() {
-		return lastUpdated;
-	}
-	
-	@Override
-    public void setLastUpdated(Date date) {
-	    lastUpdated = date;
-	}
-	
-	@Override
-    public void setInstallPath(String installPath) {
-	    this.installPath = installPath;
-	}
-
-	@Override
-    public Status getDownloadState() {
-		return downloadState;
-	}
-
-	public VMTemplateStoragePoolVO(long poolId, long templateId) {
-		super();
-		this.poolId = poolId;
-		this.templateId = templateId;
-		this.downloadState = Status.NOT_DOWNLOADED;
-		this.state = ObjectInDataStoreStateMachine.State.Allocated;
-		this.markedForGC = false;
-	}
-
-	public VMTemplateStoragePoolVO(long poolId, long templateId, Date lastUpdated,
-			int downloadPercent, Status downloadState,
-			String localDownloadPath, String errorString, String jobId,
-			String installPath, long templateSize) {
-		super();
-		this.poolId = poolId;
-		this.templateId = templateId;
-		this.lastUpdated = lastUpdated;
-		this.downloadPercent = downloadPercent;
-		this.downloadState = downloadState;
-		this.localDownloadPath = localDownloadPath;
-		this.errorString = errorString;
-		this.jobId = jobId;
-		this.installPath = installPath;
-		this.templateSize = templateSize;
-	}
-
-	protected VMTemplateStoragePoolVO() {
-		
-	}
-
-	@Override
-    public void setLocalDownloadPath(String localPath) {
-		this.localDownloadPath = localPath;
-	}
-
-	@Override
-    public String getLocalDownloadPath() {
-		return localDownloadPath;
-	}
-
-	@Override
-    public void setErrorString(String errorString) {
-		this.errorString = errorString;
-	}
-
-	@Override
-    public String getErrorString() {
-		return errorString;
-	}
-
-	@Override
-    public void setJobId(String jobId) {
-		this.jobId = jobId;
-	}
-
-	@Override
-    public String getJobId() {
-		return jobId;
-	}
-	
-	public void setTemplateSize(long templateSize) {
-		this.templateSize = templateSize;
-	}
-	
-	public boolean getMarkedForGC() {
-		return markedForGC;
-	}
-	
-	public void setMarkedForGC(boolean markedForGC) {
-		this.markedForGC = markedForGC;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (obj instanceof VMTemplateStoragePoolVO) {
-		   VMTemplateStoragePoolVO other = (VMTemplateStoragePoolVO)obj;
-		   return (this.templateId==other.getTemplateId() && this.poolId==other.getPoolId());
-		}
-		return false;
-	}
-
-	@Override
-	public int hashCode() {
-		Long tid = new Long(templateId);
-		Long hid = new Long(poolId);
-		return tid.hashCode()+hid.hashCode();
-	}
-	
-	@Override
-    public String toString() {
-	    return new StringBuilder("TmplPool[").append(id).append("-").append(templateId).append("-").append("poolId").append("-").append(installPath).append("]").toString();
-	}
-
-    @Override
-    public State getState() {
-        return this.state;
-    }
-    
-    public long getUpdatedCount() {
-        return this.updatedCount;
-    }
-    
-    public void incrUpdatedCount() {
-        this.updatedCount++;
-    }
-
-    public void decrUpdatedCount() {
-        this.updatedCount--;
-    }
-    
-    public Date getUpdated() {
-        return updated;
-    }
-    
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/VMTemplateSwiftVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/VMTemplateSwiftVO.java b/core/src/com/cloud/storage/VMTemplateSwiftVO.java
deleted file mode 100755
index 6c7a73d..0000000
--- a/core/src/com/cloud/storage/VMTemplateSwiftVO.java
+++ /dev/null
@@ -1,107 +0,0 @@
-// 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.storage;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import com.cloud.utils.db.GenericDaoBase;
-import org.apache.cloudstack.api.InternalIdentity;
-
-/**
- * Join table for swift and templates
- * 
- * 
- */
-@Entity
-@Table(name = "template_swift_ref")
-public class VMTemplateSwiftVO implements InternalIdentity {
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    Long id;
-
-    @Column(name = "swift_id")
-    private long swiftId;
-
-    @Column(name = "template_id")
-    private long templateId;
-
-    @Column(name = GenericDaoBase.CREATED_COLUMN)
-    private Date created = null;
-
-    @Column(name = "path")
-    private String path;
-
-    @Column(name = "size")
-    private long size;
-
-    @Column(name = "physical_size")
-    private long physicalSize;
-
-    public VMTemplateSwiftVO(long swiftId, long templateId, Date created, String path, long size, long physicalSize) {
-        this.swiftId = swiftId;
-        this.templateId = templateId;
-        this.created = created;
-        this.path = path;
-        this.size = size;
-        this.physicalSize = physicalSize;
-    }
-
-    protected VMTemplateSwiftVO() {
-
-    }
-
-    public long getTemplateId() {
-        return templateId;
-    }
-
-    public long getId() {
-        return id;
-    }
-
-    public Date getCreated() {
-        return created;
-    }
-
-    public String getPath() {
-        return path;
-    }
-
-    public long getSwiftId() {
-        return swiftId;
-    }
-
-    public long getSize() {
-        return size;
-    }
-
-    public long getPhysicalSize() {
-        return physicalSize;
-    }
-
-    @Override
-    public String toString() {
-        return new StringBuilder("TmplSwift[").append(id).append("-").append(templateId).append("-").append(swiftId).append("]").toString();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/VMTemplateVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/VMTemplateVO.java b/core/src/com/cloud/storage/VMTemplateVO.java
deleted file mode 100755
index e643d75..0000000
--- a/core/src/com/cloud/storage/VMTemplateVO.java
+++ /dev/null
@@ -1,534 +0,0 @@
-// 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.storage;
-
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState;
-
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.storage.Storage.ImageFormat;
-import com.cloud.storage.Storage.TemplateType;
-import com.cloud.template.VirtualMachineTemplate;
-import com.cloud.utils.db.GenericDao;
-import com.cloud.utils.fsm.StateObject;
-
-@Entity
-@Table(name="vm_template")
-public class VMTemplateVO implements VirtualMachineTemplate, StateObject<TemplateState> {
-    @Id
-    @TableGenerator(name="vm_template_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="vm_template_seq", allocationSize=1)
-    @Column(name="id", nullable = false)
-    private long id;
-
-    @Column(name="format")
-    private Storage.ImageFormat format;
-
-    @Column(name="unique_name")
-    private String uniqueName;
-
-    @Column(name="name")
-    private String name = null;
-
-    @Column(name="public")
-    private boolean publicTemplate = true;
-
-    @Column(name="featured")
-    private boolean featured;
-
-    @Column(name="type")
-    private Storage.TemplateType templateType;
-
-    @Column(name="url")
-    private String url = null;
-
-    @Column(name="hvm")
-    private boolean requiresHvm;
-
-    @Column(name="bits")
-    private int bits;
-
-    @Temporal(value=TemporalType.TIMESTAMP)
-    @Column(name=GenericDao.CREATED_COLUMN)
-    private Date created = null;
-
-    @Column(name=GenericDao.REMOVED)
-    @Temporal(TemporalType.TIMESTAMP)
-    private Date removed;
-
-    @Column(name="account_id")
-    private long accountId;
-
-    @Column(name="checksum")
-    private String checksum;
-
-    @Column(name="display_text", length=4096)
-    private String displayText;
-
-    @Column(name="enable_password")
-    private boolean enablePassword;
-
-    @Column(name="guest_os_id")
-    private long guestOSId;
-
-    @Column(name="bootable")
-    private boolean bootable = true;
-
-    @Column(name="prepopulate")
-    private boolean prepopulate = false;
-
-    @Column(name="cross_zones")
-    private boolean crossZones = false;
-
-    @Column(name="hypervisor_type")
-    @Enumerated(value=EnumType.STRING)
-    private HypervisorType hypervisorType;
-
-    @Column(name="extractable")
-    private boolean extractable = true;
-
-    @Column(name="source_template_id")
-    private Long sourceTemplateId;
-
-    @Column(name="template_tag")
-    private String templateTag;
-
-    @Column(name="uuid")
-    private String uuid;
-
-    @Column(name="sort_key")
-    private int sortKey;
-
-    @Column(name="enable_sshkey")
-    private boolean enableSshKey;
-    
-    @Column(name = "image_data_store_id")
-    private long imageDataStoreId;
-    
-    @Column(name = "size")
-    private Long size;
-    
-    @Column(name = "state")
-    private TemplateState state;
-    
-    @Column(name="update_count", updatable = true)
-    protected long updatedCount;
-    
-    @Column(name = "updated")
-    @Temporal(value = TemporalType.TIMESTAMP)
-    Date updated;
-
-    @Transient
-    Map details;
-
-    @Override
-    public String getUniqueName() {
-        return uniqueName;
-    }
-
-    public void setUniqueName(String uniqueName) {
-        this.uniqueName = uniqueName;
-    }
-
-    public VMTemplateVO() {
-    	this.uuid = UUID.randomUUID().toString();
-    	this.state = TemplateState.Allocated;
-    }
-
-    /**
-     * Proper constructor for a new vm template.
-     */
-    public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType, Map details) {
-        this(id, generateUniqueName(id, accountId, name), name, format, isPublic, featured, isExtractable, type, url, null, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, hyperType, details);
-    	this.uuid = UUID.randomUUID().toString();
-    	this.state = TemplateState.Allocated;
-    }
-
-    public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType, String templateTag, Map details, boolean sshKeyEnabled) {
-        this(id, name, format, isPublic, featured, isExtractable, type, url, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, hyperType, details);
-        this.templateTag = templateTag;
-    	this.uuid = UUID.randomUUID().toString();
-    	this.state = TemplateState.Allocated;
-    	this.enableSshKey = sshKeyEnabled;
-    }
-
-    public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, TemplateType type, String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType) {
-        this.id = id;
-        this.name = name;
-        this.publicTemplate = isPublic;
-        this.featured = featured;
-        this.templateType = type;
-        this.url = url;
-        this.requiresHvm = requiresHvm;
-        this.bits = bits;
-        this.accountId = accountId;
-        this.checksum = cksum;
-        this.uniqueName = uniqueName;
-        this.displayText = displayText;
-        this.enablePassword = enablePassword;
-        this.format = format;
-        this.created = created;
-        this.guestOSId = guestOSId;
-        this.bootable = bootable;
-        this.hypervisorType = hyperType;
-    	this.uuid = UUID.randomUUID().toString();
-    	this.state = TemplateState.Allocated;
-    }
-
-    // Has an extra attribute - isExtractable
-    public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType, Map details) {
-        this(id, uniqueName, name, format, isPublic, featured, type, url, created, requiresHvm, bits, accountId, cksum,  displayText, enablePassword, guestOSId, bootable, hyperType);
-        this.extractable = isExtractable;
-    	this.uuid = UUID.randomUUID().toString();
-    	this.details = details;
-    }
-
-    public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType, String templateTag, Map details) {
-        this(id, uniqueName, name, format, isPublic, featured, isExtractable, type, url, created, requiresHvm, bits, accountId, cksum,  displayText, enablePassword, guestOSId, bootable, hyperType, details);
-        this.templateTag = templateTag;
-    	this.uuid = UUID.randomUUID().toString();
-    }
-
-    @Override
-    public boolean getEnablePassword() {
-        return enablePassword;
-    }
-
-    @Override
-    public Storage.ImageFormat getFormat() {
-        return format;
-    }
-
-    public void setEnablePassword(boolean enablePassword) {
-        this.enablePassword = enablePassword;
-    }
-
-    public void setFormat(ImageFormat format) {
-        this.format = format;
-    }
-
-    private static String generateUniqueName(long id, long userId, String displayName) {
-        StringBuilder name = new StringBuilder();
-        name.append(id);
-        name.append("-");
-        name.append(userId);
-        name.append("-");
-        name.append(UUID.nameUUIDFromBytes((displayName + System.currentTimeMillis()).getBytes()).toString());
-        return name.toString();
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-
-    @Override
-    public TemplateType getTemplateType() {
-        return templateType;
-    }
-
-    public void setTemplateType(TemplateType type) {
-        this.templateType = type;
-    }
-
-    public boolean requiresHvm() {
-        return requiresHvm;
-    }
-
-    @Override
-    public int getBits() {
-        return bits;
-    }
-
-    public void setBits(int bits) {
-        this.bits = bits;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public Date getRemoved() {
-        return removed;
-    }
-
-    @Override
-    public boolean isPublicTemplate() {
-        return publicTemplate;
-    }
-
-    public void setPublicTemplate(boolean publicTemplate) {
-        this.publicTemplate = publicTemplate;
-    }
-
-    @Override
-    public boolean isFeatured() {
-        return featured;
-    }
-
-    public void setFeatured(boolean featured) {
-        this.featured = featured;
-    }
-
-    @Override
-    public Date getCreated() {
-        return created;
-    }
-
-    @Override
-    public String getUrl() {
-        return url;
-    }
-
-    public void setUrl(String url) {
-        this.url = url;
-    }
-
-    @Override
-    public boolean isRequiresHvm() {
-        return requiresHvm;
-    }
-
-    public void setRequiresHvm(boolean value) {
-        requiresHvm = value;
-    }
-
-    @Override
-    public long getAccountId() {
-        return accountId;
-    }
-
-    @Override
-    public String getChecksum() {
-        return checksum;
-    }
-
-    public void setChecksum(String checksum) {
-        this.checksum = checksum;
-    }
-
-    @Override
-    public String getDisplayText() {
-        return displayText;
-    }
-
-    public void setDisplayText(String displayText) {
-        this.displayText = displayText;
-    }
-
-    @Override
-    public long getGuestOSId() {
-        return guestOSId;
-    }
-
-    public void setGuestOSId(long guestOSId) {
-        this.guestOSId = guestOSId;
-    }
-
-    @Override
-    public boolean isBootable() {
-        return bootable;
-    }
-
-    public void setBootable(boolean bootable) {
-        this.bootable = bootable;
-    }
-
-    public void setPrepopulate(boolean prepopulate) {
-        this.prepopulate = prepopulate;
-    }
-
-    public boolean isPrepopulate() {
-        return prepopulate;
-    }
-
-    public void setCrossZones(boolean crossZones) {
-        this.crossZones = crossZones;
-    }
-
-    @Override
-    public boolean isCrossZones() {
-        return crossZones;
-    }
-
-    @Override
-    public HypervisorType getHypervisorType() {
-        return hypervisorType;
-    }
-
-    public void setHypervisorType(HypervisorType hyperType) {
-        hypervisorType = hyperType;
-    }
-
-    @Override
-    public boolean isExtractable() {
-        return extractable;
-    }
-
-    public void setExtractable(boolean extractable) {
-        this.extractable = extractable;
-    }
-
-    @Override
-    public Long getSourceTemplateId() {
-        return sourceTemplateId;
-    }
-
-    public void setSourceTemplateId(Long sourceTemplateId) {
-        this.sourceTemplateId = sourceTemplateId;
-    }
-
-    @Override
-    public String getTemplateTag() {
-        return templateTag;
-    }
-
-    public void setTemplateTag(String templateTag) {
-        this.templateTag = templateTag;
-    }
-
-    @Override
-    public long getDomainId() {
-        return -1;
-    }
-
-    @Override
-    public String getUuid() {
-    	return this.uuid;
-    }
-
-    public void setUuid(String uuid) {
-    	this.uuid = uuid;
-    }
-
-    public Map getDetails() {
-    	return this.details;
-    }
-
-    public void setDetails(Map details) {
-    	this.details = details;
-    }
-
-    @Override
-    public boolean equals(Object that) {
-        if (this == that ) {
-            return true;
-        }
-        if (!(that instanceof VMTemplateVO)){
-            return false;
-        }
-        VMTemplateVO other = (VMTemplateVO)that;
-
-        return ((this.getUniqueName().equals(other.getUniqueName())));
-    }
-
-    @Override
-    public int hashCode() {
-        return uniqueName.hashCode();
-    }
-
-    @Transient
-    String toString;
-    @Override
-    public String toString() {
-        if (toString == null) {
-            toString = new StringBuilder("Tmpl[").append(id).append("-").append(format).append("-").append(uniqueName).toString();
-        }
-        return toString;
-    }
-
-    public void setRemoved(Date removed) {
-        this.removed = removed;
-    }
-
-    public void setSortKey(int key) {
-    	sortKey = key;
-    }
-
-    public int getSortKey() {
-    	return sortKey;
-    }
-
-	@Override
-	public boolean getEnableSshKey() {
-		return enableSshKey;
-	}
-
-	public void setEnableSshKey(boolean enable) {
-		enableSshKey = enable;
-	}
-	
-	 public Long getImageDataStoreId() {
-	        return this.imageDataStoreId;
-	    }
-
-	    public void setImageDataStoreId(long dataStoreId) {
-	        this.imageDataStoreId = dataStoreId;
-	    }
-	    
-	    public void setSize(Long size) {
-	        this.size = size;
-	    }
-	    
-	    public Long getSize() {
-	        return this.size;
-	    }
-	    
-	    public TemplateState getState() {
-	        return this.state;
-	    }
-	    
-	    public long getUpdatedCount() {
-	        return this.updatedCount;
-	    }
-	    
-	    public void incrUpdatedCount() {
-	        this.updatedCount++;
-	    }
-
-	    public void decrUpdatedCount() {
-	        this.updatedCount--;
-	    }
-	    
-	    public Date getUpdated() {
-	        return updated;
-	    }
-	    
-	    public void setUpdated(Date updated) {
-	        this.updated = updated;
-	    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/VMTemplateZoneVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/VMTemplateZoneVO.java b/core/src/com/cloud/storage/VMTemplateZoneVO.java
deleted file mode 100644
index 93a67b5..0000000
--- a/core/src/com/cloud/storage/VMTemplateZoneVO.java
+++ /dev/null
@@ -1,116 +0,0 @@
-// 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.storage;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import com.cloud.utils.db.GenericDao;
-import com.cloud.utils.db.GenericDaoBase;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="template_zone_ref")
-public class VMTemplateZoneVO implements InternalIdentity {
-	@Id
-	@GeneratedValue(strategy=GenerationType.IDENTITY)
-	Long id;
-	
-	@Column(name="zone_id")
-	private long zoneId;
-	
-	@Column(name="template_id")
-	private long templateId;
-	
-	@Column(name=GenericDaoBase.CREATED_COLUMN)
-	private Date created = null;
-	
-	@Column(name="last_updated")
-	@Temporal(value=TemporalType.TIMESTAMP)
-	private Date lastUpdated = null;
-    
-    @Temporal(value=TemporalType.TIMESTAMP)
-    @Column(name=GenericDao.REMOVED_COLUMN)
-    private Date removed;
-    
-    protected VMTemplateZoneVO() {
-    	
-    }
-
-	public VMTemplateZoneVO(long zoneId, long templateId, Date lastUpdated) {
-		this.zoneId = zoneId;
-		this.templateId = templateId;
-		this.lastUpdated = lastUpdated;
-	}
-
-	public long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	public long getZoneId() {
-		return zoneId;
-	}
-
-	public void setZoneId(long zoneId) {
-		this.zoneId = zoneId;
-	}
-
-	public long getTemplateId() {
-		return templateId;
-	}
-
-	public void setTemplateId(long templateId) {
-		this.templateId = templateId;
-	}
-
-	public Date getCreated() {
-		return created;
-	}
-
-	public void setCreated(Date created) {
-		this.created = created;
-	}
-
-	public Date getLastUpdated() {
-		return lastUpdated;
-	}
-
-	public void setLastUpdated(Date lastUpdated) {
-		this.lastUpdated = lastUpdated;
-	}
-
-	public void setRemoved(Date removed) {
-		this.removed = removed;
-	}
-
-	public Date getRemoved() {
-		return removed;
-	}
-    
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/VolumeHostVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/VolumeHostVO.java b/core/src/com/cloud/storage/VolumeHostVO.java
deleted file mode 100755
index 40bae49..0000000
--- a/core/src/com/cloud/storage/VolumeHostVO.java
+++ /dev/null
@@ -1,347 +0,0 @@
-// 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.storage;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import org.apache.cloudstack.api.InternalIdentity;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
-
-import com.cloud.storage.Storage.ImageFormat;
-import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
-import com.cloud.utils.db.GenericDaoBase;
-
-/**
- * Join table for storage hosts and volumes
- *
- */
-@Entity
-@Table(name="volume_host_ref")
-public class VolumeHostVO implements InternalIdentity, DataObjectInStore {
-	@Id
-	@GeneratedValue(strategy=GenerationType.IDENTITY)
-	Long id;
-	
-	@Column(name="host_id")
-	private long hostId;
-	
-	@Column(name="volume_id")
-	private long volumeId;
-	
-	@Column(name="zone_id")
-	private long zoneId;
-	
-	@Column(name=GenericDaoBase.CREATED_COLUMN)
-	private Date created = null;
-	
-	@Column(name="last_updated")
-	@Temporal(value=TemporalType.TIMESTAMP)
-	private Date lastUpdated = null;
-	
-	@Column (name="download_pct")
-	private int downloadPercent;
-	
-	@Column (name="size")
-	private long size;
-	
-	@Column (name="physical_size")
-	private long physicalSize;
-	
-	@Column (name="download_state")
-	@Enumerated(EnumType.STRING)
-	private Status downloadState;
-	
-    @Column(name="checksum")
-    private String checksum;
-	
-	@Column (name="local_path")
-	private String localDownloadPath;
-	
-	@Column (name="error_str")
-	private String errorString;
-	
-	@Column (name="job_id")
-	private String jobId;	
-	
-	@Column (name="install_path")
-    private String installPath;
-	
-	@Column (name="url")
-	private String downloadUrl;
-	
-	@Column(name="format")
-    private Storage.ImageFormat format;
-    
-    @Column(name="destroyed")
-    boolean destroyed = false;
-    
-    @Column(name="update_count", updatable = true, nullable=false)
-    protected long updatedCount;
-    
-    @Column(name = "updated")
-    @Temporal(value = TemporalType.TIMESTAMP)
-    Date updated;
-    
-    @Column(name = "state")
-    @Enumerated(EnumType.STRING)
-    ObjectInDataStoreStateMachine.State state;
-	
-    public String getInstallPath() {
-		return installPath;
-	}
-
-	public long getHostId() {
-		return hostId;
-	}
-
-	public void setHostId(long hostId) {
-		this.hostId = hostId;
-	}
-
-	
-    public long getVolumeId() {
-		return volumeId;
-	}
-
-	
-    public void setVolumeId(long volumeId) {
-		this.volumeId = volumeId;
-	}
-
-	
-    public long getZoneId() {
-		return zoneId;
-	}
-
-	public void setZoneId(long zoneId) {
-		this.zoneId = zoneId;
-	}
-
-	public int getDownloadPercent() {
-		return downloadPercent;
-	}
-
-	
-    public void setDownloadPercent(int downloadPercent) {
-		this.downloadPercent = downloadPercent;
-	}
-
-	
-    public void setDownloadState(Status downloadState) {
-		this.downloadState = downloadState;
-	}
-
-	
-    public long getId() {
-		return id;
-	}
-
-	
-    public Date getCreated() {
-		return created;
-	}
-
-	
-    public Date getLastUpdated() {
-		return lastUpdated;
-	}
-	
-	
-    public void setLastUpdated(Date date) {
-	    lastUpdated = date;
-	}
-	
-	
-    public void setInstallPath(String installPath) {
-	    this.installPath = installPath;
-	}
-
-	
-    public Status getDownloadState() {
-		return downloadState;
-	}
-
-	public String getChecksum() {
-		return checksum;
-	}
-
-	public void setChecksum(String checksum) {
-		this.checksum = checksum;
-	}
-
-	public VolumeHostVO(long hostId, long volumeId) {
-		super();
-		this.hostId = hostId;
-		this.volumeId = volumeId;
-		this.state = ObjectInDataStoreStateMachine.State.Allocated;
-	}
-
-	public VolumeHostVO(long hostId, long volumeId, long zoneId, Date lastUpdated,
-			int downloadPercent, Status downloadState,
-			String localDownloadPath, String errorString, String jobId,
-			String installPath, String downloadUrl, String checksum, ImageFormat format) {
-		//super();
-		this.hostId = hostId;
-		this.volumeId = volumeId;
-		this.zoneId = zoneId;
-		this.lastUpdated = lastUpdated;
-		this.downloadPercent = downloadPercent;
-		this.downloadState = downloadState;
-		this.localDownloadPath = localDownloadPath;
-		this.errorString = errorString;
-		this.jobId = jobId;
-		this.installPath = installPath;
-		this.setDownloadUrl(downloadUrl);
-		this.checksum = checksum;
-		this.format = format;
-	}
-
-	protected VolumeHostVO() {
-		
-	}
-
-	
-    public void setLocalDownloadPath(String localPath) {
-		this.localDownloadPath = localPath;
-	}
-
-	
-    public String getLocalDownloadPath() {
-		return localDownloadPath;
-	}
-
-	
-    public void setErrorString(String errorString) {
-		this.errorString = errorString;
-	}
-
-	
-    public String getErrorString() {
-		return errorString;
-	}
-
-	
-    public void setJobId(String jobId) {
-		this.jobId = jobId;
-	}
-
-	
-    public String getJobId() {
-		return jobId;
-	}
-
-	
-	public boolean equals(Object obj) {
-		if (obj instanceof VolumeHostVO) {
-			VolumeHostVO other = (VolumeHostVO)obj;
-			return (this.volumeId==other.getVolumeId() && this.hostId==other.getHostId());		   
-		}
-		return false;
-	}
-
-	
-	public int hashCode() {
-		Long tid = new Long(volumeId);
-		Long hid = new Long(hostId);
-		return tid.hashCode()+hid.hashCode();
-	}
-
-    public void setSize(long size) {
-        this.size = size;
-    }
-
-    public long getSize() {
-        return size;
-    }
-	
-    
-    public void setPhysicalSize(long physicalSize) {
-        this.physicalSize = physicalSize;
-    }
-
-    public long getPhysicalSize() {
-        return physicalSize;
-    }
-
-    public void setDestroyed(boolean destroyed) {
-    	this.destroyed = destroyed;
-    }
-
-    public boolean getDestroyed() {
-    	return destroyed;
-    }
-
-	public void setDownloadUrl(String downloadUrl) {
-		this.downloadUrl = downloadUrl;
-	}
-
-	public String getDownloadUrl() {
-		return downloadUrl;
-	}	
-	
-    public Storage.ImageFormat getFormat() {
-		return format;
-	}
-
-	public void setFormat(Storage.ImageFormat format) {
-		this.format = format;
-	}
-
-	public long getVolumeSize() {
-	    return -1;
-	}
-	
-	
-    public String toString() {
-	    return new StringBuilder("VolumeHost[").append(id).append("-").append(volumeId).append("-").append(hostId).append(installPath).append("]").toString();
-	}
-    
-    public long getUpdatedCount() {
-        return this.updatedCount;
-    }
-    
-    public void incrUpdatedCount() {
-        this.updatedCount++;
-    }
-
-    public void decrUpdatedCount() {
-        this.updatedCount--;
-    }
-    
-    public Date getUpdated() {
-        return updated;
-    }
-
-    @Override
-    public ObjectInDataStoreStateMachine.State getState() {
-        // TODO Auto-generated method stub
-        return this.state;
-    }
-
-}


[05/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/offerings/NetworkOfferingServiceMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/offerings/NetworkOfferingServiceMapVO.java b/engine/schema/src/com/cloud/offerings/NetworkOfferingServiceMapVO.java
new file mode 100644
index 0000000..f249405
--- /dev/null
+++ b/engine/schema/src/com/cloud/offerings/NetworkOfferingServiceMapVO.java
@@ -0,0 +1,94 @@
+// 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.offerings;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.network.Network.Provider;
+import com.cloud.network.Network.Service;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="ntwk_offering_service_map")
+public class NetworkOfferingServiceMapVO implements InternalIdentity {
+   
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+    
+    @Column(name="network_offering_id")
+    long networkOfferingId;
+    
+    @Column(name="service")
+    String service;
+    
+    @Column(name="provider")
+    String provider;
+    
+    @Column(name=GenericDao.CREATED_COLUMN)
+    Date created;
+
+    public long getId() {
+        return id;
+    }
+
+    public long getNetworkOfferingId() {
+        return networkOfferingId;
+    }
+
+    public String getService() {
+        return service;
+    }
+
+    public String getProvider() {
+        return provider;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+    
+    public NetworkOfferingServiceMapVO() {
+    }
+    
+    public NetworkOfferingServiceMapVO(long networkOfferingId, Service service, Provider provider) {
+        this.networkOfferingId = networkOfferingId;
+        this.service = service.getName();
+        if (provider != null) {
+            this.provider = provider.getName();
+        }
+    }
+    
+    public String toString() {
+        StringBuilder buf = new StringBuilder("[Network Offering Service[");
+        return buf.append(networkOfferingId).append("-").append(service).append("-").append(provider).append("]").toString();
+    }
+}
+
+
+
+
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java b/engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java
new file mode 100755
index 0000000..3ae0bf3
--- /dev/null
+++ b/engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java
@@ -0,0 +1,417 @@
+// 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.offerings;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.network.Network;
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.offering.NetworkOffering;
+import com.cloud.utils.db.GenericDao;
+
+@Entity
+@Table(name = "network_offerings")
+public class NetworkOfferingVO implements NetworkOffering {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    long id;
+
+    @Column(name = "name")
+    String name;
+
+    @Column(name = "unique_name")
+    private String uniqueName;
+
+    @Column(name = "display_text")
+    String displayText;
+
+    @Column(name = "nw_rate")
+    Integer rateMbps;
+
+    @Column(name = "mc_rate")
+    Integer multicastRateMbps;
+
+    @Column(name = "traffic_type")
+    @Enumerated(value = EnumType.STRING)
+    TrafficType trafficType;
+
+    @Column(name = "specify_vlan")
+    boolean specifyVlan;
+
+    @Column(name = "system_only")
+    boolean systemOnly;
+
+    @Column(name = "service_offering_id")
+    Long serviceOfferingId;
+
+    @Column(name = "tags", length = 4096)
+    String tags;
+
+    @Column(name = "default")
+    boolean isDefault;
+
+    @Column(name = "availability")
+    @Enumerated(value = EnumType.STRING)
+    Availability availability;
+
+    @Column(name = "state")
+    @Enumerated(value = EnumType.STRING)
+    State state = State.Disabled;
+
+    @Column(name = GenericDao.REMOVED_COLUMN)
+    Date removed;
+
+    @Column(name = GenericDao.CREATED_COLUMN)
+    Date created;
+
+    @Column(name = "guest_type")
+    @Enumerated(value = EnumType.STRING)
+    Network.GuestType guestType;
+
+    @Column(name = "dedicated_lb_service")
+    boolean dedicatedLB;
+
+    @Column(name = "shared_source_nat_service")
+    boolean sharedSourceNat;
+
+    @Column(name = "specify_ip_ranges")
+    boolean specifyIpRanges = false;
+
+    @Column(name = "sort_key")
+    int sortKey;
+
+    @Column(name = "uuid")
+    String uuid;
+
+    @Column(name = "redundant_router_service")
+    boolean redundantRouter;
+
+    @Column(name = "conserve_mode")
+    boolean conserveMode;
+
+    @Column(name = "elastic_ip_service")
+    boolean elasticIp;
+
+    @Column(name = "eip_associate_public_ip")
+    boolean eipAssociatePublicIp;
+
+    @Column(name = "elastic_lb_service")
+    boolean elasticLb;
+
+    @Column(name = "inline")
+    boolean inline;
+
+    @Column(name = "is_persistent")
+    boolean isPersistent;
+
+    @Override
+    public String getDisplayText() {
+        return displayText;
+    }
+    
+    @Column(name = "internal_lb")
+    boolean internalLb;
+    
+    @Column(name = "public_lb")
+    boolean publicLb;
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public TrafficType getTrafficType() {
+        return trafficType;
+    }
+
+    @Override
+    public Integer getMulticastRateMbps() {
+        return multicastRateMbps;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public Integer getRateMbps() {
+        return rateMbps;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    @Override
+    public boolean isSystemOnly() {
+        return systemOnly;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    @Override
+    public String getTags() {
+        return tags;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setDisplayText(String displayText) {
+        this.displayText = displayText;
+    }
+
+    public void setRateMbps(Integer rateMbps) {
+        this.rateMbps = rateMbps;
+    }
+
+    public void setMulticastRateMbps(Integer multicastRateMbps) {
+        this.multicastRateMbps = multicastRateMbps;
+    }
+
+    @Override
+    public boolean isDefault() {
+        return isDefault;
+    }
+
+    @Override
+    public boolean getSpecifyVlan() {
+        return specifyVlan;
+    }
+
+    @Override
+    public Availability getAvailability() {
+        return availability;
+    }
+
+    public void setAvailability(Availability availability) {
+        this.availability = availability;
+    }
+
+    @Override
+    public String getUniqueName() {
+        return uniqueName;
+    }
+
+    @Override
+    public void setState(State state) {
+        this.state = state;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    @Override
+    public Network.GuestType getGuestType() {
+        return guestType;
+    }
+
+    public void setServiceOfferingId(Long serviceOfferingId) {
+        this.serviceOfferingId = serviceOfferingId;
+    }
+
+    @Override
+    public Long getServiceOfferingId() {
+        return serviceOfferingId;
+    }
+
+    @Override
+    public boolean getDedicatedLB() {
+        return dedicatedLB;
+    }
+
+    public void setDedicatedLB(boolean dedicatedLB) {
+        this.dedicatedLB = dedicatedLB;
+    }
+
+    @Override
+    public boolean getSharedSourceNat() {
+        return sharedSourceNat;
+    }
+
+    public void setSharedSourceNat(boolean sharedSourceNat) {
+        this.sharedSourceNat = sharedSourceNat;
+    }
+
+    @Override
+    public boolean getRedundantRouter() {
+        return redundantRouter;
+    }
+
+    public void setRedundantRouter(boolean redundantRouter) {
+        this.redundantRouter = redundantRouter;
+    }
+
+    public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps, Integer multicastRateMbps, boolean isDefault,
+            Availability availability, String tags, Network.GuestType guestType, boolean conserveMode, boolean specifyIpRanges, boolean isPersistent, boolean internalLb, boolean publicLb) {
+        this.name = name;
+        this.displayText = displayText;
+        this.rateMbps = rateMbps;
+        this.multicastRateMbps = multicastRateMbps;
+        this.trafficType = trafficType;
+        this.systemOnly = systemOnly;
+        this.specifyVlan = specifyVlan;
+        this.isDefault = isDefault;
+        this.availability = availability;
+        this.uniqueName = name;
+        this.uuid = UUID.randomUUID().toString();
+        this.tags = tags;
+        this.guestType = guestType;
+        this.conserveMode = conserveMode;
+        this.dedicatedLB = true;
+        this.sharedSourceNat = false;
+        this.redundantRouter = false;
+        this.elasticIp = false;
+        this.eipAssociatePublicIp = true;
+        this.elasticLb = false;
+        this.inline = false;
+        this.specifyIpRanges = specifyIpRanges;
+        this.isPersistent=isPersistent;
+        this.publicLb = publicLb;
+        this.internalLb = internalLb;
+    }
+
+    public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps, Integer multicastRateMbps, boolean isDefault,
+            Availability availability, String tags, Network.GuestType guestType, boolean conserveMode, boolean dedicatedLb, boolean sharedSourceNat, boolean redundantRouter, boolean elasticIp, boolean elasticLb,
+            boolean specifyIpRanges, boolean inline, boolean isPersistent, boolean associatePublicIP, boolean publicLb, boolean internalLb) {
+        this(name, displayText, trafficType, systemOnly, specifyVlan, rateMbps, multicastRateMbps, isDefault, availability, tags, guestType, conserveMode, specifyIpRanges, isPersistent, internalLb, publicLb);
+        this.dedicatedLB = dedicatedLb;
+        this.sharedSourceNat = sharedSourceNat;
+        this.redundantRouter = redundantRouter;
+        this.elasticIp = elasticIp;
+        this.elasticLb = elasticLb;
+        this.inline = inline;
+        this.eipAssociatePublicIp = associatePublicIP;
+    }
+
+    public NetworkOfferingVO() {
+    }
+
+    /**
+     * Network Offering for all system vms.
+     *
+     * @param name
+     * @param trafficType
+     * @param specifyIpRanges
+     *            TODO
+     */
+    public NetworkOfferingVO(String name, TrafficType trafficType, boolean specifyIpRanges) {
+        this(name, "System Offering for " + name, trafficType, true, false, 0, 0, true, Availability.Required, null, null, true, specifyIpRanges, false, false, false);
+        this.state = State.Enabled;
+    }
+
+    public NetworkOfferingVO(String name, Network.GuestType guestType) {
+        this(name, "System Offering for " + name, TrafficType.Guest, true, true, 0, 0, true, Availability.Optional,
+                null, Network.GuestType.Isolated, true, false, false, false, false);
+        this.state = State.Enabled;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder buf = new StringBuilder("[Network Offering [");
+        return buf.append(id).append("-").append(trafficType).append("-").append(name).append("]").toString();
+    }
+
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    public void setSortKey(int key) {
+        sortKey = key;
+    }
+
+    public int getSortKey() {
+        return sortKey;
+    }
+
+    public void setUniqueName(String uniqueName) {
+        this.uniqueName = uniqueName;
+    }
+
+    @Override
+    public boolean isConserveMode() {
+        return conserveMode;
+    }
+
+    @Override
+    public boolean getElasticIp() {
+        return elasticIp;
+    }
+
+    @Override
+    public boolean getAssociatePublicIP() {
+        return eipAssociatePublicIp;
+    }
+
+    @Override
+    public boolean getElasticLb() {
+        return elasticLb;
+    }
+
+    @Override
+    public boolean getSpecifyIpRanges() {
+        return specifyIpRanges;
+    }
+
+    @Override
+    public boolean isInline() {
+        return inline;
+    }
+
+    public void setIsPersistent(Boolean isPersistent) {
+        this.isPersistent = isPersistent;
+    }
+
+    public boolean getIsPersistent() {
+        return isPersistent;
+    }
+
+    @Override
+    public boolean getInternalLb() {
+        return internalLb;
+    }
+
+    @Override
+    public boolean getPublicLb() {
+        return publicLb;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDao.java b/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDao.java
new file mode 100644
index 0000000..5bb79ce
--- /dev/null
+++ b/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDao.java
@@ -0,0 +1,64 @@
+// 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.offerings.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import com.cloud.network.Network;
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.offering.NetworkOffering;
+import com.cloud.offering.NetworkOffering.Availability;
+import com.cloud.offering.NetworkOffering.Detail;
+import com.cloud.offerings.NetworkOfferingVO;
+import com.cloud.utils.db.GenericDao;
+
+/**
+ * NetworkOfferingDao deals with searches and operations done on the
+ * network_offering table.
+ * 
+ */
+public interface NetworkOfferingDao extends GenericDao<NetworkOfferingVO, Long> {
+    /**
+     * Returns the network offering that matches the name.
+     * 
+     * @param uniqueName
+     *            name
+     * @return NetworkOfferingVO
+     */
+    NetworkOfferingVO findByUniqueName(String uniqueName);
+
+    /**
+     * If not, then it persists it into the database.
+     * 
+     * @param offering
+     *            network offering to persist if not in the database.
+     * @return NetworkOfferingVO backed by a row in the database
+     */
+    NetworkOfferingVO persistDefaultNetworkOffering(NetworkOfferingVO offering);
+
+    List<NetworkOfferingVO> listSystemNetworkOfferings();
+
+    List<NetworkOfferingVO> listByAvailability(Availability availability, boolean isSystem);
+
+    List<Long> getOfferingIdsToUpgradeFrom(NetworkOffering originalOffering);
+
+    List<NetworkOfferingVO> listByTrafficTypeGuestTypeAndState(NetworkOffering.State state, TrafficType trafficType, Network.GuestType type);
+
+    NetworkOfferingVO persist(NetworkOfferingVO off, Map<Detail, String> details);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDaoImpl.java b/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDaoImpl.java
new file mode 100644
index 0000000..ef8237a
--- /dev/null
+++ b/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDaoImpl.java
@@ -0,0 +1,193 @@
+// 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.offerings.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.persistence.EntityExistsException;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.Network;
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.offering.NetworkOffering;
+import com.cloud.offering.NetworkOffering.Availability;
+import com.cloud.offering.NetworkOffering.Detail;
+import com.cloud.offerings.NetworkOfferingDetailsVO;
+import com.cloud.offerings.NetworkOfferingVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+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;
+
+@Component
+@Local(value = NetworkOfferingDao.class)
+@DB(txn = false)
+public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Long> implements NetworkOfferingDao {
+    final SearchBuilder<NetworkOfferingVO> NameSearch;
+    final SearchBuilder<NetworkOfferingVO> SystemOfferingSearch;
+    final SearchBuilder<NetworkOfferingVO> AvailabilitySearch;
+    final SearchBuilder<NetworkOfferingVO> AllFieldsSearch;
+    private final GenericSearchBuilder<NetworkOfferingVO, Long> UpgradeSearch;
+    @Inject NetworkOfferingDetailsDao _detailsDao;
+
+    protected NetworkOfferingDaoImpl() {
+        super();
+
+        NameSearch = createSearchBuilder();
+        NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ);
+        NameSearch.and("uniqueName", NameSearch.entity().getUniqueName(), SearchCriteria.Op.EQ);
+        NameSearch.done();
+
+        SystemOfferingSearch = createSearchBuilder();
+        SystemOfferingSearch.and("system", SystemOfferingSearch.entity().isSystemOnly(), SearchCriteria.Op.EQ);
+        SystemOfferingSearch.done();
+
+        AvailabilitySearch = createSearchBuilder();
+        AvailabilitySearch.and("availability", AvailabilitySearch.entity().getAvailability(), SearchCriteria.Op.EQ);
+        AvailabilitySearch.and("isSystem", AvailabilitySearch.entity().isSystemOnly(), SearchCriteria.Op.EQ);
+        AvailabilitySearch.done();
+
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("trafficType", AllFieldsSearch.entity().getTrafficType(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("guestType", AllFieldsSearch.entity().getGuestType(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("isSystem", AllFieldsSearch.entity().isSystemOnly(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+
+        UpgradeSearch = createSearchBuilder(Long.class);
+        UpgradeSearch.selectField(UpgradeSearch.entity().getId());
+        UpgradeSearch.and("physicalNetworkId", UpgradeSearch.entity().getId(), Op.NEQ);
+        UpgradeSearch.and("physicalNetworkId", UpgradeSearch.entity().isSystemOnly(), Op.EQ);
+        UpgradeSearch.and("trafficType", UpgradeSearch.entity().getTrafficType(), Op.EQ);
+        UpgradeSearch.and("guestType", UpgradeSearch.entity().getGuestType(), Op.EQ);
+        UpgradeSearch.and("state", UpgradeSearch.entity().getState(), Op.EQ);
+        UpgradeSearch.done();
+    }
+
+    @Override
+    public NetworkOfferingVO findByUniqueName(String uniqueName) {
+        SearchCriteria<NetworkOfferingVO> sc = NameSearch.create();
+
+        sc.setParameters("uniqueName", uniqueName);
+
+        return findOneBy(sc);
+
+    }
+
+    @Override
+    public NetworkOfferingVO persistDefaultNetworkOffering(NetworkOfferingVO offering) {
+        assert offering.getUniqueName() != null : "how are you going to find this later if you don't set it?";
+        NetworkOfferingVO vo = findByUniqueName(offering.getUniqueName());
+        if (vo != null) {
+            return vo;
+        }
+        try {
+            vo = persist(offering);
+            return vo;
+        } catch (EntityExistsException e) {
+            // Assume it's conflict on unique name from two different management servers.
+            return findByUniqueName(offering.getName());
+        }
+    }
+
+    @Override
+    public List<NetworkOfferingVO> listSystemNetworkOfferings() {
+        SearchCriteria<NetworkOfferingVO> sc = SystemOfferingSearch.create();
+        sc.setParameters("system", true);
+        return this.listIncludingRemovedBy(sc, null);
+    }
+
+    @Override
+    public List<NetworkOfferingVO> listByAvailability(Availability availability, boolean isSystem) {
+        SearchCriteria<NetworkOfferingVO> sc = AvailabilitySearch.create();
+        sc.setParameters("availability", availability);
+        sc.setParameters("isSystem", isSystem);
+        return listBy(sc, null);
+    }
+
+    @Override
+    @DB
+    public boolean remove(Long networkOfferingId) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        NetworkOfferingVO offering = findById(networkOfferingId);
+        offering.setUniqueName(null);
+        update(networkOfferingId, offering);
+        boolean result = super.remove(networkOfferingId);
+        txn.commit();
+        return result;
+    }
+
+    @Override
+    public List<Long> getOfferingIdsToUpgradeFrom(NetworkOffering originalOffering) {
+        SearchCriteria<Long> sc = UpgradeSearch.create();
+        // exclude original offering
+        sc.addAnd("id", SearchCriteria.Op.NEQ, originalOffering.getId());
+
+        // list only non-system offerings
+        sc.addAnd("systemOnly", SearchCriteria.Op.EQ, false);
+
+        // Type of the network should be the same
+        sc.addAnd("guestType", SearchCriteria.Op.EQ, originalOffering.getGuestType());
+
+        // Traffic types should be the same
+        sc.addAnd("trafficType", SearchCriteria.Op.EQ, originalOffering.getTrafficType());
+
+        sc.addAnd("state", SearchCriteria.Op.EQ, NetworkOffering.State.Enabled);
+        
+        //specify Vlan should be the same
+        sc.addAnd("specifyVlan", SearchCriteria.Op.EQ, originalOffering.getSpecifyVlan());
+
+        return customSearch(sc, null);
+    }
+
+    @Override
+    public List<NetworkOfferingVO> listByTrafficTypeGuestTypeAndState(NetworkOffering.State state, TrafficType trafficType, Network.GuestType type) {
+        SearchCriteria<NetworkOfferingVO> sc = AllFieldsSearch.create();
+        sc.setParameters("trafficType", trafficType);
+        sc.setParameters("guestType", type);
+        sc.setParameters("state", state);
+        return listBy(sc, null);
+    }
+    
+    @Override
+    @DB
+    public NetworkOfferingVO persist(NetworkOfferingVO off, Map<Detail, String> details) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        //1) persist the offering
+        NetworkOfferingVO vo = super.persist(off);
+        
+        //2) persist the details
+        if (details != null && !details.isEmpty()) {
+            for (NetworkOffering.Detail detail : details.keySet()) {
+                _detailsDao.persist(new NetworkOfferingDetailsVO(off.getId(), detail, details.get(detail)));
+            }
+        }
+       
+        txn.commit();
+        return vo;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDetailsDao.java b/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDetailsDao.java
new file mode 100644
index 0000000..ce209e0
--- /dev/null
+++ b/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDetailsDao.java
@@ -0,0 +1,31 @@
+// 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.offerings.dao;
+
+
+import java.util.Map;
+
+import com.cloud.offering.NetworkOffering;
+import com.cloud.offering.NetworkOffering.Detail;
+import com.cloud.offerings.NetworkOfferingDetailsVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface NetworkOfferingDetailsDao extends GenericDao<NetworkOfferingDetailsVO, Long>{
+
+    Map<NetworkOffering.Detail,String> getNtwkOffDetails(long offeringId);
+    String getDetail(long offeringId, Detail detailName);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDetailsDaoImpl.java b/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDetailsDaoImpl.java
new file mode 100644
index 0000000..068f390
--- /dev/null
+++ b/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDetailsDaoImpl.java
@@ -0,0 +1,79 @@
+// 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.offerings.dao;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.cloud.offering.NetworkOffering;
+import com.cloud.offering.NetworkOffering.Detail;
+import com.cloud.offerings.NetworkOfferingDetailsVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+public class NetworkOfferingDetailsDaoImpl extends GenericDaoBase<NetworkOfferingDetailsVO, Long> implements NetworkOfferingDetailsDao{
+    protected final SearchBuilder<NetworkOfferingDetailsVO> DetailSearch;
+    private final GenericSearchBuilder<NetworkOfferingDetailsVO, String> ValueSearch;
+
+    
+    public NetworkOfferingDetailsDaoImpl() {
+        
+        DetailSearch = createSearchBuilder();
+        DetailSearch.and("offeringId", DetailSearch.entity().getOfferingId(), SearchCriteria.Op.EQ);
+        DetailSearch.and("name", DetailSearch.entity().getName(), SearchCriteria.Op.EQ);
+        DetailSearch.done();
+        
+        ValueSearch = createSearchBuilder(String.class);
+        ValueSearch.select(null, Func.DISTINCT, ValueSearch.entity().getValue());
+        ValueSearch.and("offeringId", ValueSearch.entity().getOfferingId(), SearchCriteria.Op.EQ);
+        ValueSearch.and("name", ValueSearch.entity().getName(), Op.EQ);
+        ValueSearch.done();
+    }
+    
+    @Override
+    public Map<NetworkOffering.Detail,String> getNtwkOffDetails(long offeringId) {
+        SearchCriteria<NetworkOfferingDetailsVO> sc = DetailSearch.create();
+        sc.setParameters("offeringId", offeringId);
+        
+        List<NetworkOfferingDetailsVO> results = search(sc, null);
+        Map<NetworkOffering.Detail, String> details = new HashMap<NetworkOffering.Detail, String>(results.size());
+        for (NetworkOfferingDetailsVO result : results) {
+            details.put(result.getName(), result.getValue());
+        }
+        
+        return details;
+    }
+
+    @Override
+    public String getDetail(long offeringId, Detail detailName) {
+        SearchCriteria<String> sc = ValueSearch.create();
+        sc.setParameters("name", detailName);
+        sc.setParameters("offeringId", offeringId);
+        List<String> results = customSearch(sc, null);
+        if (results.isEmpty()) {
+            return null;
+        } else {
+            return results.get(0);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingServiceMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingServiceMapDao.java b/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingServiceMapDao.java
new file mode 100644
index 0000000..42ab0eb
--- /dev/null
+++ b/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingServiceMapDao.java
@@ -0,0 +1,50 @@
+// 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.offerings.dao;
+
+import java.util.List;
+
+import com.cloud.network.Network.Provider;
+import com.cloud.network.Network.Service;
+import com.cloud.offerings.NetworkOfferingServiceMapVO;
+import com.cloud.utils.db.GenericDao;
+
+/**
+ * NetworkOfferingServiceDao deals with searches and operations done on the
+ * ntwk_offering_service_map table.
+ *
+ */
+public interface NetworkOfferingServiceMapDao extends GenericDao<NetworkOfferingServiceMapVO, Long> {
+   boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service... services);
+   
+   List<NetworkOfferingServiceMapVO> listByNetworkOfferingId(long networkOfferingId);
+   
+   void deleteByOfferingId(long networkOfferingId);
+   
+   List<String> listProvidersForServiceForNetworkOffering(long networkOfferingId, Service service);
+   
+   boolean isProviderForNetworkOffering(long networkOfferingId, Provider provider);
+   
+   List<String> listServicesForNetworkOffering(long networkOfferingId);
+   
+   List<String> getDistinctProviders(long offId);
+}
+
+
+
+
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingServiceMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingServiceMapDaoImpl.java b/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingServiceMapDaoImpl.java
new file mode 100644
index 0000000..7282443
--- /dev/null
+++ b/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingServiceMapDaoImpl.java
@@ -0,0 +1,171 @@
+// 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.offerings.dao;
+
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.Network.Provider;
+import com.cloud.network.Network.Service;
+import com.cloud.offerings.NetworkOfferingServiceMapVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
+
+@Component
+@Local(value=NetworkOfferingServiceMapDao.class) @DB(txn=false)
+public class NetworkOfferingServiceMapDaoImpl extends GenericDaoBase<NetworkOfferingServiceMapVO, Long> implements NetworkOfferingServiceMapDao {
+
+	final SearchBuilder<NetworkOfferingServiceMapVO> AllFieldsSearch;
+    final SearchBuilder<NetworkOfferingServiceMapVO> MultipleServicesSearch;
+    final GenericSearchBuilder<NetworkOfferingServiceMapVO, String> ProvidersSearch;
+    final GenericSearchBuilder<NetworkOfferingServiceMapVO, String> ServicesSearch;
+    final GenericSearchBuilder<NetworkOfferingServiceMapVO, String> DistinctProvidersSearch;
+
+    
+    protected NetworkOfferingServiceMapDaoImpl() {
+        super();
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("networkOfferingId", AllFieldsSearch.entity().getNetworkOfferingId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("service", AllFieldsSearch.entity().getService(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("provider", AllFieldsSearch.entity().getProvider(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+        
+        MultipleServicesSearch = createSearchBuilder();
+        MultipleServicesSearch.and("networkOfferingId", MultipleServicesSearch.entity().getNetworkOfferingId(), SearchCriteria.Op.EQ);
+        MultipleServicesSearch.and("service", MultipleServicesSearch.entity().getService(), SearchCriteria.Op.IN);
+        MultipleServicesSearch.and("provider", MultipleServicesSearch.entity().getProvider(), SearchCriteria.Op.EQ);
+        MultipleServicesSearch.done();
+        
+        ProvidersSearch = createSearchBuilder(String.class);
+        ProvidersSearch.and("networkOfferingId", ProvidersSearch.entity().getNetworkOfferingId(), SearchCriteria.Op.EQ);
+        ProvidersSearch.and("service", ProvidersSearch.entity().getService(), SearchCriteria.Op.EQ);
+        ProvidersSearch.select(null, Func.DISTINCT, ProvidersSearch.entity().getProvider());
+        ProvidersSearch.done();
+        
+        ServicesSearch = createSearchBuilder(String.class);
+        ServicesSearch.and("networkOfferingId", ServicesSearch.entity().getNetworkOfferingId(), SearchCriteria.Op.EQ);
+        ServicesSearch.select(null, Func.DISTINCT, ServicesSearch.entity().getService());
+        ServicesSearch.done();
+        
+        DistinctProvidersSearch = createSearchBuilder(String.class);
+        DistinctProvidersSearch.and("offId", DistinctProvidersSearch.entity().getNetworkOfferingId(), SearchCriteria.Op.EQ);
+        DistinctProvidersSearch.and("provider", DistinctProvidersSearch.entity().getProvider(), SearchCriteria.Op.EQ);
+        DistinctProvidersSearch.selectField(DistinctProvidersSearch.entity().getProvider());
+        DistinctProvidersSearch.done();
+    }
+    
+    @Override
+    public boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service... services) {
+        SearchCriteria<NetworkOfferingServiceMapVO> sc = MultipleServicesSearch.create();
+        sc.setParameters("networkOfferingId", networkOfferingId);
+        
+        if (services != null) {
+            String[] servicesStr = new String[services.length];
+            
+            int i = 0;
+            for (Service service : services) {
+                servicesStr[i] = service.getName();
+                i++;
+            }
+            
+            sc.setParameters("service", (Object[])servicesStr);
+        }
+        
+        List<NetworkOfferingServiceMapVO> offeringServices = listBy(sc);
+        
+        if (services != null) {
+            if (offeringServices.size() == services.length) {
+                return true;
+            }
+        } else if (!offeringServices.isEmpty()) {
+            return true;
+        }
+        
+        return false;
+    }
+ 
+    @Override
+    public List<NetworkOfferingServiceMapVO> listByNetworkOfferingId(long networkOfferingId) {
+        SearchCriteria<NetworkOfferingServiceMapVO> sc = AllFieldsSearch.create();
+        sc.setParameters("networkOfferingId", networkOfferingId);
+        return listBy(sc);
+    }
+    
+    @Override
+    public void deleteByOfferingId(long networkOfferingId) {
+        SearchCriteria<NetworkOfferingServiceMapVO> sc = AllFieldsSearch.create();
+        sc.setParameters("networkOfferingId", networkOfferingId);
+        remove(sc);
+    }
+    
+    @Override
+    public List<String> listProvidersForServiceForNetworkOffering(long networkOfferingId, Service service) {
+    	SearchCriteria<String> sc = ProvidersSearch.create();;
+    	
+        sc.setParameters("networkOfferingId", networkOfferingId);
+        sc.setParameters("service", service.getName());
+        
+        return customSearch(sc, null);
+    }
+
+    @Override
+    public boolean isProviderForNetworkOffering(long networkOfferingId, Provider provider) {
+    	SearchCriteria<NetworkOfferingServiceMapVO> sc = AllFieldsSearch.create();;
+    	
+        sc.setParameters("networkOfferingId", networkOfferingId);
+        sc.setParameters("provider", provider.getName());
+        
+        if (findOneBy(sc) != null) {
+            return true;
+        }
+        return false;
+    }
+    
+    @Override
+    public List<String> listServicesForNetworkOffering(long networkOfferingId) {
+    	SearchCriteria<String> sc = ServicesSearch.create();;
+        sc.setParameters("networkOfferingId", networkOfferingId);
+        return customSearch(sc, null);
+    }
+    
+    @Override
+	public NetworkOfferingServiceMapVO persist(
+			NetworkOfferingServiceMapVO entity) {
+        SearchCriteria<NetworkOfferingServiceMapVO> sc = AllFieldsSearch.create();
+        sc.setParameters("networkOfferingId", entity.getNetworkOfferingId());
+        sc.setParameters("service", entity.getService());
+        sc.setParameters("provider", entity.getProvider());
+        NetworkOfferingServiceMapVO mappingInDb = findOneBy(sc);
+        return mappingInDb!=null? mappingInDb : super.persist(entity); 
+	}
+    
+    @Override
+    public List<String> getDistinctProviders(long offId) {
+        SearchCriteria<String> sc = DistinctProvidersSearch.create();
+        sc.setParameters("offId", offId);
+        List<String> results = customSearch(sc, null);
+        return results;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/projects/ProjectAccountVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/projects/ProjectAccountVO.java b/engine/schema/src/com/cloud/projects/ProjectAccountVO.java
new file mode 100644
index 0000000..8c4f1ba
--- /dev/null
+++ b/engine/schema/src/com/cloud/projects/ProjectAccountVO.java
@@ -0,0 +1,96 @@
+// 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.projects;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="project_account")
+@SuppressWarnings("unused")
+public class ProjectAccountVO implements ProjectAccount, InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+    @Column(name="project_id")
+    private long projectId;
+
+    @Column(name="account_id")
+    private long accountId;
+    
+    @Column(name="account_role")
+    @Enumerated(value=EnumType.STRING)
+    private Role accountRole = Role.Regular;
+    
+    @Column(name="project_account_id")
+    long projectAccountId;
+    
+    @Column(name=GenericDao.CREATED_COLUMN)
+    private Date created;
+
+    
+    protected ProjectAccountVO(){
+    }
+    
+    public ProjectAccountVO(Project project, long accountId, Role accountRole) {
+       this.accountId = accountId;
+       this.accountRole = accountRole;
+       this.projectId = project.getId();
+       this.projectAccountId = project.getProjectAccountId();
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public long getProjectId() {
+        return projectId;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public Role getAccountRole() {
+        return accountRole;
+    }
+    
+    @Override
+    public long getProjectAccountId() {
+        return projectAccountId;
+    }
+
+    public void setAccountRole(Role accountRole) {
+        this.accountRole = accountRole;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/projects/ProjectInvitationVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/projects/ProjectInvitationVO.java b/engine/schema/src/com/cloud/projects/ProjectInvitationVO.java
new file mode 100644
index 0000000..78f05c7
--- /dev/null
+++ b/engine/schema/src/com/cloud/projects/ProjectInvitationVO.java
@@ -0,0 +1,150 @@
+// 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.projects;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = "project_invitations")
+public class ProjectInvitationVO implements ProjectInvitation {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "project_id")
+    private long projectId;
+
+    @Column(name = "account_id")
+    private Long forAccountId;
+
+    @Column(name = "domain_id")
+    private Long inDomainId;
+
+    @Column(name = "token")
+    private String token;
+
+    @Column(name = "email")
+    private String email;
+
+    @Column(name = "state")
+    @Enumerated(value = EnumType.STRING)
+    private State state = State.Pending;
+
+    @Column(name = GenericDao.CREATED_COLUMN)
+    private Date created;
+
+    @Column(name = "uuid")
+    private String uuid;
+
+    protected ProjectInvitationVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public ProjectInvitationVO(long projectId, Long accountId, Long domainId, String email, String token) {
+        this.forAccountId = accountId;
+        this.inDomainId = domainId;
+        this.projectId = projectId;
+        this.email = email;
+        this.token = token;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public long getProjectId() {
+        return projectId;
+    }
+
+    @Override
+    public Long getForAccountId() {
+        return forAccountId;
+    }
+
+    @Override
+    public String getToken() {
+        return token;
+    }
+
+    @Override
+    public String getEmail() {
+        return email;
+    }
+
+    @Override
+    public Date getCreated() {
+        return created;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    public void setState(State state) {
+        this.state = state;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder buf = new StringBuilder("ProjectInvitation[");
+        buf.append(id).append("|projectId=").append(projectId).append("|accountId=").append(forAccountId).append("]");
+        return buf.toString();
+    }
+
+    @Override
+    public Long getInDomainId() {
+        return inDomainId;
+    }
+
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    @Override
+    public long getDomainId() {
+        return inDomainId == null ? -1 : inDomainId;
+    }
+
+    @Override
+    public long getAccountId() {
+        return forAccountId == null ? -1 : forAccountId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/projects/ProjectVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/projects/ProjectVO.java b/engine/schema/src/com/cloud/projects/ProjectVO.java
new file mode 100644
index 0000000..53947f1
--- /dev/null
+++ b/engine/schema/src/com/cloud/projects/ProjectVO.java
@@ -0,0 +1,163 @@
+// 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.projects;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="projects")
+public class ProjectVO implements Project, Identity, InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+    @Column(name="name")
+    private String name;
+    
+    @Column(name="display_text")
+    String displayText;
+    
+    @Column(name="domain_id")
+    long domainId;
+
+    @Column(name="project_account_id")
+    long projectAccountId;
+    
+    @Column(name="state")
+    @Enumerated(value=EnumType.STRING)
+    private State state;
+    
+    @Column(name=GenericDao.CREATED_COLUMN)
+    private Date created;
+    
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+    
+    @Column(name="uuid")
+    private String uuid;
+    
+    protected ProjectVO(){
+    	this.uuid = UUID.randomUUID().toString();
+    }
+    
+    public ProjectVO(String name, String displayText, long domainId, long projectAccountId) {
+        this.name = name;
+        this.displayText = displayText;
+        this.projectAccountId = projectAccountId;
+        this.domainId = domainId;
+        this.state = State.Disabled;
+    	this.uuid = UUID.randomUUID().toString();
+    }
+    
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public String getDisplayText() {
+        return displayText;
+    }
+
+    public void setDisplayText(String displayText) {
+        this.displayText = displayText;
+    }
+
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public Date getCreated() {
+        return created;
+    }
+
+    @Override
+    public Date getRemoved() {
+        return removed;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder buf = new StringBuilder("Project[");
+        buf.append(id).append("|name=").append(name).append("|domainid=").append(domainId).append("]");
+        return buf.toString();
+    }
+    
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof ProjectVO)) {
+            return false;
+        }
+        ProjectVO that = (ProjectVO)obj;
+        if (this.id != that.id) {
+            return false;
+        }
+        
+        return true;
+    }
+
+    @Override
+    public long getProjectAccountId() {
+        return projectAccountId;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    @Override
+    public void setState(State state) {
+        this.state = state;
+    }
+    
+    @Override
+    public String getUuid() {
+    	return this.uuid; 
+    }
+    
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/projects/dao/ProjectAccountDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/projects/dao/ProjectAccountDao.java b/engine/schema/src/com/cloud/projects/dao/ProjectAccountDao.java
new file mode 100644
index 0000000..4ff59be
--- /dev/null
+++ b/engine/schema/src/com/cloud/projects/dao/ProjectAccountDao.java
@@ -0,0 +1,43 @@
+// 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.projects.dao;
+
+import java.util.List;
+
+import com.cloud.projects.ProjectAccount;
+import com.cloud.projects.ProjectAccountVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface ProjectAccountDao extends GenericDao<ProjectAccountVO, Long> {
+    ProjectAccountVO getProjectOwner(long projectId);
+
+    List<ProjectAccountVO> listByProjectId(long projectId);
+
+    ProjectAccountVO findByProjectIdAccountId(long projectId, long accountId);
+
+    boolean canAccessProjectAccount(long accountId, long projectAccountId);
+
+    boolean canModifyProjectAccount(long accountId, long projectAccountId);
+
+    List<Long> listPermittedAccountIds(long accountId);
+
+    List<Long> listAdministratedProjectIds(long adminAccountId);
+
+    Long countByAccountIdAndRole(long accountId, ProjectAccount.Role role);
+    
+    void removeAccountFromProjects(long accountId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/projects/dao/ProjectAccountDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/projects/dao/ProjectAccountDaoImpl.java b/engine/schema/src/com/cloud/projects/dao/ProjectAccountDaoImpl.java
new file mode 100644
index 0000000..b089e58
--- /dev/null
+++ b/engine/schema/src/com/cloud/projects/dao/ProjectAccountDaoImpl.java
@@ -0,0 +1,157 @@
+// 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.projects.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.projects.ProjectAccount;
+import com.cloud.projects.ProjectAccountVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value = { ProjectAccountDao.class })
+public class ProjectAccountDaoImpl extends GenericDaoBase<ProjectAccountVO, Long> implements ProjectAccountDao {
+    protected final SearchBuilder<ProjectAccountVO> AllFieldsSearch;
+    final GenericSearchBuilder<ProjectAccountVO, Long> AdminSearch;
+    final GenericSearchBuilder<ProjectAccountVO, Long> ProjectAccountSearch;
+    final GenericSearchBuilder<ProjectAccountVO, Long> CountByRoleSearch;
+    public static final Logger s_logger = Logger.getLogger(ProjectAccountDaoImpl.class.getName());
+
+    protected ProjectAccountDaoImpl() {
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("role", AllFieldsSearch.entity().getAccountRole(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("projectId", AllFieldsSearch.entity().getProjectId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("projectAccountId", AllFieldsSearch.entity().getProjectAccountId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+
+        AdminSearch = createSearchBuilder(Long.class);
+        AdminSearch.selectField(AdminSearch.entity().getProjectId());
+        AdminSearch.and("role", AdminSearch.entity().getAccountRole(), Op.EQ);
+        AdminSearch.and("accountId", AdminSearch.entity().getAccountId(), Op.EQ);
+        AdminSearch.done();
+
+        ProjectAccountSearch = createSearchBuilder(Long.class);
+        ProjectAccountSearch.selectField(ProjectAccountSearch.entity().getProjectAccountId());
+        ProjectAccountSearch.and("accountId", ProjectAccountSearch.entity().getAccountId(), Op.EQ);
+        ProjectAccountSearch.done();
+
+        CountByRoleSearch = createSearchBuilder(Long.class);
+        CountByRoleSearch.select(null, Func.COUNT, CountByRoleSearch.entity().getId());
+        CountByRoleSearch.and("accountId", CountByRoleSearch.entity().getAccountId(), Op.EQ);
+        CountByRoleSearch.and("role", CountByRoleSearch.entity().getAccountRole(), Op.EQ);
+        CountByRoleSearch.done();
+    }
+
+    @Override
+    public ProjectAccountVO getProjectOwner(long projectId) {
+        SearchCriteria<ProjectAccountVO> sc = AllFieldsSearch.create();
+        sc.setParameters("role", ProjectAccount.Role.Admin);
+        sc.setParameters("projectId", projectId);
+
+        return findOneBy(sc);
+    }
+
+    @Override
+    public List<ProjectAccountVO> listByProjectId(long projectId) {
+        SearchCriteria<ProjectAccountVO> sc = AllFieldsSearch.create();
+        sc.setParameters("projectId", projectId);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public ProjectAccountVO findByProjectIdAccountId(long projectId, long accountId) {
+        SearchCriteria<ProjectAccountVO> sc = AllFieldsSearch.create();
+        sc.setParameters("projectId", projectId);
+        sc.setParameters("accountId", accountId);
+
+        return findOneBy(sc);
+    }
+
+    @Override
+    public boolean canAccessProjectAccount(long accountId, long projectAccountId) {
+        SearchCriteria<ProjectAccountVO> sc = AllFieldsSearch.create();
+        sc.setParameters("accountId", accountId);
+        sc.setParameters("projectAccountId", projectAccountId);
+
+        if (findOneBy(sc) != null) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public boolean canModifyProjectAccount(long accountId, long projectAccountId) {
+        SearchCriteria<ProjectAccountVO> sc = AllFieldsSearch.create();
+        sc.setParameters("accountId", accountId);
+        sc.setParameters("projectAccountId", projectAccountId);
+        sc.setParameters("role", ProjectAccount.Role.Admin);
+
+        if (findOneBy(sc) != null) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public List<Long> listPermittedAccountIds(long accountId) {
+        SearchCriteria<Long> sc = ProjectAccountSearch.create();
+        sc.setParameters("accountId", accountId);
+        return customSearch(sc, null);
+    }
+
+    @Override
+    public List<Long> listAdministratedProjectIds(long adminAccountId) {
+        SearchCriteria<Long> sc = AdminSearch.create();
+        sc.setParameters("role", ProjectAccount.Role.Admin);
+        sc.setParameters("accountId", adminAccountId);
+        return customSearch(sc, null);
+    }
+
+    @Override
+    public Long countByAccountIdAndRole(long accountId, ProjectAccount.Role role) {
+        SearchCriteria<Long> sc = CountByRoleSearch.create();
+        sc.setParameters("accountId", accountId);
+        sc.setParameters("role", role);
+        return customSearch(sc, null).get(0);
+    }
+    
+    @Override
+    public void removeAccountFromProjects(long accountId) {
+        SearchCriteria<ProjectAccountVO> sc = AllFieldsSearch.create();
+        sc.setParameters("accountId", accountId);
+
+        int rowsRemoved = remove(sc);
+        if (rowsRemoved > 0) {
+            s_logger.debug("Removed account id=" + accountId + " from " + rowsRemoved + " projects");
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/projects/dao/ProjectDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/projects/dao/ProjectDao.java b/engine/schema/src/com/cloud/projects/dao/ProjectDao.java
new file mode 100644
index 0000000..e741f24
--- /dev/null
+++ b/engine/schema/src/com/cloud/projects/dao/ProjectDao.java
@@ -0,0 +1,37 @@
+// 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.projects.dao;
+
+import java.util.List;
+
+import com.cloud.projects.Project;
+import com.cloud.projects.ProjectVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface ProjectDao extends GenericDao<ProjectVO, Long> {
+
+    ProjectVO findByNameAndDomain(String name, long domainId);
+
+    Long countProjectsForDomain(long domainId);
+
+    ProjectVO findByProjectAccountId(long projectAccountId);
+
+    List<ProjectVO> listByState(Project.State state);
+    
+    ProjectVO findByProjectAccountIdIncludingRemoved(long projectAccountId);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/projects/dao/ProjectDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/projects/dao/ProjectDaoImpl.java b/engine/schema/src/com/cloud/projects/dao/ProjectDaoImpl.java
new file mode 100644
index 0000000..ecf40da
--- /dev/null
+++ b/engine/schema/src/com/cloud/projects/dao/ProjectDaoImpl.java
@@ -0,0 +1,124 @@
+// 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.projects.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.projects.Project;
+import com.cloud.projects.ProjectVO;
+import com.cloud.server.ResourceTag.TaggedResourceType;
+import com.cloud.tags.dao.ResourceTagDao;
+import com.cloud.tags.dao.ResourceTagsDaoImpl;
+
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+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;
+
+@Component
+@Local(value = { ProjectDao.class })
+public class ProjectDaoImpl extends GenericDaoBase<ProjectVO, Long> implements ProjectDao {
+    private static final Logger s_logger = Logger.getLogger(ProjectDaoImpl.class);
+    protected final SearchBuilder<ProjectVO> AllFieldsSearch;
+    protected GenericSearchBuilder<ProjectVO, Long> CountByDomain;
+    protected GenericSearchBuilder<ProjectVO, Long> ProjectAccountSearch;
+    // ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class);
+    @Inject ResourceTagDao _tagsDao;
+
+    protected ProjectDaoImpl() {
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("name", AllFieldsSearch.entity().getName(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("domainId", AllFieldsSearch.entity().getDomainId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("projectAccountId", AllFieldsSearch.entity().getProjectAccountId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+
+        CountByDomain = createSearchBuilder(Long.class);
+        CountByDomain.select(null, Func.COUNT, null);
+        CountByDomain.and("domainId", CountByDomain.entity().getDomainId(), SearchCriteria.Op.EQ);
+        CountByDomain.done();
+    }
+
+    @Override
+    public ProjectVO findByNameAndDomain(String name, long domainId) {
+        SearchCriteria<ProjectVO> sc = AllFieldsSearch.create();
+        sc.setParameters("name", name);
+        sc.setParameters("domainId", domainId);
+
+        return findOneBy(sc);
+    }
+
+    @Override
+    @DB
+    public boolean remove(Long projectId) {
+        boolean result = false;
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        ProjectVO projectToRemove = findById(projectId);
+        projectToRemove.setName(null);
+        if (!update(projectId, projectToRemove)) {
+            s_logger.warn("Failed to reset name for the project id=" + projectId + " as a part of project remove");
+            return false;
+        } 
+        
+        _tagsDao.removeByIdAndType(projectId, TaggedResourceType.Project);
+        result = super.remove(projectId);
+        txn.commit();
+
+        return result;
+
+    }
+
+    @Override
+    public Long countProjectsForDomain(long domainId) {
+        SearchCriteria<Long> sc = CountByDomain.create();
+        sc.setParameters("domainId", domainId);
+        return customSearch(sc, null).get(0);
+    }
+
+    @Override
+    public ProjectVO findByProjectAccountId(long projectAccountId) {
+        SearchCriteria<ProjectVO> sc = AllFieldsSearch.create();
+        sc.setParameters("projectAccountId", projectAccountId);
+
+        return findOneBy(sc);
+    }
+
+    @Override
+    public List<ProjectVO> listByState(Project.State state) {
+        SearchCriteria<ProjectVO> sc = AllFieldsSearch.create();
+        sc.setParameters("state", state);
+        return listBy(sc);
+    }
+    
+    @Override
+    public ProjectVO findByProjectAccountIdIncludingRemoved(long projectAccountId) {
+        SearchCriteria<ProjectVO> sc = AllFieldsSearch.create();
+        sc.setParameters("projectAccountId", projectAccountId);
+
+        return findOneIncludingRemovedBy(sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/projects/dao/ProjectInvitationDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/projects/dao/ProjectInvitationDao.java b/engine/schema/src/com/cloud/projects/dao/ProjectInvitationDao.java
new file mode 100644
index 0000000..3788641
--- /dev/null
+++ b/engine/schema/src/com/cloud/projects/dao/ProjectInvitationDao.java
@@ -0,0 +1,44 @@
+// 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.projects.dao;
+
+import java.util.List;
+
+import com.cloud.projects.ProjectInvitation.State;
+import com.cloud.projects.ProjectInvitationVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface ProjectInvitationDao extends GenericDao<ProjectInvitationVO, Long> {
+    ProjectInvitationVO findByAccountIdProjectId(long accountId, long projectId, State... inviteState);
+
+    List<ProjectInvitationVO> listExpiredInvitations();
+
+    boolean expirePendingInvitations(long timeOut);
+
+    boolean isActive(long id, long timeout);
+
+    ProjectInvitationVO findByEmailAndProjectId(String email, long projectId, State... inviteState);
+
+    ProjectInvitationVO findPendingByTokenAndProjectId(String token, long projectId, State... inviteState);
+
+    void cleanupInvitations(long projectId);
+
+    ProjectInvitationVO findPendingById(long id);
+
+    List<ProjectInvitationVO> listInvitationsToExpire(long timeOut);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/projects/dao/ProjectInvitationDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/projects/dao/ProjectInvitationDaoImpl.java b/engine/schema/src/com/cloud/projects/dao/ProjectInvitationDaoImpl.java
new file mode 100644
index 0000000..4491512
--- /dev/null
+++ b/engine/schema/src/com/cloud/projects/dao/ProjectInvitationDaoImpl.java
@@ -0,0 +1,171 @@
+// 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.projects.dao;
+
+import java.sql.Date;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.projects.ProjectInvitation.State;
+import com.cloud.projects.ProjectInvitationVO;
+import com.cloud.utils.DateUtil;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value = { ProjectInvitationDao.class })
+public class ProjectInvitationDaoImpl extends GenericDaoBase<ProjectInvitationVO, Long> implements ProjectInvitationDao {
+    private static final Logger s_logger = Logger.getLogger(ProjectInvitationDaoImpl.class);
+    protected final SearchBuilder<ProjectInvitationVO> AllFieldsSearch;
+    protected final SearchBuilder<ProjectInvitationVO> InactiveSearch;
+
+    protected ProjectInvitationDaoImpl() {
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getForAccountId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("projectId", AllFieldsSearch.entity().getProjectId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("created", AllFieldsSearch.entity().getCreated(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("projectAccountId", AllFieldsSearch.entity().getState(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), SearchCriteria.Op.IN);
+        AllFieldsSearch.and("email", AllFieldsSearch.entity().getEmail(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("token", AllFieldsSearch.entity().getToken(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+
+        InactiveSearch = createSearchBuilder();
+        InactiveSearch.and("id", InactiveSearch.entity().getId(), SearchCriteria.Op.EQ);
+        InactiveSearch.and("accountId", InactiveSearch.entity().getForAccountId(), SearchCriteria.Op.EQ);
+        InactiveSearch.and("projectId", InactiveSearch.entity().getProjectId(), SearchCriteria.Op.EQ);
+        InactiveSearch.and("created", InactiveSearch.entity().getCreated(), SearchCriteria.Op.LTEQ);
+        InactiveSearch.and("state", InactiveSearch.entity().getState(), SearchCriteria.Op.EQ);
+        InactiveSearch.done();
+    }
+
+    @Override
+    public ProjectInvitationVO findByAccountIdProjectId(long accountId, long projectId, State... inviteState) {
+        SearchCriteria<ProjectInvitationVO> sc = AllFieldsSearch.create();
+        sc.setParameters("accountId", accountId);
+        sc.setParameters("projectId", projectId);
+        if (inviteState != null && inviteState.length > 0) {
+            sc.setParameters("state", (Object[]) inviteState);
+        }
+
+        return findOneBy(sc);
+    }
+
+    @Override
+    public List<ProjectInvitationVO> listExpiredInvitations() {
+        SearchCriteria<ProjectInvitationVO> sc = AllFieldsSearch.create();
+        sc.setParameters("state", State.Expired);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public boolean expirePendingInvitations(long timeout) {
+        boolean success = true;
+
+        SearchCriteria<ProjectInvitationVO> sc = InactiveSearch.create();
+        sc.setParameters("created", new Date((DateUtil.currentGMTTime().getTime() >> 10) - timeout));
+        sc.setParameters("state", State.Pending);
+
+        List<ProjectInvitationVO> invitationsToExpire = listBy(sc);
+        for (ProjectInvitationVO invitationToExpire : invitationsToExpire) {
+            invitationToExpire.setState(State.Expired);
+            if (!update(invitationToExpire.getId(), invitationToExpire)) {
+                s_logger.warn("Fail to expire invitation " + invitationToExpire.toString());
+                success = false;
+            }
+        }
+        return success;
+    }
+
+    @Override
+    public List<ProjectInvitationVO> listInvitationsToExpire(long timeOut) {
+        SearchCriteria<ProjectInvitationVO> sc = InactiveSearch.create();
+        sc.setParameters("created", new Date((DateUtil.currentGMTTime().getTime()) - timeOut));
+        sc.setParameters("state", State.Pending);
+        return listBy(sc);
+    }
+
+    @Override
+    public boolean isActive(long id, long timeout) {
+        SearchCriteria<ProjectInvitationVO> sc = InactiveSearch.create();
+
+        sc.setParameters("id", id);
+
+        if (findOneBy(sc) == null) {
+            s_logger.warn("Unable to find project invitation by id " + id);
+            return false;
+        }
+
+        sc.setParameters("created", new Date((DateUtil.currentGMTTime().getTime()) - timeout));
+
+        if (findOneBy(sc) == null) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public ProjectInvitationVO findByEmailAndProjectId(String email, long projectId, State... inviteState) {
+        SearchCriteria<ProjectInvitationVO> sc = AllFieldsSearch.create();
+        sc.setParameters("email", email);
+        sc.setParameters("projectId", projectId);
+        if (inviteState != null && inviteState.length > 0) {
+            sc.setParameters("state", (Object[]) inviteState);
+        }
+
+        return findOneBy(sc);
+    }
+
+    @Override
+    public ProjectInvitationVO findPendingByTokenAndProjectId(String token, long projectId, State... inviteState) {
+        SearchCriteria<ProjectInvitationVO> sc = AllFieldsSearch.create();
+        sc.setParameters("token", token);
+        sc.setParameters("projectId", projectId);
+        if (inviteState != null && inviteState.length > 0) {
+            sc.setParameters("state", (Object[]) inviteState);
+        }
+
+        return findOneBy(sc);
+    }
+
+    @Override
+    public ProjectInvitationVO findPendingById(long id) {
+        SearchCriteria<ProjectInvitationVO> sc = AllFieldsSearch.create();
+        sc.setParameters("id", id);
+        sc.setParameters("state", State.Pending);
+
+        return findOneBy(sc);
+    }
+
+    @Override
+    public void cleanupInvitations(long projectId) {
+        SearchCriteria<ProjectInvitationVO> sc = AllFieldsSearch.create();
+        sc.setParameters("projectId", projectId);
+
+        int numberRemoved = remove(sc);
+        s_logger.debug("Removed " + numberRemoved + " invitations for project id=" + projectId);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/secstorage/CommandExecLogDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/secstorage/CommandExecLogDao.java b/engine/schema/src/com/cloud/secstorage/CommandExecLogDao.java
new file mode 100644
index 0000000..9a7bb6c
--- /dev/null
+++ b/engine/schema/src/com/cloud/secstorage/CommandExecLogDao.java
@@ -0,0 +1,25 @@
+// 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.secstorage;
+
+import java.util.Date;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface CommandExecLogDao extends GenericDao<CommandExecLogVO, Long> {
+	public void expungeExpiredRecords(Date cutTime);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/secstorage/CommandExecLogDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/secstorage/CommandExecLogDaoImpl.java b/engine/schema/src/com/cloud/secstorage/CommandExecLogDaoImpl.java
new file mode 100644
index 0000000..8fa9e41
--- /dev/null
+++ b/engine/schema/src/com/cloud/secstorage/CommandExecLogDaoImpl.java
@@ -0,0 +1,49 @@
+// 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.secstorage;
+
+import java.util.Date;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value={CommandExecLogDao.class})
+public class CommandExecLogDaoImpl extends GenericDaoBase<CommandExecLogVO, Long> implements CommandExecLogDao {
+
+    protected final SearchBuilder<CommandExecLogVO> ExpungeSearch;
+	
+	public CommandExecLogDaoImpl() {
+		ExpungeSearch = createSearchBuilder();
+		ExpungeSearch.and("created", ExpungeSearch.entity().getCreated(), Op.LT);
+		ExpungeSearch.done();
+	}
+	
+	@Override
+	public void expungeExpiredRecords(Date cutTime) {
+		SearchCriteria<CommandExecLogVO> sc = ExpungeSearch.create();
+		sc.setParameters("created", cutTime);
+		expunge(sc);
+	}
+}
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/secstorage/CommandExecLogVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/secstorage/CommandExecLogVO.java b/engine/schema/src/com/cloud/secstorage/CommandExecLogVO.java
new file mode 100644
index 0000000..4ec023e
--- /dev/null
+++ b/engine/schema/src/com/cloud/secstorage/CommandExecLogVO.java
@@ -0,0 +1,112 @@
+// 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.secstorage;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import com.cloud.utils.DateUtil;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="cmd_exec_log")
+public class CommandExecLogVO implements InternalIdentity {
+	
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+	private long id;
+    
+    @Column(name="host_id")
+	private long hostId;
+    
+    @Column(name="instance_id")
+	private long instanceId;
+	
+    @Column(name="command_name")
+	private String commandName;
+    
+    @Column(name="weight")
+    private int weight;
+	
+    @Column(name="created")
+    @Temporal(value=TemporalType.TIMESTAMP)
+    private Date created;
+    
+    public CommandExecLogVO() {
+    }
+    
+    public CommandExecLogVO(long hostId, long instanceId, String commandName, int weight) {
+    	this.hostId = hostId;
+    	this.instanceId = instanceId;
+    	this.commandName = commandName;
+    	this.weight = weight;
+    	this.created = DateUtil.currentGMTTime();
+    }
+    
+    public long getId() {
+    	return this.id;
+    }
+    
+    public long getHostId() {
+    	return this.hostId;
+    }
+    
+    public void setHostId(long hostId) {
+    	this.hostId = hostId;
+    }
+    
+    public long getInstanceId() {
+    	return this.instanceId;
+    }
+    
+    public void setInstanceId(long instanceId) {
+    	this.instanceId = instanceId;
+    }
+    
+    public String getCommandName() {
+    	return this.commandName;
+    }
+    
+    public void setCommandName(String commandName) {
+    	this.commandName = commandName;
+    }
+    
+    public int getWeight() {
+    	return weight;
+    }
+    
+    public void setWeight(int weight) {
+    	this.weight = weight;
+    }
+    
+    public Date getCreated() {
+    	return this.created;
+    }
+    
+    public void setCreated(Date created) {
+    	this.created = created;
+    }
+}


[49/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java b/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java
deleted file mode 100644
index ed3bc62..0000000
--- a/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.to.VolumeTO;
-
-public class CreateVolumeFromVMSnapshotAnswer extends Answer {
-    private String path;
-    private VolumeTO volumeTo;
-
-    public VolumeTO getVolumeTo() {
-        return volumeTo;
-    }
-
-    public CreateVolumeFromVMSnapshotAnswer(
-            CreateVolumeFromVMSnapshotCommand cmd, VolumeTO volumeTo) {
-        super(cmd, true, "");
-        this.volumeTo = volumeTo;
-    }
-
-    public String getPath() {
-        return path;
-    }
-
-    protected CreateVolumeFromVMSnapshotAnswer() {
-
-    }
-
-    public CreateVolumeFromVMSnapshotAnswer(
-            CreateVolumeFromVMSnapshotCommand cmd, String path) {
-        super(cmd, true, "");
-        this.path = path;
-    }
-
-    public CreateVolumeFromVMSnapshotAnswer(
-            CreateVolumeFromVMSnapshotCommand cmd, boolean result, String string) {
-        super(cmd, result, string);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java b/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java
deleted file mode 100644
index 634e15c..0000000
--- a/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java
+++ /dev/null
@@ -1,88 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.vm.DiskProfile;
-
-public class CreateVolumeFromVMSnapshotCommand extends Command {
-
-    protected String path;
-    protected String name;
-    protected Boolean fullClone;
-    protected String storagePoolUuid;
-    private StorageFilerTO pool;
-    private DiskProfile diskProfile;
-    private Long volumeId;
-
-    public DiskProfile getDskch() {
-        return diskProfile;
-    }
-
-    public String getPath() {
-        return path;
-    }
-
-    public Long getVolumeId() {
-        return volumeId;
-    }
-
-    protected CreateVolumeFromVMSnapshotCommand() {
-
-    }
-
-    public CreateVolumeFromVMSnapshotCommand(String path, String name,
-            Boolean fullClone, String storagePoolUuid) {
-        this.path = path;
-        this.name = name;
-        this.fullClone = fullClone;
-        this.storagePoolUuid = storagePoolUuid;
-    }
-
-    public CreateVolumeFromVMSnapshotCommand(String path, String name,
-            Boolean fullClone, String storagePoolUuid, StorageFilerTO pool,
-            DiskProfile diskProfile, Long volumeId) {
-        this.path = path;
-        this.name = name;
-        this.fullClone = fullClone;
-        this.storagePoolUuid = storagePoolUuid;
-        this.pool = pool;
-        this.diskProfile = diskProfile;
-        this.volumeId = volumeId;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public Boolean getFullClone() {
-        return fullClone;
-    }
-
-    public String getStoragePoolUuid() {
-        return storagePoolUuid;
-    }
-
-    public StorageFilerTO getPool() {
-        return pool;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CronCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CronCommand.java b/api/src/com/cloud/agent/api/CronCommand.java
deleted file mode 100755
index c43237c..0000000
--- a/api/src/com/cloud/agent/api/CronCommand.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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.agent.api;
-
-public interface CronCommand {
-    /**
-     * @return interval at which to run the command in seconds.
-     */
-    public int getInterval();
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/DeleteObjectFromSwiftCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/DeleteObjectFromSwiftCommand.java b/api/src/com/cloud/agent/api/DeleteObjectFromSwiftCommand.java
deleted file mode 100644
index 3d62c50..0000000
--- a/api/src/com/cloud/agent/api/DeleteObjectFromSwiftCommand.java
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-import com.cloud.agent.api.to.SwiftTO;
-
-/**
- *
- *
- */
-
-public class DeleteObjectFromSwiftCommand extends Command {
-    @LogLevel(Log4jLevel.Off)
-    private SwiftTO swift;
-    private String container;
-    private String object;
-
-    protected DeleteObjectFromSwiftCommand() {
-
-    }
-
-    public DeleteObjectFromSwiftCommand(SwiftTO swift, String container, String object) {
-        this.swift = swift;
-        this.container = container;
-        this.object = object;
-    }
-
-    public SwiftTO getSwift() {
-        return this.swift;
-    }
-
-    public String getContainer() {
-        return container;
-    }
-
-    public String getObject() {
-        return object;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        // TODO Auto-generated method stub
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java b/api/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java
deleted file mode 100644
index 9a895d8..0000000
--- a/api/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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.agent.api;
-
-
-public class DeleteSnapshotBackupAnswer extends Answer {
-
-    protected DeleteSnapshotBackupAnswer() {
-
-    }
-
-    public DeleteSnapshotBackupAnswer(DeleteSnapshotBackupCommand cmd, boolean success, String details) {
-        super(cmd, success, details);
-    }
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java b/api/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
deleted file mode 100644
index 128df84..0000000
--- a/api/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
+++ /dev/null
@@ -1,96 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-import com.cloud.agent.api.to.S3TO;
-import com.cloud.agent.api.to.SwiftTO;
-import com.cloud.storage.StoragePool;
-
-/**
- * This command encapsulates a primitive operation which enables coalescing the backed up VHD snapshots on the secondary server
- * This currently assumes that the secondary storage are mounted on the XenServer.
- */
-public class DeleteSnapshotBackupCommand extends SnapshotCommand {
-    @LogLevel(Log4jLevel.Off)
-    private SwiftTO swift;
-    private S3TO s3;
-    private Boolean all;
-
-    public SwiftTO getSwift() {
-        return swift;
-    }
-
-    public Boolean isAll() {
-        return all;
-    }
-
-    public void setAll(Boolean all) {
-        this.all = all;
-    }
-
-    public void setSwift(SwiftTO swift) {
-        this.swift = swift;
-    }
-
-    public S3TO getS3() {
-        return s3;
-    }
-
-    protected DeleteSnapshotBackupCommand() {
-    }
-
-    /**
-     * Given 2 VHD files on the secondary storage which are linked in a parent chain as follows:
-     * backupUUID = parent(childUUID)
-     * It gets another VHD
-     * previousBackupVHD = parent(backupUUID)
-     *
-     * And
-     * 1) it coalesces backupUuid into its parent.
-     * 2) It deletes the VHD file corresponding to backupUuid
-     * 3) It sets the parent VHD of childUUID to that of previousBackupUuid
-     *
-     * It takes care of the cases when
-     * 1) childUUID is null. - Step 3 is not done.
-     * 2) previousBackupUUID is null
-     *       - Merge childUUID into its parent backupUUID
-     *       - Set the UUID of the resultant VHD to childUUID
-     *       - Essentially we are deleting the oldest VHD file and setting the current oldest VHD to childUUID
-     *
-     * @param volumeName                  The name of the volume whose snapshot was taken (something like i-3-SV-ROOT)
-     * @param secondaryStoragePoolURL    This is what shows up in the UI when you click on Secondary storage.
-     *                                    In the code, it is present as: In the vmops.host_details table, there is a field mount.parent. This is the value of that field
-     *                                    If you have better ideas on how to get it, you are welcome.
-     * @param backupUUID                  The VHD which has to be deleted
-     * @param childUUID                   The child VHD file of the backup whose parent is reset to its grandparent.
-     */
-    public DeleteSnapshotBackupCommand(StoragePool pool,
-                                       SwiftTO swift,
-                                       S3TO s3,
-                                       String secondaryStoragePoolURL,
-                                       Long   dcId,
-                                       Long   accountId,
-                                       Long   volumeId,
- String backupUUID, Boolean all)
-    {
-        super(pool, secondaryStoragePoolURL, backupUUID, null, dcId, accountId, volumeId);
-        setSwift(swift);
-        this.s3 = s3;
-        setAll(all);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java b/api/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java
deleted file mode 100644
index e2071d7..0000000
--- a/api/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java
+++ /dev/null
@@ -1,63 +0,0 @@
-// 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.agent.api;
-
-/**
- * This command encapsulates a primitive operation which enables coalescing the backed up VHD snapshots on the secondary server
- * This currently assumes that the secondary storage are mounted on the XenServer.
- */
-public class DeleteSnapshotsDirCommand extends Command {
-    String secondaryStorageUrl;
-    Long dcId;
-    Long accountId;
-    Long volumeId;
-
-    protected DeleteSnapshotsDirCommand() {
-
-    }
-
-    public DeleteSnapshotsDirCommand(String secondaryStorageUrl,
- Long dcId, Long accountId, Long volumeId)
-    {
-        this.secondaryStorageUrl = secondaryStorageUrl;
-        this.dcId = dcId;
-        this.accountId = accountId;
-        this.volumeId = volumeId;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public String getSecondaryStorageUrl() {
-        return secondaryStorageUrl;
-    }
-
-    public Long getDcId() {
-        return dcId;
-    }
-
-    public Long getAccountId() {
-        return accountId;
-    }
-
-    public Long getVolumeId() {
-        return volumeId;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/DeleteStoragePoolCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/DeleteStoragePoolCommand.java b/api/src/com/cloud/agent/api/DeleteStoragePoolCommand.java
deleted file mode 100644
index 4618d59..0000000
--- a/api/src/com/cloud/agent/api/DeleteStoragePoolCommand.java
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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.agent.api;
-
-import java.io.File;
-import java.util.UUID;
-
-import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.storage.StoragePool;
-
-public class DeleteStoragePoolCommand extends Command {
-
-	StorageFilerTO pool;
-	public static final String LOCAL_PATH_PREFIX="/mnt/";
-	String localPath;
-
-	public DeleteStoragePoolCommand() {
-
-	}
-
-    public DeleteStoragePoolCommand(StoragePool pool, String localPath) {
-    	this.pool = new StorageFilerTO(pool);
-    	this.localPath = localPath;
-    }
-
-    public DeleteStoragePoolCommand(StoragePool pool) {
-		this(pool, LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes()));
-	}
-
-    public StorageFilerTO getPool() {
-        return pool;
-    }
-
-    public void setPool(StoragePool pool) {
-        this.pool = new StorageFilerTO(pool);
-    }
-
-	@Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-	public String getLocalPath() {
-		return localPath;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/DeleteTemplateFromS3Command.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/DeleteTemplateFromS3Command.java b/api/src/com/cloud/agent/api/DeleteTemplateFromS3Command.java
deleted file mode 100644
index 278669b..0000000
--- a/api/src/com/cloud/agent/api/DeleteTemplateFromS3Command.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.agent.api;
-
-import com.cloud.agent.api.to.S3TO;
-
-public class DeleteTemplateFromS3Command extends Command {
-
-    private S3TO s3;
-    private Long templateId;
-    private Long accountId;
-
-    protected DeleteTemplateFromS3Command() {
-        super();
-    }
-
-    public DeleteTemplateFromS3Command(final S3TO s3, final Long accountId,
-            final Long templateId) {
-
-        super();
-
-        this.s3 = s3;
-        this.accountId = accountId;
-        this.templateId = templateId;
-
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result
-                + ((accountId == null) ? 0 : accountId.hashCode());
-        result = prime * result + ((s3 == null) ? 0 : s3.hashCode());
-        result = prime * result
-                + ((templateId == null) ? 0 : templateId.hashCode());
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object thatObject) {
-
-        if (this == thatObject) {
-            return true;
-        }
-
-        if (thatObject == null) {
-            return false;
-        }
-
-        if (getClass() != thatObject.getClass()) {
-            return false;
-        }
-
-        final DeleteTemplateFromS3Command thatCommand = (DeleteTemplateFromS3Command) thatObject;
-
-        if (!(accountId == thatCommand.accountId)
-                || (this.accountId != null && this.accountId
-                        .equals(thatCommand.accountId))) {
-            return false;
-        }
-
-        if (!(templateId == thatCommand.templateId)
-                || (this.templateId != null && this.templateId
-                        .equals(thatCommand.templateId))) {
-            return false;
-        }
-
-        return true;
-
-    }
-
-    public S3TO getS3() {
-        return s3;
-    }
-
-    public Long getTemplateId() {
-        return templateId;
-    }
-
-    public Long getAccountId() {
-        return accountId;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java b/api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
deleted file mode 100644
index 8f4ecad..0000000
--- a/api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// 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.agent.api;
-
-import java.util.List;
-
-import com.cloud.agent.api.to.VolumeTO;
-
-public class DeleteVMSnapshotAnswer extends Answer {
-    private List<VolumeTO> volumeTOs;
-
-    public DeleteVMSnapshotAnswer() {
-    }
-
-    public DeleteVMSnapshotAnswer(DeleteVMSnapshotCommand cmd, boolean result,
-            String message) {
-        super(cmd, result, message);
-    }
-
-    public DeleteVMSnapshotAnswer(DeleteVMSnapshotCommand cmd,
-            List<VolumeTO> volumeTOs) {
-        super(cmd, true, "");
-        this.volumeTOs = volumeTOs;
-    }
-
-    public List<VolumeTO> getVolumeTOs() {
-        return volumeTOs;
-    }
-
-    public void setVolumeTOs(List<VolumeTO> volumeTOs) {
-        this.volumeTOs = volumeTOs;
-    }
-
- 
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java b/api/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java
deleted file mode 100644
index c213448..0000000
--- a/api/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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.agent.api;
-
-import java.util.List;
-
-import com.cloud.agent.api.to.VolumeTO;
-
-
-public class DeleteVMSnapshotCommand extends VMSnapshotBaseCommand {
-    public DeleteVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType) {
-        super( vmName,  snapshot, volumeTOs, guestOSType);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/DownloadSnapshotFromS3Command.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/DownloadSnapshotFromS3Command.java b/api/src/com/cloud/agent/api/DownloadSnapshotFromS3Command.java
deleted file mode 100644
index edf683a..0000000
--- a/api/src/com/cloud/agent/api/DownloadSnapshotFromS3Command.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.agent.api;
-
-import com.cloud.agent.api.to.S3TO;
-
-public class DownloadSnapshotFromS3Command extends SnapshotCommand {
-
-    private S3TO s3;
-    private String parent;
-
-    protected DownloadSnapshotFromS3Command() {
-        super();
-    }
-
-    public DownloadSnapshotFromS3Command(S3TO s3, String parent,
-            String secondaryStorageUrl, Long dcId, Long accountId,
-            Long volumeId, String backupUuid, int wait) {
-
-        super(null, secondaryStorageUrl, backupUuid, "", dcId, accountId,
-                volumeId);
-
-        this.s3 = s3;
-        this.parent = parent;
-        setWait(wait);
-
-    }
-
-    public S3TO getS3() {
-        return s3;
-    }
-
-    public void setS3(S3TO s3) {
-        this.s3 = s3;
-    }
-
-    public String getParent() {
-        return parent;
-    }
-
-    public void setParent(String parent) {
-        this.parent = parent;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/DownloadTemplateFromS3ToSecondaryStorageCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/DownloadTemplateFromS3ToSecondaryStorageCommand.java b/api/src/com/cloud/agent/api/DownloadTemplateFromS3ToSecondaryStorageCommand.java
deleted file mode 100644
index af61228..0000000
--- a/api/src/com/cloud/agent/api/DownloadTemplateFromS3ToSecondaryStorageCommand.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.agent.api;
-
-import com.cloud.agent.api.to.S3TO;
-
-public final class DownloadTemplateFromS3ToSecondaryStorageCommand extends Command {
-
-    private final S3TO s3;
-    private final Long accountId;
-    private final Long templateId;
-    private final String storagePath;
-
-    public DownloadTemplateFromS3ToSecondaryStorageCommand(final S3TO s3,
-        final Long accountId, final Long templateId,
-        final String storagePath, final int wait) {
-
-        super();
-
-        this.s3 = s3;
-        this.accountId = accountId;
-        this.templateId = templateId;
-        this.storagePath = storagePath;
-
-        setWait(wait);
-
-    }
-
-    public S3TO getS3() {
-        return this.s3;
-    }
-
-    public Long getAccountId() {
-        return this.accountId;
-    }
-
-    public Long getTemplateId() {
-        return this.templateId;
-    }
-
-    public String getStoragePath() {
-        return this.storagePath;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/FenceAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/FenceAnswer.java b/api/src/com/cloud/agent/api/FenceAnswer.java
deleted file mode 100644
index 7af18f5..0000000
--- a/api/src/com/cloud/agent/api/FenceAnswer.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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.agent.api;
-
-public class FenceAnswer extends Answer {
-    public FenceAnswer() {
-        super();
-    }
-
-    public FenceAnswer(FenceCommand cmd) {
-        super(cmd, true, null);
-    }
-
-    public FenceAnswer(FenceCommand cmd, String details) {
-        super(cmd, true, details);
-    }
-
-    public FenceAnswer(FenceCommand cmd, boolean result, String details) {
-        super(cmd, result, details);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/FenceCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/FenceCommand.java b/api/src/com/cloud/agent/api/FenceCommand.java
deleted file mode 100644
index a891944..0000000
--- a/api/src/com/cloud/agent/api/FenceCommand.java
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.host.Host;
-import com.cloud.vm.VirtualMachine;
-
-public class FenceCommand extends Command {
-
-    public FenceCommand() {
-        super();
-    }
-
-    String vmName;
-    String hostGuid;
-    String hostIp;
-    boolean inSeq;
-
-    public FenceCommand(VirtualMachine vm, Host host) {
-        super();
-        vmName = vm.getInstanceName();
-        hostGuid = host.getGuid();
-        hostIp = host.getPrivateIpAddress();
-        inSeq = false;
-    }
-
-    public void setSeq(boolean inseq) {
-    	inSeq = inseq;
-    }
-
-    public String getVmName() {
-        return vmName;
-    }
-
-    public String getHostGuid() {
-        return hostGuid;
-    }
-
-    public String getHostIp() {
-        return hostIp;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return inSeq;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/GetDomRVersionAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/GetDomRVersionAnswer.java b/api/src/com/cloud/agent/api/GetDomRVersionAnswer.java
deleted file mode 100644
index 7487b57..0000000
--- a/api/src/com/cloud/agent/api/GetDomRVersionAnswer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.agent.api;
-
-public class GetDomRVersionAnswer extends Answer {
-    public static final String ROUTER_NAME = "router.name";
-    public static final String ROUTER_IP = "router.ip";
-    String templateVersion;
-    String scriptsVersion;
-
-    protected GetDomRVersionAnswer() {
-    }
-
-    public GetDomRVersionAnswer(GetDomRVersionCmd cmd, String details, String templateVersion, String scriptsVersion) {
-        super(cmd, true, details);
-        this.templateVersion = templateVersion;
-        this.scriptsVersion = scriptsVersion;
-    }
-
-    public GetDomRVersionAnswer(GetDomRVersionCmd cmd, String details) {
-        super(cmd, false, details);
-    }
-
-    public String getTemplateVersion() {
-        return this.templateVersion;
-    }
-
-    public String getScriptsVersion() {
-        return this.scriptsVersion;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/GetDomRVersionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/GetDomRVersionCmd.java b/api/src/com/cloud/agent/api/GetDomRVersionCmd.java
deleted file mode 100644
index 577c386..0000000
--- a/api/src/com/cloud/agent/api/GetDomRVersionCmd.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.routing.NetworkElementCommand;
-
-public class GetDomRVersionCmd extends NetworkElementCommand {
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-    public GetDomRVersionCmd() {
-        super();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/GetFileStatsAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/GetFileStatsAnswer.java b/api/src/com/cloud/agent/api/GetFileStatsAnswer.java
deleted file mode 100755
index f93070e..0000000
--- a/api/src/com/cloud/agent/api/GetFileStatsAnswer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-import com.cloud.storage.VolumeStats;
-
-@LogLevel(Log4jLevel.Trace)
-public class GetFileStatsAnswer extends Answer implements VolumeStats {
-    long size;
-    protected GetFileStatsAnswer() {
-    }
-
-    public GetFileStatsAnswer(GetFileStatsCommand cmd, long value) {
-        super(cmd);
-        size = value;
-    }
-
-    @Override
-    public long getBytesUsed() {
-        return size;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/GetFileStatsCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/GetFileStatsCommand.java b/api/src/com/cloud/agent/api/GetFileStatsCommand.java
deleted file mode 100755
index c6dc213..0000000
--- a/api/src/com/cloud/agent/api/GetFileStatsCommand.java
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-import com.cloud.storage.Volume;
-
-@LogLevel(Log4jLevel.Trace)
-public class GetFileStatsCommand extends Command {
-    protected GetFileStatsCommand() {
-    }
-
-    String paths;
-
-    public GetFileStatsCommand(Volume volume) {
-        paths = volume.getPath();
-    }
-
-    public String getPaths() {
-        return paths;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/GetHostStatsAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/GetHostStatsAnswer.java b/api/src/com/cloud/agent/api/GetHostStatsAnswer.java
deleted file mode 100755
index 897d7f9..0000000
--- a/api/src/com/cloud/agent/api/GetHostStatsAnswer.java
+++ /dev/null
@@ -1,88 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-import com.cloud.host.HostStats;
-
-@LogLevel(Log4jLevel.Trace)
-public class GetHostStatsAnswer extends Answer implements HostStats {
-
-    HostStatsEntry hostStats;
-
-    protected GetHostStatsAnswer() {
-        hostStats = new HostStatsEntry();
-    }
-
-    public GetHostStatsAnswer(GetHostStatsCommand cmd, HostStatsEntry hostStatistics) {
-        super(cmd);
-        this.hostStats = hostStatistics;
-    }
-
-    public GetHostStatsAnswer(GetHostStatsCommand cmd, double cpuUtilization, double freeMemoryKBs, double totalMemoryKBs, double networkReadKBs,
-            double networkWriteKBs, String entityType) {
-        super(cmd);
-        hostStats = new HostStatsEntry();
-
-        hostStats.setCpuUtilization(cpuUtilization);
-        hostStats.setFreeMemoryKBs(freeMemoryKBs);
-        hostStats.setTotalMemoryKBs(totalMemoryKBs);
-        hostStats.setNetworkReadKBs(networkReadKBs);
-        hostStats.setNetworkWriteKBs(networkWriteKBs);
-        hostStats.setEntityType(entityType);
-    }
-
-    @Override
-    public double getUsedMemory() {
-        return hostStats.getUsedMemory();
-    }
-
-    @Override
-    public double getFreeMemoryKBs() {
-        return hostStats.getFreeMemoryKBs();
-    }
-
-    @Override
-    public double getTotalMemoryKBs() {
-        return hostStats.getTotalMemoryKBs();
-    }
-
-    @Override
-    public double getCpuUtilization() {
-        return hostStats.getCpuUtilization();
-    }
-
-    @Override
-    public double getNetworkReadKBs() {
-        return hostStats.getNetworkReadKBs();
-    }
-
-    @Override
-    public double getNetworkWriteKBs() {
-        return hostStats.getNetworkWriteKBs();
-    }
-
-    @Override
-    public String getEntityType() {
-        return hostStats.getEntityType();
-    }
-
-    @Override
-    public HostStats getHostStats() {
-        return hostStats;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/GetHostStatsCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/GetHostStatsCommand.java b/api/src/com/cloud/agent/api/GetHostStatsCommand.java
deleted file mode 100755
index f10a9cd..0000000
--- a/api/src/com/cloud/agent/api/GetHostStatsCommand.java
+++ /dev/null
@@ -1,53 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-
-@LogLevel(Log4jLevel.Trace)
-public class GetHostStatsCommand extends Command
-{
-    String hostGuid;
-    String hostName;
-    long hostId;
-
-    protected GetHostStatsCommand() {
-    }
-
-    public GetHostStatsCommand(String hostGuid, String hostName, long hostId) {
-        this.hostGuid = hostGuid;
-        this.hostName = hostName;
-        this.hostId = hostId;
-    }
-
-    public String getHostGuid(){
-        return this.hostGuid;
-    }
-
-    public String getHostName(){
-        return this.hostName;
-    }
-
-    public long getHostId(){
-        return this.hostId;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/GetStorageStatsAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/GetStorageStatsAnswer.java b/api/src/com/cloud/agent/api/GetStorageStatsAnswer.java
deleted file mode 100755
index 2443e8e..0000000
--- a/api/src/com/cloud/agent/api/GetStorageStatsAnswer.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-import com.cloud.storage.StorageStats;
-
-@LogLevel(Log4jLevel.Trace)
-public class GetStorageStatsAnswer extends Answer implements StorageStats {
-    protected GetStorageStatsAnswer() {
-    }
-
-    protected long used;
-
-    protected long capacity;
-
-    @Override
-    public long getByteUsed() {
-        return used;
-    }
-
-    @Override
-    public long getCapacityBytes() {
-        return capacity;
-    }
-
-
-    public GetStorageStatsAnswer(GetStorageStatsCommand cmd, long capacity, long used) {
-        super(cmd, true, null);
-        this.capacity = capacity;
-        this.used = used;
-    }
-
-    public GetStorageStatsAnswer(GetStorageStatsCommand cmd, String details) {
-        super(cmd, false, details);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/GetStorageStatsCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/GetStorageStatsCommand.java b/api/src/com/cloud/agent/api/GetStorageStatsCommand.java
deleted file mode 100755
index f7ebd51..0000000
--- a/api/src/com/cloud/agent/api/GetStorageStatsCommand.java
+++ /dev/null
@@ -1,76 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-import com.cloud.storage.Storage.StoragePoolType;
-
-@LogLevel(Log4jLevel.Trace)
-public class GetStorageStatsCommand extends Command {
-    private String id;
-    private String localPath;
-    private StoragePoolType pooltype;
-    private String secUrl;
-
-
-    public String getSecUrl() {
-		return secUrl;
-	}
-
-	public void setSecUrl(String secUrl) {
-		this.secUrl = secUrl;
-	}
-
-	public GetStorageStatsCommand() {
-    }
-
-    public StoragePoolType getPooltype() {
-        return pooltype;
-    }
-
-    public void setPooltype(StoragePoolType pooltype) {
-        this.pooltype = pooltype;
-    }
-
-    public GetStorageStatsCommand(String secUrl) {
-        this.secUrl = secUrl;
-    }
-
-    public GetStorageStatsCommand(String id, StoragePoolType pooltype) {
-        this.id = id;
-        this.pooltype = pooltype;
-    }
-
-    public GetStorageStatsCommand(String id, StoragePoolType pooltype, String localPath) {
-        this.id = id;
-        this.pooltype = pooltype;
-        this.localPath = localPath;
-    }
-
-    public String getStorageId() {
-        return this.id;
-    }
-
-    public String getLocalPath() {
-        return this.localPath;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/GetVmStatsAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/GetVmStatsAnswer.java b/api/src/com/cloud/agent/api/GetVmStatsAnswer.java
deleted file mode 100755
index c02eb9a..0000000
--- a/api/src/com/cloud/agent/api/GetVmStatsAnswer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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.agent.api;
-
-import java.util.HashMap;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-
-@LogLevel(Log4jLevel.Trace)
-public class GetVmStatsAnswer extends Answer {
-
-    HashMap<String, VmStatsEntry> vmStatsMap;
-
-    public GetVmStatsAnswer(GetVmStatsCommand cmd, HashMap<String, VmStatsEntry> vmStatsMap) {
-        super(cmd);
-        this.vmStatsMap = vmStatsMap;
-    }
-
-    public HashMap<String, VmStatsEntry> getVmStatsMap() {
-        return vmStatsMap;
-    }
-
-    protected GetVmStatsAnswer() {
-        //no-args constructor for json serialization-deserialization
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/GetVmStatsCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/GetVmStatsCommand.java b/api/src/com/cloud/agent/api/GetVmStatsCommand.java
deleted file mode 100755
index 41b0f98..0000000
--- a/api/src/com/cloud/agent/api/GetVmStatsCommand.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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.agent.api;
-
-import java.util.List;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-
-@LogLevel(Log4jLevel.Trace)
-public class GetVmStatsCommand extends Command {
-    List<String> vmNames;
-    String hostGuid;
-    String hostName;
-
-    protected GetVmStatsCommand() {
-    }
-
-    public GetVmStatsCommand(List<String> vmNames, String hostGuid, String hostName) {
-        this.vmNames = vmNames;
-        this.hostGuid = hostGuid;
-        this.hostName = hostName;
-    }
-
-    public List<String> getVmNames() {
-        return vmNames;
-    }
-
-    public String getHostGuid(){
-        return this.hostGuid;
-    }
-
-    public String getHostName(){
-        return this.hostName;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/GetVncPortAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/GetVncPortAnswer.java b/api/src/com/cloud/agent/api/GetVncPortAnswer.java
deleted file mode 100644
index 5e94a18..0000000
--- a/api/src/com/cloud/agent/api/GetVncPortAnswer.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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.agent.api;
-
-public class GetVncPortAnswer extends Answer {
-	String address;
-    int port;
-
-    protected GetVncPortAnswer() {
-    }
-
-    public GetVncPortAnswer(GetVncPortCommand cmd, int port) {
-        super(cmd, true, null);
-        this.port = port;
-    }
-
-    public GetVncPortAnswer(GetVncPortCommand cmd, String address, int port) {
-        super(cmd, true, null);
-        this.address = address;
-        this.port = port;
-    }
-
-    public GetVncPortAnswer(GetVncPortCommand cmd, String details) {
-        super(cmd, false, details);
-    }
-
-    public String getAddress() {
-    	return address;
-    }
-
-    public int getPort() {
-        return port;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/GetVncPortCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/GetVncPortCommand.java b/api/src/com/cloud/agent/api/GetVncPortCommand.java
deleted file mode 100644
index 06165dc..0000000
--- a/api/src/com/cloud/agent/api/GetVncPortCommand.java
+++ /dev/null
@@ -1,43 +0,0 @@
-// 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.agent.api;
-
-public class GetVncPortCommand extends Command {
-    long id;
-    String name;
-
-    public GetVncPortCommand() {
-    }
-
-    public GetVncPortCommand(long id, String name) {
-        this.id = id;
-        this.name = name;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public long getId() {
-        return id;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/HostStatsEntry.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/HostStatsEntry.java b/api/src/com/cloud/agent/api/HostStatsEntry.java
deleted file mode 100644
index 0d8cfb2..0000000
--- a/api/src/com/cloud/agent/api/HostStatsEntry.java
+++ /dev/null
@@ -1,113 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.host.HostStats;
-
-public class HostStatsEntry implements HostStats {
-
-	long hostId;
-	String entityType;
-	double cpuUtilization;
-	double networkReadKBs;
-	double networkWriteKBs;
-    double totalMemoryKBs;
-    double freeMemoryKBs;
-
-    public HostStatsEntry() {
-    }
-
-    public HostStatsEntry(long hostId,double cpuUtilization, double networkReadKBs, double networkWriteKBs, String entityType,
-		double totalMemoryKBs, double freeMemoryKBs, double xapiMemoryUsageKBs, double averageLoad)
-    {
-        this.hostId = hostId;
-        this.entityType = entityType;
-        this.cpuUtilization = cpuUtilization;
-        this.networkReadKBs = networkReadKBs;
-        this.networkWriteKBs = networkWriteKBs;
-        this.totalMemoryKBs = totalMemoryKBs;
-        this.freeMemoryKBs = freeMemoryKBs;
-    }
-
-	@Override
-    public double getNetworkReadKBs() {
-    	return networkReadKBs;
-    }
-
-    public void setNetworkReadKBs(double networkReadKBs) {
-    	this.networkReadKBs = networkReadKBs;
-    }
-
-	@Override
-    public double getNetworkWriteKBs() {
-    	return networkWriteKBs;
-    }
-
-    public void setNetworkWriteKBs(double networkWriteKBs) {
-    	this.networkWriteKBs = networkWriteKBs;
-    }
-
-	@Override
-    public String getEntityType(){
-    	return this.entityType;
-    }
-
-    public void setEntityType(String entityType){
-    	this.entityType = entityType;
-    }
-
-	@Override
-    public double getTotalMemoryKBs(){
-    	return this.totalMemoryKBs;
-    }
-
-    public void setTotalMemoryKBs(double totalMemoryKBs){
-    	this.totalMemoryKBs = totalMemoryKBs;
-    }
-
-	@Override
-    public double getFreeMemoryKBs(){
-    	return this.freeMemoryKBs;
-    }
-
-    public void setFreeMemoryKBs(double freeMemoryKBs){
-    	this.freeMemoryKBs = freeMemoryKBs;
-    }
-
-	@Override
-	public double getCpuUtilization() {
-		return this.cpuUtilization;
-	}
-
-	public void setCpuUtilization(double cpuUtilization) {
-		this.cpuUtilization = cpuUtilization;
-	}
-
-	@Override
-	public double getUsedMemory() {
-		return (totalMemoryKBs-freeMemoryKBs);
-	}
-
-	@Override
-	public HostStats getHostStats() {
-		return this;
-	}
-
-	public void setHostId(long hostId) {
-		this.hostId = hostId;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/MaintainAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/MaintainAnswer.java b/api/src/com/cloud/agent/api/MaintainAnswer.java
deleted file mode 100644
index dcfdab3..0000000
--- a/api/src/com/cloud/agent/api/MaintainAnswer.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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.agent.api;
-
-public class MaintainAnswer extends Answer {
-	boolean willMigrate;
-
-    public MaintainAnswer() {
-    }
-
-    public MaintainAnswer(MaintainCommand cmd) {
-        this(cmd, true, null);
-    }
-
-    public MaintainAnswer(MaintainCommand cmd, boolean willMigrate) {
-        this(cmd, true, null);
-        this.willMigrate = willMigrate;
-    }
-
-    public MaintainAnswer(MaintainCommand cmd, String details) {
-        this(cmd, true, details);
-    }
-
-    public MaintainAnswer(MaintainCommand cmd, boolean result, String details) {
-        super(cmd, result, details);
-        this.willMigrate = true;
-    }
-
-    public boolean getMigrate() {
-    	return this.willMigrate;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/MaintainCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/MaintainCommand.java b/api/src/com/cloud/agent/api/MaintainCommand.java
deleted file mode 100644
index 2a9b9a5..0000000
--- a/api/src/com/cloud/agent/api/MaintainCommand.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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.agent.api;
-
-public class MaintainCommand extends Command {
-
-    public MaintainCommand() {
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ManageSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ManageSnapshotAnswer.java b/api/src/com/cloud/agent/api/ManageSnapshotAnswer.java
deleted file mode 100644
index e490bdf..0000000
--- a/api/src/com/cloud/agent/api/ManageSnapshotAnswer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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.agent.api;
-
-
-public class ManageSnapshotAnswer extends Answer {
-    // For create Snapshot
-    private String _snapshotPath;
-
-    public ManageSnapshotAnswer() {}
-
-    public ManageSnapshotAnswer(Command cmd, boolean success, String result) {
-        super(cmd, success, result);
-    }
-
-    // For XenServer
-    public ManageSnapshotAnswer(ManageSnapshotCommand cmd, long snapshotId, String snapshotPath, boolean success, String result) {
-    	super(cmd, success, result);
-    	_snapshotPath = snapshotPath;
-    }
-
-    public String getSnapshotPath() {
-    	return _snapshotPath;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ManageSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ManageSnapshotCommand.java b/api/src/com/cloud/agent/api/ManageSnapshotCommand.java
deleted file mode 100644
index 5effc54..0000000
--- a/api/src/com/cloud/agent/api/ManageSnapshotCommand.java
+++ /dev/null
@@ -1,92 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.storage.StoragePool;
-
-
-public class ManageSnapshotCommand extends Command {
-    // XXX: Should be an enum
-    // XXX: Anyway there is something called inheritance in Java
-    public static String CREATE_SNAPSHOT = "-c";
-    public static String DESTROY_SNAPSHOT = "-d";
-
-    private String _commandSwitch;
-
-    // Information about the volume that the snapshot is based on
-    private String _volumePath = null;
-	StorageFilerTO _pool;
-
-    // Information about the snapshot
-    private String _snapshotPath = null;
-    private String _snapshotName = null;
-    private long _snapshotId;
-    private String _vmName = null;
-
-    public ManageSnapshotCommand() {}
-
-    public ManageSnapshotCommand(long snapshotId, String volumePath, StoragePool pool, String preSnapshotPath ,String snapshotName, String vmName) {
-        _commandSwitch = ManageSnapshotCommand.CREATE_SNAPSHOT;
-        _volumePath = volumePath;
-        _pool = new StorageFilerTO(pool);
-        _snapshotPath = preSnapshotPath;
-        _snapshotName = snapshotName;
-        _snapshotId = snapshotId;
-        _vmName = vmName;
-    }
-
-    public ManageSnapshotCommand(long snapshotId, String snapshotPath) {
-        _commandSwitch = ManageSnapshotCommand.DESTROY_SNAPSHOT;
-        _snapshotPath = snapshotPath;
-    }
-
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-    public String getCommandSwitch() {
-        return _commandSwitch;
-    }
-
-    public String getVolumePath() {
-        return _volumePath;
-    }
-
-    public StorageFilerTO getPool() {
-        return _pool;
-    }
-
-    public String getSnapshotPath() {
-    	return _snapshotPath;
-    }
-
-    public String getSnapshotName() {
-        return _snapshotName;
-    }
-
-    public long getSnapshotId() {
-        return _snapshotId;
-    }
-
-    public String getVmName() {
-    	return _vmName;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/MigrateAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/MigrateAnswer.java b/api/src/com/cloud/agent/api/MigrateAnswer.java
deleted file mode 100644
index 19d690a..0000000
--- a/api/src/com/cloud/agent/api/MigrateAnswer.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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.agent.api;
-
-public class MigrateAnswer extends Answer {
-    Integer vncPort = null;
-
-    protected MigrateAnswer() {
-    }
-
-    public MigrateAnswer(MigrateCommand cmd, boolean result, String detail, Integer vncPort) {
-        super(cmd, result, detail);
-        this.vncPort = vncPort;
-    }
-
-    public Integer getVncPort() {
-        return vncPort;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/MigrateCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/MigrateCommand.java b/api/src/com/cloud/agent/api/MigrateCommand.java
deleted file mode 100644
index 5042b8c..0000000
--- a/api/src/com/cloud/agent/api/MigrateCommand.java
+++ /dev/null
@@ -1,59 +0,0 @@
-// 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.agent.api;
-
-public class MigrateCommand extends Command {
-    String vmName;
-    String destIp;
-    String hostGuid;
-    boolean isWindows;
-
-
-    protected MigrateCommand() {
-    }
-
-    public MigrateCommand(String vmName, String destIp, boolean isWindows) {
-        this.vmName = vmName;
-        this.destIp = destIp;
-        this.isWindows = isWindows;
-    }
-
-    public boolean isWindows() {
-        return isWindows;
-    }
-
-    public String getDestinationIp() {
-        return destIp;
-    }
-
-    public String getVmName() {
-        return vmName;
-    }
-
-    public void setHostGuid(String guid) {
-        this.hostGuid = guid;
-    }
-
-    public String getHostGuid() {
-        return this.hostGuid;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/MigrateWithStorageAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/MigrateWithStorageAnswer.java b/api/src/com/cloud/agent/api/MigrateWithStorageAnswer.java
deleted file mode 100644
index 06aff32..0000000
--- a/api/src/com/cloud/agent/api/MigrateWithStorageAnswer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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.agent.api;
-
-import java.util.List;
-import com.cloud.agent.api.to.VolumeTO;
-
-public class MigrateWithStorageAnswer extends Answer {
-
-    List<VolumeTO> volumeTos;
-
-    public MigrateWithStorageAnswer(MigrateWithStorageCommand cmd, Exception ex) {
-        super(cmd, ex);
-        volumeTos = null;
-    }
-
-    public MigrateWithStorageAnswer(MigrateWithStorageCommand cmd, List<VolumeTO> volumeTos) {
-        super(cmd, true, null);
-        this.volumeTos = volumeTos;
-    }
-
-    public List<VolumeTO> getVolumeTos() {
-        return volumeTos;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/MigrateWithStorageCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/MigrateWithStorageCommand.java b/api/src/com/cloud/agent/api/MigrateWithStorageCommand.java
deleted file mode 100644
index 058aa15..0000000
--- a/api/src/com/cloud/agent/api/MigrateWithStorageCommand.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.agent.api;
-
-import java.util.Map;
-import com.cloud.agent.api.to.VirtualMachineTO;
-import com.cloud.agent.api.to.VolumeTO;
-import com.cloud.agent.api.to.StorageFilerTO;
-
-public class MigrateWithStorageCommand extends Command {
-    VirtualMachineTO vm;
-    Map<VolumeTO, StorageFilerTO> volumeToFiler;
-
-    public MigrateWithStorageCommand(VirtualMachineTO vm, Map<VolumeTO, StorageFilerTO> volumeToFiler) {
-        this.vm = vm;
-        this.volumeToFiler = volumeToFiler;
-    }
-
-    public VirtualMachineTO getVirtualMachine() {
-        return vm;
-    }
-
-    public Map<VolumeTO, StorageFilerTO> getVolumeToFiler() {
-        return volumeToFiler;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/MigrateWithStorageCompleteAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/MigrateWithStorageCompleteAnswer.java b/api/src/com/cloud/agent/api/MigrateWithStorageCompleteAnswer.java
deleted file mode 100644
index 920cf48..0000000
--- a/api/src/com/cloud/agent/api/MigrateWithStorageCompleteAnswer.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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.agent.api;
-
-import java.util.List;
-import com.cloud.agent.api.to.VolumeTO;
-
-public class MigrateWithStorageCompleteAnswer extends Answer {
-    List<VolumeTO> volumeTos;
-
-    public MigrateWithStorageCompleteAnswer(MigrateWithStorageCompleteCommand cmd, Exception ex) {
-        super(cmd, ex);
-        volumeTos = null;
-    }
-
-    public MigrateWithStorageCompleteAnswer(MigrateWithStorageCompleteCommand cmd, List<VolumeTO> volumeTos) {
-        super(cmd, true, null);
-        this.volumeTos = volumeTos;
-    }
-
-    public List<VolumeTO> getVolumeTos() {
-        return volumeTos;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/MigrateWithStorageCompleteCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/MigrateWithStorageCompleteCommand.java b/api/src/com/cloud/agent/api/MigrateWithStorageCompleteCommand.java
deleted file mode 100644
index 1303c07..0000000
--- a/api/src/com/cloud/agent/api/MigrateWithStorageCompleteCommand.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.to.VirtualMachineTO;
-
-public class MigrateWithStorageCompleteCommand extends Command {
-    VirtualMachineTO vm;
-
-    public MigrateWithStorageCompleteCommand(VirtualMachineTO vm) {
-        this.vm = vm;
-    }
-
-    public VirtualMachineTO getVirtualMachine() {
-        return vm;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/MigrateWithStorageReceiveAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/MigrateWithStorageReceiveAnswer.java b/api/src/com/cloud/agent/api/MigrateWithStorageReceiveAnswer.java
deleted file mode 100644
index 3bf521c..0000000
--- a/api/src/com/cloud/agent/api/MigrateWithStorageReceiveAnswer.java
+++ /dev/null
@@ -1,55 +0,0 @@
-// 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.agent.api;
-
-import java.util.Map;
-import com.cloud.agent.api.to.VolumeTO;
-import com.cloud.agent.api.to.NicTO;
-
-public class MigrateWithStorageReceiveAnswer extends Answer {
-
-    Map<VolumeTO, Object> volumeToSr;
-    Map<NicTO, Object> nicToNetwork;
-    Map<String, String> token;
-
-    public MigrateWithStorageReceiveAnswer(MigrateWithStorageReceiveCommand cmd, Exception ex) {
-        super(cmd, ex);
-        volumeToSr = null;
-        nicToNetwork = null;
-        token = null;
-    }
-
-    public MigrateWithStorageReceiveAnswer(MigrateWithStorageReceiveCommand cmd, Map<VolumeTO, Object> volumeToSr,
-            Map<NicTO, Object> nicToNetwork, Map<String, String> token) {
-        super(cmd, true, null);
-        this.volumeToSr = volumeToSr;
-        this.nicToNetwork = nicToNetwork;
-        this.token = token;
-    }
-
-    public Map<VolumeTO, Object> getVolumeToSr() {
-        return volumeToSr;
-    }
-
-    public Map<NicTO, Object> getNicToNetwork() {
-        return nicToNetwork;
-    }
-
-    public Map<String, String> getToken() {
-        return token;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/MigrateWithStorageReceiveCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/MigrateWithStorageReceiveCommand.java b/api/src/com/cloud/agent/api/MigrateWithStorageReceiveCommand.java
deleted file mode 100644
index df67405..0000000
--- a/api/src/com/cloud/agent/api/MigrateWithStorageReceiveCommand.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.agent.api;
-
-import java.util.Map;
-import com.cloud.agent.api.to.VirtualMachineTO;
-import com.cloud.agent.api.to.VolumeTO;
-import com.cloud.agent.api.to.StorageFilerTO;
-
-public class MigrateWithStorageReceiveCommand extends Command {
-    VirtualMachineTO vm;
-    Map<VolumeTO, StorageFilerTO> volumeToFiler;
-
-    public MigrateWithStorageReceiveCommand(VirtualMachineTO vm, Map<VolumeTO, StorageFilerTO> volumeToFiler) {
-        this.vm = vm;
-        this.volumeToFiler = volumeToFiler;
-    }
-
-    public VirtualMachineTO getVirtualMachine() {
-        return vm;
-    }
-
-    public Map<VolumeTO, StorageFilerTO> getVolumeToFiler() {
-        return volumeToFiler;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-}


[12/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/dao/ConditionDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/dao/ConditionDao.java b/engine/schema/src/com/cloud/network/as/dao/ConditionDao.java
new file mode 100644
index 0000000..128920d
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/dao/ConditionDao.java
@@ -0,0 +1,28 @@
+// 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.network.as.dao;
+
+import com.cloud.network.as.ConditionVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface ConditionDao extends GenericDao<ConditionVO, Long> {
+
+    ConditionVO findByCounterId(long ctrId);
+
+    int removeByAccountId(long accountId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/dao/ConditionDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/dao/ConditionDaoImpl.java b/engine/schema/src/com/cloud/network/as/dao/ConditionDaoImpl.java
new file mode 100644
index 0000000..8235823
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/dao/ConditionDaoImpl.java
@@ -0,0 +1,56 @@
+//       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.network.as.dao;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.as.ConditionVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value = ConditionDao.class)
+public class ConditionDaoImpl extends GenericDaoBase<ConditionVO, Long> implements ConditionDao {
+    final SearchBuilder<ConditionVO> AllFieldsSearch;
+
+    protected ConditionDaoImpl() {
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ);
+        AllFieldsSearch.and("counterId", AllFieldsSearch.entity().getCounterid(), Op.EQ);
+        AllFieldsSearch.done();
+    }
+
+    @Override
+    public ConditionVO findByCounterId(long ctrId) {
+        SearchCriteria<ConditionVO> sc = AllFieldsSearch.create();
+        sc.setParameters("counterId", ctrId);
+        return findOneBy(sc);
+    }
+
+    public int removeByAccountId(long accountId) {
+        SearchCriteria<ConditionVO> sc = createSearchCriteria();
+
+        sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
+
+        return remove(sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/dao/CounterDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/dao/CounterDao.java b/engine/schema/src/com/cloud/network/as/dao/CounterDao.java
new file mode 100644
index 0000000..47b0d48
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/dao/CounterDao.java
@@ -0,0 +1,29 @@
+// 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.network.as.dao;
+
+import java.util.List;
+
+import com.cloud.network.as.CounterVO;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDao;
+
+public interface CounterDao extends GenericDao<CounterVO, Long> {
+    public List<CounterVO> listCounters(Long id, String name, String source, String keyword, Filter filter);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/dao/CounterDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/dao/CounterDaoImpl.java b/engine/schema/src/com/cloud/network/as/dao/CounterDaoImpl.java
new file mode 100644
index 0000000..0abc3a0
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/dao/CounterDaoImpl.java
@@ -0,0 +1,70 @@
+// 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.network.as.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.as.CounterVO;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value = CounterDao.class)
+public class CounterDaoImpl extends GenericDaoBase<CounterVO, Long> implements CounterDao {
+    final SearchBuilder<CounterVO> AllFieldsSearch;
+
+    protected CounterDaoImpl() {
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ);
+        AllFieldsSearch.and("name", AllFieldsSearch.entity().getName(), Op.LIKE);
+        AllFieldsSearch.and("source", AllFieldsSearch.entity().getSource(), Op.EQ);
+        AllFieldsSearch.done();
+    }
+
+    @Override
+    public List<CounterVO> listCounters(Long id, String name, String source, String keyword, Filter filter) {
+        SearchCriteria<CounterVO> sc = AllFieldsSearch.create();
+
+        if (keyword != null) {
+            SearchCriteria<CounterVO> ssc = createSearchCriteria();
+            ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
+            sc.addAnd("name", SearchCriteria.Op.SC, ssc);
+        }
+
+        if (name != null) {
+            sc.addAnd("name", SearchCriteria.Op.LIKE, "%" + name + "%");
+        }
+
+        if (id != null) {
+            sc.addAnd("id", SearchCriteria.Op.EQ, id);
+        }
+
+        if (source != null) {
+            sc.addAnd("source", SearchCriteria.Op.EQ, source);
+        }
+        return listBy(sc, filter);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapDao.java b/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapDao.java
new file mode 100644
index 0000000..dc1ec89
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapDao.java
@@ -0,0 +1,34 @@
+// 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.network.dao;
+
+import com.cloud.network.dao.AccountGuestVlanMapVO;
+import com.cloud.utils.db.GenericDao;
+
+import java.util.List;
+
+public interface AccountGuestVlanMapDao extends GenericDao<AccountGuestVlanMapVO, Long> {
+
+    public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByAccount(long accountId);
+
+    public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByVlan(long guestVlanId);
+
+    public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByPhysicalNetwork(long physicalNetworkId);
+
+    public int removeByAccountId(long accountId);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapDaoImpl.java b/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapDaoImpl.java
new file mode 100644
index 0000000..e7a7b34
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapDaoImpl.java
@@ -0,0 +1,83 @@
+// 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.network.dao;
+
+import com.cloud.network.dao.AccountGuestVlanMapVO;
+import com.cloud.network.dao.AccountGuestVlanMapDao;
+
+import java.util.List;
+import javax.ejb.Local;
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value={AccountGuestVlanMapDao.class})
+@DB(txn=false)
+public class AccountGuestVlanMapDaoImpl extends GenericDaoBase<AccountGuestVlanMapVO, Long> implements AccountGuestVlanMapDao {
+
+    protected SearchBuilder<AccountGuestVlanMapVO> AccountSearch;
+    protected SearchBuilder<AccountGuestVlanMapVO> GuestVlanSearch;
+    protected SearchBuilder<AccountGuestVlanMapVO> PhysicalNetworkSearch;
+
+    @Override
+    public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByAccount(long accountId) {
+        SearchCriteria<AccountGuestVlanMapVO> sc = AccountSearch.create();
+        sc.setParameters("accountId", accountId);
+        return listIncludingRemovedBy(sc);
+    }
+
+    @Override
+    public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByVlan(long guestVlanId) {
+        SearchCriteria<AccountGuestVlanMapVO> sc = GuestVlanSearch.create();
+        sc.setParameters("guestVlanId", guestVlanId);
+        return listIncludingRemovedBy(sc);
+    }
+
+    @Override
+    public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByPhysicalNetwork(long physicalNetworkId) {
+        SearchCriteria<AccountGuestVlanMapVO> sc = GuestVlanSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        return listIncludingRemovedBy(sc);
+    }
+
+    @Override
+    public int removeByAccountId(long accountId) {
+        SearchCriteria<AccountGuestVlanMapVO> sc = AccountSearch.create();
+        sc.setParameters("accountId", accountId);
+        return expunge(sc);
+    }
+
+    public AccountGuestVlanMapDaoImpl() {
+        super();
+        AccountSearch = createSearchBuilder();
+        AccountSearch.and("accountId", AccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AccountSearch.done();
+
+        GuestVlanSearch = createSearchBuilder();
+        GuestVlanSearch.and("guestVlanId", GuestVlanSearch.entity().getId(), SearchCriteria.Op.EQ);
+        GuestVlanSearch.done();
+
+        PhysicalNetworkSearch = createSearchBuilder();
+        PhysicalNetworkSearch.and("physicalNetworkId", PhysicalNetworkSearch.entity().getId(), SearchCriteria.Op.EQ);
+        PhysicalNetworkSearch.done();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapVO.java b/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapVO.java
new file mode 100644
index 0000000..17c941a
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapVO.java
@@ -0,0 +1,94 @@
+// 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.network.dao;
+
+import com.cloud.network.GuestVlan;
+
+import javax.persistence.*;
+import java.util.UUID;
+
+@Entity
+@Table(name="account_vnet_map")
+public class AccountGuestVlanMapVO implements GuestVlan {
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="account_id")
+    private long accountId;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    @Column(name="vnet_range")
+    private String guestVlanRange;
+
+    @Column(name="physical_network_id")
+    private long physicalNetworkId;
+
+    public AccountGuestVlanMapVO(long accountId,long physicalNetworkId) {
+        this.accountId = accountId;
+        this.physicalNetworkId = physicalNetworkId;
+        this.guestVlanRange = null;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public AccountGuestVlanMapVO() {
+
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public String getGuestVlanRange() {
+        return guestVlanRange;
+    }
+
+
+    public void setGuestVlanRange(String guestVlanRange) {
+        this.guestVlanRange = guestVlanRange;
+    }
+
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    @Override
+    public long getPhysicalNetworkId() {
+        return this.physicalNetworkId;
+    }
+
+    public void setPhysicalNetworkId(long physicalNetworkId) {
+        this.physicalNetworkId = physicalNetworkId;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/ExternalFirewallDeviceDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/ExternalFirewallDeviceDao.java b/engine/schema/src/com/cloud/network/dao/ExternalFirewallDeviceDao.java
new file mode 100644
index 0000000..bb3ebef
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/ExternalFirewallDeviceDao.java
@@ -0,0 +1,58 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.network.dao.ExternalFirewallDeviceVO.FirewallDeviceAllocationState;
+import com.cloud.network.dao.ExternalFirewallDeviceVO.FirewallDeviceState;
+import com.cloud.utils.db.GenericDao;
+
+public interface ExternalFirewallDeviceDao extends GenericDao<ExternalFirewallDeviceVO, Long> {
+
+    /**
+     * list all the firewall devices added in to this physical network?
+     * @param physicalNetworkId physical Network Id
+     * @return list of ExternalFirewallDeviceVO for the devices added in to this physical network.
+     */
+    List<ExternalFirewallDeviceVO> listByPhysicalNetwork(long physicalNetworkId);
+
+    /**
+     * list the firewall devices added in to this physical network of certain provider type?
+     * @param physicalNetworkId physical Network Id
+     * @param provider_name netwrok service provider name
+     */
+    List<ExternalFirewallDeviceVO> listByPhysicalNetworkAndProvider(long physicalNetworkId, String provider_name);
+
+    /**
+     * list the firewall devices added in to this physical network by their allocation state
+     * @param physicalNetworkId physical Network Id
+     * @param provider_name netwrok service provider name
+     * @param allocationState firewall device allocation state
+     * @return list of ExternalFirewallDeviceVO for the devices in the physical network with a device allocation state
+     */
+    List<ExternalFirewallDeviceVO> listByProviderAndDeviceAllocationState(long physicalNetworkId, String provider_name, FirewallDeviceAllocationState allocationState);
+
+    /**
+     * list the load balancer devices added in to this physical network by the device status (enabled/disabled)
+     * @param physicalNetworkId physical Network Id
+     * @param provider_name netwrok service provider name
+     * @param state firewall device status
+     * @return list of ExternalFirewallDeviceVO for the devices in the physical network with a device state
+     */
+    List<ExternalFirewallDeviceVO> listByProviderAndDeviceStaus(long physicalNetworkId, String provider_name, FirewallDeviceState state);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/ExternalFirewallDeviceDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/ExternalFirewallDeviceDaoImpl.java b/engine/schema/src/com/cloud/network/dao/ExternalFirewallDeviceDaoImpl.java
new file mode 100644
index 0000000..01f8861
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/ExternalFirewallDeviceDaoImpl.java
@@ -0,0 +1,96 @@
+// 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.network.dao;
+
+import java.util.List;
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.dao.ExternalFirewallDeviceVO.FirewallDeviceAllocationState;
+import com.cloud.network.dao.ExternalFirewallDeviceVO.FirewallDeviceState;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value=ExternalFirewallDeviceDao.class) @DB(txn=false)
+public class ExternalFirewallDeviceDaoImpl extends GenericDaoBase<ExternalFirewallDeviceVO, Long> implements ExternalFirewallDeviceDao {
+    final SearchBuilder<ExternalFirewallDeviceVO> physicalNetworkServiceProviderSearch;
+    final SearchBuilder<ExternalFirewallDeviceVO> physicalNetworkIdSearch;
+    final SearchBuilder<ExternalFirewallDeviceVO> allocationStateSearch;
+    final SearchBuilder<ExternalFirewallDeviceVO> deviceStatusSearch;
+
+    protected ExternalFirewallDeviceDaoImpl() {
+        physicalNetworkIdSearch = createSearchBuilder();
+        physicalNetworkIdSearch.and("physicalNetworkId", physicalNetworkIdSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        physicalNetworkIdSearch.done();
+
+        physicalNetworkServiceProviderSearch = createSearchBuilder();
+        physicalNetworkServiceProviderSearch.and("physicalNetworkId", physicalNetworkServiceProviderSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        physicalNetworkServiceProviderSearch.and("networkServiceProviderName", physicalNetworkServiceProviderSearch.entity().getProviderName(), Op.EQ);
+        physicalNetworkServiceProviderSearch.done();
+
+        allocationStateSearch = createSearchBuilder();
+        allocationStateSearch.and("physicalNetworkId", allocationStateSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        allocationStateSearch.and("providerName", allocationStateSearch.entity().getProviderName(), Op.EQ);
+        allocationStateSearch.and("allocationState", allocationStateSearch.entity().getAllocationState(), Op.EQ);
+        allocationStateSearch.done();
+
+        deviceStatusSearch = createSearchBuilder();
+        deviceStatusSearch.and("physicalNetworkId", deviceStatusSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        deviceStatusSearch.and("providerName", deviceStatusSearch.entity().getProviderName(), Op.EQ);
+        deviceStatusSearch.and("deviceState", deviceStatusSearch.entity().getDeviceState(), Op.EQ);
+        deviceStatusSearch.done();
+    }
+
+	@Override
+	public List<ExternalFirewallDeviceVO> listByPhysicalNetwork(long physicalNetworkId) {
+        SearchCriteria<ExternalFirewallDeviceVO> sc = physicalNetworkIdSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        return search(sc, null);
+	}
+
+	@Override
+	public List<ExternalFirewallDeviceVO> listByPhysicalNetworkAndProvider(long physicalNetworkId, String providerName) {
+        SearchCriteria<ExternalFirewallDeviceVO> sc = physicalNetworkServiceProviderSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("networkServiceProviderName", providerName);
+        return search(sc, null);
+	}
+
+    @Override
+    public List<ExternalFirewallDeviceVO> listByProviderAndDeviceAllocationState(long physicalNetworkId, String providerName, FirewallDeviceAllocationState allocationState) {
+        SearchCriteria<ExternalFirewallDeviceVO> sc = allocationStateSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("providerName", providerName);
+        sc.setParameters("allocationState", allocationState);
+        return search(sc, null);
+    }
+
+    @Override
+    public List<ExternalFirewallDeviceVO> listByProviderAndDeviceStaus(long physicalNetworkId, String providerName, FirewallDeviceState state) {
+        SearchCriteria<ExternalFirewallDeviceVO> sc = deviceStatusSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("providerName", providerName);
+        sc.setParameters("deviceState", state);
+        return search(sc, null);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/ExternalFirewallDeviceVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/ExternalFirewallDeviceVO.java b/engine/schema/src/com/cloud/network/dao/ExternalFirewallDeviceVO.java
new file mode 100644
index 0000000..31750b4
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/ExternalFirewallDeviceVO.java
@@ -0,0 +1,161 @@
+// 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.network.dao;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ * ExternalFirewallDeviceVO contains information of a external firewall device (Juniper SRX) added into a deployment
+  */
+
+@Entity
+@Table(name="external_firewall_devices")
+public class ExternalFirewallDeviceVO implements InternalIdentity, Identity {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    @Column(name = "host_id")
+    private long hostId;
+
+    @Column(name = "physical_network_id")
+    private long physicalNetworkId;
+
+    @Column(name = "provider_name")
+    private String providerName;
+
+    @Column(name = "device_name")
+    private String deviceName;
+
+    @Column(name="device_state")
+    @Enumerated(value=EnumType.STRING)
+    FirewallDeviceState deviceState;
+
+    @Column(name="is_dedicated")
+    private boolean isDedicatedDevice;
+
+    @Column(name = "capacity")
+    private long capacity;
+
+    @Column(name = "allocation_state")
+    @Enumerated(value=EnumType.STRING)
+    private FirewallDeviceAllocationState allocationState;
+
+    //keeping it enum for future possible states Maintenance, Shutdown
+    public enum FirewallDeviceState {
+        Enabled,
+        Disabled
+    }
+
+    public enum FirewallDeviceAllocationState {
+        Free,
+        Allocated
+    }
+
+    public ExternalFirewallDeviceVO(long hostId, long physicalNetworkId, String provider_name, String device_name, long capacity, boolean dedicated) {
+        this.physicalNetworkId = physicalNetworkId;
+        this.providerName = provider_name;
+        this.deviceName = device_name;
+        this.hostId = hostId;
+        this.deviceState = FirewallDeviceState.Disabled;
+        this.allocationState = FirewallDeviceAllocationState.Free;
+        this.capacity = capacity;
+        this.isDedicatedDevice = dedicated;
+        this.deviceState = FirewallDeviceState.Enabled;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public ExternalFirewallDeviceVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public String getProviderName() {
+        return providerName;
+    }
+
+    public String getDeviceName() {
+        return deviceName;
+    }
+
+    public long getHostId() {
+        return hostId;
+    }
+
+    public long getCapacity() {
+        return capacity;
+    }
+
+    public void setCapacity(long capacity) {
+        this.capacity = capacity;
+    }
+
+    public FirewallDeviceState getDeviceState() {
+        return deviceState;
+    }
+
+    public void setDeviceState(FirewallDeviceState state) {
+        this.deviceState = state;
+    }
+
+    public FirewallDeviceAllocationState getAllocationState() {
+        return allocationState;
+    }
+
+    public void setAllocationState(FirewallDeviceAllocationState allocationState) {
+        this.allocationState = allocationState;
+    }
+
+    public boolean getIsDedicatedDevice() {
+        return isDedicatedDevice;
+    }
+
+    public void setIsDedicatedDevice(boolean isDedicated) {
+        isDedicatedDevice = isDedicated;
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDao.java b/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDao.java
new file mode 100644
index 0000000..b7baa7e
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDao.java
@@ -0,0 +1,74 @@
+// 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.network.dao;
+
+import com.cloud.network.dao.ExternalLoadBalancerDeviceVO.LBDeviceAllocationState;
+import com.cloud.network.dao.ExternalLoadBalancerDeviceVO.LBDeviceState;
+import com.cloud.utils.db.GenericDao;
+
+import java.util.List;
+
+public interface ExternalLoadBalancerDeviceDao extends GenericDao<ExternalLoadBalancerDeviceVO, Long> {
+
+    /**
+     * list all the load balancer devices added in to this physical network?
+     * @param physicalNetworkId physical Network Id
+     * @return list of ExternalLoadBalancerDeviceVO for the devices in the physical network.
+     */
+    List<ExternalLoadBalancerDeviceVO> listByPhysicalNetwork(long physicalNetworkId);
+
+    /**
+     * list the load balancer devices added in to this physical network of certain provider type?
+     * @param physicalNetworkId physical Network Id
+     * @param provider_name netwrok service provider name
+     */
+    List<ExternalLoadBalancerDeviceVO> listByPhysicalNetworkAndProvider(long physicalNetworkId, String provider_name);
+
+    /**
+     * list the load balancer devices added in to this physical network by their allocation state
+     * @param physicalNetworkId physical Network Id
+     * @param provider_name netwrok service provider name
+     * @param allocationState load balancer device allocation state
+     * @return list of ExternalLoadBalancerDeviceVO for the devices in the physical network with a device allocation state
+     */
+    List<ExternalLoadBalancerDeviceVO> listByProviderAndDeviceAllocationState(long physicalNetworkId, String provider_name, LBDeviceAllocationState allocationState);
+
+    /**
+     * list the load balancer devices added in to this physical network by the device status (enabled/disabled)
+     * @param physicalNetworkId physical Network Id
+     * @param provider_name netwrok service provider name
+     * @param state load balancer device status
+     * @return list of ExternalLoadBalancerDeviceVO for the devices in the physical network with a device state
+     */
+    List<ExternalLoadBalancerDeviceVO> listByProviderAndDeviceStaus(long physicalNetworkId, String provider_name, LBDeviceState state);
+
+    /**
+     * list the load balancer devices added in to this physical network by the managed type (external/cloudstack managed)
+     * @param physicalNetworkId physical Network Id
+     * @param provider_name netwrok service provider name
+     * @param managed managed type
+     * @return list of ExternalLoadBalancerDeviceVO for the devices in to this physical network of a managed type
+     */
+    List<ExternalLoadBalancerDeviceVO> listByProviderAndManagedType(long physicalNetworkId, String provider_name, boolean managed);
+
+    /**
+     * Find the external load balancer device that is provisioned as GSLB service provider in the pyshical network
+     * @param physicalNetworkId physical Network Id
+     * @return ExternalLoadBalancerDeviceVO for the device acting as GSLB provider in the physical network
+     */
+    ExternalLoadBalancerDeviceVO findGslbServiceProvider(long physicalNetworkId, String providerName);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java b/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java
new file mode 100644
index 0000000..ea6437d
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java
@@ -0,0 +1,127 @@
+// 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.network.dao;
+
+import com.cloud.network.dao.ExternalLoadBalancerDeviceVO.LBDeviceAllocationState;
+import com.cloud.network.dao.ExternalLoadBalancerDeviceVO.LBDeviceState;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+import org.springframework.stereotype.Component;
+
+import javax.ejb.Local;
+import java.util.List;
+
+@Component
+@Local(value=ExternalLoadBalancerDeviceDao.class) @DB(txn=false)
+public class ExternalLoadBalancerDeviceDaoImpl extends GenericDaoBase<ExternalLoadBalancerDeviceVO, Long> implements ExternalLoadBalancerDeviceDao {
+    final SearchBuilder<ExternalLoadBalancerDeviceVO> physicalNetworkIdSearch;
+    final SearchBuilder<ExternalLoadBalancerDeviceVO> physicalNetworkServiceProviderSearch;
+    final SearchBuilder<ExternalLoadBalancerDeviceVO> allocationStateSearch;
+    final SearchBuilder<ExternalLoadBalancerDeviceVO> deviceStatusSearch;
+    final SearchBuilder<ExternalLoadBalancerDeviceVO> deviceManagedTypeSearch;
+    final SearchBuilder<ExternalLoadBalancerDeviceVO> gslbProviderSearch;
+
+    public ExternalLoadBalancerDeviceDaoImpl() {
+        super();
+
+        physicalNetworkIdSearch = createSearchBuilder();
+        physicalNetworkIdSearch.and("physicalNetworkId", physicalNetworkIdSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        physicalNetworkIdSearch.done();
+
+        physicalNetworkServiceProviderSearch = createSearchBuilder();
+        physicalNetworkServiceProviderSearch.and("physicalNetworkId", physicalNetworkServiceProviderSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        physicalNetworkServiceProviderSearch.and("providerName", physicalNetworkServiceProviderSearch.entity().getProviderName(), Op.EQ);
+        physicalNetworkServiceProviderSearch.done();
+
+        allocationStateSearch = createSearchBuilder();
+        allocationStateSearch.and("physicalNetworkId", allocationStateSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        allocationStateSearch.and("providerName", allocationStateSearch.entity().getProviderName(), Op.EQ);
+        allocationStateSearch.and("allocationState", allocationStateSearch.entity().getAllocationState(), Op.EQ);
+        allocationStateSearch.done();
+
+        deviceStatusSearch = createSearchBuilder();
+        deviceStatusSearch.and("physicalNetworkId", deviceStatusSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        deviceStatusSearch.and("providerName", deviceStatusSearch.entity().getProviderName(), Op.EQ);
+        deviceStatusSearch.and("deviceState", deviceStatusSearch.entity().getState(), Op.EQ);
+        deviceStatusSearch.done();
+
+        deviceManagedTypeSearch = createSearchBuilder();
+        deviceManagedTypeSearch.and("physicalNetworkId", deviceManagedTypeSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        deviceManagedTypeSearch.and("providerName", deviceManagedTypeSearch.entity().getProviderName(), Op.EQ);
+        deviceManagedTypeSearch.and("managedType", deviceManagedTypeSearch.entity().getIsManagedDevice(), Op.EQ);
+        deviceManagedTypeSearch.done();
+
+        gslbProviderSearch = createSearchBuilder();
+        gslbProviderSearch.and("physicalNetworkId", gslbProviderSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        gslbProviderSearch.and("providerName", gslbProviderSearch.entity().getProviderName(), Op.EQ);
+        gslbProviderSearch.and("gslbProvider", gslbProviderSearch.entity().getGslbProvider(), Op.EQ);
+
+    }
+
+    public List<ExternalLoadBalancerDeviceVO> listByPhysicalNetwork(long physicalNetworkId) {
+        SearchCriteria<ExternalLoadBalancerDeviceVO> sc = physicalNetworkIdSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        return search(sc, null);
+    }
+
+    @Override
+    public List<ExternalLoadBalancerDeviceVO> listByPhysicalNetworkAndProvider(long physicalNetworkId, String provider_name) {
+        SearchCriteria<ExternalLoadBalancerDeviceVO> sc = physicalNetworkServiceProviderSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("providerName", provider_name);
+        return search(sc, null);
+    }
+
+    @Override
+    public List<ExternalLoadBalancerDeviceVO> listByProviderAndDeviceAllocationState(long physicalNetworkId, String provider_name, LBDeviceAllocationState state) {
+        SearchCriteria<ExternalLoadBalancerDeviceVO> sc = allocationStateSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("providerName", provider_name);
+        sc.setParameters("allocationState", state);
+        return search(sc, null);
+    }
+
+    @Override
+    public List<ExternalLoadBalancerDeviceVO> listByProviderAndDeviceStaus(long physicalNetworkId, String providerName, LBDeviceState state) {
+        SearchCriteria<ExternalLoadBalancerDeviceVO> sc = deviceStatusSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("providerName", providerName);
+        sc.setParameters("deviceState", state);
+        return search(sc, null);
+    }
+
+    @Override
+    public List<ExternalLoadBalancerDeviceVO> listByProviderAndManagedType(long physicalNetworkId, String providerName, boolean managed) {
+        SearchCriteria<ExternalLoadBalancerDeviceVO> sc = deviceManagedTypeSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("providerName", providerName);
+        sc.setParameters("managedType", managed);
+        return search(sc, null);
+    }
+
+    @Override
+    public ExternalLoadBalancerDeviceVO findGslbServiceProvider(long physicalNetworkId, String providerName) {
+        SearchCriteria<ExternalLoadBalancerDeviceVO> sc = gslbProviderSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("providerName", providerName);
+        sc.setParameters("gslbProvider", true);
+        return findOneBy(sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java b/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java
new file mode 100644
index 0000000..04714a6
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java
@@ -0,0 +1,227 @@
+// 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.network.dao;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+import org.apache.cloudstack.network.ExternalNetworkDeviceManager;
+
+import javax.persistence.*;
+import java.util.UUID;
+
+/**
+ * ExternalLoadBalancerDeviceVO contains information on external load balancer devices (F5/Netscaler VPX,MPX,SDX) added into a deployment
+  */
+
+@Entity
+@Table(name="external_load_balancer_devices")
+public class ExternalLoadBalancerDeviceVO implements InternalIdentity, Identity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    @Column(name = "host_id")
+    private long hostId;
+
+    @Column(name = "physical_network_id")
+    private long physicalNetworkId;
+    
+    @Column(name = "provider_name")
+    private String providerName;
+
+    @Column(name = "device_name")
+    private String deviceName;
+
+    @Column(name="device_state")
+    @Enumerated(value=EnumType.STRING)
+    private LBDeviceState state;
+
+    @Column(name = "allocation_state")
+    @Enumerated(value=EnumType.STRING)
+    private LBDeviceAllocationState allocationState;
+
+    @Column(name="is_managed")
+    private boolean isManagedDevice;
+
+    @Column(name="is_dedicated")
+    private boolean isDedicatedDevice;
+
+    @Column(name="is_gslb_provider")
+    private boolean gslbProvider;
+
+    @Column(name="gslb_site_publicip")
+    private String gslbSitePublicIP;
+
+    @Column(name="gslb_site_privateip")
+    private String gslbSitePrivateIP;
+
+    @Column(name = "parent_host_id")
+    private long parentHostId;
+
+    @Column(name = "capacity")
+    private long capacity;
+
+    //keeping it enum for future possible states Maintenance, Shutdown
+    public enum LBDeviceState {
+        Enabled,
+        Disabled
+    }
+
+    public enum LBDeviceAllocationState {
+        Free,      // In this state no networks are using this device for load balancing
+        Shared,    // In this state one or more networks will be using this device for load balancing
+        Dedicated, // In this state this device is dedicated for a single network
+        Provider   // This state is set only for device that can dynamically provision LB appliances
+    }
+
+    public ExternalLoadBalancerDeviceVO(long hostId, long physicalNetworkId, String provider_name, String device_name,
+            long capacity, boolean dedicated, boolean gslbProvider) {
+        this.physicalNetworkId = physicalNetworkId;
+        this.providerName = provider_name;
+        this.deviceName = device_name;
+        this.hostId = hostId;
+        this.state = LBDeviceState.Disabled;
+        this.allocationState = LBDeviceAllocationState.Free;
+        this.capacity = capacity;
+        this.isDedicatedDevice = dedicated;
+        this.isManagedDevice = false;
+        this.state = LBDeviceState.Enabled;
+        this.uuid = UUID.randomUUID().toString();
+        this.gslbProvider = gslbProvider;
+        this.gslbSitePublicIP = null;
+        this.gslbSitePrivateIP = null;
+        if (device_name.equalsIgnoreCase(ExternalNetworkDeviceManager.NetworkDevice.NetscalerSDXLoadBalancer.getName())) {
+            this.allocationState = LBDeviceAllocationState.Provider;
+        }
+    }
+
+    public ExternalLoadBalancerDeviceVO(long hostId, long physicalNetworkId, String provider_name, String device_name,
+            long capacity, boolean dedicated, boolean managed, long parentHostId) {
+        this(hostId, physicalNetworkId, provider_name, device_name, capacity, dedicated, false);
+        this.isManagedDevice = managed;
+        this.parentHostId = parentHostId;
+    }
+
+    public ExternalLoadBalancerDeviceVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public String getProviderName() {
+        return providerName;
+    }
+
+    public String getDeviceName() {
+        return deviceName;
+    }
+
+    public long getHostId() {
+        return hostId;
+    }
+
+    public long getParentHostId() {
+        return parentHostId;
+    }
+
+    public void setParentHostId(long parentHostId) {
+        this.parentHostId = parentHostId;
+    }
+
+    public long getCapacity() {
+        return capacity;
+    }
+
+    public void setCapacity(long capacity) {
+        this.capacity = capacity;
+    }
+
+    public LBDeviceState getState() {
+        return state;
+    }
+
+    public void setState(LBDeviceState state) {
+        this.state = state;
+    }    
+
+    public LBDeviceAllocationState getAllocationState() {
+        return allocationState;
+    }
+
+    public void setAllocationState(LBDeviceAllocationState allocationState) {
+        this.allocationState = allocationState;
+    }
+    
+    public boolean getIsManagedDevice() {
+        return isManagedDevice;
+    }
+
+    public void setIsManagedDevice(boolean managed) {
+        this.isManagedDevice = managed;
+    }
+
+    public boolean getIsDedicatedDevice() {
+        return isDedicatedDevice;
+    }
+
+    public void setIsDedicatedDevice(boolean isDedicated) {
+        isDedicatedDevice = isDedicated;
+    }
+
+    public boolean getGslbProvider() {
+        return gslbProvider;
+    }
+
+    public void setGslbProvider(boolean gslbProvider) {
+        gslbProvider = gslbProvider;
+    }
+
+    public void setGslbSitePublicIP(String gslbSitePublicIP) {
+        this.gslbSitePublicIP = gslbSitePublicIP;
+    }
+
+    public String getGslbSitePublicIP() {
+        return gslbSitePublicIP;
+    }
+
+    public void setGslbSitePrivateIP(String gslbSitePrivateIP) {
+        this.gslbSitePrivateIP = gslbSitePrivateIP;
+    }
+
+    public String getGslbSitePrivateIP() {
+        return gslbSitePrivateIP;
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/FirewallRulesCidrsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/FirewallRulesCidrsDao.java b/engine/schema/src/com/cloud/network/dao/FirewallRulesCidrsDao.java
new file mode 100644
index 0000000..d020ea7
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/FirewallRulesCidrsDao.java
@@ -0,0 +1,29 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface FirewallRulesCidrsDao extends GenericDao<FirewallRulesCidrsVO, Long> {
+    
+    void persist(long firewallRuleId, List<String> sourceCidrs);
+    
+    List<String> getSourceCidrs(long firewallRuleId);
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/FirewallRulesCidrsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/FirewallRulesCidrsDaoImpl.java b/engine/schema/src/com/cloud/network/dao/FirewallRulesCidrsDaoImpl.java
new file mode 100644
index 0000000..b007e19
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/FirewallRulesCidrsDaoImpl.java
@@ -0,0 +1,70 @@
+// 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.network.dao;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value=FirewallRulesCidrsDao.class)
+public class FirewallRulesCidrsDaoImpl extends GenericDaoBase<FirewallRulesCidrsVO, Long> implements FirewallRulesCidrsDao {
+    private static final Logger s_logger = Logger.getLogger(FirewallRulesCidrsDaoImpl.class);
+    protected final SearchBuilder<FirewallRulesCidrsVO> CidrsSearch;
+    
+    protected FirewallRulesCidrsDaoImpl() {
+        CidrsSearch = createSearchBuilder();
+        CidrsSearch.and("firewallRuleId", CidrsSearch.entity().getFirewallRuleId(), SearchCriteria.Op.EQ);
+        CidrsSearch.done();        
+    }
+
+    @Override @DB
+    public List<String> getSourceCidrs(long firewallRuleId) {
+        SearchCriteria<FirewallRulesCidrsVO> sc = CidrsSearch.create();
+        sc.setParameters("firewallRuleId", firewallRuleId);
+        
+        List<FirewallRulesCidrsVO> results = search(sc, null);
+        List<String> cidrs = new ArrayList<String>(results.size());
+        for (FirewallRulesCidrsVO result : results) {
+            cidrs.add(result.getCidr());
+        }
+
+        return cidrs;
+    }
+    
+    @Override @DB
+    public void persist(long firewallRuleId, List<String> sourceCidrs) {
+        Transaction txn = Transaction.currentTxn();
+
+        txn.start();
+        for (String tag : sourceCidrs) {
+            FirewallRulesCidrsVO vo = new FirewallRulesCidrsVO(firewallRuleId, tag);
+            persist(vo);
+        }
+        txn.commit();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/FirewallRulesCidrsVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/FirewallRulesCidrsVO.java b/engine/schema/src/com/cloud/network/dao/FirewallRulesCidrsVO.java
new file mode 100644
index 0000000..75b8919
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/FirewallRulesCidrsVO.java
@@ -0,0 +1,65 @@
+// 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.network.dao;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name=("firewall_rules_cidrs"))
+public class FirewallRulesCidrsVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private Long id;
+
+    @Column(name="firewall_rule_id")
+    private long firewallRuleId;
+
+    @Column(name="source_cidr")
+    private String sourceCidrList;
+
+    public FirewallRulesCidrsVO() { }
+
+    public FirewallRulesCidrsVO(long firewallRuleId, String sourceCidrList) {
+        this.firewallRuleId = firewallRuleId;
+        this.sourceCidrList = sourceCidrList;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getFirewallRuleId() {
+        return firewallRuleId;
+    }
+
+    public String getCidr() {
+        return sourceCidrList;
+    }
+
+    public String getSourceCidrList() {
+        return sourceCidrList;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/FirewallRulesDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/FirewallRulesDao.java b/engine/schema/src/com/cloud/network/dao/FirewallRulesDao.java
new file mode 100644
index 0000000..6b9b3bb
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/FirewallRulesDao.java
@@ -0,0 +1,64 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.rules.FirewallRuleVO;
+import com.cloud.utils.db.GenericDao;
+
+/*
+ * Data Access Object for user_ip_address and ip_forwarding tables
+ */
+public interface FirewallRulesDao extends GenericDao<FirewallRuleVO, Long> {
+
+    List<FirewallRuleVO> listByIpAndPurposeAndNotRevoked(long ipAddressId, FirewallRule.Purpose purpose);
+
+    List<FirewallRuleVO> listByNetworkAndPurposeAndNotRevoked(long networkId, FirewallRule.Purpose purpose);
+
+    boolean setStateToAdd(FirewallRuleVO rule);
+
+    boolean revoke(FirewallRuleVO rule);
+
+    boolean releasePorts(long ipAddressId, String protocol, FirewallRule.Purpose purpose, int[] ports);
+
+    List<FirewallRuleVO> listByIpAndPurpose(long ipAddressId, FirewallRule.Purpose purpose);
+
+    List<FirewallRuleVO> listByNetworkAndPurpose(long networkId, FirewallRule.Purpose purpose);
+
+    List<FirewallRuleVO> listStaticNatByVmId(long vmId);
+
+    List<FirewallRuleVO> listByIpPurposeAndProtocolAndNotRevoked(long ipAddressId, Integer startPort, Integer endPort, String protocol, FirewallRule.Purpose purpose);
+
+    FirewallRuleVO findByRelatedId(long ruleId);
+
+    List<FirewallRuleVO> listSystemRules();
+
+    List<FirewallRuleVO> listByIp(long ipAddressId);
+
+    List<FirewallRuleVO> listByIpAndNotRevoked(long ipAddressId);
+
+    long countRulesByIpId(long sourceIpId);
+    
+    List<FirewallRuleVO> listByNetworkPurposeTrafficTypeAndNotRevoked(long networkId, FirewallRule.Purpose purpose, FirewallRule.TrafficType trafficType);
+    List<FirewallRuleVO> listByNetworkPurposeTrafficType(long networkId, FirewallRule.Purpose purpose, FirewallRule.TrafficType trafficType);
+    
+    List<FirewallRuleVO> listByIpAndPurposeWithState(Long addressId, FirewallRule.Purpose purpose, FirewallRule.State state);
+        
+    void loadSourceCidrs(FirewallRuleVO rule);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/FirewallRulesDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/FirewallRulesDaoImpl.java b/engine/schema/src/com/cloud/network/dao/FirewallRulesDaoImpl.java
new file mode 100644
index 0000000..45a8068
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/FirewallRulesDaoImpl.java
@@ -0,0 +1,352 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.rules.FirewallRule.FirewallRuleType;
+import com.cloud.network.rules.FirewallRule.Purpose;
+import com.cloud.network.rules.FirewallRule.State;
+import com.cloud.network.rules.FirewallRule.TrafficType;
+import com.cloud.network.rules.FirewallRuleVO;
+import com.cloud.server.ResourceTag.TaggedResourceType;
+import com.cloud.tags.dao.ResourceTagDao;
+import com.cloud.tags.dao.ResourceTagsDaoImpl;
+import com.cloud.utils.db.DB;
+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.SearchCriteria.Op;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value = FirewallRulesDao.class)
+@DB(txn = false)
+public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> implements FirewallRulesDao {
+
+    protected final SearchBuilder<FirewallRuleVO> AllFieldsSearch;
+    protected final SearchBuilder<FirewallRuleVO> NotRevokedSearch;
+    protected final SearchBuilder<FirewallRuleVO> ReleaseSearch;
+    protected SearchBuilder<FirewallRuleVO> VmSearch;
+    protected final SearchBuilder<FirewallRuleVO> SystemRuleSearch;
+    protected final GenericSearchBuilder<FirewallRuleVO, Long> RulesByIpCount;
+
+    @Inject protected FirewallRulesCidrsDao _firewallRulesCidrsDao;
+    @Inject ResourceTagDao _tagsDao;
+    @Inject IPAddressDao _ipDao;
+
+    protected FirewallRulesDaoImpl() {
+        super();
+
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("ipId", AllFieldsSearch.entity().getSourceIpAddressId(), Op.EQ);
+        AllFieldsSearch.and("protocol", AllFieldsSearch.entity().getProtocol(), Op.EQ);
+        AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ);
+        AllFieldsSearch.and("purpose", AllFieldsSearch.entity().getPurpose(), Op.EQ);
+        AllFieldsSearch.and("account", AllFieldsSearch.entity().getAccountId(), Op.EQ);
+        AllFieldsSearch.and("domain", AllFieldsSearch.entity().getDomainId(), Op.EQ);
+        AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ);
+        AllFieldsSearch.and("networkId", AllFieldsSearch.entity().getNetworkId(), Op.EQ);
+        AllFieldsSearch.and("related", AllFieldsSearch.entity().getRelated(), Op.EQ);
+        AllFieldsSearch.and("trafficType", AllFieldsSearch.entity().getTrafficType(), Op.EQ);
+        AllFieldsSearch.done();
+
+        NotRevokedSearch = createSearchBuilder();
+        NotRevokedSearch.and("ipId", NotRevokedSearch.entity().getSourceIpAddressId(), Op.EQ);
+        NotRevokedSearch.and("state", NotRevokedSearch.entity().getState(), Op.NEQ);
+        NotRevokedSearch.and("purpose", NotRevokedSearch.entity().getPurpose(), Op.EQ);
+        NotRevokedSearch.and("protocol", NotRevokedSearch.entity().getProtocol(), Op.EQ);
+        NotRevokedSearch.and("sourcePortStart", NotRevokedSearch.entity().getSourcePortStart(), Op.EQ);
+        NotRevokedSearch.and("sourcePortEnd", NotRevokedSearch.entity().getSourcePortEnd(), Op.EQ);
+        NotRevokedSearch.and("networkId", NotRevokedSearch.entity().getNetworkId(), Op.EQ);
+        NotRevokedSearch.and("trafficType", NotRevokedSearch.entity().getTrafficType(), Op.EQ);
+        NotRevokedSearch.done();
+
+        ReleaseSearch = createSearchBuilder();
+        ReleaseSearch.and("protocol", ReleaseSearch.entity().getProtocol(), Op.EQ);
+        ReleaseSearch.and("ipId", ReleaseSearch.entity().getSourceIpAddressId(), Op.EQ);
+        ReleaseSearch.and("purpose", ReleaseSearch.entity().getPurpose(), Op.EQ);
+        ReleaseSearch.and("ports", ReleaseSearch.entity().getSourcePortStart(), Op.IN);
+        ReleaseSearch.done();
+
+        SystemRuleSearch = createSearchBuilder();
+        SystemRuleSearch.and("type", SystemRuleSearch.entity().getType(), Op.EQ);
+        SystemRuleSearch.and("ipId", SystemRuleSearch.entity().getSourceIpAddressId(), Op.NULL);
+        SystemRuleSearch.done();
+
+        RulesByIpCount = createSearchBuilder(Long.class);
+        RulesByIpCount.select(null, Func.COUNT, RulesByIpCount.entity().getId());
+        RulesByIpCount.and("ipAddressId", RulesByIpCount.entity().getSourceIpAddressId(), Op.EQ);
+        RulesByIpCount.done();
+    }
+
+    @Override
+    public List<FirewallRuleVO> listSystemRules() {
+        SearchCriteria<FirewallRuleVO> sc = SystemRuleSearch.create();
+        sc.setParameters("type", FirewallRuleType.System.toString());
+        return listBy(sc);
+    }
+
+    @Override
+    public boolean releasePorts(long ipId, String protocol, FirewallRule.Purpose purpose, int[] ports) {
+        SearchCriteria<FirewallRuleVO> sc = ReleaseSearch.create();
+        sc.setParameters("protocol", protocol);
+        sc.setParameters("ipId", ipId);
+        sc.setParameters("purpose", purpose);
+        sc.setParameters("ports", ports);
+
+        int results = remove(sc);
+        return results == ports.length;
+    }
+
+    @Override
+    public List<FirewallRuleVO> listByIpAndPurpose(long ipId, FirewallRule.Purpose purpose) {
+        SearchCriteria<FirewallRuleVO> sc = AllFieldsSearch.create();
+        sc.setParameters("ipId", ipId);
+        sc.setParameters("purpose", purpose);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<FirewallRuleVO> listByIpAndPurposeAndNotRevoked(long ipId, FirewallRule.Purpose purpose) {
+        SearchCriteria<FirewallRuleVO> sc = NotRevokedSearch.create();
+        sc.setParameters("ipId", ipId);
+        sc.setParameters("state", State.Revoke);
+
+        if (purpose != null) {
+            sc.setParameters("purpose", purpose);
+        }
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<FirewallRuleVO> listByNetworkAndPurposeAndNotRevoked(long networkId, FirewallRule.Purpose purpose) {
+        SearchCriteria<FirewallRuleVO> sc = NotRevokedSearch.create();
+        sc.setParameters("networkId", networkId);
+        sc.setParameters("state", State.Revoke);
+
+        if (purpose != null) {
+            sc.setParameters("purpose", purpose);
+        }
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<FirewallRuleVO> listByNetworkAndPurpose(long networkId, FirewallRule.Purpose purpose) {
+        SearchCriteria<FirewallRuleVO> sc = AllFieldsSearch.create();
+        sc.setParameters("purpose", purpose);
+        sc.setParameters("networkId", networkId);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<FirewallRuleVO> listByNetworkPurposeTrafficTypeAndNotRevoked(long networkId, FirewallRule.Purpose purpose, TrafficType trafficType) {
+        SearchCriteria<FirewallRuleVO> sc = NotRevokedSearch.create();
+        sc.setParameters("networkId", networkId);
+        sc.setParameters("state", State.Revoke);
+        if (purpose != null) {
+            sc.setParameters("purpose", purpose);
+        }
+        sc.setParameters("trafficType", trafficType);
+
+        return listBy(sc);
+    }
+
+
+    @Override
+    public boolean setStateToAdd(FirewallRuleVO rule) {
+        SearchCriteria<FirewallRuleVO> sc = AllFieldsSearch.create();
+        sc.setParameters("id", rule.getId());
+        sc.setParameters("state", State.Staged);
+
+        rule.setState(State.Add);
+
+        return update(rule, sc) > 0;
+    }
+
+    @Override
+    public boolean revoke(FirewallRuleVO rule) {
+        rule.setState(State.Revoke);
+        return update(rule.getId(), rule);
+    }
+
+    @Override
+    public List<FirewallRuleVO> listStaticNatByVmId(long vmId) {
+        if (VmSearch == null) {
+            SearchBuilder<IPAddressVO> IpSearch = _ipDao.createSearchBuilder();
+            IpSearch.and("associatedWithVmId", IpSearch.entity().getAssociatedWithVmId(), SearchCriteria.Op.EQ);
+            IpSearch.and("oneToOneNat", IpSearch.entity().isOneToOneNat(), SearchCriteria.Op.NNULL);
+
+            VmSearch = createSearchBuilder();
+            VmSearch.and("purpose", VmSearch.entity().getPurpose(), Op.EQ);
+            VmSearch.join("ipSearch", IpSearch, VmSearch.entity().getSourceIpAddressId(), IpSearch.entity().getId(), JoinBuilder.JoinType.INNER);
+            VmSearch.done();
+        }
+
+        SearchCriteria<FirewallRuleVO> sc = VmSearch.create();
+        sc.setParameters("purpose", Purpose.StaticNat);
+        sc.setJoinParameters("ipSearch", "associatedWithVmId", vmId);
+
+        return listBy(sc);
+    }
+
+    @Override
+    @DB
+    public FirewallRuleVO persist(FirewallRuleVO firewallRule) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+
+        FirewallRuleVO dbfirewallRule = super.persist(firewallRule);
+        saveSourceCidrs(firewallRule, firewallRule.getSourceCidrList());
+        loadSourceCidrs(dbfirewallRule);
+
+        txn.commit();
+        return dbfirewallRule;
+    }
+
+    public void saveSourceCidrs(FirewallRuleVO firewallRule, List<String> cidrList) {
+        if (cidrList == null) {
+            return;
+        }
+        _firewallRulesCidrsDao.persist(firewallRule.getId(), cidrList);
+    }
+
+    @Override
+    public List<FirewallRuleVO> listByIpPurposeAndProtocolAndNotRevoked(long ipAddressId, Integer startPort, Integer endPort, String protocol, FirewallRule.Purpose purpose) {
+        SearchCriteria<FirewallRuleVO> sc = NotRevokedSearch.create();
+        sc.setParameters("ipId", ipAddressId);
+        sc.setParameters("state", State.Revoke);
+
+        if (purpose != null) {
+            sc.setParameters("purpose", purpose);
+        }
+
+        if (protocol != null) {
+            sc.setParameters("protocol", protocol);
+        }
+
+        sc.setParameters("sourcePortStart", startPort);
+
+        sc.setParameters("sourcePortEnd", endPort);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public FirewallRuleVO findByRelatedId(long ruleId) {
+        SearchCriteria<FirewallRuleVO> sc = AllFieldsSearch.create();
+        sc.setParameters("related", ruleId);
+        sc.setParameters("purpose", Purpose.Firewall);
+
+        return findOneBy(sc);
+    }
+
+    @Override
+    public List<FirewallRuleVO> listByIp(long ipId) {
+        SearchCriteria<FirewallRuleVO> sc = AllFieldsSearch.create();
+        sc.setParameters("ipId", ipId);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<FirewallRuleVO> listByIpAndNotRevoked(long ipId) {
+        SearchCriteria<FirewallRuleVO> sc = NotRevokedSearch.create();
+        sc.setParameters("ipId", ipId);
+        sc.setParameters("state", State.Revoke);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public long countRulesByIpId(long sourceIpId) {
+        SearchCriteria<Long> sc = RulesByIpCount.create();
+        sc.setParameters("ipAddressId", sourceIpId);
+        return customSearch(sc, null).get(0);
+    }
+
+    @Override
+    public List<FirewallRuleVO> listByNetworkPurposeTrafficType(long networkId, Purpose purpose, TrafficType trafficType) {
+        SearchCriteria<FirewallRuleVO> sc = AllFieldsSearch.create();
+        sc.setParameters("networkId", networkId);
+
+        if (purpose != null) {
+            sc.setParameters("purpose", purpose);
+        }
+
+        sc.setParameters("trafficType", trafficType);
+
+        return listBy(sc);
+    }
+
+    @Override
+    @DB
+    public boolean remove(Long id) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        FirewallRuleVO entry = findById(id);
+        if (entry != null) {
+            if (entry.getPurpose() == Purpose.LoadBalancing) {
+                _tagsDao.removeByIdAndType(id, TaggedResourceType.LoadBalancer);
+            } else if (entry.getPurpose() == Purpose.PortForwarding) {
+                _tagsDao.removeByIdAndType(id, TaggedResourceType.PortForwardingRule);
+            } else if (entry.getPurpose() == Purpose.Firewall) {
+                _tagsDao.removeByIdAndType(id, TaggedResourceType.FirewallRule);
+            } else if (entry.getPurpose() == Purpose.NetworkACL) {
+                _tagsDao.removeByIdAndType(id, TaggedResourceType.NetworkACL);
+            }
+        }
+        boolean result = super.remove(id);
+        txn.commit();
+        return result;
+    }
+
+    @Override
+    public List<FirewallRuleVO> listByIpAndPurposeWithState(Long ipId, Purpose purpose, State state) {
+        SearchCriteria<FirewallRuleVO> sc = AllFieldsSearch.create();
+        sc.setParameters("ipId", ipId);
+
+        if (state != null) {
+            sc.setParameters("state", state);
+        }
+
+        if (purpose != null) {
+            sc.setParameters("purpose", purpose);
+        }
+
+        return listBy(sc);
+    }
+
+    @Override
+    public void loadSourceCidrs(FirewallRuleVO rule) {
+        List<String> sourceCidrs = _firewallRulesCidrsDao.getSourceCidrs(rule.getId());
+        rule.setSourceCidrList(sourceCidrs);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/IPAddressDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/IPAddressDao.java b/engine/schema/src/com/cloud/network/dao/IPAddressDao.java
new file mode 100755
index 0000000..3d588fa
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/IPAddressDao.java
@@ -0,0 +1,71 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.dc.Vlan.VlanType;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.net.Ip;
+
+public interface IPAddressDao extends GenericDao<IPAddressVO, Long> {
+	
+    IPAddressVO markAsUnavailable(long ipAddressId);
+    
+	void unassignIpAddress(long ipAddressId);	
+
+	List<IPAddressVO> listByAccount(long accountId);
+	
+	List<IPAddressVO> listByVlanId(long vlanId);
+	
+	List<IPAddressVO> listByDcIdIpAddress(long dcId, String ipAddress);
+	
+	List<IPAddressVO> listByDcId(long dcId); 
+	
+	List<IPAddressVO> listByAssociatedNetwork(long networkId, Boolean isSourceNat);
+	
+	List<IPAddressVO> listStaticNatPublicIps(long networkId);
+	
+	int countIPs(long dcId, long vlanDbId, boolean onlyCountAllocated);
+	
+	int countIPs(long dcId, Long accountId, String vlanId, String vlanGateway, String vlanNetmask);
+	
+    long countAllocatedIPsForAccount(long accountId);
+	
+	boolean mark(long dcId, Ip ip);
+
+	int countIPsForNetwork(long dcId, boolean onlyCountAllocated, VlanType vlanType);
+	
+	IPAddressVO findByAssociatedVmId(long vmId);
+	
+	IPAddressVO findByIpAndSourceNetworkId(long networkId, String ipAddress);
+
+	public IPAddressVO findByIpAndDcId(long dcId, String ipAddress);
+
+	List<IPAddressVO> listByPhysicalNetworkId(long physicalNetworkId);
+	
+	List<IPAddressVO> listByAssociatedVpc(long vpcId, Boolean isSourceNat);
+
+	long countFreePublicIPs();
+	
+    long countFreeIPsInNetwork(long networkId);
+    IPAddressVO findByVmIp(String vmIp);
+
+    IPAddressVO findByAssociatedVmIdAndVmIp(long vmId, String vmIp);
+
+    IPAddressVO findByIpAndNetworkId(long networkId, String ipAddress);
+}


[44/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/PrepareOVAPackingAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/PrepareOVAPackingAnswer.java b/api/src/com/cloud/agent/api/storage/PrepareOVAPackingAnswer.java
new file mode 100755
index 0000000..923d952
--- /dev/null
+++ b/api/src/com/cloud/agent/api/storage/PrepareOVAPackingAnswer.java
@@ -0,0 +1,26 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Answer;
+
+public class PrepareOVAPackingAnswer extends Answer {
+    public PrepareOVAPackingAnswer(PrepareOVAPackingCommand cmd, boolean result, String details) {
+        super(cmd, result, details);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/PrepareOVAPackingCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/PrepareOVAPackingCommand.java b/api/src/com/cloud/agent/api/storage/PrepareOVAPackingCommand.java
new file mode 100755
index 0000000..29fa26d
--- /dev/null
+++ b/api/src/com/cloud/agent/api/storage/PrepareOVAPackingCommand.java
@@ -0,0 +1,48 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Command;
+
+public class PrepareOVAPackingCommand extends Command {
+        private String templatePath;
+        private String secUrl;
+
+        public PrepareOVAPackingCommand() {
+        }
+
+        public PrepareOVAPackingCommand(String secUrl, String templatePath) {
+            this.secUrl = secUrl;
+            this.templatePath = templatePath;
+        }
+
+        @Override
+        public boolean executeInSequence() {
+                return true;
+        }
+
+        public String getTemplatePath() {
+                return this.templatePath;
+        }
+
+        public String getSecondaryStorageUrl() {
+                return this.secUrl;
+        }
+
+}
+
+ 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.java b/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.java
deleted file mode 100644
index a5a6c49..0000000
--- a/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Answer;
-
-public class PrimaryStorageDownloadAnswer extends Answer  {
-	private String installPath;
-    private long templateSize = 0L;
-
-	protected PrimaryStorageDownloadAnswer() {
-	}
-
-    public PrimaryStorageDownloadAnswer(String detail) {
-        super(null, false, detail);
-    }
-
-	public PrimaryStorageDownloadAnswer(String installPath, long templateSize ) {
-        super(null);
-		this.installPath = installPath;
-		this.templateSize = templateSize;
-	}
-
-	public String getInstallPath() {
-		return installPath;
-	}
-
-	public void setInstallPath(String installPath) {
-		this.installPath = installPath;
-    }
-
-    public void setTemplateSize(long templateSize) {
-        this.templateSize = templateSize;
-    }
-
-    public Long getTemplateSize() {
-        return templateSize;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java b/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java
deleted file mode 100644
index 8d955bb..0000000
--- a/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java
+++ /dev/null
@@ -1,87 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.storage.Storage.ImageFormat;
-import com.cloud.storage.StoragePool;
-
-/**
- *
- */
-public class PrimaryStorageDownloadCommand extends AbstractDownloadCommand {
-	String localPath;
-	String poolUuid;
-	long poolId;
-
-    StorageFilerTO primaryPool;
-
-	String secondaryStorageUrl;
-	String primaryStorageUrl;
-
-    protected PrimaryStorageDownloadCommand() {
-	}
-
-    public PrimaryStorageDownloadCommand(String name, String url, ImageFormat format, long accountId, StoragePool pool, int wait) {
-        super(name, url, format, accountId);
-        this.poolId = pool.getId();
-        this.poolUuid = pool.getUuid();
-        this.primaryPool = new StorageFilerTO(pool);
-        setWait(wait);
-    }
-
-    public String getPoolUuid() {
-        return poolUuid;
-    }
-
-    public long getPoolId() {
-        return poolId;
-    }
-
-    public StorageFilerTO getPool() {
-        return primaryPool;
-    }
-    
-    public void setLocalPath(String path) {
-    	this.localPath = path;
-    }
-
-    public String getLocalPath() {
-    	return localPath;
-    }
-
-    public void setSecondaryStorageUrl(String url) {
-    	secondaryStorageUrl = url;
-    }
-
-    public String getSecondaryStorageUrl() {
-    	return secondaryStorageUrl;
-    }
-
-    public void setPrimaryStorageUrl(String url) {
-    	primaryStorageUrl = url;
-    }
-
-    public String getPrimaryStorageUrl() {
-    	return primaryStorageUrl;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java b/api/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java
deleted file mode 100644
index 3434b98..0000000
--- a/api/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Answer;
-
-public class ResizeVolumeAnswer extends Answer {
-    private long newSize;
-
-    protected ResizeVolumeAnswer() {
-
-    }
-
-    public ResizeVolumeAnswer(ResizeVolumeCommand cmd, boolean result, String details, long newSize) {
-        super(cmd, result, details);
-        this.newSize = newSize;
-    }
-
-    public ResizeVolumeAnswer(ResizeVolumeCommand cmd, boolean result, String details) {
-        super(cmd, result, details);
-    }
-
-    public long getNewSize() {
-        return newSize;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java b/api/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
deleted file mode 100644
index 82d3ae7..0000000
--- a/api/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Command;
-import com.cloud.agent.api.to.StorageFilerTO;
-
-public class ResizeVolumeCommand extends Command {
-    private String path;
-    private StorageFilerTO pool;
-    private String vmInstance;
-    private Long newSize;
-    private Long currentSize;
-    private boolean shrinkOk;
-    
-    protected ResizeVolumeCommand() {
-        
-    }
-    
-    public ResizeVolumeCommand(String path,
-                           StorageFilerTO pool,
-                           Long currentSize,
-                           Long newSize,
-                           boolean shrinkOk,
-                           String vmInstance) 
-    {
-        this.path = path;
-        this.pool = pool;
-        this.vmInstance = vmInstance;
-        this.currentSize = currentSize;
-        this.newSize = newSize;
-        this.shrinkOk = shrinkOk;
-    }
-
-    public String getPath() {
-    	return path;
-    }
-
-    public String getPoolUuid() {
-        return pool.getUuid();
-    }
-
-    public StorageFilerTO getPool() {
-        return pool;
-    }
-    
-    public long getNewSize() {
-        return newSize;
-    }
-
-    public long getCurrentSize() {
-        return currentSize;
-    }
-
-    public boolean getShrinkOk() {
-        return shrinkOk;
-    }
-
-    public String getInstanceName() {
-        return vmInstance;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/StorageCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/StorageCommand.java b/api/src/com/cloud/agent/api/storage/StorageCommand.java
deleted file mode 100644
index 270143b..0000000
--- a/api/src/com/cloud/agent/api/storage/StorageCommand.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Command;
-
-public abstract class StorageCommand extends Command {
-    protected StorageCommand() {
-        super();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java b/api/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java
deleted file mode 100644
index 9660136..0000000
--- a/api/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-
-public class UpgradeDiskAnswer extends Answer {
-
-    public UpgradeDiskAnswer() {}
-
-    public UpgradeDiskAnswer(Command cmd, boolean success, String details) {
-        super(cmd, success, details);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/UpgradeDiskCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/UpgradeDiskCommand.java b/api/src/com/cloud/agent/api/storage/UpgradeDiskCommand.java
deleted file mode 100644
index f8363e1..0000000
--- a/api/src/com/cloud/agent/api/storage/UpgradeDiskCommand.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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.agent.api.storage;
-
-
-public class UpgradeDiskCommand extends StorageCommand {
-
-    private String _imagePath;
-    private String _newSize;
-
-    public UpgradeDiskCommand() {}
-
-    public UpgradeDiskCommand(String imagePath, String newSize) {
-        _imagePath = imagePath;
-        _newSize = newSize;
-    }
-
-    public String getImagePath() {
-        return _imagePath;
-    }
-    public void setImagePath(String imagePath) {
-        _imagePath = imagePath;
-    }
-
-    public String getNewSize() {
-        return _newSize;
-    }
-    public void setNewSize(String newSize) {
-        _newSize = newSize;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/UploadAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/UploadAnswer.java b/api/src/com/cloud/agent/api/storage/UploadAnswer.java
deleted file mode 100755
index f2d9788..0000000
--- a/api/src/com/cloud/agent/api/storage/UploadAnswer.java
+++ /dev/null
@@ -1,123 +0,0 @@
-// 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.agent.api.storage;
-
-import java.io.File;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.storage.Upload;
-
-public class UploadAnswer extends Answer {
-
-
-	private String jobId;
-	private int uploadPct;
-	private String errorString;
-	private Upload.Status uploadStatus;
-	private String uploadPath;
-	private String installPath;
-	public Long templateSize = 0L;
-
-	public int getUploadPct() {
-		return uploadPct;
-	}
-	public String getErrorString() {
-		return errorString;
-	}
-
-	public String getUploadStatusString() {
-		return uploadStatus.toString();
-	}
-
-	public Upload.Status getUploadStatus() {
-		return uploadStatus;
-	}
-
-	public String getUploadPath() {
-		return uploadPath;
-	}
-	protected UploadAnswer() {
-
-	}
-
-	public void setErrorString(String errorString) {
-        this.errorString = errorString;
-    }
-    public String getJobId() {
-		return jobId;
-	}
-	public void setJobId(String jobId) {
-		this.jobId = jobId;
-	}
-
-	public UploadAnswer(String jobId, int uploadPct, String errorString,
-			Upload.Status uploadStatus, String fileSystemPath, String installPath, long templateSize) {
-		super();
-		this.jobId = jobId;
-		this.uploadPct = uploadPct;
-		this.errorString = errorString;
-		this.details = errorString;
-		this.uploadStatus = uploadStatus;
-		this.uploadPath = fileSystemPath;
-		this.installPath = fixPath(installPath);
-		this.templateSize = templateSize;
-	}
-
-   public UploadAnswer(String jobId, int uploadPct, Command command,
-		   Upload.Status uploadStatus, String fileSystemPath, String installPath) {
-	    super(command);
-        this.jobId = jobId;
-        this.uploadPct = uploadPct;
-        this.uploadStatus = uploadStatus;
-        this.uploadPath = fileSystemPath;
-        this.installPath = installPath;
-    }
-
-	private static String fixPath(String path){
-		if (path == null) {
-            return path;
-        }
-		if (path.startsWith(File.separator)) {
-			path=path.substring(File.separator.length());
-		}
-		if (path.endsWith(File.separator)) {
-			path=path.substring(0, path.length()-File.separator.length());
-		}
-		return path;
-	}
-
-	public void setUploadStatus(Upload.Status uploadStatus) {
-		this.uploadStatus = uploadStatus;
-	}
-
-	public String getInstallPath() {
-		return installPath;
-	}
-	public void setInstallPath(String installPath) {
-		this.installPath = fixPath(installPath);
-	}
-
-	public void setTemplateSize(long templateSize) {
-		this.templateSize = templateSize;
-	}
-
-	public Long getTemplateSize() {
-		return templateSize;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/UploadCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/UploadCommand.java b/api/src/com/cloud/agent/api/storage/UploadCommand.java
deleted file mode 100644
index 473bd5b..0000000
--- a/api/src/com/cloud/agent/api/storage/UploadCommand.java
+++ /dev/null
@@ -1,145 +0,0 @@
-// 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.agent.api.storage;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import com.cloud.agent.api.storage.DownloadCommand.PasswordAuth;
-import com.cloud.agent.api.to.TemplateTO;
-import com.cloud.storage.Upload.Type;
-import com.cloud.template.VirtualMachineTemplate;
-
-
-public class UploadCommand extends AbstractUploadCommand implements InternalIdentity {
-
-	private TemplateTO template;
-	private String url;
-	private String installPath;
-	private boolean hvm;
-	private String description;
-	private String checksum;
-	private PasswordAuth auth;
-	private long templateSizeInBytes;
-	private long id;
-	private Type type;
-
-	public UploadCommand(VirtualMachineTemplate template, String url, String installPath, long sizeInBytes) {
-
-		this.template = new TemplateTO(template);
-		this.url = url;
-		this.installPath = installPath;
-		this.checksum = template.getChecksum();
-		this.id = template.getId();
-		this.templateSizeInBytes = sizeInBytes;
-
-	}
-
-	public UploadCommand(String url, long id, long sizeInBytes, String installPath, Type type){
-		this.template = null;
-		this.url = url;
-		this.installPath = installPath;
-		this.id = id;
-		this.type = type;
-		this.templateSizeInBytes = sizeInBytes;
-	}
-
-	protected UploadCommand() {
-	}
-
-	public UploadCommand(UploadCommand that) {
-		this.template = that.template;
-		this.url = that.url;
-		this.installPath = that.installPath;
-		this.checksum = that.getChecksum();
-		this.id = that.id;
-	}
-
-	public String getDescription() {
-		return description;
-	}
-
-
-	public TemplateTO getTemplate() {
-		return template;
-	}
-
-	public void setTemplate(TemplateTO template) {
-		this.template = template;
-	}
-
-	@Override
-    public String getUrl() {
-		return url;
-	}
-
-	@Override
-    public void setUrl(String url) {
-		this.url = url;
-	}
-
-	public boolean isHvm() {
-		return hvm;
-	}
-
-	public void setHvm(boolean hvm) {
-		this.hvm = hvm;
-	}
-
-	public PasswordAuth getAuth() {
-		return auth;
-	}
-
-	public void setAuth(PasswordAuth auth) {
-		this.auth = auth;
-	}
-
-	public Long getTemplateSizeInBytes() {
-		return templateSizeInBytes;
-	}
-
-	public void setTemplateSizeInBytes(Long templateSizeInBytes) {
-		this.templateSizeInBytes = templateSizeInBytes;
-	}
-
-	public long getId() {
-		return id;
-	}
-
-	public void setId(long id) {
-		this.id = id;
-	}
-
-	public void setInstallPath(String installPath) {
-		this.installPath = installPath;
-	}
-
-	public void setDescription(String description) {
-		this.description = description;
-	}
-
-	public void setChecksum(String checksum) {
-		this.checksum = checksum;
-	}
-
-	public String getInstallPath() {
-		return installPath;
-	}
-
-	public String getChecksum() {
-		return checksum;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/UploadProgressCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/UploadProgressCommand.java b/api/src/com/cloud/agent/api/storage/UploadProgressCommand.java
deleted file mode 100644
index 7f6d584..0000000
--- a/api/src/com/cloud/agent/api/storage/UploadProgressCommand.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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.agent.api.storage;
-
-public class UploadProgressCommand extends UploadCommand {
-
-	public static enum RequestType {GET_STATUS, ABORT, RESTART, PURGE, GET_OR_RESTART}
-	private String jobId;
-	private RequestType request;
-
-	protected UploadProgressCommand() {
-		super();
-	}
-
-	public UploadProgressCommand(UploadCommand cmd, String jobId, RequestType req) {
-	    super(cmd);
-
-		this.jobId = jobId;
-		this.setRequest(req);
-	}
-
-	public String getJobId() {
-		return jobId;
-	}
-
-	public void setRequest(RequestType request) {
-		this.request = request;
-	}
-
-	public RequestType getRequest() {
-		return request;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/ssCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/ssCommand.java b/api/src/com/cloud/agent/api/storage/ssCommand.java
deleted file mode 100644
index c218a8d..0000000
--- a/api/src/com/cloud/agent/api/storage/ssCommand.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Command;
-
-public abstract class ssCommand extends Command {
-    private String secUrl;
-
-
-	public ssCommand() {
-	}
-
-    protected ssCommand(ssCommand that) {
-        this.secUrl = that.secUrl;
-    }
-	public ssCommand(String secUrl) {
-	    this.secUrl = secUrl;
-    }
-
-	@Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public String getSecUrl() {
-        return secUrl;
-    }
-
-    public void setSecUrl(String secUrl) {
-        this.secUrl = secUrl;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/uploadTemplateToSwiftFromSecondaryStorageCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/uploadTemplateToSwiftFromSecondaryStorageCommand.java b/api/src/com/cloud/agent/api/uploadTemplateToSwiftFromSecondaryStorageCommand.java
deleted file mode 100644
index 10001b1..0000000
--- a/api/src/com/cloud/agent/api/uploadTemplateToSwiftFromSecondaryStorageCommand.java
+++ /dev/null
@@ -1,80 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-import com.cloud.agent.api.to.SwiftTO;
-
-/**
- *
- *
- */
-
-public class uploadTemplateToSwiftFromSecondaryStorageCommand extends Command {
-    @LogLevel(Log4jLevel.Off)
-    private SwiftTO swift;
-    private String secondaryStorageUrl;
-
-    private Long dcId;
-    private Long accountId;
-    private Long templateId;
-
-    protected uploadTemplateToSwiftFromSecondaryStorageCommand() {
-
-    }
-
-    public uploadTemplateToSwiftFromSecondaryStorageCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long templateId, int wait) {
-
-        this.swift = swift;
-        this.secondaryStorageUrl = secondaryStorageUrl;
-        this.dcId = dcId;
-        this.accountId = accountId;
-        this.templateId = templateId;
-        setWait(wait);
-    }
-
-    public SwiftTO getSwift() {
-        return this.swift;
-    }
-
-    public void setSwift(SwiftTO swift) {
-        this.swift = swift;
-    }
-
-    public String getSecondaryStorageUrl() {
-        return secondaryStorageUrl;
-    }
-
-    public Long getDcId() {
-        return dcId;
-    }
-
-    public Long getAccountId() {
-        return accountId;
-    }
-
-    public Long getTemplateId() {
-        return templateId;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        // TODO Auto-generated method stub
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/alert/AlertAdapter.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/alert/AlertAdapter.java b/api/src/com/cloud/alert/AlertAdapter.java
new file mode 100644
index 0000000..c04776a
--- /dev/null
+++ b/api/src/com/cloud/alert/AlertAdapter.java
@@ -0,0 +1,22 @@
+// 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.alert;
+
+import com.cloud.utils.component.Adapter;
+
+public interface AlertAdapter extends Adapter {
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/async/AsyncJob.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/async/AsyncJob.java b/api/src/com/cloud/async/AsyncJob.java
index 866429b..ccdc406 100644
--- a/api/src/com/cloud/async/AsyncJob.java
+++ b/api/src/com/cloud/async/AsyncJob.java
@@ -50,7 +50,10 @@ public interface AsyncJob extends Identity, InternalIdentity {
         AutoScaleVmProfile,
         AutoScaleVmGroup,
         GlobalLoadBalancerRule,
-        AffinityGroup
+        LoadBalancerRule,
+        AffinityGroup,
+        InternalLbVm,
+        DedicatedGuestVlanRange
     }
 
     long getUserId();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/configuration/ConfigurationService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/configuration/ConfigurationService.java b/api/src/com/cloud/configuration/ConfigurationService.java
index 6937d0b..fdbd9d6 100644
--- a/api/src/com/cloud/configuration/ConfigurationService.java
+++ b/api/src/com/cloud/configuration/ConfigurationService.java
@@ -20,6 +20,11 @@ import java.util.List;
 
 import javax.naming.NamingException;
 
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.ResourceAllocationException;
 import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
 import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
 import org.apache.cloudstack.api.command.admin.ldap.LDAPRemoveCmd;
@@ -46,10 +51,6 @@ import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.Pod;
 import com.cloud.dc.Vlan;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.network.Networks.TrafficType;
 import com.cloud.offering.DiskOffering;
 import com.cloud.offering.NetworkOffering;
@@ -65,7 +66,7 @@ public interface ConfigurationService {
      *            - the command wrapping name and value parameters
      * @return updated configuration object if successful
      */
-    Configuration updateConfiguration(UpdateCfgCmd cmd);
+    Configuration updateConfiguration(UpdateCfgCmd cmd) throws InvalidParameterValueException;
 
     /**
      * Create a service offering through the API
@@ -250,7 +251,7 @@ public interface ConfigurationService {
 
     NetworkOffering getNetworkOffering(long id);
 
-    Integer getNetworkOfferingNetworkRate(long networkOfferingId);
+    Integer getNetworkOfferingNetworkRate(long networkOfferingId, Long dataCenterId);
 
     Account getVlanAccount(long vlanId);
 
@@ -262,7 +263,7 @@ public interface ConfigurationService {
 
     Long getDefaultPageSize();
 
-    Integer getServiceOfferingNetworkRate(long serviceOfferingId);
+    Integer getServiceOfferingNetworkRate(long serviceOfferingId, Long dataCenterId);
 
     DiskOffering getDiskOffering(long diskOfferingId);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/event/EventTypes.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java
index e7781fa..17a7f62 100755
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -16,6 +16,9 @@
 // under the License.
 package com.cloud.event;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import com.cloud.configuration.Configuration;
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.Pod;
@@ -23,8 +26,18 @@ import com.cloud.dc.StorageNetworkIpRange;
 import com.cloud.dc.Vlan;
 import com.cloud.domain.Domain;
 import com.cloud.host.Host;
-import com.cloud.network.*;
-import com.cloud.network.as.*;
+import com.cloud.network.GuestVlan;
+import com.cloud.network.Network;
+import com.cloud.network.PhysicalNetwork;
+import com.cloud.network.PhysicalNetworkServiceProvider;
+import com.cloud.network.PhysicalNetworkTrafficType;
+import com.cloud.network.PublicIpAddress;
+import com.cloud.network.RemoteAccessVpn;
+import com.cloud.network.as.AutoScaleCounter;
+import com.cloud.network.as.AutoScalePolicy;
+import com.cloud.network.as.AutoScaleVmGroup;
+import com.cloud.network.as.AutoScaleVmProfile;
+import com.cloud.network.as.Condition;
 import com.cloud.network.router.VirtualRouter;
 import com.cloud.network.rules.LoadBalancer;
 import com.cloud.network.rules.StaticNat;
@@ -43,9 +56,6 @@ import com.cloud.user.Account;
 import com.cloud.user.User;
 import com.cloud.vm.VirtualMachine;
 
-import java.util.HashMap;
-import java.util.Map;
-
 public class EventTypes {
 
     //map of Event and corresponding entity for which Event is applicable
@@ -400,6 +410,14 @@ public class EventTypes {
     public static final String EVENT_AFFINITY_GROUP_ASSIGN = "AG.ASSIGN";
     public static final String EVENT_AFFINITY_GROUP_REMOVE = "AG.REMOVE";
     public static final String EVENT_VM_AFFINITY_GROUP_UPDATE = "VM.AG.UPDATE";
+    
+    public static final String EVENT_INTERNAL_LB_VM_START = "INTERNALLBVM.START";
+    public static final String EVENT_INTERNAL_LB_VM_STOP = "INTERNALLBVM.STOP";
+
+    // Dedicated guest vlan range
+    public static final String EVENT_GUEST_VLAN_RANGE_DEDICATE  = "GUESTVLANRANGE.DEDICATE";
+    public static final String EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE  = "GUESTVLANRANGE.RELEASE";
+
 
     static {
 
@@ -701,6 +719,9 @@ public class EventTypes {
         entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_UPDATE, AutoScaleVmGroup.class.getName());
         entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_ENABLE, AutoScaleVmGroup.class.getName());
         entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DISABLE, AutoScaleVmGroup.class.getName());
+
+        entityEventDetails.put(EVENT_GUEST_VLAN_RANGE_DEDICATE, GuestVlan.class.getName());
+        entityEventDetails.put(EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE, GuestVlan.class.getName());
     }
 
     public static String getEntityForEvent (String eventName) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/event/UsageEvent.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/event/UsageEvent.java b/api/src/com/cloud/event/UsageEvent.java
new file mode 100644
index 0000000..0d4ef17
--- /dev/null
+++ b/api/src/com/cloud/event/UsageEvent.java
@@ -0,0 +1,33 @@
+// 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.event;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import java.util.Date;
+
+public interface UsageEvent extends InternalIdentity {
+    String getType();
+
+    Date getCreateDate();
+    long getAccountId();
+    Long getSize();
+    Long getTemplateId();
+    Long getOfferingId();
+    long getResourceId();
+    long getZoneId();
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/exception/AgentControlChannelException.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/exception/AgentControlChannelException.java b/api/src/com/cloud/exception/AgentControlChannelException.java
new file mode 100644
index 0000000..50b84d4
--- /dev/null
+++ b/api/src/com/cloud/exception/AgentControlChannelException.java
@@ -0,0 +1,27 @@
+// 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.exception;
+
+import com.cloud.exception.CloudException;
+
+public class AgentControlChannelException extends CloudException {
+	private static final long serialVersionUID = -310647782960500466L;
+	
+	public AgentControlChannelException(String msg) {
+		super(msg);
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/info/ConsoleProxyLoadInfo.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/info/ConsoleProxyLoadInfo.java b/api/src/com/cloud/info/ConsoleProxyLoadInfo.java
new file mode 100644
index 0000000..a3ec3e3
--- /dev/null
+++ b/api/src/com/cloud/info/ConsoleProxyLoadInfo.java
@@ -0,0 +1,48 @@
+// 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.info;
+
+public class ConsoleProxyLoadInfo {
+	
+	private long id;
+	private String name;
+	private int count;
+	
+	public long getId() {
+		return id;
+	}
+	
+	public void setId(long id) {
+		this.id = id;
+	}
+	
+	public String getName() {
+		return name;
+	}
+	
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	public int getCount() {
+		return count;
+	}
+	
+	public void setCount(int count) {
+		this.count = count;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/info/RunningHostCountInfo.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/info/RunningHostCountInfo.java b/api/src/com/cloud/info/RunningHostCountInfo.java
new file mode 100644
index 0000000..f77a4dc
--- /dev/null
+++ b/api/src/com/cloud/info/RunningHostCountInfo.java
@@ -0,0 +1,48 @@
+// 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.info;
+
+public class RunningHostCountInfo {
+	
+	private long dcId;
+	private String hostType;
+	private int count;
+	
+	public long getDcId() {
+		return dcId;
+	}
+	
+	public void setDcId(long dcId) {
+		this.dcId = dcId;
+	}
+	
+	public String getHostType() {
+		return hostType;
+	}
+	
+	public void setHostType(String hostType) {
+		this.hostType = hostType;
+	}
+	
+	public int getCount() {
+		return count;
+	}
+	
+	public void setCount(int count) {
+		this.count = count;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/GuestVlan.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/GuestVlan.java b/api/src/com/cloud/network/GuestVlan.java
new file mode 100644
index 0000000..a5173d8
--- /dev/null
+++ b/api/src/com/cloud/network/GuestVlan.java
@@ -0,0 +1,31 @@
+// 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.network;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+public interface GuestVlan extends InternalIdentity, Identity {
+
+    public long getId();
+
+    public long getAccountId();
+
+    public String getGuestVlanRange();
+
+    public long getPhysicalNetworkId();
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/IpAddress.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/IpAddress.java b/api/src/com/cloud/network/IpAddress.java
index 71c9b4e..c48e8b9 100644
--- a/api/src/com/cloud/network/IpAddress.java
+++ b/api/src/com/cloud/network/IpAddress.java
@@ -81,4 +81,7 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity
     Long getVpcId();
 
     String getVmIp();
+    
+    Long getNetworkId();
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/Network.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/Network.java b/api/src/com/cloud/network/Network.java
index f1b6f87..100f69e 100644
--- a/api/src/com/cloud/network/Network.java
+++ b/api/src/com/cloud/network/Network.java
@@ -16,18 +16,19 @@
 // under the License.
 package com.cloud.network;
 
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
 import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.Networks.Mode;
 import com.cloud.network.Networks.TrafficType;
 import com.cloud.utils.fsm.StateMachine2;
 import com.cloud.utils.fsm.StateObject;
-import org.apache.cloudstack.acl.ControlledEntity;
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
 
 /**
  * owned by an account.
@@ -50,7 +51,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
                 Capability.MultipleIps, Capability.TrafficStatistics, Capability.SupportedTrafficDirection, Capability.SupportedEgressProtocols);
         public static final Service Lb = new Service("Lb", Capability.SupportedLBAlgorithms, Capability.SupportedLBIsolation,
                 Capability.SupportedProtocols, Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps,
-                Capability.SupportedStickinessMethods, Capability.ElasticLb);
+                Capability.SupportedStickinessMethods, Capability.ElasticLb, Capability.LbSchemes);
         public static final Service UserData = new Service("UserData");
         public static final Service SourceNat = new Service("SourceNat", Capability.SupportedSourceNatTypes, Capability.RedundantRouter);
         public static final Service StaticNat = new Service("StaticNat", Capability.ElasticIp);
@@ -124,6 +125,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
         public static final Provider None = new Provider("None", false);
         // NiciraNvp is not an "External" provider, otherwise we get in trouble with NetworkServiceImpl.providersConfiguredForExternalNetworking 
         public static final Provider NiciraNvp = new Provider("NiciraNvp", false);
+        public static final Provider InternalLbVm = new Provider("InternalLbVm", false);
         public static final Provider CiscoVnmc = new Provider("CiscoVnmc", true);
 
         private String name;
@@ -177,6 +179,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
         public static final Capability SupportedTrafficDirection = new Capability("SupportedTrafficDirection");
         public static final Capability SupportedEgressProtocols = new Capability("SupportedEgressProtocols");
         public static final Capability HealthCheckPolicy = new Capability("HealthCheckPolicy");
+        public static final Capability LbSchemes = new Capability("LbSchemes");
 
         private String name;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/NetworkModel.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/NetworkModel.java b/api/src/com/cloud/network/NetworkModel.java
index 4d7d714..f84a8b0 100644
--- a/api/src/com/cloud/network/NetworkModel.java
+++ b/api/src/com/cloud/network/NetworkModel.java
@@ -33,6 +33,7 @@ import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.element.NetworkElement;
 import com.cloud.network.element.UserDataServiceProvider;
 import com.cloud.offering.NetworkOffering;
+import com.cloud.offering.NetworkOffering.Detail;
 import com.cloud.user.Account;
 import com.cloud.vm.Nic;
 import com.cloud.vm.NicProfile;
@@ -181,7 +182,7 @@ public interface NetworkModel {
     /**
      * @return
      */
-    String getDefaultNetworkDomain();
+    String getDefaultNetworkDomain(long zoneId);
 
     /**
      * @param ntwkOffId
@@ -263,4 +264,12 @@ public interface NetworkModel {
     boolean isProviderEnabledInZone(long zoneId, String provider);
 
     Nic getPlaceholderNicForRouter(Network network, Long podId);
+    
+    IpAddress getPublicIpAddress(String ipAddress, long zoneId);
+
+    List<String> getUsedIpsInNetwork(Network network);
+
+    Map<Detail, String> getNtwkOffDetails(long offId);
+
+    Networks.IsolationType[] listNetworkIsolationMethods();
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/NetworkService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java
index b832ccd..2b4982a 100755
--- a/api/src/com/cloud/network/NetworkService.java
+++ b/api/src/com/cloud/network/NetworkService.java
@@ -18,6 +18,8 @@ package com.cloud.network;
 
 import java.util.List;
 
+import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
+import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
 import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
 import org.apache.cloudstack.api.command.user.network.*;
 import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
@@ -27,6 +29,7 @@ import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.exception.InsufficientCapacityException;
 import com.cloud.exception.ResourceAllocationException;
 import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.GuestVlan;
 import com.cloud.network.Network.Service;
 import com.cloud.network.Networks.TrafficType;
 import com.cloud.user.Account;
@@ -112,6 +115,12 @@ public interface NetworkService {
 
     boolean deletePhysicalNetworkTrafficType(Long id);
 
+    GuestVlan dedicateGuestVlanRange(DedicateGuestVlanRangeCmd cmd);
+
+    Pair<List<? extends GuestVlan>, Integer> listDedicatedGuestVlanRanges(ListDedicatedGuestVlanRangesCmd cmd);
+
+    boolean releaseDedicatedGuestVlanRange(Long dedicatedGuestVlanRangeId);
+
     Pair<List<? extends PhysicalNetworkTrafficType>, Integer> listTrafficTypes(Long physicalNetworkId);
 
 
@@ -136,6 +145,7 @@ public interface NetworkService {
         ResourceAllocationException, ResourceUnavailableException, ConcurrentOperationException;
 
     /**
+     *
      * @param networkName
      * @param displayText
      * @param physicalNetworkId
@@ -146,17 +156,18 @@ public interface NetworkService {
      * @param netmask
      * @param networkOwnerId
      * @param vpcId TODO
+     * @param sourceNat
      * @return
      * @throws InsufficientCapacityException
      * @throws ConcurrentOperationException
      * @throws ResourceAllocationException
      */
     Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String vlan,
-            String startIp, String endIP, String gateway, String netmask, long networkOwnerId, Long vpcId)
+                                 String startIp, String endIP, String gateway, String netmask, long networkOwnerId, Long vpcId, Boolean sourceNat)
                     throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException;
 
     /* Requests an IP address for the guest nic */
-    String allocateSecondaryGuestIP(Account account, long zoneId, Long nicId,
+    NicSecondaryIp allocateSecondaryGuestIP(Account account, long zoneId, Long nicId,
             Long networkId, String ipaddress) throws InsufficientAddressCapacityException;
 
     boolean releaseSecondaryIpFromNic(long ipAddressId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/UserIpv6Address.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/UserIpv6Address.java b/api/src/com/cloud/network/UserIpv6Address.java
new file mode 100644
index 0000000..4c33d45
--- /dev/null
+++ b/api/src/com/cloud/network/UserIpv6Address.java
@@ -0,0 +1,52 @@
+// 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.network;
+
+import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+/**
+ * @author Sheng Yang
+ *
+ */
+public interface UserIpv6Address extends ControlledEntity, Identity, InternalIdentity {
+    enum State {
+        Allocating, // The IP Address is being propagated to other network elements and is not ready for use yet.
+        Allocated, // The IP address is in used.
+        Releasing, // The IP address is being released for other network elements and is not ready for allocation.
+        Free // The IP address is ready to be allocated.
+    }
+
+    long getDataCenterId();
+
+    String getAddress();
+
+    long getVlanId();
+
+    State getState();
+
+    Long getNetworkId();
+    
+    Long getSourceNetworkId();
+
+    Long getPhysicalNetworkId();
+
+    void setState(UserIpv6Address.State state);
+    
+    String getMacAddress();
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/VirtualNetworkApplianceService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/VirtualNetworkApplianceService.java b/api/src/com/cloud/network/VirtualNetworkApplianceService.java
index 250ecb2..58eead2 100644
--- a/api/src/com/cloud/network/VirtualNetworkApplianceService.java
+++ b/api/src/com/cloud/network/VirtualNetworkApplianceService.java
@@ -63,5 +63,7 @@ public interface VirtualNetworkApplianceService {
     VirtualRouter startRouter(long id) throws ResourceUnavailableException, InsufficientCapacityException, ConcurrentOperationException;
 
     VirtualRouter destroyRouter(long routerId, Account caller, Long callerUserId) throws ResourceUnavailableException, ConcurrentOperationException;
+    
+    VirtualRouter findRouter(long routerId);
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/VirtualRouterProvider.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/VirtualRouterProvider.java b/api/src/com/cloud/network/VirtualRouterProvider.java
index ed6a274..f67686e 100644
--- a/api/src/com/cloud/network/VirtualRouterProvider.java
+++ b/api/src/com/cloud/network/VirtualRouterProvider.java
@@ -23,7 +23,8 @@ public interface VirtualRouterProvider extends InternalIdentity, Identity {
     public enum VirtualRouterProviderType {
         VirtualRouter,
         ElasticLoadBalancerVm,
-        VPCVirtualRouter
+        VPCVirtualRouter,
+        InternalLbVm
     }
 
     public VirtualRouterProviderType getType();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/lb/LoadBalancingRule.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/lb/LoadBalancingRule.java b/api/src/com/cloud/network/lb/LoadBalancingRule.java
index 3e11e8c..4b37782 100644
--- a/api/src/com/cloud/network/lb/LoadBalancingRule.java
+++ b/api/src/com/cloud/network/lb/LoadBalancingRule.java
@@ -25,111 +25,83 @@ import com.cloud.network.as.Condition;
 import com.cloud.network.as.Counter;
 import com.cloud.network.rules.FirewallRule;
 import com.cloud.network.rules.LoadBalancer;
+import com.cloud.network.rules.LoadBalancerContainer.Scheme;
 import com.cloud.utils.Pair;
+import com.cloud.utils.net.Ip;
 
-public class LoadBalancingRule implements FirewallRule, LoadBalancer {
+public class LoadBalancingRule {
     private LoadBalancer lb;
+    private Ip sourceIp;
     private List<LbDestination> destinations;
     private List<LbStickinessPolicy> stickinessPolicies;
     private LbAutoScaleVmGroup autoScaleVmGroup;
     private List<LbHealthCheckPolicy> healthCheckPolicies;
 
     public LoadBalancingRule(LoadBalancer lb, List<LbDestination> destinations,
-            List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies) {
+            List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies, Ip sourceIp) {
         this.lb = lb;
         this.destinations = destinations;
         this.stickinessPolicies = stickinessPolicies;
         this.healthCheckPolicies = healthCheckPolicies;
+        this.sourceIp = sourceIp;
     }
 
-    @Override
     public long getId() {
         return lb.getId();
     }
 
-    @Override
-    public long getAccountId() {
-        return lb.getAccountId();
-    }
-
-    @Override
-    public long getDomainId() {
-        return lb.getDomainId();
-    }
-
-    @Override
     public String getName() {
         return lb.getName();
     }
 
-    @Override
     public String getDescription() {
         return lb.getDescription();
     }
 
-    @Override
     public int getDefaultPortStart() {
         return lb.getDefaultPortStart();
     }
 
-    @Override
     public int getDefaultPortEnd() {
         return lb.getDefaultPortEnd();
     }
 
-    @Override
     public String getAlgorithm() {
         return lb.getAlgorithm();
     }
 
-    @Override
     public String getUuid() {
         return lb.getUuid();
     }
 
-    @Override
     public String getXid() {
         return lb.getXid();
     }
 
-    @Override
-    public Long getSourceIpAddressId() {
-        return lb.getSourceIpAddressId();
-    }
-
-    @Override
     public Integer getSourcePortStart() {
         return lb.getSourcePortStart();
     }
 
-    @Override
     public Integer getSourcePortEnd() {
         return lb.getSourcePortEnd();
     }
 
-    @Override
     public String getProtocol() {
         return lb.getProtocol();
     }
 
-    @Override
-    public Purpose getPurpose() {
-        return Purpose.LoadBalancing;
+    public FirewallRule.Purpose getPurpose() {
+        return FirewallRule.Purpose.LoadBalancing;
     }
 
-    @Override
-    public State getState() {
+    public FirewallRule.State getState() {
         return lb.getState();
     }
 
-    @Override
     public long getNetworkId() {
         return lb.getNetworkId();
     }
 
-    public LoadBalancer getLb() {
-        return lb;
-    }
 
     public void setDestinations(List<LbDestination> destinations) {
         this.destinations = destinations;
@@ -287,36 +259,6 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
         }
     }
 
-    @Override
-    public Integer getIcmpCode() {
-        return null;
-    }
-
-    @Override
-    public Integer getIcmpType() {
-        return null;
-    }
-
-    @Override
-    public List<String> getSourceCidrList() {
-        return null;
-    }
-
-    @Override
-    public Long getRelated() {
-        return null;
-    }
-
-    @Override
-    public TrafficType getTrafficType() {
-        return null;
-    }
-
-    @Override
-    public FirewallRuleType getType() {
-        return FirewallRuleType.User;
-    }
-
     public LbAutoScaleVmGroup getAutoScaleVmGroup() {
         return autoScaleVmGroup;
     }
@@ -473,4 +415,11 @@ public class LoadBalancingRule implements FirewallRule, LoadBalancer {
         }
     }
 
+    public Ip getSourceIp() {
+        return sourceIp;
+    }
+
+    public Scheme getScheme() {
+        return lb.getScheme();
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/lb/LoadBalancingRulesService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/lb/LoadBalancingRulesService.java b/api/src/com/cloud/network/lb/LoadBalancingRulesService.java
index ed39bed..5fc41e3 100644
--- a/api/src/com/cloud/network/lb/LoadBalancingRulesService.java
+++ b/api/src/com/cloud/network/lb/LoadBalancingRulesService.java
@@ -17,10 +17,10 @@
 package com.cloud.network.lb;
 
 import java.util.List;
+import java.util.Map;
 
 import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBHealthCheckPolicyCmd;
 import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBStickinessPolicyCmd;
-import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
 import org.apache.cloudstack.api.command.user.loadbalancer.ListLBHealthCheckPoliciesCmd;
 import org.apache.cloudstack.api.command.user.loadbalancer.ListLBStickinessPoliciesCmd;
 import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRuleInstancesCmd;
@@ -30,12 +30,13 @@ import org.apache.cloudstack.api.command.user.loadbalancer.UpdateLoadBalancerRul
 import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.exception.NetworkRuleConflictException;
 import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
 import com.cloud.network.rules.HealthCheckPolicy;
 import com.cloud.network.rules.LoadBalancer;
+import com.cloud.network.rules.LoadBalancerContainer.Scheme;
 import com.cloud.network.rules.StickinessPolicy;
 import com.cloud.uservm.UserVm;
 import com.cloud.utils.Pair;
+import com.cloud.utils.net.Ip;
 
 
 public interface LoadBalancingRulesService {
@@ -49,7 +50,9 @@ public interface LoadBalancingRulesService {
      * @return the newly created LoadBalancerVO if successful, null otherwise
      * @throws InsufficientAddressCapacityException
      */
-    LoadBalancer createLoadBalancerRule(CreateLoadBalancerRuleCmd lb, boolean openFirewall) throws NetworkRuleConflictException, InsufficientAddressCapacityException;
+    LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description, 
+            int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd, Long ipAddrId, String protocol, String algorithm,
+            long networkId, long lbOwnerId, boolean openFirewall) throws NetworkRuleConflictException, InsufficientAddressCapacityException;
 
     LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd);
 
@@ -134,8 +137,9 @@ public interface LoadBalancingRulesService {
 
     List<? extends HealthCheckPolicy> searchForLBHealthCheckPolicies(ListLBHealthCheckPoliciesCmd cmd);
 
-    List<LoadBalancingRule> listByNetworkId(long networkId);
-
     LoadBalancer findById(long LoadBalancer);
-   public void updateLBHealthChecks() throws ResourceUnavailableException;
+    
+    public void updateLBHealthChecks(Scheme scheme) throws ResourceUnavailableException;
+
+    Map<Ip, UserVm> getLbInstances(long lbId);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/router/VirtualRouter.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/router/VirtualRouter.java b/api/src/com/cloud/network/router/VirtualRouter.java
index d7239dd..2311f48 100755
--- a/api/src/com/cloud/network/router/VirtualRouter.java
+++ b/api/src/com/cloud/network/router/VirtualRouter.java
@@ -23,7 +23,7 @@ import com.cloud.vm.VirtualMachine;
  */
 public interface VirtualRouter extends VirtualMachine {
 	public enum Role {
-		VIRTUAL_ROUTER, LB
+		VIRTUAL_ROUTER, LB, INTERNAL_LB_VM
 	}
     Role getRole();
     boolean getIsRedundantRouter();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/rules/LoadBalancer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/rules/LoadBalancer.java b/api/src/com/cloud/network/rules/LoadBalancer.java
index ab6085a..e6dadca 100644
--- a/api/src/com/cloud/network/rules/LoadBalancer.java
+++ b/api/src/com/cloud/network/rules/LoadBalancer.java
@@ -19,16 +19,10 @@ package com.cloud.network.rules;
 /**
  * Definition for a LoadBalancer
  */
-public interface LoadBalancer extends FirewallRule {
-
-    String getName();
-
-    String getDescription();
-
+public interface LoadBalancer extends FirewallRule, LoadBalancerContainer {
+    
     int getDefaultPortStart();
 
     int getDefaultPortEnd();
 
-    String getAlgorithm();
-
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/rules/LoadBalancerContainer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/rules/LoadBalancerContainer.java b/api/src/com/cloud/network/rules/LoadBalancerContainer.java
new file mode 100644
index 0000000..9d5ea59
--- /dev/null
+++ b/api/src/com/cloud/network/rules/LoadBalancerContainer.java
@@ -0,0 +1,33 @@
+// 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.network.rules;
+
+public interface LoadBalancerContainer {
+    
+    public enum Scheme {
+        Public, Internal;
+    }
+
+    String getName();
+
+    String getDescription();
+    
+    String getAlgorithm();
+    
+    Scheme getScheme();
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/rules/RulesService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/rules/RulesService.java b/api/src/com/cloud/network/rules/RulesService.java
index d47b38f..45abd84 100644
--- a/api/src/com/cloud/network/rules/RulesService.java
+++ b/api/src/com/cloud/network/rules/RulesService.java
@@ -67,7 +67,7 @@ public interface RulesService {
 
     boolean applyPortForwardingRules(long ipAdddressId, Account caller) throws ResourceUnavailableException;
 
-    boolean enableStaticNat(long ipAddressId, long vmId, long networkId, boolean isSystemVm, String vmGuestIp) throws NetworkRuleConflictException, ResourceUnavailableException;
+    boolean enableStaticNat(long ipAddressId, long vmId, long networkId, String vmGuestIp) throws NetworkRuleConflictException, ResourceUnavailableException;
 
     PortForwardingRule getPortForwardigRule(long ruleId);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/security/SecurityGroupRules.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/security/SecurityGroupRules.java b/api/src/com/cloud/network/security/SecurityGroupRules.java
index d255e46..4dbafd6 100644
--- a/api/src/com/cloud/network/security/SecurityGroupRules.java
+++ b/api/src/com/cloud/network/security/SecurityGroupRules.java
@@ -31,6 +31,8 @@ public interface SecurityGroupRules extends InternalIdentity {
 
     Long getRuleId();
 
+    String getRuleUuid();
+
     int getStartPort();
 
     int getEndPort();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/vpc/PrivateIp.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpc/PrivateIp.java b/api/src/com/cloud/network/vpc/PrivateIp.java
index 857fc22..eb68433 100644
--- a/api/src/com/cloud/network/vpc/PrivateIp.java
+++ b/api/src/com/cloud/network/vpc/PrivateIp.java
@@ -44,5 +44,6 @@ public interface PrivateIp {
     String getMacAddress();
 
     long getNetworkId();
+    boolean getSourceNat();
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/vpc/VpcGateway.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpc/VpcGateway.java b/api/src/com/cloud/network/vpc/VpcGateway.java
index 1756616..e3530d0 100644
--- a/api/src/com/cloud/network/vpc/VpcGateway.java
+++ b/api/src/com/cloud/network/vpc/VpcGateway.java
@@ -77,4 +77,8 @@ public interface VpcGateway extends Identity, ControlledEntity, InternalIdentity
      * @return
      */
     State getState();
+    /**
+     * @return
+     */
+    boolean getSourceNat();
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/vpc/VpcOffering.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpc/VpcOffering.java b/api/src/com/cloud/network/vpc/VpcOffering.java
index 3961d0a..3ec81e6 100644
--- a/api/src/com/cloud/network/vpc/VpcOffering.java
+++ b/api/src/com/cloud/network/vpc/VpcOffering.java
@@ -26,6 +26,7 @@ public interface VpcOffering extends InternalIdentity, Identity {
     }
 
     public static final String defaultVPCOfferingName = "Default VPC offering";
+    public static final String defaultVPCNSOfferingName = "Default VPC  offering with Netscaler";
 
     /**
      * 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/network/vpc/VpcService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpc/VpcService.java b/api/src/com/cloud/network/vpc/VpcService.java
index 07ce89b..23e2764 100644
--- a/api/src/com/cloud/network/vpc/VpcService.java
+++ b/api/src/com/cloud/network/vpc/VpcService.java
@@ -163,6 +163,7 @@ public interface VpcService {
     /**
      * Persists VPC private gateway in the Database.
      * 
+     *
      * @param vpcId TODO
      * @param physicalNetworkId
      * @param vlan
@@ -170,13 +171,14 @@ public interface VpcService {
      * @param gateway
      * @param netmask
      * @param gatewayOwnerId
+     * @param isSourceNat
      * @return
      * @throws InsufficientCapacityException
      * @throws ConcurrentOperationException
      * @throws ResourceAllocationException
      */
     public PrivateGateway createVpcPrivateGateway(long vpcId, Long physicalNetworkId, String vlan, String ipAddress,
-            String gateway, String netmask, long gatewayOwnerId) throws ResourceAllocationException,
+                                                  String gateway, String netmask, long gatewayOwnerId, Boolean isSourceNat) throws ResourceAllocationException,
             ConcurrentOperationException, InsufficientCapacityException;
 
     /**

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/offering/NetworkOffering.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/offering/NetworkOffering.java b/api/src/com/cloud/offering/NetworkOffering.java
index 6f0b993..72e2a2b 100644
--- a/api/src/com/cloud/offering/NetworkOffering.java
+++ b/api/src/com/cloud/offering/NetworkOffering.java
@@ -16,6 +16,8 @@
 // under the License.
 package com.cloud.offering;
 
+import java.util.Map;
+
 import org.apache.cloudstack.acl.InfrastructureEntity;
 import org.apache.cloudstack.api.Identity;
 import org.apache.cloudstack.api.InternalIdentity;
@@ -38,6 +40,11 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
         Disabled,
         Enabled
     }
+    
+    public enum Detail {
+        InternalLbProvider,
+        PublicLbProvider
+    }
 
     public final static String SystemPublicNetwork = "System-Public-Network";
     public final static String SystemControlNetwork = "System-Control-Network";
@@ -116,5 +123,9 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
     boolean isInline();
 
     boolean getIsPersistent();
+    
+    boolean getInternalLb();
+
+    boolean getPublicLb();
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/offering/ServiceOffering.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/offering/ServiceOffering.java b/api/src/com/cloud/offering/ServiceOffering.java
index d6c215f..165369c 100755
--- a/api/src/com/cloud/offering/ServiceOffering.java
+++ b/api/src/com/cloud/offering/ServiceOffering.java
@@ -30,6 +30,7 @@ public interface ServiceOffering extends InfrastructureEntity, InternalIdentity,
     public static final String ssvmDefaultOffUniqueName = "Cloud.com-SecondaryStorage";
     public static final String routerDefaultOffUniqueName = "Cloud.Com-SoftwareRouter";
     public static final String elbVmDefaultOffUniqueName = "Cloud.Com-ElasticLBVm";
+    public static final String internalLbVmDefaultOffUniqueName = "Cloud.Com-InternalLBVm";
 
     public enum StorageType {
         local,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/resource/UnableDeleteHostException.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/resource/UnableDeleteHostException.java b/api/src/com/cloud/resource/UnableDeleteHostException.java
new file mode 100755
index 0000000..154147c
--- /dev/null
+++ b/api/src/com/cloud/resource/UnableDeleteHostException.java
@@ -0,0 +1,28 @@
+// 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.resource;
+
+import com.cloud.utils.SerialVersionUID;
+import com.cloud.exception.CloudException;
+
+public class UnableDeleteHostException extends CloudException {
+    private static final long serialVersionUID = SerialVersionUID.UnableDeleteHostException;
+    
+    public UnableDeleteHostException(String msg) {
+        super(msg);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/storage/StoragePoolDiscoverer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/storage/StoragePoolDiscoverer.java b/api/src/com/cloud/storage/StoragePoolDiscoverer.java
new file mode 100644
index 0000000..40a925d
--- /dev/null
+++ b/api/src/com/cloud/storage/StoragePoolDiscoverer.java
@@ -0,0 +1,33 @@
+// 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.storage;
+
+import java.net.URI;
+import java.util.Map;
+
+import com.cloud.exception.DiscoveryException;
+import com.cloud.utils.component.Adapter;
+
+/**
+ * Discoverer to find new Storage Pools.
+ */
+public interface StoragePoolDiscoverer extends Adapter {
+
+    Map<? extends StoragePool, Map<String, String>> find(long dcId, Long podId, URI uri, Map<String, String> details) throws DiscoveryException;
+
+    Map<? extends StoragePool, Map<String, String>> find(long dcId, Long podId, URI uri, Map<String, String> details, String username, String password) throws DiscoveryException;
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/storage/snapshot/SnapshotSchedule.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/storage/snapshot/SnapshotSchedule.java b/api/src/com/cloud/storage/snapshot/SnapshotSchedule.java
index 12c1445..6f3d2ce 100644
--- a/api/src/com/cloud/storage/snapshot/SnapshotSchedule.java
+++ b/api/src/com/cloud/storage/snapshot/SnapshotSchedule.java
@@ -16,12 +16,12 @@
 // under the License.
 package com.cloud.storage.snapshot;
 
-import java.util.Date;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
 
-public interface SnapshotSchedule {
-    long getId();
+import java.util.Date;
 
-    String getUuid();
+public interface SnapshotSchedule extends InternalIdentity, Identity {
 
     Long getVolumeId();
 
@@ -38,10 +38,9 @@ public interface SnapshotSchedule {
 
     Long getAsyncJobId();
 
-    void setAsyncJobId(long asyncJobId);
+    void setAsyncJobId(Long asyncJobId);
 
     Long getSnapshotId();
 
     void setSnapshotId(Long snapshotId);
-
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/vm/ConsoleProxy.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/ConsoleProxy.java b/api/src/com/cloud/vm/ConsoleProxy.java
new file mode 100644
index 0000000..1d4fcb1
--- /dev/null
+++ b/api/src/com/cloud/vm/ConsoleProxy.java
@@ -0,0 +1,27 @@
+// 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;
+
+/**
+ *  ConsoleProxy is a system VM instance that is used 
+ *  to proxy VNC traffic
+ */
+public interface ConsoleProxy extends SystemVm {
+    public int getActiveSession();
+    public byte[] getSessionDetails();
+}
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/vm/SecondaryStorageVm.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/SecondaryStorageVm.java b/api/src/com/cloud/vm/SecondaryStorageVm.java
new file mode 100644
index 0000000..9acff14
--- /dev/null
+++ b/api/src/com/cloud/vm/SecondaryStorageVm.java
@@ -0,0 +1,26 @@
+// 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;
+
+/**
+ *  Secondary Storage VM is a system VM instance that is used 
+ *  to interface the management server to secondary storage
+ */
+public interface SecondaryStorageVm extends SystemVm {
+	enum Role { templateProcessor, commandExecutor } 
+}
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/vm/SystemVm.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/SystemVm.java b/api/src/com/cloud/vm/SystemVm.java
new file mode 100644
index 0000000..a697d08
--- /dev/null
+++ b/api/src/com/cloud/vm/SystemVm.java
@@ -0,0 +1,26 @@
+// 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;
+
+import java.util.Date;
+
+public interface SystemVm extends VirtualMachine {
+    public String getPublicIpAddress();
+    public String getPublicNetmask();
+    public String getPublicMacAddress();
+    public Date getLastUpdateTime();
+}


[36/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/WEB-INF/classes/resources/messages_fr_FR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_fr_FR.properties b/client/WEB-INF/classes/resources/messages_fr_FR.properties
index 6a7cc9a..8be438a 100644
--- a/client/WEB-INF/classes/resources/messages_fr_FR.properties
+++ b/client/WEB-INF/classes/resources/messages_fr_FR.properties
@@ -15,78 +15,46 @@
 # specific language governing permissions and limitations
 # under the License.
 
-#Stored by I18NEdit, may be edited!
-ICMP.code=Code ICMP
-ICMP.type=Type ICMP
-changed.item.properties=Propri\u00E9t\u00E9s de l\\'\u00E9l\u00E9ment modifi\u00E9es
+
+changed.item.properties=Propri\u00e9t\u00e9s de l\\'\u00e9l\u00e9ment modifi\u00e9es
 confirm.enable.s3=Remplir les informations suivantes pour activer le support de stockage secondaire S3
 confirm.enable.swift=Remplir les informations suivantes pour activer Swift
 error.could.not.enable.zone=Impossible d\\'activer la zone
-error.installWizard.message=Une erreur s\\'est produite ; vous pouvez retourner en arri\u00E8re et corriger les erreurs
+error.installWizard.message=Une erreur s\\'est produite ; vous pouvez retourner en arri\u00e8re et corriger les erreurs
 error.invalid.username.password=Utilisateur ou mot de passe invalide
-error.login=Votre nom d\\'utilisateur / mot de passe ne correspond pas \u00E0 nos donn\u00E9es.
-error.menu.select=\u00C9chec de l\\'action car il n\\'y a aucun \u00E9l\u00E9ment s\u00E9lectionn\u00E9.
+error.login=Votre nom d\\'utilisateur / mot de passe ne correspond pas \u00e0 nos donn\u00e9es.
+error.menu.select=\u00c9chec de l\\'action car il n\\'y a aucun \u00e9l\u00e9ment s\u00e9lectionn\u00e9.
 error.mgmt.server.inaccessible=Le serveur de gestion est indisponible. Essayez plus tard.
 error.password.not.match=Les mots de passe ne correspondent pas
-error.please.specify.physical.network.tags=L\\'offre r\u00E9seau ne sera pas disponible tant que des libell\u00E9s n\\'auront pas \u00E9t\u00E9 renseign\u00E9s pour ce r\u00E9seau physique.
-error.session.expired=Votre session a expir\u00E9e.
+error.please.specify.physical.network.tags=L\\'offre r\u00e9seau ne sera pas disponible tant que des libell\u00e9s n\\'auront pas \u00e9t\u00e9 renseign\u00e9s pour ce r\u00e9seau physique.
+error.session.expired=Votre session a expir\u00e9e.
 error.something.went.wrong.please.correct.the.following=Erreur; corriger le point suivant
 error.unable.to.reach.management.server=Impossible de joindre le serveur d\\'administration
-error.unresolved.internet.name=Votre nom Internet ne peut pas \u00EAtre r\u00E9solu.
-extractable=D\u00E9compressable
+error.unresolved.internet.name=Votre nom Internet ne peut pas \u00eatre r\u00e9solu.
+extractable=D\u00e9compressable
+force.delete.domain.warning=Attention \: Choisir cette option entra\u00eenera la suppression de tous les domaines issus et l\\'ensemble des comptes associ\u00e9s, ainsi que de leur ressources
 force.delete=Forcer la suppression
-force.delete.domain.warning=Attention \: Choisir cette option entra\u00EEnera la suppression de tous les domaines issus et l\\'ensemble des comptes associ\u00E9s, ainsi que de leur ressources
 force.remove=Forcer la suppression
-force.remove.host.warning=Attention \: Choisir cette option entra\u00EEnera CloudStack \u00E0\u00A0arr\u00EAter l\\'ensemble des machines virtuelles avant d\\'enlever l\\'h\u00F4te du cluster
-force.stop=Forcer l\\'arr\u00EAt
-force.stop.instance.warning=Attention \: un arr\u00EAt forc\u00E9 sur cette instance est la dernier option. Cela peut engendrer des pertes de donn\u00E9es et/ou un comportement inconsistant de votre instance.
-image.directory=R\u00E9pertoire d\\'images
-inline=Align\u00E9
-instances.actions.reboot.label=Red\u00E9marrer l\\'instance
-label.CIDR.list=Liste CIDR
-label.CIDR.of.destination.network=CIDR du r\u00E9seau de destination
-label.CPU.cap=Limitation CPU
-label.DHCP.server.type=Serveur DHCP
-label.DNS.domain.for.guest.networks=Domaine DNS pour les r\u00E9seaux invit\u00E9s
-label.ESP.encryption=Chiffrement ESP
-label.ESP.hash=Empreinte ESP
-label.ESP.lifetime=Dur\u00E9e de vie ESP (secondes)
-label.ESP.policy=Mode ESP
-label.IKE.DH=DH IKE
-label.IKE.encryption=Chiffrement IKE
-label.IKE.hash=Empreinte IKE
-label.IKE.lifetime=Dur\u00E9e de vie IKE (secondes)
-label.IKE.policy=Mode IKE
-label.IPsec.preshared.key=Cl\u00E9 partag\u00E9e IPsec
-label.LB.isolation=R\u00E9partition de charge isol\u00E9e
-label.LUN.number=N\u00B0 LUN
-label.PING.CIFS.password=Mot de passe CIFS PING
-label.PING.CIFS.username=Identifiant CIFS PING
-label.PING.dir=R\u00E9pertoire PING
-label.PING.storage.IP=IP stockage PING
-label.PreSetup=PreSetup
-label.Pxe.server.type=Serveur PXE
-label.SR.name=Nom du point de montage
-label.SharedMountPoint=Point de montage partag\u00E9
-label.TFTP.dir=R\u00E9pertoire TFTP
-label.VMFS.datastore=Magasin de donn\u00E9es VMFS
-label.VMs.in.tier=Machines virtuelles dans le tiers
-label.VPC.router.details=D\u00E9tails routeur VPC
-label.VPN.connection=Connexion VPN
-label.VPN.customer.gateway=Passerelle VPN client
-label.VPN.gateway=Passerelle VPN
+force.remove.host.warning=Attention \: Choisir cette option entra\u00eenera CloudStack \u00e0\u00a0arr\u00eater l\\'ensemble des machines virtuelles avant d\\'enlever l\\'h\u00f4te du cluster
+force.stop=Forcer l\\'arr\u00eat
+force.stop.instance.warning=Attention \: un arr\u00eat forc\u00e9 sur cette instance est la dernier option. Cela peut engendrer des pertes de donn\u00e9es et/ou un comportement inconsistant de votre instance.
+ICMP.code=Code ICMP
+ICMP.type=Type ICMP
+image.directory=R\u00e9pertoire d\\'images
+inline=Align\u00e9
+instances.actions.reboot.label=Red\u00e9marrer l\\'instance
 label.accept.project.invitation=Accepter l\\'invitation au projet
+label.account.and.security.group=Compte, groupe de s\u00e9curit\u00e9
 label.account=Compte
-label.account.and.security.group=Compte, groupe de s\u00E9curit\u00E9
 label.account.id=ID du Compte
 label.account.name=Nom du compte
-label.account.specific=Sp\u00E9cifique au compte
 label.accounts=Comptes
-label.acquire.new.ip=Acqu\u00E9rir une nouvelle adresse IP
-label.action.attach.disk=Rattacher un disque
+label.account.specific=Sp\u00e9cifique au compte
+label.acquire.new.ip=Acqu\u00e9rir une nouvelle adresse IP
 label.action.attach.disk.processing=Rattachement du Disque...
-label.action.attach.iso=Rattacher une image ISO
+label.action.attach.disk=Rattacher un disque
 label.action.attach.iso.processing=Rattachement de l\\'image ISO
+label.action.attach.iso=Rattacher une image ISO
 label.action.cancel.maintenance.mode=Annuler le mode maintenance
 label.action.cancel.maintenance.mode.processing=Annulation du mode maintenance...
 label.action.change.password=Changer le mot de passe
@@ -94,100 +62,100 @@ label.action.change.service=Changer d\\'offre de service
 label.action.change.service.processing=Changement de d\\'offre de service...
 label.action.copy.ISO=Copier une image ISO
 label.action.copy.ISO.processing=Copie de l\\'image ISO...
-label.action.copy.template=Copier un mod\u00E8le
-label.action.copy.template.processing=Copie du Mod\u00E8le...
-label.action.create.template=Cr\u00E9er un mod\u00E8le
-label.action.create.template.from.vm=Cr\u00E9er un mod\u00E8le depuis la VM
-label.action.create.template.from.volume=Cr\u00E9er un mod\u00E8le depuis le volume
-label.action.create.template.processing=Cr\u00E9ation du Mod\u00E8le...
-label.action.create.vm=Cr\u00E9er une VM
-label.action.create.vm.processing=Cr\u00E9ation de la VM...
-label.action.create.volume=Cr\u00E9er un Volume
-label.action.create.volume.processing=Cr\u00E9ation du Volume...
-label.action.delete.IP.range=Supprimer la plage IP
-label.action.delete.IP.range.processing=Suppression de la plage IP...
-label.action.delete.ISO=Supprimer l\\'image ISO
-label.action.delete.ISO.processing=Suppression de l\\'image ISO...
-label.action.delete.account=Supprimer un compte
+label.action.copy.template=Copier un mod\u00e8le
+label.action.copy.template.processing=Copie du Mod\u00e8le...
+label.action.create.template=Cr\u00e9er un mod\u00e8le
+label.action.create.template.from.vm=Cr\u00e9er un mod\u00e8le depuis la VM
+label.action.create.template.from.volume=Cr\u00e9er un mod\u00e8le depuis le volume
+label.action.create.template.processing=Cr\u00e9ation du Mod\u00e8le...
+label.action.create.vm=Cr\u00e9er une VM
+label.action.create.vm.processing=Cr\u00e9ation de la VM...
+label.action.create.volume=Cr\u00e9er un Volume
+label.action.create.volume.processing=Cr\u00e9ation du Volume...
 label.action.delete.account.processing=Suppression du compte...
-label.action.delete.cluster=Supprimer le Cluster
+label.action.delete.account=Supprimer un compte
 label.action.delete.cluster.processing=Suppression du Cluster...
-label.action.delete.disk.offering=Supprimer l\\'offre Disque
+label.action.delete.cluster=Supprimer le Cluster
 label.action.delete.disk.offering.processing=Suppression de l\\'offre Disque...
-label.action.delete.domain=Supprimer le domaine
+label.action.delete.disk.offering=Supprimer l\\'offre Disque
 label.action.delete.domain.processing=Suppression du domaine...
-label.action.delete.firewall=Supprimer la r\u00E8gle de pare-feu
+label.action.delete.domain=Supprimer le domaine
 label.action.delete.firewall.processing=Suppression du Pare-feu...
-label.action.delete.ingress.rule=Supprimer la r\u00E8gle d\\'entr\u00E9e
-label.action.delete.ingress.rule.processing=Suppression de la r\u00E8gle d\\'entr\u00E9e..
-label.action.delete.load.balancer=Supprimer la r\u00E8gle de r\u00E9partition de charge
-label.action.delete.load.balancer.processing=Suppression du r\u00E9partiteur de charge...
-label.action.delete.network=Supprimer le r\u00E9seau
-label.action.delete.network.processing=Suppression du r\u00E9seau...
+label.action.delete.firewall=Supprimer la r\u00e8gle de pare-feu
+label.action.delete.ingress.rule.processing=Suppression de la r\u00e8gle d\\'entr\u00e9e..
+label.action.delete.ingress.rule=Supprimer la r\u00e8gle d\\'entr\u00e9e
+label.action.delete.IP.range.processing=Suppression de la plage IP...
+label.action.delete.IP.range=Supprimer la plage IP
+label.action.delete.ISO.processing=Suppression de l\\'image ISO...
+label.action.delete.ISO=Supprimer l\\'image ISO
+label.action.delete.load.balancer.processing=Suppression du r\u00e9partiteur de charge...
+label.action.delete.load.balancer=Supprimer la r\u00e8gle de r\u00e9partition de charge
+label.action.delete.network.processing=Suppression du r\u00e9seau...
+label.action.delete.network=Supprimer le r\u00e9seau
 label.action.delete.nexusVswitch=Supprimer le Nexus 1000v
-label.action.delete.physical.network=Supprimer le r\u00E9seau physique
-label.action.delete.pod=Supprimer le Pod
+label.action.delete.physical.network=Supprimer le r\u00e9seau physique
 label.action.delete.pod.processing=Suppression du pod...
-label.action.delete.primary.storage=Supprimer le stockage principal
+label.action.delete.pod=Supprimer le Pod
 label.action.delete.primary.storage.processing=Suppression du stockage principal...
-label.action.delete.secondary.storage=Supprimer le stockage secondaire
+label.action.delete.primary.storage=Supprimer le stockage principal
 label.action.delete.secondary.storage.processing=Suppression du stockage secondaire...
-label.action.delete.security.group=Supprimer le groupe de s\u00E9curit\u00E9
-label.action.delete.security.group.processing=Suppression du groupe de s\u00E9curit\u00E9
-label.action.delete.service.offering=Supprimer l\\'offre de service
+label.action.delete.secondary.storage=Supprimer le stockage secondaire
+label.action.delete.security.group.processing=Suppression du groupe de s\u00e9curit\u00e9
+label.action.delete.security.group=Supprimer le groupe de s\u00e9curit\u00e9
 label.action.delete.service.offering.processing=Suppression de l\\'offre de service...
-label.action.delete.snapshot=Supprimer l\\'instantan\u00E9
-label.action.delete.snapshot.processing=Suppression de l\\'instantan\u00E9...
-label.action.delete.system.service.offering=Supprimer l\\'offre syst\u00E8me
-label.action.delete.template=Supprimer le mod\u00E8le
-label.action.delete.template.processing=Suppression du mod\u00E8le...
-label.action.delete.user=Supprimer l\\'utilisateur
+label.action.delete.service.offering=Supprimer l\\'offre de service
+label.action.delete.snapshot.processing=Suppression de l\\'instantan\u00e9...
+label.action.delete.snapshot=Supprimer l\\'instantan\u00e9
+label.action.delete.system.service.offering=Supprimer l\\'offre syst\u00e8me
+label.action.delete.template.processing=Suppression du mod\u00e8le...
+label.action.delete.template=Supprimer le mod\u00e8le
 label.action.delete.user.processing=Suppression de l\\'utilisateur...
-label.action.delete.volume=Supprimer le volume
+label.action.delete.user=Supprimer l\\'utilisateur
 label.action.delete.volume.processing=Suppression du volume...
-label.action.delete.zone=Supprimer la zone
+label.action.delete.volume=Supprimer le volume
 label.action.delete.zone.processing=Suppression de la zone...
-label.action.destroy.instance=Supprimer l\\'instance
+label.action.delete.zone=Supprimer la zone
 label.action.destroy.instance.processing=Suppression de l\\'instance...
-label.action.destroy.systemvm=Supprimer la VM Syst\u00E8me
-label.action.destroy.systemvm.processing=Suppression de la VM Syst\u00E8me...
-label.action.detach.disk=D\u00E9tacher le disque
-label.action.detach.disk.processing=D\u00E9tachement du disque...
-label.action.detach.iso=D\u00E9tacher l\\'image ISO
-label.action.detach.iso.processing=D\u00E9tachement de l\\'image ISO...
-label.action.disable.account=D\u00E9sactiver le compte
-label.action.disable.account.processing=D\u00E9sactivation du compte...
-label.action.disable.cluster=D\u00E9sactiver le cluster
-label.action.disable.cluster.processing=D\u00E9sactivation du cluster...
-label.action.disable.nexusVswitch=D\u00E9sactiver le Nexus 1000v
-label.action.disable.physical.network=D\u00E9sactiver le r\u00E9seau physique
-label.action.disable.pod=D\u00E9sactiver le Pod
-label.action.disable.pod.processing=D\u00E9sactivation du Pod...
-label.action.disable.static.NAT=D\u00E9sactiver le NAT Statique
-label.action.disable.static.NAT.processing=D\u00E9sactivation du NAT Statique...
-label.action.disable.user=D\u00E9sactiver l\\'utilisateur
-label.action.disable.user.processing=D\u00E9sactivation de l\\'utilisateur...
-label.action.disable.zone=D\u00E9sactivation de la zone
-label.action.disable.zone.processing=D\u00E9sactivation de la zone...
-label.action.download.ISO=T\u00E9l\u00E9charger une image ISO
-label.action.download.template=T\u00E9l\u00E9charger un mod\u00E8le
-label.action.download.volume=T\u00E9l\u00E9charger un volume
-label.action.download.volume.processing=T\u00E9l\u00E9chargement du volume...
-label.action.edit.ISO=Modifier l\\'image ISO
+label.action.destroy.instance=Supprimer l\\'instance
+label.action.destroy.systemvm.processing=Suppression de la VM Syst\u00e8me...
+label.action.destroy.systemvm=Supprimer la VM Syst\u00e8me
+label.action.detach.disk=D\u00e9tacher le disque
+label.action.detach.disk.processing=D\u00e9tachement du disque...
+label.action.detach.iso=D\u00e9tacher l\\'image ISO
+label.action.detach.iso.processing=D\u00e9tachement de l\\'image ISO...
+label.action.disable.account=D\u00e9sactiver le compte
+label.action.disable.account.processing=D\u00e9sactivation du compte...
+label.action.disable.cluster=D\u00e9sactiver le cluster
+label.action.disable.cluster.processing=D\u00e9sactivation du cluster...
+label.action.disable.nexusVswitch=D\u00e9sactiver le Nexus 1000v
+label.action.disable.physical.network=D\u00e9sactiver le r\u00e9seau physique
+label.action.disable.pod=D\u00e9sactiver le Pod
+label.action.disable.pod.processing=D\u00e9sactivation du Pod...
+label.action.disable.static.NAT=D\u00e9sactiver le NAT Statique
+label.action.disable.static.NAT.processing=D\u00e9sactivation du NAT Statique...
+label.action.disable.user=D\u00e9sactiver l\\'utilisateur
+label.action.disable.user.processing=D\u00e9sactivation de l\\'utilisateur...
+label.action.disable.zone=D\u00e9sactivation de la zone
+label.action.disable.zone.processing=D\u00e9sactivation de la zone...
+label.action.download.ISO=T\u00e9l\u00e9charger une image ISO
+label.action.download.template=T\u00e9l\u00e9charger un mod\u00e8le
+label.action.download.volume.processing=T\u00e9l\u00e9chargement du volume...
+label.action.download.volume=T\u00e9l\u00e9charger un volume
 label.action.edit.account=Modifier le Compte
 label.action.edit.disk.offering=Modifier l\\'offre de disque
 label.action.edit.domain=Modifier le domaine
 label.action.edit.global.setting=Modifier la configuration globale
-label.action.edit.host=Modifier l\\'h\u00F4te
+label.action.edit.host=Modifier l\\'h\u00f4te
 label.action.edit.instance=Modifier l\\'instance
-label.action.edit.network=Modifier le r\u00E9seau
-label.action.edit.network.offering=Modifier l\\'offre de service r\u00E9seau
-label.action.edit.network.processing=Modification du R\u00E9seau...
+label.action.edit.ISO=Modifier l\\'image ISO
+label.action.edit.network=Modifier le r\u00e9seau
+label.action.edit.network.offering=Modifier l\\'offre de service r\u00e9seau
+label.action.edit.network.processing=Modification du R\u00e9seau...
 label.action.edit.pod=Modifier le pod
 label.action.edit.primary.storage=Modifier le stockage principal
 label.action.edit.resource.limits=Modifier les limites de ressources
 label.action.edit.service.offering=Modifier l\\'offre de service
-label.action.edit.template=Modifier le mod\u00E8le
+label.action.edit.template=Modifier le mod\u00e8le
 label.action.edit.user=Modifier l\\'utilisateur
 label.action.edit.zone=Modifier la zone
 label.action.enable.account=Activer le compte
@@ -197,7 +165,7 @@ label.action.enable.cluster.processing=Activation du cluster...
 label.action.enable.maintenance.mode=Activer le mode maintenance
 label.action.enable.maintenance.mode.processing=Activation du mode maintenance...
 label.action.enable.nexusVswitch=Activer le Nexus 1000v
-label.action.enable.physical.network=Activer le r\u00E9seau physique
+label.action.enable.physical.network=Activer le r\u00e9seau physique
 label.action.enable.pod=Activer le Pod
 label.action.enable.pod.processing=Activation du Pod...
 label.action.enable.static.NAT=Activer le NAT Statique
@@ -208,74 +176,74 @@ label.action.enable.zone=Activer la zone
 label.action.enable.zone.processing=Activation de la zone...
 label.action.force.reconnect=Forcer la reconnexion
 label.action.force.reconnect.processing=Reconnexion en cours...
-label.action.generate.keys=G\u00E9n\u00E9rer les cl\u00E9s
-label.action.generate.keys.processing=G\u00E9n\u00E9ration des cl\u00E9s...
+label.action.generate.keys=G\u00e9n\u00e9rer les cl\u00e9s
+label.action.generate.keys.processing=G\u00e9n\u00e9ration des cl\u00e9s...
 label.action.list.nexusVswitch=Liste des Nexus 1000v
-label.action.lock.account=Verrouiller le compte
 label.action.lock.account.processing=Verrouillage du compte...
-label.action.manage.cluster=G\u00E9rer le Cluster
+label.action.lock.account=Verrouiller le compte
+label.action.manage.cluster=G\u00e9rer le Cluster
 label.action.manage.cluster.processing=Gestion du cluster...
 label.action.migrate.instance=Migrer l\\'instance
 label.action.migrate.instance.processing=Migration de l\\'instance...
 label.action.migrate.router=Migration routeur
 label.action.migrate.router.processing=Migration routeur en cours...
-label.action.migrate.systemvm=Migration VM syst\u00E8me
-label.action.migrate.systemvm.processing=Migration VM syst\u00E8me en cours ...
-label.action.reboot.instance=Red\u00E9marrer l\\'instance
-label.action.reboot.instance.processing=Red\u00E9marrage de l\\'instance...
-label.action.reboot.router=Red\u00E9marrer le routeur
-label.action.reboot.router.processing=Red\u00E9marrage du routeur...
-label.action.reboot.systemvm=Red\u00E9marrer la VM Syst\u00E8me
-label.action.reboot.systemvm.processing=Red\u00E9marrage de la VM Syst\u00E8me...
-label.action.recurring.snapshot=Instantan\u00E9s r\u00E9currents 
+label.action.migrate.systemvm=Migration VM syst\u00e8me
+label.action.migrate.systemvm.processing=Migration VM syst\u00e8me en cours ...
+label.action.reboot.instance.processing=Red\u00e9marrage de l\\'instance...
+label.action.reboot.instance=Red\u00e9marrer l\\'instance
+label.action.reboot.router.processing=Red\u00e9marrage du routeur...
+label.action.reboot.router=Red\u00e9marrer le routeur
+label.action.reboot.systemvm.processing=Red\u00e9marrage de la VM Syst\u00e8me...
+label.action.reboot.systemvm=Red\u00e9marrer la VM Syst\u00e8me
+label.action.recurring.snapshot=Instantan\u00e9s r\u00e9currents
 label.action.register.iso=Enregistrer ISO
-label.action.register.template=Enregistrer mod\u00E8le
-label.action.release.ip=Lib\u00E9rer l\\'adresse IP
-label.action.release.ip.processing=Lib\u00E9ration de l\\'adresse IP...
-label.action.remove.host=Supprimer l\\'h\u00F4te
-label.action.remove.host.processing=Suppression de l\\'h\u00F4te...
-label.action.reset.password=R\u00E9-initialiser le mot de passe
-label.action.reset.password.processing=R\u00E9-initialisation du mot de passe...
-label.action.resize.volume=Redimensionner Volume
+label.action.register.template=Enregistrer mod\u00e8le
+label.action.release.ip=Lib\u00e9rer l\\'adresse IP
+label.action.release.ip.processing=Lib\u00e9ration de l\\'adresse IP...
+label.action.remove.host.processing=Suppression de l\\'h\u00f4te...
+label.action.remove.host=Supprimer l\\'h\u00f4te
+label.action.reset.password.processing=R\u00e9-initialisation du mot de passe...
+label.action.reset.password=R\u00e9-initialiser le mot de passe
 label.action.resize.volume.processing=Redimensionnement en cours...
+label.action.resize.volume=Redimensionner Volume
 label.action.resource.limits=Limites de ressources
-label.action.restore.instance=Restaurer l\\'instance
 label.action.restore.instance.processing=Restauration de l\\'instance...
-label.action.start.instance=D\u00E9marrer l\\'instance
-label.action.start.instance.processing=D\u00E9marrage de l\\'instance...
-label.action.start.router=D\u00E9marrer le routeur
-label.action.start.router.processing=D\u00E9marrage du routeur...
-label.action.start.systemvm=D\u00E9marrer la VM syst\u00E8me
-label.action.start.systemvm.processing=D\u00E9marrage de la VM syst\u00E8me...
-label.action.stop.instance=Arr\u00EAter l\\'Instance
-label.action.stop.instance.processing=Arr\u00EAt de l\\'Instance...
-label.action.stop.router=Arr\u00EAter le routeur
-label.action.stop.router.processing=Arr\u00EAt du routeur...
-label.action.stop.systemvm=Arr\u00EAter la VM syst\u00E8me
-label.action.stop.systemvm.processing=Arr\u00EAt de la VM syst\u00E8me...
-label.action.take.snapshot=Prendre un instantan\u00E9
-label.action.take.snapshot.processing=Prise de l\\'instantan\u00E9...
-label.action.unmanage.cluster=Ne plus g\u00E9rer le Cluster
-label.action.unmanage.cluster.processing=Arr\u00EAt de la gestion du Cluster
-label.action.update.OS.preference=Mettre \u00E0 jour les pr\u00E9f\u00E9rences d\\'OS
-label.action.update.OS.preference.processing=Mise \u00E0 jour des pr\u00E9f\u00E9rences d\\'OS...
-label.action.update.resource.count=Mettre \u00E0 jour le compteur des ressources
-label.action.update.resource.count.processing=Mise \u00E0 jour du compteur...
+label.action.restore.instance=Restaurer l\\'instance
 label.actions=Actions
+label.action.start.instance=D\u00e9marrer l\\'instance
+label.action.start.instance.processing=D\u00e9marrage de l\\'instance...
+label.action.start.router=D\u00e9marrer le routeur
+label.action.start.router.processing=D\u00e9marrage du routeur...
+label.action.start.systemvm=D\u00e9marrer la VM syst\u00e8me
+label.action.start.systemvm.processing=D\u00e9marrage de la VM syst\u00e8me...
+label.action.stop.instance=Arr\u00eater l\\'Instance
+label.action.stop.instance.processing=Arr\u00eat de l\\'Instance...
+label.action.stop.router=Arr\u00eater le routeur
+label.action.stop.router.processing=Arr\u00eat du routeur...
+label.action.stop.systemvm=Arr\u00eater la VM syst\u00e8me
+label.action.stop.systemvm.processing=Arr\u00eat de la VM syst\u00e8me...
+label.action.take.snapshot=Prendre un instantan\u00e9
+label.action.take.snapshot.processing=Prise de l\\'instantan\u00e9...
+label.action.unmanage.cluster=Ne plus g\u00e9rer le Cluster
+label.action.unmanage.cluster.processing=Arr\u00eat de la gestion du Cluster
+label.action.update.OS.preference=Mettre \u00e0 jour les pr\u00e9f\u00e9rences d\\'OS
+label.action.update.OS.preference.processing=Mise \u00e0 jour des pr\u00e9f\u00e9rences d\\'OS...
+label.action.update.resource.count=Mettre \u00e0 jour le compteur des ressources
+label.action.update.resource.count.processing=Mise \u00e0 jour du compteur...
+label.action.vmsnapshot.create=Prendre un instantan\u00e9 VM
+label.action.vmsnapshot.delete=Supprimer l\\'instantan\u00e9 VM
+label.action.vmsnapshot.revert=Revenir \u00e0 un instantan\u00e9 VM
 label.activate.project=Activer projet
 label.active.sessions=Sessions actives
-label.add=Ajouter
-label.add.ACL=Ajouter r\u00E8gle ACL
-label.add.F5.device=Ajouter un F5
-label.add.NiciraNvp.device=Ajouter un contr\u00F4leur Nvp
-label.add.SRX.device=Ajouter un SRX
-label.add.VM.to.tier=Ajouter une machine virtuelle au tiers
-label.add.VPN.gateway=Ajouter une passerelle VPN
 label.add.account=Ajouter un compte
-label.add.account.to.project=Ajouter un compte au projet
 label.add.accounts=Ajouter des comptes
 label.add.accounts.to=Ajouter des comptes sur
-label.add.by=Ajout\u00E9 par
+label.add.account.to.project=Ajouter un compte au projet
+label.add.ACL=Ajouter r\u00e8gle ACL
+label.add.affinity.group=Ajouter nouvea groupe d\\'affinit\u00e9
+label.add=Ajouter
+label.add.BigSwitchVns.device=Ajouter contr\u00f4leur BigSwitch Vns
+label.add.by=Ajout\u00e9 par
 label.add.by.cidr=Ajouter par CIDR
 label.add.by.group=Ajouter par groupe
 label.add.cluster=Ajouter un cluster
@@ -283,308 +251,343 @@ label.add.compute.offering=Ajouter une offre de calcul
 label.add.direct.iprange=Ajouter une plage d\\'adresse IP directe
 label.add.disk.offering=Ajouter une offre disque
 label.add.domain=Ajouter un domaine
-label.add.egress.rule=Ajouter la r\u00E8gle sortante
-label.add.firewall=Ajouter une r\u00E8gle de pare-feu
-label.add.guest.network=Ajouter un r\u00E9seau d\\'invit\u00E9
-label.add.host=Ajouter un h\u00F4te
-label.add.ingress.rule=Ajouter une r\u00E8gle d\\'entr\u00E9e
+label.add.egress.rule=Ajouter la r\u00e8gle sortante
+label.add.F5.device=Ajouter un F5
+label.add.firewall=Ajouter une r\u00e8gle de pare-feu
+label.add.guest.network=Ajouter un r\u00e9seau d\\'invit\u00e9
+label.add.host=Ajouter un h\u00f4te
+label.adding=Ajout
+label.adding.cluster=Ajout du Cluster
+label.adding.failed=\u00c9chec de l\\'ajout
+label.adding.pod=Ajout du Pod
+label.adding.processing=Ajout...
+label.add.ingress.rule=Ajouter une r\u00e8gle d\\'entr\u00e9e
+label.adding.succeeded=Ajout r\u00e9ussi
+label.adding.user=Ajout de l\\'utilisateur
+label.adding.zone=Ajout de la zone
 label.add.ip.range=Ajouter une plage IP
-label.add.load.balancer=Ajouter un r\u00E9partiteur de charge
+label.additional.networks=R\u00e9seaux additionnels
+label.add.load.balancer=Ajouter un r\u00e9partiteur de charge
 label.add.more=Ajouter plus
 label.add.netScaler.device=Ajouter un Netscaler
-label.add.network=Ajouter un r\u00E9seau
-label.add.network.ACL=Ajouter une r\u00E8gle d\\'acc\u00E8s r\u00E9seau ACL
-label.add.network.device=Ajouter un \u00E9quipement r\u00E9seau
-label.add.network.offering=Ajouter une offre r\u00E9seau
+label.add.network.ACL=Ajouter une r\u00e8gle d\\'acc\u00e8s r\u00e9seau ACL
+label.add.network=Ajouter un r\u00e9seau
+label.add.network.device=Ajouter un \u00e9quipement r\u00e9seau
+label.add.network.offering=Ajouter une offre r\u00e9seau
 label.add.new.F5=Ajouter un F5
+label.add.new.gateway=Ajouter une nouvelle passerelle
 label.add.new.NetScaler=Ajouter un Netscaler
 label.add.new.SRX=Ajouter un SRX
-label.add.new.gateway=Ajouter une nouvelle passerelle
 label.add.new.tier=Ajouter un nouveau tiers
-label.add.physical.network=Ajouter un r\u00E9seau physique
+label.add.NiciraNvp.device=Ajouter un contr\u00f4leur Nvp
+label.add.physical.network=Ajouter un r\u00e9seau physique
 label.add.pod=Ajouter un pod
-label.add.port.forwarding.rule=Ajouter une r\u00E8gle de transfert de port
+label.add.port.forwarding.rule=Ajouter une r\u00e8gle de transfert de port
 label.add.primary.storage=Ajouter un stockage principal
+label.add.region=Ajouter R\u00e9gion
 label.add.resources=Ajouter ressources
 label.add.route=Ajouter route
-label.add.rule=Ajouter r\u00E8gle
+label.add.rule=Ajouter r\u00e8gle
 label.add.secondary.storage=Ajouter un stockage secondaire
-label.add.security.group=Ajouter un groupe de s\u00E9curit\u00E9
+label.add.security.group=Ajouter un groupe de s\u00e9curit\u00e9
 label.add.service.offering=Ajouter une offre de service
-label.add.static.nat.rule=Ajouter une r\u00E8gle de NAT statique
+label.add.SRX.device=Ajouter un SRX
+label.add.static.nat.rule=Ajouter une r\u00e8gle de NAT statique
 label.add.static.route=Ajouter une route statique
-label.add.system.service.offering=Ajouter une offre de service syst\u00E8me
-label.add.template=Ajouter un mod\u00E8le
+label.add.system.service.offering=Ajouter une offre de service syst\u00e8me
+label.add.template=Ajouter un mod\u00e8le
 label.add.to.group=Ajouter au groupe
 label.add.user=Ajouter un utilisateur
 label.add.vlan=Ajouter un VLAN
 label.add.vm=Ajouter VM
 label.add.vms=Ajouter VMs
-label.add.vms.to.lb=Ajouter une/des VM(s) \u00E0 la r\u00E8gle de r\u00E9partition de charge
+label.add.vms.to.lb=Ajouter une/des VM(s) \u00e0 la r\u00e8gle de r\u00e9partition de charge
+label.add.VM.to.tier=Ajouter une machine virtuelle au tiers
 label.add.volume=Ajouter un volume
 label.add.vpc=Ajouter un VPC
 label.add.vpn.customer.gateway=Ajouter une passerelle VPN cliente
+label.add.VPN.gateway=Ajouter une passerelle VPN
 label.add.vpn.user=Ajouter un utilisateur VPN
 label.add.zone=Ajouter une zone
-label.adding=Ajout
-label.adding.cluster=Ajout du Cluster
-label.adding.failed=\u00C9chec de l\\'ajout
-label.adding.pod=Ajout du Pod
-label.adding.processing=Ajout...
-label.adding.succeeded=Ajout r\u00E9ussi
-label.adding.user=Ajout de l\\'utilisateur
-label.adding.zone=Ajout de la zone
-label.additional.networks=R\u00E9seaux additionnels
-label.admin=Administrateur
 label.admin.accounts=Comptes Administrateur
-label.advanced=Avanc\u00E9
-label.advanced.mode=Mode avanc\u00E9
-label.advanced.search=Recherche avanc\u00E9e
+label.admin=Administrateur
+label.advanced=Avanc\u00e9
+label.advanced.mode=Mode avanc\u00e9
+label.advanced.search=Recherche avanc\u00e9e
+label.affinity=Affinit\u00e9
+label.affinity.group=Groupe d\\'Affinit\u00e9
+label.affinity.groups=Groups d\\'Affinit\u00e9
 label.agent.password=Mot de passe Agent
 label.agent.username=Identifiant Agent
 label.agree=Accepter
 label.alert=Alerte
 label.algorithm=Algorithme
-label.allocated=Allou\u00E9
-label.allocation.state=\u00C9tat
-label.api.key=Cl\u00E9 d\\'API
+label.allocated=Allou\u00e9
+label.allocation.state=\u00c9tat
+label.anti.affinity=Anti-affinit\u00e9
+label.anti.affinity.group=Groupe d\\'Anti-affinit\u00e9
+label.anti.affinity.groups=Groupes d\\'Anti-affinit\u00e9
+label.api.key=Cl\u00e9 d\\'API
 label.apply=Appliquer
 label.assign=Assigner
-label.assign.to.load.balancer=Assigner l\\'instance au r\u00E9partiteur de charge
-label.associated.network=R\u00E9seau associ\u00E9
-label.associated.network.id=ID du r\u00E9seau associ\u00E9
-label.attached.iso=Image ISO attach\u00E9e
-label.availability=Disponibilit\u00E9
-label.availability.zone=Zone de disponibilit\u00E9
+label.assign.to.load.balancer=Assigner l\\'instance au r\u00e9partiteur de charge
+label.associated.network.id=ID du r\u00e9seau associ\u00e9
+label.associated.network=R\u00e9seau associ\u00e9
+label.attached.iso=Image ISO attach\u00e9e
+label.author.email=Email auteur
+label.author.name=Nom auteur
+label.availability=Disponibilit\u00e9
+label.availability.zone=Zone de disponibilit\u00e9
 label.available=Disponible
 label.available.public.ips=Adresses IP publiques disponibles
 label.back=Retour
 label.bandwidth=Bande passante
 label.basic=Basique
 label.basic.mode=Mode basique
-label.bootable=Amor\u00E7able
+label.bigswitch.controller.address=Adresse du contr\u00f4leur BigSwitch Vns
+label.bootable=Amor\u00e7able
 label.broadcast.domain.range=Plage du domaine multi-diffusion
 label.broadcast.domain.type=Type de domaine de multi-diffusion
 label.broadcast.uri=URI multi-diffusion
 label.by.account=Par compte
-label.by.availability=Par disponibilit\u00E9
+label.by.availability=Par disponibilit\u00e9
 label.by.domain=Par domaine
 label.by.end.date=Par date de fin
 label.by.level=Par niveau
 label.by.pod=Par Pod
-label.by.role=Par r\u00F4le
-label.by.start.date=Par date de d\u00E9but
-label.by.state=Par \u00E9tat
+label.by.role=Par r\u00f4le
+label.by.start.date=Par date de d\u00e9but
+label.by.state=Par \u00e9tat
+label.bytes.received=Octets re\u00e7us
+label.bytes.sent=Octets envoy\u00e9s
 label.by.traffic.type=Par type de trafic
-label.by.type=Par type
 label.by.type.id=Par type d\\'ID
+label.by.type=Par type
 label.by.zone=Par zone
-label.bytes.received=Octets re\u00E7us
-label.bytes.sent=Octets envoy\u00E9s
 label.cancel=Annuler
-label.capacity=Capacit\u00E9
+label.capacity=Capacit\u00e9
 label.certificate=Certificat
 label.change.service.offering=Modifier l\\'offre de service
 label.change.value=Modifier la valeur
-label.character=Caract\u00E8re
-label.checksum=Somme de contr\u00F4le MD5
+label.character=Caract\u00e8re
+label.checksum=Somme de contr\u00f4le MD5
+label.cidr.account=CIDR ou Compte/Groupe de s\u00e9curit\u00e9
 label.cidr=CIDR
-label.cidr.account=CIDR ou Compte/Groupe de s\u00E9curit\u00E9
 label.cidr.list=CIDR Source
+label.CIDR.list=Liste CIDR
+label.CIDR.of.destination.network=CIDR du r\u00e9seau de destination
 label.clean.up=Nettoyage
 label.clear.list=Purger la liste
 label.close=Fermer
 label.cloud.console=Console d\\'Administration du Cloud
-label.cloud.managed=G\u00E9r\u00E9 par Cloud.com
+label.cloud.managed=G\u00e9r\u00e9 par Cloud.com
 label.cluster=Cluster
 label.cluster.name=Nom du cluster
-label.cluster.type=Type de Cluster
 label.clusters=Clusters
+label.cluster.type=Type de Cluster
 label.clvm=CLVM
 label.code=Code
-label.community=Communaut\u00E9
-label.compute=Processeur
+label.community=Communaut\u00e9
 label.compute.and.storage=Calcul et Stockage
 label.compute.offering=Offre de calcul
 label.compute.offerings=Offres de calcul
+label.compute=Processeur
 label.configuration=Configuration
 label.configure=Configurer
-label.configure.network.ACLs=Configurer les r\u00E8gles d\\'acc\u00E8s r\u00E9seau ACL
+label.configure.network.ACLs=Configurer les r\u00e8gles d\\'acc\u00e8s r\u00e9seau ACL
 label.configure.vpc=Configurer le VPC
-label.confirm.password=Confirmer le mot de passe
 label.confirmation=Confirmation
-label.congratulations=F\u00E9licitations \!
+label.confirm.password=Confirmer le mot de passe
+label.congratulations=F\u00e9licitations \!
 label.conserve.mode=Conserver le mode
 label.console.proxy=Console proxy
-label.continue=Continuer
 label.continue.basic.install=Continuer avec l\\'installation basique
-label.corrections.saved=Modifications enregistr\u00E9es
+label.continue=Continuer
+label.corrections.saved=Modifications enregistr\u00e9es
+label.cpu.allocated=CPU allou\u00e9e
+label.cpu.allocated.for.VMs=CPU allou\u00e9e aux VMs
+label.CPU.cap=Limitation CPU
 label.cpu=CPU
-label.cpu.allocated=CPU allou\u00E9e
-label.cpu.allocated.for.VMs=CPU allou\u00E9e aux VMs
+label.cpu.limits=Limites CPU
 label.cpu.mhz=CPU (en MHz)
-label.cpu.utilized=CPU utilis\u00E9e
-label.create.VPN.connection=Cr\u00E9er une connexion VPN
-label.create.project=Cr\u00E9er un projet
-label.create.template=Cr\u00E9er un mod\u00E8le
-label.created=Cr\u00E9\u00E9
-label.created.by.system=Cr\u00E9\u00E9 par le syst\u00E8me
+label.cpu.utilized=CPU utilis\u00e9e
+label.created.by.system=Cr\u00e9\u00e9 par le syst\u00e8me
+label.created=Cr\u00e9\u00e9
+label.create.project=Cr\u00e9er un projet
+label.create.template=Cr\u00e9er un mod\u00e8le
+label.create.VPN.connection=Cr\u00e9er une connexion VPN
 label.cross.zones=Multi Zones
-label.custom.disk.size=Taille de disque personnalis\u00E9e
+label.custom.disk.size=Taille de disque personnalis\u00e9e
 label.daily=Quotidien
-label.data.disk.offering=Offre de disque de donn\u00E9es
+label.data.disk.offering=Offre de disque de donn\u00e9es
 label.date=Date
 label.day.of.month=Jour du mois
 label.day.of.week=Jour de la semaine
-label.dead.peer.detection=D\u00E9tection de pair mort
+label.dead.peer.detection=D\u00e9tection de pair mort
 label.decline.invitation=Refuser l\\'invitation
-label.dedicated=D\u00E9di\u00E9
-label.default=Par d\u00E9faut
-label.default.use=Utilisation par d\u00E9faut
-label.default.view=Vue par d\u00E9faut
-label.delete=Supprimer
+label.dedicated=D\u00e9di\u00e9
+label.default=Par d\u00e9faut
+label.default.use=Utilisation par d\u00e9faut
+label.default.view=Vue par d\u00e9faut
+label.delete.affinity.group=Supprimer le groupe d\\'affinit\u00e9
+label.delete.BigSwitchVns=Supprimer contr\u00f4leur BigSwitch Vns
 label.delete.F5=Supprimer F5
+label.delete.gateway=Supprimer la passerelle
 label.delete.NetScaler=Supprimer Netscaler
-label.delete.NiciraNvp=Supprimer un contr\u00F4leur Nvp
+label.delete.NiciraNvp=Supprimer un contr\u00f4leur Nvp
+label.delete.project=Supprimer projet
 label.delete.SRX=Supprimer SRX
+label.delete=Supprimer
 label.delete.VPN.connection=Supprimer la connexion VPN
 label.delete.VPN.customer.gateway=Supprimer la passerelle VPN client
 label.delete.VPN.gateway=Supprimer la passerelle VPN
-label.delete.gateway=Supprimer la passerelle
-label.delete.project=Supprimer projet
 label.delete.vpn.user=Supprimer l\\'utilisateur VPN
-label.deleting.failed=Suppression \u00E9chou\u00E9e
+label.deleting.failed=Suppression \u00e9chou\u00e9e
 label.deleting.processing=Suppression...
 label.description=Description
-label.destination.physical.network.id=Identifiant du r\u00E9seau physique de destination
+label.destination.physical.network.id=Identifiant du r\u00e9seau physique de destination
 label.destination.zone=Zone de destination
-label.destroy=D\u00E9truire
+label.destroy=D\u00e9truire
 label.destroy.router=Supprimer le routeur
-label.detaching.disk=D\u00E9tacher le disque
-label.details=D\u00E9tails
-label.device.id=ID du p\u00E9riph\u00E9rique
+label.detaching.disk=D\u00e9tacher le disque
+label.details=D\u00e9tails
+label.device.id=ID du p\u00e9riph\u00e9rique
 label.devices=Machines
 label.dhcp=DHCP
-label.direct.ips=Adresses IP du r\u00E9seau partag\u00E9
-label.disable.provider=D\u00E9sactiver ce fournisseur
-label.disable.vpn=D\u00E9sactiver le VPN
-label.disabled=D\u00E9sactiv\u00E9
-label.disabling.vpn.access=D\u00E9sactiver l\\'acc\u00E8s VPN
-label.disk.allocated=Disque Allou\u00E9
+label.DHCP.server.type=Serveur DHCP
+label.direct.ips=Adresses IP du r\u00e9seau partag\u00e9
+label.disabled=D\u00e9sactiv\u00e9
+label.disable.provider=D\u00e9sactiver ce fournisseur
+label.disable.vpn=D\u00e9sactiver le VPN
+label.disabling.vpn.access=D\u00e9sactiver l\\'acc\u00e8s VPN
+label.disk.allocated=Disque Allou\u00e9
 label.disk.offering=Offre de Disque
-label.disk.size=Taille du disque
 label.disk.size.gb=Taille du disque (en Go)
+label.disk.size=Taille du disque
 label.disk.total=Espace disque total
 label.disk.volume=Volume disque
 label.display.name=Nom commun
-label.display.text=Texte affich\u00E9
-label.dns=DNS
+label.display.text=Texte affich\u00e9
 label.dns.1=DNS 1
 label.dns.2=DNS 2
-label.domain=Domaine
+label.dns=DNS
+label.DNS.domain.for.guest.networks=Domaine DNS pour les r\u00e9seaux invit\u00e9s
 label.domain.admin=Administrateur du domaine
+label.domain=Domaine
 label.domain.id=ID du domaine
 label.domain.name=Nom de domaine
 label.domain.router=Routeur du domaine
 label.domain.suffix=Suffixe de domaine DNS (i.e., xyz.com)
-label.done=Termin\u00E9
-label.double.quotes.are.not.allowed=Les guillemets ne sont pas autoris\u00E9es
-label.download.progress=Progression du t\u00E9l\u00E9chargement
-label.drag.new.position=D\u00E9placer sur une autre position
+label.done=Termin\u00e9
+label.double.quotes.are.not.allowed=Les guillemets ne sont pas autoris\u00e9es
+label.download.progress=Progression du t\u00e9l\u00e9chargement
+label.drag.new.position=D\u00e9placer sur une autre position
+label.edit.affinity.group=Modifier le groupe d\\'affinit\u00e9
+label.edit.lb.rule=Modifier la r\u00e8gle LB
 label.edit=Modifier
-label.edit.lb.rule=Modifier la r\u00E8gle LB
-label.edit.network.details=Modifier les param\u00E8tres r\u00E9seau
-label.edit.project.details=Modifier les d\u00E9tails du projet
+label.edit.network.details=Modifier les param\u00e8tres r\u00e9seau
+label.edit.project.details=Modifier les d\u00e9tails du projet
 label.edit.tags=Modifier les balises
 label.edit.traffic.type=Modifier le type de trafic
 label.edit.vpc=Modifier le VPC
-label.egress.rule=R\u00E8gle sortante
-label.egress.rules=R\u00E8gles de sortie
-label.elastic=\u00C9lastique
+label.egress.rule=R\u00e8gle sortante
+label.egress.rules=R\u00e8gles de sortie
 label.elastic.IP=IP extensible
-label.elastic.LB=R\u00E9partition de charge extensible
+label.elastic.LB=R\u00e9partition de charge extensible
+label.elastic=\u00c9lastique
 label.email=Email
 label.enable.provider=Activer le fournisseur
 label.enable.s3=Activer le stockage secondaire de type S3
 label.enable.swift=Activer Swift
 label.enable.vpn=Activer VPN
+label.enabling.vpn.access=Activation de l\\'acc\u00e8s VPN
 label.enabling.vpn=Activation du VPN
-label.enabling.vpn.access=Activation de l\\'acc\u00E8s VPN
 label.end.IP=Fin de plage IP
+label.endpoint.or.operation=Terminaison ou Op\u00e9ration
+label.endpoint=Terminaison
 label.end.port=Port de fin
-label.end.reserved.system.IP=Adresse IP de fin r\u00E9serv\u00E9e Syst\u00E8me
+label.end.reserved.system.IP=Adresse IP de fin r\u00e9serv\u00e9e Syst\u00e8me
 label.end.vlan=VLAN de fin
-label.endpoint.or.operation=Terminaison ou Op\u00E9ration
 label.enter.token=Entrez le jeton unique
-label.error=Erreur
 label.error.code=Code d\\'erreur
-label.esx.host=H\u00F4te ESX/ESXi
+label.error=Erreur
+label.ESP.encryption=Chiffrement ESP
+label.ESP.hash=Empreinte ESP
+label.ESP.lifetime=Dur\u00e9e de vie ESP (secondes)
+label.ESP.policy=Mode ESP
+label.esx.host=H\u00f4te ESX/ESXi
 label.example=Exemple
+label.external.link=Lien externe
 label.f5=F5
-label.failed=\u00C9chou\u00E9
-label.featured=Sponsoris\u00E9
-label.fetch.latest=Rafra\u00EEchir
+label.failed=\u00c9chou\u00e9
+label.featured=Sponsoris\u00e9
+label.fetch.latest=Rafra\u00eechir
 label.filterBy=Filtre
 label.firewall=Pare-feu
-label.first.name=Pr\u00E9nom
+label.first.name=Pr\u00e9nom
 label.format=Format
 label.friday=Vendredi
 label.full=Complet
 label.full.path=Chemin complet
 label.gateway=Passerelle
-label.general.alerts=Alertes g\u00E9n\u00E9rales
-label.generating.url=G\u00E9n\u00E9ration de l\\'URL
-label.go.step.2=Aller \u00E0 l\\'\u00E9tape 2
-label.go.step.3=Aller \u00E0 l\\'\u00E9tape 3
-label.go.step.4=Aller \u00E0 l\\'\u00E9tape 4
-label.go.step.5=Aller \u00E0 l\\'\u00E9tape 5
+label.general.alerts=Alertes g\u00e9n\u00e9rales
+label.generating.url=G\u00e9n\u00e9ration de l\\'URL
+label.go.step.2=Aller \u00e0 l\\'\u00e9tape 2
+label.go.step.3=Aller \u00e0 l\\'\u00e9tape 3
+label.go.step.4=Aller \u00e0 l\\'\u00e9tape 4
+label.go.step.5=Aller \u00e0 l\\'\u00e9tape 5
 label.group=Groupe
 label.group.optional=Groupe (optionnel)
-label.guest=Invit\u00E9
-label.guest.cidr=CIDR invit\u00E9
-label.guest.end.ip=Adresse IP de fin pour les invit\u00E9s
-label.guest.gateway=Passerelle pour les invit\u00E9s
-label.guest.ip=Adresse IP des invit\u00E9s
-label.guest.ip.range=Plage d\\'adresses IP des invit\u00E9s
-label.guest.netmask=Masque de r\u00E9seau des invit\u00E9s
-label.guest.networks=R\u00E9seaux d\\'invit\u00E9
-label.guest.start.ip=Adresse IP de d\u00E9but pour les invit\u00E9s
-label.guest.traffic=Trafic invit\u00E9
-label.guest.type=Type d\\'invit\u00E9
-label.ha.enabled=Haute disponibilit\u00E9 activ\u00E9e
+label.guest.cidr=CIDR invit\u00e9
+label.guest.end.ip=Adresse IP de fin pour les invit\u00e9s
+label.guest.gateway=Passerelle pour les invit\u00e9s
+label.guest=Invit\u00e9
+label.guest.ip=Adresse IP des invit\u00e9s
+label.guest.ip.range=Plage d\\'adresses IP des invit\u00e9s
+label.guest.netmask=Masque de r\u00e9seau des invit\u00e9s
+label.guest.networks=R\u00e9seaux d\\'invit\u00e9
+label.guest.start.ip=Adresse IP de d\u00e9but pour les invit\u00e9s
+label.guest.traffic=Trafic invit\u00e9
+label.guest.type=Type d\\'invit\u00e9
+label.ha.enabled=Haute disponibilit\u00e9 activ\u00e9e
 label.help=Aide
-label.hide.ingress.rule=Cacher la r\u00E8gle d\\'entr\u00E9e
+label.hide.ingress.rule=Cacher la r\u00e8gle d\\'entr\u00e9e
 label.hints=Astuces
-label.host=H\u00F4te
-label.host.MAC=Adresse MAC h\u00F4te
-label.host.alerts=Alertes des h\u00F4tes
-label.host.name=Nom d\\'h\u00F4te
-label.host.tags=\u00C9tiquettes d\\'h\u00F4te
-label.hosts=H\u00F4tes
+label.host.alerts=Alertes des h\u00f4tes
+label.host=H\u00f4te
+label.host.MAC=Adresse MAC h\u00f4te
+label.host.name=Nom d\\'h\u00f4te
+label.hosts=H\u00f4tes
+label.host.tags=\u00c9tiquettes d\\'h\u00f4te
 label.hourly=Chaque heure
-label.hypervisor=Hyperviseur
 label.hypervisor.capabilities=Fonctions hyperviseur
+label.hypervisor=Hyperviseur
 label.hypervisor.type=Type d\\'hyperviseur
 label.hypervisor.version=Version hyperviseur
 label.id=ID
+label.IKE.DH=DH IKE
+label.IKE.encryption=Chiffrement IKE
+label.IKE.hash=Empreinte IKE
+label.IKE.lifetime=Dur\u00e9e de vie IKE (secondes)
+label.IKE.policy=Mode IKE
 label.info=Information
-label.ingress.rule=R\u00E8gle d\\'entr\u00E9e
-label.initiated.by=Initi\u00E9 par
+label.ingress.rule=R\u00e8gle d\\'entr\u00e9e
+label.initiated.by=Initi\u00e9 par
 label.installWizard.addClusterIntro.subtitle=Qu\\'est ce qu\\'un cluster ?
 label.installWizard.addClusterIntro.title=Ajoutons un cluster
-label.installWizard.addHostIntro.subtitle=Qu\\'est ce qu\\'un h\u00F4te ?
-label.installWizard.addHostIntro.title=Ajoutons un h\u00F4te
+label.installWizard.addHostIntro.subtitle=Qu\\'est ce qu\\'un h\u00f4te ?
+label.installWizard.addHostIntro.title=Ajoutons un h\u00f4te
 label.installWizard.addPodIntro.subtitle=Qu\\'est ce qu\\'un pod ?
 label.installWizard.addPodIntro.title=Ajoutons un pod
 label.installWizard.addPrimaryStorageIntro.subtitle=Qu\\'est ce que le stockage principal ?
 label.installWizard.addPrimaryStorageIntro.title=Ajoutons du stockage principal
 label.installWizard.addSecondaryStorageIntro.subtitle=Qu\\'est ce que le stockage secondaire ?
 label.installWizard.addSecondaryStorageIntro.title=Ajoutons du stockage secondaire
-label.installWizard.addZone.title=Ajouter une zone
 label.installWizard.addZoneIntro.subtitle=Qu\\'est ce qu\\'une zone ?
 label.installWizard.addZoneIntro.title=Ajoutons une zone
-label.installWizard.click.launch=Appuyer sur le bouton d\u00E9marrer.
-label.installWizard.subtitle=Ce tutoriel vous aidera \u00E0 configurer votre installation CloudStack&\#8482;
+label.installWizard.addZone.title=Ajouter une zone
+label.installWizard.click.launch=Appuyer sur le bouton d\u00e9marrer.
+label.installWizard.subtitle=Ce tutoriel vous aidera \u00e0 configurer votre installation CloudStack&\#8482;
 label.installWizard.title=Bonjour et bienvenue dans CloudStack&\#8482;
 label.instance=Instance
 label.instance.limits=Limites des instances
@@ -594,105 +597,114 @@ label.internal.dns.1=DNS interne 1
 label.internal.dns.2=DNS interne 2
 label.internal.name=Nom interne
 label.interval.type=Type d\\'intervalle
-label.introduction.to.cloudstack=Introduction \u00E0 CloudStack&\#8482;
+label.introduction.to.cloudstack=Introduction \u00e0 CloudStack&\#8482;
 label.invalid.integer=Nombre entier invalide
 label.invalid.number=Nombre invalide
 label.invitations=Invitations
+label.invited.accounts=Comptes invit\u00e9s
 label.invite=Inviter
 label.invite.to=Inviter sur
-label.invited.accounts=Comptes invit\u00E9s
-label.ip=IP
 label.ip.address=Adresse IP
+label.ipaddress=Adresse IP
 label.ip.allocations=Allocations de IPs
+label.ip=IP
 label.ip.limits=Limite de IPs publiques
 label.ip.or.fqdn=IP ou FQDN
 label.ip.range=Plage IP
 label.ip.ranges=Plages IP
-label.ipaddress=Adresse IP
+label.IPsec.preshared.key=Cl\u00e9 partag\u00e9e IPsec
 label.ips=IPs
-label.is.default=Est par d\u00E9faut
-label.is.redundant.router=Redondant
-label.is.shared=Est partag\u00E9
-label.is.system=Est Syst\u00E8me
 label.iscsi=iSCSI
+label.is.default=Est par d\u00e9faut
+label.iso.boot=D\u00e9marrage par ISO
 label.iso=ISO
-label.iso.boot=D\u00E9marrage par ISO
-label.isolated.networks=R\u00E9seaux isol\u00E9s
-label.isolation.method=M\u00E9thode de s\u00E9paration
+label.isolated.networks=R\u00e9seaux isol\u00e9s
+label.isolation.method=M\u00e9thode de s\u00e9paration
 label.isolation.mode=Mode d\\'isolation
 label.isolation.uri=URI d\\'isolation
-label.item.listing=Liste des \u00E9l\u00E9ments
+label.is.redundant.router=Redondant
+label.is.shared=Est partag\u00e9
+label.is.system=Est Syst\u00e8me
+label.item.listing=Liste des \u00e9l\u00e9ments
 label.keep=Conserver
-label.key=Clef
 label.keyboard.type=Type de clavier
-label.kvm.traffic.label=Libell\u00E9 pour le trafic KVM
-label.label=Libell\u00E9
-label.lang.brportugese=Portuguais Br\u00E9sil
+label.key=Clef
+label.kvm.traffic.label=Libell\u00e9 pour le trafic KVM
+label.label=Libell\u00e9
+label.lang.arabic=Arabe
+label.lang.brportugese=Portuguais Br\u00e9sil
 label.lang.catalan=Catalan
-label.lang.chinese=Chinois (simplifi\u00E9)
+label.lang.chinese=Chinois (simplifi\u00e9)
 label.lang.english=Anglais
-label.lang.french=Fran\u00E7ais
+label.lang.french=Fran\u00e7ais
 label.lang.german=Allemand
 label.lang.italian=Italien
 label.lang.japanese=Japonais
-label.lang.korean=Cor\u00E9en
-label.lang.norwegian=Norv\u00E9gien
+label.lang.korean=Cor\u00e9en
+label.lang.norwegian=Norv\u00e9gien
 label.lang.russian=Russe
 label.lang.spanish=Espagnol
-label.last.disconnected=Derni\u00E8re D\u00E9connexion
+label.last.disconnected=Derni\u00e8re D\u00e9connexion
 label.last.name=Nom
-label.latest.events=Derniers \u00E9v\u00E9nements
-label.launch=D\u00E9marrer
-label.launch.vm=D\u00E9marrer VM
-label.launch.zone=D\u00E9marrer la zone
+label.latest.events=Derniers \u00e9v\u00e9nements
+label.launch=D\u00e9marrer
+label.launch.vm=D\u00e9marrer VM
+label.launch.zone=D\u00e9marrer la zone
+label.LB.isolation=R\u00e9partition de charge isol\u00e9e
 label.least.connections=Le moins de connexions
 label.level=Niveau
 label.linklocal.ip=Adresse IP de lien local
-label.load.balancer=R\u00E9partiteur de charge
-label.load.balancing=R\u00E9partition de charge
-label.load.balancing.policies=R\u00E8gles de r\u00E9partition de charge
+label.load.balancer=R\u00e9partiteur de charge
+label.load.balancing.policies=R\u00e8gles de r\u00e9partition de charge
+label.load.balancing=R\u00e9partition de charge
 label.loading=Chargement en cours
 label.local=Local
+label.local.storage.enabled=Stockage local activ\u00e9
 label.local.storage=Stockage local
-label.local.storage.enabled=Stockage local activ\u00E9
 label.login=Connexion
-label.logout=D\u00E9connexion
+label.logout=D\u00e9connexion
 label.lun=LUN
-label.make.project.owner=Devenir propri\u00E9taire du projet
-label.manage=G\u00E9r\u00E9
-label.manage.resources=G\u00E9rer les ressources
+label.LUN.number=N\u00b0 LUN
+label.make.project.owner=Devenir propri\u00e9taire du projet
+label.manage=G\u00e9r\u00e9
 label.management=Administration
 label.management.ips=Adresses IP de gestion
-label.max.guest.limit=Nombre maximum d\\'invit\u00E9s
-label.max.networks=R\u00E9seaux Max.
+label.manage.resources=G\u00e9rer les ressources
+label.max.cpus=Nombre coeurs CPU max.
+label.max.guest.limit=Nombre maximum d\\'invit\u00e9s
+label.maximum=Maximum
+label.max.memory=M\u00e9moire max. (Mo)
+label.max.networks=R\u00e9seaux Max.
+label.max.primary.storage=Principal max. (Go)
 label.max.public.ips=Max. IP publiques
-label.max.snapshots=Max instantan\u00E9es
-label.max.templates=Max. mod\u00E8les
+label.max.secondary.storage=Secondaire max. (Go)
+label.max.snapshots=Max instantan\u00e9es
+label.max.templates=Max. mod\u00e8les
 label.max.vms=Max. VMs utilisateur
 label.max.volumes=Max. volumes
 label.max.vpcs=Max. VPCs
-label.maximum=Maximum
 label.may.continue=Vous pouvez continuer.
-label.memory=M\u00E9moire (en Mo)
-label.memory.allocated=M\u00E9moire allou\u00E9e
-label.memory.mb=M\u00E9moire (en MB)
-label.memory.total=M\u00E9moire totale
-label.memory.used=M\u00E9moire utilis\u00E9e
+label.memory.allocated=M\u00e9moire allou\u00e9e
+label.memory.limits=Limites m\u00e9moire (Mo)
+label.memory.mb=M\u00e9moire (en MB)
+label.memory=M\u00e9moire (en Mo)
+label.memory.total=M\u00e9moire totale
+label.memory.used=M\u00e9moire utilis\u00e9e
 label.menu.accounts=Comptes
 label.menu.alerts=Alertes
 label.menu.all.accounts=Tous les comptes
 label.menu.all.instances=Toutes les instances
-label.menu.community.isos=ISO de la communaut\u00E9
-label.menu.community.templates=Mod\u00E8les de la communaut\u00E9
+label.menu.community.isos=ISO de la communaut\u00e9
+label.menu.community.templates=Mod\u00e8les de la communaut\u00e9
 label.menu.configuration=Configuration
 label.menu.dashboard=Tableau de bord
-label.menu.destroyed.instances=Instances d\u00E9truites
+label.menu.destroyed.instances=Instances d\u00e9truites
 label.menu.disk.offerings=Offres de disque
 label.menu.domains=Domaines
-label.menu.events=\u00C9v\u00E9nements
-label.menu.featured.isos=ISOs Sponsoris\u00E9es
-label.menu.featured.templates=Mod\u00E8les sponsoris\u00E9s
-label.menu.global.settings=Param\u00E8tres globaux
+label.menu.events=\u00c9v\u00e9nements
+label.menu.featured.isos=ISOs Sponsoris\u00e9es
+label.menu.featured.templates=Mod\u00e8les sponsoris\u00e9s
+label.menu.global.settings=Param\u00e8tres globaux
 label.menu.infrastructure=Infrastructure
 label.menu.instances=Instances
 label.menu.ipaddresses=Adresses IP
@@ -700,72 +712,73 @@ label.menu.isos=ISOs
 label.menu.my.accounts=Mes comptes
 label.menu.my.instances=Mes instances
 label.menu.my.isos=Mes ISOs
-label.menu.my.templates=Mes mod\u00E8les
-label.menu.network=R\u00E9seau
-label.menu.network.offerings=Offres de Service R\u00E9seau
+label.menu.my.templates=Mes mod\u00e8les
+label.menu.network.offerings=Offres de Service R\u00e9seau
+label.menu.network=R\u00e9seau
 label.menu.physical.resources=Ressources physiques
+label.menu.regions=R\u00e9gions
 label.menu.running.instances=Instances actives
-label.menu.security.groups=Groupes de s\u00E9curit\u00E9
+label.menu.security.groups=Groupes de s\u00e9curit\u00e9
 label.menu.service.offerings=Offres de Service
-label.menu.snapshots=Instantan\u00E9s
-label.menu.stopped.instances=Instances Arr\u00EAt\u00E9es
+label.menu.snapshots=Instantan\u00e9s
+label.menu.stopped.instances=Instances Arr\u00eat\u00e9es
 label.menu.storage=Stockage
-label.menu.system=Syst\u00E8me
-label.menu.system.service.offerings=Offres syst\u00E8me
-label.menu.system.vms=\ VMs Syst\u00E8mes
-label.menu.templates=Mod\u00E8les
+label.menu.system.service.offerings=Offres syst\u00e8me
+label.menu.system=Syst\u00e8me
+label.menu.system.vms=\ VMs Syst\u00e8mes
+label.menu.templates=Mod\u00e8les
 label.menu.virtual.appliances=Appliances Virtuelles
 label.menu.virtual.resources=Ressources Virtuelles
 label.menu.volumes=Volumes
+label.migrate.instance.to.host=Migration de l\\'instance sur un autre h\u00f4te
 label.migrate.instance.to=Migrer l\\'instance vers
-label.migrate.instance.to.host=Migration de l\\'instance sur un autre h\u00F4te
 label.migrate.instance.to.ps=Migration de l\\'instance sur un autre stockage principal
-label.migrate.router.to=Migrer le routeur vers 
-label.migrate.systemvm.to=Migrer la VM syst\u00E8me vers 
-label.migrate.to.host=Migrer vers un h\u00F4te
+label.migrate.router.to=Migrer le routeur vers
+label.migrate.systemvm.to=Migrer la VM syst\u00e8me vers
+label.migrate.to.host=Migrer vers un h\u00f4te
 label.migrate.to.storage=Migrer vers un stockage
 label.migrate.volume=Migration du volume vers un autre stockage principal
 label.minimum=Minimum
 label.minute.past.hour=minute(s)
 label.monday=Lundi
 label.monthly=Mensuel
-label.more.templates=Plus de mod\u00E8les
+label.more.templates=Plus de mod\u00e8les
 label.move.down.row=Descendre d\\'un cran
-label.move.to.bottom=D\u00E9placer en bas
+label.move.to.bottom=D\u00e9placer en bas
 label.move.to.top=Placer au dessus
 label.move.up.row=Monter d\\'un cran
 label.my.account=Mon compte
-label.my.network=Mon r\u00E9seau
-label.my.templates=Mes mod\u00E8les
+label.my.network=Mon r\u00e9seau
+label.my.templates=Mes mod\u00e8les
 label.name=Nom
 label.name.optional=Nom (optionnel)
 label.nat.port.range=Plage de port NAT
+label.netmask=Masque de r\u00e9seau
 label.netScaler=NetScaler
-label.netmask=Masque de r\u00E9seau
-label.network=R\u00E9seau
-label.network.ACL=R\u00E8gles d\\'acc\u00E8s r\u00E9seau ACL
-label.network.ACL.total=Total R\u00E8gles d\\'acc\u00E8s r\u00E9seau
-label.network.ACLs=R\u00E8gles d\\'acc\u00E8s r\u00E9seau
-label.network.desc=Description r\u00E9seau
-label.network.device=\u00C9quipement R\u00E9seau
-label.network.device.type=Type d\\'\u00E9quipement r\u00E9seau
+label.network.ACL=R\u00e8gles d\\'acc\u00e8s r\u00e9seau ACL
+label.network.ACLs=R\u00e8gles d\\'acc\u00e8s r\u00e9seau
+label.network.ACL.total=Total R\u00e8gles d\\'acc\u00e8s r\u00e9seau
+label.network.desc=Description r\u00e9seau
+label.network.device.type=Type d\\'\u00e9quipement r\u00e9seau
+label.network.device=\u00c9quipement R\u00e9seau
 label.network.domain=Nom de domaine
-label.network.domain.text=Domaine r\u00E9seau
-label.network.id=ID r\u00E9seau
-label.network.label.display.for.blank.value=Utiliser la passerelle par d\u00E9faut
-label.network.name=Nom du r\u00E9seau
-label.network.offering=Offre de Service R\u00E9seau
-label.network.offering.display.text=Texte affich\u00E9 d\\'Offre de R\u00E9seau
-label.network.offering.id=ID de l\\'Offre de Service R\u00E9seau
-label.network.offering.name=Nom de l\\'Offre de Service R\u00E9seau
-label.network.rate=D\u00E9bit R\u00E9seau
-label.network.rate.megabytes=D\u00E9bit r\u00E9seau (Mo/s)
-label.network.read=Lecture r\u00E9seau
-label.network.service.providers=Fournisseurs de service r\u00E9seau
-label.network.type=Type de r\u00E9seau
-label.network.write=\u00C9criture r\u00E9seau
-label.networking.and.security=R\u00E9seau et s\u00E9curit\u00E9
-label.networks=R\u00E9seaux
+label.network.domain.text=Domaine r\u00e9seau
+label.network.id=ID r\u00e9seau
+label.networking.and.security=R\u00e9seau et s\u00e9curit\u00e9
+label.network.label.display.for.blank.value=Utiliser la passerelle par d\u00e9faut
+label.network.name=Nom du r\u00e9seau
+label.network.offering.display.text=Texte affich\u00e9 d\\'Offre de R\u00e9seau
+label.network.offering.id=ID de l\\'Offre de Service R\u00e9seau
+label.network.offering.name=Nom de l\\'Offre de Service R\u00e9seau
+label.network.offering=Offre de Service R\u00e9seau
+label.network.rate=D\u00e9bit R\u00e9seau
+label.network.rate.megabytes=D\u00e9bit r\u00e9seau (Mo/s)
+label.network.read=Lecture r\u00e9seau
+label.network=R\u00e9seau
+label.network.service.providers=Fournisseurs de service r\u00e9seau
+label.networks=R\u00e9seaux
+label.network.type=Type de r\u00e9seau
+label.network.write=\u00c9criture r\u00e9seau
 label.new=Nouveau
 label.new.password=Nouveau mot de passe
 label.new.project=Nouveau projet
@@ -775,220 +788,234 @@ label.nexusVswitch=Nexus 1000v
 label.nfs=NFS
 label.nfs.server=Serveur NFS
 label.nfs.storage=Stockage NFS
-label.nic.adapter.type=Type de carte r\u00E9seau
-label.nicira.controller.address=Adresse du contr\u00F4leur
+label.nic.adapter.type=Type de carte r\u00e9seau
+label.nicira.controller.address=Adresse du contr\u00f4leur
 label.nicira.l3gatewayserviceuuid=Uuid du service passerelle L3
 label.nicira.transportzoneuuid=Uuid de la Zone Transport
 label.nics=Cartes NIC
-label.no=Non
 label.no.actions=Aucune action disponible
-label.no.alerts=Aucune alerte r\u00E9cente
-label.no.data=Aucune donn\u00E9e
-label.no.errors=Aucune erreur r\u00E9cente
+label.no.alerts=Aucune alerte r\u00e9cente
+label.no.data=Aucune donn\u00e9e
+label.no.errors=Aucune erreur r\u00e9cente
 label.no.isos=Aucun ISOs disponible
-label.no.items=Aucun \u00E9l\u00E9ment disponible
-label.no.security.groups=Aucun groupe de s\u00E9curit\u00E9 disponible
-label.no.thanks=Non merci
+label.no.items=Aucun \u00e9l\u00e9ment disponible
 label.none=Aucun
+label.no=Non
+label.no.security.groups=Aucun groupe de s\u00e9curit\u00e9 disponible
 label.not.found=Introuvable
+label.no.thanks=Non merci
 label.notifications=Messages
-label.num.cpu.cores=Nombre de c\u0153urs
 label.number.of.clusters=Nombre de clusters
-label.number.of.hosts=Nombre d\\'H\u00F4tes
+label.number.of.hosts=Nombre d\\'H\u00f4tes
 label.number.of.pods=Nombre de Pods
-label.number.of.system.vms=Nombre de VM Syst\u00E8me
+label.number.of.system.vms=Nombre de VM Syst\u00e8me
 label.number.of.virtual.routers=Nombre de routeurs virtuels
 label.number.of.zones=Nombre de zones
+label.num.cpu.cores=Nombre de c\u0153urs
 label.numretries=Nombre de tentatives
 label.ocfs2=OCFS2
-label.offer.ha=Offrir la haute disponibilit\u00E9
+label.offer.ha=Offrir la haute disponibilit\u00e9
 label.ok=OK
 label.optional=Facultatif
 label.order=Ordre
-label.os.preference=Pr\u00E9f\u00E9rence OS
+label.os.preference=Pr\u00e9f\u00e9rence OS
 label.os.type=Type du OS
-label.owned.public.ips=Adresses IP Publiques d\u00E9tenues
-label.owner.account=Propri\u00E9taire
-label.owner.domain=Propri\u00E9taire
+label.owned.public.ips=Adresses IP Publiques d\u00e9tenues
+label.owner.account=Propri\u00e9taire
+label.owner.domain=Propri\u00e9taire
 label.parent.domain=Parent du Domaine
+label.password.enabled=Mot de passe activ\u00e9
 label.password=Mot de passe
-label.password.enabled=Mot de passe activ\u00E9
 label.path=Chemin
-label.perfect.forward.secrecy=Confidentialit\u00E9 persistante
-label.physical.network=R\u00E9seau physique
-label.physical.network.ID=Identifiant du r\u00E9seau physique
+label.perfect.forward.secrecy=Confidentialit\u00e9 persistante
+label.physical.network.ID=Identifiant du r\u00e9seau physique
+label.physical.network=R\u00e9seau physique
+label.PING.CIFS.password=Mot de passe CIFS PING
+label.PING.CIFS.username=Identifiant CIFS PING
+label.PING.dir=R\u00e9pertoire PING
+label.PING.storage.IP=IP stockage PING
 label.please.specify.netscaler.info=Renseigner les informations sur le Netscaler
 label.please.wait=Patientez s\\'il vous plait
-label.pod=Pod
+label.plugin.details=D\u00e9tails extension
+label.plugins=Extensions
 label.pod.name=Nom du pod
+label.pod=Pod
 label.pods=Pods
+label.port.forwarding.policies=R\u00e8gles de transfert de port
 label.port.forwarding=Redirection de port
-label.port.forwarding.policies=R\u00E8gles de transfert de port
 label.port.range=Plage de ports
-label.prev=Pr\u00E9c\u00E9dent
+label.PreSetup=PreSetup
 label.previous=Retour
-label.primary.allocated=Stockage principal allou\u00E9
-label.primary.network=R\u00E9seau principal
-label.primary.storage=Premier stockage
+label.prev=Pr\u00e9c\u00e9dent
+label.primary.allocated=Stockage principal allou\u00e9
+label.primary.network=R\u00e9seau principal
 label.primary.storage.count=Groupes de stockage principal
-label.primary.used=Stockage principal utilis\u00E9
-label.private.Gateway=Passerelle priv\u00E9e
-label.private.interface=Interface priv\u00E9e
-label.private.ip=Adresse IP Priv\u00E9e
-label.private.ip.range=Plage d\\'adresses IP Priv\u00E9es
-label.private.ips=Adresses IP Priv\u00E9es
-label.private.network=R\u00E9seau priv\u00E9
-label.private.port=Port priv\u00E9
-label.private.zone=Zone Priv\u00E9e
-label.privatekey=Cl\u00E9 priv\u00E9e PKCS\#8
-label.project=Projet
+label.primary.storage.limits=Limites stockage principal (Go)
+label.primary.storage=Premier stockage
+label.primary.used=Stockage principal utilis\u00e9
+label.private.Gateway=Passerelle priv\u00e9e
+label.private.interface=Interface priv\u00e9e
+label.private.ip=Adresse IP Priv\u00e9e
+label.private.ip.range=Plage d\\'adresses IP Priv\u00e9es
+label.private.ips=Adresses IP Priv\u00e9es
+label.privatekey=Cl\u00e9 priv\u00e9e PKCS\#8
+label.private.network=R\u00e9seau priv\u00e9
+label.private.port=Port priv\u00e9
+label.private.zone=Zone Priv\u00e9e
 label.project.dashboard=Tableau de bord projet
 label.project.id=ID projet
 label.project.invite=Inviter sur le projet
 label.project.name=Nom du projet
-label.project.view=Vue projet
+label.project=Projet
 label.projects=Projets
+label.project.view=Vue projet
 label.protocol=Protocole
 label.providers=Fournisseurs
-label.public=Publique
 label.public.interface=Interface publique
 label.public.ip=Adresse IP publique
 label.public.ips=Adresses IP publiques
-label.public.network=R\u00E9seau public
+label.public.network=R\u00e9seau public
 label.public.port=Port public
+label.public=Publique
 label.public.traffic=Trafic public
 label.public.zone=Zone publique
-label.purpose=R\u00F4le
-label.quickview=Aper\u00E7u
-label.reboot=Red\u00E9marrer
-label.recent.errors=Erreurs r\u00E9centes
-label.redundant.router=Routeur redondant
+label.purpose=R\u00f4le
+label.Pxe.server.type=Serveur PXE
+label.quickview=Aper\u00e7u
+label.reboot=Red\u00e9marrer
+label.recent.errors=Erreurs r\u00e9centes
 label.redundant.router.capability=Router redondant
-label.redundant.state=\u00C9tat de la redondance
+label.redundant.router=Routeur redondant
+label.redundant.state=\u00c9tat de la redondance
 label.refresh=Actualiser
+label.region=R\u00e9gion
 label.related=Connexes
 label.remind.later=Rappeler moi plus tard
-label.remove.ACL=Supprimer une r\u00E8gle ACL
-label.remove.egress.rule=Supprimer la r\u00E8gle sortante
-label.remove.from.load.balancer=Supprimer l\\'instance du r\u00E9partiteur de charge
-label.remove.ingress.rule=Supprimer la r\u00E8gle entrante
+label.remove.ACL=Supprimer une r\u00e8gle ACL
+label.remove.egress.rule=Supprimer la r\u00e8gle sortante
+label.remove.from.load.balancer=Supprimer l\\'instance du r\u00e9partiteur de charge
+label.remove.ingress.rule=Supprimer la r\u00e8gle entrante
 label.remove.ip.range=Supprimer la plage IP
-label.remove.pf=Supprimer la r\u00E8gle de transfert de port
+label.remove.pf=Supprimer la r\u00e8gle de transfert de port
 label.remove.project.account=Supprimer le compte projet
-label.remove.rule=Supprimer la r\u00E8gle
+label.remove.region=Supprimer r\u00e9gion
+label.remove.rule=Supprimer la r\u00e8gle
 label.remove.static.nat.rule=Supprimer le NAT statique
 label.remove.static.route=Supprimer une route statique
 label.remove.tier=Supprimer le tiers
-label.remove.vm.from.lb=Supprimer la VM de la r\u00E8gle de r\u00E9partition de charge
+label.remove.vm.from.lb=Supprimer la VM de la r\u00e8gle de r\u00e9partition de charge
 label.remove.vpc=Supprimer le VPC
 label.removing=Suppression
 label.removing.user=Retrait de l\\'utilisateur
 label.required=Requis
-label.reserved.system.gateway=Passerelle r\u00E9serv\u00E9e Syst\u00E8me
-label.reserved.system.ip=Adresse IP Syst\u00E8me r\u00E9serv\u00E9e
-label.reserved.system.netmask=Masque de sous-r\u00E9seau r\u00E9serv\u00E9 Syst\u00E8me
-label.reset.VPN.connection=R\u00E9-initialiser la connexion VPN
+label.reserved.system.gateway=Passerelle r\u00e9serv\u00e9e Syst\u00e8me
+label.reserved.system.ip=Adresse IP Syst\u00e8me r\u00e9serv\u00e9e
+label.reserved.system.netmask=Masque de sous-r\u00e9seau r\u00e9serv\u00e9 Syst\u00e8me
+label.reset.VPN.connection=R\u00e9-initialiser la connexion VPN
 label.resize.new.offering.id=Nouvelle Offre
 label.resize.new.size=Nouvelle Taille (Go)
-label.resize.shrink.ok=R\u00E9duction OK
-label.resource=Ressource
+label.resize.shrink.ok=R\u00e9duction OK
 label.resource.limits=Limite des ressources
-label.resource.state=\u00C9tat des ressources
+label.resource=Ressource
 label.resources=Ressources
-label.restart.network=Red\u00E9marrage du r\u00E9seau
-label.restart.required=Red\u00E9marrage n\u00E9cessaire
-label.restart.vpc=Red\u00E9marrer le VPC
+label.resource.state=\u00c9tat des ressources
+label.restart.network=Red\u00e9marrage du r\u00e9seau
+label.restart.required=Red\u00e9marrage n\u00e9cessaire
+label.restart.vpc=Red\u00e9marrer le VPC
 label.restore=Restaurer
 label.review=Revoir
-label.revoke.project.invite=R\u00E9voquer l\\'invitation
-label.role=R\u00F4le
-label.root.disk.controller=Contr\u00F4leur de disque principal
+label.revoke.project.invite=R\u00e9voquer l\\'invitation
+label.role=R\u00f4le
+label.root.disk.controller=Contr\u00f4leur de disque principal
 label.root.disk.offering=Offre de disque racine
-label.round.robin=Al\u00E9atoire
-label.rules=R\u00E8gles
+label.round.robin=Al\u00e9atoire
+label.rules=R\u00e8gles
 label.running.vms=VMs actives
-label.s3.access_key=Cl\u00E9 d\\'Acc\u00E8s
+label.s3.access_key=Cl\u00e9 d\\'Acc\u00e8s
 label.s3.bucket=Seau
-label.s3.connection_timeout=D\u00E9lai d\\'expiration de connexion
+label.s3.connection_timeout=D\u00e9lai d\\'expiration de connexion
 label.s3.endpoint=Terminaison
-label.s3.max_error_retry=Nombre d\\'essai en erreur max. 
-label.s3.secret_key=Cl\u00E9 Priv\u00E9e
-label.s3.socket_timeout=D\u00E9lai d\\'expiration de la socket
+label.s3.max_error_retry=Nombre d\\'essai en erreur max.
+label.s3.secret_key=Cl\u00e9 Priv\u00e9e
+label.s3.socket_timeout=D\u00e9lai d\\'expiration de la socket
 label.s3.use_https=Utiliser HTTPS
 label.saturday=Samedi
-label.save=Sauvegarder
 label.save.and.continue=Enregistrer et continuer
+label.save=Sauvegarder
 label.saving.processing=Sauvegarde en cours...
-label.scope=Port\u00E9e
+label.scope=Port\u00e9e
 label.search=Rechercher
-label.secondary.storage=Stockage secondaire
 label.secondary.storage.count=Groupes de stockage secondaire
+label.secondary.storage.limits=Limites stockage secondaire (Go)
+label.secondary.storage=Stockage secondaire
 label.secondary.storage.vm=VM stockage secondaire
-label.secondary.used=Stockage secondaire utilis\u00E9
-label.secret.key=Cl\u00E9 priv\u00E9e
-label.security.group=Groupe de s\u00E9curit\u00E9
-label.security.group.name=Nom du groupe de s\u00E9curit\u00E9
-label.security.groups=Groupes de s\u00E9curit\u00E9
-label.security.groups.enabled=Groupes de s\u00E9curit\u00E9 Activ\u00E9s
-label.select=S\u00E9lectionner
-label.select-view=S\u00E9lectionner la vue 
-label.select.a.template=S\u00E9lectionner un mod\u00E8le
-label.select.a.zone=S\u00E9lectionner une zone
-label.select.instance=S\u00E9lectionner une instance
-label.select.instance.to.attach.volume.to=S\u00E9lectionner l\\'instance \u00E0 laquelle rattacher ce volume
-label.select.iso.or.template=S\u00E9lectionner un ISO ou un mod\u00E8le
-label.select.offering=S\u00E9lectionner une offre
-label.select.project=S\u00E9lectionner un projet
-label.select.tier=S\u00E9lectionner le tiers
-label.select.vm.for.static.nat=S\u00E9lectionner une VM pour le NAT statique
-label.sent=Envoy\u00E9
+label.secondary.used=Stockage secondaire utilis\u00e9
+label.secret.key=Cl\u00e9 priv\u00e9e
+label.security.group=Groupe de s\u00e9curit\u00e9
+label.security.group.name=Nom du groupe de s\u00e9curit\u00e9
+label.security.groups.enabled=Groupes de s\u00e9curit\u00e9 Activ\u00e9s
+label.security.groups=Groupes de s\u00e9curit\u00e9
+label.select.a.template=S\u00e9lectionner un mod\u00e8le
+label.select.a.zone=S\u00e9lectionner une zone
+label.select.instance=S\u00e9lectionner une instance
+label.select.instance.to.attach.volume.to=S\u00e9lectionner l\\'instance \u00e0 laquelle rattacher ce volume
+label.select.iso.or.template=S\u00e9lectionner un ISO ou un mod\u00e8le
+label.select.offering=S\u00e9lectionner une offre
+label.select.project=S\u00e9lectionner un projet
+label.select=S\u00e9lectionner
+label.select.tier=S\u00e9lectionner le tiers
+label.select-view=S\u00e9lectionner la vue
+label.select.vm.for.static.nat=S\u00e9lectionner une VM pour le NAT statique
+label.sent=Envoy\u00e9
 label.server=Serveur
 label.service.capabilities=Fonctions disponibles
 label.service.offering=Offre de Service
-label.session.expired=Session expir\u00E9e
-label.set.up.zone.type=Configurer le type de zone
+label.session.expired=Session expir\u00e9e
 label.setup=Configuration
-label.setup.network=Configurer le r\u00E9seau
+label.setup.network=Configurer le r\u00e9seau
 label.setup.zone=Configurer la zone
+label.set.up.zone.type=Configurer le type de zone
 label.shared=En partage
-label.show.ingress.rule=Montrer la r\u00E8gle d\\'entr\u00E9e
-label.shutdown.provider=\u00C9teindre ce fournisseur
-label.site.to.site.VPN=VPN Site-\u00E0-Site
+label.SharedMountPoint=Point de montage partag\u00e9
+label.show.ingress.rule=Montrer la r\u00e8gle d\\'entr\u00e9e
+label.shutdown.provider=\u00c9teindre ce fournisseur
+label.site.to.site.VPN=VPN Site-\u00e0-Site
 label.size=Taille
-label.skip.guide=J\\'ai d\u00E9j\u00E0 utilis\u00E9 CloudStack avant, passer ce tutoriel
-label.snapshot=Instantan\u00E9
-label.snapshot.limits=Limites d\\'instantan\u00E9s
-label.snapshot.name=Nom Instantan\u00E9
-label.snapshot.s=Instantan\u00E9(s)
-label.snapshot.schedule=Configurer un instantan\u00E9 r\u00E9current
-label.snapshots=Instantan\u00E9s
-label.source=Origine
+label.skip.guide=J\\'ai d\u00e9j\u00e0 utilis\u00e9 CloudStack avant, passer ce tutoriel
+label.snapshot=Instantan\u00e9
+label.snapshot.limits=Limites d\\'instantan\u00e9s
+label.snapshot.name=Nom Instantan\u00e9
+label.snapshot.schedule=Configurer un instantan\u00e9 r\u00e9current
+label.snapshot.s=Instantan\u00e9(s)
+label.snapshots=Instantan\u00e9s
 label.source.nat=NAT Source
-label.specify.IP.ranges=Sp\u00E9cifier des plages IP
-label.specify.vlan=Pr\u00E9ciser le VLAN
+label.source=Origine
+label.specify.IP.ranges=Sp\u00e9cifier des plages IP
+label.specify.vlan=Pr\u00e9ciser le VLAN
+label.SR.name = Nom du point de montage
 label.srx=SRX
-label.start.IP=Plage de d\u00E9but IP
-label.start.port=Port de d\u00E9but
-label.start.reserved.system.IP=Adresse IP de d\u00E9but r\u00E9serv\u00E9e Syst\u00E8me
-label.start.vlan=VLAN de d\u00E9part
-label.state=\u00C9tat
+label.start.IP=Plage de d\u00e9but IP
+label.start.port=Port de d\u00e9but
+label.start.reserved.system.IP=Adresse IP de d\u00e9but r\u00e9serv\u00e9e Syst\u00e8me
+label.start.vlan=VLAN de d\u00e9part
+label.state=\u00c9tat
+label.static.nat.enabled=NAT statique activ\u00e9
 label.static.nat=NAT Statique
-label.static.nat.enabled=NAT statique activ\u00E9
 label.static.nat.to=NAT Statique vers
-label.static.nat.vm.details=D\u00E9tails des NAT statique VM
+label.static.nat.vm.details=D\u00e9tails des NAT statique VM
 label.statistics=Statistiques
 label.status=Statut
-label.step.1=\u00C9tape 1
-label.step.1.title=\u00C9tape 1 \: <strong>S\u00E9lectionnez un mod\u00E8le</strong>
-label.step.2=\u00C9tape 2
-label.step.2.title=\u00C9tape 2 \: <strong>Offre de Service</strong>
-label.step.3=\u00C9tape 3
-label.step.3.title=\u00C9tape 3 \: <strong id\="step3_label">S\u00E9lectionnez une offre de service</strong>
-label.step.4=\u00C9tape 4
-label.step.4.title=\u00C9tape 4 \: <strong>R\u00E9seau</strong>
-label.step.5=\u00C9tape 5
-label.step.5.title=\u00C9tape 5 \: <strong>V\u00E9rification</strong>
-label.stickiness=Fid\u00E9lit\u00E9
+label.step.1.title=\u00c9tape 1 \: <strong>S\u00e9lectionnez un mod\u00e8le</strong>
+label.step.1=\u00c9tape 1
+label.step.2.title=\u00c9tape 2 \: <strong>Offre de Service</strong>
+label.step.2=\u00c9tape 2
+label.step.3.title=\u00c9tape 3 \: <strong id\="step3_label">S\u00e9lectionnez une offre de service</strong>
+label.step.3=\u00c9tape 3
+label.step.4.title=\u00c9tape 4 \: <strong>R\u00e9seau</strong>
+label.step.4=\u00c9tape 4
+label.step.5.title=\u00c9tape 5 \: <strong>V\u00e9rification</strong>
+label.step.5=\u00c9tape 5
+label.stickiness=Fid\u00e9lit\u00e9
 label.sticky.cookie-name=Nom du cookie
 label.sticky.domain=Domaine
 label.sticky.expire=Expiration
@@ -997,127 +1024,140 @@ label.sticky.indirect=Indirect
 label.sticky.length=Longueur
 label.sticky.mode=Mode
 label.sticky.nocache=Pas de cache
-label.sticky.postonly=Apr\u00E8s seulement
-label.sticky.prefix=Pr\u00E9fixe
-label.sticky.request-learn=Apprendre la requ\u00EAte
+label.sticky.postonly=Apr\u00e8s seulement
+label.sticky.prefix=Pr\u00e9fixe
+label.sticky.request-learn=Apprendre la requ\u00eate
 label.sticky.tablesize=Taille du tableau
-label.stop=Arr\u00EAter
-label.stopped.vms=VMs arr\u00EAt\u00E9es
+label.stop=Arr\u00eater
+label.stopped.vms=VMs arr\u00eat\u00e9es
 label.storage=Stockage
-label.storage.tags=\u00C9tiquettes de stockage
+label.storage.tags=\u00c9tiquettes de stockage
 label.storage.traffic=Trafic stockage
 label.storage.type=Type de stockage
-label.subdomain.access=Acc\u00E8s sous-domaine
+label.subdomain.access=Acc\u00e8s sous-domaine
 label.submit=Envoyer
 label.submitted.by=[Soumis par \: <span id\="submitted_by"></span>]
-label.succeeded=R\u00E9ussi
+label.succeeded=R\u00e9ussi
 label.sunday=Dimanche
-label.super.cidr.for.guest.networks=Super CIDR pour les r\u00E9seaux invit\u00E9s
-label.supported.services=Services support\u00E9s
-label.supported.source.NAT.type=Type de NAT support\u00E9
+label.super.cidr.for.guest.networks=Super CIDR pour les r\u00e9seaux invit\u00e9s
+label.supported.services=Services support\u00e9s
+label.supported.source.NAT.type=Type de NAT support\u00e9
 label.suspend.project=Suspendre projet
-label.system.capacity=Capacit\u00E9 syst\u00E8me
-label.system.offering=Offre de syst\u00E8me
-label.system.service.offering=Offre de Service Syst\u00E8me
-label.system.vm=VM Syst\u00E8me
-label.system.vm.type=Type de VM syst\u00E8me 
-label.system.vms=\ VMs Syst\u00E8mes
-label.system.wide.capacity=Capacit\u00E9 globale 
-label.tagged=\u00C9tiquet\u00E9
-label.tags=\u00C9tiquette
+label.system.capacity=Capacit\u00e9 syst\u00e8me
+label.system.offering=Offre de syst\u00e8me
+label.system.service.offering=Offre de Service Syst\u00e8me
+label.system.vms=\ VMs Syst\u00e8mes
+label.system.vm.type=Type de VM syst\u00e8me
+label.system.vm=VM Syst\u00e8me
+label.system.wide.capacity=Capacit\u00e9 globale
+label.tagged=\u00c9tiquet\u00e9
+label.tags=\u00c9tiquette
 label.target.iqn=Cible IQN
-label.task.completed=T\u00E2che termin\u00E9e
-label.template=Mod\u00E8le
-label.template.limits=Limites de mod\u00E8le
-label.theme.default=Th\u00E8me par d\u00E9faut
-label.theme.grey=Personnalis\u00E9 - Gris
-label.theme.lightblue=Personnalis\u00E9 - Bleu clair
+label.task.completed=T\u00e2che termin\u00e9e
+label.template.limits=Limites de mod\u00e8le
+label.template=Mod\u00e8le
+label.TFTP.dir=R\u00e9pertoire TFTP
+label.theme.default=Th\u00e8me par d\u00e9faut
+label.theme.grey=Personnalis\u00e9 - Gris
+label.theme.lightblue=Personnalis\u00e9 - Bleu clair
 label.thursday=Jeudi
+label.tier.details=D\u00e9tails du tiers
 label.tier=Tiers
-label.tier.details=D\u00E9tails du tiers
+label.timeout=D\u00e9lai d\\'expiration
+label.timeout.in.second = D\u00e9lai d\\'expiration (secondes)
 label.time=Temps
 label.time.zone=Fuseau horaire
-label.timeout=D\u00E9lai d\\'expiration
-label.timeout.in.second=D\u00E9lai d\\'expiration (secondes)
 label.timezone=Fuseau horaire
 label.token=Jeton unique
-label.total.CPU=Capacit\u00E9 totale en CPU
-label.total.cpu=Capacit\u00E9 Totale en CPU
-label.total.hosts=Total H\u00F4tes
-label.total.memory=Total m\u00E9moire
+label.total.cpu=Capacit\u00e9 Totale en CPU
+label.total.CPU=Capacit\u00e9 totale en CPU
+label.total.hosts=Total H\u00f4tes
+label.total.memory=Total m\u00e9moire
 label.total.of.ip=Total adresses IP
 label.total.of.vm=Total VM
 label.total.storage=Total stockage
 label.total.vms=Nombre total de VMs
-label.traffic.label=Libell\u00E9 de trafic
-label.traffic.type=Type de Trafic
+label.traffic.label=Libell\u00e9 de trafic
 label.traffic.types=Types de trafic
+label.traffic.type=Type de Trafic
 label.tuesday=Mardi
-label.type=Type
 label.type.id=ID du Type
+label.type=Type
 label.unavailable=Indisponible
-label.unlimited=Illimit\u00E9
-label.untagged=Non Tagg\u00E9
-label.update.project.resources=Mettre \u00E0 jour les ressources du projet
-label.update.ssl=Certificat SSL
-label.update.ssl.cert=Certificat SSL
-label.updating=Mise \u00E0 jour
+label.unlimited=Illimit\u00e9
+label.untagged=Non Tagg\u00e9
+label.update.project.resources=Mettre \u00e0 jour les ressources du projet
+label.update.ssl.cert= Certificat SSL
+label.update.ssl= Certificat SSL
+label.updating=Mise \u00e0 jour
 label.upload=Charger
 label.upload.volume=Charger un volume
 label.url=URL
 label.usage.interface=Interface Utilisation
-label.used=Utilis\u00E9
-label.user=Utilisateur
+label.used=Utilis\u00e9
 label.username=Nom d\\'Utilisateur
 label.users=Utilisateurs
+label.user=Utilisateur
+label.use.vm.ip=Utiliser IP VM \:
 label.value=Valeur
 label.vcdcname=Nom du DC vCenter
 label.vcenter.cluster=Cluster vCenter
 label.vcenter.datacenter=Datacenter vCenter
 label.vcenter.datastore=Datastore vCenter
-label.vcenter.host=H\u00F4te vCenter
+label.vcenter.host=H\u00f4te vCenter
 label.vcenter.password=Mot de passe vCenter
 label.vcenter.username=Nom d\\'utilisateur vCenter
 label.vcipaddress=Adresse IP vCenter
 label.version=Version
-label.view=Voir
 label.view.all=Voir tout
 label.view.console=Voir la console
-label.view.more=Voir plus
 label.viewing=Consultation en cours
+label.view.more=Voir plus
+label.view=Voir
 label.virtual.appliance=Appliance Virtuelle
 label.virtual.appliances=Appliances Virtuelles
 label.virtual.machines=Machines virtuelles
-label.virtual.network=R\u00E9seau virtuel
+label.virtual.network=R\u00e9seau virtuel
 label.virtual.router=Routeur Virtuel
 label.virtual.routers=Routeurs virtuels
-label.vlan=VLAN
 label.vlan.id=ID du VLAN
 label.vlan.range=Plage du VLAN
+label.vlan=VLAN
 label.vm.add=Ajouter une instance
-label.vm.destroy=D\u00E9truire
+label.vm.destroy=D\u00e9truire
 label.vm.display.name=Nom commun VM
-label.vm.name=Nom de la VM
-label.vm.reboot=Red\u00E9marrer
-label.vm.start=D\u00E9marrer
-label.vm.state=\u00C9tat VM
-label.vm.stop=Arr\u00EAter
+label.VMFS.datastore=Magasin de donn\u00e9es VMFS
 label.vmfs=VMFS
+label.vm.name=Nom de la VM
+label.vm.reboot=Red\u00e9marrer
+label.VMs.in.tier=Machines virtuelles dans le tiers
+label.vmsnapshot.current=estCourant
+label.vmsnapshot=Instantan\u00e9s VM
+label.vmsnapshot.memory=M\u00e9more instantan\u00e9
+label.vmsnapshot.parentname=Parent
+label.vmsnapshot.type=Type
+label.vm.start=D\u00e9marrer
+label.vm.state=\u00c9tat VM
+label.vm.stop=Arr\u00eater
 label.vms=VMs
-label.vmware.traffic.label=Libell\u00E9 pour le trafic VMware 
+label.vmware.traffic.label=Libell\u00e9 pour le trafic VMware
 label.volgroup=Groupe de Volume
-label.volume=Volume
 label.volume.limits=Limites des volumes
 label.volume.name=Nom du volume
 label.volumes=Volumes
-label.vpc=VPC
+label.volume=Volume
 label.vpc.id=ID VPC
-label.vpn=VPN
+label.VPC.router.details=D\u00e9tails routeur VPC
+label.vpc=VPC
+label.VPN.connection=Connexion VPN
 label.vpn.customer.gateway=Passerelle VPN client
-label.vsmctrlvlanid=\ ID VLAN Contr\u00F4le
+label.VPN.customer.gateway=Passerelle VPN client
+label.VPN.gateway=Passerelle VPN
+label.vpn=VPN
+label.vsmctrlvlanid=\ ID VLAN Contr\u00f4le
 label.vsmpktvlanid=ID VLAN Paquet
 label.vsmstoragevlanid=VLAN ID Stockage
-label.vsphere.managed=G\u00E9r\u00E9e par vSphere
+label.vsphere.managed=G\u00e9r\u00e9e par vSphere
 label.waiting=En attente
 label.warn=Avertissement
 label.wednesday=Mercredi
@@ -1125,353 +1165,361 @@ label.weekly=Hebdomadaire
 label.welcome=Bienvenue
 label.welcome.cloud.console=Bienvenue dans la Console d\\'Administration
 label.what.is.cloudstack=Qu\\'est-ce-que CloudStack&\#8482; ?
-label.xen.traffic.label=Libell\u00E9 pour le trafic XenServer
+label.xen.traffic.label=Libell\u00e9 pour le trafic XenServer
 label.yes=Oui
-label.zone=Zone
-label.zone.details=D\u00E9tails de la zone
+label.zone.details=D\u00e9tails de la zone
 label.zone.id=ID de la zone
 label.zone.name=Nom de zone
-label.zone.step.1.title=\u00C9tape 1 \: <strong>S\u00E9lectionnez un r\u00E9seau</strong>
-label.zone.step.2.title=\u00C9tape 2 \: <strong>Ajoutez une zone</strong>
-label.zone.step.3.title=\u00C9tape 3 \: <strong>Ajoutez un Pod</strong>
-label.zone.step.4.title=\u00C9tape 4 \: <strong>Ajoutez une plage d\\'adresses IP</strong>
+label.zone.step.1.title=\u00c9tape 1 \: <strong>S\u00e9lectionnez un r\u00e9seau</strong>
+label.zone.step.2.title=\u00c9tape 2 \: <strong>Ajoutez une zone</strong>
+label.zone.step.3.title=\u00c9tape 3 \: <strong>Ajoutez un Pod</strong>
+label.zone.step.4.title=\u00c9tape 4 \: <strong>Ajoutez une plage d\\'adresses IP</strong>
+label.zones=Zones
 label.zone.type=Type de zone
-label.zone.wide=Transverse \u00E0 la zone
-label.zoneWizard.trafficType.guest=Invit\u00E9 \: Trafic entre les machines virtuelles utilisateurs
-label.zoneWizard.trafficType.management=Administration \: Trafic entre les ressources internes de CloudStack, incluant tous les composants qui communiquent avec le serveur d\\'administration, tels que les h\u00F4tes and les machines virtuelles Syst\u00E8mes CloudStack
+label.zone.wide=Transverse \u00e0 la zone
+label.zoneWizard.trafficType.guest=Invit\u00e9 \: Trafic entre les machines virtuelles utilisateurs
+label.zoneWizard.trafficType.management=Administration \: Trafic entre les ressources internes de CloudStack, incluant tous les composants qui communiquent avec le serveur d\\'administration, tels que les h\u00f4tes and les machines virtuelles Syst\u00e8mes CloudStack
 label.zoneWizard.trafficType.public=Public \: Trafic entre Internet et les machines virtuelles dans le nuage
-label.zoneWizard.trafficType.storage=Stockage \: Trafic entre les serveurs de stockages principaux et secondaires, tel que le transfert de machines virtuelles mod\u00E8les et des instantan\u00E9s de disques
-label.zones=Zones
-managed.state=\u00C9tat de la gestion
-message.Zone.creation.complete=Cr\u00E9ation de la zone termin\u00E9e
-message.acquire.new.ip=Confirmer l\\'acquisition d\\'une nouvelle adresse IP pour ce r\u00E9seau.
+label.zoneWizard.trafficType.storage=Stockage \: Trafic entre les serveurs de stockages principaux et secondaires, tel que le transfert de machines virtuelles mod\u00e8les et des instantan\u00e9s de disques
+label.zone=Zone
+managed.state=\u00c9tat de la gestion
+message.acquire.new.ip=Confirmer l\\'acquisition d\\'une nouvelle adresse IP pour ce r\u00e9seau.
 message.acquire.new.ip.vpc=Veuillez confirmer que vous voulez une nouvelle adresse IP pour ce VPC
-message.acquire.public.ip=S\u00E9lectionnez la zone dans laquelle vous voulez acqu\u00E9rir votre nouvelle adresse IP.
-message.action.cancel.maintenance=Votre h\u00F4te a quitt\u00E9 la maintenance. Ce processus peut prendre jusqu\\'\u00E0 plusieurs minutes.
+message.acquire.public.ip=S\u00e9lectionnez la zone dans laquelle vous voulez acqu\u00e9rir votre nouvelle adresse IP.
 message.action.cancel.maintenance.mode=Confirmer l\\'annulation de cette maintenance.
-message.action.change.service.warning.for.instance=Votre instance doit \u00EAtre arr\u00EAt\u00E9e avant d\\'essayer de changer son offre de service.
-message.action.change.service.warning.for.router=Votre routeur doit \u00EAtre arr\u00EAt\u00E9 avant d\\'essayer de changer son offre de service.
-message.action.delete.ISO=\u00CAtes-vous s\u00FBr que vous souhaitez supprimer cette ISO.
-message.action.delete.ISO.for.all.zones=L\\'ISO est utilis\u00E9 par toutes les zones. S\\'il vous pla\u00EEt confirmer que vous voulez le supprimer de toutes les zones.
-message.action.delete.cluster=\u00CAtes-vous s\u00FBr que vous voulez supprimer ce cluster.
-message.action.delete.disk.offering=\u00CAtes-vous s\u00FBr que vous souhaitez supprimer cette offre de disque.
-message.action.delete.domain=\u00CAtes-vous s\u00FBr que vous voulez supprimer ce domaine.
-message.action.delete.external.firewall=\u00CAtes-vous s\u00FBr que vous souhaitez supprimer ce pare-feu externe. Attention \: Si vous pr\u00E9voyez de rajouter le m\u00EAme pare-feu externe de nouveau, vous devez r\u00E9-initialiser les donn\u00E9es d\\'utilisation sur l\\'appareil.
-message.action.delete.external.load.balancer=\u00CAtes-vous s\u00FBr que vous souhaitez supprimer ce r\u00E9partiteur de charge externe. Attention \: Si vous pensez ajouter le m\u00EAme r\u00E9partiteur de charge plus tard, vous devez remettre \u00E0 z\u00E9ro les statistiques d\\'utilisation de cet \u00E9quipement.
-message.action.delete.ingress.rule=\u00CAtes-vous s\u00FBr que vous souhaitez supprimer cette r\u00E8gle d\\'entr\u00E9e.
-message.action.delete.network=\u00CAtes-vous s\u00FBr que vous voulez supprimer ce r\u00E9seau.
+message.action.cancel.maintenance=Votre h\u00f4te a quitt\u00e9 la maintenance. Ce processus peut prendre jusqu\\'\u00

<TRUNCATED>

[50/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index f418628..016554a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,10 +18,7 @@
 build/replace.properties
 build/build.number
 bin/
-cloudstack-proprietary/
-premium/
 .lock-wscript
-artifacts/
 .waf-*
 waf-*
 target/
@@ -37,7 +34,7 @@ cloud-*.tar.bz2
 *.egg-info/
 *.prefs
 build.number
-api.log.*.gz
+*.log.*.gz
 cloud.log.*.*
 unittest
 deps/cloud.userlibraries
@@ -59,6 +56,7 @@ tools/cli/build/
 *.iso
 *.tar.gz
 *.tgz
+.*
 target-eclipse
 awsapi/modules/*
 !.gitignore

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/agent/conf/agent.properties
----------------------------------------------------------------------
diff --git a/agent/conf/agent.properties b/agent/conf/agent.properties
index e49afbf..7dc4ba8 100644
--- a/agent/conf/agent.properties
+++ b/agent/conf/agent.properties
@@ -78,7 +78,7 @@ domr.scripts.dir=scripts/network/domr/kvm
 # a sensible default will be selected based on the network.bridge.type but can
 # be overridden here.
 # native = com.cloud.hypervisor.kvm.resource.BridgeVifDriver
-# openvswitch = com.cloud.hypervisor.kvm.resource.OvsBridgeDriver
+# openvswitch = com.cloud.hypervisor.kvm.resource.OvsVifDriver
 #libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.BridgeVifDriver
 
 # set the hypervisor type, values are: kvm, lxc

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/AgentControlAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/AgentControlAnswer.java b/api/src/com/cloud/agent/api/AgentControlAnswer.java
deleted file mode 100644
index 7dbf7b5..0000000
--- a/api/src/com/cloud/agent/api/AgentControlAnswer.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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.agent.api;
-
-public class AgentControlAnswer extends Answer {
-	public AgentControlAnswer() {
-	}
-
-    public AgentControlAnswer(Command command) {
-        super(command);
-    }
-
-    public AgentControlAnswer(Command command, boolean success, String details) {
-    	super(command, success, details);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/AgentControlCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/AgentControlCommand.java b/api/src/com/cloud/agent/api/AgentControlCommand.java
deleted file mode 100644
index da187ac..0000000
--- a/api/src/com/cloud/agent/api/AgentControlCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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.agent.api;
-
-public class AgentControlCommand extends Command {
-
-	public AgentControlCommand() {
-	}
-
-    public boolean executeInSequence() {
-    	return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/AttachIsoCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/AttachIsoCommand.java b/api/src/com/cloud/agent/api/AttachIsoCommand.java
deleted file mode 100644
index c6f0b61..0000000
--- a/api/src/com/cloud/agent/api/AttachIsoCommand.java
+++ /dev/null
@@ -1,59 +0,0 @@
-// 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.agent.api;
-
-public class AttachIsoCommand extends Command {
-
-	private String vmName;
-	private String storeUrl;
-	private String isoPath;
-	private boolean attach;
-
-	protected AttachIsoCommand() {
-	}
-
-	public AttachIsoCommand(String vmName, String isoPath, boolean attach) {
-		this.vmName = vmName;
-		this.isoPath = isoPath;
-		this.attach = attach;
-	}
-
-	@Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-	public String getVmName() {
-		return vmName;
-	}
-
-	public String getIsoPath() {
-		return isoPath;
-	}
-
-	public boolean isAttach() {
-	    return attach;
-	}
-
-	public String getStoreUrl() {
-		return storeUrl;
-	}
-
-	public void setStoreUrl(String url) {
-		storeUrl = url;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/AttachVolumeAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/AttachVolumeAnswer.java b/api/src/com/cloud/agent/api/AttachVolumeAnswer.java
deleted file mode 100644
index b377b7c..0000000
--- a/api/src/com/cloud/agent/api/AttachVolumeAnswer.java
+++ /dev/null
@@ -1,58 +0,0 @@
-// 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.agent.api;
-
-
-public class AttachVolumeAnswer extends Answer {
-    private Long deviceId;
-    private String chainInfo;
-
-    protected AttachVolumeAnswer() {
-
-    }
-
-    public AttachVolumeAnswer(AttachVolumeCommand cmd, String result) {
-        super(cmd, false, result);
-        this.deviceId = null;
-    }
-
-    public AttachVolumeAnswer(AttachVolumeCommand cmd, Long deviceId) {
-        super(cmd);
-        this.deviceId = deviceId;
-    }
-
-
-    public AttachVolumeAnswer(AttachVolumeCommand cmd) {
-        super(cmd);
-        this.deviceId = null;
-    }
-
-    /**
-     * @return the deviceId
-     */
-    public Long getDeviceId() {
-        return deviceId;
-    }
-
-    public void setChainInfo(String chainInfo) {
-    	this.chainInfo = chainInfo;
-    }
-
-    public String getChainInfo() {
-    	return chainInfo;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/AttachVolumeCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/AttachVolumeCommand.java b/api/src/com/cloud/agent/api/AttachVolumeCommand.java
deleted file mode 100644
index 302b8f8..0000000
--- a/api/src/com/cloud/agent/api/AttachVolumeCommand.java
+++ /dev/null
@@ -1,99 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.storage.Storage.StoragePoolType;
-
-public class AttachVolumeCommand extends Command {
-
-	boolean attach;
-	String vmName;
-	StoragePoolType pooltype;
-	String poolUuid;
-	String volumeFolder;
-	String volumePath;
-	String volumeName;
-	Long deviceId;
-	String chainInfo;
-
-	protected AttachVolumeCommand() {
-	}
-
-	public AttachVolumeCommand(boolean attach, String vmName, StoragePoolType pooltype, String volumeFolder, String volumePath, String volumeName, Long deviceId, String chainInfo) {
-		this.attach = attach;
-		this.vmName = vmName;
-		this.pooltype = pooltype;
-		this.volumeFolder = volumeFolder;
-		this.volumePath = volumePath;
-		this.volumeName = volumeName;
-		this.deviceId = deviceId;
-		this.chainInfo = chainInfo;
-	}
-
-	@Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-	public boolean getAttach() {
-		return attach;
-	}
-
-	public String getVmName() {
-		return vmName;
-	}
-
-	public StoragePoolType getPooltype() {
-        return pooltype;
-    }
-
-    public void setPooltype(StoragePoolType pooltype) {
-        this.pooltype = pooltype;
-    }
-
-    public String getVolumeFolder() {
-		return volumeFolder;
-	}
-
-	public String getVolumePath() {
-		return volumePath;
-	}
-
-	public String getVolumeName() {
-		return volumeName;
-	}
-
-    public Long getDeviceId() {
-        return deviceId;
-    }
-
-    public void setDeviceId(Long deviceId) {
-        this.deviceId = deviceId;
-    }
-
-    public String getPoolUuid() {
-    	return poolUuid;
-    }
-
-    public void setPoolUuid(String poolUuid) {
-    	this.poolUuid = poolUuid;
-    }
-
-    public String getChainInfo() {
-    	return chainInfo;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/BackupSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/BackupSnapshotAnswer.java b/api/src/com/cloud/agent/api/BackupSnapshotAnswer.java
deleted file mode 100644
index 9e35db6..0000000
--- a/api/src/com/cloud/agent/api/BackupSnapshotAnswer.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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.agent.api;
-
-
-public class BackupSnapshotAnswer extends Answer {
-    private String backupSnapshotName;
-    private boolean full;
-
-    protected BackupSnapshotAnswer() {
-
-    }
-
-    public BackupSnapshotAnswer(BackupSnapshotCommand cmd, boolean success, String result, String backupSnapshotName, boolean full) {
-        super(cmd, success, result);
-        this.backupSnapshotName = backupSnapshotName;
-        this.full = full;
-    }
-
-    /**
-     * @return the backupSnapshotName
-     */
-    public String getBackupSnapshotName() {
-        return backupSnapshotName;
-    }
-
-    public boolean isFull() {
-        return full;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/BackupSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/BackupSnapshotCommand.java b/api/src/com/cloud/agent/api/BackupSnapshotCommand.java
deleted file mode 100644
index cac686d..0000000
--- a/api/src/com/cloud/agent/api/BackupSnapshotCommand.java
+++ /dev/null
@@ -1,121 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-import com.cloud.agent.api.to.S3TO;
-import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.agent.api.to.SwiftTO;
-import com.cloud.storage.StoragePool;
-
-/**
- * This currently assumes that both primary and secondary storage are mounted on the XenServer.
- */
-public class BackupSnapshotCommand extends SnapshotCommand {
-    private String prevSnapshotUuid;
-    private String prevBackupUuid;
-    private boolean isVolumeInactive;
-    private String vmName;
-    private Long snapshotId;
-    @LogLevel(Log4jLevel.Off)
-    private SwiftTO swift;
-    private S3TO s3;
-    StorageFilerTO pool;
-    private Long secHostId;
-
-    protected BackupSnapshotCommand() {
-
-    }
-
-    /**
-     * @param primaryStoragePoolNameLabel   The UUID of the primary storage Pool
-     * @param secondaryStoragePoolURL  This is what shows up in the UI when you click on Secondary storage.
-     * @param snapshotUuid             The UUID of the snapshot which is going to be backed up
-     * @param prevSnapshotUuid         The UUID of the previous snapshot for this volume. This will be destroyed on the primary storage.
-     * @param prevBackupUuid           This is the UUID of the vhd file which was last backed up on secondary storage.
-     * @param firstBackupUuid          This is the backup of the first ever snapshot taken by the volume.
-     * @param isFirstSnapshotOfRootVolume true if this is the first snapshot of a root volume. Set the parent of the backup to null.
-     * @param isVolumeInactive         True if the volume belongs to a VM that is not running or is detached.
-     * @param secHostId                This is the Id of the secondary storage.
-     */
-    public BackupSnapshotCommand(String secondaryStoragePoolURL,
-                                 Long   dcId,
-                                 Long   accountId,
-                                 Long   volumeId,
-                                 Long   snapshotId,
-                                 Long   secHostId,
-                                 String volumePath,
-                                 StoragePool pool,
-                                 String snapshotUuid,
-                                 String snapshotName,
-                                 String prevSnapshotUuid,
-                                 String prevBackupUuid,
-                                 boolean isVolumeInactive,
-                                 String vmName,
-                                 int wait)
-    {
-        super(pool, secondaryStoragePoolURL, snapshotUuid, snapshotName, dcId, accountId, volumeId);
-        this.snapshotId = snapshotId;
-        this.prevSnapshotUuid = prevSnapshotUuid;
-        this.prevBackupUuid = prevBackupUuid;
-        this.isVolumeInactive = isVolumeInactive;
-        this.vmName = vmName;
-        this.secHostId = secHostId;
-        setVolumePath(volumePath);
-        setWait(wait);
-    }
-
-    public String getPrevSnapshotUuid() {
-        return prevSnapshotUuid;
-    }
-
-    public String getPrevBackupUuid() {
-        return prevBackupUuid;
-    }
-
-    public boolean isVolumeInactive() {
-        return isVolumeInactive;
-    }
-
-    public String getVmName() {
-        return vmName;
-    }
-
-    public SwiftTO getSwift() {
-        return swift;
-    }
-
-    public void setSwift(SwiftTO swift) {
-        this.swift = swift;
-    }
-
-    public S3TO getS3() {
-        return s3;
-    }
-
-    public void setS3(S3TO s3) {
-        this.s3 = s3;
-    }
-
-    public Long getSnapshotId() {
-        return snapshotId;
-    }
-
-    public Long getSecHostId() {
-        return secHostId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/BumpUpPriorityCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/BumpUpPriorityCommand.java b/api/src/com/cloud/agent/api/BumpUpPriorityCommand.java
deleted file mode 100644
index 5d3f10f..0000000
--- a/api/src/com/cloud/agent/api/BumpUpPriorityCommand.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.routing.NetworkElementCommand;
-
-public class BumpUpPriorityCommand extends NetworkElementCommand {
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-    public BumpUpPriorityCommand() {
-        super();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CancelCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CancelCommand.java b/api/src/com/cloud/agent/api/CancelCommand.java
deleted file mode 100644
index 0692055..0000000
--- a/api/src/com/cloud/agent/api/CancelCommand.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.agent.api;
-
-
-
-public class CancelCommand extends Command {
-    protected long sequence;
-    protected String reason;
-
-    protected CancelCommand() {
-    }
-
-    public CancelCommand(long sequence, String reason) {
-        this.sequence = sequence;
-        this.reason = reason;
-    }
-
-    public long getSequence() {
-        return sequence;
-    }
-
-    public String getReason() {
-        return reason;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ChangeAgentAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ChangeAgentAnswer.java b/api/src/com/cloud/agent/api/ChangeAgentAnswer.java
deleted file mode 100644
index 537eabe..0000000
--- a/api/src/com/cloud/agent/api/ChangeAgentAnswer.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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.agent.api;
-
-public class ChangeAgentAnswer extends Answer {
-	protected ChangeAgentAnswer() {
-	}
-
-	public ChangeAgentAnswer(ChangeAgentCommand cmd, boolean result) {
-		super(cmd, result, null);
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ChangeAgentCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ChangeAgentCommand.java b/api/src/com/cloud/agent/api/ChangeAgentCommand.java
deleted file mode 100644
index abdb60a..0000000
--- a/api/src/com/cloud/agent/api/ChangeAgentCommand.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.host.Status.Event;
-
-public class ChangeAgentCommand extends Command {
-	long agentId;
-	Event event;
-
-	protected ChangeAgentCommand() {
-	}
-
-	public ChangeAgentCommand(long agentId, Event event) {
-		this.agentId = agentId;
-		this.event = event;
-	}
-
-	public long getAgentId() {
-		return agentId;
-	}
-
-	public Event getEvent() {
-		return event;
-	}
-
-	@Override
-	public boolean executeInSequence() {
-		return false;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CheckHealthAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CheckHealthAnswer.java b/api/src/com/cloud/agent/api/CheckHealthAnswer.java
deleted file mode 100644
index f9f723a..0000000
--- a/api/src/com/cloud/agent/api/CheckHealthAnswer.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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.agent.api;
-
-public class CheckHealthAnswer extends Answer {
-
-    public CheckHealthAnswer() {}
-
-    public CheckHealthAnswer(CheckHealthCommand cmd, boolean alive) {
-        super(cmd, alive, "resource is " + (alive? "alive" : "not alive"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CheckHealthCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CheckHealthCommand.java b/api/src/com/cloud/agent/api/CheckHealthCommand.java
deleted file mode 100644
index ff42276..0000000
--- a/api/src/com/cloud/agent/api/CheckHealthCommand.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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.agent.api;
-
-public class CheckHealthCommand extends Command {
-
-    public CheckHealthCommand() {
-        setWait(50);
-    }
-
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CheckNetworkAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CheckNetworkAnswer.java b/api/src/com/cloud/agent/api/CheckNetworkAnswer.java
deleted file mode 100644
index 52825fd..0000000
--- a/api/src/com/cloud/agent/api/CheckNetworkAnswer.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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.agent.api;
-
-public class CheckNetworkAnswer extends Answer {
-    // indicate if agent reconnect is needed after setupNetworkNames command
-    private boolean _reconnect;
-    public CheckNetworkAnswer() {}
-
-
-    public CheckNetworkAnswer(CheckNetworkCommand cmd, boolean result, String details, boolean reconnect) {
-        super(cmd, result, details);
-        _reconnect = reconnect;
-    }
-
-    public CheckNetworkAnswer(CheckNetworkCommand cmd, boolean result, String details) {
-        this(cmd, result, details, false);
-    }
-
-    public boolean needReconnect() {
-        return _reconnect;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CheckNetworkCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CheckNetworkCommand.java b/api/src/com/cloud/agent/api/CheckNetworkCommand.java
deleted file mode 100644
index 8e1be56..0000000
--- a/api/src/com/cloud/agent/api/CheckNetworkCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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.agent.api;
-
-import java.util.List;
-
-import com.cloud.network.PhysicalNetworkSetupInfo;
-
-public class CheckNetworkCommand extends Command {
-
-    List<PhysicalNetworkSetupInfo> networkInfoList;
-
-    public CheckNetworkCommand(List<PhysicalNetworkSetupInfo> networkInfoList) {
-        this.networkInfoList = networkInfoList;
-    }
-
-    public List<PhysicalNetworkSetupInfo> getPhysicalNetworkInfoList() {
-        return networkInfoList;
-    }
-
-    protected CheckNetworkCommand() {
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CheckOnHostAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CheckOnHostAnswer.java b/api/src/com/cloud/agent/api/CheckOnHostAnswer.java
deleted file mode 100644
index e5325e3..0000000
--- a/api/src/com/cloud/agent/api/CheckOnHostAnswer.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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.agent.api;
-
-public class CheckOnHostAnswer extends Answer {
-    boolean determined;
-    boolean alive;
-
-    protected CheckOnHostAnswer() {
-    }
-
-    public CheckOnHostAnswer(CheckOnHostCommand cmd, Boolean alive, String details) {
-        super(cmd, true, details);
-        if (alive == null) {
-            determined = false;
-        } else {
-            determined = true;
-            this.alive = alive;
-        }
-    }
-
-    public CheckOnHostAnswer(CheckOnHostCommand cmd, String details) {
-        super(cmd, false, details);
-    }
-
-    public boolean isDetermined() {
-        return determined;
-    }
-
-    public boolean isAlive() {
-        return alive;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CheckOnHostCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CheckOnHostCommand.java b/api/src/com/cloud/agent/api/CheckOnHostCommand.java
deleted file mode 100644
index 596a532..0000000
--- a/api/src/com/cloud/agent/api/CheckOnHostCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.to.HostTO;
-import com.cloud.host.Host;
-
-public class CheckOnHostCommand extends Command {
-    HostTO host;
-
-    protected CheckOnHostCommand() {
-    }
-
-
-    public CheckOnHostCommand(Host host) {
-        this.host = new HostTO(host);
-        setWait(20);
-    }
-
-    public HostTO getHost() {
-        return host;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CheckRouterAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CheckRouterAnswer.java b/api/src/com/cloud/agent/api/CheckRouterAnswer.java
deleted file mode 100644
index da8189f..0000000
--- a/api/src/com/cloud/agent/api/CheckRouterAnswer.java
+++ /dev/null
@@ -1,81 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.network.router.VirtualRouter.RedundantState;
-
-public class CheckRouterAnswer extends Answer {
-    public static final String ROUTER_NAME = "router.name";
-    public static final String ROUTER_IP = "router.ip";
-    RedundantState state;
-    boolean isBumped;
-
-    protected CheckRouterAnswer() {
-    }
-
-    public CheckRouterAnswer(CheckRouterCommand cmd, String details, boolean parse) {
-        super(cmd, true, details);
-        if (parse) {
-            if (!parseDetails(details)) {
-                this.result = false;
-            }
-        }
-	}
-
-    public CheckRouterAnswer(CheckRouterCommand cmd, String details) {
-        super(cmd, false, details);
-    }
-
-    protected boolean parseDetails(String details) {
-        String[] lines = details.split("&");
-        if (lines.length != 2) {
-            return false;
-        }
-        if (lines[0].startsWith("Status: MASTER")) {
-            state = RedundantState.MASTER;
-        } else if (lines[0].startsWith("Status: BACKUP")) {
-            state = RedundantState.BACKUP;
-        } else if (lines[0].startsWith("Status: FAULT")) {
-            state = RedundantState.FAULT;
-        } else {
-            state = RedundantState.UNKNOWN;
-        }
-        if (lines[1].startsWith("Bumped: YES")) {
-            isBumped = true;
-        } else {
-            isBumped = false;
-        }
-        return true;
-    }
-
-    public void setState(RedundantState state) {
-        this.state = state;
-	}
-
-    public RedundantState getState() {
-        return state;
-	}
-
-    public boolean isBumped() {
-        return isBumped;
-    }
-
-    public void setIsBumped(boolean isBumped) {
-        this.isBumped = isBumped;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CheckRouterCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CheckRouterCommand.java b/api/src/com/cloud/agent/api/CheckRouterCommand.java
deleted file mode 100644
index 6215fc3..0000000
--- a/api/src/com/cloud/agent/api/CheckRouterCommand.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.routing.NetworkElementCommand;
-
-public class CheckRouterCommand extends NetworkElementCommand {
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-    public CheckRouterCommand() {
-        super();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java b/api/src/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java
deleted file mode 100644
index 0e9db96..0000000
--- a/api/src/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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.agent.api;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class CheckS2SVpnConnectionsAnswer extends Answer {
-    Map<String, Boolean> ipToConnected;
-    Map<String, String> ipToDetail;
-    String details;
-
-    protected CheckS2SVpnConnectionsAnswer() {
-        ipToConnected = new HashMap<String, Boolean>();
-        ipToDetail = new HashMap<String, String>();
-    }
-
-    public CheckS2SVpnConnectionsAnswer(CheckS2SVpnConnectionsCommand cmd, boolean result, String details) {
-        super(cmd, result, details);
-        ipToConnected = new HashMap<String, Boolean>();
-        ipToDetail = new HashMap<String, String>();
-        this.details = details;
-        if (result) {
-            parseDetails(details);
-        }
-    }
-
-    protected void parseDetails(String details) {
-        String[] lines = details.split("&");
-        for (String line : lines) {
-            String[] words = line.split(":");
-            if (words.length != 3) {
-                //Not something we can parse
-                return;
-            }
-            String ip = words[0];
-            boolean connected = words[1].equals("0");
-            String detail = words[2];
-            ipToConnected.put(ip, connected);
-            ipToDetail.put(ip, detail);
-        }
-    }
-
-    public boolean isConnected(String ip) {
-        if (this.getResult()) {
-            return ipToConnected.get(ip);
-        }
-        return false;
-    }
-
-    public String getDetail(String ip) {
-        if (this.getResult()) {
-            return ipToDetail.get(ip);
-        }
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java b/api/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java
deleted file mode 100644
index 9cfb53b..0000000
--- a/api/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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.agent.api;
-
-import java.util.List;
-
-import com.cloud.agent.api.routing.NetworkElementCommand;
-
-public class CheckS2SVpnConnectionsCommand extends NetworkElementCommand {
-    List<String> vpnIps;
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public CheckS2SVpnConnectionsCommand(List<String> vpnIps) {
-        super();
-        this.vpnIps = vpnIps;
-    }
-
-    public List<String> getVpnIps() {
-        return vpnIps;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CheckStateAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CheckStateAnswer.java b/api/src/com/cloud/agent/api/CheckStateAnswer.java
deleted file mode 100755
index bf8ae0f..0000000
--- a/api/src/com/cloud/agent/api/CheckStateAnswer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.vm.VirtualMachine.State;
-
-/**
- */
-public class CheckStateAnswer extends Answer {
-    State state;
-
-    public CheckStateAnswer() {}
-
-    public CheckStateAnswer(CheckStateCommand cmd, State state) {
-        this(cmd, state, null);
-    }
-
-    public CheckStateAnswer(CheckStateCommand cmd, String details) {
-        super(cmd, false, details);
-        this.state = null;
-    }
-
-    public CheckStateAnswer(CheckStateCommand cmd, State state, String details) {
-        super(cmd, true, details);
-        this.state = state;
-    }
-
-    public State getState() {
-        return state;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CheckStateCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CheckStateCommand.java b/api/src/com/cloud/agent/api/CheckStateCommand.java
deleted file mode 100755
index 89fc773..0000000
--- a/api/src/com/cloud/agent/api/CheckStateCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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.agent.api;
-
-/**
- *
- *
- */
-public class CheckStateCommand extends Command {
-    String vmName;
-
-    public CheckStateCommand() {}
-
-    public CheckStateCommand(String vmName) {
-        this.vmName = vmName;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public String getVmName() {
-        return vmName;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java b/api/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java
deleted file mode 100644
index 3f0ffdb..0000000
--- a/api/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java
+++ /dev/null
@@ -1,52 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.vm.VirtualMachine.State;
-
-public class CheckVirtualMachineAnswer extends Answer {
-
-    Integer vncPort;
-    State state;
-
-
-    protected CheckVirtualMachineAnswer() {
-    }
-
-    public CheckVirtualMachineAnswer(CheckVirtualMachineCommand cmd, State state, Integer vncPort, String detail) {
-        super(cmd, true, detail);
-        this.state = state;
-        this.vncPort = vncPort;
-    }
-
-    public CheckVirtualMachineAnswer(CheckVirtualMachineCommand cmd, State state, Integer vncPort) {
-        this(cmd, state, vncPort, null);
-    }
-
-    public CheckVirtualMachineAnswer(CheckVirtualMachineCommand cmd, String detail) {
-        super(cmd, false, detail);
-    }
-
-
-    public Integer getVncPort() {
-        return vncPort;
-    }
-
-    public State getState() {
-        return state;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CheckVirtualMachineCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CheckVirtualMachineCommand.java b/api/src/com/cloud/agent/api/CheckVirtualMachineCommand.java
deleted file mode 100644
index 62f4420..0000000
--- a/api/src/com/cloud/agent/api/CheckVirtualMachineCommand.java
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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.agent.api;
-
-public class CheckVirtualMachineCommand extends Command {
-
-    private String vmName;
-
-    protected CheckVirtualMachineCommand() {
-
-    }
-
-    public CheckVirtualMachineCommand(String vmName) {
-        this.vmName = vmName;
-        setWait(20);
-    }
-
-    public String getVmName() {
-        return vmName;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java b/api/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java
deleted file mode 100644
index 8b5172d..0000000
--- a/api/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java
+++ /dev/null
@@ -1,47 +0,0 @@
-// 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.agent.api;
-
-
-public class CleanupNetworkRulesCmd extends Command implements CronCommand {
-
-    private int interval = 10*60;
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-
-
-
-    public CleanupNetworkRulesCmd(int intervalSecs) {
-        super();
-        interval = intervalSecs;
-    }
-
-    public CleanupNetworkRulesCmd() {
-
-    }
-
-
-    @Override
-    public int getInterval() {
-        return interval;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CleanupSnapshotBackupCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CleanupSnapshotBackupCommand.java b/api/src/com/cloud/agent/api/CleanupSnapshotBackupCommand.java
deleted file mode 100644
index ae65a52..0000000
--- a/api/src/com/cloud/agent/api/CleanupSnapshotBackupCommand.java
+++ /dev/null
@@ -1,75 +0,0 @@
-// 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.agent.api;
-
-import java.util.List;
-
-public class CleanupSnapshotBackupCommand extends Command {
-        private String secondaryStoragePoolURL;
-        private Long   dcId;
-        private Long   accountId;
-        private Long   volumeId;
-        private List<String> validBackupUUIDs;
-
-    protected CleanupSnapshotBackupCommand() {
-
-    }
-
-     /*
-     * @param secondaryStoragePoolURL    This is what shows up in the UI when you click on Secondary storage.
-     *                                    In the code, it is present as: In the vmops.host_details table, there is a field mount.parent. This is the value of that field
-     *                                    If you have better ideas on how to get it, you are welcome.
-     * @param validBackupUUID             The VHD which are valid
-     */
-    public CleanupSnapshotBackupCommand(String secondaryStoragePoolURL,
-                                       Long   dcId,
-                                       Long   accountId,
-                                       Long   volumeId,
-                                       List<String> validBackupUUIDs)
-    {
-        this.secondaryStoragePoolURL = secondaryStoragePoolURL;
-        this.dcId = dcId;
-        this.accountId = accountId;
-        this.volumeId = volumeId;
-        this.validBackupUUIDs = validBackupUUIDs;
-    }
-
-    public String getSecondaryStoragePoolURL() {
-        return secondaryStoragePoolURL;
-    }
-
-    public Long getDcId() {
-        return dcId;
-    }
-
-    public Long getAccountId() {
-        return accountId;
-    }
-
-    public Long getVolumeId() {
-        return volumeId;
-    }
-
-    public List<String> getValidBackupUUIDs() {
-        return validBackupUUIDs;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ClusterSyncAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ClusterSyncAnswer.java b/api/src/com/cloud/agent/api/ClusterSyncAnswer.java
deleted file mode 100644
index 99fee2a..0000000
--- a/api/src/com/cloud/agent/api/ClusterSyncAnswer.java
+++ /dev/null
@@ -1,55 +0,0 @@
-// 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.agent.api;
-
-import java.util.HashMap;
-
-import com.cloud.utils.Pair;
-import com.cloud.vm.VirtualMachine.State;
-
-public class ClusterSyncAnswer extends Answer {
-    private long _clusterId;
-    private HashMap<String, Pair<String, State>> _newStates;
-    private boolean _isExecuted=false;
-
-    // this is here because a cron command answer is being sent twice
-    //  AgentAttache.processAnswers
-    //  AgentManagerImpl.notifyAnswersToMonitors
-    public boolean isExceuted(){
-        return _isExecuted;
-    }
-
-    public void setExecuted(){
-        _isExecuted = true;
-    }
-
-
-    public ClusterSyncAnswer(long clusterId, HashMap<String, Pair<String, State>> newStates){
-        _clusterId = clusterId;
-        _newStates = newStates;
-        result = true;
-    }
-
-    public long getClusterId() {
-        return _clusterId;
-    }
-
-    public HashMap<String, Pair<String, State>> getNewStates() {
-        return _newStates;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ClusterSyncCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ClusterSyncCommand.java b/api/src/com/cloud/agent/api/ClusterSyncCommand.java
deleted file mode 100644
index 17dbbd8..0000000
--- a/api/src/com/cloud/agent/api/ClusterSyncCommand.java
+++ /dev/null
@@ -1,47 +0,0 @@
-// 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.agent.api;
-
-
-public class ClusterSyncCommand extends Command implements CronCommand {
-    int _interval;
-
-    long _clusterId;
-
-    public ClusterSyncCommand() {
-    }
-
-    public ClusterSyncCommand(int interval, long clusterId){
-        _interval = interval;
-        _clusterId = clusterId;
-    }
-
-    @Override
-    public int getInterval() {
-        return _interval;
-    }
-
-    public long getClusterId() {
-        return _clusterId;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ComputeChecksumCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ComputeChecksumCommand.java b/api/src/com/cloud/agent/api/ComputeChecksumCommand.java
deleted file mode 100755
index a2c88c4..0000000
--- a/api/src/com/cloud/agent/api/ComputeChecksumCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.storage.ssCommand;
-
-
-public class ComputeChecksumCommand extends ssCommand {
-
-
-    private String templatePath;
-    public ComputeChecksumCommand() {
-        super();
-    }
-
-    public ComputeChecksumCommand(String secUrl, String templatePath) {
-        super(secUrl);
-        this.templatePath = templatePath;
-    }
-
-    public String getTemplatePath() {
-        return templatePath;
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java b/api/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java
deleted file mode 100644
index 9f50a2f..0000000
--- a/api/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java
+++ /dev/null
@@ -1,88 +0,0 @@
-// 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.agent.api;
-
-public class ConsoleAccessAuthenticationAnswer extends AgentControlAnswer {
-
-	private boolean _success;
-
-	private boolean _isReauthenticating;
-	private String _host;
-	private int _port;
-
-	private String _tunnelUrl;
-	private String _tunnelSession;
-
-	public ConsoleAccessAuthenticationAnswer() {
-		_success = false;
-		_isReauthenticating = false;
-		_port = 0;
-	}
-
-	public ConsoleAccessAuthenticationAnswer(Command cmd, boolean success) {
-		super(cmd);
-		_success = success;
-	}
-
-	public boolean succeeded() {
-		return _success;
-	}
-
-	public void setSuccess(boolean value) {
-		_success = value;
-	}
-
-	public boolean isReauthenticating() {
-		return _isReauthenticating;
-	}
-
-	public void setReauthenticating(boolean value) {
-		_isReauthenticating = value;
-	}
-
-	public String getHost() {
-		return _host;
-	}
-
-	public void setHost(String host) {
-		_host = host;
-	}
-
-	public int getPort() {
-		return _port;
-	}
-
-	public void setPort(int port) {
-		_port = port;
-	}
-
-	public String getTunnelUrl() {
-		return _tunnelUrl;
-	}
-
-	public void setTunnelUrl(String tunnelUrl) {
-		_tunnelUrl = tunnelUrl;
-	}
-
-	public String getTunnelSession() {
-		return _tunnelSession;
-	}
-
-	public void setTunnelSession(String tunnelSession) {
-		_tunnelSession = tunnelSession;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java b/api/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java
deleted file mode 100644
index bd8093c..0000000
--- a/api/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java
+++ /dev/null
@@ -1,68 +0,0 @@
-// 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.agent.api;
-
-public class ConsoleAccessAuthenticationCommand extends AgentControlCommand {
-
-	private String _host;
-	private String _port;
-	private String _vmId;
-	private String _sid;
-	private String _ticket;
-
-	private boolean _isReauthenticating;
-
-	public ConsoleAccessAuthenticationCommand() {
-		_isReauthenticating = false;
-	}
-
-	public ConsoleAccessAuthenticationCommand(String host, String port, String vmId, String sid, String ticket) {
-		_host = host;
-		_port = port;
-		_vmId = vmId;
-		_sid = sid;
-		_ticket = ticket;
-	}
-
-	public String getHost() {
-		return _host;
-	}
-
-	public String getPort() {
-		return _port;
-	}
-
-	public String getVmId() {
-		return _vmId;
-	}
-
-	public String getSid() {
-		return _sid;
-	}
-
-	public String getTicket() {
-		return _ticket;
-	}
-
-	public boolean isReauthenticating() {
-		return _isReauthenticating;
-	}
-
-	public void setReauthenticating(boolean value) {
-		_isReauthenticating = value;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java b/api/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java
deleted file mode 100644
index ebb06b6..0000000
--- a/api/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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.agent.api;
-
-public class ConsoleProxyLoadReportCommand extends AgentControlCommand {
-
-	private long _proxyVmId;
-	private String _loadInfo;
-
-	public ConsoleProxyLoadReportCommand() {
-	}
-
-	public ConsoleProxyLoadReportCommand(long proxyVmId, String loadInfo) {
-		_proxyVmId = proxyVmId;
-		_loadInfo = loadInfo;
-	}
-
-	public long getProxyVmId() {
-		return _proxyVmId;
-	}
-
-	public String getLoadInfo() {
-		return _loadInfo;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java b/api/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java
deleted file mode 100644
index 9e2680e..0000000
--- a/api/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java
+++ /dev/null
@@ -1,82 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.storage.StoragePool;
-
-/**
- * This currently assumes that both primary and secondary storage are mounted on the XenServer.
- */
-public class CreatePrivateTemplateFromSnapshotCommand extends SnapshotCommand {
-    private String origTemplateInstallPath;
-    private Long   newTemplateId;
-    private String templateName;
-
-    protected CreatePrivateTemplateFromSnapshotCommand() {
-
-    }
-
-    /**
-     * Given the UUID of a backed up snapshot VHD file on the secondary storage, the execute of this command does
-     * 1) Get the parent chain of this VHD all the way up to the root, say VHDList
-     * 2) Copy all the files in the VHDlist to some temp location
-     * 3) Coalesce all the VHDs to one VHD which contains all the data of the volume. This invokes the DeletePreviousBackupCommand for each VHD
-     * 4) Rename the UUID of this VHD
-     * @param secondaryStoragePoolURL  This is what shows up in the UI when you click on Secondary storage.
-     *                                 In the code, it is present as: In the vmops.host_details table, there is a field mount.parent. This is the value of that field
-     *                                 If you have better ideas on how to get it, you are welcome.
-     *                                 It may not be the UUID of the base copy of the snapshot, if no data was written since last snapshot.
-     * @param origTemplateInstallPath  The install path of the original template VHD on the secondary
-     */
-
-    public CreatePrivateTemplateFromSnapshotCommand(StoragePool pool,
-                                                    String secondaryStoragePoolURL,
-                                                    Long   dcId,
-                                                    Long   accountId,
-                                                    Long   volumeId,
-                                                    String backedUpSnapshotUuid,
-                                                    String backedUpSnapshotName,
-                                                    String origTemplateInstallPath,
-                                                    Long   newTemplateId,
-                                                    String templateName,
-                                                    int wait)
-    {
-        super(pool, secondaryStoragePoolURL, backedUpSnapshotUuid, backedUpSnapshotName, dcId, accountId, volumeId);
-        this.origTemplateInstallPath = origTemplateInstallPath;
-        this.newTemplateId = newTemplateId;
-        this.templateName = templateName;
-        setWait(wait);
-    }
-
-    /**
-     * @return the origTemplateInstallPath
-     */
-    public String getOrigTemplateInstallPath() {
-        return origTemplateInstallPath;
-    }
-
-    public Long getNewTemplateId() {
-        return newTemplateId;
-    }
-
-    /**
-     * @return templateName
-     */
-    public String getTemplateName() {
-        return templateName;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java b/api/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java
deleted file mode 100644
index 4e0bf32..0000000
--- a/api/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java
+++ /dev/null
@@ -1,93 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.storage.StoragePool;
-
-public class CreatePrivateTemplateFromVolumeCommand extends SnapshotCommand {
-    private String _vmName;
-    private String _volumePath;
-    private String _userSpecifiedName;
-    private String _uniqueName;
-    private long _templateId;
-    private long _accountId;
-    StorageFilerTO _primaryPool;
-    // For XenServer
-    private String _secondaryStorageUrl;
-
-    public CreatePrivateTemplateFromVolumeCommand() {
-    }
-
-    public CreatePrivateTemplateFromVolumeCommand(StoragePool pool, String secondaryStorageUrl, long templateId, long accountId, String userSpecifiedName, String uniqueName, String volumePath, String vmName, int wait) {
-        _secondaryStorageUrl = secondaryStorageUrl;
-        _templateId = templateId;
-        _accountId = accountId;
-        _userSpecifiedName = userSpecifiedName;
-        _uniqueName = uniqueName;
-        _volumePath = volumePath;
-        _vmName = vmName;
-        primaryStoragePoolNameLabel = pool.getUuid();
-        _primaryPool = new StorageFilerTO(pool);
-        setWait(wait);
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-    public StorageFilerTO getPool() {
-        return _primaryPool;
-    }
-
-    public String getSecondaryStorageUrl() {
-        return _secondaryStorageUrl;
-    }
-
-    public String getTemplateName() {
-        return _userSpecifiedName;
-    }
-
-    public String getUniqueName() {
-        return _uniqueName;
-    }
-
-    public long getTemplateId() {
-        return _templateId;
-    }
-
-    public String getVmName() {
-        return _vmName;
-    }
-
-    public void setVolumePath(String _volumePath) {
-        this._volumePath = _volumePath;
-    }
-
-    public String getVolumePath() {
-        return _volumePath;
-    }
-
-    public Long getAccountId() {
-        return _accountId;
-    }
-
-    public void setTemplateId(long templateId) {
-        _templateId = templateId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CreateStoragePoolCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CreateStoragePoolCommand.java b/api/src/com/cloud/agent/api/CreateStoragePoolCommand.java
deleted file mode 100644
index 7a4d768..0000000
--- a/api/src/com/cloud/agent/api/CreateStoragePoolCommand.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.storage.StoragePool;
-
-public class CreateStoragePoolCommand extends ModifyStoragePoolCommand {
-
-
-	public CreateStoragePoolCommand() {
-	}
-
-    public CreateStoragePoolCommand(boolean add, StoragePool pool) {
-        super(add, pool);
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java b/api/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java
deleted file mode 100644
index f9fb164..0000000
--- a/api/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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.agent.api;
-
-import java.util.List;
-
-import com.cloud.agent.api.to.VolumeTO;
-
-public class CreateVMSnapshotAnswer extends Answer {
-
-    private List<VolumeTO> volumeTOs;
-    private VMSnapshotTO vmSnapshotTo;
-    
- 
-	public List<VolumeTO> getVolumeTOs() {
-        return volumeTOs;
-    }
-
-    public void setVolumeTOs(List<VolumeTO> volumeTOs) {
-        this.volumeTOs = volumeTOs;
-    }
-
-    public VMSnapshotTO getVmSnapshotTo() {
-        return vmSnapshotTo;
-    }
-
-    public void setVmSnapshotTo(VMSnapshotTO vmSnapshotTo) {
-        this.vmSnapshotTo = vmSnapshotTo;
-    }
-
-    public CreateVMSnapshotAnswer() {
-
-    }
-
-    public CreateVMSnapshotAnswer(CreateVMSnapshotCommand cmd, boolean success,
-            String result) {
-        super(cmd, success, result);
-    }
-
-    public CreateVMSnapshotAnswer(CreateVMSnapshotCommand cmd,
-    		VMSnapshotTO vmSnapshotTo, List<VolumeTO> volumeTOs) {
-        super(cmd, true, "");
-        this.vmSnapshotTo = vmSnapshotTo;
-        this.volumeTOs = volumeTOs;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java b/api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
deleted file mode 100644
index 478987d..0000000
--- a/api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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.agent.api;
-
-import java.util.List;
-
-import com.cloud.agent.api.to.VolumeTO;
-import com.cloud.vm.VirtualMachine;
-
-public class CreateVMSnapshotCommand extends VMSnapshotBaseCommand {
-
-    public CreateVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType, VirtualMachine.State vmState) {
-        super(vmName, snapshot, volumeTOs, guestOSType);
-        this.vmState  = vmState;
-    }
-
-    private VirtualMachine.State vmState;
-   
-
-    public VirtualMachine.State getVmState() {
-        return vmState;
-    }
-
-    public void setVmState(VirtualMachine.State vmState) {
-        this.vmState = vmState;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java b/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java
deleted file mode 100644
index 2f7cd94..0000000
--- a/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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.agent.api;
-
-
-public class CreateVolumeFromSnapshotAnswer extends Answer {
-    private String vdiUUID;
-
-    protected CreateVolumeFromSnapshotAnswer() {
-
-    }
-
-    public CreateVolumeFromSnapshotAnswer(CreateVolumeFromSnapshotCommand cmd, boolean success, String result, String vdiUUID) {
-        super(cmd, success, result);
-        this.vdiUUID = vdiUUID;
-    }
-
-    /**
-     * @return the vdi
-     */
-    public String getVdi() {
-        return vdiUUID;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java b/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
deleted file mode 100644
index fbf6121..0000000
--- a/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
+++ /dev/null
@@ -1,58 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.storage.StoragePool;
-
-
-/**
- * This currently assumes that both primary and secondary storage are mounted on the XenServer.
- */
-public class CreateVolumeFromSnapshotCommand extends SnapshotCommand {
-
-    protected CreateVolumeFromSnapshotCommand() {
-
-    }
-
-    /**
-     * Given the UUID of a backed up snapshot VHD file on the secondary storage, the execute of this command does
-     * 1) Get the parent chain of this VHD all the way up to the root, say VHDList
-     * 2) Copy all the files in the VHDlist to some temp location
-     * 3) Coalesce all the VHDs to one VHD which contains all the data of the volume. This invokes the DeletePreviousBackupCommand for each VHD
-     * 4) Rename the UUID of this VHD
-     * 5) Move this VHD to primary storage
-     * @param primaryStoragePoolNameLabel   The primary storage Pool
-     * @param secondaryStoragePoolURL This is what shows up in the UI when you click on Secondary storage.
-     *                                 In the code, it is present as: In the vmops.host_details table, there is a field mount.parent. This is the value of that field
-     *                                 If you have better ideas on how to get it, you are welcome.
-     *                                 It may not be the UUID of the base copy of the snapshot, if no data was written since last snapshot.
-     * @param templatePath             The install path of the template VHD on the secondary, if this a root volume
-     */
-
-    public CreateVolumeFromSnapshotCommand(StoragePool pool,
-                                           String secondaryStoragePoolURL,
-                                           Long   dcId,
-                                           Long   accountId,
-                                           Long   volumeId,
-                                           String backedUpSnapshotUuid,
-                                           String backedUpSnapshotName,
-                                           int wait)
-    {
-        super(pool, secondaryStoragePoolURL, backedUpSnapshotUuid, backedUpSnapshotName, dcId, accountId, volumeId);
-        setWait(wait);
-    }
-}


[45/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/Site2SiteVpnCfgCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/Site2SiteVpnCfgCommand.java b/api/src/com/cloud/agent/api/routing/Site2SiteVpnCfgCommand.java
deleted file mode 100644
index 8316303..0000000
--- a/api/src/com/cloud/agent/api/routing/Site2SiteVpnCfgCommand.java
+++ /dev/null
@@ -1,154 +0,0 @@
-// 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.agent.api.routing;
-
-public class Site2SiteVpnCfgCommand extends NetworkElementCommand {
-
-    private boolean create;
-    private String localPublicIp;
-    private String localGuestCidr;
-    private String localPublicGateway;
-    private String peerGatewayIp;
-    private String peerGuestCidrList;
-    private String ipsecPsk;
-    private String ikePolicy;
-    private String espPolicy;
-    private long ikeLifetime;
-    private long espLifetime;
-    private boolean dpd;
-
-	@Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public Site2SiteVpnCfgCommand () {
-        this.create = false;
-    }
-
-    public Site2SiteVpnCfgCommand (boolean create, String localPublicIp, String localPublicGateway, String localGuestCidr, String peerGatewayIp,
-            String peerGuestCidrList, String ikePolicy, String espPolicy, String ipsecPsk, Long ikeLifetime, Long espLifetime, Boolean dpd) {
-        this.create = create;
-        this.setLocalPublicIp(localPublicIp);
-        this.setLocalPublicGateway(localPublicGateway);
-        this.setLocalGuestCidr(localGuestCidr);
-        this.setPeerGatewayIp(peerGatewayIp);
-        this.setPeerGuestCidrList(peerGuestCidrList);
-        this.ipsecPsk = ipsecPsk;
-        this.ikePolicy = ikePolicy;
-        this.espPolicy = espPolicy;
-        this.ikeLifetime = ikeLifetime;
-        this.espLifetime = espLifetime;
-        this.dpd = dpd;
-    }
-
-    public boolean isCreate() {
-        return create;
-    }
-
-    public void setCreate(boolean create) {
-        this.create = create;
-    }
-
-    public String getIpsecPsk() {
-        return ipsecPsk;
-    }
-
-    public void setIpsecPsk(String ipsecPsk) {
-        this.ipsecPsk = ipsecPsk;
-    }
-
-    public String getIkePolicy() {
-        return ikePolicy;
-    }
-
-    public void setIkePolicy(String ikePolicy) {
-        this.ikePolicy = ikePolicy;
-    }
-
-    public String getEspPolicy() {
-        return espPolicy;
-    }
-
-    public void setEspPolicy(String espPolicy) {
-        this.espPolicy = espPolicy;
-    }
-
-    public long getIkeLifetime() {
-        return ikeLifetime;
-    }
-
-    public void setikeLifetime(long ikeLifetime) {
-        this.ikeLifetime = ikeLifetime;
-    }
-
-    public long getEspLifetime() {
-        return espLifetime;
-    }
-
-    public void setEspLifetime(long espLifetime) {
-        this.espLifetime = espLifetime;
-    }
-
-    public Boolean getDpd() {
-        return dpd;
-    }
-
-    public void setDpd(Boolean dpd) {
-        this.dpd = dpd;
-    }
-
-    public String getLocalPublicIp() {
-        return localPublicIp;
-    }
-
-    public void setLocalPublicIp(String localPublicIp) {
-        this.localPublicIp = localPublicIp;
-    }
-
-    public String getLocalGuestCidr() {
-        return localGuestCidr;
-    }
-
-    public void setLocalGuestCidr(String localGuestCidr) {
-        this.localGuestCidr = localGuestCidr;
-    }
-
-    public String getLocalPublicGateway() {
-        return localPublicGateway;
-    }
-
-    public void setLocalPublicGateway(String localPublicGateway) {
-        this.localPublicGateway = localPublicGateway;
-    }
-
-    public String getPeerGatewayIp() {
-        return peerGatewayIp;
-    }
-
-    public void setPeerGatewayIp(String peerGatewayIp) {
-        this.peerGatewayIp = peerGatewayIp;
-    }
-
-    public String getPeerGuestCidrList() {
-        return peerGuestCidrList;
-    }
-
-    public void setPeerGuestCidrList(String peerGuestCidrList) {
-        this.peerGuestCidrList = peerGuestCidrList;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/SiteLoadBalancerConfig.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/SiteLoadBalancerConfig.java b/api/src/com/cloud/agent/api/routing/SiteLoadBalancerConfig.java
deleted file mode 100644
index cca5de8..0000000
--- a/api/src/com/cloud/agent/api/routing/SiteLoadBalancerConfig.java
+++ /dev/null
@@ -1,121 +0,0 @@
-// 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.agent.api.routing;
-
-// details of site participating in the GLSB service, represents configuration load balancer rule and the zone
-// in which the rule is configured
-public class SiteLoadBalancerConfig {
-
-    // true if the site details are local to the zone receiving 'GlobalLoadBalancerConfigCommand'
-    boolean local;
-
-    // true if the site needs to be removed from GSLB service
-    boolean revoked;
-
-    // service type of the 'site load balanced' service
-    String serviceType;
-
-    // public IP corresponding to the site load balanced service
-    String servicePublicIp;
-
-    // port corresponding to the site load balanced service
-    String servicePort;
-
-    // Private IP corresponding to the GSLB service provider in the site.
-    String gslbProviderPrivateIp;
-
-    // Public IP corresponding to the GSLB service provider in the site.
-    String gslbProviderPublicIp;
-
-    // zone id in which site is located
-    long dataCenterId;
-
-    public SiteLoadBalancerConfig(boolean revoked, String serviceType, String servicePublicIp, String servicePort,
-                                  long dataCenterId) {
-        this.revoked = revoked;
-        this.serviceType = serviceType;
-        this.servicePublicIp = servicePublicIp;
-        this.servicePort = servicePort;
-        this.dataCenterId = dataCenterId;
-    }
-
-    public SiteLoadBalancerConfig(String gslbProviderPublicIP, String gslbProviderPrivateIp, boolean local,
-                                  boolean revoked, String serviceType, String servicePublicIp, String port,
-                                  long dataCenterId) {
-        this(revoked, serviceType, servicePublicIp, port, dataCenterId);
-        this.gslbProviderPrivateIp = gslbProviderPrivateIp;
-        this.gslbProviderPublicIp = gslbProviderPublicIP;
-        this.local = local;
-    }
-
-    public String getServiceType() {
-        return  serviceType;
-    }
-
-    public void setServiceType(String serviceType) {
-        this.serviceType = serviceType;
-    }
-
-    public String getServicePublicIp() {
-        return servicePublicIp;
-    }
-
-    public void SetServicePublicIp(String servicePublicIp) {
-        this.servicePublicIp = servicePublicIp;
-    }
-
-    public String getServicePort() {
-        return servicePort;
-    }
-
-    public void setServicePort(String port) {
-        this.servicePort = port;
-    }
-
-    public String getGslbProviderPrivateIp() {
-        return gslbProviderPrivateIp;
-    }
-
-    public void setGslbProviderPrivateIp(String privateIp) {
-        this.gslbProviderPrivateIp = privateIp;
-    }
-
-    public String getGslbProviderPublicIp() {
-        return gslbProviderPublicIp;
-    }
-
-    public long getDataCenterId() {
-        return  dataCenterId;
-    }
-
-    public void setGslbProviderPublicIp(String publicIp) {
-        this.gslbProviderPublicIp = publicIp;
-    }
-
-    public boolean isLocal() {
-        return local;
-    }
-
-    public void setLocal(boolean local) {
-        this.local = local;
-    }
-
-    public boolean forRevoke() {
-        return revoked;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/UserDataCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/UserDataCommand.java b/api/src/com/cloud/agent/api/routing/UserDataCommand.java
deleted file mode 100644
index f7b38c8..0000000
--- a/api/src/com/cloud/agent/api/routing/UserDataCommand.java
+++ /dev/null
@@ -1,63 +0,0 @@
-// 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.agent.api.routing;
-
-
-public class UserDataCommand extends NetworkElementCommand {
-
-    String userData;
-    String vmIpAddress;
-    String routerPrivateIpAddress;
-    String vmName;
-
-    protected UserDataCommand() {
-
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public UserDataCommand(String userData, String vmIpAddress, String routerPrivateIpAddress, String vmName) {
-        this.userData = userData;
-        this.vmIpAddress = vmIpAddress;
-        this.routerPrivateIpAddress = routerPrivateIpAddress;
-        this.vmName = vmName;
-    }
-
-	public String getRouterPrivateIpAddress() {
-		return routerPrivateIpAddress;
-	}
-
-	public String getVmIpAddress() {
-		return vmIpAddress;
-	}
-
-	public String getVmName() {
-		return vmName;
-	}
-
-	public String getUserData() {
-		return userData;
-	}
-
-	public void setUserData(String userData) {
-		this.userData = userData;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/VmDataCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/VmDataCommand.java b/api/src/com/cloud/agent/api/routing/VmDataCommand.java
deleted file mode 100644
index df88255..0000000
--- a/api/src/com/cloud/agent/api/routing/VmDataCommand.java
+++ /dev/null
@@ -1,67 +0,0 @@
-// 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.agent.api.routing;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.cloud.agent.api.LogLevel;
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-
-public class VmDataCommand extends NetworkElementCommand {
-
-	String vmIpAddress;
-	String vmName;
-	@LogLevel(Log4jLevel.Trace)
-	List<String[]> vmData;
-
-    protected VmDataCommand() {
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public VmDataCommand(String vmIpAddress) {
-    	this(vmIpAddress, null);
-    }
-
-    public String getVmName() {
-        return vmName;
-    }
-
-    public VmDataCommand(String vmIpAddress, String vmName) {
-        this.vmName = vmName;
-        this.vmIpAddress = vmIpAddress;
-        this.vmData = new ArrayList<String[]>();
-    }
-
-
-	public String getVmIpAddress() {
-		return vmIpAddress;
-	}
-
-	public List<String[]> getVmData() {
-		return vmData;
-	}
-
-	public void addVmData(String folder, String file, String contents) {
-		vmData.add(new String[]{folder, file, contents});
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java b/api/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java
deleted file mode 100644
index ebe725d..0000000
--- a/api/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java
+++ /dev/null
@@ -1,94 +0,0 @@
-// 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.agent.api.routing;
-import java.util.List;
-
-import com.cloud.agent.api.LogLevel;
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-import com.cloud.network.VpnUser;
-
-
-public class VpnUsersCfgCommand extends NetworkElementCommand {
-	public static class UsernamePassword{
-		private String username;
-	    @LogLevel(Log4jLevel.Off)
-		private String password;
-		boolean add = true;
-
-		public boolean isAdd() {
-			return add;
-		}
-		public void setAdd(boolean add) {
-			this.add = add;
-		}
-		public String getUsername() {
-			return username;
-		}
-		public void setUsername(String username) {
-			this.username = username;
-		}
-		public String getPassword() {
-			return password;
-		}
-		public void setPassword(String password) {
-			this.password = password;
-		}
-		public UsernamePassword(String username, String password) {
-			super();
-			this.username = username;
-			this.password = password;
-		}
-		public UsernamePassword(String username, String password, boolean add) {
-			super();
-			this.username = username;
-			this.password = password;
-			this.add = add;
-		}
-		protected UsernamePassword() {
-			//for Gson
-		}
-		public String getUsernamePassword() {
-			return getUsername() + "," + getPassword();
-		}
-	}
-	UsernamePassword [] userpwds;
-
-    protected VpnUsersCfgCommand() {
-
-    }
-
-    public VpnUsersCfgCommand(List<VpnUser> addUsers, List<VpnUser> removeUsers) {
-    	userpwds = new UsernamePassword[addUsers.size() + removeUsers.size()];
-    	int i = 0;
-    	for (VpnUser vpnUser: removeUsers) {
-    		userpwds[i++] = new UsernamePassword(vpnUser.getUsername(), vpnUser.getPassword(), false);
-    	}
-    	for (VpnUser vpnUser: addUsers) {
-    		userpwds[i++] = new UsernamePassword(vpnUser.getUsername(), vpnUser.getPassword(), true);
-    	}
-    }
-
-	@Override
-	public boolean executeInSequence() {
-		return true;
-	}
-
-	public UsernamePassword[] getUserpwds() {
-		return userpwds;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java b/api/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java
deleted file mode 100644
index 04b3d43..0000000
--- a/api/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java
+++ /dev/null
@@ -1,78 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.storage.Storage.ImageFormat;
-
-public abstract class AbstractDownloadCommand extends ssCommand {
-
-    private String url;
-    private ImageFormat format;
-    private long accountId;
-    private String name;
-
-    protected AbstractDownloadCommand() {
-    }
-
-    protected AbstractDownloadCommand(String name, String url, ImageFormat format, long accountId) {
-    	assert(url != null);
-    	url = url.replace('\\', '/');
-
-        this.url = url;
-        this.format = format;
-        this.accountId = accountId;
-        this.name = name;
-    }
-
-    protected AbstractDownloadCommand(AbstractDownloadCommand that) {
-        super(that);
-        assert(that.url != null);
-
-        this.url = that.url.replace('\\', '/');
-        this.format = that.format;
-        this.accountId = that.accountId;
-        this.name = that.name;
-    }
-
-    public String getUrl() {
-        return url;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public ImageFormat getFormat() {
-        return format;
-    }
-
-    public long getAccountId() {
-        return accountId;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-	public void setUrl(String url) {
-		assert(url != null);
-		url = url.replace('\\', '/');
-		this.url = url;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/AbstractUploadCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/AbstractUploadCommand.java b/api/src/com/cloud/agent/api/storage/AbstractUploadCommand.java
deleted file mode 100644
index 49c04b1..0000000
--- a/api/src/com/cloud/agent/api/storage/AbstractUploadCommand.java
+++ /dev/null
@@ -1,68 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.storage.Storage.ImageFormat;
-
-public class AbstractUploadCommand  extends StorageCommand{
-
-
-    private String url;
-    private ImageFormat format;
-    private long accountId;
-    private String name;
-
-    protected AbstractUploadCommand() {
-    }
-
-    protected AbstractUploadCommand(String name, String url, ImageFormat format, long accountId) {
-        this.url = url;
-        this.format = format;
-        this.accountId = accountId;
-        this.name = name;
-    }
-
-    protected AbstractUploadCommand(AbstractUploadCommand that) {
-        this(that.name, that.url, that.format, that.accountId);
-    }
-
-    public String getUrl() {
-        return url;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public ImageFormat getFormat() {
-        return format;
-    }
-
-    public long getAccountId() {
-        return accountId;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-	public void setUrl(String url) {
-		this.url = url;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java b/api/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java
deleted file mode 100644
index 8c55ac3..0000000
--- a/api/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-
-public class CopyVolumeAnswer extends Answer {
-	private String volumeFolder;
-	private String volumePath;
-
-	protected CopyVolumeAnswer() {
-    }
-
-	public CopyVolumeAnswer(Command command, boolean success, String details, String volumeFolder, String volumePath) {
-		super(command, success, details);
-		this.volumeFolder = volumeFolder;
-		this.volumePath = volumePath;
-	}
-
-	public String getVolumeFolder() {
-		return volumeFolder;
-	}
-
-	public String getVolumePath() {
-		return volumePath;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/CopyVolumeCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/CopyVolumeCommand.java b/api/src/com/cloud/agent/api/storage/CopyVolumeCommand.java
deleted file mode 100644
index 3d05e9b..0000000
--- a/api/src/com/cloud/agent/api/storage/CopyVolumeCommand.java
+++ /dev/null
@@ -1,72 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Command;
-import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.storage.StoragePool;
-
-public class CopyVolumeCommand extends Command {
-
-	long volumeId;
-	String volumePath;
-	StorageFilerTO pool;
-	String secondaryStorageURL;
-	boolean toSecondaryStorage;
-	String vmName;
-
-	public CopyVolumeCommand() {
-	}
-
-	public CopyVolumeCommand(long volumeId, String volumePath, StoragePool pool, String secondaryStorageURL, boolean toSecondaryStorage, int wait) {
-		this.volumeId = volumeId;
-		this.volumePath = volumePath;
-		this.pool = new StorageFilerTO(pool);
-		this.secondaryStorageURL = secondaryStorageURL;
-		this.toSecondaryStorage = toSecondaryStorage;
-		setWait(wait);
-	}
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-	public String getVolumePath() {
-		return volumePath;
-	}
-
-	public long getVolumeId() {
-		return volumeId;
-	}
-
-	public StorageFilerTO getPool() {
-		return pool;
-	}
-
-	public String getSecondaryStorageURL() {
-		return secondaryStorageURL;
-	}
-
-	public boolean toSecondaryStorage() {
-		return toSecondaryStorage;
-	}
-
-	public String getVmName() {
-		return vmName;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/CreateAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/CreateAnswer.java b/api/src/com/cloud/agent/api/storage/CreateAnswer.java
deleted file mode 100644
index ab6cc03..0000000
--- a/api/src/com/cloud/agent/api/storage/CreateAnswer.java
+++ /dev/null
@@ -1,53 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.to.VolumeTO;
-
-public class CreateAnswer extends Answer {
-    VolumeTO volume;
-    boolean requestTemplateReload = false;
-    protected CreateAnswer() {
-    }
-
-    public CreateAnswer(CreateCommand cmd, VolumeTO volume) {
-        super(cmd, true, null);
-        this.volume = volume;
-    }
-
-    public CreateAnswer(CreateCommand cmd, String details) {
-        super(cmd, false, details);
-    }
-
-    public CreateAnswer(CreateCommand cmd, String details, boolean requestTemplateReload) {
-        super(cmd, false, details);
-        this.requestTemplateReload = requestTemplateReload;
-    }
-
-    public CreateAnswer(CreateCommand cmd, Exception e) {
-        super(cmd, e);
-    }
-
-    public VolumeTO getVolume() {
-        return volume;
-    }
-
-    public boolean templateReloadRequested() {
-    	return requestTemplateReload;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/CreateCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/CreateCommand.java b/api/src/com/cloud/agent/api/storage/CreateCommand.java
deleted file mode 100644
index fd0375a..0000000
--- a/api/src/com/cloud/agent/api/storage/CreateCommand.java
+++ /dev/null
@@ -1,96 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Command;
-import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.storage.StoragePool;
-import com.cloud.vm.DiskProfile;
-
-public class CreateCommand extends Command {
-    private long volId;
-    private StorageFilerTO pool;
-    private DiskProfile diskCharacteristics;
-    private String templateUrl;
-
-    protected CreateCommand() {
-        super();
-    }
-
-    /**
-     * Construction for template based volumes.
-     *
-     * @param vol
-     * @param vm
-     * @param diskCharacteristics
-     * @param templateUrl
-     * @param pool
-     */
-    public CreateCommand(DiskProfile diskCharacteristics, String templateUrl, StorageFilerTO pool) {
-        this(diskCharacteristics, pool);
-        this.templateUrl = templateUrl;
-    }
-
-    /**
-     * Construction for regular volumes.
-     *
-     * @param vol
-     * @param vm
-     * @param diskCharacteristics
-     * @param pool
-     */
-    public CreateCommand(DiskProfile diskCharacteristics, StorageFilerTO pool) {
-        this.volId = diskCharacteristics.getVolumeId();
-        this.diskCharacteristics = diskCharacteristics;
-        this.pool = pool;
-        this.templateUrl = null;
-    }
-
-    public CreateCommand(DiskProfile diskCharacteristics, String templateUrl, StoragePool pool) {
-        this(diskCharacteristics, templateUrl, new StorageFilerTO(pool));
-    }
-
-    public CreateCommand(DiskProfile diskCharacteristics, StoragePool pool) {
-        this(diskCharacteristics, new StorageFilerTO(pool));
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public String getTemplateUrl() {
-        return templateUrl;
-    }
-
-    public StorageFilerTO getPool() {
-        return pool;
-    }
-
-    public DiskProfile getDiskCharacteristics() {
-        return diskCharacteristics;
-    }
-
-    public long getVolumeId() {
-        return volId;
-    }
-
-    @Deprecated
-    public String getInstanceName() {
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java b/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java
deleted file mode 100644
index 808a67f..0000000
--- a/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Answer;
-
-public class CreateEntityDownloadURLAnswer extends Answer{
-
-    String resultString;
-    short resultCode;
-    public static final short RESULT_SUCCESS = 1;
-    public static final short RESULT_FAILURE = 0;
-
-    public CreateEntityDownloadURLAnswer(String resultString, short resultCode) {
-        super();
-        this.resultString = resultString;
-        this.resultCode = resultCode;
-    }
-
-    public CreateEntityDownloadURLAnswer(){
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java b/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java
deleted file mode 100755
index d928e0c..0000000
--- a/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java
+++ /dev/null
@@ -1,72 +0,0 @@
-// 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.agent.api.storage;
-
-
-public class CreateEntityDownloadURLCommand extends AbstractDownloadCommand {
-
-    public CreateEntityDownloadURLCommand(String parent, String installPath, String uuid) { // this constructor is for creating template download url
-        super();
-        this.parent = parent; // parent is required as not the template can be child of one of many parents
-        this.installPath = installPath;
-        this.extractLinkUUID = uuid;
-    }
-
-    public CreateEntityDownloadURLCommand(String installPath, String uuid) {
-        super();
-        this.parent = parent;
-        this.installPath = installPath;
-        this.extractLinkUUID = uuid;
-    }
-
-    public CreateEntityDownloadURLCommand() {
-    }
-
-    private String installPath;
-    private String parent;
-    private String extractLinkUUID;
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-    public String getInstallPath() {
-        return installPath;
-    }
-
-    public void setInstallPath(String installPath) {
-        this.installPath = installPath;
-    }
-
-    public String getParent() {
-        return parent;
-    }
-
-    public void setParent(String parent) {
-        this.parent = parent;
-    }
-
-	public String getExtractLinkUUID() {
-		return extractLinkUUID;
-	}
-
-	public void setExtractLinkUUID(String extractLinkUUID) {
-		this.extractLinkUUID = extractLinkUUID;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java b/api/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java
deleted file mode 100644
index 83db84d..0000000
--- a/api/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java
+++ /dev/null
@@ -1,77 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.storage.Storage.ImageFormat;
-
-public class CreatePrivateTemplateAnswer extends Answer {
-    private String _path;
-    private long _virtualSize;
-    private long _physicalSize;
-    private String _uniqueName;
-    private ImageFormat _format;
-
-    public CreatePrivateTemplateAnswer() {}
-
-    public CreatePrivateTemplateAnswer(Command cmd, boolean success, String result, String path, long virtualSize,
-            long physicalSize, String uniqueName, ImageFormat format) {
-        super(cmd, success, result);
-        _path = path;
-        _virtualSize = virtualSize;
-        _physicalSize = physicalSize;
-        _uniqueName = uniqueName;
-        _format = format;
-    }
-
-    public CreatePrivateTemplateAnswer(Command cmd, boolean success, String result) {
-        super(cmd, success, result);
-    }
-
-    public String getPath() {
-        return _path;
-    }
-
-    public void setPath(String path) {
-        _path = path;
-    }
-
-    public long getVirtualSize() {
-    	return _virtualSize;
-    }
-
-    public void setVirtualSize(long virtualSize) {
-    	_virtualSize = virtualSize;
-    }
-
-    public void setphysicalSize(long _physicalSize) {
-        this._physicalSize = _physicalSize;
-    }
-
-    public long getphysicalSize() {
-        return _physicalSize;
-    }
-
-    public String getUniqueName() {
-    	return _uniqueName;
-    }
-
-    public ImageFormat getImageFormat() {
-    	return _format;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java b/api/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java
deleted file mode 100644
index d392a89..0000000
--- a/api/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java
+++ /dev/null
@@ -1,90 +0,0 @@
-// 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.agent.api.storage;
-
-public class CreatePrivateTemplateCommand extends StorageCommand {
-    private String _snapshotFolder;
-    private String _snapshotPath;
-    private String _userFolder;
-    private String _userSpecifiedName;
-    private String _uniqueName;
-    private long _templateId;
-    private long _accountId;
-
-    // For XenServer
-    private String _secondaryStorageURL;
-    private String _snapshotName;
-
-    public CreatePrivateTemplateCommand() {}
-
-    public CreatePrivateTemplateCommand(String secondaryStorageURL, long templateId, long accountId, String userSpecifiedName, String uniqueName, String snapshotFolder, String snapshotPath, String snapshotName, String userFolder) {
-    	_secondaryStorageURL = secondaryStorageURL;
-    	_templateId = templateId;
-    	_accountId = accountId;
-    	_userSpecifiedName = userSpecifiedName;
-        _uniqueName = uniqueName;
-        _snapshotFolder = snapshotFolder;
-        _snapshotPath = snapshotPath;
-        _snapshotName = snapshotName;
-        _userFolder = userFolder;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-    public String getSecondaryStorageURL() {
-    	return _secondaryStorageURL;
-    }
-
-    public String getTemplateName() {
-        return _userSpecifiedName;
-    }
-
-    public String getUniqueName() {
-        return _uniqueName;
-    }
-
-    public String getSnapshotFolder() {
-        return _snapshotFolder;
-    }
-
-    public String getSnapshotPath() {
-        return _snapshotPath;
-    }
-
-    public String getSnapshotName() {
-    	return _snapshotName;
-    }
-
-    public String getUserFolder() {
-        return _userFolder;
-    }
-
-    public long getTemplateId() {
-    	return _templateId;
-    }
-
-    public long getAccountId() {
-    	return _accountId;
-    }
-
-    public void setTemplateId(long templateId) {
-    	_templateId = templateId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/CreateVolumeOVAAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/CreateVolumeOVAAnswer.java b/api/src/com/cloud/agent/api/storage/CreateVolumeOVAAnswer.java
new file mode 100755
index 0000000..52a57db
--- /dev/null
+++ b/api/src/com/cloud/agent/api/storage/CreateVolumeOVAAnswer.java
@@ -0,0 +1,26 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Answer;
+
+public class CreateVolumeOVAAnswer extends Answer {
+    public CreateVolumeOVAAnswer(CreateVolumeOVACommand cmd, boolean result, String details) {
+        super(cmd, result, details);
+    }
+
+} 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/CreateVolumeOVACommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/CreateVolumeOVACommand.java b/api/src/com/cloud/agent/api/storage/CreateVolumeOVACommand.java
new file mode 100755
index 0000000..224b7c80
--- /dev/null
+++ b/api/src/com/cloud/agent/api/storage/CreateVolumeOVACommand.java
@@ -0,0 +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.agent.api.storage;
+
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.StoragePool;
+
+public class CreateVolumeOVACommand extends Command {
+        String secUrl;
+        String volPath;
+        String volName;
+        StorageFilerTO pool;
+
+        public CreateVolumeOVACommand() {
+        }
+
+        public CreateVolumeOVACommand(String secUrl, String volPath, String volName, StoragePool pool, int wait) {
+        this.secUrl = secUrl;
+        this.volPath = volPath;
+        this.volName = volName;
+        this.pool = new StorageFilerTO(pool);
+        setWait(wait);
+   }
+
+        @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+        public String getVolPath() {
+                return this.volPath;
+        }
+
+        public String getVolName() {
+                return this.volName;
+        }
+        public String getSecondaryStorageUrl() {
+                return this.secUrl;
+    }
+    public StorageFilerTO getPool() {
+            return pool;
+    }
+}
+
+ 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLAnswer.java b/api/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLAnswer.java
deleted file mode 100644
index c6fdf3c..0000000
--- a/api/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLAnswer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Answer;
-
-public class DeleteEntityDownloadURLAnswer  extends Answer{
-
-    String resultString;
-    short resultCode;
-    public static final short RESULT_SUCCESS = 1;
-    public static final short RESULT_FAILURE = 0;
-
-    public DeleteEntityDownloadURLAnswer(String resultString, short resultCode) {
-        super();
-        this.resultString = resultString;
-        this.resultCode = resultCode;
-    }
-
-    public DeleteEntityDownloadURLAnswer(){
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java b/api/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java
deleted file mode 100755
index fbfacb9..0000000
--- a/api/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java
+++ /dev/null
@@ -1,72 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.storage.Upload;
-
-public class DeleteEntityDownloadURLCommand extends AbstractDownloadCommand {
-
-    private String path;
-    private String extractUrl;
-    private Upload.Type type;
-    private String parentPath;
-
-    public DeleteEntityDownloadURLCommand(String path, Upload.Type type, String url, String parentPath) {
-        super();
-        this.path = path;
-        this.type = type;
-        this.extractUrl = url;
-        this.parentPath = parentPath;
-    }
-
-    public DeleteEntityDownloadURLCommand() {
-        super();
-    }
-
-    public String getPath() {
-        return path;
-    }
-
-    public void setPath(String path) {
-        this.path = path;
-    }
-
-    public Upload.Type getType() {
-        return type;
-    }
-
-    public void setType(Upload.Type type) {
-        this.type = type;
-    }
-
-	public String getExtractUrl() {
-		return extractUrl;
-	}
-
-	public void setExtractUrl(String extractUrl) {
-		this.extractUrl = extractUrl;
-	}
-
-	public String getParentPath() {
-		return parentPath;
-	}
-
-	public void setParentPath(String parentPath) {
-		this.parentPath = parentPath;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java b/api/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java
deleted file mode 100644
index 69f465c..0000000
--- a/api/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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.agent.api.storage;
-
-
-public class DeleteTemplateCommand extends ssCommand {
-	private String templatePath;
-
-
-	public DeleteTemplateCommand() {
-	}
-
-	public DeleteTemplateCommand(String secUrl, String templatePath) {
-	    this.setSecUrl(secUrl);
-    	this.templatePath = templatePath;
-    }
-
-	@Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-	public String getTemplatePath() {
-		return templatePath;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java b/api/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java
deleted file mode 100755
index 949af01..0000000
--- a/api/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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.agent.api.storage;
-
-public class DeleteVolumeCommand extends ssCommand {
-	private String volumePath;
-
-	public DeleteVolumeCommand() {
-	}
-
-	public DeleteVolumeCommand(String secUrl, String volumePath) {
-	    this.setSecUrl(secUrl);
-    	this.volumePath = volumePath;
-    }
-
-	@Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-	public String getVolumePath() {
-		return volumePath;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/DestroyAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/DestroyAnswer.java b/api/src/com/cloud/agent/api/storage/DestroyAnswer.java
deleted file mode 100644
index ac60015..0000000
--- a/api/src/com/cloud/agent/api/storage/DestroyAnswer.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Answer;
-
-public class DestroyAnswer extends Answer {
-    public DestroyAnswer(DestroyCommand cmd, boolean result, String details) {
-        super(cmd, result, details);
-    }
-
-    // Constructor for gson.
-    protected DestroyAnswer() {
-        super();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/DestroyCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/DestroyCommand.java b/api/src/com/cloud/agent/api/storage/DestroyCommand.java
deleted file mode 100755
index 6732ea5..0000000
--- a/api/src/com/cloud/agent/api/storage/DestroyCommand.java
+++ /dev/null
@@ -1,55 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.to.VolumeTO;
-import com.cloud.storage.StoragePool;
-import com.cloud.storage.VMTemplateStorageResourceAssoc;
-import com.cloud.storage.Volume;
-
-public class DestroyCommand extends StorageCommand {
-	// in VMware, things are designed around VM instead of volume, we need it the volume VM context if the volume is attached
-	String vmName;
-    VolumeTO volume;
-
-    protected DestroyCommand() {
-    }
-
-    public DestroyCommand(StoragePool pool, Volume volume, String vmName) {
-         this.volume = new VolumeTO(volume, pool);
-         this.vmName = vmName;
-    }
-
-    public DestroyCommand(StoragePool pool, VMTemplateStorageResourceAssoc templatePoolRef) {
-        volume = new VolumeTO(templatePoolRef.getId(), null, pool.getPoolType(), pool.getUuid(),
-        		null, pool.getPath(), templatePoolRef.getInstallPath(),
-        		templatePoolRef.getTemplateSize(), null);
-    }
-
-    public VolumeTO getVolume() {
-    	return volume;
-    }
-
-    public String getVmName() {
-    	return vmName;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/DownloadAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/DownloadAnswer.java b/api/src/com/cloud/agent/api/storage/DownloadAnswer.java
deleted file mode 100755
index bb7b8a9..0000000
--- a/api/src/com/cloud/agent/api/storage/DownloadAnswer.java
+++ /dev/null
@@ -1,141 +0,0 @@
-// 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.agent.api.storage;
-
-import java.io.File;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.storage.VMTemplateStorageResourceAssoc;
-import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
-
-public class DownloadAnswer extends Answer  {
-	private String jobId;
-	private int downloadPct;
-	private String errorString;
-	private VMTemplateStorageResourceAssoc.Status downloadStatus;
-	private String downloadPath;
-	private String installPath;
-	private long templateSize = 0L;
-	private long templatePhySicalSize = 0L;
-	private String checkSum;
-
-	public String getCheckSum() {
-		return checkSum;
-	}
-
-	public int getDownloadPct() {
-		return downloadPct;
-	}
-	public String getErrorString() {
-		return errorString;
-	}
-
-	public String getDownloadStatusString() {
-		return downloadStatus.toString();
-	}
-
-	public VMTemplateStorageResourceAssoc.Status getDownloadStatus() {
-		return downloadStatus;
-	}
-
-	public String getDownloadPath() {
-		return downloadPath;
-	}
-	protected DownloadAnswer() {
-
-	}
-
-	public String getJobId() {
-		return jobId;
-	}
-	public void setJobId(String jobId) {
-		this.jobId = jobId;
-	}
-
-    public DownloadAnswer(String errorString, Status status) {
-        super();
-        this.downloadPct = 0;
-        this.errorString = errorString;
-        this.downloadStatus = status;
-        this.details = errorString;
-    }
-
-	public DownloadAnswer(String jobId, int downloadPct, String errorString,
-			Status downloadStatus, String fileSystemPath, String installPath, long templateSize, long templatePhySicalSize, String checkSum) {
-		super();
-		this.jobId = jobId;
-		this.downloadPct = downloadPct;
-		this.errorString = errorString;
-		this.details = errorString;
-		this.downloadStatus = downloadStatus;
-		this.downloadPath = fileSystemPath;
-		this.installPath = fixPath(installPath);
-		this.templateSize = templateSize;
-		this.templatePhySicalSize = templatePhySicalSize;
-		this.checkSum = checkSum;
-	}
-
-   public DownloadAnswer(String jobId, int downloadPct, Command command,
-            Status downloadStatus, String fileSystemPath, String installPath) {
-        super(command);
-        this.jobId = jobId;
-        this.downloadPct = downloadPct;
-        this.downloadStatus = downloadStatus;
-        this.downloadPath = fileSystemPath;
-        this.installPath = installPath;
-    }
-
-	private static String fixPath(String path){
-		if (path == null) {
-            return path;
-        }
-		if (path.startsWith(File.separator)) {
-			path=path.substring(File.separator.length());
-		}
-		if (path.endsWith(File.separator)) {
-			path=path.substring(0, path.length()-File.separator.length());
-		}
-		return path;
-	}
-
-	public void setDownloadStatus(VMTemplateStorageResourceAssoc.Status downloadStatus) {
-		this.downloadStatus = downloadStatus;
-	}
-
-	public String getInstallPath() {
-		return installPath;
-	}
-	public void setInstallPath(String installPath) {
-		this.installPath = fixPath(installPath);
-	}
-
-	public void setTemplateSize(long templateSize) {
-		this.templateSize = templateSize;
-	}
-
-	public Long getTemplateSize() {
-		return templateSize;
-	}
-    public void setTemplatePhySicalSize(long templatePhySicalSize) {
-        this.templatePhySicalSize = templatePhySicalSize;
-    }
-    public long getTemplatePhySicalSize() {
-        return templatePhySicalSize;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/DownloadCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/DownloadCommand.java b/api/src/com/cloud/agent/api/storage/DownloadCommand.java
deleted file mode 100644
index c6ffe45..0000000
--- a/api/src/com/cloud/agent/api/storage/DownloadCommand.java
+++ /dev/null
@@ -1,219 +0,0 @@
-// 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.agent.api.storage;
-
-import java.net.URI;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import com.cloud.storage.Storage.ImageFormat;
-import com.cloud.storage.Volume;
-import com.cloud.template.VirtualMachineTemplate;
-
-
-public class DownloadCommand extends AbstractDownloadCommand implements InternalIdentity {
-	public static class PasswordAuth {
-		String userName;
-		String password;
-		public PasswordAuth() {
-
-		}
-		public PasswordAuth(String user, String password) {
-			this.userName = user;
-			this.password = password;
-		}
-		public String getUserName() {
-			return userName;
-		}
-		public String getPassword() {
-			return password;
-		}
-	}
-
-    public static enum ResourceType {
-        VOLUME, TEMPLATE
-    }
-
-	public static class Proxy {
-		private String _host;
-		private int _port;
-		private String _userName;
-		private String _password;
-
-		public Proxy() {
-
-		}
-
-		public Proxy(String host, int port, String userName, String password) {
-			this._host = host;
-			this._port = port;
-			this._userName = userName;
-			this._password = password;
-		}
-
-		public Proxy(URI uri) {
-			this._host = uri.getHost();
-			this._port = uri.getPort() == -1 ? 3128 : uri.getPort();
-			String userInfo = uri.getUserInfo();
-			if (userInfo != null) {
-				String[] tokens = userInfo.split(":");
-				if (tokens.length == 1) {
-					this._userName = userInfo;
-					this._password = "";
-				} else if (tokens.length == 2) {
-					this._userName = tokens[0];
-					this._password = tokens[1];
-				}
-			}
-		}
-
-		public String getHost() {
-			return _host;
-		}
-
-		public int getPort() {
-			return _port;
-		}
-
-		public String getUserName() {
-			return _userName;
-		}
-
-		public String getPassword() {
-			return _password;
-		}
-	}
-	private boolean hvm;
-	private String description;
-	private String checksum;
-	private PasswordAuth auth;
-	private Proxy _proxy;
-	private Long maxDownloadSizeInBytes = null;
-	private long id;
-	private ResourceType resourceType = ResourceType.TEMPLATE;
-
-	protected DownloadCommand() {
-	}
-
-
-	public DownloadCommand(DownloadCommand that) {
-	    super(that);
-	    this.hvm = that.hvm;
-	    this.checksum = that.checksum;
-	    this.id = that.id;
-	    this.description = that.description;
-	    this.auth = that.getAuth();
-	    this.setSecUrl(that.getSecUrl());
-	    this.maxDownloadSizeInBytes = that.getMaxDownloadSizeInBytes();
-	    this.resourceType = that.resourceType;
-	}
-
-	public DownloadCommand(String secUrl, VirtualMachineTemplate template, Long maxDownloadSizeInBytes) {
-	    super(template.getUniqueName(), template.getUrl(), template.getFormat(), template.getAccountId());
-	    this.hvm = template.isRequiresHvm();
-	    this.checksum = template.getChecksum();
-	    this.id = template.getId();
-	    this.description = template.getDisplayText();
-	    this.setSecUrl(secUrl);
-	    this.maxDownloadSizeInBytes = maxDownloadSizeInBytes;
-	}
-
-	public DownloadCommand(String secUrl, Volume volume, Long maxDownloadSizeInBytes, String checkSum, String url, ImageFormat format) {
-	    super(volume.getName(), url, format, volume.getAccountId());
-	    //this.hvm = volume.isRequiresHvm();
-	    this.checksum = checkSum;
-	    this.id = volume.getId();
-	    this.setSecUrl(secUrl);
-	    this.maxDownloadSizeInBytes = maxDownloadSizeInBytes;
-	    this.resourceType = ResourceType.VOLUME;
-	}
-
-	public DownloadCommand(String secUrl, String url, VirtualMachineTemplate template, String user, String passwd, Long maxDownloadSizeInBytes) {
-	    super(template.getUniqueName(), url, template.getFormat(), template.getAccountId());
-        this.hvm = template.isRequiresHvm();
-        this.checksum = template.getChecksum();
-        this.id = template.getId();
-        this.description = template.getDisplayText();
-        this.setSecUrl(secUrl);
-        this.maxDownloadSizeInBytes = maxDownloadSizeInBytes;
-		auth = new PasswordAuth(user, passwd);
-	}
-
-	public long getId() {
-	    return id;
-	}
-
-	public void setHvm(boolean hvm) {
-		this.hvm = hvm;
-	}
-
-	public boolean isHvm() {
-		return hvm;
-	}
-
-	public String getDescription() {
-		return description;
-	}
-
-	public String getChecksum() {
-		return checksum;
-	}
-
-    public void setDescription(String description) {
-		this.description = description;
-	}
-
-	public void setChecksum(String checksum) {
-		this.checksum = checksum;
-	}
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-
-	public PasswordAuth getAuth() {
-		return auth;
-	}
-
-	public void setCreds(String userName, String passwd) {
-		auth = new PasswordAuth(userName, passwd);
-	}
-
-	public Proxy getProxy() {
-		return _proxy;
-	}
-
-	public void setProxy(Proxy proxy) {
-		_proxy = proxy;
-	}
-
-	public Long getMaxDownloadSizeInBytes() {
-		return maxDownloadSizeInBytes;
-	}
-
-
-	public ResourceType getResourceType() {
-		return resourceType;
-	}
-
-
-	public void setResourceType(ResourceType resourceType) {
-		this.resourceType = resourceType;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/DownloadProgressCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/DownloadProgressCommand.java b/api/src/com/cloud/agent/api/storage/DownloadProgressCommand.java
deleted file mode 100644
index 835847b..0000000
--- a/api/src/com/cloud/agent/api/storage/DownloadProgressCommand.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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.agent.api.storage;
-
-
-
-public class DownloadProgressCommand extends DownloadCommand {
-	public static enum RequestType {GET_STATUS, ABORT, RESTART, PURGE, GET_OR_RESTART}
-	private String jobId;
-	private RequestType request;
-
-	protected DownloadProgressCommand() {
-		super();
-	}
-
-	public DownloadProgressCommand(DownloadCommand cmd, String jobId, RequestType req) {
-	    super(cmd);
-
-		this.jobId = jobId;
-		this.setRequest(req);
-	}
-
-	public String getJobId() {
-		return jobId;
-	}
-
-	public void setRequest(RequestType request) {
-		this.request = request;
-	}
-
-	public RequestType getRequest() {
-		return request;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/ListTemplateAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/ListTemplateAnswer.java b/api/src/com/cloud/agent/api/storage/ListTemplateAnswer.java
deleted file mode 100644
index a4e2e25..0000000
--- a/api/src/com/cloud/agent/api/storage/ListTemplateAnswer.java
+++ /dev/null
@@ -1,53 +0,0 @@
-// 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.agent.api.storage;
-
-import java.util.Map;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.storage.template.TemplateInfo;
-
-public class ListTemplateAnswer extends Answer  {
-    private String secUrl;
-    private Map<String, TemplateInfo> templateInfos;
-
-	public ListTemplateAnswer() {
-
-	}
-
-	public ListTemplateAnswer(String secUrl, Map<String, TemplateInfo> templateInfos) {
-	    super(null, true, "success");
-	    this.setSecUrl(secUrl);
-	    this.templateInfos = templateInfos;
-	}
-
-	public Map<String, TemplateInfo> getTemplateInfo() {
-	    return templateInfos;
-	}
-
-	public void setTemplateInfo(Map<String, TemplateInfo> templateInfos) {
-	    this.templateInfos = templateInfos;
-	}
-
-    public void setSecUrl(String secUrl) {
-        this.secUrl = secUrl;
-    }
-
-    public String getSecUrl() {
-        return secUrl;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/ListTemplateCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/ListTemplateCommand.java b/api/src/com/cloud/agent/api/storage/ListTemplateCommand.java
deleted file mode 100644
index da25ed5..0000000
--- a/api/src/com/cloud/agent/api/storage/ListTemplateCommand.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.LogLevel;
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-import com.cloud.agent.api.to.SwiftTO;
-
-public class ListTemplateCommand extends StorageCommand {
-    private String secUrl;
-    @LogLevel(Log4jLevel.Off)
-    private SwiftTO swift;
-
-    public ListTemplateCommand() {
-    }
-
-	public ListTemplateCommand(String secUrl) {
-	    this.secUrl = secUrl;
-        this.swift = null;
-	}
-
-    public ListTemplateCommand(SwiftTO swift) {
-        this.secUrl = null;
-        this.swift = swift;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public String getSecUrl() {
-        return secUrl;
-    }
-
-    public SwiftTO getSwift() {
-        return swift;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/ListVolumeAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/ListVolumeAnswer.java b/api/src/com/cloud/agent/api/storage/ListVolumeAnswer.java
deleted file mode 100755
index 6bbb2e8..0000000
--- a/api/src/com/cloud/agent/api/storage/ListVolumeAnswer.java
+++ /dev/null
@@ -1,53 +0,0 @@
-// 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.agent.api.storage;
-
-import java.util.Map;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.storage.template.TemplateInfo;
-
-public class ListVolumeAnswer extends Answer {
-	private String secUrl;
-    private Map<Long, TemplateInfo> templateInfos;
-
-	public ListVolumeAnswer() {
-
-	}
-
-	public ListVolumeAnswer(String secUrl, Map<Long, TemplateInfo> templateInfos) {
-	    super(null, true, "success");
-	    this.setSecUrl(secUrl);
-	    this.templateInfos = templateInfos;
-	}
-
-	public Map<Long, TemplateInfo> getTemplateInfo() {
-	    return templateInfos;
-	}
-
-	public void setTemplateInfo(Map<Long, TemplateInfo> templateInfos) {
-	    this.templateInfos = templateInfos;
-	}
-
-    public void setSecUrl(String secUrl) {
-        this.secUrl = secUrl;
-    }
-
-    public String getSecUrl() {
-        return secUrl;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/ListVolumeCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/ListVolumeCommand.java b/api/src/com/cloud/agent/api/storage/ListVolumeCommand.java
deleted file mode 100755
index 63c5b62..0000000
--- a/api/src/com/cloud/agent/api/storage/ListVolumeCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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.agent.api.storage;
-
-
-public class ListVolumeCommand extends StorageCommand {
-
-    private String secUrl;
-
-    public ListVolumeCommand() {
-    }
-
-	public ListVolumeCommand(String secUrl) {
-	    this.secUrl = secUrl;
-	}
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public String getSecUrl() {
-        return secUrl;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java b/api/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java
deleted file mode 100644
index edd2830..0000000
--- a/api/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-
-public class ManageVolumeAvailabilityAnswer extends Answer {
-
-	protected ManageVolumeAvailabilityAnswer() {
-    }
-
-	public ManageVolumeAvailabilityAnswer(Command command, boolean success, String details) {
-		super(command, success, details);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.java b/api/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.java
deleted file mode 100644
index 1a7d480..0000000
--- a/api/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Command;
-
-public class ManageVolumeAvailabilityCommand extends Command {
-
-	boolean attach;
-	String primaryStorageSRUuid;
-	String volumeUuid;
-
-
-	public ManageVolumeAvailabilityCommand() {
-	}
-
-	public ManageVolumeAvailabilityCommand(boolean attach, String primaryStorageSRUuid, String volumeUuid) {
-    	this.attach = attach;
-    	this.primaryStorageSRUuid = primaryStorageSRUuid;
-        this.volumeUuid = volumeUuid;
-    }
-
-	@Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-	public boolean getAttach() {
-		return attach;
-	}
-
-	public String getPrimaryStorageSRUuid() {
-		return primaryStorageSRUuid;
-	}
-
-	public String getVolumeUuid() {
-		return volumeUuid;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.java b/api/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.java
deleted file mode 100644
index d5efa95..0000000
--- a/api/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-
-public class MigrateVolumeAnswer extends Answer {
-    private String volumePath;
-
-    public MigrateVolumeAnswer(Command command, boolean success, String details, String volumePath) {
-        super(command, success, details);
-        this.volumePath = volumePath;
-    }
-
-    public MigrateVolumeAnswer(Command command) {
-        super(command);
-        this.volumePath = null;
-    }
-
-    public String getVolumePath() {
-        return volumePath;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java b/api/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java
deleted file mode 100644
index b82d848..0000000
--- a/api/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// 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.agent.api.storage;
-
-import com.cloud.agent.api.Command;
-import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.storage.StoragePool;
-
-public class MigrateVolumeCommand extends Command {
-
-    long volumeId;
-    String volumePath;
-    StorageFilerTO pool;
-
-    public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool) {
-        this.volumeId = volumeId;
-        this.volumePath = volumePath;
-        this.pool = new StorageFilerTO(pool);
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public String getVolumePath() {
-        return volumePath;
-    }
-
-    public long getVolumeId() {
-        return volumeId;
-    }
-
-    public StorageFilerTO getPool() {
-        return pool;
-    }
-}
\ No newline at end of file


[53/57] [abbrv] git commit: updated refs/heads/master to f84b6ab

Posted by ni...@apache.org.
db conflict resolve


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

Branch: refs/heads/master
Commit: fa1217576bda168d969422ce1f9dd6f87615e047
Parents: e107776
Author: Nitin Mehta <ni...@citrix.com>
Authored: Sun May 12 13:59:14 2013 +0530
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Sun May 12 13:59:14 2013 +0530

----------------------------------------------------------------------
 setup/db/db/schema-410to420.sql |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fa121757/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index 5bb1eaa..30b96fd 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -1204,7 +1204,6 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'Netwo
 
 
 alter table `cloud_usage`.`usage_network_offering` add column nic_id bigint(20) unsigned NOT NULL;
-<<<<<<< HEAD
 DROP VIEW IF EXISTS `cloud`.`disk_offering_view`;
 CREATE VIEW `cloud`.`disk_offering_view` AS
     select
@@ -1514,7 +1513,6 @@ CREATE VIEW `cloud`.`volume_view` AS
             and async_job.instance_type = 'Volume'
             and async_job.job_status = 0;
 
-=======
 ALTER TABLE `cloud`.`data_center_details` MODIFY value varchar(1024);
 ALTER TABLE `cloud`.`cluster_details` MODIFY value varchar(255);
 ALTER TABLE `cloud`.`storage_pool_details` MODIFY value varchar(255);
@@ -1541,4 +1539,3 @@ CREATE TABLE `cloud`.`account_vnet_map` (
 
 ALTER TABLE `cloud`.`op_dc_vnet_alloc` ADD COLUMN account_vnet_map_id bigint unsigned;
 ALTER TABLE `cloud`.`op_dc_vnet_alloc` ADD CONSTRAINT `fk_op_dc_vnet_alloc__account_vnet_map_id` FOREIGN KEY `fk_op_dc_vnet_alloc__account_vnet_map_id` (`account_vnet_map_id`) REFERENCES `account_vnet_map` (`id`);
->>>>>>> master


[17/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/DcDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/DcDetailVO.java b/engine/schema/src/com/cloud/dc/DcDetailVO.java
new file mode 100644
index 0000000..15bfacb
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/DcDetailVO.java
@@ -0,0 +1,73 @@
+// 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.dc;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="data_center_details")
+public class DcDetailVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+    @Column(name="dc_id")
+    private long dcId;
+    
+    @Column(name="name")
+    private String name;
+    
+    @Column(name="value")
+    private String value;
+    
+    protected DcDetailVO() {
+    }
+    
+    public DcDetailVO(long dcId, String name, String value) {
+        this.dcId = dcId;
+        this.name = name;
+        this.value = value;
+    }
+
+    public long getDcId() {
+        return dcId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public long getId() {
+        return id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/HostPodVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/HostPodVO.java b/engine/schema/src/com/cloud/dc/HostPodVO.java
new file mode 100644
index 0000000..e4ba9d0
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/HostPodVO.java
@@ -0,0 +1,197 @@
+// 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.dc;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.org.Grouping;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = "host_pod_ref")
+public class HostPodVO implements Pod {
+	@Id
+	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	long id;
+
+	@Column(name = "name")
+	private String name = null;
+
+	@Column(name = "data_center_id")
+	private long dataCenterId;
+
+	@Column(name = "gateway")
+	private String gateway;
+
+	@Column(name = "cidr_address")
+	private String cidrAddress;
+
+	@Column(name = "cidr_size")
+	private int cidrSize;
+
+	@Column(name = "description")
+	private String description;
+
+    @Column(name="allocation_state")
+    @Enumerated(value=EnumType.STRING)
+    AllocationState allocationState;
+
+	@Column(name = "external_dhcp")
+	private Boolean externalDhcp;
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+
+	@Column(name = "uuid")
+	private String uuid;
+
+	public HostPodVO(String name, long dcId, String gateway, String cidrAddress, int cidrSize, String description) {
+		this.name = name;
+		this.dataCenterId = dcId;
+		this.gateway = gateway;
+		this.cidrAddress = cidrAddress;
+		this.cidrSize = cidrSize;
+		this.description = description;
+		this.allocationState = Grouping.AllocationState.Enabled;
+		this.externalDhcp = false;
+		this.uuid = UUID.randomUUID().toString();
+	}
+
+	/*
+	 * public HostPodVO(String name, long dcId) { this(null, name, dcId); }
+	 */
+	protected HostPodVO() {
+		this.uuid = UUID.randomUUID().toString();
+	}
+
+	@Override
+    public long getId() {
+		return id;
+	}
+
+	public long getDataCenterId() {
+		return dataCenterId;
+	}
+
+	public void setDataCenterId(long dataCenterId) {
+		this.dataCenterId = dataCenterId;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	@Override
+    public String getCidrAddress() {
+		return cidrAddress;
+	}
+
+	public void setCidrAddress(String cidrAddress) {
+		this.cidrAddress = cidrAddress;
+	}
+
+	@Override
+    public int getCidrSize() {
+		return cidrSize;
+	}
+
+	public void setCidrSize(int cidrSize) {
+		this.cidrSize = cidrSize;
+	}
+
+	@Override
+    public String getGateway() {
+		return gateway;
+	}
+
+	public void setGateway(String gateway) {
+		this.gateway = gateway;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+    public AllocationState getAllocationState() {
+    	return allocationState;
+    }
+
+    public void setAllocationState(AllocationState allocationState) {
+		this.allocationState = allocationState;
+    }
+
+	// Use for comparisons only.
+	public HostPodVO(Long id) {
+	    this.id = id;
+	}
+
+	@Override
+    public int hashCode() {
+	    return  NumbersUtil.hash(id);
+	}
+
+	public boolean getExternalDhcp() {
+		return externalDhcp;
+	}
+
+	public void setExternalDhcp(boolean use) {
+		externalDhcp = use;
+	}
+
+	@Override
+    public boolean equals(Object obj) {
+	    if (obj instanceof HostPodVO) {
+	        return id == ((HostPodVO)obj).id;
+	    } else {
+	        return false;
+	    }
+	}
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/PodCluster.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/PodCluster.java b/engine/schema/src/com/cloud/dc/PodCluster.java
new file mode 100644
index 0000000..acffe4d
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/PodCluster.java
@@ -0,0 +1,67 @@
+// 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.dc;
+
+public class PodCluster {
+    HostPodVO _pod;
+    ClusterVO _cluster;
+    
+    protected PodCluster() {
+        super();
+    }
+    
+    public PodCluster(HostPodVO pod, ClusterVO cluster) {
+        _pod = pod;
+        _cluster = cluster;
+    }
+    
+    public HostPodVO getPod() {
+        return _pod;
+    }
+    
+    public ClusterVO getCluster() {
+        return _cluster;
+    }
+    
+    
+    @Override
+    public int hashCode() {
+        return _pod.hashCode() ^ (_cluster != null ? _cluster.hashCode() : 0);
+    }
+    
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof PodCluster)) {
+            return false;
+        }
+        
+        PodCluster that = (PodCluster)obj;
+        if (!this._pod.equals(that._pod)) {
+            return false;
+        }
+        
+        if (this._cluster == null && that._cluster == null) {
+            return true;
+        }
+        
+        if (this._cluster == null || that._cluster == null) {
+            return false;
+        }
+        
+        return this._cluster.equals(that._cluster);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/PodVlanMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/PodVlanMapVO.java b/engine/schema/src/com/cloud/dc/PodVlanMapVO.java
new file mode 100644
index 0000000..8853fac
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/PodVlanMapVO.java
@@ -0,0 +1,62 @@
+// 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.dc;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="pod_vlan_map")
+public class PodVlanMapVO implements InternalIdentity {
+	    
+	@Id
+	@GeneratedValue(strategy=GenerationType.IDENTITY)
+	@Column(name="id")
+	private long id;
+	
+	@Column(name="pod_id")
+	private long podId;
+	
+	@Column(name="vlan_db_id")
+	private long vlanDbId;
+	
+	public PodVlanMapVO(long podId, long vlanDbId) {
+		this.podId = podId;
+		this.vlanDbId = vlanDbId;
+	}
+	
+	public PodVlanMapVO() {
+	}
+	
+	public long getId() {
+		return id;
+	}
+	
+	public long getPodId() {
+		return podId;
+	}
+	
+	public long getVlanDbId() {
+		return vlanDbId;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/PodVlanVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/PodVlanVO.java b/engine/schema/src/com/cloud/dc/PodVlanVO.java
new file mode 100755
index 0000000..5324c84
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/PodVlanVO.java
@@ -0,0 +1,98 @@
+// 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.dc;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity
+@Table(name="op_pod_vlan_alloc")
+public class PodVlanVO implements InternalIdentity {
+    
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    Long id;
+    
+    @Column(name="taken", nullable=true)
+    @Temporal(value=TemporalType.TIMESTAMP)
+    Date takenAt;
+
+    @Column(name="vlan", updatable=false, nullable=false)
+    protected String vlan;
+    
+    @Column(name="data_center_id") 
+    long dataCenterId;
+    
+    @Column(name="pod_id", updatable=false, nullable=false)
+    protected long podId;
+
+    @Column(name="account_id")
+    protected Long accountId;
+    
+    public Date getTakenAt() {
+        return takenAt;
+    }
+
+    public void setTakenAt(Date taken) {
+        this.takenAt = taken;
+    }
+
+    public PodVlanVO(String vlan, long dataCenterId, long podId) {
+        this.vlan = vlan;
+        this.dataCenterId = dataCenterId;
+        this.podId = podId;
+        this.takenAt = null;
+    }
+    
+    public long getId() {
+        return id;
+    }
+    
+    public Long getAccountId() {
+    	return accountId;
+    }
+    
+    public String getVlan() {
+        return vlan;
+    }
+
+    public long getDataCenterId() {
+        return dataCenterId;
+    }
+
+    public long getPodId() {
+        return podId;
+    }
+
+    public void setAccountId(Long accountId) {
+    	this.accountId = accountId;
+    }
+    
+    protected PodVlanVO() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/StorageNetworkIpAddressVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/StorageNetworkIpAddressVO.java b/engine/schema/src/com/cloud/dc/StorageNetworkIpAddressVO.java
new file mode 100755
index 0000000..6ad1ecd
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/StorageNetworkIpAddressVO.java
@@ -0,0 +1,120 @@
+// 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.dc;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.SecondaryTable;
+import javax.persistence.SecondaryTables;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity
+@Table(name="op_dc_storage_network_ip_address")
+@SecondaryTables({@SecondaryTable(name = "dc_storage_network_ip_range", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "range_id", referencedColumnName = "id")})})
+public class StorageNetworkIpAddressVO implements InternalIdentity {
+	@Id
+	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	@Column(name = "id")
+	long id;
+
+	@Column(name = "range_id")
+	long rangeId;
+			
+	@Column(name = "ip_address", updatable = false, nullable = false)
+	String ipAddress;
+
+	@Column(name = "taken")
+	@Temporal(value = TemporalType.TIMESTAMP)
+	private Date takenAt;
+	
+	@Column(name = "netmask", table = "dc_storage_network_ip_range", insertable = false, updatable = false)
+	private String netmask;
+	
+	@Column(name = "mac_address")
+	long mac;
+	
+	@Column(name = "vlan", table = "dc_storage_network_ip_range", insertable = false, updatable = false)
+	Integer vlan;
+	
+	@Column(name = "gateway", table = "dc_storage_network_ip_range", insertable = false, updatable = false)
+	String gateway;
+
+	protected StorageNetworkIpAddressVO() {
+	}
+
+	public long getId() {
+		return id;
+	}
+
+	public void setTakenAt(Date takenDate) {
+		this.takenAt = takenDate;
+	}
+
+	public String getIpAddress() {
+		return ipAddress;
+	}
+	
+	public void setIpAddress(String ip) {
+		this.ipAddress = ip;
+	}
+
+	public Date getTakenAt() {
+		return takenAt;
+	}
+	
+	public long getRangeId() {
+		return rangeId;
+	}
+	
+	public void setRangeId(long id) {
+		this.rangeId = id;
+	}
+	
+	public long getMac() {
+		return mac;
+	}
+	
+	public void setMac(long mac) {
+		this.mac = mac;
+	}
+	
+	public String getNetmask() {
+		return netmask;
+	}
+	
+	public void setNetmask(String netmask) {
+		this.netmask = netmask;
+	}
+	
+	public Integer getVlan() {
+		return vlan;
+	}
+	
+	public String getGateway() {
+		return gateway;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/StorageNetworkIpRangeVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/StorageNetworkIpRangeVO.java b/engine/schema/src/com/cloud/dc/StorageNetworkIpRangeVO.java
new file mode 100755
index 0000000..e410d22
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/StorageNetworkIpRangeVO.java
@@ -0,0 +1,184 @@
+// 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.dc;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.SecondaryTable;
+import javax.persistence.SecondaryTables;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="dc_storage_network_ip_range")
+@SecondaryTables({@SecondaryTable(name="networks", pkJoinColumns={@PrimaryKeyJoinColumn(name="network_id", referencedColumnName="id")}),
+	@SecondaryTable(name="host_pod_ref", pkJoinColumns={@PrimaryKeyJoinColumn(name="pod_id", referencedColumnName="id")}),
+	@SecondaryTable(name="data_center", pkJoinColumns={@PrimaryKeyJoinColumn(name="data_center_id", referencedColumnName="id")})
+})
+public class StorageNetworkIpRangeVO implements StorageNetworkIpRange {
+	@Id
+	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	@Column(name = "id")
+	private long id;
+	
+	@Column(name = "uuid")
+	String uuid;
+	
+	@Column(name = "vlan")
+	private Integer vlan;
+	
+	@Column(name = "data_center_id")
+	private long dataCenterId;
+	
+	@Column(name = "pod_id")
+	private long podId;
+	
+	@Column(name = "start_ip")
+	private String startIp;
+	
+	@Column(name = "end_ip")
+	private String endIp;
+	
+	@Column(name = "gateway")
+	private String gateway;
+	
+	@Column(name = "network_id")
+	private long networkId;
+	
+	@Column(name="netmask")
+	private String netmask;
+	
+	@Column(name = "uuid", table = "networks", insertable = false, updatable = false)
+	String networkUuid;
+	
+	@Column(name = "uuid", table = "host_pod_ref", insertable = false, updatable = false)
+	String podUuid;
+	
+	@Column(name = "uuid", table = "data_center", insertable = false, updatable = false)
+	String zoneUuid;
+	
+	public StorageNetworkIpRangeVO(long dcId, long podId, long networkId, String startIp, String endIp, Integer vlan, String netmask, String gateway) {
+		this();
+		this.dataCenterId = dcId;
+		this.podId = podId;
+		this.networkId = networkId;
+		this.startIp = startIp;
+		this.endIp = endIp;
+		this.vlan = vlan;
+		this.netmask = netmask;
+		this.gateway = gateway;
+	}
+		
+	protected StorageNetworkIpRangeVO() {
+		this.uuid = UUID.randomUUID().toString();
+	}
+	
+	public long getId() {
+		return id;
+	}
+	
+	public long getDataCenterId() {
+		return dataCenterId;
+	}
+	
+	public void setDataCenterId(long dcId) {
+		this.dataCenterId = dcId;
+	}
+	
+	public long getPodId() {
+		return podId;
+	}
+	
+	public void setPodId(long podId) {
+		this.podId = podId;
+	}
+	
+	public long getNetworkId() {
+		return networkId;
+	}
+	
+	public void setNetworkId(long nwId) {
+		this.networkId = nwId;
+	}
+		
+	public Integer getVlan() {
+		return vlan;
+	}
+	
+	public void setVlan(int vlan) {
+		this.vlan = vlan;
+	}
+	
+	public void setStartIp(String start) {
+		this.startIp = start;
+	}
+	
+	public String getStartIp() {
+		return startIp;
+	}
+	
+	public void setEndIp(String end) {
+		this.endIp = end;
+	}
+
+	public String getEndIp() {
+		return endIp;
+	}
+	
+	public String getNetmask() {
+		return netmask;
+	}
+	
+	public String getGateway() {
+		return this.gateway;
+	}
+	
+	public void setGateway(String gateway) {
+		this.gateway = gateway;
+	}
+	
+	public void setNetmask(String netmask) {
+		this.netmask = netmask;
+	}
+
+	@Override
+	public String getUuid() {
+		return uuid;
+	}
+
+	@Override
+	public String getPodUuid() {
+		return podUuid;
+	}
+
+	@Override
+	public String getNetworkUuid() {
+		return networkUuid;
+	}
+
+	@Override
+	public String getZoneUuid() {
+		return zoneUuid;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/VlanVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/VlanVO.java b/engine/schema/src/com/cloud/dc/VlanVO.java
new file mode 100644
index 0000000..af6b5fc
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/VlanVO.java
@@ -0,0 +1,196 @@
+// 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.dc;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="vlan")
+public class VlanVO implements Vlan {
+
+	@Id
+	@GeneratedValue(strategy=GenerationType.IDENTITY)
+	@Column(name="id")
+	Long id;
+
+	@Column(name="vlan_id")
+	String vlanTag;
+
+	@Column(name="vlan_gateway")
+	String vlanGateway;
+
+	@Column(name="vlan_netmask")
+	String vlanNetmask;
+
+	@Column(name="ip6_gateway")
+	String ip6Gateway;
+
+	@Column(name="ip6_cidr")
+	String ip6Cidr;
+
+	@Column(name="data_center_id")
+	long dataCenterId;
+
+	@Column(name="description")
+	String ipRange;
+
+	@Column(name="ip6_range")
+	String ip6Range;
+	
+    @Column(name="network_id")
+    Long networkId;
+
+    @Column(name="physical_network_id")
+    Long physicalNetworkId;
+
+	@Column(name="vlan_type")
+	@Enumerated(EnumType.STRING)
+	VlanType vlanType;
+
+    @Column(name="uuid")
+    String uuid;
+
+	public VlanVO(VlanType vlanType, String vlanTag, String vlanGateway, String vlanNetmask, long dataCenterId, String ipRange, Long networkId, Long physicalNetworkId, String ip6Gateway, String ip6Cidr, String ip6Range) {
+		this.vlanType = vlanType;
+		this.vlanTag = vlanTag;
+		this.vlanGateway = vlanGateway;
+		this.vlanNetmask = vlanNetmask;
+		this.ip6Gateway = ip6Gateway;
+		this.ip6Cidr = ip6Cidr;
+		this.dataCenterId = dataCenterId;
+		this.ipRange = ipRange;
+		this.ip6Range = ip6Range;
+		this.networkId = networkId;
+		this.uuid = UUID.randomUUID().toString();
+		this.physicalNetworkId = physicalNetworkId;
+	}
+
+	public VlanVO() {
+		this.uuid = UUID.randomUUID().toString();
+	}
+
+	@Override
+    public long getId() {
+		return id;
+	}
+
+	@Override
+    public String getVlanTag() {
+		return vlanTag;
+	}
+
+	@Override
+    public String getVlanGateway() {
+		return vlanGateway;
+	}
+
+	@Override
+    public String getVlanNetmask() {
+        return vlanNetmask;
+    }
+
+	@Override
+    public long getDataCenterId() {
+		return dataCenterId;
+	}
+
+	@Override
+    public String getIpRange() {
+		return ipRange;
+	}
+
+	@Override
+    public VlanType getVlanType() {
+		return vlanType;
+	}
+
+    @Override
+    public Long getNetworkId() {
+        return networkId;
+    }
+
+    public void setNetworkId(Long networkId) {
+        this.networkId = networkId;
+    }
+
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+    @Override
+    public Long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public void setPhysicalNetworkId(Long physicalNetworkId) {
+        this.physicalNetworkId = physicalNetworkId;
+    }
+
+    transient String toString;
+    @Override
+    public String toString() {
+        if (toString == null) {
+            toString = new StringBuilder("Vlan[").append(vlanTag).append("|").append(vlanGateway).append("|").append(vlanNetmask).
+                    append("|").append(ip6Gateway).append("|").append(ip6Cidr).append("|").append(ipRange).append("|").
+                    append("|").append(ip6Range).append(networkId).append("]").toString();
+        }
+        return toString;
+    }
+    
+    @Override
+	public String getIp6Gateway() {
+		return ip6Gateway;
+	}
+
+	public void setIp6Gateway(String ip6Gateway) {
+		this.ip6Gateway = ip6Gateway;
+	}
+
+    @Override
+	public String getIp6Cidr() {
+		return ip6Cidr;
+	}
+
+	public void setIp6Cidr(String ip6Cidr) {
+		this.ip6Cidr = ip6Cidr;
+	}
+
+	@Override
+	public String getIp6Range() {
+		return ip6Range;
+	}
+
+	public void setIp6Range(String ip6Range) {
+		this.ip6Range = ip6Range;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/AccountVlanMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/AccountVlanMapDao.java b/engine/schema/src/com/cloud/dc/dao/AccountVlanMapDao.java
new file mode 100644
index 0000000..c90557b
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/AccountVlanMapDao.java
@@ -0,0 +1,30 @@
+// 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.dc.dao;
+
+import java.util.List;
+
+import com.cloud.dc.AccountVlanMapVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface AccountVlanMapDao extends GenericDao<AccountVlanMapVO, Long> {
+		
+	public List<AccountVlanMapVO> listAccountVlanMapsByAccount(long accountId);
+	public List<AccountVlanMapVO> listAccountVlanMapsByVlan(long vlanDbId);
+	public AccountVlanMapVO findAccountVlanMap(long accountId, long vlanDbId);
+	
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/AccountVlanMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/AccountVlanMapDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/AccountVlanMapDaoImpl.java
new file mode 100644
index 0000000..e4c0652
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/AccountVlanMapDaoImpl.java
@@ -0,0 +1,75 @@
+// 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.dc.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.AccountVlanMapVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value={AccountVlanMapDao.class})
+public class AccountVlanMapDaoImpl extends GenericDaoBase<AccountVlanMapVO, Long> implements AccountVlanMapDao {
+    
+	protected SearchBuilder<AccountVlanMapVO> AccountSearch;
+	protected SearchBuilder<AccountVlanMapVO> VlanSearch;
+	protected SearchBuilder<AccountVlanMapVO> AccountVlanSearch;
+	
+	@Override
+	public List<AccountVlanMapVO> listAccountVlanMapsByAccount(long accountId) {
+		SearchCriteria<AccountVlanMapVO> sc = AccountSearch.create();
+    	sc.setParameters("accountId", accountId);
+    	return listIncludingRemovedBy(sc);
+	}
+	
+	@Override
+	public List<AccountVlanMapVO> listAccountVlanMapsByVlan(long vlanDbId) {
+		SearchCriteria<AccountVlanMapVO> sc = VlanSearch.create();
+    	sc.setParameters("vlanDbId", vlanDbId);
+    	return listIncludingRemovedBy(sc);
+	}
+	
+	@Override
+	public AccountVlanMapVO findAccountVlanMap(long accountId, long vlanDbId) {
+		SearchCriteria<AccountVlanMapVO> sc = AccountVlanSearch.create();
+		sc.setParameters("accountId", accountId);
+		sc.setParameters("vlanDbId", vlanDbId);
+		return findOneIncludingRemovedBy(sc);
+	}
+	
+    public AccountVlanMapDaoImpl() {
+    	AccountSearch = createSearchBuilder();
+    	AccountSearch.and("accountId", AccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AccountSearch.done();
+        
+        VlanSearch = createSearchBuilder();
+    	VlanSearch.and("vlanDbId", VlanSearch.entity().getVlanDbId(), SearchCriteria.Op.EQ);
+        VlanSearch.done();
+        
+        AccountVlanSearch = createSearchBuilder();
+        AccountVlanSearch.and("accountId", AccountVlanSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AccountVlanSearch.and("vlanDbId", AccountVlanSearch.entity().getVlanDbId(), SearchCriteria.Op.EQ);
+        AccountVlanSearch.done();
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/ClusterDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/ClusterDao.java b/engine/schema/src/com/cloud/dc/dao/ClusterDao.java
new file mode 100644
index 0000000..3ce0798
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/ClusterDao.java
@@ -0,0 +1,37 @@
+// 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.dc.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import com.cloud.dc.ClusterVO;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.utils.db.GenericDao;
+
+public interface ClusterDao extends GenericDao<ClusterVO, Long> {
+    List<ClusterVO> listByPodId(long podId);
+    ClusterVO findBy(String name, long podId);
+    List<ClusterVO> listByHyTypeWithoutGuid(String hyType);
+    List<ClusterVO> listByZoneId(long zoneId);
+
+    List<HypervisorType> getAvailableHypervisorInZone(Long zoneId);
+    List<ClusterVO> listByDcHyType(long dcId, String hyType);
+    Map<Long, List<Long>> getPodClusterIdMap(List<Long> clusterIds);
+    List<Long> listDisabledClusters(long zoneId, Long podId);
+    List<Long> listClustersWithDisabledPods(long zoneId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/ClusterDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/ClusterDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/ClusterDaoImpl.java
new file mode 100644
index 0000000..86dc65e
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/ClusterDaoImpl.java
@@ -0,0 +1,241 @@
+// 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.dc.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.ClusterVO;
+import com.cloud.dc.HostPodVO;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+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.Func;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Component
+@Local(value=ClusterDao.class)
+public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements ClusterDao {
+
+    protected final SearchBuilder<ClusterVO> PodSearch;
+    protected final SearchBuilder<ClusterVO> HyTypeWithoutGuidSearch;
+    protected final SearchBuilder<ClusterVO> AvailHyperSearch;
+    protected final SearchBuilder<ClusterVO> ZoneSearch;
+    protected final SearchBuilder<ClusterVO> ZoneHyTypeSearch;
+
+    private static final String GET_POD_CLUSTER_MAP_PREFIX = "SELECT pod_id, id FROM cloud.cluster WHERE cluster.id IN( ";
+    private static final String GET_POD_CLUSTER_MAP_SUFFIX = " )";
+    @Inject
+    protected HostPodDao _hostPodDao;
+
+    public ClusterDaoImpl() {
+        super();
+
+        HyTypeWithoutGuidSearch = createSearchBuilder();
+        HyTypeWithoutGuidSearch.and("hypervisorType", HyTypeWithoutGuidSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ);
+        HyTypeWithoutGuidSearch.and("guid", HyTypeWithoutGuidSearch.entity().getGuid(), SearchCriteria.Op.NULL);
+        HyTypeWithoutGuidSearch.done();
+
+        ZoneHyTypeSearch = createSearchBuilder();
+        ZoneHyTypeSearch.and("hypervisorType", ZoneHyTypeSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ);
+        ZoneHyTypeSearch.and("dataCenterId", ZoneHyTypeSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        ZoneHyTypeSearch.done();
+
+        PodSearch = createSearchBuilder();
+        PodSearch.and("pod", PodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
+        PodSearch.and("name", PodSearch.entity().getName(), SearchCriteria.Op.EQ);
+        PodSearch.done();
+
+        ZoneSearch = createSearchBuilder();
+        ZoneSearch.and("dataCenterId", ZoneSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        ZoneSearch.groupBy(ZoneSearch.entity().getHypervisorType());
+        ZoneSearch.done();
+
+        AvailHyperSearch = createSearchBuilder();
+        AvailHyperSearch.and("zoneId", AvailHyperSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        AvailHyperSearch.select(null, Func.DISTINCT, AvailHyperSearch.entity().getHypervisorType());
+        AvailHyperSearch.done();
+    }
+
+    @Override
+    public List<ClusterVO> listByZoneId(long zoneId) {
+        SearchCriteria<ClusterVO> sc = ZoneSearch.create();
+        sc.setParameters("dataCenterId", zoneId);        
+        return listBy(sc);
+    }
+
+    @Override
+    public List<ClusterVO> listByPodId(long podId) {
+        SearchCriteria<ClusterVO> sc = PodSearch.create();
+        sc.setParameters("pod", podId);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public ClusterVO findBy(String name, long podId) {
+        SearchCriteria<ClusterVO> sc = PodSearch.create();
+        sc.setParameters("pod", podId);
+        sc.setParameters("name", name);
+
+        return findOneBy(sc);
+    }
+
+    @Override
+    public List<ClusterVO> listByHyTypeWithoutGuid(String hyType) {
+        SearchCriteria<ClusterVO> sc = HyTypeWithoutGuidSearch.create();
+        sc.setParameters("hypervisorType", hyType);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<ClusterVO> listByDcHyType(long dcId, String hyType) {
+        SearchCriteria<ClusterVO> sc = ZoneHyTypeSearch.create();
+        sc.setParameters("dataCenterId", dcId);
+        sc.setParameters("hypervisorType", hyType);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<HypervisorType> getAvailableHypervisorInZone(Long zoneId) {
+        SearchCriteria<ClusterVO> sc = AvailHyperSearch.create();
+        if (zoneId != null) {
+            sc.setParameters("zoneId", zoneId);
+        }
+        List<ClusterVO> clusters = listBy(sc);
+        List<HypervisorType> hypers = new ArrayList<HypervisorType>(4);
+        for (ClusterVO cluster : clusters) {
+            hypers.add(cluster.getHypervisorType());
+        }
+
+        return hypers;
+    }
+
+    @Override
+    public Map<Long, List<Long>> getPodClusterIdMap(List<Long> clusterIds){
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        Map<Long, List<Long>> result = new HashMap<Long, List<Long>>();
+
+        try {
+            StringBuilder sql = new StringBuilder(GET_POD_CLUSTER_MAP_PREFIX);
+            if (clusterIds.size() > 0) {
+                for (Long clusterId : clusterIds) {
+                    sql.append(clusterId).append(",");
+                }
+                sql.delete(sql.length()-1, sql.length());
+                sql.append(GET_POD_CLUSTER_MAP_SUFFIX);
+            }
+
+            pstmt = txn.prepareAutoCloseStatement(sql.toString());
+            ResultSet rs = pstmt.executeQuery();
+            while (rs.next()) {
+                Long podId = rs.getLong(1);
+                Long clusterIdInPod  = rs.getLong(2);
+                if(result.containsKey(podId)){
+                    List<Long> clusterList = result.get(podId);
+                    clusterList.add(clusterIdInPod);
+                    result.put(podId, clusterList);
+                }else{
+                    List<Long> clusterList = new ArrayList<Long>();
+                    clusterList.add(clusterIdInPod);
+                    result.put(podId, clusterList);
+                }
+            }
+            return result;
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("DB Exception on: " + GET_POD_CLUSTER_MAP_PREFIX, e);
+        } catch (Throwable e) {
+            throw new CloudRuntimeException("Caught: " + GET_POD_CLUSTER_MAP_PREFIX, e);
+        }
+    }
+
+    @Override
+    public List<Long> listDisabledClusters(long zoneId, Long podId) {
+        GenericSearchBuilder<ClusterVO, Long> clusterIdSearch = createSearchBuilder(Long.class);
+        clusterIdSearch.selectField(clusterIdSearch.entity().getId());
+        clusterIdSearch.and("dataCenterId", clusterIdSearch.entity().getDataCenterId(), Op.EQ);
+        if(podId != null){
+            clusterIdSearch.and("podId", clusterIdSearch.entity().getPodId(), Op.EQ);
+        }
+        clusterIdSearch.and("allocationState", clusterIdSearch.entity().getAllocationState(), Op.EQ);
+        clusterIdSearch.done();
+
+
+        SearchCriteria<Long> sc = clusterIdSearch.create();
+        sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId);
+        if (podId != null) {
+            sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
+        }
+        sc.addAnd("allocationState", SearchCriteria.Op.EQ, Grouping.AllocationState.Disabled);
+        return customSearch(sc, null);
+    }
+
+    @Override
+    public List<Long> listClustersWithDisabledPods(long zoneId) {
+
+        GenericSearchBuilder<HostPodVO, Long> disabledPodIdSearch = _hostPodDao.createSearchBuilder(Long.class);
+        disabledPodIdSearch.selectField(disabledPodIdSearch.entity().getId());
+        disabledPodIdSearch.and("dataCenterId", disabledPodIdSearch.entity().getDataCenterId(), Op.EQ);
+        disabledPodIdSearch.and("allocationState", disabledPodIdSearch.entity().getAllocationState(), Op.EQ);
+
+        GenericSearchBuilder<ClusterVO, Long> clusterIdSearch = createSearchBuilder(Long.class);
+        clusterIdSearch.selectField(clusterIdSearch.entity().getId());
+        clusterIdSearch.join("disabledPodIdSearch", disabledPodIdSearch, clusterIdSearch.entity().getPodId(), disabledPodIdSearch.entity().getId(), JoinBuilder.JoinType.INNER);
+        clusterIdSearch.done();
+
+
+        SearchCriteria<Long> sc = clusterIdSearch.create();
+        sc.setJoinParameters("disabledPodIdSearch", "dataCenterId", zoneId);
+        sc.setJoinParameters("disabledPodIdSearch", "allocationState", Grouping.AllocationState.Disabled);
+
+        return customSearch(sc, null);
+    }
+
+    @Override
+    public boolean remove(Long id) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        ClusterVO cluster = createForUpdate();
+        cluster.setName(null);
+        cluster.setGuid(null);
+
+        update(id, cluster);
+
+        boolean result = super.remove(id);
+        txn.commit();
+        return result;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/ClusterVSMMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/ClusterVSMMapDao.java b/engine/schema/src/com/cloud/dc/dao/ClusterVSMMapDao.java
new file mode 100644
index 0000000..ae08e59
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/ClusterVSMMapDao.java
@@ -0,0 +1,29 @@
+// 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.dc.dao;
+
+import java.util.List;
+
+import com.cloud.dc.ClusterVSMMapVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface ClusterVSMMapDao extends GenericDao<ClusterVSMMapVO, Long> {
+    ClusterVSMMapVO findByClusterId(long clusterId);
+    List<ClusterVSMMapVO> listByVSMId(long vsmId);
+    boolean removeByVsmId(long vsmId);
+    boolean removeByClusterId(long clusterId);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java
new file mode 100644
index 0000000..b12fa9d
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java
@@ -0,0 +1,95 @@
+// 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.dc.dao;
+
+import java.util.List;
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.ClusterVSMMapVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value=ClusterVSMMapDao.class)
+@DB(txn = false)
+public class ClusterVSMMapDaoImpl extends GenericDaoBase<ClusterVSMMapVO, Long> implements ClusterVSMMapDao {
+
+    final SearchBuilder<ClusterVSMMapVO> ClusterSearch;
+    final SearchBuilder<ClusterVSMMapVO> VsmSearch;
+    
+    public ClusterVSMMapDaoImpl() {
+        //super();
+        
+        ClusterSearch = createSearchBuilder();
+        ClusterSearch.and("clusterId", ClusterSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
+        ClusterSearch.done();
+        
+        VsmSearch = createSearchBuilder();
+        VsmSearch.and("vsmId", VsmSearch.entity().getVsmId(), SearchCriteria.Op.EQ);
+        VsmSearch.done();
+    }
+
+    @Override
+    public boolean removeByVsmId(long vsmId) {
+    	SearchCriteria<ClusterVSMMapVO> sc = VsmSearch.create();
+    	sc.setParameters("vsmId", vsmId);
+    	this.remove(sc);
+    	return true;
+    }
+    
+    @Override
+    public boolean removeByClusterId(long clusterId) {
+    	SearchCriteria<ClusterVSMMapVO> sc = ClusterSearch.create();
+    	sc.setParameters("clusterId", clusterId);
+    	this.remove(sc);
+    	return true;
+    }
+    
+    @Override
+    public ClusterVSMMapVO findByClusterId(long clusterId) {
+        SearchCriteria<ClusterVSMMapVO> sc = ClusterSearch.create();
+        sc.setParameters("clusterId", clusterId);        
+        return findOneBy(sc);
+    }
+
+    @Override
+    public List<ClusterVSMMapVO> listByVSMId(long vsmId) {
+    	SearchCriteria<ClusterVSMMapVO> sc = VsmSearch.create();
+    	sc.setParameters("vsmId", vsmId);
+    	return listBy(sc);
+    }
+    
+    public boolean remove(Long id) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        ClusterVSMMapVO cluster = createForUpdate();
+        //cluster.setClusterId(null);
+        //cluster.setVsmId(null);
+        
+        update(id, cluster);
+
+        boolean result = super.remove(id);
+        txn.commit();
+        return result;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/DataCenterDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterDao.java b/engine/schema/src/com/cloud/dc/dao/DataCenterDao.java
new file mode 100755
index 0000000..e54b9bb
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/DataCenterDao.java
@@ -0,0 +1,82 @@
+// 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.dc.dao;
+
+import java.util.List;
+
+import com.cloud.dc.DataCenterIpAddressVO;
+import com.cloud.dc.DataCenterVO;
+import com.cloud.dc.DataCenterVnetVO;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.GenericDao;
+
+public interface DataCenterDao extends GenericDao<DataCenterVO, Long> {
+    DataCenterVO findByName(String name);
+    
+    /**
+     * @param id data center id
+     * @return a pair of mac address strings.  The first one is private and second is public.
+     */
+    String[] getNextAvailableMacAddressPair(long id);
+    String[] getNextAvailableMacAddressPair(long id, long mask);
+    Pair<String, Long> allocatePrivateIpAddress(long id, long podId, long instanceId, String reservationId);
+    DataCenterIpAddressVO allocatePrivateIpAddress(long id, String reservationId);
+    String allocateLinkLocalIpAddress(long id, long podId, long instanceId, String reservationId);
+    String allocateVnet(long dcId, long physicalNetworkId, long accountId, String reservationId);
+    
+    void releaseVnet(String vnet, long dcId, long physicalNetworkId, long accountId, String reservationId);
+    void releasePrivateIpAddress(String ipAddress, long dcId, Long instanceId);
+    void releasePrivateIpAddress(long nicId, String reservationId);
+    void releaseLinkLocalIpAddress(String ipAddress, long dcId, Long instanceId);
+    void releaseLinkLocalIpAddress(long nicId, String reservationId);
+    
+    boolean deletePrivateIpAddressByPod(long podId);
+    boolean deleteLinkLocalIpAddressByPod(long podId);
+    
+    void addPrivateIpAddress(long dcId,long podId, String start, String end);
+    void addLinkLocalIpAddress(long dcId,long podId, String start, String end);
+    
+    List<DataCenterVnetVO> findVnet(long dcId, long physicalNetworkId, String vnet);
+
+    String allocatePodVlan(long podId, long accountId);
+
+	List<DataCenterVO> findZonesByDomainId(Long domainId);
+
+	List<DataCenterVO> listPublicZones(String keyword);
+
+	List<DataCenterVO> findChildZones(Object[] ids, String keyword);
+
+    void loadDetails(DataCenterVO zone);
+    void saveDetails(DataCenterVO zone);
+    
+    List<DataCenterVO> listDisabledZones();
+    List<DataCenterVO> listEnabledZones();
+    DataCenterVO findByToken(String zoneToken);    
+    DataCenterVO findByTokenOrIdOrName(String tokenIdOrName);
+
+	int countZoneVlans(long dcId, boolean onlyCountAllocated);
+    
+    void addVnet(long dcId, long physicalNetworkId, int start, int end);
+    void deleteVnet(long physicalNetworkId);
+    List<DataCenterVnetVO> listAllocatedVnets(long physicalNetworkId);
+
+	List<DataCenterVO> findZonesByDomainId(Long domainId, String keyword);
+
+	List<DataCenterVO> findByKeyword(String keyword);
+
+    List<DataCenterVO> listAllZones();
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java
new file mode 100755
index 0000000..4d9d010
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java
@@ -0,0 +1,425 @@
+// 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.dc.dao;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+import javax.persistence.TableGenerator;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.DataCenterIpAddressVO;
+import com.cloud.dc.DataCenterLinkLocalIpAddressVO;
+import com.cloud.dc.DataCenterVO;
+import com.cloud.dc.DataCenterVnetVO;
+import com.cloud.dc.PodVlanVO;
+import com.cloud.network.dao.AccountGuestVlanMapDao;
+import com.cloud.network.dao.AccountGuestVlanMapVO;
+import com.cloud.org.Grouping;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SequenceFetcher;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.net.NetUtils;
+
+/**
+ * @config
+ * {@table
+ *    || Param Name | Description | Values | Default ||
+ *    || mac.address.prefix | prefix to attach to all public and private mac addresses | number | 06 ||
+ *  }
+ **/
+@Component
+@Local(value={DataCenterDao.class})
+public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implements DataCenterDao {
+    private static final Logger s_logger = Logger.getLogger(DataCenterDaoImpl.class);
+
+    protected SearchBuilder<DataCenterVO> NameSearch;
+    protected SearchBuilder<DataCenterVO> ListZonesByDomainIdSearch;
+    protected SearchBuilder<DataCenterVO> PublicZonesSearch;
+    protected SearchBuilder<DataCenterVO> ChildZonesSearch;
+    protected SearchBuilder<DataCenterVO> DisabledZonesSearch;
+    protected SearchBuilder<DataCenterVO> TokenSearch;
+
+    @Inject protected DataCenterIpAddressDao _ipAllocDao = null;
+    @Inject protected DataCenterLinkLocalIpAddressDao _LinkLocalIpAllocDao = null;
+    @Inject protected DataCenterVnetDao _vnetAllocDao = null;
+    @Inject protected PodVlanDao _podVlanAllocDao = null;
+    @Inject protected DcDetailsDao _detailsDao = null;
+    @Inject protected AccountGuestVlanMapDao _accountGuestVlanMapDao = null;
+
+    protected long _prefix;
+    protected Random _rand = new Random(System.currentTimeMillis());
+    protected TableGenerator _tgMacAddress;
+
+
+    @Override
+    public DataCenterVO findByName(String name) {
+        SearchCriteria<DataCenterVO> sc = NameSearch.create();
+        sc.setParameters("name", name);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public DataCenterVO findByToken(String zoneToken){
+        SearchCriteria<DataCenterVO> sc = TokenSearch.create();
+        sc.setParameters("zoneToken", zoneToken);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public List<DataCenterVO> findZonesByDomainId(Long domainId){
+        SearchCriteria<DataCenterVO> sc = ListZonesByDomainIdSearch.create();
+        sc.setParameters("domainId", domainId);
+        return listBy(sc);    	
+    }
+
+    @Override
+    public List<DataCenterVO> findZonesByDomainId(Long domainId, String keyword){
+        SearchCriteria<DataCenterVO> sc = ListZonesByDomainIdSearch.create();
+        sc.setParameters("domainId", domainId);
+        if (keyword != null) {
+            SearchCriteria<DataCenterVO> ssc = createSearchCriteria();
+            ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
+            ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%");
+            sc.addAnd("name", SearchCriteria.Op.SC, ssc);
+        }
+        return listBy(sc);    	
+    }
+
+    @Override
+    public List<DataCenterVO> findChildZones(Object[] ids, String keyword){
+        SearchCriteria<DataCenterVO> sc = ChildZonesSearch.create();
+        sc.setParameters("domainid", ids);
+        if (keyword != null) {
+            SearchCriteria<DataCenterVO> ssc = createSearchCriteria();
+            ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
+            ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%");
+            sc.addAnd("name", SearchCriteria.Op.SC, ssc);
+        }
+        return listBy(sc);  
+    }
+
+    @Override
+    public List<DataCenterVO> listPublicZones(String keyword){
+        SearchCriteria<DataCenterVO> sc = PublicZonesSearch.create();
+        if (keyword != null) {
+            SearchCriteria<DataCenterVO> ssc = createSearchCriteria();
+            ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
+            ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%");
+            sc.addAnd("name", SearchCriteria.Op.SC, ssc);
+        }
+        //sc.setParameters("domainId", domainId);
+        return listBy(sc);    	    	
+    }
+
+    @Override
+    public List<DataCenterVO> findByKeyword(String keyword){
+        SearchCriteria<DataCenterVO> ssc = createSearchCriteria();
+        ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
+        ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%");
+        return listBy(ssc);
+    }
+
+    @Override
+    public void releaseVnet(String vnet, long dcId, long physicalNetworkId, long accountId, String reservationId) {
+        _vnetAllocDao.release(vnet, physicalNetworkId, accountId, reservationId);
+    }
+
+    @Override
+    public List<DataCenterVnetVO> findVnet(long dcId, long physicalNetworkId, String vnet) {
+        return _vnetAllocDao.findVnet(dcId, physicalNetworkId, vnet);
+    }
+
+    @Override
+    public int countZoneVlans(long dcId, boolean onlyCountAllocated){    	
+        return _vnetAllocDao.countZoneVlans(dcId, onlyCountAllocated);
+    }
+
+    @Override
+    public void releasePrivateIpAddress(String ipAddress, long dcId, Long instanceId) {
+        _ipAllocDao.releaseIpAddress(ipAddress, dcId, instanceId);
+    }
+
+    @Override
+    public void releasePrivateIpAddress(long nicId, String reservationId) {
+        _ipAllocDao.releaseIpAddress(nicId, reservationId);
+    }
+
+    @Override
+    public void releaseLinkLocalIpAddress(long nicId, String reservationId) {
+        _LinkLocalIpAllocDao.releaseIpAddress(nicId, reservationId);
+    }
+
+    @Override
+    public void releaseLinkLocalIpAddress(String ipAddress, long dcId, Long instanceId) {
+        _LinkLocalIpAllocDao.releaseIpAddress(ipAddress, dcId, instanceId);
+    }
+
+    @Override
+    public boolean deletePrivateIpAddressByPod(long podId) {
+        return _ipAllocDao.deleteIpAddressByPod(podId);
+    }
+
+    @Override
+    public boolean deleteLinkLocalIpAddressByPod(long podId) {
+        return _LinkLocalIpAllocDao.deleteIpAddressByPod(podId);
+    }
+
+    @Override
+    public String allocateVnet(long dataCenterId, long physicalNetworkId, long accountId, String reservationId) {
+        ArrayList<Long> dedicatedVlanDbIds = new ArrayList<Long>();
+        List<AccountGuestVlanMapVO> maps = _accountGuestVlanMapDao.listAccountGuestVlanMapsByAccount(accountId);
+        for (AccountGuestVlanMapVO map : maps) {
+            dedicatedVlanDbIds.add(map.getId());
+        }
+        if (dedicatedVlanDbIds != null && !dedicatedVlanDbIds.isEmpty()) {
+            DataCenterVnetVO vo = _vnetAllocDao.take(physicalNetworkId, accountId, reservationId, dedicatedVlanDbIds);
+            if (vo != null)
+                return vo.getVnet();
+        }
+        DataCenterVnetVO vo = _vnetAllocDao.take(physicalNetworkId, accountId, reservationId, null);
+        if (vo == null) {
+            return null;
+        }
+        return vo.getVnet();
+    }
+
+    @Override
+    public String allocatePodVlan(long podId, long accountId) {
+        PodVlanVO vo = _podVlanAllocDao.take(podId, accountId);
+        if (vo == null) {
+            return null;
+        }
+        return vo.getVlan();
+    }
+
+    @Override
+    public String[] getNextAvailableMacAddressPair(long id) {
+        return getNextAvailableMacAddressPair(id, 0);
+    }
+
+    @Override
+    public String[] getNextAvailableMacAddressPair(long id, long mask) {
+        SequenceFetcher fetch = SequenceFetcher.getInstance();
+
+        long seq = fetch.getNextSequence(Long.class, _tgMacAddress, id);
+        seq = seq | _prefix | ((id & 0x7f) << 32);
+        seq |= mask;
+        seq |= ((_rand.nextInt(Short.MAX_VALUE) << 16) & 0x00000000ffff0000l);
+        String[] pair = new String[2];
+        pair[0] = NetUtils.long2Mac(seq);
+        pair[1] = NetUtils.long2Mac(seq | 0x1l << 39);
+        return pair;
+    }
+
+    @Override
+    public Pair<String, Long> allocatePrivateIpAddress(long dcId, long podId, long instanceId, String reservationId) {
+        DataCenterIpAddressVO vo = _ipAllocDao.takeIpAddress(dcId, podId, instanceId, reservationId);
+        if (vo == null) {
+            return null;
+        }
+        return new Pair<String, Long>(vo.getIpAddress(), vo.getMacAddress());
+    }
+
+    @Override
+    public DataCenterIpAddressVO allocatePrivateIpAddress(long dcId, String reservationId) {
+        DataCenterIpAddressVO vo = _ipAllocDao.takeDataCenterIpAddress(dcId, reservationId);
+        return vo;
+    }
+
+    @Override
+    public String allocateLinkLocalIpAddress(long dcId, long podId, long instanceId, String reservationId) {
+        DataCenterLinkLocalIpAddressVO vo = _LinkLocalIpAllocDao.takeIpAddress(dcId, podId, instanceId, reservationId);
+        if (vo == null) {
+            return null;
+        }
+        return vo.getIpAddress();
+    }
+
+    @Override
+    public void addVnet(long dcId, long physicalNetworkId, int start, int end) {
+        _vnetAllocDao.add(dcId, physicalNetworkId, start, end);
+    }
+
+    @Override
+    public void deleteVnet(long physicalNetworkId) {
+        _vnetAllocDao.delete(physicalNetworkId);
+    }
+
+    @Override
+    public List<DataCenterVnetVO> listAllocatedVnets(long physicalNetworkId) {
+        return _vnetAllocDao.listAllocatedVnets(physicalNetworkId);
+    }    
+
+    @Override
+    public void addPrivateIpAddress(long dcId,long podId, String start, String end) {
+        _ipAllocDao.addIpRange(dcId, podId, start, end);
+    }
+
+    @Override
+    public void addLinkLocalIpAddress(long dcId,long podId, String start, String end) {
+        _LinkLocalIpAllocDao.addIpRange(dcId, podId, start, end);
+    }
+
+    @Override
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        if (!super.configure(name, params)) {
+            return false;
+        }
+
+        String value = (String)params.get("mac.address.prefix");
+        _prefix = (long)NumbersUtil.parseInt(value, 06) << 40;
+
+        if (!_ipAllocDao.configure("Ip Alloc", params)) {
+            return false;
+        }
+
+        if (!_vnetAllocDao.configure("vnet Alloc", params)) {
+            return false;
+        }
+        return true;
+    }
+
+    public DataCenterDaoImpl() {
+        super();
+        NameSearch = createSearchBuilder();
+        NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ);
+        NameSearch.done();
+
+        ListZonesByDomainIdSearch = createSearchBuilder();
+        ListZonesByDomainIdSearch.and("domainId", ListZonesByDomainIdSearch.entity().getDomainId(), SearchCriteria.Op.EQ);
+        ListZonesByDomainIdSearch.done();
+
+        PublicZonesSearch = createSearchBuilder();
+        PublicZonesSearch.and("domainId", PublicZonesSearch.entity().getDomainId(), SearchCriteria.Op.NULL);
+        PublicZonesSearch.done();        
+
+        ChildZonesSearch = createSearchBuilder();
+        ChildZonesSearch.and("domainid", ChildZonesSearch.entity().getDomainId(), SearchCriteria.Op.IN);
+        ChildZonesSearch.done();
+
+        DisabledZonesSearch = createSearchBuilder();
+        DisabledZonesSearch.and("allocationState", DisabledZonesSearch.entity().getAllocationState(), SearchCriteria.Op.EQ);
+        DisabledZonesSearch.done();
+
+        TokenSearch = createSearchBuilder();
+        TokenSearch.and("zoneToken", TokenSearch.entity().getZoneToken(), SearchCriteria.Op.EQ);
+        TokenSearch.done();                
+
+        _tgMacAddress = _tgs.get("macAddress");
+        assert _tgMacAddress != null : "Couldn't get mac address table generator";
+    }
+
+    @Override @DB
+    public boolean update(Long zoneId, DataCenterVO zone) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        boolean persisted = super.update(zoneId, zone);
+        if (!persisted) {
+            return persisted;
+        }
+        saveDetails(zone);
+        txn.commit();
+        return persisted;
+    }
+
+    @Override
+    public void loadDetails(DataCenterVO zone) {
+        Map<String, String> details =_detailsDao.findDetails(zone.getId());
+        zone.setDetails(details);
+    }
+
+    @Override
+    public void saveDetails(DataCenterVO zone) {
+        Map<String, String> details = zone.getDetails();
+        if (details == null) {
+            return;
+        }
+        _detailsDao.persist(zone.getId(), details);
+    }
+
+    @Override
+    public List<DataCenterVO> listDisabledZones(){
+        SearchCriteria<DataCenterVO> sc = DisabledZonesSearch.create();
+        sc.setParameters("allocationState", Grouping.AllocationState.Disabled);
+
+        List<DataCenterVO> dcs =  listBy(sc);
+
+        return dcs;
+    }
+
+    @Override
+    public List<DataCenterVO> listEnabledZones(){
+        SearchCriteria<DataCenterVO> sc = DisabledZonesSearch.create();
+        sc.setParameters("allocationState", Grouping.AllocationState.Enabled);
+
+        List<DataCenterVO> dcs =  listBy(sc);
+
+        return dcs;
+    }
+
+    @Override
+    public DataCenterVO findByTokenOrIdOrName(String tokenOrIdOrName) {
+        DataCenterVO result = findByToken(tokenOrIdOrName);
+        if (result == null) {
+            result = findByName(tokenOrIdOrName);
+            if (result == null) {
+                try {
+                    Long dcId = Long.parseLong(tokenOrIdOrName);
+                    return findById(dcId);
+                } catch (NumberFormatException nfe) {
+
+                }
+            }
+        }
+        return result;
+    }
+
+    @Override
+    public boolean remove(Long id) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        DataCenterVO zone = createForUpdate();
+        zone.setName(null);
+
+        update(id, zone);
+
+        boolean result = super.remove(id);
+        txn.commit();
+        return result;
+    }
+    
+    @Override
+    public List<DataCenterVO> listAllZones(){
+        SearchCriteria<DataCenterVO> sc = NameSearch.create();
+        List<DataCenterVO> dcs =  listBy(sc);
+
+        return dcs;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDao.java b/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDao.java
new file mode 100644
index 0000000..7a19b24
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDao.java
@@ -0,0 +1,38 @@
+// 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.dc.dao;
+
+import java.util.List;
+
+import com.cloud.dc.DataCenterIpAddressVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface DataCenterIpAddressDao extends GenericDao<DataCenterIpAddressVO, Long> {
+    
+    public DataCenterIpAddressVO takeIpAddress(long dcId, long podId, long instanceId, String reservationId);
+    public DataCenterIpAddressVO takeDataCenterIpAddress(long dcId, String reservationId);
+    public void addIpRange(long dcId, long podId, String start, String end);
+    public void releaseIpAddress(String ipAddress, long dcId, Long instanceId);
+    public void releaseIpAddress(long nicId, String reservationId);
+
+    boolean mark(long dcId, long podId, String ip);
+    List<DataCenterIpAddressVO> listByPodIdDcIdIpAddress(long podId, long dcId, String ipAddress);
+    List<DataCenterIpAddressVO> listByPodIdDcId(long podId, long dcId);
+    int countIPs(long podId, long dcId, boolean onlyCountAllocated);
+    boolean deleteIpAddressByPod(long podId);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java
new file mode 100755
index 0000000..353402d
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java
@@ -0,0 +1,225 @@
+// 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.dc.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.Date;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.DataCenterIpAddressVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+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.utils.net.NetUtils;
+
+@Component
+@Local(value={DataCenterIpAddressDao.class}) @DB(txn=false)
+public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddressVO, Long> implements DataCenterIpAddressDao {
+    private static final Logger s_logger = Logger.getLogger(DataCenterIpAddressDaoImpl.class);
+    
+    private final SearchBuilder<DataCenterIpAddressVO> AllFieldsSearch;
+    private final GenericSearchBuilder<DataCenterIpAddressVO, Integer> AllIpCount;
+    private final GenericSearchBuilder<DataCenterIpAddressVO, Integer> AllAllocatedIpCount;
+    
+    @DB
+    public DataCenterIpAddressVO takeIpAddress(long dcId, long podId, long instanceId, String reservationId) {
+        SearchCriteria<DataCenterIpAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("pod", podId);
+        sc.setParameters("taken", (Date)null);
+        
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        DataCenterIpAddressVO  vo = lockOneRandomRow(sc, true);
+        if (vo == null) {
+            txn.rollback();
+            return null;
+        }
+        vo.setTakenAt(new Date());
+        vo.setInstanceId(instanceId);
+        vo.setReservationId(reservationId);
+        update(vo.getId(), vo);
+        txn.commit();
+        return vo;
+    }
+
+    @DB
+    public DataCenterIpAddressVO takeDataCenterIpAddress(long dcId, String reservationId) {
+        SearchCriteria<DataCenterIpAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("dc", dcId);
+        sc.setParameters("taken", (Date)null);
+        
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        DataCenterIpAddressVO  vo = lockOneRandomRow(sc, true);
+        if (vo == null) {
+            txn.rollback();
+            return null;
+        }
+        vo.setTakenAt(new Date());
+        vo.setReservationId(reservationId);
+        update(vo.getId(), vo);
+        txn.commit();
+        return vo;
+    }
+
+    @Override
+    public boolean deleteIpAddressByPod(long podId) {
+        SearchCriteria<DataCenterIpAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("pod", podId);
+        return remove(sc) > 0;
+    }
+    
+    @Override
+    public boolean mark(long dcId, long podId, String ip) {
+        SearchCriteria<DataCenterIpAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("pod", podId);
+        sc.setParameters("ipAddress", ip);
+        
+        DataCenterIpAddressVO vo = createForUpdate();
+        vo.setTakenAt(new Date());
+        
+        return update(vo, sc) >= 1;
+    }
+    
+    @DB
+    public void addIpRange(long dcId, long podId, String start, String end) {
+        Transaction txn = Transaction.currentTxn();
+        String insertSql = "INSERT INTO `cloud`.`op_dc_ip_address_alloc` (ip_address, data_center_id, pod_id, mac_address) VALUES (?, ?, ?, (select mac_address from `cloud`.`data_center` where id=?))";
+        String updateSql = "UPDATE `cloud`.`data_center` set mac_address = mac_address+1 where id=?";
+        PreparedStatement stmt = null;
+        
+        long startIP = NetUtils.ip2Long(start);
+        long endIP = NetUtils.ip2Long(end);
+        
+        try {
+            txn.start();
+            
+            while (startIP <= endIP) {
+                stmt = txn.prepareStatement(insertSql);
+                stmt.setString(1, NetUtils.long2Ip(startIP++));
+                stmt.setLong(2, dcId);
+                stmt.setLong(3, podId);
+                stmt.setLong(4, dcId);
+                stmt.executeUpdate();
+                stmt.close();
+                stmt = txn.prepareStatement(updateSql);
+                stmt.setLong(1, dcId);
+                stmt.executeUpdate();
+                stmt.close();
+            }
+            txn.commit();
+        } catch (SQLException ex) {
+            throw new CloudRuntimeException("Unable to persist ip address range ", ex);
+        } 
+    }
+    
+    public void releaseIpAddress(String ipAddress, long dcId, Long instanceId) {
+    	if (s_logger.isDebugEnabled()) {
+    		s_logger.debug("Releasing ip address: " + ipAddress + " data center " + dcId);
+    	}
+        SearchCriteria<DataCenterIpAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("ip", ipAddress);
+        sc.setParameters("dc", dcId);
+        sc.setParameters("instance", instanceId);
+
+        DataCenterIpAddressVO vo = createForUpdate();
+        
+        vo.setTakenAt(null);
+        vo.setInstanceId(null);
+        vo.setReservationId(null);
+        update(vo, sc);
+    }
+    
+    public void releaseIpAddress(long nicId, String reservationId) {
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Releasing ip address for reservationId=" + reservationId + ", instance=" + nicId);
+        }
+        SearchCriteria<DataCenterIpAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("instance", nicId);
+        sc.setParameters("reservation", reservationId);
+        
+        DataCenterIpAddressVO vo = createForUpdate();
+        vo.setTakenAt(null);
+        vo.setInstanceId(null);
+        vo.setReservationId(null);
+        update(vo, sc);
+    }
+    
+    public List<DataCenterIpAddressVO> listByPodIdDcId(long podId, long dcId) {
+		SearchCriteria<DataCenterIpAddressVO> sc = AllFieldsSearch.create();
+		sc.setParameters("pod", podId);
+		return listBy(sc);
+	}
+    
+    @Override
+    public List<DataCenterIpAddressVO> listByPodIdDcIdIpAddress(long podId, long dcId, String ipAddress) {
+    	SearchCriteria<DataCenterIpAddressVO> sc = AllFieldsSearch.create();
+		sc.setParameters("pod", podId);
+		sc.setParameters("ipAddress", ipAddress);
+		return listBy(sc);
+    }
+    
+    @Override
+    public int countIPs(long podId, long dcId, boolean onlyCountAllocated) {
+        SearchCriteria<Integer> sc;
+        if (onlyCountAllocated) { 
+            sc = AllAllocatedIpCount.create();
+        } else {
+            sc = AllIpCount.create();
+        }
+        
+        sc.setParameters("pod", podId);
+        List<Integer> count = customSearch(sc, null);
+        return count.get(0);
+	}
+    
+    public DataCenterIpAddressDaoImpl() {
+        super();
+        
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("ip", AllFieldsSearch.entity().getIpAddress(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("dc", AllFieldsSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("pod", AllFieldsSearch.entity().getPodId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("instance", AllFieldsSearch.entity().getInstanceId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("ipAddress", AllFieldsSearch.entity().getIpAddress(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("reservation", AllFieldsSearch.entity().getReservationId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("taken", AllFieldsSearch.entity().getTakenAt(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+        
+        AllIpCount = createSearchBuilder(Integer.class);
+        AllIpCount.select(null, Func.COUNT, AllIpCount.entity().getId());
+        AllIpCount.and("pod", AllIpCount.entity().getPodId(), SearchCriteria.Op.EQ);
+        AllIpCount.done();
+        
+        AllAllocatedIpCount = createSearchBuilder(Integer.class);
+        AllAllocatedIpCount.select(null, Func.COUNT, AllAllocatedIpCount.entity().getId());
+        AllAllocatedIpCount.and("pod", AllAllocatedIpCount.entity().getPodId(), SearchCriteria.Op.EQ);
+        AllAllocatedIpCount.and("removed", AllAllocatedIpCount.entity().getTakenAt(), SearchCriteria.Op.NNULL);
+        AllAllocatedIpCount.done();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDao.java b/engine/schema/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDao.java
new file mode 100644
index 0000000..7fe9467
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDao.java
@@ -0,0 +1,32 @@
+// 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.dc.dao;
+
+import java.util.List;
+
+import com.cloud.dc.DataCenterLinkLocalIpAddressVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface DataCenterLinkLocalIpAddressDao extends GenericDao<DataCenterLinkLocalIpAddressVO, Long>{
+    public DataCenterLinkLocalIpAddressVO takeIpAddress(long dcId, long podId, long instanceId, String reservationId);
+    public boolean deleteIpAddressByPod(long podId);
+    public void addIpRange(long dcId, long podId, String start, String end);
+    public void releaseIpAddress(String ipAddress, long dcId, long instanceId);
+    public void releaseIpAddress(long nicId, String reservationId);
+    public List<DataCenterLinkLocalIpAddressVO> listByPodIdDcId(long podId, long dcId);
+    public int countIPs(long podId, long dcId, boolean onlyCountAllocated);
+}


[56/57] [abbrv] git commit: updated refs/heads/master to f84b6ab

Posted by ni...@apache.org.
merge with master


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

Branch: refs/heads/master
Commit: 8d53b1ef05a45604d76b2cf80094f688edf15b44
Parents: 941a9a5 78ffb7a
Author: Nitin Mehta <ni...@citrix.com>
Authored: Mon May 13 16:36:41 2013 +0530
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Mon May 13 16:36:41 2013 +0530

----------------------------------------------------------------------
 api/src/com/cloud/agent/api/to/NetworkACLTO.java   |   49 +-
 api/src/com/cloud/event/EventTypes.java            |    8 +
 api/src/com/cloud/network/Network.java             |    3 +
 api/src/com/cloud/network/NetworkProfile.java      |   12 +
 .../network/element/NetworkACLServiceProvider.java |    3 +-
 .../cloud/network/firewall/NetworkACLService.java  |   51 --
 api/src/com/cloud/network/vpc/NetworkACL.java      |   36 +
 api/src/com/cloud/network/vpc/NetworkACLItem.java  |   80 +++
 .../com/cloud/network/vpc/NetworkACLService.java   |  125 ++++
 .../org/apache/cloudstack/api/ApiConstants.java    |    2 +
 api/src/org/apache/cloudstack/api/BaseCmd.java     |    2 +-
 .../apache/cloudstack/api/ResponseGenerator.java   |   20 +-
 .../command/user/network/CreateNetworkACLCmd.java  |  222 ++-----
 .../user/network/CreateNetworkACLListCmd.java      |  120 ++++
 .../api/command/user/network/CreateNetworkCmd.java |   15 +-
 .../command/user/network/DeleteNetworkACLCmd.java  |   43 +-
 .../user/network/DeleteNetworkACLListCmd.java      |   93 +++
 .../user/network/ListNetworkACLListsCmd.java       |  102 +++
 .../command/user/network/ListNetworkACLsCmd.java   |   46 +-
 .../user/network/ReplaceNetworkACLListCmd.java     |   98 +++
 .../user/network/UpdateNetworkACLItemCmd.java      |  173 +++++
 .../api/response/NetworkACLItemResponse.java       |  122 ++++
 .../api/response/NetworkACLResponse.java           |   78 +--
 client/tomcatconf/applicationContext.xml.in        |    3 +
 client/tomcatconf/commands.properties.in           |    6 +
 .../agent/api/routing/SetNetworkACLCommand.java    |   19 +-
 docs/en-US/Installation_Guide.xml                  |    1 +
 docs/en-US/gslb.xml                                |   21 +
 docs/en-US/storage-setup.xml                       |  192 +++++
 .../src/com/cloud/network/dao/NetworkDao.java      |    2 +
 .../src/com/cloud/network/dao/NetworkDaoImpl.java  |    9 +
 .../src/com/cloud/network/dao/NetworkVO.java       |   13 +
 .../src/com/cloud/upgrade/dao/Upgrade410to420.java |  159 +++++
 .../debian/config/opt/cloud/bin/vpc_acl.sh         |   11 +-
 .../cloud/network/resource/CiscoVnmcResource.java  |    8 +-
 .../network/resource/CiscoVnmcResourceTest.java    |   13 +-
 server/src/com/cloud/api/ApiDBUtils.java           |   31 +-
 server/src/com/cloud/api/ApiResponseHelper.java    |   73 ++-
 .../src/com/cloud/api/query/QueryManagerImpl.java  |    2 +
 .../src/com/cloud/network/NetworkManagerImpl.java  |   36 +-
 .../src/com/cloud/network/NetworkServiceImpl.java  |   37 +-
 .../network/element/VpcVirtualRouterElement.java   |    8 +-
 .../network/firewall/FirewallManagerImpl.java      |    4 +-
 .../router/VpcVirtualNetworkApplianceManager.java  |    7 +-
 .../VpcVirtualNetworkApplianceManagerImpl.java     |   29 +-
 .../com/cloud/network/vpc/NetworkACLItemDao.java   |   37 +
 .../com/cloud/network/vpc/NetworkACLItemVO.java    |  237 +++++++
 .../com/cloud/network/vpc/NetworkACLManager.java   |  120 +++-
 .../cloud/network/vpc/NetworkACLManagerImpl.java   |  538 ++++++---------
 .../cloud/network/vpc/NetworkACLServiceImpl.java   |  448 ++++++++++++
 server/src/com/cloud/network/vpc/NetworkACLVO.java |   79 +++
 server/src/com/cloud/network/vpc/VpcManager.java   |    3 +-
 .../src/com/cloud/network/vpc/VpcManagerImpl.java  |    9 +-
 .../com/cloud/network/vpc/dao/NetworkACLDao.java   |   23 +
 .../cloud/network/vpc/dao/NetworkACLDaoImpl.java   |   35 +
 .../network/vpc/dao/NetworkACLItemDaoImpl.java     |  113 +++
 .../src/com/cloud/server/ManagementServerImpl.java |   40 +-
 .../com/cloud/tags/TaggedResourceManagerImpl.java  |    4 +
 .../com/cloud/network/MockNetworkManagerImpl.java  |    8 +-
 .../test/com/cloud/vpc/MockNetworkManagerImpl.java |    3 +
 server/test/com/cloud/vpc/MockVpcManagerImpl.java  |   10 +-
 .../vpc/MockVpcVirtualNetworkApplianceManager.java |   10 +-
 .../test/com/cloud/vpc/NetworkACLManagerTest.java  |  195 ++++++
 .../test/com/cloud/vpc/NetworkACLServiceTest.java  |  219 ++++++
 .../test/com/cloud/vpc/dao/MockNetworkDaoImpl.java |    5 +
 setup/db/db/schema-410to420.sql                    |   43 ++
 test/integration/smoke/test_network_acl.py         |  119 ++++
 tools/marvin/setup.py                              |   14 +-
 ui/scripts/events.js                               |   10 +-
 ui/scripts/vpc.js                                  |    9 +-
 70 files changed, 3687 insertions(+), 831 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/api/src/com/cloud/event/EventTypes.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/api/src/com/cloud/network/Network.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/api/src/com/cloud/network/NetworkProfile.java
----------------------------------------------------------------------
diff --cc api/src/com/cloud/network/NetworkProfile.java
index 7358b1a,1807021..fa63ea2
--- a/api/src/com/cloud/network/NetworkProfile.java
+++ b/api/src/com/cloud/network/NetworkProfile.java
@@@ -52,7 -52,7 +52,8 @@@ public class NetworkProfile implements 
      private boolean restartRequired;
      private boolean specifyIpRanges;
      private Long vpcId;
 +    private boolean displayNetwork;
+     private Long networkAclId;
  
      public NetworkProfile(Network network) {
          this.id = network.getId();
@@@ -82,7 -82,7 +83,8 @@@
          this.restartRequired = network.isRestartRequired();
          this.specifyIpRanges = network.getSpecifyIpRanges();
          this.vpcId = network.getVpcId();
 +        this.displayNetwork = network.getDisplayNetwork();
+         this.networkAclId = network.getNetworkACLId();
      }
  
      public String getDns1() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/api/src/org/apache/cloudstack/api/ResponseGenerator.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/ResponseGenerator.java
index ab8f995,16760c0..10bf305
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@@ -26,89 -33,7 +33,90 @@@ import com.cloud.network.vpc.VpcOfferin
  import org.apache.cloudstack.api.ApiConstants.HostDetails;
  import org.apache.cloudstack.api.ApiConstants.VMDetails;
  import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
 +import org.apache.cloudstack.api.response.AccountResponse;
 +import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
 +import org.apache.cloudstack.api.response.AsyncJobResponse;
 +import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
 +import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
 +import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
 +import org.apache.cloudstack.api.response.CapacityResponse;
 +import org.apache.cloudstack.api.response.ClusterResponse;
 +import org.apache.cloudstack.api.response.ConditionResponse;
 +import org.apache.cloudstack.api.response.ConfigurationResponse;
 +import org.apache.cloudstack.api.response.CounterResponse;
 +import org.apache.cloudstack.api.response.CreateCmdResponse;
 +import org.apache.cloudstack.api.response.DiskOfferingResponse;
 +import org.apache.cloudstack.api.response.DomainResponse;
 +import org.apache.cloudstack.api.response.DomainRouterResponse;
 +import org.apache.cloudstack.api.response.EventResponse;
 +import org.apache.cloudstack.api.response.ExtractResponse;
 +import org.apache.cloudstack.api.response.FirewallResponse;
 +import org.apache.cloudstack.api.response.FirewallRuleResponse;
 +import org.apache.cloudstack.api.response.GlobalLoadBalancerResponse;
 +import org.apache.cloudstack.api.response.GuestOSResponse;
 +import org.apache.cloudstack.api.response.GuestVlanRangeResponse;
 +import org.apache.cloudstack.api.response.HostForMigrationResponse;
 +import org.apache.cloudstack.api.response.HostResponse;
 +import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse;
 +import org.apache.cloudstack.api.response.IPAddressResponse;
 +import org.apache.cloudstack.api.response.InstanceGroupResponse;
 +import org.apache.cloudstack.api.response.InternalLoadBalancerElementResponse;
 +import org.apache.cloudstack.api.response.IpForwardingRuleResponse;
 +import org.apache.cloudstack.api.response.IsolationMethodResponse;
 +import org.apache.cloudstack.api.response.LBHealthCheckResponse;
 +import org.apache.cloudstack.api.response.LBStickinessResponse;
 +import org.apache.cloudstack.api.response.LDAPConfigResponse;
 +import org.apache.cloudstack.api.response.LoadBalancerResponse;
 +import org.apache.cloudstack.api.response.NetworkACLResponse;
 +import org.apache.cloudstack.api.response.NetworkOfferingResponse;
 +import org.apache.cloudstack.api.response.NetworkResponse;
 +import org.apache.cloudstack.api.response.NicResponse;
 +import org.apache.cloudstack.api.response.NicSecondaryIpResponse;
 +import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
 +import org.apache.cloudstack.api.response.PodResponse;
 +import org.apache.cloudstack.api.response.PrivateGatewayResponse;
 +import org.apache.cloudstack.api.response.ProjectAccountResponse;
 +import org.apache.cloudstack.api.response.ProjectInvitationResponse;
 +import org.apache.cloudstack.api.response.ProjectResponse;
 +import org.apache.cloudstack.api.response.ProviderResponse;
 +import org.apache.cloudstack.api.response.RegionResponse;
 +import org.apache.cloudstack.api.response.RemoteAccessVpnResponse;
 +import org.apache.cloudstack.api.response.ResourceCountResponse;
 +import org.apache.cloudstack.api.response.ResourceLimitResponse;
 +import org.apache.cloudstack.api.response.ResourceTagResponse;
 +import org.apache.cloudstack.api.response.S3Response;
 +import org.apache.cloudstack.api.response.SecurityGroupResponse;
 +import org.apache.cloudstack.api.response.ServiceOfferingResponse;
 +import org.apache.cloudstack.api.response.ServiceResponse;
 +import org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse;
 +import org.apache.cloudstack.api.response.Site2SiteVpnConnectionResponse;
 +import org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse;
 +import org.apache.cloudstack.api.response.SnapshotPolicyResponse;
 +import org.apache.cloudstack.api.response.SnapshotResponse;
 +import org.apache.cloudstack.api.response.SnapshotScheduleResponse;
 +import org.apache.cloudstack.api.response.StaticRouteResponse;
 +import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse;
 +import org.apache.cloudstack.api.response.StoragePoolForMigrationResponse;
 +import org.apache.cloudstack.api.response.StoragePoolResponse;
 +import org.apache.cloudstack.api.response.SwiftResponse;
 +import org.apache.cloudstack.api.response.SystemVmInstanceResponse;
 +import org.apache.cloudstack.api.response.SystemVmResponse;
 +import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
 +import org.apache.cloudstack.api.response.TemplateResponse;
 +import org.apache.cloudstack.api.response.TrafficMonitorResponse;
 +import org.apache.cloudstack.api.response.TrafficTypeResponse;
 +import org.apache.cloudstack.api.response.UsageRecordResponse;
 +import org.apache.cloudstack.api.response.UserResponse;
 +import org.apache.cloudstack.api.response.UserVmResponse;
 +import org.apache.cloudstack.api.response.VMSnapshotResponse;
 +import org.apache.cloudstack.api.response.VirtualRouterProviderResponse;
 +import org.apache.cloudstack.api.response.VlanIpRangeResponse;
 +import org.apache.cloudstack.api.response.VolumeResponse;
 +import org.apache.cloudstack.api.response.VpcOfferingResponse;
 +import org.apache.cloudstack.api.response.VpcResponse;
 +import org.apache.cloudstack.api.response.VpnUsersResponse;
 +import org.apache.cloudstack.api.response.ZoneResponse;
+ import org.apache.cloudstack.api.response.*;
  import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
  import org.apache.cloudstack.region.Region;
  import org.apache.cloudstack.usage.Usage;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
index 8c0f75e,e88aca7..667c4c8
--- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
@@@ -126,9 -120,9 +120,12 @@@ public class CreateNetworkCmd extends B
      @Parameter(name=ApiConstants.IP6_CIDR, type=CommandType.STRING, description="the CIDR of IPv6 network, must be at least /64")
      private String ip6Cidr;
  
 +    @Parameter(name=ApiConstants.DISPLAY_NETWORK, type=CommandType.BOOLEAN, description="an optional field, whether to the display the network to the end user or not.")
 +    private Boolean displayNetwork;
 +
+     @Parameter(name=ApiConstants.ACL_ID, type=CommandType.UUID, entityType = NetworkACLResponse.class,
+             description="Network ACL Id associated for the network")
+     private Long aclId;
      /////////////////////////////////////////////////////
      /////////////////// Accessors ///////////////////////
      /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/client/tomcatconf/applicationContext.xml.in
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/docs/en-US/gslb.xml
----------------------------------------------------------------------
diff --cc docs/en-US/gslb.xml
index 2303331,8070e30..1b692df
--- a/docs/en-US/gslb.xml
+++ b/docs/en-US/gslb.xml
@@@ -157,29 -157,15 +157,41 @@@
    </section>
    <section id="gslb-workflow">
      <title>Configuring GSLB</title>
++<<<<<<< HEAD
 +    <para>A GSLB deployment is the logical collection of GSLB virtual server, GSLB service, LB
 +      virtual server, service, domain, and ADNS service. To create a GSLB site, you must configure
 +      load balancing in the zone. You must create GSLB vservers and GSLB services for each site. You
 +      must bind GSLB services to GSLB vservers. You must then create an ADNS service that provides
 +      the IP address of the best performing site to the client's request. A GSLB vserver is an
 +      entity that performs load balancing for the domains bound to it by returning the IP address of
 +      the best GSLB service. A GSLB service is a representation of the load balancing/content
 +      switching vserver. An LB vserver load balances incoming traffic by identifying the best
 +      server, then directs traffic to the corresponding service. It can also load-balance external
 +      DNS name servers. Services are entities that represent the servers. The domain is the domain
 +      name for which the system is the authoritative DNS server. By creating an ADNS service, the
 +      system can be configured as an authoritative DNS server.</para>
 +    <para>To configure GSLB in your cloud environment, as a cloud administrator you must perform the
 +      following.</para>
 +    <para>To configure such a GSLB setup, you must first configure a standard load balancing setup
 +      for each zone. This enables you to balance load across the different servers in each zone in
 +      the region. Then, configure both NetScaler appliances that you plan to add to each zone as
 +      authoritative DNS (ADNS) servers. Next, create a GSLB site for each zone, configure GSLB
 +      virtual servers for each site, create GLSB services, and bind the GSLB services to the GSLB
 +      virtual servers. Finally, bind the domain to the GSLB virtual servers. The GSLB configurations
 +      on the two appliances at the two different sites are identical, although each sites
 +      load-balancing configuration is specific to that site.</para>
 +    <para>Perform the following as a cloud administrator. As per the above example, the
++=======
+     <para>To configure a GSLB deployment, you must first configure a standard load balancing setup
+       for each zone. This enables you to balance load across the different servers in each zone in
+       the region. Then on the NetScaler side, configure both NetScaler appliances that you plan to
+       add to each zone as authoritative DNS (ADNS) servers. Next, create a GSLB site for each zone,
+       configure GSLB virtual servers for each site, create GLSB services, and bind the GSLB services
+       to the GSLB virtual servers. Finally, bind the domain to the GSLB virtual servers. The GSLB
+       configurations on the two appliances at the two different zones are identical, although each
+       sites load-balancing configuration is specific to that site.</para>
+     <para>Perform the following as a cloud administrator. As per the example given above, the
++>>>>>>> master
        administrator of xyztelco is the one who sets up GSLB:</para>
      <orderedlist>
        <listitem>
@@@ -200,7 -186,9 +212,13 @@@
                  >Configuring an Authoritative DNS Service</ulink>.</para>
            </listitem>
            <listitem>
++<<<<<<< HEAD
 +            <para>Configure a GSLB site with site name formed from the domain name details.</para>
++=======
+             <para>Configure a GSLB site with the site name formed from the domain name.</para>
+             <para>As per the example given above, the site names are A.xyztelco.com and
+               B.xyztelco.com.</para>
++>>>>>>> master
              <para>For more information, see <ulink
                  url="http://support.citrix.com/proddocs/topic/netscaler-traffic-management-10-map/ns-gslb-config-basic-site-tsk.html"
                  >Configuring a Basic GSLB Site</ulink>.</para>
@@@ -459,7 -447,6 +477,10 @@@
      </section>
      <section id="assign-lb-gslb">
        <title>Assigning Load Balancing Rules to GSLB</title>
++<<<<<<< HEAD
 +      <para/>
++=======
++>>>>>>> master
        <orderedlist>
          <listitem>
            <para>Log in to the &PRODUCT; UI as a domain administrator or user.</para>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/engine/schema/src/com/cloud/network/dao/NetworkVO.java
----------------------------------------------------------------------
diff --cc engine/schema/src/com/cloud/network/dao/NetworkVO.java
index 9b0eec5,ee44349..6580ea0
--- a/engine/schema/src/com/cloud/network/dao/NetworkVO.java
+++ b/engine/schema/src/com/cloud/network/dao/NetworkVO.java
@@@ -160,9 -160,9 +160,12 @@@ public class NetworkVO implements Netwo
      @Column(name="ip6_cidr")
      String ip6Cidr;
  
 +    @Column(name="display_network", updatable=true, nullable=false)
 +    protected boolean displayNetwork = true;
 +
+     @Column(name="network_acl_id")
+     Long networkACLId;
+ 
      public NetworkVO() {
      	this.uuid = UUID.randomUUID().toString();
      }
@@@ -541,12 -541,13 +544,22 @@@
  		this.ip6Gateway = ip6Gateway;
  	}
  
 +    @Override()
 +    public boolean getDisplayNetwork() {
 +        return displayNetwork;
 +    }
 +
 +    public void setDisplayNetwork(boolean displayNetwork) {
 +        this.displayNetwork = displayNetwork;
 +    }
++
+     @Override
+     public void setNetworkACLId(Long networkACLId) {
+         this.networkACLId = networkACLId;
+     }
+ 
+     @Override
+     public Long getNetworkACLId() {
+         return networkACLId;
+     }
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
----------------------------------------------------------------------
diff --cc engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
index 3a164c4,6f36e21..1bd9abe
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@@ -438,6 -596,6 +596,7 @@@ public class Upgrade410to420 implement
      }
      
      
++    
      private void upgradePhysicalNtwksWithInternalLbProvider(Connection conn) {
  
          PreparedStatement pstmt = null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/server/src/com/cloud/api/ApiDBUtils.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/api/ApiDBUtils.java
index fce1f71,4264c93..94c873e
--- a/server/src/com/cloud/api/ApiDBUtils.java
+++ b/server/src/com/cloud/api/ApiDBUtils.java
@@@ -25,6 -25,20 +25,21 @@@ import java.util.Set
  import javax.annotation.PostConstruct;
  import javax.inject.Inject;
  
++
+ import com.cloud.network.rules.LoadBalancer;
+ import com.cloud.network.vpc.NetworkACL;
+ import com.cloud.network.vpc.StaticRouteVO;
+ import com.cloud.network.vpc.VpcGatewayVO;
+ import com.cloud.network.vpc.VpcManager;
+ import com.cloud.network.vpc.VpcOffering;
+ import com.cloud.network.vpc.VpcProvisioningService;
+ import com.cloud.network.vpc.VpcVO;
+ import com.cloud.network.vpc.dao.NetworkACLDao;
+ import com.cloud.network.vpc.dao.StaticRouteDao;
+ import com.cloud.network.vpc.dao.VpcDao;
+ import com.cloud.network.vpc.dao.VpcGatewayDao;
+ import com.cloud.network.vpc.dao.VpcOfferingDao;
+ import com.cloud.region.ha.GlobalLoadBalancingRulesService;
  import org.apache.cloudstack.affinity.AffinityGroup;
  import org.apache.cloudstack.affinity.AffinityGroupResponse;
  import org.apache.cloudstack.affinity.dao.AffinityGroupDao;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/api/ApiResponseHelper.java
index 39327cf,7b4c1f9..7b2bb03
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@@ -3809,7 -3823,6 +3824,7 @@@ public class ApiResponseHelper implemen
          }
      }
  
-     
++
      @Override
      public InternalLoadBalancerElementResponse createInternalLbElementResponse(VirtualRouterProvider result) {
          if (result.getType() != VirtualRouterProvider.VirtualRouterProviderType.InternalLbVm) {
@@@ -3827,7 -3840,6 +3842,7 @@@
          return response;
      }
  
-     
++
      @Override
      public IsolationMethodResponse createIsolationMethodResponse(IsolationType method) {
          IsolationMethodResponse response = new IsolationMethodResponse();
@@@ -3835,4 -3847,17 +3850,18 @@@
          response.setObjectName("isolationmethod");
          return response;
      }
+ 
++
+     public NetworkACLResponse createNetworkACLResponse(NetworkACL networkACL) {
+         NetworkACLResponse response = new NetworkACLResponse();
+         response.setId(networkACL.getUuid());
+         response.setName(networkACL.getName());
+         response.setDescription(networkACL.getDescription());
+         Vpc vpc = ApiDBUtils.findVpcById(networkACL.getVpcId());
+         if(vpc != null){
+             response.setVpcId(vpc.getUuid());
+         }
+         response.setObjectName("networkacllist");
+         return response;
+     }
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/api/query/QueryManagerImpl.java
index ebf9cac,808b1ef..54b7d7c
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@@ -30,8 -29,6 +30,9 @@@ import com.cloud.vm.dao.NicDetailDao
  import org.apache.cloudstack.affinity.AffinityGroupResponse;
  import org.apache.cloudstack.affinity.AffinityGroupVMMapVO;
  import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
 +import com.cloud.storage.VolumeDetailVO;
 +import com.cloud.storage.dao.VolumeDetailsDao;
++
  import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
  import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
  import org.apache.cloudstack.api.command.admin.internallb.ListInternalLBVMsCmd;
@@@ -992,6 -992,6 +993,7 @@@ public class QueryManagerImpl extends M
          response.setResponses(routerResponses, result.second());
          return response;
      }
++
      
      @Override
      public ListResponse<DomainRouterResponse> searchForInternalLbVms(ListInternalLBVMsCmd cmd) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/NetworkServiceImpl.java
index addd853,92d52da..4a57321
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@@ -42,13 -44,23 +44,26 @@@ import org.apache.cloudstack.acl.Securi
  import org.apache.cloudstack.acl.SecurityChecker.AccessType;
  import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
  import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
 +import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
 +import org.apache.cloudstack.api.command.user.network.*;
+ import com.cloud.network.vpc.NetworkACL;
+ import com.cloud.network.vpc.dao.NetworkACLDao;
+ import org.apache.cloudstack.acl.ControlledEntity.ACLType;
+ import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+ 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.vm.ListNicsCmd;
  import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
  import org.apache.log4j.Logger;
  import org.springframework.stereotype.Component;
 +
+ import org.apache.log4j.Logger;
+ import org.springframework.stereotype.Component;
+ import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
+ import org.bouncycastle.util.IPAddress;
+ 
  import com.cloud.configuration.Config;
  import com.cloud.configuration.ConfigurationManager;
  import com.cloud.configuration.dao.ConfigurationDao;
@@@ -928,7 -942,7 +945,8 @@@ public class NetworkServiceImpl extend
          String endIPv6 = cmd.getEndIpv6();
          String ip6Gateway = cmd.getIp6Gateway();
          String ip6Cidr = cmd.getIp6Cidr();
 +        Boolean displayNetwork = cmd.getDisplayNetwork();
+         Long aclId = cmd.getAclId();
  
          // Validate network offering
          NetworkOfferingVO ntwkOff = _networkOfferingDao.findById(networkOfferingId);
@@@ -1218,8 -1224,21 +1236,23 @@@
              if (!_configMgr.isOfferingForVpc(ntwkOff)){
                  throw new InvalidParameterValueException("Network offering can't be used for VPC networks");
              }
 +            network = _vpcMgr.createVpcGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId,
-                     networkDomain, owner, sharedDomainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, caller, displayNetwork);
++                    networkDomain, owner, sharedDomainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, aclId, caller, displayNetwork);
+             if(aclId == null){
+                 //Use default deny all ACL, when aclId is not specified
+                 aclId = NetworkACL.DEFAULT_DENY;
+             } else {
+                 NetworkACL acl = _networkACLDao.findById(aclId);
+                 if(acl == null){
+                     throw new InvalidParameterValueException("Unable to find specified NetworkACL");
+                 }
+ 
+                 if(vpcId != acl.getVpcId()){
+                     throw new InvalidParameterValueException("ACL: "+aclId+" do not belong to the VPC");
+                 }
+             }
+             network = _vpcMgr.createVpcGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId, 
 -                    networkDomain, owner, sharedDomainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, aclId, caller);
++                    networkDomain, owner, sharedDomainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, aclId, caller, displayNetwork);
          } else {
              if (_configMgr.isOfferingForVpc(ntwkOff)){
                  throw new InvalidParameterValueException("Network offering can be used for VPC networks only");
@@@ -1841,7 -1860,7 +1874,8 @@@
      @DB
      @ActionEvent(eventType = EventTypes.EVENT_NETWORK_UPDATE, eventDescription = "updating network", async = true)
      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) {
++
          boolean restartNetwork = false;
  
          // verify input parameters
@@@ -3775,7 -3787,7 +3809,8 @@@
          if (privateNetwork == null) {
              //create Guest network
              privateNetwork = _networkMgr.createGuestNetwork(ntwkOff.getId(), networkName, displayText, gateway, cidr, vlan,
 -                    null, owner, null, pNtwk, pNtwk.getDataCenterId(), ACLType.Account, null, null, null, null);
 +                    null, owner, null, pNtwk, pNtwk.getDataCenterId(), ACLType.Account, null, null, null, null, true);
++
              s_logger.debug("Created private network " + privateNetwork);
          } else {
              s_logger.debug("Private network already exists: " + privateNetwork);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/server/src/com/cloud/network/vpc/VpcManager.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/vpc/VpcManager.java
index 3fad1aa,07b9494..f3b4bbc
--- a/server/src/com/cloud/network/vpc/VpcManager.java
+++ b/server/src/com/cloud/network/vpc/VpcManager.java
@@@ -104,9 -102,9 +104,10 @@@ public interface VpcManager extends Vpc
       * @throws InsufficientCapacityException
       * @throws ResourceAllocationException
       */
 -    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, long aclId, Account caller)
 +    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, Boolean displayNetworkEnabled)
++                                  ACLType aclType, Boolean subdomainAccess, long vpcId, Long aclId, Account caller, Boolean displayNetworkEnabled)
++
                      throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException;
  
  

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/vpc/VpcManagerImpl.java
index 552332e,9993c06..b70ede8
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@@ -1967,9 -1967,9 +1967,9 @@@ public class VpcManagerImpl extends Man
      
      @DB
      @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, long aclId, Account caller)
 +    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, Boolean isDisplayNetworkEnabled)
++                                         PhysicalNetwork pNtwk, long zoneId, ACLType aclType, Boolean subdomainAccess, long vpcId, Long aclId, Account caller, Boolean isDisplayNetworkEnabled)
                      throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException {
  
          Vpc vpc = getActiveVpc(vpcId);
@@@ -1993,9 -1993,12 +1993,14 @@@
          validateNtwkOffForNtwkInVpc(null, ntwkOffId, cidr, networkDomain, vpc, gateway, owner);
  
          //2) Create network
--        Network guestNetwork = _ntwkMgr.createGuestNetwork(ntwkOffId, name, displayText, gateway, cidr, vlanId, 
 -                networkDomain, owner, domainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, null, null);
++        Network guestNetwork = _ntwkMgr.createGuestNetwork(ntwkOffId, name, displayText, gateway, cidr, vlanId,
 +                networkDomain, owner, domainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, null, null, isDisplayNetworkEnabled);
 +
++
+         if(guestNetwork != null){
+             guestNetwork.setNetworkACLId(aclId);
+             _ntwkDao.update(guestNetwork.getId(), (NetworkVO)guestNetwork);
+         }
          return guestNetwork;
      }
      

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/server/ManagementServerImpl.java
index 6018138,3c8fa29..425ecf0
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@@ -276,7 -276,20 +276,22 @@@ import org.apache.cloudstack.api.comman
  import org.apache.cloudstack.api.command.user.nat.DisableStaticNatCmd;
  import org.apache.cloudstack.api.command.user.nat.EnableStaticNatCmd;
  import org.apache.cloudstack.api.command.user.nat.ListIpForwardingRulesCmd;
 +import org.apache.cloudstack.api.command.user.network.*;
++
+ import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd;
+ import org.apache.cloudstack.api.command.user.network.CreateNetworkACLListCmd;
+ import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
+ import org.apache.cloudstack.api.command.user.network.DeleteNetworkACLCmd;
+ import org.apache.cloudstack.api.command.user.network.DeleteNetworkACLListCmd;
+ import org.apache.cloudstack.api.command.user.network.DeleteNetworkCmd;
+ import org.apache.cloudstack.api.command.user.network.ListNetworkACLListsCmd;
+ import org.apache.cloudstack.api.command.user.network.ListNetworkACLsCmd;
+ import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
+ import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
+ import org.apache.cloudstack.api.command.user.network.ReplaceNetworkACLListCmd;
+ import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
+ import org.apache.cloudstack.api.command.user.network.UpdateNetworkACLItemCmd;
+ import org.apache.cloudstack.api.command.user.network.UpdateNetworkCmd;
  import org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd;
  import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
  import org.apache.cloudstack.api.command.user.project.ActivateProjectCmd;
@@@ -355,7 -368,15 +370,16 @@@ import org.apache.cloudstack.api.comman
  import org.apache.cloudstack.api.command.user.vmsnapshot.DeleteVMSnapshotCmd;
  import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd;
  import org.apache.cloudstack.api.command.user.vmsnapshot.RevertToVMSnapshotCmd;
 +import org.apache.cloudstack.api.command.user.volume.*;
+ import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
+ import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
+ import org.apache.cloudstack.api.command.user.volume.DeleteVolumeCmd;
+ import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
+ import org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd;
+ import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd;
+ import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd;
+ import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
+ import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
  import org.apache.cloudstack.api.command.user.vpc.CreateStaticRouteCmd;
  import org.apache.cloudstack.api.command.user.vpc.CreateVPCCmd;
  import org.apache.cloudstack.api.command.user.vpc.DeleteStaticRouteCmd;
@@@ -1609,6 -1630,6 +1633,7 @@@ public class ManagementServerImpl exten
              paramCountCheck++;
          }
  
++
          if (paramCountCheck > 1) {
              throw new InvalidParameterValueException("cannot handle multiple IDs, provide only one ID corresponding to the scope");
          }
@@@ -2858,17 -2878,6 +2883,10 @@@
          cmdList.add(ListAffinityGroupsCmd.class);
          cmdList.add(UpdateVMAffinityGroupCmd.class);
          cmdList.add(ListAffinityGroupTypesCmd.class);
-         cmdList.add(AddVolumeDetailCmd.class);
-         cmdList.add(UpdateVolumeDetailCmd.class);
-         cmdList.add(RemoveVolumeDetailCmd.class);
-         cmdList.add(ListVolumeDetailsCmd.class);
-         cmdList.add(AddNicDetailCmd.class);
-         cmdList.add(UpdateNicDetailCmd.class);
-         cmdList.add(RemoveNicDetailCmd.class);
-         cmdList.add(ListNicDetailsCmd.class);
++
 +        cmdList.add(AddResourceDetailCmd.class);
 +        cmdList.add(RemoveResourceDetailCmd.class);
 +        cmdList.add(ListResourceDetailsCmd.class);
          cmdList.add(StopInternalLBVMCmd.class);
          cmdList.add(StartInternalLBVMCmd.class);
          cmdList.add(ListInternalLBVMsCmd.class);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/tags/TaggedResourceManagerImpl.java
index 2385806,daffe93..f58c5d7
--- a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
+++ b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
@@@ -25,7 -25,7 +25,8 @@@ import javax.ejb.Local
  import javax.inject.Inject;
  import javax.naming.ConfigurationException;
  
 +import com.cloud.vm.dao.NicDao;
+ import com.cloud.network.vpc.NetworkACLItemDao;
  import org.apache.log4j.Logger;
  import org.springframework.stereotype.Component;
  
@@@ -119,8 -119,8 +120,10 @@@ public class TaggedResourceManagerImpl 
      @Inject
      VMSnapshotDao _vmSnapshotDao;
      @Inject
 +    NicDao _nicDao;
+     NetworkACLItemDao _networkACLItemDao;
+ 
 +
      @Override
      public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
          _daoMap.put(TaggedResourceType.UserVm, _userVmDao);
@@@ -136,8 -136,7 +139,9 @@@
          _daoMap.put(TaggedResourceType.PublicIpAddress, _publicIpDao);
          _daoMap.put(TaggedResourceType.Project, _projectDao);
          _daoMap.put(TaggedResourceType.Vpc, _vpcDao);
 +        _daoMap.put(TaggedResourceType.NetworkACL, _firewallDao);
 +        _daoMap.put(TaggedResourceType.Nic, _nicDao);
+         _daoMap.put(TaggedResourceType.NetworkACL, _networkACLItemDao);
          _daoMap.put(TaggedResourceType.StaticRoute, _staticRouteDao);
          _daoMap.put(TaggedResourceType.VMSnapshot, _vmSnapshotDao);
          _daoMap.put(TaggedResourceType.RemoteAccessVpn, _vpnDao);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/server/test/com/cloud/network/MockNetworkManagerImpl.java
----------------------------------------------------------------------
diff --cc server/test/com/cloud/network/MockNetworkManagerImpl.java
index cfd7149,eb5fc25..a0c0850
--- a/server/test/com/cloud/network/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/network/MockNetworkManagerImpl.java
@@@ -639,9 -635,15 +639,13 @@@ public class MockNetworkManagerImpl ext
          return null;
      }
  
 -    /* (non-Javadoc)
 -     * @see com.cloud.network.NetworkService#createPrivateNetwork(java.lang.String, java.lang.String, long, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, long, java.lang.Long)
 -     */
      @Override
-     public Network createPrivateNetwork(String s, String s2, long l, String s3, String s4, String s5, String s6, String s7, long l2, Long aLong, Boolean aBoolean) throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
-         return null;  //To change body of implemented methods use File | Settings | File Templates.
++
+     public Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String vlan,
+                                         String startIp, String endIP, String gateway, String netmask, long networkOwnerId, Long vpcId, Boolean sourceNat)
+                     throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
+         // TODO Auto-generated method stub
+         return null;
      }
  
      /* (non-Javadoc)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
----------------------------------------------------------------------
diff --cc server/test/com/cloud/vpc/MockNetworkManagerImpl.java
index 5d19cf4,84ae818..52a375c
--- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
@@@ -84,7 -83,15 +84,10 @@@ import com.cloud.user.Account
  import com.cloud.user.User;
  import com.cloud.utils.Pair;
  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.VirtualMachine.Type;
++
+ import com.cloud.vm.VirtualMachineProfile;
++
  import org.apache.cloudstack.acl.ControlledEntity.ACLType;
  import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
  import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/server/test/com/cloud/vpc/MockVpcManagerImpl.java
----------------------------------------------------------------------
diff --cc server/test/com/cloud/vpc/MockVpcManagerImpl.java
index de4169c,b4851d6..3835c2e
--- a/server/test/com/cloud/vpc/MockVpcManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockVpcManagerImpl.java
@@@ -24,6 -24,6 +24,7 @@@ import javax.ejb.Local
  import javax.inject.Inject;
  import javax.naming.ConfigurationException;
  
++import org.apache.cloudstack.acl.ControlledEntity;
  import org.apache.cloudstack.acl.ControlledEntity.ACLType;
  import org.apache.cloudstack.api.command.user.vpc.ListPrivateGatewaysCmd;
  import org.apache.cloudstack.api.command.user.vpc.ListStaticRoutesCmd;
@@@ -298,14 -298,14 +299,9 @@@ public class MockVpcManagerImpl extend
  
      }
  
--    /* (non-Javadoc)
--     * @see com.cloud.network.vpc.VpcManager#createVpcGuestNetwork(long, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, com.cloud.user.Account, java.lang.Long, com.cloud.network.PhysicalNetwork, long, org.apache.cloudstack.acl.ControlledEntity.ACLType, java.lang.Boolean, long, com.cloud.user.Account)
--     */
      @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, Boolean displayNetworkEnabled) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException {
-         // TODO Auto-generated method stub
-         return null;
 -            long zoneId, ACLType aclType, Boolean subdomainAccess, long vpcId, long aclId, Account caller) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException {
 -        // TODO Auto-generated method stub
 -        return null;
++    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, Long aclId, Account caller, Boolean displayNetworkEnabled) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException {
++        return null;  //To change body of implemented methods use File | Settings | File Templates.
      }
  
      /* (non-Javadoc)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d53b1ef/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --cc setup/db/db/schema-410to420.sql
index 30b96fd,6e74537..096ca33
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@@ -1539,3 -1178,45 +1539,46 @@@ CREATE TABLE `cloud`.`account_vnet_map
  
  ALTER TABLE `cloud`.`op_dc_vnet_alloc` ADD COLUMN account_vnet_map_id bigint unsigned;
  ALTER TABLE `cloud`.`op_dc_vnet_alloc` ADD CONSTRAINT `fk_op_dc_vnet_alloc__account_vnet_map_id` FOREIGN KEY `fk_op_dc_vnet_alloc__account_vnet_map_id` (`account_vnet_map_id`) REFERENCES `account_vnet_map` (`id`);
+ 
+ CREATE TABLE `cloud`.`network_acl` (
+   `id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
+   `name` varchar(255) NOT NULL COMMENT 'name of the network acl',
+   `uuid` varchar(40),
+   `vpc_id` bigint unsigned COMMENT 'vpc this network acl belongs to',
+   `description` varchar(1024),
+   PRIMARY KEY  (`id`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ 
+ CREATE TABLE `cloud`.`network_acl_item` (
+   `id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
+   `uuid` varchar(40),
+   `acl_id` bigint unsigned NOT NULL COMMENT 'network acl id',
+   `start_port` int(10) COMMENT 'starting port of a port range',
+   `end_port` int(10) COMMENT 'end port of a port range',
+   `state` char(32) NOT NULL COMMENT 'current state of this rule',
+   `protocol` char(16) NOT NULL default 'TCP' COMMENT 'protocol to open these ports for',
+   `created` datetime COMMENT 'Date created',
+   `icmp_code` int(10) COMMENT 'The ICMP code (if protocol=ICMP). A value of -1 means all codes for the given ICMP type.',
+   `icmp_type` int(10) COMMENT 'The ICMP type (if protocol=ICMP). A value of -1 means all types.',
+   `traffic_type` char(32) COMMENT 'the traffic type of the rule, can be Ingress or Egress',
+   `cidr` varchar(255) COMMENT 'comma seperated cidr list',
+   `number` int(10) NOT NULL COMMENT 'priority number of the acl item',
+   `action` varchar(10) NOT NULL COMMENT 'rule action, allow or deny',
+   PRIMARY KEY  (`id`),
+   UNIQUE KEY (`acl_id`, `number`),
+   CONSTRAINT `fk_network_acl_item__acl_id` FOREIGN KEY(`acl_id`) REFERENCES `network_acl`(`id`) ON DELETE CASCADE,
+   CONSTRAINT `uc_network_acl_item__uuid` UNIQUE (`uuid`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ 
+ ALTER TABLE `cloud`.`networks` add column `network_acl_id` bigint unsigned COMMENT 'network acl id';
+ 
+ -- Add Default ACL deny_all
+ INSERT INTO `cloud`.`network_acl` (id, uuid, vpc_id, description, name) values (1, UUID(), 0, "Default Network ACL Deny All", "default_deny");
+ INSERT INTO `cloud`.`network_acl_item` (id, uuid, acl_id, state, protocol, created, traffic_type, cidr, number, action) values (1, UUID(), 1, "Active", "all", now(), "Ingress", "0.0.0.0/0", 1, "Deny");
+ INSERT INTO `cloud`.`network_acl_item` (id, uuid, acl_id, state, protocol, created, traffic_type, cidr, number, action) values (2, UUID(), 1, "Active", "all", now(), "Egress", "0.0.0.0/0", 2, "Deny");
+ 
+ -- Add Default ACL allow_all
+ INSERT INTO `cloud`.`network_acl` (id, uuid, vpc_id, description, name) values (2, UUID(), 0, "Default Network ACL Allow All", "default_allow");
+ INSERT INTO `cloud`.`network_acl_item` (id, uuid, acl_id, state, protocol, created, traffic_type, cidr, number, action) values (3, UUID(), 2, "Active", "all", now(), "Ingress", "0.0.0.0/0", 1, "Allow");
+ INSERT INTO `cloud`.`network_acl_item` (id, uuid, acl_id, state, protocol, created, traffic_type, cidr, number, action) values (4, UUID(), 2, "Active", "all", now(), "Egress", "0.0.0.0/0", 2, "Allow");
++>>>>>>> master


[31/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DownloadTemplateFromSwiftToSecondaryStorageCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DownloadTemplateFromSwiftToSecondaryStorageCommand.java b/core/src/com/cloud/agent/api/DownloadTemplateFromSwiftToSecondaryStorageCommand.java
new file mode 100644
index 0000000..79ec882
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DownloadTemplateFromSwiftToSecondaryStorageCommand.java
@@ -0,0 +1,90 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.agent.api.to.SwiftTO;
+
+/**
+ *
+ *
+ */
+
+public class DownloadTemplateFromSwiftToSecondaryStorageCommand extends Command {
+    @LogLevel(Log4jLevel.Off)
+    private SwiftTO swift;
+    private String secondaryStorageUrl;
+
+    private Long dcId;
+    private Long accountId;
+    private Long templateId;
+    private String path;
+
+    protected DownloadTemplateFromSwiftToSecondaryStorageCommand() {
+
+    }
+
+    public DownloadTemplateFromSwiftToSecondaryStorageCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long templateId, String path, int wait) {
+
+        this.swift = swift;
+        this.secondaryStorageUrl = secondaryStorageUrl;
+        this.dcId = dcId;
+        this.accountId = accountId;
+        this.templateId = templateId;
+        this.path = path;
+        setWait(wait);
+    }
+
+    public SwiftTO getSwift() {
+        return this.swift;
+    }
+
+    public void setSwift(SwiftTO swift) {
+        this.swift = swift;
+    }
+
+    public String getSecondaryStorageUrl() {
+        return secondaryStorageUrl;
+    }
+
+    public Long getDcId() {
+        return dcId;
+    }
+
+    public Long getAccountId() {
+        return accountId;
+    }
+
+    public Long getTemplateId() {
+        return templateId;
+    }
+
+    public String getPath() {
+        return path;
+    }
+
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        // TODO Auto-generated method stub
+        return true;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/FenceAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/FenceAnswer.java b/core/src/com/cloud/agent/api/FenceAnswer.java
new file mode 100644
index 0000000..7af18f5
--- /dev/null
+++ b/core/src/com/cloud/agent/api/FenceAnswer.java
@@ -0,0 +1,36 @@
+// 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.agent.api;
+
+public class FenceAnswer extends Answer {
+    public FenceAnswer() {
+        super();
+    }
+
+    public FenceAnswer(FenceCommand cmd) {
+        super(cmd, true, null);
+    }
+
+    public FenceAnswer(FenceCommand cmd, String details) {
+        super(cmd, true, details);
+    }
+
+    public FenceAnswer(FenceCommand cmd, boolean result, String details) {
+        super(cmd, result, details);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/FenceCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/FenceCommand.java b/core/src/com/cloud/agent/api/FenceCommand.java
new file mode 100644
index 0000000..a891944
--- /dev/null
+++ b/core/src/com/cloud/agent/api/FenceCommand.java
@@ -0,0 +1,61 @@
+// 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.agent.api;
+
+import com.cloud.host.Host;
+import com.cloud.vm.VirtualMachine;
+
+public class FenceCommand extends Command {
+
+    public FenceCommand() {
+        super();
+    }
+
+    String vmName;
+    String hostGuid;
+    String hostIp;
+    boolean inSeq;
+
+    public FenceCommand(VirtualMachine vm, Host host) {
+        super();
+        vmName = vm.getInstanceName();
+        hostGuid = host.getGuid();
+        hostIp = host.getPrivateIpAddress();
+        inSeq = false;
+    }
+
+    public void setSeq(boolean inseq) {
+    	inSeq = inseq;
+    }
+
+    public String getVmName() {
+        return vmName;
+    }
+
+    public String getHostGuid() {
+        return hostGuid;
+    }
+
+    public String getHostIp() {
+        return hostIp;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return inSeq;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/GetDomRVersionAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/GetDomRVersionAnswer.java b/core/src/com/cloud/agent/api/GetDomRVersionAnswer.java
new file mode 100644
index 0000000..7487b57
--- /dev/null
+++ b/core/src/com/cloud/agent/api/GetDomRVersionAnswer.java
@@ -0,0 +1,45 @@
+// 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.agent.api;
+
+public class GetDomRVersionAnswer extends Answer {
+    public static final String ROUTER_NAME = "router.name";
+    public static final String ROUTER_IP = "router.ip";
+    String templateVersion;
+    String scriptsVersion;
+
+    protected GetDomRVersionAnswer() {
+    }
+
+    public GetDomRVersionAnswer(GetDomRVersionCmd cmd, String details, String templateVersion, String scriptsVersion) {
+        super(cmd, true, details);
+        this.templateVersion = templateVersion;
+        this.scriptsVersion = scriptsVersion;
+    }
+
+    public GetDomRVersionAnswer(GetDomRVersionCmd cmd, String details) {
+        super(cmd, false, details);
+    }
+
+    public String getTemplateVersion() {
+        return this.templateVersion;
+    }
+
+    public String getScriptsVersion() {
+        return this.scriptsVersion;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/GetDomRVersionCmd.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/GetDomRVersionCmd.java b/core/src/com/cloud/agent/api/GetDomRVersionCmd.java
new file mode 100644
index 0000000..577c386
--- /dev/null
+++ b/core/src/com/cloud/agent/api/GetDomRVersionCmd.java
@@ -0,0 +1,30 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.routing.NetworkElementCommand;
+
+public class GetDomRVersionCmd extends NetworkElementCommand {
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public GetDomRVersionCmd() {
+        super();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/GetFileStatsAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/GetFileStatsAnswer.java b/core/src/com/cloud/agent/api/GetFileStatsAnswer.java
new file mode 100755
index 0000000..f93070e
--- /dev/null
+++ b/core/src/com/cloud/agent/api/GetFileStatsAnswer.java
@@ -0,0 +1,37 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.storage.VolumeStats;
+
+@LogLevel(Log4jLevel.Trace)
+public class GetFileStatsAnswer extends Answer implements VolumeStats {
+    long size;
+    protected GetFileStatsAnswer() {
+    }
+
+    public GetFileStatsAnswer(GetFileStatsCommand cmd, long value) {
+        super(cmd);
+        size = value;
+    }
+
+    @Override
+    public long getBytesUsed() {
+        return size;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/GetFileStatsCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/GetFileStatsCommand.java b/core/src/com/cloud/agent/api/GetFileStatsCommand.java
new file mode 100755
index 0000000..c6dc213
--- /dev/null
+++ b/core/src/com/cloud/agent/api/GetFileStatsCommand.java
@@ -0,0 +1,41 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.storage.Volume;
+
+@LogLevel(Log4jLevel.Trace)
+public class GetFileStatsCommand extends Command {
+    protected GetFileStatsCommand() {
+    }
+
+    String paths;
+
+    public GetFileStatsCommand(Volume volume) {
+        paths = volume.getPath();
+    }
+
+    public String getPaths() {
+        return paths;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/GetHostStatsAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/GetHostStatsAnswer.java b/core/src/com/cloud/agent/api/GetHostStatsAnswer.java
new file mode 100755
index 0000000..897d7f9
--- /dev/null
+++ b/core/src/com/cloud/agent/api/GetHostStatsAnswer.java
@@ -0,0 +1,88 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.host.HostStats;
+
+@LogLevel(Log4jLevel.Trace)
+public class GetHostStatsAnswer extends Answer implements HostStats {
+
+    HostStatsEntry hostStats;
+
+    protected GetHostStatsAnswer() {
+        hostStats = new HostStatsEntry();
+    }
+
+    public GetHostStatsAnswer(GetHostStatsCommand cmd, HostStatsEntry hostStatistics) {
+        super(cmd);
+        this.hostStats = hostStatistics;
+    }
+
+    public GetHostStatsAnswer(GetHostStatsCommand cmd, double cpuUtilization, double freeMemoryKBs, double totalMemoryKBs, double networkReadKBs,
+            double networkWriteKBs, String entityType) {
+        super(cmd);
+        hostStats = new HostStatsEntry();
+
+        hostStats.setCpuUtilization(cpuUtilization);
+        hostStats.setFreeMemoryKBs(freeMemoryKBs);
+        hostStats.setTotalMemoryKBs(totalMemoryKBs);
+        hostStats.setNetworkReadKBs(networkReadKBs);
+        hostStats.setNetworkWriteKBs(networkWriteKBs);
+        hostStats.setEntityType(entityType);
+    }
+
+    @Override
+    public double getUsedMemory() {
+        return hostStats.getUsedMemory();
+    }
+
+    @Override
+    public double getFreeMemoryKBs() {
+        return hostStats.getFreeMemoryKBs();
+    }
+
+    @Override
+    public double getTotalMemoryKBs() {
+        return hostStats.getTotalMemoryKBs();
+    }
+
+    @Override
+    public double getCpuUtilization() {
+        return hostStats.getCpuUtilization();
+    }
+
+    @Override
+    public double getNetworkReadKBs() {
+        return hostStats.getNetworkReadKBs();
+    }
+
+    @Override
+    public double getNetworkWriteKBs() {
+        return hostStats.getNetworkWriteKBs();
+    }
+
+    @Override
+    public String getEntityType() {
+        return hostStats.getEntityType();
+    }
+
+    @Override
+    public HostStats getHostStats() {
+        return hostStats;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/GetHostStatsCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/GetHostStatsCommand.java b/core/src/com/cloud/agent/api/GetHostStatsCommand.java
new file mode 100755
index 0000000..f10a9cd
--- /dev/null
+++ b/core/src/com/cloud/agent/api/GetHostStatsCommand.java
@@ -0,0 +1,53 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+
+@LogLevel(Log4jLevel.Trace)
+public class GetHostStatsCommand extends Command
+{
+    String hostGuid;
+    String hostName;
+    long hostId;
+
+    protected GetHostStatsCommand() {
+    }
+
+    public GetHostStatsCommand(String hostGuid, String hostName, long hostId) {
+        this.hostGuid = hostGuid;
+        this.hostName = hostName;
+        this.hostId = hostId;
+    }
+
+    public String getHostGuid(){
+        return this.hostGuid;
+    }
+
+    public String getHostName(){
+        return this.hostName;
+    }
+
+    public long getHostId(){
+        return this.hostId;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/GetStorageStatsAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/GetStorageStatsAnswer.java b/core/src/com/cloud/agent/api/GetStorageStatsAnswer.java
new file mode 100755
index 0000000..2443e8e
--- /dev/null
+++ b/core/src/com/cloud/agent/api/GetStorageStatsAnswer.java
@@ -0,0 +1,51 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.storage.StorageStats;
+
+@LogLevel(Log4jLevel.Trace)
+public class GetStorageStatsAnswer extends Answer implements StorageStats {
+    protected GetStorageStatsAnswer() {
+    }
+
+    protected long used;
+
+    protected long capacity;
+
+    @Override
+    public long getByteUsed() {
+        return used;
+    }
+
+    @Override
+    public long getCapacityBytes() {
+        return capacity;
+    }
+
+
+    public GetStorageStatsAnswer(GetStorageStatsCommand cmd, long capacity, long used) {
+        super(cmd, true, null);
+        this.capacity = capacity;
+        this.used = used;
+    }
+
+    public GetStorageStatsAnswer(GetStorageStatsCommand cmd, String details) {
+        super(cmd, false, details);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/GetStorageStatsCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/GetStorageStatsCommand.java b/core/src/com/cloud/agent/api/GetStorageStatsCommand.java
new file mode 100755
index 0000000..f7ebd51
--- /dev/null
+++ b/core/src/com/cloud/agent/api/GetStorageStatsCommand.java
@@ -0,0 +1,76 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.storage.Storage.StoragePoolType;
+
+@LogLevel(Log4jLevel.Trace)
+public class GetStorageStatsCommand extends Command {
+    private String id;
+    private String localPath;
+    private StoragePoolType pooltype;
+    private String secUrl;
+
+
+    public String getSecUrl() {
+		return secUrl;
+	}
+
+	public void setSecUrl(String secUrl) {
+		this.secUrl = secUrl;
+	}
+
+	public GetStorageStatsCommand() {
+    }
+
+    public StoragePoolType getPooltype() {
+        return pooltype;
+    }
+
+    public void setPooltype(StoragePoolType pooltype) {
+        this.pooltype = pooltype;
+    }
+
+    public GetStorageStatsCommand(String secUrl) {
+        this.secUrl = secUrl;
+    }
+
+    public GetStorageStatsCommand(String id, StoragePoolType pooltype) {
+        this.id = id;
+        this.pooltype = pooltype;
+    }
+
+    public GetStorageStatsCommand(String id, StoragePoolType pooltype, String localPath) {
+        this.id = id;
+        this.pooltype = pooltype;
+        this.localPath = localPath;
+    }
+
+    public String getStorageId() {
+        return this.id;
+    }
+
+    public String getLocalPath() {
+        return this.localPath;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/GetVmStatsAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/GetVmStatsAnswer.java b/core/src/com/cloud/agent/api/GetVmStatsAnswer.java
new file mode 100755
index 0000000..c02eb9a
--- /dev/null
+++ b/core/src/com/cloud/agent/api/GetVmStatsAnswer.java
@@ -0,0 +1,40 @@
+// 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.agent.api;
+
+import java.util.HashMap;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+
+@LogLevel(Log4jLevel.Trace)
+public class GetVmStatsAnswer extends Answer {
+
+    HashMap<String, VmStatsEntry> vmStatsMap;
+
+    public GetVmStatsAnswer(GetVmStatsCommand cmd, HashMap<String, VmStatsEntry> vmStatsMap) {
+        super(cmd);
+        this.vmStatsMap = vmStatsMap;
+    }
+
+    public HashMap<String, VmStatsEntry> getVmStatsMap() {
+        return vmStatsMap;
+    }
+
+    protected GetVmStatsAnswer() {
+        //no-args constructor for json serialization-deserialization
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/GetVmStatsCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/GetVmStatsCommand.java b/core/src/com/cloud/agent/api/GetVmStatsCommand.java
new file mode 100755
index 0000000..41b0f98
--- /dev/null
+++ b/core/src/com/cloud/agent/api/GetVmStatsCommand.java
@@ -0,0 +1,54 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+
+@LogLevel(Log4jLevel.Trace)
+public class GetVmStatsCommand extends Command {
+    List<String> vmNames;
+    String hostGuid;
+    String hostName;
+
+    protected GetVmStatsCommand() {
+    }
+
+    public GetVmStatsCommand(List<String> vmNames, String hostGuid, String hostName) {
+        this.vmNames = vmNames;
+        this.hostGuid = hostGuid;
+        this.hostName = hostName;
+    }
+
+    public List<String> getVmNames() {
+        return vmNames;
+    }
+
+    public String getHostGuid(){
+        return this.hostGuid;
+    }
+
+    public String getHostName(){
+        return this.hostName;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/GetVncPortAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/GetVncPortAnswer.java b/core/src/com/cloud/agent/api/GetVncPortAnswer.java
new file mode 100644
index 0000000..5e94a18
--- /dev/null
+++ b/core/src/com/cloud/agent/api/GetVncPortAnswer.java
@@ -0,0 +1,48 @@
+// 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.agent.api;
+
+public class GetVncPortAnswer extends Answer {
+	String address;
+    int port;
+
+    protected GetVncPortAnswer() {
+    }
+
+    public GetVncPortAnswer(GetVncPortCommand cmd, int port) {
+        super(cmd, true, null);
+        this.port = port;
+    }
+
+    public GetVncPortAnswer(GetVncPortCommand cmd, String address, int port) {
+        super(cmd, true, null);
+        this.address = address;
+        this.port = port;
+    }
+
+    public GetVncPortAnswer(GetVncPortCommand cmd, String details) {
+        super(cmd, false, details);
+    }
+
+    public String getAddress() {
+    	return address;
+    }
+
+    public int getPort() {
+        return port;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/GetVncPortCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/GetVncPortCommand.java b/core/src/com/cloud/agent/api/GetVncPortCommand.java
new file mode 100644
index 0000000..06165dc
--- /dev/null
+++ b/core/src/com/cloud/agent/api/GetVncPortCommand.java
@@ -0,0 +1,43 @@
+// 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.agent.api;
+
+public class GetVncPortCommand extends Command {
+    long id;
+    String name;
+
+    public GetVncPortCommand() {
+    }
+
+    public GetVncPortCommand(long id, String name) {
+        this.id = id;
+        this.name = name;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public long getId() {
+        return id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/HostStatsEntry.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/HostStatsEntry.java b/core/src/com/cloud/agent/api/HostStatsEntry.java
new file mode 100644
index 0000000..0d8cfb2
--- /dev/null
+++ b/core/src/com/cloud/agent/api/HostStatsEntry.java
@@ -0,0 +1,113 @@
+// 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.agent.api;
+
+import com.cloud.host.HostStats;
+
+public class HostStatsEntry implements HostStats {
+
+	long hostId;
+	String entityType;
+	double cpuUtilization;
+	double networkReadKBs;
+	double networkWriteKBs;
+    double totalMemoryKBs;
+    double freeMemoryKBs;
+
+    public HostStatsEntry() {
+    }
+
+    public HostStatsEntry(long hostId,double cpuUtilization, double networkReadKBs, double networkWriteKBs, String entityType,
+		double totalMemoryKBs, double freeMemoryKBs, double xapiMemoryUsageKBs, double averageLoad)
+    {
+        this.hostId = hostId;
+        this.entityType = entityType;
+        this.cpuUtilization = cpuUtilization;
+        this.networkReadKBs = networkReadKBs;
+        this.networkWriteKBs = networkWriteKBs;
+        this.totalMemoryKBs = totalMemoryKBs;
+        this.freeMemoryKBs = freeMemoryKBs;
+    }
+
+	@Override
+    public double getNetworkReadKBs() {
+    	return networkReadKBs;
+    }
+
+    public void setNetworkReadKBs(double networkReadKBs) {
+    	this.networkReadKBs = networkReadKBs;
+    }
+
+	@Override
+    public double getNetworkWriteKBs() {
+    	return networkWriteKBs;
+    }
+
+    public void setNetworkWriteKBs(double networkWriteKBs) {
+    	this.networkWriteKBs = networkWriteKBs;
+    }
+
+	@Override
+    public String getEntityType(){
+    	return this.entityType;
+    }
+
+    public void setEntityType(String entityType){
+    	this.entityType = entityType;
+    }
+
+	@Override
+    public double getTotalMemoryKBs(){
+    	return this.totalMemoryKBs;
+    }
+
+    public void setTotalMemoryKBs(double totalMemoryKBs){
+    	this.totalMemoryKBs = totalMemoryKBs;
+    }
+
+	@Override
+    public double getFreeMemoryKBs(){
+    	return this.freeMemoryKBs;
+    }
+
+    public void setFreeMemoryKBs(double freeMemoryKBs){
+    	this.freeMemoryKBs = freeMemoryKBs;
+    }
+
+	@Override
+	public double getCpuUtilization() {
+		return this.cpuUtilization;
+	}
+
+	public void setCpuUtilization(double cpuUtilization) {
+		this.cpuUtilization = cpuUtilization;
+	}
+
+	@Override
+	public double getUsedMemory() {
+		return (totalMemoryKBs-freeMemoryKBs);
+	}
+
+	@Override
+	public HostStats getHostStats() {
+		return this;
+	}
+
+	public void setHostId(long hostId) {
+		this.hostId = hostId;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/MaintainAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/MaintainAnswer.java b/core/src/com/cloud/agent/api/MaintainAnswer.java
new file mode 100644
index 0000000..dcfdab3
--- /dev/null
+++ b/core/src/com/cloud/agent/api/MaintainAnswer.java
@@ -0,0 +1,46 @@
+// 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.agent.api;
+
+public class MaintainAnswer extends Answer {
+	boolean willMigrate;
+
+    public MaintainAnswer() {
+    }
+
+    public MaintainAnswer(MaintainCommand cmd) {
+        this(cmd, true, null);
+    }
+
+    public MaintainAnswer(MaintainCommand cmd, boolean willMigrate) {
+        this(cmd, true, null);
+        this.willMigrate = willMigrate;
+    }
+
+    public MaintainAnswer(MaintainCommand cmd, String details) {
+        this(cmd, true, details);
+    }
+
+    public MaintainAnswer(MaintainCommand cmd, boolean result, String details) {
+        super(cmd, result, details);
+        this.willMigrate = true;
+    }
+
+    public boolean getMigrate() {
+    	return this.willMigrate;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/MaintainCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/MaintainCommand.java b/core/src/com/cloud/agent/api/MaintainCommand.java
new file mode 100644
index 0000000..2a9b9a5
--- /dev/null
+++ b/core/src/com/cloud/agent/api/MaintainCommand.java
@@ -0,0 +1,28 @@
+// 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.agent.api;
+
+public class MaintainCommand extends Command {
+
+    public MaintainCommand() {
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ManageSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ManageSnapshotAnswer.java b/core/src/com/cloud/agent/api/ManageSnapshotAnswer.java
new file mode 100644
index 0000000..e490bdf
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ManageSnapshotAnswer.java
@@ -0,0 +1,40 @@
+// 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.agent.api;
+
+
+public class ManageSnapshotAnswer extends Answer {
+    // For create Snapshot
+    private String _snapshotPath;
+
+    public ManageSnapshotAnswer() {}
+
+    public ManageSnapshotAnswer(Command cmd, boolean success, String result) {
+        super(cmd, success, result);
+    }
+
+    // For XenServer
+    public ManageSnapshotAnswer(ManageSnapshotCommand cmd, long snapshotId, String snapshotPath, boolean success, String result) {
+    	super(cmd, success, result);
+    	_snapshotPath = snapshotPath;
+    }
+
+    public String getSnapshotPath() {
+    	return _snapshotPath;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ManageSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ManageSnapshotCommand.java b/core/src/com/cloud/agent/api/ManageSnapshotCommand.java
new file mode 100644
index 0000000..5effc54
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ManageSnapshotCommand.java
@@ -0,0 +1,92 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.StoragePool;
+
+
+public class ManageSnapshotCommand extends Command {
+    // XXX: Should be an enum
+    // XXX: Anyway there is something called inheritance in Java
+    public static String CREATE_SNAPSHOT = "-c";
+    public static String DESTROY_SNAPSHOT = "-d";
+
+    private String _commandSwitch;
+
+    // Information about the volume that the snapshot is based on
+    private String _volumePath = null;
+	StorageFilerTO _pool;
+
+    // Information about the snapshot
+    private String _snapshotPath = null;
+    private String _snapshotName = null;
+    private long _snapshotId;
+    private String _vmName = null;
+
+    public ManageSnapshotCommand() {}
+
+    public ManageSnapshotCommand(long snapshotId, String volumePath, StoragePool pool, String preSnapshotPath ,String snapshotName, String vmName) {
+        _commandSwitch = ManageSnapshotCommand.CREATE_SNAPSHOT;
+        _volumePath = volumePath;
+        _pool = new StorageFilerTO(pool);
+        _snapshotPath = preSnapshotPath;
+        _snapshotName = snapshotName;
+        _snapshotId = snapshotId;
+        _vmName = vmName;
+    }
+
+    public ManageSnapshotCommand(long snapshotId, String snapshotPath) {
+        _commandSwitch = ManageSnapshotCommand.DESTROY_SNAPSHOT;
+        _snapshotPath = snapshotPath;
+    }
+
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public String getCommandSwitch() {
+        return _commandSwitch;
+    }
+
+    public String getVolumePath() {
+        return _volumePath;
+    }
+
+    public StorageFilerTO getPool() {
+        return _pool;
+    }
+
+    public String getSnapshotPath() {
+    	return _snapshotPath;
+    }
+
+    public String getSnapshotName() {
+        return _snapshotName;
+    }
+
+    public long getSnapshotId() {
+        return _snapshotId;
+    }
+
+    public String getVmName() {
+    	return _vmName;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/MigrateAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/MigrateAnswer.java b/core/src/com/cloud/agent/api/MigrateAnswer.java
new file mode 100644
index 0000000..19d690a
--- /dev/null
+++ b/core/src/com/cloud/agent/api/MigrateAnswer.java
@@ -0,0 +1,33 @@
+// 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.agent.api;
+
+public class MigrateAnswer extends Answer {
+    Integer vncPort = null;
+
+    protected MigrateAnswer() {
+    }
+
+    public MigrateAnswer(MigrateCommand cmd, boolean result, String detail, Integer vncPort) {
+        super(cmd, result, detail);
+        this.vncPort = vncPort;
+    }
+
+    public Integer getVncPort() {
+        return vncPort;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/MigrateCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/MigrateCommand.java b/core/src/com/cloud/agent/api/MigrateCommand.java
new file mode 100644
index 0000000..5042b8c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/MigrateCommand.java
@@ -0,0 +1,59 @@
+// 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.agent.api;
+
+public class MigrateCommand extends Command {
+    String vmName;
+    String destIp;
+    String hostGuid;
+    boolean isWindows;
+
+
+    protected MigrateCommand() {
+    }
+
+    public MigrateCommand(String vmName, String destIp, boolean isWindows) {
+        this.vmName = vmName;
+        this.destIp = destIp;
+        this.isWindows = isWindows;
+    }
+
+    public boolean isWindows() {
+        return isWindows;
+    }
+
+    public String getDestinationIp() {
+        return destIp;
+    }
+
+    public String getVmName() {
+        return vmName;
+    }
+
+    public void setHostGuid(String guid) {
+        this.hostGuid = guid;
+    }
+
+    public String getHostGuid() {
+        return this.hostGuid;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/MigrateWithStorageAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/MigrateWithStorageAnswer.java b/core/src/com/cloud/agent/api/MigrateWithStorageAnswer.java
new file mode 100644
index 0000000..06aff32
--- /dev/null
+++ b/core/src/com/cloud/agent/api/MigrateWithStorageAnswer.java
@@ -0,0 +1,39 @@
+// 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.agent.api;
+
+import java.util.List;
+import com.cloud.agent.api.to.VolumeTO;
+
+public class MigrateWithStorageAnswer extends Answer {
+
+    List<VolumeTO> volumeTos;
+
+    public MigrateWithStorageAnswer(MigrateWithStorageCommand cmd, Exception ex) {
+        super(cmd, ex);
+        volumeTos = null;
+    }
+
+    public MigrateWithStorageAnswer(MigrateWithStorageCommand cmd, List<VolumeTO> volumeTos) {
+        super(cmd, true, null);
+        this.volumeTos = volumeTos;
+    }
+
+    public List<VolumeTO> getVolumeTos() {
+        return volumeTos;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/MigrateWithStorageCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/MigrateWithStorageCommand.java b/core/src/com/cloud/agent/api/MigrateWithStorageCommand.java
new file mode 100644
index 0000000..058aa15
--- /dev/null
+++ b/core/src/com/cloud/agent/api/MigrateWithStorageCommand.java
@@ -0,0 +1,45 @@
+// 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.agent.api;
+
+import java.util.Map;
+import com.cloud.agent.api.to.VirtualMachineTO;
+import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.agent.api.to.StorageFilerTO;
+
+public class MigrateWithStorageCommand extends Command {
+    VirtualMachineTO vm;
+    Map<VolumeTO, StorageFilerTO> volumeToFiler;
+
+    public MigrateWithStorageCommand(VirtualMachineTO vm, Map<VolumeTO, StorageFilerTO> volumeToFiler) {
+        this.vm = vm;
+        this.volumeToFiler = volumeToFiler;
+    }
+
+    public VirtualMachineTO getVirtualMachine() {
+        return vm;
+    }
+
+    public Map<VolumeTO, StorageFilerTO> getVolumeToFiler() {
+        return volumeToFiler;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/MigrateWithStorageCompleteAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/MigrateWithStorageCompleteAnswer.java b/core/src/com/cloud/agent/api/MigrateWithStorageCompleteAnswer.java
new file mode 100644
index 0000000..920cf48
--- /dev/null
+++ b/core/src/com/cloud/agent/api/MigrateWithStorageCompleteAnswer.java
@@ -0,0 +1,38 @@
+// 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.agent.api;
+
+import java.util.List;
+import com.cloud.agent.api.to.VolumeTO;
+
+public class MigrateWithStorageCompleteAnswer extends Answer {
+    List<VolumeTO> volumeTos;
+
+    public MigrateWithStorageCompleteAnswer(MigrateWithStorageCompleteCommand cmd, Exception ex) {
+        super(cmd, ex);
+        volumeTos = null;
+    }
+
+    public MigrateWithStorageCompleteAnswer(MigrateWithStorageCompleteCommand cmd, List<VolumeTO> volumeTos) {
+        super(cmd, true, null);
+        this.volumeTos = volumeTos;
+    }
+
+    public List<VolumeTO> getVolumeTos() {
+        return volumeTos;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/MigrateWithStorageCompleteCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/MigrateWithStorageCompleteCommand.java b/core/src/com/cloud/agent/api/MigrateWithStorageCompleteCommand.java
new file mode 100644
index 0000000..1303c07
--- /dev/null
+++ b/core/src/com/cloud/agent/api/MigrateWithStorageCompleteCommand.java
@@ -0,0 +1,36 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.to.VirtualMachineTO;
+
+public class MigrateWithStorageCompleteCommand extends Command {
+    VirtualMachineTO vm;
+
+    public MigrateWithStorageCompleteCommand(VirtualMachineTO vm) {
+        this.vm = vm;
+    }
+
+    public VirtualMachineTO getVirtualMachine() {
+        return vm;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/MigrateWithStorageReceiveAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/MigrateWithStorageReceiveAnswer.java b/core/src/com/cloud/agent/api/MigrateWithStorageReceiveAnswer.java
new file mode 100644
index 0000000..3bf521c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/MigrateWithStorageReceiveAnswer.java
@@ -0,0 +1,55 @@
+// 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.agent.api;
+
+import java.util.Map;
+import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.agent.api.to.NicTO;
+
+public class MigrateWithStorageReceiveAnswer extends Answer {
+
+    Map<VolumeTO, Object> volumeToSr;
+    Map<NicTO, Object> nicToNetwork;
+    Map<String, String> token;
+
+    public MigrateWithStorageReceiveAnswer(MigrateWithStorageReceiveCommand cmd, Exception ex) {
+        super(cmd, ex);
+        volumeToSr = null;
+        nicToNetwork = null;
+        token = null;
+    }
+
+    public MigrateWithStorageReceiveAnswer(MigrateWithStorageReceiveCommand cmd, Map<VolumeTO, Object> volumeToSr,
+            Map<NicTO, Object> nicToNetwork, Map<String, String> token) {
+        super(cmd, true, null);
+        this.volumeToSr = volumeToSr;
+        this.nicToNetwork = nicToNetwork;
+        this.token = token;
+    }
+
+    public Map<VolumeTO, Object> getVolumeToSr() {
+        return volumeToSr;
+    }
+
+    public Map<NicTO, Object> getNicToNetwork() {
+        return nicToNetwork;
+    }
+
+    public Map<String, String> getToken() {
+        return token;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/MigrateWithStorageReceiveCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/MigrateWithStorageReceiveCommand.java b/core/src/com/cloud/agent/api/MigrateWithStorageReceiveCommand.java
new file mode 100644
index 0000000..df67405
--- /dev/null
+++ b/core/src/com/cloud/agent/api/MigrateWithStorageReceiveCommand.java
@@ -0,0 +1,45 @@
+// 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.agent.api;
+
+import java.util.Map;
+import com.cloud.agent.api.to.VirtualMachineTO;
+import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.agent.api.to.StorageFilerTO;
+
+public class MigrateWithStorageReceiveCommand extends Command {
+    VirtualMachineTO vm;
+    Map<VolumeTO, StorageFilerTO> volumeToFiler;
+
+    public MigrateWithStorageReceiveCommand(VirtualMachineTO vm, Map<VolumeTO, StorageFilerTO> volumeToFiler) {
+        this.vm = vm;
+        this.volumeToFiler = volumeToFiler;
+    }
+
+    public VirtualMachineTO getVirtualMachine() {
+        return vm;
+    }
+
+    public Map<VolumeTO, StorageFilerTO> getVolumeToFiler() {
+        return volumeToFiler;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/MigrateWithStorageSendAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/MigrateWithStorageSendAnswer.java b/core/src/com/cloud/agent/api/MigrateWithStorageSendAnswer.java
new file mode 100644
index 0000000..7cf641f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/MigrateWithStorageSendAnswer.java
@@ -0,0 +1,39 @@
+// 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.agent.api;
+
+import java.util.Set;
+import com.cloud.agent.api.to.VolumeTO;
+
+public class MigrateWithStorageSendAnswer extends Answer {
+
+    Set<VolumeTO> volumeToSet;
+
+    public MigrateWithStorageSendAnswer(MigrateWithStorageSendCommand cmd, Exception ex) {
+        super(cmd, ex);
+        volumeToSet = null;
+    }
+
+    public MigrateWithStorageSendAnswer(MigrateWithStorageSendCommand cmd, Set<VolumeTO> volumeToSet) {
+        super(cmd, true, null);
+        this.volumeToSet = volumeToSet;
+    }
+
+    public Set<VolumeTO> getVolumeToSet() {
+        return volumeToSet;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/MigrateWithStorageSendCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/MigrateWithStorageSendCommand.java b/core/src/com/cloud/agent/api/MigrateWithStorageSendCommand.java
new file mode 100644
index 0000000..d10db30
--- /dev/null
+++ b/core/src/com/cloud/agent/api/MigrateWithStorageSendCommand.java
@@ -0,0 +1,58 @@
+// 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.agent.api;
+
+import java.util.Map;
+import com.cloud.agent.api.to.VirtualMachineTO;
+import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.agent.api.to.NicTO;
+
+public class MigrateWithStorageSendCommand extends Command {
+    VirtualMachineTO vm;
+    Map<VolumeTO, Object> volumeToSr;
+    Map<NicTO, Object> nicToNetwork;
+    Map<String, String> token;
+
+    public MigrateWithStorageSendCommand(VirtualMachineTO vm, Map<VolumeTO, Object> volumeToSr,
+            Map<NicTO, Object> nicToNetwork, Map<String, String> token) {
+        this.vm = vm;
+        this.volumeToSr = volumeToSr;
+        this.nicToNetwork = nicToNetwork;
+        this.token = token;
+    }
+
+    public VirtualMachineTO getVirtualMachine() {
+        return vm;
+    }
+
+    public Map<VolumeTO, Object> getVolumeToSr() {
+        return volumeToSr;
+    }
+
+    public Map<NicTO, Object> getNicToNetwork() {
+        return nicToNetwork;
+    }
+
+    public Map<String, String> getToken() {
+        return token;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ModifySshKeysCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ModifySshKeysCommand.java b/core/src/com/cloud/agent/api/ModifySshKeysCommand.java
new file mode 100644
index 0000000..c078973
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ModifySshKeysCommand.java
@@ -0,0 +1,44 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+
+public class ModifySshKeysCommand extends Command {
+    @LogLevel(Log4jLevel.Off)
+    private String _pubKey;
+    @LogLevel(Log4jLevel.Off)
+    private String _prvKey;
+
+    public ModifySshKeysCommand() {
+
+    }
+    public ModifySshKeysCommand(String pubKey, String prvKey) {
+        _pubKey = pubKey;
+        _prvKey = prvKey;
+    }
+    public String getPubKey() {
+        return _pubKey;
+    }
+    public String getPrvKey() {
+        return _prvKey;
+    }
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ModifyStoragePoolAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ModifyStoragePoolAnswer.java b/core/src/com/cloud/agent/api/ModifyStoragePoolAnswer.java
new file mode 100644
index 0000000..df77985
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ModifyStoragePoolAnswer.java
@@ -0,0 +1,57 @@
+// 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.agent.api;
+
+import java.util.Map;
+
+import com.cloud.storage.template.TemplateInfo;
+
+public class ModifyStoragePoolAnswer extends Answer {
+    StoragePoolInfo poolInfo;
+    Map<String, TemplateInfo> templateInfo;
+
+    protected ModifyStoragePoolAnswer() {
+    }
+
+    public ModifyStoragePoolAnswer(ModifyStoragePoolCommand cmd, long capacityBytes, long availableBytes, Map<String, TemplateInfo> tInfo) {
+        super(cmd);
+        this.result = true;
+        this.poolInfo = new StoragePoolInfo(null,
+                cmd.getPool().getHost(), cmd.getPool().getPath(), cmd.getLocalPath(),
+                cmd.getPool().getType(), capacityBytes, availableBytes );
+
+        this.templateInfo = tInfo;
+    }
+
+    public StoragePoolInfo getPoolInfo() {
+       return poolInfo;
+    }
+
+    public void setPoolInfo(StoragePoolInfo poolInfo) {
+        this.poolInfo = poolInfo;
+    }
+
+
+    public Map<String, TemplateInfo> getTemplateInfo() {
+        return templateInfo;
+    }
+
+    public void setTemplateInfo(Map<String, TemplateInfo> templateInfo) {
+        this.templateInfo = templateInfo;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ModifyStoragePoolCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ModifyStoragePoolCommand.java b/core/src/com/cloud/agent/api/ModifyStoragePoolCommand.java
new file mode 100644
index 0000000..8bc956d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ModifyStoragePoolCommand.java
@@ -0,0 +1,75 @@
+// 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.agent.api;
+
+import java.io.File;
+import java.util.UUID;
+
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.StoragePool;
+
+public class ModifyStoragePoolCommand extends Command {
+
+	boolean add;
+	StorageFilerTO pool;
+    String localPath;
+	String [] options;
+	public static final String LOCAL_PATH_PREFIX="/mnt/";
+
+
+	public ModifyStoragePoolCommand() {
+
+	}
+
+    public ModifyStoragePoolCommand(boolean add, StoragePool pool, String localPath) {
+    	this.add = add;
+    	this.pool = new StorageFilerTO(pool);
+        this.localPath = localPath;
+
+    }
+
+    public ModifyStoragePoolCommand(boolean add, StoragePool pool) {
+		this(add, pool, LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes()));
+	}
+
+    public StorageFilerTO getPool() {
+        return pool;
+    }
+
+    public void setPool(StoragePool pool) {
+        this.pool = new StorageFilerTO(pool);
+    }
+
+	public boolean getAdd() {
+    	return add;
+    }
+
+	@Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+	public String getLocalPath() {
+		return localPath;
+	}
+
+	public void setOptions(String[] options) {
+		this.options = options;
+	}
+
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/NetworkUsageAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/NetworkUsageAnswer.java b/core/src/com/cloud/agent/api/NetworkUsageAnswer.java
new file mode 100644
index 0000000..fd8ebda
--- /dev/null
+++ b/core/src/com/cloud/agent/api/NetworkUsageAnswer.java
@@ -0,0 +1,61 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+
+@LogLevel(Log4jLevel.Debug)
+public class NetworkUsageAnswer extends Answer {
+	String routerName;
+	Long bytesSent;
+    Long bytesReceived;
+
+    protected NetworkUsageAnswer() {
+    }
+
+    public NetworkUsageAnswer(NetworkUsageCommand cmd, String details, Long bytesSent, Long bytesReceived) {
+        super(cmd, true, details);
+        this.bytesReceived = bytesReceived;
+        this.bytesSent = bytesSent;
+        routerName = cmd.getDomRName();
+    }
+
+    public NetworkUsageAnswer(Command command, Exception e) {
+        super(command, e);
+    }
+
+
+    public void setBytesReceived(Long bytesReceived) {
+        this.bytesReceived = bytesReceived;
+    }
+
+    public Long getBytesReceived() {
+        return bytesReceived;
+    }
+
+    public void setBytesSent(Long bytesSent) {
+        this.bytesSent = bytesSent;
+    }
+
+    public Long getBytesSent() {
+        return bytesSent;
+    }
+
+	public String getRouterName() {
+		return routerName;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/NetworkUsageCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/NetworkUsageCommand.java b/core/src/com/cloud/agent/api/NetworkUsageCommand.java
new file mode 100644
index 0000000..6cbf93b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/NetworkUsageCommand.java
@@ -0,0 +1,98 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+
+@LogLevel(Log4jLevel.Trace)
+public class NetworkUsageCommand extends Command {
+    private String privateIP;
+    private String domRName;
+    private String option;
+    boolean forVpc = false;
+    private String gatewayIP;
+    private String vpcCIDR;
+
+    protected NetworkUsageCommand() {
+
+    }
+
+    public NetworkUsageCommand(String privateIP, String domRName, boolean forVpc, String gatewayIP)
+    {
+        this.privateIP = privateIP;
+        this.domRName = domRName;
+        this.forVpc = forVpc;
+        this.gatewayIP = gatewayIP;
+        this.option = "get";
+    }
+
+    public NetworkUsageCommand(String privateIP, String domRName, String option, boolean forVpc)
+    {
+        this.privateIP = privateIP;
+        this.domRName = domRName;
+        this.option = option;
+        this.forVpc = forVpc;
+    }
+
+    public NetworkUsageCommand(String privateIP, String domRName, boolean forVpc, String gatewayIP, String vpcCIDR)
+    {
+        this.privateIP = privateIP;
+        this.domRName = domRName;
+        this.forVpc = forVpc;
+        this.gatewayIP = gatewayIP;
+        this.option = "create";
+        this.vpcCIDR = vpcCIDR;
+    }
+
+    public NetworkUsageCommand(String privateIP, String domRName, String option, boolean forVpc, String gatewayIP)
+    {
+        this.privateIP = privateIP;
+        this.domRName = domRName;
+        this.forVpc = forVpc;
+        this.gatewayIP = gatewayIP;
+        this.option = option;
+    }
+
+    public String getPrivateIP() {
+        return privateIP;
+    }
+
+    public String getDomRName() {
+        return domRName;
+    }
+
+    public String getOption() {
+        return option;
+    }
+
+    public boolean isForVpc() {
+        return forVpc;
+    }
+
+	public String getVpcCIDR() {
+		return vpcCIDR;
+	}
+
+	public String getGatewayIP() {
+		return gatewayIP;
+	}
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PingAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PingAnswer.java b/core/src/com/cloud/agent/api/PingAnswer.java
new file mode 100644
index 0000000..d9ed89c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PingAnswer.java
@@ -0,0 +1,33 @@
+// 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.agent.api;
+
+public class PingAnswer extends Answer {
+    private PingCommand _command = null;
+
+    protected PingAnswer() {
+    }
+
+    public PingAnswer(PingCommand cmd) {
+        super(cmd);
+        _command = cmd;
+    }
+
+    public PingCommand getCommand() {
+        return _command;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PingCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PingCommand.java b/core/src/com/cloud/agent/api/PingCommand.java
new file mode 100755
index 0000000..8d9681f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PingCommand.java
@@ -0,0 +1,45 @@
+// 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.agent.api;
+
+import com.cloud.host.Host;
+
+public class PingCommand extends Command {
+    Host.Type hostType;
+    long hostId;
+
+    protected PingCommand() {
+    }
+
+    public PingCommand(Host.Type type, long id) {
+        hostType = type;
+        hostId = id;
+    }
+
+    public Host.Type getHostType() {
+        return hostType;
+    }
+
+    public long getHostId() {
+        return hostId;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+ }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PingRoutingCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PingRoutingCommand.java b/core/src/com/cloud/agent/api/PingRoutingCommand.java
new file mode 100755
index 0000000..e25ac62
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PingRoutingCommand.java
@@ -0,0 +1,54 @@
+// 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.agent.api;
+
+import java.util.Map;
+
+import com.cloud.host.Host;
+import com.cloud.vm.VirtualMachine.State;
+
+public class PingRoutingCommand extends PingCommand {
+    Map<String, State> newStates;
+    boolean _gatewayAccessible = true;
+    boolean _vnetAccessible = true;
+
+    protected PingRoutingCommand() {
+    }
+
+    public PingRoutingCommand(Host.Type type, long id, Map<String, State> states) {
+        super(type, id);
+        this.newStates = states;
+    }
+
+    public Map<String, State> getNewStates() {
+        return newStates;
+    }
+
+    public boolean isGatewayAccessible() {
+        return _gatewayAccessible;
+    }
+    public void setGatewayAccessible(boolean gatewayAccessible) {
+        _gatewayAccessible = gatewayAccessible;
+    }
+
+    public boolean isVnetAccessible() {
+        return _vnetAccessible;
+    }
+    public void setVnetAccessible(boolean vnetAccessible) {
+        _vnetAccessible = vnetAccessible;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java b/core/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java
new file mode 100644
index 0000000..51226bc
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java
@@ -0,0 +1,46 @@
+// 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.agent.api;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.cloud.host.Host;
+import com.cloud.utils.Pair;
+import com.cloud.vm.VirtualMachine.State;
+
+
+public class PingRoutingWithNwGroupsCommand extends PingRoutingCommand {
+	HashMap<String, Pair<Long, Long>> newGroupStates;
+
+	protected PingRoutingWithNwGroupsCommand() {
+		super();
+	}
+
+	public PingRoutingWithNwGroupsCommand(Host.Type type, long id, Map<String, State> states, HashMap<String, Pair<Long, Long>> nwGrpStates) {
+		super(type, id, states);
+		newGroupStates = nwGrpStates;
+	}
+
+	public HashMap<String, Pair<Long, Long>> getNewGroupStates() {
+		return newGroupStates;
+	}
+
+	public void setNewGroupStates(HashMap<String, Pair<Long, Long>> newGroupStates) {
+		this.newGroupStates = newGroupStates;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java b/core/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java
new file mode 100644
index 0000000..d44987b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java
@@ -0,0 +1,42 @@
+// 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.agent.api;
+
+import java.util.List;
+import java.util.Map;
+
+import com.cloud.host.Host;
+import com.cloud.utils.Pair;
+import com.cloud.vm.VirtualMachine.State;
+
+public class PingRoutingWithOvsCommand extends PingRoutingCommand {
+	List<Pair<String, Long>> states;
+
+	protected PingRoutingWithOvsCommand() {
+		super();
+	}
+
+	public PingRoutingWithOvsCommand(Host.Type type, long id,
+			Map<String, State> states, List<Pair<String, Long>> ovsStates) {
+		super(type, id, states);
+		this.states = ovsStates;
+	}
+
+	public List<Pair<String, Long>> getStates() {
+		return states;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PingStorageCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PingStorageCommand.java b/core/src/com/cloud/agent/api/PingStorageCommand.java
new file mode 100755
index 0000000..438ab50
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PingStorageCommand.java
@@ -0,0 +1,37 @@
+// 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.agent.api;
+
+import java.util.Map;
+
+import com.cloud.host.Host;
+
+public class PingStorageCommand extends PingCommand {
+    Map<String, Boolean> changes;
+
+    protected PingStorageCommand() {
+    }
+
+    public PingStorageCommand(Host.Type type, long id, Map<String, Boolean> changes) {
+        super(type, id);
+        this.changes = changes;
+    }
+
+    public Map<String, Boolean> getChanges() {
+        return changes;
+    }
+}


[25/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/host/HostVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/host/HostVO.java b/core/src/com/cloud/host/HostVO.java
deleted file mode 100755
index c814b94..0000000
--- a/core/src/com/cloud/host/HostVO.java
+++ /dev/null
@@ -1,732 +0,0 @@
-// 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.host;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.DiscriminatorColumn;
-import javax.persistence.DiscriminatorType;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-
-import org.apache.cloudstack.api.Identity;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.resource.ResourceState;
-import com.cloud.storage.Storage.StoragePoolType;
-import com.cloud.utils.NumbersUtil;
-import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="host")
-@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
-@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32)
-public class HostVO implements Host {
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private long id;
-
-    @Column(name="disconnected")
-    @Temporal(value=TemporalType.TIMESTAMP)
-    private Date disconnectedOn;
-
-    @Column(name="name", nullable=false)
-    private String name = null;
-
-    /**
-     * Note: There is no setter for status because it has to be set in the dao code.
-     */
-    @Column(name="status", nullable=false)
-    private Status status = null;
-
-    @Column(name="type", updatable = true, nullable=false)
-    @Enumerated(value=EnumType.STRING)
-    private Type type;
-
-    @Column(name="private_ip_address", nullable=false)
-    private String privateIpAddress;
-
-    @Column(name="private_mac_address", nullable=false)
-    private String privateMacAddress;
-
-    @Column(name="private_netmask", nullable=false)
-    private String privateNetmask;
-
-    @Column(name="public_netmask")
-    private String publicNetmask;
-
-    @Column(name="public_ip_address")
-    private String publicIpAddress;
-
-    @Column(name="public_mac_address")
-    private String publicMacAddress;
-
-    @Column(name="storage_ip_address")
-    private String storageIpAddress;
-
-    @Column(name="cluster_id")
-    private Long clusterId;
-
-    @Column(name="storage_netmask")
-    private String storageNetmask;
-
-    @Column(name="storage_mac_address")
-    private String storageMacAddress;
-
-    @Column(name="storage_ip_address_2")
-    private String storageIpAddressDeux;
-
-    @Column(name="storage_netmask_2")
-    private String storageNetmaskDeux;
-
-    @Column(name="storage_mac_address_2")
-    private String storageMacAddressDeux;
-
-    @Column(name="hypervisor_type", updatable = true, nullable=false)
-    @Enumerated(value=EnumType.STRING)
-    private HypervisorType hypervisorType;
-
-    @Column(name="proxy_port")
-    private Integer proxyPort;
-
-    @Column(name="resource")
-    private String resource;
-
-    @Column(name="fs_type")
-    private StoragePoolType fsType;
-
-    @Column(name="available")
-    private boolean available = true;
-
-    @Column(name="setup")
-    private boolean setup = false;
-
-    @Column(name="resource_state", nullable=false)
-    @Enumerated(value=EnumType.STRING)
-    private ResourceState resourceState;
-
-    @Column(name="hypervisor_version")
-    private String hypervisorVersion;
-
-    @Column(name="update_count", updatable = true, nullable=false)
-    protected long updated;	// This field should be updated everytime the state is updated.  There's no set method in the vo object because it is done with in the dao code.
-
-    @Column(name="uuid")
-    private String uuid;
-
-    // This is a delayed load value.  If the value is null,
-    // then this field has not been loaded yet.
-    // Call host dao to load it.
-    @Transient
-    Map<String, String> details;
-
-    // This is a delayed load value.  If the value is null,
-    // then this field has not been loaded yet.
-    // Call host dao to load it.
-    @Transient
-    List<String> hostTags;
-
-    @Override
-    public String getStorageIpAddressDeux() {
-        return storageIpAddressDeux;
-    }
-
-    public void setStorageIpAddressDeux(String deuxStorageIpAddress) {
-        this.storageIpAddressDeux = deuxStorageIpAddress;
-    }
-
-    @Override
-    public String getStorageNetmaskDeux() {
-        return storageNetmaskDeux;
-    }
-
-    @Override
-    public Long getClusterId() {
-        return clusterId;
-    }
-
-    public void setClusterId(Long clusterId) {
-        this.clusterId = clusterId;
-    }
-
-    public void setStorageNetmaskDeux(String deuxStorageNetmask) {
-        this.storageNetmaskDeux = deuxStorageNetmask;
-    }
-
-    @Override
-    public String getStorageMacAddressDeux() {
-        return storageMacAddressDeux;
-    }
-
-    public void setStorageMacAddressDeux(String duexStorageMacAddress) {
-        this.storageMacAddressDeux = duexStorageMacAddress;
-    }
-
-    @Override
-    public String getPrivateMacAddress() {
-        return privateMacAddress;
-    }
-
-    public void setPrivateMacAddress(String privateMacAddress) {
-        this.privateMacAddress = privateMacAddress;
-    }
-
-    public boolean isAvailable() {
-        return available;
-    }
-
-    public void setAvailable(boolean available) {
-        this.available = available;
-    }
-
-    @Override
-    public String getPrivateNetmask() {
-        return privateNetmask;
-    }
-
-    public void setPrivateNetmask(String privateNetmask) {
-        this.privateNetmask = privateNetmask;
-    }
-
-    @Override
-    public String getPublicNetmask() {
-        return publicNetmask;
-    }
-
-    public void setPublicNetmask(String publicNetmask) {
-        this.publicNetmask = publicNetmask;
-    }
-
-    @Override
-    public String getPublicIpAddress() {
-        return publicIpAddress;
-    }
-
-    public void setPublicIpAddress(String publicIpAddress) {
-        this.publicIpAddress = publicIpAddress;
-    }
-
-    @Override
-    public String getPublicMacAddress() {
-        return publicMacAddress;
-    }
-
-    public void setPublicMacAddress(String publicMacAddress) {
-        this.publicMacAddress = publicMacAddress;
-    }
-
-    @Override
-    public String getStorageIpAddress() {
-        return storageIpAddress;
-    }
-
-    public void setStorageIpAddress(String storageIpAddress) {
-        this.storageIpAddress = storageIpAddress;
-    }
-
-    @Override
-    public String getStorageNetmask() {
-        return storageNetmask;
-    }
-
-    public void setStorageNetmask(String storageNetmask) {
-        this.storageNetmask = storageNetmask;
-    }
-
-    @Override
-    public String getStorageMacAddress() {
-        return storageMacAddress;
-    }
-
-    public boolean isSetup() {
-        return setup;
-    }
-
-    public void setSetup(boolean setup) {
-        this.setup = setup;
-    }
-
-    public void setStorageMacAddress(String storageMacAddress) {
-        this.storageMacAddress = storageMacAddress;
-    }
-
-    public String getResource() {
-        return resource;
-    }
-
-    public void setResource(String resource) {
-        this.resource = resource;
-    }
-
-    public Map<String, String> getDetails() {
-        return details;
-    }
-
-    public String getDetail(String name) {
-        assert (details != null) : "Did you forget to load the details?";
-
-        return details != null ? details.get(name) : null;
-    }
-
-    public void setDetail(String name, String value) {
-        assert (details != null) : "Did you forget to load the details?";
-
-        details.put(name, value);
-    }
-
-    public void setDetails(Map<String, String> details) {
-        this.details = details;
-    }
-
-    public List<String> getHostTags() {
-        return hostTags;
-    }
-
-    public void setHostTags(List<String> hostTags) {
-        this.hostTags = hostTags;
-    }
-
-    @Column(name="data_center_id", nullable=false)
-    private long dataCenterId;
-
-    @Column(name="pod_id")
-    private Long podId;
-
-    @Column(name="cpus")
-    private Integer cpus;
-
-    @Column(name="url")
-    private String storageUrl;
-
-    @Column(name="speed")
-    private Long speed;
-
-    @Column(name="ram")
-    private long totalMemory;
-
-    @Column(name="parent", nullable=false)
-    private String parent;
-
-    @Column(name="guid", updatable=true, nullable=false)
-    private String guid;
-
-    @Column(name="capabilities")
-    private String caps;
-
-    @Column(name="total_size")
-    private Long totalSize;
-
-    @Column(name="last_ping")
-    private long lastPinged;
-
-    @Column(name="mgmt_server_id")
-    private Long managementServerId;
-
-    @Column(name="dom0_memory")
-    private long dom0MinMemory;
-
-    @Column(name="version")
-    private String version;
-
-    @Column(name=GenericDao.CREATED_COLUMN)
-    private Date created;
-
-    @Column(name=GenericDao.REMOVED_COLUMN)
-    private Date removed;
-
-    public HostVO(String guid) {
-        this.guid = guid;
-        this.status = Status.Creating;
-        this.totalMemory = 0;
-        this.dom0MinMemory = 0;
-        this.resourceState = ResourceState.Creating;
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    protected HostVO() {
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    public HostVO(long id,
-            String name,
-            Type type,
-            String privateIpAddress,
-            String privateNetmask,
-            String privateMacAddress,
-            String publicIpAddress,
-            String publicNetmask,
-            String publicMacAddress,
-            String storageIpAddress,
-            String storageNetmask,
-            String storageMacAddress,
-            String deuxStorageIpAddress,
-            String duxStorageNetmask,
-            String deuxStorageMacAddress,
-            String guid,
-            Status status,
-            String version,
-            String iqn,
-            Date disconnectedOn,
-            long dcId,
-            Long podId,
-            long serverId,
-            long ping,
-            String parent,
-            long totalSize,
-            StoragePoolType fsType) {
-        this(id, name, type, privateIpAddress, privateNetmask, privateMacAddress, publicIpAddress, publicNetmask, publicMacAddress, storageIpAddress, storageNetmask, storageMacAddress, guid, status, version, iqn, disconnectedOn, dcId, podId, serverId, ping, null, null, null, 0, null);
-        this.parent = parent;
-        this.totalSize = totalSize;
-        this.fsType = fsType;
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    public HostVO(long id,
-            String name,
-            Type type,
-            String privateIpAddress,
-            String privateNetmask,
-            String privateMacAddress,
-            String publicIpAddress,
-            String publicNetmask,
-            String publicMacAddress,
-            String storageIpAddress,
-            String storageNetmask,
-            String storageMacAddress,
-            String guid,
-            Status status,
-            String version,
-            String url,
-            Date disconnectedOn,
-            long dcId,
-            Long podId,
-            long serverId,
-            long ping,
-            Integer cpus,
-            Long speed,
-            Long totalMemory,
-            long dom0MinMemory,
-            String caps) {
-        this.id = id;
-        this.name = name;
-        this.status = status;
-        this.type = type;
-        this.privateIpAddress = privateIpAddress;
-        this.privateNetmask = privateNetmask;
-        this.privateMacAddress = privateMacAddress;
-        this.publicIpAddress = publicIpAddress;
-        this.publicNetmask = publicNetmask;
-        this.publicMacAddress = publicMacAddress;
-        this.storageIpAddress = storageIpAddress;
-        this.storageNetmask = storageNetmask;
-        this.storageMacAddress = storageMacAddress;
-        this.dataCenterId = dcId;
-        this.podId = podId;
-        this.cpus = cpus;
-        this.version = version;
-        this.speed = speed;
-        this.totalMemory = totalMemory != null ? totalMemory : 0;
-        this.guid = guid;
-        this.parent = null;
-        this.totalSize = null;
-        this.fsType = null;
-        this.managementServerId = serverId;
-        this.lastPinged = ping;
-        this.caps = caps;
-        this.disconnectedOn = disconnectedOn;
-        this.dom0MinMemory = dom0MinMemory;
-        this.storageUrl = url;
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    public void setPodId(Long podId) {
-
-        this.podId = podId;
-    }
-
-    public void setDataCenterId(long dcId) {
-        this.dataCenterId = dcId;
-    }
-
-    public void setVersion(String version) {
-        this.version = version;
-    }
-
-    public void setStorageUrl(String url) {
-        this.storageUrl = url;
-    }
-
-    public void setDisconnectedOn(Date disconnectedOn) {
-        this.disconnectedOn = disconnectedOn;
-    }
-
-    public String getStorageUrl() {
-        return storageUrl;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public void setPrivateIpAddress(String ipAddress) {
-        this.privateIpAddress = ipAddress;
-    }
-
-    public void setCpus(Integer cpus) {
-        this.cpus = cpus;
-    }
-
-    public void setSpeed(Long speed) {
-        this.speed = speed;
-    }
-
-    public void setTotalMemory(long totalMemory) {
-        this.totalMemory = totalMemory;
-    }
-
-    public void setParent(String parent) {
-        this.parent = parent;
-    }
-
-    public void setCaps(String caps) {
-        this.caps = caps;
-    }
-
-    public void setTotalSize(Long totalSize) {
-        this.totalSize = totalSize;
-    }
-
-    public void setLastPinged(long lastPinged) {
-        this.lastPinged = lastPinged;
-    }
-
-    public void setManagementServerId(Long managementServerId) {
-        this.managementServerId = managementServerId;
-    }
-
-    @Override
-    public long getLastPinged() {
-        return lastPinged;
-    }
-
-    @Override
-    public String getParent() {
-        return parent;
-    }
-
-    @Override
-    public long getTotalSize() {
-        return totalSize;
-    }
-
-    @Override
-    public String getCapabilities() {
-        return caps;
-    }
-
-    @Override
-    public Date getCreated() {
-        return created;
-    }
-
-    @Override
-    public Date getRemoved() {
-        return removed;
-    }
-
-    @Override
-    public String getVersion() {
-        return version;
-    }
-
-    public void setType(Type type) {
-        this.type = type;
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public Status getStatus() {
-        return status;
-    }
-
-    @Override
-    public long getDataCenterId() {
-        return dataCenterId;
-    }
-
-    @Override
-    public Long getPodId() {
-        return podId;
-    }
-
-    @Override
-    public Long getManagementServerId() {
-        return managementServerId;
-    }
-
-    @Override
-    public Date getDisconnectedOn() {
-        return disconnectedOn;
-    }
-
-    @Override
-    public String getPrivateIpAddress() {
-        return privateIpAddress;
-    }
-
-    @Override
-    public String getGuid() {
-        return guid;
-    }
-
-    public void setGuid(String guid) {
-        this.guid = guid;
-    }
-
-    @Override
-    public Integer getCpus() {
-        return cpus;
-    }
-
-    @Override
-    public Long getSpeed() {
-        return speed;
-    }
-
-    @Override
-    public Long getTotalMemory() {
-        return totalMemory;
-    }
-
-    @Override
-    public Integer getProxyPort() {
-        return proxyPort;
-    }
-
-    public void setProxyPort(Integer port) {
-        proxyPort = port;
-    }
-
-    public StoragePoolType getFsType() {
-        return fsType;
-    }
-
-    @Override
-    public Type getType() {
-        return type;
-    }
-
-    @Override
-    public int hashCode() {
-        return NumbersUtil.hash(id);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof HostVO) {
-            return ((HostVO)obj).getId() == this.getId();
-        } else {
-            return false;
-        }
-    }
-
-    @Override
-    public String toString() {
-        return new StringBuilder("Host[").append("-").append(id).append("-").append(type).append("]").toString();
-    }
-
-    public void setHypervisorType(HypervisorType hypervisorType) {
-        this.hypervisorType = hypervisorType;
-    }
-
-    @Override
-    public HypervisorType getHypervisorType() {
-        return hypervisorType;
-    }
-
-    public void setHypervisorVersion(String hypervisorVersion) {
-        this.hypervisorVersion = hypervisorVersion;
-    }
-
-    @Override
-    public String getHypervisorVersion() {
-        return hypervisorVersion;
-    }
-
-	@Override
-	@Transient
-	public Status getState() {
-		return status;
-	}
-
-    @Override
-    public ResourceState getResourceState() {
-        return resourceState;
-    }
-
-    public void setResourceState(ResourceState state) {
-    	resourceState = state;
-    }
-
-    @Override
-    public boolean isInMaintenanceStates() {
-        return (getResourceState() == ResourceState.Maintenance || getResourceState() == ResourceState.ErrorInMaintenance
-                || getResourceState() == ResourceState.PrepareForMaintenance);
-    }
-
-    public long getUpdated() {
-    	return updated;
-    }
-
-	public long incrUpdated() {
-		updated++;
-		return updated;
-	}
-
-	@Override
-	public String getUuid() {
-		return this.uuid;
-	}
-
-	public void setUuid(String uuid) {
-		this.uuid = uuid;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/hypervisor/HypervisorCapabilitiesVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/hypervisor/HypervisorCapabilitiesVO.java b/core/src/com/cloud/hypervisor/HypervisorCapabilitiesVO.java
deleted file mode 100644
index 6689066..0000000
--- a/core/src/com/cloud/hypervisor/HypervisorCapabilitiesVO.java
+++ /dev/null
@@ -1,212 +0,0 @@
-// 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.hypervisor;
-
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.apache.cloudstack.api.Identity;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.utils.NumbersUtil;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="hypervisor_capabilities")
-public class HypervisorCapabilitiesVO implements HypervisorCapabilities {
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private long id;
-
-    @Column(name="hypervisor_type")
-    @Enumerated(value=EnumType.STRING)
-    private HypervisorType hypervisorType;
-
-    @Column(name="hypervisor_version")
-    private String hypervisorVersion;
-
-    @Column(name="max_guests_limit")
-    private Long maxGuestsLimit;
-
-    @Column(name="security_group_enabled")
-    private boolean securityGroupEnabled;
-
-    @Column(name="uuid")
-    private String uuid;
-
-    @Column(name="max_data_volumes_limit")
-    private Integer maxDataVolumesLimit;
-
-    @Column(name="max_hosts_per_cluster")
-    private Integer maxHostsPerCluster;
-
-    @Column(name="vm_snapshot_enabled")
-    private Boolean vmSnapshotEnabled;
-
-    @Column(name="storage_motion_supported")
-    private boolean storageMotionSupported;
-
-    protected HypervisorCapabilitiesVO() {
-    	this.uuid = UUID.randomUUID().toString();
-    }
-
-    public HypervisorCapabilitiesVO(HypervisorType hypervisorType, String hypervisorVersion, Long maxGuestsLimit,
-            boolean securityGroupEnabled, boolean storageMotionSupported) {
-        this.hypervisorType = hypervisorType;
-        this.hypervisorVersion = hypervisorVersion;
-        this.maxGuestsLimit = maxGuestsLimit;
-        this.securityGroupEnabled = securityGroupEnabled;
-        this.storageMotionSupported = storageMotionSupported;
-    	this.uuid = UUID.randomUUID().toString();
-    }
-
-    /**
-     * @param hypervisorType the hypervisorType to set
-     */
-    public void setHypervisorType(HypervisorType hypervisorType) {
-        this.hypervisorType = hypervisorType;
-    }
-
-
-    /**
-     * @return the hypervisorType
-     */
-    @Override
-    public HypervisorType getHypervisorType() {
-        return hypervisorType;
-    }
-
-    /**
-     * @param hypervisorVersion the hypervisorVersion to set
-     */
-    public void setHypervisorVersion(String hypervisorVersion) {
-        this.hypervisorVersion = hypervisorVersion;
-    }
-
-    /**
-     * @return the hypervisorVersion
-     */
-    @Override
-    public String getHypervisorVersion() {
-        return hypervisorVersion;
-    }
-
-    public void setSecurityGroupEnabled(Boolean securityGroupEnabled) {
-        this.securityGroupEnabled = securityGroupEnabled;
-    }
-
-    /**
-     * @return the securityGroupSupport
-     */
-    @Override
-    public boolean isSecurityGroupEnabled() {
-        return securityGroupEnabled;
-    }
-
-    /**
-     * @param maxGuests the maxGuests to set
-     */
-    public void setMaxGuestsLimit(Long maxGuestsLimit) {
-        this.maxGuestsLimit = maxGuestsLimit;
-    }
-
-    /**
-     * @return the maxGuests
-     */
-    @Override
-    public Long getMaxGuestsLimit() {
-        return maxGuestsLimit;
-    }
-
-    /**
-     * @param storageMotionSupported
-     */
-    public void setStorageMotionSupported(boolean storageMotionSupported) {
-        this.storageMotionSupported = storageMotionSupported;
-    }
-
-    /**
-     * @return if storage motion is supported
-     */
-    @Override
-    public boolean isStorageMotionSupported() {
-        return storageMotionSupported;
-    }
-
-
-    public long getId() {
-        return id;
-    }
-
-    @Override
-    public int hashCode() {
-        return NumbersUtil.hash(id);
-    }
-    
-    @Override
-    public String getUuid() {
-    	return this.uuid;
-    }
-    
-    public void setUuid(String uuid) {
-    	this.uuid = uuid;
-    }
-
-    @Override
-    public Integer getMaxDataVolumesLimit() {
-        return maxDataVolumesLimit;
-    }
-
-    public void setMaxDataVolumesLimit(Integer maxDataVolumesLimit) {
-        this.maxDataVolumesLimit = maxDataVolumesLimit;
-    }
-
-    @Override
-    public Integer getMaxHostsPerCluster() {
-        return maxHostsPerCluster;
-    }
-
-    public void setMaxHostsPerCluster(Integer maxHostsPerCluster) {
-        this.maxHostsPerCluster = maxHostsPerCluster;
-    }
-
-	public Boolean getVmSnapshotEnabled() {
-		return vmSnapshotEnabled;
-	}
-
-	public void setVmSnapshotEnabled(Boolean vmSnapshotEnabled) {
-		this.vmSnapshotEnabled = vmSnapshotEnabled;
-	}
-
-	@Override
-    public boolean equals(Object obj) {
-        if (obj instanceof HypervisorCapabilitiesVO) {
-            return ((HypervisorCapabilitiesVO)obj).getId() == this.getId();
-        } else {
-            return false;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/info/ConsoleProxyLoadInfo.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/info/ConsoleProxyLoadInfo.java b/core/src/com/cloud/info/ConsoleProxyLoadInfo.java
deleted file mode 100644
index a3ec3e3..0000000
--- a/core/src/com/cloud/info/ConsoleProxyLoadInfo.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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.info;
-
-public class ConsoleProxyLoadInfo {
-	
-	private long id;
-	private String name;
-	private int count;
-	
-	public long getId() {
-		return id;
-	}
-	
-	public void setId(long id) {
-		this.id = id;
-	}
-	
-	public String getName() {
-		return name;
-	}
-	
-	public void setName(String name) {
-		this.name = name;
-	}
-	
-	public int getCount() {
-		return count;
-	}
-	
-	public void setCount(int count) {
-		this.count = count;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/info/RunningHostCountInfo.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/info/RunningHostCountInfo.java b/core/src/com/cloud/info/RunningHostCountInfo.java
deleted file mode 100644
index f77a4dc..0000000
--- a/core/src/com/cloud/info/RunningHostCountInfo.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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.info;
-
-public class RunningHostCountInfo {
-	
-	private long dcId;
-	private String hostType;
-	private int count;
-	
-	public long getDcId() {
-		return dcId;
-	}
-	
-	public void setDcId(long dcId) {
-		this.dcId = dcId;
-	}
-	
-	public String getHostType() {
-		return hostType;
-	}
-	
-	public void setHostType(String hostType) {
-		this.hostType = hostType;
-	}
-	
-	public int getCount() {
-		return count;
-	}
-	
-	public void setCount(int count) {
-		this.count = count;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/network/VpnUserVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/network/VpnUserVO.java b/core/src/com/cloud/network/VpnUserVO.java
deleted file mode 100644
index 5a8e531..0000000
--- a/core/src/com/cloud/network/VpnUserVO.java
+++ /dev/null
@@ -1,131 +0,0 @@
-// 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.network;
-
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.apache.cloudstack.api.Identity;
-import com.cloud.utils.db.Encrypt;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name=("vpn_users"))
-public class VpnUserVO implements VpnUser {
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private long id;
-
-    @Column(name="owner_id")
-    private long accountId;
-
-    @Column(name="domain_id")
-    private long domainId;
-
-    @Column(name="username")
-    private String username;
-
-    @Encrypt
-    @Column(name="password")
-    private String password;
-
-    @Column(name="state")
-    @Enumerated(value=EnumType.STRING)
-    private State state;
-
-    @Column(name="uuid")
-    private String uuid;
-
-    public VpnUserVO() {
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    public VpnUserVO(long accountId, long domainId, String userName, String password) {
-        this.accountId = accountId;
-        this.domainId = domainId;
-        this.username = userName;
-        this.password = password;
-        this.state = State.Add;
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-
-    @Override
-    public long getAccountId() {
-        return accountId;
-    }
-
-    @Override
-    public String getUsername() {
-        return username;
-    }
-
-    public void setUsername(String userName) {
-        this.username = userName;
-    }
-
-    @Override
-    public String getPassword() {
-        return password;
-    }
-
-    @Override
-    public State getState() {
-        return state;
-    }
-
-    public void setState(State state) {
-        this.state = state;
-    }
-
-    public void setPassword(String password) {
-        this.password = password;
-    }
-
-    @Override
-    public long getDomainId() {
-        return domainId;
-    }
-
-
-    @Override
-    public String toString() {
-        return new StringBuilder("VpnUser[").append(id).append("-").append(username).append("-").append(accountId).append("]").toString();
-    }
-
-    @Override
-    public String getUuid() {
-        return this.uuid;
-    }
-
-    public void setUuid(String uuid) {
-        this.uuid = uuid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/network/security/SecurityGroupRuleVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/network/security/SecurityGroupRuleVO.java b/core/src/com/cloud/network/security/SecurityGroupRuleVO.java
deleted file mode 100644
index f01b50f..0000000
--- a/core/src/com/cloud/network/security/SecurityGroupRuleVO.java
+++ /dev/null
@@ -1,167 +0,0 @@
-// 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.network.security;
-
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import com.cloud.async.AsyncInstanceCreateStatus;
-import com.google.gson.annotations.Expose;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name = ("security_group_rule"))
-public class SecurityGroupRuleVO implements SecurityRule {
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Column(name = "id")
-    private long id;
-
-    @Column(name = "security_group_id")
-    private long securityGroupId;
-
-    @Column(name = "start_port")
-    private int startPort;
-
-    @Column(name = "end_port")
-    private int endPort;
-
-    @Column(name = "type")
-    private String type;
-
-    @Column(name = "protocol")
-    private String protocol;
-
-    @Column(name = "allowed_network_id", nullable = true)
-    private Long allowedNetworkId = null;
-
-    @Column(name = "allowed_ip_cidr", nullable = true)
-    private String allowedSourceIpCidr = null;
-
-    @Expose
-    @Column(name = "create_status", updatable = true, nullable = false)
-    @Enumerated(value = EnumType.STRING)
-    private AsyncInstanceCreateStatus createStatus;
-
-    @Column(name = "uuid")
-    private String uuid;
-    
-    public SecurityGroupRuleVO() {
-    	this.uuid = UUID.randomUUID().toString();
-    }
-
-    public SecurityGroupRuleVO(SecurityRuleType type,long securityGroupId, int fromPort, int toPort, String protocol, long allowedNetworkId ) {
-        this.securityGroupId = securityGroupId;
-        this.startPort = fromPort;
-        this.endPort = toPort;
-        this.protocol = protocol;
-        this.allowedNetworkId = allowedNetworkId;
-    	this.uuid = UUID.randomUUID().toString();
-        if (type == SecurityRuleType.IngressRule) {
-            this.type = SecurityRuleType.IngressRule.getType();
-        } else {
-            this.type = SecurityRuleType.EgressRule.getType();
-        }
-    }
-
-    public SecurityGroupRuleVO(SecurityRuleType type,long securityGroupId, int fromPort, int toPort, String protocol, String allowedIpCidr) {
-        this.securityGroupId = securityGroupId;
-        this.startPort = fromPort;
-        this.endPort = toPort;
-        this.protocol = protocol;
-        this.allowedSourceIpCidr = allowedIpCidr;
-    	this.uuid = UUID.randomUUID().toString();
-        if (type == SecurityRuleType.IngressRule) {
-            this.type = SecurityRuleType.IngressRule.getType();
-        } else {
-            this.type = SecurityRuleType.EgressRule.getType();
-        }
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-    
-    @Override
-    public String getType() {
-        return type;
-    }
-
-    @Override
-    public long getSecurityGroupId() {
-        return securityGroupId;
-    }
-    
-    public SecurityRuleType getRuleType() {
-        if ("ingress".equalsIgnoreCase(this.type))
-            return SecurityRuleType.IngressRule;
-        else
-            return SecurityRuleType.EgressRule;
-    }
-    
-    @Override
-    public int getStartPort() {
-        return startPort;
-    }
-
-    @Override
-    public int getEndPort() {
-        return endPort;
-    }
-
-    @Override
-    public String getProtocol() {
-        return protocol;
-    }
-
-    @Override
-    public AsyncInstanceCreateStatus getCreateStatus() {
-        return createStatus;
-    }
-
-    public void setCreateStatus(AsyncInstanceCreateStatus createStatus) {
-        this.createStatus = createStatus;
-    }
-
-    @Override
-    public Long getAllowedNetworkId() {
-        return allowedNetworkId;
-    }
-
-    @Override
-    public String getAllowedSourceIpCidr() {
-        return allowedSourceIpCidr;
-    }
-    
-    @Override
-    public String getUuid() {
-    	return this.uuid;
-    }
-    
-    public void setUuid(String uuid) {
-    	this.uuid = uuid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/network/security/SecurityGroupRulesVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/network/security/SecurityGroupRulesVO.java b/core/src/com/cloud/network/security/SecurityGroupRulesVO.java
deleted file mode 100644
index 82060ef..0000000
--- a/core/src/com/cloud/network/security/SecurityGroupRulesVO.java
+++ /dev/null
@@ -1,156 +0,0 @@
-// 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.network.security;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.PrimaryKeyJoinColumn;
-import javax.persistence.SecondaryTable;
-import javax.persistence.Table;
-
-import com.cloud.network.security.SecurityRule.SecurityRuleType;
-import com.cloud.utils.db.JoinType;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name = ("security_group"))
-@JoinType(type = "left")
-@SecondaryTable(name = "security_group_rule", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "id", referencedColumnName = "security_group_id") })
-public class SecurityGroupRulesVO implements SecurityGroupRules {
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Column(name = "id")
-    private long id;
-
-    @Column(name = "name")
-    private String name;
-
-    @Column(name = "description")
-    private String description;
-
-    @Column(name = "domain_id")
-    private Long domainId;
-
-    @Column(name = "account_id")
-    private Long accountId;
-
-    @Column(name = "id", table = "security_group_rule", insertable = false, updatable = false)
-    private Long ruleId;
-
-    @Column(name = "start_port", table = "security_group_rule", insertable = false, updatable = false)
-    private int startPort;
-
-    @Column(name = "end_port", table = "security_group_rule", insertable = false, updatable = false)
-    private int endPort;
-
-    @Column(name = "protocol", table = "security_group_rule", insertable = false, updatable = false)
-    private String protocol;
-
-    @Column(name = "type", table = "security_group_rule", insertable = false, updatable = false)
-    private String type;
-
-    @Column(name = "allowed_network_id", table = "security_group_rule", insertable = false, updatable = false, nullable = true)
-    private Long allowedNetworkId = null;
-
-    @Column(name = "allowed_ip_cidr", table = "security_group_rule", insertable = false, updatable = false, nullable = true)
-    private String allowedSourceIpCidr = null;
-
-    public SecurityGroupRulesVO() {
-    }
-
-    public SecurityGroupRulesVO(long id, String name, String description, Long domainId, Long accountId, Long ruleId, int startPort, int endPort, String protocol, Long allowedNetworkId,
-            String allowedSourceIpCidr) {
-        this.id = id;
-        this.name = name;
-        this.description = description;
-        this.domainId = domainId;
-        this.accountId = accountId;
-        this.ruleId = ruleId;
-        this.startPort = startPort;
-        this.endPort = endPort;
-        this.protocol = protocol;
-        this.allowedNetworkId = allowedNetworkId;
-        this.allowedSourceIpCidr = allowedSourceIpCidr;
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public Long getDomainId() {
-        return domainId;
-    }
-
-    @Override
-    public Long getAccountId() {
-        return accountId;
-    }
-
-    @Override
-    public Long getRuleId() {
-        return ruleId;
-    }
-
-    @Override
-    public int getStartPort() {
-        return startPort;
-    }
-
-    @Override
-    public int getEndPort() {
-        return endPort;
-    }
-
-    @Override
-    public String getProtocol() {
-        return protocol;
-    }
-
-    @Override
-    public SecurityRuleType getRuleType() {
-        if ("ingress".equalsIgnoreCase(this.type)) {
-            return SecurityRuleType.IngressRule;
-        } else {
-            return SecurityRuleType.EgressRule;
-        }
-    }
-
-    @Override
-    public Long getAllowedNetworkId() {
-        return allowedNetworkId;
-    }
-
-    @Override
-    public String getAllowedSourceIpCidr() {
-        return allowedSourceIpCidr;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/network/security/SecurityGroupVMMapVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/network/security/SecurityGroupVMMapVO.java b/core/src/com/cloud/network/security/SecurityGroupVMMapVO.java
deleted file mode 100644
index 75bde33..0000000
--- a/core/src/com/cloud/network/security/SecurityGroupVMMapVO.java
+++ /dev/null
@@ -1,89 +0,0 @@
-// 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.network.security;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.PrimaryKeyJoinColumn;
-import javax.persistence.SecondaryTable;
-import javax.persistence.SecondaryTables;
-import javax.persistence.Table;
-
-import com.cloud.vm.VirtualMachine.State;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name = ("security_group_vm_map"))
-@SecondaryTables({ @SecondaryTable(name = "nics", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "instance_id", referencedColumnName = "instance_id") }),
-        @SecondaryTable(name = "vm_instance", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "instance_id", referencedColumnName = "id") }),
-        @SecondaryTable(name = "security_group", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "security_group_id", referencedColumnName = "id") }) })
-public class SecurityGroupVMMapVO implements InternalIdentity {
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Column(name = "id")
-    private Long id;
-
-    @Column(name = "security_group_id")
-    private long securityGroupId;
-
-    @Column(name = "instance_id")
-    private long instanceId;
-
-    @Column(name = "ip4_address", table = "nics", insertable = false, updatable = false)
-    private String guestIpAddress;
-
-    @Column(name = "state", table = "vm_instance", insertable = false, updatable = false)
-    private State vmState;
-
-    @Column(name = "name", table = "security_group", insertable = false, updatable = false)
-    private String groupName;
-
-    public SecurityGroupVMMapVO() {
-    }
-
-    public SecurityGroupVMMapVO(long securityGroupId, long instanceId) {
-        this.securityGroupId = securityGroupId;
-        this.instanceId = instanceId;
-    }
-
-    public long getId() {
-        return id;
-    }
-
-    public long getSecurityGroupId() {
-        return securityGroupId;
-    }
-
-    public String getGuestIpAddress() {
-        return guestIpAddress;
-    }
-
-    public long getInstanceId() {
-        return instanceId;
-    }
-
-    public State getVmState() {
-        return vmState;
-    }
-
-    public String getGroupName() {
-        return groupName;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/network/security/SecurityGroupVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/network/security/SecurityGroupVO.java b/core/src/com/cloud/network/security/SecurityGroupVO.java
deleted file mode 100644
index be7c593..0000000
--- a/core/src/com/cloud/network/security/SecurityGroupVO.java
+++ /dev/null
@@ -1,99 +0,0 @@
-// 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.network.security;
-
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name = ("security_group"))
-public class SecurityGroupVO implements SecurityGroup {
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Column(name = "id")
-    private long id;
-
-    @Column(name = "name")
-    private String name;
-
-    @Column(name = "description")
-    private String description;
-
-    @Column(name = "domain_id")
-    private long domainId;
-
-    @Column(name = "account_id")
-    private long accountId;
-
-    @Column(name = "uuid")
-    private String uuid;
-    
-    public SecurityGroupVO() {
-    	this.uuid = UUID.randomUUID().toString();
-    }
-
-    public SecurityGroupVO(String name, String description, long domainId, long accountId) {
-        this.name = name;
-        this.description = description;
-        this.domainId = domainId;
-        this.accountId = accountId;
-    	this.uuid = UUID.randomUUID().toString();
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public long getDomainId() {
-        return domainId;
-    }
-
-    @Override
-    public long getAccountId() {
-        return accountId;
-    }
-    
-    @Override
-    public String getUuid() {
-    	return this.uuid;
-    }
-    
-    public void setUuid(String uuid) {
-    	this.uuid = uuid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/network/security/SecurityGroupWork.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/network/security/SecurityGroupWork.java b/core/src/com/cloud/network/security/SecurityGroupWork.java
deleted file mode 100644
index e50f3eb..0000000
--- a/core/src/com/cloud/network/security/SecurityGroupWork.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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.network.security;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-/**
- * Work related to security groups for a vm
- *
- */
-public interface SecurityGroupWork {
-    
-    public enum Step {
-        Scheduled,
-        Processing,
-        Done,
-        Error
-    }
-    
-    Long getInstanceId();
-    Long getLogsequenceNumber();
-    Step getStep();
-    void setStep(Step step);
-    public abstract void setLogsequenceNumber(Long logsequenceNumber);
-    
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/network/security/SecurityGroupWorkVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/network/security/SecurityGroupWorkVO.java b/core/src/com/cloud/network/security/SecurityGroupWorkVO.java
deleted file mode 100644
index 33d30fb..0000000
--- a/core/src/com/cloud/network/security/SecurityGroupWorkVO.java
+++ /dev/null
@@ -1,135 +0,0 @@
-// 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.network.security;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="op_nwgrp_work")
-public class SecurityGroupWorkVO implements SecurityGroupWork, InternalIdentity {
-	
-	
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private Long id;
-    
-    @Column(name="instance_id", updatable=false, nullable=false)
-    private Long instanceId;    // vm_instance id
-    
-    
-    @Column(name="mgmt_server_id", nullable=true)
-    private Long serverId;
-    
-    @Column(name=GenericDao.CREATED_COLUMN)
-    private Date created;
-    
-    
-    @Column(name="step", nullable = false)
-    @Enumerated(value=EnumType.STRING)
-    private Step step;
-    
-    @Column(name="taken", nullable=true)
-    @Temporal(value=TemporalType.TIMESTAMP)
-    private Date dateTaken;
-    
-    @Column(name="seq_no", nullable=true)
-    private Long logsequenceNumber = null;
-
-    
-    protected SecurityGroupWorkVO() {
-    }
-    
-    public long getId() {
-        return id;
-    }
-    
-    public Long getInstanceId() {
-        return instanceId;
-    }
-    
-   
-    public Long getServerId() {
-        return serverId;
-    }
-  
-
-    public void setServerId(final Long serverId) {
-        this.serverId = serverId;
-    }
-
-    public Date getCreated() {
-        return created;
-    }
-
-
-
-	public SecurityGroupWorkVO(Long instanceId, Long serverId, Date created,
-			Step step, Date dateTaken) {
-		super();
-		this.instanceId = instanceId;
-		this.serverId = serverId;
-		this.created = created;
-		this.step = step;
-		this.dateTaken = dateTaken;
-	}
-
-	@Override
-	public String toString() {
-    	return new StringBuilder("[NWGrp-Work:id=").append(id).append(":vm=").append(instanceId).append("]").toString();
-    }
-
-	public Date getDateTaken() {
-		return dateTaken;
-	}
-
-	public void setStep(Step step) {
-		this.step = step;
-	}
-
-	public Step getStep() {
-		return step;
-	}
-
-	public void setDateTaken(Date date) {
-		dateTaken = date;
-	}
-
-	public Long getLogsequenceNumber() {
-		return logsequenceNumber;
-	}
-
-	@Override
-    public void setLogsequenceNumber(Long logsequenceNumber) {
-		this.logsequenceNumber = logsequenceNumber;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/network/security/VmRulesetLogVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/network/security/VmRulesetLogVO.java b/core/src/com/cloud/network/security/VmRulesetLogVO.java
deleted file mode 100644
index 2090ce3..0000000
--- a/core/src/com/cloud/network/security/VmRulesetLogVO.java
+++ /dev/null
@@ -1,81 +0,0 @@
-// 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.network.security;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
-
-/**
- * Records the intent to update a VM's ingress ruleset
- *
- */
-@Entity
-@Table(name="op_vm_ruleset_log")
-public class VmRulesetLogVO implements InternalIdentity {
-	@Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private Long id;
-    
-    @Column(name="instance_id", updatable=false, nullable=false)
-    private Long instanceId;    // vm_instance id
-    
-    @Column(name=GenericDao.CREATED_COLUMN)
-    private Date created;
-    
-    @Column(name="logsequence")
-    long logsequence;
-    
-    protected VmRulesetLogVO() {
-    	
-    }
-
-	public VmRulesetLogVO(Long instanceId) {
-		super();
-		this.instanceId = instanceId;
-	}
-
-	public long getId() {
-		return id;
-	}
-
-	public Long getInstanceId() {
-		return instanceId;
-	}
-
-	public Date getCreated() {
-		return created;
-	}
-
-	public long getLogsequence() {
-		return logsequence;
-	}
-    
-	public void incrLogsequence() {
-		logsequence++;
-	}
-    
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/resource/ResourceListener.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/resource/ResourceListener.java b/core/src/com/cloud/resource/ResourceListener.java
index 0efea12..17fba6c 100755
--- a/core/src/com/cloud/resource/ResourceListener.java
+++ b/core/src/com/cloud/resource/ResourceListener.java
@@ -20,7 +20,7 @@ import java.net.URI;
 import java.util.List;
 import java.util.Map;
 
-import com.cloud.host.HostVO;
+import com.cloud.host.Host;
 
 public interface ResourceListener {
     static final Integer EVENT_DISCOVER_BEFORE = 0x1;
@@ -33,9 +33,9 @@ public interface ResourceListener {
     static final Integer EVENT_PREPARE_MAINTENANCE_AFTER = 0x1 << 7;
     static final Integer EVENT_ALL = (EVENT_DISCOVER_BEFORE | EVENT_DISCOVER_AFTER | EVENT_DELETE_HOST_BEFORE | EVENT_DELETE_HOST_AFTER
             | EVENT_CANCEL_MAINTENANCE_BEFORE | EVENT_CANCEL_MAINTENANCE_AFTER | EVENT_PREPARE_MAINTENANCE_BEFORE | EVENT_PREPARE_MAINTENANCE_AFTER);
-    
+
     /**
-     * 
+     *
      * @param dcid
      * @param podId
      * @param clusterId
@@ -43,63 +43,63 @@ public interface ResourceListener {
      * @param username
      * @param password
      * @param hostTags
-     * 
+     *
      * Called before Discover.find()
      */
     void processDiscoverEventBefore(Long dcid, Long podId, Long clusterId, URI uri, String username, String password, List<String> hostTags);
 
     /**
-     * 
+     *
      * @param resources
-     * 
+     *
      * Called after Discover.find()
      */
     void processDiscoverEventAfter(Map<? extends ServerResource, Map<String, String>> resources);
 
     /**
-     * 
+     *
      * @param host
-     * 
+     *
      * Called before host delete
      */
-    void processDeleteHostEventBefore(HostVO host);
+    void processDeleteHostEventBefore(Host host);
 
     /**
-     * 
+     *
      * @param host
-     * 
+     *
      * Called after host delete. NOTE param host includes stale data which has been removed from database
      */
-    void processDeletHostEventAfter(HostVO host);
+    void processDeletHostEventAfter(Host host);
 
     /**
-     * 
+     *
      * @param hostId
-     * 
+     *
      * Called before AgentManager.cancelMaintenance
      */
     void processCancelMaintenaceEventBefore(Long hostId);
 
     /**
-     * 
+     *
      * @param hostId
-     * 
+     *
      * Called after AgentManager.cancelMaintenance
      */
     void processCancelMaintenaceEventAfter(Long hostId);
 
     /**
-     * 
+     *
      * @param hostId
-     * 
+     *
      * Called before AgentManager.main
      */
     void processPrepareMaintenaceEventBefore(Long hostId);
 
     /**
-     * 
+     *
      * @param hostId
-     * 
+     *
      * Called after AgentManager.main
      */
     void processPrepareMaintenaceEventAfter(Long hostId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/resource/UnableDeleteHostException.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/resource/UnableDeleteHostException.java b/core/src/com/cloud/resource/UnableDeleteHostException.java
deleted file mode 100755
index 154147c..0000000
--- a/core/src/com/cloud/resource/UnableDeleteHostException.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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.resource;
-
-import com.cloud.utils.SerialVersionUID;
-import com.cloud.exception.CloudException;
-
-public class UnableDeleteHostException extends CloudException {
-    private static final long serialVersionUID = SerialVersionUID.UnableDeleteHostException;
-    
-    public UnableDeleteHostException(String msg) {
-        super(msg);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/DiskOfferingVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/DiskOfferingVO.java b/core/src/com/cloud/storage/DiskOfferingVO.java
deleted file mode 100755
index 909d7fe..0000000
--- a/core/src/com/cloud/storage/DiskOfferingVO.java
+++ /dev/null
@@ -1,330 +0,0 @@
-// 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.storage;
-
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.DiscriminatorColumn;
-import javax.persistence.DiscriminatorType;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-
-import org.apache.cloudstack.api.Identity;
-import com.cloud.offering.DiskOffering;
-import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="disk_offering")
-@Inheritance(strategy=InheritanceType.JOINED)
-@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32)
-public class DiskOfferingVO implements DiskOffering {
-    public enum Type {
-        Disk,
-        Service
-    };
-
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    long id;
-
-    @Column(name="domain_id")
-    Long domainId;
-
-    @Column(name="unique_name")
-    private String uniqueName;
-
-    @Column(name="name")
-    private String name = null;
-
-    @Column(name="display_text", length=4096)
-    private String displayText = null;
-
-    @Column(name="disk_size")
-    long diskSize;
-
-    @Column(name="tags", length=4096)
-    String tags;
-
-    @Column(name="type")
-    Type type;
-
-    @Column(name=GenericDao.REMOVED)
-    @Temporal(TemporalType.TIMESTAMP)
-    private Date removed;
-
-    @Column(name=GenericDao.CREATED_COLUMN)
-    private Date created;
-
-    @Column(name="recreatable")
-    private boolean recreatable;
-
-    @Column(name="use_local_storage")
-    private boolean useLocalStorage;
-
-    @Column(name="system_use")
-    private boolean systemUse;
-
-    @Column(name="customized")
-    private boolean customized;
-
-    @Column(name="uuid")
-    private String uuid;
-
-    @Column(name="sort_key")
-    int sortKey;
-
-    @Column(name="display_offering")
-    boolean displayOffering;
-
-    public DiskOfferingVO() {
-    	this.uuid = UUID.randomUUID().toString();
-    }
-
-    public DiskOfferingVO(Long domainId, String name, String displayText, long diskSize, String tags, boolean isCustomized) {
-        this.domainId = domainId;
-        this.name = name;
-        this.displayText = displayText;
-        this.diskSize = diskSize;
-        this.tags = tags;
-        this.recreatable = false;
-        this.type = Type.Disk;
-        this.useLocalStorage = false;
-        this.customized = isCustomized;
-    	this.uuid = UUID.randomUUID().toString();
-    }
-
-    public DiskOfferingVO(String name, String displayText, boolean mirrored, String tags, boolean recreatable, boolean useLocalStorage, boolean systemUse, boolean customized) {
-        this.domainId = null;
-        this.type = Type.Service;
-        this.name = name;
-        this.displayText = displayText;
-        this.tags = tags;
-        this.recreatable = recreatable;
-        this.useLocalStorage = useLocalStorage;
-        this.systemUse = systemUse;
-        this.customized = customized;
-    	this.uuid = UUID.randomUUID().toString();
-    }
-
-    //domain specific offerings constructor (null domainId implies public offering)
-    public DiskOfferingVO(String name, String displayText, boolean mirrored, String tags, boolean recreatable, boolean useLocalStorage, boolean systemUse, boolean customized, Long domainId) {
-        this.type = Type.Service;
-        this.name = name;
-        this.displayText = displayText;
-        this.tags = tags;
-        this.recreatable = recreatable;
-        this.useLocalStorage = useLocalStorage;
-        this.systemUse = systemUse;
-        this.customized = customized;
-        this.domainId = domainId;
-    	this.uuid = UUID.randomUUID().toString();
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-
-    @Override
-    public boolean isCustomized() {
-		return customized;
-	}
-
-	public void setCustomized(boolean customized) {
-		this.customized = customized;
-	}
-
-	@Override
-    public String getUniqueName() {
-        return uniqueName;
-    }
-
-    @Override
-    public boolean getUseLocalStorage() {
-        return useLocalStorage;
-    }
-
-    @Override
-    public Long getDomainId() {
-        return domainId;
-    }
-
-    public Type getType() {
-        return type;
-    }
-
-    public boolean isRecreatable() {
-        return recreatable;
-    }
-
-    public void setDomainId(Long domainId) {
-        this.domainId = domainId;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-
-    @Override
-    public boolean getSystemUse() {
-        return systemUse;
-    }
-
-    public void setSystemUse(boolean systemUse) {
-        this.systemUse = systemUse;
-    }
-
-    @Override
-    public String getDisplayText() {
-        return displayText;
-    }
-    public void setDisplayText(String displayText) {
-        this.displayText = displayText;
-    }
-
-    @Override
-    public long getDiskSize(){
-    	return diskSize;
-    }
-
-    @Override
-    public void setDiskSize(long diskSize) {
-        this.diskSize = diskSize;
-    }
-
-    public Date getRemoved() {
-        return removed;
-    }
-
-	@Override
-    public Date getCreated() {
-		return created;
-	}
-
-    protected void setTags(String tags) {
-        this.tags = tags;
-    }
-
-    @Override
-    public String getTags() {
-        return tags;
-    }
-
-    public void setUniqueName(String name) {
-        this.uniqueName = name;
-    }
-
-    @Override
-    @Transient
-    public String[] getTagsArray() {
-        String tags = getTags();
-        if (tags == null || tags.isEmpty()) {
-            return new String[0];
-        }
-
-        return tags.split(",");
-    }
-
-    @Transient
-    public boolean containsTag(String... tags) {
-        if (this.tags == null) {
-            return false;
-        }
-
-        for (String tag : tags) {
-            if (!this.tags.matches(tag)) {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    @Transient
-    public void setTagsArray(List<String> newTags) {
-        if (newTags.isEmpty()) {
-            setTags(null);
-            return;
-        }
-
-        StringBuilder buf = new StringBuilder();
-        for (String tag : newTags) {
-            buf.append(tag).append(",");
-        }
-
-        buf.delete(buf.length() - 1, buf.length());
-
-        setTags(buf.toString());
-    }
-
-	public void setUseLocalStorage(boolean useLocalStorage) {
-		this.useLocalStorage = useLocalStorage;
-	}
-
-    public void setRemoved(Date removed) {
-        this.removed = removed;
-    }
-
-    @Override
-    public String getUuid() {
-    	return this.uuid;
-    }
-
-    public void setUuid(String uuid) {
-    	this.uuid = uuid;
-    }
-
-    public void setSortKey(int key) {
-    	sortKey = key;
-    }
-
-    public int getSortKey() {
-    	return sortKey;
-    }
-    
-    public void setRecreatable(boolean recreatable) {
-    	this.recreatable = recreatable;
-    }
-
-
-    public boolean getDisplayOffering() {
-        return displayOffering;
-    }
-
-    public void setDisplayOffering(boolean displayOffering) {
-        this.displayOffering = displayOffering;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/GuestOSCategoryVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/GuestOSCategoryVO.java b/core/src/com/cloud/storage/GuestOSCategoryVO.java
deleted file mode 100644
index 03a7479..0000000
--- a/core/src/com/cloud/storage/GuestOSCategoryVO.java
+++ /dev/null
@@ -1,68 +0,0 @@
-// 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.storage;
-
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="guest_os_category")
-public class GuestOSCategoryVO implements GuestOsCategory {
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    long id;
-
-    @Column(name="name")
-    String name;
-
-    @Column(name="uuid")
-    String uuid = UUID.randomUUID().toString();
-
-    @Override
-    public long getId() {
-    	return id;
-    }
-
-    @Override
-    public String getName() {
-    	return name;
-    }
-
-    @Override
-    public void setName(String name) {
-    	this.name = name;
-    }
-
-    @Override
-    public String getUuid() {
-    	return this.uuid;
-    }
-
-    public void setUuid(String uuid) {
-    	this.uuid = uuid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/GuestOSVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/GuestOSVO.java b/core/src/com/cloud/storage/GuestOSVO.java
deleted file mode 100644
index 49e136d..0000000
--- a/core/src/com/cloud/storage/GuestOSVO.java
+++ /dev/null
@@ -1,90 +0,0 @@
-// 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.storage;
-
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="guest_os")
-public class GuestOSVO implements GuestOS {
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    long id;
-
-    @Column(name="category_id")
-    private long categoryId;
-
-    @Column(name="name")
-    String name;
-
-    @Column(name="display_name")
-    String displayName;
-
-    @Column(name="uuid")
-    String uuid = UUID.randomUUID().toString();
-
-    @Override
-    public long getId() {
-    	return id;
-    }
-
-    public long getCategoryId() {
-    	return categoryId;
-    }
-
-    public void setCategoryId(long categoryId) {
-    	this.categoryId = categoryId;
-    }
-
-    @Override
-    public String getName() {
-    	return name;
-    }
-
-    public void setName(String name) {
-    	this.name = name;
-    }
-
-    @Override
-    public String getDisplayName() {
-    	return displayName;
-    }
-
-    public void setDisplayName(String displayName) {
-    	this.displayName = displayName;
-    }
-
-    @Override
-    public String getUuid() {
-    	return this.uuid;
-    }
-
-    public void setUuid(String uuid) {
-    	this.uuid = uuid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/LaunchPermissionVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/LaunchPermissionVO.java b/core/src/com/cloud/storage/LaunchPermissionVO.java
deleted file mode 100644
index 992bac2..0000000
--- a/core/src/com/cloud/storage/LaunchPermissionVO.java
+++ /dev/null
@@ -1,57 +0,0 @@
-// 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.storage;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name="launch_permission")
-public class LaunchPermissionVO implements InternalIdentity {
-    @Id
-    @Column(name="id")
-    private Long id;
-
-    @Column(name="template_id")
-    private long templateId;
-
-    @Column(name="account_id")
-    private long accountId;
-
-    public LaunchPermissionVO() { }
-
-    public LaunchPermissionVO(long templateId, long accountId) {
-        this.templateId = templateId;
-        this.accountId = accountId;
-    }
-
-    public long getId() {
-        return id;
-    }
-
-    public long getTemplateId() {
-        return templateId;
-    }
-
-    public long getAccountId() {
-        return accountId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/S3VO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/S3VO.java b/core/src/com/cloud/storage/S3VO.java
deleted file mode 100644
index ec49bc9..0000000
--- a/core/src/com/cloud/storage/S3VO.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * 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.storage;
-
-import com.cloud.agent.api.to.S3TO;
-import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import java.util.Date;
-
-@Entity
-@Table(name = "s3")
-public class S3VO implements S3 {
-
-    public static final String ID_COLUMN_NAME = "id";
-
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Column(name = ID_COLUMN_NAME)
-    private long id;
-
-    @Column(name = "uuid")
-    private String uuid;
-
-    @Column(name = "access_key")
-    private String accessKey;
-
-    @Column(name = "secret_key")
-    private String secretKey;
-
-    @Column(name = "end_point")
-    private String endPoint;
-
-    @Column(name = "bucket")
-    private String bucketName;
-
-    @Column(name = "https")
-    private Integer httpsFlag;
-
-    @Column(name = "connection_timeout")
-    private Integer connectionTimeout;
-
-    @Column(name = "max_error_retry")
-    private Integer maxErrorRetry;
-
-    @Column(name = "socket_timeout")
-    private Integer socketTimeout;
-
-    @Column(name = GenericDao.CREATED_COLUMN)
-    private Date created;
-
-    public S3VO() {
-        super();
-    }
-
-    public S3VO(final String uuid, final String accessKey,
-            final String secretKey, final String endPoint,
-            final String bucketName, final Boolean httpsFlag,
-            final Integer connectionTimeout, final Integer maxErrorRetry,
-            final Integer socketTimeout, final Date created) {
-
-        super();
-
-        this.uuid = uuid;
-        this.accessKey = accessKey;
-        this.secretKey = secretKey;
-        this.endPoint = endPoint;
-        this.bucketName = bucketName;
-
-        Integer value = null;
-        if (httpsFlag != null) {
-            value = httpsFlag == false ? 0 : 1;
-        }
-        this.httpsFlag = value;
-
-        this.connectionTimeout = connectionTimeout;
-        this.maxErrorRetry = maxErrorRetry;
-        this.socketTimeout = socketTimeout;
-        this.created = created;
-
-    }
-
-    @Override
-    public S3TO toS3TO() {
-
-        Boolean httpsFlag = null;
-        if (this.httpsFlag != null) {
-            httpsFlag = this.httpsFlag == 0 ? false : true;
-        }
-
-        return new S3TO(this.id, this.uuid, this.accessKey, this.secretKey,
-                this.endPoint, this.bucketName, httpsFlag,
-                this.connectionTimeout, this.maxErrorRetry, this.socketTimeout,
-                this.created);
-
-    }
-
-    public long getId() {
-        return this.id;
-    }
-
-    public void setId(final long id) {
-        this.id = id;
-    }
-
-    public String getUuid() {
-        return this.uuid;
-    }
-
-    public void setUuid(final String uuid) {
-        this.uuid = uuid;
-    }
-
-    public String getAccessKey() {
-        return this.accessKey;
-    }
-
-    public void setAccessKey(final String accessKey) {
-        this.accessKey = accessKey;
-    }
-
-    public String getSecretKey() {
-        return this.secretKey;
-    }
-
-    public void setSecretKey(final String secretKey) {
-        this.secretKey = secretKey;
-    }
-
-    public String getEndPoint() {
-        return this.endPoint;
-    }
-
-    public void setEndPoint(final String endPoint) {
-        this.endPoint = endPoint;
-    }
-
-    public String getBucketName() {
-        return this.bucketName;
-    }
-
-    public void setBucketName(final String bucketName) {
-        this.bucketName = bucketName;
-    }
-
-    public Integer getHttpsFlag() {
-        return this.httpsFlag;
-    }
-
-    public void setHttpsFlag(final Integer httpsFlag) {
-        this.httpsFlag = httpsFlag;
-    }
-
-    public Integer getConnectionTimeout() {
-        return this.connectionTimeout;
-    }
-
-    public void setConnectionTimeout(final int connectionTimeout) {
-        this.connectionTimeout = connectionTimeout;
-    }
-
-    public Integer getMaxErrorRetry() {
-        return this.maxErrorRetry;
-    }
-
-    public void setMaxErrorRetry(final int maxErrorRetry) {
-        this.maxErrorRetry = maxErrorRetry;
-    }
-
-    public Integer getSocketTimeout() {
-        return this.socketTimeout;
-    }
-
-    public void setSocketTimeout(final int socketTimeout) {
-        this.socketTimeout = socketTimeout;
-    }
-
-    public Date getCreated() {
-        return this.created;
-    }
-
-    public void setCreated(final Date created) {
-        this.created = created;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/SecondaryStorage.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/SecondaryStorage.java b/core/src/com/cloud/storage/SecondaryStorage.java
deleted file mode 100644
index dc01642..0000000
--- a/core/src/com/cloud/storage/SecondaryStorage.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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.storage;
-
-public interface SecondaryStorage {
-    
-    String getBackupPath();
-    
-    String getTemplatePath();
-    
-    String getIsoPath();
-
-    void createTemplate();
-    
-    void destroyTemplate();
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/storage/SecondaryStorageLayer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/SecondaryStorageLayer.java b/core/src/com/cloud/storage/SecondaryStorageLayer.java
deleted file mode 100644
index 539733d..0000000
--- a/core/src/com/cloud/storage/SecondaryStorageLayer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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.storage;
-
-import java.net.URI;
-
-import com.cloud.storage.Storage.ImageFormat;
-import com.cloud.utils.component.Adapter;
-
-public interface SecondaryStorageLayer extends Adapter {
-    
-    /**
-     * Mounts a template
-     * 
-     * @param poolId the pool to mount it to.
-     * @param poolUuid the pool's uuid if it is needed.
-     * @param name unique name to the template.
-     * @param url url to access the template.
-     * @param format format of the template.
-     * @param accountId account id the template belongs to.
-     * @return a String that unique identifies the reference the template once it is mounted.
-     */
-    String mountTemplate(long poolId, String poolUuid, String name, URI url, ImageFormat format, long accountId);
-    
-}


[14/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/host/dao/HostDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/dao/HostDaoImpl.java b/engine/schema/src/com/cloud/host/dao/HostDaoImpl.java
new file mode 100755
index 0000000..07a4232
--- /dev/null
+++ b/engine/schema/src/com/cloud/host/dao/HostDaoImpl.java
@@ -0,0 +1,920 @@
+// 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.host.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.TimeZone;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.persistence.TableGenerator;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.cluster.agentlb.HostTransferMapVO;
+import com.cloud.cluster.agentlb.dao.HostTransferMapDao;
+import com.cloud.cluster.agentlb.dao.HostTransferMapDaoImpl;
+import com.cloud.dc.ClusterVO;
+import com.cloud.dc.dao.ClusterDao;
+import com.cloud.dc.dao.ClusterDaoImpl;
+import com.cloud.host.Host;
+import com.cloud.host.Host.Type;
+import com.cloud.host.HostTagVO;
+import com.cloud.host.HostVO;
+import com.cloud.host.Status;
+import com.cloud.host.Status.Event;
+import com.cloud.info.RunningHostCountInfo;
+import com.cloud.org.Managed;
+import com.cloud.resource.ResourceState;
+import com.cloud.utils.DateUtil;
+import com.cloud.utils.db.Attribute;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.JoinBuilder;
+import com.cloud.utils.db.JoinBuilder.JoinType;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.UpdateBuilder;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Component
+@Local(value = { HostDao.class })
+@DB(txn = false)
+@TableGenerator(name = "host_req_sq", table = "op_host", pkColumnName = "id", valueColumnName = "sequence", allocationSize = 1)
+public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao { //FIXME: , ExternalIdDao {
+    private static final Logger s_logger = Logger.getLogger(HostDaoImpl.class);
+    private static final Logger status_logger = Logger.getLogger(Status.class);
+    private static final Logger state_logger = Logger.getLogger(ResourceState.class);
+
+    protected SearchBuilder<HostVO> TypePodDcStatusSearch;
+
+    protected SearchBuilder<HostVO> IdStatusSearch;
+    protected SearchBuilder<HostVO> TypeDcSearch;
+    protected SearchBuilder<HostVO> TypeDcStatusSearch;
+    protected SearchBuilder<HostVO> TypeClusterStatusSearch;
+    protected SearchBuilder<HostVO> MsStatusSearch;
+    protected SearchBuilder<HostVO> DcPrivateIpAddressSearch;
+    protected SearchBuilder<HostVO> DcStorageIpAddressSearch;
+
+    protected SearchBuilder<HostVO> GuidSearch;
+    protected SearchBuilder<HostVO> DcSearch;
+    protected SearchBuilder<HostVO> PodSearch;
+    protected SearchBuilder<HostVO> TypeSearch;
+    protected SearchBuilder<HostVO> StatusSearch;
+    protected SearchBuilder<HostVO> ResourceStateSearch;
+    protected SearchBuilder<HostVO> NameLikeSearch;
+    protected SearchBuilder<HostVO> NameSearch;
+    protected SearchBuilder<HostVO> SequenceSearch;
+    protected SearchBuilder<HostVO> DirectlyConnectedSearch;
+    protected SearchBuilder<HostVO> UnmanagedDirectConnectSearch;
+    protected SearchBuilder<HostVO> UnmanagedApplianceSearch;
+    protected SearchBuilder<HostVO> MaintenanceCountSearch;
+    protected SearchBuilder<HostVO> ClusterStatusSearch;
+    protected SearchBuilder<HostVO> TypeNameZoneSearch;
+    protected SearchBuilder<HostVO> AvailHypevisorInZone;
+
+    protected SearchBuilder<HostVO> DirectConnectSearch;
+    protected SearchBuilder<HostVO> ManagedDirectConnectSearch;
+    protected SearchBuilder<HostVO> ManagedRoutingServersSearch;
+    protected SearchBuilder<HostVO> SecondaryStorageVMSearch;
+
+
+    protected GenericSearchBuilder<HostVO, Long> HostsInStatusSearch;
+    protected GenericSearchBuilder<HostVO, Long> CountRoutingByDc;
+    protected SearchBuilder<HostTransferMapVO> HostTransferSearch;
+    protected SearchBuilder<ClusterVO> ClusterManagedSearch;
+    protected SearchBuilder<HostVO> RoutingSearch;
+
+    protected SearchBuilder<HostVO> HostsForReconnectSearch;
+    protected GenericSearchBuilder<HostVO, Long> ClustersOwnedByMSSearch;
+    protected GenericSearchBuilder<ClusterVO, Long> AllClustersSearch;
+    protected SearchBuilder<HostVO> HostsInClusterSearch;
+    
+    protected Attribute _statusAttr;
+    protected Attribute _resourceStateAttr;
+    protected Attribute _msIdAttr;
+    protected Attribute _pingTimeAttr;
+    
+    @Inject protected HostDetailsDao _detailsDao;
+    @Inject protected HostTagsDao _hostTagsDao;
+    @Inject protected HostTransferMapDao _hostTransferDao;
+    @Inject protected ClusterDao _clusterDao;
+
+    public HostDaoImpl() {
+    	super();
+    }
+
+    @PostConstruct
+    public void init() {
+
+        MaintenanceCountSearch = createSearchBuilder();
+        MaintenanceCountSearch.and("cluster", MaintenanceCountSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
+        MaintenanceCountSearch.and("resourceState", MaintenanceCountSearch.entity().getResourceState(), SearchCriteria.Op.IN);
+        MaintenanceCountSearch.done();
+
+        TypePodDcStatusSearch = createSearchBuilder();
+        HostVO entity = TypePodDcStatusSearch.entity();
+        TypePodDcStatusSearch.and("type", entity.getType(), SearchCriteria.Op.EQ);
+        TypePodDcStatusSearch.and("pod", entity.getPodId(), SearchCriteria.Op.EQ);
+        TypePodDcStatusSearch.and("dc", entity.getDataCenterId(), SearchCriteria.Op.EQ);
+        TypePodDcStatusSearch.and("cluster", entity.getClusterId(), SearchCriteria.Op.EQ);
+        TypePodDcStatusSearch.and("status", entity.getStatus(), SearchCriteria.Op.EQ);
+        TypePodDcStatusSearch.and("resourceState", entity.getResourceState(), SearchCriteria.Op.EQ);
+        TypePodDcStatusSearch.done();
+
+        MsStatusSearch = createSearchBuilder();
+        MsStatusSearch.and("ms", MsStatusSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ);
+        MsStatusSearch.and("type", MsStatusSearch.entity().getType(), SearchCriteria.Op.EQ);
+        MsStatusSearch.and("resourceState", MsStatusSearch.entity().getResourceState(), SearchCriteria.Op.NIN);
+        MsStatusSearch.done();
+
+        TypeDcSearch = createSearchBuilder();
+        TypeDcSearch.and("type", TypeDcSearch.entity().getType(), SearchCriteria.Op.EQ);
+        TypeDcSearch.and("dc", TypeDcSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        TypeDcSearch.done();
+        
+        SecondaryStorageVMSearch = createSearchBuilder();
+        SecondaryStorageVMSearch.and("type", SecondaryStorageVMSearch.entity().getType(), SearchCriteria.Op.EQ);
+        SecondaryStorageVMSearch.and("dc", SecondaryStorageVMSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        SecondaryStorageVMSearch.and("status", SecondaryStorageVMSearch.entity().getStatus(), SearchCriteria.Op.EQ);
+        SecondaryStorageVMSearch.done();
+
+        TypeDcStatusSearch = createSearchBuilder();
+        TypeDcStatusSearch.and("type", TypeDcStatusSearch.entity().getType(), SearchCriteria.Op.EQ);
+        TypeDcStatusSearch.and("dc", TypeDcStatusSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        TypeDcStatusSearch.and("status", TypeDcStatusSearch.entity().getStatus(), SearchCriteria.Op.EQ);
+        TypeDcStatusSearch.and("resourceState", TypeDcStatusSearch.entity().getResourceState(), SearchCriteria.Op.EQ);
+        TypeDcStatusSearch.done();
+
+        TypeClusterStatusSearch = createSearchBuilder();
+        TypeClusterStatusSearch.and("type", TypeClusterStatusSearch.entity().getType(), SearchCriteria.Op.EQ);
+        TypeClusterStatusSearch.and("cluster", TypeClusterStatusSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
+        TypeClusterStatusSearch.and("status", TypeClusterStatusSearch.entity().getStatus(), SearchCriteria.Op.EQ);
+        TypeClusterStatusSearch.and("resourceState", TypeClusterStatusSearch.entity().getResourceState(), SearchCriteria.Op.EQ);
+        TypeClusterStatusSearch.done();
+
+        IdStatusSearch = createSearchBuilder();
+        IdStatusSearch.and("id", IdStatusSearch.entity().getId(), SearchCriteria.Op.EQ);
+        IdStatusSearch.and("states", IdStatusSearch.entity().getStatus(), SearchCriteria.Op.IN);
+        IdStatusSearch.done();
+
+        DcPrivateIpAddressSearch = createSearchBuilder();
+        DcPrivateIpAddressSearch.and("privateIpAddress", DcPrivateIpAddressSearch.entity().getPrivateIpAddress(), SearchCriteria.Op.EQ);
+        DcPrivateIpAddressSearch.and("dc", DcPrivateIpAddressSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        DcPrivateIpAddressSearch.done();
+
+        DcStorageIpAddressSearch = createSearchBuilder();
+        DcStorageIpAddressSearch.and("storageIpAddress", DcStorageIpAddressSearch.entity().getStorageIpAddress(), SearchCriteria.Op.EQ);
+        DcStorageIpAddressSearch.and("dc", DcStorageIpAddressSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        DcStorageIpAddressSearch.done();
+
+        GuidSearch = createSearchBuilder();
+        GuidSearch.and("guid", GuidSearch.entity().getGuid(), SearchCriteria.Op.EQ);
+        GuidSearch.done();
+
+        DcSearch = createSearchBuilder();
+        DcSearch.and("dc", DcSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        DcSearch.done();
+
+        ClusterStatusSearch = createSearchBuilder();
+        ClusterStatusSearch.and("cluster", ClusterStatusSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
+        ClusterStatusSearch.and("status", ClusterStatusSearch.entity().getStatus(), SearchCriteria.Op.EQ);
+        ClusterStatusSearch.done();
+
+        TypeNameZoneSearch = createSearchBuilder();
+        TypeNameZoneSearch.and("name", TypeNameZoneSearch.entity().getName(), SearchCriteria.Op.EQ);
+        TypeNameZoneSearch.and("type", TypeNameZoneSearch.entity().getType(), SearchCriteria.Op.EQ);
+        TypeNameZoneSearch.and("zoneId", TypeNameZoneSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        TypeNameZoneSearch.done();
+
+        PodSearch = createSearchBuilder();
+        PodSearch.and("pod", PodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
+        PodSearch.done();
+
+        TypeSearch = createSearchBuilder();
+        TypeSearch.and("type", TypeSearch.entity().getType(), SearchCriteria.Op.EQ);
+        TypeSearch.done();
+
+        StatusSearch = createSearchBuilder();
+        StatusSearch.and("status", StatusSearch.entity().getStatus(), SearchCriteria.Op.IN);
+        StatusSearch.done();
+        
+        ResourceStateSearch = createSearchBuilder();
+        ResourceStateSearch.and("resourceState", ResourceStateSearch.entity().getResourceState(), SearchCriteria.Op.IN);
+        ResourceStateSearch.done();
+
+        NameLikeSearch = createSearchBuilder();
+        NameLikeSearch.and("name", NameLikeSearch.entity().getName(), SearchCriteria.Op.LIKE);
+        NameLikeSearch.done();
+
+        NameSearch = createSearchBuilder();
+        NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ);
+        NameSearch.done();
+
+        SequenceSearch = createSearchBuilder();
+        SequenceSearch.and("id", SequenceSearch.entity().getId(), SearchCriteria.Op.EQ);
+        // SequenceSearch.addRetrieve("sequence", SequenceSearch.entity().getSequence());
+        SequenceSearch.done();
+
+        DirectlyConnectedSearch = createSearchBuilder();
+        DirectlyConnectedSearch.and("resource", DirectlyConnectedSearch.entity().getResource(), SearchCriteria.Op.NNULL);
+        DirectlyConnectedSearch.and("ms", DirectlyConnectedSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ);
+        DirectlyConnectedSearch.and("statuses", DirectlyConnectedSearch.entity().getStatus(), SearchCriteria.Op.EQ);
+        DirectlyConnectedSearch.and("resourceState", DirectlyConnectedSearch.entity().getResourceState(), SearchCriteria.Op.NOTIN);
+        DirectlyConnectedSearch.done();
+
+        UnmanagedDirectConnectSearch = createSearchBuilder();
+        UnmanagedDirectConnectSearch.and("resource", UnmanagedDirectConnectSearch.entity().getResource(), SearchCriteria.Op.NNULL);
+        UnmanagedDirectConnectSearch.and("server", UnmanagedDirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL);
+        UnmanagedDirectConnectSearch.and("lastPinged", UnmanagedDirectConnectSearch.entity().getLastPinged(), SearchCriteria.Op.LTEQ);
+        UnmanagedDirectConnectSearch.and("resourceStates", UnmanagedDirectConnectSearch.entity().getResourceState(), SearchCriteria.Op.NIN);
+        UnmanagedDirectConnectSearch.and("cluster", UnmanagedDirectConnectSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
+        /*
+         * UnmanagedDirectConnectSearch.op(SearchCriteria.Op.OR, "managementServerId",
+         * UnmanagedDirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ);
+         * UnmanagedDirectConnectSearch.and("lastPinged", UnmanagedDirectConnectSearch.entity().getLastPinged(),
+         * SearchCriteria.Op.LTEQ); UnmanagedDirectConnectSearch.cp(); UnmanagedDirectConnectSearch.cp();
+         */
+        try {
+        HostTransferSearch = _hostTransferDao.createSearchBuilder();
+        } catch (Throwable e) {
+        	s_logger.debug("error", e);
+        }
+        HostTransferSearch.and("id", HostTransferSearch.entity().getId(), SearchCriteria.Op.NULL);
+        UnmanagedDirectConnectSearch.join("hostTransferSearch", HostTransferSearch, HostTransferSearch.entity().getId(), UnmanagedDirectConnectSearch.entity().getId(), JoinType.LEFTOUTER);
+        ClusterManagedSearch = _clusterDao.createSearchBuilder();
+        ClusterManagedSearch.and("managed", ClusterManagedSearch.entity().getManagedState(), SearchCriteria.Op.EQ);
+        UnmanagedDirectConnectSearch.join("ClusterManagedSearch", ClusterManagedSearch, ClusterManagedSearch.entity().getId(), UnmanagedDirectConnectSearch.entity().getClusterId(), JoinType.INNER);
+        UnmanagedDirectConnectSearch.done();
+        
+
+        DirectConnectSearch = createSearchBuilder();
+        DirectConnectSearch.and("resource", DirectConnectSearch.entity().getResource(), SearchCriteria.Op.NNULL);
+        DirectConnectSearch.and("id", DirectConnectSearch.entity().getId(), SearchCriteria.Op.EQ);
+        DirectConnectSearch.and().op("nullserver", DirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL);
+        DirectConnectSearch.or("server", DirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ);
+        DirectConnectSearch.cp();
+        DirectConnectSearch.done();
+
+        UnmanagedApplianceSearch = createSearchBuilder();
+        UnmanagedApplianceSearch.and("resource", UnmanagedApplianceSearch.entity().getResource(), SearchCriteria.Op.NNULL);
+        UnmanagedApplianceSearch.and("server", UnmanagedApplianceSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL);
+        UnmanagedApplianceSearch.and("types", UnmanagedApplianceSearch.entity().getType(), SearchCriteria.Op.IN);
+        UnmanagedApplianceSearch.and("lastPinged", UnmanagedApplianceSearch.entity().getLastPinged(), SearchCriteria.Op.LTEQ);
+        UnmanagedApplianceSearch.done();
+
+        AvailHypevisorInZone = createSearchBuilder();
+        AvailHypevisorInZone.and("zoneId", AvailHypevisorInZone.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        AvailHypevisorInZone.and("hostId", AvailHypevisorInZone.entity().getId(), SearchCriteria.Op.NEQ);
+        AvailHypevisorInZone.and("type", AvailHypevisorInZone.entity().getType(), SearchCriteria.Op.EQ);
+        AvailHypevisorInZone.groupBy(AvailHypevisorInZone.entity().getHypervisorType());
+        AvailHypevisorInZone.done();
+
+        HostsInStatusSearch = createSearchBuilder(Long.class);
+        HostsInStatusSearch.selectField(HostsInStatusSearch.entity().getId());
+        HostsInStatusSearch.and("dc", HostsInStatusSearch.entity().getDataCenterId(), Op.EQ);
+        HostsInStatusSearch.and("pod", HostsInStatusSearch.entity().getPodId(), Op.EQ);
+        HostsInStatusSearch.and("cluster", HostsInStatusSearch.entity().getClusterId(), Op.EQ);
+        HostsInStatusSearch.and("type", HostsInStatusSearch.entity().getType(), Op.EQ);
+        HostsInStatusSearch.and("statuses", HostsInStatusSearch.entity().getStatus(), Op.IN);
+        HostsInStatusSearch.done();
+
+        CountRoutingByDc = createSearchBuilder(Long.class);
+        CountRoutingByDc.select(null, Func.COUNT, null);
+        CountRoutingByDc.and("dc", CountRoutingByDc.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        CountRoutingByDc.and("type", CountRoutingByDc.entity().getType(), SearchCriteria.Op.EQ);
+        CountRoutingByDc.and("status", CountRoutingByDc.entity().getStatus(), SearchCriteria.Op.EQ);
+
+        CountRoutingByDc.done();
+
+        ManagedDirectConnectSearch = createSearchBuilder();
+        ManagedDirectConnectSearch.and("resource", ManagedDirectConnectSearch.entity().getResource(), SearchCriteria.Op.NNULL);
+        ManagedDirectConnectSearch.and("server", ManagedDirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL);
+        ManagedDirectConnectSearch.done();
+
+        ManagedRoutingServersSearch = createSearchBuilder();
+        ManagedRoutingServersSearch.and("server", ManagedRoutingServersSearch.entity().getManagementServerId(), SearchCriteria.Op.NNULL);
+        ManagedRoutingServersSearch.and("type", ManagedRoutingServersSearch.entity().getType(), SearchCriteria.Op.EQ);
+        ManagedRoutingServersSearch.done();
+        
+        RoutingSearch = createSearchBuilder();
+        RoutingSearch.and("type", RoutingSearch.entity().getType(), SearchCriteria.Op.EQ);
+        RoutingSearch.done();
+
+        HostsForReconnectSearch = createSearchBuilder();
+        HostsForReconnectSearch.and("resource", HostsForReconnectSearch.entity().getResource(), SearchCriteria.Op.NNULL);
+        HostsForReconnectSearch.and("server", HostsForReconnectSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ);
+        HostsForReconnectSearch.and("lastPinged", HostsForReconnectSearch.entity().getLastPinged(), SearchCriteria.Op.LTEQ);
+        HostsForReconnectSearch.and("resourceStates", HostsForReconnectSearch.entity().getResourceState(), SearchCriteria.Op.NIN);
+        HostsForReconnectSearch.and("cluster", HostsForReconnectSearch.entity().getClusterId(), SearchCriteria.Op.NNULL);
+        HostsForReconnectSearch.and("status", HostsForReconnectSearch.entity().getStatus(), SearchCriteria.Op.IN);
+        HostsForReconnectSearch.done();
+
+        ClustersOwnedByMSSearch = createSearchBuilder(Long.class);
+        ClustersOwnedByMSSearch.select(null, Func.DISTINCT, ClustersOwnedByMSSearch.entity().getClusterId());
+        ClustersOwnedByMSSearch.and("resource", ClustersOwnedByMSSearch.entity().getResource(), SearchCriteria.Op.NNULL);
+        ClustersOwnedByMSSearch.and("cluster", ClustersOwnedByMSSearch.entity().getClusterId(), SearchCriteria.Op.NNULL);
+        ClustersOwnedByMSSearch.and("server", ClustersOwnedByMSSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ);
+        ClustersOwnedByMSSearch.done();
+
+        AllClustersSearch = _clusterDao.createSearchBuilder(Long.class);
+        AllClustersSearch.select(null, Func.NATIVE, AllClustersSearch.entity().getId());
+        AllClustersSearch.and("managed", AllClustersSearch.entity().getManagedState(), SearchCriteria.Op.EQ);
+        AllClustersSearch.done();
+
+        HostsInClusterSearch = createSearchBuilder();
+        HostsInClusterSearch.and("resource", HostsInClusterSearch.entity().getResource(), SearchCriteria.Op.NNULL);
+        HostsInClusterSearch.and("cluster", HostsInClusterSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
+        HostsInClusterSearch.and("server", HostsInClusterSearch.entity().getManagementServerId(), SearchCriteria.Op.NNULL);
+        HostsInClusterSearch.done();
+
+        _statusAttr = _allAttributes.get("status");
+        _msIdAttr = _allAttributes.get("managementServerId");
+        _pingTimeAttr = _allAttributes.get("lastPinged");
+        _resourceStateAttr = _allAttributes.get("resourceState");
+
+        assert (_statusAttr != null && _msIdAttr != null && _pingTimeAttr != null) : "Couldn't find one of these attributes";
+    }
+
+    @Override
+    public long countBy(long clusterId, ResourceState... states) {
+        SearchCriteria<HostVO> sc = MaintenanceCountSearch.create();
+
+        sc.setParameters("resourceState", (Object[]) states);
+        sc.setParameters("cluster", clusterId);
+
+        List<HostVO> hosts = listBy(sc);
+        return hosts.size();
+    }
+    
+
+    @Override
+    public HostVO findByGuid(String guid) {
+        SearchCriteria<HostVO> sc = GuidSearch.create("guid", guid);
+        return findOneBy(sc);
+    }
+
+    /*
+     * Find hosts which is in Disconnected, Down, Alert and ping timeout and server is not null, set server to null
+     */
+    private void resetHosts(long managementServerId, long lastPingSecondsAfter) {
+        SearchCriteria<HostVO> sc = HostsForReconnectSearch.create();
+        sc.setParameters("server", managementServerId);
+        sc.setParameters("lastPinged", lastPingSecondsAfter);
+        sc.setParameters("status", Status.Disconnected, Status.Down, Status.Alert);
+
+        List<HostVO> hosts = lockRows(sc, null, true); // exclusive lock
+        for (HostVO host : hosts) {
+            host.setManagementServerId(null);
+            update(host.getId(), host);
+        }
+    }
+
+    /*
+     * Returns a list of cluster owned by @managementServerId
+     */
+    private List<Long> findClustersOwnedByManagementServer(long managementServerId) {
+        SearchCriteria<Long> sc = ClustersOwnedByMSSearch.create();
+        sc.setParameters("server", managementServerId);
+
+        List<Long> clusters = customSearch(sc, null);
+        return clusters;
+    }
+
+    /*
+     * Returns a list of all cluster Ids
+     */
+    private List<Long> listAllClusters() {
+        SearchCriteria<Long> sc = AllClustersSearch.create();
+        sc.setParameters("managed", Managed.ManagedState.Managed);
+
+        List<Long> clusters = _clusterDao.customSearch(sc, null);
+        return clusters;
+    }
+
+    /*
+     * This determines if hosts belonging to cluster(@clusterId) are up for grabs
+     *
+     * This is used for handling following cases:
+     * 1. First host added in cluster
+     * 2. During MS restart all hosts in a cluster are without any MS
+     */
+    private boolean canOwnCluster(long clusterId) {
+        SearchCriteria<HostVO> sc = HostsInClusterSearch.create();
+        sc.setParameters("cluster", clusterId);
+
+        List<HostVO> hosts = search(sc, null);
+        boolean ownCluster = (hosts == null || hosts.size() == 0);
+
+        return ownCluster;
+    }
+
+    @Override @DB
+    public List<HostVO> findAndUpdateDirectAgentToLoad(long lastPingSecondsAfter, Long limit, long managementServerId) {
+        Transaction txn = Transaction.currentTxn();
+
+        // reset hosts that are suitable candidates for reconnect
+        txn.start();
+        resetHosts(managementServerId, lastPingSecondsAfter);
+        txn.commit();
+
+        List<Long> clusters = findClustersOwnedByManagementServer(managementServerId);
+        List<Long> allClusters = listAllClusters();
+
+        SearchCriteria<HostVO> sc = UnmanagedDirectConnectSearch.create();
+        sc.setParameters("lastPinged", lastPingSecondsAfter);
+        sc.setJoinParameters("ClusterManagedSearch", "managed", Managed.ManagedState.Managed);
+        List<HostVO> assignedHosts = new ArrayList<HostVO>();
+        List<Long> remainingClusters = new ArrayList<Long>();
+
+        // handle clusters already owned by @managementServerId
+        txn.start();
+        for (Long clusterId : allClusters) {
+            if (clusters.contains(clusterId)) { // host belongs to clusters owned by @managementServerId
+                sc.setParameters("cluster", clusterId);
+                List<HostVO> unmanagedHosts = lockRows(sc, null, true);
+                for (HostVO host : unmanagedHosts) {
+                    host.setManagementServerId(managementServerId);
+                    update(host.getId(), host);
+                    assignedHosts.add(host);
+                }
+            } else {
+                remainingClusters.add(clusterId);
+            }
+        }
+        txn.commit();
+
+        // for remaining clusters check if they can be owned
+        for (Long clusterId : remainingClusters) {
+            txn.start();
+            sc.setParameters("cluster", clusterId);
+            List<HostVO> unmanagedHosts = lockRows(sc, null, true);
+            if (canOwnCluster(clusterId)) { // cluster is not owned by any other MS, so @managementServerId can own it
+                for (HostVO host : unmanagedHosts) {
+                    host.setManagementServerId(managementServerId);
+                    update(host.getId(), host);
+                    assignedHosts.add(host);
+                }
+            }
+            txn.commit();
+        }
+
+        return assignedHosts;
+    }
+    
+    @Override @DB
+    public List<HostVO> findAndUpdateApplianceToLoad(long lastPingSecondsAfter, long managementServerId) {
+    	Transaction txn = Transaction.currentTxn();
+    	
+    	txn.start();
+    	SearchCriteria<HostVO> sc = UnmanagedApplianceSearch.create();
+    	sc.setParameters("lastPinged", lastPingSecondsAfter);
+        sc.setParameters("types", Type.ExternalDhcp, Type.ExternalFirewall, Type.ExternalLoadBalancer, Type.BaremetalDhcp, Type.BaremetalPxe, Type.TrafficMonitor, Type.L2Networking);
+    	List<HostVO> hosts = lockRows(sc, null, true);
+    	
+    	for (HostVO host : hosts) {
+    		host.setManagementServerId(managementServerId);
+    		update(host.getId(), host);
+    	}
+    	
+    	txn.commit();
+    	
+    	return hosts;
+    }
+
+    @Override
+    public void markHostsAsDisconnected(long msId, long lastPing) {
+        SearchCriteria<HostVO> sc = MsStatusSearch.create();
+        sc.setParameters("ms", msId);
+
+        HostVO host = createForUpdate();
+        host.setLastPinged(lastPing);
+        host.setDisconnectedOn(new Date());
+        UpdateBuilder ub = getUpdateBuilder(host);
+        ub.set(host, "status", Status.Disconnected);
+
+        update(ub, sc, null);
+
+        sc = MsStatusSearch.create();
+        sc.setParameters("ms", msId);
+
+        host = createForUpdate();
+        host.setManagementServerId(null);
+        host.setLastPinged((System.currentTimeMillis() >> 10) - (10 * 60));
+        host.setDisconnectedOn(new Date());
+        ub = getUpdateBuilder(host);
+        update(ub, sc, null);
+    }
+ 
+    @Override
+    public List<HostVO> listByHostTag(Host.Type type, Long clusterId, Long podId, long dcId, String hostTag) {
+
+        SearchBuilder<HostTagVO> hostTagSearch = _hostTagsDao.createSearchBuilder();
+        HostTagVO tagEntity = hostTagSearch.entity();
+        hostTagSearch.and("tag", tagEntity.getTag(), SearchCriteria.Op.EQ);
+
+        SearchBuilder<HostVO> hostSearch = createSearchBuilder();
+        HostVO entity = hostSearch.entity();
+        hostSearch.and("type", entity.getType(), SearchCriteria.Op.EQ);
+        hostSearch.and("pod", entity.getPodId(), SearchCriteria.Op.EQ);
+        hostSearch.and("dc", entity.getDataCenterId(), SearchCriteria.Op.EQ);
+        hostSearch.and("cluster", entity.getClusterId(), SearchCriteria.Op.EQ);
+        hostSearch.and("status", entity.getStatus(), SearchCriteria.Op.EQ);
+        hostSearch.and("resourceState", entity.getResourceState(), SearchCriteria.Op.EQ);
+        hostSearch.join("hostTagSearch", hostTagSearch, entity.getId(), tagEntity.getHostId(), JoinBuilder.JoinType.INNER);
+
+        SearchCriteria<HostVO> sc = hostSearch.create();
+        sc.setJoinParameters("hostTagSearch", "tag", hostTag);
+        sc.setParameters("type", type.toString());
+        if (podId != null) {
+            sc.setParameters("pod", podId);
+        }
+        if (clusterId != null) {
+            sc.setParameters("cluster", clusterId);
+        }
+        sc.setParameters("dc", dcId);
+        sc.setParameters("status", Status.Up.toString());
+        sc.setParameters("resourceState", ResourceState.Enabled.toString());
+
+        return listBy(sc);
+    }
+    
+    
+    @Override
+    public List<HostVO> listAllUpAndEnabledNonHAHosts(Type type, Long clusterId, Long podId, long dcId, String haTag) {
+        SearchBuilder<HostTagVO> hostTagSearch = null;
+        if (haTag != null && !haTag.isEmpty()) {
+            hostTagSearch = _hostTagsDao.createSearchBuilder();
+            hostTagSearch.and().op("tag", hostTagSearch.entity().getTag(), SearchCriteria.Op.NEQ);
+            hostTagSearch.or("tagNull", hostTagSearch.entity().getTag(), SearchCriteria.Op.NULL);
+            hostTagSearch.cp();
+        }
+        
+        SearchBuilder<HostVO> hostSearch = createSearchBuilder();
+     
+        hostSearch.and("type", hostSearch.entity().getType(), SearchCriteria.Op.EQ);
+        hostSearch.and("clusterId", hostSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
+        hostSearch.and("podId", hostSearch.entity().getPodId(), SearchCriteria.Op.EQ);
+        hostSearch.and("zoneId", hostSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        hostSearch.and("status", hostSearch.entity().getStatus(), SearchCriteria.Op.EQ);
+        hostSearch.and("resourceState", hostSearch.entity().getResourceState(), SearchCriteria.Op.EQ);
+        
+        if (haTag != null && !haTag.isEmpty()) {
+            hostSearch.join("hostTagSearch", hostTagSearch, hostSearch.entity().getId(), hostTagSearch.entity().getHostId(), JoinBuilder.JoinType.LEFTOUTER);
+        }
+
+        SearchCriteria<HostVO> sc = hostSearch.create();
+        
+        if (haTag != null && !haTag.isEmpty()) {
+            sc.setJoinParameters("hostTagSearch", "tag", haTag);
+        }
+        
+        if (type != null) {
+            sc.setParameters("type", type);
+        }
+        
+        if (clusterId != null) {
+            sc.setParameters("clusterId", clusterId);
+        }
+        
+        if (podId != null) {
+            sc.setParameters("podId", podId);
+        }
+        
+        sc.setParameters("zoneId", dcId);
+        sc.setParameters("status", Status.Up);
+        sc.setParameters("resourceState", ResourceState.Enabled);
+        
+        return listBy(sc);
+    }
+
+    @Override
+    public void loadDetails(HostVO host) {
+        Map<String, String> details = _detailsDao.findDetails(host.getId());
+        host.setDetails(details);
+    }
+
+    @Override
+    public void loadHostTags(HostVO host) {
+        List<String> hostTags = _hostTagsDao.gethostTags(host.getId());
+        host.setHostTags(hostTags);
+    }
+
+    @DB
+    @Override
+    public List<HostVO> findLostHosts(long timeout) {
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        List<HostVO> result = new ArrayList<HostVO>();
+        ResultSet rs = null;
+        try {
+            String sql = "select h.id from host h left join  cluster c on h.cluster_id=c.id where h.mgmt_server_id is not null and h.last_ping < ? and h.status in ('Up', 'Updating', 'Disconnected', 'Connecting') and h.type not in ('ExternalFirewall', 'ExternalLoadBalancer', 'TrafficMonitor', 'SecondaryStorage', 'LocalSecondaryStorage', 'L2Networking') and (h.cluster_id is null or c.managed_state = 'Managed') ;" ;
+            pstmt = txn.prepareStatement(sql);
+            pstmt.setLong(1, timeout);
+            rs = pstmt.executeQuery();
+            while (rs.next()) {
+                long id = rs.getLong(1); //ID column
+                result.add(findById(id));
+            }
+        } catch (Exception e) {
+            s_logger.warn("Exception: ", e);
+        } finally {
+            try {
+                if (rs != null) {
+                    rs.close();
+                }
+                if (pstmt != null) {
+                    pstmt.close();
+                }
+            } catch (SQLException e) {
+            }
+        }
+        return result;
+    }
+   
+    @Override
+    public void saveDetails(HostVO host) {
+        Map<String, String> details = host.getDetails();
+        if (details == null) {
+            return;
+        }
+        _detailsDao.persist(host.getId(), details);
+    }
+
+    protected void saveHostTags(HostVO host) {
+        List<String> hostTags = host.getHostTags();
+        if (hostTags == null || (hostTags != null && hostTags.isEmpty())) {
+            return;
+        }
+        _hostTagsDao.persist(host.getId(), hostTags);
+    }
+
+    @Override
+    @DB
+    public HostVO persist(HostVO host) {
+        final String InsertSequenceSql = "INSERT INTO op_host(id) VALUES(?)";
+
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+
+        HostVO dbHost = super.persist(host);
+
+        try {
+            PreparedStatement pstmt = txn.prepareAutoCloseStatement(InsertSequenceSql);
+            pstmt.setLong(1, dbHost.getId());
+            pstmt.executeUpdate();
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Unable to persist the sequence number for this host");
+        }
+
+        saveDetails(host);
+        loadDetails(dbHost);
+        saveHostTags(host);
+        loadHostTags(dbHost);
+
+        txn.commit();
+
+        return dbHost;
+    }
+
+    @Override
+    @DB
+    public boolean update(Long hostId, HostVO host) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+
+        boolean persisted = super.update(hostId, host);
+        if (!persisted) {
+            return persisted;
+        }
+
+        saveDetails(host);
+        saveHostTags(host);
+
+        txn.commit();
+
+        return persisted;
+    }
+
+    @Override
+    @DB
+    public List<RunningHostCountInfo> getRunningHostCounts(Date cutTime) {
+        String sql = "select * from (" + "select h.data_center_id, h.type, count(*) as count from host as h INNER JOIN mshost as m ON h.mgmt_server_id=m.msid "
+                + "where h.status='Up' and h.type='SecondaryStorage' and m.last_update > ? " + "group by h.data_center_id, h.type " + "UNION ALL "
+                + "select h.data_center_id, h.type, count(*) as count from host as h INNER JOIN mshost as m ON h.mgmt_server_id=m.msid "
+                + "where h.status='Up' and h.type='Routing' and m.last_update > ? " + "group by h.data_center_id, h.type) as t " + "ORDER by t.data_center_id, t.type";
+
+        ArrayList<RunningHostCountInfo> l = new ArrayList<RunningHostCountInfo>();
+
+        Transaction txn = Transaction.currentTxn();
+        ;
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql);
+            String gmtCutTime = DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutTime);
+            pstmt.setString(1, gmtCutTime);
+            pstmt.setString(2, gmtCutTime);
+
+            ResultSet rs = pstmt.executeQuery();
+            while (rs.next()) {
+                RunningHostCountInfo info = new RunningHostCountInfo();
+                info.setDcId(rs.getLong(1));
+                info.setHostType(rs.getString(2));
+                info.setCount(rs.getInt(3));
+
+                l.add(info);
+            }
+        } catch (SQLException e) {
+        } catch (Throwable e) {
+        }
+        return l;
+    }
+
+    @Override
+    public long getNextSequence(long hostId) {
+        if (s_logger.isTraceEnabled()) {
+            s_logger.trace("getNextSequence(), hostId: " + hostId);
+        }
+
+        TableGenerator tg = _tgs.get("host_req_sq");
+        assert tg != null : "how can this be wrong!";
+
+        return s_seqFetcher.getNextSequence(Long.class, tg, hostId);
+    }
+
+    /*TODO: this is used by mycloud, check if it needs resource state Enabled */
+    @Override
+    public long countRoutingHostsByDataCenter(long dcId) {
+        SearchCriteria<Long> sc = CountRoutingByDc.create();
+        sc.setParameters("dc", dcId);
+        sc.setParameters("type", Host.Type.Routing);
+        sc.setParameters("status", Status.Up.toString());
+        return customSearch(sc, null).get(0);
+    }
+
+
+	@Override
+	public boolean updateState(Status oldStatus, Event event, Status newStatus, Host vo, Object data) {
+		HostVO host = findById(vo.getId());
+		long oldPingTime = host.getLastPinged();
+
+		SearchBuilder<HostVO> sb = createSearchBuilder();
+		sb.and("status", sb.entity().getStatus(), SearchCriteria.Op.EQ);
+		sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
+		sb.and("update", sb.entity().getUpdated(), SearchCriteria.Op.EQ);
+		if (newStatus.checkManagementServer()) {
+			sb.and("ping", sb.entity().getLastPinged(), SearchCriteria.Op.EQ);
+			sb.and().op("nullmsid", sb.entity().getManagementServerId(), SearchCriteria.Op.NULL);
+			sb.or("msid", sb.entity().getManagementServerId(), SearchCriteria.Op.EQ);
+			sb.closeParen();
+		}
+		sb.done();
+
+		SearchCriteria<HostVO> sc = sb.create();
+
+		sc.setParameters("status", oldStatus);
+		sc.setParameters("id", host.getId());
+		sc.setParameters("update", host.getUpdated());
+		long oldUpdateCount = host.getUpdated();
+		if (newStatus.checkManagementServer()) {
+			sc.setParameters("ping", oldPingTime);
+			sc.setParameters("msid", host.getManagementServerId());
+		}
+
+		long newUpdateCount = host.incrUpdated();
+		UpdateBuilder ub = getUpdateBuilder(host);
+		ub.set(host, _statusAttr, newStatus);
+		if (newStatus.updateManagementServer()) {
+			if (newStatus.lostConnection()) {
+				ub.set(host, _msIdAttr, null);
+			} else {
+				ub.set(host, _msIdAttr, host.getManagementServerId());
+			}
+			if (event.equals(Event.Ping) || event.equals(Event.AgentConnected)) {
+				ub.set(host, _pingTimeAttr, System.currentTimeMillis() >> 10);
+			}
+		}
+		if (event.equals(Event.ManagementServerDown)) {
+			ub.set(host, _pingTimeAttr, ((System.currentTimeMillis() >> 10) - (10 * 60)));
+		}
+		int result = update(ub, sc, null);
+		assert result <= 1 : "How can this update " + result + " rows? ";
+
+		if (status_logger.isDebugEnabled() && result == 0) {
+			HostVO ho = findById(host.getId());
+			assert ho != null : "How how how? : " + host.getId();
+
+			StringBuilder str = new StringBuilder("Unable to update host for event:").append(event.toString());
+			str.append(". Name=").append(host.getName());
+			str.append("; New=[status=").append(newStatus.toString()).append(":msid=")
+			        .append(newStatus.lostConnection() ? "null" : host.getManagementServerId()).append(":lastpinged=").append(host.getLastPinged()).append("]");
+			str.append("; Old=[status=").append(oldStatus.toString()).append(":msid=").append(host.getManagementServerId()).append(":lastpinged=")
+			        .append(oldPingTime).append("]");
+			str.append("; DB=[status=").append(vo.getStatus().toString()).append(":msid=").append(vo.getManagementServerId()).append(":lastpinged=")
+			        .append(vo.getLastPinged()).append(":old update count=").append(oldUpdateCount).append("]");
+			status_logger.debug(str.toString());
+		} else {
+			StringBuilder msg = new StringBuilder("Agent status update: [");
+			msg.append("id = " + host.getId());
+			msg.append("; name = " + host.getName());
+			msg.append("; old status = " + oldStatus);
+			msg.append("; event = " + event);
+			msg.append("; new status = " + newStatus);
+			msg.append("; old update count = " + oldUpdateCount);
+			msg.append("; new update count = " + newUpdateCount + "]");
+			status_logger.debug(msg.toString());
+		}
+		
+		return result > 0;
+	}
+	
+    @Override
+    public boolean updateResourceState(ResourceState oldState, ResourceState.Event event, ResourceState newState, Host vo) {
+        HostVO host = (HostVO)vo;
+        SearchBuilder<HostVO> sb = createSearchBuilder();
+        sb.and("resource_state", sb.entity().getResourceState(), SearchCriteria.Op.EQ);
+        sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
+        sb.done();
+        
+        SearchCriteria<HostVO> sc = sb.create();
+
+        sc.setParameters("resource_state", oldState);
+        sc.setParameters("id", host.getId());
+        
+        UpdateBuilder ub = getUpdateBuilder(host);
+        ub.set(host, _resourceStateAttr, newState);
+        int result = update(ub, sc, null);
+        assert result <= 1 : "How can this update " + result + " rows? ";
+        
+        if (state_logger.isDebugEnabled() && result == 0) {
+            HostVO ho = findById(host.getId());
+            assert ho != null : "How how how? : " + host.getId();
+
+            StringBuilder str = new StringBuilder("Unable to update resource state: [");
+			str.append("m = " + host.getId());
+			str.append("; name = " + host.getName());
+			str.append("; old state = " + oldState);
+			str.append("; event = " + event);
+			str.append("; new state = " + newState + "]");
+			state_logger.debug(str.toString());
+        } else {
+			StringBuilder msg = new StringBuilder("Resource state update: [");
+			msg.append("id = " + host.getId());
+			msg.append("; name = " + host.getName());
+			msg.append("; old state = " + oldState);
+			msg.append("; event = " + event);
+			msg.append("; new state = " + newState + "]");
+			state_logger.debug(msg.toString());
+        }
+		
+        return result > 0;
+    }
+    
+    @Override
+    public HostVO findByTypeNameAndZoneId(long zoneId, String name, Host.Type type) {
+        SearchCriteria<HostVO> sc = TypeNameZoneSearch.create();
+        sc.setParameters("type", type);
+        sc.setParameters("name", name);
+        sc.setParameters("zoneId", zoneId);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public List<HostVO> findHypervisorHostInCluster(long clusterId) {
+        SearchCriteria<HostVO> sc = TypeClusterStatusSearch.create();
+        sc.setParameters("type", Host.Type.Routing);
+        sc.setParameters("cluster", clusterId);
+        sc.setParameters("status", Status.Up);
+        sc.setParameters("resourceState", ResourceState.Enabled);
+
+        return listBy(sc);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/host/dao/HostDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/dao/HostDetailsDao.java b/engine/schema/src/com/cloud/host/dao/HostDetailsDao.java
new file mode 100644
index 0000000..5babcad
--- /dev/null
+++ b/engine/schema/src/com/cloud/host/dao/HostDetailsDao.java
@@ -0,0 +1,32 @@
+// 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.host.dao;
+
+import java.util.Map;
+
+import com.cloud.host.DetailVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface HostDetailsDao extends GenericDao<DetailVO, Long> {
+    Map<String, String> findDetails(long hostId);
+    
+    void persist(long hostId, Map<String, String> details);
+    
+    DetailVO findDetail(long hostId, String name);
+
+	void deleteDetails(long hostId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/host/dao/HostDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/dao/HostDetailsDaoImpl.java b/engine/schema/src/com/cloud/host/dao/HostDetailsDaoImpl.java
new file mode 100644
index 0000000..b6a9cef
--- /dev/null
+++ b/engine/schema/src/com/cloud/host/dao/HostDetailsDaoImpl.java
@@ -0,0 +1,110 @@
+// 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.host.dao;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.host.DetailVO;
+import com.cloud.utils.crypt.DBEncryptionUtil;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value=HostDetailsDao.class)
+public class HostDetailsDaoImpl extends GenericDaoBase<DetailVO, Long> implements HostDetailsDao {
+    protected final SearchBuilder<DetailVO> HostSearch;
+    protected final SearchBuilder<DetailVO> DetailSearch;
+    
+    public HostDetailsDaoImpl() {
+        HostSearch = createSearchBuilder();
+        HostSearch.and("hostId", HostSearch.entity().getHostId(), SearchCriteria.Op.EQ);
+        HostSearch.done();
+        
+        DetailSearch = createSearchBuilder();
+        DetailSearch.and("hostId", DetailSearch.entity().getHostId(), SearchCriteria.Op.EQ);
+        DetailSearch.and("name", DetailSearch.entity().getName(), SearchCriteria.Op.EQ);
+        DetailSearch.done();
+    }
+
+    @Override
+    public DetailVO findDetail(long hostId, String name) {
+        SearchCriteria<DetailVO> sc = DetailSearch.create();
+        sc.setParameters("hostId", hostId);
+        sc.setParameters("name", name);
+        
+        DetailVO detail = findOneIncludingRemovedBy(sc);
+        if("password".equals(name) && detail != null){
+        	detail.setValue(DBEncryptionUtil.decrypt(detail.getValue()));
+        }
+        return detail;
+    }
+
+    @Override
+    public Map<String, String> findDetails(long hostId) {
+        SearchCriteria<DetailVO> sc = HostSearch.create();
+        sc.setParameters("hostId", hostId);
+        
+        List<DetailVO> results = search(sc, null);
+        Map<String, String> details = new HashMap<String, String>(results.size());
+        for (DetailVO result : results) {
+        	if("password".equals(result.getName())){
+        		details.put(result.getName(), DBEncryptionUtil.decrypt(result.getValue()));
+        	} else {
+        		details.put(result.getName(), result.getValue());
+        	}
+        }
+        return details;
+    }
+    
+    @Override
+    public void deleteDetails(long hostId) {
+        SearchCriteria sc = HostSearch.create();
+        sc.setParameters("hostId", hostId);
+        
+        List<DetailVO> results = search(sc, null);
+        for (DetailVO result : results) {
+        	remove(result.getId());
+        }
+    }
+
+    @Override
+    public void persist(long hostId, Map<String, String> details) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        SearchCriteria<DetailVO> sc = HostSearch.create();
+        sc.setParameters("hostId", hostId);
+        expunge(sc);
+        
+        for (Map.Entry<String, String> detail : details.entrySet()) {
+        	String value = detail.getValue();
+        	if("password".equals(detail.getKey())){
+        		value = DBEncryptionUtil.encrypt(value);
+        	}
+            DetailVO vo = new DetailVO(hostId, detail.getKey(), value);
+            persist(vo);
+        }
+        txn.commit();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/host/dao/HostTagsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/dao/HostTagsDao.java b/engine/schema/src/com/cloud/host/dao/HostTagsDao.java
new file mode 100644
index 0000000..ddda882
--- /dev/null
+++ b/engine/schema/src/com/cloud/host/dao/HostTagsDao.java
@@ -0,0 +1,30 @@
+// 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.host.dao;
+
+import java.util.List;
+import com.cloud.host.HostTagVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface HostTagsDao extends GenericDao<HostTagVO, Long> {
+    
+    void persist(long hostId, List<String> hostTags);
+    
+    List<String> gethostTags(long hostId);
+	
+}
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java b/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java
new file mode 100644
index 0000000..0e93275
--- /dev/null
+++ b/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java
@@ -0,0 +1,75 @@
+// 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.host.dao;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.host.HostTagVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value=HostTagsDao.class)
+public class HostTagsDaoImpl extends GenericDaoBase<HostTagVO, Long> implements HostTagsDao {
+    protected final SearchBuilder<HostTagVO> HostSearch;
+    
+    public HostTagsDaoImpl() {
+        HostSearch = createSearchBuilder();
+        HostSearch.and("hostId", HostSearch.entity().getHostId(), SearchCriteria.Op.EQ);
+        HostSearch.done();        
+    }
+
+    @Override
+    public List<String> gethostTags(long hostId) {
+        SearchCriteria<HostTagVO> sc = HostSearch.create();
+        sc.setParameters("hostId", hostId);
+        
+        List<HostTagVO> results = search(sc, null);
+        List<String> hostTags = new ArrayList<String>(results.size());
+        for (HostTagVO result : results) {
+        	hostTags.add(result.getTag());
+        }
+
+        return hostTags;
+    }
+    
+    @Override
+    public void persist(long hostId, List<String> hostTags) {
+        Transaction txn = Transaction.currentTxn();
+
+        txn.start();
+        SearchCriteria<HostTagVO> sc = HostSearch.create();
+        sc.setParameters("hostId", hostId);
+        expunge(sc);
+        
+        for (String tag : hostTags) {
+            tag = tag.trim();
+            if(tag.length() > 0) {
+                HostTagVO vo = new HostTagVO(hostId, tag);
+                persist(vo);
+            }
+        }
+        txn.commit();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/hypervisor/HypervisorCapabilitiesVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/hypervisor/HypervisorCapabilitiesVO.java b/engine/schema/src/com/cloud/hypervisor/HypervisorCapabilitiesVO.java
new file mode 100644
index 0000000..6689066
--- /dev/null
+++ b/engine/schema/src/com/cloud/hypervisor/HypervisorCapabilitiesVO.java
@@ -0,0 +1,212 @@
+// 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.hypervisor;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.utils.NumbersUtil;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="hypervisor_capabilities")
+public class HypervisorCapabilitiesVO implements HypervisorCapabilities {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="hypervisor_type")
+    @Enumerated(value=EnumType.STRING)
+    private HypervisorType hypervisorType;
+
+    @Column(name="hypervisor_version")
+    private String hypervisorVersion;
+
+    @Column(name="max_guests_limit")
+    private Long maxGuestsLimit;
+
+    @Column(name="security_group_enabled")
+    private boolean securityGroupEnabled;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    @Column(name="max_data_volumes_limit")
+    private Integer maxDataVolumesLimit;
+
+    @Column(name="max_hosts_per_cluster")
+    private Integer maxHostsPerCluster;
+
+    @Column(name="vm_snapshot_enabled")
+    private Boolean vmSnapshotEnabled;
+
+    @Column(name="storage_motion_supported")
+    private boolean storageMotionSupported;
+
+    protected HypervisorCapabilitiesVO() {
+    	this.uuid = UUID.randomUUID().toString();
+    }
+
+    public HypervisorCapabilitiesVO(HypervisorType hypervisorType, String hypervisorVersion, Long maxGuestsLimit,
+            boolean securityGroupEnabled, boolean storageMotionSupported) {
+        this.hypervisorType = hypervisorType;
+        this.hypervisorVersion = hypervisorVersion;
+        this.maxGuestsLimit = maxGuestsLimit;
+        this.securityGroupEnabled = securityGroupEnabled;
+        this.storageMotionSupported = storageMotionSupported;
+    	this.uuid = UUID.randomUUID().toString();
+    }
+
+    /**
+     * @param hypervisorType the hypervisorType to set
+     */
+    public void setHypervisorType(HypervisorType hypervisorType) {
+        this.hypervisorType = hypervisorType;
+    }
+
+
+    /**
+     * @return the hypervisorType
+     */
+    @Override
+    public HypervisorType getHypervisorType() {
+        return hypervisorType;
+    }
+
+    /**
+     * @param hypervisorVersion the hypervisorVersion to set
+     */
+    public void setHypervisorVersion(String hypervisorVersion) {
+        this.hypervisorVersion = hypervisorVersion;
+    }
+
+    /**
+     * @return the hypervisorVersion
+     */
+    @Override
+    public String getHypervisorVersion() {
+        return hypervisorVersion;
+    }
+
+    public void setSecurityGroupEnabled(Boolean securityGroupEnabled) {
+        this.securityGroupEnabled = securityGroupEnabled;
+    }
+
+    /**
+     * @return the securityGroupSupport
+     */
+    @Override
+    public boolean isSecurityGroupEnabled() {
+        return securityGroupEnabled;
+    }
+
+    /**
+     * @param maxGuests the maxGuests to set
+     */
+    public void setMaxGuestsLimit(Long maxGuestsLimit) {
+        this.maxGuestsLimit = maxGuestsLimit;
+    }
+
+    /**
+     * @return the maxGuests
+     */
+    @Override
+    public Long getMaxGuestsLimit() {
+        return maxGuestsLimit;
+    }
+
+    /**
+     * @param storageMotionSupported
+     */
+    public void setStorageMotionSupported(boolean storageMotionSupported) {
+        this.storageMotionSupported = storageMotionSupported;
+    }
+
+    /**
+     * @return if storage motion is supported
+     */
+    @Override
+    public boolean isStorageMotionSupported() {
+        return storageMotionSupported;
+    }
+
+
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public int hashCode() {
+        return NumbersUtil.hash(id);
+    }
+    
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+    
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+
+    @Override
+    public Integer getMaxDataVolumesLimit() {
+        return maxDataVolumesLimit;
+    }
+
+    public void setMaxDataVolumesLimit(Integer maxDataVolumesLimit) {
+        this.maxDataVolumesLimit = maxDataVolumesLimit;
+    }
+
+    @Override
+    public Integer getMaxHostsPerCluster() {
+        return maxHostsPerCluster;
+    }
+
+    public void setMaxHostsPerCluster(Integer maxHostsPerCluster) {
+        this.maxHostsPerCluster = maxHostsPerCluster;
+    }
+
+	public Boolean getVmSnapshotEnabled() {
+		return vmSnapshotEnabled;
+	}
+
+	public void setVmSnapshotEnabled(Boolean vmSnapshotEnabled) {
+		this.vmSnapshotEnabled = vmSnapshotEnabled;
+	}
+
+	@Override
+    public boolean equals(Object obj) {
+        if (obj instanceof HypervisorCapabilitiesVO) {
+            return ((HypervisorCapabilitiesVO)obj).getId() == this.getId();
+        } else {
+            return false;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/hypervisor/dao/HypervisorCapabilitiesDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/hypervisor/dao/HypervisorCapabilitiesDao.java b/engine/schema/src/com/cloud/hypervisor/dao/HypervisorCapabilitiesDao.java
new file mode 100644
index 0000000..1fdc03a
--- /dev/null
+++ b/engine/schema/src/com/cloud/hypervisor/dao/HypervisorCapabilitiesDao.java
@@ -0,0 +1,38 @@
+// 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.hypervisor.dao;
+
+import java.util.List;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.hypervisor.HypervisorCapabilitiesVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface HypervisorCapabilitiesDao extends GenericDao<HypervisorCapabilitiesVO, Long> {
+    
+    List<HypervisorCapabilitiesVO> listAllByHypervisorType(HypervisorType hypervisorType);
+    
+    HypervisorCapabilitiesVO findByHypervisorTypeAndVersion(HypervisorType hypervisorType, String hypervisorVersion);
+    
+    Long getMaxGuestsLimit(HypervisorType hypervisorType, String hypervisorVersion);
+
+    Integer getMaxDataVolumesLimit(HypervisorType hypervisorType, String hypervisorVersion);
+
+    Integer getMaxHostsPerCluster(HypervisorType hypervisorType, String hypervisorVersion);
+    
+    Boolean isVmSnapshotEnabled(HypervisorType hypervisorType, String hypervisorVersion);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/hypervisor/dao/HypervisorCapabilitiesDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/hypervisor/dao/HypervisorCapabilitiesDaoImpl.java b/engine/schema/src/com/cloud/hypervisor/dao/HypervisorCapabilitiesDaoImpl.java
new file mode 100644
index 0000000..b5e17ee
--- /dev/null
+++ b/engine/schema/src/com/cloud/hypervisor/dao/HypervisorCapabilitiesDaoImpl.java
@@ -0,0 +1,105 @@
+// 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.hypervisor.dao;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.hypervisor.HypervisorCapabilitiesVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import javax.ejb.Local;
+import java.util.List;
+
+@Component
+@Local(value=HypervisorCapabilitiesDao.class)
+public class HypervisorCapabilitiesDaoImpl extends GenericDaoBase<HypervisorCapabilitiesVO, Long> implements HypervisorCapabilitiesDao {
+    
+    private static final Logger s_logger = Logger.getLogger(HypervisorCapabilitiesDaoImpl.class);
+
+    protected final SearchBuilder<HypervisorCapabilitiesVO> HypervisorTypeSearch;
+    protected final SearchBuilder<HypervisorCapabilitiesVO> HypervisorTypeAndVersionSearch;
+
+    private static final String DEFAULT_VERSION = "default";
+    
+    protected HypervisorCapabilitiesDaoImpl() {
+        HypervisorTypeSearch = createSearchBuilder();
+        HypervisorTypeSearch.and("hypervisorType", HypervisorTypeSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ);
+        HypervisorTypeSearch.done();
+        
+        HypervisorTypeAndVersionSearch = createSearchBuilder();
+        HypervisorTypeAndVersionSearch.and("hypervisorType", HypervisorTypeAndVersionSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ);
+        HypervisorTypeAndVersionSearch.and("hypervisorVersion", HypervisorTypeAndVersionSearch.entity().getHypervisorVersion(), SearchCriteria.Op.EQ);
+        HypervisorTypeAndVersionSearch.done();
+    }
+
+    HypervisorCapabilitiesVO getCapabilities(HypervisorType hypervisorType, String hypervisorVersion) {
+        HypervisorCapabilitiesVO result = findByHypervisorTypeAndVersion(hypervisorType, hypervisorVersion);
+        if (result == null) { // if data is not available for a specific version then use 'default' as version
+            result = findByHypervisorTypeAndVersion(hypervisorType, DEFAULT_VERSION);
+        }
+        return result;
+    }
+
+    @Override
+    public List<HypervisorCapabilitiesVO> listAllByHypervisorType(HypervisorType hypervisorType){
+        SearchCriteria<HypervisorCapabilitiesVO> sc = HypervisorTypeSearch.create();
+        sc.setParameters("hypervisorType", hypervisorType);
+        return search(sc, null);
+    }
+    
+    @Override
+    public HypervisorCapabilitiesVO findByHypervisorTypeAndVersion(HypervisorType hypervisorType, String hypervisorVersion){
+        SearchCriteria<HypervisorCapabilitiesVO> sc = HypervisorTypeAndVersionSearch.create();
+        sc.setParameters("hypervisorType", hypervisorType);
+        sc.setParameters("hypervisorVersion", hypervisorVersion);
+        return findOneBy(sc);
+    }
+    
+    @Override
+    public Long getMaxGuestsLimit(HypervisorType hypervisorType, String hypervisorVersion){
+        Long defaultLimit = new Long(50);
+        HypervisorCapabilitiesVO result = getCapabilities(hypervisorType, hypervisorVersion);
+        if (result == null)
+            return defaultLimit;
+        Long limit = result.getMaxGuestsLimit();
+        if (limit == null)
+            return defaultLimit;
+        return limit;
+    }
+
+    @Override
+    public Integer getMaxDataVolumesLimit(HypervisorType hypervisorType, String hypervisorVersion) {
+        HypervisorCapabilitiesVO result = getCapabilities(hypervisorType, hypervisorVersion);
+        return result.getMaxDataVolumesLimit();
+    }
+
+    @Override
+    public Integer getMaxHostsPerCluster(HypervisorType hypervisorType, String hypervisorVersion) {
+        HypervisorCapabilitiesVO result = getCapabilities(hypervisorType, hypervisorVersion);
+        return result.getMaxHostsPerCluster();
+    }
+
+	@Override
+	public Boolean isVmSnapshotEnabled(HypervisorType hypervisorType,
+			String hypervisorVersion) {
+		HypervisorCapabilitiesVO result = getCapabilities(hypervisorType, hypervisorVersion);
+		return result.getVmSnapshotEnabled();
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/keystore/KeystoreDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/keystore/KeystoreDao.java b/engine/schema/src/com/cloud/keystore/KeystoreDao.java
new file mode 100644
index 0000000..291f16e
--- /dev/null
+++ b/engine/schema/src/com/cloud/keystore/KeystoreDao.java
@@ -0,0 +1,29 @@
+// 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.keystore;
+
+import java.util.List;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface KeystoreDao extends GenericDao<KeystoreVO, Long> {
+	KeystoreVO findByName(String name);
+	void save(String name, String certificate, String key, String domainSuffix);
+	void save(String alias, String certificate, Integer index,
+			String domainSuffix);
+	List<KeystoreVO> findCertChain();
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/keystore/KeystoreDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/keystore/KeystoreDaoImpl.java b/engine/schema/src/com/cloud/keystore/KeystoreDaoImpl.java
new file mode 100644
index 0000000..0ea97c7
--- /dev/null
+++ b/engine/schema/src/com/cloud/keystore/KeystoreDaoImpl.java
@@ -0,0 +1,118 @@
+// 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.keystore;
+
+import java.sql.PreparedStatement;
+import java.util.Comparator;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+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.exception.CloudRuntimeException;
+
+import edu.emory.mathcs.backport.java.util.Collections;
+
+@Component
+@Local(value={KeystoreDao.class})
+public class KeystoreDaoImpl extends GenericDaoBase<KeystoreVO, Long> implements KeystoreDao {
+    protected final SearchBuilder<KeystoreVO> FindByNameSearch;
+    protected final SearchBuilder<KeystoreVO> CertChainSearch;
+
+	public KeystoreDaoImpl() {
+		FindByNameSearch = createSearchBuilder();
+		FindByNameSearch.and("name", FindByNameSearch.entity().getName(), Op.EQ);
+		FindByNameSearch.done();
+		
+		CertChainSearch = createSearchBuilder();
+		CertChainSearch.and("key", CertChainSearch.entity().getKey(), Op.NULL);
+		CertChainSearch.done();
+	}
+	
+	@Override
+	public List<KeystoreVO> findCertChain() {
+		SearchCriteria<KeystoreVO> sc =  CertChainSearch.create();
+		List<KeystoreVO> ks = listBy(sc);
+		Collections.sort(ks, new Comparator() { public int compare(Object o1, Object o2) {
+			Integer seq1 = ((KeystoreVO)o1).getIndex();
+			Integer seq2 = ((KeystoreVO)o2).getIndex();
+			return seq1.compareTo(seq2);
+		}});
+		return ks;
+	}
+	
+	@Override
+	public KeystoreVO findByName(String name) {
+		assert(name != null);
+		
+		SearchCriteria<KeystoreVO> sc =  FindByNameSearch.create();
+		sc.setParameters("name", name);
+		return findOneBy(sc);
+	}
+	
+	@Override
+	@DB
+	public void save(String name, String certificate, String key, String domainSuffix) {
+		Transaction txn = Transaction.currentTxn();
+		try {
+			txn.start();
+			
+			String sql = "INSERT INTO keystore (`name`, `certificate`, `key`, `domain_suffix`) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE `certificate`=?, `key`=?, `domain_suffix`=?";
+			PreparedStatement pstmt = txn.prepareAutoCloseStatement(sql);
+			pstmt.setString(1, name);
+			pstmt.setString(2, certificate);
+			pstmt.setString(3, key);
+			pstmt.setString(4, domainSuffix);
+			pstmt.setString(5, certificate);
+			pstmt.setString(6, key);
+			pstmt.setString(7, domainSuffix);
+
+			pstmt.executeUpdate();
+			txn.commit();
+		} catch(Exception e) {
+			txn.rollback();
+			throw new CloudRuntimeException("Unable to save certificate under name " + name + " due to exception", e);
+		}
+	}
+	
+	@Override
+	@DB
+	public void save(String alias, String certificate, Integer index, String domainSuffix) {
+		KeystoreVO ks = this.findByName(alias);
+		if (ks != null) {
+			ks.setCertificate(certificate);
+			ks.setName(alias);
+			ks.setIndex(index);
+			ks.setDomainSuffix(domainSuffix);
+			this.update(ks.getId(), ks);
+		} else {
+			KeystoreVO newks = new KeystoreVO();
+			newks.setCertificate(certificate);
+			newks.setName(alias);
+			newks.setIndex(index);
+			newks.setDomainSuffix(domainSuffix);
+			this.persist(newks);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/keystore/KeystoreVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/keystore/KeystoreVO.java b/engine/schema/src/com/cloud/keystore/KeystoreVO.java
new file mode 100644
index 0000000..f590607
--- /dev/null
+++ b/engine/schema/src/com/cloud/keystore/KeystoreVO.java
@@ -0,0 +1,101 @@
+// 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.keystore;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="keystore")
+public class KeystoreVO implements InternalIdentity {
+	@Id
+	@GeneratedValue(strategy=GenerationType.IDENTITY)
+	@Column(name="id")
+	private Long id;
+
+	@Column(name="name")
+	private String name;
+	
+    @Column(name="certificate",length=65535)
+    private String certificate;
+
+    @Column(name="key",length=65535)
+    private String key;
+    
+    @Column(name="domain_suffix")
+    private String domainSuffix;
+    
+    @Column(name="seq")
+    private Integer index;
+
+    public KeystoreVO() {
+    }
+    
+	public long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getCertificate() {
+		return certificate;
+	}
+
+	public void setCertificate(String certificate) {
+		this.certificate = certificate;
+	}
+
+	public String getKey() {
+		return key;
+	}
+
+	public void setKey(String key) {
+		this.key = key;
+	}
+
+	public String getDomainSuffix() {
+		return domainSuffix;
+	}
+
+	public void setDomainSuffix(String domainSuffix) {
+		this.domainSuffix = domainSuffix;
+	}
+	
+	public void setIndex(Integer index) {
+		this.index = index;
+	}
+	
+	public Integer getIndex() {
+		return this.index;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/migration/DiskOffering20Dao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/migration/DiskOffering20Dao.java b/engine/schema/src/com/cloud/migration/DiskOffering20Dao.java
new file mode 100644
index 0000000..ce22f48
--- /dev/null
+++ b/engine/schema/src/com/cloud/migration/DiskOffering20Dao.java
@@ -0,0 +1,22 @@
+// 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.migration;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface DiskOffering20Dao extends GenericDao<DiskOffering20VO, Long>  {
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/migration/DiskOffering20DaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/migration/DiskOffering20DaoImpl.java b/engine/schema/src/com/cloud/migration/DiskOffering20DaoImpl.java
new file mode 100644
index 0000000..e0eb40e
--- /dev/null
+++ b/engine/schema/src/com/cloud/migration/DiskOffering20DaoImpl.java
@@ -0,0 +1,27 @@
+// 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.migration;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+
+@Local(value={DiskOffering20Dao.class})
+public class DiskOffering20DaoImpl extends GenericDaoBase<DiskOffering20VO, Long> implements DiskOffering20Dao {
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/migration/DiskOffering20VO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/migration/DiskOffering20VO.java b/engine/schema/src/com/cloud/migration/DiskOffering20VO.java
new file mode 100644
index 0000000..e50328d
--- /dev/null
+++ b/engine/schema/src/com/cloud/migration/DiskOffering20VO.java
@@ -0,0 +1,113 @@
+// 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.migration;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="disk_offering")
+public class DiskOffering20VO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    Long id;
+
+    @Column(name="domain_id")
+    long domainId;
+
+    @Column(name="name")
+    private String name = null;
+
+    @Column(name="display_text")
+    private String displayText = null;
+
+    @Column(name="disk_size")
+    long diskSize;
+
+    @Column(name="mirrored")
+    boolean mirrored;
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+
+    public DiskOffering20VO() {
+    }
+
+    public DiskOffering20VO(long domainId, String name, String displayText, long diskSize, boolean mirrored) {
+        this.domainId = domainId;
+        this.name = name;
+        this.displayText = displayText;
+        this.diskSize = diskSize;
+        this.mirrored = mirrored;
+    }
+
+    public long getId() {
+        return id;
+    }
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public long getDomainId() {
+        return domainId;
+    }
+    public void setDomainId(long domainId) {
+        this.domainId = domainId;
+    }
+
+    public String getName() {
+        return name;
+    }
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDisplayText() {
+        return displayText;
+    }
+    public void setDisplayText(String displayText) {
+        this.displayText = displayText;
+    }
+
+    public long getDiskSize() {
+        return diskSize;
+    }
+    public void setDiskSize(long diskSize) {
+        this.diskSize = diskSize;
+    }
+
+    public boolean getMirrored() {
+        return mirrored;
+    }
+    public void setMirrored(boolean mirrored) {
+        this.mirrored = mirrored;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/migration/DiskOffering21Dao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/migration/DiskOffering21Dao.java b/engine/schema/src/com/cloud/migration/DiskOffering21Dao.java
new file mode 100644
index 0000000..21781ea
--- /dev/null
+++ b/engine/schema/src/com/cloud/migration/DiskOffering21Dao.java
@@ -0,0 +1,23 @@
+// 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.migration;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface DiskOffering21Dao extends GenericDao<DiskOffering21VO, Long> {
+}
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/migration/DiskOffering21DaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/migration/DiskOffering21DaoImpl.java b/engine/schema/src/com/cloud/migration/DiskOffering21DaoImpl.java
new file mode 100644
index 0000000..b67d8fb
--- /dev/null
+++ b/engine/schema/src/com/cloud/migration/DiskOffering21DaoImpl.java
@@ -0,0 +1,27 @@
+// 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.migration;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+
+@Local(value={DiskOffering21Dao.class})
+public class DiskOffering21DaoImpl extends GenericDaoBase<DiskOffering21VO, Long> implements DiskOffering21Dao {
+}


[37/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/WEB-INF/classes/resources/messages_es.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_es.properties b/client/WEB-INF/classes/resources/messages_es.properties
index 28f9363..16cfc1c 100644
--- a/client/WEB-INF/classes/resources/messages_es.properties
+++ b/client/WEB-INF/classes/resources/messages_es.properties
@@ -15,7 +15,8 @@
 # specific language governing permissions and limitations
 # under the License.
 
-error.installWizard.message=Algo salio mal, debes ir para atr\u00e1s y corregir los error. 
+
+error.installWizard.message=Algo salio mal, debes ir para atr\u00e1s y corregir los error.
 error.login=Su nombre de usuario / contrase\u00c3\u00b1a no coincide con nuestros registros.
 error.mgmt.server.inaccessible=El Servidor de Gesti\u00c3\u00b3n es inaccesible. Por favor, int\u00c3\u00a9ntelo de nuevo m\u00c3\u00a1s tarde.
 error.session.expired=Su sesi\u00c3\u00b3n ha caducado.
@@ -31,133 +32,133 @@ ICMP.code=ICMP C\u00c3\u00b3digo
 ICMP.type=Tipo ICMP
 image.directory=Directorio de la imagen
 inline=en l\u00c3\u00adnea
-label.account=Cuenta 
-label.account.id=ID de la cuenta 
-label.account.name=Nombre de la cuenta 
+label.account=Cuenta
+label.account.id=ID de la cuenta
+label.account.name=Nombre de la cuenta
 label.accounts=Cuentas
-label.account.specific=espec\u00c3\u00adficas de la cuenta 
+label.account.specific=espec\u00c3\u00adficas de la cuenta
 label.acquire.new.ip=adquirir nuevas IP
-label.action.attach.disk=Conecte el disco 
-label.action.attach.disk.processing=disco Fijaci\u00c3\u00b3n .... 
-label.action.attach.iso=Adjuntar ISO 
-label.action.attach.iso.processing=Colocaci\u00c3\u00b3n de la norma ISO .... 
-label.action.cancel.maintenance.mode=Cancelar modo de mantenimiento 
-label.action.cancel.maintenance.mode.processing=Cancelaci\u00c3\u00b3n del modo de mantenimiento .... 
-label.action.change.password=Cambiar contrase\u00c3\u00b1a 
-label.action.change.service=Cambio de Servicio 
-label.action.change.service.processing=Cambio de servicio .... 
-label.action.copy.ISO=Copia de la ISO 
-label.action.copy.ISO.processing=hacer frente ISO .... 
-label.action.copy.template=Copia de plantilla 
-label.action.copy.template.processing=hacer frente plantilla .... 
-label.action.create.template=Crear plantilla 
+label.action.attach.disk=Conecte el disco
+label.action.attach.disk.processing=disco Fijaci\u00c3\u00b3n ....
+label.action.attach.iso=Adjuntar ISO
+label.action.attach.iso.processing=Colocaci\u00c3\u00b3n de la norma ISO ....
+label.action.cancel.maintenance.mode=Cancelar modo de mantenimiento
+label.action.cancel.maintenance.mode.processing=Cancelaci\u00c3\u00b3n del modo de mantenimiento ....
+label.action.change.password=Cambiar contrase\u00c3\u00b1a
+label.action.change.service=Cambio de Servicio
+label.action.change.service.processing=Cambio de servicio ....
+label.action.copy.ISO=Copia de la ISO
+label.action.copy.ISO.processing=hacer frente ISO ....
+label.action.copy.template=Copia de plantilla
+label.action.copy.template.processing=hacer frente plantilla ....
+label.action.create.template=Crear plantilla
 label.action.create.template.from.vm=Crear plantilla de VM
 label.action.create.template.from.volume=Crear plantilla de volumen
-label.action.create.template.processing=Creaci\u00c3\u00b3n de plantillas .... 
-label.action.create.vm=Crear VM 
-label.action.create.vm.processing=Creaci\u00c3\u00b3n de m\u00c3\u00a1quina virtual .... 
-label.action.create.volume=Crear volumen 
-label.action.create.volume.processing=Crear volumen .... 
-label.action.delete.account=Eliminar cuenta 
-label.action.delete.account.processing=Eliminar cuentas .... 
-label.action.delete.cluster=Borrar Grupo 
-label.action.delete.cluster.processing=Borrar Grupo .... 
-label.action.delete.disk.offering=Borrar disco Ofrenda 
-label.action.delete.disk.offering.processing=Borrar disco ofrece .... 
-label.action.delete.domain=Eliminar de dominio 
-label.action.delete.domain.processing=Eliminaci\u00c3\u00b3n de dominio .... 
-label.action.delete.firewall=Eliminar servidor de seguridad 
-label.action.delete.firewall.processing=Eliminaci\u00c3\u00b3n de firewall .... 
-label.action.delete.ingress.rule=Borrar ingreso Regla 
-label.action.delete.ingress.rule.processing=Eliminaci\u00c3\u00b3n de ingreso regla .... 
-label.action.delete.IP.range=Eliminar Rango de IP 
-label.action.delete.IP.range.processing=Eliminar Rango de IP .... 
-label.action.delete.ISO=Eliminar ISO 
-label.action.delete.ISO.processing=Eliminaci\u00c3\u00b3n de la norma ISO .... 
-label.action.delete.load.balancer=Eliminar equilibrador de carga 
+label.action.create.template.processing=Creaci\u00c3\u00b3n de plantillas ....
+label.action.create.vm=Crear VM
+label.action.create.vm.processing=Creaci\u00c3\u00b3n de m\u00c3\u00a1quina virtual ....
+label.action.create.volume=Crear volumen
+label.action.create.volume.processing=Crear volumen ....
+label.action.delete.account=Eliminar cuenta
+label.action.delete.account.processing=Eliminar cuentas ....
+label.action.delete.cluster=Borrar Grupo
+label.action.delete.cluster.processing=Borrar Grupo ....
+label.action.delete.disk.offering=Borrar disco Ofrenda
+label.action.delete.disk.offering.processing=Borrar disco ofrece ....
+label.action.delete.domain=Eliminar de dominio
+label.action.delete.domain.processing=Eliminaci\u00c3\u00b3n de dominio ....
+label.action.delete.firewall=Eliminar servidor de seguridad
+label.action.delete.firewall.processing=Eliminaci\u00c3\u00b3n de firewall ....
+label.action.delete.ingress.rule=Borrar ingreso Regla
+label.action.delete.ingress.rule.processing=Eliminaci\u00c3\u00b3n de ingreso regla ....
+label.action.delete.IP.range=Eliminar Rango de IP
+label.action.delete.IP.range.processing=Eliminar Rango de IP ....
+label.action.delete.ISO=Eliminar ISO
+label.action.delete.ISO.processing=Eliminaci\u00c3\u00b3n de la norma ISO ....
+label.action.delete.load.balancer=Eliminar equilibrador de carga
 label.action.delete.load.balancer.processing=Eliminaci\u00c3\u00b3n del equilibrador de carga ....
-label.action.delete.network=Eliminar Red 
-label.action.delete.network.processing=Eliminaci\u00c3\u00b3n de red .... 
-label.action.delete.pod=Eliminar Pod 
-label.action.delete.pod.processing=Eliminar Pod .... 
-label.action.delete.primary.storage=Almacenamiento primario Eliminar 
-label.action.delete.primary.storage.processing=Eliminaci\u00c3\u00b3n de almacenamiento primaria .... 
-label.action.delete.secondary.storage.processing=Eliminaci\u00c3\u00b3n de almacenamiento secundario .... 
-label.action.delete.secondary.storage=secundaria almacenamiento Eliminar 
-label.action.delete.security.group=Borrar Grupo de Seguridad 
-label.action.delete.security.group.processing=Eliminar grupo de seguridad .... 
-label.action.delete.service.offering=Eliminar Oferta de Servicio 
-label.action.delete.service.offering.processing=Eliminaci\u00c3\u00b3n de Oferta de Servicio .... 
-label.action.delete.snapshot=Eliminar instant\u00c3\u00a1nea 
-label.action.delete.snapshot.processing=Eliminar instant\u00c3\u00a1nea .... 
-label.action.delete.template=Eliminar plantilla 
-label.action.delete.template.processing=Eliminar plantilla .... 
-label.action.delete.user=Eliminar usuario 
-label.action.delete.user.processing=Eliminar usuario .... 
-label.action.delete.volume=Eliminar volumen 
-label.action.delete.volume.processing=Eliminar volumen .... 
-label.action.delete.zone=Eliminar Zona 
-label.action.delete.zone.processing=Eliminaci\u00c3\u00b3n de la Zona .... 
-label.action.destroy.instance=Destruye Instancia 
-label.action.destroy.instance.processing=Destrucci\u00c3\u00b3n Instancia .... 
+label.action.delete.network=Eliminar Red
+label.action.delete.network.processing=Eliminaci\u00c3\u00b3n de red ....
+label.action.delete.pod=Eliminar Pod
+label.action.delete.pod.processing=Eliminar Pod ....
+label.action.delete.primary.storage=Almacenamiento primario Eliminar
+label.action.delete.primary.storage.processing=Eliminaci\u00c3\u00b3n de almacenamiento primaria ....
+label.action.delete.secondary.storage.processing=Eliminaci\u00c3\u00b3n de almacenamiento secundario ....
+label.action.delete.secondary.storage=secundaria almacenamiento Eliminar
+label.action.delete.security.group=Borrar Grupo de Seguridad
+label.action.delete.security.group.processing=Eliminar grupo de seguridad ....
+label.action.delete.service.offering=Eliminar Oferta de Servicio
+label.action.delete.service.offering.processing=Eliminaci\u00c3\u00b3n de Oferta de Servicio ....
+label.action.delete.snapshot=Eliminar instant\u00c3\u00a1nea
+label.action.delete.snapshot.processing=Eliminar instant\u00c3\u00a1nea ....
+label.action.delete.template=Eliminar plantilla
+label.action.delete.template.processing=Eliminar plantilla ....
+label.action.delete.user=Eliminar usuario
+label.action.delete.user.processing=Eliminar usuario ....
+label.action.delete.volume=Eliminar volumen
+label.action.delete.volume.processing=Eliminar volumen ....
+label.action.delete.zone=Eliminar Zona
+label.action.delete.zone.processing=Eliminaci\u00c3\u00b3n de la Zona ....
+label.action.destroy.instance=Destruye Instancia
+label.action.destroy.instance.processing=Destrucci\u00c3\u00b3n Instancia ....
 label.action.destroy.systemvm=destruir el sistema VM
 label.action.destroy.systemvm.processing=Destrucci\u00c3\u00b3n del sistema VM ....
-label.action.detach.disk.processing=Extracci\u00c3\u00b3n disco .... 
-label.action.detach.disk=Separar disco 
-label.action.detach.iso.processing=Extracci\u00c3\u00b3n ISO .... 
-label.action.detach.iso=Separar ISO 
-label.action.disable.account=Desactivar cuenta 
-label.action.disable.account.processing=Deshabilitar cuenta .... 
-label.action.disable.cluster=Deshabilitar cl\u00c3\u00baster 
-label.action.disable.cluster.processing=Desactivaci\u00c3\u00b3n de Cluster Server .... 
-label.action.disable.pod=Deshabilitar Pod 
-label.action.disable.pod.processing=Deshabilitar Pod .... 
-label.action.disable.static.NAT=Deshabilitar NAT est\u00c3\u00a1tica 
-label.action.disable.static.NAT.processing=Deshabilitar NAT est\u00c3\u00a1tica .... 
-label.action.disable.user=Deshabilitar usuario 
-label.action.disable.user.processing=Desactivaci\u00c3\u00b3n de usuario .... 
-label.action.disable.zone=Deshabilitar la zona 
-label.action.disable.zone.processing=Desactivaci\u00c3\u00b3n de la zona .... 
-label.action.download.ISO=ISO Descargar 
-label.action.download.template=Descargar plantilla 
-label.action.download.volume=Descargar Volumen 
-label.action.download.volume.processing=Volumen Descargar .... 
-label.action.edit.account=Editar cuenta 
-label.action.edit.disk.offering=Editar disco Ofrenda 
-label.action.edit.domain=Editar Dominio 
-label.action.edit.global.setting=Editar Mundial Marco 
+label.action.detach.disk.processing=Extracci\u00c3\u00b3n disco ....
+label.action.detach.disk=Separar disco
+label.action.detach.iso.processing=Extracci\u00c3\u00b3n ISO ....
+label.action.detach.iso=Separar ISO
+label.action.disable.account=Desactivar cuenta
+label.action.disable.account.processing=Deshabilitar cuenta ....
+label.action.disable.cluster=Deshabilitar cl\u00c3\u00baster
+label.action.disable.cluster.processing=Desactivaci\u00c3\u00b3n de Cluster Server ....
+label.action.disable.pod=Deshabilitar Pod
+label.action.disable.pod.processing=Deshabilitar Pod ....
+label.action.disable.static.NAT=Deshabilitar NAT est\u00c3\u00a1tica
+label.action.disable.static.NAT.processing=Deshabilitar NAT est\u00c3\u00a1tica ....
+label.action.disable.user=Deshabilitar usuario
+label.action.disable.user.processing=Desactivaci\u00c3\u00b3n de usuario ....
+label.action.disable.zone=Deshabilitar la zona
+label.action.disable.zone.processing=Desactivaci\u00c3\u00b3n de la zona ....
+label.action.download.ISO=ISO Descargar
+label.action.download.template=Descargar plantilla
+label.action.download.volume=Descargar Volumen
+label.action.download.volume.processing=Volumen Descargar ....
+label.action.edit.account=Editar cuenta
+label.action.edit.disk.offering=Editar disco Ofrenda
+label.action.edit.domain=Editar Dominio
+label.action.edit.global.setting=Editar Mundial Marco
 label.action.edit.host=edici\u00c3\u00b3n Anfitri\u00c3\u00b3n
-label.action.edit.instance=Editar Instancia 
-label.action.edit.ISO=Editar ISO 
+label.action.edit.instance=Editar Instancia
+label.action.edit.ISO=Editar ISO
 label.action.edit.network=Edici\u00c3\u00b3n de redes
-label.action.edit.network.offering=Editar Red ofrece 
-label.action.edit.pod=Editar Pod 
-label.action.edit.primary.storage=Editar Almacenamiento primario 
-label.action.edit.resource.limits=Editar l\u00c3\u00admites de recursos 
-label.action.edit.service.offering=Editar Oferta de Servicio 
-label.action.edit.template=Editar plantilla 
-label.action.edit.user=Editar usuario 
-label.action.edit.zone=Edici\u00c3\u00b3n Zona 
-label.action.enable.account=Habilitar cuenta 
-label.action.enable.account.processing=cuenta de Habilitaci\u00c3\u00b3n .... 
-label.action.enable.cluster=Habilitar cl\u00c3\u00baster 
-label.action.enable.cluster.processing=Habilitar cl\u00c3\u00baster .... 
-label.action.enable.maintenance.mode=Activar el modo de mantenimiento 
-label.action.enable.maintenance.mode.processing=Habilitaci\u00c3\u00b3n del modo de mantenimiento .... 
-label.action.enable.pod=Habilitar Pod 
-label.action.enable.pod.processing=Habilitaci\u00c3\u00b3n Pod .... 
-label.action.enable.static.NAT=Habilitar NAT est\u00c3\u00a1tica 
-label.action.enable.static.NAT.processing=Habilitar NAT est\u00c3\u00a1tica .... 
-label.action.enable.user.processing=Habilitaci\u00c3\u00b3n del usuario .... 
-label.action.enable.user=usuario Activar 
+label.action.edit.network.offering=Editar Red ofrece
+label.action.edit.pod=Editar Pod
+label.action.edit.primary.storage=Editar Almacenamiento primario
+label.action.edit.resource.limits=Editar l\u00c3\u00admites de recursos
+label.action.edit.service.offering=Editar Oferta de Servicio
+label.action.edit.template=Editar plantilla
+label.action.edit.user=Editar usuario
+label.action.edit.zone=Edici\u00c3\u00b3n Zona
+label.action.enable.account=Habilitar cuenta
+label.action.enable.account.processing=cuenta de Habilitaci\u00c3\u00b3n ....
+label.action.enable.cluster=Habilitar cl\u00c3\u00baster
+label.action.enable.cluster.processing=Habilitar cl\u00c3\u00baster ....
+label.action.enable.maintenance.mode=Activar el modo de mantenimiento
+label.action.enable.maintenance.mode.processing=Habilitaci\u00c3\u00b3n del modo de mantenimiento ....
+label.action.enable.pod=Habilitar Pod
+label.action.enable.pod.processing=Habilitaci\u00c3\u00b3n Pod ....
+label.action.enable.static.NAT=Habilitar NAT est\u00c3\u00a1tica
+label.action.enable.static.NAT.processing=Habilitar NAT est\u00c3\u00a1tica ....
+label.action.enable.user.processing=Habilitaci\u00c3\u00b3n del usuario ....
+label.action.enable.user=usuario Activar
 label.action.enable.zone=Habilitar la zona
-label.action.enable.zone.processing=Habilitaci\u00c3\u00b3n de zona .... 
-label.action.force.reconnect=Fuerza Vuelva a conectar 
-label.action.force.reconnect.processing=Reconectando .... 
-label.action.generate.keys=Generar Claves 
-label.action.generate.keys.processing=Generar claves .... 
-label.action.lock.account=Bloqueo de cuenta 
-label.action.lock.account.processing=Bloqueo de cuenta .... 
+label.action.enable.zone.processing=Habilitaci\u00c3\u00b3n de zona ....
+label.action.force.reconnect=Fuerza Vuelva a conectar
+label.action.force.reconnect.processing=Reconectando ....
+label.action.generate.keys=Generar Claves
+label.action.generate.keys.processing=Generar claves ....
+label.action.lock.account=Bloqueo de cuenta
+label.action.lock.account.processing=Bloqueo de cuenta ....
 label.action.manage.cluster=gestionar racimo
 label.action.manage.cluster.processing=La gesti\u00c3\u00b3n de cl\u00c3\u00basteres ....
 label.action.migrate.instance=Migrar Instancia
@@ -166,650 +167,650 @@ label.action.migrate.router=migrar Router
 label.action.migrate.router.processing=Migraci\u00c3\u00b3n router ....
 label.action.migrate.systemvm=Migrar del sistema VM
 label.action.migrate.systemvm.processing=La migraci\u00c3\u00b3n de VM del sistema ....
-label.action.reboot.instance.processing=Reiniciar Instancia .... 
-label.action.reboot.instance=Reiniciar Instancia 
-label.action.reboot.router.processing=Reiniciar router .... 
-label.action.reboot.router=Reiniciar router 
-label.action.reboot.systemvm.processing=reinicio del sistema VM .... 
-label.action.reboot.systemvm=Reiniciar sistema VM 
-label.action.recurring.snapshot=recurrente instant\u00c3\u00a1neas 
-label.action.release.ip=estreno IP 
-label.action.release.ip.processing=Liberar IP .... 
-label.action.remove.host.processing=Extracci\u00c3\u00b3n de host .... 
-label.action.remove.host=Quitar host 
-label.action.reset.password.processing=Restablecimiento de la contrase\u00c3\u00b1a .... 
-label.action.reset.password=Restablecer contrase\u00c3\u00b1a 
-label.action.resource.limits=Recursos l\u00c3\u00admites 
-label.action.restore.instance.processing=Restaurar Instancia .... 
-label.action.restore.instance=Restaurar Instancia 
-label.actions=Acciones 
-label.action.start.instance=Iniciar Instancia 
-label.action.start.instance.processing=A partir Instancia .... 
-label.action.start.router=inicio del router 
-label.action.start.router.processing=A partir del router .... 
-label.action.start.systemvm=Inicio del sistema VM 
-label.action.start.systemvm.processing=A partir del sistema VM .... 
-label.action.stop.instance=Detener Instancia 
-label.action.stop.instance.processing=Detener Instancia .... 
-label.action.stop.router=Detener router 
-label.action.stop.router.processing=Detener router .... 
-label.action.stop.systemvm=parada del sistema VM 
-label.action.stop.systemvm.processing=Detener sistema VM .... 
-label.action.take.snapshot.processing=Tomar instant\u00c3\u00a1neas .... 
-label.action.take.snapshot=Tomar instant\u00c3\u00a1nea 
+label.action.reboot.instance.processing=Reiniciar Instancia ....
+label.action.reboot.instance=Reiniciar Instancia
+label.action.reboot.router.processing=Reiniciar router ....
+label.action.reboot.router=Reiniciar router
+label.action.reboot.systemvm.processing=reinicio del sistema VM ....
+label.action.reboot.systemvm=Reiniciar sistema VM
+label.action.recurring.snapshot=recurrente instant\u00c3\u00a1neas
+label.action.release.ip=estreno IP
+label.action.release.ip.processing=Liberar IP ....
+label.action.remove.host.processing=Extracci\u00c3\u00b3n de host ....
+label.action.remove.host=Quitar host
+label.action.reset.password.processing=Restablecimiento de la contrase\u00c3\u00b1a ....
+label.action.reset.password=Restablecer contrase\u00c3\u00b1a
+label.action.resource.limits=Recursos l\u00c3\u00admites
+label.action.restore.instance.processing=Restaurar Instancia ....
+label.action.restore.instance=Restaurar Instancia
+label.actions=Acciones
+label.action.start.instance=Iniciar Instancia
+label.action.start.instance.processing=A partir Instancia ....
+label.action.start.router=inicio del router
+label.action.start.router.processing=A partir del router ....
+label.action.start.systemvm=Inicio del sistema VM
+label.action.start.systemvm.processing=A partir del sistema VM ....
+label.action.stop.instance=Detener Instancia
+label.action.stop.instance.processing=Detener Instancia ....
+label.action.stop.router=Detener router
+label.action.stop.router.processing=Detener router ....
+label.action.stop.systemvm=parada del sistema VM
+label.action.stop.systemvm.processing=Detener sistema VM ....
+label.action.take.snapshot.processing=Tomar instant\u00c3\u00a1neas ....
+label.action.take.snapshot=Tomar instant\u00c3\u00a1nea
 label.action.unmanage.cluster.processing=Unmanaging Grupo ....
 label.action.unmanage.cluster=Unmanage racimo
-label.action.update.OS.preference=Actualizar OS Preferencia 
-label.action.update.OS.preference.processing=Actualizaci\u00c3\u00b3n de sistema operativo preferencia .... 
+label.action.update.OS.preference=Actualizar OS Preferencia
+label.action.update.OS.preference.processing=Actualizaci\u00c3\u00b3n de sistema operativo preferencia ....
 label.action.update.resource.count=Actualizaci\u00c3\u00b3n de recursos Conde
 label.action.update.resource.count.processing=Actualizaci\u00c3\u00b3n de Conde de recursos ....
-label.active.sessions=Sesiones activas 
-label.add.account=A\u00c3\u00b1adir cuenta 
-label.add=Agregar 
-label.add.by.cidr=A\u00c3\u00b1adir Por CIDR 
-label.add.by.group=A\u00c3\u00b1adir Por el Grupo de 
-label.add.cluster=A\u00c3\u00b1adir Grupo 
-label.add.direct.iprange=A\u00c3\u00b1adir Direct IP Gama 
-label.add.disk.offering=A\u00c3\u00b1adir disco Ofrenda 
-label.add.domain=Agregar dominio 
-label.add.firewall=Agregar Servidor de seguridad 
-label.add.host=Agregar host 
-label.adding=Agregar 
-label.adding.cluster=Adici\u00c3\u00b3n de cl\u00c3\u00baster 
-label.adding.failed=No se pudo agregar 
-label.adding.pod=Agregar Pod 
-label.adding.processing=A\u00c3\u00b1adir .... 
-label.add.ingress.rule=A\u00c3\u00b1adir regla del ingreso 
-label.adding.succeeded=Agregar Sucesor 
-label.adding.user=Agregar usuario 
-label.adding.zone=Agregar la zona 
-label.add.ip.range=A\u00c3\u00b1adir Rango de IP 
-label.additional.networks=Redes adicional 
-label.add.load.balancer=A\u00c3\u00b1adir equilibrador de carga 
-label.add.more=A\u00c3\u00b1adir m\u00c3\u00a1s 
-label.add.network=Agregar sitios de red 
+label.active.sessions=Sesiones activas
+label.add.account=A\u00c3\u00b1adir cuenta
+label.add=Agregar
+label.add.by.cidr=A\u00c3\u00b1adir Por CIDR
+label.add.by.group=A\u00c3\u00b1adir Por el Grupo de
+label.add.cluster=A\u00c3\u00b1adir Grupo
+label.add.direct.iprange=A\u00c3\u00b1adir Direct IP Gama
+label.add.disk.offering=A\u00c3\u00b1adir disco Ofrenda
+label.add.domain=Agregar dominio
+label.add.firewall=Agregar Servidor de seguridad
+label.add.host=Agregar host
+label.adding=Agregar
+label.adding.cluster=Adici\u00c3\u00b3n de cl\u00c3\u00baster
+label.adding.failed=No se pudo agregar
+label.adding.pod=Agregar Pod
+label.adding.processing=A\u00c3\u00b1adir ....
+label.add.ingress.rule=A\u00c3\u00b1adir regla del ingreso
+label.adding.succeeded=Agregar Sucesor
+label.adding.user=Agregar usuario
+label.adding.zone=Agregar la zona
+label.add.ip.range=A\u00c3\u00b1adir Rango de IP
+label.additional.networks=Redes adicional
+label.add.load.balancer=A\u00c3\u00b1adir equilibrador de carga
+label.add.more=A\u00c3\u00b1adir m\u00c3\u00a1s
+label.add.network=Agregar sitios de red
 label.add.network.device=A\u00c3\u00b1adir dispositivo de red
-label.add.pod=A\u00c3\u00b1adir Pod 
-label.add.primary.storage=A\u00c3\u00b1adir Almacenamiento primario 
-label.add.secondary.storage=A\u00c3\u00b1adir secundaria almacenamiento 
-label.add.security.group=Agregar grupo de seguridad 
-label.add.service.offering=A\u00c3\u00b1adir Servicio de Oferta 
-label.add.template=A\u00c3\u00b1adir plantilla 
+label.add.pod=A\u00c3\u00b1adir Pod
+label.add.primary.storage=A\u00c3\u00b1adir Almacenamiento primario
+label.add.secondary.storage=A\u00c3\u00b1adir secundaria almacenamiento
+label.add.security.group=Agregar grupo de seguridad
+label.add.service.offering=A\u00c3\u00b1adir Servicio de Oferta
+label.add.template=A\u00c3\u00b1adir plantilla
 label.add.to.group=Agregar al grupo
-label.add.user=Agregar usuario 
-label.add.vlan=A\u00c3\u00b1adir VLAN 
-label.add.volume=A\u00c3\u00b1adir volumen 
-label.add.zone=A\u00c3\u00b1adir Zona 
-label.admin.accounts=Administrador de Cuentas 
-label.admin=Admin 
-label.advanced=Avanzado 
-label.advanced.mode=Modo avanzado 
-label.advanced.search=B\u00c3\u00basqueda Avanzada 
+label.add.user=Agregar usuario
+label.add.vlan=A\u00c3\u00b1adir VLAN
+label.add.volume=A\u00c3\u00b1adir volumen
+label.add.zone=A\u00c3\u00b1adir Zona
+label.admin.accounts=Administrador de Cuentas
+label.admin=Admin
+label.advanced=Avanzado
+label.advanced.mode=Modo avanzado
+label.advanced.search=B\u00c3\u00basqueda Avanzada
 label.alert=Alerta
-label.algorithm=Algoritmo 
-label.allocated=Asignados 
-label.api.key=clave de API 
-label.assign=Asignar 
-label.assign.to.load.balancer=instancia de Asignaci\u00c3\u00b3n de equilibrador de carga 
-label.associated.network.id=ID de red asociados 
-label.attached.iso=adjunta ISO 
-label.availability=Disponibilidad 
-label.availability.zone=Disponibilidad de la zona 
+label.algorithm=Algoritmo
+label.allocated=Asignados
+label.api.key=clave de API
+label.assign=Asignar
+label.assign.to.load.balancer=instancia de Asignaci\u00c3\u00b3n de equilibrador de carga
+label.associated.network.id=ID de red asociados
+label.attached.iso=adjunta ISO
+label.availability=Disponibilidad
+label.availability.zone=Disponibilidad de la zona
 label.available=Disponible
-label.available.public.ips=Disponible direcciones IP p\u00c3\u00bablicas 
-label.back=Volver 
-label.basic.mode=Modo b\u00c3\u00a1sico 
-label.bootable=arranque 
-label.broadcast.domain.type=Tipo de dominio de difusi\u00c3\u00b3n 
+label.available.public.ips=Disponible direcciones IP p\u00c3\u00bablicas
+label.back=Volver
+label.basic.mode=Modo b\u00c3\u00a1sico
+label.bootable=arranque
+label.broadcast.domain.type=Tipo de dominio de difusi\u00c3\u00b3n
 label.by.account=Por Cuenta
-label.by.availability=Por Disponibilidad 
+label.by.availability=Por Disponibilidad
 label.by.domain=Por dominio
 label.by.end.date=Por Fecha de finalizaci\u00c3\u00b3n
-label.by.level=por Nivel 
+label.by.level=por Nivel
 label.by.pod=Por Pod
-label.by.role=por funci\u00c3\u00b3n 
+label.by.role=por funci\u00c3\u00b3n
 label.by.start.date=Por Fecha de inicio
-label.by.state=Por Estado 
-label.bytes.received=Bytes recibidos 
-label.bytes.sent=Bytes enviados 
-label.by.traffic.type=Por tipo de tr\u00c3\u00a1fico 
+label.by.state=Por Estado
+label.bytes.received=Bytes recibidos
+label.bytes.sent=Bytes enviados
+label.by.traffic.type=Por tipo de tr\u00c3\u00a1fico
 label.by.type.id=Por tipo de identificaci\u00c3\u00b3n
-label.by.type=Por tipo 
+label.by.type=Por tipo
 label.by.zone=Por Zona
-label.cancel=Cancelar 
-label.certificate=Certificado 
-label.character=Personaje 
-label.cidr.account=CIDR o de cuenta / Grupo de Seguridad 
+label.cancel=Cancelar
+label.certificate=Certificado
+label.character=Personaje
+label.cidr.account=CIDR o de cuenta / Grupo de Seguridad
 label.cidr=CIDR
 label.cidr.list=fuente CIDR
-label.close=Cerrar 
-label.cloud.console=Cloud Management Console 
-label.cloud.managed=Cloud.com Gestionado 
-label.cluster=Grupo 
-label.cluster.type=Tipo de Cluster Server 
+label.close=Cerrar
+label.cloud.console=Cloud Management Console
+label.cloud.managed=Cloud.com Gestionado
+label.cluster=Grupo
+label.cluster.type=Tipo de Cluster Server
 label.clvm=CLVM
-label.code=C\u00c3\u00b3digo 
-label.configuration=Configuraci\u00c3\u00b3n 
+label.code=C\u00c3\u00b3digo
+label.configuration=Configuraci\u00c3\u00b3n
 label.confirmation=Confirmation
-label.congratulations=Felicitaciones \! 
+label.congratulations=Felicitaciones \!
 label.cpu.allocated=CPU asignado
 label.cpu.allocated.for.VMs=CPU asignado para m\u00c3\u00a1quinas virtuales
 label.CPU.cap=CPU Cap
-label.cpu=CPU 
+label.cpu=CPU
 label.cpu.utilized=CPU Utilizado
-label.created=creaci\u00c3\u00b3n 
-label.cross.zones=Cruz Zonas 
-label.custom.disk.size=Personal Disk Size 
-label.daily=diario 
+label.created=creaci\u00c3\u00b3n
+label.cross.zones=Cruz Zonas
+label.custom.disk.size=Personal Disk Size
+label.daily=diario
 label.data.disk.offering=Datos Disco Offering
-label.date=Fecha 
-label.day.of.month=D\u00c3\u00ada del mes 
-label.day.of.week=d\u00c3\u00ada de la semana 
+label.date=Fecha
+label.day.of.month=D\u00c3\u00ada del mes
+label.day.of.week=d\u00c3\u00ada de la semana
 label.default.use=Usar por defecto
-label.delete=Eliminar 
-label.deleting.failed=No se pudo eliminar 
-label.deleting.processing=Eliminar .... 
-label.description=Descripci\u00c3\u00b3n 
-label.destroy=Destroy 
-label.detaching.disk=Extracci\u00c3\u00b3n del disco 
-label.details=Detalles 
-label.device.id=ID de dispositivo 
+label.delete=Eliminar
+label.deleting.failed=No se pudo eliminar
+label.deleting.processing=Eliminar ....
+label.description=Descripci\u00c3\u00b3n
+label.destroy=Destroy
+label.detaching.disk=Extracci\u00c3\u00b3n del disco
+label.details=Detalles
+label.device.id=ID de dispositivo
 label.DHCP.server.type=Tipo de servidor DHCP
-label.disabled=personas de movilidad reducida 
-label.disabling.vpn.access=Desactivaci\u00c3\u00b3n de VPN de acceso 
-label.disk.allocated=disco asignado 
-label.disk.offering=disco Ofrenda 
-label.disk.size.gb=tama\u00c3\u00b1o de disco (en GB) 
-label.disk.size=tama\u00c3\u00b1o de disco 
-label.disk.total=disco Total 
-label.disk.volume=volumen de disco 
-label.display.text=visualizaci\u00c3\u00b3n de texto 
-label.dns.1=DNS 1 
-label.dns.2=DNS 2 
-label.domain.admin=Administrador de dominio 
-label.domain=dominio 
-label.domain.id=ID de dominio 
-label.domain.name=Nombre de dominio 
+label.disabled=personas de movilidad reducida
+label.disabling.vpn.access=Desactivaci\u00c3\u00b3n de VPN de acceso
+label.disk.allocated=disco asignado
+label.disk.offering=disco Ofrenda
+label.disk.size.gb=tama\u00c3\u00b1o de disco (en GB)
+label.disk.size=tama\u00c3\u00b1o de disco
+label.disk.total=disco Total
+label.disk.volume=volumen de disco
+label.display.text=visualizaci\u00c3\u00b3n de texto
+label.dns.1=DNS 1
+label.dns.2=DNS 2
+label.domain.admin=Administrador de dominio
+label.domain=dominio
+label.domain.id=ID de dominio
+label.domain.name=Nombre de dominio
 label.domain.suffix=DNS sufijo de dominio (es decir, xyz.com)
-label.double.quotes.are.not.allowed=comillas dobles no se permite 
+label.double.quotes.are.not.allowed=comillas dobles no se permite
 label.download.progress=Progreso de la descarga
-label.edit=Editar 
-label.email=correo electr\u00c3\u00b3nico 
-label.enabling.vpn.access=Habilitaci\u00c3\u00b3n de Acceso VPN 
-label.enabling.vpn=Habilitaci\u00c3\u00b3n VPN 
-label.endpoint.or.operation=punto final o de Operaci\u00c3\u00b3n 
-label.end.port=Puerto final 
-label.error.code=C\u00c3\u00b3digo de error 
-label.error=Error 
-label.esx.host=ESX / ESXi anfitri\u00c3\u00b3n 
-label.example=Ejemplo 
-label.failed=Error 
-label.featured=destacados 
-label.firewall=Servidor de seguridad 
-label.first.name=Nombre 
-label.format=Formato 
-label.friday=Viernes 
+label.edit=Editar
+label.email=correo electr\u00c3\u00b3nico
+label.enabling.vpn.access=Habilitaci\u00c3\u00b3n de Acceso VPN
+label.enabling.vpn=Habilitaci\u00c3\u00b3n VPN
+label.endpoint.or.operation=punto final o de Operaci\u00c3\u00b3n
+label.end.port=Puerto final
+label.error.code=C\u00c3\u00b3digo de error
+label.error=Error
+label.esx.host=ESX / ESXi anfitri\u00c3\u00b3n
+label.example=Ejemplo
+label.failed=Error
+label.featured=destacados
+label.firewall=Servidor de seguridad
+label.first.name=Nombre
+label.format=Formato
+label.friday=Viernes
 label.full=completo
-label.gateway=puerta de enlace 
-label.general.alerts=General de Alertas 
-label.generating.url=Generar URL 
-label.go.step.2=Ir al paso 2 
-label.go.step.3=Ir al paso 3 
-label.go.step.4=Ir al paso 4 
-label.go.step.5=Ir al paso 5 
-label.group=Grupo 
-label.group.optional=Grupo (Opcional) 
-label.guest.cidr=Habitaci\u00c3\u00b3n CIDR 
-label.guest.gateway=Habitaci\u00c3\u00b3n Gateway 
-label.guest.ip=Habitaci\u00c3\u00b3n direcci\u00c3\u00b3n IP 
-label.guest.ip.range=Habitaci\u00c3\u00b3n Rango de IP 
-label.guest.netmask=Habitaci\u00c3\u00b3n m\u00c3\u00a1scara de red 
-label.ha.enabled=HA Activado 
-label.help=Ayuda 
+label.gateway=puerta de enlace
+label.general.alerts=General de Alertas
+label.generating.url=Generar URL
+label.go.step.2=Ir al paso 2
+label.go.step.3=Ir al paso 3
+label.go.step.4=Ir al paso 4
+label.go.step.5=Ir al paso 5
+label.group=Grupo
+label.group.optional=Grupo (Opcional)
+label.guest.cidr=Habitaci\u00c3\u00b3n CIDR
+label.guest.gateway=Habitaci\u00c3\u00b3n Gateway
+label.guest.ip=Habitaci\u00c3\u00b3n direcci\u00c3\u00b3n IP
+label.guest.ip.range=Habitaci\u00c3\u00b3n Rango de IP
+label.guest.netmask=Habitaci\u00c3\u00b3n m\u00c3\u00a1scara de red
+label.ha.enabled=HA Activado
+label.help=Ayuda
 label.hide.ingress.rule=Ocultar el art\u00c3\u00adculo ingreso
-label.host.alerts=Host Alertas 
-label.host=Ej\u00c3\u00a9rcitos  
-label.host.name=nombre de host 
-label.hosts=Ej\u00c3\u00a9rcitos 
-label.hourly=por hora 
-label.hypervisor=Hypervisor 
-label.hypervisor.type=Tipo Hypervisor 
-label.id=ID 
-label.info=Informaci\u00c3\u00b3n 
-label.ingress.rule=ingreso Regla 
-label.initiated.by=Iniciado por 
-label.installWizard.click.launch=Click en el bot\u00f3n de lanzar. 
-label.instance=Instancia 
-label.instance.limits=Instancia L\u00c3\u00admites 
-label.instance.name=Nombre de instancia 
-label.instances=Instancias 
-label.internal.dns.1=DNS interno una 
-label.internal.dns.2=DNS interno 2 
-label.interval.type=Tipo de intervalo 
-label.invalid.integer=entero no v\u00c3\u00a1lido 
-label.invalid.number=N\u00c3\u00bamero no v\u00c3\u00a1lido 
+label.host.alerts=Host Alertas
+label.host=Ej\u00c3\u00a9rcitos
+label.host.name=nombre de host
+label.hosts=Ej\u00c3\u00a9rcitos
+label.hourly=por hora
+label.hypervisor=Hypervisor
+label.hypervisor.type=Tipo Hypervisor
+label.id=ID
+label.info=Informaci\u00c3\u00b3n
+label.ingress.rule=ingreso Regla
+label.initiated.by=Iniciado por
+label.installWizard.click.launch=Click en el bot\u00f3n de lanzar.
+label.instance=Instancia
+label.instance.limits=Instancia L\u00c3\u00admites
+label.instance.name=Nombre de instancia
+label.instances=Instancias
+label.internal.dns.1=DNS interno una
+label.internal.dns.2=DNS interno 2
+label.interval.type=Tipo de intervalo
+label.invalid.integer=entero no v\u00c3\u00a1lido
+label.invalid.number=N\u00c3\u00bamero no v\u00c3\u00a1lido
 label.invite=Invitar
 label.invite.to=Invitar a .
-label.ip.address=Direcci\u00c3\u00b3n IP 
-label.ipaddress=Direcci\u00c3\u00b3n IP 
-label.ip.allocations=IP asignaciones 
-label.ip=IP 
-label.ip.limits=IP p\u00c3\u00bablica L\u00c3\u00admites 
-label.ip.or.fqdn=IP o FQDN 
-label.ip.range=Rango de IP 
-label.ips=IP 
-label.iscsi=iSCSI 
-label.is.default=Es por defecto 
-label.iso.boot=ISO de arranque 
-label.iso=ISO 
+label.ip.address=Direcci\u00c3\u00b3n IP
+label.ipaddress=Direcci\u00c3\u00b3n IP
+label.ip.allocations=IP asignaciones
+label.ip=IP
+label.ip.limits=IP p\u00c3\u00bablica L\u00c3\u00admites
+label.ip.or.fqdn=IP o FQDN
+label.ip.range=Rango de IP
+label.ips=IP
+label.iscsi=iSCSI
+label.is.default=Es por defecto
+label.iso.boot=ISO de arranque
+label.iso=ISO
 label.isolation.mode=modo de aislamiento
 label.is.redundant.router=redundante
-label.is.shared=es compartido 
-label.is.system=es el Sistema 
-label.keep=Mantener 
-label.lang.chinese=Chino (simplificado) 
-label.lang.english=Ingl\u00c3\u00a9s 
-label.lang.japanese=japon\u00c3\u00a9s 
-label.lang.spanish=Espa\u00c3\u00b1ol 
-label.last.disconnected=\u00c3\u009altima Desconectado 
-label.last.name=Apellido 
+label.is.shared=es compartido
+label.is.system=es el Sistema
+label.keep=Mantener
+label.lang.chinese=Chino (simplificado)
+label.lang.english=Ingl\u00c3\u00a9s
+label.lang.japanese=japon\u00c3\u00a9s
+label.lang.spanish=Espa\u00c3\u00b1ol
+label.last.disconnected=\u00c3\u009altima Desconectado
+label.last.name=Apellido
 label.launch=Lanzar
 label.launch.vm=Lanzar maquina virtual
-label.level=Nivel 
-label.load.balancer=equilibrador de carga 
-label.loading=Carga 
-label.local=local 
-label.login=Login 
-label.logout=Cerrar sesi\u00c3\u00b3n 
-label.lun=LUN 
-label.manage=Administrar 
-label.maximum=m\u00c3\u00a1ximo 
+label.level=Nivel
+label.load.balancer=equilibrador de carga
+label.loading=Carga
+label.local=local
+label.login=Login
+label.logout=Cerrar sesi\u00c3\u00b3n
+label.lun=LUN
+label.manage=Administrar
+label.maximum=m\u00c3\u00a1ximo
 label.max.volumes=Maxima cantidad de Volumes
-label.memory.allocated=memoria asignada 
-label.memory=memoria (en MB) 
-label.memory.total=Total de memoria 
-label.memory.used=memoria usada 
+label.memory.allocated=memoria asignada
+label.memory=memoria (en MB)
+label.memory.total=Total de memoria
+label.memory.used=memoria usada
 label.menu.accounts=Cuentas
-label.menu.alerts=Alertas 
-label.menu.all.accounts=Todas las cuentas 
-label.menu.all.instances=todas las instancias 
-label.menu.community.isos=Comunidad ISOs 
-label.menu.community.templates=plantillas de la comunidad 
-label.menu.configuration=Configuraci\u00c3\u00b3n 
-label.menu.dashboard=Interfaz 
-label.menu.destroyed.instances=Destruir instancias 
-label.menu.disk.offerings=disco ofertas 
-label.menu.domains=dominio 
-label.menu.events=Eventos 
-label.menu.featured.isos=destacados ISO 
-label.menu.featured.templates=destacados plantillas 
-label.menu.global.settings=Configuraci\u00c3\u00b3n global 
-label.menu.instances=Instancias 
-label.menu.ipaddresses=Direcciones IP 
-label.menu.isos=ISO 
-label.menu.my.accounts=Mis cuentas 
-label.menu.my.instances=Mi instancias 
-label.menu.my.isos=Mi ISOs 
-label.menu.my.templates=Mis plantillas 
-label.menu.network.offerings=Red de ofertas 
-label.menu.network=Red 
-label.menu.physical.resources=Recursos F\u00c3\u00adsicos 
-label.menu.running.instances=Ejecuci\u00c3\u00b3n de instancias 
-label.menu.security.groups=Grupos de seguridad 
-label.menu.service.offerings=Ofertas de Servicios 
-label.menu.snapshots=instant\u00c3\u00a1neas 
-label.menu.stopped.instances=Detenido instancias 
-label.menu.storage=Almacenamiento 
-label.menu.system=Sistema 
-label.menu.system.vms=Sistema de m\u00c3\u00a1quinas virtuales 
-label.menu.templates=plantillas 
-label.menu.virtual.appliances=Virtual Appliances 
-label.menu.virtual.resources=Virtual de Recursos 
-label.menu.volumes=Vol\u00c3\u00bamenes 
+label.menu.alerts=Alertas
+label.menu.all.accounts=Todas las cuentas
+label.menu.all.instances=todas las instancias
+label.menu.community.isos=Comunidad ISOs
+label.menu.community.templates=plantillas de la comunidad
+label.menu.configuration=Configuraci\u00c3\u00b3n
+label.menu.dashboard=Interfaz
+label.menu.destroyed.instances=Destruir instancias
+label.menu.disk.offerings=disco ofertas
+label.menu.domains=dominio
+label.menu.events=Eventos
+label.menu.featured.isos=destacados ISO
+label.menu.featured.templates=destacados plantillas
+label.menu.global.settings=Configuraci\u00c3\u00b3n global
+label.menu.instances=Instancias
+label.menu.ipaddresses=Direcciones IP
+label.menu.isos=ISO
+label.menu.my.accounts=Mis cuentas
+label.menu.my.instances=Mi instancias
+label.menu.my.isos=Mi ISOs
+label.menu.my.templates=Mis plantillas
+label.menu.network.offerings=Red de ofertas
+label.menu.network=Red
+label.menu.physical.resources=Recursos F\u00c3\u00adsicos
+label.menu.running.instances=Ejecuci\u00c3\u00b3n de instancias
+label.menu.security.groups=Grupos de seguridad
+label.menu.service.offerings=Ofertas de Servicios
+label.menu.snapshots=instant\u00c3\u00a1neas
+label.menu.stopped.instances=Detenido instancias
+label.menu.storage=Almacenamiento
+label.menu.system=Sistema
+label.menu.system.vms=Sistema de m\u00c3\u00a1quinas virtuales
+label.menu.templates=plantillas
+label.menu.virtual.appliances=Virtual Appliances
+label.menu.virtual.resources=Virtual de Recursos
+label.menu.volumes=Vol\u00c3\u00bamenes
 label.migrate.instance.to.host=Migrar instancia a otro host.
 label.migrate.instance.to=Migraci\u00c3\u00b3n de ejemplo para
 label.migrate.instance.to.ps=Migrar instancia a otro primary storage.
 label.migrate.router.to=Router para migrar
 label.migrate.systemvm.to=Migrar m\u00c3\u00a1quina virtual del sistema para
-label.minimum=M\u00c3\u00adnimo 
-label.minute.past.hour=Minuto (s) despu\u00c3\u00a9s de la hora 
-label.monday=lunes 
-label.monthly=mensual 
-label.more.templates=plantillas \= M\u00c3\u00a1s 
-label.my.account=Mi Cuenta 
+label.minimum=M\u00c3\u00adnimo
+label.minute.past.hour=Minuto (s) despu\u00c3\u00a9s de la hora
+label.monday=lunes
+label.monthly=mensual
+label.more.templates=plantillas \= M\u00c3\u00a1s
+label.my.account=Mi Cuenta
 label.my.templates=Mis plantillas
-label.name=Nombre 
-label.name.optional=Nombre (Opcional) 
-label.netmask=m\u00c3\u00a1scara de red 
-label.network.desc=Red de Desc 
+label.name=Nombre
+label.name.optional=Nombre (Opcional)
+label.netmask=m\u00c3\u00a1scara de red
+label.network.desc=Red de Desc
 label.network.device=De dispositivos de red
 label.network.device.type=Tipo de red de dispositivos
 label.network.domain=red de dominio
-label.network.id=ID de red 
-label.network.name=Nombre de red 
-label.network.offering.display.text=Red ofrece visualizaci\u00c3\u00b3n de texto 
-label.network.offering.id=Red ofrece ID 
-label.network.offering.name=Red ofrece Nombre 
-label.network.offering=Red ofrece 
-label.network.rate=Tasa de Red 
-label.network.read=Leer de la red 
-label.network=Red 
+label.network.id=ID de red
+label.network.name=Nombre de red
+label.network.offering.display.text=Red ofrece visualizaci\u00c3\u00b3n de texto
+label.network.offering.id=Red ofrece ID
+label.network.offering.name=Red ofrece Nombre
+label.network.offering=Red ofrece
+label.network.rate=Tasa de Red
+label.network.read=Leer de la red
+label.network=Red
 label.networks=Redes
-label.network.type=Tipo de red 
-label.network.write=Escribir en la red 
+label.network.type=Tipo de red
+label.network.write=Escribir en la red
 label.new=Nuevo
-label.new.password=Nueva contrase\u00c3\u00b1a 
+label.new.password=Nueva contrase\u00c3\u00b1a
 label.new.vm=Nueva maquina virtual
-label.next=Siguiente 
-label.nfs=NFS 
-label.nfs.server=servidor NFS 
-label.nfs.storage=NFS Almacenamiento 
-label.nics=NIC 
-label.no.actions=No Acciones disponibles 
-label.no.alerts=No alertas recientes 
-label.no.errors=No recientes errores 
-label.no.isos=No ISOs disponibles 
-label.no.items=No art\u00c3\u00adculos disponibles 
+label.next=Siguiente
+label.nfs=NFS
+label.nfs.server=servidor NFS
+label.nfs.storage=NFS Almacenamiento
+label.nics=NIC
+label.no.actions=No Acciones disponibles
+label.no.alerts=No alertas recientes
+label.no.errors=No recientes errores
+label.no.isos=No ISOs disponibles
+label.no.items=No art\u00c3\u00adculos disponibles
 label.none=Ninguno
-label.no=No 
-label.no.security.groups=No hay grupos disponibles de Seguridad 
+label.no=No
+label.no.security.groups=No hay grupos disponibles de Seguridad
 label.not.found=No se ha encontrado
-label.no.thanks=No, gracias 
-label.num.cpu.cores=n\u00c3\u00bamero de n\u00c3\u00bacleos de CPU 
+label.no.thanks=No, gracias
+label.num.cpu.cores=n\u00c3\u00bamero de n\u00c3\u00bacleos de CPU
 label.numretries=N\u00c3\u00bamero de reintentos
 label.ocfs2=OCFS2
-label.offer.ha=Oferta HA 
-label.optional=Opcional 
-label.os.preference=OS Preferencia 
-label.os.type=tipo de Sistema Operativo 
-label.owned.public.ips=propiedad p\u00c3\u00bablica Direcciones IP 
-label.owner.account=titular de la cuenta 
-label.parent.domain=Padres de dominio 
-label.password=Contrase\u00c3\u00b1a 
-label.password.enabled=Contrase\u00c3\u00b1a Activado 
-label.path=Ruta 
+label.offer.ha=Oferta HA
+label.optional=Opcional
+label.os.preference=OS Preferencia
+label.os.type=tipo de Sistema Operativo
+label.owned.public.ips=propiedad p\u00c3\u00bablica Direcciones IP
+label.owner.account=titular de la cuenta
+label.parent.domain=Padres de dominio
+label.password=Contrase\u00c3\u00b1a
+label.password.enabled=Contrase\u00c3\u00b1a Activado
+label.path=Ruta
 label.PING.CIFS.password=PING CIFS contrase\u00c3\u00b1a
 label.PING.CIFS.username=PING CIFS nombre de usuario
 label.PING.dir=PING Directorio
 label.PING.storage.IP=PING almacenamiento IP
-label.please.wait=Por favor espere 
-label.pod=Pod 
-label.port.forwarding=Port Forwarding 
-label.port.range=rango de puertos 
+label.please.wait=Por favor espere
+label.pod=Pod
+label.port.forwarding=Port Forwarding
+label.port.range=rango de puertos
 label.PreSetup=PreSetup
-label.prev=Anterior 
+label.prev=Anterior
 label.previous=Previo
-label.primary.allocated=primaria asignado de almacenamiento 
-label.primary.network=Red Primaria 
-label.primary.storage=Almacenamiento Primario 
-label.primary.used=Primaria Almacenado 
-label.private.interface=Interfaz privada 
-label.private.ip=direcci\u00c3\u00b3n IP privada 
-label.private.ip.range=IP privada Gama 
-label.private.ips=direcciones IP privadas 
+label.primary.allocated=primaria asignado de almacenamiento
+label.primary.network=Red Primaria
+label.primary.storage=Almacenamiento Primario
+label.primary.used=Primaria Almacenado
+label.private.interface=Interfaz privada
+label.private.ip=direcci\u00c3\u00b3n IP privada
+label.private.ip.range=IP privada Gama
+label.private.ips=direcciones IP privadas
 label.privatekey=PKCS\#8 la clave privada
-label.private.port=Puerto privado 
-label.private.zone=Zona Privada 
+label.private.port=Puerto privado
+label.private.zone=Zona Privada
 label.project.name=Nombre del Proyecto
-label.protocol=Protocolo 
-label.public.interface=interfaz p\u00c3\u00bablica 
-label.public.ip=direcci\u00c3\u00b3n IP p\u00c3\u00bablica 
-label.public.ips=direcciones IP p\u00c3\u00bablicas 
-label.public.port=Puerto P\u00c3\u00bablico 
-label.public=P\u00c3\u00bablica 
-label.public.zone=Zona P\u00c3\u00bablica 
+label.protocol=Protocolo
+label.public.interface=interfaz p\u00c3\u00bablica
+label.public.ip=direcci\u00c3\u00b3n IP p\u00c3\u00bablica
+label.public.ips=direcciones IP p\u00c3\u00bablicas
+label.public.port=Puerto P\u00c3\u00bablico
+label.public=P\u00c3\u00bablica
+label.public.zone=Zona P\u00c3\u00bablica
 label.Pxe.server.type=Tipo de servidor Pxe
-label.reboot=Reiniciar 
-label.recent.errors=recientes errores 
+label.reboot=Reiniciar
+label.recent.errors=recientes errores
 label.redundant.router=enrutador redundante
-label.refresh=Actualizar 
-label.related=relacionados 
-label.remind.later=Recordar mas tarde 
-label.remove.from.load.balancer=ejemplo Eliminaci\u00c3\u00b3n de equilibrador de carga 
+label.refresh=Actualizar
+label.related=relacionados
+label.remind.later=Recordar mas tarde
+label.remove.from.load.balancer=ejemplo Eliminaci\u00c3\u00b3n de equilibrador de carga
 label.removing=Borrando.
-label.removing.user=Eliminar usuario 
-label.required=Requerido 
-label.reserved.system.ip=Reservados sistema de PI 
-label.resource.limits=L\u00c3\u00admites de Recursos 
-label.resource=Recursos 
-label.resources=Recursos 
-label.role=Papel 
+label.removing.user=Eliminar usuario
+label.required=Requerido
+label.reserved.system.ip=Reservados sistema de PI
+label.resource.limits=L\u00c3\u00admites de Recursos
+label.resource=Recursos
+label.resources=Recursos
+label.role=Papel
 label.root.disk.offering=Root Disco Offering
-label.running.vms=Ejecuci\u00c3\u00b3n de m\u00c3\u00a1quinas virtuales 
-label.s3.secret_key=clave secreta 
-label.saturday=s\u00c3\u00a1bado 
-label.save=Guardar 
-label.saving.processing=ahorro .... 
-label.scope=Alcance 
-label.search=Buscar 
-label.secondary.storage=Almacenamiento secundario 
-label.secondary.used=Secundaria Almacenado 
-label.secret.key=clave secreta 
-label.security.group=Grupo de Seguridad 
-label.security.group.name=Nombre de grupo de seguridad 
+label.running.vms=Ejecuci\u00c3\u00b3n de m\u00c3\u00a1quinas virtuales
+label.s3.secret_key=clave secreta
+label.saturday=s\u00c3\u00a1bado
+label.save=Guardar
+label.saving.processing=ahorro ....
+label.scope=Alcance
+label.search=Buscar
+label.secondary.storage=Almacenamiento secundario
+label.secondary.used=Secundaria Almacenado
+label.secret.key=clave secreta
+label.security.group=Grupo de Seguridad
+label.security.group.name=Nombre de grupo de seguridad
 label.security.groups.enabled=Los grupos de seguridad habilitado
-label.security.groups=Grupos de seguridad 
+label.security.groups=Grupos de seguridad
 label.select.a.zone=Seleccione una zona.
-label.sent=Enviados 
-label.server=Servidor 
-label.service.offering=Oferta de Servicio 
+label.sent=Enviados
+label.server=Servidor
+label.service.offering=Oferta de Servicio
 label.session.expired=Session Caducado
-label.shared=compartidas 
-label.SharedMountPoint=SharedMountPoint 
+label.shared=compartidas
+label.SharedMountPoint=SharedMountPoint
 label.show.ingress.rule=Mostrar la regla del ingreso
-label.size=Tama\u00c3\u00b1o 
-label.snapshot=Instant\u00c3\u00a1nea 
-label.snapshot.limits=instant\u00c3\u00a1neas L\u00c3\u00admites 
-label.snapshot.name=Nombre de instant\u00c3\u00a1neas 
-label.snapshot.schedule=Lista de instant\u00c3\u00a1neas 
-label.snapshot.s=Instant\u00c3\u00a1nea (s) 
-label.snapshots=instant\u00c3\u00a1neas 
-label.source.nat=NAT Fuente 
-label.specify.vlan=Especifique VLAN 
+label.size=Tama\u00c3\u00b1o
+label.snapshot=Instant\u00c3\u00a1nea
+label.snapshot.limits=instant\u00c3\u00a1neas L\u00c3\u00admites
+label.snapshot.name=Nombre de instant\u00c3\u00a1neas
+label.snapshot.schedule=Lista de instant\u00c3\u00a1neas
+label.snapshot.s=Instant\u00c3\u00a1nea (s)
+label.snapshots=instant\u00c3\u00a1neas
+label.source.nat=NAT Fuente
+label.specify.vlan=Especifique VLAN
 label.SR.name = SR Nombre de etiqueta
-label.start.port=Iniciar Puerto 
-label.state=Estado 
-label.static.nat=NAT est\u00c3\u00a1tica 
-label.static.nat.to=est\u00c3\u00a1tico NAT para 
-label.statistics=Estad\u00c3\u00adsticas 
-label.status=Estado 
-label.step.1=Paso 1 
-label.step.1.title=Paso 1\: <strong> Seleccione una plantilla </strong> 
-label.step.2=Paso 2 
-label.step.2.title=Paso 2\: <strong> Oferta de Servicio </strong> 
-label.step.3=Paso 3 
-label.step.3.title=Paso 3\: <strong id\="step3_label"> Seleccione un disco Ofrenda </strong> 
-label.step.4=Paso 4 
-label.step.4.title=Paso 4\: <strong> Red </strong> 
-label.step.5=Paso 5 
-label.step.5.title=Paso 5\: Revisi\u00c3\u00b3n <strong> </strong> 
-label.sticky.domain=dominio 
+label.start.port=Iniciar Puerto
+label.state=Estado
+label.static.nat=NAT est\u00c3\u00a1tica
+label.static.nat.to=est\u00c3\u00a1tico NAT para
+label.statistics=Estad\u00c3\u00adsticas
+label.status=Estado
+label.step.1=Paso 1
+label.step.1.title=Paso 1\: <strong> Seleccione una plantilla </strong>
+label.step.2=Paso 2
+label.step.2.title=Paso 2\: <strong> Oferta de Servicio </strong>
+label.step.3=Paso 3
+label.step.3.title=Paso 3\: <strong id\="step3_label"> Seleccione un disco Ofrenda </strong>
+label.step.4=Paso 4
+label.step.4.title=Paso 4\: <strong> Red </strong>
+label.step.5=Paso 5
+label.step.5.title=Paso 5\: Revisi\u00c3\u00b3n <strong> </strong>
+label.sticky.domain=dominio
 label.sticky.mode=modo
-label.stop=Detener 
-label.stopped.vms=Detenido m\u00c3\u00a1quinas virtuales 
-label.storage=Almacenamiento 
+label.stop=Detener
+label.stopped.vms=Detenido m\u00c3\u00a1quinas virtuales
+label.storage=Almacenamiento
 label.storage.tags=Etiquetas de almacenamiento
-label.storage.type=Tipo de almacenamiento 
-label.submit=Enviar 
-label.submitted.by=[Enviado por\: <span id\="submitted_by"> </span>] 
-label.succeeded=Sucesor 
-label.sunday=domingo 
-label.system.capacity=Capacidad de todo el sistema 
-label.system.vm=Sistema de VM 
-label.system.vms=Sistema de m\u00c3\u00a1quinas virtuales 
-label.system.vm.type=Tipo de sistema VM 
-label.tagged=etiqueta 
-label.tags=Etiquetas 
-label.target.iqn=Objetivo IQN 
-label.task.completed=Tarea finalizada. 
-label.template.limits=Plantilla L\u00c3\u00admites 
-label.template=plantilla 
+label.storage.type=Tipo de almacenamiento
+label.submit=Enviar
+label.submitted.by=[Enviado por\: <span id\="submitted_by"> </span>]
+label.succeeded=Sucesor
+label.sunday=domingo
+label.system.capacity=Capacidad de todo el sistema
+label.system.vm=Sistema de VM
+label.system.vms=Sistema de m\u00c3\u00a1quinas virtuales
+label.system.vm.type=Tipo de sistema VM
+label.tagged=etiqueta
+label.tags=Etiquetas
+label.target.iqn=Objetivo IQN
+label.task.completed=Tarea finalizada.
+label.template.limits=Plantilla L\u00c3\u00admites
+label.template=plantilla
 label.TFTP.dir=Directorio de TFTP
-label.theme.default=Tema Por Defecto 
+label.theme.default=Tema Por Defecto
 label.theme.grey=Personal - Gris
 label.theme.lightblue=Personal - Azul
-label.thursday=Jueves 
+label.thursday=Jueves
 label.timeout.in.second = Tiempo de espera (segundos)
-label.time=Tiempo 
-label.time.zone=Zona horaria 
-label.timezone=Zona horaria 
+label.time=Tiempo
+label.time.zone=Zona horaria
+label.timezone=Zona horaria
 label.total.cpu=Total CPU
 label.total.CPU=Total CPU
-label.total.vms=Total de m\u00c3\u00a1quinas virtuales 
-label.traffic.type=Tipo de Tr\u00c3\u00a1fico 
-label.tuesday=martes 
-label.type.id=Tipo de identificaci\u00c3\u00b3n 
-label.type=Tipo 
-label.unavailable=no disponible 
+label.total.vms=Total de m\u00c3\u00a1quinas virtuales
+label.traffic.type=Tipo de Tr\u00c3\u00a1fico
+label.tuesday=martes
+label.type.id=Tipo de identificaci\u00c3\u00b3n
+label.type=Tipo
+label.unavailable=no disponible
 label.unlimited=Unlimited
-label.untagged=sin etiquetar 
-label.updating=Actualizar 
+label.untagged=sin etiquetar
+label.updating=Actualizar
 label.url=URL
-label.usage.interface=Interfaz de uso 
-label.used=Usado 
-label.username=Nombre de usuario 
-label.users=usuario 
-label.user=Usuario 
-label.value=Valor 
-label.vcenter.cluster=vCenter cl\u00c3\u00baster 
-label.vcenter.datacenter=vCenter de centros de datos 
-label.vcenter.datastore=vCenter almac\u00c3\u00a9n de datos 
-label.vcenter.host=vCenter anfitri\u00c3\u00b3n 
-label.vcenter.password=vCenter Contrase\u00c3\u00b1a 
-label.vcenter.username=vCenter Nombre de usuario 
-label.version=Versi\u00c3\u00b3n 
-label.virtual.appliances=Virtual Appliances 
-label.virtual.appliance=Virtual Appliance 
+label.usage.interface=Interfaz de uso
+label.used=Usado
+label.username=Nombre de usuario
+label.users=usuario
+label.user=Usuario
+label.value=Valor
+label.vcenter.cluster=vCenter cl\u00c3\u00baster
+label.vcenter.datacenter=vCenter de centros de datos
+label.vcenter.datastore=vCenter almac\u00c3\u00a9n de datos
+label.vcenter.host=vCenter anfitri\u00c3\u00b3n
+label.vcenter.password=vCenter Contrase\u00c3\u00b1a
+label.vcenter.username=vCenter Nombre de usuario
+label.version=Versi\u00c3\u00b3n
+label.virtual.appliances=Virtual Appliances
+label.virtual.appliance=Virtual Appliance
 label.virtual.machines=Maquinas virtuales
-label.virtual.network=Red Virtual 
-label.vlan.id=ID de VLAN 
-label.vlan.range=VLAN Gama 
-label.vlan=VLAN 
-label.vm.add=A\u00c3\u00b1adir Instancia 
-label.vm.destroy=Destroy 
+label.virtual.network=Red Virtual
+label.vlan.id=ID de VLAN
+label.vlan.range=VLAN Gama
+label.vlan=VLAN
+label.vm.add=A\u00c3\u00b1adir Instancia
+label.vm.destroy=Destroy
 label.VMFS.datastore=VMFS de datos tienda
-label.vmfs=VMFS 
-label.vm.reboot=Reiniciar 
-label.vmsnapshot.type=Tipo 
-label.vm.start=Inicio 
-label.vm.stop=Detener 
-label.vms=VM 
+label.vmfs=VMFS
+label.vm.reboot=Reiniciar
+label.vmsnapshot.type=Tipo
+label.vm.start=Inicio
+label.vm.stop=Detener
+label.vms=VM
 label.volgroup=Volume Group
-label.volume.limits=l\u00c3\u00admites de volumen 
-label.volume.name=Nombre de Volumen 
-label.volumes=Vol\u00c3\u00bamenes 
-label.volume=Volumen 
-label.vpn=VPN 
-label.vsphere.managed=Gestionado \= vSphere 
-label.waiting=Esperando 
-label.warn=Advertir 
-label.wednesday=mi\u00c3\u00a9rcoles 
-label.weekly=Semanal 
-label.welcome=Bienvenido 
-label.welcome.cloud.console=Bienvenido a la consola de administraci\u00c3\u00b3n 
-label.yes=S\u00c3\u00ad 
-label.zone.id=Zona de identificaci\u00c3\u00b3n 
-label.zone.step.1.title=Paso 1\: <strong> Seleccione una red </strong> 
-label.zone.step.2.title=Paso 2\: <strong>A\u00c3\u00b1adir una zona </strong> 
-label.zone.step.3.title=Paso 3\: <strong>A\u00c3\u00b1adir una vaina </strong> 
-label.zone.step.4.title=Paso 4\: <strong>A\u00c3\u00b1adir un rango de IP </strong> 
-label.zone.wide=Zona para todo el 
+label.volume.limits=l\u00c3\u00admites de volumen
+label.volume.name=Nombre de Volumen
+label.volumes=Vol\u00c3\u00bamenes
+label.volume=Volumen
+label.vpn=VPN
+label.vsphere.managed=Gestionado \= vSphere
+label.waiting=Esperando
+label.warn=Advertir
+label.wednesday=mi\u00c3\u00a9rcoles
+label.weekly=Semanal
+label.welcome=Bienvenido
+label.welcome.cloud.console=Bienvenido a la consola de administraci\u00c3\u00b3n
+label.yes=S\u00c3\u00ad
+label.zone.id=Zona de identificaci\u00c3\u00b3n
+label.zone.step.1.title=Paso 1\: <strong> Seleccione una red </strong>
+label.zone.step.2.title=Paso 2\: <strong>A\u00c3\u00b1adir una zona </strong>
+label.zone.step.3.title=Paso 3\: <strong>A\u00c3\u00b1adir una vaina </strong>
+label.zone.step.4.title=Paso 4\: <strong>A\u00c3\u00b1adir un rango de IP </strong>
+label.zone.wide=Zona para todo el
 label.zone=Zona
 managed.state=Estado logr\u00c3\u00b3
-message.acquire.public.ip=Por favor seleccione una zona de la que desea adquirir su nueva IP. 
-message.action.cancel.maintenance.mode=Por favor, confirme que desea cancelar el mantenimiento 
+message.acquire.public.ip=Por favor seleccione una zona de la que desea adquirir su nueva IP.
+message.action.cancel.maintenance.mode=Por favor, confirme que desea cancelar el mantenimiento
 message.action.cancel.maintenance=Su acogida ha sido cancelado con \u00c3\u00a9xito para el mantenimiento. Este proceso puede tardar hasta varios minutos.
-message.action.delete.cluster=Por favor, confirme que desea eliminar del cl\u00c3\u00baster 
-message.action.delete.disk.offering=Por favor, confirme que desea eliminar ofreciendo disco 
-message.action.delete.domain=Por favor, confirme que desea eliminar de dominio 
+message.action.delete.cluster=Por favor, confirme que desea eliminar del cl\u00c3\u00baster
+message.action.delete.disk.offering=Por favor, confirme que desea eliminar ofreciendo disco
+message.action.delete.domain=Por favor, confirme que desea eliminar de dominio
 message.action.delete.external.firewall=Por favor, confirme que desea quitar este servidor de seguridad externo. Advertencia\: Si usted est\u00c3\u00a1 planeando volver a agregar el servidor de seguridad externo mismo, debe restablecer los datos de uso en el dispositivo.
 message.action.delete.external.load.balancer=Por favor, confirme que desea eliminar este equilibrador de carga externa. Advertencia\: Si usted est\u00c3\u00a1 planeando volver a agregar la misma equilibrador de carga externo, debe restablecer los datos de uso en el dispositivo.
-message.action.delete.ingress.rule=Por favor, confirme que desea eliminar la regla de ingreso 
-message.action.delete.ISO.for.all.zones=La ISO es utilizado por todas las zonas. Por favor, confirme que desea eliminar de todas las zonas. 
-message.action.delete.ISO=Por favor, confirme que desea eliminar la norma ISO 
-message.action.delete.network=Por favor, confirme que desea eliminar de la red 
-message.action.delete.pod=Por favor, confirme que desea eliminar de la vaina 
-message.action.delete.primary.storage=Por favor, confirme que desea eliminar el almacenamiento primario 
-message.action.delete.secondary.storage=Por favor, confirme que desea eliminar de almacenamiento secundario 
-message.action.delete.security.group=Por favor, confirme que desea eliminar el grupo de seguridad 
-message.action.delete.service.offering=Por favor, confirme que desea eliminar oferta de servicios 
+message.action.delete.ingress.rule=Por favor, confirme que desea eliminar la regla de ingreso
+message.action.delete.ISO.for.all.zones=La ISO es utilizado por todas las zonas. Por favor, confirme que desea eliminar de todas las zonas.
+message.action.delete.ISO=Por favor, confirme que desea eliminar la norma ISO
+message.action.delete.network=Por favor, confirme que desea eliminar de la red
+message.action.delete.pod=Por favor, confirme que desea eliminar de la vaina
+message.action.delete.primary.storage=Por favor, confirme que desea eliminar el almacenamiento primario
+message.action.delete.secondary.storage=Por favor, confirme que desea eliminar de almacenamiento secundario
+message.action.delete.security.group=Por favor, confirme que desea eliminar el grupo de seguridad
+message.action.delete.service.offering=Por favor, confirme que desea eliminar oferta de servicios
 message.action.delete.snapshot=Por favor, confirme que desea eliminar instant\u00c3\u00a1neas
-message.action.delete.template.for.all.zones=La plantilla es utilizada por todas las zonas. Por favor, confirme que desea eliminar de todas las zonas. 
-message.action.delete.template=Por favor, confirme que desea eliminar la plantilla 
-message.action.delete.volume=Por favor, confirme que desea eliminar el volumen 
-message.action.delete.zone=Por favor, confirme que desea eliminar la zona 
-message.action.destroy.instance=Por favor, confirme que desea destruir ejemplo 
+message.action.delete.template.for.all.zones=La plantilla es utilizada por todas las zonas. Por favor, confirme que desea eliminar de todas las zonas.
+message.action.delete.template=Por favor, confirme que desea eliminar la plantilla
+message.action.delete.volume=Por favor, confirme que desea eliminar el volumen
+message.action.delete.zone=Por favor, confirme que desea eliminar la zona
+message.action.destroy.instance=Por favor, confirme que desea destruir ejemplo
 message.action.destroy.systemvm=Por favor, confirme que desea destruir la m\u00c3\u00a1quina virtual del sistema.
 message.action.disable.cluster=Por favor, confirme que desea desactivar este grupo.
 message.action.disable.pod=Por favor, confirme que desea desactivar esta vaina.
-message.action.disable.static.NAT=Por favor, confirme que desea desactivar NAT est\u00c3\u00a1tica 
+message.action.disable.static.NAT=Por favor, confirme que desea desactivar NAT est\u00c3\u00a1tica
 message.action.disable.zone=Por favor, confirme que desea desactivar esta zona.
 message.action.enable.cluster=Por favor, confirme que desea habilitar este grupo.
 message.action.enable.maintenance=Su acogida ha sido preparado con \u00c3\u00a9xito para el mantenimiento. Este proceso puede tardar hasta varios minutos o m\u00c3\u00a1s dependiendo de c\u00c3\u00b3mo las m\u00c3\u00a1quinas virtuales se encuentran actualmente en este servidor.
-message.action.enable.pod=Por favor, confirme que desea habilitar esta vaina. 
-message.action.enable.zone=Por favor, confirme que desea habilitar esta zona. 
-message.action.force.reconnect=Por favor, confirme que desea forzar una reconexi\u00c3\u00b3n para el anfitri\u00c3\u00b3n 
-message.action.host.enable.maintenance.mode=mode \= mantenimiento de Habilitaci\u00c3\u00b3n provocar\u00c3\u00a1 una migraci\u00c3\u00b3n en vivo de todas las instancias que se ejecutan en el sistema para cualquier m\u00c3\u00a1quina disponible. 
+message.action.enable.pod=Por favor, confirme que desea habilitar esta vaina.
+message.action.enable.zone=Por favor, confirme que desea habilitar esta zona.
+message.action.force.reconnect=Por favor, confirme que desea forzar una reconexi\u00c3\u00b3n para el anfitri\u00c3\u00b3n
+message.action.host.enable.maintenance.mode=mode \= mantenimiento de Habilitaci\u00c3\u00b3n provocar\u00c3\u00a1 una migraci\u00c3\u00b3n en vivo de todas las instancias que se ejecutan en el sistema para cualquier m\u00c3\u00a1quina disponible.
 message.action.manage.cluster=Por favor, confirme que desea para administrar el cl\u00c3\u00baster.
-message.action.primarystorage.enable.maintenance.mode=Advertencia\: colocar el almacenamiento principal en modo de mantenimiento har\u00c3\u00a1 que todas las m\u00c3\u00a1quinas virtuales utilizando vol\u00c3\u00bamenes de que sea detenido. \u00c2\u00bfDesea continuar? 
-message.action.reboot.instance=Por favor, confirme que desea reiniciar el ejemplo 
-message.action.reboot.systemvm=Por favor, confirme que desea reiniciar el sistema VM 
-message.action.release.ip=Por favor, confirme que desea liberar IP 
+message.action.primarystorage.enable.maintenance.mode=Advertencia\: colocar el almacenamiento principal en modo de mantenimiento har\u00c3\u00a1 que todas las m\u00c3\u00a1quinas virtuales utilizando vol\u00c3\u00bamenes de que sea detenido. \u00c2\u00bfDesea continuar?
+message.action.reboot.instance=Por favor, confirme que desea reiniciar el ejemplo
+message.action.reboot.systemvm=Por favor, confirme que desea reiniciar el sistema VM
+message.action.release.ip=Por favor, confirme que desea liberar IP
 message.action.reset.password.off=Su ejemplo en la actualidad no es compatible con esta funci\u00c3\u00b3n.
 message.action.reset.password.warning=Su ejemplo debe ser detenido antes de intentar cambiar su contrase\u00c3\u00b1a actual.
-message.action.restore.instance=Por favor, confirme que desea restaurar ejemplo 
-message.action.start.instance=Por favor, confirme que desea iniciar la instancia 
-message.action.start.router=Por favor, confirme que desea iniciar router 
-message.action.start.systemvm=Por favor, confirme que desea iniciar el sistema VM 
-message.action.stop.instance=Por favor, confirme que desea detener la instancia 
-message.action.stop.systemvm=Por favor, confirme que desea detener sistema VM 
-message.action.take.snapshot=Por favor, confirme que desea tomar instant\u00c3\u00a1neas 
+message.action.restore.instance=Por favor, confirme que desea restaurar ejemplo
+message.action.start.instance=Por favor, confirme que desea iniciar la instancia
+message.action.start.router=Por favor, confirme que desea iniciar router
+message.action.start.systemvm=Por favor, confirme que desea iniciar el sistema VM
+message.action.stop.instance=Por favor, confirme que desea detener la instancia
+message.action.stop.systemvm=Por favor, confirme que desea detener sistema VM
+message.action.take.snapshot=Por favor, confirme que desea tomar instant\u00c3\u00a1neas
 message.action.unmanage.cluster=Por favor, confirme que desea unmanage del cl\u00c3\u00baster.
-message.add.cluster=A\u00c3\u00b1adir un hipervisor administradas por cl\u00c3\u00baster de <b> zona <span id\="zone_name"> </span> </b>, la consola de <b> <span id\="pod_name"> </span> </b> 
-message.add.cluster.zone=A\u00c3\u00b1adir un hipervisor administradas por cl\u00c3\u00baster de <b> zona <span id\="zone_name"> </span> </b> 
-message.add.disk.offering=Por favor, especifique los par\u00c3\u00a1metros siguientes para agregar un nuevo disco que ofrece 
-message.add.firewall=A\u00c3\u00b1adir un servidor de seguridad a la zona 
-message.add.host=Por favor, especifique los par\u00c3\u00a1metros siguientes para agregar un nuevo host 
-message.add.ip.range=A\u00c3\u00b1adir un rango de IP a la red p\u00c3\u00bablica en la zona 
-message.add.ip.range.direct.network=A\u00c3\u00b1adir un rango de IP para dirigir <b> red <span id\="directnetwork_name"> </span> </b> en la zona <b> <span id \= "zone_name" > </span> </b> 
-message.add.ip.range.to.pod=<p> A\u00c3\u00b1adir un rango de IP de la vaina\: <b><span id\="pod_name_label"> </span> </b> </p> 
-message.additional.networks.desc=Por favor seleccione de red adicionales (s) que la instancia virtual estar\u00c3\u00a1 conectado. 
-message.add.load.balancer=A\u00c3\u00b1adir un equilibrador de carga a la zona 
-message.add.network=Agregar una nueva red para la zona\: <b><span id\="zone_name"> </span> </b> 
-message.add.pod=Agregar una vaina nueva <b> zona <span id\="add_pod_zone_name"> </span> </b> 
-message.add.primary=Por favor, especifique los par\u00c3\u00a1metros siguientes para agregar un nuevo almacenamiento primario 
-message.add.primary.storage=Agregar una nueva almacenamiento primario para <b> zona <span id\="zone_name"> </span> </b>, la consola de <b> <span id\="pod_name"> </span> </b> 
-message.add.secondary.storage=A\u00c3\u00b1adir un nuevo almacenamiento de <b> zona <span id\="zone_name"> </span> </b> 
-message.add.service.offering=Por favor, rellene los siguientes datos para agregar una nueva oferta de servicio. 
-message.add.template=Por favor ingrese los siguientes datos para crear la nueva plantilla 
-message.add.volume=Por favor, rellene los siguientes datos para agregar un nuevo volumen. 
-message.advanced.mode.desc=Seleccione este modelo de red si desea habilitar soporte VLAN. Este modelo de red proporciona la m\u00c3\u00a1xima flexibilidad al permitir a los administradores proporcionar ofertas personalizadas de la red como el suministro de firewall, VPN, o el apoyo equilibrador de carga, as\u00c3\u00ad como permitir vs directa de redes virtuales. 
+message.add.cluster=A\u00c3\u00b1adir un hipervisor administradas por cl\u00c3\u00baster de <b> zona <span id\="zone_name"> </span> </b>, la consola de <b> <span id\="pod_name"> </span> </b>
+message.add.cluster.zone=A\u00c3\u00b1adir un hipervisor administradas por cl\u00c3\u00baster de <b> zona <span id\="zone_name"> </span> </b>
+message.add.disk.offering=Por favor, especifique los par\u00c3\u00a1metros siguientes para agregar un nuevo disco que ofrece
+message.add.firewall=A\u00c3\u00b1adir un servidor de seguridad a la zona
+message.add.host=Por favor, especifique los par\u00c3\u00a1metros siguientes para agregar un nuevo host
+message.add.ip.range=A\u00c3\u00b1adir un rango de IP a la red p\u00c3\u00bablica en la zona
+message.add.ip.range.direct.network=A\u00c3\u00b1adir un rango de IP para dirigir <b> red <span id\="directnetwork_name"> </span> </b> en la zona <b> <span id \= "zone_name" > </span> </b>
+message.add.ip.range.to.pod=<p> A\u00c3\u00b1adir un rango de IP de la vaina\: <b><span id\="pod_name_label"> </span> </b> </p>
+message.additional.networks.desc=Por favor seleccione de red adicionales (s) que la instancia virtual estar\u00c3\u00a1 conectado.
+message.add.load.balancer=A\u00c3\u00b1adir un equilibrador de carga a la zona
+message.add.network=Agregar una nueva red para la zona\: <b><span id\="zone_name"> </span> </b>
+message.add.pod=Agregar una vaina nueva <b> zona <span id\="add_pod_zone_name"> </span> </b>
+message.add.primary=Por favor, especifique los par\u00c3\u00a1metros siguientes para agregar un nuevo almacenamiento primario
+message.add.primary.storage=Agregar una nueva almacenamiento primario para <b> zona <span id\="zone_name"> </span> </b>, la consola de <b> <span id\="pod_name"> </span> </b>
+message.add.secondary.storage=A\u00c3\u00b1adir un nuevo almacenamiento de <b> zona <span id\="zone_name"> </span> </b>
+message.add.service.offering=Por favor, rellene los siguientes datos para agregar una nueva oferta de servicio.
+message.add.template=Por favor ingrese los siguientes datos para crear la nueva plantilla
+message.add.volume=Por favor, rellene los siguientes datos para agregar un nuevo volumen.
+message.advanced.mode.desc=Seleccione este modelo de red si desea habilitar soporte VLAN. Este modelo de red proporciona la m\u00c3\u00a1xima flexibilidad al permitir a los administradores proporcionar ofertas personalizadas de la red como el suministro de firewall, VPN, o el apoyo equilibrador de carga, as\u00c3\u00ad como permitir vs directa de redes virtuales.
 message.advanced.security.group=Elija esta opci\u00c3\u00b3n si desea utilizar grupos de seguridad para proporcionar resultados de aislamiento VM.
 message.advanced.virtual=Elija esta opci\u00c3\u00b3n si desea utilizar VLAN toda la zona para proporcionar el aislamiento VM invitado.
-message.allow.vpn.access=Por favor, introduzca un nombre de usuario y la contrase\u00c3\u00b1a del usuario que desea permitir el acceso de VPN. 
+message.allow.vpn.access=Por favor, introduzca un nombre de usuario y la contrase\u00c3\u00b1a del usuario que desea permitir el acceso de VPN.
 message.apply.snapshot.policy=Ha actualizado su pol\u00c3\u00adtica instant\u00c3\u00a1nea actual.
-message.attach.iso.confirm=Por favor, confirme que desea conectar el ISO a la instancia virtual 
-message.attach.volume=Por favor, rellene los siguientes datos para fijar un nuevo volumen. Si est\u00c3\u00a1 colocando un volumen de disco a una m\u00c3\u00a1quina virtual de Windows basado, usted tendr\u00c3\u00a1 que reiniciar la instancia para ver el disco adjunto. 
-message.basic.mode.desc=Seleccione este modelo de red si lo haces * <b> no <u> </u> * </b> desea habilitar cualquier soporte VLAN. Todas las instancias virtuales creados en virtud de este modelo de red se le asignar\u00c3\u00a1 una direcci\u00c3\u00b3n IP directamente desde la red y grupos de seguridad se utilizan para proporcionar la seguridad y la segregaci\u00c3\u00b3n. 
-message.change.offering.confirm=Por favor, confirme que desea cambiar la oferta de servicio de la instancia virtual. 
-message.copy.iso.confirm=Por favor, confirme que desea copiar el ISO a 
-message.copy.template=Copia plantilla <b id\="copy_template_name_text"> XXX </b> de la zona <b id\="copy_template_source_zone_text"> </b> 
-message.create.template.vm=Crear VM de la plantilla <b id\="p_name"> </b> 
-message.create.template.volume=Por favor, especifique la siguiente informaci\u00c3\u00b3n antes de crear una plantilla de su volumen de disco\: <b> <span id\="volume_name"> </span> </b>. Creaci\u00c3\u00b3n de la plantilla puede oscilar entre varios minutos m\u00c3\u00a1s, dependiendo del tama\u00c3\u00b1o del volumen. 
-message.delete.account=Por favor, confirme que desea eliminar esta cuenta. 
-message.detach.iso.confirm=Por favor, confirme que desea quitar el ISO de la instancia virtual 
+message.attach.iso.confirm=Por favor, confirme que desea conectar el ISO a la instancia virtual
+message.attach.volume=Por favor, rellene los siguientes datos para fijar un nuevo volumen. Si est\u00c3\u00a1 colocando un volumen de disco a una m\u00c3\u00a1quina virtual de Windows basado, usted tendr\u00c3\u00a1 que reiniciar la instancia para ver el disco adjunto.
+message.basic.mode.desc=Seleccione este modelo de red si lo haces * <b> no <u> </u> * </b> desea habilitar cualquier soporte VLAN. Todas las instancias virtuales creados en virtud de este modelo de red se le asignar\u00c3\u00a1 una direcci\u00c3\u00b3n IP directamente desde la red y grupos de seguridad se utilizan para proporcionar la seguridad y la segregaci\u00c3\u00b3n.
+message.change.offering.confirm=Por favor, confirme que desea cambiar la oferta de servicio de la instancia virtual.
+message.copy.iso.confirm=Por favor, confirme que desea copiar el ISO a
+message.copy.template=Copia plantilla <b id\="copy_template_name_text"> XXX </b> de la zona <b id\="copy_template_source_zone_text"> </b>
+message.create.template.vm=Crear VM de la plantilla <b id\="p_name"> </b>
+message.create.template.volume=Por favor, especifique la siguiente informaci\u00c3\u00b3n antes de crear una plantilla de su volumen de disco\: <b> <span id\="volume_name"> </span> </b>. Creaci\u00c3\u00b3n de la plantilla puede oscilar entre varios minutos m\u00c3\u00a1s, dependiendo del tama\u00c3\u00b1o del volumen.
+message.delete.account=Por favor, confirme que desea eliminar esta cuenta.
+message.detach.iso.confirm=Por favor, confirme que desea quitar el ISO de la instancia virtual
 message.disable.snapshot.policy=Ha desactivado su pol\u00c3\u00adtica instant\u00c3\u00a1nea actual.
 message.disable.vpn.access=Por favor, confirme que desea desactivar VPN de acceso.
 message.download.volume=Por favor, haga clic <a href\="\#">00000</a> para bajar el volumen
-message.edit.confirm=Por favor confirmar los cambios antes de hacer clic en "Guardar" 
-message.edit.limits=Por favor, especifique los l\u00c3\u00admites de los recursos siguientes. A "-1" indica que no hay l\u00c3\u00admite a la cantidad de los recursos de crear. 
-message.enable.account=Por favor, confirme que desea habilitar esta cuenta. 
-message.enabled.vpn.ip.sec=La clave pre-compartida IPSec es 
-message.enabled.vpn=Su acceso a la VPN est\u00c3\u00a1 habilitado y se puede acceder a trav\u00c3\u00a9s de la IP 
-message.enable.vpn.access=VPN \= est\u00c3\u00a1 desactivado para esta direcci\u00c3\u00b3n IP. \u00c2\u00bfTe gustar\u00c3\u00ada que permitan el acceso VPN? 
-message.enable.vpn=VPN de acceso actualmente no est\u00c3\u00a1 habilitado. Por favor, <a href\="\#" id\="enable_vpn_link"> haga clic aqu\u00c3\u00ad </a> para habilitar VPN. 
+message.edit.confirm=Por favor confirmar los cambios antes de hacer clic en "Guardar"
+message.edit.limits=Por favor, especifique los l\u00c3\u00admites de los recursos siguientes. A "-1" indica que no hay l\u00c3\u00admite a la cantidad de los recursos de crear.
+message.enable.account=Por favor, confirme que desea habilitar esta cuenta.
+message.enabled.vpn.ip.sec=La clave pre-compartida IPSec es
+message.enabled.vpn=Su acceso a la VPN est\u00c3\u00a1 habilitado y se puede acceder a trav\u00c3\u00a9s de la IP
+message.enable.vpn.access=VPN \= est\u00c3\u00a1 desactivado para esta direcci\u00c3\u00b3n IP. \u00c2\u00bfTe gustar\u00c3\u00ada que permitan el acceso VPN?
+message.enable.vpn=VPN de acceso actualmente no est\u00c3\u00a1 habilitado. Por favor, <a href\="\#" id\="enable_vpn_link"> haga clic aqu\u00c3\u00ad </a> para habilitar VPN.
 message.installWizard.click.retry=Haz click en el bot\u00f3n para re-intentar el lanzamiento de la instancia.
-message.installWizard.tooltip.addCluster.name=Nombre del  Cluster. Puede ser  alfanum\u00e9rico .Este no es usado por CloudStack 
+message.installWizard.tooltip.addCluster.name=Nombre del  Cluster. Puede ser  alfanum\u00e9rico .Este no es usado por CloudStack
 message.installWizard.tooltip.addHost.hostname=El nombre DNS o direcci\u00f3n IP del host
 message.installWizard.tooltip.addHost.username=Generalmente root
 message.installWizard.tooltip.addPod.name=Nombre del POD
@@ -818,44 +819,44 @@ message.installWizard.tooltip.addPrimaryStorage.name=\ Nombre para el storage
 message.installWizard.tooltip.addSecondaryStorage.nfsServer=Direcci\u00f3n IP del servidor NFS que contiene el secondary storage
 message.installWizard.tooltip.addZone.name=Nombre de la zona.
 message.installWizard.tooltip.configureGuestTraffic.description=Una breve descripci\u00f3n para su red.
-message.installWizard.tooltip.configureGuestTraffic.guestGateway=El gatway, puerta de enlace, que las maquinas guest deben usar. 
-message.installWizard.tooltip.configureGuestTraffic.name=Nombre de su RED 
-message.lock.account=Por favor, confirme que desea bloquear esta cuenta. Al bloquear la cuenta, todos los usuarios de esta cuenta ya no ser\u00c3\u00a1 capaz de gestionar sus recursos de la nube. Los recursos existentes todav\u00c3\u00ada se puede acceder. 
+message.installWizard.tooltip.configureGuestTraffic.guestGateway=El gatway, puerta de enlace, que las maquinas guest deben usar.
+message.installWizard.tooltip.configureGuestTraffic.name=Nombre de su RED
+message.lock.account=Por favor, confirme que desea bloquear esta cuenta. Al bloquear la cuenta, todos los usuarios de esta cuenta ya no ser\u00c3\u00a1 capaz de gestionar sus recursos de la nube. Los recursos existentes todav\u00c3\u00ada se puede acceder.
 message.migrate.instance.confirm=Por favor, confirme el anfitri\u00c3\u00b3n desea migrar la instancia virtual.
 message.migrate.instance.to.host=Por favor, confirmar que desea mover la instancia a otro host.
 message.migrate.instance.to.ps=Por favor, confirmar que desea mover la instancia a otro primary storage.
 message.migrate.router.confirm=Por favor, confirme el hu\u00c3\u00a9sped que desea migrar el router\:
 message.migrate.systemvm.confirm=Por favor, confirme el hu\u00c3\u00a9sped que desea migrar la m\u00c3\u00a1quina virtual de sistema\:
 message.no.network.support.configuration.not.true=Usted no tiene ninguna zona que ha permitido a grupo de seguridad. Por lo tanto, no hay funciones de red adicionales. Por favor, contin\u00c3\u00bae con el paso 5.
-message.no.network.support=El hipervisor seleccionado, vSphere, no tiene funciones de red adicionales. Por favor, contin\u00c3\u00bae con el paso 5. 
-message.number.clusters=<h2> <span> \# de </span> Grupos </h2> 
-message.number.hosts=<h2> <span> \# de </span> Anfitri\u00c3\u00b3n </h2> 
-message.number.pods=<h2> <span> \# de </span> Las vainas </h2> 
-message.number.storage=<h2> <span> \# de </span> Almacenamiento primario </h2> 
-message.number.zones=<h2> <span> \# de </span> Zonas </h2> 
-message.remove.vpn.access=Por favor, confirme que desea eliminar el acceso VPN desde el siguiente usuario 
-message.restart.mgmt.server=Por favor, reinicie el servidor de administraci\u00c3\u00b3n (s) para la nueva configuraci\u00c3\u00b3n surta efecto. 
-message.security.group.usage=(Uso <strong> pulse Ctrl </strong> para seleccionar todos los grupos de seguridad se aplica) 
-message.select.item=Por favor, seleccionar un item . 
+message.no.network.support=El hipervisor seleccionado, vSphere, no tiene funciones de red adicionales. Por favor, contin\u00c3\u00bae con el paso 5.
+message.number.clusters=<h2> <span> \# de </span> Grupos </h2>
+message.number.hosts=<h2> <span> \# de </span> Anfitri\u00c3\u00b3n </h2>
+message.number.pods=<h2> <span> \# de </span> Las vainas </h2>
+message.number.storage=<h2> <span> \# de </span> Almacenamiento primario </h2>
+message.number.zones=<h2> <span> \# de </span> Zonas </h2>
+message.remove.vpn.access=Por favor, confirme que desea eliminar el acceso VPN desde el siguiente usuario
+message.restart.mgmt.server=Por favor, reinicie el servidor de administraci\u00c3\u00b3n (s) para la nueva configuraci\u00c3\u00b3n surta efecto.
+message.security.group.usage=(Uso <strong> pulse Ctrl </strong> para seleccionar todos los grupos de seguridad se aplica)
+message.select.item=Por favor, seleccionar un item .
 message.setup.successful=La configuraci\u00f3n de la cloud finalizo satisfactoriamente.
-message.snapshot.schedule=Puede horarios de configuraci\u00c3\u00b3n recurrente instant\u00c3\u00a1neas mediante la selecci\u00c3\u00b3n de las opciones disponibles a continuaci\u00c3\u00b3n y la aplicaci\u00c3\u00b3n de su preferencia pol\u00c3\u00adtica 
-message.step.1.continue=Por favor seleccione una plantilla o ISO para continuar 
-message.step.1.desc=Por favor seleccione una plantilla para la instancia virtual. Tambi\u00c3\u00a9n puede optar por seleccionar una plantilla en blanco desde el que puede ser una imagen ISO instalado en. 
-message.step.2.continue=Por favor seleccione una oferta de servicio para continuar 
+message.snapshot.schedule=Puede horarios de configuraci\u00c3\u00b3n recurrente instant\u00c3\u00a1neas mediante la selecci\u00c3\u00b3n de las opciones disponibles a continuaci\u00c3\u00b3n y la aplicaci\u00c3\u00b3n de su preferencia pol\u00c3\u00adtica
+message.step.1.continue=Por favor seleccione una plantilla o ISO para continuar
+message.step.1.desc=Por favor seleccione una plantilla para la instancia virtual. Tambi\u00c3\u00a9n puede optar por seleccionar una plantilla en blanco desde el que puede ser una imagen ISO instalado en.
+message.step.2.continue=Por favor seleccione una oferta de servicio para continuar
 message.step.2.desc=
-message.step.3.continue=Por favor seleccione una oferta en disco para continuar 
+message.step.3.continue=Por favor seleccione una oferta en disco para continuar
 message.step.3.desc=
 message.step.4.continue=Por favor seleccione al menos una red social para continuar
-message.step.4.desc=Por favor, seleccione la red primaria que la instancia virtual estar\u00c3\u00a1 conectado. 
-message.update.os.preference=Por favor seleccione un sistema operativo de preferencia para este equipo. Todas las instancias virtuales con preferencias similares ser\u00c3\u00a1n los primeros asignados a este equipo antes de elegir otro. 
-message.update.ssl=Por favor, env\u00c3\u00ade una nueva X.509 compatible con certificado SSL que se actualizar\u00c3\u00a1 a cada instancia virtual de la consola del servidor proxy\: 
-message.virtual.network.desc=Una red dedicada virtualizados para su cuenta. El dominio de difusi\u00c3\u00b3n est\u00c3\u00a1 contenida dentro de una VLAN y todos los acceso a la red p\u00c3\u00bablica se encamina a cabo por un router virtual. 
+message.step.4.desc=Por favor, seleccione la red primaria que la instancia virtual estar\u00c3\u00a1 conectado.
+message.update.os.preference=Por favor seleccione un sistema operativo de preferencia para este equipo. Todas las instancias virtuales con preferencias similares ser\u00c3\u00a1n los primeros asignados a este equipo antes de elegir otro.
+message.update.ssl=Por favor, env\u00c3\u00ade una nueva X.509 compatible con certificado SSL que se actualizar\u00c3\u00a1 a cada instancia virtual de la consola del servidor proxy\:
+message.virtual.network.desc=Una red dedicada virtualizados para su cuenta. El dominio de difusi\u00c3\u00b3n est\u00c3\u00a1 contenida dentro de una VLAN y todos los acceso a la red p\u00c3\u00bablica se encamina a cabo por un router virtual.
 message.vm.create.template.confirm=Crear plantilla de la m\u00c3\u00a1quina virtual se reiniciar\u00c3\u00a1 autom\u00c3\u00a1ticamente.
-message.volume.create.template.confirm=Por favor, confirme que desea crear una plantilla para este volumen de disco. Creaci\u00c3\u00b3n de la plantilla puede oscilar entre varios minutos m\u00c3\u00a1s, dependiendo del tama\u00c3\u00b1o del volumen. 
-message.zone.step.1.desc=Por favor seleccione un modelo de red para su zona. 
+message.volume.create.template.confirm=Por favor, confirme que desea crear una plantilla para este volumen de disco. Creaci\u00c3\u00b3n de la plantilla puede oscilar entre varios minutos m\u00c3\u00a1s, dependiendo del tama\u00c3\u00b1o del volumen.
+message.zone.step.1.desc=Por favor seleccione un modelo de red para su zona.
 mode=modo
-network.rate=Tasa de Red 
+network.rate=Tasa de Red
 side.by.side=Juntos
-state.Allocated=Asignados 
-state.Disabled=personas de movilidad reducida 
-state.Error=Error 
+state.Allocated=Asignados
+state.Disabled=personas de movilidad reducida
+state.Error=Error


[28/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/DhcpEntryCommand.java b/core/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
new file mode 100644
index 0000000..fd8d84c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
@@ -0,0 +1,142 @@
+// 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.agent.api.routing;
+
+
+public class DhcpEntryCommand extends NetworkElementCommand {
+
+    String vmMac;
+    String vmIpAddress;
+    String vmName;
+    String dns;
+    String gateway;
+    String nextServer;
+    String defaultRouter;
+    String staticRoutes;
+    String defaultDns;
+    String vmIp6Address;
+    String ip6Gateway;
+    String duid;
+    private boolean isDefault;
+
+    protected DhcpEntryCommand() {
+
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String vmIp6Address) {
+        this.vmMac = vmMac;
+        this.vmIpAddress = vmIpAddress;
+        this.vmName = vmName;
+        this.vmIp6Address = vmIp6Address;
+        this.setDefault(true);
+    }
+
+    public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String vmIp6Address, String dns, String gateway, String ip6Gateway) {
+        this(vmMac, vmIpAddress, vmName, vmIp6Address);
+        this.dns = dns;
+        this.gateway = gateway;
+    }
+
+    public String getDns() {
+        return dns;
+    }
+
+    public String getGateway() {
+        return gateway;
+    }
+
+    public String getVmMac() {
+        return vmMac;
+    }
+
+    public String getVmIpAddress() {
+        return vmIpAddress;
+    }
+
+    public String getVmName() {
+        return vmName;
+    }
+
+    public void setNextServer(String ip) {
+        nextServer = ip;
+    }
+
+    public String getNextServer() {
+        return nextServer;
+    }
+
+    public String getDefaultRouter() {
+        return defaultRouter;
+    }
+
+    public void setDefaultRouter(String defaultRouter) {
+        this.defaultRouter = defaultRouter;
+    }
+
+    public String getStaticRoutes() {
+        return staticRoutes;
+    }
+
+    public void setStaticRoutes(String staticRoutes) {
+        this.staticRoutes = staticRoutes;
+    }
+
+	public String getDefaultDns() {
+		return defaultDns;
+	}
+
+	public void setDefaultDns(String defaultDns) {
+		this.defaultDns = defaultDns;
+	}
+
+	public String getIp6Gateway() {
+		return ip6Gateway;
+	}
+
+	public void setIp6Gateway(String ip6Gateway) {
+		this.ip6Gateway = ip6Gateway;
+	}
+
+	public String getDuid() {
+		return duid;
+	}
+
+	public void setDuid(String duid) {
+		this.duid = duid;
+	}
+
+	public String getVmIp6Address() {
+		return vmIp6Address;
+	}
+
+	public void setVmIp6Address(String ip6Address) {
+		this.vmIp6Address = ip6Address;
+	}
+
+	public boolean isDefault() {
+		return isDefault;
+	}
+
+	public void setDefault(boolean isDefault) {
+		this.isDefault = isDefault;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigAnswer.java b/core/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigAnswer.java
new file mode 100644
index 0000000..e5167fe
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigAnswer.java
@@ -0,0 +1,27 @@
+// 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.agent.api.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class GlobalLoadBalancerConfigAnswer extends Answer{
+
+    public GlobalLoadBalancerConfigAnswer(boolean success, String details) {
+        this.result = success;
+        this.details = details;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigCommand.java b/core/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigCommand.java
new file mode 100644
index 0000000..b3603c8
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigCommand.java
@@ -0,0 +1,100 @@
+// 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.agent.api.routing;
+
+import com.cloud.agent.api.Command;
+
+import java.util.List;
+
+/**
+ * GlobalLoadBalancerConfigCommand used for sending the GSLB configuration to GSLB service provider
+ */
+public class GlobalLoadBalancerConfigCommand extends Command {
+
+    // FQDN that represents the globally load balanced service
+    String domainName;
+
+    // type of the globally load balanced service
+    String serviceType;
+
+    // load balancing method to distribute traffic across the sites participating in global service load balancing
+    String lbMethod;
+
+    // session persistence type
+    String persistenceType;
+
+    // unique Id given per gslb rule, that is uniquely represents glsb rule on all participant sites
+    long gslbId;
+
+    // true if global load balancer rule is being deleted
+    boolean revoked;
+
+    // list of the site details that are participating in the GSLB service
+    List<SiteLoadBalancerConfig> siteLoadBalancers;
+
+    public GlobalLoadBalancerConfigCommand(String domainName,
+                                                 String lbMethod,
+                                                 String persistenceType,
+                                                 String serviceType,
+                                                 long gslbId,
+                                                 boolean revoked) {
+        this.domainName = domainName;
+        this.serviceType = serviceType;
+        this.lbMethod = lbMethod;
+        this.persistenceType = persistenceType;
+        this.gslbId = gslbId;
+        this.revoked = revoked;
+    }
+
+    public List<SiteLoadBalancerConfig> getSiteDetails() {
+        return siteLoadBalancers;
+    }
+
+    public void setSiteLoadBalancers(List<SiteLoadBalancerConfig> siteLoadBalancers) {
+        this.siteLoadBalancers = siteLoadBalancers;
+    }
+
+    public String getServiceType() {
+        return serviceType;
+    }
+
+    public String getLoadBalancerMethod() {
+        return lbMethod;
+    }
+
+    public String getPersistenceType() {
+        return persistenceType;
+    }
+
+    public long getGslbId() {
+        return this.gslbId;
+    }
+
+    public String getDomainName() {
+        return domainName;
+    }
+
+    public boolean isForRevoke() {
+        return revoked;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/HealthCheckLBConfigAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/HealthCheckLBConfigAnswer.java b/core/src/com/cloud/agent/api/routing/HealthCheckLBConfigAnswer.java
new file mode 100644
index 0000000..dfca4ab
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/HealthCheckLBConfigAnswer.java
@@ -0,0 +1,42 @@
+// 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.agent.api.routing;
+
+import java.util.List;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.to.LoadBalancerTO;
+import com.cloud.agent.api.to.NicTO;
+
+/**
+ * LoadBalancerConfigCommand sends the load balancer configuration
+ */
+public class HealthCheckLBConfigAnswer extends Answer {
+    List<LoadBalancerTO> loadBalancers;
+
+    protected HealthCheckLBConfigAnswer() {
+    }
+
+    public HealthCheckLBConfigAnswer(List<LoadBalancerTO> loadBalancers) {
+        this.loadBalancers = loadBalancers;
+    }
+
+    public List<LoadBalancerTO> getLoadBalancers() {
+        return loadBalancers;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/HealthCheckLBConfigCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/HealthCheckLBConfigCommand.java b/core/src/com/cloud/agent/api/routing/HealthCheckLBConfigCommand.java
new file mode 100644
index 0000000..f705f6c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/HealthCheckLBConfigCommand.java
@@ -0,0 +1,39 @@
+// 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.agent.api.routing;
+
+import com.cloud.agent.api.to.LoadBalancerTO;
+import com.cloud.agent.api.to.NicTO;
+
+/**
+ * LoadBalancerConfigCommand sends the load balancer configuration
+ */
+public class HealthCheckLBConfigCommand extends NetworkElementCommand {
+    LoadBalancerTO[] loadBalancers;
+
+    protected HealthCheckLBConfigCommand() {
+    }
+
+    public HealthCheckLBConfigCommand(LoadBalancerTO[] loadBalancers) {
+        this.loadBalancers = loadBalancers;
+    }
+
+    public LoadBalancerTO[] getLoadBalancers() {
+        return loadBalancers;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/IpAssocAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/IpAssocAnswer.java b/core/src/com/cloud/agent/api/routing/IpAssocAnswer.java
new file mode 100644
index 0000000..194923c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/IpAssocAnswer.java
@@ -0,0 +1,48 @@
+// 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.agent.api.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class IpAssocAnswer extends Answer{
+    String[] results;
+
+    public static final String errorResult = "Failed";
+
+    protected IpAssocAnswer() {
+        super();
+    }
+
+    public IpAssocAnswer(IpAssocCommand cmd, String[] results) {
+
+        boolean finalResult = true;
+        for (String result : results) {
+            if (result.equals(errorResult)) {
+                finalResult = false;
+                break;
+            }
+        }
+        this.result = finalResult;
+        this.details = null;
+        assert(cmd.getIpAddresses().length == results.length) : "Shouldn't the results match the commands?";
+        this.results = results;
+    }
+
+    String[] getResults() {
+        return results;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/IpAssocCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/IpAssocCommand.java b/core/src/com/cloud/agent/api/routing/IpAssocCommand.java
new file mode 100644
index 0000000..5cdc2da
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/IpAssocCommand.java
@@ -0,0 +1,42 @@
+// 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.agent.api.routing;
+
+import com.cloud.agent.api.to.IpAddressTO;
+
+public class IpAssocCommand extends NetworkElementCommand {
+
+	IpAddressTO[] ipAddresses;
+
+	protected IpAssocCommand() {
+	}
+
+	public IpAssocCommand(IpAddressTO[] ips) {
+		this.ipAddresses = ips;
+	}
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public IpAddressTO[] getIpAddresses() {
+        return ipAddresses;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/IpAssocVpcCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/IpAssocVpcCommand.java b/core/src/com/cloud/agent/api/routing/IpAssocVpcCommand.java
new file mode 100644
index 0000000..e5c900d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/IpAssocVpcCommand.java
@@ -0,0 +1,29 @@
+// 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.agent.api.routing;
+
+import com.cloud.agent.api.to.IpAddressTO;
+
+public class IpAssocVpcCommand extends IpAssocCommand{
+    protected IpAssocVpcCommand() {
+        super();
+    }
+
+    public IpAssocVpcCommand(IpAddressTO[] ips) {
+        super(ips);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java b/core/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java
new file mode 100644
index 0000000..1c1fb91
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java
@@ -0,0 +1,66 @@
+// 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.agent.api.routing;
+
+import com.cloud.agent.api.to.LoadBalancerTO;
+import com.cloud.agent.api.to.NicTO;
+
+/**
+ * LoadBalancerConfigCommand sends the load balancer configuration
+ */
+public class LoadBalancerConfigCommand extends NetworkElementCommand {
+    LoadBalancerTO[] loadBalancers;
+    public String lbStatsVisibility = "guest-network";
+    public String lbStatsPublicIP; /* load balancer listen on this ips for stats */
+    public String lbStatsPrivateIP; /* load balancer listen on this ips for stats */
+    public String lbStatsGuestIP; /* load balancer listen on this ips for stats */
+    public String lbStatsPort = "8081"; /*load balancer listen on this port for stats */
+    public String lbStatsSrcCidrs = "0/0" ; /* TODO : currently there is no filtering based on the source ip */
+    public String lbStatsAuth = "admin1:AdMiN123";
+    public String lbStatsUri = "/admin?stats";
+    NicTO nic;
+    Long vpcId;
+
+    protected LoadBalancerConfigCommand() {
+    }
+
+    public LoadBalancerConfigCommand(LoadBalancerTO[] loadBalancers, Long vpcId) {
+    	this.loadBalancers = loadBalancers;
+    	this.vpcId = vpcId;
+    }
+
+    public LoadBalancerConfigCommand(LoadBalancerTO[] loadBalancers,String PublicIp,String GuestIp,String PrivateIp, NicTO nic, Long vpcId) {
+    	this.loadBalancers = loadBalancers;
+    	this.lbStatsPublicIP = PublicIp;
+    	this.lbStatsPrivateIP = PrivateIp;
+    	this.lbStatsGuestIP = GuestIp;
+    	this.nic = nic;
+    	this.vpcId = vpcId;
+    }
+
+    public NicTO getNic() {
+        return nic;
+    }
+
+	public LoadBalancerTO[] getLoadBalancers() {
+        return loadBalancers;
+    }
+
+    public Long getVpcId() {
+        return vpcId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java b/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java
new file mode 100644
index 0000000..41ae80f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/NetworkElementCommand.java
@@ -0,0 +1,53 @@
+// 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.agent.api.routing;
+
+import java.util.HashMap;
+
+import com.cloud.agent.api.Command;
+
+public abstract class NetworkElementCommand extends Command {
+    HashMap<String, String> accessDetails = new HashMap<String, String>(0);
+
+    public static final String ACCOUNT_ID = "account.id";
+    public static final String GUEST_NETWORK_CIDR = "guest.network.cidr";
+    public static final String GUEST_NETWORK_GATEWAY = "guest.network.gateway";
+    public static final String GUEST_VLAN_TAG = "guest.vlan.tag";
+    public static final String ROUTER_NAME = "router.name";
+    public static final String ROUTER_IP = "router.ip";
+    public static final String ROUTER_GUEST_IP = "router.guest.ip";
+    public static final String ZONE_NETWORK_TYPE = "zone.network.type";
+    public static final String GUEST_BRIDGE = "guest.bridge";
+
+    protected NetworkElementCommand() {
+        super();
+    }
+
+    public void setAccessDetail(String name, String value) {
+        accessDetails.put(name, value);
+    }
+
+    public String getAccessDetail(String name) {
+        return accessDetails.get(name);
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java b/core/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java
new file mode 100644
index 0000000..68d7caf
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java
@@ -0,0 +1,78 @@
+// 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.agent.api.routing;
+
+
+public class RemoteAccessVpnCfgCommand extends NetworkElementCommand {
+
+	boolean create;
+    String vpnServerIp;
+    String ipRange;
+    String presharedKey;
+    String localIp;
+
+    protected RemoteAccessVpnCfgCommand() {
+    	this.create = false;
+    }
+
+    public boolean isCreate() {
+		return create;
+	}
+
+	@Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+
+	public RemoteAccessVpnCfgCommand(boolean create, String vpnServerAddress, String localIp, String ipRange, String ipsecPresharedKey) {
+		this.vpnServerIp = vpnServerAddress;
+		this.ipRange  = ipRange;
+		this.presharedKey = ipsecPresharedKey;
+		this.localIp = localIp;
+		this.create = create;
+	}
+
+	public String getVpnServerIp() {
+		return vpnServerIp;
+	}
+
+	public void setVpnServerIp(String vpnServerIp) {
+		this.vpnServerIp = vpnServerIp;
+	}
+
+	public String getIpRange() {
+		return ipRange;
+	}
+
+	public void setIpRange(String ipRange) {
+		this.ipRange = ipRange;
+	}
+
+	public String getPresharedKey() {
+		return presharedKey;
+	}
+
+	public void setPresharedKey(String presharedKey) {
+		this.presharedKey = presharedKey;
+	}
+
+	public String getLocalIp() {
+		return localIp;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SavePasswordCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SavePasswordCommand.java b/core/src/com/cloud/agent/api/routing/SavePasswordCommand.java
new file mode 100644
index 0000000..6dac148
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SavePasswordCommand.java
@@ -0,0 +1,54 @@
+// 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.agent.api.routing;
+
+
+public class SavePasswordCommand extends NetworkElementCommand {
+
+    String password;
+    String vmIpAddress;
+    String vmName;
+
+    protected SavePasswordCommand() {
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    public SavePasswordCommand(String password, String vmIpAddress, String vmName) {
+        this.password = password;
+        this.vmIpAddress = vmIpAddress;
+        this.vmName = vmName;
+    }
+
+	public String getPassword() {
+		return password;
+	}
+
+	public String getVmIpAddress() {
+		return vmIpAddress;
+	}
+
+    public String getVmName() {
+        return vmName;
+    }
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetFirewallRulesAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetFirewallRulesAnswer.java b/core/src/com/cloud/agent/api/routing/SetFirewallRulesAnswer.java
new file mode 100644
index 0000000..5268c3d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetFirewallRulesAnswer.java
@@ -0,0 +1,36 @@
+// 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.agent.api.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class SetFirewallRulesAnswer extends Answer {
+    String[] results;
+
+    protected SetFirewallRulesAnswer() {
+    }
+
+    public SetFirewallRulesAnswer(SetFirewallRulesCommand cmd, boolean success, String[] results) {
+        super(cmd, success, null);
+        assert (cmd.getRules().length == results.length) : "rules and their results should be the same length don't you think?";
+        this.results = results;
+    }
+
+    public String[] getResults() {
+        return results;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetFirewallRulesCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetFirewallRulesCommand.java b/core/src/com/cloud/agent/api/routing/SetFirewallRulesCommand.java
new file mode 100644
index 0000000..3841bd7
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetFirewallRulesCommand.java
@@ -0,0 +1,98 @@
+// 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.agent.api.routing;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import com.cloud.agent.api.to.FirewallRuleTO;
+
+/**
+ *
+ * AccessDetails allow different components to put in information about
+ * how to access the components inside the command.
+ */
+public class SetFirewallRulesCommand extends NetworkElementCommand {
+    FirewallRuleTO[] rules;
+
+    protected SetFirewallRulesCommand() {
+    }
+
+    public SetFirewallRulesCommand(List<FirewallRuleTO> rules) {
+        this.rules = rules.toArray(new FirewallRuleTO[rules.size()]);
+    }
+
+    public FirewallRuleTO[] getRules() {
+        return rules;
+    }
+
+	public String[][] generateFwRules() {
+		String [][] result = new String [2][];
+		Set<String> toAdd = new HashSet<String>();
+
+
+		for (FirewallRuleTO fwTO: rules) {
+		/* example  :  172.16.92.44:tcp:80:80:0.0.0.0/0:,200.16.92.44:tcp:220:220:0.0.0.0/0:,
+		 *  each entry format      <ip>:protocol:srcport:destport:scidr:
+		 *  reverted entry format  <ip>:reverted:0:0:0:
+		 */
+			if (fwTO.revoked() == true)
+			{
+				StringBuilder sb = new StringBuilder();
+				/* This entry is added just to make sure atleast there will one entry in the list to get the ipaddress */
+				sb.append(fwTO.getSrcIp()).append(":reverted:0:0:0:");
+				String fwRuleEntry = sb.toString();
+				toAdd.add(fwRuleEntry);
+				continue;
+			}
+
+			List<String> cidr;
+			StringBuilder sb = new StringBuilder();
+			sb.append(fwTO.getSrcIp()).append(":").append(fwTO.getProtocol()).append(":");
+			if ("icmp".compareTo(fwTO.getProtocol()) == 0)
+			{
+				sb.append(fwTO.getIcmpType()).append(":").append(fwTO.getIcmpCode()).append(":");
+
+			}else if (fwTO.getStringSrcPortRange() == null)
+				sb.append("0:0").append(":");
+			else
+			    sb.append(fwTO.getStringSrcPortRange()).append(":");
+
+			cidr = fwTO.getSourceCidrList();
+			if (cidr == null || cidr.isEmpty())
+			{
+				sb.append("0.0.0.0/0");
+			}else{
+				Boolean firstEntry = true;
+	            for (String tag : cidr) {
+	            	if (!firstEntry) sb.append("-");
+	        	   sb.append(tag);
+	        	   firstEntry = false;
+	            }
+			}
+			sb.append(":");
+			String fwRuleEntry = sb.toString();
+
+			toAdd.add(fwRuleEntry);
+
+		}
+		result[0] = toAdd.toArray(new String[toAdd.size()]);
+
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetNetworkACLAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetNetworkACLAnswer.java b/core/src/com/cloud/agent/api/routing/SetNetworkACLAnswer.java
new file mode 100644
index 0000000..dc192ad
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetNetworkACLAnswer.java
@@ -0,0 +1,36 @@
+// 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.agent.api.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class SetNetworkACLAnswer extends Answer {
+    String[] results;
+
+    protected SetNetworkACLAnswer() {
+    }
+
+    public SetNetworkACLAnswer(SetNetworkACLCommand cmd, boolean success, String[] results) {
+        super(cmd, success, null);
+        assert (cmd.getRules().length == results.length) : "ACLs and their results should be the same length";
+        this.results = results;
+    }
+
+    public String[] getResults() {
+        return results;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java b/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java
new file mode 100644
index 0000000..dba7354
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java
@@ -0,0 +1,97 @@
+// 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.agent.api.routing;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import com.cloud.agent.api.to.NetworkACLTO;
+import com.cloud.agent.api.to.NicTO;
+
+public class SetNetworkACLCommand extends NetworkElementCommand{
+    NetworkACLTO[] rules;
+    NicTO nic;
+
+    protected SetNetworkACLCommand() {
+    }
+
+    public SetNetworkACLCommand(List<NetworkACLTO> rules, NicTO nic) {
+        this.rules = rules.toArray(new NetworkACLTO[rules.size()]);
+        this.nic = nic;
+    }
+
+    public NetworkACLTO[] getRules() {
+        return rules;
+    }
+    public String[][] generateFwRules() {
+        String [][] result = new String [2][];
+        Set<String> toAdd = new HashSet<String>();
+
+
+        for (NetworkACLTO aclTO: rules) {
+        /*  example  :  Ingress:tcp:80:80:0.0.0.0/0:,Egress:tcp:220:220:0.0.0.0/0:,
+         *  each entry format      Ingress/Egress:protocol:start port: end port:scidrs:
+         *  reverted entry format  Ingress/Egress:reverted:0:0:0:
+         */
+            if (aclTO.revoked() == true)
+            {
+                StringBuilder sb = new StringBuilder();
+                /* This entry is added just to make sure atleast there will one entry in the list to get the ipaddress */
+                sb.append(aclTO.getTrafficType().toString()).append(":reverted:0:0:0:");
+                String aclRuleEntry = sb.toString();
+                toAdd.add(aclRuleEntry);
+                continue;
+            }
+
+            List<String> cidr;
+            StringBuilder sb = new StringBuilder();
+            sb.append(aclTO.getTrafficType().toString()).append(":").append(aclTO.getProtocol()).append(":");
+            if ("icmp".compareTo(aclTO.getProtocol()) == 0)
+            {
+                sb.append(aclTO.getIcmpType()).append(":").append(aclTO.getIcmpCode()).append(":");
+            } else {
+                sb.append(aclTO.getStringPortRange()).append(":");
+            }
+            cidr = aclTO.getSourceCidrList();
+            if (cidr == null || cidr.isEmpty())
+            {
+                sb.append("0.0.0.0/0");
+            }else{
+                Boolean firstEntry = true;
+                for (String tag : cidr) {
+                    if (!firstEntry) sb.append("-");
+                   sb.append(tag);
+                   firstEntry = false;
+                }
+            }
+            sb.append(":");
+            String aclRuleEntry = sb.toString();
+
+            toAdd.add(aclRuleEntry);
+
+        }
+        result[0] = toAdd.toArray(new String[toAdd.size()]);
+
+        return result;
+    }
+
+    public NicTO getNic() {
+        return nic;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesAnswer.java b/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesAnswer.java
new file mode 100644
index 0000000..15306fb
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesAnswer.java
@@ -0,0 +1,37 @@
+// 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.agent.api.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class SetPortForwardingRulesAnswer extends Answer {
+    String[] results;
+    protected SetPortForwardingRulesAnswer() {
+        super();
+    }
+
+    public SetPortForwardingRulesAnswer(SetPortForwardingRulesCommand cmd, String[] results, boolean success) {
+        super(cmd, success, null);
+
+        assert(cmd.getRules().length == results.length) : "Shouldn't the results match the commands?";
+        this.results = results;
+    }
+
+    String[] getResults() {
+        return results;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesCommand.java b/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesCommand.java
new file mode 100644
index 0000000..a7bf37f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesCommand.java
@@ -0,0 +1,40 @@
+// 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.agent.api.routing;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.PortForwardingRuleTO;
+
+public class SetPortForwardingRulesCommand extends NetworkElementCommand {
+    PortForwardingRuleTO[] rules;
+
+    protected SetPortForwardingRulesCommand() {
+    }
+
+    public SetPortForwardingRulesCommand(List<? extends PortForwardingRuleTO> pfRules) {
+        rules = new PortForwardingRuleTO[pfRules.size()];
+        int i = 0;
+        for (PortForwardingRuleTO rule : pfRules) {
+            rules[i++] = rule;
+        }
+    }
+
+    public PortForwardingRuleTO[] getRules() {
+        return rules;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesVpcCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesVpcCommand.java b/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesVpcCommand.java
new file mode 100644
index 0000000..7228457
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetPortForwardingRulesVpcCommand.java
@@ -0,0 +1,30 @@
+// 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.agent.api.routing;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.PortForwardingRuleTO;
+
+public class SetPortForwardingRulesVpcCommand extends SetPortForwardingRulesCommand{
+    protected SetPortForwardingRulesVpcCommand() {
+    }
+
+    public SetPortForwardingRulesVpcCommand(List<? extends PortForwardingRuleTO> pfRules) {
+        super(pfRules);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetSourceNatAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetSourceNatAnswer.java b/core/src/com/cloud/agent/api/routing/SetSourceNatAnswer.java
new file mode 100644
index 0000000..655f363
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetSourceNatAnswer.java
@@ -0,0 +1,27 @@
+// 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.agent.api.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class SetSourceNatAnswer extends Answer{
+    public SetSourceNatAnswer() {}
+
+    public SetSourceNatAnswer(SetSourceNatCommand cmd, boolean success, String result) {
+        super(cmd, success, result);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetSourceNatCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetSourceNatCommand.java b/core/src/com/cloud/agent/api/routing/SetSourceNatCommand.java
new file mode 100644
index 0000000..96aa001
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetSourceNatCommand.java
@@ -0,0 +1,42 @@
+// 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.agent.api.routing;
+
+import com.cloud.agent.api.to.IpAddressTO;
+
+public class SetSourceNatCommand extends NetworkElementCommand{
+    IpAddressTO ipAddress;
+    boolean add;
+
+    protected SetSourceNatCommand() {
+    }
+
+    public SetSourceNatCommand(IpAddressTO ip, boolean add) {
+        this.ipAddress = ip;
+        this.add = add;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public IpAddressTO getIpAddress() {
+        return ipAddress;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetStaticNatRulesAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetStaticNatRulesAnswer.java b/core/src/com/cloud/agent/api/routing/SetStaticNatRulesAnswer.java
new file mode 100644
index 0000000..9b5d09b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetStaticNatRulesAnswer.java
@@ -0,0 +1,37 @@
+// 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.agent.api.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class SetStaticNatRulesAnswer extends Answer {
+    String[] results;
+    protected SetStaticNatRulesAnswer() {
+        super();
+    }
+
+    public SetStaticNatRulesAnswer(SetStaticNatRulesCommand cmd, String[] results, boolean success) {
+        super(cmd, success, null);
+
+        assert(cmd.getRules().length == results.length) : "Shouldn't the results match the commands?";
+        this.results = results;
+    }
+
+    String[] getResults() {
+        return results;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetStaticNatRulesCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetStaticNatRulesCommand.java b/core/src/com/cloud/agent/api/routing/SetStaticNatRulesCommand.java
new file mode 100644
index 0000000..852d161
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetStaticNatRulesCommand.java
@@ -0,0 +1,47 @@
+// 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.agent.api.routing;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.StaticNatRuleTO;
+
+public class SetStaticNatRulesCommand extends NetworkElementCommand{
+
+    StaticNatRuleTO[] rules;
+    Long vpcId;
+
+    protected SetStaticNatRulesCommand() {
+    }
+
+    public SetStaticNatRulesCommand(List<? extends StaticNatRuleTO> staticNatRules, Long vpcId) {
+        rules = new StaticNatRuleTO[staticNatRules.size()];
+        int i = 0;
+        for (StaticNatRuleTO rule : staticNatRules) {
+            rules[i++] = rule;
+        }
+        this.vpcId = vpcId;
+    }
+
+    public StaticNatRuleTO[] getRules() {
+        return rules;
+    }
+
+    public Long getVpcId() {
+        return vpcId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java b/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java
new file mode 100644
index 0000000..76f5bb9
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetStaticRouteAnswer.java
@@ -0,0 +1,36 @@
+// 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.agent.api.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class SetStaticRouteAnswer extends Answer{
+    String[] results;
+
+    protected SetStaticRouteAnswer() {
+    }
+
+    public SetStaticRouteAnswer(SetStaticRouteCommand cmd, boolean success, String[] results) {
+        super(cmd, success, null);
+        assert (cmd.getStaticRoutes().length == results.length) : "Static routes and their results should be the same length";
+        this.results = results;
+    }
+
+    public String[] getResults() {
+        return results;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SetStaticRouteCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SetStaticRouteCommand.java b/core/src/com/cloud/agent/api/routing/SetStaticRouteCommand.java
new file mode 100644
index 0000000..c9c2056
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SetStaticRouteCommand.java
@@ -0,0 +1,62 @@
+// 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.agent.api.routing;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import com.cloud.network.vpc.StaticRoute;
+import com.cloud.network.vpc.StaticRouteProfile;
+import com.cloud.utils.net.NetUtils;
+
+public class SetStaticRouteCommand extends NetworkElementCommand{
+    StaticRouteProfile[] staticRoutes;
+
+    protected SetStaticRouteCommand() {
+    }
+
+    public SetStaticRouteCommand(List<StaticRouteProfile> staticRoutes) {
+        this.staticRoutes = staticRoutes.toArray(new StaticRouteProfile[staticRoutes.size()]);
+    }
+
+    public StaticRouteProfile[] getStaticRoutes() {
+        return staticRoutes;
+    }
+
+    public String[][] generateSRouteRules() {
+        String [][] result = new String [2][];
+        Set<String> toAdd = new HashSet<String>();
+        for (StaticRouteProfile route: staticRoutes) {
+            /*  example  :  ip:gateway:cidr,
+             */
+            String cidr = route.getCidr();
+            String subnet = NetUtils.getCidrSubNet(cidr);
+            String cidrSize = cidr.split("\\/")[1];
+            String entry;
+            if (route.getState() == StaticRoute.State.Active || route.getState() == StaticRoute.State.Add) {
+                entry = route.getIp4Address() + ":" + route.getGateway() + ":" + subnet + "/" + cidrSize;
+            } else {
+                entry = "Revoke:" + route.getGateway() + ":" + subnet + "/" + cidrSize;
+            }
+            toAdd.add(entry);
+        }
+        result[0] = toAdd.toArray(new String[toAdd.size()]);
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/Site2SiteVpnCfgCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/Site2SiteVpnCfgCommand.java b/core/src/com/cloud/agent/api/routing/Site2SiteVpnCfgCommand.java
new file mode 100644
index 0000000..8316303
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/Site2SiteVpnCfgCommand.java
@@ -0,0 +1,154 @@
+// 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.agent.api.routing;
+
+public class Site2SiteVpnCfgCommand extends NetworkElementCommand {
+
+    private boolean create;
+    private String localPublicIp;
+    private String localGuestCidr;
+    private String localPublicGateway;
+    private String peerGatewayIp;
+    private String peerGuestCidrList;
+    private String ipsecPsk;
+    private String ikePolicy;
+    private String espPolicy;
+    private long ikeLifetime;
+    private long espLifetime;
+    private boolean dpd;
+
+	@Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    public Site2SiteVpnCfgCommand () {
+        this.create = false;
+    }
+
+    public Site2SiteVpnCfgCommand (boolean create, String localPublicIp, String localPublicGateway, String localGuestCidr, String peerGatewayIp,
+            String peerGuestCidrList, String ikePolicy, String espPolicy, String ipsecPsk, Long ikeLifetime, Long espLifetime, Boolean dpd) {
+        this.create = create;
+        this.setLocalPublicIp(localPublicIp);
+        this.setLocalPublicGateway(localPublicGateway);
+        this.setLocalGuestCidr(localGuestCidr);
+        this.setPeerGatewayIp(peerGatewayIp);
+        this.setPeerGuestCidrList(peerGuestCidrList);
+        this.ipsecPsk = ipsecPsk;
+        this.ikePolicy = ikePolicy;
+        this.espPolicy = espPolicy;
+        this.ikeLifetime = ikeLifetime;
+        this.espLifetime = espLifetime;
+        this.dpd = dpd;
+    }
+
+    public boolean isCreate() {
+        return create;
+    }
+
+    public void setCreate(boolean create) {
+        this.create = create;
+    }
+
+    public String getIpsecPsk() {
+        return ipsecPsk;
+    }
+
+    public void setIpsecPsk(String ipsecPsk) {
+        this.ipsecPsk = ipsecPsk;
+    }
+
+    public String getIkePolicy() {
+        return ikePolicy;
+    }
+
+    public void setIkePolicy(String ikePolicy) {
+        this.ikePolicy = ikePolicy;
+    }
+
+    public String getEspPolicy() {
+        return espPolicy;
+    }
+
+    public void setEspPolicy(String espPolicy) {
+        this.espPolicy = espPolicy;
+    }
+
+    public long getIkeLifetime() {
+        return ikeLifetime;
+    }
+
+    public void setikeLifetime(long ikeLifetime) {
+        this.ikeLifetime = ikeLifetime;
+    }
+
+    public long getEspLifetime() {
+        return espLifetime;
+    }
+
+    public void setEspLifetime(long espLifetime) {
+        this.espLifetime = espLifetime;
+    }
+
+    public Boolean getDpd() {
+        return dpd;
+    }
+
+    public void setDpd(Boolean dpd) {
+        this.dpd = dpd;
+    }
+
+    public String getLocalPublicIp() {
+        return localPublicIp;
+    }
+
+    public void setLocalPublicIp(String localPublicIp) {
+        this.localPublicIp = localPublicIp;
+    }
+
+    public String getLocalGuestCidr() {
+        return localGuestCidr;
+    }
+
+    public void setLocalGuestCidr(String localGuestCidr) {
+        this.localGuestCidr = localGuestCidr;
+    }
+
+    public String getLocalPublicGateway() {
+        return localPublicGateway;
+    }
+
+    public void setLocalPublicGateway(String localPublicGateway) {
+        this.localPublicGateway = localPublicGateway;
+    }
+
+    public String getPeerGatewayIp() {
+        return peerGatewayIp;
+    }
+
+    public void setPeerGatewayIp(String peerGatewayIp) {
+        this.peerGatewayIp = peerGatewayIp;
+    }
+
+    public String getPeerGuestCidrList() {
+        return peerGuestCidrList;
+    }
+
+    public void setPeerGuestCidrList(String peerGuestCidrList) {
+        this.peerGuestCidrList = peerGuestCidrList;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/SiteLoadBalancerConfig.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/SiteLoadBalancerConfig.java b/core/src/com/cloud/agent/api/routing/SiteLoadBalancerConfig.java
new file mode 100644
index 0000000..cca5de8
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/SiteLoadBalancerConfig.java
@@ -0,0 +1,121 @@
+// 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.agent.api.routing;
+
+// details of site participating in the GLSB service, represents configuration load balancer rule and the zone
+// in which the rule is configured
+public class SiteLoadBalancerConfig {
+
+    // true if the site details are local to the zone receiving 'GlobalLoadBalancerConfigCommand'
+    boolean local;
+
+    // true if the site needs to be removed from GSLB service
+    boolean revoked;
+
+    // service type of the 'site load balanced' service
+    String serviceType;
+
+    // public IP corresponding to the site load balanced service
+    String servicePublicIp;
+
+    // port corresponding to the site load balanced service
+    String servicePort;
+
+    // Private IP corresponding to the GSLB service provider in the site.
+    String gslbProviderPrivateIp;
+
+    // Public IP corresponding to the GSLB service provider in the site.
+    String gslbProviderPublicIp;
+
+    // zone id in which site is located
+    long dataCenterId;
+
+    public SiteLoadBalancerConfig(boolean revoked, String serviceType, String servicePublicIp, String servicePort,
+                                  long dataCenterId) {
+        this.revoked = revoked;
+        this.serviceType = serviceType;
+        this.servicePublicIp = servicePublicIp;
+        this.servicePort = servicePort;
+        this.dataCenterId = dataCenterId;
+    }
+
+    public SiteLoadBalancerConfig(String gslbProviderPublicIP, String gslbProviderPrivateIp, boolean local,
+                                  boolean revoked, String serviceType, String servicePublicIp, String port,
+                                  long dataCenterId) {
+        this(revoked, serviceType, servicePublicIp, port, dataCenterId);
+        this.gslbProviderPrivateIp = gslbProviderPrivateIp;
+        this.gslbProviderPublicIp = gslbProviderPublicIP;
+        this.local = local;
+    }
+
+    public String getServiceType() {
+        return  serviceType;
+    }
+
+    public void setServiceType(String serviceType) {
+        this.serviceType = serviceType;
+    }
+
+    public String getServicePublicIp() {
+        return servicePublicIp;
+    }
+
+    public void SetServicePublicIp(String servicePublicIp) {
+        this.servicePublicIp = servicePublicIp;
+    }
+
+    public String getServicePort() {
+        return servicePort;
+    }
+
+    public void setServicePort(String port) {
+        this.servicePort = port;
+    }
+
+    public String getGslbProviderPrivateIp() {
+        return gslbProviderPrivateIp;
+    }
+
+    public void setGslbProviderPrivateIp(String privateIp) {
+        this.gslbProviderPrivateIp = privateIp;
+    }
+
+    public String getGslbProviderPublicIp() {
+        return gslbProviderPublicIp;
+    }
+
+    public long getDataCenterId() {
+        return  dataCenterId;
+    }
+
+    public void setGslbProviderPublicIp(String publicIp) {
+        this.gslbProviderPublicIp = publicIp;
+    }
+
+    public boolean isLocal() {
+        return local;
+    }
+
+    public void setLocal(boolean local) {
+        this.local = local;
+    }
+
+    public boolean forRevoke() {
+        return revoked;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/UserDataCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/UserDataCommand.java b/core/src/com/cloud/agent/api/routing/UserDataCommand.java
new file mode 100644
index 0000000..f7b38c8
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/UserDataCommand.java
@@ -0,0 +1,63 @@
+// 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.agent.api.routing;
+
+
+public class UserDataCommand extends NetworkElementCommand {
+
+    String userData;
+    String vmIpAddress;
+    String routerPrivateIpAddress;
+    String vmName;
+
+    protected UserDataCommand() {
+
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    public UserDataCommand(String userData, String vmIpAddress, String routerPrivateIpAddress, String vmName) {
+        this.userData = userData;
+        this.vmIpAddress = vmIpAddress;
+        this.routerPrivateIpAddress = routerPrivateIpAddress;
+        this.vmName = vmName;
+    }
+
+	public String getRouterPrivateIpAddress() {
+		return routerPrivateIpAddress;
+	}
+
+	public String getVmIpAddress() {
+		return vmIpAddress;
+	}
+
+	public String getVmName() {
+		return vmName;
+	}
+
+	public String getUserData() {
+		return userData;
+	}
+
+	public void setUserData(String userData) {
+		this.userData = userData;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/VmDataCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/VmDataCommand.java b/core/src/com/cloud/agent/api/routing/VmDataCommand.java
new file mode 100644
index 0000000..df88255
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/VmDataCommand.java
@@ -0,0 +1,67 @@
+// 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.agent.api.routing;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.cloud.agent.api.LogLevel;
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+
+public class VmDataCommand extends NetworkElementCommand {
+
+	String vmIpAddress;
+	String vmName;
+	@LogLevel(Log4jLevel.Trace)
+	List<String[]> vmData;
+
+    protected VmDataCommand() {
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    public VmDataCommand(String vmIpAddress) {
+    	this(vmIpAddress, null);
+    }
+
+    public String getVmName() {
+        return vmName;
+    }
+
+    public VmDataCommand(String vmIpAddress, String vmName) {
+        this.vmName = vmName;
+        this.vmIpAddress = vmIpAddress;
+        this.vmData = new ArrayList<String[]>();
+    }
+
+
+	public String getVmIpAddress() {
+		return vmIpAddress;
+	}
+
+	public List<String[]> getVmData() {
+		return vmData;
+	}
+
+	public void addVmData(String folder, String file, String contents) {
+		vmData.add(new String[]{folder, file, contents});
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java b/core/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java
new file mode 100644
index 0000000..ebe725d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java
@@ -0,0 +1,94 @@
+// 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.agent.api.routing;
+import java.util.List;
+
+import com.cloud.agent.api.LogLevel;
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.network.VpnUser;
+
+
+public class VpnUsersCfgCommand extends NetworkElementCommand {
+	public static class UsernamePassword{
+		private String username;
+	    @LogLevel(Log4jLevel.Off)
+		private String password;
+		boolean add = true;
+
+		public boolean isAdd() {
+			return add;
+		}
+		public void setAdd(boolean add) {
+			this.add = add;
+		}
+		public String getUsername() {
+			return username;
+		}
+		public void setUsername(String username) {
+			this.username = username;
+		}
+		public String getPassword() {
+			return password;
+		}
+		public void setPassword(String password) {
+			this.password = password;
+		}
+		public UsernamePassword(String username, String password) {
+			super();
+			this.username = username;
+			this.password = password;
+		}
+		public UsernamePassword(String username, String password, boolean add) {
+			super();
+			this.username = username;
+			this.password = password;
+			this.add = add;
+		}
+		protected UsernamePassword() {
+			//for Gson
+		}
+		public String getUsernamePassword() {
+			return getUsername() + "," + getPassword();
+		}
+	}
+	UsernamePassword [] userpwds;
+
+    protected VpnUsersCfgCommand() {
+
+    }
+
+    public VpnUsersCfgCommand(List<VpnUser> addUsers, List<VpnUser> removeUsers) {
+    	userpwds = new UsernamePassword[addUsers.size() + removeUsers.size()];
+    	int i = 0;
+    	for (VpnUser vpnUser: removeUsers) {
+    		userpwds[i++] = new UsernamePassword(vpnUser.getUsername(), vpnUser.getPassword(), false);
+    	}
+    	for (VpnUser vpnUser: addUsers) {
+    		userpwds[i++] = new UsernamePassword(vpnUser.getUsername(), vpnUser.getPassword(), true);
+    	}
+    }
+
+	@Override
+	public boolean executeInSequence() {
+		return true;
+	}
+
+	public UsernamePassword[] getUserpwds() {
+		return userpwds;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java b/core/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java
new file mode 100644
index 0000000..04b3d43
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java
@@ -0,0 +1,78 @@
+// 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.agent.api.storage;
+
+import com.cloud.storage.Storage.ImageFormat;
+
+public abstract class AbstractDownloadCommand extends ssCommand {
+
+    private String url;
+    private ImageFormat format;
+    private long accountId;
+    private String name;
+
+    protected AbstractDownloadCommand() {
+    }
+
+    protected AbstractDownloadCommand(String name, String url, ImageFormat format, long accountId) {
+    	assert(url != null);
+    	url = url.replace('\\', '/');
+
+        this.url = url;
+        this.format = format;
+        this.accountId = accountId;
+        this.name = name;
+    }
+
+    protected AbstractDownloadCommand(AbstractDownloadCommand that) {
+        super(that);
+        assert(that.url != null);
+
+        this.url = that.url.replace('\\', '/');
+        this.format = that.format;
+        this.accountId = that.accountId;
+        this.name = that.name;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public ImageFormat getFormat() {
+        return format;
+    }
+
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+	public void setUrl(String url) {
+		assert(url != null);
+		url = url.replace('\\', '/');
+		this.url = url;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/AbstractUploadCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/AbstractUploadCommand.java b/core/src/com/cloud/agent/api/storage/AbstractUploadCommand.java
new file mode 100644
index 0000000..49c04b1
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/AbstractUploadCommand.java
@@ -0,0 +1,68 @@
+// 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.agent.api.storage;
+
+import com.cloud.storage.Storage.ImageFormat;
+
+public class AbstractUploadCommand  extends StorageCommand{
+
+
+    private String url;
+    private ImageFormat format;
+    private long accountId;
+    private String name;
+
+    protected AbstractUploadCommand() {
+    }
+
+    protected AbstractUploadCommand(String name, String url, ImageFormat format, long accountId) {
+        this.url = url;
+        this.format = format;
+        this.accountId = accountId;
+        this.name = name;
+    }
+
+    protected AbstractUploadCommand(AbstractUploadCommand that) {
+        this(that.name, that.url, that.format, that.accountId);
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public ImageFormat getFormat() {
+        return format;
+    }
+
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+	public void setUrl(String url) {
+		this.url = url;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java b/core/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java
new file mode 100644
index 0000000..8c55ac3
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java
@@ -0,0 +1,42 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+
+public class CopyVolumeAnswer extends Answer {
+	private String volumeFolder;
+	private String volumePath;
+
+	protected CopyVolumeAnswer() {
+    }
+
+	public CopyVolumeAnswer(Command command, boolean success, String details, String volumeFolder, String volumePath) {
+		super(command, success, details);
+		this.volumeFolder = volumeFolder;
+		this.volumePath = volumePath;
+	}
+
+	public String getVolumeFolder() {
+		return volumeFolder;
+	}
+
+	public String getVolumePath() {
+		return volumePath;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/CopyVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/CopyVolumeCommand.java b/core/src/com/cloud/agent/api/storage/CopyVolumeCommand.java
new file mode 100644
index 0000000..3d05e9b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/CopyVolumeCommand.java
@@ -0,0 +1,72 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.StoragePool;
+
+public class CopyVolumeCommand extends Command {
+
+	long volumeId;
+	String volumePath;
+	StorageFilerTO pool;
+	String secondaryStorageURL;
+	boolean toSecondaryStorage;
+	String vmName;
+
+	public CopyVolumeCommand() {
+	}
+
+	public CopyVolumeCommand(long volumeId, String volumePath, StoragePool pool, String secondaryStorageURL, boolean toSecondaryStorage, int wait) {
+		this.volumeId = volumeId;
+		this.volumePath = volumePath;
+		this.pool = new StorageFilerTO(pool);
+		this.secondaryStorageURL = secondaryStorageURL;
+		this.toSecondaryStorage = toSecondaryStorage;
+		setWait(wait);
+	}
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+	public String getVolumePath() {
+		return volumePath;
+	}
+
+	public long getVolumeId() {
+		return volumeId;
+	}
+
+	public StorageFilerTO getPool() {
+		return pool;
+	}
+
+	public String getSecondaryStorageURL() {
+		return secondaryStorageURL;
+	}
+
+	public boolean toSecondaryStorage() {
+		return toSecondaryStorage;
+	}
+
+	public String getVmName() {
+		return vmName;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/CreateAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/CreateAnswer.java b/core/src/com/cloud/agent/api/storage/CreateAnswer.java
new file mode 100644
index 0000000..ab6cc03
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/CreateAnswer.java
@@ -0,0 +1,53 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.to.VolumeTO;
+
+public class CreateAnswer extends Answer {
+    VolumeTO volume;
+    boolean requestTemplateReload = false;
+    protected CreateAnswer() {
+    }
+
+    public CreateAnswer(CreateCommand cmd, VolumeTO volume) {
+        super(cmd, true, null);
+        this.volume = volume;
+    }
+
+    public CreateAnswer(CreateCommand cmd, String details) {
+        super(cmd, false, details);
+    }
+
+    public CreateAnswer(CreateCommand cmd, String details, boolean requestTemplateReload) {
+        super(cmd, false, details);
+        this.requestTemplateReload = requestTemplateReload;
+    }
+
+    public CreateAnswer(CreateCommand cmd, Exception e) {
+        super(cmd, e);
+    }
+
+    public VolumeTO getVolume() {
+        return volume;
+    }
+
+    public boolean templateReloadRequested() {
+    	return requestTemplateReload;
+    }
+}


[48/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/MigrateWithStorageSendAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/MigrateWithStorageSendAnswer.java b/api/src/com/cloud/agent/api/MigrateWithStorageSendAnswer.java
deleted file mode 100644
index 7cf641f..0000000
--- a/api/src/com/cloud/agent/api/MigrateWithStorageSendAnswer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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.agent.api;
-
-import java.util.Set;
-import com.cloud.agent.api.to.VolumeTO;
-
-public class MigrateWithStorageSendAnswer extends Answer {
-
-    Set<VolumeTO> volumeToSet;
-
-    public MigrateWithStorageSendAnswer(MigrateWithStorageSendCommand cmd, Exception ex) {
-        super(cmd, ex);
-        volumeToSet = null;
-    }
-
-    public MigrateWithStorageSendAnswer(MigrateWithStorageSendCommand cmd, Set<VolumeTO> volumeToSet) {
-        super(cmd, true, null);
-        this.volumeToSet = volumeToSet;
-    }
-
-    public Set<VolumeTO> getVolumeToSet() {
-        return volumeToSet;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/MigrateWithStorageSendCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/MigrateWithStorageSendCommand.java b/api/src/com/cloud/agent/api/MigrateWithStorageSendCommand.java
deleted file mode 100644
index d10db30..0000000
--- a/api/src/com/cloud/agent/api/MigrateWithStorageSendCommand.java
+++ /dev/null
@@ -1,58 +0,0 @@
-// 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.agent.api;
-
-import java.util.Map;
-import com.cloud.agent.api.to.VirtualMachineTO;
-import com.cloud.agent.api.to.VolumeTO;
-import com.cloud.agent.api.to.NicTO;
-
-public class MigrateWithStorageSendCommand extends Command {
-    VirtualMachineTO vm;
-    Map<VolumeTO, Object> volumeToSr;
-    Map<NicTO, Object> nicToNetwork;
-    Map<String, String> token;
-
-    public MigrateWithStorageSendCommand(VirtualMachineTO vm, Map<VolumeTO, Object> volumeToSr,
-            Map<NicTO, Object> nicToNetwork, Map<String, String> token) {
-        this.vm = vm;
-        this.volumeToSr = volumeToSr;
-        this.nicToNetwork = nicToNetwork;
-        this.token = token;
-    }
-
-    public VirtualMachineTO getVirtualMachine() {
-        return vm;
-    }
-
-    public Map<VolumeTO, Object> getVolumeToSr() {
-        return volumeToSr;
-    }
-
-    public Map<NicTO, Object> getNicToNetwork() {
-        return nicToNetwork;
-    }
-
-    public Map<String, String> getToken() {
-        return token;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ModifySshKeysCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ModifySshKeysCommand.java b/api/src/com/cloud/agent/api/ModifySshKeysCommand.java
deleted file mode 100644
index c078973..0000000
--- a/api/src/com/cloud/agent/api/ModifySshKeysCommand.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-
-public class ModifySshKeysCommand extends Command {
-    @LogLevel(Log4jLevel.Off)
-    private String _pubKey;
-    @LogLevel(Log4jLevel.Off)
-    private String _prvKey;
-
-    public ModifySshKeysCommand() {
-
-    }
-    public ModifySshKeysCommand(String pubKey, String prvKey) {
-        _pubKey = pubKey;
-        _prvKey = prvKey;
-    }
-    public String getPubKey() {
-        return _pubKey;
-    }
-    public String getPrvKey() {
-        return _prvKey;
-    }
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ModifyStoragePoolAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ModifyStoragePoolAnswer.java b/api/src/com/cloud/agent/api/ModifyStoragePoolAnswer.java
deleted file mode 100644
index df77985..0000000
--- a/api/src/com/cloud/agent/api/ModifyStoragePoolAnswer.java
+++ /dev/null
@@ -1,57 +0,0 @@
-// 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.agent.api;
-
-import java.util.Map;
-
-import com.cloud.storage.template.TemplateInfo;
-
-public class ModifyStoragePoolAnswer extends Answer {
-    StoragePoolInfo poolInfo;
-    Map<String, TemplateInfo> templateInfo;
-
-    protected ModifyStoragePoolAnswer() {
-    }
-
-    public ModifyStoragePoolAnswer(ModifyStoragePoolCommand cmd, long capacityBytes, long availableBytes, Map<String, TemplateInfo> tInfo) {
-        super(cmd);
-        this.result = true;
-        this.poolInfo = new StoragePoolInfo(null,
-                cmd.getPool().getHost(), cmd.getPool().getPath(), cmd.getLocalPath(),
-                cmd.getPool().getType(), capacityBytes, availableBytes );
-
-        this.templateInfo = tInfo;
-    }
-
-    public StoragePoolInfo getPoolInfo() {
-       return poolInfo;
-    }
-
-    public void setPoolInfo(StoragePoolInfo poolInfo) {
-        this.poolInfo = poolInfo;
-    }
-
-
-    public Map<String, TemplateInfo> getTemplateInfo() {
-        return templateInfo;
-    }
-
-    public void setTemplateInfo(Map<String, TemplateInfo> templateInfo) {
-        this.templateInfo = templateInfo;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ModifyStoragePoolCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ModifyStoragePoolCommand.java b/api/src/com/cloud/agent/api/ModifyStoragePoolCommand.java
deleted file mode 100644
index 8bc956d..0000000
--- a/api/src/com/cloud/agent/api/ModifyStoragePoolCommand.java
+++ /dev/null
@@ -1,75 +0,0 @@
-// 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.agent.api;
-
-import java.io.File;
-import java.util.UUID;
-
-import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.storage.StoragePool;
-
-public class ModifyStoragePoolCommand extends Command {
-
-	boolean add;
-	StorageFilerTO pool;
-    String localPath;
-	String [] options;
-	public static final String LOCAL_PATH_PREFIX="/mnt/";
-
-
-	public ModifyStoragePoolCommand() {
-
-	}
-
-    public ModifyStoragePoolCommand(boolean add, StoragePool pool, String localPath) {
-    	this.add = add;
-    	this.pool = new StorageFilerTO(pool);
-        this.localPath = localPath;
-
-    }
-
-    public ModifyStoragePoolCommand(boolean add, StoragePool pool) {
-		this(add, pool, LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes()));
-	}
-
-    public StorageFilerTO getPool() {
-        return pool;
-    }
-
-    public void setPool(StoragePool pool) {
-        this.pool = new StorageFilerTO(pool);
-    }
-
-	public boolean getAdd() {
-    	return add;
-    }
-
-	@Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-	public String getLocalPath() {
-		return localPath;
-	}
-
-	public void setOptions(String[] options) {
-		this.options = options;
-	}
-
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/NetworkUsageAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/NetworkUsageAnswer.java b/api/src/com/cloud/agent/api/NetworkUsageAnswer.java
deleted file mode 100644
index fd8ebda..0000000
--- a/api/src/com/cloud/agent/api/NetworkUsageAnswer.java
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-
-@LogLevel(Log4jLevel.Debug)
-public class NetworkUsageAnswer extends Answer {
-	String routerName;
-	Long bytesSent;
-    Long bytesReceived;
-
-    protected NetworkUsageAnswer() {
-    }
-
-    public NetworkUsageAnswer(NetworkUsageCommand cmd, String details, Long bytesSent, Long bytesReceived) {
-        super(cmd, true, details);
-        this.bytesReceived = bytesReceived;
-        this.bytesSent = bytesSent;
-        routerName = cmd.getDomRName();
-    }
-
-    public NetworkUsageAnswer(Command command, Exception e) {
-        super(command, e);
-    }
-
-
-    public void setBytesReceived(Long bytesReceived) {
-        this.bytesReceived = bytesReceived;
-    }
-
-    public Long getBytesReceived() {
-        return bytesReceived;
-    }
-
-    public void setBytesSent(Long bytesSent) {
-        this.bytesSent = bytesSent;
-    }
-
-    public Long getBytesSent() {
-        return bytesSent;
-    }
-
-	public String getRouterName() {
-		return routerName;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/NetworkUsageCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/NetworkUsageCommand.java b/api/src/com/cloud/agent/api/NetworkUsageCommand.java
deleted file mode 100644
index 6cbf93b..0000000
--- a/api/src/com/cloud/agent/api/NetworkUsageCommand.java
+++ /dev/null
@@ -1,98 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-
-@LogLevel(Log4jLevel.Trace)
-public class NetworkUsageCommand extends Command {
-    private String privateIP;
-    private String domRName;
-    private String option;
-    boolean forVpc = false;
-    private String gatewayIP;
-    private String vpcCIDR;
-
-    protected NetworkUsageCommand() {
-
-    }
-
-    public NetworkUsageCommand(String privateIP, String domRName, boolean forVpc, String gatewayIP)
-    {
-        this.privateIP = privateIP;
-        this.domRName = domRName;
-        this.forVpc = forVpc;
-        this.gatewayIP = gatewayIP;
-        this.option = "get";
-    }
-
-    public NetworkUsageCommand(String privateIP, String domRName, String option, boolean forVpc)
-    {
-        this.privateIP = privateIP;
-        this.domRName = domRName;
-        this.option = option;
-        this.forVpc = forVpc;
-    }
-
-    public NetworkUsageCommand(String privateIP, String domRName, boolean forVpc, String gatewayIP, String vpcCIDR)
-    {
-        this.privateIP = privateIP;
-        this.domRName = domRName;
-        this.forVpc = forVpc;
-        this.gatewayIP = gatewayIP;
-        this.option = "create";
-        this.vpcCIDR = vpcCIDR;
-    }
-
-    public NetworkUsageCommand(String privateIP, String domRName, String option, boolean forVpc, String gatewayIP)
-    {
-        this.privateIP = privateIP;
-        this.domRName = domRName;
-        this.forVpc = forVpc;
-        this.gatewayIP = gatewayIP;
-        this.option = option;
-    }
-
-    public String getPrivateIP() {
-        return privateIP;
-    }
-
-    public String getDomRName() {
-        return domRName;
-    }
-
-    public String getOption() {
-        return option;
-    }
-
-    public boolean isForVpc() {
-        return forVpc;
-    }
-
-	public String getVpcCIDR() {
-		return vpcCIDR;
-	}
-
-	public String getGatewayIP() {
-		return gatewayIP;
-	}
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/PingAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/PingAnswer.java b/api/src/com/cloud/agent/api/PingAnswer.java
deleted file mode 100644
index d9ed89c..0000000
--- a/api/src/com/cloud/agent/api/PingAnswer.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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.agent.api;
-
-public class PingAnswer extends Answer {
-    private PingCommand _command = null;
-
-    protected PingAnswer() {
-    }
-
-    public PingAnswer(PingCommand cmd) {
-        super(cmd);
-        _command = cmd;
-    }
-
-    public PingCommand getCommand() {
-        return _command;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/PingCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/PingCommand.java b/api/src/com/cloud/agent/api/PingCommand.java
deleted file mode 100755
index 8d9681f..0000000
--- a/api/src/com/cloud/agent/api/PingCommand.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.host.Host;
-
-public class PingCommand extends Command {
-    Host.Type hostType;
-    long hostId;
-
-    protected PingCommand() {
-    }
-
-    public PingCommand(Host.Type type, long id) {
-        hostType = type;
-        hostId = id;
-    }
-
-    public Host.Type getHostType() {
-        return hostType;
-    }
-
-    public long getHostId() {
-        return hostId;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
- }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/PingRoutingCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/PingRoutingCommand.java b/api/src/com/cloud/agent/api/PingRoutingCommand.java
deleted file mode 100755
index e25ac62..0000000
--- a/api/src/com/cloud/agent/api/PingRoutingCommand.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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.agent.api;
-
-import java.util.Map;
-
-import com.cloud.host.Host;
-import com.cloud.vm.VirtualMachine.State;
-
-public class PingRoutingCommand extends PingCommand {
-    Map<String, State> newStates;
-    boolean _gatewayAccessible = true;
-    boolean _vnetAccessible = true;
-
-    protected PingRoutingCommand() {
-    }
-
-    public PingRoutingCommand(Host.Type type, long id, Map<String, State> states) {
-        super(type, id);
-        this.newStates = states;
-    }
-
-    public Map<String, State> getNewStates() {
-        return newStates;
-    }
-
-    public boolean isGatewayAccessible() {
-        return _gatewayAccessible;
-    }
-    public void setGatewayAccessible(boolean gatewayAccessible) {
-        _gatewayAccessible = gatewayAccessible;
-    }
-
-    public boolean isVnetAccessible() {
-        return _vnetAccessible;
-    }
-    public void setVnetAccessible(boolean vnetAccessible) {
-        _vnetAccessible = vnetAccessible;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java b/api/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java
deleted file mode 100644
index 51226bc..0000000
--- a/api/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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.agent.api;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.cloud.host.Host;
-import com.cloud.utils.Pair;
-import com.cloud.vm.VirtualMachine.State;
-
-
-public class PingRoutingWithNwGroupsCommand extends PingRoutingCommand {
-	HashMap<String, Pair<Long, Long>> newGroupStates;
-
-	protected PingRoutingWithNwGroupsCommand() {
-		super();
-	}
-
-	public PingRoutingWithNwGroupsCommand(Host.Type type, long id, Map<String, State> states, HashMap<String, Pair<Long, Long>> nwGrpStates) {
-		super(type, id, states);
-		newGroupStates = nwGrpStates;
-	}
-
-	public HashMap<String, Pair<Long, Long>> getNewGroupStates() {
-		return newGroupStates;
-	}
-
-	public void setNewGroupStates(HashMap<String, Pair<Long, Long>> newGroupStates) {
-		this.newGroupStates = newGroupStates;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java b/api/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java
deleted file mode 100644
index d44987b..0000000
--- a/api/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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.agent.api;
-
-import java.util.List;
-import java.util.Map;
-
-import com.cloud.host.Host;
-import com.cloud.utils.Pair;
-import com.cloud.vm.VirtualMachine.State;
-
-public class PingRoutingWithOvsCommand extends PingRoutingCommand {
-	List<Pair<String, Long>> states;
-
-	protected PingRoutingWithOvsCommand() {
-		super();
-	}
-
-	public PingRoutingWithOvsCommand(Host.Type type, long id,
-			Map<String, State> states, List<Pair<String, Long>> ovsStates) {
-		super(type, id, states);
-		this.states = ovsStates;
-	}
-
-	public List<Pair<String, Long>> getStates() {
-		return states;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/PingStorageCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/PingStorageCommand.java b/api/src/com/cloud/agent/api/PingStorageCommand.java
deleted file mode 100755
index 438ab50..0000000
--- a/api/src/com/cloud/agent/api/PingStorageCommand.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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.agent.api;
-
-import java.util.Map;
-
-import com.cloud.host.Host;
-
-public class PingStorageCommand extends PingCommand {
-    Map<String, Boolean> changes;
-
-    protected PingStorageCommand() {
-    }
-
-    public PingStorageCommand(Host.Type type, long id, Map<String, Boolean> changes) {
-        super(type, id);
-        this.changes = changes;
-    }
-
-    public Map<String, Boolean> getChanges() {
-        return changes;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/PingTestCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/PingTestCommand.java b/api/src/com/cloud/agent/api/PingTestCommand.java
deleted file mode 100644
index 69c6efa..0000000
--- a/api/src/com/cloud/agent/api/PingTestCommand.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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.agent.api;
-
-public class PingTestCommand extends Command {
-
-    String _computingHostIp = null;
-    String _routerIp = null;
-    String _privateIp = null;
-
-    public PingTestCommand() {}
-
-    public PingTestCommand(String computingHostIp) {
-        _computingHostIp = computingHostIp;
-        setWait(20);
-    }
-
-    public PingTestCommand(String routerIp, String privateIp) {
-        _routerIp = routerIp;
-        _privateIp = privateIp;
-        setWait(20);
-    }
-
-    public String getComputingHostIp() {
-        return _computingHostIp;
-    }
-
-    public String getRouterIp() {
-        return _routerIp;
-    }
-
-    public String getPrivateIp() {
-        return _privateIp;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/PlugNicAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/PlugNicAnswer.java b/api/src/com/cloud/agent/api/PlugNicAnswer.java
deleted file mode 100644
index 90d31bd..0000000
--- a/api/src/com/cloud/agent/api/PlugNicAnswer.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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.agent.api;
-
-public class PlugNicAnswer extends Answer{
-    public PlugNicAnswer() {}
-
-    public PlugNicAnswer(PlugNicCommand cmd, boolean success, String result) {
-        super(cmd, success, result);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/PlugNicCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/PlugNicCommand.java b/api/src/com/cloud/agent/api/PlugNicCommand.java
deleted file mode 100644
index b896e45..0000000
--- a/api/src/com/cloud/agent/api/PlugNicCommand.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.to.NicTO;
-
-public class PlugNicCommand extends Command {
-
-    NicTO nic;
-    String instanceName;
-
-    public NicTO getNic() {
-        return nic;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    protected PlugNicCommand() {
-    }
-
-    public PlugNicCommand(NicTO nic, String instanceName) {
-        this.nic = nic;
-        this.instanceName = instanceName;
-    }
-
-    public String getVmName() {
-        return instanceName;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/PoolEjectCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/PoolEjectCommand.java b/api/src/com/cloud/agent/api/PoolEjectCommand.java
deleted file mode 100644
index 3085042..0000000
--- a/api/src/com/cloud/agent/api/PoolEjectCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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.agent.api;
-
-public class PoolEjectCommand extends Command {
-    private String hostuuid;
-
-	public String getHostuuid() {
-        return hostuuid;
-    }
-
-    public void setHostuuid(String hostuuid) {
-        this.hostuuid = hostuuid;
-    }
-    public PoolEjectCommand() {
-		super();
-	}
-    public PoolEjectCommand(String hostuuid) {
-        super();
-        setHostuuid(hostuuid);
-    }
-
-	@Override
-	public boolean executeInSequence() {
-		return true;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/PrepareForMigrationAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/PrepareForMigrationAnswer.java b/api/src/com/cloud/agent/api/PrepareForMigrationAnswer.java
deleted file mode 100644
index 1b215bc..0000000
--- a/api/src/com/cloud/agent/api/PrepareForMigrationAnswer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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.agent.api;
-
-public class PrepareForMigrationAnswer extends Answer {
-    protected PrepareForMigrationAnswer() {
-    }
-
-    public PrepareForMigrationAnswer(PrepareForMigrationCommand cmd, String detail) {
-        super(cmd, false, detail);
-    }
-
-    public PrepareForMigrationAnswer(PrepareForMigrationCommand cmd, Exception ex) {
-        super(cmd, ex);
-    }
-
-    public PrepareForMigrationAnswer(PrepareForMigrationCommand cmd) {
-        super(cmd, true, null);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/PrepareForMigrationCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/PrepareForMigrationCommand.java b/api/src/com/cloud/agent/api/PrepareForMigrationCommand.java
deleted file mode 100644
index c0e1368..0000000
--- a/api/src/com/cloud/agent/api/PrepareForMigrationCommand.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.to.VirtualMachineTO;
-
-public class PrepareForMigrationCommand extends Command {
-    VirtualMachineTO vm;
-
-    protected PrepareForMigrationCommand() {
-    }
-
-    public PrepareForMigrationCommand(VirtualMachineTO vm) {
-    	this.vm = vm;
-    }
-
-    public VirtualMachineTO getVirtualMachine() {
-    	return vm;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/PrepareOCFS2NodesCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/PrepareOCFS2NodesCommand.java b/api/src/com/cloud/agent/api/PrepareOCFS2NodesCommand.java
deleted file mode 100755
index 0c80bfa..0000000
--- a/api/src/com/cloud/agent/api/PrepareOCFS2NodesCommand.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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.agent.api;
-
-import java.util.List;
-
-import com.cloud.utils.Ternary;
-
-public class PrepareOCFS2NodesCommand extends Command {
-    List<Ternary<Integer, String, String>> nodes;
-    String clusterName;
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public PrepareOCFS2NodesCommand(String clusterName, List<Ternary<Integer, String, String>> nodes) {
-        this.nodes = nodes;
-        this.clusterName = clusterName;
-    }
-
-    public List<Ternary<Integer, String, String>> getNodes() {
-        return nodes;
-    }
-
-    public String getClusterName() {
-        return clusterName;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/PropagateResourceEventCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/PropagateResourceEventCommand.java b/api/src/com/cloud/agent/api/PropagateResourceEventCommand.java
deleted file mode 100755
index 45cd4b3..0000000
--- a/api/src/com/cloud/agent/api/PropagateResourceEventCommand.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.resource.ResourceState;
-
-public class PropagateResourceEventCommand extends Command {
-    long hostId;
-    ResourceState.Event event;
-
-    protected PropagateResourceEventCommand() {
-
-    }
-
-    public PropagateResourceEventCommand(long hostId, ResourceState.Event event) {
-        this.hostId = hostId;
-        this.event = event;
-    }
-
-    public long getHostId() {
-        return hostId;
-    }
-
-    public ResourceState.Event getEvent() {
-        return event;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ReadyAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ReadyAnswer.java b/api/src/com/cloud/agent/api/ReadyAnswer.java
deleted file mode 100644
index b5dd0b7..0000000
--- a/api/src/com/cloud/agent/api/ReadyAnswer.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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.agent.api;
-
-public class ReadyAnswer extends Answer {
-	protected ReadyAnswer() {
-	}
-
-	public ReadyAnswer(ReadyCommand cmd) {
-		super(cmd, true, null);
-	}
-
-	public ReadyAnswer(ReadyCommand cmd, String details) {
-		super(cmd, false, details);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ReadyCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ReadyCommand.java b/api/src/com/cloud/agent/api/ReadyCommand.java
deleted file mode 100644
index c6ca799..0000000
--- a/api/src/com/cloud/agent/api/ReadyCommand.java
+++ /dev/null
@@ -1,58 +0,0 @@
-// 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.agent.api;
-
-public class ReadyCommand extends Command {
-	private String _details;
-	public ReadyCommand() {
-		super();
-	}
-
-	private Long dcId;
-	private Long hostId;
-
-	public ReadyCommand(Long dcId) {
-		super();
-		this.dcId = dcId;
-	}
-
-	public ReadyCommand(Long dcId, Long hostId) {
-	    this(dcId);
-	    this.hostId = hostId;
-	}
-
-	public void setDetails(String details) {
-		_details = details;
-	}
-
-	public String getDetails() {
-		return _details;
-	}
-
-	public Long getDataCenterId() {
-		return dcId;
-	}
-
-	@Override
-	public boolean executeInSequence() {
-		return true;
-	}
-
-    public Long getHostId() {
-        return hostId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/RebootAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/RebootAnswer.java b/api/src/com/cloud/agent/api/RebootAnswer.java
deleted file mode 100644
index 244bf1e..0000000
--- a/api/src/com/cloud/agent/api/RebootAnswer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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.agent.api;
-
-public class RebootAnswer extends Answer {
-    Integer vncPort;
-
-    protected RebootAnswer() {
-    }
-
-    public RebootAnswer(RebootCommand cmd, String details, Integer vncport) {
-        super(cmd, true, details);
-        this.vncPort = vncport;
-    }
-
-    public RebootAnswer(RebootCommand cmd, String details, boolean success) {
-        super(cmd, success, details);
-        this.vncPort = null;
-    }
-
-    public RebootAnswer(RebootCommand cmd, Exception e) {
-        super(cmd, e);
-    }
-
-    public Integer getVncPort() {
-    	return vncPort;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/RebootCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/RebootCommand.java b/api/src/com/cloud/agent/api/RebootCommand.java
deleted file mode 100755
index 49712b6..0000000
--- a/api/src/com/cloud/agent/api/RebootCommand.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.hypervisor.Hypervisor;
-import com.cloud.vm.VirtualMachine;
-
-public class RebootCommand extends Command {
-    String vmName;
-
-    protected RebootCommand() {
-    }
-
-    public RebootCommand(VirtualMachine vm) {
-        vmName = vm.getInstanceName();
-    }
-
-    public RebootCommand(String vmName) {
-        this.vmName = vmName;
-    }
-
-    public String getVmName() {
-        return vmName;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/RebootRouterCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/RebootRouterCommand.java b/api/src/com/cloud/agent/api/RebootRouterCommand.java
deleted file mode 100644
index c5027b3..0000000
--- a/api/src/com/cloud/agent/api/RebootRouterCommand.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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.agent.api;
-
-
-public class RebootRouterCommand extends RebootCommand {
-
-	protected String privateIp;
-
-	protected RebootRouterCommand() {
-	}
-
-
-	public RebootRouterCommand(String vmName, String privateIp) {
-		super(vmName);
-		this.privateIp=privateIp;
-	}
-
-
-	public String getPrivateIpAddress() {
-		return privateIp;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java b/api/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java
deleted file mode 100644
index 848ffc0..0000000
--- a/api/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java
+++ /dev/null
@@ -1,63 +0,0 @@
-// 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.agent.api;
-
-import java.util.List;
-
-import com.cloud.agent.api.to.VolumeTO;
-import com.cloud.vm.VirtualMachine;
-
-public class RevertToVMSnapshotAnswer extends Answer {
-
-    private List<VolumeTO> volumeTOs;
-    private VirtualMachine.State vmState;
-
-    public RevertToVMSnapshotAnswer(RevertToVMSnapshotCommand cmd, boolean result,
-            String message) {
-        super(cmd, result, message);
-    }
-
-    public RevertToVMSnapshotAnswer() {
-        super();
-    }
-
-    public RevertToVMSnapshotAnswer(RevertToVMSnapshotCommand cmd,
-            List<VolumeTO> volumeTOs,
-            VirtualMachine.State vmState) {
-        super(cmd, true, "");
-        this.volumeTOs = volumeTOs;
-        this.vmState = vmState;
-    }
-
-    public VirtualMachine.State getVmState() {
-        return vmState;
-    }
-
-    public List<VolumeTO> getVolumeTOs() {
-        return volumeTOs;
-    }
-
-    public void setVolumeTOs(List<VolumeTO> volumeTOs) {
-        this.volumeTOs = volumeTOs;
-    }
-
-    public void setVmState(VirtualMachine.State vmState) {
-        this.vmState = vmState;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java b/api/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
deleted file mode 100644
index 429a186..0000000
--- a/api/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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.agent.api;
-
-import java.util.List;
-
-import com.cloud.agent.api.to.VolumeTO;
-
-public class RevertToVMSnapshotCommand extends VMSnapshotBaseCommand {
-
-    public RevertToVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType) {
-        super(vmName, snapshot, volumeTOs, guestOSType);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ScaleVmAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ScaleVmAnswer.java b/api/src/com/cloud/agent/api/ScaleVmAnswer.java
deleted file mode 100644
index 31d6e44..0000000
--- a/api/src/com/cloud/agent/api/ScaleVmAnswer.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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.agent.api;
-
-public class ScaleVmAnswer extends Answer {
-
-    protected ScaleVmAnswer() {
-    }
-    
-    public ScaleVmAnswer(ScaleVmCommand cmd, boolean result, String detail) {
-        super(cmd, result, detail);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ScaleVmCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ScaleVmCommand.java b/api/src/com/cloud/agent/api/ScaleVmCommand.java
deleted file mode 100644
index 35d22ad..0000000
--- a/api/src/com/cloud/agent/api/ScaleVmCommand.java
+++ /dev/null
@@ -1,113 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.to.VirtualMachineTO;
-
-public class ScaleVmCommand extends Command {
-
-    VirtualMachineTO vm;
-    String vmName;
-    int cpus;
-    Integer speed;
-    long minRam;
-    long maxRam;
-    
-    public VirtualMachineTO getVm() {
-		return vm;
-	}
-
-	public void setVm(VirtualMachineTO vm) {
-		this.vm = vm;
-	}
-
-	public int getCpus() {
-		return cpus;
-	}
-
-	public ScaleVmCommand(String vmName, int cpus,
-			Integer speed, long minRam, long maxRam, boolean limitCpuUse) {
-		super();
-		this.vmName = vmName;
-		this.cpus = cpus;
-		this.speed = speed;
-		this.minRam = minRam;
-		this.maxRam = maxRam;
-		this.vm = new VirtualMachineTO(1L, vmName, null, cpus, speed, minRam, maxRam, null, null, false, false, null);
-		/*vm.setName(vmName);
-		vm.setCpus(cpus);
-		vm.setRam(minRam, maxRam);*/
-	}
-
-	public void setCpus(int cpus) {
-		this.cpus = cpus;
-	}
-
-	public Integer getSpeed() {
-		return speed;
-	}
-
-	public void setSpeed(Integer speed) {
-		this.speed = speed;
-	}
-
-	public long getMinRam() {
-		return minRam;
-	}
-
-	public void setMinRam(long minRam) {
-		this.minRam = minRam;
-	}
-
-	public long getMaxRam() {
-		return maxRam;
-	}
-
-	public void setMaxRam(long maxRam) {
-		this.maxRam = maxRam;
-	}
-
-	public String getVmName() {
-		return vmName;
-	}
-
-	public void setVmName(String vmName) {
-		this.vmName = vmName;
-	}
-
-	public VirtualMachineTO getVirtualMachine() {
-        return vm;
-    }
-    
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-    
-    protected ScaleVmCommand() {
-    }
-    
-    public ScaleVmCommand(VirtualMachineTO vm) {
-        this.vm = vm;
-    }
-
-	public boolean getLimitCpuUse() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java b/api/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java
deleted file mode 100755
index e938de7..0000000
--- a/api/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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.agent.api;
-
-/*
- * This is used to schedule an explicit host scan in MS peers. Currently used during
- * add host operation so that correct MS can take host ownership. On receiving the
- * command the scan is scheduled immediately.
- */
-public class ScheduleHostScanTaskCommand extends Command {
-    public ScheduleHostScanTaskCommand() {
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false; // standalone command and can be executed independent of other commands
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java b/api/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java
deleted file mode 100755
index 41a779b..0000000
--- a/api/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java
+++ /dev/null
@@ -1,82 +0,0 @@
-// 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.agent.api;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SecStorageFirewallCfgCommand extends Command {
-
-	public static class PortConfig {
-		boolean add;
-		String sourceIp;
-		String port;
-		String intf;
-		public PortConfig(String sourceIp, String port, boolean add, String intf) {
-			this.add = add;
-			this.sourceIp = sourceIp;
-			this.port = port;
-			this.intf = intf;
-		}
-		public PortConfig() {
-
-		}
-		public boolean isAdd() {
-			return add;
-		}
-		public String getSourceIp() {
-			return sourceIp;
-		}
-		public String getPort() {
-			return port;
-		}
-		public String getIntf() {
-			return intf;
-		}
-	}
-
-	private List<PortConfig> portConfigs = new ArrayList<PortConfig>();
-	private boolean isAppendAIp = false;
-
-	public SecStorageFirewallCfgCommand() {
-
-	}
-
-	public SecStorageFirewallCfgCommand(boolean isAppend) {
-    	this.isAppendAIp = isAppend;
-	}
-
-    public void addPortConfig(String sourceIp, String port, boolean add, String intf) {
-    	PortConfig pc = new PortConfig(sourceIp, port, add, intf);
-    	this.portConfigs.add(pc);
-
-    }
-
-	public boolean getIsAppendAIp() {
-		return isAppendAIp;
-	}
-
-	@Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-
-	public List<PortConfig> getPortConfigs() {
-		return portConfigs;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/SecStorageSetupAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/SecStorageSetupAnswer.java b/api/src/com/cloud/agent/api/SecStorageSetupAnswer.java
deleted file mode 100644
index bb0c016..0000000
--- a/api/src/com/cloud/agent/api/SecStorageSetupAnswer.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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.agent.api;
-
-public class SecStorageSetupAnswer extends Answer {
-    private String _dir;
-	protected SecStorageSetupAnswer() {
-	}
-
-	public SecStorageSetupAnswer(String dir) {
-		super(null, true, "success");
-	    this._dir = dir;
-	}
-
-    public String get_dir() {
-        return _dir;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/SecStorageSetupCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/SecStorageSetupCommand.java b/api/src/com/cloud/agent/api/SecStorageSetupCommand.java
deleted file mode 100644
index 50c06cf..0000000
--- a/api/src/com/cloud/agent/api/SecStorageSetupCommand.java
+++ /dev/null
@@ -1,83 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-
-public class SecStorageSetupCommand extends Command {
-	private String secUrl;
-	private Certificates certs;
-
-	public static class Certificates {
-	    @LogLevel(Log4jLevel.Off)
-		private String privKey;
-	    @LogLevel(Log4jLevel.Off)
-		private String privCert;
-	    @LogLevel(Log4jLevel.Off)
-		private String certChain;
-
-	    public Certificates() {
-
-	    }
-
-	    public Certificates(String prvKey, String privCert, String certChain) {
-	    	this.privKey = prvKey;
-	    	this.privCert = privCert;
-	    	this.certChain = certChain;
-	    }
-
-	    public String getPrivKey() {
-	    	return this.privKey;
-	    }
-
-	    public String getPrivCert() {
-	    	return this.privCert;
-	    }
-
-	    public String getCertChain() {
-	    	return this.certChain;
-	    }
-	}
-
-	public SecStorageSetupCommand() {
-		super();
-	}
-
-	public SecStorageSetupCommand(String secUrl, Certificates certs) {
-		super();
-		this.secUrl = secUrl;
-		this.certs = certs;
-	}
-
-	@Override
-	public boolean executeInSequence() {
-		return true;
-	}
-
-    public String getSecUrl() {
-        return secUrl;
-    }
-
-    public Certificates getCerts() {
-    	return this.certs;
-    }
-
-    public void setSecUrl(String secUrl) {
-        this.secUrl = secUrl;
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/SecStorageVMSetupCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/SecStorageVMSetupCommand.java b/api/src/com/cloud/agent/api/SecStorageVMSetupCommand.java
deleted file mode 100644
index be97709..0000000
--- a/api/src/com/cloud/agent/api/SecStorageVMSetupCommand.java
+++ /dev/null
@@ -1,57 +0,0 @@
-// 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.agent.api;
-
-public class SecStorageVMSetupCommand extends Command {
-	String [] allowedInternalSites = new String[0];
-	String copyUserName;
-	String copyPassword;
-
-	public SecStorageVMSetupCommand() {
-		super();
-	}
-
-	@Override
-	public boolean executeInSequence() {
-		return true;
-	}
-
-	public String[] getAllowedInternalSites() {
-		return allowedInternalSites;
-	}
-
-	public void setAllowedInternalSites(String[] allowedInternalSites) {
-		this.allowedInternalSites = allowedInternalSites;
-	}
-
-	public String getCopyUserName() {
-		return copyUserName;
-	}
-
-	public void setCopyUserName(String copyUserName) {
-		this.copyUserName = copyUserName;
-	}
-
-	public String getCopyPassword() {
-		return copyPassword;
-	}
-
-	public void setCopyPassword(String copyPassword) {
-		this.copyPassword = copyPassword;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/SecurityGroupRuleAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/SecurityGroupRuleAnswer.java b/api/src/com/cloud/agent/api/SecurityGroupRuleAnswer.java
deleted file mode 100644
index 144fea2..0000000
--- a/api/src/com/cloud/agent/api/SecurityGroupRuleAnswer.java
+++ /dev/null
@@ -1,70 +0,0 @@
-// 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.agent.api;
-
-public class SecurityGroupRuleAnswer extends Answer {
-    public static enum FailureReason {
-        NONE,
-        UNKNOWN,
-        PROGRAMMING_FAILED,
-        CANNOT_BRIDGE_FIREWALL
-    }
-    Long logSequenceNumber = null;
-    Long vmId = null;
-    FailureReason reason = FailureReason.NONE;
-
-
-    protected SecurityGroupRuleAnswer() {
-    }
-
-    public SecurityGroupRuleAnswer(SecurityGroupRulesCmd cmd) {
-    	super(cmd);
-        this.logSequenceNumber = cmd.getSeqNum();
-        this.vmId = cmd.getVmId();
-    }
-
-    public SecurityGroupRuleAnswer(SecurityGroupRulesCmd cmd, boolean result, String detail) {
-        super(cmd, result, detail);
-        this.logSequenceNumber = cmd.getSeqNum();
-        this.vmId = cmd.getVmId();
-        reason = FailureReason.PROGRAMMING_FAILED;
-    }
-
-    public SecurityGroupRuleAnswer(SecurityGroupRulesCmd cmd, boolean result, String detail, FailureReason r) {
-        super(cmd, result, detail);
-        this.logSequenceNumber = cmd.getSeqNum();
-        this.vmId = cmd.getVmId();
-        reason = r;
-    }
-
-    public Long getLogSequenceNumber() {
-        return logSequenceNumber;
-    }
-
-    public Long getVmId() {
-        return vmId;
-    }
-
-    public FailureReason getReason() {
-        return reason;
-    }
-
-    public void setReason(FailureReason reason) {
-        this.reason = reason;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/SecurityGroupRulesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/SecurityGroupRulesCmd.java b/api/src/com/cloud/agent/api/SecurityGroupRulesCmd.java
deleted file mode 100644
index 4336b4c..0000000
--- a/api/src/com/cloud/agent/api/SecurityGroupRulesCmd.java
+++ /dev/null
@@ -1,304 +0,0 @@
-// 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.agent.api;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.List;
-import java.util.zip.DeflaterOutputStream;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.log4j.Logger;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-import com.cloud.utils.net.NetUtils;
-
-
-public class SecurityGroupRulesCmd extends Command {
-    private static Logger s_logger = Logger.getLogger(SecurityGroupRulesCmd.class);
-    public static class IpPortAndProto {
-        private String proto;
-        private int startPort;
-        private int endPort;
-        @LogLevel(Log4jLevel.Trace)
-        private String [] allowedCidrs;
-
-        public IpPortAndProto() { }
-
-        public IpPortAndProto(String proto, int startPort, int endPort,
-                String[] allowedCidrs) {
-            super();
-            this.proto = proto;
-            this.startPort = startPort;
-            this.endPort = endPort;
-            this.allowedCidrs = allowedCidrs;
-        }
-
-        public String[] getAllowedCidrs() {
-            return allowedCidrs;
-        }
-
-        public void setAllowedCidrs(String[] allowedCidrs) {
-            this.allowedCidrs = allowedCidrs;
-        }
-
-        public String getProto() {
-            return proto;
-        }
-
-        public int getStartPort() {
-            return startPort;
-        }
-
-        public int getEndPort() {
-            return endPort;
-        }
-
-    }
-
-
-    String guestIp;
-    String vmName;
-    String guestMac;
-    String signature;
-    Long seqNum;
-    Long vmId;
-    Long msId;
-    IpPortAndProto [] ingressRuleSet;
-    IpPortAndProto [] egressRuleSet;
-    private List<String> secIps;
-
-    public SecurityGroupRulesCmd() {
-        super();
-    }
-
-
-    public SecurityGroupRulesCmd(String guestIp, String guestMac, String vmName, Long vmId, String signature, Long seqNum, IpPortAndProto[] ingressRuleSet, IpPortAndProto[] egressRuleSet) {
-        super();
-        this.guestIp = guestIp;
-        this.vmName = vmName;
-        this.ingressRuleSet = ingressRuleSet;
-        this.egressRuleSet = egressRuleSet;
-        this.guestMac = guestMac;
-        this.signature = signature;
-        this.seqNum = seqNum;
-        this.vmId  = vmId;
-        if (signature == null) {
-            String stringified = stringifyRules();
-            this.signature = DigestUtils.md5Hex(stringified);
-        }
-    }
-
-
-    public SecurityGroupRulesCmd(String guestIp, String guestMac, String vmName, Long vmId, String signature, Long seqNum, IpPortAndProto[] ingressRuleSet, IpPortAndProto[] egressRuleSet, List<String> secIps) {
-        super();
-        this.guestIp = guestIp;
-        this.vmName = vmName;
-        this.ingressRuleSet = ingressRuleSet;
-        this.egressRuleSet = egressRuleSet;
-        this.guestMac = guestMac;
-        this.signature = signature;
-        this.seqNum = seqNum;
-        this.vmId  = vmId;
-        if (signature == null) {
-            String stringified = stringifyRules();
-            this.signature = DigestUtils.md5Hex(stringified);
-        }
-        this.secIps = secIps;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-
-    public IpPortAndProto[] getIngressRuleSet() {
-        return ingressRuleSet;
-    }
-
-
-    public void setIngressRuleSet(IpPortAndProto[] ingressRuleSet) {
-        this.ingressRuleSet = ingressRuleSet;
-    }
-
-    public IpPortAndProto[] getEgressRuleSet() {
-        return egressRuleSet;
-    }
-
-
-    public void setEgressRuleSet(IpPortAndProto[] egressRuleSet) {
-        this.egressRuleSet = egressRuleSet;
-    }
-
-    public String getGuestIp() {
-        return guestIp;
-    }
-
-    public List<String> getSecIps() {
-        return secIps;
-    }
-
-
-    public String getVmName() {
-        return vmName;
-    }
-
-    public String stringifyRules() {
-        StringBuilder ruleBuilder = new StringBuilder();
-        for (SecurityGroupRulesCmd.IpPortAndProto ipPandP: getIngressRuleSet()) {
-            ruleBuilder.append("I:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
-            for (String cidr: ipPandP.getAllowedCidrs()) {
-                ruleBuilder.append(cidr).append(",");
-            }
-            ruleBuilder.append("NEXT");
-            ruleBuilder.append(" ");
-        }
-        for (SecurityGroupRulesCmd.IpPortAndProto ipPandP: getEgressRuleSet()) {
-            ruleBuilder.append("E:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
-            for (String cidr: ipPandP.getAllowedCidrs()) {
-                ruleBuilder.append(cidr).append(",");
-            }
-            ruleBuilder.append("NEXT");
-            ruleBuilder.append(" ");
-        }
-        return ruleBuilder.toString();
-    }
-
-    //convert cidrs in the form "a.b.c.d/e" to "hexvalue of 32bit ip/e"
-    private String compressCidr(String cidr) {
-        String [] toks = cidr.split("/");
-        long ipnum = NetUtils.ip2Long(toks[0]);
-        return Long.toHexString(ipnum) + "/" + toks[1];
-    }
-
-
-    public String getSecIpsString() {
-        StringBuilder sb = new StringBuilder();
-        List<String> ips = getSecIps();
-        if (ips == null) {
-            return "0:";
-        } else {
-            for (String ip : ips) {
-                sb.append(ip).append(":");
-            }
-        }
-        return sb.toString();
-    }
-
-
-    public String stringifyCompressedRules() {
-        StringBuilder ruleBuilder = new StringBuilder();
-        for (SecurityGroupRulesCmd.IpPortAndProto ipPandP : getIngressRuleSet()) {
-            ruleBuilder.append("I:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
-            for (String cidr: ipPandP.getAllowedCidrs()) {
-                //convert cidrs in the form "a.b.c.d/e" to "hexvalue of 32bit ip/e"
-                ruleBuilder.append(compressCidr(cidr)).append(",");
-            }
-            ruleBuilder.append("NEXT");
-            ruleBuilder.append(" ");
-        }
-        for (SecurityGroupRulesCmd.IpPortAndProto ipPandP : getEgressRuleSet()) {
-            ruleBuilder.append("E:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
-            for (String cidr: ipPandP.getAllowedCidrs()) {
-                //convert cidrs in the form "a.b.c.d/e" to "hexvalue of 32bit ip/e"
-                ruleBuilder.append(compressCidr(cidr)).append(",");
-            }
-            ruleBuilder.append("NEXT");
-            ruleBuilder.append(" ");
-        }
-        return ruleBuilder.toString();
-    }
-
-    /*
-     * Compress the security group rules using zlib compression to allow the call to the hypervisor
-     * to scale beyond 8k cidrs.
-     */
-    public String compressStringifiedRules() {
-        StringBuilder ruleBuilder = new StringBuilder();
-        for (SecurityGroupRulesCmd.IpPortAndProto ipPandP: getIngressRuleSet()) {
-            ruleBuilder.append("I:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
-            for (String cidr: ipPandP.getAllowedCidrs()) {
-                ruleBuilder.append(cidr).append(",");
-            }
-            ruleBuilder.append("NEXT");
-            ruleBuilder.append(" ");
-        }
-        for (SecurityGroupRulesCmd.IpPortAndProto ipPandP: getEgressRuleSet()) {
-            ruleBuilder.append("E:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
-            for (String cidr: ipPandP.getAllowedCidrs()) {
-                ruleBuilder.append(cidr).append(",");
-            }
-            ruleBuilder.append("NEXT");
-            ruleBuilder.append(" ");
-        }
-        String stringified = ruleBuilder.toString();
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        try {
-            //Note : not using GZipOutputStream since that is for files
-            //GZipOutputStream gives a different header, although the compression is the same
-            DeflaterOutputStream dzip = new DeflaterOutputStream(out);
-            dzip.write(stringified.getBytes());
-            dzip.close();
-        } catch (IOException e) {
-            s_logger.warn("Exception while compressing security group rules");
-            return null;
-        }
-        return Base64.encodeBase64String(out.toByteArray());
-    }
-
-    public String getSignature() {
-        return signature;
-    }
-
-
-    public String getGuestMac() {
-        return guestMac;
-    }
-
-
-    public Long getSeqNum() {
-        return seqNum;
-    }
-
-
-    public Long getVmId() {
-        return vmId;
-    }
-
-    public int getTotalNumCidrs() {
-        //useful for logging
-        int count = 0;
-        for (IpPortAndProto i: ingressRuleSet) {
-            count += i.allowedCidrs.length;
-        }
-        for (IpPortAndProto i: egressRuleSet) {
-            count += i.allowedCidrs.length;
-        }
-        return count;
-    }
-
-    public void setMsId(long msId) {
-        this.msId = msId;
-    }
-
-    public Long getMsId() {
-        return msId;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/SetupAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/SetupAnswer.java b/api/src/com/cloud/agent/api/SetupAnswer.java
deleted file mode 100644
index 97252a2..0000000
--- a/api/src/com/cloud/agent/api/SetupAnswer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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.agent.api;
-
-public class SetupAnswer extends Answer {
-    // indicate if agent reconnect is needed after setup command
-    private boolean _reconnect;
-    public SetupAnswer() {}
-
-    public SetupAnswer(SetupCommand cmd, boolean reconnect) {
-        super(cmd, true, null);
-        _reconnect = reconnect;
-    }
-
-    public SetupAnswer(SetupCommand cmd, String details) {
-        super(cmd, false, details);
-        _reconnect = true;
-    }
-    public boolean needReconnect() {
-        return _reconnect;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/SetupCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/SetupCommand.java b/api/src/com/cloud/agent/api/SetupCommand.java
deleted file mode 100644
index ee43c59..0000000
--- a/api/src/com/cloud/agent/api/SetupCommand.java
+++ /dev/null
@@ -1,60 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.host.HostEnvironment;
-
-public class SetupCommand extends Command {
-
-    HostEnvironment env;
-    boolean multipath;
-    boolean needSetup;
-
-    public boolean needSetup() {
-        return needSetup;
-    }
-
-    public void setNeedSetup(boolean setup) {
-        this.needSetup = setup;
-    }
-
-    public SetupCommand(HostEnvironment env) {
-        this.env = env;
-        this.multipath = false;
-        this.needSetup = false;
-    }
-
-    public HostEnvironment getEnvironment() {
-        return env;
-    }
-
-    protected SetupCommand() {
-    }
-
-    public void setMultipathOn() {
-        this.multipath = true;
-    }
-
-    public boolean useMultipath() {
-        return multipath;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-}


[40/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/awsapi/pom.xml
----------------------------------------------------------------------
diff --git a/awsapi/pom.xml b/awsapi/pom.xml
index f19a713..d457349 100644
--- a/awsapi/pom.xml
+++ b/awsapi/pom.xml
@@ -286,12 +286,6 @@
     </dependency>
   </dependencies>
   <build>
-    <defaultGoal>install</defaultGoal>
-    <sourceDirectory>src</sourceDirectory>
-    <!--  Tests still depend on hibernate, 
-          so thats not going to work 
-    <testSourceDirectory>test</testSourceDirectory>
-    -->
     <resources>
       <resource>
         <directory>src</directory>
@@ -307,6 +301,17 @@
       </resource>
     </resources>
     <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>com/cloud/gate/util/UtilTestCase.java</exclude>
+            <exclude>com/cloud/gate/service/ServiceTestCase.java</exclude>
+            <exclude>com/cloud/gate/util/CloudStackClientTestCase.java</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
 	  <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-war-plugin</artifactId>
@@ -364,22 +369,6 @@
 		</executions>
 	  </plugin>
     </plugins>
-    <!--
-        <plugins>
-         <plugin>
-           <groupId>org.apache.maven.plugins</groupId>
-           <artifactId>maven-jar-plugin</artifactId>
-           <version>2.2</version>
-           <executions>
-             <execution>
-               <goals>
-                 <goal>test-jar</goal>
-               </goals>
-             </execution>
-           </executions>
-         </plugin>
-        </plugins>
-    -->
     <pluginManagement>
       <plugins>
         <plugin>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/awsapi/test/com/cloud/gate/model/ModelTestCase.java
----------------------------------------------------------------------
diff --git a/awsapi/test/com/cloud/gate/model/ModelTestCase.java b/awsapi/test/com/cloud/gate/model/ModelTestCase.java
deleted file mode 100644
index 91aeaa7..0000000
--- a/awsapi/test/com/cloud/gate/model/ModelTestCase.java
+++ /dev/null
@@ -1,368 +0,0 @@
-// 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.gate.model;
-
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-import org.junit.Assert;
-
-import com.cloud.bridge.model.MHost;
-import com.cloud.bridge.model.MHostMount;
-import com.cloud.bridge.model.SBucket;
-import com.cloud.bridge.model.SHost;
-import com.cloud.bridge.model.SMeta;
-import com.cloud.bridge.model.SObject;
-import com.cloud.bridge.util.CloudSessionFactory;
-import com.cloud.bridge.util.QueryHelper;
-import com.cloud.gate.testcase.BaseTestCase;
-
-public class ModelTestCase extends BaseTestCase {
-    protected final static Logger logger = Logger.getLogger(ModelTestCase.class);
-
-    public void testSHost() {
-		SHost host;
-		
-		// create the record
-		Session session = CloudSessionFactory.getInstance().openSession();
-		try {
-			Transaction txn = session.beginTransaction();
-			host = new SHost();
-			host.setHost("localhost");
-			host.setExportRoot("/");
-			host.setUserOnHost("root");
-			host.setUserPassword("password");
-			session.saveOrUpdate(host);
-			txn.commit();
-		} finally {
-			session.close();
-		}
-		Assert.assertTrue(host.getId() != 0);
-		
-		// retrive the record
-		session = CloudSessionFactory.getInstance().openSession();
-		try {
-			Transaction txn = session.beginTransaction();
-			host = (SHost)session.get(SHost.class, (long)host.getId());
-			txn.commit();
-			
-			Assert.assertTrue(host.getHost().equals("localhost"));
-			Assert.assertTrue(host.getUserOnHost().equals("root"));
-			Assert.assertTrue(host.getUserPassword().equals("password"));
-			
-			logger.info("Retrived record, host:" + host.getHost() 
-					+ ", user: " + host.getUserOnHost() 
-					+ ", password: " + host.getUserPassword());
-			
-		} finally {
-			session.close();
-		}
-		
-		// delete the record
-		session = CloudSessionFactory.getInstance().openSession();
-		try {
-			Transaction txn = session.beginTransaction();
-			host = (SHost)session.get(SHost.class, (long)host.getId());
-			session.delete(host);
-			txn.commit();
-		} finally {
-			session.close();
-		}
-		
-		session = CloudSessionFactory.getInstance().openSession();
-		try {
-			Transaction txn = session.beginTransaction();
-			host = (SHost)session.get(SHost.class, (long)host.getId());
-			txn.commit();
-			
-			Assert.assertTrue(host == null);
-		} finally {
-			session.close();
-		}
-    }
-    
-    public void testSBucket() {
-    	SHost host;
-    	SBucket bucket;
-    	Session session;
-    	
-		session = CloudSessionFactory.getInstance().openSession();
-		try {
-			Transaction txn = session.beginTransaction();
-			host = new SHost();
-			host.setHost("localhost");
-			host.setUserOnHost("root");
-			host.setUserPassword("password");
-			host.setExportRoot("/");
-			
-			bucket = new SBucket();
-			bucket.setName("Bucket");
-			bucket.setOwnerCanonicalId("OwnerId-dummy");
-			bucket.setCreateTime(new Date());
-			
-			host.getBuckets().add(bucket);
-			bucket.setShost(host);
-			
-			session.save(host);
-			session.save(bucket);
-			txn.commit();
-		} finally {
-			session.close();
-		}
-		
-		long bucketId = bucket.getId();
-		
-		// load bucket
-		session = CloudSessionFactory.getInstance().openSession();
-		try {
-			Transaction txn = session.beginTransaction();
-			bucket = (SBucket)session.get(SBucket.class, bucketId);
-			txn.commit();
-			
-			Assert.assertTrue(bucket.getShost().getHost().equals("localhost"));
-			Assert.assertTrue(bucket.getName().equals("Bucket"));
-			Assert.assertTrue(bucket.getOwnerCanonicalId().equals("OwnerId-dummy"));
-		} finally {
-			session.close();
-		}
-		
-		// delete the bucket
-		session = CloudSessionFactory.getInstance().openSession();
-		try {
-			Transaction txn = session.beginTransaction();
-			bucket = (SBucket)session.get(SBucket.class, bucketId);
-			session.delete(bucket);
-			
-			host = (SHost)session.get(SHost.class, host.getId());
-			session.delete(host);
-			txn.commit();
-		} finally {
-			session.close();
-		}
-
-		// verify the deletion
-		session = CloudSessionFactory.getInstance().openSession();
-		try {
-			Transaction txn = session.beginTransaction();
-			bucket = (SBucket)session.get(SBucket.class, bucketId);
-			txn.commit();
-			
-			Assert.assertTrue(bucket == null);
-		} finally {
-			session.close();
-		}
-    }
-    
-    public void testSObject() {
-    	SHost host;
-    	SBucket bucket;
-    	Session session;
-    	SObject sobject;
-    	
-    	// setup 
-		session = CloudSessionFactory.getInstance().openSession();
-		try {
-			Transaction txn = session.beginTransaction();
-			host = new SHost();
-			host.setHost("localhost");
-			host.setUserOnHost("root");
-			host.setUserPassword("password");
-			host.setExportRoot("/");
-			
-			bucket = new SBucket();
-			bucket.setName("Bucket");
-			bucket.setOwnerCanonicalId("OwnerId-dummy");
-			bucket.setCreateTime(new Date());
-			bucket.setShost(host);
-			host.getBuckets().add(bucket);
-			
-			sobject = new SObject();
-			sobject.setNameKey("ObjectNameKey");
-			sobject.setOwnerCanonicalId("OwnerId-dummy");
-			sobject.setCreateTime(new Date());
-			sobject.setBucket(bucket);
-			bucket.getObjectsInBucket().add(sobject);
-			
-			session.save(host);
-			session.save(bucket);
-			session.save(sobject);
-			txn.commit();
-			
-		} finally {
-			session.close();
-		}
-		
-		session = CloudSessionFactory.getInstance().openSession();
-		try {
-			Transaction txn = session.beginTransaction();
-			sobject = (SObject)session.get(SObject.class, sobject.getId());
-			txn.commit();
-			Assert.assertTrue(sobject.getBucket().getName().equals("Bucket"));
-			Assert.assertTrue(sobject.getNameKey().equals("ObjectNameKey"));
-			Assert.assertTrue(sobject.getOwnerCanonicalId().equals("OwnerId-dummy"));
-		} finally {
-			session.close();
-		}
-
-		// test delete cascade
-		session = CloudSessionFactory.getInstance().openSession();
-		try {
-			Transaction txn = session.beginTransaction();
-			bucket = (SBucket)session.get(SBucket.class, bucket.getId());
-			session.delete(bucket);
-			
-			host = (SHost)session.get(SHost.class, host.getId());
-			session.delete(host);
-			txn.commit();
-		} finally {
-			session.close();
-		}
-    }
-    
-    public void testMeta() {
-		Session session;
-
-		session = CloudSessionFactory.getInstance().openSession();
-    	try {
-			Transaction txn = session.beginTransaction();
-    		SMeta meta = new SMeta();
-    		meta.setTarget("SObject");
-    		meta.setTargetId(1);
-    		meta.setName("param1");
-    		meta.setValue("value1");
-    		session.save(meta);
-    		
-    		logger.info("Meta 1: " + meta.getId());
-    		
-    		meta = new SMeta();
-    		meta.setTarget("SObject");
-    		meta.setTargetId(1);
-    		meta.setName("param2");
-    		meta.setValue("value2");
-    		session.save(meta);
-    		
-    		logger.info("Meta 2: " + meta.getId());
-    		
-    		txn.commit();
-    	} finally {
-    		session.close();
-    	}
-    	
-    	session = CloudSessionFactory.getInstance().openSession();
-    	try {
-			Transaction txn = session.beginTransaction();
-    		Query query = session.createQuery("from SMeta where target=? and targetId=?");
-    		QueryHelper.bindParameters(query, new Object[] {
-    			"SObject", new Long(1)
-    		});
-    		List<SMeta> l = QueryHelper.executeQuery(query); 
-    		txn.commit();
-    		
-    		for(SMeta meta: l) {
-    			logger.info("" + meta.getName() + "=" + meta.getValue());
-    		}
-    	} finally {
-    		session.close();
-    	}
-    	
-    	session = CloudSessionFactory.getInstance().openSession();
-    	try {
-			Transaction txn = session.beginTransaction();
-    		Query query = session.createQuery("delete from SMeta where target=?");
-    		QueryHelper.bindParameters(query, new Object[] {"SObject"});
-    		query.executeUpdate();
-    		txn.commit();
-    	} finally {
-    		session.close();
-    	}
-    }
-    
-    public void testHosts() {
-		Session session;
-		SHost shost;
-		MHost mhost;
-		MHostMount hostMount;
-
-    	session = CloudSessionFactory.getInstance().openSession();
-    	try {
-    		Transaction txn = session.beginTransaction();
-    		shost = new SHost();
-    		shost.setHost("Storage host1");
-    		shost.setUserOnHost("root");
-    		shost.setUserPassword("password");
-			shost.setExportRoot("/");
-    		session.save(shost);
-    		
-    		mhost = new MHost();
-    		mhost.setHostKey("1");
-    		mhost.setHost("management host1");
-    		mhost.setVersion("v1");
-    		session.save(mhost);
-
-    		hostMount = new MHostMount();
-    		hostMount.setMhost(mhost);
-    		hostMount.setShost(shost);
-    		hostMount.setMountPath("/mnt");
-    		session.save(hostMount);
-    		txn.commit();
-    	} finally {
-    		session.close();
-    	}
-    	
-    	session = CloudSessionFactory.getInstance().openSession();
-    	try {
-    		Transaction txn = session.beginTransaction();
-    		mhost = (MHost)session.createQuery("from MHost where hostKey=?").
-    			setLong(0, new Long(1)).uniqueResult();
-    		
-    		if(mhost != null) {
-	    		Iterator it = mhost.getMounts().iterator();
-	    		while(it.hasNext()) {
-	    			MHostMount mount = (MHostMount)it.next();
-	    			Assert.assertTrue(mount.getMountPath().equals("/mnt"));
-	    			
-	    			logger.info(mount.getMountPath());
-	    		}
-    		}
-    		txn.commit();
-    	} finally {
-    		session.close();
-    	}
-    	
-    	session = CloudSessionFactory.getInstance().openSession();
-    	try {
-    		Transaction txn = session.beginTransaction();
-    		mhost = (MHost)session.createQuery("from MHost where hostKey=?").
-    			setLong(0, new Long(1)).uniqueResult();
-    		if(mhost != null)
-    			session.delete(mhost);
-    		
-    		shost = (SHost)session.createQuery("from SHost where host=?").
-			setString(0, "Storage host1").uniqueResult();
-    		if(shost != null)
-    			session.delete(shost);
-    		txn.commit();
-    	} finally {
-    		session.close();
-    	}
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/awsapi/test/com/cloud/gate/persist/PersitTestCase.java
----------------------------------------------------------------------
diff --git a/awsapi/test/com/cloud/gate/persist/PersitTestCase.java b/awsapi/test/com/cloud/gate/persist/PersitTestCase.java
deleted file mode 100644
index 4961d93..0000000
--- a/awsapi/test/com/cloud/gate/persist/PersitTestCase.java
+++ /dev/null
@@ -1,73 +0,0 @@
-// 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.gate.persist;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.bridge.persist.PersistContext;
-import com.cloud.gate.testcase.BaseTestCase;
-
-public class PersitTestCase extends BaseTestCase {
-    protected final static Logger logger = Logger.getLogger(PersitTestCase.class);
-    
-    public void testNamedLock() {
-    	Thread t1 = new Thread(new Runnable() {
-    		public void run() {
-    			for(int i = 0; i < 10; i++) {
-    				if(PersistContext.acquireNamedLock("TestLock", 3)) {
-    					logger.info("Thread 1 acquired lock");
-    					try {
-							Thread.currentThread().sleep(BaseTestCase.getRandomMilliseconds(5000, 10000));
-						} catch (InterruptedException e) {
-						}
-    					logger.info("Thread 1 to release lock");
-    					PersistContext.releaseNamedLock("TestLock");
-    				} else {
-    					logger.info("Thread 1 is unable to acquire lock");
-    				}
-    			}
-    		}
-    	});
-    	
-    	Thread t2 = new Thread(new Runnable() {
-    		public void run() {
-    			for(int i = 0; i < 10; i++) {
-    				if(PersistContext.acquireNamedLock("TestLock", 3)) {
-    					logger.info("Thread 2 acquired lock");
-    					try {
-							Thread.currentThread().sleep(BaseTestCase.getRandomMilliseconds(1000, 5000));
-						} catch (InterruptedException e) {
-						}
-    					logger.info("Thread 2 to release lock");
-    					PersistContext.releaseNamedLock("TestLock");
-    				} else {
-    					logger.info("Thread 2 is unable to acquire lock");
-    				}
-    			}
-    		}
-    	});
-    	
-    	t1.start();
-    	t2.start();
-    	
-    	try {
-	    	t1.join();
-	    	t2.join();
-    	} catch(InterruptedException e) {
-    	}
-    }
-}


[57/57] [abbrv] git commit: updated refs/heads/master to f84b6ab

Posted by ni...@apache.org.
merge with master


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

Branch: refs/heads/master
Commit: f84b6abde022b4578acc432f03a81c53839282b4
Parents: 8d53b1e 052c24c
Author: Nitin Mehta <ni...@citrix.com>
Authored: Mon May 13 17:30:42 2013 +0530
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Mon May 13 17:30:42 2013 +0530

----------------------------------------------------------------------
 api/src/com/cloud/agent/api/to/DnsmasqTO.java      |   53 +++
 .../exception/MissingParameterValueException.java  |   25 +
 .../cloud/network/element/DhcpServiceProvider.java |    2 +
 api/src/com/cloud/vm/NicIpAlias.java               |   45 ++
 client/tomcatconf/applicationContext.xml.in        |    1 +
 .../agent/api/routing/CreateIpAliasCommand.java    |   36 ++
 .../agent/api/routing/DeleteIpAliasCommand.java    |   50 +++
 .../agent/api/routing/DnsMasqConfigCommand.java    |   65 +++
 .../src/com/cloud/agent/api/routing/IpAliasTO.java |   42 ++
 .../virtualnetwork/VirtualRoutingResource.java     |  117 ++++-
 .../src/com/cloud/network/DnsMasqConfigurator.java |  118 +++++
 engine/schema/src/com/cloud/dc/dao/VlanDao.java    |    6 +-
 .../schema/src/com/cloud/dc/dao/VlanDaoImpl.java   |   38 +-
 .../src/com/cloud/network/dao/IPAddressDao.java    |    8 +-
 .../com/cloud/network/dao/IPAddressDaoImpl.java    |   39 +-
 engine/schema/src/com/cloud/vm/dao/NicDao.java     |    6 +-
 engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java |   19 +-
 .../storage/volume/VolumeServiceImpl.java          |    5 +-
 .../systemvm/debian/config/root/createIpAlias.sh   |   35 ++
 .../systemvm/debian/config/root/deleteIpAlias.sh   |   43 ++
 patches/systemvm/debian/config/root/dnsmasq.sh     |   43 ++
 .../networkservice/BaremetalDhcpElement.java       |   41 +-
 .../hypervisor/vmware/resource/VmwareResource.java |  199 +++++++--
 .../xen/resource/CitrixResourceBase.java           |  166 +++++--
 .../com/cloud/network/element/MidoNetElement.java  |   59 ++-
 scripts/vm/hypervisor/xenserver/createipAlias.sh   |   26 ++
 scripts/vm/hypervisor/xenserver/deleteipAlias.sh   |   25 +
 scripts/vm/hypervisor/xenserver/vmops              |   45 ++-
 scripts/vm/hypervisor/xenserver/xcpserver/patch    |    2 +
 scripts/vm/hypervisor/xenserver/xenserver56/patch  |    2 +
 .../vm/hypervisor/xenserver/xenserver56fp1/patch   |    2 +
 scripts/vm/hypervisor/xenserver/xenserver60/patch  |    2 +
 .../cloud/configuration/ConfigurationManager.java  |    2 -
 .../configuration/ConfigurationManagerImpl.java    |  344 ++++++++++++---
 server/src/com/cloud/network/NetworkManager.java   |    4 +
 .../src/com/cloud/network/NetworkManagerImpl.java  |   30 ++-
 server/src/com/cloud/network/addr/PublicIp.java    |    4 +
 .../network/element/VirtualRouterElement.java      |   59 +++
 .../router/VirtualNetworkApplianceManager.java     |   13 +-
 .../router/VirtualNetworkApplianceManagerImpl.java |  273 ++++++++++--
 server/src/com/cloud/vm/dao/NicIpAliasDao.java     |   61 +++
 server/src/com/cloud/vm/dao/NicIpAliasDaoImpl.java |  186 ++++++++
 server/src/com/cloud/vm/dao/NicIpAliasVO.java      |  226 ++++++++++
 .../cloud/configuration/ValidateIpRangeTest.java   |   71 +++
 .../com/cloud/network/MockNetworkManagerImpl.java  |   11 +
 .../cloud/vpc/MockConfigurationManagerImpl.java    |   71 ++--
 .../test/com/cloud/vpc/MockNetworkManagerImpl.java |   25 +-
 .../vpc/MockVpcVirtualNetworkApplianceManager.java |   10 +
 .../networkoffering/CreateNetworkOfferingTest.java |   29 +-
 server/test/resources/createNetworkOffering.xml    |   21 +-
 setup/db/db/schema-410to420.sql                    |   20 +-
 51 files changed, 2456 insertions(+), 369 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f84b6abd/client/tomcatconf/applicationContext.xml.in
----------------------------------------------------------------------
diff --cc client/tomcatconf/applicationContext.xml.in
index d85839e,1bd2f82..6406660
--- a/client/tomcatconf/applicationContext.xml.in
+++ b/client/tomcatconf/applicationContext.xml.in
@@@ -258,8 -258,8 +258,9 @@@
    <bean id="networkRuleConfigDaoImpl" class="com.cloud.network.dao.NetworkRuleConfigDaoImpl" />
    <bean id="networkServiceMapDaoImpl" class="com.cloud.network.dao.NetworkServiceMapDaoImpl" />
    <bean id="nicDaoImpl" class="com.cloud.vm.dao.NicDaoImpl" />
 +  <bean id="nicDetailDaoImpl" class="com.cloud.vm.dao.NicDetailDaoImpl" />
    <bean id="nicSecondaryIpDaoImpl" class="com.cloud.vm.dao.NicSecondaryIpDaoImpl" />
+   <bean id="nicIpAliasDaoImpl" class="com.cloud.vm.dao.NicIpAliasDaoImpl" />
    <bean id="objectInDataStoreDaoImpl" class="org.apache.cloudstack.storage.db.ObjectInDataStoreDaoImpl" />
    <bean id="ovsTunnelInterfaceDaoImpl" class="com.cloud.network.ovs.dao.OvsTunnelInterfaceDaoImpl" />
    <bean id="ovsTunnelNetworkDaoImpl" class="com.cloud.network.ovs.dao.OvsTunnelNetworkDaoImpl" />

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f84b6abd/server/src/com/cloud/configuration/ConfigurationManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f84b6abd/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 87fd8ff,ce2493c..55e7b7e
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@@ -2464,11 -2538,69 +2540,69 @@@ public class ConfigurationManagerImpl e
          return vlan;
      }
  
+     public boolean validateIpRange(String startIP, String endIP, String newVlanGateway, String newVlanNetmask, List<VlanVO> vlans, boolean ipv4, boolean ipv6, String ip6Gateway, String ip6Cidr, String startIPv6, String endIPv6, Network network) {
+         String vlanGateway;
+         String vlanNetmask;
+         boolean sameSubnet = false;
+         if ( vlans != null && vlans.size() > 0 ) {
+ 
+             for (VlanVO vlan : vlans) {
+                 if (ipv4) {
+                     vlanGateway = vlan.getVlanGateway();
+                     vlanNetmask = vlan.getVlanNetmask();
+                     // Check if ip addresses are in network range
+                     if (!NetUtils.sameSubnet(startIP, vlanGateway, vlanNetmask)) {
+                         if (!NetUtils.sameSubnet(endIP, vlanGateway, vlanNetmask)) {
+                                 // check if the the new subnet is not a superset of the existing subnets.
+                                 if (NetUtils.isNetworkAWithinNetworkB(NetUtils.getCidrFromGatewayAndNetmask(vlanGateway,vlanNetmask), NetUtils.ipAndNetMaskToCidr(startIP, newVlanNetmask))){
+                                     throw new InvalidParameterValueException ("The new subnet is a superset of the existing subnet");
+                                 }
+                                 // check if the new subnet is not a subset of the existing subnet.
+                                 if (NetUtils.isNetworkAWithinNetworkB(NetUtils.ipAndNetMaskToCidr(startIP, newVlanNetmask), NetUtils.getCidrFromGatewayAndNetmask(vlanGateway,vlanNetmask))){
+                                     throw  new InvalidParameterValueException("The new subnet is a subset of the existing subnet");
+                                 }
+                         }
+                     } else if (NetUtils.sameSubnet(endIP, vlanGateway, vlanNetmask)){
+                         // trying to add to the same subnet.
+                         sameSubnet = true;
+                         if (newVlanGateway == null) {
+                             newVlanGateway = vlanGateway;
+                         }
+                         if (!newVlanGateway.equals(vlanGateway)){
+                             throw new InvalidParameterValueException("The gateway of the ip range is not same as the gateway of the subnet.");
+                         }
+                         break;
+                     }
+                     else {
+                         throw new InvalidParameterValueException("Start ip and End ip is not in vlan range!");
+                     }
+                 }
+                 if (ipv6) {
+                     if (ip6Gateway != null && !ip6Gateway.equals(network.getIp6Gateway())) {
+                        throw new InvalidParameterValueException("The input gateway " + ip6Gateway + " is not same as network gateway " + network.getIp6Gateway());
+                     }
+                     if (ip6Cidr != null && !ip6Cidr.equals(network.getIp6Cidr())) {
+                        throw new InvalidParameterValueException("The input cidr " + ip6Cidr + " is not same as network ciddr " + network.getIp6Cidr());
+                     }
+                     ip6Gateway = network.getIp6Gateway();
+                     ip6Cidr = network.getIp6Cidr();
+                     _networkModel.checkIp6Parameters(startIPv6, endIPv6, ip6Gateway, ip6Cidr);
+                 }
+             }
+             if (sameSubnet == false) {
+                 if (newVlanGateway ==null)  {
+                     throw  new MissingParameterValueException("The gateway for the new subnet is not specified.");
+                 }
+             }
+         }
+         return  sameSubnet;
+     }
+ 
      @Override
      @DB
 -    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 vlanIp6Gateway, String vlanIp6Cidr) {
 +    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 vlanIp6Gateway, String vlanIp6Cidr) {
          Network network = _networkModel.getNetwork(networkId);
          
          boolean ipv4 = false, ipv6 = false;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f84b6abd/server/src/com/cloud/network/NetworkManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f84b6abd/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f84b6abd/server/test/com/cloud/network/MockNetworkManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f84b6abd/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f84b6abd/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f84b6abd/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------


[39/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/WEB-INF/classes/resources/messages.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties
index fbc0471..1638be1 100644
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -14,7 +14,10 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-
+message.select.affinity.groups=Please select any affinity groups you want this VM to belong to:
+message.no.affinity.groups=You do not have any affinity groups. Please continue to the next step.
+label.action.delete.nic=Remove NIC
+message.action.delete.nic=Please confirm that want to remove this NIC, which will also remove the associated network from the VM. 
 changed.item.properties=Changed item properties
 confirm.enable.s3=Please fill in the following information to enable support for S3-backed Secondary Storage
 confirm.enable.swift=Please fill in the following information to enable support for Swift
@@ -22,7 +25,7 @@ error.could.not.enable.zone=Could not enable zone
 error.installWizard.message=Something went wrong; you may go back and correct any errors
 error.invalid.username.password=Invalid username or password
 error.login=Your username/password does not match our records.
-error.menu.select=Unable to perform action due to no items being selected. 
+error.menu.select=Unable to perform action due to no items being selected.
 error.mgmt.server.inaccessible=The Management Server is unaccessible.  Please try again later.
 error.password.not.match=The password fields do not match
 error.please.specify.physical.network.tags=Network offerings is not available until you specify tags for this physical network.
@@ -31,115 +34,115 @@ error.something.went.wrong.please.correct.the.following=Something went wrong; pl
 error.unable.to.reach.management.server=Unable to reach Management Server
 error.unresolved.internet.name=Your internet name cannot be resolved.
 extractable=Extractable
-force.delete.domain.warning=Warning: Choosing this option will cause the deletion of all child domains and all associated accounts and their resources.
+force.delete.domain.warning=Warning\: Choosing this option will cause the deletion of all child domains and all associated accounts and their resources.
 force.delete=Force Delete
+force.remove.host.warning=Warning\: Choosing this option will cause CloudStack to forcefully stop all running virtual machines before removing this host from the cluster.
 force.remove=Force Remove
-force.remove.host.warning=Warning: Choosing this option will cause CloudStack to forcefully stop all running virtual machines before removing this host from the cluster.
+force.stop.instance.warning=Warning\: Forcing a stop on this instance should be your last option. It can lead to data loss as well as inconsistent behavior of the virtual machine state.
 force.stop=Force Stop
-force.stop.instance.warning=Warning: Forcing a stop on this instance should be your last option. It can lead to data loss as well as inconsistent behavior of the virtual machine state.
 ICMP.code=ICMP Code
 ICMP.type=ICMP Type
 image.directory=Image Directory
 inline=Inline
 instances.actions.reboot.label=Reboot instance
 label.accept.project.invitation=Accept project invitation
-label.account=Account
 label.account.and.security.group=Account, Security group
 label.account.id=Account ID
 label.account.name=Account Name
-label.accounts=Accounts
 label.account.specific=Account-Specific
+label.account=Account
+label.accounts=Accounts
 label.acquire.new.ip=Acquire New IP
-label.action.attach.disk=Attach Disk
 label.action.attach.disk.processing=Attaching Disk....
-label.action.attach.iso=Attach ISO
+label.action.attach.disk=Attach Disk
 label.action.attach.iso.processing=Attaching ISO....
-label.action.cancel.maintenance.mode=Cancel Maintenance Mode
+label.action.attach.iso=Attach ISO
 label.action.cancel.maintenance.mode.processing=Cancelling Maintenance Mode....
+label.action.cancel.maintenance.mode=Cancel Maintenance Mode
 label.action.change.password=Change Password
-label.action.change.service=Change Service
 label.action.change.service.processing=Changing Service....
-label.action.copy.ISO=Copy ISO
+label.action.change.service=Change Service
 label.action.copy.ISO.processing=Coping ISO....
-label.action.copy.template=Copy Template
+label.action.copy.ISO=Copy ISO
 label.action.copy.template.processing=Coping Template....
-label.action.create.template=Create Template
+label.action.copy.template=Copy Template
 label.action.create.template.from.vm=Create Template from VM
 label.action.create.template.from.volume=Create Template from Volume
 label.action.create.template.processing=Creating Template....
-label.action.create.vm=Create VM
+label.action.create.template=Create Template
 label.action.create.vm.processing=Creating VM....
-label.action.create.volume=Create Volume
+label.action.create.vm=Create VM
 label.action.create.volume.processing=Creating Volume....
-label.action.delete.account=Delete account
+label.action.create.volume=Create Volume
 label.action.delete.account.processing=Deleting account....
-label.action.delete.cluster=Delete Cluster
+label.action.delete.account=Delete account
 label.action.delete.cluster.processing=Deleting Cluster....
-label.action.delete.disk.offering=Delete Disk Offering
+label.action.delete.cluster=Delete Cluster
 label.action.delete.disk.offering.processing=Deleting Disk Offering....
-label.action.delete.domain=Delete Domain
+label.action.delete.disk.offering=Delete Disk Offering
 label.action.delete.domain.processing=Deleting Domain....
-label.action.delete.firewall=Delete firewall rule
+label.action.delete.domain=Delete Domain
 label.action.delete.firewall.processing=Deleting Firewall....
-label.action.delete.ingress.rule=Delete Ingress Rule
+label.action.delete.firewall=Delete firewall rule
 label.action.delete.ingress.rule.processing=Deleting Ingress Rule....
-label.action.delete.IP.range=Delete IP Range
+label.action.delete.ingress.rule=Delete Ingress Rule
 label.action.delete.IP.range.processing=Deleting IP Range....
-label.action.delete.ISO=Delete ISO
+label.action.delete.IP.range=Delete IP Range
 label.action.delete.ISO.processing=Deleting ISO....
-label.action.delete.load.balancer=Delete load balancer rule
+label.action.delete.ISO=Delete ISO
 label.action.delete.load.balancer.processing=Deleting Load Balancer....
-label.action.delete.network=Delete Network
+label.action.delete.load.balancer=Delete load balancer rule
 label.action.delete.network.processing=Deleting Network....
+label.action.delete.network=Delete Network
 label.action.delete.nexusVswitch=Delete Nexus 1000v
 label.action.delete.physical.network=Delete physical network
-label.action.delete.pod=Delete Pod
 label.action.delete.pod.processing=Deleting Pod....
-label.action.delete.primary.storage=Delete Primary Storage
+label.action.delete.pod=Delete Pod
 label.action.delete.primary.storage.processing=Deleting Primary Storage....
-label.action.delete.secondary.storage=Delete Secondary Storage
+label.action.delete.primary.storage=Delete Primary Storage
 label.action.delete.secondary.storage.processing=Deleting Secondary Storage....
-label.action.delete.security.group=Delete Security Group
+label.action.delete.secondary.storage=Delete Secondary Storage
 label.action.delete.security.group.processing=Deleting Security Group....
-label.action.delete.service.offering=Delete Service Offering
+label.action.delete.security.group=Delete Security Group
 label.action.delete.service.offering.processing=Deleting Service Offering....
-label.action.delete.snapshot=Delete Snapshot
+label.action.delete.service.offering=Delete Service Offering
 label.action.delete.snapshot.processing=Deleting Snapshot....
+label.action.delete.snapshot=Delete Snapshot
 label.action.delete.system.service.offering=Delete System Service Offering
-label.action.delete.template=Delete Template
 label.action.delete.template.processing=Deleting Template....
-label.action.delete.user=Delete User
+label.action.delete.template=Delete Template
 label.action.delete.user.processing=Deleting User....
-label.action.delete.volume=Delete Volume
+label.action.delete.user=Delete User
 label.action.delete.volume.processing=Deleting Volume....
-label.action.delete.zone=Delete Zone
+label.action.delete.volume=Delete Volume
 label.action.delete.zone.processing=Deleting Zone....
-label.action.destroy.instance=Destroy Instance
+label.action.delete.zone=Delete Zone
 label.action.destroy.instance.processing=Destroying Instance....
-label.action.destroy.systemvm=Destroy System VM
+label.action.destroy.instance=Destroy Instance
 label.action.destroy.systemvm.processing=Destroying System VM....
-label.action.detach.disk=Detach Disk
+label.action.destroy.systemvm=Destroy System VM
 label.action.detach.disk.processing=Detaching Disk....
-label.action.detach.iso=Detach ISO
+label.action.detach.disk=Detach Disk
 label.action.detach.iso.processing=Detaching ISO....
-label.action.disable.account=Disable account
+label.action.detach.iso=Detach ISO
 label.action.disable.account.processing=Disabling account....
-label.action.disable.cluster=Disable Cluster
+label.action.disable.account=Disable account
 label.action.disable.cluster.processing=Disabling Cluster....
+label.action.disable.cluster=Disable Cluster
 label.action.disable.nexusVswitch=Disable Nexus 1000v
 label.action.disable.physical.network=Disable physical network
-label.action.disable.pod=Disable Pod
 label.action.disable.pod.processing=Disabling Pod....
-label.action.disable.static.NAT=Disable Static NAT
+label.action.disable.pod=Disable Pod
 label.action.disable.static.NAT.processing=Disabling Static NAT....
-label.action.disable.user=Disable User
+label.action.disable.static.NAT=Disable Static NAT
 label.action.disable.user.processing=Disabling User....
-label.action.disable.zone=Disable Zone
+label.action.disable.user=Disable User
 label.action.disable.zone.processing=Disabling Zone....
+label.action.disable.zone=Disable Zone
 label.action.download.ISO=Download ISO
 label.action.download.template=Download Template
-label.action.download.volume=Download Volume
 label.action.download.volume.processing=Downloading Volume....
+label.action.download.volume=Download Volume
 label.action.edit.account=Edit account
 label.action.edit.disk.offering=Edit Disk Offering
 label.action.edit.domain=Edit Domain
@@ -147,9 +150,9 @@ label.action.edit.global.setting=Edit Global Setting
 label.action.edit.host=Edit Host
 label.action.edit.instance=Edit Instance
 label.action.edit.ISO=Edit ISO
-label.action.edit.network=Edit Network
 label.action.edit.network.offering=Edit Network Offering
 label.action.edit.network.processing=Editing Network....
+label.action.edit.network=Edit Network
 label.action.edit.pod=Edit Pod
 label.action.edit.primary.storage=Edit Primary Storage
 label.action.edit.resource.limits=Edit Resource Limits
@@ -157,37 +160,37 @@ label.action.edit.service.offering=Edit Service Offering
 label.action.edit.template=Edit Template
 label.action.edit.user=Edit User
 label.action.edit.zone=Edit Zone
-label.action.enable.account=Enable account
 label.action.enable.account.processing=Enabling account....
-label.action.enable.cluster=Enable Cluster
+label.action.enable.account=Enable account
 label.action.enable.cluster.processing=Enabling Cluster....
-label.action.enable.maintenance.mode=Enable Maintenance Mode
+label.action.enable.cluster=Enable Cluster
 label.action.enable.maintenance.mode.processing=Enabling Maintenance Mode....
+label.action.enable.maintenance.mode=Enable Maintenance Mode
 label.action.enable.nexusVswitch=Enable Nexus 1000v
 label.action.enable.physical.network=Enable physical network
-label.action.enable.pod=Enable Pod
 label.action.enable.pod.processing=Enabling Pod....
-label.action.enable.static.NAT=Enable Static NAT
+label.action.enable.pod=Enable Pod
 label.action.enable.static.NAT.processing=Enabling Static NAT....
-label.action.enable.user=Enable User
+label.action.enable.static.NAT=Enable Static NAT
 label.action.enable.user.processing=Enabling User....
-label.action.enable.zone=Enable Zone
+label.action.enable.user=Enable User
 label.action.enable.zone.processing=Enabling Zone....
-label.action.force.reconnect=Force Reconnect
+label.action.enable.zone=Enable Zone
 label.action.force.reconnect.processing=Reconnecting....
-label.action.generate.keys=Generate Keys
+label.action.force.reconnect=Force Reconnect
 label.action.generate.keys.processing=Generate Keys....
+label.action.generate.keys=Generate Keys
 label.action.list.nexusVswitch=List Nexus 1000v
-label.action.lock.account=Lock account
 label.action.lock.account.processing=Locking account....
-label.action.manage.cluster=Manage Cluster
+label.action.lock.account=Lock account
 label.action.manage.cluster.processing=Managing Cluster....
-label.action.migrate.instance=Migrate Instance
+label.action.manage.cluster=Manage Cluster
 label.action.migrate.instance.processing=Migrating Instance....
-label.action.migrate.router=Migrate Router
+label.action.migrate.instance=Migrate Instance
 label.action.migrate.router.processing=Migrating Router....
-label.action.migrate.systemvm=Migrate System VM
+label.action.migrate.router=Migrate Router
 label.action.migrate.systemvm.processing=Migrating System VM....
+label.action.migrate.systemvm=Migrate System VM
 label.action.reboot.instance.processing=Rebooting Instance....
 label.action.reboot.instance=Reboot Instance
 label.action.reboot.router.processing=Rebooting Router....
@@ -208,7 +211,6 @@ label.action.resize.volume=Resize Volume
 label.action.resource.limits=Resource limits
 label.action.restore.instance.processing=Restoring Instance....
 label.action.restore.instance=Restore Instance
-label.actions=Actions
 label.action.start.instance.processing=Starting Instance....
 label.action.start.instance=Start Instance
 label.action.start.router.processing=Starting Router....
@@ -232,18 +234,19 @@ label.action.update.resource.count=Update Resource Count
 label.action.vmsnapshot.create=Take VM Snapshot
 label.action.vmsnapshot.delete=Delete VM snapshot
 label.action.vmsnapshot.revert=Revert to VM snapshot
+label.actions=Actions
 label.activate.project=Activate Project
 label.active.sessions=Active Sessions
+label.add.account.to.project=Add account to project
 label.add.account=Add Account
-label.add.accounts=Add accounts
 label.add.accounts.to=Add accounts to
-label.add.account.to.project=Add account to project
+label.add.accounts=Add accounts
 label.add.ACL=Add ACL
-label.add=Add
+label.add.affinity.group=Add new affinity group
 label.add.BigSwitchVns.device=Add BigSwitch Vns Controller
-label.add.by=Add by
 label.add.by.cidr=Add By CIDR
 label.add.by.group=Add By Group
+label.add.by=Add by
 label.add.cluster=Add Cluster
 label.add.compute.offering=Add compute offering
 label.add.direct.iprange=Add Direct Ip Range
@@ -254,24 +257,15 @@ label.add.F5.device=Add F5 device
 label.add.firewall=Add firewall rule
 label.add.guest.network=Add guest network
 label.add.host=Add Host
-label.adding=Adding
-label.adding.cluster=Adding Cluster
-label.adding.failed=Adding Failed
-label.adding.pod=Adding Pod
-label.adding.processing=Adding....
 label.add.ingress.rule=Add Ingress Rule
-label.adding.succeeded=Adding Succeeded
-label.adding.user=Adding User
-label.adding.zone=Adding Zone
 label.add.ip.range=Add IP Range
-label.additional.networks=Additional Networks
 label.add.load.balancer=Add Load Balancer
 label.add.more=Add More
 label.add.netScaler.device=Add Netscaler device
 label.add.network.ACL=Add network ACL
-label.add.network=Add Network
 label.add.network.device=Add Network Device
 label.add.network.offering=Add network offering
+label.add.network=Add Network
 label.add.new.F5=Add new F5
 label.add.new.gateway=Add new gateway
 label.add.new.NetScaler=Add new NetScaler
@@ -297,21 +291,34 @@ label.add.template=Add Template
 label.add.to.group=Add to group
 label.add.user=Add User
 label.add.vlan=Add VLAN
+label.add.VM.to.tier=Add VM to tier
 label.add.vm=Add VM
-label.add.vms=Add VMs
 label.add.vms.to.lb=Add VM(s) to load balancer rule
-label.add.VM.to.tier=Add VM to tier
+label.add.vms=Add VMs
 label.add.volume=Add Volume
 label.add.vpc=Add VPC
 label.add.vpn.customer.gateway=Add VPN Customer Gateway
 label.add.VPN.gateway=Add VPN Gateway
 label.add.vpn.user=Add VPN user
 label.add.zone=Add Zone
+label.add=Add
+label.adding.cluster=Adding Cluster
+label.adding.failed=Adding Failed
+label.adding.pod=Adding Pod
+label.adding.processing=Adding....
+label.adding.succeeded=Adding Succeeded
+label.adding.user=Adding User
+label.adding.zone=Adding Zone
+label.adding=Adding
+label.additional.networks=Additional Networks
 label.admin.accounts=Admin Accounts
 label.admin=Admin
-label.advanced=Advanced
 label.advanced.mode=Advanced Mode
 label.advanced.search=Advance Search
+label.advanced=Advanced
+label.affinity.group=Affinity Group
+label.affinity.groups=Affinity Groups
+label.affinity=Affinity
 label.agent.password=Agent Password
 label.agent.username=Agent Username
 label.agree=Agree
@@ -319,23 +326,26 @@ label.alert=Alert
 label.algorithm=Algorithm
 label.allocated=Allocated
 label.allocation.state=Allocation State
+label.anti.affinity.group=Anti-affinity Group
+label.anti.affinity.groups=Anti-affinity Groups
+label.anti.affinity=Anti-affinity
 label.api.key=API Key
 label.apply=Apply
-label.assign=Assign
 label.assign.to.load.balancer=Assigning instance to load balancer
-label.associated.network=Associated Network
+label.assign=Assign
 label.associated.network.id=Associated Network ID
+label.associated.network=Associated Network
 label.attached.iso=Attached ISO
 label.author.email=Author e-mail
 label.author.name=Author name
-label.availability=Availability
 label.availability.zone=Availability Zone
-label.available=Available
+label.availability=Availability
 label.available.public.ips=Available Public IP Addresses
+label.available=Available
 label.back=Back
 label.bandwidth=Bandwidth
-label.basic=Basic
 label.basic.mode=Basic Mode
+label.basic=Basic
 label.bigswitch.controller.address=BigSwitch Vns Controller Address
 label.bootable=Bootable
 label.broadcast.domain.range=Broadcast domain range
@@ -350,12 +360,12 @@ label.by.pod=By Pod
 label.by.role=By Role
 label.by.start.date=By Start Date
 label.by.state=By State
-label.bytes.received=Bytes Received
-label.bytes.sent=Bytes Sent
 label.by.traffic.type=By Traffic Type
-label.by.type=By Type
 label.by.type.id=By Type ID
+label.by.type=By Type
 label.by.zone=By Zone
+label.bytes.received=Bytes Received
+label.bytes.sent=Bytes Sent
 label.cancel=Cancel
 label.capacity=Capacity
 label.certificate=Certificate
@@ -364,50 +374,50 @@ label.change.value=Change value
 label.character=Character
 label.checksum=MD5 checksum
 label.cidr.account=CIDR or Account/Security Group
-label.cidr=CIDR
 label.CIDR.list=CIDR list
 label.cidr.list=Source CIDR
 label.CIDR.of.destination.network=CIDR of destination network
+label.cidr=CIDR
 label.clean.up=Clean up
 label.clear.list=Clear list
 label.close=Close
 label.cloud.console=Cloud Management Console
 label.cloud.managed=Cloud.com Managed
-label.cluster=Cluster
 label.cluster.name=Cluster Name
-label.clusters=Clusters
 label.cluster.type=Cluster Type
+label.cluster=Cluster
+label.clusters=Clusters
 label.clvm=CLVM
 label.code=Code
 label.community=Community
 label.compute.and.storage=Compute and Storage
-label.compute=Compute
 label.compute.offering=Compute offering
 label.compute.offerings=Compute offerings
+label.compute=Compute
 label.configuration=Configuration
-label.configure=Configure
 label.configure.network.ACLs=Configure Network ACLs
 label.configure.vpc=Configure VPC
-label.confirmation=Confirmation
+label.configure=Configure
 label.confirm.password=Confirm password
-label.congratulations=Congratulations!
+label.confirmation=Confirmation
+label.congratulations=Congratulations\!
 label.conserve.mode=Conserve mode
 label.console.proxy=Console proxy
 label.continue.basic.install=Continue with basic installation
 label.continue=Continue
 label.corrections.saved=Corrections saved
-label.cpu.allocated=CPU Allocated
 label.cpu.allocated.for.VMs=CPU Allocated for VMs
+label.cpu.allocated=CPU Allocated
 label.CPU.cap=CPU Cap
-label.cpu=CPU
 label.cpu.limits=CPU limits
 label.cpu.mhz=CPU (in MHz)
 label.cpu.utilized=CPU Utilized
-label.created.by.system=Created by system
-label.created=Created
+label.cpu=CPU
 label.create.project=Create project
 label.create.template=Create template
 label.create.VPN.connection=Create VPN Connection
+label.created.by.system=Created by system
+label.created=Created
 label.cross.zones=Cross Zones
 label.custom.disk.size=Custom Disk Size
 label.daily=Daily
@@ -418,11 +428,11 @@ label.day.of.week=Day of Week
 label.dead.peer.detection=Dead Peer Detection
 label.decline.invitation=Decline invitation
 label.dedicated=Dedicated
-label.default=Default
 label.default.use=Default Use
 label.default.view=Default View
+label.default=Default
+label.delete.affinity.group=Delete Affinity Group
 label.delete.BigSwitchVns=Remove BigSwitch Vns Controller
-label.delete=Delete
 label.delete.F5=Delete F5
 label.delete.gateway=delete gateway
 label.delete.NetScaler=Delete NetScaler
@@ -433,58 +443,60 @@ label.delete.VPN.connection=delete VPN connection
 label.delete.VPN.customer.gateway=delete VPN Customer Gateway
 label.delete.VPN.gateway=delete VPN Gateway
 label.delete.vpn.user=Delete VPN user
+label.delete=Delete
 label.deleting.failed=Deleting Failed
 label.deleting.processing=Deleting....
 label.description=Description
 label.destination.physical.network.id=Destination physical network ID
 label.destination.zone=Destination Zone
-label.destroy=Destroy
 label.destroy.router=Destroy router
+label.destroy=Destroy
 label.detaching.disk=Detaching Disk
 label.details=Details
 label.device.id=Device ID
 label.devices=Devices
-label.dhcp=DHCP
 label.DHCP.server.type=DHCP Server Type
+label.dhcp=DHCP
 label.direct.ips=Shared Network IPs
-label.disabled=Disabled
 label.disable.provider=Disable provider
 label.disable.vpn=Disable VPN
+label.disabled=Disabled
 label.disabling.vpn.access=Disabling VPN Access
 label.disk.allocated=Disk Allocated
 label.disk.offering=Disk Offering
-label.disk.size=Disk Size
 label.disk.size.gb=Disk Size (in GB)
+label.disk.size=Disk Size
 label.disk.total=Disk Total
 label.disk.volume=Disk Volume
 label.display.name=Display name
 label.display.text=Display Text
 label.dns.1=DNS 1
 label.dns.2=DNS 2
-label.dns=DNS
 label.DNS.domain.for.guest.networks=DNS domain for Guest Networks
+label.dns=DNS
 label.domain.admin=Domain Admin
-label.domain=Domain
 label.domain.id=Domain ID
 label.domain.name=Domain Name
 label.domain.router=Domain router
 label.domain.suffix=DNS Domain Suffix (i.e., xyz.com)
+label.domain=Domain
 label.done=Done
 label.double.quotes.are.not.allowed=Double quotes are not allowed
 label.download.progress=Download Progress
 label.drag.new.position=Drag to new position
-label.edit=Edit
+label.edit.affinity.group=Edit Affinity Group
 label.edit.lb.rule=Edit LB rule
 label.edit.network.details=Edit network details
 label.edit.project.details=Edit project details
 label.edit.tags=Edit tags
 label.edit.traffic.type=Edit traffic type
 label.edit.vpc=Edit VPC
+label.edit=Edit
 label.egress.rule=Egress rule
 label.egress.rules=Egress rules
-label.elastic=Elastic
 label.elastic.IP=Elastic IP
 label.elastic.LB=Elastic LB
+label.elastic=Elastic
 label.email=Email
 label.enable.provider=Enable provider
 label.enable.s3=Enable S3-backed Secondary Storage
@@ -493,18 +505,17 @@ label.enable.vpn=Enable VPN
 label.enabling.vpn.access=Enabling VPN Access
 label.enabling.vpn=Enabling VPN
 label.end.IP=End IP
-label.endpoint=Endpoint
-label.endpoint.or.operation=Endpoint or Operation
 label.end.port=End Port
 label.end.reserved.system.IP=End Reserved system IP
 label.end.vlan=End Vlan
+label.endpoint.or.operation=Endpoint or Operation
+label.endpoint=Endpoint
 label.enter.token=Enter token
 label.error.code=Error Code
 label.error=Error
 label.ESP.encryption=ESP Encryption
 label.ESP.hash=ESP Hash
 label.ESP.lifetime=ESP Lifetime (second)
-label.ESP.lifetime=ESP Lifetime(second)
 label.ESP.policy=ESP policy
 label.esx.host=ESX/ESXi Host
 label.example=Example
@@ -518,8 +529,8 @@ label.firewall=Firewall
 label.first.name=First Name
 label.format=Format
 label.friday=Friday
-label.full=Full
 label.full.path=Full path
+label.full=Full
 label.gateway=Gateway
 label.general.alerts=General Alerts
 label.generating.url=Generating URL
@@ -527,40 +538,39 @@ label.go.step.2=Go to Step 2
 label.go.step.3=Go to Step 3
 label.go.step.4=Go to Step 4
 label.go.step.5=Go to Step 5
-label.group=Group
 label.group.optional=Group (Optional)
+label.group=Group
 label.guest.cidr=Guest CIDR
 label.guest.end.ip=Guest end IP
 label.guest.gateway=Guest Gateway
-label.guest=Guest
-label.guest.ip=Guest IP Address
 label.guest.ip.range=Guest IP Range
+label.guest.ip=Guest IP Address
 label.guest.netmask=Guest Netmask
 label.guest.networks=Guest networks
 label.guest.start.ip=Guest start IP
 label.guest.traffic=Guest Traffic
 label.guest.type=Guest Type
+label.guest=Guest
 label.ha.enabled=HA Enabled
 label.help=Help
 label.hide.ingress.rule=Hide Ingress Rule
 label.hints=Hints
 label.host.alerts=Host Alerts
-label.host=Host
 label.host.MAC=Host MAC
 label.host.name=Host Name
+label.host.tags=Host Tags
+label.host=Host
 label.hosts=Hosts
-label.host.tags=Host Tags 
 label.hourly=Hourly
 label.hypervisor.capabilities=Hypervisor capabilities
-label.hypervisor=Hypervisor
 label.hypervisor.type=Hypervisor Type
 label.hypervisor.version=Hypervisor version
+label.hypervisor=Hypervisor
 label.id=ID
 label.IKE.DH=IKE DH
 label.IKE.encryption=IKE Encryption
 label.IKE.hash=IKE Hash
 label.IKE.lifetime=IKE lifetime (second)
-label.IKE.lifetime=IKE Lifetime (second)
 label.IKE.policy=IKE policy
 label.info=Info
 label.ingress.rule=Ingress Rule
@@ -575,92 +585,95 @@ label.installWizard.addPrimaryStorageIntro.subtitle=What is primary storage?
 label.installWizard.addPrimaryStorageIntro.title=Let&rsquo;s add primary storage
 label.installWizard.addSecondaryStorageIntro.subtitle=What is secondary storage?
 label.installWizard.addSecondaryStorageIntro.title=Let&rsquo;s add secondary storage
+label.installWizard.addZone.title=Add zone
 label.installWizard.addZoneIntro.subtitle=What is a zone?
 label.installWizard.addZoneIntro.title=Let&rsquo;s add a zone
-label.installWizard.addZone.title=Add zone
 label.installWizard.click.launch=Click the launch button.
-label.installWizard.subtitle=This tour will aid you in setting up your CloudStack&#8482 installation
-label.installWizard.title=Hello and Welcome to CloudStack&#8482
-label.instance=Instance
+label.installWizard.subtitle=This tour will aid you in setting up your CloudStack&\#8482 installation
+label.installWizard.title=Hello and Welcome to CloudStack&\#8482
 label.instance.limits=Instance Limits
 label.instance.name=Instance Name
+label.instance=Instance
 label.instances=Instances
 label.internal.dns.1=Internal DNS 1
 label.internal.dns.2=Internal DNS 2
 label.internal.name=Internal name
 label.interval.type=Interval Type
-label.introduction.to.cloudstack=Introduction to CloudStack&#8482
+label.introduction.to.cloudstack=Introduction to CloudStack&\#8482
 label.invalid.integer=Invalid Integer
 label.invalid.number=Invalid Number
 label.invitations=Invitations
-label.invited.accounts=Invited accounts
-label.invite=Invite
 label.invite.to=Invite to
+label.invite=Invite
+label.invited.accounts=Invited accounts
 label.ip.address=IP Address
-label.ipaddress=IP Address
 label.ip.allocations=IP Allocations
-label.ip=IP
 label.ip.limits=Public IP Limits
 label.ip.or.fqdn=IP or FQDN
 label.ip.range=IP Range
 label.ip.ranges=IP Ranges
-label.IPsec.preshared.key=IPsec Preshared-Key
+label.ip=IP
+label.ipaddress=IP Address
 label.ips=IPs
-label.iscsi=iSCSI
+label.IPsec.preshared.key=IPsec Preshared-Key
 label.is.default=Is Default
+label.is.redundant.router=Redundant
+label.is.shared=Is Shared
+label.is.system=Is System
+label.iscsi=iSCSI
 label.iso.boot=ISO Boot
 label.iso=ISO
 label.isolated.networks=Isolated networks
 label.isolation.method=Isolation method
 label.isolation.mode=Isolation Mode
 label.isolation.uri=Isolation URI
-label.is.redundant.router=Redundant
-label.is.shared=Is Shared
-label.is.system=Is System
 label.item.listing=Item listing
 label.keep=Keep
-label.keyboard.type=Keyboard type
 label.key=Key
+label.keyboard.type=Keyboard type
 label.kvm.traffic.label=KVM traffic label
 label.label=Label
+label.lang.arabic=Arabic
 label.lang.brportugese=Brazilian Portugese
+label.lang.catalan=Catalan
 label.lang.chinese=Chinese (Simplified)
 label.lang.english=English
 label.lang.french=French
+label.lang.german=German
+label.lang.italian=Italian
 label.lang.japanese=Japanese
 label.lang.korean=Korean
+label.lang.norwegian=Norwegian
 label.lang.russian=Russian
 label.lang.spanish=Spanish
 label.last.disconnected=Last Disconnected
 label.last.name=Last Name
 label.latest.events=Latest events
-label.launch=Launch
 label.launch.vm=Launch VM
-label.launch.zone=Launch zone 
+label.launch.zone=Launch zone
+label.launch=Launch
 label.LB.isolation=LB isolation
 label.least.connections=Least connections
 label.level=Level
 label.linklocal.ip=Link Local IP Adddress
 label.load.balancer=Load Balancer
-label.load.balancing=Load Balancing
 label.load.balancing.policies=Load balancing policies
+label.load.balancing=Load Balancing
 label.loading=Loading
-label.local=Local
 label.local.storage.enabled=Local storage enabled
-label.local.storage.enabled=Local Storage Enabled
 label.local.storage=Local Storage
+label.local=Local
 label.login=Login
 label.logout=Logout
+label.LUN.number=LUN \#
 label.lun=LUN
-label.LUN.number=LUN #
 label.make.project.owner=Make account project owner
+label.manage.resources=Manage Resources
 label.manage=Manage
 label.management.ips=Management IP Addresses
 label.management=Management
-label.manage.resources=Manage Resources
 label.max.cpus=Max. CPU cores
 label.max.guest.limit=Max guest limit
-label.maximum=Maximum
 label.max.memory=Max. memory (MiB)
 label.max.networks=Max. networks
 label.max.primary.storage=Max. primary (GiB)
@@ -671,13 +684,14 @@ label.max.templates=Max. templates
 label.max.vms=Max. user VMs
 label.max.volumes=Max. volumes
 label.max.vpcs=Max. VPCs
+label.maximum=Maximum
 label.may.continue=You may now continue.
 label.memory.allocated=Memory Allocated
 label.memory.limits=Memory limits (MiB)
 label.memory.mb=Memory (in MB)
-label.memory=Memory
 label.memory.total=Memory Total
 label.memory.used=Memory Used
+label.memory=Memory
 label.menu.accounts=Accounts
 label.menu.alerts=Alerts
 label.menu.all.accounts=All Accounts
@@ -701,8 +715,8 @@ label.menu.my.accounts=My Accounts
 label.menu.my.instances=My Instances
 label.menu.my.isos=My ISOs
 label.menu.my.templates=My Templates
-label.menu.network=Network
 label.menu.network.offerings=Network Offerings
+label.menu.network=Network
 label.menu.physical.resources=Physical Resources
 label.menu.regions=Regions
 label.menu.running.instances=Running Instances
@@ -712,15 +726,15 @@ label.menu.snapshots=Snapshots
 label.menu.stopped.instances=Stopped Instances
 label.menu.storage=Storage
 label.menu.system.service.offerings=System Offerings
-label.menu.system=System
 label.menu.system.vms=System VMs
+label.menu.system=System
 label.menu.templates=Templates
 label.menu.virtual.appliances=Virtual Appliances
 label.menu.virtual.resources=Virtual Resources
 label.menu.volumes=Volumes
 label.migrate.instance.to.host=Migrate instance to another host
-label.migrate.instance.to=Migrate instance to
 label.migrate.instance.to.ps=Migrate instance to another primary storage
+label.migrate.instance.to=Migrate instance to
 label.migrate.router.to=Migrate Router to
 label.migrate.systemvm.to=Migrate System VM to
 label.migrate.to.host=Migrate to host
@@ -738,24 +752,22 @@ label.move.up.row=Move up one row
 label.my.account=My Account
 label.my.network=My network
 label.my.templates=My templates
-label.name=Name
 label.name.optional=Name (Optional)
+label.name=Name
 label.nat.port.range=NAT Port Range
 label.netmask=Netmask
 label.netScaler=NetScaler
+label.network.ACL.total=Network ACL Total
 label.network.ACL=Network ACL
 label.network.ACLs=Network ACLs
-label.network.ACL.total=Network ACL Total
 label.network.desc=Network Desc
-label.network.device=Network Device
 label.network.device.type=Network Device Type
-label.network.domain=Network Domain
+label.network.device=Network Device
 label.network.domain.text=Network domain
+label.network.domain=Network Domain
 label.network.id=Network ID
-label.networking.and.security=Networking and security
 label.network.label.display.for.blank.value=Use default gateway
 label.network.name=Network Name
-label.network=Network
 label.network.offering.display.text=Network Offering Display Text
 label.network.offering.id=Network Offering ID
 label.network.offering.name=Network Offering Name
@@ -764,18 +776,20 @@ label.network.rate.megabytes=Network Rate (Mb/s)
 label.network.rate=Network Rate
 label.network.read=Network Read
 label.network.service.providers=Network Service Providers
-label.networks=Networks
 label.network.type=Network Type
 label.network.write=Network Write
-label.new=New
+label.network=Network
+label.networking.and.security=Networking and security
+label.networks=Networks
 label.new.password=New Password
 label.new.project=New Project
 label.new.vm=New VM
+label.new=New
 label.next=Next
 label.nexusVswitch=Nexus 1000v
-label.nfs=NFS
 label.nfs.server=NFS Server
 label.nfs.storage=NFS Storage
+label.nfs=NFS
 label.nic.adapter.type=NIC adapter type
 label.nicira.controller.address=Controller Address
 label.nicira.l3gatewayserviceuuid=L3 Gateway Service Uuid
@@ -787,20 +801,19 @@ label.no.data=No data to show
 label.no.errors=No Recent Errors
 label.no.isos=No available ISOs
 label.no.items=No Available Items
-label.none=None
-label.no=No
 label.no.security.groups=No Available Security Groups
-label.not.found=Not Found
 label.no.thanks=No thanks
-label.no.thanks=No Thanks
+label.no=No
+label.none=None
+label.not.found=Not Found
 label.notifications=Notifications
+label.num.cpu.cores=\# of CPU Cores
 label.number.of.clusters=Number of Clusters
 label.number.of.hosts=Number of Hosts
 label.number.of.pods=Number of Pods
 label.number.of.system.vms=Number of System VMs
 label.number.of.virtual.routers=Number of Virtual Routers
 label.number.of.zones=Number of Zones
-label.num.cpu.cores=# of CPU Cores
 label.numretries=Number of Retries
 label.ocfs2=OCFS2
 label.offer.ha=Offer HA
@@ -811,14 +824,14 @@ label.os.preference=OS Preference
 label.os.type=OS Type
 label.owned.public.ips=Owned Public IP Addresses
 label.owner.account=Owner Account
-label.owner.domain=Owner Domain  
+label.owner.domain=Owner Domain
 label.parent.domain=Parent Domain
 label.password.enabled=Password Enabled
 label.password=Password
 label.path=Path
 label.perfect.forward.secrecy=Perfect Forward Secrecy
 label.physical.network.ID=Physical network ID
-label.physical.network=Physical Network        
+label.physical.network=Physical Network
 label.PING.CIFS.password=PING CIFS password
 label.PING.CIFS.username=PING CIFS username
 label.PING.dir=PING Directory
@@ -834,8 +847,8 @@ label.port.forwarding.policies=Port forwarding policies
 label.port.forwarding=Port Forwarding
 label.port.range=Port Range
 label.PreSetup=PreSetup
-label.previous=Previous
 label.prev=Prev
+label.previous=Previous
 label.primary.allocated=Primary Storage Allocated
 label.primary.network=Primary Network
 label.primary.storage.count=Primary Storage Pools
@@ -844,20 +857,20 @@ label.primary.storage=Primary Storage
 label.primary.used=Primary Storage Used
 label.private.Gateway=Private Gateway
 label.private.interface=Private Interface
-label.private.ip=Private IP Address
 label.private.ip.range=Private IP Range
+label.private.ip=Private IP Address
 label.private.ips=Private IP Addresses
-label.privatekey=PKCS#8 Private Key
 label.private.network=Private network
 label.private.port=Private Port
 label.private.zone=Private Zone
+label.privatekey=PKCS\#8 Private Key
 label.project.dashboard=Project dashboard
 label.project.id=Project ID
 label.project.invite=Invite to project
 label.project.name=Project name
+label.project.view=Project View
 label.project=Project
 label.projects=Projects
-label.project.view=Project View
 label.protocol=Protocol
 label.providers=Providers
 label.public.interface=Public Interface
@@ -865,9 +878,9 @@ label.public.ip=Public IP Address
 label.public.ips=Public IP Addresses
 label.public.network=Public network
 label.public.port=Public Port
-label.public=Public
-label.public.traffic=Public traffic     
+label.public.traffic=Public traffic
 label.public.zone=Public Zone
+label.public=Public
 label.purpose=Purpose
 label.Pxe.server.type=Pxe Server Type
 label.quickview=Quickview
@@ -887,7 +900,6 @@ label.remove.ingress.rule=Remove ingress rule
 label.remove.ip.range=Remove IP range
 label.remove.pf=Remove port forwarding rule
 label.remove.project.account=Remove account from project
-label.remove.project.account=Remove project account
 label.remove.region=Remove Region
 label.remove.rule=Remove rule
 label.remove.static.nat.rule=Remove static NAT rule
@@ -895,8 +907,8 @@ label.remove.static.route=Remove static route
 label.remove.tier=Remove tier
 label.remove.vm.from.lb=Remove VM from load balancer rule
 label.remove.vpc=remove VPC
-label.removing=Removing
 label.removing.user=Removing User
+label.removing=Removing
 label.required=Required
 label.reserved.system.gateway=Reserved system gateway
 label.reserved.system.ip=Reserved System IP
@@ -906,9 +918,9 @@ label.resize.new.offering.id=New Offering
 label.resize.new.size=New Size(GB)
 label.resize.shrink.ok=Shrink OK
 label.resource.limits=Resource Limits
+label.resource.state=Resource state
 label.resource=Resource
 label.resources=Resources
-label.resource.state=Resource state
 label.restart.network=Restart network
 label.restart.required=Restart required
 label.restart.vpc=restart VPC
@@ -937,36 +949,36 @@ label.scope=Scope
 label.search=Search
 label.secondary.storage.count=Secondary Storage Pools
 label.secondary.storage.limits=Secondary Storage limits (GiB)
-label.secondary.storage=Secondary Storage
 label.secondary.storage.vm=Secondary storage VM
+label.secondary.storage=Secondary Storage
 label.secondary.used=Secondary Storage Used
 label.secret.key=Secret Key
 label.security.group.name=Security Group Name
 label.security.group=Security Group
 label.security.groups.enabled=Security Groups Enabled
 label.security.groups=Security Groups
+label.select-view=Select view
 label.select.a.template=Select a template
 label.select.a.zone=Select a zone
-label.select.instance=Select instance
 label.select.instance.to.attach.volume.to=Select instance to attach volume to
+label.select.instance=Select instance
 label.select.iso.or.template=Select ISO or template
 label.select.offering=Select offering
 label.select.project=Select Project
-label.select=Select
 label.select.tier=Select Tier
-label.select-view=Select view
 label.select.vm.for.static.nat=Select VM for static NAT
+label.select=Select
 label.sent=Sent
 label.server=Server
 label.service.capabilities=Service Capabilities
 label.service.offering=Service Offering
 label.session.expired=Session Expired
+label.set.up.zone.type=Set up zone type
 label.setup.network=Setup Network
-label.setup=Setup
 label.setup.zone=Setup Zone
-label.set.up.zone.type=Set up zone type
-label.SharedMountPoint=SharedMountPoint
+label.setup=Setup
 label.shared=Shared
+label.SharedMountPoint=SharedMountPoint
 label.show.ingress.rule=Show Ingress Rule
 label.shutdown.provider=Shutdown provider
 label.site.to.site.VPN=Site-to-site VPN
@@ -974,9 +986,9 @@ label.size=Size
 label.skip.guide=I have used CloudStack before, skip this guide
 label.snapshot.limits=Snapshot Limits
 label.snapshot.name=Snapshot Name
+label.snapshot.s=Snapshot (s)
 label.snapshot.schedule=Setup Recurring Snapshot
 label.snapshot=Snapshot
-label.snapshot.s=Snapshot (s)
 label.snapshots=Snapshots
 label.source.nat=Source NAT
 label.source=Source
@@ -990,21 +1002,21 @@ label.start.reserved.system.IP=Start Reserved system IP
 label.start.vlan=Start Vlan
 label.state=State
 label.static.nat.enabled=Static NAT Enabled
-label.static.nat=Static NAT
 label.static.nat.to=Static NAT to
 label.static.nat.vm.details=Static NAT VM Details
+label.static.nat=Static NAT
 label.statistics=Statistics
 label.status=Status
+label.step.1.title=Step 1\: <strong>Select a Template</strong>
 label.step.1=Step 1
-label.step.1.title=Step 1: <strong>Select a Template</strong>
+label.step.2.title=Step 2\: <strong>Service Offering</strong>
 label.step.2=Step 2
-label.step.2.title=Step 2: <strong>Service Offering</strong>
+label.step.3.title=Step 3\: <strong id\="step3_label">Select a Disk Offering</strong>
 label.step.3=Step 3
-label.step.3.title=Step 3: <strong id="step3_label">Select a Disk Offering</strong>
+label.step.4.title=Step 4\: <strong>Network</strong>
 label.step.4=Step 4
-label.step.4.title=Step 4: <strong>Network</strong>
+label.step.5.title=Step 5\: <strong>Review</strong>
 label.step.5=Step 5
-label.step.5.title=Step 5: <strong>Review</strong>
 label.stickiness=Stickiness
 label.sticky.cookie-name=Cookie name
 label.sticky.domain=Domain
@@ -1018,15 +1030,15 @@ label.sticky.postonly=Post only
 label.sticky.prefix=Prefix
 label.sticky.request-learn=Request learn
 label.sticky.tablesize=Table size
-label.stopped.vms=Stopped VMs
 label.stop=Stop
-label.storage=Storage
+label.stopped.vms=Stopped VMs
 label.storage.tags=Storage Tags
 label.storage.traffic=Storage Traffic
 label.storage.type=Storage Type
+label.storage=Storage
 label.subdomain.access=Subdomain Access
 label.submit=Submit
-label.submitted.by=[Submitted by: <span id="submitted_by"></span>]
+label.submitted.by=[Submitted by\: <span id\="submitted_by"></span>]
 label.succeeded=Succeeded
 label.sunday=Sunday
 label.super.cidr.for.guest.networks=Super CIDR for Guest Networks
@@ -1036,9 +1048,9 @@ label.suspend.project=Suspend Project
 label.system.capacity=System Capacity
 label.system.offering=System Offering
 label.system.service.offering=System Service Offering
-label.system.vms=System VMs
-label.system.vm=System VM
 label.system.vm.type=System VM Type
+label.system.vm=System VM
+label.system.vms=System VMs
 label.system.wide.capacity=System-wide capacity
 label.tagged=Tagged
 label.tags=Tags
@@ -1053,14 +1065,14 @@ label.theme.lightblue=Custom - Light Blue
 label.thursday=Thursday
 label.tier.details=Tier details
 label.tier=Tier
+label.time.zone=Timezone
+label.time=Time
 label.timeout.in.second = Timeout(seconds)
 label.timeout=Timeout
-label.time=Time
-label.time.zone=Timezone
 label.timezone=Timezone
 label.token=Token
-label.total.cpu=Total CPU
 label.total.CPU=Total CPU
+label.total.cpu=Total CPU
 label.total.hosts=Total Hosts
 label.total.memory=Total Memory
 label.total.of.ip=Total of IP Address
@@ -1068,8 +1080,8 @@ label.total.of.vm=Total of VM
 label.total.storage=Total Storage
 label.total.vms=Total VMs
 label.traffic.label=Traffic label
-label.traffic.types=Traffic Types
 label.traffic.type=Traffic Type
+label.traffic.types=Traffic Types
 label.tuesday=Tuesday
 label.type.id=Type ID
 label.type=Type
@@ -1080,15 +1092,15 @@ label.update.project.resources=Update project resources
 label.update.ssl.cert= SSL Certificate
 label.update.ssl= SSL Certificate
 label.updating=Updating
-label.upload=Upload
 label.upload.volume=Upload volume
+label.upload=Upload
 label.url=URL
 label.usage.interface=Usage Interface
+label.use.vm.ip=Use VM IP\:
 label.used=Used
+label.user=User
 label.username=Username
 label.users=Users
-label.user=User
-label.use.vm.ip=Use VM IP:
 label.value=Value
 label.vcdcname=vCenter DC name
 label.vcenter.cluster=vCenter Cluster
@@ -1101,47 +1113,47 @@ label.vcipaddress=vCenter IP Address
 label.version=Version
 label.view.all=View all
 label.view.console=View console
-label.viewing=Viewing
 label.view.more=View more
 label.view=View
-label.virtual.appliances=Virtual Appliances
+label.viewing=Viewing
 label.virtual.appliance=Virtual Appliance
+label.virtual.appliances=Virtual Appliances
 label.virtual.machines=Virtual machines
 label.virtual.network=Virtual Network
-label.virtual.routers=Virtual Routers
 label.virtual.router=Virtual Router
+label.virtual.routers=Virtual Routers
 label.vlan.id=VLAN ID
 label.vlan.range=VLAN Range
 label.vlan=VLAN
 label.vm.add=Add Instance
 label.vm.destroy=Destroy
 label.vm.display.name=VM display name
-label.VMFS.datastore=VMFS datastore
-label.vmfs=VMFS
 label.vm.name=VM name
 label.vm.reboot=Reboot
+label.vm.start=Start
+label.vm.state=VM state
+label.vm.stop=Stop
+label.VMFS.datastore=VMFS datastore
+label.vmfs=VMFS
 label.VMs.in.tier=VMs in tier
+label.vms=VMs
 label.vmsnapshot.current=isCurrent
 label.vmsnapshot.memory=Snapshot memory
 label.vmsnapshot.parentname=Parent
 label.vmsnapshot.type=Type
 label.vmsnapshot=VM Snapshots
-label.vm.start=Start
-label.vm.state=VM state
-label.vm.stop=Stop
-label.vms=VMs
 label.vmware.traffic.label=VMware traffic label
 label.volgroup=Volume Group
 label.volume.limits=Volume Limits
 label.volume.name=Volume Name
-label.volumes=Volumes
 label.volume=Volume
+label.volumes=Volumes
 label.vpc.id=VPC ID
 label.VPC.router.details=VPC router details
 label.vpc=VPC
 label.VPN.connection=VPN Connection
-label.vpn.customer.gateway=VPN Customer Gateway
 label.VPN.customer.gateway=VPN Customer Gateway
+label.vpn.customer.gateway=VPN Customer Gateway
 label.VPN.gateway=VPN Gateway
 label.vpn=VPN
 label.vsmctrlvlanid=Control VLAN ID
@@ -1154,27 +1166,27 @@ label.wednesday=Wednesday
 label.weekly=Weekly
 label.welcome.cloud.console=Welcome to Management Console
 label.welcome=Welcome
-label.what.is.cloudstack=What is CloudStack&#8482?
+label.what.is.cloudstack=What is CloudStack&\#8482?
 label.xen.traffic.label=XenServer traffic label
 label.yes=Yes
 label.zone.details=Zone details
 label.zone.id=Zone ID
 label.zone.name=Zone name
-label.zone.step.1.title=Step 1: <strong>Select a Network</strong>
-label.zone.step.2.title=Step 2: <strong>Add a Zone</strong>
-label.zone.step.3.title=Step 3: <strong>Add a Pod</strong>
-label.zone.step.4.title=Step 4: <strong>Add an IP range</strong>
-label.zones=Zones
+label.zone.step.1.title=Step 1\: <strong>Select a Network</strong>
+label.zone.step.2.title=Step 2\: <strong>Add a Zone</strong>
+label.zone.step.3.title=Step 3\: <strong>Add a Pod</strong>
+label.zone.step.4.title=Step 4\: <strong>Add an IP range</strong>
 label.zone.type=Zone Type
 label.zone.wide=Zone-Wide
-label.zoneWizard.trafficType.guest=Guest: Traffic between end-user virtual machines
-label.zoneWizard.trafficType.management=Management: Traffic between CloudStack\'s internal resources, including any components that communicate with the Management Server, such as hosts and CloudStack system VMs
-label.zoneWizard.trafficType.public=Public: Traffic between the internet and virtual machines in the cloud.
-label.zoneWizard.trafficType.storage=Storage: Traffic between primary and secondary storage servers, such as VM templates and snapshots
 label.zone=Zone
+label.zones=Zones
+label.zoneWizard.trafficType.guest=Guest\: Traffic between end-user virtual machines
+label.zoneWizard.trafficType.management=Management\: Traffic between CloudStack\\\\'s internal resources, including any components that communicate with the Management Server, such as hosts and CloudStack system VMs
+label.zoneWizard.trafficType.public=Public\: Traffic between the internet and virtual machines in the cloud.
+label.zoneWizard.trafficType.storage=Storage\: Traffic between primary and secondary storage servers, such as VM templates and snapshots
 managed.state=Managed State
-message.acquire.new.ip=Please confirm that you would like to acquire a new IP for this network.
 message.acquire.new.ip.vpc=Please confirm that you would like to acquire a new IP for this VPC.
+message.acquire.new.ip=Please confirm that you would like to acquire a new IP for this network.
 message.acquire.public.ip=Please select a zone from which you want to acquire your new IP from.
 message.action.cancel.maintenance.mode=Please confirm that you want to cancel this maintenance.
 message.action.cancel.maintenance=Your host has been successfully canceled for maintenance. This process can take up to several minutes.
@@ -1183,8 +1195,8 @@ message.action.change.service.warning.for.router=Your router must be stopped bef
 message.action.delete.cluster=Please confirm that you want to delete this cluster.
 message.action.delete.disk.offering=Please confirm that you want to delete this disk offering.
 message.action.delete.domain=Please confirm that you want to delete this domain.
-message.action.delete.external.firewall=Please confirm that you would like to remove this external firewall. Warning: If you are planning to add back the same external firewall, you must reset usage data on the device.
-message.action.delete.external.load.balancer=Please confirm that you would like to remove this external load balancer. Warning: If you are planning to add back the same external load balancer, you must reset usage data on the device.
+message.action.delete.external.firewall=Please confirm that you would like to remove this external firewall. Warning\: If you are planning to add back the same external firewall, you must reset usage data on the device.
+message.action.delete.external.load.balancer=Please confirm that you would like to remove this external load balancer. Warning\: If you are planning to add back the same external load balancer, you must reset usage data on the device.
 message.action.delete.ingress.rule=Please confirm that you want to delete this ingress rule.
 message.action.delete.ISO.for.all.zones=The ISO is used by all zones. Please confirm that you want to delete it from all zones.
 message.action.delete.ISO=Please confirm that you want to delete this ISO.
@@ -1220,15 +1232,14 @@ message.action.enable.pod=Please confirm that you want to enable this pod.
 message.action.enable.zone=Please confirm that you want to enable this zone.
 message.action.force.reconnect=Your host has been successfully forced to reconnect.  This process can take up to several minutes.
 message.action.host.enable.maintenance.mode=Enabling maintenance mode will cause a live migration of all running instances on this host to any available host.
-message.action.instance.reset.password=Please confirm that you want to change the ROOT password for this virtual machine.  
+message.action.instance.reset.password=Please confirm that you want to change the ROOT password for this virtual machine.
 message.action.manage.cluster=Please confirm that you want to manage the cluster.
-message.action.primarystorage.enable.maintenance.mode=Warning: placing the primary storage into maintenance mode will cause all VMs using volumes from it to be stopped.  Do you want to continue?
+message.action.primarystorage.enable.maintenance.mode=Warning\: placing the primary storage into maintenance mode will cause all VMs using volumes from it to be stopped.  Do you want to continue?
 message.action.reboot.instance=Please confirm that you want to reboot this instance.
 message.action.reboot.router=All services provided by this virtual router will be interrupted. Please confirm that you want to reboot this router.
 message.action.reboot.systemvm=Please confirm that you want to reboot this system VM.
 message.action.release.ip=Please confirm that you want to release this IP.
 message.action.remove.host=Please confirm that you want to remove this host.
-message.action.remove.host=Removing last/only host in cluster and reinstalling the host will destroy working environment/database on the host and render the VM Guests unuseable.
 message.action.reset.password.off=Your instance currently does not support this feature.
 message.action.reset.password.warning=Your instance must be stopped before attempting to change its current password.
 message.action.restore.instance=Please confirm that you want to restore this instance.
@@ -1243,40 +1254,40 @@ message.action.unmanage.cluster=Please confirm that you want to unmanage the clu
 message.action.vmsnapshot.delete=Please confirm that you want to delete this VM snapshot.
 message.action.vmsnapshot.revert=Revert VM snapshot
 message.activate.project=Are you sure you want to activate this project?
-message.add.cluster=Add a hypervisor managed cluster for zone <b><span id="zone_name"></span></b>, pod <b><span id="pod_name"></span></b>
-message.add.cluster.zone=Add a hypervisor managed cluster for zone <b><span id="zone_name"></span></b>
+message.add.cluster.zone=Add a hypervisor managed cluster for zone <b><span id\="zone_name"></span></b>
+message.add.cluster=Add a hypervisor managed cluster for zone <b><span id\="zone_name"></span></b>, pod <b><span id\="pod_name"></span></b>
 message.add.disk.offering=Please specify the following parameters to add a new disk offering
 message.add.domain=Please specify the subdomain you want to create under this domain
 message.add.firewall=Add a firewall to zone
 message.add.guest.network=Please confirm that you would like to add a guest network
 message.add.host=Please specify the following parameters to add a new host
-message.adding.host=Adding host
-message.adding.Netscaler.device=Adding Netscaler device
-message.adding.Netscaler.provider=Adding Netscaler provider
+message.add.ip.range.direct.network=Add an IP range to direct network <b><span id\="directnetwork_name"></span></b> in zone <b><span id\="zone_name"></span></b>
+message.add.ip.range.to.pod=<p>Add an IP range to pod\: <b><span id\="pod_name_label"></span></b></p>
 message.add.ip.range=Add an IP range to public network in zone
-message.add.ip.range.direct.network=Add an IP range to direct network <b><span id="directnetwork_name"></span></b> in zone <b><span id="zone_name"></span></b>
-message.add.ip.range.to.pod=<p>Add an IP range to pod: <b><span id="pod_name_label"></span></b></p>
-message.additional.networks.desc=Please select additional network(s) that your virtual instance will be connected to.
+message.add.load.balancer.under.ip=The load balancer rule has been added under IP\:
 message.add.load.balancer=Add a load balancer to zone
-message.add.load.balancer.under.ip=The load balancer rule has been added under IP:
-message.add.network=Add a new network for zone: <b><span id="zone_name"></span></b>
+message.add.network=Add a new network for zone\: <b><span id\="zone_name"></span></b>
 message.add.new.gateway.to.vpc=Please specify the information to add a new gateway to this VPC.
-message.add.pod=Add a new pod for zone <b><span id="add_pod_zone_name"></span></b>
-message.add.pod.during.zone.creation=Each zone must contain in one or more pods, and we will add the first pod now. A pod contains hosts and primary storage servers, which you will add in a later step. First, configure a range of reserved IP addresses for CloudStack's internal management traffic. The reserved IP range must be unique for each zone in the cloud.
+message.add.pod.during.zone.creation=Each zone must contain in one or more pods, and we will add the first pod now. A pod contains hosts and primary storage servers, which you will add in a later step. First, configure a range of reserved IP addresses for CloudStack\\'s internal management traffic. The reserved IP range must be unique for each zone in the cloud.
+message.add.pod=Add a new pod for zone <b><span id\="add_pod_zone_name"></span></b>
+message.add.primary.storage=Add a new Primary Storage for zone <b><span id\="zone_name"></span></b>, pod <b><span id\="pod_name"></span></b>
 message.add.primary=Please specify the following parameters to add a new primary storage
-message.add.primary.storage=Add a new Primary Storage for zone <b><span id="zone_name"></span></b>, pod <b><span id="pod_name"></span></b>
 message.add.region=Please specify the required information to add a new region.
-message.add.secondary.storage=Add a new storage for zone <b><span id="zone_name"></span></b>
+message.add.secondary.storage=Add a new storage for zone <b><span id\="zone_name"></span></b>
 message.add.service.offering=Please fill in the following data to add a new compute offering.
 message.add.system.service.offering=Please fill in the following data to add a new system service offering.
 message.add.template=Please enter the following data to create your new template
 message.add.volume=Please fill in the following data to add a new volume.
 message.add.VPN.gateway=Please confirm that you want to add a VPN Gateway
+message.adding.host=Adding host
+message.adding.Netscaler.device=Adding Netscaler device
+message.adding.Netscaler.provider=Adding Netscaler provider
+message.additional.networks.desc=Please select additional network(s) that your virtual instance will be connected to.
 message.advanced.mode.desc=Choose this network model if you wish to enable VLAN support.  This network model provides the most flexibility in allowing administrators to provide custom network offerings such as providing firewall, vpn, or load balancer support as well as enabling direct vs virtual networking.
 message.advanced.security.group=Choose this if you wish to use security groups to provide guest VM isolation.
 message.advanced.virtual=Choose this if you wish to use zone-wide VLANs to provide guest VM isolation.
-message.after.enable.s3=S3-backed Secondary Storage configured. Note: When you leave this page, you will not be able to re-configure S3 again.
-message.after.enable.swift=Swift configured. Note: When you leave this page, you will not be able to re-configure Swift again.
+message.after.enable.s3=S3-backed Secondary Storage configured. Note\: When you leave this page, you will not be able to re-configure S3 again.
+message.after.enable.swift=Swift configured. Note\: When you leave this page, you will not be able to re-configure Swift again.
 message.alert.state.detected=Alert state detected
 message.allow.vpn.access=Please enter a username and password of the user that you want to allow VPN access.
 message.apply.snapshot.policy=You have successfully updated your current snapshot policy.
@@ -1301,10 +1312,10 @@ message.confirm.join.project=Please confirm you wish to join this project.
 message.confirm.remove.IP.range=Please confirm that you would like to remove this IP range.
 message.confirm.shutdown.provider=Please confirm that you would like to shutdown this provider
 message.copy.iso.confirm=Please confirm that you wish to copy your ISO to
-message.copy.template=Copy template <b id="copy_template_name_text">XXX</b> from zone <b id="copy_template_source_zone_text"></b> to
+message.copy.template=Copy template <b id\="copy_template_name_text">XXX</b> from zone <b id\="copy_template_source_zone_text"></b> to
+message.create.template.vm=Create VM from template <b id\="p_name"></b>
+message.create.template.volume=Please specify the following information before creating a template of your disk volume\: <b><span id\="volume_name"></span></b>. Creation of the template can range from several minutes to longer depending on the size of the volume.
 message.create.template=Are you sure you want to create template?
-message.create.template.vm=Create VM from template <b id="p_name"></b>
-message.create.template.volume=Please specify the following information before creating a template of your disk volume: <b><span id="volume_name"></span></b>. Creation of the template can range from several minutes to longer depending on the size of the volume.
 message.creating.cluster=Creating cluster
 message.creating.guest.network=Creating guest network
 message.creating.physical.networks=Creating physical networks
@@ -1314,6 +1325,7 @@ message.creating.secondary.storage=Creating secondary storage
 message.creating.zone=Creating zone
 message.decline.invitation=Are you sure you want to decline this project invitation?
 message.delete.account=Please confirm that you want to delete this account.
+message.delete.affinity.group=Please confirm that you would like to remove this affinity group.
 message.delete.gateway=Please confirm you want to delete the gateway
 message.delete.project=Are you sure you want to delete this project?
 message.delete.user=Please confirm that you would like to delete this user.
@@ -1323,31 +1335,31 @@ message.delete.VPN.gateway=Please confirm that you want to delete this VPN Gatew
 message.desc.advanced.zone=For more sophisticated network topologies. This network model provides the most flexibility in defining guest networks and providing custom network offerings such as firewall, VPN, or load balancer support.
 message.desc.basic.zone=Provide a single network where each VM instance is assigned an IP directly from the network. Guest isolation can be provided through layer-3 means such as security groups (IP address source filtering).
 message.desc.cluster=Each pod must contain one or more clusters, and we will add the first cluster now. A cluster provides a way to group hosts. The hosts in a cluster all have identical hardware, run the same hypervisor, are on the same subnet, and access the same shared storage. Each cluster consists of one or more hosts and one or more primary storage servers.
-message.desc.host=Each cluster must contain at least one host (computer) for guest VMs to run on, and we will add the first host now. For a host to function in CloudStack, you must install hypervisor software on the host, assign an IP address to the host, and ensure the host is connected to the CloudStack management server.<br/><br/>Give the host's DNS or IP address, the user name (usually root) and password, and any labels you use to categorize hosts.
+message.desc.host=Each cluster must contain at least one host (computer) for guest VMs to run on, and we will add the first host now. For a host to function in CloudStack, you must install hypervisor software on the host, assign an IP address to the host, and ensure the host is connected to the CloudStack management server.<br/><br/>Give the host\\'s DNS or IP address, the user name (usually root) and password, and any labels you use to categorize hosts.
 message.desc.primary.storage=Each cluster must contain one or more primary storage servers, and we will add the first one now. Primary storage contains the disk volumes for all the VMs running on hosts in the cluster. Use any standards-compliant protocol that is supported by the underlying hypervisor.
 message.desc.secondary.storage=Each zone must have at least one NFS or secondary storage server, and we will add the first one now. Secondary storage stores VM templates, ISO images, and VM disk volume snapshots. This server must be available to all hosts in the zone.<br/><br/>Provide the IP address and exported path.
 message.desc.zone=A zone is the largest organizational unit in CloudStack, and it typically corresponds to a single datacenter. Zones provide physical isolation and redundancy. A zone consists of one or more pods (each of which contains hosts and primary storage servers) and a secondary storage server which is shared by all pods in the zone.
 message.detach.disk=Are you sure you want to detach this disk?
 message.detach.iso.confirm=Please confirm that you want to detach the ISO from this virtual instance.
-message.disable.account=Please confirm that you want to disable this account.  By disabling the account, all users for this account will no longer have access to their cloud resources.  All running virtual machines will be immediately shut down. 
+message.disable.account=Please confirm that you want to disable this account.  By disabling the account, all users for this account will no longer have access to their cloud resources.  All running virtual machines will be immediately shut down.
 message.disable.snapshot.policy=You have successfully disabled your current snapshot policy.
 message.disable.user=Please confirm that you would like to disable this user.
 message.disable.vpn.access=Please confirm that you want to disable VPN Access.
 message.disable.vpn=Are you sure you want to disable VPN?
-message.download.ISO=Please click <a href="#">00000</a> to download ISO    
-message.download.template=Please click <a href="#">00000</a> to download template 
+message.download.ISO=Please click <a href\="\#">00000</a> to download ISO
+message.download.template=Please click <a href\="\#">00000</a> to download template
 message.download.volume.confirm=Please confirm that you want to download this volume
-message.download.volume=Please click <a href="#">00000</a> to download volume
+message.download.volume=Please click <a href\="\#">00000</a> to download volume
 message.edit.account=Edit ("-1" indicates no limit to the amount of resources create)
 message.edit.confirm=Please confirm that your changes before clicking "Save".
 message.edit.limits=Please specify limits to the following resources.  A "-1" indicates no limit to the amount of resources create.
 message.edit.traffic.type=Please specify the traffic label you want associated with this traffic type.
 message.enable.account=Please confirm that you want to enable this account.
-message.enabled.vpn.ip.sec=Your IPSec pre-shared key is
-message.enabled.vpn=Your VPN access is currently enabled and can be accessed via the IP
 message.enable.user=Please confirm that you would like to enable this user.
 message.enable.vpn.access=VPN is currently disabled for this IP Address.  Would you like to enable VPN access?
 message.enable.vpn=Please confirm that you want VPN access enabled for this IP address.
+message.enabled.vpn.ip.sec=Your IPSec pre-shared key is
+message.enabled.vpn=Your VPN access is currently enabled and can be accessed via the IP
 message.enabling.security.group.provider=Enabling Security Group provider
 message.enabling.zone=Enabling zone
 message.enter.token=Please enter the token that you were given in your invite e-mail.
@@ -1355,14 +1367,14 @@ message.generate.keys=Please confirm that you would like to generate new keys fo
 message.guest.traffic.in.advanced.zone=Guest network traffic is communication between end-user virtual machines. Specify a range of VLAN IDs to carry guest traffic for each physical network.
 message.guest.traffic.in.basic.zone=Guest network traffic is communication between end-user virtual machines. Specify a range of IP addresses that CloudStack can assign to guest VMs. Make sure this range does not overlap the reserved system IP range.
 message.installWizard.click.retry=Click the button to retry launch.
-message.installWizard.copy.whatIsACluster=A cluster provides a way to group hosts. The hosts in a cluster all have identical hardware, run the same hypervisor, are on the same subnet, and access the same shared storage. Virtual machine instances (VMs) can be live-migrated from one host to another within the same cluster, without interrupting service to the user. A cluster is the third-largest organizational unit within a CloudStack&#8482; deployment. Clusters are contained within pods, and pods are contained within zones.<br/><br/>CloudStack&#8482; allows multiple clusters in a cloud deployment, but for a Basic Installation, we only need one cluster. 
-message.installWizard.copy.whatIsAHost=A host is a single computer. Hosts provide the computing resources that run the guest virtual machines. Each host has hypervisor software installed on it to manage the guest VMs (except for bare metal hosts, which are a special case discussed in the Advanced Installation Guide). For example, a Linux KVM-enabled server, a Citrix XenServer server, and an ESXi server are hosts. In a Basic Installation, we use a single host running XenServer or KVM.<br/><br/>The host is the smallest organizational unit within a CloudStack&#8482; deployment. Hosts are contained within clusters, clusters are contained within pods, and pods are contained within zones. 
-message.installWizard.copy.whatIsAPod=A pod often represents a single rack. Hosts in the same pod are in the same subnet.<br/><br/>A pod is the second-largest organizational unit within a CloudStack&#8482; deployment. Pods are contained within zones. Each zone can contain one or more pods; in the Basic Installation, you will have just one pod in your zone.
-message.installWizard.copy.whatIsAZone=A zone is the largest organizational unit within a CloudStack&#8482; deployment. A zone typically corresponds to a single datacenter, although it is permissible to have multiple zones in a datacenter. The benefit of organizing infrastructure into zones is to provide physical isolation and redundancy. For example, each zone can have its own power supply and network uplink, and the zones can be widely separated geographically (though this is not required).
-message.installWizard.copy.whatIsCloudStack=CloudStack&#8482 is a software platform that pools computing resources to build public, private, and hybrid Infrastructure as a Service (IaaS) clouds. CloudStack&#8482 manages the network, storage, and compute nodes that make up a cloud infrastructure. Use CloudStack&#8482 to deploy, manage, and configure cloud computing environments.<br/><br/>Extending beyond individual virtual machine images running on commodity hardware, CloudStack&#8482 provides a turnkey cloud infrastructure software stack for delivering virtual datacenters as a service - delivering all of the essential components to build, deploy, and manage multi-tier and multi-tenant cloud applications. Both open-source and Premium versions are available, with the open-source version offering nearly identical features. 
-message.installWizard.copy.whatIsPrimaryStorage=A CloudStack&#8482; cloud infrastructure makes use of two types of storage: primary storage and secondary storage. Both of these can be iSCSI or NFS servers, or localdisk.<br/><br/><strong>Primary storage</strong> is associated with a cluster, and it stores the disk volumes of each guest VM for all the VMs running on hosts in that cluster. The primary storage server is typically located close to the hosts. 
-message.installWizard.copy.whatIsSecondaryStorage=Secondary storage is associated with a zone, and it stores the following:<ul><li>Templates - OS images that can be used to boot VMs and can include additional configuration information, such as installed applications</li><li>ISO images - OS images that can be bootable or non-bootable</li><li>Disk volume snapshots - saved copies of VM data which can be used for data recovery or to create new templates</ul>
-message.installWizard.now.building=Now building your cloud... 
+message.installWizard.copy.whatIsACluster=A cluster provides a way to group hosts. The hosts in a cluster all have identical hardware, run the same hypervisor, are on the same subnet, and access the same shared storage. Virtual machine instances (VMs) can be live-migrated from one host to another within the same cluster, without interrupting service to the user. A cluster is the third-largest organizational unit within a CloudStack&\#8482; deployment. Clusters are contained within pods, and pods are contained within zones.<br/><br/>CloudStack&\#8482; allows multiple clusters in a cloud deployment, but for a Basic Installation, we only need one cluster.
+message.installWizard.copy.whatIsAHost=A host is a single computer. Hosts provide the computing resources that run the guest virtual machines. Each host has hypervisor software installed on it to manage the guest VMs (except for bare metal hosts, which are a special case discussed in the Advanced Installation Guide). For example, a Linux KVM-enabled server, a Citrix XenServer server, and an ESXi server are hosts. In a Basic Installation, we use a single host running XenServer or KVM.<br/><br/>The host is the smallest organizational unit within a CloudStack&\#8482; deployment. Hosts are contained within clusters, clusters are contained within pods, and pods are contained within zones.
+message.installWizard.copy.whatIsAPod=A pod often represents a single rack. Hosts in the same pod are in the same subnet.<br/><br/>A pod is the second-largest organizational unit within a CloudStack&\#8482; deployment. Pods are contained within zones. Each zone can contain one or more pods; in the Basic Installation, you will have just one pod in your zone.
+message.installWizard.copy.whatIsAZone=A zone is the largest organizational unit within a CloudStack&\#8482; deployment. A zone typically corresponds to a single datacenter, although it is permissible to have multiple zones in a datacenter. The benefit of organizing infrastructure into zones is to provide physical isolation and redundancy. For example, each zone can have its own power supply and network uplink, and the zones can be widely separated geographically (though this is not required).
+message.installWizard.copy.whatIsCloudStack=CloudStack&\#8482 is a software platform that pools computing resources to build public, private, and hybrid Infrastructure as a Service (IaaS) clouds. CloudStack&\#8482 manages the network, storage, and compute nodes that make up a cloud infrastructure. Use CloudStack&\#8482 to deploy, manage, and configure cloud computing environments.<br/><br/>Extending beyond individual virtual machine images running on commodity hardware, CloudStack&\#8482 provides a turnkey cloud infrastructure software stack for delivering virtual datacenters as a service - delivering all of the essential components to build, deploy, and manage multi-tier and multi-tenant cloud applications. Both open-source and Premium versions are available, with the open-source version offering nearly identical features.
+message.installWizard.copy.whatIsPrimaryStorage=A CloudStack&\#8482; cloud infrastructure makes use of two types of storage\: primary storage and secondary storage. Both of these can be iSCSI or NFS servers, or localdisk.<br/><br/><strong>Primary storage</strong> is associated with a cluster, and it stores the disk volumes of each guest VM for all the VMs running on hosts in that cluster. The primary storage server is typically located close to the hosts.
+message.installWizard.copy.whatIsSecondaryStorage=Secondary storage is associated with a zone, and it stores the following\:<ul><li>Templates - OS images that can be used to boot VMs and can include additional configuration information, such as installed applications</li><li>ISO images - OS images that can be bootable or non-bootable</li><li>Disk volume snapshots - saved copies of VM data which can be used for data recovery or to create new templates</ul>
+message.installWizard.now.building=Now building your cloud...
 message.installWizard.tooltip.addCluster.name=A name for the cluster.  This can be text of your choosing and is not used by CloudStack.
 message.installWizard.tooltip.addHost.hostname=The DNS name or IP address of the host.
 message.installWizard.tooltip.addHost.password=This is the password for the user named above (from your XenServer install).
@@ -1392,26 +1404,26 @@ message.instanceWizard.noTemplates=You do not have any templates available; plea
 message.ip.address.changed=Your IP addresses may have changed; would you like to refresh the listing? Note that in this case the details pane will close.
 message.iso.desc=Disc image containing data or bootable media for OS
 message.join.project=You have now joined a project. Please switch to Project view to see the project.
-message.launch.vm.on.private.network=Do you wish to launch your instance on your own private dedicated network? 
+message.launch.vm.on.private.network=Do you wish to launch your instance on your own private dedicated network?
 message.launch.zone=Zone is ready to launch; please proceed to the next step.
 message.lock.account=Please confirm that you want to lock this account.  By locking the account, all users for this account will no longer be able to manage their cloud resources.  Existing resources can still be accessed.
 message.migrate.instance.confirm=Please confirm the host you wish to migrate the virtual instance to.
 message.migrate.instance.to.host=Please confirm that you want to migrate instance to another host.
 message.migrate.instance.to.ps=Please confirm that you want to migrate instance to another primary storage.
-message.migrate.router.confirm=Please confirm the host you wish to migrate the router to:
-message.migrate.systemvm.confirm=Please confirm the host you wish to migrate the system VM to:
+message.migrate.router.confirm=Please confirm the host you wish to migrate the router to\:
+message.migrate.systemvm.confirm=Please confirm the host you wish to migrate the system VM to\:
 message.migrate.volume=Please confirm that you want to migrate volume to another primary storage.
-message.new.user=Specify the following to add a new user to the account 
+message.new.user=Specify the following to add a new user to the account
 message.no.network.support.configuration.not.true=You do not have any zone that has security group enabled. Thus, no additional network features.  Please continue to step 5.
 message.no.network.support=Your selected hypervisor, vSphere, does not have any additional network features.  Please continue to step 5.
 message.no.projects.adminOnly=You do not have any projects.<br/>Please ask your administrator to create a new project.
 message.no.projects=You do not have any projects.<br/>Please create a new one from the projects section.
-message.number.clusters=<h2><span> # of </span> Clusters</h2>
-message.number.hosts=<h2><span> # of </span> Hosts</h2>
-message.number.pods=<h2><span> # of </span> Pods</h2>
-message.number.storage=<h2><span> # of </span> Primary Storage Volumes</h2>
-message.number.zones=<h2><span> # of </span> Zones</h2>
-message.pending.projects.1=You have pending project invitations:
+message.number.clusters=<h2><span> \# of </span> Clusters</h2>
+message.number.hosts=<h2><span> \# of </span> Hosts</h2>
+message.number.pods=<h2><span> \# of </span> Pods</h2>
+message.number.storage=<h2><span> \# of </span> Primary Storage Volumes</h2>
+message.number.zones=<h2><span> \# of </span> Zones</h2>
+message.pending.projects.1=You have pending project invitations\:
 message.pending.projects.2=To view, please go to the projects section, then select invitations from the drop-down.
 message.please.add.at.lease.one.traffic.range=Please add at least one traffic range.
 message.please.proceed=Please proceed to the next step.
@@ -1442,7 +1454,7 @@ message.select.security.groups=Please select security group(s) for your new VM
 message.select.template=Please select a template for your new virtual instance.
 message.setup.physical.network.during.zone.creation.basic=When adding a basic zone, you can set up one physical network, which corresponds to a NIC on the hypervisor. The network carries several types of traffic.<br/><br/>You may also <strong>drag and drop</strong> other traffic types onto the physical network.
 message.setup.physical.network.during.zone.creation=When adding an advanced zone, you need to set up one or more physical networks. Each network corresponds to a NIC on the hypervisor. Each physical network can carry one or more types of traffic, with certain restrictions on how they may be combined.<br/><br/><strong>Drag and drop one or more traffic types</strong> onto each physical network.
-message.setup.successful=Cloud setup successful!
+message.setup.successful=Cloud setup successful\!
 message.snapshot.schedule=You can setup recurring snapshot schedules by selecting from the available options below and applying your policy preference
 message.specify.url=Please specify URL
 message.step.1.continue=Please select a template or ISO to continue
@@ -1453,7 +1465,7 @@ message.step.3.continue=Please select a disk offering to continue
 message.step.3.desc=
 message.step.4.continue=Please select at least one network to continue
 message.step.4.desc=Please select the primary network that your virtual instance will be connected to.
-message.storage.traffic=Traffic between CloudStack's internal resources, including any components that communicate with the Management Server, such as hosts and CloudStack system VMs. Please configure storage traffic here.
+message.storage.traffic=Traffic between CloudStack\\'s internal resources, including any components that communicate with the Management Server, such as hosts and CloudStack system VMs. Please configure storage traffic here.
 message.suspend.project=Are you sure you want to suspend this project?
 message.template.desc=OS image that can be used to boot VMs
 message.tooltip.dns.1=Name of a DNS server for use by VMs in the zone. The public IP addresses for the zone must have a route to this server.
@@ -1467,7 +1479,7 @@ message.tooltip.reserved.system.netmask=The network prefix that defines the pod
 message.tooltip.zone.name=A name for the zone.
 message.update.os.preference=Please choose a OS preference for this host.  All virtual instances with similar preferences will be first allocated to this host before choosing another.
 message.update.resource.count=Please confirm that you want to update resource counts for this account.
-message.update.ssl=Please submit a new X.509 compliant SSL certificate to be updated to each console proxy virtual instance:
+message.update.ssl=Please submit a new X.509 compliant SSL certificate to be updated to each console proxy virtual instance\:
 message.validate.instance.name=Instance name can not be longer than 63 characters. Only ASCII letters a~z, A~Z, digits 0~9, hyphen are allowed. Must start with a letter and end with a letter or a digit.
 message.virtual.network.desc=A dedicated virtualized network for your account.  The broadcast domain is contained within a VLAN and all public network access is routed out by a virtual router.
 message.vm.create.template.confirm=Create Template will reboot the VM automatically.
@@ -1478,9 +1490,9 @@ message.zone.creation.complete.would.you.like.to.enable.this.zone=Zone creation
 message.Zone.creation.complete=Zone creation complete
 message.zone.no.network.selection=The zone you selected does not have any choices for network selection.
 message.zone.step.1.desc=Please select a network model for your zone.
-message.zone.step.2.desc=Please enter the following info to add a new zone 
-message.zone.step.3.desc=Please enter the following info to add a new pod 
-message.zoneWizard.enable.local.storage=WARNING: If you enable local storage for this zone, you must do the following, depending on where you would like your system VMs to launch:<br/><br/>1. If system VMs need to be launched in primary storage, primary storage needs to be added to the zone after creation. You must also start the zone in a disabled state.<br/><br/>2. If system VMs need to be launched in local storage, system.vm.use.local.storage needs to be set to true before you enable the zone.<br/><br/><br/>Would you like to continue?
+message.zone.step.2.desc=Please enter the following info to add a new zone
+message.zone.step.3.desc=Please enter the following info to add a new pod
+message.zoneWizard.enable.local.storage=WARNING\: If you enable local storage for this zone, you must do the following, depending on where you would like your system VMs to launch\:<br/><br/>1. If system VMs need to be launched in primary storage, primary storage needs to be added to the zone after creation. You must also start the zone in a disabled state.<br/><br/>2. If system VMs need to be launched in local storage, system.vm.use.local.storage needs to be set to true before you enable the zone.<br/><br/><br/>Would you like to continue?
 mode=Mode
 network.rate=Network Rate
 notification.reboot.instance=Reboot instance
@@ -1498,14 +1510,14 @@ state.Creating=Creating
 state.Declined=Declined
 state.Destroyed=Destroyed
 state.Disabled=Disabled
-state.enabled=Enabled
 state.Enabled=Enabled
+state.enabled=Enabled
 state.Error=Error
 state.Expunging=Expunging
 state.Migrating=Migrating
 state.Pending=Pending
-state.ready=Ready
 state.Ready=Ready
+state.ready=Ready
 state.Running=Running
 state.Starting=Starting
 state.Stopped=Stopped


[47/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/SetupGuestNetworkAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/SetupGuestNetworkAnswer.java b/api/src/com/cloud/agent/api/SetupGuestNetworkAnswer.java
deleted file mode 100644
index 972a1c2..0000000
--- a/api/src/com/cloud/agent/api/SetupGuestNetworkAnswer.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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.agent.api;
-
-public class SetupGuestNetworkAnswer extends Answer{
-    public SetupGuestNetworkAnswer() {}
-
-    public SetupGuestNetworkAnswer(SetupGuestNetworkCommand cmd, boolean success, String result) {
-        super(cmd, success, result);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/SetupGuestNetworkCommand.java b/api/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
deleted file mode 100644
index 2cf5bf8..0000000
--- a/api/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
+++ /dev/null
@@ -1,72 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.routing.NetworkElementCommand;
-import com.cloud.agent.api.to.NicTO;
-
-public class SetupGuestNetworkCommand extends NetworkElementCommand{
-    String dhcpRange;
-    String networkDomain;
-    String defaultDns1 = null;
-    String defaultDns2 = null;
-    boolean isRedundant = false;
-    Integer priority;
-    boolean add = true;
-    NicTO nic;
-
-    public NicTO getNic() {
-        return nic;
-    }
-
-    public String getDefaultDns1() {
-        return defaultDns1;
-    }
-
-    public String getDefaultDns2() {
-        return defaultDns2;
-    }
-
-    public String getNetworkDomain() {
-        return networkDomain;
-    }
-
-    public boolean isAdd() {
-       return add;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    protected SetupGuestNetworkCommand() {
-    }
-
-
-    public SetupGuestNetworkCommand(String dhcpRange, String networkDomain, boolean isRedundant, Integer priority,
-            String defaultDns1, String defaultDns2, boolean add, NicTO nic) {
-        this.dhcpRange = dhcpRange;
-        this.networkDomain = networkDomain;
-        this.defaultDns1 = defaultDns1;
-        this.defaultDns2 = defaultDns2;
-        this.isRedundant = isRedundant;
-        this.priority = priority;
-        this.add = add;
-        this.nic = nic;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ShutdownCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ShutdownCommand.java b/api/src/com/cloud/agent/api/ShutdownCommand.java
deleted file mode 100644
index 5412f35..0000000
--- a/api/src/com/cloud/agent/api/ShutdownCommand.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// 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.agent.api;
-
-/**
- *
- */
-public class ShutdownCommand extends Command {
-    public static final String Requested = "sig.kill";
-    public static final String Update = "update";
-    public static final String Unknown = "unknown";
-    public static final String DeleteHost = "deleteHost";
-
-    private String reason;
-    private String detail;
-
-    protected ShutdownCommand() {
-        super();
-    }
-
-    public ShutdownCommand(String reason, String detail) {
-        super();
-        this.reason = reason;
-        this.detail = detail;
-    }
-
-    /**
-     * @return return the reason the agent shutdown.  If Unknown, call getDetail() for any details.
-     */
-    public String getReason() {
-        return reason;
-    }
-
-    public String getDetail() {
-        return detail;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/SnapshotCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/SnapshotCommand.java b/api/src/com/cloud/agent/api/SnapshotCommand.java
deleted file mode 100644
index d8abeb6..0000000
--- a/api/src/com/cloud/agent/api/SnapshotCommand.java
+++ /dev/null
@@ -1,126 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.storage.StoragePool;
-
-/**
- * This currently assumes that both primary and secondary storage are mounted on
- * the XenServer.
- */
-public class SnapshotCommand extends Command {
-    protected String primaryStoragePoolNameLabel;
-    StorageFilerTO primaryPool;
-    private String snapshotUuid;
-    private String snapshotName;
-    private String secondaryStorageUrl;
-    private Long dcId;
-    private Long accountId;
-    private Long volumeId;
-    private String volumePath;
-
-    protected SnapshotCommand() {
-
-    }
-
-    /**
-     * @param primaryStoragePoolNameLabel
-     *            The primary storage Pool
-     * @param snapshotUuid
-     *            The UUID of the snapshot which is going to be backed up
-     * @param secondaryStoragePoolURL
-     *            This is what shows up in the UI when you click on Secondary
-     *            storage. In the code, it is present as: In the
-     *            vmops.host_details table, there is a field mount.parent. This
-     *            is the value of that field If you have better ideas on how to
-     *            get it, you are welcome.
-     */
-    public SnapshotCommand(StoragePool pool,
-            String secondaryStorageUrl, String snapshotUuid,
-            String snapshotName, Long dcId, Long accountId, Long volumeId) {
-        this.primaryStoragePoolNameLabel = pool.getUuid();
-        this.primaryPool = new StorageFilerTO(pool);
-        this.snapshotUuid = snapshotUuid;
-        this.secondaryStorageUrl = secondaryStorageUrl;
-        this.dcId = dcId;
-        this.accountId = accountId;
-        this.volumeId = volumeId;
-        this.snapshotName = snapshotName;
-    }
-
-    /**
-     * @return the primaryStoragePoolNameLabel
-     */
-    public String getPrimaryStoragePoolNameLabel() {
-        return primaryStoragePoolNameLabel;
-    }
-
-    /**
-     * @return the primaryPool
-     */
-    public StorageFilerTO getPool() {
-        return primaryPool;
-    }
-
-    /**
-     * @return the snapshotUuid
-     */
-    public String getSnapshotUuid() {
-        return snapshotUuid;
-    }
-
-    public String getSnapshotName() {
-        return snapshotName;
-    }
-
-    /**
-     * @return the secondaryStoragePoolURL
-     */
-    public String getSecondaryStorageUrl() {
-        return secondaryStorageUrl;
-    }
-
-    public Long getDataCenterId() {
-        return dcId;
-    }
-
-    public Long getAccountId() {
-        return accountId;
-    }
-
-    public Long getVolumeId() {
-        return volumeId;
-    }
-
-    public String getVolumePath() {
-        return volumePath;
-    }
-
-    public void setVolumePath(String path) {
-        volumePath = path;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/StartAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/StartAnswer.java b/api/src/com/cloud/agent/api/StartAnswer.java
deleted file mode 100644
index 922d060..0000000
--- a/api/src/com/cloud/agent/api/StartAnswer.java
+++ /dev/null
@@ -1,57 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.to.VirtualMachineTO;
-
-public class StartAnswer extends Answer {
-    VirtualMachineTO vm;
-    String host_guid;
-
-    protected StartAnswer() {
-    }
-
-    public StartAnswer(StartCommand cmd, String msg) {
-        super(cmd, false, msg);
-        this.vm  = cmd.getVirtualMachine();
-    }
-
-    public StartAnswer(StartCommand cmd, Exception e) {
-        super(cmd, false, e.getMessage());
-        this.vm  = cmd.getVirtualMachine();
-    }
-
-    public StartAnswer(StartCommand cmd) {
-        super(cmd, true, null);
-        this.vm  = cmd.getVirtualMachine();
-        this.host_guid = null;
-    }
-
-    public StartAnswer(StartCommand cmd, String msg, String guid) {
-        super(cmd, true, msg);
-        this.vm  = cmd.getVirtualMachine();
-        this.host_guid = guid;
-    }
-
-    public VirtualMachineTO getVirtualMachine() {
-        return vm;
-    }
-
-    public String getHost_guid() {
-        return host_guid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/StartCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/StartCommand.java b/api/src/com/cloud/agent/api/StartCommand.java
deleted file mode 100644
index ec707d6..0000000
--- a/api/src/com/cloud/agent/api/StartCommand.java
+++ /dev/null
@@ -1,52 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.to.VirtualMachineTO;
-import com.cloud.host.Host;
-
-/**
- */
-public class StartCommand extends Command {
-    VirtualMachineTO vm;
-    String hostIp;
-
-    public VirtualMachineTO getVirtualMachine() {
-        return vm;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    protected StartCommand() {
-    }
-
-    public StartCommand(VirtualMachineTO vm) {
-        this.vm = vm;
-    }
-
-    public StartCommand(VirtualMachineTO vm, Host host) {
-        this.vm = vm;
-        this.hostIp = host.getPrivateIpAddress();
-    }
-
-    public String getHostIp() {
-        return this.hostIp;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/StartupAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/StartupAnswer.java b/api/src/com/cloud/agent/api/StartupAnswer.java
deleted file mode 100755
index c0925cb..0000000
--- a/api/src/com/cloud/agent/api/StartupAnswer.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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.agent.api;
-
-
-public class StartupAnswer extends Answer {
-    long hostId;
-    int pingInterval;
-
-    protected StartupAnswer() {
-    }
-
-    public StartupAnswer(StartupCommand cmd, long hostId, int pingInterval) {
-        super(cmd);
-        this.hostId = hostId;
-        this.pingInterval = pingInterval;
-    }
-
-    public StartupAnswer(StartupCommand cmd, String details) {
-        super(cmd, false, details);
-    }
-
-    public long getHostId() {
-        return hostId;
-    }
-
-    public int getPingInterval() {
-        return pingInterval;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/StartupCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/StartupCommand.java b/api/src/com/cloud/agent/api/StartupCommand.java
deleted file mode 100755
index dd2d390..0000000
--- a/api/src/com/cloud/agent/api/StartupCommand.java
+++ /dev/null
@@ -1,286 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.host.Host;
-
-public class StartupCommand extends Command {
-    Host.Type type;
-    String dataCenter;
-    String pod;
-    String cluster;
-    String guid;
-    String name;
-    Long id;
-    String version;
-    String iqn;
-    String publicIpAddress;
-    String publicNetmask;
-    String publicMacAddress;
-    String privateIpAddress;
-    String privateMacAddress;
-    String privateNetmask;
-    String storageIpAddress;
-    String storageNetmask;
-    String storageMacAddress;
-    String storageIpAddressDeux;
-    String storageMacAddressDeux;
-    String storageNetmaskDeux;
-    String agentTag;
-    String resourceName;
-    String gatewayIpAddress;
-
-    public StartupCommand(Host.Type type) {
-        this.type = type;
-    }
-
-    public StartupCommand(Long id, Host.Type type, String name, String dataCenter, String pod, String guid, String version) {
-        super();
-        this.id = id;
-        this.dataCenter = dataCenter;
-        this.pod = pod;
-        this.guid = guid;
-        this.name = name;
-        this.version = version;
-        this.type = type;
-    }
-
-    public StartupCommand(Long id, Host.Type type, String name, String dataCenter, String pod, String guid, String version, String gatewayIpAddress) {
-		this(id, type, name, dataCenter, pod, guid, version);
-		this.gatewayIpAddress = gatewayIpAddress;
-    }
-
-    public Host.Type getHostType() {
-        return type;
-    }
-
-    public void setHostType(Host.Type type) {
-    	this.type = type;
-    }
-
-    public String getIqn() {
-        return iqn;
-    }
-
-    public void setCluster(String cluster) {
-        this.cluster = cluster;
-    }
-
-    public String getCluster() {
-        return cluster;
-    }
-
-    public void setIqn(String iqn) {
-        this.iqn = iqn;
-    }
-
-    public String getDataCenter() {
-        return dataCenter;
-    }
-
-    public String getPod() {
-        return pod;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public String getStorageIpAddressDeux() {
-		return storageIpAddressDeux;
-	}
-
-	public void setStorageIpAddressDeux(String storageIpAddressDeux) {
-		this.storageIpAddressDeux = storageIpAddressDeux;
-	}
-
-	public String getStorageMacAddressDeux() {
-		return storageMacAddressDeux;
-	}
-
-	public void setStorageMacAddressDeux(String storageMacAddressDeux) {
-		this.storageMacAddressDeux = storageMacAddressDeux;
-	}
-
-	public String getStorageNetmaskDeux() {
-		return storageNetmaskDeux;
-	}
-
-	public void setStorageNetmaskDeux(String storageNetmaskDeux) {
-		this.storageNetmaskDeux = storageNetmaskDeux;
-	}
-
-	public String getGuid() {
-        return guid;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public String getVersion() {
-        return version;
-    }
-
-    public void setDataCenter(String dataCenter) {
-        this.dataCenter = dataCenter;
-    }
-
-    public void setPod(String pod) {
-        this.pod = pod;
-    }
-
-    public void setGuid(String guid) {
-        this.guid = guid;
-    }
-
-    public void setGuid(String guid, String resourceName) {
-    	this.resourceName = resourceName;
-    	this.guid = guid + "-" + resourceName;
-    }
-
-    public String getPublicNetmask() {
-        return publicNetmask;
-    }
-
-    public void setPublicNetmask(String publicNetmask) {
-        this.publicNetmask = publicNetmask;
-    }
-
-    public String getPublicMacAddress() {
-        return publicMacAddress;
-    }
-
-    public void setPublicMacAddress(String publicMacAddress) {
-        this.publicMacAddress = publicMacAddress;
-    }
-
-    public String getPrivateIpAddress() {
-        return privateIpAddress;
-    }
-
-    public void setPrivateIpAddress(String privateIpAddress) {
-        this.privateIpAddress = privateIpAddress;
-    }
-
-    public String getPrivateMacAddress() {
-        return privateMacAddress;
-    }
-
-    public void setPrivateMacAddress(String privateMacAddress) {
-        this.privateMacAddress = privateMacAddress;
-    }
-
-    public String getPrivateNetmask() {
-        return privateNetmask;
-    }
-
-    public void setPrivateNetmask(String privateNetmask) {
-        this.privateNetmask = privateNetmask;
-    }
-
-    public String getStorageIpAddress() {
-        return storageIpAddress;
-    }
-
-    public void setStorageIpAddress(String storageIpAddress) {
-        this.storageIpAddress = storageIpAddress;
-    }
-
-    public String getStorageNetmask() {
-        return storageNetmask;
-    }
-
-    public void setStorageNetmask(String storageNetmask) {
-        this.storageNetmask = storageNetmask;
-    }
-
-    public String getStorageMacAddress() {
-        return storageMacAddress;
-    }
-
-    public void setStorageMacAddress(String storageMacAddress) {
-        this.storageMacAddress = storageMacAddress;
-    }
-
-    public String getPublicIpAddress() {
-        return publicIpAddress;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public void setVersion(String version) {
-        this.version = version;
-    }
-
-    public void setPublicIpAddress(String publicIpAddress) {
-        this.publicIpAddress = publicIpAddress;
-    }
-
-    public String getAgentTag() {
-    	return agentTag;
-    }
-
-    public void setAgentTag(String tag) {
-    	agentTag = tag;
-    }
-
-    public void setResourceName(String resourceName) {
-    	this.resourceName = resourceName;
-    }
-
-    public String getGuidWithoutResource() {
-    	if (resourceName == null) {
-            return guid;
-        } else {
-    	  int hyph = guid.lastIndexOf('-');
-    	  if (hyph == -1) {
-    		  return guid;
-    	  }
-    	  String tmpResource = guid.substring(hyph+1, guid.length());
-    	  if (resourceName.equals(tmpResource)){
-    		  return guid.substring(0, hyph);
-    	  } else {
-    		  return guid;
-    	  }
-    	}
-    }
-
-    public String getResourceName() {
-    	return resourceName;
-    }
-
-    public String getGatewayIpAddress() {
-        return gatewayIpAddress;
-    }
-
-    public void setGatewayIpAddress(String gatewayIpAddress) {
-        this.gatewayIpAddress = gatewayIpAddress;
-    }
-
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/StartupExternalDhcpCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/StartupExternalDhcpCommand.java b/api/src/com/cloud/agent/api/StartupExternalDhcpCommand.java
deleted file mode 100644
index b71f635..0000000
--- a/api/src/com/cloud/agent/api/StartupExternalDhcpCommand.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.host.Host;
-
-public class StartupExternalDhcpCommand extends StartupCommand {
-	public StartupExternalDhcpCommand() {
-		super(Host.Type.ExternalDhcp);
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/StartupExternalFirewallCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/StartupExternalFirewallCommand.java b/api/src/com/cloud/agent/api/StartupExternalFirewallCommand.java
deleted file mode 100644
index c4ed107..0000000
--- a/api/src/com/cloud/agent/api/StartupExternalFirewallCommand.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.host.Host;
-
-public class StartupExternalFirewallCommand extends StartupCommand {
-
-    public StartupExternalFirewallCommand() {
-        super(Host.Type.ExternalFirewall);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java b/api/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java
deleted file mode 100644
index 1e7a5f1..0000000
--- a/api/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.host.Host;
-
-public class StartupExternalLoadBalancerCommand extends StartupCommand {
-    public StartupExternalLoadBalancerCommand() {
-        super(Host.Type.ExternalLoadBalancer);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/StartupProxyCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/StartupProxyCommand.java b/api/src/com/cloud/agent/api/StartupProxyCommand.java
deleted file mode 100644
index 25cd769..0000000
--- a/api/src/com/cloud/agent/api/StartupProxyCommand.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.host.Host;
-
-public class StartupProxyCommand extends StartupCommand {
-    private int proxyPort;
-	private long proxyVmId;
-
-	public StartupProxyCommand() {
-        super(Host.Type.ConsoleProxy);
-        setIqn("NoIqn");
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public int getProxyPort() {
-        return proxyPort;
-    }
-
-    public void setProxyPort(int proxyPort) {
-        this.proxyPort = proxyPort;
-    }
-
-    public long getProxyVmId() {
-		return proxyVmId;
-	}
-	public void setProxyVmId(long proxyVmId) {
-		this.proxyVmId = proxyVmId;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/StartupPxeServerCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/StartupPxeServerCommand.java b/api/src/com/cloud/agent/api/StartupPxeServerCommand.java
deleted file mode 100644
index dff5c53..0000000
--- a/api/src/com/cloud/agent/api/StartupPxeServerCommand.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.host.Host;
-
-public class StartupPxeServerCommand extends StartupCommand {
-	public StartupPxeServerCommand() {
-		super(Host.Type.PxeServer);
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/StartupRoutingCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/StartupRoutingCommand.java b/api/src/com/cloud/agent/api/StartupRoutingCommand.java
deleted file mode 100755
index 5961ab0..0000000
--- a/api/src/com/cloud/agent/api/StartupRoutingCommand.java
+++ /dev/null
@@ -1,224 +0,0 @@
-// 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.agent.api;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.cloud.host.Host;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.network.Networks.RouterPrivateIpStrategy;
-import com.cloud.utils.Pair;
-import com.cloud.vm.VirtualMachine.State;
-
-public class StartupRoutingCommand extends StartupCommand {
-    public static class VmState {
-        State state;
-        String host;
-        public VmState() {
-        }
-        public VmState(State state, String host) {
-            this.state = state;
-            this.host = host;
-        }
-        public State getState() {
-            return state;
-        }
-        public String getHost() {
-            return host;
-        }
-    }
-    int cpus;
-    long speed;
-    long memory;
-    long dom0MinMemory;
-    boolean poolSync;
-    Map<String, VmState> vms;
-    HashMap<String, Pair<String, State>> _clusterVMStates;
-    String caps;
-    String pool;
-    HypervisorType hypervisorType;
-    Map<String, String> hostDetails; //stuff like host os, cpu capabilities
-    String hypervisorVersion;
-
-    public StartupRoutingCommand() {
-        super(Host.Type.Routing);
-        hostDetails = new HashMap<String, String>();
-        getHostDetails().put(RouterPrivateIpStrategy.class.getCanonicalName(), RouterPrivateIpStrategy.DcGlobal.toString());
-
-    }
-
-    public StartupRoutingCommand(int cpus,
-                                   long speed,
-                                   long memory,
-                                   long dom0MinMemory,
-                                   String caps,
-                                   HypervisorType hypervisorType,
-                                   RouterPrivateIpStrategy privIpStrategy,
-                                   Map<String, VmState> vms) {
-        this(cpus, speed, memory, dom0MinMemory, caps, hypervisorType, vms);
-        getHostDetails().put(RouterPrivateIpStrategy.class.getCanonicalName(), privIpStrategy.toString());
-    }
-
-    public StartupRoutingCommand(int cpus,
-            long speed,
-            long memory,
-            long dom0MinMemory,
-            String caps,
-            HypervisorType hypervisorType,
-            RouterPrivateIpStrategy privIpStrategy) {
-this(cpus, speed, memory, dom0MinMemory, caps, hypervisorType, new HashMap<String,String>(), new HashMap<String, VmState>());
-getHostDetails().put(RouterPrivateIpStrategy.class.getCanonicalName(), privIpStrategy.toString());
-}
-
-    public StartupRoutingCommand(int cpus,
-            long speed,
-            long memory,
-            long dom0MinMemory,
-            final String caps,
-            final HypervisorType hypervisorType,
-            final Map<String, String> hostDetails,
-            Map<String, VmState> vms) {
-        super(Host.Type.Routing);
-        this.cpus = cpus;
-        this.speed = speed;
-        this.memory = memory;
-        this.dom0MinMemory = dom0MinMemory;
-        this.vms = vms;
-        this.hypervisorType = hypervisorType;
-        this.hostDetails = hostDetails;
-        this.caps = caps;
-        this.poolSync = false;
-    }
-
-    public StartupRoutingCommand(int cpus2, long speed2, long memory2,
-            long dom0MinMemory2, String caps2, HypervisorType hypervisorType2,
-            Map<String, VmState> vms2) {
-        this(cpus2, speed2, memory2, dom0MinMemory2, caps2, hypervisorType2, new HashMap<String,String>(), vms2);
-    }
-
-    public StartupRoutingCommand(int cpus, long speed, long memory, long dom0MinMemory, final String caps, final HypervisorType hypervisorType, final Map<String, String> hostDetails, Map<String, VmState> vms, String hypervisorVersion) {
-        this(cpus, speed, memory, dom0MinMemory, caps, hypervisorType, hostDetails, vms);
-        this.hypervisorVersion = hypervisorVersion;
-    }
-
-    public void setChanges(Map<String, VmState> vms) {
-        this.vms = vms;
-    }
-
-    public void setStateChanges(Map<String, State> vms) {
-        for( String vm_name : vms.keySet() ) {
-            if( this.vms == null ) {
-                this.vms = new HashMap<String, VmState>();
-            }
-            this.vms.put(vm_name, new VmState(vms.get(vm_name), null));
-        }
-    }
-
-    public void setClusterVMStateChanges(HashMap<String, Pair<String, State>> allStates){
-    	_clusterVMStates = allStates;
-    }
-
-    public int getCpus() {
-        return cpus;
-    }
-
-    public String getCapabilities() {
-        return caps;
-    }
-
-    public long getSpeed() {
-        return speed;
-    }
-
-    public long getMemory() {
-        return memory;
-    }
-
-    public long getDom0MinMemory() {
-        return dom0MinMemory;
-    }
-
-    public Map<String, VmState> getVmStates() {
-        return vms;
-    }
-
-    public HashMap<String, Pair<String, State>> getClusterVMStateChanges() {
-        return _clusterVMStates;
-    }
-
-    public void setSpeed(long speed) {
-        this.speed = speed;
-    }
-
-    public void setCpus(int cpus) {
-        this.cpus = cpus;
-    }
-
-    public void setMemory(long memory) {
-        this.memory = memory;
-    }
-
-    public void setDom0MinMemory(long dom0MinMemory) {
-        this.dom0MinMemory = dom0MinMemory;
-    }
-
-    public void setCaps(String caps) {
-        this.caps = caps;
-    }
-
-    public String getPool() {
-        return pool;
-    }
-
-    public void setPool(String pool) {
-        this.pool = pool;
-    }
-
-    public boolean isPoolSync() {
-        return poolSync;
-    }
-
-    public void setPoolSync(boolean poolSync) {
-        this.poolSync = poolSync;
-    }
-
-    public HypervisorType getHypervisorType() {
-        return hypervisorType;
-    }
-
-    public void setHypervisorType(HypervisorType hypervisorType) {
-        this.hypervisorType = hypervisorType;
-    }
-
-    public Map<String, String> getHostDetails() {
-        return hostDetails;
-    }
-
-    public void setHostDetails(Map<String, String> hostDetails) {
-        this.hostDetails = hostDetails;
-    }
-
-    public String getHypervisorVersion() {
-        return hypervisorVersion;
-    }
-
-    public void setHypervisorVersion(String hypervisorVersion) {
-        this.hypervisorVersion = hypervisorVersion;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/StartupSecondaryStorageCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/StartupSecondaryStorageCommand.java b/api/src/com/cloud/agent/api/StartupSecondaryStorageCommand.java
deleted file mode 100644
index c19ea99..0000000
--- a/api/src/com/cloud/agent/api/StartupSecondaryStorageCommand.java
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.host.Host;
-
-public class StartupSecondaryStorageCommand extends StartupCommand {
-
-	public StartupSecondaryStorageCommand() {
-        super(Host.Type.SecondaryStorage);
-        setIqn("NoIqn");
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/StartupStorageCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/StartupStorageCommand.java b/api/src/com/cloud/agent/api/StartupStorageCommand.java
deleted file mode 100755
index 3c3b058..0000000
--- a/api/src/com/cloud/agent/api/StartupStorageCommand.java
+++ /dev/null
@@ -1,110 +0,0 @@
-// 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.agent.api;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.cloud.host.Host;
-import com.cloud.storage.Storage;
-import com.cloud.storage.Storage.StoragePoolType;
-import com.cloud.storage.template.TemplateInfo;
-
-
-public class StartupStorageCommand extends StartupCommand {
-
-	String parent;
-    Map<String, TemplateInfo> templateInfo;
-    long totalSize;
-    StoragePoolInfo poolInfo;
-    Storage.StorageResourceType resourceType;
-    StoragePoolType fsType;
-    Map<String, String> hostDetails = new HashMap<String, String>();
-    String nfsShare;
-
-    public StartupStorageCommand() {
-        super(Host.Type.Storage);
-    }
-
-    public StartupStorageCommand(String parent, StoragePoolType fsType, long totalSize, Map<String, TemplateInfo> info) {
-        super(Host.Type.Storage);
-        this.parent = parent;
-        this.totalSize = totalSize;
-        this.templateInfo = info;
-        this.poolInfo = null;
-        this.fsType = fsType;
-    }
-
-
-    public StartupStorageCommand(String parent, StoragePoolType fsType, Map<String, TemplateInfo> templateInfo, StoragePoolInfo poolInfo) {
-		super(Host.Type.Storage);
-		this.parent = parent;
-		this.templateInfo = templateInfo;
-		this.totalSize = poolInfo.capacityBytes;
-		this.poolInfo = poolInfo;
-		this.fsType = fsType;
-	}
-
-	public String getParent() {
-        return parent;
-    }
-
-	public void setParent(String parent) {
-        this.parent = parent;
-    }
-
-    public void setNfsShare(String nfsShare) {
-	    this.nfsShare = nfsShare;
-	}
-
-	public String getNfsShare() {
-	    return nfsShare;
-	}
-
-    public long getTotalSize() {
-        return totalSize;
-    }
-
-	public Map<String, TemplateInfo> getTemplateInfo() {
-		return templateInfo;
-	}
-
-	public void setTemplateInfo(Map<String, TemplateInfo> templateInfo) {
-		this.templateInfo = templateInfo;
-	}
-
-	public StoragePoolInfo getPoolInfo() {
-		return poolInfo;
-	}
-
-	public void setPoolInfo(StoragePoolInfo poolInfo) {
-		this.poolInfo = poolInfo;
-	}
-
-	public Storage.StorageResourceType getResourceType() {
-		return resourceType;
-	}
-
-	public void setResourceType(Storage.StorageResourceType resourceType) {
-		this.resourceType = resourceType;
-	}
-
-	/*For secondary storage*/
-	public Map<String, String> getHostDetails() {
-		return hostDetails;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/StartupTrafficMonitorCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/StartupTrafficMonitorCommand.java b/api/src/com/cloud/agent/api/StartupTrafficMonitorCommand.java
deleted file mode 100644
index bb8f3d7..0000000
--- a/api/src/com/cloud/agent/api/StartupTrafficMonitorCommand.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.host.Host;
-
-public class StartupTrafficMonitorCommand extends StartupCommand {
-    public StartupTrafficMonitorCommand() {
-        super(Host.Type.TrafficMonitor);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/StopAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/StopAnswer.java b/api/src/com/cloud/agent/api/StopAnswer.java
deleted file mode 100755
index 1111fed..0000000
--- a/api/src/com/cloud/agent/api/StopAnswer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.agent.api;
-
-public class StopAnswer extends RebootAnswer {
-    Integer vncPort;
-
-    protected StopAnswer() {
-    }
-
-    public StopAnswer(StopCommand cmd, String details, Integer vncPort, boolean success) {
-        super(cmd,  details, success);
-        this.vncPort = vncPort;
-    }
-
-    public StopAnswer(StopCommand cmd, String details, boolean success) {
-        super(cmd, details, success);
-        vncPort = null;
-
-    }
-
-    public StopAnswer(StopCommand cmd, Exception e) {
-        super(cmd, e);
-    }
-
-    @Override
-    public Integer getVncPort() {
-        return vncPort;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/StopCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/StopCommand.java b/api/src/com/cloud/agent/api/StopCommand.java
deleted file mode 100755
index 1c67f38..0000000
--- a/api/src/com/cloud/agent/api/StopCommand.java
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.vm.VirtualMachine;
-
-public class StopCommand extends RebootCommand {
-    String vnet;
-    private boolean isProxy=false;
-    private String urlPort=null;
-    private String publicConsoleProxyIpAddress=null;
-
-    protected StopCommand() {
-    }
-
-    public StopCommand(VirtualMachine vm, boolean isProxy, String urlPort, String publicConsoleProxyIpAddress) {
-    	super(vm);
-    	this.isProxy = isProxy;
-    	this.urlPort = urlPort;
-    	this.publicConsoleProxyIpAddress = publicConsoleProxyIpAddress;
-    }
-
-    public StopCommand(VirtualMachine vm, String vnet) {
-        super(vm);
-        this.vnet = vnet;
-    }
-    
-    public StopCommand(VirtualMachine vm) {
-        super(vm);
-    }
-
-    public StopCommand(String vmName) {
-        super(vmName);
-    }
-
-    public String getVnet() {
-        return vnet;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-	public boolean isProxy() {
-		return this.isProxy;
-	}
-
-	public String getURLPort() {
-		return this.urlPort;
-	}
-
-	public String getPublicConsoleProxyIpAddress() {
-		return this.publicConsoleProxyIpAddress;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/TransferAgentCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/TransferAgentCommand.java b/api/src/com/cloud/agent/api/TransferAgentCommand.java
deleted file mode 100644
index 0dfde7e..0000000
--- a/api/src/com/cloud/agent/api/TransferAgentCommand.java
+++ /dev/null
@@ -1,57 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.host.Status.Event;
-
-public class TransferAgentCommand extends Command {
-    protected long agentId;
-    protected long futureOwner;
-    protected long currentOwner;
-    Event event;
-
-    protected TransferAgentCommand() {
-    }
-
-    public TransferAgentCommand(long agentId, long currentOwner, long futureOwner, Event event) {
-        this.agentId = agentId;
-        this.currentOwner = currentOwner;
-        this.futureOwner = futureOwner;
-        this.event = event;
-    }
-
-    public long getAgentId() {
-        return agentId;
-    }
-
-    public long getFutureOwner() {
-        return futureOwner;
-    }
-
-    public Event getEvent() {
-        return event;
-    }
-
-    public long getCurrentOwner() {
-        return currentOwner;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/UnPlugNicAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/UnPlugNicAnswer.java b/api/src/com/cloud/agent/api/UnPlugNicAnswer.java
deleted file mode 100644
index 232afef..0000000
--- a/api/src/com/cloud/agent/api/UnPlugNicAnswer.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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.agent.api;
-
-public class UnPlugNicAnswer extends Answer{
-    public UnPlugNicAnswer() {}
-
-    public UnPlugNicAnswer(UnPlugNicCommand cmd, boolean success, String result) {
-        super(cmd, success, result);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/UnPlugNicCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/UnPlugNicCommand.java b/api/src/com/cloud/agent/api/UnPlugNicCommand.java
deleted file mode 100644
index b6cab88..0000000
--- a/api/src/com/cloud/agent/api/UnPlugNicCommand.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.to.NicTO;
-
-public class UnPlugNicCommand extends Command{
-    NicTO nic;
-    String instanceName;
-
-    public NicTO getNic() {
-        return nic;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    protected UnPlugNicCommand() {
-    }
-
-    public UnPlugNicCommand(NicTO nic, String instanceName) {
-        this.nic = nic;
-        this.instanceName = instanceName;
-    }
-
-    public String getInstanceName() {
-        return instanceName;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/UnregisterVMCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/UnregisterVMCommand.java b/api/src/com/cloud/agent/api/UnregisterVMCommand.java
deleted file mode 100644
index 428ffea..0000000
--- a/api/src/com/cloud/agent/api/UnregisterVMCommand.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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.agent.api;
-
-public class UnregisterVMCommand extends Command {
-    String vmName;
-
-    public UnregisterVMCommand(String vmName){
-        this.vmName = vmName;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-    public String getVmName() {
-        return vmName;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/UpdateHostPasswordCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/UpdateHostPasswordCommand.java b/api/src/com/cloud/agent/api/UpdateHostPasswordCommand.java
deleted file mode 100644
index 27cfd19..0000000
--- a/api/src/com/cloud/agent/api/UpdateHostPasswordCommand.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-
-
-public class UpdateHostPasswordCommand extends Command {
-    @LogLevel(Log4jLevel.Off)
-    protected String _username;
-    @LogLevel(Log4jLevel.Off)
-    protected String _new_password;
-
-    protected UpdateHostPasswordCommand() {
-    }
-
-    public UpdateHostPasswordCommand(String username, String new_password) {
-        this._username = username;
-        this._new_password = new_password;
-    }
-
-    public String getNewPassword() {
-        return _new_password;
-    }
-
-    public String getUsername() {
-        return _username;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/UpgradeAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/UpgradeAnswer.java b/api/src/com/cloud/agent/api/UpgradeAnswer.java
deleted file mode 100644
index 00b0f25..0000000
--- a/api/src/com/cloud/agent/api/UpgradeAnswer.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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.agent.api;
-
-public class UpgradeAnswer extends Answer {
-    protected UpgradeAnswer() {
-    }
-
-    public UpgradeAnswer(UpgradeCommand cmd, String failure) {
-        super(cmd, false, failure);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/UpgradeCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/UpgradeCommand.java b/api/src/com/cloud/agent/api/UpgradeCommand.java
deleted file mode 100644
index 0e1b6d2..0000000
--- a/api/src/com/cloud/agent/api/UpgradeCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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.agent.api;
-
-/**
- * UpgradeCommand is sent when the agent should update.
- */
-public class UpgradeCommand extends Command {
-
-    String url;
-
-    protected UpgradeCommand() {
-    }
-
-    public UpgradeCommand(String url) {
-        this.url = url;
-    }
-
-    public String getUpgradeUrl() {
-        return url;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/UpgradeSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/UpgradeSnapshotCommand.java b/api/src/com/cloud/agent/api/UpgradeSnapshotCommand.java
deleted file mode 100644
index f00f490..0000000
--- a/api/src/com/cloud/agent/api/UpgradeSnapshotCommand.java
+++ /dev/null
@@ -1,64 +0,0 @@
-// 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.agent.api;
-import com.cloud.storage.StoragePool;
-
-public class UpgradeSnapshotCommand extends SnapshotCommand {
-    private String version;
-    private Long templateId;
-    private Long tmpltAccountId;
-
-    protected UpgradeSnapshotCommand() {
-
-    }
-
-    /**
-     * @param primaryStoragePoolNameLabel   The UUID of the primary storage Pool
-     * @param secondaryStoragePoolURL  This is what shows up in the UI when you click on Secondary storage.
-     * @param snapshotUuid             The UUID of the snapshot which is going to be upgraded
-     * @param _version          version for this snapshot
-     */
-    public UpgradeSnapshotCommand(StoragePool pool,
-                                 String secondaryStoragePoolURL,
-                                 Long   dcId,
-                                 Long   accountId,
-                                 Long   volumeId,
-                                 Long   templateId,
-                                 Long   tmpltAccountId,
-                                 String volumePath,
-                                 String snapshotUuid,
-                                 String snapshotName,
-                                 String version)
-    {
-        super(pool, secondaryStoragePoolURL, snapshotUuid, snapshotName, dcId, accountId, volumeId);
-        this.version = version;
-        this.templateId = templateId;
-        this.tmpltAccountId = tmpltAccountId;
-    }
-
-    public String getVersion() {
-        return version;
-    }
-
-    public Long getTemplateId() {
-        return templateId;
-    }
-
-    public Long getTmpltAccountId() {
-        return tmpltAccountId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/UploadTemplateToS3FromSecondaryStorageCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/UploadTemplateToS3FromSecondaryStorageCommand.java b/api/src/com/cloud/agent/api/UploadTemplateToS3FromSecondaryStorageCommand.java
deleted file mode 100644
index 1807cd5..0000000
--- a/api/src/com/cloud/agent/api/UploadTemplateToS3FromSecondaryStorageCommand.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.agent.api;
-
-import com.cloud.agent.api.to.S3TO;
-
-public class UploadTemplateToS3FromSecondaryStorageCommand extends Command {
-
-    private final S3TO s3;
-    private final String storagePath;
-    private final Long dataCenterId;
-    private final Long accountId;
-    private final Long templateId;
-
-    public UploadTemplateToS3FromSecondaryStorageCommand(final S3TO s3,
-        final String storagePath, final Long dataCenterId, final Long accountId,
-        final Long templateId) {
-
-        super();
-
-        this.s3 = s3;
-        this.storagePath = storagePath;
-        this.dataCenterId = dataCenterId;
-        this.accountId = accountId;
-        this.templateId = templateId;
-
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-    @Override
-    public boolean equals(final Object thatObject) {
-
-        if (this == thatObject) {
-            return true;
-        }
-
-        if (thatObject == null || getClass() != thatObject.getClass()) {
-            return false;
-        }
-
-        final UploadTemplateToS3FromSecondaryStorageCommand thatCommand =
-                (UploadTemplateToS3FromSecondaryStorageCommand) thatObject;
-
-        if (this.accountId != null ? !this.accountId.equals(thatCommand
-                .accountId) : thatCommand.accountId != null) {
-            return false;
-        }
-
-        if (this.dataCenterId != null ? !this.dataCenterId.equals(thatCommand
-                .dataCenterId) : thatCommand.dataCenterId != null) {
-            return false;
-        }
-
-        if (this.s3 != null ? !this.s3.equals(thatCommand.s3) : thatCommand.s3 != null) {
-            return false;
-        }
-
-        if (this.storagePath != null ? !this.storagePath.equals(thatCommand
-                .storagePath) : thatCommand.storagePath != null) {
-            return false;
-        }
-
-        if (this.templateId != null ? !this.templateId.equals(thatCommand.templateId) :
-                thatCommand.templateId != null) {
-            return false;
-        }
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = this.s3 != null ? this.s3.hashCode() : 0;
-        result = 31 * result + (this.storagePath != null ? this.storagePath.hashCode() : 0);
-        result = 31 * result + (this.dataCenterId != null ? this.dataCenterId.hashCode() : 0);
-        result = 31 * result + (this.accountId != null ? this.accountId.hashCode() : 0);
-        result = 31 * result + (this.templateId != null ? this.templateId.hashCode() : 0);
-        return result;
-    }
-
-    public S3TO getS3() {
-        return this.s3;
-    }
-
-    public String getStoragePath() {
-        return this.storagePath;
-    }
-
-    public Long getDataCenterId() {
-        return this.dataCenterId;
-    }
-
-    public Long getAccountId() {
-        return this.accountId;
-    }
-
-    public Long getTemplateId() {
-        return this.templateId;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/VMSnapshotBaseCommand.java b/api/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
deleted file mode 100644
index 2120f2f..0000000
--- a/api/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
+++ /dev/null
@@ -1,74 +0,0 @@
-// 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.agent.api;
-
-import java.util.List;
-
-import com.cloud.agent.api.to.VolumeTO;
-
-public class VMSnapshotBaseCommand extends Command{
-    protected List<VolumeTO> volumeTOs;
-    protected VMSnapshotTO target;
-    protected String vmName;
-    protected String guestOSType;
-    
-    
-    public VMSnapshotBaseCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType) {
-        this.vmName = vmName;
-        this.target = snapshot;
-        this.volumeTOs = volumeTOs;
-        this.guestOSType = guestOSType;
-    }
-    
-    public List<VolumeTO> getVolumeTOs() {
-        return volumeTOs;
-    }
-
-    public void setVolumeTOs(List<VolumeTO> volumeTOs) {
-        this.volumeTOs = volumeTOs;
-    }
-
-    public VMSnapshotTO getTarget() {
-        return target;
-    }
-
-    public void setTarget(VMSnapshotTO target) {
-        this.target = target;
-    }
-
-    public String getVmName() {
-        return vmName;
-    }
-
-    public void setVmName(String vmName) {
-        this.vmName = vmName;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-
-    public String getGuestOSType() {
-        return guestOSType;
-    }
-
-    public void setGuestOSType(String guestOSType) {
-        this.guestOSType = guestOSType;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/VMSnapshotTO.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/VMSnapshotTO.java b/api/src/com/cloud/agent/api/VMSnapshotTO.java
deleted file mode 100644
index c7b42d2..0000000
--- a/api/src/com/cloud/agent/api/VMSnapshotTO.java
+++ /dev/null
@@ -1,90 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.vm.snapshot.VMSnapshot;
-
-public class VMSnapshotTO {
-	private Long id;
-    private String snapshotName;
-    private VMSnapshot.Type type;
-    private Long createTime;
-    private Boolean current;
-    private String description;
-    private VMSnapshotTO parent;
-    
-    public Long getId() {
-		return id;
-	}
-	public void setId(Long id) {
-		this.id = id;
-	}
-	public VMSnapshotTO(Long id, String snapshotName, 
-	        VMSnapshot.Type type, Long createTime, 
-			String description, Boolean current, VMSnapshotTO parent) {
-		super();
-		this.id = id;
-		this.snapshotName = snapshotName;
-		this.type = type;
-		this.createTime = createTime;
-		this.current = current;
-		this.description = description;
-		this.parent = parent;
-	}
-	public VMSnapshotTO() {
-	    
-	}
-	public String getDescription() {
-		return description;
-	}
-	public void setDescription(String description) {
-		this.description = description;
-	}
-	public Boolean getCurrent() {
-        return current;
-    }
-    public void setCurrent(Boolean current) {
-        this.current = current;
-    }
-    public Long getCreateTime() {
-        return createTime;
-    }
-    public void setCreateTime(Long createTime) {
-        this.createTime = createTime;
-    }
- 
-    public VMSnapshot.Type getType() {
-        return type;
-    }
-    public void setType(VMSnapshot.Type type) {
-        this.type = type;
-    }
-
-    public String getSnapshotName() {
-        return snapshotName;
-    }
-    public void setSnapshotName(String snapshotName) {
-        this.snapshotName = snapshotName;
-    }
-    public VMSnapshotTO getParent() {
-        return parent;
-    }
-    public void setParent(VMSnapshotTO parent) {
-        this.parent = parent;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ValidateSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ValidateSnapshotAnswer.java b/api/src/com/cloud/agent/api/ValidateSnapshotAnswer.java
deleted file mode 100644
index f5bb544..0000000
--- a/api/src/com/cloud/agent/api/ValidateSnapshotAnswer.java
+++ /dev/null
@@ -1,53 +0,0 @@
-// 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.agent.api;
-
-
-public class ValidateSnapshotAnswer extends Answer {
-    private String expectedSnapshotBackupUuid;
-    private String actualSnapshotBackupUuid;
-    private String actualSnapshotUuid;
-
-    protected ValidateSnapshotAnswer() {
-
-    }
-
-    public ValidateSnapshotAnswer(ValidateSnapshotCommand cmd, boolean success, String result, String expectedSnapshotBackupUuid, String actualSnapshotBackupUuid, String actualSnapshotUuid) {
-        super(cmd, success, result);
-        this.expectedSnapshotBackupUuid = expectedSnapshotBackupUuid;
-        this.actualSnapshotBackupUuid = actualSnapshotBackupUuid;
-        this.actualSnapshotUuid = actualSnapshotUuid;
-    }
-
-    /**
-     * @return the expectedSnapshotBackupUuid
-     */
-    public String getExpectedSnapshotBackupUuid() {
-        return expectedSnapshotBackupUuid;
-    }
-
-    /**
-     * @return the actualSnapshotBackupUuid
-     */
-    public String getActualSnapshotBackupUuid() {
-        return actualSnapshotBackupUuid;
-    }
-
-    public String getActualSnapshotUuid() {
-        return actualSnapshotUuid;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/ValidateSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/ValidateSnapshotCommand.java b/api/src/com/cloud/agent/api/ValidateSnapshotCommand.java
deleted file mode 100644
index 9ffbf29..0000000
--- a/api/src/com/cloud/agent/api/ValidateSnapshotCommand.java
+++ /dev/null
@@ -1,84 +0,0 @@
-// 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.agent.api;
-
-public class ValidateSnapshotCommand extends Command {
-    private String primaryStoragePoolNameLabel;
-    private String volumeUuid;
-    private String firstBackupUuid;
-    private String previousSnapshotUuid;
-    private String templateUuid;
-
-    protected ValidateSnapshotCommand() {
-
-    }
-
-    /**
-     * @param primaryStoragePoolNameLabel   The primary storage Pool Name Label
-     * @param volumeUuid        The UUID of the volume for which the snapshot was taken
-     * @param firstBackupUuid   This UUID of the first snapshot that was ever taken for this volume, even it was deleted.
-     * @param previousSnapshotUuid The UUID of the previous snapshot on the primary.
-     * @param templateUuid      If this is a root volume and no snapshot has been taken for it,
-     *                          this is the UUID of the template VDI.
-     */
-    public ValidateSnapshotCommand(String primaryStoragePoolNameLabel,
-                                                 String volumeUuid,
-                                                 String firstBackupUuid,
-                                                 String previousSnapshotUuid,
-                                                 String templateUuid)
-    {
-        this.primaryStoragePoolNameLabel = primaryStoragePoolNameLabel;
-        this.volumeUuid                  = volumeUuid;
-        this.firstBackupUuid             = firstBackupUuid;
-        this.previousSnapshotUuid        = previousSnapshotUuid;
-        this.templateUuid                = templateUuid;
-    }
-
-    public String getPrimaryStoragePoolNameLabel() {
-        return primaryStoragePoolNameLabel;
-    }
-
-    /**
-     * @return the volumeUuid
-     */
-    public String getVolumeUuid() {
-        return volumeUuid;
-    }
-
-    /**
-     * @return the firstBackupUuid
-     */
-    public String getFirstBackupUuid() {
-        return firstBackupUuid;
-    }
-
-    public String getPreviousSnapshotUuid() {
-        return previousSnapshotUuid;
-    }
-
-    /**
-     * @return the templateUuid
-     */
-    public String getTemplateUuid() {
-        return templateUuid;
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/VmStatsEntry.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/VmStatsEntry.java b/api/src/com/cloud/agent/api/VmStatsEntry.java
deleted file mode 100755
index 8828e91..0000000
--- a/api/src/com/cloud/agent/api/VmStatsEntry.java
+++ /dev/null
@@ -1,82 +0,0 @@
-// 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.agent.api;
-
-import com.cloud.vm.VmStats;
-
-public class VmStatsEntry implements VmStats {
-
-	double cpuUtilization;
-	double networkReadKBs;
-	double networkWriteKBs;
-	int numCPUs;
-	String entityType;
-
-    public VmStatsEntry() {
-    }
-
-    public VmStatsEntry(double cpuUtilization, double networkReadKBs, double networkWriteKBs, int numCPUs, String entityType)
-    {
-        this.cpuUtilization = cpuUtilization;
-        this.networkReadKBs = networkReadKBs;
-        this.networkWriteKBs = networkWriteKBs;
-        this.numCPUs = numCPUs;
-        this.entityType = entityType;
-    }
-
-    public double getCPUUtilization() {
-    	return cpuUtilization;
-    }
-
-    public void setCPUUtilization(double cpuUtilization) {
-    	this.cpuUtilization = cpuUtilization;
-    }
-
-    public double getNetworkReadKBs() {
-    	return networkReadKBs;
-    }
-
-    public void setNetworkReadKBs(double networkReadKBs) {
-    	this.networkReadKBs = networkReadKBs;
-    }
-
-    public double getNetworkWriteKBs() {
-    	return networkWriteKBs;
-    }
-
-    public void setNetworkWriteKBs(double networkWriteKBs) {
-    	this.networkWriteKBs = networkWriteKBs;
-    }
-
-    public int getNumCPUs() {
-    	return numCPUs;
-    }
-
-    public void setNumCPUs(int numCPUs) {
-    	this.numCPUs = numCPUs;
-    }
-
-    public String getEntityType(){
-    	return this.entityType;
-    }
-
-    public void setEntityType(String entityType){
-    	this.entityType = entityType;
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/baremetal/IpmISetBootDevCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/baremetal/IpmISetBootDevCommand.java b/api/src/com/cloud/agent/api/baremetal/IpmISetBootDevCommand.java
deleted file mode 100644
index fdd1fe9..0000000
--- a/api/src/com/cloud/agent/api/baremetal/IpmISetBootDevCommand.java
+++ /dev/null
@@ -1,43 +0,0 @@
-// 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.agent.api.baremetal;
-
-import com.cloud.agent.api.Command;
-
-public class IpmISetBootDevCommand extends Command {
-	public enum BootDev {
-		pxe(),
-		disk(),
-		cdrom(),
-	}
-
-	BootDev bootDev;
-
-	public BootDev getBootDev() {
-		return bootDev;
-	}
-
-	public IpmISetBootDevCommand(BootDev dev) {
-		bootDev = dev;
-	}
-
-	@Override
-	public boolean executeInSequence() {
-		return true;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/agent/api/baremetal/IpmiBootorResetCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/baremetal/IpmiBootorResetCommand.java b/api/src/com/cloud/agent/api/baremetal/IpmiBootorResetCommand.java
deleted file mode 100644
index 4f8dcaf..0000000
--- a/api/src/com/cloud/agent/api/baremetal/IpmiBootorResetCommand.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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.agent.api.baremetal;
-
-import com.cloud.agent.api.Command;
-
-public class IpmiBootorResetCommand extends Command {
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-}


[32/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckOnHostCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckOnHostCommand.java b/core/src/com/cloud/agent/api/CheckOnHostCommand.java
new file mode 100644
index 0000000..596a532
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckOnHostCommand.java
@@ -0,0 +1,42 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.to.HostTO;
+import com.cloud.host.Host;
+
+public class CheckOnHostCommand extends Command {
+    HostTO host;
+
+    protected CheckOnHostCommand() {
+    }
+
+
+    public CheckOnHostCommand(Host host) {
+        this.host = new HostTO(host);
+        setWait(20);
+    }
+
+    public HostTO getHost() {
+        return host;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckRouterAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckRouterAnswer.java b/core/src/com/cloud/agent/api/CheckRouterAnswer.java
new file mode 100644
index 0000000..da8189f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckRouterAnswer.java
@@ -0,0 +1,81 @@
+// 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.agent.api;
+
+import com.cloud.network.router.VirtualRouter.RedundantState;
+
+public class CheckRouterAnswer extends Answer {
+    public static final String ROUTER_NAME = "router.name";
+    public static final String ROUTER_IP = "router.ip";
+    RedundantState state;
+    boolean isBumped;
+
+    protected CheckRouterAnswer() {
+    }
+
+    public CheckRouterAnswer(CheckRouterCommand cmd, String details, boolean parse) {
+        super(cmd, true, details);
+        if (parse) {
+            if (!parseDetails(details)) {
+                this.result = false;
+            }
+        }
+	}
+
+    public CheckRouterAnswer(CheckRouterCommand cmd, String details) {
+        super(cmd, false, details);
+    }
+
+    protected boolean parseDetails(String details) {
+        String[] lines = details.split("&");
+        if (lines.length != 2) {
+            return false;
+        }
+        if (lines[0].startsWith("Status: MASTER")) {
+            state = RedundantState.MASTER;
+        } else if (lines[0].startsWith("Status: BACKUP")) {
+            state = RedundantState.BACKUP;
+        } else if (lines[0].startsWith("Status: FAULT")) {
+            state = RedundantState.FAULT;
+        } else {
+            state = RedundantState.UNKNOWN;
+        }
+        if (lines[1].startsWith("Bumped: YES")) {
+            isBumped = true;
+        } else {
+            isBumped = false;
+        }
+        return true;
+    }
+
+    public void setState(RedundantState state) {
+        this.state = state;
+	}
+
+    public RedundantState getState() {
+        return state;
+	}
+
+    public boolean isBumped() {
+        return isBumped;
+    }
+
+    public void setIsBumped(boolean isBumped) {
+        this.isBumped = isBumped;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckRouterCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckRouterCommand.java b/core/src/com/cloud/agent/api/CheckRouterCommand.java
new file mode 100644
index 0000000..6215fc3
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckRouterCommand.java
@@ -0,0 +1,30 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.routing.NetworkElementCommand;
+
+public class CheckRouterCommand extends NetworkElementCommand {
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public CheckRouterCommand() {
+        super();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java b/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java
new file mode 100644
index 0000000..0e9db96
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java
@@ -0,0 +1,71 @@
+// 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.agent.api;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class CheckS2SVpnConnectionsAnswer extends Answer {
+    Map<String, Boolean> ipToConnected;
+    Map<String, String> ipToDetail;
+    String details;
+
+    protected CheckS2SVpnConnectionsAnswer() {
+        ipToConnected = new HashMap<String, Boolean>();
+        ipToDetail = new HashMap<String, String>();
+    }
+
+    public CheckS2SVpnConnectionsAnswer(CheckS2SVpnConnectionsCommand cmd, boolean result, String details) {
+        super(cmd, result, details);
+        ipToConnected = new HashMap<String, Boolean>();
+        ipToDetail = new HashMap<String, String>();
+        this.details = details;
+        if (result) {
+            parseDetails(details);
+        }
+    }
+
+    protected void parseDetails(String details) {
+        String[] lines = details.split("&");
+        for (String line : lines) {
+            String[] words = line.split(":");
+            if (words.length != 3) {
+                //Not something we can parse
+                return;
+            }
+            String ip = words[0];
+            boolean connected = words[1].equals("0");
+            String detail = words[2];
+            ipToConnected.put(ip, connected);
+            ipToDetail.put(ip, detail);
+        }
+    }
+
+    public boolean isConnected(String ip) {
+        if (this.getResult()) {
+            return ipToConnected.get(ip);
+        }
+        return false;
+    }
+
+    public String getDetail(String ip) {
+        if (this.getResult()) {
+            return ipToDetail.get(ip);
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java b/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java
new file mode 100644
index 0000000..9cfb53b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java
@@ -0,0 +1,39 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.routing.NetworkElementCommand;
+
+public class CheckS2SVpnConnectionsCommand extends NetworkElementCommand {
+    List<String> vpnIps;
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    public CheckS2SVpnConnectionsCommand(List<String> vpnIps) {
+        super();
+        this.vpnIps = vpnIps;
+    }
+
+    public List<String> getVpnIps() {
+        return vpnIps;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckStateAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckStateAnswer.java b/core/src/com/cloud/agent/api/CheckStateAnswer.java
new file mode 100755
index 0000000..bf8ae0f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckStateAnswer.java
@@ -0,0 +1,45 @@
+// 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.agent.api;
+
+import com.cloud.vm.VirtualMachine.State;
+
+/**
+ */
+public class CheckStateAnswer extends Answer {
+    State state;
+
+    public CheckStateAnswer() {}
+
+    public CheckStateAnswer(CheckStateCommand cmd, State state) {
+        this(cmd, state, null);
+    }
+
+    public CheckStateAnswer(CheckStateCommand cmd, String details) {
+        super(cmd, false, details);
+        this.state = null;
+    }
+
+    public CheckStateAnswer(CheckStateCommand cmd, State state, String details) {
+        super(cmd, true, details);
+        this.state = state;
+    }
+
+    public State getState() {
+        return state;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckStateCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckStateCommand.java b/core/src/com/cloud/agent/api/CheckStateCommand.java
new file mode 100755
index 0000000..89fc773
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckStateCommand.java
@@ -0,0 +1,40 @@
+// 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.agent.api;
+
+/**
+ *
+ *
+ */
+public class CheckStateCommand extends Command {
+    String vmName;
+
+    public CheckStateCommand() {}
+
+    public CheckStateCommand(String vmName) {
+        this.vmName = vmName;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    public String getVmName() {
+        return vmName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java b/core/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java
new file mode 100644
index 0000000..3f0ffdb
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java
@@ -0,0 +1,52 @@
+// 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.agent.api;
+
+import com.cloud.vm.VirtualMachine.State;
+
+public class CheckVirtualMachineAnswer extends Answer {
+
+    Integer vncPort;
+    State state;
+
+
+    protected CheckVirtualMachineAnswer() {
+    }
+
+    public CheckVirtualMachineAnswer(CheckVirtualMachineCommand cmd, State state, Integer vncPort, String detail) {
+        super(cmd, true, detail);
+        this.state = state;
+        this.vncPort = vncPort;
+    }
+
+    public CheckVirtualMachineAnswer(CheckVirtualMachineCommand cmd, State state, Integer vncPort) {
+        this(cmd, state, vncPort, null);
+    }
+
+    public CheckVirtualMachineAnswer(CheckVirtualMachineCommand cmd, String detail) {
+        super(cmd, false, detail);
+    }
+
+
+    public Integer getVncPort() {
+        return vncPort;
+    }
+
+    public State getState() {
+        return state;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckVirtualMachineCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckVirtualMachineCommand.java b/core/src/com/cloud/agent/api/CheckVirtualMachineCommand.java
new file mode 100644
index 0000000..62f4420
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckVirtualMachineCommand.java
@@ -0,0 +1,41 @@
+// 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.agent.api;
+
+public class CheckVirtualMachineCommand extends Command {
+
+    private String vmName;
+
+    protected CheckVirtualMachineCommand() {
+
+    }
+
+    public CheckVirtualMachineCommand(String vmName) {
+        this.vmName = vmName;
+        setWait(20);
+    }
+
+    public String getVmName() {
+        return vmName;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java b/core/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java
new file mode 100644
index 0000000..8b5172d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java
@@ -0,0 +1,47 @@
+// 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.agent.api;
+
+
+public class CleanupNetworkRulesCmd extends Command implements CronCommand {
+
+    private int interval = 10*60;
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+
+
+
+    public CleanupNetworkRulesCmd(int intervalSecs) {
+        super();
+        interval = intervalSecs;
+    }
+
+    public CleanupNetworkRulesCmd() {
+
+    }
+
+
+    @Override
+    public int getInterval() {
+        return interval;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CleanupSnapshotBackupCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CleanupSnapshotBackupCommand.java b/core/src/com/cloud/agent/api/CleanupSnapshotBackupCommand.java
new file mode 100644
index 0000000..ae65a52
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CleanupSnapshotBackupCommand.java
@@ -0,0 +1,75 @@
+// 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.agent.api;
+
+import java.util.List;
+
+public class CleanupSnapshotBackupCommand extends Command {
+        private String secondaryStoragePoolURL;
+        private Long   dcId;
+        private Long   accountId;
+        private Long   volumeId;
+        private List<String> validBackupUUIDs;
+
+    protected CleanupSnapshotBackupCommand() {
+
+    }
+
+     /*
+     * @param secondaryStoragePoolURL    This is what shows up in the UI when you click on Secondary storage.
+     *                                    In the code, it is present as: In the vmops.host_details table, there is a field mount.parent. This is the value of that field
+     *                                    If you have better ideas on how to get it, you are welcome.
+     * @param validBackupUUID             The VHD which are valid
+     */
+    public CleanupSnapshotBackupCommand(String secondaryStoragePoolURL,
+                                       Long   dcId,
+                                       Long   accountId,
+                                       Long   volumeId,
+                                       List<String> validBackupUUIDs)
+    {
+        this.secondaryStoragePoolURL = secondaryStoragePoolURL;
+        this.dcId = dcId;
+        this.accountId = accountId;
+        this.volumeId = volumeId;
+        this.validBackupUUIDs = validBackupUUIDs;
+    }
+
+    public String getSecondaryStoragePoolURL() {
+        return secondaryStoragePoolURL;
+    }
+
+    public Long getDcId() {
+        return dcId;
+    }
+
+    public Long getAccountId() {
+        return accountId;
+    }
+
+    public Long getVolumeId() {
+        return volumeId;
+    }
+
+    public List<String> getValidBackupUUIDs() {
+        return validBackupUUIDs;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ClusterSyncAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ClusterSyncAnswer.java b/core/src/com/cloud/agent/api/ClusterSyncAnswer.java
new file mode 100644
index 0000000..99fee2a
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ClusterSyncAnswer.java
@@ -0,0 +1,55 @@
+// 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.agent.api;
+
+import java.util.HashMap;
+
+import com.cloud.utils.Pair;
+import com.cloud.vm.VirtualMachine.State;
+
+public class ClusterSyncAnswer extends Answer {
+    private long _clusterId;
+    private HashMap<String, Pair<String, State>> _newStates;
+    private boolean _isExecuted=false;
+
+    // this is here because a cron command answer is being sent twice
+    //  AgentAttache.processAnswers
+    //  AgentManagerImpl.notifyAnswersToMonitors
+    public boolean isExceuted(){
+        return _isExecuted;
+    }
+
+    public void setExecuted(){
+        _isExecuted = true;
+    }
+
+
+    public ClusterSyncAnswer(long clusterId, HashMap<String, Pair<String, State>> newStates){
+        _clusterId = clusterId;
+        _newStates = newStates;
+        result = true;
+    }
+
+    public long getClusterId() {
+        return _clusterId;
+    }
+
+    public HashMap<String, Pair<String, State>> getNewStates() {
+        return _newStates;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ClusterSyncCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ClusterSyncCommand.java b/core/src/com/cloud/agent/api/ClusterSyncCommand.java
new file mode 100644
index 0000000..17dbbd8
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ClusterSyncCommand.java
@@ -0,0 +1,47 @@
+// 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.agent.api;
+
+
+public class ClusterSyncCommand extends Command implements CronCommand {
+    int _interval;
+
+    long _clusterId;
+
+    public ClusterSyncCommand() {
+    }
+
+    public ClusterSyncCommand(int interval, long clusterId){
+        _interval = interval;
+        _clusterId = clusterId;
+    }
+
+    @Override
+    public int getInterval() {
+        return _interval;
+    }
+
+    public long getClusterId() {
+        return _clusterId;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ComputeChecksumCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ComputeChecksumCommand.java b/core/src/com/cloud/agent/api/ComputeChecksumCommand.java
new file mode 100755
index 0000000..a2c88c4
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ComputeChecksumCommand.java
@@ -0,0 +1,40 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.storage.ssCommand;
+
+
+public class ComputeChecksumCommand extends ssCommand {
+
+
+    private String templatePath;
+    public ComputeChecksumCommand() {
+        super();
+    }
+
+    public ComputeChecksumCommand(String secUrl, String templatePath) {
+        super(secUrl);
+        this.templatePath = templatePath;
+    }
+
+    public String getTemplatePath() {
+        return templatePath;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java b/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java
new file mode 100644
index 0000000..9f50a2f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java
@@ -0,0 +1,88 @@
+// 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.agent.api;
+
+public class ConsoleAccessAuthenticationAnswer extends AgentControlAnswer {
+
+	private boolean _success;
+
+	private boolean _isReauthenticating;
+	private String _host;
+	private int _port;
+
+	private String _tunnelUrl;
+	private String _tunnelSession;
+
+	public ConsoleAccessAuthenticationAnswer() {
+		_success = false;
+		_isReauthenticating = false;
+		_port = 0;
+	}
+
+	public ConsoleAccessAuthenticationAnswer(Command cmd, boolean success) {
+		super(cmd);
+		_success = success;
+	}
+
+	public boolean succeeded() {
+		return _success;
+	}
+
+	public void setSuccess(boolean value) {
+		_success = value;
+	}
+
+	public boolean isReauthenticating() {
+		return _isReauthenticating;
+	}
+
+	public void setReauthenticating(boolean value) {
+		_isReauthenticating = value;
+	}
+
+	public String getHost() {
+		return _host;
+	}
+
+	public void setHost(String host) {
+		_host = host;
+	}
+
+	public int getPort() {
+		return _port;
+	}
+
+	public void setPort(int port) {
+		_port = port;
+	}
+
+	public String getTunnelUrl() {
+		return _tunnelUrl;
+	}
+
+	public void setTunnelUrl(String tunnelUrl) {
+		_tunnelUrl = tunnelUrl;
+	}
+
+	public String getTunnelSession() {
+		return _tunnelSession;
+	}
+
+	public void setTunnelSession(String tunnelSession) {
+		_tunnelSession = tunnelSession;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java b/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java
new file mode 100644
index 0000000..bd8093c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java
@@ -0,0 +1,68 @@
+// 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.agent.api;
+
+public class ConsoleAccessAuthenticationCommand extends AgentControlCommand {
+
+	private String _host;
+	private String _port;
+	private String _vmId;
+	private String _sid;
+	private String _ticket;
+
+	private boolean _isReauthenticating;
+
+	public ConsoleAccessAuthenticationCommand() {
+		_isReauthenticating = false;
+	}
+
+	public ConsoleAccessAuthenticationCommand(String host, String port, String vmId, String sid, String ticket) {
+		_host = host;
+		_port = port;
+		_vmId = vmId;
+		_sid = sid;
+		_ticket = ticket;
+	}
+
+	public String getHost() {
+		return _host;
+	}
+
+	public String getPort() {
+		return _port;
+	}
+
+	public String getVmId() {
+		return _vmId;
+	}
+
+	public String getSid() {
+		return _sid;
+	}
+
+	public String getTicket() {
+		return _ticket;
+	}
+
+	public boolean isReauthenticating() {
+		return _isReauthenticating;
+	}
+
+	public void setReauthenticating(boolean value) {
+		_isReauthenticating = value;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java b/core/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java
new file mode 100644
index 0000000..ebb06b6
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java
@@ -0,0 +1,39 @@
+// 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.agent.api;
+
+public class ConsoleProxyLoadReportCommand extends AgentControlCommand {
+
+	private long _proxyVmId;
+	private String _loadInfo;
+
+	public ConsoleProxyLoadReportCommand() {
+	}
+
+	public ConsoleProxyLoadReportCommand(long proxyVmId, String loadInfo) {
+		_proxyVmId = proxyVmId;
+		_loadInfo = loadInfo;
+	}
+
+	public long getProxyVmId() {
+		return _proxyVmId;
+	}
+
+	public String getLoadInfo() {
+		return _loadInfo;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java b/core/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java
new file mode 100644
index 0000000..9e2680e
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java
@@ -0,0 +1,82 @@
+// 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.agent.api;
+
+import com.cloud.storage.StoragePool;
+
+/**
+ * This currently assumes that both primary and secondary storage are mounted on the XenServer.
+ */
+public class CreatePrivateTemplateFromSnapshotCommand extends SnapshotCommand {
+    private String origTemplateInstallPath;
+    private Long   newTemplateId;
+    private String templateName;
+
+    protected CreatePrivateTemplateFromSnapshotCommand() {
+
+    }
+
+    /**
+     * Given the UUID of a backed up snapshot VHD file on the secondary storage, the execute of this command does
+     * 1) Get the parent chain of this VHD all the way up to the root, say VHDList
+     * 2) Copy all the files in the VHDlist to some temp location
+     * 3) Coalesce all the VHDs to one VHD which contains all the data of the volume. This invokes the DeletePreviousBackupCommand for each VHD
+     * 4) Rename the UUID of this VHD
+     * @param secondaryStoragePoolURL  This is what shows up in the UI when you click on Secondary storage.
+     *                                 In the code, it is present as: In the vmops.host_details table, there is a field mount.parent. This is the value of that field
+     *                                 If you have better ideas on how to get it, you are welcome.
+     *                                 It may not be the UUID of the base copy of the snapshot, if no data was written since last snapshot.
+     * @param origTemplateInstallPath  The install path of the original template VHD on the secondary
+     */
+
+    public CreatePrivateTemplateFromSnapshotCommand(StoragePool pool,
+                                                    String secondaryStoragePoolURL,
+                                                    Long   dcId,
+                                                    Long   accountId,
+                                                    Long   volumeId,
+                                                    String backedUpSnapshotUuid,
+                                                    String backedUpSnapshotName,
+                                                    String origTemplateInstallPath,
+                                                    Long   newTemplateId,
+                                                    String templateName,
+                                                    int wait)
+    {
+        super(pool, secondaryStoragePoolURL, backedUpSnapshotUuid, backedUpSnapshotName, dcId, accountId, volumeId);
+        this.origTemplateInstallPath = origTemplateInstallPath;
+        this.newTemplateId = newTemplateId;
+        this.templateName = templateName;
+        setWait(wait);
+    }
+
+    /**
+     * @return the origTemplateInstallPath
+     */
+    public String getOrigTemplateInstallPath() {
+        return origTemplateInstallPath;
+    }
+
+    public Long getNewTemplateId() {
+        return newTemplateId;
+    }
+
+    /**
+     * @return templateName
+     */
+    public String getTemplateName() {
+        return templateName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java b/core/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java
new file mode 100644
index 0000000..4e0bf32
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java
@@ -0,0 +1,93 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.StoragePool;
+
+public class CreatePrivateTemplateFromVolumeCommand extends SnapshotCommand {
+    private String _vmName;
+    private String _volumePath;
+    private String _userSpecifiedName;
+    private String _uniqueName;
+    private long _templateId;
+    private long _accountId;
+    StorageFilerTO _primaryPool;
+    // For XenServer
+    private String _secondaryStorageUrl;
+
+    public CreatePrivateTemplateFromVolumeCommand() {
+    }
+
+    public CreatePrivateTemplateFromVolumeCommand(StoragePool pool, String secondaryStorageUrl, long templateId, long accountId, String userSpecifiedName, String uniqueName, String volumePath, String vmName, int wait) {
+        _secondaryStorageUrl = secondaryStorageUrl;
+        _templateId = templateId;
+        _accountId = accountId;
+        _userSpecifiedName = userSpecifiedName;
+        _uniqueName = uniqueName;
+        _volumePath = volumePath;
+        _vmName = vmName;
+        primaryStoragePoolNameLabel = pool.getUuid();
+        _primaryPool = new StorageFilerTO(pool);
+        setWait(wait);
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public StorageFilerTO getPool() {
+        return _primaryPool;
+    }
+
+    public String getSecondaryStorageUrl() {
+        return _secondaryStorageUrl;
+    }
+
+    public String getTemplateName() {
+        return _userSpecifiedName;
+    }
+
+    public String getUniqueName() {
+        return _uniqueName;
+    }
+
+    public long getTemplateId() {
+        return _templateId;
+    }
+
+    public String getVmName() {
+        return _vmName;
+    }
+
+    public void setVolumePath(String _volumePath) {
+        this._volumePath = _volumePath;
+    }
+
+    public String getVolumePath() {
+        return _volumePath;
+    }
+
+    public Long getAccountId() {
+        return _accountId;
+    }
+
+    public void setTemplateId(long templateId) {
+        _templateId = templateId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreateStoragePoolCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreateStoragePoolCommand.java b/core/src/com/cloud/agent/api/CreateStoragePoolCommand.java
new file mode 100644
index 0000000..7a4d768
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreateStoragePoolCommand.java
@@ -0,0 +1,30 @@
+// 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.agent.api;
+
+import com.cloud.storage.StoragePool;
+
+public class CreateStoragePoolCommand extends ModifyStoragePoolCommand {
+
+
+	public CreateStoragePoolCommand() {
+	}
+
+    public CreateStoragePoolCommand(boolean add, StoragePool pool) {
+        super(add, pool);
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java b/core/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java
new file mode 100644
index 0000000..f9fb164
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java
@@ -0,0 +1,62 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class CreateVMSnapshotAnswer extends Answer {
+
+    private List<VolumeTO> volumeTOs;
+    private VMSnapshotTO vmSnapshotTo;
+    
+ 
+	public List<VolumeTO> getVolumeTOs() {
+        return volumeTOs;
+    }
+
+    public void setVolumeTOs(List<VolumeTO> volumeTOs) {
+        this.volumeTOs = volumeTOs;
+    }
+
+    public VMSnapshotTO getVmSnapshotTo() {
+        return vmSnapshotTo;
+    }
+
+    public void setVmSnapshotTo(VMSnapshotTO vmSnapshotTo) {
+        this.vmSnapshotTo = vmSnapshotTo;
+    }
+
+    public CreateVMSnapshotAnswer() {
+
+    }
+
+    public CreateVMSnapshotAnswer(CreateVMSnapshotCommand cmd, boolean success,
+            String result) {
+        super(cmd, success, result);
+    }
+
+    public CreateVMSnapshotAnswer(CreateVMSnapshotCommand cmd,
+    		VMSnapshotTO vmSnapshotTo, List<VolumeTO> volumeTOs) {
+        super(cmd, true, "");
+        this.vmSnapshotTo = vmSnapshotTo;
+        this.volumeTOs = volumeTOs;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreateVMSnapshotCommand.java b/core/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
new file mode 100644
index 0000000..478987d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
@@ -0,0 +1,42 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.vm.VirtualMachine;
+
+public class CreateVMSnapshotCommand extends VMSnapshotBaseCommand {
+
+    public CreateVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType, VirtualMachine.State vmState) {
+        super(vmName, snapshot, volumeTOs, guestOSType);
+        this.vmState  = vmState;
+    }
+
+    private VirtualMachine.State vmState;
+   
+
+    public VirtualMachine.State getVmState() {
+        return vmState;
+    }
+
+    public void setVmState(VirtualMachine.State vmState) {
+        this.vmState = vmState;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java b/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java
new file mode 100644
index 0000000..2f7cd94
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java
@@ -0,0 +1,38 @@
+// 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.agent.api;
+
+
+public class CreateVolumeFromSnapshotAnswer extends Answer {
+    private String vdiUUID;
+
+    protected CreateVolumeFromSnapshotAnswer() {
+
+    }
+
+    public CreateVolumeFromSnapshotAnswer(CreateVolumeFromSnapshotCommand cmd, boolean success, String result, String vdiUUID) {
+        super(cmd, success, result);
+        this.vdiUUID = vdiUUID;
+    }
+
+    /**
+     * @return the vdi
+     */
+    public String getVdi() {
+        return vdiUUID;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java b/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
new file mode 100644
index 0000000..fbf6121
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
@@ -0,0 +1,58 @@
+// 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.agent.api;
+
+import com.cloud.storage.StoragePool;
+
+
+/**
+ * This currently assumes that both primary and secondary storage are mounted on the XenServer.
+ */
+public class CreateVolumeFromSnapshotCommand extends SnapshotCommand {
+
+    protected CreateVolumeFromSnapshotCommand() {
+
+    }
+
+    /**
+     * Given the UUID of a backed up snapshot VHD file on the secondary storage, the execute of this command does
+     * 1) Get the parent chain of this VHD all the way up to the root, say VHDList
+     * 2) Copy all the files in the VHDlist to some temp location
+     * 3) Coalesce all the VHDs to one VHD which contains all the data of the volume. This invokes the DeletePreviousBackupCommand for each VHD
+     * 4) Rename the UUID of this VHD
+     * 5) Move this VHD to primary storage
+     * @param primaryStoragePoolNameLabel   The primary storage Pool
+     * @param secondaryStoragePoolURL This is what shows up in the UI when you click on Secondary storage.
+     *                                 In the code, it is present as: In the vmops.host_details table, there is a field mount.parent. This is the value of that field
+     *                                 If you have better ideas on how to get it, you are welcome.
+     *                                 It may not be the UUID of the base copy of the snapshot, if no data was written since last snapshot.
+     * @param templatePath             The install path of the template VHD on the secondary, if this a root volume
+     */
+
+    public CreateVolumeFromSnapshotCommand(StoragePool pool,
+                                           String secondaryStoragePoolURL,
+                                           Long   dcId,
+                                           Long   accountId,
+                                           Long   volumeId,
+                                           String backedUpSnapshotUuid,
+                                           String backedUpSnapshotName,
+                                           int wait)
+    {
+        super(pool, secondaryStoragePoolURL, backedUpSnapshotUuid, backedUpSnapshotName, dcId, accountId, volumeId);
+        setWait(wait);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java b/core/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java
new file mode 100644
index 0000000..ed3bc62
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java
@@ -0,0 +1,54 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class CreateVolumeFromVMSnapshotAnswer extends Answer {
+    private String path;
+    private VolumeTO volumeTo;
+
+    public VolumeTO getVolumeTo() {
+        return volumeTo;
+    }
+
+    public CreateVolumeFromVMSnapshotAnswer(
+            CreateVolumeFromVMSnapshotCommand cmd, VolumeTO volumeTo) {
+        super(cmd, true, "");
+        this.volumeTo = volumeTo;
+    }
+
+    public String getPath() {
+        return path;
+    }
+
+    protected CreateVolumeFromVMSnapshotAnswer() {
+
+    }
+
+    public CreateVolumeFromVMSnapshotAnswer(
+            CreateVolumeFromVMSnapshotCommand cmd, String path) {
+        super(cmd, true, "");
+        this.path = path;
+    }
+
+    public CreateVolumeFromVMSnapshotAnswer(
+            CreateVolumeFromVMSnapshotCommand cmd, boolean result, String string) {
+        super(cmd, result, string);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java b/core/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java
new file mode 100644
index 0000000..634e15c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java
@@ -0,0 +1,88 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.vm.DiskProfile;
+
+public class CreateVolumeFromVMSnapshotCommand extends Command {
+
+    protected String path;
+    protected String name;
+    protected Boolean fullClone;
+    protected String storagePoolUuid;
+    private StorageFilerTO pool;
+    private DiskProfile diskProfile;
+    private Long volumeId;
+
+    public DiskProfile getDskch() {
+        return diskProfile;
+    }
+
+    public String getPath() {
+        return path;
+    }
+
+    public Long getVolumeId() {
+        return volumeId;
+    }
+
+    protected CreateVolumeFromVMSnapshotCommand() {
+
+    }
+
+    public CreateVolumeFromVMSnapshotCommand(String path, String name,
+            Boolean fullClone, String storagePoolUuid) {
+        this.path = path;
+        this.name = name;
+        this.fullClone = fullClone;
+        this.storagePoolUuid = storagePoolUuid;
+    }
+
+    public CreateVolumeFromVMSnapshotCommand(String path, String name,
+            Boolean fullClone, String storagePoolUuid, StorageFilerTO pool,
+            DiskProfile diskProfile, Long volumeId) {
+        this.path = path;
+        this.name = name;
+        this.fullClone = fullClone;
+        this.storagePoolUuid = storagePoolUuid;
+        this.pool = pool;
+        this.diskProfile = diskProfile;
+        this.volumeId = volumeId;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public Boolean getFullClone() {
+        return fullClone;
+    }
+
+    public String getStoragePoolUuid() {
+        return storagePoolUuid;
+    }
+
+    public StorageFilerTO getPool() {
+        return pool;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CronCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CronCommand.java b/core/src/com/cloud/agent/api/CronCommand.java
new file mode 100755
index 0000000..c43237c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CronCommand.java
@@ -0,0 +1,24 @@
+// 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.agent.api;
+
+public interface CronCommand {
+    /**
+     * @return interval at which to run the command in seconds.
+     */
+    public int getInterval();
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DeleteObjectFromSwiftCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteObjectFromSwiftCommand.java b/core/src/com/cloud/agent/api/DeleteObjectFromSwiftCommand.java
new file mode 100644
index 0000000..3d62c50
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DeleteObjectFromSwiftCommand.java
@@ -0,0 +1,61 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.agent.api.to.SwiftTO;
+
+/**
+ *
+ *
+ */
+
+public class DeleteObjectFromSwiftCommand extends Command {
+    @LogLevel(Log4jLevel.Off)
+    private SwiftTO swift;
+    private String container;
+    private String object;
+
+    protected DeleteObjectFromSwiftCommand() {
+
+    }
+
+    public DeleteObjectFromSwiftCommand(SwiftTO swift, String container, String object) {
+        this.swift = swift;
+        this.container = container;
+        this.object = object;
+    }
+
+    public SwiftTO getSwift() {
+        return this.swift;
+    }
+
+    public String getContainer() {
+        return container;
+    }
+
+    public String getObject() {
+        return object;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        // TODO Auto-generated method stub
+        return true;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java b/core/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java
new file mode 100644
index 0000000..9a895d8
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java
@@ -0,0 +1,32 @@
+// 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.agent.api;
+
+
+public class DeleteSnapshotBackupAnswer extends Answer {
+
+    protected DeleteSnapshotBackupAnswer() {
+
+    }
+
+    public DeleteSnapshotBackupAnswer(DeleteSnapshotBackupCommand cmd, boolean success, String details) {
+        super(cmd, success, details);
+    }
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java b/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
new file mode 100644
index 0000000..128df84
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
@@ -0,0 +1,96 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.agent.api.to.S3TO;
+import com.cloud.agent.api.to.SwiftTO;
+import com.cloud.storage.StoragePool;
+
+/**
+ * This command encapsulates a primitive operation which enables coalescing the backed up VHD snapshots on the secondary server
+ * This currently assumes that the secondary storage are mounted on the XenServer.
+ */
+public class DeleteSnapshotBackupCommand extends SnapshotCommand {
+    @LogLevel(Log4jLevel.Off)
+    private SwiftTO swift;
+    private S3TO s3;
+    private Boolean all;
+
+    public SwiftTO getSwift() {
+        return swift;
+    }
+
+    public Boolean isAll() {
+        return all;
+    }
+
+    public void setAll(Boolean all) {
+        this.all = all;
+    }
+
+    public void setSwift(SwiftTO swift) {
+        this.swift = swift;
+    }
+
+    public S3TO getS3() {
+        return s3;
+    }
+
+    protected DeleteSnapshotBackupCommand() {
+    }
+
+    /**
+     * Given 2 VHD files on the secondary storage which are linked in a parent chain as follows:
+     * backupUUID = parent(childUUID)
+     * It gets another VHD
+     * previousBackupVHD = parent(backupUUID)
+     *
+     * And
+     * 1) it coalesces backupUuid into its parent.
+     * 2) It deletes the VHD file corresponding to backupUuid
+     * 3) It sets the parent VHD of childUUID to that of previousBackupUuid
+     *
+     * It takes care of the cases when
+     * 1) childUUID is null. - Step 3 is not done.
+     * 2) previousBackupUUID is null
+     *       - Merge childUUID into its parent backupUUID
+     *       - Set the UUID of the resultant VHD to childUUID
+     *       - Essentially we are deleting the oldest VHD file and setting the current oldest VHD to childUUID
+     *
+     * @param volumeName                  The name of the volume whose snapshot was taken (something like i-3-SV-ROOT)
+     * @param secondaryStoragePoolURL    This is what shows up in the UI when you click on Secondary storage.
+     *                                    In the code, it is present as: In the vmops.host_details table, there is a field mount.parent. This is the value of that field
+     *                                    If you have better ideas on how to get it, you are welcome.
+     * @param backupUUID                  The VHD which has to be deleted
+     * @param childUUID                   The child VHD file of the backup whose parent is reset to its grandparent.
+     */
+    public DeleteSnapshotBackupCommand(StoragePool pool,
+                                       SwiftTO swift,
+                                       S3TO s3,
+                                       String secondaryStoragePoolURL,
+                                       Long   dcId,
+                                       Long   accountId,
+                                       Long   volumeId,
+ String backupUUID, Boolean all)
+    {
+        super(pool, secondaryStoragePoolURL, backupUUID, null, dcId, accountId, volumeId);
+        setSwift(swift);
+        this.s3 = s3;
+        setAll(all);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java b/core/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java
new file mode 100644
index 0000000..e2071d7
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java
@@ -0,0 +1,63 @@
+// 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.agent.api;
+
+/**
+ * This command encapsulates a primitive operation which enables coalescing the backed up VHD snapshots on the secondary server
+ * This currently assumes that the secondary storage are mounted on the XenServer.
+ */
+public class DeleteSnapshotsDirCommand extends Command {
+    String secondaryStorageUrl;
+    Long dcId;
+    Long accountId;
+    Long volumeId;
+
+    protected DeleteSnapshotsDirCommand() {
+
+    }
+
+    public DeleteSnapshotsDirCommand(String secondaryStorageUrl,
+ Long dcId, Long accountId, Long volumeId)
+    {
+        this.secondaryStorageUrl = secondaryStorageUrl;
+        this.dcId = dcId;
+        this.accountId = accountId;
+        this.volumeId = volumeId;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    public String getSecondaryStorageUrl() {
+        return secondaryStorageUrl;
+    }
+
+    public Long getDcId() {
+        return dcId;
+    }
+
+    public Long getAccountId() {
+        return accountId;
+    }
+
+    public Long getVolumeId() {
+        return volumeId;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DeleteStoragePoolCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteStoragePoolCommand.java b/core/src/com/cloud/agent/api/DeleteStoragePoolCommand.java
new file mode 100644
index 0000000..4618d59
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DeleteStoragePoolCommand.java
@@ -0,0 +1,61 @@
+// 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.agent.api;
+
+import java.io.File;
+import java.util.UUID;
+
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.StoragePool;
+
+public class DeleteStoragePoolCommand extends Command {
+
+	StorageFilerTO pool;
+	public static final String LOCAL_PATH_PREFIX="/mnt/";
+	String localPath;
+
+	public DeleteStoragePoolCommand() {
+
+	}
+
+    public DeleteStoragePoolCommand(StoragePool pool, String localPath) {
+    	this.pool = new StorageFilerTO(pool);
+    	this.localPath = localPath;
+    }
+
+    public DeleteStoragePoolCommand(StoragePool pool) {
+		this(pool, LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes()));
+	}
+
+    public StorageFilerTO getPool() {
+        return pool;
+    }
+
+    public void setPool(StoragePool pool) {
+        this.pool = new StorageFilerTO(pool);
+    }
+
+	@Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+	public String getLocalPath() {
+		return localPath;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DeleteTemplateFromS3Command.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteTemplateFromS3Command.java b/core/src/com/cloud/agent/api/DeleteTemplateFromS3Command.java
new file mode 100644
index 0000000..278669b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DeleteTemplateFromS3Command.java
@@ -0,0 +1,106 @@
+/*
+ * 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.agent.api;
+
+import com.cloud.agent.api.to.S3TO;
+
+public class DeleteTemplateFromS3Command extends Command {
+
+    private S3TO s3;
+    private Long templateId;
+    private Long accountId;
+
+    protected DeleteTemplateFromS3Command() {
+        super();
+    }
+
+    public DeleteTemplateFromS3Command(final S3TO s3, final Long accountId,
+            final Long templateId) {
+
+        super();
+
+        this.s3 = s3;
+        this.accountId = accountId;
+        this.templateId = templateId;
+
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result
+                + ((accountId == null) ? 0 : accountId.hashCode());
+        result = prime * result + ((s3 == null) ? 0 : s3.hashCode());
+        result = prime * result
+                + ((templateId == null) ? 0 : templateId.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object thatObject) {
+
+        if (this == thatObject) {
+            return true;
+        }
+
+        if (thatObject == null) {
+            return false;
+        }
+
+        if (getClass() != thatObject.getClass()) {
+            return false;
+        }
+
+        final DeleteTemplateFromS3Command thatCommand = (DeleteTemplateFromS3Command) thatObject;
+
+        if (!(accountId == thatCommand.accountId)
+                || (this.accountId != null && this.accountId
+                        .equals(thatCommand.accountId))) {
+            return false;
+        }
+
+        if (!(templateId == thatCommand.templateId)
+                || (this.templateId != null && this.templateId
+                        .equals(thatCommand.templateId))) {
+            return false;
+        }
+
+        return true;
+
+    }
+
+    public S3TO getS3() {
+        return s3;
+    }
+
+    public Long getTemplateId() {
+        return templateId;
+    }
+
+    public Long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java b/core/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
new file mode 100644
index 0000000..8f4ecad
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
@@ -0,0 +1,49 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class DeleteVMSnapshotAnswer extends Answer {
+    private List<VolumeTO> volumeTOs;
+
+    public DeleteVMSnapshotAnswer() {
+    }
+
+    public DeleteVMSnapshotAnswer(DeleteVMSnapshotCommand cmd, boolean result,
+            String message) {
+        super(cmd, result, message);
+    }
+
+    public DeleteVMSnapshotAnswer(DeleteVMSnapshotCommand cmd,
+            List<VolumeTO> volumeTOs) {
+        super(cmd, true, "");
+        this.volumeTOs = volumeTOs;
+    }
+
+    public List<VolumeTO> getVolumeTOs() {
+        return volumeTOs;
+    }
+
+    public void setVolumeTOs(List<VolumeTO> volumeTOs) {
+        this.volumeTOs = volumeTOs;
+    }
+
+ 
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java b/core/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java
new file mode 100644
index 0000000..c213448
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java
@@ -0,0 +1,28 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+
+public class DeleteVMSnapshotCommand extends VMSnapshotBaseCommand {
+    public DeleteVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType) {
+        super( vmName,  snapshot, volumeTOs, guestOSType);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DownloadSnapshotFromS3Command.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DownloadSnapshotFromS3Command.java b/core/src/com/cloud/agent/api/DownloadSnapshotFromS3Command.java
new file mode 100644
index 0000000..edf683a
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DownloadSnapshotFromS3Command.java
@@ -0,0 +1,61 @@
+/*
+ * 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.agent.api;
+
+import com.cloud.agent.api.to.S3TO;
+
+public class DownloadSnapshotFromS3Command extends SnapshotCommand {
+
+    private S3TO s3;
+    private String parent;
+
+    protected DownloadSnapshotFromS3Command() {
+        super();
+    }
+
+    public DownloadSnapshotFromS3Command(S3TO s3, String parent,
+            String secondaryStorageUrl, Long dcId, Long accountId,
+            Long volumeId, String backupUuid, int wait) {
+
+        super(null, secondaryStorageUrl, backupUuid, "", dcId, accountId,
+                volumeId);
+
+        this.s3 = s3;
+        this.parent = parent;
+        setWait(wait);
+
+    }
+
+    public S3TO getS3() {
+        return s3;
+    }
+
+    public void setS3(S3TO s3) {
+        this.s3 = s3;
+    }
+
+    public String getParent() {
+        return parent;
+    }
+
+    public void setParent(String parent) {
+        this.parent = parent;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DownloadSnapshotFromSwiftCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DownloadSnapshotFromSwiftCommand.java b/core/src/com/cloud/agent/api/DownloadSnapshotFromSwiftCommand.java
new file mode 100644
index 0000000..0711b2e
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DownloadSnapshotFromSwiftCommand.java
@@ -0,0 +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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.agent.api.to.SwiftTO;
+
+/**
+ * This currently assumes that both primary and secondary storage are mounted on the XenServer.
+ */
+public class DownloadSnapshotFromSwiftCommand extends SnapshotCommand {
+    @LogLevel(Log4jLevel.Off)
+    private SwiftTO _swift;
+
+    private String _parent;
+
+    protected DownloadSnapshotFromSwiftCommand() {
+
+    }
+
+    public DownloadSnapshotFromSwiftCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long volumeId, String parent, String BackupUuid, int wait) {
+
+        super(null, secondaryStorageUrl, BackupUuid, "", dcId, accountId, volumeId);
+        setParent(parent);
+        setSwift(swift);
+        setWait(wait);
+    }
+
+
+    public SwiftTO getSwift() {
+        return this._swift;
+    }
+
+    public void setSwift(SwiftTO swift) {
+        this._swift = swift;
+    }
+
+    public String getParent() {
+        return _parent;
+    }
+
+    public void setParent(String parent) {
+        this._parent = parent;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DownloadTemplateFromS3ToSecondaryStorageCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DownloadTemplateFromS3ToSecondaryStorageCommand.java b/core/src/com/cloud/agent/api/DownloadTemplateFromS3ToSecondaryStorageCommand.java
new file mode 100644
index 0000000..af61228
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DownloadTemplateFromS3ToSecondaryStorageCommand.java
@@ -0,0 +1,66 @@
+/*
+ * 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.agent.api;
+
+import com.cloud.agent.api.to.S3TO;
+
+public final class DownloadTemplateFromS3ToSecondaryStorageCommand extends Command {
+
+    private final S3TO s3;
+    private final Long accountId;
+    private final Long templateId;
+    private final String storagePath;
+
+    public DownloadTemplateFromS3ToSecondaryStorageCommand(final S3TO s3,
+        final Long accountId, final Long templateId,
+        final String storagePath, final int wait) {
+
+        super();
+
+        this.s3 = s3;
+        this.accountId = accountId;
+        this.templateId = templateId;
+        this.storagePath = storagePath;
+
+        setWait(wait);
+
+    }
+
+    public S3TO getS3() {
+        return this.s3;
+    }
+
+    public Long getAccountId() {
+        return this.accountId;
+    }
+
+    public Long getTemplateId() {
+        return this.templateId;
+    }
+
+    public String getStoragePath() {
+        return this.storagePath;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+}


[18/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostPeerDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostPeerDaoImpl.java b/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostPeerDaoImpl.java
new file mode 100644
index 0000000..8ad02cd
--- /dev/null
+++ b/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostPeerDaoImpl.java
@@ -0,0 +1,108 @@
+// 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.cluster.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.cluster.ManagementServerHost;
+import com.cloud.cluster.ManagementServerHostPeerVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value={ManagementServerHostPeerDao.class})
+public class ManagementServerHostPeerDaoImpl extends GenericDaoBase<ManagementServerHostPeerVO, Long> implements ManagementServerHostPeerDao {
+    private static final Logger s_logger = Logger.getLogger(ManagementServerHostPeerDaoImpl.class);
+    
+    private final SearchBuilder<ManagementServerHostPeerVO> ClearPeerSearch;
+    private final SearchBuilder<ManagementServerHostPeerVO> FindForUpdateSearch;
+    private final SearchBuilder<ManagementServerHostPeerVO> CountSearch;
+
+    public ManagementServerHostPeerDaoImpl() {
+        ClearPeerSearch = createSearchBuilder();
+        ClearPeerSearch.and("ownerMshost", ClearPeerSearch.entity().getOwnerMshost(), SearchCriteria.Op.EQ);
+        ClearPeerSearch.done();
+        
+        FindForUpdateSearch = createSearchBuilder();
+        FindForUpdateSearch.and("ownerMshost", FindForUpdateSearch.entity().getOwnerMshost(), SearchCriteria.Op.EQ);
+        FindForUpdateSearch.and("peerMshost", FindForUpdateSearch.entity().getPeerMshost(), SearchCriteria.Op.EQ);
+        FindForUpdateSearch.and("peerRunid", FindForUpdateSearch.entity().getPeerRunid(), SearchCriteria.Op.EQ);
+        FindForUpdateSearch.done();
+        
+        CountSearch = createSearchBuilder();
+        CountSearch.and("peerMshost", CountSearch.entity().getPeerMshost(), SearchCriteria.Op.EQ);
+        CountSearch.and("peerRunid", CountSearch.entity().getPeerRunid(), SearchCriteria.Op.EQ);
+        CountSearch.and("peerState", CountSearch.entity().getPeerState(), SearchCriteria.Op.EQ);
+        CountSearch.done();
+    }
+    
+    @Override
+    @DB
+    public void clearPeerInfo(long ownerMshost) {
+        SearchCriteria<ManagementServerHostPeerVO>  sc = ClearPeerSearch.create();
+        sc.setParameters("ownerMshost", ownerMshost);
+        
+        expunge(sc);
+    }
+    
+    @Override
+    @DB
+    public void updatePeerInfo(long ownerMshost, long peerMshost, long peerRunid, ManagementServerHost.State peerState) {
+        Transaction txn = Transaction.currentTxn();
+        try {
+            txn.start();
+        
+            SearchCriteria<ManagementServerHostPeerVO> sc = FindForUpdateSearch.create();
+            sc.setParameters("ownerMshost", ownerMshost);
+            sc.setParameters("peerMshost", peerMshost);
+            sc.setParameters("peerRunid", peerRunid);
+            List<ManagementServerHostPeerVO> l = listBy(sc);
+            if(l.size() == 1) {
+                ManagementServerHostPeerVO peer = l.get(0);
+                peer.setPeerState(peerState);
+                update(peer.getId(), peer);
+            } else {
+                ManagementServerHostPeerVO peer = new ManagementServerHostPeerVO(ownerMshost, peerMshost, peerRunid, peerState);
+                persist(peer);
+            }
+            txn.commit();
+        } catch(Exception e) {
+            s_logger.warn("Unexpected exception, ", e);
+            txn.rollback();
+        }
+    }
+    
+    @Override
+    @DB
+    public int countStateSeenInPeers(long mshost, long runid, ManagementServerHost.State state) {
+        SearchCriteria<ManagementServerHostPeerVO> sc = CountSearch.create();
+        sc.setParameters("peerMshost", mshost);
+        sc.setParameters("peerRunid", runid);
+        sc.setParameters("peerState", state);
+        
+        List<ManagementServerHostPeerVO> l = listBy(sc);
+        return l.size();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/configuration/ConfigurationVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/ConfigurationVO.java b/engine/schema/src/com/cloud/configuration/ConfigurationVO.java
new file mode 100644
index 0000000..6cd87b0
--- /dev/null
+++ b/engine/schema/src/com/cloud/configuration/ConfigurationVO.java
@@ -0,0 +1,107 @@
+// 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.configuration;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.utils.crypt.DBEncryptionUtil;
+
+@Entity
+@Table(name="configuration")
+public class ConfigurationVO implements Configuration{
+	@Column(name="instance")
+    private String instance;
+
+	@Column(name="component")
+	private String component;
+	
+	@Id
+	@Column(name="name")
+    private String name;
+	
+	@Column(name="value", length=4095)
+    private String value;
+	
+	@Column(name="description", length=1024)
+    private String description;
+	
+	@Column(name="category")
+	private String category;
+	
+	protected ConfigurationVO() {}
+	
+	public ConfigurationVO(String category, String instance, String component, String name, String value, String description) {
+		this.category = category;
+		this.instance = instance;
+		this.component = component;
+		this.name = name;
+		this.value = value;
+		this.description = description;
+	}
+
+	public String getCategory() {
+		return category;
+	}
+	
+	public void setCategory(String category) {
+		this.category = category;
+	}
+	
+	public String getInstance() {
+		return instance;
+	}
+	
+	public void setInstance(String instance) {
+		this.instance = instance;
+	}
+
+	public String getComponent() {
+	    return component;
+	}
+	
+	public void setComponent(String component) {
+		this.component = component;
+	}
+
+	public String getName() {
+		return name;
+	}
+	
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getValue() {
+		return (("Hidden".equals(getCategory()) || "Secure".equals(getCategory())) ? DBEncryptionUtil.decrypt(value) : value);
+	}
+	
+	public void setValue(String value) {
+		this.value = value;
+	}
+	
+	public String getDescription() {
+		return description;
+	}
+	
+	public void setDescription(String description) {
+		this.description = description;
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/configuration/ResourceCountVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/ResourceCountVO.java b/engine/schema/src/com/cloud/configuration/ResourceCountVO.java
new file mode 100644
index 0000000..b87f55c
--- /dev/null
+++ b/engine/schema/src/com/cloud/configuration/ResourceCountVO.java
@@ -0,0 +1,131 @@
+// 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.configuration;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="resource_count")
+public class ResourceCountVO implements ResourceCount {
+	
+	@Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private Long id = null;
+	
+	@Column(name="type")
+	@Enumerated(EnumType.STRING)
+	private ResourceType type;
+	
+	@Column(name="account_id")
+    private Long accountId;
+	
+	@Column(name="domain_id")
+    private Long domainId;
+	
+	@Column(name="count")
+	private long count;
+	
+    
+    public ResourceCountVO(){}
+	
+	public ResourceCountVO(ResourceType type, long count, long ownerId, ResourceOwnerType ownerType) {  
+		this.type = type;
+		this.count = count;
+		
+		if (ownerType == ResourceOwnerType.Account) {
+		    this.accountId = ownerId;
+		} else if (ownerType == ResourceOwnerType.Domain) {
+		    this.domainId = ownerId;
+		}
+	}
+	
+	@Override
+	public long getId() {
+		return id;
+	}
+	
+	public void setId(Long id) {
+		this.id = id;
+	}
+	
+	@Override
+	public ResourceType getType() {
+		return type;
+	}
+	
+	public void setType(ResourceType type) {
+		this.type = type;
+	}
+
+	@Override
+	public long getCount() {
+		return count;
+	}
+	@Override
+	public void setCount(long count) {
+		this.count = count;
+	}
+	
+    public Long getDomainId() {
+        return domainId;
+    }
+    
+    public Long getAccountId() {
+        return accountId;
+    }
+	
+	@Override
+    public String toString() {
+        return new StringBuilder("REsourceCount[").append("-").append(id).append("-").append(type).append("-").append(accountId).append("-").append(domainId).append("]").toString();
+    }
+	
+	@Override
+	public long getOwnerId() {
+	    if (accountId != null) {
+	        return accountId;
+	    } 
+	    
+	    return domainId;
+	}
+	
+	@Override
+	public ResourceOwnerType getResourceOwnerType() {
+	    if (accountId != null) {
+	        return ResourceOwnerType.Account;
+	    } else {
+	        return ResourceOwnerType.Domain;
+	    }
+	}
+	
+	public void setDomainId(Long domainId) {
+	    this.domainId = domainId;
+	}
+
+	public void setAccountId(Long accountId) {
+	    this.accountId = accountId;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/configuration/ResourceLimitVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/ResourceLimitVO.java b/engine/schema/src/com/cloud/configuration/ResourceLimitVO.java
new file mode 100644
index 0000000..c131495
--- /dev/null
+++ b/engine/schema/src/com/cloud/configuration/ResourceLimitVO.java
@@ -0,0 +1,128 @@
+// 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.configuration;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "resource_limit")
+public class ResourceLimitVO implements ResourceLimit {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private Long id = null;
+
+    @Column(name = "type")
+    @Enumerated(EnumType.STRING)
+    private ResourceCount.ResourceType type;
+
+    @Column(name = "domain_id")
+    private Long domainId;
+
+    @Column(name = "account_id")
+    private Long accountId;
+
+    @Column(name = "max")
+    private Long max;
+
+    public ResourceLimitVO() {
+    }
+
+    public ResourceLimitVO(ResourceCount.ResourceType type, Long max, long ownerId, ResourceOwnerType ownerType) {
+        this.type = type;
+        this.max = max;
+
+        if (ownerType == ResourceOwnerType.Account) {
+            this.accountId = ownerId;
+        } else if (ownerType == ResourceOwnerType.Domain) {
+            this.domainId = ownerId;
+        }
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    @Override
+    public ResourceType getType() {
+        return type;
+    }
+
+    public void setType(ResourceCount.ResourceType type) {
+        this.type = type;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public Long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public Long getMax() {
+        return max;
+    }
+
+    @Override
+    public void setMax(Long max) {
+        this.max = max;
+    }
+
+    @Override
+    public long getOwnerId() {
+        if (accountId != null) {
+            return accountId;
+        }
+
+        return domainId;
+    }
+
+    @Override
+    public ResourceOwnerType getResourceOwnerType() {
+        if (accountId != null) {
+            return ResourceOwnerType.Account;
+        } else {
+            return ResourceOwnerType.Domain;
+        }
+    }
+
+    public void setDomainId(Long domainId) {
+        this.domainId = domainId;
+    }
+
+    public void setAccountId(Long accountId) {
+        this.accountId = accountId;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/configuration/dao/ConfigurationDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/dao/ConfigurationDao.java b/engine/schema/src/com/cloud/configuration/dao/ConfigurationDao.java
new file mode 100644
index 0000000..2b09901
--- /dev/null
+++ b/engine/schema/src/com/cloud/configuration/dao/ConfigurationDao.java
@@ -0,0 +1,69 @@
+// 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.configuration.dao;
+
+import java.util.Map;
+import java.util.List;
+
+import com.cloud.configuration.ConfigurationVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface ConfigurationDao extends GenericDao<ConfigurationVO, String> {
+	
+	/**
+	 * 
+	 *    1. params passed in.
+	 *    2. configuration for the instance.
+	 *    3. configuration for the DEFAULT instance.
+	 * 
+	 * @param params parameters from the components.xml which will override the database values.
+	 * @return a consolidated look at the configuration parameters.
+	 */
+    public Map<String, String> getConfiguration(String instance, Map<String, ? extends Object> params);
+    
+    public Map<String, String> getConfiguration(Map<String, ? extends Object> params);
+    
+    public Map<String, String> getConfiguration();
+    
+    /**
+     * Updates a configuration value
+     * @param value the new value
+     * @return true if success, false if failure
+     */
+    public boolean update(String name, String value);
+    
+    /**
+     * Gets the value for the specified configuration name
+     * @return value
+     */
+    public String getValue(String name);
+    
+    public String getValueAndInitIfNotExist(String name, String category, String initValue);
+    
+
+    /**
+     * returns whether or not this is a premium configuration
+     * @return true if premium configuration, false otherwise
+     */
+    boolean isPremium();
+    
+    ConfigurationVO findByName(String name);
+
+	boolean update(String name, String category, String value);
+	
+	void invalidateCache();
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java b/engine/schema/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java
new file mode 100644
index 0000000..fe5f5ae
--- /dev/null
+++ b/engine/schema/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java
@@ -0,0 +1,225 @@
+// 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.configuration.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.configuration.ConfigurationVO;
+import com.cloud.utils.component.ComponentLifecycle;
+import com.cloud.utils.crypt.DBEncryptionUtil;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Component
+@Local(value={ConfigurationDao.class})
+public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String> implements ConfigurationDao {
+    private static final Logger s_logger = Logger.getLogger(ConfigurationDaoImpl.class);
+    private Map<String, String> _configs = null;
+    private boolean _premium;
+
+    final SearchBuilder<ConfigurationVO> InstanceSearch;
+    final SearchBuilder<ConfigurationVO> NameSearch;
+    
+    public static final String UPDATE_CONFIGURATION_SQL = "UPDATE configuration SET value = ? WHERE name = ?";
+
+    public ConfigurationDaoImpl () {
+        InstanceSearch = createSearchBuilder();
+        InstanceSearch.and("instance", InstanceSearch.entity().getInstance(), SearchCriteria.Op.EQ);
+        
+        NameSearch = createSearchBuilder();
+        NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ);
+        setRunLevel(ComponentLifecycle.RUN_LEVEL_SYSTEM_BOOTSTRAP);
+    }
+
+    @Override
+    public boolean isPremium() {
+        return _premium;
+    }
+    
+    @Override
+    public void invalidateCache() {
+    	_configs = null;
+    }
+
+    @Override
+    public Map<String, String> getConfiguration(String instance, Map<String, ? extends Object> params) {
+        if (_configs == null) {
+            _configs = new HashMap<String, String>();
+
+            SearchCriteria<ConfigurationVO> sc = InstanceSearch.create();
+            sc.setParameters("instance", "DEFAULT");
+
+            List<ConfigurationVO> configurations = listIncludingRemovedBy(sc);
+
+            for (ConfigurationVO config : configurations) {
+            	if (config.getValue() != null)
+            		_configs.put(config.getName(), config.getValue());
+            }
+
+            if(!"DEFAULT".equals(instance)){
+            	//Default instance params are already added, need not add again 
+            	sc = InstanceSearch.create();
+            	sc.setParameters("instance", instance);
+
+            	configurations = listIncludingRemovedBy(sc);
+
+            	for (ConfigurationVO config : configurations) {
+            		if (config.getValue() != null)
+            			_configs.put(config.getName(), config.getValue());
+            	}
+            }
+
+        }
+
+        mergeConfigs(_configs, params);
+        return _configs;
+    }
+
+    @Override
+    public Map<String, String> getConfiguration(Map<String, ? extends Object> params) {
+        return getConfiguration("DEFAULT", params);
+    }
+    
+    @Override
+    public Map<String, String> getConfiguration() {
+        return getConfiguration("DEFAULT", new HashMap<String, Object>());
+    }
+    
+    protected void mergeConfigs(Map<String, String> dbParams, Map<String, ? extends Object> xmlParams) {
+        for (Map.Entry<String, ? extends Object> param : xmlParams.entrySet()) {
+            dbParams.put(param.getKey(), (String)param.getValue());
+        }
+    }
+
+    @Override
+	public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+    	super.configure(name, params);
+
+    	Object premium = params.get("premium");
+        _premium = (premium != null) && ((String) premium).equals("true");
+
+        return true;
+    }
+
+    //Use update method with category instead
+    @Override @Deprecated
+    public boolean update(String name, String value) {
+    	Transaction txn = Transaction.currentTxn();
+		try {
+			PreparedStatement stmt = txn.prepareStatement(UPDATE_CONFIGURATION_SQL);
+			stmt.setString(1, value);
+			stmt.setString(2, name);
+			stmt.executeUpdate();
+			return true;
+		} catch (Exception e) {
+			s_logger.warn("Unable to update Configuration Value", e);
+		}
+		return false;
+    }
+
+    @Override
+    public boolean update(String name, String category, String value) {
+    	Transaction txn = Transaction.currentTxn();
+		try {
+			value = ("Hidden".equals(category) || "Secure".equals(category)) ? DBEncryptionUtil.encrypt(value) : value;
+			PreparedStatement stmt = txn.prepareStatement(UPDATE_CONFIGURATION_SQL);
+			stmt.setString(1, value);
+			stmt.setString(2, name);
+			stmt.executeUpdate();
+			return true;
+		} catch (Exception e) {
+			s_logger.warn("Unable to update Configuration Value", e);
+		}
+		return false;
+    }
+    
+    @Override
+    public String getValue(String name) {
+    	ConfigurationVO config =  findByName(name);
+        return (config == null) ? null : config.getValue();
+    }
+    
+    @Override
+    @DB
+    public String getValueAndInitIfNotExist(String name, String category, String initValue) {
+    	Transaction txn = Transaction.currentTxn();
+    	PreparedStatement stmt = null;
+    	PreparedStatement stmtInsert = null;
+    	String returnValue = initValue;
+		try {
+			txn.start();
+			stmt = txn.prepareAutoCloseStatement("SELECT value FROM configuration WHERE name=?");
+			stmt.setString(1, name);
+			ResultSet rs = stmt.executeQuery();
+			if(rs != null && rs.next()) {
+				returnValue =  rs.getString(1);
+				if(returnValue != null) {
+					txn.commit();
+					if("Hidden".equals(category) || "Secure".equals(category)){
+						return DBEncryptionUtil.decrypt(returnValue);
+					} else {
+						return returnValue;
+					}
+				} else {
+					// restore init value
+					returnValue = initValue;
+				}
+			}
+			stmt.close();
+
+			if("Hidden".equals(category) || "Secure".equals(category)){
+				initValue = DBEncryptionUtil.encrypt(initValue);
+			}
+			stmtInsert = txn.prepareAutoCloseStatement(
+				"INSERT INTO configuration(instance, name, value, description) VALUES('DEFAULT', ?, ?, '') ON DUPLICATE KEY UPDATE value=?");
+			stmtInsert.setString(1, name);
+			stmtInsert.setString(2, initValue);
+			stmtInsert.setString(3, initValue);
+			if(stmtInsert.executeUpdate() < 1) {
+				throw new CloudRuntimeException("Unable to init configuration variable: " + name); 
+			}
+			txn.commit();
+			return returnValue;
+		} catch (Exception e) {
+			s_logger.warn("Unable to update Configuration Value", e);
+			throw new CloudRuntimeException("Unable to init configuration variable: " + name); 
+		}
+    }
+    
+    @Override
+    public ConfigurationVO findByName(String name) {
+        SearchCriteria<ConfigurationVO> sc = NameSearch.create();
+        sc.setParameters("name", name);
+        return findOneIncludingRemovedBy(sc);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/configuration/dao/ResourceCountDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/dao/ResourceCountDao.java b/engine/schema/src/com/cloud/configuration/dao/ResourceCountDao.java
new file mode 100644
index 0000000..111bcb1
--- /dev/null
+++ b/engine/schema/src/com/cloud/configuration/dao/ResourceCountDao.java
@@ -0,0 +1,58 @@
+// 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.configuration.dao;
+
+import java.util.List;
+import java.util.Set;
+
+import com.cloud.configuration.Resource.ResourceOwnerType;
+import com.cloud.configuration.Resource.ResourceType;
+import com.cloud.configuration.ResourceCountVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface ResourceCountDao extends GenericDao<ResourceCountVO, Long> {
+	/**
+     * @param domainId the id of the domain to get the resource count
+     * @param type the type of resource (e.g. user_vm, public_ip, volume)
+     * @return the count of resources in use for the given type and domain
+     */
+	long getResourceCount(long ownerId, ResourceOwnerType ownerType, ResourceType type);
+
+    /**
+     * @param domainId the id of the domain to set the resource count
+     * @param type the type of resource (e.g. user_vm, public_ip, volume)
+     * @param the count of resources in use for the given type and domain
+     */
+	void setResourceCount(long ownerId, ResourceOwnerType ownerType, ResourceType type, long count);
+	
+	@Deprecated 
+	void updateDomainCount(long domainId, ResourceType type, boolean increment, long delta);
+
+    boolean updateById(long id, boolean increment, long delta);
+
+    void createResourceCounts(long ownerId, ResourceOwnerType ownerType);
+    
+    List<ResourceCountVO> listByOwnerId(long ownerId, ResourceOwnerType ownerType);
+    
+    ResourceCountVO findByOwnerAndType(long ownerId, ResourceOwnerType ownerType, ResourceType type);
+    
+    List<ResourceCountVO> listResourceCountByOwnerType(ResourceOwnerType ownerType);
+    
+    Set<Long> listAllRowsToUpdate(long ownerId, ResourceOwnerType ownerType, ResourceType type);
+
+    Set<Long> listRowsToUpdateForDomain(long domainId, ResourceType type);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java b/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
new file mode 100644
index 0000000..52bc746
--- /dev/null
+++ b/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
@@ -0,0 +1,222 @@
+// 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.configuration.dao;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.configuration.Resource;
+import com.cloud.configuration.Resource.ResourceOwnerType;
+import com.cloud.configuration.Resource.ResourceType;
+import com.cloud.configuration.ResourceCountVO;
+import com.cloud.configuration.ResourceLimit;
+import com.cloud.domain.dao.DomainDao;
+import com.cloud.domain.dao.DomainDaoImpl;
+import com.cloud.exception.UnsupportedServiceException;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.user.dao.AccountDaoImpl;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value={ResourceCountDao.class})
+public class ResourceCountDaoImpl extends GenericDaoBase<ResourceCountVO, Long> implements ResourceCountDao {
+    private final SearchBuilder<ResourceCountVO> TypeSearch;
+
+    private final SearchBuilder<ResourceCountVO> AccountSearch;
+    private final SearchBuilder<ResourceCountVO> DomainSearch;
+
+    @Inject protected DomainDao _domainDao;
+    @Inject protected AccountDao _accountDao;
+
+    public ResourceCountDaoImpl() {
+        TypeSearch = createSearchBuilder();
+        TypeSearch.and("type", TypeSearch.entity().getType(), SearchCriteria.Op.EQ);
+        TypeSearch.and("accountId", TypeSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        TypeSearch.and("domainId", TypeSearch.entity().getDomainId(), SearchCriteria.Op.EQ);
+        TypeSearch.done();
+
+        AccountSearch = createSearchBuilder();
+        AccountSearch.and("accountId", AccountSearch.entity().getAccountId(), SearchCriteria.Op.NNULL);
+        AccountSearch.done();
+
+        DomainSearch = createSearchBuilder();
+        DomainSearch.and("domainId", DomainSearch.entity().getDomainId(), SearchCriteria.Op.NNULL);
+        DomainSearch.done();
+    }
+
+    @Override 
+    public ResourceCountVO findByOwnerAndType(long ownerId, ResourceOwnerType ownerType, ResourceType type) {
+        SearchCriteria<ResourceCountVO> sc = TypeSearch.create();
+        sc.setParameters("type", type);
+
+        if (ownerType == ResourceOwnerType.Account) {
+            sc.setParameters("accountId", ownerId);
+            return findOneIncludingRemovedBy(sc);
+        } else if (ownerType == ResourceOwnerType.Domain) {
+            sc.setParameters("domainId", ownerId);
+            return findOneIncludingRemovedBy(sc);
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public long getResourceCount(long ownerId, ResourceOwnerType ownerType, ResourceType type) {
+        ResourceCountVO vo = findByOwnerAndType(ownerId, ownerType, type);
+        if (vo != null) {
+            return vo.getCount();
+        } else {
+            return 0;
+        }
+    }
+
+    @Override 
+    public void setResourceCount(long ownerId, ResourceOwnerType ownerType, ResourceType type, long count) {
+        ResourceCountVO resourceCountVO = findByOwnerAndType(ownerId, ownerType, type);
+        if (count != resourceCountVO.getCount()) {
+            resourceCountVO.setCount(count);
+            update(resourceCountVO.getId(), resourceCountVO);
+        }
+    }
+
+    @Override @Deprecated
+    public void updateDomainCount(long domainId, ResourceType type, boolean increment, long delta) {
+        delta = increment ? delta : delta * -1;
+
+        ResourceCountVO resourceCountVO = findByOwnerAndType(domainId, ResourceOwnerType.Domain, type);
+        resourceCountVO.setCount(resourceCountVO.getCount() + delta);
+        update(resourceCountVO.getId(), resourceCountVO);	
+    }
+
+    @Override
+    public boolean updateById(long id, boolean increment, long delta) {
+        delta = increment ? delta : delta * -1;
+
+        ResourceCountVO resourceCountVO = findById(id);
+        resourceCountVO.setCount(resourceCountVO.getCount() + delta);
+        return update(resourceCountVO.getId(), resourceCountVO);
+    }
+
+    @Override
+    public Set<Long> listRowsToUpdateForDomain(long domainId, ResourceType type) {
+        Set<Long> rowIds = new HashSet<Long>();
+        Set<Long> domainIdsToUpdate = _domainDao.getDomainParentIds(domainId);
+        for (Long domainIdToUpdate : domainIdsToUpdate) {
+            ResourceCountVO domainCountRecord = findByOwnerAndType(domainIdToUpdate, ResourceOwnerType.Domain, type);
+            if (domainCountRecord != null) {
+                rowIds.add(domainCountRecord.getId());
+            }
+        }
+        return rowIds;
+    }
+
+    @Override
+    public Set<Long> listAllRowsToUpdate(long ownerId, ResourceOwnerType ownerType, ResourceType type) {
+        Set<Long> rowIds = new HashSet<Long>();
+
+        if (ownerType == ResourceOwnerType.Account) {
+            //get records for account
+            ResourceCountVO accountCountRecord = findByOwnerAndType(ownerId, ResourceOwnerType.Account, type);
+            if (accountCountRecord != null) {
+                rowIds.add(accountCountRecord.getId());
+            }
+
+            //get records for account's domain and all its parent domains
+            rowIds.addAll(listRowsToUpdateForDomain(_accountDao.findByIdIncludingRemoved(ownerId).getDomainId(),type));
+        } else if (ownerType == ResourceOwnerType.Domain) {
+            return listRowsToUpdateForDomain(ownerId, type);
+        } 
+
+        return rowIds;
+    }
+
+    @Override @DB
+    public void createResourceCounts(long ownerId, ResourceLimit.ResourceOwnerType ownerType){
+
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+
+        ResourceType[] resourceTypes = Resource.ResourceType.values();
+        for (ResourceType resourceType : resourceTypes) {
+            if (!resourceType.supportsOwner(ownerType)) {
+                continue;
+            }
+            ResourceCountVO resourceCountVO = new ResourceCountVO(resourceType, 0, ownerId, ownerType);
+            persist(resourceCountVO);
+        }
+
+        txn.commit();
+    }
+
+    private List<ResourceCountVO> listByDomainId(long domainId) {
+        SearchCriteria<ResourceCountVO> sc = TypeSearch.create();
+        sc.setParameters("domainId", domainId);
+
+        return listBy(sc);
+    }
+
+    private List<ResourceCountVO> listByAccountId(long accountId) {
+        SearchCriteria<ResourceCountVO> sc = TypeSearch.create();
+        sc.setParameters("accountId", accountId);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<ResourceCountVO> listByOwnerId(long ownerId, ResourceOwnerType ownerType) {
+        if (ownerType == ResourceOwnerType.Account) {
+            return listByAccountId(ownerId);
+        } else if (ownerType == ResourceOwnerType.Domain) {
+            return listByDomainId(ownerId);
+        } else {
+            return new ArrayList<ResourceCountVO>();
+        }
+    }
+
+    @Override
+    public List<ResourceCountVO> listResourceCountByOwnerType(ResourceOwnerType ownerType) {
+        if (ownerType == ResourceOwnerType.Account) {
+            return listBy(AccountSearch.create());
+        } else if (ownerType == ResourceOwnerType.Domain) {
+            return listBy(DomainSearch.create());
+        } else {
+            return new ArrayList<ResourceCountVO>();
+        }
+    }
+
+    @Override
+    public ResourceCountVO persist(ResourceCountVO resourceCountVO){
+        ResourceOwnerType ownerType = resourceCountVO.getResourceOwnerType();
+        ResourceType resourceType = resourceCountVO.getType();
+        if (!resourceType.supportsOwner(ownerType)) {
+            throw new UnsupportedServiceException("Resource type " + resourceType + " is not supported for owner of type " + ownerType.getName());
+        }
+
+        return super.persist(resourceCountVO);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDao.java b/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDao.java
new file mode 100644
index 0000000..5fd79b3
--- /dev/null
+++ b/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDao.java
@@ -0,0 +1,35 @@
+// 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.configuration.dao;
+
+import java.util.List;
+
+import com.cloud.configuration.Resource.ResourceOwnerType;
+import com.cloud.configuration.ResourceCount;
+import com.cloud.configuration.ResourceLimitVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface ResourceLimitDao extends GenericDao<ResourceLimitVO, Long> {
+
+    List<ResourceLimitVO> listByOwner(Long ownerId, ResourceOwnerType ownerType);
+
+    boolean update(Long id, Long max);
+
+    ResourceCount.ResourceType getLimitType(String type);
+
+    ResourceLimitVO findByOwnerIdAndType(long ownerId, ResourceOwnerType ownerType, ResourceCount.ResourceType type);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDaoImpl.java b/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDaoImpl.java
new file mode 100644
index 0000000..d337070
--- /dev/null
+++ b/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDaoImpl.java
@@ -0,0 +1,100 @@
+// 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.configuration.dao;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.configuration.Resource;
+import com.cloud.configuration.Resource.ResourceOwnerType;
+import com.cloud.configuration.Resource.ResourceType;
+import com.cloud.configuration.ResourceCount;
+import com.cloud.configuration.ResourceLimitVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value = { ResourceLimitDao.class })
+public class ResourceLimitDaoImpl extends GenericDaoBase<ResourceLimitVO, Long> implements ResourceLimitDao {
+    private SearchBuilder<ResourceLimitVO> IdTypeSearch;
+
+    public ResourceLimitDaoImpl() {
+        IdTypeSearch = createSearchBuilder();
+        IdTypeSearch.and("type", IdTypeSearch.entity().getType(), SearchCriteria.Op.EQ);
+        IdTypeSearch.and("domainId", IdTypeSearch.entity().getDomainId(), SearchCriteria.Op.EQ);
+        IdTypeSearch.and("accountId", IdTypeSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        IdTypeSearch.done();
+    }
+
+    @Override
+    public List<ResourceLimitVO> listByOwner(Long ownerId, ResourceOwnerType ownerType) {
+        SearchCriteria<ResourceLimitVO> sc = IdTypeSearch.create();
+
+        if (ownerType == ResourceOwnerType.Account) {
+            sc.setParameters("accountId", ownerId);
+            return listBy(sc);
+        } else if (ownerType == ResourceOwnerType.Domain) {
+            sc.setParameters("domainId", ownerId);
+            return listBy(sc);
+        } else {
+            return new ArrayList<ResourceLimitVO>();
+        }
+    }
+
+    @Override
+    public boolean update(Long id, Long max) {
+        ResourceLimitVO limit = findById(id);
+        if (max != null)
+            limit.setMax(max);
+        else
+            limit.setMax(new Long(-1));
+        return update(id, limit);
+    }
+
+    @Override
+    public ResourceCount.ResourceType getLimitType(String type) {
+        ResourceType[] validTypes = Resource.ResourceType.values();
+
+        for (ResourceType validType : validTypes) {
+            if (validType.getName().equals(type)) {
+                return validType;
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public ResourceLimitVO findByOwnerIdAndType(long ownerId, ResourceOwnerType ownerType, ResourceCount.ResourceType type) {
+        SearchCriteria<ResourceLimitVO> sc = IdTypeSearch.create();
+        sc.setParameters("type", type);
+
+        if (ownerType == ResourceOwnerType.Account) {
+            sc.setParameters("accountId", ownerId);
+            return findOneBy(sc);
+        } else if (ownerType == ResourceOwnerType.Domain) {
+            sc.setParameters("domainId", ownerId);
+            return findOneBy(sc);
+        } else {
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/AccountVlanMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/AccountVlanMapVO.java b/engine/schema/src/com/cloud/dc/AccountVlanMapVO.java
new file mode 100644
index 0000000..b1bf919
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/AccountVlanMapVO.java
@@ -0,0 +1,65 @@
+// 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.dc;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.user.OwnedBy;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="account_vlan_map")
+public class AccountVlanMapVO implements OwnedBy, InternalIdentity {
+	    
+	@Id
+	@GeneratedValue(strategy=GenerationType.IDENTITY)
+	@Column(name="id")
+	private long id;
+	
+	@Column(name="account_id")
+	private long accountId;
+	
+	@Column(name="vlan_db_id")
+	private long vlanDbId;
+	
+	public AccountVlanMapVO(long accountId, long vlanDbId) {
+		this.accountId = accountId;
+		this.vlanDbId = vlanDbId;
+	}
+	
+	public AccountVlanMapVO() {
+		
+	}
+	
+	public long getId() {
+		return id;
+	}
+
+	@Override
+	public long getAccountId() {
+		return accountId;
+	}
+	
+	public long getVlanDbId() {
+		return vlanDbId;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/ClusterDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/ClusterDetailsDao.java b/engine/schema/src/com/cloud/dc/ClusterDetailsDao.java
new file mode 100644
index 0000000..2c7e241
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/ClusterDetailsDao.java
@@ -0,0 +1,32 @@
+// 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.dc;
+
+import java.util.Map;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface ClusterDetailsDao extends GenericDao<ClusterDetailsVO, Long> {
+    Map<String, String> findDetails(long clusterId);
+    
+    void persist(long clusterId, Map<String, String> details);
+    void persist(long clusterId, String name, String value);
+    
+    ClusterDetailsVO findDetail(long clusterId, String name);
+
+	void deleteDetails(long clusterId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/ClusterDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/ClusterDetailsDaoImpl.java b/engine/schema/src/com/cloud/dc/ClusterDetailsDaoImpl.java
new file mode 100755
index 0000000..d14e0e4
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/ClusterDetailsDaoImpl.java
@@ -0,0 +1,133 @@
+// 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.dc;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.crypt.DBEncryptionUtil;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value=ClusterDetailsDao.class)
+public class ClusterDetailsDaoImpl extends GenericDaoBase<ClusterDetailsVO, Long> implements ClusterDetailsDao {
+    protected final SearchBuilder<ClusterDetailsVO> ClusterSearch;
+    protected final SearchBuilder<ClusterDetailsVO> DetailSearch;
+
+    protected ClusterDetailsDaoImpl() {
+        ClusterSearch = createSearchBuilder();
+        ClusterSearch.and("clusterId", ClusterSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
+        ClusterSearch.done();
+
+        DetailSearch = createSearchBuilder();
+        DetailSearch.and("clusterId", DetailSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
+        DetailSearch.and("name", DetailSearch.entity().getName(), SearchCriteria.Op.EQ);
+        DetailSearch.done();
+    }
+
+    @Override
+    public ClusterDetailsVO findDetail(long clusterId, String name) {
+        SearchCriteria<ClusterDetailsVO> sc = DetailSearch.create();
+        // This is temporary fix to support list/update configuration api for cpu and memory overprovisioning ratios
+        if(name.equalsIgnoreCase("cpu.overprovisioning.factor")) {
+            name = "cpuOvercommitRatio";
+        }
+        if (name.equalsIgnoreCase("mem.overprovisioning.factor")) {
+            name = "memoryOvercommitRatio";
+        }
+        sc.setParameters("clusterId", clusterId);
+        sc.setParameters("name", name);
+
+
+        ClusterDetailsVO detail = findOneIncludingRemovedBy(sc);
+        if("password".equals(name) && detail != null){
+            detail.setValue(DBEncryptionUtil.decrypt(detail.getValue()));
+        }
+        return detail;
+    }
+
+
+    @Override
+    public Map<String, String> findDetails(long clusterId) {
+        SearchCriteria<ClusterDetailsVO> sc = ClusterSearch.create();
+        sc.setParameters("clusterId", clusterId);
+
+        List<ClusterDetailsVO> results = search(sc, null);
+        Map<String, String> details = new HashMap<String, String>(results.size());
+        for (ClusterDetailsVO result : results) {
+            if("password".equals(result.getName())){
+                details.put(result.getName(), DBEncryptionUtil.decrypt(result.getValue()));
+            } else {
+                details.put(result.getName(), result.getValue());
+            }
+        }
+        return details;
+    }
+
+    @Override
+    public void deleteDetails(long clusterId) {
+        SearchCriteria sc = ClusterSearch.create();
+        sc.setParameters("clusterId", clusterId);
+
+        List<ClusterDetailsVO> results = search(sc, null);
+        for (ClusterDetailsVO result : results) {
+            remove(result.getId());
+        }
+    }
+
+    @Override
+    public void persist(long clusterId, Map<String, String> details) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        SearchCriteria<ClusterDetailsVO> sc = ClusterSearch.create();
+        sc.setParameters("clusterId", clusterId);
+        expunge(sc);
+
+        for (Map.Entry<String, String> detail : details.entrySet()) {
+            String value = detail.getValue();
+            if("password".equals(detail.getKey())){
+                value = DBEncryptionUtil.encrypt(value);
+            }
+            ClusterDetailsVO vo = new ClusterDetailsVO(clusterId, detail.getKey(), value);
+            persist(vo);
+        }
+        txn.commit();
+    }
+
+    @Override
+    public void persist(long clusterId, String name, String value) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        SearchCriteria<ClusterDetailsVO> sc = DetailSearch.create();
+        sc.setParameters("clusterId", clusterId);
+        sc.setParameters("name", name);
+        expunge(sc);
+
+        ClusterDetailsVO vo = new ClusterDetailsVO(clusterId, name, value);
+        persist(vo);
+        txn.commit();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/ClusterDetailsVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/ClusterDetailsVO.java b/engine/schema/src/com/cloud/dc/ClusterDetailsVO.java
new file mode 100644
index 0000000..11a5525
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/ClusterDetailsVO.java
@@ -0,0 +1,74 @@
+// 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.dc;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="cluster_details")
+public class ClusterDetailsVO implements InternalIdentity {
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+    @Column(name="cluster_id")
+    private long clusterId;
+    
+    @Column(name="name")
+    private String name;
+    
+    @Column(name="value")
+    private String value;
+    
+    protected ClusterDetailsVO() {
+    }
+    
+    public ClusterDetailsVO(long clusterId, String name, String value) {
+        this.clusterId = clusterId;
+        this.name = name;
+        this.value = value;
+    }
+
+    public long getClusterId() {
+        return clusterId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public long getId() {
+        return id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/ClusterVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/ClusterVO.java b/engine/schema/src/com/cloud/dc/ClusterVO.java
new file mode 100644
index 0000000..4195b74
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/ClusterVO.java
@@ -0,0 +1,189 @@
+// 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.dc;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.org.Cluster;
+import com.cloud.org.Managed.ManagedState;
+import com.cloud.org.Grouping;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="cluster")
+public class ClusterVO implements Cluster {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+
+    @Column(name="name")
+    String name;
+
+    @Column(name="guid")
+    String guid;
+
+    @Column(name="data_center_id")
+    long dataCenterId;
+
+    @Column(name="pod_id")
+    long podId;
+
+    @Column(name="hypervisor_type")
+    String hypervisorType;
+
+    @Column(name="cluster_type")
+    @Enumerated(value=EnumType.STRING)
+    Cluster.ClusterType clusterType;
+
+    @Column(name="allocation_state")
+    @Enumerated(value=EnumType.STRING)
+    AllocationState allocationState;
+
+    @Column(name="managed_state")
+    @Enumerated(value=EnumType.STRING)
+    ManagedState managedState;
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+
+    @Column(name="uuid")
+    String uuid;
+
+    public ClusterVO() {
+    	clusterType = Cluster.ClusterType.CloudManaged;
+    	allocationState = Grouping.AllocationState.Enabled;
+
+    	this.uuid = UUID.randomUUID().toString();
+    }
+
+    public ClusterVO(long dataCenterId, long podId, String name) {
+        this.dataCenterId = dataCenterId;
+        this.podId = podId;
+        this.name = name;
+    	this.clusterType = Cluster.ClusterType.CloudManaged;
+    	this.allocationState = Grouping.AllocationState.Enabled;
+    	this.managedState = ManagedState.Managed;
+    	this.uuid = UUID.randomUUID().toString();
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public long getDataCenterId() {
+        return dataCenterId;
+    }
+
+    public long getPodId() {
+        return podId;
+    }
+
+    public Cluster.ClusterType getClusterType() {
+    	return clusterType;
+    }
+
+    public void setClusterType(Cluster.ClusterType clusterType) {
+    	this.clusterType = clusterType;
+    }
+
+    public AllocationState getAllocationState() {
+    	return allocationState;
+    }
+
+    public void setAllocationState(AllocationState allocationState) {
+		this.allocationState = allocationState;
+    }
+
+    public ManagedState getManagedState() {
+        return managedState;
+    }
+
+    public void setManagedState(ManagedState managedState) {
+        this.managedState = managedState;
+    }
+
+    public ClusterVO(long clusterId) {
+        this.id = clusterId;
+    }
+
+    @Override
+    public int hashCode() {
+        return NumbersUtil.hash(id);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof ClusterVO)) {
+            return false;
+        }
+        ClusterVO that = (ClusterVO)obj;
+        return this.id == that.id;
+    }
+
+    public HypervisorType getHypervisorType() {
+    	return HypervisorType.getType(hypervisorType);
+    }
+
+	public void setHypervisorType(String hy) {
+    	hypervisorType = hy;
+    }
+
+    public String getGuid() {
+        return guid;
+    }
+
+    public void setGuid(String guid) {
+        this.guid = guid;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/ClusterVSMMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/ClusterVSMMapVO.java b/engine/schema/src/com/cloud/dc/ClusterVSMMapVO.java
new file mode 100644
index 0000000..a7fe748
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/ClusterVSMMapVO.java
@@ -0,0 +1,62 @@
+// 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.dc;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+
+// NOTE: This particular table is totally internal to the CS MS.
+// Do not ever include a uuid/guid field in this table. We just
+// need it map cluster Ids with Cisco Nexus VSM Ids.
+
+@Entity
+@Table(name="cluster_vsm_map")
+public class ClusterVSMMapVO {
+
+    @Column(name="cluster_id")
+    long clusterId;
+    
+    @Column(name="vsm_id")
+    long vsmId;
+    
+    public ClusterVSMMapVO(long clusterId, long vsmId) {
+        this.clusterId = clusterId;
+        this.vsmId = vsmId;
+    }
+    
+    public ClusterVSMMapVO() {
+    	// Do nothing.
+    }  
+
+    public long getClusterId() {
+        return clusterId;
+    }
+
+    public long getVsmId() {
+        return vsmId;
+    }
+    
+    public void setClusterId(long clusterId) {
+        this.clusterId = clusterId;
+    }
+
+    public void setVsmId(long vsmId) {
+        this.vsmId = vsmId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/DataCenterIpAddressVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/DataCenterIpAddressVO.java b/engine/schema/src/com/cloud/dc/DataCenterIpAddressVO.java
new file mode 100755
index 0000000..d92227f
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/DataCenterIpAddressVO.java
@@ -0,0 +1,115 @@
+// 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.dc;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity
+@Table(name="op_dc_ip_address_alloc")
+public class DataCenterIpAddressVO implements InternalIdentity {
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+    
+    @Column(name="ip_address", updatable=false, nullable=false)
+    String ipAddress;
+    
+    @Column(name="taken")
+    @Temporal(value=TemporalType.TIMESTAMP)
+    private Date takenAt;
+    
+    @Column(name="data_center_id", updatable=false, nullable=false)
+    private long dataCenterId;
+    
+    @Column(name="pod_id", updatable=false, nullable=false)
+    private long podId;
+    
+    @Column(name="reservation_id")
+    String reservationId;
+    
+    @Column(name="nic_id")
+    private Long instanceId;
+    
+    @Column(name="mac_address")
+    long macAddress;
+    
+    protected DataCenterIpAddressVO() {
+    }
+    
+    public String getReservationId() {
+        return reservationId;
+    }
+
+    public void setReservationId(String reservationId) {
+        this.reservationId = reservationId;
+    }
+
+	public DataCenterIpAddressVO(String ipAddress, long dataCenterId, long podId) {
+        this.ipAddress = ipAddress;
+        this.dataCenterId = dataCenterId;
+        this.podId = podId;
+    }
+    
+    public long getId() {
+        return id;
+    }
+    
+    public Long getInstanceId() {
+    	return instanceId;
+    }
+    
+    public void setInstanceId(Long instanceId) {
+    	this.instanceId = instanceId;
+    }
+
+    public long getPodId() {
+        return podId;
+    }
+
+    public void setTakenAt(Date takenDate) {
+        this.takenAt = takenDate;
+    }
+
+    public String getIpAddress() {
+        return ipAddress;
+    }
+    
+    public long getDataCenterId() {
+        return dataCenterId;
+    }
+
+    public Date getTakenAt() {
+        return takenAt;
+    }
+    
+    public long getMacAddress() {
+        return macAddress;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/DataCenterLinkLocalIpAddressVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/DataCenterLinkLocalIpAddressVO.java b/engine/schema/src/com/cloud/dc/DataCenterLinkLocalIpAddressVO.java
new file mode 100644
index 0000000..ffa7549
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/DataCenterLinkLocalIpAddressVO.java
@@ -0,0 +1,108 @@
+// 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.dc;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity
+@Table(name="op_dc_link_local_ip_address_alloc")
+public class DataCenterLinkLocalIpAddressVO implements InternalIdentity {
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+    
+    @Column(name="ip_address", updatable=false, nullable=false)
+    String ipAddress;
+    
+    @Column(name="taken")
+    @Temporal(value=TemporalType.TIMESTAMP)
+    private Date takenAt;
+    
+    @Column(name="data_center_id", updatable=false, nullable=false)
+    private long dataCenterId;
+    
+    @Column(name="pod_id", updatable=false, nullable=false)
+    private long podId;
+    
+    @Column(name="nic_id")
+    private Long instanceId;
+    
+    @Column(name="reservation_id")
+    private String reservationId;
+    
+    protected DataCenterLinkLocalIpAddressVO() {
+    }
+    
+    public DataCenterLinkLocalIpAddressVO(String ipAddress, long dataCenterId, long podId) {
+        this.ipAddress = ipAddress;
+        this.dataCenterId = dataCenterId;
+        this.podId = podId;
+    }
+    
+    public long getId() {
+        return id;
+    }
+    
+    public Long getInstanceId() {
+    	return instanceId;
+    }
+    
+    public void setInstanceId(Long instanceId) {
+    	this.instanceId = instanceId;
+    }
+
+    public long getPodId() {
+        return podId;
+    }
+
+    public void setTakenAt(Date takenDate) {
+        this.takenAt = takenDate;
+    }
+    
+    public void setReservationId(String reservationId) {
+        this.reservationId = reservationId;
+    }
+    
+    public String getReservationId() {
+        return reservationId;
+    }
+
+    public String getIpAddress() {
+        return ipAddress;
+    }
+    
+    public long getDataCenterId() {
+        return dataCenterId;
+    }
+
+    public Date getTakenAt() {
+        return takenAt;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/DataCenterVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/DataCenterVO.java b/engine/schema/src/com/cloud/dc/DataCenterVO.java
new file mode 100644
index 0000000..6da13e7
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/DataCenterVO.java
@@ -0,0 +1,460 @@
+// 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.dc;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+import javax.persistence.Transient;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.network.Network.Provider;
+import com.cloud.org.Grouping;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="data_center")
+public class DataCenterVO implements DataCenter {
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+	@Column(name="name")
+	private String name = null;
+
+    @Column(name="description")
+    private String description = null;
+
+    @Column(name="dns1")
+    private String dns1 = null;
+
+    @Column(name="dns2")
+    private String dns2 = null;
+
+    @Column(name="ip6_dns1")
+    private String ip6Dns1 = null;
+
+    @Column(name="ip6_dns2")
+    private String ip6Dns2 = null;
+
+    @Column(name="internal_dns1")
+    private String internalDns1 = null;
+
+    @Column(name="internal_dns2")
+    private String internalDns2 = null;
+
+    @Column(name="router_mac_address", updatable = false, nullable=false)
+    private String routerMacAddress = "02:00:00:00:00:01";
+
+    @Column(name="guest_network_cidr")
+    private String guestNetworkCidr = null;
+
+    @Column(name="domain_id")
+    private Long domainId = null;
+
+    @Column(name="domain")
+    private String domain;
+
+    @Column(name="networktype")
+    @Enumerated(EnumType.STRING)
+    NetworkType networkType;
+
+    @Column(name="dns_provider")
+    private String dnsProvider;
+
+    @Column(name="dhcp_provider")
+    private String dhcpProvider;
+
+    @Column(name="gateway_provider")
+    private String gatewayProvider;
+
+    @Column(name="vpn_provider")
+    private String vpnProvider;
+
+    @Column(name="userdata_provider")
+    private String userDataProvider;
+
+    @Column(name="lb_provider")
+    private String loadBalancerProvider;
+
+    @Column(name="firewall_provider")
+    private String firewallProvider;
+
+    @Column(name="mac_address", nullable=false)
+    @TableGenerator(name="mac_address_sq", table="data_center", pkColumnName="id", valueColumnName="mac_address", allocationSize=1)
+    private long macAddress = 1;
+
+	@Column(name="zone_token")
+	private String zoneToken;
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+
+    // This is a delayed load value.  If the value is null,
+    // then this field has not been loaded yet.
+    // Call the dao to load it.
+    @Transient
+    Map<String, String> details;
+
+    @Column(name="allocation_state")
+    @Enumerated(value=EnumType.STRING)
+    AllocationState allocationState;
+
+	@Column(name="uuid")
+	private String uuid;
+
+    @Column(name="is_security_group_enabled")
+    boolean securityGroupEnabled;
+
+    @Column(name="is_local_storage_enabled")
+    boolean localStorageEnabled;
+
+    @Override
+    public String getDnsProvider() {
+        return dnsProvider;
+    }
+
+    public void setDnsProvider(String dnsProvider) {
+        this.dnsProvider = dnsProvider;
+    }
+
+    @Override
+    public String getDhcpProvider() {
+        return dhcpProvider;
+    }
+
+    public void setDhcpProvider(String dhcpProvider) {
+        this.dhcpProvider = dhcpProvider;
+    }
+
+    @Override
+    public String getGatewayProvider() {
+        return gatewayProvider;
+    }
+
+    public void setGatewayProvider(String gatewayProvider) {
+        this.gatewayProvider = gatewayProvider;
+    }
+
+    @Override
+    public String getLoadBalancerProvider() {
+        return loadBalancerProvider;
+    }
+
+    public void setLoadBalancerProvider(String loadBalancerProvider) {
+        this.loadBalancerProvider = loadBalancerProvider;
+    }
+
+    @Override
+    public String getFirewallProvider() {
+        return firewallProvider;
+    }
+
+    public void setFirewallProvider(String firewallProvider) {
+        this.firewallProvider = firewallProvider;
+    }
+
+    public DataCenterVO(long id, String name, String description, String dns1, String dns2, String dns3, String dns4, String guestCidr, String domain, Long domainId, NetworkType zoneType, String zoneToken, String domainSuffix) {
+        this(name, description, dns1, dns2, dns3, dns4, guestCidr, domain, domainId, zoneType, zoneToken, domainSuffix, false, false, null, null);
+        this.id = id;
+        this.allocationState = Grouping.AllocationState.Enabled;
+        this.uuid = UUID.randomUUID().toString();
+	}
+
+    public DataCenterVO(String name, String description, String dns1, String dns2, String dns3, String dns4, String guestCidr, String domain, Long domainId, NetworkType zoneType, String zoneToken, String domainSuffix, boolean securityGroupEnabled, boolean localStorageEnabled, String ip6Dns1, String ip6Dns2) {
+        this.name = name;
+        this.description = description;
+        this.dns1 = dns1;
+        this.dns2 = dns2;
+        this.ip6Dns1 = ip6Dns1;
+        this.ip6Dns2 = ip6Dns2;
+        this.internalDns1 = dns3;
+        this.internalDns2 = dns4;
+        this.guestNetworkCidr = guestCidr;
+        this.domain = domain;
+        this.domainId = domainId;
+        this.networkType = zoneType;
+        this.allocationState = Grouping.AllocationState.Enabled;
+        this.securityGroupEnabled = securityGroupEnabled;
+        this.localStorageEnabled = localStorageEnabled;
+
+        if (zoneType == NetworkType.Advanced) {
+            loadBalancerProvider = Provider.VirtualRouter.getName();
+            firewallProvider = Provider.VirtualRouter.getName();
+            dhcpProvider = Provider.VirtualRouter.getName();
+            dnsProvider = Provider.VirtualRouter.getName();
+            gatewayProvider = Provider.VirtualRouter.getName();
+            vpnProvider = Provider.VirtualRouter.getName();
+            userDataProvider = Provider.VirtualRouter.getName();
+        } else if (zoneType == NetworkType.Basic){
+            dhcpProvider = Provider.VirtualRouter.getName();
+            dnsProvider = Provider.VirtualRouter.getName();
+            userDataProvider = Provider.VirtualRouter.getName();
+            loadBalancerProvider = Provider.ElasticLoadBalancerVm.getName();
+        }
+
+        this.zoneToken = zoneToken;
+        this.domain = domainSuffix;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    @Override
+    public String getVpnProvider() {
+        return vpnProvider;
+    }
+
+    public void setVpnProvider(String vpnProvider) {
+        this.vpnProvider = vpnProvider;
+    }
+
+    @Override
+    public String getUserDataProvider() {
+        return userDataProvider;
+    }
+
+    public void setUserDataProvider(String userDataProvider) {
+        this.userDataProvider = userDataProvider;
+    }
+
+    @Override
+    public String getGuestNetworkCidr()
+    {
+    	return guestNetworkCidr;
+    }
+
+    public void setGuestNetworkCidr(String guestNetworkCidr)
+    {
+    	this.guestNetworkCidr = guestNetworkCidr;
+    }
+
+    @Override
+    public Long getDomainId() {
+		return domainId;
+	}
+
+	public void setDomainId(Long domainId) {
+		this.domainId = domainId;
+	}
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    public String getRouterMacAddress() {
+        return routerMacAddress;
+    }
+
+    @Override
+    public String getDns1() {
+        return dns1;
+    }
+
+    @Override
+    public String getDns2() {
+        return dns2;
+    }
+
+    @Override
+    public String getInternalDns1() {
+        return internalDns1;
+    }
+
+    @Override
+    public String getInternalDns2() {
+        return internalDns2;
+    }
+
+	protected DataCenterVO() {
+    }
+
+	@Override
+    public long getId() {
+		return id;
+	}
+
+	@Override
+    public String getName() {
+	    return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public void setDns1(String dns1) {
+		this.dns1 = dns1;
+	}
+
+	public void setDns2(String dns2) {
+		this.dns2 = dns2;
+	}
+
+	public void setInternalDns1(String dns3) {
+		this.internalDns1 = dns3;
+	}
+
+	public void setInternalDns2(String dns4) {
+		this.internalDns2 = dns4;
+	}
+
+    public void setRouterMacAddress(String routerMacAddress) {
+        this.routerMacAddress = routerMacAddress;
+    }
+
+    @Override
+    public String getDomain() {
+        return domain;
+    }
+
+    public void setDomain(String domain) {
+        this.domain = domain;
+    }
+
+    public void setNetworkType(NetworkType zoneNetworkType) {
+        this.networkType = zoneNetworkType;
+    }
+
+    @Override
+    public NetworkType getNetworkType() {
+        return networkType;
+    }
+
+    @Override
+    public boolean isSecurityGroupEnabled() {
+        return securityGroupEnabled;
+    }
+
+    public void setSecurityGroupEnabled(boolean enabled) {
+        this.securityGroupEnabled = enabled;
+    }
+
+    @Override
+    public boolean isLocalStorageEnabled() {
+        return localStorageEnabled;
+    }
+
+    public void setLocalStorageEnabled(boolean enabled) {
+        this.localStorageEnabled = enabled;
+    }
+
+    @Override
+    public Map<String, String> getDetails() {
+        return details;
+    }
+
+    @Override
+    public void setDetails(Map<String, String> details2) {
+        details = details2;
+    }
+
+    public String getDetail(String name) {
+        assert (details != null) : "Did you forget to load the details?";
+
+        return details != null ? details.get(name) : null;
+    }
+
+    public void setDetail(String name, String value) {
+        assert (details != null) : "Did you forget to load the details?";
+
+        details.put(name, value);
+    }
+
+    public AllocationState getAllocationState() {
+    	return allocationState;
+    }
+
+    public void setAllocationState(AllocationState allocationState) {
+		this.allocationState = allocationState;
+    }
+
+    @Override
+    public int hashCode() {
+        return NumbersUtil.hash(id);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof DataCenterVO)) {
+            return false;
+        }
+        DataCenterVO that = (DataCenterVO)obj;
+        return this.id == that.id;
+    }
+
+    @Override
+    public String getZoneToken() {
+ 	    return zoneToken;
+ 	}
+
+ 	public void setZoneToken(String zoneToken) {
+ 		this.zoneToken = zoneToken;
+ 	}
+
+ 	public Date getRemoved() {
+ 	    return removed;
+ 	}
+
+ 	@Override
+ 	public String getUuid() {
+ 		return this.uuid;
+ 	}
+
+ 	public void setUuid(String uuid) {
+ 		this.uuid = uuid;
+ 	}
+
+    public long getMacAddress() {
+        return macAddress;
+    }
+
+    public void setMacAddress(long macAddress) {
+        this.macAddress = macAddress;
+    }
+
+ 	@Override
+	public String getIp6Dns1() {
+		return ip6Dns1;
+	}
+
+	public void setIp6Dns1(String ip6Dns1) {
+		this.ip6Dns1 = ip6Dns1;
+	}
+
+ 	@Override
+	public String getIp6Dns2() {
+		return ip6Dns2;
+	}
+
+	public void setIp6Dns2(String ip6Dns2) {
+		this.ip6Dns2 = ip6Dns2;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/DataCenterVnetVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/DataCenterVnetVO.java b/engine/schema/src/com/cloud/dc/DataCenterVnetVO.java
new file mode 100755
index 0000000..9bae132
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/DataCenterVnetVO.java
@@ -0,0 +1,120 @@
+// 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.dc;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity
+@Table(name="op_dc_vnet_alloc")
+public class DataCenterVnetVO implements InternalIdentity {
+    
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+    
+    @Column(name="taken", nullable=true)
+    @Temporal(value=TemporalType.TIMESTAMP)
+    Date takenAt;
+
+    @Column(name="vnet", updatable=false, nullable=false)
+    protected String vnet;
+
+    @Column(name="physical_network_id", updatable=false, nullable=false)
+    protected long physicalNetworkId;
+
+    @Column(name="data_center_id", updatable=false, nullable=false)
+    protected long dataCenterId;
+
+    @Column(name="account_id")
+    protected Long accountId;
+    
+    @Column(name="reservation_id")
+    protected String reservationId;
+
+    @Column(name="account_vnet_map_id")
+    protected Long accountGuestVlanMapId;
+    
+    public Date getTakenAt() {
+        return takenAt;
+    }
+
+    public void setTakenAt(Date taken) {
+        this.takenAt = taken;
+    }
+
+    public DataCenterVnetVO(String vnet, long dcId, long physicalNetworkId) {
+        this.vnet = vnet;
+        this.dataCenterId = dcId;
+        this.physicalNetworkId = physicalNetworkId;
+        this.takenAt = null;
+    }
+    
+    public long getId() {
+        return id;
+    }
+    
+    public String getVnet() {
+        return vnet;
+    }
+    
+    public String getReservationId() {
+        return reservationId;
+    }
+    
+    public void setReservationId(String reservationId) {
+        this.reservationId = reservationId;
+    }
+    
+    public Long getAccountId() {
+    	return accountId;
+    }
+    
+    public void setAccountId(Long accountId) {
+    	this.accountId = accountId;
+    }
+    
+    public long getDataCenterId() {
+        return dataCenterId;
+    }
+
+    public long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public void setAccountGuestVlanMapId(Long accountGuestVlanMapId) {
+        this.accountGuestVlanMapId = accountGuestVlanMapId;
+    }
+
+    public Long getAccountGuestVlanMapId() {
+        return accountGuestVlanMapId;
+    }
+    
+    protected DataCenterVnetVO() {
+    }
+}


[03/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/VMTemplateStoragePoolVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/VMTemplateStoragePoolVO.java b/engine/schema/src/com/cloud/storage/VMTemplateStoragePoolVO.java
new file mode 100644
index 0000000..9b76176
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/VMTemplateStoragePoolVO.java
@@ -0,0 +1,275 @@
+// 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.storage;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
+import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.State;
+
+import com.cloud.utils.db.GenericDaoBase;
+
+/**
+ * Join table for storage pools and templates
+ *
+ */
+@Entity
+@Table(name="template_spool_ref")
+public class VMTemplateStoragePoolVO implements VMTemplateStorageResourceAssoc, DataObjectInStore {
+	@Id
+	@GeneratedValue(strategy=GenerationType.IDENTITY)
+	long id;
+	
+	@Column(name="pool_id")
+	private long poolId;
+	
+	@Column(name="template_id") long templateId;
+	
+	@Column(name=GenericDaoBase.CREATED_COLUMN) Date created = null;
+	
+	@Column(name="last_updated")
+	@Temporal(value=TemporalType.TIMESTAMP) Date lastUpdated = null;
+	
+	@Column (name="download_pct") int downloadPercent;
+	
+	@Column (name="download_state")
+	@Enumerated(EnumType.STRING) Status downloadState;
+	
+	@Column (name="local_path") String localDownloadPath;
+	
+	@Column (name="error_str") String errorString;
+	
+	@Column (name="job_id") String jobId;
+	
+	@Column (name="install_path") String installPath;
+	
+	@Column (name="template_size") long templateSize;
+	
+	@Column (name="marked_for_gc") boolean markedForGC;
+
+	@Column(name="update_count", updatable = true, nullable=false)
+	protected long updatedCount;
+
+	@Column(name = "updated")
+	@Temporal(value = TemporalType.TIMESTAMP)
+	Date updated;
+
+	@Column(name = "state")
+	@Enumerated(EnumType.STRING)
+	ObjectInDataStoreStateMachine.State state;
+
+	@Override
+    public String getInstallPath() {
+		return installPath;
+	}
+	
+	@Override
+    public long getTemplateSize() {
+		return templateSize;
+	}
+
+	public long getPoolId() {
+		return poolId;
+	}
+
+	public void setpoolId(long poolId) {
+		this.poolId = poolId;
+	}
+
+	@Override
+    public long getTemplateId() {
+		return templateId;
+	}
+
+	@Override
+    public void setTemplateId(long templateId) {
+		this.templateId = templateId;
+	}
+
+	@Override
+    public int getDownloadPercent() {
+		return downloadPercent;
+	}
+
+	@Override
+    public void setDownloadPercent(int downloadPercent) {
+		this.downloadPercent = downloadPercent;
+	}
+
+	@Override
+    public void setDownloadState(Status downloadState) {
+		this.downloadState = downloadState;
+	}
+
+	@Override
+    public long getId() {
+		return id;
+	}
+
+	@Override
+    public Date getCreated() {
+		return created;
+	}
+
+	@Override
+    public Date getLastUpdated() {
+		return lastUpdated;
+	}
+	
+	@Override
+    public void setLastUpdated(Date date) {
+	    lastUpdated = date;
+	}
+	
+	@Override
+    public void setInstallPath(String installPath) {
+	    this.installPath = installPath;
+	}
+
+	@Override
+    public Status getDownloadState() {
+		return downloadState;
+	}
+
+	public VMTemplateStoragePoolVO(long poolId, long templateId) {
+		super();
+		this.poolId = poolId;
+		this.templateId = templateId;
+		this.downloadState = Status.NOT_DOWNLOADED;
+		this.state = ObjectInDataStoreStateMachine.State.Allocated;
+		this.markedForGC = false;
+	}
+
+	public VMTemplateStoragePoolVO(long poolId, long templateId, Date lastUpdated,
+			int downloadPercent, Status downloadState,
+			String localDownloadPath, String errorString, String jobId,
+			String installPath, long templateSize) {
+		super();
+		this.poolId = poolId;
+		this.templateId = templateId;
+		this.lastUpdated = lastUpdated;
+		this.downloadPercent = downloadPercent;
+		this.downloadState = downloadState;
+		this.localDownloadPath = localDownloadPath;
+		this.errorString = errorString;
+		this.jobId = jobId;
+		this.installPath = installPath;
+		this.templateSize = templateSize;
+	}
+
+	protected VMTemplateStoragePoolVO() {
+		
+	}
+
+	@Override
+    public void setLocalDownloadPath(String localPath) {
+		this.localDownloadPath = localPath;
+	}
+
+	@Override
+    public String getLocalDownloadPath() {
+		return localDownloadPath;
+	}
+
+	@Override
+    public void setErrorString(String errorString) {
+		this.errorString = errorString;
+	}
+
+	@Override
+    public String getErrorString() {
+		return errorString;
+	}
+
+	@Override
+    public void setJobId(String jobId) {
+		this.jobId = jobId;
+	}
+
+	@Override
+    public String getJobId() {
+		return jobId;
+	}
+	
+	public void setTemplateSize(long templateSize) {
+		this.templateSize = templateSize;
+	}
+	
+	public boolean getMarkedForGC() {
+		return markedForGC;
+	}
+	
+	public void setMarkedForGC(boolean markedForGC) {
+		this.markedForGC = markedForGC;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (obj instanceof VMTemplateStoragePoolVO) {
+		   VMTemplateStoragePoolVO other = (VMTemplateStoragePoolVO)obj;
+		   return (this.templateId==other.getTemplateId() && this.poolId==other.getPoolId());
+		}
+		return false;
+	}
+
+	@Override
+	public int hashCode() {
+		Long tid = new Long(templateId);
+		Long hid = new Long(poolId);
+		return tid.hashCode()+hid.hashCode();
+	}
+	
+	@Override
+    public String toString() {
+	    return new StringBuilder("TmplPool[").append(id).append("-").append(templateId).append("-").append("poolId").append("-").append(installPath).append("]").toString();
+	}
+
+    @Override
+    public State getState() {
+        return this.state;
+    }
+    
+    public long getUpdatedCount() {
+        return this.updatedCount;
+    }
+    
+    public void incrUpdatedCount() {
+        this.updatedCount++;
+    }
+
+    public void decrUpdatedCount() {
+        this.updatedCount--;
+    }
+    
+    public Date getUpdated() {
+        return updated;
+    }
+    
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/VMTemplateSwiftVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/VMTemplateSwiftVO.java b/engine/schema/src/com/cloud/storage/VMTemplateSwiftVO.java
new file mode 100755
index 0000000..6c7a73d
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/VMTemplateSwiftVO.java
@@ -0,0 +1,107 @@
+// 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.storage;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.utils.db.GenericDaoBase;
+import org.apache.cloudstack.api.InternalIdentity;
+
+/**
+ * Join table for swift and templates
+ * 
+ * 
+ */
+@Entity
+@Table(name = "template_swift_ref")
+public class VMTemplateSwiftVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    Long id;
+
+    @Column(name = "swift_id")
+    private long swiftId;
+
+    @Column(name = "template_id")
+    private long templateId;
+
+    @Column(name = GenericDaoBase.CREATED_COLUMN)
+    private Date created = null;
+
+    @Column(name = "path")
+    private String path;
+
+    @Column(name = "size")
+    private long size;
+
+    @Column(name = "physical_size")
+    private long physicalSize;
+
+    public VMTemplateSwiftVO(long swiftId, long templateId, Date created, String path, long size, long physicalSize) {
+        this.swiftId = swiftId;
+        this.templateId = templateId;
+        this.created = created;
+        this.path = path;
+        this.size = size;
+        this.physicalSize = physicalSize;
+    }
+
+    protected VMTemplateSwiftVO() {
+
+    }
+
+    public long getTemplateId() {
+        return templateId;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public String getPath() {
+        return path;
+    }
+
+    public long getSwiftId() {
+        return swiftId;
+    }
+
+    public long getSize() {
+        return size;
+    }
+
+    public long getPhysicalSize() {
+        return physicalSize;
+    }
+
+    @Override
+    public String toString() {
+        return new StringBuilder("TmplSwift[").append(id).append("-").append(templateId).append("-").append(swiftId).append("]").toString();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/VMTemplateVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/VMTemplateVO.java b/engine/schema/src/com/cloud/storage/VMTemplateVO.java
new file mode 100755
index 0000000..e643d75
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/VMTemplateVO.java
@@ -0,0 +1,534 @@
+// 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.storage;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.storage.Storage.TemplateType;
+import com.cloud.template.VirtualMachineTemplate;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.fsm.StateObject;
+
+@Entity
+@Table(name="vm_template")
+public class VMTemplateVO implements VirtualMachineTemplate, StateObject<TemplateState> {
+    @Id
+    @TableGenerator(name="vm_template_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="vm_template_seq", allocationSize=1)
+    @Column(name="id", nullable = false)
+    private long id;
+
+    @Column(name="format")
+    private Storage.ImageFormat format;
+
+    @Column(name="unique_name")
+    private String uniqueName;
+
+    @Column(name="name")
+    private String name = null;
+
+    @Column(name="public")
+    private boolean publicTemplate = true;
+
+    @Column(name="featured")
+    private boolean featured;
+
+    @Column(name="type")
+    private Storage.TemplateType templateType;
+
+    @Column(name="url")
+    private String url = null;
+
+    @Column(name="hvm")
+    private boolean requiresHvm;
+
+    @Column(name="bits")
+    private int bits;
+
+    @Temporal(value=TemporalType.TIMESTAMP)
+    @Column(name=GenericDao.CREATED_COLUMN)
+    private Date created = null;
+
+    @Column(name=GenericDao.REMOVED)
+    @Temporal(TemporalType.TIMESTAMP)
+    private Date removed;
+
+    @Column(name="account_id")
+    private long accountId;
+
+    @Column(name="checksum")
+    private String checksum;
+
+    @Column(name="display_text", length=4096)
+    private String displayText;
+
+    @Column(name="enable_password")
+    private boolean enablePassword;
+
+    @Column(name="guest_os_id")
+    private long guestOSId;
+
+    @Column(name="bootable")
+    private boolean bootable = true;
+
+    @Column(name="prepopulate")
+    private boolean prepopulate = false;
+
+    @Column(name="cross_zones")
+    private boolean crossZones = false;
+
+    @Column(name="hypervisor_type")
+    @Enumerated(value=EnumType.STRING)
+    private HypervisorType hypervisorType;
+
+    @Column(name="extractable")
+    private boolean extractable = true;
+
+    @Column(name="source_template_id")
+    private Long sourceTemplateId;
+
+    @Column(name="template_tag")
+    private String templateTag;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    @Column(name="sort_key")
+    private int sortKey;
+
+    @Column(name="enable_sshkey")
+    private boolean enableSshKey;
+    
+    @Column(name = "image_data_store_id")
+    private long imageDataStoreId;
+    
+    @Column(name = "size")
+    private Long size;
+    
+    @Column(name = "state")
+    private TemplateState state;
+    
+    @Column(name="update_count", updatable = true)
+    protected long updatedCount;
+    
+    @Column(name = "updated")
+    @Temporal(value = TemporalType.TIMESTAMP)
+    Date updated;
+
+    @Transient
+    Map details;
+
+    @Override
+    public String getUniqueName() {
+        return uniqueName;
+    }
+
+    public void setUniqueName(String uniqueName) {
+        this.uniqueName = uniqueName;
+    }
+
+    public VMTemplateVO() {
+    	this.uuid = UUID.randomUUID().toString();
+    	this.state = TemplateState.Allocated;
+    }
+
+    /**
+     * Proper constructor for a new vm template.
+     */
+    public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType, Map details) {
+        this(id, generateUniqueName(id, accountId, name), name, format, isPublic, featured, isExtractable, type, url, null, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, hyperType, details);
+    	this.uuid = UUID.randomUUID().toString();
+    	this.state = TemplateState.Allocated;
+    }
+
+    public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType, String templateTag, Map details, boolean sshKeyEnabled) {
+        this(id, name, format, isPublic, featured, isExtractable, type, url, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, hyperType, details);
+        this.templateTag = templateTag;
+    	this.uuid = UUID.randomUUID().toString();
+    	this.state = TemplateState.Allocated;
+    	this.enableSshKey = sshKeyEnabled;
+    }
+
+    public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, TemplateType type, String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType) {
+        this.id = id;
+        this.name = name;
+        this.publicTemplate = isPublic;
+        this.featured = featured;
+        this.templateType = type;
+        this.url = url;
+        this.requiresHvm = requiresHvm;
+        this.bits = bits;
+        this.accountId = accountId;
+        this.checksum = cksum;
+        this.uniqueName = uniqueName;
+        this.displayText = displayText;
+        this.enablePassword = enablePassword;
+        this.format = format;
+        this.created = created;
+        this.guestOSId = guestOSId;
+        this.bootable = bootable;
+        this.hypervisorType = hyperType;
+    	this.uuid = UUID.randomUUID().toString();
+    	this.state = TemplateState.Allocated;
+    }
+
+    // Has an extra attribute - isExtractable
+    public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType, Map details) {
+        this(id, uniqueName, name, format, isPublic, featured, type, url, created, requiresHvm, bits, accountId, cksum,  displayText, enablePassword, guestOSId, bootable, hyperType);
+        this.extractable = isExtractable;
+    	this.uuid = UUID.randomUUID().toString();
+    	this.details = details;
+    }
+
+    public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType, String templateTag, Map details) {
+        this(id, uniqueName, name, format, isPublic, featured, isExtractable, type, url, created, requiresHvm, bits, accountId, cksum,  displayText, enablePassword, guestOSId, bootable, hyperType, details);
+        this.templateTag = templateTag;
+    	this.uuid = UUID.randomUUID().toString();
+    }
+
+    @Override
+    public boolean getEnablePassword() {
+        return enablePassword;
+    }
+
+    @Override
+    public Storage.ImageFormat getFormat() {
+        return format;
+    }
+
+    public void setEnablePassword(boolean enablePassword) {
+        this.enablePassword = enablePassword;
+    }
+
+    public void setFormat(ImageFormat format) {
+        this.format = format;
+    }
+
+    private static String generateUniqueName(long id, long userId, String displayName) {
+        StringBuilder name = new StringBuilder();
+        name.append(id);
+        name.append("-");
+        name.append(userId);
+        name.append("-");
+        name.append(UUID.nameUUIDFromBytes((displayName + System.currentTimeMillis()).getBytes()).toString());
+        return name.toString();
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public TemplateType getTemplateType() {
+        return templateType;
+    }
+
+    public void setTemplateType(TemplateType type) {
+        this.templateType = type;
+    }
+
+    public boolean requiresHvm() {
+        return requiresHvm;
+    }
+
+    @Override
+    public int getBits() {
+        return bits;
+    }
+
+    public void setBits(int bits) {
+        this.bits = bits;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    @Override
+    public boolean isPublicTemplate() {
+        return publicTemplate;
+    }
+
+    public void setPublicTemplate(boolean publicTemplate) {
+        this.publicTemplate = publicTemplate;
+    }
+
+    @Override
+    public boolean isFeatured() {
+        return featured;
+    }
+
+    public void setFeatured(boolean featured) {
+        this.featured = featured;
+    }
+
+    @Override
+    public Date getCreated() {
+        return created;
+    }
+
+    @Override
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    @Override
+    public boolean isRequiresHvm() {
+        return requiresHvm;
+    }
+
+    public void setRequiresHvm(boolean value) {
+        requiresHvm = value;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public String getChecksum() {
+        return checksum;
+    }
+
+    public void setChecksum(String checksum) {
+        this.checksum = checksum;
+    }
+
+    @Override
+    public String getDisplayText() {
+        return displayText;
+    }
+
+    public void setDisplayText(String displayText) {
+        this.displayText = displayText;
+    }
+
+    @Override
+    public long getGuestOSId() {
+        return guestOSId;
+    }
+
+    public void setGuestOSId(long guestOSId) {
+        this.guestOSId = guestOSId;
+    }
+
+    @Override
+    public boolean isBootable() {
+        return bootable;
+    }
+
+    public void setBootable(boolean bootable) {
+        this.bootable = bootable;
+    }
+
+    public void setPrepopulate(boolean prepopulate) {
+        this.prepopulate = prepopulate;
+    }
+
+    public boolean isPrepopulate() {
+        return prepopulate;
+    }
+
+    public void setCrossZones(boolean crossZones) {
+        this.crossZones = crossZones;
+    }
+
+    @Override
+    public boolean isCrossZones() {
+        return crossZones;
+    }
+
+    @Override
+    public HypervisorType getHypervisorType() {
+        return hypervisorType;
+    }
+
+    public void setHypervisorType(HypervisorType hyperType) {
+        hypervisorType = hyperType;
+    }
+
+    @Override
+    public boolean isExtractable() {
+        return extractable;
+    }
+
+    public void setExtractable(boolean extractable) {
+        this.extractable = extractable;
+    }
+
+    @Override
+    public Long getSourceTemplateId() {
+        return sourceTemplateId;
+    }
+
+    public void setSourceTemplateId(Long sourceTemplateId) {
+        this.sourceTemplateId = sourceTemplateId;
+    }
+
+    @Override
+    public String getTemplateTag() {
+        return templateTag;
+    }
+
+    public void setTemplateTag(String templateTag) {
+        this.templateTag = templateTag;
+    }
+
+    @Override
+    public long getDomainId() {
+        return -1;
+    }
+
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+
+    public Map getDetails() {
+    	return this.details;
+    }
+
+    public void setDetails(Map details) {
+    	this.details = details;
+    }
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that ) {
+            return true;
+        }
+        if (!(that instanceof VMTemplateVO)){
+            return false;
+        }
+        VMTemplateVO other = (VMTemplateVO)that;
+
+        return ((this.getUniqueName().equals(other.getUniqueName())));
+    }
+
+    @Override
+    public int hashCode() {
+        return uniqueName.hashCode();
+    }
+
+    @Transient
+    String toString;
+    @Override
+    public String toString() {
+        if (toString == null) {
+            toString = new StringBuilder("Tmpl[").append(id).append("-").append(format).append("-").append(uniqueName).toString();
+        }
+        return toString;
+    }
+
+    public void setRemoved(Date removed) {
+        this.removed = removed;
+    }
+
+    public void setSortKey(int key) {
+    	sortKey = key;
+    }
+
+    public int getSortKey() {
+    	return sortKey;
+    }
+
+	@Override
+	public boolean getEnableSshKey() {
+		return enableSshKey;
+	}
+
+	public void setEnableSshKey(boolean enable) {
+		enableSshKey = enable;
+	}
+	
+	 public Long getImageDataStoreId() {
+	        return this.imageDataStoreId;
+	    }
+
+	    public void setImageDataStoreId(long dataStoreId) {
+	        this.imageDataStoreId = dataStoreId;
+	    }
+	    
+	    public void setSize(Long size) {
+	        this.size = size;
+	    }
+	    
+	    public Long getSize() {
+	        return this.size;
+	    }
+	    
+	    public TemplateState getState() {
+	        return this.state;
+	    }
+	    
+	    public long getUpdatedCount() {
+	        return this.updatedCount;
+	    }
+	    
+	    public void incrUpdatedCount() {
+	        this.updatedCount++;
+	    }
+
+	    public void decrUpdatedCount() {
+	        this.updatedCount--;
+	    }
+	    
+	    public Date getUpdated() {
+	        return updated;
+	    }
+	    
+	    public void setUpdated(Date updated) {
+	        this.updated = updated;
+	    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/VMTemplateZoneVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/VMTemplateZoneVO.java b/engine/schema/src/com/cloud/storage/VMTemplateZoneVO.java
new file mode 100644
index 0000000..93a67b5
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/VMTemplateZoneVO.java
@@ -0,0 +1,116 @@
+// 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.storage;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.db.GenericDaoBase;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="template_zone_ref")
+public class VMTemplateZoneVO implements InternalIdentity {
+	@Id
+	@GeneratedValue(strategy=GenerationType.IDENTITY)
+	Long id;
+	
+	@Column(name="zone_id")
+	private long zoneId;
+	
+	@Column(name="template_id")
+	private long templateId;
+	
+	@Column(name=GenericDaoBase.CREATED_COLUMN)
+	private Date created = null;
+	
+	@Column(name="last_updated")
+	@Temporal(value=TemporalType.TIMESTAMP)
+	private Date lastUpdated = null;
+    
+    @Temporal(value=TemporalType.TIMESTAMP)
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+    
+    protected VMTemplateZoneVO() {
+    	
+    }
+
+	public VMTemplateZoneVO(long zoneId, long templateId, Date lastUpdated) {
+		this.zoneId = zoneId;
+		this.templateId = templateId;
+		this.lastUpdated = lastUpdated;
+	}
+
+	public long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public long getZoneId() {
+		return zoneId;
+	}
+
+	public void setZoneId(long zoneId) {
+		this.zoneId = zoneId;
+	}
+
+	public long getTemplateId() {
+		return templateId;
+	}
+
+	public void setTemplateId(long templateId) {
+		this.templateId = templateId;
+	}
+
+	public Date getCreated() {
+		return created;
+	}
+
+	public void setCreated(Date created) {
+		this.created = created;
+	}
+
+	public Date getLastUpdated() {
+		return lastUpdated;
+	}
+
+	public void setLastUpdated(Date lastUpdated) {
+		this.lastUpdated = lastUpdated;
+	}
+
+	public void setRemoved(Date removed) {
+		this.removed = removed;
+	}
+
+	public Date getRemoved() {
+		return removed;
+	}
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/VolumeHostVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/VolumeHostVO.java b/engine/schema/src/com/cloud/storage/VolumeHostVO.java
new file mode 100755
index 0000000..40bae49
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/VolumeHostVO.java
@@ -0,0 +1,347 @@
+// 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.storage;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.cloudstack.api.InternalIdentity;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
+
+import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
+import com.cloud.utils.db.GenericDaoBase;
+
+/**
+ * Join table for storage hosts and volumes
+ *
+ */
+@Entity
+@Table(name="volume_host_ref")
+public class VolumeHostVO implements InternalIdentity, DataObjectInStore {
+	@Id
+	@GeneratedValue(strategy=GenerationType.IDENTITY)
+	Long id;
+	
+	@Column(name="host_id")
+	private long hostId;
+	
+	@Column(name="volume_id")
+	private long volumeId;
+	
+	@Column(name="zone_id")
+	private long zoneId;
+	
+	@Column(name=GenericDaoBase.CREATED_COLUMN)
+	private Date created = null;
+	
+	@Column(name="last_updated")
+	@Temporal(value=TemporalType.TIMESTAMP)
+	private Date lastUpdated = null;
+	
+	@Column (name="download_pct")
+	private int downloadPercent;
+	
+	@Column (name="size")
+	private long size;
+	
+	@Column (name="physical_size")
+	private long physicalSize;
+	
+	@Column (name="download_state")
+	@Enumerated(EnumType.STRING)
+	private Status downloadState;
+	
+    @Column(name="checksum")
+    private String checksum;
+	
+	@Column (name="local_path")
+	private String localDownloadPath;
+	
+	@Column (name="error_str")
+	private String errorString;
+	
+	@Column (name="job_id")
+	private String jobId;	
+	
+	@Column (name="install_path")
+    private String installPath;
+	
+	@Column (name="url")
+	private String downloadUrl;
+	
+	@Column(name="format")
+    private Storage.ImageFormat format;
+    
+    @Column(name="destroyed")
+    boolean destroyed = false;
+    
+    @Column(name="update_count", updatable = true, nullable=false)
+    protected long updatedCount;
+    
+    @Column(name = "updated")
+    @Temporal(value = TemporalType.TIMESTAMP)
+    Date updated;
+    
+    @Column(name = "state")
+    @Enumerated(EnumType.STRING)
+    ObjectInDataStoreStateMachine.State state;
+	
+    public String getInstallPath() {
+		return installPath;
+	}
+
+	public long getHostId() {
+		return hostId;
+	}
+
+	public void setHostId(long hostId) {
+		this.hostId = hostId;
+	}
+
+	
+    public long getVolumeId() {
+		return volumeId;
+	}
+
+	
+    public void setVolumeId(long volumeId) {
+		this.volumeId = volumeId;
+	}
+
+	
+    public long getZoneId() {
+		return zoneId;
+	}
+
+	public void setZoneId(long zoneId) {
+		this.zoneId = zoneId;
+	}
+
+	public int getDownloadPercent() {
+		return downloadPercent;
+	}
+
+	
+    public void setDownloadPercent(int downloadPercent) {
+		this.downloadPercent = downloadPercent;
+	}
+
+	
+    public void setDownloadState(Status downloadState) {
+		this.downloadState = downloadState;
+	}
+
+	
+    public long getId() {
+		return id;
+	}
+
+	
+    public Date getCreated() {
+		return created;
+	}
+
+	
+    public Date getLastUpdated() {
+		return lastUpdated;
+	}
+	
+	
+    public void setLastUpdated(Date date) {
+	    lastUpdated = date;
+	}
+	
+	
+    public void setInstallPath(String installPath) {
+	    this.installPath = installPath;
+	}
+
+	
+    public Status getDownloadState() {
+		return downloadState;
+	}
+
+	public String getChecksum() {
+		return checksum;
+	}
+
+	public void setChecksum(String checksum) {
+		this.checksum = checksum;
+	}
+
+	public VolumeHostVO(long hostId, long volumeId) {
+		super();
+		this.hostId = hostId;
+		this.volumeId = volumeId;
+		this.state = ObjectInDataStoreStateMachine.State.Allocated;
+	}
+
+	public VolumeHostVO(long hostId, long volumeId, long zoneId, Date lastUpdated,
+			int downloadPercent, Status downloadState,
+			String localDownloadPath, String errorString, String jobId,
+			String installPath, String downloadUrl, String checksum, ImageFormat format) {
+		//super();
+		this.hostId = hostId;
+		this.volumeId = volumeId;
+		this.zoneId = zoneId;
+		this.lastUpdated = lastUpdated;
+		this.downloadPercent = downloadPercent;
+		this.downloadState = downloadState;
+		this.localDownloadPath = localDownloadPath;
+		this.errorString = errorString;
+		this.jobId = jobId;
+		this.installPath = installPath;
+		this.setDownloadUrl(downloadUrl);
+		this.checksum = checksum;
+		this.format = format;
+	}
+
+	protected VolumeHostVO() {
+		
+	}
+
+	
+    public void setLocalDownloadPath(String localPath) {
+		this.localDownloadPath = localPath;
+	}
+
+	
+    public String getLocalDownloadPath() {
+		return localDownloadPath;
+	}
+
+	
+    public void setErrorString(String errorString) {
+		this.errorString = errorString;
+	}
+
+	
+    public String getErrorString() {
+		return errorString;
+	}
+
+	
+    public void setJobId(String jobId) {
+		this.jobId = jobId;
+	}
+
+	
+    public String getJobId() {
+		return jobId;
+	}
+
+	
+	public boolean equals(Object obj) {
+		if (obj instanceof VolumeHostVO) {
+			VolumeHostVO other = (VolumeHostVO)obj;
+			return (this.volumeId==other.getVolumeId() && this.hostId==other.getHostId());		   
+		}
+		return false;
+	}
+
+	
+	public int hashCode() {
+		Long tid = new Long(volumeId);
+		Long hid = new Long(hostId);
+		return tid.hashCode()+hid.hashCode();
+	}
+
+    public void setSize(long size) {
+        this.size = size;
+    }
+
+    public long getSize() {
+        return size;
+    }
+	
+    
+    public void setPhysicalSize(long physicalSize) {
+        this.physicalSize = physicalSize;
+    }
+
+    public long getPhysicalSize() {
+        return physicalSize;
+    }
+
+    public void setDestroyed(boolean destroyed) {
+    	this.destroyed = destroyed;
+    }
+
+    public boolean getDestroyed() {
+    	return destroyed;
+    }
+
+	public void setDownloadUrl(String downloadUrl) {
+		this.downloadUrl = downloadUrl;
+	}
+
+	public String getDownloadUrl() {
+		return downloadUrl;
+	}	
+	
+    public Storage.ImageFormat getFormat() {
+		return format;
+	}
+
+	public void setFormat(Storage.ImageFormat format) {
+		this.format = format;
+	}
+
+	public long getVolumeSize() {
+	    return -1;
+	}
+	
+	
+    public String toString() {
+	    return new StringBuilder("VolumeHost[").append(id).append("-").append(volumeId).append("-").append(hostId).append(installPath).append("]").toString();
+	}
+    
+    public long getUpdatedCount() {
+        return this.updatedCount;
+    }
+    
+    public void incrUpdatedCount() {
+        this.updatedCount++;
+    }
+
+    public void decrUpdatedCount() {
+        this.updatedCount--;
+    }
+    
+    public Date getUpdated() {
+        return updated;
+    }
+
+    @Override
+    public ObjectInDataStoreStateMachine.State getState() {
+        // TODO Auto-generated method stub
+        return this.state;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/VolumeVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/VolumeVO.java b/engine/schema/src/com/cloud/storage/VolumeVO.java
new file mode 100755
index 0000000..1699afd
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/VolumeVO.java
@@ -0,0 +1,466 @@
+// 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.storage;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import com.cloud.storage.Storage.StoragePoolType;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.db.GenericDao;
+
+@Entity
+@Table(name = "volumes")
+public class VolumeVO implements Volume {
+    @Id
+    @TableGenerator(name = "volume_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "volume_seq", allocationSize = 1)
+    @GeneratedValue(strategy = GenerationType.TABLE)
+    @Column(name = "id")
+    long id;
+
+    @Column(name = "name")
+    String name;
+
+    @Column(name = "pool_id")
+    Long poolId;
+    
+    @Column(name = "last_pool_id")
+    Long lastPoolId;
+    
+    @Column(name = "account_id")
+    long accountId;
+
+    @Column(name = "domain_id")
+    long domainId;
+
+    @Column(name = "instance_id")
+    Long instanceId = null;
+
+    @Column(name = "device_id")
+    Long deviceId = null;
+
+    @Column(name = "size")
+    Long size;
+
+    @Column(name = "folder")
+    String folder;
+
+    @Column(name = "path")
+    String path;
+
+    @Column(name = "pod_id")
+    Long podId;
+
+    @Column(name = "created")
+    Date created;
+
+    @Column(name = "attached")
+    @Temporal(value = TemporalType.TIMESTAMP)
+    Date attached;
+
+    @Column(name = "data_center_id")
+    long dataCenterId;
+
+    @Column(name = "host_ip")
+    String hostip;
+
+    @Column(name = "disk_offering_id")
+    long diskOfferingId;
+
+    @Column(name = "template_id")
+    Long templateId;
+
+    @Column(name = "first_snapshot_backup_uuid")
+    String firstSnapshotBackupUuid;
+
+    @Column(name = "volume_type")
+    @Enumerated(EnumType.STRING)
+    Type volumeType = Volume.Type.UNKNOWN;
+
+    @Column(name = "pool_type")
+    @Enumerated(EnumType.STRING)
+    StoragePoolType poolType;
+
+    @Column(name = GenericDao.REMOVED_COLUMN)
+    Date removed;
+
+    @Column(name = "updated")
+    @Temporal(value = TemporalType.TIMESTAMP)
+    Date updated;
+    
+    @Column(name="update_count", updatable = true, nullable=false)
+    protected long updatedCount;	// This field should be updated everytime the state is updated.  There's no set method in the vo object because it is done with in the dao code.
+
+    @Column(name = "recreatable")
+    boolean recreatable;
+
+    @Column(name = "state")
+    @Enumerated(value = EnumType.STRING)
+    private State state;
+
+    @Column(name = "chain_info")
+    String chainInfo;
+
+    @Column(name = "uuid")
+    String uuid;
+
+    @Column(name="display_volume", updatable=true, nullable=false)
+    protected boolean displayVolume;
+
+    @Transient
+    // @Column(name="reservation")
+    String reservationId;
+    
+    // Real Constructor
+    public VolumeVO(Type type, String name, long dcId, long domainId, long accountId, long diskOfferingId, long size) {
+        this.volumeType = type;
+        this.name = name;
+        this.dataCenterId = dcId;
+        this.accountId = accountId;
+        this.domainId = domainId;
+        this.size = size;
+        this.diskOfferingId = diskOfferingId;
+        this.state = State.Allocated;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public VolumeVO(String name, long dcId, long podId, long accountId, long domainId, Long instanceId, String folder, String path, long size, Volume.Type vType) {
+        this.name = name;
+        this.accountId = accountId;
+        this.domainId = domainId;
+        this.instanceId = instanceId;
+        this.folder = folder;
+        this.path = path;
+        this.size = size;
+        this.podId = podId;
+        this.dataCenterId = dcId;
+        this.volumeType = vType;
+        this.state = Volume.State.Allocated;
+        this.recreatable = false;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    // Copy Constructor
+    public VolumeVO(Volume that) {
+        this(that.getName(), that.getDataCenterId(), that.getPodId(), that.getAccountId(), that.getDomainId(), that.getInstanceId(), that.getFolder(), that.getPath(), that.getSize(), that
+                .getVolumeType());
+        this.recreatable = that.isRecreatable();
+        this.state = that.getState();
+        this.size = that.getSize();
+        this.diskOfferingId = that.getDiskOfferingId();
+        this.poolId = that.getPoolId();
+        this.attached = that.getAttached();
+        this.chainInfo = that.getChainInfo();
+        this.templateId = that.getTemplateId();
+        this.deviceId = that.getDeviceId();
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    @Override
+    public long getUpdatedCount() {
+    	return this.updatedCount;
+    }
+    
+    @Override
+    public void incrUpdatedCount() {
+    	this.updatedCount++;
+    }
+    
+    public void decrUpdatedCount() {
+    	this.updatedCount--;
+    }
+    
+    @Override
+    public boolean isRecreatable() {
+        return recreatable;
+    }
+
+    public void setRecreatable(boolean recreatable) {
+        this.recreatable = recreatable;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public Long getPodId() {
+        return podId;
+    }
+
+    @Override
+    public long getDataCenterId() {
+        return dataCenterId;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    public void setPoolType(StoragePoolType poolType) {
+        this.poolType = poolType;
+    }
+
+    public StoragePoolType getPoolType() {
+        return poolType;
+    }
+
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public String getFolder() {
+        return folder;
+    }
+
+    @Override
+    public String getPath() {
+        return path;
+    }
+
+    protected VolumeVO() {
+    }
+
+    @Override
+    public Long getSize() {
+        return size;
+    }
+
+    public void setSize(Long size) {
+        this.size = size;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return instanceId;
+    }
+
+    @Override
+    public Long getDeviceId() {
+        return deviceId;
+    }
+
+    public void setDeviceId(Long deviceId) {
+        this.deviceId = deviceId;
+    }
+
+    @Override
+    public Type getVolumeType() {
+        return volumeType;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setFolder(String folder) {
+        this.folder = folder;
+    }
+
+    public void setAccountId(long accountId) {
+        this.accountId = accountId;
+    }
+
+    public void setDomainId(long domainId) {
+        this.domainId = domainId;
+    }
+
+    public void setInstanceId(Long instanceId) {
+        this.instanceId = instanceId;
+    }
+
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    public String getHostIp() {
+        return hostip;
+    }
+
+    public void setHostIp(String hostip) {
+        this.hostip = hostip;
+    }
+
+    public void setPodId(Long podId) {
+        this.podId = podId;
+    }
+
+    public void setDataCenterId(long dataCenterId) {
+        this.dataCenterId = dataCenterId;
+    }
+
+    public void setVolumeType(Type type) {
+        volumeType = type;
+    }
+
+    @Override
+    public Date getCreated() {
+        return created;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public void setRemoved(Date removed) {
+        this.removed = removed;
+    }
+
+    @Override
+    public long getDiskOfferingId() {
+        return diskOfferingId;
+    }
+
+    public void setDiskOfferingId(long diskOfferingId) {
+        this.diskOfferingId = diskOfferingId;
+    }
+
+    @Override
+    public Long getTemplateId() {
+        return templateId;
+    }
+
+    public void setTemplateId(Long templateId) {
+        this.templateId = templateId;
+    }
+
+    public String getFirstSnapshotBackupUuid() {
+        return firstSnapshotBackupUuid;
+    }
+
+    public void setFirstSnapshotBackupUuid(String firstSnapshotBackupUuid) {
+        this.firstSnapshotBackupUuid = firstSnapshotBackupUuid;
+    }
+
+    @Override
+    public Long getPoolId() {
+        return poolId;
+    }
+
+    public void setPoolId(Long poolId) {
+        this.poolId = poolId;
+    }
+
+    @Override
+    public Date getUpdated() {
+        return updated;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    public void setUpdated(Date updated) {
+        this.updated = updated;
+    }
+
+    @Override
+    public String toString() {
+        return new StringBuilder("Vol[").append(id).append("|vm=").append(instanceId).append("|").append(volumeType).append("]").toString();
+    }
+
+    @Override
+    public Date getAttached() {
+        return this.attached;
+    }
+
+    public void setAttached(Date attached) {
+        this.attached = attached;
+    }
+
+    @Override
+    public String getChainInfo() {
+        return this.chainInfo;
+    }
+
+    public void setChainInfo(String chainInfo) {
+        this.chainInfo = chainInfo;
+    }
+    
+    public Long getLastPoolId() {
+    	return this.lastPoolId;
+    }
+    
+    public void setLastPoolId(Long poolId) {
+    	this.lastPoolId = poolId;
+    }
+
+    @Override
+    public int hashCode() {
+        return NumbersUtil.hash(id);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof VolumeVO) {
+            return id == ((VolumeVO) obj).id;
+        } else {
+            return false;
+        }
+    }
+    
+    @Override
+    public String getReservationId() {
+    	return this.reservationId;
+    }
+    
+    @Override
+    public void setReservationId(String reserv) {
+    	this.reservationId = reserv;
+    }
+    
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+    
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+
+
+    public boolean isDisplayVolume() {
+        return displayVolume;
+    }
+
+    public void setDisplayVolume(boolean displayVolume) {
+        this.displayVolume = displayVolume;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/DiskOfferingDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/DiskOfferingDao.java b/engine/schema/src/com/cloud/storage/dao/DiskOfferingDao.java
new file mode 100644
index 0000000..c17e319
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/DiskOfferingDao.java
@@ -0,0 +1,31 @@
+// 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.storage.dao;
+
+import java.util.List;
+
+import com.cloud.storage.DiskOfferingVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface DiskOfferingDao extends GenericDao<DiskOfferingVO, Long> {
+    List<DiskOfferingVO> listByDomainId(long domainId);
+    List<DiskOfferingVO> findPrivateDiskOffering();
+	List<DiskOfferingVO> findPublicDiskOfferings();
+    DiskOfferingVO findByUniqueName(String uniqueName);
+    DiskOfferingVO persistDeafultDiskOffering(DiskOfferingVO offering);
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java
new file mode 100644
index 0000000..1f68c50
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java
@@ -0,0 +1,152 @@
+// 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.storage.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.persistence.EntityExistsException;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.storage.DiskOfferingVO;
+import com.cloud.storage.DiskOfferingVO.Type;
+import com.cloud.utils.db.Attribute;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value={DiskOfferingDao.class})
+public class DiskOfferingDaoImpl extends GenericDaoBase<DiskOfferingVO, Long> implements DiskOfferingDao {
+    private static final Logger s_logger = Logger.getLogger(DiskOfferingDaoImpl.class);
+
+    private final SearchBuilder<DiskOfferingVO> DomainIdSearch;
+    private final SearchBuilder<DiskOfferingVO> PrivateDiskOfferingSearch;
+    private final SearchBuilder<DiskOfferingVO> PublicDiskOfferingSearch;
+    protected final SearchBuilder<DiskOfferingVO> UniqueNameSearch;
+    private final Attribute _typeAttr;
+
+    protected DiskOfferingDaoImpl() {
+        DomainIdSearch  = createSearchBuilder();
+        DomainIdSearch.and("domainId", DomainIdSearch.entity().getDomainId(), SearchCriteria.Op.EQ);
+        DomainIdSearch.and("removed", DomainIdSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
+        DomainIdSearch.done();
+        
+        PrivateDiskOfferingSearch  = createSearchBuilder();
+        PrivateDiskOfferingSearch.and("diskSize", PrivateDiskOfferingSearch.entity().getDiskSize(), SearchCriteria.Op.EQ);
+        PrivateDiskOfferingSearch.done();
+        
+        PublicDiskOfferingSearch = createSearchBuilder();
+        PublicDiskOfferingSearch.and("domainId", PublicDiskOfferingSearch.entity().getDomainId(), SearchCriteria.Op.NULL);
+        PublicDiskOfferingSearch.and("system", PublicDiskOfferingSearch.entity().getSystemUse(), SearchCriteria.Op.EQ);
+        PublicDiskOfferingSearch.and("removed", PublicDiskOfferingSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
+        PublicDiskOfferingSearch.done();
+        
+        UniqueNameSearch = createSearchBuilder();
+        UniqueNameSearch.and("name", UniqueNameSearch.entity().getUniqueName(), SearchCriteria.Op.EQ);
+        UniqueNameSearch.done();
+        
+        _typeAttr = _allAttributes.get("type");
+    }
+
+    @Override
+    public List<DiskOfferingVO> listByDomainId(long domainId) {
+        SearchCriteria<DiskOfferingVO> sc = DomainIdSearch.create();
+        sc.setParameters("domainId", domainId);
+        // FIXME:  this should not be exact match, but instead should find all available disk offerings from parent domains
+        return listBy(sc);
+    }
+    
+    @Override
+    public List<DiskOfferingVO> findPrivateDiskOffering() {
+        SearchCriteria<DiskOfferingVO> sc = PrivateDiskOfferingSearch.create();
+        sc.setParameters("diskSize", 0);
+        return listBy(sc);
+    }
+    
+    @Override
+    public List<DiskOfferingVO> searchIncludingRemoved(SearchCriteria<DiskOfferingVO> sc, final Filter filter, final Boolean lock, final boolean cache) {
+        sc.addAnd(_typeAttr, Op.EQ, Type.Disk);
+        return super.searchIncludingRemoved(sc, filter, lock, cache);
+    }
+    
+    @Override
+    public <K> List<K> customSearchIncludingRemoved(SearchCriteria<K> sc, final Filter filter) {
+        sc.addAnd(_typeAttr, Op.EQ, Type.Disk);
+        return super.customSearchIncludingRemoved(sc, filter);
+    }
+    
+    @Override
+    protected List<DiskOfferingVO> executeList(final String sql, final Object... params) {
+        StringBuilder builder = new StringBuilder(sql);
+        int index = builder.indexOf("WHERE");
+        if (index == -1) {
+            builder.append(" WHERE type=?");
+        } else {
+            builder.insert(index + 6, "type=? ");
+        }
+        
+        return super.executeList(sql, Type.Disk, params);
+    }
+    
+    @Override
+    public List<DiskOfferingVO> findPublicDiskOfferings(){
+    	SearchCriteria<DiskOfferingVO> sc = PublicDiskOfferingSearch.create();
+    	sc.setParameters("system", false);
+        return listBy(sc);    	
+    }
+    
+    @Override
+    public DiskOfferingVO findByUniqueName(String uniqueName) {
+        SearchCriteria<DiskOfferingVO> sc = UniqueNameSearch.create();
+        sc.setParameters("name", uniqueName);
+        List<DiskOfferingVO> vos = search(sc, null, null, false);
+        if (vos.size() == 0) {
+            return null;
+        }
+        
+        return vos.get(0);
+    }
+    
+    @Override
+    public DiskOfferingVO persistDeafultDiskOffering(DiskOfferingVO offering) {
+        assert offering.getUniqueName() != null : "unique name shouldn't be null for the disk offering";
+        DiskOfferingVO vo = findByUniqueName(offering.getUniqueName());
+        if (vo != null) {
+            return vo;
+        }
+        try {
+            return persist(offering);
+        } catch (EntityExistsException e) {
+            // Assume it's conflict on unique name
+            return findByUniqueName(offering.getUniqueName());
+        }
+    }
+    
+    @Override
+    public boolean remove(Long id) {
+        DiskOfferingVO diskOffering = createForUpdate();
+        diskOffering.setRemoved(new Date());
+
+        return update(id, diskOffering);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/GuestOSCategoryDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/GuestOSCategoryDao.java b/engine/schema/src/com/cloud/storage/dao/GuestOSCategoryDao.java
new file mode 100644
index 0000000..0f7ea32
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/GuestOSCategoryDao.java
@@ -0,0 +1,24 @@
+// 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.storage.dao;
+
+import com.cloud.storage.GuestOSCategoryVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface GuestOSCategoryDao extends GenericDao<GuestOSCategoryVO, Long> {
+   
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/GuestOSCategoryDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/GuestOSCategoryDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/GuestOSCategoryDaoImpl.java
new file mode 100644
index 0000000..d017b99
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/GuestOSCategoryDaoImpl.java
@@ -0,0 +1,34 @@
+// 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.storage.dao;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.storage.GuestOSCategoryVO;
+import com.cloud.utils.db.GenericDaoBase;
+
+@Component
+@Local (value={GuestOSCategoryDao.class})
+public class GuestOSCategoryDaoImpl extends GenericDaoBase<GuestOSCategoryVO, Long> implements GuestOSCategoryDao {
+    
+	protected GuestOSCategoryDaoImpl() {
+
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/GuestOSDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/GuestOSDao.java b/engine/schema/src/com/cloud/storage/dao/GuestOSDao.java
new file mode 100755
index 0000000..19e423b
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/GuestOSDao.java
@@ -0,0 +1,26 @@
+// 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.storage.dao;
+
+import com.cloud.storage.GuestOSVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface GuestOSDao extends GenericDao<GuestOSVO, Long> {
+
+    GuestOSVO listByDisplayName(String displayName);
+   
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/GuestOSDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/GuestOSDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/GuestOSDaoImpl.java
new file mode 100755
index 0000000..c39fae8
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/GuestOSDaoImpl.java
@@ -0,0 +1,51 @@
+// 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.storage.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.storage.GuestOSVO;
+import com.cloud.storage.VMTemplateHostVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local (value={GuestOSDao.class})
+public class GuestOSDaoImpl extends GenericDaoBase<GuestOSVO, Long> implements GuestOSDao {
+    
+    
+    protected final SearchBuilder<GuestOSVO> Search;
+    
+	protected GuestOSDaoImpl() {
+        Search = createSearchBuilder();
+        Search.and("display_name", Search.entity().getDisplayName(), SearchCriteria.Op.EQ);
+        Search.done();
+	}
+	
+   @Override
+    public GuestOSVO listByDisplayName(String displayName) {
+        SearchCriteria<GuestOSVO> sc = Search.create();
+        sc.setParameters("display_name", displayName);
+        return findOneBy(sc);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/LaunchPermissionDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/LaunchPermissionDao.java b/engine/schema/src/com/cloud/storage/dao/LaunchPermissionDao.java
new file mode 100644
index 0000000..0ad60b5
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/LaunchPermissionDao.java
@@ -0,0 +1,61 @@
+// 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.storage.dao;
+
+import java.util.List;
+
+
+import com.cloud.storage.LaunchPermissionVO;
+import com.cloud.storage.VMTemplateVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface LaunchPermissionDao extends GenericDao<LaunchPermissionVO, Long> {
+    /**
+     * remove the ability to launch vms from the given template for the given account names which are valid in the given domain
+     * @param templateId id of the template to modify launch permissions
+     * @param accountIds list of account ids
+     */
+    void removePermissions(long templateId, List<Long> accountIds);
+
+    /**
+     * remove all launch permissions associated with a template
+     * @param templateId
+     */
+    void removeAllPermissions(long templateId);
+
+    /**
+     * Find a launch permission by templateId, accountName, and domainId
+     * @param templateId the id of the template to search for
+     * @param accountId the id of the account for which permission is being searched
+     * @return launch permission if found, null otherwise
+     */
+    LaunchPermissionVO findByTemplateAndAccount(long templateId, long accountId);
+
+    /**
+     * List all launch permissions for the given template
+     * @param templateId id of the template for which launch permissions will be queried
+     * @return list of launch permissions
+     */
+    List<LaunchPermissionVO> findByTemplate(long templateId);
+
+    /**
+     * List all templates for which permission to launch instances has been granted to the given account
+     * @param accountId
+     * @return
+     */
+    List<VMTemplateVO> listPermittedTemplates(long accountId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/LaunchPermissionDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/LaunchPermissionDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/LaunchPermissionDaoImpl.java
new file mode 100644
index 0000000..286b1d9
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/LaunchPermissionDaoImpl.java
@@ -0,0 +1,158 @@
+// 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.storage.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.storage.LaunchPermissionVO;
+import com.cloud.storage.VMTemplateVO;
+import com.cloud.storage.Storage.TemplateType;
+import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.utils.DateUtil;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Component
+@Local(value={LaunchPermissionDao.class})
+public class LaunchPermissionDaoImpl extends GenericDaoBase<LaunchPermissionVO, Long> implements LaunchPermissionDao {
+    private static final Logger s_logger = Logger.getLogger(LaunchPermissionDaoImpl.class);
+    private static final String REMOVE_LAUNCH_PERMISSION = "DELETE FROM `cloud`.`launch_permission`" +
+                                                           "  WHERE template_id = ? AND account_id = ?";
+
+    private static final String LIST_PERMITTED_TEMPLATES = "SELECT t.id, t.unique_name, t.name, t.public, t.format, t.type, t.hvm, t.bits, t.url, t.created, t.account_id, t.checksum, t.display_text, t.enable_password, t.guest_os_id, t.featured" +
+                                                           "  FROM `cloud`.`vm_template` t INNER JOIN (SELECT lp.template_id as lptid" +
+                                                                                                      " FROM `cloud`.`launch_permission` lp" +
+                                                                                                      " WHERE lp.account_id = ?) joinlp" +
+                                                           "  WHERE t.id = joinlp.lptid" +
+                                                           "  ORDER BY t.created DESC";
+
+    private final SearchBuilder<LaunchPermissionVO> TemplateAndAccountSearch;
+    private final SearchBuilder<LaunchPermissionVO> TemplateIdSearch;
+
+    protected LaunchPermissionDaoImpl() {
+        TemplateAndAccountSearch = createSearchBuilder();
+        TemplateAndAccountSearch.and("templateId", TemplateAndAccountSearch.entity().getTemplateId(), SearchCriteria.Op.EQ);
+        TemplateAndAccountSearch.and("accountId", TemplateAndAccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        TemplateAndAccountSearch.done();
+
+        TemplateIdSearch = createSearchBuilder();
+        TemplateIdSearch.and("templateId", TemplateIdSearch.entity().getTemplateId(), SearchCriteria.Op.EQ);
+        TemplateIdSearch.done();
+    }
+
+    @Override
+    public void removePermissions(long templateId, List<Long> accountIds) {
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        try {
+            txn.start();
+            String sql = REMOVE_LAUNCH_PERMISSION;
+            pstmt = txn.prepareAutoCloseStatement(sql);
+            for (Long accountId : accountIds) {
+                pstmt.setLong(1, templateId);
+                pstmt.setLong(2, accountId.longValue());
+                pstmt.addBatch();
+            }
+            pstmt.executeBatch();
+            txn.commit();
+        } catch (Exception e) {
+            txn.rollback();
+            s_logger.warn("Error removing launch permissions", e);
+            throw new CloudRuntimeException("Error removing launch permissions", e);
+        }
+    }
+
+    @Override
+    public void removeAllPermissions(long templateId) {
+        SearchCriteria<LaunchPermissionVO> sc = TemplateIdSearch.create();
+        sc.setParameters("templateId", templateId);
+        expunge(sc);
+    }
+
+    @Override
+    public LaunchPermissionVO findByTemplateAndAccount(long templateId, long accountId) {
+        SearchCriteria<LaunchPermissionVO> sc = TemplateAndAccountSearch.create();
+        sc.setParameters("templateId", templateId);
+        sc.setParameters("accountId", accountId);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public List<VMTemplateVO> listPermittedTemplates(long accountId) {
+        Transaction txn = Transaction.currentTxn();
+        List<VMTemplateVO> permittedTemplates = new ArrayList<VMTemplateVO>();
+        PreparedStatement pstmt = null;
+        try {
+            String sql = LIST_PERMITTED_TEMPLATES;
+            pstmt = txn.prepareAutoCloseStatement(sql);
+            pstmt.setLong(1, accountId);
+            ResultSet rs = pstmt.executeQuery();
+            while (rs.next()) {
+                long id = rs.getLong(1);
+                String uniqueName = rs.getString(2);
+                String name = rs.getString(3);
+                boolean isPublic = rs.getBoolean(4);
+                String value = rs.getString(5);
+                ImageFormat format = ImageFormat.valueOf(value);
+                String tmpltType = rs.getString(6);
+                boolean requiresHVM = rs.getBoolean(7);
+                int bits = rs.getInt(8);
+                String url = rs.getString(9);
+                String createdTS = rs.getString(10);
+                long templateAccountId = rs.getLong(11);
+                String checksum = rs.getString(12);
+                String displayText = rs.getString(13);
+                boolean enablePassword = rs.getBoolean(14);
+                long guestOSId = rs.getLong(15);
+                boolean featured = rs.getBoolean(16);
+                Date createdDate = null;
+
+                if (createdTS != null) {
+                    createdDate = DateUtil.parseDateString(s_gmtTimeZone, createdTS);
+                }
+
+                if (isPublic) {
+                    continue; // if it's public already, skip adding it to permitted templates as this for private templates only
+                }
+                VMTemplateVO template = new VMTemplateVO(id, uniqueName, name, format, isPublic, featured, TemplateType.valueOf(tmpltType), url, createdDate, requiresHVM, bits, templateAccountId, checksum, displayText, enablePassword, guestOSId, true, null);
+                permittedTemplates.add(template);
+            }
+        } catch (Exception e) {
+            s_logger.warn("Error listing permitted templates", e);
+        }
+        return permittedTemplates;
+    }
+
+    @Override
+    public List<LaunchPermissionVO> findByTemplate(long templateId) {
+        SearchCriteria<LaunchPermissionVO> sc = TemplateIdSearch.create();
+        sc.setParameters("templateId", templateId);
+        return listBy(sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/S3Dao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/S3Dao.java b/engine/schema/src/com/cloud/storage/dao/S3Dao.java
new file mode 100644
index 0000000..ebea353
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/S3Dao.java
@@ -0,0 +1,29 @@
+/*
+ * 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.storage.dao;
+
+import com.cloud.agent.api.to.S3TO;
+import com.cloud.storage.S3VO;
+import com.cloud.utils.db.GenericDao;
+
+public interface S3Dao extends GenericDao<S3VO, Long> {
+
+    S3TO getS3TO(final Long id);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/S3DaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/S3DaoImpl.java b/engine/schema/src/com/cloud/storage/dao/S3DaoImpl.java
new file mode 100644
index 0000000..f0dd078
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/S3DaoImpl.java
@@ -0,0 +1,50 @@
+/*
+ * 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.storage.dao;
+
+import com.cloud.agent.api.to.S3TO;
+import com.cloud.storage.S3VO;
+import com.cloud.utils.db.GenericDaoBase;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+@Component
+@Local(S3Dao.class)
+public class S3DaoImpl extends GenericDaoBase<S3VO, Long> implements S3Dao {
+
+    @Override
+    public S3TO getS3TO(final Long id) {
+
+        if (id != null) {
+
+            final S3VO s3VO = findById(id);
+            if (s3VO != null) {
+                return s3VO.toS3TO();
+            }
+
+        }
+
+        // NOTE: Excluded listAll / shuffle operation implemented in SwiftDaoImpl ...
+
+        return null;
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/SnapshotDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/SnapshotDao.java b/engine/schema/src/com/cloud/storage/dao/SnapshotDao.java
new file mode 100644
index 0000000..3ac9e77
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/SnapshotDao.java
@@ -0,0 +1,54 @@
+// 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.storage.dao;
+
+import com.cloud.storage.Snapshot;
+import com.cloud.storage.Snapshot.Type;
+import com.cloud.storage.SnapshotVO;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.fsm.StateDao;
+
+import java.util.List;
+
+public interface SnapshotDao extends GenericDao<SnapshotVO, Long>, StateDao<Snapshot.State, Snapshot.Event, SnapshotVO> {
+	List<SnapshotVO> listByVolumeId(long volumeId);
+	List<SnapshotVO> listByVolumeId(Filter filter, long volumeId);
+	SnapshotVO findNextSnapshot(long parentSnapId);
+	long getLastSnapshot(long volumeId, long snapId);
+    List<SnapshotVO> listByVolumeIdType(long volumeId, Type type);
+    List<SnapshotVO> listByVolumeIdIncludingRemoved(long volumeId);
+    List<SnapshotVO> listByBackupUuid(long volumeId, String backupUuid);
+    long updateSnapshotVersion(long volumeId, String from, String to);
+    List<SnapshotVO> listByVolumeIdVersion(long volumeId, String version);
+    Long getSecHostId(long volumeId);
+    long updateSnapshotSecHost(long dcId, long secHostId);
+    List<SnapshotVO> listByHostId(Filter filter, long hostId);
+    List<SnapshotVO> listByHostId(long hostId);
+    public Long countSnapshotsForAccount(long accountId);
+    List<SnapshotVO> listByInstanceId(long instanceId, Snapshot.State... status);
+    List<SnapshotVO> listByStatus(long volumeId, Snapshot.State... status);
+    List<SnapshotVO> listAllByStatus(Snapshot.State... status);
+    /**
+     * Gets the Total Secondary Storage space (in bytes) used by snapshots allocated for an account
+     *
+     * @param account
+     * @return total Secondary Storage space allocated
+     */
+    long secondaryStorageUsedForAccount(long accountId);
+
+}


[15/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java b/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
new file mode 100644
index 0000000..c30ca5e
--- /dev/null
+++ b/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
@@ -0,0 +1,278 @@
+// 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.domain.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.domain.Domain;
+import com.cloud.domain.DomainVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value={DomainDao.class})
+public class DomainDaoImpl extends GenericDaoBase<DomainVO, Long> implements DomainDao {
+    private static final Logger s_logger = Logger.getLogger(DomainDaoImpl.class);
+    
+	protected SearchBuilder<DomainVO> DomainNameLikeSearch;
+	protected SearchBuilder<DomainVO> ParentDomainNameLikeSearch;
+	protected SearchBuilder<DomainVO> DomainPairSearch;
+	protected SearchBuilder<DomainVO> ImmediateChildDomainSearch;
+	protected SearchBuilder<DomainVO> FindAllChildrenSearch;
+	protected SearchBuilder<DomainVO> AllFieldsSearch;
+	
+	public DomainDaoImpl () {
+		DomainNameLikeSearch = createSearchBuilder();
+		DomainNameLikeSearch.and("name", DomainNameLikeSearch.entity().getName(), SearchCriteria.Op.LIKE);
+		DomainNameLikeSearch.done();
+		
+		ParentDomainNameLikeSearch = createSearchBuilder();
+		ParentDomainNameLikeSearch.and("name", ParentDomainNameLikeSearch.entity().getName(), SearchCriteria.Op.LIKE);
+		ParentDomainNameLikeSearch.and("parent", ParentDomainNameLikeSearch.entity().getName(), SearchCriteria.Op.EQ);
+		ParentDomainNameLikeSearch.done();
+
+		DomainPairSearch = createSearchBuilder();
+		DomainPairSearch.and("id", DomainPairSearch.entity().getId(), SearchCriteria.Op.IN);
+		DomainPairSearch.done();
+
+		ImmediateChildDomainSearch = createSearchBuilder();
+		ImmediateChildDomainSearch.and("parent", ImmediateChildDomainSearch.entity().getParent(), SearchCriteria.Op.EQ);
+		ImmediateChildDomainSearch.done();
+		
+		FindAllChildrenSearch = createSearchBuilder();
+		FindAllChildrenSearch.and("path", FindAllChildrenSearch.entity().getPath(), SearchCriteria.Op.LIKE);
+		FindAllChildrenSearch.and("id", FindAllChildrenSearch.entity().getId(), SearchCriteria.Op.NEQ);
+		FindAllChildrenSearch.done();
+		
+		AllFieldsSearch = createSearchBuilder();
+		AllFieldsSearch.and("name", AllFieldsSearch.entity().getName(), SearchCriteria.Op.EQ);
+		AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), SearchCriteria.Op.EQ);
+		AllFieldsSearch.and("owner", AllFieldsSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+		AllFieldsSearch.and("path", AllFieldsSearch.entity().getPath(), SearchCriteria.Op.EQ);
+		AllFieldsSearch.and("parent", AllFieldsSearch.entity().getParent(), SearchCriteria.Op.EQ);
+		AllFieldsSearch.done();
+
+	}
+	
+    
+    private static String allocPath(DomainVO parentDomain, String name) {
+        String parentPath = parentDomain.getPath();
+        return parentPath + name + "/";
+    }
+
+    @Override
+    public synchronized DomainVO create(DomainVO domain) {
+        // make sure domain name is valid
+        String domainName = domain.getName();
+        if (domainName != null) {
+            if (domainName.contains("/")) {
+                throw new IllegalArgumentException("Domain name contains one or more invalid characters.  Please enter a name without '/' characters.");
+            }
+        } else {
+            throw new IllegalArgumentException("Domain name is null.  Please specify a valid domain name.");
+        }
+
+    	long parent = DomainVO.ROOT_DOMAIN;
+    	if(domain.getParent() != null && domain.getParent().longValue() >= DomainVO.ROOT_DOMAIN) {
+    		parent = domain.getParent().longValue();
+    	}
+    	
+    	DomainVO parentDomain = findById(parent);
+    	if(parentDomain == null) {
+            s_logger.error("Unable to load parent domain: " + parent);
+    		return null;
+    	}
+    	
+        Transaction txn = Transaction.currentTxn();
+    	try {
+    		txn.start();
+
+    		parentDomain = this.lockRow(parent, true);
+            if(parentDomain == null) {
+                s_logger.error("Unable to lock parent domain: " + parent);
+                return null;
+            }
+    		
+            domain.setPath(allocPath(parentDomain, domain.getName()));
+            domain.setLevel(parentDomain.getLevel() + 1);
+            
+            parentDomain.setNextChildSeq(parentDomain.getNextChildSeq() + 1); // FIXME:  remove sequence number?
+            parentDomain.setChildCount(parentDomain.getChildCount() + 1);
+            persist(domain);
+            update(parentDomain.getId(), parentDomain);
+            
+    		txn.commit();
+    		return domain;
+    	} catch(Exception e) {
+    		s_logger.error("Unable to create domain due to " + e.getMessage(), e);
+    		txn.rollback();
+    		return null;
+    	} 
+    }
+
+    @Override
+    @DB
+    public boolean remove(Long id) {
+        // check for any active users / domains assigned to the given domain id and don't remove the domain if there are any
+    	if (id != null && id.longValue() == DomainVO.ROOT_DOMAIN) {
+    		s_logger.error("Can not remove domain " + id + " as it is ROOT domain");
+    		return false;
+    	}
+    	
+        DomainVO domain = findById(id);
+        if(domain == null) {
+        	s_logger.error("Unable to remove domain as domain " + id + " no longer exists");
+        	return false;
+        }
+        
+        if(domain.getParent() == null) {
+        	s_logger.error("Invalid domain " + id + ", orphan?");
+        	return false;
+        }
+    	
+        String sql = "SELECT * from account where domain_id = " + id + " and removed is null";
+        String sql1 = "SELECT * from domain where parent = " + id + " and removed is null";
+
+        boolean success = false;
+        Transaction txn = Transaction.currentTxn();
+        try {
+        	txn.start();
+            DomainVO parentDomain = super.lockRow(domain.getParent(), true);
+            if(parentDomain == null) {
+                s_logger.error("Unable to load parent domain: " + domain.getParent());
+                return false;
+            }
+        	
+            PreparedStatement stmt = txn.prepareAutoCloseStatement(sql);
+            ResultSet rs = stmt.executeQuery();
+            if (rs.next()) {
+                return false;
+            }
+            stmt = txn.prepareAutoCloseStatement(sql1);
+            rs = stmt.executeQuery();
+            if (rs.next()) {
+                return false;
+            }
+            
+        	parentDomain.setChildCount(parentDomain.getChildCount() - 1);
+        	update(parentDomain.getId(), parentDomain);
+            success = super.remove(id);
+            txn.commit();
+        } catch (SQLException ex) {
+            success = false;
+            s_logger.error("error removing domain: " + id, ex);
+            txn.rollback();
+        } 
+        return success;
+    }
+
+    @Override
+    public DomainVO findDomainByPath(String domainPath) {
+        SearchCriteria<DomainVO> sc = createSearchCriteria();
+        sc.addAnd("path", SearchCriteria.Op.EQ, domainPath);
+        return findOneBy(sc);
+    }
+    
+    @Override
+    public DomainVO findImmediateChildForParent(Long parentId){
+        SearchCriteria<DomainVO> sc = ImmediateChildDomainSearch.create();
+    	sc.setParameters("parent", parentId);
+    	return (listBy(sc).size() > 0 ? listBy(sc).get(0) : null);//may need to revisit for multiple children case
+    }
+
+    @Override
+    public List<DomainVO> findImmediateChildrenForParent(Long parentId){
+        SearchCriteria<DomainVO> sc = ImmediateChildDomainSearch.create();
+    	sc.setParameters("parent", parentId);
+    	return listBy(sc);
+    }
+
+    @Override
+    public List<DomainVO> findAllChildren(String path, Long parentId){
+    	SearchCriteria<DomainVO> sc = FindAllChildrenSearch.create();
+    	sc.setParameters("path", "%"+path+"%");
+    	sc.setParameters("id", parentId);
+    	return listBy(sc);
+    }
+    
+    @Override
+    public boolean isChildDomain(Long parentId, Long childId) {
+        if ((parentId == null) || (childId == null)) {
+            return false;
+        }
+
+        if (parentId.equals(childId)) {
+            return true;
+        }
+
+        boolean result = false;
+        SearchCriteria<DomainVO> sc = DomainPairSearch.create();
+        sc.setParameters("id", parentId, childId);
+
+        List<DomainVO> domainPair = listBy(sc);
+
+        if ((domainPair != null) && (domainPair.size() == 2)) {
+            DomainVO d1 = domainPair.get(0);
+            DomainVO d2 = domainPair.get(1);
+
+            if (d1.getId() == parentId) {
+                result = d2.getPath().startsWith(d1.getPath());
+            } else {
+                result = d1.getPath().startsWith(d2.getPath());
+            }
+        }
+        return result;
+    }
+    
+    @Override
+    public List<DomainVO> findInactiveDomains() {
+        SearchCriteria<DomainVO> sc = AllFieldsSearch.create();
+        sc.setParameters("state", Domain.State.Inactive);
+        return listBy(sc);
+    }
+    
+    @Override
+    public Set<Long> getDomainParentIds(long domainId) {
+        Set<Long> parentDomains = new HashSet<Long>();
+        Domain domain = findById(domainId);
+
+        if (domain != null) {
+            parentDomains.add(domain.getId());
+
+            while (domain.getParent() != null) {
+                domain = findById(domain.getParent());
+                parentDomains.add(domain.getId());
+            }
+        }
+        
+        return parentDomains;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/event/EventVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/EventVO.java b/engine/schema/src/com/cloud/event/EventVO.java
new file mode 100644
index 0000000..2c30ead
--- /dev/null
+++ b/engine/schema/src/com/cloud/event/EventVO.java
@@ -0,0 +1,194 @@
+// 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.event;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import com.cloud.utils.db.GenericDao;
+
+@Entity
+@Table(name="event")
+public class EventVO implements Event {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id = -1;
+
+    @Column(name="type")
+    private String type;
+
+    @Enumerated(value=EnumType.STRING)
+    @Column(name="state")
+    private State state = State.Completed;
+
+    @Column(name="description", length=1024)
+    private String description;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    private Date createDate;
+
+    @Column(name="user_id")
+    private long userId;
+
+    @Column(name="account_id")
+    private long accountId;
+
+    @Column(name="domain_id")
+    private long domainId;
+
+    @Column(name="level")
+    private String level = LEVEL_INFO;
+
+    @Column(name="start_id")
+    private long startId;
+
+    @Column(name="parameters", length=1024)
+    private String parameters;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    @Column(name="archived")
+    private boolean archived;
+
+    @Transient
+    private int totalSize;
+
+    public static final String LEVEL_INFO = "INFO";
+    public static final String LEVEL_WARN = "WARN";
+    public static final String LEVEL_ERROR = "ERROR";
+
+    public EventVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public long getId() {
+        return id;
+    }
+    @Override
+    public String getType() {
+        return type;
+    }
+    public void setType(String type) {
+        this.type = type;
+    }
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    public void setState(State state) {
+        this.state = state;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+    public void setDescription(String description) {
+        this.description = description;
+    }
+    @Override
+    public Date getCreateDate() {
+        return createDate;
+    }
+    public void setCreatedDate(Date createdDate) {
+        createDate = createdDate;
+    }
+    @Override
+    public long getUserId() {
+        return userId;
+    }
+    public void setUserId(long userId) {
+        this.userId = userId;
+    }
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+    public void setAccountId(long accountId) {
+        this.accountId = accountId;
+    }
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+	public void setDomainId(long domainId) {
+		this.domainId = domainId;
+	}
+
+	@Override
+    public int getTotalSize() {
+		return totalSize;
+	}
+	public void setTotalSize(int totalSize) {
+		this.totalSize = totalSize;
+	}
+	@Override
+    public String getLevel() {
+		return level;
+	}
+	public void setLevel(String level) {
+		this.level = level;
+	}
+	@Override
+    public long getStartId() {
+        return startId;
+    }
+
+    public void setStartId(long startId) {
+        this.startId = startId;
+    }
+
+    @Override
+    public String getParameters() {
+        return parameters;
+    }
+    public void setParameters(String parameters) {
+        this.parameters = parameters;
+    }
+
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    @Override
+    public boolean getArchived() {
+        return archived;
+    }
+
+    public void setArchived(Boolean archived) {
+        this.archived = archived;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/event/UsageEventVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/UsageEventVO.java b/engine/schema/src/com/cloud/event/UsageEventVO.java
new file mode 100644
index 0000000..c92972b
--- /dev/null
+++ b/engine/schema/src/com/cloud/event/UsageEventVO.java
@@ -0,0 +1,216 @@
+// 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.event;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="usage_event")
+public class UsageEventVO implements UsageEvent {
+	@Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+	private long id = -1;
+
+	@Column(name="type")
+	private String type;
+	
+	@Column(name=GenericDao.CREATED_COLUMN)
+	private Date createDate;
+
+	@Column(name="account_id")
+	private long accountId;
+
+    @Column(name="zone_id")
+	private long zoneId;
+
+    @Column(name="resource_id")
+    private long resourceId;
+
+    @Column(name="resource_name")
+    private String resourceName;
+    
+    @Column(name="offering_id")
+    private Long offeringId;
+    
+    @Column(name="template_id")
+    private Long templateId;
+
+    @Column(name="size")
+    private Long size;
+    
+    @Column(name="resource_type")
+    private String resourceType;
+    
+    @Column(name="processed")
+    boolean processed;
+
+    
+	public UsageEventVO() {
+	}
+	
+	public UsageEventVO(String usageType, long accountId, long zoneId, long resourceId, String resourceName, Long offeringId, Long templateId, Long size) {
+	    this.type = usageType;
+	    this.accountId = accountId;
+	    this.zoneId = zoneId;
+	    this.resourceId = resourceId;
+	    this.resourceName = resourceName;
+	    this.offeringId = offeringId;
+	    this.templateId = templateId;
+	    this.size = size;
+	}
+	
+    public UsageEventVO(String usageType, long accountId, long zoneId, long resourceId, String resourceName) {
+        this.type = usageType;
+        this.accountId = accountId;
+        this.zoneId = zoneId;
+        this.resourceId = resourceId;
+        this.resourceName = resourceName;
+    }
+	
+    //IPAddress usage event
+	public UsageEventVO(String usageType, long accountId, long zoneId, long ipAddressId, String ipAddress, boolean isSourceNat, String guestType, boolean isSystem) {
+	    this.type = usageType;
+        this.accountId = accountId;
+        this.zoneId = zoneId;
+        this.resourceId = ipAddressId;
+        this.resourceName = ipAddress;
+        this.size = (isSourceNat ? 1L : 0L);
+        this.resourceType = guestType;
+        this.templateId = (isSystem ? 1L : 0L);
+    }
+	
+	public UsageEventVO(String usageType, long accountId, long zoneId, long resourceId, String resourceName, Long offeringId, Long templateId, String resourceType) {
+	    this.type = usageType;
+	    this.accountId = accountId;
+	    this.zoneId = zoneId;
+	    this.resourceId = resourceId;
+	    this.resourceName = resourceName;
+	    this.offeringId = offeringId;
+	    this.templateId = templateId;
+	    this.resourceType = resourceType;
+	}
+	
+	//Security Group usage event
+	public UsageEventVO(String usageType, long accountId,
+			long zoneId, long vmId, long securityGroupId) {
+	    this.type = usageType;
+	    this.accountId = accountId;
+	    this.zoneId = zoneId;
+	    this.resourceId = vmId;
+	    this.offeringId = securityGroupId;
+	}
+
+	@Override
+    public long getId() {
+		return id;
+	}
+	@Override
+    public String getType() {
+		return type;
+	}
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	@Override
+    public Date getCreateDate() {
+		return createDate;
+	}
+	public void setCreatedDate(Date createdDate) {
+	    createDate = createdDate;
+	}
+	
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+    public void setAccountId(long accountId) {
+        this.accountId = accountId;
+    }
+
+    public void setZoneId(long zoneId) {
+        this.zoneId = zoneId;
+    }
+    @Override
+    public long getZoneId() {
+        return zoneId;
+    }
+
+    public void setResourceId(long resourceId) {
+        this.resourceId = resourceId;
+    }
+    @Override
+    public long getResourceId() {
+        return resourceId;
+    }
+    
+    public void setResourceName(String resourceName) {
+        this.resourceName = resourceName;
+    }
+
+    public String getResourceName() {
+        return resourceName;
+    }
+
+    public void setOfferingId(long offeringId) {
+        this.offeringId = offeringId;
+    }
+    @Override
+    public Long getOfferingId() {
+        return offeringId;
+    }
+
+    public void setTemplateId(long templateId) {
+        this.templateId = templateId;
+    }
+    @Override
+    public Long getTemplateId() {
+        return templateId;
+    }
+
+    public void setSize(long size) {
+        this.size = size;
+    }
+    @Override
+    public Long getSize() {
+        return size;
+    }
+
+    public boolean isProcessed() {
+        return processed;
+    }
+
+    public void setProcessed(boolean processed) {
+        this.processed = processed;
+    }
+    
+    public String getResourceType() {
+        return resourceType;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/event/dao/EventDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/dao/EventDao.java b/engine/schema/src/com/cloud/event/dao/EventDao.java
new file mode 100644
index 0000000..da5f47a
--- /dev/null
+++ b/engine/schema/src/com/cloud/event/dao/EventDao.java
@@ -0,0 +1,38 @@
+// 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.event.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import com.cloud.event.EventVO;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.db.SearchCriteria;
+
+public interface EventDao extends GenericDao<EventVO, Long> {
+    public List<EventVO> searchAllEvents(SearchCriteria<EventVO> sc, Filter filter);
+
+    public List<EventVO> listOlderEvents(Date oldTime);
+
+    EventVO findCompletedEvent(long startId);
+
+    public List<EventVO> listToArchiveOrDeleteEvents(List<Long> ids, String type, Date olderThan, Long accountId);
+
+    public void archiveEvents(List<EventVO> events);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java b/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
new file mode 100644
index 0000000..6ba59c5
--- /dev/null
+++ b/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
@@ -0,0 +1,109 @@
+// 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.event.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.event.Event.State;
+import com.cloud.event.EventVO;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value={EventDao.class})
+public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements EventDao {
+    public static final Logger s_logger = Logger.getLogger(EventDaoImpl.class.getName());
+    protected final SearchBuilder<EventVO> CompletedEventSearch;
+    protected final SearchBuilder<EventVO> ToArchiveOrDeleteEventSearch;
+
+    public EventDaoImpl () {
+        CompletedEventSearch = createSearchBuilder();
+        CompletedEventSearch.and("state",CompletedEventSearch.entity().getState(),SearchCriteria.Op.EQ);
+        CompletedEventSearch.and("startId", CompletedEventSearch.entity().getStartId(), SearchCriteria.Op.EQ);
+        CompletedEventSearch.done();
+
+        ToArchiveOrDeleteEventSearch = createSearchBuilder();
+        ToArchiveOrDeleteEventSearch.and("id", ToArchiveOrDeleteEventSearch.entity().getId(), Op.IN);
+        ToArchiveOrDeleteEventSearch.and("type", ToArchiveOrDeleteEventSearch.entity().getType(), Op.EQ);
+        ToArchiveOrDeleteEventSearch.and("accountId", ToArchiveOrDeleteEventSearch.entity().getAccountId(), Op.EQ);
+        ToArchiveOrDeleteEventSearch.and("createDateL", ToArchiveOrDeleteEventSearch.entity().getCreateDate(), Op.LT);
+        ToArchiveOrDeleteEventSearch.done();
+    }
+
+    @Override
+    public List<EventVO> searchAllEvents(SearchCriteria<EventVO> sc, Filter filter) {
+        return listIncludingRemovedBy(sc, filter);
+    }
+
+    @Override
+    public List<EventVO> listOlderEvents(Date oldTime) {
+        if (oldTime == null) return null;
+        SearchCriteria<EventVO> sc = createSearchCriteria();
+        sc.addAnd("createDate", SearchCriteria.Op.LT, oldTime);
+        return listIncludingRemovedBy(sc, null);
+    }
+
+    @Override
+    public EventVO findCompletedEvent(long startId) {
+        SearchCriteria<EventVO> sc = CompletedEventSearch.create();
+        sc.setParameters("state", State.Completed);
+        sc.setParameters("startId", startId);
+        return findOneIncludingRemovedBy(sc);
+    }
+
+    @Override
+    public List<EventVO> listToArchiveOrDeleteEvents(List<Long> ids, String type, Date olderThan, Long accountId) {
+        SearchCriteria<EventVO> sc = ToArchiveOrDeleteEventSearch.create();
+        if (ids != null) {
+            sc.setParameters("id", ids.toArray(new Object[ids.size()]));
+        }
+        if (type != null) {
+            sc.setParameters("type", type);
+        }
+        if (olderThan != null) {
+            sc.setParameters("createDateL", olderThan);
+        }
+        if (accountId != null) {
+            sc.setParameters("accountId", accountId);
+        }
+        return search(sc, null);
+    }
+
+    @Override
+    public void archiveEvents(List<EventVO> events) {
+
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        for (EventVO event : events) {
+            event = lockRow(event.getId(), true);
+            event.setArchived(true);
+            update(event.getId(), event);
+            txn.commit();
+        }
+        txn.close();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/event/dao/UsageEventDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/dao/UsageEventDao.java b/engine/schema/src/com/cloud/event/dao/UsageEventDao.java
new file mode 100644
index 0000000..01979e1
--- /dev/null
+++ b/engine/schema/src/com/cloud/event/dao/UsageEventDao.java
@@ -0,0 +1,35 @@
+// 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.event.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import com.cloud.event.UsageEventVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface UsageEventDao extends GenericDao<UsageEventVO, Long> {
+
+    public List<UsageEventVO> listLatestEvents(Date endDate);
+
+    public List<UsageEventVO> getLatestEvent();
+
+    List<UsageEventVO> getRecentEvents(Date endDate);
+
+    List<UsageEventVO> listDirectIpEvents(Date startDate, Date endDate, long zoneId);
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java b/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java
new file mode 100644
index 0000000..004ab7c
--- /dev/null
+++ b/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java
@@ -0,0 +1,187 @@
+// 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.event.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Date;
+import java.util.List;
+import java.util.TimeZone;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.Vlan;
+import com.cloud.event.EventTypes;
+import com.cloud.event.UsageEventVO;
+import com.cloud.utils.DateUtil;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Component
+@Local(value={UsageEventDao.class})
+public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implements UsageEventDao {
+    public static final Logger s_logger = Logger.getLogger(UsageEventDaoImpl.class.getName());
+
+    private final SearchBuilder<UsageEventVO> latestEventsSearch;
+    private final SearchBuilder<UsageEventVO> IpeventsSearch;
+    private static final String COPY_EVENTS = "INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type) " +
+    		"SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type FROM cloud.usage_event vmevt WHERE vmevt.id > ? and vmevt.id <= ? ";
+    private static final String COPY_ALL_EVENTS = "INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type) " +
+    		"SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type FROM cloud.usage_event vmevt WHERE vmevt.id <= ?";
+    private static final String MAX_EVENT = "select max(id) from cloud.usage_event where created <= ?";
+
+
+    public UsageEventDaoImpl () {
+        latestEventsSearch = createSearchBuilder();
+        latestEventsSearch.and("processed", latestEventsSearch.entity().isProcessed(), SearchCriteria.Op.EQ);
+        latestEventsSearch.and("enddate", latestEventsSearch.entity().getCreateDate(), SearchCriteria.Op.LTEQ);
+        latestEventsSearch.done();
+
+        IpeventsSearch = createSearchBuilder();
+        IpeventsSearch.and("startdate", IpeventsSearch.entity().getCreateDate(), SearchCriteria.Op.GTEQ);
+        IpeventsSearch.and("enddate", IpeventsSearch.entity().getCreateDate(), SearchCriteria.Op.LTEQ);
+        IpeventsSearch.and("zoneid", IpeventsSearch.entity().getZoneId(), SearchCriteria.Op.EQ);
+        IpeventsSearch.and("networktype", IpeventsSearch.entity().getResourceType(), SearchCriteria.Op.EQ);
+        IpeventsSearch.and().op("assignEvent", IpeventsSearch.entity().getType(), SearchCriteria.Op.EQ);
+        IpeventsSearch.or("releaseEvent", IpeventsSearch.entity().getType(), SearchCriteria.Op.EQ);
+        IpeventsSearch.closeParen();
+        IpeventsSearch.done();
+    }
+
+    @Override
+    public List<UsageEventVO> listLatestEvents(Date endDate) {
+        Filter filter = new Filter(UsageEventVO.class, "createDate", Boolean.TRUE, null, null);
+        SearchCriteria<UsageEventVO> sc = latestEventsSearch.create();
+        sc.setParameters("processed", false);
+        sc.setParameters("enddate", endDate);
+        return listBy(sc, filter);
+    }
+
+    @Override
+    public List<UsageEventVO> getLatestEvent() {
+        Filter filter = new Filter(UsageEventVO.class, "id", Boolean.FALSE, Long.valueOf(0), Long.valueOf(1));
+        return listAll(filter);
+    }
+
+    @Override
+    @DB
+    public synchronized List<UsageEventVO> getRecentEvents(Date endDate) {
+        long recentEventId = getMostRecentEventId();
+        long maxEventId = getMaxEventId(endDate);
+        Transaction txn = Transaction.open(Transaction.USAGE_DB);
+        String sql = COPY_EVENTS;
+        if (recentEventId == 0) {
+            if (s_logger.isDebugEnabled()) {
+                s_logger.debug("no recent event date, copying all events");
+            }
+            sql = COPY_ALL_EVENTS;
+        }
+
+        PreparedStatement pstmt = null;
+        try {
+            txn.start();
+            pstmt = txn.prepareAutoCloseStatement(sql);
+            int i = 1;
+            if (recentEventId != 0) {
+                pstmt.setLong(i++, recentEventId);
+            }
+            pstmt.setLong(i++, maxEventId);
+            pstmt.executeUpdate();
+            txn.commit();
+            return findRecentEvents(endDate);
+        } catch (Exception ex) {
+            txn.rollback();
+            s_logger.error("error copying events from cloud db to usage db", ex);
+            throw new CloudRuntimeException(ex.getMessage());
+        }
+    }
+
+    @DB
+    private long getMostRecentEventId() {
+        Transaction txn = Transaction.open(Transaction.USAGE_DB);
+        try {
+            List<UsageEventVO> latestEvents = getLatestEvent();
+
+            if(latestEvents !=null && latestEvents.size() == 1){
+                UsageEventVO latestEvent = latestEvents.get(0);
+                if(latestEvent != null){
+                    return latestEvent.getId();
+                }
+            }
+            return 0;
+        } catch (Exception ex) {
+            s_logger.error("error getting most recent event id", ex);
+            throw new CloudRuntimeException(ex.getMessage());
+        } finally {
+            txn.close();
+        }
+    }
+
+    private List<UsageEventVO> findRecentEvents(Date endDate) {
+        Transaction txn = Transaction.open(Transaction.USAGE_DB);
+        try {
+            return listLatestEvents(endDate);
+        } catch (Exception ex) {
+            s_logger.error("error getting most recent event date", ex);
+            throw new CloudRuntimeException(ex.getMessage());
+        } finally {
+            txn.close();
+        }
+    }
+
+    private long getMaxEventId(Date endDate) {
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        try {
+            String sql = MAX_EVENT;
+            pstmt = txn.prepareAutoCloseStatement(sql);
+            pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), endDate));
+            ResultSet rs = pstmt.executeQuery();
+            if (rs.next()) {
+                return Long.valueOf(rs.getLong(1));
+            }
+            return 0;
+        } catch (Exception ex) {
+            s_logger.error("error getting max event id", ex);
+            throw new CloudRuntimeException(ex.getMessage());
+        } finally {
+            txn.close();
+        }
+    }
+
+    @Override
+    public List<UsageEventVO> listDirectIpEvents(Date startDate, Date endDate, long zoneId) {
+        Filter filter = new Filter(UsageEventVO.class, "createDate", Boolean.TRUE, null, null);
+        SearchCriteria<UsageEventVO> sc = IpeventsSearch.create();
+        sc.setParameters("startdate", startDate);
+        sc.setParameters("enddate", endDate);
+        sc.setParameters("assignEvent", EventTypes.EVENT_NET_IP_ASSIGN);
+        sc.setParameters("releaseEvent", EventTypes.EVENT_NET_IP_RELEASE);
+        sc.setParameters("zoneid", zoneId);
+        sc.setParameters("networktype", Vlan.VlanType.DirectAttached.toString());
+        return listBy(sc, filter);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/host/DetailVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/DetailVO.java b/engine/schema/src/com/cloud/host/DetailVO.java
new file mode 100644
index 0000000..4e62490
--- /dev/null
+++ b/engine/schema/src/com/cloud/host/DetailVO.java
@@ -0,0 +1,73 @@
+// 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.host;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="host_details")
+public class DetailVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+    @Column(name="host_id")
+    private long hostId;
+    
+    @Column(name="name")
+    private String name;
+    
+    @Column(name="value")
+    private String value;
+    
+    protected DetailVO() {
+    }
+    
+    public DetailVO(long hostId, String name, String value) {
+        this.hostId = hostId;
+        this.name = name;
+        this.value = value;
+    }
+
+    public long getHostId() {
+        return hostId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public long getId() {
+        return id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/host/HostTagVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/HostTagVO.java b/engine/schema/src/com/cloud/host/HostTagVO.java
new file mode 100644
index 0000000..b1f5ace
--- /dev/null
+++ b/engine/schema/src/com/cloud/host/HostTagVO.java
@@ -0,0 +1,65 @@
+// 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.host;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="host_tags")
+public class HostTagVO implements InternalIdentity {
+	@Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+    @Column(name="host_id")
+    private long hostId;
+    
+    @Column(name="tag")
+    private String tag;
+    
+    protected HostTagVO() {
+    }
+    
+    public HostTagVO(long hostId, String tag) {
+        this.hostId = hostId;
+        this.tag = tag;
+    }
+
+    public long getHostId() {
+        return hostId;
+    }
+
+    public String getTag() {
+        return tag;
+    }
+
+    public void setTag(String tag) {
+        this.tag = tag;
+    }
+
+    public long getId() {
+        return id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/host/HostVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/HostVO.java b/engine/schema/src/com/cloud/host/HostVO.java
new file mode 100755
index 0000000..c814b94
--- /dev/null
+++ b/engine/schema/src/com/cloud/host/HostVO.java
@@ -0,0 +1,732 @@
+// 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.host;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.DiscriminatorType;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.resource.ResourceState;
+import com.cloud.storage.Storage.StoragePoolType;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="host")
+@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
+@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32)
+public class HostVO implements Host {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="disconnected")
+    @Temporal(value=TemporalType.TIMESTAMP)
+    private Date disconnectedOn;
+
+    @Column(name="name", nullable=false)
+    private String name = null;
+
+    /**
+     * Note: There is no setter for status because it has to be set in the dao code.
+     */
+    @Column(name="status", nullable=false)
+    private Status status = null;
+
+    @Column(name="type", updatable = true, nullable=false)
+    @Enumerated(value=EnumType.STRING)
+    private Type type;
+
+    @Column(name="private_ip_address", nullable=false)
+    private String privateIpAddress;
+
+    @Column(name="private_mac_address", nullable=false)
+    private String privateMacAddress;
+
+    @Column(name="private_netmask", nullable=false)
+    private String privateNetmask;
+
+    @Column(name="public_netmask")
+    private String publicNetmask;
+
+    @Column(name="public_ip_address")
+    private String publicIpAddress;
+
+    @Column(name="public_mac_address")
+    private String publicMacAddress;
+
+    @Column(name="storage_ip_address")
+    private String storageIpAddress;
+
+    @Column(name="cluster_id")
+    private Long clusterId;
+
+    @Column(name="storage_netmask")
+    private String storageNetmask;
+
+    @Column(name="storage_mac_address")
+    private String storageMacAddress;
+
+    @Column(name="storage_ip_address_2")
+    private String storageIpAddressDeux;
+
+    @Column(name="storage_netmask_2")
+    private String storageNetmaskDeux;
+
+    @Column(name="storage_mac_address_2")
+    private String storageMacAddressDeux;
+
+    @Column(name="hypervisor_type", updatable = true, nullable=false)
+    @Enumerated(value=EnumType.STRING)
+    private HypervisorType hypervisorType;
+
+    @Column(name="proxy_port")
+    private Integer proxyPort;
+
+    @Column(name="resource")
+    private String resource;
+
+    @Column(name="fs_type")
+    private StoragePoolType fsType;
+
+    @Column(name="available")
+    private boolean available = true;
+
+    @Column(name="setup")
+    private boolean setup = false;
+
+    @Column(name="resource_state", nullable=false)
+    @Enumerated(value=EnumType.STRING)
+    private ResourceState resourceState;
+
+    @Column(name="hypervisor_version")
+    private String hypervisorVersion;
+
+    @Column(name="update_count", updatable = true, nullable=false)
+    protected long updated;	// This field should be updated everytime the state is updated.  There's no set method in the vo object because it is done with in the dao code.
+
+    @Column(name="uuid")
+    private String uuid;
+
+    // This is a delayed load value.  If the value is null,
+    // then this field has not been loaded yet.
+    // Call host dao to load it.
+    @Transient
+    Map<String, String> details;
+
+    // This is a delayed load value.  If the value is null,
+    // then this field has not been loaded yet.
+    // Call host dao to load it.
+    @Transient
+    List<String> hostTags;
+
+    @Override
+    public String getStorageIpAddressDeux() {
+        return storageIpAddressDeux;
+    }
+
+    public void setStorageIpAddressDeux(String deuxStorageIpAddress) {
+        this.storageIpAddressDeux = deuxStorageIpAddress;
+    }
+
+    @Override
+    public String getStorageNetmaskDeux() {
+        return storageNetmaskDeux;
+    }
+
+    @Override
+    public Long getClusterId() {
+        return clusterId;
+    }
+
+    public void setClusterId(Long clusterId) {
+        this.clusterId = clusterId;
+    }
+
+    public void setStorageNetmaskDeux(String deuxStorageNetmask) {
+        this.storageNetmaskDeux = deuxStorageNetmask;
+    }
+
+    @Override
+    public String getStorageMacAddressDeux() {
+        return storageMacAddressDeux;
+    }
+
+    public void setStorageMacAddressDeux(String duexStorageMacAddress) {
+        this.storageMacAddressDeux = duexStorageMacAddress;
+    }
+
+    @Override
+    public String getPrivateMacAddress() {
+        return privateMacAddress;
+    }
+
+    public void setPrivateMacAddress(String privateMacAddress) {
+        this.privateMacAddress = privateMacAddress;
+    }
+
+    public boolean isAvailable() {
+        return available;
+    }
+
+    public void setAvailable(boolean available) {
+        this.available = available;
+    }
+
+    @Override
+    public String getPrivateNetmask() {
+        return privateNetmask;
+    }
+
+    public void setPrivateNetmask(String privateNetmask) {
+        this.privateNetmask = privateNetmask;
+    }
+
+    @Override
+    public String getPublicNetmask() {
+        return publicNetmask;
+    }
+
+    public void setPublicNetmask(String publicNetmask) {
+        this.publicNetmask = publicNetmask;
+    }
+
+    @Override
+    public String getPublicIpAddress() {
+        return publicIpAddress;
+    }
+
+    public void setPublicIpAddress(String publicIpAddress) {
+        this.publicIpAddress = publicIpAddress;
+    }
+
+    @Override
+    public String getPublicMacAddress() {
+        return publicMacAddress;
+    }
+
+    public void setPublicMacAddress(String publicMacAddress) {
+        this.publicMacAddress = publicMacAddress;
+    }
+
+    @Override
+    public String getStorageIpAddress() {
+        return storageIpAddress;
+    }
+
+    public void setStorageIpAddress(String storageIpAddress) {
+        this.storageIpAddress = storageIpAddress;
+    }
+
+    @Override
+    public String getStorageNetmask() {
+        return storageNetmask;
+    }
+
+    public void setStorageNetmask(String storageNetmask) {
+        this.storageNetmask = storageNetmask;
+    }
+
+    @Override
+    public String getStorageMacAddress() {
+        return storageMacAddress;
+    }
+
+    public boolean isSetup() {
+        return setup;
+    }
+
+    public void setSetup(boolean setup) {
+        this.setup = setup;
+    }
+
+    public void setStorageMacAddress(String storageMacAddress) {
+        this.storageMacAddress = storageMacAddress;
+    }
+
+    public String getResource() {
+        return resource;
+    }
+
+    public void setResource(String resource) {
+        this.resource = resource;
+    }
+
+    public Map<String, String> getDetails() {
+        return details;
+    }
+
+    public String getDetail(String name) {
+        assert (details != null) : "Did you forget to load the details?";
+
+        return details != null ? details.get(name) : null;
+    }
+
+    public void setDetail(String name, String value) {
+        assert (details != null) : "Did you forget to load the details?";
+
+        details.put(name, value);
+    }
+
+    public void setDetails(Map<String, String> details) {
+        this.details = details;
+    }
+
+    public List<String> getHostTags() {
+        return hostTags;
+    }
+
+    public void setHostTags(List<String> hostTags) {
+        this.hostTags = hostTags;
+    }
+
+    @Column(name="data_center_id", nullable=false)
+    private long dataCenterId;
+
+    @Column(name="pod_id")
+    private Long podId;
+
+    @Column(name="cpus")
+    private Integer cpus;
+
+    @Column(name="url")
+    private String storageUrl;
+
+    @Column(name="speed")
+    private Long speed;
+
+    @Column(name="ram")
+    private long totalMemory;
+
+    @Column(name="parent", nullable=false)
+    private String parent;
+
+    @Column(name="guid", updatable=true, nullable=false)
+    private String guid;
+
+    @Column(name="capabilities")
+    private String caps;
+
+    @Column(name="total_size")
+    private Long totalSize;
+
+    @Column(name="last_ping")
+    private long lastPinged;
+
+    @Column(name="mgmt_server_id")
+    private Long managementServerId;
+
+    @Column(name="dom0_memory")
+    private long dom0MinMemory;
+
+    @Column(name="version")
+    private String version;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    private Date created;
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+
+    public HostVO(String guid) {
+        this.guid = guid;
+        this.status = Status.Creating;
+        this.totalMemory = 0;
+        this.dom0MinMemory = 0;
+        this.resourceState = ResourceState.Creating;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    protected HostVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public HostVO(long id,
+            String name,
+            Type type,
+            String privateIpAddress,
+            String privateNetmask,
+            String privateMacAddress,
+            String publicIpAddress,
+            String publicNetmask,
+            String publicMacAddress,
+            String storageIpAddress,
+            String storageNetmask,
+            String storageMacAddress,
+            String deuxStorageIpAddress,
+            String duxStorageNetmask,
+            String deuxStorageMacAddress,
+            String guid,
+            Status status,
+            String version,
+            String iqn,
+            Date disconnectedOn,
+            long dcId,
+            Long podId,
+            long serverId,
+            long ping,
+            String parent,
+            long totalSize,
+            StoragePoolType fsType) {
+        this(id, name, type, privateIpAddress, privateNetmask, privateMacAddress, publicIpAddress, publicNetmask, publicMacAddress, storageIpAddress, storageNetmask, storageMacAddress, guid, status, version, iqn, disconnectedOn, dcId, podId, serverId, ping, null, null, null, 0, null);
+        this.parent = parent;
+        this.totalSize = totalSize;
+        this.fsType = fsType;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public HostVO(long id,
+            String name,
+            Type type,
+            String privateIpAddress,
+            String privateNetmask,
+            String privateMacAddress,
+            String publicIpAddress,
+            String publicNetmask,
+            String publicMacAddress,
+            String storageIpAddress,
+            String storageNetmask,
+            String storageMacAddress,
+            String guid,
+            Status status,
+            String version,
+            String url,
+            Date disconnectedOn,
+            long dcId,
+            Long podId,
+            long serverId,
+            long ping,
+            Integer cpus,
+            Long speed,
+            Long totalMemory,
+            long dom0MinMemory,
+            String caps) {
+        this.id = id;
+        this.name = name;
+        this.status = status;
+        this.type = type;
+        this.privateIpAddress = privateIpAddress;
+        this.privateNetmask = privateNetmask;
+        this.privateMacAddress = privateMacAddress;
+        this.publicIpAddress = publicIpAddress;
+        this.publicNetmask = publicNetmask;
+        this.publicMacAddress = publicMacAddress;
+        this.storageIpAddress = storageIpAddress;
+        this.storageNetmask = storageNetmask;
+        this.storageMacAddress = storageMacAddress;
+        this.dataCenterId = dcId;
+        this.podId = podId;
+        this.cpus = cpus;
+        this.version = version;
+        this.speed = speed;
+        this.totalMemory = totalMemory != null ? totalMemory : 0;
+        this.guid = guid;
+        this.parent = null;
+        this.totalSize = null;
+        this.fsType = null;
+        this.managementServerId = serverId;
+        this.lastPinged = ping;
+        this.caps = caps;
+        this.disconnectedOn = disconnectedOn;
+        this.dom0MinMemory = dom0MinMemory;
+        this.storageUrl = url;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public void setPodId(Long podId) {
+
+        this.podId = podId;
+    }
+
+    public void setDataCenterId(long dcId) {
+        this.dataCenterId = dcId;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public void setStorageUrl(String url) {
+        this.storageUrl = url;
+    }
+
+    public void setDisconnectedOn(Date disconnectedOn) {
+        this.disconnectedOn = disconnectedOn;
+    }
+
+    public String getStorageUrl() {
+        return storageUrl;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setPrivateIpAddress(String ipAddress) {
+        this.privateIpAddress = ipAddress;
+    }
+
+    public void setCpus(Integer cpus) {
+        this.cpus = cpus;
+    }
+
+    public void setSpeed(Long speed) {
+        this.speed = speed;
+    }
+
+    public void setTotalMemory(long totalMemory) {
+        this.totalMemory = totalMemory;
+    }
+
+    public void setParent(String parent) {
+        this.parent = parent;
+    }
+
+    public void setCaps(String caps) {
+        this.caps = caps;
+    }
+
+    public void setTotalSize(Long totalSize) {
+        this.totalSize = totalSize;
+    }
+
+    public void setLastPinged(long lastPinged) {
+        this.lastPinged = lastPinged;
+    }
+
+    public void setManagementServerId(Long managementServerId) {
+        this.managementServerId = managementServerId;
+    }
+
+    @Override
+    public long getLastPinged() {
+        return lastPinged;
+    }
+
+    @Override
+    public String getParent() {
+        return parent;
+    }
+
+    @Override
+    public long getTotalSize() {
+        return totalSize;
+    }
+
+    @Override
+    public String getCapabilities() {
+        return caps;
+    }
+
+    @Override
+    public Date getCreated() {
+        return created;
+    }
+
+    @Override
+    public Date getRemoved() {
+        return removed;
+    }
+
+    @Override
+    public String getVersion() {
+        return version;
+    }
+
+    public void setType(Type type) {
+        this.type = type;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public Status getStatus() {
+        return status;
+    }
+
+    @Override
+    public long getDataCenterId() {
+        return dataCenterId;
+    }
+
+    @Override
+    public Long getPodId() {
+        return podId;
+    }
+
+    @Override
+    public Long getManagementServerId() {
+        return managementServerId;
+    }
+
+    @Override
+    public Date getDisconnectedOn() {
+        return disconnectedOn;
+    }
+
+    @Override
+    public String getPrivateIpAddress() {
+        return privateIpAddress;
+    }
+
+    @Override
+    public String getGuid() {
+        return guid;
+    }
+
+    public void setGuid(String guid) {
+        this.guid = guid;
+    }
+
+    @Override
+    public Integer getCpus() {
+        return cpus;
+    }
+
+    @Override
+    public Long getSpeed() {
+        return speed;
+    }
+
+    @Override
+    public Long getTotalMemory() {
+        return totalMemory;
+    }
+
+    @Override
+    public Integer getProxyPort() {
+        return proxyPort;
+    }
+
+    public void setProxyPort(Integer port) {
+        proxyPort = port;
+    }
+
+    public StoragePoolType getFsType() {
+        return fsType;
+    }
+
+    @Override
+    public Type getType() {
+        return type;
+    }
+
+    @Override
+    public int hashCode() {
+        return NumbersUtil.hash(id);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof HostVO) {
+            return ((HostVO)obj).getId() == this.getId();
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public String toString() {
+        return new StringBuilder("Host[").append("-").append(id).append("-").append(type).append("]").toString();
+    }
+
+    public void setHypervisorType(HypervisorType hypervisorType) {
+        this.hypervisorType = hypervisorType;
+    }
+
+    @Override
+    public HypervisorType getHypervisorType() {
+        return hypervisorType;
+    }
+
+    public void setHypervisorVersion(String hypervisorVersion) {
+        this.hypervisorVersion = hypervisorVersion;
+    }
+
+    @Override
+    public String getHypervisorVersion() {
+        return hypervisorVersion;
+    }
+
+	@Override
+	@Transient
+	public Status getState() {
+		return status;
+	}
+
+    @Override
+    public ResourceState getResourceState() {
+        return resourceState;
+    }
+
+    public void setResourceState(ResourceState state) {
+    	resourceState = state;
+    }
+
+    @Override
+    public boolean isInMaintenanceStates() {
+        return (getResourceState() == ResourceState.Maintenance || getResourceState() == ResourceState.ErrorInMaintenance
+                || getResourceState() == ResourceState.PrepareForMaintenance);
+    }
+
+    public long getUpdated() {
+    	return updated;
+    }
+
+	public long incrUpdated() {
+		updated++;
+		return updated;
+	}
+
+	@Override
+	public String getUuid() {
+		return this.uuid;
+	}
+
+	public void setUuid(String uuid) {
+		this.uuid = uuid;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/host/dao/HostDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/dao/HostDao.java b/engine/schema/src/com/cloud/host/dao/HostDao.java
new file mode 100755
index 0000000..98bdcb4
--- /dev/null
+++ b/engine/schema/src/com/cloud/host/dao/HostDao.java
@@ -0,0 +1,83 @@
+// 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.host.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import com.cloud.host.Host;
+import com.cloud.host.Host.Type;
+import com.cloud.host.HostVO;
+import com.cloud.host.Status;
+import com.cloud.info.RunningHostCountInfo;
+import com.cloud.resource.ResourceState;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.fsm.StateDao;
+
+/**
+ * Data Access Object for server
+ *
+ */
+public interface HostDao extends GenericDao<HostVO, Long>, StateDao<Status, Status.Event, Host> {
+    long countBy(long clusterId,  ResourceState... states);
+
+    /**
+     * Mark all hosts associated with a certain management server
+     * as disconnected.
+     * 
+     * @param msId management server id.
+     */
+    void markHostsAsDisconnected(long msId, long lastPing);
+
+	List<HostVO> findLostHosts(long timeout);
+
+    List<HostVO> findAndUpdateDirectAgentToLoad(long lastPingSecondsAfter, Long limit, long managementServerId);
+
+    List<RunningHostCountInfo> getRunningHostCounts(Date cutTime);
+
+    long getNextSequence(long hostId);
+
+    void loadDetails(HostVO host);
+
+    void saveDetails(HostVO host);
+
+    void loadHostTags(HostVO host);
+
+    List<HostVO> listByHostTag(Host.Type type, Long clusterId, Long podId, long dcId, String hostTag);
+
+    long countRoutingHostsByDataCenter(long dcId);
+
+	List<HostVO> findAndUpdateApplianceToLoad(long lastPingSecondsAfter, long managementServerId);
+
+    boolean updateResourceState(ResourceState oldState, ResourceState.Event event, ResourceState newState, Host vo);
+
+	HostVO findByGuid(String guid);
+	
+	HostVO findByTypeNameAndZoneId(long zoneId, String name, Host.Type type);
+	List<HostVO> findHypervisorHostInCluster(long clusterId);
+
+
+    /**
+     * @param type
+     * @param clusterId
+     * @param podId
+     * @param dcId
+     * @param haTag TODO
+     * @return
+     */
+    List<HostVO> listAllUpAndEnabledNonHAHosts(Type type, Long clusterId, Long podId, long dcId, String haTag);
+}


[33/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/WEB-INF/classes/resources/messages_ko_KR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ko_KR.properties b/client/WEB-INF/classes/resources/messages_ko_KR.properties
index 757871a..766fc60 100644
--- a/client/WEB-INF/classes/resources/messages_ko_KR.properties
+++ b/client/WEB-INF/classes/resources/messages_ko_KR.properties
@@ -15,6 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
+
 changed.item.properties=\ud56d\ubaa9 \uc18d\uc131 \ubcc0\uacbd
 confirm.enable.swift=Swift \uae30\uc220 \uc9c0\uc6d0\ub97c \uc0ac\uc6a9 \ud558\ub824\uba74 \ub2e4\uc74c \uc815\ubcf4\ub97c \uc785\ub825\ud574 \uc8fc\uc2ed\uc2dc\uc624.
 error.could.not.enable.zone=Zone\uc744 \uc0ac\uc6a9 \ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.
@@ -1193,7 +1194,6 @@ message.add.load.balancer.under.ip=\ub2e4\uc74c IP \uc8fc\uc18c\uc5d0 \ub300\ud5
 message.add.load.balancer=Zone\uc5d0 \ub124\ud2b8\uc6cc\ud06c \ub85c\ub4dc \uacf5\uc720 \uc7a5\uce58\ub97c \ucd94\uac00\ud569\ub2c8\ub2e4.
 message.add.network=Zone <b><span id\="zone_name"></span></b>\uc5d0 \uc0c8\ub85c\uc6b4 \ub124\ud2b8\uc6cc\ud06c\ub97c \ucd94\uac00\ud569\ub2c8\ub2e4.
 message.add.new.gateway.to.vpc=\ud604\uc7ac VPC\uc5d0 \uc0c8\ub85c\uc6b4 \uac8c\uc774\ud2b8\uc6e8\uc774\ub97c \ucd94\uac00\ud558\uae30 \uc704\ud55c \uc815\ubcf4\ub97c \uc9c0\uc815\ud574 \uc8fc\uc2ed\uc2dc\uc624.
-message.add.pod.during.zone.creation=\uac01 Zone\uc5d0\ub294 \ud55c \uac1c \uc774\uc0c1 Pod\uac00 \ud544\uc694\ud569\ub2c8\ub2e4. \uc9c0\uae08 \uc5ec\uae30\uc11c \uccab\ubc88\uc9f8 Pod\ub97c \ucd94\uac00\ud569\ub2c8\ub2e4. Pod\ub294 \ud638\uc2a4\ud2b8\uc640 \uae30\ubcf8 \uc2a4\ud1a0\ub9ac\uc9c0 \uc11c\ubc84\uc5d0\uc11c \uad6c\uc131\ud569\ub2c8\ub2e4\ub9cc  \uc774\ub294 \ub2e4\uc74c \uc21c\uc11c\ub85c \ucd94\uac00\ud569\ub2c8\ub2e4. \ub9e8 \ucc98\uc74c CloudStack \ub0b4\ubd80 \uad00\ub9ac \ud2b8\ub798\ud53d\uc744 \uc704\ud574\uc11c IP \uc8fc\uc18c \ubc94\uc704\ub97c \uc608\uc57d\ud569\ub2c8\ub2e4. IP \uc8fc\uc18c \ubc94\uc704\ub294 \ud074\ub77c\uc6b0\ub4dc \ub0b4\ubd80 \uac01 Zone\uc5d0\uc11c \uc911\ubcf5 \ud558\uc9c0 \uc54a\uac8c \uc608\uc57d\ud560 \ud544\uc694\uac00 \uc788\uc2b5\ub2c8\ub2e4.
 message.add.pod=Zone <b><span id\="add_pod_zone_name"></span></b>\uc5d0 \uc0c8\ub85c\uc6b4 Pod\ub97c \ucd94\uac00\ud569\ub2c8\ub2e4.
 message.add.primary.storage=Zone <b><span id\="zone_name"></span></b> Pod <b><span id\="pod_name"></span></b>\uc5d0 \uc0c8\ub85c\uc6b4 \uae30\ubcf8 \uc2a4\ud1a0\ub9ac\uc9c0\ub97c \ucd94\uac00\ud569\ub2c8\ub2e4.
 message.add.primary=\uc0c8\ub85c\uc6b4 \uae30\ubcf8 \uc2a4\ud1a0\ub9ac\uc9c0\ub97c \ucd94\uac00\ud558\uae30 \uc704\ud574 \uc544\ub798 \ud30c\ub77c\ubbf8\ud130\ub97c \uc9c0\uc815\ud574 \uc8fc\uc2ed\uc2dc\uc624.
@@ -1253,7 +1253,6 @@ message.delete.VPN.gateway=\ud604\uc7ac VPN \uac8c\uc774\ud2b8\uc6e8\uc774\ub97c
 message.desc.advanced.zone=\ubcf4\ub2e4 \uc138\ub828\ub41c \ub124\ud2b8\uc6cc\ud06c \uae30\uc220\uc744 \uc9c0\uc6d0\ud569\ub2c8\ub2e4. \uc774 \ub124\ud2b8\uc6cc\ud06c \ubaa8\ub378\uc744 \uc120\ud0dd\ud558\uba74, \ubcf4\ub2e4 \uc720\uc5f0\ud558\uac8c \uac8c\uc2a4\ud2b8 \ub124\ud2b8\uc6cc\ud06c\ub97c \uc815\ud558\uace0 \ubc29\ud654\ubcbd(fire wall), VPN, \ub124\ud2b8\uc6cc\ud06c \ub85c\ub4dc \uacf5\uc720 \uc7a5\uce58 \uae30\uc220 \uc9c0\uc6d0\uc640 \uac19\uc740 \uc0ac\uc6a9\uc790 \uc9c0\uc815 \ud55c \ub124\ud2b8\uc6cc\ud06c \uc81c\uacf5\uc744 \uc81c\uacf5\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.
 message.desc.basic.zone=\uac01 VM \uc778\uc2a4\ud134\uc2a4\uc5d0 IP \uc8fc\uc18c\uac00 \ub124\ud2b8\uc6cc\ud06c\uc5d0\uc11c \uc9c1\uc811 \ud560\ub2f9\ud560 \uc218 \uc788\ub294 \ub2e8\uc77c \ub124\ud2b8\uc6cc\ud06c\ub97c \uc81c\uacf5\ud569\ub2c8\ub2e4. \ubcf4\uc548 \uadf8\ub8f9 (\uc804\uc1a1\uc6d0 IP \uc8fc\uc18c \ud544\ud130)\uacfc \uac19\uc740 \uce35 \uc138 \uac00\uc9c0 \ub808\ubca8 \ubc29\ubc95\uc73c\ub85c \uac8c\uc2a4\ud2b8\ub97c \ubd84\ub9ac\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.
 message.desc.cluster=\uac01 Pod\uc5d0\ub294 \ud55c \uac1c \uc774\uc0c1 \ud074\ub7ec\uc2a4\ud130\uac00 \ud544\uc694\ud569\ub2c8\ub2e4. \uc9c0\uae08 \uc5ec\uae30\uc11c \ucd5c\ucd08 \ud074\ub7ec\uc2a4\ud130\ub97c \ucd94\uac00\ud569\ub2c8\ub2e4. \ud074\ub7ec\uc2a4\ud130\ub294 \ud638\uc2a4\ud2b8\ub97c \uadf8\ub8f9\ud654 \ud558\ub294 \ubc29\ubc95\uc785\ub2c8\ub2e4. \ud55c \ud074\ub7ec\uc2a4\ud130 \ub0b4\ubd80 \ud638\uc2a4\ud2b8\ub294 \ubaa8\ub450 \ub3d9\uc77c\ud55c \ud558\ub4dc\uc6e8\uc5b4\uc5d0\uc11c \uad6c\uc131\ub418\uc5b4 \uac19\uc740 \ud558\uc774\ud37c \ubc14\uc774\uc800\ub97c \uc2e4\ud589\ud558\uace0 \uac19\uc740 \uc11c\ube0c \ub124\ud2b8\uc6cc\ud06c\uc0c1\uc5d0 \uc788\uc5b4 \uac19\uc740 \uacf5\uc720 \uc2a4\ud1a0\ub9ac\uc9c0\uc5d0 \uc811\uadfc \ud569\ub2c8\ub2e4. \uac01 \ud074\ub7ec\uc2a4\ud130\ub294 \ud55c \uac1c \uc774\uc0c1 \ud638\uc2a4\ud2b8\uc640 \ud55c \uac1c \uc774\uc0c1 \uae30\ubcf8 \uc2a4\ud1a0\ub9ac\uc9c0 \uc11c\ubc84\uc5d0\uc11c \uad6c\uc131\ub429\ub2c8\ub2e4.
-message.desc.host=\uac01 \ud074\ub7ec\uc2a4\ud130\uc5d0\ub294 \uc801\uc5b4\ub3c4 \ud55c \uac1c \uc774\uc0c1 \uac8c\uc2a4\ud2b8 VM\ub97c \uc2e4\ud589\ud558\uae30 \uc704\ud55c \ud638\uc2a4\ud2b8 (\ucef4\ud4e8\ud130)\uac00 \ud544\uc694\ud569\ub2c8\ub2e4. \uc9c0\uae08 \uc5ec\uae30\uc11c \uccab\ubc88\uc9f8 \ud638\uc2a4\ud2b8\ub97c \ucd94\uac00\ud569\ub2c8\ub2e4. CloudStack\uc73c\ub85c \ud638\uc2a4\ud2b8\ub97c \ub3d9\uc791\ud558\ub824\uba74 \ud638\uc2a4\ud2b8\uc5d0\uac8c \ud558\uc774\ud37c \ubc14\uc774\uc800\ub97c \uc124\uce58\ud558\uace0 IP \uc8fc\uc18c\ub97c \ud560\ub2f9\ud574 \ud638\uc2a4\ud2b8\uac00 CloudStack \uad00\ub9ac \uc11c\ubc84\uc5d0 \uc811\uc18d\ud558\ub3c4\ub85d \ud569\ub2c8\ub2e4. <br/><br/>\ud638\uc2a4\ud2b8 DNS \uba85 \ub610\ub294 IP \uc8fc\uc18c, \uc0ac\uc6a9\uc790\uba85(\uc6d0\ub798 root)\uacfc \uc554\ud638 \ubc0f \ud638\uc2a4\ud2b8 \ubd84\ub958\uc5d0 \uc0ac\uc6a9\ud558\ub294 \ub77c\ubca8\uc744 \uc785\ub825\ud574 \uc8fc\uc2ed\uc2dc\uc624.
 message.desc.primary.storage=\uac01 \ud074\ub7ec\uc2a4\ud130\uc5d0\ub294 \uc801\uc5b4\ub3c4 \ud55c \uac1c \uc774\uc0c1\uc758 \uae30\ubcf8 \uc2a4\ud1a0\ub9ac\uc9c0 \uc11c\ubc84\uac00 \ud544\uc694\ud569\ub2c8\ub2e4. \uc9c0\uae08 \uc5ec\uae30\uc11c \uccab\ubc88\uc9f8 \uc11c\ubc84\ub97c \ucd94\uac00\ud569\ub2c8\ub2e4. \uae30\ubcf8 \uc2a4\ud1a0\ub9ac\uc9c0\ub294 \ud074\ub7ec\uc2a4\ud130 \ub0b4 \ubd80 \ud638\uc2a4\ud2b8\uc0c1\uc5d0\uc11c \ub3d9\uc791\ud558\ub294 \ubaa8\ub4e0 VM \ub514\uc2a4\ud06c \ubcfc\ub968\uc744 \ud3ec\ud568\ud569\ub2c8\ub2e4. \uae30\ubcf8\uc801\uc73c\ub85c \ud558\uc774\ud37c \ubc14\uc774\uc800\uc5d0\uc11c \uae30\uc220 \uc9c0\uc6d0\ub418\ub294 \ud45c\uc900\uc5d0 \uc900\uac70\ud55c \ud504\ub85c\ud1a0\ucf5c\uc744 \uc0ac\uc6a9\ud574 \uc8fc\uc2ed\uc2dc\uc624.
 message.desc.secondary.storage=\uac01 Zone\uc5d0\ub294 \uc801\uc5b4\ub3c4 \ud55c \uac1c \uc774\uc0c1\uc758 NFS \uc989 2\ucc28 \uc2a4\ud1a0\ub9ac\uc9c0 \uc11c\ubc84\uac00 \ud544\uc694\ud569\ub2c8\ub2e4. \uc9c0\uae08 \uc5ec\uae30\uc11c \uccab\ubc88\uc9f8 \uc11c\ubc84\ub97c \ucd94\uac00\ud569\ub2c8\ub2e4. 2\ucc28 \uc2a4\ud1a0\ub9ac\uc9c0\ub294 VM \ud15c\ud50c\ub9bf, ISO \uc774\ubbf8\uc9c0 \ubc0f VM \ub514\uc2a4\ud06c \ubcfc\ub968 \uc2a4\ub0c5\uc0f7\uc744 \ud3ec\ud568\ud569\ub2c8\ub2e4. \uc774 \uc11c\ubc84\ub294 Zone\ub0b4 \ubaa8\ub4e0 \ud638\uc2a4\ud2b8\uc5d0\uc11c  \uc0ac\uc6a9\ud560 \uc218 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4. <br/><br/>IP \uc8fc\uc18c\uc640 \ub0b4\ubcf4\ub0b4\ub0bc \uacbd\ub85c\ub97c \uc785\ub825\ud574 \uc8fc\uc2ed\uc2dc\uc624.
 message.desc.zone=Zone\uc740 CloudStack \ud658\uacbd\ub0b4 \ucd5c\ub300 \uc870\uc9c1 \ub2e8\uc704\ub85c \uc6d0\ub798 \ub2e8\uc77c \ub370\uc774\ud130 \uc13c\ud130\uc5d0 \ud574\ub2f9\ud569\ub2c8\ub2e4. Zone\uc5d0 \ud574\uc11c \ubb3c\ub9ac\uc801\uc778 \ubd84\ub9ac\uc640 \uc911\ubcf5\uc131\uc774 \uc81c\uacf5\ub429\ub2c8\ub2e4. Zone\uc740 \ud55c \uac1c \uc774\uc0c1 Pod( \uac01 Pod\ub294 \ud638\uc2a4\ud2b8\uc640 \uae30\ubcf8 \uc2a4\ud1a0\ub9ac\uc9c0 \uc11c\ubc84\uc5d0\uc11c \uad6c\uc131)\uc640 Zone\ub0b4 \ubaa8\ub4e0 Pod\ub85c \uacf5\uc720\ub418\ub294 2\ucc28 \uc2a4\ud1a0\ub9ac\uc9c0 \uc11c\ubc84\ub85c \uad6c\uc131\ub429\ub2c8\ub2e4.
@@ -1381,7 +1380,6 @@ message.step.3.continue=\uc2e4\ud589\ud558\ub824\uba74 \ub514\uc2a4\ud06c\uc81c\
 message.step.3.desc=
 message.step.4.continue=\uc2e4\ud589\ud558\ub824\uba74 \ub124\ud2b8\uc6cc\ud06c\ub97c \uc801\uc5b4\ub3c4 \ud55c \uac1c \uc774\uc0c1 \uc120\ud0dd\ud574 \uc8fc\uc2ed\uc2dc\uc624.
 message.step.4.desc=\uac00\uc0c1 \uc778\uc2a4\ud134\uc2a4\uac00 \uc811\uc18d\ud558\ub294 \uae30\ubcf8 \ub124\ud2b8\uc6cc\ud06c\ub97c \uc120\ud0dd\ud574 \uc8fc\uc2ed\uc2dc\uc624.
-message.storage.traffic=\ud638\uc2a4\ud2b8\ub098 CloudStack \uc2dc\uc2a4\ud15c VM \ub4f1 \uad00\ub9ac \uc11c\ubc84\uc640 \ud1b5\uc2e0\ud558\ub294 CloudStack \ub0b4\ubd80 \uc790\uc6d0\uac04 \ud2b8\ub798\ud53d\uc785\ub2c8\ub2e4. \uc5ec\uae30\uc11c \uc2a4\ud1a0\ub9ac\uc9c0 \ud2b8\ub798\ud53d\uc744 \uad6c\uc131\ud574 \uc8fc\uc2ed\uc2dc\uc624.
 message.suspend.project=\ud604\uc7ac \ud504\ub85c\uc81d\ud2b8\ub97c \uc77c\uc2dc\uc815\uc9c0\ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?
 message.template.desc=VM\uc758 \uc2dc\uc791\uc5d0 \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 OS \uc774\ubbf8\uc9c0
 message.tooltip.dns.1=Zone\ub0b4 VM \ub85c \uc0ac\uc6a9\ud558\ub294 DNS \uc11c\ubc84 \uc774\ub984\uc785\ub2c8\ub2e4. Zone \uacf5\uac1c IP \uc8fc\uc18c\uc5d0\uc11c \uc774 \uc11c\ubc84\uc5d0 \ud1b5\uc2e0\ud560 \uc218 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/WEB-INF/classes/resources/messages_nb_NO.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_nb_NO.properties b/client/WEB-INF/classes/resources/messages_nb_NO.properties
index be41244..8fba48c 100644
--- a/client/WEB-INF/classes/resources/messages_nb_NO.properties
+++ b/client/WEB-INF/classes/resources/messages_nb_NO.properties
@@ -15,6 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
+
 changed.item.properties=Endrede egenskaper
 error.could.not.enable.zone=Kunne ikke aktivere sonen
 error.installWizard.message=Noe gikk galt. G\u00e5 tilbake og korriger feilene.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/WEB-INF/classes/resources/messages_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_pt_BR.properties b/client/WEB-INF/classes/resources/messages_pt_BR.properties
index fd24f54..23123c1 100644
--- a/client/WEB-INF/classes/resources/messages_pt_BR.properties
+++ b/client/WEB-INF/classes/resources/messages_pt_BR.properties
@@ -15,6 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
+
 changed.item.properties=Alteradas propriedades do item
 confirm.enable.s3=Por favor preencha as informa\u00e7\u00f5es abaixo para habilitar suporte a storage secund\u00e1ria fornecida por S3
 confirm.enable.swift=Por favor preencha as informa\u00e7\u00f5es abaixo para habilitar suporte ao Swift
@@ -1112,7 +1113,6 @@ label.zones=Zonas
 label.zone.type=Tipo de Zona
 label.zone.wide=Zone-Wide
 label.zoneWizard.trafficType.guest=H\u00f3spede\: tr\u00e1fego entre m\u00e1quinas virtuais de usu\u00e1rios finais
-label.zoneWizard.trafficType.management=Ger\u00eancia\: tr\u00e1fego entre recursos internos do CloudStack, incluindo quaisquer componentes que se comunicam com o servidor de gerenciamento, tais como hosts e m\u00e1quinas virtuais de sistema do CloudStack
 label.zoneWizard.trafficType.public=P\u00fablico\: tr\u00e1fego entre a internet e m\u00e1quinas virtuais na nuvem.
 label.zoneWizard.trafficType.storage=Storage\: tr\u00e1fego entre servidores de storage prim\u00e1ria e secund\u00e1ria, tais como templates de m\u00e1quinas virtuais e snapshots
 label.zone=Zona

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/WEB-INF/classes/resources/messages_ru_RU.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ru_RU.properties b/client/WEB-INF/classes/resources/messages_ru_RU.properties
index b0ffe40..5818abc 100644
--- a/client/WEB-INF/classes/resources/messages_ru_RU.properties
+++ b/client/WEB-INF/classes/resources/messages_ru_RU.properties
@@ -15,6 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
+
 changed.item.properties=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b
 confirm.enable.swift=\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043d\u0438\u0436\u0435\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438 Swift
 error.could.not.enable.zone=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0437\u043e\u043d\u0443
@@ -1052,7 +1053,7 @@ message.acquire.public.ip=\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442
 message.action.cancel.maintenance.mode=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f.
 message.action.cancel.maintenance=\u0423\u0437\u0435\u043b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u0448\u0435\u043b \u0438\u0437 \u0440\u0435\u0436\u0438\u043c\u0430 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f. \u042d\u0442\u043b\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043c\u043e\u0436\u0435\u0442 \u0434\u043b\u0438\u0442\u044c\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043d\u0443\u0442.
 message.action.change.service.warning.for.instance=\u0414\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0432\u0430\u0448\u0430 \u043c\u0430\u0448\u0438\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430.
-message.action.change.service.warning.for.router=\n
+message.action.change.service.warning.for.router=\u0414\u043b\u044f \u0440\u043e\u0443\u0442\u0435\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0432\u0430\u0448\u0430 \u043c\u0430\u0448\u0438\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430.
 message.action.delete.cluster=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0442\u0435\u0440.
 message.action.delete.disk.offering=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0434\u0438\u0441\u043a\u043e\u0432\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441.
 message.action.delete.domain=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0434\u043e\u043c\u0435\u043d.
@@ -1130,7 +1131,6 @@ message.additional.networks.desc=\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u044
 message.add.load.balancer=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0443 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432 \u0437\u043e\u043d\u0443
 message.add.load.balancer.under.ip=\u041f\u0440\u0430\u0432\u0438\u043b\u043e \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 IP\:
 message.add.network=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0441\u0435\u0442\u044c \u0434\u043b\u044f \u0437\u043e\u043d\u044b\: <b><span id\="zone_name"></span></b>
-message.add.pod.during.zone.creation=\u041a\u0430\u0436\u0434\u0430\u044f \u0437\u043e\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0435\u043d\u0434\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0435 \u043f\u0435\u0440\u0432\u044b\u043c. \u0421\u0442\u0435\u043d\u0434 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0443\u0437\u043b\u044b \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u044b \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0448\u0430\u0433\u0435. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u043
 5\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0445 \u0430\u0434\u0440\u0435\u0441\u043e\u0432 IP \u0434\u043b\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0441\u0435\u0442\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0445 IP \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u043e\u043d\u044b \u043e\u0431\u043b\u0430\u043a\u0430.
 message.add.pod=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0441\u0442\u0435\u043d\u0434 \u0434\u043b\u044f \u0437\u043e\u043d\u044b <b><span id\="add_pod_zone_name"></span></b>
 message.add.primary.storage=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u043b\u044f \u0437\u043e\u043d\u044b <b><span id\="zone_name"></span></b>, \u0441\u0442\u0435\u043d\u0434\u0430 <b><span id\="pod_name"></span></b>
 message.add.primary=\u0423\u043a\u0430\u0436\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430
@@ -1185,7 +1185,6 @@ message.delete.user=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442
 message.desc.advanced.zone=\u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0442\u043e\u043f\u043e\u043b\u043e\u0433\u0438\u0439. \u042d\u0442\u0430 \u0441\u0435\u0442\u0435\u0432\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0433\u043e\u0441\u0442\u0435\u0432\u043e\u0439 \u0441\u0435\u0442\u0438 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u0441\u043b\u0443\u0433, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u043c\u0435\u0436\u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u044d\u043a\u0440\u0430\u043d, VPN, \u0438\u043b\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0
 43a\u0430 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438.
 message.desc.basic.zone=\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0434\u0438\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u0412\u041c \u0438\u043c\u0435\u0435\u0442 \u00ab\u0431\u0435\u043b\u044b\u0439\u00bb IP-\u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0442\u0438. \u0418\u0437\u043e\u043b\u044f\u0446\u0438\u0438 \u0433\u043e\u0441\u0442\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0435\u0442\u0438 3-\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0433\u0440\u0443\u043f\u043f\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 (\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f IP-\u0432\u0434\u0440\u0435\u0441\u043e\u0432)
 message.desc.cluster=\u041a\u0430\u0436\u0434\u044b\u0439 \u0441\u0442\u0435\u043d\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u0432, \u043f\u0435\u0440\u0432\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0435. \u041a\u043b\u0430\u0441\u0442\u0435\u0440 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0433\u0440\u0443\u043f\u043f\u0443 \u0443\u0437\u043b\u043e\u0432. \u0423\u0437\u043b\u044b \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u0438\u043c\u0435\u044e\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0435, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0447\u043
 5\u0440\u0435\u0437 \u043e\u0434\u0438\u043d \u0433\u0438\u043f\u0435\u0440\u0432\u0438\u0437\u043e\u0440, \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0438 \u0438\u043c\u0435\u044e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043e\u0434\u043d\u043e\u043c\u0443  \u0438 \u0442\u043e\u043c\u0443 \u0436\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c\u0443 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0443. \u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0443\u0437\u043b\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0435\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449.
-message.desc.host=\u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043e\u0434\u0438\u043d \u0443\u0437\u0435\u043b (\u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440) \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0412\u041c, \u043f\u0435\u0440\u0432\u044b\u0439 \u0438\u0437 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0432\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0435 \u0441\u0435\u0439\u0447\u0430\u0441. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0443\u0437\u043b\u0430 \u0432 CloudStack \u0432\u0430\u0436\u043d\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0433\u0438\u043f\u0435\u0440\u0432\u0438\u0437\u043e\u0440\u0430 \u043d\u0430 \u0443\u0437\u0435\u043b, \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 IP \u043a \u0443\u0437\u043b\
 u0443 \u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0437\u043b\u0430 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f CloudStack.<br/><br/>\u0423\u043a\u0430\u0436\u0438\u0442\u0435 \u0438\u043c\u044f DNS \u0438\u043b\u0438 \u0430\u0434\u0440\u0435\u0441 IP, \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u043a \u041e\u0421 (\u043e\u0431\u044b\u0447\u043d\u043e root), \u0430 \u0442\u0430\u043a\u0436\u0435 \u043c\u0435\u0442\u043a\u0438 \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0443\u0437\u043b\u043e\u0432.
 message.desc.primary.storage=\u041a\u0430\u0436\u0434\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u0435\u0439\u0447\u0430\u0441. \u041f\u0435\u0440\u0432\u0438\u0447\u043d\u0430\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u044b \u0436\u0435\u0441\u0442\u043a\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u0430 \u0434\u043b\u044f \u0432\u0441\u0435
 \u0445 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u043d\u0430 \u0443\u0437\u043b\u0430\u0445 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043b\u044e\u0431\u043e\u0439 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0433\u0438\u043f\u0435\u0440\u0432\u0438\u0437\u043e\u0440\u0430.
 message.desc.secondary.storage=\u041a\u0430\u0436\u0434\u0430\u044f \u0437\u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c NFS \u0438\u043b\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c \u0438 \u0438\u0445 \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043e \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0412\u041c,
  \u043e\u0431\u0440\u0430\u0437\u043e\u0432 ISO \u0438 \u0441\u043d\u0438\u043c\u043a\u043e\u0432 \u0412\u041c. \u042d\u0442\u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u043e\u0432 \u0437\u043e\u043d\u044b.<br/><br/>\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c IP-\u0430\u0434\u0440\u0435\u0441 \u0438 \u043f\u0443\u0442\u044c.
 message.desc.zone=layer 3
@@ -1310,7 +1309,6 @@ message.step.3.continue=\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\
 message.step.3.desc=
 message.step.4.continue=\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u0443 \u0441\u0435\u0442\u044c \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u044f.
 message.step.4.desc=\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0441\u0435\u0442\u044c, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0430.
-message.storage.traffic=\u0422\u0440\u0430\u0444\u0438\u043a \u043c\u0435\u0436\u0434\u0443 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438 CloudStack, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0441\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0445\u043e\u0441\u0442\u044b \u0438 CloudStack \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u0442\u0435 \u0442\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0437\u0434\u0435\u0441\u044c.
 message.suspend.project=\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442?
 message.template.desc=\u041e\u0431\u0440\u0430\u0437 \u041e\u0421, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0439 \u0432 \u0412\u041c
 message.tooltip.dns.1=\u0418\u043c\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 DNS \u0434\u043b\u044f \u0412\u041c \u044d\u0442\u043e\u0439 \u0437\u043e\u043d\u044b. \u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u044d\u0442\u043e\u0439 \u0437\u043e\u043d\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/WEB-INF/classes/resources/messages_zh_CN.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_zh_CN.properties b/client/WEB-INF/classes/resources/messages_zh_CN.properties
index f62439d..687ef60 100644
--- a/client/WEB-INF/classes/resources/messages_zh_CN.properties
+++ b/client/WEB-INF/classes/resources/messages_zh_CN.properties
@@ -15,6 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
+
 changed.item.properties=\u66f4\u6539\u9879\u76ee\u5c5e\u6027
 confirm.enable.s3=\u8bf7\u586b\u5199\u4e0b\u5217\u4fe1\u606f\u4ee5\u542f\u7528\u652f\u6301S3\u7684\u4e8c\u7ea7\u5b58\u50a8
 confirm.enable.swift=\u8bf7\u586b\u5199\u4ee5\u4e0b\u4fe1\u606f\u4ee5\u542f\u7528\u5bf9 SWIFT \u7684\u652f\u6301
@@ -1164,7 +1165,6 @@ label.zone.type=\u533a\u57df\u7c7b\u578b
 label.zone=\u533a\u57df
 label.zone.wide=\u6574\u4e2a\u533a\u57df
 label.zoneWizard.trafficType.guest=\u6765\u5bbe\u7f51\u7edc\: \u5ba2\u6237\u865a\u62df\u673a\u4e4b\u95f4\u7684\u7f51\u7edc\u6d41\u91cf
-label.zoneWizard.trafficType.management=\u7ba1\u7406\u7f51\: CloudStack\u5185\u90e8\u8d44\u6e90\u4e4b\u95f4\u7684\u7f51\u7edc\u6d41\u91cf, \u5305\u62ec\u4e0e\u7ba1\u7406\u670d\u52a1\u5668\u4ea4\u4e92\u7684\u4efb\u4f55\u7ec4\u4ef6, \u6bd4\u5982\u4e3b\u673a\u548cCloudStack\u7cfb\u7edf\u865a\u62df\u673a
 label.zoneWizard.trafficType.public=\u516c\u5171\u7f51\u7edc\: \u4e91\u73af\u5883\u4e2d\u865a\u62df\u673a\u4e0e\u56e0\u7279\u7f51\u4e4b\u95f4\u7684\u7f51\u7edc\u6d41\u91cf.
 label.zoneWizard.trafficType.storage=\u5b58\u50a8\u7f51\: \u4e3b\u5b58\u50a8\u4e0e\u4e8c\u7ea7\u5b58\u50a8\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u6d41\u91cf, \u6bd4\u5982\u865a\u673a\u6a21\u677f\u548c\u5feb\u7167
 managed.state=\u6258\u7ba1\u72b6\u6001
@@ -1255,7 +1255,6 @@ message.add.load.balancer=\u5411\u533a\u57df\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u8d1f
 message.add.load.balancer.under.ip=\u5df2\u5728\u4ee5\u4e0b IP \u4e0b\u6dfb\u52a0\u8d1f\u8f7d\u5e73\u8861\u5668\u89c4\u5219\:
 message.add.network=\u4e3a\u533a\u57df\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7f51\u7edc\: <b><span id\="zone_name"></span></b>
 message.add.new.gateway.to.vpc=\u8bf7\u6307\u5b9a\u5c06\u65b0\u7f51\u5173\u6dfb\u52a0\u5230\u6b64 VPC \u6240\u9700\u7684\u4fe1\u606f\u3002
-message.add.pod.during.zone.creation=\u6bcf\u4e2a\u533a\u57df\u4e2d\u5fc5\u987b\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u63d0\u4f9b\u70b9\uff0c\u73b0\u5728\u6211\u4eec\u5c06\u6dfb\u52a0\u7b2c\u4e00\u4e2a\u63d0\u4f9b\u70b9\u3002\u63d0\u4f9b\u70b9\u4e2d\u5305\u542b\u4e3b\u673a\u548c\u4e3b\u5b58\u50a8\u670d\u52a1\u5668\uff0c\u60a8\u5c06\u5728\u968f\u540e\u7684\u67d0\u4e2a\u6b65\u9aa4\u4e2d\u6dfb\u52a0\u8fd9\u4e9b\u4e3b\u673a\u548c\u670d\u52a1\u5668\u3002\u9996\u5148\uff0c\u8bf7\u4e3a CloudStack \u7684\u5185\u90e8\u7ba1\u7406\u6d41\u91cf\u914d\u7f6e\u4e00\u4e2a\u9884\u7559 IP \u5730\u5740\u8303\u56f4\u3002\u9884\u7559\u7684 IP \u8303\u56f4\u5bf9\u4e91\u4e2d\u7684\u6bcf\u4e2a\u533a\u57df\u6765\u8bf4\u5fc5\u987b\u552f\u4e00\u3002
 message.add.pod=\u4e3a\u533a\u57df <b><span id\="add_pod_zone_name"></span></b> \u6dfb\u52a0\u4e00\u4e2a\u65b0\u63d0\u4f9b\u70b9
 message.add.primary.storage=\u4e3a\u533a\u57df <b><span id\="zone_name"></span></b>\u3001\u63d0\u4f9b\u70b9 <b><span id\="pod_name"></span></b> \u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u4e3b\u5b58\u50a8
 message.add.primary=\u8bf7\u6307\u5b9a\u4ee5\u4e0b\u53c2\u6570\u4ee5\u6dfb\u52a0\u4e00\u4e2a\u65b0\u4e3b\u5b58\u50a8
@@ -1317,7 +1316,6 @@ message.delete.VPN.gateway=\u8bf7\u786e\u8ba4\u60a8\u786e\u5b9e\u8981\u5220\u966
 message.desc.advanced.zone=\u9002\u7528\u4e8e\u66f4\u52a0\u590d\u6742\u7684\u7f51\u7edc\u62d3\u6251\u3002\u6b64\u7f51\u7edc\u6a21\u5f0f\u5728\u5b9a\u4e49\u6765\u5bbe\u7f51\u7edc\u5e76\u63d0\u4f9b\u9632\u706b\u5899\u3001VPN \u6216\u8d1f\u8f7d\u5e73\u8861\u5668\u652f\u6301\u7b49\u81ea\u5b9a\u4e49\u7f51\u7edc\u65b9\u6848\u65b9\u9762\u63d0\u4f9b\u4e86\u6700\u5927\u7684\u7075\u6d3b\u6027\u3002
 message.desc.basic.zone=\u63d0\u4f9b\u4e00\u4e2a\u7f51\u7edc\uff0c\u5c06\u76f4\u63a5\u4ece\u6b64\u7f51\u7edc\u4e2d\u4e3a\u6bcf\u4e2a VM \u5b9e\u4f8b\u5206\u914d\u4e00\u4e2a IP\u3002\u53ef\u4ee5\u901a\u8fc7\u5b89\u5168\u7ec4\u7b49\u7b2c 3 \u5c42\u65b9\u5f0f\u63d0\u4f9b\u6765\u5bbe\u9694\u79bb(IP \u5730\u5740\u6e90\u8fc7\u6ee4)\u3002
 message.desc.cluster=\u6bcf\u4e2a\u63d0\u4f9b\u70b9\u4e2d\u5fc5\u987b\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u7fa4\u96c6\uff0c\u73b0\u5728\u6211\u4eec\u5c06\u6dfb\u52a0\u7b2c\u4e00\u4e2a\u7fa4\u96c6\u3002\u7fa4\u96c6\u63d0\u4f9b\u4e86\u4e00\u79cd\u7f16\u7ec4\u4e3b\u673a\u7684\u65b9\u6cd5\u3002\u7fa4\u96c6\u4e2d\u7684\u6240\u6709\u4e3b\u673a\u90fd\u5177\u6709\u76f8\u540c\u7684\u786c\u4ef6\uff0c\u8fd0\u884c\u76f8\u540c\u7684\u865a\u62df\u673a\u7ba1\u7406\u7a0b\u5e8f\uff0c\u4f4d\u4e8e\u76f8\u540c\u7684\u5b50\u7f51\u4e2d\uff0c\u5e76\u8bbf\u95ee\u76f8\u540c\u7684\u5171\u4eab\u5b58\u50a8\u3002\u6bcf\u4e2a\u7fa4\u96c6\u7531\u4e00\u4e2a\u6216\u591a\u4e2a\u4e3b\u673a\u4ee5\u53ca\u4e00\u4e2a\u6216\u591a\u4e2a\u4e3b\u5b58\u50a8\u670d\u52a1\u5668\u7ec4\u6210\u3002
-message.desc.host=\u6bcf\u4e2a\u7fa4\u96c6\u4e2d\u5fc5\u987b\u81f3\u5c11\u5305\u542b\u4e00\u4e2a\u4e3b\u673a\u4ee5\u4f9b\u6765\u5bbe VM \u5728\u4e0a\u9762\u8fd0\u884c\uff0c\u73b0\u5728\u6211\u4eec\u5c06\u6dfb\u52a0\u7b2c\u4e00\u4e2a\u4e3b\u673a\u3002\u8981\u4f7f\u4e3b\u673a\u5728 CloudStack \u4e2d\u8fd0\u884c\uff0c\u5fc5\u987b\u5728\u6b64\u4e3b\u673a\u4e0a\u5b89\u88c5\u865a\u62df\u673a\u7ba1\u7406\u7a0b\u5e8f\u8f6f\u4ef6\uff0c\u4e3a\u5176\u5206\u914d\u4e00\u4e2a IP \u5730\u5740\uff0c\u5e76\u786e\u4fdd\u5c06\u5176\u8fde\u63a5\u5230 CloudStack \u7ba1\u7406\u670d\u52a1\u5668\u3002<br/><br/>\u8bf7\u63d0\u4f9b\u4e3b\u673a\u7684 DNS \u6216 IP \u5730\u5740\u3001\u7528\u6237\u540d(\u901a\u5e38\u4e3a root)\u548c\u5bc6\u7801\uff0c\u4ee5\u53ca\u7528\u4e8e\u5bf9\u4e3b\u673a\u8fdb\u884c\u5206\u7c7b\u7684\u4efb\u4f55\u6807\u7b7e\u3002
 message.desc.primary.storage=\u6bcf\u4e2a\u7fa4\u96c6\u4e2d\u5fc5\u987b\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u4e3b\u5b58\u50a8\u670d\u52a1\u5668\uff0c\u73b0\u5728\u6211\u4eec\u5c06\u6dfb\u52a0\u7b2c\u4e00\u4e2a\u4e3b\u5b58\u50a8\u670d\u52a1\u5668\u3002\u4e3b\u5b58\u50a8\u4e2d\u5305\u542b\u5728\u7fa4\u96c6\u4e2d\u7684\u4e3b\u673a\u4e0a\u8fd0\u884c\u7684\u6240\u6709 VM \u7684\u78c1\u76d8\u5377\u3002\u8bf7\u4f7f\u7528\u5e95\u5c42\u865a\u62df\u673a\u7ba1\u7406\u7a0b\u5e8f\u652f\u6301\u7684\u7b26\u5408\u6807\u51c6\u7684\u534f\u8bae\u3002
 message.desc.secondary.storage=\u6bcf\u4e2a\u533a\u57df\u4e2d\u5fc5\u987b\u81f3\u5c11\u5305\u542b\u4e00\u4e2a NFS \u6216\u8f85\u52a9\u5b58\u50a8\u670d\u52a1\u5668\uff0c\u73b0\u5728\u6211\u4eec\u5c06\u6dfb\u52a0\u7b2c\u4e00\u4e2a NFS \u6216\u8f85\u52a9\u5b58\u50a8\u670d\u52a1\u5668\u3002\u8f85\u52a9\u5b58\u50a8\u7528\u4e8e\u5b58\u50a8 VM \u6a21\u677f\u3001ISO \u6620\u50cf\u548c VM \u78c1\u76d8\u5377\u5feb\u7167\u3002\u6b64\u670d\u52a1\u5668\u5fc5\u987b\u5bf9\u533a\u57df\u4e2d\u7684\u6240\u6709\u670d\u52a1\u5668\u53ef\u7528\u3002<br/><br/>\u8bf7\u63d0\u4f9b IP \u5730\u5740\u548c\u5bfc\u51fa\u8def\u5f84\u3002
 message.desc.zone=\u533a\u57df\u662f CloudStack \u4e2d\u6700\u5927\u7684\u7ec4\u7ec7\u5355\u4f4d\uff0c\u4e00\u4e2a\u533a\u57df\u901a\u5e38\u4e0e\u4e00\u4e2a\u6570\u636e\u4e2d\u5fc3\u76f8\u5bf9\u5e94\u3002\u533a\u57df\u53ef\u63d0\u4f9b\u7269\u7406\u9694\u79bb\u548c\u5197\u4f59\u3002\u4e00\u4e2a\u533a\u57df\u7531\u4e00\u4e2a\u6216\u591a\u4e2a\u63d0\u4f9b\u70b9\u4ee5\u53ca\u7531\u533a\u57df\u4e2d\u7684\u6240\u6709\u63d0\u4f9b\u70b9\u5171\u4eab\u7684\u4e00\u4e2a\u8f85\u52a9\u5b58\u50a8\u670d\u52a1\u5668\u7ec4\u6210\uff0c\u5176\u4e2d\u6bcf\u4e2a\u63d0\u4f9b\u70b9\u4e2d\u5305\u542b\u591a\u4e2a\u4e3b\u673a\u548c\u4e3b\u5b58\u50a8\u670d\u52a1\u5668\u3002
@@ -1447,7 +1445,6 @@ message.step.3.continue=\u8bf7\u9009\u62e9\u4e00\u79cd\u78c1\u76d8\u65b9\u6848\u
 message.step.3.desc=
 message.step.4.continue=\u8bf7\u81f3\u5c11\u9009\u62e9\u4e00\u4e2a\u7f51\u7edc\u4ee5\u7ee7\u7eed
 message.step.4.desc=\u8bf7\u9009\u62e9\u865a\u62df\u5b9e\u4f8b\u8981\u8fde\u63a5\u5230\u7684\u4e3b\u7f51\u7edc\u3002
-message.storage.traffic=CloudStack \u5185\u90e8\u8d44\u6e90(\u5305\u62ec\u4e0e\u7ba1\u7406\u670d\u52a1\u5668\u901a\u4fe1\u7684\u4efb\u4f55\u7ec4\u4ef6\uff0c\u4f8b\u5982\u4e3b\u673a\u548c CloudStack \u7cfb\u7edf VM)\u4e4b\u95f4\u7684\u6d41\u91cf\u3002\u8bf7\u5728\u6b64\u5904\u914d\u7f6e\u5b58\u50a8\u6d41\u91cf\u3002
 message.suspend.project=\u662f\u5426\u786e\u5b9e\u8981\u6682\u505c\u6b64\u9879\u76ee?
 message.template.desc=\u53ef\u7528\u4e8e\u542f\u52a8 VM \u7684\u64cd\u4f5c\u7cfb\u7edf\u6620\u50cf
 message.tooltip.dns.1=\u4f9b\u533a\u57df\u4e2d\u7684 VM \u4f7f\u7528\u7684 DNS \u670d\u52a1\u5668\u540d\u79f0\u3002\u533a\u57df\u7684\u516c\u7528 IP \u5730\u5740\u5fc5\u987b\u8def\u7531\u5230\u6b64\u670d\u52a1\u5668\u3002

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index 743cd36..197ba27 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -85,6 +85,11 @@
       <artifactId>cloud-plugin-network-midonet</artifactId>
       <version>${project.version}</version>
     </dependency>
+  <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-network-internallb</artifactId>
+      <version>${project.version}</version>
+    </dependency>
     <dependency>
       <groupId>org.apache.cloudstack</groupId>
       <artifactId>cloud-plugin-hypervisor-xen</artifactId>
@@ -239,6 +244,11 @@
       <artifactId>cloud-plugin-host-anti-affinity</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-console-proxy</artifactId>
+      <version>${project.version}</version>
+    </dependency>
   </dependencies>
   <build>
     <defaultGoal>install</defaultGoal>
@@ -450,16 +460,15 @@
             </goals>
             <configuration>
               <target if="${nonoss}">
-                <echo>test</echo>
                 <replaceregexp
                   file="${basedir}/target/generated-webapp/WEB-INF/web.xml"
                   match="classpath:componentContext.xml"
                   replace="classpath:nonossComponentContext.xml" byline="true" />
-                <exec executable="cp">
-                    <arg value="-r" />
-                    <arg value="${basedir}/../plugins/network-elements/cisco-vnmc/scripts" />
-                    <arg value="${basedir}/target/generated-webapp/WEB-INF/classes/" />
-                </exec>
+                <copy overwrite="true" todir="${basedir}/target/generated-webapp/WEB-INF/classes/scripts">
+                    <fileset dir="${basedir}/../plugins/network-elements/cisco-vnmc/scripts">
+                        <include name="**/*" />
+                    </fileset>
+                </copy>
               </target>
             </configuration>
           </execution>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/tomcatconf/applicationContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/applicationContext.xml.in b/client/tomcatconf/applicationContext.xml.in
index 40c2182..222924c 100644
--- a/client/tomcatconf/applicationContext.xml.in
+++ b/client/tomcatconf/applicationContext.xml.in
@@ -82,7 +82,7 @@
     <property name="messageSerializer" ref="messageSerializer" />
   </bean>
 
-  <bean id="eventBus" class = "org.apache.cloudstack.framework.eventbus.EventBusBase" />
+  <bean id="messageBus" class = "org.apache.cloudstack.framework.messagebus.MessageBusBase" />
 
   <!--
     DAO with customized configuration
@@ -165,8 +165,8 @@
   <bean id="accountDaoImpl" class="com.cloud.user.dao.AccountDaoImpl" />
   <bean id="accountDetailsDaoImpl" class="com.cloud.user.AccountDetailsDaoImpl" />
   <bean id="accountJoinDaoImpl" class="com.cloud.api.query.dao.AccountJoinDaoImpl" />
+  <bean id="accountGuestVlanMapDaoImpl" class="com.cloud.network.dao.AccountGuestVlanMapDaoImpl" />
   <bean id="accountVlanMapDaoImpl" class="com.cloud.dc.dao.AccountVlanMapDaoImpl" />
-  <bean id="agentUpgradeDaoImpl" class="com.cloud.maint.dao.AgentUpgradeDaoImpl" />
   <bean id="alertDaoImpl" class="com.cloud.alert.dao.AlertDaoImpl" />
   <bean id="asyncJobDaoImpl" class="com.cloud.async.dao.AsyncJobDaoImpl" />
   <bean id="asyncJobJoinDaoImpl" class="com.cloud.api.query.dao.AsyncJobJoinDaoImpl" />
@@ -303,7 +303,6 @@
   <bean id="snapshotDaoImpl" class="com.cloud.storage.dao.SnapshotDaoImpl" />
   <bean id="snapshotPolicyDaoImpl" class="com.cloud.storage.dao.SnapshotPolicyDaoImpl" />
   <bean id="snapshotScheduleDaoImpl" class="com.cloud.storage.dao.SnapshotScheduleDaoImpl" />
-  <bean id="stackMaidDaoImpl" class="com.cloud.cluster.dao.StackMaidDaoImpl" />
   <bean id="staticRouteDaoImpl" class="com.cloud.network.vpc.dao.StaticRouteDaoImpl" />
   <bean id="storageNetworkIpAddressDaoImpl" class="com.cloud.dc.dao.StorageNetworkIpAddressDaoImpl" />
   <bean id="storageNetworkIpRangeDaoImpl" class="com.cloud.dc.dao.StorageNetworkIpRangeDaoImpl" />
@@ -366,6 +365,9 @@
   <bean id="vpcOfferingServiceMapDaoImpl" class="com.cloud.network.vpc.dao.VpcOfferingServiceMapDaoImpl" />
   <bean id="vpcServiceMapDaoImpl" class="com.cloud.network.vpc.dao.VpcServiceMapDaoImpl" />
   <bean id="vpnUserDaoImpl" class="com.cloud.network.dao.VpnUserDaoImpl" />
+  <bean id="applicationLbRuleDaoImpl" class="org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDaoImpl" />
+  <bean id="networkOfferingDetailsDaoImpl" class="com.cloud.offerings.dao.NetworkOfferingDetailsDaoImpl" />
+
 
   <!--
     Checkers
@@ -409,10 +411,12 @@
   <bean id="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement">
     <property name="name" value="VpcVirtualRouter"/>
   </bean>
-
   <bean id="elasticLoadBalancerElement" class="com.cloud.network.element.ElasticLoadBalancerElement">
     <property name="name" value="ElasticLoadBalancerElement"/>
   </bean>
+  <bean id="InternalLbVm" class="org.apache.cloudstack.network.element.InternalLoadBalancerElement">
+    <property name="name" value="InternalLbVm"/>
+  </bean>
 
   <!-- 
     General allocators
@@ -534,10 +538,14 @@
   -->
   <bean id="UserDispersingPlanner" class="com.cloud.deploy.UserDispersingPlanner">
     <property name="name" value="UserDispersing"/>
+	<property name="StoragePoolAllocators" value="#{storagePoolAllocators.Adapters}" />
+    <property name="HostAllocators" value="#{hostAllocators.Adapters}" />
   </bean>
   
   <bean id="UserConcentratedPodPlanner" class="com.cloud.deploy.UserConcentratedPodPlanner">
     <property name="name" value="UserConcentratedPod"/>
+	<property name="StoragePoolAllocators" value="#{storagePoolAllocators.Adapters}" />
+    <property name="HostAllocators" value="#{hostAllocators.Adapters}" />
   </bean>
 
   <bean id="clusterBasedAgentLoadBalancerPlanner" class="com.cloud.cluster.agentlb.ClusterBasedAgentLoadBalancerPlanner">
@@ -703,7 +711,6 @@
   <bean id="taggedResourceManagerImpl" class="com.cloud.tags.TaggedResourceManagerImpl" />
   <bean id="resourceMetaDataManagerImpl" class="com.cloud.metadata.ResourceMetaDataManagerImpl" />
   <bean id="templateManagerImpl" class="com.cloud.template.TemplateManagerImpl" />
-  <bean id="upgradeManagerImpl" class="com.cloud.maint.UpgradeManagerImpl" />
   <bean id="uploadMonitorImpl" class="com.cloud.storage.upload.UploadMonitorImpl" />
   <bean id="usageServiceImpl" class="com.cloud.usage.UsageServiceImpl" />
   <bean id="virtualNetworkApplianceManagerImpl" class="com.cloud.network.router.VirtualNetworkApplianceManagerImpl" />
@@ -790,6 +797,8 @@
   <bean id="vMSnapshotManagerImpl" class="com.cloud.vm.snapshot.VMSnapshotManagerImpl" />
   <bean id="volumeManagerImpl" class="com.cloud.storage.VolumeManagerImpl" />
   <bean id="ClassicalPrimaryDataStoreProvider" class="org.apache.cloudstack.storage.datastore.provider.CloudStackPrimaryDataStoreProviderImpl" />
+  <bean id="ApplicationLoadBalancerService" class="org.apache.cloudstack.network.lb.ApplicationLoadBalancerManagerImpl" />
+  <bean id="InternalLoadBalancerVMManager" class="org.apache.cloudstack.network.lb.InternalLoadBalancerVMManagerImpl" />
 
 
 <!--=======================================================================================================-->

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index ccd6adf..0e6f3a7 100644
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -67,7 +67,7 @@ getVMPassword=15
 restoreVirtualMachine=15
 changeServiceForVirtualMachine=15
 scaleVirtualMachine=15
-assignVirtualMachine=1
+assignVirtualMachine=7
 migrateVirtualMachine=1
 migrateVirtualMachineWithVolume=1
 recoverVirtualMachine=7
@@ -127,6 +127,9 @@ deleteVlanIpRange=1
 listVlanIpRanges=1
 dedicatePublicIpRange=1
 releasePublicIpRange=1
+dedicateGuestVlanRange=1
+releaseDedicatedGuestVlanRange=1
+listDedicatedGuestVlanRanges=1
 
 #### address commands
 associateIpAddress=15
@@ -583,11 +586,22 @@ removeFromGlobalLoadBalancerRule=15
 listVMSnapshot=15
 createVMSnapshot=15
 deleteVMSnapshot=15
-revertToSnapshot=15
+revertToVMSnapshot=15
 
 #### Baremetal commands
 addBaremetalHost=1
 
+#### New Load Balancer commands
+createLoadBalancer=15
+listLoadBalancers=15
+deleteLoadBalancer=15
+
+#Internal Load Balancer Element commands
+configureInternalLoadBalancerElement=1
+createInternalLoadBalancerElement=1
+listInternalLoadBalancerElements=1
+
+
 #### Affinity group commands
 createAffinityGroup=15
 deleteAffinityGroup=15
@@ -605,3 +619,10 @@ addCiscoAsa1000vResource=1
 deleteCiscoAsa1000vResource=1
 listCiscoAsa1000vResources=1
 
+#### Internal LB VM commands
+stopInternalLoadBalancerVM=1
+startInternalLoadBalancerVM=1
+listInternalLoadBalancerVMs=1
+
+### Network Isolation methods listing
+listNetworkIsolationMethods=1

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/tomcatconf/componentContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/componentContext.xml.in b/client/tomcatconf/componentContext.xml.in
index 7a46981..8a45e5f 100644
--- a/client/tomcatconf/componentContext.xml.in
+++ b/client/tomcatconf/componentContext.xml.in
@@ -198,6 +198,7 @@
           <ref bean="VirtualRouter"/>
           <ref bean="VpcVirtualRouter"/>
           <ref bean="NiciraNvp"/>
+          <ref bean="InternalLbVm"/>
       </list>
     </property>
   </bean>
@@ -241,6 +242,7 @@
           <ref bean="VpcVirtualRouter"/>
           <ref bean="NiciraNvp" />
           <ref bean="MidoNetElement"/>
+          <ref bean="InternalLbVm"/>
 <!--
           <ref bean="BareMetalDhcp"/>
           <ref bean="BareMetalPxe"/>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/tomcatconf/nonossComponentContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/nonossComponentContext.xml.in b/client/tomcatconf/nonossComponentContext.xml.in
index 2359ba8..1b6ee6e 100644
--- a/client/tomcatconf/nonossComponentContext.xml.in
+++ b/client/tomcatconf/nonossComponentContext.xml.in
@@ -42,7 +42,7 @@
   independent configuration
     
 -->
-  <bean id="premiumDatabaseUpgradeChecker" class="com.cloud.upgrade.PremiumDatabaseUpgradeChecker"/>
+  <bean id="DatabaseUpgradeChecker" class="com.cloud.upgrade.DatabaseUpgradeChecker"/>
   <bean id="GlobalLoadBalancingRulesServiceImpl" class ="org.apache.cloudstack.region.gslb.GlobalLoadBalancingRulesServiceImpl" >
     <property name="GslbServiceProvider">
       <ref bean="Netscaler"/>
@@ -294,6 +294,7 @@
           <ref bean="VirtualRouter"/>
           <ref bean="VpcVirtualRouter"/>
           <ref bean="NiciraNvp"/>
+          <ref bean="InternalLbVm"/>
       </list>
     </property>
   </bean>
@@ -343,6 +344,7 @@
           <ref bean="Ovs"/>
           <ref bean="SecurityGroupProvider"/>
           <ref bean="VpcVirtualRouter"/>
+          <ref bean="InternalLbVm"/>
 <!--
           <ref bean="BareMetalDhcp"/>
           <ref bean="BareMetalPxe"/>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/tomcatconf/simulatorComponentContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/simulatorComponentContext.xml.in b/client/tomcatconf/simulatorComponentContext.xml.in
index 9d8c6c0..652c4c8 100644
--- a/client/tomcatconf/simulatorComponentContext.xml.in
+++ b/client/tomcatconf/simulatorComponentContext.xml.in
@@ -205,6 +205,7 @@
         <ref bean="Ovs"/>
         <ref bean="SecurityGroupProvider"/>
         <ref bean="VpcVirtualRouter"/>
+        <ref bean="InternalLbVm"/>
         <!--
                   <ref bean="BareMetalDhcp"/>
                   <ref bean="BareMetalPxe"/>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 0da6952..a2d487e 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -37,6 +37,11 @@
       <version>${project.version}</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-engine-schema</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
       <groupId>commons-httpclient</groupId>
       <artifactId>commons-httpclient</artifactId>
       <version>${cs.httpclient.version}</version>
@@ -55,7 +60,5 @@
   </dependencies>
   <build>
     <defaultGoal>install</defaultGoal>
-    <sourceDirectory>src</sourceDirectory>
-    <testSourceDirectory>test</testSourceDirectory>
   </build>
 </project>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/RecoveryHandler.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/RecoveryHandler.java b/core/src/com/cloud/agent/RecoveryHandler.java
deleted file mode 100644
index 418c7b1..0000000
--- a/core/src/com/cloud/agent/RecoveryHandler.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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.agent;
-
-import com.cloud.agent.api.Command;
-
-public interface RecoveryHandler {
-    /**
-     * Perform the necessary recovery because the success of this command
-     * is not known.
-     * 
-     * @param agentId agent the commands were sent to.
-     * @param seq sequence number.
-     * @param cmds commands that failed.
-     */
-    public void handle(long agentId, long seq, Command[] cmds);
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/AgentControlAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/AgentControlAnswer.java b/core/src/com/cloud/agent/api/AgentControlAnswer.java
new file mode 100644
index 0000000..7dbf7b5
--- /dev/null
+++ b/core/src/com/cloud/agent/api/AgentControlAnswer.java
@@ -0,0 +1,30 @@
+// 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.agent.api;
+
+public class AgentControlAnswer extends Answer {
+	public AgentControlAnswer() {
+	}
+
+    public AgentControlAnswer(Command command) {
+        super(command);
+    }
+
+    public AgentControlAnswer(Command command, boolean success, String details) {
+    	super(command, success, details);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/AgentControlCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/AgentControlCommand.java b/core/src/com/cloud/agent/api/AgentControlCommand.java
new file mode 100644
index 0000000..da187ac
--- /dev/null
+++ b/core/src/com/cloud/agent/api/AgentControlCommand.java
@@ -0,0 +1,27 @@
+// 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.agent.api;
+
+public class AgentControlCommand extends Command {
+
+	public AgentControlCommand() {
+	}
+
+    public boolean executeInSequence() {
+    	return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/AttachIsoCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/AttachIsoCommand.java b/core/src/com/cloud/agent/api/AttachIsoCommand.java
new file mode 100644
index 0000000..c6f0b61
--- /dev/null
+++ b/core/src/com/cloud/agent/api/AttachIsoCommand.java
@@ -0,0 +1,59 @@
+// 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.agent.api;
+
+public class AttachIsoCommand extends Command {
+
+	private String vmName;
+	private String storeUrl;
+	private String isoPath;
+	private boolean attach;
+
+	protected AttachIsoCommand() {
+	}
+
+	public AttachIsoCommand(String vmName, String isoPath, boolean attach) {
+		this.vmName = vmName;
+		this.isoPath = isoPath;
+		this.attach = attach;
+	}
+
+	@Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+	public String getVmName() {
+		return vmName;
+	}
+
+	public String getIsoPath() {
+		return isoPath;
+	}
+
+	public boolean isAttach() {
+	    return attach;
+	}
+
+	public String getStoreUrl() {
+		return storeUrl;
+	}
+
+	public void setStoreUrl(String url) {
+		storeUrl = url;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/AttachVolumeAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/AttachVolumeAnswer.java b/core/src/com/cloud/agent/api/AttachVolumeAnswer.java
new file mode 100644
index 0000000..b377b7c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/AttachVolumeAnswer.java
@@ -0,0 +1,58 @@
+// 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.agent.api;
+
+
+public class AttachVolumeAnswer extends Answer {
+    private Long deviceId;
+    private String chainInfo;
+
+    protected AttachVolumeAnswer() {
+
+    }
+
+    public AttachVolumeAnswer(AttachVolumeCommand cmd, String result) {
+        super(cmd, false, result);
+        this.deviceId = null;
+    }
+
+    public AttachVolumeAnswer(AttachVolumeCommand cmd, Long deviceId) {
+        super(cmd);
+        this.deviceId = deviceId;
+    }
+
+
+    public AttachVolumeAnswer(AttachVolumeCommand cmd) {
+        super(cmd);
+        this.deviceId = null;
+    }
+
+    /**
+     * @return the deviceId
+     */
+    public Long getDeviceId() {
+        return deviceId;
+    }
+
+    public void setChainInfo(String chainInfo) {
+    	this.chainInfo = chainInfo;
+    }
+
+    public String getChainInfo() {
+    	return chainInfo;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/AttachVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/AttachVolumeCommand.java b/core/src/com/cloud/agent/api/AttachVolumeCommand.java
new file mode 100644
index 0000000..302b8f8
--- /dev/null
+++ b/core/src/com/cloud/agent/api/AttachVolumeCommand.java
@@ -0,0 +1,99 @@
+// 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.agent.api;
+
+import com.cloud.storage.Storage.StoragePoolType;
+
+public class AttachVolumeCommand extends Command {
+
+	boolean attach;
+	String vmName;
+	StoragePoolType pooltype;
+	String poolUuid;
+	String volumeFolder;
+	String volumePath;
+	String volumeName;
+	Long deviceId;
+	String chainInfo;
+
+	protected AttachVolumeCommand() {
+	}
+
+	public AttachVolumeCommand(boolean attach, String vmName, StoragePoolType pooltype, String volumeFolder, String volumePath, String volumeName, Long deviceId, String chainInfo) {
+		this.attach = attach;
+		this.vmName = vmName;
+		this.pooltype = pooltype;
+		this.volumeFolder = volumeFolder;
+		this.volumePath = volumePath;
+		this.volumeName = volumeName;
+		this.deviceId = deviceId;
+		this.chainInfo = chainInfo;
+	}
+
+	@Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+	public boolean getAttach() {
+		return attach;
+	}
+
+	public String getVmName() {
+		return vmName;
+	}
+
+	public StoragePoolType getPooltype() {
+        return pooltype;
+    }
+
+    public void setPooltype(StoragePoolType pooltype) {
+        this.pooltype = pooltype;
+    }
+
+    public String getVolumeFolder() {
+		return volumeFolder;
+	}
+
+	public String getVolumePath() {
+		return volumePath;
+	}
+
+	public String getVolumeName() {
+		return volumeName;
+	}
+
+    public Long getDeviceId() {
+        return deviceId;
+    }
+
+    public void setDeviceId(Long deviceId) {
+        this.deviceId = deviceId;
+    }
+
+    public String getPoolUuid() {
+    	return poolUuid;
+    }
+
+    public void setPoolUuid(String poolUuid) {
+    	this.poolUuid = poolUuid;
+    }
+
+    public String getChainInfo() {
+    	return chainInfo;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/BackupSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/BackupSnapshotAnswer.java b/core/src/com/cloud/agent/api/BackupSnapshotAnswer.java
new file mode 100644
index 0000000..9e35db6
--- /dev/null
+++ b/core/src/com/cloud/agent/api/BackupSnapshotAnswer.java
@@ -0,0 +1,44 @@
+// 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.agent.api;
+
+
+public class BackupSnapshotAnswer extends Answer {
+    private String backupSnapshotName;
+    private boolean full;
+
+    protected BackupSnapshotAnswer() {
+
+    }
+
+    public BackupSnapshotAnswer(BackupSnapshotCommand cmd, boolean success, String result, String backupSnapshotName, boolean full) {
+        super(cmd, success, result);
+        this.backupSnapshotName = backupSnapshotName;
+        this.full = full;
+    }
+
+    /**
+     * @return the backupSnapshotName
+     */
+    public String getBackupSnapshotName() {
+        return backupSnapshotName;
+    }
+
+    public boolean isFull() {
+        return full;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/BackupSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/BackupSnapshotCommand.java b/core/src/com/cloud/agent/api/BackupSnapshotCommand.java
new file mode 100644
index 0000000..cac686d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/BackupSnapshotCommand.java
@@ -0,0 +1,121 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.agent.api.to.S3TO;
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.agent.api.to.SwiftTO;
+import com.cloud.storage.StoragePool;
+
+/**
+ * This currently assumes that both primary and secondary storage are mounted on the XenServer.
+ */
+public class BackupSnapshotCommand extends SnapshotCommand {
+    private String prevSnapshotUuid;
+    private String prevBackupUuid;
+    private boolean isVolumeInactive;
+    private String vmName;
+    private Long snapshotId;
+    @LogLevel(Log4jLevel.Off)
+    private SwiftTO swift;
+    private S3TO s3;
+    StorageFilerTO pool;
+    private Long secHostId;
+
+    protected BackupSnapshotCommand() {
+
+    }
+
+    /**
+     * @param primaryStoragePoolNameLabel   The UUID of the primary storage Pool
+     * @param secondaryStoragePoolURL  This is what shows up in the UI when you click on Secondary storage.
+     * @param snapshotUuid             The UUID of the snapshot which is going to be backed up
+     * @param prevSnapshotUuid         The UUID of the previous snapshot for this volume. This will be destroyed on the primary storage.
+     * @param prevBackupUuid           This is the UUID of the vhd file which was last backed up on secondary storage.
+     * @param firstBackupUuid          This is the backup of the first ever snapshot taken by the volume.
+     * @param isFirstSnapshotOfRootVolume true if this is the first snapshot of a root volume. Set the parent of the backup to null.
+     * @param isVolumeInactive         True if the volume belongs to a VM that is not running or is detached.
+     * @param secHostId                This is the Id of the secondary storage.
+     */
+    public BackupSnapshotCommand(String secondaryStoragePoolURL,
+                                 Long   dcId,
+                                 Long   accountId,
+                                 Long   volumeId,
+                                 Long   snapshotId,
+                                 Long   secHostId,
+                                 String volumePath,
+                                 StoragePool pool,
+                                 String snapshotUuid,
+                                 String snapshotName,
+                                 String prevSnapshotUuid,
+                                 String prevBackupUuid,
+                                 boolean isVolumeInactive,
+                                 String vmName,
+                                 int wait)
+    {
+        super(pool, secondaryStoragePoolURL, snapshotUuid, snapshotName, dcId, accountId, volumeId);
+        this.snapshotId = snapshotId;
+        this.prevSnapshotUuid = prevSnapshotUuid;
+        this.prevBackupUuid = prevBackupUuid;
+        this.isVolumeInactive = isVolumeInactive;
+        this.vmName = vmName;
+        this.secHostId = secHostId;
+        setVolumePath(volumePath);
+        setWait(wait);
+    }
+
+    public String getPrevSnapshotUuid() {
+        return prevSnapshotUuid;
+    }
+
+    public String getPrevBackupUuid() {
+        return prevBackupUuid;
+    }
+
+    public boolean isVolumeInactive() {
+        return isVolumeInactive;
+    }
+
+    public String getVmName() {
+        return vmName;
+    }
+
+    public SwiftTO getSwift() {
+        return swift;
+    }
+
+    public void setSwift(SwiftTO swift) {
+        this.swift = swift;
+    }
+
+    public S3TO getS3() {
+        return s3;
+    }
+
+    public void setS3(S3TO s3) {
+        this.s3 = s3;
+    }
+
+    public Long getSnapshotId() {
+        return snapshotId;
+    }
+
+    public Long getSecHostId() {
+        return secHostId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/BumpUpPriorityCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/BumpUpPriorityCommand.java b/core/src/com/cloud/agent/api/BumpUpPriorityCommand.java
new file mode 100644
index 0000000..5d3f10f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/BumpUpPriorityCommand.java
@@ -0,0 +1,30 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.routing.NetworkElementCommand;
+
+public class BumpUpPriorityCommand extends NetworkElementCommand {
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public BumpUpPriorityCommand() {
+        super();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CancelCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CancelCommand.java b/core/src/com/cloud/agent/api/CancelCommand.java
new file mode 100644
index 0000000..0692055
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CancelCommand.java
@@ -0,0 +1,45 @@
+// 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.agent.api;
+
+
+
+public class CancelCommand extends Command {
+    protected long sequence;
+    protected String reason;
+
+    protected CancelCommand() {
+    }
+
+    public CancelCommand(long sequence, String reason) {
+        this.sequence = sequence;
+        this.reason = reason;
+    }
+
+    public long getSequence() {
+        return sequence;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ChangeAgentAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ChangeAgentAnswer.java b/core/src/com/cloud/agent/api/ChangeAgentAnswer.java
new file mode 100644
index 0000000..537eabe
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ChangeAgentAnswer.java
@@ -0,0 +1,26 @@
+// 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.agent.api;
+
+public class ChangeAgentAnswer extends Answer {
+	protected ChangeAgentAnswer() {
+	}
+
+	public ChangeAgentAnswer(ChangeAgentCommand cmd, boolean result) {
+		super(cmd, result, null);
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ChangeAgentCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ChangeAgentCommand.java b/core/src/com/cloud/agent/api/ChangeAgentCommand.java
new file mode 100644
index 0000000..abdb60a
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ChangeAgentCommand.java
@@ -0,0 +1,46 @@
+// 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.agent.api;
+
+import com.cloud.host.Status.Event;
+
+public class ChangeAgentCommand extends Command {
+	long agentId;
+	Event event;
+
+	protected ChangeAgentCommand() {
+	}
+
+	public ChangeAgentCommand(long agentId, Event event) {
+		this.agentId = agentId;
+		this.event = event;
+	}
+
+	public long getAgentId() {
+		return agentId;
+	}
+
+	public Event getEvent() {
+		return event;
+	}
+
+	@Override
+	public boolean executeInSequence() {
+		return false;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckHealthAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckHealthAnswer.java b/core/src/com/cloud/agent/api/CheckHealthAnswer.java
new file mode 100644
index 0000000..f9f723a
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckHealthAnswer.java
@@ -0,0 +1,26 @@
+// 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.agent.api;
+
+public class CheckHealthAnswer extends Answer {
+
+    public CheckHealthAnswer() {}
+
+    public CheckHealthAnswer(CheckHealthCommand cmd, boolean alive) {
+        super(cmd, alive, "resource is " + (alive? "alive" : "not alive"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckHealthCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckHealthCommand.java b/core/src/com/cloud/agent/api/CheckHealthCommand.java
new file mode 100644
index 0000000..ff42276
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckHealthCommand.java
@@ -0,0 +1,30 @@
+// 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.agent.api;
+
+public class CheckHealthCommand extends Command {
+
+    public CheckHealthCommand() {
+        setWait(50);
+    }
+
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckNetworkAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckNetworkAnswer.java b/core/src/com/cloud/agent/api/CheckNetworkAnswer.java
new file mode 100644
index 0000000..52825fd
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckNetworkAnswer.java
@@ -0,0 +1,38 @@
+// 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.agent.api;
+
+public class CheckNetworkAnswer extends Answer {
+    // indicate if agent reconnect is needed after setupNetworkNames command
+    private boolean _reconnect;
+    public CheckNetworkAnswer() {}
+
+
+    public CheckNetworkAnswer(CheckNetworkCommand cmd, boolean result, String details, boolean reconnect) {
+        super(cmd, result, details);
+        _reconnect = reconnect;
+    }
+
+    public CheckNetworkAnswer(CheckNetworkCommand cmd, boolean result, String details) {
+        this(cmd, result, details, false);
+    }
+
+    public boolean needReconnect() {
+        return _reconnect;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckNetworkCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckNetworkCommand.java b/core/src/com/cloud/agent/api/CheckNetworkCommand.java
new file mode 100644
index 0000000..8e1be56
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckNetworkCommand.java
@@ -0,0 +1,42 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.network.PhysicalNetworkSetupInfo;
+
+public class CheckNetworkCommand extends Command {
+
+    List<PhysicalNetworkSetupInfo> networkInfoList;
+
+    public CheckNetworkCommand(List<PhysicalNetworkSetupInfo> networkInfoList) {
+        this.networkInfoList = networkInfoList;
+    }
+
+    public List<PhysicalNetworkSetupInfo> getPhysicalNetworkInfoList() {
+        return networkInfoList;
+    }
+
+    protected CheckNetworkCommand() {
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckOnHostAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckOnHostAnswer.java b/core/src/com/cloud/agent/api/CheckOnHostAnswer.java
new file mode 100644
index 0000000..e5325e3
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckOnHostAnswer.java
@@ -0,0 +1,48 @@
+// 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.agent.api;
+
+public class CheckOnHostAnswer extends Answer {
+    boolean determined;
+    boolean alive;
+
+    protected CheckOnHostAnswer() {
+    }
+
+    public CheckOnHostAnswer(CheckOnHostCommand cmd, Boolean alive, String details) {
+        super(cmd, true, details);
+        if (alive == null) {
+            determined = false;
+        } else {
+            determined = true;
+            this.alive = alive;
+        }
+    }
+
+    public CheckOnHostAnswer(CheckOnHostCommand cmd, String details) {
+        super(cmd, false, details);
+    }
+
+    public boolean isDetermined() {
+        return determined;
+    }
+
+    public boolean isAlive() {
+        return alive;
+    }
+
+}


[02/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/SnapshotDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/SnapshotDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/SnapshotDaoImpl.java
new file mode 100644
index 0000000..f55663f
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/SnapshotDaoImpl.java
@@ -0,0 +1,357 @@
+// 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.storage.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.List;
+
+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.server.ResourceTag.TaggedResourceType;
+import com.cloud.storage.Snapshot;
+import com.cloud.storage.Snapshot.Event;
+import com.cloud.storage.Snapshot.State;
+import com.cloud.storage.Snapshot.Type;
+import com.cloud.storage.SnapshotVO;
+import com.cloud.storage.Volume;
+import com.cloud.storage.VolumeVO;
+import com.cloud.storage.dao.VolumeDaoImpl.SumCount;
+import com.cloud.tags.dao.ResourceTagDao;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.JoinBuilder.JoinType;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.Transaction;
+import com.cloud.vm.VMInstanceVO;
+import com.cloud.vm.dao.VMInstanceDao;
+
+@Component
+@Local (value={SnapshotDao.class})
+public class SnapshotDaoImpl extends GenericDaoBase<SnapshotVO, Long> implements SnapshotDao {
+    public static final Logger s_logger = Logger.getLogger(SnapshotDaoImpl.class.getName());
+    private static final String GET_LAST_SNAPSHOT = "SELECT id FROM snapshots where volume_id = ? AND id != ? AND path IS NOT NULL ORDER BY created DESC";
+    private static final String UPDATE_SNAPSHOT_VERSION = "UPDATE snapshots SET version = ? WHERE volume_id = ? AND version = ?";
+    private static final String GET_SECHOST_ID = "SELECT sechost_id FROM snapshots where volume_id = ? AND backup_snap_id IS NOT NULL AND sechost_id IS NOT NULL LIMIT 1";
+    private static final String UPDATE_SECHOST_ID = "UPDATE snapshots SET sechost_id = ? WHERE data_center_id = ?";
+
+    private SearchBuilder<SnapshotVO> VolumeIdSearch;
+    private SearchBuilder<SnapshotVO> VolumeIdTypeSearch;
+    private SearchBuilder<SnapshotVO> ParentIdSearch;
+    private SearchBuilder<SnapshotVO> backupUuidSearch;
+    private SearchBuilder<SnapshotVO> VolumeIdVersionSearch;
+    private SearchBuilder<SnapshotVO> HostIdSearch;
+    private SearchBuilder<SnapshotVO> AccountIdSearch;
+    private SearchBuilder<SnapshotVO> InstanceIdSearch;
+    private SearchBuilder<SnapshotVO> StatusSearch;
+    private GenericSearchBuilder<SnapshotVO, Long> CountSnapshotsByAccount;
+    private GenericSearchBuilder<SnapshotVO, SumCount> secondaryStorageSearch;
+    @Inject ResourceTagDao _tagsDao;
+    @Inject protected VMInstanceDao _instanceDao;
+    @Inject protected VolumeDao _volumeDao;
+
+    @Override
+    public SnapshotVO findNextSnapshot(long snapshotId) {
+        SearchCriteria<SnapshotVO> sc = ParentIdSearch.create();
+        sc.setParameters("prevSnapshotId", snapshotId);
+        return findOneIncludingRemovedBy(sc);
+    }
+    
+    @Override
+     public List<SnapshotVO> listByBackupUuid(long volumeId, String backupUuid) {
+        SearchCriteria<SnapshotVO> sc = backupUuidSearch.create();
+        sc.setParameters("backupUuid", backupUuid);
+        return listBy(sc, null);
+    }
+    
+    @Override
+    public List<SnapshotVO> listByVolumeIdType(long volumeId, Type type ) {
+        return listByVolumeIdType(null, volumeId, type);
+    }
+    
+    
+    @Override
+    public List<SnapshotVO> listByVolumeIdVersion(long volumeId, String version ) {
+        return listByVolumeIdVersion(null, volumeId, version);
+    }
+
+    @Override
+    public List<SnapshotVO> listByVolumeId(long volumeId) {
+        return listByVolumeId(null, volumeId);
+    }
+    
+    @Override
+    public List<SnapshotVO> listByVolumeId(Filter filter, long volumeId ) {
+        SearchCriteria<SnapshotVO> sc = VolumeIdSearch.create();
+        sc.setParameters("volumeId", volumeId);
+        return listBy(sc, filter);
+    }
+    
+    @Override
+    public List<SnapshotVO> listByHostId(long hostId) {
+        return listByHostId(null, hostId);
+    }
+    
+    @Override
+    public List<SnapshotVO> listByHostId(Filter filter, long hostId ) {
+        SearchCriteria<SnapshotVO> sc = HostIdSearch.create();
+        sc.setParameters("hostId", hostId);
+        sc.setParameters("status", Snapshot.State.BackedUp);
+        return listBy(sc, filter);
+    }
+        
+    @Override
+    public List<SnapshotVO> listByVolumeIdIncludingRemoved(long volumeId) {
+        SearchCriteria<SnapshotVO> sc = VolumeIdSearch.create();
+        sc.setParameters("volumeId", volumeId);
+        return listIncludingRemovedBy(sc, null);
+    }
+    
+    public List<SnapshotVO> listByVolumeIdType(Filter filter, long volumeId, Type type ) {
+        SearchCriteria<SnapshotVO> sc = VolumeIdTypeSearch.create();
+        sc.setParameters("volumeId", volumeId);
+        sc.setParameters("type", type.ordinal());
+        return listBy(sc, filter);
+    }
+    
+    public List<SnapshotVO> listByVolumeIdVersion(Filter filter, long volumeId, String version ) {
+        SearchCriteria<SnapshotVO> sc = VolumeIdVersionSearch.create();
+        sc.setParameters("volumeId", volumeId);
+        sc.setParameters("version", version);
+        return listBy(sc, filter);
+    }
+
+    public SnapshotDaoImpl() {
+    }
+    
+    @PostConstruct
+    protected void init() {
+        VolumeIdSearch = createSearchBuilder();
+        VolumeIdSearch.and("volumeId", VolumeIdSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
+        VolumeIdSearch.done();
+        
+        HostIdSearch = createSearchBuilder();
+        HostIdSearch.and("hostId", HostIdSearch.entity().getSecHostId(), SearchCriteria.Op.EQ);
+        HostIdSearch.and("status", HostIdSearch.entity().getState(), SearchCriteria.Op.EQ);
+        HostIdSearch.done();
+        
+        VolumeIdTypeSearch = createSearchBuilder();
+        VolumeIdTypeSearch.and("volumeId", VolumeIdTypeSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
+        VolumeIdTypeSearch.and("type", VolumeIdTypeSearch.entity().getsnapshotType(), SearchCriteria.Op.EQ);
+        VolumeIdTypeSearch.done();
+        
+        VolumeIdVersionSearch = createSearchBuilder();
+        VolumeIdVersionSearch.and("volumeId", VolumeIdVersionSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
+        VolumeIdVersionSearch.and("version", VolumeIdVersionSearch.entity().getVersion(), SearchCriteria.Op.EQ);
+        VolumeIdVersionSearch.done();
+        
+        ParentIdSearch = createSearchBuilder();
+        ParentIdSearch.and("prevSnapshotId", ParentIdSearch.entity().getPrevSnapshotId(), SearchCriteria.Op.EQ);
+        ParentIdSearch.done();
+        
+        backupUuidSearch = createSearchBuilder();
+        backupUuidSearch.and("backupUuid", backupUuidSearch.entity().getBackupSnapshotId(), SearchCriteria.Op.EQ);
+        backupUuidSearch.done();
+
+        AccountIdSearch = createSearchBuilder();
+        AccountIdSearch.and("accountId", AccountIdSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AccountIdSearch.done();
+        
+        StatusSearch = createSearchBuilder();
+        StatusSearch.and("volumeId", StatusSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
+        StatusSearch.and("status", StatusSearch.entity().getState(), SearchCriteria.Op.IN);
+        StatusSearch.done();
+        
+        CountSnapshotsByAccount = createSearchBuilder(Long.class);
+        CountSnapshotsByAccount.select(null, Func.COUNT, null);        
+        CountSnapshotsByAccount.and("account", CountSnapshotsByAccount.entity().getAccountId(), SearchCriteria.Op.EQ);
+        CountSnapshotsByAccount.and("removed", CountSnapshotsByAccount.entity().getRemoved(), SearchCriteria.Op.NULL);
+        CountSnapshotsByAccount.done();
+        
+        InstanceIdSearch = createSearchBuilder();
+        InstanceIdSearch.and("status", InstanceIdSearch.entity().getState(), SearchCriteria.Op.IN);
+
+        SearchBuilder<VMInstanceVO> instanceSearch = _instanceDao.createSearchBuilder();
+        instanceSearch.and("instanceId", instanceSearch.entity().getId(), SearchCriteria.Op.EQ);
+
+        SearchBuilder<VolumeVO> volumeSearch = _volumeDao.createSearchBuilder();
+        volumeSearch.and("state", volumeSearch.entity().getState(), SearchCriteria.Op.EQ);
+        volumeSearch.join("instanceVolumes", instanceSearch, instanceSearch.entity().getId(), volumeSearch.entity().getInstanceId(), JoinType.INNER);
+
+        InstanceIdSearch.join("instanceSnapshots", volumeSearch, volumeSearch.entity().getId(), InstanceIdSearch.entity().getVolumeId(), JoinType.INNER);
+        InstanceIdSearch.done();
+
+        secondaryStorageSearch = createSearchBuilder(SumCount.class);
+        secondaryStorageSearch.select("sum", Func.SUM, secondaryStorageSearch.entity().getSize());
+        secondaryStorageSearch.and("accountId", secondaryStorageSearch.entity().getAccountId(), Op.EQ);
+        secondaryStorageSearch.and("isRemoved", secondaryStorageSearch.entity().getRemoved(), Op.NULL);
+        secondaryStorageSearch.done();
+    }
+
+    @Override
+    public Long getSecHostId(long volumeId) {
+
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        String sql = GET_SECHOST_ID;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql);
+            pstmt.setLong(1, volumeId);
+            ResultSet rs = pstmt.executeQuery();
+            if (rs.next()) {
+                return rs.getLong(1);
+            }
+        } catch (Exception ex) {
+        }
+        return null;      
+    }
+    @Override
+    public long getLastSnapshot(long volumeId, long snapId) {
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        String sql = GET_LAST_SNAPSHOT;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql);
+            pstmt.setLong(1, volumeId);
+            pstmt.setLong(2, snapId);
+            ResultSet rs = pstmt.executeQuery();
+            if (rs.next()) {
+                return rs.getLong(1);
+            }
+        } catch (Exception ex) {
+            s_logger.error("error getting last snapshot", ex);
+        }
+        return 0;
+    }
+
+    @Override
+    public long updateSnapshotVersion(long volumeId, String from, String to) {
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        String sql = UPDATE_SNAPSHOT_VERSION;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql);
+            pstmt.setString(1, to);
+            pstmt.setLong(2, volumeId);
+            pstmt.setString(3, from);
+            pstmt.executeUpdate();
+            return 1;
+        } catch (Exception ex) {
+            s_logger.error("error getting last snapshot", ex);
+        }
+        return 0;
+    }
+    
+    @Override
+    public long updateSnapshotSecHost(long dcId, long secHostId) {
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        String sql = UPDATE_SECHOST_ID;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql);
+            pstmt.setLong(1, secHostId);
+            pstmt.setLong(2, dcId);
+            pstmt.executeUpdate();
+            return 1;
+        } catch (Exception ex) {
+            s_logger.error("error set secondary storage host id", ex);
+        }
+        return 0;
+    }
+
+    @Override
+    public Long countSnapshotsForAccount(long accountId) {
+    	SearchCriteria<Long> sc = CountSnapshotsByAccount.create();
+        sc.setParameters("account", accountId);
+        return customSearch(sc, null).get(0);
+    }
+    
+    @Override
+	public List<SnapshotVO> listByInstanceId(long instanceId, Snapshot.State... status) {
+    	SearchCriteria<SnapshotVO> sc = this.InstanceIdSearch.create();
+    	
+    	if (status != null && status.length != 0) {
+    	    sc.setParameters("status", (Object[])status);
+    	}
+    	
+    	sc.setJoinParameters("instanceSnapshots", "state", Volume.State.Ready);
+    	sc.setJoinParameters("instanceVolumes", "instanceId", instanceId);
+        return listBy(sc, null);
+    }
+    
+    @Override
+    public List<SnapshotVO> listByStatus(long volumeId, Snapshot.State... status) {
+    	SearchCriteria<SnapshotVO> sc = this.StatusSearch.create();
+    	sc.setParameters("volumeId", volumeId);
+    	sc.setParameters("status", (Object[])status);
+    	return listBy(sc, null);
+    }
+    
+    @Override
+    @DB
+    public boolean remove(Long id) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        SnapshotVO entry = findById(id);
+        if (entry != null) {
+            _tagsDao.removeByIdAndType(id, TaggedResourceType.Snapshot);
+        }
+        boolean result = super.remove(id);
+        txn.commit();
+        return result;
+    }
+    
+    @Override
+    public List<SnapshotVO> listAllByStatus(Snapshot.State... status) {
+        SearchCriteria<SnapshotVO> sc = this.StatusSearch.create();
+        sc.setParameters("status", (Object[])status);
+        return listBy(sc, null);
+    }
+
+    @Override
+    public boolean updateState(State currentState, Event event, State nextState, SnapshotVO snapshot, Object data) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        SnapshotVO snapshotVO = (SnapshotVO)snapshot;
+        snapshotVO.setState(nextState);
+        super.update(snapshotVO.getId(), snapshotVO);
+        txn.commit();
+        return true;
+    }
+
+    @Override
+    public long secondaryStorageUsedForAccount(long accountId) {
+        SearchCriteria<SumCount> sc = secondaryStorageSearch.create();
+        sc.setParameters("accountId", accountId);
+        List<SumCount> storageSpace = customSearch(sc, null);
+        if (storageSpace != null) {
+            return storageSpace.get(0).sum;
+        } else {
+            return 0;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/SnapshotPolicyDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/SnapshotPolicyDao.java b/engine/schema/src/com/cloud/storage/dao/SnapshotPolicyDao.java
new file mode 100644
index 0000000..467d491
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/SnapshotPolicyDao.java
@@ -0,0 +1,38 @@
+// 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.storage.dao;
+
+import java.util.List;
+
+import com.cloud.storage.SnapshotPolicyVO;
+import com.cloud.utils.DateUtil.IntervalType;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDao;
+
+/*
+ * Data Access Object for snapshot_policy table
+ */
+public interface SnapshotPolicyDao extends GenericDao<SnapshotPolicyVO, Long> {
+	List<SnapshotPolicyVO> listByVolumeId(long volumeId);
+	List<SnapshotPolicyVO> listByVolumeId(long volumeId, Filter filter);
+    Pair<List<SnapshotPolicyVO>, Integer> listAndCountByVolumeId(long volumeId);
+    Pair<List<SnapshotPolicyVO>, Integer> listAndCountByVolumeId(long volumeId, Filter filter);
+	SnapshotPolicyVO findOneByVolumeInterval(long volumeId, IntervalType intvType);
+    List<SnapshotPolicyVO> listActivePolicies();
+    SnapshotPolicyVO findOneByVolume(long volumeId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/SnapshotPolicyDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/SnapshotPolicyDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/SnapshotPolicyDaoImpl.java
new file mode 100644
index 0000000..3f894a2
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/SnapshotPolicyDaoImpl.java
@@ -0,0 +1,105 @@
+// 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.storage.dao;
+
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.storage.SnapshotPolicyVO;
+import com.cloud.utils.DateUtil.IntervalType;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local (value={SnapshotPolicyDao.class})
+public class SnapshotPolicyDaoImpl extends GenericDaoBase<SnapshotPolicyVO, Long> implements SnapshotPolicyDao {
+	private final SearchBuilder<SnapshotPolicyVO> VolumeIdSearch;
+	private final SearchBuilder<SnapshotPolicyVO> VolumeIdIntervalSearch;
+	private final SearchBuilder<SnapshotPolicyVO> ActivePolicySearch;
+	
+	@Override
+	public SnapshotPolicyVO findOneByVolumeInterval(long volumeId, IntervalType intvType) {
+		SearchCriteria<SnapshotPolicyVO> sc = VolumeIdIntervalSearch.create();
+        sc.setParameters("volumeId", volumeId);
+        sc.setParameters("interval", intvType.ordinal());
+		return findOneBy(sc);
+	}
+	
+   @Override
+    public SnapshotPolicyVO findOneByVolume(long volumeId) {
+        SearchCriteria<SnapshotPolicyVO> sc = VolumeIdSearch.create();
+        sc.setParameters("volumeId", volumeId);
+        sc.setParameters("active", true);
+        return findOneBy(sc);
+    }
+	
+	@Override
+	public List<SnapshotPolicyVO> listByVolumeId(long volumeId) {
+		return listByVolumeId(volumeId, null);
+	}
+	
+    @Override
+    public List<SnapshotPolicyVO> listByVolumeId(long volumeId, Filter filter) {
+        SearchCriteria<SnapshotPolicyVO> sc = VolumeIdSearch.create();
+        sc.setParameters("volumeId", volumeId);
+        sc.setParameters("active", true);
+        return listBy(sc, filter);
+    }
+	
+    @Override
+    public Pair<List<SnapshotPolicyVO>, Integer> listAndCountByVolumeId(long volumeId) {
+        return listAndCountByVolumeId(volumeId, null);
+    }
+
+    @Override
+    public Pair<List<SnapshotPolicyVO>, Integer> listAndCountByVolumeId(long volumeId, Filter filter) {
+        SearchCriteria<SnapshotPolicyVO> sc = VolumeIdSearch.create();
+        sc.setParameters("volumeId", volumeId);
+        sc.setParameters("active", true);
+        return searchAndCount(sc, filter);
+    }
+
+    protected SnapshotPolicyDaoImpl() {
+        VolumeIdSearch = createSearchBuilder();
+        VolumeIdSearch.and("volumeId", VolumeIdSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
+        VolumeIdSearch.and("active", VolumeIdSearch.entity().isActive(), SearchCriteria.Op.EQ);
+        VolumeIdSearch.done();
+        
+        VolumeIdIntervalSearch = createSearchBuilder();
+        VolumeIdIntervalSearch.and("volumeId", VolumeIdIntervalSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
+        VolumeIdIntervalSearch.and("interval", VolumeIdIntervalSearch.entity().getInterval(), SearchCriteria.Op.EQ);
+        VolumeIdIntervalSearch.done();
+        
+        ActivePolicySearch = createSearchBuilder();
+        ActivePolicySearch.and("active", ActivePolicySearch.entity().isActive(), SearchCriteria.Op.EQ);
+        ActivePolicySearch.done();
+    }
+
+    @Override
+    public List<SnapshotPolicyVO> listActivePolicies() {
+        SearchCriteria<SnapshotPolicyVO> sc = ActivePolicySearch.create();
+        sc.setParameters("active", true);
+        return listIncludingRemovedBy(sc);
+    }	
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/SnapshotScheduleDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/SnapshotScheduleDao.java b/engine/schema/src/com/cloud/storage/dao/SnapshotScheduleDao.java
new file mode 100644
index 0000000..0419e28
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/SnapshotScheduleDao.java
@@ -0,0 +1,41 @@
+// 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.storage.dao;
+
+
+import java.util.Date;
+import java.util.List;
+import com.cloud.storage.SnapshotPolicyVO;
+import com.cloud.storage.SnapshotScheduleVO;
+import com.cloud.utils.db.GenericDao;
+
+/*
+ * Data Access Object for snapshot_schedule table
+ */
+public interface SnapshotScheduleDao extends GenericDao<SnapshotScheduleVO, Long> {
+
+	List<SnapshotScheduleVO> getCoincidingSnapshotSchedules(long volumeId, Date date);
+
+    List<SnapshotScheduleVO> getSchedulesToExecute(Date currentTimestamp);
+
+    SnapshotScheduleVO getCurrentSchedule(Long volumeId, Long policyId, boolean executing);
+
+    SnapshotScheduleVO findOneByVolume(long volumeId);
+
+    SnapshotScheduleVO findOneByVolumePolicy(long volumeId, long policyId);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/SnapshotScheduleDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/SnapshotScheduleDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/SnapshotScheduleDaoImpl.java
new file mode 100644
index 0000000..c01644e
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/SnapshotScheduleDaoImpl.java
@@ -0,0 +1,134 @@
+// 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.storage.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.storage.Snapshot;
+import com.cloud.storage.SnapshotScheduleVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local (value={SnapshotScheduleDao.class})
+public class SnapshotScheduleDaoImpl extends GenericDaoBase<SnapshotScheduleVO, Long> implements SnapshotScheduleDao {
+	protected final SearchBuilder<SnapshotScheduleVO> executableSchedulesSearch;
+	protected final SearchBuilder<SnapshotScheduleVO> coincidingSchedulesSearch;
+    private final SearchBuilder<SnapshotScheduleVO> VolumeIdSearch;
+    private final SearchBuilder<SnapshotScheduleVO> VolumeIdPolicyIdSearch;
+	
+	
+	protected SnapshotScheduleDaoImpl() {
+		
+	    executableSchedulesSearch = createSearchBuilder();
+        executableSchedulesSearch.and("scheduledTimestamp", executableSchedulesSearch.entity().getScheduledTimestamp(), SearchCriteria.Op.LT);
+        executableSchedulesSearch.and("asyncJobId", executableSchedulesSearch.entity().getAsyncJobId(), SearchCriteria.Op.NULL);
+        executableSchedulesSearch.done();
+        
+        coincidingSchedulesSearch = createSearchBuilder();
+        coincidingSchedulesSearch.and("volumeId", coincidingSchedulesSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
+        coincidingSchedulesSearch.and("scheduledTimestamp", coincidingSchedulesSearch.entity().getScheduledTimestamp(), SearchCriteria.Op.LT);
+        coincidingSchedulesSearch.and("asyncJobId", coincidingSchedulesSearch.entity().getAsyncJobId(), SearchCriteria.Op.NULL);
+        coincidingSchedulesSearch.done();
+        
+        VolumeIdSearch = createSearchBuilder();
+        VolumeIdSearch.and("volumeId", VolumeIdSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
+        VolumeIdSearch.done();
+        
+        VolumeIdPolicyIdSearch = createSearchBuilder();
+        VolumeIdPolicyIdSearch.and("volumeId", VolumeIdPolicyIdSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
+        VolumeIdPolicyIdSearch.and("policyId", VolumeIdPolicyIdSearch.entity().getPolicyId(), SearchCriteria.Op.EQ);
+        VolumeIdPolicyIdSearch.done();
+		
+	}
+	
+	/**
+	 * {@inheritDoc} 
+	 */
+	@Override
+	public List<SnapshotScheduleVO> getCoincidingSnapshotSchedules(long volumeId, Date date) {
+		SearchCriteria<SnapshotScheduleVO> sc = coincidingSchedulesSearch.create();
+	    sc.setParameters("volumeId", volumeId);
+	    sc.setParameters("scheduledTimestamp", date);
+	    // Don't return manual snapshots. They will be executed through another code path.
+        sc.addAnd("policyId", SearchCriteria.Op.NEQ, 1L);
+        return listBy(sc);
+	}
+
+	
+    @Override
+    public SnapshotScheduleVO findOneByVolume(long volumeId) {
+        SearchCriteria<SnapshotScheduleVO> sc = VolumeIdSearch.create();
+        sc.setParameters("volumeId", volumeId);
+        return findOneBy(sc);
+    }
+    
+    
+    @Override
+    public SnapshotScheduleVO findOneByVolumePolicy(long volumeId, long policyId) {
+        SearchCriteria<SnapshotScheduleVO> sc = VolumeIdPolicyIdSearch.create();
+        sc.setParameters("volumeId", volumeId);
+        sc.setParameters("policyId", policyId);
+        return findOneBy(sc);
+    }
+	/**
+     * {@inheritDoc} 
+     */
+    @Override
+    public List<SnapshotScheduleVO> getSchedulesToExecute(Date currentTimestamp) {
+        SearchCriteria<SnapshotScheduleVO> sc = executableSchedulesSearch.create();
+        sc.setParameters("scheduledTimestamp", currentTimestamp);
+        return listBy(sc);
+    }
+    
+    /**
+     * {@inheritDoc} 
+     */
+    @Override
+    public SnapshotScheduleVO getCurrentSchedule(Long volumeId, Long policyId, boolean executing) {
+        assert volumeId != null;
+        SearchCriteria<SnapshotScheduleVO> sc = createSearchCriteria();
+        SearchCriteria.Op op = executing ? SearchCriteria.Op.NNULL : SearchCriteria.Op.NULL;
+        sc.addAnd("volumeId", SearchCriteria.Op.EQ, volumeId);
+        if (policyId != null) {
+            sc.addAnd("policyId", SearchCriteria.Op.EQ, policyId);
+            if (policyId != Snapshot.MANUAL_POLICY_ID) {
+                // manual policies aren't scheduled by the snapshot poller, so don't look for the jobId here
+                sc.addAnd("asyncJobId", op);
+            }
+        } else {
+            sc.addAnd("asyncJobId", op);
+        }
+
+        List<SnapshotScheduleVO> snapshotSchedules = listBy(sc);
+        // This will return only one schedule because of a DB uniqueness constraint.
+        assert (snapshotSchedules.size() <= 1);
+        if (snapshotSchedules.isEmpty()) {
+            return null;
+        }
+        else {
+            return snapshotSchedules.get(0);
+        }
+    }
+    
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/StoragePoolDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/StoragePoolDetailsDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/StoragePoolDetailsDaoImpl.java
new file mode 100644
index 0000000..38b5253
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/StoragePoolDetailsDaoImpl.java
@@ -0,0 +1,85 @@
+// 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.storage.dao;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+
+import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value=StoragePoolDetailsDao.class)
+public class StoragePoolDetailsDaoImpl extends GenericDaoBase<StoragePoolDetailVO, Long> implements StoragePoolDetailsDao {
+    
+    protected final SearchBuilder<StoragePoolDetailVO> PoolSearch;
+    
+    protected StoragePoolDetailsDaoImpl() {
+        super();
+        PoolSearch = createSearchBuilder();
+        PoolSearch.and("pool", PoolSearch.entity().getPoolId(), SearchCriteria.Op.EQ);
+        PoolSearch.and("name", PoolSearch.entity().getName(), SearchCriteria.Op.EQ);
+        PoolSearch.done();
+    }
+    
+    @Override
+    public void update(long poolId, Map<String, String> details) {
+        Transaction txn = Transaction.currentTxn();
+        SearchCriteria<StoragePoolDetailVO> sc = PoolSearch.create();
+        sc.setParameters("pool", poolId);
+        
+        txn.start();
+        expunge(sc);
+        for (Map.Entry<String, String> entry : details.entrySet()) {
+            StoragePoolDetailVO detail = new StoragePoolDetailVO(poolId, entry.getKey(), entry.getValue());
+            persist(detail);
+        }
+        txn.commit();
+    }
+    
+    @Override
+    public Map<String, String> getDetails(long poolId) {
+    	SearchCriteria<StoragePoolDetailVO> sc = PoolSearch.create();
+    	sc.setParameters("pool", poolId);
+    	
+    	List<StoragePoolDetailVO> details = listBy(sc);
+    	Map<String, String> detailsMap = new HashMap<String, String>();
+    	for (StoragePoolDetailVO detail : details) {
+    		detailsMap.put(detail.getName(), detail.getValue());
+    	}
+    	
+    	return detailsMap;
+    }
+
+    @Override
+    public StoragePoolDetailVO findDetail(long poolId, String name) {
+        SearchCriteria<StoragePoolDetailVO> sc = PoolSearch.create();
+        sc.setParameters("pool", poolId);
+        sc.setParameters("name", name);
+
+        return findOneIncludingRemovedBy(sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/StoragePoolHostDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/StoragePoolHostDao.java b/engine/schema/src/com/cloud/storage/dao/StoragePoolHostDao.java
new file mode 100644
index 0000000..8dd10a7
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/StoragePoolHostDao.java
@@ -0,0 +1,42 @@
+// 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.storage.dao;
+
+import java.util.List;
+
+import com.cloud.host.Status;
+import com.cloud.storage.StoragePoolHostVO;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.GenericDao;
+
+public interface StoragePoolHostDao extends GenericDao<StoragePoolHostVO, Long> {
+    public List<StoragePoolHostVO> listByPoolId(long id);
+
+    public List<StoragePoolHostVO> listByHostIdIncludingRemoved(long hostId);
+
+    public StoragePoolHostVO findByPoolHost(long poolId, long hostId);
+
+    List<StoragePoolHostVO> listByHostStatus(long poolId, Status hostStatus);
+
+    List<Pair<Long, Integer>> getDatacenterStoragePoolHostInfo(long dcId, boolean sharedOnly);
+
+    public void deletePrimaryRecordsForHost(long hostId);
+
+    public void deleteStoragePoolHostDetails(long hostId, long poolId);
+
+    List<StoragePoolHostVO> listByHostId(long hostId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/StoragePoolHostDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/StoragePoolHostDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/StoragePoolHostDaoImpl.java
new file mode 100644
index 0000000..4f509d1
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/StoragePoolHostDaoImpl.java
@@ -0,0 +1,184 @@
+// 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.storage.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.host.Status;
+import com.cloud.storage.StoragePoolHostVO;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value = { StoragePoolHostDao.class })
+public class StoragePoolHostDaoImpl extends GenericDaoBase<StoragePoolHostVO, Long> implements StoragePoolHostDao {
+    public static final Logger s_logger = Logger.getLogger(StoragePoolHostDaoImpl.class.getName());
+
+    protected final SearchBuilder<StoragePoolHostVO> PoolSearch;
+    protected final SearchBuilder<StoragePoolHostVO> HostSearch;
+    protected final SearchBuilder<StoragePoolHostVO> PoolHostSearch;
+
+    protected static final String HOST_FOR_POOL_SEARCH = "SELECT * FROM storage_pool_host_ref ph,  host h where  ph.host_id = h.id and ph.pool_id=? and h.status=? ";
+
+    protected static final String STORAGE_POOL_HOST_INFO = "SELECT p.data_center_id,  count(ph.host_id) " + " FROM storage_pool p, storage_pool_host_ref ph "
+            + " WHERE p.id = ph.pool_id AND p.data_center_id = ? " + " GROUP by p.data_center_id";
+
+    protected static final String SHARED_STORAGE_POOL_HOST_INFO = "SELECT p.data_center_id,  count(ph.host_id) " + " FROM storage_pool p, storage_pool_host_ref ph "
+            + " WHERE p.id = ph.pool_id AND p.data_center_id = ? " + " AND p.pool_type NOT IN ('LVM', 'Filesystem')" + " GROUP by p.data_center_id";
+
+    protected static final String DELETE_PRIMARY_RECORDS = "DELETE " + "FROM storage_pool_host_ref " + "WHERE host_id = ?";
+
+    public StoragePoolHostDaoImpl() {
+        PoolSearch = createSearchBuilder();
+        PoolSearch.and("pool_id", PoolSearch.entity().getPoolId(), SearchCriteria.Op.EQ);
+        PoolSearch.done();
+
+        HostSearch = createSearchBuilder();
+        HostSearch.and("host_id", HostSearch.entity().getHostId(), SearchCriteria.Op.EQ);
+        HostSearch.done();
+
+        PoolHostSearch = createSearchBuilder();
+        PoolHostSearch.and("pool_id", PoolHostSearch.entity().getPoolId(), SearchCriteria.Op.EQ);
+        PoolHostSearch.and("host_id", PoolHostSearch.entity().getHostId(), SearchCriteria.Op.EQ);
+        PoolHostSearch.done();
+
+    }
+
+    @Override
+    public List<StoragePoolHostVO> listByPoolId(long id) {
+        SearchCriteria<StoragePoolHostVO> sc = PoolSearch.create();
+        sc.setParameters("pool_id", id);
+        return listIncludingRemovedBy(sc);
+    }
+
+    @Override
+    public List<StoragePoolHostVO> listByHostIdIncludingRemoved(long hostId) {
+        SearchCriteria<StoragePoolHostVO> sc = HostSearch.create();
+        sc.setParameters("host_id", hostId);
+        return listIncludingRemovedBy(sc);
+    }
+    
+    @Override
+    public List<StoragePoolHostVO> listByHostId(long hostId) {
+        SearchCriteria<StoragePoolHostVO> sc = HostSearch.create();
+        sc.setParameters("host_id", hostId);
+        return listBy(sc);
+    }
+
+    @Override
+    public StoragePoolHostVO findByPoolHost(long poolId, long hostId) {
+        SearchCriteria<StoragePoolHostVO> sc = PoolHostSearch.create();
+        sc.setParameters("pool_id", poolId);
+        sc.setParameters("host_id", hostId);
+        return findOneIncludingRemovedBy(sc);
+    }
+
+    @Override
+    public List<StoragePoolHostVO> listByHostStatus(long poolId, Status hostStatus) {
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        List<StoragePoolHostVO> result = new ArrayList<StoragePoolHostVO>();
+        ResultSet rs = null;
+        try {
+            String sql = HOST_FOR_POOL_SEARCH;
+            pstmt = txn.prepareStatement(sql);
+
+            pstmt.setLong(1, poolId);
+            pstmt.setString(2, hostStatus.toString());
+            rs = pstmt.executeQuery();
+            while (rs.next()) {
+                // result.add(toEntityBean(rs, false)); TODO: this is buggy in GenericDaoBase for hand constructed queries
+                long id = rs.getLong(1); // ID column
+                result.add(findById(id));
+            }
+        } catch (Exception e) {
+            s_logger.warn("Exception: ", e);
+        } finally {
+            try {
+                if (rs != null) {
+                    rs.close();
+                }
+                if (pstmt != null) {
+                    pstmt.close();
+                }
+            } catch (SQLException e) {
+            }
+        }
+        return result;
+
+    }
+
+    @Override
+    public List<Pair<Long, Integer>> getDatacenterStoragePoolHostInfo(long dcId, boolean sharedOnly) {
+        ArrayList<Pair<Long, Integer>> l = new ArrayList<Pair<Long, Integer>>();
+        String sql = sharedOnly ? SHARED_STORAGE_POOL_HOST_INFO : STORAGE_POOL_HOST_INFO;
+        Transaction txn = Transaction.currentTxn();
+        ;
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql);
+            pstmt.setLong(1, dcId);
+
+            ResultSet rs = pstmt.executeQuery();
+            while (rs.next()) {
+                l.add(new Pair<Long, Integer>(rs.getLong(1), rs.getInt(2)));
+            }
+        } catch (SQLException e) {
+        } catch (Throwable e) {
+        }
+        return l;
+    }
+
+    /**
+     * This method deletes the primary records from the host
+     * 
+     * @param hostId
+     *            -- id of the host
+     */
+    @Override
+    public void deletePrimaryRecordsForHost(long hostId) {
+        SearchCriteria<StoragePoolHostVO> sc = HostSearch.create();
+        sc.setParameters("host_id", hostId);
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        remove(sc);
+        txn.commit();
+    }
+
+    @Override
+    public void deleteStoragePoolHostDetails(long hostId, long poolId) {
+        SearchCriteria<StoragePoolHostVO> sc = PoolHostSearch.create();
+        sc.setParameters("host_id", hostId);
+        sc.setParameters("pool_id", poolId);
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        remove(sc);
+        txn.commit();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/StoragePoolWorkDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/StoragePoolWorkDao.java b/engine/schema/src/com/cloud/storage/dao/StoragePoolWorkDao.java
new file mode 100644
index 0000000..c05abf5
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/StoragePoolWorkDao.java
@@ -0,0 +1,38 @@
+// 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.storage.dao;
+
+import java.util.List;
+
+import com.cloud.storage.StoragePoolWorkVO;
+import com.cloud.utils.db.GenericDao;
+/**
+ * Data Access Object for storage_pool table
+ */
+public interface StoragePoolWorkDao extends GenericDao<StoragePoolWorkVO, Long> {
+
+    List<StoragePoolWorkVO> listPendingWorkForPrepareForMaintenanceByPoolId(long poolId);
+
+    List<StoragePoolWorkVO> listPendingWorkForCancelMaintenanceByPoolId(long poolId);
+
+    StoragePoolWorkVO findByPoolIdAndVmId(long poolId, long vmId);
+
+    void removePendingJobsOnMsRestart(long msId, long poolId);
+
+    List<Long> searchForPoolIdsForPendingWorkJobs(long msId);
+        
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/StoragePoolWorkDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/StoragePoolWorkDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/StoragePoolWorkDaoImpl.java
new file mode 100644
index 0000000..360a814
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/StoragePoolWorkDaoImpl.java
@@ -0,0 +1,136 @@
+// 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.storage.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.storage.StoragePoolWorkVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Component
+@Local(value={StoragePoolWorkDao.class}) @DB(txn=false)
+public class StoragePoolWorkDaoImpl extends GenericDaoBase<StoragePoolWorkVO, Long>  implements StoragePoolWorkDao {
+
+    protected final SearchBuilder<StoragePoolWorkVO> PendingWorkForPrepareForMaintenanceSearch;
+    protected final SearchBuilder<StoragePoolWorkVO> PendingWorkForCancelMaintenanceSearch;
+    protected final SearchBuilder<StoragePoolWorkVO> PoolAndVmIdSearch;
+    protected final SearchBuilder<StoragePoolWorkVO> PendingJobsForDeadMs;
+    
+    private final String FindPoolIds = "SELECT distinct storage_pool_work.pool_id FROM storage_pool_work WHERE mgmt_server_id = ?";
+    
+    protected StoragePoolWorkDaoImpl() {
+        PendingWorkForPrepareForMaintenanceSearch = createSearchBuilder();
+        PendingWorkForPrepareForMaintenanceSearch.and("poolId", PendingWorkForPrepareForMaintenanceSearch.entity().getPoolId(), SearchCriteria.Op.EQ);
+        PendingWorkForPrepareForMaintenanceSearch.and("stoppedForMaintenance", PendingWorkForPrepareForMaintenanceSearch.entity().isStoppedForMaintenance(), SearchCriteria.Op.EQ);
+        PendingWorkForPrepareForMaintenanceSearch.and("startedAfterMaintenance", PendingWorkForPrepareForMaintenanceSearch.entity().isStartedAfterMaintenance(), SearchCriteria.Op.EQ);
+        PendingWorkForPrepareForMaintenanceSearch.done();
+        
+        PendingWorkForCancelMaintenanceSearch = createSearchBuilder();
+        PendingWorkForCancelMaintenanceSearch.and("poolId", PendingWorkForCancelMaintenanceSearch.entity().getPoolId(), SearchCriteria.Op.EQ);
+        PendingWorkForCancelMaintenanceSearch.and("stoppedForMaintenance", PendingWorkForCancelMaintenanceSearch.entity().isStoppedForMaintenance(), SearchCriteria.Op.EQ);
+        PendingWorkForCancelMaintenanceSearch.and("startedAfterMaintenance", PendingWorkForCancelMaintenanceSearch.entity().isStartedAfterMaintenance(), SearchCriteria.Op.EQ);
+        PendingWorkForCancelMaintenanceSearch.done();
+
+        PoolAndVmIdSearch = createSearchBuilder();
+        PoolAndVmIdSearch.and("poolId", PoolAndVmIdSearch.entity().getPoolId(), SearchCriteria.Op.EQ);
+        PoolAndVmIdSearch.and("vmId", PoolAndVmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ);
+        PoolAndVmIdSearch.done();
+        
+        PendingJobsForDeadMs = createSearchBuilder();
+        PendingJobsForDeadMs.and("managementServerId", PendingJobsForDeadMs.entity().getManagementServerId(), SearchCriteria.Op.EQ);
+        PendingJobsForDeadMs.and("poolId", PendingJobsForDeadMs.entity().getPoolId(), SearchCriteria.Op.EQ);
+        PendingJobsForDeadMs.and("stoppedForMaintenance", PendingJobsForDeadMs.entity().isStoppedForMaintenance(), SearchCriteria.Op.EQ);
+        PendingJobsForDeadMs.and("startedAfterMaintenance", PendingJobsForDeadMs.entity().isStartedAfterMaintenance(), SearchCriteria.Op.EQ);
+        PendingJobsForDeadMs.done();
+        
+    }
+    
+    @Override
+    public List<StoragePoolWorkVO> listPendingWorkForPrepareForMaintenanceByPoolId(long poolId) {
+        SearchCriteria<StoragePoolWorkVO> sc = PendingWorkForPrepareForMaintenanceSearch.create();
+        sc.setParameters("poolId", poolId);
+        sc.setParameters("stoppedForMaintenance", false);
+        sc.setParameters("startedAfterMaintenance", false);
+        return listBy(sc);
+    }
+    
+    @Override
+    public List<StoragePoolWorkVO> listPendingWorkForCancelMaintenanceByPoolId(long poolId) {
+        SearchCriteria<StoragePoolWorkVO> sc = PendingWorkForCancelMaintenanceSearch.create();
+        sc.setParameters("poolId", poolId);
+        sc.setParameters("stoppedForMaintenance", true);
+        sc.setParameters("startedAfterMaintenance", false);
+        return listBy(sc);
+    }
+    
+    @Override
+    public StoragePoolWorkVO findByPoolIdAndVmId(long poolId, long vmId) {
+        SearchCriteria<StoragePoolWorkVO> sc = PoolAndVmIdSearch.create();
+        sc.setParameters("poolId", poolId);
+        sc.setParameters("vmId", vmId);
+        return listBy(sc).get(0);
+    }
+    
+    @Override
+    public void removePendingJobsOnMsRestart(long msId, long poolId) {
+        //hung jobs are those which are stopped, but never started
+        SearchCriteria<StoragePoolWorkVO> sc = PendingJobsForDeadMs.create();
+        sc.setParameters("managementServerId", msId);
+        sc.setParameters("poolId", poolId);
+        sc.setParameters("stoppedForMaintenance", true);
+        sc.setParameters("startedAfterMaintenance", false);        
+        remove(sc);
+    }
+    
+    @Override
+    @DB
+    public List<Long> searchForPoolIdsForPendingWorkJobs(long msId){
+        
+        StringBuilder sql = new StringBuilder(FindPoolIds);
+
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql.toString());
+            pstmt.setLong(1, msId);
+
+            ResultSet rs = pstmt.executeQuery();
+            List<Long> poolIds = new ArrayList<Long>();
+
+            while (rs.next()) {
+                poolIds.add(rs.getLong("pool_id"));
+            }           
+            return poolIds;
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Unable to execute " + pstmt.toString(), e);
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/SwiftDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/SwiftDao.java b/engine/schema/src/com/cloud/storage/dao/SwiftDao.java
new file mode 100644
index 0000000..72c5219
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/SwiftDao.java
@@ -0,0 +1,31 @@
+// 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.storage.dao;
+
+import com.cloud.agent.api.to.SwiftTO;
+import com.cloud.storage.SwiftVO;
+import com.cloud.utils.db.GenericDao;
+
+/**
+ * 
+ * 
+ */
+
+public interface SwiftDao extends GenericDao<SwiftVO, Long> {
+
+    SwiftTO getSwiftTO(Long swiftId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/SwiftDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/SwiftDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/SwiftDaoImpl.java
new file mode 100644
index 0000000..19e5a85
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/SwiftDaoImpl.java
@@ -0,0 +1,58 @@
+// 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.storage.dao;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.agent.api.to.SwiftTO;
+import com.cloud.storage.SwiftVO;
+import com.cloud.utils.db.GenericDaoBase;
+
+/**
+ * 
+ * 
+ */
+@Component
+@Local (value={SwiftDao.class})
+public class SwiftDaoImpl extends GenericDaoBase<SwiftVO, Long> implements SwiftDao {
+    public static final Logger s_logger = Logger.getLogger(SwiftDaoImpl.class.getName());
+
+    @Override
+    public SwiftTO getSwiftTO(Long swiftId) {
+        if (swiftId != null) {
+            SwiftVO swift = findById(swiftId);
+            if (swift != null) {
+                return swift.toSwiftTO();
+            }
+            return null;
+        }
+
+        List<SwiftVO> swiftVOs = listAll();
+        if (swiftVOs == null || swiftVOs.size() < 1) {
+            return null;
+        } else {
+            Collections.shuffle(swiftVOs);
+            return swiftVOs.get(0).toSwiftTO();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/UploadDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/UploadDao.java b/engine/schema/src/com/cloud/storage/dao/UploadDao.java
new file mode 100755
index 0000000..06336ae
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/UploadDao.java
@@ -0,0 +1,36 @@
+// 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.storage.dao;
+
+import java.util.List;
+
+import com.cloud.storage.UploadVO;
+import com.cloud.storage.Upload.Status;
+import com.cloud.storage.Upload.Type;
+import com.cloud.storage.Upload.Mode;
+import com.cloud.utils.db.GenericDao;
+
+public interface UploadDao extends GenericDao<UploadVO, Long> {		
+
+	List<UploadVO> listByTypeUploadStatus(long typeId, Type type,
+			Status uploadState);
+
+	List<UploadVO> listByHostAndUploadStatus(long sserverId, Status uploadInProgress);
+	
+	List<UploadVO> listByModeAndStatus(Mode mode, Status uploadState);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/UploadDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/UploadDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/UploadDaoImpl.java
new file mode 100755
index 0000000..31fad43
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/UploadDaoImpl.java
@@ -0,0 +1,92 @@
+// 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.storage.dao;
+import java.util.List;
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.storage.UploadVO;
+import com.cloud.storage.Upload.Status;
+import com.cloud.storage.Upload.Mode;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value={UploadDao.class})
+public class UploadDaoImpl extends GenericDaoBase<UploadVO, Long> implements UploadDao {
+	public static final Logger s_logger = Logger.getLogger(UploadDaoImpl.class.getName());
+	protected final SearchBuilder<UploadVO> typeUploadStatusSearch;
+	protected final SearchBuilder<UploadVO> typeHostAndUploadStatusSearch;
+	protected final SearchBuilder<UploadVO> typeModeAndStatusSearch;
+	
+	protected static final String UPDATE_UPLOAD_INFO =
+		"UPDATE upload SET upload_state = ?, upload_pct= ?, last_updated = ? "
+	+   ", upload_error_str = ?, upload_job_id = ? "
+	+   "WHERE host_id = ? and type_id = ? and type = ?";
+	
+	protected static final String UPLOADS_STATE_DC=
+		"SELECT * FROM upload t, host h where t.host_id = h.id and h.data_center_id=? "
+	+	" and t.type_id=? and t.upload_state = ?" ;
+	
+	
+	public UploadDaoImpl() {
+		typeUploadStatusSearch = createSearchBuilder();
+		typeUploadStatusSearch.and("type_id", typeUploadStatusSearch.entity().getTypeId(), SearchCriteria.Op.EQ);
+		typeUploadStatusSearch.and("upload_state", typeUploadStatusSearch.entity().getUploadState(), SearchCriteria.Op.EQ);
+		typeUploadStatusSearch.and("type", typeUploadStatusSearch.entity().getType(), SearchCriteria.Op.EQ);
+		typeUploadStatusSearch.done();
+		
+		typeHostAndUploadStatusSearch = createSearchBuilder();
+		typeHostAndUploadStatusSearch.and("host_id", typeHostAndUploadStatusSearch.entity().getHostId(), SearchCriteria.Op.EQ);
+		typeHostAndUploadStatusSearch.and("upload_state", typeHostAndUploadStatusSearch.entity().getUploadState(), SearchCriteria.Op.EQ);
+		typeHostAndUploadStatusSearch.done();
+		
+		typeModeAndStatusSearch = createSearchBuilder();
+		typeModeAndStatusSearch.and("mode", typeModeAndStatusSearch.entity().getMode(), SearchCriteria.Op.EQ);
+		typeModeAndStatusSearch.and("upload_state", typeModeAndStatusSearch.entity().getUploadState(), SearchCriteria.Op.EQ);
+		typeModeAndStatusSearch.done();
+		
+	}
+	
+	@Override
+	public List<UploadVO> listByTypeUploadStatus(long typeId, UploadVO.Type type, UploadVO.Status uploadState) {
+		SearchCriteria<UploadVO> sc = typeUploadStatusSearch.create();
+		sc.setParameters("type_id", typeId);
+		sc.setParameters("type", type);
+		sc.setParameters("upload_state", uploadState.toString());
+		return listBy(sc);
+	}
+	
+	@Override
+    public List<UploadVO> listByHostAndUploadStatus(long sserverId, Status uploadState){	    
+        SearchCriteria<UploadVO> sc = typeHostAndUploadStatusSearch.create();
+        sc.setParameters("host_id", sserverId);
+        sc.setParameters("upload_state", uploadState.toString());
+        return listBy(sc);
+	}
+	
+	@Override
+	public List<UploadVO> listByModeAndStatus(Mode mode, Status uploadState){
+	    SearchCriteria<UploadVO> sc = typeModeAndStatusSearch.create();
+	    sc.setParameters("mode", mode.toString());
+	    sc.setParameters("upload_state", uploadState.toString());
+	    return listBy(sc);
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/storage/dao/VMTemplateDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/VMTemplateDao.java b/engine/schema/src/com/cloud/storage/dao/VMTemplateDao.java
new file mode 100755
index 0000000..8520757
--- /dev/null
+++ b/engine/schema/src/com/cloud/storage/dao/VMTemplateDao.java
@@ -0,0 +1,84 @@
+// 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.storage.dao;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateEvent;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState;
+
+import com.cloud.domain.DomainVO;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.projects.Project.ListProjectResourcesCriteria;
+import com.cloud.storage.VMTemplateVO;
+import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
+import com.cloud.user.Account;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.fsm.StateDao;
+
+/*
+ * Data Access Object for vm_templates table
+ */
+public interface VMTemplateDao extends GenericDao<VMTemplateVO, Long>, StateDao<TemplateState, TemplateEvent, VMTemplateVO> {
+	
+	
+	public List<VMTemplateVO> listByPublic();
+	public VMTemplateVO findByName(String templateName);
+	public VMTemplateVO findByTemplateName(String templateName);	
+
+	//public void update(VMTemplateVO template);
+
+
+	public List<VMTemplateVO> listAllSystemVMTemplates();
+
+	public List<VMTemplateVO> listDefaultBuiltinTemplates();
+	public String getRoutingTemplateUniqueName();
+	public List<VMTemplateVO> findIsosByIdAndPath(Long domainId, Long accountId, String path);
+	public List<VMTemplateVO> listReadyTemplates();
+	public List<VMTemplateVO> listByAccountId(long accountId);
+	public Set<Pair<Long, Long>> searchTemplates(String name, String keyword, TemplateFilter templateFilter, boolean isIso,
+	        List<HypervisorType> hypers, Boolean bootable, DomainVO domain, Long pageSize, Long startIndex, Long zoneId,
+	        HypervisorType hyperType, boolean onlyReady, boolean showDomr, List<Account> permittedAccounts, Account caller,
+	        ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags, String zoneType);
+	
+    public Set<Pair<Long, Long>> searchSwiftTemplates(String name, String keyword, TemplateFilter templateFilter,
+            boolean isIso, List<HypervisorType> hypers, Boolean bootable, DomainVO domain, Long pageSize, Long startIndex,
+            Long zoneId, HypervisorType hyperType, boolean onlyReady, boolean showDomr, List<Account> permittedAccounts, Account caller, Map<String, String> tags);
+
+    public Set<Pair<Long, Long>> searchS3Templates(String name, String keyword, TemplateFilter templateFilter,
+            boolean isIso, List<HypervisorType> hypers, Boolean bootable, DomainVO domain, Long pageSize, Long startIndex,
+            Long zoneId, HypervisorType hyperType, boolean onlyReady, boolean showDomr, List<Account> permittedAccounts, Account caller, Map<String, String> tags);
+
+	public long addTemplateToZone(VMTemplateVO tmplt, long zoneId);
+	public List<VMTemplateVO> listAllInZone(long dataCenterId);	
+	
+    public List<VMTemplateVO> listByHypervisorType(List<HypervisorType> hyperTypes);
+	public List<VMTemplateVO> publicIsoSearch(Boolean bootable, boolean listRemoved, Map<String, String> tags);
+	public List<VMTemplateVO> userIsoSearch(boolean listRemoved);
+    VMTemplateVO findSystemVMTemplate(long zoneId);
+    VMTemplateVO findSystemVMTemplate(long zoneId, HypervisorType hType);
+
+    VMTemplateVO findRoutingTemplate(HypervisorType type, String templateName);
+    List<Long> listPrivateTemplatesByHost(Long hostId);
+    public Long countTemplatesForAccount(long accountId);
+	
+    List<VMTemplateVO> findTemplatesToSyncToS3();
+
+}


[16/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java
new file mode 100644
index 0000000..b52e373
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java
@@ -0,0 +1,188 @@
+// 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.dc.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.DataCenterLinkLocalIpAddressVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+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.utils.net.NetUtils;
+
+@Component
+@Local(value={DataCenterLinkLocalIpAddressDaoImpl.class}) @DB(txn=false)
+public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCenterLinkLocalIpAddressVO, Long> implements DataCenterLinkLocalIpAddressDao {
+    private static final Logger s_logger = Logger.getLogger(DataCenterLinkLocalIpAddressDaoImpl.class);
+    
+    private final SearchBuilder<DataCenterLinkLocalIpAddressVO> AllFieldsSearch;
+    private final GenericSearchBuilder<DataCenterLinkLocalIpAddressVO, Integer> AllIpCount;
+    private final GenericSearchBuilder<DataCenterLinkLocalIpAddressVO, Integer> AllAllocatedIpCount;
+    
+    @DB
+    public DataCenterLinkLocalIpAddressVO takeIpAddress(long dcId, long podId, long instanceId, String reservationId) {
+        SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("pod", podId);
+        sc.setParameters("taken", (Date)null);
+        
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        
+        DataCenterLinkLocalIpAddressVO  vo = lockOneRandomRow(sc, true);
+        if (vo == null) {
+            return null;
+        }
+        
+        vo.setTakenAt(new Date());
+        vo.setInstanceId(instanceId);
+        vo.setReservationId(reservationId);
+        update(vo.getId(), vo);
+        txn.commit();
+        return vo;
+    }
+    
+    public boolean deleteIpAddressByPod(long podId) {
+        SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("pod", podId);
+        return remove(sc) > 0;
+    }
+    
+    @DB
+    public void addIpRange(long dcId, long podId, String start, String end) {
+        String insertSql = "INSERT INTO `cloud`.`op_dc_link_local_ip_address_alloc` (ip_address, data_center_id, pod_id) VALUES (?, ?, ?)";
+        PreparedStatement stmt = null;
+        
+        long startIP = NetUtils.ip2Long(start);
+        long endIP = NetUtils.ip2Long(end);
+
+        Transaction txn = Transaction.currentTxn();
+        try {
+            txn.start();
+            stmt = txn.prepareAutoCloseStatement(insertSql);
+            while (startIP <= endIP) {
+                    stmt.setString(1, NetUtils.long2Ip(startIP++));
+                    stmt.setLong(2, dcId);
+                    stmt.setLong(3, podId);
+                    stmt.addBatch();
+            }
+            stmt.executeBatch();
+            txn.commit();
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Unable to insert", e);
+        }
+    }
+    
+    public void releaseIpAddress(String ipAddress, long dcId, long instanceId) {
+    	if (s_logger.isDebugEnabled()) {
+    		s_logger.debug("Releasing ip address: " + ipAddress + " data center " + dcId);
+    	}
+        SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("ip", ipAddress);
+        sc.setParameters("dc", dcId);
+        sc.setParameters("instance", instanceId);
+
+        DataCenterLinkLocalIpAddressVO vo = createForUpdate();
+        
+        vo.setTakenAt(null);
+        vo.setInstanceId(null);
+        vo.setReservationId(null);
+        update(vo, sc);
+    }
+    
+    public void releaseIpAddress(long nicId, String reservationId) {
+        SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("instance", nicId);
+        sc.setParameters("reservation", reservationId);
+
+        DataCenterLinkLocalIpAddressVO vo = createForUpdate();
+        
+        vo.setTakenAt(null);
+        vo.setInstanceId(null);
+        vo.setReservationId(null);
+        update(vo, sc);
+    }
+    
+    public List<DataCenterLinkLocalIpAddressVO> listByPodIdDcId(long podId, long dcId) {
+		SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = AllFieldsSearch.create();
+		sc.setParameters("pod", podId);
+		return listBy(sc);
+	}
+    
+    public int countIPs(long podId, long dcId, boolean onlyCountAllocated) {
+        SearchCriteria<Integer> sc;
+        if (onlyCountAllocated) { 
+            sc = AllAllocatedIpCount.create();
+        } else {
+            sc = AllIpCount.create();
+        }
+        
+        sc.setParameters("pod", podId);
+        List<Integer> count = customSearch(sc, null);
+        return count.get(0);
+	}
+    
+    public DataCenterLinkLocalIpAddressDaoImpl() {
+        super();
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("ip", AllFieldsSearch.entity().getIpAddress(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("dc", AllFieldsSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("pod", AllFieldsSearch.entity().getPodId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("instance", AllFieldsSearch.entity().getInstanceId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("reservation", AllFieldsSearch.entity().getReservationId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("taken", AllFieldsSearch.entity().getTakenAt(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+        
+        AllIpCount = createSearchBuilder(Integer.class);
+        AllIpCount.select(null, Func.COUNT, AllIpCount.entity().getId());
+        AllIpCount.and("pod", AllIpCount.entity().getPodId(), SearchCriteria.Op.EQ);
+        AllIpCount.done();
+        
+        AllAllocatedIpCount = createSearchBuilder(Integer.class);
+        AllAllocatedIpCount.select(null, Func.COUNT, AllAllocatedIpCount.entity().getId());
+        AllAllocatedIpCount.and("pod", AllAllocatedIpCount.entity().getPodId(), SearchCriteria.Op.EQ);
+        AllAllocatedIpCount.and("removed", AllAllocatedIpCount.entity().getTakenAt(), SearchCriteria.Op.NNULL);
+        AllAllocatedIpCount.done();
+        
+    }
+    
+    @Override
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        super.configure(name, params);
+        
+        SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("ip", NetUtils.getLinkLocalGateway());
+        remove(sc);
+        
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDao.java b/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDao.java
new file mode 100644
index 0000000..778498d
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDao.java
@@ -0,0 +1,49 @@
+// 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.dc.dao;
+
+import java.util.List;
+
+import com.cloud.dc.DataCenterVnetVO;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.db.Transaction;
+
+public interface DataCenterVnetDao extends GenericDao<DataCenterVnetVO, Long> {
+    public List<DataCenterVnetVO> listAllocatedVnets(long physicalNetworkId);
+    public List<DataCenterVnetVO> listAllocatedVnetsInRange(long dcId, long physicalNetworkId, Integer start, Integer end);
+    public List<DataCenterVnetVO> findVnet(long dcId, String vnet);   
+    public int countZoneVlans(long dcId, boolean onlyCountAllocated);    
+    public List<DataCenterVnetVO> findVnet(long dcId, long physicalNetworkId, String vnet);
+    
+    public void add(long dcId, long physicalNetworkId, int start, int end);
+    
+    public void delete(long physicalNetworkId);
+
+    public void deleteRange(Transaction txn, long dcId, long physicalNetworkId, int start, int end);
+
+    public void lockRange(long dcId, long physicalNetworkId, Integer start, Integer end);
+
+    public DataCenterVnetVO take(long physicalNetworkId, long accountId, String reservationId, List<Long> vlanDbIds);
+
+    public void release(String vnet, long physicalNetworkId, long accountId, String reservationId);
+
+    public void releaseDedicatedGuestVlans(Long dedicatedGuestVlanRangeId);
+
+    public int countVnetsAllocatedToAccount(long dcId, long accountId);
+
+    public int countVnetsDedicatedToAccount(long dcId, long accountId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java
new file mode 100755
index 0000000..e97f2c6
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java
@@ -0,0 +1,318 @@
+// 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.dc.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import com.cloud.exception.InvalidParameterValueException;
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.DataCenterVnetVO;
+import com.cloud.network.dao.AccountGuestVlanMapDao;
+import com.cloud.network.dao.AccountGuestVlanMapVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDao;
+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.SearchCriteria.Op;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+/**
+ * DataCenterVnetDaoImpl maintains the one-to-many relationship between
+ * data center/physical_network and the vnet that appears within the physical network.
+ */
+@Component
+@DB(txn=false)
+public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long> implements DataCenterVnetDao {
+
+    private final SearchBuilder<DataCenterVnetVO> FreeVnetSearch;
+    private final SearchBuilder<DataCenterVnetVO> FreeDedicatedVnetSearch;
+    private final SearchBuilder<DataCenterVnetVO> VnetDcSearch;
+    private final SearchBuilder<DataCenterVnetVO> VnetDcSearchAllocated;
+    private final SearchBuilder<DataCenterVnetVO> DcSearchAllocated;
+    private final SearchBuilder<DataCenterVnetVO> DcSearchAllocatedInRange;
+    private final GenericSearchBuilder<DataCenterVnetVO, Integer> countZoneVlans;
+    private final GenericSearchBuilder<DataCenterVnetVO, Integer> countAllocatedZoneVlans;
+    private final SearchBuilder<DataCenterVnetVO> SearchRange;
+    private final SearchBuilder<DataCenterVnetVO> DedicatedGuestVlanRangeSearch;
+    private final GenericSearchBuilder<DataCenterVnetVO, Integer> countVnetsAllocatedToAccount;
+    protected GenericSearchBuilder<DataCenterVnetVO, Integer> countVnetsDedicatedToAccount;
+    protected SearchBuilder<AccountGuestVlanMapVO> AccountGuestVlanMapSearch;
+
+    @Inject protected AccountGuestVlanMapDao _accountGuestVlanMapDao;
+    
+    public List<DataCenterVnetVO> listAllocatedVnets(long physicalNetworkId) {
+        SearchCriteria<DataCenterVnetVO> sc = DcSearchAllocated.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);       
+        return listBy(sc);
+    }
+
+    public List<DataCenterVnetVO> listAllocatedVnetsInRange(long dcId, long physicalNetworkId, Integer start, Integer end) {
+        SearchCriteria<DataCenterVnetVO> sc = DcSearchAllocatedInRange.create();
+        sc.setParameters("dc",dcId);
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("vnetRange", start.toString(), end.toString());
+        return listBy(sc);
+    }
+
+    public void lockRange(long dcId, long physicalNetworkId, Integer start, Integer end) {
+        SearchCriteria<DataCenterVnetVO> sc = SearchRange.create();
+        sc.setParameters("dc",dcId);
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("vnetRange", start.toString(), end.toString());
+        lockRows(sc,null,true);
+    }
+
+    public List<DataCenterVnetVO> findVnet(long dcId, String vnet) {
+    	SearchCriteria<DataCenterVnetVO> sc = VnetDcSearch.create();;
+    	sc.setParameters("dc", dcId);
+    	sc.setParameters("vnet", vnet);
+    	return listBy(sc);
+    }
+    
+    public int countZoneVlans(long dcId, boolean onlyCountAllocated){    	
+        SearchCriteria<Integer> sc = onlyCountAllocated ?  countAllocatedZoneVlans.create() : countZoneVlans.create();
+        sc.setParameters("dc", dcId);                
+        return customSearch(sc, null).get(0);
+    }
+    
+    public List<DataCenterVnetVO> findVnet(long dcId, long physicalNetworkId, String vnet) {
+        SearchCriteria<DataCenterVnetVO> sc = VnetDcSearch.create();
+        sc.setParameters("dc", dcId);
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("vnet", vnet);
+
+        return listBy(sc);
+    }    
+    
+    @DB
+    public void add(long dcId, long physicalNetworkId, int start, int end) {
+        String insertVnet = "INSERT INTO `cloud`.`op_dc_vnet_alloc` (vnet, data_center_id, physical_network_id) VALUES ( ?, ?, ?)";
+        
+        Transaction txn = Transaction.currentTxn();
+        try {
+            txn.start();
+            PreparedStatement stmt = txn.prepareAutoCloseStatement(insertVnet);
+            for (int i = start; i <= end; i++) {
+                stmt.setString(1, String.valueOf(i));
+                stmt.setLong(2, dcId);
+                stmt.setLong(3, physicalNetworkId);
+                stmt.addBatch();
+            }
+            stmt.executeBatch();
+            txn.commit();
+        } catch (SQLException e) {
+           if (!e.getMessage().contains("Duplicate")){
+               txn.rollback();
+               txn.close();
+               throw new CloudRuntimeException("Exception caught adding vnet ", e);
+           }
+        }
+    }
+
+    public void deleteRange(Transaction txn, long dcId, long physicalNetworkId, int start, int end) {
+        String deleteVnet = "DELETE FROM `cloud`.`op_dc_vnet_alloc` WHERE data_center_id=? AND physical_network_id=? AND taken IS NULL AND vnet BETWEEN ? AND ?";
+        try {
+            PreparedStatement stmt = txn.prepareAutoCloseStatement(deleteVnet);
+            stmt.setLong(1,dcId);
+            stmt.setLong(2,physicalNetworkId);
+            stmt.setString(3,((Integer)start).toString());
+            stmt.setString(4,((Integer)end).toString());
+            stmt.execute();
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Exception caught adding vnet ", e);
+        }
+    }
+    public void delete(long physicalNetworkId) {
+        SearchCriteria<DataCenterVnetVO> sc = VnetDcSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        remove(sc);
+    }
+
+    @DB
+    public DataCenterVnetVO take(long physicalNetworkId, long accountId, String reservationId, List<Long> vlanDbIds) {
+        SearchCriteria<DataCenterVnetVO> sc;
+        if (vlanDbIds != null) {
+            sc = FreeDedicatedVnetSearch.create();
+            sc.setParameters("accountGuestVlanMapId", vlanDbIds.toArray());
+        } else {
+            sc = FreeVnetSearch.create();
+        }
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        Date now = new Date();
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        DataCenterVnetVO vo = lockOneRandomRow(sc, true);
+        if (vo == null) {
+            return null;
+        }
+
+        vo.setTakenAt(now);
+        vo.setAccountId(accountId);
+        vo.setReservationId(reservationId);
+        update(vo.getId(), vo);
+        txn.commit();
+        return vo;
+    }
+
+
+    public void release(String vnet, long physicalNetworkId, long accountId, String reservationId) {
+        SearchCriteria<DataCenterVnetVO> sc = VnetDcSearchAllocated.create();
+        sc.setParameters("vnet", vnet);
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("account", accountId);
+        sc.setParameters("reservation", reservationId);
+
+        DataCenterVnetVO vo = findOneIncludingRemovedBy(sc);
+        if (vo == null) {
+            return;
+        }
+
+        vo.setTakenAt(null);
+        vo.setAccountId(null);
+        vo.setReservationId(null);
+        update(vo.getId(), vo);
+    }
+
+    @Override
+    public void releaseDedicatedGuestVlans(Long dedicatedGuestVlanRangeId) {
+        SearchCriteria<DataCenterVnetVO> sc = DedicatedGuestVlanRangeSearch.create();
+        sc.setParameters("dedicatedGuestVlanRangeId", dedicatedGuestVlanRangeId);
+        List<DataCenterVnetVO> vnets = listBy(sc);
+        for(DataCenterVnetVO vnet : vnets) {
+           vnet.setAccountGuestVlanMapId(null);
+           update(vnet.getId(), vnet);
+        }
+    }
+
+    @Override
+    public int countVnetsAllocatedToAccount(long dcId, long accountId) {
+        SearchCriteria<Integer> sc = countVnetsAllocatedToAccount.create();
+        sc.setParameters("dc", dcId);
+        sc.setParameters("accountId", accountId);
+        return customSearch(sc, null).get(0);
+    }
+
+    @Override
+    public int countVnetsDedicatedToAccount(long dcId, long accountId) {
+        SearchCriteria<Integer> sc = countVnetsDedicatedToAccount.create();
+        sc.setParameters("dc", dcId);
+        sc.setParameters("accountId", accountId);
+        return customSearch(sc, null).get(0);
+    }
+
+    @Override
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        boolean result = super.configure(name, params);
+
+        countVnetsDedicatedToAccount = createSearchBuilder(Integer.class);
+        countVnetsDedicatedToAccount.and("dc", countVnetsDedicatedToAccount.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        countVnetsDedicatedToAccount.and("accountGuestVlanMapId", countVnetsDedicatedToAccount.entity().getAccountGuestVlanMapId(), Op.NNULL);
+        AccountGuestVlanMapSearch = _accountGuestVlanMapDao.createSearchBuilder();
+        AccountGuestVlanMapSearch.and("accountId", AccountGuestVlanMapSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        countVnetsDedicatedToAccount.join("AccountGuestVlanMapSearch", AccountGuestVlanMapSearch, countVnetsDedicatedToAccount.entity().getAccountGuestVlanMapId(),
+                AccountGuestVlanMapSearch.entity().getId(), JoinBuilder.JoinType.INNER);
+        countVnetsDedicatedToAccount.select(null, Func.COUNT, countVnetsDedicatedToAccount.entity().getId());
+        countVnetsDedicatedToAccount.done();
+        AccountGuestVlanMapSearch.done();
+
+        return result;
+    }
+
+    public DataCenterVnetDaoImpl() {
+    	super();
+        DcSearchAllocated = createSearchBuilder();
+        DcSearchAllocated.and("dc", DcSearchAllocated.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        DcSearchAllocated.and("physicalNetworkId", DcSearchAllocated.entity().getPhysicalNetworkId(), SearchCriteria.Op.EQ);
+        DcSearchAllocated.and("allocated", DcSearchAllocated.entity().getTakenAt(), SearchCriteria.Op.NNULL);
+        DcSearchAllocated.done();
+
+        DcSearchAllocatedInRange = createSearchBuilder();
+        DcSearchAllocatedInRange.and("dc",DcSearchAllocatedInRange.entity().getDataCenterId(), Op.EQ);
+        DcSearchAllocatedInRange.and("physicalNetworkId", DcSearchAllocatedInRange.entity().getPhysicalNetworkId(), Op.EQ);
+        DcSearchAllocatedInRange.and("allocated", DcSearchAllocatedInRange.entity().getTakenAt(), Op.NNULL);
+        DcSearchAllocatedInRange.and("vnetRange", DcSearchAllocatedInRange.entity().getVnet(), Op.BETWEEN);
+        DcSearchAllocatedInRange.done();
+
+        SearchRange = createSearchBuilder();
+        SearchRange.and("dc", SearchRange.entity().getDataCenterId(), Op.EQ);
+        SearchRange.and("physicalNetworkId", SearchRange.entity().getPhysicalNetworkId(), Op.EQ);
+        SearchRange.and("vnetRange", SearchRange.entity().getVnet(), Op.BETWEEN);
+        
+        FreeVnetSearch = createSearchBuilder();
+        FreeVnetSearch.and("dc", FreeVnetSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        FreeVnetSearch.and("physicalNetworkId", FreeVnetSearch.entity().getPhysicalNetworkId(), SearchCriteria.Op.EQ);
+        FreeVnetSearch.and("taken", FreeVnetSearch.entity().getTakenAt(), SearchCriteria.Op.NULL);
+        FreeVnetSearch.and("accountGuestVlanMapId", FreeVnetSearch.entity().getAccountGuestVlanMapId(), SearchCriteria.Op.NULL);
+        FreeVnetSearch.done();
+
+        FreeDedicatedVnetSearch = createSearchBuilder();
+        FreeDedicatedVnetSearch.and("dc", FreeDedicatedVnetSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        FreeDedicatedVnetSearch.and("physicalNetworkId", FreeDedicatedVnetSearch.entity().getPhysicalNetworkId(), SearchCriteria.Op.EQ);
+        FreeDedicatedVnetSearch.and("taken", FreeDedicatedVnetSearch.entity().getTakenAt(), SearchCriteria.Op.NULL);
+        FreeDedicatedVnetSearch.and("accountGuestVlanMapId", FreeDedicatedVnetSearch.entity().getAccountGuestVlanMapId(), SearchCriteria.Op.IN);
+        FreeDedicatedVnetSearch.done();
+        
+        VnetDcSearch = createSearchBuilder();
+        VnetDcSearch.and("vnet", VnetDcSearch.entity().getVnet(), SearchCriteria.Op.EQ);
+        VnetDcSearch.and("dc", VnetDcSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        VnetDcSearch.and("physicalNetworkId", VnetDcSearch.entity().getPhysicalNetworkId(), SearchCriteria.Op.EQ);
+        VnetDcSearch.done();
+        
+        countZoneVlans = createSearchBuilder(Integer.class);
+        countZoneVlans.select(null, Func.COUNT, countZoneVlans.entity().getId());
+        countZoneVlans.and("dc", countZoneVlans.entity().getDataCenterId(), Op.EQ);  
+        countZoneVlans.done();
+        
+        countAllocatedZoneVlans = createSearchBuilder(Integer.class);
+        countAllocatedZoneVlans.select(null, Func.COUNT, countAllocatedZoneVlans.entity().getId());
+        countAllocatedZoneVlans.and("dc", countAllocatedZoneVlans.entity().getDataCenterId(), Op.EQ);
+        countAllocatedZoneVlans.and("allocated", countAllocatedZoneVlans.entity().getTakenAt(), SearchCriteria.Op.NNULL);
+        countAllocatedZoneVlans.done();
+
+        VnetDcSearchAllocated = createSearchBuilder();
+        VnetDcSearchAllocated.and("vnet", VnetDcSearchAllocated.entity().getVnet(), SearchCriteria.Op.EQ);
+        VnetDcSearchAllocated.and("dc", VnetDcSearchAllocated.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        VnetDcSearchAllocated.and("physicalNetworkId", VnetDcSearchAllocated.entity().getPhysicalNetworkId(), SearchCriteria.Op.EQ);        
+        VnetDcSearchAllocated.and("taken", VnetDcSearchAllocated.entity().getTakenAt(), SearchCriteria.Op.NNULL);
+        VnetDcSearchAllocated.and("account", VnetDcSearchAllocated.entity().getAccountId(), SearchCriteria.Op.EQ);
+        VnetDcSearchAllocated.and("reservation", VnetDcSearchAllocated.entity().getReservationId(), SearchCriteria.Op.EQ);
+        VnetDcSearchAllocated.done();
+
+        DedicatedGuestVlanRangeSearch = createSearchBuilder();
+        DedicatedGuestVlanRangeSearch.and("dedicatedGuestVlanRangeId", DedicatedGuestVlanRangeSearch.entity().getAccountGuestVlanMapId(), SearchCriteria.Op.EQ);
+        DedicatedGuestVlanRangeSearch.done();
+
+        countVnetsAllocatedToAccount = createSearchBuilder(Integer.class);
+        countVnetsAllocatedToAccount.and("dc", countVnetsAllocatedToAccount.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        countVnetsAllocatedToAccount.and("accountId", countVnetsAllocatedToAccount.entity().getAccountId(), SearchCriteria.Op.EQ);
+        countVnetsAllocatedToAccount.select(null, Func.COUNT, countVnetsAllocatedToAccount.entity().getId());
+        countVnetsAllocatedToAccount.done();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/DcDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DcDetailsDao.java b/engine/schema/src/com/cloud/dc/dao/DcDetailsDao.java
new file mode 100644
index 0000000..a3b72a8
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/DcDetailsDao.java
@@ -0,0 +1,32 @@
+// 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.dc.dao;
+
+import java.util.Map;
+
+import com.cloud.dc.DcDetailVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface DcDetailsDao extends GenericDao<DcDetailVO, Long> {
+    Map<String, String> findDetails(long dcId);
+    
+    void persist(long dcId, Map<String, String> details);
+    
+    DcDetailVO findDetail(long dcId, String name);
+
+	void deleteDetails(long dcId);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/DcDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DcDetailsDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/DcDetailsDaoImpl.java
new file mode 100644
index 0000000..278fdb4
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/DcDetailsDaoImpl.java
@@ -0,0 +1,97 @@
+// 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.dc.dao;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.DcDetailVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value=DcDetailsDao.class)
+public class DcDetailsDaoImpl extends GenericDaoBase<DcDetailVO, Long> implements DcDetailsDao {
+    protected final SearchBuilder<DcDetailVO> DcSearch;
+    protected final SearchBuilder<DcDetailVO> DetailSearch;
+    
+    public DcDetailsDaoImpl() {
+        DcSearch = createSearchBuilder();
+        DcSearch.and("dcId", DcSearch.entity().getDcId(), SearchCriteria.Op.EQ);
+        DcSearch.done();
+        
+        DetailSearch = createSearchBuilder();
+        DetailSearch.and("dcId", DetailSearch.entity().getDcId(), SearchCriteria.Op.EQ);
+        DetailSearch.and("name", DetailSearch.entity().getName(), SearchCriteria.Op.EQ);
+        DetailSearch.done();
+    }
+
+    @Override
+    public DcDetailVO findDetail(long dcId, String name) {
+        SearchCriteria<DcDetailVO> sc = DetailSearch.create();
+        sc.setParameters("dcId", dcId);
+        sc.setParameters("name", name);
+        
+        return findOneIncludingRemovedBy(sc);
+    }
+
+    @Override
+    public Map<String, String> findDetails(long dcId) {
+        SearchCriteria<DcDetailVO> sc = DcSearch.create();
+        sc.setParameters("dcId", dcId);
+        
+        List<DcDetailVO> results = search(sc, null);
+        Map<String, String> details = new HashMap<String, String>(results.size());
+        for (DcDetailVO result : results) {
+            details.put(result.getName(), result.getValue());
+        }
+        return details;
+    }
+    
+    @Override
+    public void deleteDetails(long dcId) {
+        SearchCriteria sc = DcSearch.create();
+        sc.setParameters("dcId", dcId);
+        
+        List<DcDetailVO> results = search(sc, null);
+        for (DcDetailVO result : results) {
+        	remove(result.getId());
+        }
+    }
+
+    @Override
+    public void persist(long dcId, Map<String, String> details) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        SearchCriteria<DcDetailVO> sc = DcSearch.create();
+        sc.setParameters("dcId", dcId);
+        expunge(sc);
+        
+        for (Map.Entry<String, String> detail : details.entrySet()) {
+            DcDetailVO vo = new DcDetailVO(dcId, detail.getKey(), detail.getValue());
+            persist(vo);
+        }
+        txn.commit();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/HostPodDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/HostPodDao.java b/engine/schema/src/com/cloud/dc/dao/HostPodDao.java
new file mode 100644
index 0000000..03f7155
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/HostPodDao.java
@@ -0,0 +1,35 @@
+// 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.dc.dao;
+
+import java.util.HashMap;
+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 HashMap<Long, List<Object>> getCurrentPodCidrSubnets(long zoneId, long podIdToSkip);
+
+    public List<Long> listDisabledPods(long zoneId);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/HostPodDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/HostPodDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/HostPodDaoImpl.java
new file mode 100644
index 0000000..07b4ad1
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/HostPodDaoImpl.java
@@ -0,0 +1,134 @@
+// 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.dc.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+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.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value={HostPodDao.class})
+public class HostPodDaoImpl extends GenericDaoBase<HostPodVO, Long> implements HostPodDao {
+    private static final Logger s_logger = Logger.getLogger(HostPodDaoImpl.class);
+
+    protected SearchBuilder<HostPodVO> DataCenterAndNameSearch;
+    protected SearchBuilder<HostPodVO> DataCenterIdSearch;
+
+    public HostPodDaoImpl() {
+        DataCenterAndNameSearch = createSearchBuilder();
+        DataCenterAndNameSearch.and("dc", DataCenterAndNameSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        DataCenterAndNameSearch.and("name", DataCenterAndNameSearch.entity().getName(), SearchCriteria.Op.EQ);
+        DataCenterAndNameSearch.done();
+
+        DataCenterIdSearch = createSearchBuilder();
+        DataCenterIdSearch.and("dcId", DataCenterIdSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        DataCenterIdSearch.done();
+    }
+
+    @Override
+    public List<HostPodVO> listByDataCenterId(long id) {
+        SearchCriteria<HostPodVO> sc = DataCenterIdSearch.create();
+        sc.setParameters("dcId", id);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public HostPodVO findByName(String name, long dcId) {
+        SearchCriteria<HostPodVO> sc = DataCenterAndNameSearch.create();
+        sc.setParameters("dc", dcId);
+        sc.setParameters("name", name);
+
+        return findOneBy(sc);
+    }
+
+    @Override
+    public HashMap<Long, List<Object>> getCurrentPodCidrSubnets(long zoneId, long podIdToSkip) {
+        HashMap<Long, List<Object>> currentPodCidrSubnets = new HashMap<Long, List<Object>>();
+
+        String selectSql = "SELECT id, cidr_address, cidr_size FROM host_pod_ref WHERE data_center_id=" + zoneId +" and removed IS NULL";
+        Transaction txn = Transaction.currentTxn();
+        try {
+            PreparedStatement stmt = txn.prepareAutoCloseStatement(selectSql);
+            ResultSet rs = stmt.executeQuery();
+            while (rs.next()) {
+                Long podId = rs.getLong("id");
+                if (podId.longValue() == podIdToSkip) {
+                    continue;
+                }
+                String cidrAddress = rs.getString("cidr_address");
+                long cidrSize = rs.getLong("cidr_size");
+                List<Object> cidrPair = new ArrayList<Object>();
+                cidrPair.add(0, cidrAddress);
+                cidrPair.add(1, new Long(cidrSize));
+                currentPodCidrSubnets.put(podId, cidrPair);
+            }
+        } catch (SQLException ex) {
+            s_logger.warn("DB exception " + ex.getMessage(), ex);
+            return null;
+        }
+
+        return currentPodCidrSubnets;
+    }
+
+    @Override
+    public boolean remove(Long id) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        HostPodVO pod = createForUpdate();
+        pod.setName(null);
+
+        update(id, pod);
+
+        boolean result = super.remove(id);
+        txn.commit();
+        return result;
+    }
+
+    @Override
+    public List<Long> listDisabledPods(long zoneId) {
+        GenericSearchBuilder<HostPodVO, Long> podIdSearch = createSearchBuilder(Long.class);
+        podIdSearch.selectField(podIdSearch.entity().getId());
+        podIdSearch.and("dataCenterId", podIdSearch.entity().getDataCenterId(), Op.EQ);
+        podIdSearch.and("allocationState", podIdSearch.entity().getAllocationState(), Op.EQ);
+        podIdSearch.done();
+
+
+        SearchCriteria<Long> sc = podIdSearch.create();
+        sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId);
+        sc.addAnd("allocationState", SearchCriteria.Op.EQ, Grouping.AllocationState.Disabled);
+        return customSearch(sc, null);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/PodVlanDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/PodVlanDao.java b/engine/schema/src/com/cloud/dc/dao/PodVlanDao.java
new file mode 100644
index 0000000..6359dfe
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/PodVlanDao.java
@@ -0,0 +1,30 @@
+// 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.dc.dao;
+
+import java.util.List;
+
+import com.cloud.dc.PodVlanVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface PodVlanDao extends GenericDao<PodVlanVO, Long> {
+    public List<PodVlanVO> listAllocatedVnets(long podId);    
+    public void add(long podId, int start, int end);   
+    public void delete(long podId);
+    public PodVlanVO take(long podId, long accountId);
+    public void release(String vlan, long podId, long accountId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/PodVlanDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/PodVlanDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/PodVlanDaoImpl.java
new file mode 100755
index 0000000..413f9ed
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/PodVlanDaoImpl.java
@@ -0,0 +1,139 @@
+// 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.dc.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.Date;
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.PodVlanVO;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+/**
+ * PodVlanDaoImpl maintains the one-to-many relationship between
+ */
+@Component
+public class PodVlanDaoImpl extends GenericDaoBase<PodVlanVO, Long> implements PodVlanDao {
+    private final SearchBuilder<PodVlanVO> FreeVlanSearch;
+    private final SearchBuilder<PodVlanVO> VlanPodSearch;
+    private final SearchBuilder<PodVlanVO> PodSearchAllocated;
+    
+    public List<PodVlanVO> listAllocatedVnets(long podId) {
+    	SearchCriteria<PodVlanVO> sc = PodSearchAllocated.create();
+    	sc.setParameters("podId", podId);
+    	return listBy(sc);
+    }
+    
+    public void add(long podId, int start, int end) {
+        String insertVnet = "INSERT INTO `cloud`.`op_pod_vlan_alloc` (vlan, pod_id) VALUES ( ?, ?)";
+        
+        Transaction txn = Transaction.currentTxn();
+        try {
+            txn.start();
+            PreparedStatement stmt = txn.prepareAutoCloseStatement(insertVnet);
+            for (int i = start; i < end; i++) {
+                stmt.setString(1, String.valueOf(i));
+                stmt.setLong(2, podId);
+                stmt.addBatch();
+            }
+            stmt.executeBatch();
+            txn.commit();
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Exception caught adding vnet ", e);
+        }
+    }
+    
+    public void delete(long podId) {
+    	String deleteVnet = "DELETE FROM `cloud`.`op_pod_vlan_alloc` WHERE pod_id = ?";
+
+        Transaction txn = Transaction.currentTxn();
+        try {
+            PreparedStatement stmt = txn.prepareAutoCloseStatement(deleteVnet);
+            stmt.setLong(1, podId);
+            stmt.executeUpdate();
+        } catch (SQLException e) {
+        	throw new CloudRuntimeException("Exception caught deleting vnet ", e);
+        }
+    }
+
+    public PodVlanVO take(long podId, long accountId) {
+        SearchCriteria<PodVlanVO> sc = FreeVlanSearch.create();
+        sc.setParameters("podId", podId);
+        Date now = new Date();
+        Transaction txn = Transaction.currentTxn();
+        try {
+            txn.start();
+            PodVlanVO vo = lockOneRandomRow(sc, true);
+            if (vo == null) {
+                return null;
+            }
+
+            vo.setTakenAt(now);
+            vo.setAccountId(accountId);
+            update(vo.getId(), vo);
+            txn.commit();
+            return vo;
+
+        } catch (Exception e) {
+            throw new CloudRuntimeException("Caught Exception ", e);
+        }
+    }
+
+    public void release(String vlan, long podId, long accountId) {
+        SearchCriteria<PodVlanVO> sc = VlanPodSearch.create();
+        sc.setParameters("vlan", vlan);
+        sc.setParameters("podId", podId);
+        sc.setParameters("account", accountId);
+
+        PodVlanVO vo = findOneIncludingRemovedBy(sc);
+        if (vo == null) {
+            return;
+        }
+
+        vo.setTakenAt(null);
+        vo.setAccountId(null);
+        update(vo.getId(), vo);
+    }
+    
+    public PodVlanDaoImpl() {
+    	super();
+    	PodSearchAllocated = createSearchBuilder();
+    	PodSearchAllocated.and("podId", PodSearchAllocated.entity().getPodId(), SearchCriteria.Op.EQ);
+    	PodSearchAllocated.and("allocated", PodSearchAllocated.entity().getTakenAt(), SearchCriteria.Op.NNULL);
+    	PodSearchAllocated.done();
+        
+        FreeVlanSearch = createSearchBuilder();
+        FreeVlanSearch.and("podId", FreeVlanSearch.entity().getPodId(), SearchCriteria.Op.EQ);
+        FreeVlanSearch.and("taken", FreeVlanSearch.entity().getTakenAt(), SearchCriteria.Op.NULL);
+        FreeVlanSearch.done();
+
+        VlanPodSearch = createSearchBuilder();
+        VlanPodSearch.and("vlan", VlanPodSearch.entity().getVlan(), SearchCriteria.Op.EQ);
+        VlanPodSearch.and("podId", VlanPodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
+        VlanPodSearch.and("taken", VlanPodSearch.entity().getTakenAt(), SearchCriteria.Op.NNULL);
+        VlanPodSearch.and("account", VlanPodSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        VlanPodSearch.done();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/PodVlanMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/PodVlanMapDao.java b/engine/schema/src/com/cloud/dc/dao/PodVlanMapDao.java
new file mode 100644
index 0000000..841ed1b
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/PodVlanMapDao.java
@@ -0,0 +1,30 @@
+// 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.dc.dao;
+
+import java.util.List;
+
+import com.cloud.dc.PodVlanMapVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface PodVlanMapDao extends GenericDao<PodVlanMapVO, Long> {
+		
+	public List<PodVlanMapVO> listPodVlanMapsByPod(long podId);
+	public PodVlanMapVO listPodVlanMapsByVlan(long vlanDbId);
+	public PodVlanMapVO findPodVlanMap(long podId, long vlanDbId);
+	
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/PodVlanMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/PodVlanMapDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/PodVlanMapDaoImpl.java
new file mode 100644
index 0000000..df7a5d9
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/PodVlanMapDaoImpl.java
@@ -0,0 +1,75 @@
+// 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.dc.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.PodVlanMapVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value={PodVlanMapDao.class})
+public class PodVlanMapDaoImpl extends GenericDaoBase<PodVlanMapVO, Long> implements PodVlanMapDao {
+    
+	protected SearchBuilder<PodVlanMapVO> PodSearch;
+	protected SearchBuilder<PodVlanMapVO> VlanSearch;
+	protected SearchBuilder<PodVlanMapVO> PodVlanSearch;
+	
+	@Override
+	public List<PodVlanMapVO> listPodVlanMapsByPod(long podId) {
+		SearchCriteria<PodVlanMapVO> sc = PodSearch.create();
+    	sc.setParameters("podId", podId);
+    	return listIncludingRemovedBy(sc);
+	}
+	
+	@Override
+	public PodVlanMapVO listPodVlanMapsByVlan(long vlanDbId) {
+		SearchCriteria<PodVlanMapVO> sc = VlanSearch.create();
+    	sc.setParameters("vlanDbId", vlanDbId);
+    	return findOneBy(sc);
+	}
+	
+	@Override
+	public PodVlanMapVO findPodVlanMap(long podId, long vlanDbId) {
+		SearchCriteria<PodVlanMapVO> sc = PodVlanSearch.create();
+		sc.setParameters("podId", podId);
+		sc.setParameters("vlanDbId", vlanDbId);
+		return findOneIncludingRemovedBy(sc);
+	}
+	
+    public PodVlanMapDaoImpl() {
+    	PodSearch = createSearchBuilder();
+    	PodSearch.and("podId", PodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
+        PodSearch.done();
+        
+    	VlanSearch = createSearchBuilder();
+    	VlanSearch.and("vlanDbId", VlanSearch.entity().getVlanDbId(), SearchCriteria.Op.EQ);
+        VlanSearch.done();
+        
+        PodVlanSearch = createSearchBuilder();
+        PodVlanSearch.and("podId", PodVlanSearch.entity().getPodId(), SearchCriteria.Op.EQ);
+        PodVlanSearch.and("vlanDbId", PodVlanSearch.entity().getVlanDbId(), SearchCriteria.Op.EQ);
+        PodVlanSearch.done();
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpAddressDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpAddressDao.java b/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpAddressDao.java
new file mode 100755
index 0000000..f1fd2bd
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpAddressDao.java
@@ -0,0 +1,32 @@
+// 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.dc.dao;
+
+import java.util.List;
+
+import com.cloud.dc.StorageNetworkIpAddressVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface StorageNetworkIpAddressDao extends GenericDao<StorageNetworkIpAddressVO, Long> {
+	long countInUseIpByRangeId(long rangeId);
+
+	List<String> listInUseIpByRangeId(long rangeId);
+	
+	StorageNetworkIpAddressVO takeIpAddress(long rangeId);
+	
+	void releaseIpAddress(String ip);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpAddressDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpAddressDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpAddressDaoImpl.java
new file mode 100755
index 0000000..782ee0d
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpAddressDaoImpl.java
@@ -0,0 +1,114 @@
+// 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.dc.dao;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.DataCenterIpAddressVO;
+import com.cloud.dc.StorageNetworkIpAddressVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria2;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.SearchCriteria.Func;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value={StorageNetworkIpAddressDao.class})
+@DB(txn=false)
+public class StorageNetworkIpAddressDaoImpl extends GenericDaoBase<StorageNetworkIpAddressVO, Long> implements StorageNetworkIpAddressDao {
+	protected final GenericSearchBuilder<StorageNetworkIpAddressVO, Long> countInUserIp;
+	protected final GenericSearchBuilder<StorageNetworkIpAddressVO, String> listInUseIp;
+	protected final SearchBuilder<StorageNetworkIpAddressVO> untakenIp;
+	protected final SearchBuilder<StorageNetworkIpAddressVO> ipSearch;
+	
+
+	protected StorageNetworkIpAddressDaoImpl() {
+		countInUserIp = createSearchBuilder(Long.class);
+		countInUserIp.select(null, Func.COUNT, null);
+		countInUserIp.and("rangeId", countInUserIp.entity().getRangeId(), Op.EQ);
+		countInUserIp.and("taken", countInUserIp.entity().getTakenAt(), Op.NNULL);
+		countInUserIp.done();
+		
+		listInUseIp = createSearchBuilder(String.class);
+		listInUseIp.selectField(listInUseIp.entity().getIpAddress());
+		listInUseIp.and("rangeId", listInUseIp.entity().getRangeId(), Op.EQ);
+		listInUseIp.and("taken", listInUseIp.entity().getTakenAt(), Op.NNULL);
+		listInUseIp.done();
+		
+		untakenIp = createSearchBuilder();
+		untakenIp.and("rangeId", untakenIp.entity().getRangeId(), Op.EQ);
+		untakenIp.and("taken", untakenIp.entity().getTakenAt(), Op.NULL);
+		untakenIp.done();
+		
+		ipSearch = createSearchBuilder();
+		ipSearch.and("ipAddress", ipSearch.entity().getIpAddress(), Op.EQ);
+		ipSearch.done();
+	}
+	
+	@Override
+	public long countInUseIpByRangeId(long rangeId) {
+		SearchCriteria<Long> sc = countInUserIp.create();
+		sc.setParameters("rangeId", rangeId);
+		return customSearch(sc, null).get(0);
+	}
+
+	@Override
+	public List<String> listInUseIpByRangeId(long rangeId) {
+		SearchCriteria<String> sc = listInUseIp.create();
+		sc.setParameters("rangeId", rangeId);
+		return customSearch(sc, null);
+	}
+	
+	@Override
+	@DB
+    public StorageNetworkIpAddressVO takeIpAddress(long rangeId) {
+		SearchCriteria<StorageNetworkIpAddressVO> sc = untakenIp.create();
+		sc.setParameters("rangeId", rangeId);
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        StorageNetworkIpAddressVO ip = lockOneRandomRow(sc, true);
+        if (ip == null) {
+        	txn.rollback();
+        	return null;
+        }
+        ip.setTakenAt(new Date());
+        update(ip.getId(), ip);
+        txn.commit();
+        return ip;
+	}
+
+	@Override
+    public void releaseIpAddress(String ip) {
+		SearchCriteria<StorageNetworkIpAddressVO> sc = ipSearch.create();
+	    sc.setParameters("ipAddress", ip);
+	    StorageNetworkIpAddressVO vo = createForUpdate();
+	    vo.setTakenAt(null);
+	    update(vo, sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpRangeDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpRangeDao.java b/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpRangeDao.java
new file mode 100755
index 0000000..2edd568
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpRangeDao.java
@@ -0,0 +1,32 @@
+// 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.dc.dao;
+
+import java.util.List;
+
+import com.cloud.dc.StorageNetworkIpRangeVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface StorageNetworkIpRangeDao extends GenericDao<StorageNetworkIpRangeVO, Long> {
+	List<StorageNetworkIpRangeVO> listByRangeId(long rangeId);
+
+	List<StorageNetworkIpRangeVO> listByPodId(long podId);
+
+	List<StorageNetworkIpRangeVO> listByDataCenterId(long dcId);
+	
+	long countRanges();
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpRangeDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpRangeDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpRangeDaoImpl.java
new file mode 100755
index 0000000..d732e6f
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/StorageNetworkIpRangeDaoImpl.java
@@ -0,0 +1,78 @@
+// 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.dc.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.StorageNetworkIpRangeVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria2;
+import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria.Func;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value={StorageNetworkIpRangeDao.class})
+@DB(txn=false)
+public class StorageNetworkIpRangeDaoImpl extends GenericDaoBase<StorageNetworkIpRangeVO, Long> implements StorageNetworkIpRangeDao {
+	protected final GenericSearchBuilder<StorageNetworkIpRangeVO, Long> countRanges;
+	
+	protected StorageNetworkIpRangeDaoImpl() {
+		countRanges = createSearchBuilder(Long.class);
+		countRanges.select(null, Func.COUNT, null);
+		countRanges.done();
+	}
+	
+	@Override
+    public List<StorageNetworkIpRangeVO> listByPodId(long podId) {
+		SearchCriteriaService<StorageNetworkIpRangeVO, StorageNetworkIpRangeVO> sc = SearchCriteria2.create(StorageNetworkIpRangeVO.class);
+	    sc.addAnd(sc.getEntity().getPodId(), Op.EQ, podId);
+		return sc.list();
+    }
+
+	@Override
+    public List<StorageNetworkIpRangeVO> listByRangeId(long rangeId) {
+		SearchCriteriaService<StorageNetworkIpRangeVO, StorageNetworkIpRangeVO> sc = SearchCriteria2.create(StorageNetworkIpRangeVO.class);
+	    sc.addAnd(sc.getEntity().getId(), Op.EQ, rangeId);
+		return sc.list();
+    }
+
+	@Override
+    public List<StorageNetworkIpRangeVO> listByDataCenterId(long dcId) {
+		SearchCriteriaService<StorageNetworkIpRangeVO, StorageNetworkIpRangeVO> sc = SearchCriteria2.create(StorageNetworkIpRangeVO.class);
+	    sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dcId);
+		return sc.list();
+    }
+	
+	@Override
+	public long countRanges() {
+		SearchCriteria<Long> sc = countRanges.create();
+		return customSearch(sc, null).get(0);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/VlanDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/VlanDao.java b/engine/schema/src/com/cloud/dc/dao/VlanDao.java
new file mode 100755
index 0000000..cc82632
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/VlanDao.java
@@ -0,0 +1,55 @@
+// 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.dc.dao;
+
+import java.util.List;
+
+import com.cloud.dc.Vlan;
+import com.cloud.dc.Vlan.VlanType;
+import com.cloud.dc.VlanVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface VlanDao extends GenericDao<VlanVO, Long> {
+	
+	VlanVO findByZoneAndVlanId(long zoneId, String vlanId);
+	
+	List<VlanVO> listByZone(long zoneId);
+	
+	List<VlanVO> listByType(Vlan.VlanType vlanType);
+	
+	List<VlanVO> listByZoneAndType(long zoneId, Vlan.VlanType vlanType);
+	
+	List<VlanVO> listVlansForPod(long podId);
+	
+	List<VlanVO> listVlansForPodByType(long podId, Vlan.VlanType vlanType);
+	
+	void addToPod(long podId, long vlanDbId);
+
+	List<VlanVO> listVlansForAccountByType(Long zoneId, long accountId, VlanType vlanType);
+	
+	boolean zoneHasDirectAttachUntaggedVlans(long zoneId);
+
+	List<VlanVO> listZoneWideVlans(long zoneId, VlanType vlanType, String vlanId);
+
+	List<VlanVO> searchForZoneWideVlans(long dcId, String vlanType,String vlanId);
+	
+	List<VlanVO> listVlansByNetworkId(long networkId);
+	
+	List<VlanVO> listVlansByPhysicalNetworkId(long physicalNetworkId);
+
+        List<VlanVO> listZoneWideNonDedicatedVlans(long zoneId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/dc/dao/VlanDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/VlanDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/VlanDaoImpl.java
new file mode 100755
index 0000000..100295b
--- /dev/null
+++ b/engine/schema/src/com/cloud/dc/dao/VlanDaoImpl.java
@@ -0,0 +1,334 @@
+// 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.dc.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.AccountVlanMapVO;
+import com.cloud.dc.PodVlanMapVO;
+import com.cloud.dc.Vlan;
+import com.cloud.dc.Vlan.VlanType;
+import com.cloud.dc.VlanVO;
+import com.cloud.network.dao.IPAddressDao;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.JoinBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Component
+@Local(value={VlanDao.class})
+public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao {
+
+    private final String FindZoneWideVlans = "SELECT * FROM vlan WHERE data_center_id=? and vlan_type=? and vlan_id!=? and id not in (select vlan_db_id from account_vlan_map)";
+
+    protected SearchBuilder<VlanVO> ZoneVlanIdSearch;
+    protected SearchBuilder<VlanVO> ZoneSearch;
+    protected SearchBuilder<VlanVO> ZoneTypeSearch;
+    protected SearchBuilder<VlanVO> ZoneTypeAllPodsSearch;
+    protected SearchBuilder<VlanVO> ZoneTypePodSearch;
+    protected SearchBuilder<VlanVO> ZoneVlanSearch;
+    protected SearchBuilder<VlanVO> NetworkVlanSearch;
+    protected SearchBuilder<VlanVO> PhysicalNetworkVlanSearch;
+    protected SearchBuilder<VlanVO> ZoneWideNonDedicatedVlanSearch;
+
+    protected SearchBuilder<AccountVlanMapVO> AccountVlanMapSearch;
+
+    @Inject protected PodVlanMapDao _podVlanMapDao;
+    @Inject protected AccountVlanMapDao _accountVlanMapDao;
+    @Inject protected IPAddressDao _ipAddressDao;
+
+    @Override
+    public VlanVO findByZoneAndVlanId(long zoneId, String vlanId) {
+        SearchCriteria<VlanVO> sc = ZoneVlanIdSearch.create();
+        sc.setParameters("zoneId", zoneId);
+        sc.setParameters("vlanId", vlanId);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public List<VlanVO> listByZone(long zoneId) {
+        SearchCriteria<VlanVO> sc = ZoneSearch.create();
+        sc.setParameters("zoneId", zoneId);
+        return listBy(sc);
+    }
+
+    public VlanDaoImpl() {
+        ZoneVlanIdSearch = createSearchBuilder();
+        ZoneVlanIdSearch.and("zoneId", ZoneVlanIdSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        ZoneVlanIdSearch.and("vlanId", ZoneVlanIdSearch.entity().getVlanTag(), SearchCriteria.Op.EQ);
+        ZoneVlanIdSearch.done();
+
+        ZoneSearch = createSearchBuilder();
+        ZoneSearch.and("zoneId", ZoneSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        ZoneSearch.done();
+
+        ZoneTypeSearch = createSearchBuilder();
+        ZoneTypeSearch.and("zoneId", ZoneTypeSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        ZoneTypeSearch.and("vlanType", ZoneTypeSearch.entity().getVlanType(), SearchCriteria.Op.EQ);
+        ZoneTypeSearch.done();
+
+        NetworkVlanSearch = createSearchBuilder();
+        NetworkVlanSearch.and("networkOfferingId", NetworkVlanSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
+        NetworkVlanSearch.done();
+
+        PhysicalNetworkVlanSearch = createSearchBuilder();
+        PhysicalNetworkVlanSearch.and("physicalNetworkId", PhysicalNetworkVlanSearch.entity().getPhysicalNetworkId(), SearchCriteria.Op.EQ);
+        PhysicalNetworkVlanSearch.done();
+    }
+
+    @Override
+    public List<VlanVO> listZoneWideVlans(long zoneId, VlanType vlanType, String vlanId){
+        SearchCriteria<VlanVO> sc = ZoneVlanSearch.create();
+        sc.setParameters("zoneId", zoneId);
+        sc.setParameters("vlanId", vlanId);
+        sc.setParameters("vlanType", vlanType);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<VlanVO> listByZoneAndType(long zoneId, VlanType vlanType) {
+        SearchCriteria<VlanVO> sc = ZoneTypeSearch.create();
+        sc.setParameters("zoneId", zoneId);
+        sc.setParameters("vlanType", vlanType);
+        return listBy(sc);
+    }
+
+
+    @Override
+    public List<VlanVO> listByType(VlanType vlanType) {
+        SearchCriteria<VlanVO> sc = ZoneTypeSearch.create();
+        sc.setParameters("vlanType", vlanType);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<VlanVO> listVlansForPod(long podId) {
+        //FIXME: use a join statement to improve the performance (should be minor since we expect only one or two
+        List<PodVlanMapVO> vlanMaps = _podVlanMapDao.listPodVlanMapsByPod(podId);
+        List<VlanVO> result  = new ArrayList<VlanVO>();
+        for (PodVlanMapVO pvmvo: vlanMaps) {
+            result.add(findById(pvmvo.getVlanDbId()));
+        }
+        return result;
+    }
+
+    @Override
+    public List<VlanVO> listVlansForPodByType(long podId, VlanType vlanType) {
+        //FIXME: use a join statement to improve the performance (should be minor since we expect only one or two)
+        List<PodVlanMapVO> vlanMaps = _podVlanMapDao.listPodVlanMapsByPod(podId);
+        List<VlanVO> result  = new ArrayList<VlanVO>();
+        for (PodVlanMapVO pvmvo: vlanMaps) {
+            VlanVO vlan =findById(pvmvo.getVlanDbId());
+            if (vlan.getVlanType() == vlanType) {
+                result.add(vlan);
+            }
+        }
+        return result;
+    }
+
+    @Override
+    public List<VlanVO> listVlansForAccountByType(Long zoneId, long accountId, VlanType vlanType) {
+        //FIXME: use a join statement to improve the performance (should be minor since we expect only one or two)
+        List<AccountVlanMapVO> vlanMaps = _accountVlanMapDao.listAccountVlanMapsByAccount(accountId);
+        List<VlanVO> result  = new ArrayList<VlanVO>();
+        for (AccountVlanMapVO acvmvo: vlanMaps) {
+            VlanVO vlan =findById(acvmvo.getVlanDbId());
+            if (vlan.getVlanType() == vlanType && (zoneId == null || vlan.getDataCenterId() == zoneId)) {
+                result.add(vlan);
+            }
+        }
+        return result;
+    }
+
+    @Override
+    public void addToPod(long podId, long vlanDbId) {
+        PodVlanMapVO pvmvo = new PodVlanMapVO(podId, vlanDbId);
+        _podVlanMapDao.persist(pvmvo);
+
+    }
+
+    @Override
+    public boolean configure(String name, Map<String, Object> params)
+            throws ConfigurationException {
+        boolean result = super.configure(name, params);
+        ZoneTypeAllPodsSearch = createSearchBuilder();
+        ZoneTypeAllPodsSearch.and("zoneId", ZoneTypeAllPodsSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        ZoneTypeAllPodsSearch.and("vlanType", ZoneTypeAllPodsSearch.entity().getVlanType(), SearchCriteria.Op.EQ);
+
+        SearchBuilder<PodVlanMapVO> PodVlanSearch = _podVlanMapDao.createSearchBuilder();
+        PodVlanSearch.and("podId", PodVlanSearch.entity().getPodId(), SearchCriteria.Op.NNULL);
+        ZoneTypeAllPodsSearch.join("vlan", PodVlanSearch, PodVlanSearch.entity().getVlanDbId(), ZoneTypeAllPodsSearch.entity().getId(), JoinBuilder.JoinType.INNER);
+
+        ZoneTypeAllPodsSearch.done();
+        PodVlanSearch.done();
+
+        ZoneTypePodSearch = createSearchBuilder();
+        ZoneTypePodSearch.and("zoneId", ZoneTypePodSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        ZoneTypePodSearch.and("vlanType", ZoneTypePodSearch.entity().getVlanType(), SearchCriteria.Op.EQ);
+
+        SearchBuilder<PodVlanMapVO> PodVlanSearch2 = _podVlanMapDao.createSearchBuilder();
+        PodVlanSearch2.and("podId", PodVlanSearch2.entity().getPodId(), SearchCriteria.Op.EQ);
+        ZoneTypePodSearch.join("vlan", PodVlanSearch2,  PodVlanSearch2.entity().getVlanDbId(), ZoneTypePodSearch.entity().getId(), JoinBuilder.JoinType.INNER);
+        PodVlanSearch2.done();
+        ZoneTypePodSearch.done();
+
+        ZoneWideNonDedicatedVlanSearch = createSearchBuilder();
+        ZoneWideNonDedicatedVlanSearch.and("zoneId", ZoneWideNonDedicatedVlanSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        AccountVlanMapSearch = _accountVlanMapDao.createSearchBuilder();
+        AccountVlanMapSearch.and("accountId", AccountVlanMapSearch.entity().getAccountId(), SearchCriteria.Op.NULL);
+        ZoneWideNonDedicatedVlanSearch.join("AccountVlanMapSearch", AccountVlanMapSearch, ZoneWideNonDedicatedVlanSearch.entity().getId(), AccountVlanMapSearch.entity().getVlanDbId(), JoinBuilder.JoinType.LEFTOUTER);
+        ZoneWideNonDedicatedVlanSearch.done();
+        AccountVlanMapSearch.done();
+
+        return result;
+    }
+
+    private VlanVO findNextVlan(long zoneId, Vlan.VlanType vlanType) {
+        List<VlanVO> allVlans = listByZoneAndType(zoneId, vlanType);
+        List<VlanVO> emptyVlans = new ArrayList<VlanVO>();
+        List<VlanVO> fullVlans = new ArrayList<VlanVO>();
+
+        // Try to find a VLAN that is partially allocated
+        for (VlanVO vlan : allVlans) {
+            long vlanDbId = vlan.getId();
+
+            int countOfAllocatedIps = _ipAddressDao.countIPs(zoneId, vlanDbId, true);
+            int countOfAllIps = _ipAddressDao.countIPs(zoneId, vlanDbId, false);
+
+            if ((countOfAllocatedIps > 0) && (countOfAllocatedIps < countOfAllIps)) {
+                return vlan;
+            } else if (countOfAllocatedIps == 0) {
+                emptyVlans.add(vlan);
+            } else if (countOfAllocatedIps == countOfAllIps) {
+                fullVlans.add(vlan);
+            }
+        }
+
+        if (emptyVlans.isEmpty()) {
+            return null;
+        }
+
+        // Try to find an empty VLAN with the same tag/subnet as a VLAN that is full
+        for (VlanVO fullVlan : fullVlans) {
+            for (VlanVO emptyVlan : emptyVlans) {
+                if (fullVlan.getVlanTag().equals(emptyVlan.getVlanTag()) && 
+                        fullVlan.getVlanGateway().equals(emptyVlan.getVlanGateway()) &&
+                        fullVlan.getVlanNetmask().equals(emptyVlan.getVlanNetmask())) {
+                    return emptyVlan;
+                }
+            }
+        }
+
+        // Return a random empty VLAN
+        return emptyVlans.get(0);
+    }
+
+    @Override
+    public boolean zoneHasDirectAttachUntaggedVlans(long zoneId) {
+        SearchCriteria<VlanVO> sc = ZoneTypeAllPodsSearch.create();
+        sc.setParameters("zoneId", zoneId);
+        sc.setParameters("vlanType", VlanType.DirectAttached);
+
+        return listIncludingRemovedBy(sc).size() > 0;
+    }
+
+
+    public Pair<String, VlanVO> assignPodDirectAttachIpAddress(long zoneId,
+            long podId, long accountId, long domainId) {
+        SearchCriteria<VlanVO> sc = ZoneTypePodSearch.create();
+        sc.setParameters("zoneId", zoneId);
+        sc.setParameters("vlanType", VlanType.DirectAttached);
+        sc.setJoinParameters("vlan", "podId", podId);
+
+        VlanVO vlan = findOneIncludingRemovedBy(sc);
+        if (vlan == null) {
+            return null;
+        }
+
+        return null;
+//    	String ipAddress = _ipAddressDao.assignIpAddress(accountId, domainId, vlan.getId(), false).getAddress();
+//    	if (ipAddress == null) {
+//    		return null;
+//    	}
+//		return new Pair<String, VlanVO>(ipAddress, vlan);
+
+    }
+
+    @Override
+    @DB
+    public List<VlanVO> searchForZoneWideVlans(long dcId, String vlanType, String vlanId){
+
+        StringBuilder sql = new StringBuilder(FindZoneWideVlans);
+
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql.toString());
+            pstmt.setLong(1, dcId);
+            pstmt.setString(2, vlanType);
+            pstmt.setString(3, vlanId);
+
+            ResultSet rs = pstmt.executeQuery();
+            List<VlanVO> zoneWideVlans = new ArrayList<VlanVO>();
+
+            while (rs.next()) {
+                zoneWideVlans.add(toEntityBean(rs, false));
+            }
+
+            return zoneWideVlans;
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Unable to execute " + pstmt.toString(), e);
+        }
+    }
+
+    @Override
+    public List<VlanVO> listVlansByNetworkId(long networkOfferingId) {
+        SearchCriteria<VlanVO> sc = NetworkVlanSearch.create();
+        sc.setParameters("networkOfferingId", networkOfferingId);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<VlanVO> listVlansByPhysicalNetworkId(long physicalNetworkId) {
+        SearchCriteria<VlanVO> sc = PhysicalNetworkVlanSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        return listBy(sc);
+    }	
+
+    @Override
+    public List<VlanVO> listZoneWideNonDedicatedVlans(long zoneId) {
+        SearchCriteria<VlanVO> sc = ZoneWideNonDedicatedVlanSearch.create();
+        sc.setParameters("ZoneWideNonDedicatedVlanSearch", "zoneId", zoneId);
+        return listBy(sc);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/domain/DomainVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/domain/DomainVO.java b/engine/schema/src/com/cloud/domain/DomainVO.java
new file mode 100644
index 0000000..a87bedc
--- /dev/null
+++ b/engine/schema/src/com/cloud/domain/DomainVO.java
@@ -0,0 +1,215 @@
+// 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.domain;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.InternalIdentity;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.utils.db.GenericDao;
+
+@Entity
+@Table(name="domain")
+public class DomainVO implements Domain {
+	public static final Logger s_logger = Logger.getLogger(DomainVO.class.getName());
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="parent")
+    private Long parent = null;
+
+    @Column(name="name")
+    private String name = null;
+
+    @Column(name="owner")
+    private long accountId;
+
+    @Column(name="path")
+    private String path = null;
+
+    @Column(name="level")
+    private int level;
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+
+    @Column(name="child_count")
+    private int childCount = 0;
+
+    @Column(name="next_child_seq")
+    private long nextChildSeq = 1L;
+
+    @Column(name="state")
+    private Domain.State state;
+
+    @Column(name="network_domain")
+    private String networkDomain;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    public DomainVO() {}
+    
+    public DomainVO(String name, long owner, Long parentId, String networkDomain) {
+    	this.parent = parentId;
+        this.name = name;
+        this.accountId = owner;
+        this.path ="";
+        this.level = 0;
+        this.state = Domain.State.Active;
+        this.networkDomain = networkDomain;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public DomainVO(String name, long owner, Long parentId, String networkDomain, String uuid) {
+    	this.parent = parentId;
+        this.name = name;
+        this.accountId = owner;
+        this.path ="";
+        this.level = 0;
+        this.state = Domain.State.Active;
+        this.networkDomain = networkDomain;
+        this.uuid = uuid;
+    }
+    
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public Long getParent() {
+        return parent;
+    }
+
+    @Override
+    public void setParent(Long parent) {
+    	if(parent == null) {
+    		this.parent = DomainVO.ROOT_DOMAIN;
+    	} else {
+    		if(parent.longValue() <= DomainVO.ROOT_DOMAIN)
+    			this.parent = DomainVO.ROOT_DOMAIN;
+    		else
+    			this.parent = parent;
+    	}
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public Date getRemoved() {
+        return removed;
+    }
+
+    @Override
+    public String getPath() {
+    	return path;
+    }
+
+    @Override
+    public void setPath(String path) {
+    	this.path = path;
+    }
+
+    @Override
+    public int getLevel() {
+    	return level;
+    }
+
+    public void setLevel(int level) {
+    	this.level = level;
+    }
+
+    @Override
+    public int getChildCount() {
+    	return childCount;
+    }
+
+    public void setChildCount(int count) {
+    	childCount = count;
+    }
+
+    @Override
+    public long getNextChildSeq() {
+    	return nextChildSeq;
+    }
+
+    public void setNextChildSeq(long seq) {
+    	nextChildSeq = seq;
+    }
+
+    @Override
+    public Domain.State getState() {
+        return state;
+    }
+
+    @Override
+    public void setState(Domain.State state) {
+        this.state = state;
+    }
+
+    @Override
+    public String toString() {
+        return new StringBuilder("Domain:").append(id).append(path).toString();
+    }
+
+    @Override
+    public String getNetworkDomain() {
+        return networkDomain;
+    }
+
+    public void setNetworkDomain(String domainSuffix) {
+        this.networkDomain = domainSuffix;
+    }
+
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+    
+}
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/domain/dao/DomainDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/domain/dao/DomainDao.java b/engine/schema/src/com/cloud/domain/dao/DomainDao.java
new file mode 100644
index 0000000..afeb0f4
--- /dev/null
+++ b/engine/schema/src/com/cloud/domain/dao/DomainDao.java
@@ -0,0 +1,34 @@
+// 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.domain.dao;
+
+import java.util.List;
+import java.util.Set;
+
+import com.cloud.domain.DomainVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface DomainDao extends GenericDao<DomainVO, Long> {
+    public DomainVO create(DomainVO domain);
+    public DomainVO findDomainByPath(String domainPath);
+    public boolean isChildDomain(Long parentId, Long childId);
+	DomainVO findImmediateChildForParent(Long parentId);
+	List<DomainVO> findImmediateChildrenForParent(Long parentId);
+	List<DomainVO> findAllChildren(String path, Long parentId);
+	List<DomainVO> findInactiveDomains();
+    Set<Long> getDomainParentIds(long domainId);
+}


[26/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/alert/AlertVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/alert/AlertVO.java b/core/src/com/cloud/alert/AlertVO.java
deleted file mode 100755
index 3f014aa..0000000
--- a/core/src/com/cloud/alert/AlertVO.java
+++ /dev/null
@@ -1,183 +0,0 @@
-// 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.alert;
-
-import java.util.Date;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import com.cloud.utils.db.GenericDao;
-
-@Entity
-@Table(name="alert")
-public class AlertVO implements Alert {
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private long id;
-
-    @Column(name="type")
-    private short type;
-    
-    @Column(name="cluster_id")
-    private Long clusterId = null;
-    
-    @Column(name="pod_id")
-    private Long podId = null;
-
-    @Column(name="data_center_id")
-    private long dataCenterId = 0;
-
-    @Column(name="subject", length=999)
-    private String subject;
-
-    @Column(name="sent_count")
-    private int sentCount = 0;
-
-    @Column(name=GenericDao.CREATED_COLUMN)
-    private Date createdDate;
-
-    @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="last_sent", updatable=true, nullable=true)
-    private Date lastSent;
-
-    @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="resolved", updatable=true, nullable=true)
-    private Date resolved;
-
-    @Column(name="uuid")
-    private String uuid;
-
-    @Column(name="archived")
-    private boolean archived;
-
-    public AlertVO() {
-        this.uuid = UUID.randomUUID().toString();
-    }
-    public AlertVO(Long id) {
-        this.id = id;
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-    @Override
-    public short getType() {
-        return type;
-    }
-
-    public void setType(short type) {
-        this.type = type;
-    }
-
-    @Override
-    public String getSubject() {
-        return subject;
-    }
-
-    public void setSubject(String subject) {
-        this.subject = subject;
-    }
-
-    public Long getClusterId() {
-        return clusterId;
-    }
-    public void setClusterId(Long clusterId) {
-        this.clusterId = clusterId;
-    }
-    @Override
-    public Long getPodId() {
-        return podId;
-    }
-
-    public void setPodId(Long podId) {
-        this.podId = podId;
-    }
-
-    @Override
-    public long getDataCenterId() {
-        return dataCenterId;
-    }
-
-    public void setDataCenterId(long dataCenterId) {
-        this.dataCenterId = dataCenterId;
-    }
-
-    @Override
-    public int getSentCount() {
-        return sentCount;
-    }
-
-    public void setSentCount(int sentCount) {
-        this.sentCount = sentCount;
-    }
-
-    @Override
-    public Date getCreatedDate() {
-        return createdDate;
-    }
-
-    public void setCreatedDate(Date createdDate) {
-        this.createdDate = createdDate;
-    }
-
-    @Override
-    public Date getLastSent() {
-        return lastSent;
-    }
-
-    public void setLastSent(Date lastSent) {
-        this.lastSent = lastSent;
-    }
-
-    @Override
-    public Date getResolved() {
-        return resolved;
-    }
-
-    public void setResolved(Date resolved) {
-        this.resolved = resolved;
-    }
-    
-    @Override
-    public String getUuid() {
-        return this.uuid;
-    }
-
-    public void setUuid(String uuid) {
-        this.uuid = uuid;
-    }
-
-    @Override
-    public boolean getArchived() {
-        return archived;
-    }
-
-    public void setArchived(Boolean archived) {
-        this.archived = archived;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/async/AsyncJobVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/async/AsyncJobVO.java b/core/src/com/cloud/async/AsyncJobVO.java
deleted file mode 100644
index ad482b0..0000000
--- a/core/src/com/cloud/async/AsyncJobVO.java
+++ /dev/null
@@ -1,400 +0,0 @@
-// 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.async;
-
-import java.util.Date;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-
-import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="async_job")
-public class AsyncJobVO implements AsyncJob {
-	public static final int CALLBACK_POLLING = 0;
-	public static final int CALLBACK_EMAIL = 1;
-	
-	@Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private Long id = null;
-
-    @Column(name="user_id")
-    private long userId;
-    
-    @Column(name="account_id")
-    private long accountId;
-    
-    @Column(name="session_key")
-    private String sessionKey;
-    
-	@Column(name="job_cmd")
-    private String cmd;
-	
-	@Column(name="job_cmd_originator")
-	private String cmdOriginator;
-    
-	@Column(name="job_cmd_ver")
-    private int cmdVersion;
-    
-    @Column(name="job_cmd_info", length=65535)
-    private String cmdInfo;
-    
-    @Column(name="callback_type")
-    private int callbackType;
-    
-    @Column(name="callback_address")
-    private String callbackAddress;
-    
-    @Column(name="job_status")
-    private int status;
-    
-    @Column(name="job_process_status")
-    private int processStatus;
-    
-    @Column(name="job_result_code")
-    private int resultCode;
-    
-    @Column(name="job_result", length=65535)
-    private String result;
-    
-    @Enumerated(value=EnumType.STRING)
-    @Column(name="instance_type", length=64)
-    private Type instanceType;
-    
-	@Column(name="instance_id", length=64)
-    private Long instanceId;
-    
-    @Column(name="job_init_msid")
-    private Long initMsid;
-
-    @Column(name="job_complete_msid")
-    private Long completeMsid;
-    
-    @Column(name=GenericDao.CREATED_COLUMN)
-    private Date created;
-    
-    @Column(name="last_updated")
-    @Temporal(TemporalType.TIMESTAMP)
-    private Date lastUpdated;
-    
-    @Column(name="last_polled")
-    @Temporal(TemporalType.TIMESTAMP)
-    private Date lastPolled;
-    
-    @Column(name=GenericDao.REMOVED_COLUMN)
-    private Date removed;
-    
-    @Column(name="uuid")
-    private String uuid;
-
-    @Transient
-    private SyncQueueItemVO syncSource = null;
-
-    @Transient
-    private boolean fromPreviousSession = false;
-
-    
-    public AsyncJobVO() {
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    public AsyncJobVO(long userId, long accountId, String cmd, String cmdInfo, Long instanceId, Type instanceType) {
-	this.userId = userId;
-	this.accountId = accountId;
-	this.cmd = cmd;
-	this.cmdInfo = cmdInfo;
-    	this.callbackType = CALLBACK_POLLING;
-    	this.uuid = UUID.randomUUID().toString();
-        this.instanceId = instanceId;
-    }
-
-    public AsyncJobVO(long userId, long accountId, String cmd, String cmdInfo,
-	int callbackType, String callbackAddress, Long instanceId, Type instanceType) {
-
-	this(userId, accountId, cmd, cmdInfo, instanceId, instanceType);
-	this.callbackType = callbackType;
-	this.callbackAddress = callbackAddress;
-    	this.uuid = UUID.randomUUID().toString();
-    }
-
-
-    @Override
-    public long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	@Override
-    public long getUserId() {
-		return userId;
-	}
-
-	public void setUserId(long userId) {
-		this.userId = userId;
-	}
-
-	@Override
-    public long getAccountId() {
-		return accountId;
-	}
-
-	public void setAccountId(long accountId) {
-		this.accountId = accountId;
-	}
-
-	@Override
-    public String getCmd() {
-		return cmd;
-	}
-
-	public void setCmd(String cmd) {
-		this.cmd = cmd;
-	}
-	
-	@Override
-    public int getCmdVersion() {
-		return cmdVersion;
-	}
-	
-	public void setCmdVersion(int version) {
-		cmdVersion = version;
-	}
-
-	@Override
-    public String getCmdInfo() {
-		return cmdInfo;
-	}
-
-	public void setCmdInfo(String cmdInfo) {
-		this.cmdInfo = cmdInfo;
-	}
-
-	@Override
-    public int getCallbackType() {
-		return callbackType;
-	}
-
-	public void setCallbackType(int callbackType) {
-		this.callbackType = callbackType;
-	}
-
-	@Override
-    public String getCallbackAddress() {
-		return callbackAddress;
-	}
-
-	public void setCallbackAddress(String callbackAddress) {
-		this.callbackAddress = callbackAddress;
-	}
-
-	@Override
-    public int getStatus() {
-		return status;
-	}
-
-	public void setStatus(int status) {
-		this.status = status;
-	}
-	
-	@Override
-    public int getProcessStatus() {
-		return processStatus;
-	}
-	
-	public void setProcessStatus(int status) {
-		processStatus = status;
-	}
-	
-	@Override
-    public int getResultCode() {
-		return resultCode;
-	}
-	
-	public void setResultCode(int resultCode) {
-		this.resultCode = resultCode;
-	}
-
-	@Override
-    public String getResult() {
-		return result;
-	}
-
-	public void setResult(String result) {
-		this.result = result;
-	}
-
-	@Override
-    public Long getInitMsid() {
-		return initMsid;
-	}
-
-	public void setInitMsid(Long initMsid) {
-		this.initMsid = initMsid;
-	}
-
-	@Override
-    public Long getCompleteMsid() {
-		return completeMsid;
-	}
-
-	public void setCompleteMsid(Long completeMsid) {
-		this.completeMsid = completeMsid;
-	}
-
-	@Override
-    public Date getCreated() {
-		return created;
-	}
-
-	public void setCreated(Date created) {
-		this.created = created;
-	}
-
-	@Override
-    public Date getLastUpdated() {
-		return lastUpdated;
-	}
-
-	public void setLastUpdated(Date lastUpdated) {
-		this.lastUpdated = lastUpdated;
-	}
-
-	@Override
-    public Date getLastPolled() {
-		return lastPolled;
-	}
-
-	public void setLastPolled(Date lastPolled) {
-		this.lastPolled = lastPolled;
-	}
-
-	@Override
-    public Date getRemoved() {
-		return removed;
-	}
-
-	public void setRemoved(Date removed) {
-		this.removed = removed;
-	}
-	
-    @Override
-    public Type getInstanceType() {
-		return instanceType;
-	}
-
-	public void setInstanceType(Type instanceType) {
-		this.instanceType = instanceType;
-	}
-
-	@Override
-    public Long getInstanceId() {
-		return instanceId;
-	}
-
-	public void setInstanceId(Long instanceId) {
-		this.instanceId = instanceId;
-	}
-	
-    @Override
-    public String getSessionKey() {
-		return sessionKey;
-	}
-
-	public void setSessionKey(String sessionKey) {
-		this.sessionKey = sessionKey;
-	}
-	
-    @Override
-    public String getCmdOriginator() {
-		return cmdOriginator;
-	}
-
-	public void setCmdOriginator(String cmdOriginator) {
-		this.cmdOriginator = cmdOriginator;
-	}
-	
-	@Override
-    public SyncQueueItemVO getSyncSource() {
-        return syncSource;
-    }
-    
-    public void setSyncSource(SyncQueueItemVO syncSource) {
-        this.syncSource = syncSource;
-    }
-    
-    @Override
-    public boolean isFromPreviousSession() {
-        return fromPreviousSession;
-    }
-    
-    public void setFromPreviousSession(boolean fromPreviousSession) {
-        this.fromPreviousSession = fromPreviousSession;
-    }
-    
-    @Override
-    public String getUuid() {
-    	return this.uuid;
-    }
-    
-    public void setUuid(String uuid) {
-    	this.uuid = uuid;
-    }
-    
-	@Override
-    public String toString() {
-		StringBuffer sb = new StringBuffer();
-		sb.append("AsyncJobVO {id:").append(getId());
-		sb.append(", userId: ").append(getUserId());
-		sb.append(", accountId: ").append(getAccountId());
-		sb.append(", sessionKey: ").append(getSessionKey());
-		sb.append(", instanceType: ").append(getInstanceType());
-		sb.append(", instanceId: ").append(getInstanceId());
-		sb.append(", cmd: ").append(getCmd());
-		sb.append(", cmdOriginator: ").append(getCmdOriginator());
-		sb.append(", cmdInfo: ").append(getCmdInfo());
-		sb.append(", cmdVersion: ").append(getCmdVersion());
-		sb.append(", callbackType: ").append(getCallbackType());
-		sb.append(", callbackAddress: ").append(getCallbackAddress());
-		sb.append(", status: ").append(getStatus());
-		sb.append(", processStatus: ").append(getProcessStatus());
-		sb.append(", resultCode: ").append(getResultCode());
-		sb.append(", result: ").append(getResult());
-		sb.append(", initMsid: ").append(getInitMsid());
-		sb.append(", completeMsid: ").append(getCompleteMsid());
-		sb.append(", lastUpdated: ").append(getLastUpdated());
-		sb.append(", lastPolled: ").append(getLastPolled());
-		sb.append(", created: ").append(getCreated());
-		sb.append("}");
-		return sb.toString();
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/async/SyncQueueItemVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/async/SyncQueueItemVO.java b/core/src/com/cloud/async/SyncQueueItemVO.java
deleted file mode 100644
index b0546a7..0000000
--- a/core/src/com/cloud/async/SyncQueueItemVO.java
+++ /dev/null
@@ -1,141 +0,0 @@
-// 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.async;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-@Entity
-@Table(name="sync_queue_item")
-public class SyncQueueItemVO implements SyncQueueItem, InternalIdentity {
-
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private Long id = null;
-    
-    @Column(name="queue_id")
-    private Long queueId;
-    
-    @Column(name="content_type")
-    private String contentType;
-    
-    @Column(name="content_id")
-    private Long contentId;
-    
-    @Column(name="queue_proc_msid")
-    private Long lastProcessMsid;
-
-    @Column(name="queue_proc_number")
-    private Long lastProcessNumber;
-    
-    @Column(name="queue_proc_time")
-    @Temporal(TemporalType.TIMESTAMP)
-    private Date lastProcessTime;
-    
-    @Column(name="created")
-    private Date created;
-    
-    public long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public Long getQueueId() {
-        return queueId;
-    }
-
-    public void setQueueId(Long queueId) {
-        this.queueId = queueId;
-    }
-
-    @Override
-    public String getContentType() {
-        return contentType;
-    }
-
-    public void setContentType(String contentType) {
-        this.contentType = contentType;
-    }
-    
-    @Override
-    public Long getContentId() {
-        return contentId;
-    }
-
-    public void setContentId(Long contentId) {
-        this.contentId = contentId;
-    }
-
-    public Long getLastProcessMsid() {
-        return lastProcessMsid;
-    }
-
-    public void setLastProcessMsid(Long lastProcessMsid) {
-        this.lastProcessMsid = lastProcessMsid;
-    }
-
-    public Long getLastProcessNumber() {
-        return lastProcessNumber;
-    }
-
-    public void setLastProcessNumber(Long lastProcessNumber) {
-        this.lastProcessNumber = lastProcessNumber;
-    }
-
-    public Date getCreated() {
-        return created;
-    }
-
-    public void setCreated(Date created) {
-        this.created = created;
-    }
-
-    public String toString() {
-        StringBuffer sb = new StringBuffer();
-        sb.append("SyncQueueItemVO {id:").append(getId()).append(", queueId: ").append(getQueueId());
-        sb.append(", contentType: ").append(getContentType());
-        sb.append(", contentId: ").append(getContentId());
-        sb.append(", lastProcessMsid: ").append(getLastProcessMsid());
-        sb.append(", lastprocessNumber: ").append(getLastProcessNumber());
-        sb.append(", lastProcessTime: ").append(getLastProcessTime());
-        sb.append(", created: ").append(getCreated());
-        sb.append("}");
-        return sb.toString();
-    }
-
-       public Date getLastProcessTime() {
-            return lastProcessTime;
-        }
-
-        public void setLastProcessTime(Date lastProcessTime) {
-            this.lastProcessTime = lastProcessTime;
-        }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/async/SyncQueueVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/async/SyncQueueVO.java b/core/src/com/cloud/async/SyncQueueVO.java
deleted file mode 100644
index 4f2bc4f..0000000
--- a/core/src/com/cloud/async/SyncQueueVO.java
+++ /dev/null
@@ -1,137 +0,0 @@
-// 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.async;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-@Entity
-@Table(name="sync_queue")
-public class SyncQueueVO implements InternalIdentity {
-
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private Long id;
-
-    @Column(name="sync_objtype")
-
-    private String syncObjType;
-
-    @Column(name="sync_objid")
-    private Long syncObjId;
-
-    @Column(name="queue_proc_number")
-    private Long lastProcessNumber;
-
-    @Column(name="created")
-    @Temporal(TemporalType.TIMESTAMP)
-    private Date created;
-
-    @Column(name="last_updated")
-    @Temporal(TemporalType.TIMESTAMP)
-    private Date lastUpdated;
-
-    @Column(name="queue_size")
-    private long queueSize = 0;
-
-    @Column(name="queue_size_limit")
-    private long queueSizeLimit = 0;
-
-    public long getId() {
-        return id;
-    }
-
-    public String getSyncObjType() {
-        return syncObjType;
-    }
-
-    public void setSyncObjType(String syncObjType) {
-        this.syncObjType = syncObjType;
-    }
-
-    public Long getSyncObjId() {
-        return syncObjId;
-    }
-
-    public void setSyncObjId(Long syncObjId) {
-        this.syncObjId = syncObjId;
-    }
-    
-    public Long getLastProcessNumber() {
-        return lastProcessNumber;
-    }
-    
-    public void setLastProcessNumber(Long number) {
-        lastProcessNumber = number;
-    }
-
-    public Date getCreated() {
-        return created;
-    }
-
-    public void setCreated(Date created) {
-        this.created = created;
-    }
-
-    public Date getLastUpdated() {
-        return lastUpdated;
-    }
-
-    public void setLastUpdated(Date lastUpdated) {
-        this.lastUpdated = lastUpdated;
-    }
-
-    public String toString() {
-        StringBuffer sb = new StringBuffer();
-        sb.append("SyncQueueVO {id:").append(getId());
-        sb.append(", syncObjType: ").append(getSyncObjType());
-        sb.append(", syncObjId: ").append(getSyncObjId());
-        sb.append(", lastProcessNumber: ").append(getLastProcessNumber());
-        sb.append(", lastUpdated: ").append(getLastUpdated());
-        sb.append(", created: ").append(getCreated());
-        sb.append(", count: ").append(getQueueSize());
-        sb.append("}");
-        return sb.toString();
-    }
-
-    public long getQueueSize() {
-        return queueSize;
-    }
-
-    public void setQueueSize(long queueSize) {
-        this.queueSize = queueSize;
-    }
-
-    public long getQueueSizeLimit() {
-        return queueSizeLimit;
-    }
-
-    public void setQueueSizeLimit(long queueSizeLimit) {
-        this.queueSizeLimit = queueSizeLimit;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/capacity/CapacityVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/capacity/CapacityVO.java b/core/src/com/cloud/capacity/CapacityVO.java
deleted file mode 100755
index d34e9d3..0000000
--- a/core/src/com/cloud/capacity/CapacityVO.java
+++ /dev/null
@@ -1,204 +0,0 @@
-// 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.capacity;
-
-import javax.persistence.Transient;
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="op_host_capacity")
-public class CapacityVO implements Capacity {
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private long id;
-
-    @Column(name="host_id")
-    private Long hostOrPoolId;
-
-    @Column(name="data_center_id")
-    private Long dataCenterId;
-
-    @Column(name="pod_id")
-    private Long podId;
-
-    @Column(name="cluster_id")
-    private Long clusterId;
-
-    @Column(name="used_capacity")
-    private long usedCapacity;
-
-    @Column(name="reserved_capacity")
-    private long reservedCapacity;
-    
-    @Column(name="total_capacity")
-    private long totalCapacity;
-
-    @Column(name="capacity_type")
-    private short capacityType;
-    
-    @Column(name="capacity_state")
-    private CapacityState capacityState;
-    
-    @Column(name=GenericDao.CREATED_COLUMN)
-    protected Date created;    
-    
-    @Column(name="update_time", updatable=true, nullable=true)
-    @Temporal(value=TemporalType.TIMESTAMP)
-    protected Date updateTime;
-    
-    @Transient
-    private Float usedPercentage;
-    
-    public CapacityVO() {}
-
-    public CapacityVO(Long hostId, Long dataCenterId, Long podId, Long clusterId, long usedCapacity, long totalCapacity, short capacityType) {
-        this.hostOrPoolId = hostId;
-        this.dataCenterId = dataCenterId;
-        this.podId = podId;
-        this.clusterId = clusterId;
-        this.usedCapacity = usedCapacity;
-        this.totalCapacity = totalCapacity;
-        this.capacityType = capacityType;
-        this.updateTime = new Date();
-        this.capacityState = CapacityState.Enabled;
-    }
-    
-    public CapacityVO(Long dataCenterId, Long podId, Long clusterId, short capacityType, float usedPercentage) {        
-        this.dataCenterId = dataCenterId;
-        this.podId = podId;
-        this.clusterId = clusterId;
-        this.capacityType = capacityType;
-        this.usedPercentage = usedPercentage;
-        this.capacityState = CapacityState.Enabled;
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-
-    @Override
-    public Long getHostOrPoolId() {
-        return hostOrPoolId;
-    }
-    
-    public void setHostId(Long hostId) {
-        this.hostOrPoolId = hostId;
-    }
-    @Override
-    public Long getDataCenterId() {
-        return dataCenterId;
-    }
-    public void setDataCenterId(Long dataCenterId) {
-        this.dataCenterId = dataCenterId;
-    }
-    
-    @Override
-    public Long getPodId() {
-        return podId;
-    }
-    public void setPodId(long podId) {
-        this.podId = new Long(podId);
-    }
-    
-    @Override
-    public Long getClusterId() {
-        return clusterId;
-    }
-    public void setClusterId(long clusterId) {
-        this.clusterId = new Long(clusterId);
-    }
-    
-    @Override
-    public long getUsedCapacity() {
-        return usedCapacity;
-    }
-    public void setUsedCapacity(long usedCapacity) {
-        this.usedCapacity = usedCapacity;
-        this.setUpdateTime (new Date());
-    }
-    @Override
-    public long getReservedCapacity() {
-        return reservedCapacity;
-    }
-    public void setReservedCapacity(long reservedCapacity) {
-        this.reservedCapacity = reservedCapacity;
-        this.setUpdateTime (new Date());
-    }
-    @Override
-    public long getTotalCapacity() {
-        return totalCapacity;
-    }
-    public void setTotalCapacity(long totalCapacity) {
-        this.totalCapacity = totalCapacity;
-        this.setUpdateTime (new Date());
-    }
-    @Override
-    public short getCapacityType() {
-        return capacityType;
-    }
-    public void setCapacityType(short capacityType) {
-        this.capacityType = capacityType;
-    }
-
-	public CapacityState getCapacityState() {
-        return capacityState;
-    }
-
-    public void setCapacityState(CapacityState capacityState) {
-        this.capacityState = capacityState;
-    }
-
-    public Date getCreated() {
-		return created;
-	}
-
-	public Date getUpdateTime() {
-		return updateTime;
-	}
-
-	public void setUpdateTime(Date updateTime) {
-		this.updateTime = updateTime;
-	}
-
-	@Override
-    public Float getUsedPercentage() {
-        return usedPercentage;
-    }
-
-    public void setUsedPercentage(float usedPercentage) {
-        this.usedPercentage = usedPercentage;
-    }
-
-    @Override
-    public String getUuid() {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/certificate/CertificateVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/certificate/CertificateVO.java b/core/src/com/cloud/certificate/CertificateVO.java
deleted file mode 100644
index 4f04760..0000000
--- a/core/src/com/cloud/certificate/CertificateVO.java
+++ /dev/null
@@ -1,63 +0,0 @@
-// 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.certificate;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name="certificate")
-public class CertificateVO implements InternalIdentity {
-
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private Long id = null;
-
-    @Column(name="certificate",length=65535)
-    private String certificate;
-
-    @Column(name="updated")
-    private String updated;
-
-    public CertificateVO() {}
-
-    public long getId() {
-        return id;
-    }
-    
-    public String getCertificate() {
-        return certificate;
-    }
-    public void setCertificate(String certificate) {
-        this.certificate = certificate;
-    }
-    
-    public String getUpdated(){
-    	return this.updated;
-    }
-    
-    public void setUpdated(String updated){
-    	this.updated = updated;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/configuration/ConfigurationVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/configuration/ConfigurationVO.java b/core/src/com/cloud/configuration/ConfigurationVO.java
deleted file mode 100644
index 6cd87b0..0000000
--- a/core/src/com/cloud/configuration/ConfigurationVO.java
+++ /dev/null
@@ -1,107 +0,0 @@
-// 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.configuration;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import com.cloud.utils.crypt.DBEncryptionUtil;
-
-@Entity
-@Table(name="configuration")
-public class ConfigurationVO implements Configuration{
-	@Column(name="instance")
-    private String instance;
-
-	@Column(name="component")
-	private String component;
-	
-	@Id
-	@Column(name="name")
-    private String name;
-	
-	@Column(name="value", length=4095)
-    private String value;
-	
-	@Column(name="description", length=1024)
-    private String description;
-	
-	@Column(name="category")
-	private String category;
-	
-	protected ConfigurationVO() {}
-	
-	public ConfigurationVO(String category, String instance, String component, String name, String value, String description) {
-		this.category = category;
-		this.instance = instance;
-		this.component = component;
-		this.name = name;
-		this.value = value;
-		this.description = description;
-	}
-
-	public String getCategory() {
-		return category;
-	}
-	
-	public void setCategory(String category) {
-		this.category = category;
-	}
-	
-	public String getInstance() {
-		return instance;
-	}
-	
-	public void setInstance(String instance) {
-		this.instance = instance;
-	}
-
-	public String getComponent() {
-	    return component;
-	}
-	
-	public void setComponent(String component) {
-		this.component = component;
-	}
-
-	public String getName() {
-		return name;
-	}
-	
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public String getValue() {
-		return (("Hidden".equals(getCategory()) || "Secure".equals(getCategory())) ? DBEncryptionUtil.decrypt(value) : value);
-	}
-	
-	public void setValue(String value) {
-		this.value = value;
-	}
-	
-	public String getDescription() {
-		return description;
-	}
-	
-	public void setDescription(String description) {
-		this.description = description;
-	}
-	
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/configuration/ResourceCountVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/configuration/ResourceCountVO.java b/core/src/com/cloud/configuration/ResourceCountVO.java
deleted file mode 100644
index b87f55c..0000000
--- a/core/src/com/cloud/configuration/ResourceCountVO.java
+++ /dev/null
@@ -1,131 +0,0 @@
-// 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.configuration;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name="resource_count")
-public class ResourceCountVO implements ResourceCount {
-	
-	@Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private Long id = null;
-	
-	@Column(name="type")
-	@Enumerated(EnumType.STRING)
-	private ResourceType type;
-	
-	@Column(name="account_id")
-    private Long accountId;
-	
-	@Column(name="domain_id")
-    private Long domainId;
-	
-	@Column(name="count")
-	private long count;
-	
-    
-    public ResourceCountVO(){}
-	
-	public ResourceCountVO(ResourceType type, long count, long ownerId, ResourceOwnerType ownerType) {  
-		this.type = type;
-		this.count = count;
-		
-		if (ownerType == ResourceOwnerType.Account) {
-		    this.accountId = ownerId;
-		} else if (ownerType == ResourceOwnerType.Domain) {
-		    this.domainId = ownerId;
-		}
-	}
-	
-	@Override
-	public long getId() {
-		return id;
-	}
-	
-	public void setId(Long id) {
-		this.id = id;
-	}
-	
-	@Override
-	public ResourceType getType() {
-		return type;
-	}
-	
-	public void setType(ResourceType type) {
-		this.type = type;
-	}
-
-	@Override
-	public long getCount() {
-		return count;
-	}
-	@Override
-	public void setCount(long count) {
-		this.count = count;
-	}
-	
-    public Long getDomainId() {
-        return domainId;
-    }
-    
-    public Long getAccountId() {
-        return accountId;
-    }
-	
-	@Override
-    public String toString() {
-        return new StringBuilder("REsourceCount[").append("-").append(id).append("-").append(type).append("-").append(accountId).append("-").append(domainId).append("]").toString();
-    }
-	
-	@Override
-	public long getOwnerId() {
-	    if (accountId != null) {
-	        return accountId;
-	    } 
-	    
-	    return domainId;
-	}
-	
-	@Override
-	public ResourceOwnerType getResourceOwnerType() {
-	    if (accountId != null) {
-	        return ResourceOwnerType.Account;
-	    } else {
-	        return ResourceOwnerType.Domain;
-	    }
-	}
-	
-	public void setDomainId(Long domainId) {
-	    this.domainId = domainId;
-	}
-
-	public void setAccountId(Long accountId) {
-	    this.accountId = accountId;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/configuration/ResourceLimitVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/configuration/ResourceLimitVO.java b/core/src/com/cloud/configuration/ResourceLimitVO.java
deleted file mode 100644
index c131495..0000000
--- a/core/src/com/cloud/configuration/ResourceLimitVO.java
+++ /dev/null
@@ -1,128 +0,0 @@
-// 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.configuration;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name = "resource_limit")
-public class ResourceLimitVO implements ResourceLimit {
-
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Column(name = "id")
-    private Long id = null;
-
-    @Column(name = "type")
-    @Enumerated(EnumType.STRING)
-    private ResourceCount.ResourceType type;
-
-    @Column(name = "domain_id")
-    private Long domainId;
-
-    @Column(name = "account_id")
-    private Long accountId;
-
-    @Column(name = "max")
-    private Long max;
-
-    public ResourceLimitVO() {
-    }
-
-    public ResourceLimitVO(ResourceCount.ResourceType type, Long max, long ownerId, ResourceOwnerType ownerType) {
-        this.type = type;
-        this.max = max;
-
-        if (ownerType == ResourceOwnerType.Account) {
-            this.accountId = ownerId;
-        } else if (ownerType == ResourceOwnerType.Domain) {
-            this.domainId = ownerId;
-        }
-    }
-
-    @Override
-    public long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    @Override
-    public ResourceType getType() {
-        return type;
-    }
-
-    public void setType(ResourceCount.ResourceType type) {
-        this.type = type;
-    }
-
-    public Long getDomainId() {
-        return domainId;
-    }
-
-    public Long getAccountId() {
-        return accountId;
-    }
-
-    @Override
-    public Long getMax() {
-        return max;
-    }
-
-    @Override
-    public void setMax(Long max) {
-        this.max = max;
-    }
-
-    @Override
-    public long getOwnerId() {
-        if (accountId != null) {
-            return accountId;
-        }
-
-        return domainId;
-    }
-
-    @Override
-    public ResourceOwnerType getResourceOwnerType() {
-        if (accountId != null) {
-            return ResourceOwnerType.Account;
-        } else {
-            return ResourceOwnerType.Domain;
-        }
-    }
-
-    public void setDomainId(Long domainId) {
-        this.domainId = domainId;
-    }
-
-    public void setAccountId(Long accountId) {
-        this.accountId = accountId;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/event/EventVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/event/EventVO.java b/core/src/com/cloud/event/EventVO.java
deleted file mode 100644
index 2c30ead..0000000
--- a/core/src/com/cloud/event/EventVO.java
+++ /dev/null
@@ -1,194 +0,0 @@
-// 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.event;
-
-import java.util.Date;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-
-import com.cloud.utils.db.GenericDao;
-
-@Entity
-@Table(name="event")
-public class EventVO implements Event {
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private long id = -1;
-
-    @Column(name="type")
-    private String type;
-
-    @Enumerated(value=EnumType.STRING)
-    @Column(name="state")
-    private State state = State.Completed;
-
-    @Column(name="description", length=1024)
-    private String description;
-
-    @Column(name=GenericDao.CREATED_COLUMN)
-    private Date createDate;
-
-    @Column(name="user_id")
-    private long userId;
-
-    @Column(name="account_id")
-    private long accountId;
-
-    @Column(name="domain_id")
-    private long domainId;
-
-    @Column(name="level")
-    private String level = LEVEL_INFO;
-
-    @Column(name="start_id")
-    private long startId;
-
-    @Column(name="parameters", length=1024)
-    private String parameters;
-
-    @Column(name="uuid")
-    private String uuid;
-
-    @Column(name="archived")
-    private boolean archived;
-
-    @Transient
-    private int totalSize;
-
-    public static final String LEVEL_INFO = "INFO";
-    public static final String LEVEL_WARN = "WARN";
-    public static final String LEVEL_ERROR = "ERROR";
-
-    public EventVO() {
-        this.uuid = UUID.randomUUID().toString();
-    }
-
-    public long getId() {
-        return id;
-    }
-    @Override
-    public String getType() {
-        return type;
-    }
-    public void setType(String type) {
-        this.type = type;
-    }
-    @Override
-    public State getState() {
-        return state;
-    }
-
-    public void setState(State state) {
-        this.state = state;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-    public void setDescription(String description) {
-        this.description = description;
-    }
-    @Override
-    public Date getCreateDate() {
-        return createDate;
-    }
-    public void setCreatedDate(Date createdDate) {
-        createDate = createdDate;
-    }
-    @Override
-    public long getUserId() {
-        return userId;
-    }
-    public void setUserId(long userId) {
-        this.userId = userId;
-    }
-    @Override
-    public long getAccountId() {
-        return accountId;
-    }
-    public void setAccountId(long accountId) {
-        this.accountId = accountId;
-    }
-    @Override
-    public long getDomainId() {
-        return domainId;
-    }
-
-	public void setDomainId(long domainId) {
-		this.domainId = domainId;
-	}
-
-	@Override
-    public int getTotalSize() {
-		return totalSize;
-	}
-	public void setTotalSize(int totalSize) {
-		this.totalSize = totalSize;
-	}
-	@Override
-    public String getLevel() {
-		return level;
-	}
-	public void setLevel(String level) {
-		this.level = level;
-	}
-	@Override
-    public long getStartId() {
-        return startId;
-    }
-
-    public void setStartId(long startId) {
-        this.startId = startId;
-    }
-
-    @Override
-    public String getParameters() {
-        return parameters;
-    }
-    public void setParameters(String parameters) {
-        this.parameters = parameters;
-    }
-
-    @Override
-    public String getUuid() {
-        return this.uuid;
-    }
-
-    public void setUuid(String uuid) {
-        this.uuid = uuid;
-    }
-
-    @Override
-    public boolean getArchived() {
-        return archived;
-    }
-
-    public void setArchived(Boolean archived) {
-        this.archived = archived;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/event/UsageEvent.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/event/UsageEvent.java b/core/src/com/cloud/event/UsageEvent.java
deleted file mode 100644
index 0d4ef17..0000000
--- a/core/src/com/cloud/event/UsageEvent.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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.event;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import java.util.Date;
-
-public interface UsageEvent extends InternalIdentity {
-    String getType();
-
-    Date getCreateDate();
-    long getAccountId();
-    Long getSize();
-    Long getTemplateId();
-    Long getOfferingId();
-    long getResourceId();
-    long getZoneId();
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/event/UsageEventVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/event/UsageEventVO.java b/core/src/com/cloud/event/UsageEventVO.java
deleted file mode 100644
index c92972b..0000000
--- a/core/src/com/cloud/event/UsageEventVO.java
+++ /dev/null
@@ -1,216 +0,0 @@
-// 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.event;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name="usage_event")
-public class UsageEventVO implements UsageEvent {
-	@Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-	private long id = -1;
-
-	@Column(name="type")
-	private String type;
-	
-	@Column(name=GenericDao.CREATED_COLUMN)
-	private Date createDate;
-
-	@Column(name="account_id")
-	private long accountId;
-
-    @Column(name="zone_id")
-	private long zoneId;
-
-    @Column(name="resource_id")
-    private long resourceId;
-
-    @Column(name="resource_name")
-    private String resourceName;
-    
-    @Column(name="offering_id")
-    private Long offeringId;
-    
-    @Column(name="template_id")
-    private Long templateId;
-
-    @Column(name="size")
-    private Long size;
-    
-    @Column(name="resource_type")
-    private String resourceType;
-    
-    @Column(name="processed")
-    boolean processed;
-
-    
-	public UsageEventVO() {
-	}
-	
-	public UsageEventVO(String usageType, long accountId, long zoneId, long resourceId, String resourceName, Long offeringId, Long templateId, Long size) {
-	    this.type = usageType;
-	    this.accountId = accountId;
-	    this.zoneId = zoneId;
-	    this.resourceId = resourceId;
-	    this.resourceName = resourceName;
-	    this.offeringId = offeringId;
-	    this.templateId = templateId;
-	    this.size = size;
-	}
-	
-    public UsageEventVO(String usageType, long accountId, long zoneId, long resourceId, String resourceName) {
-        this.type = usageType;
-        this.accountId = accountId;
-        this.zoneId = zoneId;
-        this.resourceId = resourceId;
-        this.resourceName = resourceName;
-    }
-	
-    //IPAddress usage event
-	public UsageEventVO(String usageType, long accountId, long zoneId, long ipAddressId, String ipAddress, boolean isSourceNat, String guestType, boolean isSystem) {
-	    this.type = usageType;
-        this.accountId = accountId;
-        this.zoneId = zoneId;
-        this.resourceId = ipAddressId;
-        this.resourceName = ipAddress;
-        this.size = (isSourceNat ? 1L : 0L);
-        this.resourceType = guestType;
-        this.templateId = (isSystem ? 1L : 0L);
-    }
-	
-	public UsageEventVO(String usageType, long accountId, long zoneId, long resourceId, String resourceName, Long offeringId, Long templateId, String resourceType) {
-	    this.type = usageType;
-	    this.accountId = accountId;
-	    this.zoneId = zoneId;
-	    this.resourceId = resourceId;
-	    this.resourceName = resourceName;
-	    this.offeringId = offeringId;
-	    this.templateId = templateId;
-	    this.resourceType = resourceType;
-	}
-	
-	//Security Group usage event
-	public UsageEventVO(String usageType, long accountId,
-			long zoneId, long vmId, long securityGroupId) {
-	    this.type = usageType;
-	    this.accountId = accountId;
-	    this.zoneId = zoneId;
-	    this.resourceId = vmId;
-	    this.offeringId = securityGroupId;
-	}
-
-	@Override
-    public long getId() {
-		return id;
-	}
-	@Override
-    public String getType() {
-		return type;
-	}
-	public void setType(String type) {
-		this.type = type;
-	}
-
-	@Override
-    public Date getCreateDate() {
-		return createDate;
-	}
-	public void setCreatedDate(Date createdDate) {
-	    createDate = createdDate;
-	}
-	
-    @Override
-    public long getAccountId() {
-        return accountId;
-    }
-    public void setAccountId(long accountId) {
-        this.accountId = accountId;
-    }
-
-    public void setZoneId(long zoneId) {
-        this.zoneId = zoneId;
-    }
-    @Override
-    public long getZoneId() {
-        return zoneId;
-    }
-
-    public void setResourceId(long resourceId) {
-        this.resourceId = resourceId;
-    }
-    @Override
-    public long getResourceId() {
-        return resourceId;
-    }
-    
-    public void setResourceName(String resourceName) {
-        this.resourceName = resourceName;
-    }
-
-    public String getResourceName() {
-        return resourceName;
-    }
-
-    public void setOfferingId(long offeringId) {
-        this.offeringId = offeringId;
-    }
-    @Override
-    public Long getOfferingId() {
-        return offeringId;
-    }
-
-    public void setTemplateId(long templateId) {
-        this.templateId = templateId;
-    }
-    @Override
-    public Long getTemplateId() {
-        return templateId;
-    }
-
-    public void setSize(long size) {
-        this.size = size;
-    }
-    @Override
-    public Long getSize() {
-        return size;
-    }
-
-    public boolean isProcessed() {
-        return processed;
-    }
-
-    public void setProcessed(boolean processed) {
-        this.processed = processed;
-    }
-    
-    public String getResourceType() {
-        return resourceType;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/event/dao/EventDao.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/event/dao/EventDao.java b/core/src/com/cloud/event/dao/EventDao.java
deleted file mode 100644
index da5f47a..0000000
--- a/core/src/com/cloud/event/dao/EventDao.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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.event.dao;
-
-import java.util.Date;
-import java.util.List;
-
-import com.cloud.event.EventVO;
-import com.cloud.utils.db.Filter;
-import com.cloud.utils.db.GenericDao;
-import com.cloud.utils.db.SearchCriteria;
-
-public interface EventDao extends GenericDao<EventVO, Long> {
-    public List<EventVO> searchAllEvents(SearchCriteria<EventVO> sc, Filter filter);
-
-    public List<EventVO> listOlderEvents(Date oldTime);
-
-    EventVO findCompletedEvent(long startId);
-
-    public List<EventVO> listToArchiveOrDeleteEvents(List<Long> ids, String type, Date olderThan, Long accountId);
-
-    public void archiveEvents(List<EventVO> events);
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/event/dao/EventDaoImpl.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/event/dao/EventDaoImpl.java b/core/src/com/cloud/event/dao/EventDaoImpl.java
deleted file mode 100644
index 6ba59c5..0000000
--- a/core/src/com/cloud/event/dao/EventDaoImpl.java
+++ /dev/null
@@ -1,109 +0,0 @@
-// 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.event.dao;
-
-import java.util.Date;
-import java.util.List;
-
-import javax.ejb.Local;
-
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import com.cloud.event.Event.State;
-import com.cloud.event.EventVO;
-import com.cloud.utils.db.Filter;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.Transaction;
-import com.cloud.utils.db.SearchCriteria.Op;
-
-@Component
-@Local(value={EventDao.class})
-public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements EventDao {
-    public static final Logger s_logger = Logger.getLogger(EventDaoImpl.class.getName());
-    protected final SearchBuilder<EventVO> CompletedEventSearch;
-    protected final SearchBuilder<EventVO> ToArchiveOrDeleteEventSearch;
-
-    public EventDaoImpl () {
-        CompletedEventSearch = createSearchBuilder();
-        CompletedEventSearch.and("state",CompletedEventSearch.entity().getState(),SearchCriteria.Op.EQ);
-        CompletedEventSearch.and("startId", CompletedEventSearch.entity().getStartId(), SearchCriteria.Op.EQ);
-        CompletedEventSearch.done();
-
-        ToArchiveOrDeleteEventSearch = createSearchBuilder();
-        ToArchiveOrDeleteEventSearch.and("id", ToArchiveOrDeleteEventSearch.entity().getId(), Op.IN);
-        ToArchiveOrDeleteEventSearch.and("type", ToArchiveOrDeleteEventSearch.entity().getType(), Op.EQ);
-        ToArchiveOrDeleteEventSearch.and("accountId", ToArchiveOrDeleteEventSearch.entity().getAccountId(), Op.EQ);
-        ToArchiveOrDeleteEventSearch.and("createDateL", ToArchiveOrDeleteEventSearch.entity().getCreateDate(), Op.LT);
-        ToArchiveOrDeleteEventSearch.done();
-    }
-
-    @Override
-    public List<EventVO> searchAllEvents(SearchCriteria<EventVO> sc, Filter filter) {
-        return listIncludingRemovedBy(sc, filter);
-    }
-
-    @Override
-    public List<EventVO> listOlderEvents(Date oldTime) {
-        if (oldTime == null) return null;
-        SearchCriteria<EventVO> sc = createSearchCriteria();
-        sc.addAnd("createDate", SearchCriteria.Op.LT, oldTime);
-        return listIncludingRemovedBy(sc, null);
-    }
-
-    @Override
-    public EventVO findCompletedEvent(long startId) {
-        SearchCriteria<EventVO> sc = CompletedEventSearch.create();
-        sc.setParameters("state", State.Completed);
-        sc.setParameters("startId", startId);
-        return findOneIncludingRemovedBy(sc);
-    }
-
-    @Override
-    public List<EventVO> listToArchiveOrDeleteEvents(List<Long> ids, String type, Date olderThan, Long accountId) {
-        SearchCriteria<EventVO> sc = ToArchiveOrDeleteEventSearch.create();
-        if (ids != null) {
-            sc.setParameters("id", ids.toArray(new Object[ids.size()]));
-        }
-        if (type != null) {
-            sc.setParameters("type", type);
-        }
-        if (olderThan != null) {
-            sc.setParameters("createDateL", olderThan);
-        }
-        if (accountId != null) {
-            sc.setParameters("accountId", accountId);
-        }
-        return search(sc, null);
-    }
-
-    @Override
-    public void archiveEvents(List<EventVO> events) {
-
-        Transaction txn = Transaction.currentTxn();
-        txn.start();
-        for (EventVO event : events) {
-            event = lockRow(event.getId(), true);
-            event.setArchived(true);
-            update(event.getId(), event);
-            txn.commit();
-        }
-        txn.close();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/event/dao/UsageEventDao.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/event/dao/UsageEventDao.java b/core/src/com/cloud/event/dao/UsageEventDao.java
deleted file mode 100644
index 52fa01d..0000000
--- a/core/src/com/cloud/event/dao/UsageEventDao.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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.event.dao;
-
-import java.util.Date;
-import java.util.List;
-
-import com.cloud.event.UsageEventVO;
-import com.cloud.exception.UsageServerException;
-import com.cloud.utils.db.GenericDao;
-
-public interface UsageEventDao extends GenericDao<UsageEventVO, Long> {
-    
-    public List<UsageEventVO> listLatestEvents(Date endDate);
-
-    public List<UsageEventVO> getLatestEvent();
-    
-    List<UsageEventVO> getRecentEvents(Date endDate) throws UsageServerException;
-
-    List<UsageEventVO> listDirectIpEvents(Date startDate, Date endDate, long zoneId);
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/event/dao/UsageEventDaoImpl.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/event/dao/UsageEventDaoImpl.java b/core/src/com/cloud/event/dao/UsageEventDaoImpl.java
deleted file mode 100644
index dafc8d4..0000000
--- a/core/src/com/cloud/event/dao/UsageEventDaoImpl.java
+++ /dev/null
@@ -1,187 +0,0 @@
-// 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.event.dao;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.util.Date;
-import java.util.List;
-import java.util.TimeZone;
-
-import javax.ejb.Local;
-
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import com.cloud.dc.Vlan;
-import com.cloud.event.EventTypes;
-import com.cloud.event.UsageEventVO;
-import com.cloud.exception.UsageServerException;
-import com.cloud.utils.DateUtil;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.Filter;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.Transaction;
-
-@Component
-@Local(value={UsageEventDao.class})
-public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implements UsageEventDao {
-    public static final Logger s_logger = Logger.getLogger(UsageEventDaoImpl.class.getName());
-
-    private final SearchBuilder<UsageEventVO> latestEventsSearch;
-    private final SearchBuilder<UsageEventVO> IpeventsSearch;
-    private static final String COPY_EVENTS = "INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type) " +
-    		"SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type FROM cloud.usage_event vmevt WHERE vmevt.id > ? and vmevt.id <= ? ";
-    private static final String COPY_ALL_EVENTS = "INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type) " +
-    		"SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type FROM cloud.usage_event vmevt WHERE vmevt.id <= ?";
-    private static final String MAX_EVENT = "select max(id) from cloud.usage_event where created <= ?";
-
-
-    public UsageEventDaoImpl () {
-        latestEventsSearch = createSearchBuilder();
-        latestEventsSearch.and("processed", latestEventsSearch.entity().isProcessed(), SearchCriteria.Op.EQ);
-        latestEventsSearch.and("enddate", latestEventsSearch.entity().getCreateDate(), SearchCriteria.Op.LTEQ);
-        latestEventsSearch.done();
-        
-        IpeventsSearch = createSearchBuilder();        
-        IpeventsSearch.and("startdate", IpeventsSearch.entity().getCreateDate(), SearchCriteria.Op.GTEQ);
-        IpeventsSearch.and("enddate", IpeventsSearch.entity().getCreateDate(), SearchCriteria.Op.LTEQ);
-        IpeventsSearch.and("zoneid", IpeventsSearch.entity().getZoneId(), SearchCriteria.Op.EQ);
-        IpeventsSearch.and("networktype", IpeventsSearch.entity().getResourceType(), SearchCriteria.Op.EQ);
-        IpeventsSearch.and().op("assignEvent", IpeventsSearch.entity().getType(), SearchCriteria.Op.EQ);
-        IpeventsSearch.or("releaseEvent", IpeventsSearch.entity().getType(), SearchCriteria.Op.EQ);
-        IpeventsSearch.closeParen();
-        IpeventsSearch.done();
-    }
-
-    @Override
-    public List<UsageEventVO> listLatestEvents(Date endDate) {
-        Filter filter = new Filter(UsageEventVO.class, "createDate", Boolean.TRUE, null, null);
-        SearchCriteria<UsageEventVO> sc = latestEventsSearch.create();
-        sc.setParameters("processed", false);
-        sc.setParameters("enddate", endDate);
-        return listBy(sc, filter);
-    }
-
-    @Override
-    public List<UsageEventVO> getLatestEvent() {
-        Filter filter = new Filter(UsageEventVO.class, "id", Boolean.FALSE, Long.valueOf(0), Long.valueOf(1));
-        return listAll(filter);
-    }
-    
-    @Override
-    @DB
-    public synchronized List<UsageEventVO> getRecentEvents(Date endDate) throws UsageServerException {
-        long recentEventId = getMostRecentEventId();
-        long maxEventId = getMaxEventId(endDate);
-        Transaction txn = Transaction.open(Transaction.USAGE_DB);
-        String sql = COPY_EVENTS;
-        if (recentEventId == 0) {
-            if (s_logger.isDebugEnabled()) {
-                s_logger.debug("no recent event date, copying all events");
-            }
-            sql = COPY_ALL_EVENTS;
-        }
-
-        PreparedStatement pstmt = null;
-        try {
-            txn.start();
-            pstmt = txn.prepareAutoCloseStatement(sql);
-            int i = 1;
-            if (recentEventId != 0) {
-                pstmt.setLong(i++, recentEventId);
-            }
-            pstmt.setLong(i++, maxEventId);
-            pstmt.executeUpdate();
-            txn.commit();
-            return findRecentEvents(endDate);
-        } catch (Exception ex) {
-            txn.rollback();
-            s_logger.error("error copying events from cloud db to usage db", ex);
-            throw new UsageServerException(ex.getMessage());
-        }
-    }
-
-    @DB
-    private long getMostRecentEventId() throws UsageServerException {
-        Transaction txn = Transaction.open(Transaction.USAGE_DB);
-        try {
-            List<UsageEventVO> latestEvents = getLatestEvent();
-
-            if(latestEvents !=null && latestEvents.size() == 1){
-                UsageEventVO latestEvent = latestEvents.get(0);
-                if(latestEvent != null){
-                    return latestEvent.getId();
-                }
-            }
-            return 0;
-        } catch (Exception ex) {
-            s_logger.error("error getting most recent event id", ex);
-            throw new UsageServerException(ex.getMessage());
-        } finally {
-            txn.close();
-        }
-    }
-
-    private List<UsageEventVO> findRecentEvents(Date endDate) throws UsageServerException {
-        Transaction txn = Transaction.open(Transaction.USAGE_DB);
-        try {
-            return listLatestEvents(endDate);
-        } catch (Exception ex) {
-            s_logger.error("error getting most recent event date", ex);
-            throw new UsageServerException(ex.getMessage());
-        } finally {
-            txn.close();
-        }
-    }
-    
-    private long getMaxEventId(Date endDate) throws UsageServerException {
-        Transaction txn = Transaction.currentTxn();
-        PreparedStatement pstmt = null;
-        try {
-            String sql = MAX_EVENT;
-            pstmt = txn.prepareAutoCloseStatement(sql);
-            pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), endDate));
-            ResultSet rs = pstmt.executeQuery();
-            if (rs.next()) {
-                return Long.valueOf(rs.getLong(1));
-            }
-            return 0;
-        } catch (Exception ex) {
-            s_logger.error("error getting max event id", ex);
-            throw new UsageServerException(ex.getMessage());
-        } finally {
-            txn.close();
-        }
-    }
-
-    @Override
-    public List<UsageEventVO> listDirectIpEvents(Date startDate, Date endDate, long zoneId) {
-        Filter filter = new Filter(UsageEventVO.class, "createDate", Boolean.TRUE, null, null);
-        SearchCriteria<UsageEventVO> sc = IpeventsSearch.create();
-        sc.setParameters("startdate", startDate);
-        sc.setParameters("enddate", endDate);
-        sc.setParameters("assignEvent", EventTypes.EVENT_NET_IP_ASSIGN);
-        sc.setParameters("releaseEvent", EventTypes.EVENT_NET_IP_RELEASE);
-        sc.setParameters("zoneid", zoneId);
-        sc.setParameters("networktype", Vlan.VlanType.DirectAttached.toString());
-        return listBy(sc, filter);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/exception/AgentControlChannelException.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/exception/AgentControlChannelException.java b/core/src/com/cloud/exception/AgentControlChannelException.java
deleted file mode 100644
index 50b84d4..0000000
--- a/core/src/com/cloud/exception/AgentControlChannelException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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.exception;
-
-import com.cloud.exception.CloudException;
-
-public class AgentControlChannelException extends CloudException {
-	private static final long serialVersionUID = -310647782960500466L;
-	
-	public AgentControlChannelException(String msg) {
-		super(msg);
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/host/DetailVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/host/DetailVO.java b/core/src/com/cloud/host/DetailVO.java
deleted file mode 100644
index 4e62490..0000000
--- a/core/src/com/cloud/host/DetailVO.java
+++ /dev/null
@@ -1,73 +0,0 @@
-// 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.host;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name="host_details")
-public class DetailVO implements InternalIdentity {
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private long id;
-    
-    @Column(name="host_id")
-    private long hostId;
-    
-    @Column(name="name")
-    private String name;
-    
-    @Column(name="value")
-    private String value;
-    
-    protected DetailVO() {
-    }
-    
-    public DetailVO(long hostId, String name, String value) {
-        this.hostId = hostId;
-        this.name = name;
-        this.value = value;
-    }
-
-    public long getHostId() {
-        return hostId;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public void setValue(String value) {
-        this.value = value;
-    }
-
-    public long getId() {
-        return id;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/host/HostTagVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/host/HostTagVO.java b/core/src/com/cloud/host/HostTagVO.java
deleted file mode 100644
index b1f5ace..0000000
--- a/core/src/com/cloud/host/HostTagVO.java
+++ /dev/null
@@ -1,65 +0,0 @@
-// 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.host;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name="host_tags")
-public class HostTagVO implements InternalIdentity {
-	@Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    private long id;
-    
-    @Column(name="host_id")
-    private long hostId;
-    
-    @Column(name="tag")
-    private String tag;
-    
-    protected HostTagVO() {
-    }
-    
-    public HostTagVO(long hostId, String tag) {
-        this.hostId = hostId;
-        this.tag = tag;
-    }
-
-    public long getHostId() {
-        return hostId;
-    }
-
-    public String getTag() {
-        return tag;
-    }
-
-    public void setTag(String tag) {
-        this.tag = tag;
-    }
-
-    public long getId() {
-        return id;
-    }
-}


[09/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkVO.java b/engine/schema/src/com/cloud/network/dao/NetworkVO.java
new file mode 100644
index 0000000..9b0eec5
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkVO.java
@@ -0,0 +1,552 @@
+// 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.network.dao;
+
+import java.net.URI;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+import javax.persistence.Transient;
+
+import org.apache.cloudstack.acl.ControlledEntity;
+
+import com.cloud.network.Network;
+import com.cloud.network.Networks.BroadcastDomainType;
+import com.cloud.network.Networks.Mode;
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.net.NetUtils;
+
+/**
+ * NetworkConfigurationVO contains information about a specific network.
+ *
+ */
+@Entity
+@Table(name="networks")
+public class NetworkVO implements Network {
+    @Id
+    @TableGenerator(name="networks_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="networks_seq", allocationSize=1)
+    @Column(name="id")
+    long id;
+
+    @Column(name="mode")
+    @Enumerated(value=EnumType.STRING)
+    Mode mode;
+
+    @Column(name="broadcast_domain_type")
+    @Enumerated(value=EnumType.STRING)
+    BroadcastDomainType broadcastDomainType;
+
+    @Column(name="traffic_type")
+    @Enumerated(value=EnumType.STRING)
+    TrafficType trafficType;
+
+    @Column(name="name")
+    String name;
+
+    @Column(name="display_text")
+    String displayText;;
+
+    @Column(name="broadcast_uri")
+    URI broadcastUri;
+
+    @Column(name="gateway")
+    String gateway;
+
+    @Column(name="cidr")
+    String cidr;
+
+    @Column(name="network_cidr")
+    String networkCidr;
+
+    @Column(name="network_offering_id")
+    long networkOfferingId;
+
+    @Column(name="vpc_id")
+    Long vpcId;
+
+    @Column(name="physical_network_id")
+    Long physicalNetworkId;
+
+    @Column(name="data_center_id")
+    long dataCenterId;
+
+    @Column(name="related")
+    long related;
+
+    @Column(name="guru_name")
+    String guruName;
+
+    @Column(name="state")
+    @Enumerated(value=EnumType.STRING)
+    State state;
+
+    @Column(name="dns1")
+    String dns1;
+
+    @Column(name="domain_id")
+    long domainId;
+
+    @Column(name="account_id")
+    long accountId;
+
+    @Column(name="set_fields")
+    long setFields;
+
+    @TableGenerator(name="mac_address_seq", table="op_networks", pkColumnName="id", valueColumnName="mac_address_seq", allocationSize=1)
+    @Transient
+    long macAddress = 1;
+
+    @Column(name="guru_data", length=1024)
+    String guruData;
+
+    @Column(name="dns2")
+    String dns2;
+
+    @Column(name="network_domain")
+    String networkDomain;
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    Date removed;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    Date created;
+
+    @Column(name="reservation_id")
+    String reservationId;
+
+    @Column(name="uuid")
+    String uuid;
+
+    @Column(name="guest_type")
+    @Enumerated(value=EnumType.STRING)
+    Network.GuestType guestType;
+
+    @Column(name="acl_type")
+    @Enumerated(value=EnumType.STRING)
+    ControlledEntity.ACLType aclType;
+
+    @Column(name="restart_required")
+    boolean restartRequired = false;
+
+    @Column(name="specify_ip_ranges")
+    boolean specifyIpRanges = false;
+
+    @Column(name="ip6_gateway")
+    String ip6Gateway;
+
+    @Column(name="ip6_cidr")
+    String ip6Cidr;
+
+    @Column(name="display_network", updatable=true, nullable=false)
+    protected boolean displayNetwork = true;
+
+    public NetworkVO() {
+    	this.uuid = UUID.randomUUID().toString();
+    }
+
+    /**
+     * Constructor to be used for the adapters because it only initializes what's needed.
+     * @param trafficType
+     * @param mode
+     * @param broadcastDomainType
+     * @param networkOfferingId
+     * @param state TODO
+     * @param dataCenterId
+     * @param physicalNetworkId TODO
+     */
+    public NetworkVO(TrafficType trafficType, Mode mode, BroadcastDomainType broadcastDomainType, long networkOfferingId,
+            State state, long dataCenterId, Long physicalNetworkId) {
+        this.trafficType = trafficType;
+        this.mode = mode;
+        this.broadcastDomainType = broadcastDomainType;
+        this.networkOfferingId = networkOfferingId;
+        this.dataCenterId = dataCenterId;
+        this.physicalNetworkId = physicalNetworkId;
+        if (state == null) {
+            state = State.Allocated;
+        } else {
+            this.state = state;
+        }
+        this.id = -1;
+    	this.uuid = UUID.randomUUID().toString();
+    }
+
+    public NetworkVO(long id, Network that, long offeringId, String guruName, long domainId, long accountId,
+            long related, String name, String displayText, String networkDomain, GuestType guestType, long dcId,
+            Long physicalNetworkId, ACLType aclType, boolean specifyIpRanges, Long vpcId) {
+        this(id, that.getTrafficType(), that.getMode(), that.getBroadcastDomainType(), offeringId, domainId, accountId,
+                related, name, displayText, networkDomain, guestType, dcId, physicalNetworkId, aclType, specifyIpRanges, vpcId);
+        this.gateway = that.getGateway();
+        this.cidr = that.getCidr();
+        this.networkCidr = that.getNetworkCidr();
+        this.broadcastUri = that.getBroadcastUri();
+        this.broadcastDomainType = that.getBroadcastDomainType();
+        this.guruName = guruName;
+        this.state = that.getState();
+        if (state == null) {
+            state = State.Allocated;
+        }
+    	this.uuid = UUID.randomUUID().toString();
+    	this.ip6Gateway = that.getIp6Gateway();
+    	this.ip6Cidr = that.getIp6Cidr();
+    }
+
+    /**
+     * Constructor for the actual DAO object.
+     * @param trafficType
+     * @param mode
+     * @param broadcastDomainType
+     * @param networkOfferingId
+     * @param domainId
+     * @param accountId
+     * @param name
+     * @param displayText
+     * @param networkDomain
+     * @param guestType TODO
+     * @param aclType TODO
+     * @param specifyIpRanges TODO
+     * @param vpcId TODO
+     * @param dataCenterId
+     */
+    public NetworkVO(long id, TrafficType trafficType, Mode mode, BroadcastDomainType broadcastDomainType,
+            long networkOfferingId, long domainId, long accountId, long related, String name, String displayText,
+            String networkDomain, GuestType guestType, long dcId, Long physicalNetworkId, ACLType aclType, boolean specifyIpRanges, Long vpcId) {
+        this(trafficType, mode, broadcastDomainType, networkOfferingId, State.Allocated, dcId, physicalNetworkId);
+        this.domainId = domainId;
+        this.accountId = accountId;
+        this.related = related;
+        this.id = id;
+        this.name = name;
+        this.displayText = displayText;
+        this.aclType = aclType;
+        this.networkDomain = networkDomain;
+    	this.uuid = UUID.randomUUID().toString();
+        this.guestType = guestType;
+        this.specifyIpRanges = specifyIpRanges;
+        this.vpcId = vpcId;
+    }
+
+    @Override
+    public String getReservationId() {
+        return reservationId;
+    }
+
+    public void setReservationId(String reservationId) {
+        this.reservationId = reservationId;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    // don't use this directly when possible, use Network state machine instead
+    public void setState(State state) {
+        this.state = state;
+    }
+
+    @Override
+    public long getRelated() {
+        return related;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public Mode getMode() {
+        return mode;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public long getNetworkOfferingId() {
+        return networkOfferingId;
+    }
+
+    public void setNetworkOfferingId(long networkOfferingId) {
+        this.networkOfferingId = networkOfferingId;
+    }
+
+    public void setMode(Mode mode) {
+        this.mode = mode;
+    }
+
+    @Override
+    public BroadcastDomainType getBroadcastDomainType() {
+        return broadcastDomainType;
+    }
+
+    public String getGuruData() {
+        return guruData;
+    }
+
+    public void setGuruData(String guruData) {
+        this.guruData = guruData;
+    }
+
+    public String getGuruName() {
+        return guruName;
+    }
+
+    public void setGuruName(String guruName) {
+        this.guruName = guruName;
+    }
+
+    public void setBroadcastDomainType(BroadcastDomainType broadcastDomainType) {
+        this.broadcastDomainType = broadcastDomainType;
+    }
+
+    @Override
+    public String getNetworkDomain() {
+        return networkDomain;
+    }
+
+    public void setNetworkDomain(String networkDomain) {
+        this.networkDomain = networkDomain;
+    }
+
+    @Override
+    public TrafficType getTrafficType() {
+        return trafficType;
+    }
+
+    public void setTrafficType(TrafficType trafficType) {
+        this.trafficType = trafficType;
+    }
+
+    @Override
+    public String getGateway() {
+        return gateway;
+    }
+
+    public void setGateway(String gateway) {
+        this.gateway = gateway;
+    }
+    // "cidr" is the Cloudstack managed address space, all CloudStack managed vms get IP address from "cidr"
+    // In general "cidr" also serves as the network cidr
+    // But in case IP reservation feature is configured for a Guest network, "network_cidr" is the Effective network cidr for the network,
+    //  "cidr" will still continue to be the effective address space for CloudStack managed vms in that Guest network
+    @Override
+    public String getCidr() {
+        return cidr;
+    }
+
+    public void setCidr(String cidr) {
+        this.cidr = cidr;
+    }
+
+    // "networkcidr" is the network CIDR of the guest network which is configured with IP reservation feature
+    // It is the summation of "cidr" and the reservedIPrange(the address space used for non cloudstack purposes.)
+    //  For networks not using IP reservation "networkcidr" is always null
+    @Override
+    public String getNetworkCidr() {
+        return networkCidr;
+    }
+
+    public void setNetworkCidr(String networkCidr) {
+        this.networkCidr = networkCidr;
+    }
+
+    @Override
+    public URI getBroadcastUri() {
+        return broadcastUri;
+    }
+
+    public void setBroadcastUri(URI broadcastUri) {
+        this.broadcastUri = broadcastUri;
+    }
+
+    @Override
+    public int hashCode() {
+        return NumbersUtil.hash(id);
+    }
+
+    @Override
+    public Long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    @Override
+    public void setPhysicalNetworkId(Long physicalNetworkId) {
+        this.physicalNetworkId = physicalNetworkId;
+    }
+
+    @Override
+    public long getDataCenterId() {
+        return dataCenterId;
+    }
+
+    public String getDns1() {
+        return dns1;
+    }
+
+    public void setDns1(String dns) {
+        this.dns1 = dns;
+    }
+
+    public String getDns2() {
+        return dns2;
+    }
+
+    public void setDns2(String dns) {
+        this.dns2 = dns;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String getDisplayText() {
+        return displayText;
+    }
+
+    public void setDisplayText(String displayText) {
+        this.displayText = displayText;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public void setRemoved(Date removed) {
+        this.removed = removed;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public void setCreated(Date created) {
+        this.created = created;
+    }
+
+    @Override
+    public Network.GuestType getGuestType() {
+        return guestType;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof NetworkVO)) {
+            return false;
+        }
+        NetworkVO that = (NetworkVO)obj;
+        if (this.trafficType != that.trafficType) {
+            return false;
+        }
+
+        if ((this.cidr == null && that.cidr != null) || (this.cidr != null && that.cidr == null)) {
+            return false;
+        }
+
+        if (this.cidr == null && that.cidr == null) {
+            return true;
+        }
+
+        return NetUtils.isNetworkAWithinNetworkB(this.cidr, that.cidr);
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder buf = new StringBuilder("Ntwk[");
+        buf.append(id).append("|").append(trafficType).append("|").append(networkOfferingId).append("]");
+        return buf.toString();
+    }
+
+    public String getUuid() {
+    	return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+
+	public ControlledEntity.ACLType getAclType() {
+		return aclType;
+	}
+
+	public void setRestartRequired(boolean restartRequired) {
+		this.restartRequired = restartRequired;
+	}
+
+	@Override
+	public boolean isRestartRequired() {
+		return restartRequired;
+	}
+
+    @Override
+    public boolean getSpecifyIpRanges() {
+    	return specifyIpRanges;
+    }
+
+    @Override
+    public Long getVpcId() {
+        return vpcId;
+    }
+
+	public String getIp6Cidr() {
+		return ip6Cidr;
+	}
+
+	public void setIp6Cidr(String ip6Cidr) {
+		this.ip6Cidr = ip6Cidr;
+	}
+
+	public String getIp6Gateway() {
+		return ip6Gateway;
+	}
+
+	public void setIp6Gateway(String ip6Gateway) {
+		this.ip6Gateway = ip6Gateway;
+	}
+
+    @Override()
+    public boolean getDisplayNetwork() {
+        return displayNetwork;
+    }
+
+    public void setDisplayNetwork(boolean displayNetwork) {
+        this.displayNetwork = displayNetwork;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/PhysicalNetworkDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkDao.java b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkDao.java
new file mode 100644
index 0000000..891fbfd
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkDao.java
@@ -0,0 +1,28 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.utils.db.GenericDao;
+
+public interface PhysicalNetworkDao extends GenericDao<PhysicalNetworkVO, Long> {
+    List<PhysicalNetworkVO> listByZone(long zoneId);
+    List<PhysicalNetworkVO> listByZoneIncludingRemoved(long zoneId);
+    List<PhysicalNetworkVO> listByZoneAndTrafficType(long dataCenterId, TrafficType trafficType);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/PhysicalNetworkDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkDaoImpl.java b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkDaoImpl.java
new file mode 100644
index 0000000..1e26a51
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkDaoImpl.java
@@ -0,0 +1,79 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+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;
+
+@Component
+@Local(value=PhysicalNetworkDao.class) @DB(txn=false)
+public class PhysicalNetworkDaoImpl extends GenericDaoBase<PhysicalNetworkVO, Long> implements PhysicalNetworkDao {
+    final SearchBuilder<PhysicalNetworkVO> ZoneSearch;
+
+    @Inject protected PhysicalNetworkTrafficTypeDao _trafficTypeDao;
+
+    protected PhysicalNetworkDaoImpl() {
+        super();
+        ZoneSearch = createSearchBuilder();
+        ZoneSearch.and("dataCenterId", ZoneSearch.entity().getDataCenterId(), Op.EQ);
+        ZoneSearch.done();
+    }
+
+    @Override
+    public List<PhysicalNetworkVO> listByZone(long zoneId) {
+        SearchCriteria<PhysicalNetworkVO> sc = ZoneSearch.create();
+        sc.setParameters("dataCenterId", zoneId);
+        return search(sc, null);
+    }
+
+    @Override
+    public List<PhysicalNetworkVO> listByZoneIncludingRemoved(long zoneId) {
+        SearchCriteria<PhysicalNetworkVO> sc = ZoneSearch.create();
+        sc.setParameters("dataCenterId", zoneId);
+        return listIncludingRemovedBy(sc);
+    }
+
+    @Override
+    public List<PhysicalNetworkVO> listByZoneAndTrafficType(long dataCenterId, TrafficType trafficType) {
+
+        SearchBuilder<PhysicalNetworkTrafficTypeVO> trafficTypeSearch = _trafficTypeDao.createSearchBuilder();
+        PhysicalNetworkTrafficTypeVO trafficTypeEntity = trafficTypeSearch.entity();
+        trafficTypeSearch.and("trafficType", trafficTypeSearch.entity().getTrafficType(), SearchCriteria.Op.EQ);
+
+        SearchBuilder<PhysicalNetworkVO> pnSearch = createSearchBuilder();
+        pnSearch.and("dataCenterId", pnSearch.entity().getDataCenterId(), Op.EQ);
+        pnSearch.join("trafficTypeSearch", trafficTypeSearch, pnSearch.entity().getId(), trafficTypeEntity.getPhysicalNetworkId(), JoinBuilder.JoinType.INNER);
+
+        SearchCriteria<PhysicalNetworkVO> sc = pnSearch.create();
+        sc.setJoinParameters("trafficTypeSearch", "trafficType", trafficType);
+        sc.setParameters("dataCenterId", dataCenterId);
+
+        return listBy(sc);  
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodDaoImpl.java b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodDaoImpl.java
new file mode 100644
index 0000000..04508e7
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodDaoImpl.java
@@ -0,0 +1,70 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+public class PhysicalNetworkIsolationMethodDaoImpl extends GenericDaoBase<PhysicalNetworkIsolationMethodVO, Long> implements GenericDao<PhysicalNetworkIsolationMethodVO, Long> {
+    private final GenericSearchBuilder<PhysicalNetworkIsolationMethodVO, String> IsolationMethodSearch;
+    private final SearchBuilder<PhysicalNetworkIsolationMethodVO> AllFieldsSearch;
+
+    protected PhysicalNetworkIsolationMethodDaoImpl() {
+        super();
+        IsolationMethodSearch = createSearchBuilder(String.class);
+        IsolationMethodSearch.selectField(IsolationMethodSearch.entity().getIsolationMethod());
+        IsolationMethodSearch.and("physicalNetworkId", IsolationMethodSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        IsolationMethodSearch.done();
+
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ);
+        AllFieldsSearch.and("physicalNetworkId", AllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        AllFieldsSearch.and("isolationMethod", AllFieldsSearch.entity().getIsolationMethod(), Op.EQ);
+        AllFieldsSearch.done();
+    }
+
+    public List<String> getAllIsolationMethod(long physicalNetworkId) {
+        SearchCriteria<String> sc = IsolationMethodSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+
+        return customSearch(sc, null);
+    }
+
+    public String getIsolationMethod(long physicalNetworkId) {
+        SearchCriteria<String> sc = IsolationMethodSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+
+        return customSearch(sc, null).get(0);
+    }
+    
+    public int clearIsolationMethods(long physicalNetworkId) {
+        SearchCriteria<PhysicalNetworkIsolationMethodVO> sc = AllFieldsSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+
+        return remove(sc);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodVO.java b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodVO.java
new file mode 100644
index 0000000..5996704
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodVO.java
@@ -0,0 +1,68 @@
+// 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.network.dao;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ * 
+ */
+@Entity
+@Table(name = "physical_network_isolation_methods")
+public class PhysicalNetworkIsolationMethodVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "physical_network_id")
+    private long physicalNetworkId;
+
+    @Column(name = "isolation_method")
+    private String isolationMethod;
+
+    /**
+     * There should never be a public constructor for this class. Since it's
+     * only here to define the table for the DAO class.
+     */
+    protected PhysicalNetworkIsolationMethodVO() {
+    }
+
+    protected PhysicalNetworkIsolationMethodVO(long physicalNetworkId, String isolationMethod) {
+        this.physicalNetworkId = physicalNetworkId;
+        this.isolationMethod = isolationMethod;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public String getIsolationMethod() {
+        return isolationMethod;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/PhysicalNetworkServiceProviderDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkServiceProviderDao.java b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkServiceProviderDao.java
new file mode 100644
index 0000000..9e0ba17
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkServiceProviderDao.java
@@ -0,0 +1,28 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface PhysicalNetworkServiceProviderDao extends GenericDao<PhysicalNetworkServiceProviderVO, Long> {
+    List<PhysicalNetworkServiceProviderVO> listBy(long physicalNetworkId);
+    PhysicalNetworkServiceProviderVO findByServiceProvider(long physicalNetworkId, String providerType);
+    void deleteProviders(long physicalNetworkId);
+    boolean isServiceProviderEnabled(long physicalNetworkId, String providerType, String serviceType);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/PhysicalNetworkServiceProviderDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkServiceProviderDaoImpl.java b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkServiceProviderDaoImpl.java
new file mode 100644
index 0000000..16a23dd
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkServiceProviderDaoImpl.java
@@ -0,0 +1,131 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.Network.Service;
+import com.cloud.network.PhysicalNetworkServiceProvider;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value=PhysicalNetworkServiceProviderDao.class) @DB(txn=false)
+public class PhysicalNetworkServiceProviderDaoImpl extends GenericDaoBase<PhysicalNetworkServiceProviderVO, Long> implements PhysicalNetworkServiceProviderDao {
+    final SearchBuilder<PhysicalNetworkServiceProviderVO> physicalNetworkSearch;
+    final SearchBuilder<PhysicalNetworkServiceProviderVO> physicalNetworkServiceProviderSearch;
+    final SearchBuilder<PhysicalNetworkServiceProviderVO> AllFieldsSearch;
+
+    protected PhysicalNetworkServiceProviderDaoImpl() {
+        super();
+        physicalNetworkSearch = createSearchBuilder();
+        physicalNetworkSearch.and("physicalNetworkId", physicalNetworkSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        physicalNetworkSearch.done();
+
+        physicalNetworkServiceProviderSearch = createSearchBuilder();
+        physicalNetworkServiceProviderSearch.and("physicalNetworkId", physicalNetworkServiceProviderSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        physicalNetworkServiceProviderSearch.and("serviceProvderType", physicalNetworkServiceProviderSearch.entity().getProviderName(), Op.EQ);
+        physicalNetworkServiceProviderSearch.done();
+        
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("physicalNetworkId", AllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        AllFieldsSearch.and("serviceProvderType", AllFieldsSearch.entity().getProviderName(), Op.EQ);
+        AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ);
+        AllFieldsSearch.and("vpnService", AllFieldsSearch.entity().isVpnServiceProvided(), Op.EQ);
+        AllFieldsSearch.and("dhcpService", AllFieldsSearch.entity().isDhcpServiceProvided(), Op.EQ);
+        AllFieldsSearch.and("dnsService", AllFieldsSearch.entity().isDnsServiceProvided(), Op.EQ);
+        AllFieldsSearch.and("gatewayService", AllFieldsSearch.entity().isGatewayServiceProvided(), Op.EQ);
+        AllFieldsSearch.and("firewallService", AllFieldsSearch.entity().isFirewallServiceProvided(), Op.EQ);
+        AllFieldsSearch.and("sourceNatService", AllFieldsSearch.entity().isSourcenatServiceProvided(), Op.EQ);
+        AllFieldsSearch.and("lbService", AllFieldsSearch.entity().isLbServiceProvided(), Op.EQ);
+        AllFieldsSearch.and("staticNatService", AllFieldsSearch.entity().isStaticnatServiceProvided(), Op.EQ);
+        AllFieldsSearch.and("pfService", AllFieldsSearch.entity().isPortForwardingServiceProvided(), Op.EQ);
+        AllFieldsSearch.and("userDataService", AllFieldsSearch.entity().isUserdataServiceProvided(), Op.EQ);
+        AllFieldsSearch.and("securityGroupService", AllFieldsSearch.entity().isSecuritygroupServiceProvided(), Op.EQ);
+        AllFieldsSearch.done();
+    }
+
+    @Override
+    public List<PhysicalNetworkServiceProviderVO> listBy(long physicalNetworkId) {
+        SearchCriteria<PhysicalNetworkServiceProviderVO> sc = physicalNetworkSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        return search(sc, null);
+    }
+
+    @Override
+    public PhysicalNetworkServiceProviderVO findByServiceProvider(long physicalNetworkId, String providerType) {
+        SearchCriteria<PhysicalNetworkServiceProviderVO> sc = physicalNetworkServiceProviderSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("serviceProvderType", providerType);
+        return findOneBy(sc);
+    }
+    
+    @Override
+    public void deleteProviders(long physicalNetworkId) {
+        SearchCriteria<PhysicalNetworkServiceProviderVO> sc = physicalNetworkSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        remove(sc);
+    }
+    
+    @Override
+    public boolean isServiceProviderEnabled(long physicalNetworkId, String providerType, String serviceType) {
+    	 SearchCriteria<PhysicalNetworkServiceProviderVO> sc = AllFieldsSearch.create();
+         sc.setParameters("physicalNetworkId", physicalNetworkId);
+         sc.setParameters("serviceProvderType", providerType);
+         sc.setParameters("state", PhysicalNetworkServiceProvider.State.Enabled.toString());
+         
+         if (serviceType.equalsIgnoreCase(Service.Dhcp.getName())) {
+             sc.setParameters("dhcpService", true);
+         } else if (serviceType.equalsIgnoreCase(Service.Dns.getName())) {
+             sc.setParameters("dnsService", true);
+         }else if (serviceType.equalsIgnoreCase(Service.Firewall.getName())) {
+             sc.setParameters("firewallService", true);
+         }else if (serviceType.equalsIgnoreCase(Service.Gateway.getName())) {
+             sc.setParameters("gatewayService", true);
+         }else if (serviceType.equalsIgnoreCase(Service.Lb.getName())) {
+             sc.setParameters("lbService", true);
+         }else if (serviceType.equalsIgnoreCase(Service.PortForwarding.getName())) {
+             sc.setParameters("pfService", true);
+         }else if (serviceType.equalsIgnoreCase(Service.SecurityGroup.getName())) {
+             sc.setParameters("securityGroupService", true);
+         }else if (serviceType.equalsIgnoreCase(Service.SourceNat.getName())) {
+             sc.setParameters("sourceNatService", true);
+         }else if (serviceType.equalsIgnoreCase(Service.StaticNat.getName())) {
+             sc.setParameters("staticNatService", true);
+         }else if (serviceType.equalsIgnoreCase(Service.UserData.getName())) {
+             sc.setParameters("userDataService", true);
+         }else if (serviceType.equalsIgnoreCase(Service.Vpn.getName())) {
+             sc.setParameters("vpnService", true);
+         }
+         
+         PhysicalNetworkServiceProviderVO map = findOneBy(sc);
+
+         if (map != null) {
+        	 return true;
+         } else {
+        	 return false;
+         }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/PhysicalNetworkServiceProviderVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkServiceProviderVO.java b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkServiceProviderVO.java
new file mode 100644
index 0000000..370e498
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkServiceProviderVO.java
@@ -0,0 +1,322 @@
+// 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.network.dao;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.network.Network.Service;
+import com.cloud.network.PhysicalNetworkServiceProvider;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = "physical_network_service_providers")
+public class PhysicalNetworkServiceProviderVO implements PhysicalNetworkServiceProvider, InternalIdentity {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+    
+    @Column(name="uuid")
+    private String uuid; 
+
+    @Column(name = "physical_network_id")
+    private long physicalNetworkId;
+    
+    @Column(name = "destination_physical_network_id")
+    private long destPhysicalNetworkId;    
+
+    @Column(name = "provider_name")
+    private String providerName;
+
+    @Column(name="state")
+    @Enumerated(value=EnumType.STRING)
+    State state;
+    
+    @Column(name = "vpn_service_provided")
+    boolean vpnServiceProvided;
+
+    @Column(name = "dhcp_service_provided")
+    boolean dhcpServiceProvided;
+    
+    @Column(name = "dns_service_provided")
+    boolean dnsServiceProvided;
+    
+    @Column(name = "gateway_service_provided")
+    boolean gatewayServiceProvided;
+    
+    @Column(name = "firewall_service_provided")
+    boolean firewallServiceProvided;
+    
+    @Column(name = "source_nat_service_provided")
+    boolean sourcenatServiceProvided;
+    
+    @Column(name = "load_balance_service_provided")
+    boolean lbServiceProvided;
+    
+    @Column(name = "static_nat_service_provided")
+    boolean staticnatServiceProvided;
+    
+    @Column(name = "port_forwarding_service_provided")
+    boolean portForwardingServiceProvided;
+    
+    @Column(name = "user_data_service_provided")
+    boolean userdataServiceProvided;
+    
+    @Column(name = "security_group_service_provided")
+    boolean securitygroupServiceProvided;
+    
+    @Column(name = "networkacl_service_provided")
+    boolean networkAclServiceProvided;
+    
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    Date removed;
+    
+    public PhysicalNetworkServiceProviderVO() {
+    }
+
+    public PhysicalNetworkServiceProviderVO(long physicalNetworkId, String name) {
+        this.physicalNetworkId = physicalNetworkId;
+        this.providerName = name;
+        this.state = State.Disabled;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+
+    @Override
+    public State getState() {
+        return state;
+    }
+    
+    @Override
+    public void setState(State state) {
+        this.state = state;
+    }    
+
+    @Override
+    public String getProviderName() {
+        return providerName;
+    }
+
+    public void setDestinationPhysicalNetworkId(long destPhysicalNetworkId) {
+        this.destPhysicalNetworkId = destPhysicalNetworkId;
+    }
+    
+    @Override
+    public long getDestinationPhysicalNetworkId() {
+        return destPhysicalNetworkId;
+    }
+    
+    @Override
+    public boolean isVpnServiceProvided() {
+        return vpnServiceProvided;
+    }
+
+    public void setVpnServiceProvided(boolean vpnServiceProvided) {
+        this.vpnServiceProvided = vpnServiceProvided;
+    }
+
+    @Override
+    public boolean isDhcpServiceProvided() {
+        return dhcpServiceProvided;
+    }
+
+    public void setDhcpServiceProvided(boolean dhcpServiceProvided) {
+        this.dhcpServiceProvided = dhcpServiceProvided;
+    }
+
+    @Override
+    public boolean isDnsServiceProvided() {
+        return dnsServiceProvided;
+    }
+
+    public void setDnsServiceProvided(boolean dnsServiceProvided) {
+        this.dnsServiceProvided = dnsServiceProvided;
+    }
+
+    @Override
+    public boolean isGatewayServiceProvided() {
+        return gatewayServiceProvided;
+    }
+
+    public void setGatewayServiceProvided(boolean gatewayServiceProvided) {
+        this.gatewayServiceProvided = gatewayServiceProvided;
+    }
+
+    @Override
+    public boolean isFirewallServiceProvided() {
+        return firewallServiceProvided;
+    }
+
+    public void setFirewallServiceProvided(boolean firewallServiceProvided) {
+        this.firewallServiceProvided = firewallServiceProvided;
+    }
+
+    @Override
+    public boolean isSourcenatServiceProvided() {
+        return sourcenatServiceProvided;
+    }
+
+    public void setSourcenatServiceProvided(boolean sourcenatServiceProvided) {
+        this.sourcenatServiceProvided = sourcenatServiceProvided;
+    }
+
+    @Override
+    public boolean isLbServiceProvided() {
+        return lbServiceProvided;
+    }
+
+    public void setLbServiceProvided(boolean lbServiceProvided) {
+        this.lbServiceProvided = lbServiceProvided;
+    }
+
+    public boolean isStaticnatServiceProvided() {
+        return staticnatServiceProvided;
+    }
+
+    public void setStaticnatServiceProvided(boolean staticnatServiceProvided) {
+        this.staticnatServiceProvided = staticnatServiceProvided;
+    }
+
+    public boolean isPortForwardingServiceProvided() {
+        return portForwardingServiceProvided;
+    }
+
+    public void setPortForwardingServiceProvided(boolean portForwardingServiceProvided) {
+        this.portForwardingServiceProvided = portForwardingServiceProvided;
+    }
+
+    @Override
+    public boolean isUserdataServiceProvided() {
+        return userdataServiceProvided;
+    }
+
+    public void setUserdataServiceProvided(boolean userdataServiceProvided) {
+        this.userdataServiceProvided = userdataServiceProvided;
+    }
+
+    @Override
+    public boolean isSecuritygroupServiceProvided() {
+        return securitygroupServiceProvided;
+    }
+
+    public void setSecuritygroupServiceProvided(boolean securitygroupServiceProvided) {
+        this.securitygroupServiceProvided = securitygroupServiceProvided;
+    }
+    
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+    
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+    
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public void setRemoved(Date removed) {
+        this.removed = removed;
+    }
+    
+    public void setEnabledServices(List<Service> services){
+        this.setVpnServiceProvided(services.contains(Service.Vpn));
+        this.setDhcpServiceProvided(services.contains(Service.Dhcp));
+        this.setDnsServiceProvided(services.contains(Service.Dns));
+        this.setGatewayServiceProvided(services.contains(Service.Gateway));
+        this.setFirewallServiceProvided(services.contains(Service.Firewall));
+        this.setLbServiceProvided(services.contains(Service.Lb));
+        this.setSourcenatServiceProvided(services.contains(Service.SourceNat));
+        this.setStaticnatServiceProvided(services.contains(Service.StaticNat));
+        this.setPortForwardingServiceProvided(services.contains(Service.PortForwarding));
+        this.setUserdataServiceProvided(services.contains(Service.UserData));
+        this.setSecuritygroupServiceProvided(services.contains(Service.SecurityGroup));
+        this.setNetworkAclServiceProvided(services.contains(Service.NetworkACL));
+    }
+    
+    @Override
+    public List<Service> getEnabledServices(){
+        List<Service> services = new ArrayList<Service>();
+        if(this.isVpnServiceProvided()){
+            services.add(Service.Vpn);
+        }
+        if(this.isDhcpServiceProvided()){
+            services.add(Service.Dhcp);
+        }
+        if(this.isDnsServiceProvided()){
+            services.add(Service.Dns);
+        }
+        if(this.isGatewayServiceProvided()){
+            services.add(Service.Gateway);
+        }
+        if(this.isFirewallServiceProvided()){
+            services.add(Service.Firewall);
+        }
+        if(this.isLbServiceProvided()){
+            services.add(Service.Lb);
+        }
+        if(this.sourcenatServiceProvided){
+            services.add(Service.SourceNat);
+        }
+        if(this.staticnatServiceProvided){
+            services.add(Service.StaticNat);
+        }
+        if(this.portForwardingServiceProvided){
+            services.add(Service.PortForwarding);
+        }
+        if(this.isUserdataServiceProvided()){
+            services.add(Service.UserData);
+        }
+        if(this.isSecuritygroupServiceProvided()){
+            services.add(Service.SecurityGroup);
+        }
+        return services;
+    }
+    
+    @Override
+    public boolean isNetworkAclServiceProvided() {
+        return networkAclServiceProvided;
+    }
+
+    public void setNetworkAclServiceProvided(boolean networkAclServiceProvided) {
+        this.networkAclServiceProvided = networkAclServiceProvided;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTagDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTagDaoImpl.java b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTagDaoImpl.java
new file mode 100644
index 0000000..c3e9f73
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTagDaoImpl.java
@@ -0,0 +1,63 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+public class PhysicalNetworkTagDaoImpl extends GenericDaoBase<PhysicalNetworkTagVO, Long> implements GenericDao<PhysicalNetworkTagVO, Long> {
+    private final GenericSearchBuilder<PhysicalNetworkTagVO, String> TagSearch;
+    private final SearchBuilder<PhysicalNetworkTagVO> AllFieldsSearch;
+
+    protected PhysicalNetworkTagDaoImpl() {
+        super();
+        TagSearch = createSearchBuilder(String.class);
+        TagSearch.selectField(TagSearch.entity().getTag());
+        TagSearch.and("physicalNetworkId", TagSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        TagSearch.done();
+
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ);
+        AllFieldsSearch.and("physicalNetworkId", AllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        AllFieldsSearch.and("tag", AllFieldsSearch.entity().getTag(), Op.EQ);
+        AllFieldsSearch.done();
+    }
+
+    public List<String> getTags(long physicalNetworkId) {
+        SearchCriteria<String> sc = TagSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+
+        return customSearch(sc, null);
+    }
+
+    public int clearTags(long physicalNetworkId) {
+        SearchCriteria<PhysicalNetworkTagVO> sc = AllFieldsSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+
+        return remove(sc);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTagVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTagVO.java b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTagVO.java
new file mode 100644
index 0000000..787c049
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTagVO.java
@@ -0,0 +1,68 @@
+// 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.network.dao;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ * 
+ */
+@Entity
+@Table(name = "physical_network_tags")
+public class PhysicalNetworkTagVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "physical_network_id")
+    private long physicalNetworkId;
+
+    @Column(name = "tag")
+    private String tag;
+
+    /**
+     * There should never be a public constructor for this class. Since it's
+     * only here to define the table for the DAO class.
+     */
+    protected PhysicalNetworkTagVO() {
+    }
+
+    protected PhysicalNetworkTagVO(long physicalNetworkId, String tag) {
+        this.physicalNetworkId = physicalNetworkId;
+        this.tag = tag;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public String getTag() {
+        return tag;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDao.java b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDao.java
new file mode 100644
index 0000000..42e5b4e
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDao.java
@@ -0,0 +1,33 @@
+// 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.network.dao;
+
+
+import java.util.List;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.GenericDao;
+
+public interface PhysicalNetworkTrafficTypeDao extends GenericDao<PhysicalNetworkTrafficTypeVO, Long> {
+    Pair<List<PhysicalNetworkTrafficTypeVO>, Integer> listAndCountBy(long physicalNetworkId);
+    boolean isTrafficTypeSupported(long physicalNetworkId, TrafficType trafficType);
+    String getNetworkTag (long physicalNetworkId, TrafficType trafficType, HypervisorType hType);
+    PhysicalNetworkTrafficTypeVO findBy(long physicalNetworkId, TrafficType trafficType);
+    void deleteTrafficTypes(long physicalNetworkId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java
new file mode 100755
index 0000000..7e47239
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java
@@ -0,0 +1,143 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value=PhysicalNetworkTrafficTypeDao.class) @DB(txn=false)
+public class PhysicalNetworkTrafficTypeDaoImpl extends GenericDaoBase<PhysicalNetworkTrafficTypeVO, Long> implements PhysicalNetworkTrafficTypeDao {
+    final SearchBuilder<PhysicalNetworkTrafficTypeVO> physicalNetworkSearch;
+    final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> kvmAllFieldsSearch;
+    final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> xenAllFieldsSearch;
+    final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> vmWareAllFieldsSearch;
+    final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> simulatorAllFieldsSearch;
+    final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> ovmAllFieldsSearch;
+
+    protected PhysicalNetworkTrafficTypeDaoImpl() {
+        super();
+        physicalNetworkSearch = createSearchBuilder();
+        physicalNetworkSearch.and("physicalNetworkId", physicalNetworkSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        physicalNetworkSearch.and("trafficType", physicalNetworkSearch.entity().getTrafficType(), Op.EQ);
+        physicalNetworkSearch.done();
+
+        kvmAllFieldsSearch = createSearchBuilder(String.class);
+        kvmAllFieldsSearch.and("physicalNetworkId", kvmAllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        kvmAllFieldsSearch.and("trafficType", kvmAllFieldsSearch.entity().getTrafficType(), Op.EQ);
+        kvmAllFieldsSearch.selectField(kvmAllFieldsSearch.entity().getKvmNetworkLabel());
+        kvmAllFieldsSearch.done();
+
+        xenAllFieldsSearch = createSearchBuilder(String.class);
+        xenAllFieldsSearch.and("physicalNetworkId", xenAllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        xenAllFieldsSearch.and("trafficType", xenAllFieldsSearch.entity().getTrafficType(), Op.EQ);
+        xenAllFieldsSearch.selectField(xenAllFieldsSearch.entity().getXenNetworkLabel());
+        xenAllFieldsSearch.done();
+
+        vmWareAllFieldsSearch = createSearchBuilder(String.class);
+        vmWareAllFieldsSearch.and("physicalNetworkId", vmWareAllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        vmWareAllFieldsSearch.and("trafficType", vmWareAllFieldsSearch.entity().getTrafficType(), Op.EQ);
+        vmWareAllFieldsSearch.selectField(vmWareAllFieldsSearch.entity().getVmwareNetworkLabel());
+        vmWareAllFieldsSearch.done();
+        
+        simulatorAllFieldsSearch = createSearchBuilder(String.class);
+        simulatorAllFieldsSearch.and("physicalNetworkId", simulatorAllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        simulatorAllFieldsSearch.and("trafficType", simulatorAllFieldsSearch.entity().getTrafficType(), Op.EQ);
+        simulatorAllFieldsSearch.selectField(simulatorAllFieldsSearch.entity().getSimulatorNetworkLabel());
+        simulatorAllFieldsSearch.done();
+        
+        ovmAllFieldsSearch = createSearchBuilder(String.class);
+        ovmAllFieldsSearch.and("physicalNetworkId", ovmAllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        ovmAllFieldsSearch.and("trafficType", ovmAllFieldsSearch.entity().getTrafficType(), Op.EQ);
+        ovmAllFieldsSearch.selectField(ovmAllFieldsSearch.entity().getSimulatorNetworkLabel());
+        ovmAllFieldsSearch.done();
+    }
+
+    @Override
+    public Pair<List<PhysicalNetworkTrafficTypeVO>, Integer> listAndCountBy(long physicalNetworkId) {
+        SearchCriteria<PhysicalNetworkTrafficTypeVO> sc = physicalNetworkSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        return searchAndCount(sc, null);
+    }
+
+    @Override
+    public boolean isTrafficTypeSupported(long physicalNetworkId, TrafficType trafficType){
+        SearchCriteria<PhysicalNetworkTrafficTypeVO> sc = physicalNetworkSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("trafficType", trafficType);
+        if (findOneBy(sc) != null) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public String getNetworkTag(long physicalNetworkId, TrafficType trafficType, HypervisorType hType) {
+        SearchCriteria<String> sc = null;
+        if (hType == HypervisorType.XenServer) {
+            sc = xenAllFieldsSearch.create();
+        } else if (hType == HypervisorType.KVM) {
+            sc = kvmAllFieldsSearch.create();
+        } else if (hType == HypervisorType.VMware) {
+            sc = vmWareAllFieldsSearch.create();
+        } else if (hType == HypervisorType.Simulator) {
+        	sc = simulatorAllFieldsSearch.create();
+        } else if (hType == HypervisorType.Ovm) {
+        	sc = ovmAllFieldsSearch.create();
+        } else if (hType == HypervisorType.BareMetal) {
+        	return null;
+        } else {
+            assert(false) : "We don't handle this hypervisor type";
+            return null;
+        }
+
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("trafficType", trafficType);
+        List<String> tag = customSearch(sc, null);
+
+        return tag.size() == 0 ? null : tag.get(0);
+    }
+
+    @Override
+    public PhysicalNetworkTrafficTypeVO findBy(long physicalNetworkId, TrafficType trafficType){
+        SearchCriteria<PhysicalNetworkTrafficTypeVO> sc = physicalNetworkSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        sc.setParameters("trafficType", trafficType);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public void deleteTrafficTypes(long physicalNetworkId) {
+        SearchCriteria<PhysicalNetworkTrafficTypeVO> sc = physicalNetworkSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        remove(sc);        
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeVO.java b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeVO.java
new file mode 100644
index 0000000..4c32d0a
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeVO.java
@@ -0,0 +1,149 @@
+// 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.network.dao;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.network.PhysicalNetworkTrafficType;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = "physical_network_traffic_types")
+public class PhysicalNetworkTrafficTypeVO implements PhysicalNetworkTrafficType {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+    
+    @Column(name="uuid")
+    private String uuid;   
+
+    @Column(name = "physical_network_id")
+    private long physicalNetworkId;
+    
+    @Column(name="traffic_type")
+    @Enumerated(value=EnumType.STRING)
+    TrafficType trafficType;
+
+    @Column(name = "xen_network_label")
+    private String xenNetworkLabel;
+
+    @Column(name = "kvm_network_label")
+    private String kvmNetworkLabel;
+
+    @Column(name = "vmware_network_label")
+    private String vmwareNetworkLabel;
+
+    @Column(name = "simulator_network_label")
+    private String simulatorNetworkLabel;
+    
+    @Column(name = "vlan")
+    private String vlan;
+    
+    public PhysicalNetworkTrafficTypeVO() {
+    }
+
+    public PhysicalNetworkTrafficTypeVO(long physicalNetworkId, TrafficType trafficType, String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan) {
+        this.physicalNetworkId = physicalNetworkId;
+        this.trafficType = trafficType;
+        this.xenNetworkLabel = xenLabel;
+        this.kvmNetworkLabel = kvmLabel;
+        this.vmwareNetworkLabel = vmwareLabel;
+        this.simulatorNetworkLabel = simulatorLabel;
+        this.setVlan(vlan);
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    @Override
+    public TrafficType getTrafficType() {
+        return trafficType;
+    }
+    
+    public void setXenNetworkLabel(String xenNetworkLabel) {
+        this.xenNetworkLabel = xenNetworkLabel;
+    }
+
+    @Override
+    public String getXenNetworkLabel() {
+        return xenNetworkLabel;
+    }
+
+    public void setKvmNetworkLabel(String kvmNetworkLabel) {
+        this.kvmNetworkLabel = kvmNetworkLabel;
+    }
+
+    @Override
+    public String getKvmNetworkLabel() {
+        return kvmNetworkLabel;
+    }
+
+    public void setVmwareNetworkLabel(String vmwareNetworkLabel) {
+        this.vmwareNetworkLabel = vmwareNetworkLabel;
+    }
+    
+    @Override
+    public String getVmwareNetworkLabel() {
+    	return vmwareNetworkLabel;
+    }
+
+	public void setSimulatorNetworkLabel(String simulatorNetworkLabel) {
+		this.simulatorNetworkLabel = simulatorNetworkLabel;
+	}
+	
+	@Override
+	public String getSimulatorNetworkLabel() {
+		return simulatorNetworkLabel;
+	}
+
+    public void setVlan(String vlan) {
+        this.vlan = vlan;
+    }
+
+    public String getVlan() {
+        return vlan;
+    }  
+    
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+    
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/PhysicalNetworkVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/PhysicalNetworkVO.java b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkVO.java
new file mode 100644
index 0000000..f68eee1
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/PhysicalNetworkVO.java
@@ -0,0 +1,246 @@
+// 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.network.dao;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+import javax.persistence.CollectionTable;
+import javax.persistence.Column;
+import javax.persistence.ElementCollection;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+import com.cloud.network.PhysicalNetwork;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.GenericDao;
+
+/**
+ * NetworkConfigurationVO contains information about a specific physical network.
+ *
+ */
+@Entity
+@Table(name="physical_network")
+public class PhysicalNetworkVO implements PhysicalNetwork {
+    @Id
+    @TableGenerator(name="physical_networks_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="physical_networks_seq", allocationSize=1)
+    @Column(name="id")
+    long id;
+    
+    @Column(name="uuid")
+    private String uuid;
+    
+	@Column(name="name")
+	private String name;
+
+    @Column(name="data_center_id")
+    long dataCenterId;
+
+    @Column(name="vnet")
+    private String vnet = null;
+    
+    @Column(name="speed")
+    private String speed = null;
+    
+    @Column(name="domain_id")
+    Long domainId = null;
+
+    @Column(name="broadcast_domain_range")
+    @Enumerated(value=EnumType.STRING)
+    BroadcastDomainRange broadcastDomainRange;
+
+    @Column(name="state")
+    @Enumerated(value=EnumType.STRING)
+    State state;
+    
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    Date removed;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    Date created;
+
+    @ElementCollection(targetClass = String.class, fetch=FetchType.EAGER)
+    @Column(name="tag")
+    @CollectionTable(name="physical_network_tags", joinColumns=@JoinColumn(name="physical_network_id"))
+    List<String> tags;
+    
+    @ElementCollection(targetClass = String.class, fetch=FetchType.EAGER)
+    @Column(name="isolation_method")
+    @CollectionTable(name="physical_network_isolation_methods", joinColumns=@JoinColumn(name="physical_network_id"))
+    List<String> isolationMethods;
+
+    public PhysicalNetworkVO(){
+        
+    }
+    
+    public PhysicalNetworkVO(long id, long dataCenterId, String vnet, String speed, Long domainId, BroadcastDomainRange broadcastDomainRange, String name) {
+        this.dataCenterId = dataCenterId;
+        this.setVnet(vnet);
+        this.setSpeed(speed);
+        this.domainId = domainId;
+        if(broadcastDomainRange != null){
+            this.broadcastDomainRange = broadcastDomainRange;
+        }else{
+            this.broadcastDomainRange = BroadcastDomainRange.POD;
+        }
+        this.state = State.Disabled;
+        this.uuid = UUID.randomUUID().toString();
+        this.name = name;
+        this.id = id;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    public void setState(State state) {
+        this.state = state;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public List<String> getTags() {
+        return tags != null ? tags : new ArrayList<String>();
+    }
+
+    public void addTag(String tag) {
+        if (tags == null) {
+            tags = new ArrayList<String>();
+        }
+        tags.add(tag);
+    }
+
+    public void setTags(List<String> tags) {
+        this.tags = tags;
+    }
+
+    @Override
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public BroadcastDomainRange getBroadcastDomainRange() {
+        return broadcastDomainRange;
+    }
+
+    public void setBroadcastDomainRange(BroadcastDomainRange broadcastDomainRange) {
+        this.broadcastDomainRange = broadcastDomainRange;
+    }
+
+    @Override
+    public int hashCode() {
+        return NumbersUtil.hash(id);
+    }
+
+    @Override
+    public long getDataCenterId() {
+        return dataCenterId;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public void setRemoved(Date removed) {
+        this.removed = removed;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public void setCreated(Date created) {
+        this.created = created;
+    }
+
+    @Override
+    public List<String> getIsolationMethods() {
+        return isolationMethods != null ? isolationMethods : new ArrayList<String>();
+    }
+    
+    public void addIsolationMethod(String isolationMethod) {
+        if (isolationMethods == null) {
+            isolationMethods = new ArrayList<String>();
+        }
+        isolationMethods.add(isolationMethod);
+    }
+
+    public void setIsolationMethods(List<String> isolationMethods) {
+        this.isolationMethods = isolationMethods;
+    }
+
+    public void setVnet(String vnet) {
+        this.vnet = vnet;
+    }
+
+    @Override
+    public List<Pair<Integer, Integer>> getVnet() {
+        List <Pair<Integer,Integer>>  vnetList = new ArrayList<Pair<Integer, Integer>>();
+        if (vnet != null) {
+           String [] Temp = vnet.split(";");
+           String [] vnetSplit = null;
+           for (String vnetRange : Temp){
+               vnetSplit = vnetRange.split("-");
+               vnetList.add(new Pair<Integer,Integer>(Integer.parseInt(vnetSplit[0]),Integer.parseInt(vnetSplit[1])));
+           }
+        }
+        return vnetList;
+    }
+
+    @Override
+    public String getVnetString() {
+        return vnet;
+    }
+
+    public void setSpeed(String speed) {
+        this.speed = speed;
+    }
+
+    @Override
+    public String getSpeed() {
+        return speed;
+    }
+    
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+    
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    @Override
+	public String getName() {
+		return name;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/PortProfileDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/PortProfileDao.java b/engine/schema/src/com/cloud/network/dao/PortProfileDao.java
new file mode 100644
index 0000000..5ecd8f4
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/PortProfileDao.java
@@ -0,0 +1,50 @@
+// 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.network.dao;
+
+import java.util.List;
+import com.cloud.utils.db.GenericDao;
+
+public interface PortProfileDao extends GenericDao<PortProfileVO, Long> {
+
+    /**
+     * Return a Port Profile VO (db record) given its name.
+     */
+    PortProfileVO findByName(String portProfileName);
+    
+    /*
+     * Returns true if there already is any portprofile that trunks
+     * vlan IDs in a specified range.
+     */
+    boolean doesVlanRangeClash(int lowVlanId, int highVlanId);
+    
+    /*
+     * Return a list of port profiles that have the specified access vlanID.
+     */
+    List<PortProfileVO> listByVlanId(int vlanId);
+    
+    /**
+     * Other candidate functions that could be helpful.
+     * 
+     * List all portprofiles configured with a particular id.
+     * List<PortProfileVO> listByVlanId(int vlanId);
+     * 
+     * List all uplink portprofiles (these represent physical ports).
+     * List<PortProfileVO> listAllUplinkPortProfiles();	// we may have to provide some filter, like clusterId or zoneId or something.
+     * 
+     */
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/PortProfileDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/PortProfileDaoImpl.java b/engine/schema/src/com/cloud/network/dao/PortProfileDaoImpl.java
new file mode 100644
index 0000000..61fe52a
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/PortProfileDaoImpl.java
@@ -0,0 +1,89 @@
+// 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.network.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.List;
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Component
+@Local(value=PortProfileDao.class) @DB(txn=false)
+public class PortProfileDaoImpl extends GenericDaoBase<PortProfileVO, Long> implements PortProfileDao {
+	protected static final Logger s_logger     = Logger.getLogger(PortProfileDaoImpl.class);
+	
+    final SearchBuilder<PortProfileVO> nameSearch;
+    final SearchBuilder<PortProfileVO> accessVlanSearch;
+    
+    public PortProfileDaoImpl() {    	
+        super();
+        
+        nameSearch = createSearchBuilder();
+        nameSearch.and("portProfileName", nameSearch.entity().getPortProfileName(), Op.EQ);
+        nameSearch.done();
+        
+        accessVlanSearch = createSearchBuilder();
+        accessVlanSearch.and("accessVlanId", accessVlanSearch.entity().getAccessVlanId(), Op.EQ);
+        accessVlanSearch.done();
+    }
+    
+    public PortProfileVO findByName(String portProfileName) {
+    	SearchCriteria<PortProfileVO> sc = nameSearch.create();
+    	sc.setParameters("portProfileName", portProfileName);
+    	return findOneBy(sc);
+    }
+    
+    @DB
+    public boolean doesVlanRangeClash(int lowVlanId, int highVlanId) {
+    	String dbName = "cloud";
+    	String tableName = "port_profile";
+    	String condition = "(trunk_low_vlan_id BETWEEN " + lowVlanId + " AND " + highVlanId + ")" + " OR (trunk_high_vlan_id BETWEEN " + lowVlanId + " AND " + highVlanId + ")";
+    	String selectSql = "SELECT * FROM `" + dbName + "`.`" + tableName + "` WHERE " + condition;
+
+        Transaction txn = Transaction.currentTxn();
+        try {
+            PreparedStatement stmt = txn.prepareAutoCloseStatement(selectSql);
+            ResultSet rs = stmt.executeQuery();
+            if (rs != null && rs.next()) {
+            	// There are records that contain vlans in this range, so return true
+            	return true;
+            }
+        } catch (SQLException ex) {
+            throw new CloudRuntimeException("Failed to execute SQL query to check for vlan range clash");
+        }
+        return false;
+    }
+    
+    public List<PortProfileVO> listByVlanId(int vlanId) {
+    	SearchCriteria<PortProfileVO> sc = accessVlanSearch.create();
+    	sc.setParameters("accessVlanId", vlanId);
+    	return search(sc, null);
+    }
+    
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/PortProfileVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/PortProfileVO.java b/engine/schema/src/com/cloud/network/dao/PortProfileVO.java
new file mode 100644
index 0000000..6227348
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/PortProfileVO.java
@@ -0,0 +1,204 @@
+// 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.network.dao;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import com.cloud.exception.InvalidParameterValueException;
+import org.apache.cloudstack.api.InternalIdentity;
+
+/**
+ * PortProfileVO contains information on portprofiles that are created on a Cisco Nexus 1000v VSM associated
+ * with a VMWare cluster. 
+ */
+
+@Entity
+@Table(name="port_profile")
+public class PortProfileVO implements InternalIdentity {
+	
+	// We need to know what properties a VSM has. Put them here.
+	
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    @Column(name = "port_profile_name")
+    private String portProfileName;
+
+    @Column(name = "port_mode")
+    private PortMode portMode;
+    
+    @Column(name = "vsm_id")
+    private long vsmId;
+
+    @Column(name = "trunk_low_vlan_id")
+    private int lowVlanId;
+    
+    @Column(name = "trunk_high_vlan_id")
+    private int highVlanId;
+    
+    @Column(name = "access_vlan_id")
+    private int accessVlanId;
+    
+    @Column(name = "port_type")
+    private PortType portType;
+    
+    @Column(name = "port_binding")
+    private BindingType portBinding;
+
+    public enum BindingType {
+    	Static,
+    	Ephemeral
+    }
+    
+    public enum PortType {
+    	Ethernet,
+    	vEthernet
+    }
+    
+    // This tells us whether the port trunks multiple VLANs
+    // or carries traffic of a single VLAN.
+    public enum PortMode {
+    	Access,
+    	Trunk
+    }
+
+    // Accessor methods
+    public long getId() {
+        return id;
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    public String getPortProfileName() {
+    	return portProfileName;
+    }
+    
+    public PortMode getPortMode() {
+    	return portMode;
+    }
+    
+    public long getVsmId() {
+    	return vsmId;
+    }
+    
+    public int getLowVlanId() {
+    	return lowVlanId;
+    }
+    
+    public int getHighVlanId() {
+    	return highVlanId;
+    }
+    
+    public int getAccessVlanId() {
+    	return accessVlanId;
+    }
+    
+    public PortType getPortType() {
+    	return portType;
+    }
+    
+    public BindingType getPortBinding() {
+    	return portBinding;
+    }
+    
+    // Setter methods
+
+    public void setPortProfileName(String name) {
+    	portProfileName = name;
+    }
+    
+    public void setPortMode(PortMode mode) {
+    	portMode = mode;
+    }
+    
+    public void setVsmId(long id) {
+    	vsmId = id;
+    }
+    
+    public void setLowVlanId(int vlanId) {
+    	lowVlanId = vlanId;
+    }
+    
+    public void setHighVlanId(int vlanId) {
+    	highVlanId = vlanId;
+    }
+    
+    public void setAccessVlanId(int vlanId) {
+    	accessVlanId = vlanId;
+    }
+    
+    public void setPortType(PortType type) {
+    	portType = type;
+    }
+    
+    public void setPortBinding(BindingType bindingType) {
+    	portBinding = bindingType;
+    }
+
+    // Constructor methods.
+    
+    public PortProfileVO(String portProfName, long vsmId, int vlanId, PortType pType, BindingType bType) {
+    	// Set the relevant portprofile properties here.
+    	// When supplied with a single vlanId, we set this portprofile as an access port profile.
+    	
+    	this.setPortMode(PortMode.Access);
+    	
+        this.uuid = UUID.randomUUID().toString();
+        this.setPortProfileName(portProfName);
+        this.setVsmId(vsmId);
+        this.setAccessVlanId(vlanId);
+        this.setPortType(pType);
+        this.setPortBinding(bType);
+    }
+    
+    public PortProfileVO(String portProfName, long vsmId, int lowVlanId, int highVlanId, PortType pType, BindingType bType) {
+    	// Set the relevant portprofile properties here.
+    	// When supplied with a vlan range, we set this portprofile as a trunk port profile.
+    	
+    	if (lowVlanId >= highVlanId) {
+    		throw new InvalidParameterValueException("Low Vlan Id cannot be greater than or equal to high Vlan Id");
+    	}
+    	this.setPortMode(PortMode.Trunk);
+    	
+        this.uuid = UUID.randomUUID().toString();
+        this.setPortProfileName(portProfName);
+        this.setVsmId(vsmId);
+        this.setLowVlanId(lowVlanId);
+        this.setHighVlanId(highVlanId);
+        this.setPortType(pType);
+        this.setPortBinding(bType);
+    }    
+    
+    public PortProfileVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }    
+}


[43/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/vm/UserVmService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/UserVmService.java b/api/src/com/cloud/vm/UserVmService.java
index 2ccd19d..0a0660a 100755
--- a/api/src/com/cloud/vm/UserVmService.java
+++ b/api/src/com/cloud/vm/UserVmService.java
@@ -459,8 +459,8 @@ public interface UserVmService {
 
     VirtualMachine vmStorageMigration(Long vmId, StoragePool destPool);
 
-    UserVm restoreVM(RestoreVMCmd cmd);
+    UserVm restoreVM(RestoreVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException;
 
-    UserVm upgradeVirtualMachine(ScaleVMCmd scaleVMCmd) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
+    boolean upgradeVirtualMachine(ScaleVMCmd scaleVMCmd) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/vm/VirtualMachine.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VirtualMachine.java b/api/src/com/cloud/vm/VirtualMachine.java
index 8f807d4..ce9add6 100755
--- a/api/src/com/cloud/vm/VirtualMachine.java
+++ b/api/src/com/cloud/vm/VirtualMachine.java
@@ -186,6 +186,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
         SecondaryStorageVm,
         ElasticIpVm,
         ElasticLoadBalancerVm,
+        InternalLoadBalancerVm,
 
         /*
          * UserBareMetal is only used for selecting VirtualMachineGuru, there is no
@@ -196,7 +197,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
         public static boolean isSystemVM(VirtualMachine.Type vmtype) {
             if (DomainRouter.equals(vmtype)
                     || ConsoleProxy.equals(vmtype)
-                    || SecondaryStorageVm.equals(vmtype)) {
+                    || SecondaryStorageVm.equals(vmtype) || InternalLoadBalancerVm.equals(vmtype)) {
                 return true;
             }
             return false;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/vm/VirtualMachineName.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VirtualMachineName.java b/api/src/com/cloud/vm/VirtualMachineName.java
new file mode 100755
index 0000000..81838b9
--- /dev/null
+++ b/api/src/com/cloud/vm/VirtualMachineName.java
@@ -0,0 +1,190 @@
+// 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;
+
+import java.util.Formatter;
+
+import com.cloud.dc.Vlan;
+
+/**
+ * VM Name. 
+ */
+public class VirtualMachineName {
+    public static final String SEPARATOR = "-";
+    
+    public static String getVnetName(long vnetId) {
+        StringBuilder vnet = new StringBuilder();
+        Formatter formatter = new Formatter(vnet);
+        formatter.format("%04x", vnetId);
+        return vnet.toString();
+    }
+    
+    public static boolean isValidVmName(String vmName) {
+        return isValidVmName(vmName, null);
+    }
+    
+    public static boolean isValidVmName(String vmName, String instance) {
+        String[] tokens = vmName.split(SEPARATOR);
+        /*Some vms doesn't have vlan/vnet id*/
+        if (tokens.length != 5 && tokens.length != 4) {
+            return false;
+        }
+
+        if (!tokens[0].equals("i")) {
+            return false;
+        }
+        
+        try {
+            Long.parseLong(tokens[1]);
+            Long.parseLong(tokens[2]);
+            if (tokens.length == 5 && !Vlan.UNTAGGED.equalsIgnoreCase(tokens[4])) {
+            	Long.parseLong(tokens[4], 16);
+            }
+        } catch (NumberFormatException e) {
+            return false;
+        }
+        
+        return instance == null || instance.equals(tokens[3]);
+    }
+    
+    public static String getVmName(long vmId, long userId, String instance) {
+        StringBuilder vmName = new StringBuilder("i");
+        vmName.append(SEPARATOR).append(userId).append(SEPARATOR).append(vmId);
+        vmName.append(SEPARATOR).append(instance);
+        return vmName.toString();
+    }
+    
+    public static long getVmId(String vmName) {
+        int begin = vmName.indexOf(SEPARATOR);
+        begin = vmName.indexOf(SEPARATOR, begin + SEPARATOR.length());
+        int end = vmName.indexOf(SEPARATOR, begin + SEPARATOR.length());
+        return Long.parseLong(vmName.substring(begin + 1, end));
+    }
+    
+    public static long getRouterId(String routerName) {
+        int begin = routerName.indexOf(SEPARATOR);
+        int end = routerName.indexOf(SEPARATOR, begin + SEPARATOR.length());
+        return Long.parseLong(routerName.substring(begin + 1, end));
+    }
+    
+    public static long getConsoleProxyId(String vmName) {
+        int begin = vmName.indexOf(SEPARATOR);
+        int end = vmName.indexOf(SEPARATOR, begin + SEPARATOR.length());
+        return Long.parseLong(vmName.substring(begin + 1, end));
+    }
+    
+    public static long getSystemVmId(String vmName) {
+        int begin = vmName.indexOf(SEPARATOR);
+        int end = vmName.indexOf(SEPARATOR, begin + SEPARATOR.length());
+        return Long.parseLong(vmName.substring(begin + 1, end));
+    }
+    
+    public static String getVnet(String vmName) {
+        return vmName.substring(vmName.lastIndexOf(SEPARATOR) + SEPARATOR.length());
+    }
+    
+    public static String getRouterName(long routerId, String instance) {
+        StringBuilder builder = new StringBuilder("r");
+        builder.append(SEPARATOR).append(routerId).append(SEPARATOR).append(instance);
+        return builder.toString();
+    }
+    
+    public static String getConsoleProxyName(long vmId, String instance) {
+        StringBuilder builder = new StringBuilder("v");
+        builder.append(SEPARATOR).append(vmId).append(SEPARATOR).append(instance);
+        return builder.toString();
+    }
+    
+    public static String getSystemVmName(long vmId, String instance, String prefix) {
+        StringBuilder builder = new StringBuilder(prefix);
+        builder.append(SEPARATOR).append(vmId).append(SEPARATOR).append(instance);
+        return builder.toString();
+    }
+    
+    public static String attachVnet(String name, String vnet) {
+        return name + SEPARATOR + vnet;
+    }
+    
+    public static boolean isValidRouterName(String name) {
+        return isValidRouterName(name, null);
+    }
+    
+    public static boolean isValidRouterName(String name, String instance) {
+        String[] tokens = name.split(SEPARATOR);
+        if (tokens.length != 3 && tokens.length != 4 ) {
+            return false;
+        }
+        
+        if (!tokens[0].equals("r")) {
+            return false;
+        }
+        
+        try {
+            Long.parseLong(tokens[1]);
+        } catch (NumberFormatException ex) {
+            return false;
+        }
+        
+        return instance == null || tokens[2].equals(instance);
+    }
+    
+    public static boolean isValidConsoleProxyName(String name) {
+    	return isValidConsoleProxyName(name, null);
+    }
+    
+    public static boolean isValidConsoleProxyName(String name, String instance) {
+        String[] tokens = name.split(SEPARATOR);
+        if (tokens.length != 3) {
+            return false;
+        }
+        
+        if (!tokens[0].equals("v")) {
+            return false;
+        }
+        
+        try {
+            Long.parseLong(tokens[1]);
+        } catch (NumberFormatException ex) {
+            return false;
+        }
+        
+        return instance == null || tokens[2].equals(instance);
+    }
+    
+    public static boolean isValidSecStorageVmName(String name, String instance) {
+    	return isValidSystemVmName(name, instance, "s");
+    }
+    
+    public static boolean isValidSystemVmName(String name, String instance, String prefix) {
+        String[] tokens = name.split(SEPARATOR);
+        if (tokens.length != 3) {
+            return false;
+        }
+        
+        if (!tokens[0].equals(prefix)) {
+            return false;
+        }
+        
+        try {
+            Long.parseLong(tokens[1]);
+        } catch (NumberFormatException ex) {
+            return false;
+        }
+        
+        return instance == null || tokens[2].equals(instance);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/com/cloud/vm/VmDetailConstants.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VmDetailConstants.java b/api/src/com/cloud/vm/VmDetailConstants.java
new file mode 100644
index 0000000..5ff3ce0
--- /dev/null
+++ b/api/src/com/cloud/vm/VmDetailConstants.java
@@ -0,0 +1,24 @@
+// 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;
+
+public interface VmDetailConstants {
+	public static final String KEYBOARD = "keyboard";
+	public static final String NIC_ADAPTER = "nicAdapter";
+	public static final String ROOK_DISK_CONTROLLER = "rootDiskController";
+	public static final String NESTED_VIRTUALIZATION_FLAG = "nestedVirtualizationFlag";
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index 4eca1c4..822791d 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -90,6 +90,7 @@ public class ApiConstants {
     public static final String GSLB_SERVICE_TYPE = "gslbservicetype";
     public static final String GSLB_STICKY_SESSION_METHOD = "gslbstickysessionmethodname";
     public static final String GUEST_CIDR_ADDRESS = "guestcidraddress";
+    public static final String GUEST_VLAN_RANGE = "guestvlanrange";
     public static final String HA_ENABLE = "haenable";
     public static final String HOST_ID = "hostid";
     public static final String HOST_NAME = "hostname";
@@ -226,6 +227,7 @@ public class ApiConstants {
     public static final String VIRTUAL_MACHINE_ID = "virtualmachineid";
     public static final String VIRTUAL_MACHINE_IDS = "virtualmachineids";
     public static final String VLAN = "vlan";
+    public static final String VLAN_RANGE = "vlanrange";
     public static final String REMOVE_VLAN="removevlan";
     public static final String VLAN_ID = "vlanid";
     public static final String VM_AVAILABLE = "vmavailable";
@@ -483,6 +485,12 @@ public class ApiConstants {
     public static final String HEALTHCHECK_HEALTHY_THRESHOLD = "healthythreshold";
     public static final String HEALTHCHECK_UNHEALTHY_THRESHOLD = "unhealthythreshold";
     public static final String HEALTHCHECK_PINGPATH = "pingpath";
+    public static final String SOURCE_PORT = "sourceport";
+    public static final String INSTANCE_PORT = "instanceport";
+    public static final String SOURCE_IP = "sourceipaddress";
+    public static final String SOURCE_IP_NETWORK_ID = "sourceipaddressnetworkid";
+    public static final String SCHEME = "scheme";
+    public static final String PROVIDER_TYPE = "providertype";
     public static final String AFFINITY_GROUP_IDS = "affinitygroupids";
     public static final String AFFINITY_GROUP_NAMES = "affinitygroupnames";
     public static final String ASA_INSIDE_PORT_PROFILE = "insideportprofile";

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index 40e8d0e..6708950 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -29,6 +29,9 @@ import javax.inject.Inject;
 
 import org.apache.cloudstack.affinity.AffinityGroupService;
 import com.cloud.server.ResourceMetaDataService;
+import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
+import org.apache.cloudstack.network.lb.ApplicationLoadBalancerService;
+import org.apache.cloudstack.network.lb.InternalLoadBalancerVMService;
 import org.apache.cloudstack.query.QueryService;
 import org.apache.cloudstack.usage.UsageService;
 import org.apache.log4j.Logger;
@@ -43,6 +46,7 @@ import com.cloud.exception.NetworkRuleConflictException;
 import com.cloud.exception.PermissionDeniedException;
 import com.cloud.exception.ResourceAllocationException;
 import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.NetworkModel;
 import com.cloud.network.NetworkService;
 import com.cloud.network.NetworkUsageService;
 import com.cloud.network.StorageNetworkService;
@@ -140,7 +144,12 @@ public abstract class BaseCmd {
     @Inject public VMSnapshotService _vmSnapshotService;
     @Inject public DataStoreProviderApiService dataStoreProviderApiService;
     @Inject public VpcProvisioningService _vpcProvSvc;
+    @Inject public ApplicationLoadBalancerService _newLbSvc;
+    @Inject public ApplicationLoadBalancerService _appLbService;
     @Inject public AffinityGroupService _affinityGroupService;
+    @Inject public InternalLoadBalancerElementService _internalLbElementSvc;
+    @Inject public InternalLoadBalancerVMService _internalLbSvc;
+    @Inject public NetworkModel _ntwkModel;
 
     public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/ResponseGenerator.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
index a3aa9de..ab8f995 100644
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api;
 import java.text.DecimalFormat;
 import java.util.EnumSet;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.cloudstack.affinity.AffinityGroup;
 import org.apache.cloudstack.affinity.AffinityGroupResponse;
@@ -26,6 +27,7 @@ import org.apache.cloudstack.api.ApiConstants.HostDetails;
 import org.apache.cloudstack.api.ApiConstants.VMDetails;
 import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
 import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
 import org.apache.cloudstack.api.response.AsyncJobResponse;
 import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
 import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
@@ -43,12 +45,17 @@ import org.apache.cloudstack.api.response.EventResponse;
 import org.apache.cloudstack.api.response.ExtractResponse;
 import org.apache.cloudstack.api.response.FirewallResponse;
 import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.GlobalLoadBalancerResponse;
 import org.apache.cloudstack.api.response.GuestOSResponse;
+import org.apache.cloudstack.api.response.GuestVlanRangeResponse;
+import org.apache.cloudstack.api.response.HostForMigrationResponse;
 import org.apache.cloudstack.api.response.HostResponse;
 import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse;
 import org.apache.cloudstack.api.response.IPAddressResponse;
 import org.apache.cloudstack.api.response.InstanceGroupResponse;
+import org.apache.cloudstack.api.response.InternalLoadBalancerElementResponse;
 import org.apache.cloudstack.api.response.IpForwardingRuleResponse;
+import org.apache.cloudstack.api.response.IsolationMethodResponse;
 import org.apache.cloudstack.api.response.LBHealthCheckResponse;
 import org.apache.cloudstack.api.response.LBStickinessResponse;
 import org.apache.cloudstack.api.response.LDAPConfigResponse;
@@ -82,6 +89,7 @@ import org.apache.cloudstack.api.response.SnapshotResponse;
 import org.apache.cloudstack.api.response.SnapshotScheduleResponse;
 import org.apache.cloudstack.api.response.StaticRouteResponse;
 import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse;
+import org.apache.cloudstack.api.response.StoragePoolForMigrationResponse;
 import org.apache.cloudstack.api.response.StoragePoolResponse;
 import org.apache.cloudstack.api.response.SwiftResponse;
 import org.apache.cloudstack.api.response.SystemVmInstanceResponse;
@@ -101,6 +109,7 @@ import org.apache.cloudstack.api.response.VpcOfferingResponse;
 import org.apache.cloudstack.api.response.VpcResponse;
 import org.apache.cloudstack.api.response.VpnUsersResponse;
 import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
 import org.apache.cloudstack.region.Region;
 import org.apache.cloudstack.usage.Usage;
 
@@ -117,9 +126,25 @@ import com.cloud.domain.Domain;
 import com.cloud.event.Event;
 import com.cloud.host.Host;
 import com.cloud.hypervisor.HypervisorCapabilities;
-import com.cloud.network.*;
+import com.cloud.network.GuestVlan;
+import com.cloud.network.IpAddress;
+import com.cloud.network.Network;
 import com.cloud.network.Network.Service;
-import com.cloud.network.as.*;
+import com.cloud.network.Networks.IsolationType;
+import com.cloud.network.PhysicalNetwork;
+import com.cloud.network.PhysicalNetworkServiceProvider;
+import com.cloud.network.PhysicalNetworkTrafficType;
+import com.cloud.network.RemoteAccessVpn;
+import com.cloud.network.Site2SiteCustomerGateway;
+import com.cloud.network.Site2SiteVpnConnection;
+import com.cloud.network.Site2SiteVpnGateway;
+import com.cloud.network.VirtualRouterProvider;
+import com.cloud.network.VpnUser;
+import com.cloud.network.as.AutoScalePolicy;
+import com.cloud.network.as.AutoScaleVmGroup;
+import com.cloud.network.as.AutoScaleVmProfile;
+import com.cloud.network.as.Condition;
+import com.cloud.network.as.Counter;
 import com.cloud.network.router.VirtualRouter;
 import com.cloud.network.rules.FirewallRule;
 import com.cloud.network.rules.HealthCheckPolicy;
@@ -142,7 +167,12 @@ import com.cloud.projects.ProjectAccount;
 import com.cloud.projects.ProjectInvitation;
 import com.cloud.region.ha.GlobalLoadBalancerRule;
 import com.cloud.server.ResourceTag;
-import com.cloud.storage.*;
+import com.cloud.storage.GuestOS;
+import com.cloud.storage.S3;
+import com.cloud.storage.Snapshot;
+import com.cloud.storage.StoragePool;
+import com.cloud.storage.Swift;
+import com.cloud.storage.Volume;
 import com.cloud.storage.snapshot.SnapshotPolicy;
 import com.cloud.storage.snapshot.SnapshotSchedule;
 import com.cloud.template.VirtualMachineTemplate;
@@ -150,11 +180,12 @@ import com.cloud.user.Account;
 import com.cloud.user.User;
 import com.cloud.user.UserAccount;
 import com.cloud.uservm.UserVm;
+import com.cloud.utils.net.Ip;
 import com.cloud.vm.InstanceGroup;
 import com.cloud.vm.Nic;
-import com.cloud.vm.snapshot.VMSnapshot;
+import com.cloud.vm.NicSecondaryIp;
 import com.cloud.vm.VirtualMachine;
-import org.apache.cloudstack.api.response.*;
+import com.cloud.vm.snapshot.VMSnapshot;
 
 public interface ResponseGenerator {
     UserResponse createUserResponse(UserAccount user);
@@ -197,6 +228,8 @@ public interface ResponseGenerator {
 
     IPAddressResponse createIPAddressResponse(IpAddress ipAddress);
 
+    GuestVlanRangeResponse createDedicatedGuestVlanRangeResponse(GuestVlan result);
+
     GlobalLoadBalancerResponse createGlobalLoadBalancerResponse(GlobalLoadBalancerRule globalLoadBalancerRule);
 
     LoadBalancerResponse createLoadBalancerResponse(LoadBalancer loadBalancer);
@@ -389,11 +422,16 @@ public interface ResponseGenerator {
     TrafficMonitorResponse createTrafficMonitorResponse(Host trafficMonitor);
     VMSnapshotResponse createVMSnapshotResponse(VMSnapshot vmSnapshot);
 
-    NicSecondaryIpResponse createSecondaryIPToNicResponse(String ip,
-            Long nicId, Long networkId);
+    NicSecondaryIpResponse createSecondaryIPToNicResponse(NicSecondaryIp result);
     public NicResponse createNicResponse(Nic result);
 
+    ApplicationLoadBalancerResponse createLoadBalancerContainerReponse(ApplicationLoadBalancerRule lb, Map<Ip, UserVm> lbInstances);
+    
     AffinityGroupResponse createAffinityGroupResponse(AffinityGroup group);
 
     Long getAffinityGroupId(String name, long entityOwnerId);
+
+    InternalLoadBalancerElementResponse createInternalLbElementResponse(VirtualRouterProvider result);
+    
+    IsolationMethodResponse createIsolationMethodResponse(IsolationType method);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
index 0417b18..f2dd349 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
@@ -70,6 +70,9 @@ public class ListClustersCmd extends BaseListCmd {
     @Parameter(name=ApiConstants.MANAGED_STATE, type=CommandType.STRING, description="whether this cluster is managed by cloudstack")
     private String managedState;
 
+    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+    private String zoneType;
+    
     @Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the clusters")
     private Boolean showCapacities;
 
@@ -114,7 +117,10 @@ public class ListClustersCmd extends BaseListCmd {
         this.managedState = managedstate;
     }
 
-
+    public String getZoneType() {
+        return zoneType;
+    }
+    
     public Boolean getShowCapacities() {
         return showCapacities;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
index 9f34405..a11904e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
@@ -45,11 +45,17 @@ public class ListCfgsByCmd extends BaseListCmd {
     @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists configuration by name")
     private String configName;
 
-    @Parameter(name=ApiConstants.SCOPE, type = CommandType.STRING, description = "scope(zone/cluster/pool/account) of the parameter that needs to be updated")
-    private String scope;
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, description="the ID of the Zone to update the parameter value for corresponding zone")
+    private Long zone_id;
 
-    @Parameter(name=ApiConstants.ID, type = CommandType.UUID, entityType = {ZoneResponse.class, ClusterResponse.class, StoragePoolResponse.class, AccountResponse.class}, description = "corresponding ID of the scope")
-    private Long id;
+    @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType=ClusterResponse.class, description="the ID of the Cluster to update the parameter value for corresponding cluster")
+    private Long cluster_id;
+
+    @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.UUID, entityType=StoragePoolResponse.class, description="the ID of the Storage pool to update the parameter value for corresponding storage pool")
+    private Long storagepool_id;
+
+    @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType=AccountResponse.class, description="the ID of the Account to update the parameter value for corresponding account")
+    private Long account_id;
 
 
     // ///////////////////////////////////////////////////
@@ -64,14 +70,21 @@ public class ListCfgsByCmd extends BaseListCmd {
         return configName;
     }
 
-    public String getScope() {
-        return scope;
+    public Long getZoneId() {
+        return zone_id;
+    }
+
+    public Long getClusterId() {
+        return cluster_id;
     }
 
-    public Long getId() {
-        return id;
+    public Long getStoragepoolId() {
+        return storagepool_id;
     }
 
+    public Long getAccountId() {
+        return account_id;
+    }
 
     @Override
     public Long getPageSizeVal() {
@@ -100,10 +113,17 @@ public class ListCfgsByCmd extends BaseListCmd {
         for (Configuration cfg : result.first()) {
             ConfigurationResponse cfgResponse = _responseGenerator.createConfigurationResponse(cfg);
             cfgResponse.setObjectName("configuration");
-            if (scope != null) {
-                cfgResponse.setScope(scope);
-            } else {
-                cfgResponse.setScope("global");
+            if(getZoneId() != null) {
+                cfgResponse.setScope("zone");
+            }
+            if(getClusterId() != null) {
+                cfgResponse.setScope("cluster");
+            }
+            if(getStoragepoolId() != null) {
+                cfgResponse.setScope("storagepool");
+            }
+            if(getAccountId() != null) {
+                cfgResponse.setScope("account");
             }
             configResponses.add(cfgResponse);
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
index 074c5a3..deb61d3 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
@@ -43,11 +43,17 @@ public class UpdateCfgCmd extends BaseCmd {
     @Parameter(name=ApiConstants.VALUE, type=CommandType.STRING, description="the value of the configuration", length=4095)
     private String value;
 
-    @Parameter(name=ApiConstants.SCOPE, type = CommandType.STRING, description = "scope(zone/cluster/pool/account) of the parameter that needs to be updated")
-    private String scope;
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, description="the ID of the Zone to update the parameter value for corresponding zone")
+    private Long zone_id;
 
-    @Parameter(name=ApiConstants.ID, type = CommandType.UUID, entityType = {ZoneResponse.class, ClusterResponse.class, StoragePoolResponse.class, AccountResponse.class}, description = "corresponding ID of the scope")
-    private Long id;
+    @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType=ClusterResponse.class, description="the ID of the Cluster to update the parameter value for corresponding cluster")
+    private Long cluster_id;
+
+    @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.UUID, entityType=StoragePoolResponse.class, description="the ID of the Storage pool to update the parameter value for corresponding storage pool")
+    private Long storagepool_id;
+
+    @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType=AccountResponse.class, description="the ID of the Account to update the parameter value for corresponding account")
+    private Long account_id;
 
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
@@ -61,12 +67,20 @@ public class UpdateCfgCmd extends BaseCmd {
         return value;
     }
 
-    public String getScope() {
-        return scope;
+    public Long getZoneId() {
+        return zone_id;
     }
 
-    public Long getId() {
-        return id;
+    public Long getClusterId() {
+        return cluster_id;
+    }
+
+    public Long getStoragepoolId() {
+        return storagepool_id;
+    }
+
+    public Long getAccountId() {
+        return account_id;
     }
 
     /////////////////////////////////////////////////////
@@ -89,12 +103,19 @@ public class UpdateCfgCmd extends BaseCmd {
         if (cfg != null) {
             ConfigurationResponse response = _responseGenerator.createConfigurationResponse(cfg);
             response.setResponseName(getCommandName());
-            if (scope != null) {
-                response.setScope(scope);
-                response.setValue(value);
-            } else {
-                response.setScope("global");
+            if(getZoneId() != null) {
+                response.setScope("zone");
+            }
+            if(getClusterId() != null) {
+                response.setScope("cluster");
+            }
+            if(getStoragepoolId() != null) {
+                response.setScope("storagepool");
+            }
+            if(getAccountId() != null) {
+                response.setScope("account");
             }
+            response.setValue(value);
             this.setResponseObject(response);
         } else {
             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update config");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
index 5ec7cf3..69c6980 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
@@ -75,6 +75,9 @@ public class ListHostsCmd extends BaseListCmd {
             description="the Zone ID for the host")
     private Long zoneId;
 
+    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+    private String zoneType;
+    
     @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
             required=false, description="lists hosts in the same cluster as this VM and flag hosts with enough CPU/RAm to host this VM")
     private Long virtualMachineId;
@@ -124,6 +127,10 @@ public class ListHostsCmd extends BaseListCmd {
         return zoneId;
     }
 
+    public String getZoneType() {
+        return zoneType;
+    }
+    
     public Long getVirtualMachineId() {
         return virtualMachineId;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java
new file mode 100644
index 0000000..7c3d1e9
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java
@@ -0,0 +1,114 @@
+// 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 org.apache.cloudstack.api.command.admin.internallb;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.InternalLoadBalancerElementResponse;
+import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.VirtualRouterProvider;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@APICommand(name = "configureInternalLoadBalancerElement", responseObject=InternalLoadBalancerElementResponse.class,
+            description="Configures an Internal Load Balancer element.", since="4.2.0")
+public class ConfigureInternalLoadBalancerElementCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(ConfigureInternalLoadBalancerElementCmd.class.getName());
+    private static final String s_name = "configureinternalloadbalancerelementresponse";
+
+    @Inject
+    private List<InternalLoadBalancerElementService> _service;
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = InternalLoadBalancerElementResponse.class,
+            required=true, description="the ID of the internal lb provider")
+    private Long id;
+
+    @Parameter(name=ApiConstants.ENABLED, type=CommandType.BOOLEAN, required=true, description="Enables/Disables the Internal Load Balancer element")
+    private Boolean enabled;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+
+    public Long getId() {
+        return id;
+    }
+
+    public Boolean getEnabled() {
+        return enabled;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_NETWORK_ELEMENT_CONFIGURE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "configuring internal load balancer element: " + id;
+    }
+
+    @Override
+    public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
+        s_logger.debug("hello alena");
+        UserContext.current().setEventDetails("Internal load balancer element: " + id);
+        s_logger.debug("hello alena");
+        VirtualRouterProvider result = _service.get(0).configureInternalLoadBalancerElement(getId(), getEnabled());
+        s_logger.debug("hello alena");
+        if (result != null){
+            InternalLoadBalancerElementResponse routerResponse = _responseGenerator.createInternalLbElementResponse(result);
+            routerResponse.setResponseName(getCommandName());
+            this.setResponseObject(routerResponse);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure the internal load balancer element");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java
new file mode 100644
index 0000000..2902f7a
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java
@@ -0,0 +1,116 @@
+// 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 org.apache.cloudstack.api.command.admin.internallb;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.InternalLoadBalancerElementResponse;
+import org.apache.cloudstack.api.response.ProviderResponse;
+import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.network.VirtualRouterProvider;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@APICommand(name = "createInternalLoadBalancerElement", responseObject=InternalLoadBalancerElementResponse.class, description="Create an Internal Load Balancer element.",since="4.2.0")
+public class CreateInternalLoadBalancerElementCmd extends BaseAsyncCreateCmd {
+    public static final Logger s_logger = Logger.getLogger(CreateInternalLoadBalancerElementCmd.class.getName());
+    private static final String s_name = "createinternalloadbalancerelementresponse";
+
+    @Inject
+    private List<InternalLoadBalancerElementService> _service;
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.NETWORK_SERVICE_PROVIDER_ID, type=CommandType.UUID, entityType = ProviderResponse.class, required=true, description="the network service provider ID of the internal load balancer element")
+    private Long nspId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public void setNspId(Long nspId) {
+        this.nspId = nspId;
+    }
+
+    public Long getNspId() {
+        return nspId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute(){
+        UserContext.current().setEventDetails("Virtual router element Id: "+getEntityId());
+        VirtualRouterProvider result = _service.get(0).getInternalLoadBalancerElement(getEntityId());
+        if (result != null) {
+            InternalLoadBalancerElementResponse response = _responseGenerator.createInternalLbElementResponse(result);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        }else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
+        }
+    }
+
+    @Override
+    public void create() throws ResourceAllocationException {
+        VirtualRouterProvider result = _service.get(0).addInternalLoadBalancerElement(getNspId());
+        if (result != null) {
+            setEntityId(result.getId());
+            setEntityUuid(result.getUuid());
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Internal Load Balancer entity to physical network");
+        }
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_SERVICE_PROVIDER_CREATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "Adding physical network element Internal Load Balancer: " + getEntityId();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java
new file mode 100644
index 0000000..e314b32
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java
@@ -0,0 +1,151 @@
+// 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 org.apache.cloudstack.api.command.admin.internallb;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.DomainRouterResponse;
+import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VpcResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.network.router.VirtualRouter.Role;
+
+@APICommand(name = "listInternalLoadBalancerVMs", description="List internal LB VMs.", responseObject=DomainRouterResponse.class)
+public class ListInternalLBVMsCmd extends BaseListProjectAndAccountResourcesCmd {
+    public static final Logger s_logger = Logger.getLogger(ListInternalLBVMsCmd.class.getName());
+
+    private static final String s_name = "listinternallbvmssresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.HOST_ID, type=CommandType.UUID, entityType=HostResponse.class,
+            description="the host ID of the Internal LB VM")
+    private Long hostId;
+
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class,
+            description="the ID of the Internal LB VM")
+    private Long id;
+
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the Internal LB VM")
+    private String routerName;
+
+    @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class,
+            description="the Pod ID of the Internal LB VM")
+    private Long podId;
+
+    @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="the state of the Internal LB VM")
+    private String state;
+
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
+            description="the Zone ID of the Internal LB VM")
+    private Long zoneId;
+
+    @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType=NetworkResponse.class,
+            description="list by network id")
+    private Long networkId;
+
+    @Parameter(name=ApiConstants.VPC_ID, type=CommandType.UUID, entityType=VpcResponse.class,
+            description="List Internal LB VMs by VPC")
+    private Long vpcId;
+
+    @Parameter(name=ApiConstants.FOR_VPC, type=CommandType.BOOLEAN, description="if true is passed for this parameter, list only VPC Internal LB VMs")
+    private Boolean forVpc;
+    
+    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+    private String zoneType;
+    
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getHostId() {
+        return hostId;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getRouterName() {
+        return routerName;
+    }
+
+    public Long getPodId() {
+        return podId;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    public Long getNetworkId() {
+        return networkId;
+    }
+
+    public Long getVpcId() {
+        return vpcId;
+    }
+
+    public Boolean getForVpc() {
+        return forVpc;
+    }
+    
+    public String getRole() {
+        return Role.INTERNAL_LB_VM.toString();
+    }
+    
+    public String getZoneType() {
+        return zoneType;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.DomainRouter;
+    }
+
+    @Override
+    public void execute(){
+        ListResponse<DomainRouterResponse> response = _queryService.searchForInternalLbVms(this);
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java
new file mode 100644
index 0000000..1853619
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java
@@ -0,0 +1,99 @@
+// 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 org.apache.cloudstack.api.command.admin.internallb;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.InternalLoadBalancerElementResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.ProviderResponse;
+import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
+import org.apache.log4j.Logger;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.VirtualRouterProvider;
+
+@APICommand(name = "listInternalLoadBalancerElements", description="Lists all available Internal Load Balancer elements.",
+            responseObject=InternalLoadBalancerElementResponse.class, since="4.2.0")
+public class ListInternalLoadBalancerElementsCmd extends BaseListCmd {
+    public static final Logger s_logger = Logger.getLogger(ListInternalLoadBalancerElementsCmd.class.getName());
+    private static final String _name = "listinternalloadbalancerelementsresponse";
+
+    @Inject
+    private InternalLoadBalancerElementService _service;
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = InternalLoadBalancerElementResponse.class,
+            description="list internal load balancer elements by id")
+    private Long id;
+
+    @Parameter(name=ApiConstants.NSP_ID, type=CommandType.UUID, entityType = ProviderResponse.class,
+            description="list internal load balancer elements by network service provider id")
+    private Long nspId;
+
+    @Parameter(name=ApiConstants.ENABLED, type=CommandType.BOOLEAN, description="list internal load balancer elements by enabled state")
+    private Boolean enabled;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getNspId() {
+        return nspId;
+    }
+
+    public Boolean getEnabled() {
+        return enabled;
+    }
+
+    @Override
+    public String getCommandName() {
+        return _name;
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
+        List<? extends VirtualRouterProvider> providers = _service.searchForInternalLoadBalancerElements(getId(), getNspId(), getEnabled());
+        ListResponse<InternalLoadBalancerElementResponse> response = new ListResponse<InternalLoadBalancerElementResponse>();
+        List<InternalLoadBalancerElementResponse> providerResponses = new ArrayList<InternalLoadBalancerElementResponse>();
+        for (VirtualRouterProvider provider : providers) {
+            InternalLoadBalancerElementResponse providerResponse = _responseGenerator.createInternalLbElementResponse(provider);
+            providerResponses.add(providerResponse);
+        }
+        response.setResponses(providerResponses);
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java
new file mode 100644
index 0000000..31d132b
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java
@@ -0,0 +1,120 @@
+// 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 org.apache.cloudstack.api.command.admin.internallb;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.DomainRouterResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.router.VirtualRouter;
+import com.cloud.network.router.VirtualRouter.Role;
+import com.cloud.user.UserContext;
+
+@APICommand(name = "startInternalLoadBalancerVM", responseObject=DomainRouterResponse.class, description="Starts an existing internal lb vm.")
+public class StartInternalLBVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(StartInternalLBVMCmd.class.getName());
+    private static final String s_name = "startinternallbvmresponse";
+
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=DomainRouterResponse.class,
+            required=true, description="the ID of the internal lb vm")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "router";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        VirtualRouter router = _entityMgr.findById(VirtualRouter.class, getId());
+        if (router != null && router.getRole() == Role.INTERNAL_LB_VM) {
+            return router.getAccountId();
+        } else {
+            throw new InvalidParameterValueException("Unable to find internal lb vm by id");
+        } 
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_INTERNAL_LB_VM_START;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "starting internal lb vm: " + getId();
+    }
+
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.InternalLbVm;
+    }
+
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
+        UserContext.current().setEventDetails("Internal Lb Vm Id: "+getId());
+        VirtualRouter result = null;
+        VirtualRouter router = _routerService.findRouter(getId());
+        if (router == null || router.getRole() != Role.INTERNAL_LB_VM) {
+            throw new InvalidParameterValueException("Can't find internal lb vm by id");
+        } else {
+            result = _internalLbSvc.startInternalLbVm(getId(), UserContext.current().getCaller(), UserContext.current().getCallerUserId());
+        }
+        
+        if (result != null){
+            DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(result);
+            routerResponse.setResponseName(getCommandName());
+            this.setResponseObject(routerResponse);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start internal lb vm");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java
new file mode 100644
index 0000000..f40db49
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java
@@ -0,0 +1,123 @@
+// 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 org.apache.cloudstack.api.command.admin.internallb;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.DomainRouterResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.router.VirtualRouter;
+import com.cloud.network.router.VirtualRouter.Role;
+import com.cloud.user.UserContext;
+
+@APICommand(name = "stopInternalLoadBalancerVM", description = "Stops an Internal LB vm.", responseObject = DomainRouterResponse.class)
+public class StopInternalLBVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(StopInternalLBVMCmd.class.getName());
+    private static final String s_name = "stopinternallbvmresponse";
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class,
+            required = true, description = "the ID of the internal lb vm")
+    private Long id;
+
+    @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM. The caller knows the VM is stopped.")
+    private Boolean forced;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        VirtualRouter vm = _entityMgr.findById(VirtualRouter.class, getId());
+        if (vm != null && vm.getRole() == Role.INTERNAL_LB_VM) {
+            return vm.getAccountId();
+        } else {
+            throw new InvalidParameterValueException("Unable to find internal lb vm by id");
+        }
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_INTERNAL_LB_VM_STOP;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "stopping internal lb vm: " + getId();
+    }
+
+    @Override
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.InternalLbVm;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    public boolean isForced() {
+        return (forced != null) ? forced : false;
+    }
+
+    @Override
+    public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
+        UserContext.current().setEventDetails("Internal lb vm Id: "+getId());
+        VirtualRouter result = null;
+        VirtualRouter vm = _routerService.findRouter(getId());
+        if (vm == null || vm.getRole() != Role.INTERNAL_LB_VM) {
+            throw new InvalidParameterValueException("Can't find internal lb vm by id");
+        } else {
+            result = _internalLbSvc.stopInternalLbVm(getId(), isForced(), UserContext.current().getCaller(), UserContext.current().getCallerUserId());
+        } 
+        
+        if (result != null) {
+            DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop internal lb vm");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
index b48bf9e..6410715 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
@@ -31,7 +31,6 @@ import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.response.NetworkOfferingResponse;
 import org.apache.cloudstack.api.response.ServiceOfferingResponse;
-
 import org.apache.log4j.Logger;
 
 import com.cloud.exception.InvalidParameterValueException;
@@ -95,6 +94,10 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
 
     @Parameter(name=ApiConstants.IS_PERSISTENT, type=CommandType.BOOLEAN, description="true if network offering supports persistent networks; defaulted to false if not specified")
     private Boolean isPersistent;
+    
+    @Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, since="4.2.0", description="Template details in key/value pairs." +
+    		" Supported keys are internallbprovider/publiclbprovider with service provider as a value")
+    protected Map details;
 
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
@@ -215,6 +218,16 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
 
         return capabilityMap;
     }
+    
+    public Map<String, String> getDetails() {
+        if (details == null || details.isEmpty()) {
+            return null;
+        }
+
+        Collection paramsCollection = details.values();
+        Map<String, String> params = (Map<String, String>) (paramsCollection.toArray())[0];
+        return params;
+    }
 
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/network/DedicateGuestVlanRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DedicateGuestVlanRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DedicateGuestVlanRangeCmd.java
new file mode 100644
index 0000000..ec14360
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/DedicateGuestVlanRangeCmd.java
@@ -0,0 +1,118 @@
+/*
+ * 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 org.apache.cloudstack.api.command.admin.network;
+
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.GuestVlan;
+import com.cloud.user.Account;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.GuestVlanRangeResponse;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.log4j.Logger;
+
+@APICommand(name = "dedicateGuestVlanRange", description="Dedicates a guest vlan range to an account", responseObject=GuestVlanRangeResponse.class)
+public class DedicateGuestVlanRangeCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(DedicateGuestVlanRangeCmd.class.getName());
+
+    private static final String s_name = "dedicateguestvlanrangeresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.VLAN_RANGE, type=CommandType.STRING, required=true,
+            description="guest vlan range to be dedicated")
+    private String vlan;
+
+    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true,
+            description="account who will own the VLAN")
+    private String accountName;
+
+    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
+            description="project who will own the VLAN")
+    private Long projectId;
+
+    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
+            required=true, description="domain ID of the account owning a VLAN")
+    private Long domainId;
+
+    @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, entityType = PhysicalNetworkResponse.class,
+            required=true, description="physical network ID of the vlan")
+    private Long physicalNetworkId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getVlan() {
+        return vlan;
+    }
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public Long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public Long getProjectId() {
+        return projectId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, ResourceAllocationException {
+        GuestVlan result  = _networkService.dedicateGuestVlanRange(this);
+        if (result != null) {
+            GuestVlanRangeResponse response = _responseGenerator.createDedicatedGuestVlanRangeResponse(result);
+            response.setResponseName(getCommandName());
+            response.setObjectName("dedicatedguestvlanrange");
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to dedicate guest vlan range");
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/network/ListDedicatedGuestVlanRangesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListDedicatedGuestVlanRangesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListDedicatedGuestVlanRangesCmd.java
new file mode 100644
index 0000000..7f93efc
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListDedicatedGuestVlanRangesCmd.java
@@ -0,0 +1,129 @@
+// 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 org.apache.cloudstack.api.command.admin.network;
+
+import com.cloud.network.GuestVlan;
+import com.cloud.user.Account;
+import com.cloud.utils.Pair;
+import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.response.*;
+import org.apache.log4j.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+@APICommand(name = "listDedicatedGuestVlanRanges", description="Lists dedicated guest vlan ranges", responseObject=GuestVlanRangeResponse.class)
+public class ListDedicatedGuestVlanRangesCmd extends BaseListCmd {
+    public static final Logger s_logger = Logger.getLogger(ListDedicatedGuestVlanRangesCmd.class.getName());
+
+    private static final String s_name = "listdedicatedguestvlanrangesresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=GuestVlanRangeResponse.class,
+            description="list dedicated guest vlan ranges by id")
+    private Long id;
+
+    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account with which the guest VLAN range is associated. Must be used with the domainId parameter.")
+    private String accountName;
+
+    @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
+            description="project who will own the guest VLAN range")
+    private Long projectId;
+
+    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
+            description="the domain ID with which the guest VLAN range is associated.  If used with the account parameter, returns all guest VLAN ranges for that account in the specified domain.")
+    private Long domainId;
+
+    @Parameter(name=ApiConstants.GUEST_VLAN_RANGE, type=CommandType.STRING, description="the dedicated guest vlan range")
+    private String guestVlanRange;
+
+    @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, entityType = PhysicalNetworkResponse.class,
+            description="physical network id of the guest VLAN range")
+    private Long physicalNetworkId;
+
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
+            description="zone of the guest VLAN range")
+    private Long zoneId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public Long getProjectId() {
+        return projectId;
+    }
+
+    public String getGuestVlanRange() {
+        return guestVlanRange;
+    }
+
+    public Long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute(){
+        Pair<List<? extends GuestVlan>, Integer> vlans = _networkService.listDedicatedGuestVlanRanges(this);
+        ListResponse<GuestVlanRangeResponse> response = new ListResponse<GuestVlanRangeResponse>();
+        List<GuestVlanRangeResponse> guestVlanResponses = new ArrayList<GuestVlanRangeResponse>();
+        for (GuestVlan vlan : vlans.first()) {
+            GuestVlanRangeResponse guestVlanResponse = _responseGenerator.createDedicatedGuestVlanRangeResponse(vlan);
+            guestVlanResponse.setObjectName("dedicatedguestvlanrange");
+            guestVlanResponses.add(guestVlanResponse);
+        }
+
+        response.setResponses(guestVlanResponses, vlans.second());
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkIsolationMethodsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkIsolationMethodsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkIsolationMethodsCmd.java
new file mode 100644
index 0000000..7eef22a
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkIsolationMethodsCmd.java
@@ -0,0 +1,58 @@
+// 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 org.apache.cloudstack.api.command.admin.network;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.response.IsolationMethodResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+
+import com.cloud.network.Networks;
+
+@APICommand(name = "listNetworkIsolationMethods", description="Lists supported methods of network isolation",
+responseObject=IsolationMethodResponse.class, since="4.2.0")
+public class ListNetworkIsolationMethodsCmd extends BaseListCmd{
+    
+    private static final String s_name = "listnetworkisolationmethodsresponse";
+
+    @Override
+    public void execute() {
+        Networks.IsolationType[] methods = _ntwkModel.listNetworkIsolationMethods();
+        
+        ListResponse<IsolationMethodResponse> response = new ListResponse<IsolationMethodResponse>();
+        List<IsolationMethodResponse> isolationResponses = new ArrayList<IsolationMethodResponse>();
+        if (methods != null) {
+            for (Networks.IsolationType method : methods) {
+                IsolationMethodResponse isolationMethod = _responseGenerator.createIsolationMethodResponse(method);
+                isolationResponses.add(isolationMethod);
+            }
+        }
+        response.setResponses(isolationResponses, methods.length);
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+        
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java
new file mode 100644
index 0000000..76cb42d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java
@@ -0,0 +1,94 @@
+// 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 org.apache.cloudstack.api.command.admin.network;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceInUseException;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.response.CounterResponse;
+import org.apache.cloudstack.api.response.GuestVlanRangeResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
+@APICommand(name = "releaseDedicatedGuestVlanRange", description = "Releases a dedicated guest vlan range to the system", responseObject = SuccessResponse.class)
+public class ReleaseDedicatedGuestVlanRangeCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(ReleaseDedicatedGuestVlanRangeCmd.class.getName());
+    private static final String s_name = "releasededicatedguestvlanrangeresponse";
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=GuestVlanRangeResponse.class,
+            required=true, description="the ID of the dedicated guest vlan range")
+    private Long id;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    @Override
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.DedicatedGuestVlanRange;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Releasing a dedicated guest vlan range.";
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+
+    @Override
+    public void execute(){
+        UserContext.current().setEventDetails("Dedicated guest vlan range Id: " + id);
+        boolean result = _networkService.releaseDedicatedGuestVlanRange(getId());
+        if (result) {
+            SuccessResponse response = new SuccessResponse(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to release dedicated guest vlan range");
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
index 3dace42..db233ae 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
@@ -55,6 +55,9 @@ public class ListPodsByCmd extends BaseListCmd {
     @Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="list pods by allocation state")
     private String allocationState;
 
+    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+    private String zoneType;
+    
     @Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the pods")
     private Boolean showCapacities;
 
@@ -78,6 +81,10 @@ public class ListPodsByCmd extends BaseListCmd {
         return allocationState;
     }
 
+    public String getZoneType() {
+        return zoneType;
+    }
+    
     public Boolean getShowCapacities() {
         return showCapacities;
     }


[10/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java b/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
new file mode 100644
index 0000000..1bc8973
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
@@ -0,0 +1,621 @@
+// 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.network.dao;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.persistence.TableGenerator;
+
+import org.apache.cloudstack.acl.ControlledEntity.ACLType;
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.Network;
+import com.cloud.network.Network.GuestType;
+import com.cloud.network.Network.Provider;
+import com.cloud.network.Network.Service;
+import com.cloud.network.Network.State;
+import com.cloud.network.Network.Event;
+import com.cloud.network.Networks.BroadcastDomainType;
+import com.cloud.network.Networks.Mode;
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.offering.NetworkOffering;
+import com.cloud.offerings.NetworkOfferingVO;
+import com.cloud.offerings.dao.NetworkOfferingDao;
+import com.cloud.offerings.dao.NetworkOfferingDaoImpl;
+import com.cloud.server.ResourceTag.TaggedResourceType;
+import com.cloud.tags.dao.ResourceTagDao;
+import com.cloud.tags.dao.ResourceTagsDaoImpl;
+import com.cloud.utils.db.*;
+import com.cloud.utils.db.JoinBuilder.JoinType;
+import com.cloud.utils.db.SearchCriteria.Func;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.net.NetUtils;
+
+@Component
+@Local(value = NetworkDao.class)
+@DB(txn = false)
+public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements NetworkDao {
+    SearchBuilder<NetworkVO> AllFieldsSearch;
+    SearchBuilder<NetworkVO> AccountSearch;
+    SearchBuilder<NetworkVO> RelatedConfigSearch;
+    SearchBuilder<NetworkVO> AccountNetworkSearch;
+    SearchBuilder<NetworkVO> ZoneBroadcastUriSearch;
+    SearchBuilder<NetworkVO> ZoneSecurityGroupSearch;
+    GenericSearchBuilder<NetworkVO, Integer> CountBy;
+    SearchBuilder<NetworkVO> PhysicalNetworkSearch;
+    SearchBuilder<NetworkVO> SecurityGroupSearch;
+    GenericSearchBuilder<NetworkVO, Long> NetworksRegularUserCanCreateSearch;
+    GenericSearchBuilder<NetworkVO, Integer> NetworksCount;
+    SearchBuilder<NetworkVO> SourceNATSearch;
+    GenericSearchBuilder<NetworkVO, Long>  CountByZoneAndURI;
+    GenericSearchBuilder<NetworkVO, Long> VpcNetworksCount;
+    SearchBuilder<NetworkVO> OfferingAccountNetworkSearch;
+
+    GenericSearchBuilder<NetworkVO, Long> GarbageCollectedSearch;
+    
+    
+    
+    @Inject ResourceTagDao _tagsDao;
+    @Inject NetworkAccountDao _accountsDao;
+    @Inject NetworkDomainDao _domainsDao;
+    @Inject NetworkOpDao _opDao;
+    @Inject NetworkServiceMapDao _ntwkSvcMap;
+    @Inject NetworkOfferingDao _ntwkOffDao;
+    @Inject NetworkOpDao _ntwkOpDao;
+
+    TableGenerator _tgMacAddress;
+
+    Random _rand = new Random(System.currentTimeMillis());
+    long _prefix = 0x2;
+
+    public NetworkDaoImpl() {
+    }
+
+    @PostConstruct
+    protected void init() {
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("trafficType", AllFieldsSearch.entity().getTrafficType(), Op.EQ);
+        AllFieldsSearch.and("cidr", AllFieldsSearch.entity().getCidr(), Op.EQ);
+        AllFieldsSearch.and("broadcastType", AllFieldsSearch.entity().getBroadcastDomainType(), Op.EQ);
+        AllFieldsSearch.and("offering", AllFieldsSearch.entity().getNetworkOfferingId(), Op.EQ);
+        AllFieldsSearch.and("datacenter", AllFieldsSearch.entity().getDataCenterId(), Op.EQ);
+        AllFieldsSearch.and("account", AllFieldsSearch.entity().getAccountId(), Op.EQ);
+        AllFieldsSearch.and("related", AllFieldsSearch.entity().getRelated(), Op.EQ);
+        AllFieldsSearch.and("guestType", AllFieldsSearch.entity().getGuestType(), Op.EQ);
+        AllFieldsSearch.and("physicalNetwork", AllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        AllFieldsSearch.and("broadcastUri", AllFieldsSearch.entity().getBroadcastUri(), Op.EQ);
+        AllFieldsSearch.and("vpcId", AllFieldsSearch.entity().getVpcId(), Op.EQ);
+        SearchBuilder<NetworkOfferingVO> join1 = _ntwkOffDao.createSearchBuilder();
+        join1.and("isSystem", join1.entity().isSystemOnly(), Op.EQ);
+        join1.and("isRedundant", join1.entity().getRedundantRouter(), Op.EQ);
+        AllFieldsSearch.join("offerings", join1, AllFieldsSearch.entity().getNetworkOfferingId(), join1.entity().getId(), JoinBuilder.JoinType.INNER);
+        AllFieldsSearch.done();
+
+        AccountSearch = createSearchBuilder();
+        AccountSearch.and("offering", AccountSearch.entity().getNetworkOfferingId(), Op.EQ);
+        SearchBuilder<NetworkAccountVO> join = _accountsDao.createSearchBuilder();
+        join.and("account", join.entity().getAccountId(), Op.EQ);
+        AccountSearch.join("accounts", join, AccountSearch.entity().getId(), join.entity().getNetworkId(), JoinBuilder.JoinType.INNER);
+        AccountSearch.and("datacenter", AccountSearch.entity().getDataCenterId(), Op.EQ);
+        AccountSearch.and("cidr", AccountSearch.entity().getCidr(), Op.EQ);
+        AccountSearch.and("vpcId", AccountSearch.entity().getVpcId(), Op.EQ);
+        AccountSearch.done();
+
+        RelatedConfigSearch = createSearchBuilder();
+        RelatedConfigSearch.and("offering", RelatedConfigSearch.entity().getNetworkOfferingId(), Op.EQ);
+        RelatedConfigSearch.and("datacenter", RelatedConfigSearch.entity().getDataCenterId(), Op.EQ);
+        SearchBuilder<NetworkAccountVO> join2 = _accountsDao.createSearchBuilder();
+        join2.and("account", join2.entity().getAccountId(), Op.EQ);
+        RelatedConfigSearch.join("account", join2, join2.entity().getNetworkId(), RelatedConfigSearch.entity().getId(), JoinType.INNER);
+        RelatedConfigSearch.done();
+
+        AccountNetworkSearch = createSearchBuilder();
+        AccountNetworkSearch.and("networkId", AccountNetworkSearch.entity().getId(), Op.EQ);
+        SearchBuilder<NetworkAccountVO> mapJoin = _accountsDao.createSearchBuilder();
+        mapJoin.and("accountId", mapJoin.entity().getAccountId(), Op.EQ);
+        AccountNetworkSearch.join("networkSearch", mapJoin, AccountNetworkSearch.entity().getId(), mapJoin.entity().getNetworkId(), JoinBuilder.JoinType.INNER);
+        AccountNetworkSearch.done();
+
+        ZoneBroadcastUriSearch = createSearchBuilder();
+        ZoneBroadcastUriSearch.and("dataCenterId", ZoneBroadcastUriSearch.entity().getDataCenterId(), Op.EQ);
+        ZoneBroadcastUriSearch.and("broadcastUri", ZoneBroadcastUriSearch.entity().getBroadcastUri(), Op.EQ);
+        ZoneBroadcastUriSearch.and("guestType", ZoneBroadcastUriSearch.entity().getGuestType(), Op.EQ);
+        ZoneBroadcastUriSearch.done();
+
+        CountByZoneAndURI = createSearchBuilder(Long.class);
+        CountByZoneAndURI.select(null, Func.COUNT, null);
+        CountByZoneAndURI.and("dataCenterId", CountByZoneAndURI.entity().getDataCenterId(), Op.EQ);
+        CountByZoneAndURI.and("broadcastUri", CountByZoneAndURI.entity().getBroadcastUri(), Op.EQ);
+        CountByZoneAndURI.and("guestType", CountByZoneAndURI.entity().getGuestType(), Op.EQ);
+
+        CountByZoneAndURI.done();
+        
+        ZoneSecurityGroupSearch = createSearchBuilder();
+        ZoneSecurityGroupSearch.and("dataCenterId", ZoneSecurityGroupSearch.entity().getDataCenterId(), Op.EQ);
+        SearchBuilder<NetworkServiceMapVO> offJoin = _ntwkSvcMap.createSearchBuilder();
+        offJoin.and("service", offJoin.entity().getService(), Op.EQ);
+        ZoneSecurityGroupSearch.join("services", offJoin, ZoneSecurityGroupSearch.entity().getId(), offJoin.entity().getNetworkId(), JoinBuilder.JoinType.INNER);
+        ZoneSecurityGroupSearch.done();
+
+        CountBy = createSearchBuilder(Integer.class);
+        CountBy.select(null, Func.COUNT, CountBy.entity().getId());
+        CountBy.and("offeringId", CountBy.entity().getNetworkOfferingId(), Op.EQ);
+        CountBy.and("vpcId", CountBy.entity().getVpcId(), Op.EQ);
+        CountBy.and("removed", CountBy.entity().getRemoved(), Op.NULL);
+        CountBy.done();
+
+        PhysicalNetworkSearch = createSearchBuilder();
+        PhysicalNetworkSearch.and("physicalNetworkId", PhysicalNetworkSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        PhysicalNetworkSearch.done();
+
+        SecurityGroupSearch = createSearchBuilder();
+        SearchBuilder<NetworkServiceMapVO> join3 = _ntwkSvcMap.createSearchBuilder();
+        join3.and("service", join3.entity().getService(), Op.EQ);
+        SecurityGroupSearch.join("services", join3, SecurityGroupSearch.entity().getId(), join3.entity().getNetworkId(), JoinBuilder.JoinType.INNER);
+        SecurityGroupSearch.done();
+        
+        NetworksCount = createSearchBuilder(Integer.class);
+        NetworksCount.select(null, Func.COUNT, NetworksCount.entity().getId());
+        NetworksCount.and("networkOfferingId", NetworksCount.entity().getNetworkOfferingId(), SearchCriteria.Op.EQ);
+        NetworksCount.done();
+        
+        NetworksRegularUserCanCreateSearch = createSearchBuilder(Long.class);
+        NetworksRegularUserCanCreateSearch.and("aclType", NetworksRegularUserCanCreateSearch.entity().getAclType(), Op.EQ);
+        NetworksRegularUserCanCreateSearch.select(null, Func.COUNT, NetworksRegularUserCanCreateSearch.entity().getId());
+        SearchBuilder<NetworkAccountVO> join4 = _accountsDao.createSearchBuilder();
+        join4.and("account", join4.entity().getAccountId(), Op.EQ);
+        join4.and("isOwner", join4.entity().isOwner(), Op.EQ);
+        NetworksRegularUserCanCreateSearch.join("accounts", join4, NetworksRegularUserCanCreateSearch.entity().getId(), join4.entity().getNetworkId(), JoinBuilder.JoinType.INNER);
+        SearchBuilder<NetworkOfferingVO> join5 = _ntwkOffDao.createSearchBuilder();
+        join5.and("specifyVlan", join5.entity().getSpecifyVlan(), Op.EQ);
+        NetworksRegularUserCanCreateSearch.join("ntwkOff", join5, NetworksRegularUserCanCreateSearch.entity().getNetworkOfferingId(), join5.entity().getId(), JoinBuilder.JoinType.INNER);    
+        NetworksRegularUserCanCreateSearch.done();
+
+        _tgMacAddress = _tgs.get("macAddress");
+        
+        SourceNATSearch = createSearchBuilder();
+        SourceNATSearch.and("account", SourceNATSearch.entity().getAccountId(), Op.EQ);
+        SourceNATSearch.and("datacenter", SourceNATSearch.entity().getDataCenterId(), Op.EQ);
+        SourceNATSearch.and("guestType", SourceNATSearch.entity().getGuestType(), Op.EQ);
+        SearchBuilder<NetworkServiceMapVO> join6 = _ntwkSvcMap.createSearchBuilder();
+        join6.and("service", join6.entity().getService(), Op.EQ);
+        SourceNATSearch.join("services", join6, SourceNATSearch.entity().getId(), join6.entity().getNetworkId(), JoinBuilder.JoinType.INNER);
+        SourceNATSearch.done();
+        
+        VpcNetworksCount = createSearchBuilder(Long.class);
+        VpcNetworksCount.and("vpcId", VpcNetworksCount.entity().getVpcId(), Op.EQ);
+        VpcNetworksCount.select(null, Func.COUNT, VpcNetworksCount.entity().getId());
+        VpcNetworksCount.done();
+
+        OfferingAccountNetworkSearch = createSearchBuilder();
+        OfferingAccountNetworkSearch.select(null, Func.DISTINCT, OfferingAccountNetworkSearch.entity().getId());
+        SearchBuilder<NetworkOfferingVO> ntwkOfferingJoin = _ntwkOffDao.createSearchBuilder();
+        ntwkOfferingJoin.and("isSystem", ntwkOfferingJoin.entity().isSystemOnly(), Op.EQ);
+        OfferingAccountNetworkSearch.join("ntwkOfferingSearch", ntwkOfferingJoin, OfferingAccountNetworkSearch.entity().getNetworkOfferingId(), ntwkOfferingJoin.entity().getId(), JoinBuilder.JoinType.LEFT);
+        SearchBuilder<NetworkAccountVO> ntwkAccountJoin = _accountsDao.createSearchBuilder();
+        ntwkAccountJoin.and("accountId", ntwkAccountJoin.entity().getAccountId(), Op.EQ);
+        OfferingAccountNetworkSearch.join("ntwkAccountSearch", ntwkAccountJoin, OfferingAccountNetworkSearch.entity().getId(), ntwkAccountJoin.entity().getNetworkId(), JoinBuilder.JoinType.INNER);
+        OfferingAccountNetworkSearch.and("zoneId", OfferingAccountNetworkSearch.entity().getDataCenterId(), Op.EQ);
+        OfferingAccountNetworkSearch.and("type", OfferingAccountNetworkSearch.entity().getGuestType(), Op.EQ);
+        OfferingAccountNetworkSearch.done();
+
+        GarbageCollectedSearch = createSearchBuilder(Long.class);
+        GarbageCollectedSearch.selectField(GarbageCollectedSearch.entity().getId());
+        SearchBuilder<NetworkOpVO> join7 = _ntwkOpDao.createSearchBuilder();
+        join7.and("activenics", join7.entity().getActiveNicsCount(), Op.EQ);
+        join7.and("gc", join7.entity().isGarbageCollected(), Op.EQ);
+        join7.and("check", join7.entity().isCheckForGc(), Op.EQ);
+        GarbageCollectedSearch.join("ntwkOpGC", join7, GarbageCollectedSearch.entity().getId(), join7.entity().getId(), JoinBuilder.JoinType.INNER);
+        SearchBuilder<NetworkOfferingVO> join8 = _ntwkOffDao.createSearchBuilder();
+        join8.and("isPersistent", join8.entity().getIsPersistent(), Op.EQ);
+        GarbageCollectedSearch.join("ntwkOffGC", join8, GarbageCollectedSearch.entity().getNetworkOfferingId(), join8.entity().getId(), JoinBuilder.JoinType.INNER);
+        GarbageCollectedSearch.done();
+
+    }
+
+    @Override
+    public List<NetworkVO> listByZoneAndGuestType(long accountId, long dataCenterId, Network.GuestType type, Boolean isSystem) {
+        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+        sc.setParameters("datacenter", dataCenterId);
+        sc.setParameters("account", accountId);
+        if (type != null) {
+            sc.setParameters("guestType", type);
+        }
+        
+        if (isSystem != null) {
+            sc.setJoinParameters("offerings", "isSystem", isSystem);
+        }
+        
+        return listBy(sc, null);
+    }
+
+    public List<NetworkVO> findBy(TrafficType trafficType, Mode mode, BroadcastDomainType broadcastType, long networkOfferingId, long dataCenterId) {
+        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+        sc.setParameters("trafficType", trafficType);
+        sc.setParameters("broadcastType", broadcastType);
+        sc.setParameters("offering", networkOfferingId);
+        sc.setParameters("datacenter", dataCenterId);
+
+        return search(sc, null);
+    }
+
+    @Override
+    public List<NetworkVO> listBy(long accountId, long offeringId, long dataCenterId) {
+        SearchCriteria<NetworkVO> sc = AccountSearch.create();
+        sc.setParameters("offering", offeringId);
+        sc.setJoinParameters("accounts", "account", accountId);
+        sc.setParameters("datacenter", dataCenterId);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<NetworkVO> listBy(long accountId, long dataCenterId, String cidr, boolean skipVpc) {
+        SearchCriteria<NetworkVO> sc = AccountSearch.create();
+        sc.setJoinParameters("accounts", "account", accountId);
+        sc.setParameters("datacenter", dataCenterId);
+        sc.setParameters("cidr", cidr);
+        if (skipVpc) {
+            sc.setParameters("vpcId", (Object)null);
+        }
+
+        return listBy(sc);
+    }
+
+    @Override
+    @DB
+    public NetworkVO persist(NetworkVO network, boolean gc, Map<String, String> serviceProviderMap) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+
+        // 1) create network
+        NetworkVO newNetwork = super.persist(network);
+        // 2) add account to the network
+        addAccountToNetwork(network.getId(), network.getAccountId(), true);
+        // 3) add network to gc monitor table
+        NetworkOpVO op = new NetworkOpVO(network.getId(), gc);
+        _opDao.persist(op);
+        // 4) add services/providers for the network
+        persistNetworkServiceProviders(newNetwork.getId(), serviceProviderMap);
+
+        txn.commit();
+        return newNetwork;
+    }
+
+    @Override
+    @DB
+    public boolean update(Long networkId, NetworkVO network, Map<String, String> serviceProviderMap) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+
+        super.update(networkId, network);
+        if (serviceProviderMap != null) {
+            _ntwkSvcMap.deleteByNetworkId(networkId);
+            persistNetworkServiceProviders(networkId, serviceProviderMap);
+        }
+
+        txn.commit();
+        return true;
+    }
+
+    @Override
+    @DB
+    public void persistNetworkServiceProviders(long networkId, Map<String, String> serviceProviderMap) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        for (String service : serviceProviderMap.keySet()) {
+            NetworkServiceMapVO serviceMap = new NetworkServiceMapVO(networkId, Service.getService(service), Provider.getProvider(serviceProviderMap.get(service)));
+            _ntwkSvcMap.persist(serviceMap);
+        }
+        txn.commit();
+    }
+
+    protected void addAccountToNetwork(long networkId, long accountId, boolean isOwner) {
+        NetworkAccountVO account = new NetworkAccountVO(networkId, accountId, isOwner);
+        _accountsDao.persist(account);
+    }
+
+    @Override
+    public SearchBuilder<NetworkAccountVO> createSearchBuilderForAccount() {
+        return _accountsDao.createSearchBuilder();
+    }
+
+    @Override
+    public List<NetworkVO> getNetworksForOffering(long offeringId, long dataCenterId, long accountId) {
+        SearchCriteria<NetworkVO> sc = RelatedConfigSearch.create();
+        sc.setParameters("offering", offeringId);
+        sc.setParameters("dc", dataCenterId);
+        sc.setJoinParameters("account", "account", accountId);
+        return search(sc, null);
+    }
+
+    @Override
+    public String getNextAvailableMacAddress(long networkConfigId) {
+        SequenceFetcher fetch = SequenceFetcher.getInstance();
+
+        long seq = fetch.getNextSequence(Long.class, _tgMacAddress, networkConfigId);
+        seq = seq | _prefix << 40 | ((_rand.nextInt(Short.MAX_VALUE) << 16) & 0x00000000ffff0000l);
+        return NetUtils.long2Mac(seq);
+    }
+
+    @Override
+    public List<NetworkVO> listBy(long accountId, long networkId) {
+        SearchCriteria<NetworkVO> sc = AccountNetworkSearch.create();
+        sc.setParameters("networkId", networkId);
+        sc.setJoinParameters("networkSearch", "accountId", accountId);
+        return listBy(sc);
+    }
+
+    @Override
+    public long countByZoneAndUri(long zoneId, String broadcastUri) {
+
+        SearchCriteria<Long> sc = CountByZoneAndURI.create();
+        sc.setParameters("dataCenterId", zoneId);
+        sc.setParameters("broadcastUri", broadcastUri);
+        
+        return customSearch(sc, null).get(0);
+    }
+
+    @Override
+    public List<NetworkVO> listByZone(long zoneId) {
+        SearchCriteria<NetworkVO> sc = ZoneBroadcastUriSearch.create();
+        sc.setParameters("dataCenterId", zoneId);
+        return search(sc, null);
+    }
+
+    @Override
+    public long countByZoneUriAndGuestType(long zoneId, String broadcastUri, GuestType guestType) {
+        SearchCriteria<Long> sc = CountByZoneAndURI.create();
+        sc.setParameters("dataCenterId", zoneId);
+        sc.setParameters("broadcastUri", broadcastUri);
+        sc.setParameters("guestType", guestType);
+        return customSearch(sc, null).get(0);
+    }
+
+    @Override
+    public List<NetworkVO> listByZoneSecurityGroup(Long zoneId) {
+        SearchCriteria<NetworkVO> sc = ZoneSecurityGroupSearch.create();
+        if (zoneId != null) {
+            sc.setParameters("dataCenterId", zoneId);
+        }
+        sc.setJoinParameters("services", "service", Service.SecurityGroup.getName());
+        return search(sc, null);
+    }
+
+    @Override
+    public void changeActiveNicsBy(long networkId, int count) {
+        _opDao.changeActiveNicsBy(networkId, count);
+    }
+
+    @Override
+    public int getActiveNicsIn(long networkId) {
+        return _opDao.getActiveNics(networkId);
+    }
+
+    @Override
+    public List<Long> findNetworksToGarbageCollect() {
+        SearchCriteria<Long> sc = GarbageCollectedSearch.create();
+        sc.setJoinParameters("ntwkOffGC", "isPersistent", false);
+        sc.setJoinParameters("ntwkOpGC", "activenics", 0);
+        sc.setJoinParameters("ntwkOpGC", "gc", true);
+        sc.setJoinParameters("ntwkOpGC", "check", true);
+        return customSearch(sc, null);
+    }
+
+    @Override
+    public void clearCheckForGc(long networkId) {
+        _opDao.clearCheckForGc(networkId);
+    }
+    
+    @Override
+    public void setCheckForGc(long networkId) {
+        _opDao.setCheckForGc(networkId);
+    }
+
+    @Override
+    public List<NetworkVO> listByOwner(long ownerId) {
+        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+        sc.setParameters("account", ownerId);
+        return listBy(sc);
+    }
+
+    @Override
+    public void addDomainToNetwork(long networkId, long domainId, Boolean subdomainAccess) {
+        addDomainToNetworknetwork(networkId, domainId, subdomainAccess);
+    }
+
+    protected void addDomainToNetworknetwork(long networkId, long domainId, Boolean subdomainAccess) {
+        NetworkDomainVO domain = new NetworkDomainVO(networkId, domainId, subdomainAccess);
+        _domainsDao.persist(domain);
+    }
+    
+    
+    @Override
+    public int getNetworkCountByVpcId(long vpcId) {
+        SearchCriteria<Integer> sc = CountBy.create();
+        sc.setParameters("vpcId", vpcId);
+        List<Integer> results = customSearch(sc, null);
+        return results.get(0);
+    }
+    
+
+    @Override
+    public List<NetworkVO> listSecurityGroupEnabledNetworks() {
+        SearchCriteria<NetworkVO> sc = SecurityGroupSearch.create();
+        sc.setJoinParameters("services", "service", Service.SecurityGroup.getName());
+        return listBy(sc);
+    }
+
+    @Override
+    public List<NetworkVO> listByPhysicalNetwork(long physicalNetworkId) {
+        SearchCriteria<NetworkVO> sc = PhysicalNetworkSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<NetworkVO> listByPhysicalNetworkTrafficType(long physicalNetworkId, TrafficType trafficType) {
+        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+        sc.setParameters("trafficType", trafficType);
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<NetworkVO> listByPhysicalNetworkAndProvider(long physicalNetworkId, String providerName) {
+        SearchBuilder<NetworkServiceMapVO> svcProviderMapSearch = _ntwkSvcMap.createSearchBuilder();
+        NetworkServiceMapVO svcProviderEntry = svcProviderMapSearch.entity();
+        svcProviderMapSearch.and("Provider", svcProviderMapSearch.entity().getProvider(), SearchCriteria.Op.EQ);
+
+        SearchBuilder<NetworkVO> networksSearch = createSearchBuilder();
+        networksSearch.and("physicalNetworkId", networksSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        networksSearch.join("svcProviderMapSearch", svcProviderMapSearch, networksSearch.entity().getId(), svcProviderEntry.getNetworkId(), JoinBuilder.JoinType.INNER);
+
+        SearchCriteria<NetworkVO> sc = networksSearch.create();
+        sc.setJoinParameters("svcProviderMapSearch", "Provider", providerName);
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<NetworkVO> listBy(long accountId, long dataCenterId, Network.GuestType type, TrafficType trafficType) {
+        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+        sc.setParameters("datacenter", dataCenterId);
+        sc.setParameters("account", accountId);
+        sc.setParameters("guestType", type);
+        sc.setParameters("trafficType", trafficType);
+
+        return listBy(sc, null);
+    }
+
+    @Override
+    public List<NetworkVO> listByZoneAndTrafficType(long zoneId, TrafficType trafficType) {
+        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+        sc.setParameters("datacenter", zoneId);
+        sc.setParameters("trafficType", trafficType);
+
+        return listBy(sc, null);
+    }
+    
+    @Override
+    public int getNetworkCountByNetworkOffId(long networkOfferingId) {
+        SearchCriteria<Integer> sc = NetworksCount.create();
+        sc.setParameters("networkOfferingId", networkOfferingId);
+        List<Integer> count = customSearch(sc, null);
+        return count.get(0);
+    }
+    
+    @Override
+    public long countNetworksUserCanCreate(long ownerId) {
+        SearchCriteria<Long> sc = NetworksRegularUserCanCreateSearch.create();
+        sc.setParameters("aclType", ACLType.Account);
+        sc.setJoinParameters("accounts", "account", ownerId);
+        sc.setJoinParameters("ntwkOff", "specifyVlan", false);
+        return customSearch(sc, null).get(0);
+    }
+    
+    
+    @Override
+    public List<NetworkVO> listSourceNATEnabledNetworks(long accountId, long dataCenterId, Network.GuestType type) {
+        SearchCriteria<NetworkVO> sc = SourceNATSearch.create();
+        sc.setParameters("datacenter", dataCenterId);
+        sc.setParameters("account", accountId);
+        sc.setParameters("guestType", type);
+        sc.setJoinParameters("services", "service", Service.SourceNat.getName());
+        return listBy(sc);
+    }
+    
+    @Override
+    public List<NetworkVO> listByVpc(long vpcId) {
+        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+        sc.setParameters("vpcId", vpcId);
+
+        return listBy(sc, null);
+    }
+
+
+    @Override
+    public NetworkVO getPrivateNetwork(String broadcastUri, String cidr, long accountId, long zoneId) {
+        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+        sc.setParameters("datacenter", zoneId);
+        sc.setParameters("broadcastUri", broadcastUri);
+        sc.setParameters("cidr", cidr);
+        sc.setParameters("account", accountId);
+        sc.setParameters("offering", _ntwkOffDao.findByUniqueName(NetworkOffering.SystemPrivateGatewayNetworkOffering).getId());
+        return findOneBy(sc);
+    }
+
+    @Override
+    @DB
+    public boolean remove(Long id) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        NetworkVO entry = findById(id);
+        if (entry != null) {
+            _tagsDao.removeByIdAndType(id, TaggedResourceType.Network);
+        }
+        boolean result = super.remove(id);
+        txn.commit();
+        return result;
+    }
+
+    @Override
+    public long countVpcNetworks(long vpcId) {
+        SearchCriteria<Long> sc = VpcNetworksCount.create();
+        sc.setParameters("vpcId", vpcId);
+        return customSearch(sc, null).get(0);
+    }
+
+    @Override
+    public boolean updateState(State currentState, Event event, State nextState, Network vo, Object data) {
+       // TODO: ensure this update is correct
+       Transaction txn = Transaction.currentTxn();
+       txn.start();
+
+       NetworkVO networkVo = (NetworkVO) vo;
+       networkVo.setState(nextState);
+       super.update(networkVo.getId(), networkVo);
+
+       txn.commit();
+       return true;
+    }
+
+    @Override
+    public List<NetworkVO> listNetworksByAccount(long accountId, long zoneId, Network.GuestType type, boolean isSystem) {
+        SearchCriteria<NetworkVO> sc = OfferingAccountNetworkSearch.create();
+        sc.setJoinParameters("ntwkOfferingSearch", "isSystem", isSystem);
+        sc.setJoinParameters("ntwkAccountSearch", "accountId", accountId);
+        sc.setParameters("zoneId", zoneId);
+        sc.setParameters("type", type);
+
+        List<NetworkVO> networks = search(sc, null);
+        return networks;
+    }
+
+    @Override
+    public List<NetworkVO> listRedundantNetworks() {
+        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+        sc.setJoinParameters("offerings", "isRedundant", true);
+        return listBy(sc, null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkDomainDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkDomainDao.java b/engine/schema/src/com/cloud/network/dao/NetworkDomainDao.java
new file mode 100644
index 0000000..6689892
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkDomainDao.java
@@ -0,0 +1,27 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface NetworkDomainDao extends GenericDao<NetworkDomainVO, Long>{
+    List<NetworkDomainVO> listDomainNetworkMapByDomain(Object... domainId);
+    NetworkDomainVO getDomainNetworkMapByNetworkId(long networkId);
+    List<Long> listNetworkIdsByDomain(long domainId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkDomainDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkDomainDaoImpl.java b/engine/schema/src/com/cloud/network/dao/NetworkDomainDaoImpl.java
new file mode 100644
index 0000000..bbb9203
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkDomainDaoImpl.java
@@ -0,0 +1,75 @@
+// 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.network.dao;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value=NetworkDomainDao.class) @DB(txn=false)
+public class NetworkDomainDaoImpl extends GenericDaoBase<NetworkDomainVO, Long> implements NetworkDomainDao {
+    final SearchBuilder<NetworkDomainVO> AllFieldsSearch;
+    final SearchBuilder<NetworkDomainVO> DomainsSearch;
+    
+    protected NetworkDomainDaoImpl() {
+        super();
+        
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("domainId", AllFieldsSearch.entity().getDomainId(), Op.EQ);
+        AllFieldsSearch.and("networkId", AllFieldsSearch.entity().getNetworkId(), Op.EQ);
+        AllFieldsSearch.done();
+        
+        DomainsSearch = createSearchBuilder();
+        DomainsSearch.and("domainId", DomainsSearch.entity().getDomainId(), Op.IN);
+        DomainsSearch.done();
+    }
+    
+    @Override
+    public List<NetworkDomainVO> listDomainNetworkMapByDomain(Object... domainId) {
+        SearchCriteria<NetworkDomainVO> sc = DomainsSearch.create();
+        sc.setParameters("domainId", (Object[])domainId);
+        
+        return listBy(sc);
+    }
+    
+    @Override
+    public NetworkDomainVO getDomainNetworkMapByNetworkId(long networkId) {
+        SearchCriteria<NetworkDomainVO> sc = AllFieldsSearch.create();
+        sc.setParameters("networkId", networkId);
+        return findOneBy(sc);
+    }
+    
+    @Override
+    public List<Long> listNetworkIdsByDomain(long domainId) {
+        List<Long> networkIdsToReturn = new ArrayList<Long>();
+        List<NetworkDomainVO> maps = listDomainNetworkMapByDomain(domainId);
+        for (NetworkDomainVO map : maps) {
+            networkIdsToReturn.add(map.getNetworkId());
+        } 
+        return networkIdsToReturn;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkDomainVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkDomainVO.java b/engine/schema/src/com/cloud/network/dao/NetworkDomainVO.java
new file mode 100644
index 0000000..bb4e904
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkDomainVO.java
@@ -0,0 +1,72 @@
+// 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.network.dao;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.domain.PartOf;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="domain_network_ref")
+public class NetworkDomainVO implements PartOf, InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    long id;
+    
+    @Column(name="domain_id")
+    long domainId;
+    
+    @Column(name="network_id")
+    long networkId;
+    
+    @Column(name="subdomain_access")
+    public
+    Boolean subdomainAccess;
+
+    protected NetworkDomainVO() {
+    }
+    
+    public NetworkDomainVO(long networkId, long domainId, Boolean subdomainAccess) {
+        this.networkId = networkId;
+        this.domainId = domainId;
+        this.subdomainAccess = subdomainAccess;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+    
+    public long getNetworkId() {
+        return networkId;
+    }
+
+	public Boolean isSubdomainAccess() {
+		return subdomainAccess;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkExternalFirewallDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkExternalFirewallDao.java b/engine/schema/src/com/cloud/network/dao/NetworkExternalFirewallDao.java
new file mode 100644
index 0000000..9e255dc
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkExternalFirewallDao.java
@@ -0,0 +1,38 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface NetworkExternalFirewallDao extends GenericDao<NetworkExternalFirewallVO, Long> {
+
+    /**
+     * find the network to firewall device mapping corresponding to a network
+     * @param lbDeviceId guest network Id
+     * @return return NetworkExternalFirewallDao for the guest network
+     */    
+    NetworkExternalFirewallVO findByNetworkId(long networkId);
+
+    /**
+     * list all network to firewall device mappings corresponding to a firewall device Id
+     * @param lbDeviceId firewall device Id
+     * @return list of NetworkExternalFirewallVO mappings corresponding to the networks mapped to the firewall device 
+     */    
+    List<NetworkExternalFirewallVO> listByFirewallDeviceId(long lbDeviceId);	
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkExternalFirewallDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkExternalFirewallDaoImpl.java b/engine/schema/src/com/cloud/network/dao/NetworkExternalFirewallDaoImpl.java
new file mode 100644
index 0000000..b176760
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkExternalFirewallDaoImpl.java
@@ -0,0 +1,61 @@
+// 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.network.dao;
+
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value=NetworkExternalFirewallDao.class) @DB(txn=false)
+public class NetworkExternalFirewallDaoImpl extends GenericDaoBase<NetworkExternalFirewallVO, Long> implements NetworkExternalFirewallDao {
+
+    final SearchBuilder<NetworkExternalFirewallVO> networkIdSearch;
+    final SearchBuilder<NetworkExternalFirewallVO> deviceIdSearch;
+    protected NetworkExternalFirewallDaoImpl() {
+        super();
+        networkIdSearch = createSearchBuilder();
+        networkIdSearch.and("networkId", networkIdSearch.entity().getNetworkId(), Op.EQ);
+        networkIdSearch.done();
+        deviceIdSearch = createSearchBuilder();
+        deviceIdSearch.and("externalFWDeviceId", deviceIdSearch.entity().getExternalFirewallDeviceId(), Op.EQ);
+        deviceIdSearch.done();
+    }
+
+    @Override
+    public NetworkExternalFirewallVO findByNetworkId(long networkId) {
+        SearchCriteria<NetworkExternalFirewallVO> sc = networkIdSearch.create();
+        sc.setParameters("networkId", networkId);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public List<NetworkExternalFirewallVO> listByFirewallDeviceId(long fwDeviceId) {
+        SearchCriteria<NetworkExternalFirewallVO> sc = deviceIdSearch.create();
+        sc.setParameters("externalFWDeviceId", fwDeviceId);
+        return search(sc, null);
+    }    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkExternalFirewallVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkExternalFirewallVO.java b/engine/schema/src/com/cloud/network/dao/NetworkExternalFirewallVO.java
new file mode 100644
index 0000000..3c33dd5
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkExternalFirewallVO.java
@@ -0,0 +1,88 @@
+// 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.network.dao;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+/**
+ * NetworkExternalFirewallVO contains information on the networks that are using external firewall
+  */
+
+@Entity
+@Table(name="network_external_firewall_device_map")
+public class NetworkExternalFirewallVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    @Column(name = "network_id")
+    private long networkId;
+
+    @Column(name = "external_firewall_device_id")
+    private long externalFirewallDeviceId;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    Date created;
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    Date removed;
+
+    public NetworkExternalFirewallVO(long networkId, long externalFirewallDeviceId) {
+        this.networkId = networkId;
+        this.externalFirewallDeviceId = externalFirewallDeviceId;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public NetworkExternalFirewallVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getNetworkId() {
+        return networkId;
+    }
+
+    public long getExternalFirewallDeviceId() {
+        return externalFirewallDeviceId;
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkExternalLoadBalancerDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkExternalLoadBalancerDao.java b/engine/schema/src/com/cloud/network/dao/NetworkExternalLoadBalancerDao.java
new file mode 100644
index 0000000..527d376
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkExternalLoadBalancerDao.java
@@ -0,0 +1,38 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface  NetworkExternalLoadBalancerDao extends GenericDao<NetworkExternalLoadBalancerVO, Long> {
+
+    /**
+     * find the network to load balancer device mapping corresponding to a network
+     * @param networkId guest network Id
+     * @return return NetworkExternalLoadBalancerVO for the guest network
+     */
+    NetworkExternalLoadBalancerVO findByNetworkId(long networkId);
+
+    /**
+     * list all network to load balancer device mappings corresponding to a load balancer device Id
+     * @param lbDeviceId load balancer device Id
+     * @return list of NetworkExternalLoadBalancerVO mappings corresponding to the networks mapped to the load balancer device 
+     */
+    List<NetworkExternalLoadBalancerVO> listByLoadBalancerDeviceId(long lbDeviceId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkExternalLoadBalancerDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkExternalLoadBalancerDaoImpl.java b/engine/schema/src/com/cloud/network/dao/NetworkExternalLoadBalancerDaoImpl.java
new file mode 100644
index 0000000..c29c164
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkExternalLoadBalancerDaoImpl.java
@@ -0,0 +1,62 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value=NetworkExternalLoadBalancerDao.class) @DB(txn=false)
+public class NetworkExternalLoadBalancerDaoImpl extends GenericDaoBase<NetworkExternalLoadBalancerVO, Long> implements NetworkExternalLoadBalancerDao {
+
+    final SearchBuilder<NetworkExternalLoadBalancerVO> networkIdSearch;
+    final SearchBuilder<NetworkExternalLoadBalancerVO> deviceIdSearch;
+    
+    protected NetworkExternalLoadBalancerDaoImpl() {
+        super();
+        networkIdSearch = createSearchBuilder();
+        networkIdSearch.and("networkId", networkIdSearch.entity().getNetworkId(), Op.EQ);
+        networkIdSearch.done();
+
+        deviceIdSearch = createSearchBuilder();
+        deviceIdSearch.and("externalLBDeviceId", deviceIdSearch.entity().getExternalLBDeviceId(), Op.EQ);
+        deviceIdSearch.done();
+    }
+
+    @Override
+    public NetworkExternalLoadBalancerVO findByNetworkId(long networkId) {
+        SearchCriteria<NetworkExternalLoadBalancerVO> sc = networkIdSearch.create();
+        sc.setParameters("networkId", networkId);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public List<NetworkExternalLoadBalancerVO> listByLoadBalancerDeviceId(long lbDeviceId) {
+        SearchCriteria<NetworkExternalLoadBalancerVO> sc = deviceIdSearch.create();
+        sc.setParameters("externalLBDeviceId", lbDeviceId);
+        return search(sc, null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkExternalLoadBalancerVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkExternalLoadBalancerVO.java b/engine/schema/src/com/cloud/network/dao/NetworkExternalLoadBalancerVO.java
new file mode 100644
index 0000000..820759c
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkExternalLoadBalancerVO.java
@@ -0,0 +1,89 @@
+// 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.network.dao;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+/**
+ * NetworkExternalLoadBalancerVO contains mapping of a network and the external load balancer device id assigned to the network
+  */
+
+@Entity
+@Table(name="network_external_lb_device_map")
+public class NetworkExternalLoadBalancerVO implements InternalIdentity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    @Column(name = "network_id")
+    private long networkId;
+
+    @Column(name = "external_load_balancer_device_id")
+    private long externalLBDeviceId;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    Date created;
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    Date removed;
+
+    public NetworkExternalLoadBalancerVO(long networkId, long externalLBDeviceID) {
+        this.networkId = networkId;
+        this.externalLBDeviceId = externalLBDeviceID;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public NetworkExternalLoadBalancerVO(){
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getNetworkId() {
+        return networkId;
+    }
+
+    public long getExternalLBDeviceId() {
+        return externalLBDeviceId;
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkOpDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkOpDao.java b/engine/schema/src/com/cloud/network/dao/NetworkOpDao.java
new file mode 100644
index 0000000..f492dbd
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkOpDao.java
@@ -0,0 +1,26 @@
+// 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.network.dao;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface NetworkOpDao extends GenericDao<NetworkOpVO, Long> {
+    public int getActiveNics(long networkId);
+    public void changeActiveNicsBy(long networkId, int count);
+    public void setCheckForGc(long networkId);
+    public void clearCheckForGc(long networkId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkOpDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkOpDaoImpl.java b/engine/schema/src/com/cloud/network/dao/NetworkOpDaoImpl.java
new file mode 100644
index 0000000..a3f54b7
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkOpDaoImpl.java
@@ -0,0 +1,84 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.Attribute;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.UpdateBuilder;
+
+@Component
+public class NetworkOpDaoImpl extends GenericDaoBase<NetworkOpVO, Long> implements NetworkOpDao {
+    protected final SearchBuilder<NetworkOpVO> AllFieldsSearch;
+    protected final GenericSearchBuilder<NetworkOpVO, Integer> ActiveNicsSearch;
+    protected final Attribute _activeNicsAttribute;
+    
+    protected NetworkOpDaoImpl() {
+        super();
+        
+        ActiveNicsSearch = createSearchBuilder(Integer.class);
+        ActiveNicsSearch.selectField(ActiveNicsSearch.entity().getActiveNicsCount());
+        ActiveNicsSearch.and("network", ActiveNicsSearch.entity().getId(), Op.EQ);
+        ActiveNicsSearch.done();
+        
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("network", AllFieldsSearch.entity().getId(), Op.EQ);
+        AllFieldsSearch.done();
+
+        _activeNicsAttribute = _allAttributes.get("activeNicsCount");
+        assert _activeNicsAttribute != null : "Cannot find activeNicsCount";
+    }
+
+    public int getActiveNics(long networkId) {
+        SearchCriteria<Integer> sc = ActiveNicsSearch.create();
+        sc.setParameters("network", networkId);
+        
+        return customSearch(sc, null).get(0);
+    }
+    
+    public void changeActiveNicsBy(long networkId, int count) {
+        
+        SearchCriteria<NetworkOpVO> sc = AllFieldsSearch.create();
+        sc.setParameters("network", networkId);
+
+        NetworkOpVO vo = createForUpdate();
+        UpdateBuilder builder = getUpdateBuilder(vo);
+        builder.incr(_activeNicsAttribute, count);
+        
+        update(builder, sc, null);
+    }
+    
+    public void setCheckForGc(long networkId) {
+        NetworkOpVO vo = createForUpdate();
+        vo.setCheckForGc(true);
+        update(networkId, vo);
+    }
+    
+    public void clearCheckForGc(long networkId) {
+        NetworkOpVO vo = createForUpdate();
+        vo.setCheckForGc(false);
+        update(networkId, vo);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkOpVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkOpVO.java b/engine/schema/src/com/cloud/network/dao/NetworkOpVO.java
new file mode 100644
index 0000000..8d41727
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkOpVO.java
@@ -0,0 +1,76 @@
+// 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.network.dao;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="op_networks")
+public class NetworkOpVO implements InternalIdentity {
+    
+    @Id
+    @Column(name="id")
+    long id;
+    
+    @Column(name="nics_count")
+    int activeNicsCount;
+    
+    @Column(name="gc")
+    boolean garbageCollected;
+    
+    @Column(name="check_for_gc")
+    boolean checkForGc;
+
+    protected NetworkOpVO() {
+    }
+    
+    public NetworkOpVO(long id, boolean gc) {
+        this.id = id;
+        this.garbageCollected = gc;
+        this.checkForGc = gc;
+        this.activeNicsCount = 0;
+    }
+    
+    public long getId() {
+        return id;
+    }
+    
+    public long getActiveNicsCount() {
+        return activeNicsCount;
+    }
+    
+    public void setActiveNicsCount(int number) {
+        activeNicsCount += number;
+    }
+    
+    public boolean isGarbageCollected() {
+        return garbageCollected;
+    }
+    
+    public boolean isCheckForGc() {
+        return checkForGc;
+    }
+    
+    public void setCheckForGc(boolean check) {
+        checkForGc = check;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkRuleConfigDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkRuleConfigDao.java b/engine/schema/src/com/cloud/network/dao/NetworkRuleConfigDao.java
new file mode 100644
index 0000000..80e070a
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkRuleConfigDao.java
@@ -0,0 +1,26 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface NetworkRuleConfigDao extends GenericDao<NetworkRuleConfigVO, Long> {
+    List<NetworkRuleConfigVO> listBySecurityGroupId(long securityGroupId);
+    void deleteBySecurityGroup(long securityGroupId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkRuleConfigDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkRuleConfigDaoImpl.java b/engine/schema/src/com/cloud/network/dao/NetworkRuleConfigDaoImpl.java
new file mode 100644
index 0000000..a5af4fe
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkRuleConfigDaoImpl.java
@@ -0,0 +1,51 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value={NetworkRuleConfigDao.class})
+public class NetworkRuleConfigDaoImpl extends GenericDaoBase<NetworkRuleConfigVO, Long> implements NetworkRuleConfigDao {
+    protected SearchBuilder<NetworkRuleConfigVO> SecurityGroupIdSearch;
+
+    protected NetworkRuleConfigDaoImpl() {
+        SecurityGroupIdSearch  = createSearchBuilder();
+        SecurityGroupIdSearch.and("securityGroupId", SecurityGroupIdSearch.entity().getSecurityGroupId(), SearchCriteria.Op.EQ);
+        SecurityGroupIdSearch.done();
+    }
+
+    public List<NetworkRuleConfigVO> listBySecurityGroupId(long securityGroupId) {
+        SearchCriteria<NetworkRuleConfigVO> sc = SecurityGroupIdSearch.create();
+        sc.setParameters("securityGroupId", securityGroupId);
+        return listBy(sc);
+    }
+
+    public void deleteBySecurityGroup(long securityGroupId) {
+        SearchCriteria<NetworkRuleConfigVO> sc = SecurityGroupIdSearch.create();
+        sc.setParameters("securityGroupId", securityGroupId);
+        expunge(sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkRuleConfigVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkRuleConfigVO.java b/engine/schema/src/com/cloud/network/dao/NetworkRuleConfigVO.java
new file mode 100644
index 0000000..542c0bb
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkRuleConfigVO.java
@@ -0,0 +1,93 @@
+// 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.network.dao;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.async.AsyncInstanceCreateStatus;
+import com.google.gson.annotations.Expose;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name=("network_rule_config"))
+public class NetworkRuleConfigVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private Long id;
+
+    @Column(name="security_group_id")
+    private long securityGroupId;
+
+    @Column(name="public_port")
+    private String publicPort;
+
+    @Column(name="private_port")
+    private String privatePort;
+
+    @Column(name="protocol")
+    private String protocol;
+    
+    @Expose
+    @Column(name="create_status", updatable = true, nullable=false)
+    @Enumerated(value=EnumType.STRING)
+    private AsyncInstanceCreateStatus createStatus;
+
+    public NetworkRuleConfigVO() {}
+
+    public NetworkRuleConfigVO(long securityGroupId, String publicPort, String privatePort, String protocol) {
+        this.securityGroupId = securityGroupId;
+        this.publicPort = publicPort;
+        this.privatePort = privatePort;
+        this.protocol = protocol;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getSecurityGroupId() {
+        return securityGroupId;
+    }
+
+    public String getPublicPort() {
+        return publicPort;
+    }
+
+    public String getPrivatePort() {
+        return privatePort;
+    }
+
+    public String getProtocol() {
+        return protocol;
+    }
+    
+    public AsyncInstanceCreateStatus getCreateStatus() {
+    	return createStatus;
+    }
+    
+    public void setCreateStatus(AsyncInstanceCreateStatus createStatus) {
+    	this.createStatus = createStatus;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkServiceMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkServiceMapDao.java b/engine/schema/src/com/cloud/network/dao/NetworkServiceMapDao.java
new file mode 100644
index 0000000..6d401c4
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkServiceMapDao.java
@@ -0,0 +1,39 @@
+// 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.network.dao;
+
+import java.util.List;
+
+import com.cloud.network.Network.Provider;
+import com.cloud.network.Network.Service;
+import com.cloud.utils.db.GenericDao;
+
+/**
+ * NetworkServiceDao deals with searches and operations done on the
+ * ntwk_service_map table.
+ *
+ */
+public interface NetworkServiceMapDao extends GenericDao<NetworkServiceMapVO, Long>{
+    boolean areServicesSupportedInNetwork(long networkId, Service... services);
+    boolean canProviderSupportServiceInNetwork(long networkId, Service service, Provider provider);
+    List<NetworkServiceMapVO> getServicesInNetwork(long networkId);
+    String getProviderForServiceInNetwork(long networkid, Service service);
+	void deleteByNetworkId(long networkId);
+	List<String> getDistinctProviders(long networkId);
+	String isProviderForNetwork(long networkId, Provider provider);
+	List<String> getProvidersForServiceInNetwork(long networkId, Service service);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkServiceMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkServiceMapDaoImpl.java b/engine/schema/src/com/cloud/network/dao/NetworkServiceMapDaoImpl.java
new file mode 100644
index 0000000..3cdd738
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkServiceMapDaoImpl.java
@@ -0,0 +1,176 @@
+// 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.network.dao;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.exception.UnsupportedServiceException;
+import com.cloud.network.Network.Provider;
+import com.cloud.network.Network.Service;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value=NetworkServiceMapDao.class) @DB(txn=false)
+public class NetworkServiceMapDaoImpl extends GenericDaoBase<NetworkServiceMapVO, Long> implements NetworkServiceMapDao {
+    final SearchBuilder<NetworkServiceMapVO> AllFieldsSearch;
+    final SearchBuilder<NetworkServiceMapVO> MultipleServicesSearch;
+    final GenericSearchBuilder<NetworkServiceMapVO, String> DistinctProvidersSearch;
+    
+    protected NetworkServiceMapDaoImpl() {
+        super();
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("networkId", AllFieldsSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("service", AllFieldsSearch.entity().getService(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("provider", AllFieldsSearch.entity().getProvider(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+        
+        MultipleServicesSearch = createSearchBuilder();
+        MultipleServicesSearch.and("networkId", MultipleServicesSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
+        MultipleServicesSearch.and("service", MultipleServicesSearch.entity().getService(), SearchCriteria.Op.IN);
+        MultipleServicesSearch.and("provider", MultipleServicesSearch.entity().getProvider(), SearchCriteria.Op.EQ);
+        MultipleServicesSearch.done();
+        
+        DistinctProvidersSearch = createSearchBuilder(String.class);
+        DistinctProvidersSearch.and("networkId", DistinctProvidersSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
+        DistinctProvidersSearch.and("provider", DistinctProvidersSearch.entity().getProvider(), SearchCriteria.Op.EQ);
+        DistinctProvidersSearch.and("service", DistinctProvidersSearch.entity().getService(), SearchCriteria.Op.EQ);
+        DistinctProvidersSearch.selectField(DistinctProvidersSearch.entity().getProvider());
+        DistinctProvidersSearch.done();
+    }
+    
+    @Override
+    public boolean areServicesSupportedInNetwork(long networkId, Service... services) {
+        SearchCriteria<NetworkServiceMapVO> sc = MultipleServicesSearch.create();
+        sc.setParameters("networkId", networkId);
+        
+        if (services != null) {
+            String[] servicesStr = new String[services.length];
+            
+            int i = 0;
+            for (Service service : services) {
+                servicesStr[i] = service.getName();
+                i++;
+            }
+            
+            sc.setParameters("service", (Object[])servicesStr);
+        }
+        
+        List<NetworkServiceMapVO> networkServices = listBy(sc);
+        
+        if (services != null) {
+            if (networkServices.size() == services.length) {
+                return true;
+            }
+        } else if (!networkServices.isEmpty()) {
+            return true;
+        }
+        
+        return false;
+    }
+    
+    @Override
+    public boolean canProviderSupportServiceInNetwork(long networkId, Service service, Provider provider) {
+        SearchCriteria<NetworkServiceMapVO> sc = AllFieldsSearch.create();
+        sc.setParameters("networkId", networkId);
+        sc.setParameters("service", service.getName());
+        sc.setParameters("provider", provider.getName());
+        if (findOneBy(sc) != null) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+    
+    protected List<String> getServicesForProviderInNetwork(long networkId, Provider provider) {
+        List<String> services = new ArrayList<String>();
+        SearchCriteria<NetworkServiceMapVO> sc = AllFieldsSearch.create();
+        sc.setParameters("networkId", networkId);
+        sc.setParameters("provider", provider.getName());
+        List<NetworkServiceMapVO> map = listBy(sc);
+        for (NetworkServiceMapVO instance : map) {
+            services.add(instance.getService());
+        }
+        
+        return services;
+    }
+    
+    @Override
+    public String getProviderForServiceInNetwork(long networkId, Service service) {
+        SearchCriteria<NetworkServiceMapVO> sc = AllFieldsSearch.create();
+        sc.setParameters("networkId", networkId);
+        sc.setParameters("service", service.getName());
+        NetworkServiceMapVO ntwkSvc = findOneBy(sc);
+        if (ntwkSvc == null) {
+            throw new UnsupportedServiceException("Service " + service.getName() + " is not supported in the network id=" + networkId);
+        }
+        
+        return ntwkSvc.getProvider();
+    }
+ 
+    @Override
+    public List<NetworkServiceMapVO> getServicesInNetwork(long networkId) {
+        SearchCriteria<NetworkServiceMapVO> sc = AllFieldsSearch.create();
+        sc.setParameters("networkId", networkId);
+        return listBy(sc);
+    }
+    
+    @Override
+    public void deleteByNetworkId(long networkId) {
+        SearchCriteria<NetworkServiceMapVO> sc = AllFieldsSearch.create();
+        sc.setParameters("networkId", networkId);
+        remove(sc);
+    }
+    
+    @Override
+    public List<String> getDistinctProviders(long networkId) {
+        SearchCriteria<String> sc = DistinctProvidersSearch.create();
+        sc.setParameters("networkId", networkId);
+        List<String> results = customSearch(sc, null);
+        return results;
+    }
+    
+    @Override
+    public String isProviderForNetwork(long networkId, Provider provider) {
+    	SearchCriteria<String> sc = DistinctProvidersSearch.create();
+        sc.setParameters("networkId", networkId);
+        sc.setParameters("provider", provider.getName());
+        List<String> results = customSearch(sc, null);
+        if (results.isEmpty()) {
+        	return null;
+        } else {
+        	return results.get(0);
+        }
+    }
+
+    @Override
+    public List<String> getProvidersForServiceInNetwork(long networkId, Service service) {
+        SearchCriteria<String> sc = DistinctProvidersSearch.create();
+        sc.setParameters("networkId", networkId);
+        sc.setParameters("service", service.getName());
+        return customSearch(sc, null);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/dao/NetworkServiceMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkServiceMapVO.java b/engine/schema/src/com/cloud/network/dao/NetworkServiceMapVO.java
new file mode 100644
index 0000000..7bb480b
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/NetworkServiceMapVO.java
@@ -0,0 +1,92 @@
+// 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.network.dao;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.network.Network;
+import com.cloud.network.Network.Provider;
+import com.cloud.network.Network.Service;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="ntwk_service_map")
+public class NetworkServiceMapVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+    
+    @Column(name="network_id")
+    long networkId;
+    
+    @Column(name="service")
+    String service;
+    
+    @Column(name="provider")
+    String provider;
+    
+    @Column(name=GenericDao.CREATED_COLUMN)
+    Date created;
+
+    public long getId() {
+        return id;
+    }
+
+    public long getNetworkId() {
+        return networkId;
+    }
+
+    public String getService() {
+        return service;
+    }
+
+    public String getProvider() {
+        return provider;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+    
+    public NetworkServiceMapVO() {
+    }
+    
+    public NetworkServiceMapVO(long networkId, Service service, Provider provider) {
+        this.networkId = networkId;
+        this.service = service.getName();
+        this.provider = provider.getName();
+    }
+    
+    public String toString() {
+        StringBuilder buf = new StringBuilder("[Network Service[");
+        return buf.append(networkId).append("-").append(service).append("-").append(provider).append("]").toString();
+    }
+}
+
+
+
+
+


[38/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/WEB-INF/classes/resources/messages_ar.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ar.properties b/client/WEB-INF/classes/resources/messages_ar.properties
new file mode 100644
index 0000000..4d3011b
--- /dev/null
+++ b/client/WEB-INF/classes/resources/messages_ar.properties
@@ -0,0 +1,285 @@
+# 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.
+
+
+changed.item.properties=\u062a\u063a\u064a\u0631 \u062e\u0635\u0627\u0626\u0635 \u0627\u0644\u0639\u0646\u0635\u0631
+confirm.enable.s3=\u0641\u0636\u0644\u0627 \u0642\u0645 \u0628\u062a\u0639\u0628\u0626\u0629 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0627\u0644\u0642\u0627\u062f\u0645\u0629 \u0644\u062a\u0645\u0643\u064a\u0646 \u0627\u0644\u062a\u062e\u0632\u064a\u0646 S3 \u0644\u0644\u0630\u0627\u0643\u0631\u0629 \u0627\u0644\u062b\u0627\u0646\u0648\u064a\u0629.
+instances.actions.reboot.label=\u0625\u0639\u0627\u062f\u0629 \u062a\u0634\u063a\u064a\u0644 \u0627\u0644\u0646\u0645\u0648\u0630\u062c
+label.accept.project.invitation=\u0642\u0628\u0648\u0644 \u062f\u0639\u0648\u0629 \u0627\u0644\u0645\u0634\u0631\u0648\u0639
+label.action.delete.system.service.offering=\u062d\u0630\u0641 \u0646\u0638\u0627\u0645 \u062a\u0642\u062f\u064a\u0645 \u0627\u0644\u062e\u062f\u0645\u0629
+label.action.disable.physical.network=\u062a\u0639\u0637\u064a\u0644 \u0634\u0628\u0643\u0629 \u0641\u064a\u0632\u064a\u0627\u0626\u064a\u0629
+label.action.enable.physical.network=\u062a\u0645\u0643\u064a\u0646 \u0634\u0628\u0643\u0629 \u0641\u064a\u0632\u064a\u0627\u0626\u064a\u0629
+label.activate.project=\u062a\u0641\u0639\u064a\u0644 \u0627\u0644\u0645\u0634\u0631\u0648\u0639
+label.add.accounts.to=\u0625\u0636\u0627\u0641\u0629 \u062d\u0633\u0627\u0628\u0627\u062a \u0625\u0644\u0649
+label.add.accounts=\u0625\u0636\u0627\u0641\u0629 \u062d\u0633\u0627\u0628\u0627\u062a
+label.add.account.to.project=\u0625\u0636\u0627\u0641\u0629 \u062d\u0633\u0627\u0628 \u0644\u0644\u0645\u0634\u0631\u0648\u0639
+label.add.ACL=\u0625\u0636\u0627\u0641\u0629 ACL
+label.add.network.ACL=\u0625\u0636\u0627\u0641\u0629 \u0634\u0628\u0643\u0629 ACL
+label.add.new.gateway=\u0623\u0636\u0641 \u0628\u0648\u0627\u0628\u0629 \u062c\u062f\u064a\u062f\u0629
+label.add.new.tier=\u0625\u0636\u0627\u0641\u0629 \u0637\u0628\u0642\u0629 \u062c\u062f\u064a\u062f\u0629
+label.add.port.forwarding.rule=\u0625\u0636\u0627\u0641\u0629 \u0642\u0627\u0639\u062f\u0629 \u0645\u0646\u0641\u0630 \u0625\u0639\u0627\u062f\u0629 \u0627\u0644\u062a\u0648\u062c\u064a\u0647
+label.add.route=\u0625\u0636\u0627\u0641\u0629 \u0645\u0633\u0627\u0631
+label.add.rule=\u0625\u0636\u0627\u0641\u0629 \u0642\u0627\u0639\u062f\u0629
+label.add.static.route=\u0625\u0636\u0627\u0641\u0629 \u062a\u0648\u062c\u064a\u0647 \u062b\u0627\u0628\u062a
+label.add.to.group=\u0625\u0636\u0627\u0641\u0629 \u0625\u0644\u0649 \u0627\u0644\u0645\u062c\u0645\u0648\u0639\u0629
+label.add.VM.to.tier=\u0625\u0636\u0627\u0641\u0629 \u062c\u0647\u0627\u0632 \u0625\u0641\u062a\u0631\u0627\u0636\u064a \u0641\u064a \u0637\u0628\u0642\u0629
+label.add.vpc=\u0625\u0636\u0627\u0641\u0629 \u0633\u062d\u0627\u0628\u0629 \u0625\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u062e\u0627\u0635\u0629
+label.add.VPN.gateway=\u0623\u0636\u0641 \u0628\u0648\u0627\u0628\u0629 \u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u0627\u0644\u0634\u062e\u0635\u064a\u0629
+label.allocated=\u062a\u062e\u0635\u064a\u0635
+label.apply=\u062a\u0637\u0628\u064a\u0642
+label.associated.network=\u0634\u0628\u0643\u0629 \u0645\u0631\u062a\u0628\u0637\u0629
+label.broadcast.uri=\u0628\u062b \u0627\u0644\u0631\u0627\u0628\u0637
+label.change.value=\u062a\u063a\u064a\u0631 \u0627\u0644\u0642\u064a\u0645\u0629
+label.CIDR.list=\u0642\u0627\u0626\u0645\u0629 CIDR
+label.CIDR.of.destination.network=CIDR \u0627\u0644\u062e\u0627\u0635 \u0628\u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0645\u0648\u062c\u0647\u0629.
+label.clean.up=\u062a\u0646\u0638\u064a\u0641
+label.clear.list=\u0645\u0633\u062d \u0627\u0644\u0642\u0627\u0626\u0645\u0629
+label.configuration=\u0627\u0644\u062a\u0643\u0648\u064a\u0646
+label.configure.network.ACLs=\u0636\u0628\u0637 \u0634\u0628\u0643\u0629 ACLs
+label.configure=\u0642\u0645 \u0628\u062a\u0643\u0648\u064a\u0646
+label.configure.vpc=\u062a\u0643\u0648\u064a\u0646 VPC
+label.corrections.saved=\u062a\u0645 \u062d\u0641\u0638 \u0627\u0644\u062a\u0635\u062d\u064a\u062d\u0627\u062a
+label.cpu.mhz=\u0648\u062d\u062f\u0629 \u0627\u0644\u0645\u0639\u0627\u0644\u062c\u0629 \u0627\u0644\u0645\u0631\u0643\u0632\u064a\u0629 (\u0628\u0627\u0644\u0645\u064a\u063a\u0627\u0647\u064a\u0631\u062a\u0632)
+label.cpu=\u00d9\u0088\u00d8\u00ad\u00d8\u00af\u00d8\u00a9 \u00d8\u00a7\u00d9\u0084\u00d9
+label.create.project=\u0623\u0646\u0634\u0626 \u0645\u0634\u0631\u0648\u0639
+label.create.VPN.connection=\u0625\u0646\u0634\u0627\u0621 \u0627\u062a\u0635\u0627\u0644 \u0628\u0648\u0627\u0628\u0629 \u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u0627\u0644\u0634\u062e\u0635\u064a\u0629
+label.dead.peer.detection=\u0643\u0634\u0641 \u0627\u0644\u0642\u0631\u064a\u0646 \u0627\u0644\u0645\u0641\u0642\u0648\u062f
+label.decline.invitation=\u0631\u0641\u0636 \u0627\u0644\u062f\u0639\u0648\u0629
+label.default=\u0627\u0644\u0625\u0641\u062a\u0631\u0627\u0636\u064a
+label.default.view=\u0637\u0631\u064a\u0642\u0629 \u0627\u0644\u0639\u0631\u0636 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629
+label.delete.gateway=\u0627\u062d\u0630\u0641 \u0627\u0644\u0628\u0648\u0627\u0628\u0629
+label.delete.project=\u062d\u0630\u0641 \u0627\u0644\u0645\u0634\u0631\u0648\u0639
+label.delete.VPN.connection=\u0627\u062d\u0630\u0641 \u0628\u0648\u0627\u0628\u0629 \u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u0627\u0644\u0634\u062e\u0635\u064a\u0629
+label.delete.VPN.customer.gateway=\u062d\u0630\u0641 \u0628\u0648\u0627\u0628\u0629 VPN \u0627\u0644\u0645\u062e\u0635\u0635\u0629
+label.delete.VPN.gateway=\u0627\u062d\u0630\u0641 \u0628\u0648\u0627\u0628\u0629 \u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u0627\u0644\u0634\u062e\u0635\u064a\u0629
+label.destroy=\u0647\u062f\u0645
+label.devices=\u0627\u0644\u0623\u062c\u0647\u0632\u0629
+label.direct.ips=\u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0645\u0634\u062a\u0631\u0643\u0629 IPs
+label.display.name=\u0639\u0631\u0636 \u0627\u0644\u0627\u0633\u0645
+label.DNS.domain.for.guest.networks=\u0645\u062c\u0627\u0644 DNS \u0644\u0634\u0628\u0643\u0627\u062a \u0627\u0644\u0632\u0627\u0626\u0631
+label.dns=\u0646\u0638\u0627\u0645 \u062a\u0633\u0645\u064a\u0629 \u0627\u0644\u0645\u062c\u0627\u0644 DNS
+label.drag.new.position=\u0627\u0633\u062d\u0628 \u0644\u0645\u0648\u0642\u0641 \u062c\u062f\u064a\u062f
+label.edit.network.details=\u062a\u062d\u0631\u064a\u0631 \u062a\u0641\u0627\u0635\u064a\u0644 \u0627\u0644\u0634\u0628\u0643\u0629
+label.edit.project.details=\u0627\u0636\u0627\u0641\u0629 \u062a\u0641\u0627\u0635\u064a\u0644 \u0627\u0644\u0645\u0634\u0631\u0648\u0639
+label.edit.tags=\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0639\u0644\u0627\u0645\u0627\u062a
+label.edit.vpc=\u062a\u0639\u062f\u064a\u0644 VPC
+label.egress.rules=\u0642\u0648\u0627\u0639\u062f \u0627\u0644\u062e\u0631\u0648\u062c
+label.elastic=\u0645\u0631\u0646
+label.enable.s3=\u062a\u0645\u0643\u064a\u0646 \u0627\u0644\u062a\u062e\u0632\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u0648\u064a S3
+label.endpoint=\u0646\u0642\u0637\u0629 \u0627\u0644\u0646\u0647\u0627\u064a\u0629
+label.error=\u062e\u0637\u0623
+label.ESP.lifetime=\u0639\u0645\u0631 ESP (\u062b\u0627\u0646\u064a\u0629)
+label.ESP.policy=\u0633\u064a\u0627\u0633\u0629 ESP
+label.filterBy=\u062a\u0635\u0641\u064a\u0629 \u062d\u0633\u0628
+label.full.path=\u0645\u0633\u0627\u0631 \u0643\u0627\u0645\u0644
+label.guest.type=\u0646\u0648\u0639 \u0627\u0644\u0636\u064a\u0641
+label.IKE.lifetime=\u0639\u0645\u0631 IKE (\u062b\u0627\u0646\u064a\u0629)
+label.IKE.policy=\u0633\u064a\u0627\u0633\u0629 IKE
+label.instances=\u0627\u0644\u062d\u0627\u0644\u0627\u062a
+label.invitations=\u062f\u0639\u0648\u0627\u062a
+label.invited.accounts=\u062f\u0639\u0648\u0629 \u062d\u0633\u0627\u0628\u0627\u062a
+label.invite.to=\u062f\u0639\u0648\u0629 \u0644\u0640
+label.IPsec.preshared.key=\u0645\u0641\u062a\u0627\u062d \u0623\u0645\u0646 \u0628\u0631\u0648\u062a\u0648\u0643\u0648\u0644 \u0627\u0644\u0625\u0646\u062a\u0631\u0646\u062a \u062a\u0645\u062a \u0645\u0634\u0627\u0631\u0643\u062a\u0647 \u0645\u0633\u0628\u0642\u0627
+label.isolation.uri=\u0639\u0632\u0644 \u0627\u0644\u0631\u0627\u0628\u0637
+label.keyboard.type=\u0646\u0648\u0639 \u0644\u0648\u062d\u0629 \u0627\u0644\u0645\u0641\u0627\u062a\u064a\u062d
+label.least.connections=\u0623\u0642\u0644 \u0627\u0644\u0625\u062a\u0635\u0627\u0644\u0627\u062a
+label.local.storage.enabled=\u062a\u0645\u0643\u064a\u0646 \u0627\u0644\u062a\u062e\u0632\u064a\u0646 \u0627\u0644\u0645\u062d\u0644\u064a
+label.make.project.owner=\u062c\u0639\u0644 \u0627\u0644\u062d\u0633\u0627\u0628 \u0645\u0627\u0644\u0643 \u0644\u0644\u0645\u0634\u0631\u0648\u0639
+label.max.guest.limit=\u0627\u0644\u062d\u062f \u0627\u0644\u0623\u0642\u0635\u0627\u0621 \u0644\u0636\u064a\u0641
+label.memory.mb=\u0627\u0644\u0630\u0627\u0643\u0631\u0629 ( \u0628\u0627\u0644\u0645\u064a\u062c\u0627\u0628\u0627\u064a\u0628\u062a)
+label.memory=\u0627\u0644\u0630\u0627\u0643\u0631\u0629
+label.menu.alerts=\u0627\u0644\u062a\u0646\u0628\u064a\u0647\u0627\u062a
+label.menu.all.accounts=\u062c\u0645\u064a\u0639 \u0627\u0644\u062d\u0633\u0627\u0628\u0627\u062a
+label.menu.all.instances=\u062c\u0645\u064a\u0639 \u0627\u0644\u062d\u0627\u0644\u0627\u062a
+label.menu.community.isos=\u0627\u0644\u062a\u0636\u0627\u0645\u0646 \u0627\u0644\u062f\u0648\u0644\u064a \u0627\u0644\u0645\u062c\u062a\u0645\u0639\u064a
+label.menu.community.templates=\u0642\u0648\u0627\u0644\u0628 \u0627\u0644\u0645\u062c\u062a\u0645\u0639
+label.menu.configuration=\u062a\u0631\u062a\u064a\u0628
+label.menu.dashboard=\u0644\u0648\u062d\u0629 \u0627\u0644\u0642\u064a\u0627\u062f\u0629
+label.menu.destroyed.instances=\u062d\u0627\u0644\u0627\u062a \u0627\u0644\u062a\u062f\u0645\u064a\u0631
+label.menu.disk.offerings=\u0639\u0631\u0648\u0636 \u0627\u0644\u0642\u0631\u0635
+label.menu.domains=\u0627\u0644\u0645\u062c\u0627\u0644\u0627\u062a
+label.menu.events=\u0623\u062d\u062f\u0627\u062b
+label.menu.featured.isos=\u0645\u0645\u064a\u0632\u0627\u062a \u0627\u0644\u062a\u0636\u0627\u0645\u0646 \u0627\u0644\u062f\u0648\u0644\u064a
+label.menu.featured.templates=\u0642\u0648\u0627\u0644\u0628 \u0645\u0645\u064a\u0632\u0629
+label.menu.global.settings=\u0627\u0644\u0625\u0639\u062f\u0627\u062f\u0627\u062a \u0627\u0644\u0639\u0645\u0648\u0645\u064a\u0629
+label.menu.instances=\u0627\u0644\u062d\u0627\u0644\u0627\u062a
+label.migrate.instance.to.host=\u0646\u0642\u0644 \u0627\u0644\u0642\u0627\u0644\u0628 \u0625\u0644\u0649 \u0645\u0636\u064a\u0641 \u0622\u062e\u0631
+label.migrate.instance.to.ps=\u0646\u0642\u0644 \u0627\u0644\u0642\u0627\u0644\u0628 \u0625\u0644\u0649 \u0627\u0644\u0630\u0627\u0643\u0631\u0629 \u0627\u0644\u0623\u0633\u0627\u0633\u064a\u0629
+label.migrate.to.host=\u0627\u0644\u062a\u062d\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u0645\u0636\u064a\u0641
+label.migrate.to.storage=\u0627\u0644\u062a\u062d\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u062a\u062e\u0632\u064a\u0646
+label.move.down.row=\u0627\u0644\u0627\u0646\u062a\u0642\u0627\u0644 \u0625\u0644\u0649 \u0627\u0644\u0623\u0633\u0641\u0644 \u0628\u0635\u0641 \u0648\u0627\u062d\u062f
+label.move.to.bottom=\u0627\u0644\u0627\u0646\u062a\u0642\u0627\u0644 \u0625\u0644\u0649 \u0627\u0644\u0623\u0633\u0641\u0644
+label.move.to.top=\u0627\u0646\u062a\u0642\u0627\u0644 \u0625\u0644\u0649 \u0623\u0639\u0644\u0649
+label.move.up.row=\u0627\u0644\u0627\u0646\u062a\u0642\u0627\u0644 \u0625\u0644\u0649 \u0627\u0644\u0623\u0639\u0644\u0649 \u0628\u0635\u0641 \u0648\u0627\u062d\u062f
+label.my.network=\u0634\u0628\u0643\u062a\u064a
+label.my.templates=\u0642\u0648\u0627\u0644\u0628\u064a
+label.network.ACLs=\u0634\u0628\u0643\u0629 ACLs
+label.network.ACL.total=\u0625\u062c\u0645\u0627\u0644 \u0634\u0628\u0643\u0629 ACL
+label.network.ACL=\u0634\u0628\u0643\u0629 ACL
+label.networks=\u0627\u0644\u0634\u0628\u0643\u0627\u062a
+label.new.project=\u0645\u0634\u0631\u0648\u0639 \u062c\u062f\u064a\u062f
+label.new=\u062c\u062f\u064a\u062f
+label.no.data=\u0644\u0627 \u064a\u0648\u062c\u062f \u0628\u064a\u0627\u0646\u0627\u062a \u0644\u0644\u0639\u0631\u0636
+label.no.thanks=\u0644\u0627\u061b \u0634\u0643\u0631\u0627\u064b
+label.notifications=\u0627\u0644\u062a\u0646\u0628\u064a\u0647\u0627\u062a
+label.ok=\u0645\u0648\u0627\u0641\u0642
+label.order=\u062a\u0631\u062a\u064a\u0628
+label.previous=\u0627\u0644\u0633\u0627\u0628\u0642
+label.private.Gateway=\u0645\u0646\u0641\u0630\\Gateway \u062e\u0627\u0635
+label.project.invite=\u062f\u0639\u0648\u0629 \u0625\u0644\u0649 \u0627\u0644\u0645\u0634\u0631\u0648\u0639
+label.project.name=\u0627\u0633\u0645 \u0627\u0644\u0645\u0634\u0631\u0648\u0639
+label.projects=\u0627\u0644\u0645\u0634\u0627\u0631\u064a\u0639
+label.project=\u0645\u0634\u0631\u0648\u0639
+label.project.view=\u0639\u0631\u0636 \u0627\u0644\u0645\u0634\u0631\u0648\u0639
+label.quickview=\u0646\u0638\u0631\u0629 \u0633\u0631\u064a\u0639\u0629
+label.reboot=\u0625\u0639\u0627\u062f\u0629 \u062a\u0634\u063a\u064a\u0644
+label.remind.later=\u0630\u0643\u0631\u0646\u064a \u0644\u0627\u062d\u0642\u0627\u064b
+label.remove.ACL=\u0625\u0632\u0627\u0644\u0629 ACL
+label.remove.static.route=\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u062a\u0648\u062c\u064a\u0647 \u062b\u0627\u0628\u062a
+label.remove.tier=\u0625\u0636\u0627\u0641\u0629 \u0637\u0628\u0642\u0629
+label.remove.vpc=\u0625\u0632\u0627\u0644\u0629 VPC
+label.reset.VPN.connection=\u0625\u0639\u0627\u062f\u0629 \u062a\u0639\u064a\u064a\u0646 \u0627\u062a\u0635\u0627\u0644 \u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u0627\u0644\u0634\u062e\u0635\u064a\u0629
+label.restart.network=\u0625\u0639\u0627\u062f\u0629 \u062a\u0634\u063a\u064a\u0644 \u0627\u0644\u0634\u0628\u0643\u0629
+label.restart.required=\u0645\u0637\u0644\u0648\u0628 \u0625\u0639\u0627\u062f\u0629 \u0627\u0644\u062a\u0634\u063a\u064a\u0644
+label.restart.vpc=\u0625\u0639\u062f\u0627\u0629 \u062a\u0634\u063a\u064a\u0644 VPC
+label.restore=\u0625\u0633\u062a\u0639\u0627\u062f\u0629
+label.review=\u0645\u0631\u0627\u062c\u0639\u0629
+label.revoke.project.invite=\u0625\u0644\u063a\u0627\u0621 \u0627\u0644\u062f\u0639\u0648\u0629
+label.s3.access_key=\u0645\u0641\u062a\u0627\u062d \u0627\u0644\u0648\u0635\u0648\u0644
+label.s3.bucket=\u062f\u0644\u0648
+label.s3.connection_timeout=\u0645\u0647\u0644\u0629 \u0627\u0644\u0627\u062a\u0635\u0627\u0644
+label.s3.endpoint=\u0646\u0642\u0637\u0629 \u0627\u0644\u0646\u0647\u0627\u064a\u0629
+label.s3.max_error_retry=\u0623\u0642\u0635\u0649 \u062e\u0637\u0623 \u0641\u064a \u0625\u0639\u0627\u062f\u0629 \u0627\u0644\u0645\u062d\u0627\u0648\u0644\u0629
+label.s3.secret_key=\u0627\u0644\u0645\u0641\u062a\u0627\u062d \u0627\u0644\u0633\u0631\u064a
+label.s3.socket_timeout=\u0645\u0647\u0644\u0629 \u0627\u0644\u0645\u0642\u0628\u0633
+label.s3.use_https=\u0627\u0633\u062a\u062e\u062f\u0645 HTTPS
+label.scope=\u0627\u0644\u0645\u062c\u0627\u0644
+label.search=\u0628\u062d\u062b
+label.secret.key=\u0627\u0644\u0645\u0641\u062a\u0627\u062d \u0627\u0644\u0633\u0631\u064a
+label.select.a.template=\u0627\u062e\u062a\u0631 \u0642\u0627\u0644\u0628
+label.select.project=\u062d\u062f\u062f \u0627\u0644\u0645\u0634\u0631\u0648\u0639
+label.select.tier=\u062d\u062f\u062f \u0637\u0628\u0642\u0629
+label.select-view=\u062d\u062f\u062f \u0637\u0631\u064a\u0642\u0629 \u0627\u0644\u0639\u0631\u0636
+label.service.capabilities=\u0642\u062f\u0631\u0627\u062a \u0627\u0644\u062e\u062f\u0645\u0629
+label.setup=\u0627\u0644\u062a\u062b\u0628\u064a\u062a
+label.site.to.site.VPN=\u0645\u0648\u0642\u0639 \u0625\u0644\u0649 \u0645\u0648\u0642\u0639-\u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0634\u062e\u0635\u064a\u0629 \u0627\u0644\u0638\u0627\u0647\u0631\u064a\u0629  VPN
+label.source=\u0645\u0635\u062f\u0631
+label.specify.IP.ranges=\u062a\u062d\u062f\u064a\u062f \u0646\u0637\u0627\u0642\u0627\u062a IP
+label.sticky.tablesize=\u062d\u062c\u0645 \u0627\u0644\u062c\u062f\u0648\u0644
+label.stop=\u062a\u0648\u0642\u0641
+label.super.cidr.for.guest.networks=CIDR \u0645\u0645\u062a\u0627\u0632 \u0644\u0634\u0628\u0643\u0627\u062a \u0627\u0644\u0636\u064a\u0641.
+label.supported.services=\t\u0627\u0644\u062e\u062f\u0645\u0627\u062a \u0627\u0644\u0645\u062f\u0639\u0648\u0645\u0629
+label.suspend.project=\u0625\u064a\u0642\u0627\u0641 \u0627\u0644\u0645\u0634\u0631\u0648\u0639
+label.tier.details=\u062a\u0641\u0627\u0635\u064a\u0644 \u0627\u0644\u0637\u0628\u0642\u0629
+label.tier=\u0637\u0628\u0642\u0629
+label.upload=\u0631\u0641\u0639
+label.view.all=\u0639\u0631\u0636 \u0627\u0644\u0643\u0644
+label.viewing=\u0639\u0631\u0636
+label.view=\u0639\u0631\u0636
+label.vm.destroy=\u0647\u062f\u0645
+label.vm.reboot=\u0625\u0639\u0627\u062f\u0629 \u062a\u0634\u063a\u064a\u0644
+label.VMs.in.tier=\u0627\u0644\u0623\u062c\u0647\u0632\u0629 \u0627\u0644\u0625\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u0641\u064a \u0637\u0628\u0642\u0629
+label.vm.stop=\u062a\u0648\u0642\u0641
+label.volume.limits=\u062d\u062f\u0648\u062f \u0627\u0644\u0645\u0646\u0637\u0642\u0629
+label.vpc.id=\u0647\u0648\u064a\u0629 \u062e\u0627\u0635\u0629 \u0628\u0633\u062d\u0627\u0628\u0629 \u0625\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u062e\u0627\u0635\u0629
+label.VPC.router.details=\u062a\u0641\u0627\u0635\u064a\u0644 \u062c\u0647\u0627\u0632 \u0627\u0644\u062a\u0648\u062c\u064a\u0647 VPC
+label.vpc=\u0633\u062d\u0627\u0628\u0629 \u0625\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u062e\u0627\u0635\u0629 VPC
+label.VPN.connection=\u0625\u062a\u0635\u0627\u0644 \u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u0627\u0644\u0634\u062e\u0635\u064a\u0629
+label.vpn.customer.gateway=\u0628\u0648\u0627\u0628\u0629 \u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u0627\u0644\u0634\u062e\u0635\u064a\u0629 \u0644\u0644\u0639\u0645\u064a\u0644
+label.VPN.customer.gateway=\u0628\u0648\u0627\u0628\u0629 \u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u0627\u0644\u0634\u062e\u0635\u064a\u0629 \u0644\u0644\u0639\u0645\u064a\u0644
+label.VPN.gateway=\u0628\u0648\u0627\u0628\u0629 \u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u0627\u0644\u0634\u062e\u0635\u064a\u0629
+label.waiting=\u0642\u064a\u062f \u0627\u0644\u0625\u0646\u062a\u0638\u0627\u0631
+label.warn=\u062a\u062d\u0630\u064a\u0631
+label.wednesday=\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621
+label.weekly=\u0625\u0633\u0628\u0648\u0639\u064a
+label.welcome.cloud.console=\u0645\u0631\u062d\u0628\u0627 \u0628\u0643\u0645 \u0641\u064a \u0648\u062d\u062f\u0629 \u0627\u0644\u062a\u062d\u0643\u0645 \u0627\u0644\u0625\u0631\u0627\u062f\u064a\u0629
+label.welcome=\u0645\u0631\u062d\u0628\u0627
+label.yes=\u0646\u0639\u0645
+label.zone.details=\u062a\u0641\u0627\u0635\u064a\u0644 \u0627\u0644\u0645\u0646\u0637\u0642\u0629
+label.zone.name=\u0627\u0633\u0645 \u0627\u0644\u0645\u0646\u0637\u0642\u0629
+label.zone.step.1.title=\u0627\u0644\u062e\u0637\u0648\u0629 1 \\\: \u0639\u0644\u0649 .<\u0642\u0648\u064a> \u0627\u062e\u062a\u0631 \u0634\u0628\u0643\u0629 </ \u0642\u0648\u064a>
+label.zone.step.2.title=\u0627\u0644\u062e\u0637\u0648\u0629 2 \\\: <\u0642\u0648\u064a> \u0625\u0636\u0627\u0641\u0629 \u0645\u0646\u0637\u0642\u0629 </ \u0642\u0648\u064a>
+label.zone.step.3.title=\u0627\u0644\u062e\u0637\u0648\u0629 3 \\\: \u0639\u0644\u0649 <\u0642\u0648\u064a> \u0625\u0636\u0627\u0641\u0629 \u0628\u0648\u062f </ \u0642\u0648\u064a>
+label.zone.step.4.title=\u0627\u0644\u062e\u0637\u0648\u0629 4 \\\: <\u0642\u0648\u064a> \u0625\u0636\u0627\u0641\u0629 \u0645\u062c\u0645\u0648\u0639\u0629 IP <\\\u0642\u0648\u064a>
+label.zone.wide=\u0645\u0646\u0637\u0642\u0629 \u0648\u0627\u0633\u0639\u0629
+label.zoneWizard.trafficType.guest=\u0627\u0644\u0636\u064a\u0641 \\\: \u0627\u0644\u062d\u0631\u0643\u0629 \u0628\u064a\u0646 \u0627\u0644\u0623\u062c\u0647\u0632\u0629 \u0627\u0644\u0625\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u0644\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u0627\u0644\u0646\u0647\u0627\u0626\u064a.
+label.zoneWizard.trafficType.public=\u0627\u0644\u0639\u0627\u0645\u0629 \\\: \u0627\u0644\u0645\u0631\u0648\u0631 \u0628\u064a\u0646 \u0627\u0644\u0625\u0646\u062a\u0631\u0646\u062a \u0648\u0627\u0644\u0623\u062c\u0647\u0632\u0629 \u0627\u0644\u0638\u0627\u0647\u0631\u064a\u0629 \u0641\u064a \u0627\u0644\u0633\u062d\u0627\u0628\u0629.
+label.zoneWizard.trafficType.storage=\u0627\u0644\u062a\u062e\u0632\u064a\u0646 \\\: \u0627\u0644\u0645\u0631\u0648\u0631 \u0628\u064a\u0646 \u0645\u0644\u0642\u0645\u0627\u062a \u0627\u0644\u062a\u062e\u0632\u064a\u0646 \u0627\u0644\u0627\u0628\u062a\u062f\u0627\u0626\u064a\u0629 \u0648\u0627\u0644\u062b\u0627\u0646\u0648\u064a\u0629\u060c \u0645\u062b\u0644 \u0642\u0648\u0627\u0644\u0628 VM \u0648\u0627\u0644\u0644\u0642\u0637\u0627\u062a
+message.acquire.new.ip.vpc=\u064a\u0631\u062c\u0649 \u0627\u0644\u062a\u0623\u0643\u064a\u062f \u0628\u0623\u0646\u0643 \u062a\u0631\u063a\u0628 \u0641\u064a \u0627\u0644\u062d\u0635\u0648\u0644 \u0639\u0644\u0649 \u0628\u0648\u0631\u062a\u0648\u0643\u0648\u0644 \u0625\u0646\u062a\u0631\u0646\u062a \u062c\u062f\u064a\u062f \u0644\u0647\u0630\u0627 \u0627\u0644\u062d\u0627\u0633\u0648\u0628 \u0627\u0644\u0625\u0641\u062a\u0631\u0627\u0636\u064a.
+message.action.delete.system.service.offering=\u0627\u0644\u0631\u062c\u0627\u0621 \u062a\u0623\u0643\u064a\u062f \u0631\u063a\u0628\u062a\u0643 \u0641\u064a \u062d\u0630\u0641 \u062e\u062f\u0645\u0629 \u0627\u0644\u0646\u0638\u0627\u0645 \u0627\u0644\u0645\u0642\u062f\u0645\u0629.
+message.action.disable.physical.network=\u0641\u0636\u0644\u0627 \u060c \u0623\u0643\u0651\u062f \u0623\u0646\u0643 \u062a\u0631\u064a\u062f \u062a\u0639\u0637\u064a\u0644 \u0647\u0630\u0647 \u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0641\u064a\u0632\u064a\u0627\u0626\u064a\u0629
+message.action.enable.physical.network=\u0641\u0636\u0644\u0627 \u060c \u0623\u0643\u0651\u062f \u0623\u0646\u0643 \u062a\u0631\u064a\u062f \u062a\u0645\u0643\u064a\u0646 \u0647\u0630\u0647 \u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0641\u064a\u0632\u064a\u0627\u0626\u064a\u0629
+message.activate.project=\u0647\u0644 \u0623\u0646\u062a \u0645\u062a\u0623\u0643\u062f \u0645\u0646 \u0623\u0646\u0643 \u062a\u0631\u064a\u062f \u062a\u0641\u0639\u064a\u0644 \u0647\u0630\u0627 \u0627\u0644\u0645\u0634\u0631\u0648\u0639 \u061f
+message.add.domain=\u064a\u0631\u062c\u0649 \u062a\u062d\u062f\u064a\u062f \u0627\u0644\u0645\u062c\u0627\u0644 \u0627\u0644\u0641\u0631\u0639\u064a \u0627\u0644\u0630\u064a \u062a\u0631\u064a\u062f \u0625\u0646\u0634\u0627\u0621 \u062a\u062d\u062a \u0647\u0630\u0627 \u0627\u0644\u0646\u0637\u0627\u0642
+message.add.new.gateway.to.vpc=\u0641\u0636\u0644\u0627 \u062d\u062f\u062f \u0627\u0644\u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0644\u0625\u0636\u0627\u0641\u0629 \u0628\u0648\u0627\u0628\u0629 gateway \u0644\u0647\u0630\u0647 \u0627\u0644\u0633\u062d\u0627\u0628\u0629 \u0627\u0644\u0625\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u0627\u0644\u062e\u0627\u0635\u0629 VPC
+message.add.system.service.offering=\u0627\u0644\u0631\u062c\u0627\u0621 \u062a\u0639\u0628\u0626\u0629 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0627\u0644\u062a\u0627\u0644\u064a\u0629 \u0644\u0625\u0636\u0627\u0641\u0629 \u0646\u0638\u0627\u0645 \u062c\u062f\u064a\u062f \u0644\u0637\u0631\u062d
+message.add.VPN.gateway=\u064a\u0631\u062c\u0649 \u062a\u0623\u0643\u064a\u062f \u0631\u063a\u0628\u062a\u0643 \u0641\u064a \u0625\u0636\u0627\u0641\u0629 \u0628\u0648\u0627\u0628\u0629 \u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u0627\u0644\u0634\u062e\u0635\u064a\u0629 VPN
+message.after.enable.s3=\u062a\u0645 \u0625\u0639\u062f\u0627\u062f \u0627\u0644\u062a\u062e\u0632\u064a\u0646 S3 \u0644\u0644\u0630\u0627\u0643\u0631\u0629 \u0627\u0644\u062b\u0627\u0646\u0648\u064a\u0629. \u062a\u0646\u0648\u064a\u0647 \: \u0639\u0646\u062f \u0645\u063a\u0627\u062f\u0631\u062a\u0643 \u0644\u0647\u0630\u0647 \u0627\u0644\u0635\u0641\u062d\u0629 \u0644\u0646 \u064a\u0643\u0648\u0646 \u0628\u0625\u0645\u0643\u0627\u0646\u0643 \u0625\u0639\u0627\u062f\u0629 \u0636\u0628\u0637 S3 \u0645\u0631\u0629 \u0623\u062e\u0631\u0649.
+message.confirm.join.project=\u0646\u0631\u062c\u0648 \u062a\u0623\u0643\u064a\u062f \u0631\u063a\u0628\u062a\u0643 \u0641\u064a \u0627\u0644\u0645\u0634\u0627\u0631\u0643\u0629 \u0641\u064a \u0627\u0644\u0645\u0634\u0631\u0648\u0639
+message.decline.invitation=\u0647\u0644 \u0623\u0646\u062a \u0645\u062a\u0623\u0643\u062f \u0645\u0646 \u0623\u0646\u0643 \u062a\u0631\u064a\u062f \u0631\u0641\u0636 \u0647\u0630\u0647 \u0627\u0644\u062f\u0639\u0648\u0629 \u0627\u0644\u0645\u0634\u0631\u0648\u0639\u061f
+message.delete.gateway=\u064a\u0631\u062c\u0649 \u062a\u0623\u0643\u064a\u062f \u0631\u063a\u0628\u062a\u0643 \u0641\u064a \u062d\u0630\u0641 \u0627\u0644\u0628\u0648\u0627\u0628\u0629
+message.delete.project=\u0647\u0644 \u0623\u0646\u062a \u0645\u062a\u0623\u0643\u062f \u0645\u0646 \u0623\u0646\u0643 \u062a\u0631\u064a\u062f \u062d\u0630\u0641 \u0627\u0644\u0645\u0634\u0631\u0648\u0639 \u061f
+message.delete.user=\u0627\u0644\u0631\u062c\u0627\u0621 \u0627\u0644\u062a\u0623\u0643\u064a\u062f \u0628\u0623\u0646\u0643 \u062a\u0631\u063a\u0628 \u0628\u062d\u0630\u0641 \u0647\u0630\u0627 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645
+message.delete.VPN.connection=\u064a\u0631\u062c\u0649 \u062a\u0623\u0643\u064a\u062f \u0631\u063a\u0628\u062a\u0643 \u0641\u064a \u062d\u0630\u0641 \u0628\u0648\u0627\u0628\u0629 \u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u0627\u0644\u0634\u062e\u0635\u064a\u0629 VPN
+message.delete.VPN.gateway=\u064a\u0631\u062c\u0649 \u062a\u0623\u0643\u064a\u062f \u0631\u063a\u0628\u062a\u0643 \u0641\u064a \u062d\u0630\u0641 \u0628\u0648\u0627\u0628\u0629 \u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u0627\u0644\u0634\u062e\u0635\u064a\u0629
+message.detach.disk=\u0647\u0644 \u0623\u0646\u062a \u0645\u062a\u0623\u0643\u062f \u0645\u0646 \u0623\u0646\u0643 \u062a\u0631\u064a\u062f \u0641\u0635\u0644 \u0647\u0630\u0627 \u0627\u0644\u0642\u0631\u0635\u061f
+message.disable.user=\u0627\u0644\u0631\u062c\u0627\u0621 \u0627\u0644\u062a\u0623\u0643\u064a\u062f \u0628\u0623\u0646\u0643 \u062a\u0631\u063a\u0628 \u0628\u062a\u0639\u0637\u064a\u0644 \u0647\u0630\u0627 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645
+message.enable.account=\u0627\u0644\u0631\u062c\u0627\u0621 \u062a\u0623\u0643\u064a\u062f \u0623\u0646\u0643 \u062a\u0631\u064a\u062f \u062a\u0645\u0643\u064a\u0646 \u0647\u0630\u0627 \u0627\u0644\u062d\u0633\u0627\u0628.
+message.enable.user=\u0627\u0644\u0631\u062c\u0627\u0621 \u0627\u0644\u062a\u0623\u0643\u064a\u062f \u0628\u0623\u0646\u0643 \u062a\u0631\u063a\u0628 \u0628\u062a\u0641\u0639\u064a\u0644 \u0647\u0630\u0627 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645
+message.generate.keys=\u0627\u0644\u0631\u062c\u0627\u0621 \u0627\u0644\u062a\u0623\u0643\u064a\u062f \u0628\u0623\u0646\u0643 \u062a\u0631\u063a\u0628 \u0628\u0625\u0646\u0634\u0627\u0621 \u0645\u0641\u0627\u062a\u064a\u062d \u062c\u062f\u064a\u062f\u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645
+message.instanceWizard.noTemplates=\u0644\u064a\u0633 \u0644\u062f\u064a\u0643 \u0623\u064a \u0642\u0648\u0627\u0644\u0628 \u0645\u062a\u0627\u062d\u0629\u061b \u064a\u0631\u062c\u0649 \u0625\u0636\u0627\u0641\u0629 \u0642\u0627\u0644\u0628 \u0645\u062a\u0648\u0627\u0641\u0642\u060c \u0648\u0625\u0639\u0627\u062f\u0629 \u0625\u0637\u0644\u0627\u0642 \u0627\u0644\u0645\u0639\u0627\u0644\u062c .
+message.join.project=\u0644\u0642\u062f \u0627\u0646\u0636\u0645\u0645\u062a \u0625\u0644\u0649 \u0627\u0644\u0645\u0634\u0631\u0648\u0639. \u064a\u0631\u062c\u0649 \u0627\u0644\u062a\u0628\u062f\u064a\u0644 \u0625\u0644\u0649 \u0637\u0631\u064a\u0642\u0629 \u0639\u0631\u0636 \u0627\u0644\u0645\u0634\u0631\u0648\u0639 \u0644\u0631\u0624\u064a\u0629 \u0627\u0644\u0645\u0634\u0631\u0648\u0639
+message.migrate.instance.to.host=\u064a\u0631\u062c\u0649 \u062a\u0623\u0643\u064a\u062f \u0623\u0646\u0643 \u062a\u0631\u064a\u062f \u0646\u0642\u0644 \u0627\u0644\u0642\u0627\u0644\u0628 \u0625\u0644\u0649 \u0645\u0636\u064a\u0641 \u0622\u062e\u0631.
+message.migrate.instance.to.ps=\u064a\u0631\u062c\u0649 \u062a\u0623\u0643\u064a\u062f \u0623\u0646\u0643 \u062a\u0631\u064a\u062f \u0646\u0642\u0644 \u0627\u0644\u0642\u0627\u0644\u0628 \u0625\u0644\u0649 \u0627\u0644\u0630\u0627\u0643\u0631\u0629 \u0627\u0644\u0623\u0633\u0627\u0633\u064a\u0629.
+message.no.projects.adminOnly=\u0644\u064a\u0633 \u0644\u062f\u064a\u0643 \u0623\u064a \u0645\u0634\u0627\u0631\u064a\u0639. <br/> \u0627\u0644\u0631\u062c\u0627\u0621 \u0637\u0644\u0628 \u0645\u0646 \u0627\u0644\u0645\u0633\u0624\u0648\u0644 \u0625\u0646\u0634\u0627\u0621 \u0645\u0634\u0631\u0648\u0639 \u062c\u062f\u064a\u062f.
+message.no.projects=\u0644\u064a\u0633 \u0644\u062f\u064a\u0643 \u0623\u064a \u0645\u0634\u0627\u0631\u064a\u0639. <br/> \u064a\u0631\u062c\u0649 \u0625\u0646\u0634\u0627\u0621 \u0645\u0634\u0631\u0648\u0639 \u062c\u062f\u064a\u062f \u0645\u0646 \u0642\u0633\u0645 \u0627\u0644\u0645\u0634\u0627\u0631\u064a\u0639.
+message.pending.projects.1=\u0644\u062f\u064a\u0643 \u062f\u0639\u0648\u0627\u062a \u0645\u0634\u0631\u0648\u0639 \u0645\u0639\u0644\u0642\u0629/\:
+message.pending.projects.2=\u0644\u0639\u0631\u0636\u060c \u0627\u0644\u0631\u062c\u0627\u0621 \u0627\u0644\u0630\u0647\u0627\u0628 \u0625\u0644\u0649 \u0642\u0633\u0645 \u0627\u0644\u0645\u0634\u0627\u0631\u064a\u0639\u060c \u062b\u0645 \u062d\u062f\u062f \u062f\u0639\u0648\u0627\u062a \u0645\u0646 \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0645\u0646\u0633\u062f\u0644\u0629.
+message.please.select.networks=\u0627\u0644\u0631\u062c\u0627\u0621 \u0627\u062e\u062a\u064a\u0627\u0631 \u0627\u0644\u0634\u0628\u0643\u0627\u062a \u0644\u062c\u0647\u0627\u0632\u0643 \u0627\u0644\u0625\u0641\u062a\u0631\u0627\u0636\u064a
+message.project.invite.sent=\u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062f\u0639\u0648\u0629 ; \u0633\u064a\u062a\u0645 \u0625\u0636\u0627\u0641\u062a\u0647\u0645 \u0625\u0644\u0649 \u0627\u0644\u0645\u0634\u0631\u0648\u0639 \u0628\u0645\u062c\u0631\u062f \u0642\u0628\u0648\u0644 \u0627\u0644\u062f\u0639\u0648\u0629
+message.remove.vpc=\u064a\u0631\u062c\u0649 \u062a\u0623\u0643\u064a\u062f \u0631\u063a\u0628\u062a\u0643 \u0641\u064a \u062d\u0630\u0641 \u0627\u0644\u0640VPC 
+message.reset.password.warning.notPasswordEnabled=\u0627\u0644\u0642\u0627\u0644\u0628 \u0644\u0647\u0630\u0627 \u0627\u0644\u0646\u0645\u0648\u0630\u062c \u062a\u0645 \u0627\u0646\u0634\u0627\u0626\u0647 \u0645\u0646 \u062f\u0648\u0646 \u0643\u0644\u0645\u0629 \u0645\u0631\u0648\u0631 \u0645\u0645\u0643\u0646\u0629
+message.reset.password.warning.notStopped=\u064a\u062c\u0628 \u0625\u064a\u0642\u0627\u0641 \u0627\u0644\u0646\u0645\u0648\u0630\u062c \u0627\u0644\u062e\u0627\u0635 \u0628\u0643 \u0642\u0628\u0644 \u0645\u062d\u0627\u0648\u0644\u0629 \u062a\u063a\u064a\u064a\u0631 \u0643\u0644\u0645\u0629 \u0627\u0644\u0645\u0631\u0648\u0631 \u0627\u0644\u062d\u0627\u0644\u064a\u0629
+message.reset.VPN.connection=\u064a\u0631\u062c\u0649 \u062a\u0623\u0643\u064a\u062f \u0623\u0646\u0643 \u062a\u0631\u064a\u062f \u0625\u0639\u0627\u062f\u0629-\u0636\u0628\u0637 \u0625\u062a\u0635\u0627\u0644 \u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629 \u0627\u0644\u0634\u062e\u0635\u064a\u0629 VPN
+message.restart.vpc=\u064a\u0631\u062c\u0649 \u062a\u0623\u0643\u064a\u062f \u0631\u063a\u0628\u062a\u0643 \u0641\u064a \u0625\u0639\u0627\u062f\u0629 \u062a\u0634\u063a\u064a\u0644 \u0627\u0644\u0640VPN
+message.select.template=\u0627\u0644\u0631\u062c\u0627\u0621 \u0627\u062e\u062a\u064a\u0627\u0631 \u0642\u0627\u0644\u0628 \u0644\u0645\u062b\u0627\u0644\u0643 \u0627\u0644\u0625\u0641\u062a\u0631\u0627\u0636\u064a \u0627\u0644\u062c\u062f\u064a\u062f
+message.step.2.desc=
+message.step.3.desc=
+message.suspend.project=\u0647\u0644 \u0623\u0646\u062a \u0645\u062a\u0623\u0643\u062f \u0645\u0646 \u0623\u0646\u0643 \u062a\u0631\u064a\u062f \u0625\u064a\u0642\u0627\u0641 \u0647\u0630\u0627 \u0627\u0644\u0645\u0634\u0631\u0648\u0639 \u061f
+message.update.resource.count=\u0627\u0644\u0631\u062c\u0627\u0621 \u0627\u0644\u062a\u0623\u0643\u064a\u062f \u0628\u0623\u0646\u0643 \u062a\u0631\u063a\u0628 \u0628\u062a\u062d\u062f\u064a\u062b \u0645\u0635\u0627\u062f\u0631 \u0627\u0644\u062d\u0633\u0627\u0628\u0627\u062a \u0644\u0647\u0630\u0627 \u0627\u0644\u062d\u0633\u0627\u0628
+message.vm.review.launch=\u064a\u0631\u062c\u0649 \u0645\u0631\u0627\u062c\u0639\u0629 \u0627\u0644\u0645\u0639\u0644\u0648\u0645\u0627\u062a \u0627\u0644\u062a\u0627\u0644\u064a\u0629 \u0648\u062a\u0623\u0643\u062f \u0623\u0646 \u0645\u062b\u0627\u0644\u0643 \u0627\u0644\u0625\u0641\u062a\u0631\u0627\u0636\u064a \u0635\u062d\u064a\u062d \u0642\u0628\u0644 \u0627\u0644\u0625\u0646\u0637\u0644\u0627\u0642
+message.zoneWizard.enable.local.storage=\u062a\u062d\u0630\u064a\u0631\\\: \u0625\u0630\u0627 \u0642\u0645\u062a \u0628\u062a\u0645\u0643\u064a\u0646 \u0627\u0644\u0630\u0627\u0643\u0631\u0629 \u0627\u0644\u0645\u062d\u0644\u064a\u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u0646\u0637\u0627\u0642 \u064a\u062c\u0628 \u0639\u0644\u064a\u0643 \u0639\u0645\u0644 \u0627\u0644\u0622\u062a\u064a \u060c \u0625\u0639\u062a\u0645\u0627\u062f\u0627 \u0639\u0644\u0649 \u0627\u0644\u0645\u0643\u0627\u0646 \u0627\u0644\u0630\u064a \u062a\u0631\u063a\u0628 \u0623\u0646 \u064a\u0646\u0637\u0644\u0642 \u0645\u0646\u0647 \u0646\u0638\u0627\u0645\u0643 \u0627\u0644\u0625\u0641\u062a\u0631\u0627\u0636\u064a \\\:   </br><br/>  1.\u0625\u0630\u0627 \u0643\u0627\u0646 \u0646\u0638\u0627\u0645\u0643 \u0627\u0644\u0625\u0641\u062a\u0631\u0627\u0636\u064a \u064a\u062d\u062a\u0627\u062c \u0625\u0644\u0649 \u062a\u0634\u063a\u064a\u0644 \u0627\u0644\u0630\u0627\u0643\u0631\u0629 \u0627\u0644\u0625\u0628\u062a\
 u062f\u0627\u0626\u064a\u0629
+notification.reboot.instance=\u0625\u0639\u0627\u062f\u0629 \u062a\u0634\u063a\u064a\u0644 \u0627\u0644\u0646\u0645\u0648\u0630\u062c
+notification.start.instance=\u0628\u062f\u0621 \u0627\u0644\u0646\u0645\u0648\u0630\u062c
+notification.stop.instance=\u0625\u064a\u0642\u0627\u0641 \u0627\u0644\u0646\u0645\u0648\u0630\u062c
+state.Accepted=\u062a\u0645 \u0627\u0644\u0642\u0628\u0648\u0644
+state.Active=\u0646\u0634\u0637
+state.Allocated=\u062a\u062e\u0635\u064a\u0635
+state.Completed=\u062a\u0645 \u0627\u0644\u0627\u0643\u0645\u0627\u0644
+state.Creating=\u0625\u0646\u0634\u0627\u0621
+state.Declined=\u062a\u0645 \u0627\u0644\u0631\u0641\u0636
+state.Destroyed=\u062f\u0645\u0631
+state.enabled=\u062a\u0645\u0643\u064a\u0646
+state.Enabled=\u062a\u0645\u0643\u064a\u0646
+state.Error=\u062e\u0637\u0623
+state.Expunging=\u0645\u062d\u0648
+state.Pending=\u0641\u064a \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631
+state.ready=\u062c\u0627\u0647\u0632
+state.Ready=\u062c\u0627\u0647\u0632
+state.Stopped=\u062a\u0648\u0642\u0641
+state.Suspended=\u062a\u0645 \u0627\u0644\u0625\u064a\u0642\u0627\u0641
+ui.listView.filters.all=\u0627\u0644\u0643\u0644

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/WEB-INF/classes/resources/messages_ca.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ca.properties b/client/WEB-INF/classes/resources/messages_ca.properties
index 2d8e953..4e66083 100644
--- a/client/WEB-INF/classes/resources/messages_ca.properties
+++ b/client/WEB-INF/classes/resources/messages_ca.properties
@@ -15,6 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
+
 confirm.enable.swift=Si us plau ompliu la seg\u00fcent informaci\u00f3 per habilitar el suport per a Swift
 error.installWizard.message=Quelcom ha fallat, vost\u00e8 pot tornar enrere i corregir els errors detalls suggerime
 error.password.not.match=Els camps de contrasenya no coincideixen

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/WEB-INF/classes/resources/messages_de_DE.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_de_DE.properties b/client/WEB-INF/classes/resources/messages_de_DE.properties
index 4581268..ca87323 100644
--- a/client/WEB-INF/classes/resources/messages_de_DE.properties
+++ b/client/WEB-INF/classes/resources/messages_de_DE.properties
@@ -15,13 +15,14 @@
 # specific language governing permissions and limitations
 # under the License.
 
+
 error.installWizard.message=Ein Fehler ist aufgetreten; Sie k\u00f6nnen zur\u00fcckgehen und den Fehler korregieren
 error.login=Ihr Benutzername / Passwort stimmt nicht mit uneren unseren Aufzeichnungen \u00fcberein.
 error.session.expired=Ihre Sitzung ist abgelaufen.
 force.delete.domain.warning=Achtung\: Diese Auswahl f\u00fchrt zu einer L\u00f6schung aller untergeordneten Domains und aller angeschlossenen Konten sowie ihrer Quellen.
 force.delete=Erzwinge L\u00f6schung
 force.remove=Erzwinge Entfernung
-force.remove.host.warning=Achtung\: Diese Auswahl wird CloudStack zum sofortigen Anhalten der virtuellen Maschine f\u00fchren, bevor der Host vom Cluster entfernt wurde.  
+force.remove.host.warning=Achtung\: Diese Auswahl wird CloudStack zum sofortigen Anhalten der virtuellen Maschine f\u00fchren, bevor der Host vom Cluster entfernt wurde.
 force.stop=Erzwinge Abbruch
 ICMP.code=ICMP Code
 ICMP.type=ICMP-Typ
@@ -159,7 +160,7 @@ label.action.migrate.instance.processing=Umziehen einer Instanz
 label.action.reboot.instance=Instanz neustarten
 label.action.reboot.instance.processing=Neustarten der Instanz...
 label.action.reboot.router.processing=Neustart vom Router ....
-label.action.reboot.router=Router neu starten 
+label.action.reboot.router=Router neu starten
 label.action.reboot.systemvm.processing=Neustart-System VM ....
 label.action.reboot.systemvm=System VM neu starten
 label.action.release.ip=IP ver\u00f6ffentlichen
@@ -271,7 +272,7 @@ label.cidr=CIDR
 label.cidr.list=Quelle CIDR
 label.close=Schliessen
 label.cloud.console=Cloud Management Konsole
-label.cloud.managed=Geleitet von cloud.com 
+label.cloud.managed=Geleitet von cloud.com
 label.cluster=Cluster
 label.cluster.type=Cluster-Typ
 label.code=Code
@@ -279,7 +280,7 @@ label.configuration=Konfiguration
 label.confirmation=Best\u00e4tigung
 label.congratulations=Herzlichen Gl\u00fcckwunsch
 label.corrections.saved=Korrekturen gespeichert
-label.cpu.allocated=Zugeteilte CPU 
+label.cpu.allocated=Zugeteilte CPU
 label.CPU.cap=CPU Obergrenze
 label.cpu=CPU
 label.cpu.mhz=CPU (in MHz)
@@ -708,7 +709,7 @@ message.enable.account=Bitte best\u00e4tigen Sie, dass Sie dieses Konto aktivier
 message.enabled.vpn=Ihr VPN Zugriff ist zurzeit aktiv und via IP k\u00f6nnen Sie darauf zugreifen
 message.enable.vpn.access=VPN ist zurzeit nicht f\u00fcr diese IP Addresse aktiviert. M\u00f6chten Sie den VPN Zugriff aktivieren?
 message.installWizard.click.retry=Bitte den Start Button f\u00fcr einen neuen Versuch dr\u00fccken
-message.installWizard.tooltip.addCluster.name=Der Name des Clusters. Der Name kann frei gew\u00e4hlt werden und wird von Cloudstack nicht genutzt. 
+message.installWizard.tooltip.addCluster.name=Der Name des Clusters. Der Name kann frei gew\u00e4hlt werden und wird von Cloudstack nicht genutzt.
 message.installWizard.tooltip.addHost.hostname=Der DNS-Name oder die IP-Adresse des hosts
 message.installWizard.tooltip.addHost.password=Dies ist das Passwort des o.a. Users (von der XenServer Installation)
 message.installWizard.tooltip.addHost.username=\u00fcberlicherweise root
@@ -717,16 +718,16 @@ message.installWizard.tooltip.addPod.reservedSystemGateway=Das Gateways f\u00fcr
 message.installWizard.tooltip.addPod.reservedSystemNetmask=Die Subnetzmaske des Gast-Netzwerks
 message.installWizard.tooltip.addPrimaryStorage.name=Der Name der Storage Devices
 message.installWizard.tooltip.addPrimaryStorage.path=(f\u00fcr NFS) Bei NFS wird hier der exportierte Pfad (Shared Mount Point) angegeben. F\u00fcr KVM wird hier der Pfad angegeben, wo auf jedem Host das primary storage gemountet wurde. Z.B. "/mnt/primary"
-message.installWizard.tooltip.addPrimaryStorage.server=(f\u00fcr NFS, iSCSI oder PreSetup) Die IP-Adresse oder der DNS-Name des storage devices. 
-message.installWizard.tooltip.addSecondaryStorage.nfsServer=Die IP-Adresse des NFS-Servers, der den Secondary Storage bereitstellt. 
-message.installWizard.tooltip.addSecondaryStorage.path=Der exportierte Pfad, der auf dem o.a. Server liegt. 
+message.installWizard.tooltip.addPrimaryStorage.server=(f\u00fcr NFS, iSCSI oder PreSetup) Die IP-Adresse oder der DNS-Name des storage devices.
+message.installWizard.tooltip.addSecondaryStorage.nfsServer=Die IP-Adresse des NFS-Servers, der den Secondary Storage bereitstellt.
+message.installWizard.tooltip.addSecondaryStorage.path=Der exportierte Pfad, der auf dem o.a. Server liegt.
 message.installWizard.tooltip.addZone.name=Der Name f\u00fcr die zone
-message.installWizard.tooltip.configureGuestTraffic.description=Eine Beschreibung des Netzwerkes. 
-message.installWizard.tooltip.configureGuestTraffic.guestGateway=Das gateway, welches der Gast benutzen soll. 
+message.installWizard.tooltip.configureGuestTraffic.description=Eine Beschreibung des Netzwerkes.
+message.installWizard.tooltip.configureGuestTraffic.guestGateway=Das gateway, welches der Gast benutzen soll.
 message.installWizard.tooltip.configureGuestTraffic.guestNetmask=Die Subnetzmaske des Gast-Netzwerks
 message.installWizard.tooltip.configureGuestTraffic.name=Der Name f\u00fcr das Netzwerk
 message.migrate.instance.to.host=Bitte best\u00e4tigen sie, dass die Instanz auf einen anderen Host migriert werden soll
-message.migrate.instance.to.ps=Bitte best\u00e4tigen sie, dass sie die Instanz auf einen anderen prim\u00e4ren Speicher migrieren wollen. 
+message.migrate.instance.to.ps=Bitte best\u00e4tigen sie, dass sie die Instanz auf einen anderen prim\u00e4ren Speicher migrieren wollen.
 message.new.user=Spezifieren Sie das folgende um einen neuen Nutzer dem Benutzerkonto hinzuzuf\u00fcgen
 message.remove.vpn.access=Bitte best\u00e4tigen Sie, dass Sie den VPN-Zugriff vom folgenden Benutzer entfernen m\u00f6chten.
 message.setup.successful=Cloud setup erfolgreich


[29/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartupProxyCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupProxyCommand.java b/core/src/com/cloud/agent/api/StartupProxyCommand.java
new file mode 100644
index 0000000..25cd769
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartupProxyCommand.java
@@ -0,0 +1,49 @@
+// 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.agent.api;
+
+import com.cloud.host.Host;
+
+public class StartupProxyCommand extends StartupCommand {
+    private int proxyPort;
+	private long proxyVmId;
+
+	public StartupProxyCommand() {
+        super(Host.Type.ConsoleProxy);
+        setIqn("NoIqn");
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    public int getProxyPort() {
+        return proxyPort;
+    }
+
+    public void setProxyPort(int proxyPort) {
+        this.proxyPort = proxyPort;
+    }
+
+    public long getProxyVmId() {
+		return proxyVmId;
+	}
+	public void setProxyVmId(long proxyVmId) {
+		this.proxyVmId = proxyVmId;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartupPxeServerCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupPxeServerCommand.java b/core/src/com/cloud/agent/api/StartupPxeServerCommand.java
new file mode 100644
index 0000000..dff5c53
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartupPxeServerCommand.java
@@ -0,0 +1,25 @@
+// 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.agent.api;
+
+import com.cloud.host.Host;
+
+public class StartupPxeServerCommand extends StartupCommand {
+	public StartupPxeServerCommand() {
+		super(Host.Type.PxeServer);
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartupRoutingCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupRoutingCommand.java b/core/src/com/cloud/agent/api/StartupRoutingCommand.java
new file mode 100755
index 0000000..5961ab0
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartupRoutingCommand.java
@@ -0,0 +1,224 @@
+// 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.agent.api;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.cloud.host.Host;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.network.Networks.RouterPrivateIpStrategy;
+import com.cloud.utils.Pair;
+import com.cloud.vm.VirtualMachine.State;
+
+public class StartupRoutingCommand extends StartupCommand {
+    public static class VmState {
+        State state;
+        String host;
+        public VmState() {
+        }
+        public VmState(State state, String host) {
+            this.state = state;
+            this.host = host;
+        }
+        public State getState() {
+            return state;
+        }
+        public String getHost() {
+            return host;
+        }
+    }
+    int cpus;
+    long speed;
+    long memory;
+    long dom0MinMemory;
+    boolean poolSync;
+    Map<String, VmState> vms;
+    HashMap<String, Pair<String, State>> _clusterVMStates;
+    String caps;
+    String pool;
+    HypervisorType hypervisorType;
+    Map<String, String> hostDetails; //stuff like host os, cpu capabilities
+    String hypervisorVersion;
+
+    public StartupRoutingCommand() {
+        super(Host.Type.Routing);
+        hostDetails = new HashMap<String, String>();
+        getHostDetails().put(RouterPrivateIpStrategy.class.getCanonicalName(), RouterPrivateIpStrategy.DcGlobal.toString());
+
+    }
+
+    public StartupRoutingCommand(int cpus,
+                                   long speed,
+                                   long memory,
+                                   long dom0MinMemory,
+                                   String caps,
+                                   HypervisorType hypervisorType,
+                                   RouterPrivateIpStrategy privIpStrategy,
+                                   Map<String, VmState> vms) {
+        this(cpus, speed, memory, dom0MinMemory, caps, hypervisorType, vms);
+        getHostDetails().put(RouterPrivateIpStrategy.class.getCanonicalName(), privIpStrategy.toString());
+    }
+
+    public StartupRoutingCommand(int cpus,
+            long speed,
+            long memory,
+            long dom0MinMemory,
+            String caps,
+            HypervisorType hypervisorType,
+            RouterPrivateIpStrategy privIpStrategy) {
+this(cpus, speed, memory, dom0MinMemory, caps, hypervisorType, new HashMap<String,String>(), new HashMap<String, VmState>());
+getHostDetails().put(RouterPrivateIpStrategy.class.getCanonicalName(), privIpStrategy.toString());
+}
+
+    public StartupRoutingCommand(int cpus,
+            long speed,
+            long memory,
+            long dom0MinMemory,
+            final String caps,
+            final HypervisorType hypervisorType,
+            final Map<String, String> hostDetails,
+            Map<String, VmState> vms) {
+        super(Host.Type.Routing);
+        this.cpus = cpus;
+        this.speed = speed;
+        this.memory = memory;
+        this.dom0MinMemory = dom0MinMemory;
+        this.vms = vms;
+        this.hypervisorType = hypervisorType;
+        this.hostDetails = hostDetails;
+        this.caps = caps;
+        this.poolSync = false;
+    }
+
+    public StartupRoutingCommand(int cpus2, long speed2, long memory2,
+            long dom0MinMemory2, String caps2, HypervisorType hypervisorType2,
+            Map<String, VmState> vms2) {
+        this(cpus2, speed2, memory2, dom0MinMemory2, caps2, hypervisorType2, new HashMap<String,String>(), vms2);
+    }
+
+    public StartupRoutingCommand(int cpus, long speed, long memory, long dom0MinMemory, final String caps, final HypervisorType hypervisorType, final Map<String, String> hostDetails, Map<String, VmState> vms, String hypervisorVersion) {
+        this(cpus, speed, memory, dom0MinMemory, caps, hypervisorType, hostDetails, vms);
+        this.hypervisorVersion = hypervisorVersion;
+    }
+
+    public void setChanges(Map<String, VmState> vms) {
+        this.vms = vms;
+    }
+
+    public void setStateChanges(Map<String, State> vms) {
+        for( String vm_name : vms.keySet() ) {
+            if( this.vms == null ) {
+                this.vms = new HashMap<String, VmState>();
+            }
+            this.vms.put(vm_name, new VmState(vms.get(vm_name), null));
+        }
+    }
+
+    public void setClusterVMStateChanges(HashMap<String, Pair<String, State>> allStates){
+    	_clusterVMStates = allStates;
+    }
+
+    public int getCpus() {
+        return cpus;
+    }
+
+    public String getCapabilities() {
+        return caps;
+    }
+
+    public long getSpeed() {
+        return speed;
+    }
+
+    public long getMemory() {
+        return memory;
+    }
+
+    public long getDom0MinMemory() {
+        return dom0MinMemory;
+    }
+
+    public Map<String, VmState> getVmStates() {
+        return vms;
+    }
+
+    public HashMap<String, Pair<String, State>> getClusterVMStateChanges() {
+        return _clusterVMStates;
+    }
+
+    public void setSpeed(long speed) {
+        this.speed = speed;
+    }
+
+    public void setCpus(int cpus) {
+        this.cpus = cpus;
+    }
+
+    public void setMemory(long memory) {
+        this.memory = memory;
+    }
+
+    public void setDom0MinMemory(long dom0MinMemory) {
+        this.dom0MinMemory = dom0MinMemory;
+    }
+
+    public void setCaps(String caps) {
+        this.caps = caps;
+    }
+
+    public String getPool() {
+        return pool;
+    }
+
+    public void setPool(String pool) {
+        this.pool = pool;
+    }
+
+    public boolean isPoolSync() {
+        return poolSync;
+    }
+
+    public void setPoolSync(boolean poolSync) {
+        this.poolSync = poolSync;
+    }
+
+    public HypervisorType getHypervisorType() {
+        return hypervisorType;
+    }
+
+    public void setHypervisorType(HypervisorType hypervisorType) {
+        this.hypervisorType = hypervisorType;
+    }
+
+    public Map<String, String> getHostDetails() {
+        return hostDetails;
+    }
+
+    public void setHostDetails(Map<String, String> hostDetails) {
+        this.hostDetails = hostDetails;
+    }
+
+    public String getHypervisorVersion() {
+        return hypervisorVersion;
+    }
+
+    public void setHypervisorVersion(String hypervisorVersion) {
+        this.hypervisorVersion = hypervisorVersion;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartupSecondaryStorageCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupSecondaryStorageCommand.java b/core/src/com/cloud/agent/api/StartupSecondaryStorageCommand.java
new file mode 100644
index 0000000..c19ea99
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartupSecondaryStorageCommand.java
@@ -0,0 +1,32 @@
+// 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.agent.api;
+
+import com.cloud.host.Host;
+
+public class StartupSecondaryStorageCommand extends StartupCommand {
+
+	public StartupSecondaryStorageCommand() {
+        super(Host.Type.SecondaryStorage);
+        setIqn("NoIqn");
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartupStorageCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupStorageCommand.java b/core/src/com/cloud/agent/api/StartupStorageCommand.java
new file mode 100755
index 0000000..3c3b058
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartupStorageCommand.java
@@ -0,0 +1,110 @@
+// 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.agent.api;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.cloud.host.Host;
+import com.cloud.storage.Storage;
+import com.cloud.storage.Storage.StoragePoolType;
+import com.cloud.storage.template.TemplateInfo;
+
+
+public class StartupStorageCommand extends StartupCommand {
+
+	String parent;
+    Map<String, TemplateInfo> templateInfo;
+    long totalSize;
+    StoragePoolInfo poolInfo;
+    Storage.StorageResourceType resourceType;
+    StoragePoolType fsType;
+    Map<String, String> hostDetails = new HashMap<String, String>();
+    String nfsShare;
+
+    public StartupStorageCommand() {
+        super(Host.Type.Storage);
+    }
+
+    public StartupStorageCommand(String parent, StoragePoolType fsType, long totalSize, Map<String, TemplateInfo> info) {
+        super(Host.Type.Storage);
+        this.parent = parent;
+        this.totalSize = totalSize;
+        this.templateInfo = info;
+        this.poolInfo = null;
+        this.fsType = fsType;
+    }
+
+
+    public StartupStorageCommand(String parent, StoragePoolType fsType, Map<String, TemplateInfo> templateInfo, StoragePoolInfo poolInfo) {
+		super(Host.Type.Storage);
+		this.parent = parent;
+		this.templateInfo = templateInfo;
+		this.totalSize = poolInfo.capacityBytes;
+		this.poolInfo = poolInfo;
+		this.fsType = fsType;
+	}
+
+	public String getParent() {
+        return parent;
+    }
+
+	public void setParent(String parent) {
+        this.parent = parent;
+    }
+
+    public void setNfsShare(String nfsShare) {
+	    this.nfsShare = nfsShare;
+	}
+
+	public String getNfsShare() {
+	    return nfsShare;
+	}
+
+    public long getTotalSize() {
+        return totalSize;
+    }
+
+	public Map<String, TemplateInfo> getTemplateInfo() {
+		return templateInfo;
+	}
+
+	public void setTemplateInfo(Map<String, TemplateInfo> templateInfo) {
+		this.templateInfo = templateInfo;
+	}
+
+	public StoragePoolInfo getPoolInfo() {
+		return poolInfo;
+	}
+
+	public void setPoolInfo(StoragePoolInfo poolInfo) {
+		this.poolInfo = poolInfo;
+	}
+
+	public Storage.StorageResourceType getResourceType() {
+		return resourceType;
+	}
+
+	public void setResourceType(Storage.StorageResourceType resourceType) {
+		this.resourceType = resourceType;
+	}
+
+	/*For secondary storage*/
+	public Map<String, String> getHostDetails() {
+		return hostDetails;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartupTrafficMonitorCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupTrafficMonitorCommand.java b/core/src/com/cloud/agent/api/StartupTrafficMonitorCommand.java
new file mode 100644
index 0000000..bb8f3d7
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartupTrafficMonitorCommand.java
@@ -0,0 +1,26 @@
+// 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.agent.api;
+
+import com.cloud.host.Host;
+
+public class StartupTrafficMonitorCommand extends StartupCommand {
+    public StartupTrafficMonitorCommand() {
+        super(Host.Type.TrafficMonitor);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StopAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StopAnswer.java b/core/src/com/cloud/agent/api/StopAnswer.java
new file mode 100755
index 0000000..1111fed
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StopAnswer.java
@@ -0,0 +1,45 @@
+// 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.agent.api;
+
+public class StopAnswer extends RebootAnswer {
+    Integer vncPort;
+
+    protected StopAnswer() {
+    }
+
+    public StopAnswer(StopCommand cmd, String details, Integer vncPort, boolean success) {
+        super(cmd,  details, success);
+        this.vncPort = vncPort;
+    }
+
+    public StopAnswer(StopCommand cmd, String details, boolean success) {
+        super(cmd, details, success);
+        vncPort = null;
+
+    }
+
+    public StopAnswer(StopCommand cmd, Exception e) {
+        super(cmd, e);
+    }
+
+    @Override
+    public Integer getVncPort() {
+        return vncPort;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StopCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StopCommand.java b/core/src/com/cloud/agent/api/StopCommand.java
new file mode 100755
index 0000000..1c67f38
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StopCommand.java
@@ -0,0 +1,71 @@
+// 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.agent.api;
+
+import com.cloud.vm.VirtualMachine;
+
+public class StopCommand extends RebootCommand {
+    String vnet;
+    private boolean isProxy=false;
+    private String urlPort=null;
+    private String publicConsoleProxyIpAddress=null;
+
+    protected StopCommand() {
+    }
+
+    public StopCommand(VirtualMachine vm, boolean isProxy, String urlPort, String publicConsoleProxyIpAddress) {
+    	super(vm);
+    	this.isProxy = isProxy;
+    	this.urlPort = urlPort;
+    	this.publicConsoleProxyIpAddress = publicConsoleProxyIpAddress;
+    }
+
+    public StopCommand(VirtualMachine vm, String vnet) {
+        super(vm);
+        this.vnet = vnet;
+    }
+    
+    public StopCommand(VirtualMachine vm) {
+        super(vm);
+    }
+
+    public StopCommand(String vmName) {
+        super(vmName);
+    }
+
+    public String getVnet() {
+        return vnet;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+	public boolean isProxy() {
+		return this.isProxy;
+	}
+
+	public String getURLPort() {
+		return this.urlPort;
+	}
+
+	public String getPublicConsoleProxyIpAddress() {
+		return this.publicConsoleProxyIpAddress;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/TransferAgentCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/TransferAgentCommand.java b/core/src/com/cloud/agent/api/TransferAgentCommand.java
new file mode 100644
index 0000000..0dfde7e
--- /dev/null
+++ b/core/src/com/cloud/agent/api/TransferAgentCommand.java
@@ -0,0 +1,57 @@
+// 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.agent.api;
+
+import com.cloud.host.Status.Event;
+
+public class TransferAgentCommand extends Command {
+    protected long agentId;
+    protected long futureOwner;
+    protected long currentOwner;
+    Event event;
+
+    protected TransferAgentCommand() {
+    }
+
+    public TransferAgentCommand(long agentId, long currentOwner, long futureOwner, Event event) {
+        this.agentId = agentId;
+        this.currentOwner = currentOwner;
+        this.futureOwner = futureOwner;
+        this.event = event;
+    }
+
+    public long getAgentId() {
+        return agentId;
+    }
+
+    public long getFutureOwner() {
+        return futureOwner;
+    }
+
+    public Event getEvent() {
+        return event;
+    }
+
+    public long getCurrentOwner() {
+        return currentOwner;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/UnPlugNicAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/UnPlugNicAnswer.java b/core/src/com/cloud/agent/api/UnPlugNicAnswer.java
new file mode 100644
index 0000000..232afef
--- /dev/null
+++ b/core/src/com/cloud/agent/api/UnPlugNicAnswer.java
@@ -0,0 +1,25 @@
+// 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.agent.api;
+
+public class UnPlugNicAnswer extends Answer{
+    public UnPlugNicAnswer() {}
+
+    public UnPlugNicAnswer(UnPlugNicCommand cmd, boolean success, String result) {
+        super(cmd, success, result);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/UnPlugNicCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/UnPlugNicCommand.java b/core/src/com/cloud/agent/api/UnPlugNicCommand.java
new file mode 100644
index 0000000..b6cab88
--- /dev/null
+++ b/core/src/com/cloud/agent/api/UnPlugNicCommand.java
@@ -0,0 +1,45 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.to.NicTO;
+
+public class UnPlugNicCommand extends Command{
+    NicTO nic;
+    String instanceName;
+
+    public NicTO getNic() {
+        return nic;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    protected UnPlugNicCommand() {
+    }
+
+    public UnPlugNicCommand(NicTO nic, String instanceName) {
+        this.nic = nic;
+        this.instanceName = instanceName;
+    }
+
+    public String getInstanceName() {
+        return instanceName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/UnregisterVMCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/UnregisterVMCommand.java b/core/src/com/cloud/agent/api/UnregisterVMCommand.java
new file mode 100644
index 0000000..428ffea
--- /dev/null
+++ b/core/src/com/cloud/agent/api/UnregisterVMCommand.java
@@ -0,0 +1,34 @@
+// 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.agent.api;
+
+public class UnregisterVMCommand extends Command {
+    String vmName;
+
+    public UnregisterVMCommand(String vmName){
+        this.vmName = vmName;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public String getVmName() {
+        return vmName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/UpdateHostPasswordCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/UpdateHostPasswordCommand.java b/core/src/com/cloud/agent/api/UpdateHostPasswordCommand.java
new file mode 100644
index 0000000..27cfd19
--- /dev/null
+++ b/core/src/com/cloud/agent/api/UpdateHostPasswordCommand.java
@@ -0,0 +1,48 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+
+
+public class UpdateHostPasswordCommand extends Command {
+    @LogLevel(Log4jLevel.Off)
+    protected String _username;
+    @LogLevel(Log4jLevel.Off)
+    protected String _new_password;
+
+    protected UpdateHostPasswordCommand() {
+    }
+
+    public UpdateHostPasswordCommand(String username, String new_password) {
+        this._username = username;
+        this._new_password = new_password;
+    }
+
+    public String getNewPassword() {
+        return _new_password;
+    }
+
+    public String getUsername() {
+        return _username;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/UpgradeAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/UpgradeAnswer.java b/core/src/com/cloud/agent/api/UpgradeAnswer.java
new file mode 100644
index 0000000..00b0f25
--- /dev/null
+++ b/core/src/com/cloud/agent/api/UpgradeAnswer.java
@@ -0,0 +1,26 @@
+// 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.agent.api;
+
+public class UpgradeAnswer extends Answer {
+    protected UpgradeAnswer() {
+    }
+
+    public UpgradeAnswer(UpgradeCommand cmd, String failure) {
+        super(cmd, false, failure);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/UpgradeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/UpgradeCommand.java b/core/src/com/cloud/agent/api/UpgradeCommand.java
new file mode 100644
index 0000000..0e1b6d2
--- /dev/null
+++ b/core/src/com/cloud/agent/api/UpgradeCommand.java
@@ -0,0 +1,42 @@
+// 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.agent.api;
+
+/**
+ * UpgradeCommand is sent when the agent should update.
+ */
+public class UpgradeCommand extends Command {
+
+    String url;
+
+    protected UpgradeCommand() {
+    }
+
+    public UpgradeCommand(String url) {
+        this.url = url;
+    }
+
+    public String getUpgradeUrl() {
+        return url;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/UpgradeSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/UpgradeSnapshotCommand.java b/core/src/com/cloud/agent/api/UpgradeSnapshotCommand.java
new file mode 100644
index 0000000..f00f490
--- /dev/null
+++ b/core/src/com/cloud/agent/api/UpgradeSnapshotCommand.java
@@ -0,0 +1,64 @@
+// 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.agent.api;
+import com.cloud.storage.StoragePool;
+
+public class UpgradeSnapshotCommand extends SnapshotCommand {
+    private String version;
+    private Long templateId;
+    private Long tmpltAccountId;
+
+    protected UpgradeSnapshotCommand() {
+
+    }
+
+    /**
+     * @param primaryStoragePoolNameLabel   The UUID of the primary storage Pool
+     * @param secondaryStoragePoolURL  This is what shows up in the UI when you click on Secondary storage.
+     * @param snapshotUuid             The UUID of the snapshot which is going to be upgraded
+     * @param _version          version for this snapshot
+     */
+    public UpgradeSnapshotCommand(StoragePool pool,
+                                 String secondaryStoragePoolURL,
+                                 Long   dcId,
+                                 Long   accountId,
+                                 Long   volumeId,
+                                 Long   templateId,
+                                 Long   tmpltAccountId,
+                                 String volumePath,
+                                 String snapshotUuid,
+                                 String snapshotName,
+                                 String version)
+    {
+        super(pool, secondaryStoragePoolURL, snapshotUuid, snapshotName, dcId, accountId, volumeId);
+        this.version = version;
+        this.templateId = templateId;
+        this.tmpltAccountId = tmpltAccountId;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public Long getTemplateId() {
+        return templateId;
+    }
+
+    public Long getTmpltAccountId() {
+        return tmpltAccountId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/UploadTemplateToS3FromSecondaryStorageCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/UploadTemplateToS3FromSecondaryStorageCommand.java b/core/src/com/cloud/agent/api/UploadTemplateToS3FromSecondaryStorageCommand.java
new file mode 100644
index 0000000..1807cd5
--- /dev/null
+++ b/core/src/com/cloud/agent/api/UploadTemplateToS3FromSecondaryStorageCommand.java
@@ -0,0 +1,121 @@
+/*
+ * 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.agent.api;
+
+import com.cloud.agent.api.to.S3TO;
+
+public class UploadTemplateToS3FromSecondaryStorageCommand extends Command {
+
+    private final S3TO s3;
+    private final String storagePath;
+    private final Long dataCenterId;
+    private final Long accountId;
+    private final Long templateId;
+
+    public UploadTemplateToS3FromSecondaryStorageCommand(final S3TO s3,
+        final String storagePath, final Long dataCenterId, final Long accountId,
+        final Long templateId) {
+
+        super();
+
+        this.s3 = s3;
+        this.storagePath = storagePath;
+        this.dataCenterId = dataCenterId;
+        this.accountId = accountId;
+        this.templateId = templateId;
+
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    @Override
+    public boolean equals(final Object thatObject) {
+
+        if (this == thatObject) {
+            return true;
+        }
+
+        if (thatObject == null || getClass() != thatObject.getClass()) {
+            return false;
+        }
+
+        final UploadTemplateToS3FromSecondaryStorageCommand thatCommand =
+                (UploadTemplateToS3FromSecondaryStorageCommand) thatObject;
+
+        if (this.accountId != null ? !this.accountId.equals(thatCommand
+                .accountId) : thatCommand.accountId != null) {
+            return false;
+        }
+
+        if (this.dataCenterId != null ? !this.dataCenterId.equals(thatCommand
+                .dataCenterId) : thatCommand.dataCenterId != null) {
+            return false;
+        }
+
+        if (this.s3 != null ? !this.s3.equals(thatCommand.s3) : thatCommand.s3 != null) {
+            return false;
+        }
+
+        if (this.storagePath != null ? !this.storagePath.equals(thatCommand
+                .storagePath) : thatCommand.storagePath != null) {
+            return false;
+        }
+
+        if (this.templateId != null ? !this.templateId.equals(thatCommand.templateId) :
+                thatCommand.templateId != null) {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = this.s3 != null ? this.s3.hashCode() : 0;
+        result = 31 * result + (this.storagePath != null ? this.storagePath.hashCode() : 0);
+        result = 31 * result + (this.dataCenterId != null ? this.dataCenterId.hashCode() : 0);
+        result = 31 * result + (this.accountId != null ? this.accountId.hashCode() : 0);
+        result = 31 * result + (this.templateId != null ? this.templateId.hashCode() : 0);
+        return result;
+    }
+
+    public S3TO getS3() {
+        return this.s3;
+    }
+
+    public String getStoragePath() {
+        return this.storagePath;
+    }
+
+    public Long getDataCenterId() {
+        return this.dataCenterId;
+    }
+
+    public Long getAccountId() {
+        return this.accountId;
+    }
+
+    public Long getTemplateId() {
+        return this.templateId;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/UploadTemplateToSwiftFromSecondaryStorageCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/UploadTemplateToSwiftFromSecondaryStorageCommand.java b/core/src/com/cloud/agent/api/UploadTemplateToSwiftFromSecondaryStorageCommand.java
new file mode 100644
index 0000000..7ba377d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/UploadTemplateToSwiftFromSecondaryStorageCommand.java
@@ -0,0 +1,80 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.agent.api.to.SwiftTO;
+
+/**
+ *
+ *
+ */
+
+public class UploadTemplateToSwiftFromSecondaryStorageCommand extends Command {
+    @LogLevel(Log4jLevel.Off)
+    private SwiftTO swift;
+    private String secondaryStorageUrl;
+
+    private Long dcId;
+    private Long accountId;
+    private Long templateId;
+
+    protected UploadTemplateToSwiftFromSecondaryStorageCommand() {
+
+    }
+
+    public UploadTemplateToSwiftFromSecondaryStorageCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long templateId, int wait) {
+
+        this.swift = swift;
+        this.secondaryStorageUrl = secondaryStorageUrl;
+        this.dcId = dcId;
+        this.accountId = accountId;
+        this.templateId = templateId;
+        setWait(wait);
+    }
+
+    public SwiftTO getSwift() {
+        return this.swift;
+    }
+
+    public void setSwift(SwiftTO swift) {
+        this.swift = swift;
+    }
+
+    public String getSecondaryStorageUrl() {
+        return secondaryStorageUrl;
+    }
+
+    public Long getDcId() {
+        return dcId;
+    }
+
+    public Long getAccountId() {
+        return accountId;
+    }
+
+    public Long getTemplateId() {
+        return templateId;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        // TODO Auto-generated method stub
+        return true;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/VMSnapshotBaseCommand.java b/core/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
new file mode 100644
index 0000000..2120f2f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
@@ -0,0 +1,74 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class VMSnapshotBaseCommand extends Command{
+    protected List<VolumeTO> volumeTOs;
+    protected VMSnapshotTO target;
+    protected String vmName;
+    protected String guestOSType;
+    
+    
+    public VMSnapshotBaseCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType) {
+        this.vmName = vmName;
+        this.target = snapshot;
+        this.volumeTOs = volumeTOs;
+        this.guestOSType = guestOSType;
+    }
+    
+    public List<VolumeTO> getVolumeTOs() {
+        return volumeTOs;
+    }
+
+    public void setVolumeTOs(List<VolumeTO> volumeTOs) {
+        this.volumeTOs = volumeTOs;
+    }
+
+    public VMSnapshotTO getTarget() {
+        return target;
+    }
+
+    public void setTarget(VMSnapshotTO target) {
+        this.target = target;
+    }
+
+    public String getVmName() {
+        return vmName;
+    }
+
+    public void setVmName(String vmName) {
+        this.vmName = vmName;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public String getGuestOSType() {
+        return guestOSType;
+    }
+
+    public void setGuestOSType(String guestOSType) {
+        this.guestOSType = guestOSType;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/VMSnapshotTO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/VMSnapshotTO.java b/core/src/com/cloud/agent/api/VMSnapshotTO.java
new file mode 100644
index 0000000..c7b42d2
--- /dev/null
+++ b/core/src/com/cloud/agent/api/VMSnapshotTO.java
@@ -0,0 +1,90 @@
+// 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.agent.api;
+
+import com.cloud.vm.snapshot.VMSnapshot;
+
+public class VMSnapshotTO {
+	private Long id;
+    private String snapshotName;
+    private VMSnapshot.Type type;
+    private Long createTime;
+    private Boolean current;
+    private String description;
+    private VMSnapshotTO parent;
+    
+    public Long getId() {
+		return id;
+	}
+	public void setId(Long id) {
+		this.id = id;
+	}
+	public VMSnapshotTO(Long id, String snapshotName, 
+	        VMSnapshot.Type type, Long createTime, 
+			String description, Boolean current, VMSnapshotTO parent) {
+		super();
+		this.id = id;
+		this.snapshotName = snapshotName;
+		this.type = type;
+		this.createTime = createTime;
+		this.current = current;
+		this.description = description;
+		this.parent = parent;
+	}
+	public VMSnapshotTO() {
+	    
+	}
+	public String getDescription() {
+		return description;
+	}
+	public void setDescription(String description) {
+		this.description = description;
+	}
+	public Boolean getCurrent() {
+        return current;
+    }
+    public void setCurrent(Boolean current) {
+        this.current = current;
+    }
+    public Long getCreateTime() {
+        return createTime;
+    }
+    public void setCreateTime(Long createTime) {
+        this.createTime = createTime;
+    }
+ 
+    public VMSnapshot.Type getType() {
+        return type;
+    }
+    public void setType(VMSnapshot.Type type) {
+        this.type = type;
+    }
+
+    public String getSnapshotName() {
+        return snapshotName;
+    }
+    public void setSnapshotName(String snapshotName) {
+        this.snapshotName = snapshotName;
+    }
+    public VMSnapshotTO getParent() {
+        return parent;
+    }
+    public void setParent(VMSnapshotTO parent) {
+        this.parent = parent;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ValidateSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ValidateSnapshotAnswer.java b/core/src/com/cloud/agent/api/ValidateSnapshotAnswer.java
new file mode 100644
index 0000000..f5bb544
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ValidateSnapshotAnswer.java
@@ -0,0 +1,53 @@
+// 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.agent.api;
+
+
+public class ValidateSnapshotAnswer extends Answer {
+    private String expectedSnapshotBackupUuid;
+    private String actualSnapshotBackupUuid;
+    private String actualSnapshotUuid;
+
+    protected ValidateSnapshotAnswer() {
+
+    }
+
+    public ValidateSnapshotAnswer(ValidateSnapshotCommand cmd, boolean success, String result, String expectedSnapshotBackupUuid, String actualSnapshotBackupUuid, String actualSnapshotUuid) {
+        super(cmd, success, result);
+        this.expectedSnapshotBackupUuid = expectedSnapshotBackupUuid;
+        this.actualSnapshotBackupUuid = actualSnapshotBackupUuid;
+        this.actualSnapshotUuid = actualSnapshotUuid;
+    }
+
+    /**
+     * @return the expectedSnapshotBackupUuid
+     */
+    public String getExpectedSnapshotBackupUuid() {
+        return expectedSnapshotBackupUuid;
+    }
+
+    /**
+     * @return the actualSnapshotBackupUuid
+     */
+    public String getActualSnapshotBackupUuid() {
+        return actualSnapshotBackupUuid;
+    }
+
+    public String getActualSnapshotUuid() {
+        return actualSnapshotUuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ValidateSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ValidateSnapshotCommand.java b/core/src/com/cloud/agent/api/ValidateSnapshotCommand.java
new file mode 100644
index 0000000..9ffbf29
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ValidateSnapshotCommand.java
@@ -0,0 +1,84 @@
+// 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.agent.api;
+
+public class ValidateSnapshotCommand extends Command {
+    private String primaryStoragePoolNameLabel;
+    private String volumeUuid;
+    private String firstBackupUuid;
+    private String previousSnapshotUuid;
+    private String templateUuid;
+
+    protected ValidateSnapshotCommand() {
+
+    }
+
+    /**
+     * @param primaryStoragePoolNameLabel   The primary storage Pool Name Label
+     * @param volumeUuid        The UUID of the volume for which the snapshot was taken
+     * @param firstBackupUuid   This UUID of the first snapshot that was ever taken for this volume, even it was deleted.
+     * @param previousSnapshotUuid The UUID of the previous snapshot on the primary.
+     * @param templateUuid      If this is a root volume and no snapshot has been taken for it,
+     *                          this is the UUID of the template VDI.
+     */
+    public ValidateSnapshotCommand(String primaryStoragePoolNameLabel,
+                                                 String volumeUuid,
+                                                 String firstBackupUuid,
+                                                 String previousSnapshotUuid,
+                                                 String templateUuid)
+    {
+        this.primaryStoragePoolNameLabel = primaryStoragePoolNameLabel;
+        this.volumeUuid                  = volumeUuid;
+        this.firstBackupUuid             = firstBackupUuid;
+        this.previousSnapshotUuid        = previousSnapshotUuid;
+        this.templateUuid                = templateUuid;
+    }
+
+    public String getPrimaryStoragePoolNameLabel() {
+        return primaryStoragePoolNameLabel;
+    }
+
+    /**
+     * @return the volumeUuid
+     */
+    public String getVolumeUuid() {
+        return volumeUuid;
+    }
+
+    /**
+     * @return the firstBackupUuid
+     */
+    public String getFirstBackupUuid() {
+        return firstBackupUuid;
+    }
+
+    public String getPreviousSnapshotUuid() {
+        return previousSnapshotUuid;
+    }
+
+    /**
+     * @return the templateUuid
+     */
+    public String getTemplateUuid() {
+        return templateUuid;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/VmStatsEntry.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/VmStatsEntry.java b/core/src/com/cloud/agent/api/VmStatsEntry.java
new file mode 100755
index 0000000..8828e91
--- /dev/null
+++ b/core/src/com/cloud/agent/api/VmStatsEntry.java
@@ -0,0 +1,82 @@
+// 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.agent.api;
+
+import com.cloud.vm.VmStats;
+
+public class VmStatsEntry implements VmStats {
+
+	double cpuUtilization;
+	double networkReadKBs;
+	double networkWriteKBs;
+	int numCPUs;
+	String entityType;
+
+    public VmStatsEntry() {
+    }
+
+    public VmStatsEntry(double cpuUtilization, double networkReadKBs, double networkWriteKBs, int numCPUs, String entityType)
+    {
+        this.cpuUtilization = cpuUtilization;
+        this.networkReadKBs = networkReadKBs;
+        this.networkWriteKBs = networkWriteKBs;
+        this.numCPUs = numCPUs;
+        this.entityType = entityType;
+    }
+
+    public double getCPUUtilization() {
+    	return cpuUtilization;
+    }
+
+    public void setCPUUtilization(double cpuUtilization) {
+    	this.cpuUtilization = cpuUtilization;
+    }
+
+    public double getNetworkReadKBs() {
+    	return networkReadKBs;
+    }
+
+    public void setNetworkReadKBs(double networkReadKBs) {
+    	this.networkReadKBs = networkReadKBs;
+    }
+
+    public double getNetworkWriteKBs() {
+    	return networkWriteKBs;
+    }
+
+    public void setNetworkWriteKBs(double networkWriteKBs) {
+    	this.networkWriteKBs = networkWriteKBs;
+    }
+
+    public int getNumCPUs() {
+    	return numCPUs;
+    }
+
+    public void setNumCPUs(int numCPUs) {
+    	this.numCPUs = numCPUs;
+    }
+
+    public String getEntityType(){
+    	return this.entityType;
+    }
+
+    public void setEntityType(String entityType){
+    	this.entityType = entityType;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/baremetal/IpmISetBootDevCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/baremetal/IpmISetBootDevCommand.java b/core/src/com/cloud/agent/api/baremetal/IpmISetBootDevCommand.java
new file mode 100644
index 0000000..fdd1fe9
--- /dev/null
+++ b/core/src/com/cloud/agent/api/baremetal/IpmISetBootDevCommand.java
@@ -0,0 +1,43 @@
+// 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.agent.api.baremetal;
+
+import com.cloud.agent.api.Command;
+
+public class IpmISetBootDevCommand extends Command {
+	public enum BootDev {
+		pxe(),
+		disk(),
+		cdrom(),
+	}
+
+	BootDev bootDev;
+
+	public BootDev getBootDev() {
+		return bootDev;
+	}
+
+	public IpmISetBootDevCommand(BootDev dev) {
+		bootDev = dev;
+	}
+
+	@Override
+	public boolean executeInSequence() {
+		return true;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/baremetal/IpmiBootorResetCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/baremetal/IpmiBootorResetCommand.java b/core/src/com/cloud/agent/api/baremetal/IpmiBootorResetCommand.java
new file mode 100644
index 0000000..4f8dcaf
--- /dev/null
+++ b/core/src/com/cloud/agent/api/baremetal/IpmiBootorResetCommand.java
@@ -0,0 +1,28 @@
+// 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.agent.api.baremetal;
+
+import com.cloud.agent.api.Command;
+
+public class IpmiBootorResetCommand extends Command {
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/baremetal/PreparePxeServerAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/baremetal/PreparePxeServerAnswer.java b/core/src/com/cloud/agent/api/baremetal/PreparePxeServerAnswer.java
new file mode 100644
index 0000000..d8f0529
--- /dev/null
+++ b/core/src/com/cloud/agent/api/baremetal/PreparePxeServerAnswer.java
@@ -0,0 +1,29 @@
+// 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.agent.api.baremetal;
+
+import com.cloud.agent.api.Answer;
+
+public class PreparePxeServerAnswer extends Answer {
+	public PreparePxeServerAnswer(PreparePxeServerCommand cmd) {
+		super(cmd, true, "SUCCESS");
+	}
+
+	public PreparePxeServerAnswer(PreparePxeServerCommand cmd, String details) {
+		super(cmd, false, details);
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/baremetal/PreparePxeServerCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/baremetal/PreparePxeServerCommand.java b/core/src/com/cloud/agent/api/baremetal/PreparePxeServerCommand.java
new file mode 100644
index 0000000..6c73563
--- /dev/null
+++ b/core/src/com/cloud/agent/api/baremetal/PreparePxeServerCommand.java
@@ -0,0 +1,80 @@
+// 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.agent.api.baremetal;
+
+import com.cloud.agent.api.Command;
+
+public class PreparePxeServerCommand extends Command {
+
+	String ip;
+	String mac;
+	String netMask;
+	String gateway;
+	String dns;
+	String template;
+	String vmName;
+	String hostName;
+
+	@Override
+	public boolean executeInSequence() {
+		return true;
+	}
+
+	public PreparePxeServerCommand(String ip, String mac, String netMask, String gateway, String dns, String template, String vmName, String hostName) {
+		this.ip = ip;
+		this.mac = mac;
+		this.netMask = netMask;
+		this.gateway = gateway;
+		this.dns = dns;
+		this.template = template;
+		this.vmName = vmName;
+		this.hostName = hostName;
+	}
+
+	public String getIp() {
+		return ip;
+	}
+
+	public String getMac() {
+		return mac;
+	}
+
+	public String getNetMask() {
+		return netMask;
+	}
+
+	public String getGateWay() {
+		return gateway;
+	}
+
+	public String getDns() {
+		return dns;
+	}
+
+	public String getTemplate() {
+		return template;
+	}
+
+	public String getVmName() {
+		return vmName;
+	}
+
+	public String getHostName() {
+		return hostName;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/baremetal/prepareCreateTemplateCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/baremetal/prepareCreateTemplateCommand.java b/core/src/com/cloud/agent/api/baremetal/prepareCreateTemplateCommand.java
new file mode 100644
index 0000000..b187420
--- /dev/null
+++ b/core/src/com/cloud/agent/api/baremetal/prepareCreateTemplateCommand.java
@@ -0,0 +1,66 @@
+// 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.agent.api.baremetal;
+
+import com.cloud.agent.api.Command;
+
+public class prepareCreateTemplateCommand extends Command {
+    String ip;
+    String mac;
+    String netMask;
+    String gateway;
+    String dns;
+    String template;
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    public prepareCreateTemplateCommand(String ip, String mac, String netMask, String gateway, String dns, String template) {
+        this.ip = ip;
+        this.mac = mac;
+        this.netMask = netMask;
+        this.gateway = gateway;
+        this.dns = dns;
+        this.template = template;
+    }
+
+    public String getIp() {
+        return ip;
+    }
+
+    public String getMac() {
+        return mac;
+    }
+
+    public String getNetMask() {
+        return netMask;
+    }
+
+    public String getGateWay() {
+        return gateway;
+    }
+
+    public String getDns() {
+        return dns;
+    }
+
+    public String getTemplate() {
+        return template;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/check/CheckSshAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/check/CheckSshAnswer.java b/core/src/com/cloud/agent/api/check/CheckSshAnswer.java
new file mode 100644
index 0000000..3414eb0
--- /dev/null
+++ b/core/src/com/cloud/agent/api/check/CheckSshAnswer.java
@@ -0,0 +1,37 @@
+// 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.agent.api.check;
+
+import com.cloud.agent.api.Answer;
+
+public class CheckSshAnswer extends Answer {
+    protected CheckSshAnswer() {
+
+    }
+
+    public CheckSshAnswer(CheckSshCommand cmd) {
+        super(cmd, true, null);
+    }
+
+    public CheckSshAnswer(CheckSshCommand cmd, String details) {
+        super(cmd, false, details);
+    }
+
+    public CheckSshAnswer(CheckSshCommand cmd, Throwable th) {
+        super(cmd, false, th.getMessage());
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/check/CheckSshCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/check/CheckSshCommand.java b/core/src/com/cloud/agent/api/check/CheckSshCommand.java
new file mode 100644
index 0000000..e384983
--- /dev/null
+++ b/core/src/com/cloud/agent/api/check/CheckSshCommand.java
@@ -0,0 +1,65 @@
+// 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.agent.api.check;
+
+import com.cloud.agent.api.Command;
+
+public class CheckSshCommand extends Command {
+    String ip;
+    int port;
+    int interval;
+    int retries;
+    String name;
+
+    protected CheckSshCommand() {
+        super();
+    }
+
+    public CheckSshCommand(String instanceName, String ip, int port) {
+        super();
+        this.ip = ip;
+        this.port = port;
+        this.interval = 6;
+        this.retries = 100;
+        this.name = instanceName;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getIp() {
+        return ip;
+    }
+
+    public int getPort() {
+        return port;
+    }
+
+    public int getInterval() {
+        return interval;
+    }
+
+    public int getRetries() {
+        return retries;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/proxy/CheckConsoleProxyLoadCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/proxy/CheckConsoleProxyLoadCommand.java b/core/src/com/cloud/agent/api/proxy/CheckConsoleProxyLoadCommand.java
new file mode 100644
index 0000000..7582b0d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/proxy/CheckConsoleProxyLoadCommand.java
@@ -0,0 +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.agent.api.proxy;
+
+
+/**
+ * CheckConsoleProxyLoadCommand implements one-shot console proxy load-scan command
+ */
+public class CheckConsoleProxyLoadCommand extends ProxyCommand {
+
+	private long proxyVmId;
+	private String proxyVmName;
+	private String proxyManagementIp;
+	private int proxyCmdPort;
+
+	public CheckConsoleProxyLoadCommand() {
+	}
+
+	public CheckConsoleProxyLoadCommand(long proxyVmId, String proxyVmName, String proxyManagementIp, int proxyCmdPort) {
+		this.proxyVmId = proxyVmId;
+		this.proxyVmName = proxyVmName;
+		this.proxyManagementIp = proxyManagementIp;
+		this.proxyCmdPort = proxyCmdPort;
+	}
+
+	public long getProxyVmId() {
+		return proxyVmId;
+	}
+
+	public String getProxyVmName() {
+		return proxyVmName;
+	}
+
+	public String getProxyManagementIp() {
+		return proxyManagementIp;
+	}
+
+	public int getProxyCmdPort() {
+		return proxyCmdPort;
+	}
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/proxy/ConsoleProxyLoadAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/proxy/ConsoleProxyLoadAnswer.java b/core/src/com/cloud/agent/api/proxy/ConsoleProxyLoadAnswer.java
new file mode 100644
index 0000000..ae93f51
--- /dev/null
+++ b/core/src/com/cloud/agent/api/proxy/ConsoleProxyLoadAnswer.java
@@ -0,0 +1,44 @@
+// 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.agent.api.proxy;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+
+public class ConsoleProxyLoadAnswer extends Answer {
+
+	private long proxyVmId;
+	private String proxyVmName;
+
+	protected ConsoleProxyLoadAnswer() {
+	}
+
+	public ConsoleProxyLoadAnswer(Command command, long proxyVmId, String proxyVmName, boolean success, String details) {
+		super(command, success, details);
+
+		this.proxyVmId = proxyVmId;
+		this.proxyVmName = proxyVmName;
+	}
+
+	public long getProxyVmId() {
+		return proxyVmId;
+	}
+
+	public String getProxyVmName() {
+		return proxyVmName;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/proxy/ProxyCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/proxy/ProxyCommand.java b/core/src/com/cloud/agent/api/proxy/ProxyCommand.java
new file mode 100644
index 0000000..b283eb8
--- /dev/null
+++ b/core/src/com/cloud/agent/api/proxy/ProxyCommand.java
@@ -0,0 +1,25 @@
+// 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.agent.api.proxy;
+
+import com.cloud.agent.api.Command;
+
+public abstract class ProxyCommand extends Command {
+    protected ProxyCommand() {
+        super();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/proxy/StartConsoleProxyAgentHttpHandlerCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/proxy/StartConsoleProxyAgentHttpHandlerCommand.java b/core/src/com/cloud/agent/api/proxy/StartConsoleProxyAgentHttpHandlerCommand.java
new file mode 100644
index 0000000..3befc2f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/proxy/StartConsoleProxyAgentHttpHandlerCommand.java
@@ -0,0 +1,68 @@
+// 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.agent.api.proxy;
+
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.LogLevel;
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+
+public class StartConsoleProxyAgentHttpHandlerCommand extends Command {
+    @LogLevel(Log4jLevel.Off)
+	private byte[] keystoreBits;
+    @LogLevel(Log4jLevel.Off)
+	private String keystorePassword;
+    @LogLevel(Log4jLevel.Off)
+	private String encryptorPassword;
+
+	public StartConsoleProxyAgentHttpHandlerCommand() {
+		super();
+	}
+
+	public StartConsoleProxyAgentHttpHandlerCommand(byte[] ksBits, String ksPassword) {
+		this.keystoreBits = ksBits;
+		this.keystorePassword = ksPassword;
+	}
+
+	@Override
+	public boolean executeInSequence() {
+		return true;
+	}
+
+	public byte[] getKeystoreBits() {
+		return keystoreBits;
+	}
+
+	public void setKeystoreBits(byte[] keystoreBits) {
+		this.keystoreBits = keystoreBits;
+	}
+
+	public String getKeystorePassword() {
+		return keystorePassword;
+	}
+
+	public void setKeystorePassword(String keystorePassword) {
+		this.keystorePassword = keystorePassword;
+	}
+
+	public String getEncryptorPassword() {
+		return encryptorPassword;
+	}
+
+	public void setEncryptorPassword(String encryptorPassword) {
+		this.encryptorPassword = encryptorPassword;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/proxy/WatchConsoleProxyLoadCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/proxy/WatchConsoleProxyLoadCommand.java b/core/src/com/cloud/agent/api/proxy/WatchConsoleProxyLoadCommand.java
new file mode 100644
index 0000000..ef4a549
--- /dev/null
+++ b/core/src/com/cloud/agent/api/proxy/WatchConsoleProxyLoadCommand.java
@@ -0,0 +1,65 @@
+// 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.agent.api.proxy;
+
+import com.cloud.agent.api.CronCommand;
+
+public class WatchConsoleProxyLoadCommand extends ProxyCommand implements CronCommand {
+
+	private long proxyVmId;
+	private String proxyVmName;
+	private String proxyManagementIp;
+	private int proxyCmdPort;
+	int interval;
+
+    public WatchConsoleProxyLoadCommand(int interval, long proxyVmId, String proxyVmName,
+    	String proxyManagementIp, int proxyCmdPort) {
+        this.interval = interval;
+    	this.proxyVmId = proxyVmId;
+		this.proxyVmName = proxyVmName;
+		this.proxyManagementIp = proxyManagementIp;
+		this.proxyCmdPort = proxyCmdPort;
+    }
+
+	protected WatchConsoleProxyLoadCommand() {
+	}
+
+	public long getProxyVmId() {
+		return proxyVmId;
+	}
+
+	public String getProxyVmName() {
+		return proxyVmName;
+	}
+
+	public String getProxyManagementIp() {
+		return proxyManagementIp;
+	}
+
+	public int getProxyCmdPort() {
+		return proxyCmdPort;
+	}
+
+	public int getInterval() {
+	    return interval;
+	}
+
+	@Override
+    public boolean executeInSequence() {
+	    return false;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/CreateLoadBalancerApplianceCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/CreateLoadBalancerApplianceCommand.java b/core/src/com/cloud/agent/api/routing/CreateLoadBalancerApplianceCommand.java
new file mode 100644
index 0000000..dc7f1a1
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/CreateLoadBalancerApplianceCommand.java
@@ -0,0 +1,48 @@
+// 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.agent.api.routing;
+
+/** NetworkElementCommand to spin a load balancer appliance */
+
+public class CreateLoadBalancerApplianceCommand extends NetworkElementCommand {
+
+    String ip;
+    String netmask;
+    String gateway;
+    String username;
+    String password;
+    String publicInterface;
+    String privateInterface;
+
+    public CreateLoadBalancerApplianceCommand(String ip, String netmask, String gateway) {
+        this.ip = ip;
+        this.netmask = netmask;
+        this.gateway = gateway;
+    }
+
+    public String getLoadBalancerIP() {
+        return ip;
+    }
+
+    public String getNetmask() {
+        return netmask;
+    }
+
+    public String getGateway() {
+        return gateway;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/routing/DestroyLoadBalancerApplianceCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/routing/DestroyLoadBalancerApplianceCommand.java b/core/src/com/cloud/agent/api/routing/DestroyLoadBalancerApplianceCommand.java
new file mode 100644
index 0000000..5f46d82
--- /dev/null
+++ b/core/src/com/cloud/agent/api/routing/DestroyLoadBalancerApplianceCommand.java
@@ -0,0 +1,32 @@
+// 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.
+/** NetworkElementCommand to destroy a VPX instance on the Netscaler SDX load balancer appliance */
+//TODO: fill in the Nitro API parameters required
+package com.cloud.agent.api.routing;
+
+public class DestroyLoadBalancerApplianceCommand extends NetworkElementCommand {
+
+    String ip;
+
+    public DestroyLoadBalancerApplianceCommand(String ip) {
+        this.ip = ip;
+    }
+
+    public String getLoadBalancerIP() {
+        return ip;
+    }
+}


[07/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/rules/dao/PortForwardingRulesDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/rules/dao/PortForwardingRulesDaoImpl.java b/engine/schema/src/com/cloud/network/rules/dao/PortForwardingRulesDaoImpl.java
new file mode 100644
index 0000000..cc780cb
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/rules/dao/PortForwardingRulesDaoImpl.java
@@ -0,0 +1,162 @@
+// 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.network.rules.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.dao.FirewallRulesCidrsDao;
+import com.cloud.network.dao.FirewallRulesCidrsDaoImpl;
+import com.cloud.network.rules.FirewallRule.Purpose;
+import com.cloud.network.rules.FirewallRule.State;
+import com.cloud.network.rules.PortForwardingRuleVO;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.vm.dao.NicSecondaryIpVO;
+
+@Component
+@Local(value=PortForwardingRulesDao.class)
+public class PortForwardingRulesDaoImpl extends GenericDaoBase<PortForwardingRuleVO, Long> implements PortForwardingRulesDao {
+
+    protected final SearchBuilder<PortForwardingRuleVO> AllFieldsSearch;
+    protected final SearchBuilder<PortForwardingRuleVO> ApplicationSearch;
+    protected final SearchBuilder<PortForwardingRuleVO> ActiveRulesSearch;
+    protected final SearchBuilder<PortForwardingRuleVO> AllRulesSearchByVM;
+    protected final SearchBuilder<PortForwardingRuleVO> ActiveRulesSearchByAccount;
+
+    @Inject protected FirewallRulesCidrsDao _portForwardingRulesCidrsDao;
+    
+    protected PortForwardingRulesDaoImpl() {
+        super();
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ);
+        AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ);
+        AllFieldsSearch.and("ipId", AllFieldsSearch.entity().getSourceIpAddressId(), Op.EQ);
+        AllFieldsSearch.and("protocol", AllFieldsSearch.entity().getProtocol(), Op.EQ);
+        AllFieldsSearch.and("networkId", AllFieldsSearch.entity().getNetworkId(), Op.EQ);
+        AllFieldsSearch.and("vmId", AllFieldsSearch.entity().getVirtualMachineId(), Op.EQ);
+        AllFieldsSearch.and("purpose", AllFieldsSearch.entity().getPurpose(), Op.EQ);
+        AllFieldsSearch.and("dstIp", AllFieldsSearch.entity().getDestinationIpAddress(), Op.EQ);
+        AllFieldsSearch.done();
+        
+        ApplicationSearch = createSearchBuilder();
+        ApplicationSearch.and("ipId", ApplicationSearch.entity().getSourceIpAddressId(), Op.EQ);
+        ApplicationSearch.and("state", ApplicationSearch.entity().getState(), Op.NEQ);
+        ApplicationSearch.and("purpose", ApplicationSearch.entity().getPurpose(), Op.EQ);
+        ApplicationSearch.done();
+        
+        
+        ActiveRulesSearch = createSearchBuilder();
+        ActiveRulesSearch.and("ipId", ActiveRulesSearch.entity().getSourceIpAddressId(), Op.EQ);
+        ActiveRulesSearch.and("networkId", ActiveRulesSearch.entity().getNetworkId(), Op.EQ);
+        ActiveRulesSearch.and("state", ActiveRulesSearch.entity().getState(), Op.NEQ);
+        ActiveRulesSearch.and("purpose", ActiveRulesSearch.entity().getPurpose(), Op.EQ);
+        ActiveRulesSearch.done();
+        
+        AllRulesSearchByVM = createSearchBuilder();
+        AllRulesSearchByVM.and("vmId", AllRulesSearchByVM.entity().getVirtualMachineId(), Op.EQ);
+        AllRulesSearchByVM.and("purpose", AllRulesSearchByVM.entity().getPurpose(), Op.EQ);
+        AllRulesSearchByVM.done();
+        
+        ActiveRulesSearchByAccount = createSearchBuilder();
+        ActiveRulesSearchByAccount.and("accountId", ActiveRulesSearchByAccount.entity().getAccountId(), Op.EQ);
+        ActiveRulesSearchByAccount.and("state", ActiveRulesSearchByAccount.entity().getState(), Op.NEQ);
+        ActiveRulesSearchByAccount.and("purpose", ActiveRulesSearchByAccount.entity().getPurpose(), Op.EQ);
+        ActiveRulesSearchByAccount.done();
+    }
+
+    @Override
+    public List<PortForwardingRuleVO> listForApplication(long ipId) {
+        SearchCriteria<PortForwardingRuleVO> sc = ApplicationSearch.create();
+        sc.setParameters("ipId", ipId);
+        sc.setParameters("state", State.Staged);
+        sc.setParameters("purpose", Purpose.PortForwarding);
+        
+        return listBy(sc, null);
+    }
+    
+    @Override
+    public List<PortForwardingRuleVO> listByVm(Long vmId) {
+    	SearchCriteria<PortForwardingRuleVO> sc = AllRulesSearchByVM.create();
+    	sc.setParameters("vmId", vmId);
+    	sc.setParameters("purpose", Purpose.PortForwarding);
+    	
+    	return listBy(sc, null);
+    }
+
+    @Override
+    public List<PortForwardingRuleVO> listByIpAndNotRevoked(long ipId) {
+        SearchCriteria<PortForwardingRuleVO> sc = ActiveRulesSearch.create();
+        sc.setParameters("ipId", ipId);
+        sc.setParameters("state", State.Revoke);
+        sc.setParameters("purpose", Purpose.PortForwarding);
+        
+        return listBy(sc, null);
+    }
+    
+    @Override
+    public List<PortForwardingRuleVO> listByNetworkAndNotRevoked(long networkId) {
+        SearchCriteria<PortForwardingRuleVO> sc = ActiveRulesSearch.create();
+        sc.setParameters("networkId", networkId);
+        sc.setParameters("state", State.Revoke);
+        sc.setParameters("purpose", Purpose.PortForwarding);
+        
+        return listBy(sc, null);
+    }
+    
+    @Override
+    public List<PortForwardingRuleVO> listByIp(long ipId) {
+        SearchCriteria<PortForwardingRuleVO> sc = AllFieldsSearch.create();
+        sc.setParameters("ipId", ipId);
+        sc.setParameters("purpose", Purpose.PortForwarding);
+        
+        return listBy(sc, null);
+    }
+    
+    @Override
+    public List<PortForwardingRuleVO> listByNetwork(long networkId) {
+        SearchCriteria<PortForwardingRuleVO> sc = AllFieldsSearch.create();
+        sc.setParameters("networkId", networkId);
+        sc.setParameters("purpose", Purpose.PortForwarding);
+        
+        return listBy(sc);
+    }
+
+    @Override
+    public List<PortForwardingRuleVO> listByAccount(long accountId) {
+        SearchCriteria<PortForwardingRuleVO> sc = ActiveRulesSearchByAccount.create();
+        sc.setParameters("accountId", accountId);
+        sc.setParameters("state", State.Revoke);
+        sc.setParameters("purpose", Purpose.PortForwarding);
+        
+        return listBy(sc);
+    }
+    @Override
+    public List<PortForwardingRuleVO> listByDestIpAddr(String ip4Address) {
+        SearchCriteria<PortForwardingRuleVO> sc = AllFieldsSearch.create();
+        sc.setParameters("dstIp", ip4Address);
+        return listBy(sc);
+    }
+  
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/SecurityGroupRuleVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/SecurityGroupRuleVO.java b/engine/schema/src/com/cloud/network/security/SecurityGroupRuleVO.java
new file mode 100644
index 0000000..f01b50f
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/SecurityGroupRuleVO.java
@@ -0,0 +1,167 @@
+// 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.network.security;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.async.AsyncInstanceCreateStatus;
+import com.google.gson.annotations.Expose;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = ("security_group_rule"))
+public class SecurityGroupRuleVO implements SecurityRule {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "security_group_id")
+    private long securityGroupId;
+
+    @Column(name = "start_port")
+    private int startPort;
+
+    @Column(name = "end_port")
+    private int endPort;
+
+    @Column(name = "type")
+    private String type;
+
+    @Column(name = "protocol")
+    private String protocol;
+
+    @Column(name = "allowed_network_id", nullable = true)
+    private Long allowedNetworkId = null;
+
+    @Column(name = "allowed_ip_cidr", nullable = true)
+    private String allowedSourceIpCidr = null;
+
+    @Expose
+    @Column(name = "create_status", updatable = true, nullable = false)
+    @Enumerated(value = EnumType.STRING)
+    private AsyncInstanceCreateStatus createStatus;
+
+    @Column(name = "uuid")
+    private String uuid;
+    
+    public SecurityGroupRuleVO() {
+    	this.uuid = UUID.randomUUID().toString();
+    }
+
+    public SecurityGroupRuleVO(SecurityRuleType type,long securityGroupId, int fromPort, int toPort, String protocol, long allowedNetworkId ) {
+        this.securityGroupId = securityGroupId;
+        this.startPort = fromPort;
+        this.endPort = toPort;
+        this.protocol = protocol;
+        this.allowedNetworkId = allowedNetworkId;
+    	this.uuid = UUID.randomUUID().toString();
+        if (type == SecurityRuleType.IngressRule) {
+            this.type = SecurityRuleType.IngressRule.getType();
+        } else {
+            this.type = SecurityRuleType.EgressRule.getType();
+        }
+    }
+
+    public SecurityGroupRuleVO(SecurityRuleType type,long securityGroupId, int fromPort, int toPort, String protocol, String allowedIpCidr) {
+        this.securityGroupId = securityGroupId;
+        this.startPort = fromPort;
+        this.endPort = toPort;
+        this.protocol = protocol;
+        this.allowedSourceIpCidr = allowedIpCidr;
+    	this.uuid = UUID.randomUUID().toString();
+        if (type == SecurityRuleType.IngressRule) {
+            this.type = SecurityRuleType.IngressRule.getType();
+        } else {
+            this.type = SecurityRuleType.EgressRule.getType();
+        }
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+    
+    @Override
+    public String getType() {
+        return type;
+    }
+
+    @Override
+    public long getSecurityGroupId() {
+        return securityGroupId;
+    }
+    
+    public SecurityRuleType getRuleType() {
+        if ("ingress".equalsIgnoreCase(this.type))
+            return SecurityRuleType.IngressRule;
+        else
+            return SecurityRuleType.EgressRule;
+    }
+    
+    @Override
+    public int getStartPort() {
+        return startPort;
+    }
+
+    @Override
+    public int getEndPort() {
+        return endPort;
+    }
+
+    @Override
+    public String getProtocol() {
+        return protocol;
+    }
+
+    @Override
+    public AsyncInstanceCreateStatus getCreateStatus() {
+        return createStatus;
+    }
+
+    public void setCreateStatus(AsyncInstanceCreateStatus createStatus) {
+        this.createStatus = createStatus;
+    }
+
+    @Override
+    public Long getAllowedNetworkId() {
+        return allowedNetworkId;
+    }
+
+    @Override
+    public String getAllowedSourceIpCidr() {
+        return allowedSourceIpCidr;
+    }
+    
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+    
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/SecurityGroupRulesVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/SecurityGroupRulesVO.java b/engine/schema/src/com/cloud/network/security/SecurityGroupRulesVO.java
new file mode 100644
index 0000000..c74152e
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/SecurityGroupRulesVO.java
@@ -0,0 +1,169 @@
+// 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.network.security;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.SecondaryTable;
+import javax.persistence.Table;
+
+import com.cloud.network.security.SecurityRule.SecurityRuleType;
+import com.cloud.utils.db.JoinType;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = ("security_group"))
+@JoinType(type = "left")
+@SecondaryTable(name = "security_group_rule", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "id", referencedColumnName = "security_group_id") })
+public class SecurityGroupRulesVO implements SecurityGroupRules {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "name")
+    private String name;
+
+    @Column(name = "description")
+    private String description;
+
+    @Column(name = "domain_id")
+    private Long domainId;
+
+    @Column(name = "account_id")
+    private Long accountId;
+
+    @Column(name = "id", table = "security_group_rule", insertable = false, updatable = false)
+    private Long ruleId;
+
+    @Column(name = "uuid", table = "security_group_rule", insertable = false, updatable = false)
+    private String ruleUuid;
+
+    @Column(name = "start_port", table = "security_group_rule", insertable = false, updatable = false)
+    private int startPort;
+
+    @Column(name = "end_port", table = "security_group_rule", insertable = false, updatable = false)
+    private int endPort;
+
+    @Column(name = "protocol", table = "security_group_rule", insertable = false, updatable = false)
+    private String protocol;
+
+    @Column(name = "type", table = "security_group_rule", insertable = false, updatable = false)
+    private String type;
+
+    @Column(name = "allowed_network_id", table = "security_group_rule", insertable = false, updatable = false, nullable = true)
+    private Long allowedNetworkId = null;
+
+    @Column(name = "allowed_ip_cidr", table = "security_group_rule", insertable = false, updatable = false, nullable = true)
+    private String allowedSourceIpCidr = null;
+
+    public SecurityGroupRulesVO() {
+    }
+
+    public SecurityGroupRulesVO(long id) {
+        this.id = id;
+    }
+
+    public SecurityGroupRulesVO(long id, String name, String description, Long domainId, Long accountId, Long ruleId, String ruleUuid, int startPort, int endPort, String protocol, Long allowedNetworkId,
+            String allowedSourceIpCidr) {
+        this.id = id;
+        this.name = name;
+        this.description = description;
+        this.domainId = domainId;
+        this.accountId = accountId;
+        this.ruleId = ruleId;
+        this.ruleUuid = ruleUuid;
+        this.startPort = startPort;
+        this.endPort = endPort;
+        this.protocol = protocol;
+        this.allowedNetworkId = allowedNetworkId;
+        this.allowedSourceIpCidr = allowedSourceIpCidr;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    @Override
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public Long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public Long getRuleId() {
+        return ruleId;
+    }
+
+    @Override
+    public String getRuleUuid() {
+        return ruleUuid;
+    }
+
+    @Override
+    public int getStartPort() {
+        return startPort;
+    }
+
+    @Override
+    public int getEndPort() {
+        return endPort;
+    }
+
+    @Override
+    public String getProtocol() {
+        return protocol;
+    }
+
+    @Override
+    public SecurityRuleType getRuleType() {
+        if ("ingress".equalsIgnoreCase(this.type)) {
+            return SecurityRuleType.IngressRule;
+        } else {
+            return SecurityRuleType.EgressRule;
+        }
+    }
+
+    @Override
+    public Long getAllowedNetworkId() {
+        return allowedNetworkId;
+    }
+
+    @Override
+    public String getAllowedSourceIpCidr() {
+        return allowedSourceIpCidr;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/SecurityGroupVMMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/SecurityGroupVMMapVO.java b/engine/schema/src/com/cloud/network/security/SecurityGroupVMMapVO.java
new file mode 100644
index 0000000..75bde33
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/SecurityGroupVMMapVO.java
@@ -0,0 +1,89 @@
+// 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.network.security;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.SecondaryTable;
+import javax.persistence.SecondaryTables;
+import javax.persistence.Table;
+
+import com.cloud.vm.VirtualMachine.State;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = ("security_group_vm_map"))
+@SecondaryTables({ @SecondaryTable(name = "nics", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "instance_id", referencedColumnName = "instance_id") }),
+        @SecondaryTable(name = "vm_instance", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "instance_id", referencedColumnName = "id") }),
+        @SecondaryTable(name = "security_group", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "security_group_id", referencedColumnName = "id") }) })
+public class SecurityGroupVMMapVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private Long id;
+
+    @Column(name = "security_group_id")
+    private long securityGroupId;
+
+    @Column(name = "instance_id")
+    private long instanceId;
+
+    @Column(name = "ip4_address", table = "nics", insertable = false, updatable = false)
+    private String guestIpAddress;
+
+    @Column(name = "state", table = "vm_instance", insertable = false, updatable = false)
+    private State vmState;
+
+    @Column(name = "name", table = "security_group", insertable = false, updatable = false)
+    private String groupName;
+
+    public SecurityGroupVMMapVO() {
+    }
+
+    public SecurityGroupVMMapVO(long securityGroupId, long instanceId) {
+        this.securityGroupId = securityGroupId;
+        this.instanceId = instanceId;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getSecurityGroupId() {
+        return securityGroupId;
+    }
+
+    public String getGuestIpAddress() {
+        return guestIpAddress;
+    }
+
+    public long getInstanceId() {
+        return instanceId;
+    }
+
+    public State getVmState() {
+        return vmState;
+    }
+
+    public String getGroupName() {
+        return groupName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/SecurityGroupVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/SecurityGroupVO.java b/engine/schema/src/com/cloud/network/security/SecurityGroupVO.java
new file mode 100644
index 0000000..be7c593
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/SecurityGroupVO.java
@@ -0,0 +1,99 @@
+// 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.network.security;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = ("security_group"))
+public class SecurityGroupVO implements SecurityGroup {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "name")
+    private String name;
+
+    @Column(name = "description")
+    private String description;
+
+    @Column(name = "domain_id")
+    private long domainId;
+
+    @Column(name = "account_id")
+    private long accountId;
+
+    @Column(name = "uuid")
+    private String uuid;
+    
+    public SecurityGroupVO() {
+    	this.uuid = UUID.randomUUID().toString();
+    }
+
+    public SecurityGroupVO(String name, String description, long domainId, long accountId) {
+        this.name = name;
+        this.description = description;
+        this.domainId = domainId;
+        this.accountId = accountId;
+    	this.uuid = UUID.randomUUID().toString();
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+    
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+    
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/SecurityGroupWork.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/SecurityGroupWork.java b/engine/schema/src/com/cloud/network/security/SecurityGroupWork.java
new file mode 100644
index 0000000..e50f3eb
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/SecurityGroupWork.java
@@ -0,0 +1,40 @@
+// 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.network.security;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+/**
+ * Work related to security groups for a vm
+ *
+ */
+public interface SecurityGroupWork {
+    
+    public enum Step {
+        Scheduled,
+        Processing,
+        Done,
+        Error
+    }
+    
+    Long getInstanceId();
+    Long getLogsequenceNumber();
+    Step getStep();
+    void setStep(Step step);
+    public abstract void setLogsequenceNumber(Long logsequenceNumber);
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/SecurityGroupWorkVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/SecurityGroupWorkVO.java b/engine/schema/src/com/cloud/network/security/SecurityGroupWorkVO.java
new file mode 100644
index 0000000..33d30fb
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/SecurityGroupWorkVO.java
@@ -0,0 +1,135 @@
+// 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.network.security;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="op_nwgrp_work")
+public class SecurityGroupWorkVO implements SecurityGroupWork, InternalIdentity {
+	
+	
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private Long id;
+    
+    @Column(name="instance_id", updatable=false, nullable=false)
+    private Long instanceId;    // vm_instance id
+    
+    
+    @Column(name="mgmt_server_id", nullable=true)
+    private Long serverId;
+    
+    @Column(name=GenericDao.CREATED_COLUMN)
+    private Date created;
+    
+    
+    @Column(name="step", nullable = false)
+    @Enumerated(value=EnumType.STRING)
+    private Step step;
+    
+    @Column(name="taken", nullable=true)
+    @Temporal(value=TemporalType.TIMESTAMP)
+    private Date dateTaken;
+    
+    @Column(name="seq_no", nullable=true)
+    private Long logsequenceNumber = null;
+
+    
+    protected SecurityGroupWorkVO() {
+    }
+    
+    public long getId() {
+        return id;
+    }
+    
+    public Long getInstanceId() {
+        return instanceId;
+    }
+    
+   
+    public Long getServerId() {
+        return serverId;
+    }
+  
+
+    public void setServerId(final Long serverId) {
+        this.serverId = serverId;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+
+
+	public SecurityGroupWorkVO(Long instanceId, Long serverId, Date created,
+			Step step, Date dateTaken) {
+		super();
+		this.instanceId = instanceId;
+		this.serverId = serverId;
+		this.created = created;
+		this.step = step;
+		this.dateTaken = dateTaken;
+	}
+
+	@Override
+	public String toString() {
+    	return new StringBuilder("[NWGrp-Work:id=").append(id).append(":vm=").append(instanceId).append("]").toString();
+    }
+
+	public Date getDateTaken() {
+		return dateTaken;
+	}
+
+	public void setStep(Step step) {
+		this.step = step;
+	}
+
+	public Step getStep() {
+		return step;
+	}
+
+	public void setDateTaken(Date date) {
+		dateTaken = date;
+	}
+
+	public Long getLogsequenceNumber() {
+		return logsequenceNumber;
+	}
+
+	@Override
+    public void setLogsequenceNumber(Long logsequenceNumber) {
+		this.logsequenceNumber = logsequenceNumber;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/VmRulesetLogVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/VmRulesetLogVO.java b/engine/schema/src/com/cloud/network/security/VmRulesetLogVO.java
new file mode 100644
index 0000000..2090ce3
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/VmRulesetLogVO.java
@@ -0,0 +1,81 @@
+// 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.network.security;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+/**
+ * Records the intent to update a VM's ingress ruleset
+ *
+ */
+@Entity
+@Table(name="op_vm_ruleset_log")
+public class VmRulesetLogVO implements InternalIdentity {
+	@Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private Long id;
+    
+    @Column(name="instance_id", updatable=false, nullable=false)
+    private Long instanceId;    // vm_instance id
+    
+    @Column(name=GenericDao.CREATED_COLUMN)
+    private Date created;
+    
+    @Column(name="logsequence")
+    long logsequence;
+    
+    protected VmRulesetLogVO() {
+    	
+    }
+
+	public VmRulesetLogVO(Long instanceId) {
+		super();
+		this.instanceId = instanceId;
+	}
+
+	public long getId() {
+		return id;
+	}
+
+	public Long getInstanceId() {
+		return instanceId;
+	}
+
+	public Date getCreated() {
+		return created;
+	}
+
+	public long getLogsequence() {
+		return logsequence;
+	}
+    
+	public void incrLogsequence() {
+		logsequence++;
+	}
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/dao/SecurityGroupDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/dao/SecurityGroupDao.java b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupDao.java
new file mode 100644
index 0000000..482e13c
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupDao.java
@@ -0,0 +1,30 @@
+// 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.network.security.dao;
+
+import java.util.List;
+
+import com.cloud.network.security.SecurityGroupVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface SecurityGroupDao extends GenericDao<SecurityGroupVO, Long> {
+    List<SecurityGroupVO> listByAccountId(long accountId);
+    boolean isNameInUse(Long accountId, Long domainId, String name);
+    SecurityGroupVO findByAccountAndName(Long accountId, String name);
+    List<SecurityGroupVO> findByAccountAndNames(Long accountId, String... names);
+    int removeByAccountId(long accountId); 
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/dao/SecurityGroupDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/dao/SecurityGroupDaoImpl.java b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupDaoImpl.java
new file mode 100644
index 0000000..d82cc4a
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupDaoImpl.java
@@ -0,0 +1,136 @@
+// 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.network.security.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.security.SecurityGroupVO;
+import com.cloud.server.ResourceTag.TaggedResourceType;
+import com.cloud.tags.dao.ResourceTagDao;
+import com.cloud.tags.dao.ResourceTagsDaoImpl;
+
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value={SecurityGroupDao.class})
+public class SecurityGroupDaoImpl extends GenericDaoBase<SecurityGroupVO, Long> implements SecurityGroupDao {
+    private SearchBuilder<SecurityGroupVO> AccountIdSearch;
+    private SearchBuilder<SecurityGroupVO> AccountIdNameSearch;
+    private SearchBuilder<SecurityGroupVO> AccountIdNamesSearch;
+    @Inject ResourceTagDao _tagsDao;
+
+
+    protected SecurityGroupDaoImpl() {
+        AccountIdSearch = createSearchBuilder();
+        AccountIdSearch.and("accountId", AccountIdSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AccountIdSearch.done();
+
+        AccountIdNameSearch = createSearchBuilder();
+        AccountIdNameSearch.and("accountId", AccountIdNameSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AccountIdNameSearch.and("name", AccountIdNameSearch.entity().getName(), SearchCriteria.Op.EQ);
+        
+        AccountIdNamesSearch = createSearchBuilder();
+        AccountIdNamesSearch.and("accountId", AccountIdNamesSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AccountIdNamesSearch.and("groupNames", AccountIdNamesSearch.entity().getName(), SearchCriteria.Op.IN);
+        AccountIdNameSearch.done();
+    }
+
+    @Override
+    public List<SecurityGroupVO> listByAccountId(long accountId) {
+        SearchCriteria<SecurityGroupVO> sc = AccountIdSearch.create();
+        sc.setParameters("accountId", accountId);
+        return listBy(sc);
+    }
+
+    @Override
+    public boolean isNameInUse(Long accountId, Long domainId, String name) {
+        SearchCriteria<SecurityGroupVO> sc = createSearchCriteria();
+        sc.addAnd("name", SearchCriteria.Op.EQ, name);
+        if (accountId != null) {
+            sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
+        } else {
+            sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId);
+            sc.addAnd("accountId", SearchCriteria.Op.NULL);
+        }
+
+        List<SecurityGroupVO> securityGroups = listBy(sc);
+        return ((securityGroups != null) && !securityGroups.isEmpty());
+    }
+
+	@Override
+	public SecurityGroupVO findByAccountAndName(Long accountId, String name) {
+		SearchCriteria<SecurityGroupVO> sc = AccountIdNameSearch.create();
+		sc.setParameters("accountId", accountId);
+		sc.setParameters("name", name);
+
+		return findOneIncludingRemovedBy(sc);
+	}
+
+	@Override
+	public List<SecurityGroupVO> findByAccountAndNames(Long accountId, String... names) {
+		SearchCriteria<SecurityGroupVO> sc = AccountIdNamesSearch.create();
+		sc.setParameters("accountId", accountId);
+
+		sc.setParameters("groupNames", (Object [])names);
+
+		return listBy(sc);
+	}
+	@Override
+	public int removeByAccountId(long accountId) {
+	    SearchCriteria<SecurityGroupVO> sc = AccountIdSearch.create();
+	    sc.setParameters("accountId", accountId);
+	    return expunge(sc);
+	} 
+
+	
+	@Override
+    @DB
+    public boolean remove(Long id) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        SecurityGroupVO entry = findById(id);
+        if (entry != null) {
+            _tagsDao.removeByIdAndType(id, TaggedResourceType.SecurityGroup);
+        }
+        boolean result = super.remove(id);
+        txn.commit();
+        return result;
+    }
+	
+	@Override
+    @DB
+    public boolean expunge(Long id) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        SecurityGroupVO entry = findById(id);
+        if (entry != null) {
+            _tagsDao.removeByIdAndType(id, TaggedResourceType.SecurityGroup);
+        }
+        boolean result = super.expunge(id);
+        txn.commit();
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRuleDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRuleDao.java b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRuleDao.java
new file mode 100644
index 0000000..4668aa4
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRuleDao.java
@@ -0,0 +1,35 @@
+// 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.network.security.dao;
+
+import java.util.List;
+
+import com.cloud.network.security.SecurityGroupRuleVO;
+import com.cloud.network.security.SecurityRule.SecurityRuleType;
+import com.cloud.utils.db.GenericDao;
+
+public interface SecurityGroupRuleDao extends GenericDao<SecurityGroupRuleVO, Long> {
+    List<SecurityGroupRuleVO> listBySecurityGroupId(long securityGroupId, SecurityRuleType type);
+    List<SecurityGroupRuleVO> listByAllowedSecurityGroupId(long networkGroupId);
+    SecurityGroupRuleVO findByProtoPortsAndCidr(long networkGroupId, String proto, int startPort, int endPort, String cidr);
+    SecurityGroupRuleVO findByProtoPortsAndGroup(String proto, int startPort, int endPort, String networkGroup);
+    SecurityGroupRuleVO findByProtoPortsAndAllowedGroupId(long networkGroupId, String proto, int startPort, int endPort, Long allowedGroupId);
+    int deleteBySecurityGroup(long securityGroupId);
+	int deleteByPortProtoAndGroup(long securityGroupId, String protocol, int startPort,int endPort, Long id);
+	int deleteByPortProtoAndCidr(long securityGroupId, String protocol, int startPort,int endPort, String cidr);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRuleDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRuleDaoImpl.java b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRuleDaoImpl.java
new file mode 100644
index 0000000..346ed26
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRuleDaoImpl.java
@@ -0,0 +1,176 @@
+// 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.network.security.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.security.SecurityGroupRuleVO;
+import com.cloud.network.security.SecurityGroupVO;
+import com.cloud.network.security.SecurityRule.SecurityRuleType;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.JoinBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value={SecurityGroupRuleDao.class})
+public class SecurityGroupRuleDaoImpl extends GenericDaoBase<SecurityGroupRuleVO, Long> implements SecurityGroupRuleDao {
+	
+	@Inject SecurityGroupDao _securityGroupDao;
+	
+    protected SearchBuilder<SecurityGroupRuleVO> securityGroupIdSearch;
+    protected SearchBuilder<SecurityGroupRuleVO> securityGroupIdAndTypeSearch;
+    protected SearchBuilder<SecurityGroupRuleVO> allowedSecurityGroupIdSearch;
+    protected SearchBuilder<SecurityGroupRuleVO> protoPortsAndCidrSearch;
+    protected SearchBuilder<SecurityGroupRuleVO> protoPortsAndSecurityGroupNameSearch;
+    protected SearchBuilder<SecurityGroupRuleVO> protoPortsAndSecurityGroupIdSearch;
+
+
+
+    protected SecurityGroupRuleDaoImpl() {
+        securityGroupIdSearch  = createSearchBuilder();
+        securityGroupIdSearch.and("securityGroupId", securityGroupIdSearch.entity().getSecurityGroupId(), SearchCriteria.Op.EQ);
+        securityGroupIdSearch.done();
+        
+        securityGroupIdAndTypeSearch  = createSearchBuilder();
+        securityGroupIdAndTypeSearch.and("securityGroupId", securityGroupIdAndTypeSearch.entity().getSecurityGroupId(), SearchCriteria.Op.EQ);
+        securityGroupIdAndTypeSearch.and("type", securityGroupIdAndTypeSearch.entity().getType(), SearchCriteria.Op.EQ);
+        securityGroupIdAndTypeSearch.done();
+        
+        allowedSecurityGroupIdSearch  = createSearchBuilder();
+        allowedSecurityGroupIdSearch.and("allowedNetworkId", allowedSecurityGroupIdSearch.entity().getAllowedNetworkId(), SearchCriteria.Op.EQ);
+        allowedSecurityGroupIdSearch.done();
+        
+        protoPortsAndCidrSearch = createSearchBuilder();
+        protoPortsAndCidrSearch.and("securityGroupId", protoPortsAndCidrSearch.entity().getSecurityGroupId(), SearchCriteria.Op.EQ);
+        protoPortsAndCidrSearch.and("proto", protoPortsAndCidrSearch.entity().getProtocol(), SearchCriteria.Op.EQ);
+        protoPortsAndCidrSearch.and("startPort", protoPortsAndCidrSearch.entity().getStartPort(), SearchCriteria.Op.EQ);
+        protoPortsAndCidrSearch.and("endPort", protoPortsAndCidrSearch.entity().getEndPort(), SearchCriteria.Op.EQ);
+        protoPortsAndCidrSearch.and("cidr", protoPortsAndCidrSearch.entity().getAllowedSourceIpCidr(), SearchCriteria.Op.EQ);
+        protoPortsAndCidrSearch.done();
+        
+        protoPortsAndSecurityGroupIdSearch = createSearchBuilder();
+        protoPortsAndSecurityGroupIdSearch.and("securityGroupId", protoPortsAndSecurityGroupIdSearch.entity().getSecurityGroupId(), SearchCriteria.Op.EQ);
+        protoPortsAndSecurityGroupIdSearch.and("proto", protoPortsAndSecurityGroupIdSearch.entity().getProtocol(), SearchCriteria.Op.EQ);
+        protoPortsAndSecurityGroupIdSearch.and("startPort", protoPortsAndSecurityGroupIdSearch.entity().getStartPort(), SearchCriteria.Op.EQ);
+        protoPortsAndSecurityGroupIdSearch.and("endPort", protoPortsAndSecurityGroupIdSearch.entity().getEndPort(), SearchCriteria.Op.EQ);        
+        protoPortsAndSecurityGroupIdSearch.and("allowedNetworkId", protoPortsAndSecurityGroupIdSearch.entity().getAllowedNetworkId(), SearchCriteria.Op.EQ);
+
+    }
+
+    public List<SecurityGroupRuleVO> listBySecurityGroupId(long securityGroupId, SecurityRuleType type) {
+        SearchCriteria<SecurityGroupRuleVO> sc = securityGroupIdAndTypeSearch.create();
+        sc.setParameters("securityGroupId", securityGroupId);
+        String dbType; 
+        if (type == SecurityRuleType.EgressRule) {
+            dbType = SecurityRuleType.EgressRule.getType();     
+        }else {
+            dbType = SecurityRuleType.IngressRule.getType();
+        }
+        
+        sc.setParameters("type", dbType);
+        return listBy(sc);
+    }
+
+    public int deleteBySecurityGroup(long securityGroupId) {
+        SearchCriteria<SecurityGroupRuleVO> sc = securityGroupIdSearch.create();
+        sc.setParameters("securityGroupId", securityGroupId);
+        return expunge(sc);
+    }
+
+    @Override
+    public List<SecurityGroupRuleVO> listByAllowedSecurityGroupId(long securityGroupId) {
+        SearchCriteria<SecurityGroupRuleVO> sc = allowedSecurityGroupIdSearch.create();
+        sc.setParameters("allowedNetworkId", securityGroupId);
+        return listBy(sc);
+    }
+
+    @Override
+    public SecurityGroupRuleVO findByProtoPortsAndCidr(long securityGroupId,
+            String proto, int startPort, int endPort, String cidr) {
+        SearchCriteria<SecurityGroupRuleVO> sc = protoPortsAndCidrSearch.create();
+        sc.setParameters("securityGroupId", securityGroupId);
+        sc.setParameters("proto", proto);
+        sc.setParameters("startPort", startPort);
+        sc.setParameters("endPort", endPort);
+        sc.setParameters("cidr", cidr);
+        return findOneIncludingRemovedBy(sc);
+    }
+
+    @Override
+    public SecurityGroupRuleVO findByProtoPortsAndGroup(String proto, int startPort, int endPort, String securityGroup) {
+        SearchCriteria<SecurityGroupRuleVO> sc = protoPortsAndSecurityGroupNameSearch.create();
+        sc.setParameters("proto", proto);
+        sc.setParameters("startPort", startPort);
+        sc.setParameters("endPort", endPort);
+        sc.setJoinParameters("groupName", "groupName", securityGroup);
+        return findOneIncludingRemovedBy(sc);
+    }
+
+	@Override
+	public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        protoPortsAndSecurityGroupNameSearch = createSearchBuilder();
+        protoPortsAndSecurityGroupNameSearch.and("proto", protoPortsAndSecurityGroupNameSearch.entity().getProtocol(), SearchCriteria.Op.EQ);
+        protoPortsAndSecurityGroupNameSearch.and("startPort", protoPortsAndSecurityGroupNameSearch.entity().getStartPort(), SearchCriteria.Op.EQ);
+        protoPortsAndSecurityGroupNameSearch.and("endPort", protoPortsAndSecurityGroupNameSearch.entity().getEndPort(), SearchCriteria.Op.EQ);
+        SearchBuilder<SecurityGroupVO> ngSb = _securityGroupDao.createSearchBuilder();
+        ngSb.and("groupName", ngSb.entity().getName(), SearchCriteria.Op.EQ);
+        protoPortsAndSecurityGroupNameSearch.join("groupName", ngSb, protoPortsAndSecurityGroupNameSearch.entity().getAllowedNetworkId(), ngSb.entity().getId(), JoinBuilder.JoinType.INNER);
+        protoPortsAndSecurityGroupNameSearch.done();
+        return super.configure(name, params);
+    }
+
+    @Override
+    public int deleteByPortProtoAndGroup(long securityGroupId, String protocol, int startPort, int endPort, Long allowedGroupId) {
+        SearchCriteria<SecurityGroupRuleVO> sc = protoPortsAndSecurityGroupIdSearch.create();
+        sc.setParameters("securityGroupId", securityGroupId);
+        sc.setParameters("proto", protocol);
+        sc.setParameters("startPort", startPort);
+        sc.setParameters("endPort", endPort);
+        sc.setParameters("allowedNetworkId", allowedGroupId);
+        return expunge(sc);
+    }
+
+    @Override
+    public int deleteByPortProtoAndCidr(long securityGroupId, String protocol, int startPort, int endPort, String cidr) {
+        SearchCriteria<SecurityGroupRuleVO> sc = protoPortsAndCidrSearch.create();
+        sc.setParameters("securityGroupId", securityGroupId);
+        sc.setParameters("proto", protocol);
+        sc.setParameters("startPort", startPort);
+        sc.setParameters("endPort", endPort);
+        sc.setParameters("cidr", cidr);
+        return expunge(sc);
+    }
+
+    @Override
+    public SecurityGroupRuleVO findByProtoPortsAndAllowedGroupId(long securityGroupId, String proto, int startPort, int endPort, Long allowedGroupId) {
+        SearchCriteria<SecurityGroupRuleVO> sc = protoPortsAndSecurityGroupIdSearch.create();
+        sc.addAnd("securityGroupId", SearchCriteria.Op.EQ, securityGroupId);
+        sc.setParameters("proto", proto);
+        sc.setParameters("startPort", startPort);
+        sc.setParameters("endPort", endPort);
+        sc.setParameters("allowedNetworkId", allowedGroupId);
+        return findOneIncludingRemovedBy(sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRulesDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRulesDao.java b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRulesDao.java
new file mode 100644
index 0000000..b97662c
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRulesDao.java
@@ -0,0 +1,48 @@
+// 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.network.security.dao;
+
+import java.util.List;
+
+import com.cloud.network.security.SecurityGroupRulesVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface SecurityGroupRulesDao extends GenericDao<SecurityGroupRulesVO, Long> {
+	/**
+	 * List a security group and associated ingress rules
+	 * @return the list of ingress rules associated with the security group (and security group info)
+	 */
+	List<SecurityGroupRulesVO> listSecurityGroupRules(long accountId, String groupName);
+
+	/**
+	 * List security groups and associated ingress rules
+	 * @return the list of security groups with associated ingress rules
+	 */
+	List<SecurityGroupRulesVO> listSecurityGroupRules(long accountId);
+
+    /**
+     * List all security groups and associated ingress rules
+     * @return the list of security groups with associated ingress rules
+     */
+    List<SecurityGroupRulesVO> listSecurityGroupRules();
+    
+    /**
+     * List all security rules belonging to the specific group
+     * @return the security group with associated ingress rules
+     */
+    List<SecurityGroupRulesVO> listSecurityRulesByGroupId(long groupId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRulesDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRulesDaoImpl.java b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRulesDaoImpl.java
new file mode 100644
index 0000000..18ef57f
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRulesDaoImpl.java
@@ -0,0 +1,96 @@
+// 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.network.security.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.security.SecurityGroupRulesVO;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value={SecurityGroupRulesDao.class})
+public class SecurityGroupRulesDaoImpl extends GenericDaoBase<SecurityGroupRulesVO, Long> implements SecurityGroupRulesDao {
+    private SearchBuilder<SecurityGroupRulesVO> AccountGroupNameSearch;
+    private SearchBuilder<SecurityGroupRulesVO> AccountSearch;
+    private SearchBuilder<SecurityGroupRulesVO> GroupSearch;
+
+
+    protected SecurityGroupRulesDaoImpl() {
+        AccountGroupNameSearch = createSearchBuilder();
+        AccountGroupNameSearch.and("accountId", AccountGroupNameSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AccountGroupNameSearch.and("name", AccountGroupNameSearch.entity().getName(), SearchCriteria.Op.EQ);
+        AccountGroupNameSearch.done();
+
+        AccountSearch = createSearchBuilder();
+        AccountSearch.and("accountId", AccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+        AccountSearch.done();
+        
+        GroupSearch = createSearchBuilder();
+        GroupSearch.and("groupId", GroupSearch.entity().getId(), SearchCriteria.Op.EQ);
+        GroupSearch.done();
+        
+    }
+
+    @Override
+    public List<SecurityGroupRulesVO> listSecurityGroupRules() {
+        Filter searchFilter = new Filter(SecurityGroupRulesVO.class, "id", true, null, null);
+        return listAll(searchFilter);
+    }
+
+    @Override
+    public List<SecurityGroupRulesVO> listSecurityGroupRules(long accountId, String groupName) {
+        Filter searchFilter = new Filter(SecurityGroupRulesVO.class, "id", true, null, null);
+
+        SearchCriteria<SecurityGroupRulesVO> sc = AccountGroupNameSearch.create();
+        sc.setParameters("accountId", accountId);
+        sc.setParameters("name", groupName);
+
+        return listBy(sc, searchFilter);
+    }
+
+    @Override
+    public List<SecurityGroupRulesVO> listSecurityGroupRules(long accountId) {
+        Filter searchFilter = new Filter(SecurityGroupRulesVO.class, "id", true, null, null);
+        SearchCriteria<SecurityGroupRulesVO> sc = AccountSearch.create();
+        sc.setParameters("accountId", accountId);
+        return listBy(sc, searchFilter);
+    }
+    
+    @Override
+    public List<SecurityGroupRulesVO> listSecurityRulesByGroupId(long groupId) {
+        Filter searchFilter = new Filter(SecurityGroupRulesVO.class, "id", true, null, null);
+        SearchCriteria<SecurityGroupRulesVO> sc = GroupSearch.create();
+        sc.setParameters("groupId", groupId);
+        return listBy(sc, searchFilter);
+    }
+
+    @Override
+    public SecurityGroupRulesVO findByUuidIncludingRemoved(final String uuid) {
+        SearchCriteria<SecurityGroupRulesVO> sc = createSearchCriteria();
+        sc.addAnd("ruleUuid", SearchCriteria.Op.EQ, uuid);
+        SecurityGroupRulesVO rule = findOneIncludingRemovedBy(sc);
+        SecurityGroupRulesVO newRule = new SecurityGroupRulesVO(rule.getRuleId());
+        return newRule;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/dao/SecurityGroupVMMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/dao/SecurityGroupVMMapDao.java b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupVMMapDao.java
new file mode 100644
index 0000000..cbeae4f
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupVMMapDao.java
@@ -0,0 +1,38 @@
+// 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.network.security.dao;
+
+import java.util.List;
+
+import com.cloud.network.security.SecurityGroupVMMapVO;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.vm.VirtualMachine.State;
+
+public interface SecurityGroupVMMapDao extends GenericDao<SecurityGroupVMMapVO, Long> {
+    List<SecurityGroupVMMapVO> listByIpAndInstanceId(String ipAddress, long instanceId);
+    List<SecurityGroupVMMapVO> listByInstanceId(long instanceId);
+    Pair<List<SecurityGroupVMMapVO>, Integer> listByInstanceId(long instanceId, Filter filter);
+    List<SecurityGroupVMMapVO> listByIp(String ipAddress);
+    List<SecurityGroupVMMapVO> listBySecurityGroup(long securityGroupId);
+    List<SecurityGroupVMMapVO> listBySecurityGroup(long securityGroupId, State ... vmStates);
+    int deleteVM(long instanceid);
+	List<Long> listVmIdsBySecurityGroup(long securityGroupId);
+	SecurityGroupVMMapVO findByVmIdGroupId(long instanceId, long securityGroupId);
+	long countSGForVm(long instanceId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/dao/SecurityGroupVMMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/dao/SecurityGroupVMMapDaoImpl.java b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupVMMapDaoImpl.java
new file mode 100644
index 0000000..46135d1
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupVMMapDaoImpl.java
@@ -0,0 +1,166 @@
+// 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.network.security.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.VlanVO;
+import com.cloud.dc.Vlan.VlanType;
+import com.cloud.network.dao.IPAddressVO;
+import com.cloud.network.security.SecurityGroupVMMapVO;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.Filter;
+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.SearchCriteria.Op;
+import com.cloud.vm.VirtualMachine.State;
+
+@Component
+@Local(value={SecurityGroupVMMapDao.class})
+public class SecurityGroupVMMapDaoImpl extends GenericDaoBase<SecurityGroupVMMapVO, Long> implements SecurityGroupVMMapDao {
+    private SearchBuilder<SecurityGroupVMMapVO> ListByIpAndVmId;
+    private SearchBuilder<SecurityGroupVMMapVO> ListByVmId;
+    private SearchBuilder<SecurityGroupVMMapVO> ListByVmIdGroupId;
+    protected GenericSearchBuilder<SecurityGroupVMMapVO, Long> CountSGForVm;
+
+    private GenericSearchBuilder<SecurityGroupVMMapVO, Long> ListVmIdBySecurityGroup;
+
+    private SearchBuilder<SecurityGroupVMMapVO> ListByIp;
+    private SearchBuilder<SecurityGroupVMMapVO> ListBySecurityGroup;
+    private SearchBuilder<SecurityGroupVMMapVO> ListBySecurityGroupAndStates;
+
+    protected SecurityGroupVMMapDaoImpl() {
+        ListByIpAndVmId  = createSearchBuilder();
+        ListByIpAndVmId.and("ipAddress", ListByIpAndVmId.entity().getGuestIpAddress(), SearchCriteria.Op.EQ);
+        ListByIpAndVmId.and("instanceId", ListByIpAndVmId.entity().getInstanceId(), SearchCriteria.Op.EQ);
+        ListByIpAndVmId.done();
+
+        ListVmIdBySecurityGroup = createSearchBuilder(Long.class);
+        ListVmIdBySecurityGroup.and("securityGroupId", ListVmIdBySecurityGroup.entity().getSecurityGroupId(), SearchCriteria.Op.EQ);
+        ListVmIdBySecurityGroup.selectField(ListVmIdBySecurityGroup.entity().getInstanceId());
+        ListVmIdBySecurityGroup.done();
+        
+        ListBySecurityGroup = createSearchBuilder();
+        ListBySecurityGroup.and("securityGroupId", ListBySecurityGroup.entity().getSecurityGroupId(), SearchCriteria.Op.EQ);
+        ListBySecurityGroup.done();
+
+        ListByIp  = createSearchBuilder();
+        ListByIp.and("ipAddress", ListByIp.entity().getGuestIpAddress(), SearchCriteria.Op.EQ);
+        ListByIp.done();
+
+        ListByVmId  = createSearchBuilder();
+        ListByVmId.and("instanceId", ListByVmId.entity().getInstanceId(), SearchCriteria.Op.EQ);
+        ListByVmId.done();
+        
+        ListBySecurityGroupAndStates = createSearchBuilder();
+        ListBySecurityGroupAndStates.and("securityGroupId", ListBySecurityGroupAndStates.entity().getSecurityGroupId(), SearchCriteria.Op.EQ);
+        ListBySecurityGroupAndStates.and("states", ListBySecurityGroupAndStates.entity().getVmState(), SearchCriteria.Op.IN);
+        ListBySecurityGroupAndStates.done();
+        
+        ListByVmIdGroupId  = createSearchBuilder();
+        ListByVmIdGroupId.and("instanceId", ListByVmIdGroupId.entity().getInstanceId(), SearchCriteria.Op.EQ);
+        ListByVmIdGroupId.and("securityGroupId", ListByVmIdGroupId.entity().getSecurityGroupId(), SearchCriteria.Op.EQ);
+        ListByVmIdGroupId.done();
+        
+        CountSGForVm = createSearchBuilder(Long.class);
+        CountSGForVm.select(null, Func.COUNT, null);
+        CountSGForVm.and("vmId", CountSGForVm.entity().getInstanceId(), SearchCriteria.Op.EQ);
+        CountSGForVm.done();
+    }
+
+    @Override
+    public List<SecurityGroupVMMapVO> listByIpAndInstanceId(String ipAddress, long vmId) {
+        SearchCriteria<SecurityGroupVMMapVO> sc = ListByIpAndVmId.create();
+        sc.setParameters("ipAddress", ipAddress);
+        sc.setParameters("instanceId", vmId);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<SecurityGroupVMMapVO> listBySecurityGroup(long securityGroupId) {
+        SearchCriteria<SecurityGroupVMMapVO> sc = ListBySecurityGroup.create();
+        sc.setParameters("securityGroupId", securityGroupId);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<SecurityGroupVMMapVO> listByIp(String ipAddress) {
+        SearchCriteria<SecurityGroupVMMapVO> sc = ListByIp.create();
+        sc.setParameters("ipAddress", ipAddress);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<SecurityGroupVMMapVO> listByInstanceId(long vmId) {
+        SearchCriteria<SecurityGroupVMMapVO> sc = ListByVmId.create();
+        sc.setParameters("instanceId", vmId);
+        return listBy(sc);
+    }
+
+    @Override
+    public Pair<List<SecurityGroupVMMapVO>, Integer> listByInstanceId(long instanceId, Filter filter) {
+        SearchCriteria<SecurityGroupVMMapVO> sc = ListByVmId.create();
+        sc.setParameters("instanceId", instanceId);
+        return this.searchAndCount(sc, filter);
+    }
+
+    @Override
+    public int deleteVM(long instanceId) {
+    	SearchCriteria<SecurityGroupVMMapVO> sc = ListByVmId.create();
+        sc.setParameters("instanceId", instanceId);
+        return super.expunge(sc);
+    }
+
+	@Override
+	public List<SecurityGroupVMMapVO> listBySecurityGroup(long securityGroupId, State... vmStates) {
+		SearchCriteria<SecurityGroupVMMapVO> sc = ListBySecurityGroupAndStates.create();
+		sc.setParameters("securityGroupId", securityGroupId);
+		sc.setParameters("states", (Object[])vmStates);
+		return listBy(sc, null, true);
+	}
+	
+    @Override
+    public List<Long> listVmIdsBySecurityGroup(long securityGroupId) {
+        SearchCriteria<Long> sc = ListVmIdBySecurityGroup.create();
+        sc.setParameters("securityGroupId", securityGroupId);
+        return customSearchIncludingRemoved(sc, null);
+    }
+
+	@Override
+	public SecurityGroupVMMapVO findByVmIdGroupId(long instanceId, long securityGroupId) {
+        SearchCriteria<SecurityGroupVMMapVO> sc = ListByVmIdGroupId.create();
+        sc.setParameters("securityGroupId", securityGroupId);
+        sc.setParameters("instanceId", instanceId);
+		return findOneIncludingRemovedBy(sc);
+	}
+	
+	@Override
+	public long countSGForVm(long instanceId) {
+		SearchCriteria<Long> sc = CountSGForVm.create();
+    	sc.setParameters("vmId", instanceId);
+        return customSearch(sc, null).get(0);       
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/dao/SecurityGroupWorkDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/dao/SecurityGroupWorkDao.java b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupWorkDao.java
new file mode 100644
index 0000000..e6b4b88
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupWorkDao.java
@@ -0,0 +1,49 @@
+// 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.network.security.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import com.cloud.network.security.SecurityGroupWork;
+import com.cloud.network.security.SecurityGroupWorkVO;
+import com.cloud.network.security.SecurityGroupWork.Step;
+import com.cloud.utils.db.GenericDao;
+
+public interface SecurityGroupWorkDao extends GenericDao<SecurityGroupWorkVO, Long> {
+    SecurityGroupWork findByVmId(long vmId, boolean taken);
+    
+    SecurityGroupWorkVO findByVmIdStep(long vmId, Step step);
+
+
+	SecurityGroupWorkVO take(long serverId);
+
+	void updateStep(Long vmId, Long logSequenceNumber, Step done);
+	
+	void updateStep(Long workId, Step done);
+	
+	int deleteFinishedWork(Date timeBefore);
+	
+	List<SecurityGroupWorkVO> findUnfinishedWork(Date timeBefore);
+	
+	List<SecurityGroupWorkVO> findAndCleanupUnfinishedWork(Date timeBefore);
+
+	
+	List<SecurityGroupWorkVO> findScheduledWork();
+
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/dao/SecurityGroupWorkDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/dao/SecurityGroupWorkDaoImpl.java b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupWorkDaoImpl.java
new file mode 100644
index 0000000..3154ffe
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupWorkDaoImpl.java
@@ -0,0 +1,241 @@
+// 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.network.security.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.security.SecurityGroupWork;
+import com.cloud.network.security.SecurityGroupWork.Step;
+import com.cloud.network.security.SecurityGroupWorkVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+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.exception.CloudRuntimeException;
+
+@Component
+@Local(value={SecurityGroupWorkDao.class})
+public class SecurityGroupWorkDaoImpl extends GenericDaoBase<SecurityGroupWorkVO, Long> implements SecurityGroupWorkDao {
+    private static final Logger s_logger = Logger.getLogger(SecurityGroupWorkDaoImpl.class);
+
+    private final SearchBuilder<SecurityGroupWorkVO> VmIdTakenSearch;
+    private final SearchBuilder<SecurityGroupWorkVO> VmIdSeqNumSearch;
+    private final SearchBuilder<SecurityGroupWorkVO> VmIdUnTakenSearch;
+    private final SearchBuilder<SecurityGroupWorkVO> UntakenWorkSearch;
+    private final SearchBuilder<SecurityGroupWorkVO> VmIdStepSearch;
+    private final SearchBuilder<SecurityGroupWorkVO> CleanupSearch;
+
+
+    protected SecurityGroupWorkDaoImpl() {
+        VmIdTakenSearch = createSearchBuilder();
+        VmIdTakenSearch.and("vmId", VmIdTakenSearch.entity().getInstanceId(), SearchCriteria.Op.EQ);
+        VmIdTakenSearch.and("taken", VmIdTakenSearch.entity().getDateTaken(), SearchCriteria.Op.NNULL);
+
+        VmIdTakenSearch.done();
+
+        VmIdUnTakenSearch = createSearchBuilder();
+        VmIdUnTakenSearch.and("vmId", VmIdUnTakenSearch.entity().getInstanceId(), SearchCriteria.Op.EQ);
+        VmIdUnTakenSearch.and("taken", VmIdUnTakenSearch.entity().getDateTaken(), SearchCriteria.Op.NULL);
+
+        VmIdUnTakenSearch.done();
+
+        UntakenWorkSearch = createSearchBuilder();
+        UntakenWorkSearch.and("server", UntakenWorkSearch.entity().getServerId(), SearchCriteria.Op.NULL);
+        UntakenWorkSearch.and("taken", UntakenWorkSearch.entity().getDateTaken(), SearchCriteria.Op.NULL);
+        UntakenWorkSearch.and("step", UntakenWorkSearch.entity().getStep(), SearchCriteria.Op.EQ);
+
+        UntakenWorkSearch.done();
+
+        VmIdSeqNumSearch = createSearchBuilder();
+        VmIdSeqNumSearch.and("vmId", VmIdSeqNumSearch.entity().getInstanceId(), SearchCriteria.Op.EQ);
+        VmIdSeqNumSearch.and("seqno", VmIdSeqNumSearch.entity().getLogsequenceNumber(), SearchCriteria.Op.EQ);
+
+        VmIdSeqNumSearch.done();
+
+        VmIdStepSearch = createSearchBuilder();
+        VmIdStepSearch.and("vmId", VmIdStepSearch.entity().getInstanceId(), SearchCriteria.Op.EQ);
+        VmIdStepSearch.and("step", VmIdStepSearch.entity().getStep(), SearchCriteria.Op.EQ);
+
+        VmIdStepSearch.done();
+
+        CleanupSearch = createSearchBuilder();
+        CleanupSearch.and("taken", CleanupSearch.entity().getDateTaken(), Op.LTEQ);
+        CleanupSearch.and("step", CleanupSearch.entity().getStep(), SearchCriteria.Op.IN);
+
+        CleanupSearch.done();
+
+
+    }
+
+    @Override
+    public SecurityGroupWork findByVmId(long vmId, boolean taken) {
+        SearchCriteria<SecurityGroupWorkVO> sc = taken?VmIdTakenSearch.create():VmIdUnTakenSearch.create();
+        sc.setParameters("vmId", vmId);
+        return findOneIncludingRemovedBy(sc);
+    }
+
+	@Override
+	@DB
+	public SecurityGroupWorkVO take(long serverId) {
+		final Transaction txn = Transaction.currentTxn();
+        try {
+            final SearchCriteria<SecurityGroupWorkVO> sc = UntakenWorkSearch.create();
+            sc.setParameters("step", Step.Scheduled);
+
+            final Filter filter = new Filter(SecurityGroupWorkVO.class, null, true, 0l, 1l);//FIXME: order desc by update time?
+
+            txn.start();
+            final List<SecurityGroupWorkVO> vos = lockRows(sc, filter, true);
+            if (vos.size() == 0) {
+                txn.commit();
+                if (s_logger.isTraceEnabled()) {
+                    s_logger.trace("Security Group take: no work found");
+                }
+                return null;
+            }
+            SecurityGroupWorkVO work = vos.get(0);
+            boolean processing = false;
+            if ( findByVmIdStep(work.getInstanceId(), Step.Processing) != null) {
+                //ensure that there is no job in Processing state for the same VM
+                processing = true;
+                if (s_logger.isTraceEnabled()) {
+                    s_logger.trace("Security Group work take: found a job in Scheduled and Processing  vmid=" + work.getInstanceId());
+                }
+            }
+            work.setServerId(serverId);
+            work.setDateTaken(new Date());
+            if (processing) {
+                //the caller to take() should check the step and schedule another work item to come back
+                //and take a look.
+                work.setStep(SecurityGroupWork.Step.Done);
+            } else {
+                work.setStep(SecurityGroupWork.Step.Processing);
+            }
+
+            update(work.getId(), work);
+
+            txn.commit();
+
+            return work;
+
+        } catch (final Throwable e) {
+            throw new CloudRuntimeException("Unable to execute take", e);
+        }
+	}
+
+	@Override
+	@DB
+	public void updateStep(Long vmId, Long logSequenceNumber, Step step) {
+		final Transaction txn = Transaction.currentTxn();
+		txn.start();
+        SearchCriteria<SecurityGroupWorkVO> sc = VmIdSeqNumSearch.create();
+        sc.setParameters("vmId", vmId);
+        sc.setParameters("seqno", logSequenceNumber);
+
+        final Filter filter = new Filter(SecurityGroupWorkVO.class, null, true, 0l, 1l);
+
+        final List<SecurityGroupWorkVO> vos = lockRows(sc, filter, true);
+        if (vos.size() == 0) {
+        	txn.commit();
+            return;
+        }
+        SecurityGroupWorkVO work = vos.get(0);
+        work.setStep(step);
+        update(work.getId(), work);
+
+        txn.commit();
+	}
+
+	@Override
+	public SecurityGroupWorkVO findByVmIdStep(long vmId, Step step) {
+        SearchCriteria<SecurityGroupWorkVO> sc = VmIdStepSearch.create();
+        sc.setParameters("vmId", vmId);
+        sc.setParameters("step", step);
+        return findOneIncludingRemovedBy(sc);
+	}
+
+	@Override
+	@DB
+	public void updateStep(Long workId, Step step) {
+		final Transaction txn = Transaction.currentTxn();
+		txn.start();
+
+        SecurityGroupWorkVO work = lockRow(workId, true);
+        if (work == null) {
+        	txn.commit();
+        	return;
+        }
+        work.setStep(step);
+        update(work.getId(), work);
+
+        txn.commit();
+
+	}
+
+	@Override
+	public int deleteFinishedWork(Date timeBefore) {
+		final SearchCriteria<SecurityGroupWorkVO> sc = CleanupSearch.create();
+		sc.setParameters("taken", timeBefore);
+		sc.setParameters("step", Step.Done);
+
+		return expunge(sc);
+	}
+
+	@Override
+	public List<SecurityGroupWorkVO> findUnfinishedWork(Date timeBefore) {
+		final SearchCriteria<SecurityGroupWorkVO> sc = CleanupSearch.create();
+		sc.setParameters("taken", timeBefore);
+		sc.setParameters("step", Step.Processing);
+
+		List<SecurityGroupWorkVO> result = listIncludingRemovedBy(sc);
+
+		return result;
+	}
+
+	@Override
+	public List<SecurityGroupWorkVO> findAndCleanupUnfinishedWork(Date timeBefore) {
+	    final SearchCriteria<SecurityGroupWorkVO> sc = CleanupSearch.create();
+	    sc.setParameters("taken", timeBefore);
+	    sc.setParameters("step", Step.Processing);
+
+	    List<SecurityGroupWorkVO> result = listIncludingRemovedBy(sc);
+
+	    SecurityGroupWorkVO work = createForUpdate();
+	    work.setStep(Step.Error);
+	    update(work, sc);
+
+	    return result;
+	}
+
+	@Override
+    public List<SecurityGroupWorkVO> findScheduledWork() {
+        final SearchCriteria<SecurityGroupWorkVO> sc = UntakenWorkSearch.create();
+        sc.setParameters("step", Step.Scheduled);
+        return listIncludingRemovedBy(sc);
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/dao/VmRulesetLogDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/dao/VmRulesetLogDao.java b/engine/schema/src/com/cloud/network/security/dao/VmRulesetLogDao.java
new file mode 100644
index 0000000..d5ed4a0
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/dao/VmRulesetLogDao.java
@@ -0,0 +1,29 @@
+// 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.network.security.dao;
+
+import java.util.Set;
+
+import com.cloud.network.security.VmRulesetLogVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface VmRulesetLogDao extends GenericDao<VmRulesetLogVO, Long> {
+    VmRulesetLogVO findByVmId(long vmId);
+
+    int createOrUpdate(Set<Long> workItems);
+    
+}


[54/57] [abbrv] git commit: updated refs/heads/master to f84b6ab

Posted by ni...@apache.org.
remove unwanted files


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

Branch: refs/heads/master
Commit: 5f0f1001beec0c1d27e977b53242a44766569aa4
Parents: fa12175
Author: Nitin Mehta <ni...@citrix.com>
Authored: Sun May 12 14:30:10 2013 +0530
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Sun May 12 14:30:10 2013 +0530

----------------------------------------------------------------------
 api/src/com/cloud/network/NetworkService.java      |    6 -
 api/src/com/cloud/storage/VolumeApiService.java    |    6 -
 .../api/command/user/network/AddNicDetailCmd.java  |  113 --------------
 .../command/user/network/ListNicDetailsCmd.java    |   77 ----------
 .../command/user/network/RemoveNicDetailCmd.java   |  117 ---------------
 .../command/user/network/UpdateNicDetailCmd.java   |  116 --------------
 .../command/user/volume/AddVolumeDetailCmd.java    |  115 --------------
 .../command/user/volume/ListVolumeDetailsCmd.java  |   82 ----------
 .../command/user/volume/RemoveVolumeDetailCmd.java |  107 -------------
 .../command/user/volume/UpdateVolumeDetailCmd.java |  115 --------------
 .../org/apache/cloudstack/query/QueryService.java  |    2 -
 .../api/command/test/AddNicDetailCmdTest.java      |   62 --------
 .../api/command/test/AddVolumeDetailCmdTest.java   |   62 --------
 .../api/command/test/RemoveNicDetailCmdTest.java   |   62 --------
 .../command/test/RemoveVolumeDetailCmdTest.java    |   63 --------
 .../command/test/UpdateVolumeDetailCmdTest.java    |   65 --------
 .../api/command/test/updateNicDetailCmdTest.java   |   62 --------
 .../src/com/cloud/api/query/QueryManagerImpl.java  |   29 ----
 .../src/com/cloud/network/NetworkServiceImpl.java  |   14 --
 .../src/com/cloud/storage/VolumeManagerImpl.java   |   59 --------
 .../com/cloud/network/MockNetworkManagerImpl.java  |   15 --
 .../test/com/cloud/vpc/MockNetworkManagerImpl.java |   15 --
 22 files changed, 0 insertions(+), 1364 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/src/com/cloud/network/NetworkService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java
index 2b4982a..4a6a84f 100755
--- a/api/src/com/cloud/network/NetworkService.java
+++ b/api/src/com/cloud/network/NetworkService.java
@@ -175,10 +175,4 @@ public interface NetworkService {
     /* lists the nic informaton */
     List<? extends Nic> listNics(ListNicsCmd listNicsCmd);
 
-    void removeNicDetail(RemoveNicDetailCmd removeNicDetailCmd);
-
-    void addNicDetail(AddNicDetailCmd cmd);
-
-    void updateNicDetail(UpdateNicDetailCmd cmd);
-
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/src/com/cloud/storage/VolumeApiService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/storage/VolumeApiService.java b/api/src/com/cloud/storage/VolumeApiService.java
index 047d124..7e5ebe2 100644
--- a/api/src/com/cloud/storage/VolumeApiService.java
+++ b/api/src/com/cloud/storage/VolumeApiService.java
@@ -75,11 +75,5 @@ public interface VolumeApiService {
 
     Volume detachVolumeFromVM(DetachVolumeCmd cmmd);
 
-    void updateVolumeDetails(UpdateVolumeDetailCmd updateVolumeDetailCmd);
-
-    void removeVolumeDetail(RemoveVolumeDetailCmd removeVolumeDetailCmd);
-
-    void addVolumeDetail(AddVolumeDetailCmd addVolumeDetailCmd);
-
     Volume updateVolume(UpdateVolumeCmd updateVolumeCmd);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/src/org/apache/cloudstack/api/command/user/network/AddNicDetailCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/AddNicDetailCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/AddNicDetailCmd.java
deleted file mode 100644
index 230cd7e..0000000
--- a/api/src/org/apache/cloudstack/api/command/user/network/AddNicDetailCmd.java
+++ /dev/null
@@ -1,113 +0,0 @@
-// 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 org.apache.cloudstack.api.command.user.network;
-
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.NicResponse;
-import org.apache.cloudstack.api.response.SuccessResponse;
-import org.apache.cloudstack.api.response.UserVmResponse;
-import org.apache.cloudstack.api.response.VolumeResponse;
-import org.apache.log4j.Logger;
-
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.storage.Volume;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@APICommand(name = "addNicDetail", description="Adds detail for the volume.", since="4.2", responseObject=SuccessResponse.class)
-public class AddNicDetailCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(AddNicDetailCmd.class.getName());
-    private static final String s_name = "addNicDetailresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=NicResponse.class,
-            required=true, description="the ID of the nic")
-    private Long id;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING,
-            required=true, description="the name of the field")
-    private String name;
-
-    @Parameter(name=ApiConstants.VALUE, type=CommandType.STRING,
-            required=true, description="the value of the field")
-    private String value;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-
-    public String getName() {
-        return name;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.Volume;
-    }
-
-    public Long getInstanceId() {
-        return getId();
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Account caller = UserContext.current().getCaller();
-        return caller.getAccountId();
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_NIC_CREATE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "adding detail to the nic: " + getId();
-    }
-
-    @Override
-    public void execute(){
-        _networkService.addNicDetail(this);
-        this.setResponseObject(new SuccessResponse(getCommandName()));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/src/org/apache/cloudstack/api/command/user/network/ListNicDetailsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNicDetailsCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNicDetailsCmd.java
deleted file mode 100644
index 84f3589..0000000
--- a/api/src/org/apache/cloudstack/api/command/user/network/ListNicDetailsCmd.java
+++ /dev/null
@@ -1,77 +0,0 @@
-// 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 org.apache.cloudstack.api.command.user.network;
-
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.response.*;
-import org.apache.log4j.Logger;
-
-import java.util.List;
-
-
-@APICommand(name = "listNicDetails", description="Lists all nic details.", responseObject=NicDetailResponse.class)
-public class ListNicDetailsCmd extends BaseListTaggedResourcesCmd {
-    public static final Logger s_logger = Logger.getLogger(ListNicDetailsCmd.class.getName());
-
-    private static final String s_name = "listnicdetailsresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=NicResponse.class,
-            required=true, description="the ID of the nic")
-    private Long id;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the nic detail")
-    private String name;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-
-
-    @Override
-    public void execute(){
-        ListResponse<NicDetailResponse> responses = new ListResponse<NicDetailResponse>();
-        List<NicDetailResponse> nicDetailList = _queryService.searchForNicDetails(this);
-        responses.setResponses(nicDetailList);
-        responses.setResponseName(getCommandName());
-        this.setResponseObject(responses);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/src/org/apache/cloudstack/api/command/user/network/RemoveNicDetailCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/RemoveNicDetailCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/RemoveNicDetailCmd.java
deleted file mode 100644
index abea515..0000000
--- a/api/src/org/apache/cloudstack/api/command/user/network/RemoveNicDetailCmd.java
+++ /dev/null
@@ -1,117 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for removeitional 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 org.apache.cloudstack.api.command.user.network;
-
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.NicResponse;
-import org.apache.cloudstack.api.response.SuccessResponse;
-import org.apache.cloudstack.api.response.UserVmResponse;
-import org.apache.cloudstack.api.response.VolumeResponse;
-import org.apache.log4j.Logger;
-
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.storage.Volume;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@APICommand(name = "removeNicDetail", description="Removes detail for the volume.", since="4.2", responseObject=SuccessResponse.class)
-public class RemoveNicDetailCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(RemoveNicDetailCmd.class.getName());
-    private static final String s_name = "removeNicDetailresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=NicResponse.class,
-            required=true, description="the ID of the nic")
-    private Long id;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING,
-            required=false, description="the name of the field")
-    private String name;
-
-    @Parameter(name=ApiConstants.VALUE, type=CommandType.STRING,
-            required=false, description="the value of the field")
-    private String value;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-
-    public String getName() {
-        return name;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.Volume;
-    }
-
-    public Long getInstanceId() {
-        return getId();
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Volume volume = _responseGenerator.findVolumeById(getId());
-        if (volume == null) {
-            return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
-        }
-        return volume.getAccountId();
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_NIC_DETAIL_REMOVE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "removing detail to the nic: " + getId();
-    }
-
-    @Override
-    public void execute(){
-        UserContext.current().setEventDetails("Nic Id: "+getId());
-        _networkService.removeNicDetail(this);
-        this.setResponseObject(new SuccessResponse(getCommandName()));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/src/org/apache/cloudstack/api/command/user/network/UpdateNicDetailCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNicDetailCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNicDetailCmd.java
deleted file mode 100644
index 0e263e1..0000000
--- a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNicDetailCmd.java
+++ /dev/null
@@ -1,116 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for updateitional 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 org.apache.cloudstack.api.command.user.network;
-
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.NicResponse;
-import org.apache.cloudstack.api.response.SuccessResponse;
-import org.apache.cloudstack.api.response.UserVmResponse;
-import org.apache.cloudstack.api.response.VolumeResponse;
-import org.apache.log4j.Logger;
-
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.storage.Volume;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@APICommand(name = "updateNicDetail", description="Updates detail for the nic.", since="4.2", responseObject=SuccessResponse.class)
-public class UpdateNicDetailCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(UpdateNicDetailCmd.class.getName());
-    private static final String s_name = "updateNicDetailresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=NicResponse.class,
-            required=true, description="the ID of the nic")
-    private Long id;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING,
-            required=true, description="the name of the field")
-    private String name;
-
-    @Parameter(name=ApiConstants.VALUE, type=CommandType.STRING,
-            required=true, description="the value of the field")
-    private String value;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-
-    public String getName() {
-        return name;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.Volume;
-    }
-
-    public Long getInstanceId() {
-        return getId();
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Volume volume = _responseGenerator.findVolumeById(getId());
-        if (volume == null) {
-            return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
-        }
-        return volume.getAccountId();
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_VOLUME_ATTACH;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "updating detail to the nic: " + getId();
-    }
-
-    @Override
-    public void execute(){
-        _networkService.updateNicDetail(this);
-        this.setResponseObject(new SuccessResponse(getCommandName()));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/src/org/apache/cloudstack/api/command/user/volume/AddVolumeDetailCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/AddVolumeDetailCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/AddVolumeDetailCmd.java
deleted file mode 100644
index e9eff59..0000000
--- a/api/src/org/apache/cloudstack/api/command/user/volume/AddVolumeDetailCmd.java
+++ /dev/null
@@ -1,115 +0,0 @@
-// 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 org.apache.cloudstack.api.command.user.volume;
-
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.SuccessResponse;
-import org.apache.cloudstack.api.response.UserVmResponse;
-import org.apache.cloudstack.api.response.VolumeResponse;
-import org.apache.log4j.Logger;
-
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.storage.Volume;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@APICommand(name = "addVolumeDetail", description="Adds detail for the volume.", responseObject=SuccessResponse.class)
-public class AddVolumeDetailCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(AddVolumeDetailCmd.class.getName());
-    private static final String s_name = "addVolumeDetailresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class,
-            required=true, description="the ID of the disk volume")
-    private Long id;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING,
-            required=true, description="the name of the field")
-    private String name;
-
-    @Parameter(name=ApiConstants.VALUE, type=CommandType.STRING,
-            required=true, description="the value of the field")
-    private String value;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-
-    public String getName() {
-        return name;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.Volume;
-    }
-
-    public Long getInstanceId() {
-        return getId();
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Volume volume = _responseGenerator.findVolumeById(getId());
-        if (volume == null) {
-            return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
-        }
-        return volume.getAccountId();
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_VOLUME_DETAIL_ADD;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "adding detail to the volume: " + getId();
-    }
-
-    @Override
-    public void execute(){
-        _volumeService.addVolumeDetail(this);
-        this.setResponseObject(new SuccessResponse(getCommandName()));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumeDetailsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumeDetailsCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumeDetailsCmd.java
deleted file mode 100644
index fc064cc..0000000
--- a/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumeDetailsCmd.java
+++ /dev/null
@@ -1,82 +0,0 @@
-// 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 org.apache.cloudstack.api.command.user.volume;
-
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.response.*;
-import org.apache.log4j.Logger;
-
-import com.cloud.async.AsyncJob;
-
-import java.util.List;
-
-
-@APICommand(name = "listVolumeDetails", description="Lists all volume details.", responseObject=VolumeDetailResponse.class)
-public class ListVolumeDetailsCmd extends BaseListTaggedResourcesCmd {
-    public static final Logger s_logger = Logger.getLogger(ListVolumeDetailsCmd.class.getName());
-
-    private static final String s_name = "listvolumedetailsresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class,
-            required=true, description="the ID of the volume")
-    private Long id;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the volume detail")
-    private String name;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.Volume;
-    }
-
-    @Override
-    public void execute(){
-        ListResponse<VolumeDetailResponse> responses = new ListResponse<VolumeDetailResponse>();
-        List<VolumeDetailResponse> volumeDetailList = _queryService.searchForVolumeDetails(this);
-        responses.setResponses(volumeDetailList);
-        responses.setResponseName(getCommandName());
-        this.setResponseObject(responses);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/src/org/apache/cloudstack/api/command/user/volume/RemoveVolumeDetailCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/RemoveVolumeDetailCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/RemoveVolumeDetailCmd.java
deleted file mode 100644
index 9e3c1c6..0000000
--- a/api/src/org/apache/cloudstack/api/command/user/volume/RemoveVolumeDetailCmd.java
+++ /dev/null
@@ -1,107 +0,0 @@
-// 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 org.apache.cloudstack.api.command.user.volume;
-
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.SuccessResponse;
-import org.apache.cloudstack.api.response.UserVmResponse;
-import org.apache.cloudstack.api.response.VolumeResponse;
-import org.apache.log4j.Logger;
-
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.storage.Volume;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@APICommand(name = "removeVolumeDetail", description="Remove a particular detail for the volume.", responseObject=VolumeResponse.class)
-public class RemoveVolumeDetailCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(AttachVolumeCmd.class.getName());
-    private static final String s_name = "removeVolumeDetailresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class,
-            required=true, description="the ID of the disk volume")
-    private Long id;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING,
-            required=true, description="the name of the field")
-    private String name;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-
-    public String getName() {
-        return name;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.Volume;
-    }
-
-    public Long getInstanceId() {
-        return getId();
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Volume volume = _responseGenerator.findVolumeById(getId());
-        if (volume == null) {
-            return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
-        }
-        return volume.getAccountId();
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_VOLUME_ATTACH;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "adding detail to the volume: " + getId();
-    }
-
-    @Override
-    public void execute(){
-        _volumeService.removeVolumeDetail(this);
-        this.setResponseObject(new SuccessResponse(getCommandName()));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeDetailCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeDetailCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeDetailCmd.java
deleted file mode 100644
index 8a43c6e..0000000
--- a/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeDetailCmd.java
+++ /dev/null
@@ -1,115 +0,0 @@
-// 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 org.apache.cloudstack.api.command.user.volume;
-
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.SuccessResponse;
-import org.apache.cloudstack.api.response.UserVmResponse;
-import org.apache.cloudstack.api.response.VolumeResponse;
-import org.apache.log4j.Logger;
-
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.storage.Volume;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@APICommand(name = "updateVolumeDetail", description="Updates the volume detail.", responseObject=VolumeResponse.class)
-public class UpdateVolumeDetailCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(AttachVolumeCmd.class.getName());
-    private static final String s_name = "updateVolumeDetailresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class,
-            required=true, description="the ID of the disk volume")
-    private Long id;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING,
-            required=true, description="the name of the field")
-    private String name;
-
-    @Parameter(name=ApiConstants.VALUE, type=CommandType.STRING, entityType=UserVmResponse.class,
-            required=true, description="the value of the field")
-    private String value;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-
-    public String getName() {
-        return name;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.Volume;
-    }
-
-    public Long getInstanceId() {
-        return getId();
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Volume volume = _responseGenerator.findVolumeById(getId());
-        if (volume == null) {
-            return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
-        }
-        return volume.getAccountId();
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_VOLUME_ATTACH;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "updating detail to the volume: " + getId();
-    }
-
-    @Override
-    public void execute(){
-        _volumeService.updateVolumeDetails(this);
-        this.setResponseObject(new SuccessResponse(getCommandName()));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/src/org/apache/cloudstack/query/QueryService.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/query/QueryService.java b/api/src/org/apache/cloudstack/query/QueryService.java
index 9eada21..7ab2c19 100644
--- a/api/src/org/apache/cloudstack/query/QueryService.java
+++ b/api/src/org/apache/cloudstack/query/QueryService.java
@@ -90,8 +90,6 @@ public interface QueryService {
     public ListResponse<AffinityGroupResponse> listAffinityGroups(Long affinityGroupId, String affinityGroupName,
             String affinityGroupType, Long vmId, Long startIndex, Long pageSize);
 
-    public List<VolumeDetailResponse> searchForVolumeDetails(ListVolumeDetailsCmd cmd);
-
     List<NicDetailResponse> searchForNicDetails(ListNicDetailsCmd ListNicDetailsCmd);
 
     public List<ResourceDetailResponse> listResource(ListResourceDetailsCmd cmd);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/test/org/apache/cloudstack/api/command/test/AddNicDetailCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/AddNicDetailCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddNicDetailCmdTest.java
deleted file mode 100644
index 6c43fd8..0000000
--- a/api/test/org/apache/cloudstack/api/command/test/AddNicDetailCmdTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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 org.apache.cloudstack.api.command.test;
-
-import com.cloud.network.NetworkService;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.apache.cloudstack.api.ResponseGenerator;
-
-import org.apache.cloudstack.api.command.user.network.AddNicDetailCmd;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.mockito.Mockito;
-import static org.mockito.Mockito.*;
-
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-
-public class AddNicDetailCmdTest extends TestCase{
-
-    private AddNicDetailCmd addNicDetailCmd;
-    private ResponseGenerator responseGenerator;
-
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
-    @Before
-    public void setUp() {
-
-        addNicDetailCmd = new AddNicDetailCmd();
-
-    }
-
-
-    @Test
-    public void testCreateSuccess() {
-
-        NetworkService networkService = Mockito.mock(NetworkService.class);
-        doNothing().when(networkService).addNicDetail(addNicDetailCmd);
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/test/org/apache/cloudstack/api/command/test/AddVolumeDetailCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/AddVolumeDetailCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddVolumeDetailCmdTest.java
deleted file mode 100644
index d501439..0000000
--- a/api/test/org/apache/cloudstack/api/command/test/AddVolumeDetailCmdTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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 org.apache.cloudstack.api.command.test;
-
-import com.cloud.storage.VolumeApiService;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.apache.cloudstack.api.ResponseGenerator;
-
-import org.apache.cloudstack.api.command.user.volume.AddVolumeDetailCmd;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.mockito.Mockito;
-import static org.mockito.Mockito.*;
-
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-
-public class AddVolumeDetailCmdTest extends TestCase{
-
-    private AddVolumeDetailCmd addVolumeDetailCmd;
-    private ResponseGenerator responseGenerator;
-
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
-    @Before
-    public void setUp() {
-
-        addVolumeDetailCmd = new AddVolumeDetailCmd();
-
-    }
-
-
-    @Test
-    public void testCreateSuccess() {
-
-        VolumeApiService volumeService = Mockito.mock(VolumeApiService.class);
-        doNothing().when(volumeService).addVolumeDetail(addVolumeDetailCmd);
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/test/org/apache/cloudstack/api/command/test/RemoveNicDetailCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/RemoveNicDetailCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/RemoveNicDetailCmdTest.java
deleted file mode 100644
index 607255c..0000000
--- a/api/test/org/apache/cloudstack/api/command/test/RemoveNicDetailCmdTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for removeitional 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 org.apache.cloudstack.api.command.test;
-
-import com.cloud.network.NetworkService;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.apache.cloudstack.api.ResponseGenerator;
-
-import org.apache.cloudstack.api.command.user.network.RemoveNicDetailCmd;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.mockito.Mockito;
-import static org.mockito.Mockito.*;
-
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-
-public class RemoveNicDetailCmdTest extends TestCase{
-
-    private RemoveNicDetailCmd removeNicDetailCmd;
-    private ResponseGenerator responseGenerator;
-
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
-    @Before
-    public void setUp() {
-
-        removeNicDetailCmd = new RemoveNicDetailCmd();
-
-    }
-
-
-    @Test
-    public void testCreateSuccess() {
-
-        NetworkService networkService = Mockito.mock(NetworkService.class);
-        doNothing().when(networkService).removeNicDetail(removeNicDetailCmd);
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/test/org/apache/cloudstack/api/command/test/RemoveVolumeDetailCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/RemoveVolumeDetailCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/RemoveVolumeDetailCmdTest.java
deleted file mode 100644
index 12ae812..0000000
--- a/api/test/org/apache/cloudstack/api/command/test/RemoveVolumeDetailCmdTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-// 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 org.apache.cloudstack.api.command.test;
-
-import com.cloud.storage.VolumeApiService;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.apache.cloudstack.api.ResponseGenerator;
-
-import org.apache.cloudstack.api.command.user.volume.AddVolumeDetailCmd;
-import org.apache.cloudstack.api.command.user.volume.RemoveVolumeDetailCmd;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.mockito.Mockito;
-import static org.mockito.Mockito.*;
-
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-
-public class RemoveVolumeDetailCmdTest extends TestCase{
-
-    private RemoveVolumeDetailCmd removeVolumeDetailCmd;
-    private ResponseGenerator responseGenerator;
-
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
-    @Before
-    public void setUp() {
-
-        removeVolumeDetailCmd = new RemoveVolumeDetailCmd();
-
-    }
-
-
-    @Test
-    public void testCreateSuccess() {
-
-        VolumeApiService volumeService = Mockito.mock(VolumeApiService.class);
-        doNothing().when(volumeService).removeVolumeDetail(removeVolumeDetailCmd);
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/test/org/apache/cloudstack/api/command/test/UpdateVolumeDetailCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/UpdateVolumeDetailCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/UpdateVolumeDetailCmdTest.java
deleted file mode 100644
index 1a3bada..0000000
--- a/api/test/org/apache/cloudstack/api/command/test/UpdateVolumeDetailCmdTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-// 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 org.apache.cloudstack.api.command.test;
-
-import com.cloud.storage.VolumeApiService;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.apache.cloudstack.api.ResponseGenerator;
-
-import org.apache.cloudstack.api.command.user.volume.UpdateVolumeDetailCmd;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.mockito.Mockito;
-import static org.mockito.Mockito.*;
-
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-
-public class UpdateVolumeDetailCmdTest extends TestCase{
-
-    private UpdateVolumeDetailCmd updateVolumeDetailCmd;
-    private ResponseGenerator responseGenerator;
-
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
-    @Before
-    public void setUp() {
-
-        updateVolumeDetailCmd = new UpdateVolumeDetailCmd();
-
-        //Account account = new AccountVO("testaccount", 1L, "networkdomain", (short) 0, "uuid");
-        //UserContext.registerContext(1, account, null, true);
-
-    }
-
-
-    @Test
-    public void testCreateSuccess() {
-
-        VolumeApiService volumeService = Mockito.mock(VolumeApiService.class);
-        doNothing().when(volumeService).updateVolumeDetails(updateVolumeDetailCmd);
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/api/test/org/apache/cloudstack/api/command/test/updateNicDetailCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/updateNicDetailCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/updateNicDetailCmdTest.java
deleted file mode 100644
index 7143e2c..0000000
--- a/api/test/org/apache/cloudstack/api/command/test/updateNicDetailCmdTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for updateitional 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 org.apache.cloudstack.api.command.test;
-
-import com.cloud.network.NetworkService;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.apache.cloudstack.api.ResponseGenerator;
-
-import org.apache.cloudstack.api.command.user.network.UpdateNicDetailCmd;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.mockito.Mockito;
-import static org.mockito.Mockito.*;
-
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-
-public class updateNicDetailCmdTest extends TestCase{
-
-    private UpdateNicDetailCmd updateNicDetailCmd;
-    private ResponseGenerator responseGenerator;
-
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
-    @Before
-    public void setUp() {
-
-        updateNicDetailCmd = new UpdateNicDetailCmd();
-
-    }
-
-
-    @Test
-    public void testCreateSuccess() {
-
-        NetworkService networkService = Mockito.mock(NetworkService.class);
-        doNothing().when(networkService).updateNicDetail(updateNicDetailCmd);
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index 6c1406a..ebf9cac 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -1533,35 +1533,6 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
     }
 
     @Override
-    public List<VolumeDetailResponse> searchForVolumeDetails(ListVolumeDetailsCmd cmd){
-
-        Long id = cmd.getId();
-        String name = cmd.getName();
-
-        List<VolumeDetailVO> volumeDetailList;
-        if(name == null){
-            volumeDetailList = _volumeDetailDao.findDetails(id);
-        }else{
-            VolumeDetailVO volumeDetail = _volumeDetailDao.findDetail(id, name);
-            volumeDetailList = new LinkedList<VolumeDetailVO>();
-            volumeDetailList.add(volumeDetail);
-        }
-
-        List<VolumeDetailResponse> volumeDetailResponseList = new ArrayList<VolumeDetailResponse>();
-        for (VolumeDetailVO volumeDetail : volumeDetailList ){
-            VolumeDetailResponse volumeDetailResponse = new VolumeDetailResponse();
-            String uuid = ApiDBUtils.findVolumeById(id).getUuid();
-            volumeDetailResponse.setId(uuid);
-            volumeDetailResponse.setName(volumeDetail.getName());
-            volumeDetailResponse.setValue(volumeDetail.getValue());
-            volumeDetailResponse.setObjectName("volumedetail");
-            volumeDetailResponseList.add(volumeDetailResponse);
-        }
-
-        return volumeDetailResponseList;
-    }
-
-    @Override
     public List<NicDetailResponse> searchForNicDetails(ListNicDetailsCmd cmd){
         Long id = cmd.getId();
         String name = cmd.getName();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index 85fa979..addd853 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -3836,18 +3836,4 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         return _networkMgr.listVmNics(vmId, nicId);
     }
 
-    @Override
-    public void removeNicDetail(RemoveNicDetailCmd removeNicDetailCmd) {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @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.
-    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/server/src/com/cloud/storage/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java
index 356f676..2f4b2c8 100644
--- a/server/src/com/cloud/storage/VolumeManagerImpl.java
+++ b/server/src/com/cloud/storage/VolumeManagerImpl.java
@@ -1793,65 +1793,6 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
         return volume;
     }
 
-    @Override
-    @ActionEvent(eventType = EventTypes.EVENT_VOLUME_DETAIL_UPDATE, eventDescription = "updating volume detail", async = true)
-    public void updateVolumeDetails(UpdateVolumeDetailCmd cmd){
-        UserContext.current().setEventDetails("Volume Id: "+cmd.getId());
-        Account caller = UserContext.current().getCaller();
-        Long volumeId = cmd.getId();
-        String name = cmd.getName();
-        String value = cmd.getValue();
-
-        VolumeVO volume = _volsDao.findById(volumeId);
-        _accountMgr.checkAccess(caller, null, true, volume);
-        VolumeDetailVO volDetail = _volDetailDao.findDetail(volumeId, name);
-        if(volDetail != null){
-            volDetail.setValue(value);
-             _volDetailDao.update(volDetail.getId(), volDetail);
-        }else{
-            throw new InvalidParameterValueException("This detail doesnt exist for the volume ");
-        }
-
-    }
-
-
-    @Override
-    @ActionEvent(eventType = EventTypes.EVENT_VOLUME_DETAIL_REMOVE, eventDescription = "removing volume detail", async = true)
-    public void removeVolumeDetail(RemoveVolumeDetailCmd cmd){
-        UserContext.current().setEventDetails("Volume Id: "+cmd.getId());
-        Account caller = UserContext.current().getCaller();
-        Long volumeId = cmd.getId();
-        String name = cmd.getName();
-
-        VolumeVO volume = _volsDao.findById(volumeId);
-        _accountMgr.checkAccess(caller, null, true, volume);
-        VolumeDetailVO volDetail = _volDetailDao.findDetail(volumeId, name);
-        if(volDetail != null){
-            _volDetailDao.remove(volDetail.getId());
-        }else{
-            throw new InvalidParameterValueException("This detail doesnt exist for the volume ");
-        }
-
-    }
-
-
-    @Override
-    @ActionEvent(eventType = EventTypes.EVENT_VOLUME_DETAIL_ADD, eventDescription = "adding volume detail", async = true)
-    public void addVolumeDetail(AddVolumeDetailCmd cmd){
-
-        Account caller = UserContext.current().getCaller();
-        UserContext.current().setEventDetails("Volume Id: "+ cmd.getId());
-
-        Long volumeId = cmd.getId();
-        String name = cmd.getName();
-        String value = cmd.getValue();
-
-        VolumeVO volume = _volsDao.findById(volumeId);
-        _accountMgr.checkAccess(caller, null, true, volume);
-        VolumeDetailVO volDetail = new VolumeDetailVO(volumeId, name, value);
-        _volDetailDao.persist(volDetail);
-    }
-
 
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_VOLUME_DETACH, eventDescription = "detaching volume", async = true)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/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 19b6aa1..cfd7149 100755
--- a/server/test/com/cloud/network/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/network/MockNetworkManagerImpl.java
@@ -897,21 +897,6 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
     }
 
     @Override
-    public void removeNicDetail(RemoveNicDetailCmd removeNicDetailCmd) {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @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 String allocatePublicIpForGuestNic(Long networkId, DataCenter dc,
             Pod pod, Account caller, String requestedIp)
             throws InsufficientAddressCapacityException {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f0f1001/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 0b1de60..5d19cf4 100644
--- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
@@ -1407,21 +1407,6 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
         return null;
     }
 
-    @Override
-    public void removeNicDetail(RemoveNicDetailCmd removeNicDetailCmd) {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @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 String allocatePublicIpForGuestNic(Long networkId, DataCenter dc,


[34/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/client/WEB-INF/classes/resources/messages_ja.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ja.properties b/client/WEB-INF/classes/resources/messages_ja.properties
index 2380e91..e483a97 100644
--- a/client/WEB-INF/classes/resources/messages_ja.properties
+++ b/client/WEB-INF/classes/resources/messages_ja.properties
@@ -15,873 +15,874 @@
 # specific language governing permissions and limitations
 # under the License.
 
-changed.item.properties=\u9805\u76EE\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u5909\u66F4
+
+changed.item.properties=\u9805\u76ee\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u5909\u66f4
 confirm.enable.s3=S3\u57fa\u76e4\u30bb\u30ab\u30f3\u30c0\u30ea\u30b9\u30c8\u30ec\u30fc\u30b8\u3092\u6709\u52b9\u5316\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u60c5\u5831\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044
-confirm.enable.swift=Swift1 \u306E\u30B5\u30DD\u30FC\u30C8\u3092\u6709\u52B9\u306B\u3059\u308B\u306B\u306F\u3001\u6B21\u306E\u60C5\u5831\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-error.could.not.enable.zone=\u30BE\u30FC\u30F3\u3092\u6709\u52B9\u306B\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
-error.installWizard.message=\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u623B\u3063\u3066\u30A8\u30E9\u30FC\u3092\u4FEE\u6B63\u3067\u304D\u307E\u3059\u3002
-error.invalid.username.password=\u7121\u52B9\u306A\u30E6\u30FC\u30B6\u30FC\u540D\u307E\u305F\u306F\u30D1\u30B9\u30EF\u30FC\u30C9
-error.login=\u30E6\u30FC\u30B6\u30FC\u540D/\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u8A18\u9332\u3068\u4E00\u81F4\u3057\u307E\u305B\u3093\u3002
+confirm.enable.swift=Swift1 \u306e\u30b5\u30dd\u30fc\u30c8\u3092\u6709\u52b9\u306b\u3059\u308b\u306b\u306f\u3001\u6b21\u306e\u60c5\u5831\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002
+error.could.not.enable.zone=\u30be\u30fc\u30f3\u3092\u6709\u52b9\u306b\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f
+error.installWizard.message=\u554f\u984c\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002\u623b\u3063\u3066\u30a8\u30e9\u30fc\u3092\u4fee\u6b63\u3067\u304d\u307e\u3059\u3002
+error.invalid.username.password=\u7121\u52b9\u306a\u30e6\u30fc\u30b6\u30fc\u540d\u307e\u305f\u306f\u30d1\u30b9\u30ef\u30fc\u30c9
+error.login=\u30e6\u30fc\u30b6\u30fc\u540d/\u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u8a18\u9332\u3068\u4e00\u81f4\u3057\u307e\u305b\u3093\u3002
 error.menu.select=\u00e3\u0082\u00a2\u00e3\u0082\u00a4\u00e3\u0083\u0086\u00e3\u0083\u00a0\u00e3\u0081\u008c\u00e9\u0081\u00b8\u00e6\u008a\u009e\u00e3\u0081\u0095\u00e3\u0082\u008c\u00e3\u0081\u00a6\u00e3\u0081\u0084\u00e3\u0081\u00aa\u00e3\u0081\u0084\u00e3\u0081\u009f\u00e3\u0082\u0081\u00e3\u0082\u00a2\u00e3\u0082\u00af\u00e3\u0082\u00b7\u00e3\u0083\u00a7\u00e3\u0083\u00b3\u00e3\u0082\u0092\u00e5\u00ae\u009f\u00e8\u00a1\u008c\u00e3\u0081\u0099\u00e3\u0082\u008b\u00e3\u0081\u0093\u00e3\u0081\u00a8\u00e3\u0081\u008c\u00e3\u0081\u00a7\u00e3\u0081\u008d\u00e3\u0081\u00be\u00e3\u0081\u009b\u00e3\u0082\u0093
-error.mgmt.server.inaccessible=\u7BA1\u7406\u30B5\u30FC\u30D0\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093\u3002\u5F8C\u3067\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-error.password.not.match=\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u4E00\u81F4\u3057\u307E\u305B\u3093
-error.please.specify.physical.network.tags=\u3053\u306E\u7269\u7406\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u306E\u30BF\u30B0\u3092\u6307\u5B9A\u3057\u306A\u3051\u308C\u3070\u3001\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002
-error.session.expired=\u30BB\u30C3\u30B7\u30E7\u30F3\u306E\u6709\u52B9\u671F\u9650\u304C\u5207\u308C\u307E\u3057\u305F\u3002
-error.something.went.wrong.please.correct.the.following=\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u5185\u5BB9\u3092\u4FEE\u6B63\u3057\u3066\u304F\u3060\u3055\u3044
-error.unable.to.reach.management.server=\u7BA1\u7406\u30B5\u30FC\u30D0\u30FC\u3068\u901A\u4FE1\u3067\u304D\u307E\u305B\u3093
+error.mgmt.server.inaccessible=\u7ba1\u7406\u30b5\u30fc\u30d0\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u305b\u3093\u3002\u5f8c\u3067\u518d\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002
+error.password.not.match=\u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u4e00\u81f4\u3057\u307e\u305b\u3093
+error.please.specify.physical.network.tags=\u3053\u306e\u7269\u7406\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u30bf\u30b0\u3092\u6307\u5b9a\u3057\u306a\u3051\u308c\u3070\u3001\u30cd\u30c3\u30c8\u30ef\u30fc\u30af \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002
+error.session.expired=\u30bb\u30c3\u30b7\u30e7\u30f3\u306e\u6709\u52b9\u671f\u9650\u304c\u5207\u308c\u307e\u3057\u305f\u3002
+error.something.went.wrong.please.correct.the.following=\u554f\u984c\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002\u6b21\u306e\u5185\u5bb9\u3092\u4fee\u6b63\u3057\u3066\u304f\u3060\u3055\u3044
+error.unable.to.reach.management.server=\u7ba1\u7406\u30b5\u30fc\u30d0\u30fc\u3068\u901a\u4fe1\u3067\u304d\u307e\u305b\u3093
 error.unresolved.internet.name=\u3042\u306a\u305f\u306e\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u540d\u306f\u89e3\u6c7a\u3055\u308c\u307e\u305b\u3093\u3067\u3057\u305f\u3002
-extractable=\u62BD\u51FA\u53EF\u80FD
-force.delete.domain.warning=\u8B66\u544A\: \u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u9078\u629E\u3059\u308B\u3068\u3001\u3059\u3079\u3066\u306E\u5B50\u30C9\u30E1\u30A4\u30F3\u304A\u3088\u3073\u95A2\u9023\u3059\u308B\u3059\u3079\u3066\u306E\u30A2\u30AB\u30A6\u30F3\u30C8\u3068\u305D\u306E\u30EA\u30BD\u30FC\u30B9\u304C\u524A\u9664\u3055\u308C\u307E\u3059\u3002
-force.delete=\u5F37\u5236\u524A\u9664
-force.remove.host.warning=\u8B66\u544A\: \u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u9078\u629E\u3059\u308B\u3068\u3001\u5B9F\u884C\u4E2D\u306E\u3059\u3079\u3066\u306E\u4EEE\u60F3\u30DE\u30B7\u30F3\u304C\u5F37\u5236\u7684\u306B\u505C\u6B62\u3055\u308C\u3001\u30AF\u30E9\u30B9\u30BF\u30FC\u304B\u3089\u3053\u306E\u30DB\u30B9\u30C8\u304C\u5F37\u5236\u7684\u306B\u89E3\u9664\u3055\u308C\u307E\u3059\u3002
-force.remove=\u5F37\u5236\u89E3\u9664
-force.stop.instance.warning=\u8B66\u544A\: \u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u306E\u5F37\u5236\u505C\u6B62\u306F\u3001\u6700\u7D42\u624B\u6BB5\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30C7\u30FC\u30BF\u3092\u640D\u5931\u3059\u308B\u3060\u3051\u3067\u306A\u304F\u3001\u4EEE\u60F3\u30DE\u30B7\u30F3\u306E\u52D5\u4F5C\u304C\u4E00\u8CAB\u3057\u306A\u304F\u306A\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002
-force.stop=\u5F37\u5236\u505C\u6B62
-ICMP.code=ICMP \u30B3\u30FC\u30C9
-ICMP.type=ICMP \u306E\u7A2E\u985E
-image.directory=\u753B\u50CF\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA
-inline=\u76F4\u5217
-instances.actions.reboot.label=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u306E\u518D\u8D77\u52D5
-label.accept.project.invitation=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3078\u306E\u62DB\u5F85\u306E\u627F\u8AFE
-label.account.and.security.group=\u30A2\u30AB\u30A6\u30F3\u30C8\u3001\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3 \u30B0\u30EB\u30FC\u30D7
-label.account.id=\u30A2\u30AB\u30A6\u30F3\u30C8 ID
-label.account.name=\u30A2\u30AB\u30A6\u30F3\u30C8\u540D
-label.account.specific=\u30A2\u30AB\u30A6\u30F3\u30C8\u56FA\u6709
-label.accounts=\u30A2\u30AB\u30A6\u30F3\u30C8
-label.account=\u30A2\u30AB\u30A6\u30F3\u30C8
-label.acquire.new.ip=\u65B0\u3057\u3044 IP \u30A2\u30C9\u30EC\u30B9\u306E\u53D6\u5F97
-label.action.attach.disk.processing=\u30C7\u30A3\u30B9\u30AF\u3092\u30A2\u30BF\u30C3\u30C1\u3057\u3066\u3044\u307E\u3059...
-label.action.attach.disk=\u30C7\u30A3\u30B9\u30AF\u306E\u30A2\u30BF\u30C3\u30C1
-label.action.attach.iso=ISO \u306E\u30A2\u30BF\u30C3\u30C1
-label.action.attach.iso.processing=ISO \u3092\u30A2\u30BF\u30C3\u30C1\u3057\u3066\u3044\u307E\u3059...
-label.action.cancel.maintenance.mode.processing=\u4FDD\u5B88\u30E2\u30FC\u30C9\u3092\u30AD\u30E3\u30F3\u30BB\u30EB\u3057\u3066\u3044\u307E\u3059...
-label.action.cancel.maintenance.mode=\u4FDD\u5B88\u30E2\u30FC\u30C9\u306E\u30AD\u30E3\u30F3\u30BB\u30EB
-label.action.change.password=\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u5909\u66F4
-label.action.change.service.processing=\u30B5\u30FC\u30D3\u30B9\u3092\u5909\u66F4\u3057\u3066\u3044\u307E\u3059...
-label.action.change.service=\u30B5\u30FC\u30D3\u30B9\u306E\u5909\u66F4
-label.action.copy.ISO=ISO \u306E\u30B3\u30D4\u30FC
-label.action.copy.ISO.processing=ISO \u3092\u30B3\u30D4\u30FC\u3057\u3066\u3044\u307E\u3059...
-label.action.copy.template.processing=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u3092\u30B3\u30D4\u30FC\u3057\u3066\u3044\u307E\u3059...
-label.action.copy.template=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u30B3\u30D4\u30FC
-label.action.create.template.from.vm=VM \u304B\u3089\u306E\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u4F5C\u6210
-label.action.create.template.from.volume=\u30DC\u30EA\u30E5\u30FC\u30E0\u304B\u3089\u306E\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u4F5C\u6210
-label.action.create.template.processing=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059...
-label.action.create.template=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u4F5C\u6210
-label.action.create.vm.processing=VM \u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059...
-label.action.create.vm=VM \u306E\u4F5C\u6210
-label.action.create.volume.processing=\u30DC\u30EA\u30E5\u30FC\u30E0\u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059...
-label.action.create.volume=\u30DC\u30EA\u30E5\u30FC\u30E0\u306E\u4F5C\u6210
-label.action.delete.account.processing=\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.account=\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u524A\u9664
-label.action.delete.cluster.processing=\u30AF\u30E9\u30B9\u30BF\u30FC\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.cluster=\u30AF\u30E9\u30B9\u30BF\u30FC\u306E\u524A\u9664
-label.action.delete.disk.offering.processing=\u30C7\u30A3\u30B9\u30AF \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.disk.offering=\u30C7\u30A3\u30B9\u30AF \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0\u306E\u524A\u9664
-label.action.delete.domain.processing=\u30C9\u30E1\u30A4\u30F3\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.domain=\u30C9\u30E1\u30A4\u30F3\u306E\u524A\u9664
-label.action.delete.firewall.processing=\u30D5\u30A1\u30A4\u30A2\u30A6\u30A9\u30FC\u30EB\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.firewall=\u30D5\u30A1\u30A4\u30A2\u30A6\u30A9\u30FC\u30EB\u898F\u5247\u306E\u524A\u9664
-label.action.delete.ingress.rule.processing=\u53D7\u4FE1\u898F\u5247\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.ingress.rule=\u53D7\u4FE1\u898F\u5247\u306E\u524A\u9664
-label.action.delete.IP.range=IP \u30A2\u30C9\u30EC\u30B9\u306E\u7BC4\u56F2\u306E\u524A\u9664
-label.action.delete.IP.range.processing=IP \u30A2\u30C9\u30EC\u30B9\u306E\u7BC4\u56F2\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.ISO=ISO \u306E\u524A\u9664
-label.action.delete.ISO.processing=ISO \u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.load.balancer.processing=\u8CA0\u8377\u5206\u6563\u88C5\u7F6E\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.load.balancer=\u8CA0\u8377\u5206\u6563\u898F\u5247\u306E\u524A\u9664
-label.action.delete.network.processing=\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.network=\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u306E\u524A\u9664
-label.action.delete.nexusVswitch=Nexus 1000V \u306E\u524A\u9664
-label.action.delete.physical.network=\u7269\u7406\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u306E\u524A\u9664
-label.action.delete.pod.processing=\u30DD\u30C3\u30C9\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.pod=\u30DD\u30C3\u30C9\u306E\u524A\u9664
-label.action.delete.primary.storage.processing=\u30D7\u30E9\u30A4\u30DE\u30EA \u30B9\u30C8\u30EC\u30FC\u30B8\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.primary.storage=\u30D7\u30E9\u30A4\u30DE\u30EA \u30B9\u30C8\u30EC\u30FC\u30B8\u306E\u524A\u9664
-label.action.delete.secondary.storage.processing=\u30BB\u30AB\u30F3\u30C0\u30EA \u30B9\u30C8\u30EC\u30FC\u30B8\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.secondary.storage=\u30BB\u30AB\u30F3\u30C0\u30EA \u30B9\u30C8\u30EC\u30FC\u30B8\u306E\u524A\u9664
-label.action.delete.security.group.processing=\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3 \u30B0\u30EB\u30FC\u30D7\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.security.group=\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3 \u30B0\u30EB\u30FC\u30D7\u306E\u524A\u9664
-label.action.delete.service.offering.processing=\u30B5\u30FC\u30D3\u30B9 \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.service.offering=\u30B5\u30FC\u30D3\u30B9 \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0\u306E\u524A\u9664
-label.action.delete.snapshot.processing=\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.snapshot=\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u306E\u524A\u9664
-label.action.delete.system.service.offering=\u30B7\u30B9\u30C6\u30E0 \u30B5\u30FC\u30D3\u30B9 \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0\u306E\u524A\u9664
-label.action.delete.template.processing=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.template=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u524A\u9664
-label.action.delete.user.processing=\u30E6\u30FC\u30B6\u30FC\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.user=\u30E6\u30FC\u30B6\u30FC\u306E\u524A\u9664
-label.action.delete.volume.processing=\u30DC\u30EA\u30E5\u30FC\u30E0\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.volume=\u30DC\u30EA\u30E5\u30FC\u30E0\u306E\u524A\u9664
-label.action.delete.zone.processing=\u30BE\u30FC\u30F3\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.delete.zone=\u30BE\u30FC\u30F3\u306E\u524A\u9664
-label.action.destroy.instance.processing=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u7834\u68C4\u3057\u3066\u3044\u307E\u3059...
-label.action.destroy.instance=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u306E\u7834\u68C4
-label.action.destroy.systemvm.processing=\u30B7\u30B9\u30C6\u30E0 VM \u3092\u7834\u68C4\u3057\u3066\u3044\u307E\u3059...
-label.action.destroy.systemvm=\u30B7\u30B9\u30C6\u30E0 VM \u306E\u7834\u68C4
-label.action.detach.disk.processing=\u30C7\u30A3\u30B9\u30AF\u3092\u30C7\u30BF\u30C3\u30C1\u3057\u3066\u3044\u307E\u3059...
-label.action.detach.disk=\u30C7\u30A3\u30B9\u30AF\u306E\u30C7\u30BF\u30C3\u30C1
-label.action.detach.iso=ISO \u306E\u30C7\u30BF\u30C3\u30C1
-label.action.detach.iso.processing=ISO \u3092\u30C7\u30BF\u30C3\u30C1\u3057\u3066\u3044\u307E\u3059...
-label.action.disable.account.processing=\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u7121\u52B9\u306B\u3057\u3066\u3044\u307E\u3059...
-label.action.disable.account=\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u7121\u52B9\u5316
-label.action.disable.cluster.processing=\u30AF\u30E9\u30B9\u30BF\u30FC\u3092\u7121\u52B9\u306B\u3057\u3066\u3044\u307E\u3059...
-label.action.disable.cluster=\u30AF\u30E9\u30B9\u30BF\u30FC\u306E\u7121\u52B9\u5316
-label.action.disable.nexusVswitch=Nexus 1000V \u306E\u7121\u52B9\u5316
-label.action.disable.physical.network=\u7269\u7406\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u306E\u7121\u52B9\u5316
-label.action.disable.pod.processing=\u30DD\u30C3\u30C9\u3092\u7121\u52B9\u306B\u3057\u3066\u3044\u307E\u3059...
-label.action.disable.pod=\u30DD\u30C3\u30C9\u306E\u7121\u52B9\u5316
-label.action.disable.static.NAT.processing=\u9759\u7684 NAT \u3092\u7121\u52B9\u306B\u3057\u3066\u3044\u307E\u3059...
-label.action.disable.static.NAT=\u9759\u7684 NAT \u306E\u7121\u52B9\u5316
-label.action.disable.user.processing=\u30E6\u30FC\u30B6\u30FC\u3092\u7121\u52B9\u306B\u3057\u3066\u3044\u307E\u3059...
-label.action.disable.user=\u30E6\u30FC\u30B6\u30FC\u306E\u7121\u52B9\u5316
-label.action.disable.zone.processing=\u30BE\u30FC\u30F3\u3092\u7121\u52B9\u306B\u3057\u3066\u3044\u307E\u3059...
-label.action.disable.zone=\u30BE\u30FC\u30F3\u306E\u7121\u52B9\u5316
-label.action.download.ISO=ISO \u306E\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9
-label.action.download.template=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9
-label.action.download.volume.processing=\u30DC\u30EA\u30E5\u30FC\u30E0\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3057\u3066\u3044\u307E\u3059...
-label.action.download.volume=\u30DC\u30EA\u30E5\u30FC\u30E0\u306E\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9
-label.action.edit.account=\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u7DE8\u96C6
-label.action.edit.disk.offering=\u30C7\u30A3\u30B9\u30AF \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0\u306E\u7DE8\u96C6
-label.action.edit.domain=\u30C9\u30E1\u30A4\u30F3\u306E\u7DE8\u96C6
-label.action.edit.global.setting=\u30B0\u30ED\u30FC\u30D0\u30EB\u8A2D\u5B9A\u306E\u7DE8\u96C6
-label.action.edit.host=\u30DB\u30B9\u30C8\u306E\u7DE8\u96C6
-label.action.edit.instance=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u306E\u7DE8\u96C6
-label.action.edit.ISO=ISO \u306E\u7DE8\u96C6
-label.action.edit.network.offering=\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0\u306E\u7DE8\u96C6
-label.action.edit.network.processing=\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u3092\u7DE8\u96C6\u3057\u3066\u3044\u307E\u3059...
-label.action.edit.network=\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u306E\u7DE8\u96C6
-label.action.edit.pod=\u30DD\u30C3\u30C9\u306E\u7DE8\u96C6
-label.action.edit.primary.storage=\u30D7\u30E9\u30A4\u30DE\u30EA \u30B9\u30C8\u30EC\u30FC\u30B8\u306E\u7DE8\u96C6
-label.action.edit.resource.limits=\u30EA\u30BD\u30FC\u30B9\u5236\u9650\u306E\u7DE8\u96C6
-label.action.edit.service.offering=\u30B5\u30FC\u30D3\u30B9 \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0\u306E\u7DE8\u96C6
-label.action.edit.template=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u7DE8\u96C6
-label.action.edit.user=\u30E6\u30FC\u30B6\u30FC\u306E\u7DE8\u96C6
-label.action.edit.zone=\u30BE\u30FC\u30F3\u306E\u7DE8\u96C6
-label.action.enable.account.processing=\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u6709\u52B9\u306B\u3057\u3066\u3044\u307E\u3059...
-label.action.enable.account=\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u6709\u52B9\u5316
-label.action.enable.cluster.processing=\u30AF\u30E9\u30B9\u30BF\u30FC\u3092\u6709\u52B9\u306B\u3057\u3066\u3044\u307E\u3059...
-label.action.enable.cluster=\u30AF\u30E9\u30B9\u30BF\u30FC\u306E\u6709\u52B9\u5316
-label.action.enable.maintenance.mode.processing=\u4FDD\u5B88\u30E2\u30FC\u30C9\u3092\u6709\u52B9\u306B\u3057\u3066\u3044\u307E\u3059...
-label.action.enable.maintenance.mode=\u4FDD\u5B88\u30E2\u30FC\u30C9\u306E\u6709\u52B9\u5316
-label.action.enable.nexusVswitch=Nexus 1000V \u306E\u6709\u52B9\u5316
-label.action.enable.physical.network=\u7269\u7406\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u306E\u6709\u52B9\u5316
-label.action.enable.pod.processing=\u30DD\u30C3\u30C9\u3092\u6709\u52B9\u306B\u3057\u3066\u3044\u307E\u3059...
-label.action.enable.pod=\u30DD\u30C3\u30C9\u306E\u6709\u52B9\u5316
-label.action.enable.static.NAT.processing=\u9759\u7684 NAT \u3092\u6709\u52B9\u306B\u3057\u3066\u3044\u307E\u3059...
-label.action.enable.static.NAT=\u9759\u7684 NAT \u306E\u6709\u52B9\u5316
-label.action.enable.user.processing=\u30E6\u30FC\u30B6\u30FC\u3092\u6709\u52B9\u306B\u3057\u3066\u3044\u307E\u3059...
-label.action.enable.user=\u30E6\u30FC\u30B6\u30FC\u306E\u6709\u52B9\u5316
-label.action.enable.zone.processing=\u30BE\u30FC\u30F3\u3092\u6709\u52B9\u306B\u3057\u3066\u3044\u307E\u3059...
-label.action.enable.zone=\u30BE\u30FC\u30F3\u306E\u6709\u52B9\u5316
-label.action.force.reconnect.processing=\u518D\u63A5\u7D9A\u3057\u3066\u3044\u307E\u3059...
-label.action.force.reconnect=\u5F37\u5236\u518D\u63A5\u7D9A
-label.action.generate.keys.processing=\u30AD\u30FC\u3092\u751F\u6210\u3057\u3066\u3044\u307E\u3059...
-label.action.generate.keys=\u30AD\u30FC\u306E\u751F\u6210
-label.action.list.nexusVswitch=Nexus 1000V \u306E\u4E00\u89A7\u8868\u793A
-label.action.lock.account.processing=\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u30ED\u30C3\u30AF\u3057\u3066\u3044\u307E\u3059...
-label.action.lock.account=\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u30ED\u30C3\u30AF
-label.action.manage.cluster.processing=\u30AF\u30E9\u30B9\u30BF\u30FC\u3092\u7BA1\u7406\u5BFE\u8C61\u306B\u3057\u3066\u3044\u307E\u3059...
-label.action.manage.cluster=\u30AF\u30E9\u30B9\u30BF\u30FC\u306E\u7BA1\u7406\u5BFE\u8C61\u5316
-label.action.migrate.instance.processing=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u79FB\u884C\u3057\u3066\u3044\u307E\u3059...
-label.action.migrate.instance=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u306E\u79FB\u884C
-label.action.migrate.router.processing=\u30EB\u30FC\u30BF\u30FC\u3092\u79FB\u884C\u3057\u3066\u3044\u307E\u3059...
-label.action.migrate.router=\u30EB\u30FC\u30BF\u30FC\u306E\u79FB\u884C
-label.action.migrate.systemvm.processing=\u30B7\u30B9\u30C6\u30E0 VM \u3092\u79FB\u884C\u3057\u3066\u3044\u307E\u3059...
-label.action.migrate.systemvm=\u30B7\u30B9\u30C6\u30E0 VM \u306E\u79FB\u884C
-label.action.reboot.instance.processing=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u518D\u8D77\u52D5\u3057\u3066\u3044\u307E\u3059...
-label.action.reboot.instance=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u306E\u518D\u8D77\u52D5
-label.action.reboot.router.processing=\u30EB\u30FC\u30BF\u30FC\u3092\u518D\u8D77\u52D5\u3057\u3066\u3044\u307E\u3059...
-label.action.reboot.router=\u30EB\u30FC\u30BF\u30FC\u306E\u518D\u8D77\u52D5
-label.action.reboot.systemvm.processing=\u30B7\u30B9\u30C6\u30E0 VM \u3092\u518D\u8D77\u52D5\u3057\u3066\u3044\u307E\u3059...
-label.action.reboot.systemvm=\u30B7\u30B9\u30C6\u30E0 VM \u306E\u518D\u8D77\u52D5
-label.action.recurring.snapshot=\u5B9A\u671F\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8
-label.action.register.iso=ISO \u306E\u767B\u9332
-label.action.register.template=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u767B\u9332
-label.action.release.ip=IP \u30A2\u30C9\u30EC\u30B9\u306E\u89E3\u653E
-label.action.release.ip.processing=IP \u30A2\u30C9\u30EC\u30B9\u3092\u89E3\u653E\u3057\u3066\u3044\u307E\u3059...
-label.action.remove.host.processing=\u30DB\u30B9\u30C8\u3092\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.action.remove.host=\u30DB\u30B9\u30C8\u306E\u524A\u9664
-label.action.reset.password.processing=\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u30EA\u30BB\u30C3\u30C8\u3057\u3066\u3044\u307E\u3059...
-label.action.reset.password=\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u30EA\u30BB\u30C3\u30C8
-label.action.resource.limits=\u30EA\u30BD\u30FC\u30B9\u5236\u9650
-label.action.restore.instance.processing=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u5FA9\u5143\u3057\u3066\u3044\u307E\u3059...
-label.action.restore.instance=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u306E\u5FA9\u5143
-label.action.start.instance.processing=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u8D77\u52D5\u3057\u3066\u3044\u307E\u3059...
-label.action.start.instance=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u306E\u8D77\u52D5
-label.action.start.router.processing=\u30EB\u30FC\u30BF\u30FC\u3092\u8D77\u52D5\u3057\u3066\u3044\u307E\u3059...
-label.action.start.router=\u30EB\u30FC\u30BF\u30FC\u306E\u8D77\u52D5
-label.action.start.systemvm.processing=\u30B7\u30B9\u30C6\u30E0 VM \u3092\u8D77\u52D5\u3057\u3066\u3044\u307E\u3059...
-label.action.start.systemvm=\u30B7\u30B9\u30C6\u30E0 VM \u306E\u8D77\u52D5
-label.action.stop.instance.processing=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u505C\u6B62\u3057\u3066\u3044\u307E\u3059...
-label.action.stop.instance=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u306E\u505C\u6B62
-label.action.stop.router.processing=\u30EB\u30FC\u30BF\u30FC\u3092\u505C\u6B62\u3057\u3066\u3044\u307E\u3059...
-label.action.stop.router=\u30EB\u30FC\u30BF\u30FC\u306E\u505C\u6B62
-label.action.stop.systemvm.processing=\u30B7\u30B9\u30C6\u30E0 VM \u3092\u505C\u6B62\u3057\u3066\u3044\u307E\u3059...
-label.action.stop.systemvm=\u30B7\u30B9\u30C6\u30E0 VM \u306E\u505C\u6B62
-label.actions=\u64CD\u4F5C
-label.action.take.snapshot.processing=\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059....
-label.action.take.snapshot=\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u306E\u4F5C\u6210
-label.action.unmanage.cluster.processing=\u30AF\u30E9\u30B9\u30BF\u30FC\u3092\u975E\u7BA1\u7406\u5BFE\u8C61\u306B\u3057\u3066\u3044\u307E\u3059...
-label.action.unmanage.cluster=\u30AF\u30E9\u30B9\u30BF\u30FC\u306E\u975E\u7BA1\u7406\u5BFE\u8C61\u5316
-label.action.update.OS.preference=OS \u57FA\u672C\u8A2D\u5B9A\u306E\u66F4\u65B0
-label.action.update.OS.preference.processing=OS \u57FA\u672C\u8A2D\u5B9A\u3092\u66F4\u65B0\u3057\u3066\u3044\u307E\u3059...
-label.action.update.resource.count.processing=\u30EA\u30BD\u30FC\u30B9\u6570\u3092\u66F4\u65B0\u3057\u3066\u3044\u307E\u3059...
-label.action.update.resource.count=\u30EA\u30BD\u30FC\u30B9\u6570\u306E\u66F4\u65B0
-label.activate.project=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30A2\u30AF\u30C6\u30A3\u30D6\u5316
-label.active.sessions=\u30A2\u30AF\u30C6\u30A3\u30D6\u306A\u30BB\u30C3\u30B7\u30E7\u30F3
-label.add.accounts.to=\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u8FFD\u52A0\u5148\:
-label.add.accounts=\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u8FFD\u52A0
-label.add.account.to.project=\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3078\u306E\u8FFD\u52A0
-label.add.account=\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u8FFD\u52A0
-label.add.ACL=ACL \u306E\u8FFD\u52A0
-label.add.by.cidr=CIDR \u3067\u8FFD\u52A0
-label.add.by.group=\u30B0\u30EB\u30FC\u30D7\u3067\u8FFD\u52A0
-label.add.by=\u8FFD\u52A0\u5358\u4F4D
-label.add.cluster=\u30AF\u30E9\u30B9\u30BF\u30FC\u306E\u8FFD\u52A0
-label.add.compute.offering=\u30B3\u30F3\u30D4\u30E5\u30FC\u30C6\u30A3\u30F3\u30B0 \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0\u306E\u8FFD\u52A0
-label.add.direct.iprange=\u76F4\u63A5 IP \u30A2\u30C9\u30EC\u30B9\u306E\u7BC4\u56F2\u306E\u8FFD\u52A0
-label.add.disk.offering=\u30C7\u30A3\u30B9\u30AF \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0\u306E\u8FFD\u52A0
-label.add.domain=\u30C9\u30E1\u30A4\u30F3\u306E\u8FFD\u52A0
-label.add.egress.rule=\u9001\u4FE1\u898F\u5247\u306E\u8FFD\u52A0
-label.add.F5.device=F5 \u30C7\u30D0\u30A4\u30B9\u306E\u8FFD\u52A0
-label.add.firewall=\u30D5\u30A1\u30A4\u30A2\u30A6\u30A9\u30FC\u30EB\u898F\u5247\u306E\u8FFD\u52A0
-label.add.guest.network=\u30B2\u30B9\u30C8 \u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u306E\u8FFD\u52A0
-label.add.host=\u30DB\u30B9\u30C8\u306E\u8FFD\u52A0
-label.adding.cluster=\u30AF\u30E9\u30B9\u30BF\u30FC\u3092\u8FFD\u52A0\u3057\u3066\u3044\u307E\u3059
-label.adding.failed=\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
-label.adding.pod=\u30DD\u30C3\u30C9\u3092\u8FFD\u52A0\u3057\u3066\u3044\u307E\u3059
-label.adding.processing=\u8FFD\u52A0\u3057\u3066\u3044\u307E\u3059...
-label.add.ingress.rule=\u53D7\u4FE1\u898F\u5247\u306E\u8FFD\u52A0
-label.adding.succeeded=\u8FFD\u52A0\u3057\u307E\u3057\u305F
-label.adding=\u8FFD\u52A0\u3057\u3066\u3044\u307E\u3059
-label.adding.user=\u30E6\u30FC\u30B6\u30FC\u3092\u8FFD\u52A0\u3057\u3066\u3044\u307E\u3059
-label.adding.zone=\u30BE\u30FC\u30F3\u3092\u8FFD\u52A0\u3057\u3066\u3044\u307E\u3059
-label.add.ip.range=IP \u30A2\u30C9\u30EC\u30B9\u306E\u7BC4\u56F2\u306E\u8FFD\u52A0
-label.additional.networks=\u8FFD\u52A0\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF
-label.add.load.balancer=\u8CA0\u8377\u5206\u6563\u88C5\u7F6E\u306E\u8FFD\u52A0
-label.add.more=\u305D\u306E\u307B\u304B\u306E\u9805\u76EE\u306E\u8FFD\u52A0
-label.add.netScaler.device=Netscaler \u30C7\u30D0\u30A4\u30B9\u306E\u8FFD\u52A0
-label.add.network.ACL=\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF ACL \u306E\u8FFD\u52A0
-label.add.network.device=\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF \u30C7\u30D0\u30A4\u30B9\u306E\u8FFD\u52A0
-label.add.network.offering=\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0\u306E\u8FFD\u52A0
-label.add.network=\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u306E\u8FFD\u52A0
-label.add.new.F5=\u65B0\u3057\u3044 F5 \u306E\u8FFD\u52A0
-label.add.new.gateway=\u65B0\u3057\u3044\u30B2\u30FC\u30C8\u30A6\u30A7\u30A4\u306E\u8FFD\u52A0
-label.add.new.NetScaler=\u65B0\u3057\u3044 NetScaler \u306E\u8FFD\u52A0
-label.add.new.SRX=\u65B0\u3057\u3044 SRX \u306E\u8FFD\u52A0
-label.add.new.tier=\u65B0\u3057\u3044\u968E\u5C64\u306E\u8FFD\u52A0
+extractable=\u62bd\u51fa\u53ef\u80fd
+force.delete.domain.warning=\u8b66\u544a\: \u3053\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u9078\u629e\u3059\u308b\u3068\u3001\u3059\u3079\u3066\u306e\u5b50\u30c9\u30e1\u30a4\u30f3\u304a\u3088\u3073\u95a2\u9023\u3059\u308b\u3059\u3079\u3066\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u3068\u305d\u306e\u30ea\u30bd\u30fc\u30b9\u304c\u524a\u9664\u3055\u308c\u307e\u3059\u3002
+force.delete=\u5f37\u5236\u524a\u9664
+force.remove.host.warning=\u8b66\u544a\: \u3053\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u9078\u629e\u3059\u308b\u3068\u3001\u5b9f\u884c\u4e2d\u306e\u3059\u3079\u3066\u306e\u4eee\u60f3\u30de\u30b7\u30f3\u304c\u5f37\u5236\u7684\u306b\u505c\u6b62\u3055\u308c\u3001\u30af\u30e9\u30b9\u30bf\u30fc\u304b\u3089\u3053\u306e\u30db\u30b9\u30c8\u304c\u5f37\u5236\u7684\u306b\u89e3\u9664\u3055\u308c\u307e\u3059\u3002
+force.remove=\u5f37\u5236\u89e3\u9664
+force.stop.instance.warning=\u8b66\u544a\: \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u5f37\u5236\u505c\u6b62\u306f\u3001\u6700\u7d42\u624b\u6bb5\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u30c7\u30fc\u30bf\u3092\u640d\u5931\u3059\u308b\u3060\u3051\u3067\u306a\u304f\u3001\u4eee\u60f3\u30de\u30b7\u30f3\u306e\u52d5\u4f5c\u304c\u4e00\u8cab\u3057\u306a\u304f\u306a\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002
+force.stop=\u5f37\u5236\u505c\u6b62
+ICMP.code=ICMP \u30b3\u30fc\u30c9
+ICMP.type=ICMP \u306e\u7a2e\u985e
+image.directory=\u753b\u50cf\u30c7\u30a3\u30ec\u30af\u30c8\u30ea
+inline=\u76f4\u5217
+instances.actions.reboot.label=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u518d\u8d77\u52d5
+label.accept.project.invitation=\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3078\u306e\u62db\u5f85\u306e\u627f\u8afe
+label.account.and.security.group=\u30a2\u30ab\u30a6\u30f3\u30c8\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3 \u30b0\u30eb\u30fc\u30d7
+label.account.id=\u30a2\u30ab\u30a6\u30f3\u30c8 ID
+label.account.name=\u30a2\u30ab\u30a6\u30f3\u30c8\u540d
+label.account.specific=\u30a2\u30ab\u30a6\u30f3\u30c8\u56fa\u6709
+label.accounts=\u30a2\u30ab\u30a6\u30f3\u30c8
+label.account=\u30a2\u30ab\u30a6\u30f3\u30c8
+label.acquire.new.ip=\u65b0\u3057\u3044 IP \u30a2\u30c9\u30ec\u30b9\u306e\u53d6\u5f97
+label.action.attach.disk.processing=\u30c7\u30a3\u30b9\u30af\u3092\u30a2\u30bf\u30c3\u30c1\u3057\u3066\u3044\u307e\u3059...
+label.action.attach.disk=\u30c7\u30a3\u30b9\u30af\u306e\u30a2\u30bf\u30c3\u30c1
+label.action.attach.iso=ISO \u306e\u30a2\u30bf\u30c3\u30c1
+label.action.attach.iso.processing=ISO \u3092\u30a2\u30bf\u30c3\u30c1\u3057\u3066\u3044\u307e\u3059...
+label.action.cancel.maintenance.mode.processing=\u4fdd\u5b88\u30e2\u30fc\u30c9\u3092\u30ad\u30e3\u30f3\u30bb\u30eb\u3057\u3066\u3044\u307e\u3059...
+label.action.cancel.maintenance.mode=\u4fdd\u5b88\u30e2\u30fc\u30c9\u306e\u30ad\u30e3\u30f3\u30bb\u30eb
+label.action.change.password=\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u5909\u66f4
+label.action.change.service.processing=\u30b5\u30fc\u30d3\u30b9\u3092\u5909\u66f4\u3057\u3066\u3044\u307e\u3059...
+label.action.change.service=\u30b5\u30fc\u30d3\u30b9\u306e\u5909\u66f4
+label.action.copy.ISO=ISO \u306e\u30b3\u30d4\u30fc
+label.action.copy.ISO.processing=ISO \u3092\u30b3\u30d4\u30fc\u3057\u3066\u3044\u307e\u3059...
+label.action.copy.template.processing=\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u30b3\u30d4\u30fc\u3057\u3066\u3044\u307e\u3059...
+label.action.copy.template=\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u30b3\u30d4\u30fc
+label.action.create.template.from.vm=VM \u304b\u3089\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u4f5c\u6210
+label.action.create.template.from.volume=\u30dc\u30ea\u30e5\u30fc\u30e0\u304b\u3089\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u4f5c\u6210
+label.action.create.template.processing=\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059...
+label.action.create.template=\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u4f5c\u6210
+label.action.create.vm.processing=VM \u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059...
+label.action.create.vm=VM \u306e\u4f5c\u6210
+label.action.create.volume.processing=\u30dc\u30ea\u30e5\u30fc\u30e0\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059...
+label.action.create.volume=\u30dc\u30ea\u30e5\u30fc\u30e0\u306e\u4f5c\u6210
+label.action.delete.account.processing=\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.account=\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u524a\u9664
+label.action.delete.cluster.processing=\u30af\u30e9\u30b9\u30bf\u30fc\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.cluster=\u30af\u30e9\u30b9\u30bf\u30fc\u306e\u524a\u9664
+label.action.delete.disk.offering.processing=\u30c7\u30a3\u30b9\u30af \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.disk.offering=\u30c7\u30a3\u30b9\u30af \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0\u306e\u524a\u9664
+label.action.delete.domain.processing=\u30c9\u30e1\u30a4\u30f3\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.domain=\u30c9\u30e1\u30a4\u30f3\u306e\u524a\u9664
+label.action.delete.firewall.processing=\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.firewall=\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u898f\u5247\u306e\u524a\u9664
+label.action.delete.ingress.rule.processing=\u53d7\u4fe1\u898f\u5247\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.ingress.rule=\u53d7\u4fe1\u898f\u5247\u306e\u524a\u9664
+label.action.delete.IP.range=IP \u30a2\u30c9\u30ec\u30b9\u306e\u7bc4\u56f2\u306e\u524a\u9664
+label.action.delete.IP.range.processing=IP \u30a2\u30c9\u30ec\u30b9\u306e\u7bc4\u56f2\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.ISO=ISO \u306e\u524a\u9664
+label.action.delete.ISO.processing=ISO \u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.load.balancer.processing=\u8ca0\u8377\u5206\u6563\u88c5\u7f6e\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.load.balancer=\u8ca0\u8377\u5206\u6563\u898f\u5247\u306e\u524a\u9664
+label.action.delete.network.processing=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.network=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u524a\u9664
+label.action.delete.nexusVswitch=Nexus 1000V \u306e\u524a\u9664
+label.action.delete.physical.network=\u7269\u7406\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u524a\u9664
+label.action.delete.pod.processing=\u30dd\u30c3\u30c9\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.pod=\u30dd\u30c3\u30c9\u306e\u524a\u9664
+label.action.delete.primary.storage.processing=\u30d7\u30e9\u30a4\u30de\u30ea \u30b9\u30c8\u30ec\u30fc\u30b8\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.primary.storage=\u30d7\u30e9\u30a4\u30de\u30ea \u30b9\u30c8\u30ec\u30fc\u30b8\u306e\u524a\u9664
+label.action.delete.secondary.storage.processing=\u30bb\u30ab\u30f3\u30c0\u30ea \u30b9\u30c8\u30ec\u30fc\u30b8\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.secondary.storage=\u30bb\u30ab\u30f3\u30c0\u30ea \u30b9\u30c8\u30ec\u30fc\u30b8\u306e\u524a\u9664
+label.action.delete.security.group.processing=\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3 \u30b0\u30eb\u30fc\u30d7\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.security.group=\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3 \u30b0\u30eb\u30fc\u30d7\u306e\u524a\u9664
+label.action.delete.service.offering.processing=\u30b5\u30fc\u30d3\u30b9 \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.service.offering=\u30b5\u30fc\u30d3\u30b9 \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0\u306e\u524a\u9664
+label.action.delete.snapshot.processing=\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.snapshot=\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8\u306e\u524a\u9664
+label.action.delete.system.service.offering=\u30b7\u30b9\u30c6\u30e0 \u30b5\u30fc\u30d3\u30b9 \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0\u306e\u524a\u9664
+label.action.delete.template.processing=\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.template=\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u524a\u9664
+label.action.delete.user.processing=\u30e6\u30fc\u30b6\u30fc\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.user=\u30e6\u30fc\u30b6\u30fc\u306e\u524a\u9664
+label.action.delete.volume.processing=\u30dc\u30ea\u30e5\u30fc\u30e0\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.volume=\u30dc\u30ea\u30e5\u30fc\u30e0\u306e\u524a\u9664
+label.action.delete.zone.processing=\u30be\u30fc\u30f3\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.delete.zone=\u30be\u30fc\u30f3\u306e\u524a\u9664
+label.action.destroy.instance.processing=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u7834\u68c4\u3057\u3066\u3044\u307e\u3059...
+label.action.destroy.instance=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u7834\u68c4
+label.action.destroy.systemvm.processing=\u30b7\u30b9\u30c6\u30e0 VM \u3092\u7834\u68c4\u3057\u3066\u3044\u307e\u3059...
+label.action.destroy.systemvm=\u30b7\u30b9\u30c6\u30e0 VM \u306e\u7834\u68c4
+label.action.detach.disk.processing=\u30c7\u30a3\u30b9\u30af\u3092\u30c7\u30bf\u30c3\u30c1\u3057\u3066\u3044\u307e\u3059...
+label.action.detach.disk=\u30c7\u30a3\u30b9\u30af\u306e\u30c7\u30bf\u30c3\u30c1
+label.action.detach.iso=ISO \u306e\u30c7\u30bf\u30c3\u30c1
+label.action.detach.iso.processing=ISO \u3092\u30c7\u30bf\u30c3\u30c1\u3057\u3066\u3044\u307e\u3059...
+label.action.disable.account.processing=\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u7121\u52b9\u306b\u3057\u3066\u3044\u307e\u3059...
+label.action.disable.account=\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u7121\u52b9\u5316
+label.action.disable.cluster.processing=\u30af\u30e9\u30b9\u30bf\u30fc\u3092\u7121\u52b9\u306b\u3057\u3066\u3044\u307e\u3059...
+label.action.disable.cluster=\u30af\u30e9\u30b9\u30bf\u30fc\u306e\u7121\u52b9\u5316
+label.action.disable.nexusVswitch=Nexus 1000V \u306e\u7121\u52b9\u5316
+label.action.disable.physical.network=\u7269\u7406\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u7121\u52b9\u5316
+label.action.disable.pod.processing=\u30dd\u30c3\u30c9\u3092\u7121\u52b9\u306b\u3057\u3066\u3044\u307e\u3059...
+label.action.disable.pod=\u30dd\u30c3\u30c9\u306e\u7121\u52b9\u5316
+label.action.disable.static.NAT.processing=\u9759\u7684 NAT \u3092\u7121\u52b9\u306b\u3057\u3066\u3044\u307e\u3059...
+label.action.disable.static.NAT=\u9759\u7684 NAT \u306e\u7121\u52b9\u5316
+label.action.disable.user.processing=\u30e6\u30fc\u30b6\u30fc\u3092\u7121\u52b9\u306b\u3057\u3066\u3044\u307e\u3059...
+label.action.disable.user=\u30e6\u30fc\u30b6\u30fc\u306e\u7121\u52b9\u5316
+label.action.disable.zone.processing=\u30be\u30fc\u30f3\u3092\u7121\u52b9\u306b\u3057\u3066\u3044\u307e\u3059...
+label.action.disable.zone=\u30be\u30fc\u30f3\u306e\u7121\u52b9\u5316
+label.action.download.ISO=ISO \u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9
+label.action.download.template=\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9
+label.action.download.volume.processing=\u30dc\u30ea\u30e5\u30fc\u30e0\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u3044\u307e\u3059...
+label.action.download.volume=\u30dc\u30ea\u30e5\u30fc\u30e0\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9
+label.action.edit.account=\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u7de8\u96c6
+label.action.edit.disk.offering=\u30c7\u30a3\u30b9\u30af \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0\u306e\u7de8\u96c6
+label.action.edit.domain=\u30c9\u30e1\u30a4\u30f3\u306e\u7de8\u96c6
+label.action.edit.global.setting=\u30b0\u30ed\u30fc\u30d0\u30eb\u8a2d\u5b9a\u306e\u7de8\u96c6
+label.action.edit.host=\u30db\u30b9\u30c8\u306e\u7de8\u96c6
+label.action.edit.instance=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u7de8\u96c6
+label.action.edit.ISO=ISO \u306e\u7de8\u96c6
+label.action.edit.network.offering=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0\u306e\u7de8\u96c6
+label.action.edit.network.processing=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u7de8\u96c6\u3057\u3066\u3044\u307e\u3059...
+label.action.edit.network=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u7de8\u96c6
+label.action.edit.pod=\u30dd\u30c3\u30c9\u306e\u7de8\u96c6
+label.action.edit.primary.storage=\u30d7\u30e9\u30a4\u30de\u30ea \u30b9\u30c8\u30ec\u30fc\u30b8\u306e\u7de8\u96c6
+label.action.edit.resource.limits=\u30ea\u30bd\u30fc\u30b9\u5236\u9650\u306e\u7de8\u96c6
+label.action.edit.service.offering=\u30b5\u30fc\u30d3\u30b9 \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0\u306e\u7de8\u96c6
+label.action.edit.template=\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u7de8\u96c6
+label.action.edit.user=\u30e6\u30fc\u30b6\u30fc\u306e\u7de8\u96c6
+label.action.edit.zone=\u30be\u30fc\u30f3\u306e\u7de8\u96c6
+label.action.enable.account.processing=\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u6709\u52b9\u306b\u3057\u3066\u3044\u307e\u3059...
+label.action.enable.account=\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u6709\u52b9\u5316
+label.action.enable.cluster.processing=\u30af\u30e9\u30b9\u30bf\u30fc\u3092\u6709\u52b9\u306b\u3057\u3066\u3044\u307e\u3059...
+label.action.enable.cluster=\u30af\u30e9\u30b9\u30bf\u30fc\u306e\u6709\u52b9\u5316
+label.action.enable.maintenance.mode.processing=\u4fdd\u5b88\u30e2\u30fc\u30c9\u3092\u6709\u52b9\u306b\u3057\u3066\u3044\u307e\u3059...
+label.action.enable.maintenance.mode=\u4fdd\u5b88\u30e2\u30fc\u30c9\u306e\u6709\u52b9\u5316
+label.action.enable.nexusVswitch=Nexus 1000V \u306e\u6709\u52b9\u5316
+label.action.enable.physical.network=\u7269\u7406\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u6709\u52b9\u5316
+label.action.enable.pod.processing=\u30dd\u30c3\u30c9\u3092\u6709\u52b9\u306b\u3057\u3066\u3044\u307e\u3059...
+label.action.enable.pod=\u30dd\u30c3\u30c9\u306e\u6709\u52b9\u5316
+label.action.enable.static.NAT.processing=\u9759\u7684 NAT \u3092\u6709\u52b9\u306b\u3057\u3066\u3044\u307e\u3059...
+label.action.enable.static.NAT=\u9759\u7684 NAT \u306e\u6709\u52b9\u5316
+label.action.enable.user.processing=\u30e6\u30fc\u30b6\u30fc\u3092\u6709\u52b9\u306b\u3057\u3066\u3044\u307e\u3059...
+label.action.enable.user=\u30e6\u30fc\u30b6\u30fc\u306e\u6709\u52b9\u5316
+label.action.enable.zone.processing=\u30be\u30fc\u30f3\u3092\u6709\u52b9\u306b\u3057\u3066\u3044\u307e\u3059...
+label.action.enable.zone=\u30be\u30fc\u30f3\u306e\u6709\u52b9\u5316
+label.action.force.reconnect.processing=\u518d\u63a5\u7d9a\u3057\u3066\u3044\u307e\u3059...
+label.action.force.reconnect=\u5f37\u5236\u518d\u63a5\u7d9a
+label.action.generate.keys.processing=\u30ad\u30fc\u3092\u751f\u6210\u3057\u3066\u3044\u307e\u3059...
+label.action.generate.keys=\u30ad\u30fc\u306e\u751f\u6210
+label.action.list.nexusVswitch=Nexus 1000V \u306e\u4e00\u89a7\u8868\u793a
+label.action.lock.account.processing=\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u30ed\u30c3\u30af\u3057\u3066\u3044\u307e\u3059...
+label.action.lock.account=\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u30ed\u30c3\u30af
+label.action.manage.cluster.processing=\u30af\u30e9\u30b9\u30bf\u30fc\u3092\u7ba1\u7406\u5bfe\u8c61\u306b\u3057\u3066\u3044\u307e\u3059...
+label.action.manage.cluster=\u30af\u30e9\u30b9\u30bf\u30fc\u306e\u7ba1\u7406\u5bfe\u8c61\u5316
+label.action.migrate.instance.processing=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u79fb\u884c\u3057\u3066\u3044\u307e\u3059...
+label.action.migrate.instance=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u79fb\u884c
+label.action.migrate.router.processing=\u30eb\u30fc\u30bf\u30fc\u3092\u79fb\u884c\u3057\u3066\u3044\u307e\u3059...
+label.action.migrate.router=\u30eb\u30fc\u30bf\u30fc\u306e\u79fb\u884c
+label.action.migrate.systemvm.processing=\u30b7\u30b9\u30c6\u30e0 VM \u3092\u79fb\u884c\u3057\u3066\u3044\u307e\u3059...
+label.action.migrate.systemvm=\u30b7\u30b9\u30c6\u30e0 VM \u306e\u79fb\u884c
+label.action.reboot.instance.processing=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u518d\u8d77\u52d5\u3057\u3066\u3044\u307e\u3059...
+label.action.reboot.instance=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u518d\u8d77\u52d5
+label.action.reboot.router.processing=\u30eb\u30fc\u30bf\u30fc\u3092\u518d\u8d77\u52d5\u3057\u3066\u3044\u307e\u3059...
+label.action.reboot.router=\u30eb\u30fc\u30bf\u30fc\u306e\u518d\u8d77\u52d5
+label.action.reboot.systemvm.processing=\u30b7\u30b9\u30c6\u30e0 VM \u3092\u518d\u8d77\u52d5\u3057\u3066\u3044\u307e\u3059...
+label.action.reboot.systemvm=\u30b7\u30b9\u30c6\u30e0 VM \u306e\u518d\u8d77\u52d5
+label.action.recurring.snapshot=\u5b9a\u671f\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8
+label.action.register.iso=ISO \u306e\u767b\u9332
+label.action.register.template=\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u767b\u9332
+label.action.release.ip=IP \u30a2\u30c9\u30ec\u30b9\u306e\u89e3\u653e
+label.action.release.ip.processing=IP \u30a2\u30c9\u30ec\u30b9\u3092\u89e3\u653e\u3057\u3066\u3044\u307e\u3059...
+label.action.remove.host.processing=\u30db\u30b9\u30c8\u3092\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.action.remove.host=\u30db\u30b9\u30c8\u306e\u524a\u9664
+label.action.reset.password.processing=\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u30ea\u30bb\u30c3\u30c8\u3057\u3066\u3044\u307e\u3059...
+label.action.reset.password=\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u30ea\u30bb\u30c3\u30c8
+label.action.resource.limits=\u30ea\u30bd\u30fc\u30b9\u5236\u9650
+label.action.restore.instance.processing=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u5fa9\u5143\u3057\u3066\u3044\u307e\u3059...
+label.action.restore.instance=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u5fa9\u5143
+label.action.start.instance.processing=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u8d77\u52d5\u3057\u3066\u3044\u307e\u3059...
+label.action.start.instance=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u8d77\u52d5
+label.action.start.router.processing=\u30eb\u30fc\u30bf\u30fc\u3092\u8d77\u52d5\u3057\u3066\u3044\u307e\u3059...
+label.action.start.router=\u30eb\u30fc\u30bf\u30fc\u306e\u8d77\u52d5
+label.action.start.systemvm.processing=\u30b7\u30b9\u30c6\u30e0 VM \u3092\u8d77\u52d5\u3057\u3066\u3044\u307e\u3059...
+label.action.start.systemvm=\u30b7\u30b9\u30c6\u30e0 VM \u306e\u8d77\u52d5
+label.action.stop.instance.processing=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u505c\u6b62\u3057\u3066\u3044\u307e\u3059...
+label.action.stop.instance=\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u505c\u6b62
+label.action.stop.router.processing=\u30eb\u30fc\u30bf\u30fc\u3092\u505c\u6b62\u3057\u3066\u3044\u307e\u3059...
+label.action.stop.router=\u30eb\u30fc\u30bf\u30fc\u306e\u505c\u6b62
+label.action.stop.systemvm.processing=\u30b7\u30b9\u30c6\u30e0 VM \u3092\u505c\u6b62\u3057\u3066\u3044\u307e\u3059...
+label.action.stop.systemvm=\u30b7\u30b9\u30c6\u30e0 VM \u306e\u505c\u6b62
+label.actions=\u64cd\u4f5c
+label.action.take.snapshot.processing=\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059....
+label.action.take.snapshot=\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8\u306e\u4f5c\u6210
+label.action.unmanage.cluster.processing=\u30af\u30e9\u30b9\u30bf\u30fc\u3092\u975e\u7ba1\u7406\u5bfe\u8c61\u306b\u3057\u3066\u3044\u307e\u3059...
+label.action.unmanage.cluster=\u30af\u30e9\u30b9\u30bf\u30fc\u306e\u975e\u7ba1\u7406\u5bfe\u8c61\u5316
+label.action.update.OS.preference=OS \u57fa\u672c\u8a2d\u5b9a\u306e\u66f4\u65b0
+label.action.update.OS.preference.processing=OS \u57fa\u672c\u8a2d\u5b9a\u3092\u66f4\u65b0\u3057\u3066\u3044\u307e\u3059...
+label.action.update.resource.count.processing=\u30ea\u30bd\u30fc\u30b9\u6570\u3092\u66f4\u65b0\u3057\u3066\u3044\u307e\u3059...
+label.action.update.resource.count=\u30ea\u30bd\u30fc\u30b9\u6570\u306e\u66f4\u65b0
+label.activate.project=\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30a2\u30af\u30c6\u30a3\u30d6\u5316
+label.active.sessions=\u30a2\u30af\u30c6\u30a3\u30d6\u306a\u30bb\u30c3\u30b7\u30e7\u30f3
+label.add.accounts.to=\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u8ffd\u52a0\u5148\:
+label.add.accounts=\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u8ffd\u52a0
+label.add.account.to.project=\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3078\u306e\u8ffd\u52a0
+label.add.account=\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u8ffd\u52a0
+label.add.ACL=ACL \u306e\u8ffd\u52a0
+label.add.by.cidr=CIDR \u3067\u8ffd\u52a0
+label.add.by.group=\u30b0\u30eb\u30fc\u30d7\u3067\u8ffd\u52a0
+label.add.by=\u8ffd\u52a0\u5358\u4f4d
+label.add.cluster=\u30af\u30e9\u30b9\u30bf\u30fc\u306e\u8ffd\u52a0
+label.add.compute.offering=\u30b3\u30f3\u30d4\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0 \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0\u306e\u8ffd\u52a0
+label.add.direct.iprange=\u76f4\u63a5 IP \u30a2\u30c9\u30ec\u30b9\u306e\u7bc4\u56f2\u306e\u8ffd\u52a0
+label.add.disk.offering=\u30c7\u30a3\u30b9\u30af \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0\u306e\u8ffd\u52a0
+label.add.domain=\u30c9\u30e1\u30a4\u30f3\u306e\u8ffd\u52a0
+label.add.egress.rule=\u9001\u4fe1\u898f\u5247\u306e\u8ffd\u52a0
+label.add.F5.device=F5 \u30c7\u30d0\u30a4\u30b9\u306e\u8ffd\u52a0
+label.add.firewall=\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u898f\u5247\u306e\u8ffd\u52a0
+label.add.guest.network=\u30b2\u30b9\u30c8 \u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u8ffd\u52a0
+label.add.host=\u30db\u30b9\u30c8\u306e\u8ffd\u52a0
+label.adding.cluster=\u30af\u30e9\u30b9\u30bf\u30fc\u3092\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059
+label.adding.failed=\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f
+label.adding.pod=\u30dd\u30c3\u30c9\u3092\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059
+label.adding.processing=\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059...
+label.add.ingress.rule=\u53d7\u4fe1\u898f\u5247\u306e\u8ffd\u52a0
+label.adding.succeeded=\u8ffd\u52a0\u3057\u307e\u3057\u305f
+label.adding=\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059
+label.adding.user=\u30e6\u30fc\u30b6\u30fc\u3092\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059
+label.adding.zone=\u30be\u30fc\u30f3\u3092\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059
+label.add.ip.range=IP \u30a2\u30c9\u30ec\u30b9\u306e\u7bc4\u56f2\u306e\u8ffd\u52a0
+label.additional.networks=\u8ffd\u52a0\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af
+label.add.load.balancer=\u8ca0\u8377\u5206\u6563\u88c5\u7f6e\u306e\u8ffd\u52a0
+label.add.more=\u305d\u306e\u307b\u304b\u306e\u9805\u76ee\u306e\u8ffd\u52a0
+label.add.netScaler.device=Netscaler \u30c7\u30d0\u30a4\u30b9\u306e\u8ffd\u52a0
+label.add.network.ACL=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af ACL \u306e\u8ffd\u52a0
+label.add.network.device=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af \u30c7\u30d0\u30a4\u30b9\u306e\u8ffd\u52a0
+label.add.network.offering=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0\u306e\u8ffd\u52a0
+label.add.network=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u8ffd\u52a0
+label.add.new.F5=\u65b0\u3057\u3044 F5 \u306e\u8ffd\u52a0
+label.add.new.gateway=\u65b0\u3057\u3044\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4\u306e\u8ffd\u52a0
+label.add.new.NetScaler=\u65b0\u3057\u3044 NetScaler \u306e\u8ffd\u52a0
+label.add.new.SRX=\u65b0\u3057\u3044 SRX \u306e\u8ffd\u52a0
+label.add.new.tier=\u65b0\u3057\u3044\u968e\u5c64\u306e\u8ffd\u52a0
 label.add.NiciraNvp.device=NVP\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u8ffd\u52a0
-label.add.physical.network=\u7269\u7406\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u306E\u8FFD\u52A0
-label.add.pod=\u30DD\u30C3\u30C9\u306E\u8FFD\u52A0
-label.add.port.forwarding.rule=\u30DD\u30FC\u30C8\u8EE2\u9001\u898F\u5247\u306E\u8FFD\u52A0
-label.add.primary.storage=\u30D7\u30E9\u30A4\u30DE\u30EA \u30B9\u30C8\u30EC\u30FC\u30B8\u306E\u8FFD\u52A0
-label.add.resources=\u30EA\u30BD\u30FC\u30B9\u306E\u8FFD\u52A0
-label.add.route=\u30EB\u30FC\u30C8\u306E\u8FFD\u52A0
-label.add.rule=\u898F\u5247\u306E\u8FFD\u52A0
-label.add.secondary.storage=\u30BB\u30AB\u30F3\u30C0\u30EA \u30B9\u30C8\u30EC\u30FC\u30B8\u306E\u8FFD\u52A0
-label.add.security.group=\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3 \u30B0\u30EB\u30FC\u30D7\u306E\u8FFD\u52A0
-label.add.service.offering=\u30B5\u30FC\u30D3\u30B9 \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0\u306E\u8FFD\u52A0
-label.add.SRX.device=SRX \u30C7\u30D0\u30A4\u30B9\u306E\u8FFD\u52A0
-label.add.static.nat.rule=\u9759\u7684 NAT \u898F\u5247\u306E\u8FFD\u52A0
-label.add.static.route=\u9759\u7684\u30EB\u30FC\u30C8\u306E\u8FFD\u52A0
-label.add.system.service.offering=\u30B7\u30B9\u30C6\u30E0 \u30B5\u30FC\u30D3\u30B9 \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0\u306E\u8FFD\u52A0
-label.add.template=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u8FFD\u52A0
-label.add.to.group=\u30B0\u30EB\u30FC\u30D7\u3078\u306E\u8FFD\u52A0
-label.add=\u8FFD\u52A0
-label.add.user=\u30E6\u30FC\u30B6\u30FC\u306E\u8FFD\u52A0
-label.add.vlan=VLAN \u306E\u8FFD\u52A0
-label.add.vms.to.lb=\u8CA0\u8377\u5206\u6563\u898F\u5247\u3078\u306E VM \u306E\u8FFD\u52A0
-label.add.vms=VM \u306E\u8FFD\u52A0
-label.add.VM.to.tier=\u968E\u5C64\u3078\u306E VM \u306E\u8FFD\u52A0
-label.add.vm=VM \u306E\u8FFD\u52A0
-label.add.volume=\u30DC\u30EA\u30E5\u30FC\u30E0\u306E\u8FFD\u52A0
-label.add.vpc=VPC \u306E\u8FFD\u52A0
-label.add.vpn.customer.gateway=VPN \u30AB\u30B9\u30BF\u30DE\u30FC \u30B2\u30FC\u30C8\u30A6\u30A7\u30A4\u306E\u8FFD\u52A0
-label.add.VPN.gateway=VPN \u30B2\u30FC\u30C8\u30A6\u30A7\u30A4\u306E\u8FFD\u52A0
-label.add.vpn.user=VPN \u30E6\u30FC\u30B6\u30FC\u306E\u8FFD\u52A0
-label.add.zone=\u30BE\u30FC\u30F3\u306E\u8FFD\u52A0
-label.admin.accounts=\u7BA1\u7406\u8005\u30A2\u30AB\u30A6\u30F3\u30C8
-label.admin=\u7BA1\u7406\u8005
-label.advanced.mode=\u62E1\u5F35\u30E2\u30FC\u30C9
-label.advanced.search=\u9AD8\u5EA6\u306A\u691C\u7D22
-label.advanced=\u62E1\u5F35
-label.agent.password=\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8 \u30D1\u30B9\u30EF\u30FC\u30C9
-label.agent.username=\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8 \u30E6\u30FC\u30B6\u30FC\u540D
-label.agree=\u540C\u610F\u3059\u308B
-label.alert=\u30A2\u30E9\u30FC\u30C8
-label.algorithm=\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0
-label.allocated=\u5272\u308A\u5F53\u3066\u6E08\u307F
-label.allocation.state=\u5272\u308A\u5F53\u3066\u72B6\u614B
-label.api.key=API \u30AD\u30FC
+label.add.physical.network=\u7269\u7406\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u8ffd\u52a0
+label.add.pod=\u30dd\u30c3\u30c9\u306e\u8ffd\u52a0
+label.add.port.forwarding.rule=\u30dd\u30fc\u30c8\u8ee2\u9001\u898f\u5247\u306e\u8ffd\u52a0
+label.add.primary.storage=\u30d7\u30e9\u30a4\u30de\u30ea \u30b9\u30c8\u30ec\u30fc\u30b8\u306e\u8ffd\u52a0
+label.add.resources=\u30ea\u30bd\u30fc\u30b9\u306e\u8ffd\u52a0
+label.add.route=\u30eb\u30fc\u30c8\u306e\u8ffd\u52a0
+label.add.rule=\u898f\u5247\u306e\u8ffd\u52a0
+label.add.secondary.storage=\u30bb\u30ab\u30f3\u30c0\u30ea \u30b9\u30c8\u30ec\u30fc\u30b8\u306e\u8ffd\u52a0
+label.add.security.group=\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3 \u30b0\u30eb\u30fc\u30d7\u306e\u8ffd\u52a0
+label.add.service.offering=\u30b5\u30fc\u30d3\u30b9 \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0\u306e\u8ffd\u52a0
+label.add.SRX.device=SRX \u30c7\u30d0\u30a4\u30b9\u306e\u8ffd\u52a0
+label.add.static.nat.rule=\u9759\u7684 NAT \u898f\u5247\u306e\u8ffd\u52a0
+label.add.static.route=\u9759\u7684\u30eb\u30fc\u30c8\u306e\u8ffd\u52a0
+label.add.system.service.offering=\u30b7\u30b9\u30c6\u30e0 \u30b5\u30fc\u30d3\u30b9 \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0\u306e\u8ffd\u52a0
+label.add.template=\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u8ffd\u52a0
+label.add.to.group=\u30b0\u30eb\u30fc\u30d7\u3078\u306e\u8ffd\u52a0
+label.add=\u8ffd\u52a0
+label.add.user=\u30e6\u30fc\u30b6\u30fc\u306e\u8ffd\u52a0
+label.add.vlan=VLAN \u306e\u8ffd\u52a0
+label.add.vms.to.lb=\u8ca0\u8377\u5206\u6563\u898f\u5247\u3078\u306e VM \u306e\u8ffd\u52a0
+label.add.vms=VM \u306e\u8ffd\u52a0
+label.add.VM.to.tier=\u968e\u5c64\u3078\u306e VM \u306e\u8ffd\u52a0
+label.add.vm=VM \u306e\u8ffd\u52a0
+label.add.volume=\u30dc\u30ea\u30e5\u30fc\u30e0\u306e\u8ffd\u52a0
+label.add.vpc=VPC \u306e\u8ffd\u52a0
+label.add.vpn.customer.gateway=VPN \u30ab\u30b9\u30bf\u30de\u30fc \u30b2\u30fc\u30c8\u30a6\u30a7\u30a4\u306e\u8ffd\u52a0
+label.add.VPN.gateway=VPN \u30b2\u30fc\u30c8\u30a6\u30a7\u30a4\u306e\u8ffd\u52a0
+label.add.vpn.user=VPN \u30e6\u30fc\u30b6\u30fc\u306e\u8ffd\u52a0
+label.add.zone=\u30be\u30fc\u30f3\u306e\u8ffd\u52a0
+label.admin.accounts=\u7ba1\u7406\u8005\u30a2\u30ab\u30a6\u30f3\u30c8
+label.admin=\u7ba1\u7406\u8005
+label.advanced.mode=\u62e1\u5f35\u30e2\u30fc\u30c9
+label.advanced.search=\u9ad8\u5ea6\u306a\u691c\u7d22
+label.advanced=\u62e1\u5f35
+label.agent.password=\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8 \u30d1\u30b9\u30ef\u30fc\u30c9
+label.agent.username=\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8 \u30e6\u30fc\u30b6\u30fc\u540d
+label.agree=\u540c\u610f\u3059\u308b
+label.alert=\u30a2\u30e9\u30fc\u30c8
+label.algorithm=\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0
+label.allocated=\u5272\u308a\u5f53\u3066\u6e08\u307f
+label.allocation.state=\u5272\u308a\u5f53\u3066\u72b6\u614b
+label.api.key=API \u30ad\u30fc
 label.apply=\u9069\u7528
-label.assign.to.load.balancer=\u8CA0\u8377\u5206\u6563\u88C5\u7F6E\u306B\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u5272\u308A\u5F53\u3066\u3066\u3044\u307E\u3059
-label.assign=\u5272\u308A\u5F53\u3066
-label.associated.network.id=\u95A2\u9023\u3065\u3051\u3089\u308C\u305F\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF ID
-label.associated.network=\u95A2\u9023\u3065\u3051\u3089\u308C\u305F\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF
-label.attached.iso=\u30A2\u30BF\u30C3\u30C1\u3055\u308C\u305F ISO
-label.availability=\u53EF\u7528\u6027
-label.availability.zone=\u5229\u7528\u53EF\u80FD\u30BE\u30FC\u30F3
-label.available.public.ips=\u4F7F\u7528\u3067\u304D\u308B\u30D1\u30D6\u30EA\u30C3\u30AF IP \u30A2\u30C9\u30EC\u30B9
-label.available=\u4F7F\u7528\u53EF\u80FD
-label.back=\u623B\u308B
-label.bandwidth=\u5E2F\u57DF\u5E45
-label.basic.mode=\u57FA\u672C\u30E2\u30FC\u30C9
-label.basic=\u57FA\u672C
-label.bootable=\u8D77\u52D5\u53EF\u80FD
-label.broadcast.domain.range=\u30D6\u30ED\u30FC\u30C9\u30AD\u30E3\u30B9\u30C8 \u30C9\u30E1\u30A4\u30F3\u306E\u7BC4\u56F2
-label.broadcast.domain.type=\u30D6\u30ED\u30FC\u30C9\u30AD\u30E3\u30B9\u30C8 \u30C9\u30E1\u30A4\u30F3\u306E\u7A2E\u985E
+label.assign.to.load.balancer=\u8ca0\u8377\u5206\u6563\u88c5\u7f6e\u306b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u5272\u308a\u5f53\u3066\u3066\u3044\u307e\u3059
+label.assign=\u5272\u308a\u5f53\u3066
+label.associated.network.id=\u95a2\u9023\u3065\u3051\u3089\u308c\u305f\u30cd\u30c3\u30c8\u30ef\u30fc\u30af ID
+label.associated.network=\u95a2\u9023\u3065\u3051\u3089\u308c\u305f\u30cd\u30c3\u30c8\u30ef\u30fc\u30af
+label.attached.iso=\u30a2\u30bf\u30c3\u30c1\u3055\u308c\u305f ISO
+label.availability=\u53ef\u7528\u6027
+label.availability.zone=\u5229\u7528\u53ef\u80fd\u30be\u30fc\u30f3
+label.available.public.ips=\u4f7f\u7528\u3067\u304d\u308b\u30d1\u30d6\u30ea\u30c3\u30af IP \u30a2\u30c9\u30ec\u30b9
+label.available=\u4f7f\u7528\u53ef\u80fd
+label.back=\u623b\u308b
+label.bandwidth=\u5e2f\u57df\u5e45
+label.basic.mode=\u57fa\u672c\u30e2\u30fc\u30c9
+label.basic=\u57fa\u672c
+label.bootable=\u8d77\u52d5\u53ef\u80fd
+label.broadcast.domain.range=\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8 \u30c9\u30e1\u30a4\u30f3\u306e\u7bc4\u56f2
+label.broadcast.domain.type=\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8 \u30c9\u30e1\u30a4\u30f3\u306e\u7a2e\u985e
 label.broadcast.uri=Broadcast URI
-label.by.account=\u30A2\u30AB\u30A6\u30F3\u30C8
-label.by.availability=\u53EF\u7528\u6027
-label.by.domain=\u30C9\u30E1\u30A4\u30F3
-label.by.end.date=\u7D42\u4E86\u65E5
-label.by.level=\u30EC\u30D9\u30EB
-label.by.pod=\u30DD\u30C3\u30C9
-label.by.role=\u5F79\u5272
-label.by.start.date=\u958B\u59CB\u65E5
-label.by.state=\u72B6\u614B
-label.bytes.received=\u53D7\u4FE1\u30D0\u30A4\u30C8
-label.bytes.sent=\u9001\u4FE1\u30D0\u30A4\u30C8
-label.by.traffic.type=\u30C8\u30E9\u30D5\u30A3\u30C3\u30AF\u306E\u7A2E\u985E
-label.by.type.id=\u7A2E\u985E ID
-label.by.type=\u7A2E\u985E
-label.by.zone=\u30BE\u30FC\u30F3
-label.cancel=\u30AD\u30E3\u30F3\u30BB\u30EB
-label.capacity=\u51E6\u7406\u80FD\u529B
-label.certificate=\u8A3C\u660E\u66F8
-label.change.service.offering=\u30B5\u30FC\u30D3\u30B9 \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0\u306E\u5909\u66F4
-label.change.value=\u5024\u306E\u5909\u66F4
-label.character=\u6587\u5B57
-label.checksum=MD5 \u30C1\u30A7\u30C3\u30AF\u30B5\u30E0
-label.cidr.account=CIDR \u307E\u305F\u306F\u30A2\u30AB\u30A6\u30F3\u30C8/\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3 \u30B0\u30EB\u30FC\u30D7
+label.by.account=\u30a2\u30ab\u30a6\u30f3\u30c8
+label.by.availability=\u53ef\u7528\u6027
+label.by.domain=\u30c9\u30e1\u30a4\u30f3
+label.by.end.date=\u7d42\u4e86\u65e5
+label.by.level=\u30ec\u30d9\u30eb
+label.by.pod=\u30dd\u30c3\u30c9
+label.by.role=\u5f79\u5272
+label.by.start.date=\u958b\u59cb\u65e5
+label.by.state=\u72b6\u614b
+label.bytes.received=\u53d7\u4fe1\u30d0\u30a4\u30c8
+label.bytes.sent=\u9001\u4fe1\u30d0\u30a4\u30c8
+label.by.traffic.type=\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u306e\u7a2e\u985e
+label.by.type.id=\u7a2e\u985e ID
+label.by.type=\u7a2e\u985e
+label.by.zone=\u30be\u30fc\u30f3
+label.cancel=\u30ad\u30e3\u30f3\u30bb\u30eb
+label.capacity=\u51e6\u7406\u80fd\u529b
+label.certificate=\u8a3c\u660e\u66f8
+label.change.service.offering=\u30b5\u30fc\u30d3\u30b9 \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0\u306e\u5909\u66f4
+label.change.value=\u5024\u306e\u5909\u66f4
+label.character=\u6587\u5b57
+label.checksum=MD5 \u30c1\u30a7\u30c3\u30af\u30b5\u30e0
+label.cidr.account=CIDR \u307e\u305f\u306f\u30a2\u30ab\u30a6\u30f3\u30c8/\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3 \u30b0\u30eb\u30fc\u30d7
 label.cidr=CIDR
-label.CIDR.list=CIDR \u4E00\u89A7
-label.cidr.list=\u9001\u4FE1\u5143 CIDR
-label.CIDR.of.destination.network=\u5B9B\u5148\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u306E CIDR
-label.clean.up=\u30AF\u30EA\u30FC\u30F3 \u30A2\u30C3\u30D7
-label.clear.list=\u4E00\u89A7\u306E\u6D88\u53BB
-label.close=\u9589\u3058\u308B
-label.cloud.console=\u30AF\u30E9\u30A6\u30C9\u7BA1\u7406\u30B3\u30F3\u30BD\u30FC\u30EB
-label.cloud.managed=Cloud.com \u306B\u3088\u308B\u7BA1\u7406
-label.cluster.name=\u30AF\u30E9\u30B9\u30BF\u30FC\u540D
-label.clusters=\u30AF\u30E9\u30B9\u30BF\u30FC
-label.cluster.type=\u30AF\u30E9\u30B9\u30BF\u30FC\u306E\u7A2E\u985E
-label.cluster=\u30AF\u30E9\u30B9\u30BF\u30FC
+label.CIDR.list=CIDR \u4e00\u89a7
+label.cidr.list=\u9001\u4fe1\u5143 CIDR
+label.CIDR.of.destination.network=\u5b9b\u5148\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e CIDR
+label.clean.up=\u30af\u30ea\u30fc\u30f3 \u30a2\u30c3\u30d7
+label.clear.list=\u4e00\u89a7\u306e\u6d88\u53bb
+label.close=\u9589\u3058\u308b
+label.cloud.console=\u30af\u30e9\u30a6\u30c9\u7ba1\u7406\u30b3\u30f3\u30bd\u30fc\u30eb
+label.cloud.managed=Cloud.com \u306b\u3088\u308b\u7ba1\u7406
+label.cluster.name=\u30af\u30e9\u30b9\u30bf\u30fc\u540d
+label.clusters=\u30af\u30e9\u30b9\u30bf\u30fc
+label.cluster.type=\u30af\u30e9\u30b9\u30bf\u30fc\u306e\u7a2e\u985e
+label.cluster=\u30af\u30e9\u30b9\u30bf\u30fc
 label.clvm=CLVM
-label.code=\u30B3\u30FC\u30C9
-label.community=\u30B3\u30DF\u30E5\u30CB\u30C6\u30A3
-label.compute.and.storage=\u30B3\u30F3\u30D4\u30E5\u30FC\u30C6\u30A3\u30F3\u30B0\u3068\u30B9\u30C8\u30EC\u30FC\u30B8
-label.compute.offerings=\u30B3\u30F3\u30D4\u30E5\u30FC\u30C6\u30A3\u30F3\u30B0 \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0
-label.compute.offering=\u30B3\u30F3\u30D4\u30E5\u30FC\u30C6\u30A3\u30F3\u30B0 \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0
-label.compute=\u30B3\u30F3\u30D4\u30E5\u30FC\u30C6\u30A3\u30F3\u30B0
-label.configuration=\u69CB\u6210
-label.configure.network.ACLs=\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF ACL \u306E\u69CB\u6210
-label.configure=\u69CB\u6210
-label.configure.vpc=VPC \u306E\u69CB\u6210
-label.confirmation=\u78BA\u8A8D
-label.confirm.password=\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u78BA\u8A8D\u5165\u529B
-label.congratulations=\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u306F\u3053\u308C\u3067\u5B8C\u4E86\u3067\u3059\u3002
-label.conserve.mode=\u7BC0\u7D04\u30E2\u30FC\u30C9
-label.console.proxy=\u30B3\u30F3\u30BD\u30FC\u30EB \u30D7\u30ED\u30AD\u30B7
-label.continue.basic.install=\u57FA\u672C\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3092\u7D9A\u884C\u3059\u308B
-label.continue=\u7D9A\u884C
-label.corrections.saved=\u63A5\u7D9A\u304C\u4FDD\u5B58\u3055\u308C\u307E\u3057\u305F
-label.cpu.allocated.for.VMs=VM \u306B\u5272\u308A\u5F53\u3066\u6E08\u307F\u306E CPU
-label.cpu.allocated=\u5272\u308A\u5F53\u3066\u6E08\u307F\u306E CPU
+label.code=\u30b3\u30fc\u30c9
+label.community=\u30b3\u30df\u30e5\u30cb\u30c6\u30a3
+label.compute.and.storage=\u30b3\u30f3\u30d4\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u3068\u30b9\u30c8\u30ec\u30fc\u30b8
+label.compute.offerings=\u30b3\u30f3\u30d4\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0 \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0
+label.compute.offering=\u30b3\u30f3\u30d4\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0 \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0
+label.compute=\u30b3\u30f3\u30d4\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0
+label.configuration=\u69cb\u6210
+label.configure.network.ACLs=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af ACL \u306e\u69cb\u6210
+label.configure=\u69cb\u6210
+label.configure.vpc=VPC \u306e\u69cb\u6210
+label.confirmation=\u78ba\u8a8d
+label.confirm.password=\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u78ba\u8a8d\u5165\u529b
+label.congratulations=\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u306f\u3053\u308c\u3067\u5b8c\u4e86\u3067\u3059\u3002
+label.conserve.mode=\u7bc0\u7d04\u30e2\u30fc\u30c9
+label.console.proxy=\u30b3\u30f3\u30bd\u30fc\u30eb \u30d7\u30ed\u30ad\u30b7
+label.continue.basic.install=\u57fa\u672c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u7d9a\u884c\u3059\u308b
+label.continue=\u7d9a\u884c
+label.corrections.saved=\u63a5\u7d9a\u304c\u4fdd\u5b58\u3055\u308c\u307e\u3057\u305f
+label.cpu.allocated.for.VMs=VM \u306b\u5272\u308a\u5f53\u3066\u6e08\u307f\u306e CPU
+label.cpu.allocated=\u5272\u308a\u5f53\u3066\u6e08\u307f\u306e CPU
 label.CPU.cap=CPU \u5236\u9650
 label.cpu=CPU
 label.cpu.mhz=CPU (MHz)
-label.cpu.utilized=CPU \u4F7F\u7528\u7387
-label.created.by.system=\u30B7\u30B9\u30C6\u30E0\u4F5C\u6210
-label.created=\u4F5C\u6210\u65E5\u6642
-label.create.project=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u4F5C\u6210
-label.create.template=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u4F5C\u6210
-label.create.VPN.connection=VPN \u63A5\u7D9A\u306E\u4F5C\u6210
-label.cross.zones=\u30AF\u30ED\u30B9 \u30BE\u30FC\u30F3
-label.custom.disk.size=\u30AB\u30B9\u30BF\u30E0 \u30C7\u30A3\u30B9\u30AF \u30B5\u30A4\u30BA
-label.daily=\u6BCE\u65E5
-label.data.disk.offering=\u30C7\u30FC\u30BF \u30C7\u30A3\u30B9\u30AF \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0
-label.date=\u65E5\u6642
-label.day.of.month=\u6BCE\u6708\u6307\u5B9A\u65E5
-label.day.of.week=\u6BCE\u9031\u6307\u5B9A\u65E5
-label.dead.peer.detection=\u505C\u6B62\u30D4\u30A2\u306E\u691C\u51FA
-label.decline.invitation=\u62DB\u5F85\u306E\u8F9E\u9000
-label.dedicated=\u5C02\u7528
-label.default=\u30C7\u30D5\u30A9\u30EB\u30C8
-label.default.use=\u30C7\u30D5\u30A9\u30EB\u30C8\u4F7F\u7528
-label.default.view=\u30C7\u30D5\u30A9\u30EB\u30C8 \u30D3\u30E5\u30FC
-label.delete.F5=F5 \u306E\u524A\u9664
-label.delete.gateway=\u30B2\u30FC\u30C8\u30A6\u30A7\u30A4\u306E\u524A\u9664
-label.delete.NetScaler=NetScaler \u306E\u524A\u9664
+label.cpu.utilized=CPU \u4f7f\u7528\u7387
+label.created.by.system=\u30b7\u30b9\u30c6\u30e0\u4f5c\u6210
+label.created=\u4f5c\u6210\u65e5\u6642
+label.create.project=\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210
+label.create.template=\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u4f5c\u6210
+label.create.VPN.connection=VPN \u63a5\u7d9a\u306e\u4f5c\u6210
+label.cross.zones=\u30af\u30ed\u30b9 \u30be\u30fc\u30f3
+label.custom.disk.size=\u30ab\u30b9\u30bf\u30e0 \u30c7\u30a3\u30b9\u30af \u30b5\u30a4\u30ba
+label.daily=\u6bce\u65e5
+label.data.disk.offering=\u30c7\u30fc\u30bf \u30c7\u30a3\u30b9\u30af \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0
+label.date=\u65e5\u6642
+label.day.of.month=\u6bce\u6708\u6307\u5b9a\u65e5
+label.day.of.week=\u6bce\u9031\u6307\u5b9a\u65e5
+label.dead.peer.detection=\u505c\u6b62\u30d4\u30a2\u306e\u691c\u51fa
+label.decline.invitation=\u62db\u5f85\u306e\u8f9e\u9000
+label.dedicated=\u5c02\u7528
+label.default=\u30c7\u30d5\u30a9\u30eb\u30c8
+label.default.use=\u30c7\u30d5\u30a9\u30eb\u30c8\u4f7f\u7528
+label.default.view=\u30c7\u30d5\u30a9\u30eb\u30c8 \u30d3\u30e5\u30fc
+label.delete.F5=F5 \u306e\u524a\u9664
+label.delete.gateway=\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4\u306e\u524a\u9664
+label.delete.NetScaler=NetScaler \u306e\u524a\u9664
 label.delete.NiciraNvp=NVP\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u524a\u9664
-label.delete.project=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u524A\u9664
-label.delete.SRX=SRX \u306E\u524A\u9664
-label.delete=\u524A\u9664
-label.delete.VPN.connection=VPN \u63A5\u7D9A\u306E\u524A\u9664
-label.delete.VPN.customer.gateway=VPN \u30AB\u30B9\u30BF\u30DE\u30FC \u30B2\u30FC\u30C8\u30A6\u30A7\u30A4\u306E\u524A\u9664
-label.delete.VPN.gateway=VPN \u30B2\u30FC\u30C8\u30A6\u30A7\u30A4\u306E\u524A\u9664
-label.delete.vpn.user=VPN \u30E6\u30FC\u30B6\u30FC\u306E\u524A\u9664
-label.deleting.failed=\u524A\u9664\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
-label.deleting.processing=\u524A\u9664\u3057\u3066\u3044\u307E\u3059...
-label.description=\u8AAC\u660E
-label.destination.physical.network.id=\u30D6\u30EA\u30C3\u30B8\u5148\u7269\u7406\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF ID
-label.destination.zone=\u30B3\u30D4\u30FC\u5148\u30BE\u30FC\u30F3
-label.destroy.router=\u30EB\u30FC\u30BF\u30FC\u306E\u7834\u68C4
+label.delete.project=\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u524a\u9664
+label.delete.SRX=SRX \u306e\u524a\u9664
+label.delete=\u524a\u9664
+label.delete.VPN.connection=VPN \u63a5\u7d9a\u306e\u524a\u9664
+label.delete.VPN.customer.gateway=VPN \u30ab\u30b9\u30bf\u30de\u30fc \u30b2\u30fc\u30c8\u30a6\u30a7\u30a4\u306e\u524a\u9664
+label.delete.VPN.gateway=VPN \u30b2\u30fc\u30c8\u30a6\u30a7\u30a4\u306e\u524a\u9664
+label.delete.vpn.user=VPN \u30e6\u30fc\u30b6\u30fc\u306e\u524a\u9664
+label.deleting.failed=\u524a\u9664\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f
+label.deleting.processing=\u524a\u9664\u3057\u3066\u3044\u307e\u3059...
+label.description=\u8aac\u660e
+label.destination.physical.network.id=\u30d6\u30ea\u30c3\u30b8\u5148\u7269\u7406\u30cd\u30c3\u30c8\u30ef\u30fc\u30af ID
+label.destination.zone=\u30b3\u30d4\u30fc\u5148\u30be\u30fc\u30f3
+label.destroy.router=\u30eb\u30fc\u30bf\u30fc\u306e\u7834\u68c4
 label.destroy=\u7834\u68c4
-label.detaching.disk=\u30C7\u30A3\u30B9\u30AF\u3092\u30C7\u30BF\u30C3\u30C1\u3057\u3066\u3044\u307E\u3059
-label.details=\u8A73\u7D30
-label.device.id=\u30C7\u30D0\u30A4\u30B9 ID
-label.devices=\u30C7\u30D0\u30A4\u30B9
+label.detaching.disk=\u30c7\u30a3\u30b9\u30af\u3092\u30c7\u30bf\u30c3\u30c1\u3057\u3066\u3044\u307e\u3059
+label.details=\u8a73\u7d30
+label.device.id=\u30c7\u30d0\u30a4\u30b9 ID
+label.devices=\u30c7\u30d0\u30a4\u30b9
 label.dhcp=DHCP
-label.DHCP.server.type=DHCP \u30B5\u30FC\u30D0\u30FC\u306E\u7A2E\u985E
-label.direct.ips=\u76F4\u63A5 IP \u30A2\u30C9\u30EC\u30B9
-label.disabled=\u7121\u52B9
-label.disable.provider=\u30D7\u30ED\u30D0\u30A4\u30C0\u30FC\u306E\u7121\u52B9\u5316
-label.disable.vpn=VPN \u306E\u7121\u52B9\u5316
-label.disabling.vpn.access=VPN \u30A2\u30AF\u30BB\u30B9\u3092\u7121\u52B9\u306B\u3057\u3066\u3044\u307E\u3059
-label.disk.allocated=\u5272\u308A\u5F53\u3066\u6E08\u307F\u306E\u30C7\u30A3\u30B9\u30AF
-label.disk.offering=\u30C7\u30A3\u30B9\u30AF \u30AA\u30D5\u30A1\u30EA\u30F3\u30B0
-label.disk.size.gb=\u30C7\u30A3\u30B9\u30AF \u30B5\u30A4\u30BA (GB \u5358\u4F4D)
-label.disk.size=\u30C7\u30A3\u30B9\u30AF \u30B5\u30A4\u30BA
-label.disk.total=\u30C7\u30A3\u30B9\u30AF\u5408\u8A08
-label.disk.volume=\u30C7\u30A3\u30B9\u30AF \u30DC\u30EA\u30E5\u30FC\u30E0
-label.display.name=\u8868\u793A\u540D
-label.display.text=\u8868\u793A\u30C6\u30AD\u30B9\u30C8
+label.DHCP.server.type=DHCP \u30b5\u30fc\u30d0\u30fc\u306e\u7a2e\u985e
+label.direct.ips=\u76f4\u63a5 IP \u30a2\u30c9\u30ec\u30b9
+label.disabled=\u7121\u52b9
+label.disable.provider=\u30d7\u30ed\u30d0\u30a4\u30c0\u30fc\u306e\u7121\u52b9\u5316
+label.disable.vpn=VPN \u306e\u7121\u52b9\u5316
+label.disabling.vpn.access=VPN \u30a2\u30af\u30bb\u30b9\u3092\u7121\u52b9\u306b\u3057\u3066\u3044\u307e\u3059
+label.disk.allocated=\u5272\u308a\u5f53\u3066\u6e08\u307f\u306e\u30c7\u30a3\u30b9\u30af
+label.disk.offering=\u30c7\u30a3\u30b9\u30af \u30aa\u30d5\u30a1\u30ea\u30f3\u30b0
+label.disk.size.gb=\u30c7\u30a3\u30b9\u30af \u30b5\u30a4\u30ba (GB \u5358\u4f4d)
+label.disk.size=\u30c7\u30a3\u30b9\u30af \u30b5\u30a4\u30ba
+label.disk.total=\u30c7\u30a3\u30b9\u30af\u5408\u8a08
+label.disk.volume=\u30c7\u30a3\u30b9\u30af \u30dc\u30ea\u30e5\u30fc\u30e0
+label.display.name=\u8868\u793a\u540d
+label.display.text=\u8868\u793a\u30c6\u30ad\u30b9\u30c8
 label.dns.1=DNS 1
 label.dns.2=DNS 2
 label.dns=DNS
-label.DNS.domain.for.guest.networks=\u30B2\u30B9\u30C8 \u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u306E DNS \u30C9\u30E1\u30A4\u30F3
-label.domain.admin=\u30C9\u30E1\u30A4\u30F3\u7BA1\u7406\u8005
-label.domain.id=\u30C9\u30E1\u30A4\u30F3 ID
-label.domain.name=\u30C9\u30E1\u30A4\u30F3\u540D
-label.domain.router=\u30C9\u30E1\u30A4\u30F3 \u30EB\u30FC\u30BF\u30FC
-label.domain.suffix=DNS \u30C9\u30E1\u30A4\u30F3 \u30B5\u30D5\u30A3\u30C3\u30AF\u30B9 (\u4F8B\: xyz.com)
-label.domain=\u30C9\u30E1\u30A4\u30F3
-label.done=\u5B8C\u4E86
-label.double.quotes.are.not.allowed=\u4E8C\u91CD\u5F15\u7528\u7B26\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093
-label.download.progress=\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u306E\u9032\u6357\u72B6\u6CC1
-label.drag.new.position=\u65B0\u3057\u3044\u4F4D\u7F6E\u306B\u30C9\u30E9\u30C3\u30B0
-label.edit.lb.rule=\u8CA0\u8377\u5206\u6563\u898F\u5247\u306E\u7DE8\u96C6
-label.edit.network.details=\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u306E\u8A73\u7D30\u306E\u7DE8\u96C6
-label.edit.project.details=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u8A73\u7D30\u306E\u7DE8\u96C6
-label.edit.tags=\u30BF\u30B0\u306E\u7DE8\u96C6
-label.edit.traffic.type=\u30C8\u30E9\u30D5\u30A3\u30C3\u30AF\u306E\u7A2E\u985E\u306E\u7DE8\u96C6
-label.edit=\u7DE8\u96C6
-label.edit.vpc=VPC \u306E\u7DE8\u96C6
+label.DNS.domain.for.guest.networks=\u30b2\u30b9\u30c8 \u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e DNS \u30c9\u30e1\u30a4\u30f3
+label.domain.admin=\u30c9\u30e1\u30a4\u30f3\u7ba1\u7406\u8005
+label.domain.id=\u30c9\u30e1\u30a4\u30f3 ID
+label.domain.name=\u30c9\u30e1\u30a4\u30f3\u540d
+label.domain.router=\u30c9\u30e1\u30a4\u30f3 \u30eb\u30fc\u30bf\u30fc
+label.domain.suffix=DNS \u30c9\u30e1\u30a4\u30f3 \u30b5\u30d5\u30a3\u30c3\u30af\u30b9 (\u4f8b\: xyz.com)
+label.domain=\u30c9\u30e1\u30a4\u30f3
+label.done=\u5b8c\u4e86
+label.double.quotes.are.not.allowed=\u4e8c\u91cd\u5f15\u7528\u7b26\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093
+label.download.progress=\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306e\u9032\u6357\u72b6\u6cc1
+label.drag.new.position=\u65b0\u3057\u3044\u4f4d\u7f6e\u306b\u30c9\u30e9\u30c3\u30b0
+label.edit.lb.rule=\u8ca0\u8377\u5206\u6563\u898f\u5247\u306e\u7de8\u96c6
+label.edit.network.details=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u8a73\u7d30\u306e\u7de8\u96c6
+label.edit.project.details=\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u8a73\u7d30\u306e\u7de8\u96c6
+label.edit.tags=\u30bf\u30b0\u306e\u7de8\u96c6
+label.edit.traffic.type=\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u306e\u7a2e\u985e\u306e\u7de8\u96c6
+label.edit=\u7de8\u96c6
+label.edit.vpc=VPC \u306e\u7de8\u96c6
 label.egress.rules=\u9001\u4fe1\u30eb\u30fc\u30eb
-label.egress.rule=\u9001\u4FE1\u898F\u5247
-label.elastic.IP=\u30A8\u30E9\u30B9\u30C6\u30A3\u30C3\u30AF IP \u30A2\u30C9\u30EC\u30B9
-label.elastic.LB=\u30A8\u30E9\u30B9\u30C6\u30A3\u30C3\u30AF\u8CA0\u8377\u5206\u6563
-label.elastic=\u30A8\u30E9\u30B9\u30C6\u30A3\u30C3\u30AF
-label.email=\u96FB\u5B50\u30E1\u30FC\u30EB
-label.enable.provider=\u30D7\u30ED\u30D0\u30A4\u30C0\u30FC\u306E\u6709\u52B9\u5316
+label.egress.rule=\u9001\u4fe1\u898f\u5247
+label.elastic.IP=\u30a8\u30e9\u30b9\u30c6\u30a3\u30c3\u30af IP \u30a2\u30c9\u30ec\u30b9
+label.elastic.LB=\u30a8\u30e9\u30b9\u30c6\u30a3\u30c3\u30af\u8ca0\u8377\u5206\u6563
+label.elastic=\u30a8\u30e9\u30b9\u30c6\u30a3\u30c3\u30af
+label.email=\u96fb\u5b50\u30e1\u30fc\u30eb
+label.enable.provider=\u30d7\u30ed\u30d0\u30a4\u30c0\u30fc\u306e\u6709\u52b9\u5316
 label.enable.s3=S3\u57fa\u76e4\u30bb\u30ab\u30f3\u30c0\u30ea\u30b9\u30c8\u30ec\u30fc\u30b8\u306e\u6709\u52b9\u5316
-label.enable.swift=Swift \u306E\u6709\u52B9\u5316
-label.enable.vpn=VPN \u306E\u6709\u52B9\u5316
-label.enabling.vpn.access=VPN \u30A2\u30AF\u30BB\u30B9\u3092\u6709\u52B9\u306B\u3057\u3066\u3044\u307E\u3059
-label.enabling.vpn=VPN \u3092\u6709\u52B9\u306B\u3057\u3066\u3044\u307E\u3059
-label.end.IP=\u7D42\u4E86 IP \u30A2\u30C9\u30EC\u30B9
-label.endpoint.or.operation=\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u307E\u305F\u306F\u64CD\u4F5C
+label.enable.swift=Swift \u306e\u6709\u52b9\u5316
+label.enable.vpn=VPN \u306e\u6709\u52b9\u5316
+label.enabling.vpn.access=VPN \u30a2\u30af\u30bb\u30b9\u3092\u6709\u52b9\u306b\u3057\u3066\u3044\u307e\u3059
+label.enabling.vpn=VPN \u3092\u6709\u52b9\u306b\u3057\u3066\u3044\u307e\u3059
+label.end.IP=\u7d42\u4e86 IP \u30a2\u30c9\u30ec\u30b9
+label.endpoint.or.operation=\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u307e\u305f\u306f\u64cd\u4f5c
 label.endpoint=\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8
-label.end.port=\u7D42\u4E86\u30DD\u30FC\u30C8
-label.end.reserved.system.IP=\u4E88\u7D04\u6E08\u307F\u7D42\u4E86\u30B7\u30B9\u30C6\u30E0 IP \u30A2\u30C9\u30EC\u30B9
-label.end.vlan=\u7D42\u4E86 VLAN
-label.enter.token=\u30C8\u30FC\u30AF\u30F3\u306E\u5165\u529B
-label.error.code=\u30A8\u30E9\u30FC \u30B3\u30FC\u30C9
-label.error=\u30A8\u30E9\u30FC
-label.ESP.encryption=ESP \u6697\u53F7\u5316
-label.ESP.hash=ESP \u30CF\u30C3\u30B7\u30E5
-label.ESP.policy=ESP \u30DD\u30EA\u30B7\u30FC
-label.esx.host=ESX/ESXi \u30DB\u30B9\u30C8
-label.example=\u4F8B
+label.end.port=\u7d42\u4e86\u30dd\u30fc\u30c8
+label.end.reserved.system.IP=\u4e88\u7d04\u6e08\u307f\u7d42\u4e86\u30b7\u30b9\u30c6\u30e0 IP \u30a2\u30c9\u30ec\u30b9
+label.end.vlan=\u7d42\u4e86 VLAN
+label.enter.token=\u30c8\u30fc\u30af\u30f3\u306e\u5165\u529b
+label.error.code=\u30a8\u30e9\u30fc \u30b3\u30fc\u30c9
+label.error=\u30a8\u30e9\u30fc
+label.ESP.encryption=ESP \u6697\u53f7\u5316
+label.ESP.hash=ESP \u30cf\u30c3\u30b7\u30e5
+label.ESP.policy=ESP \u30dd\u30ea\u30b7\u30fc
+label.esx.host=ESX/ESXi \u30db\u30b9\u30c8
+label.example=\u4f8b
 label.f5=F5
 label.failed=\u5931\u6557
-label.featured=\u304A\u3059\u3059\u3081
-label.fetch.latest=\u6700\u65B0\u60C5\u5831\u306E\u53D6\u5F97
-label.filterBy=\u30D5\u30A3\u30EB\u30BF\u30FC
-label.firewall=\u30D5\u30A1\u30A4\u30A2\u30A6\u30A9\u30FC\u30EB
-label.first.name=\u540D
-label.format=\u5F62\u5F0F
-label.friday=\u91D1\u66DC\u65E5
-label.full.path=\u30D5\u30EB \u30D1\u30B9
-label.full=\u5B8C\u5168
-label.gateway=\u30B2\u30FC\u30C8\u30A6\u30A7\u30A4
-label.general.alerts=\u4E00\u822C\u30A2\u30E9\u30FC\u30C8
-label.generating.url=URL \u3092\u751F\u6210\u3057\u3066\u3044\u307E\u3059
-label.go.step.2=\u624B\u9806 2 \u306B\u9032\u3080
-label.go.step.3=\u624B\u9806 3 \u306B\u9032\u3080
-label.go.step.4=\u624B\u9806 4 \u306B\u9032\u3080
-label.go.step.5=\u624B\u9806 5 \u306B\u9032\u3080
-label.group.optional=\u30B0\u30EB\u30FC\u30D7 (\u30AA\u30D7\u30B7\u30E7\u30F3)
-label.group=\u30B0\u30EB\u30FC\u30D7
-label.guest.cidr=\u30B2\u30B9\u30C8 CIDR
-label.guest.end.ip=\u30B2\u30B9\u30C8\u306E\u7D42\u4E86 IP \u30A2\u30C9\u30EC\u30B9
-label.guest.gateway=\u30B2\u30B9\u30C8 \u30B2\u30FC\u30C8\u30A6\u30A7\u30A4
-label.guest.ip.range=\u30B2\u30B9\u30C8 IP \u30A2\u30C9\u30EC\u30B9\u306E\u7BC4\u56F2
-label.guest.ip=\u30B2\u30B9\u30C8 IP \u30A2\u30C9\u30EC\u30B9
-label.guest.netmask=\u30B2\u30B9\u30C8 \u30CD\u30C3\u30C8\u30DE\u30B9\u30AF
-label.guest.networks=\u30B2\u30B9\u30C8 \u30CD\u30C3\u30C8\u30EF\u30FC\u30AF
-label.guest.start.ip=\u30B2\u30B9\u30C8\u306E\u958B\u59CB IP \u30A2\u30C9\u30EC\u30B9
-label.guest.traffic=\u30B2\u30B9\u30C8 \u30C8\u30E9\u30D5\u30A3\u30C3\u30AF
-label.guest.type=\u30B2\u30B9\u30C8\u306E\u7A2E\u985E
-label.guest=\u30B2\u30B9\u30C8
-label.ha.enabled=\u9AD8\u53EF\u7528\u6027\u6709\u52B9
-label.help=\u30D8\u30EB\u30D7
-label.hide.ingress.rule=\u53D7\u4FE1\u898F\u5247\u3092\u96A0\u3059
-label.hints=\u30D2\u30F3\u30C8
-label.host.alerts=\u30DB\u30B9\u30C8 \u30A2\u30E9\u30FC\u30C8
-label.host.MAC=\u30DB\u30B9\u30C8\u306E MAC
-label.host.name=\u30DB\u30B9\u30C8\u540D
-label.hosts=\u30DB\u30B9\u30C8
+label.featured=\u304a\u3059\u3059\u3081
+label.fetch.latest=\u6700\u65b0\u60c5\u5831\u306e\u53d6\u5f97
+label.filterBy=\u30d5\u30a3\u30eb\u30bf\u30fc
+label.firewall=\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb
+label.first.name=\u540d
+label.format=\u5f62\u5f0f
+label.friday=\u91d1\u66dc\u65e5
+label.full.path=\u30d5\u30eb \u30d1\u30b9
+label.full=\u5b8c\u5168
+label.gateway=\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4
+label.general.alerts=\u4e00\u822c\u30a2\u30e9\u30fc\u30c8
+label.generating.url=URL \u3092\u751f\u6210\u3057\u3066\u3044\u307e\u3059
+label.go.step.2=\u624b\u9806 2 \u306b\u9032\u3080
+label.go.step.3=\u624b\u9806 3 \u306b\u9032\u3080
+label.go.step.4=\u624b\u9806 4 \u306b\u9032\u3080
+label.go.step.5=\u624b\u9806 5 \u306b\u9032\u3080
+label.group.optional=\u30b0\u30eb\u30fc\u30d7 (\u30aa\u30d7\u30b7\u30e7\u30f3)
+label.group=\u30b0\u30eb\u30fc\u30d7
+label.guest.cidr=\u30b2\u30b9\u30c8 CIDR
+label.guest.end.ip=\u30b2\u30b9\u30c8\u306e\u7d42\u4e86 IP \u30a2\u30c9\u30ec\u30b9
+label.guest.gateway=\u30b2\u30b9\u30c8 \u30b2\u30fc\u30c8\u30a6\u30a7\u30a4
+label.guest.ip.range=\u30b2\u30b9\u30c8 IP \u30a2\u30c9\u30ec\u30b9\u306e\u7bc4\u56f2
+label.guest.ip=\u30b2\u30b9\u30c8 IP \u30a2\u30c9\u30ec\u30b9
+label.guest.netmask=\u30b2\u30b9\u30c8 \u30cd\u30c3\u30c8\u30de\u30b9\u30af
+label.guest.networks=\u30b2\u30b9\u30c8 \u30cd\u30c3\u30c8\u30ef\u30fc\u30af
+label.guest.start.ip=\u30b2\u30b9\u30c8\u306e\u958b\u59cb IP \u30a2\u30c9\u30ec\u30b9
+label.guest.traffic=\u30b2\u30b9\u30c8 \u30c8\u30e9\u30d5\u30a3\u30c3\u30af
+label.guest.type=\u30b2\u30b9\u30c8\u306e\u7a2e\u985e
+label.guest=\u30b2\u30b9\u30c8
+label.ha.enabled=\u9ad8\u53ef\u7528\u6027\u6709\u52b9
+label.help=\u30d8\u30eb\u30d7
+label.hide.ingress.rule=\u53d7\u4fe1\u898f\u5247\u3092\u96a0\u3059
+label.hints=\u30d2\u30f3\u30c8
+label.host.alerts=\u30db\u30b9\u30c8 \u30a2\u30e9\u30fc\u30c8
+label.host.MAC=\u30db\u30b9\u30c8\u306e MAC
+label.host.name=\u30db\u30b9\u30c8\u540d
+label.hosts=\u30db\u30b9\u30c8
 label.host.tags=\u00e3\u0083\u009b\u00e3\u0082\u00b9\u00e3\u0083\u0088\u00e3\u0082\u00bf\u00e3\u0082\u00b0
-label.host=\u30DB\u30B9\u30C8
-label.hourly=\u6BCE\u6642
-label.hypervisor.capabilities=\u30CF\u30A4\u30D1\u30FC\u30D0\u30A4\u30B6\u30FC\u306E\u6A5F\u80FD
-label.hypervisor.type=\u30CF\u30A4\u30D1\u30FC\u30D0\u30A4\u30B6\u30FC\u306E\u7A2E\u985E
-label.hypervisor=\u30CF\u30A4\u30D1\u30FC\u30D0\u30A4\u30B6\u30FC
-label.hypervisor.version=\u30CF\u30A4\u30D1\u30FC\u30D0\u30A4\u30B6\u30FC\u306E\u30D0\u30FC\u30B8\u30E7\u30F3
+label.host=\u30db\u30b9\u30c8
+label.hourly=\u6bce\u6642
+label.hypervisor.capabilities=\u30cf\u30a4\u30d1\u30fc\u30d0\u30a4\u30b6\u30fc\u306e\u6a5f\u80fd
+label.hypervisor.type=\u30cf\u30a4\u30d1\u30fc\u30d0\u30a4\u30b6\u30fc\u306e\u7a2e\u985e
+label.hypervisor=\u30cf\u30a4\u30d1\u30fc\u30d0\u30a4\u30b6\u30fc
+label.hypervisor.version=\u30cf\u30a4\u30d1\u30fc\u30d0\u30a4\u30b6\u30fc\u306e\u30d0\u30fc\u30b8\u30e7\u30f3
 label.id=ID
 label.IKE.DH=IKE DH
-label.IKE.encryption=IKE \u6697\u53F7\u5316
-label.IKE.hash=IKE \u30CF\u30C3\u30B7\u30E5
-label.IKE.policy=IKE \u30DD\u30EA\u30B7\u30FC
-label.info=\u60C5\u5831
-label.ingress.rule=\u53D7\u4FE1\u898F\u5247
-label.initiated.by=\u958B\u59CB\u30E6\u30FC\u30B6\u30FC
-label.installWizard.addClusterIntro.subtitle=\u30AF\u30E9\u30B9\u30BF\u30FC\u306B\u3064\u3044\u3066
-label.installWizard.addClusterIntro.title=\u30AF\u30E9\u30B9\u30BF\u30FC\u3092\u8FFD\u52A0\u3057\u307E\u3057\u3087\u3046
-label.installWizard.addHostIntro.subtitle=\u30DB\u30B9\u30C8\u306B\u3064\u3044\u3066
-label.installWizard.addHostIntro.title=\u30DB\u30B9\u30C8\u3092\u8FFD\u52A0\u3057\u307E\u3057\u3087\u3046
-label.installWizard.addPodIntro.subtitle=\u30DD\u30C3\u30C9\u306B\u3064\u3044\u3066
-label.installWizard.addPodIntro.title=\u30DD\u30C3\u30C9\u3092\u8FFD\u52A0\u3057\u307E\u3057\u3087\u3046
-label.installWizard.addPrimaryStorageIntro.subtitle=\u30D7\u30E9\u30A4\u30DE\u30EA \u30B9\u30C8\u30EC\u30FC\u30B8\u306B\u3064\u3044\u3066
-label.installWizard.addPrimaryStorageIntro.title=\u30D7\u30E9\u30A4\u30DE\u30EA \u30B9\u30C8\u30EC\u30FC\u30B8\u3092\u8FFD\u52A0\u3057\u307E\u3057\u3087\u3046
+label.IKE.encryption=IKE \u6697\u53f7\u5316
+label.IKE.hash=IKE \u30cf\u30c3\u30b7\u30e5
+label.IKE.policy=IKE \u30dd\u30ea\u30b7\u30fc
+label.info=\u60c5\u5831
+label.ingress.rule=\u53d7\u4fe1\u898f\u5247
+label.initiated.by=\u958b\u59cb\u30e6\u30fc\u30b6\u30fc
+label.installWizard.addClusterIntro.subtitle=\u30af\u30e9\u30b9\u30bf\u30fc\u306b\u3064\u3044\u3066
+label.installWizard.addClusterIntro.title=\u30af\u30e9\u30b9\u30bf\u30fc\u3092\u8ffd\u52a0\u3057\u307e\u3057\u3087\u3046
+label.installWizard.addHostIntro.subtitle=\u30db\u30b9\u30c8\u306b\u3064\u3044\u3066
+label.installWizard.addHostIntro.title=\u30db\u30b9\u30c8\u3092\u8ffd\u52a0\u3057\u307e\u3057\u3087\u3046
+label.installWizard.addPodIntro.subtitle=\u30dd\u30c3\u30c9\u306b\u3064\u3044\u3066
+label.installWizard.addPodIntro.title=\u30dd\u30c3\u30c9\u3092\u8ffd\u52a0\u3057\u307e\u3057\u3087\u3046
+label.installWizard.addPrimaryStorageIntro.subtitle=\u30d7\u30e9\u30a4\u30de\u30ea \u30b9\u30c8\u30ec\u30fc\u30b8\u306b\u3064\u3044\u3066
+label.installWizard.addPrimaryStorageIntro.title=\u30d7\u30e9\u30a4\u30de\u30ea \u30b9\u30c8\u30ec\u30fc\u30b8\u3092\u8ffd\u52a0\u3057\u307e\u3057\u3087\u3046
 label.installWizard.addSecondaryStorageIntro.subtitle=\u30bb\u30ab\u30f3\u30c0\u30ea\u30fc\u30b9\u30c8\u30ec\u30fc\u30b8\u3068\u306f\uff1f
-label.installWizard.addSecondaryStorageIntro.title=\u30BB\u30AB\u30F3\u30C0\u30EA \u30B9\u30C8\u30EC\u30FC\u30B8\u3092\u8FFD\u52A0\u3057\u307E\u3057\u3087\u3046
-label.installWizard.addZoneIntro.subtitle=\u30BE\u30FC\u30F3\u306B\u3064\u3044\u3066
-label.installWizard.addZoneIntro.title=\u30BE\u30FC\u30F3\u3092\u8FFD\u52A0\u3057\u307E\u3057\u3087\u3046
-label.installWizard.addZone.title=\u30BE\u30FC\u30F3\u306E\u8FFD\u52A0
-label.installWizard.click.launch=[\u8D77\u52D5] \u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-label.installWizard.subtitle=\u3053\u306E\u30AC\u30A4\u30C9 \u30C4\u30A2\u30FC\u306F CloudStack&\#8482; \u74B0\u5883\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u306B\u5F79\u7ACB\u3061\u307E\u3059
-label.installWizard.title=CloudStack&\#8482; \u3078\u3088\u3046\u3053\u305D
-label.instance.limits=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u5236\u9650
-label.instance.name=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u540D
-label.instances=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9
-label.instance=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9
-label.internal.dns.1=\u5185\u90E8 DNS 1
-label.internal.dns.2=\u5185\u90E8 DNS 2
-label.internal.name=\u5185\u90E8\u540D
-label.interval.type=\u9593\u9694\u306E\u7A2E\u985E
-label.introduction.to.cloudstack=CloudStack&\#8482; \u306E\u7D39\u4ECB
-label.invalid.integer=\u7121\u52B9\u306A\u6574\u6570
-label.invalid.number=\u7121\u52B9\u306A\u6570
-label.invitations=\u62DB\u5F85\u72B6
-label.invited.accounts=\u62DB\u5F85\u6E08\u307F\u30A2\u30AB\u30A6\u30F3\u30C8
-label.invite.to=\u62DB\u5F85\u3059\u308B\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\:
-label.invite=\u62DB\u5F85
-label.ip.address=IP \u30A2\u30C9\u30EC\u30B9
-label.ipaddress=IP \u30A2\u30C9\u30EC\u30B9
-label.ip.allocations=IP \u30A2\u30C9\u30EC\u30B9\u306E\u5272\u308A\u5F53\u3066
+label.installWizard.addSecondaryStorageIntro.title=\u30bb\u30ab\u30f3\u30c0\u30ea \u30b9\u30c8\u30ec\u30fc\u30b8\u3092\u8ffd\u52a0\u3057\u307e\u3057\u3087\u3046
+label.installWizard.addZoneIntro.subtitle=\u30be\u30fc\u30f3\u306b\u3064\u3044\u3066
+label.installWizard.addZoneIntro.title=\u30be\u30fc\u30f3\u3092\u8ffd\u52a0\u3057\u307e\u3057\u3087\u3046
+label.installWizard.addZone.title=\u30be\u30fc\u30f3\u306e\u8ffd\u52a0
+label.installWizard.click.launch=[\u8d77\u52d5] \u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002
+label.installWizard.subtitle=\u3053\u306e\u30ac\u30a4\u30c9 \u30c4\u30a2\u30fc\u306f CloudStack&\#8482; \u74b0\u5883\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u306b\u5f79\u7acb\u3061\u307e\u3059
+label.inst

<TRUNCATED>

[06/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/security/dao/VmRulesetLogDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/dao/VmRulesetLogDaoImpl.java b/engine/schema/src/com/cloud/network/security/dao/VmRulesetLogDaoImpl.java
new file mode 100644
index 0000000..746b66f
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/security/dao/VmRulesetLogDaoImpl.java
@@ -0,0 +1,200 @@
+// 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.network.security.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.SQLTransactionRollbackException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.security.VmRulesetLogVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value={VmRulesetLogDao.class})
+public class VmRulesetLogDaoImpl extends GenericDaoBase<VmRulesetLogVO, Long> implements VmRulesetLogDao {
+    protected static Logger s_logger = Logger.getLogger(VmRulesetLogDaoImpl.class);
+    private SearchBuilder<VmRulesetLogVO> VmIdSearch;
+    private String INSERT_OR_UPDATE = "INSERT INTO op_vm_ruleset_log (instance_id, created, logsequence) " +
+    		" VALUES(?, now(), 1) ON DUPLICATE KEY UPDATE logsequence=logsequence+1";
+    private static HashMap<Integer, String> cachedPrepStmtStrings = new  HashMap<Integer, String>();
+    final static private int cacheStringSizes [] = {512, 256, 128, 64, 32, 16, 8, 4, 2, 1};
+
+    static {
+        //prepare the cache.
+        for (int size: cacheStringSizes) {
+            cachedPrepStmtStrings.put(size, createPrepStatementString(size));
+        }
+    }
+
+    
+    private static String createPrepStatementString(int numItems) {
+        StringBuilder builder = new StringBuilder("INSERT INTO op_vm_ruleset_log (instance_id, created, logsequence) VALUES ");
+        for (int i=0; i < numItems-1; i++) {
+            builder.append("(?, now(), 1), ");
+        }
+        builder.append("(?, now(), 1) ");
+        builder.append(" ON DUPLICATE KEY UPDATE logsequence=logsequence+1");
+        return builder.toString();
+    }
+
+    protected VmRulesetLogDaoImpl() {
+        VmIdSearch = createSearchBuilder();
+        VmIdSearch.and("vmId", VmIdSearch.entity().getInstanceId(), SearchCriteria.Op.EQ);
+
+        VmIdSearch.done();    
+
+    }
+
+    @Override
+    public VmRulesetLogVO findByVmId(long vmId) {
+        SearchCriteria<VmRulesetLogVO> sc = VmIdSearch.create();
+        sc.setParameters("vmId", vmId);
+        return findOneIncludingRemovedBy(sc);
+    }
+
+    @Override
+    public int createOrUpdate(Set<Long> workItems) {
+        //return createOrUpdateUsingBatch(workItems);
+        return createOrUpdateUsingMultiInsert(workItems);
+    }
+    
+    private int executeWithRetryOnDeadlock(Transaction txn, String pstmt,  List<Long> vmIds) throws SQLException {
+
+        int numUpdated = 0;
+        final int maxTries = 3;
+        for (int i=0; i < maxTries; i++) {
+            try {
+                PreparedStatement stmtInsert = txn.prepareAutoCloseStatement(pstmt);
+                int argIndex = 1;
+                for (Long vmId: vmIds) {
+                    stmtInsert.setLong(argIndex++, vmId);
+                }
+                numUpdated = stmtInsert.executeUpdate();
+                i = maxTries;
+            } catch (SQLTransactionRollbackException e1) {
+                if (i < maxTries-1) {
+                    int delayMs =  (i+1)*1000;
+                    s_logger.debug("Caught a deadlock exception while inserting security group rule log, retrying in " + delayMs);
+                    try {
+                        Thread.sleep(delayMs);
+                    } catch(InterruptedException ie) {
+                        
+                    }
+                }
+                else 
+                    s_logger.warn("Caught another deadlock exception while retrying inserting security group rule log, giving up");
+
+            }
+        }
+        if (s_logger.isTraceEnabled()) {
+            s_logger.trace("Inserted or updated " + numUpdated + " rows");
+        }
+        return numUpdated;
+    }
+    
+    protected int createOrUpdateUsingMultiInsert(Set<Long> workItems) {
+        Transaction txn = Transaction.currentTxn();
+
+        int size = workItems.size();
+        int count = 0;
+        Iterator<Long> workIter = workItems.iterator();
+        int remaining = size;
+        try {
+            for (int stmtSize : cacheStringSizes) {
+                int numStmts = remaining / stmtSize;
+                if (numStmts > 0) {
+                    String pstmt = cachedPrepStmtStrings.get(stmtSize);
+                    for (int i=0; i < numStmts; i++) {
+                        List<Long> vmIds = new ArrayList<Long>();
+                        for (int argIndex=1; argIndex <= stmtSize; argIndex++) {
+                            Long vmId = workIter.next();
+                            vmIds.add(vmId);
+                        }
+                        int numUpdated = executeWithRetryOnDeadlock(txn, pstmt, vmIds);
+                        if (s_logger.isTraceEnabled()) {
+                            s_logger.trace("Inserted or updated " + numUpdated + " rows");
+                        }
+                        if (numUpdated > 0)
+                            count += stmtSize;
+                    }
+                    remaining = remaining - numStmts * stmtSize;
+                }
+
+            }
+        } catch (SQLException sqe) {
+            s_logger.warn("Failed to execute multi insert ", sqe);
+        }
+        
+        return count;
+    }
+    
+    protected int createOrUpdateUsingBatch(Set<Long> workItems) {
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement stmtInsert = null;
+        int [] queryResult = null;
+        int count=0;
+        boolean success = true;
+        try {
+            stmtInsert = txn.prepareAutoCloseStatement(INSERT_OR_UPDATE);
+            
+            txn.start();
+            for (Long vmId: workItems) {
+                stmtInsert.setLong(1, vmId);
+                stmtInsert.addBatch();
+                count++;
+                if (count % 16 ==0) {
+                    queryResult = stmtInsert.executeBatch();
+                    stmtInsert.clearBatch();
+                }
+            }
+            queryResult = stmtInsert.executeBatch();
+            
+            txn.commit();
+            if (s_logger.isTraceEnabled())
+                s_logger.trace("Updated or inserted " + workItems.size() + " log items");
+        } catch (SQLException e) {
+            s_logger.warn("Failed to execute batch update statement for ruleset log: ", e);
+            txn.rollback();
+            success = false;
+        }
+        if (!success && queryResult != null) {
+            Long [] arrayItems = new Long[workItems.size()];
+            workItems.toArray(arrayItems);
+            for (int i=0; i < queryResult.length; i++) {
+                if (queryResult[i] < 0 ) {
+                    s_logger.debug("Batch query update failed for vm " + arrayItems[i]);
+                }
+            }
+        } 
+        return count;
+    }
+
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/PrivateIpVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/PrivateIpVO.java b/engine/schema/src/com/cloud/network/vpc/PrivateIpVO.java
new file mode 100644
index 0000000..952a0c2
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/PrivateIpVO.java
@@ -0,0 +1,103 @@
+// 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.network.vpc;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+
+@Entity
+@Table(name="private_ip_address")
+public class PrivateIpVO implements InternalIdentity {
+    
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+    
+    @Column(name="ip_address", updatable=false, nullable=false)
+    String ipAddress;
+    
+    @Column(name="mac_address")
+    private long macAddress;
+    
+    @Column(name="taken")
+    @Temporal(value=TemporalType.TIMESTAMP)
+    private Date takenAt;
+    
+    @Column(name="network_id", updatable=false, nullable=false)
+    private long networkId;
+    
+    @Column(name="vpc_id")
+    private Long vpcId;
+
+    @Column(name="source_nat")
+    private boolean sourceNat;
+    
+    public PrivateIpVO() {
+    }
+
+    public PrivateIpVO(String ipAddress, long networkId, long macAddress, long vpcId, boolean sourceNat) {
+        this.ipAddress = ipAddress;
+        this.networkId = networkId;
+        this.macAddress = macAddress;
+        this.vpcId = vpcId;
+        this.sourceNat = sourceNat;
+    }
+    
+    public void setTakenAt(Date takenDate) {
+        this.takenAt = takenDate;
+    }
+    
+    public String getIpAddress() {
+        return ipAddress;
+    }
+   
+    public long getNetworkId() {
+        return networkId;
+    }
+
+    public Date getTakenAt() {
+        return takenAt;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getMacAddress() {
+        return macAddress;
+    }
+    
+    public Long getVpcId() {
+        return vpcId;
+    }
+    public boolean getSourceNat() {
+        return sourceNat;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/StaticRouteVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/StaticRouteVO.java b/engine/schema/src/com/cloud/network/vpc/StaticRouteVO.java
new file mode 100644
index 0000000..eb4c61b
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/StaticRouteVO.java
@@ -0,0 +1,141 @@
+// 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.network.vpc;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+
+@Entity
+@Table(name="static_routes")
+public class StaticRouteVO implements StaticRoute {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+
+    @Column(name="uuid")
+    String uuid;
+
+    @Column(name="vpc_gateway_id", updatable=false)
+    long vpcGatewayId;
+
+    @Column(name="cidr")
+    private String cidr;
+
+    @Enumerated(value=EnumType.STRING)
+    @Column(name="state")
+    State state;
+
+    @Column(name="vpc_id")
+    private Long vpcId;
+
+    @Column(name = "account_id")
+    long accountId;
+
+    @Column(name = "domain_id")
+    long domainId;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    Date created;
+
+    protected StaticRouteVO(){
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    /**
+     * @param vpcGatewayId
+     * @param cidr
+     * @param vpcId
+     * @param accountId TODO
+     * @param domainId TODO
+     */
+    public StaticRouteVO(long vpcGatewayId, String cidr, Long vpcId, long accountId, long domainId) {
+        super();
+        this.vpcGatewayId = vpcGatewayId;
+        this.cidr = cidr;
+        this.state = State.Staged;
+        this.vpcId = vpcId;
+        this.accountId = accountId;
+        this.domainId = domainId;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    @Override
+    public long getVpcGatewayId() {
+        return vpcGatewayId;
+    }
+
+    @Override
+    public String getCidr() {
+        return cidr;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    @Override
+    public Long getVpcId() {
+        return vpcId;
+    }
+
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    public void setState(State state) {
+        this.state = state;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder buf = new StringBuilder("StaticRoute[");
+        buf.append(uuid).append("|").append(cidr).append("|").append(vpcGatewayId).append("]");
+        return buf.toString();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/VpcGatewayVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/VpcGatewayVO.java b/engine/schema/src/com/cloud/network/vpc/VpcGatewayVO.java
new file mode 100644
index 0000000..e8dcb46
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/VpcGatewayVO.java
@@ -0,0 +1,206 @@
+// 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.network.vpc;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.utils.db.GenericDao;
+
+
+@Entity
+@Table(name="vpc_gateways")
+public class VpcGatewayVO implements VpcGateway {
+    
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+    @Column(name = "ip4_address")
+    String ip4Address;
+    
+    @Column(name="gateway") 
+    String gateway;
+    
+    @Column(name="netmask") 
+    String netmask;
+    
+    @Column(name="vlan_tag") 
+    String vlanTag;
+    
+    @Column(name = "type")
+    @Enumerated(value = EnumType.STRING)
+    VpcGateway.Type type;
+    
+    @Column(name="vpc_id")
+    Long vpcId;
+    
+    @Column(name="zone_id")
+    long zoneId;
+    
+    @Column(name="network_id")
+    Long networkId;
+    
+    @Column(name=GenericDao.CREATED_COLUMN)
+    Date created;
+    
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    Date removed;
+    
+    @Column(name="uuid")
+    private String uuid;
+    
+    @Column(name = "account_id")
+    long accountId;
+
+    @Column(name = "domain_id")
+    long domainId;
+    
+    @Column(name="state")
+    @Enumerated(value=EnumType.STRING)
+    State state;
+
+    @Column(name="source_nat")
+    boolean sourceNat;
+
+    protected VpcGatewayVO(){
+        this.uuid = UUID.randomUUID().toString();
+    }
+    
+    /**
+     * @param ip4Address
+     * @param type
+     * @param vpcId
+     * @param zoneId
+     * @param networkId
+     * @param vlanTag TODO
+     * @param gateway TODO
+     * @param netmask TODO
+     * @param accountId TODO
+     * @param domainId TODO
+     * @param account_id
+     * @param sourceNat
+     */
+    public VpcGatewayVO(String ip4Address, Type type, Long vpcId, long zoneId, Long networkId, String vlanTag, 
+            String gateway, String netmask, long accountId, long domainId, boolean sourceNat) {
+        this.ip4Address = ip4Address;
+        this.type = type;
+        this.vpcId = vpcId;
+        this.zoneId = zoneId;
+        this.networkId = networkId;
+        this.vlanTag = vlanTag;
+        this.gateway = gateway;
+        this.netmask = netmask;
+        this.uuid = UUID.randomUUID().toString();
+        this.accountId = accountId;
+        this.domainId = domainId;
+        this.state = State.Creating;
+        this.sourceNat = sourceNat;
+    }
+
+    @Override
+    public String getUuid() {
+        return this.uuid; 
+    }
+    
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public String getIp4Address() {
+        return ip4Address;
+    }
+
+    @Override
+    public VpcGateway.Type getType() {
+        return type;
+    }
+
+    @Override
+    public Long getVpcId() {
+        return vpcId;
+    }
+
+    @Override
+    public long getZoneId() {
+        return zoneId;
+    }
+
+    @Override
+    public Long getNetworkId() {
+        return networkId;
+    }
+    
+    @Override
+    public String toString() {
+        StringBuilder buf = new StringBuilder("VpcGateway[");
+        buf.append(id).append("|").append(ip4Address.toString()).append("|").append(vpcId).append("]");
+        return buf.toString();
+    }
+
+    @Override
+    public String getGateway() {
+        return gateway;
+    }
+
+    @Override
+    public String getNetmask() {
+        return netmask;
+    }
+
+    @Override
+    public String getVlanTag() {
+        return vlanTag;
+    }
+    
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    public void setState(State state) {
+        this.state = state;
+    }
+
+    @Override
+    public boolean getSourceNat() {
+        return this.sourceNat;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/VpcOfferingServiceMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/VpcOfferingServiceMapVO.java b/engine/schema/src/com/cloud/network/vpc/VpcOfferingServiceMapVO.java
new file mode 100644
index 0000000..9dbb32f
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/VpcOfferingServiceMapVO.java
@@ -0,0 +1,89 @@
+// 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.network.vpc;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.network.Network.Provider;
+import com.cloud.network.Network.Service;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+
+@Entity
+@Table(name="vpc_offering_service_map")
+public class VpcOfferingServiceMapVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+    
+    @Column(name="vpc_offering_id")
+    long vpcOfferingId;
+    
+    @Column(name="service")
+    String service;
+    
+    @Column(name="provider")
+    String provider;
+    
+    @Column(name=GenericDao.CREATED_COLUMN)
+    Date created;
+
+    public long getId() {
+        return id;
+    }
+
+    public long getVpcOfferingId() {
+        return vpcOfferingId;
+    }
+
+    public String getService() {
+        return service;
+    }
+
+    public String getProvider() {
+        return provider;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+    
+    public VpcOfferingServiceMapVO() {
+    }
+    
+    public VpcOfferingServiceMapVO(long vpcOfferingId, Service service, Provider provider) {
+        this.vpcOfferingId = vpcOfferingId;
+        this.service = service.getName();
+        if (provider != null) {
+            this.provider = provider.getName();
+        }
+    }
+    
+    public String toString() {
+        StringBuilder buf = new StringBuilder("[VPC Offering Service[");
+        return buf.append(vpcOfferingId).append("-").append(service).append("-").append(provider).append("]").toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/VpcOfferingVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/VpcOfferingVO.java b/engine/schema/src/com/cloud/network/vpc/VpcOfferingVO.java
new file mode 100644
index 0000000..9d5becf
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/VpcOfferingVO.java
@@ -0,0 +1,151 @@
+// 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.network.vpc;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+
+@Entity
+@Table(name="vpc_offerings")
+public class VpcOfferingVO implements VpcOffering {
+    
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    long id;
+    
+    @Column(name="uuid")
+    private String uuid;
+
+    @Column(name = "name")
+    String name;
+
+    @Column(name = "unique_name")
+    String uniqueName;
+
+    @Column(name = "display_text")
+    String displayText;
+    
+    @Column(name = "state")
+    @Enumerated(value = EnumType.STRING)
+    State state = State.Disabled;
+    
+    @Column(name = "default")
+    boolean isDefault = false;
+    
+    @Column(name = GenericDao.REMOVED_COLUMN)
+    Date removed;
+
+    @Column(name = GenericDao.CREATED_COLUMN)
+    Date created;
+    
+    @Column(name = "service_offering_id")
+    Long serviceOfferingId;
+    
+    public VpcOfferingVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+    
+    public VpcOfferingVO(String name, String displayText, Long serviceOfferingId) {
+        this.name = name;
+        this.displayText = displayText;
+        this.uniqueName = name;
+        this.serviceOfferingId = serviceOfferingId;
+        this.uuid = UUID.randomUUID().toString();
+        this.state = State.Disabled;
+    }
+    
+    public VpcOfferingVO(String name, String displayText, boolean isDefault, Long serviceOfferingId) {
+        this(name, displayText, serviceOfferingId);
+        this.isDefault = isDefault;
+    }
+    
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public String getUuid() {
+        return uuid;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    public String getUniqueName() {
+        return uniqueName;
+    }
+
+    @Override
+    public String getDisplayText() {
+        return displayText;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+    
+    @Override
+    public boolean isDefault() {
+        return isDefault;
+    }
+
+    public void setUniqueName(String uniqueName) {
+        this.uniqueName = uniqueName;
+    }
+    
+    @Override
+    public String toString() {
+        StringBuilder buf = new StringBuilder("[VPC Offering [");
+        return buf.append(id).append("-").append(name).append("]").toString();
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+
+    public void setDisplayText(String displayText) {
+        this.displayText = displayText;
+    }
+
+    public void setState(State state) {
+        this.state = state;
+    }
+
+    @Override
+    public Long getServiceOfferingId() {
+        return serviceOfferingId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/VpcServiceMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/VpcServiceMapVO.java b/engine/schema/src/com/cloud/network/vpc/VpcServiceMapVO.java
new file mode 100644
index 0000000..6f22909
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/VpcServiceMapVO.java
@@ -0,0 +1,90 @@
+// 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.network.vpc;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.network.Network.Provider;
+import com.cloud.network.Network.Service;
+import com.cloud.utils.db.GenericDao;
+
+@Entity
+@Table(name="vpc_service_map")
+public class VpcServiceMapVO {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+
+    @Column(name="vpc_id")
+    long vpcId;
+
+    @Column(name="service")
+    String service;
+
+    @Column(name="provider")
+    String provider;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    Date created;
+
+    public long getId() {
+        return id;
+    }
+
+    public long getVpcId() {
+        return vpcId;
+    }
+
+    public String getService() {
+        return service;
+    }
+
+    public String getProvider() {
+        return provider;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public VpcServiceMapVO() {
+    }
+
+    public VpcServiceMapVO(long vpcId, Service service, Provider provider) {
+        this.vpcId = vpcId;
+        this.service = service.getName();
+        this.provider = provider.getName();
+    }
+
+    public String toString() {
+        StringBuilder buf = new StringBuilder("[VPC Service[");
+        return buf.append(vpcId).append("-").append(service).append("-").append(provider).append("]").toString();
+    }
+}
+
+
+
+
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/VpcVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/VpcVO.java b/engine/schema/src/com/cloud/network/vpc/VpcVO.java
new file mode 100644
index 0000000..7b784eb
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/VpcVO.java
@@ -0,0 +1,181 @@
+// 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.network.vpc;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.utils.db.GenericDao;
+
+@Entity
+@Table(name="vpc")
+public class VpcVO implements Vpc {
+    @Id
+    @Column(name="id")
+    long id;
+    
+    @Column(name="uuid")
+    private String uuid;
+    
+    @Column(name="name")
+    private String name;
+    
+    @Column(name = "display_text")
+    String displayText;
+
+    @Column(name="zone_id")
+    long zoneId;
+
+    @Column(name="cidr")
+    private String cidr = null;
+    
+    @Column(name="domain_id")
+    Long domainId = null;
+    
+    @Column(name="account_id")
+    Long accountId = null;
+
+    @Column(name="state")
+    @Enumerated(value=EnumType.STRING)
+    State state;
+    
+    @Column(name="vpc_offering_id")
+    long vpcOfferingId;
+    
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    Date removed;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    Date created;
+    
+    @Column(name="network_domain")
+    String networkDomain;
+    
+    @Column(name="restart_required")
+    boolean restartRequired = false;
+    
+    public VpcVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+    
+    public VpcVO(long zoneId, String name, String displayText, long accountId, long domainId, long vpcOffId, String cidr,
+            String networkDomain) {
+        this.zoneId = zoneId;
+        this.name = name;
+        this.displayText = displayText;
+        this.accountId = accountId;
+        this.domainId = domainId;
+        this.cidr = cidr;
+        this.uuid = UUID.randomUUID().toString();
+        this.state = State.Enabled;
+        this.networkDomain = networkDomain;
+        this.vpcOfferingId = vpcOffId;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public String getUuid() {
+        return uuid;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public long getZoneId() {
+        return zoneId;
+    }
+
+    @Override
+    public String getCidr() {
+        return cidr;
+    }
+    
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    public void setState(State state) {
+        this.state = state;
+    }
+
+    @Override
+    public long getVpcOfferingId() {
+        return vpcOfferingId;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    @Override
+    public String getDisplayText() {
+        return displayText;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setDisplayText(String displayText) {
+        this.displayText = displayText;
+    }
+    
+    @Override
+    public String toString() {
+        StringBuilder buf = new StringBuilder("[VPC [");
+        return buf.append(id).append("-").append(name).append("]").toString();
+    }
+
+    @Override
+    public String getNetworkDomain() {
+        return networkDomain;
+    }
+    
+    public void setRestartRequired(boolean restartRequired) {
+        this.restartRequired = restartRequired;
+    }
+
+    @Override
+    public boolean isRestartRequired() {
+        return restartRequired;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/dao/PrivateIpDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/PrivateIpDao.java b/engine/schema/src/com/cloud/network/vpc/dao/PrivateIpDao.java
new file mode 100644
index 0000000..02df92e
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/dao/PrivateIpDao.java
@@ -0,0 +1,75 @@
+// 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.network.vpc.dao;
+
+import java.util.List;
+
+import com.cloud.network.vpc.PrivateIpVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface PrivateIpDao extends GenericDao<PrivateIpVO, Long>{
+
+    /**
+     * @param dcId
+     * @param networkId
+     * @param requestedIp TODO
+     * @return
+     */
+    PrivateIpVO allocateIpAddress(long dcId, long networkId, String requestedIp);
+
+    /**
+     * @param ipAddress
+     * @param networkId
+     */
+    void releaseIpAddress(String ipAddress, long networkId);
+
+    /**
+     * @param networkId
+     * @param ip4Address
+     * @return
+     */
+    PrivateIpVO findByIpAndSourceNetworkId(long networkId, String ip4Address);
+
+    /**
+     * @param networkId
+     * @return
+     */
+    List<PrivateIpVO> listByNetworkId(long networkId);
+
+    /**
+     * @param ntwkId
+     * @return
+     */
+    int countAllocatedByNetworkId(long ntwkId);
+
+    /**
+     * @param networkId
+     */
+    void deleteByNetworkId(long networkId);
+    
+    int countByNetworkId(long ntwkId);
+
+    /**
+     * @param vpcId
+     * @param ip4Address
+     * @return
+     */
+    PrivateIpVO findByIpAndVpcId(long vpcId, String ip4Address);
+
+    
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/dao/PrivateIpDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/PrivateIpDaoImpl.java b/engine/schema/src/com/cloud/network/vpc/dao/PrivateIpDaoImpl.java
new file mode 100644
index 0000000..ecab3bb
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/dao/PrivateIpDaoImpl.java
@@ -0,0 +1,156 @@
+// 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.network.vpc.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.vpc.PrivateIpVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value = PrivateIpDao.class)
+@DB(txn = false)
+public class PrivateIpDaoImpl extends GenericDaoBase<PrivateIpVO, Long> implements PrivateIpDao {
+    private static final Logger s_logger = Logger.getLogger(PrivateIpDaoImpl.class);
+
+    private final SearchBuilder<PrivateIpVO> AllFieldsSearch;
+    private final GenericSearchBuilder<PrivateIpVO, Integer> CountAllocatedByNetworkId;
+    private final GenericSearchBuilder<PrivateIpVO, Integer> CountByNetworkId;
+
+    
+    protected PrivateIpDaoImpl() {
+        super();
+        
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("ip", AllFieldsSearch.entity().getIpAddress(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("networkId", AllFieldsSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("ipAddress", AllFieldsSearch.entity().getIpAddress(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("taken", AllFieldsSearch.entity().getTakenAt(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("vpcId", AllFieldsSearch.entity().getVpcId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+        
+        CountAllocatedByNetworkId = createSearchBuilder(Integer.class);
+        CountAllocatedByNetworkId.select(null, Func.COUNT, CountAllocatedByNetworkId.entity().getId());
+        CountAllocatedByNetworkId.and("networkId", CountAllocatedByNetworkId.entity().getNetworkId(), Op.EQ);
+        CountAllocatedByNetworkId.and("taken", CountAllocatedByNetworkId.entity().getTakenAt(), Op.NNULL);
+        CountAllocatedByNetworkId.done();
+        
+        CountByNetworkId = createSearchBuilder(Integer.class);
+        CountByNetworkId.select(null, Func.COUNT, CountByNetworkId.entity().getId());
+        CountByNetworkId.and("networkId", CountByNetworkId.entity().getNetworkId(), Op.EQ);
+        CountByNetworkId.done();
+    }
+    
+    @Override
+    public PrivateIpVO allocateIpAddress(long dcId, long networkId, String requestedIp) {
+        SearchCriteria<PrivateIpVO> sc = AllFieldsSearch.create();
+        sc.setParameters("networkId", networkId);
+        sc.setParameters("taken", (Date)null);
+        
+        if (requestedIp != null) {
+            sc.setParameters("ipAddress", requestedIp);
+        }
+        
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        PrivateIpVO  vo = lockOneRandomRow(sc, true);
+        if (vo == null) {
+            txn.rollback();
+            return null;
+        }
+        vo.setTakenAt(new Date());
+        update(vo.getId(), vo);
+        txn.commit();
+        return vo;
+    }
+    
+    @Override
+    public void releaseIpAddress(String ipAddress, long networkId) {
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Releasing private ip address: " + ipAddress + " network id " + networkId);
+        }
+        SearchCriteria<PrivateIpVO> sc = AllFieldsSearch.create();
+        sc.setParameters("ip", ipAddress);
+        sc.setParameters("networkId", networkId);
+
+        PrivateIpVO vo = createForUpdate();
+        
+        vo.setTakenAt(null);
+        update(vo, sc);
+    }
+
+
+    @Override
+    public PrivateIpVO findByIpAndSourceNetworkId(long networkId, String ip4Address) {
+        SearchCriteria<PrivateIpVO> sc = AllFieldsSearch.create();
+        sc.setParameters("ip", ip4Address);
+        sc.setParameters("networkId", networkId);
+        return findOneBy(sc);
+    }
+    
+    @Override
+    public PrivateIpVO findByIpAndVpcId(long vpcId, String ip4Address) {
+        SearchCriteria<PrivateIpVO> sc = AllFieldsSearch.create();
+        sc.setParameters("ip", ip4Address);
+        sc.setParameters("vpcId", vpcId);
+        return findOneBy(sc);
+    }
+    
+    @Override
+    public List<PrivateIpVO> listByNetworkId(long networkId) {
+        SearchCriteria<PrivateIpVO> sc = AllFieldsSearch.create();
+        sc.setParameters("networkId", networkId);
+        return listBy(sc);
+    }
+    
+    @Override
+    public int countAllocatedByNetworkId(long ntwkId) {
+        SearchCriteria<Integer> sc = CountAllocatedByNetworkId.create();
+        sc.setParameters("networkId", ntwkId);
+        List<Integer> results = customSearch(sc, null);
+        return results.get(0);
+    }
+    
+    
+    @Override
+    public void deleteByNetworkId(long networkId) {
+        SearchCriteria<PrivateIpVO> sc = AllFieldsSearch.create();
+        sc.setParameters("networkId", networkId);
+        remove(sc);
+    }
+
+    @Override
+    public int countByNetworkId(long ntwkId) {
+        SearchCriteria<Integer> sc = CountByNetworkId.create();
+        sc.setParameters("networkId", ntwkId);
+        List<Integer> results = customSearch(sc, null);
+        return results.get(0);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDao.java b/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDao.java
new file mode 100644
index 0000000..a8fbc09
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDao.java
@@ -0,0 +1,35 @@
+// 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.network.vpc.dao;
+
+import java.util.List;
+
+import com.cloud.network.vpc.StaticRoute;
+import com.cloud.network.vpc.StaticRouteVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface StaticRouteDao extends GenericDao<StaticRouteVO, Long>{
+    
+    boolean setStateToAdd(StaticRouteVO rule);
+
+    List<? extends StaticRoute> listByGatewayIdAndNotRevoked(long gatewayId);
+    
+    List<StaticRouteVO> listByVpcId(long vpcId);
+    
+    long countRoutesByGateway(long gatewayId);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDaoImpl.java b/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDaoImpl.java
new file mode 100644
index 0000000..fac35a9
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/dao/StaticRouteDaoImpl.java
@@ -0,0 +1,119 @@
+// 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.network.vpc.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.vpc.StaticRoute;
+import com.cloud.network.vpc.StaticRouteVO;
+import com.cloud.server.ResourceTag.TaggedResourceType;
+import com.cloud.tags.dao.ResourceTagDao;
+import com.cloud.tags.dao.ResourceTagsDaoImpl;
+
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value = StaticRouteDao.class)
+@DB(txn = false)
+public class StaticRouteDaoImpl extends GenericDaoBase<StaticRouteVO, Long> implements StaticRouteDao{
+    protected final SearchBuilder<StaticRouteVO> AllFieldsSearch;
+    protected final SearchBuilder<StaticRouteVO> NotRevokedSearch;
+    protected final GenericSearchBuilder<StaticRouteVO, Long> RoutesByGatewayCount;
+    @Inject ResourceTagDao _tagsDao;
+    
+    protected StaticRouteDaoImpl() {
+        super();
+
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("gatewayId", AllFieldsSearch.entity().getVpcGatewayId(), Op.EQ);
+        AllFieldsSearch.and("vpcId", AllFieldsSearch.entity().getVpcId(), Op.EQ);
+        AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ);
+        AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ);
+        AllFieldsSearch.done();
+        
+        NotRevokedSearch = createSearchBuilder();
+        NotRevokedSearch.and("gatewayId", NotRevokedSearch.entity().getVpcGatewayId(), Op.EQ);
+        NotRevokedSearch.and("state", NotRevokedSearch.entity().getState(), Op.NEQ);
+        NotRevokedSearch.done();
+        
+        RoutesByGatewayCount = createSearchBuilder(Long.class);
+        RoutesByGatewayCount.select(null, Func.COUNT, RoutesByGatewayCount.entity().getId());
+        RoutesByGatewayCount.and("gatewayId", RoutesByGatewayCount.entity().getVpcGatewayId(), Op.EQ);
+        RoutesByGatewayCount.done();
+    }
+
+    
+    @Override
+    public boolean setStateToAdd(StaticRouteVO rule) {
+        SearchCriteria<StaticRouteVO> sc = AllFieldsSearch.create();
+        sc.setParameters("id", rule.getId());
+        sc.setParameters("state", StaticRoute.State.Staged);
+
+        rule.setState(StaticRoute.State.Add);
+
+        return update(rule, sc) > 0;
+    }
+
+
+    @Override
+    public List<? extends StaticRoute> listByGatewayIdAndNotRevoked(long gatewayId) {
+        SearchCriteria<StaticRouteVO> sc = NotRevokedSearch.create();
+        sc.setParameters("gatewayId", gatewayId);
+        sc.setParameters("state", StaticRoute.State.Revoke);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<StaticRouteVO> listByVpcId(long vpcId) {
+        SearchCriteria<StaticRouteVO> sc = AllFieldsSearch.create();
+        sc.setParameters("vpcId", vpcId);
+        return listBy(sc);
+    }
+
+    @Override
+    public long countRoutesByGateway(long gatewayId) {
+        SearchCriteria<Long> sc = RoutesByGatewayCount.create();
+        sc.setParameters("gatewayId", gatewayId);
+        return customSearch(sc, null).get(0);
+    }
+    
+    @Override
+    @DB
+    public boolean remove(Long id) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        StaticRouteVO entry = findById(id);
+        if (entry != null) {
+            _tagsDao.removeByIdAndType(id, TaggedResourceType.StaticRoute);
+        }
+        boolean result = super.remove(id);
+        txn.commit();
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/dao/VpcDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/VpcDao.java b/engine/schema/src/com/cloud/network/vpc/dao/VpcDao.java
new file mode 100644
index 0000000..5a33217
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/dao/VpcDao.java
@@ -0,0 +1,47 @@
+// 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.network.vpc.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import com.cloud.network.vpc.Vpc;
+import com.cloud.network.vpc.VpcVO;
+import com.cloud.utils.db.GenericDao;
+
+
+public interface VpcDao extends GenericDao<VpcVO, Long>{
+
+    /**
+     * @param offId
+     * @return
+     */
+    int getVpcCountByOfferingId(long offId);
+    
+    Vpc getActiveVpcById(long vpcId);
+    
+    List<? extends Vpc> listByAccountId(long accountId);
+    
+    List<VpcVO> listInactiveVpcs();
+    
+    long countByAccountId(long accountId);
+
+    VpcVO persist(VpcVO vpc, Map<String, String> serviceProviderMap);
+
+    void persistVpcServiceProviders(long vpcId,
+                                    Map<String, String> serviceProviderMap);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/dao/VpcDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/VpcDaoImpl.java b/engine/schema/src/com/cloud/network/vpc/dao/VpcDaoImpl.java
new file mode 100644
index 0000000..6560b90
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/dao/VpcDaoImpl.java
@@ -0,0 +1,152 @@
+// 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.network.vpc.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import com.cloud.network.Network;
+import com.cloud.network.vpc.VpcServiceMapVO;
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.vpc.Vpc;
+import com.cloud.network.vpc.VpcVO;
+import com.cloud.server.ResourceTag.TaggedResourceType;
+import com.cloud.tags.dao.ResourceTagDao;
+
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value = VpcDao.class)
+@DB(txn = false)
+public class VpcDaoImpl extends GenericDaoBase<VpcVO, Long> implements VpcDao{
+    final GenericSearchBuilder<VpcVO, Integer> CountByOfferingId;
+    final SearchBuilder<VpcVO> AllFieldsSearch;
+    final GenericSearchBuilder<VpcVO, Long> CountByAccountId;
+
+    @Inject ResourceTagDao _tagsDao;
+    @Inject VpcServiceMapDao _vpcSvcMap;
+
+    protected VpcDaoImpl() {
+        super();
+        
+        CountByOfferingId = createSearchBuilder(Integer.class);
+        CountByOfferingId.select(null, Func.COUNT, CountByOfferingId.entity().getId());
+        CountByOfferingId.and("offeringId", CountByOfferingId.entity().getVpcOfferingId(), Op.EQ);
+        CountByOfferingId.and("removed", CountByOfferingId.entity().getRemoved(), Op.NULL);
+        CountByOfferingId.done();
+        
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ);
+        AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ);
+        AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), Op.EQ);
+        AllFieldsSearch.done();
+        
+        CountByAccountId = createSearchBuilder(Long.class);
+        CountByAccountId.select(null, Func.COUNT, CountByAccountId.entity().getId());
+        CountByAccountId.and("offeringId", CountByAccountId.entity().getAccountId(), Op.EQ);
+        CountByAccountId.and("removed", CountByAccountId.entity().getRemoved(), Op.NULL);
+        CountByAccountId.done();
+    }
+    
+    
+    @Override
+    public int getVpcCountByOfferingId(long offId) {
+        SearchCriteria<Integer> sc = CountByOfferingId.create();
+        sc.setParameters("offeringId", offId);
+        List<Integer> results = customSearch(sc, null);
+        return results.get(0);
+    }
+    
+    @Override
+    public Vpc getActiveVpcById(long vpcId) {
+        SearchCriteria<VpcVO> sc = AllFieldsSearch.create();
+        sc.setParameters("id", vpcId);
+        sc.setParameters("state", Vpc.State.Enabled);
+        return findOneBy(sc);
+    }
+    
+    @Override
+    public List<? extends Vpc> listByAccountId(long accountId) {
+        SearchCriteria<VpcVO> sc = AllFieldsSearch.create();
+        sc.setParameters("accountId", accountId);
+        return listBy(sc, null);
+    }
+    
+    @Override
+    public List<VpcVO> listInactiveVpcs() {
+        SearchCriteria<VpcVO> sc = AllFieldsSearch.create();
+        sc.setParameters("state", Vpc.State.Inactive);
+        return listBy(sc, null);
+    }
+    
+    @Override
+    @DB
+    public boolean remove(Long id) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        VpcVO entry = findById(id);
+        if (entry != null) {
+            _tagsDao.removeByIdAndType(id, TaggedResourceType.Vpc);
+        }
+        boolean result = super.remove(id);
+        txn.commit();
+        return result;
+    }
+    
+    @Override
+    public long countByAccountId(long accountId) {
+        SearchCriteria<Long> sc = CountByAccountId.create();
+        sc.setParameters("accountId", accountId);
+        List<Long> results = customSearch(sc, null);
+        return results.get(0);
+    }
+
+    @Override
+    @DB
+    public VpcVO persist(VpcVO vpc, Map<String, String> serviceProviderMap) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        VpcVO newVpc = super.persist(vpc);
+        persistVpcServiceProviders(vpc.getId(), serviceProviderMap);
+        txn.commit();
+        return newVpc;
+    }
+
+    @Override
+    @DB
+    public void persistVpcServiceProviders(long vpcId, Map<String, String> serviceProviderMap) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        for (String service : serviceProviderMap.keySet()) {
+            VpcServiceMapVO serviceMap = new VpcServiceMapVO(vpcId, Network.Service.getService(service), Network.Provider.getProvider(serviceProviderMap.get(service)));
+            _vpcSvcMap.persist(serviceMap);
+        }
+        txn.commit();
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/dao/VpcGatewayDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/VpcGatewayDao.java b/engine/schema/src/com/cloud/network/vpc/dao/VpcGatewayDao.java
new file mode 100644
index 0000000..600d67f
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/dao/VpcGatewayDao.java
@@ -0,0 +1,26 @@
+// 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.network.vpc.dao;
+
+import com.cloud.network.vpc.VpcGatewayVO;
+import com.cloud.utils.db.GenericDao;
+
+
+public interface VpcGatewayDao extends GenericDao<VpcGatewayVO, Long>{
+    VpcGatewayVO getPrivateGatewayForVpc(long vpcId);
+    VpcGatewayVO getVpnGatewayForVpc(long vpcId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/dao/VpcGatewayDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/VpcGatewayDaoImpl.java b/engine/schema/src/com/cloud/network/vpc/dao/VpcGatewayDaoImpl.java
new file mode 100644
index 0000000..a1cd934
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/dao/VpcGatewayDaoImpl.java
@@ -0,0 +1,62 @@
+// 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.network.vpc.dao;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.vpc.VpcGateway;
+import com.cloud.network.vpc.VpcGatewayVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value = VpcGatewayDao.class)
+@DB(txn = false)
+public class VpcGatewayDaoImpl extends GenericDaoBase<VpcGatewayVO, Long> implements VpcGatewayDao{
+    protected final SearchBuilder<VpcGatewayVO> AllFieldsSearch;
+    
+    protected VpcGatewayDaoImpl() {
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("vpcId", AllFieldsSearch.entity().getVpcId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("type", AllFieldsSearch.entity().getType(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+    }
+
+
+    @Override
+    public VpcGatewayVO getPrivateGatewayForVpc(long vpcId) {
+        SearchCriteria<VpcGatewayVO> sc = AllFieldsSearch.create();
+        sc.setParameters("vpcId", vpcId);
+        sc.setParameters("type", VpcGateway.Type.Private);
+
+        return findOneBy(sc);
+    }
+
+    @Override
+    public VpcGatewayVO getVpnGatewayForVpc(long vpcId) {
+        SearchCriteria<VpcGatewayVO> sc = AllFieldsSearch.create();
+        sc.setParameters("vpcId", vpcId);
+        sc.setParameters("type", VpcGateway.Type.Vpn);
+
+        return findOneBy(sc);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/dao/VpcOfferingDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/VpcOfferingDao.java b/engine/schema/src/com/cloud/network/vpc/dao/VpcOfferingDao.java
new file mode 100644
index 0000000..8138ac6
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/dao/VpcOfferingDao.java
@@ -0,0 +1,32 @@
+// 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.network.vpc.dao;
+
+import com.cloud.network.vpc.VpcOfferingVO;
+import com.cloud.utils.db.GenericDao;
+
+
+public interface VpcOfferingDao extends GenericDao<VpcOfferingVO, Long>{
+    /**
+     * Returns the VPC offering that matches the unique name.
+     * 
+     * @param uniqueName
+     *            name
+     * @return VpcOfferingVO
+     */
+    VpcOfferingVO findByUniqueName(String uniqueName);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/dao/VpcOfferingDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/VpcOfferingDaoImpl.java b/engine/schema/src/com/cloud/network/vpc/dao/VpcOfferingDaoImpl.java
new file mode 100644
index 0000000..2cda547
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/dao/VpcOfferingDaoImpl.java
@@ -0,0 +1,71 @@
+// 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.network.vpc.dao;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.vpc.VpcOfferingVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+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;
+
+@Component
+@Local(value = VpcOfferingDao.class)
+@DB(txn = false)
+public class VpcOfferingDaoImpl extends GenericDaoBase<VpcOfferingVO, Long> implements VpcOfferingDao{
+    final SearchBuilder<VpcOfferingVO> AllFieldsSearch;
+
+    protected VpcOfferingDaoImpl() {
+        super();
+        
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ);
+        AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ);
+        AllFieldsSearch.and("name", AllFieldsSearch.entity().getName(), Op.EQ);
+        AllFieldsSearch.and("uName", AllFieldsSearch.entity().getUniqueName(), Op.EQ);
+        AllFieldsSearch.and("displayText", AllFieldsSearch.entity().getDisplayText(), Op.EQ);
+        AllFieldsSearch.and("svcOffId", AllFieldsSearch.entity().getServiceOfferingId(), Op.EQ);
+        AllFieldsSearch.done();
+        
+    }
+
+    @Override
+    @DB
+    public boolean remove(Long vpcOffId) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        VpcOfferingVO offering = findById(vpcOffId);
+        offering.setUniqueName(null);
+        update(vpcOffId, offering);
+        boolean result = super.remove(vpcOffId);
+        txn.commit();
+        return result;
+    }
+
+
+    @Override
+    public VpcOfferingVO findByUniqueName(String uniqueName) {
+        SearchCriteria<VpcOfferingVO> sc = AllFieldsSearch.create();
+        sc.setParameters("uName", uniqueName);
+        return findOneBy(sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/dao/VpcOfferingServiceMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/VpcOfferingServiceMapDao.java b/engine/schema/src/com/cloud/network/vpc/dao/VpcOfferingServiceMapDao.java
new file mode 100644
index 0000000..b298c1e
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/dao/VpcOfferingServiceMapDao.java
@@ -0,0 +1,41 @@
+// 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.network.vpc.dao;
+
+import java.util.List;
+
+import com.cloud.network.Network.Service;
+import com.cloud.network.vpc.VpcOfferingServiceMapVO;
+import com.cloud.utils.db.GenericDao;
+
+
+public interface VpcOfferingServiceMapDao extends GenericDao<VpcOfferingServiceMapVO, Long>{
+    
+    List<VpcOfferingServiceMapVO> listByVpcOffId(long vpcOffId);
+
+    /**
+     * @param networkOfferingId
+     * @param services
+     * @return
+     */
+    boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service[] services);
+    
+    List<String> listServicesForVpcOffering(long vpcOfferingId);
+    
+    VpcOfferingServiceMapVO findByServiceProviderAndOfferingId(String service, String provider, long vpcOfferingId);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/dao/VpcOfferingServiceMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/VpcOfferingServiceMapDaoImpl.java b/engine/schema/src/com/cloud/network/vpc/dao/VpcOfferingServiceMapDaoImpl.java
new file mode 100644
index 0000000..4b5f1b9
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/dao/VpcOfferingServiceMapDaoImpl.java
@@ -0,0 +1,119 @@
+// 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.network.vpc.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.Network.Service;
+import com.cloud.network.vpc.VpcOfferingServiceMapVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
+
+@Component
+@Local(value = VpcOfferingServiceMapDao.class)
+@DB(txn = false)
+public class VpcOfferingServiceMapDaoImpl extends GenericDaoBase<VpcOfferingServiceMapVO, Long> implements VpcOfferingServiceMapDao{
+    final SearchBuilder<VpcOfferingServiceMapVO> AllFieldsSearch;
+    final SearchBuilder<VpcOfferingServiceMapVO> MultipleServicesSearch;
+    final GenericSearchBuilder<VpcOfferingServiceMapVO, String> ServicesSearch;
+
+    
+    protected VpcOfferingServiceMapDaoImpl() {
+        super();
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("vpcOffId", AllFieldsSearch.entity().getVpcOfferingId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("service", AllFieldsSearch.entity().getService(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("provider", AllFieldsSearch.entity().getProvider(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+        
+        
+        MultipleServicesSearch = createSearchBuilder();
+        MultipleServicesSearch.and("vpcOffId", MultipleServicesSearch.entity().getVpcOfferingId(), SearchCriteria.Op.EQ);
+        MultipleServicesSearch.and("service", MultipleServicesSearch.entity().getService(), SearchCriteria.Op.IN);
+        MultipleServicesSearch.and("provider", MultipleServicesSearch.entity().getProvider(), SearchCriteria.Op.EQ);
+        MultipleServicesSearch.done();
+        
+        ServicesSearch = createSearchBuilder(String.class);
+        ServicesSearch.and("offeringId", ServicesSearch.entity().getVpcOfferingId(), SearchCriteria.Op.EQ);
+        ServicesSearch.select(null, Func.DISTINCT, ServicesSearch.entity().getService());
+        ServicesSearch.done();
+    }
+    
+    @Override
+    public List<VpcOfferingServiceMapVO> listByVpcOffId(long vpcOffId) {
+        SearchCriteria<VpcOfferingServiceMapVO> sc = AllFieldsSearch.create();
+        sc.setParameters("vpcOffId", vpcOffId);
+        return listBy(sc);
+    }
+    
+    
+    @Override
+    public boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service... services) {
+        SearchCriteria<VpcOfferingServiceMapVO> sc = MultipleServicesSearch.create();
+        sc.setParameters("vpcOffId", networkOfferingId);
+        
+        if (services != null) {
+            String[] servicesStr = new String[services.length];
+            
+            int i = 0;
+            for (Service service : services) {
+                servicesStr[i] = service.getName();
+                i++;
+            }
+            
+            sc.setParameters("service", (Object[])servicesStr);
+        }
+        
+        List<VpcOfferingServiceMapVO> offeringServices = listBy(sc);
+        
+        if (services != null) {
+            if (offeringServices.size() == services.length) {
+                return true;
+            }
+        } else if (!offeringServices.isEmpty()) {
+            return true;
+        }
+        
+        return false;
+    }
+
+    @Override
+    public List<String> listServicesForVpcOffering(long offId) {
+        SearchCriteria<String> sc = ServicesSearch.create();;
+        sc.setParameters("offeringId", offId);
+        return customSearch(sc, null);
+    }
+
+
+    @Override
+    public VpcOfferingServiceMapVO findByServiceProviderAndOfferingId(String service, String provider, long vpcOfferingId) {
+        SearchCriteria<VpcOfferingServiceMapVO> sc = AllFieldsSearch.create();
+        sc.setParameters("vpcOffId", vpcOfferingId);
+        sc.setParameters("service", service);
+        sc.setParameters("provider", provider);
+        
+        return findOneBy(sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/dao/VpcServiceMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/VpcServiceMapDao.java b/engine/schema/src/com/cloud/network/vpc/dao/VpcServiceMapDao.java
new file mode 100644
index 0000000..8c4537e
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/dao/VpcServiceMapDao.java
@@ -0,0 +1,40 @@
+// 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.network.vpc.dao;
+
+import java.util.List;
+
+import com.cloud.network.Network.Provider;
+import com.cloud.network.Network.Service;
+import com.cloud.network.dao.NetworkServiceMapVO;
+import com.cloud.network.vpc.VpcServiceMapVO;
+import com.cloud.utils.db.GenericDao;
+
+/**
+ * VpcServiceMapDao deals with searches and operations done on the
+ * vpc_service_map table.
+ *
+ */
+public interface VpcServiceMapDao extends GenericDao<VpcServiceMapVO, Long>{
+    boolean areServicesSupportedInVpc(long vpcId, Service... services);
+    boolean canProviderSupportServiceInVpc(long vpcId, Service service, Provider provider);
+    List<NetworkServiceMapVO> getServicesInVpc(long vpcId);
+    String getProviderForServiceInVpc(long vpcId, Service service);
+    void deleteByVpcId(long vpcId);
+    List<String> getDistinctProviders(long vpcId);
+    String isProviderForVpc(long vpcId, Provider provider);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/vpc/dao/VpcServiceMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/VpcServiceMapDaoImpl.java b/engine/schema/src/com/cloud/network/vpc/dao/VpcServiceMapDaoImpl.java
new file mode 100644
index 0000000..a992181
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/vpc/dao/VpcServiceMapDaoImpl.java
@@ -0,0 +1,115 @@
+// 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.network.vpc.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import com.cloud.exception.UnsupportedServiceException;
+import com.cloud.network.Network.Provider;
+import com.cloud.network.Network.Service;
+import com.cloud.network.dao.NetworkServiceMapVO;
+import com.cloud.network.vpc.VpcServiceMapVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import org.springframework.stereotype.Component;
+
+@Component
+@Local(value=VpcServiceMapDao.class) @DB(txn=false)
+public class VpcServiceMapDaoImpl extends GenericDaoBase<VpcServiceMapVO, Long> implements VpcServiceMapDao {
+    final SearchBuilder<VpcServiceMapVO> AllFieldsSearch;
+    final SearchBuilder<VpcServiceMapVO> MultipleServicesSearch;
+    final GenericSearchBuilder<VpcServiceMapVO, String> DistinctProvidersSearch;
+
+    protected VpcServiceMapDaoImpl(){
+        super();
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("vpcId", AllFieldsSearch.entity().getVpcId(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("service", AllFieldsSearch.entity().getService(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.and("provider", AllFieldsSearch.entity().getProvider(), SearchCriteria.Op.EQ);
+        AllFieldsSearch.done();
+
+        MultipleServicesSearch = createSearchBuilder();
+        MultipleServicesSearch.and("vpcId", MultipleServicesSearch.entity().getVpcId(), SearchCriteria.Op.EQ);
+        MultipleServicesSearch.and("service", MultipleServicesSearch.entity().getService(), SearchCriteria.Op.IN);
+        MultipleServicesSearch.and("provider", MultipleServicesSearch.entity().getProvider(), SearchCriteria.Op.EQ);
+        MultipleServicesSearch.done();
+
+        DistinctProvidersSearch = createSearchBuilder(String.class);
+        DistinctProvidersSearch.and("vpcId", DistinctProvidersSearch.entity().getVpcId(), SearchCriteria.Op.EQ);
+        DistinctProvidersSearch.and("provider", DistinctProvidersSearch.entity().getProvider(), SearchCriteria.Op.EQ);
+        DistinctProvidersSearch.selectField(DistinctProvidersSearch.entity().getProvider());
+        DistinctProvidersSearch.done();
+    }
+
+    @Override
+    public boolean areServicesSupportedInVpc(long vpcId, Service... services) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean canProviderSupportServiceInVpc(long vpcId, Service service,
+                                                  Provider provider) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public List<NetworkServiceMapVO> getServicesInVpc(long vpcId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getProviderForServiceInVpc(long vpcId, Service service) {
+        SearchCriteria<VpcServiceMapVO> sc = AllFieldsSearch.create();
+        sc.setParameters("vpcId", vpcId);
+        sc.setParameters("service", service.getName());
+        VpcServiceMapVO ntwkSvc = findOneBy(sc);
+        if (ntwkSvc == null) {
+            throw new UnsupportedServiceException("Service " + service.getName() + " is not supported in the vpc id=" + vpcId);
+        }
+
+        return ntwkSvc.getProvider();
+    }
+
+    @Override
+    public void deleteByVpcId(long vpcId) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public List<String> getDistinctProviders(long vpcId) {
+        SearchCriteria<String> sc = DistinctProvidersSearch.create();
+        sc.setParameters("vpcId", vpcId);
+        List<String> results = customSearch(sc, null);
+        return results;
+    }
+
+    @Override
+    public String isProviderForVpc(long vpcId, Provider provider) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/offerings/NetworkOfferingDetailsVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/offerings/NetworkOfferingDetailsVO.java b/engine/schema/src/com/cloud/offerings/NetworkOfferingDetailsVO.java
new file mode 100644
index 0000000..6cd5abc
--- /dev/null
+++ b/engine/schema/src/com/cloud/offerings/NetworkOfferingDetailsVO.java
@@ -0,0 +1,90 @@
+// 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.offerings;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import com.cloud.offering.NetworkOffering;
+import com.cloud.offering.NetworkOffering.Detail;
+
+@Entity
+@Table(name="network_offering_details")
+public class NetworkOfferingDetailsVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+    @Column(name="network_offering_id")
+    private long offeringId;
+    
+    @Enumerated(value=EnumType.STRING)
+    @Column(name="name")
+    private NetworkOffering.Detail name;
+    
+    @Column(name="value", length=1024)
+    private String value;
+    
+    public NetworkOfferingDetailsVO() {}
+    
+    public NetworkOfferingDetailsVO(long offeringId, Detail detailName, String value) {
+        this.offeringId = offeringId;
+        this.name = detailName;
+        this.value = value;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getOfferingId() {
+        return offeringId;
+    }
+
+    public NetworkOffering.Detail getName() {
+        return name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public void setOfferingId(long offeringId) {
+        this.offeringId = offeringId;
+    }
+
+    public void setName(NetworkOffering.Detail name) {
+        this.name = name;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+}


[41/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerContainer.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerContainer.java b/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerContainer.java
new file mode 100644
index 0000000..df94d3d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerContainer.java
@@ -0,0 +1,28 @@
+// 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 org.apache.cloudstack.network.lb;
+
+import com.cloud.network.rules.LoadBalancerContainer;
+import com.cloud.utils.net.Ip;
+
+public interface ApplicationLoadBalancerContainer extends LoadBalancerContainer{
+    
+    public Long getSourceIpNetworkId();
+    
+    public Ip getSourceIp();
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerRule.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerRule.java b/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerRule.java
new file mode 100644
index 0000000..f4acb73
--- /dev/null
+++ b/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerRule.java
@@ -0,0 +1,24 @@
+// 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 org.apache.cloudstack.network.lb;
+
+import com.cloud.network.rules.LoadBalancer;
+
+public interface ApplicationLoadBalancerRule extends ApplicationLoadBalancerContainer, LoadBalancer{
+    int getInstancePort();
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java b/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java
new file mode 100644
index 0000000..b2ac358
--- /dev/null
+++ b/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java
@@ -0,0 +1,42 @@
+// 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 org.apache.cloudstack.network.lb;
+
+import java.util.List;
+
+import org.apache.cloudstack.api.command.user.loadbalancer.ListApplicationLoadBalancersCmd;
+
+import com.cloud.exception.InsufficientAddressCapacityException;
+import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.network.rules.LoadBalancerContainer.Scheme;
+import com.cloud.utils.Pair;
+
+public interface ApplicationLoadBalancerService {
+    
+    ApplicationLoadBalancerRule createApplicationLoadBalancer(String name, String description, Scheme scheme, long sourceIpNetworkId, String sourceIp,
+            int sourcePort, int instancePort, String algorithm, long networkId, long lbOwnerId) throws InsufficientAddressCapacityException,
+            NetworkRuleConflictException, InsufficientVirtualNetworkCapcityException;
+    
+    boolean deleteApplicationLoadBalancer(long id);
+    
+    Pair<List<? extends ApplicationLoadBalancerRule>, Integer> listApplicationLoadBalancers(ListApplicationLoadBalancersCmd cmd);
+    
+    ApplicationLoadBalancerRule getApplicationLoadBalancer(long ruleId);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMService.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMService.java b/api/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMService.java
new file mode 100644
index 0000000..91cd88d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMService.java
@@ -0,0 +1,34 @@
+// 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 org.apache.cloudstack.network.lb;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.StorageUnavailableException;
+import com.cloud.network.router.VirtualRouter;
+import com.cloud.user.Account;
+
+public interface InternalLoadBalancerVMService {
+
+    VirtualRouter startInternalLbVm(long internalLbVmId, Account caller, long callerUserId) 
+            throws StorageUnavailableException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException;
+
+    VirtualRouter stopInternalLbVm(long vmId, boolean forced, Account caller, long callerUserId)
+            throws ConcurrentOperationException, ResourceUnavailableException;
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/src/org/apache/cloudstack/query/QueryService.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/query/QueryService.java b/api/src/org/apache/cloudstack/query/QueryService.java
index 2b82fec..9eada21 100644
--- a/api/src/org/apache/cloudstack/query/QueryService.java
+++ b/api/src/org/apache/cloudstack/query/QueryService.java
@@ -18,6 +18,7 @@ package org.apache.cloudstack.query;
 
 import org.apache.cloudstack.affinity.AffinityGroupResponse;
 import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
+import org.apache.cloudstack.api.command.admin.internallb.ListInternalLBVMsCmd;
 import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd;
 import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd;
 import org.apache.cloudstack.api.command.admin.user.ListUsersCmd;
@@ -95,4 +96,6 @@ public interface QueryService {
 
     public List<ResourceDetailResponse> listResource(ListResourceDetailsCmd cmd);
 
+    ListResponse<DomainRouterResponse> searchForInternalLbVms(ListInternalLBVMsCmd cmd);
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/AgentControlAnswerTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/AgentControlAnswerTest.java b/api/test/org/apache/cloudstack/api/agent/test/AgentControlAnswerTest.java
deleted file mode 100644
index d0e8b4c..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/AgentControlAnswerTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertFalse;
-
-import org.junit.Test;
-
-import com.cloud.agent.api.AgentControlAnswer;
-import com.cloud.agent.api.AgentControlCommand;
-
-public class AgentControlAnswerTest {
-    AgentControlCommand acc = new AgentControlCommand();
-    AgentControlAnswer aca = new AgentControlAnswer(acc);
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = acc.executeInSequence();
-        assertFalse(b);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/AgentControlCommandTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/AgentControlCommandTest.java b/api/test/org/apache/cloudstack/api/agent/test/AgentControlCommandTest.java
deleted file mode 100644
index 24d0fe5..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/AgentControlCommandTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertFalse;
-
-import org.junit.Test;
-
-import com.cloud.agent.api.AgentControlCommand;
-
-public class AgentControlCommandTest {
-    AgentControlCommand acc = new AgentControlCommand();
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = acc.executeInSequence();
-        assertFalse(b);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/AnswerTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/AnswerTest.java b/api/test/org/apache/cloudstack/api/agent/test/AnswerTest.java
deleted file mode 100644
index 343a3ce..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/AnswerTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-import com.cloud.agent.api.AgentControlCommand;
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.UnsupportedAnswer;
-
-public class AnswerTest {
-    AgentControlCommand acc = new AgentControlCommand();
-    Answer a = new Answer(acc, true, "details");
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = a.executeInSequence();
-        assertFalse(b);
-    }
-
-    @Test
-    public void testGetResult() {
-        boolean b = a.getResult();
-        assertTrue(b);
-    }
-
-    @Test
-    public void testGetDetails() {
-        String d = a.getDetails();
-        assertTrue(d.equals("details"));
-    }
-
-    @Test
-    public void testCreateUnsupportedCommandAnswer() {
-        UnsupportedAnswer usa = Answer.createUnsupportedCommandAnswer(acc);
-        boolean b = usa.executeInSequence();
-        assertFalse(b);
-
-        b = usa.getResult();
-        assertFalse(b);
-
-        String d = usa.getDetails();
-        assertTrue(d.equals("Unsupported command issued:" + acc.toString()
-                + ".  Are you sure you got the right type of server?"));
-
-        usa = Answer.createUnsupportedVersionAnswer(acc);
-        b = usa.executeInSequence();
-        assertFalse(b);
-
-        b = usa.getResult();
-        assertFalse(b);
-
-        d = usa.getDetails();
-        assertTrue(d.equals("Unsuppored Version."));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/AttachIsoCommandTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/AttachIsoCommandTest.java b/api/test/org/apache/cloudstack/api/agent/test/AttachIsoCommandTest.java
deleted file mode 100644
index d189d9c..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/AttachIsoCommandTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-import com.cloud.agent.api.AttachIsoCommand;
-
-public class AttachIsoCommandTest {
-    AttachIsoCommand aic = new AttachIsoCommand("vmname", "isopath", false);
-
-    @Test
-    public void testGetVmName() {
-        String vmName = aic.getVmName();
-        assertTrue(vmName.equals("vmname"));
-    }
-
-    @Test
-    public void testGetIsoPath() {
-        String isoPath = aic.getIsoPath();
-        assertTrue(isoPath.equals("isopath"));
-    }
-
-    @Test
-    public void testIsAttach() {
-        boolean b = aic.isAttach();
-        assertFalse(b);
-    }
-
-    @Test
-    public void testGetStoreUrl() {
-        aic.setStoreUrl("http://incubator.apache.org/cloudstack/");
-        String url = aic.getStoreUrl();
-        assertTrue(url.equals("http://incubator.apache.org/cloudstack/"));
-    }
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = aic.executeInSequence();
-        assertTrue(b);
-    }
-
-    @Test
-    public void testAllowCaching() {
-        boolean b = aic.allowCaching();
-        assertTrue(b);
-    }
-
-    @Test
-    public void testGetWait() {
-        int b;
-        aic.setWait(5);
-        b = aic.getWait();
-        assertEquals(b, 5);
-        aic.setWait(-3);
-        b = aic.getWait();
-        assertEquals(b, -3);
-        aic.setWait(0);
-        b = aic.getWait();
-        assertEquals(b, 0);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java b/api/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java
deleted file mode 100644
index 251a6cb..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-import com.cloud.agent.api.AttachVolumeAnswer;
-import com.cloud.agent.api.AttachVolumeCommand;
-import com.cloud.storage.Storage.StoragePoolType;
-
-public class AttachVolumeAnswerTest {
-    AttachVolumeCommand avc = new AttachVolumeCommand(true, "vmname",
-            StoragePoolType.Filesystem, "vFolder", "vPath", "vName",
-            123456789L, "chainInfo");
-    AttachVolumeAnswer ava1 = new AttachVolumeAnswer(avc);
-    String results = "";
-    AttachVolumeAnswer ava2 = new AttachVolumeAnswer(avc, results);
-    Long deviceId = 10L;
-    AttachVolumeAnswer ava3 = new AttachVolumeAnswer(avc, deviceId);
-
-    @Test
-    public void testGetDeviceId() {
-        Long dId = ava1.getDeviceId();
-        assertTrue(dId == null);
-
-        dId = ava2.getDeviceId();
-        assertTrue(dId == null);
-
-        dId = ava3.getDeviceId();
-        Long expected = 10L;
-        assertEquals(expected, dId);
-    }
-
-    @Test
-    public void testGetChainInfo() {
-        ava1.setChainInfo("chainInfo");
-        String chainInfo = ava1.getChainInfo();
-        assertTrue(chainInfo.equals("chainInfo"));
-
-        ava2.setChainInfo("chainInfo");
-        chainInfo = ava2.getChainInfo();
-        assertTrue(chainInfo.equals("chainInfo"));
-
-        ava3.setChainInfo("chainInfo");
-        chainInfo = ava3.getChainInfo();
-        assertTrue(chainInfo.equals("chainInfo"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java b/api/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java
deleted file mode 100644
index 1ec416a..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-import com.cloud.agent.api.AttachVolumeCommand;
-import com.cloud.storage.Storage.StoragePoolType;
-
-public class AttachVolumeCommandTest {
-    AttachVolumeCommand avc = new AttachVolumeCommand(true, "vmname",
-            StoragePoolType.Filesystem, "vFolder", "vPath", "vName",
-            123456789L, "chainInfo");
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = avc.executeInSequence();
-        assertTrue(b);
-    }
-
-    @Test
-    public void testGetAttach() {
-        boolean b = avc.getAttach();
-        assertTrue(b);
-    }
-
-    @Test
-    public void testGetVmName() {
-        String vmName = avc.getVmName();
-        assertTrue(vmName.equals("vmname"));
-    }
-
-    @Test
-    public void testGetPooltype() {
-        StoragePoolType pt = avc.getPooltype();
-        assertTrue(pt.equals(StoragePoolType.Filesystem));
-
-        avc.setPooltype(StoragePoolType.NetworkFilesystem);
-        pt = avc.getPooltype();
-        assertTrue(pt.equals(StoragePoolType.NetworkFilesystem));
-
-        avc.setPooltype(StoragePoolType.IscsiLUN);
-        pt = avc.getPooltype();
-        assertTrue(pt.equals(StoragePoolType.IscsiLUN));
-
-        avc.setPooltype(StoragePoolType.Iscsi);
-        pt = avc.getPooltype();
-        assertTrue(pt.equals(StoragePoolType.Iscsi));
-    }
-
-    @Test
-    public void testGetVolumeFolder() {
-        String vFolder = avc.getVolumeFolder();
-        assertTrue(vFolder.equals("vFolder"));
-    }
-
-    @Test
-    public void testGetVolumePath() {
-        String vPath = avc.getVolumePath();
-        assertTrue(vPath.equals("vPath"));
-    }
-
-    @Test
-    public void testGetVolumeName() {
-        String vName = avc.getVolumeName();
-        assertTrue(vName.equals("vName"));
-    }
-
-    @Test
-    public void testGetDeviceId() {
-        Long dId = avc.getDeviceId();
-        Long expected = 123456789L;
-        assertEquals(expected, dId);
-
-        avc.setDeviceId(5L);
-        dId = avc.getDeviceId();
-        expected = 5L;
-        assertEquals(expected, dId);
-
-        avc.setDeviceId(0L);
-        dId = avc.getDeviceId();
-        expected = 0L;
-        assertEquals(expected, dId);
-
-        avc.setDeviceId(-5L);
-        dId = avc.getDeviceId();
-        expected = -5L;
-        assertEquals(expected, dId);
-    }
-
-    @Test
-    public void testGetPoolUuid() {
-        avc.setPoolUuid("420fa39c-4ef1-a83c-fd93-46dc1ff515ae");
-        String pUuid = avc.getPoolUuid();
-        assertTrue(pUuid.equals("420fa39c-4ef1-a83c-fd93-46dc1ff515ae"));
-    }
-
-    @Test
-    public void testGetWait() {
-        String cInfo = avc.getChainInfo();
-        assertTrue(cInfo.equals("chainInfo"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/BackupSnapshotAnswerTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/BackupSnapshotAnswerTest.java b/api/test/org/apache/cloudstack/api/agent/test/BackupSnapshotAnswerTest.java
deleted file mode 100644
index 7fd6e0b..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/BackupSnapshotAnswerTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.cloud.agent.api.BackupSnapshotAnswer;
-import com.cloud.agent.api.BackupSnapshotCommand;
-import com.cloud.storage.StoragePool;
-
-public class BackupSnapshotAnswerTest {
-    private BackupSnapshotCommand bsc;
-    private BackupSnapshotAnswer bsa;
-
-    @Before
-    public void setUp() {
-
-        StoragePool pool = Mockito.mock(StoragePool.class);
-
-        bsc = new BackupSnapshotCommand(
-                "secondaryStoragePoolURL", 101L, 102L, 103L, 104L, 105L,
-                "volumePath", pool, "snapshotUuid", "snapshotName",
-                "prevSnapshotUuid", "prevBackupUuid", false, "vmName", 5);
-        bsa = new BackupSnapshotAnswer(bsc, true, "results", "bussname", false);
-    }
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = bsa.executeInSequence();
-        assertFalse(b);
-    }
-
-    @Test
-    public void testIsFull() {
-        boolean b = bsa.isFull();
-        assertFalse(b);
-    }
-
-    @Test
-    public void testGetBackupSnapshotName() {
-        String name = bsa.getBackupSnapshotName();
-        assertTrue(name.equals("bussname"));
-    }
-
-    @Test
-    public void testGetResult() {
-        boolean b = bsa.getResult();
-        assertTrue(b);
-    }
-
-    @Test
-    public void testDetails() {
-        String details = bsa.getDetails();
-        assertTrue(details.equals("results"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/BackupSnapshotCommandTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/BackupSnapshotCommandTest.java b/api/test/org/apache/cloudstack/api/agent/test/BackupSnapshotCommandTest.java
deleted file mode 100644
index 44d53aa..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/BackupSnapshotCommandTest.java
+++ /dev/null
@@ -1,301 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.junit.Test;
-
-import com.cloud.agent.api.BackupSnapshotCommand;
-import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.agent.api.to.SwiftTO;
-import com.cloud.storage.Storage.StoragePoolType;
-import com.cloud.storage.StoragePool;
-import com.cloud.storage.StoragePoolStatus;
-
-public class BackupSnapshotCommandTest {
-    public StoragePool pool = new StoragePool() {
-        @Override
-        public long getId() {
-            return 1L;
-        };
-
-        @Override
-        public String getName() {
-            return "name";
-        };
-
-        @Override
-        public String getUuid() {
-            return "bed9f83e-cac3-11e1-ac8a-0050568b007e";
-        };
-
-        @Override
-        public StoragePoolType getPoolType() {
-            return StoragePoolType.Filesystem;
-        };
-
-        @Override
-        public Date getCreated() {
-            Date date = null;
-            try {
-                date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
-                .parse("01/01/1970 12:12:12");
-            } catch (ParseException e) {
-                e.printStackTrace();
-            }
-            return date;
-        }
-
-        @Override
-        public Date getUpdateTime() {
-            return new Date();
-        };
-
-        @Override
-        public long getDataCenterId() {
-            return 0L;
-        };
-
-        @Override
-        public long getCapacityBytes() {
-            return 0L;
-        };
-
-        @Override
-        public long getAvailableBytes() {
-            return 0L;
-        };
-
-        @Override
-        public Long getClusterId() {
-            return 0L;
-        };
-
-        @Override
-        public String getHostAddress() {
-            return "hostAddress";
-        };
-
-        @Override
-        public String getPath() {
-            return "path";
-        };
-
-        @Override
-        public String getUserInfo() {
-            return "userInfo";
-        };
-
-        @Override
-        public boolean isShared() {
-            return false;
-        };
-
-        @Override
-        public boolean isLocal() {
-            return false;
-        };
-
-        @Override
-        public StoragePoolStatus getStatus() {
-            return StoragePoolStatus.Up;
-        };
-
-        @Override
-        public int getPort() {
-            return 25;
-        };
-
-        @Override
-        public Long getPodId() {
-            return 0L;
-        }
-
-        @Override
-        public String getStorageProviderName() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public boolean isInMaintenance() {
-            // TODO Auto-generated method stub
-            return false;
-        };
-    };
-
-    BackupSnapshotCommand bsc = new BackupSnapshotCommand(
-            "http://secondary.Storage.Url",
-            101L, 102L, 103L, 104L, 105L, "vPath", pool,
-            "420fa39c-4ef1-a83c-fd93-46dc1ff515ae", "sName",
-            "9012793e-0657-11e2-bebc-0050568b0057",
-            "7167e0b2-f5b0-11e1-8414-0050568b0057", false, "vmName", 5);
-
-    BackupSnapshotCommand bsc1 = new BackupSnapshotCommand(
-            "http://secondary.Storage.Url",
-            101L, 102L, 103L, 104L, 105L,"vPath", pool,
-            "420fa39c-4ef1-a83c-fd93-46dc1ff515ae", "sName",
-            "9012793e-0657-11e2-bebc-0050568b0057",
-            "7167e0b2-f5b0-11e1-8414-0050568b0057", false, "vmName", 5);
-
-    @Test
-    public void testGetPrimaryStoragePoolNameLabel() {
-        String label = bsc.getPrimaryStoragePoolNameLabel();
-        assertTrue(label.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e"));
-    }
-
-    @Test
-    public void testGetSecondaryStorageUrl() {
-        String url = bsc.getSecondaryStorageUrl();
-        assertTrue(url.equals("http://secondary.Storage.Url"));
-    }
-
-    @Test
-    public void testGetDataCenterId() {
-        Long dcId = bsc.getDataCenterId();
-        Long expected = 101L;
-        assertEquals(expected, dcId);
-    }
-
-    @Test
-    public void testGetAccountId() {
-        Long aId = bsc.getAccountId();
-        Long expected = 102L;
-        assertEquals(expected, aId);
-    }
-
-    @Test
-    public void testGetVolumeId() {
-        Long vId = bsc.getVolumeId();
-        Long expected = 103L;
-        assertEquals(expected, vId);
-    }
-
-    @Test
-    public void testGetSnapshotId() {
-        Long ssId = bsc.getSnapshotId();
-        Long expected = 104L;
-        assertEquals(expected, ssId);
-    }
-
-    @Test
-    public void testGetPool() {
-        StorageFilerTO pool = bsc.getPool();
-
-        Long id = pool.getId();
-        Long expectedL = 1L;
-        assertEquals(expectedL, id);
-
-        String uuid = pool.getUuid();
-        assertTrue(uuid.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e"));
-
-        String host = pool.getHost();
-        assertTrue(host.equals("hostAddress"));
-
-        String path = pool.getPath();
-        assertTrue(path.equals("path"));
-
-        String userInfo = pool.getUserInfo();
-        assertTrue(userInfo.equals("userInfo"));
-
-        Integer port = pool.getPort();
-        Integer expectedI = 25;
-        assertEquals(expectedI, port);
-
-        StoragePoolType type = pool.getType();
-        assertEquals(StoragePoolType.Filesystem, type);
-
-        String str = pool.toString();
-        assertTrue(str.equals("Pool[" + id.toString() + "|" + host + ":"
-                + port.toString() + "|" + path + "]"));
-    }
-
-    @Test
-    public void testGetCreated() {
-        try {
-            Date date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
-            .parse("01/01/1970 12:12:12");
-            Date d = pool.getCreated();
-            assertTrue(d.compareTo(date) == 0);
-        } catch (ParseException e) {
-            e.printStackTrace();
-        }
-    }
-
-    @Test
-    public void testGetSwift() {
-        SwiftTO s1 = new SwiftTO();
-        bsc.setSwift(s1);
-        SwiftTO s2 = bsc.getSwift();
-        assertEquals(s1, s2);
-    }
-
-    @Test
-    public void testGetSnapshotName() {
-        String ssName = bsc.getSnapshotName();
-        assertTrue(ssName.equals("sName"));
-    }
-
-    @Test
-    public void testGetSnapshotUuid() {
-        String uuid = bsc.getSnapshotUuid();
-        assertTrue(uuid.equals("420fa39c-4ef1-a83c-fd93-46dc1ff515ae"));
-    }
-
-    @Test
-    public void testGetPrevSnapshotUuid() {
-        String uuid = bsc.getPrevSnapshotUuid();
-        assertTrue(uuid.equals("9012793e-0657-11e2-bebc-0050568b0057"));
-    }
-
-    @Test
-    public void testGetPrevBackupUuid() {
-        String uuid = bsc.getPrevBackupUuid();
-        assertTrue(uuid.equals("7167e0b2-f5b0-11e1-8414-0050568b0057"));
-    }
-
-    @Test
-    public void testGetVolumePath() {
-        String path = bsc.getVolumePath();
-        assertTrue(path.equals("vPath"));
-
-        bsc.setVolumePath("vPath1");
-        path = bsc.getVolumePath();
-        assertTrue(path.equals("vPath1"));
-
-        bsc1.setVolumePath("vPath2");
-        path = bsc1.getVolumePath();
-        assertTrue(path.equals("vPath2"));
-    }
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = bsc.executeInSequence();
-        assertFalse(b);
-
-        b = bsc1.executeInSequence();
-        assertFalse(b);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/BumpUpPriorityCommandTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/BumpUpPriorityCommandTest.java b/api/test/org/apache/cloudstack/api/agent/test/BumpUpPriorityCommandTest.java
deleted file mode 100644
index f5f5985..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/BumpUpPriorityCommandTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-import com.cloud.agent.api.BumpUpPriorityCommand;
-import com.cloud.agent.api.routing.NetworkElementCommand;
-
-public class BumpUpPriorityCommandTest {
-
-    BumpUpPriorityCommand bupc = new BumpUpPriorityCommand();
-
-    // test super class
-    @Test
-    public void testSuperGetAccessDetail() {
-        String value;
-        bupc.setAccessDetail(NetworkElementCommand.ACCOUNT_ID, "accountID");
-        value = bupc.getAccessDetail(NetworkElementCommand.ACCOUNT_ID);
-        assertTrue(value.equals("accountID"));
-
-        bupc.setAccessDetail(NetworkElementCommand.GUEST_NETWORK_CIDR,
-                "GuestNetworkCIDR");
-        value = bupc.getAccessDetail(NetworkElementCommand.GUEST_NETWORK_CIDR);
-        assertTrue(value.equals("GuestNetworkCIDR"));
-
-        bupc.setAccessDetail(NetworkElementCommand.GUEST_NETWORK_GATEWAY,
-                "GuestNetworkGateway");
-        value = bupc
-                .getAccessDetail(NetworkElementCommand.GUEST_NETWORK_GATEWAY);
-        assertTrue(value.equals("GuestNetworkGateway"));
-
-        bupc.setAccessDetail(NetworkElementCommand.GUEST_VLAN_TAG,
-                "GuestVlanTag");
-        value = bupc.getAccessDetail(NetworkElementCommand.GUEST_VLAN_TAG);
-        assertTrue(value.equals("GuestVlanTag"));
-
-        bupc.setAccessDetail(NetworkElementCommand.ROUTER_NAME, "RouterName");
-        value = bupc.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
-        assertTrue(value.equals("RouterName"));
-
-        bupc.setAccessDetail(NetworkElementCommand.ROUTER_IP, "RouterIP");
-        value = bupc.getAccessDetail(NetworkElementCommand.ROUTER_IP);
-        assertTrue(value.equals("RouterIP"));
-
-        bupc.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP,
-                "RouterGuestIP");
-        value = bupc.getAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP);
-        assertTrue(value.equals("RouterGuestIP"));
-
-        bupc.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE,
-                "ZoneNetworkType");
-        value = bupc.getAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE);
-        assertTrue(value.equals("ZoneNetworkType"));
-
-        bupc.setAccessDetail(NetworkElementCommand.GUEST_BRIDGE, "GuestBridge");
-        value = bupc.getAccessDetail(NetworkElementCommand.GUEST_BRIDGE);
-        assertTrue(value.equals("GuestBridge"));
-    }
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = bupc.executeInSequence();
-        assertFalse(b);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/CancelCommandTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/CancelCommandTest.java b/api/test/org/apache/cloudstack/api/agent/test/CancelCommandTest.java
deleted file mode 100644
index 19827fd..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/CancelCommandTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-import com.cloud.agent.api.CancelCommand;
-
-public class CancelCommandTest {
-    CancelCommand cc = new CancelCommand(123456789L, "goodreason");
-
-    @Test
-    public void testGetSequence() {
-        Long s = cc.getSequence();
-        assertTrue(123456789L == s);
-    }
-
-    @Test
-    public void testGetReason() {
-        String r = cc.getReason();
-        assertTrue(r.equals("goodreason"));
-    }
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = cc.executeInSequence();
-        assertFalse(b);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/ChangeAgentAnswerTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/ChangeAgentAnswerTest.java b/api/test/org/apache/cloudstack/api/agent/test/ChangeAgentAnswerTest.java
deleted file mode 100644
index 8933e6e..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/ChangeAgentAnswerTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-import com.cloud.agent.api.ChangeAgentAnswer;
-import com.cloud.agent.api.ChangeAgentCommand;
-import com.cloud.host.Status.Event;
-
-public class ChangeAgentAnswerTest {
-    ChangeAgentCommand cac = new ChangeAgentCommand(123456789L,
-            Event.AgentConnected);
-    ChangeAgentAnswer caa = new ChangeAgentAnswer(cac, true);
-
-    @Test
-    public void testGetResult() {
-        boolean b = caa.getResult();
-        assertTrue(b);
-    }
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = caa.executeInSequence();
-        assertFalse(b);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/ChangeAgentCommandTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/ChangeAgentCommandTest.java b/api/test/org/apache/cloudstack/api/agent/test/ChangeAgentCommandTest.java
deleted file mode 100644
index d0c2bf8..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/ChangeAgentCommandTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-import com.cloud.agent.api.ChangeAgentCommand;
-import com.cloud.host.Status.Event;
-
-public class ChangeAgentCommandTest {
-
-    ChangeAgentCommand cac = new ChangeAgentCommand(123456789L,
-            Event.AgentConnected);
-
-    @Test
-    public void testGetAgentId() {
-        Long aid = cac.getAgentId();
-        assertTrue(123456789L == aid);
-    }
-
-    @Test
-    public void testGetEvent() {
-        Event e = cac.getEvent();
-        assertEquals(Event.AgentConnected, e);
-    }
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = cac.executeInSequence();
-        assertFalse(b);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/CheckHealthAnswerTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/CheckHealthAnswerTest.java b/api/test/org/apache/cloudstack/api/agent/test/CheckHealthAnswerTest.java
deleted file mode 100644
index 6fa94f9..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/CheckHealthAnswerTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-import com.cloud.agent.api.CheckHealthAnswer;
-import com.cloud.agent.api.CheckHealthCommand;
-
-public class CheckHealthAnswerTest {
-    CheckHealthCommand chc = new CheckHealthCommand();
-    CheckHealthAnswer cha = new CheckHealthAnswer(chc, true);
-
-    @Test
-    public void testGetResult() {
-        boolean r = cha.getResult();
-        assertTrue(r);
-    }
-
-    @Test
-    public void testGetDetails() {
-        String d = cha.getDetails();
-        boolean r = cha.getResult();
-        assertTrue(d.equals("resource is " + (r ? "alive" : "not alive")));
-    }
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = cha.executeInSequence();
-        assertFalse(b);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/CheckHealthCommandTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/CheckHealthCommandTest.java b/api/test/org/apache/cloudstack/api/agent/test/CheckHealthCommandTest.java
deleted file mode 100644
index 1b565a5..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/CheckHealthCommandTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-import com.cloud.agent.api.CheckHealthCommand;
-
-public class CheckHealthCommandTest {
-    CheckHealthCommand chc = new CheckHealthCommand();
-
-    @Test
-    public void testGetWait() {
-        int wait = chc.getWait();
-        assertTrue(wait == 50);
-    }
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = chc.executeInSequence();
-        assertFalse(b);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/CheckNetworkAnswerTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/CheckNetworkAnswerTest.java b/api/test/org/apache/cloudstack/api/agent/test/CheckNetworkAnswerTest.java
deleted file mode 100644
index 1853d39..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/CheckNetworkAnswerTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.cloud.agent.api.CheckNetworkAnswer;
-import com.cloud.agent.api.CheckNetworkCommand;
-
-public class CheckNetworkAnswerTest {
-    CheckNetworkCommand cnc;
-    CheckNetworkAnswer cna;
-
-    @Before
-    public void setUp() {
-        cnc = Mockito.mock(CheckNetworkCommand.class);
-        cna = new CheckNetworkAnswer(cnc, true, "details", true);
-    }
-
-    @Test
-    public void testGetResult() {
-        boolean b = cna.getResult();
-        assertTrue(b);
-    }
-
-    @Test
-    public void testGetDetails() {
-        String d = cna.getDetails();
-        assertTrue(d.equals("details"));
-    }
-
-    @Test
-    public void testNeedReconnect() {
-        boolean b = cna.needReconnect();
-        assertTrue(b);
-    }
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = cna.executeInSequence();
-        assertFalse(b);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/CheckNetworkCommandTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/CheckNetworkCommandTest.java b/api/test/org/apache/cloudstack/api/agent/test/CheckNetworkCommandTest.java
deleted file mode 100644
index 0b87b58..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/CheckNetworkCommandTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.cloud.agent.api.CheckNetworkCommand;
-import com.cloud.network.PhysicalNetworkSetupInfo;
-
-public class CheckNetworkCommandTest {
-    CheckNetworkCommand cnc;
-
-    @Before
-    public void setUp() {
-        @SuppressWarnings("unchecked")
-        List<PhysicalNetworkSetupInfo> net = Mockito.mock(List.class);
-        cnc = new CheckNetworkCommand(net);
-    }
-
-    @Test
-    public void testGetPhysicalNetworkInfoList() {
-        List<PhysicalNetworkSetupInfo> networkInfoList = cnc
-                .getPhysicalNetworkInfoList();
-        assertEquals(0, networkInfoList.size());
-    }
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = cnc.executeInSequence();
-        assertTrue(b);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/CheckOnHostCommandTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/CheckOnHostCommandTest.java b/api/test/org/apache/cloudstack/api/agent/test/CheckOnHostCommandTest.java
deleted file mode 100644
index 1b68276..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/CheckOnHostCommandTest.java
+++ /dev/null
@@ -1,483 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.junit.Test;
-
-import com.cloud.agent.api.CheckOnHostCommand;
-import com.cloud.agent.api.to.HostTO;
-import com.cloud.host.Host;
-import com.cloud.host.Status;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.resource.ResourceState;
-
-public class CheckOnHostCommandTest {
-    public Host host = new Host() {
-        public Status getState() {
-            return Status.Up;
-        };
-
-        public long getId() {
-            return 101L;
-        };
-
-
-        @Override
-        public String getUuid() {
-            return "101";
-        }
-
-        public String getName() {
-            return "hostName";
-        };
-
-        public Type getType() {
-            return Host.Type.Storage;
-        };
-
-        public Date getCreated() {
-            Date date = null;
-            try {
-                date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
-                        .parse("01/01/1970 12:12:12");
-            } catch (ParseException e) {
-                e.printStackTrace();
-            }
-            return date;
-        }
-
-        public Status getStatus() {
-            return Status.Up;
-        };
-
-        public String getPrivateIpAddress() {
-            return "10.1.1.1";
-        };
-
-        public String getStorageIpAddress() {
-            return "10.1.1.2";
-        };
-
-        public String getGuid() {
-            return "bed9f83e-cac3-11e1-ac8a-0050568b007e";
-        };
-
-        public Long getTotalMemory() {
-            return 100000000000L;
-        };
-
-        public Integer getCpus() {
-            return 16;
-        };
-
-        public Long getSpeed() {
-            return 2000000000L;
-        };
-
-        public Integer getProxyPort() {
-            return 22;
-        };
-
-        public Long getPodId() {
-            return 16L;
-        };
-
-        public long getDataCenterId() {
-            return 17L;
-        };
-
-        public String getParent() {
-            return "parent";
-        };
-
-        public String getStorageIpAddressDeux() {
-            return "10.1.1.3";
-        };
-
-        public HypervisorType getHypervisorType() {
-            return HypervisorType.XenServer;
-        };
-
-        public Date getDisconnectedOn() {
-            Date date = null;
-            try {
-                date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
-                        .parse("01/01/2012 12:12:12");
-            } catch (ParseException e) {
-                e.printStackTrace();
-            }
-            return date;
-        }
-
-        public String getVersion() {
-            return "4.0.1";
-        };
-
-        public long getTotalSize() {
-            return 100000000000L;
-        };
-
-        public String getCapabilities() {
-            return "capabilities";
-        };
-
-        public long getLastPinged() {
-            return 1L;
-        };
-
-        public Long getManagementServerId() {
-            return 2L;
-        };
-
-        public Date getRemoved() {
-            Date date = null;
-            try {
-                date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
-                        .parse("02/01/2012 12:12:12");
-            } catch (ParseException e) {
-                e.printStackTrace();
-            }
-            return date;
-        };
-
-        public Long getClusterId() {
-            return 3L;
-        };
-
-        public String getPublicIpAddress() {
-            return "10.1.1.4";
-        };
-
-        public String getPublicNetmask() {
-            return "255.255.255.8";
-        };
-
-        public String getPrivateNetmask() {
-            return "255.255.255.16";
-        };
-
-        public String getStorageNetmask() {
-            return "255.255.255.24";
-        };
-
-        public String getStorageMacAddress() {
-            return "01:f4:17:38:0e:26";
-        };
-
-        public String getPublicMacAddress() {
-            return "02:f4:17:38:0e:26";
-        };
-
-        public String getPrivateMacAddress() {
-            return "03:f4:17:38:0e:26";
-        };
-
-        public String getStorageNetmaskDeux() {
-            return "255.255.255.25";
-        };
-
-        public String getStorageMacAddressDeux() {
-            return "01:f4:17:38:0e:27";
-        };
-
-        public String getHypervisorVersion() {
-            return "1.2.3.0";
-        };
-
-        public boolean isInMaintenanceStates() {
-            return false;
-        };
-
-        public ResourceState getResourceState() {
-            return ResourceState.Enabled;
-        };
-    };
-
-    CheckOnHostCommand cohc = new CheckOnHostCommand(host);
-
-    @Test
-    public void testGetHost() {
-        HostTO h = cohc.getHost();
-        assertNotNull(h);
-    }
-
-    @Test
-    public void testGetState() {
-        Status s = host.getState();
-        assertTrue(s == Status.Up);
-    }
-
-    @Test
-    public void testGetId() {
-        Long id = host.getId();
-        assertTrue(101L == id);
-    }
-
-    @Test
-    public void testGetName() {
-        String name = host.getName();
-        assertTrue(name.equals("hostName"));
-    }
-
-    @Test
-    public void testGetType() {
-        Host.Type t = host.getType();
-        assertTrue(t == Host.Type.Storage);
-    }
-
-    @Test
-    public void testGetCreated() {
-        try {
-            Date date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
-                    .parse("01/01/1970 12:12:12");
-            Date d = host.getCreated();
-            assertTrue(d.compareTo(date) == 0);
-        } catch (ParseException e) {
-            e.printStackTrace();
-        }
-    }
-
-    @Test
-    public void testGetStatus() {
-        Status s = host.getStatus();
-        assertTrue(s == Status.Up);
-    }
-
-    @Test
-    public void testGetPrivateIpAddress() {
-        String addr = host.getPrivateIpAddress();
-        assertTrue(addr.equals("10.1.1.1"));
-    }
-
-    @Test
-    public void testGetStorageIpAddress() {
-        String addr = host.getStorageIpAddress();
-        assertTrue(addr.equals("10.1.1.2"));
-    }
-
-    @Test
-    public void testGetGuid() {
-        String guid = host.getGuid();
-        assertTrue(guid.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e"));
-    }
-
-    @Test
-    public void testGetTotalMemory() {
-        Long m = host.getTotalMemory();
-        assertTrue(m == 100000000000L);
-    }
-
-    @Test
-    public void testGetCpus() {
-        int cpus = host.getCpus();
-        assertTrue(cpus == 16);
-    }
-
-    @Test
-    public void testGetSpeed() {
-        Long spped = host.getSpeed();
-        assertTrue(spped == 2000000000L);
-    }
-
-    @Test
-    public void testGetProxyPort() {
-        Integer port = host.getProxyPort();
-        assertTrue(port == 22);
-    }
-
-    @Test
-    public void testGetPodId() {
-        Long pID = host.getPodId();
-        assertTrue(pID == 16L);
-    }
-
-    @Test
-    public void testGetDataCenterId() {
-        long dcID = host.getDataCenterId();
-        assertTrue(dcID == 17L);
-    }
-
-    @Test
-    public void testGetParent() {
-        String p = host.getParent();
-        assertTrue(p.equals("parent"));
-    }
-
-    @Test
-    public void testGetStorageIpAddressDeux() {
-        String addr = host.getStorageIpAddressDeux();
-        assertTrue(addr.equals("10.1.1.3"));
-    }
-
-    @Test
-    public void testGetHypervisorType() {
-        HypervisorType type = host.getHypervisorType();
-        assertTrue(type == HypervisorType.XenServer);
-    }
-
-    @Test
-    public void testGetDisconnectedOn() {
-        try {
-            Date date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
-                    .parse("01/01/2012 12:12:12");
-            Date d = host.getDisconnectedOn();
-            assertTrue(d.compareTo(date) == 0);
-        } catch (ParseException e) {
-            e.printStackTrace();
-        }
-    }
-
-    @Test
-    public void testGetVersion() {
-        String v = host.getVersion();
-        assertTrue(v.equals("4.0.1"));
-    }
-
-    @Test
-    public void testGetTotalSize() {
-        long size = host.getTotalSize();
-        assertTrue(size == 100000000000L);
-    }
-
-    @Test
-    public void testGetCapabilities() {
-        String c = host.getCapabilities();
-        assertTrue(c.equals("capabilities"));
-    }
-
-    @Test
-    public void testGetLastPinged() {
-        long lp = host.getLastPinged();
-        assertTrue(lp == 1L);
-    }
-
-    @Test
-    public void testGetManagementServerId() {
-        Long msID = host.getManagementServerId();
-        assertTrue(msID == 2L);
-    }
-
-    @Test
-    public void testGetRemoved() {
-        try {
-            Date date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
-                    .parse("02/01/2012 12:12:12");
-            Date d = host.getRemoved();
-            assertTrue(d.compareTo(date) == 0);
-        } catch (ParseException e) {
-            e.printStackTrace();
-        }
-    }
-
-    @Test
-    public void testGetClusterId() {
-        Long cID = host.getClusterId();
-        assertTrue(cID == 3L);
-    }
-
-    @Test
-    public void testGetPublicIpAddress() {
-        String pipAddr = host.getPublicIpAddress();
-        assertTrue(pipAddr.equals("10.1.1.4"));
-    }
-
-    @Test
-    public void testGetPublicNetmask() {
-        String pMask = host.getPublicNetmask();
-        assertTrue(pMask.equals("255.255.255.8"));
-    }
-
-    @Test
-    public void testGetPrivateNetmask() {
-        String pMask = host.getPrivateNetmask();
-        assertTrue(pMask.equals("255.255.255.16"));
-    }
-
-    @Test
-    public void testGetStorageNetmask() {
-        String sMask = host.getStorageNetmask();
-        assertTrue(sMask.equals("255.255.255.24"));
-    }
-
-    @Test
-    public void testGetStorageMacAddress() {
-        String sMac = host.getStorageMacAddress();
-        assertTrue(sMac.equals("01:f4:17:38:0e:26"));
-    }
-
-    @Test
-    public void testGetPublicMacAddress() {
-        String pMac = host.getPublicMacAddress();
-        assertTrue(pMac.equals("02:f4:17:38:0e:26"));
-    }
-
-    @Test
-    public void testGetPrivateMacAddress() {
-        String pMac = host.getPrivateMacAddress();
-        assertTrue(pMac.equals("03:f4:17:38:0e:26"));
-    }
-
-    @Test
-    public void testGetStorageNetmaskDeux() {
-        String sMask = host.getStorageNetmaskDeux();
-        assertTrue(sMask.equals("255.255.255.25"));
-    }
-
-    @Test
-    public void testGetStorageMacAddressDeux() {
-        String sMac = host.getStorageMacAddressDeux();
-        assertTrue(sMac.equals("01:f4:17:38:0e:27"));
-    }
-
-    @Test
-    public void testGetHypervisorVersion() {
-        String v = host.getHypervisorVersion();
-        assertTrue(v.equals("1.2.3.0"));
-    }
-
-    @Test
-    public void testIsInMaintenanceStates() {
-        boolean b = host.isInMaintenanceStates();
-        assertFalse(b);
-    }
-
-    @Test
-    public void testGetResourceState() {
-        ResourceState r = host.getResourceState();
-        assertTrue(r == ResourceState.Enabled);
-    }
-
-    @Test
-    public void testGetWait() {
-        int wait = cohc.getWait();
-        assertTrue(20 == wait);
-    }
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = cohc.executeInSequence();
-        assertFalse(b);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java b/api/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java
deleted file mode 100644
index c2d69c0..0000000
--- a/api/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java
+++ /dev/null
@@ -1,209 +0,0 @@
-// 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 org.apache.cloudstack.api.agent.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.cloud.agent.api.SnapshotCommand;
-import com.cloud.storage.Storage.StoragePoolType;
-import com.cloud.storage.StoragePool;
-import com.cloud.storage.StoragePoolStatus;
-
-public class SnapshotCommandTest {
-
-    public StoragePool pool = new StoragePool() {
-        public long getId() {
-            return 1L;
-        };
-
-        public String getName() {
-            return "name";
-        };
-
-        public String getUuid() {
-            return "bed9f83e-cac3-11e1-ac8a-0050568b007e";
-        };
-
-        public StoragePoolType getPoolType() {
-            return StoragePoolType.Filesystem;
-        };
-
-        public Date getCreated() {
-            Date date = null;
-            try {
-                date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
-                        .parse("01/01/1970 12:12:12");
-            } catch (ParseException e) {
-                e.printStackTrace();
-            }
-            return date;
-        }
-
-        public Date getUpdateTime() {
-            return new Date();
-        };
-
-        public long getDataCenterId() {
-            return 0L;
-        };
-
-        public long getCapacityBytes() {
-            return 0L;
-        };
-
-        public long getAvailableBytes() {
-            return 0L;
-        };
-
-        public Long getClusterId() {
-            return 0L;
-        };
-
-        public String getHostAddress() {
-            return "hostAddress";
-        };
-
-        public String getPath() {
-            return "path";
-        };
-
-        public String getUserInfo() {
-            return "userInfo";
-        };
-
-        public boolean isShared() {
-            return false;
-        };
-
-        public boolean isLocal() {
-            return false;
-        };
-
-        public StoragePoolStatus getStatus() {
-            return StoragePoolStatus.Up;
-        };
-
-        public int getPort() {
-            return 25;
-        };
-
-        public Long getPodId() {
-            return 0L;
-        }
-
-		@Override
-		public String getStorageProviderName() {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-        @Override
-        public boolean isInMaintenance() {
-            // TODO Auto-generated method stub
-            return false;
-        };
-    };
-
-    SnapshotCommand ssc = new SnapshotCommand(pool,
-            "http://secondary.Storage.Url",
-            "420fa39c-4ef1-a83c-fd93-46dc1ff515ae", "snapshotName", 101L, 102L,
-            103L);
-
-    SnapshotCommand ssc1;
-
-
-    @Before
-    public void setUp() {
-        ssc1 = new SnapshotCommand(pool,
-                "secondaryStorageUrl", "snapshotUuid", "snapshotName", 101L,
-                102L, 103L);
-    }
-
-    @Test
-    public void testGetPrimaryStoragePoolNameLabel() {
-        String label = ssc.getPrimaryStoragePoolNameLabel();
-        assertTrue(label.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e"));
-    }
-
-    @Test
-    public void testGetSecondaryStorageUrl() {
-        String url = ssc.getSecondaryStorageUrl();
-        assertTrue(url.equals("http://secondary.Storage.Url"));
-    }
-
-    @Test
-    public void testGetSnapshotUuid() {
-        String uuid = ssc.getSnapshotUuid();
-        assertTrue(uuid.equals("420fa39c-4ef1-a83c-fd93-46dc1ff515ae"));
-    }
-
-    @Test
-    public void testGetSnapshotName() {
-        String name = ssc.getSnapshotName();
-        assertTrue(name.equals("snapshotName"));
-    }
-
-    @Test
-    public void testGetVolumePath() {
-        ssc.setVolumePath("vPath");
-        String path = ssc.getVolumePath();
-        assertTrue(path.equals("vPath"));
-
-        ssc1.setVolumePath("vPath1");
-        path = ssc1.getVolumePath();
-        assertTrue(path.equals("vPath1"));
-    }
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = ssc.executeInSequence();
-        assertFalse(b);
-
-        b = ssc1.executeInSequence();
-        assertFalse(b);
-    }
-
-    @Test
-    public void testGetDataCenterId() {
-        Long dcId = ssc.getDataCenterId();
-        Long expected = 101L;
-        assertEquals(expected, dcId);
-    }
-
-    @Test
-    public void testGetAccountId() {
-        Long aId = ssc.getAccountId();
-        Long expected = 102L;
-        assertEquals(expected, aId);
-    }
-
-    @Test
-    public void testGetVolumeId() {
-        Long vId = ssc.getVolumeId();
-        Long expected = 103L;
-        assertEquals(expected, vId);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/command/test/AddIpToVmNicTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/AddIpToVmNicTest.java b/api/test/org/apache/cloudstack/api/command/test/AddIpToVmNicTest.java
index 106589d..e5015cb 100644
--- a/api/test/org/apache/cloudstack/api/command/test/AddIpToVmNicTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/AddIpToVmNicTest.java
@@ -16,6 +16,7 @@
 // under the License.
 package org.apache.cloudstack.api.command.test;
 
+import com.cloud.vm.NicSecondaryIp;
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
@@ -64,15 +65,16 @@ public class AddIpToVmNicTest extends TestCase {
 
         NetworkService networkService = Mockito.mock(NetworkService.class);
         AddIpToVmNicCmd ipTonicCmd = Mockito.mock(AddIpToVmNicCmd.class);
+        NicSecondaryIp secIp = Mockito.mock(NicSecondaryIp.class);
 
         Mockito.when(
-                networkService.allocateSecondaryGuestIP(Mockito.any(Account.class), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyString())).thenReturn("10.1.1.2");
+                networkService.allocateSecondaryGuestIP(Mockito.any(Account.class), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyString())).thenReturn(secIp);
 
         ipTonicCmd._networkService = networkService;
         responseGenerator = Mockito.mock(ResponseGenerator.class);
 
         NicSecondaryIpResponse ipres = Mockito.mock(NicSecondaryIpResponse.class);
-        Mockito.when(responseGenerator.createSecondaryIPToNicResponse(Mockito.anyString(), Mockito.anyLong(), Mockito.anyLong())).thenReturn(ipres);
+        Mockito.when(responseGenerator.createSecondaryIPToNicResponse(secIp)).thenReturn(ipres);
 
         ipTonicCmd._responseGenerator = responseGenerator;
         ipTonicCmd.execute();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
index 301fa02..8a28290 100644
--- a/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
@@ -16,31 +16,20 @@
 // under the License.
 package org.apache.cloudstack.api.command.test;
 
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
 import com.cloud.uservm.UserVm;
 import com.cloud.vm.UserVmService;
 import junit.framework.Assert;
 import junit.framework.TestCase;
 import org.apache.cloudstack.api.ResponseGenerator;
 import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.command.admin.region.AddRegionCmd;
 import org.apache.cloudstack.api.command.user.vm.ScaleVMCmd;
-import org.apache.cloudstack.api.response.RegionResponse;
-import org.apache.cloudstack.api.response.UserVmResponse;
-import org.apache.cloudstack.region.Region;
-import org.apache.cloudstack.region.RegionService;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.mockito.Mockito;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-
 public class ScaleVMCmdTest extends TestCase{
 
     private ScaleVMCmd scaleVMCmd;
@@ -57,12 +46,11 @@ public class ScaleVMCmdTest extends TestCase{
             public Long getId() {
                 return 2L;
             }
+            @Override
+            public String getCommandName() {
+                return "scalevirtualmachineresponse";
+            }
         };
-
-       //Account account = new AccountVO("testaccount", 1L, "networkdomain", (short) 0, "uuid");
-       //UserContext.registerContext(1, account, null, true);
-
-
     }
 
 
@@ -71,11 +59,10 @@ public class ScaleVMCmdTest extends TestCase{
 
         UserVmService userVmService = Mockito.mock(UserVmService.class);
 
-        UserVm uservm = Mockito.mock(UserVm.class);
         try {
             Mockito.when(
                     userVmService.upgradeVirtualMachine(scaleVMCmd))
-                    .thenReturn(uservm);
+                    .thenReturn(true);
         }catch (Exception e){
             Assert.fail("Received exception when success expected " +e.getMessage());
         }
@@ -83,13 +70,6 @@ public class ScaleVMCmdTest extends TestCase{
         scaleVMCmd._userVmService = userVmService;
         responseGenerator = Mockito.mock(ResponseGenerator.class);
 
-        UserVmResponse userVmResponse = Mockito.mock(UserVmResponse.class);
-        List<UserVmResponse> responseList = new ArrayList<UserVmResponse>();
-        responseList.add(userVmResponse);
-
-        Mockito.when(responseGenerator.createUserVmResponse("virtualmachine",uservm))
-                .thenReturn(responseList);
-
         scaleVMCmd._responseGenerator = responseGenerator;
         scaleVMCmd.execute();
 
@@ -101,10 +81,9 @@ public class ScaleVMCmdTest extends TestCase{
         UserVmService userVmService = Mockito.mock(UserVmService.class);
 
         try {
-            UserVm uservm = Mockito.mock(UserVm.class);
             Mockito.when(
                     userVmService.upgradeVirtualMachine(scaleVMCmd))
-                    .thenReturn(null);
+                    .thenReturn(false);
         }catch (Exception e){
             Assert.fail("Received exception when success expected " +e.getMessage());
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/api/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java
----------------------------------------------------------------------
diff --git a/api/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java b/api/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java
deleted file mode 100644
index 02085f5..0000000
--- a/api/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java
+++ /dev/null
@@ -1,229 +0,0 @@
-// 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 src.com.cloud.agent.api.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.junit.Test;
-
-import com.cloud.agent.api.storage.ResizeVolumeCommand;
-import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.storage.Storage.StoragePoolType;
-import com.cloud.storage.StoragePool;
-import com.cloud.storage.StoragePoolStatus;
-
-
-public class ResizeVolumeCommandTest {
-
-    public StoragePool dummypool = new StoragePool() {
-        @Override
-        public long getId() {
-            return 1L;
-        };
-
-        @Override
-        public String getName() {
-            return "name";
-        };
-
-        @Override
-        public String getUuid() {
-            return "bed9f83e-cac3-11e1-ac8a-0050568b007e";
-        };
-
-        @Override
-        public StoragePoolType getPoolType() {
-            return StoragePoolType.Filesystem;
-        };
-
-        @Override
-        public Date getCreated() {
-            Date date = null;
-            try {
-                date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
-                .parse("01/01/1970 12:12:12");
-            } catch (ParseException e) {
-                e.printStackTrace();
-            }
-            return date;
-        }
-
-        @Override
-        public Date getUpdateTime() {
-            return new Date();
-        };
-
-        @Override
-        public long getDataCenterId() {
-            return 0L;
-        };
-
-        @Override
-        public long getCapacityBytes() {
-            return 0L;
-        };
-
-        @Override
-        public long getAvailableBytes() {
-            return 0L;
-        };
-
-        @Override
-        public Long getClusterId() {
-            return 0L;
-        };
-
-        @Override
-        public String getHostAddress() {
-            return "hostAddress";
-        };
-
-        @Override
-        public String getPath() {
-            return "path";
-        };
-
-        @Override
-        public String getUserInfo() {
-            return "userInfo";
-        };
-
-        @Override
-        public boolean isShared() {
-            return false;
-        };
-
-        @Override
-        public boolean isLocal() {
-            return false;
-        };
-
-        @Override
-        public StoragePoolStatus getStatus() {
-            return StoragePoolStatus.Up;
-        };
-
-        @Override
-        public int getPort() {
-            return 25;
-        };
-
-        @Override
-        public Long getPodId() {
-            return 0L;
-        }
-
-        @Override
-        public String getStorageProviderName() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public boolean isInMaintenance() {
-            // TODO Auto-generated method stub
-            return false;
-        };
-    };
-
-    Long newSize = 4194304L;
-    Long currentSize = 1048576L;
-
-    ResizeVolumeCommand rv = new ResizeVolumeCommand("dummydiskpath", 
-            new StorageFilerTO(dummypool), currentSize, newSize, false, 
-            "vmName");
-
-    @Test
-    public void testExecuteInSequence() {
-        boolean b = rv.executeInSequence();
-        assertFalse(b);
-    }
-
-    @Test
-    public void testGetPath() {
-        String path = rv.getPath();
-        assertTrue(path.equals("dummydiskpath"));
-    }
-
-    @Test
-    public void testGetPoolUuid() {
-        String poolUuid = rv.getPoolUuid();
-        assertTrue(poolUuid.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e"));
-    }
-
-    @Test
-    public void testGetPool() {
-        StorageFilerTO pool = rv.getPool();
-
-        Long id = pool.getId();
-        Long expectedL = 1L;
-        assertEquals(expectedL, id);
-
-        String uuid = pool.getUuid();
-        assertTrue(uuid.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e"));
-
-        String host = pool.getHost();
-        assertTrue(host.equals("hostAddress"));
-
-        String path = pool.getPath();
-        assertTrue(path.equals("path"));
-
-        String userInfo = pool.getUserInfo();
-        assertTrue(userInfo.equals("userInfo"));
-
-        Integer port = pool.getPort();
-        Integer expectedI = 25;
-        assertEquals(expectedI, port);
-
-        StoragePoolType type = pool.getType();
-        assertEquals(StoragePoolType.Filesystem, type);
-
-        String str = pool.toString();
-        assertTrue(str.equals("Pool[" + id.toString() + "|" + host + ":"
-                + port.toString() + "|" + path + "]"));
-    }
-
-    @Test
-    public void testGetNewSize() {
-        long newSize = rv.getNewSize();
-        assertTrue(newSize == 4194304L);
-    }
-
-    @Test
-    public void testGetCurrentSize() {
-        long currentSize = rv.getCurrentSize();
-        assertTrue(currentSize == 1048576L);
-    }
-
-    @Test
-    public void testGetShrinkOk() {
-        assertFalse(rv.getShrinkOk());
-    }
-
-    @Test
-    public void testGetInstanceName() {
-        String vmName = rv.getInstanceName();
-        assertTrue(vmName.equals("vmName"));
-    }
-
-}


[51/57] [abbrv] [partial] git commit: updated refs/heads/master to f84b6ab

Posted by ni...@apache.org.
merge master


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

Branch: refs/heads/master
Commit: c11dbad9c9ba7a876243ec02e90215906cfd9115
Parents: 836a3f1
Author: Nitin Mehta <ni...@citrix.com>
Authored: Sat May 11 15:28:43 2013 +0530
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Sat May 11 15:28:43 2013 +0530

----------------------------------------------------------------------
 .gitignore                                         |    6 +-
 agent/conf/agent.properties                        |    2 +-
 .../com/cloud/agent/api/AgentControlAnswer.java    |   30 -
 .../com/cloud/agent/api/AgentControlCommand.java   |   27 -
 api/src/com/cloud/agent/api/AttachIsoCommand.java  |   59 -
 .../com/cloud/agent/api/AttachVolumeAnswer.java    |   58 -
 .../com/cloud/agent/api/AttachVolumeCommand.java   |   99 -
 .../com/cloud/agent/api/BackupSnapshotAnswer.java  |   44 -
 .../com/cloud/agent/api/BackupSnapshotCommand.java |  121 -
 .../com/cloud/agent/api/BumpUpPriorityCommand.java |   30 -
 api/src/com/cloud/agent/api/CancelCommand.java     |   45 -
 api/src/com/cloud/agent/api/ChangeAgentAnswer.java |   26 -
 .../com/cloud/agent/api/ChangeAgentCommand.java    |   46 -
 api/src/com/cloud/agent/api/CheckHealthAnswer.java |   26 -
 .../com/cloud/agent/api/CheckHealthCommand.java    |   30 -
 .../com/cloud/agent/api/CheckNetworkAnswer.java    |   38 -
 .../com/cloud/agent/api/CheckNetworkCommand.java   |   42 -
 api/src/com/cloud/agent/api/CheckOnHostAnswer.java |   48 -
 .../com/cloud/agent/api/CheckOnHostCommand.java    |   42 -
 api/src/com/cloud/agent/api/CheckRouterAnswer.java |   81 -
 .../com/cloud/agent/api/CheckRouterCommand.java    |   30 -
 .../agent/api/CheckS2SVpnConnectionsAnswer.java    |   71 -
 .../agent/api/CheckS2SVpnConnectionsCommand.java   |   39 -
 api/src/com/cloud/agent/api/CheckStateAnswer.java  |   45 -
 api/src/com/cloud/agent/api/CheckStateCommand.java |   40 -
 .../cloud/agent/api/CheckVirtualMachineAnswer.java |   52 -
 .../agent/api/CheckVirtualMachineCommand.java      |   41 -
 .../cloud/agent/api/CleanupNetworkRulesCmd.java    |   47 -
 .../agent/api/CleanupSnapshotBackupCommand.java    |   75 -
 api/src/com/cloud/agent/api/ClusterSyncAnswer.java |   55 -
 .../com/cloud/agent/api/ClusterSyncCommand.java    |   47 -
 .../cloud/agent/api/ComputeChecksumCommand.java    |   40 -
 .../api/ConsoleAccessAuthenticationAnswer.java     |   88 -
 .../api/ConsoleAccessAuthenticationCommand.java    |   68 -
 .../agent/api/ConsoleProxyLoadReportCommand.java   |   39 -
 .../CreatePrivateTemplateFromSnapshotCommand.java  |   82 -
 .../CreatePrivateTemplateFromVolumeCommand.java    |   93 -
 .../cloud/agent/api/CreateStoragePoolCommand.java  |   30 -
 .../cloud/agent/api/CreateVMSnapshotAnswer.java    |   62 -
 .../cloud/agent/api/CreateVMSnapshotCommand.java   |   42 -
 .../agent/api/CreateVolumeFromSnapshotAnswer.java  |   38 -
 .../agent/api/CreateVolumeFromSnapshotCommand.java |   58 -
 .../api/CreateVolumeFromVMSnapshotAnswer.java      |   54 -
 .../api/CreateVolumeFromVMSnapshotCommand.java     |   88 -
 api/src/com/cloud/agent/api/CronCommand.java       |   24 -
 .../agent/api/DeleteObjectFromSwiftCommand.java    |   61 -
 .../agent/api/DeleteSnapshotBackupAnswer.java      |   32 -
 .../agent/api/DeleteSnapshotBackupCommand.java     |   96 -
 .../cloud/agent/api/DeleteSnapshotsDirCommand.java |   63 -
 .../cloud/agent/api/DeleteStoragePoolCommand.java  |   61 -
 .../agent/api/DeleteTemplateFromS3Command.java     |  106 -
 .../cloud/agent/api/DeleteVMSnapshotAnswer.java    |   49 -
 .../cloud/agent/api/DeleteVMSnapshotCommand.java   |   28 -
 .../agent/api/DownloadSnapshotFromS3Command.java   |   61 -
 ...oadTemplateFromS3ToSecondaryStorageCommand.java |   66 -
 api/src/com/cloud/agent/api/FenceAnswer.java       |   36 -
 api/src/com/cloud/agent/api/FenceCommand.java      |   61 -
 .../com/cloud/agent/api/GetDomRVersionAnswer.java  |   45 -
 api/src/com/cloud/agent/api/GetDomRVersionCmd.java |   30 -
 .../com/cloud/agent/api/GetFileStatsAnswer.java    |   37 -
 .../com/cloud/agent/api/GetFileStatsCommand.java   |   41 -
 .../com/cloud/agent/api/GetHostStatsAnswer.java    |   88 -
 .../com/cloud/agent/api/GetHostStatsCommand.java   |   53 -
 .../com/cloud/agent/api/GetStorageStatsAnswer.java |   51 -
 .../cloud/agent/api/GetStorageStatsCommand.java    |   76 -
 api/src/com/cloud/agent/api/GetVmStatsAnswer.java  |   40 -
 api/src/com/cloud/agent/api/GetVmStatsCommand.java |   54 -
 api/src/com/cloud/agent/api/GetVncPortAnswer.java  |   48 -
 api/src/com/cloud/agent/api/GetVncPortCommand.java |   43 -
 api/src/com/cloud/agent/api/HostStatsEntry.java    |  113 -
 api/src/com/cloud/agent/api/MaintainAnswer.java    |   46 -
 api/src/com/cloud/agent/api/MaintainCommand.java   |   28 -
 .../com/cloud/agent/api/ManageSnapshotAnswer.java  |   40 -
 .../com/cloud/agent/api/ManageSnapshotCommand.java |   92 -
 api/src/com/cloud/agent/api/MigrateAnswer.java     |   33 -
 api/src/com/cloud/agent/api/MigrateCommand.java    |   59 -
 .../cloud/agent/api/MigrateWithStorageAnswer.java  |   39 -
 .../cloud/agent/api/MigrateWithStorageCommand.java |   45 -
 .../api/MigrateWithStorageCompleteAnswer.java      |   38 -
 .../api/MigrateWithStorageCompleteCommand.java     |   36 -
 .../agent/api/MigrateWithStorageReceiveAnswer.java |   55 -
 .../api/MigrateWithStorageReceiveCommand.java      |   45 -
 .../agent/api/MigrateWithStorageSendAnswer.java    |   39 -
 .../agent/api/MigrateWithStorageSendCommand.java   |   58 -
 .../com/cloud/agent/api/ModifySshKeysCommand.java  |   44 -
 .../cloud/agent/api/ModifyStoragePoolAnswer.java   |   57 -
 .../cloud/agent/api/ModifyStoragePoolCommand.java  |   75 -
 .../com/cloud/agent/api/NetworkUsageAnswer.java    |   61 -
 .../com/cloud/agent/api/NetworkUsageCommand.java   |   98 -
 api/src/com/cloud/agent/api/PingAnswer.java        |   33 -
 api/src/com/cloud/agent/api/PingCommand.java       |   45 -
 .../com/cloud/agent/api/PingRoutingCommand.java    |   54 -
 .../agent/api/PingRoutingWithNwGroupsCommand.java  |   46 -
 .../cloud/agent/api/PingRoutingWithOvsCommand.java |   42 -
 .../com/cloud/agent/api/PingStorageCommand.java    |   37 -
 api/src/com/cloud/agent/api/PingTestCommand.java   |   54 -
 api/src/com/cloud/agent/api/PlugNicAnswer.java     |   25 -
 api/src/com/cloud/agent/api/PlugNicCommand.java    |   46 -
 api/src/com/cloud/agent/api/PoolEjectCommand.java  |   42 -
 .../cloud/agent/api/PrepareForMigrationAnswer.java |   34 -
 .../agent/api/PrepareForMigrationCommand.java      |   39 -
 .../cloud/agent/api/PrepareOCFS2NodesCommand.java  |   44 -
 .../agent/api/PropagateResourceEventCommand.java   |   48 -
 api/src/com/cloud/agent/api/ReadyAnswer.java       |   31 -
 api/src/com/cloud/agent/api/ReadyCommand.java      |   58 -
 api/src/com/cloud/agent/api/RebootAnswer.java      |   42 -
 api/src/com/cloud/agent/api/RebootCommand.java     |   45 -
 .../com/cloud/agent/api/RebootRouterCommand.java   |   38 -
 .../cloud/agent/api/RevertToVMSnapshotAnswer.java  |   63 -
 .../cloud/agent/api/RevertToVMSnapshotCommand.java |   29 -
 api/src/com/cloud/agent/api/ScaleVmAnswer.java     |   28 -
 api/src/com/cloud/agent/api/ScaleVmCommand.java    |  113 -
 .../agent/api/ScheduleHostScanTaskCommand.java     |   32 -
 .../agent/api/SecStorageFirewallCfgCommand.java    |   82 -
 .../com/cloud/agent/api/SecStorageSetupAnswer.java |   33 -
 .../cloud/agent/api/SecStorageSetupCommand.java    |   83 -
 .../cloud/agent/api/SecStorageVMSetupCommand.java  |   57 -
 .../cloud/agent/api/SecurityGroupRuleAnswer.java   |   70 -
 .../com/cloud/agent/api/SecurityGroupRulesCmd.java |  304 --
 api/src/com/cloud/agent/api/SetupAnswer.java       |   37 -
 api/src/com/cloud/agent/api/SetupCommand.java      |   60 -
 .../cloud/agent/api/SetupGuestNetworkAnswer.java   |   25 -
 .../cloud/agent/api/SetupGuestNetworkCommand.java  |   72 -
 api/src/com/cloud/agent/api/ShutdownCommand.java   |   56 -
 api/src/com/cloud/agent/api/SnapshotCommand.java   |  126 -
 api/src/com/cloud/agent/api/StartAnswer.java       |   57 -
 api/src/com/cloud/agent/api/StartCommand.java      |   52 -
 api/src/com/cloud/agent/api/StartupAnswer.java     |   44 -
 api/src/com/cloud/agent/api/StartupCommand.java    |  286 --
 .../agent/api/StartupExternalDhcpCommand.java      |   25 -
 .../agent/api/StartupExternalFirewallCommand.java  |   26 -
 .../api/StartupExternalLoadBalancerCommand.java    |   26 -
 .../com/cloud/agent/api/StartupProxyCommand.java   |   49 -
 .../cloud/agent/api/StartupPxeServerCommand.java   |   25 -
 .../com/cloud/agent/api/StartupRoutingCommand.java |  224 --
 .../agent/api/StartupSecondaryStorageCommand.java  |   32 -
 .../com/cloud/agent/api/StartupStorageCommand.java |  110 -
 .../agent/api/StartupTrafficMonitorCommand.java    |   26 -
 api/src/com/cloud/agent/api/StopAnswer.java        |   45 -
 api/src/com/cloud/agent/api/StopCommand.java       |   71 -
 .../com/cloud/agent/api/TransferAgentCommand.java  |   57 -
 api/src/com/cloud/agent/api/UnPlugNicAnswer.java   |   25 -
 api/src/com/cloud/agent/api/UnPlugNicCommand.java  |   45 -
 .../com/cloud/agent/api/UnregisterVMCommand.java   |   34 -
 .../cloud/agent/api/UpdateHostPasswordCommand.java |   48 -
 api/src/com/cloud/agent/api/UpgradeAnswer.java     |   26 -
 api/src/com/cloud/agent/api/UpgradeCommand.java    |   42 -
 .../cloud/agent/api/UpgradeSnapshotCommand.java    |   64 -
 ...oadTemplateToS3FromSecondaryStorageCommand.java |  121 -
 .../com/cloud/agent/api/VMSnapshotBaseCommand.java |   74 -
 api/src/com/cloud/agent/api/VMSnapshotTO.java      |   90 -
 .../cloud/agent/api/ValidateSnapshotAnswer.java    |   53 -
 .../cloud/agent/api/ValidateSnapshotCommand.java   |   84 -
 api/src/com/cloud/agent/api/VmStatsEntry.java      |   82 -
 .../agent/api/baremetal/IpmISetBootDevCommand.java |   43 -
 .../api/baremetal/IpmiBootorResetCommand.java      |   28 -
 .../api/baremetal/PreparePxeServerAnswer.java      |   29 -
 .../api/baremetal/PreparePxeServerCommand.java     |   80 -
 .../baremetal/prepareCreateTemplateCommand.java    |   66 -
 .../com/cloud/agent/api/check/CheckSshAnswer.java  |   37 -
 .../com/cloud/agent/api/check/CheckSshCommand.java |   65 -
 .../api/downloadSnapshotFromSwiftCommand.java      |   60 -
 ...TemplateFromSwiftToSecondaryStorageCommand.java |   90 -
 .../api/proxy/CheckConsoleProxyLoadCommand.java    |   60 -
 .../agent/api/proxy/ConsoleProxyLoadAnswer.java    |   44 -
 .../com/cloud/agent/api/proxy/ProxyCommand.java    |   25 -
 .../StartConsoleProxyAgentHttpHandlerCommand.java  |   68 -
 .../api/proxy/WatchConsoleProxyLoadCommand.java    |   65 -
 .../CreateLoadBalancerApplianceCommand.java        |   48 -
 .../DestroyLoadBalancerApplianceCommand.java       |   32 -
 .../cloud/agent/api/routing/DhcpEntryCommand.java  |  142 -
 .../routing/GlobalLoadBalancerConfigAnswer.java    |   27 -
 .../routing/GlobalLoadBalancerConfigCommand.java   |  100 -
 .../api/routing/HealthCheckLBConfigAnswer.java     |   42 -
 .../api/routing/HealthCheckLBConfigCommand.java    |   39 -
 .../com/cloud/agent/api/routing/IpAssocAnswer.java |   48 -
 .../cloud/agent/api/routing/IpAssocCommand.java    |   42 -
 .../cloud/agent/api/routing/IpAssocVpcCommand.java |   29 -
 .../api/routing/LoadBalancerConfigCommand.java     |   66 -
 .../agent/api/routing/NetworkElementCommand.java   |   53 -
 .../api/routing/RemoteAccessVpnCfgCommand.java     |   78 -
 .../agent/api/routing/SavePasswordCommand.java     |   54 -
 .../agent/api/routing/SetFirewallRulesAnswer.java  |   36 -
 .../agent/api/routing/SetFirewallRulesCommand.java |   98 -
 .../agent/api/routing/SetNetworkACLAnswer.java     |   36 -
 .../agent/api/routing/SetNetworkACLCommand.java    |   97 -
 .../api/routing/SetPortForwardingRulesAnswer.java  |   37 -
 .../api/routing/SetPortForwardingRulesCommand.java |   40 -
 .../routing/SetPortForwardingRulesVpcCommand.java  |   30 -
 .../agent/api/routing/SetSourceNatAnswer.java      |   27 -
 .../agent/api/routing/SetSourceNatCommand.java     |   42 -
 .../agent/api/routing/SetStaticNatRulesAnswer.java |   37 -
 .../api/routing/SetStaticNatRulesCommand.java      |   47 -
 .../agent/api/routing/SetStaticRouteAnswer.java    |   36 -
 .../agent/api/routing/SetStaticRouteCommand.java   |   62 -
 .../agent/api/routing/Site2SiteVpnCfgCommand.java  |  154 -
 .../agent/api/routing/SiteLoadBalancerConfig.java  |  121 -
 .../cloud/agent/api/routing/UserDataCommand.java   |   63 -
 .../com/cloud/agent/api/routing/VmDataCommand.java |   67 -
 .../agent/api/routing/VpnUsersCfgCommand.java      |   94 -
 .../agent/api/storage/AbstractDownloadCommand.java |   78 -
 .../agent/api/storage/AbstractUploadCommand.java   |   68 -
 .../cloud/agent/api/storage/CopyVolumeAnswer.java  |   42 -
 .../cloud/agent/api/storage/CopyVolumeCommand.java |   72 -
 .../com/cloud/agent/api/storage/CreateAnswer.java  |   53 -
 .../com/cloud/agent/api/storage/CreateCommand.java |   96 -
 .../api/storage/CreateEntityDownloadURLAnswer.java |   37 -
 .../storage/CreateEntityDownloadURLCommand.java    |   72 -
 .../api/storage/CreatePrivateTemplateAnswer.java   |   77 -
 .../api/storage/CreatePrivateTemplateCommand.java  |   90 -
 .../agent/api/storage/CreateVolumeOVAAnswer.java   |   26 +
 .../agent/api/storage/CreateVolumeOVACommand.java  |   60 +
 .../api/storage/DeleteEntityDownloadURLAnswer.java |   37 -
 .../storage/DeleteEntityDownloadURLCommand.java    |   72 -
 .../agent/api/storage/DeleteTemplateCommand.java   |   40 -
 .../agent/api/storage/DeleteVolumeCommand.java     |   38 -
 .../com/cloud/agent/api/storage/DestroyAnswer.java |   31 -
 .../cloud/agent/api/storage/DestroyCommand.java    |   55 -
 .../cloud/agent/api/storage/DownloadAnswer.java    |  141 -
 .../cloud/agent/api/storage/DownloadCommand.java   |  219 --
 .../agent/api/storage/DownloadProgressCommand.java |   48 -
 .../agent/api/storage/ListTemplateAnswer.java      |   53 -
 .../agent/api/storage/ListTemplateCommand.java     |   54 -
 .../cloud/agent/api/storage/ListVolumeAnswer.java  |   53 -
 .../cloud/agent/api/storage/ListVolumeCommand.java |   40 -
 .../storage/ManageVolumeAvailabilityAnswer.java    |   31 -
 .../storage/ManageVolumeAvailabilityCommand.java   |   54 -
 .../agent/api/storage/MigrateVolumeAnswer.java     |   38 -
 .../agent/api/storage/MigrateVolumeCommand.java    |   51 -
 .../agent/api/storage/PrepareOVAPackingAnswer.java |   26 +
 .../api/storage/PrepareOVAPackingCommand.java      |   48 +
 .../api/storage/PrimaryStorageDownloadAnswer.java  |   54 -
 .../api/storage/PrimaryStorageDownloadCommand.java |   87 -
 .../agent/api/storage/ResizeVolumeAnswer.java      |   40 -
 .../agent/api/storage/ResizeVolumeCommand.java     |   85 -
 .../cloud/agent/api/storage/StorageCommand.java    |   26 -
 .../cloud/agent/api/storage/UpgradeDiskAnswer.java |   29 -
 .../agent/api/storage/UpgradeDiskCommand.java      |   50 -
 .../com/cloud/agent/api/storage/UploadAnswer.java  |  123 -
 .../com/cloud/agent/api/storage/UploadCommand.java |  145 -
 .../agent/api/storage/UploadProgressCommand.java   |   48 -
 api/src/com/cloud/agent/api/storage/ssCommand.java |   48 -
 ...TemplateToSwiftFromSecondaryStorageCommand.java |   80 -
 api/src/com/cloud/alert/AlertAdapter.java          |   22 +
 api/src/com/cloud/async/AsyncJob.java              |    5 +-
 .../cloud/configuration/ConfigurationService.java  |   15 +-
 api/src/com/cloud/event/EventTypes.java            |   31 +-
 api/src/com/cloud/event/UsageEvent.java            |   33 +
 .../exception/AgentControlChannelException.java    |   27 +
 api/src/com/cloud/info/ConsoleProxyLoadInfo.java   |   48 +
 api/src/com/cloud/info/RunningHostCountInfo.java   |   48 +
 api/src/com/cloud/network/GuestVlan.java           |   31 +
 api/src/com/cloud/network/IpAddress.java           |    3 +
 api/src/com/cloud/network/Network.java             |   19 +-
 api/src/com/cloud/network/NetworkModel.java        |   11 +-
 api/src/com/cloud/network/NetworkService.java      |   15 +-
 api/src/com/cloud/network/UserIpv6Address.java     |   52 +
 .../network/VirtualNetworkApplianceService.java    |    2 +
 .../com/cloud/network/VirtualRouterProvider.java   |    3 +-
 .../com/cloud/network/lb/LoadBalancingRule.java    |   83 +-
 .../network/lb/LoadBalancingRulesService.java      |   16 +-
 .../com/cloud/network/router/VirtualRouter.java    |    2 +-
 api/src/com/cloud/network/rules/LoadBalancer.java  |   10 +-
 .../cloud/network/rules/LoadBalancerContainer.java |   33 +
 api/src/com/cloud/network/rules/RulesService.java  |    2 +-
 .../cloud/network/security/SecurityGroupRules.java |    2 +
 api/src/com/cloud/network/vpc/PrivateIp.java       |    1 +
 api/src/com/cloud/network/vpc/VpcGateway.java      |    4 +
 api/src/com/cloud/network/vpc/VpcOffering.java     |    1 +
 api/src/com/cloud/network/vpc/VpcService.java      |    4 +-
 api/src/com/cloud/offering/NetworkOffering.java    |   11 +
 api/src/com/cloud/offering/ServiceOffering.java    |    1 +
 .../cloud/resource/UnableDeleteHostException.java  |   28 +
 .../com/cloud/storage/StoragePoolDiscoverer.java   |   33 +
 .../cloud/storage/snapshot/SnapshotSchedule.java   |   11 +-
 api/src/com/cloud/vm/ConsoleProxy.java             |   27 +
 api/src/com/cloud/vm/SecondaryStorageVm.java       |   26 +
 api/src/com/cloud/vm/SystemVm.java                 |   26 +
 api/src/com/cloud/vm/UserVmService.java            |    4 +-
 api/src/com/cloud/vm/VirtualMachine.java           |    3 +-
 api/src/com/cloud/vm/VirtualMachineName.java       |  190 +
 api/src/com/cloud/vm/VmDetailConstants.java        |   24 +
 .../org/apache/cloudstack/api/ApiConstants.java    |    8 +
 api/src/org/apache/cloudstack/api/BaseCmd.java     |    9 +
 .../apache/cloudstack/api/ResponseGenerator.java   |   52 +-
 .../api/command/admin/cluster/ListClustersCmd.java |    8 +-
 .../api/command/admin/config/ListCfgsByCmd.java    |   44 +-
 .../api/command/admin/config/UpdateCfgCmd.java     |   47 +-
 .../api/command/admin/host/ListHostsCmd.java       |    7 +
 .../ConfigureInternalLoadBalancerElementCmd.java   |  114 +
 .../CreateInternalLoadBalancerElementCmd.java      |  116 +
 .../admin/internallb/ListInternalLBVMsCmd.java     |  151 +
 .../ListInternalLoadBalancerElementsCmd.java       |   99 +
 .../admin/internallb/StartInternalLBVMCmd.java     |  120 +
 .../admin/internallb/StopInternalLBVMCmd.java      |  123 +
 .../admin/network/CreateNetworkOfferingCmd.java    |   15 +-
 .../admin/network/DedicateGuestVlanRangeCmd.java   |  118 +
 .../network/ListDedicatedGuestVlanRangesCmd.java   |  129 +
 .../network/ListNetworkIsolationMethodsCmd.java    |   58 +
 .../network/ReleaseDedicatedGuestVlanRangeCmd.java |   94 +
 .../api/command/admin/pod/ListPodsByCmd.java       |    7 +
 .../router/CreateVirtualRouterElementCmd.java      |   21 +-
 .../api/command/admin/router/ListRoutersCmd.java   |   14 +-
 .../api/command/admin/router/StartRouterCmd.java   |   10 +-
 .../api/command/admin/router/StopRouterCmd.java    |   11 +-
 .../command/admin/systemvm/ListSystemVMsCmd.java   |    7 +
 .../command/admin/vpc/CreatePrivateGatewayCmd.java |   14 +-
 .../api/command/user/iso/ListIsosCmd.java          |    7 +
 .../CreateApplicationLoadBalancerCmd.java          |  218 ++
 .../loadbalancer/CreateLoadBalancerRuleCmd.java    |    6 +-
 .../DeleteApplicationLoadBalancerCmd.java          |  116 +
 .../ListApplicationLoadBalancersCmd.java           |  131 +
 .../api/command/user/nat/EnableStaticNatCmd.java   |    2 +-
 .../api/command/user/network/ListNetworksCmd.java  |    7 +
 .../command/user/snapshot/CreateSnapshotCmd.java   |    2 +
 .../command/user/snapshot/ListSnapshotsCmd.java    |    7 +
 .../command/user/template/ListTemplatesCmd.java    |    8 +
 .../api/command/user/vm/AddIpToVmNicCmd.java       |    9 +-
 .../cloudstack/api/command/user/vm/ScaleVMCmd.java |   10 +-
 .../user/vmsnapshot/RevertToSnapshotCmd.java       |   92 -
 .../user/vmsnapshot/RevertToVMSnapshotCmd.java     |   92 +
 .../api/command/user/zone/ListZonesByCmd.java      |    8 +
 .../ApplicationLoadBalancerInstanceResponse.java   |   63 +
 .../response/ApplicationLoadBalancerResponse.java  |  142 +
 .../ApplicationLoadBalancerRuleResponse.java       |   51 +
 .../api/response/ConfigurationResponse.java        |    3 +
 .../api/response/DomainRouterResponse.java         |   13 +-
 .../api/response/GuestVlanRangeResponse.java       |   94 +
 .../InternalLoadBalancerElementResponse.java       |   51 +
 .../api/response/IsolationMethodResponse.java      |   33 +
 .../api/response/NetworkOfferingResponse.java      |    9 +
 .../api/response/PrivateGatewayResponse.java       |   10 +
 .../response/VirtualRouterProviderResponse.java    |    1 +
 .../InternalLoadBalancerElementService.java        |   56 +
 .../lb/ApplicationLoadBalancerContainer.java       |   28 +
 .../network/lb/ApplicationLoadBalancerRule.java    |   24 +
 .../network/lb/ApplicationLoadBalancerService.java |   42 +
 .../network/lb/InternalLoadBalancerVMService.java  |   34 +
 .../org/apache/cloudstack/query/QueryService.java  |    3 +
 .../api/agent/test/AgentControlAnswerTest.java     |   35 -
 .../api/agent/test/AgentControlCommandTest.java    |   33 -
 .../cloudstack/api/agent/test/AnswerTest.java      |   73 -
 .../api/agent/test/AttachIsoCommandTest.java       |   80 -
 .../api/agent/test/AttachVolumeAnswerTest.java     |   65 -
 .../api/agent/test/AttachVolumeCommandTest.java    |  120 -
 .../api/agent/test/BackupSnapshotAnswerTest.java   |   75 -
 .../api/agent/test/BackupSnapshotCommandTest.java  |  301 --
 .../api/agent/test/BumpUpPriorityCommandTest.java  |   83 -
 .../api/agent/test/CancelCommandTest.java          |   46 -
 .../api/agent/test/ChangeAgentAnswerTest.java      |   44 -
 .../api/agent/test/ChangeAgentCommandTest.java     |   50 -
 .../api/agent/test/CheckHealthAnswerTest.java      |   49 -
 .../api/agent/test/CheckHealthCommandTest.java     |   40 -
 .../api/agent/test/CheckNetworkAnswerTest.java     |   62 -
 .../api/agent/test/CheckNetworkCommandTest.java    |   53 -
 .../api/agent/test/CheckOnHostCommandTest.java     |  483 ---
 .../api/agent/test/SnapshotCommandTest.java        |  209 --
 .../api/command/test/AddIpToVmNicTest.java         |    6 +-
 .../api/command/test/ScaleVMCmdTest.java           |   35 +-
 .../agent/api/test/ResizeVolumeCommandTest.java    |  229 --
 awsapi/pom.xml                                     |   33 +-
 .../test/com/cloud/gate/model/ModelTestCase.java   |  368 --
 .../com/cloud/gate/persist/PersitTestCase.java     |   73 -
 .../WEB-INF/classes/resources/messages.properties  |  566 ++--
 .../classes/resources/messages_ar.properties       |  285 ++
 .../classes/resources/messages_ca.properties       |    1 +
 .../classes/resources/messages_de_DE.properties    |   23 +-
 .../classes/resources/messages_es.properties       | 1367 ++++----
 .../classes/resources/messages_fr_FR.properties    | 1842 +++++-----
 .../classes/resources/messages_it_IT.properties    |    2 +-
 .../classes/resources/messages_ja.properties       | 2685 +++++++--------
 .../classes/resources/messages_ko_KR.properties    |    4 +-
 .../classes/resources/messages_nb_NO.properties    |    1 +
 .../classes/resources/messages_pt_BR.properties    |    2 +-
 .../classes/resources/messages_ru_RU.properties    |    6 +-
 .../classes/resources/messages_zh_CN.properties    |    5 +-
 client/pom.xml                                     |   21 +-
 client/tomcatconf/applicationContext.xml.in        |   19 +-
 client/tomcatconf/commands.properties.in           |   25 +-
 client/tomcatconf/componentContext.xml.in          |    2 +
 client/tomcatconf/nonossComponentContext.xml.in    |    4 +-
 client/tomcatconf/simulatorComponentContext.xml.in |    1 +
 core/pom.xml                                       |    7 +-
 core/src/com/cloud/agent/RecoveryHandler.java      |   31 -
 .../com/cloud/agent/api/AgentControlAnswer.java    |   30 +
 .../com/cloud/agent/api/AgentControlCommand.java   |   27 +
 core/src/com/cloud/agent/api/AttachIsoCommand.java |   59 +
 .../com/cloud/agent/api/AttachVolumeAnswer.java    |   58 +
 .../com/cloud/agent/api/AttachVolumeCommand.java   |   99 +
 .../com/cloud/agent/api/BackupSnapshotAnswer.java  |   44 +
 .../com/cloud/agent/api/BackupSnapshotCommand.java |  121 +
 .../com/cloud/agent/api/BumpUpPriorityCommand.java |   30 +
 core/src/com/cloud/agent/api/CancelCommand.java    |   45 +
 .../src/com/cloud/agent/api/ChangeAgentAnswer.java |   26 +
 .../com/cloud/agent/api/ChangeAgentCommand.java    |   46 +
 .../src/com/cloud/agent/api/CheckHealthAnswer.java |   26 +
 .../com/cloud/agent/api/CheckHealthCommand.java    |   30 +
 .../com/cloud/agent/api/CheckNetworkAnswer.java    |   38 +
 .../com/cloud/agent/api/CheckNetworkCommand.java   |   42 +
 .../src/com/cloud/agent/api/CheckOnHostAnswer.java |   48 +
 .../com/cloud/agent/api/CheckOnHostCommand.java    |   42 +
 .../src/com/cloud/agent/api/CheckRouterAnswer.java |   81 +
 .../com/cloud/agent/api/CheckRouterCommand.java    |   30 +
 .../agent/api/CheckS2SVpnConnectionsAnswer.java    |   71 +
 .../agent/api/CheckS2SVpnConnectionsCommand.java   |   39 +
 core/src/com/cloud/agent/api/CheckStateAnswer.java |   45 +
 .../src/com/cloud/agent/api/CheckStateCommand.java |   40 +
 .../cloud/agent/api/CheckVirtualMachineAnswer.java |   52 +
 .../agent/api/CheckVirtualMachineCommand.java      |   41 +
 .../cloud/agent/api/CleanupNetworkRulesCmd.java    |   47 +
 .../agent/api/CleanupSnapshotBackupCommand.java    |   75 +
 .../src/com/cloud/agent/api/ClusterSyncAnswer.java |   55 +
 .../com/cloud/agent/api/ClusterSyncCommand.java    |   47 +
 .../cloud/agent/api/ComputeChecksumCommand.java    |   40 +
 .../api/ConsoleAccessAuthenticationAnswer.java     |   88 +
 .../api/ConsoleAccessAuthenticationCommand.java    |   68 +
 .../agent/api/ConsoleProxyLoadReportCommand.java   |   39 +
 .../CreatePrivateTemplateFromSnapshotCommand.java  |   82 +
 .../CreatePrivateTemplateFromVolumeCommand.java    |   93 +
 .../cloud/agent/api/CreateStoragePoolCommand.java  |   30 +
 .../cloud/agent/api/CreateVMSnapshotAnswer.java    |   62 +
 .../cloud/agent/api/CreateVMSnapshotCommand.java   |   42 +
 .../agent/api/CreateVolumeFromSnapshotAnswer.java  |   38 +
 .../agent/api/CreateVolumeFromSnapshotCommand.java |   58 +
 .../api/CreateVolumeFromVMSnapshotAnswer.java      |   54 +
 .../api/CreateVolumeFromVMSnapshotCommand.java     |   88 +
 core/src/com/cloud/agent/api/CronCommand.java      |   24 +
 .../agent/api/DeleteObjectFromSwiftCommand.java    |   61 +
 .../agent/api/DeleteSnapshotBackupAnswer.java      |   32 +
 .../agent/api/DeleteSnapshotBackupCommand.java     |   96 +
 .../cloud/agent/api/DeleteSnapshotsDirCommand.java |   63 +
 .../cloud/agent/api/DeleteStoragePoolCommand.java  |   61 +
 .../agent/api/DeleteTemplateFromS3Command.java     |  106 +
 .../cloud/agent/api/DeleteVMSnapshotAnswer.java    |   49 +
 .../cloud/agent/api/DeleteVMSnapshotCommand.java   |   28 +
 .../agent/api/DownloadSnapshotFromS3Command.java   |   61 +
 .../api/DownloadSnapshotFromSwiftCommand.java      |   60 +
 ...oadTemplateFromS3ToSecondaryStorageCommand.java |   66 +
 ...TemplateFromSwiftToSecondaryStorageCommand.java |   90 +
 core/src/com/cloud/agent/api/FenceAnswer.java      |   36 +
 core/src/com/cloud/agent/api/FenceCommand.java     |   61 +
 .../com/cloud/agent/api/GetDomRVersionAnswer.java  |   45 +
 .../src/com/cloud/agent/api/GetDomRVersionCmd.java |   30 +
 .../com/cloud/agent/api/GetFileStatsAnswer.java    |   37 +
 .../com/cloud/agent/api/GetFileStatsCommand.java   |   41 +
 .../com/cloud/agent/api/GetHostStatsAnswer.java    |   88 +
 .../com/cloud/agent/api/GetHostStatsCommand.java   |   53 +
 .../com/cloud/agent/api/GetStorageStatsAnswer.java |   51 +
 .../cloud/agent/api/GetStorageStatsCommand.java    |   76 +
 core/src/com/cloud/agent/api/GetVmStatsAnswer.java |   40 +
 .../src/com/cloud/agent/api/GetVmStatsCommand.java |   54 +
 core/src/com/cloud/agent/api/GetVncPortAnswer.java |   48 +
 .../src/com/cloud/agent/api/GetVncPortCommand.java |   43 +
 core/src/com/cloud/agent/api/HostStatsEntry.java   |  113 +
 core/src/com/cloud/agent/api/MaintainAnswer.java   |   46 +
 core/src/com/cloud/agent/api/MaintainCommand.java  |   28 +
 .../com/cloud/agent/api/ManageSnapshotAnswer.java  |   40 +
 .../com/cloud/agent/api/ManageSnapshotCommand.java |   92 +
 core/src/com/cloud/agent/api/MigrateAnswer.java    |   33 +
 core/src/com/cloud/agent/api/MigrateCommand.java   |   59 +
 .../cloud/agent/api/MigrateWithStorageAnswer.java  |   39 +
 .../cloud/agent/api/MigrateWithStorageCommand.java |   45 +
 .../api/MigrateWithStorageCompleteAnswer.java      |   38 +
 .../api/MigrateWithStorageCompleteCommand.java     |   36 +
 .../agent/api/MigrateWithStorageReceiveAnswer.java |   55 +
 .../api/MigrateWithStorageReceiveCommand.java      |   45 +
 .../agent/api/MigrateWithStorageSendAnswer.java    |   39 +
 .../agent/api/MigrateWithStorageSendCommand.java   |   58 +
 .../com/cloud/agent/api/ModifySshKeysCommand.java  |   44 +
 .../cloud/agent/api/ModifyStoragePoolAnswer.java   |   57 +
 .../cloud/agent/api/ModifyStoragePoolCommand.java  |   75 +
 .../com/cloud/agent/api/NetworkUsageAnswer.java    |   61 +
 .../com/cloud/agent/api/NetworkUsageCommand.java   |   98 +
 core/src/com/cloud/agent/api/PingAnswer.java       |   33 +
 core/src/com/cloud/agent/api/PingCommand.java      |   45 +
 .../com/cloud/agent/api/PingRoutingCommand.java    |   54 +
 .../agent/api/PingRoutingWithNwGroupsCommand.java  |   46 +
 .../cloud/agent/api/PingRoutingWithOvsCommand.java |   42 +
 .../com/cloud/agent/api/PingStorageCommand.java    |   37 +
 core/src/com/cloud/agent/api/PingTestCommand.java  |   54 +
 core/src/com/cloud/agent/api/PlugNicAnswer.java    |   25 +
 core/src/com/cloud/agent/api/PlugNicCommand.java   |   46 +
 core/src/com/cloud/agent/api/PoolEjectCommand.java |   42 +
 .../cloud/agent/api/PrepareForMigrationAnswer.java |   34 +
 .../agent/api/PrepareForMigrationCommand.java      |   39 +
 .../cloud/agent/api/PrepareOCFS2NodesCommand.java  |   44 +
 .../agent/api/PropagateResourceEventCommand.java   |   48 +
 core/src/com/cloud/agent/api/ReadyAnswer.java      |   31 +
 core/src/com/cloud/agent/api/ReadyCommand.java     |   58 +
 core/src/com/cloud/agent/api/RebootAnswer.java     |   42 +
 core/src/com/cloud/agent/api/RebootCommand.java    |   45 +
 .../com/cloud/agent/api/RebootRouterCommand.java   |   38 +
 .../cloud/agent/api/RevertToVMSnapshotAnswer.java  |   63 +
 .../cloud/agent/api/RevertToVMSnapshotCommand.java |   29 +
 core/src/com/cloud/agent/api/ScaleVmAnswer.java    |   28 +
 core/src/com/cloud/agent/api/ScaleVmCommand.java   |  113 +
 .../agent/api/ScheduleHostScanTaskCommand.java     |   32 +
 .../agent/api/SecStorageFirewallCfgCommand.java    |   82 +
 .../com/cloud/agent/api/SecStorageSetupAnswer.java |   33 +
 .../cloud/agent/api/SecStorageSetupCommand.java    |   83 +
 .../cloud/agent/api/SecStorageVMSetupCommand.java  |   57 +
 .../cloud/agent/api/SecurityGroupRuleAnswer.java   |   70 +
 .../com/cloud/agent/api/SecurityGroupRulesCmd.java |  304 ++
 core/src/com/cloud/agent/api/SetupAnswer.java      |   37 +
 core/src/com/cloud/agent/api/SetupCommand.java     |   60 +
 .../cloud/agent/api/SetupGuestNetworkAnswer.java   |   25 +
 .../cloud/agent/api/SetupGuestNetworkCommand.java  |   72 +
 core/src/com/cloud/agent/api/ShutdownCommand.java  |   56 +
 core/src/com/cloud/agent/api/SnapshotCommand.java  |  126 +
 core/src/com/cloud/agent/api/StartAnswer.java      |   57 +
 core/src/com/cloud/agent/api/StartCommand.java     |   52 +
 core/src/com/cloud/agent/api/StartupAnswer.java    |   44 +
 core/src/com/cloud/agent/api/StartupCommand.java   |  286 ++
 .../agent/api/StartupExternalDhcpCommand.java      |   25 +
 .../agent/api/StartupExternalFirewallCommand.java  |   26 +
 .../api/StartupExternalLoadBalancerCommand.java    |   26 +
 .../com/cloud/agent/api/StartupProxyCommand.java   |   49 +
 .../cloud/agent/api/StartupPxeServerCommand.java   |   25 +
 .../com/cloud/agent/api/StartupRoutingCommand.java |  224 ++
 .../agent/api/StartupSecondaryStorageCommand.java  |   32 +
 .../com/cloud/agent/api/StartupStorageCommand.java |  110 +
 .../agent/api/StartupTrafficMonitorCommand.java    |   26 +
 core/src/com/cloud/agent/api/StopAnswer.java       |   45 +
 core/src/com/cloud/agent/api/StopCommand.java      |   71 +
 .../com/cloud/agent/api/TransferAgentCommand.java  |   57 +
 core/src/com/cloud/agent/api/UnPlugNicAnswer.java  |   25 +
 core/src/com/cloud/agent/api/UnPlugNicCommand.java |   45 +
 .../com/cloud/agent/api/UnregisterVMCommand.java   |   34 +
 .../cloud/agent/api/UpdateHostPasswordCommand.java |   48 +
 core/src/com/cloud/agent/api/UpgradeAnswer.java    |   26 +
 core/src/com/cloud/agent/api/UpgradeCommand.java   |   42 +
 .../cloud/agent/api/UpgradeSnapshotCommand.java    |   64 +
 ...oadTemplateToS3FromSecondaryStorageCommand.java |  121 +
 ...TemplateToSwiftFromSecondaryStorageCommand.java |   80 +
 .../com/cloud/agent/api/VMSnapshotBaseCommand.java |   74 +
 core/src/com/cloud/agent/api/VMSnapshotTO.java     |   90 +
 .../cloud/agent/api/ValidateSnapshotAnswer.java    |   53 +
 .../cloud/agent/api/ValidateSnapshotCommand.java   |   84 +
 core/src/com/cloud/agent/api/VmStatsEntry.java     |   82 +
 .../agent/api/baremetal/IpmISetBootDevCommand.java |   43 +
 .../api/baremetal/IpmiBootorResetCommand.java      |   28 +
 .../api/baremetal/PreparePxeServerAnswer.java      |   29 +
 .../api/baremetal/PreparePxeServerCommand.java     |   80 +
 .../baremetal/prepareCreateTemplateCommand.java    |   66 +
 .../com/cloud/agent/api/check/CheckSshAnswer.java  |   37 +
 .../com/cloud/agent/api/check/CheckSshCommand.java |   65 +
 .../api/proxy/CheckConsoleProxyLoadCommand.java    |   60 +
 .../agent/api/proxy/ConsoleProxyLoadAnswer.java    |   44 +
 .../com/cloud/agent/api/proxy/ProxyCommand.java    |   25 +
 .../StartConsoleProxyAgentHttpHandlerCommand.java  |   68 +
 .../api/proxy/WatchConsoleProxyLoadCommand.java    |   65 +
 .../CreateLoadBalancerApplianceCommand.java        |   48 +
 .../DestroyLoadBalancerApplianceCommand.java       |   32 +
 .../cloud/agent/api/routing/DhcpEntryCommand.java  |  142 +
 .../routing/GlobalLoadBalancerConfigAnswer.java    |   27 +
 .../routing/GlobalLoadBalancerConfigCommand.java   |  100 +
 .../api/routing/HealthCheckLBConfigAnswer.java     |   42 +
 .../api/routing/HealthCheckLBConfigCommand.java    |   39 +
 .../com/cloud/agent/api/routing/IpAssocAnswer.java |   48 +
 .../cloud/agent/api/routing/IpAssocCommand.java    |   42 +
 .../cloud/agent/api/routing/IpAssocVpcCommand.java |   29 +
 .../api/routing/LoadBalancerConfigCommand.java     |   66 +
 .../agent/api/routing/NetworkElementCommand.java   |   53 +
 .../api/routing/RemoteAccessVpnCfgCommand.java     |   78 +
 .../agent/api/routing/SavePasswordCommand.java     |   54 +
 .../agent/api/routing/SetFirewallRulesAnswer.java  |   36 +
 .../agent/api/routing/SetFirewallRulesCommand.java |   98 +
 .../agent/api/routing/SetNetworkACLAnswer.java     |   36 +
 .../agent/api/routing/SetNetworkACLCommand.java    |   97 +
 .../api/routing/SetPortForwardingRulesAnswer.java  |   37 +
 .../api/routing/SetPortForwardingRulesCommand.java |   40 +
 .../routing/SetPortForwardingRulesVpcCommand.java  |   30 +
 .../agent/api/routing/SetSourceNatAnswer.java      |   27 +
 .../agent/api/routing/SetSourceNatCommand.java     |   42 +
 .../agent/api/routing/SetStaticNatRulesAnswer.java |   37 +
 .../api/routing/SetStaticNatRulesCommand.java      |   47 +
 .../agent/api/routing/SetStaticRouteAnswer.java    |   36 +
 .../agent/api/routing/SetStaticRouteCommand.java   |   62 +
 .../agent/api/routing/Site2SiteVpnCfgCommand.java  |  154 +
 .../agent/api/routing/SiteLoadBalancerConfig.java  |  121 +
 .../cloud/agent/api/routing/UserDataCommand.java   |   63 +
 .../com/cloud/agent/api/routing/VmDataCommand.java |   67 +
 .../agent/api/routing/VpnUsersCfgCommand.java      |   94 +
 .../agent/api/storage/AbstractDownloadCommand.java |   78 +
 .../agent/api/storage/AbstractUploadCommand.java   |   68 +
 .../cloud/agent/api/storage/CopyVolumeAnswer.java  |   42 +
 .../cloud/agent/api/storage/CopyVolumeCommand.java |   72 +
 .../com/cloud/agent/api/storage/CreateAnswer.java  |   53 +
 .../com/cloud/agent/api/storage/CreateCommand.java |   96 +
 .../api/storage/CreateEntityDownloadURLAnswer.java |   37 +
 .../storage/CreateEntityDownloadURLCommand.java    |   72 +
 .../api/storage/CreatePrivateTemplateAnswer.java   |   77 +
 .../api/storage/CreatePrivateTemplateCommand.java  |   90 +
 .../api/storage/DeleteEntityDownloadURLAnswer.java |   37 +
 .../storage/DeleteEntityDownloadURLCommand.java    |   72 +
 .../agent/api/storage/DeleteTemplateCommand.java   |   40 +
 .../agent/api/storage/DeleteVolumeCommand.java     |   38 +
 .../com/cloud/agent/api/storage/DestroyAnswer.java |   31 +
 .../cloud/agent/api/storage/DestroyCommand.java    |   55 +
 .../cloud/agent/api/storage/DownloadAnswer.java    |  141 +
 .../cloud/agent/api/storage/DownloadCommand.java   |  219 ++
 .../agent/api/storage/DownloadProgressCommand.java |   48 +
 .../agent/api/storage/ListTemplateAnswer.java      |   53 +
 .../agent/api/storage/ListTemplateCommand.java     |   54 +
 .../cloud/agent/api/storage/ListVolumeAnswer.java  |   53 +
 .../cloud/agent/api/storage/ListVolumeCommand.java |   40 +
 .../storage/ManageVolumeAvailabilityAnswer.java    |   31 +
 .../storage/ManageVolumeAvailabilityCommand.java   |   54 +
 .../agent/api/storage/MigrateVolumeAnswer.java     |   38 +
 .../agent/api/storage/MigrateVolumeCommand.java    |   51 +
 .../api/storage/PrimaryStorageDownloadAnswer.java  |   54 +
 .../api/storage/PrimaryStorageDownloadCommand.java |   87 +
 .../agent/api/storage/ResizeVolumeAnswer.java      |   40 +
 .../agent/api/storage/ResizeVolumeCommand.java     |   85 +
 .../cloud/agent/api/storage/StorageCommand.java    |   26 +
 .../cloud/agent/api/storage/UpgradeDiskAnswer.java |   29 +
 .../agent/api/storage/UpgradeDiskCommand.java      |   50 +
 .../com/cloud/agent/api/storage/UploadAnswer.java  |  123 +
 .../com/cloud/agent/api/storage/UploadCommand.java |  145 +
 .../agent/api/storage/UploadProgressCommand.java   |   48 +
 .../src/com/cloud/agent/api/storage/ssCommand.java |   48 +
 .../virtualnetwork/VirtualRoutingResource.java     |   15 +-
 core/src/com/cloud/alert/AlertAdapter.java         |   22 -
 core/src/com/cloud/alert/AlertManager.java         |   58 -
 core/src/com/cloud/alert/AlertVO.java              |  183 -
 core/src/com/cloud/async/AsyncJobVO.java           |  400 ---
 core/src/com/cloud/async/SyncQueueItemVO.java      |  141 -
 core/src/com/cloud/async/SyncQueueVO.java          |  137 -
 core/src/com/cloud/capacity/CapacityVO.java        |  204 --
 core/src/com/cloud/certificate/CertificateVO.java  |   63 -
 .../com/cloud/configuration/ConfigurationVO.java   |  107 -
 .../com/cloud/configuration/ResourceCountVO.java   |  131 -
 .../com/cloud/configuration/ResourceLimitVO.java   |  128 -
 core/src/com/cloud/event/EventVO.java              |  194 --
 core/src/com/cloud/event/UsageEvent.java           |   33 -
 core/src/com/cloud/event/UsageEventVO.java         |  216 --
 core/src/com/cloud/event/dao/EventDao.java         |   38 -
 core/src/com/cloud/event/dao/EventDaoImpl.java     |  109 -
 core/src/com/cloud/event/dao/UsageEventDao.java    |   36 -
 .../src/com/cloud/event/dao/UsageEventDaoImpl.java |  187 -
 .../exception/AgentControlChannelException.java    |   27 -
 core/src/com/cloud/host/DetailVO.java              |   73 -
 core/src/com/cloud/host/HostTagVO.java             |   65 -
 core/src/com/cloud/host/HostVO.java                |  732 ----
 .../cloud/hypervisor/HypervisorCapabilitiesVO.java |  212 --
 core/src/com/cloud/info/ConsoleProxyLoadInfo.java  |   48 -
 core/src/com/cloud/info/RunningHostCountInfo.java  |   48 -
 core/src/com/cloud/network/VpnUserVO.java          |  131 -
 .../network/security/SecurityGroupRuleVO.java      |  167 -
 .../network/security/SecurityGroupRulesVO.java     |  156 -
 .../network/security/SecurityGroupVMMapVO.java     |   89 -
 .../cloud/network/security/SecurityGroupVO.java    |   99 -
 .../cloud/network/security/SecurityGroupWork.java  |   40 -
 .../network/security/SecurityGroupWorkVO.java      |  135 -
 .../com/cloud/network/security/VmRulesetLogVO.java |   81 -
 core/src/com/cloud/resource/ResourceListener.java  |   40 +-
 .../cloud/resource/UnableDeleteHostException.java  |   28 -
 core/src/com/cloud/storage/DiskOfferingVO.java     |  330 --
 core/src/com/cloud/storage/GuestOSCategoryVO.java  |   68 -
 core/src/com/cloud/storage/GuestOSVO.java          |   90 -
 core/src/com/cloud/storage/LaunchPermissionVO.java |   57 -
 core/src/com/cloud/storage/S3VO.java               |  209 --
 core/src/com/cloud/storage/SecondaryStorage.java   |   30 -
 .../com/cloud/storage/SecondaryStorageLayer.java   |   39 -
 core/src/com/cloud/storage/SnapshotPolicyVO.java   |  133 -
 core/src/com/cloud/storage/SnapshotScheduleVO.java |  125 -
 core/src/com/cloud/storage/SnapshotVO.java         |  298 --
 .../com/cloud/storage/StoragePoolDiscoverer.java   |   35 -
 .../com/cloud/storage/StoragePoolHostAssoc.java    |   35 -
 core/src/com/cloud/storage/StoragePoolHostVO.java  |  109 -
 core/src/com/cloud/storage/StoragePoolWorkVO.java  |  118 -
 core/src/com/cloud/storage/SwiftVO.java            |  108 -
 core/src/com/cloud/storage/UploadVO.java           |  268 --
 core/src/com/cloud/storage/VMTemplateDetailVO.java |   84 -
 core/src/com/cloud/storage/VMTemplateHostVO.java   |  322 --
 core/src/com/cloud/storage/VMTemplateS3VO.java     |  204 --
 .../com/cloud/storage/VMTemplateStoragePoolVO.java |  275 --
 core/src/com/cloud/storage/VMTemplateSwiftVO.java  |  107 -
 core/src/com/cloud/storage/VMTemplateVO.java       |  534 ---
 core/src/com/cloud/storage/VMTemplateZoneVO.java   |  116 -
 core/src/com/cloud/storage/VolumeHostVO.java       |  347 --
 core/src/com/cloud/storage/VolumeVO.java           |  466 ---
 .../storage/resource/StoragePoolResource.java      |    4 +
 .../cloud/storage/snapshot/SnapshotSchedule.java   |   46 -
 core/src/com/cloud/user/AccountVO.java             |  189 -
 core/src/com/cloud/user/SSHKeyPairVO.java          |  119 -
 core/src/com/cloud/user/UserAccountVO.java         |  284 --
 core/src/com/cloud/user/UserStatisticsVO.java      |  165 -
 core/src/com/cloud/user/UserStatsLogVO.java        |  132 -
 core/src/com/cloud/user/UserVO.java                |  274 --
 core/src/com/cloud/vm/ConsoleProxy.java            |   27 -
 core/src/com/cloud/vm/ConsoleProxyVO.java          |  151 -
 core/src/com/cloud/vm/DomainRouterVO.java          |  246 --
 core/src/com/cloud/vm/InstanceGroupVMMapVO.java    |   71 -
 core/src/com/cloud/vm/InstanceGroupVO.java         |  120 -
 core/src/com/cloud/vm/SecondaryStorageVm.java      |   26 -
 core/src/com/cloud/vm/SecondaryStorageVmVO.java    |  135 -
 core/src/com/cloud/vm/SystemVm.java                |   26 -
 core/src/com/cloud/vm/UserVmCloneSettingVO.java    |   50 -
 core/src/com/cloud/vm/UserVmDetailVO.java          |   85 -
 core/src/com/cloud/vm/UserVmVO.java                |  141 -
 core/src/com/cloud/vm/VMInstanceVO.java            |  494 ---
 core/src/com/cloud/vm/VirtualDisk.java             |   31 -
 core/src/com/cloud/vm/VirtualMachineName.java      |  190 -
 core/src/com/cloud/vm/VmDetailConstants.java       |   24 -
 core/src/com/cloud/vm/snapshot/VMSnapshotVO.java   |  224 --
 .../api/agent/test/AgentControlAnswerTest.java     |   35 +
 .../api/agent/test/AgentControlCommandTest.java    |   33 +
 .../cloudstack/api/agent/test/AnswerTest.java      |   73 +
 .../api/agent/test/AttachIsoCommandTest.java       |   80 +
 .../api/agent/test/AttachVolumeAnswerTest.java     |   65 +
 .../api/agent/test/AttachVolumeCommandTest.java    |  120 +
 .../api/agent/test/BackupSnapshotAnswerTest.java   |   75 +
 .../api/agent/test/BackupSnapshotCommandTest.java  |  301 ++
 .../api/agent/test/BumpUpPriorityCommandTest.java  |   83 +
 .../api/agent/test/CancelCommandTest.java          |   46 +
 .../api/agent/test/ChangeAgentAnswerTest.java      |   44 +
 .../api/agent/test/ChangeAgentCommandTest.java     |   50 +
 .../api/agent/test/CheckHealthAnswerTest.java      |   49 +
 .../api/agent/test/CheckHealthCommandTest.java     |   40 +
 .../api/agent/test/CheckNetworkAnswerTest.java     |   62 +
 .../api/agent/test/CheckNetworkCommandTest.java    |   53 +
 .../api/agent/test/CheckOnHostCommandTest.java     |  483 +++
 .../api/agent/test/SnapshotCommandTest.java        |  209 ++
 .../agent/api/test/ResizeVolumeCommandTest.java    |  229 ++
 docs/en-US/MidoNet_Plugin_Guide.ent                |   22 +
 docs/en-US/MidoNet_Plugin_Guide.xml                |   52 +
 docs/en-US/Release_Notes.xml                       |   12 +-
 docs/en-US/added-API-commands-4.2.xml              |   78 +
 docs/en-US/aws-ec2-configuration.xml               |    2 +-
 docs/en-US/change-database-password.xml            |    6 +-
 docs/en-US/changed-API-commands-4.2.xml            |   15 +-
 docs/en-US/citrix-xenserver-installation.xml       |    2 +-
 docs/en-US/configure-usage-server.xml              |    4 +-
 docs/en-US/creating-network-offerings.xml          |    2 +-
 docs/en-US/database-replication.xml                |    6 +-
 docs/en-US/delete-event-alerts.xml                 |   12 +
 docs/en-US/elastic-ip.xml                          |   47 +-
 docs/en-US/events.xml                              |    2 +-
 .../external-firewalls-and-load-balancers.xml      |    1 +
 docs/en-US/gslb.xml                                |  499 +++
 docs/en-US/guest-ip-ranges.xml                     |   10 +-
 docs/en-US/hypervisor-host-install-agent.xml       |    6 +-
 docs/en-US/hypervisor-host-install-libvirt.xml     |    2 +-
 docs/en-US/images/add-gslb.png                     |  Bin 0 -> 17665 bytes
 docs/en-US/images/eip-ns-basiczone.png             |  Bin 0 -> 63227 bytes
 docs/en-US/images/gslb.png                         |  Bin 0 -> 60354 bytes
 .../increase-management-server-max-memory.xml      |    2 +-
 docs/en-US/install-usage-server.xml                |    2 +-
 docs/en-US/libcloud-examples.xml                   |   75 +
 docs/en-US/lxc-install.xml                         |    4 +-
 docs/en-US/networks.xml                            |    3 +-
 docs/en-US/plugin-midonet-about.xml                |   27 +
 docs/en-US/plugin-midonet-features.xml             |   57 +
 docs/en-US/plugin-midonet-introduction.xml         |   26 +
 docs/en-US/plugin-midonet-preparations.xml         |   90 +
 docs/en-US/plugin-midonet-provider.xml             |   39 +
 docs/en-US/plugin-midonet-revisions.xml            |   45 +
 docs/en-US/plugin-midonet-ui.xml                   |   65 +
 docs/en-US/plugin-midonet-usage.xml                |   29 +
 docs/en-US/set-database-buffer-pool-size.xml       |    2 +-
 docs/en-US/set-global-project-resource-limits.xml  |    2 +-
 docs/en-US/set-projects-creator-permissions.xml    |    2 +-
 docs/en-US/set-up-invitations.xml                  |    2 +-
 docs/en-US/signing-api-calls-python.xml            |  101 +
 docs/en-US/signing-api-requests.xml                |    3 +
 docs/en-US/stop-restart-management-server.xml      |    6 +-
 docs/en-US/sys-offering-sysvm.xml                  |    2 +-
 docs/en-US/tools.xml                               |    1 +
 docs/en-US/zone-add.xml                            |    2 +-
 docs/publican-plugin-midonet.cfg                   |   28 +
 engine/api/pom.xml                                 |   10 +-
 engine/pom.xml                                     |    2 -
 engine/schema/src/com/cloud/alert/AlertVO.java     |  183 +
 .../schema/src/com/cloud/alert/dao/AlertDao.java   |   33 +
 .../src/com/cloud/alert/dao/AlertDaoImpl.java      |  156 +
 .../schema/src/com/cloud/capacity/CapacityVO.java  |  204 ++
 .../src/com/cloud/capacity/dao/CapacityDao.java    |   45 +
 .../com/cloud/capacity/dao/CapacityDaoImpl.java    |  816 +++++
 .../src/com/cloud/certificate/CertificateVO.java   |   63 +
 .../com/cloud/certificate/dao/CertificateDao.java  |   24 +
 .../cloud/certificate/dao/CertificateDaoImpl.java  |   63 +
 .../cluster/ClusterInvalidSessionException.java    |   33 +
 .../cloud/cluster/ManagementServerHostPeerVO.java  |  120 +
 .../com/cloud/cluster/ManagementServerHostVO.java  |  182 +
 .../cloud/cluster/agentlb/HostTransferMapVO.java   |   98 +
 .../cluster/agentlb/dao/HostTransferMapDao.java    |   45 +
 .../agentlb/dao/HostTransferMapDaoImpl.java        |  146 +
 .../cloud/cluster/dao/ManagementServerHostDao.java |   48 +
 .../cluster/dao/ManagementServerHostDaoImpl.java   |  276 ++
 .../cluster/dao/ManagementServerHostPeerDao.java   |   27 +
 .../dao/ManagementServerHostPeerDaoImpl.java       |  108 +
 .../com/cloud/configuration/ConfigurationVO.java   |  107 +
 .../com/cloud/configuration/ResourceCountVO.java   |  131 +
 .../com/cloud/configuration/ResourceLimitVO.java   |  128 +
 .../cloud/configuration/dao/ConfigurationDao.java  |   69 +
 .../configuration/dao/ConfigurationDaoImpl.java    |  225 ++
 .../cloud/configuration/dao/ResourceCountDao.java  |   58 +
 .../configuration/dao/ResourceCountDaoImpl.java    |  222 ++
 .../cloud/configuration/dao/ResourceLimitDao.java  |   35 +
 .../configuration/dao/ResourceLimitDaoImpl.java    |  100 +
 .../schema/src/com/cloud/dc/AccountVlanMapVO.java  |   65 +
 .../schema/src/com/cloud/dc/ClusterDetailsDao.java |   32 +
 .../src/com/cloud/dc/ClusterDetailsDaoImpl.java    |  133 +
 .../schema/src/com/cloud/dc/ClusterDetailsVO.java  |   74 +
 engine/schema/src/com/cloud/dc/ClusterVO.java      |  189 +
 .../schema/src/com/cloud/dc/ClusterVSMMapVO.java   |   62 +
 .../src/com/cloud/dc/DataCenterIpAddressVO.java    |  115 +
 .../cloud/dc/DataCenterLinkLocalIpAddressVO.java   |  108 +
 engine/schema/src/com/cloud/dc/DataCenterVO.java   |  460 +++
 .../schema/src/com/cloud/dc/DataCenterVnetVO.java  |  120 +
 engine/schema/src/com/cloud/dc/DcDetailVO.java     |   73 +
 engine/schema/src/com/cloud/dc/HostPodVO.java      |  197 ++
 engine/schema/src/com/cloud/dc/PodCluster.java     |   67 +
 engine/schema/src/com/cloud/dc/PodVlanMapVO.java   |   62 +
 engine/schema/src/com/cloud/dc/PodVlanVO.java      |   98 +
 .../com/cloud/dc/StorageNetworkIpAddressVO.java    |  120 +
 .../src/com/cloud/dc/StorageNetworkIpRangeVO.java  |  184 +
 engine/schema/src/com/cloud/dc/VlanVO.java         |  196 ++
 .../src/com/cloud/dc/dao/AccountVlanMapDao.java    |   30 +
 .../com/cloud/dc/dao/AccountVlanMapDaoImpl.java    |   75 +
 engine/schema/src/com/cloud/dc/dao/ClusterDao.java |   37 +
 .../src/com/cloud/dc/dao/ClusterDaoImpl.java       |  241 ++
 .../src/com/cloud/dc/dao/ClusterVSMMapDao.java     |   29 +
 .../src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java |   95 +
 .../schema/src/com/cloud/dc/dao/DataCenterDao.java |   82 +
 .../src/com/cloud/dc/dao/DataCenterDaoImpl.java    |  425 +++
 .../com/cloud/dc/dao/DataCenterIpAddressDao.java   |   38 +
 .../cloud/dc/dao/DataCenterIpAddressDaoImpl.java   |  225 ++
 .../dc/dao/DataCenterLinkLocalIpAddressDao.java    |   32 +
 .../dao/DataCenterLinkLocalIpAddressDaoImpl.java   |  188 +
 .../src/com/cloud/dc/dao/DataCenterVnetDao.java    |   49 +
 .../com/cloud/dc/dao/DataCenterVnetDaoImpl.java    |  318 ++
 .../schema/src/com/cloud/dc/dao/DcDetailsDao.java  |   32 +
 .../src/com/cloud/dc/dao/DcDetailsDaoImpl.java     |   97 +
 engine/schema/src/com/cloud/dc/dao/HostPodDao.java |   35 +
 .../src/com/cloud/dc/dao/HostPodDaoImpl.java       |  134 +
 engine/schema/src/com/cloud/dc/dao/PodVlanDao.java |   30 +
 .../src/com/cloud/dc/dao/PodVlanDaoImpl.java       |  139 +
 .../schema/src/com/cloud/dc/dao/PodVlanMapDao.java |   30 +
 .../src/com/cloud/dc/dao/PodVlanMapDaoImpl.java    |   75 +
 .../cloud/dc/dao/StorageNetworkIpAddressDao.java   |   32 +
 .../dc/dao/StorageNetworkIpAddressDaoImpl.java     |  114 +
 .../com/cloud/dc/dao/StorageNetworkIpRangeDao.java |   32 +
 .../cloud/dc/dao/StorageNetworkIpRangeDaoImpl.java |   78 +
 engine/schema/src/com/cloud/dc/dao/VlanDao.java    |   55 +
 .../schema/src/com/cloud/dc/dao/VlanDaoImpl.java   |  334 ++
 engine/schema/src/com/cloud/domain/DomainVO.java   |  215 ++
 .../schema/src/com/cloud/domain/dao/DomainDao.java |   34 +
 .../src/com/cloud/domain/dao/DomainDaoImpl.java    |  278 ++
 engine/schema/src/com/cloud/event/EventVO.java     |  194 ++
 .../schema/src/com/cloud/event/UsageEventVO.java   |  216 ++
 .../schema/src/com/cloud/event/dao/EventDao.java   |   38 +
 .../src/com/cloud/event/dao/EventDaoImpl.java      |  109 +
 .../src/com/cloud/event/dao/UsageEventDao.java     |   35 +
 .../src/com/cloud/event/dao/UsageEventDaoImpl.java |  187 +
 engine/schema/src/com/cloud/host/DetailVO.java     |   73 +
 engine/schema/src/com/cloud/host/HostTagVO.java    |   65 +
 engine/schema/src/com/cloud/host/HostVO.java       |  732 ++++
 engine/schema/src/com/cloud/host/dao/HostDao.java  |   83 +
 .../schema/src/com/cloud/host/dao/HostDaoImpl.java |  920 +++++
 .../src/com/cloud/host/dao/HostDetailsDao.java     |   32 +
 .../src/com/cloud/host/dao/HostDetailsDaoImpl.java |  110 +
 .../schema/src/com/cloud/host/dao/HostTagsDao.java |   30 +
 .../src/com/cloud/host/dao/HostTagsDaoImpl.java    |   75 +
 .../cloud/hypervisor/HypervisorCapabilitiesVO.java |  212 ++
 .../hypervisor/dao/HypervisorCapabilitiesDao.java  |   38 +
 .../dao/HypervisorCapabilitiesDaoImpl.java         |  105 +
 .../schema/src/com/cloud/keystore/KeystoreDao.java |   29 +
 .../src/com/cloud/keystore/KeystoreDaoImpl.java    |  118 +
 .../schema/src/com/cloud/keystore/KeystoreVO.java  |  101 +
 .../src/com/cloud/migration/DiskOffering20Dao.java |   22 +
 .../com/cloud/migration/DiskOffering20DaoImpl.java |   27 +
 .../src/com/cloud/migration/DiskOffering20VO.java  |  113 +
 .../src/com/cloud/migration/DiskOffering21Dao.java |   23 +
 .../com/cloud/migration/DiskOffering21DaoImpl.java |   27 +
 .../src/com/cloud/migration/DiskOffering21VO.java  |  257 ++
 .../com/cloud/migration/ServiceOffering20Dao.java  |   22 +
 .../cloud/migration/ServiceOffering20DaoImpl.java  |   27 +
 .../com/cloud/migration/ServiceOffering20VO.java   |  199 ++
 .../com/cloud/migration/ServiceOffering21Dao.java  |   22 +
 .../cloud/migration/ServiceOffering21DaoImpl.java  |   27 +
 .../com/cloud/migration/ServiceOffering21VO.java   |  178 +
 .../com/cloud/network/LBHealthCheckPolicyVO.java   |  157 +
 .../src/com/cloud/network/UserIpv6AddressVO.java   |  188 +
 engine/schema/src/com/cloud/network/VpnUserVO.java |  131 +
 .../network/as/AutoScalePolicyConditionMapVO.java  |   61 +
 .../com/cloud/network/as/AutoScalePolicyVO.java    |  134 +
 .../network/as/AutoScaleVmGroupPolicyMapVO.java    |   64 +
 .../com/cloud/network/as/AutoScaleVmGroupVO.java   |  191 +
 .../com/cloud/network/as/AutoScaleVmProfileVO.java |  218 ++
 .../src/com/cloud/network/as/ConditionVO.java      |  129 +
 .../schema/src/com/cloud/network/as/CounterVO.java |  111 +
 .../as/dao/AutoScalePolicyConditionMapDao.java     |   28 +
 .../as/dao/AutoScalePolicyConditionMapDaoImpl.java |   61 +
 .../cloud/network/as/dao/AutoScalePolicyDao.java   |   24 +
 .../network/as/dao/AutoScalePolicyDaoImpl.java     |   38 +
 .../cloud/network/as/dao/AutoScaleVmGroupDao.java  |   28 +
 .../network/as/dao/AutoScaleVmGroupDaoImpl.java    |   65 +
 .../as/dao/AutoScaleVmGroupPolicyMapDao.java       |   30 +
 .../as/dao/AutoScaleVmGroupPolicyMapDaoImpl.java   |   77 +
 .../network/as/dao/AutoScaleVmProfileDao.java      |   25 +
 .../network/as/dao/AutoScaleVmProfileDaoImpl.java  |   38 +
 .../src/com/cloud/network/as/dao/ConditionDao.java |   28 +
 .../com/cloud/network/as/dao/ConditionDaoImpl.java |   56 +
 .../src/com/cloud/network/as/dao/CounterDao.java   |   29 +
 .../com/cloud/network/as/dao/CounterDaoImpl.java   |   70 +
 .../cloud/network/dao/AccountGuestVlanMapDao.java  |   34 +
 .../network/dao/AccountGuestVlanMapDaoImpl.java    |   83 +
 .../cloud/network/dao/AccountGuestVlanMapVO.java   |   94 +
 .../network/dao/ExternalFirewallDeviceDao.java     |   58 +
 .../network/dao/ExternalFirewallDeviceDaoImpl.java |   96 +
 .../network/dao/ExternalFirewallDeviceVO.java      |  161 +
 .../network/dao/ExternalLoadBalancerDeviceDao.java |   74 +
 .../dao/ExternalLoadBalancerDeviceDaoImpl.java     |  127 +
 .../network/dao/ExternalLoadBalancerDeviceVO.java  |  227 ++
 .../cloud/network/dao/FirewallRulesCidrsDao.java   |   29 +
 .../network/dao/FirewallRulesCidrsDaoImpl.java     |   70 +
 .../cloud/network/dao/FirewallRulesCidrsVO.java    |   65 +
 .../com/cloud/network/dao/FirewallRulesDao.java    |   64 +
 .../cloud/network/dao/FirewallRulesDaoImpl.java    |  352 ++
 .../src/com/cloud/network/dao/IPAddressDao.java    |   71 +
 .../com/cloud/network/dao/IPAddressDaoImpl.java    |  376 ++
 .../src/com/cloud/network/dao/IPAddressVO.java     |  308 ++
 .../network/dao/InlineLoadBalancerNicMapDao.java   |   24 +
 .../dao/InlineLoadBalancerNicMapDaoImpl.java       |   46 +
 .../network/dao/InlineLoadBalancerNicMapVO.java    |   60 +
 .../cloud/network/dao/LBHealthCheckPolicyDao.java  |   35 +
 .../network/dao/LBHealthCheckPolicyDaoImpl.java    |   71 +
 .../cloud/network/dao/LBStickinessPolicyDao.java   |   34 +
 .../network/dao/LBStickinessPolicyDaoImpl.java     |   69 +
 .../cloud/network/dao/LBStickinessPolicyVO.java    |  145 +
 .../src/com/cloud/network/dao/LoadBalancerDao.java |   32 +
 .../com/cloud/network/dao/LoadBalancerDaoImpl.java |   79 +
 .../cloud/network/dao/LoadBalancerVMMapDao.java    |   31 +
 .../network/dao/LoadBalancerVMMapDaoImpl.java      |   97 +
 .../com/cloud/network/dao/LoadBalancerVMMapVO.java |   89 +
 .../src/com/cloud/network/dao/LoadBalancerVO.java  |  116 +
 .../com/cloud/network/dao/NetworkAccountDao.java   |   22 +
 .../cloud/network/dao/NetworkAccountDaoImpl.java   |   29 +
 .../com/cloud/network/dao/NetworkAccountVO.java    |   72 +
 .../src/com/cloud/network/dao/NetworkDao.java      |  114 +
 .../src/com/cloud/network/dao/NetworkDaoImpl.java  |  621 ++++
 .../com/cloud/network/dao/NetworkDomainDao.java    |   27 +
 .../cloud/network/dao/NetworkDomainDaoImpl.java    |   75 +
 .../src/com/cloud/network/dao/NetworkDomainVO.java |   72 +
 .../network/dao/NetworkExternalFirewallDao.java    |   38 +
 .../dao/NetworkExternalFirewallDaoImpl.java        |   61 +
 .../network/dao/NetworkExternalFirewallVO.java     |   88 +
 .../dao/NetworkExternalLoadBalancerDao.java        |   38 +
 .../dao/NetworkExternalLoadBalancerDaoImpl.java    |   62 +
 .../network/dao/NetworkExternalLoadBalancerVO.java |   89 +
 .../src/com/cloud/network/dao/NetworkOpDao.java    |   26 +
 .../com/cloud/network/dao/NetworkOpDaoImpl.java    |   84 +
 .../src/com/cloud/network/dao/NetworkOpVO.java     |   76 +
 .../cloud/network/dao/NetworkRuleConfigDao.java    |   26 +
 .../network/dao/NetworkRuleConfigDaoImpl.java      |   51 +
 .../com/cloud/network/dao/NetworkRuleConfigVO.java |   93 +
 .../cloud/network/dao/NetworkServiceMapDao.java    |   39 +
 .../network/dao/NetworkServiceMapDaoImpl.java      |  176 +
 .../com/cloud/network/dao/NetworkServiceMapVO.java |   92 +
 .../src/com/cloud/network/dao/NetworkVO.java       |  552 +++
 .../com/cloud/network/dao/PhysicalNetworkDao.java  |   28 +
 .../cloud/network/dao/PhysicalNetworkDaoImpl.java  |   79 +
 .../dao/PhysicalNetworkIsolationMethodDaoImpl.java |   70 +
 .../dao/PhysicalNetworkIsolationMethodVO.java      |   68 +
 .../dao/PhysicalNetworkServiceProviderDao.java     |   28 +
 .../dao/PhysicalNetworkServiceProviderDaoImpl.java |  131 +
 .../dao/PhysicalNetworkServiceProviderVO.java      |  322 ++
 .../network/dao/PhysicalNetworkTagDaoImpl.java     |   63 +
 .../cloud/network/dao/PhysicalNetworkTagVO.java    |   68 +
 .../network/dao/PhysicalNetworkTrafficTypeDao.java |   33 +
 .../dao/PhysicalNetworkTrafficTypeDaoImpl.java     |  143 +
 .../network/dao/PhysicalNetworkTrafficTypeVO.java  |  149 +
 .../com/cloud/network/dao/PhysicalNetworkVO.java   |  246 ++
 .../src/com/cloud/network/dao/PortProfileDao.java  |   50 +
 .../com/cloud/network/dao/PortProfileDaoImpl.java  |   89 +
 .../src/com/cloud/network/dao/PortProfileVO.java   |  204 ++
 .../com/cloud/network/dao/RemoteAccessVpnDao.java  |   30 +
 .../cloud/network/dao/RemoteAccessVpnDaoImpl.java  |   84 +
 .../com/cloud/network/dao/RemoteAccessVpnVO.java   |  142 +
 .../com/cloud/network/dao/RouterNetworkDao.java    |   26 +
 .../cloud/network/dao/RouterNetworkDaoImpl.java    |   62 +
 .../src/com/cloud/network/dao/RouterNetworkVO.java |   75 +
 .../network/dao/Site2SiteCustomerGatewayDao.java   |   27 +
 .../dao/Site2SiteCustomerGatewayDaoImpl.java       |   66 +
 .../network/dao/Site2SiteCustomerGatewayVO.java    |  206 ++
 .../network/dao/Site2SiteVpnConnectionDao.java     |   29 +
 .../network/dao/Site2SiteVpnConnectionDaoImpl.java |   97 +
 .../network/dao/Site2SiteVpnConnectionVO.java      |  143 +
 .../cloud/network/dao/Site2SiteVpnGatewayDao.java  |   23 +
 .../network/dao/Site2SiteVpnGatewayDaoImpl.java    |   50 +
 .../cloud/network/dao/Site2SiteVpnGatewayVO.java   |  114 +
 .../com/cloud/network/dao/UserIpv6AddressDao.java  |   41 +
 .../cloud/network/dao/UserIpv6AddressDaoImpl.java  |  122 +
 .../network/dao/VirtualRouterProviderDao.java      |   31 +
 .../network/dao/VirtualRouterProviderDaoImpl.java  |   79 +
 .../src/com/cloud/network/dao/VpnUserDao.java      |   28 +
 .../src/com/cloud/network/dao/VpnUserDaoImpl.java  |   87 +
 .../network/element/VirtualRouterProviderVO.java   |  120 +
 .../com/cloud/network/rules/FirewallRuleVO.java    |  268 ++
 .../cloud/network/rules/PortForwardingRuleVO.java  |   96 +
 .../network/rules/dao/PortForwardingRulesDao.java  |   47 +
 .../rules/dao/PortForwardingRulesDaoImpl.java      |  162 +
 .../network/security/SecurityGroupRuleVO.java      |  167 +
 .../network/security/SecurityGroupRulesVO.java     |  169 +
 .../network/security/SecurityGroupVMMapVO.java     |   89 +
 .../cloud/network/security/SecurityGroupVO.java    |   99 +
 .../cloud/network/security/SecurityGroupWork.java  |   40 +
 .../network/security/SecurityGroupWorkVO.java      |  135 +
 .../com/cloud/network/security/VmRulesetLogVO.java |   81 +
 .../network/security/dao/SecurityGroupDao.java     |   30 +
 .../network/security/dao/SecurityGroupDaoImpl.java |  136 +
 .../network/security/dao/SecurityGroupRuleDao.java |   35 +
 .../security/dao/SecurityGroupRuleDaoImpl.java     |  176 +
 .../security/dao/SecurityGroupRulesDao.java        |   48 +
 .../security/dao/SecurityGroupRulesDaoImpl.java    |   96 +
 .../security/dao/SecurityGroupVMMapDao.java        |   38 +
 .../security/dao/SecurityGroupVMMapDaoImpl.java    |  166 +
 .../network/security/dao/SecurityGroupWorkDao.java |   49 +
 .../security/dao/SecurityGroupWorkDaoImpl.java     |  241 ++
 .../network/security/dao/VmRulesetLogDao.java      |   29 +
 .../network/security/dao/VmRulesetLogDaoImpl.java  |  200 ++
 .../src/com/cloud/network/vpc/PrivateIpVO.java     |  103 +
 .../src/com/cloud/network/vpc/StaticRouteVO.java   |  141 +
 .../src/com/cloud/network/vpc/VpcGatewayVO.java    |  206 ++
 .../cloud/network/vpc/VpcOfferingServiceMapVO.java |   89 +
 .../src/com/cloud/network/vpc/VpcOfferingVO.java   |  151 +
 .../src/com/cloud/network/vpc/VpcServiceMapVO.java |   90 +
 engine/schema/src/com/cloud/network/vpc/VpcVO.java |  181 +
 .../com/cloud/network/vpc/dao/PrivateIpDao.java    |   75 +
 .../cloud/network/vpc/dao/PrivateIpDaoImpl.java    |  156 +
 .../com/cloud/network/vpc/dao/StaticRouteDao.java  |   35 +
 .../cloud/network/vpc/dao/StaticRouteDaoImpl.java  |  119 +
 .../src/com/cloud/network/vpc/dao/VpcDao.java      |   47 +
 .../src/com/cloud/network/vpc/dao/VpcDaoImpl.java  |  152 +
 .../com/cloud/network/vpc/dao/VpcGatewayDao.java   |   26 +
 .../cloud/network/vpc/dao/VpcGatewayDaoImpl.java   |   62 +
 .../com/cloud/network/vpc/dao/VpcOfferingDao.java  |   32 +
 .../cloud/network/vpc/dao/VpcOfferingDaoImpl.java  |   71 +
 .../network/vpc/dao/VpcOfferingServiceMapDao.java  |   41 +
 .../vpc/dao/VpcOfferingServiceMapDaoImpl.java      |  119 +
 .../cloud/network/vpc/dao/VpcServiceMapDao.java    |   40 +
 .../network/vpc/dao/VpcServiceMapDaoImpl.java      |  115 +
 .../cloud/offerings/NetworkOfferingDetailsVO.java  |   90 +
 .../offerings/NetworkOfferingServiceMapVO.java     |   94 +
 .../src/com/cloud/offerings/NetworkOfferingVO.java |  417 +++
 .../cloud/offerings/dao/NetworkOfferingDao.java    |   64 +
 .../offerings/dao/NetworkOfferingDaoImpl.java      |  193 ++
 .../offerings/dao/NetworkOfferingDetailsDao.java   |   31 +
 .../dao/NetworkOfferingDetailsDaoImpl.java         |   79 +
 .../dao/NetworkOfferingServiceMapDao.java          |   50 +
 .../dao/NetworkOfferingServiceMapDaoImpl.java      |  171 +
 .../src/com/cloud/projects/ProjectAccountVO.java   |   96 +
 .../com/cloud/projects/ProjectInvitationVO.java    |  150 +
 .../schema/src/com/cloud/projects/ProjectVO.java   |  163 +
 .../com/cloud/projects/dao/ProjectAccountDao.java  |   43 +
 .../cloud/projects/dao/ProjectAccountDaoImpl.java  |  157 +
 .../src/com/cloud/projects/dao/ProjectDao.java     |   37 +
 .../src/com/cloud/projects/dao/ProjectDaoImpl.java |  124 +
 .../cloud/projects/dao/ProjectInvitationDao.java   |   44 +
 .../projects/dao/ProjectInvitationDaoImpl.java     |  171 +
 .../com/cloud/secstorage/CommandExecLogDao.java    |   25 +
 .../cloud/secstorage/CommandExecLogDaoImpl.java    |   49 +
 .../src/com/cloud/secstorage/CommandExecLogVO.java |  112 +
 .../src/com/cloud/service/ServiceOfferingVO.java   |  211 ++
 .../com/cloud/service/dao/ServiceOfferingDao.java  |   34 +
 .../cloud/service/dao/ServiceOfferingDaoImpl.java  |  157 +
 .../src/com/cloud/storage/DiskOfferingVO.java      |  330 ++
 .../src/com/cloud/storage/GuestOSCategoryVO.java   |   68 +
 engine/schema/src/com/cloud/storage/GuestOSVO.java |   90 +
 .../src/com/cloud/storage/LaunchPermissionVO.java  |   57 +
 engine/schema/src/com/cloud/storage/S3VO.java      |  209 ++
 .../src/com/cloud/storage/SnapshotPolicyVO.java    |  133 +
 .../src/com/cloud/storage/SnapshotScheduleVO.java  |  125 +
 .../schema/src/com/cloud/storage/SnapshotVO.java   |  298 ++
 .../com/cloud/storage/StoragePoolHostAssoc.java    |   35 +
 .../src/com/cloud/storage/StoragePoolHostVO.java   |  109 +
 .../src/com/cloud/storage/StoragePoolWorkVO.java   |  118 +
 engine/schema/src/com/cloud/storage/SwiftVO.java   |  108 +
 engine/schema/src/com/cloud/storage/UploadVO.java  |  268 ++
 .../src/com/cloud/storage/VMTemplateDetailVO.java  |   84 +
 .../src/com/cloud/storage/VMTemplateHostVO.java    |  322 ++
 .../src/com/cloud/storage/VMTemplateS3VO.java      |  204 ++
 .../com/cloud/storage/VMTemplateStoragePoolVO.java |  275 ++
 .../src/com/cloud/storage/VMTemplateSwiftVO.java   |  107 +
 .../schema/src/com/cloud/storage/VMTemplateVO.java |  534 +++
 .../src/com/cloud/storage/VMTemplateZoneVO.java    |  116 +
 .../schema/src/com/cloud/storage/VolumeHostVO.java |  347 ++
 engine/schema/src/com/cloud/storage/VolumeVO.java  |  466 +++
 .../src/com/cloud/storage/dao/DiskOfferingDao.java |   31 +
 .../com/cloud/storage/dao/DiskOfferingDaoImpl.java |  152 +
 .../com/cloud/storage/dao/GuestOSCategoryDao.java  |   24 +
 .../cloud/storage/dao/GuestOSCategoryDaoImpl.java  |   34 +
 .../src/com/cloud/storage/dao/GuestOSDao.java      |   26 +
 .../src/com/cloud/storage/dao/GuestOSDaoImpl.java  |   51 +
 .../com/cloud/storage/dao/LaunchPermissionDao.java |   61 +
 .../cloud/storage/dao/LaunchPermissionDaoImpl.java |  158 +
 engine/schema/src/com/cloud/storage/dao/S3Dao.java |   29 +
 .../src/com/cloud/storage/dao/S3DaoImpl.java       |   50 +
 .../src/com/cloud/storage/dao/SnapshotDao.java     |   54 +
 .../src/com/cloud/storage/dao/SnapshotDaoImpl.java |  357 ++
 .../com/cloud/storage/dao/SnapshotPolicyDao.java   |   38 +
 .../cloud/storage/dao/SnapshotPolicyDaoImpl.java   |  105 +
 .../com/cloud/storage/dao/SnapshotScheduleDao.java |   41 +
 .../cloud/storage/dao/SnapshotScheduleDaoImpl.java |  134 +
 .../storage/dao/StoragePoolDetailsDaoImpl.java     |   85 +
 .../com/cloud/storage/dao/StoragePoolHostDao.java  |   42 +
 .../cloud/storage/dao/StoragePoolHostDaoImpl.java  |  184 +
 .../com/cloud/storage/dao/StoragePoolWorkDao.java  |   38 +
 .../cloud/storage/dao/StoragePoolWorkDaoImpl.java  |  136 +
 .../schema/src/com/cloud/storage/dao/SwiftDao.java |   31 +
 .../src/com/cloud/storage/dao/SwiftDaoImpl.java    |   58 +
 .../src/com/cloud/storage/dao/UploadDao.java       |   36 +
 .../src/com/cloud/storage/dao/UploadDaoImpl.java   |   92 +
 .../src/com/cloud/storage/dao/VMTemplateDao.java   |   84 +
 .../com/cloud/storage/dao/VMTemplateDaoImpl.java   | 1136 ++++++
 .../cloud/storage/dao/VMTemplateDetailsDao.java    |   32 +
 .../storage/dao/VMTemplateDetailsDaoImpl.java      |   99 +
 .../com/cloud/storage/dao/VMTemplateHostDao.java   |   67 +
 .../cloud/storage/dao/VMTemplateHostDaoImpl.java   |  427 +++
 .../com/cloud/storage/dao/VMTemplatePoolDao.java   |   49 +
 .../cloud/storage/dao/VMTemplatePoolDaoImpl.java   |  304 ++
 .../src/com/cloud/storage/dao/VMTemplateS3Dao.java |   36 +
 .../com/cloud/storage/dao/VMTemplateS3DaoImpl.java |  105 +
 .../com/cloud/storage/dao/VMTemplateSwiftDao.java  |   37 +
 .../cloud/storage/dao/VMTemplateSwiftDaoImpl.java  |   87 +
 .../com/cloud/storage/dao/VMTemplateZoneDao.java   |   33 +
 .../cloud/storage/dao/VMTemplateZoneDaoImpl.java   |   89 +
 .../src/com/cloud/storage/dao/VolumeDao.java       |   92 +
 .../src/com/cloud/storage/dao/VolumeDaoImpl.java   |  459 +++
 .../src/com/cloud/storage/dao/VolumeHostDao.java   |   40 +
 .../com/cloud/storage/dao/VolumeHostDaoImpl.java   |  165 +
 .../schema/src/com/cloud/tags/ResourceTagVO.java   |  160 +
 .../src/com/cloud/tags/dao/ResourceTagDao.java     |   37 +
 .../com/cloud/tags/dao/ResourceTagsDaoImpl.java    |   62 +
 .../src/com/cloud/upgrade/DatabaseCreator.java     |  233 ++
 .../cloud/upgrade/DatabaseIntegrityChecker.java    |  264 ++
 .../com/cloud/upgrade/DatabaseUpgradeChecker.java  |  369 ++
 .../upgrade/PremiumDatabaseUpgradeChecker.java     |  148 +
 .../src/com/cloud/upgrade/dao/DbUpgrade.java       |   45 +
 .../src/com/cloud/upgrade/dao/DbUpgradeUtils.java  |  106 +
 .../src/com/cloud/upgrade/dao/Upgrade217to218.java |   66 +
 .../src/com/cloud/upgrade/dao/Upgrade218to22.java  | 2382 +++++++++++++
 .../upgrade/dao/Upgrade218to224DomainVlans.java    |  140 +
 .../cloud/upgrade/dao/Upgrade218to22Premium.java   |  100 +
 .../com/cloud/upgrade/dao/Upgrade2210to2211.java   |   64 +
 .../com/cloud/upgrade/dao/Upgrade2211to2212.java   |  139 +
 .../upgrade/dao/Upgrade2211to2212Premium.java      |   55 +
 .../com/cloud/upgrade/dao/Upgrade2212to2213.java   |  104 +
 .../com/cloud/upgrade/dao/Upgrade2213to2214.java   |  308 ++
 .../src/com/cloud/upgrade/dao/Upgrade2214to30.java | 1326 +++++++
 .../src/com/cloud/upgrade/dao/Upgrade221to222.java |   66 +
 .../cloud/upgrade/dao/Upgrade221to222Premium.java  |   61 +
 .../src/com/cloud/upgrade/dao/Upgrade222to224.java |  610 ++++
 .../cloud/upgrade/dao/Upgrade222to224Premium.java  |   87 +
 .../src/com/cloud/upgrade/dao/Upgrade224to225.java |  351 ++
 .../src/com/cloud/upgrade/dao/Upgrade225to226.java |  108 +
 .../src/com/cloud/upgrade/dao/Upgrade227to228.java |  157 +
 .../cloud/upgrade/dao/Upgrade227to228Premium.java  |  132 +
 .../src/com/cloud/upgrade/dao/Upgrade228to229.java |  138 +
 .../com/cloud/upgrade/dao/Upgrade229to2210.java    |  194 ++
 .../src/com/cloud/upgrade/dao/Upgrade301to302.java |  229 ++
 .../src/com/cloud/upgrade/dao/Upgrade302to40.java  | 1082 ++++++
 .../src/com/cloud/upgrade/dao/Upgrade30to301.java  |  124 +
 .../src/com/cloud/upgrade/dao/Upgrade30xBase.java  |  311 ++
 .../src/com/cloud/upgrade/dao/Upgrade40to41.java   |  164 +
 .../src/com/cloud/upgrade/dao/Upgrade410to420.java |  489 +++
 .../cloud/upgrade/dao/UpgradeSnapshot217to224.java |   60 +
 .../cloud/upgrade/dao/UpgradeSnapshot223to224.java |   60 +
 .../src/com/cloud/upgrade/dao/VersionDao.java      |   25 +
 .../src/com/cloud/upgrade/dao/VersionDaoImpl.java  |  172 +
 .../src/com/cloud/upgrade/dao/VersionVO.java       |   91 +
 .../cloud/usage/ExternalPublicIpStatisticsVO.java  |   98 +
 .../src/com/cloud/usage/UsageIPAddressVO.java      |  121 +
 engine/schema/src/com/cloud/usage/UsageJobVO.java  |  180 +
 .../com/cloud/usage/UsageLoadBalancerPolicyVO.java |   91 +
 .../com/cloud/usage/UsageNetworkOfferingVO.java    |  117 +
 .../schema/src/com/cloud/usage/UsageNetworkVO.java |  144 +
 .../com/cloud/usage/UsagePortForwardingRuleVO.java |   91 +
 .../src/com/cloud/usage/UsageSecurityGroupVO.java  |   97 +
 .../schema/src/com/cloud/usage/UsageStorageVO.java |  115 +
 .../src/com/cloud/usage/UsageVMInstanceVO.java     |  121 +
 engine/schema/src/com/cloud/usage/UsageVO.java     |  260 ++
 .../schema/src/com/cloud/usage/UsageVPNUserVO.java |  105 +
 .../schema/src/com/cloud/usage/UsageVolumeVO.java  |  115 +
 .../usage/dao/ExternalPublicIpStatisticsDao.java   |   33 +
 .../dao/ExternalPublicIpStatisticsDaoImpl.java     |   77 +
 .../schema/src/com/cloud/usage/dao/UsageDao.java   |   39 +
 .../src/com/cloud/usage/dao/UsageDaoImpl.java      |  273 ++
 .../src/com/cloud/usage/dao/UsageIPAddressDao.java |   28 +
 .../com/cloud/usage/dao/UsageIPAddressDaoImpl.java |  145 +
 .../src/com/cloud/usage/dao/UsageJobDao.java       |   34 +
 .../src/com/cloud/usage/dao/UsageJobDaoImpl.java   |  200 ++
 .../usage/dao/UsageLoadBalancerPolicyDao.java      |   29 +
 .../usage/dao/UsageLoadBalancerPolicyDaoImpl.java  |  169 +
 .../src/com/cloud/usage/dao/UsageNetworkDao.java   |   27 +
 .../com/cloud/usage/dao/UsageNetworkDaoImpl.java   |   98 +
 .../cloud/usage/dao/UsageNetworkOfferingDao.java   |   28 +
 .../usage/dao/UsageNetworkOfferingDaoImpl.java     |  153 +
 .../usage/dao/UsagePortForwardingRuleDao.java      |   29 +
 .../usage/dao/UsagePortForwardingRuleDaoImpl.java  |  169 +
 .../com/cloud/usage/dao/UsageSecurityGroupDao.java |   28 +
 .../cloud/usage/dao/UsageSecurityGroupDaoImpl.java |  151 +
 .../src/com/cloud/usage/dao/UsageStorageDao.java   |   31 +
 .../com/cloud/usage/dao/UsageStorageDaoImpl.java   |  211 ++
 .../com/cloud/usage/dao/UsageVMInstanceDao.java    |   29 +
 .../cloud/usage/dao/UsageVMInstanceDaoImpl.java    |  137 +
 .../src/com/cloud/usage/dao/UsageVPNUserDao.java   |   28 +
 .../com/cloud/usage/dao/UsageVPNUserDaoImpl.java   |  150 +
 .../src/com/cloud/usage/dao/UsageVolumeDao.java    |   29 +
 .../com/cloud/usage/dao/UsageVolumeDaoImpl.java    |  178 +
 .../schema/src/com/cloud/user/AccountDetailVO.java |   75 +
 .../src/com/cloud/user/AccountDetailsDao.java      |   37 +
 .../src/com/cloud/user/AccountDetailsDaoImpl.java  |   96 +
 engine/schema/src/com/cloud/user/AccountVO.java    |  189 +
 engine/schema/src/com/cloud/user/SSHKeyPairVO.java |  119 +
 .../schema/src/com/cloud/user/UserAccountVO.java   |  284 ++
 .../src/com/cloud/user/UserStatisticsVO.java       |  165 +
 .../schema/src/com/cloud/user/UserStatsLogVO.java  |  132 +
 engine/schema/src/com/cloud/user/UserVO.java       |  274 ++
 .../schema/src/com/cloud/user/dao/AccountDao.java  |   52 +
 .../src/com/cloud/user/dao/AccountDaoImpl.java     |  267 ++
 .../src/com/cloud/user/dao/SSHKeyPairDao.java      |   38 +
 .../src/com/cloud/user/dao/SSHKeyPairDaoImpl.java  |   85 +
 .../src/com/cloud/user/dao/UserAccountDao.java     |   27 +
 .../src/com/cloud/user/dao/UserAccountDaoImpl.java |   69 +
 engine/schema/src/com/cloud/user/dao/UserDao.java  |   52 +
 .../schema/src/com/cloud/user/dao/UserDaoImpl.java |  131 +
 .../src/com/cloud/user/dao/UserStatisticsDao.java  |   35 +
 .../com/cloud/user/dao/UserStatisticsDaoImpl.java  |  137 +
 .../src/com/cloud/user/dao/UserStatsLogDao.java    |   23 +
 .../com/cloud/user/dao/UserStatsLogDaoImpl.java    |   31 +
 engine/schema/src/com/cloud/vm/ConsoleProxyVO.java |  287 ++
 engine/schema/src/com/cloud/vm/DomainRouterVO.java |  246 ++
 .../src/com/cloud/vm/InstanceGroupVMMapVO.java     |   71 +
 .../schema/src/com/cloud/vm/InstanceGroupVO.java   |  120 +
 engine/schema/src/com/cloud/vm/ItWorkDao.java      |   45 +
 engine/schema/src/com/cloud/vm/ItWorkDaoImpl.java  |  108 +
 engine/schema/src/com/cloud/vm/ItWorkVO.java       |  179 +
 engine/schema/src/com/cloud/vm/NicVO.java          |  365 ++
 .../src/com/cloud/vm/SecondaryStorageVmVO.java     |  135 +
 .../src/com/cloud/vm/UserVmCloneSettingVO.java     |   50 +
 engine/schema/src/com/cloud/vm/UserVmDetailVO.java |   85 +
 engine/schema/src/com/cloud/vm/UserVmVO.java       |  141 +
 engine/schema/src/com/cloud/vm/VMInstanceVO.java   |  493 +++
 .../src/com/cloud/vm/dao/ConsoleProxyDao.java      |   47 +
 .../src/com/cloud/vm/dao/ConsoleProxyDaoImpl.java  |  353 ++
 .../src/com/cloud/vm/dao/DomainRouterDao.java      |  149 +
 .../src/com/cloud/vm/dao/DomainRouterDaoImpl.java  |  358 ++
 .../src/com/cloud/vm/dao/InstanceGroupDao.java     |   36 +
 .../src/com/cloud/vm/dao/InstanceGroupDaoImpl.java |   80 +
 .../com/cloud/vm/dao/InstanceGroupVMMapDao.java    |   28 +
 .../cloud/vm/dao/InstanceGroupVMMapDaoImpl.java    |   75 +
 engine/schema/src/com/cloud/vm/dao/NicDao.java     |   69 +
 engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java |  241 ++
 .../src/com/cloud/vm/dao/NicSecondaryIpDao.java    |   53 +
 .../com/cloud/vm/dao/NicSecondaryIpDaoImpl.java    |  138 +
 .../src/com/cloud/vm/dao/NicSecondaryIpVO.java     |  160 +
 .../com/cloud/vm/dao/SecondaryStorageVmDao.java    |   42 +
 .../cloud/vm/dao/SecondaryStorageVmDaoImpl.java    |  269 ++
 .../com/cloud/vm/dao/UserVmCloneSettingDao.java    |   37 +
 .../cloud/vm/dao/UserVmCloneSettingDaoImpl.java    |   74 +
 engine/schema/src/com/cloud/vm/dao/UserVmDao.java  |   77 +
 .../schema/src/com/cloud/vm/dao/UserVmDaoImpl.java |  586 ++++
 engine/schema/src/com/cloud/vm/dao/UserVmData.java |  723 ++++
 .../src/com/cloud/vm/dao/UserVmDetailsDao.java     |   32 +
 .../src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java |   99 +
 .../schema/src/com/cloud/vm/dao/VMInstanceDao.java |  119 +
 .../src/com/cloud/vm/dao/VMInstanceDaoImpl.java    |  628 ++++
 .../src/com/cloud/vm/snapshot/VMSnapshotVO.java    |  224 ++
 .../com/cloud/vm/snapshot/dao/VMSnapshotDao.java   |   39 +
 .../cloud/vm/snapshot/dao/VMSnapshotDaoImpl.java   |  161 +
 .../cloudstack/affinity/AffinityGroupVMMapVO.java  |   66 +
 .../cloudstack/affinity/AffinityGroupVO.java       |  114 +
 .../cloudstack/affinity/dao/AffinityGroupDao.java  |   30 +
 .../affinity/dao/AffinityGroupDaoImpl.java         |  102 +
 .../affinity/dao/AffinityGroupVMMapDao.java        |   47 +
 .../affinity/dao/AffinityGroupVMMapDaoImpl.java    |  167 +
 .../lb/ApplicationLoadBalancerRuleVO.java          |  133 +
 .../lb/dao/ApplicationLoadBalancerRuleDao.java     |   35 +
 .../lb/dao/ApplicationLoadBalancerRuleDaoImpl.java |  115 +
 .../org/apache/cloudstack/region/RegionSyncVO.java |   93 +
 .../src/org/apache/cloudstack/region/RegionVO.java |   87 +
 .../apache/cloudstack/region/dao/RegionDao.java    |   27 +
 .../cloudstack/region/dao/RegionDaoImpl.java       |   48 +
 .../region/gslb/GlobalLoadBalancerDaoImpl.java     |   58 +
 .../gslb/GlobalLoadBalancerLbRuleMapDao.java       |   30 +
 .../gslb/GlobalLoadBalancerLbRuleMapDaoImpl.java   |   63 +
 .../region/gslb/GlobalLoadBalancerLbRuleMapVO.java |   83 +
 .../region/gslb/GlobalLoadBalancerRuleDao.java     |   28 +
 .../region/gslb/GlobalLoadBalancerRuleVO.java      |  183 +
 .../StorageAllocatorTestConfiguration.java         |    4 +-
 .../storage/test/ChildTestConfiguration.java       |    4 +-
 .../datastore/provider/DefaultHostListener.java    |    2 +-
 framework/api/pom.xml                              |   42 -
 .../framework/async/AsyncCallFuture.java           |   84 -
 .../framework/async/AsyncCompletionCallback.java   |   23 -
 framework/events/pom.xml                           |   51 +-
 framework/ipc/pom.xml                              |   20 +-
 .../framework/async/AsyncCallFuture.java           |   84 +
 .../framework/async/AsyncCompletionCallback.java   |   23 +
 .../framework/client/ClientEventBus.java           |    4 +-
 .../framework/client/ClientTransportProvider.java  |    2 +-
 .../cloudstack/framework/eventbus/EventBus.java    |   32 -
 .../framework/eventbus/EventBusBase.java           |  308 --
 .../framework/eventbus/EventBusEndpoint.java       |   61 -
 .../framework/eventbus/EventDispatcher.java        |  104 -
 .../framework/eventbus/EventHandler.java           |   30 -
 .../framework/eventbus/PublishScope.java           |   24 -
 .../cloudstack/framework/eventbus/Subscriber.java  |   24 -
 .../framework/messagebus/MessageBus.java           |   34 +
 .../framework/messagebus/MessageBusBase.java       |  408 +++
 .../framework/messagebus/MessageBusEndpoint.java   |   61 +
 .../framework/messagebus/MessageDispatcher.java    |  104 +
 .../framework/messagebus/MessageHandler.java       |   30 +
 .../framework/messagebus/MessageSubscriber.java    |   24 +
 .../framework/messagebus/PublishScope.java         |   24 +
 .../framework/server/ServerEventBus.java           |    4 +-
 .../sampleserver/SampleManagerComponent.java       |   12 +-
 .../sampleserver/SampleManagerComponent2.java      |   12 +-
 .../cloudstack/messagebus/TestMessageBus.java      |  116 +
 .../ipc/test/resources/MessageBusTestContext.xml   |   51 +
 framework/jobs/pom.xml                             |   33 +-
 framework/pom.xml                                  |    2 +-
 packaging/centos63/package.sh                      |    4 +-
 patches/systemvm/debian/config/etc/dnsmasq.conf    |  634 ----
 .../systemvm/debian/config/etc/dnsmasq.conf.tmpl   |  634 ++++
 .../debian/config/etc/init.d/cloud-early-config    |   37 +
 .../debian/config/etc/iptables/iptables-ilbvm      |   33 +
 patches/systemvm/debian/config/etc/vpcdnsmasq.conf |    3 -
 .../systemvm/debian/config/opt/cloud/bin/ilb.sh    |  211 ++
 .../debian/config/opt/cloud/bin/patchsystemvm.sh   |   23 +
 .../config/opt/cloud/bin/vpc_loadbalancer.sh       |   23 +
 .../config/opt/cloud/bin/vpc_privateGateway.sh     |    2 +-
 patches/systemvm/debian/config/root/edithosts.sh   |   31 +-
 .../discovery/ApiDiscoveryServiceImpl.java         |    4 +
 .../kvm/resource/LibvirtComputingResource.java     |    2 +-
 .../cloud/agent/manager/SimulatorManagerImpl.java  |   78 +-
 .../src/com/cloud/simulator/MockSecStorageVO.java  |    3 +-
 .../src/com/cloud/simulator/MockStoragePoolVO.java |    3 +-
 .../src/com/cloud/simulator/MockVolumeVO.java      |    3 +-
 plugins/hypervisors/vmware/pom.xml                 |   10 +
 .../src/com/cloud/hypervisor/guru/VMwareGuru.java  |   12 +
 .../vmware/manager/VmwareManagerImpl.java          |    3 +-
 .../vmware/manager/VmwareStorageManager.java       |    4 +
 .../vmware/manager/VmwareStorageManagerImpl.java   |  401 ++-
 .../hypervisor/vmware/resource/VmwareResource.java |  116 +-
 .../VmwareSecondaryStorageResourceHandler.java     |   24 +
 .../vmware/resource/VmwareResourceTest.java        |   82 +
 .../xen/discoverer/XcpServerDiscoverer.java        |    7 +-
 .../hypervisor/xen/resource/CitrixHelper.java      |   90 +-
 .../xen/resource/CitrixResourceBase.java           |   14 +
 .../hypervisor/xen/resource/XcpServerResource.java |   11 +-
 .../cloud/network/element/BigSwitchVnsElement.java |    4 +-
 .../network/cisco/create-egress-acl-rule.xml       |   53 +-
 .../create-generic-egress-acl-no-protocol-rule.xml |   94 +
 .../cisco/create-generic-egress-acl-rule.xml       |    1 -
 .../network/cisco/create-ingress-acl-rule.xml      |   43 +-
 .../commands/ListCiscoAsa1000vResourcesCmd.java    |    1 +
 .../api/commands/ListCiscoVnmcResourcesCmd.java    |   15 +-
 .../response/CiscoAsa1000vResourceResponse.java    |   45 +-
 .../api/response/CiscoVnmcResourceResponse.java    |   42 +-
 .../cloud/network/cisco/CiscoVnmcConnection.java   |   10 +-
 .../network/cisco/CiscoVnmcConnectionImpl.java     |   65 +-
 .../cloud/network/element/CiscoVnmcElement.java    |   48 +-
 .../cloud/network/resource/CiscoVnmcResource.java  |   12 +-
 .../network/resource/CiscoVnmcResourceTest.java    |    4 +-
 .../element/ElasticLoadBalancerElement.java        |   22 +-
 .../network/lb/ElasticLoadBalancerManager.java     |    4 +-
 .../network/lb/ElasticLoadBalancerManagerImpl.java |   32 +-
 .../element/F5ExternalLoadBalancerElement.java     |   87 +-
 .../network-elements/internal-loadbalancer/pom.xml |   50 +
 .../element/InternalLoadBalancerElement.java       |  548 +++
 .../network/lb/InternalLoadBalancerVMManager.java  |   90 +
 .../lb/InternalLoadBalancerVMManagerImpl.java      |  951 +++++
 .../ElementChildTestConfiguration.java             |  125 +
 .../InternalLbElementServiceTest.java              |  189 +
 .../internallbelement/InternalLbElementTest.java   |  226 ++
 .../internallbvmmgr/InternalLBVMManagerTest.java   |  388 +++
 .../internallbvmmgr/InternalLBVMServiceTest.java   |  291 ++
 .../internallbvmmgr/LbChildTestConfiguration.java  |  172 +
 .../test/resources/lb_element.xml                  |   46 +
 .../test/resources/lb_mgr.xml                      |   46 +
 .../test/resources/lb_svc.xml                      |   46 +
 .../cloud/network/element/NetscalerElement.java    |  166 +-
 .../cloud/network/resource/NetscalerResource.java  |  109 +-
 .../api/commands/DeleteNiciraNvpDeviceCmd.java     |    2 +-
 .../src/com/cloud/network/nicira/NiciraNvpTag.java |   17 +-
 .../com/cloud/network/nicira/NiciraTagTest.java    |   54 +
 plugins/pom.xml                                    |    4 +-
 .../CloudStackPrimaryDataStoreLifeCycleImpl.java   |   44 +-
 pom.xml                                            |  142 +-
 scripts/network/exdhcp/dnsmasq_edithosts.sh        |   19 +-
 server/pom.xml                                     |  101 +-
 server/src/com/cloud/alert/AlertManager.java       |   58 +
 server/src/com/cloud/alert/AlertManagerImpl.java   |   30 +-
 server/src/com/cloud/alert/dao/AlertDao.java       |   33 -
 server/src/com/cloud/alert/dao/AlertDaoImpl.java   |  156 -
 server/src/com/cloud/api/ApiDBUtils.java           |   26 +-
 server/src/com/cloud/api/ApiResponseHelper.java    |  200 +-
 server/src/com/cloud/api/ApiServer.java            |   17 +-
 .../src/com/cloud/api/query/QueryManagerImpl.java  |   60 +-
 .../cloud/api/query/dao/AccountJoinDaoImpl.java    |    6 +-
 .../api/query/dao/DomainRouterJoinDaoImpl.java     |   15 +-
 .../com/cloud/api/query/dao/HostJoinDaoImpl.java   |    6 +-
 .../api/query/dao/SecurityGroupJoinDaoImpl.java    |    6 +-
 .../api/query/dao/StoragePoolJoinDaoImpl.java      |    6 +-
 .../api/query/dao/UserAccountJoinDaoImpl.java      |    6 +-
 .../com/cloud/api/query/dao/UserVmJoinDaoImpl.java |    6 +-
 .../com/cloud/api/query/dao/VolumeJoinDaoImpl.java |    6 +-
 .../src/com/cloud/api/query/vo/AccountJoinVO.java  |    6 +-
 .../com/cloud/api/query/vo/DomainRouterJoinVO.java |   23 +-
 server/src/com/cloud/api/query/vo/HostJoinVO.java  |    6 +-
 .../cloud/api/query/vo/SecurityGroupJoinVO.java    |    6 +-
 .../com/cloud/api/query/vo/StoragePoolJoinVO.java  |    6 +-
 .../com/cloud/api/query/vo/UserAccountJoinVO.java  |    6 +-
 .../src/com/cloud/api/query/vo/UserVmJoinVO.java   |    6 +-
 .../src/com/cloud/api/query/vo/VolumeJoinVO.java   |    6 +-
 server/src/com/cloud/async/AsyncJobVO.java         |  401 +++
 server/src/com/cloud/async/SyncQueueItemVO.java    |  141 +
 server/src/com/cloud/async/SyncQueueVO.java        |  137 +
 .../com/cloud/capacity/CapacityManagerImpl.java    |  101 +-
 .../cloud/capacity/StorageCapacityListener.java    |   16 +-
 server/src/com/cloud/capacity/dao/CapacityDao.java |   45 -
 .../com/cloud/capacity/dao/CapacityDaoImpl.java    |  806 -----
 .../com/cloud/certificate/dao/CertificateDao.java  |   24 -
 .../cloud/certificate/dao/CertificateDaoImpl.java  |   63 -
 server/src/com/cloud/cluster/CheckPointVO.java     |  121 -
 .../cluster/ClusterInvalidSessionException.java    |   33 -
 .../cloud/cluster/ManagementServerHostPeerVO.java  |  120 -
 .../com/cloud/cluster/ManagementServerHostVO.java  |  182 -
 .../cloud/cluster/agentlb/HostTransferMapVO.java   |   98 -
 .../cluster/agentlb/dao/HostTransferMapDao.java    |   45 -
 .../agentlb/dao/HostTransferMapDaoImpl.java        |  146 -
 .../cloud/cluster/dao/ManagementServerHostDao.java |   48 -
 .../cluster/dao/ManagementServerHostDaoImpl.java   |  276 --
 .../cluster/dao/ManagementServerHostPeerDao.java   |   27 -
 .../dao/ManagementServerHostPeerDaoImpl.java       |  108 -
 server/src/com/cloud/cluster/dao/StackMaidDao.java |   44 -
 .../com/cloud/cluster/dao/StackMaidDaoImpl.java    |  208 --
 server/src/com/cloud/configuration/Config.java     |   44 +-
 .../cloud/configuration/ConfigurationManager.java  |   12 +-
 .../configuration/ConfigurationManagerImpl.java    |  329 ++-
 .../cloud/configuration/dao/ConfigurationDao.java  |   69 -
 .../configuration/dao/ConfigurationDaoImpl.java    |  225 --
 .../cloud/configuration/dao/ResourceCountDao.java  |   58 -
 .../configuration/dao/ResourceCountDaoImpl.java    |  222 --
 .../cloud/configuration/dao/ResourceLimitDao.java  |   35 -
 .../configuration/dao/ResourceLimitDaoImpl.java    |  100 -
 .../consoleproxy/ConsoleProxyManagerImpl.java      |  194 +-
 server/src/com/cloud/dc/AccountVlanMapVO.java      |   65 -
 server/src/com/cloud/dc/ClusterDetailsDao.java     |   32 -
 server/src/com/cloud/dc/ClusterDetailsDaoImpl.java |  125 -
 server/src/com/cloud/dc/ClusterDetailsVO.java      |   74 -
 server/src/com/cloud/dc/ClusterVO.java             |  189 -
 server/src/com/cloud/dc/ClusterVSMMapVO.java       |   62 -
 server/src/com/cloud/dc/DataCenterIpAddressVO.java |  115 -
 .../cloud/dc/DataCenterLinkLocalIpAddressVO.java   |  108 -
 server/src/com/cloud/dc/DataCenterVO.java          |  460 ---
 server/src/com/cloud/dc/DataCenterVnetVO.java      |  109 -
 server/src/com/cloud/dc/DcDetailVO.java            |   73 -
 server/src/com/cloud/dc/HostPodVO.java             |  197 --
 server/src/com/cloud/dc/PodCluster.java            |   67 -
 server/src/com/cloud/dc/PodVlanMapVO.java          |   62 -
 server/src/com/cloud/dc/PodVlanVO.java             |   98 -
 .../com/cloud/dc/StorageNetworkIpAddressVO.java    |  120 -
 .../src/com/cloud/dc/StorageNetworkIpRangeVO.java  |  184 -
 server/src/com/cloud/dc/VlanVO.java                |  196 --
 server/src/com/cloud/dc/dao/AccountVlanMapDao.java |   30 -
 .../com/cloud/dc/dao/AccountVlanMapDaoImpl.java    |   75 -
 server/src/com/cloud/dc/dao/ClusterDao.java        |   37 -
 server/src/com/cloud/dc/dao/ClusterDaoImpl.java    |  241 --
 server/src/com/cloud/dc/dao/ClusterVSMMapDao.java  |   29 -
 .../src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java |   95 -
 server/src/com/cloud/dc/dao/DataCenterDao.java     |   82 -
 server/src/com/cloud/dc/dao/DataCenterDaoImpl.java |  412 ---
 .../com/cloud/dc/dao/DataCenterIpAddressDao.java   |   38 -
 .../cloud/dc/dao/DataCenterIpAddressDaoImpl.java   |  225 --
 .../dc/dao/DataCenterLinkLocalIpAddressDao.java    |   32 -
 .../dao/DataCenterLinkLocalIpAddressDaoImpl.java   |  188 -
 server/src/com/cloud/dc/dao/DataCenterVnetDao.java |   44 -
 .../com/cloud/dc/dao/DataCenterVnetDaoImpl.java    |  234 --
 server/src/com/cloud/dc/dao/DcDetailsDao.java      |   32 -
 server/src/com/cloud/dc/dao/DcDetailsDaoImpl.java  |   97 -
 server/src/com/cloud/dc/dao/HostPodDao.java        |   35 -
 server/src/com/cloud/dc/dao/HostPodDaoImpl.java    |  134 -
 server/src/com/cloud/dc/dao/PodVlanDao.java        |   30 -
 server/src/com/cloud/dc/dao/PodVlanDaoImpl.java    |  139 -
 server/src/com/cloud/dc/dao/PodVlanMapDao.java     |   30 -
 server/src/com/cloud/dc/dao/PodVlanMapDaoImpl.java |   75 -
 .../cloud/dc/dao/StorageNetworkIpAddressDao.java   |   32 -
 .../dc/dao/StorageNetworkIpAddressDaoImpl.java     |  114 -
 .../com/cloud/dc/dao/StorageNetworkIpRangeDao.java |   32 -
 .../cloud/dc/dao/StorageNetworkIpRangeDaoImpl.java |   78 -
 server/src/com/cloud/dc/dao/VlanDao.java           |   55 -
 server/src/com/cloud/dc/dao/VlanDaoImpl.java       |  334 --
 server/src/com/cloud/deploy/FirstFitPlanner.java   |   65 +-
 server/src/com/cloud/domain/DomainVO.java          |  215 --
 server/src/com/cloud/domain/dao/DomainDao.java     |   34 -
 server/src/com/cloud/domain/dao/DomainDaoImpl.java |  278 --
 server/src/com/cloud/host/dao/HostDao.java         |   83 -
 server/src/com/cloud/host/dao/HostDaoImpl.java     |  920 -----
 server/src/com/cloud/host/dao/HostDetailsDao.java  |   32 -
 .../src/com/cloud/host/dao/HostDetailsDaoImpl.java |  110 -
 server/src/com/cloud/host/dao/HostTagsDao.java     |   30 -
 server/src/com/cloud/host/dao/HostTagsDaoImpl.java |   75 -
 .../hypervisor/dao/HypervisorCapabilitiesDao.java  |   38 -
 .../dao/HypervisorCapabilitiesDaoImpl.java         |  105 -
 server/src/com/cloud/keystore/KeystoreDao.java     |   29 -
 server/src/com/cloud/keystore/KeystoreDaoImpl.java |  118 -
 server/src/com/cloud/keystore/KeystoreVO.java      |  101 -
 server/src/com/cloud/maint/AgentUpgradeVO.java     |   63 -
 server/src/com/cloud/maint/UpgradeManager.java     |   47 -
 server/src/com/cloud/maint/UpgradeManagerImpl.java |  189 -
 .../src/com/cloud/maint/UpgradeManagerMBean.java   |   23 -
 server/src/com/cloud/maint/UpgradeMonitor.java     |   34 -
 server/src/com/cloud/maint/Version.java            |   66 -
 .../src/com/cloud/maint/dao/AgentUpgradeDao.java   |   23 -
 .../com/cloud/maint/dao/AgentUpgradeDaoImpl.java   |   29 -
 .../com/cloud/migration/Db21to22MigrationUtil.java |  228 --
 .../migration/Db22beta4to22GAMigrationUtil.java    |  128 -
 .../src/com/cloud/migration/DiskOffering20Dao.java |   22 -
 .../com/cloud/migration/DiskOffering20DaoImpl.java |   27 -
 .../src/com/cloud/migration/DiskOffering20VO.java  |  113 -
 .../src/com/cloud/migration/DiskOffering21Dao.java |   23 -
 .../com/cloud/migration/DiskOffering21DaoImpl.java |   27 -
 .../src/com/cloud/migration/DiskOffering21VO.java  |  257 --
 .../com/cloud/migration/ServiceOffering20Dao.java  |   22 -
 .../cloud/migration/ServiceOffering20DaoImpl.java  |   27 -
 .../com/cloud/migration/ServiceOffering20VO.java   |  199 --
 .../com/cloud/migration/ServiceOffering21Dao.java  |   22 -
 .../cloud/migration/ServiceOffering21DaoImpl.java  |   27 -
 .../com/cloud/migration/ServiceOffering21VO.java   |  178 -
 .../network/ExternalLoadBalancerDeviceManager.java |    6 +-
 .../ExternalLoadBalancerDeviceManagerImpl.java     |   35 +-
 .../ExternalLoadBalancerUsageManagerImpl.java      |   34 +-
 .../com/cloud/network/LBHealthCheckPolicyVO.java   |  157 -
 server/src/com/cloud/network/NetworkManager.java   |    3 +-
 .../src/com/cloud/network/NetworkManagerImpl.java  |  176 +-
 server/src/com/cloud/network/NetworkModelImpl.java |   80 +-
 server/src/com/cloud/network/UserIpv6Address.java  |   52 -
 .../src/com/cloud/network/UserIpv6AddressVO.java   |  188 -
 .../network/as/AutoScalePolicyConditionMapVO.java  |   61 -
 .../com/cloud/network/as/AutoScalePolicyVO.java    |  134 -
 .../network/as/AutoScaleVmGroupPolicyMapVO.java    |   64 -
 .../com/cloud/network/as/AutoScaleVmGroupVO.java   |  191 -
 .../com/cloud/network/as/AutoScaleVmProfileVO.java |  218 --
 server/src/com/cloud/network/as/ConditionVO.java   |  129 -
 server/src/com/cloud/network/as/CounterVO.java     |  111 -
 .../as/dao/AutoScalePolicyConditionMapDao.java     |   28 -
 .../as/dao/AutoScalePolicyConditionMapDaoImpl.java |   61 -
 .../cloud/network/as/dao/AutoScalePolicyDao.java   |   24 -
 .../network/as/dao/AutoScalePolicyDaoImpl.java     |   38 -
 .../cloud/network/as/dao/AutoScaleVmGroupDao.java  |   28 -
 .../network/as/dao/AutoScaleVmGroupDaoImpl.java    |   65 -
 .../as/dao/AutoScaleVmGroupPolicyMapDao.java       |   30 -
 .../as/dao/AutoScaleVmGroupPolicyMapDaoImpl.java   |   77 -
 .../network/as/dao/AutoScaleVmProfileDao.java      |   25 -
 .../network/as/dao/AutoScaleVmProfileDaoImpl.java  |   38 -
 .../src/com/cloud/network/as/dao/ConditionDao.java |   28 -
 .../com/cloud/network/as/dao/ConditionDaoImpl.java |   56 -
 .../src/com/cloud/network/as/dao/CounterDao.java   |   29 -
 .../com/cloud/network/as/dao/CounterDaoImpl.java   |   70 -
 .../network/dao/ExternalFirewallDeviceDao.java     |   58 -
 .../network/dao/ExternalFirewallDeviceDaoImpl.java |   96 -
 .../network/dao/ExternalFirewallDeviceVO.java      |  161 -
 .../network/dao/ExternalLoadBalancerDeviceDao.java |   74 -
 .../dao/ExternalLoadBalancerDeviceDaoImpl.java     |  127 -
 .../network/dao/ExternalLoadBalancerDeviceVO.java  |  227 --
 .../cloud/network/dao/FirewallRulesCidrsDao.java   |   29 -
 .../network/dao/FirewallRulesCidrsDaoImpl.java     |   70 -
 .../cloud/network/dao/FirewallRulesCidrsVO.java    |   65 -
 .../com/cloud/network/dao/FirewallRulesDao.java    |   65 -
 .../cloud/network/dao/FirewallRulesDaoImpl.java    |  352 --
 server/src/com/cloud/network/dao/IPAddressDao.java |   71 -
 .../com/cloud/network/dao/IPAddressDaoImpl.java    |  376 --
 server/src/com/cloud/network/dao/IPAddressVO.java  |  307 --
 .../network/dao/InlineLoadBalancerNicMapDao.java   |   24 -
 .../dao/InlineLoadBalancerNicMapDaoImpl.java       |   46 -
 .../network/dao/InlineLoadBalancerNicMapVO.java    |   60 -
 .../cloud/network/dao/LBHealthCheckPolicyDao.java  |   35 -
 .../network/dao/LBHealthCheckPolicyDaoImpl.java    |   71 -
 .../cloud/network/dao/LBStickinessPolicyDao.java   |   34 -
 .../network/dao/LBStickinessPolicyDaoImpl.java     |   69 -
 .../cloud/network/dao/LBStickinessPolicyVO.java    |  145 -
 .../src/com/cloud/network/dao/LoadBalancerDao.java |   36 -
 .../com/cloud/network/dao/LoadBalancerDaoImpl.java |  137 -
 .../cloud/network/dao/LoadBalancerVMMapDao.java    |   31 -
 .../network/dao/LoadBalancerVMMapDaoImpl.java      |   97 -
 .../com/cloud/network/dao/LoadBalancerVMMapVO.java |   89 -
 .../src/com/cloud/network/dao/LoadBalancerVO.java  |   98 -
 .../com/cloud/network/dao/NetworkAccountDao.java   |   22 -
 .../cloud/network/dao/NetworkAccountDaoImpl.java   |   29 -
 .../com/cloud/network/dao/NetworkAccountVO.java    |   72 -
 server/src/com/cloud/network/dao/NetworkDao.java   |  114 -
 .../src/com/cloud/network/dao/NetworkDaoImpl.java  |  621 ----
 .../com/cloud/network/dao/NetworkDomainDao.java    |   27 -
 .../cloud/network/dao/NetworkDomainDaoImpl.java    |   75 -
 .../src/com/cloud/network/dao/NetworkDomainVO.java |   72 -
 .../network/dao/NetworkExternalFirewallDao.java    |   38 -
 .../dao/NetworkExternalFirewallDaoImpl.java        |   61 -
 .../network/dao/NetworkExternalFirewallVO.java     |   88 -
 .../dao/NetworkExternalLoadBalancerDao.java        |   38 -
 .../dao/NetworkExternalLoadBalancerDaoImpl.java    |   62 -
 .../network/dao/NetworkExternalLoadBalancerVO.java |   89 -
 server/src/com/cloud/network/dao/NetworkOpDao.java |   26 -
 .../com/cloud/network/dao/NetworkOpDaoImpl.java    |   84 -
 server/src/com/cloud/network/dao/NetworkOpVO.java  |   76 -
 .../cloud/network/dao/NetworkRuleConfigDao.java    |   26 -
 .../network/dao/NetworkRuleConfigDaoImpl.java      |   51 -
 .../com/cloud/network/dao/NetworkRuleConfigVO.java |   93 -
 .../cloud/network/dao/NetworkServiceMapDao.java    |   38 -
 .../network/dao/NetworkServiceMapDaoImpl.java      |  167 -
 .../com/cloud/network/dao/NetworkServiceMapVO.java |   92 -
 server/src/com/cloud/network/dao/NetworkVO.java    |  555 ---
 .../com/cloud/network/dao/PhysicalNetworkDao.java  |   28 -
 .../cloud/network/dao/PhysicalNetworkDaoImpl.java  |   79 -
 .../dao/PhysicalNetworkIsolationMethodDaoImpl.java |   70 -
 .../dao/PhysicalNetworkIsolationMethodVO.java      |   68 -
 .../dao/PhysicalNetworkServiceProviderDao.java     |   28 -
 .../dao/PhysicalNetworkServiceProviderDaoImpl.java |  131 -
 .../dao/PhysicalNetworkServiceProviderVO.java      |  322 --
 .../network/dao/PhysicalNetworkTagDaoImpl.java     |   63 -
 .../cloud/network/dao/PhysicalNetworkTagVO.java    |   68 -
 .../network/dao/PhysicalNetworkTrafficTypeDao.java |   33 -
 .../dao/PhysicalNetworkTrafficTypeDaoImpl.java     |  143 -
 .../network/dao/PhysicalNetworkTrafficTypeVO.java  |  149 -
 .../com/cloud/network/dao/PhysicalNetworkVO.java   |  246 --
 .../src/com/cloud/network/dao/PortProfileDao.java  |   50 -
 .../com/cloud/network/dao/PortProfileDaoImpl.java  |   89 -
 .../src/com/cloud/network/dao/PortProfileVO.java   |  204 --
 .../com/cloud/network/dao/RemoteAccessVpnDao.java  |   30 -
 .../cloud/network/dao/RemoteAccessVpnDaoImpl.java  |   84 -
 .../com/cloud/network/dao/RemoteAccessVpnVO.java   |  142 -
 .../com/cloud/network/dao/RouterNetworkDao.java    |   26 -
 .../cloud/network/dao/RouterNetworkDaoImpl.java    |   62 -
 .../src/com/cloud/network/dao/RouterNetworkVO.java |   75 -
 .../network/dao/Site2SiteCustomerGatewayDao.java   |   27 -
 .../dao/Site2SiteCustomerGatewayDaoImpl.java       |   66 -
 .../network/dao/Site2SiteCustomerGatewayVO.java    |  206 --
 .../network/dao/Site2SiteVpnConnectionDao.java     |   29 -
 .../network/dao/Site2SiteVpnConnectionDaoImpl.java |   97 -
 .../network/dao/Site2SiteVpnConnectionVO.java      |  143 -
 .../cloud/network/dao/Site2SiteVpnGatewayDao.java  |   23 -
 .../network/dao/Site2SiteVpnGatewayDaoImpl.java    |   50 -
 .../cloud/network/dao/Site2SiteVpnGatewayVO.java   |  114 -
 .../com/cloud/network/dao/UserIpv6AddressDao.java  |   41 -
 .../cloud/network/dao/UserIpv6AddressDaoImpl.java  |  122 -
 .../network/dao/VirtualRouterProviderDao.java      |   31 -
 .../network/dao/VirtualRouterProviderDaoImpl.java  |   79 -
 server/src/com/cloud/network/dao/VpnUserDao.java   |   28 -
 .../src/com/cloud/network/dao/VpnUserDaoImpl.java  |   87 -
 .../network/element/VirtualRouterElement.java      |   56 +-
 .../network/element/VirtualRouterProviderVO.java   |  120 -
 .../network/firewall/FirewallManagerImpl.java      |   89 +-
 .../network/guru/ExternalGuestNetworkGuru.java     |   40 +-
 .../com/cloud/network/guru/GuestNetworkGuru.java   |   43 +-
 .../com/cloud/network/lb/LBHealthCheckManager.java |    4 +-
 .../cloud/network/lb/LBHealthCheckManagerImpl.java |    9 +-
 .../network/lb/LoadBalancingRulesManager.java      |   24 +-
 .../network/lb/LoadBalancingRulesManagerImpl.java  |  402 ++-
 .../router/VirtualNetworkApplianceManager.java     |    4 +
 .../router/VirtualNetworkApplianceManagerImpl.java |   80 +-
 .../VpcVirtualNetworkApplianceManagerImpl.java     |    6 +-
 .../com/cloud/network/rules/FirewallRuleVO.java    |  270 --
 .../cloud/network/rules/PortForwardingRuleVO.java  |   96 -
 .../src/com/cloud/network/rules/RulesManager.java  |    3 +
 .../com/cloud/network/rules/RulesManagerImpl.java  |   51 +-
 .../network/rules/dao/PortForwardingRulesDao.java  |   47 -
 .../rules/dao/PortForwardingRulesDaoImpl.java      |  162 -
 .../network/security/dao/SecurityGroupDao.java     |   30 -
 .../network/security/dao/SecurityGroupDaoImpl.java |  136 -
 .../network/security/dao/SecurityGroupRuleDao.java |   35 -
 .../security/dao/SecurityGroupRuleDaoImpl.java     |  176 -
 .../security/dao/SecurityGroupRulesDao.java        |   48 -
 .../security/dao/SecurityGroupRulesDaoImpl.java    |   87 -
 .../security/dao/SecurityGroupVMMapDao.java        |   38 -
 .../security/dao/SecurityGroupVMMapDaoImpl.java    |  166 -
 .../network/security/dao/SecurityGroupWorkDao.java |   49 -
 .../security/dao/SecurityGroupWorkDaoImpl.java     |  242 --
 .../network/security/dao/VmRulesetLogDao.java      |   29 -
 .../network/security/dao/VmRulesetLogDaoImpl.java  |  200 --
 .../cloud/network/vpc/PrivateGatewayProfile.java   |    5 +
 .../com/cloud/network/vpc/PrivateIpAddress.java    |    7 +
 server/src/com/cloud/network/vpc/PrivateIpVO.java  |   95 -
 .../src/com/cloud/network/vpc/StaticRouteVO.java   |  141 -
 server/src/com/cloud/network/vpc/VpcGatewayVO.java |  196 --
 .../src/com/cloud/network/vpc/VpcManagerImpl.java  |   53 +-
 .../cloud/network/vpc/VpcOfferingServiceMapVO.java |   89 -
 .../src/com/cloud/network/vpc/VpcOfferingVO.java   |  151 -
 .../src/com/cloud/network/vpc/VpcServiceMapVO.java |   90 -
 server/src/com/cloud/network/vpc/VpcVO.java        |  181 -
 .../com/cloud/network/vpc/dao/PrivateIpDao.java    |   75 -
 .../cloud/network/vpc/dao/PrivateIpDaoImpl.java    |  156 -
 .../com/cloud/network/vpc/dao/StaticRouteDao.java  |   35 -
 .../cloud/network/vpc/dao/StaticRouteDaoImpl.java  |  119 -
 server/src/com/cloud/network/vpc/dao/VpcDao.java   |   47 -
 .../src/com/cloud/network/vpc/dao/VpcDaoImpl.java  |  152 -
 .../com/cloud/network/vpc/dao/VpcGatewayDao.java   |   26 -
 .../cloud/network/vpc/dao/VpcGatewayDaoImpl.java   |   62 -
 .../com/cloud/network/vpc/dao/VpcOfferingDao.java  |   32 -
 .../cloud/network/vpc/dao/VpcOfferingDaoImpl.java  |   71 -
 .../network/vpc/dao/VpcOfferingServiceMapDao.java  |   41 -
 .../vpc/dao/VpcOfferingServiceMapDaoImpl.java      |  119 -
 .../cloud/network/vpc/dao/VpcServiceMapDao.java    |   40 -
 .../network/vpc/dao/VpcServiceMapDaoImpl.java      |  115 -
 .../network/vpn/RemoteAccessVpnManagerImpl.java    |    6 +-
 .../offerings/NetworkOfferingServiceMapVO.java     |   94 -
 .../src/com/cloud/offerings/NetworkOfferingVO.java |  391 ---
 .../cloud/offerings/dao/NetworkOfferingDao.java    |   60 -
 .../offerings/dao/NetworkOfferingDaoImpl.java      |  169 -
 .../dao/NetworkOfferingServiceMapDao.java          |   50 -
 .../dao/NetworkOfferingServiceMapDaoImpl.java      |  171 -
 .../src/com/cloud/projects/ProjectAccountVO.java   |   96 -
 .../com/cloud/projects/ProjectInvitationVO.java    |  150 -
 server/src/com/cloud/projects/ProjectVO.java       |  163 -
 .../com/cloud/projects/dao/ProjectAccountDao.java  |   43 -
 .../cloud/projects/dao/ProjectAccountDaoImpl.java  |  157 -
 server/src/com/cloud/projects/dao/ProjectDao.java  |   37 -
 .../src/com/cloud/projects/dao/ProjectDaoImpl.java |  124 -
 .../cloud/projects/dao/ProjectInvitationDao.java   |   44 -
 .../projects/dao/ProjectInvitationDaoImpl.java     |  171 -
 .../com/cloud/resource/ResourceManagerImpl.java    |   12 +-
 .../resourcelimit/ResourceLimitManagerImpl.java    |    2 +-
 .../com/cloud/secstorage/CommandExecLogDao.java    |   25 -
 .../cloud/secstorage/CommandExecLogDaoImpl.java    |   49 -
 .../src/com/cloud/secstorage/CommandExecLogVO.java |  112 -
 .../com/cloud/server/ConfigurationServerImpl.java  |   25 +-
 .../src/com/cloud/server/ManagementServerImpl.java |  738 +++-
 .../src/com/cloud/service/ServiceOfferingVO.java   |  211 --
 .../com/cloud/service/dao/ServiceOfferingDao.java  |   34 -
 .../cloud/service/dao/ServiceOfferingDaoImpl.java  |  157 -
 .../src/com/cloud/servlet/ConsoleProxyServlet.java |   29 +-
 server/src/com/cloud/storage/OCFS2ManagerImpl.java |   48 +-
 server/src/com/cloud/storage/StorageManager.java   |    2 +
 .../src/com/cloud/storage/StorageManagerImpl.java  |   58 +-
 .../src/com/cloud/storage/dao/DiskOfferingDao.java |   31 -
 .../com/cloud/storage/dao/DiskOfferingDaoImpl.java |  152 -
 .../com/cloud/storage/dao/GuestOSCategoryDao.java  |   24 -
 .../cloud/storage/dao/GuestOSCategoryDaoImpl.java  |   34 -
 server/src/com/cloud/storage/dao/GuestOSDao.java   |   26 -
 .../src/com/cloud/storage/dao/GuestOSDaoImpl.java  |   51 -
 .../com/cloud/storage/dao/LaunchPermissionDao.java |   61 -
 .../cloud/storage/dao/LaunchPermissionDaoImpl.java |  158 -
 server/src/com/cloud/storage/dao/S3Dao.java        |   29 -
 server/src/com/cloud/storage/dao/S3DaoImpl.java    |   50 -
 server/src/com/cloud/storage/dao/SnapshotDao.java  |   54 -
 .../src/com/cloud/storage/dao/SnapshotDaoImpl.java |  357 --
 .../com/cloud/storage/dao/SnapshotPolicyDao.java   |   38 -
 .../cloud/storage/dao/SnapshotPolicyDaoImpl.java   |  105 -
 .../com/cloud/storage/dao/SnapshotScheduleDao.java |   41 -
 .../cloud/storage/dao/SnapshotScheduleDaoImpl.java |  134 -
 .../storage/dao/StoragePoolDetailsDaoImpl.java     |   84 -
 .../com/cloud/storage/dao/StoragePoolHostDao.java  |   42 -
 .../cloud/storage/dao/StoragePoolHostDaoImpl.java  |  184 -
 .../com/cloud/storage/dao/StoragePoolWorkDao.java  |   38 -
 .../cloud/storage/dao/StoragePoolWorkDaoImpl.java  |  136 -
 server/src/com/cloud/storage/dao/SwiftDao.java     |   31 -
 server/src/com/cloud/storage/dao/SwiftDaoImpl.java |   58 -
 server/src/com/cloud/storage/dao/UploadDao.java    |   36 -
 .../src/com/cloud/storage/dao/UploadDaoImpl.java   |   92 -
 .../src/com/cloud/storage/dao/VMTemplateDao.java   |   84 -
 .../com/cloud/storage/dao/VMTemplateDaoImpl.java   | 1122 ------
 .../cloud/storage/dao/VMTemplateDetailsDao.java    |   32 -
 .../storage/dao/VMTemplateDetailsDaoImpl.java      |   99 -
 .../com/cloud/storage/dao/VMTemplateHostDao.java   |   67 -
 .../cloud/storage/dao/VMTemplateHostDaoImpl.java   |  427 ---
 .../com/cloud/storage/dao/VMTemplatePoolDao.java   |   49 -
 .../cloud/storage/dao/VMTemplatePoolDaoImpl.java   |  304 --
 .../src/com/cloud/storage/dao/VMTemplateS3Dao.java |   36 -
 .../com/cloud/storage/dao/VMTemplateS3DaoImpl.java |  105 -
 .../com/cloud/storage/dao/VMTemplateSwiftDao.java  |   37 -
 .../cloud/storage/dao/VMTemplateSwiftDaoImpl.java  |   87 -
 .../com/cloud/storage/dao/VMTemplateZoneDao.java   |   33 -
 .../cloud/storage/dao/VMTemplateZoneDaoImpl.java   |   89 -
 server/src/com/cloud/storage/dao/VolumeDao.java    |   92 -
 .../src/com/cloud/storage/dao/VolumeDaoImpl.java   |  459 ---
 .../src/com/cloud/storage/dao/VolumeHostDao.java   |   40 -
 .../com/cloud/storage/dao/VolumeHostDaoImpl.java   |  165 -
 .../storage/download/DownloadMonitorImpl.java      |    4 +-
 .../storage/snapshot/SnapshotManagerImpl.java      |   36 +-
 server/src/com/cloud/tags/ResourceTagVO.java       |  160 -
 server/src/com/cloud/tags/dao/ResourceTagDao.java  |   37 -
 .../com/cloud/tags/dao/ResourceTagsDaoImpl.java    |   62 -
 .../cloud/template/HypervisorTemplateAdapter.java  |   78 +
 server/src/com/cloud/template/TemplateAdapter.java |    3 +
 .../com/cloud/template/TemplateAdapterBase.java    |   20 +-
 .../com/cloud/template/TemplateManagerImpl.java    |   25 +-
 server/src/com/cloud/upgrade/DatabaseCreator.java  |  233 --
 .../cloud/upgrade/DatabaseIntegrityChecker.java    |  264 --
 .../com/cloud/upgrade/DatabaseUpgradeChecker.java  |  369 --
 .../upgrade/PremiumDatabaseUpgradeChecker.java     |  139 -
 server/src/com/cloud/upgrade/dao/DbUpgrade.java    |   45 -
 .../src/com/cloud/upgrade/dao/DbUpgradeUtils.java  |  106 -
 .../src/com/cloud/upgrade/dao/Upgrade217to218.java |   66 -
 .../src/com/cloud/upgrade/dao/Upgrade218to22.java  | 2385 -------------
 .../upgrade/dao/Upgrade218to224DomainVlans.java    |  140 -
 .../cloud/upgrade/dao/Upgrade218to22Premium.java   |  100 -
 .../com/cloud/upgrade/dao/Upgrade2210to2211.java   |   64 -
 .../com/cloud/upgrade/dao/Upgrade2211to2212.java   |  139 -
 .../upgrade/dao/Upgrade2211to2212Premium.java      |   55 -
 .../com/cloud/upgrade/dao/Upgrade2212to2213.java   |  104 -
 .../com/cloud/upgrade/dao/Upgrade2213to2214.java   |  308 --
 .../src/com/cloud/upgrade/dao/Upgrade2214to30.java | 1326 -------
 .../src/com/cloud/upgrade/dao/Upgrade221to222.java |   66 -
 .../cloud/upgrade/dao/Upgrade221to222Premium.java  |   61 -
 .../src/com/cloud/upgrade/dao/Upgrade222to224.java |  610 ----
 .../cloud/upgrade/dao/Upgrade222to224Premium.java  |   87 -
 .../src/com/cloud/upgrade/dao/Upgrade224to225.java |  351 --
 .../src/com/cloud/upgrade/dao/Upgrade225to226.java |  108 -
 .../src/com/cloud/upgrade/dao/Upgrade227to228.java |  157 -
 .../cloud/upgrade/dao/Upgrade227to228Premium.java  |  132 -
 .../src/com/cloud/upgrade/dao/Upgrade228to229.java |  138 -
 .../com/cloud/upgrade/dao/Upgrade229to2210.java    |  194 --
 .../src/com/cloud/upgrade/dao/Upgrade301to302.java |  229 --
 .../src/com/cloud/upgrade/dao/Upgrade302to40.java  | 1033 ------
 .../src/com/cloud/upgrade/dao/Upgrade30to301.java  |  124 -
 .../src/com/cloud/upgrade/dao/Upgrade30xBase.java  |  311 --
 .../src/com/cloud/upgrade/dao/Upgrade40to41.java   |  164 -
 .../src/com/cloud/upgrade/dao/Upgrade410to420.java |  402 ---
 .../cloud/upgrade/dao/UpgradeSnapshot217to224.java |   60 -
 .../cloud/upgrade/dao/UpgradeSnapshot223to224.java |   60 -
 server/src/com/cloud/upgrade/dao/VersionDao.java   |   25 -
 .../src/com/cloud/upgrade/dao/VersionDaoImpl.java  |  172 -
 server/src/com/cloud/upgrade/dao/VersionVO.java    |   91 -
 .../cloud/usage/ExternalPublicIpStatisticsVO.java  |   98 -
 server/src/com/cloud/usage/UsageIPAddressVO.java   |  121 -
 server/src/com/cloud/usage/UsageJobVO.java         |  180 -
 .../com/cloud/usage/UsageLoadBalancerPolicyVO.java |   91 -
 .../com/cloud/usage/UsageNetworkOfferingVO.java    |  117 -
 server/src/com/cloud/usage/UsageNetworkVO.java     |  144 -
 .../com/cloud/usage/UsagePortForwardingRuleVO.java |   91 -
 .../src/com/cloud/usage/UsageSecurityGroupVO.java  |   97 -
 server/src/com/cloud/usage/UsageStorageVO.java     |  115 -
 server/src/com/cloud/usage/UsageVMInstanceVO.java  |  121 -
 server/src/com/cloud/usage/UsageVO.java            |  260 --
 server/src/com/cloud/usage/UsageVPNUserVO.java     |  105 -
 server/src/com/cloud/usage/UsageVolumeVO.java      |  115 -
 .../usage/dao/ExternalPublicIpStatisticsDao.java   |   33 -
 .../dao/ExternalPublicIpStatisticsDaoImpl.java     |   77 -
 server/src/com/cloud/usage/dao/UsageDao.java       |   41 -
 server/src/com/cloud/usage/dao/UsageDaoImpl.java   |  272 --
 .../src/com/cloud/usage/dao/UsageIPAddressDao.java |   28 -
 .../com/cloud/usage/dao/UsageIPAddressDaoImpl.java |  145 -
 server/src/com/cloud/usage/dao/UsageJobDao.java    |   34 -
 .../src/com/cloud/usage/dao/UsageJobDaoImpl.java   |  200 --
 .../usage/dao/UsageLoadBalancerPolicyDao.java      |   29 -
 .../usage/dao/UsageLoadBalancerPolicyDaoImpl.java  |  169 -
 .../src/com/cloud/usage/dao/UsageNetworkDao.java   |   27 -
 .../com/cloud/usage/dao/UsageNetworkDaoImpl.java   |   98 -
 .../cloud/usage/dao/UsageNetworkOfferingDao.java   |   28 -
 .../usage/dao/UsageNetworkOfferingDaoImpl.java     |  153 -
 .../usage/dao/UsagePortForwardingRuleDao.java      |   29 -
 .../usage/dao/UsagePortForwardingRuleDaoImpl.java  |  169 -
 .../com/cloud/usage/dao/UsageSecurityGroupDao.java |   28 -
 .../cloud/usage/dao/UsageSecurityGroupDaoImpl.java |  151 -
 .../src/com/cloud/usage/dao/UsageStorageDao.java   |   31 -
 .../com/cloud/usage/dao/UsageStorageDaoImpl.java   |  211 --
 .../com/cloud/usage/dao/UsageVMInstanceDao.java    |   29 -
 .../cloud/usage/dao/UsageVMInstanceDaoImpl.java    |  137 -
 .../src/com/cloud/usage/dao/UsageVPNUserDao.java   |   28 -
 .../com/cloud/usage/dao/UsageVPNUserDaoImpl.java   |  150 -
 server/src/com/cloud/usage/dao/UsageVolumeDao.java |   29 -
 .../com/cloud/usage/dao/UsageVolumeDaoImpl.java    |  178 -
 server/src/com/cloud/user/AccountDetailVO.java     |   75 -
 server/src/com/cloud/user/AccountDetailsDao.java   |   37 -
 .../src/com/cloud/user/AccountDetailsDaoImpl.java  |   96 -
 server/src/com/cloud/user/AccountManagerImpl.java  |   15 +
 server/src/com/cloud/user/dao/AccountDao.java      |   52 -
 server/src/com/cloud/user/dao/AccountDaoImpl.java  |  267 --
 server/src/com/cloud/user/dao/SSHKeyPairDao.java   |   38 -
 .../src/com/cloud/user/dao/SSHKeyPairDaoImpl.java  |   85 -
 server/src/com/cloud/user/dao/UserAccountDao.java  |   27 -
 .../src/com/cloud/user/dao/UserAccountDaoImpl.java |   69 -
 server/src/com/cloud/user/dao/UserDao.java         |   52 -
 server/src/com/cloud/user/dao/UserDaoImpl.java     |  131 -
 .../src/com/cloud/user/dao/UserStatisticsDao.java  |   35 -
 .../com/cloud/user/dao/UserStatisticsDaoImpl.java  |  137 -
 server/src/com/cloud/user/dao/UserStatsLogDao.java |   23 -
 .../com/cloud/user/dao/UserStatsLogDaoImpl.java    |   31 -
 server/src/com/cloud/vm/ItWorkDao.java             |   45 -
 server/src/com/cloud/vm/ItWorkDaoImpl.java         |  108 -
 server/src/com/cloud/vm/ItWorkVO.java              |  179 -
 server/src/com/cloud/vm/NicVO.java                 |  365 --
 server/src/com/cloud/vm/UserVmManagerImpl.java     |   78 +-
 .../com/cloud/vm/VirtualMachineManagerImpl.java    |   63 +-
 server/src/com/cloud/vm/dao/ConsoleProxyDao.java   |   47 -
 .../src/com/cloud/vm/dao/ConsoleProxyDaoImpl.java  |  353 --
 server/src/com/cloud/vm/dao/DomainRouterDao.java   |  149 -
 .../src/com/cloud/vm/dao/DomainRouterDaoImpl.java  |  358 --
 server/src/com/cloud/vm/dao/InstanceGroupDao.java  |   36 -
 .../src/com/cloud/vm/dao/InstanceGroupDaoImpl.java |   80 -
 .../com/cloud/vm/dao/InstanceGroupVMMapDao.java    |   28 -
 .../cloud/vm/dao/InstanceGroupVMMapDaoImpl.java    |   75 -
 server/src/com/cloud/vm/dao/NicDao.java            |   69 -
 server/src/com/cloud/vm/dao/NicDaoImpl.java        |  241 --
 server/src/com/cloud/vm/dao/NicSecondaryIpDao.java |   53 -
 .../com/cloud/vm/dao/NicSecondaryIpDaoImpl.java    |  138 -
 server/src/com/cloud/vm/dao/NicSecondaryIpVO.java  |  160 -
 .../com/cloud/vm/dao/SecondaryStorageVmDao.java    |   42 -
 .../cloud/vm/dao/SecondaryStorageVmDaoImpl.java    |  269 --
 .../com/cloud/vm/dao/UserVmCloneSettingDao.java    |   37 -
 .../cloud/vm/dao/UserVmCloneSettingDaoImpl.java    |   74 -
 server/src/com/cloud/vm/dao/UserVmDao.java         |   77 -
 server/src/com/cloud/vm/dao/UserVmDaoImpl.java     |  586 ----
 server/src/com/cloud/vm/dao/UserVmData.java        |  723 ----
 server/src/com/cloud/vm/dao/UserVmDetailsDao.java  |   32 -
 .../src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java |   99 -
 server/src/com/cloud/vm/dao/VMInstanceDao.java     |  119 -
 server/src/com/cloud/vm/dao/VMInstanceDaoImpl.java |  628 ----
 .../com/cloud/vm/snapshot/dao/VMSnapshotDao.java   |   39 -
 .../cloud/vm/snapshot/dao/VMSnapshotDaoImpl.java   |  161 -
 .../cloudstack/affinity/AffinityGroupVMMapVO.java  |   66 -
 .../cloudstack/affinity/AffinityGroupVO.java       |  114 -
 .../cloudstack/affinity/dao/AffinityGroupDao.java  |   30 -
 .../affinity/dao/AffinityGroupDaoImpl.java         |  102 -
 .../affinity/dao/AffinityGroupVMMapDao.java        |   47 -
 .../affinity/dao/AffinityGroupVMMapDaoImpl.java    |  167 -
 .../lb/ApplicationLoadBalancerManagerImpl.java     |  524 +++
 .../org/apache/cloudstack/region/RegionSyncVO.java |   93 -
 .../src/org/apache/cloudstack/region/RegionVO.java |   87 -
 .../apache/cloudstack/region/dao/RegionDao.java    |   27 -
 .../cloudstack/region/dao/RegionDaoImpl.java       |   48 -
 .../region/gslb/GlobalLoadBalancerDaoImpl.java     |   58 -
 .../gslb/GlobalLoadBalancerLbRuleMapDao.java       |   30 -
 .../gslb/GlobalLoadBalancerLbRuleMapDaoImpl.java   |   63 -
 .../region/gslb/GlobalLoadBalancerLbRuleMapVO.java |   83 -
 .../region/gslb/GlobalLoadBalancerRuleDao.java     |   28 -
 .../region/gslb/GlobalLoadBalancerRuleVO.java      |  183 -
 .../cloud/network/DedicateGuestVlanRangesTest.java |  378 ++
 .../com/cloud/network/MockNetworkManagerImpl.java  |   60 +-
 .../com/cloud/network/MockNetworkModelImpl.java    |   26 +-
 .../com/cloud/network/MockRulesManagerImpl.java    |   11 +-
 .../SecurityGroupManagerTestConfiguration.java     |    4 +-
 .../snapshot/SnapshotDaoTestConfiguration.java     |    4 +-
 .../dao/StoragePoolDaoTestConfiguration.java       |    4 +-
 .../test/com/cloud/vm/MockUserVmManagerImpl.java   |    6 +-
 server/test/com/cloud/vm/UserVmManagerTest.java    |   85 +-
 .../UserVmCloneSettingDaoTestConfiguration.java    |    4 +-
 .../cloud/vm/dao/UserVmDaoTestConfiguration.java   |    4 +-
 .../cloud/vpc/MockConfigurationManagerImpl.java    |   10 +-
 .../test/com/cloud/vpc/MockNetworkManagerImpl.java |   69 +-
 .../test/com/cloud/vpc/MockNetworkModelImpl.java   |   26 +-
 server/test/com/cloud/vpc/MockVpcManagerImpl.java  |    2 +-
 .../vpc/MockVpcVirtualNetworkApplianceManager.java |   14 +-
 server/test/com/cloud/vpc/VpcTest.java             |  269 ++
 .../test/com/cloud/vpc/VpcTestConfiguration.java   |    4 +-
 .../cloud/vpc/dao/MockNetworkOfferingDaoImpl.java  |   12 +-
 .../vpc/dao/MockNetworkServiceMapDaoImpl.java      |    6 +
 .../affinity/AffinityApiTestConfiguration.java     |  344 --
 .../cloudstack/affinity/AffinityApiUnitTest.java   |   87 +-
 .../cloudstack/lb/ApplicationLoadBalancerTest.java |  292 ++
 .../cloudstack/lb/ChildTestConfiguration.java      |  105 +
 .../networkoffering/ChildTestConfiguration.java    |   46 +-
 .../networkoffering/CreateNetworkOfferingTest.java |   60 +-
 server/test/resources/affinityContext.xml          |   47 -
 server/test/resources/appLoadBalancer.xml          |   43 +
 services/console-proxy/plugin/pom.xml              |    8 +-
 services/console-proxy/pom.xml                     |    4 +-
 services/console-proxy/server/css/ajaxviewer.css   |    6 +-
 services/console-proxy/server/js/ajaxkeys.js       |  317 ++-
 services/console-proxy/server/js/ajaxviewer.js     |  128 +-
 services/console-proxy/server/pom.xml              |    2 +-
 .../cloud/consoleproxy/ConsoleProxyClientBase.java |    1 +
 services/pom.xml                                   |    2 +-
 services/secondary-storage/pom.xml                 |    2 +-
 .../resource/NfsSecondaryStorageResource.java      |   24 +-
 setup/db/db/schema-2214to30.sql                    |    1 +
 setup/db/db/schema-40to410.sql                     |    8 +-
 setup/db/db/schema-410to420.sql                    |  111 +-
 setup/db/templates.sql                             |   12 +
 setup/dev/advanced.cfg                             |   13 +-
 setup/dev/basic.cfg                                |    3 +
 test/integration/component/test_accounts.py        |   96 +-
 .../component/test_allocation_states.py            |    2 +-
 test/integration/component/test_blocker_bugs.py    |   90 +-
 test/integration/component/test_egress_rules.py    |  200 +-
 test/integration/component/test_eip_elb.py         |  124 +-
 .../component/test_multiple_ip_ranges.py           |  429 +++
 .../integration/component/test_network_offering.py |  220 +-
 test/integration/component/test_project_configs.py |  142 +-
 test/integration/component/test_project_limits.py  |   30 +-
 .../component/test_project_resources.py            |   60 +-
 test/integration/component/test_project_usage.py   |   60 +-
 test/integration/component/test_projects.py        |   86 +-
 test/integration/component/test_regions.py         |  140 +
 .../integration/component/test_regions_accounts.py |  206 ++
 test/integration/component/test_resource_limits.py |   98 +-
 test/integration/component/test_routers.py         |  120 +-
 test/integration/component/test_security_groups.py |  208 +-
 test/integration/component/test_snapshots.py       |   92 +-
 test/integration/component/test_storage_motion.py  |   21 +-
 test/integration/component/test_templates.py       |   46 +-
 test/integration/component/test_usage.py           |  106 +-
 .../integration/component/test_vm_passwdenabled.py |   12 +-
 test/integration/component/test_volumes.py         |   74 +-
 test/integration/component/test_vpn_users.py       |  447 +++
 test/integration/smoke/test_affinity_groups.py     |    4 +-
 .../smoke/test_deploy_vm_with_userdata.py          |    2 +
 test/integration/smoke/test_global_settings.py     |   14 +-
 test/integration/smoke/test_guest_vlan_range.py    |  175 +
 test/integration/smoke/test_internal_lb.py         |  250 ++
 test/integration/smoke/test_iso.py                 |   18 +-
 test/integration/smoke/test_network.py             |  168 +-
 test/integration/smoke/test_nic.py                 |    8 +-
 test/integration/smoke/test_non_contigiousvlan.py  |    2 +-
 test/integration/smoke/test_regions.py             |   93 +
 test/integration/smoke/test_routers.py             |   60 +-
 test/integration/smoke/test_scale_vm.py            |    4 +-
 test/integration/smoke/test_templates.py           |   45 +-
 test/integration/smoke/test_vm_life_cycle.py       |    2 +
 test/integration/smoke/test_vm_snapshots.py        |  308 ++
 test/integration/smoke/test_volumes.py             |   25 +-
 test/selenium/ReadMe.txt                           |   36 +-
 test/selenium/lib/initialize.py                    |   17 +-
 test/selenium/smoke/Login_and_Accounts.py          |    5 +-
 test/selenium/smoke/main.py                        |    2 +-
 tools/apidoc/gen_toc.py                            |    1 +
 .../definitions/systemvmtemplate/definition.rb     |    6 +-
 .../definitions/systemvmtemplate/postinstall.sh    |   10 +-
 .../definitions/systemvmtemplate64/definition.rb   |    6 +-
 .../definitions/systemvmtemplate64/postinstall.sh  |   10 +-
 tools/marvin/marvin/asyncJobMgr.py                 |   70 +-
 tools/marvin/marvin/cloudstackConnection.py        |   19 +-
 tools/marvin/marvin/cloudstackTestClient.py        |   53 +-
 tools/marvin/marvin/configGenerator.py             |    1 +
 tools/marvin/marvin/dbConnection.py                |    6 +-
 tools/marvin/marvin/deployDataCenter.py            |   20 +
 tools/marvin/marvin/integration/lib/base.py        |  717 ++++-
 tools/marvin/marvin/integration/lib/utils.py       |   17 +-
 tools/marvin/marvin/remoteSSHClient.py             |   18 +-
 .../marvin/marvin/sandbox/advanced/advanced_env.py |    8 +
 tools/marvin/marvin/sandbox/advanced/sandbox.cfg   |  209 ++
 tools/marvin/marvin/sandbox/basic/basic_env.py     |    1 +
 .../sandbox/demo/simulator/simulator_setup.py      |    2 +
 tools/marvin/pom.xml                               |   77 +-
 tools/transifex/.tx/config                         |   32 +
 tools/transifex/README-transifex.txt               |   71 +
 tools/transifex/sync-transifex-ui.sh               |  160 +
 ui/css/cloudstack3.css                             |  141 +-
 ui/dictionary.jsp                                  | 1714 +++++-----
 ui/images/icons.png                                |  Bin 50745 -> 50052 bytes
 ui/images/sprites.png                              |  Bin 188552 -> 192407 bytes
 ui/index.jsp                                       |   21 +-
 ui/scripts/accounts.js                             |   51 +
 ui/scripts/affinity.js                             |  183 +
 ui/scripts/cloudStack.js                           |    9 +-
 ui/scripts/configuration.js                        |    2 +-
 ui/scripts/domains.js                              |    2 +-
 ui/scripts/instanceWizard.js                       |  949 +++---
 ui/scripts/instances.js                            |  352 ++-
 ui/scripts/network.js                              |  289 +-
 ui/scripts/plugins.js                              |   19 +-
 ui/scripts/regions.js                              |   27 +-
 ui/scripts/sharedFunctions.js                      |    4 +
 ui/scripts/storage.js                              |   48 +-
 ui/scripts/system.js                               |  573 +++-
 ui/scripts/templates.js                            |  106 +-
 ui/scripts/ui-custom/affinity.js                   |  173 +
 ui/scripts/ui-custom/granularSettings.js           |   46 +
 ui/scripts/ui-custom/instanceWizard.js             |   42 +-
 ui/scripts/ui-custom/vpc.js                        |    1 +
 ui/scripts/ui/widgets/detailView.js                |  157 +-
 ui/scripts/ui/widgets/listView.js                  |   16 +-
 ui/scripts/ui/widgets/multiEdit.js                 |    5 +
 ui/scripts/vm_snapshots.js                         |    2 +-
 ui/scripts/vpc.js                                  |   76 +-
 ui/scripts/zoneWizard.js                           |  104 +
 .../cloud/usage/UsageManagerTestConfiguration.java |    5 +-
 utils/pom.xml                                      |   12 +-
 utils/src/com/cloud/maint/Version.java             |   66 +
 utils/src/com/cloud/utils/AnnotationHelper.java    |   28 +-
 .../com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java |    9 +-
 .../utils/component/SpringComponentScanUtils.java  |   41 -
 utils/src/com/cloud/utils/net/NetUtils.java        |   10 +-
 .../apache/cloudstack/test/utils/SpringUtils.java  |  113 +
 vmware-base/pom.xml                                |    4 -
 .../hypervisor/vmware/mo/VirtualMachineMO.java     |    6 +-
 .../cloud/hypervisor/vmware/util/VmwareClient.java |    2 +-
 .../vmware/util/VmwareGuestOsMapper.java           |   16 +-
 .../cloud/hypervisor/vmware/util/VmwareHelper.java |   26 +-
 .../vmware/mo/TestVmwareContextFactory.java        |   43 -
 .../cloud/hypervisor/vmware/mo/TestVmwareMO.java   |   39 -
 .../hypervisor/vmware/util/TestVmwareUtil.java     |  107 -
 vmware-base/test/com/cloud/vmware/TestVMWare.java  | 1342 -------
 2086 files changed, 114028 insertions(+), 98797 deletions(-)
----------------------------------------------------------------------



[13/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/migration/DiskOffering21VO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/migration/DiskOffering21VO.java b/engine/schema/src/com/cloud/migration/DiskOffering21VO.java
new file mode 100644
index 0000000..593f7ba
--- /dev/null
+++ b/engine/schema/src/com/cloud/migration/DiskOffering21VO.java
@@ -0,0 +1,257 @@
+// 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.migration;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.DiscriminatorType;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="disk_offering_21")
+@Inheritance(strategy=InheritanceType.JOINED)
+@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32)
+public class DiskOffering21VO implements InternalIdentity {
+    public enum Type {
+        Disk,
+        Service
+    };
+    
+    @Id
+    @GeneratedValue(strategy=GenerationType.AUTO)
+    @Column(name="id")
+    long id;
+
+    @Column(name="domain_id")
+    Long domainId;
+
+    @Column(name="unique_name")
+    private String uniqueName;
+    
+    @Column(name="name")
+    private String name = null;
+
+    @Column(name="display_text")
+    private String displayText = null;
+
+    @Column(name="disk_size")
+    long diskSize;
+
+    @Column(name="mirrored")
+    boolean mirrored;
+    
+    @Column(name="tags")
+    String tags;
+    
+    @Column(name="type")
+    Type type;
+    
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    private Date created;
+    
+    @Column(name="recreatable")
+    private boolean recreatable;
+    
+    @Column(name="use_local_storage")
+    private boolean useLocalStorage;
+
+    @Column(name="system_use")
+    protected boolean systemUse;
+    
+    
+    public DiskOffering21VO() {
+    }
+
+    public DiskOffering21VO(long domainId, String name, String displayText, long diskSize, boolean mirrored, String tags) {
+        this.domainId = domainId;
+        this.name = name;
+        this.displayText = displayText;
+        this.diskSize = diskSize;
+        this.mirrored = mirrored;
+        this.tags = tags;
+        this.recreatable = false;
+        this.type = Type.Disk;
+        this.useLocalStorage = false;
+    }
+    
+    public DiskOffering21VO(String name, String displayText, boolean mirrored, String tags, boolean recreatable, boolean useLocalStorage) {
+        this.domainId = null;
+        this.type = Type.Service;
+        this.name = name;
+        this.displayText = displayText;
+        this.mirrored = mirrored;
+        this.tags = tags;
+        this.recreatable = recreatable;
+        this.useLocalStorage = useLocalStorage;
+    }
+
+    public long getId() {
+        return id;
+    }
+    
+    public void setId(Long id) {
+    	this.id = id;
+    }
+    
+    public String getUniqueName() {
+        return uniqueName;
+    }
+
+    public boolean getSystemUse() {
+        return systemUse;
+    }
+    
+    public void setSystemUse(boolean systemUse) {
+        this.systemUse = systemUse;
+    }
+    
+    public boolean getUseLocalStorage() {
+        return useLocalStorage;
+    }
+    
+    public void setUserLocalStorage(boolean useLocalStorage) {
+    	this.useLocalStorage = useLocalStorage; 
+    }
+    
+    public Long getDomainId() {
+        return domainId;
+    }
+    
+    public Type getType() {
+        return type;
+    }
+    
+    public void setType(Type type) {
+    	this.type = type;
+    }
+    
+    public boolean isRecreatable() {
+        return recreatable;
+    }
+    
+    public void setDomainId(Long domainId) {
+        this.domainId = domainId;
+    }
+
+    public String getName() {
+        return name;
+    }
+    
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDisplayText() {
+        return displayText;
+    }
+    public void setDisplayText(String displayText) {
+        this.displayText = displayText;
+    }
+
+    public long getDiskSizeInBytes() {
+        return diskSize * 1024 * 1024;
+    }
+    
+    public void setDiskSize(long diskSize) {
+        this.diskSize = diskSize;
+    }
+
+    public boolean isMirrored() {
+        return mirrored;
+    }
+    public void setMirrored(boolean mirrored) {
+        this.mirrored = mirrored;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+    
+	public Date getCreated() {
+		return created;
+	}
+	
+    protected void setTags(String tags) {
+        this.tags = tags;
+    }
+    
+    public String getTags() {
+        return tags;
+    }
+    
+    public void setUniqueName(String name) {
+        this.uniqueName = name;
+    }
+
+    @Transient
+    public String[] getTagsArray() {
+        String tags = getTags();
+        if (tags == null || tags.isEmpty()) {
+            return new String[0];
+        }
+        
+        return tags.split(",");
+    }
+
+    @Transient
+    public boolean containsTag(String... tags) {
+        if (this.tags == null) {
+            return false;
+        }
+        
+        for (String tag : tags) {
+            if (!this.tags.matches(tag)) {
+                return false;
+            }
+        }
+        
+        return true;
+    }
+    
+    @Transient
+    public void setTagsArray(List<String> newTags) {
+        if (newTags.isEmpty()) {
+            setTags(null);
+            return;
+        }
+        
+        StringBuilder buf = new StringBuilder();
+        for (String tag : newTags) {
+            buf.append(tag).append(",");
+        }
+        
+        buf.delete(buf.length() - 1, buf.length());
+        
+        setTags(buf.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/migration/ServiceOffering20Dao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/migration/ServiceOffering20Dao.java b/engine/schema/src/com/cloud/migration/ServiceOffering20Dao.java
new file mode 100644
index 0000000..e87b684
--- /dev/null
+++ b/engine/schema/src/com/cloud/migration/ServiceOffering20Dao.java
@@ -0,0 +1,22 @@
+// 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.migration;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface ServiceOffering20Dao extends GenericDao<ServiceOffering20VO, Long> {
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/migration/ServiceOffering20DaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/migration/ServiceOffering20DaoImpl.java b/engine/schema/src/com/cloud/migration/ServiceOffering20DaoImpl.java
new file mode 100644
index 0000000..f67949e
--- /dev/null
+++ b/engine/schema/src/com/cloud/migration/ServiceOffering20DaoImpl.java
@@ -0,0 +1,27 @@
+// 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.migration;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+
+@Local(value={ServiceOffering20Dao.class})
+public class ServiceOffering20DaoImpl extends GenericDaoBase<ServiceOffering20VO, Long> implements ServiceOffering20Dao  {
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/migration/ServiceOffering20VO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/migration/ServiceOffering20VO.java b/engine/schema/src/com/cloud/migration/ServiceOffering20VO.java
new file mode 100644
index 0000000..bed29ec
--- /dev/null
+++ b/engine/schema/src/com/cloud/migration/ServiceOffering20VO.java
@@ -0,0 +1,199 @@
+// 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.migration;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.dc.Vlan;
+import com.cloud.dc.Vlan.VlanType;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="service_offering")
+public class ServiceOffering20VO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+	private Long id = null;
+    
+    @Column(name="name")
+	private String name = null;
+    
+    @Column(name="cpu")
+	private int cpu;
+    
+    @Column(name="speed")
+    private int speed;
+    
+    @Column(name="ram_size")
+	private int ramSize;
+    
+    @Column(name="nw_rate")
+    private int rateMbps;
+    
+    @Column(name="mc_rate")
+    private int multicastRateMbps;
+    
+    @Column(name="mirrored")
+    private boolean mirroredVolumes;
+    
+    @Column(name="ha_enabled")
+    private boolean offerHA;
+    
+    @Column(name="display_text")
+	private String displayText = null;
+    
+    @Column(name="guest_ip_type")
+    @Enumerated(EnumType.STRING)
+    private Vlan.VlanType guestIpType = Vlan.VlanType.VirtualNetwork;
+    
+    @Column(name="use_local_storage")
+    private boolean useLocalStorage;
+    
+	@Column(name=GenericDao.CREATED_COLUMN)
+    private Date created;
+    
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+    
+    protected ServiceOffering20VO() {
+    }
+
+    public ServiceOffering20VO(Long id, String name, int cpu, int ramSize, int speed, int rateMbps, int multicastRateMbps, boolean offerHA, String displayText, boolean localStorageRequired) {
+        this(id, name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, displayText, Vlan.VlanType.VirtualNetwork, localStorageRequired);
+    }
+    
+    public ServiceOffering20VO(Long id, String name, int cpu, int ramSize, int speed, int rateMbps, int multicastRateMbps, boolean offerHA, String displayText, VlanType guestIpType, boolean useLocalStorage) {
+        this.id = id;
+        this.name = name;
+        this.cpu = cpu;
+        this.ramSize = ramSize;
+        this.speed = speed;
+        this.rateMbps = rateMbps;
+        this.multicastRateMbps = multicastRateMbps;
+        this.offerHA = offerHA;
+        this.displayText = displayText;
+        this.guestIpType = guestIpType;
+        this.useLocalStorage = useLocalStorage;
+    }
+
+	public boolean getOfferHA() {
+	    return offerHA;
+	}
+	
+	public void setOfferHA(boolean offerHA) {
+		this.offerHA = offerHA;
+	}
+	
+	public long getId() {
+		return id;
+	}
+	
+	public String getName() {
+		return name;
+	}
+	
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	public int getCpu() {
+	    return cpu;
+	}
+	
+	public void setCpu(int cpu) {
+		this.cpu = cpu;
+	}
+
+	public void setSpeed(int speed) {
+		this.speed = speed;
+	}
+
+	public void setRamSize(int ramSize) {
+		this.ramSize = ramSize;
+	}
+
+	public int getSpeed() {
+	    return speed;
+	}
+	
+	public int getRamSize() {
+	    return ramSize;
+	}
+	
+	public Date getCreated() {
+		return created;
+	}
+	
+	public Date getRemoved() {
+		return removed;
+	}
+
+	public void setMirroredVolumes(boolean mirroredVolumes) {
+		this.mirroredVolumes = mirroredVolumes;
+	}
+
+	public boolean isMirroredVolumes() {
+		return mirroredVolumes;
+	}
+	
+	public String getDisplayText() {
+		return displayText;
+	}
+
+	public void setDisplayText(String displayText) {
+		this.displayText = displayText;
+	}
+
+	public void setRateMbps(int rateMbps) {
+		this.rateMbps = rateMbps;
+	}
+
+	public int getRateMbps() {
+		return rateMbps;
+	}
+
+	public void setMulticastRateMbps(int multicastRateMbps) {
+		this.multicastRateMbps = multicastRateMbps;
+	}
+
+	public int getMulticastRateMbps() {
+		return multicastRateMbps;
+	}
+
+	public void setGuestIpType(Vlan.VlanType guestIpType) {
+		this.guestIpType = guestIpType;
+	}
+
+	public Vlan.VlanType getGuestIpType() {
+		return guestIpType;
+	}
+	
+	public boolean getUseLocalStorage() {
+		return useLocalStorage;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/migration/ServiceOffering21Dao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/migration/ServiceOffering21Dao.java b/engine/schema/src/com/cloud/migration/ServiceOffering21Dao.java
new file mode 100644
index 0000000..eece426
--- /dev/null
+++ b/engine/schema/src/com/cloud/migration/ServiceOffering21Dao.java
@@ -0,0 +1,22 @@
+// 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.migration;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface ServiceOffering21Dao extends GenericDao<ServiceOffering21VO, Long> {
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/migration/ServiceOffering21DaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/migration/ServiceOffering21DaoImpl.java b/engine/schema/src/com/cloud/migration/ServiceOffering21DaoImpl.java
new file mode 100644
index 0000000..ce24191
--- /dev/null
+++ b/engine/schema/src/com/cloud/migration/ServiceOffering21DaoImpl.java
@@ -0,0 +1,27 @@
+// 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.migration;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+
+@Local(value={ServiceOffering21Dao.class})
+public class ServiceOffering21DaoImpl extends GenericDaoBase<ServiceOffering21VO, Long> implements ServiceOffering21Dao {
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/migration/ServiceOffering21VO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/migration/ServiceOffering21VO.java b/engine/schema/src/com/cloud/migration/ServiceOffering21VO.java
new file mode 100644
index 0000000..d07be64
--- /dev/null
+++ b/engine/schema/src/com/cloud/migration/ServiceOffering21VO.java
@@ -0,0 +1,178 @@
+// 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.migration;
+
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import com.cloud.offering.ServiceOffering;
+
+@Entity
+@Table(name="service_offering_21")
+@DiscriminatorValue(value="Service")
+@PrimaryKeyJoinColumn(name="id")
+public class ServiceOffering21VO extends DiskOffering21VO implements ServiceOffering {
+    @Column(name="cpu")
+	private int cpu;
+
+    @Column(name="speed")
+    private int speed;
+
+    @Column(name="ram_size")
+	private int ramSize;
+
+    @Column(name="nw_rate")
+    private Integer rateMbps;
+
+    @Column(name="mc_rate")
+    private Integer multicastRateMbps;
+
+    @Column(name="ha_enabled")
+    private boolean offerHA;
+
+    @Column(name="host_tag")
+    private String hostTag;
+
+    protected ServiceOffering21VO() {
+        super();
+    }
+
+    public ServiceOffering21VO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText, boolean useLocalStorage, boolean recreatable, String tags) {
+        super(name, displayText, false, tags, recreatable, useLocalStorage);
+        this.cpu = cpu;
+        this.ramSize = ramSize;
+        this.speed = speed;
+        this.rateMbps = rateMbps;
+        this.multicastRateMbps = multicastRateMbps;
+        this.offerHA = offerHA;
+    }
+
+    public ServiceOffering21VO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText, boolean useLocalStorage, boolean recreatable, String tags, String hostTag) {
+    	this(name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, displayText, useLocalStorage, recreatable, tags);
+       	this.hostTag = hostTag;
+    }
+
+
+	@Override
+	public boolean getOfferHA() {
+	    return offerHA;
+	}
+
+	@Override
+	public boolean getLimitCpuUse() {
+	    return false;
+	}
+
+	public void setOfferHA(boolean offerHA) {
+		this.offerHA = offerHA;
+	}
+
+	@Override
+    @Transient
+	public String[] getTagsArray() {
+	    String tags = getTags();
+	    if (tags == null || tags.length() == 0) {
+	        return new String[0];
+	    }
+
+	    return tags.split(",");
+	}
+
+	@Override
+	public int getCpu() {
+	    return cpu;
+	}
+
+	public void setCpu(int cpu) {
+		this.cpu = cpu;
+	}
+
+	public void setSpeed(int speed) {
+		this.speed = speed;
+	}
+
+	public void setRamSize(int ramSize) {
+		this.ramSize = ramSize;
+	}
+
+	@Override
+	public int getSpeed() {
+	    return speed;
+	}
+
+	@Override
+	public int getRamSize() {
+	    return ramSize;
+	}
+
+	public void setRateMbps(Integer rateMbps) {
+		this.rateMbps = rateMbps;
+	}
+
+	@Override
+    public Integer getRateMbps() {
+		return rateMbps;
+	}
+
+	public void setMulticastRateMbps(Integer multicastRateMbps) {
+		this.multicastRateMbps = multicastRateMbps;
+	}
+
+	@Override
+    public Integer getMulticastRateMbps() {
+		return multicastRateMbps;
+	}
+
+	public String gethypervisorType() {
+		return null;
+	}
+
+	public void setHostTag(String hostTag) {
+		this.hostTag = hostTag;
+	}
+
+	public String getHostTag() {
+		return hostTag;
+	}
+
+    @Override
+    public boolean getDefaultUse() {
+        return false;
+    }
+
+    @Override
+    public String getSystemVmType() {
+        return null;
+    }
+
+    @Override
+    public String getUuid() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean getVolatileVm() {
+        return false;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/LBHealthCheckPolicyVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/LBHealthCheckPolicyVO.java b/engine/schema/src/com/cloud/network/LBHealthCheckPolicyVO.java
new file mode 100644
index 0000000..ed03a2b
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/LBHealthCheckPolicyVO.java
@@ -0,0 +1,157 @@
+// 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.network;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+
+import com.cloud.network.rules.HealthCheckPolicy;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = ("load_balancer_healthcheck_policies"))
+@PrimaryKeyJoinColumn(name = "load_balancer_id", referencedColumnName = "id")
+public class LBHealthCheckPolicyVO implements HealthCheckPolicy {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "load_balancer_id")
+    private long loadBalancerId;
+
+    @Column(name = "pingpath")
+    private String pingPath;
+
+    @Column(name = "description")
+    private String description;
+
+    @Column(name = "uuid")
+    private String uuid;
+
+    @Column(name = "response_time")
+    private int responseTime;
+
+    @Column(name = "healthcheck_interval")
+    private int healthcheckInterval;
+
+    @Column(name = "healthcheck_thresshold")
+    private int healthcheckThresshold;
+
+    @Column(name = "unhealth_thresshold")
+    private int unhealthThresshold;
+
+    @Column(name = "revoke")
+    private boolean revoke = false;
+
+    protected LBHealthCheckPolicyVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public LBHealthCheckPolicyVO(long loadBalancerId, String pingPath, String description, int responseTime,
+            int healthcheckInterval, int healthcheckThresshold, int unhealthThresshold) {
+        this.loadBalancerId = loadBalancerId;
+
+        if (pingPath == null || pingPath.isEmpty())
+            this.pingPath = "/";
+        else
+            this.pingPath = pingPath;
+
+        if (responseTime == 0)
+            this.responseTime = 2;
+        else
+            this.responseTime = responseTime;
+
+        if (healthcheckInterval == 0)
+            this.healthcheckInterval = 5;
+        else
+            this.healthcheckInterval = healthcheckInterval;
+
+        if (healthcheckThresshold == 0)
+            this.healthcheckThresshold = 2;
+        else
+            this.healthcheckThresshold = healthcheckThresshold;
+
+        if (unhealthThresshold == 0)
+            this.unhealthThresshold = 1;
+        else
+            this.unhealthThresshold = unhealthThresshold;
+        this.uuid = UUID.randomUUID().toString();
+
+    }
+
+    public int getResponseTime() {
+        return responseTime;
+    }
+
+    public int getHealthcheckInterval() {
+        return healthcheckInterval;
+    }
+
+    public int getHealthcheckThresshold() {
+        return healthcheckThresshold;
+    }
+
+    public int getUnhealthThresshold() {
+        return unhealthThresshold;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getLoadBalancerId() {
+        return loadBalancerId;
+    }
+
+    public String getpingpath() {
+        return pingPath;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public boolean isRevoke() {
+        return revoke;
+    }
+
+    public void setRevoke(boolean revoke) {
+        this.revoke = revoke;
+    }
+
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/UserIpv6AddressVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/UserIpv6AddressVO.java b/engine/schema/src/com/cloud/network/UserIpv6AddressVO.java
new file mode 100644
index 0000000..70eb12d
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/UserIpv6AddressVO.java
@@ -0,0 +1,188 @@
+// 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.network;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import com.cloud.utils.db.GenericDao;
+
+@Entity
+@Table(name=("user_ipv6_address"))
+public class UserIpv6AddressVO implements UserIpv6Address {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+
+	@Column(name="ip_address")
+	@Enumerated(value=EnumType.STRING)
+	private String address = null;
+
+	@Column(name="data_center_id", updatable=false)
+	private long dataCenterId;
+
+	@Column(name="vlan_id")
+	private long vlanId;
+
+	@Column(name="state")
+	private State state;
+
+	@Column(name="mac_address")
+	private String macAddress;
+
+	@Column(name="source_network_id")
+    private Long sourceNetworkId;
+
+	@Column(name="network_id")
+	private Long networkId;
+
+	@Column(name="uuid")
+	private String uuid;
+
+    @Column(name="physical_network_id")
+    private Long physicalNetworkId;
+
+	@Column(name="account_id")
+	private Long accountId = null;
+
+    @Column(name="domain_id")
+    private Long domainId = null;
+	
+    @Column(name = GenericDao.CREATED_COLUMN)
+    Date created;
+	
+	protected UserIpv6AddressVO() {
+		this.uuid = UUID.randomUUID().toString();
+	}
+
+	public UserIpv6AddressVO(String address, long dataCenterId, String macAddress, long vlanDbId) {
+		this.address = address;
+		this.dataCenterId = dataCenterId;
+		this.vlanId = vlanDbId;
+		this.state = State.Free;
+		this.setMacAddress(macAddress);
+		this.uuid = UUID.randomUUID().toString();
+	}
+
+
+	@Override
+	public long getAccountId() {
+		return accountId;
+	}
+
+	@Override
+	public long getDomainId() {
+		return domainId;
+	}
+
+	@Override
+	public String getUuid() {
+		return uuid;
+	}
+
+	@Override
+	public long getId() {
+		return id;
+	}
+
+	@Override
+	public long getDataCenterId() {
+		return dataCenterId;
+	}
+
+	@Override
+	public String getAddress() {
+		return address;
+	}
+
+	@Override
+	public long getVlanId() {
+		return vlanId;
+	}
+
+	@Override
+	public State getState() {
+		return state;
+	}
+
+	@Override
+	public Long getNetworkId() {
+		return networkId;
+	}
+
+	@Override
+	public Long getSourceNetworkId() {
+		return sourceNetworkId;
+	}
+
+	@Override
+	public Long getPhysicalNetworkId() {
+		return physicalNetworkId;
+	}
+
+	@Override
+	public void setState(State state) {
+		this.state = state;
+	}
+
+	public String getMacAddress() {
+		return macAddress;
+	}
+
+	public void setMacAddress(String macAddress) {
+		this.macAddress = macAddress;
+	}
+
+	public void setSourceNetworkId(Long sourceNetworkId) {
+		this.sourceNetworkId = sourceNetworkId;
+	}
+
+	public void setNetworkId(Long networkId) {
+		this.networkId = networkId;
+	}
+
+	public void setPhysicalNetworkId(Long physicalNetworkId) {
+		this.physicalNetworkId = physicalNetworkId;
+	}
+
+	public void setDomainId(Long domainId) {
+		this.domainId = domainId;
+	}
+
+	public void setAccountId(Long accountId) {
+		this.accountId = accountId;
+	}
+
+	public Date getCreated() {
+		return created;
+	}
+
+	public void setCreated(Date created) {
+		this.created = created;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/VpnUserVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/VpnUserVO.java b/engine/schema/src/com/cloud/network/VpnUserVO.java
new file mode 100644
index 0000000..5a8e531
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/VpnUserVO.java
@@ -0,0 +1,131 @@
+// 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.network;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.utils.db.Encrypt;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name=("vpn_users"))
+public class VpnUserVO implements VpnUser {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="owner_id")
+    private long accountId;
+
+    @Column(name="domain_id")
+    private long domainId;
+
+    @Column(name="username")
+    private String username;
+
+    @Encrypt
+    @Column(name="password")
+    private String password;
+
+    @Column(name="state")
+    @Enumerated(value=EnumType.STRING)
+    private State state;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    public VpnUserVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public VpnUserVO(long accountId, long domainId, String userName, String password) {
+        this.accountId = accountId;
+        this.domainId = domainId;
+        this.username = userName;
+        this.password = password;
+        this.state = State.Add;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String userName) {
+        this.username = userName;
+    }
+
+    @Override
+    public String getPassword() {
+        return password;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    public void setState(State state) {
+        this.state = state;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+
+    @Override
+    public String toString() {
+        return new StringBuilder("VpnUser[").append(id).append("-").append(username).append("-").append(accountId).append("]").toString();
+    }
+
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/AutoScalePolicyConditionMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/AutoScalePolicyConditionMapVO.java b/engine/schema/src/com/cloud/network/as/AutoScalePolicyConditionMapVO.java
new file mode 100644
index 0000000..7d87b27
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/AutoScalePolicyConditionMapVO.java
@@ -0,0 +1,61 @@
+// 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.network.as;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name=("autoscale_policy_condition_map"))
+public class AutoScalePolicyConditionMapVO implements InternalIdentity {
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="policy_id")
+    private long policyId;
+
+    @Column(name="condition_id")
+    private long conditionId;
+
+    public AutoScalePolicyConditionMapVO() { }
+
+    public AutoScalePolicyConditionMapVO(long policyId, long conditionId) {
+        this.policyId = policyId;
+        this.conditionId = conditionId;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getPolicyId() {
+        return policyId;
+    }
+
+    public long getConditionId() {
+        return conditionId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/AutoScalePolicyVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/AutoScalePolicyVO.java b/engine/schema/src/com/cloud/network/as/AutoScalePolicyVO.java
new file mode 100644
index 0000000..f8fbcb4
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/AutoScalePolicyVO.java
@@ -0,0 +1,134 @@
+// 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.network.as;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = "autoscale_policies")
+@Inheritance(strategy = InheritanceType.JOINED)
+public class AutoScalePolicyVO implements AutoScalePolicy, InternalIdentity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    long id;
+
+    @Column(name = "uuid")
+    String uuid;
+
+    @Column(name = "domain_id")
+    private long domainId;
+
+    @Column(name = "account_id")
+    private long accountId;
+
+    @Column(name = "duration")
+    private int duration;
+
+    @Column(name = "quiet_time", updatable = true, nullable = false)
+    private int quietTime;
+
+    @Column(name = "action", updatable = false, nullable = false)
+    private String action;
+
+    @Column(name = GenericDao.REMOVED_COLUMN)
+    protected Date removed;
+
+    @Column(name = GenericDao.CREATED_COLUMN)
+    protected Date created;
+
+    public AutoScalePolicyVO() {
+    }
+
+    public AutoScalePolicyVO(long domainId, long accountId, int duration, int quietTime, String action) {
+        this.uuid = UUID.randomUUID().toString();
+        this.domainId = domainId;
+        this.accountId = accountId;
+        this.duration = duration;
+        this.quietTime = quietTime;
+        this.action = action;
+    }
+
+    @Override
+    public String toString() {
+        return new StringBuilder("AutoScalePolicy[").append("id-").append(id).append("]").toString();
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public int getDuration() {
+        return duration;
+    }
+
+    @Override
+    public int getQuietTime() {
+        return quietTime;
+    }
+
+    @Override
+    public String getAction() {
+        return action;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public void setDuration(Integer duration) {
+        this.duration = duration;
+    }
+
+    public void setQuietTime(Integer quietTime) {
+        this.quietTime = quietTime;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/AutoScaleVmGroupPolicyMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/AutoScaleVmGroupPolicyMapVO.java b/engine/schema/src/com/cloud/network/as/AutoScaleVmGroupPolicyMapVO.java
new file mode 100644
index 0000000..7e1c38a
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/AutoScaleVmGroupPolicyMapVO.java
@@ -0,0 +1,64 @@
+// 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.network.as;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name=("autoscale_vmgroup_policy_map"))
+public class AutoScaleVmGroupPolicyMapVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="vmgroup_id")
+    private long vmGroupId;
+
+    @Column(name="policy_id")
+    private long policyId;
+
+    public AutoScaleVmGroupPolicyMapVO() { }
+
+    public AutoScaleVmGroupPolicyMapVO(long vmGroupId, long policyId) {
+        this.vmGroupId = vmGroupId;
+        this.policyId = policyId;
+    }
+
+    public AutoScaleVmGroupPolicyMapVO(long vmgroupId, long policyId, boolean revoke) {
+        this(vmgroupId, policyId);
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getVmGroupId() {
+        return vmGroupId;
+    }
+
+    public long getPolicyId() {
+        return policyId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/AutoScaleVmGroupVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/AutoScaleVmGroupVO.java b/engine/schema/src/com/cloud/network/as/AutoScaleVmGroupVO.java
new file mode 100644
index 0000000..d1d85f9
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/AutoScaleVmGroupVO.java
@@ -0,0 +1,191 @@
+// 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.network.as;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = "autoscale_vmgroups")
+@Inheritance(strategy = InheritanceType.JOINED)
+public class AutoScaleVmGroupVO implements AutoScaleVmGroup, InternalIdentity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    long id;
+
+    @Column(name = "uuid")
+    String uuid;
+
+    @Column(name = "zone_id", updatable = false)
+    private long zoneId;
+
+    @Column(name = "domain_id", updatable = false)
+    private long domainId;
+
+    @Column(name = "account_id")
+    private long accountId;
+
+    @Column(name = "load_balancer_id")
+    private Long loadBalancerId;
+
+    @Column(name = "min_members", updatable = true)
+    private int minMembers;
+
+    @Column(name = "max_members", updatable = true)
+    private int maxMembers;
+
+    @Column(name = "member_port")
+    private int memberPort;
+
+    @Column(name = "interval")
+    private int interval;
+
+    @Column(name = "profile_id")
+    private long profileId;
+
+    @Column(name = GenericDao.REMOVED_COLUMN)
+    protected Date removed;
+
+    @Column(name = GenericDao.CREATED_COLUMN)
+    protected Date created;
+
+    @Column(name = "state")
+    private String state;
+
+    public AutoScaleVmGroupVO() {
+    }
+
+    public AutoScaleVmGroupVO(long lbRuleId, long zoneId, long domainId, long accountId, int minMembers, int maxMembers, int memberPort, int interval, long profileId, String state) {
+        this.uuid = UUID.randomUUID().toString();
+        this.loadBalancerId = lbRuleId;
+        this.minMembers = minMembers;
+        this.maxMembers = maxMembers;
+        this.memberPort = memberPort;
+        this.profileId = profileId;
+        this.accountId = accountId;
+        this.domainId = domainId;
+        this.zoneId = zoneId;
+        this.state = state;
+        this.interval = interval;
+    }
+
+    @Override
+    public String toString() {
+        return new StringBuilder("AutoScaleVmGroupVO[").append("id").append("]").toString();
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    public long getZoneId() {
+        return zoneId;
+    }
+
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public Long getLoadBalancerId() {
+        return loadBalancerId;
+    }
+
+    @Override
+    public int getMinMembers() {
+        return minMembers;
+    }
+
+    @Override
+    public int getMaxMembers() {
+        return maxMembers;
+    }
+
+    @Override
+    public int getMemberPort() {
+        return memberPort;
+    }
+
+    @Override
+    public int getInterval() {
+        return interval;
+    }
+
+    @Override
+    public long getProfileId() {
+        return profileId;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    @Override
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public void setMinMembers(int minMembers) {
+        this.minMembers = minMembers;
+    }
+
+    public void setMaxMembers(int maxMembers) {
+        this.maxMembers = maxMembers;
+    }
+
+    public void setInterval(Integer interval) {
+        this.interval = interval;
+    }
+
+    public void setLoadBalancerId(Long loadBalancerId) {
+        this.loadBalancerId = loadBalancerId;
+    }
+
+    @Override
+    public String getUuid() {
+        return uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/AutoScaleVmProfileVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/AutoScaleVmProfileVO.java b/engine/schema/src/com/cloud/network/as/AutoScaleVmProfileVO.java
new file mode 100644
index 0000000..011be2b
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/AutoScaleVmProfileVO.java
@@ -0,0 +1,218 @@
+// 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.network.as;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.net.NetUtils;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = "autoscale_vmprofiles")
+@Inheritance(strategy = InheritanceType.JOINED)
+public class AutoScaleVmProfileVO implements AutoScaleVmProfile, Identity, InternalIdentity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    protected long id;
+
+    @Column(name = "uuid")
+    protected String uuid;
+
+    @Column(name = "zone_id", updatable = true, nullable = false)
+    protected Long zoneId;
+
+    @Column(name = "domain_id", updatable = true)
+    private long domainId;
+
+    @Column(name = "account_id")
+    private long accountId;
+
+    @Column(name = "autoscale_user_id")
+    private long autoscaleUserId;
+
+    @Column(name = "service_offering_id", updatable = true, nullable = false)
+    private Long serviceOfferingId;
+
+    @Column(name = "template_id", updatable = true, nullable = false, length = 17)
+    private Long templateId;
+
+    @Column(name = "other_deploy_params", updatable = true, length = 1024)
+    private String otherDeployParams;
+
+    @Column(name = "destroy_vm_grace_period", updatable = true)
+    private Integer destroyVmGraceperiod = NetUtils.DEFAULT_AUTOSCALE_VM_DESTROY_TIME;
+
+    @Column(name = "counter_params", updatable = true)
+    private String counterParams;
+
+    @Column(name = GenericDao.REMOVED_COLUMN)
+    protected Date removed;
+
+    @Column(name = GenericDao.CREATED_COLUMN)
+    protected Date created;
+
+    public AutoScaleVmProfileVO() {
+    }
+
+    public AutoScaleVmProfileVO(long zoneId, long domainId, long accountId, long serviceOfferingId, long templateId, String otherDeployParams, Map counterParamList, Integer destroyVmGraceperiod,
+            long autoscaleUserId) {
+        this.uuid = UUID.randomUUID().toString();
+        this.zoneId = zoneId;
+        this.domainId = domainId;
+        this.accountId = accountId;
+        this.serviceOfferingId = serviceOfferingId;
+        this.templateId = templateId;
+        this.otherDeployParams = otherDeployParams;
+        this.autoscaleUserId = autoscaleUserId;
+        if (destroyVmGraceperiod != null) {
+            this.destroyVmGraceperiod = destroyVmGraceperiod;
+        }
+        setCounterParamsForUpdate(counterParamList);
+    }
+
+    @Override
+    public String toString() {
+        return new StringBuilder("AutoScaleVMProfileVO[").append("id").append(id).append("-").append("templateId").append("-").append(templateId).append("]").toString();
+    }
+
+    @Override
+    public Long getTemplateId() {
+        return templateId;
+    }
+
+    public void setTemplateId(Long templateId) {
+        this.templateId = templateId;
+    }
+
+    @Override
+    public Long getServiceOfferingId() {
+        return serviceOfferingId;
+    }
+
+    @Override
+    public String getOtherDeployParams() {
+        return otherDeployParams;
+    }
+
+    public void setOtherDeployParams(String otherDeployParams) {
+        this.otherDeployParams = otherDeployParams;
+    }
+
+    @Override
+    public List<Pair<String, String>> getCounterParams() {
+        List<Pair<String, String>> paramsList = new ArrayList<Pair<String, String>>();
+        if (counterParams != null) {
+            String[] params = counterParams.split("[=&]");
+            for (int i = 0; i < (params.length - 1); i = i + 2) {
+                paramsList.add(new Pair<String, String>(params[i], params[i + 1]));
+            }
+        }
+        return paramsList;
+    }
+
+    public void setCounterParams(String counterParam) {
+        this.counterParams = counterParam;
+    }
+
+    public void setCounterParamsForUpdate(Map counterParamList) {
+        StringBuilder sb = new StringBuilder("");
+        boolean isFirstParam = true;
+        if (counterParamList != null) {
+            Iterator<HashMap<String, String>> iter = counterParamList.values().iterator();
+            while (iter.hasNext()) {
+                HashMap<String, String> paramKVpair = iter.next();
+                if (!isFirstParam) {
+                    sb.append("&");
+                }
+                String paramName = paramKVpair.get("name");
+                String paramValue = paramKVpair.get("value");
+                sb.append(paramName + "=" + paramValue);
+                isFirstParam = false;
+            }
+        }
+        /*
+         * setCounterParams(String counterParam)'s String param is caught by UpdateBuilder and stored in an internal
+         * list.
+         * Which is used later to update the db. The variables in a VO object is not used to update the db.
+         * Hence calling the function which is intercepted.
+         */
+        setCounterParams(sb.toString());
+    }
+
+    @Override
+    public String getUuid() {
+        return uuid;
+    }
+
+    public void setAutoscaleUserId(long autoscaleUserId) {
+        this.autoscaleUserId = autoscaleUserId;
+    }
+
+    @Override
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public Integer getDestroyVmGraceperiod() {
+        return destroyVmGraceperiod;
+    }
+
+    public void setDestroyVmGraceperiod(Integer destroyVmGraceperiod) {
+        this.destroyVmGraceperiod = destroyVmGraceperiod;
+    }
+
+    @Override
+    public long getAutoScaleUserId() {
+        return autoscaleUserId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/ConditionVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/ConditionVO.java b/engine/schema/src/com/cloud/network/as/ConditionVO.java
new file mode 100644
index 0000000..bbae72f
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/ConditionVO.java
@@ -0,0 +1,129 @@
+// 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.network.as;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = "conditions")
+public class ConditionVO implements Condition, Identity, InternalIdentity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "counter_id")
+    private long counterid;
+
+    @Column(name = "threshold")
+    private long threshold;
+
+    @Column(name = "relational_operator")
+    @Enumerated(value = EnumType.STRING)
+    private Operator relationalOperator;
+
+    @Column(name = "domain_id")
+    protected long domainId;
+
+    @Column(name = "account_id")
+    protected long accountId;
+
+    @Column(name = "uuid")
+    private String uuid;
+
+    @Column(name = GenericDao.REMOVED_COLUMN)
+    Date removed;
+
+    @Column(name = GenericDao.CREATED_COLUMN)
+    Date created;
+
+    public ConditionVO() {
+    }
+
+    public ConditionVO(long counterid, long threshold, long accountId, long domainId, Operator relationalOperator) {
+        this.counterid = counterid;
+        this.threshold = threshold;
+        this.relationalOperator = relationalOperator;
+        this.accountId = accountId;
+        this.domainId = domainId;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public String toString() {
+        return new StringBuilder("Condition[").append("id-").append(id).append("]").toString();
+    }
+
+    @Override
+    public long getCounterid() {
+        return counterid;
+    }
+
+    @Override
+    public long getThreshold() {
+        return threshold;
+    }
+
+    @Override
+    public Operator getRelationalOperator() {
+        return relationalOperator;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/CounterVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/CounterVO.java b/engine/schema/src/com/cloud/network/as/CounterVO.java
new file mode 100644
index 0000000..b7b03f7
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/CounterVO.java
@@ -0,0 +1,111 @@
+// 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.network.as;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = "counter")
+public class CounterVO implements Counter, Identity, InternalIdentity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "source")
+    @Enumerated(value = EnumType.STRING)
+    private Source source;
+
+    @Column(name = "name")
+    private String name;
+
+    @Column(name = "value")
+    private String value;
+
+    @Column(name = "uuid")
+    private String uuid;
+
+    @Column(name = GenericDao.REMOVED_COLUMN)
+    Date removed;
+
+    @Column(name = GenericDao.CREATED_COLUMN)
+    Date created;
+
+    public CounterVO() {
+    }
+
+    public CounterVO(Source source, String name, String value) {
+        this.source = source;
+        this.name = name;
+        this.value = value;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    @Override
+    public String toString() {
+        return new StringBuilder("Counter[").append("id-").append(id).append("]").toString();
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public String getValue() {
+        return value;
+    }
+
+    @Override
+    public Source getSource() {
+        return source;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/dao/AutoScalePolicyConditionMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/dao/AutoScalePolicyConditionMapDao.java b/engine/schema/src/com/cloud/network/as/dao/AutoScalePolicyConditionMapDao.java
new file mode 100644
index 0000000..3025198
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/dao/AutoScalePolicyConditionMapDao.java
@@ -0,0 +1,28 @@
+// 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.network.as.dao;
+
+import java.util.List;
+
+import com.cloud.network.as.AutoScalePolicyConditionMapVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface AutoScalePolicyConditionMapDao extends GenericDao<AutoScalePolicyConditionMapVO, Long> {
+    List<AutoScalePolicyConditionMapVO> listByAll(Long policyId, Long conditionId);
+    public boolean isConditionInUse(Long conditionId);
+	boolean removeByAutoScalePolicyId(long id);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/dao/AutoScalePolicyConditionMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/dao/AutoScalePolicyConditionMapDaoImpl.java b/engine/schema/src/com/cloud/network/as/dao/AutoScalePolicyConditionMapDaoImpl.java
new file mode 100644
index 0000000..00fee3d
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/dao/AutoScalePolicyConditionMapDaoImpl.java
@@ -0,0 +1,61 @@
+// 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.network.as.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.as.AutoScalePolicyConditionMapVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value={AutoScalePolicyConditionMapDao.class})
+public class AutoScalePolicyConditionMapDaoImpl extends GenericDaoBase<AutoScalePolicyConditionMapVO, Long> implements AutoScalePolicyConditionMapDao {
+
+	private SearchCriteria<AutoScalePolicyConditionMapVO> getSearchCriteria(Long policyId, Long conditionId)
+	{
+        SearchCriteria<AutoScalePolicyConditionMapVO> sc = createSearchCriteria();
+
+        if(policyId != null)
+            sc.addAnd("policyId", SearchCriteria.Op.EQ, policyId);
+
+        if(conditionId != null)
+            sc.addAnd("conditionId", SearchCriteria.Op.EQ, conditionId);
+
+        return sc;
+	}
+	
+    @Override
+    public List<AutoScalePolicyConditionMapVO> listByAll(Long policyId, Long conditionId) {
+        return listBy(getSearchCriteria(policyId, conditionId));
+    }
+    
+    public boolean isConditionInUse(Long conditionId) {
+        return findOneBy(getSearchCriteria(null, conditionId)) != null;
+    }
+
+	@Override
+	public boolean removeByAutoScalePolicyId(long policyId) {
+        SearchCriteria<AutoScalePolicyConditionMapVO> sc = createSearchCriteria();
+        sc.addAnd("policyId", SearchCriteria.Op.EQ, policyId);
+		return expunge(sc) > 0;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/dao/AutoScalePolicyDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/dao/AutoScalePolicyDao.java b/engine/schema/src/com/cloud/network/as/dao/AutoScalePolicyDao.java
new file mode 100644
index 0000000..0cc2d27
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/dao/AutoScalePolicyDao.java
@@ -0,0 +1,24 @@
+// 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.network.as.dao;
+
+import com.cloud.network.as.AutoScalePolicyVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface AutoScalePolicyDao extends GenericDao<AutoScalePolicyVO, Long> {
+    int removeByAccountId(long accountId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/dao/AutoScalePolicyDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/dao/AutoScalePolicyDaoImpl.java b/engine/schema/src/com/cloud/network/as/dao/AutoScalePolicyDaoImpl.java
new file mode 100644
index 0000000..796a9c3
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/dao/AutoScalePolicyDaoImpl.java
@@ -0,0 +1,38 @@
+// 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.network.as.dao;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.as.AutoScalePolicyVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value = { AutoScalePolicyDao.class })
+public class AutoScalePolicyDaoImpl extends GenericDaoBase<AutoScalePolicyVO, Long>  implements AutoScalePolicyDao {
+
+    public int removeByAccountId(long accountId) {
+        SearchCriteria<AutoScalePolicyVO> sc = createSearchCriteria();
+
+        sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
+
+        return remove(sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupDao.java b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupDao.java
new file mode 100644
index 0000000..3fc8a5b
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupDao.java
@@ -0,0 +1,28 @@
+// 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.network.as.dao;
+
+import java.util.List;
+
+import com.cloud.network.as.AutoScaleVmGroupVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface AutoScaleVmGroupDao extends GenericDao<AutoScaleVmGroupVO, Long> {
+    List<AutoScaleVmGroupVO> listByAll(Long loadBalancerId, Long profileId);
+    boolean isProfileInUse(long profileId);
+    boolean isAutoScaleLoadBalancer(Long loadBalancerId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupDaoImpl.java b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupDaoImpl.java
new file mode 100644
index 0000000..4ddd572
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupDaoImpl.java
@@ -0,0 +1,65 @@
+// 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.network.as.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.as.AutoScaleVmGroupVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
+
+@Component
+@Local(value = { AutoScaleVmGroupDao.class })
+public class AutoScaleVmGroupDaoImpl extends GenericDaoBase<AutoScaleVmGroupVO, Long>  implements AutoScaleVmGroupDao {
+
+    @Override
+    public List<AutoScaleVmGroupVO> listByAll(Long loadBalancerId, Long profileId) {
+        SearchCriteria<AutoScaleVmGroupVO> sc = createSearchCriteria();
+
+        if(loadBalancerId != null)
+            sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId);
+
+        if(profileId != null)
+            sc.addAnd("profileId", SearchCriteria.Op.EQ, profileId);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public boolean isProfileInUse(long profileId) {
+        SearchCriteria<AutoScaleVmGroupVO> sc = createSearchCriteria();
+        sc.addAnd("profileId", SearchCriteria.Op.EQ, profileId);
+        return findOneBy(sc) != null;
+    }
+
+    @Override
+    public boolean isAutoScaleLoadBalancer(Long loadBalancerId) {
+        GenericSearchBuilder<AutoScaleVmGroupVO, Long> CountByAccount = createSearchBuilder(Long.class);
+        CountByAccount.select(null, Func.COUNT, null);
+        CountByAccount.and("loadBalancerId", CountByAccount.entity().getLoadBalancerId(), SearchCriteria.Op.EQ);
+
+        SearchCriteria<Long> sc = CountByAccount.create();
+        sc.setParameters("loadBalancerId", loadBalancerId);
+        return customSearch(sc, null).get(0) > 0;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupPolicyMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupPolicyMapDao.java b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupPolicyMapDao.java
new file mode 100644
index 0000000..41d91f7
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupPolicyMapDao.java
@@ -0,0 +1,30 @@
+// 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.network.as.dao;
+
+import java.util.List;
+
+import com.cloud.network.as.AutoScaleVmGroupPolicyMapVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface AutoScaleVmGroupPolicyMapDao extends GenericDao<AutoScaleVmGroupPolicyMapVO, Long> {
+    boolean removeByGroupId(long vmGroupId);
+    boolean removeByGroupAndPolicies(long vmGroupId, List<Long> bakupPolicyIds);
+    List<AutoScaleVmGroupPolicyMapVO> listByVmGroupId(long vmGroupId);
+    List<AutoScaleVmGroupPolicyMapVO> listByPolicyId(long policyId);
+    public boolean isAutoScalePolicyInUse(long policyId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupPolicyMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupPolicyMapDaoImpl.java b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupPolicyMapDaoImpl.java
new file mode 100644
index 0000000..ffb3dbc
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupPolicyMapDaoImpl.java
@@ -0,0 +1,77 @@
+// 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.network.as.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.as.AutoScaleVmGroupPolicyMapVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value={AutoScaleVmGroupPolicyMapDao.class})
+public class AutoScaleVmGroupPolicyMapDaoImpl extends GenericDaoBase<AutoScaleVmGroupPolicyMapVO, Long> implements AutoScaleVmGroupPolicyMapDao {
+
+    @Override
+    public boolean removeByGroupId(long vmGroupId) {
+        SearchCriteria<AutoScaleVmGroupPolicyMapVO> sc = createSearchCriteria();
+        sc.addAnd("vmGroupId", SearchCriteria.Op.EQ, vmGroupId);
+
+        return expunge(sc) > 0;
+    }
+
+    @Override
+    public boolean removeByGroupAndPolicies(long vmGroupId, List<Long> policyIds) {
+        SearchBuilder<AutoScaleVmGroupPolicyMapVO> policySearch = createSearchBuilder();
+        policySearch.and("vmGroupId", policySearch.entity().getVmGroupId(), Op.EQ);
+        policySearch.and("policyIds", policySearch.entity().getPolicyId(), Op.IN);
+        policySearch.done();
+        SearchCriteria<AutoScaleVmGroupPolicyMapVO> sc = policySearch.create();
+        sc.setParameters("vmGroupId", vmGroupId);
+        sc.setParameters("policyIds", policyIds);
+        return expunge(sc) > 0;
+    }
+
+    @Override
+    public List<AutoScaleVmGroupPolicyMapVO> listByVmGroupId(long vmGroupId) {
+        SearchCriteria<AutoScaleVmGroupPolicyMapVO> sc = createSearchCriteria();
+        sc.addAnd("vmGroupId", SearchCriteria.Op.EQ, vmGroupId);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<AutoScaleVmGroupPolicyMapVO> listByPolicyId(long policyId) {
+        SearchCriteria<AutoScaleVmGroupPolicyMapVO> sc = createSearchCriteria();
+        sc.addAnd("policyId", SearchCriteria.Op.EQ, policyId);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public boolean isAutoScalePolicyInUse(long policyId) {
+        SearchCriteria<AutoScaleVmGroupPolicyMapVO> sc = createSearchCriteria();
+        sc.addAnd("policyId", SearchCriteria.Op.EQ, policyId);
+        return findOneBy(sc) != null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmProfileDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmProfileDao.java b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmProfileDao.java
new file mode 100644
index 0000000..0855bf7
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmProfileDao.java
@@ -0,0 +1,25 @@
+// 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.network.as.dao;
+
+import com.cloud.network.as.AutoScaleVmProfileVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface AutoScaleVmProfileDao extends GenericDao<AutoScaleVmProfileVO, Long> {
+
+    int removeByAccountId(long accountId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmProfileDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmProfileDaoImpl.java b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmProfileDaoImpl.java
new file mode 100644
index 0000000..5d08491
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmProfileDaoImpl.java
@@ -0,0 +1,38 @@
+// 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.network.as.dao;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.as.AutoScaleVmProfileVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value = { AutoScaleVmProfileDao.class })
+public class AutoScaleVmProfileDaoImpl extends GenericDaoBase<AutoScaleVmProfileVO, Long>  implements AutoScaleVmProfileDao {
+
+    @Override
+    public int removeByAccountId(long accountId) {
+        SearchCriteria<AutoScaleVmProfileVO> sc = createSearchCriteria();
+        sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
+
+        return remove(sc);
+    }
+}


[19/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java b/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java
new file mode 100755
index 0000000..0b9ff1a
--- /dev/null
+++ b/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java
@@ -0,0 +1,816 @@
+// 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.capacity.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.capacity.Capacity;
+import com.cloud.capacity.CapacityVO;
+import com.cloud.storage.Storage;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.JoinBuilder.JoinType;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Component
+@Local(value = { CapacityDao.class })
+public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements CapacityDao {
+    private static final Logger s_logger = Logger.getLogger(CapacityDaoImpl.class);
+
+    private static final String ADD_ALLOCATED_SQL = "UPDATE `cloud`.`op_host_capacity` SET used_capacity = used_capacity + ? WHERE host_id = ? AND capacity_type = ?";
+    private static final String SUBTRACT_ALLOCATED_SQL = "UPDATE `cloud`.`op_host_capacity` SET used_capacity = used_capacity - ? WHERE host_id = ? AND capacity_type = ?";
+
+    private static final String LIST_CLUSTERSINZONE_BY_HOST_CAPACITIES_PART1 = "SELECT DISTINCT capacity.cluster_id  FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster` cluster on (cluster.id = capacity.cluster_id AND cluster.removed is NULL)   INNER JOIN `cloud`.`cluster_details` cluster_details ON (cluster.id = cluster_details.cluster_id ) WHERE ";
+    private static final String LIST_CLUSTERSINZONE_BY_HOST_CAPACITIES_PART2 = " AND capacity_type = ? AND cluster_details.name= ? AND ((total_capacity * cluster_details.value ) - used_capacity + reserved_capacity) >= ? AND capacity.cluster_id IN (SELECT distinct capacity.cluster_id  FROM `cloud`.`op_host_capacity` capacity INNER JOIN  `cloud`.`cluster_details` cluster_details ON (capacity.cluster_id = cluster_details.cluster_id ) WHERE ";
+    private static final String LIST_CLUSTERSINZONE_BY_HOST_CAPACITIES_PART3 = " AND capacity_type = ? AND cluster_details.name= ? AND ((total_capacity * cluster_details.value) - used_capacity + reserved_capacity) >= ?) ";
+
+    private final SearchBuilder<CapacityVO> _hostIdTypeSearch;
+    private final SearchBuilder<CapacityVO> _hostOrPoolIdSearch;
+    private final SearchBuilder<CapacityVO> _allFieldsSearch;
+    @Inject protected PrimaryDataStoreDao _storagePoolDao;
+
+
+    private static final String LIST_HOSTS_IN_CLUSTER_WITH_ENOUGH_CAPACITY = " SELECT  host_capacity.host_id FROM (`cloud`.`host` JOIN `cloud`.`op_host_capacity` host_capacity ON (host.id = host_capacity.host_id AND host.cluster_id = ?) JOIN `cloud`.`cluster_details` cluster_details ON (host_capacity.cluster_id = cluster_details.cluster_id) AND  host.type = ? AND cluster_details.name='cpuOvercommitRatio' AND ((host_capacity.total_capacity *cluster_details.value ) - host_capacity.used_capacity) >= ? and host_capacity.capacity_type = '1' " +
+               " AND  host_capacity.host_id IN (SELECT capacity.host_id FROM `cloud`.`op_host_capacity` capacity JOIN `cloud`.`cluster_details` cluster_details ON (capacity.cluster_id= cluster_details.cluster_id) where capacity_type='0' AND cluster_details.name='memoryOvercommitRatio' AND ((total_capacity* cluster_details.value) - used_capacity ) >= ?)) ";
+
+    private static final String ORDER_CLUSTERS_BY_AGGREGATE_CAPACITY_PART1= "SELECT capacity.cluster_id, SUM(used_capacity+reserved_capacity)/SUM(total_capacity ) FROM `cloud`.`op_host_capacity` capacity WHERE ";
+
+    private static final String ORDER_CLUSTERS_BY_AGGREGATE_CAPACITY_PART2= " AND capacity_type = ?  AND cluster_details.name =? GROUP BY capacity.cluster_id ORDER BY SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) ASC";
+
+    private static final String ORDER_CLUSTERS_BY_AGGREGATE_OVERCOMMIT_CAPACITY_PART1= "SELECT capacity.cluster_id, SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster_details` cluster_details ON (capacity.cluster_id = cluster_details.cluster_id) WHERE ";
+
+    private static final String ORDER_CLUSTERS_BY_AGGREGATE_OVERCOMMIT_CAPACITY_PART2= " AND capacity_type = ?  AND cluster_details.name =? GROUP BY capacity.cluster_id ORDER BY SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) ASC";
+
+    private static final String LIST_PODSINZONE_BY_HOST_CAPACITY_TYPE = "SELECT DISTINCT capacity.pod_id  FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`host_pod_ref` pod " +
+                                                          " ON (pod.id = capacity.pod_id AND pod.removed is NULL) INNER JOIN `cloud`.`cluster_details` cluster ON (capacity.cluster_id = cluster.cluster_id ) WHERE capacity.data_center_id = ? AND capacity_type = ? AND cluster_details.name= ? ((total_capacity * cluster.value ) - used_capacity + reserved_capacity) >= ? ";
+
+    private static final String ORDER_PODS_BY_AGGREGATE_CAPACITY = " SELECT capacity.pod_id, SUM(used_capacity+reserved_capacity)/SUM(total_capacity) FROM `cloud`.`op_host_capacity` capacity WHERE data_center_id= ? AND capacity_type = ? GROUP BY capacity.pod_id ORDER BY SUM(used_capacity+reserved_capacity)/SUM(total_capacity) ASC ";
+
+    private static final String ORDER_PODS_BY_AGGREGATE_OVERCOMMIT_CAPACITY ="SELECT capacity.pod_id, SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster_details` cluster_details ON (capacity.cluster_id = cluster_details.cluster_id) WHERE data_center_id=? AND capacity_type = ?  AND cluster_details.name = ? GROUP BY capacity.pod_id ORDER BY SUM(used_capacity+reserved_capacity)/SUM(total_capacity * cluster_details.value) ASC";
+
+    private static final String LIST_CAPACITY_BY_RESOURCE_STATE = "SELECT capacity.data_center_id, sum(capacity.used_capacity), sum(capacity.reserved_quantity), sum(capacity.total_capacity), capacity_capacity_type "+
+                                                                  "FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`data_center` dc ON (dc.id = capacity.data_center_id AND dc.removed is NULL)"+
+                                                                  "FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`host_pod_ref` pod ON (pod.id = capacity.pod_id AND pod.removed is NULL)"+
+                                                                  "FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`cluster` cluster ON (cluster.id = capacity.cluster_id AND cluster.removed is NULL)"+
+                                                                  "FROM `cloud`.`op_host_capacity` capacity INNER JOIN `cloud`.`host` host ON (host.id = capacity.host_id AND host.removed is NULL)"+
+                                                                  "WHERE dc.allocation_state = ? AND pod.allocation_state = ? AND cluster.allocation_state = ? AND host.resource_state = ? AND capacity_type not in (3,4) ";
+    
+    private static final String LIST_CAPACITY_GROUP_BY_ZONE_TYPE_PART1 = "SELECT (sum(capacity.used_capacity) + sum(capacity.reserved_capacity)), (case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`configuration` where name like 'cpu.overprovisioning.factor')) else sum(total_capacity) end), " +
+                                                                         "((sum(capacity.used_capacity) + sum(capacity.reserved_capacity)) / (case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`configuration` where name like 'cpu.overprovisioning.factor')) else sum(total_capacity) end)) percent,"+
+                                                                         " capacity.capacity_type, capacity.data_center_id "+
+                                                                         "FROM `cloud`.`op_host_capacity` capacity "+
+                                                                         "WHERE  total_capacity > 0 AND data_center_id is not null AND capacity_state='Enabled'";
+    private static final String LIST_CAPACITY_GROUP_BY_ZONE_TYPE_PART2 = " GROUP BY data_center_id, capacity_type order by percent desc limit ";
+    private static final String LIST_CAPACITY_GROUP_BY_POD_TYPE_PART1 =  "SELECT (sum(capacity.used_capacity) + sum(capacity.reserved_capacity))," +
+            " (case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) " +
+            "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))else sum(total_capacity) end)," +
+            "((sum(capacity.used_capacity) + sum(capacity.reserved_capacity)) / ( case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) " +
+            "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))else sum(total_capacity) end)) percent," +
+            "capacity.capacity_type, capacity.data_center_id, pod_id FROM `cloud`.`op_host_capacity` capacity WHERE  total_capacity > 0 AND data_center_id is not null AND capacity_state='Enabled' ";
+
+    private static final String LIST_CAPACITY_GROUP_BY_POD_TYPE_PART2 = " GROUP BY pod_id, capacity_type order by percent desc limit ";
+
+    private static final String LIST_CAPACITY_GROUP_BY_CLUSTER_TYPE_PART1 = "SELECT (sum(capacity.used_capacity) + sum(capacity.reserved_capacity))," +
+            " (case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) " +
+            "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))else sum(total_capacity) end)," +
+            "((sum(capacity.used_capacity) + sum(capacity.reserved_capacity)) / ( case capacity_type when 1 then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'cpuOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id)) " +
+            "when '0' then (sum(total_capacity) * (select value from `cloud`.`cluster_details` where cluster_details.name= 'memoryOvercommitRatio' AND cluster_details.cluster_id=capacity.cluster_id))else sum(total_capacity) end)) percent," +
+            "capacity.capacity_type, capacity.data_center_id, pod_id, cluster_id FROM `cloud`.`op_host_capacity` capacity WHERE  total_capacity > 0 AND data_center_id is not null AND capacity_state='Enabled' ";
+
+
+    private static final String LIST_CAPACITY_GROUP_BY_CLUSTER_TYPE_PART2 = " GROUP BY cluster_id, capacity_type order by percent desc limit ";
+    private static final String UPDATE_CAPACITY_STATE = "UPDATE `cloud`.`op_host_capacity` SET capacity_state = ? WHERE ";
+
+    private static final String LIST_CLUSTERS_CROSSING_THRESHOLD = "SELECT clusterList.cluster_id " +
+                       "FROM (	SELECT cluster.cluster_id cluster_id, ( (sum(cluster.used) + sum(cluster.reserved) + ?)/sum(cluster.total) ) ratio, cluster.configValue value " +
+                                "FROM (	SELECT capacity.cluster_id cluster_id, capacity.used_capacity used, capacity.reserved_capacity reserved, capacity.total_capacity total, " +
+                                            "CASE (SELECT count(*) FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) " +
+                                                "WHEN 1 THEN (	SELECT details.value FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) " +
+                                                "ELSE (	SELECT config.value FROM `cloud`.`configuration` config WHERE config.name = ?) " +
+                                            "END configValue " +
+                                        "FROM `cloud`.`op_host_capacity` capacity " +
+                                        "WHERE capacity.data_center_id = ? AND capacity.capacity_type = ? AND capacity.total_capacity > 0) cluster " +
+
+                                "GROUP BY cluster.cluster_id)  clusterList " +
+                        "WHERE clusterList.ratio > clusterList.value; ";
+
+
+
+    public CapacityDaoImpl() {
+        _hostIdTypeSearch = createSearchBuilder();
+        _hostIdTypeSearch.and("hostId", _hostIdTypeSearch.entity().getHostOrPoolId(), SearchCriteria.Op.EQ);
+        _hostIdTypeSearch.and("type", _hostIdTypeSearch.entity().getCapacityType(), SearchCriteria.Op.EQ);
+        _hostIdTypeSearch.done();
+
+        _hostOrPoolIdSearch = createSearchBuilder();
+        _hostOrPoolIdSearch.and("hostId", _hostOrPoolIdSearch.entity().getHostOrPoolId(), SearchCriteria.Op.EQ);
+        _hostOrPoolIdSearch.done();
+
+        _allFieldsSearch = createSearchBuilder();
+        _allFieldsSearch.and("id", _allFieldsSearch.entity().getId(), SearchCriteria.Op.EQ);
+        _allFieldsSearch.and("hostId", _allFieldsSearch.entity().getHostOrPoolId(), SearchCriteria.Op.EQ);
+        _allFieldsSearch.and("zoneId", _allFieldsSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        _allFieldsSearch.and("podId", _allFieldsSearch.entity().getPodId(), SearchCriteria.Op.EQ);
+        _allFieldsSearch.and("clusterId", _allFieldsSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
+        _allFieldsSearch.and("capacityType", _allFieldsSearch.entity().getCapacityType(), SearchCriteria.Op.EQ);
+        _allFieldsSearch.and("capacityState", _allFieldsSearch.entity().getCapacityState(), SearchCriteria.Op.EQ);
+
+        _allFieldsSearch.done();
+    }
+          
+    @Override
+    public  List<Long> listClustersCrossingThreshold(short capacityType, Long zoneId, String configName, long compute_requested){
+
+         Transaction txn = Transaction.currentTxn();
+         PreparedStatement pstmt = null;
+         List<Long> result = new ArrayList<Long>();         
+         StringBuilder sql = new StringBuilder(LIST_CLUSTERS_CROSSING_THRESHOLD);
+         // during listing the clusters that cross the threshold
+         // we need to check with disabled thresholds of each cluster if not defined at cluster consider the global value
+         try {
+             pstmt = txn.prepareAutoCloseStatement(sql.toString());
+             pstmt.setLong(1,compute_requested);
+             pstmt.setString(2, configName);
+             pstmt.setString(3, configName);
+             pstmt.setString(4, configName);
+             pstmt.setLong(5,zoneId);
+             pstmt.setShort(6,capacityType);
+
+             ResultSet rs = pstmt.executeQuery();
+             while (rs.next()) {
+                 result.add(rs.getLong(1));
+             }
+             return result;
+         } catch (SQLException e) {
+             throw new CloudRuntimeException("DB Exception on: " + sql, e);
+         } catch (Throwable e) {
+        	 throw new CloudRuntimeException("Caught: " + sql, e);
+         } 
+     }
+
+    /*public static String preparePlaceHolders(int length) {
+        StringBuilder builder = new StringBuilder();
+        for (int i = 0; i < length;) {
+            builder.append("?");
+            if (++i < length) {
+                builder.append(",");
+            }
+        }
+        return builder.toString();
+    }
+
+    public static void setValues(PreparedStatement preparedStatement, Object... values) throws SQLException {
+        for (int i = 0; i < values.length; i++) {
+            preparedStatement.setObject(i + 1, values[i]);
+        }
+    }*/
+
+
+    @Override
+    public  List<SummedCapacity> findCapacityBy(Integer capacityType, Long zoneId, Long podId, Long clusterId, String resource_state){
+
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        List<SummedCapacity> result = new ArrayList<SummedCapacity>();
+
+        StringBuilder sql = new StringBuilder(LIST_CAPACITY_BY_RESOURCE_STATE);           
+        List<Long> resourceIdList = new ArrayList<Long>();
+
+        if (zoneId != null){
+            sql.append(" AND capacity.data_center_id = ?");
+            resourceIdList.add(zoneId);
+        }
+        if (podId != null){
+            sql.append(" AND capacity.pod_id = ?");
+            resourceIdList.add(podId);
+        }
+        if (clusterId != null){
+            sql.append(" AND capacity.cluster_id = ?");
+            resourceIdList.add(clusterId);
+        }
+        if (capacityType != null){
+            sql.append(" AND capacity.capacity_type = ?");
+            resourceIdList.add(capacityType.longValue());
+        }   
+
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql.toString());
+            pstmt.setString(1, resource_state);
+            pstmt.setString(2, resource_state);
+            pstmt.setString(3, resource_state);
+            pstmt.setString(4, resource_state);
+            for (int i = 0; i < resourceIdList.size(); i++){                
+                pstmt.setLong( 5+i, resourceIdList.get(i));
+            }            
+            ResultSet rs = pstmt.executeQuery();
+            while (rs.next()) {
+                SummedCapacity summedCapacity = new SummedCapacity(rs.getLong(2), rs.getLong(3), rs.getLong(4), (short)rs.getLong(5), null, null, rs.getLong(1));
+                result.add(summedCapacity);
+            }
+            return result;
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("DB Exception on: " + sql, e);
+        } catch (Throwable e) {
+            throw new CloudRuntimeException("Caught: " + sql, e);
+        }        
+    }
+
+    @Override
+    public  List<SummedCapacity> listCapacitiesGroupedByLevelAndType(Integer capacityType, Long zoneId, Long podId, Long clusterId, int level, Long limit){
+
+        StringBuilder finalQuery = new StringBuilder(); 
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        List<SummedCapacity> result = new ArrayList<SummedCapacity>();
+
+        List<Long> resourceIdList = new ArrayList<Long>();
+
+        switch(level){
+        case 1: // List all the capacities grouped by zone, capacity Type
+            finalQuery.append(LIST_CAPACITY_GROUP_BY_ZONE_TYPE_PART1);
+            break;
+
+        case 2: // List all the capacities grouped by pod, capacity Type
+            finalQuery.append(LIST_CAPACITY_GROUP_BY_POD_TYPE_PART1);
+            break;
+
+        case 3: // List all the capacities grouped by cluster, capacity Type
+            finalQuery.append(LIST_CAPACITY_GROUP_BY_CLUSTER_TYPE_PART1);
+            break;
+        }
+
+        if (zoneId != null){
+            finalQuery.append(" AND data_center_id = ?" );
+            resourceIdList.add(zoneId);
+        }
+        if (podId != null){
+            finalQuery.append(" AND pod_id = ?" );
+            resourceIdList.add(podId);
+        }
+        if (clusterId != null){
+            finalQuery.append(" AND cluster_id = ?" );
+            resourceIdList.add(clusterId );
+        }
+        if (capacityType != null){
+            finalQuery.append(" AND capacity_type = ?");
+            resourceIdList.add(capacityType.longValue() );
+        }
+
+        switch(level){
+        case 1: // List all the capacities grouped by zone, capacity Type
+            finalQuery.append(LIST_CAPACITY_GROUP_BY_ZONE_TYPE_PART2);
+            break;
+
+        case 2: // List all the capacities grouped by pod, capacity Type
+            finalQuery.append(LIST_CAPACITY_GROUP_BY_POD_TYPE_PART2);
+            break;
+
+        case 3: // List all the capacities grouped by cluster, capacity Type
+            finalQuery.append(LIST_CAPACITY_GROUP_BY_CLUSTER_TYPE_PART2);
+            break;
+        }
+
+        finalQuery.append("?");
+        resourceIdList.add((long) limit);
+        
+        try {
+            pstmt = txn.prepareAutoCloseStatement(finalQuery.toString());
+            for (int i = 0; i < resourceIdList.size(); i++){
+                pstmt.setLong(1+i, resourceIdList.get(i));
+            }
+            ResultSet rs = pstmt.executeQuery();
+            while (rs.next()) {
+                Long capacityPodId = null;
+                Long capacityClusterId = null;
+
+                if(level != 1 && rs.getLong(6) != 0)
+                    capacityPodId = rs.getLong(6);
+                if(level == 3 && rs.getLong(7) != 0)
+                    capacityClusterId = rs.getLong(7);                   
+
+                SummedCapacity summedCapacity = new SummedCapacity( rs.getLong(1), rs.getLong(2), rs.getFloat(3),
+                        (short)rs.getLong(4), rs.getLong(5),
+                        capacityPodId, capacityClusterId);
+
+                result.add(summedCapacity);
+            }
+            return result;
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("DB Exception on: " + finalQuery, e);
+        } catch (Throwable e) {
+            throw new CloudRuntimeException("Caught: " + finalQuery, e);
+        }                     
+
+    }
+
+    @Override
+    public  List<SummedCapacity> findCapacityBy(Integer capacityType, Long zoneId, Long podId, Long clusterId){
+
+        GenericSearchBuilder<CapacityVO, SummedCapacity> SummedCapacitySearch = createSearchBuilder(SummedCapacity.class);
+        SummedCapacitySearch.select("dcId", Func.NATIVE, SummedCapacitySearch.entity().getDataCenterId());
+        SummedCapacitySearch.select("sumUsed", Func.SUM, SummedCapacitySearch.entity().getUsedCapacity());
+        SummedCapacitySearch.select("sumReserved", Func.SUM, SummedCapacitySearch.entity().getReservedCapacity());
+        SummedCapacitySearch.select("sumTotal", Func.SUM, SummedCapacitySearch.entity().getTotalCapacity());
+        SummedCapacitySearch.select("capacityType", Func.NATIVE, SummedCapacitySearch.entity().getCapacityType());        
+
+        if (zoneId==null && podId==null && clusterId==null){ // List all the capacities grouped by zone, capacity Type
+            SummedCapacitySearch.groupBy(SummedCapacitySearch.entity().getDataCenterId(), SummedCapacitySearch.entity().getCapacityType());            
+        }else {
+            SummedCapacitySearch.groupBy(SummedCapacitySearch.entity().getCapacityType());
+        }
+
+        if (zoneId != null){
+            SummedCapacitySearch.and("dcId", SummedCapacitySearch.entity().getDataCenterId(), Op.EQ);
+        }
+        if (podId != null){
+            SummedCapacitySearch.and("podId", SummedCapacitySearch.entity().getPodId(), Op.EQ);
+        }
+        if (clusterId != null){
+            SummedCapacitySearch.and("clusterId", SummedCapacitySearch.entity().getClusterId(), Op.EQ);
+        }
+        if (capacityType != null){
+            SummedCapacitySearch.and("capacityType", SummedCapacitySearch.entity().getCapacityType(), Op.EQ);	
+        }        
+
+        SummedCapacitySearch.done();
+
+
+        SearchCriteria<SummedCapacity> sc = SummedCapacitySearch.create();
+        if (zoneId != null){
+            sc.setParameters("dcId", zoneId);
+        }
+        if (podId != null){
+            sc.setParameters("podId", podId);
+        }
+        if (clusterId != null){
+            sc.setParameters("clusterId", clusterId);
+        }
+        if (capacityType != null){
+            sc.setParameters("capacityType", capacityType);
+        }
+
+        Filter filter = new Filter(CapacityVO.class, null, true, null, null);
+        List<SummedCapacity> results = customSearchIncludingRemoved(sc, filter);
+        return results;        
+
+    }
+
+    public void updateAllocated(Long hostId, long allocatedAmount, short capacityType, boolean add) {
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        try {
+            txn.start();
+            String sql = null;
+            if (add) {
+                sql = ADD_ALLOCATED_SQL;
+            } else {
+                sql = SUBTRACT_ALLOCATED_SQL;
+            }
+            pstmt = txn.prepareAutoCloseStatement(sql);
+            pstmt.setLong(1, allocatedAmount);
+            pstmt.setLong(2, hostId);
+            pstmt.setShort(3, capacityType);
+            pstmt.executeUpdate(); // TODO:  Make sure exactly 1 row was updated?
+            txn.commit();
+        } catch (Exception e) {
+            txn.rollback();
+            s_logger.warn("Exception updating capacity for host: " + hostId, e);
+        }
+    }
+
+
+    @Override
+    public CapacityVO findByHostIdType(Long hostId, short capacityType) {
+        SearchCriteria<CapacityVO> sc = _hostIdTypeSearch.create();
+        sc.setParameters("hostId", hostId);
+        sc.setParameters("type", capacityType);
+        return findOneBy(sc);
+    }  
+
+    @Override
+    public List<Long> listClustersInZoneOrPodByHostCapacities(long id, int requiredCpu, long requiredRam, short capacityTypeForOrdering, boolean isZone){
+    Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        List<Long> result = new ArrayList<Long>();
+
+        StringBuilder sql = new StringBuilder(LIST_CLUSTERSINZONE_BY_HOST_CAPACITIES_PART1);
+
+        if(isZone){
+            sql.append("capacity.data_center_id = ?");
+        }else{
+            sql.append("capacity.pod_id = ?");
+        }
+        sql.append(LIST_CLUSTERSINZONE_BY_HOST_CAPACITIES_PART2);
+        if(isZone){
+            sql.append("capacity.data_center_id = ?");
+        }else{
+            sql.append("capacity.pod_id = ?");
+        }
+        sql.append(LIST_CLUSTERSINZONE_BY_HOST_CAPACITIES_PART3);
+
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql.toString());
+            pstmt.setLong(1, id);
+            pstmt.setShort(2, CapacityVO.CAPACITY_TYPE_CPU);
+            pstmt.setString(3,"cpuOvercommitRatio");
+            pstmt.setLong(4, requiredCpu);
+            pstmt.setLong(5, id);
+            pstmt.setShort(6, CapacityVO.CAPACITY_TYPE_MEMORY);
+            pstmt.setString(7,"memoryOvercommitRatio");
+            pstmt.setLong(8, requiredRam);
+
+            ResultSet rs = pstmt.executeQuery();
+            while (rs.next()) {
+                result.add(rs.getLong(1));
+            }
+            return result;
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("DB Exception on: " + sql, e);
+        } catch (Throwable e) {
+            throw new CloudRuntimeException("Caught: " + sql, e);
+        }
+    }
+
+
+    @Override
+    public List<Long> listHostsWithEnoughCapacity(int requiredCpu, long requiredRam, Long clusterId, String hostType){
+    Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        List<Long> result = new ArrayList<Long>();
+
+        StringBuilder sql = new StringBuilder(LIST_HOSTS_IN_CLUSTER_WITH_ENOUGH_CAPACITY);
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql.toString());
+            pstmt.setLong(1, clusterId);
+            pstmt.setString(2, hostType);
+            pstmt.setLong(3, requiredCpu);
+            pstmt.setLong(4, requiredRam);
+
+            ResultSet rs = pstmt.executeQuery();
+            while (rs.next()) {
+                result.add(rs.getLong(1));
+            }
+            return result;
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("DB Exception on: " + sql, e);
+        } catch (Throwable e) {
+            throw new CloudRuntimeException("Caught: " + sql, e);
+        }
+    }
+
+    public static class SummedCapacity {
+        public long sumUsed;
+        public long sumReserved;
+        public long sumTotal;
+        public Float percentUsed;
+        public short capacityType;
+        public Long clusterId;
+        public Long podId;
+        public Long dcId;
+        public SummedCapacity() {
+        }
+        public SummedCapacity(long sumUsed, long sumReserved, long sumTotal,
+                short capacityType, Long clusterId, Long podId) {
+            super();
+            this.sumUsed = sumUsed;
+            this.sumReserved = sumReserved;
+            this.sumTotal = sumTotal;
+            this.capacityType = capacityType;
+            this.clusterId = clusterId;
+            this.podId = podId;
+        }
+        public SummedCapacity(long sumUsed, long sumReserved, long sumTotal,
+                short capacityType, Long clusterId, Long podId, Long zoneId) {
+            this(sumUsed, sumReserved, sumTotal, capacityType, clusterId, podId);
+            this.dcId = zoneId;
+        }
+
+        public SummedCapacity(long sumUsed, long sumTotal, float percentUsed, short capacityType, Long zoneId, Long podId, Long clusterId) {
+            super();
+            this.sumUsed = sumUsed;
+            this.sumTotal = sumTotal;
+            this.percentUsed = percentUsed;
+            this.capacityType = capacityType;
+            this.clusterId = clusterId;
+            this.podId = podId;
+            this.dcId = zoneId;
+        }
+
+        public Short getCapacityType() {				
+            return capacityType;
+        }
+        public Long getUsedCapacity() {
+            return sumUsed;
+        }
+        public long getReservedCapacity() {
+            return sumReserved;
+        }
+        public Long getTotalCapacity() {
+            return sumTotal;
+        }
+        public Long getDataCenterId() {
+            return dcId;
+        }
+        public Long getClusterId() {
+            return clusterId;
+        }
+        public Long getPodId() {
+            return podId;
+        }
+        public Float getPercentUsed() {
+            return percentUsed;
+        }
+    }
+    @Override
+    public List<SummedCapacity> findByClusterPodZone(Long zoneId, Long podId, Long clusterId){
+
+        GenericSearchBuilder<CapacityVO, SummedCapacity> SummedCapacitySearch = createSearchBuilder(SummedCapacity.class);
+        SummedCapacitySearch.select("sumUsed", Func.SUM, SummedCapacitySearch.entity().getUsedCapacity());
+        SummedCapacitySearch.select("sumTotal", Func.SUM, SummedCapacitySearch.entity().getTotalCapacity());   
+        SummedCapacitySearch.select("capacityType", Func.NATIVE, SummedCapacitySearch.entity().getCapacityType());                                
+        SummedCapacitySearch.groupBy(SummedCapacitySearch.entity().getCapacityType());
+
+        if(zoneId != null){
+            SummedCapacitySearch.and("zoneId", SummedCapacitySearch.entity().getDataCenterId(), Op.EQ);
+        }
+        if (podId != null){
+            SummedCapacitySearch.and("podId", SummedCapacitySearch.entity().getPodId(), Op.EQ);
+        }
+        if (clusterId != null){
+            SummedCapacitySearch.and("clusterId", SummedCapacitySearch.entity().getClusterId(), Op.EQ);
+        }
+        SummedCapacitySearch.done();
+
+
+        SearchCriteria<SummedCapacity> sc = SummedCapacitySearch.create();
+        if (zoneId != null){
+            sc.setParameters("zoneId", zoneId);
+        }
+        if (podId != null){
+            sc.setParameters("podId", podId);
+        }
+        if (clusterId != null){
+            sc.setParameters("clusterId", clusterId);
+        }
+
+        return customSearchIncludingRemoved(sc, null);         
+    }
+
+    @Override
+    public List<SummedCapacity> findNonSharedStorageForClusterPodZone(Long zoneId, Long podId, Long clusterId){
+
+        GenericSearchBuilder<CapacityVO, SummedCapacity> SummedCapacitySearch = createSearchBuilder(SummedCapacity.class);
+        SummedCapacitySearch.select("sumUsed", Func.SUM, SummedCapacitySearch.entity().getUsedCapacity());
+        SummedCapacitySearch.select("sumTotal", Func.SUM, SummedCapacitySearch.entity().getTotalCapacity());   
+        SummedCapacitySearch.select("capacityType", Func.NATIVE, SummedCapacitySearch.entity().getCapacityType());
+        SummedCapacitySearch.and("capacityType", SummedCapacitySearch.entity().getCapacityType(), Op.EQ);
+
+        SearchBuilder<StoragePoolVO>  nonSharedStorage = _storagePoolDao.createSearchBuilder();
+        nonSharedStorage.and("poolTypes", nonSharedStorage.entity().getPoolType(), SearchCriteria.Op.IN);
+        SummedCapacitySearch.join("nonSharedStorage", nonSharedStorage, nonSharedStorage.entity().getId(), SummedCapacitySearch.entity().getHostOrPoolId(), JoinType.INNER);
+        nonSharedStorage.done();        
+
+        if(zoneId != null){
+            SummedCapacitySearch.and("zoneId", SummedCapacitySearch.entity().getDataCenterId(), Op.EQ);
+        }
+        if (podId != null){
+            SummedCapacitySearch.and("podId", SummedCapacitySearch.entity().getPodId(), Op.EQ);
+        }
+        if (clusterId != null){
+            SummedCapacitySearch.and("clusterId", SummedCapacitySearch.entity().getClusterId(), Op.EQ);
+        }
+        SummedCapacitySearch.done();
+
+
+        SearchCriteria<SummedCapacity> sc = SummedCapacitySearch.create();
+        sc.setJoinParameters("nonSharedStorage", "poolTypes", Storage.getNonSharedStoragePoolTypes().toArray());
+        sc.setParameters("capacityType", Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED);
+        if (zoneId != null){
+            sc.setParameters("zoneId", zoneId);
+        }
+        if (podId != null){
+            sc.setParameters("podId", podId);
+        }
+        if (clusterId != null){
+            sc.setParameters("clusterId", clusterId);
+        }
+
+        return customSearchIncludingRemoved(sc, null);         
+    }
+
+    @Override
+    public boolean removeBy(Short capacityType, Long zoneId, Long podId, Long clusterId, Long hostId) {
+        SearchCriteria<CapacityVO> sc = _allFieldsSearch.create();
+
+        if (capacityType != null) {
+            sc.setParameters("capacityType", capacityType);
+        }
+
+        if (zoneId != null) {
+            sc.setParameters("zoneId", zoneId);
+        }
+
+        if (podId != null) {
+            sc.setParameters("podId", podId);
+        }
+
+        if (clusterId != null) {
+            sc.setParameters("clusterId", clusterId);
+        }
+
+        if (hostId != null) {
+            sc.setParameters("hostId", hostId);
+        }
+
+        return remove(sc) > 0;
+    }
+
+    @Override
+    public Pair<List<Long>, Map<Long, Double>> orderClustersByAggregateCapacity(long id, short capacityTypeForOrdering, boolean isZone){
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        List<Long> result = new ArrayList<Long>();
+        Map<Long, Double> clusterCapacityMap = new HashMap<Long, Double>();
+        StringBuilder sql = new StringBuilder();
+        if (capacityTypeForOrdering != Capacity.CAPACITY_TYPE_CPU && capacityTypeForOrdering != Capacity.CAPACITY_TYPE_MEMORY)  {
+             sql.append(ORDER_CLUSTERS_BY_AGGREGATE_CAPACITY_PART1);
+        }
+        else {
+             sql.append(ORDER_CLUSTERS_BY_AGGREGATE_OVERCOMMIT_CAPACITY_PART1);
+        }
+
+
+        if(isZone){
+            sql.append(" data_center_id = ?");
+        }else{
+            sql.append(" pod_id = ?");
+        }
+        if (capacityTypeForOrdering != Capacity.CAPACITY_TYPE_CPU && capacityTypeForOrdering != Capacity.CAPACITY_TYPE_MEMORY){
+           sql.append(ORDER_CLUSTERS_BY_AGGREGATE_CAPACITY_PART2);
+        }
+        else {
+           sql.append(ORDER_CLUSTERS_BY_AGGREGATE_OVERCOMMIT_CAPACITY_PART2);
+        }
+
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql.toString());
+            pstmt.setLong(1, id);
+            pstmt.setShort(2,capacityTypeForOrdering);
+
+            if (capacityTypeForOrdering == Capacity.CAPACITY_TYPE_CPU){
+                pstmt.setString(3,"cpuOvercommitRatio");
+            }
+            else if (capacityTypeForOrdering == Capacity.CAPACITY_TYPE_MEMORY){
+                pstmt.setString(3,"memoryOvercommitRatio");
+            }
+
+            ResultSet rs = pstmt.executeQuery();
+            while (rs.next()) {
+                Long clusterId = rs.getLong(1);
+                result.add(clusterId);
+                clusterCapacityMap.put(clusterId, rs.getDouble(2));
+            }
+            return new Pair<List<Long>, Map<Long, Double>>(result, clusterCapacityMap);
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("DB Exception on: " + sql, e);
+        } catch (Throwable e) {
+            throw new CloudRuntimeException("Caught: " + sql, e);
+        }
+    }
+
+    @Override
+    public List<Long> listPodsByHostCapacities(long zoneId, int requiredCpu, long requiredRam, short capacityType) {
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        List<Long> result = new ArrayList<Long>();
+
+        StringBuilder sql = new StringBuilder(LIST_PODSINZONE_BY_HOST_CAPACITY_TYPE);
+                      sql.append("AND capacity.pod_id IN (");
+                      sql.append(LIST_PODSINZONE_BY_HOST_CAPACITY_TYPE);
+                      sql.append(")");
+
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql.toString());
+            pstmt.setLong(1, zoneId);
+            pstmt.setShort(2, CapacityVO.CAPACITY_TYPE_CPU);
+            pstmt.setString(3, "cpuOvercommitRatio");
+            pstmt.setLong(4, requiredCpu);
+            pstmt.setLong(5, zoneId);
+            pstmt.setShort(6, CapacityVO.CAPACITY_TYPE_MEMORY);
+            pstmt.setString(7,"memoryOvercommitRatio" );
+            pstmt.setLong(8, requiredRam);
+
+            ResultSet rs = pstmt.executeQuery();
+            while (rs.next()) {
+                result.add(rs.getLong(1));
+            }
+            return result;
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("DB Exception on: " + sql, e);
+        } catch (Throwable e) {
+            throw new CloudRuntimeException("Caught: " + sql, e);
+        }
+    }
+
+    @Override
+    public Pair<List<Long>, Map<Long, Double>> orderPodsByAggregateCapacity(long zoneId, short capacityTypeForOrdering) {
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        List<Long> result = new ArrayList<Long>();
+        Map<Long, Double> podCapacityMap = new HashMap<Long, Double>();
+        
+        StringBuilder sql = new StringBuilder(ORDER_PODS_BY_AGGREGATE_CAPACITY);
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql.toString());
+            pstmt.setLong(2, zoneId);
+            pstmt.setShort(3, capacityTypeForOrdering);
+            
+            if(capacityTypeForOrdering == CapacityVO.CAPACITY_TYPE_CPU){
+                pstmt.setString(3, "cpuOvercommitRatio");
+            }
+            
+            ResultSet rs = pstmt.executeQuery();
+            while (rs.next()) {
+                Long podId = rs.getLong(1);
+                result.add(podId);
+                podCapacityMap.put(podId, rs.getDouble(2));
+            }
+            return new Pair<List<Long>, Map<Long, Double>>(result, podCapacityMap);
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("DB Exception on: " + sql, e);
+        } catch (Throwable e) {
+            throw new CloudRuntimeException("Caught: " + sql, e);
+        }
+    }
+
+    @Override
+    public void updateCapacityState(Long dcId, Long podId, Long clusterId, Long hostId, String capacityState) {
+        Transaction txn = Transaction.currentTxn();
+        StringBuilder sql = new StringBuilder(UPDATE_CAPACITY_STATE);
+        List<Long> resourceIdList = new ArrayList<Long>();
+
+        if (dcId != null){
+            sql.append(" data_center_id = ?");
+            resourceIdList.add(dcId);
+        }
+        if (podId != null){
+            sql.append(" pod_id = ?");
+            resourceIdList.add(podId);
+        }
+        if (clusterId != null){
+            sql.append(" cluster_id = ?");
+            resourceIdList.add(clusterId);
+        }
+        if (hostId != null){
+            sql.append(" host_id = ?");
+            resourceIdList.add(hostId);
+        }
+
+        PreparedStatement pstmt = null;
+        try {       
+            pstmt = txn.prepareAutoCloseStatement(sql.toString());
+            pstmt.setString(1, capacityState);
+            for (int i = 0; i < resourceIdList.size(); i++){                
+                pstmt.setLong( 2+i, resourceIdList.get(i));
+            }            
+            pstmt.executeUpdate();
+        } catch (Exception e) {
+            s_logger.warn("Error updating CapacityVO", e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/certificate/CertificateVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/certificate/CertificateVO.java b/engine/schema/src/com/cloud/certificate/CertificateVO.java
new file mode 100644
index 0000000..4f04760
--- /dev/null
+++ b/engine/schema/src/com/cloud/certificate/CertificateVO.java
@@ -0,0 +1,63 @@
+// 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.certificate;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="certificate")
+public class CertificateVO implements InternalIdentity {
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private Long id = null;
+
+    @Column(name="certificate",length=65535)
+    private String certificate;
+
+    @Column(name="updated")
+    private String updated;
+
+    public CertificateVO() {}
+
+    public long getId() {
+        return id;
+    }
+    
+    public String getCertificate() {
+        return certificate;
+    }
+    public void setCertificate(String certificate) {
+        this.certificate = certificate;
+    }
+    
+    public String getUpdated(){
+    	return this.updated;
+    }
+    
+    public void setUpdated(String updated){
+    	this.updated = updated;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/certificate/dao/CertificateDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/certificate/dao/CertificateDao.java b/engine/schema/src/com/cloud/certificate/dao/CertificateDao.java
new file mode 100644
index 0000000..9aedf9f
--- /dev/null
+++ b/engine/schema/src/com/cloud/certificate/dao/CertificateDao.java
@@ -0,0 +1,24 @@
+// 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.certificate.dao;
+
+import com.cloud.certificate.CertificateVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface CertificateDao extends GenericDao<CertificateVO, Long> {
+	public Long persistCustomCertToDb(String certStr, CertificateVO cert, Long managementServerId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/certificate/dao/CertificateDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/certificate/dao/CertificateDaoImpl.java b/engine/schema/src/com/cloud/certificate/dao/CertificateDaoImpl.java
new file mode 100644
index 0000000..f071cea
--- /dev/null
+++ b/engine/schema/src/com/cloud/certificate/dao/CertificateDaoImpl.java
@@ -0,0 +1,63 @@
+// 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.certificate.dao;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.certificate.CertificateVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+
+@Component
+@Local(value={CertificateDao.class}) @DB(txn=false)
+public class CertificateDaoImpl extends GenericDaoBase<CertificateVO, Long>  implements CertificateDao {
+	
+    private static final Logger s_logger = Logger.getLogger(CertificateDaoImpl.class);
+    
+    public CertificateDaoImpl(){
+    	
+    }
+    
+	@Override
+	public Long persistCustomCertToDb(String certStr, CertificateVO cert, Long managementServerId){		
+	    BufferedInputStream f = null;
+		try 
+	    {
+        	cert.setCertificate(certStr);
+        	cert.setUpdated("Y");
+        	update(cert.getId(),cert);
+        	return cert.getId();
+	    }  catch (Exception e){
+	    	s_logger.warn("Unable to read the certificate: "+e);
+	    	return new Long(0);
+	    }
+	    finally 
+	    {
+	        if (f != null) 
+	        	try { f.close(); } catch (IOException ignored) { }
+	    }
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/cluster/ClusterInvalidSessionException.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/ClusterInvalidSessionException.java b/engine/schema/src/com/cloud/cluster/ClusterInvalidSessionException.java
new file mode 100644
index 0000000..8ac94f2
--- /dev/null
+++ b/engine/schema/src/com/cloud/cluster/ClusterInvalidSessionException.java
@@ -0,0 +1,33 @@
+// 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.cluster;
+
+import com.cloud.exception.CloudException;
+
+public class ClusterInvalidSessionException extends CloudException {
+
+	private static final long serialVersionUID = -6636524194520997512L;
+
+    public ClusterInvalidSessionException(String message) {
+        super(message);
+    }
+
+    public ClusterInvalidSessionException(String message, Throwable th) {
+        super(message, th);
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/cluster/ManagementServerHostPeerVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/ManagementServerHostPeerVO.java b/engine/schema/src/com/cloud/cluster/ManagementServerHostPeerVO.java
new file mode 100644
index 0000000..e5e12ec
--- /dev/null
+++ b/engine/schema/src/com/cloud/cluster/ManagementServerHostPeerVO.java
@@ -0,0 +1,120 @@
+// 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.cluster;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import com.cloud.utils.DateUtil;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="mshost_peer")
+public class ManagementServerHostPeerVO implements InternalIdentity {
+    
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+    @Column(name="owner_mshost", updatable=true, nullable=false)
+    private long ownerMshost;
+    
+    @Column(name="peer_mshost", updatable=true, nullable=false)
+    private long peerMshost;
+    
+    @Column(name="peer_runid", updatable=true, nullable=false)
+    private long peerRunid;
+
+    @Column(name="peer_state", updatable = true, nullable=false)
+    @Enumerated(value=EnumType.STRING)
+    private ManagementServerHost.State peerState;
+    
+    @Temporal(TemporalType.TIMESTAMP)
+    @Column(name="last_update", updatable=true, nullable=true)
+    private Date lastUpdateTime;
+
+    public ManagementServerHostPeerVO() {
+    }
+    
+    public ManagementServerHostPeerVO(long ownerMshost, long peerMshost, long peerRunid, ManagementServerHost.State peerState) {
+        this.ownerMshost = ownerMshost;
+        this.peerMshost = peerMshost;
+        this.peerRunid = peerRunid;
+        this.peerState = peerState;
+        
+        this.lastUpdateTime = DateUtil.currentGMTTime();
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public long getOwnerMshost() {
+        return ownerMshost;
+    }
+
+    public void setOwnerMshost(long ownerMshost) {
+        this.ownerMshost = ownerMshost;
+    }
+
+    public long getPeerMshost() {
+        return peerMshost;
+    }
+
+    public void setPeerMshost(long peerMshost) {
+        this.peerMshost = peerMshost;
+    }
+
+    public long getPeerRunid() {
+        return peerRunid;
+    }
+
+    public void setPeerRunid(long peerRunid) {
+        this.peerRunid = peerRunid;
+    }
+
+    public ManagementServerHost.State getPeerState() {
+        return peerState;
+    }
+
+    public void setPeerState(ManagementServerHost.State peerState) {
+        this.peerState = peerState;
+    }
+
+    public Date getLastUpdateTime() {
+        return lastUpdateTime;
+    }
+
+    public void setLastUpdateTime(Date lastUpdateTime) {
+        this.lastUpdateTime = lastUpdateTime;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/cluster/ManagementServerHostVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/ManagementServerHostVO.java b/engine/schema/src/com/cloud/cluster/ManagementServerHostVO.java
new file mode 100644
index 0000000..31642e4
--- /dev/null
+++ b/engine/schema/src/com/cloud/cluster/ManagementServerHostVO.java
@@ -0,0 +1,182 @@
+// 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.cluster;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="mshost")
+public class ManagementServerHostVO implements ManagementServerHost {
+
+	@Id
+	@GeneratedValue(strategy=GenerationType.IDENTITY)
+	@Column(name="id")
+	private long id;
+
+	@Column(name="msid", updatable=true, nullable=false)
+	private long msid;
+	
+	@Column(name="runid", updatable=true, nullable=false)
+	private long runid;
+
+	@Column(name="name", updatable=true, nullable=true)
+	private String name;
+	
+    @Column(name="state", updatable = true, nullable=false)
+    @Enumerated(value=EnumType.STRING)
+	private ManagementServerHost.State state;
+	
+	@Column(name="version", updatable=true, nullable=true)
+	private String version;
+	
+	@Column(name="service_ip", updatable=true, nullable=false)
+	private String serviceIP;
+	
+	@Column(name="service_port", updatable=true, nullable=false)
+	private int servicePort;
+	
+    @Temporal(TemporalType.TIMESTAMP)
+    @Column(name="last_update", updatable=true, nullable=true)
+    private Date lastUpdateTime;
+    
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+    
+	@Column(name="alert_count", updatable=true, nullable=false)
+	private int alertCount;
+
+    public ManagementServerHostVO() {
+    }
+    
+    public ManagementServerHostVO(long msid, long runid, String serviceIP, int servicePort, Date updateTime) {
+    	this.msid = msid;
+    	this.runid = runid;
+    	this.serviceIP = serviceIP;
+    	this.servicePort = servicePort;
+    	this.lastUpdateTime = updateTime;
+    }
+    
+	public long getId() {
+		return id;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+	
+	public long getRunid() {
+		return runid;
+	}
+	
+	public void setRunid(long runid) {
+		this.runid = runid;
+	}
+
+	@Override
+	public long getMsid() {
+		return msid;
+	}
+
+	public void setMsid(long msid) {
+		this.msid = msid;
+	}
+	
+	public String getName() {
+		return name;
+	}
+	
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	@Override
+	public ManagementServerHost.State getState() {
+		return this.state;
+	}
+	
+	public void setState(ManagementServerHost.State state) {
+		this.state = state;
+	}
+	
+	@Override
+	public String getVersion() {
+		return version;
+	}
+	
+	public void setVersion(String version) {
+		this.version = version;
+	}
+	
+	public String getServiceIP() {
+		return serviceIP;
+	}
+
+	public void setServiceIP(String serviceIP) {
+		this.serviceIP = serviceIP;
+	}
+
+	public int getServicePort() {
+		return servicePort;
+	}
+
+	public void setServicePort(int servicePort) {
+		this.servicePort = servicePort;
+	}
+
+	public Date getLastUpdateTime() {
+		return lastUpdateTime;
+	}
+
+	public void setLastUpdateTime(Date lastUpdateTime) {
+		this.lastUpdateTime = lastUpdateTime;
+	}
+	
+	public Date getRemoved() {
+		return removed;
+	}
+	
+	public void setRemoved(Date removedTime) {
+		removed = removedTime;
+	}
+	
+	public int getAlertCount() {
+		return alertCount; 
+	}
+	
+	public void setAlertCount(int count) {
+		alertCount = count;
+	}
+	
+	@Override
+    public String toString() {
+        return new StringBuilder("ManagementServer[").append("-").append(id).append("-").append(msid).append("-").append(state).append("]").toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/cluster/agentlb/HostTransferMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/agentlb/HostTransferMapVO.java b/engine/schema/src/com/cloud/cluster/agentlb/HostTransferMapVO.java
new file mode 100644
index 0000000..9c2edde
--- /dev/null
+++ b/engine/schema/src/com/cloud/cluster/agentlb/HostTransferMapVO.java
@@ -0,0 +1,98 @@
+// 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.cluster.agentlb;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = "op_host_transfer")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+public class HostTransferMapVO implements InternalIdentity {
+
+    public enum HostTransferState {
+        TransferRequested, TransferStarted;
+    }
+
+    @Id
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "initial_mgmt_server_id")
+    private long initialOwner;
+
+    @Column(name = "future_mgmt_server_id")
+    private long futureOwner;
+
+    @Column(name = "state")
+    private HostTransferState state;
+    
+    @Column(name=GenericDao.CREATED_COLUMN)
+    private Date created;
+
+    public HostTransferMapVO(long hostId, long initialOwner, long futureOwner) {
+        this.id = hostId;
+        this.initialOwner = initialOwner;
+        this.futureOwner = futureOwner;
+        this.state = HostTransferState.TransferRequested;
+    }
+
+    protected HostTransferMapVO() {
+    }
+
+    public long getInitialOwner() {
+        return initialOwner;
+    }
+
+    public long getFutureOwner() {
+        return futureOwner;
+    }
+
+    public HostTransferState getState() {
+        return state;
+    }
+
+    public void setInitialOwner(long initialOwner) {
+        this.initialOwner = initialOwner;
+    }
+
+    public void setFutureOwner(long futureOwner) {
+        this.futureOwner = futureOwner;
+    }
+
+    public void setState(HostTransferState state) {
+        this.state = state;
+    }
+
+    public long getId() {
+        return id;
+    }
+    
+    public Date getCreated() {
+        return created;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/cluster/agentlb/dao/HostTransferMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/agentlb/dao/HostTransferMapDao.java b/engine/schema/src/com/cloud/cluster/agentlb/dao/HostTransferMapDao.java
new file mode 100644
index 0000000..6c1f782
--- /dev/null
+++ b/engine/schema/src/com/cloud/cluster/agentlb/dao/HostTransferMapDao.java
@@ -0,0 +1,45 @@
+// 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.cluster.agentlb.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import com.cloud.cluster.agentlb.HostTransferMapVO;
+import com.cloud.cluster.agentlb.HostTransferMapVO.HostTransferState;
+import com.cloud.utils.db.GenericDao;
+
+public interface HostTransferMapDao extends GenericDao<HostTransferMapVO, Long> {
+
+    List<HostTransferMapVO> listHostsLeavingCluster(long currentOwnerId);
+
+    List<HostTransferMapVO> listHostsJoiningCluster(long futureOwnerId);
+
+    HostTransferMapVO startAgentTransfering(long hostId, long currentOwner, long futureOwner);
+
+    boolean completeAgentTransfer(long hostId);
+    
+    List<HostTransferMapVO> listBy(long futureOwnerId, HostTransferState state);
+    
+    HostTransferMapVO findActiveHostTransferMapByHostId(long hostId, Date cutTime);
+    
+    boolean startAgentTransfer(long hostId);
+    
+    HostTransferMapVO findByIdAndFutureOwnerId(long id, long futureOwnerId);
+    
+    HostTransferMapVO findByIdAndCurrentOwnerId(long id, long currentOwnerId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/cluster/agentlb/dao/HostTransferMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/agentlb/dao/HostTransferMapDaoImpl.java b/engine/schema/src/com/cloud/cluster/agentlb/dao/HostTransferMapDaoImpl.java
new file mode 100644
index 0000000..cff4cfc
--- /dev/null
+++ b/engine/schema/src/com/cloud/cluster/agentlb/dao/HostTransferMapDaoImpl.java
@@ -0,0 +1,146 @@
+// 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.cluster.agentlb.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.cluster.agentlb.HostTransferMapVO;
+import com.cloud.cluster.agentlb.HostTransferMapVO.HostTransferState;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value = { HostTransferMapDao.class })
+@DB(txn = false)
+public class HostTransferMapDaoImpl extends GenericDaoBase<HostTransferMapVO, Long> implements HostTransferMapDao {
+    private static final Logger s_logger = Logger.getLogger(HostTransferMapDaoImpl.class);
+
+    protected  SearchBuilder<HostTransferMapVO> AllFieldsSearch;
+    protected  SearchBuilder<HostTransferMapVO> IntermediateStateSearch;
+    protected  SearchBuilder<HostTransferMapVO> ActiveSearch;
+
+    public HostTransferMapDaoImpl() {
+       super();
+    }
+    
+    @PostConstruct
+    public void init() {
+    	 AllFieldsSearch = createSearchBuilder();
+         AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), SearchCriteria.Op.EQ);
+         AllFieldsSearch.and("initialOwner", AllFieldsSearch.entity().getInitialOwner(), SearchCriteria.Op.EQ);
+         AllFieldsSearch.and("futureOwner", AllFieldsSearch.entity().getFutureOwner(), SearchCriteria.Op.EQ);
+         AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), SearchCriteria.Op.EQ);
+         AllFieldsSearch.done();
+         
+         IntermediateStateSearch = createSearchBuilder();
+         IntermediateStateSearch.and("futureOwner", IntermediateStateSearch.entity().getFutureOwner(), SearchCriteria.Op.EQ);
+         IntermediateStateSearch.and("initialOwner", IntermediateStateSearch.entity().getInitialOwner(), SearchCriteria.Op.EQ);
+         IntermediateStateSearch.and("state", IntermediateStateSearch.entity().getState(), SearchCriteria.Op.IN);
+         IntermediateStateSearch.done();
+         
+         ActiveSearch = createSearchBuilder();
+         ActiveSearch.and("created", ActiveSearch.entity().getCreated(),  SearchCriteria.Op.GT);
+         ActiveSearch.and("id", ActiveSearch.entity().getId(), SearchCriteria.Op.EQ);
+         ActiveSearch.and("state", ActiveSearch.entity().getState(), SearchCriteria.Op.EQ);
+         ActiveSearch.done();
+         
+    }
+
+    @Override
+    public List<HostTransferMapVO> listHostsLeavingCluster(long currentOwnerId) {
+        SearchCriteria<HostTransferMapVO> sc = IntermediateStateSearch.create();
+        sc.setParameters("initialOwner", currentOwnerId);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<HostTransferMapVO> listHostsJoiningCluster(long futureOwnerId) {
+        SearchCriteria<HostTransferMapVO> sc = IntermediateStateSearch.create();
+        sc.setParameters("futureOwner", futureOwnerId);
+
+        return listBy(sc);
+    }
+    
+    @Override
+    public HostTransferMapVO startAgentTransfering(long hostId, long initialOwner, long futureOwner) {
+        HostTransferMapVO transfer = new HostTransferMapVO(hostId, initialOwner, futureOwner);
+        return persist(transfer); 
+    }
+
+    @Override
+    public boolean completeAgentTransfer(long hostId) {
+        return remove(hostId);
+    }
+    
+    @Override
+    public List<HostTransferMapVO> listBy(long futureOwnerId, HostTransferState state) {
+        SearchCriteria<HostTransferMapVO> sc = AllFieldsSearch.create();
+        sc.setParameters("futureOwner", futureOwnerId);
+        sc.setParameters("state", state);
+
+        return listBy(sc);
+    }
+    
+    @Override
+    public HostTransferMapVO findActiveHostTransferMapByHostId(long hostId, Date cutTime) {
+        SearchCriteria<HostTransferMapVO> sc = ActiveSearch.create();
+        sc.setParameters("id", hostId);
+        sc.setParameters("state", HostTransferState.TransferRequested);
+        sc.setParameters("created", cutTime);
+        
+        return findOneBy(sc);
+        
+    }
+    
+    @Override
+    public boolean startAgentTransfer(long hostId) {
+        HostTransferMapVO transfer = findById(hostId);
+        transfer.setState(HostTransferState.TransferStarted);
+        return update(hostId, transfer);
+    }
+    
+    
+    @Override
+    public HostTransferMapVO findByIdAndFutureOwnerId(long id, long futureOwnerId) {
+        SearchCriteria<HostTransferMapVO> sc = AllFieldsSearch.create();
+        sc.setParameters("futureOwner", futureOwnerId);
+        sc.setParameters("id", id);
+
+        return findOneBy(sc);
+    }
+    
+    
+    @Override
+    public HostTransferMapVO findByIdAndCurrentOwnerId(long id, long currentOwnerId) {
+        SearchCriteria<HostTransferMapVO> sc = AllFieldsSearch.create();
+        sc.setParameters("initialOwner", currentOwnerId);
+        sc.setParameters("id", id);
+
+        return findOneBy(sc);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostDao.java b/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostDao.java
new file mode 100644
index 0000000..fec0679
--- /dev/null
+++ b/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostDao.java
@@ -0,0 +1,48 @@
+// 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.cluster.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import com.cloud.cluster.ManagementServerHost;
+import com.cloud.cluster.ManagementServerHost.State;
+import com.cloud.cluster.ManagementServerHostVO;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDao;
+
+public interface ManagementServerHostDao extends GenericDao<ManagementServerHostVO, Long> {
+    @Override
+    boolean remove(Long id);
+
+	ManagementServerHostVO findByMsid(long msid);
+	int increaseAlertCount(long id);
+	
+	void update(long id, long runid, String name, String version, String serviceIP, int servicePort, Date lastUpdate);
+	void update(long id, long runid, Date lastUpdate);
+	List<ManagementServerHostVO> getActiveList(Date cutTime);
+	List<ManagementServerHostVO> getInactiveList(Date cutTime);
+
+	void invalidateRunSession(long id, long runid);
+	
+	void update(long id, long runId, State state, Date lastUpdate);
+	
+	List<ManagementServerHostVO> listBy(ManagementServerHost.State...states);
+	public List<Long> listOrphanMsids();
+
+	ManagementServerHostVO findOneInUpState(Filter filter);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java b/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
new file mode 100644
index 0000000..3866da1
--- /dev/null
+++ b/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
@@ -0,0 +1,276 @@
+// 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.cluster.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.TimeZone;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.cluster.ClusterInvalidSessionException;
+import com.cloud.cluster.ManagementServerHost;
+import com.cloud.cluster.ManagementServerHost.State;
+import com.cloud.cluster.ManagementServerHostVO;
+import com.cloud.utils.DateUtil;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Component
+@Local(value={ManagementServerHostDao.class})
+public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServerHostVO, Long> implements ManagementServerHostDao {
+    private static final Logger s_logger = Logger.getLogger(ManagementServerHostDaoImpl.class);
+    
+    private final SearchBuilder<ManagementServerHostVO> MsIdSearch;
+    private final SearchBuilder<ManagementServerHostVO> ActiveSearch;
+    private final SearchBuilder<ManagementServerHostVO> InactiveSearch;
+    private final SearchBuilder<ManagementServerHostVO> StateSearch;
+
+	@Override
+    public void invalidateRunSession(long id, long runid) {
+	    Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = txn.prepareAutoCloseStatement("update mshost set runid=0, state='Down' where id=? and runid=?");
+            pstmt.setLong(1, id);
+            pstmt.setLong(2, runid);
+            
+            pstmt.executeUpdate();
+        } catch (SQLException e) {
+        	throw new CloudRuntimeException("DB exception on " + pstmt.toString(), e);
+        }
+	}
+	
+	@Override
+    public ManagementServerHostVO findByMsid(long msid) {
+        SearchCriteria<ManagementServerHostVO> sc = MsIdSearch.create();
+        sc.setParameters("msid", msid);
+		
+		List<ManagementServerHostVO> l = listIncludingRemovedBy(sc);
+		if(l != null && l.size() > 0) {
+            return l.get(0);
+        }
+		 
+		return null;
+	}
+	
+	@Override
+    @DB
+	public void update(long id, long runid, String name, String version, String serviceIP, int servicePort, Date lastUpdate) {
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        try {
+            txn.start();
+            
+            pstmt = txn.prepareAutoCloseStatement("update mshost set name=?, version=?, service_ip=?, service_port=?, last_update=?, removed=null, alert_count=0, runid=?, state=? where id=?");
+            pstmt.setString(1, name);
+            pstmt.setString(2, version);
+            pstmt.setString(3, serviceIP);
+            pstmt.setInt(4, servicePort);
+            pstmt.setString(5, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), lastUpdate));
+            pstmt.setLong(6, runid);
+            pstmt.setString(7, ManagementServerHost.State.Up.toString());
+            pstmt.setLong(8, id);
+            
+            pstmt.executeUpdate();
+            txn.commit();
+        } catch(Exception e) {
+            s_logger.warn("Unexpected exception, ", e);
+        }
+	}
+	
+	@Override
+    @DB
+    public boolean remove(Long id) {
+        Transaction txn = Transaction.currentTxn();
+    
+        try {
+        	txn.start();
+        	
+        	ManagementServerHostVO msHost = findById(id);
+        	msHost.setState(ManagementServerHost.State.Down);
+        	super.remove(id);
+        	
+        	txn.commit();
+        	return true;
+        } catch(Exception e) {
+            s_logger.warn("Unexpected exception, ", e);
+        }
+        
+        return false;
+    }
+
+	@Override
+    @DB
+	public void update(long id, long runid, Date lastUpdate) {
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        try {
+            txn.start();
+            
+            pstmt = txn.prepareAutoCloseStatement("update mshost set last_update=?, removed=null, alert_count=0 where id=? and runid=?");
+            pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), lastUpdate));
+            pstmt.setLong(2, id);
+            pstmt.setLong(3, runid);
+            
+            int count = pstmt.executeUpdate();
+            txn.commit();
+
+            if(count < 1) {
+                throw new CloudRuntimeException("Invalid cluster session detected", new ClusterInvalidSessionException("runid " + runid + " is no longer valid"));
+            }
+        } catch(Exception e) {
+            s_logger.warn("Unexpected exception, ", e);
+        }
+	}
+	
+	@Override
+    public List<ManagementServerHostVO> getActiveList(Date cutTime) {
+	    SearchCriteria<ManagementServerHostVO> sc = ActiveSearch.create();
+	    sc.setParameters("lastUpdateTime", cutTime);
+	    
+	    return listIncludingRemovedBy(sc);
+	}
+
+	@Override
+    public List<ManagementServerHostVO> getInactiveList(Date cutTime) {
+	    SearchCriteria<ManagementServerHostVO> sc = InactiveSearch.create();
+	    sc.setParameters("lastUpdateTime", cutTime);
+	    
+	    return listIncludingRemovedBy(sc);
+	}
+	
+	@Override
+    @DB
+	public int increaseAlertCount(long id) {
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        int changedRows = 0;
+        try {
+            txn.start();
+            
+            pstmt = txn.prepareAutoCloseStatement("update mshost set alert_count=alert_count+1 where id=? and alert_count=0");
+            pstmt.setLong(1, id);
+            
+            changedRows = pstmt.executeUpdate();
+            txn.commit();
+        } catch(Exception e) {
+            s_logger.warn("Unexpected exception, ", e);
+            txn.rollback();
+        }
+        
+        return changedRows;
+	}
+	
+	protected ManagementServerHostDaoImpl() {
+		MsIdSearch = createSearchBuilder();
+		MsIdSearch.and("msid",  MsIdSearch.entity().getMsid(), SearchCriteria.Op.EQ);
+		MsIdSearch.done();
+		
+	    ActiveSearch = createSearchBuilder();
+	    ActiveSearch.and("lastUpdateTime", ActiveSearch.entity().getLastUpdateTime(),  SearchCriteria.Op.GT);
+	    ActiveSearch.and("removed", ActiveSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
+	    ActiveSearch.done();
+
+	    InactiveSearch = createSearchBuilder();
+	    InactiveSearch.and("lastUpdateTime", InactiveSearch.entity().getLastUpdateTime(),  SearchCriteria.Op.LTEQ);
+	    InactiveSearch.and("removed", InactiveSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
+	    InactiveSearch.done();
+	    
+	    StateSearch = createSearchBuilder();
+	    StateSearch.and("state", StateSearch.entity().getState(), SearchCriteria.Op.IN);
+	    StateSearch.done();
+	}
+	
+	
+	@Override
+    public void update(long id, long runId, State state, Date lastUpdate) {
+	    Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = txn.prepareAutoCloseStatement("update mshost set state=?, last_update=? where id=? and runid=?");
+            pstmt.setString(1, state.toString());
+            pstmt.setString(2, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), lastUpdate));
+            pstmt.setLong(3, id);
+            pstmt.setLong(4, runId);
+            
+            int count = pstmt.executeUpdate();
+            
+            if(count < 1) {
+                throw new CloudRuntimeException("Invalid cluster session detected", new ClusterInvalidSessionException("runid " + runId + " is no longer valid"));
+            }
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("DB exception on " + pstmt.toString(), e);
+        }
+    }
+	
+	@Override
+	public List<ManagementServerHostVO> listBy(ManagementServerHost.State...states) {
+	    SearchCriteria<ManagementServerHostVO> sc = StateSearch.create();
+
+        sc.setParameters("state", (Object[]) states);
+        
+        return listBy(sc);
+	}
+	
+	@Override
+	public List<Long> listOrphanMsids() {
+		List<Long> orphanList = new ArrayList<Long>();
+		
+	    Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(
+            	"select t.mgmt_server_id from (select mgmt_server_id, count(*) as count from host group by mgmt_server_id) as t WHERE t.count > 0 AND t.mgmt_server_id NOT IN (select msid from mshost)");
+
+            ResultSet rs = pstmt.executeQuery();
+            while(rs.next()) {
+            	orphanList.add(rs.getLong(1));
+            }
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("DB exception on " + pstmt.toString(), e);
+        }
+        
+        return orphanList;
+	}
+
+	@Override
+	public ManagementServerHostVO findOneInUpState(Filter filter) {
+	    SearchCriteria<ManagementServerHostVO> sc = StateSearch.create();
+
+        sc.setParameters("state", ManagementServerHost.State.Up);
+        
+        List<ManagementServerHostVO> mshosts =  listBy(sc, filter);
+        if(mshosts != null && mshosts.size() > 0){
+        	return mshosts.get(0);	
+        }
+        return null;
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostPeerDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostPeerDao.java b/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostPeerDao.java
new file mode 100644
index 0000000..14c872a
--- /dev/null
+++ b/engine/schema/src/com/cloud/cluster/dao/ManagementServerHostPeerDao.java
@@ -0,0 +1,27 @@
+// 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.cluster.dao;
+
+import com.cloud.cluster.ManagementServerHost;
+import com.cloud.cluster.ManagementServerHostPeerVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface ManagementServerHostPeerDao extends GenericDao<ManagementServerHostPeerVO, Long> {
+    void clearPeerInfo(long ownerMshost);
+    void updatePeerInfo(long ownerMshost, long peerMshost, long peerRunid, ManagementServerHost.State peerState);
+    int countStateSeenInPeers(long mshost, long runid, ManagementServerHost.State state);
+}


[21/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/CheckOnHostCommandTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/CheckOnHostCommandTest.java b/core/test/org/apache/cloudstack/api/agent/test/CheckOnHostCommandTest.java
new file mode 100644
index 0000000..1b68276
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/CheckOnHostCommandTest.java
@@ -0,0 +1,483 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.junit.Test;
+
+import com.cloud.agent.api.CheckOnHostCommand;
+import com.cloud.agent.api.to.HostTO;
+import com.cloud.host.Host;
+import com.cloud.host.Status;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.resource.ResourceState;
+
+public class CheckOnHostCommandTest {
+    public Host host = new Host() {
+        public Status getState() {
+            return Status.Up;
+        };
+
+        public long getId() {
+            return 101L;
+        };
+
+
+        @Override
+        public String getUuid() {
+            return "101";
+        }
+
+        public String getName() {
+            return "hostName";
+        };
+
+        public Type getType() {
+            return Host.Type.Storage;
+        };
+
+        public Date getCreated() {
+            Date date = null;
+            try {
+                date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
+                        .parse("01/01/1970 12:12:12");
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            return date;
+        }
+
+        public Status getStatus() {
+            return Status.Up;
+        };
+
+        public String getPrivateIpAddress() {
+            return "10.1.1.1";
+        };
+
+        public String getStorageIpAddress() {
+            return "10.1.1.2";
+        };
+
+        public String getGuid() {
+            return "bed9f83e-cac3-11e1-ac8a-0050568b007e";
+        };
+
+        public Long getTotalMemory() {
+            return 100000000000L;
+        };
+
+        public Integer getCpus() {
+            return 16;
+        };
+
+        public Long getSpeed() {
+            return 2000000000L;
+        };
+
+        public Integer getProxyPort() {
+            return 22;
+        };
+
+        public Long getPodId() {
+            return 16L;
+        };
+
+        public long getDataCenterId() {
+            return 17L;
+        };
+
+        public String getParent() {
+            return "parent";
+        };
+
+        public String getStorageIpAddressDeux() {
+            return "10.1.1.3";
+        };
+
+        public HypervisorType getHypervisorType() {
+            return HypervisorType.XenServer;
+        };
+
+        public Date getDisconnectedOn() {
+            Date date = null;
+            try {
+                date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
+                        .parse("01/01/2012 12:12:12");
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            return date;
+        }
+
+        public String getVersion() {
+            return "4.0.1";
+        };
+
+        public long getTotalSize() {
+            return 100000000000L;
+        };
+
+        public String getCapabilities() {
+            return "capabilities";
+        };
+
+        public long getLastPinged() {
+            return 1L;
+        };
+
+        public Long getManagementServerId() {
+            return 2L;
+        };
+
+        public Date getRemoved() {
+            Date date = null;
+            try {
+                date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
+                        .parse("02/01/2012 12:12:12");
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            return date;
+        };
+
+        public Long getClusterId() {
+            return 3L;
+        };
+
+        public String getPublicIpAddress() {
+            return "10.1.1.4";
+        };
+
+        public String getPublicNetmask() {
+            return "255.255.255.8";
+        };
+
+        public String getPrivateNetmask() {
+            return "255.255.255.16";
+        };
+
+        public String getStorageNetmask() {
+            return "255.255.255.24";
+        };
+
+        public String getStorageMacAddress() {
+            return "01:f4:17:38:0e:26";
+        };
+
+        public String getPublicMacAddress() {
+            return "02:f4:17:38:0e:26";
+        };
+
+        public String getPrivateMacAddress() {
+            return "03:f4:17:38:0e:26";
+        };
+
+        public String getStorageNetmaskDeux() {
+            return "255.255.255.25";
+        };
+
+        public String getStorageMacAddressDeux() {
+            return "01:f4:17:38:0e:27";
+        };
+
+        public String getHypervisorVersion() {
+            return "1.2.3.0";
+        };
+
+        public boolean isInMaintenanceStates() {
+            return false;
+        };
+
+        public ResourceState getResourceState() {
+            return ResourceState.Enabled;
+        };
+    };
+
+    CheckOnHostCommand cohc = new CheckOnHostCommand(host);
+
+    @Test
+    public void testGetHost() {
+        HostTO h = cohc.getHost();
+        assertNotNull(h);
+    }
+
+    @Test
+    public void testGetState() {
+        Status s = host.getState();
+        assertTrue(s == Status.Up);
+    }
+
+    @Test
+    public void testGetId() {
+        Long id = host.getId();
+        assertTrue(101L == id);
+    }
+
+    @Test
+    public void testGetName() {
+        String name = host.getName();
+        assertTrue(name.equals("hostName"));
+    }
+
+    @Test
+    public void testGetType() {
+        Host.Type t = host.getType();
+        assertTrue(t == Host.Type.Storage);
+    }
+
+    @Test
+    public void testGetCreated() {
+        try {
+            Date date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
+                    .parse("01/01/1970 12:12:12");
+            Date d = host.getCreated();
+            assertTrue(d.compareTo(date) == 0);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testGetStatus() {
+        Status s = host.getStatus();
+        assertTrue(s == Status.Up);
+    }
+
+    @Test
+    public void testGetPrivateIpAddress() {
+        String addr = host.getPrivateIpAddress();
+        assertTrue(addr.equals("10.1.1.1"));
+    }
+
+    @Test
+    public void testGetStorageIpAddress() {
+        String addr = host.getStorageIpAddress();
+        assertTrue(addr.equals("10.1.1.2"));
+    }
+
+    @Test
+    public void testGetGuid() {
+        String guid = host.getGuid();
+        assertTrue(guid.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e"));
+    }
+
+    @Test
+    public void testGetTotalMemory() {
+        Long m = host.getTotalMemory();
+        assertTrue(m == 100000000000L);
+    }
+
+    @Test
+    public void testGetCpus() {
+        int cpus = host.getCpus();
+        assertTrue(cpus == 16);
+    }
+
+    @Test
+    public void testGetSpeed() {
+        Long spped = host.getSpeed();
+        assertTrue(spped == 2000000000L);
+    }
+
+    @Test
+    public void testGetProxyPort() {
+        Integer port = host.getProxyPort();
+        assertTrue(port == 22);
+    }
+
+    @Test
+    public void testGetPodId() {
+        Long pID = host.getPodId();
+        assertTrue(pID == 16L);
+    }
+
+    @Test
+    public void testGetDataCenterId() {
+        long dcID = host.getDataCenterId();
+        assertTrue(dcID == 17L);
+    }
+
+    @Test
+    public void testGetParent() {
+        String p = host.getParent();
+        assertTrue(p.equals("parent"));
+    }
+
+    @Test
+    public void testGetStorageIpAddressDeux() {
+        String addr = host.getStorageIpAddressDeux();
+        assertTrue(addr.equals("10.1.1.3"));
+    }
+
+    @Test
+    public void testGetHypervisorType() {
+        HypervisorType type = host.getHypervisorType();
+        assertTrue(type == HypervisorType.XenServer);
+    }
+
+    @Test
+    public void testGetDisconnectedOn() {
+        try {
+            Date date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
+                    .parse("01/01/2012 12:12:12");
+            Date d = host.getDisconnectedOn();
+            assertTrue(d.compareTo(date) == 0);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testGetVersion() {
+        String v = host.getVersion();
+        assertTrue(v.equals("4.0.1"));
+    }
+
+    @Test
+    public void testGetTotalSize() {
+        long size = host.getTotalSize();
+        assertTrue(size == 100000000000L);
+    }
+
+    @Test
+    public void testGetCapabilities() {
+        String c = host.getCapabilities();
+        assertTrue(c.equals("capabilities"));
+    }
+
+    @Test
+    public void testGetLastPinged() {
+        long lp = host.getLastPinged();
+        assertTrue(lp == 1L);
+    }
+
+    @Test
+    public void testGetManagementServerId() {
+        Long msID = host.getManagementServerId();
+        assertTrue(msID == 2L);
+    }
+
+    @Test
+    public void testGetRemoved() {
+        try {
+            Date date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
+                    .parse("02/01/2012 12:12:12");
+            Date d = host.getRemoved();
+            assertTrue(d.compareTo(date) == 0);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testGetClusterId() {
+        Long cID = host.getClusterId();
+        assertTrue(cID == 3L);
+    }
+
+    @Test
+    public void testGetPublicIpAddress() {
+        String pipAddr = host.getPublicIpAddress();
+        assertTrue(pipAddr.equals("10.1.1.4"));
+    }
+
+    @Test
+    public void testGetPublicNetmask() {
+        String pMask = host.getPublicNetmask();
+        assertTrue(pMask.equals("255.255.255.8"));
+    }
+
+    @Test
+    public void testGetPrivateNetmask() {
+        String pMask = host.getPrivateNetmask();
+        assertTrue(pMask.equals("255.255.255.16"));
+    }
+
+    @Test
+    public void testGetStorageNetmask() {
+        String sMask = host.getStorageNetmask();
+        assertTrue(sMask.equals("255.255.255.24"));
+    }
+
+    @Test
+    public void testGetStorageMacAddress() {
+        String sMac = host.getStorageMacAddress();
+        assertTrue(sMac.equals("01:f4:17:38:0e:26"));
+    }
+
+    @Test
+    public void testGetPublicMacAddress() {
+        String pMac = host.getPublicMacAddress();
+        assertTrue(pMac.equals("02:f4:17:38:0e:26"));
+    }
+
+    @Test
+    public void testGetPrivateMacAddress() {
+        String pMac = host.getPrivateMacAddress();
+        assertTrue(pMac.equals("03:f4:17:38:0e:26"));
+    }
+
+    @Test
+    public void testGetStorageNetmaskDeux() {
+        String sMask = host.getStorageNetmaskDeux();
+        assertTrue(sMask.equals("255.255.255.25"));
+    }
+
+    @Test
+    public void testGetStorageMacAddressDeux() {
+        String sMac = host.getStorageMacAddressDeux();
+        assertTrue(sMac.equals("01:f4:17:38:0e:27"));
+    }
+
+    @Test
+    public void testGetHypervisorVersion() {
+        String v = host.getHypervisorVersion();
+        assertTrue(v.equals("1.2.3.0"));
+    }
+
+    @Test
+    public void testIsInMaintenanceStates() {
+        boolean b = host.isInMaintenanceStates();
+        assertFalse(b);
+    }
+
+    @Test
+    public void testGetResourceState() {
+        ResourceState r = host.getResourceState();
+        assertTrue(r == ResourceState.Enabled);
+    }
+
+    @Test
+    public void testGetWait() {
+        int wait = cohc.getWait();
+        assertTrue(20 == wait);
+    }
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = cohc.executeInSequence();
+        assertFalse(b);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java
----------------------------------------------------------------------
diff --git a/core/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java b/core/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java
new file mode 100644
index 0000000..c2d69c0
--- /dev/null
+++ b/core/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java
@@ -0,0 +1,209 @@
+// 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 org.apache.cloudstack.api.agent.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.cloud.agent.api.SnapshotCommand;
+import com.cloud.storage.Storage.StoragePoolType;
+import com.cloud.storage.StoragePool;
+import com.cloud.storage.StoragePoolStatus;
+
+public class SnapshotCommandTest {
+
+    public StoragePool pool = new StoragePool() {
+        public long getId() {
+            return 1L;
+        };
+
+        public String getName() {
+            return "name";
+        };
+
+        public String getUuid() {
+            return "bed9f83e-cac3-11e1-ac8a-0050568b007e";
+        };
+
+        public StoragePoolType getPoolType() {
+            return StoragePoolType.Filesystem;
+        };
+
+        public Date getCreated() {
+            Date date = null;
+            try {
+                date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
+                        .parse("01/01/1970 12:12:12");
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            return date;
+        }
+
+        public Date getUpdateTime() {
+            return new Date();
+        };
+
+        public long getDataCenterId() {
+            return 0L;
+        };
+
+        public long getCapacityBytes() {
+            return 0L;
+        };
+
+        public long getAvailableBytes() {
+            return 0L;
+        };
+
+        public Long getClusterId() {
+            return 0L;
+        };
+
+        public String getHostAddress() {
+            return "hostAddress";
+        };
+
+        public String getPath() {
+            return "path";
+        };
+
+        public String getUserInfo() {
+            return "userInfo";
+        };
+
+        public boolean isShared() {
+            return false;
+        };
+
+        public boolean isLocal() {
+            return false;
+        };
+
+        public StoragePoolStatus getStatus() {
+            return StoragePoolStatus.Up;
+        };
+
+        public int getPort() {
+            return 25;
+        };
+
+        public Long getPodId() {
+            return 0L;
+        }
+
+		@Override
+		public String getStorageProviderName() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+        @Override
+        public boolean isInMaintenance() {
+            // TODO Auto-generated method stub
+            return false;
+        };
+    };
+
+    SnapshotCommand ssc = new SnapshotCommand(pool,
+            "http://secondary.Storage.Url",
+            "420fa39c-4ef1-a83c-fd93-46dc1ff515ae", "snapshotName", 101L, 102L,
+            103L);
+
+    SnapshotCommand ssc1;
+
+
+    @Before
+    public void setUp() {
+        ssc1 = new SnapshotCommand(pool,
+                "secondaryStorageUrl", "snapshotUuid", "snapshotName", 101L,
+                102L, 103L);
+    }
+
+    @Test
+    public void testGetPrimaryStoragePoolNameLabel() {
+        String label = ssc.getPrimaryStoragePoolNameLabel();
+        assertTrue(label.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e"));
+    }
+
+    @Test
+    public void testGetSecondaryStorageUrl() {
+        String url = ssc.getSecondaryStorageUrl();
+        assertTrue(url.equals("http://secondary.Storage.Url"));
+    }
+
+    @Test
+    public void testGetSnapshotUuid() {
+        String uuid = ssc.getSnapshotUuid();
+        assertTrue(uuid.equals("420fa39c-4ef1-a83c-fd93-46dc1ff515ae"));
+    }
+
+    @Test
+    public void testGetSnapshotName() {
+        String name = ssc.getSnapshotName();
+        assertTrue(name.equals("snapshotName"));
+    }
+
+    @Test
+    public void testGetVolumePath() {
+        ssc.setVolumePath("vPath");
+        String path = ssc.getVolumePath();
+        assertTrue(path.equals("vPath"));
+
+        ssc1.setVolumePath("vPath1");
+        path = ssc1.getVolumePath();
+        assertTrue(path.equals("vPath1"));
+    }
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = ssc.executeInSequence();
+        assertFalse(b);
+
+        b = ssc1.executeInSequence();
+        assertFalse(b);
+    }
+
+    @Test
+    public void testGetDataCenterId() {
+        Long dcId = ssc.getDataCenterId();
+        Long expected = 101L;
+        assertEquals(expected, dcId);
+    }
+
+    @Test
+    public void testGetAccountId() {
+        Long aId = ssc.getAccountId();
+        Long expected = 102L;
+        assertEquals(expected, aId);
+    }
+
+    @Test
+    public void testGetVolumeId() {
+        Long vId = ssc.getVolumeId();
+        Long expected = 103L;
+        assertEquals(expected, vId);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java
----------------------------------------------------------------------
diff --git a/core/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java b/core/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java
new file mode 100644
index 0000000..02085f5
--- /dev/null
+++ b/core/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java
@@ -0,0 +1,229 @@
+// 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 src.com.cloud.agent.api.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.junit.Test;
+
+import com.cloud.agent.api.storage.ResizeVolumeCommand;
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.Storage.StoragePoolType;
+import com.cloud.storage.StoragePool;
+import com.cloud.storage.StoragePoolStatus;
+
+
+public class ResizeVolumeCommandTest {
+
+    public StoragePool dummypool = new StoragePool() {
+        @Override
+        public long getId() {
+            return 1L;
+        };
+
+        @Override
+        public String getName() {
+            return "name";
+        };
+
+        @Override
+        public String getUuid() {
+            return "bed9f83e-cac3-11e1-ac8a-0050568b007e";
+        };
+
+        @Override
+        public StoragePoolType getPoolType() {
+            return StoragePoolType.Filesystem;
+        };
+
+        @Override
+        public Date getCreated() {
+            Date date = null;
+            try {
+                date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
+                .parse("01/01/1970 12:12:12");
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            return date;
+        }
+
+        @Override
+        public Date getUpdateTime() {
+            return new Date();
+        };
+
+        @Override
+        public long getDataCenterId() {
+            return 0L;
+        };
+
+        @Override
+        public long getCapacityBytes() {
+            return 0L;
+        };
+
+        @Override
+        public long getAvailableBytes() {
+            return 0L;
+        };
+
+        @Override
+        public Long getClusterId() {
+            return 0L;
+        };
+
+        @Override
+        public String getHostAddress() {
+            return "hostAddress";
+        };
+
+        @Override
+        public String getPath() {
+            return "path";
+        };
+
+        @Override
+        public String getUserInfo() {
+            return "userInfo";
+        };
+
+        @Override
+        public boolean isShared() {
+            return false;
+        };
+
+        @Override
+        public boolean isLocal() {
+            return false;
+        };
+
+        @Override
+        public StoragePoolStatus getStatus() {
+            return StoragePoolStatus.Up;
+        };
+
+        @Override
+        public int getPort() {
+            return 25;
+        };
+
+        @Override
+        public Long getPodId() {
+            return 0L;
+        }
+
+        @Override
+        public String getStorageProviderName() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        @Override
+        public boolean isInMaintenance() {
+            // TODO Auto-generated method stub
+            return false;
+        };
+    };
+
+    Long newSize = 4194304L;
+    Long currentSize = 1048576L;
+
+    ResizeVolumeCommand rv = new ResizeVolumeCommand("dummydiskpath", 
+            new StorageFilerTO(dummypool), currentSize, newSize, false, 
+            "vmName");
+
+    @Test
+    public void testExecuteInSequence() {
+        boolean b = rv.executeInSequence();
+        assertFalse(b);
+    }
+
+    @Test
+    public void testGetPath() {
+        String path = rv.getPath();
+        assertTrue(path.equals("dummydiskpath"));
+    }
+
+    @Test
+    public void testGetPoolUuid() {
+        String poolUuid = rv.getPoolUuid();
+        assertTrue(poolUuid.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e"));
+    }
+
+    @Test
+    public void testGetPool() {
+        StorageFilerTO pool = rv.getPool();
+
+        Long id = pool.getId();
+        Long expectedL = 1L;
+        assertEquals(expectedL, id);
+
+        String uuid = pool.getUuid();
+        assertTrue(uuid.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e"));
+
+        String host = pool.getHost();
+        assertTrue(host.equals("hostAddress"));
+
+        String path = pool.getPath();
+        assertTrue(path.equals("path"));
+
+        String userInfo = pool.getUserInfo();
+        assertTrue(userInfo.equals("userInfo"));
+
+        Integer port = pool.getPort();
+        Integer expectedI = 25;
+        assertEquals(expectedI, port);
+
+        StoragePoolType type = pool.getType();
+        assertEquals(StoragePoolType.Filesystem, type);
+
+        String str = pool.toString();
+        assertTrue(str.equals("Pool[" + id.toString() + "|" + host + ":"
+                + port.toString() + "|" + path + "]"));
+    }
+
+    @Test
+    public void testGetNewSize() {
+        long newSize = rv.getNewSize();
+        assertTrue(newSize == 4194304L);
+    }
+
+    @Test
+    public void testGetCurrentSize() {
+        long currentSize = rv.getCurrentSize();
+        assertTrue(currentSize == 1048576L);
+    }
+
+    @Test
+    public void testGetShrinkOk() {
+        assertFalse(rv.getShrinkOk());
+    }
+
+    @Test
+    public void testGetInstanceName() {
+        String vmName = rv.getInstanceName();
+        assertTrue(vmName.equals("vmName"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/MidoNet_Plugin_Guide.ent
----------------------------------------------------------------------
diff --git a/docs/en-US/MidoNet_Plugin_Guide.ent b/docs/en-US/MidoNet_Plugin_Guide.ent
new file mode 100644
index 0000000..f31c407
--- /dev/null
+++ b/docs/en-US/MidoNet_Plugin_Guide.ent
@@ -0,0 +1,22 @@
+<!-- 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.
+-->
+
+<!ENTITY PRODUCT "CloudStack">
+<!ENTITY BOOKID "Technical Documentation">
+<!ENTITY YEAR "2013">
+<!ENTITY HOLDER "Apache Software Foundation">

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/MidoNet_Plugin_Guide.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/MidoNet_Plugin_Guide.xml b/docs/en-US/MidoNet_Plugin_Guide.xml
new file mode 100644
index 0000000..86182e6
--- /dev/null
+++ b/docs/en-US/MidoNet_Plugin_Guide.xml
@@ -0,0 +1,52 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+
+<!-- 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.
+-->
+
+<book>
+    <bookinfo id="midonet_plugin">
+    <title>&PRODUCT; Plugin Guide for the MidoNet Plugin</title>
+    <productname>Apache CloudStack</productname>
+    <productnumber>4.2.0</productnumber>
+    <edition>1</edition>
+    <pubsnumber></pubsnumber>
+    <abstract>
+        <para>
+            Plugin Guide for the MidoNet Plugin.
+        </para>
+    </abstract>
+    <corpauthor>
+        <inlinemediaobject>
+            <imageobject>
+                <imagedata fileref="Common_Content/images/title_logo.svg" format="SVG" />
+            </imageobject>
+        </inlinemediaobject>
+    </corpauthor>
+    <xi:include href="Common_Content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+    <xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+    </bookinfo>
+    <xi:include href="plugin-midonet-about.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+    <xi:include href="plugin-midonet-usage.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+    <xi:include href="plugin-midonet-revisions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</book>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/Release_Notes.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/Release_Notes.xml b/docs/en-US/Release_Notes.xml
index cda8d72..dca95d3 100644
--- a/docs/en-US/Release_Notes.xml
+++ b/docs/en-US/Release_Notes.xml
@@ -5113,7 +5113,7 @@ service cloudstack-agent start
         <listitem>
           <para>Start the first Management Server. Do not start any other Management Server nodes
             yet.</para>
-          <programlisting language="Bash"><prompt>#</prompt> service cloud-management start</programlisting>
+          <programlisting language="Bash"><prompt>#</prompt> service cloudstack-management start</programlisting>
           <para>Wait until the databases are upgraded. Ensure that the database upgrade is complete.
             After confirmation, start the other Management Servers one at a time by running the same
             command on each node.</para>
@@ -5126,7 +5126,7 @@ service cloudstack-agent start
         <listitem>
           <para>Start all Usage Servers (if they were running on your previous version). Perform
             this on each Usage Server host.</para>
-          <para><command># service cloud-usage start</command></para>
+          <para><command># service cloudstack-usage start</command></para>
         </listitem>
         <listitem>
           <note>
@@ -5152,7 +5152,7 @@ service cloudstack-agent start
             </listitem>
             <listitem>
               <para>Start the agent.</para>
-              <programlisting># service cloud-agent start</programlisting>
+              <programlisting># service cloudstack-agent start</programlisting>
             </listitem>
             <listitem>
               <para>Edit <filename>/etc/cloud/agent/agent.properties</filename> to change the
@@ -5742,7 +5742,7 @@ service cloudstack-agent start
         <listitem>
           <para>Start the first Management Server. Do not start any other Management Server nodes
             yet.</para>
-          <programlisting language="Bash"><prompt>#</prompt> service cloud-management start</programlisting>
+          <programlisting language="Bash"><prompt>#</prompt> service cloudstack-management start</programlisting>
           <para>Wait until the databases are upgraded. Ensure that the database upgrade is complete.
             You should see a message like "Complete! Done." After confirmation, start the other
             Management Servers one at a time by running the same command on each node.</para>
@@ -5750,7 +5750,7 @@ service cloudstack-agent start
         <listitem>
           <para>Start all Usage Servers (if they were running on your previous version). Perform
             this on each Usage Server host.</para>
-          <programlisting language="Bash"><prompt>#</prompt> service cloud-usage start</programlisting>
+          <programlisting language="Bash"><prompt>#</prompt> service cloudstack-usage start</programlisting>
         </listitem>
         <listitem>
           <para>(KVM only) Additional steps are required for each KVM host. These steps will not
@@ -5776,7 +5776,7 @@ service cloudstack-agent start
             </listitem>
             <listitem>
               <para>Start the agent.</para>
-              <programlisting># service cloud-agent start</programlisting>
+              <programlisting># service cloudstack-agent start</programlisting>
             </listitem>
             <listitem>
               <para> Copy the contents of the <filename>agent.properties</filename> file to the new

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/added-API-commands-4.2.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/added-API-commands-4.2.xml b/docs/en-US/added-API-commands-4.2.xml
index 4bec148..3abb780 100644
--- a/docs/en-US/added-API-commands-4.2.xml
+++ b/docs/en-US/added-API-commands-4.2.xml
@@ -39,5 +39,83 @@
       <para>The response parameters are: id, ipaddress, secondaryips, gateway, netmask, macaddr,
         broadcasturi, isolationuri, isdefault,</para>
     </listitem>
+    <listitem>
+      <para>deleteAlerts </para>
+      <para>Deletes the specified alerts. The request parameters are: ids (allowed to pass one or
+        more IDs separated by comma); type (string); olderthan (yyyy-mm-dd format).</para>
+      <para>The response parameters are: true, false </para>
+    </listitem>
+    <listitem>
+      <para>archiveAlerts</para>
+      <para>Archives the specified alerts. The request parameters are: ids (allowed to pass one or
+        more IDs separated by comma); type (string); olderthan (yyyy-mm-dd format).</para>
+      <para>The response parameters are: true, false </para>
+    </listitem>
+    <listitem>
+      <para>deleteEvents </para>
+      <para>Deletes the specified events. The request parameters are: ids (allowed to pass one or
+        more IDs separated by comma); type (string); olderthan (yyyy-mm-dd format).</para>
+      <para>The response parameters are: true, false</para>
+    </listitem>
+    <listitem>
+      <para>archiveEvents</para>
+      <para>Archives the specified events. The request parameters are: ids (allowed to pass one or
+        more IDs separated by comma); type (string); olderthan (yyyy-mm-dd format).</para>
+      <para>The response parameters are: true, false </para>
+    </listitem>
+    <listitem>
+      <para>createGlobalLoadBalancerRule</para>
+      <para>Creates a GSLB rule. The request parameters are name (the name of the global load
+        balancer rule); domain name ( the preferred domain name for the service); lb algorithm (the
+        algorithm used to load balance the traffic across the zones); session persistence (source IP
+        and HTTP cookie); account name; and domain Id.</para>
+    </listitem>
+    <listitem>
+      <para>assignToGlobalLoadBalancerRule</para>
+      <para>Assigns a load balancing rule or list of load balancing rules to GSLB. The request
+        parameters are: id (the UUID of global load balancer rule); loadbalancerrulelist (the list
+        load balancer rules that will be assigned to global load balancer rule. These are second
+        tier load balancing rules created with createLoadBalancerRule API. Weight is optional, the
+        default is 1).</para>
+    </listitem>
+    <listitem>
+      <para>removeFromGlobalLoadBalancerRule</para>
+      <para>Removes a load balancer rule association with global load balancer rule. The request
+        parameters are id (the UUID of global load balancer rule); loadbalancerrulelist (the list
+        load balancer rules that will be assigned to global load balancer rule).</para>
+    </listitem>
+    <listitem>
+      <para>deleteGlobalLoadBalancerRule</para>
+      <para>Deletes a global load balancer rule. The request parameters is: id (the unique ID of the
+        global load balancer rule).</para>
+    </listitem>
+    <listitem>
+      <para>listGlobalLoadBalancerRule</para>
+      <para>Lists load balancer rules.</para>
+      <para>The request parameters are: account (lists resources by account. Use with the domainid
+        parameter); domainid (lists only resources belonging to the domain specified); id (the
+        unique ID of the global load balancer rule); isrecursive (defaults to false; but if true,
+        lists all the resources from the parent specified by the domainid); keyword (lists by
+        keyword); listall (if set to false, lists only resources belonging to the command's caller;
+        if set to true, lists resources that the caller is authorized to see. Default value is
+        false); page; pagesize; projectid (lists objects by project); regionid ; tags (lists
+        resources by tags: key/value pairs). </para>
+    </listitem>
+    <listitem>
+      <para>updateGlobalLoadBalancerRule</para>
+      <para>Updates global load balancer rules.</para>
+      <para>The request parameters are: id (the unique ID of the global load balancer rule); account
+        (lists resources by account. Use with the domainid parameter); description (the description
+        of the load balancer rule); domainid (lists only resources belonging to the domain
+        specified); gslblbmethod (the load balancer algorithm that is used to distributed traffic
+        across the zones participating in global server load balancing, if not specified defaults to
+        round robin); gslbstickysessionmethodname (the session sticky method; if not specified
+        defaults to sourceip); isrecursive (defaults to false, but if true, lists all resources from
+        the parent specified by the domainid till leaves); keyword (lists by keyword); listall (if
+        set to false, list only those resources belonging to the command's caller; if set to true,
+        lists resources that the caller is authorized to see. Default value is false); page;
+        pagesize; projectid (lists objects by project); regionid; tags (lists resources by tags:
+        key/value pairs)</para>
+    </listitem>
   </itemizedlist>
 </section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/aws-ec2-configuration.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/aws-ec2-configuration.xml b/docs/en-US/aws-ec2-configuration.xml
index dd7732e..d6dd2b5 100644
--- a/docs/en-US/aws-ec2-configuration.xml
+++ b/docs/en-US/aws-ec2-configuration.xml
@@ -35,7 +35,7 @@
                   <warning><para>Be sure you have included the Amazon default service offering, m1.small. As well as any EC2 instance types that you will use.</para></warning>
         </listitem>
         <listitem><para>If you did not already do so when you set the configuration parameter in step <xref linkend="set-global-config"/>, restart the Management Server.</para>
-                  <programlisting># service cloud-management restart</programlisting>
+                  <programlisting># service cloudstack-management restart</programlisting>
         </listitem>
     </orderedlist>
     <para>The following sections provides details to perform these steps</para>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/change-database-password.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/change-database-password.xml b/docs/en-US/change-database-password.xml
index 0ab5267..b0021a4 100644
--- a/docs/en-US/change-database-password.xml
+++ b/docs/en-US/change-database-password.xml
@@ -29,8 +29,8 @@
     <listitem>
         <para>Before changing the password, you'll need to stop CloudStack's management server and the usage engine if you've deployed that component.</para>
 <screen>
-<command># service cloud-management stop</command>
-<command># service cloud-usage stop</command>
+<command># service cloudstack-management stop</command>
+<command># service cloudstack-usage stop</command>
 </screen>
     </listitem>
     <listitem>
@@ -68,7 +68,7 @@ db.usage.password=ENC(encrypted_password_from_above)
 <listitem>
     <para>After copying the new password over, you can now start CloudStack (and the usage engine, if necessary).</para>
     <screen>
-        <command># service cloud-management start</command>
+        <command># service cloudstack-management start</command>
         <command># service cloud-usage start</command>
     </screen>
 </listitem>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/changed-API-commands-4.2.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/changed-API-commands-4.2.xml b/docs/en-US/changed-API-commands-4.2.xml
index 26f10ff..2dd5a3b 100644
--- a/docs/en-US/changed-API-commands-4.2.xml
+++ b/docs/en-US/changed-API-commands-4.2.xml
@@ -30,6 +30,15 @@
       </thead>
       <tbody>
         <row>
+          <entry><para>createVlanIpRange</para></entry>
+          <entry>
+            <para>No new parameter has been added. However, the current functionality has been
+              extended to add guest IPs from a different subnet in shared networks in a Basic zone.
+              Ensure that you provide netmask and gateway if you are adding guest IPs from a
+              different subnet. </para>
+          </entry>
+        </row>
+        <row>
           <entry><para>updateResourceLimit</para></entry>
           <entry>
             <para>Added the following resource types to the <parameter>resourcetype</parameter>
@@ -113,8 +122,10 @@
                 <para>removelan (removes the specified VLAN range)</para>
               </listitem>
             </itemizedlist>
-            <note><para>The removevlan and vlan parameters can be used together. If the VLAN range that you are trying
-                to remove is in use, the operation will not succeed.</para></note>
+            <note>
+              <para>The removevlan and vlan parameters can be used together. If the VLAN range that
+                you are trying to remove is in use, the operation will not succeed.</para>
+            </note>
           </entry>
         </row>
       </tbody>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/citrix-xenserver-installation.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/citrix-xenserver-installation.xml b/docs/en-US/citrix-xenserver-installation.xml
index 2cd39a4..a5118d7 100644
--- a/docs/en-US/citrix-xenserver-installation.xml
+++ b/docs/en-US/citrix-xenserver-installation.xml
@@ -610,7 +610,7 @@ master-password=[your password]</programlisting>
           <listitem>
             <para>Restart the Management Server and Usage Server. You only need to do this once for
               all clusters.</para>
-            <programlisting># service cloud-management start
+            <programlisting># service cloudstack-management start
 # service cloud-usage start</programlisting>
           </listitem>
         </orderedlist>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/configure-usage-server.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/configure-usage-server.xml b/docs/en-US/configure-usage-server.xml
index 173f4a5..83bed07 100644
--- a/docs/en-US/configure-usage-server.xml
+++ b/docs/en-US/configure-usage-server.xml
@@ -32,8 +32,8 @@
         <listitem><para>In Actions, click the Edit icon.</para></listitem>
         <listitem><para>Type the desired value and click the Save icon.</para></listitem>
         <listitem><para>Restart the Management Server (as usual with any global configuration change) and also the Usage Server:</para>
-         <programlisting># service cloud-management restart
-# service cloud-usage restart 
+         <programlisting language="Bash"># service cloudstack-management restart
+# service cloudstack-usage restart 
 </programlisting></listitem>
     </orderedlist>
     <para>The following table shows the global configuration settings that control the behavior of the Usage Server.</para>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/creating-network-offerings.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/creating-network-offerings.xml b/docs/en-US/creating-network-offerings.xml
index 2b23ca8..260751e 100644
--- a/docs/en-US/creating-network-offerings.xml
+++ b/docs/en-US/creating-network-offerings.xml
@@ -253,7 +253,7 @@
             mode. In this mode, network resources are allocated only when the first virtual machine
             starts in the network. When conservative mode is off, the public IP can only be used for
             a single service. For example, a public IP used for a port forwarding rule cannot be
-            used for defining other services, such as SaticNAT or load balancing. When the conserve
+            used for defining other services, such as StaticNAT or load balancing. When the conserve
             mode is on, you can define more than one service on the same public IP.</para>
           <note>
             <para>If StaticNAT is enabled, irrespective of the status of the conserve mode, no port

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/database-replication.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/database-replication.xml b/docs/en-US/database-replication.xml
index 718c349..bb14457 100644
--- a/docs/en-US/database-replication.xml
+++ b/docs/en-US/database-replication.xml
@@ -121,14 +121,14 @@ mysql> start slave;
     <title>Failover</title>
     <para>This will provide for a replicated database that can be used to implement manual failover for the Management Servers. &PRODUCT; failover from one MySQL instance to another is performed by the administrator. In the event of a database failure you should:</para>
     <orderedlist>
-        <listitem><para>Stop the Management Servers (via service cloud-management stop).</para></listitem>
+        <listitem><para>Stop the Management Servers (via service cloudstack-management stop).</para></listitem>
         <listitem><para>Change the replica's configuration to be a master and restart it.</para></listitem>
         <listitem><para>Ensure that the replica's port 3306 is open to the Management Servers.</para></listitem>
-        <listitem><para>Make a change so that the Management Server uses the new database. The simplest process here is to put the IP address of the new database server into each Management Server's /etc/cloud/management/db.properties.</para></listitem>
+        <listitem><para>Make a change so that the Management Server uses the new database. The simplest process here is to put the IP address of the new database server into each Management Server's /etc/cloudstack/management/db.properties.</para></listitem>
         <listitem>
         <para>Restart the Management Servers:</para>
         <programlisting>
-# service cloud-management start
+# service cloudstack-management start
         </programlisting>
         </listitem>
     </orderedlist>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/delete-event-alerts.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/delete-event-alerts.xml b/docs/en-US/delete-event-alerts.xml
index 3eebcb7..ef39040 100644
--- a/docs/en-US/delete-event-alerts.xml
+++ b/docs/en-US/delete-event-alerts.xml
@@ -28,6 +28,18 @@
     or by using the Details page. If you want to delete multiple alerts or events at the same time,
     you can use the respective context menu. You can delete alerts or events by category for a time
     period.</para>
+  <para>In order to support the delete or archive alerts, the following global parameters have been
+    added:</para>
+  <itemizedlist>
+    <listitem>
+      <para><emphasis role="bold">alert.purge.delay</emphasis>: The alerts older than specified
+        number of days are purged. Set the value to 0 to never purge alerts automatically.</para>
+    </listitem>
+    <listitem>
+      <para><emphasis role="bold">alert.purge.interval</emphasis>: The interval in seconds to wait
+        before running the alert purge thread. The default is 86400 seconds (one day).</para>
+    </listitem>
+  </itemizedlist>
   <note>
     <para>Archived alerts or events cannot be viewed in the UI, or by using the API. They are
       maintained in the database for auditing or compliance purposes.</para>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/elastic-ip.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/elastic-ip.xml b/docs/en-US/elastic-ip.xml
index b09d37d..8ecbd75 100644
--- a/docs/en-US/elastic-ip.xml
+++ b/docs/en-US/elastic-ip.xml
@@ -21,16 +21,31 @@
 <section id="elastic-ip">
   <title>About Elastic IP</title>
   <para>Elastic IP (EIP) addresses are the IP addresses that are associated with an account, and act
-    as static IP addresses. The account owner has complete control over the Elastic IP addresses
-    that belong to the account. You can allocate an Elastic IP to a VM of your choice from the EIP
-    pool of your account. Later if required you can reassign the IP address to a different VM. This
-    feature is extremely helpful during VM failure. Instead of replacing the VM which is down, the
-    IP address can be reassigned to a new VM in your account. Elastic IP service provides Static NAT
-    (1:1) service in an EIP-enabled basic zone. The default network offering,
+    as static IP addresses. The account owner has the complete control over the Elastic IP addresses
+    that belong to the account. As an account owner, you can allocate an Elastic IP to a VM of your
+    choice from the EIP pool of your account. Later if required you can reassign the IP address to a
+    different VM. This feature is extremely helpful during VM failure. Instead of replacing the VM
+    which is down, the IP address can be reassigned to a new VM in your account. </para>
+  <para>Similar to the public IP address, Elastic IP addresses are mapped to their associated
+    private IP addresses by using StaticNAT. The EIP service is equipped with StaticNAT (1:1)
+    service in an EIP-enabled basic zone. The default network offering,
     DefaultSharedNetscalerEIPandELBNetworkOffering, provides your network with EIP and ELB network
-    services if a NetScaler device is deployed in your zone. Similar to the public IP address,
-    Elastic IP addresses are also mapped to their associated private IP addresses by using Stactic
-    NAT.</para>
+    services if a NetScaler device is deployed in your zone. Consider the following illustration for
+    more details.</para>
+  <mediaobject>
+    <imageobject>
+      <imagedata fileref="./images/eip-ns-basiczone.png"/>
+    </imageobject>
+    <textobject>
+      <phrase>eip-ns-basiczone.png: Elastic IP in a NetScaler-enabled Basic Zone.</phrase>
+    </textobject>
+  </mediaobject>
+  <para>In the illustration, a NetScaler appliance is the default entry or exit point for the
+    &PRODUCT; instances, and firewall is the default entry or exit point for the rest of the data
+    center. Netscaler provides LB services and staticNAT service to the guest networks. The guest
+    traffic in the pods and the Management Server are on different subnets / VLANs. The policy-based
+    routing in the data center core switch sends the public traffic through the NetScaler, whereas
+    the rest of the data center goes through the firewall. </para>
   <para>The EIP work flow is as follows:</para>
   <itemizedlist>
     <listitem>
@@ -48,7 +63,6 @@
           supported by NetScaler, in which the source IP address is replaced in the packets
           generated by a VM in the private network with the public IP address.</para>
       </note>
-      <para/>
     </listitem>
     <listitem>
       <para>This default public IP will be released in two cases:</para>
@@ -68,12 +82,12 @@
       </itemizedlist>
     </listitem>
   </itemizedlist>
-  <para>However, for the deployments where public IPs are limited resources, you have the
-    flexibility to choose not to allocate a public IP by default. You can use the Associate Public
-    IP option to turn on or off the automatic public IP assignment in the EIP-enabled Basic zones.
-    If you turn off the automatic public IP assignment while creating a network offering, only a
-    private IP is assigned to a VM when the VM is deployed with that network offering. Later, the
-    user can acquire an IP for the VM and enable static NAT.</para>
+  <para>For the deployments where public IPs are limited resources, you have the flexibility to
+    choose not to allocate a public IP by default. You can use the Associate Public IP option to
+    turn on or off the automatic public IP assignment in the EIP-enabled Basic zones. If you turn
+    off the automatic public IP assignment while creating a network offering, only a private IP is
+    assigned to a VM when the VM is deployed with that network offering. Later, the user can acquire
+    an IP for the VM and enable static NAT.</para>
   <para condition="admin">For more information on the Associate Public IP option, see <xref
       linkend="creating-network-offerings"/>.</para>
   <para condition="install">For more information on the Associate Public IP option, see the
@@ -83,7 +97,6 @@
       continue to get both public IP and private by default, irrespective of the network offering
       configuration.</para>
   </note>
-  <para/>
   <para>New deployments which use the default shared network offering with EIP and ELB services to
     create a shared network in the Basic zone will continue allocating public IPs to each user
     VM.</para>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/events.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/events.xml b/docs/en-US/events.xml
index 4a14458..3b93ee0 100644
--- a/docs/en-US/events.xml
+++ b/docs/en-US/events.xml
@@ -25,7 +25,7 @@
     physical resources associated with a cloud environment. Events are used by monitoring systems,
     usage and billing systems, or any other event-driven workflow systems to discern a pattern and
     make the right business decision. In &PRODUCT; an event could be a state change of virtual or
-    psychical resources, an action performed by an user (action events), or policy based events
+    physical resources, an action performed by an user (action events), or policy based events
     (alerts).</para>
   <xi:include href="events-log.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
   <xi:include href="event-framework.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/external-firewalls-and-load-balancers.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/external-firewalls-and-load-balancers.xml b/docs/en-US/external-firewalls-and-load-balancers.xml
index b947daf..42ecacf 100644
--- a/docs/en-US/external-firewalls-and-load-balancers.xml
+++ b/docs/en-US/external-firewalls-and-load-balancers.xml
@@ -29,5 +29,6 @@
     xmlns:xi="http://www.w3.org/2001/XInclude"/>
   <xi:include href="ongoing-config-of-external-firewalls-lb.xml"
     xmlns:xi="http://www.w3.org/2001/XInclude"/>
+  <xi:include href="load-balancer-rules.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
   <xi:include href="autoscale.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 </section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/gslb.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/gslb.xml b/docs/en-US/gslb.xml
new file mode 100644
index 0000000..2303331
--- /dev/null
+++ b/docs/en-US/gslb.xml
@@ -0,0 +1,499 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+]>
+
+<!-- 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.
+-->
+<section id="gslb">
+  <title>Global Server Load Balancing Support</title>
+  <para>&PRODUCT; supports Global Server Load Balancing (GSLB) functionalities to provide business
+    continuity, and enable seamless resource movement within a &PRODUCT; environment. &PRODUCT;
+    achieve this by extending its functionality of integrating with NetScaler Application Delivery
+    Controller (ADC), which also provides various GSLB capabilities, such as disaster recovery and
+    load balancing. The DNS redirection technique is used to achieve GSLB in &PRODUCT;. </para>
+  <para>In order to support this functionality, region level services and service provider are
+    introduced. A new service 'GSLB' is introduced as a region level service. The GSLB service
+    provider is introduced that will provider the GSLB service. Currently, NetScaler is the
+    supported GSLB provider in &PRODUCT;. GSLB functionality works in an Active-Active data center
+    environment. </para>
+  <section id="about-gslb">
+    <title>About Global Server Load Balancing</title>
+    <para>Global Server Load Balancing (GSLB) is an extension of load balancing functionality, which
+      is highly efficient in avoiding downtime. Based on the nature of deployment, GSLB represents a
+      set of technologies that is used for various purposes, such as load sharing, disaster
+      recovery, performance, and legal obligations. With GSLB, workloads can be distributed across
+      multiple data centers situated at geographically separated locations. GSLB can also provide an
+      alternate location for accessing a resource in the event of a failure, or to provide a means
+      of shifting traffic easily to simplify maintenance, or both.</para>
+    <section id="gslb-comp">
+      <title>Components of GSLB</title>
+      <para>A typical GSLB environment is comprised of the following components:</para>
+      <itemizedlist>
+        <listitem>
+          <para><emphasis role="bold">GSLB Site</emphasis>: In &PRODUCT;terminology, GSLB sites are
+            represented by zones that are mapped to data centers, each of which has various network
+            appliances. Each GSLB site is managed by a NetScaler appliance that is local to that
+            site. Each of these appliances treats its own site as the local site and all other
+            sites, managed by other appliances, as remote sites. It is the central entity in a GSLB
+            deployment, and is represented by a name and an IP address.</para>
+        </listitem>
+        <listitem>
+          <para><emphasis role="bold">GSLB Services</emphasis>: A GSLB service is typically
+            represented by a load balancing or content switching virtual server. In a GSLB
+            environment, you can have a local as well as remote GSLB services. A local GSLB service
+            represents a local load balancing or content switching virtual server. A remote GSLB
+            service is the one configured at one of the other sites in the GSLB setup. At each site
+            in the GSLB setup, you can create one local GSLB service and any number of remote GSLB
+            services.</para>
+        </listitem>
+        <listitem>
+          <para><emphasis role="bold">GSLB Virtual Servers</emphasis>: A GSLB virtual server refers
+            to one or more GSLB services and balances traffic between traffic across the VMs in
+            multiple zones by using the &PRODUCT; functionality. It evaluates the configured GSLB
+            methods or algorithms to select a GSLB service to which to send the client requests. One
+            or more virtual servers from different zones are bound to the GSLB virtual server. GSLB
+            virtual server does not have a public IP associated with it, instead it will have a FQDN
+            DNS name.</para>
+        </listitem>
+        <listitem>
+          <para><emphasis role="bold">Load Balancing or Content Switching Virtual
+            Servers</emphasis>: According to Citrix NetScaler terminology, a load balancing or
+            content switching virtual server represents one or many servers on the local network.
+            Clients send their requests to the load balancing or content switching virtual server’s
+            virtual IP (VIP) address, and the virtual server balances the load across the local
+            servers. After a GSLB virtual server selects a GSLB service representing either a local
+            or a remote load balancing or content switching virtual server, the client sends the
+            request to that virtual server’s VIP address.</para>
+        </listitem>
+        <listitem>
+          <para><emphasis role="bold">DNS VIPs</emphasis>: DNS virtual IP represents a load
+            balancing DNS virtual server on the GSLB service provider. The DNS requests for domains
+            for which the GSLB service provider is authoritative can be sent to a DNS VIP.</para>
+        </listitem>
+        <listitem>
+          <para><emphasis role="bold">Authoritative DNS</emphasis>: ADNS (Authoritative Domain Name
+            Server) is a service that provides actual answer to DNS queries, such as web site IP
+            address. In a GSLB environment, an ADNS service responds only to DNS requests for
+            domains for which the GSLB service provider is authoritative. When an ADNS service is
+            configured, the service provider owns that IP address and advertises it. When you create
+            an ADNS service, the NetScaler responds to DNS queries on the configured ADNS service IP
+            and port.</para>
+        </listitem>
+      </itemizedlist>
+    </section>
+    <section id="concept-gslb">
+      <title>How Does GSLB Works in &PRODUCT;?</title>
+      <para>Global server load balancing is used to manage the traffic flow to a web site hosted on
+        two separate zones that ideally are in different geographic locations. The following is an
+        illustration of how GLSB functionality is provided in &PRODUCT;: An organization, xyztelco,
+        has set up a public cloud that spans two zones, Zone-1 and Zone-2, across geographically
+        separated data centers that are managed by &PRODUCT;. Tenant-A of the cloud launches a
+        highly available solution by using xyztelco cloud. For that purpose, they launch two
+        instances each in both the zones: VM1 and VM2 in Zone-1 and VM5 and VM6 in Zone-2. Tenant-A
+        acquires a public IP, IP-1 in Zone-1, and configures a load balancer rule to load balance
+        the traffic between VM1 and VM2 instances. &PRODUCT; orchestrates setting up a virtual
+        server on the LB service provider in Zone-1. Virtual server 1 that is set up on the LB
+        service provider in Zone-1 represents a publicly accessible virtual server that client
+        reaches at IP-1. The client traffic to virtual server 1 at IP-1 will be load balanced across
+        VM1 and VM2 instances. </para>
+      <para>Tenant-A acquires another public IP, IP-2 in Zone-2 and sets up a load balancer rule to
+        load balance the traffic between VM5 and VM6 instances. Similarly in Zone-2, &PRODUCT;
+        orchestrates setting up a virtual server on the LB service provider. Virtual server 2 that
+        is setup on the LB service provider in Zone-2 represents a publicly accessible virtual
+        server that client reaches at IP-2. The client traffic that reaches virtual server 2 at IP-2
+        is load balanced across VM5 and VM6 instances. At this point Tenant-A has the service
+        enabled in both the zones, but has no means to set up a disaster recovery plan if one of the
+        zone fails. Additionally, there is no way for Tenant-A to load balance the traffic
+        intelligently to one of the zones based on load, proximity and so on. The cloud
+        administrator of xyztelco provisions a GSLB service provider to both the zones. A GSLB
+        provider is typically an ADC that has the ability to act as an ADNS (Authoritative Domain
+        Name Server) and has the mechanism to monitor health of virtual servers both at local and
+        remote sites. The cloud admin enables GSLB as a service to the tenants that use zones 1 and
+        2. </para>
+      <mediaobject>
+        <imageobject>
+          <imagedata fileref="./images/gslb.png"/>
+        </imageobject>
+        <textobject>
+          <phrase>gslb.png: GSLB architecture</phrase>
+        </textobject>
+      </mediaobject>
+      <para>Tenant-A wishes to leverage the GSLB service provided by the xyztelco cloud. Tenant-A
+        configures a GSLB rule to load balance traffic across virtual server 1 at Zone-1 and virtual
+        server 2 at Zone-2. The domain name is provided as A.xyztelco.com. &PRODUCT; orchestrates
+        setting up GSLB virtual server 1 on the GSLB service provider at Zone-1. &PRODUCT; binds
+        virtual server 1 of Zone-1 and virtual server 2 of Zone-2 to GLSB virtual server 1. GSLB
+        virtual server 1 is configured to start monitoring the health of virtual server 1 and 2 in
+        Zone-1. &PRODUCT; will also orchestrate setting up GSLB virtual server 2 on GSLB service
+        provider at Zone-2. &PRODUCT; will bind virtual server 1 of Zone-1 and virtual server 2 of
+        Zone-2 to GLSB virtual server 2. GSLB virtual server 2 is configured to start monitoring the
+        health of virtual server 1 and 2. &PRODUCT; will bind the domain A.xyztelco.com to both the
+        GSLB virtual server 1 and 2. At this point, Tenant-A service will be globally reachable at
+        A.xyztelco.com. The private DNS server for the domain xyztelcom.com is configured by the
+        admin out-of-band to resolve the domain A.xyztelco.com to the GSLB providers at both the
+        zones, which are configured as ADNS for the domain A.xyztelco.com. A client when sends a DNS
+        request to resolve A.xyztelcom.com, will eventually get DNS delegation to the address of
+        GSLB providers at zone 1 and 2. A client DNS request will be received by the GSLB provider.
+        The GSLB provider, depending on the domain for which it needs to resolve, will pick up the
+        GSLB virtual server associated with the domain. Depending on the health of the virtual
+        servers being load balanced, DNS request for the domain will be resolved to the public IP
+        associated with the selected virtual server.</para>
+    </section>
+  </section>
+  <section id="gslb-workflow">
+    <title>Configuring GSLB</title>
+    <para>A GSLB deployment is the logical collection of GSLB virtual server, GSLB service, LB
+      virtual server, service, domain, and ADNS service. To create a GSLB site, you must configure
+      load balancing in the zone. You must create GSLB vservers and GSLB services for each site. You
+      must bind GSLB services to GSLB vservers. You must then create an ADNS service that provides
+      the IP address of the best performing site to the client's request. A GSLB vserver is an
+      entity that performs load balancing for the domains bound to it by returning the IP address of
+      the best GSLB service. A GSLB service is a representation of the load balancing/content
+      switching vserver. An LB vserver load balances incoming traffic by identifying the best
+      server, then directs traffic to the corresponding service. It can also load-balance external
+      DNS name servers. Services are entities that represent the servers. The domain is the domain
+      name for which the system is the authoritative DNS server. By creating an ADNS service, the
+      system can be configured as an authoritative DNS server.</para>
+    <para>To configure GSLB in your cloud environment, as a cloud administrator you must perform the
+      following.</para>
+    <para>To configure such a GSLB setup, you must first configure a standard load balancing setup
+      for each zone. This enables you to balance load across the different servers in each zone in
+      the region. Then, configure both NetScaler appliances that you plan to add to each zone as
+      authoritative DNS (ADNS) servers. Next, create a GSLB site for each zone, configure GSLB
+      virtual servers for each site, create GLSB services, and bind the GSLB services to the GSLB
+      virtual servers. Finally, bind the domain to the GSLB virtual servers. The GSLB configurations
+      on the two appliances at the two different sites are identical, although each sites
+      load-balancing configuration is specific to that site.</para>
+    <para>Perform the following as a cloud administrator. As per the above example, the
+      administrator of xyztelco is the one who sets up GSLB:</para>
+    <orderedlist>
+      <listitem>
+        <para>In the cloud.dns.name global parameter, specify the DNS name of your tenant's cloud
+          that make use of the GSLB service.</para>
+      </listitem>
+      <listitem>
+        <para>On the NetScaler side, configure GSLB as given in <ulink
+            url="http://support.citrix.com/proddocs/topic/netscaler-traffic-management-10-map/ns-gslb-config-con.html"
+            >Configuring Global Server Load Balancing (GSLB)</ulink>:</para>
+        <orderedlist>
+          <listitem>
+            <para>Configuring a standard load balancing setup.</para>
+          </listitem>
+          <listitem>
+            <para>Configure Authoritative DNS, as explained in <ulink
+                url="http://support.citrix.com/proddocs/topic/netscaler-traffic-management-10-map/ns-gslb-config-adns-svc-tsk.html"
+                >Configuring an Authoritative DNS Service</ulink>.</para>
+          </listitem>
+          <listitem>
+            <para>Configure a GSLB site with site name formed from the domain name details.</para>
+            <para>For more information, see <ulink
+                url="http://support.citrix.com/proddocs/topic/netscaler-traffic-management-10-map/ns-gslb-config-basic-site-tsk.html"
+                >Configuring a Basic GSLB Site</ulink>.</para>
+          </listitem>
+          <listitem>
+            <para>Configure a GSLB virtual server.</para>
+            <para>For more information, see <ulink
+                url="http://support.citrix.com/proddocs/topic/netscaler-traffic-management-10-map/ns-gslb-config-vsvr-tsk.html"
+                >Configuring a GSLB Virtual Server</ulink>.</para>
+          </listitem>
+          <listitem>
+            <para>Configure a GSLB service for each virtual server.</para>
+            <para>For more information, see <ulink
+                url="http://support.citrix.com/proddocs/topic/netscaler-traffic-management-10-map/ns-gslb-config-svc-tsk.html"
+                >Configuring a GSLB Service</ulink>.</para>
+          </listitem>
+          <listitem>
+            <para>Bind the GSLB services to the GSLB virtual server.</para>
+            <para>For more information, see <ulink
+                url="http://support.citrix.com/proddocs/topic/netscaler-traffic-management-10-map/ns-gslb-bind-svc-vsvr-tsk.html"
+                >Binding GSLB Services to a GSLB Virtual Server</ulink>.</para>
+          </listitem>
+          <listitem>
+            <para>Bind domain name to GSLB virtual server. Domain name is obtained from the domain
+              details.</para>
+            <para>For more information, see <ulink
+                url="http://support.citrix.com/proddocs/topic/netscaler-traffic-management-10-map/ns-gslb-bind-dom-vsvr-tsk.html"
+                >Binding a Domain to a GSLB Virtual Server</ulink>.</para>
+          </listitem>
+        </orderedlist>
+      </listitem>
+      <listitem>
+        <para>In each zone that are participating in GSLB, add GSLB-enabled NetScaler device.</para>
+        <para>For more information, see <xref linkend="enable-glsb-ns"/>.</para>
+      </listitem>
+    </orderedlist>
+    <para>As a domain administrator/ user perform the following:</para>
+    <orderedlist>
+      <listitem>
+        <para>Add a GSLB rule on both the sites.</para>
+        <para>See <xref linkend="gslb-add"/>.</para>
+      </listitem>
+      <listitem>
+        <para>Assign load balancer rules.</para>
+        <para>See <xref linkend="assign-lb-gslb"/>.</para>
+      </listitem>
+    </orderedlist>
+    <section id="prereq-gslb">
+      <title>Prerequisites and Guidelines</title>
+      <itemizedlist>
+        <listitem>
+          <para>The GSLB functionality is supported both Basic and Advanced zones.</para>
+        </listitem>
+        <listitem>
+          <para>GSLB is added as a new network service.</para>
+        </listitem>
+        <listitem>
+          <para>GSLB service provider can be added to a physical network in a zone.</para>
+        </listitem>
+        <listitem>
+          <para>The admin is allowed to enable or disable GSLB functionality at region level.</para>
+        </listitem>
+        <listitem>
+          <para>The admin is allowed to configure a zone as GSLB capable or enabled. </para>
+          <para>A zone shall be considered as GSLB capable only if a GSLB service provider is
+            provisioned in the zone.</para>
+        </listitem>
+        <listitem>
+          <para>When users have VMs deployed in multiple availability zones which are GSLB enabled,
+            they can use the GSLB functionality to load balance traffic across the VMs in multiple
+            zones.</para>
+        </listitem>
+        <listitem>
+          <para>The users can use GSLB to load balance across the VMs across zones in a region only
+            if the admin has enabled GSLB in that region. </para>
+        </listitem>
+        <listitem>
+          <para>The users can load balance traffic across the availability zones in the same region
+            or different regions.</para>
+        </listitem>
+        <listitem>
+          <para>The admin can configure DNS name for the entire cloud.</para>
+        </listitem>
+        <listitem>
+          <para>The users can specify an unique name across the cloud for a globally load balanced
+            service. The provided name is used as the domain name under the DNS name associated with
+            the cloud.</para>
+          <para>The user-provided name along with the admin-provided DNS name is used to produce a
+            globally resolvable FQDN for the globally load balanced service of the user. For
+            example, if the admin has configured xyztelco.com as the DNS name for the cloud, and
+            user specifies 'foo' for the GSLB virtual service, then the FQDN name of the GSLB
+            virtual service is foo.xyztelco.com.</para>
+        </listitem>
+        <listitem>
+          <para>While setting up GSLB, users can select a load balancing method, such as round
+            robin, for using across the zones that are part of GSLB.</para>
+        </listitem>
+        <listitem>
+          <para>The user shall be able to set weight to zone-level virtual server. Weight shall be
+            considered by the load balancing method for distributing the traffic.</para>
+        </listitem>
+        <listitem>
+          <para>The GSLB functionality shall support session persistence, where series of client
+            requests for particular domain name is sent to a virtual server on the same zone. </para>
+          <para>Statistics is collected from each GSLB virtual server.</para>
+        </listitem>
+      </itemizedlist>
+    </section>
+    <section id="enable-glsb-ns">
+      <title>Enabling GSLB in NetScaler</title>
+      <para>In each zone, add GSLB-enabled NetScaler device for load balancing.</para>
+      <orderedlist>
+        <listitem>
+          <para>Log in as administrator to the &PRODUCT; UI.</para>
+        </listitem>
+        <listitem>
+          <para>In the left navigation bar, click Infrastructure.</para>
+        </listitem>
+        <listitem>
+          <para>In Zones, click View More.</para>
+        </listitem>
+        <listitem>
+          <para>Choose the zone you want to work with.</para>
+        </listitem>
+        <listitem>
+          <para>Click the Physical Network tab, then click the name of the physical network. </para>
+        </listitem>
+        <listitem>
+          <para>In the Network Service Providers node of the diagram, click Configure. </para>
+          <para>You might have to scroll down to see this.</para>
+        </listitem>
+        <listitem>
+          <para>Click NetScaler.</para>
+        </listitem>
+        <listitem>
+          <para>Click Add NetScaler device and provide the following:</para>
+          <para>For NetScaler:</para>
+          <itemizedlist>
+            <listitem>
+              <para><emphasis role="bold">IP Address</emphasis>: The IP address of the SRX.</para>
+            </listitem>
+            <listitem>
+              <para><emphasis role="bold">Username/Password</emphasis>: The authentication
+                credentials to access the device. &PRODUCT; uses these credentials to access the
+                device.</para>
+            </listitem>
+            <listitem>
+              <para><emphasis role="bold">Type</emphasis>: The type of device that is being added.
+                It could be F5 Big Ip Load Balancer, NetScaler VPX, NetScaler MPX, or NetScaler SDX.
+                For a comparison of the NetScaler types, see the &PRODUCT; Administration
+                Guide.</para>
+            </listitem>
+            <listitem>
+              <para><emphasis role="bold">Public interface</emphasis>: Interface of device that is
+                configured to be part of the public network.</para>
+            </listitem>
+            <listitem>
+              <para><emphasis role="bold">Private interface</emphasis>: Interface of device that is
+                configured to be part of the private network.</para>
+            </listitem>
+            <listitem>
+              <para><emphasis role="bold">GSLB service</emphasis>: Select this option.</para>
+            </listitem>
+            <listitem>
+              <para><emphasis role="bold">GSLB service Public IP</emphasis>: The public IP address
+                of the NAT translator for a GSLB service that is on a private network.</para>
+            </listitem>
+            <listitem>
+              <para><emphasis role="bold">GSLB service Private IP</emphasis>: The private IP of the
+                GSLB service.</para>
+            </listitem>
+            <listitem>
+              <para><emphasis role="bold">Number of Retries</emphasis>. Number of times to attempt a
+                command on the device before considering the operation failed. Default is 2.</para>
+            </listitem>
+            <listitem>
+              <para><emphasis role="bold">Capacity</emphasis>: The number of networks the device can
+                handle.</para>
+            </listitem>
+            <listitem>
+              <para><emphasis role="bold">Dedicated</emphasis>: When marked as dedicated, this
+                device will be dedicated to a single account. When Dedicated is checked, the value
+                in the Capacity field has no significance implicitly, its value is 1.</para>
+            </listitem>
+          </itemizedlist>
+        </listitem>
+        <listitem>
+          <para>Click OK.</para>
+        </listitem>
+      </orderedlist>
+    </section>
+    <section id="gslb-add">
+      <title>Adding a GSLB Rule</title>
+      <orderedlist>
+        <listitem>
+          <para>Log in to the &PRODUCT; UI as a domain administrator or user.</para>
+        </listitem>
+        <listitem>
+          <para>In the left navigation pane, click Region.</para>
+        </listitem>
+        <listitem>
+          <para>Select the region for which you want to create a GSLB rule.</para>
+        </listitem>
+        <listitem>
+          <para>In the Details tab, click View GSLB.</para>
+        </listitem>
+        <listitem>
+          <para>Click Add GSLB.</para>
+          <para>The Add GSLB page is displayed as follows:</para>
+          <mediaobject>
+            <imageobject>
+              <imagedata fileref="./images/add-gslb.png"/>
+            </imageobject>
+            <textobject>
+              <phrase>gslb-add.png: adding a gslb rule</phrase>
+            </textobject>
+          </mediaobject>
+        </listitem>
+        <listitem>
+          <para>Specify the following:</para>
+          <itemizedlist>
+            <listitem>
+              <para><emphasis role="bold">Name</emphasis>: Name for the GSLB rule.</para>
+            </listitem>
+            <listitem>
+              <para><emphasis role="bold">Description</emphasis>: (Optional) A short description of
+                the GSLB rule that can be displayed to users.</para>
+            </listitem>
+            <listitem>
+              <para><emphasis role="bold">GSLB Domain Name</emphasis>: A preferred domain name for
+                the service.</para>
+            </listitem>
+            <listitem>
+              <para><emphasis role="bold">Algorithm</emphasis>: (Optional) The algorithm to use to
+                load balance the traffic across the zones. The options are Round Robin, Least
+                Connection, and Proximity.</para>
+            </listitem>
+            <listitem>
+              <para><emphasis role="bold">Service Type</emphasis>: The transport protocol to use for
+                GSLB. The options are TCP and UDP.</para>
+            </listitem>
+            <listitem>
+              <para><emphasis role="bold">Domain</emphasis>: (Optional) The domain for which you
+                want to create the GSLB rule.</para>
+            </listitem>
+            <listitem>
+              <para><emphasis role="bold">Account</emphasis>: (Optional) The account on which you
+                want to apply the GSLB rule.</para>
+            </listitem>
+          </itemizedlist>
+        </listitem>
+        <listitem>
+          <para>Click OK to confirm.</para>
+        </listitem>
+      </orderedlist>
+    </section>
+    <section id="assign-lb-gslb">
+      <title>Assigning Load Balancing Rules to GSLB</title>
+      <para/>
+      <orderedlist>
+        <listitem>
+          <para>Log in to the &PRODUCT; UI as a domain administrator or user.</para>
+        </listitem>
+        <listitem>
+          <para>In the left navigation pane, click Region.</para>
+        </listitem>
+        <listitem>
+          <para>Select the region for which you want to create a GSLB rule.</para>
+        </listitem>
+        <listitem>
+          <para>In the Details tab, click View GSLB.</para>
+        </listitem>
+        <listitem>
+          <para>Select the desired GSLB.</para>
+        </listitem>
+        <listitem>
+          <para>Click view assigned load balancing.</para>
+        </listitem>
+        <listitem>
+          <para>Click assign more load balancing.</para>
+        </listitem>
+        <listitem>
+          <para>Select the load balancing rule you have created for the zone.</para>
+        </listitem>
+        <listitem>
+          <para>Click OK to confirm.</para>
+        </listitem>
+      </orderedlist>
+    </section>
+  </section>
+  <section id="limitation-gslb">
+    <title>Known Limitation</title>
+    <para>Currently, &PRODUCT; does not support orchestration of services across the zones. The
+      notion of services and service providers in region are to be introduced.</para>
+  </section>
+</section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/guest-ip-ranges.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/guest-ip-ranges.xml b/docs/en-US/guest-ip-ranges.xml
index 1f8c8a1..b3ebd76 100644
--- a/docs/en-US/guest-ip-ranges.xml
+++ b/docs/en-US/guest-ip-ranges.xml
@@ -21,8 +21,12 @@
  specific language governing permissions and limitations
  under the License.
 -->
-
 <section id="guest-ip-ranges">
-    <title>Guest IP Ranges</title>
-    <para>The IP ranges for guest network traffic are set on a per-account basis by the user.  This allows the users to configure their network in a fashion that will enable VPN linking between their guest network and their clients.</para>
+  <title>Guest IP Ranges</title>
+  <para>The IP ranges for guest network traffic are set on a per-account basis by the user. This
+    allows the users to configure their network in a fashion that will enable VPN linking between
+    their guest network and their clients.</para>
+  <para>In shared networks in Basic zone and Security Group-enabled Advanced networks, you will have
+    the flexibility to add multiple guest IP ranges from different subnets. You can add or remove
+    one IP range at a time.</para>
 </section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/hypervisor-host-install-agent.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/hypervisor-host-install-agent.xml b/docs/en-US/hypervisor-host-install-agent.xml
index e5bfa37..41b6719 100644
--- a/docs/en-US/hypervisor-host-install-agent.xml
+++ b/docs/en-US/hypervisor-host-install-agent.xml
@@ -27,8 +27,8 @@
     <para>To manage KVM instances on the host &PRODUCT; uses a Agent. This Agent communicates with the Management server and controls all the instances on the host.</para>
     <para>First we start by installing the agent:</para>
     <para>In RHEL or CentOS:</para>
-    <programlisting language="Bash"><command>$ yum install cloud-agent</command></programlisting>
+    <programlisting language="Bash"><command>$ yum install cloudstack-agent</command></programlisting>
     <para>In Ubuntu:</para>
-    <programlisting language="Bash"><command>$ apt-get install cloud-agent</command></programlisting>
+    <programlisting language="Bash"><command>$ apt-get install cloudstack-agent</command></programlisting>
     <para>The host is now ready to be added to a cluster. This is covered in a later section, see <xref linkend="host-add" />. It is recommended that you continue to read the documentation before adding the host!</para>
-</section>
\ No newline at end of file
+</section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/hypervisor-host-install-libvirt.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/hypervisor-host-install-libvirt.xml b/docs/en-US/hypervisor-host-install-libvirt.xml
index f3ff090..d3d6b9b 100644
--- a/docs/en-US/hypervisor-host-install-libvirt.xml
+++ b/docs/en-US/hypervisor-host-install-libvirt.xml
@@ -24,7 +24,7 @@
 
 <section id="hypervisor-host-install-libvirt">
     <title>Install and Configure libvirt</title>
-    <para>&PRODUCT; uses libvirt for managing virtual machines. Therefore it is vital that libvirt is configured correctly. Libvirt is a dependency of cloud-agent and should already be installed.</para>
+    <para>&PRODUCT; uses libvirt for managing virtual machines. Therefore it is vital that libvirt is configured correctly. Libvirt is a dependency of cloudstack-agent and should already be installed.</para>
     <orderedlist>
         <listitem>
             <para>In order to have live migration working libvirt has to listen for unsecured TCP connections. We also need to turn off libvirts attempt to use Multicast DNS advertising. Both of these settings are in <filename>/etc/libvirt/libvirtd.conf</filename></para>


[20/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/images/add-gslb.png
----------------------------------------------------------------------
diff --git a/docs/en-US/images/add-gslb.png b/docs/en-US/images/add-gslb.png
new file mode 100644
index 0000000..827a913
Binary files /dev/null and b/docs/en-US/images/add-gslb.png differ

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/images/eip-ns-basiczone.png
----------------------------------------------------------------------
diff --git a/docs/en-US/images/eip-ns-basiczone.png b/docs/en-US/images/eip-ns-basiczone.png
new file mode 100644
index 0000000..bc88570
Binary files /dev/null and b/docs/en-US/images/eip-ns-basiczone.png differ

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/images/gslb.png
----------------------------------------------------------------------
diff --git a/docs/en-US/images/gslb.png b/docs/en-US/images/gslb.png
new file mode 100644
index 0000000..9f13580
Binary files /dev/null and b/docs/en-US/images/gslb.png differ

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/increase-management-server-max-memory.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/increase-management-server-max-memory.xml b/docs/en-US/increase-management-server-max-memory.xml
index 16d18e7..51c8724 100644
--- a/docs/en-US/increase-management-server-max-memory.xml
+++ b/docs/en-US/increase-management-server-max-memory.xml
@@ -28,7 +28,7 @@
     <orderedlist>
         <listitem><para>Edit the Tomcat configuration file:</para><programlisting>/etc/cloud/management/tomcat6.conf</programlisting></listitem>
         <listitem><para>Change the command-line parameter -XmxNNNm to a higher value of N.</para><para>For example, if the current value is -Xmx128m, change it to -Xmx1024m or higher.</para></listitem>
-        <listitem><para>To put the new setting into effect, restart the Management Server.</para><programlisting># service cloud-management restart</programlisting></listitem>
+        <listitem><para>To put the new setting into effect, restart the Management Server.</para><programlisting># service cloudstack-management restart</programlisting></listitem>
       </orderedlist>
     <para>For more information about memory issues, see "FAQ: Memory" at <ulink url="http://wiki.apache.org/tomcat/FAQ/Memory">Tomcat Wiki.</ulink></para>
 </section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/install-usage-server.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/install-usage-server.xml b/docs/en-US/install-usage-server.xml
index 9dde552..ffd748d 100644
--- a/docs/en-US/install-usage-server.xml
+++ b/docs/en-US/install-usage-server.xml
@@ -52,7 +52,7 @@
         <listitem>
         <para>Once installed, start the Usage Server with the following command.</para>
         <programlisting>
-# service cloud-usage start
+# service cloudstack-usage start
         </programlisting>
         </listitem>
     </orderedlist>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/libcloud-examples.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/libcloud-examples.xml b/docs/en-US/libcloud-examples.xml
new file mode 100644
index 0000000..d2db526
--- /dev/null
+++ b/docs/en-US/libcloud-examples.xml
@@ -0,0 +1,75 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+]>
+
+<!-- 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.
+-->
+
+<section id="libcloud-examples">
+    <title>Apache Libcloud</title>
+    <para>There are many tools available to interface with the &PRODUCT; API. Apache Libcloud is one of those. In this section
+          we provide a basic example of how to use Libcloud with &PRODUCT;. It assumes that you have access to a &PRODUCT; endpoint and that you have the API access key and secret key of a user.</para>
+    <para>To install Libcloud refer to the libcloud website. If you are familiar with Pypi simply do:</para>
+    <programlisting>pip install apache-libcloud</programlisting>
+    <para>You should see the following output:</para>
+    <programlisting>
+pip install apache-libcloud
+Downloading/unpacking apache-libcloud
+  Downloading apache-libcloud-0.12.4.tar.bz2 (376kB): 376kB downloaded
+  Running setup.py egg_info for package apache-libcloud
+    
+Installing collected packages: apache-libcloud
+  Running setup.py install for apache-libcloud
+    
+Successfully installed apache-libcloud
+Cleaning up...
+    </programlisting>
+    
+    <para>You can then open a Python interactive shell, create an instance of a &PRODUCT; driver and call the available methods via the libcloud API.</para>
+
+    <programlisting>
+ <![CDATA[
+>>> from libcloud.compute.types import Provider
+>>> from libcloud.compute.providers import get_driver
+>>> Driver = get_driver(Provider.CLOUDSTACK)
+>>> apikey='plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg'
+>>> secretkey='VDaACYb0LV9eNjTetIOElcVQkvJck_J_QljX_FcHRj87ZKiy0z0ty0ZsYBkoXkY9b7eq1EhwJaw7FF3akA3KBQ'
+>>> host='http://localhost:8080'
+>>> path='/client/api'
+>>> conn=Driver(apikey,secretkey,secure='False',host='localhost:8080',path=path)
+>>> conn=Driver(key=apikey,secret=secretkey,secure=False,host='localhost',port='8080',path=path)
+>>> conn.list_images()
+[<NodeImage: id=13ccff62-132b-4caf-b456-e8ef20cbff0e, name=tiny Linux, driver=CloudStack  ...>]
+>>> conn.list_sizes()
+[<NodeSize: id=ef2537ad-c70f-11e1-821b-0800277e749c, name=tinyOffering, ram=100 disk=0 bandwidth=0 price=0 driver=CloudStack ...>, <NodeSize: id=c66c2557-12a7-4b32-94f4-48837da3fa84, name=Small Instance, ram=512 disk=0 bandwidth=0 price=0 driver=CloudStack ...>, <NodeSize: id=3d8b82e5-d8e7-48d5-a554-cf853111bc50, name=Medium Instance, ram=1024 disk=0 bandwidth=0 price=0 driver=CloudStack ...>]
+>>> images=conn.list_images()
+>>> offerings=conn.list_sizes()
+>>> node=conn.create_node(name='toto',image=images[0],size=offerings[0])
+>>> help(node)
+>>> node.get_uuid()
+'b1aa381ba1de7f2d5048e248848993d5a900984f'
+>>> node.name
+u'toto'
+]]>
+    </programlisting>
+   
+    <para>One of the interesting use cases of Libcloud is that you can use multiple Cloud Providers, such as AWS, Rackspace, OpenNebula, vCloud and so on. You can then create Driver instances to each of these clouds and create your own multi cloud application.</para>
+
+ </section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/lxc-install.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/lxc-install.xml b/docs/en-US/lxc-install.xml
index a80c18a..40f6a0a 100644
--- a/docs/en-US/lxc-install.xml
+++ b/docs/en-US/lxc-install.xml
@@ -74,9 +74,9 @@
     <para>To manage LXC instances on the host &PRODUCT; uses a Agent. This Agent communicates with the Management server and controls all the instances on the host.</para>
     <para>First we start by installing the agent:</para>
     <para>In RHEL or CentOS:</para>
-    <programlisting language="Bash"><command>$ yum install cloud-agent</command></programlisting>
+    <programlisting language="Bash"><command>$ yum install cloudstack-agent</command></programlisting>
     <para>In Ubuntu:</para>
-    <programlisting language="Bash"><command>$ apt-get install cloud-agent</command></programlisting>
+    <programlisting language="Bash"><command>$ apt-get install cloudstack-agent</command></programlisting>
     <para>Next step is to update the Agent configuration setttings. The settings are in <filename>/etc/cloudstack/agent/agent.properties</filename></para>
     <orderedlist>
       <listitem>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/networks.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/networks.xml b/docs/en-US/networks.xml
index c2090d2..8a7405a 100644
--- a/docs/en-US/networks.xml
+++ b/docs/en-US/networks.xml
@@ -36,7 +36,8 @@
   <xi:include href="security-groups.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
   <xi:include href="external-firewalls-and-load-balancers.xml"
     xmlns:xi="http://www.w3.org/2001/XInclude"/>
-  <xi:include href="load-balancer-rules.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+  <xi:include href="gslb.xml"
+    xmlns:xi="http://www.w3.org/2001/XInclude"/>
   <xi:include href="guest-ip-ranges.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
   <xi:include href="acquire-new-ip-address.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
   <xi:include href="release-ip-address.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/plugin-midonet-about.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-midonet-about.xml b/docs/en-US/plugin-midonet-about.xml
new file mode 100644
index 0000000..dd9b3ad
--- /dev/null
+++ b/docs/en-US/plugin-midonet-about.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<chapter id="About-the-MidoNet-Plugin" >
+    <title>The MidoNet Plugin</title>
+    <xi:include href="plugin-midonet-introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+    <xi:include href="plugin-midonet-features.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+</chapter>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/plugin-midonet-features.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-midonet-features.xml b/docs/en-US/plugin-midonet-features.xml
new file mode 100644
index 0000000..f242d63
--- /dev/null
+++ b/docs/en-US/plugin-midonet-features.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<section id="Features-of-the-MidoNet-Plugin">
+    <title>Features of the MidoNet Plugin</title>
+
+    <note>
+        <para>
+        In &PRODUCT; 4.2.0 only the KVM hypervisor is supported for use in combination with MidoNet.
+        </para>
+    </note>
+
+    <para>In &PRODUCT; release 4.2.0 this plugin supports several services in the Advanced Isolated network mode.
+    </para>
+
+    <para>
+    When tenants create new isolated layer 3 networks, instead of spinning up extra Virtual Router VMs, the relevant L3 elements (routers etc) are created in the MidoNet virtual topology by making the appropriate calls to the MidoNet API. Instead of using VLANs, isolation is provided by MidoNet.
+    </para>
+
+    <para>
+    Aside from the above service (Connectivity), several extra features are supported in the 4.2.0 release:
+    </para>
+
+    <itemizedlist>
+    <listitem><para>DHCP</para></listitem>
+    <listitem><para>Firewall (ingress)</para></listitem>
+    <listitem><para>Source NAT</para></listitem>
+    <listitem><para>Static NAT</para></listitem>
+    <listitem><para>Port Forwarding</para></listitem>
+    </itemizedlist>
+
+    <para>
+    The plugin has been tested with MidoNet version 12.12. (Caddo).
+    </para>
+
+
+
+</section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/plugin-midonet-introduction.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-midonet-introduction.xml b/docs/en-US/plugin-midonet-introduction.xml
new file mode 100644
index 0000000..7793ecb
--- /dev/null
+++ b/docs/en-US/plugin-midonet-introduction.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<section id="Introduction-to-the-MidoNet-Plugin">
+    <title>Introduction to the MidoNet Plugin</title>
+    <para>The MidoNet plugin allows &PRODUCT; to use the MidoNet virtualized networking solution as a provider for &PRODUCT; networks and services. For more information on MidoNet and how it works, see <ulink url="http://www.midokura.com/midonet/">http://www.midokura.com/midonet/</ulink>.</para>
+</section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/plugin-midonet-preparations.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-midonet-preparations.xml b/docs/en-US/plugin-midonet-preparations.xml
new file mode 100644
index 0000000..cf78774
--- /dev/null
+++ b/docs/en-US/plugin-midonet-preparations.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<section id="Prerequisites">
+    <title>Prerequisites</title>
+
+    <para>In order to use the MidoNet plugin, the compute hosts must be running the MidoNet Agent, and the MidoNet API server must be available. Please consult the MidoNet User Guide for more information. The following section describes the &PRODUCT; side setup.</para>
+
+    <orderedlist>
+      <listitem>
+      <para>&PRODUCT; needs to have at least one physical network with the isolation method set to "MIDO". This network should be enabled for the Guest and Public traffic types.</para>
+    </listitem>
+
+<listitem>
+    <para>Next, we need to set the following &PRODUCT; settings under "Global Settings" in the UI:</para>
+
+<table frame='all'><title>&PRODUCT; settings</title>
+<tgroup cols='3' align='left' colsep='1' rowsep='1'>
+<thead>
+<row>
+  <entry>Setting Name</entry>
+  <entry>Description</entry>
+  <entry>Example</entry>
+</row>
+</thead>
+<tbody>
+<row>
+  <entry>midonet.apiserver.address</entry>
+  <entry>Specify the address at which the Midonet API server can be contacted</entry>
+  <entry>http://192.168.1.144:8081/midolmanj-mgmt</entry>
+</row>
+<row>
+  <entry>midonet.providerrouter.id</entry>
+  <entry>Specifies the UUID of the Midonet provider router</entry>
+  <entry>d7c5e6a3-e2f4-426b-b728-b7ce6a0448e5</entry>
+</row>
+</tbody>
+</tgroup>
+</table>
+</listitem>
+
+<listitem>
+  <para>
+  We also want MidoNet to take care of public traffic, so in <emphasis>componentContext.xml</emphasis> we need to replace this line:
+
+  <programlisting><![CDATA[<bean id="PublicNetworkGuru" class="com.cloud.network.guru.PublicNetworkGuru">]]>
+  </programlisting>
+
+  With this:
+
+  <programlisting><![CDATA[<bean id="PublicNetworkGuru" class="com.cloud.network.guru.MidoNetPublicNetworkGuru">]]>
+  </programlisting>
+</para>
+</listitem>
+</orderedlist>
+
+    <note>
+	    <para>
+	    On the compute host, MidoNet takes advantage of per-traffic type VIF driver support in &PRODUCT; KVM.
+		</para>
+		<para>
+	    In agent.properties, we set the following to make MidoNet take care of Guest and Public traffic:
+
+<programlisting>libvirt.vif.driver.Guest=com.cloud.network.resource.MidoNetVifDriver
+libvirt.vif.driver.Public=com.cloud.network.resource.MidoNetVifDriver</programlisting>
+
+		This is explained further in MidoNet User Guide.
+	    </para>
+	</note>
+
+</section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/plugin-midonet-provider.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-midonet-provider.xml b/docs/en-US/plugin-midonet-provider.xml
new file mode 100644
index 0000000..904828c
--- /dev/null
+++ b/docs/en-US/plugin-midonet-provider.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<section id="Enabling-the-service-provider">
+    <title>Enabling the MidoNet service provider via the API</title>
+    <para>
+    To enable via the API, use the following API calls:</para>
+    <para><emphasis>addNetworkServiceProvider</emphasis></para>
+    <itemizedlist>
+        <listitem><para>name = "MidoNet"</para></listitem>
+        <listitem><para>physicalnetworkid = &lt;the uuid of the physical network&gt;</para></listitem>
+    </itemizedlist>
+    <para><emphasis>updateNetworkServiceProvider</emphasis></para>
+    <itemizedlist>
+        <listitem><para>id = &lt;the provider uuid returned by the previous call&gt;</para></listitem>
+        <listitem><para>state = "Enabled"</para></listitem>
+    </itemizedlist>
+
+
+</section>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/plugin-midonet-revisions.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-midonet-revisions.xml b/docs/en-US/plugin-midonet-revisions.xml
new file mode 100644
index 0000000..73def23
--- /dev/null
+++ b/docs/en-US/plugin-midonet-revisions.xml
@@ -0,0 +1,45 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+]>
+
+<!-- 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.
+-->
+
+<appendix id="appe-cloudstack-Revision_History">
+    <title>Revision History</title>
+    <simpara>
+        <revhistory>
+            <revision>
+                <revnumber>0-0</revnumber>
+                <date>Wed Mar 13 2013</date>
+                <author>
+                    <firstname>Dave</firstname>
+                    <surname>Cahill</surname>
+                    <email>dcahill@midokura.com</email>
+                </author>
+                <revdescription>
+                    <simplelist>
+                        <member>Documentation created for 4.2.0 version of the MidoNet Plugin</member>
+                    </simplelist>
+                </revdescription>
+            </revision>
+        </revhistory>
+    </simpara>
+</appendix>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/plugin-midonet-ui.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-midonet-ui.xml b/docs/en-US/plugin-midonet-ui.xml
new file mode 100644
index 0000000..8ee9850
--- /dev/null
+++ b/docs/en-US/plugin-midonet-ui.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<section id="plugin-midonet-ui">
+    <title>Enabling the MidoNet service provider via the UI</title>
+    <para>To allow &PRODUCT; to use the MidoNet Plugin the network service provider needs to be enabled on the physical network.
+    </para>
+
+    <para>
+    The steps to enable via the UI are as follows:
+    <orderedlist>
+        <listitem><para>
+        In the left navbar, click Infrastructure
+        </para></listitem>
+
+        <listitem><para>
+        In Zones, click View All
+        </para></listitem>
+
+        <listitem><para>
+        Click the name of the Zone on which you are setting up MidoNet
+        </para></listitem>
+
+        <listitem><para>
+        Click the Physical Network tab
+        </para></listitem>
+
+        <listitem><para>
+        Click the Name of the Network on which you are setting up MidoNet
+        </para></listitem>
+
+        <listitem><para>
+        Click Configure on the Network Service Providers box
+        </para></listitem>
+
+        <listitem><para>
+        Click on the name MidoNet
+        </para></listitem>
+
+        <listitem><para>
+        Click the Enable Provider button in the Network tab
+        </para></listitem>
+
+    </orderedlist>
+    </para>
+</section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/plugin-midonet-usage.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-midonet-usage.xml b/docs/en-US/plugin-midonet-usage.xml
new file mode 100644
index 0000000..a314581
--- /dev/null
+++ b/docs/en-US/plugin-midonet-usage.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<chapter id="Using-the-MidoNet-Plugin" >
+    <title>Using the MidoNet Plugin</title>
+
+    <xi:include href="plugin-midonet-preparations.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+    <xi:include href="plugin-midonet-ui.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+    <xi:include href="plugin-midonet-provider.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+</chapter>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/set-database-buffer-pool-size.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/set-database-buffer-pool-size.xml b/docs/en-US/set-database-buffer-pool-size.xml
index 1c75031..8265ae5 100644
--- a/docs/en-US/set-database-buffer-pool-size.xml
+++ b/docs/en-US/set-database-buffer-pool-size.xml
@@ -26,7 +26,7 @@
     <title>Set Database Buffer Pool Size</title>
     <para>It is important to provide enough memory space for the MySQL database to cache data and indexes:</para>
     <orderedlist>
-        <listitem><para>Edit the Tomcat configuration file:</para><programlisting>/etc/my.cnf</programlisting></listitem>
+        <listitem><para>Edit the MySQL configuration file:</para><programlisting>/etc/my.cnf</programlisting></listitem>
         <listitem><para>Insert the following line in the [mysqld] section, below the datadir line. Use a value that is appropriate for your situation. We recommend setting the buffer pool at 40% of RAM if MySQL is on the same server as the management server or 70% of RAM if MySQL has a dedicated server. The following example assumes a dedicated server with 1024M of RAM.</para>
             <programlisting>innodb_buffer_pool_size=700M</programlisting></listitem>
         <listitem><para>Restart the MySQL service.</para><programlisting># service mysqld restart</programlisting></listitem>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/set-global-project-resource-limits.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/set-global-project-resource-limits.xml b/docs/en-US/set-global-project-resource-limits.xml
index d91942a..8ec1325 100644
--- a/docs/en-US/set-global-project-resource-limits.xml
+++ b/docs/en-US/set-global-project-resource-limits.xml
@@ -76,7 +76,7 @@
     </listitem>
     <listitem>
       <para>Restart the Management Server.</para>
-      <programlisting># service cloud-management restart</programlisting>
+      <programlisting># service cloudstack-management restart</programlisting>
     </listitem>
   </orderedlist>
 </section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/set-projects-creator-permissions.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/set-projects-creator-permissions.xml b/docs/en-US/set-projects-creator-permissions.xml
index 9b272f6..dd9cfe9 100644
--- a/docs/en-US/set-projects-creator-permissions.xml
+++ b/docs/en-US/set-projects-creator-permissions.xml
@@ -56,7 +56,7 @@
     </listitem>
     <listitem>
       <para>Restart the Management Server.</para>
-      <programlisting># service cloud-management restart</programlisting>
+      <programlisting># service cloudstack-management restart</programlisting>
     </listitem>
   </orderedlist>
 </section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/set-up-invitations.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/set-up-invitations.xml b/docs/en-US/set-up-invitations.xml
index c1303cf..180c041 100644
--- a/docs/en-US/set-up-invitations.xml
+++ b/docs/en-US/set-up-invitations.xml
@@ -89,7 +89,7 @@
             </informaltable>
         </listitem>
         <listitem><para>Restart the Management Server:</para>
-        <programlisting>service cloud-management restart</programlisting></listitem>
+        <programlisting>service cloudstack-management restart</programlisting></listitem>
     </orderedlist>
     
 </section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/signing-api-calls-python.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/signing-api-calls-python.xml b/docs/en-US/signing-api-calls-python.xml
new file mode 100644
index 0000000..a2f897f
--- /dev/null
+++ b/docs/en-US/signing-api-calls-python.xml
@@ -0,0 +1,101 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+]>
+
+<!-- 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.
+-->
+
+<section id="signing-api-calls-python">
+    <title>How to sign an API call with Python</title>
+    <para>To illustrate the procedure used to sign API calls we present a step by step interactive session
+          using Python.</para>
+    
+    <para>First import the required modules:</para>
+    <programlisting>
+
+ <![CDATA[
+$python
+Python 2.7.3 (default, Nov 17 2012, 19:54:34) 
+[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
+Type "help", "copyright", "credits" or "license" for more information.
+>>> import urllib2
+>>> import urllib
+>>> import hashlib
+>>> import hmac
+>>> import base64
+ ]]>
+    </programlisting>
+   
+    <para>Define the endpoint of the Cloud, the command that you want to execute and the keys of the user.</para>
+    <programlisting>
+ <![CDATA[
+
+>>> baseurl='http://localhost:8080/client/api?'
+>>> request={}
+>>> request['command']='listUsers'
+>>> request['response']='json'
+>>> request['apikey']='plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg'
+>>> secretkey='VDaACYb0LV9eNjTetIOElcVQkvJck_J_QljX_FcHRj87ZKiy0z0ty0ZsYBkoXkY9b7eq1EhwJaw7FF3akA3KBQ'
+  ]]>
+    </programlisting>
+    <para>Build the request string:</para>
+    <programlisting>
+ <![CDATA[
+>>> request_str='&'.join(['='.join([k,urllib.quote_plus(request[k])]) for k in request.keys()])
+>>> request_str
+'apikey=plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg&command=listUsers&response=json'
+  ]]>
+    </programlisting>
+
+    <para>Compute the signature with hmac, do a 64 bit encoding and a url encoding: </para>
+    <programlisting>
+  <![CDATA[
+>>> sig_str='&'.join(['='.join([k.lower(),urllib.quote_plus(request[k].lower().replace('+','%20'))])for k in sorted(request.iterkeys())]) 
+>>> sig_str
+'apikey=plgwjfzk4gys3momtvmjuvg-x-jlwlnfauj9gabbbf9edm-kaymmailqzzq1elzlyq_u38zcm0bewzgudp66mg&command=listusers&response=json'
+>>> sig=hmac.new(secretkey,sig_str,hashlib.sha1)
+>>> sig
+<hmac.HMAC instance at 0x10d91d680>
+>>> sig=hmac.new(secretkey,sig_str,hashlib.sha1).digest()
+>>> sig
+'M:]\x0e\xaf\xfb\x8f\xf2y\xf1p\x91\x1e\x89\x8a\xa1\x05\xc4A\xdb'
+>>> sig=base64.encodestring(hmac.new(secretkey,sig_str,hashlib.sha1).digest())
+>>> sig
+'TTpdDq/7j/J58XCRHomKoQXEQds=\n'
+>>> sig=base64.encodestring(hmac.new(secretkey,sig_str,hashlib.sha1).digest()).strip()
+>>> sig
+'TTpdDq/7j/J58XCRHomKoQXEQds='
+>>> sig=urllib.quote_plus(base64.encodestring(hmac.new(secretkey,sig_str,hashlib.sha1).digest()).strip())
+  ]]>
+    </programlisting>
+
+    <para>Finally, build the entire string and do an http GET:</para>
+    <programlisting>
+  <![CDATA[
+>>> req=baseurl+request_str+'&signature='+sig
+>>> req
+'http://localhost:8080/client/api?apikey=plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg&command=listUsers&response=json&signature=TTpdDq%2F7j%2FJ58XCRHomKoQXEQds%3D'
+>>> res=urllib2.urlopen(req)
+>>> res.read()
+'{ "listusersresponse" : { "count":3 ,"user" : [  {"id":"7ed6d5da-93b2-4545-a502-23d20b48ef2a","username":"admin","firstname":"admin","lastname":"cloud","created":"2012-07-05T12:18:27-0700","state":"enabled","account":"admin","accounttype":1,"domainid":"8a111e58-e155-4482-93ce-84efff3c7c77","domain":"ROOT","apikey":"plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg","secretkey":"VDaACYb0LV9eNjTetIOElcVQkvJck_J_QljX_FcHRj87ZKiy0z0ty0ZsYBkoXkY9b7eq1EhwJaw7FF3akA3KBQ","accountid":"7548ac03-af1d-4c1c-9064-2f3e2c0eda0d"}, {"id":"1fea6418-5576-4989-a21e-4790787bbee3","username":"runseb","firstname":"foobar","lastname":"goa","email":"joe@smith.com","created":"2013-04-10T16:52:06-0700","state":"enabled","account":"admin","accounttype":1,"domainid":"8a111e58-e155-4482-93ce-84efff3c7c77","domain":"ROOT","apikey":"Xhsb3MewjJQaXXMszRcLvQI9_NPy_UcbDj1QXikkVbDC9MDSPwWdtZ1bUY1H7JBEYTtDDLY3yuchCeW778GkBA","secretkey":"gIsgmi8C5YwxMHjX5o51pSe0kqs6JnKriw0jJBLceY5b
 gnfzKjL4aM6ctJX-i1ddQIHJLbLJDK9MRzsKk6xZ_w","accountid":"7548ac03-af1d-4c1c-9064-2f3e2c0eda0d"}, {"id":"52f65396-183c-4473-883f-a37e7bb93967","username":"toto","firstname":"john","lastname":"smith","email":"john@smith.com","created":"2013-04-23T04:27:22-0700","state":"enabled","account":"admin","accounttype":1,"domainid":"8a111e58-e155-4482-93ce-84efff3c7c77","domain":"ROOT","apikey":"THaA6fFWS_OmvU8od201omxFC8yKNL_Hc5ZCS77LFCJsRzSx48JyZucbUul6XYbEg-ZyXMl_wuEpECzK-wKnow","secretkey":"O5ywpqJorAsEBKR_5jEvrtGHfWL1Y_j1E4Z_iCr8OKCYcsPIOdVcfzjJQ8YqK0a5EzSpoRrjOFiLsG0hQrYnDA","accountid":"7548ac03-af1d-4c1c-9064-2f3e2c0eda0d"} ] } }'
+  ]]>
+    </programlisting>
+    
+ </section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/signing-api-requests.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/signing-api-requests.xml b/docs/en-US/signing-api-requests.xml
index 581b32a..fc8773b 100644
--- a/docs/en-US/signing-api-requests.xml
+++ b/docs/en-US/signing-api-requests.xml
@@ -57,4 +57,7 @@
             <programlisting>http://localhost:8080/client/api?command=deployVirtualMachine&amp;serviceOfferingId=1&amp;diskOfferingId=1&amp;templateId=2&amp;zoneId=4&amp;apiKey=miVr6X7u6bN_sdahOBpjNejPgEsT35eXq-jB8CG20YI3yaxXcgpyuaIRmFI_EJTVwZ0nUkkJbPmY3y2bciKwFQ&amp;signature=Lxx1DM40AjcXU%2FcaiK8RAP0O1hU%3D</programlisting>
         </listitem>
     </orderedlist>
+  
+    <xi:include href="signing-api-calls-python.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />   
+
 </section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/stop-restart-management-server.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/stop-restart-management-server.xml b/docs/en-US/stop-restart-management-server.xml
index 5c1bcec..74a687c 100644
--- a/docs/en-US/stop-restart-management-server.xml
+++ b/docs/en-US/stop-restart-management-server.xml
@@ -26,9 +26,9 @@
     <para>The root administrator will need to stop and restart the Management Server from time to time.</para>
     <para>For example, after changing a global configuration parameter, a restart is required. If you have multiple Management Server nodes, restart all of them to put the new parameter value into effect consistently throughout the cloud..</para>
     <para>To stop the Management Server, issue the following command at the operating system prompt on the Management Server node:</para>
-    <programlisting># service cloud-management stop</programlisting>
+    <programlisting># service cloudstack-management stop</programlisting>
     <para>To start the Management Server:</para>
-    <programlisting># service cloud-management start</programlisting>
+    <programlisting># service cloudstack-management start</programlisting>
     <para>To stop the Management Server:</para>
-    <programlisting># service cloud-management stop</programlisting>
+    <programlisting># service cloudstack-management stop</programlisting>
 </section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/sys-offering-sysvm.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/sys-offering-sysvm.xml b/docs/en-US/sys-offering-sysvm.xml
index cccf3e0..563dd6f 100644
--- a/docs/en-US/sys-offering-sysvm.xml
+++ b/docs/en-US/sys-offering-sysvm.xml
@@ -65,7 +65,7 @@
     <listitem>
       <para>Restart &PRODUCT; Management Server. Restarting is required because the default
         offerings are loaded into the memory at startup.</para>
-      <programlisting>service cloud-management restart</programlisting>
+      <programlisting>service cloudstack-management restart</programlisting>
     </listitem>
     <listitem>
       <para>Destroy the existing CPVM or SSVM offerings and wait for them to be recreated. The new

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/tools.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/tools.xml b/docs/en-US/tools.xml
index db6a510..8cddf28 100644
--- a/docs/en-US/tools.xml
+++ b/docs/en-US/tools.xml
@@ -27,4 +27,5 @@
   <xi:include href="devcloud.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
   <xi:include href="marvin.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
   <xi:include href="cloudmonkey.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+  <xi:include href="libcloud-examples.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
 </chapter>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/en-US/zone-add.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/zone-add.xml b/docs/en-US/zone-add.xml
index 4f6606f..3ca5789 100644
--- a/docs/en-US/zone-add.xml
+++ b/docs/en-US/zone-add.xml
@@ -42,7 +42,7 @@
                 </para>
                 </listitem>
                 <listitem><para>Restart the Management Server.</para>
-                    <programlisting># service cloud-management restart</programlisting>
+                    <programlisting># service cloudstack-management restart</programlisting>
                 </listitem>
                 <listitem><para>Refresh the &PRODUCT; UI browser tab and log back in.</para></listitem>
             </orderedlist>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/docs/publican-plugin-midonet.cfg
----------------------------------------------------------------------
diff --git a/docs/publican-plugin-midonet.cfg b/docs/publican-plugin-midonet.cfg
new file mode 100644
index 0000000..6558d99
--- /dev/null
+++ b/docs/publican-plugin-midonet.cfg
@@ -0,0 +1,28 @@
+# Publican configuration file for CloudStack Complete Documentation Set
+# Contains all technical docs except release notes
+# Config::Simple 4.58
+# Tue May 29 00:57:27 2012
+#
+# 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.
+
+xml_lang: en-US
+type: Book
+docname: MidoNet_Plugin_Guide
+brand: cloudstack
+chunk_first: 1
+chunk_section_depth: 1
+condition: install

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/api/pom.xml
----------------------------------------------------------------------
diff --git a/engine/api/pom.xml b/engine/api/pom.xml
index 1e8e8c3..1b8f26c 100644
--- a/engine/api/pom.xml
+++ b/engine/api/pom.xml
@@ -31,11 +31,6 @@
       <version>${project.version}</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.cloudstack</groupId>
-      <artifactId>cloud-framework-api</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-bundle-jaxrs</artifactId>
       <version>2.7.0</version>
@@ -55,6 +50,11 @@
       <artifactId>cloud-framework-rest</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-framework-ipc</artifactId>
+      <version>${project.version}</version>
+    </dependency>
   </dependencies>
   <build>
     <defaultGoal>install</defaultGoal>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/pom.xml
----------------------------------------------------------------------
diff --git a/engine/pom.xml b/engine/pom.xml
index 1a3d896..169425a 100644
--- a/engine/pom.xml
+++ b/engine/pom.xml
@@ -29,8 +29,6 @@
   </parent>
   <build>
     <defaultGoal>install</defaultGoal>
-    <sourceDirectory>src</sourceDirectory>
-    <testSourceDirectory>test</testSourceDirectory>
   </build>
   <modules>
     <module>api</module>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/alert/AlertVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/alert/AlertVO.java b/engine/schema/src/com/cloud/alert/AlertVO.java
new file mode 100755
index 0000000..3f014aa
--- /dev/null
+++ b/engine/schema/src/com/cloud/alert/AlertVO.java
@@ -0,0 +1,183 @@
+// 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.alert;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import com.cloud.utils.db.GenericDao;
+
+@Entity
+@Table(name="alert")
+public class AlertVO implements Alert {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="type")
+    private short type;
+    
+    @Column(name="cluster_id")
+    private Long clusterId = null;
+    
+    @Column(name="pod_id")
+    private Long podId = null;
+
+    @Column(name="data_center_id")
+    private long dataCenterId = 0;
+
+    @Column(name="subject", length=999)
+    private String subject;
+
+    @Column(name="sent_count")
+    private int sentCount = 0;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    private Date createdDate;
+
+    @Temporal(TemporalType.TIMESTAMP)
+    @Column(name="last_sent", updatable=true, nullable=true)
+    private Date lastSent;
+
+    @Temporal(TemporalType.TIMESTAMP)
+    @Column(name="resolved", updatable=true, nullable=true)
+    private Date resolved;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    @Column(name="archived")
+    private boolean archived;
+
+    public AlertVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+    public AlertVO(Long id) {
+        this.id = id;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+    @Override
+    public short getType() {
+        return type;
+    }
+
+    public void setType(short type) {
+        this.type = type;
+    }
+
+    @Override
+    public String getSubject() {
+        return subject;
+    }
+
+    public void setSubject(String subject) {
+        this.subject = subject;
+    }
+
+    public Long getClusterId() {
+        return clusterId;
+    }
+    public void setClusterId(Long clusterId) {
+        this.clusterId = clusterId;
+    }
+    @Override
+    public Long getPodId() {
+        return podId;
+    }
+
+    public void setPodId(Long podId) {
+        this.podId = podId;
+    }
+
+    @Override
+    public long getDataCenterId() {
+        return dataCenterId;
+    }
+
+    public void setDataCenterId(long dataCenterId) {
+        this.dataCenterId = dataCenterId;
+    }
+
+    @Override
+    public int getSentCount() {
+        return sentCount;
+    }
+
+    public void setSentCount(int sentCount) {
+        this.sentCount = sentCount;
+    }
+
+    @Override
+    public Date getCreatedDate() {
+        return createdDate;
+    }
+
+    public void setCreatedDate(Date createdDate) {
+        this.createdDate = createdDate;
+    }
+
+    @Override
+    public Date getLastSent() {
+        return lastSent;
+    }
+
+    public void setLastSent(Date lastSent) {
+        this.lastSent = lastSent;
+    }
+
+    @Override
+    public Date getResolved() {
+        return resolved;
+    }
+
+    public void setResolved(Date resolved) {
+        this.resolved = resolved;
+    }
+    
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    @Override
+    public boolean getArchived() {
+        return archived;
+    }
+
+    public void setArchived(Boolean archived) {
+        this.archived = archived;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/alert/dao/AlertDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/alert/dao/AlertDao.java b/engine/schema/src/com/cloud/alert/dao/AlertDao.java
new file mode 100755
index 0000000..fda814d
--- /dev/null
+++ b/engine/schema/src/com/cloud/alert/dao/AlertDao.java
@@ -0,0 +1,33 @@
+// 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.alert.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import com.cloud.alert.AlertVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface AlertDao extends GenericDao<AlertVO, Long> {
+    AlertVO getLastAlert(short type, long dataCenterId, Long podId, Long clusterId);
+    // This is for backward compatibility
+    AlertVO getLastAlert(short type, long dataCenterId, Long podId);
+
+    public boolean deleteAlert(List<Long> Ids, String type, Date olderThan, Long zoneId);
+    public boolean archiveAlert(List<Long> Ids, String type, Date olderThan, Long zoneId);
+    public List<AlertVO> listOlderAlerts(Date oldTime);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java b/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java
new file mode 100755
index 0000000..4b9bc6a
--- /dev/null
+++ b/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java
@@ -0,0 +1,156 @@
+// 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.alert.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.alert.AlertVO;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+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;
+
+@Component
+@Local(value = { AlertDao.class })
+public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements AlertDao {
+
+    protected final SearchBuilder<AlertVO> AlertSearchByIdsAndType;
+
+    public AlertDaoImpl() {
+        AlertSearchByIdsAndType = createSearchBuilder();
+        AlertSearchByIdsAndType.and("id", AlertSearchByIdsAndType.entity().getId(), Op.IN);
+        AlertSearchByIdsAndType.and("type", AlertSearchByIdsAndType.entity().getType(), Op.EQ);
+        AlertSearchByIdsAndType.and("createdDateL", AlertSearchByIdsAndType.entity().getCreatedDate(), Op.LT);
+        AlertSearchByIdsAndType.and("data_center_id", AlertSearchByIdsAndType.entity().getDataCenterId(), Op.EQ);
+        AlertSearchByIdsAndType.done();
+    }
+
+    @Override
+    public AlertVO getLastAlert(short type, long dataCenterId, Long podId, Long clusterId) {
+        Filter searchFilter = new Filter(AlertVO.class, "createdDate", Boolean.FALSE, Long.valueOf(0), Long.valueOf(1));
+        SearchCriteria<AlertVO> sc = createSearchCriteria();
+
+        sc.addAnd("type", SearchCriteria.Op.EQ, Short.valueOf(type));
+        sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, Long.valueOf(dataCenterId));
+        if (podId != null) {
+            sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
+        }
+        if (clusterId != null) {
+            sc.addAnd("clusterId", SearchCriteria.Op.EQ, clusterId);
+        }
+
+        List<AlertVO> alerts = listBy(sc, searchFilter);
+        if ((alerts != null) && !alerts.isEmpty()) {
+            return alerts.get(0);
+        }
+        return null;
+    }
+    
+    @Override
+    public AlertVO getLastAlert(short type, long dataCenterId, Long podId) {
+        Filter searchFilter = new Filter(AlertVO.class, "createdDate", Boolean.FALSE, Long.valueOf(0), Long.valueOf(1));
+        SearchCriteria<AlertVO> sc = createSearchCriteria();
+
+        sc.addAnd("type", SearchCriteria.Op.EQ, Short.valueOf(type));
+        sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, Long.valueOf(dataCenterId));
+        if (podId != null) {
+            sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
+        }        
+
+        List<AlertVO> alerts = listBy(sc, searchFilter);
+        if ((alerts != null) && !alerts.isEmpty()) {
+            return alerts.get(0);
+        }
+        return null;
+    }
+
+    @Override
+    public boolean archiveAlert(List<Long> Ids, String type, Date olderThan, Long zoneId) {
+        SearchCriteria<AlertVO> sc = AlertSearchByIdsAndType.create();
+
+        if (Ids != null) {
+            sc.setParameters("id", Ids.toArray(new Object[Ids.size()]));
+        }
+        if(type != null) {
+            sc.setParameters("type", type);
+        }
+        if(zoneId != null) {
+            sc.setParameters("data_center_id", zoneId);
+        }
+        if(olderThan != null) {
+            sc.setParameters("createdDateL", olderThan);
+        }
+        boolean result = true;;
+        List<AlertVO> alerts = listBy(sc);
+        if (Ids != null && alerts.size() < Ids.size()) {
+            result = false;
+            return result;
+        }
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        for (AlertVO alert : alerts) {
+            alert = lockRow(alert.getId(), true);
+            alert.setArchived(true);
+            update(alert.getId(), alert);
+            txn.commit();
+        }
+        txn.close();
+        return result;
+    }
+
+    @Override
+    public boolean deleteAlert(List<Long> ids, String type, Date olderThan, Long zoneId) {
+        SearchCriteria<AlertVO> sc = AlertSearchByIdsAndType.create();
+
+        if (ids != null) {
+            sc.setParameters("id", ids.toArray(new Object[ids.size()]));
+        }
+        if(type != null) {
+            sc.setParameters("type", type);
+        }
+        if(zoneId != null) {
+            sc.setParameters("data_center_id", zoneId);
+        }
+        if(olderThan != null) {
+            sc.setParameters("createdDateL", olderThan);
+        }
+        boolean result = true;
+        List<AlertVO> alerts = listBy(sc);
+        if (ids != null && alerts.size() < ids.size()) {
+            result = false;
+            return result;
+        }
+        remove(sc);
+        return result;
+    }
+
+    @Override
+    public List<AlertVO> listOlderAlerts(Date oldTime) {
+        if (oldTime == null) return null;
+        SearchCriteria<AlertVO> sc = createSearchCriteria();
+        sc.addAnd("createDate", SearchCriteria.Op.LT, oldTime);
+        return listIncludingRemovedBy(sc, null);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/capacity/CapacityVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/capacity/CapacityVO.java b/engine/schema/src/com/cloud/capacity/CapacityVO.java
new file mode 100755
index 0000000..d34e9d3
--- /dev/null
+++ b/engine/schema/src/com/cloud/capacity/CapacityVO.java
@@ -0,0 +1,204 @@
+// 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.capacity;
+
+import javax.persistence.Transient;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="op_host_capacity")
+public class CapacityVO implements Capacity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="host_id")
+    private Long hostOrPoolId;
+
+    @Column(name="data_center_id")
+    private Long dataCenterId;
+
+    @Column(name="pod_id")
+    private Long podId;
+
+    @Column(name="cluster_id")
+    private Long clusterId;
+
+    @Column(name="used_capacity")
+    private long usedCapacity;
+
+    @Column(name="reserved_capacity")
+    private long reservedCapacity;
+    
+    @Column(name="total_capacity")
+    private long totalCapacity;
+
+    @Column(name="capacity_type")
+    private short capacityType;
+    
+    @Column(name="capacity_state")
+    private CapacityState capacityState;
+    
+    @Column(name=GenericDao.CREATED_COLUMN)
+    protected Date created;    
+    
+    @Column(name="update_time", updatable=true, nullable=true)
+    @Temporal(value=TemporalType.TIMESTAMP)
+    protected Date updateTime;
+    
+    @Transient
+    private Float usedPercentage;
+    
+    public CapacityVO() {}
+
+    public CapacityVO(Long hostId, Long dataCenterId, Long podId, Long clusterId, long usedCapacity, long totalCapacity, short capacityType) {
+        this.hostOrPoolId = hostId;
+        this.dataCenterId = dataCenterId;
+        this.podId = podId;
+        this.clusterId = clusterId;
+        this.usedCapacity = usedCapacity;
+        this.totalCapacity = totalCapacity;
+        this.capacityType = capacityType;
+        this.updateTime = new Date();
+        this.capacityState = CapacityState.Enabled;
+    }
+    
+    public CapacityVO(Long dataCenterId, Long podId, Long clusterId, short capacityType, float usedPercentage) {        
+        this.dataCenterId = dataCenterId;
+        this.podId = podId;
+        this.clusterId = clusterId;
+        this.capacityType = capacityType;
+        this.usedPercentage = usedPercentage;
+        this.capacityState = CapacityState.Enabled;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public Long getHostOrPoolId() {
+        return hostOrPoolId;
+    }
+    
+    public void setHostId(Long hostId) {
+        this.hostOrPoolId = hostId;
+    }
+    @Override
+    public Long getDataCenterId() {
+        return dataCenterId;
+    }
+    public void setDataCenterId(Long dataCenterId) {
+        this.dataCenterId = dataCenterId;
+    }
+    
+    @Override
+    public Long getPodId() {
+        return podId;
+    }
+    public void setPodId(long podId) {
+        this.podId = new Long(podId);
+    }
+    
+    @Override
+    public Long getClusterId() {
+        return clusterId;
+    }
+    public void setClusterId(long clusterId) {
+        this.clusterId = new Long(clusterId);
+    }
+    
+    @Override
+    public long getUsedCapacity() {
+        return usedCapacity;
+    }
+    public void setUsedCapacity(long usedCapacity) {
+        this.usedCapacity = usedCapacity;
+        this.setUpdateTime (new Date());
+    }
+    @Override
+    public long getReservedCapacity() {
+        return reservedCapacity;
+    }
+    public void setReservedCapacity(long reservedCapacity) {
+        this.reservedCapacity = reservedCapacity;
+        this.setUpdateTime (new Date());
+    }
+    @Override
+    public long getTotalCapacity() {
+        return totalCapacity;
+    }
+    public void setTotalCapacity(long totalCapacity) {
+        this.totalCapacity = totalCapacity;
+        this.setUpdateTime (new Date());
+    }
+    @Override
+    public short getCapacityType() {
+        return capacityType;
+    }
+    public void setCapacityType(short capacityType) {
+        this.capacityType = capacityType;
+    }
+
+	public CapacityState getCapacityState() {
+        return capacityState;
+    }
+
+    public void setCapacityState(CapacityState capacityState) {
+        this.capacityState = capacityState;
+    }
+
+    public Date getCreated() {
+		return created;
+	}
+
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
+	@Override
+    public Float getUsedPercentage() {
+        return usedPercentage;
+    }
+
+    public void setUsedPercentage(float usedPercentage) {
+        this.usedPercentage = usedPercentage;
+    }
+
+    @Override
+    public String getUuid() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/engine/schema/src/com/cloud/capacity/dao/CapacityDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/capacity/dao/CapacityDao.java b/engine/schema/src/com/cloud/capacity/dao/CapacityDao.java
new file mode 100755
index 0000000..04466f4
--- /dev/null
+++ b/engine/schema/src/com/cloud/capacity/dao/CapacityDao.java
@@ -0,0 +1,45 @@
+// 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.capacity.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import com.cloud.capacity.CapacityVO;
+import com.cloud.capacity.dao.CapacityDaoImpl.SummedCapacity;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.GenericDao;
+
+public interface CapacityDao extends GenericDao<CapacityVO, Long> {
+	CapacityVO findByHostIdType(Long hostId, short capacityType);
+	List<Long> listClustersInZoneOrPodByHostCapacities(long id, int requiredCpu, long requiredRam, short capacityTypeForOrdering, boolean isZone);
+	List<Long> listHostsWithEnoughCapacity(int requiredCpu, long requiredRam, Long clusterId, String hostType);
+	boolean removeBy(Short capacityType, Long zoneId, Long podId, Long clusterId, Long hostId);
+	List<SummedCapacity> findByClusterPodZone(Long zoneId, Long podId, Long clusterId);
+	List<SummedCapacity> findNonSharedStorageForClusterPodZone(Long zoneId,Long podId, Long clusterId);
+	Pair<List<Long>, Map<Long, Double>> orderClustersByAggregateCapacity(long id, short capacityType, boolean isZone);
+	List<SummedCapacity> findCapacityBy(Integer capacityType, Long zoneId, Long podId, Long clusterId);
+	
+    List<Long> listPodsByHostCapacities(long zoneId, int requiredCpu, long requiredRam, short capacityType);
+    Pair<List<Long>, Map<Long, Double>> orderPodsByAggregateCapacity(long zoneId, short capacityType);
+    List<SummedCapacity> findCapacityBy(Integer capacityType, Long zoneId,
+            Long podId, Long clusterId, String resourceState);
+    List<SummedCapacity> listCapacitiesGroupedByLevelAndType(Integer capacityType, Long zoneId, Long podId, Long clusterId, int level, Long limit);  
+    void updateCapacityState(Long dcId, Long podId, Long clusterId,
+            Long hostId, String capacityState);
+	List<Long> listClustersCrossingThreshold(short capacityType, Long zoneId, String ConfigName, long computeRequested);
+}


[30/57] [abbrv] [partial] merge master

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PingTestCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PingTestCommand.java b/core/src/com/cloud/agent/api/PingTestCommand.java
new file mode 100644
index 0000000..69c6efa
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PingTestCommand.java
@@ -0,0 +1,54 @@
+// 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.agent.api;
+
+public class PingTestCommand extends Command {
+
+    String _computingHostIp = null;
+    String _routerIp = null;
+    String _privateIp = null;
+
+    public PingTestCommand() {}
+
+    public PingTestCommand(String computingHostIp) {
+        _computingHostIp = computingHostIp;
+        setWait(20);
+    }
+
+    public PingTestCommand(String routerIp, String privateIp) {
+        _routerIp = routerIp;
+        _privateIp = privateIp;
+        setWait(20);
+    }
+
+    public String getComputingHostIp() {
+        return _computingHostIp;
+    }
+
+    public String getRouterIp() {
+        return _routerIp;
+    }
+
+    public String getPrivateIp() {
+        return _privateIp;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PlugNicAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PlugNicAnswer.java b/core/src/com/cloud/agent/api/PlugNicAnswer.java
new file mode 100644
index 0000000..90d31bd
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PlugNicAnswer.java
@@ -0,0 +1,25 @@
+// 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.agent.api;
+
+public class PlugNicAnswer extends Answer{
+    public PlugNicAnswer() {}
+
+    public PlugNicAnswer(PlugNicCommand cmd, boolean success, String result) {
+        super(cmd, success, result);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PlugNicCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PlugNicCommand.java b/core/src/com/cloud/agent/api/PlugNicCommand.java
new file mode 100644
index 0000000..b896e45
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PlugNicCommand.java
@@ -0,0 +1,46 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.to.NicTO;
+
+public class PlugNicCommand extends Command {
+
+    NicTO nic;
+    String instanceName;
+
+    public NicTO getNic() {
+        return nic;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    protected PlugNicCommand() {
+    }
+
+    public PlugNicCommand(NicTO nic, String instanceName) {
+        this.nic = nic;
+        this.instanceName = instanceName;
+    }
+
+    public String getVmName() {
+        return instanceName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PoolEjectCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PoolEjectCommand.java b/core/src/com/cloud/agent/api/PoolEjectCommand.java
new file mode 100644
index 0000000..3085042
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PoolEjectCommand.java
@@ -0,0 +1,42 @@
+// 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.agent.api;
+
+public class PoolEjectCommand extends Command {
+    private String hostuuid;
+
+	public String getHostuuid() {
+        return hostuuid;
+    }
+
+    public void setHostuuid(String hostuuid) {
+        this.hostuuid = hostuuid;
+    }
+    public PoolEjectCommand() {
+		super();
+	}
+    public PoolEjectCommand(String hostuuid) {
+        super();
+        setHostuuid(hostuuid);
+    }
+
+	@Override
+	public boolean executeInSequence() {
+		return true;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PrepareForMigrationAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PrepareForMigrationAnswer.java b/core/src/com/cloud/agent/api/PrepareForMigrationAnswer.java
new file mode 100644
index 0000000..1b215bc
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PrepareForMigrationAnswer.java
@@ -0,0 +1,34 @@
+// 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.agent.api;
+
+public class PrepareForMigrationAnswer extends Answer {
+    protected PrepareForMigrationAnswer() {
+    }
+
+    public PrepareForMigrationAnswer(PrepareForMigrationCommand cmd, String detail) {
+        super(cmd, false, detail);
+    }
+
+    public PrepareForMigrationAnswer(PrepareForMigrationCommand cmd, Exception ex) {
+        super(cmd, ex);
+    }
+
+    public PrepareForMigrationAnswer(PrepareForMigrationCommand cmd) {
+        super(cmd, true, null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PrepareForMigrationCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PrepareForMigrationCommand.java b/core/src/com/cloud/agent/api/PrepareForMigrationCommand.java
new file mode 100644
index 0000000..c0e1368
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PrepareForMigrationCommand.java
@@ -0,0 +1,39 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.to.VirtualMachineTO;
+
+public class PrepareForMigrationCommand extends Command {
+    VirtualMachineTO vm;
+
+    protected PrepareForMigrationCommand() {
+    }
+
+    public PrepareForMigrationCommand(VirtualMachineTO vm) {
+    	this.vm = vm;
+    }
+
+    public VirtualMachineTO getVirtualMachine() {
+    	return vm;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PrepareOCFS2NodesCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PrepareOCFS2NodesCommand.java b/core/src/com/cloud/agent/api/PrepareOCFS2NodesCommand.java
new file mode 100755
index 0000000..0c80bfa
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PrepareOCFS2NodesCommand.java
@@ -0,0 +1,44 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.utils.Ternary;
+
+public class PrepareOCFS2NodesCommand extends Command {
+    List<Ternary<Integer, String, String>> nodes;
+    String clusterName;
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    public PrepareOCFS2NodesCommand(String clusterName, List<Ternary<Integer, String, String>> nodes) {
+        this.nodes = nodes;
+        this.clusterName = clusterName;
+    }
+
+    public List<Ternary<Integer, String, String>> getNodes() {
+        return nodes;
+    }
+
+    public String getClusterName() {
+        return clusterName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/PropagateResourceEventCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PropagateResourceEventCommand.java b/core/src/com/cloud/agent/api/PropagateResourceEventCommand.java
new file mode 100755
index 0000000..45cd4b3
--- /dev/null
+++ b/core/src/com/cloud/agent/api/PropagateResourceEventCommand.java
@@ -0,0 +1,48 @@
+// 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.agent.api;
+
+import com.cloud.resource.ResourceState;
+
+public class PropagateResourceEventCommand extends Command {
+    long hostId;
+    ResourceState.Event event;
+
+    protected PropagateResourceEventCommand() {
+
+    }
+
+    public PropagateResourceEventCommand(long hostId, ResourceState.Event event) {
+        this.hostId = hostId;
+        this.event = event;
+    }
+
+    public long getHostId() {
+        return hostId;
+    }
+
+    public ResourceState.Event getEvent() {
+        return event;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ReadyAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ReadyAnswer.java b/core/src/com/cloud/agent/api/ReadyAnswer.java
new file mode 100644
index 0000000..b5dd0b7
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ReadyAnswer.java
@@ -0,0 +1,31 @@
+// 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.agent.api;
+
+public class ReadyAnswer extends Answer {
+	protected ReadyAnswer() {
+	}
+
+	public ReadyAnswer(ReadyCommand cmd) {
+		super(cmd, true, null);
+	}
+
+	public ReadyAnswer(ReadyCommand cmd, String details) {
+		super(cmd, false, details);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ReadyCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ReadyCommand.java b/core/src/com/cloud/agent/api/ReadyCommand.java
new file mode 100644
index 0000000..c6ca799
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ReadyCommand.java
@@ -0,0 +1,58 @@
+// 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.agent.api;
+
+public class ReadyCommand extends Command {
+	private String _details;
+	public ReadyCommand() {
+		super();
+	}
+
+	private Long dcId;
+	private Long hostId;
+
+	public ReadyCommand(Long dcId) {
+		super();
+		this.dcId = dcId;
+	}
+
+	public ReadyCommand(Long dcId, Long hostId) {
+	    this(dcId);
+	    this.hostId = hostId;
+	}
+
+	public void setDetails(String details) {
+		_details = details;
+	}
+
+	public String getDetails() {
+		return _details;
+	}
+
+	public Long getDataCenterId() {
+		return dcId;
+	}
+
+	@Override
+	public boolean executeInSequence() {
+		return true;
+	}
+
+    public Long getHostId() {
+        return hostId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/RebootAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/RebootAnswer.java b/core/src/com/cloud/agent/api/RebootAnswer.java
new file mode 100644
index 0000000..244bf1e
--- /dev/null
+++ b/core/src/com/cloud/agent/api/RebootAnswer.java
@@ -0,0 +1,42 @@
+// 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.agent.api;
+
+public class RebootAnswer extends Answer {
+    Integer vncPort;
+
+    protected RebootAnswer() {
+    }
+
+    public RebootAnswer(RebootCommand cmd, String details, Integer vncport) {
+        super(cmd, true, details);
+        this.vncPort = vncport;
+    }
+
+    public RebootAnswer(RebootCommand cmd, String details, boolean success) {
+        super(cmd, success, details);
+        this.vncPort = null;
+    }
+
+    public RebootAnswer(RebootCommand cmd, Exception e) {
+        super(cmd, e);
+    }
+
+    public Integer getVncPort() {
+    	return vncPort;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/RebootCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/RebootCommand.java b/core/src/com/cloud/agent/api/RebootCommand.java
new file mode 100755
index 0000000..49712b6
--- /dev/null
+++ b/core/src/com/cloud/agent/api/RebootCommand.java
@@ -0,0 +1,45 @@
+// 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.agent.api;
+
+import com.cloud.hypervisor.Hypervisor;
+import com.cloud.vm.VirtualMachine;
+
+public class RebootCommand extends Command {
+    String vmName;
+
+    protected RebootCommand() {
+    }
+
+    public RebootCommand(VirtualMachine vm) {
+        vmName = vm.getInstanceName();
+    }
+
+    public RebootCommand(String vmName) {
+        this.vmName = vmName;
+    }
+
+    public String getVmName() {
+        return vmName;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/RebootRouterCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/RebootRouterCommand.java b/core/src/com/cloud/agent/api/RebootRouterCommand.java
new file mode 100644
index 0000000..c5027b3
--- /dev/null
+++ b/core/src/com/cloud/agent/api/RebootRouterCommand.java
@@ -0,0 +1,38 @@
+// 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.agent.api;
+
+
+public class RebootRouterCommand extends RebootCommand {
+
+	protected String privateIp;
+
+	protected RebootRouterCommand() {
+	}
+
+
+	public RebootRouterCommand(String vmName, String privateIp) {
+		super(vmName);
+		this.privateIp=privateIp;
+	}
+
+
+	public String getPrivateIpAddress() {
+		return privateIp;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java b/core/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java
new file mode 100644
index 0000000..848ffc0
--- /dev/null
+++ b/core/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java
@@ -0,0 +1,63 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.vm.VirtualMachine;
+
+public class RevertToVMSnapshotAnswer extends Answer {
+
+    private List<VolumeTO> volumeTOs;
+    private VirtualMachine.State vmState;
+
+    public RevertToVMSnapshotAnswer(RevertToVMSnapshotCommand cmd, boolean result,
+            String message) {
+        super(cmd, result, message);
+    }
+
+    public RevertToVMSnapshotAnswer() {
+        super();
+    }
+
+    public RevertToVMSnapshotAnswer(RevertToVMSnapshotCommand cmd,
+            List<VolumeTO> volumeTOs,
+            VirtualMachine.State vmState) {
+        super(cmd, true, "");
+        this.volumeTOs = volumeTOs;
+        this.vmState = vmState;
+    }
+
+    public VirtualMachine.State getVmState() {
+        return vmState;
+    }
+
+    public List<VolumeTO> getVolumeTOs() {
+        return volumeTOs;
+    }
+
+    public void setVolumeTOs(List<VolumeTO> volumeTOs) {
+        this.volumeTOs = volumeTOs;
+    }
+
+    public void setVmState(VirtualMachine.State vmState) {
+        this.vmState = vmState;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java b/core/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
new file mode 100644
index 0000000..429a186
--- /dev/null
+++ b/core/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
@@ -0,0 +1,29 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class RevertToVMSnapshotCommand extends VMSnapshotBaseCommand {
+
+    public RevertToVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType) {
+        super(vmName, snapshot, volumeTOs, guestOSType);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ScaleVmAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ScaleVmAnswer.java b/core/src/com/cloud/agent/api/ScaleVmAnswer.java
new file mode 100644
index 0000000..31d6e44
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ScaleVmAnswer.java
@@ -0,0 +1,28 @@
+// 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.agent.api;
+
+public class ScaleVmAnswer extends Answer {
+
+    protected ScaleVmAnswer() {
+    }
+    
+    public ScaleVmAnswer(ScaleVmCommand cmd, boolean result, String detail) {
+        super(cmd, result, detail);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ScaleVmCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ScaleVmCommand.java b/core/src/com/cloud/agent/api/ScaleVmCommand.java
new file mode 100644
index 0000000..35d22ad
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ScaleVmCommand.java
@@ -0,0 +1,113 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.to.VirtualMachineTO;
+
+public class ScaleVmCommand extends Command {
+
+    VirtualMachineTO vm;
+    String vmName;
+    int cpus;
+    Integer speed;
+    long minRam;
+    long maxRam;
+    
+    public VirtualMachineTO getVm() {
+		return vm;
+	}
+
+	public void setVm(VirtualMachineTO vm) {
+		this.vm = vm;
+	}
+
+	public int getCpus() {
+		return cpus;
+	}
+
+	public ScaleVmCommand(String vmName, int cpus,
+			Integer speed, long minRam, long maxRam, boolean limitCpuUse) {
+		super();
+		this.vmName = vmName;
+		this.cpus = cpus;
+		this.speed = speed;
+		this.minRam = minRam;
+		this.maxRam = maxRam;
+		this.vm = new VirtualMachineTO(1L, vmName, null, cpus, speed, minRam, maxRam, null, null, false, false, null);
+		/*vm.setName(vmName);
+		vm.setCpus(cpus);
+		vm.setRam(minRam, maxRam);*/
+	}
+
+	public void setCpus(int cpus) {
+		this.cpus = cpus;
+	}
+
+	public Integer getSpeed() {
+		return speed;
+	}
+
+	public void setSpeed(Integer speed) {
+		this.speed = speed;
+	}
+
+	public long getMinRam() {
+		return minRam;
+	}
+
+	public void setMinRam(long minRam) {
+		this.minRam = minRam;
+	}
+
+	public long getMaxRam() {
+		return maxRam;
+	}
+
+	public void setMaxRam(long maxRam) {
+		this.maxRam = maxRam;
+	}
+
+	public String getVmName() {
+		return vmName;
+	}
+
+	public void setVmName(String vmName) {
+		this.vmName = vmName;
+	}
+
+	public VirtualMachineTO getVirtualMachine() {
+        return vm;
+    }
+    
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+    
+    protected ScaleVmCommand() {
+    }
+    
+    public ScaleVmCommand(VirtualMachineTO vm) {
+        this.vm = vm;
+    }
+
+	public boolean getLimitCpuUse() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java b/core/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java
new file mode 100755
index 0000000..e938de7
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java
@@ -0,0 +1,32 @@
+// 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.agent.api;
+
+/*
+ * This is used to schedule an explicit host scan in MS peers. Currently used during
+ * add host operation so that correct MS can take host ownership. On receiving the
+ * command the scan is scheduled immediately.
+ */
+public class ScheduleHostScanTaskCommand extends Command {
+    public ScheduleHostScanTaskCommand() {
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false; // standalone command and can be executed independent of other commands
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java b/core/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java
new file mode 100755
index 0000000..41a779b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java
@@ -0,0 +1,82 @@
+// 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.agent.api;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SecStorageFirewallCfgCommand extends Command {
+
+	public static class PortConfig {
+		boolean add;
+		String sourceIp;
+		String port;
+		String intf;
+		public PortConfig(String sourceIp, String port, boolean add, String intf) {
+			this.add = add;
+			this.sourceIp = sourceIp;
+			this.port = port;
+			this.intf = intf;
+		}
+		public PortConfig() {
+
+		}
+		public boolean isAdd() {
+			return add;
+		}
+		public String getSourceIp() {
+			return sourceIp;
+		}
+		public String getPort() {
+			return port;
+		}
+		public String getIntf() {
+			return intf;
+		}
+	}
+
+	private List<PortConfig> portConfigs = new ArrayList<PortConfig>();
+	private boolean isAppendAIp = false;
+
+	public SecStorageFirewallCfgCommand() {
+
+	}
+
+	public SecStorageFirewallCfgCommand(boolean isAppend) {
+    	this.isAppendAIp = isAppend;
+	}
+
+    public void addPortConfig(String sourceIp, String port, boolean add, String intf) {
+    	PortConfig pc = new PortConfig(sourceIp, port, add, intf);
+    	this.portConfigs.add(pc);
+
+    }
+
+	public boolean getIsAppendAIp() {
+		return isAppendAIp;
+	}
+
+	@Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+
+	public List<PortConfig> getPortConfigs() {
+		return portConfigs;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SecStorageSetupAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SecStorageSetupAnswer.java b/core/src/com/cloud/agent/api/SecStorageSetupAnswer.java
new file mode 100644
index 0000000..bb0c016
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SecStorageSetupAnswer.java
@@ -0,0 +1,33 @@
+// 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.agent.api;
+
+public class SecStorageSetupAnswer extends Answer {
+    private String _dir;
+	protected SecStorageSetupAnswer() {
+	}
+
+	public SecStorageSetupAnswer(String dir) {
+		super(null, true, "success");
+	    this._dir = dir;
+	}
+
+    public String get_dir() {
+        return _dir;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SecStorageSetupCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SecStorageSetupCommand.java b/core/src/com/cloud/agent/api/SecStorageSetupCommand.java
new file mode 100644
index 0000000..50c06cf
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SecStorageSetupCommand.java
@@ -0,0 +1,83 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+
+public class SecStorageSetupCommand extends Command {
+	private String secUrl;
+	private Certificates certs;
+
+	public static class Certificates {
+	    @LogLevel(Log4jLevel.Off)
+		private String privKey;
+	    @LogLevel(Log4jLevel.Off)
+		private String privCert;
+	    @LogLevel(Log4jLevel.Off)
+		private String certChain;
+
+	    public Certificates() {
+
+	    }
+
+	    public Certificates(String prvKey, String privCert, String certChain) {
+	    	this.privKey = prvKey;
+	    	this.privCert = privCert;
+	    	this.certChain = certChain;
+	    }
+
+	    public String getPrivKey() {
+	    	return this.privKey;
+	    }
+
+	    public String getPrivCert() {
+	    	return this.privCert;
+	    }
+
+	    public String getCertChain() {
+	    	return this.certChain;
+	    }
+	}
+
+	public SecStorageSetupCommand() {
+		super();
+	}
+
+	public SecStorageSetupCommand(String secUrl, Certificates certs) {
+		super();
+		this.secUrl = secUrl;
+		this.certs = certs;
+	}
+
+	@Override
+	public boolean executeInSequence() {
+		return true;
+	}
+
+    public String getSecUrl() {
+        return secUrl;
+    }
+
+    public Certificates getCerts() {
+    	return this.certs;
+    }
+
+    public void setSecUrl(String secUrl) {
+        this.secUrl = secUrl;
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SecStorageVMSetupCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SecStorageVMSetupCommand.java b/core/src/com/cloud/agent/api/SecStorageVMSetupCommand.java
new file mode 100644
index 0000000..be97709
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SecStorageVMSetupCommand.java
@@ -0,0 +1,57 @@
+// 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.agent.api;
+
+public class SecStorageVMSetupCommand extends Command {
+	String [] allowedInternalSites = new String[0];
+	String copyUserName;
+	String copyPassword;
+
+	public SecStorageVMSetupCommand() {
+		super();
+	}
+
+	@Override
+	public boolean executeInSequence() {
+		return true;
+	}
+
+	public String[] getAllowedInternalSites() {
+		return allowedInternalSites;
+	}
+
+	public void setAllowedInternalSites(String[] allowedInternalSites) {
+		this.allowedInternalSites = allowedInternalSites;
+	}
+
+	public String getCopyUserName() {
+		return copyUserName;
+	}
+
+	public void setCopyUserName(String copyUserName) {
+		this.copyUserName = copyUserName;
+	}
+
+	public String getCopyPassword() {
+		return copyPassword;
+	}
+
+	public void setCopyPassword(String copyPassword) {
+		this.copyPassword = copyPassword;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SecurityGroupRuleAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SecurityGroupRuleAnswer.java b/core/src/com/cloud/agent/api/SecurityGroupRuleAnswer.java
new file mode 100644
index 0000000..144fea2
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SecurityGroupRuleAnswer.java
@@ -0,0 +1,70 @@
+// 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.agent.api;
+
+public class SecurityGroupRuleAnswer extends Answer {
+    public static enum FailureReason {
+        NONE,
+        UNKNOWN,
+        PROGRAMMING_FAILED,
+        CANNOT_BRIDGE_FIREWALL
+    }
+    Long logSequenceNumber = null;
+    Long vmId = null;
+    FailureReason reason = FailureReason.NONE;
+
+
+    protected SecurityGroupRuleAnswer() {
+    }
+
+    public SecurityGroupRuleAnswer(SecurityGroupRulesCmd cmd) {
+    	super(cmd);
+        this.logSequenceNumber = cmd.getSeqNum();
+        this.vmId = cmd.getVmId();
+    }
+
+    public SecurityGroupRuleAnswer(SecurityGroupRulesCmd cmd, boolean result, String detail) {
+        super(cmd, result, detail);
+        this.logSequenceNumber = cmd.getSeqNum();
+        this.vmId = cmd.getVmId();
+        reason = FailureReason.PROGRAMMING_FAILED;
+    }
+
+    public SecurityGroupRuleAnswer(SecurityGroupRulesCmd cmd, boolean result, String detail, FailureReason r) {
+        super(cmd, result, detail);
+        this.logSequenceNumber = cmd.getSeqNum();
+        this.vmId = cmd.getVmId();
+        reason = r;
+    }
+
+    public Long getLogSequenceNumber() {
+        return logSequenceNumber;
+    }
+
+    public Long getVmId() {
+        return vmId;
+    }
+
+    public FailureReason getReason() {
+        return reason;
+    }
+
+    public void setReason(FailureReason reason) {
+        this.reason = reason;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SecurityGroupRulesCmd.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SecurityGroupRulesCmd.java b/core/src/com/cloud/agent/api/SecurityGroupRulesCmd.java
new file mode 100644
index 0000000..4336b4c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SecurityGroupRulesCmd.java
@@ -0,0 +1,304 @@
+// 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.agent.api;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.zip.DeflaterOutputStream;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.utils.net.NetUtils;
+
+
+public class SecurityGroupRulesCmd extends Command {
+    private static Logger s_logger = Logger.getLogger(SecurityGroupRulesCmd.class);
+    public static class IpPortAndProto {
+        private String proto;
+        private int startPort;
+        private int endPort;
+        @LogLevel(Log4jLevel.Trace)
+        private String [] allowedCidrs;
+
+        public IpPortAndProto() { }
+
+        public IpPortAndProto(String proto, int startPort, int endPort,
+                String[] allowedCidrs) {
+            super();
+            this.proto = proto;
+            this.startPort = startPort;
+            this.endPort = endPort;
+            this.allowedCidrs = allowedCidrs;
+        }
+
+        public String[] getAllowedCidrs() {
+            return allowedCidrs;
+        }
+
+        public void setAllowedCidrs(String[] allowedCidrs) {
+            this.allowedCidrs = allowedCidrs;
+        }
+
+        public String getProto() {
+            return proto;
+        }
+
+        public int getStartPort() {
+            return startPort;
+        }
+
+        public int getEndPort() {
+            return endPort;
+        }
+
+    }
+
+
+    String guestIp;
+    String vmName;
+    String guestMac;
+    String signature;
+    Long seqNum;
+    Long vmId;
+    Long msId;
+    IpPortAndProto [] ingressRuleSet;
+    IpPortAndProto [] egressRuleSet;
+    private List<String> secIps;
+
+    public SecurityGroupRulesCmd() {
+        super();
+    }
+
+
+    public SecurityGroupRulesCmd(String guestIp, String guestMac, String vmName, Long vmId, String signature, Long seqNum, IpPortAndProto[] ingressRuleSet, IpPortAndProto[] egressRuleSet) {
+        super();
+        this.guestIp = guestIp;
+        this.vmName = vmName;
+        this.ingressRuleSet = ingressRuleSet;
+        this.egressRuleSet = egressRuleSet;
+        this.guestMac = guestMac;
+        this.signature = signature;
+        this.seqNum = seqNum;
+        this.vmId  = vmId;
+        if (signature == null) {
+            String stringified = stringifyRules();
+            this.signature = DigestUtils.md5Hex(stringified);
+        }
+    }
+
+
+    public SecurityGroupRulesCmd(String guestIp, String guestMac, String vmName, Long vmId, String signature, Long seqNum, IpPortAndProto[] ingressRuleSet, IpPortAndProto[] egressRuleSet, List<String> secIps) {
+        super();
+        this.guestIp = guestIp;
+        this.vmName = vmName;
+        this.ingressRuleSet = ingressRuleSet;
+        this.egressRuleSet = egressRuleSet;
+        this.guestMac = guestMac;
+        this.signature = signature;
+        this.seqNum = seqNum;
+        this.vmId  = vmId;
+        if (signature == null) {
+            String stringified = stringifyRules();
+            this.signature = DigestUtils.md5Hex(stringified);
+        }
+        this.secIps = secIps;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+
+    public IpPortAndProto[] getIngressRuleSet() {
+        return ingressRuleSet;
+    }
+
+
+    public void setIngressRuleSet(IpPortAndProto[] ingressRuleSet) {
+        this.ingressRuleSet = ingressRuleSet;
+    }
+
+    public IpPortAndProto[] getEgressRuleSet() {
+        return egressRuleSet;
+    }
+
+
+    public void setEgressRuleSet(IpPortAndProto[] egressRuleSet) {
+        this.egressRuleSet = egressRuleSet;
+    }
+
+    public String getGuestIp() {
+        return guestIp;
+    }
+
+    public List<String> getSecIps() {
+        return secIps;
+    }
+
+
+    public String getVmName() {
+        return vmName;
+    }
+
+    public String stringifyRules() {
+        StringBuilder ruleBuilder = new StringBuilder();
+        for (SecurityGroupRulesCmd.IpPortAndProto ipPandP: getIngressRuleSet()) {
+            ruleBuilder.append("I:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
+            for (String cidr: ipPandP.getAllowedCidrs()) {
+                ruleBuilder.append(cidr).append(",");
+            }
+            ruleBuilder.append("NEXT");
+            ruleBuilder.append(" ");
+        }
+        for (SecurityGroupRulesCmd.IpPortAndProto ipPandP: getEgressRuleSet()) {
+            ruleBuilder.append("E:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
+            for (String cidr: ipPandP.getAllowedCidrs()) {
+                ruleBuilder.append(cidr).append(",");
+            }
+            ruleBuilder.append("NEXT");
+            ruleBuilder.append(" ");
+        }
+        return ruleBuilder.toString();
+    }
+
+    //convert cidrs in the form "a.b.c.d/e" to "hexvalue of 32bit ip/e"
+    private String compressCidr(String cidr) {
+        String [] toks = cidr.split("/");
+        long ipnum = NetUtils.ip2Long(toks[0]);
+        return Long.toHexString(ipnum) + "/" + toks[1];
+    }
+
+
+    public String getSecIpsString() {
+        StringBuilder sb = new StringBuilder();
+        List<String> ips = getSecIps();
+        if (ips == null) {
+            return "0:";
+        } else {
+            for (String ip : ips) {
+                sb.append(ip).append(":");
+            }
+        }
+        return sb.toString();
+    }
+
+
+    public String stringifyCompressedRules() {
+        StringBuilder ruleBuilder = new StringBuilder();
+        for (SecurityGroupRulesCmd.IpPortAndProto ipPandP : getIngressRuleSet()) {
+            ruleBuilder.append("I:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
+            for (String cidr: ipPandP.getAllowedCidrs()) {
+                //convert cidrs in the form "a.b.c.d/e" to "hexvalue of 32bit ip/e"
+                ruleBuilder.append(compressCidr(cidr)).append(",");
+            }
+            ruleBuilder.append("NEXT");
+            ruleBuilder.append(" ");
+        }
+        for (SecurityGroupRulesCmd.IpPortAndProto ipPandP : getEgressRuleSet()) {
+            ruleBuilder.append("E:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
+            for (String cidr: ipPandP.getAllowedCidrs()) {
+                //convert cidrs in the form "a.b.c.d/e" to "hexvalue of 32bit ip/e"
+                ruleBuilder.append(compressCidr(cidr)).append(",");
+            }
+            ruleBuilder.append("NEXT");
+            ruleBuilder.append(" ");
+        }
+        return ruleBuilder.toString();
+    }
+
+    /*
+     * Compress the security group rules using zlib compression to allow the call to the hypervisor
+     * to scale beyond 8k cidrs.
+     */
+    public String compressStringifiedRules() {
+        StringBuilder ruleBuilder = new StringBuilder();
+        for (SecurityGroupRulesCmd.IpPortAndProto ipPandP: getIngressRuleSet()) {
+            ruleBuilder.append("I:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
+            for (String cidr: ipPandP.getAllowedCidrs()) {
+                ruleBuilder.append(cidr).append(",");
+            }
+            ruleBuilder.append("NEXT");
+            ruleBuilder.append(" ");
+        }
+        for (SecurityGroupRulesCmd.IpPortAndProto ipPandP: getEgressRuleSet()) {
+            ruleBuilder.append("E:").append(ipPandP.getProto()).append(":").append(ipPandP.getStartPort()).append(":").append(ipPandP.getEndPort()).append(":");
+            for (String cidr: ipPandP.getAllowedCidrs()) {
+                ruleBuilder.append(cidr).append(",");
+            }
+            ruleBuilder.append("NEXT");
+            ruleBuilder.append(" ");
+        }
+        String stringified = ruleBuilder.toString();
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        try {
+            //Note : not using GZipOutputStream since that is for files
+            //GZipOutputStream gives a different header, although the compression is the same
+            DeflaterOutputStream dzip = new DeflaterOutputStream(out);
+            dzip.write(stringified.getBytes());
+            dzip.close();
+        } catch (IOException e) {
+            s_logger.warn("Exception while compressing security group rules");
+            return null;
+        }
+        return Base64.encodeBase64String(out.toByteArray());
+    }
+
+    public String getSignature() {
+        return signature;
+    }
+
+
+    public String getGuestMac() {
+        return guestMac;
+    }
+
+
+    public Long getSeqNum() {
+        return seqNum;
+    }
+
+
+    public Long getVmId() {
+        return vmId;
+    }
+
+    public int getTotalNumCidrs() {
+        //useful for logging
+        int count = 0;
+        for (IpPortAndProto i: ingressRuleSet) {
+            count += i.allowedCidrs.length;
+        }
+        for (IpPortAndProto i: egressRuleSet) {
+            count += i.allowedCidrs.length;
+        }
+        return count;
+    }
+
+    public void setMsId(long msId) {
+        this.msId = msId;
+    }
+
+    public Long getMsId() {
+        return msId;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SetupAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SetupAnswer.java b/core/src/com/cloud/agent/api/SetupAnswer.java
new file mode 100644
index 0000000..97252a2
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SetupAnswer.java
@@ -0,0 +1,37 @@
+// 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.agent.api;
+
+public class SetupAnswer extends Answer {
+    // indicate if agent reconnect is needed after setup command
+    private boolean _reconnect;
+    public SetupAnswer() {}
+
+    public SetupAnswer(SetupCommand cmd, boolean reconnect) {
+        super(cmd, true, null);
+        _reconnect = reconnect;
+    }
+
+    public SetupAnswer(SetupCommand cmd, String details) {
+        super(cmd, false, details);
+        _reconnect = true;
+    }
+    public boolean needReconnect() {
+        return _reconnect;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SetupCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SetupCommand.java b/core/src/com/cloud/agent/api/SetupCommand.java
new file mode 100644
index 0000000..ee43c59
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SetupCommand.java
@@ -0,0 +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.agent.api;
+
+import com.cloud.host.HostEnvironment;
+
+public class SetupCommand extends Command {
+
+    HostEnvironment env;
+    boolean multipath;
+    boolean needSetup;
+
+    public boolean needSetup() {
+        return needSetup;
+    }
+
+    public void setNeedSetup(boolean setup) {
+        this.needSetup = setup;
+    }
+
+    public SetupCommand(HostEnvironment env) {
+        this.env = env;
+        this.multipath = false;
+        this.needSetup = false;
+    }
+
+    public HostEnvironment getEnvironment() {
+        return env;
+    }
+
+    protected SetupCommand() {
+    }
+
+    public void setMultipathOn() {
+        this.multipath = true;
+    }
+
+    public boolean useMultipath() {
+        return multipath;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SetupGuestNetworkAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SetupGuestNetworkAnswer.java b/core/src/com/cloud/agent/api/SetupGuestNetworkAnswer.java
new file mode 100644
index 0000000..972a1c2
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SetupGuestNetworkAnswer.java
@@ -0,0 +1,25 @@
+// 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.agent.api;
+
+public class SetupGuestNetworkAnswer extends Answer{
+    public SetupGuestNetworkAnswer() {}
+
+    public SetupGuestNetworkAnswer(SetupGuestNetworkCommand cmd, boolean success, String result) {
+        super(cmd, success, result);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SetupGuestNetworkCommand.java b/core/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
new file mode 100644
index 0000000..2cf5bf8
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
@@ -0,0 +1,72 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.routing.NetworkElementCommand;
+import com.cloud.agent.api.to.NicTO;
+
+public class SetupGuestNetworkCommand extends NetworkElementCommand{
+    String dhcpRange;
+    String networkDomain;
+    String defaultDns1 = null;
+    String defaultDns2 = null;
+    boolean isRedundant = false;
+    Integer priority;
+    boolean add = true;
+    NicTO nic;
+
+    public NicTO getNic() {
+        return nic;
+    }
+
+    public String getDefaultDns1() {
+        return defaultDns1;
+    }
+
+    public String getDefaultDns2() {
+        return defaultDns2;
+    }
+
+    public String getNetworkDomain() {
+        return networkDomain;
+    }
+
+    public boolean isAdd() {
+       return add;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    protected SetupGuestNetworkCommand() {
+    }
+
+
+    public SetupGuestNetworkCommand(String dhcpRange, String networkDomain, boolean isRedundant, Integer priority,
+            String defaultDns1, String defaultDns2, boolean add, NicTO nic) {
+        this.dhcpRange = dhcpRange;
+        this.networkDomain = networkDomain;
+        this.defaultDns1 = defaultDns1;
+        this.defaultDns2 = defaultDns2;
+        this.isRedundant = isRedundant;
+        this.priority = priority;
+        this.add = add;
+        this.nic = nic;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ShutdownCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ShutdownCommand.java b/core/src/com/cloud/agent/api/ShutdownCommand.java
new file mode 100644
index 0000000..5412f35
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ShutdownCommand.java
@@ -0,0 +1,56 @@
+// 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.agent.api;
+
+/**
+ *
+ */
+public class ShutdownCommand extends Command {
+    public static final String Requested = "sig.kill";
+    public static final String Update = "update";
+    public static final String Unknown = "unknown";
+    public static final String DeleteHost = "deleteHost";
+
+    private String reason;
+    private String detail;
+
+    protected ShutdownCommand() {
+        super();
+    }
+
+    public ShutdownCommand(String reason, String detail) {
+        super();
+        this.reason = reason;
+        this.detail = detail;
+    }
+
+    /**
+     * @return return the reason the agent shutdown.  If Unknown, call getDetail() for any details.
+     */
+    public String getReason() {
+        return reason;
+    }
+
+    public String getDetail() {
+        return detail;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/SnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SnapshotCommand.java b/core/src/com/cloud/agent/api/SnapshotCommand.java
new file mode 100644
index 0000000..d8abeb6
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SnapshotCommand.java
@@ -0,0 +1,126 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.StoragePool;
+
+/**
+ * This currently assumes that both primary and secondary storage are mounted on
+ * the XenServer.
+ */
+public class SnapshotCommand extends Command {
+    protected String primaryStoragePoolNameLabel;
+    StorageFilerTO primaryPool;
+    private String snapshotUuid;
+    private String snapshotName;
+    private String secondaryStorageUrl;
+    private Long dcId;
+    private Long accountId;
+    private Long volumeId;
+    private String volumePath;
+
+    protected SnapshotCommand() {
+
+    }
+
+    /**
+     * @param primaryStoragePoolNameLabel
+     *            The primary storage Pool
+     * @param snapshotUuid
+     *            The UUID of the snapshot which is going to be backed up
+     * @param secondaryStoragePoolURL
+     *            This is what shows up in the UI when you click on Secondary
+     *            storage. In the code, it is present as: In the
+     *            vmops.host_details table, there is a field mount.parent. This
+     *            is the value of that field If you have better ideas on how to
+     *            get it, you are welcome.
+     */
+    public SnapshotCommand(StoragePool pool,
+            String secondaryStorageUrl, String snapshotUuid,
+            String snapshotName, Long dcId, Long accountId, Long volumeId) {
+        this.primaryStoragePoolNameLabel = pool.getUuid();
+        this.primaryPool = new StorageFilerTO(pool);
+        this.snapshotUuid = snapshotUuid;
+        this.secondaryStorageUrl = secondaryStorageUrl;
+        this.dcId = dcId;
+        this.accountId = accountId;
+        this.volumeId = volumeId;
+        this.snapshotName = snapshotName;
+    }
+
+    /**
+     * @return the primaryStoragePoolNameLabel
+     */
+    public String getPrimaryStoragePoolNameLabel() {
+        return primaryStoragePoolNameLabel;
+    }
+
+    /**
+     * @return the primaryPool
+     */
+    public StorageFilerTO getPool() {
+        return primaryPool;
+    }
+
+    /**
+     * @return the snapshotUuid
+     */
+    public String getSnapshotUuid() {
+        return snapshotUuid;
+    }
+
+    public String getSnapshotName() {
+        return snapshotName;
+    }
+
+    /**
+     * @return the secondaryStoragePoolURL
+     */
+    public String getSecondaryStorageUrl() {
+        return secondaryStorageUrl;
+    }
+
+    public Long getDataCenterId() {
+        return dcId;
+    }
+
+    public Long getAccountId() {
+        return accountId;
+    }
+
+    public Long getVolumeId() {
+        return volumeId;
+    }
+
+    public String getVolumePath() {
+        return volumePath;
+    }
+
+    public void setVolumePath(String path) {
+        volumePath = path;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartAnswer.java b/core/src/com/cloud/agent/api/StartAnswer.java
new file mode 100644
index 0000000..922d060
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartAnswer.java
@@ -0,0 +1,57 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.to.VirtualMachineTO;
+
+public class StartAnswer extends Answer {
+    VirtualMachineTO vm;
+    String host_guid;
+
+    protected StartAnswer() {
+    }
+
+    public StartAnswer(StartCommand cmd, String msg) {
+        super(cmd, false, msg);
+        this.vm  = cmd.getVirtualMachine();
+    }
+
+    public StartAnswer(StartCommand cmd, Exception e) {
+        super(cmd, false, e.getMessage());
+        this.vm  = cmd.getVirtualMachine();
+    }
+
+    public StartAnswer(StartCommand cmd) {
+        super(cmd, true, null);
+        this.vm  = cmd.getVirtualMachine();
+        this.host_guid = null;
+    }
+
+    public StartAnswer(StartCommand cmd, String msg, String guid) {
+        super(cmd, true, msg);
+        this.vm  = cmd.getVirtualMachine();
+        this.host_guid = guid;
+    }
+
+    public VirtualMachineTO getVirtualMachine() {
+        return vm;
+    }
+
+    public String getHost_guid() {
+        return host_guid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartCommand.java b/core/src/com/cloud/agent/api/StartCommand.java
new file mode 100644
index 0000000..ec707d6
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartCommand.java
@@ -0,0 +1,52 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.to.VirtualMachineTO;
+import com.cloud.host.Host;
+
+/**
+ */
+public class StartCommand extends Command {
+    VirtualMachineTO vm;
+    String hostIp;
+
+    public VirtualMachineTO getVirtualMachine() {
+        return vm;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+
+    protected StartCommand() {
+    }
+
+    public StartCommand(VirtualMachineTO vm) {
+        this.vm = vm;
+    }
+
+    public StartCommand(VirtualMachineTO vm, Host host) {
+        this.vm = vm;
+        this.hostIp = host.getPrivateIpAddress();
+    }
+
+    public String getHostIp() {
+        return this.hostIp;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartupAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupAnswer.java b/core/src/com/cloud/agent/api/StartupAnswer.java
new file mode 100755
index 0000000..c0925cb
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartupAnswer.java
@@ -0,0 +1,44 @@
+// 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.agent.api;
+
+
+public class StartupAnswer extends Answer {
+    long hostId;
+    int pingInterval;
+
+    protected StartupAnswer() {
+    }
+
+    public StartupAnswer(StartupCommand cmd, long hostId, int pingInterval) {
+        super(cmd);
+        this.hostId = hostId;
+        this.pingInterval = pingInterval;
+    }
+
+    public StartupAnswer(StartupCommand cmd, String details) {
+        super(cmd, false, details);
+    }
+
+    public long getHostId() {
+        return hostId;
+    }
+
+    public int getPingInterval() {
+        return pingInterval;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartupCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupCommand.java b/core/src/com/cloud/agent/api/StartupCommand.java
new file mode 100755
index 0000000..dd2d390
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartupCommand.java
@@ -0,0 +1,286 @@
+// 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.agent.api;
+
+import com.cloud.host.Host;
+
+public class StartupCommand extends Command {
+    Host.Type type;
+    String dataCenter;
+    String pod;
+    String cluster;
+    String guid;
+    String name;
+    Long id;
+    String version;
+    String iqn;
+    String publicIpAddress;
+    String publicNetmask;
+    String publicMacAddress;
+    String privateIpAddress;
+    String privateMacAddress;
+    String privateNetmask;
+    String storageIpAddress;
+    String storageNetmask;
+    String storageMacAddress;
+    String storageIpAddressDeux;
+    String storageMacAddressDeux;
+    String storageNetmaskDeux;
+    String agentTag;
+    String resourceName;
+    String gatewayIpAddress;
+
+    public StartupCommand(Host.Type type) {
+        this.type = type;
+    }
+
+    public StartupCommand(Long id, Host.Type type, String name, String dataCenter, String pod, String guid, String version) {
+        super();
+        this.id = id;
+        this.dataCenter = dataCenter;
+        this.pod = pod;
+        this.guid = guid;
+        this.name = name;
+        this.version = version;
+        this.type = type;
+    }
+
+    public StartupCommand(Long id, Host.Type type, String name, String dataCenter, String pod, String guid, String version, String gatewayIpAddress) {
+		this(id, type, name, dataCenter, pod, guid, version);
+		this.gatewayIpAddress = gatewayIpAddress;
+    }
+
+    public Host.Type getHostType() {
+        return type;
+    }
+
+    public void setHostType(Host.Type type) {
+    	this.type = type;
+    }
+
+    public String getIqn() {
+        return iqn;
+    }
+
+    public void setCluster(String cluster) {
+        this.cluster = cluster;
+    }
+
+    public String getCluster() {
+        return cluster;
+    }
+
+    public void setIqn(String iqn) {
+        this.iqn = iqn;
+    }
+
+    public String getDataCenter() {
+        return dataCenter;
+    }
+
+    public String getPod() {
+        return pod;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getStorageIpAddressDeux() {
+		return storageIpAddressDeux;
+	}
+
+	public void setStorageIpAddressDeux(String storageIpAddressDeux) {
+		this.storageIpAddressDeux = storageIpAddressDeux;
+	}
+
+	public String getStorageMacAddressDeux() {
+		return storageMacAddressDeux;
+	}
+
+	public void setStorageMacAddressDeux(String storageMacAddressDeux) {
+		this.storageMacAddressDeux = storageMacAddressDeux;
+	}
+
+	public String getStorageNetmaskDeux() {
+		return storageNetmaskDeux;
+	}
+
+	public void setStorageNetmaskDeux(String storageNetmaskDeux) {
+		this.storageNetmaskDeux = storageNetmaskDeux;
+	}
+
+	public String getGuid() {
+        return guid;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setDataCenter(String dataCenter) {
+        this.dataCenter = dataCenter;
+    }
+
+    public void setPod(String pod) {
+        this.pod = pod;
+    }
+
+    public void setGuid(String guid) {
+        this.guid = guid;
+    }
+
+    public void setGuid(String guid, String resourceName) {
+    	this.resourceName = resourceName;
+    	this.guid = guid + "-" + resourceName;
+    }
+
+    public String getPublicNetmask() {
+        return publicNetmask;
+    }
+
+    public void setPublicNetmask(String publicNetmask) {
+        this.publicNetmask = publicNetmask;
+    }
+
+    public String getPublicMacAddress() {
+        return publicMacAddress;
+    }
+
+    public void setPublicMacAddress(String publicMacAddress) {
+        this.publicMacAddress = publicMacAddress;
+    }
+
+    public String getPrivateIpAddress() {
+        return privateIpAddress;
+    }
+
+    public void setPrivateIpAddress(String privateIpAddress) {
+        this.privateIpAddress = privateIpAddress;
+    }
+
+    public String getPrivateMacAddress() {
+        return privateMacAddress;
+    }
+
+    public void setPrivateMacAddress(String privateMacAddress) {
+        this.privateMacAddress = privateMacAddress;
+    }
+
+    public String getPrivateNetmask() {
+        return privateNetmask;
+    }
+
+    public void setPrivateNetmask(String privateNetmask) {
+        this.privateNetmask = privateNetmask;
+    }
+
+    public String getStorageIpAddress() {
+        return storageIpAddress;
+    }
+
+    public void setStorageIpAddress(String storageIpAddress) {
+        this.storageIpAddress = storageIpAddress;
+    }
+
+    public String getStorageNetmask() {
+        return storageNetmask;
+    }
+
+    public void setStorageNetmask(String storageNetmask) {
+        this.storageNetmask = storageNetmask;
+    }
+
+    public String getStorageMacAddress() {
+        return storageMacAddress;
+    }
+
+    public void setStorageMacAddress(String storageMacAddress) {
+        this.storageMacAddress = storageMacAddress;
+    }
+
+    public String getPublicIpAddress() {
+        return publicIpAddress;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public void setPublicIpAddress(String publicIpAddress) {
+        this.publicIpAddress = publicIpAddress;
+    }
+
+    public String getAgentTag() {
+    	return agentTag;
+    }
+
+    public void setAgentTag(String tag) {
+    	agentTag = tag;
+    }
+
+    public void setResourceName(String resourceName) {
+    	this.resourceName = resourceName;
+    }
+
+    public String getGuidWithoutResource() {
+    	if (resourceName == null) {
+            return guid;
+        } else {
+    	  int hyph = guid.lastIndexOf('-');
+    	  if (hyph == -1) {
+    		  return guid;
+    	  }
+    	  String tmpResource = guid.substring(hyph+1, guid.length());
+    	  if (resourceName.equals(tmpResource)){
+    		  return guid.substring(0, hyph);
+    	  } else {
+    		  return guid;
+    	  }
+    	}
+    }
+
+    public String getResourceName() {
+    	return resourceName;
+    }
+
+    public String getGatewayIpAddress() {
+        return gatewayIpAddress;
+    }
+
+    public void setGatewayIpAddress(String gatewayIpAddress) {
+        this.gatewayIpAddress = gatewayIpAddress;
+    }
+
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartupExternalDhcpCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupExternalDhcpCommand.java b/core/src/com/cloud/agent/api/StartupExternalDhcpCommand.java
new file mode 100644
index 0000000..b71f635
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartupExternalDhcpCommand.java
@@ -0,0 +1,25 @@
+// 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.agent.api;
+
+import com.cloud.host.Host;
+
+public class StartupExternalDhcpCommand extends StartupCommand {
+	public StartupExternalDhcpCommand() {
+		super(Host.Type.ExternalDhcp);
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartupExternalFirewallCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupExternalFirewallCommand.java b/core/src/com/cloud/agent/api/StartupExternalFirewallCommand.java
new file mode 100644
index 0000000..c4ed107
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartupExternalFirewallCommand.java
@@ -0,0 +1,26 @@
+// 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.agent.api;
+
+import com.cloud.host.Host;
+
+public class StartupExternalFirewallCommand extends StartupCommand {
+
+    public StartupExternalFirewallCommand() {
+        super(Host.Type.ExternalFirewall);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java b/core/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java
new file mode 100644
index 0000000..1e7a5f1
--- /dev/null
+++ b/core/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java
@@ -0,0 +1,26 @@
+// 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.agent.api;
+
+import com.cloud.host.Host;
+
+public class StartupExternalLoadBalancerCommand extends StartupCommand {
+    public StartupExternalLoadBalancerCommand() {
+        super(Host.Type.ExternalLoadBalancer);
+    }
+
+}


[52/57] [abbrv] git commit: updated refs/heads/master to f84b6ab

Posted by ni...@apache.org.
build master


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

Branch: refs/heads/master
Commit: e107776d75ae55e187b396cbf48c847734d24510
Parents: c11dbad
Author: Nitin Mehta <ni...@citrix.com>
Authored: Sun May 12 13:14:33 2013 +0530
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Sun May 12 13:14:33 2013 +0530

----------------------------------------------------------------------
 .../src/com/cloud/network/NetworkServiceImpl.java  |  820 +++++++++++----
 server/src/com/cloud/vm/UserVmManagerImpl.java     |    5 +-
 .../com/cloud/network/MockNetworkManagerImpl.java  |    2 +-
 .../test/com/cloud/vpc/MockNetworkManagerImpl.java |    8 +-
 4 files changed, 606 insertions(+), 229 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e107776d/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index c3f87f3..85fa979 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -5,7 +5,7 @@
 // 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,
@@ -16,13 +16,54 @@
 // under the License.
 package com.cloud.network;
 
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.security.InvalidParameterException;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.UUID;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.apache.cloudstack.acl.ControlledEntity.ACLType;
+import org.apache.cloudstack.acl.SecurityChecker;
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
+import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
+import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
+import org.apache.cloudstack.api.command.user.network.*;
+import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
+import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
 import com.cloud.configuration.Config;
 import com.cloud.configuration.ConfigurationManager;
 import com.cloud.configuration.dao.ConfigurationDao;
-import com.cloud.dc.*;
+import com.cloud.dc.DataCenter;
 import com.cloud.dc.DataCenter.NetworkType;
+import com.cloud.dc.DataCenterVO;
+import com.cloud.dc.DataCenterVnetVO;
+import com.cloud.dc.Pod;
 import com.cloud.dc.Vlan.VlanType;
-import com.cloud.dc.dao.*;
+import com.cloud.dc.VlanVO;
+import com.cloud.dc.dao.AccountVlanMapDao;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.dc.dao.DataCenterVnetDao;
+import com.cloud.dc.dao.HostPodDao;
+import com.cloud.dc.dao.VlanDao;
 import com.cloud.deploy.DeployDestination;
 import com.cloud.domain.Domain;
 import com.cloud.domain.DomainVO;
@@ -32,7 +73,14 @@ import com.cloud.event.EventTypes;
 import com.cloud.event.UsageEventUtils;
 import com.cloud.event.dao.EventDao;
 import com.cloud.event.dao.UsageEventDao;
-import com.cloud.exception.*;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientAddressCapacityException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.PermissionDeniedException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.UnsupportedServiceException;
 import com.cloud.host.dao.HostDao;
 import com.cloud.network.IpAddress.State;
 import com.cloud.network.Network.Capability;
@@ -44,7 +92,22 @@ import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.PhysicalNetwork.BroadcastDomainRange;
 import com.cloud.network.VirtualRouterProvider.VirtualRouterProviderType;
 import com.cloud.network.addr.PublicIp;
-import com.cloud.network.dao.*;
+import com.cloud.network.dao.AccountGuestVlanMapDao;
+import com.cloud.network.dao.AccountGuestVlanMapVO;
+import com.cloud.network.dao.FirewallRulesDao;
+import com.cloud.network.dao.IPAddressDao;
+import com.cloud.network.dao.IPAddressVO;
+import com.cloud.network.dao.NetworkDao;
+import com.cloud.network.dao.NetworkDomainDao;
+import com.cloud.network.dao.NetworkDomainVO;
+import com.cloud.network.dao.NetworkServiceMapDao;
+import com.cloud.network.dao.NetworkVO;
+import com.cloud.network.dao.PhysicalNetworkDao;
+import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
+import com.cloud.network.dao.PhysicalNetworkServiceProviderVO;
+import com.cloud.network.dao.PhysicalNetworkTrafficTypeDao;
+import com.cloud.network.dao.PhysicalNetworkTrafficTypeVO;
+import com.cloud.network.dao.PhysicalNetworkVO;
 import com.cloud.network.element.NetworkElement;
 import com.cloud.network.element.VirtualRouterElement;
 import com.cloud.network.element.VpcVirtualRouterElement;
@@ -68,7 +131,14 @@ import com.cloud.projects.ProjectManager;
 import com.cloud.server.ResourceTag.TaggedResourceType;
 import com.cloud.tags.ResourceTagVO;
 import com.cloud.tags.dao.ResourceTagDao;
-import com.cloud.user.*;
+import com.cloud.user.Account;
+import com.cloud.user.AccountManager;
+import com.cloud.user.AccountVO;
+import com.cloud.user.DomainManager;
+import com.cloud.user.ResourceLimitService;
+import com.cloud.user.User;
+import com.cloud.user.UserContext;
+import com.cloud.user.UserVO;
 import com.cloud.user.dao.AccountDao;
 import com.cloud.user.dao.UserDao;
 import com.cloud.utils.AnnotationHelper;
@@ -76,17 +146,40 @@ import com.cloud.utils.Journal;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
 import com.cloud.utils.component.ManagerBase;
-import com.cloud.utils.db.*;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.Filter;
+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.exception.CloudRuntimeException;
 import com.cloud.utils.net.NetUtils;
+import com.cloud.vm.Nic;
+import com.cloud.vm.NicSecondaryIp;
+import com.cloud.vm.NicVO;
+import com.cloud.vm.ReservationContext;
+import com.cloud.vm.ReservationContextImpl;
+import com.cloud.vm.SecondaryStorageVmVO;
+import com.cloud.vm.UserVmVO;
+import com.cloud.vm.VMInstanceVO;
+import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.dao.NicDao;
+import com.cloud.vm.dao.NicSecondaryIpDao;
+import com.cloud.vm.dao.NicSecondaryIpVO;
+import com.cloud.vm.dao.UserVmDao;
+import com.cloud.vm.dao.VMInstanceDao;
 import com.cloud.vm.*;
 import com.cloud.vm.dao.*;
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import org.apache.cloudstack.acl.SecurityChecker;
 import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
+import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
 import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
-import org.apache.cloudstack.api.command.user.network.*;
+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.vm.ListNicsCmd;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
@@ -103,6 +196,7 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.*;
 
+
 /**
  * NetworkServiceImpl implements NetworkService.
  */
@@ -147,9 +241,9 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
 
     @Inject
     UsageEventDao _usageEventDao;
-    
+
     @Inject List<NetworkGuru> _networkGurus;
-  
+
     @Inject
     NetworkDomainDao _networkDomainDao;
     @Inject
@@ -157,10 +251,10 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
 
     @Inject
     FirewallRulesDao _firewallDao;
-  
+
     @Inject
     ResourceLimitService _resourceLimitMgr;
-   
+
     @Inject
     DomainManager _domainMgr;
     @Inject
@@ -171,7 +265,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
     PhysicalNetworkDao _physicalNetworkDao;
     @Inject
     PhysicalNetworkServiceProviderDao _pNSPDao;
-    
+
     @Inject
     PhysicalNetworkTrafficTypeDao _pNTrafficTypeDao;
 
@@ -199,10 +293,12 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
     HostDao _hostDao;
     @Inject
     HostPodDao _hostPodDao;
+    @Inject 
+    InternalLoadBalancerElementService _internalLbElementSvc;
     @Inject
     DataCenterVnetDao _datacneter_vnet;
     @Inject
-    NicDetailDao _nicDetailDao = null;
+    AccountGuestVlanMapDao _accountGuestVlanMapDao;
 
     int _cidrLimit;
     boolean _allowSubdomainNetworkAccess;
@@ -251,7 +347,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
                 if (purposes == null || purposes.isEmpty()) {
                     // since no active rules are there check if any rules are applied on the public IP but are in
 // revoking state
-                    
+
                     purposes = getPublicIpPurposeInRules(ip, true, includingFirewall);
                     if (ip.isOneToOneNat()) {
                         if (purposes == null) {
@@ -368,9 +464,9 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         }
         return true;
     }
-    
 
-    
+
+
 
     private Set<Purpose> getPublicIpPurposeInRules(PublicIp ip, boolean includeRevoked, boolean includingFirewall) {
         Set<Purpose> result = new HashSet<Purpose>();
@@ -399,15 +495,15 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
 
         return _networksDao.listByZoneAndGuestType(owner.getId(), zoneId, Network.GuestType.Isolated, false);
     }
-    
+
     @Override
     public List<? extends Network> getIsolatedNetworksWithSourceNATOwnedByAccountInZone(long zoneId, Account owner) {
 
         return _networksDao.listSourceNATEnabledNetworks(owner.getId(), zoneId, Network.GuestType.Isolated);
     }
 
-    
-    
+
+
 
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_NET_IP_ASSIGN, eventDescription = "allocating Ip", create = true)
@@ -426,17 +522,19 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
                 }
 
                 // if shared network in the advanced zone, then check the caller against the network for 'AccessType.UseNetwork'
-                if (isSharedNetworkOfferingWithServices(network.getNetworkOfferingId()) && zone.getNetworkType() == NetworkType.Advanced) {
-                    Account caller = UserContext.current().getCaller();
-                    long callerUserId = UserContext.current().getCallerUserId();
-                    _accountMgr.checkAccess(caller, AccessType.UseNetwork, false, network);
-                    if (s_logger.isDebugEnabled()) {
-                        s_logger.debug("Associate IP address called by the user " + callerUserId + " account " + ipOwner.getId());
+                if (zone.getNetworkType() == NetworkType.Advanced) {
+                    if (isSharedNetworkOfferingWithServices(network.getNetworkOfferingId())) {
+                        Account caller = UserContext.current().getCaller();
+                        long callerUserId = UserContext.current().getCallerUserId();
+                        _accountMgr.checkAccess(caller, AccessType.UseNetwork, false, network);
+                        if (s_logger.isDebugEnabled()) {
+                            s_logger.debug("Associate IP address called by the user " + callerUserId + " account " + ipOwner.getId());
+                        }
+                        return _networkMgr.allocateIp(ipOwner, false, caller, callerUserId, zone);
+                    } else {
+                        throw new InvalidParameterValueException("Associate IP address can only be called on the shared networks in the advanced zone" +
+                                " with Firewall/Source Nat/Static Nat/Port Forwarding/Load balancing services enabled");
                     }
-                    return _networkMgr.allocateIp(ipOwner, false, caller, callerUserId, zone);
-                } else {
-                    throw new InvalidParameterValueException("Associate IP address can only be called on the shared networks in the advanced zone" +
-                        " with Firewall/Source Nat/Static Nat/Port Forwarding/Load balancing services enabled");
                 }
             }
         }
@@ -451,7 +549,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         _accountMgr.checkAccess(caller, null, false, ipOwner);
         long callerUserId = UserContext.current().getCallerUserId();
         DataCenter zone = _configMgr.getZone(zoneId);
-        
+
         return _networkMgr.allocateIp(ipOwner, isSystem, caller, callerUserId, zone);
     }
 
@@ -483,7 +581,8 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
     }
 
 
-    public String allocateSecondaryGuestIP (Account ipOwner, long zoneId, Long nicId, Long networkId, String requestedIp) throws InsufficientAddressCapacityException {
+    @Override
+    public NicSecondaryIp allocateSecondaryGuestIP (Account ipOwner, long zoneId, Long nicId, Long networkId, String requestedIp) throws InsufficientAddressCapacityException {
 
         Long accountId = null;
         Long domainId = null;
@@ -565,6 +664,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             return null;
         }
 
+        NicSecondaryIpVO secondaryIpVO;
         if (ipaddr != null) {
             // we got the ip addr so up the nics table and secodary ip
             Transaction txn = Transaction.currentTxn();
@@ -580,13 +680,16 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
 
             s_logger.debug("Setting nic_secondary_ip table ...");
             vmId = nicVO.getInstanceId();
-            NicSecondaryIpVO secondaryIpVO = new NicSecondaryIpVO(nicId, ipaddr, vmId, accountId, domainId, networkId);
+            secondaryIpVO = new NicSecondaryIpVO(nicId, ipaddr, vmId, accountId, domainId, networkId);
             _nicSecondaryIpDao.persist(secondaryIpVO);
             txn.commit();
+           return  getNicSecondaryIp(secondaryIpVO.getId());
+        } else {
+            return null;
         }
-        return ipaddr;
     }
 
+    @Override
     @DB
     public boolean releaseSecondaryIpFromNic (long ipAddressId) {
         Account caller = UserContext.current().getCaller();
@@ -676,6 +779,14 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         return true;
     }
 
+    NicSecondaryIp getNicSecondaryIp (long id) {
+        NicSecondaryIp nicSecIp = _nicSecondaryIpDao.findById(id);
+        if (nicSecIp == null) {
+            return null;
+        }
+        return nicSecIp;
+    }
+
     @Override
     @DB
     @ActionEvent(eventType = EventTypes.EVENT_NET_IP_RELEASE, eventDescription = "disassociating Ip", async = true)
@@ -740,7 +851,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
     public Network getNetwork(long id) {
         return _networksDao.findById(id);
     }
-   
+
 
     private void checkSharedNetworkCidrOverlap(Long zoneId, long physicalNetworkId, String cidr) {
         if (zoneId == null || cidr == null) {
@@ -791,7 +902,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             }
         }
     }
-    
+
     @Override
     @DB
     @ActionEvent(eventType = EventTypes.EVENT_NETWORK_CREATE, eventDescription = "creating network")
@@ -817,22 +928,19 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         String endIPv6 = cmd.getEndIpv6();
         String ip6Gateway = cmd.getIp6Gateway();
         String ip6Cidr = cmd.getIp6Cidr();
-        Boolean isDisplayNetworkEnabled = cmd.getDisplayNetwork();
+        Boolean displayNetwork = cmd.getDisplayNetwork();
 
         // Validate network offering
         NetworkOfferingVO ntwkOff = _networkOfferingDao.findById(networkOfferingId);
         if (ntwkOff == null || ntwkOff.isSystemOnly()) {
             InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find network offering by specified id");
             if (ntwkOff != null) {
-                ex.addProxyObject(ntwkOff, networkOfferingId, "networkOfferingId");                
+                ex.addProxyObject(ntwkOff, networkOfferingId, "networkOfferingId");
                 // Get the VO object's table name.
                 String tablename = AnnotationHelper.getTableName(ntwkOff);
                 if (tablename != null) {
                     ex.addProxyObject(tablename, networkOfferingId, "networkOfferingId");
-                } else {
-                    s_logger.info("\nCould not retrieve table name (annotation) from " + tablename + " VO proxy object\n");
                 }
-                throw ex;
             }
             throw ex;
         }
@@ -850,16 +958,24 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             zoneId = pNtwk.getDataCenterId();
         }
 
+        if(displayNetwork != null){
+            if(!_accountMgr.isRootAdmin(caller.getType())){
+                throw new PermissionDeniedException("Only admin allowed to update displaynetwork parameter");
+            }
+        }else{
+            displayNetwork = true;
+        }
+
         DataCenter zone = _dcDao.findById(zoneId);
         if (zone == null) {
             throw new InvalidParameterValueException("Specified zone id was not found");
         }
-        
+
         if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(caller.getType())) {
             // See DataCenterVO.java
             PermissionDeniedException ex = new PermissionDeniedException("Cannot perform this operation since specified Zone is currently disabled");
             ex.addProxyObject(zone, zoneId, "zoneId");
-            throw ex;            
+            throw ex;
         }
 
         // Only domain and account ACL types are supported in Acton.
@@ -879,7 +995,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
                 }
             } else if (ntwkOff.getGuestType() == GuestType.Shared) {
                 if (!(aclType == ACLType.Domain || aclType == ACLType.Account)) {
-                    throw new InvalidParameterValueException("AclType should be " + ACLType.Domain + " or " + 
+                    throw new InvalidParameterValueException("AclType should be " + ACLType.Domain + " or " +
                 ACLType.Account + " for network of type " + Network.GuestType.Shared);
                 }
             }
@@ -915,7 +1031,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
                 }
 
                 DomainVO domain = _domainDao.findById(domainId);
-                if (domain == null) {                    
+                if (domain == null) {
                     throw new InvalidParameterValueException("Unable to find domain by specified id");
                 }
                 _accountMgr.checkAccess(caller, domain);
@@ -941,7 +1057,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         if (startIPv6 != null) {
         	ipv6 = true;
         }
-        
+
         if (gateway != null) {
         	try {
         		// getByName on a literal representation will only check validity of the address
@@ -958,8 +1074,8 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         		throw new InvalidParameterValueException("Gateway parameter is invalid");
         	}
         }
-        
-        
+
+
         String cidr = null;
         if (ipv4) {
         	// if end ip is not specified, default it to startIp
@@ -992,18 +1108,18 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         	}
 
         }
-        
+
         if (ipv6) {
         	if (endIPv6 == null) {
         		endIPv6 = startIPv6;
         	}
         	_networkModel.checkIp6Parameters(startIPv6, endIPv6, ip6Gateway, ip6Cidr);
-        	
+
         	if (zone.getNetworkType() != NetworkType.Advanced || ntwkOff.getGuestType() != Network.GuestType.Shared) {
         		throw new InvalidParameterValueException("Can only support create IPv6 network with advance shared network!");
         	}
         }
-        
+
         // Regular user can create Guest Isolated Source Nat enabled network only
         if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL
                 && (ntwkOff.getTrafficType() != TrafficType.Guest || ntwkOff.getGuestType() != Network.GuestType.Isolated
@@ -1017,7 +1133,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL && (ntwkOff.getSpecifyVlan() || vlanId != null)) {
             throw new InvalidParameterValueException("Regular user is not allowed to specify vlanId");
         }
-        
+
         if (ipv4) {
         	// For non-root admins check cidr limit - if it's allowed by global config value
         	if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN && cidr != null) {
@@ -1035,14 +1151,18 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         if (ipv6 && providersConfiguredForExternalNetworking(ntwkProviders)) {
         	throw new InvalidParameterValueException("Cannot support IPv6 on network offering with external devices!");
         }
-        
+
         if (cidr != null && providersConfiguredForExternalNetworking(ntwkProviders)) {
             if (ntwkOff.getGuestType() == GuestType.Shared && (zone.getNetworkType() == NetworkType.Advanced) &&
                     isSharedNetworkOfferingWithServices(networkOfferingId)) {
                 // validate if CIDR specified overlaps with any of the CIDR's allocated for isolated networks and shared networks in the zone
                 checkSharedNetworkCidrOverlap(zoneId, pNtwk.getId(), cidr);
             } else {
-                throw new InvalidParameterValueException("Cannot specify CIDR when using network offering with external devices!");
+                // if the guest network is for the VPC, if any External Provider are supported in VPC
+                // cidr will not be null as it is generated from the super cidr of vpc.
+                // if cidr is not null and network is not part of vpc then throw the exception
+                if (vpcId == null)
+                    throw new InvalidParameterValueException("Cannot specify CIDR when using network offering with external devices!");
             }
         }
 
@@ -1051,9 +1171,9 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         // 2) GuestType is Isolated, but SourceNat service is disabled
         boolean createVlan = (startIP != null && endIP != null && zone.getNetworkType() == NetworkType.Advanced
                 && ((ntwkOff.getGuestType() == Network.GuestType.Shared)
-                || (ntwkOff.getGuestType() == GuestType.Isolated && 
+                || (ntwkOff.getGuestType() == GuestType.Isolated &&
                 !areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat))));
-        
+
         if (!createVlan) {
         	// Only support advance shared network in IPv6, which means createVlan is a must
         	if (ipv6) {
@@ -1071,7 +1191,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             } else {
                 s_logger.info("\nCould not retrieve table name (annotation) from " + tablename + " VO proxy object\n");
             }
-            throw ex;   
+            throw ex;
         }
 
         Transaction txn = Transaction.currentTxn();
@@ -1098,15 +1218,19 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             if (!_configMgr.isOfferingForVpc(ntwkOff)){
                 throw new InvalidParameterValueException("Network offering can't be used for VPC networks");
             }
-            network = _vpcMgr.createVpcGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId, 
-                    networkDomain, owner, sharedDomainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, caller, isDisplayNetworkEnabled);
+            network = _vpcMgr.createVpcGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId,
+                    networkDomain, owner, sharedDomainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, caller, displayNetwork);
         } else {
             if (_configMgr.isOfferingForVpc(ntwkOff)){
                 throw new InvalidParameterValueException("Network offering can be used for VPC networks only");
             }
-            network = _networkMgr.createGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId, 
-            		networkDomain, owner, sharedDomainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, ip6Gateway, ip6Cidr, isDisplayNetworkEnabled);
-        }  
+            if (ntwkOff.getInternalLb()) {
+                throw new InvalidParameterValueException("Internal Lb can be enabled on vpc networks only");
+            }
+
+            network = _networkMgr.createGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId,
+            		networkDomain, owner, sharedDomainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, ip6Gateway, ip6Cidr, displayNetwork);
+        }
 
         if (caller.getType() == Account.ACCOUNT_TYPE_ADMIN && createVlan) {
             // Create vlan ip range
@@ -1148,6 +1272,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         Long id = cmd.getId();
         String keyword = cmd.getKeyword();
         Long zoneId = cmd.getZoneId();
+        String zoneType = cmd.getZoneType();
         Account caller = UserContext.current().getCaller();
         Long domainId = cmd.getDomainId();
         String accountName = cmd.getAccountName();
@@ -1215,13 +1340,13 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             } else {
                 permittedAccounts.clear();
                 Project project = _projectMgr.getProject(projectId);
-                if (project == null) {                    
+                if (project == null) {
                     throw new InvalidParameterValueException("Unable to find project by specified id");
                 }
                 if (!_projectMgr.canAccessProjectAccount(caller, project.getProjectAccountId())) {
                     // getProject() returns type ProjectVO.
                     InvalidParameterValueException ex = new InvalidParameterValueException("Account " + caller + " cannot access specified project id");
-                    ex.addProxyObject(project, projectId, "projectId");                    
+                    ex.addProxyObject(project, projectId, "projectId");
                     throw ex;
                 }
                 permittedAccounts.add(project.getProjectAccountId());
@@ -1233,15 +1358,15 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             path = _domainDao.findById(domainId).getPath();
         } else {
         path = _domainDao.findById(caller.getDomainId()).getPath();
-        } 
-        
+        }
+
         if (listAll && domainId == null) {
             isRecursive = true;
         }
 
         Filter searchFilter = new Filter(NetworkVO.class, "id", false, cmd.getStartIndex(), cmd.getPageSizeVal());
         SearchBuilder<NetworkVO> sb = _networksDao.createSearchBuilder();
-        
+
         if (forVpc != null) {
             if (forVpc) {
                 sb.and("vpc", sb.entity().getVpcId(), Op.NNULL);
@@ -1285,8 +1410,8 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             SearchBuilder<AccountVO> accountSearch = _accountDao.createSearchBuilder();
         accountSearch.and("typeNEQ", accountSearch.entity().getType(), SearchCriteria.Op.NEQ);
         accountSearch.and("typeEQ", accountSearch.entity().getType(), SearchCriteria.Op.EQ);
-        
-        
+
+
             sb.join("accountSearch", accountSearch, sb.entity().getAccountId(), accountSearch.entity().getId(), JoinBuilder.JoinType.INNER);
 
         List<NetworkVO> networksToReturn = new ArrayList<NetworkVO>();
@@ -1295,40 +1420,40 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             if (!permittedAccounts.isEmpty()) {
                 //get account level networks
                 networksToReturn.addAll(listAccountSpecificNetworks(
-                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, 
-                                physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter,
+                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
+                                physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter,
                         permittedAccounts));
                 //get domain level networks
                 if (domainId != null) {
                     networksToReturn
                     .addAll(listDomainLevelNetworks(
                             buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
-                                    physicalNetworkId, aclType, true, restartRequired, specifyIpRanges, vpcId, tags), searchFilter,
+                                    physicalNetworkId, aclType, true, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter,
                                     domainId, false));
                 }
             } else {
                 //add account specific networks
                 networksToReturn.addAll(listAccountSpecificNetworksByDomainPath(
-                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, 
-                                physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter, path,
+                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
+                                physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter, path,
                         isRecursive));
                 //add domain specific networks of domain + parent domains
                 networksToReturn.addAll(listDomainSpecificNetworksByDomainPath(
-                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, 
-                                physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter, path,
+                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
+                                physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter, path,
                                 isRecursive));
                 //add networks of subdomains
                 if (domainId == null) {
                     networksToReturn
                     .addAll(listDomainLevelNetworks(
                             buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
-                                    physicalNetworkId, aclType, true, restartRequired, specifyIpRanges, vpcId, tags), searchFilter,
+                                    physicalNetworkId, aclType, true, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter,
                                     caller.getDomainId(), true));
                 }
             }
         } else {
             networksToReturn = _networksDao.search(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId,
-                    guestIpType, trafficType, physicalNetworkId, null, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags),
+                    guestIpType, trafficType, physicalNetworkId, null, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType),
                     searchFilter);
         }
 
@@ -1354,7 +1479,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
 
             networksToReturn=supportedNetworks;
         }
-        
+
         if (canUseForDeploy != null) {
             List<NetworkVO> networksForDeploy = new ArrayList<NetworkVO>();
             for (NetworkVO network : networksToReturn) {
@@ -1362,18 +1487,18 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
                     networksForDeploy.add(network);
                 }
             }
-            
+
             networksToReturn=networksForDeploy;
         }
-        
+
             return networksToReturn;
         }
 
-    
 
-    private SearchCriteria<NetworkVO> buildNetworkSearchCriteria(SearchBuilder<NetworkVO> sb, String keyword, Long id, 
+
+    private SearchCriteria<NetworkVO> buildNetworkSearchCriteria(SearchBuilder<NetworkVO> sb, String keyword, Long id,
             Boolean isSystem, Long zoneId, String guestIpType, String trafficType, Long physicalNetworkId,
-            String aclType, boolean skipProjectNetworks, Boolean restartRequired, Boolean specifyIpRanges, Long vpcId, Map<String, String> tags) {
+            String aclType, boolean skipProjectNetworks, Boolean restartRequired, Boolean specifyIpRanges, Long vpcId, Map<String, String> tags, String zoneType) {
 
         SearchCriteria<NetworkVO> sc = sb.create();
 
@@ -1395,6 +1520,10 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId);
         }
 
+        if(zoneType != null) {
+            sc.setJoinParameters("zoneSearch", "networkType", zoneType);
+        }
+
         if (guestIpType != null) {
             sc.addAnd("guestType", SearchCriteria.Op.EQ, guestIpType);
         }
@@ -1424,11 +1553,11 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         if (specifyIpRanges != null) {
             sc.addAnd("specifyIpRanges", SearchCriteria.Op.EQ, specifyIpRanges);
         }
-        
+
         if (vpcId != null) {
             sc.addAnd("vpcId", SearchCriteria.Op.EQ, vpcId);
         }
-        
+
         if (tags != null && !tags.isEmpty()) {
             int count = 0;
             sc.setJoinParameters("tagSearch", "resourceType", TaggedResourceType.Network.toString());
@@ -1511,7 +1640,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         }
 
         List<Long> networkIds = new ArrayList<Long>();
-        
+
         List<NetworkDomainVO> maps = _networkDomainDao.listDomainNetworkMapByDomain(allowedDomains.toArray());
 
         for (NetworkDomainVO map : maps) {
@@ -1540,16 +1669,16 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         NetworkVO network = _networksDao.findById(networkId);
         if (network == null) {
             // see NetworkVO.java
-            
+
             InvalidParameterValueException ex = new InvalidParameterValueException("unable to find network with specified id");
-            ex.addProxyObject(network, networkId, "networkId");            
+            ex.addProxyObject(network, networkId, "networkId");
             throw ex;
         }
 
         // don't allow to delete system network
         if (isNetworkSystem(network)) {
             InvalidParameterValueException ex = new InvalidParameterValueException("Network with specified id is system and can't be removed");
-            ex.addProxyObject(network, network.getId(), "networkId");            
+            ex.addProxyObject(network, network.getId(), "networkId");
             throw ex;
         }
 
@@ -1564,7 +1693,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         return _networkMgr.destroyNetwork(networkId, context);
     }
 
-    
+
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_NETWORK_RESTART, eventDescription = "restarting network", async = true)
     public boolean restartNetwork(RestartNetworkCmd cmd, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
@@ -1576,7 +1705,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
 
         // Check if network exists
         NetworkVO network = _networksDao.findById(networkId);
-        if (network == null) {            
+        if (network == null) {
             InvalidParameterValueException ex = new InvalidParameterValueException("Network with specified id doesn't exist");
             ex.addProxyObject("networks", networkId, "networkId");
             throw ex;
@@ -1586,9 +1715,9 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         if (!(network.getState() == Network.State.Implemented || network.getState() == Network.State.Setup)) {
             throw new InvalidParameterValueException("Network is not in the right state to be restarted. Correct states are: " + Network.State.Implemented + ", " + Network.State.Setup);
         }
-        
+
         if (network.getBroadcastDomainType() == BroadcastDomainType.Lswitch ) {
-        	/** 
+        	/**
         	 * Unable to restart these networks now.
         	 * TODO Restarting a SDN based network requires updating the nics and the configuration
         	 * in the controller. This requires a non-trivial rewrite of the restart procedure.
@@ -1614,15 +1743,15 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         return _networksDao.getActiveNicsIn(networkId);
     }
 
-    
 
-   
 
-    
+
+
+
     protected Map<Capability, String> getNetworkOfferingServiceCapabilities(NetworkOffering offering, Service service) {
 
         if (!areServicesSupportedByNetworkOffering(offering.getId(), service)) {
-            // TBD: We should be sending networkOfferingId and not the offering object itself.  
+            // TBD: We should be sending networkOfferingId and not the offering object itself.
             throw new UnsupportedServiceException("Service " + service.getName() + " is not supported by the network offering " + offering);
         }
 
@@ -1655,14 +1784,14 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
 
         return serviceCapabilities;
     }
-    
-    
+
+
     @Override
     public IpAddress getIp(long ipAddressId) {
         return _ipAddressDao.findById(ipAddressId);
     }
 
-    
+
     protected boolean providersConfiguredForExternalNetworking(Collection<String> providers) {
         for(String providerStr : providers){
             Provider provider = Network.Provider.getProvider(providerStr);
@@ -1686,33 +1815,33 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         return false;
     }
 
-    
+
     protected boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service... services) {
         return (_ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(networkOfferingId, services));
     }
 
-    
+
     protected boolean areServicesSupportedInNetwork(long networkId, Service... services) {
         return (_ntwkSrvcDao.areServicesSupportedInNetwork(networkId, services));
     }
 
- 
-        
-   
 
-    
+
+
+
+
 
     private boolean checkForNonStoppedVmInNetwork(long networkId) {
-        List<UserVmVO> vms = _userVmDao.listByNetworkIdAndStates(networkId, VirtualMachine.State.Starting, 
+        List<UserVmVO> vms = _userVmDao.listByNetworkIdAndStates(networkId, VirtualMachine.State.Starting,
                 VirtualMachine.State.Running, VirtualMachine.State.Migrating, VirtualMachine.State.Stopping);
         return vms.isEmpty();
     }
-    
+
     @Override
     @DB
     @ActionEvent(eventType = EventTypes.EVENT_NETWORK_UPDATE, eventDescription = "updating network", async = true)
     public Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount,
-                                      User callerUser, String domainSuffix, Long networkOfferingId, Boolean changeCidr, String guestVmCidr, Boolean displayNetwork) {
+            User callerUser, String domainSuffix, Long networkOfferingId, Boolean changeCidr, String guestVmCidr, Boolean displayNetwork) {
         boolean restartNetwork = false;
 
         // verify input parameters
@@ -1723,7 +1852,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             ex.addProxyObject("networks", networkId, "networkId");
             throw ex;
         }
-        
+
         //perform below validation if the network is vpc network
         if (network.getVpcId() != null && networkOfferingId != null) {
             Vpc vpc = _vpcMgr.getVpc(network.getVpcId());
@@ -1745,7 +1874,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         if (network.getTrafficType() != Networks.TrafficType.Guest) {
             throw new InvalidParameterValueException("Can't allow networks which traffic type is not " + TrafficType.Guest);
         }
-        
+
         _accountMgr.checkAccess(callerAccount, null, true, network);
 
         if (name != null) {
@@ -1776,14 +1905,14 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         if (networkOfferingId != null) {
             if (networkOffering == null || networkOffering.isSystemOnly()) {
                 InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find network offering with specified id");
-                ex.addProxyObject(networkOffering, networkOfferingId, "networkOfferingId");                
+                ex.addProxyObject(networkOffering, networkOfferingId, "networkOfferingId");
                 throw ex;
             }
-            
+
             // network offering should be in Enabled state
             if (networkOffering.getState() != NetworkOffering.State.Enabled) {
                 InvalidParameterValueException ex = new InvalidParameterValueException("Network offering with specified id is not in " + NetworkOffering.State.Enabled + " state, can't upgrade to it");
-                ex.addProxyObject(networkOffering, networkOfferingId, "networkOfferingId");                
+                ex.addProxyObject(networkOffering, networkOfferingId, "networkOfferingId");
                 throw ex;
             }
             //can't update from vpc to non-vpc network offering
@@ -1797,7 +1926,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             if (networkOfferingId != oldNetworkOfferingId) {
                 Collection<String> newProviders = _networkMgr.finalizeServicesAndProvidersForNetwork(networkOffering, network.getPhysicalNetworkId()).values();
                 Collection<String> oldProviders = _networkMgr.finalizeServicesAndProvidersForNetwork(oldNtwkOff, network.getPhysicalNetworkId()).values();
-                
+
                 if (providersConfiguredForExternalNetworking(newProviders) != providersConfiguredForExternalNetworking(oldProviders)
                         && !changeCidr) {
                     throw new InvalidParameterValueException("Updating network failed since guest CIDR needs to be changed!");
@@ -1805,7 +1934,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
                 if (changeCidr) {
                     if (!checkForNonStoppedVmInNetwork(network.getId())) {
                         InvalidParameterValueException ex = new InvalidParameterValueException("All user vm of network of specified id should be stopped before changing CIDR!");
-                        ex.addProxyObject(network, networkId, "networkId");                       
+                        ex.addProxyObject(network, networkId, "networkId");
                         throw ex;
                     }
                 }
@@ -1938,7 +2067,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
                     if (!_networkMgr.shutdownNetworkElementsAndResources(context, true, network)) {
                         s_logger.warn("Failed to shutdown the network elements and resources as a part of network restart: " + network);
                         CloudRuntimeException ex = new CloudRuntimeException("Failed to shutdown the network elements and resources as a part of update to network of specified id");
-                        ex.addProxyObject(network, networkId, "networkId");                       
+                        ex.addProxyObject(network, networkId, "networkId");
                         throw ex;
                     }
                 } else {
@@ -1957,13 +2086,13 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
                     if (!_networkMgr.shutdownNetwork(network.getId(), context, true)) {
                         s_logger.warn("Failed to shutdown the network as a part of update to network with specified id");
                         CloudRuntimeException ex = new CloudRuntimeException("Failed to shutdown the network as a part of update of specified network id");
-                        ex.addProxyObject(network, networkId, "networkId");                        
+                        ex.addProxyObject(network, networkId, "networkId");
                         throw ex;
                     }
                 }
             } else {
                 CloudRuntimeException ex = new CloudRuntimeException("Failed to shutdown the network elements and resources as a part of update to network with specified id; network is in wrong state: " + network.getState());
-                ex.addProxyObject(network, networkId, "networkId");                
+                ex.addProxyObject(network, networkId, "networkId");
                 throw ex;
             }
         }
@@ -2025,7 +2154,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
                 } catch (Exception ex) {
                     s_logger.warn("Failed to implement network " + network + " elements and resources as a part of network update due to ", ex);
                     CloudRuntimeException e = new CloudRuntimeException("Failed to implement network (with specified id) elements and resources as a part of network update");
-                    e.addProxyObject(network, networkId, "networkId");                    
+                    e.addProxyObject(network, networkId, "networkId");
                     throw e;
                 }
             }
@@ -2053,14 +2182,11 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
     }
 
 
-
-
     protected Set<Long> getAvailableIps(Network network, String requestedIp) {
         String[] cidr = network.getCidr().split("/");
         List<String> ips = _nicDao.listIpAddressInNetwork(network.getId());
-        Set<Long> allPossibleIps = NetUtils.getAllIpsFromCidr(cidr[0], Integer.parseInt(cidr[1]));
-        Set<Long> usedIps = new TreeSet<Long>(); 
-        
+        Set<Long> usedIps = new TreeSet<Long>();
+
         for (String ip : ips) {
             if (requestedIp != null && requestedIp.equals(ip)) {
                 s_logger.warn("Requested ip address " + requestedIp + " is already in use in network" + network);
@@ -2069,9 +2195,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
 
             usedIps.add(NetUtils.ip2Long(ip));
         }
-        if (usedIps.size() != 0) {
-            allPossibleIps.removeAll(usedIps);
-        }
+        Set<Long> allPossibleIps = NetUtils.getAllIpsFromCidr(cidr[0], Integer.parseInt(cidr[1]), usedIps);
 
         String gateway = network.getGateway();
         if ((gateway != null) && (allPossibleIps.contains(NetUtils.ip2Long(gateway))))
@@ -2081,7 +2205,6 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
     }
 
 
-  
     protected boolean canUpgrade(Network network, long oldNetworkOfferingId, long newNetworkOfferingId) {
         NetworkOffering oldNetworkOffering = _networkOfferingDao.findByIdIncludingRemoved(oldNetworkOfferingId);
         NetworkOffering newNetworkOffering = _networkOfferingDao.findById(newNetworkOfferingId);
@@ -2147,16 +2270,24 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
                 return false;
             }
         }
+        
+        //can't update from internal LB to public LB
+        if (areServicesSupportedByNetworkOffering(oldNetworkOfferingId, Service.Lb) && areServicesSupportedByNetworkOffering(newNetworkOfferingId, Service.Lb)) {
+            if (oldNetworkOffering.getPublicLb() != newNetworkOffering.getPublicLb() || oldNetworkOffering.getInternalLb() != newNetworkOffering.getInternalLb()) {
+                throw new InvalidParameterValueException("Original and new offerings support different types of LB - Internal vs Public," +
+                		" can't upgrade");
+            }
+        }
 
         return canIpsUseOffering(publicIps, newNetworkOfferingId);
     }
 
-    
+
 
     @Override
     @DB
     @ActionEvent(eventType = EventTypes.EVENT_PHYSICAL_NETWORK_CREATE, eventDescription = "Creating Physical Network", create = true)
-    public PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed, List<String> 
+    public PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed, List<String>
     isolationMethods, String broadcastDomainRangeStr, Long domainId, List<String> tags, String name) {
 
         // Check if zone exists
@@ -2261,13 +2392,16 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
 
             // add security group provider to the physical network
             addDefaultSecurityGroupProviderToPhysicalNetwork(pNetwork.getId());
-            
+
             // add VPCVirtualRouter as the defualt network service provider
             addDefaultVpcVirtualRouterToPhysicalNetwork(pNetwork.getId());
 
             // add baremetal as the defualt network service provider
             /* addDefaultBaremetalProvidersToPhysicalNetwork(pNetwork.getId()); */
             
+            //Add Internal Load Balancer element as a default network service provider
+            addDefaultInternalLbProviderToPhysicalNetwork(pNetwork.getId());
+            
             txn.commit();
             return pNetwork;
         } catch (Exception ex) {
@@ -2306,7 +2440,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         PhysicalNetworkVO network = _physicalNetworkDao.findById(id);
         if (network == null) {
             InvalidParameterValueException ex = new InvalidParameterValueException("Physical Network with specified id doesn't exist in the system");
-            ex.addProxyObject(network, id, "physicalNetworkId");            
+            ex.addProxyObject(network, id, "physicalNetworkId");
             throw ex;
         }
 
@@ -2314,7 +2448,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         DataCenter zone = _dcDao.findById(network.getDataCenterId());
         if (zone == null) {
             InvalidParameterValueException ex = new InvalidParameterValueException("Zone with id=" + network.getDataCenterId() + " doesn't exist in the system");
-            ex.addProxyObject(zone, network.getDataCenterId(), "dataCenterId");            
+            ex.addProxyObject(zone, network.getDataCenterId(), "dataCenterId");
             throw ex;
         }
         if (newVnetRangeString != null) {
@@ -2527,6 +2661,19 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             txn.close();
             throw new InvalidParameterValueException("Some of the vnets from this range are allocated, can only remove a range which has no allocated vnets");
         }
+        // If the range is partially dedicated to an account fail the request
+        List<AccountGuestVlanMapVO> maps = _accountGuestVlanMapDao.listAccountGuestVlanMapsByPhysicalNetwork(network.getId());
+        for (AccountGuestVlanMapVO map : maps) {
+            String[] vlans = map.getGuestVlanRange().split("-");
+            Integer dedicatedStartVlan = Integer.parseInt(vlans[0]);
+            Integer dedicatedEndVlan = Integer.parseInt(vlans[1]);
+            if ((start >= dedicatedStartVlan && start <= dedicatedEndVlan) || (end >= dedicatedStartVlan && end <= dedicatedEndVlan)) {
+                txn.close();
+                throw new InvalidParameterValueException("Vnet range " + map.getGuestVlanRange() + " is dedicated" +
+                        " to an account. The specified range " + start + "-" + end + " overlaps with the dedicated range " +
+                        " Please release the overlapping dedicated range before deleting the range");
+            }
+        }
         for (i=0; i<existingRanges.size(); i++){
             if (existingRanges.get(i).first()<= start & existingRanges.get(i).second()>= end){
                 temp = existingRanges.get(i).second();
@@ -2557,6 +2704,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         _physicalNetworkDao.update(network.getId(), network);
         txn.commit();
         _physicalNetworkDao.releaseFromLockTable(network.getId());
+
         return  true;
     }
 
@@ -2573,7 +2721,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         PhysicalNetworkVO pNetwork = _physicalNetworkDao.findById(physicalNetworkId);
         if (pNetwork == null) {
             InvalidParameterValueException ex = new InvalidParameterValueException("Physical Network with specified id doesn't exist in the system");
-            ex.addProxyObject(pNetwork, physicalNetworkId, "physicalNetworkId");            
+            ex.addProxyObject(pNetwork, physicalNetworkId, "physicalNetworkId");
             throw ex;
         }
 
@@ -2600,7 +2748,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
 
         // delete service providers
         List<PhysicalNetworkServiceProviderVO> providers = _pNSPDao.listBy(physicalNetworkId);
-        
+
         for(PhysicalNetworkServiceProviderVO provider : providers){
             try {
                 deleteNetworkServiceProvider(provider.getId());
@@ -2617,7 +2765,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         _pNTrafficTypeDao.deleteTrafficTypes(physicalNetworkId);
 
         boolean success = _physicalNetworkDao.remove(physicalNetworkId);
-        
+
         txn.commit();
 
         return success;
@@ -2694,6 +2842,260 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
     }
 
     @Override
+    @DB
+    @ActionEvent(eventType = EventTypes.EVENT_GUEST_VLAN_RANGE_DEDICATE, eventDescription = "dedicating guest vlan range", async = false)
+    public GuestVlan dedicateGuestVlanRange(DedicateGuestVlanRangeCmd cmd) {
+        String vlan = cmd.getVlan();
+        String accountName = cmd.getAccountName();
+        Long domainId = cmd.getDomainId();
+        Long physicalNetworkId = cmd.getPhysicalNetworkId();
+        Long projectId = cmd.getProjectId();
+
+        int startVlan, endVlan;
+        String updatedVlanRange = null;
+        long guestVlanMapId = 0;
+        long guestVlanMapAccountId = 0;
+
+        // Verify account is valid
+        Account vlanOwner = null;
+        if (projectId != null) {
+            if (accountName != null) {
+                throw new InvalidParameterValueException("accountName and projectId are mutually exclusive");
+            }
+            Project project = _projectMgr.getProject(projectId);
+            if (project == null) {
+                throw new InvalidParameterValueException("Unable to find project by id " + projectId);
+            }
+            vlanOwner = _accountMgr.getAccount(project.getProjectAccountId());
+        }
+
+        if ((accountName != null) && (domainId != null)) {
+            vlanOwner = _accountDao.findActiveAccount(accountName, domainId);
+            if (vlanOwner == null) {
+                throw new InvalidParameterValueException("Unable to find account by name " + accountName);
+            }
+        }
+
+        // Verify physical network isolation type is VLAN
+        PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
+        if (physicalNetwork == null ) {
+            throw new InvalidParameterValueException("Unable to find physical network by id " + physicalNetworkId);
+        } else if (physicalNetwork.getIsolationMethods() == null || !physicalNetwork.getIsolationMethods().contains("VLAN")) {
+            throw new InvalidParameterValueException("Cannot dedicate guest vlan range. " +
+                    "Physical isolation type of network " + physicalNetworkId + " is not VLAN");
+        }
+
+        // Get the start and end vlan
+        String[] vlanRange = vlan.split("-");
+        if (vlanRange.length != 2) {
+            throw new InvalidParameterValueException("Invalid format for parameter value vlan " + vlan + " .Vlan should be specified as 'startvlan-endvlan'");
+        }
+
+        try {
+            startVlan = Integer.parseInt(vlanRange[0]);
+            endVlan = Integer.parseInt(vlanRange[1]);
+        } catch (NumberFormatException e) {
+            s_logger.warn("Unable to parse guest vlan range:", e);
+            throw new InvalidParameterValueException("Please provide valid guest vlan range");
+        }
+
+        // Verify guest vlan range exists in the system
+        List <Pair <Integer,Integer>> existingRanges = physicalNetwork.getVnet();
+        Boolean exists = false;
+        if (!existingRanges.isEmpty()) {
+            for (int i=0 ; i < existingRanges.size(); i++){
+                int existingStartVlan = existingRanges.get(i).first();
+                int existingEndVlan = existingRanges.get(i).second();
+                if (startVlan >= existingStartVlan && endVlan <= existingEndVlan) {
+                        exists = true;
+                        break;
+                    }
+            }
+            if (!exists) {
+                throw new InvalidParameterValueException("Unable to find guest vlan by range " + vlan);
+            }
+        }
+
+        // Verify guest vlans in the range don't belong to a network of a different account
+        for (int i = startVlan; i <= endVlan; i++) {
+            List<DataCenterVnetVO> allocatedVlans = _datacneter_vnet.listAllocatedVnetsInRange(physicalNetwork.getDataCenterId(), physicalNetwork.getId(), startVlan, endVlan);
+            if (allocatedVlans != null && !allocatedVlans.isEmpty()){
+                for (DataCenterVnetVO allocatedVlan : allocatedVlans) {
+                    if (allocatedVlan.getAccountId() !=  vlanOwner.getAccountId()) {
+                        throw new InvalidParameterValueException("Guest vlan from this range " + allocatedVlan.getVnet() + " is allocated to a different account." +
+                                " Can only dedicate a range which has no allocated vlans or has vlans allocated to the same account ");
+                    }
+                }
+            }
+        }
+
+        List<AccountGuestVlanMapVO> guestVlanMaps = _accountGuestVlanMapDao.listAccountGuestVlanMapsByPhysicalNetwork(physicalNetworkId);
+        for (AccountGuestVlanMapVO guestVlanMap : guestVlanMaps) {
+            List<Integer> vlanTokens = getVlanFromRange(guestVlanMap.getGuestVlanRange());
+            int dedicatedStartVlan = vlanTokens.get(0).intValue();
+            int dedicatedEndVlan = vlanTokens.get(1).intValue();
+            guestVlanMapId = guestVlanMap.getId();
+            guestVlanMapAccountId = guestVlanMap.getAccountId();
+
+            // Verify if range is already dedicated
+            if (startVlan >= dedicatedStartVlan && endVlan <= dedicatedEndVlan) {
+                if (guestVlanMap.getAccountId() != vlanOwner.getAccountId()) {
+                    throw new InvalidParameterValueException("Vlan range is already dedicated to another account. Cannot dedicate guest vlan range " + vlan);
+                } else {
+                    s_logger.debug("Vlan range " + vlan +" is already dedicated to the specified account" + accountName);
+                    return guestVlanMap;
+                }
+            }
+            // Verify if range overlaps with an existing range
+            if (startVlan < dedicatedStartVlan & endVlan+1 >= dedicatedStartVlan & endVlan <= dedicatedEndVlan) { // extend to the left
+                updatedVlanRange = startVlan + "-" + dedicatedEndVlan;
+                break;
+            } else if (startVlan >= dedicatedStartVlan & startVlan-1 <= dedicatedEndVlan & endVlan > dedicatedEndVlan) { // extend to right
+                updatedVlanRange = dedicatedStartVlan + "-" +  endVlan;
+                break;
+            } else if (startVlan < dedicatedStartVlan & endVlan > dedicatedEndVlan){ // extend to the left and right
+                updatedVlanRange = startVlan + "-" +  endVlan;
+                break;
+            }
+        }
+
+        AccountGuestVlanMapVO accountGuestVlanMapVO;
+        if (updatedVlanRange != null) {
+            if (guestVlanMapAccountId != vlanOwner.getAccountId()) {
+                throw new InvalidParameterValueException("Vlan range is partially dedicated to another account. Cannot dedicate guest vlan range " + vlan);
+            }
+            accountGuestVlanMapVO = _accountGuestVlanMapDao.findById(guestVlanMapId);
+            accountGuestVlanMapVO.setGuestVlanRange(updatedVlanRange);
+            _accountGuestVlanMapDao.update(guestVlanMapId, accountGuestVlanMapVO);
+        } else {
+            Transaction txn = Transaction.currentTxn();
+            accountGuestVlanMapVO = new AccountGuestVlanMapVO(vlanOwner.getAccountId(), physicalNetworkId);
+            accountGuestVlanMapVO.setGuestVlanRange(startVlan + "-" +  endVlan);
+            _accountGuestVlanMapDao.persist(accountGuestVlanMapVO);
+            txn.commit();
+        }
+        // For every guest vlan set the corresponding account guest vlan map id
+        for (int i = startVlan; i <= endVlan; i++) {
+            List<DataCenterVnetVO> dataCenterVnet = _datacneter_vnet.findVnet(physicalNetwork.getDataCenterId(),((Integer)i).toString());
+            dataCenterVnet.get(0).setAccountGuestVlanMapId(accountGuestVlanMapVO.getId());
+            _datacneter_vnet.update(dataCenterVnet.get(0).getId(), dataCenterVnet.get(0));
+        }
+        return accountGuestVlanMapVO;
+    }
+
+    private List<Integer> getVlanFromRange(String vlanRange) {
+        // Get the start and end vlan
+        String[] vlanTokens = vlanRange.split("-");
+        List<Integer> tokens = new ArrayList<Integer>();
+        try {
+            int startVlan = Integer.parseInt(vlanTokens[0]);
+            int endVlan = Integer.parseInt(vlanTokens[1]);
+            tokens.add(startVlan);
+            tokens.add(endVlan);
+        } catch (NumberFormatException e) {
+            s_logger.warn("Unable to parse guest vlan range:", e);
+            throw new InvalidParameterValueException("Please provide valid guest vlan range");
+        }
+        return tokens;
+    }
+
+    @Override
+    public Pair<List<? extends GuestVlan>, Integer> listDedicatedGuestVlanRanges(ListDedicatedGuestVlanRangesCmd cmd) {
+        Long id = cmd.getId();
+        String accountName = cmd.getAccountName();
+        Long domainId = cmd.getDomainId();
+        Long projectId = cmd.getProjectId();
+        String guestVlanRange = cmd.getGuestVlanRange();
+        Long physicalNetworkId = cmd.getPhysicalNetworkId();
+        Long zoneId = cmd.getZoneId();
+
+        Long accountId = null;
+        if (accountName != null && domainId != null) {
+            if (projectId != null) {
+                throw new InvalidParameterValueException("Account and projectId can't be specified together");
+            }
+            Account account = _accountDao.findActiveAccount(accountName, domainId);
+            if (account == null) {
+                InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find account " + accountName);
+                ex.addProxyObject("domain", domainId, "domainId");
+                throw ex;
+            } else {
+                accountId = account.getId();
+            }
+        }
+
+        // set project information
+        if (projectId != null) {
+            Project project = _projectMgr.getProject(projectId);
+            if (project == null) {
+                InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find project by id " + projectId);
+                ex.addProxyObject(project, projectId, "projectId");
+                throw ex;
+            }
+            accountId = project.getProjectAccountId();
+        }
+
+
+        SearchBuilder<AccountGuestVlanMapVO> sb = _accountGuestVlanMapDao.createSearchBuilder();
+        sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
+        sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.EQ);
+        sb.and("guestVlanRange", sb.entity().getGuestVlanRange(), SearchCriteria.Op.EQ);
+        sb.and("physicalNetworkId", sb.entity().getPhysicalNetworkId(), SearchCriteria.Op.EQ);
+
+        if (zoneId != null) {
+            SearchBuilder<PhysicalNetworkVO> physicalnetworkSearch = _physicalNetworkDao.createSearchBuilder();
+            physicalnetworkSearch.and("zoneId", physicalnetworkSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+            sb.join("physicalnetworkSearch", physicalnetworkSearch, sb.entity().getPhysicalNetworkId(), physicalnetworkSearch.entity().getId(), JoinBuilder.JoinType.INNER);
+        }
+
+        SearchCriteria<AccountGuestVlanMapVO> sc = sb.create();
+        if (id != null) {
+            sc.setParameters("id", id);
+        }
+
+        if (accountId != null) {
+            sc.setParameters("accountId", accountId);
+        }
+
+        if (guestVlanRange != null) {
+            sc.setParameters("guestVlanRange", guestVlanRange);
+        }
+
+        if (physicalNetworkId != null) {
+            sc.setParameters("physicalNetworkId", physicalNetworkId);
+        }
+
+        if (zoneId != null) {
+            sc.setJoinParameters("physicalnetworkSearch", "zoneId", zoneId);
+        }
+
+        Filter searchFilter = new Filter(AccountGuestVlanMapVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
+        Pair<List<AccountGuestVlanMapVO>, Integer> result = _accountGuestVlanMapDao.searchAndCount(sc, searchFilter);
+        return new Pair<List<? extends GuestVlan>, Integer>(result.first(), result.second());
+    }
+
+    @Override
+    @ActionEvent(eventType = EventTypes.EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE, eventDescription = "releasing" +
+            " dedicated guest vlan range", async = true)
+    @DB
+    public boolean releaseDedicatedGuestVlanRange(Long dedicatedGuestVlanRangeId) {
+        // Verify dedicated range exists
+        AccountGuestVlanMapVO dedicatedGuestVlan = _accountGuestVlanMapDao.findById(dedicatedGuestVlanRangeId);
+        if (dedicatedGuestVlan == null) {
+        	throw new InvalidParameterValueException("Dedicated guest vlan with specified" +
+            		" id doesn't exist in the system");
+        }
+
+        // Remove dedication for the guest vlan
+        _datacneter_vnet.releaseDedicatedGuestVlans(dedicatedGuestVlan.getId());
+        if (_accountGuestVlanMapDao.remove(dedicatedGuestVlanRangeId)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    @Override
     public List<? extends Service> listNetworkServices(String providerName) {
 
         Provider provider = null;
@@ -2715,7 +3117,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         }
     }
 
-    
+
     @Override
     @DB
     @ActionEvent(eventType = EventTypes.EVENT_SERVICE_PROVIDER_CREATE, eventDescription = "Creating Physical Network ServiceProvider", create = true)
@@ -2734,7 +3136,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             PhysicalNetworkVO destNetwork = _physicalNetworkDao.findById(destinationPhysicalNetworkId);
             if (destNetwork == null) {
                 InvalidParameterValueException ex = new InvalidParameterValueException("Destination Physical Network with specified id doesn't exist in the system");
-                ex.addProxyObject(destNetwork, destinationPhysicalNetworkId, "destinationPhysicalNetworkId");                
+                ex.addProxyObject(destNetwork, destinationPhysicalNetworkId, "destinationPhysicalNetworkId");
                 throw ex;
             }
         }
@@ -2976,7 +3378,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         } else {
             pNtwks = _physicalNetworkDao.listByZone(zoneId);
         }
-        
+
         if (pNtwks.isEmpty()) {
             throw new InvalidParameterValueException("Unable to find physical network in zone id=" + zoneId);
         }
@@ -3003,8 +3405,8 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         }
     }
 
-   
-   
+
+
     @Override
     @DB
     @ActionEvent(eventType = EventTypes.EVENT_TRAFFIC_TYPE_CREATE, eventDescription = "Creating Physical Network TrafficType", create = true)
@@ -3169,7 +3571,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         return new Pair<List<? extends PhysicalNetworkTrafficType>, Integer>(result.first(), result.second());
     }
 
-   
+
 
 
 
@@ -3196,48 +3598,66 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         if (networkElement == null) {
             throw new CloudRuntimeException("Unable to find the Network Element implementing the VirtualRouter Provider");
         }
-        
+
         VirtualRouterElement element = (VirtualRouterElement)networkElement;
         element.addElement(nsp.getId(), VirtualRouterProviderType.VirtualRouter);
 
         return nsp;
     }
-    
+
     protected PhysicalNetworkServiceProvider addDefaultVpcVirtualRouterToPhysicalNetwork(long physicalNetworkId) {
 
-        PhysicalNetworkServiceProvider nsp = addProviderToPhysicalNetwork(physicalNetworkId, 
+        PhysicalNetworkServiceProvider nsp = addProviderToPhysicalNetwork(physicalNetworkId,
                 Network.Provider.VPCVirtualRouter.getName(), null, null);
- 
+
         NetworkElement networkElement =  _networkModel.getElementImplementingProvider(Network.Provider.VPCVirtualRouter.getName());
         if (networkElement == null) {
             throw new CloudRuntimeException("Unable to find the Network Element implementing the VPCVirtualRouter Provider");
         }
-        
+
         VpcVirtualRouterElement element = (VpcVirtualRouterElement)networkElement;
         element.addElement(nsp.getId(), VirtualRouterProviderType.VPCVirtualRouter);
 
         return nsp;
     }
+    
+    
+    protected PhysicalNetworkServiceProvider addDefaultInternalLbProviderToPhysicalNetwork(long physicalNetworkId) {
+
+        PhysicalNetworkServiceProvider nsp = addProviderToPhysicalNetwork(physicalNetworkId, 
+                Network.Provider.InternalLbVm.getName(), null, null);
+ 
+        NetworkElement networkElement =  _networkModel.getElementImplementingProvider(Network.Provider.InternalLbVm.getName());
+        if (networkElement == null) {
+            throw new CloudRuntimeException("Unable to find the Network Element implementing the " + Network.Provider.InternalLbVm.getName() + " Provider");
+        }
+        
+        _internalLbElementSvc.addInternalLoadBalancerElement(nsp.getId());
+
+        return nsp;
+    }
 
     protected PhysicalNetworkServiceProvider addDefaultSecurityGroupProviderToPhysicalNetwork(long physicalNetworkId) {
 
-        PhysicalNetworkServiceProvider nsp = addProviderToPhysicalNetwork(physicalNetworkId, 
+        PhysicalNetworkServiceProvider nsp = addProviderToPhysicalNetwork(physicalNetworkId,
                 Network.Provider.SecurityGroupProvider.getName(), null, null);
 
         return nsp;
     }
+    
+    
 
     private PhysicalNetworkServiceProvider addDefaultBaremetalProvidersToPhysicalNetwork(long physicalNetworkId) {
         PhysicalNetworkVO pvo = _physicalNetworkDao.findById(physicalNetworkId);
         DataCenterVO dvo = _dcDao.findById(pvo.getDataCenterId());
         if (dvo.getNetworkType() == NetworkType.Basic) {
- 
+
         	// Baremetal is currently disabled
 /*
             addProviderToPhysicalNetwork(physicalNetworkId, "BaremetalDhcpProvider", null, null);
             addProviderToPhysicalNetwork(physicalNetworkId, "BaremetalPxeProvider", null, null);
             addProviderToPhysicalNetwork(physicalNetworkId, "BaremetaUserdataProvider", null, null);
-*/        
+*/
         }
         return null;
     }
@@ -3251,13 +3671,13 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         }
     }
 
-    
-    
+
+
     private boolean getAllowSubdomainAccessGlobal() {
         return _allowSubdomainNetworkAccess;
     }
 
-  
+
 
     @Override
     public List<Pair<TrafficType, String>> listTrafficTypeImplementor(ListTrafficTypeImplementorsCmd cmd) {
@@ -3282,7 +3702,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         return results;
     }
 
-    
+
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_NET_IP_ASSIGN, eventDescription = "associating Ip", async = true)
     public IpAddress associateIPToNetwork(long ipId, long networkId) throws InsufficientAddressCapacityException,
@@ -3298,20 +3718,20 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
                     " to VPC.Specify vpcId to associate ip address to VPC");
         }
         return _networkMgr.associateIPToGuestNetwork(ipId, networkId, true);
-        
+
     }
-    
+
 
     @Override @DB
-    public Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, 
-            String vlan, String startIp, String endIp, String gateway, String netmask, long networkOwnerId, Long vpcId) 
+    public Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId,
+                                        String vlan, String startIp, String endIp, String gateway, String netmask, long networkOwnerId, Long vpcId, Boolean sourceNat)
                     throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
-        
+
         Account owner = _accountMgr.getAccount(networkOwnerId);
-        
+
         // Get system network offeirng
         NetworkOfferingVO ntwkOff = findSystemNetworkOffering(NetworkOffering.SystemPrivateGatewayNetworkOffering);
-        
+
         // Validate physical network
         PhysicalNetwork pNtwk = _physicalNetworkDao.findById(physicalNetworkId);
         if (pNtwk == null) {
@@ -3320,7 +3740,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             ex.addProxyObject("physical_network", physicalNetworkId, "physicalNetworkId");
             throw ex;
         }
-        
+
         // VALIDATE IP INFO
         // if end ip is not specified, default it to startIp
         if (!NetUtils.isValidIp(startIp)) {
@@ -3341,49 +3761,49 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         }
 
         cidr = NetUtils.ipAndNetMaskToCidr(gateway, netmask);
-        
-        
+
+
         Transaction txn = Transaction.currentTxn();
         txn.start();
-        
+
         //lock datacenter as we need to get mac address seq from there
         DataCenterVO dc = _dcDao.lockRow(pNtwk.getDataCenterId(), true);
-        
+
         //check if we need to create guest network
         Network privateNetwork = _networksDao.getPrivateNetwork(BroadcastDomainType.Vlan.toUri(vlan).toString(), cidr,
                 networkOwnerId, pNtwk.getDataCenterId());
         if (privateNetwork == null) {
             //create Guest network
-            privateNetwork = _networkMgr.createGuestNetwork(ntwkOff.getId(), networkName, displayText, gateway, cidr, vlan, 
+            privateNetwork = _networkMgr.createGuestNetwork(ntwkOff.getId(), networkName, displayText, gateway, cidr, vlan,
                     null, owner, null, pNtwk, pNtwk.getDataCenterId(), ACLType.Account, null, null, null, null, true);
             s_logger.debug("Created private network " + privateNetwork);
         } else {
             s_logger.debug("Private network already exists: " + privateNetwork);
         }
-        
+
         //add entry to private_ip_address table
         PrivateIpVO privateIp = _privateIpDao.findByIpAndSourceNetworkId(privateNetwork.getId(), startIp);
         if (privateIp != null) {
             throw new InvalidParameterValueException("Private ip address " + startIp + " already used for private gateway" +
                     " in zone " + _configMgr.getZone(pNtwk.getDataCenterId()).getName());
         }
-        
+
         Long mac = dc.getMacAddress();
         Long nextMac = mac + 1;
         dc.setMacAddress(nextMac);
 
-        privateIp = new PrivateIpVO(startIp, privateNetwork.getId(), nextMac, vpcId);
+        privateIp = new PrivateIpVO(startIp, privateNetwork.getId(), nextMac, vpcId, sourceNat);
         _privateIpDao.persist(privateIp);
-        
+
         _dcDao.update(dc.getId(), dc);
-        
+
         txn.commit();
         s_logger.debug("Private network " + privateNetwork + " is created");
 
         return privateNetwork;
     }
 
-    
+
     private NetworkOfferingVO findSystemNetworkOffering(String offeringName) {
         List<NetworkOfferingVO> allOfferings = _networkOfferingDao.listSystemNetworkOfferings();
         for (NetworkOfferingVO offer: allOfferings){
@@ -3417,55 +3837,17 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
     }
 
     @Override
-    public void addNicDetail(AddNicDetailCmd cmd){
-        UserContext.current().setEventDetails("Nic Id: " + cmd.getId());
-        Account caller = UserContext.current().getCaller();
-        Long nicId = cmd.getId();
-        String name = cmd.getName();
-        String value = cmd.getValue();
-
-        NicVO nic = _nicDao.findById(nicId);
-
-        //_accountMgr.checkAccess(caller, null, true, nic);
-        NicDetailVO nicDetail = new NicDetailVO(nicId, name, value);
-        _nicDetailDao.persist(nicDetail);
+    public void removeNicDetail(RemoveNicDetailCmd removeNicDetailCmd) {
+        //To change body of implemented methods use File | Settings | File Templates.
     }
 
     @Override
-    public void updateNicDetail(UpdateNicDetailCmd cmd){
-        UserContext.current().setEventDetails("Nic Id: " + cmd.getId());
-        Account caller = UserContext.current().getCaller();
-        Long nicId = cmd.getId();
-        String name = cmd.getName();
-        String value = cmd.getValue();
-
-        NicVO nic = _nicDao.findById(nicId);
-        // _accountMgr.checkAccess(caller, null, true, nic);
-        NicDetailVO nicDetail = _nicDetailDao.findDetail(nicId, name);
-        if(nicDetail != null){
-            nicDetail.setValue(value);
-            _nicDetailDao.update(nicDetail.getId(), nicDetail);
-        }else{
-            throw new InvalidParameterValueException("This detail doesnt exist for the nic");
-        }
-
+    public void addNicDetail(AddNicDetailCmd addNicDetailCmd) {
+        //To change body of implemented methods use File | Settings | File Templates.
     }
 
     @Override
-    public void removeNicDetail(RemoveNicDetailCmd cmd){
-        Account caller = UserContext.current().getCaller();
-        Long nicId = cmd.getId();
-        String name = cmd.getName();
-
-        NicVO nic = _nicDao.findById(nicId);
-        //_accountMgr.checkAccess(caller, null, true, nic);
-        NicDetailVO nicDetail = _nicDetailDao.findDetail(nicId, name);
-        if(nicDetail != null){
-            _nicDetailDao.remove(nicDetail.getId());
-        }else{
-            throw new InvalidParameterValueException("This detail doesnt exist for the nic ");
-        }
-
+    public void updateNicDetail(UpdateNicDetailCmd updateNicDetailCmd) {
+        //To change body of implemented methods use File | Settings | File Templates.
     }
-
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e107776d/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index e6cea77..0f6adc0 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -1062,7 +1062,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
 
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_VM_SCALE, eventDescription = "scaling Vm")
-    public UserVm
+    public boolean
     upgradeVirtualMachine(ScaleVMCmd cmd) throws InvalidParameterValueException, ResourceAllocationException {
 
         Long vmId = cmd.getId();
@@ -1076,7 +1076,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
         }
 
         if(vmInstance.getState().equals(State.Stopped)){
-            return upgradeStoppedVirtualMachine(vmId, newServiceOfferingId);
+            upgradeStoppedVirtualMachine(vmId, newServiceOfferingId);
+            return true;
         }
 
         _accountMgr.checkAccess(caller, null, true, vmInstance);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e107776d/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 698c553..19b6aa1 100755
--- a/server/test/com/cloud/network/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/network/MockNetworkManagerImpl.java
@@ -640,7 +640,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
     }
 
     @Override
-    public Network createPrivateNetwork(String s, String s2, long l, String s3, String s4, String s5, String s6, String s7, long l2, Long aLong) throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
+    public Network createPrivateNetwork(String s, String s2, long l, String s3, String s4, String s5, String s6, String s7, long l2, Long aLong, Boolean aBoolean) throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
         return null;  //To change body of implemented methods use File | Settings | File Templates.
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e107776d/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 7ba4b59..0b1de60 100644
--- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
@@ -24,6 +24,7 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import com.cloud.vm.*;
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
 import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
@@ -83,14 +84,7 @@ import com.cloud.user.Account;
 import com.cloud.user.User;
 import com.cloud.utils.Pair;
 import com.cloud.utils.component.ManagerBase;
-import com.cloud.vm.Nic;
-import com.cloud.vm.NicProfile;
-import com.cloud.vm.NicVO;
-import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VMInstanceVO;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachine.Type;
-import com.cloud.vm.VirtualMachineProfile;
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
 import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;