You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/01/11 01:01:21 UTC

[29/32] git commit: merged from master

merged from master


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

Branch: refs/heads/javelin
Commit: d6f44a4d6a52484dc2a0d4e343a8e9adce0edd8c
Parents: fac2270 e68294d
Author: Alex Huang <al...@citrix.com>
Authored: Thu Jan 10 15:55:42 2013 -0800
Committer: Alex Huang <al...@citrix.com>
Committed: Thu Jan 10 15:55:42 2013 -0800

----------------------------------------------------------------------
 .../api/commands/CreatePrivateNetworkCmd.java      |    7 +-
 .../cloud/api/commands/DestroyConsoleProxyCmd.java |    2 +-
 .../commands/ListRecurringSnapshotScheduleCmd.java |    2 +-
 api/src/com/cloud/exception/CloudException.java    |    3 +-
 .../apache/cloudstack/acl/APIAccessChecker.java    |    7 +-
 .../apache/cloudstack/api/BaseAsyncCreateCmd.java  |   15 +-
 .../org/apache/cloudstack/api/BaseResponse.java    |    6 +-
 .../command/admin/autoscale/CreateCounterCmd.java  |    6 +-
 .../network/AddNetworkServiceProviderCmd.java      |    5 +-
 .../admin/network/CreatePhysicalNetworkCmd.java    |    5 +-
 .../router/CreateVirtualRouterElementCmd.java      |    6 +-
 .../api/command/admin/usage/AddTrafficTypeCmd.java |    5 +-
 .../command/admin/vpc/CreatePrivateGatewayCmd.java |    5 +-
 .../command/admin/vpc/CreateVPCOfferingCmd.java    |    5 +-
 .../command/user/address/AssociateIPAddrCmd.java   |    4 +-
 .../user/autoscale/CreateAutoScalePolicyCmd.java   |    5 +-
 .../user/autoscale/CreateAutoScaleVmGroupCmd.java  |    5 +-
 .../autoscale/CreateAutoScaleVmProfileCmd.java     |    6 +-
 .../command/user/autoscale/CreateConditionCmd.java |    6 +-
 .../user/firewall/CreateFirewallRuleCmd.java       |    4 +-
 .../user/firewall/CreatePortForwardingRuleCmd.java |    4 +-
 .../loadbalancer/CreateLBStickinessPolicyCmd.java  |    5 +-
 .../loadbalancer/CreateLoadBalancerRuleCmd.java    |    4 +-
 .../user/nat/CreateIpForwardingRuleCmd.java        |    4 +-
 .../command/user/network/CreateNetworkACLCmd.java  |    5 +-
 .../api/command/user/project/CreateProjectCmd.java |    4 +-
 .../command/user/snapshot/CreateSnapshotCmd.java   |    4 +-
 .../command/user/template/CreateTemplateCmd.java   |    7 +-
 .../api/command/user/vm/DeployVMCmd.java           |    4 +-
 .../api/command/user/volume/CreateVolumeCmd.java   |    4 +-
 .../api/command/user/vpc/CreateStaticRouteCmd.java |    5 +-
 .../api/command/user/vpc/CreateVPCCmd.java         |    6 +-
 .../api/command/user/vpn/AddVpnUserCmd.java        |    4 +-
 .../command/user/vpn/CreateRemoteAccessVpnCmd.java |    9 +-
 .../command/user/vpn/CreateVpnConnectionCmd.java   |    4 +-
 .../user/vpn/CreateVpnCustomerGatewayCmd.java      |    3 -
 .../api/command/user/vpn/CreateVpnGatewayCmd.java  |    4 -
 .../command/user/vpn/DeleteVpnConnectionCmd.java   |    3 -
 .../user/vpn/DeleteVpnCustomerGatewayCmd.java      |    3 -
 .../api/command/user/vpn/DeleteVpnGatewayCmd.java  |    3 -
 .../command/user/vpn/ResetVpnConnectionCmd.java    |    3 -
 .../user/vpn/UpdateVpnCustomerGatewayCmd.java      |    6 +-
 .../cloudstack/api/response/CapacityResponse.java  |    1 -
 .../cloudstack/api/response/CreateCmdResponse.java |   18 +--
 .../api/response/ResourceCountResponse.java        |    1 -
 .../apache/cloudstack/api/response/S3Response.java |    9 +-
 .../cloudstack/api/response/TemplateResponse.java  |    9 +-
 .../cloudstack/discovery/ApiDiscoveryService.java  |   29 ---
 client/tomcatconf/components.xml.in                |    3 -
 docs/en-US/accessing-vms.xml                       |   35 ++--
 docs/en-US/aws-api-examples.xml                    |  145 +++++++++++++++
 docs/en-US/aws-ec2-configuration.xml               |  104 ++++++++--
 docs/en-US/aws-ec2-introduction.xml                |   13 +-
 docs/en-US/aws-ec2-requirements.xml                |    9 +-
 docs/en-US/aws-ec2-supported-commands.xml          |    2 +-
 docs/en-US/aws-ec2-timeouts.xml                    |    5 +-
 docs/en-US/aws-ec2-user-setup.xml                  |  108 ++++++-----
 docs/en-US/aws-interface-compatibility.xml         |    3 +-
 docs/en-US/images/compute-service-offerings.png    |  Bin 0 -> 75482 bytes
 docs/en-US/images/view-console-button.png          |  Bin 0 -> 59996 bytes
 .../acl/StaticRoleBasedAPIAccessChecker.java       |   60 +++----
 .../cloudstack/discovery/ApiDiscoveryService.java  |   25 +++
 .../discovery/ApiDiscoveryServiceImpl.java         |   51 ++----
 .../src/com/cloud/netapp/NetappManagerImpl.java    |    2 +-
 .../network/CiscoNexusVSMDeviceManagerImpl.java    |   94 +++++-----
 .../api/commands/ListExternalLoadBalancersCmd.java |    3 +-
 .../commands/ListF5LoadBalancerNetworksCmd.java    |    1 +
 .../element/F5ExternalLoadBalancerElement.java     |    4 +-
 .../element/JuniperSRXExternalFirewallElement.java |    4 +-
 .../ListNetscalerLoadBalancerNetworksCmd.java      |    2 +-
 .../cloud/network/element/NetscalerElement.java    |    4 +-
 pom.xml                                            |    2 +
 server/src/com/cloud/api/ApiGsonHelper.java        |    2 -
 .../src/com/cloud/api/ApiResponseGsonHelper.java   |    4 +-
 server/src/com/cloud/api/ApiResponseHelper.java    |    4 +-
 server/src/com/cloud/api/ApiServer.java            |   75 ++++++--
 server/src/com/cloud/api/IdentityTypeAdapter.java  |   80 --------
 .../cloud/api/response/ApiResponseSerializer.java  |   46 +----
 .../router/VirtualNetworkApplianceManagerImpl.java |   37 ++--
 .../com/cloud/server/ConfigurationServerImpl.java  |    2 +-
 .../src/com/cloud/servlet/CloudStartupServlet.java |   31 +---
 test/integration/smoke/test_iso.py                 |    8 +-
 tools/devcloud-kvm/README.md                       |   21 ++
 tools/devcloud-kvm/devcloud-kvm.cfg                |   97 ++++++++++
 tools/devcloud-kvm/devcloud-kvm.sql                |   40 ++++
 tools/devcloud-kvm/pom.xml                         |  138 ++++++++++++++
 utils/src/com/cloud/utils/IdentityProxy.java       |   60 ------
 .../utils/exception/RuntimeCloudException.java     |    1 -
 .../src/com/cloud/hypervisor/vmware/mo/HostMO.java |   13 +-
 89 files changed, 928 insertions(+), 684 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d6f44a4d/docs/en-US/accessing-vms.xml
----------------------------------------------------------------------
diff --cc docs/en-US/accessing-vms.xml
index 7053996,c77ad4e..ce780cf
--- a/docs/en-US/accessing-vms.xml
+++ b/docs/en-US/accessing-vms.xml
@@@ -5,43 -5,37 +5,36 @@@
  ]>
  
  <!-- Licensed to the Apache Software Foundation (ASF) under one
 - or more contributor license agreements.  See the NOTICE file
 - distributed with this work for additional information
 - regarding copyright ownership.  The ASF licenses this file
 - to you under the Apache License, Version 2.0 (the
 - "License"); you may not use this file except in compliance
 - with the License.  You may obtain a copy of the License at
 - 
 -   http://www.apache.org/licenses/LICENSE-2.0
 - 
 - Unless required by applicable law or agreed to in writing,
 - software distributed under the License is distributed on an
 - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 - KIND, either express or implied.  See the License for the
 - specific language governing permissions and limitations
 - under the License.
 +	or more contributor license agreements.  See the NOTICE file
 +	distributed with this work for additional information
 +	regarding copyright ownership.  The ASF licenses this file
 +	to you under the Apache License, Version 2.0 (the
 +	"License"); you may not use this file except in compliance
 +	with the License.  You may obtain a copy of the License at
 +	
 +	http://www.apache.org/licenses/LICENSE-2.0
 +	
 +	Unless required by applicable law or agreed to in writing,
 +	software distributed under the License is distributed on an
 +	"AS IS" BASIS, WITHOUT 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="accessing-vms">
- 		<title>Accessing VMs</title>
- 	<para>Any user can access their own virtual machines. The administrator can access all VMs running in the cloud.</para>
- 	<para>To access a VM through the &PRODUCT; UI:</para>
- 		<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 <inlinemediaobject>
- 				<imageobject>
- 					<imagedata fileref="./images/console-icon.png"/>
- 				</imageobject>
- 				<textobject>
- 					<phrase>consoleicon.png: button to view the console.</phrase>
- 				</textobject>
- 			</inlinemediaobject></para></listitem>
- 		</orderedlist>
- 		<para>To access a VM directly over the network:</para>
- 		<orderedlist>
- 			<listitem><para>The VM must have some port open to incoming traffic. For example, in a basic zone, a new VM might be assigned to a security group which allows incoming traffic. This depends on what security group you picked when creating the VM. In other cases, you can open a port by setting up a port forwarding policy. See IP Forwarding and Firewalling.</para></listitem>
- 			<listitem><para>If a port is open but you can not access the VM using ssh, it’s possible that ssh is not already enabled on the VM. This will depend on whether ssh is enabled in the template you picked when creating the VM. Access the VM through the &PRODUCT; UI and enable ssh on the machine using the commands for the VM’s operating system.</para></listitem>
- 			<listitem><para>If the network has an external firewall device, you will need to create a firewall rule to allow access. See IP Forwarding and Firewalling.</para></listitem>
- 		</orderedlist>
+         <title>Accessing VMs</title>
+     <para>Any user can access their own virtual machines. The administrator can access all VMs running in the cloud.</para>
+     <para>To access a VM through the &PRODUCT; UI:</para>
+         <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/view-console-button.png"/>.</para></listitem>
+         </orderedlist>
+         <para>To access a VM directly over the network:</para>
+         <orderedlist>
+             <listitem><para>The VM must have some port open to incoming traffic. For example, in a basic zone, a new VM might be assigned to a security group which allows incoming traffic. This depends on what security group you picked when creating the VM. In other cases, you can open a port by setting up a port forwarding policy. See IP Forwarding and Firewalling.</para></listitem>
+             <listitem><para>If a port is open but you can not access the VM using ssh, it’s possible that ssh is not already enabled on the VM. This will depend on whether ssh is enabled in the template you picked when creating the VM. Access the VM through the &PRODUCT; UI and enable ssh on the machine using the commands for the VM’s operating system.</para></listitem>
+             <listitem><para>If the network has an external firewall device, you will need to create a firewall rule to allow access. See IP Forwarding and Firewalling.</para></listitem>
+         </orderedlist>
  </section>
  

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d6f44a4d/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java
----------------------------------------------------------------------
diff --cc plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java
index b6740ed,43ca403..e0c35a5
--- 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
@@@ -21,47 -21,34 +21,44 @@@ import java.io.FileInputStream
  import java.io.FileNotFoundException;
  import java.io.IOException;
  import java.io.InputStream;
 -import java.util.*;
 +import java.util.ArrayList;
 +import java.util.Arrays;
++import java.util.HashSet;
 +import java.util.List;
 +import java.util.Map;
 +import java.util.Properties;
++import java.util.Set;
  
  import javax.ejb.Local;
 +import javax.inject.Inject;
  import javax.naming.ConfigurationException;
  
  import org.apache.log4j.Logger;
  
  import com.cloud.exception.PermissionDeniedException;
- import com.cloud.user.Account;
 -import com.cloud.server.ManagementServer;
 +import com.cloud.user.AccountManager;
- 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.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.
-  */
- 
+ // This is the default API access checker that grab's the user's account
+ // based on the account type, access is granted
  @Local(value=APIAccessChecker.class)
  public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIAccessChecker {
  
      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;
 +
 +    @Inject AccountManager _accountMgr;
 +    @Inject List<PluggableService> _services;
+     private static Set<String> s_userCommands = null;
+     private static Set<String> s_resellerCommands = null; // AKA domain-admin
+     private static Set<String> s_adminCommands = null;
+     private static Set<String> s_resourceDomainAdminCommands = null;
+     private static Set<String> s_allCommands = null;
  
      protected StaticRoleBasedAPIAccessChecker() {
          super();
@@@ -88,21 -72,21 +82,21 @@@
          return commandExists;
      }
  
-     private static boolean isCommandAvailableForAccount(short accountType, String commandName) {
+     private static boolean isCommandAvailableForAccount(RoleType roleType, String commandName) {
          boolean isCommandAvailable = false;
-         switch (accountType) {
-         case Account.ACCOUNT_TYPE_ADMIN:
+         switch (roleType) {
 -            case Admin:
 -                isCommandAvailable = s_adminCommands.contains(commandName);
 -                break;
 -            case DomainAdmin:
 -                isCommandAvailable = s_resellerCommands.contains(commandName);
 -                break;
 -            case ResourceAdmin:
 -                isCommandAvailable = s_resourceDomainAdminCommands.contains(commandName);
 -                break;
 -            case User:
 -                isCommandAvailable = s_userCommands.contains(commandName);
 -                break;
++        case Admin:
 +            isCommandAvailable = s_adminCommands.contains(commandName);
 +            break;
-         case Account.ACCOUNT_TYPE_DOMAIN_ADMIN:
++        case DomainAdmin:
 +            isCommandAvailable = s_resellerCommands.contains(commandName);
 +            break;
-         case Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN:
++        case ResourceAdmin:
 +            isCommandAvailable = s_resourceDomainAdminCommands.contains(commandName);
 +            break;
-         case Account.ACCOUNT_TYPE_NORMAL:
++        case User:
 +            isCommandAvailable = s_userCommands.contains(commandName);
 +            break;
          }
          return isCommandAvailable;
      }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d6f44a4d/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d6f44a4d/plugins/hypervisors/vmware/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d6f44a4d/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d6f44a4d/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d6f44a4d/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d6f44a4d/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d6f44a4d/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/api/ApiServer.java
index b6f82c3,1c1e8ca..c9cabf0
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@@ -51,17 -50,11 +51,20 @@@ import javax.inject.Inject
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.http.HttpSession;
  
 -import com.cloud.utils.ReflectUtil;
  import org.apache.cloudstack.acl.APIAccessChecker;
 +import org.apache.cloudstack.api.BaseAsyncCmd;
 +import org.apache.cloudstack.api.BaseAsyncCreateCmd;
 +import org.apache.cloudstack.api.BaseCmd;
 +import org.apache.cloudstack.api.BaseListCmd;
 +import org.apache.cloudstack.api.ResponseObject;
 +import org.apache.cloudstack.api.ServerApiException;
 +import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
 +import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd;
 +import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd;
 +import org.apache.cloudstack.api.command.admin.user.ListUsersCmd;
+ import org.apache.cloudstack.acl.ControlledEntity;
+ 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;
  import org.apache.cloudstack.api.command.user.event.ListEventsCmd;
@@@ -72,10 -61,8 +75,13 @@@ import org.apache.cloudstack.api.comman
  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;
++<<<<<<< HEAD
 +import org.apache.cloudstack.api.response.ExceptionResponse;
 +import org.apache.cloudstack.api.response.ListResponse;
 +import org.apache.cloudstack.discovery.ApiDiscoveryService;
++=======
++>>>>>>> master
  import org.apache.commons.codec.binary.Base64;
 -import org.apache.http.client.utils.URLEncodedUtils;
  import org.apache.http.ConnectionClosedException;
  import org.apache.http.HttpException;
  import org.apache.http.HttpRequest;
@@@ -143,18 -140,14 +149,18 @@@ public class ApiServer implements HttpR
  
      public static boolean encodeApiResponse = false;
      public static String jsonContentType = "text/javascript";
 -    private ApiDispatcher _dispatcher;
 +    @Inject ApiDispatcher _dispatcher;
 +
 +    @Inject AccountManager _accountMgr;
 +    @Inject DomainManager _domainMgr;
 +    @Inject AsyncJobManager _asyncMgr;
 +    @Inject ConfigurationDao _configDao;
-     @Inject List<APIAccessChecker> _apiAccessCheckers;
  
 -    @Inject private AccountManager _accountMgr = null;
 -    @Inject private DomainManager _domainMgr = null;
 -    @Inject private AsyncJobManager _asyncMgr = null;
 +    @Inject List<PluggableService> _pluggableServices;
 +    @Inject IdentityDao _identityDao;
  
-     protected List<ApiDiscoveryService> _apiDiscoveryServices;
 -    @Inject(adapter = APIAccessChecker.class)
 -    protected Adapters<APIAccessChecker> _apiAccessCheckers;
++    @Inject
++    protected List<APIAccessChecker> _apiAccessCheckers;
  
      private Account _systemAccount = null;
      private User _systemUser = null;
@@@ -169,11 -162,11 +175,11 @@@
          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();
 +            s_instance = new ApiServer();
 +            s_instance = ComponentContext.inject(s_instance);
 +            s_instance.init(apiConfig);
          }
      }
  
@@@ -203,17 -198,20 +208,20 @@@
              }
          }
  
-         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()));
 -        String jsonType = configDao.getValue(Config.JavaScriptDefaultContentType.key());
 +        encodeApiResponse = Boolean.valueOf(_configDao.getValue(Config.EncodeApiResponse.key()));
 +        String jsonType = _configDao.getValue(Config.JavaScriptDefaultContentType.key());
          if (jsonType != null) {
              jsonContentType = jsonType;
          }
@@@ -790,9 -791,39 +799,39 @@@
      }
  
      private boolean isCommandAvailable(User user, String commandName) {
+         if (user == null) {
+             return false;
+         }
+ 
+         Account account = _accountMgr.getAccount(user.getAccountId());
+         if (account == null) {
+             return false;
+         }
+ 
+         RoleType roleType = RoleType.Unknown;
+         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;
 -            default:
 -                return false;
++        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;
++        default:
++            return false;
+         }
+ 
          for (APIAccessChecker apiChecker : _apiAccessCheckers) {
              // Fail the checking if any checker fails to verify
-             if (!apiChecker.canAccessAPI(user, commandName))
+             if (!apiChecker.canAccessAPI(roleType, commandName))
                  return false;
          }
          return true;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d6f44a4d/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d6f44a4d/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/server/ConfigurationServerImpl.java
index 4b4d8df,b25c63f..77de9bb
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@@ -287,7 -281,7 +287,7 @@@ public class ConfigurationServerImpl im
          _identityDao.initializeDefaultUuid("user_ip_address");
          _identityDao.initializeDefaultUuid("counter");
      }
--    */
++     */
  
      private String getMountParent() {
          return getEnvironmentProperty("mount.parent");

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d6f44a4d/server/src/com/cloud/servlet/CloudStartupServlet.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/servlet/CloudStartupServlet.java
index 4b66291,484c7bf..fefcb2f
--- a/server/src/com/cloud/servlet/CloudStartupServlet.java
+++ b/server/src/com/cloud/servlet/CloudStartupServlet.java
@@@ -31,62 -27,48 +27,45 @@@ import com.cloud.api.ApiServer
  import com.cloud.exception.InvalidParameterValueException;
  import com.cloud.server.ConfigurationServer;
  import com.cloud.server.ManagementServer;
- import com.cloud.utils.PropertiesUtil;
  import com.cloud.utils.SerialVersionUID;
 -import com.cloud.utils.component.ComponentLocator;
 +import com.cloud.utils.component.ComponentContext;
  
  public class CloudStartupServlet extends HttpServlet implements ServletContextListener {
 -	public static final Logger s_logger = Logger.getLogger(CloudStartupServlet.class.getName());
 -	
 +    public static final Logger s_logger = Logger.getLogger(CloudStartupServlet.class.getName());
 +
      static final long serialVersionUID = SerialVersionUID.CloudStartupServlet;
 -   
 -    protected static ComponentLocator s_locator;
 -    
 -	@Override
 +
 +    @Override
      public void init() throws ServletException {
-         initLog4j();
- 
 -	    // Save Configuration Values
 +        // Save Configuration Values
-         ConfigurationServer c = ComponentContext.getComponent(ConfigurationServer.class);
+         //ComponentLocator loc = ComponentLocator.getLocator(ConfigurationServer.Name);
 -	    ConfigurationServer c = (ConfigurationServer)ComponentLocator.getComponent(ConfigurationServer.Name);
 -	    //ConfigurationServer c = new ConfigurationServerImpl();
 -	    try {
 -	    	c.persistDefaultValues();
 -	    	s_locator = ComponentLocator.getLocator(ManagementServer.Name);
 -		    ManagementServer ms = (ManagementServer)ComponentLocator.getComponent(ManagementServer.Name);
 -		    ms.enableAdminUser("password");
 -		    ApiServer.initApiServer();
 -	    } catch (InvalidParameterValueException ipve) {
 -	    	s_logger.error("Exception starting management server ", ipve);
 -	    	throw new ServletException (ipve.getMessage());
 -	    } catch (Exception e) {
 -	    	s_logger.error("Exception starting management server ", e);
 -	    	throw new ServletException (e.getMessage());
 -	    }
 -	}
 -	
 -	@Override
 -	public void contextInitialized(ServletContextEvent sce) {
 -	    try {
 -	        init();
 -	    } catch (ServletException e) {
 -	        s_logger.error("Exception starting management server ", e);
 -	        throw new RuntimeException(e);
 -	    }
 -	}
 -	
 -	@Override
 -	public void contextDestroyed(ServletContextEvent sce) {
 -	}
++        ConfigurationServer c = (ConfigurationServer)ComponentContext.getComponent(ConfigurationServer.Name);
++        //ConfigurationServer c = new ConfigurationServerImpl();
 +        try {
 +            c.persistDefaultValues();
- 
-             ManagementServer ms = ComponentContext.getComponent(ManagementServer.class);
-             ms.startup();
++            ManagementServer ms = (ManagementServer)ComponentContext.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());
 +        } catch (Exception e) {
 +            s_logger.error("Exception starting management server ", e);
 +            throw new ServletException (e.getMessage());
 +        }
 +    }
 +
 +    @Override
 +    public void contextInitialized(ServletContextEvent sce) {
 +        try {
 +            init();
 +        } catch (ServletException e) {
 +            s_logger.error("Exception starting management server ", e);
 +            throw new RuntimeException(e);
 +        }
 +    }
 +
 +    @Override
 +    public void contextDestroyed(ServletContextEvent sce) {
 +    }
- 
-     private void initLog4j() {
-         File file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
-         if (file != null) {
-             s_logger.info("log4j configuration found at " + file.getAbsolutePath());
-             DOMConfigurator.configureAndWatch(file.getAbsolutePath());
-         } else {
-             file = PropertiesUtil.findConfigFile("log4j-cloud.properties");
-             if (file != null) {
-                 s_logger.info("log4j configuration found at " + file.getAbsolutePath());
-                 PropertyConfigurator.configureAndWatch(file.getAbsolutePath());
-             }
-         }
-     }
  }