Merge branch 'master' into resizevolume

Conflicts:
	test/integration/smoke/test_volumes.py
diff --git a/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java b/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java
index 92c7ac5..263f023 100644
--- a/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java
+++ b/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java
@@ -31,7 +31,7 @@
 import com.cloud.network.Network;
 import com.cloud.user.UserContext;
 
-@APICommand(description="Creates a private network", responseObject=NetworkResponse.class)
+//@APICommand(description="Creates a private network", responseObject=NetworkResponse.class)
 public class CreatePrivateNetworkCmd extends BaseAsyncCreateCmd {
     public static final Logger s_logger = Logger.getLogger(CreatePrivateNetworkCmd.class.getName());
 
@@ -153,6 +153,7 @@
 
         if (result != null) {
             this.setEntityId(result.getId());
+            this.setEntityUuid(result.getUuid());
         } else {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a Private network");
         }
@@ -190,8 +191,4 @@
 
     }
 
-    @Override
-    public String getEntityTable() {
-        return "networks";
-    }
 }
diff --git a/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java b/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
index 17bafb1..8026907 100644
--- a/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
+++ b/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
@@ -25,7 +25,7 @@
 import com.cloud.user.Account;
 import com.cloud.user.UserContext;
 
-@APICommand(description="Destroys console proxy", responseObject=SuccessResponse.class)
+//@APICommand(description="Destroys console proxy", responseObject=SuccessResponse.class)
 public class DestroyConsoleProxyCmd extends BaseAsyncCmd {
     public static final Logger s_logger = Logger.getLogger(DestroyConsoleProxyCmd.class.getName());
 
diff --git a/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java b/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java
index 41f28f9..709da6a 100644
--- a/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java
+++ b/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java
@@ -27,7 +27,7 @@
 import org.apache.cloudstack.api.response.SnapshotScheduleResponse;
 import com.cloud.storage.snapshot.SnapshotSchedule;
 
-@APICommand(description="Lists recurring snapshot schedule", responseObject=SnapshotScheduleResponse.class)
+//@APICommand(description="Lists recurring snapshot schedule", responseObject=SnapshotScheduleResponse.class)
 public class ListRecurringSnapshotScheduleCmd extends BaseListCmd {
     private static final String s_name = "listrecurringsnapshotscheduleresponse";
 
diff --git a/api/src/com/cloud/exception/CloudAuthenticationException.java b/api/src/com/cloud/exception/CloudAuthenticationException.java
index 2bba79b..0bf114c 100644
--- a/api/src/com/cloud/exception/CloudAuthenticationException.java
+++ b/api/src/com/cloud/exception/CloudAuthenticationException.java
@@ -17,9 +17,9 @@
 package com.cloud.exception;
 
 import com.cloud.utils.SerialVersionUID;
-import com.cloud.utils.exception.RuntimeCloudException;
+import com.cloud.utils.exception.CloudRuntimeException;
 
-public class CloudAuthenticationException extends RuntimeCloudException {
+public class CloudAuthenticationException extends CloudRuntimeException {
     private static final long serialVersionUID = SerialVersionUID.CloudAuthenticationException;
 
     public CloudAuthenticationException(String message) {
diff --git a/api/src/com/cloud/exception/CloudException.java b/api/src/com/cloud/exception/CloudException.java
index fd83956..7326702 100644
--- a/api/src/com/cloud/exception/CloudException.java
+++ b/api/src/com/cloud/exception/CloudException.java
@@ -16,10 +16,8 @@
 // under the License.
 package com.cloud.exception;
 
-import com.cloud.utils.IdentityProxy;
 import java.util.ArrayList;
 import com.cloud.utils.exception.CSExceptionErrorCode;
-import com.cloud.utils.AnnotationHelper;
 
 /**
  * by the API response serializer. Any exceptions that are thrown by
diff --git a/api/src/com/cloud/exception/CloudExecutionException.java b/api/src/com/cloud/exception/CloudExecutionException.java
deleted file mode 100755
index d8d70f8..0000000
--- a/api/src/com/cloud/exception/CloudExecutionException.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.exception;
-
-import java.util.HashMap;
-import com.cloud.utils.exception.RuntimeCloudException;
-
-import com.cloud.utils.SerialVersionUID;
-
-/**
- *
- */
-public class CloudExecutionException extends RuntimeCloudException {
-    private final static long serialVersionUID = SerialVersionUID.CloudExecutionException;
-
-    private final ErrorCode code;
-    private final HashMap<String, Object> details;
-
-    public CloudExecutionException(ErrorCode code, String message, Throwable cause) {
-        super(message, cause);
-        this.code = code;
-        details = new HashMap<String, Object>();
-    }
-
-    public ErrorCode getErrorCode() {
-        return code;
-    }
-
-    public String getErrorMessage() {
-        return new StringBuilder("Error Code=").append(code).append("; Error Message=").append(super.toString()).toString();
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder buff = new StringBuilder();
-        buff.append("Error Code=").append(code);
-        buff.append("; Error Message=").append(super.toString());
-        if (details.size() > 0) {
-            buff.append("; Error Details=").append(details.toString());
-        }
-        return buff.toString();
-    }
-}
diff --git a/api/src/com/cloud/exception/ErrorCode.java b/api/src/com/cloud/exception/ErrorCode.java
deleted file mode 100755
index 8f048b8..0000000
--- a/api/src/com/cloud/exception/ErrorCode.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.exception;
-
-import java.util.HashSet;
-
-/**
- */
-public class ErrorCode {
-    String code;
-    private static HashSet<ErrorCode> s_codes = new HashSet<ErrorCode>();
-
-    public ErrorCode(String code) {
-        this.code = code;
-        assert !s_codes.contains(this) : "There is already an error code registered for this code: " + code;
-        s_codes.add(this);
-    }
-
-    public String getCode() {
-        return code;
-    }
-
-    @Override
-    public int hashCode() {
-        return code.hashCode();
-    }
-
-    @Override
-    public boolean equals(Object that) {
-        if (!(that instanceof ErrorCode)) {
-            return false;
-        }
-
-        return this.code.equals(((ErrorCode)that).code);
-    }
-
-    public final static ErrorCode UnableToReachResource = new ErrorCode("resource.unavailable");
-}
diff --git a/api/src/com/cloud/network/Network.java b/api/src/com/cloud/network/Network.java
index 39a0b26..c91f6a9 100644
--- a/api/src/com/cloud/network/Network.java
+++ b/api/src/com/cloud/network/Network.java
@@ -170,7 +170,6 @@
         public static final Capability AllowDnsSuffixModification = new Capability("AllowDnsSuffixModification");
         public static final Capability RedundantRouter = new Capability("RedundantRouter");
         public static final Capability ElasticIp = new Capability("ElasticIp");
-        public static final Capability AssociatePublicIP = new Capability("AssociatePublicIP");
         public static final Capability ElasticLb = new Capability("ElasticLb");
         public static final Capability AutoScaleCounters = new Capability("AutoScaleCounters");
         public static final Capability InlineMode = new Capability("InlineMode");
diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java
index d5841a4..b3332a3 100755
--- a/api/src/com/cloud/network/NetworkService.java
+++ b/api/src/com/cloud/network/NetworkService.java
@@ -41,7 +41,7 @@
 
     List<? extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner);
 
-    IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId) throws ResourceAllocationException,
+    IpAddress allocateIP(Account ipOwner, boolean isSystem, long zoneId) throws ResourceAllocationException,
         InsufficientAddressCapacityException, ConcurrentOperationException;
 
     boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException;
@@ -60,6 +60,8 @@
 
     Network getNetwork(long networkId);
 
+    Network getNetwork(String networkUuid);
+
     IpAddress getIp(long id);
 
     NetworkProfile convertNetworkToNetworkProfile(long networkId);
diff --git a/api/src/com/cloud/offering/NetworkOffering.java b/api/src/com/cloud/offering/NetworkOffering.java
index b69ad88..f2c4de5 100644
--- a/api/src/com/cloud/offering/NetworkOffering.java
+++ b/api/src/com/cloud/offering/NetworkOffering.java
@@ -105,8 +105,6 @@
 
     boolean getElasticIp();
 
-    boolean getAssociatePublicIP();
-
     boolean getElasticLb();
 
     boolean getSpecifyIpRanges();
diff --git a/api/src/com/cloud/user/AccountService.java b/api/src/com/cloud/user/AccountService.java
index ce16f5e..9f5f4d22 100755
--- a/api/src/com/cloud/user/AccountService.java
+++ b/api/src/com/cloud/user/AccountService.java
@@ -20,6 +20,7 @@
 import java.util.Map;
 
 import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 
 import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd;
@@ -193,6 +194,8 @@
 
     UserAccount getUserByApiKey(String apiKey);
 
+    RoleType getRoleType(Account account);
+
     void checkAccess(Account account, Domain domain) throws PermissionDeniedException;
 
     void checkAccess(Account account, AccessType accessType, boolean sameOwner, ControlledEntity... entities) throws PermissionDeniedException;
diff --git a/api/src/com/cloud/user/DomainService.java b/api/src/com/cloud/user/DomainService.java
index 6fbe1b9..cd20060 100644
--- a/api/src/com/cloud/user/DomainService.java
+++ b/api/src/com/cloud/user/DomainService.java
@@ -30,6 +30,8 @@
 
     Domain getDomain(long id);
 
+    Domain getDomain(String uuid);
+
     /**
      * Return whether a domain is a child domain of a given domain.
      *
diff --git a/api/src/com/cloud/user/UserContext.java b/api/src/com/cloud/user/UserContext.java
index b140728..539e118 100644
--- a/api/src/com/cloud/user/UserContext.java
+++ b/api/src/com/cloud/user/UserContext.java
@@ -50,6 +50,10 @@
         return userId;
     }
 
+    public User getCallerUser() {
+        return _accountMgr.getActiveUser(userId);
+    }
+
     public void setCallerUserId(long userId) {
         this.userId = userId;
     }
diff --git a/api/src/org/apache/cloudstack/acl/APIAccessChecker.java b/api/src/org/apache/cloudstack/acl/APIChecker.java
similarity index 67%
rename from api/src/org/apache/cloudstack/acl/APIAccessChecker.java
rename to api/src/org/apache/cloudstack/acl/APIChecker.java
index 3194bd1..0d0dfd1 100644
--- a/api/src/org/apache/cloudstack/acl/APIAccessChecker.java
+++ b/api/src/org/apache/cloudstack/acl/APIChecker.java
@@ -16,17 +16,15 @@
 // under the License.
 package org.apache.cloudstack.acl;
 
-import java.util.Properties;
-
 import com.cloud.exception.PermissionDeniedException;
-import com.cloud.user.Account;
 import com.cloud.user.User;
 import com.cloud.utils.component.Adapter;
 
-/**
- * APIAccessChecker checks the ownership and access control to API requests
- */
-public interface APIAccessChecker extends Adapter {
-    // Interface for checking access to an API for an user
-    boolean canAccessAPI(User user, String apiCommandName) throws PermissionDeniedException;
+// APIChecker checks the ownership and access control to API requests
+public interface APIChecker extends Adapter {
+    // Interface for checking access for a role using apiname
+    // If true, apiChecker has checked the operation
+    // If false, apiChecker is unable to handle the operation or not implemented
+    // On exception, checkAccess failed don't allow
+    boolean checkAccess(User user, String apiCommandName) throws PermissionDeniedException;
 }
diff --git a/api/src/org/apache/cloudstack/acl/APIAccessChecker.java b/api/src/org/apache/cloudstack/acl/RoleType.java
similarity index 64%
copy from api/src/org/apache/cloudstack/acl/APIAccessChecker.java
copy to api/src/org/apache/cloudstack/acl/RoleType.java
index 3194bd1..0d1c446 100644
--- a/api/src/org/apache/cloudstack/acl/APIAccessChecker.java
+++ b/api/src/org/apache/cloudstack/acl/RoleType.java
@@ -16,17 +16,22 @@
 // under the License.
 package org.apache.cloudstack.acl;
 
-import java.util.Properties;
+// Enum for default roles in CloudStack
+public enum RoleType {
 
-import com.cloud.exception.PermissionDeniedException;
-import com.cloud.user.Account;
-import com.cloud.user.User;
-import com.cloud.utils.component.Adapter;
+    Admin(1),
+    ResourceAdmin(2),
+    DomainAdmin(4),
+    User(8),
+    Unknown(0);
 
-/**
- * APIAccessChecker checks the ownership and access control to API requests
- */
-public interface APIAccessChecker extends Adapter {
-    // Interface for checking access to an API for an user
-    boolean canAccessAPI(User user, String apiCommandName) throws PermissionDeniedException;
+    private int mask;
+
+    private RoleType(int mask) {
+        this.mask = mask;
+    }
+
+    public int getValue() {
+        return mask;
+    }
 }
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index 81dd289..58a7831 100644
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -158,6 +158,7 @@
     public static final String RECEIVED_BYTES = "receivedbytes";
     public static final String REQUIRES_HVM = "requireshvm";
     public static final String RESOURCE_TYPE = "resourcetype";
+    public static final String RESPONSE = "response";
     public static final String QUERY_FILTER = "queryfilter";
     public static final String SCHEDULE = "schedule";
     public static final String SCOPE = "scope";
diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncCreateCmd.java b/api/src/org/apache/cloudstack/api/BaseAsyncCreateCmd.java
index ad9f4c6..1f2d3f1 100644
--- a/api/src/org/apache/cloudstack/api/BaseAsyncCreateCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseAsyncCreateCmd.java
@@ -25,6 +25,8 @@
     @Parameter(name = "id", type = CommandType.LONG)
     private Long id;
 
+    private String uuid;
+
     public abstract void create() throws ResourceAllocationException;
 
     public Long getEntityId() {
@@ -35,14 +37,19 @@
         this.id = id;
     }
 
-    public abstract String getEntityTable();
+    public String getEntityUuid() {
+        return uuid;
+    }
 
-    public String getResponse(long jobId, long objectId, String objectEntityTable) {
+    public void setEntityUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    public String getResponse(long jobId, String objectUuid) {
         CreateCmdResponse response = new CreateCmdResponse();
         AsyncJob job = _entityMgr.findById(AsyncJob.class, jobId);
         response.setJobId(job.getUuid());
-        response.setId(objectId);
-        response.setIdEntityTable(objectEntityTable);
+        response.setId(objectUuid);
         response.setResponseName(getCommandName());
         return _responseGenerator.toSerializedString(response, getResponseType());
     }
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index d964e70..3399784 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -19,7 +19,6 @@
 
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -64,7 +63,6 @@
 import com.cloud.user.AccountService;
 import com.cloud.user.DomainService;
 import com.cloud.user.ResourceLimitService;
-import com.cloud.utils.IdentityProxy;
 import com.cloud.utils.Pair;
 import com.cloud.utils.component.ComponentLocator;
 import com.cloud.vm.BareMetalVmService;
diff --git a/api/src/org/apache/cloudstack/api/BaseResponse.java b/api/src/org/apache/cloudstack/api/BaseResponse.java
index 28ca6b8..01f1be3 100644
--- a/api/src/org/apache/cloudstack/api/BaseResponse.java
+++ b/api/src/org/apache/cloudstack/api/BaseResponse.java
@@ -17,7 +17,6 @@
 package org.apache.cloudstack.api;
 
 import org.apache.cloudstack.api.ApiConstants;
-import com.cloud.utils.IdentityProxy;
 import org.apache.cloudstack.api.ResponseObject;
 import com.cloud.serializer.Param;
 import com.google.gson.annotations.SerializedName;
@@ -46,6 +45,7 @@
         this.objectName = objectName;
     }
 
+    @Override
     public String getObjectId() {
         return null;
     }
@@ -56,18 +56,22 @@
     @SerializedName(ApiConstants.JOB_STATUS) @Param(description="the current status of the latest async job acting on this object")
     private Integer jobStatus;
 
+    @Override
     public String getJobId() {
         return jobId;
     }
 
+    @Override
     public void setJobId(String jobId) {
         this.jobId = jobId;
     }
 
+    @Override
     public Integer getJobStatus() {
         return jobStatus;
     }
 
+    @Override
     public void setJobStatus(Integer jobStatus) {
         this.jobStatus = jobStatus;
     }
diff --git a/api/src/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
index e9f988a..63df4dc 100644
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@ -315,13 +315,6 @@
     StorageNetworkIpRangeResponse createStorageNetworkIpRangeResponse(StorageNetworkIpRange result);
 
     /**
-     * @param tableName TODO
-     * @param token
-     * @return
-     */
-    Long getIdentiyId(String tableName, String token);
-
-    /**
      * @param resourceTag
      * @param keyValueOnly TODO
      * @return
diff --git a/api/src/org/apache/cloudstack/api/ServerApiException.java b/api/src/org/apache/cloudstack/api/ServerApiException.java
index 70fd34e..1f57b74 100644
--- a/api/src/org/apache/cloudstack/api/ServerApiException.java
+++ b/api/src/org/apache/cloudstack/api/ServerApiException.java
@@ -15,10 +15,10 @@
 // specific language governing permissions and limitations
 // under the License.
 package org.apache.cloudstack.api;
-import com.cloud.utils.exception.RuntimeCloudException;
+import com.cloud.utils.exception.CloudRuntimeException;
 
 @SuppressWarnings("serial")
-public class ServerApiException extends RuntimeCloudException {
+public class ServerApiException extends CloudRuntimeException {
     private int _errorCode;
     private String _description;
 
diff --git a/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
index 7369a6f..a119d0f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
@@ -81,6 +81,7 @@
 
         if (ctr != null) {
             this.setEntityId(ctr.getId());
+            this.setEntityUuid(ctr.getUuid());
             CounterResponse response = _responseGenerator.createCounterResponse(ctr);
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
@@ -113,8 +114,5 @@
         return Account.ACCOUNT_ID_SYSTEM;
     }
 
-    @Override
-    public String getEntityTable() {
-        return "counter";
-    }
+
 }
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java
index b6518d8..6d4b962 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java
@@ -59,10 +59,6 @@
     @Parameter(name=ApiConstants.SERVICE_LIST, type=CommandType.LIST, collectionType = CommandType.STRING, description="the list of services to be enabled for this physical network service provider")
     private List<String> enabledServices;
 
-    @Override
-    public String getEntityTable() {
-        return "physical_network_service_providers";
-    }
 
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
@@ -116,6 +112,7 @@
         PhysicalNetworkServiceProvider result = _networkService.addProviderToPhysicalNetwork(getPhysicalNetworkId(), getProviderName(), getDestinationPhysicalNetworkId(), getEnabledServices());
         if (result != null) {
             setEntityId(result.getId());
+            setEntityUuid(result.getUuid());
         } else {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add service provider entity to physical network");
         }
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java
index dd3f323..f56ae7d 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java
@@ -79,10 +79,6 @@
         return tags;
     }
 
-    @Override
-    public String getEntityTable() {
-        return "physical_network";
-    }
 
     public Long getZoneId() {
         return zoneId;
@@ -164,6 +160,7 @@
         PhysicalNetwork result = _networkService.createPhysicalNetwork(getZoneId(),getVlan(),getNetworkSpeed(), getIsolationMethods(),getBroadcastDomainRange(),getDomainId(), getTags(), getNetworkName());
         if (result != null) {
             setEntityId(result.getId());
+            setEntityUuid(result.getUuid());
         } else {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network entity");
         }
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 545218f..f6a7b74 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
@@ -53,10 +53,7 @@
         this.nspId = nspId;
     }
 
-    @Override
-    public String getEntityTable() {
-        return "virtual_router_providers";
-    }
+
 
     public Long getNspId() {
         return nspId;
@@ -94,6 +91,7 @@
         VirtualRouterProvider result = _service.addElement(getNspId(), VirtualRouterProviderType.VirtualRouter);
         if (result != null) {
             setEntityId(result.getId());
+            setEntityUuid(result.getUuid());
         } else {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
         }
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java
index 1759ff7..5dca9d2 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java
@@ -66,10 +66,6 @@
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
 
-    @Override
-    public String getEntityTable() {
-        return "physical_network_traffic_types";
-    }
 
     public Long getPhysicalNetworkId() {
         return physicalNetworkId;
@@ -136,6 +132,7 @@
         PhysicalNetworkTrafficType result = _networkService.addTrafficTypeToPhysicalNetwork(getPhysicalNetworkId(), getTrafficType(), getXenLabel(), getKvmLabel(), getVmwareLabel(), getSimulatorLabel(), getVlan());
         if (result != null) {
             setEntityId(result.getId());
+            setEntityUuid(result.getUuid());
         } else {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add traffic type to physical network");
         }
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 7950b87..5bb76ab 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
@@ -123,6 +123,7 @@
 
         if (result != null) {
             this.setEntityId(result.getId());
+            this.setEntityUuid(result.getUuid());
         } else {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private gateway");
         }
@@ -156,10 +157,6 @@
         return  "creating private gateway";
     }
 
-    @Override
-    public String getEntityTable() {
-        return "vpc_gateways";
-    }
 
 
     @Override
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
index a0abe99..273f7c0 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
@@ -70,6 +70,7 @@
         VpcOffering vpcOff = _vpcService.createVpcOffering(getVpcOfferingName(), getDisplayText(), getSupportedServices());
         if (vpcOff != null) {
             this.setEntityId(vpcOff.getId());
+            this.setEntityUuid(vpcOff.getUuid());
         } else {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a VPC offering");
         }
@@ -87,10 +88,6 @@
         }
     }
 
-    @Override
-    public String getEntityTable() {
-       return "vpc_offerings";
-    }
 
     @Override
     public String getEventType() {
diff --git a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
index 7d4e44b..93bb240 100644
--- a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
@@ -87,9 +87,6 @@
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "user_ip_address";
-    }
 
     public String getAccountName() {
         if (accountName != null) {
@@ -216,10 +213,11 @@
     @Override
     public void create() throws ResourceAllocationException{
         try {
-            IpAddress ip =  _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()),  getZoneId(), getNetworkId());
+            IpAddress ip =  _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()), false, getZoneId());
 
             if (ip != null) {
                 this.setEntityId(ip.getId());
+                this.setEntityUuid(ip.getUuid());
             } else {
                 throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to allocate ip address");
             }
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java
index db3aaa6..e92721d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java
@@ -62,10 +62,6 @@
     private Long conditionDomainId;
     private Long conditionAccountId;
 
-    @Override
-    public String getEntityTable() {
-        return "autoscale_policies";
-    }
 
     public int getDuration() {
         return duration;
@@ -159,6 +155,7 @@
         AutoScalePolicy result = _autoScaleService.createAutoScalePolicy(this);
         if (result != null) {
             this.setEntityId(result.getId());
+            this.setEntityUuid(result.getUuid());
         } else {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create AutoScale Policy");
         }
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java
index 6297888..e3d47a0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java
@@ -72,10 +72,6 @@
     // ///////////////// Accessors ///////////////////////
     // ///////////////////////////////////////////////////
 
-    @Override
-    public String getEntityTable() {
-        return "autoscale_vmgroups";
-    }
 
     public int getMinMembers() {
         return minMembers;
@@ -161,6 +157,7 @@
         AutoScaleVmGroup result = _autoScaleService.createAutoScaleVmGroup(this);
         if (result != null) {
             this.setEntityId(result.getId());
+            this.setEntityUuid(result.getUuid());
         } else {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Autoscale Vm Group");
         }
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java
index daa4850..25bb03b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java
@@ -86,10 +86,7 @@
     private Long domainId;
     private Long accountId;
 
-    @Override
-    public String getEntityTable() {
-        return "autoscale_vmprofiles";
-    }
+
 
     public Long getDomainId() {
         if (domainId == null) {
@@ -232,6 +229,7 @@
         AutoScaleVmProfile result = _autoScaleService.createAutoScaleVmProfile(this);
         if (result != null) {
             this.setEntityId(result.getId());
+            this.setEntityUuid(result.getUuid());
         } else {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Autoscale Vm Profile");
         }
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java
index a952471..58926f2 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java
@@ -72,6 +72,7 @@
 
         if (condition != null) {
             this.setEntityId(condition.getId());
+            this.setEntityUuid(condition.getUuid());
         } else {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create condition.");
         }
@@ -146,8 +147,5 @@
         return accountId;
     }
 
-    @Override
-    public String getEntityTable() {
-        return "conditions";
-    }
+
 }
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
index 803301f..7039b41 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
@@ -80,9 +80,6 @@
     // ///////////////// Accessors ///////////////////////
     // ///////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "firewall_rules";
-    }
 
     public Long getIpAddressId() {
         return ipAddressId;
@@ -242,6 +239,7 @@
         try {
             FirewallRule result = _firewallService.createFirewallRule(this);
             setEntityId(result.getId());
+            setEntityUuid(result.getUuid());
         } catch (NetworkRuleConflictException ex) {
             s_logger.info("Network rule conflict: " + ex.getMessage());
             s_logger.trace("Network Rule Conflict: ", ex);
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
index ecccf03..1feefde 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
@@ -94,9 +94,6 @@
     // ///////////////// Accessors ///////////////////////
     // ///////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "firewall_rules";
-    }
 
     public Long getIpAddressId() {
         return ipAddressId;
@@ -301,6 +298,7 @@
         try {
             PortForwardingRule result = _rulesService.createPortForwardingRule(this, virtualMachineId, getOpenFirewall());
             setEntityId(result.getId());
+            setEntityUuid(result.getUuid());
         } catch (NetworkRuleConflictException ex) {
             s_logger.info("Network rule conflict: " , ex);
             s_logger.trace("Network Rule Conflict: ", ex);
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
index dc80d31..c01e138 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
@@ -91,9 +91,7 @@
         return paramList;
     }
 
-    public String getEntityTable() {
-        return "firewall_rules";
-    }
+
     // ///////////////////////////////////////////////////
     // ///////////// API Implementation///////////////////
     // ///////////////////////////////////////////////////
@@ -141,6 +139,7 @@
         try {
             StickinessPolicy result = _lbService.createLBStickinessPolicy(this);
             this.setEntityId(result.getId());
+            this.setEntityUuid(result.getUuid());
         } catch (NetworkRuleConflictException e) {
             s_logger.warn("Exception: ", e);
             throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
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 4aacc8e..4e76a6b 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
@@ -120,9 +120,6 @@
         return privatePort;
     }
 
-    public String getEntityTable() {
-        return "firewall_rules";
-    }
 
     public Long getSourceIpAddressId() {
         if (publicIpId != null) {
@@ -283,6 +280,7 @@
         try {
             LoadBalancer result = _lbService.createLoadBalancerRule(this, getOpenFirewall());
             this.setEntityId(result.getId());
+            this.setEntityUuid(result.getUuid());
         } catch (NetworkRuleConflictException e) {
             s_logger.warn("Exception: ", e);
             throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
index e612b84..1ce3458 100644
--- a/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
@@ -75,9 +75,6 @@
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "firewall_rules";
-    }
 
     public Long getIpAddressId() {
         return ipAddressId;
@@ -151,6 +148,7 @@
         try {
             StaticNatRule rule = _rulesService.createStaticNatRule(this, getOpenFirewall());
             this.setEntityId(rule.getId());
+            this.setEntityUuid(rule.getUuid());
         } catch (NetworkRuleConflictException e) {
             s_logger.info("Unable to create Static Nat Rule due to ", e);
             throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
index e2aba5b..16843b5 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
@@ -86,10 +86,6 @@
     // ///////////////// Accessors ///////////////////////
     // ///////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "firewall_rules";
-    }
-
     public Long getIpAddressId() {
         return null;
     }
@@ -262,6 +258,7 @@
         try {
             FirewallRule result = _networkACLService.createNetworkACL(this);
             setEntityId(result.getId());
+            setEntityUuid(result.getUuid());
         } catch (NetworkRuleConflictException ex) {
             s_logger.info("Network rule conflict: " + ex.getMessage());
             s_logger.trace("Network Rule Conflict: ", ex);
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java
index 9500a97..865f7a0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java
@@ -56,9 +56,6 @@
     // ///////////////// Accessors ///////////////////////
     // ///////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "projects";
-    }
 
     public String getAccountName() {
         if (accountName != null) {
@@ -127,6 +124,7 @@
         Project project = _projectService.createProject(getName(), getDisplayText(), getAccountName(), getDomainId());
         if (project != null) {
             this.setEntityId(project.getId());
+            this.setEntityUuid(project.getUuid());
         } else {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a project");
         }
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 33469ac..14f4654 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
@@ -65,9 +65,6 @@
     // ///////////////// Accessors ///////////////////////
     // ///////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "snapshots";
-    }
 
     public String getAccountName() {
         return accountName;
@@ -153,6 +150,7 @@
         Snapshot snapshot = _snapshotService.allocSnapshot(getVolumeId(), getPolicyId());
         if (snapshot != null) {
             this.setEntityId(snapshot.getId());
+            this.setEntityUuid(snapshot.getUuid());
         } else {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot");
         }
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
index 65cc8b9..e72b49b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
@@ -102,9 +102,6 @@
     // ///////////////// Accessors ///////////////////////
     // ///////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "vm_template";
-    }
 
     public Integer getBits() {
         return bits;
@@ -240,13 +237,15 @@
     public void create() throws ResourceAllocationException {
         if (isBareMetal()) {
             _bareMetalVmService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
-            /*Baremetal creates template record after taking image proceeded, use vmId as entity id here*/
+            /*Baremetal creates template record after taking image proceeded, use vmId as entity id and uuid here*/
             this.setEntityId(vmId);
+            this.setEntityUuid(vmId.toString());
         } else {
             VirtualMachineTemplate template = null;
             template = _userVmService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
             if (template != null) {
                 this.setEntityId(template.getId());
+                this.setEntityUuid(template.getUuid());
             } else {
                 throw new ServerApiException(BaseCmd.INTERNAL_ERROR,
                 "Failed to create a template");
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
index 349f4a1..e675c83 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
@@ -147,10 +147,9 @@
     private List<String> securityGroupNameList;
 
     @ACL(checkKeyAccess=true)
-    @Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, entityType={Network.class,IpAddress.class},
+    @Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, entityType={Network.class, IpAddress.class},
             description = "ip to network mapping. Can't be specified with networkIds parameter." +
-                    " Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].networkid=204 - requests to" +
-                    " use ip 10.10.10.11 in network id=204")
+                    " Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].networkid=uuid - requests to use ip 10.10.10.11 in network id=uuid")
     private Map ipToNetworkList;
 
     @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="the ip address for default vm's network")
@@ -171,9 +170,6 @@
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "vm_instance";
-    }
 
     public String getAccountName() {
         if (accountName == null) {
@@ -287,7 +283,17 @@
             Iterator iter = ipsCollection.iterator();
             while (iter.hasNext()) {
                 HashMap<String, String> ips = (HashMap<String, String>) iter.next();
-                Long networkId = Long.valueOf(_responseGenerator.getIdentiyId("networks", ips.get("networkid")));
+                Long networkId;
+                Network network = _networkService.getNetwork(ips.get("networkid"));
+                if (network != null) {
+                    networkId = network.getId();
+                } else {
+                    try {
+                        networkId = Long.parseLong(ips.get("networkid"));
+                    } catch(NumberFormatException e) {
+                        throw new InvalidParameterValueException("Unable to translate and find entity with networkId: " + ips.get("networkid"));
+                    }
+                }
                 String requestedIp = (String) ips.get("ip");
                 ipToNetworkMap.put(networkId, requestedIp);
             }
@@ -446,6 +452,7 @@
 
             if (vm != null) {
                 setEntityId(vm.getId());
+                setEntityUuid(vm.getUuid());
             } else {
                 throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to deploy vm");
             }
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
index 512685f..04541b9 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
@@ -76,9 +76,6 @@
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "volumes";
-    }
 
     public String getAccountName() {
         return accountName;
@@ -154,6 +151,7 @@
         Volume volume = _storageService.allocVolume(this);
         if (volume != null) {
             this.setEntityId(volume.getId());
+            this.setEntityUuid(volume.getUuid());
         } else {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create volume");
         }
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java
index 7f6cd05..43b25a8 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java
@@ -137,7 +137,7 @@
                 Volume vol = _entityMgr.findById(Volume.class, id);
                 response.setId(vol.getUuid());
                 response.setName(vol.getName());
-                DataCenter zone = _entityMgr.findById(DataCenter.class, id);
+                DataCenter zone = _entityMgr.findById(DataCenter.class, zoneId);
                 response.setZoneId(zone.getUuid());
                 response.setZoneName(zone.getName());
                 response.setMode(mode);
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java
index 85a0ae4..96de56a 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java
@@ -67,6 +67,7 @@
         try {
             StaticRoute result = _vpcService.createStaticRoute(getGatewayId(), getCidr());
             setEntityId(result.getId());
+            setEntityUuid(result.getUuid());
         } catch (NetworkRuleConflictException ex) {
             s_logger.info("Network rule conflict: " + ex.getMessage());
             s_logger.trace("Network rule conflict: ", ex);
@@ -74,10 +75,6 @@
         }
     }
 
-    @Override
-    public String getEntityTable() {
-        return "static_routes";
-    }
 
     @Override
     public String getEventType() {
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java
index df16c8e..8a2e1f6 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java
@@ -124,6 +124,7 @@
                 getCidr(), getNetworkDomain());
         if (vpc != null) {
             this.setEntityId(vpc.getId());
+            this.setEntityUuid(vpc.getUuid());
         } else {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a VPC");
         }
@@ -157,11 +158,6 @@
         }
     }
 
-    @Override
-    public String getEntityTable() {
-        return "vpc";
-    }
-
 
     @Override
     public String getEventType() {
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java
index 674dc6a..f2d19a7 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java
@@ -103,9 +103,6 @@
         return accountId;
     }
 
-    public String getEntityTable() {
-        return "vpn_users";
-    }
 
     @Override
     public String getEventDescription() {
@@ -150,5 +147,6 @@
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user");
         }
         setEntityId(vpnUser.getId());
+        setEntityUuid(vpnUser.getUuid());
     }
 }
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java
index 37952f8..b517af8 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java
@@ -62,10 +62,6 @@
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "user_ip_address";
-    }
-
     public Long getPublicIpId() {
         return publicIpId;
     }
@@ -146,6 +142,11 @@
             RemoteAccessVpn vpn = _ravService.createRemoteAccessVpn(publicIpId, ipRange, getOpenFirewall(), getNetworkId());
             if (vpn != null) {
                 this.setEntityId(vpn.getServerAddressId());
+                // find uuid for server ip address
+                IpAddress ipAddr = _entityMgr.findById(IpAddress.class, vpn.getServerAddressId());
+                if (ipAddr != null) {
+                    this.setEntityUuid(ipAddr.getUuid());
+                }
             } else {
                 throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create remote access vpn");
             }
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
index 7f85fb4..3dc334d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java
@@ -51,9 +51,6 @@
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "s2s_vpn_connection";
-    }
 
     public Long getVpnGatewayId() {
         return vpnGatewayId;
@@ -95,6 +92,7 @@
             Site2SiteVpnConnection conn = _s2sVpnService.createVpnConnection(this);
             if (conn != null) {
                 this.setEntityId(conn.getId());
+                this.setEntityUuid(conn.getUuid());
             } else {
                 throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create site to site vpn connection");
             }
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java
index 6508518..bde98b0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java
@@ -78,9 +78,6 @@
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "s2s_customer_gateway";
-    }
 
     public String getName() {
         return name;
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
index 89965bd..4b40554 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java
@@ -47,10 +47,6 @@
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "s2s_vpn_gateway";
-    }
-
     public Long getVpcId() {
         return vpcId;
     }
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java
index a079e8b..23a7793 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java
@@ -44,9 +44,6 @@
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "s2s_vpn_connection";
-    }
 
     public Long getId() {
         return id;
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java
index ef5ff3d..181ee3b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java
@@ -43,9 +43,6 @@
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "s2s_customer_gateway";
-    }
 
     public Long getId() {
         return id;
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java
index f9b9e35..9ac27d0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java
@@ -43,9 +43,6 @@
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "s2s_vpn_gateway";
-    }
 
     public Long getId() {
         return id;
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java
index 0d7632a..ed28ea5 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java
@@ -53,9 +53,6 @@
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "s2s_vpn_connection";
-    }
 
     public Long getDomainId() {
         return domainId;
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java
index f2778e0..7564129 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java
@@ -78,11 +78,7 @@
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
 
-    public String getEntityTable() {
-        return "s2s_customer_gateway";
-    }
-
-    public Long getId() {
+     public Long getId() {
         return id;
     }
 
diff --git a/api/src/org/apache/cloudstack/api/response/CapacityResponse.java b/api/src/org/apache/cloudstack/api/response/CapacityResponse.java
index 0007058..2c98dc9 100644
--- a/api/src/org/apache/cloudstack/api/response/CapacityResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/CapacityResponse.java
@@ -17,7 +17,6 @@
 package org.apache.cloudstack.api.response;
 
 import org.apache.cloudstack.api.ApiConstants;
-import com.cloud.utils.IdentityProxy;
 import com.cloud.serializer.Param;
 import com.google.gson.annotations.SerializedName;
 import org.apache.cloudstack.api.BaseResponse;
diff --git a/api/src/org/apache/cloudstack/api/response/CreateCmdResponse.java b/api/src/org/apache/cloudstack/api/response/CreateCmdResponse.java
index 3c26324..e4c6c60 100644
--- a/api/src/org/apache/cloudstack/api/response/CreateCmdResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/CreateCmdResponse.java
@@ -16,24 +16,16 @@
 // under the License.
 package org.apache.cloudstack.api.response;
 
-import org.apache.cloudstack.api.ApiConstants;
-import com.cloud.utils.IdentityProxy;
-import com.google.gson.annotations.SerializedName;
 import org.apache.cloudstack.api.BaseResponse;
 
 public class CreateCmdResponse extends BaseResponse {
-    @SerializedName(ApiConstants.ID)
-    private IdentityProxy id = new IdentityProxy();
+    private String id;
 
-    public Long getId() {
-        return id.getValue();
+    public String getId() {
+        return id;
     }
 
-    public void setId(Long id) {
-        this.id.setValue(id);
-    }
-
-    public void setIdEntityTable(String entityTable) {
-        this.id.setTableName(entityTable);
+    public void setId(String id) {
+        this.id = id;
     }
 }
diff --git a/api/src/org/apache/cloudstack/api/response/ResourceCountResponse.java b/api/src/org/apache/cloudstack/api/response/ResourceCountResponse.java
index 9e62f4f..7a29194 100644
--- a/api/src/org/apache/cloudstack/api/response/ResourceCountResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ResourceCountResponse.java
@@ -17,7 +17,6 @@
 package org.apache.cloudstack.api.response;
 
 import org.apache.cloudstack.api.ApiConstants;
-import com.cloud.utils.IdentityProxy;
 import com.cloud.serializer.Param;
 import com.google.gson.annotations.SerializedName;
 import org.apache.cloudstack.api.BaseResponse;
diff --git a/api/src/org/apache/cloudstack/api/response/S3Response.java b/api/src/org/apache/cloudstack/api/response/S3Response.java
index 5dd0ef0..4dab217 100644
--- a/api/src/org/apache/cloudstack/api/response/S3Response.java
+++ b/api/src/org/apache/cloudstack/api/response/S3Response.java
@@ -19,7 +19,6 @@
 package org.apache.cloudstack.api.response;
 
 import com.cloud.serializer.Param;
-import com.cloud.utils.IdentityProxy;
 import com.google.gson.annotations.SerializedName;
 import org.apache.cloudstack.api.BaseResponse;
 
@@ -29,7 +28,7 @@
 
     @SerializedName(ID)
     @Param(description = "The ID of the S3 configuration")
-    private IdentityProxy id = new IdentityProxy("s3");
+    private String id;
 
     @SerializedName(S3_ACCESS_KEY)
     @Param(description = "The S3 access key")
@@ -135,11 +134,11 @@
 
     @Override
     public String getObjectId() {
-        return this.id.getValue().toString();
+        return this.id;
     }
 
-    public void setObjectId(Long id) {
-        this.id.setValue(id);
+    public void setObjectId(String id) {
+        this.id = id;
     }
 
     public String getAccessKey() {
diff --git a/client/bindir/cloud-setup-management.in b/client/bindir/cloud-setup-management.in
index 469c961..ca1327a 100755
--- a/client/bindir/cloud-setup-management.in
+++ b/client/bindir/cloud-setup-management.in
@@ -16,8 +16,9 @@
 # specific language governing permissions and limitations
 # under the License.
 
+import sys
 from cloudutils.syscfg import sysConfigFactory
-from cloudutils.utilities import initLoging
+from cloudutils.utilities import initLoging, UnknownSystemException
 from cloudutils.cloudException import CloudRuntimeException, CloudInternalException
 from cloudutils.globalEnv import globalEnv
 from cloudutils.serviceConfigServer import cloudManagementConfig
@@ -35,7 +36,12 @@
     glbEnv.mode = "Server"
     
     print "Starting to configure CloudStack Management Server:"
-    syscfg = sysConfigFactory.getSysConfigFactory(glbEnv)
+    try:
+        syscfg = sysConfigFactory.getSysConfigFactory(glbEnv)
+    except UnknownSystemException:
+        print >>sys.stderr, ("Error: CloudStack failed to detect your "
+                "operating system. Exiting.")
+        sys.exit(1)
     try:
     	syscfg.registerService(cloudManagementConfig)
         syscfg.config()
diff --git a/client/tomcatconf/api-discovery_commands.properties.in b/client/tomcatconf/api-discovery_commands.properties.in
deleted file mode 100644
index 49ddfde..0000000
--- a/client/tomcatconf/api-discovery_commands.properties.in
+++ /dev/null
@@ -1,23 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# bitmap of permissions at the end of each classname, 1 = ADMIN, 2 =
-# RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
-# Please standardize naming conventions to camel-case (even for acronyms).
-
-# CloudStack API Discovery service command
-listApis=15
diff --git a/client/tomcatconf/cisconexusvsm_commands.properties.in b/client/tomcatconf/cisconexusvsm_commands.properties.in
deleted file mode 100644
index 0427ba2..0000000
--- a/client/tomcatconf/cisconexusvsm_commands.properties.in
+++ /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.
-
-### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER

-### Please standardize naming conventions to camel-case (even for acronyms).

-
-#### Cisco Nexus 1000v Virtual Supervisor Module (VSM) commands
-deleteCiscoNexusVSM=1

-enableCiscoNexusVSM=1

-disableCiscoNexusVSM=1
-listCiscoNexusVSMs=1
diff --git a/client/tomcatconf/commands-ext.properties.in b/client/tomcatconf/commands-ext.properties.in
deleted file mode 100644
index cd1d0ea..0000000
--- a/client/tomcatconf/commands-ext.properties.in
+++ /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.
-
-#### usage commands
-generateUsageRecords=com.cloud.api.commands.GenerateUsageRecordsCmd;1
-listUsageRecords=com.cloud.api.commands.GetUsageRecordsCmd;1
-listUsageTypes=com.cloud.api.commands.ListUsageTypesCmd;1
-
-#### traffic monitor commands
-addTrafficMonitor=com.cloud.api.commands.AddTrafficMonitorCmd;1
-deleteTrafficMonitor=com.cloud.api.commands.DeleteTrafficMonitorCmd;1
-listTrafficMonitors=com.cloud.api.commands.ListTrafficMonitorsCmd;1
-
-
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index f27b01c..182cbd8 100644
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -425,3 +425,87 @@
 listVpnCustomerGateways=15
 listVpnGateways=15
 listVpnConnections=15
+
+#### router commands
+createVirtualRouterElement=7
+configureVirtualRouterElement=7
+listVirtualRouterElements=7
+
+#### usage commands
+generateUsageRecords=1
+listUsageRecords=1
+listUsageTypes=1
+
+#### traffic monitor commands
+addTrafficMonitor=1
+deleteTrafficMonitor=1
+listTrafficMonitors=1
+
+#### Cisco Nexus 1000v Virtual Supervisor Module (VSM) commands
+deleteCiscoNexusVSM=1
+enableCiscoNexusVSM=1
+disableCiscoNexusVSM=1
+listCiscoNexusVSMs=1
+
+#### f5 big ip load balancer commands
+
+#Deprecated commands
+addExternalLoadBalancer=1
+deleteExternalLoadBalancer=1
+listExternalLoadBalancers=1
+
+addF5LoadBalancer=1
+configureF5LoadBalancer=1
+deleteF5LoadBalancer=1
+listF5LoadBalancers=1
+listF5LoadBalancerNetworks=1
+
+#### juniper srx firewall commands
+addExternalFirewall=1
+deleteExternalFirewall=1
+listExternalFirewalls=1
+
+addSrxFirewall=1
+deleteSrxFirewall=1
+configureSrxFirewall=1
+listSrxFirewalls=1
+listSrxFirewallNetworks=1
+
+####Netapp integration commands
+createVolumeOnFiler=15
+destroyVolumeOnFiler=15
+listVolumesOnFiler=15
+createLunOnFiler=15
+destroyLunOnFiler=15
+listLunsOnFiler=15
+associateLun=15
+dissociateLun=15
+createPool=15
+deletePool=15
+modifyPool=15
+listPools=15
+
+#### netscaler load balancer commands
+addNetscalerLoadBalancer=1
+deleteNetscalerLoadBalancer=1
+configureNetscalerLoadBalancer=1
+listNetscalerLoadBalancers=1
+listNetscalerLoadBalancerNetworks=1
+
+#### nicira nvp commands
+
+addNiciraNvpDevice=1
+deleteNiciraNvpDevice=1
+listNiciraNvpDevices=1
+listNiciraNvpDeviceNetworks=1
+
+# Not implemented (yet)
+#configureNiciraNvpDevice=1
+
+#### host simulator commands
+
+configureSimulator=1
+
+#### api discovery commands
+
+listApis=15
diff --git a/client/tomcatconf/components.xml.in b/client/tomcatconf/components.xml.in
index b9feed1..bb39839 100755
--- a/client/tomcatconf/components.xml.in
+++ b/client/tomcatconf/components.xml.in
@@ -53,12 +53,9 @@
         <dao name="Configuration configuration server" class="com.cloud.configuration.dao.ConfigurationDaoImpl">
              <param name="premium">true</param>
         </dao>
-        <adapters key="org.apache.cloudstack.acl.APIAccessChecker">
+        <adapters key="org.apache.cloudstack.acl.APIChecker">
             <adapter name="StaticRoleBasedAPIAccessChecker" class="org.apache.cloudstack.acl.StaticRoleBasedAPIAccessChecker"/>
         </adapters>
-        <adapters key="org.apache.cloudstack.discovery.ApiDiscoveryService">
-            <adapter name="ApiDiscoveryService" class="org.apache.cloudstack.discovery.ApiDiscoveryServiceImpl"/>
-        </adapters>
         <adapters key="com.cloud.agent.manager.allocator.HostAllocator">
             <adapter name="FirstFitRouting" class="com.cloud.agent.manager.allocator.impl.FirstFitRoutingAllocator"/>
             <!--adapter name="FirstFitRouting" class="com.cloud.agent.manager.allocator.impl.RecreateHostAllocator"/-->
diff --git a/client/tomcatconf/f5bigip_commands.properties.in b/client/tomcatconf/f5bigip_commands.properties.in
deleted file mode 100644
index 8c3cc2a..0000000
--- a/client/tomcatconf/f5bigip_commands.properties.in
+++ /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.
-
-### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
-### Please standardize naming conventions to camel-case (even for acronyms).
-
-#### f5 big ip load balancer commands
-
-#Deprecated commands
-addExternalLoadBalancer=1
-deleteExternalLoadBalancer=1
-listExternalLoadBalancers=1
-
-addF5LoadBalancer=1
-configureF5LoadBalancer=1
-deleteF5LoadBalancer=1
-listF5LoadBalancers=1
-listF5LoadBalancerNetworks=1
diff --git a/client/tomcatconf/junipersrx_commands.properties.in b/client/tomcatconf/junipersrx_commands.properties.in
deleted file mode 100644
index 2cadc62..0000000
--- a/client/tomcatconf/junipersrx_commands.properties.in
+++ /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.
-
-### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
-### Please standardize naming conventions to camel-case (even for acronyms).
-
-#### juniper srx firewall commands
-addExternalFirewall=1
-deleteExternalFirewall=1
-listExternalFirewalls=1
-
-addSrxFirewall=1
-deleteSrxFirewall=1
-configureSrxFirewall=1
-listSrxFirewalls=1
-listSrxFirewallNetworks=1
diff --git a/client/tomcatconf/netapp_commands.properties.in b/client/tomcatconf/netapp_commands.properties.in
deleted file mode 100644
index ea17ac0..0000000
--- a/client/tomcatconf/netapp_commands.properties.in
+++ /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.
-
-### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
-### Please standardize naming conventions to camel-case (even for acronyms).
-
-####Netapp integration commands
-createVolumeOnFiler=15
-destroyVolumeOnFiler=15
-listVolumesOnFiler=15
-createLunOnFiler=15
-destroyLunOnFiler=15
-listLunsOnFiler=15
-associateLun=15
-dissociateLun=15
-createPool=15
-deletePool=15
-modifyPool=15
-listPools=15
diff --git a/client/tomcatconf/netscalerloadbalancer_commands.properties.in b/client/tomcatconf/netscalerloadbalancer_commands.properties.in
deleted file mode 100644
index 9eeb8da..0000000
--- a/client/tomcatconf/netscalerloadbalancer_commands.properties.in
+++ /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.
-
-### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
-### Please standardize naming conventions to camel-case (even for acronyms).
-
-#### netscaler load balancer commands
-addNetscalerLoadBalancer=1
-deleteNetscalerLoadBalancer=1
-configureNetscalerLoadBalancer=1
-listNetscalerLoadBalancers=1
-listNetscalerLoadBalancerNetworks=1
diff --git a/client/tomcatconf/nicira-nvp_commands.properties.in b/client/tomcatconf/nicira-nvp_commands.properties.in
deleted file mode 100644
index 1b2b525..0000000
--- a/client/tomcatconf/nicira-nvp_commands.properties.in
+++ /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.
-
-### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
-### Please standardize naming conventions to camel-case (even for acronyms).
-
-#### nicira nvp commands
-
-addNiciraNvpDevice=1
-deleteNiciraNvpDevice=1
-listNiciraNvpDevices=1
-listNiciraNvpDeviceNetworks=1
-
-# Not implemented (yet)
-#configureNiciraNvpDevice=1
diff --git a/client/tomcatconf/simulator_commands.properties.in b/client/tomcatconf/simulator_commands.properties.in
deleted file mode 100644
index b7213a2..0000000
--- a/client/tomcatconf/simulator_commands.properties.in
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-
-configureSimulator=1
diff --git a/client/tomcatconf/virtualrouter_commands.properties.in b/client/tomcatconf/virtualrouter_commands.properties.in
deleted file mode 100644
index 169496b..0000000
--- a/client/tomcatconf/virtualrouter_commands.properties.in
+++ /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.
-
-### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
-### Please standardize naming conventions to camel-case (even for acronyms).
-
-#### router commands
-createVirtualRouterElement=7
-configureVirtualRouterElement=7
-listVirtualRouterElements=7
diff --git a/docs/en-US/accessing-vms.xml b/docs/en-US/accessing-vms.xml
index d69d021..c77ad4e 100644
--- a/docs/en-US/accessing-vms.xml
+++ b/docs/en-US/accessing-vms.xml
@@ -29,7 +29,7 @@
         <orderedlist>
             <listitem><para>Log in to the &PRODUCT; UI as a user or admin.</para></listitem>
             <listitem><para>Click Instances, then click the name of a running VM.</para></listitem>
-            <listitem><para>Click the View Console button <inlinegraphic format="PNG" fileref="images/icon.png"/>.</para></listitem>
+            <listitem><para>Click the View Console button <inlinegraphic format="PNG" fileref="images/view-console-button.png"/>.</para></listitem>
         </orderedlist>
         <para>To access a VM directly over the network:</para>
         <orderedlist>
diff --git a/docs/en-US/autoscale.xml b/docs/en-US/autoscale.xml
new file mode 100644
index 0000000..d63281f
--- /dev/null
+++ b/docs/en-US/autoscale.xml
@@ -0,0 +1,284 @@
+<?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="autoscale">
+  <title>Configuring AutoScale</title>
+  <para>AutoScaling allows you to scale your back-end services or application VMs up or down
+    seamlessly and automatically according to the conditions you define. With AutoScaling enabled,
+    you can ensure that the number of VMs you are using seamlessly scale up when demand increases,
+    and automatically decreases when demand subsides. Thus it helps you save compute costs by
+    terminating underused VMs automatically and launching new VMs when you need them, without the
+    need for manual intervention.</para>
+  <para>NetScaler AutoScaling is designed to seamlessly launch or terminate VMs based on
+    user-defined conditions. Conditions for triggering a scaleup or scaledown action can vary from a
+    simple use case like monitoring the CPU usage of a server to a complex use case of monitoring a
+    combination of server's responsiveness and its CPU usage. For example, you can configure
+    AutoScaling to launch an additional VM whenever CPU usage exceeds 80 percent for 15 minutes, or
+    to remove a VM whenever CPU usage is less than 20 percent for 30 minutes.</para>
+  <para>&PRODUCT; uses the NetScaler load balancer to monitor all aspects of a system's health and
+    work in unison with &PRODUCT; to initiate scale-up or scale-down actions. The supported
+    NetScaler version is 10.0.</para>
+  <formalpara>
+    <title>Prerequisites</title>
+    <para>Before you configure an AutoScale rule, consider the following:</para>
+  </formalpara>
+  <itemizedlist>
+    <listitem>
+      <para>Ensure that the necessary template is prepared before configuring AutoScale. When a VM
+        is deployed by using a template and when it comes up, the application should be up and
+        running.</para>
+      <note>
+        <para>If the application is not running, the NetScaler device considers the VM as
+          ineffective and continues provisioning the VMs unconditionally until the resource limit is
+          exhausted.</para>
+      </note>
+    </listitem>
+    <listitem>
+      <para>Deploy the templates you prepared. Ensure that the applications come up on the first
+        boot and is ready to take the traffic. Observe the time requires to deploy the template.
+        Consider this time when you specify the quiet time while configuring AutoScale.</para>
+    </listitem>
+    <listitem>
+      <para>The AutoScale feature supports the SNMP counters that can be used to define conditions
+        for taking scale up or scale down actions. To monitor the SNMP-based counter, ensure that
+        the SNMP agent is installed in the template used for creating the AutoScale VMs, and the
+        SNMP operations work with the configured SNMP community and port by using standard SNMP
+        managers. For example, see <xref linkend="configure-snmp-rhel"/> to configure SNMP on a RHEL
+        machine.</para>
+    </listitem>
+    <listitem>
+      <para>Ensure that the endpointe.url parameter present in the Global Settings is set to the
+        Management Server API URL. For example, http://10.102.102.22:8080/client/api. In a
+        multi-node Management Server deployment, use the virtual IP address configured in the load
+        balancer for the management server’s cluster. Additionally, ensure that the NetScaler device
+        has access to this IP address to provide AutoScale support.</para>
+      <para>If you update the endpointe.url, disable the AutoScale functionality of the load
+        balancer rules in the system, then enable them back to reflect the changes. For more
+        information see <xref linkend="update-autoscale"/></para>
+    </listitem>
+    <listitem>
+      <para>If the API Key and Secret Key are regenerated for an AutoScale user, ensure that the
+        AutoScale functionality of the load balancers that the user participates in are disabled and
+        then enabled to reflect the configuration changes in the NetScaler.</para>
+    </listitem>
+    <listitem>
+      <para>In an advanced Zone, ensure that at least one VM should be present before configuring a
+        load balancer rule with AutoScale. Having one VM in the network ensures that the network is
+        in implemented state for configuring AutoScale.</para>
+    </listitem>
+  </itemizedlist>
+  <formalpara>
+    <title>Configuration</title>
+    <para>Specify the following:</para>
+  </formalpara>
+  <mediaobject>
+    <imageobject>
+      <imagedata fileref="./images/autoscale-config.png"/>
+    </imageobject>
+    <textobject>
+      <phrase>autoscaleateconfig.png: Configuring AutoScale</phrase>
+    </textobject>
+  </mediaobject>
+  <itemizedlist>
+    <listitem>
+      <para><emphasis role="bold">Template</emphasis>: A template consists of a base OS image and
+        application. A template is used to provision the new instance of an application on a scaleup
+        action. When a VM is deployed from a template, the VM can start taking the traffic from the
+        load balancer without any admin intervention. For example, if the VM is deployed for a Web
+        service, it should have the Web server running, the database connected, and so on.</para>
+    </listitem>
+    <listitem>
+      <para><emphasis role="bold">Compute offering</emphasis>: A predefined set of virtual hardware
+        attributes, including CPU speed, number of CPUs, and RAM size, that the user can select when
+        creating a new virtual machine instance. Choose one of the compute offerings to be used
+        while provisioning a VM instance as part of scaleup action.</para>
+    </listitem>
+    <listitem>
+      <para><emphasis role="bold">Min Instance</emphasis>: The minimum number of active VM instances
+        that is assigned to a load balancing rule. The active VM instances are the application
+        instances that are up and serving the traffic, and are being load balanced. This parameter
+        ensures that a load balancing rule has at least the configured number of active VM instances
+        are available to serve the traffic.</para>
+      <note>
+        <para>If an application, such as SAP, running on a VM instance is down for some reason, the
+          VM is then not counted as part of Min Instance parameter, and the AutoScale feature
+          initiates a scaleup action if the number of active VM instances is below the configured
+          value. Similarly, when an application instance comes up from its earlier down state, this
+          application instance is counted as part of the active instance count and the AutoScale
+          process initiates a scaledown action when the active instance count breaches the Max
+          instance value.</para>
+      </note>
+    </listitem>
+    <listitem>
+      <para><emphasis role="bold">Max Instance</emphasis>: Maximum number of active VM instances
+        that <emphasis role="bold">should be assigned to </emphasis>a load balancing rule. This
+        parameter defines the upper limit of active VM instances that can be assigned to a load
+        balancing rule.</para>
+      <para>Specifying a large value for the maximum instance parameter might result in provisioning
+        large number of VM instances, which in turn leads to a single load balancing rule exhausting
+        the VM instances limit specified at the account or domain level.</para>
+      <note>
+        <para>If an application, such as SAP, running on a VM instance is down for some reason, the
+          VM is not counted as part of Max Instance parameter. So there may be scenarios where the
+          number of VMs provisioned for a scaleup action might be more than the configured Max
+          Instance value. Once the application instances in the VMs are up from an earlier down
+          state, the AutoScale feature starts aligning to the configured Max Instance value.</para>
+      </note>
+    </listitem>
+  </itemizedlist>
+  <para>Specify the following scale-up and scale-down policies:</para>
+  <itemizedlist>
+    <listitem>
+      <para><emphasis role="bold">Duration</emphasis>: The duration, in seconds, for which the
+        conditions you specify must be true to trigger a scaleup action. The conditions defined
+        should hold true for the entire duration you specify for an AutoScale action to be invoked.
+      </para>
+    </listitem>
+    <listitem>
+      <para><emphasis role="bold">Counter</emphasis>: The performance counters expose the state of
+        the monitored instances. By default, &PRODUCT; offers four performance counters: Three SNMP
+        counters and one NetScaler counter. The SNMP counters are Linux User CPU, Linux System CPU,
+        and Linux CPU Idle. The NetScaler counter is ResponseTime. The root administrator can add
+        additional counters into &PRODUCT; by using the &PRODUCT; API. </para>
+    </listitem>
+    <listitem>
+      <para><emphasis role="bold">Operator</emphasis>: The following five relational operators are
+        supported in AutoScale feature: Greater than, Less than, Less than or equal to, Greater than
+        or equal to, and Equal to.</para>
+    </listitem>
+    <listitem>
+      <para><emphasis role="bold">Threshold</emphasis>: Threshold value to be used for the counter.
+        Once the counter defined above breaches the threshold value, the AutoScale feature initiates
+        a scaleup or scaledown action.</para>
+    </listitem>
+    <listitem>
+      <para><emphasis role="bold">Add</emphasis>: Click Add to add the condition.</para>
+    </listitem>
+  </itemizedlist>
+  <para>Additionally, if you want to configure the advanced settings, click Show advanced settings,
+    and specify the following:</para>
+  <itemizedlist>
+    <listitem>
+      <para><emphasis role="bold">Polling interval</emphasis>: Frequency in which the conditions,
+        combination of counter, operator and threshold, are to be evaluated before taking a scale up
+        or down action. The default polling interval is 30 seconds.</para>
+    </listitem>
+    <listitem>
+      <para><emphasis role="bold">Quiet Time</emphasis>: This is the cool down period after an
+        AutoScale action is initiated. The time includes the time taken to complete provisioning a
+        VM instance from its template and the time taken by an application to be ready to serve
+        traffic. This quiet time allows the fleet to come up to a stable state before any action can
+        take place. The default is 300 seconds.</para>
+    </listitem>
+    <listitem>
+      <para><emphasis role="bold">Destroy VM Grace Period</emphasis>: The duration in seconds, after
+        a scaledown action is initiated, to wait before the VM is destroyed as part of scaledown
+        action. This is to ensure graceful close of any pending sessions or transactions being
+        served by the VM marked for destroy. The default is 120 seconds.</para>
+    </listitem>
+    <listitem>
+      <para><emphasis role="bold">Security Groups</emphasis>: Security groups provide a way to
+        isolate traffic to the VM instances. A security group is a group of VMs that filter their
+        incoming and outgoing traffic according to a set of rules, called ingress and egress rules.
+        These rules filter network traffic according to the IP address that is attempting to
+        communicate with the VM.</para>
+    </listitem>
+    <listitem>
+      <para><emphasis role="bold">Disk Offerings</emphasis>: A predefined set of disk size for
+        primary data storage. </para>
+    </listitem>
+    <listitem>
+      <para><emphasis role="bold">SNMP Community</emphasis>: The SNMP community string to be used by
+        the NetScaler device to query the configured counter value from the provisioned VM
+        instances. Default is public.</para>
+    </listitem>
+    <listitem>
+      <para><emphasis role="bold">SNMP Port</emphasis>: The port number on which the SNMP agent that
+        run on the provisioned VMs is listening. Default port is 161. </para>
+    </listitem>
+    <listitem>
+      <para><emphasis role="bold">User</emphasis>: This is the user that the NetScaler device use to
+        invoke scaleup and scaledown API calls to the cloud. If no option is specified, the user who
+        configures AutoScaling is applied. Specify another user name to override.</para>
+    </listitem>
+    <listitem>
+      <para><emphasis role="bold">Apply</emphasis>: Click Apply to create the AutoScale
+        configuration.</para>
+    </listitem>
+  </itemizedlist>
+  <formalpara>
+    <title>Disabling and Enabling an AutoScale Configuration</title>
+    <para>If you want to perform any maintenance operation on the AutoScale VM instances, disable
+      the AutoScale configuration. When the AutoScale configuration is disabled, no scaleup or
+      scaledown action is performed. You can use this downtime for the maintenance activities. To
+      disable the AutoScale configuration, click the Disable AutoScale<inlinemediaobject>
+        <imageobject>
+          <imagedata fileref="./images/enable-disable-autoscale.png"/>
+        </imageobject>
+        <textobject>
+          <phrase>EnableDisable.png: button to enable or disable AutoScale.</phrase>
+        </textobject>
+      </inlinemediaobject>button.</para>
+  </formalpara>
+  <para>The button toggles between enable and disable, depending on whether AutoScale is currently
+    enabled or not. After the maintenance operations are done, you can enable the AutoScale
+    configuration back. To enable, open the AutoScale configuration page again, then click the
+    Enable AutoScale<inlinemediaobject>
+      <imageobject>
+        <imagedata fileref="./images/enable-disable-autoscale.png"/>
+      </imageobject>
+      <textobject>
+        <phrase>EnableDisable.png: button to enable or disable AutoScale.</phrase>
+      </textobject>
+    </inlinemediaobject>button.</para>
+  <formalpara id="update-autoscale">
+    <title>Updating an AutoScale Configuration</title>
+    <para>You can update the various parameters and add or delete the conditions in a scaleup or
+      scaledown rule. Before you update an AutoScale configuration, ensure that you disable the
+      AutoScale load balancer rule by clicking the Disable AutoScale button.</para>
+  </formalpara>
+  <para>After you modify the required AutoScale parameters, click Apply. To apply the new AutoScale
+    policies, open the AutoScale configuration page again, then click the Enable AutoScale
+    button.</para>
+  <formalpara>
+    <title>Runtime Considerations</title>
+    <para/>
+  </formalpara>
+  <itemizedlist>
+    <listitem>
+      <para>An administrator should not assign a VM to a load balancing rule which is configured for
+        AutoScale.</para>
+    </listitem>
+    <listitem>
+      <para>Before a VM provisioning is completed if NetScaler is shutdown or restarted, the
+        provisioned VM cannot be a part of the load balancing rule though the intent was to assign
+        it to a load balancing rule. To workaround, rename the AutoScale provisioned VMs based on
+        the rule name or ID so at any point of time the VMs can be reconciled to its load balancing
+        rule.</para>
+    </listitem>
+    <listitem>
+      <para>Making API calls outside the context of AutoScale, such as destroyVM, on an autoscaled
+        VM leaves the load balancing configuration in an inconsistent state. Though VM is destroyed
+        from the load balancer rule, NetScaler continues to show the VM as a service assigned to a
+        rule.</para>
+    </listitem>
+  </itemizedlist>
+</section>
diff --git a/docs/en-US/building-marvin.xml b/docs/en-US/building-marvin.xml
new file mode 100644
index 0000000..3dac9d6
--- /dev/null
+++ b/docs/en-US/building-marvin.xml
@@ -0,0 +1,46 @@
+<?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="building-marvin">
+    <title>Building and Installing Marvin</title>
+    <para>Marvin is built with Maven and is dependent on APIdoc. To build it do the following in the root tree of &PRODUCT;:</para>
+    <programlisting>mvn -P developer -l :cloud-apidoc</programlisting>
+    <programlisting>mvn -P developer -l :cloud-marvin</programlisting>
+    <para>If successfull the build will have created the cloudstackAPI Python package under tools/marvin/marvin/cloudstackAPI as well as a gziped Marvin package under tools/marvin dist. To install the Python Marvin module do the following in tools/marvin:</para>
+    <programlisting>sudo python ./setup.py install</programlisting>
+    <para>The dependencies will be downloaded the Python module installed and you should be able to use Marvin in Python. Check that you can import the module before starting to use it.</para>
+    <programlisting>$ 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 marvin
+>>> from marvin.cloudstackAPI import *
+>>> </programlisting>
+
+   <para>You could also install it using <emphasis>pip</emphasis> or <emphasis>easy_install</emphasis> using the local distribution package in tools/marvin/dist :</para>
+   <programlisting>pip install tools/marvin/dist/Marvin-0.1.0.tar.gz</programlisting>
+   <para>Or:</para>
+   <programlisting>easy_install tools/marvin/dist/Marvin-0.1.0.tar.gz</programlisting>   
+
+</section>
diff --git a/docs/en-US/configure-snmp-rhel.xml b/docs/en-US/configure-snmp-rhel.xml
new file mode 100644
index 0000000..bd227ff
--- /dev/null
+++ b/docs/en-US/configure-snmp-rhel.xml
@@ -0,0 +1,86 @@
+<?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="configure-snmp-rhel">
+  <title>Configuring SNMP Community String on a RHEL Server</title>
+  <para>The SNMP Community string is similar to a user id or password that provides access to a
+    network device, such as router. This string is sent along with all SNMP requests. If the
+    community string is correct, the device responds with the requested information. If the
+    community string is incorrect, the device discards the request and does not respond.</para>
+  <para>The NetScaler device uses SNMP to communicate with the VMs. You must install SNMP and
+    configure SNMP Community string for a secure communication between the NetScaler device and the
+    RHEL machine.</para>
+  <orderedlist>
+    <listitem>
+      <para>Ensure that you installed SNMP on RedHat. If not, run the following command:</para>
+      <screen>yum install net-snmp-utils</screen>
+    </listitem>
+    <listitem>
+      <para>Edit the /etc/snmp/snmpd.conf file to allow the SNMP polling from the NetScaler
+        device.</para>
+      <orderedlist>
+        <listitem>
+          <para>Map the community name into a security name (local and mynetwork, depending on where
+            the request is coming from):</para>
+          <note>
+            <para>Use a strong password instead of public when you edit the following table.</para>
+          </note>
+          <screen>#         sec.name   source        community
+com2sec    local      localhost     public
+com2sec   mynetwork   0.0.0.0       public</screen>
+          <note>
+            <para>Setting to 0.0.0.0 allows all IPs to poll the NetScaler server.</para>
+          </note>
+        </listitem>
+        <listitem>
+          <para>Map the security names into group names: </para>
+          <screen>#      group.name   sec.model  sec.name
+group   MyRWGroup     v1         local
+group   MyRWGroup     v2c        local
+group   MyROGroup     v1        mynetwork
+group   MyROGroup     v2c       mynetwork</screen>
+        </listitem>
+        <listitem>
+          <para>Create a view to allow the groups to have the permission to:</para>
+          <screen>incl/excl subtree mask view all included .1 </screen>
+        </listitem>
+        <listitem>
+          <para>Grant access with different write permissions to the two groups to the view you
+            created.</para>
+          <screen># context     sec.model     sec.level     prefix     read     write     notif
+  access      MyROGroup ""  any noauth     exact      all      none     none
+  access      MyRWGroup ""  any noauth     exact      all      all      all </screen>
+        </listitem>
+      </orderedlist>
+    </listitem>
+    <listitem>
+      <para>Unblock SNMP in iptables.</para>
+      <screen>iptables -A INPUT -p udp --dport 161 -j ACCEPT</screen>
+    </listitem>
+    <listitem>
+      <para>Start the SNMP service:</para>
+      <screen>service snmpd start</screen>
+    </listitem>
+    <listitem>
+      <para>Ensure that the SNMP service is started automatically during the system startup:</para>
+      <screen>chkconfig snmpd on</screen>
+    </listitem>
+  </orderedlist>
+</section>
diff --git a/docs/en-US/external-firewalls-and-load-balancers.xml b/docs/en-US/external-firewalls-and-load-balancers.xml
index 1452804..6ca49f0 100644
--- a/docs/en-US/external-firewalls-and-load-balancers.xml
+++ b/docs/en-US/external-firewalls-and-load-balancers.xml
@@ -3,26 +3,31 @@
 <!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.
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT 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="external-firewalls-and-load-balancers">
-    <title>External Firewalls and Load Balancers</title>
-    <para>&PRODUCT; is capable of replacing its Virtual Router with an external Juniper SRX device and an optional external NetScaler or F5 load balancer for gateway and load balancing services.  In this case, the VMs use the SRX as their gateway.</para>
+  <title>External Firewalls and Load Balancers</title>
+  <para>&PRODUCT; is capable of replacing its Virtual Router with an external Juniper SRX device and
+    an optional external NetScaler or F5 load balancer for gateway and load balancing services. In
+    this case, the VMs use the SRX as their gateway.</para>
+  <xi:include href="using-netscaler-load-balancers.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+  <xi:include href="configure-snmp-rhel.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+  <xi:include href="initial-setup-of-external-firewalls-loadbalancers.xml"
+    xmlns:xi="http://www.w3.org/2001/XInclude"/>
+  <xi:include href="ongoing-configuration-of-external-firewalls-loadbalancer.xml"
+    xmlns:xi="http://www.w3.org/2001/XInclude"/>
+  <xi:include href="autoscale.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 </section>
diff --git a/docs/en-US/images/view-console-button.png b/docs/en-US/images/view-console-button.png
new file mode 100644
index 0000000..b321cea
--- /dev/null
+++ b/docs/en-US/images/view-console-button.png
Binary files differ
diff --git a/docs/en-US/marvin.xml b/docs/en-US/marvin.xml
index 062616a..8fd2c96 100644
--- a/docs/en-US/marvin.xml
+++ b/docs/en-US/marvin.xml
@@ -29,4 +29,5 @@
         <para>Marvin's complete documenation is on the wiki at <ulink url="https://cwiki.apache.org/CLOUDSTACK/testing-with-python.html">https://cwiki.apache.org/CLOUDSTACK/testing-with-python.html</ulink></para>
         <para>The source code is located at <emphasis>tools/marvin</emphasis></para>
     </note>
+    <xi:include href="building-marvin.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
 </section>
diff --git a/docs/en-US/ongoing-configuration-of-external-firewalls-loadbalancer.xml b/docs/en-US/ongoing-configuration-of-external-firewalls-loadbalancer.xml
new file mode 100644
index 0000000..c90c7ad
--- /dev/null
+++ b/docs/en-US/ongoing-configuration-of-external-firewalls-loadbalancer.xml
@@ -0,0 +1,46 @@
+<?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="ongoing-configuration-of-external-firewalls-loadbalancer">
+  <title>Ongoing Configuration of External Firewalls and Load Balancers</title>
+  <para>Additional user actions (e.g. setting a port forward) will cause further programming of the
+    firewall and load balancer. A user may request additional public IP addresses and forward
+    traffic received at these IPs to specific VMs. This is accomplished by enabling static NAT for a
+    public IP address, assigning the IP to a VM, and specifying a set of protocols and port ranges
+    to open. When a static NAT rule is created, &PRODUCT; programs the zone's external firewall with
+    the following objects:</para>
+  <itemizedlist>
+    <listitem>
+      <para>A static NAT rule that maps the public IP address to the private IP address of a
+        VM.</para>
+    </listitem>
+    <listitem>
+      <para>A security policy that allows traffic within the set of protocols and port ranges that
+        are specified.</para>
+    </listitem>
+    <listitem>
+      <para>A firewall filter counter that measures the number of bytes of incoming traffic to the
+        public IP.</para>
+    </listitem>
+  </itemizedlist>
+  <para>The number of incoming and outgoing bytes through source NAT, static NAT, and load balancing
+    rules is measured and saved on each external element. This data is collected on a regular basis
+    and stored in the &PRODUCT; database.</para>
+</section>
diff --git a/docs/en-US/system-service-offerings.xml b/docs/en-US/system-service-offerings.xml
index c41aa2e..84d5f7a 100644
--- a/docs/en-US/system-service-offerings.xml
+++ b/docs/en-US/system-service-offerings.xml
@@ -26,4 +26,5 @@
     <title>System Service Offerings</title>
     <para>System service offerings provide a choice of CPU speed, number of CPUs, tags, and RAM size, just as other service offerings do. But rather than being used for virtual machine instances and exposed to users, system service offerings are used to change the default properties of virtual routers, console proxies, and other system VMs. System service offerings are visible only to the &PRODUCT; root administrator. &PRODUCT; provides default system service offerings. The &PRODUCT; root administrator can create additional custom system service offerings.</para>
     <para>When &PRODUCT; creates a virtual router for a guest network, it uses default settings which are defined in the system service offering associated with the network offering. You can upgrade the capabilities of the virtual router by applying a new network offering that contains a different system service offering. All virtual routers in that network will begin using the settings from the new service offering.</para>
+    <xi:include href="creating-system-service-offerings.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
 </section>
diff --git a/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java b/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java
index d39f87f..1635784 100644
--- a/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java
+++ b/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java
@@ -16,93 +16,56 @@
 // under the License.
 package org.apache.cloudstack.acl;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.*;
-
-import javax.ejb.Local;
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.acl.APIAccessChecker;
-import org.apache.log4j.Logger;
-
 import com.cloud.exception.PermissionDeniedException;
 import com.cloud.server.ManagementServer;
 import com.cloud.user.Account;
-import com.cloud.user.AccountManager;
+import com.cloud.user.AccountService;
 import com.cloud.user.User;
 import com.cloud.utils.PropertiesUtil;
 import com.cloud.utils.component.AdapterBase;
 import com.cloud.utils.component.ComponentLocator;
-import com.cloud.utils.component.Inject;
-import com.cloud.utils.component.PluggableService;
 
-/*
- * This is the default API access checker that grab's the user's account
- * based on the account type, access is granted referring to commands in all *.properties files.
- */
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
 
-@Local(value=APIAccessChecker.class)
-public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIAccessChecker {
+import org.apache.log4j.Logger;
+
+// This is the default API access checker that grab's the user's account
+// based on the account type, access is granted
+@Local(value = APIChecker.class)
+public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIChecker {
 
     protected static final Logger s_logger = Logger.getLogger(StaticRoleBasedAPIAccessChecker.class);
-    public static final short ADMIN_COMMAND = 1;
-    public static final short DOMAIN_ADMIN_COMMAND = 4;
-    public static final short RESOURCE_DOMAIN_ADMIN_COMMAND = 2;
-    public static final short USER_COMMAND = 8;
-    private static List<String> s_userCommands = null;
-    private static List<String> s_resellerCommands = null; // AKA domain-admin
-    private static List<String> s_adminCommands = null;
-    private static List<String> s_resourceDomainAdminCommands = null;
-    private static List<String> s_allCommands = null;
 
-    protected @Inject AccountManager _accountMgr;
+    private static Map<RoleType, Set<String>> s_roleBasedApisMap =
+            new HashMap<RoleType, Set<String>>();
+
+    private static AccountService s_accountService;
 
     protected StaticRoleBasedAPIAccessChecker() {
         super();
-        s_allCommands = new ArrayList<String>();
-        s_userCommands = new ArrayList<String>();
-        s_resellerCommands = new ArrayList<String>();
-        s_adminCommands = new ArrayList<String>();
-        s_resourceDomainAdminCommands = new ArrayList<String>();
+        for (RoleType roleType : RoleType.values())
+            s_roleBasedApisMap.put(roleType, new HashSet<String>());
     }
 
     @Override
-    public boolean canAccessAPI(User user, String apiCommandName)
-            throws PermissionDeniedException{
-
-        boolean commandExists = s_allCommands.contains(apiCommandName);
-
-        if(commandExists && user != null){
-                Long accountId = user.getAccountId();
-                Account userAccount = _accountMgr.getAccount(accountId);
-                short accountType = userAccount.getType();
-                return isCommandAvailableForAccount(accountType, apiCommandName);
+    public boolean checkAccess(User user, String commandName)
+            throws PermissionDeniedException {
+        Account account = s_accountService.getAccount(user.getAccountId());
+        if (account == null) {
+            throw new PermissionDeniedException("The account id=" + user.getAccountId() + "for user id=" + user.getId() + "is null");
         }
 
-        return commandExists;
-    }
-
-    private static boolean isCommandAvailableForAccount(short accountType, String commandName) {
-        boolean isCommandAvailable = false;
-        switch (accountType) {
-        case Account.ACCOUNT_TYPE_ADMIN:
-            isCommandAvailable = s_adminCommands.contains(commandName);
-            break;
-        case Account.ACCOUNT_TYPE_DOMAIN_ADMIN:
-            isCommandAvailable = s_resellerCommands.contains(commandName);
-            break;
-        case Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN:
-            isCommandAvailable = s_resourceDomainAdminCommands.contains(commandName);
-            break;
-        case Account.ACCOUNT_TYPE_NORMAL:
-            isCommandAvailable = s_userCommands.contains(commandName);
-            break;
+        RoleType roleType = s_accountService.getRoleType(account);
+        boolean isAllowed = s_roleBasedApisMap.get(roleType).contains(commandName);
+        if (!isAllowed) {
+            throw new PermissionDeniedException("The API does not exist or is blacklisted. Role type=" + roleType.toString() + " is not allowed to request the api: " + commandName);
         }
-        return isCommandAvailable;
+        return isAllowed;
     }
 
     @Override
@@ -111,72 +74,27 @@
 
         // Read command properties files to build the static map per role.
         ComponentLocator locator = ComponentLocator.getLocator(ManagementServer.Name);
-        List<PluggableService> services = locator.getAllPluggableServices();
-        services.add((PluggableService) ComponentLocator.getComponent(ManagementServer.Name));
+        s_accountService = locator.getManager(AccountService.class);
 
-        List<String> configFiles = new ArrayList<String>();
-        for (PluggableService service : services) {
-            configFiles.addAll(Arrays.asList(service.getPropertiesFiles()));
-        }
+        processMapping(PropertiesUtil.processConfigFile(new String[]
+                {"commands.properties"}));
 
-        processConfigFiles(configFiles);
         return true;
     }
 
-    private void processConfigFiles(List<String> configFiles) {
-        Properties preProcessedCommands = new Properties();
-
-        for (String configFile : configFiles) {
-            File commandsFile = PropertiesUtil.findConfigFile(configFile);
-            if (commandsFile != null) {
-                try {
-                    preProcessedCommands.load(new FileInputStream(commandsFile));
-                } catch (FileNotFoundException fnfex) {
-                    // in case of a file within a jar in classpath, try to open stream using url
-                    InputStream stream = PropertiesUtil.openStreamFromURL(configFile);
-                    if (stream != null) {
-                        try {
-                            preProcessedCommands.load(stream);
-                        } catch (IOException e) {
-                            s_logger.error("IO Exception, unable to find properties file:", fnfex);
-                        }
-                    } else {
-                        s_logger.error("Unable to find properites file", fnfex);
-                    }
-                } catch (IOException ioe) {
-                    s_logger.error("IO Exception loading properties file", ioe);
-                }
-            }
-        }
-
-        for (Object key : preProcessedCommands.keySet()) {
-            String preProcessedCommand = preProcessedCommands.getProperty((String) key);
-            int splitIndex = preProcessedCommand.lastIndexOf(";");
-            // Backward compatible to old style, apiname=pkg;mask
-            String mask = preProcessedCommand.substring(splitIndex+1);
-
+    private void processMapping(Map<String, String> configMap) {
+        for (Map.Entry<String, String> entry : configMap.entrySet()) {
+            String apiName = entry.getKey();
+            String roleMask = entry.getValue();
             try {
-                short cmdPermissions = Short.parseShort(mask);
-                if ((cmdPermissions & ADMIN_COMMAND) != 0) {
-                    s_adminCommands.add((String) key);
+                short cmdPermissions = Short.parseShort(roleMask);
+                for (RoleType roleType : RoleType.values()) {
+                    if ((cmdPermissions & roleType.getValue()) != 0)
+                        s_roleBasedApisMap.get(roleType).add(apiName);
                 }
-                if ((cmdPermissions & RESOURCE_DOMAIN_ADMIN_COMMAND) != 0) {
-                    s_resourceDomainAdminCommands.add((String) key);
-                }
-                if ((cmdPermissions & DOMAIN_ADMIN_COMMAND) != 0) {
-                    s_resellerCommands.add((String) key);
-                }
-                if ((cmdPermissions & USER_COMMAND) != 0) {
-                    s_userCommands.add((String) key);
-                }
-                s_allCommands.addAll(s_adminCommands);
-                s_allCommands.addAll(s_resourceDomainAdminCommands);
-                s_allCommands.addAll(s_userCommands);
-                s_allCommands.addAll(s_resellerCommands);
             } catch (NumberFormatException nfe) {
-                s_logger.info("Malformed command.properties permissions value, key = " + key + ", value = " + preProcessedCommand);
+                s_logger.info("Malformed key=value pair for entry: " + entry.toString());
             }
         }
     }
-
 }
diff --git a/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java b/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java
index dcbaec1..bad7ca7 100644
--- a/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java
+++ b/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java
@@ -16,9 +16,12 @@
 // under the License.
 package org.apache.cloudstack.api.command.user.discovery;
 
+import com.cloud.user.User;
+import com.cloud.user.UserContext;
 import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.PlugService;
 import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.response.ListResponse;
@@ -27,8 +30,8 @@
 
 import org.apache.log4j.Logger;
 
-@APICommand(name = "listApis", responseObject = ApiDiscoveryResponse.class, description = "lists all available apis on the server, provided by Api Discovery plugin", since = "4.1.0")
-public class ListApisCmd extends BaseListCmd {
+@APICommand(name = "listApis", responseObject = ApiDiscoveryResponse.class, description = "lists all available apis on the server, provided by the Api Discovery plugin", since = "4.1.0")
+public class ListApisCmd extends BaseCmd {
 
     public static final Logger s_logger = Logger.getLogger(ListApisCmd.class.getName());
     private static final String s_name = "listapisresponse";
@@ -36,12 +39,16 @@
     @PlugService
     ApiDiscoveryService _apiDiscoveryService;
 
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="API name")
+    private String name;
+
     @Override
     public void execute() throws ServerApiException {
         if (_apiDiscoveryService != null) {
-            ListResponse<ApiDiscoveryResponse> response = (ListResponse<ApiDiscoveryResponse>) _apiDiscoveryService.listApis();
+            User user = UserContext.current().getCallerUser();
+            ListResponse<ApiDiscoveryResponse> response = (ListResponse<ApiDiscoveryResponse>) _apiDiscoveryService.listApis(user, name);
             if (response == null) {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Api Discovery plugin was unable to find and process any apis");
+                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Api Discovery plugin was unable to find an api by that name or process any apis");
             }
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
@@ -52,4 +59,10 @@
     public String getCommandName() {
         return s_name;
     }
+
+    @Override
+    public long getEntityOwnerId() {
+        // no owner is needed for list command
+        return 0;
+    }
 }
diff --git a/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java
index dd1298b..de6a9f9 100644
--- a/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java
+++ b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java
@@ -16,18 +16,15 @@
 // under the License.
 package org.apache.cloudstack.api.response;
 
-import com.cloud.user.Account;
 import org.apache.cloudstack.api.ApiConstants;
 import com.cloud.serializer.Param;
 import com.google.gson.annotations.SerializedName;
 import org.apache.cloudstack.api.BaseResponse;
-import org.apache.cloudstack.api.EntityReference;
 
 import java.util.HashSet;
 import java.util.Set;
 
 @SuppressWarnings("unused")
-@EntityReference(value = Account.class)
 public class ApiDiscoveryResponse extends BaseResponse {
     @SerializedName(ApiConstants.NAME) @Param(description="the name of the api command")
     private String name;
@@ -41,11 +38,18 @@
     @SerializedName(ApiConstants.IS_ASYNC) @Param(description="true if api is asynchronous")
     private Boolean isAsync;
 
+    @SerializedName("related") @Param(description="comma separated related apis")
+    private String related;
+
     @SerializedName(ApiConstants.PARAMS)  @Param(description="the list params the api accepts", responseObject = ApiParameterResponse.class)
     private Set<ApiParameterResponse> params;
 
+    @SerializedName(ApiConstants.RESPONSE)  @Param(description="api response fields", responseObject = ApiResponseResponse.class)
+    private Set<ApiResponseResponse> apiResponse;
+
     public ApiDiscoveryResponse(){
         params = new HashSet<ApiParameterResponse>();
+        apiResponse = new HashSet<ApiResponseResponse>();
         isAsync = false;
     }
 
@@ -65,6 +69,18 @@
         this.isAsync = isAsync;
     }
 
+    public String getRelated() {
+        return related;
+    }
+
+    public void setRelated(String related) {
+        this.related = related;
+    }
+
+    public Set<ApiParameterResponse> getParams() {
+        return params;
+    }
+
     public void setParams(Set<ApiParameterResponse> params) {
         this.params = params;
     }
@@ -72,4 +88,8 @@
     public void addParam(ApiParameterResponse param) {
         this.params.add(param);
     }
+
+    public void addApiResponse(ApiResponseResponse apiResponse) {
+        this.apiResponse.add(apiResponse);
+    }
 }
diff --git a/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiParameterResponse.java b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiParameterResponse.java
index 9138288..fa6dc17 100644
--- a/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiParameterResponse.java
+++ b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiParameterResponse.java
@@ -40,6 +40,9 @@
     @SerializedName(ApiConstants.SINCE) @Param(description="version of CloudStack the api was introduced in")
     private String since;
 
+    @SerializedName("related") @Param(description="comma separated related apis to get the parameter")
+    private String related;
+
     public ApiParameterResponse(){
     }
 
@@ -67,4 +70,12 @@
         this.since = since;
     }
 
+    public String getRelated() {
+        return related;
+    }
+
+    public void setRelated(String related) {
+        this.related = related;
+    }
+
  }
diff --git a/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiResponseResponse.java b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiResponseResponse.java
new file mode 100644
index 0000000..b96295e
--- /dev/null
+++ b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiResponseResponse.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 org.apache.cloudstack.api.response;
+
+import org.apache.cloudstack.api.ApiConstants;
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+import org.apache.cloudstack.api.BaseResponse;
+
+public class ApiResponseResponse extends BaseResponse {
+    @SerializedName(ApiConstants.NAME) @Param(description="the name of the api response field")
+    private String name;
+
+    @SerializedName(ApiConstants.DESCRIPTION) @Param(description="description of the api response field")
+    private String description;
+
+    @SerializedName(ApiConstants.TYPE) @Param(description="response field type")
+    private String type;
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+}
diff --git a/api/src/org/apache/cloudstack/discovery/ApiDiscoveryService.java b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryService.java
similarity index 80%
rename from api/src/org/apache/cloudstack/discovery/ApiDiscoveryService.java
rename to plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryService.java
index 1220694..6458c56 100644
--- a/api/src/org/apache/cloudstack/discovery/ApiDiscoveryService.java
+++ b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryService.java
@@ -16,14 +16,11 @@
 // under the License.
 package org.apache.cloudstack.discovery;
 
-import com.cloud.utils.component.Adapter;
+import com.cloud.user.User;
 import com.cloud.utils.component.PluggableService;
 import org.apache.cloudstack.api.BaseResponse;
 import org.apache.cloudstack.api.response.ListResponse;
 
-import java.util.Map;
-
-public interface ApiDiscoveryService extends Adapter, PluggableService {
-    ListResponse<? extends BaseResponse> listApis();
-    Map<String, Class<?>> getApiNameCmdClassMapping();
+public interface ApiDiscoveryService extends PluggableService {
+    ListResponse<? extends BaseResponse> listApis(User user, String apiName);
 }
diff --git a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
index 5363e55..f06e200 100644
--- a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
+++ b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
@@ -16,64 +16,63 @@
 // under the License.
 package org.apache.cloudstack.discovery;
 
+import com.cloud.serializer.Param;
+import com.cloud.user.User;
 import com.cloud.utils.ReflectUtil;
-import com.cloud.utils.component.AdapterBase;
+import com.cloud.utils.StringUtils;
+import com.cloud.utils.component.Adapters;
+import com.cloud.utils.component.ComponentLocator;
+import com.google.gson.annotations.SerializedName;
+import org.apache.cloudstack.acl.APIChecker;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.BaseAsyncCmd;
 import org.apache.cloudstack.api.BaseAsyncCreateCmd;
 import org.apache.cloudstack.api.BaseResponse;
 import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.command.user.discovery.ListApisCmd;
 import org.apache.cloudstack.api.response.ApiDiscoveryResponse;
 import org.apache.cloudstack.api.response.ApiParameterResponse;
+import org.apache.cloudstack.api.response.ApiResponseResponse;
 import org.apache.cloudstack.api.response.ListResponse;
 import org.apache.log4j.Logger;
 
 import javax.ejb.Local;
-import javax.naming.ConfigurationException;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 @Local(value = ApiDiscoveryService.class)
-public class ApiDiscoveryServiceImpl extends AdapterBase implements ApiDiscoveryService {
-
+public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
     private static final Logger s_logger = Logger.getLogger(ApiDiscoveryServiceImpl.class);
-    private Map<String, Class<?>> _apiNameCmdClassMap;
-    private ListResponse<ApiDiscoveryResponse> _discoveryResponse;
+
+    protected static Adapters<APIChecker> s_apiAccessCheckers = null;
+    private static Map<String, ApiDiscoveryResponse> s_apiNameDiscoveryResponseMap = null;
 
     protected ApiDiscoveryServiceImpl() {
         super();
-    }
-
-    private void generateApiNameCmdClassMapping() {
-        _apiNameCmdClassMap = new HashMap<String, Class<?>>();
-        Set<Class<?>> cmdClasses = ReflectUtil.getClassesWithAnnotation(APICommand.class, new String[]{"org.apache.cloudstack.api", "com.cloud.api"});
-
-        for(Class<?> cmdClass: cmdClasses) {
-            String apiName = cmdClass.getAnnotation(APICommand.class).name();
-            if (_apiNameCmdClassMap.containsKey(apiName)) {
-                s_logger.error("API Cmd class " + cmdClass.getName() + " has non-unique apiname" + apiName);
-                continue;
-            }
-            _apiNameCmdClassMap.put(apiName, cmdClass);
+        if (s_apiNameDiscoveryResponseMap == null) {
+            long startTime = System.nanoTime();
+            s_apiNameDiscoveryResponseMap = new HashMap<String, ApiDiscoveryResponse>();
+            cacheResponseMap();
+            long endTime = System.nanoTime();
+            s_logger.info("Api Discovery Service: Annotation, docstrings, api relation graph processed in " + (endTime - startTime) / 1000000.0 + " ms");
         }
     }
 
-    private void precacheListApiResponse() {
+    private void cacheResponseMap() {
+        Set<Class<?>> cmdClasses = ReflectUtil.getClassesWithAnnotation(APICommand.class,
+                new String[]{"org.apache.cloudstack.api", "com.cloud.api"});
 
-        if(_apiNameCmdClassMap == null)
-            return;
+        //TODO: Fix and use PluggableService to get the classes
 
-        _discoveryResponse = new ListResponse<ApiDiscoveryResponse>();
+        Map<String, List<String>> responseApiNameListMap = new HashMap<String, List<String>>();
 
-        List<ApiDiscoveryResponse> apiDiscoveryResponses = new ArrayList<ApiDiscoveryResponse>();
-
-        for(String key: _apiNameCmdClassMap.keySet()) {
-            Class<?> cmdClass = _apiNameCmdClassMap.get(key);
+        for (Class<?> cmdClass : cmdClasses) {
             APICommand apiCmdAnnotation = cmdClass.getAnnotation(APICommand.class);
             if (apiCmdAnnotation == null)
                 apiCmdAnnotation = cmdClass.getSuperclass().getAnnotation(APICommand.class);
@@ -82,20 +81,43 @@
                     || apiCmdAnnotation.name().isEmpty())
                 continue;
 
+            String apiName = apiCmdAnnotation.name();
+            String responseName = apiCmdAnnotation.responseObject().getName();
+            if (!responseName.contains("SuccessResponse")) {
+                if (!responseApiNameListMap.containsKey(responseName))
+                    responseApiNameListMap.put(responseName, new ArrayList<String>());
+                responseApiNameListMap.get(responseName).add(apiName);
+            }
             ApiDiscoveryResponse response = new ApiDiscoveryResponse();
-            response.setName(apiCmdAnnotation.name());
+            response.setName(apiName);
             response.setDescription(apiCmdAnnotation.description());
-            response.setSince(apiCmdAnnotation.since());
+            if (!apiCmdAnnotation.since().isEmpty())
+                response.setSince(apiCmdAnnotation.since());
+            response.setRelated(responseName);
+
+            Field[] responseFields = apiCmdAnnotation.responseObject().getDeclaredFields();
+            for (Field responseField : responseFields) {
+                SerializedName serializedName = responseField.getAnnotation(SerializedName.class);
+                if (serializedName != null) {
+                    ApiResponseResponse responseResponse = new ApiResponseResponse();
+                    responseResponse.setName(serializedName.value());
+                    Param param = responseField.getAnnotation(Param.class);
+                    if (param != null)
+                        responseResponse.setDescription(param.description());
+                    responseResponse.setType(responseField.getType().getSimpleName().toLowerCase());
+                    response.addApiResponse(responseResponse);
+                }
+            }
 
             Field[] fields = ReflectUtil.getAllFieldsForClass(cmdClass,
-                    new Class<?>[] {BaseCmd.class, BaseAsyncCmd.class, BaseAsyncCreateCmd.class});
+                    new Class<?>[]{BaseCmd.class, BaseAsyncCmd.class, BaseAsyncCreateCmd.class});
 
             boolean isAsync = ReflectUtil.isCmdClassAsync(cmdClass,
-                    new Class<?>[] {BaseAsyncCmd.class, BaseAsyncCreateCmd.class});
+                    new Class<?>[]{BaseAsyncCmd.class, BaseAsyncCreateCmd.class});
 
             response.setAsync(isAsync);
 
-            for(Field field: fields) {
+            for (Field field : fields) {
                 Parameter parameterAnnotation = field.getAnnotation(Parameter.class);
                 if (parameterAnnotation != null
                         && parameterAnnotation.expose()
@@ -104,41 +126,92 @@
                     ApiParameterResponse paramResponse = new ApiParameterResponse();
                     paramResponse.setName(parameterAnnotation.name());
                     paramResponse.setDescription(parameterAnnotation.description());
-                    paramResponse.setType(parameterAnnotation.type().toString());
+                    paramResponse.setType(parameterAnnotation.type().toString().toLowerCase());
                     paramResponse.setLength(parameterAnnotation.length());
                     paramResponse.setRequired(parameterAnnotation.required());
-                    paramResponse.setSince(parameterAnnotation.since());
+                    if (!parameterAnnotation.since().isEmpty())
+                        paramResponse.setSince(parameterAnnotation.since());
+                    paramResponse.setRelated(parameterAnnotation.entityType()[0].getName());
                     response.addParam(paramResponse);
                 }
             }
-            response.setObjectName("apis");
-            apiDiscoveryResponses.add(response);
+            response.setObjectName("api");
+            s_apiNameDiscoveryResponseMap.put(apiName, response);
         }
-        _discoveryResponse.setResponses(apiDiscoveryResponses);
+
+        for (String apiName : s_apiNameDiscoveryResponseMap.keySet()) {
+            ApiDiscoveryResponse response = s_apiNameDiscoveryResponseMap.get(apiName);
+            Set<ApiParameterResponse> processedParams = new HashSet<ApiParameterResponse>();
+            for (ApiParameterResponse param : response.getParams()) {
+                if (responseApiNameListMap.containsKey(param.getRelated())) {
+                    List<String> relatedApis = responseApiNameListMap.get(param.getRelated());
+                    param.setRelated(StringUtils.join(relatedApis, ","));
+                } else {
+                    param.setRelated(null);
+                }
+                processedParams.add(param);
+            }
+            response.setParams(processedParams);
+
+            if (responseApiNameListMap.containsKey(response.getRelated())) {
+                List<String> relatedApis = responseApiNameListMap.get(response.getRelated());
+                relatedApis.remove(apiName);
+                response.setRelated(StringUtils.join(relatedApis, ","));
+            } else {
+                response.setRelated(null);
+            }
+            s_apiNameDiscoveryResponseMap.put(apiName, response);
+        }
     }
 
     @Override
-    public boolean configure(String name, Map<String, Object> params)
-            throws ConfigurationException {
-        super.configure(name, params);
+    public ListResponse<? extends BaseResponse> listApis(User user, String name) {
+        ListResponse<ApiDiscoveryResponse> response = new ListResponse<ApiDiscoveryResponse>();
+        List<ApiDiscoveryResponse> responseList = new ArrayList<ApiDiscoveryResponse>();
 
-        generateApiNameCmdClassMapping();
-        precacheListApiResponse();
+        if (s_apiAccessCheckers == null) {
+            ComponentLocator locator = ComponentLocator.getCurrentLocator();
+            s_apiAccessCheckers = locator.getAdapters(APIChecker.class);
+        }
 
-        return true;
-    }
+        if (user == null)
+            return null;
 
-    public Map<String, Class<?>> getApiNameCmdClassMapping() {
-        return _apiNameCmdClassMap;
+        if (name != null) {
+            if (!s_apiNameDiscoveryResponseMap.containsKey(name))
+                return null;
+
+            for (APIChecker apiChecker : s_apiAccessCheckers) {
+                try {
+                    apiChecker.checkAccess(user, name);
+                } catch (Exception ex) {
+                    return null;
+                }
+            }
+            responseList.add(s_apiNameDiscoveryResponseMap.get(name));
+
+        } else {
+            for (String apiName : s_apiNameDiscoveryResponseMap.keySet()) {
+                boolean isAllowed = true;
+                for (APIChecker apiChecker : s_apiAccessCheckers) {
+                    try {
+                        apiChecker.checkAccess(user, apiName);
+                    } catch (Exception ex) {
+                        isAllowed = false;
+                    }
+                }
+                if (isAllowed)
+                    responseList.add(s_apiNameDiscoveryResponseMap.get(apiName));
+            }
+        }
+        response.setResponses(responseList);
+        return response;
     }
 
     @Override
-    public ListResponse<? extends BaseResponse> listApis() {
-        return _discoveryResponse;
-    }
-
-    @Override
-    public String[] getPropertiesFiles() {
-        return new String[] { "api-discovery_commands.properties" };
+    public List<Class<?>> getCommands() {
+        List<Class<?>> cmdList = new ArrayList<Class<?>>();
+        cmdList.add(ListApisCmd.class);
+        return cmdList;
     }
 }
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMGuestOsMapper.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMGuestOsMapper.java
index b4771ca..bd1573c 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMGuestOsMapper.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMGuestOsMapper.java
@@ -91,6 +91,8 @@
         s_mapper.put("Fedora 10", "Fedora 10");
         s_mapper.put("Fedora 9", "Fedora 9");
         s_mapper.put("Fedora 8", "Fedora 8");
+        s_mapper.put("Ubuntu 12.04 (32-bit)", "Ubuntu 12.04");
+        s_mapper.put("Ubuntu 12.04 (64-bit)", "Ubuntu 12.04");
         s_mapper.put("Ubuntu 10.04 (32-bit)", "Ubuntu 10.04");
         s_mapper.put("Ubuntu 10.04 (64-bit)", "Ubuntu 10.04");
         s_mapper.put("Ubuntu 10.10 (32-bit)", "Ubuntu 10.10");
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 4fda177..b65b531 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -2978,9 +2978,8 @@
 
             NicTO[] nics = vmSpec.getNics();
             for (NicTO nic : nics) {
-                if (nic.getIsolationUri() != null
-                        && nic.getIsolationUri().getScheme()
-                                .equalsIgnoreCase(IsolationType.Ec2.toString())) {
+                if (nic.isSecurityGroupEnabled() || ( nic.getIsolationUri() != null
+                         && nic.getIsolationUri().getScheme().equalsIgnoreCase(IsolationType.Ec2.toString()))) {
                     if (vmSpec.getType() != VirtualMachine.Type.User) {
                         default_network_rules_for_systemvm(conn, vmName);
                         break;
diff --git a/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java b/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java
index ad42c23..c639a55 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java
@@ -17,16 +17,17 @@
 package com.cloud.server;
 
 
+import com.cloud.api.commands.ConfigureSimulator;
+import com.cloud.utils.PropertiesUtil;
+
+import java.util.List;
+import java.util.Map;
+
 public class ManagementServerSimulatorImpl extends ManagementServerExtImpl {
     @Override
-    public String[] getPropertiesFiles() {
-        String[] apis = super.getPropertiesFiles();
-        String[] newapis = new String[apis.length + 1];
-        for (int i = 0; i < apis.length; i++) {
-            newapis[i] = apis[i];
-        }
-
-        newapis[apis.length] = "commands-simulator.properties";
-        return newapis;
+    public List<Class<?>> getCommands() {
+        List<Class<?>> cmdList = super.getCommands();
+        cmdList.add(ConfigureSimulator.class);
+        return cmdList;
     }
 }
diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorRuntimeException.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorRuntimeException.java
index 9891bc8..9f24bbd 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorRuntimeException.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorRuntimeException.java
@@ -18,12 +18,12 @@
 package com.cloud.simulator;
 
 import com.cloud.utils.SerialVersionUID;
-import com.cloud.utils.exception.RuntimeCloudException;
+import com.cloud.utils.exception.CloudRuntimeException;
 
 /**
  * wrap exceptions that you know there's no point in dealing with.
  */
-public class SimulatorRuntimeException extends RuntimeCloudException {
+public class SimulatorRuntimeException extends CloudRuntimeException {
 
     private static final long serialVersionUID = SerialVersionUID.CloudRuntimeException;
 
diff --git a/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java b/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java
index 911078e..68388a6 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java
@@ -17,6 +17,8 @@
 
 package com.cloud.network.element;
 
+import java.lang.Class;
+import java.lang.String;
 import java.util.List;
 import java.util.Map;
 import java.util.ArrayList;
@@ -24,6 +26,7 @@
 
 import javax.ejb.Local;
 
+import com.cloud.utils.PropertiesUtil;
 import org.apache.log4j.Logger;
 
 import com.cloud.api.commands.DeleteCiscoNexusVSMCmd;
@@ -237,7 +240,12 @@
     }
 
     @Override
-    public String[] getPropertiesFiles() {
-        return new String[] { "cisconexusvsm_commands.properties" };
+    public List<Class<?>> getCommands() {
+        List<Class<?>> cmdList = new ArrayList<Class<?>>();
+        cmdList.add(ListCiscoNexusVSMsCmd.class);
+        cmdList.add(EnableCiscoNexusVSMCmd.class);
+        cmdList.add(DisableCiscoNexusVSMCmd.class);
+        cmdList.add(DeleteCiscoNexusVSMCmd.class);
+        return cmdList;
     }
 }
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 9ebf7e8..065d3be 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -1328,7 +1328,8 @@
                     NicTO[] nics = vmSpec.getNics();
                     boolean secGrpEnabled = false;
                     for (NicTO nic : nics) {
-                        if (nic.getIsolationUri() != null && nic.getIsolationUri().getScheme().equalsIgnoreCase(IsolationType.Ec2.toString())) {
+                        if (nic.isSecurityGroupEnabled() || (nic.getIsolationUri() != null
+                                       && nic.getIsolationUri().getScheme().equalsIgnoreCase(IsolationType.Ec2.toString()))) {
                             secGrpEnabled = true;
                             break;
                         }
@@ -1346,7 +1347,8 @@
                     //For user vm, program the rules for each nic if the isolation uri scheme is ec2
                     NicTO[] nics = vmSpec.getNics();
                     for (NicTO nic : nics) {
-                        if (nic.getIsolationUri() != null && nic.getIsolationUri().getScheme().equalsIgnoreCase(IsolationType.Ec2.toString())) {
+                        if ( nic.isSecurityGroupEnabled() || nic.getIsolationUri() != null
+                                   && nic.getIsolationUri().getScheme().equalsIgnoreCase(IsolationType.Ec2.toString())) {
                             result = callHostPlugin(conn, "vmops", "default_network_rules", "vmName", vmName, "vmIP", nic.getIp(), "vmMAC", nic.getMac(), "vmID", Long.toString(vmSpec.getId()));
 
                             if (result == null || result.isEmpty() || !Boolean.parseBoolean(result)) {
diff --git a/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java b/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
index 335dc6e..70faacc 100644
--- a/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
+++ b/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
@@ -16,6 +16,8 @@
 // under the License.
 package com.cloud.network.element;
 
+import java.lang.Class;
+import java.lang.String;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -24,6 +26,7 @@
 
 import javax.ejb.Local;
 
+import com.cloud.utils.PropertiesUtil;
 import org.apache.log4j.Logger;
 
 import com.cloud.api.ApiDBUtils;
@@ -119,7 +122,7 @@
     ConfigurationDao _configDao;
 
     private boolean canHandle(Network config) {
-        if ((config.getGuestType() != Network.GuestType.Isolated && config.getGuestType() != Network.GuestType.Shared) || config.getTrafficType() != TrafficType.Guest) {
+        if (config.getGuestType() != Network.GuestType.Isolated || config.getTrafficType() != TrafficType.Guest) {
             s_logger.trace("Not handling network with Type  " + config.getGuestType() + " and traffic type " + config.getTrafficType());
             return false;
         }
@@ -260,8 +263,17 @@
     }
 
     @Override
-    public String[] getPropertiesFiles() {
-        return new String[] { "f5bigip_commands.properties" };
+    public List<Class<?>> getCommands() {
+        List<Class<?>> cmdList = new ArrayList<Class<?>>();
+        cmdList.add(AddExternalLoadBalancerCmd.class);
+        cmdList.add(AddF5LoadBalancerCmd.class);
+        cmdList.add(ConfigureF5LoadBalancerCmd.class);
+        cmdList.add(DeleteExternalLoadBalancerCmd.class);
+        cmdList.add(DeleteF5LoadBalancerCmd.class);
+        cmdList.add(ListExternalLoadBalancersCmd.class);
+        cmdList.add(ListF5LoadBalancerNetworksCmd.class);
+        cmdList.add(ListF5LoadBalancersCmd.class);
+        return cmdList;
     }
 
     @Override
diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java b/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
index f491e66..ead2af9 100644
--- a/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
+++ b/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
@@ -16,6 +16,7 @@
 // under the License.
 package com.cloud.network.element;
 
+import java.lang.String;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -24,6 +25,7 @@
 
 import javax.ejb.Local;
 
+import com.cloud.utils.PropertiesUtil;
 import org.apache.log4j.Logger;
 
 import com.cloud.api.ApiDBUtils;
@@ -128,8 +130,7 @@
 
     private boolean canHandle(Network network, Service service) {
         DataCenter zone = _configMgr.getZone(network.getDataCenterId());
-        if ((zone.getNetworkType() == NetworkType.Advanced && !(network.getGuestType() == Network.GuestType.Isolated || network.getGuestType() == Network.GuestType.Shared ))
-                || (zone.getNetworkType() == NetworkType.Basic && network.getGuestType() != Network.GuestType.Shared)) {
+        if ((zone.getNetworkType() == NetworkType.Advanced && network.getGuestType() != Network.GuestType.Isolated) || (zone.getNetworkType() == NetworkType.Basic && network.getGuestType() != Network.GuestType.Shared)) {
             s_logger.trace("Element " + getProvider().getName() + "is not handling network type = " + network.getGuestType());
             return false;
         }
@@ -402,8 +403,17 @@
     }
 
     @Override
-    public String[] getPropertiesFiles() {
-        return new String[] { "junipersrx_commands.properties"};
+    public List<Class<?>> getCommands() {
+        List<Class<?>> cmdList = new ArrayList<Class<?>>();
+        cmdList.add(AddExternalFirewallCmd.class);
+        cmdList.add(AddSrxFirewallCmd.class);
+        cmdList.add(ConfigureSrxFirewallCmd.class);
+        cmdList.add(DeleteExternalFirewallCmd.class);
+        cmdList.add(DeleteSrxFirewallCmd.class);
+        cmdList.add(ListExternalFirewallsCmd.class);
+        cmdList.add(ListSrxFirewallNetworksCmd.class);
+        cmdList.add(ListSrxFirewallsCmd.class);
+        return cmdList;
     }
 
     @Override
diff --git a/plugins/network-elements/midokura-midonet/src/com/cloud/network/element/MidokuraMidonetElement.java b/plugins/network-elements/midokura-midonet/src/com/cloud/network/element/MidokuraMidonetElement.java
index 5673466..a45c5c0 100644
--- a/plugins/network-elements/midokura-midonet/src/com/cloud/network/element/MidokuraMidonetElement.java
+++ b/plugins/network-elements/midokura-midonet/src/com/cloud/network/element/MidokuraMidonetElement.java
@@ -38,15 +38,10 @@
 import org.apache.log4j.Logger;
 
 import javax.ejb.Local;
+import java.lang.Class;
 import java.util.Map;
 import java.util.Set;
 
-/**
- * User: tomoe
- * Date: 8/8/12
- * Time: 1:38 PM
- */
-
 @Local(value = NetworkElement.class)
 public class MidokuraMidonetElement extends AdapterBase implements ConnectivityProvider, PluggableService {
     private static final Logger s_logger = Logger.getLogger(MidokuraMidonetElement.class);
@@ -126,7 +121,7 @@
     }
 
     @Override
-    public String getPropertiesFile() {
+    public List<Class<?>> getCommands() {
         // TODO: implement this.
         return null;
     }
diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
index b1fe949..c0f91bb 100644
--- a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
+++ b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
@@ -16,6 +16,7 @@
 // under the License.
 package com.cloud.network.element;
 
+import java.lang.Class;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -26,6 +27,7 @@
 
 import javax.ejb.Local;
 
+import com.cloud.utils.PropertiesUtil;
 import org.apache.log4j.Logger;
 
 import com.cloud.agent.AgentManager;
@@ -152,8 +154,7 @@
 
     private boolean canHandle(Network config, Service service) {
         DataCenter zone = _dcDao.findById(config.getDataCenterId());
-        boolean handleInAdvanceZone = (zone.getNetworkType() == NetworkType.Advanced &&
-                (config.getGuestType() == Network.GuestType.Isolated || config.getGuestType() == Network.GuestType.Shared) && config.getTrafficType() == TrafficType.Guest);
+        boolean handleInAdvanceZone = (zone.getNetworkType() == NetworkType.Advanced && config.getGuestType() == Network.GuestType.Isolated && config.getTrafficType() == TrafficType.Guest);
         boolean handleInBasicZone = (zone.getNetworkType() == NetworkType.Basic && config.getGuestType() == Network.GuestType.Shared && config.getTrafficType() == TrafficType.Guest);
 
         if (!(handleInAdvanceZone || handleInBasicZone)) {
@@ -464,8 +465,14 @@
     }
 
     @Override
-    public String[] getPropertiesFiles() {
-        return new String[] { "netscalerloadbalancer_commands.properties" };
+    public List<Class<?>> getCommands() {
+        List<Class<?>> cmdList = new ArrayList<Class<?>>();
+        cmdList.add(AddNetscalerLoadBalancerCmd.class);
+        cmdList.add(ConfigureNetscalerLoadBalancerCmd.class);
+        cmdList.add(DeleteNetscalerLoadBalancerCmd.class);
+        cmdList.add(ListNetscalerLoadBalancerNetworksCmd.class);
+        cmdList.add(ListNetscalerLoadBalancersCmd.class);
+        return cmdList;
     }
 
     @Override
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java
index cc53ee1..6bcaeee 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java
@@ -27,6 +27,7 @@
 import javax.ejb.Local;
 import javax.naming.ConfigurationException;
 
+import com.cloud.utils.PropertiesUtil;
 import org.apache.log4j.Logger;
 
 import com.cloud.agent.AgentManager;
@@ -540,8 +541,13 @@
 	}
 
 	@Override
-	public String[] getPropertiesFiles() {
-		return new String[] { "nicira-nvp_commands.properties" };
+	public List<Class<?>> getCommands() {
+        List<Class<?>> cmdList = new ArrayList<Class<?>>();
+        cmdList.add(AddNiciraNvpDeviceCmd.class);
+        cmdList.add(DeleteNiciraNvpDeviceCmd.class);
+        cmdList.add(ListNiciraNvpDeviceNetworksCmd.class);
+        cmdList.add(ListNiciraNvpDevicesCmd.class);
+        return cmdList;
 	}
 
 	@Override
diff --git a/pom.xml b/pom.xml
index 1dcf36f..c440a66 100644
--- a/pom.xml
+++ b/pom.xml
@@ -244,7 +244,6 @@
               <exclude>dist/console-proxy/js/jquery.js</exclude>
               <exclude>scripts/vm/systemvm/id_rsa.cloud</exclude>
               <exclude>tools/devcloud/basebuild/puppet-devcloudinitial/files/network.conf</exclude>
-              <exclude>tools/devcloud/devcloud.cfg</exclude>
               <exclude>ui/lib/flot/jquery.colorhelpers.js</exclude>
               <exclude>ui/lib/flot/jquery.flot.crosshair.js</exclude>
               <exclude>ui/lib/flot/jquery.flot.fillbetween.js</exclude>
@@ -371,6 +370,7 @@
         <module>developer</module>
         <module>tools/apidoc</module>
         <module>tools/devcloud</module>
+        <module>tools/devcloud-kvm</module>
         <module>tools/marvin</module>
         <module>tools/cli</module>
       </modules>
diff --git a/python/lib/cloudutils/utilities.py b/python/lib/cloudutils/utilities.py
index adf81fc..3f5f2a9 100755
--- a/python/lib/cloudutils/utilities.py
+++ b/python/lib/cloudutils/utilities.py
@@ -96,6 +96,10 @@
         output = "[%-6s]\n"%"Failed"
     sys.stdout.write(output)
     sys.stdout.flush()
+
+class UnknownSystemException(Exception):
+    "This Excption is raised if the current operating enviornment is unknown"
+    pass
  
 class Distribution:
     def __init__(self):
@@ -120,7 +124,7 @@
             self.arch = bash("uname -m").getStdout()
             
         else: 
-            self.distro = "Unknown" 
+            raise UnknownSystemException
 
     def getVersion(self):
         return self.distro 
diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java
index 7bc3271..55d7f42 100755
--- a/server/src/com/cloud/api/ApiDispatcher.java
+++ b/server/src/com/cloud/api/ApiDispatcher.java
@@ -64,7 +64,6 @@
 import com.cloud.utils.db.GenericDao;
 import com.cloud.utils.exception.CSExceptionErrorCode;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.uuididentity.dao.IdentityDao;
 
 // ApiDispatcher: A class that dispatches API commands to the appropriate manager for execution.
 public class ApiDispatcher {
@@ -75,7 +74,6 @@
     @Inject private AsyncJobManager _asyncMgr = null;
     @Inject private AccountManager _accountMgr = null;
     @Inject EntityManager _entityMgr = null;
-    @Inject IdentityDao _identityDao = null;
 
     Map<String, Class<? extends GenericDao>> _daoNameMap = new HashMap<String, Class<? extends GenericDao>>();
     // singleton class
@@ -708,8 +706,4 @@
             throw new CloudRuntimeException("Internal error at plugService for command " + cmd.getCommandName() + " [field " + field.getName() + " is not accessible]");
         }
     }
-
-    public static Long getIdentiyId(String tableName, String token) {
-        return s_instance._identityDao.getIdentityId(tableName, token);
-    }
 }
diff --git a/server/src/com/cloud/api/ApiGsonHelper.java b/server/src/com/cloud/api/ApiGsonHelper.java
index 6e64f71..6163860 100644
--- a/server/src/com/cloud/api/ApiGsonHelper.java
+++ b/server/src/com/cloud/api/ApiGsonHelper.java
@@ -17,7 +17,6 @@
 package com.cloud.api;
 
 import com.google.gson.GsonBuilder;
-import com.cloud.utils.IdentityProxy;
 import org.apache.cloudstack.api.ResponseObject;
 
 import java.util.Map;
@@ -28,7 +27,6 @@
         s_gBuilder = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
         s_gBuilder.setVersion(1.3);
         s_gBuilder.registerTypeAdapter(ResponseObject.class, new ResponseObjectTypeAdapter());
-        s_gBuilder.registerTypeAdapter(IdentityProxy.class, new IdentityTypeAdapter());
         s_gBuilder.registerTypeAdapter(Map.class, new StringMapTypeAdapter());
     }
 
diff --git a/server/src/com/cloud/api/ApiResponseGsonHelper.java b/server/src/com/cloud/api/ApiResponseGsonHelper.java
index c71193e..6bccf9a 100644
--- a/server/src/com/cloud/api/ApiResponseGsonHelper.java
+++ b/server/src/com/cloud/api/ApiResponseGsonHelper.java
@@ -17,7 +17,6 @@
 package com.cloud.api;
 
 import com.google.gson.GsonBuilder;
-import com.cloud.utils.IdentityProxy;
 import org.apache.cloudstack.api.ResponseObject;
 
 /**
@@ -25,13 +24,12 @@
  */
 public class ApiResponseGsonHelper {
     private static final GsonBuilder s_gBuilder;
-    
+
     static {
         s_gBuilder = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
         s_gBuilder.setVersion(1.3);
         s_gBuilder.registerTypeAdapter(ResponseObject.class, new ResponseObjectTypeAdapter());
         s_gBuilder.registerTypeAdapter(String.class, new EncodedStringTypeAdapter());
-        s_gBuilder.registerTypeAdapter(IdentityProxy.class, new IdentityTypeAdapter());
     }
 
     public static GsonBuilder getBuilder() {
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index 4775439..c346a6b 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -482,7 +482,7 @@
         response.setEndPoint(result.getEndPoint());
         response.setHttpsFlag(result.getHttpsFlag());
         response.setMaxErrorRetry(result.getMaxErrorRetry());
-        response.setObjectId(result.getId());
+        response.setObjectId(result.getUuid());
         response.setSecretKey(result.getSecretKey());
         response.setSocketTimeout(result.getSocketTimeout());
         response.setTemplateBucketName(result.getBucketName());
@@ -2792,11 +2792,6 @@
     }
 
     @Override
-    public Long getIdentiyId(String tableName, String token) {
-        return ApiDispatcher.getIdentiyId(tableName, token);
-    }
-
-    @Override
     public ResourceTagResponse createResourceTagResponse(ResourceTag resourceTag, boolean keyValueOnly) {
         ResourceTagJoinVO rto = ApiDBUtils.newResourceTagView(resourceTag);
         return ApiDBUtils.newResourceTagResponse(rto, keyValueOnly);
diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java
index 56cef12..e106f03 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -51,8 +51,8 @@
 import javax.servlet.http.HttpSession;
 
 import com.cloud.utils.ReflectUtil;
-import org.apache.cloudstack.acl.APIAccessChecker;
-import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.acl.APIChecker;
+import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.api.*;
 import org.apache.cloudstack.api.command.user.account.ListAccountsCmd;
 import org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd;
@@ -60,7 +60,6 @@
 import org.apache.cloudstack.api.command.user.vm.ListVMsCmd;
 import org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd;
 import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd;
-import org.apache.cloudstack.discovery.ApiDiscoveryService;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.http.client.utils.URLEncodedUtils;
 import org.apache.http.ConnectionClosedException;
@@ -132,9 +131,6 @@
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CSExceptionErrorCode;
-import com.cloud.uuididentity.dao.IdentityDao;
-
-import org.reflections.Reflections;
 
 public class ApiServer implements HttpRequestHandler {
     private static final Logger s_logger = Logger.getLogger(ApiServer.class.getName());
@@ -148,17 +144,15 @@
     @Inject private DomainManager _domainMgr = null;
     @Inject private AsyncJobManager _asyncMgr = null;
 
-    @Inject(adapter = APIAccessChecker.class)
-    protected Adapters<APIAccessChecker> _apiAccessCheckers;
-    @Inject(adapter = ApiDiscoveryService.class)
-    protected Adapters<ApiDiscoveryService> _apiDiscoveryServices;
+    @Inject(adapter = APIChecker.class)
+    protected Adapters<APIChecker> _apiAccessCheckers;
 
     private Account _systemAccount = null;
     private User _systemUser = null;
     private static int _workerCount = 0;
     private static ApiServer s_instance = null;
     private static final DateFormat _dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
-    private Map<String, Class<?>> _apiNameCmdClassMap = new HashMap<String, Class<?>>();
+    private static Map<String, Class<?>> _apiNameCmdClassMap = new HashMap<String, Class<?>>();
 
     private static ExecutorService _executor = new ThreadPoolExecutor(10, 150, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory("ApiServer"));
 
@@ -166,23 +160,22 @@
         super();
     }
 
-    public static void initApiServer(String[] apiConfig) {
+    public static void initApiServer() {
         if (s_instance == null) {
             //Injection will create ApiServer and all its fields which have @Inject
             s_instance = ComponentLocator.inject(ApiServer.class);
-            s_instance.init(apiConfig);
+            s_instance.init();
         }
     }
 
     public static ApiServer getInstance() {
-        // Assumption: CloudStartupServlet would initialize ApiServer
         if (s_instance == null) {
-            s_logger.fatal("ApiServer instance failed to initialize");
+            ApiServer.initApiServer();
         }
         return s_instance;
     }
 
-    public void init(String[] apiConfig) {
+    public void init() {
         BaseCmd.setComponents(new ApiResponseHelper());
         BaseListCmd.configure();
 
@@ -203,13 +196,16 @@
             }
         }
 
-        for (ApiDiscoveryService discoveryService: _apiDiscoveryServices) {
-            _apiNameCmdClassMap.putAll(discoveryService.getApiNameCmdClassMapping());
-        }
+        Set<Class<?>> cmdClasses = ReflectUtil.getClassesWithAnnotation(APICommand.class,
+                new String[]{"org.apache.cloudstack.api", "com.cloud.api"});
 
-        if (_apiNameCmdClassMap.size() == 0) {
-            s_logger.fatal("ApiServer failed to generate apiname, cmd class mappings."
-                         + "Please check and enable at least one ApiDiscovery adapter.");
+        for(Class<?> cmdClass: cmdClasses) {
+            String apiName = cmdClass.getAnnotation(APICommand.class).name();
+            if (_apiNameCmdClassMap.containsKey(apiName)) {
+                s_logger.error("API Cmd class " + cmdClass.getName() + " has non-unique apiname" + apiName);
+                continue;
+            }
+            _apiNameCmdClassMap.put(apiName, cmdClass);
         }
 
         encodeApiResponse = Boolean.valueOf(configDao.getValue(Config.EncodeApiResponse.key()));
@@ -403,12 +399,12 @@
         // BaseAsyncCmd: cmd is processed and submitted as an AsyncJob, job related info is serialized and returned.
         if (cmdObj instanceof BaseAsyncCmd) {
             Long objectId = null;
-            String objectEntityTable = null;
+            String objectUuid = null;
             if (cmdObj instanceof BaseAsyncCreateCmd) {
                 BaseAsyncCreateCmd createCmd = (BaseAsyncCreateCmd) cmdObj;
                 _dispatcher.dispatchCreateCmd(createCmd, params);
                 objectId = createCmd.getEntityId();
-                objectEntityTable = createCmd.getEntityTable();
+                objectUuid = createCmd.getEntityUuid();
                 params.put("id", objectId.toString());
             } else {
                 ApiDispatcher.processParameters(cmdObj, params);
@@ -452,8 +448,8 @@
             }
 
             if (objectId != null) {
-                SerializationContext.current().setUuidTranslation(true);
-                return ((BaseAsyncCreateCmd) asyncCmd).getResponse(jobId, objectId, objectEntityTable);
+                String objUuid = (objectUuid == null) ? objectId.toString() : objectUuid;
+                return ((BaseAsyncCreateCmd) asyncCmd).getResponse(jobId, objUuid);
             }
 
             SerializationContext.current().setUuidTranslation(true);
@@ -463,6 +459,7 @@
 
             // if the command is of the listXXXCommand, we will need to also return the
             // the job id and status if possible
+            // For those listXXXCommand which we have already created DB views, this step is not needed since async job is joined in their db views.
             if (cmdObj instanceof BaseListCmd && !(cmdObj instanceof ListVMsCmd) && !(cmdObj instanceof ListRoutersCmd)
                     && !(cmdObj instanceof ListSecurityGroupsCmd)
                     && !(cmdObj instanceof ListTagsCmd)
@@ -552,15 +549,18 @@
             // if userId not null, that mean that user is logged in
             if (userId != null) {
             	User user = ApiDBUtils.findUserById(userId);
-                if (!isCommandAvailable(user, commandName)) {
-                    s_logger.warn("The given command:" + commandName + " does not exist or it is not available for user");
+            	try{
+            	    checkCommandAvailable(user, commandName);
+            	}
+            	catch (PermissionDeniedException ex){
+                    s_logger.debug("The given command:" + commandName + " does not exist or it is not available for user with id:" + userId);
                     throw new ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, "The given command does not exist or it is not available for user");
                 }
                 return true;
             } else {
                 // check against every available command to see if the command exists or not
-                if (!isCommandAvailable(null, commandName) && !commandName.equals("login") && !commandName.equals("logout")) {
-                    s_logger.warn("The given command:" + commandName + " does not exist or it is not available for user");
+                if (!_apiNameCmdClassMap.containsKey(commandName) && !commandName.equals("login") && !commandName.equals("logout")) {
+                    s_logger.debug("The given command:" + commandName + " does not exist or it is not available for user with id:" + userId);
                     throw new ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, "The given command does not exist or it is not available for user");
                 }
             }
@@ -604,30 +604,29 @@
 
             // if api/secret key are passed to the parameters
             if ((signature == null) || (apiKey == null)) {
-                if (s_logger.isDebugEnabled()) {
-                    s_logger.info("expired session, missing signature, or missing apiKey -- ignoring request...sig: " + signature + ", apiKey: " + apiKey);
-                }
+                s_logger.debug("Expired session, missing signature, or missing apiKey -- ignoring request. Signature: " + signature + ", apiKey: " + apiKey);
                 return false; // no signature, bad request
             }
 
             Date expiresTS = null;
+            // FIXME: Hard coded signature, why not have an enum
             if ("3".equals(signatureVersion)) {
                 // New signature authentication. Check for expire parameter and its validity
                 if (expires == null) {
-                    s_logger.info("missing Expires parameter -- ignoring request...sig: " + signature + ", apiKey: " + apiKey);
+                    s_logger.debug("Missing Expires parameter -- ignoring request. Signature: " + signature + ", apiKey: " + apiKey);
                     return false;
                 }
                 synchronized (_dateFormat) {
                     try {
                         expiresTS = _dateFormat.parse(expires);
                     } catch (ParseException pe) {
-                        s_logger.info("Incorrect date format for Expires parameter", pe);
+                        s_logger.debug("Incorrect date format for Expires parameter", pe);
                         return false;
                     }
                 }
                 Date now = new Date(System.currentTimeMillis());
                 if (expiresTS.before(now)) {
-                    s_logger.info("Request expired -- ignoring ...sig: " + signature + ", apiKey: " + apiKey);
+                    s_logger.debug("Request expired -- ignoring ...sig: " + signature + ", apiKey: " + apiKey);
                     return false;
                 }
             }
@@ -638,7 +637,7 @@
             // verify there is a user with this api key
             Pair<User, Account> userAcctPair = _accountMgr.findUserByApiKey(apiKey);
             if (userAcctPair == null) {
-                s_logger.info("apiKey does not map to a valid user -- ignoring request, apiKey: " + apiKey);
+                s_logger.debug("apiKey does not map to a valid user -- ignoring request, apiKey: " + apiKey);
                 return false;
             }
 
@@ -653,9 +652,12 @@
 
             UserContext.updateContext(user.getId(), account, null);
 
-            if (!isCommandAvailable(user, commandName)) {
-                s_logger.warn("The given command:" + commandName + " does not exist or it is not available for user");
-                throw new ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, "The given command:" + commandName + " does not exist or it is not available for user");
+            try{
+                checkCommandAvailable(user, commandName);
+            }
+            catch (PermissionDeniedException ex){
+                s_logger.debug("The given command:" + commandName + " does not exist or it is not available for user");
+                throw new ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, "The given command:" + commandName + " does not exist or it is not available for user with id:" + userId);
             }
 
             // verify secret key exists
@@ -682,20 +684,13 @@
             if (ex instanceof ServerApiException && ((ServerApiException) ex).getErrorCode() == BaseCmd.UNSUPPORTED_ACTION_ERROR) {
                 throw (ServerApiException) ex;
             }
-            s_logger.error("unable to verifty request signature", ex);
+            s_logger.error("unable to verify request signature", ex);
         }
         return false;
     }
 
-    public Long fetchDomainId(String domainUUID){
-        ComponentLocator locator = ComponentLocator.getLocator(ManagementServer.Name);
-        IdentityDao identityDao = locator.getDao(IdentityDao.class);
-        try{
-            Long domainId = identityDao.getIdentityId("domain", domainUUID);
-            return domainId;
-        }catch(InvalidParameterValueException ex){
-            return null;
-        }
+    public Long fetchDomainId(String domainUUID) {
+        return _domainMgr.getDomain(domainUUID).getId();
     }
 
     public void loginUser(HttpSession session, String username, String password, Long domainId, String domainPath, String loginIpAddress ,Map<String, Object[]> requestParameters) throws CloudAuthenticationException {
@@ -791,13 +786,14 @@
         return true;
     }
 
-    private boolean isCommandAvailable(User user, String commandName) {
-        for (APIAccessChecker apiChecker : _apiAccessCheckers) {
-            // Fail the checking if any checker fails to verify
-            if (!apiChecker.canAccessAPI(user, commandName))
-                return false;
+    private void checkCommandAvailable(User user, String commandName) throws PermissionDeniedException {
+        if (user == null) {
+            throw new PermissionDeniedException("User is null for role based API access check for command" + commandName);
         }
-        return true;
+
+        for (APIChecker apiChecker : _apiAccessCheckers) {
+            apiChecker.checkAccess(user, commandName);
+        }
     }
 
     private Class<?> getCmdClass(String cmdName) {
diff --git a/server/src/com/cloud/api/IdentityTypeAdapter.java b/server/src/com/cloud/api/IdentityTypeAdapter.java
deleted file mode 100644
index 369c202..0000000
--- a/server/src/com/cloud/api/IdentityTypeAdapter.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.api;
-
-import java.lang.reflect.Type;
-
-import com.cloud.uuididentity.dao.IdentityDao;
-import com.cloud.uuididentity.dao.IdentityDaoImpl;
-import com.google.gson.Gson;
-import com.google.gson.JsonDeserializationContext;
-import com.google.gson.JsonDeserializer;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParseException;
-import com.google.gson.JsonPrimitive;
-import com.google.gson.JsonSerializationContext;
-import com.google.gson.JsonSerializer;
-import com.cloud.utils.IdentityProxy;
-
-
-public class IdentityTypeAdapter implements JsonSerializer<IdentityProxy>, JsonDeserializer<IdentityProxy> {
-	
-	@Override
-	public JsonElement serialize(IdentityProxy src, Type srcType, JsonSerializationContext context) {
-		if(SerializationContext.current().getUuidTranslation()) {
-			assert(src != null);
-			if(src.getValue() == null)
-				return context.serialize(null);
-	
-			IdentityDao identityDao = new IdentityDaoImpl();
-			if(src.getTableName() != null) {
-				String uuid = identityDao.getIdentityUuid(src.getTableName(), String.valueOf(src.getValue()));
-				if(uuid == null)
-					return context.serialize(null);
-				
-				// Exceptions set the _idFieldName in the IdentityProxy structure. So if this field is not
-				// null, prepare a structure of uuid and idFieldName and return the json representation of that.
-				String idName = src.getidFieldName();
-				if (idName != null) {
-					// Prepare a structure.
-					JsonObject jsonObj = new JsonObject();
-					jsonObj.add("uuid", new JsonPrimitive(uuid));
-					jsonObj.add("uuidProperty", new JsonPrimitive(idName));
-					return jsonObj;
-				}
-				return new JsonPrimitive(uuid);
-			} else {
-				return new JsonPrimitive(String.valueOf(src.getValue()));
-			}
-		} else {
-	        return new Gson().toJsonTree(src);
-		}
-	}
-	
-	@Override
-	public IdentityProxy deserialize(JsonElement src, Type srcType,
-			JsonDeserializationContext context) throws JsonParseException {
-
-		IdentityProxy obj = new IdentityProxy();
-		JsonObject json = src.getAsJsonObject();
-		obj.setTableName(json.get("_tableName").getAsString());
-		if(json.get("_value") != null)
-			obj.setValue(json.get("_value").getAsLong());
-		return obj;
-	}
-}
diff --git a/server/src/com/cloud/api/response/ApiResponseSerializer.java b/server/src/com/cloud/api/response/ApiResponseSerializer.java
index 470cc5f..11aee3d 100644
--- a/server/src/com/cloud/api/response/ApiResponseSerializer.java
+++ b/server/src/com/cloud/api/response/ApiResponseSerializer.java
@@ -37,7 +37,6 @@
 import com.cloud.api.ApiServer;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.ResponseObject;
-import com.cloud.utils.IdentityProxy;
 import com.cloud.utils.encoding.URLEncoder;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.uuididentity.dao.IdentityDao;
@@ -226,27 +225,17 @@
                                 subObj.setObjectName(serializedName.value());
                             }
                             serializeResponseObjXML(sb, subObj);
-                        } else if (value instanceof IdentityProxy) {
-                        	// Only exception reponses carry a list of IdentityProxy objects.
-                        	IdentityProxy idProxy = (IdentityProxy)value;
-                        	String id = (idProxy.getValue() != null ? String.valueOf(idProxy.getValue()) : "");
-                        	if(!id.isEmpty()) {
-                        		IdentityDao identityDao = new IdentityDaoImpl();
-                        		id = identityDao.getIdentityUuid(idProxy.getTableName(), id);
-                        	}
-                        	if(id != null && !id.isEmpty()) {
-                        		// If this is the first IdentityProxy field encountered, put in a uuidList tag.
-                        		if (!usedUuidList) {
-                        			sb.append("<").append(serializedName.value()).append(">");
-                        			usedUuidList = true;
-                        		}
-                        		sb.append("<uuid>").append(id).append("</uuid>");
-                        	}
-                        	// Append the new idFieldName property also.
-                        	String idFieldName = idProxy.getidFieldName();
-                        	if (idFieldName != null) {
-                        		sb.append("<uuidProperty>").append(idFieldName).append("</uuidProperty>");
-                        	}
+                        } else {
+                            // Only exception reponses carry a list of uuid
+                            // strings.
+                            // If this is the first IdentityProxy field
+                            // encountered, put in a uuidList tag.
+                            if (!usedUuidList) {
+                                sb.append("<").append(serializedName.value()).append(">");
+                                usedUuidList = true;
+                            }
+                            sb.append("<uuid>").append(value).append("</uuid>");
+                            // We have removed uuid property field due to removal of IdentityProxy class.
                         }
                     }
                     if (usedUuidList) {
@@ -256,19 +245,6 @@
                 } else if (fieldValue instanceof Date) {
                     sb.append("<").append(serializedName.value()).append(">").append(BaseCmd.getDateString((Date) fieldValue)).
                     append("</").append(serializedName.value()).append(">");
-                } else if (fieldValue instanceof IdentityProxy) {
-                	IdentityProxy idProxy = (IdentityProxy)fieldValue;
-                	String id = (idProxy.getValue() != null ? String.valueOf(idProxy.getValue()) : "");
-                	if(!id.isEmpty()) {
-                		IdentityDao identityDao = new IdentityDaoImpl();
-                		if(idProxy.getTableName() != null) {
-                		    id = identityDao.getIdentityUuid(idProxy.getTableName(), id);
-                		} else {
-                		    s_logger.warn("IdentityProxy sanity check issue, invalid IdentityProxy table name found in class: " + obj.getClass().getName());
-                		}
-                	}
-                	if(id != null && !id.isEmpty())
-                		sb.append("<").append(serializedName.value()).append(">").append(id).append("</").append(serializedName.value()).append(">");
                 } else {
                     String resultString = escapeSpecialXmlChars(fieldValue.toString());
                     if (!(obj instanceof ExceptionResponse)) {
diff --git a/server/src/com/cloud/async/AsyncCommandQueued.java b/server/src/com/cloud/async/AsyncCommandQueued.java
index 200b40e..f01c214 100644
--- a/server/src/com/cloud/async/AsyncCommandQueued.java
+++ b/server/src/com/cloud/async/AsyncCommandQueued.java
@@ -17,9 +17,9 @@
 package com.cloud.async;
 
 import com.cloud.utils.SerialVersionUID;
-import com.cloud.utils.exception.RuntimeCloudException;
+import com.cloud.utils.exception.CloudRuntimeException;
 
-public class AsyncCommandQueued extends RuntimeCloudException {
+public class AsyncCommandQueued extends CloudRuntimeException {
     private static final long serialVersionUID = SerialVersionUID.AsyncCommandQueued;
 
     private SyncQueueVO _queue = null;
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 2e20c13..9526279 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -2071,7 +2071,12 @@
         Long projectId = cmd.getProjectId();
         Long domainId = cmd.getDomainId();
         Account vlanOwner = null;
-
+        
+        // if end ip is not specified, default it to startIp
+        if (endIP == null && startIP != null) {
+            endIP = startIP;
+        }
+        
         if (projectId != null) {
             if (accountName != null) {
                 throw new InvalidParameterValueException("Account and projectId are mutually exclusive");
@@ -2176,6 +2181,7 @@
                         throw new InvalidParameterValueException("Nework id is required for Direct vlan creation ");
                     }
                     networkId = network.getId();
+                    zoneId = network.getDataCenterId();
                 }
             } else if (network.getGuestType() == null || network.getGuestType() == Network.GuestType.Isolated) {
                 throw new InvalidParameterValueException("Can't create direct vlan for network id=" + networkId + " with type: " + network.getGuestType());
@@ -2192,34 +2198,34 @@
             endIP = startIP;
         }
 
-        if (forVirtualNetwork || zone.getNetworkType() == DataCenter.NetworkType.Basic || zone.isSecurityGroupEnabled()) {
-            if (vlanGateway == null || vlanNetmask == null || zoneId == null) {
-                throw new InvalidParameterValueException("Gateway, netmask and zoneId have to be passed in for virtual and direct untagged networks");
-            }
-        } else {
-            // check if startIp and endIp belong to network Cidr
-            String networkCidr = network.getCidr();
-            String networkGateway = network.getGateway();
-            Long networkZoneId = network.getDataCenterId();
-            String networkNetmask = NetUtils.getCidrNetmask(networkCidr);
-
-            // Check if ip addresses are in network range
-            if (!NetUtils.sameSubnet(startIP, networkGateway, networkNetmask)) {
-                throw new InvalidParameterValueException("Start ip is not in network cidr: " + networkCidr);
-            }
-
-            if (endIP != null) {
-                if (!NetUtils.sameSubnet(endIP, networkGateway, networkNetmask)) {
-                    throw new InvalidParameterValueException("End ip is not in network cidr: " + networkCidr);
+        if ( zone.getNetworkType() == DataCenter.NetworkType.Advanced ) {
+            if (network.getTrafficType() == TrafficType.Guest) {
+                if (network.getGuestType() != GuestType.Shared) {
+                    throw new InvalidParameterValueException("Can execute createVLANIpRanges on shared guest network, but type of this guest network "
+                            + network.getId() + " is " + network.getGuestType());
                 }
+                List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(network.getId());
+                if ( vlans != null && vlans.size() > 0 ) {
+                    VlanVO vlan = vlans.get(0);
+                    if ( vlanId == null ) {
+                        vlanId = vlan.getVlanTag();
+                    } else if ( vlan.getVlanTag() != vlanId ) {
+                        throw new InvalidParameterValueException("there is already one vlan " + vlan.getVlanTag() + " on network :" +
+                                + network.getId() + ", only one vlan is allowed on guest network");
+                    }
+                    vlanGateway = vlan.getVlanGateway();
+                    vlanNetmask = vlan.getVlanNetmask();
+                }
+            } else if (network.getTrafficType() == TrafficType.Management) {
+                throw new InvalidParameterValueException("Cannot execute createVLANIpRanges on management network");
             }
-
-            // set gateway, netmask, zone from network object
-            vlanGateway = networkGateway;
-            vlanNetmask = networkNetmask;
-            zoneId = networkZoneId;
         }
 
+        if (vlanGateway == null || vlanNetmask == null || zoneId == null) {
+            throw new InvalidParameterValueException("Gateway, netmask and zoneId have to be passed in for virtual and direct untagged networks");
+        }
+
+
         // if it's an account specific range, associate ip address list to the account
         boolean associateIpRangeToAccount = false;
 
@@ -3157,33 +3163,20 @@
 
     void validateStaticNatServiceCapablities(Map<Capability, String> staticNatServiceCapabilityMap) {
         if (staticNatServiceCapabilityMap != null && !staticNatServiceCapabilityMap.isEmpty()) {
-            if (staticNatServiceCapabilityMap.keySet().size() > 2) {
-                throw new InvalidParameterValueException("Only " + Capability.ElasticIp.getName() +  " and " + Capability.AssociatePublicIP.getName() +  " capabilitiy can be sepcified for static nat service");
+            if (staticNatServiceCapabilityMap.keySet().size() > 1) {
+                throw new InvalidParameterValueException("Only " + Capability.ElasticIp.getName() +  " capability can be specified for static nat service");
             }
-            boolean eipEnabled = false;
-            boolean eipDisabled = false;
-            boolean associatePublicIP = true;
+
             for (Capability capability : staticNatServiceCapabilityMap.keySet()) {
                 String value = staticNatServiceCapabilityMap.get(capability);
                 if (capability == Capability.ElasticIp) {
-                    eipEnabled = value.contains("true");
-                    eipDisabled = value.contains("false");
-                    if (!eipEnabled && !eipDisabled) {
+                    boolean enabled = value.contains("true");
+                    boolean disabled = value.contains("false");
+                    if (!enabled && !disabled) {
                         throw new InvalidParameterValueException("Unknown specified value for " + Capability.ElasticIp.getName());
                     }
-                } else if (capability == Capability.AssociatePublicIP) {
-                    if (value.contains("true")) {
-                        associatePublicIP = true;
-                    } else if (value.contains("false")) {
-                        associatePublicIP = false;
-                    } else {
-                        throw new InvalidParameterValueException("Unknown specified value for " + Capability.AssociatePublicIP.getName());
-                    }
                 } else {
-                    throw new InvalidParameterValueException("Only " + Capability.ElasticIp.getName() +  " and " + Capability.AssociatePublicIP.getName() +  " capabilitiy can be sepcified for static nat service");
-                }
-                if (eipDisabled && associatePublicIP) {
-                    throw new InvalidParameterValueException("Capability " + Capability.AssociatePublicIP.getName() + " can only be set when capability " + Capability.ElasticIp.getName() + " is true");
+                    throw new InvalidParameterValueException("Only " + Capability.ElasticIp.getName() + " capability can be specified for static nat service");
                 }
             }
         }
@@ -3237,7 +3230,6 @@
         boolean sharedSourceNat = false;
         boolean redundantRouter = false;
         boolean elasticIp = false;
-        boolean associatePublicIp = false;
         boolean inline = false;
         if (serviceCapabilityMap != null && !serviceCapabilityMap.isEmpty()) {
             Map<Capability, String> lbServiceCapabilityMap = serviceCapabilityMap.get(Service.Lb);
@@ -3287,17 +3279,13 @@
                 String param = staticNatServiceCapabilityMap.get(Capability.ElasticIp);
                 if (param != null) {
                     elasticIp = param.contains("true");
-                    String associatePublicIP = staticNatServiceCapabilityMap.get(Capability.AssociatePublicIP);
-                    if (associatePublicIP != null) {
-                        associatePublicIp = associatePublicIP.contains("true");
-                    }
                 }
             }
         }
 
         NetworkOfferingVO offering = new NetworkOfferingVO(name, displayText, trafficType, systemOnly, specifyVlan, 
                 networkRate, multicastRate, isDefault, availability, tags, type, conserveMode, dedicatedLb,
-                sharedSourceNat, redundantRouter, elasticIp, elasticLb, associatePublicIp, specifyIpRanges, inline);
+                sharedSourceNat, redundantRouter, elasticIp, elasticLb, specifyIpRanges, inline);
 
         if (serviceOfferingId != null) {
             offering.setServiceOfferingId(serviceOfferingId);
diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
index 4994f4f..5bc5d27 100755
--- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
@@ -31,6 +31,8 @@
 import javax.naming.ConfigurationException;
 import javax.persistence.Table;
 
+import com.cloud.offering.DiskOffering;
+import com.cloud.storage.dao.DiskOfferingDao;
 import org.apache.log4j.Logger;
 
 import com.cloud.agent.AgentManager;
@@ -107,7 +109,6 @@
 import com.cloud.service.ServiceOfferingVO;
 import com.cloud.service.dao.ServiceOfferingDao;
 import com.cloud.servlet.ConsoleProxyServlet;
-import com.cloud.storage.DiskOfferingVO;
 import com.cloud.storage.StorageManager;
 import com.cloud.storage.StoragePoolStatus;
 import com.cloud.storage.StoragePoolVO;
@@ -138,7 +139,6 @@
 import com.cloud.utils.events.SubscriptionMgr;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.NetUtils;
-import com.cloud.uuididentity.dao.IdentityDao;
 import com.cloud.vm.ConsoleProxyVO;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.ReservationContext;
@@ -216,6 +216,8 @@
     @Inject
     ServiceOfferingDao _offeringDao;
     @Inject
+    DiskOfferingDao _diskOfferingDao;
+    @Inject
     NetworkOfferingDao _networkOfferingDao;
     @Inject
     StoragePoolDao _storagePoolDao;
@@ -224,8 +226,6 @@
     @Inject
     ResourceManager _resourceMgr;
     @Inject
-    IdentityDao _identityDao;
-    @Inject
     NetworkDao _networkDao;
     @Inject
     RulesManager _rulesMgr;
@@ -928,14 +928,12 @@
             return new ConsoleAccessAuthenticationAnswer(cmd, false);
         }
 
-        vmId = _identityDao.getIdentityId("vm_instance", cmd.getVmId());
-        if (vmId == null) {
-            s_logger.error("Invalid vm id " + cmd.getVmId() + " sent from console access authentication");
-            return new ConsoleAccessAuthenticationAnswer(cmd, false);
-        }
-
-        VMInstanceVO vm = _instanceDao.findById(vmId);
+        VirtualMachine vm = _instanceDao.findByUuid(cmd.getVmId());
         if (vm == null) {
+            vm = _instanceDao.findById(Long.parseLong(cmd.getVmId()));
+        }
+        if (vm == null) {
+            s_logger.error("Invalid vm id " + cmd.getVmId() + " sent from console access authentication");
             return new ConsoleAccessAuthenticationAnswer(cmd, false);
         }
 
@@ -1525,16 +1523,13 @@
         //check if there is a default service offering configured
         String cpvmSrvcOffIdStr = configs.get(Config.ConsoleProxyServiceOffering.key()); 
         if (cpvmSrvcOffIdStr != null) {
-            
-            Long cpvmSrvcOffId = null;
-            try {
-                cpvmSrvcOffId = _identityDao.getIdentityId(DiskOfferingVO.class.getAnnotation(Table.class).name(),cpvmSrvcOffIdStr);
-            } catch (Exception e) {
-                String msg = "Can't find system service offering specified by global config, uuid=" + cpvmSrvcOffIdStr + " for console proxy vm";
-                s_logger.warn(msg);
-            }
-            if(cpvmSrvcOffId != null){
-                _serviceOffering = _offeringDao.findById(cpvmSrvcOffId);
+            DiskOffering diskOffering = _diskOfferingDao.findByUuid(cpvmSrvcOffIdStr);
+            if (diskOffering == null)
+                diskOffering = _diskOfferingDao.findById(Long.parseLong(cpvmSrvcOffIdStr));
+            if (diskOffering != null) {
+                _serviceOffering = _offeringDao.findById(diskOffering.getId());
+            } else {
+                s_logger.warn("Can't find system service offering specified by global config, uuid=" + cpvmSrvcOffIdStr + " for console proxy vm");
             }
         } 
 
diff --git a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
index 242852f..2efe6d3 100644
--- a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
+++ b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
@@ -62,6 +62,7 @@
         to.setIsolationuri(profile.getIsolationUri());
         to.setNetworkRateMbps(profile.getNetworkRate());
         to.setName(profile.getName());
+        to.setSecurityGroupEnabled(profile.isSecurityGroupEnabled());
         
         // Workaround to make sure the TO has the UUID we need for Niciri integration
         NicVO nicVO = _nicDao.findById(profile.getId());
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index c500376..0a1fcd7 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -16,58 +16,19 @@
 // under the License.
 package com.cloud.network;
 
-import java.net.URI;
-import java.security.InvalidParameterException;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-import javax.ejb.Local;
-import javax.naming.ConfigurationException;
-
-import com.cloud.utils.db.*;
-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.RestartNetworkCmd;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.acl.ControlledEntity.ACLType;
-import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.Listener;
 import com.cloud.agent.api.*;
 import com.cloud.agent.api.to.NicTO;
 import com.cloud.alert.AlertManager;
 import com.cloud.api.ApiDBUtils;
-
-import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
 import com.cloud.configuration.Config;
 import com.cloud.configuration.ConfigurationManager;
 import com.cloud.configuration.Resource.ResourceType;
 import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.dc.*;
 import com.cloud.dc.DataCenter.NetworkType;
-import com.cloud.dc.DataCenterVO;
-import com.cloud.dc.Pod;
-import com.cloud.dc.PodVlanMapVO;
-import com.cloud.dc.Vlan;
 import com.cloud.dc.Vlan.VlanType;
-import com.cloud.dc.VlanVO;
 import com.cloud.dc.dao.AccountVlanMapDao;
 import com.cloud.dc.dao.DataCenterDao;
 import com.cloud.dc.dao.PodVlanMapDao;
@@ -110,13 +71,6 @@
 import com.cloud.network.lb.LoadBalancingRulesManager;
 import com.cloud.network.rules.*;
 import com.cloud.network.rules.FirewallRule.Purpose;
-import com.cloud.network.rules.FirewallRuleVO;
-import com.cloud.network.rules.PortForwardingRule;
-import com.cloud.network.rules.PortForwardingRuleVO;
-import com.cloud.network.rules.RulesManager;
-import com.cloud.network.rules.StaticNat;
-import com.cloud.network.rules.StaticNatRule;
-import com.cloud.network.rules.StaticNatRuleImpl;
 import com.cloud.network.rules.dao.PortForwardingRulesDao;
 import com.cloud.network.vpc.NetworkACLManager;
 import com.cloud.network.vpc.PrivateIpVO;
@@ -145,30 +99,38 @@
 import com.cloud.utils.component.Inject;
 import com.cloud.utils.component.Manager;
 import com.cloud.utils.concurrency.NamedThreadFactory;
+import com.cloud.utils.db.*;
 import com.cloud.utils.db.JoinBuilder.JoinType;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.Ip;
 import com.cloud.utils.net.NetUtils;
-import com.cloud.vm.Nic;
-import com.cloud.vm.NicProfile;
-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.*;
 import com.cloud.vm.VirtualMachine.Type;
-import com.cloud.vm.VirtualMachineProfile;
-import com.cloud.vm.VirtualMachineProfileImpl;
 import com.cloud.vm.dao.DomainRouterDao;
 import com.cloud.vm.dao.NicDao;
 import com.cloud.vm.dao.UserVmDao;
 import com.cloud.vm.dao.VMInstanceDao;
 import edu.emory.mathcs.backport.java.util.Collections;
+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.log4j.Logger;
 
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+import java.net.URI;
+import java.security.InvalidParameterException;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.util.*;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
 
 /**
  * NetworkManagerImpl implements NetworkManager.
@@ -980,39 +942,6 @@
 
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_NET_IP_ASSIGN, eventDescription = "allocating Ip", create = true)
-    public IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId)
-            throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException {
-
-        if (networkId != null) {
-            Network network = _networksDao.findById(networkId);
-            if (network == null) {
-                throw new InvalidParameterValueException("Invalid network id is given");
-            }
-            if (network.getGuestType() == Network.GuestType.Shared) {
-                DataCenter zone = _configMgr.getZone(zoneId);
-                if (zone == null) {
-                    throw new InvalidParameterValueException("Invalid zone Id is given");
-                }
-
-                // 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());
-                    }
-                    return allocateIp(ipOwner, false, caller, 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 allocateIP(ipOwner, false,  zoneId);
-    }
-
     public IpAddress allocateIP(Account ipOwner, boolean isSystem, long zoneId)
             throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException {
         Account caller = UserContext.current().getCaller();
@@ -1022,11 +951,11 @@
 
         DataCenter zone = _configMgr.getZone(zoneId);
         
-        return allocateIp(ipOwner, isSystem, caller, zone);
+        return allocateIp(ipOwner, isSystem, caller, callerUserId, zone);
     }
 
     @DB
-    public IpAddress allocateIp(Account ipOwner, boolean isSystem, Account caller, DataCenter zone)
+    public IpAddress allocateIp(Account ipOwner, boolean isSystem, Account caller, long callerUserId, DataCenter zone) 
             throws ConcurrentOperationException, ResourceAllocationException,
             InsufficientAddressCapacityException {
 
@@ -1047,7 +976,7 @@
         Account accountToLock = null;
         try {
             if (s_logger.isDebugEnabled()) {
-                s_logger.debug("Associate IP address called by the user " + caller.getId());
+                s_logger.debug("Associate IP address called by the user " + callerUserId + " account " + ipOwner.getId());
             }
             accountToLock = _accountDao.acquireInLockTable(ipOwner.getId());
             if (accountToLock == null) {
@@ -1127,22 +1056,7 @@
 
         IPAddressVO ipToAssoc = _ipAddressDao.findById(ipId);
         if (ipToAssoc != null) {
-            Network network = _networksDao.findById(networkId);
-            if (network == null) {
-                throw new InvalidParameterValueException("Invalid network id is given");
-            }
-
-            DataCenter zone = _configMgr.getZone(network.getDataCenterId());
-            if (network.getGuestType() == Network.GuestType.Shared && zone.getNetworkType() == NetworkType.Advanced) {
-                if (isSharedNetworkOfferingWithServices(network.getNetworkOfferingId())) {
-                    _accountMgr.checkAccess(UserContext.current().getCaller(), AccessType.UseNetwork, false, network);
-                } else {
-                    throw new InvalidParameterValueException("IP can be associated with guest network of 'shared' type only if" +
-                        "network service Source Nat, Static Nat, Port Forwarding, Load balancing, firewall are enabled in the network");
-                }
-            } else {
-                _accountMgr.checkAccess(caller, null, true, ipToAssoc);
-            }
+            _accountMgr.checkAccess(caller, null, true, ipToAssoc);
             owner = _accountMgr.getAccount(ipToAssoc.getAllocatedToAccountId());
         } else {
             s_logger.debug("Unable to find ip address by id: " + ipId);
@@ -1169,20 +1083,16 @@
             throw new InvalidParameterValueException("Ip address can be associated to the network with trafficType " + TrafficType.Guest);
         }
 
-        // Check that network belongs to IP owner - skip this check
-        //     - if zone is basic zone as there is just one guest network,
-        //     - if shared network in Advanced zone
-        //     - and it belongs to the system
-        if (network.getAccountId() != owner.getId()) {
-            if (zone.getNetworkType() != NetworkType.Basic && !(zone.getNetworkType() == NetworkType.Advanced && network.getGuestType() == Network.GuestType.Shared)) {
-                throw new InvalidParameterValueException("The owner of the network is not the same as owner of the IP");
-            }
+        // Check that network belongs to IP owner - skip this check for Basic zone as there is just one guest network,
+        // and it belongs to the system
+        if (zone.getNetworkType() != NetworkType.Basic && network.getAccountId() != owner.getId()) {
+            throw new InvalidParameterValueException("The owner of the network is not the same as owner of the IP");
         }
 
-        // In Advance zone only allow to do IP assoc
-        //      - for Isolated networks with source nat service enabled
-        //      - for shared networks with source nat service enabled
-        if (zone.getNetworkType() == NetworkType.Advanced && (!areServicesSupportedInNetwork(network.getId(), Service.SourceNat))) {
+        // In Advance zone only allow to do IP assoc for Isolated networks with source nat service enabled
+        if (zone.getNetworkType() == NetworkType.Advanced &&
+            !(network.getGuestType() == GuestType.Isolated && areServicesSupportedInNetwork(network.getId(),
+                Service.SourceNat))) {
             throw new InvalidParameterValueException("In zone of type " + NetworkType.Advanced +
                     " ip address can be associated only to the network of guest type " + GuestType.Isolated + " with the "
                     + Service.SourceNat.getName() + " enabled");
@@ -1953,21 +1863,12 @@
         try {
             NetworkGuru guru = _networkGurus.get(network.getGuruName());
             Network.State state = network.getState();
-            if (state == Network.State.Implemented || state == Network.State.Implementing) {
+            if (state == Network.State.Implemented || state == Network.State.Setup || state == Network.State.Implementing) {
                 s_logger.debug("Network id=" + networkId + " is already implemented");
                 implemented.set(guru, network);
                 return implemented;
             }
 
-            if (state == Network.State.Setup) {
-                DataCenterVO zone = _dcDao.findById(network.getDataCenterId());
-                if (!isSharedNetworkOfferingWithServices(network.getNetworkOfferingId()) || (zone.getNetworkType() == NetworkType.Basic)) {
-                    s_logger.debug("Network id=" + networkId + " is already implemented");
-                    implemented.set(guru, network);
-                    return implemented;
-                }
-            }
-
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug("Asking " + guru.getName() + " to implement " + network);
             }
@@ -2011,25 +1912,19 @@
         }
     }
 
-    @Override
-    public boolean equals(Object o) {
-        return super.equals(o);    //To change body of overridden methods use File | Settings | File Templates.
-    }
-
     private void implementNetworkElementsAndResources(DeployDestination dest, ReservationContext context,
                                                       NetworkVO network, NetworkOfferingVO offering)
             throws ConcurrentOperationException, InsufficientAddressCapacityException, ResourceUnavailableException, InsufficientCapacityException {
 
-        // Associate a source NAT IP (if one isn't already associated with the network) if this is a
-        //     1) 'Isolated' or 'Shared' guest virtual network in the advance zone
-        //     2) network has sourceNat service
-        //     3) network offering does not support a shared source NAT rule
+        // If this is a 1) guest virtual network 2) network has sourceNat service 3) network offering does not support a
+        // Shared source NAT rule,
+        // associate a source NAT IP (if one isn't already associated with the network)
 
         boolean sharedSourceNat = offering.getSharedSourceNat();
         DataCenter zone = _dcDao.findById(network.getDataCenterId());
-        if (!sharedSourceNat && areServicesSupportedInNetwork(network.getId(), Service.SourceNat)
-                && (network.getGuestType() == Network.GuestType.Isolated ||
-                (network.getGuestType() == Network.GuestType.Shared && zone.getNetworkType() == NetworkType.Advanced))) {
+        if (network.getGuestType() == Network.GuestType.Isolated
+                && areServicesSupportedInNetwork(network.getId(), Service.SourceNat)
+                && !sharedSourceNat) {
 
             List<IPAddressVO> ips = null;
             if (network.getVpcId() != null) {
@@ -2442,6 +2337,12 @@
     }
 
     @Override
+    @DB
+    public Network getNetwork(String uuid) {
+        return _networksDao.findByUuid(uuid);
+    }
+
+    @Override
     public List<? extends RemoteAccessVPNServiceProvider> getRemoteAccessVpnElements() {
         List<RemoteAccessVPNServiceProvider> elements = new ArrayList<RemoteAccessVPNServiceProvider>();
         for (NetworkElement element : _networkElements) {
@@ -2504,82 +2405,6 @@
         }
     }
 
-    private void checkSharedNetworkCidrOverlap(Long zoneId, long physicalNetworkId, String cidr) {
-        if (zoneId == null || cidr == null) {
-            return;
-        }
-
-        DataCenter zone = _dcDao.findById(zoneId);
-        List<NetworkVO> networks = _networksDao.listByZone(zoneId);
-        Map<Long, String> networkToCidr = new HashMap<Long, String>();
-
-        // check for CIDR overlap with all possible CIDR for isolated guest networks
-        // in the zone when using external networking
-        PhysicalNetworkVO pNetwork = _physicalNetworkDao.findById(physicalNetworkId);
-        if (pNetwork.getVnet() != null) {
-            String vlanRange[] = pNetwork.getVnet().split("-");
-            int lowestVlanTag = Integer.valueOf(vlanRange[0]);
-            int highestVlanTag = Integer.valueOf(vlanRange[1]);
-            for (int vlan=lowestVlanTag; vlan <= highestVlanTag; ++vlan) {
-                int offset = vlan - lowestVlanTag;
-                String globalVlanBits = _configDao.getValue(Config.GuestVlanBits.key());
-                int cidrSize = 8 + Integer.parseInt(globalVlanBits);
-                String guestNetworkCidr = zone.getGuestNetworkCidr();
-                String[] cidrTuple = guestNetworkCidr.split("\\/");
-                long newCidrAddress = (NetUtils.ip2Long(cidrTuple[0]) & 0xff000000) | (offset << (32 - cidrSize));
-                if (NetUtils.isNetworksOverlap(NetUtils.long2Ip(newCidrAddress), cidr)) {
-                    throw new InvalidParameterValueException("Specified CIDR for shared network conflict with CIDR that is reserved for zone vlan " + vlan);
-                }
-            }
-        }
-
-        // check for CIDR overlap with all CIDR's of the shared networks in the zone
-        for (NetworkVO network : networks) {
-            if (network.getGuestType() == GuestType.Isolated) {
-                continue;
-            }
-            if (network.getCidr() != null) {
-                networkToCidr.put(network.getId(), network.getCidr());
-            }
-        }
-        if (networkToCidr != null && !networkToCidr.isEmpty()) {
-            for (long networkId : networkToCidr.keySet()) {
-                String ntwkCidr = networkToCidr.get(networkId);
-                if (NetUtils.isNetworksOverlap(ntwkCidr, cidr)) {
-                    throw new InvalidParameterValueException("Specified CIDR for shared network conflict with CIDR of a shared network in the zone.");
-                }
-            }
-        }
-    }
-        public void checkVirtualNetworkCidrOverlap(Long zoneId, String cidr) {
-        if (zoneId == null) {
-            return;
-        }
-        if (cidr == null) {
-            return;
-        }
-        List<NetworkVO> networks = _networksDao.listByZone(zoneId);
-        Map<Long, String> networkToCidr = new HashMap<Long, String>();
-        for (NetworkVO network : networks) {
-            if (network.getGuestType() != GuestType.Isolated) {
-                continue;
-            }
-            if (network.getCidr() != null) {
-                networkToCidr.put(network.getId(), network.getCidr());
-            }
-        }
-        if (networkToCidr == null || networkToCidr.isEmpty()) {
-            return;
-        }
-
-        for (long networkId : networkToCidr.keySet()) {
-            String ntwkCidr = networkToCidr.get(networkId);
-            if (NetUtils.isNetworksOverlap(ntwkCidr, cidr)) {
-                throw new InvalidParameterValueException("Warning: The specified existing network has conflict CIDR subnets with new network!");
-            }
-        }
-    }
-
     @Override
     @DB
     @ActionEvent(eventType = EventTypes.EVENT_NETWORK_CREATE, eventDescription = "creating network")
@@ -2775,16 +2600,9 @@
 
         Collection<String> ntwkProviders = finalizeServicesAndProvidersForNetwork(ntwkOff, physicalNetworkId).values();
         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!");
-            }
+            throw new InvalidParameterValueException("Cannot specify CIDR when using network offering with external devices!");
         }
 
-
         // Vlan is created in 2 cases - works in Advance zone only:
         // 1) GuestType is Shared
         // 2) GuestType is Isolated, but SourceNat service is disabled
@@ -2967,11 +2785,10 @@
                 throw new InvalidParameterValueException("Network with vlan " + vlanId + " already exists in zone " + zoneId);
             }
             } else {
-                //don't allow to creating shared network with given Vlan ID, if there already exists a isolated network or
-                //shared network with same Vlan ID in the zone
-                if (_networksDao.countByZoneUriAndGuestType(zoneId, uri, GuestType.Isolated) > 0 ||
-                        _networksDao.countByZoneUriAndGuestType(zoneId, uri, GuestType.Shared) > 0) {
-                    throw new InvalidParameterValueException("There is a isolated/shared network with vlan id: " + vlanId + " already exists " + "in zone " + zoneId);
+                //don't allow to create Shared network with Vlan that already exists in the zone for Isolated networks
+                if (_networksDao.countByZoneUriAndGuestType(zoneId, uri, GuestType.Isolated) > 0) {
+                    throw new InvalidParameterValueException("Isolated network with vlan " + vlanId + " already exists " +
+                            "in zone " + zoneId);
                 }
         }
         }
@@ -3559,13 +3376,7 @@
 
             applyProfileToNetwork(network, profile);
 
-            DataCenterVO zone = _dcDao.findById(network.getDataCenterId());
-            if (isSharedNetworkOfferingWithServices(network.getNetworkOfferingId()) && (zone.getNetworkType() == NetworkType.Advanced)) {
-                network.setState(Network.State.Setup);
-            } else {
-                network.setState(Network.State.Allocated);
-            }
-
+            network.setState(Network.State.Allocated);
             network.setRestartRequired(false);
             _networksDao.update(network.getId(), network);
             _networksDao.clearCheckForGc(networkId);
@@ -4511,19 +4322,6 @@
         return false;
     }
 
-    public boolean isSharedNetworkOfferingWithServices(long networkOfferingId) {
-        NetworkOfferingVO networkOffering = _networkOfferingDao.findById(networkOfferingId);
-        if ( (networkOffering.getGuestType()  == Network.GuestType.Shared) && (
-                areServicesSupportedByNetworkOffering(networkOfferingId, Service.SourceNat) ||
-                areServicesSupportedByNetworkOffering(networkOfferingId, Service.StaticNat) ||
-                areServicesSupportedByNetworkOffering(networkOfferingId, Service.Firewall) ||
-                areServicesSupportedByNetworkOffering(networkOfferingId, Service.PortForwarding) ||
-                areServicesSupportedByNetworkOffering(networkOfferingId, Service.Lb))) {
-            return true;
-        }
-        return false;
-    }
-
     @Override
     public boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service... services) {
         return (_ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(networkOfferingId, services));
diff --git a/server/src/com/cloud/network/element/VirtualRouterElement.java b/server/src/com/cloud/network/element/VirtualRouterElement.java
index b5b8b1a..02a239e 100755
--- a/server/src/com/cloud/network/element/VirtualRouterElement.java
+++ b/server/src/com/cloud/network/element/VirtualRouterElement.java
@@ -24,7 +24,9 @@
 
 import javax.ejb.Local;
 
+import com.cloud.utils.PropertiesUtil;
 import org.apache.cloudstack.api.command.admin.router.ConfigureVirtualRouterElementCmd;
+import org.apache.cloudstack.api.command.admin.router.CreateVirtualRouterElementCmd;
 import org.apache.cloudstack.api.command.admin.router.ListVirtualRouterElementsCmd;
 import org.apache.log4j.Logger;
 
@@ -680,8 +682,12 @@
     }
 
     @Override
-    public String[] getPropertiesFiles() {
-        return new String[] { "virtualrouter_commands.properties" };
+    public List<Class<?>> getCommands() {
+        List<Class<?>> cmdList = new ArrayList<Class<?>>();
+        cmdList.add(CreateVirtualRouterElementCmd.class);
+        cmdList.add(ConfigureVirtualRouterElementCmd.class);
+        cmdList.add(ListVirtualRouterElementsCmd.class);
+        return cmdList;
     }
 
     @Override
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index 1a6eb09..717da05 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -823,26 +823,29 @@
                     String privateIP = router.getPrivateIpAddress();
 
                     if (privateIP != null) {
+                        boolean forVpc = router.getVpcId() != null;
                         List<? extends Nic> routerNics = _nicDao.listByVmId(router.getId());
                         for (Nic routerNic : routerNics) {
                             Network network = _networkMgr.getNetwork(routerNic.getNetworkId());
-                            if (network.getTrafficType() == TrafficType.Public) {
-                                boolean forVpc = router.getVpcId() != null;
+                            //Send network usage command for public nic in VPC VR
+                            //Send network usage command for isolated guest nic of non VPC VR                            
+                            if ((forVpc && network.getTrafficType() == TrafficType.Public) || (!forVpc && network.getTrafficType() == TrafficType.Guest && network.getGuestType() == Network.GuestType.Isolated)) {
                                 final NetworkUsageCommand usageCmd = new NetworkUsageCommand(privateIP, router.getHostName(),
                                         forVpc, routerNic.getIp4Address());
-                                UserStatisticsVO previousStats = _statsDao.findBy(router.getAccountId(), 
-                                        router.getDataCenterIdToDeployIn(), network.getId(), null, router.getId(), router.getType().toString());
+                                String routerType = router.getType().toString();
+                                UserStatisticsVO previousStats = _statsDao.findBy(router.getAccountId(),
+                                        router.getDataCenterIdToDeployIn(), network.getId(), (forVpc ? routerNic.getIp4Address() : null), router.getId(), routerType);
                                 NetworkUsageAnswer answer = null;
                                 try {
                                     answer = (NetworkUsageAnswer) _agentMgr.easySend(router.getHostId(), usageCmd);
                                 } catch (Exception e) {
-                                    s_logger.warn("Error while collecting network stats from router: "+router.getInstanceName()+" from host: "+router.getHostId(), e);
+                                    s_logger.warn("Error while collecting network stats from router: " + router.getInstanceName() + " from host: " + router.getHostId(), e);
                                     continue;
                                 }
 
                                 if (answer != null) {
                                     if (!answer.getResult()) {
-                                        s_logger.warn("Error while collecting network stats from router: "+router.getInstanceName()+" from host: "+router.getHostId() + "; details: " + answer.getDetails());
+                                        s_logger.warn("Error while collecting network stats from router: " + router.getInstanceName() + " from host: " + router.getHostId() + "; details: " + answer.getDetails());
                                         continue;
                                     }
                                     Transaction txn = Transaction.open(Transaction.CLOUD_DB);
@@ -852,27 +855,27 @@
                                             continue;
                                         }
                                         txn.start();
-                                        UserStatisticsVO stats = _statsDao.lock(router.getAccountId(), 
-                                                router.getDataCenterIdToDeployIn(), network.getId(), routerNic.getIp4Address(), router.getId(), router.getType().toString());
+                                        UserStatisticsVO stats = _statsDao.lock(router.getAccountId(),
+                                                router.getDataCenterIdToDeployIn(), network.getId(), (forVpc ? routerNic.getIp4Address() : null), router.getId(), routerType);
                                         if (stats == null) {
                                             s_logger.warn("unable to find stats for account: " + router.getAccountId());
                                             continue;
                                         }
 
-                                        if(previousStats != null 
-                                                && ((previousStats.getCurrentBytesReceived() != stats.getCurrentBytesReceived()) 
-                                                        || (previousStats.getCurrentBytesSent() != stats.getCurrentBytesSent()))){
+                                        if (previousStats != null
+                                                && ((previousStats.getCurrentBytesReceived() != stats.getCurrentBytesReceived())
+                                                || (previousStats.getCurrentBytesSent() != stats.getCurrentBytesSent()))) {
                                             s_logger.debug("Router stats changed from the time NetworkUsageCommand was sent. " +
-                                                    "Ignoring current answer. Router: "+answer.getRouterName()+" Rcvd: " + 
-                                                    answer.getBytesReceived()+ "Sent: " +answer.getBytesSent());
+                                                    "Ignoring current answer. Router: " + answer.getRouterName() + " Rcvd: " +
+                                                    answer.getBytesReceived() + "Sent: " + answer.getBytesSent());
                                             continue;
                                         }
 
                                         if (stats.getCurrentBytesReceived() > answer.getBytesReceived()) {
                                             if (s_logger.isDebugEnabled()) {
                                                 s_logger.debug("Received # of bytes that's less than the last one.  " +
-                                                        "Assuming something went wrong and persisting it. Router: " + 
-                                                        answer.getRouterName()+" Reported: " + answer.getBytesReceived()
+                                                        "Assuming something went wrong and persisting it. Router: " +
+                                                        answer.getRouterName() + " Reported: " + answer.getBytesReceived()
                                                         + " Stored: " + stats.getCurrentBytesReceived());
                                             }
                                             stats.setNetBytesReceived(stats.getNetBytesReceived() + stats.getCurrentBytesReceived());
@@ -881,8 +884,8 @@
                                         if (stats.getCurrentBytesSent() > answer.getBytesSent()) {
                                             if (s_logger.isDebugEnabled()) {
                                                 s_logger.debug("Received # of bytes that's less than the last one.  " +
-                                                        "Assuming something went wrong and persisting it. Router: " + 
-                                                        answer.getRouterName()+" Reported: " + answer.getBytesSent()
+                                                        "Assuming something went wrong and persisting it. Router: " +
+                                                        answer.getRouterName() + " Reported: " + answer.getBytesSent()
                                                         + " Stored: " + stats.getCurrentBytesSent());
                                             }
                                             stats.setNetBytesSent(stats.getNetBytesSent() + stats.getCurrentBytesSent());
@@ -1378,9 +1381,7 @@
             assert guestNetwork.getTrafficType() == TrafficType.Guest;
         
             // 1) Get deployment plan and find out the list of routers
-            boolean isPodBased = (dest.getDataCenter().getNetworkType() == NetworkType.Basic ||
-                    _networkMgr.areServicesSupportedInNetwork(guestNetwork.getId(), Service.SecurityGroup))
-                    && guestNetwork.getTrafficType() == TrafficType.Guest;
+            boolean isPodBased = (dest.getDataCenter().getNetworkType() == NetworkType.Basic);
 
             // dest has pod=null, for Basic Zone findOrDeployVRs for all Pods
             List<DeployDestination> destinations = new ArrayList<DeployDestination>();
@@ -1468,31 +1469,15 @@
                     offeringId = _offering.getId();
                 }
 
+                PublicIp sourceNatIp = null;
+                if (publicNetwork) {
+                    sourceNatIp = _networkMgr.assignSourceNatIpAddressToGuestNetwork(owner, guestNetwork);
+                }
+
                 // 3) deploy virtual router(s)
                 int count = routerCount - routers.size();
                 DeploymentPlan plan = planAndRouters.first();
                 for (int i = 0; i < count; i++) {
-                    PublicIp sourceNatIp = null;
-                    if (publicNetwork) {
-                        int failCount = 0;
-                        // Generate different MAC for VR
-                        while (sourceNatIp == null) {
-                            sourceNatIp = _networkMgr.assignSourceNatIpAddressToGuestNetwork(owner, guestNetwork);
-                            NicVO nic = _nicDao.findByMacAddress(sourceNatIp.getMacAddress());
-                            // We got duplicate MAC here, so regenerate the mac
-                            if (nic != null) {
-                                s_logger.debug("Failed to find a different mac for redundant router. Try again. The current mac is " + sourceNatIp.getMacAddress());
-                                sourceNatIp = null;
-                                failCount ++;
-                            }
-                            //Prevent infinite loop
-                            if (failCount > 3) {
-                                s_logger.error("Failed to find a different mac for redundant router! Abort operation!");
-                                throw new InsufficientAddressCapacityException("Failed to find a different mac for redundant router", null, offeringId);
-                            }
-                        }
-                    }
-                    
                     List<Pair<NetworkVO, NicProfile>> networks = createRouterNetworks(owner, isRedundant, plan, guestNetwork,
                             new Pair<Boolean, PublicIp>(publicNetwork, sourceNatIp));
                     //don't start the router as we are holding the network lock that needs to be released at the end of router allocation
@@ -1714,6 +1699,13 @@
             }
             NetworkOfferingVO publicOffering = _networkMgr.getSystemAccountNetworkOfferings(NetworkOfferingVO.SystemPublicNetwork).get(0);
             List<NetworkVO> publicNetworks = _networkMgr.setupNetwork(_systemAcct, publicOffering, plan, null, null, false);
+            String publicIp = defaultNic.getIp4Address();
+            // We want to use the identical MAC address for RvR on public interface if possible
+            NicVO peerNic = _nicDao.findByIp4AddressAndNetworkId(publicIp, publicNetworks.get(0).getId());
+            if (peerNic != null) {
+                s_logger.info("Use same MAC as previous RvR, the MAC is " + peerNic.getMacAddress());
+                defaultNic.setMacAddress(peerNic.getMacAddress());
+            }
             networks.add(new Pair<NetworkVO, NicProfile>(publicNetworks.get(0), defaultNic));
         }
 
diff --git a/server/src/com/cloud/network/rules/RulesManagerImpl.java b/server/src/com/cloud/network/rules/RulesManagerImpl.java
index dd09174..a75aca3 100755
--- a/server/src/com/cloud/network/rules/RulesManagerImpl.java
+++ b/server/src/com/cloud/network/rules/RulesManagerImpl.java
@@ -16,18 +16,6 @@
 // under the License.
 package com.cloud.network.rules;
 
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.ejb.Local;
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.api.command.user.firewall.ListPortForwardingRulesCmd;
-import org.apache.log4j.Logger;
-
 import com.cloud.configuration.ConfigurationManager;
 import com.cloud.domain.dao.DomainDao;
 import com.cloud.event.ActionEvent;
@@ -65,13 +53,8 @@
 import com.cloud.utils.Ternary;
 import com.cloud.utils.component.Inject;
 import com.cloud.utils.component.Manager;
-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.*;
 import com.cloud.utils.db.SearchCriteria.Op;
-import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.Ip;
 import com.cloud.vm.Nic;
@@ -80,6 +63,7 @@
 import com.cloud.vm.VirtualMachine.Type;
 import com.cloud.vm.dao.NicDao;
 import com.cloud.vm.dao.UserVmDao;
+import org.apache.cloudstack.api.command.user.firewall.ListPortForwardingRulesCmd;
 import org.apache.log4j.Logger;
 
 import javax.ejb.Local;
@@ -1189,12 +1173,11 @@
         Network guestNetwork = _networkMgr.getNetwork(ipAddress.getAssociatedWithNetworkId());
         NetworkOffering offering = _configMgr.getNetworkOffering(guestNetwork.getNetworkOfferingId());
         if (offering.getElasticIp()) {
-            if (offering.getAssociatePublicIP()) {
-                getSystemIpAndEnableStaticNatForVm(_vmDao.findById(vmId), true);
-                return true;
-            }
+            getSystemIpAndEnableStaticNatForVm(_vmDao.findById(vmId), true);
+            return true;
+        } else {
+            return disableStaticNat(ipId, caller, ctx.getCallerUserId(), false);
         }
-        return disableStaticNat(ipId, caller, ctx.getCallerUserId(), false);
     }
 
     @Override
@@ -1380,11 +1363,6 @@
             Network guestNetwork = _networkMgr.getNetwork(nic.getNetworkId());
             NetworkOffering offering = _configMgr.getNetworkOffering(guestNetwork.getNetworkOfferingId());
             if (offering.getElasticIp()) {
-                boolean isSystemVM = (vm.getType() == Type.ConsoleProxy || vm.getType() == Type.SecondaryStorageVm);
-                // for user VM's associate public IP only if offering is marked to associate a public IP by default on start of VM
-                if (!isSystemVM && !offering.getAssociatePublicIP()) {
-                    continue;
-                }
                 // check if there is already static nat enabled
                 if (_ipAddressDao.findByAssociatedVmId(vm.getId()) != null && !getNewIp) {
                     s_logger.debug("Vm " + vm + " already has ip associated with it in guest network " + guestNetwork);
@@ -1399,6 +1377,7 @@
 
                 s_logger.debug("Allocated system ip " + ip + ", now enabling static nat on it for vm " + vm);
 
+                boolean isSystemVM = (vm.getType() == Type.ConsoleProxy || vm.getType() == Type.SecondaryStorageVm);
                 try {
                     success = enableStaticNat(ip.getId(), vm.getId(), guestNetwork.getId(), isSystemVM);
                 } catch (NetworkRuleConflictException ex) {
diff --git a/server/src/com/cloud/offerings/NetworkOfferingVO.java b/server/src/com/cloud/offerings/NetworkOfferingVO.java
index 8de93d8..efaca76 100755
--- a/server/src/com/cloud/offerings/NetworkOfferingVO.java
+++ b/server/src/com/cloud/offerings/NetworkOfferingVO.java
@@ -16,26 +16,10 @@
 // under the License.
 package com.cloud.offerings;
 
-import com.cloud.network.Networks;
-
-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.network.Network;
 import com.cloud.network.Networks.TrafficType;
 import com.cloud.offering.NetworkOffering;
 import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
 
 import javax.persistence.*;
 import java.util.Date;
@@ -129,9 +113,6 @@
     @Column(name = "elastic_lb_service")
     boolean elasticLb;
 
-    @Column(name = "eip_associate_public_ip")
-    boolean eipAssociatePublicIp;
-
     @Column(name = "inline")
     boolean inline;
 
@@ -295,21 +276,19 @@
         this.redundantRouter = false;
         this.elasticIp = false;
         this.elasticLb = false;
-        this.eipAssociatePublicIp = true;
         this.inline = false;
         this.specifyIpRanges = specifyIpRanges;
     }
 
     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 associatePublicIP, boolean specifyIpRanges, boolean inline) {
+            boolean specifyIpRanges, boolean inline) {
         this(name, displayText, trafficType, systemOnly, specifyVlan, rateMbps, multicastRateMbps, isDefault, availability, tags, guestType, conserveMode, specifyIpRanges);
         this.dedicatedLB = dedicatedLb;
         this.sharedSourceNat = sharedSourceNat;
         this.redundantRouter = redundantRouter;
         this.elasticIp = elasticIp;
         this.elasticLb = elasticLb;
-        this.eipAssociatePublicIp = associatePublicIP;
         this.inline = inline;
     }
 
@@ -373,11 +352,6 @@
     }
 
     @Override
-    public boolean getAssociatePublicIP() {
-        return eipAssociatePublicIp;
-    }
-
-    @Override
     public boolean getElasticLb() {
         return elasticLb;
     }
diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java
index af5989c..5d24628 100755
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -70,7 +70,6 @@
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.NetUtils;
 import com.cloud.utils.script.Script;
-import com.cloud.uuididentity.dao.IdentityDao;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.log4j.Logger;
 
@@ -103,7 +102,6 @@
     private final AccountDao _accountDao;
     private final ResourceCountDao _resourceCountDao;
     private final NetworkOfferingServiceMapDao _ntwkOfferingServiceMapDao;
-    private final IdentityDao _identityDao;
 
     public ConfigurationServerImpl() {
         ComponentLocator locator = ComponentLocator.getLocator(Name);
@@ -120,7 +118,6 @@
         _accountDao = locator.getDao(AccountDao.class);
         _resourceCountDao = locator.getDao(ResourceCountDao.class);
         _ntwkOfferingServiceMapDao = locator.getDao(NetworkOfferingServiceMapDao.class);
-        _identityDao = locator.getDao(IdentityDao.class);
     }
 
     @Override
@@ -551,7 +548,7 @@
 
         String username = System.getProperty("user.name");
         Boolean devel = Boolean.valueOf(_configDao.getValue("developer"));
-        if (!username.equalsIgnoreCase("cloud") || !devel) {
+        if (!username.equalsIgnoreCase("cloud") && !devel) {
             s_logger.warn("Systemvm keypairs could not be set. Management server should be run as cloud user, or in development mode.");
             return;
         }
@@ -974,7 +971,7 @@
                 "Offering for Shared networks with Elastic IP and Elastic LB capabilities",
                 TrafficType.Guest,
                 false, true, null, null, true, Availability.Optional,
-                null, Network.GuestType.Shared, true, false, false, false, true, true, true, true, false);
+                null, Network.GuestType.Shared, true, false, false, false, true, true, true, false);
 
         defaultNetscalerNetworkOffering.setState(NetworkOffering.State.Enabled);
         defaultNetscalerNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultNetscalerNetworkOffering);
diff --git a/server/src/com/cloud/server/ManagementServerExtImpl.java b/server/src/com/cloud/server/ManagementServerExtImpl.java
index b732027..c8c188b 100644
--- a/server/src/com/cloud/server/ManagementServerExtImpl.java
+++ b/server/src/com/cloud/server/ManagementServerExtImpl.java
@@ -29,6 +29,7 @@
 import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.exception.PermissionDeniedException;
 import com.cloud.projects.Project;
+import com.cloud.utils.PropertiesUtil;
 import org.apache.cloudstack.api.response.UsageTypeResponse;
 import com.cloud.usage.UsageJobVO;
 import com.cloud.usage.UsageTypes;
@@ -206,8 +207,9 @@
     }
 
     @Override
-    public String[] getPropertiesFiles() {
-        return new String[] { "commands.properties", "commands-ext.properties" };
+    public List<Class<?>> getCommands() {
+        //TODO: Add api cmd classes
+        return null;
     }
 
     private Date computeAdjustedTime(Date initialDate, TimeZone targetTZ, boolean adjustToDayStart) {
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index dcecaf4..4efae63 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -223,6 +223,7 @@
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
 import com.cloud.utils.PasswordGenerator;
+import com.cloud.utils.PropertiesUtil;
 import com.cloud.utils.Ternary;
 import com.cloud.utils.component.Adapters;
 import com.cloud.utils.component.ComponentLocator;
@@ -759,7 +760,6 @@
             sc.addAnd("vm_type", SearchCriteria.Op.EQ, vmTypeStr);
         }
 
-        sc.addAnd("systemUse", SearchCriteria.Op.EQ, isSystem);
         sc.addAnd("removed", SearchCriteria.Op.NULL);
         return _offeringsDao.search(sc, searchFilter);
 
@@ -2297,8 +2297,9 @@
     }
 
     @Override
-    public String[] getPropertiesFiles() {
-        return new String[] { "commands.properties" };
+    public List<Class<?>> getCommands() {
+        //TODO: Add cmd classes
+        return null;
     }
 
     protected class EventPurgeTask implements Runnable {
diff --git a/server/src/com/cloud/servlet/CloudStartupServlet.java b/server/src/com/cloud/servlet/CloudStartupServlet.java
index 389bd26..484c7bf 100755
--- a/server/src/com/cloud/servlet/CloudStartupServlet.java
+++ b/server/src/com/cloud/servlet/CloudStartupServlet.java
@@ -48,7 +48,7 @@
 	    	s_locator = ComponentLocator.getLocator(ManagementServer.Name);
 		    ManagementServer ms = (ManagementServer)ComponentLocator.getComponent(ManagementServer.Name);
 		    ms.enableAdminUser("password");
-		    ApiServer.initApiServer(ms.getPropertiesFiles());
+		    ApiServer.initApiServer();
 	    } catch (InvalidParameterValueException ipve) {
 	    	s_logger.error("Exception starting management server ", ipve);
 	    	throw new ServletException (ipve.getMessage());
diff --git a/server/src/com/cloud/upgrade/dao/Upgrade40to41.java b/server/src/com/cloud/upgrade/dao/Upgrade40to41.java
index e23837d..cd9e20c 100644
--- a/server/src/com/cloud/upgrade/dao/Upgrade40to41.java
+++ b/server/src/com/cloud/upgrade/dao/Upgrade40to41.java
@@ -22,12 +22,6 @@
 
 import java.io.File;
 import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
 
 /**
  * @author htrippaers
@@ -84,7 +78,7 @@
 	 */
 	@Override
 	public void performDataMigration(Connection conn) {
-        upgradeEIPNetworkOfferings(conn);
+
 	}
 
 	/* (non-Javadoc)
@@ -95,36 +89,4 @@
 		return new File[0];
 	}
 
-    private void upgradeEIPNetworkOfferings(Connection conn) {
-        PreparedStatement pstmt = null;
-        ResultSet rs = null;
-
-        try {
-            pstmt = conn.prepareStatement("select id, elastic_ip_service from `cloud`.`network_offerings` where traffic_type='Guest'");
-            rs = pstmt.executeQuery();
-            while (rs.next()) {
-                long id = rs.getLong(1);
-                // check if elastic IP service is enabled for network offering
-                if (rs.getLong(2) != 0) {
-                    //update network offering with eip_associate_public_ip set to true
-                    pstmt = conn.prepareStatement("UPDATE `cloud`.`network_offerings` set eip_associate_public_ip=? where id=?");
-                    pstmt.setBoolean(1, true);
-                    pstmt.setLong(2, id);
-                    pstmt.executeUpdate();
-                }
-            }
-        } catch (SQLException e) {
-            throw new CloudRuntimeException("Unable to set elastic_ip_service for network offerings with EIP service enabled.", e);
-        } finally {
-            try {
-                if (rs != null) {
-                    rs.close();
-                }
-                if (pstmt != null) {
-                    pstmt.close();
-                }
-            } catch (SQLException e) {
-            }
-        }
-    }
 }
diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java
index c6a7d51..b910a03 100755
--- a/server/src/com/cloud/user/AccountManagerImpl.java
+++ b/server/src/com/cloud/user/AccountManagerImpl.java
@@ -37,6 +37,7 @@
 import javax.naming.ConfigurationException;
 
 import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.acl.SecurityChecker;
 import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd;
 import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
@@ -1543,6 +1544,31 @@
     }
 
     @Override
+    public RoleType getRoleType(Account account) {
+        RoleType roleType = RoleType.Unknown;
+        if (account == null)
+            return roleType;
+        short accountType = account.getType();
+
+        // Account type to role type translation
+        switch (accountType) {
+            case Account.ACCOUNT_TYPE_ADMIN:
+                roleType = RoleType.Admin;
+                break;
+            case Account.ACCOUNT_TYPE_DOMAIN_ADMIN:
+                roleType = RoleType.DomainAdmin;
+                break;
+            case Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN:
+                roleType = RoleType.ResourceAdmin;
+                break;
+            case Account.ACCOUNT_TYPE_NORMAL:
+                roleType = RoleType.User;
+                break;
+        }
+        return roleType;
+    }
+
+    @Override
     public User getActiveUser(long userId) {
         return _userDao.findById(userId);
     }
diff --git a/server/src/com/cloud/user/DomainManagerImpl.java b/server/src/com/cloud/user/DomainManagerImpl.java
index 123b895..54ca2ac 100644
--- a/server/src/com/cloud/user/DomainManagerImpl.java
+++ b/server/src/com/cloud/user/DomainManagerImpl.java
@@ -86,6 +86,11 @@
     }
 
     @Override
+    public Domain getDomain(String domainUuid) {
+        return _domainDao.findByUuid(domainUuid);
+    }
+
+    @Override
     public String getName() {
         return _name;
     }
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index f3aca68..a6fbdb1 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -16,32 +16,6 @@
 // under the License.
 package com.cloud.vm;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-import javax.ejb.Local;
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.api.command.user.template.CreateTemplateCmd;
-import org.apache.cloudstack.api.command.user.vm.*;
-import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
-import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
-import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
-import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.acl.ControlledEntity.ACLType;
-import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.*;
 import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer;
@@ -53,17 +27,6 @@
 import com.cloud.api.ApiDBUtils;
 import com.cloud.api.query.dao.UserVmJoinDao;
 import com.cloud.api.query.vo.UserVmJoinVO;
-
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
-import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
-import org.apache.cloudstack.api.command.user.vm.DestroyVMCmd;
-import org.apache.cloudstack.api.command.user.vm.RebootVMCmd;
-import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
-import org.apache.cloudstack.api.command.user.vm.ResetVMPasswordCmd;
-import org.apache.cloudstack.api.command.user.vm.RestoreVMCmd;
-import org.apache.cloudstack.api.command.user.vm.UpdateVMCmd;
-import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
 import com.cloud.async.AsyncJobExecutor;
 import com.cloud.async.AsyncJobManager;
 import com.cloud.async.AsyncJobVO;
@@ -151,12 +114,7 @@
 import com.cloud.utils.component.Manager;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.crypt.RSAHelper;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.Filter;
-import com.cloud.utils.db.GlobalLock;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.*;
 import com.cloud.utils.db.SearchCriteria.Func;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.exception.ExecutionException;
@@ -164,6 +122,26 @@
 import com.cloud.utils.net.NetUtils;
 import com.cloud.vm.VirtualMachine.State;
 import com.cloud.vm.dao.*;
+import org.apache.cloudstack.acl.ControlledEntity.ACLType;
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
+import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
+import org.apache.cloudstack.api.command.user.template.CreateTemplateCmd;
+import org.apache.cloudstack.api.command.user.vm.*;
+import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
+import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
+import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
+import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.log4j.Logger;
+
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+import java.util.*;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
 
 @Local(value = { UserVmManager.class, UserVmService.class })
 public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager {
@@ -2788,10 +2766,6 @@
         if (ip != null && ip.getSystem()) {
             UserContext ctx = UserContext.current();
             try {
-                long networkId = ip.getAssociatedWithNetworkId();
-                Network guestNetwork = _networkMgr.getNetwork(networkId);
-                NetworkOffering offering = _configMgr.getNetworkOffering(guestNetwork.getNetworkOfferingId());
-                assert (offering.getAssociatePublicIP() == true) : "User VM should not have system owned public IP associated with it when offering configured not to associate public IP.";
                 _rulesMgr.disableStaticNat(ip.getId(), ctx.getCaller(), ctx.getCallerUserId(), true);
             } catch (Exception ex) {
                 s_logger.warn("Failed to disable static nat and release system ip " + ip + " as a part of vm " + profile.getVirtualMachine() + " stop due to exception ", ex);
diff --git a/server/src/com/cloud/vm/dao/NicDao.java b/server/src/com/cloud/vm/dao/NicDao.java
index af3c7b3..762048b 100644
--- a/server/src/com/cloud/vm/dao/NicDao.java
+++ b/server/src/com/cloud/vm/dao/NicDao.java
@@ -58,6 +58,4 @@
     NicVO findByNetworkIdInstanceIdAndBroadcastUri(long networkId, long instanceId, String broadcastUri);
     
     NicVO findByIp4AddressAndNetworkIdAndInstanceId(long networkId, long instanceId, String ip4Address);
-
-    NicVO findByMacAddress(String macAddress);
 }
diff --git a/server/src/com/cloud/vm/dao/NicDaoImpl.java b/server/src/com/cloud/vm/dao/NicDaoImpl.java
index 00da2eb..3cd7fa6 100644
--- a/server/src/com/cloud/vm/dao/NicDaoImpl.java
+++ b/server/src/com/cloud/vm/dao/NicDaoImpl.java
@@ -50,7 +50,6 @@
         AllFieldsSearch.and("address", AllFieldsSearch.entity().getIp4Address(), Op.EQ);
         AllFieldsSearch.and("isDefault", AllFieldsSearch.entity().isDefaultNic(), Op.EQ);
         AllFieldsSearch.and("broadcastUri", AllFieldsSearch.entity().getBroadcastUri(), Op.EQ);
-        AllFieldsSearch.and("macAddress", AllFieldsSearch.entity().getMacAddress(), Op.EQ);
         AllFieldsSearch.done();
         
         IpSearch = createSearchBuilder(String.class);
@@ -200,11 +199,4 @@
         sc.setParameters("address", ip4Address);
         return findOneBy(sc);
     }
-
-    @Override
-    public NicVO findByMacAddress(String macAddress) {
-        SearchCriteria<NicVO> sc = AllFieldsSearch.create();
-        sc.setParameters("macAddress", macAddress);
-        return findOneBy(sc);
-    }
 }
diff --git a/server/test/com/cloud/network/MockNetworkManagerImpl.java b/server/test/com/cloud/network/MockNetworkManagerImpl.java
index 26a6e60..28d1a60 100755
--- a/server/test/com/cloud/network/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/network/MockNetworkManagerImpl.java
@@ -113,6 +113,12 @@
     }
 
     @Override
+    public Network getNetwork(String networkUuid) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
     public IpAddress getIp(long id) {
         // TODO Auto-generated method stub
         return null;
@@ -791,7 +797,7 @@
      * @see com.cloud.network.NetworkService#allocateIP(com.cloud.user.Account, long, Long)
      */
     @Override
-    public IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException {
+    public IpAddress allocateIP(Account ipOwner, boolean isSystem, long zoneId) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException {
         // TODO Auto-generated method stub
         return null;
     }
diff --git a/server/test/com/cloud/user/MockAccountManagerImpl.java b/server/test/com/cloud/user/MockAccountManagerImpl.java
index ae5d0e5..550304a 100644
--- a/server/test/com/cloud/user/MockAccountManagerImpl.java
+++ b/server/test/com/cloud/user/MockAccountManagerImpl.java
@@ -23,6 +23,7 @@
 import javax.naming.ConfigurationException;
 
 import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 import com.cloud.api.query.vo.ControlledViewEntity;
 
@@ -344,4 +345,9 @@
         return null;
     }
 
+    @Override
+    public RoleType getRoleType(Account account) {
+        return null;
+    }
+
 }
diff --git a/server/test/com/cloud/user/MockDomainManagerImpl.java b/server/test/com/cloud/user/MockDomainManagerImpl.java
index 6dc4d07..9f49535 100644
--- a/server/test/com/cloud/user/MockDomainManagerImpl.java
+++ b/server/test/com/cloud/user/MockDomainManagerImpl.java
@@ -47,6 +47,12 @@
     }
 
     @Override
+    public Domain getDomain(String uuid) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
     public boolean isChildDomain(Long parentId, Long childId) {
         // TODO Auto-generated method stub
         return false;
diff --git a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
index 8cb9dd5..642ea10 100644
--- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
@@ -16,22 +16,6 @@
 // under the License.
 package com.cloud.vpc;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.ejb.Local;
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
-import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.acl.ControlledEntity.ACLType;
-import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
-import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.Vlan;
 import com.cloud.dc.Vlan.VlanType;
@@ -48,12 +32,7 @@
 import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.addr.PublicIp;
 import com.cloud.network.dao.NetworkServiceMapDao;
-import com.cloud.network.element.LoadBalancingServiceProvider;
-import com.cloud.network.element.NetworkElement;
-import com.cloud.network.element.RemoteAccessVPNServiceProvider;
-import com.cloud.network.element.Site2SiteVpnServiceProvider;
-import com.cloud.network.element.StaticNatServiceProvider;
-import com.cloud.network.element.UserDataServiceProvider;
+import com.cloud.network.element.*;
 import com.cloud.network.guru.NetworkGuru;
 import com.cloud.network.rules.FirewallRule;
 import com.cloud.network.rules.FirewallRule.Purpose;
@@ -70,6 +49,16 @@
 import com.cloud.utils.component.Manager;
 import com.cloud.vm.*;
 import com.cloud.vpc.dao.MockVpcVirtualRouterElement;
+import org.apache.cloudstack.acl.ControlledEntity.ACLType;
+import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
+import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
+import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
+import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
+import org.apache.log4j.Logger;
+
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+import java.util.*;
 
 @Local(value = { NetworkManager.class, NetworkService.class })
 public class MockNetworkManagerImpl implements NetworkManager, Manager{
@@ -156,6 +145,12 @@
         return null;
     }
 
+    @Override
+    public Network getNetwork(String networkUuid) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
     /* (non-Javadoc)
      * @see com.cloud.network.NetworkService#getIp(long)
      */
@@ -1475,7 +1470,7 @@
      * @see com.cloud.network.NetworkService#allocateIP(com.cloud.user.Account, boolean, long)
      */
     @Override
-    public IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException {
+    public IpAddress allocateIP(Account ipOwner, boolean isSystem, long zoneId) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException {
         // TODO Auto-generated method stub
         return null;
     }
diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql
index 37d5253..174f53c 100755
--- a/setup/db/create-schema.sql
+++ b/setup/db/create-schema.sql
@@ -306,7 +306,6 @@
   `state` char(32) COMMENT 'state of the network offering that has Disabled value by default',
   `guest_type` char(32) COMMENT 'type of guest network that can be shared or isolated',
   `elastic_ip_service` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if the network offering provides elastic ip service',
-  `eip_associate_public_ip` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if public IP is associated with user VM creation by default when EIP service is enabled.',
   `elastic_lb_service` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if the network offering provides elastic lb service',
   `specify_ip_ranges` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if the network offering provides an ability to define ip ranges',
   `inline` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Is this network offering LB provider is in inline mode',
diff --git a/setup/db/db/schema-40to410.sql b/setup/db/db/schema-40to410.sql
index bf3fb30..c115135 100644
--- a/setup/db/db/schema-40to410.sql
+++ b/setup/db/db/schema-40to410.sql
@@ -58,7 +58,6 @@
 
 ALTER TABLE `cloud`.`snapshots` ADD CONSTRAINT `fk_snapshots__s3_id` FOREIGN KEY `fk_snapshots__s3_id` (`s3_id`) REFERENCES `s3` (`id`);
 
-ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `eip_associate_public_ip` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if public IP is associated with user VM creation by default when EIP service is enabled.' AFTER `elastic_ip_service`;
 ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `inline` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Is this network offering LB provider is in inline mode';
 
 ALTER TABLE `cloud`.`external_load_balancer_devices` DROP COLUMN `is_inline`;
diff --git a/setup/db/templates.kvm.sql b/setup/db/templates.kvm.sql
index bc275f5..8a55825 100644
--- a/setup/db/templates.kvm.sql
+++ b/setup/db/templates.kvm.sql
@@ -51,11 +51,12 @@
 INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Fedora 10', 'Fedora 10');
 INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Fedora 9', 'Fedora 9');
 INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Fedora 8', 'Fedora 8');
-INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 2, 'Ubuntu 10.04', 'Ubuntu 10.04');
-INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 2, 'Ubuntu 9.10', 'Ubuntu 9.10');
-INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 2, 'Ubuntu 9.04', 'Ubuntu 9.04');
-INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 2, 'Ubuntu 8.10', 'Ubuntu 8.10');
-INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 2, 'Ubuntu 8.04', 'Ubuntu 8.04');
+INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 10, 'Ubuntu 12.04', 'Ubuntu 12.04');
+INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 10, 'Ubuntu 10.04', 'Ubuntu 10.04');
+INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 10, 'Ubuntu 9.10', 'Ubuntu 9.10');
+INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 10, 'Ubuntu 9.04', 'Ubuntu 9.04');
+INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 10, 'Ubuntu 8.10', 'Ubuntu 8.10');
+INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 10, 'Ubuntu 8.04', 'Ubuntu 8.04');
 INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 2, 'Debian Squeeze', 'Debian Squeeze');
 INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 2, 'Debian Lenny', 'Debian Lenny');
 INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 2, 'Debian Etch', 'Debian Etch');
diff --git a/setup/db/templates.sql b/setup/db/templates.sql
index 3867d4f..9980b15 100755
--- a/setup/db/templates.sql
+++ b/setup/db/templates.sql
@@ -211,6 +211,8 @@
 INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (160, UUID(), 6, 'Windows PV');
 INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (161, UUID(), 1, 'CentOS 5.7 (32-bit)');
 INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (162, UUID(), 1, 'CentOS 5.7 (64-bit)');
+INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (163, UUID(), 10, 'Ubuntu 12.04 (32-bit)');
+INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (164, UUID(), 10, 'Ubuntu 12.04 (64-bit)');
 
 INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (200, UUID(), 1, 'Other CentOS (32-bit)');
 INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (201, UUID(), 1, 'Other CentOS (64-bit)');
@@ -370,11 +372,13 @@
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Debian GNU/Linux 4(32-bit)', 73);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Debian GNU/Linux 4(64-bit)', 74);
 
+INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu 12.04 (32-bit)', 162);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu 10.04 (32-bit)', 121);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu 9.10 (32-bit)', 122);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu 9.04 (32-bit)', 123);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu 8.10 (32-bit)', 124);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu 8.04 (32-bit)', 125);
+INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu 12.04 (64-bit)', 163);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu 10.04 (64-bit)', 126);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu 9.10 (64-bit)', 127);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Ubuntu 9.04 (64-bit)', 128);
@@ -385,6 +389,7 @@
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Other Ubuntu Linux (32-bit)', 59);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Other Ubuntu (64-bit)', 100);
 
+
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Other 2.6x Linux (32-bit)', 75);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Other 2.6x Linux (64-bit)', 76);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Other Linux (32-bit)', 98);
@@ -454,6 +459,8 @@
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Fedora 8', 120);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 10.04', 121);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 10.04', 126);
+INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 10.04', 162);
+INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 10.04', 163);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 9.10', 122);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 9.10', 127);
 INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Ubuntu 9.04', 123);
diff --git a/test/integration/smoke/test_iso.py b/test/integration/smoke/test_iso.py
index 22d424f..8228a27 100644
--- a/test/integration/smoke/test_iso.py
+++ b/test/integration/smoke/test_iso.py
@@ -219,14 +219,14 @@
         # Finding the OsTypeId from Ostype
         ostypes = list_os_types(
                     cls.api_client,
-                    description=self.services["ostype"]
+                    description=cls.services["ostype"]
                     )
         if not isinstance(ostypes, list):
             raise unittest.SkipTest("OSTypeId for given description not found")
 
-        self.services["iso_1"]["ostypeid"] = ostypes[0].id
-        self.services["iso_2"]["ostypeid"] = ostypes[0].id
-        self.services["ostypeid"] = ostypes[0].id
+        cls.services["iso_1"]["ostypeid"] = ostypes[0].id
+        cls.services["iso_2"]["ostypeid"] = ostypes[0].id
+        cls.services["ostypeid"] = ostypes[0].id
 
         cls.iso_1 = Iso.create(
                                cls.api_client, 
diff --git a/test/integration/smoke/test_routers.py b/test/integration/smoke/test_routers.py
index 93dc760..435c7e4 100644
--- a/test/integration/smoke/test_routers.py
+++ b/test/integration/smoke/test_routers.py
@@ -41,7 +41,7 @@
                                     "displaytext": "Tiny Instance",
                                     "cpunumber": 1,
                                     "cpuspeed": 100, # in MHz
-                                    "memory": 64, # In MBs
+                                    "memory": 128, # In MBs
                                     },
                         "virtual_machine":
                                     {
diff --git a/test/integration/smoke/test_service_offerings.py b/test/integration/smoke/test_service_offerings.py
index 3a8a9e1..7f4d130 100644
--- a/test/integration/smoke/test_service_offerings.py
+++ b/test/integration/smoke/test_service_offerings.py
@@ -39,7 +39,7 @@
                                 "displaytext": "Service Offering",
                                 "cpunumber": 1,
                                 "cpuspeed": 100, # MHz
-                                "memory": 64, # in MBs
+                                "memory": 128, # in MBs
                             },
                      }
 
diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py
index d450a5d..663b174 100644
--- a/test/integration/smoke/test_templates.py
+++ b/test/integration/smoke/test_templates.py
@@ -52,7 +52,7 @@
                                     "displaytext": "Tiny Instance",
                                     "cpunumber": 1,
                                     "cpuspeed": 100,    # in MHz
-                                    "memory": 64,       # In MBs
+                                    "memory": 128,       # In MBs
                         },
                         "disk_offering": {
                                     "displaytext": "Small",
diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py
index f6fe4e0..0bd4f95 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -80,7 +80,7 @@
                         "displaytext": "Tiny Instance",
                         "cpunumber": 1,
                         "cpuspeed": 100, # in MHz
-                        "memory": 64, # In MBs
+                        "memory": 128, # In MBs
                     },
                  "small":
                     {
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index fe36e4a..36eb5de 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -53,7 +53,7 @@
                                     "displaytext": "Tiny Instance",
                                     "cpunumber": 1,
                                     "cpuspeed": 100,    # in MHz
-                                    "memory": 64,       # In MBs
+                                    "memory": 128,       # In MBs
                                     "storagetype": "local"
                         },
                         "disk_offering": {
diff --git a/tools/apidoc/pom.xml b/tools/apidoc/pom.xml
index e0b02bc..6b159ff 100644
--- a/tools/apidoc/pom.xml
+++ b/tools/apidoc/pom.xml
@@ -57,7 +57,7 @@
                                 <argument>${client.config.jars}</argument>
                                 <argument>./target</argument>
                                 <argument>-f</argument>
-                                <argument>${client.config.conf}/commands.properties,${client.config.conf}/commands-ext.properties,${client.config.conf}/virtualrouter_commands.properties,${client.config.conf}/nicira-nvp_commands.properties,${client.config.conf}/api-discovery_commands.properties </argument>
+                                <argument>${client.config.conf}/commands.properties</argument>
                             </arguments>
                         </configuration>
                     </execution>
diff --git a/tools/devcloud-kvm/README.md b/tools/devcloud-kvm/README.md
new file mode 100644
index 0000000..3261fbe
--- /dev/null
+++ b/tools/devcloud-kvm/README.md
@@ -0,0 +1,21 @@
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+
+===========================================================
+
+This directory hosts configs for setting up the devcloud-kvm
+environment.
diff --git a/tools/devcloud-kvm/devcloud-kvm-advanced.cfg b/tools/devcloud-kvm/devcloud-kvm-advanced.cfg
new file mode 100644
index 0000000..10cbce0
--- /dev/null
+++ b/tools/devcloud-kvm/devcloud-kvm-advanced.cfg
@@ -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.
+#
+
+
+{
+    "zones": [
+        {
+            "localstorageenabled": "true", 
+            "name": "testzone", 
+            "guestcidraddress": "10.1.1.0/24", 
+            "dns1": "8.8.8.8", 
+            "physical_networks": [
+                {
+                    "broadcastdomainrange": "Zone", 
+                    "vlan": "3900-4000", 
+                    "name": "eth0",
+                    "traffictypes": [
+                        {
+                            "kvm": "cloudbr0", 
+                            "typ": "Management"
+                        }, 
+                        {
+                            "kvm": "cloudbr0", 
+                            "typ": "Guest"
+                        }
+                    ], 
+                    "providers": [
+                        {
+                            "broadcastdomainrange": "ZONE", 
+                            "name": "VirtualRouter"
+                        }, 
+                        {
+                            "broadcastdomainrange": "ZONE", 
+                            "name": "VpcVirtualRouter"
+                        }
+                    ]
+                }, 
+                {
+                    "broadcastdomainrange": "Zone", 
+                    "name": "eth1", 
+                    "traffictypes": [
+                        {
+                            "kvm": "cloudbr1", 
+                            "typ": "Public"
+                        }
+                    ], 
+                    "providers": [
+                        {
+                            "broadcastdomainrange": "ZONE", 
+                            "name": "VirtualRouter"
+                        }
+                    ]
+                }
+            ], 
+            "ipranges": [
+                {
+                    "startip": "192.168.100.100", 
+                    "endip": "192.168.100.199", 
+                    "netmask": "255.255.255.0", 
+                    "vlan": "untagged", 
+                    "gateway": "192.168.100.1"
+                }
+            ], 
+            "networktype": "Advanced", 
+            "pods": [
+                {
+                    "endip": "172.17.10.199", 
+                    "name": "testpod", 
+                    "startip": "172.17.10.100", 
+                    "netmask": "255.255.255.0", 
+                    "clusters": [
+                        {
+                            "clustername": "testcluster", 
+                            "hypervisor": "KVM", 
+                            "hosts": [
+                                {
+                                    "username": "root", 
+                                    "url": "http://172.17.10.10/", 
+                                    "password": "password"
+                                }
+                            ], 
+                            "clustertype": "CloudManaged"
+                        }
+                    ], 
+                    "gateway": "172.17.10.1"
+                }
+            ], 
+            "internaldns1": "8.8.4.4", 
+            "secondaryStorages": [
+                {
+                    "url": "nfs://172.17.10.10:/nfs/secondary"
+                }
+            ]
+        }
+    ], 
+    "dbSvr": {
+        "dbSvr": "127.0.0.1", 
+        "passwd": "cloud", 
+        "db": "cloud", 
+        "port": 3306, 
+        "user": "cloud"
+    }, 
+    "logger": [
+        {
+            "name": "TestClient", 
+            "file": "/var/log/testclient.log"
+        }, 
+        {
+            "name": "TestCase", 
+            "file": "/var/log/testcase.log"
+        }
+    ], 
+    "mgtSvr": [
+        {
+            "mgtSvrIp": "172.17.10.10", 
+            "port": 8096
+        }
+    ]
+}
diff --git a/tools/devcloud-kvm/devcloud-kvm.cfg b/tools/devcloud-kvm/devcloud-kvm.cfg
new file mode 100644
index 0000000..b3f048a
--- /dev/null
+++ b/tools/devcloud-kvm/devcloud-kvm.cfg
@@ -0,0 +1,117 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+# This is a stock devcloud config converted from the file
+# tools/devcloud/devcloud.cfg.
+
+{
+    "zones": [
+        {
+            "name": "DevCloudKVM0", 
+            "physical_networks": [
+                {
+                    "broadcastdomainrange": "Zone", 
+                    "name": "test-network", 
+                    "traffictypes": [
+                        {
+                            "typ": "Guest"
+                        }, 
+                        {
+                            "typ": "Management"
+                        } 
+                    ], 
+                    "providers": [
+                        {
+                            "broadcastdomainrange": "ZONE", 
+                            "name": "VirtualRouter"
+                        },
+                        {
+                            "broadcastdomainrange": "Pod",
+                            "name": "SecurityGroupProvider"
+                        }
+                    ]
+                }
+            ],
+            "dns2": "4.4.4.4", 
+            "dns1": "8.8.8.8",
+            "securitygroupenabled": "true", 
+            "localstorageenabled": "true",
+            "networktype": "Basic", 
+            "pods": [
+                {
+                    "endip": "192.168.100.250", 
+                    "name": "test00", 
+                    "startip": "192.168.100.200", 
+                    "guestIpRanges": [
+                        {
+                            "startip": "192.168.100.100", 
+                            "endip": "192.168.100.199", 
+                            "netmask": "255.255.255.0", 
+                            "gateway": "192.168.100.1"
+                        }
+                    ], 
+                    "netmask": "255.255.255.0", 
+                    "clusters": [
+                        {
+                            "clustername": "test000", 
+                            "hypervisor": "KVM", 
+                            "hosts": [
+                                {
+                                    "username": "root", 
+                                    "url": "http://192.168.100.10/", 
+                                    "password": "password"
+                                }
+                            ], 
+                            "clustertype": "CloudManaged"
+                        }
+                    ], 
+                    "gateway": "192.168.100.1"
+                }
+            ], 
+            "internaldns1": "192.168.100.10", 
+            "secondaryStorages": [
+                {
+                    "url": "nfs://192.168.100.10:/nfs/secondary"
+                }
+            ]
+        }
+    ], 
+    "logger": [
+        {
+            "name": "TestClient", 
+            "file": "/tmp/testclient.log"
+        }, 
+        {
+            "name": "TestCase", 
+            "file": "/tmp/testcase.log"
+        }
+    ], 
+    "mgtSvr": [
+        {
+            "mgtSvrIp": "127.0.0.1", 
+            "port": 8096
+        }
+    ],
+    "dbSvr": 
+        {
+	    "dbSvr": "127.0.0.1",
+	    "port": 3306,
+	    "user": "cloud",
+	    "passwd": "cloud",
+	    "db": "cloud"
+        }
+}
diff --git a/tools/devcloud-kvm/devcloud-kvm.py b/tools/devcloud-kvm/devcloud-kvm.py
new file mode 100644
index 0000000..dd551b5
--- /dev/null
+++ b/tools/devcloud-kvm/devcloud-kvm.py
@@ -0,0 +1,157 @@
+#!/usr/bin/env python
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+'''
+############################################################
+# Experimental state of scripts 
+#    * Need to be reviewed
+#    * Only a sandbox
+############################################################
+'''
+import random
+import marvin
+from ConfigParser import SafeConfigParser
+from optparse import OptionParser
+from marvin.configGenerator import *
+
+
+def getGlobalSettings(config):
+   for k, v in dict(config.items('globals')).iteritems():
+        cfg = configuration()
+        cfg.name = k
+        cfg.value = v
+        yield cfg
+
+
+def describeDevcloudKvmResources(config):
+    zs = cloudstackConfiguration()
+
+    z = zone()
+    z.dns1 = config.get('environment', 'dns')
+    z.internaldns1 = config.get('environment', 'dns')
+    z.name = 'Devcloud-%s'%(config.get('cloudstack', 'hypervisor'))
+    z.networktype = 'Advanced'
+    z.guestcidraddress = '10.1.1.0/24'
+    z.localstorageenabled = 'true'
+    
+    vpcprovider = provider()
+    vpcprovider.name = 'VpcVirtualRouter'
+    
+    pn = physical_network()
+    pn.name = "eth0"
+    pn.vlan = config.get('cloudstack', 'pnet.vlan')
+    pn.tags = ["devcloud-guest"]
+    pn.traffictypes = [traffictype("Guest", {"kvm" :"kvm-guest" }), traffictype("Management")]
+    pn.providers.append(vpcprovider)
+
+    pn2 = physical_network()
+    pn2.name = "eth1"
+    pn2.vlan = config.get('cloudstack', 'pnet2.vlan')
+    pn2.tags = ["devcloud-public"]
+    pn2.traffictypes = [traffictype("Public", {"kvm" : "kvm-public"})]
+    pn2.providers.append(vpcprovider)
+    
+    z.physical_networks.append(pn)
+    z.physical_networks.append(pn2)
+
+    p = pod()
+    p.name = 'POD0'
+    p.gateway = config.get('cloudstack', 'private.gateway')
+    p.startip =  config.get('cloudstack', 'private.pod.startip')
+    p.endip =  config.get('cloudstack', 'private.pod.endip')
+    p.netmask = config.get('cloudstack', 'private.netmask')
+
+    v = iprange()
+    v.gateway = config.get('cloudstack', 'public.gateway')
+    v.startip = config.get('cloudstack', 'public.vlan.startip')
+    v.endip = config.get('cloudstack', 'public.vlan.endip') 
+    v.netmask = config.get('cloudstack', 'public.netmask')
+    v.vlan = config.get('cloudstack', 'public.vlan')
+    z.ipranges.append(v)
+
+    c = cluster()
+    c.clustername = 'C0'
+    c.hypervisor = config.get('cloudstack', 'hypervisor')
+    c.clustertype = 'CloudManaged'
+
+    h = host()
+    h.username = 'root'
+    h.password = config.get('cloudstack', 'host.password')
+    h.url = 'http://%s'%(config.get('cloudstack', 'host'))
+    c.hosts.append(h)
+
+    ps = primaryStorage()
+    ps.name = 'PS0'
+    ps.url = config.get('cloudstack', 'primary.pool')
+    c.primaryStorages.append(ps)
+
+    p.clusters.append(c)
+    z.pods.append(p)
+
+    secondary = secondaryStorage()
+    secondary.url = config.get('cloudstack', 'secondary.pool')
+    z.secondaryStorages.append(secondary)
+
+    '''Add zone'''
+    zs.zones.append(z)
+
+    '''Add mgt server'''
+    mgt = managementServer()
+    mgt.mgtSvrIp = config.get('environment', 'mshost')
+    mgt.user = config.get('environment', 'mshost.user')
+    mgt.passwd = config.get('environment', 'mshost.passwd')
+    zs.mgtSvr.append(mgt)
+
+    '''Add a database'''
+    db = dbServer()
+    db.dbSvr = config.get('environment', 'mysql.host')
+    db.user = config.get('environment', 'mysql.cloud.user')
+    db.passwd = config.get('environment', 'mysql.cloud.passwd')
+    zs.dbSvr = db
+
+    '''Add some configuration'''
+    [zs.globalConfig.append(cfg) for cfg in getGlobalSettings(config)]
+
+    ''''add loggers'''
+    testClientLogger = logger()
+    testClientLogger.name = 'TestClient'
+    testClientLogger.file = 'testclient.log'
+
+    testCaseLogger = logger()
+    testCaseLogger.name = 'TestCase'
+    testCaseLogger.file = 'testcase.log'
+
+    zs.logger.append(testClientLogger)
+    zs.logger.append(testCaseLogger)
+    return zs
+
+
+if __name__ == '__main__':
+    parser = OptionParser()
+    parser.add_option('-i', '--input', action='store', default='setup.properties', \
+                      dest='input', help='file containing environment setup information')
+    parser.add_option('-o', '--output', action='store', default='./devcloud-kvm-advanced.cfg', \
+                      dest='output', help='path where environment json will be generated')
+
+
+    (opts, args) = parser.parse_args()
+
+    cfg_parser = SafeConfigParser()
+    cfg_parser.read(opts.input)
+
+    cfg = describeDevcloudKvmResources(cfg_parser)
+    generate_setup_config(cfg, opts.output)
diff --git a/tools/devcloud-kvm/devcloud-kvm.sql b/tools/devcloud-kvm/devcloud-kvm.sql
new file mode 100644
index 0000000..6d559a9
--- /dev/null
+++ b/tools/devcloud-kvm/devcloud-kvm.sql
@@ -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.
+
+
+INSERT INTO `cloud`.`disk_offering` (id, name, uuid, display_text, created, use_local_storage, type, disk_size) VALUES (17, 'tinyOffering', UUID(), 'tinyOffering', NOW(), 1, 'Service', 0);
+INSERT INTO `cloud`.`service_offering` (id, cpu, speed, ram_size) VALUES (17, 1, 100, 128);
+INSERT INTO `cloud`.`disk_offering` (id, name, uuid, display_text, created, type, disk_size) VALUES (18, 'tinyDiskOffering', UUID(), 'tinyDiskOffering', NOW(), 'Disk', 1073741824);
+INSERT INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','router.ram.size', '100');
+INSERT INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','router.cpu.mhz','100');
+INSERT INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','console.ram.size','100');
+INSERT INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','console.cpu.mhz', '100');
+INSERT INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','ssvm.ram.size','100');
+INSERT INTO `cloud`.`configuration` (instance, name,value) VALUE('DEFAULT','ssvm.cpu.mhz','100');
+INSERT INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'system.vm.use.local.storage', 'true');
+INSERT INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'expunge.workers', '3');
+INSERT INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'expunge.delay', '60');
+INSERT INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'expunge.interval', '60');
+INSERT INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'enable.ec2.api', 'true');
+INSERT INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'enable.s3.api', 'true');
+INSERT INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'host', '192.168.100.10');
+INSERT INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'management.network.cidr', '192.168.100.0/24');
+INSERT INTO `cloud`.`configuration` (instance, name, value) VALUE('DEFAULT', 'secstorage.allowed.internal.sites', '192.168.0.0/8');
+UPDATE `cloud`.`configuration` SET value='10' where name = 'storage.overprovisioning.factor';
+UPDATE `cloud`.`configuration` SET value='10' where name = 'cpu.overprovisioning.factor';
+UPDATE `cloud`.`configuration` SET value='10' where name = 'mem.overprovisioning.factor';
+UPDATE `cloud`.`vm_template` SET unique_name="tiny CentOS 6.3",name="tiny CentOS 6.3",url="http://marcus.mlsorensen.com/cloudstack-extras/tiny-centos-63.qcow2",checksum="4bbb806aa8570f4dfac13b4c38ea1603",display_text="tiny CentOS 6.3",format='QCOW2',hypervisor_type='KVM' where id=5;
+UPDATE `cloud`.`vm_template` SET url="http://dontdownloadthistemplate" where id=4;
diff --git a/tools/devcloud-kvm/kvm.properties b/tools/devcloud-kvm/kvm.properties
new file mode 100644
index 0000000..79afcd4
--- /dev/null
+++ b/tools/devcloud-kvm/kvm.properties
@@ -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.
+
+
+[globals]
+#global settings in cloudstack
+expunge.delay=60
+expunge.interval=60
+storage.cleanup.interval=300
+account.cleanup.interval=600
+expunge.workers=3
+workers=10
+vm.allocation.algorithm=random
+vm.op.wait.interval=5
+guest.domain.suffix=devcloud.kvm
+instance.name=vm
+check.pod.cidrs=true
+secstorage.allowed.internal.sites=10.147.28.0/24
+[environment]
+dns=8.8.8.8
+mshost=127.0.0.1
+mshost.user=root
+mshost.passwd=password
+mysql.host=127.0.0.1
+mysql.cloud.user=cloud
+mysql.cloud.passwd=cloud
+[cloudstack]
+#guest VLAN
+pnet.vlan=3900-3919
+pnet2.vlan=3920-3939
+#management network
+private.gateway=192.168.56.1
+private.pod.startip=192.168.56.200
+private.pod.endip=192.168.56.249
+private.netmask=255.255.255.0
+#public network
+public.gateway=10.0.3.2
+public.vlan=31
+public.vlan.startip=10.0.3.100
+public.vlan.endip=10.0.3.199
+public.netmask=255.255.255.0
+#hypervisor host information
+hypervisor=KVM
+host=192.168.56.10
+host.password=password
+#storage pools
+primary.pool=nfs://192.168.56.10/opt/storage/primary
+secondary.pool=nfs://192.168.56.10/opt/storage/secondary
diff --git a/tools/devcloud-kvm/pom.xml b/tools/devcloud-kvm/pom.xml
new file mode 100644
index 0000000..c9af192
--- /dev/null
+++ b/tools/devcloud-kvm/pom.xml
@@ -0,0 +1,138 @@
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+  license agreements. See the NOTICE file distributed with this work for additional 
+  information regarding copyright ownership. The ASF licenses this file to 
+  you under the Apache License, Version 2.0 (the "License"); you may not use 
+  this file except in compliance with the License. You may obtain a copy of 
+  the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+  by applicable law or agreed to in writing, software distributed under the 
+  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+  OF ANY KIND, either express or implied. See the License for the specific 
+  language governing permissions and limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>cloud-devcloud-kvm</artifactId>
+  <name>Apache CloudStack Developer Tools</name>
+  <packaging>pom</packaging>
+  <parent>
+    <groupId>org.apache.cloudstack</groupId>
+    <artifactId>cloudstack</artifactId>
+    <version>4.1.0-SNAPSHOT</version>
+    <relativePath>../../pom.xml</relativePath>
+  </parent>
+  <dependencies>
+    <dependency>
+      <groupId>mysql</groupId>
+      <artifactId>mysql-connector-java</artifactId>
+      <version>5.1.21</version>
+      <scope>runtime</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <defaultGoal>install</defaultGoal>
+  </build>
+  <profiles>
+    <profile>
+      <id>deploydb</id>
+      <activation>
+        <property>
+          <name>deploydb</name>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>properties-maven-plugin</artifactId>
+            <version>1.0-alpha-2</version>
+            <executions>
+              <execution>
+                <phase>initialize</phase>
+                <goals>
+                  <goal>read-project-properties</goal>
+                </goals>
+                <configuration>
+                  <files>
+                    <file>${project.parent.basedir}/utils/conf/db.properties</file>
+                    <file>${project.parent.basedir}/utils/conf/db.properties.override</file>
+                  </files>
+                  <quiet>true</quiet>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>sql-maven-plugin</artifactId>
+            <version>1.5</version>
+            <dependencies>
+              <!-- specify the dependent jdbc driver here -->
+              <dependency>
+                <groupId>mysql</groupId>
+                <artifactId>mysql-connector-java</artifactId>
+                <version>${cs.mysql.version}</version>
+              </dependency>
+            </dependencies>
+            <configuration>
+              <driver>org.gjt.mm.mysql.Driver</driver>
+              <url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}/cloud</url>
+              <username>${db.cloud.username}</username>
+              <password>${db.cloud.password}</password>
+              <!--all executions are ignored if -Dmaven.test.skip=true -->
+              <skip>${maven.test.skip}</skip>
+              <forceMojoExecution>true</forceMojoExecution>
+            </configuration>
+            <executions>
+              <execution>
+                <id>create-schema</id>
+                <phase>process-test-resources</phase>
+                <goals>
+                  <goal>execute</goal>
+                </goals>
+                <configuration>
+                  <srcFiles>
+                    <srcFile>${basedir}/devcloud-kvm.sql</srcFile>
+                  </srcFiles>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+    <profile>
+      <id>deploysvr</id>
+      <activation>
+        <property>
+          <name>deploysvr</name>
+        </property>
+      </activation>
+      <build> 
+        <plugins>
+          <plugin>
+         <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>1.2.1</version>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <executable>python</executable>
+          <arguments>
+            <argument>../marvin/marvin/deployDataCenter.py</argument>
+            <argument>-i</argument>
+            <argument>devcloud-kvm.cfg</argument>
+          </arguments>
+        </configuration>
+          </plugin>
+        </plugins>
+      </build> 
+    </profile>
+  </profiles>
+</project>
diff --git a/tools/devcloud/devcloud-advanced.cfg b/tools/devcloud/devcloud-advanced.cfg
new file mode 100644
index 0000000..75c3a4f
--- /dev/null
+++ b/tools/devcloud/devcloud-advanced.cfg
@@ -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.
+#
+# This configuration is meant for running advanced networking, with management server on the laptop. 
+# It requires that the user run a DNS resolver within devcloud via 'apt-get install dnsmasq'
+
+{
+    "zones": [
+        {
+            "localstorageenabled": "true", 
+            "name": "testzone", 
+            "guestcidraddress": "10.1.1.0/24", 
+            "dns1": "8.8.8.8", 
+            "physical_networks": [
+                {
+                    "broadcastdomainrange": "Zone", 
+                    "vlan": "3900-4000", 
+                    "name": "eth0", 
+                    "traffictypes": [
+                        {
+                            "xen": "Pool-wide network associated with eth0", 
+                            "typ": "Management"
+                        }, 
+                        {
+                            "xen": "Pool-wide network associated with eth0", 
+                            "typ": "Guest"
+                        }
+                    ],
+                    "providers": [
+                        {
+                            "broadcastdomainrange": "ZONE", 
+                            "name": "VirtualRouter"
+                        }, 
+                        {
+                            "broadcastdomainrange": "ZONE", 
+                            "name": "VpcVirtualRouter"
+                        }
+                    ]
+                }, 
+                {
+                    "broadcastdomainrange": "Zone", 
+                    "name": "eth1", 
+                    "traffictypes": [
+                        {
+                            "xen": "Pool-wide network associated with eth1", 
+                            "typ": "Public"
+                        }
+                    ], 
+                    "providers": [
+                        {
+                            "broadcastdomainrange": "ZONE", 
+                            "name": "VirtualRouter"
+                        }
+                    ]
+                }
+            ], 
+            "ipranges": [
+                {
+                    "startip": "10.0.3.100", 
+                    "endip": "10.0.3.199", 
+                    "netmask": "255.255.255.0", 
+                    "vlan": "untagged", 
+                    "gateway": "10.0.3.2"
+                }
+            ], 
+            "networktype": "Advanced", 
+            "pods": [
+                {
+                    "endip": "192.168.56.249", 
+                    "name": "testpod", 
+                    "startip": "192.168.56.200", 
+                    "netmask": "255.255.255.0", 
+                    "clusters": [
+                        {
+                            "clustername": "testcluster", 
+                            "hypervisor": "XenServer", 
+                            "hosts": [
+                                {
+                                    "username": "root", 
+                                    "url": "http://192.168.56.10/", 
+                                    "password": "password"
+                                }
+                            ], 
+                            "clustertype": "CloudManaged"
+                        }
+                    ], 
+                    "gateway": "192.168.56.1"
+                }
+            ], 
+            "internaldns1": "192.168.56.10", 
+            "secondaryStorages": [
+                {
+                    "url": "nfs://192.168.56.10:/opt/storage/secondary"
+                }
+            ]
+        }
+    ], 
+    "dbSvr": {
+        "dbSvr": "127.0.0.1", 
+        "passwd": "cloud", 
+        "db": "cloud", 
+        "port": 3306, 
+        "user": "cloud"
+    }, 
+    "logger": [
+        {
+            "name": "TestClient", 
+            "file": "/var/log/testclient.log"
+        }, 
+        {
+            "name": "TestCase", 
+            "file": "/var/log/testcase.log"
+        }
+    ], 
+    "mgtSvr": [
+        {
+            "mgtSvrIp": "192.168.56.10", 
+            "port": 8096
+        }
+    ]
+}
diff --git a/tools/devcloud/devcloud-advanced_internal-mgt.cfg b/tools/devcloud/devcloud-advanced_internal-mgt.cfg
new file mode 100644
index 0000000..a1a8cb5
--- /dev/null
+++ b/tools/devcloud/devcloud-advanced_internal-mgt.cfg
@@ -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.
+#
+# This config is designed to run as an advanced network, with management server in devcloud
+# It also requires an 'apt-get install dnsmasq' to run a resolver in devcloud for internal dns
+
+{
+    "zones": [
+        {
+            "localstorageenabled": "true", 
+            "name": "testzone", 
+            "guestcidraddress": "10.1.1.0/24", 
+            "dns1": "8.8.8.8", 
+            "physical_networks": [
+                {
+                    "broadcastdomainrange": "Zone", 
+                    "vlan": "3900-4000", 
+                    "name": "eth0", 
+                    "traffictypes": [
+                        {
+                            "xen": "Pool-wide network associated with eth0", 
+                            "typ": "Management"
+                        }, 
+                        {
+                            "xen": "Pool-wide network associated with eth0", 
+                            "typ": "Guest"
+                        }
+                    ],
+                    "providers": [
+                        {
+                            "broadcastdomainrange": "ZONE", 
+                            "name": "VirtualRouter"
+                        }, 
+                        {
+                            "broadcastdomainrange": "ZONE", 
+                            "name": "VpcVirtualRouter"
+                        }
+                    ]
+                }, 
+                {
+                    "broadcastdomainrange": "Zone", 
+                    "name": "eth1", 
+                    "traffictypes": [
+                        {
+                            "xen": "Pool-wide network associated with eth1", 
+                            "typ": "Public"
+                        }
+                    ], 
+                    "providers": [
+                        {
+                            "broadcastdomainrange": "ZONE", 
+                            "name": "VirtualRouter"
+                        }
+                    ]
+                }
+            ], 
+            "ipranges": [
+                {
+                    "startip": "10.0.3.100", 
+                    "endip": "10.0.3.199", 
+                    "netmask": "255.255.255.0", 
+                    "vlan": "untagged", 
+                    "gateway": "10.0.3.2"
+                }
+            ], 
+            "networktype": "Advanced", 
+            "pods": [
+                {
+                    "endip": "192.168.56.249", 
+                    "name": "testpod", 
+                    "startip": "192.168.56.200", 
+                    "netmask": "255.255.255.0", 
+                    "clusters": [
+                        {
+                            "clustername": "testcluster", 
+                            "hypervisor": "XenServer", 
+                            "hosts": [
+                                {
+                                    "username": "root", 
+                                    "url": "http://192.168.56.10/", 
+                                    "password": "password"
+                                }
+                            ], 
+                            "clustertype": "CloudManaged"
+                        }
+                    ], 
+                    "gateway": "192.168.56.1"
+                }
+            ], 
+            "internaldns1": "192.168.56.10", 
+            "secondaryStorages": [
+                {
+                    "url": "nfs://192.168.56.10:/opt/storage/secondary"
+                }
+            ]
+        }
+    ], 
+    "dbSvr": {
+        "dbSvr": "127.0.0.1", 
+        "passwd": "cloud", 
+        "db": "cloud", 
+        "port": 3306, 
+        "user": "cloud"
+    }, 
+    "logger": [
+        {
+            "name": "TestClient", 
+            "file": "/var/log/testclient.log"
+        }, 
+        {
+            "name": "TestCase", 
+            "file": "/var/log/testcase.log"
+        }
+    ], 
+    "mgtSvr": [
+        {
+            "mgtSvrIp": "192.168.56.10", 
+            "port": 8096
+        }
+    ],
+    "globalConfig": [
+        {
+            "name": "host",
+            "value": "192.168.56.10"
+        }
+    ]
+}
diff --git a/tools/devcloud/devcloud.cfg b/tools/devcloud/devcloud.cfg
index 8d296eb..c41f8bc 100644
--- a/tools/devcloud/devcloud.cfg
+++ b/tools/devcloud/devcloud.cfg
@@ -1,3 +1,21 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
 {
     "zones": [
         {
diff --git a/tools/marvin/marvin/configGenerator.py b/tools/marvin/marvin/configGenerator.py
index d494beb..e2a6a24 100644
--- a/tools/marvin/marvin/configGenerator.py
+++ b/tools/marvin/marvin/configGenerator.py
@@ -65,8 +65,6 @@
         self.internaldns2 = None
         self.securitygroupenabled = None
         self.localstorageenabled = None
-        ''' Guest Vlan range - only advanced zone'''
-        self.vlan = None
         '''default public network, in advanced mode'''
         self.ipranges = []
         self.physical_networks = []
@@ -80,6 +78,7 @@
             self.xen = labeldict['xen'] if 'xen' in labeldict.keys() else None
             self.kvm = labeldict['kvm'] if 'kvm' in labeldict.keys() else None
             self.vmware = labeldict['vmware'] if 'vmware' in labeldict.keys() else None
+            self.simulator = labeldict['simulator'] if 'simulator' in labeldict.keys() else None
         #{
         #    'xen' : 'cloud-xen',
         #    'kvm' : 'cloud-kvm',
diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py
index 0d5f3bd..e4f7eac 100644
--- a/tools/marvin/marvin/deployDataCenter.py
+++ b/tools/marvin/marvin/deployDataCenter.py
@@ -258,10 +258,10 @@
         traffic_type = addTrafficType.addTrafficTypeCmd()
         traffic_type.physicalnetworkid = physical_network_id
         traffic_type.traffictype = traffictype.typ
-        if traffictype.labeldict is not None:
-            traffic_type.kvmnetworklabel = traffictype.labeldict.kvm
-            traffic_type.xennetworklabel = traffictype.labeldict.xen
-            traffic_type.vmwarenetworklabel = traffictype.labeldict.vmware
+        traffic_type.kvmnetworklabel = traffictype.kvm if traffictype.kvm is not None else None
+        traffic_type.xennetworklabel = traffictype.xen if traffictype.xen is not None else None
+        traffic_type.vmwarenetworklabel = traffictype.vmware if traffictype.vmware is not None else None
+        traffic_type.simulatorlabel = traffictype.simulator if traffictype.simulator is not None else None
         return self.apiClient.addTrafficType(traffic_type)
 
     def enableZone(self, zoneid, allocation_state="Enabled"):
@@ -289,7 +289,7 @@
             for pnet in zone.physical_networks:
                 phynetwrk = self.createPhysicalNetwork(pnet, zoneId)
                 self.configureProviders(phynetwrk, pnet.providers)
-                self.updatePhysicalNetwork(phynetwrk.id, "Enabled", vlan=zone.vlan)
+                self.updatePhysicalNetwork(phynetwrk.id, "Enabled", vlan=pnet.vlan)
 
             if zone.networktype == "Basic":
                 listnetworkoffering = listNetworkOfferings.listNetworkOfferingsCmd()
diff --git a/tools/marvin/marvin/integration/lib/base.py b/tools/marvin/marvin/integration/lib/base.py
index 446da83..87b0bbb 100644
--- a/tools/marvin/marvin/integration/lib/base.py
+++ b/tools/marvin/marvin/integration/lib/base.py
@@ -1115,6 +1115,9 @@
         if domainid:
             cmd.domainid = domainid
 
+        if services["storagetype"]:
+            cmd.storagetype = services["storagetype"]
+
         return DiskOffering(apiclient.createDiskOffering(cmd).__dict__)
 
     def delete(self, apiclient):
diff --git a/tools/marvin/marvin/sandbox/advanced/advanced_env.py b/tools/marvin/marvin/sandbox/advanced/advanced_env.py
index 1873f31..db78a84 100644
--- a/tools/marvin/marvin/sandbox/advanced/advanced_env.py
+++ b/tools/marvin/marvin/sandbox/advanced/advanced_env.py
@@ -52,10 +52,22 @@
     
     pn = physical_network()
     pn.name = "Sandbox-pnet"
-    pn.traffictypes = [traffictype("Guest"), traffictype("Management"), traffictype("Public")]
+    pn.vlan = config.get('cloudstack', 'pnet.vlan')
+    pn.tags = ["cloud-simulator-public"]
+    pn.traffictypes = [traffictype("Guest"),
+            traffictype("Management", {"simulator" : "cloud-simulator-mgmt"}),
+            traffictype("Public", {"simulator":"cloud-simulator-public"})]
     pn.providers.append(vpcprovider)
+
+    pn2 = physical_network()
+    pn2.name = "Sandbox-pnet2"
+    pn2.vlan = config.get('cloudstack', 'pnet2.vlan')
+    pn2.tags = ["cloud-simulator-guest"]
+    pn2.traffictypes = [traffictype('Guest', {'simulator': 'cloud-simulator-guest'})]
+    pn2.providers.append(vpcprovider)
     
     z.physical_networks.append(pn)
+    z.physical_networks.append(pn2)
 
     p = pod()
     p.name = 'POD0'
@@ -118,11 +130,11 @@
     ''''add loggers'''
     testClientLogger = logger()
     testClientLogger.name = 'TestClient'
-    testClientLogger.file = '/var/log/testclient.log'
+    testClientLogger.file = 'testclient.log'
 
     testCaseLogger = logger()
     testCaseLogger.name = 'TestCase'
-    testCaseLogger.file = '/var/log/testcase.log'
+    testCaseLogger.file = 'testcase.log'
 
     zs.logger.append(testClientLogger)
     zs.logger.append(testCaseLogger)
diff --git a/tools/marvin/marvin/sandbox/advanced/setup.properties b/tools/marvin/marvin/sandbox/advanced/setup.properties
index ba44d51..73eacc9 100644
--- a/tools/marvin/marvin/sandbox/advanced/setup.properties
+++ b/tools/marvin/marvin/sandbox/advanced/setup.properties
@@ -24,10 +24,9 @@
 account.cleanup.interval=600
 expunge.workers=3
 workers=10
-use.user.concentrated.pod.allocation=false
 vm.allocation.algorithm=random
 vm.op.wait.interval=5
-guest.domain.suffix=sandbox.kvm
+guest.domain.suffix=sandbox.simulator
 instance.name=QA
 direct.agent.load.size=1000
 default.page.size=10000
@@ -35,15 +34,16 @@
 secstorage.allowed.internal.sites=10.147.28.0/24
 [environment]
 dns=10.147.28.6
-mshost=10.147.29.111
+mshost=localhost
 mshost.user=root
 mshost.passwd=password
-mysql.host=10.147.29.111
+mysql.host=localhost
 mysql.cloud.user=cloud
 mysql.cloud.passwd=cloud
 [cloudstack]
 #guest VLAN
-zone.vlan=675-679
+pnet.vlan=675-679
+pnet2.vlan=800-1000
 #management network
 private.gateway=10.147.29.1
 private.pod.startip=10.147.29.150
@@ -56,9 +56,9 @@
 public.vlan.endip=10.147.31.159
 public.netmask=255.255.255.0
 #hypervisor host information
-hypervisor=XenServer
-host=10.147.29.58
+hypervisor=Simulator
+host=simulator0
 host.password=password
 #storage pools
-primary.pool=nfs://10.147.28.6:/export/home/sandbox/kamakura
+primary.pool=nfs://10.147.28.6:/export/home/sandbox/primary
 secondary.pool=nfs://10.147.28.6:/export/home/sandbox/sstor
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 4103c3e..f3308bb 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -1259,12 +1259,16 @@
                                       data.listvirtualmachinesresponse.virtualmachine : [],
                                     function(instance) {
                                           var nonAutoScale=0;
+                                          if(instance.displayname == null)
+                                              nonAutoScale = 1;
+                                            else{
                                           if( instance.displayname.match(/AutoScale-LB-/)==null)
                                              nonAutoScale =1;
                                           else {
                                              if(instance.displayname.match(/AutoScale-LB-/).length)
                                                nonAutoScale =0;
                                              }
+                                          }
                                       var isActiveState= $.inArray(instance.state, ['Destroyed','Expunging']) == -1;
                                       return nonAutoScale && isActiveState;
                                     }
@@ -2623,12 +2627,16 @@
                                 function(instance) {
                                  //Hiding the autoScale VMs
                                  var nonAutoScale =0;
+                                 if(instance.displayname == null)
+                                    nonAutoScale = 1
+                                 else {
                                  if(instance.displayname.match(/AutoScale-LB-/) == null)
                                        nonAutoScale = 1;
                                  else {
                                      if( instance.displayname.match(/AutoScale-LB-/).length)          
                                         nonAutoScale =0;
-                                   }            
+                                   }   
+                                  }         
                                   var isActiveState = $.inArray(instance.state, ['Destroyed','Expunging']) == -1;
                                   var notExisting = !$.grep(itemData, function(item) {
                                     return item.id == instance.id;
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index eb78ad1..51c4fdb 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -208,12 +208,13 @@
   var json = JSON.parse(XMLHttpResponse.responseText);
   if (json != null) {
     var property;
-    for(property in json) {}
+    for(property in json) {
     var errorObj = json[property];		
 		if(errorObj.errorcode == 401 && errorObj.errortext == "unable to verify user credentials and/or request signature")
 		  return _l('label.session.expired');
 		else
       return _s(errorObj.errortext);
+     }
   } 
 	else {
     return "";
diff --git a/ui/scripts/ui/widgets/listView.js b/ui/scripts/ui/widgets/listView.js
index 85523ea..9e16ec2 100644
--- a/ui/scripts/ui/widgets/listView.js
+++ b/ui/scripts/ui/widgets/listView.js
@@ -560,8 +560,8 @@
           return $(this).index() == index;
         });
 
-        if ($target.index() > $tr.index()) $target.after($tr);
-        else $target.before($tr);
+    //    if ($target.index() > $tr.index()) $target.after($tr);
+      //  else $target.before($tr);
 
         $tr.closest('.list-view').scrollTop($tr.position().top - $tr.height() * 2);
 
diff --git a/utils/src/com/cloud/utils/IdentityProxy.java b/utils/src/com/cloud/utils/IdentityProxy.java
deleted file mode 100644
index 7e385fb..0000000
--- a/utils/src/com/cloud/utils/IdentityProxy.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
-// the License.  You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.utils;
-
-public class IdentityProxy {
-    private String _tableName;
-    private Long _value;
-    private String _idFieldName;
-
-    public IdentityProxy() {
-    }
-
-    public IdentityProxy(String tableName) {
-        _tableName = tableName;
-    }
-
-    public IdentityProxy(String tableName, Long id, String fieldName) {
-    	_tableName = tableName;
-    	_value = id;
-    	_idFieldName = fieldName;
-    }
-    
-    public String getTableName() {
-        return _tableName;
-    }
-
-    public void setTableName(String tableName) {
-        _tableName = tableName;
-    }
-
-    public Long getValue() {
-        return _value;
-    }
-
-    public void setValue(Long value) {
-        _value = value;
-    }
-    
-    public void setidFieldName(String value) {
-    	_idFieldName = value;
-    }
-    
-    public String getidFieldName() {
-    	return _idFieldName;
-    }
-}
diff --git a/utils/src/com/cloud/utils/PropertiesUtil.java b/utils/src/com/cloud/utils/PropertiesUtil.java
index 3909ca8..90f8af8 100755
--- a/utils/src/com/cloud/utils/PropertiesUtil.java
+++ b/utils/src/com/cloud/utils/PropertiesUtil.java
@@ -17,6 +17,8 @@
 package com.cloud.utils;
 
 import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
@@ -28,6 +30,7 @@
 import org.apache.log4j.Logger;
 
 public class PropertiesUtil {
+    private static final Logger s_logger = Logger.getLogger(PropertiesUtil.class);
     /**
      * Searches the class path and local paths to find the config file.
      * @param path path to find.  if it starts with / then it's absolute path.
@@ -116,4 +119,41 @@
         }
         return null;
     }
+
+    // Returns key=value pairs by parsing a commands.properties/config file
+    // with syntax; key=cmd;value (with this syntax cmd is stripped) and key=value
+    public static Map<String, String> processConfigFile(String[] configFiles) {
+        Map<String, String> configMap = new HashMap<String, String>();
+        Properties preProcessedCommands = new Properties();
+        for (String configFile : configFiles) {
+            File commandsFile = findConfigFile(configFile);
+            if (commandsFile != null) {
+                try {
+                    preProcessedCommands.load(new FileInputStream(commandsFile));
+                } catch (FileNotFoundException fnfex) {
+                    // in case of a file within a jar in classpath, try to open stream using url
+                    InputStream stream = PropertiesUtil.openStreamFromURL(configFile);
+                    if (stream != null) {
+                        try {
+                            preProcessedCommands.load(stream);
+                        } catch (IOException e) {
+                            s_logger.error("IO Exception, unable to find properties file:", fnfex);
+                        }
+                    } else {
+                        s_logger.error("Unable to find properites file", fnfex);
+                    }
+                } catch (IOException ioe) {
+                    s_logger.error("IO Exception loading properties file", ioe);
+                }
+            }
+        }
+
+        for (Object key : preProcessedCommands.keySet()) {
+            String preProcessedCommand = preProcessedCommands.getProperty((String) key);
+            int splitIndex = preProcessedCommand.lastIndexOf(";");
+            String value = preProcessedCommand.substring(splitIndex+1);
+            configMap.put((String)key, value);
+        }
+        return configMap;
+    }
 }
diff --git a/utils/src/com/cloud/utils/component/PluggableService.java b/utils/src/com/cloud/utils/component/PluggableService.java
index d219939..5e0e4df 100644
--- a/utils/src/com/cloud/utils/component/PluggableService.java
+++ b/utils/src/com/cloud/utils/component/PluggableService.java
@@ -16,9 +16,12 @@
 // under the License.
 package com.cloud.utils.component;
 
+import java.util.List;
+import java.util.Map;
+
 // This interface defines methods for pluggable code within the Cloud Stack.
 public interface PluggableService {
     // The config command properties filenames that lists allowed API commands
     // and role masks supported by this pluggable service
-    String[] getPropertiesFiles();
+    List<Class<?>> getCommands();
 }
diff --git a/utils/src/com/cloud/utils/db/GenericDao.java b/utils/src/com/cloud/utils/db/GenericDao.java
index 2fae1af..15d04b7 100755
--- a/utils/src/com/cloud/utils/db/GenericDao.java
+++ b/utils/src/com/cloud/utils/db/GenericDao.java
@@ -56,7 +56,7 @@
     T findById(ID id, boolean fresh);
 
     // Finds one unique VO using uuid
-    T findByUuid(ID uuid);
+    T findByUuid(String uuid);
     
     /**
      * @return VO object ready to be used for update.  It won't have any fields filled in.
diff --git a/utils/src/com/cloud/utils/db/GenericDaoBase.java b/utils/src/com/cloud/utils/db/GenericDaoBase.java
index 92e9e1c..880e9de 100755
--- a/utils/src/com/cloud/utils/db/GenericDaoBase.java
+++ b/utils/src/com/cloud/utils/db/GenericDaoBase.java
@@ -915,7 +915,7 @@
 
     @Override @DB(txn=false)
     @SuppressWarnings("unchecked")
-    public T findByUuid(final ID uuid) {
+    public T findByUuid(final String uuid) {
         SearchCriteria<T> sc = createSearchCriteria();
         sc.addAnd("uuid", SearchCriteria.Op.EQ, uuid);
         return findOneBy(sc);
diff --git a/utils/src/com/cloud/utils/exception/CloudRuntimeException.java b/utils/src/com/cloud/utils/exception/CloudRuntimeException.java
index 7807594..3862e22 100755
--- a/utils/src/com/cloud/utils/exception/CloudRuntimeException.java
+++ b/utils/src/com/cloud/utils/exception/CloudRuntimeException.java
@@ -16,24 +16,62 @@
 // under the License.
 package com.cloud.utils.exception;
 
+import java.util.ArrayList;
+
+import com.cloud.utils.AnnotationHelper;
 import com.cloud.utils.SerialVersionUID;
 
 /**
  * wrap exceptions that you know there's no point in dealing with.
  */
-public class CloudRuntimeException extends RuntimeCloudException {
+public class CloudRuntimeException extends RuntimeException {
 
     private static final long serialVersionUID = SerialVersionUID.CloudRuntimeException;
-    
+
+    // This holds a list of uuids and their names. Add uuid:fieldname pairs
+    protected ArrayList<String> idList = new ArrayList<String>();
+
+    protected int csErrorCode;
+
+
     public CloudRuntimeException(String message) {
         super(message);
+        setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
     }
-    
+
     public CloudRuntimeException(String message, Throwable th) {
         super(message, th);
+        setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
     }
-    
-    protected CloudRuntimeException() {
+
+    public CloudRuntimeException() {
         super();
+        setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
+    }
+
+    public void addProxyObject(String uuid) {
+        idList.add(uuid);
+        return;
+    }
+
+    public void addProxyObject(Object voObj, Long id, String idFieldName) {
+        // Get the VO object's table name.
+        String tablename = AnnotationHelper.getTableName(voObj);
+        if (tablename != null) {
+            addProxyObject(tablename, id, idFieldName);
+        }
+        return;
+    }
+
+    public ArrayList<String> getIdProxyList() {
+        return idList;
+    }
+
+    public void setCSErrorCode(int cserrcode) {
+        this.csErrorCode = cserrcode;
+    }
+
+    public int getCSErrorCode() {
+        return this.csErrorCode;
     }
 }
diff --git a/utils/src/com/cloud/utils/exception/HypervisorVersionChangedException.java b/utils/src/com/cloud/utils/exception/HypervisorVersionChangedException.java
index 4f637cb..2c0c1cc 100755
--- a/utils/src/com/cloud/utils/exception/HypervisorVersionChangedException.java
+++ b/utils/src/com/cloud/utils/exception/HypervisorVersionChangedException.java
@@ -18,10 +18,10 @@
 
 import com.cloud.utils.SerialVersionUID;
 
-public class HypervisorVersionChangedException extends RuntimeCloudException {
+public class HypervisorVersionChangedException extends CloudRuntimeException {
 
     private static final long serialVersionUID = SerialVersionUID.CloudRuntimeException;
-    
+
     public HypervisorVersionChangedException(String message) {
         super(message);
     }
diff --git a/utils/src/com/cloud/utils/exception/RuntimeCloudException.java b/utils/src/com/cloud/utils/exception/RuntimeCloudException.java
deleted file mode 100644
index 2334696..0000000
--- a/utils/src/com/cloud/utils/exception/RuntimeCloudException.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
-// the License.  You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.utils.exception;
-
-import com.cloud.utils.AnnotationHelper;
-import com.cloud.utils.IdentityProxy;
-import java.util.ArrayList;
-
-/**
- * by the API response serializer. Any exceptions that are thrown by
- * class, which extends Exception instead of RuntimeException like this
- * class does.
- */
-
-public class RuntimeCloudException extends RuntimeException {
-
-	// This holds a list of uuids and their names. Add uuid:fieldname pairs
-	protected ArrayList<String> idList = new ArrayList<String>();
-
-	protected int csErrorCode;
-
-	public void addProxyObject(String uuid) {
-		idList.add(uuid);
-		return;
-	}
-
-	public RuntimeCloudException(String message) {
-		super(message);
-		setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
-	}
-
-    public RuntimeCloudException(String message, Throwable cause) {
-        super(message, cause);
-        setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
-    }
-
-    public void addProxyObject(Object voObj, Long id, String idFieldName) {
-    	// Get the VO object's table name.
-    	String tablename = AnnotationHelper.getTableName(voObj);
-    	if (tablename != null) {
-    		addProxyObject(tablename, id, idFieldName);
-    	}
-    	return;
-    }
-
-	public RuntimeCloudException() {
-		super();
-		setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
-	}
-
-	public ArrayList<String> getIdProxyList() {
-		return idList;
-	}
-
-	public void setCSErrorCode(int cserrcode) {
-		this.csErrorCode = cserrcode;
-	}
-
-	public int getCSErrorCode() {
-		return this.csErrorCode;
-	}
-}
diff --git a/utils/test/com/cloud/utils/log/CglibThrowableRendererTest.java b/utils/test/com/cloud/utils/log/CglibThrowableRendererTest.java
index 5a9501d..c1cd81e 100644
--- a/utils/test/com/cloud/utils/log/CglibThrowableRendererTest.java
+++ b/utils/test/com/cloud/utils/log/CglibThrowableRendererTest.java
@@ -18,14 +18,21 @@
 
 import junit.framework.TestCase;
 
-import org.apache.log4j.Logger;
+import org.apache.log4j.*;
 
 import com.cloud.utils.component.ComponentLocator;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.exception.CloudRuntimeException;
+import org.apache.log4j.spi.RootLogger;
+import org.apache.log4j.spi.ThrowableRenderer;
+
+import java.io.CharArrayWriter;
+import java.io.Writer;
 
 
 public class CglibThrowableRendererTest extends TestCase {
+    static Logger another = Logger.getLogger("TEST");
+
     private final static Logger s_logger = Logger.getLogger(CglibThrowableRendererTest.class);
     public static class Test {
         @DB
@@ -48,13 +55,40 @@
             }
         }
     }
+
+    private Logger getAlternateLogger(Writer writer, ThrowableRenderer renderer) {
+        Hierarchy hierarchy = new Hierarchy(new RootLogger(Level.INFO));
+        if (renderer != null) {
+            hierarchy.setThrowableRenderer(renderer);
+        }
+        Logger alternateRoot = hierarchy.getRootLogger();
+        alternateRoot.addAppender(new WriterAppender(new SimpleLayout(), writer));
+        return alternateRoot;
+    }
     
     public void testException() {
+        Writer w = new CharArrayWriter();
+        Logger alt = getAlternateLogger(w, null);
+
         Test test = ComponentLocator.inject(Test.class);
         try {
             test.exception();
         } catch (Exception e) {
-            s_logger.warn("exception caught", e);
+            alt.warn("exception caught", e);
         }
+        // first check that we actually have some call traces containing "<generated>"
+        assertTrue(w.toString().contains("<generated>"));
+
+        w = new CharArrayWriter();
+        alt = getAlternateLogger(w, new CglibThrowableRenderer());
+
+        try {
+            test.exception();
+        } catch (Exception e) {
+            alt.warn("exception caught", e);
+        }
+        // then we check that CglibThrowableRenderer indeed remove those occurrences
+        assertFalse(w.toString().contains("<generated>"));
+
     }
 }