You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2016/05/11 09:42:49 UTC

[01/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6 [Forced Update!]

Repository: cloudstack
Updated Branches:
  refs/heads/4.9-bountycastle-daan 68217c226 -> 4817cb6ab (forced update)


Merge pull request #1485 from remibergsma/fix-ldap-default-domain

Set default networkDomain to empty instead of usernameThe 10th field of `createUserAccount` is `networkDomain` (See `AccountService.java`) and it is set to a var named `admin`, which is the user name.
So, the first user that is created in a domain that links to LDAP, creates the account within the domain, and sets the `networkDomain` field to the username. All next users are created in the same account.

Then we have the situation that in domain SBP we have a user `rbergsma` that logs in first, gets an account created and then (unless you override) all VMs started in the SBP domain will have network domain `rbergsma`. That is highly confusing and not what is should be.

The `linkDomainToLdap` api call has no `networkDomain` field, so I propose to make this field empty (set it to null). It's a sting and null / empty is allowed.

One can also specify the networkDomain when creating a VPC and also there it is allowed to be null.

When te networkDomain is needed (and is not set in the domain and not in the VPC) it is constructed by using `guest.domain.suffix` so there always is a networkDomain to be used.

It makes more sense to manually set it on a domain level, or specify it on the VPC and in the final case end up with something that is clearly generated (like cs342cloud.local) rather than the username of someone else.

* pr/1485:
  Set default networkDomain to empty instead of username

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: f434f50a86c19ed434aea44975e2120689c2b4b6
Parents: 987e800 9e1859e
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 4 10:19:58 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 4 10:19:58 2016 -0400

----------------------------------------------------------------------
 .../src/org/apache/cloudstack/api/command/LinkDomainToLdapCmd.java | 2 +-
 .../ldap/src/org/apache/cloudstack/ldap/LdapAuthenticator.java     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[20/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1534 from shapeblue/niotest-fix

CLOUDSTACK-9348: Optimize NioTest and NioConnection main loop- Reduces SSL handshake timeout to 15s, previously this was only 10s in
  commit debfcdef788ce0d51be06db0ef10f6815f9b563b
- Adds an aggresive explicit wakeup to save the Nio main IO loop/handler from
  getting blocked
- Fix NioTest to fail/succeed in about 60s, previously this was 300s
- Due to aggresive wakeup usage, NioTest should complete in less than 5s on most
  systems. On virtualized environment this may slightly increase due to thread,
  CPU burst/scheduling delays.

/cc @swill  please review and merge.
Sorry about the previous values, they were not optimized for virtualized env. The aggressive selector.wakeup will ensure main IO loop does not get blocked even by malicious users, even for any timeout (ssl handshake etc).

* pr/1534:
  CLOUDSTACK-9348: Optimize NioTest and NioConnection main loop

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 9f970f28b18534dffe33196ead60ea861f501fa9
Parents: 6d0c92b ea22869
Author: Will Stevens <wi...@gmail.com>
Authored: Fri May 6 14:26:26 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Fri May 6 14:26:27 2016 -0400

----------------------------------------------------------------------
 .../src/main/java/com/cloud/utils/nio/Link.java |  4 ++--
 .../java/com/cloud/utils/nio/NioConnection.java |  2 ++
 .../java/com/cloud/utils/testcase/NioTest.java  | 23 ++++++++++++--------
 3 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------



[03/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge release branch 4.8 to master

* 4.8:
  Set default networkDomain to empty instead of username


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: c7d1b8142c2ba02f7ffb726bf18bb098f530885a
Parents: 4d57ec0 234ed9f
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 4 10:22:16 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 4 10:22:16 2016 -0400

----------------------------------------------------------------------
 .../src/org/apache/cloudstack/api/command/LinkDomainToLdapCmd.java | 2 +-
 .../ldap/src/org/apache/cloudstack/ldap/LdapAuthenticator.java     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[39/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/response/UserResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/UserResponse.java b/api/src/org/apache/cloudstack/api/response/UserResponse.java
index 36611ae..cc986b3 100644
--- a/api/src/org/apache/cloudstack/api/response/UserResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/UserResponse.java
@@ -20,6 +20,7 @@ import java.util.Date;
 
 import com.google.gson.annotations.SerializedName;
 
+import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseResponse;
 import org.apache.cloudstack.api.EntityReference;
@@ -65,6 +66,18 @@ public class UserResponse extends BaseResponse {
     @Param(description = "the account type of the user")
     private Short accountType;
 
+    @SerializedName(ApiConstants.ROLE_ID)
+    @Param(description = "the ID of the role")
+    private String roleId;
+
+    @SerializedName(ApiConstants.ROLE_TYPE)
+    @Param(description = "the type of the role")
+    private String roleType;
+
+    @SerializedName(ApiConstants.ROLE_NAME)
+    @Param(description = "the name of the role")
+    private String roleName;
+
     @SerializedName("domainid")
     @Param(description = "the domain ID of the user")
     private String domainId;
@@ -174,6 +187,20 @@ public class UserResponse extends BaseResponse {
         this.accountType = accountType;
     }
 
+    public void setRoleId(String roleId) {
+        this.roleId = roleId;
+    }
+
+    public void setRoleType(RoleType roleType) {
+        if (roleType != null) {
+            this.roleType = roleType.name();
+        }
+    }
+
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
+    }
+
     public String getDomainId() {
         return domainId;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/test/org/apache/cloudstack/acl/RoleTypeTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/acl/RoleTypeTest.java b/api/test/org/apache/cloudstack/acl/RoleTypeTest.java
new file mode 100644
index 0000000..611b761
--- /dev/null
+++ b/api/test/org/apache/cloudstack/acl/RoleTypeTest.java
@@ -0,0 +1,100 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.acl;
+
+import com.cloud.user.Account;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import java.util.Arrays;
+
+public class RoleTypeTest {
+
+    @Test
+    public void testValidRoleTypeFromString() {
+        for (RoleType roleType : RoleType.values()) {
+            Assert.assertEquals(RoleType.fromString(roleType.name()), roleType);
+        }
+    }
+
+    @Test
+    public void testInvalidRoleTypeFromString() {
+        for (String roleType : Arrays.asList(null, "", "admin", "12345%&^*")) {
+            try {
+                RoleType.fromString(roleType);
+                Assert.fail("Invalid roletype provided, exception was expected");
+            } catch (IllegalStateException e) {
+                Assert.assertEquals(e.getMessage(), "Illegal RoleType name provided");
+            }
+        }
+    }
+
+    @Test
+    public void testDefaultRoleMaskByValue() {
+        Assert.assertEquals(RoleType.fromMask(1), RoleType.Admin);
+        Assert.assertEquals(RoleType.fromMask(2), RoleType.ResourceAdmin);
+        Assert.assertEquals(RoleType.fromMask(4), RoleType.DomainAdmin);
+        Assert.assertEquals(RoleType.fromMask(8), RoleType.User);
+        Assert.assertEquals(RoleType.fromMask(0), RoleType.Unknown);
+    }
+
+    @Test
+    public void testGetByAccountType() {
+        Assert.assertEquals(RoleType.getByAccountType(Account.ACCOUNT_TYPE_NORMAL), RoleType.User);
+        Assert.assertEquals(RoleType.getByAccountType(Account.ACCOUNT_TYPE_ADMIN), RoleType.Admin);
+        Assert.assertEquals(RoleType.getByAccountType(Account.ACCOUNT_TYPE_DOMAIN_ADMIN), RoleType.DomainAdmin);
+        Assert.assertEquals(RoleType.getByAccountType(Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN), RoleType.ResourceAdmin);
+        Assert.assertEquals(RoleType.getByAccountType(Account.ACCOUNT_TYPE_PROJECT), RoleType.Unknown);
+    }
+
+    @Test
+    public void testGetRoleByAccountTypeWhenRoleIdIsProvided() {
+        Assert.assertEquals(RoleType.getRoleByAccountType(123L, Account.ACCOUNT_TYPE_ADMIN), Long.valueOf(123L));
+        Assert.assertEquals(RoleType.getRoleByAccountType(1234L, null), Long.valueOf(1234L));
+    }
+
+    @Test
+    public void testGetRoleByAccountTypeForDefaultAccountTypes() {
+        Assert.assertEquals(RoleType.getRoleByAccountType(null, Account.ACCOUNT_TYPE_ADMIN), (Long) RoleType.Admin.getId());
+        Assert.assertEquals(RoleType.getRoleByAccountType(null, Account.ACCOUNT_TYPE_NORMAL), (Long) RoleType.User.getId());
+        Assert.assertEquals(RoleType.getRoleByAccountType(null, Account.ACCOUNT_TYPE_DOMAIN_ADMIN), (Long) RoleType.DomainAdmin.getId());
+        Assert.assertEquals(RoleType.getRoleByAccountType(null, Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN), (Long) RoleType.ResourceAdmin.getId());
+        Assert.assertEquals(RoleType.getRoleByAccountType(null, Account.ACCOUNT_TYPE_PROJECT), null);
+    }
+
+    @Test
+    public void testGetAccountTypeByRoleWhenRoleIsNull() {
+        for (Short accountType: Arrays.asList(
+                Account.ACCOUNT_TYPE_NORMAL,
+                Account.ACCOUNT_TYPE_ADMIN,
+                Account.ACCOUNT_TYPE_DOMAIN_ADMIN,
+                Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN,
+                Account.ACCOUNT_TYPE_PROJECT,
+                (short) 12345)) {
+            Assert.assertEquals(RoleType.getAccountTypeByRole(null, accountType), accountType);
+        }
+    }
+
+    @Test
+    public void testGetAccountTypeByRole() {
+        Role role = Mockito.mock(Role.class);
+        Mockito.when(role.getRoleType()).thenReturn(RoleType.Admin);
+        Mockito.when(role.getId()).thenReturn(100L);
+        Assert.assertEquals(RoleType.getAccountTypeByRole(role, null), (Short) RoleType.Admin.getAccountType());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/test/org/apache/cloudstack/acl/RuleTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/acl/RuleTest.java b/api/test/org/apache/cloudstack/acl/RuleTest.java
new file mode 100644
index 0000000..08bd775
--- /dev/null
+++ b/api/test/org/apache/cloudstack/acl/RuleTest.java
@@ -0,0 +1,98 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.acl;
+
+import com.cloud.exception.InvalidParameterValueException;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Arrays;
+
+public class RuleTest {
+
+    @Test
+    public void testToString() throws Exception {
+        Rule rule = new Rule("someString");
+        Assert.assertEquals(rule.toString(), "someString");
+    }
+
+    @Test
+    public void testMatchesEmpty() throws Exception {
+        Rule rule = new Rule("someString");
+        Assert.assertFalse(rule.matches(""));
+    }
+
+    @Test
+    public void testMatchesNull() throws Exception {
+        Rule rule = new Rule("someString");
+        Assert.assertFalse(rule.matches(null));
+    }
+
+    @Test
+    public void testMatchesSpace() throws Exception {
+        Rule rule = new Rule("someString");
+        Assert.assertFalse(rule.matches(" "));
+    }
+
+    @Test
+    public void testMatchesAPI() throws Exception {
+        Rule rule = new Rule("someApi");
+        Assert.assertTrue(rule.matches("someApi"));
+    }
+
+    @Test
+    public void testMatchesWildcardSuffix() throws Exception {
+        Rule rule = new Rule("list*");
+        Assert.assertTrue(rule.matches("listHosts"));
+    }
+
+    @Test
+    public void testMatchesWildcardPrefix() throws Exception {
+        Rule rule = new Rule("*User");
+        Assert.assertTrue(rule.matches("createUser"));
+    }
+
+    @Test
+    public void testMatchesWildcardMiddle() throws Exception {
+        Rule rule = new Rule("list*s");
+        Assert.assertTrue(rule.matches("listClusters"));
+    }
+
+    @Test
+    public void testValidateRuleWithValidData() throws Exception {
+        for (String rule : Arrays.asList("a", "1", "someApi", "someApi321", "123SomeApi",
+                "prefix*", "*middle*", "*Suffix",
+                "*", "**", "f***", "m0nk3yMa**g1c*")) {
+            Assert.assertEquals(new Rule(rule).toString(), rule);
+        }
+    }
+
+    @Test
+    public void testValidateRuleWithInvalidData() throws Exception {
+        for (String rule : Arrays.asList(null, "", " ", "  ", "\n", "\t", "\r", "\"", "\'",
+                "^someApi$", "^someApi", "some$", "some-Api;", "some,Api",
+                "^", "$", "^$", ".*", "\\w+", "r**l3rd0@Kr3", "j@s1n|+|0\u0237",
+                "[a-z0-9-]+", "^([a-z0-9_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})$")) {
+            try {
+                new Rule(rule);
+                Assert.fail("Invalid rule, exception was expected");
+            } catch (InvalidParameterValueException e) {
+                Assert.assertTrue(e.getMessage().startsWith("Only API names and wildcards are allowed"));
+            }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/test/org/apache/cloudstack/api/command/admin/account/CreateAccountCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/admin/account/CreateAccountCmdTest.java b/api/test/org/apache/cloudstack/api/command/admin/account/CreateAccountCmdTest.java
index c0a046d..b50b226 100644
--- a/api/test/org/apache/cloudstack/api/command/admin/account/CreateAccountCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/admin/account/CreateAccountCmdTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.cloudstack.api.command.admin.account;
 
+import org.apache.cloudstack.acl.RoleService;
 import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.context.CallContext;
@@ -41,10 +42,13 @@ public class CreateAccountCmdTest {
 
     @Mock
     private AccountService accountService;
+    @Mock
+    private RoleService roleService;
 
     @InjectMocks
     private CreateAccountCmd createAccountCmd = new CreateAccountCmd();
 
+    private long roleId = 1L;
     private short accountType = 1;
     private Long domainId = 1L;
 
@@ -69,7 +73,7 @@ public class CreateAccountCmdTest {
         } catch (ServerApiException e) {
             Assert.assertTrue("Received exception as the mock accountService createUserAccount returns null user", true);
         }
-        Mockito.verify(accountService, Mockito.times(1)).createUserAccount(null, "Test", null, null, null, null, null, accountType, domainId, null, null, null, null);
+        Mockito.verify(accountService, Mockito.times(1)).createUserAccount(null, "Test", null, null, null, null, null, accountType, roleId, domainId, null, null, null, null);
     }
 
     @Test
@@ -82,7 +86,7 @@ public class CreateAccountCmdTest {
             Assert.assertEquals(ApiErrorCode.PARAM_ERROR, e.getErrorCode());
             Assert.assertEquals("Empty passwords are not allowed", e.getMessage());
         }
-        Mockito.verify(accountService, Mockito.never()).createUserAccount(null, null, null, null, null, null, null, accountType, domainId, null, null, null, null);
+        Mockito.verify(accountService, Mockito.never()).createUserAccount(null, null, null, null, null, null, null, accountType, roleId, domainId, null, null, null, null);
     }
 
     @Test
@@ -95,6 +99,6 @@ public class CreateAccountCmdTest {
             Assert.assertEquals(ApiErrorCode.PARAM_ERROR, e.getErrorCode());
             Assert.assertEquals("Empty passwords are not allowed", e.getMessage());
         }
-        Mockito.verify(accountService, Mockito.never()).createUserAccount(null, null, null, null, null, null, null, accountType, domainId, null, null, null, null);
+        Mockito.verify(accountService, Mockito.never()).createUserAccount(null, null, null, null, null, null, null, accountType, roleId, domainId, null, null, null, null);
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/test/org/apache/cloudstack/api/command/test/UpdateCfgCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/UpdateCfgCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/UpdateCfgCmdTest.java
index 63c4a03..65b9330 100644
--- a/api/test/org/apache/cloudstack/api/command/test/UpdateCfgCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/UpdateCfgCmdTest.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.test;
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
+import org.apache.cloudstack.acl.RoleService;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -49,21 +50,45 @@ public class UpdateCfgCmdTest extends TestCase {
     }
 
     @Test
+    public void testExecuteForEmptyCfgName() {
+        updateCfgCmd._configService = configService;
+
+        try {
+            updateCfgCmd.execute();
+        } catch (ServerApiException exception) {
+            Assert.assertEquals("Empty configuration name provided", exception.getDescription());
+        }
+    }
+
+    @Test
+    public void testExecuteForRestrictedCfg() {
+        updateCfgCmd._configService = configService;
+        updateCfgCmd.setCfgName(RoleService.EnableDynamicApiChecker.key());
+
+        try {
+            updateCfgCmd.execute();
+        } catch (ServerApiException exception) {
+            Assert.assertEquals("Restricted configuration update not allowed", exception.getDescription());
+        }
+    }
+
+    @Test
     public void testExecuteForEmptyResult() {
         updateCfgCmd._configService = configService;
+        updateCfgCmd.setCfgName("some.cfg");
 
         try {
             updateCfgCmd.execute();
         } catch (ServerApiException exception) {
             Assert.assertEquals("Failed to update config", exception.getDescription());
         }
-
     }
 
     @Test
     public void testExecuteForNullResult() {
 
         updateCfgCmd._configService = configService;
+        updateCfgCmd.setCfgName("some.cfg");
 
         try {
             Mockito.when(configService.updateConfiguration(updateCfgCmd)).thenReturn(null);
@@ -88,6 +113,7 @@ public class UpdateCfgCmdTest extends TestCase {
         Configuration cfg = Mockito.mock(Configuration.class);
         updateCfgCmd._configService = configService;
         updateCfgCmd._responseGenerator = responseGenerator;
+        updateCfgCmd.setCfgName("some.cfg");
 
         try {
             Mockito.when(configService.updateConfiguration(updateCfgCmd)).thenReturn(cfg);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/client/WEB-INF/classes/resources/messages.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties
index fbdedda..5e97907 100644
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -1095,9 +1095,17 @@ label.retry.interval=Retry Interval
 label.review=Review
 label.revoke.project.invite=Revoke invitation
 label.role=Role
+label.roles=Roles
+label.roletype=Role Type
+label.add.role=Add Role
+label.edit.role=Edit Role
+label.delete.role=Delete Role
+message.role.ordering.fail=Reordering of rule permissions aborted as the list has changed while you were making changes. Please try again.
 label.root.certificate=Root certificate
 label.root.disk.controller=Root disk controller
 label.root.disk.offering=Root Disk Offering
+label.permission=Permission
+label.rule=Rule
 label.rules=Rules
 label.running.vms=Running VMs
 label.s3.access_key=Access Key

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index a1e4f60..9bd80b7 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -52,6 +52,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-acl-dynamic-role-based</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
       <artifactId>cloud-plugin-dedicated-resources</artifactId>
       <version>${project.version}</version>
     </dependency>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/debian/cloudstack-management.install
----------------------------------------------------------------------
diff --git a/debian/cloudstack-management.install b/debian/cloudstack-management.install
index 4e016df..c669382 100644
--- a/debian/cloudstack-management.install
+++ b/debian/cloudstack-management.install
@@ -18,7 +18,6 @@
 /etc/cloudstack/management/catalina.policy
 /etc/cloudstack/management/catalina.properties
 /etc/cloudstack/management/logging.properties
-/etc/cloudstack/management/commands.properties
 /etc/cloudstack/management/ehcache.xml
 /etc/cloudstack/management/server-ssl.xml
 /etc/cloudstack/management/server-nonssl.xml

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/debian/control
----------------------------------------------------------------------
diff --git a/debian/control b/debian/control
index 05058a8..6e7881b 100644
--- a/debian/control
+++ b/debian/control
@@ -15,7 +15,7 @@ Description: A common package which contains files which are shared by several C
 
 Package: cloudstack-management
 Architecture: all
-Depends: ${misc:Depends}, ${python:Depends}, cloudstack-common (= ${source:Version}), tomcat6, sudo, jsvc, python-mysql.connector, libmysql-java, augeas-tools, mysql-client, adduser, bzip2
+Depends: ${misc:Depends}, ${python:Depends}, cloudstack-common (= ${source:Version}), tomcat6 | tomcat7, sudo, jsvc, python-mysql.connector, libmysql-java, augeas-tools, mysql-client, adduser, bzip2
 Conflicts: cloud-server, cloud-client, cloud-client-ui
 Description: CloudStack server library
  The CloudStack management server

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/developer/developer-prefill.sql
----------------------------------------------------------------------
diff --git a/developer/developer-prefill.sql b/developer/developer-prefill.sql
index f874118..0dbe180 100644
--- a/developer/developer-prefill.sql
+++ b/developer/developer-prefill.sql
@@ -106,6 +106,11 @@ INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
             VALUES ('Advanced', 'DEFAULT', 'management-server',
             'direct.agent.load.size', '1000');
 
+-- Enable dynamic RBAC by default for fresh deployments
+INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
+            VALUES ('Advanced', 'DEFAULT', 'RoleService',
+            'dynamic.apichecker.enabled', 'true');
+
 -- Add developer configuration entry; allows management server to be run as a user other than "cloud"
 INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
             VALUES ('Advanced', 'DEFAULT', 'management-server',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
----------------------------------------------------------------------
diff --git a/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml b/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
index 67ed2a7..a3d58fc 100644
--- a/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
+++ b/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
@@ -113,6 +113,8 @@
   <!--
     DAOs with default configuration
   -->
+  <bean id="roleDaoImpl" class="org.apache.cloudstack.acl.dao.RoleDaoImpl" />
+  <bean id="rolePermissionsDaoImpl" class="org.apache.cloudstack.acl.dao.RolePermissionsDaoImpl" />
   <bean id="accountDaoImpl" class="com.cloud.user.dao.AccountDaoImpl" />
   <bean id="accountDetailsDaoImpl" class="com.cloud.user.AccountDetailsDaoImpl" />
   <bean id="accountJoinDaoImpl" class="com.cloud.api.query.dao.AccountJoinDaoImpl" />

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/engine/schema/src/com/cloud/upgrade/dao/Upgrade481to490.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade481to490.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade481to490.java
index 9e52134..d1240ec 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade481to490.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade481to490.java
@@ -17,12 +17,21 @@
 
 package com.cloud.upgrade.dao;
 
+import com.cloud.utils.PropertiesUtil;
+import com.cloud.utils.db.ScriptRunner;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.script.Script;
+import org.apache.cloudstack.acl.RoleType;
 import org.apache.log4j.Logger;
 
 import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
 import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Map;
 
 public class Upgrade481to490 implements DbUpgrade {
     final static Logger s_logger = Logger.getLogger(Upgrade481to490.class);
@@ -53,6 +62,71 @@ public class Upgrade481to490 implements DbUpgrade {
 
     @Override
     public void performDataMigration(Connection conn) {
+        setupRolesAndPermissionsForDynamicChecker(conn);
+    }
+
+    private void migrateAccountsToDefaultRoles(final Connection conn) {
+        try (final PreparedStatement selectStatement = conn.prepareStatement("SELECT `id`, `type` FROM `cloud`.`account`;");
+             final ResultSet selectResultSet = selectStatement.executeQuery()) {
+            while (selectResultSet.next()) {
+                final Long accountId = selectResultSet.getLong(1);
+                final Short accountType = selectResultSet.getShort(2);
+                final Long roleId = RoleType.getByAccountType(accountType).getId();
+                if (roleId < 1L || roleId > 4L) {
+                    s_logger.warn("Skipping role ID migration due to invalid role_id resolved for account id=" + accountId);
+                    continue;
+                }
+                try (final PreparedStatement updateStatement = conn.prepareStatement("UPDATE `cloud`.`account` SET account.role_id = ? WHERE account.id = ? ;")) {
+                    updateStatement.setLong(1, roleId);
+                    updateStatement.setLong(2, accountId);
+                    updateStatement.executeUpdate();
+                } catch (SQLException e) {
+                    s_logger.error("Failed to update cloud.account role_id for account id:" + accountId + " with exception: " + e.getMessage());
+                    throw new CloudRuntimeException("Exception while updating cloud.account role_id", e);
+                }
+            }
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Exception while migrating existing account table's role_id column to a role based on account type", e);
+        }
+        s_logger.debug("Done migrating existing accounts to use one of default roles based on account type");
+    }
+
+    private void setupRolesAndPermissionsForDynamicChecker(final Connection conn) {
+        final String alterTableSql = "ALTER TABLE `cloud`.`account` " +
+                "ADD COLUMN `role_id` bigint(20) unsigned COMMENT 'role id for this account' AFTER `type`, " +
+                "ADD KEY `fk_account__role_id` (`role_id`), " +
+                "ADD CONSTRAINT `fk_account__role_id` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`);";
+        try (final PreparedStatement pstmt = conn.prepareStatement(alterTableSql)) {
+            pstmt.executeUpdate();
+        } catch (SQLException e) {
+            if (e.getMessage().contains("role_id")) {
+                s_logger.warn("cloud.account table already has the role_id column, skipping altering table and migration of accounts");
+                return;
+            } else {
+                throw new CloudRuntimeException("Unable to create column quota_calculated in table cloud_usage.cloud_usage", e);
+            }
+        }
+
+        migrateAccountsToDefaultRoles(conn);
+
+        final Map<String, String> apiMap = PropertiesUtil.processConfigFile(new String[] { PropertiesUtil.getDefaultApiCommandsFileName() });
+        if (apiMap == null || apiMap.isEmpty()) {
+            if (s_logger.isDebugEnabled()) {
+                s_logger.debug("The commands.properties file and default role permissions were not found. " +
+                        "Assuming new installation, configuring default role-api mappings.");
+            }
+            String script = Script.findScript("", "db/create-default-role-api-mappings.sql");
+            if (script == null) {
+                s_logger.error("Unable to find default role-api mapping sql file, please configure api per role manually");
+                return;
+            }
+            try(final FileReader reader = new FileReader(new File(script))) {
+                ScriptRunner runner = new ScriptRunner(conn, false, true);
+                runner.runScript(reader);
+            } catch (SQLException | IOException e) {
+                s_logger.error("Unable to insert default api-role mappings from file: " + script + ". Please configure api per role manually, giving up!", e);
+            }
+        }
     }
 
     @Override
@@ -61,7 +135,6 @@ public class Upgrade481to490 implements DbUpgrade {
         if (script == null) {
             throw new CloudRuntimeException("Unable to find db/schema-481to490-cleanup.sql");
         }
-
         return new File[] {new File(script)};
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/engine/schema/src/com/cloud/user/AccountVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/user/AccountVO.java b/engine/schema/src/com/cloud/user/AccountVO.java
index 0f5a044..a504d2f 100644
--- a/engine/schema/src/com/cloud/user/AccountVO.java
+++ b/engine/schema/src/com/cloud/user/AccountVO.java
@@ -16,8 +16,8 @@
 // under the License.
 package com.cloud.user;
 
-import java.util.Date;
-import java.util.UUID;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.acl.RoleType;
 
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -27,8 +27,8 @@ import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Table;
-
-import com.cloud.utils.db.GenericDao;
+import java.util.Date;
+import java.util.UUID;
 
 @Entity
 @Table(name = "account")
@@ -44,6 +44,9 @@ public class AccountVO implements Account {
     @Column(name = "type")
     private short type = ACCOUNT_TYPE_NORMAL;
 
+    @Column(name = "role_id")
+    private Long roleId;
+
     @Column(name = "domain_id")
     private long domainId;
 
@@ -78,13 +81,21 @@ public class AccountVO implements Account {
         uuid = UUID.randomUUID().toString();
     }
 
-    public AccountVO(String accountName, long domainId, String networkDomain, short type, String uuid) {
+    public AccountVO(final String accountName, final long domainId, final String networkDomain, final short type, final String uuid) {
         this.accountName = accountName;
         this.domainId = domainId;
         this.networkDomain = networkDomain;
         this.type = type;
-        state = State.enabled;
+        this.state = State.enabled;
         this.uuid = uuid;
+        this.roleId = RoleType.getRoleByAccountType(null, type);
+    }
+
+    public AccountVO(final String accountName, final long domainId, final String networkDomain, final short type, final Long roleId, final String uuid) {
+        this(accountName, domainId, networkDomain, type, uuid);
+        if (roleId != null) {
+            this.roleId = roleId;
+        }
     }
 
     public void setNeedsCleanup(boolean value) {
@@ -122,6 +133,14 @@ public class AccountVO implements Account {
         this.type = type;
     }
 
+    public Long getRoleId() {
+        return roleId;
+    }
+
+    public void setRoleId(long roleId) {
+        this.roleId = roleId;
+    }
+
     @Override
     public long getDomainId() {
         return domainId;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/engine/schema/src/com/cloud/user/dao/AccountDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/user/dao/AccountDao.java b/engine/schema/src/com/cloud/user/dao/AccountDao.java
index 4c7ce8e..374c9cc 100644
--- a/engine/schema/src/com/cloud/user/dao/AccountDao.java
+++ b/engine/schema/src/com/cloud/user/dao/AccountDao.java
@@ -41,6 +41,8 @@ public interface AccountDao extends GenericDao<AccountVO, Long> {
 
     List<AccountVO> findActiveAccountsForDomain(Long domain);
 
+    List<AccountVO> findAccountsByRole(Long roleId);
+
     void markForCleanup(long accountId);
 
     List<AccountVO> listAccounts(String accountName, Long domainId, Filter filter);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/engine/schema/src/com/cloud/user/dao/AccountDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/user/dao/AccountDaoImpl.java b/engine/schema/src/com/cloud/user/dao/AccountDaoImpl.java
index bff6213..2789150 100644
--- a/engine/schema/src/com/cloud/user/dao/AccountDaoImpl.java
+++ b/engine/schema/src/com/cloud/user/dao/AccountDaoImpl.java
@@ -44,7 +44,7 @@ import com.cloud.utils.db.TransactionLegacy;
 public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements AccountDao {
     private static final Logger s_logger = Logger.getLogger(AccountDaoImpl.class);
     private static final String FIND_USER_ACCOUNT_BY_API_KEY = "SELECT u.id, u.username, u.account_id, u.secret_key, u.state, "
-        + "a.id, a.account_name, a.type, a.domain_id, a.state " + "FROM `cloud`.`user` u, `cloud`.`account` a "
+        + "a.id, a.account_name, a.type, a.role_id, a.domain_id, a.state " + "FROM `cloud`.`user` u, `cloud`.`account` a "
         + "WHERE u.account_id = a.id AND u.api_key = ? and u.removed IS NULL";
 
     protected final SearchBuilder<AccountVO> AllFieldsSearch;
@@ -53,6 +53,7 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
     protected final SearchBuilder<AccountVO> CleanupForRemovedAccountsSearch;
     protected final SearchBuilder<AccountVO> CleanupForDisabledAccountsSearch;
     protected final SearchBuilder<AccountVO> NonProjectAccountSearch;
+    protected final SearchBuilder<AccountVO> AccountByRoleSearch;
     protected final GenericSearchBuilder<AccountVO, Long> AccountIdsSearch;
 
     public AccountDaoImpl() {
@@ -96,6 +97,10 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
         AccountIdsSearch.selectFields(AccountIdsSearch.entity().getId());
         AccountIdsSearch.and("ids", AccountIdsSearch.entity().getDomainId(), Op.IN);
         AccountIdsSearch.done();
+
+        AccountByRoleSearch = createSearchBuilder();
+        AccountByRoleSearch.and("roleId", AccountByRoleSearch.entity().getRoleId(), SearchCriteria.Op.EQ);
+        AccountByRoleSearch.done();
     }
 
     @Override
@@ -140,8 +145,9 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
                 AccountVO a = new AccountVO(rs.getLong(6));
                 a.setAccountName(rs.getString(7));
                 a.setType(rs.getShort(8));
-                a.setDomainId(rs.getLong(9));
-                a.setState(State.valueOf(rs.getString(10)));
+                a.setRoleId(rs.getLong(9));
+                a.setDomainId(rs.getLong(10));
+                a.setState(State.valueOf(rs.getString(11)));
 
                 userAcctPair = new Pair<User, Account>(u, a);
             }
@@ -259,6 +265,13 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
     }
 
     @Override
+    public List<AccountVO> findAccountsByRole(Long roleId) {
+        SearchCriteria<AccountVO> sc = AccountByRoleSearch.create();
+        sc.setParameters("roleId", roleId);
+        return listBy(sc);
+    }
+
+    @Override
     public void markForCleanup(long accountId) {
         AccountVO account = findByIdIncludingRemoved(accountId);
         if (!account.getNeedsCleanup()) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/engine/schema/src/org/apache/cloudstack/acl/RolePermissionVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/acl/RolePermissionVO.java b/engine/schema/src/org/apache/cloudstack/acl/RolePermissionVO.java
new file mode 100644
index 0000000..a81cebb
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/acl/RolePermissionVO.java
@@ -0,0 +1,120 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.acl;
+
+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 java.util.UUID;
+
+@Entity
+@Table(name = "role_permissions")
+public class RolePermissionVO implements RolePermission {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "uuid")
+    private String uuid;
+
+    @Column(name = "role_id")
+    private long roleId;
+
+    @Column(name = "rule")
+    private String rule;
+
+    @Column(name = "permission", nullable = false)
+    @Enumerated(value = EnumType.STRING)
+    private Permission permission = RolePermission.Permission.DENY;
+
+    @Column(name = "description")
+    private String description;
+
+    @Column(name = "sort_order")
+    private long sortOrder = 0;
+
+    public RolePermissionVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public RolePermissionVO(final long roleId, final String rule, final Permission permission, final String description) {
+        this();
+        this.roleId = roleId;
+        this.rule = rule;
+        this.permission = permission;
+        this.description = description;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public String getUuid() {
+        return uuid;
+    }
+
+    public long getRoleId() {
+        return roleId;
+    }
+
+    public void setRoleId(long roleId) {
+        this.roleId = roleId;
+    }
+
+    @Override
+    public Rule getRule() {
+        return new Rule(rule);
+    }
+
+    public void setRule(String rule) {
+        this.rule = rule;
+    }
+
+    @Override
+    public Permission getPermission() {
+        return permission;
+    }
+
+    public void setPermission(Permission permission) {
+        this.permission = permission;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public long getSortOrder() {
+        return sortOrder;
+    }
+
+    public void setSortOrder(long sortOrder) {
+        this.sortOrder = sortOrder;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/engine/schema/src/org/apache/cloudstack/acl/RoleVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/acl/RoleVO.java b/engine/schema/src/org/apache/cloudstack/acl/RoleVO.java
new file mode 100644
index 0000000..f3404ab
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/acl/RoleVO.java
@@ -0,0 +1,106 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.acl;
+
+import com.cloud.utils.db.GenericDao;
+
+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 java.util.Date;
+import java.util.UUID;
+
+@Entity
+@Table(name = "roles")
+public class RoleVO implements Role {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "uuid")
+    private String uuid;
+
+    @Column(name = "name")
+    private String name;
+
+    @Column(name = "role_type", nullable = false)
+    @Enumerated(value = EnumType.STRING)
+    private RoleType roleType = RoleType.User;
+
+    @Column(name = "description")
+    private String description;
+
+    @Column(name = GenericDao.REMOVED_COLUMN)
+    private Date removed;
+
+    public RoleVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public RoleVO(final String name, final RoleType roleType, final String description) {
+        this();
+        this.name = name;
+        this.roleType = roleType;
+        this.description = description;
+    }
+
+    public RoleVO(final long id, final String name, final RoleType roleType, final String description) {
+        this(name, roleType, description);
+        this.id = id;
+    }
+
+    @Override
+    public String getUuid() {
+        return uuid;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public RoleType getRoleType() {
+        return roleType;
+    }
+
+    public void setRoleType(RoleType roleType) {
+        this.roleType = roleType;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/engine/schema/src/org/apache/cloudstack/acl/dao/RoleDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/acl/dao/RoleDao.java b/engine/schema/src/org/apache/cloudstack/acl/dao/RoleDao.java
new file mode 100644
index 0000000..e53654d
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/acl/dao/RoleDao.java
@@ -0,0 +1,29 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.acl.dao;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.acl.RoleVO;
+
+import java.util.List;
+
+public interface RoleDao extends GenericDao<RoleVO, Long> {
+    List<RoleVO> findAllByName(String roleName);
+    List<RoleVO> findAllByRoleType(RoleType type);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/engine/schema/src/org/apache/cloudstack/acl/dao/RoleDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/acl/dao/RoleDaoImpl.java b/engine/schema/src/org/apache/cloudstack/acl/dao/RoleDaoImpl.java
new file mode 100644
index 0000000..c7eb496
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/acl/dao/RoleDaoImpl.java
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.acl.dao;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.acl.RoleVO;
+import org.springframework.stereotype.Component;
+
+import javax.ejb.Local;
+import java.util.List;
+
+@Component
+@Local(value = {RoleDao.class})
+public class RoleDaoImpl extends GenericDaoBase<RoleVO, Long> implements RoleDao {
+    private final SearchBuilder<RoleVO> RoleByNameSearch;
+    private final SearchBuilder<RoleVO> RoleByTypeSearch;
+
+    public RoleDaoImpl() {
+        super();
+
+        RoleByNameSearch = createSearchBuilder();
+        RoleByNameSearch.and("roleName", RoleByNameSearch.entity().getName(), SearchCriteria.Op.LIKE);
+        RoleByNameSearch.done();
+
+        RoleByTypeSearch = createSearchBuilder();
+        RoleByTypeSearch.and("roleType", RoleByTypeSearch.entity().getRoleType(), SearchCriteria.Op.EQ);
+        RoleByTypeSearch.done();
+    }
+
+    @Override
+    public List<RoleVO> findAllByName(final String roleName) {
+        SearchCriteria<RoleVO> sc = RoleByNameSearch.create();
+        sc.setParameters("roleName", "%" + roleName + "%");
+        return listBy(sc);
+    }
+
+    @Override
+    public List<RoleVO> findAllByRoleType(final RoleType type) {
+        SearchCriteria<RoleVO> sc = RoleByTypeSearch.create();
+        sc.setParameters("roleType", type);
+        return listBy(sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/engine/schema/src/org/apache/cloudstack/acl/dao/RolePermissionsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/acl/dao/RolePermissionsDao.java b/engine/schema/src/org/apache/cloudstack/acl/dao/RolePermissionsDao.java
new file mode 100644
index 0000000..3754491
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/acl/dao/RolePermissionsDao.java
@@ -0,0 +1,49 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.acl.dao;
+
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.acl.Role;
+import org.apache.cloudstack.acl.RolePermission;
+import org.apache.cloudstack.acl.RolePermissionVO;
+
+import java.util.List;
+
+public interface RolePermissionsDao extends GenericDao<RolePermissionVO, Long> {
+    /**
+     * Adds a new role permission at the end of the list of role permissions
+     * @param item the new role permission
+     * @return returns persisted role permission
+     */
+    RolePermissionVO persist(final RolePermissionVO item);
+
+    /**
+     * Moves an existing role permission under a given parent role permission
+     * @param role the existing role
+     * @param newOrder the new role permissions order
+     * @return returns true on success
+     */
+    boolean update(final Role role, final List<RolePermission> newOrder);
+
+    /**
+     * Returns ordered linked-list of role permission for a given role
+     * @param roleId the ID of the role
+     * @return returns list of role permissions
+     */
+    List<RolePermissionVO> findAllByRoleIdSorted(Long roleId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/engine/schema/src/org/apache/cloudstack/acl/dao/RolePermissionsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/acl/dao/RolePermissionsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/acl/dao/RolePermissionsDaoImpl.java
new file mode 100644
index 0000000..960b652
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/acl/dao/RolePermissionsDaoImpl.java
@@ -0,0 +1,166 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.acl.dao;
+
+import com.cloud.utils.db.Attribute;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.TransactionCallback;
+import com.cloud.utils.db.TransactionStatus;
+import com.cloud.utils.db.UpdateBuilder;
+import com.cloud.utils.exception.CloudRuntimeException;
+import org.apache.cloudstack.acl.Role;
+import org.apache.cloudstack.acl.RolePermission;
+import org.apache.cloudstack.acl.RolePermissionVO;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import javax.ejb.Local;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+@Component
+@Local(value = {RolePermissionsDao.class})
+public class RolePermissionsDaoImpl extends GenericDaoBase<RolePermissionVO, Long> implements RolePermissionsDao {
+    protected static final Logger LOGGER = Logger.getLogger(RolePermissionsDaoImpl.class);
+
+    private final SearchBuilder<RolePermissionVO> RolePermissionsSearch;
+    private Attribute sortOrderAttribute;
+
+    public RolePermissionsDaoImpl() {
+        super();
+
+        RolePermissionsSearch = createSearchBuilder();
+        RolePermissionsSearch.and("uuid", RolePermissionsSearch.entity().getUuid(), SearchCriteria.Op.EQ);
+        RolePermissionsSearch.and("roleId", RolePermissionsSearch.entity().getRoleId(), SearchCriteria.Op.EQ);
+        RolePermissionsSearch.and("sortOrder", RolePermissionsSearch.entity().getSortOrder(), SearchCriteria.Op.EQ);
+        RolePermissionsSearch.done();
+
+        sortOrderAttribute = _allAttributes.get("sortOrder");
+
+        assert (sortOrderAttribute != null) : "Couldn't find one of these attributes";
+    }
+
+    private boolean updateSortOrder(final RolePermissionVO permissionBeingMoved, final RolePermissionVO parentPermission) {
+        if (parentPermission != null && permissionBeingMoved.getId() == parentPermission.getId()) {
+            return true;
+        }
+        final List<RolePermissionVO> newOrderedPermissionsList = new ArrayList<>();
+        // Null parent implies item needs to move to the top
+        if (parentPermission == null) {
+            newOrderedPermissionsList.add(permissionBeingMoved);
+        }
+        for (final RolePermissionVO permission : findAllByRoleIdSorted(permissionBeingMoved.getRoleId())) {
+            if (permission.getId() == permissionBeingMoved.getId()) {
+                continue;
+            }
+            newOrderedPermissionsList.add(permission);
+            if (parentPermission != null && permission.getId() == parentPermission.getId()) {
+                newOrderedPermissionsList.add(permissionBeingMoved);
+            }
+        }
+        long sortOrder = 0L;
+        for (final RolePermissionVO permission : newOrderedPermissionsList) {
+            permission.setSortOrder(sortOrder++);
+            if (!update(permission.getId(), permission)) {
+                LOGGER.warn("Failed to update item's sort order with id:" + permission.getId() + " while moving permission with id:" + permissionBeingMoved.getId() + " to a new position");
+                return false;
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public RolePermissionVO persist(final RolePermissionVO item) {
+        item.setSortOrder(0);
+        final List<RolePermissionVO> permissionsList = findAllByRoleIdSorted(item.getRoleId());
+        if (permissionsList != null && permissionsList.size() > 0) {
+            RolePermission lastRule = permissionsList.get(permissionsList.size() - 1);
+            item.setSortOrder(lastRule.getSortOrder() + 1);
+        }
+        return super.persist(item);
+    }
+
+    @Override
+    public boolean update(final Role role, final List<RolePermission> newOrder) {
+        if (role == null || newOrder == null || newOrder.isEmpty()) {
+            return false;
+        }
+        return Transaction.execute(new TransactionCallback<Boolean>() {
+            @Override
+            public Boolean doInTransaction(TransactionStatus status) {
+                final String failMessage = "The role's rule permissions list has changed while you were making updates, aborted re-ordering of rules. Please try again.";
+                final List<RolePermissionVO> currentOrder = findAllByRoleIdSorted(role.getId());
+                if (role.getId() < 1L || newOrder.size() != currentOrder.size()) {
+                    throw new CloudRuntimeException(failMessage);
+                }
+                final Set<Long> newOrderSet = new HashSet<>();
+                for (final RolePermission permission : newOrder) {
+                    if (permission == null) {
+                        continue;
+                    }
+                    newOrderSet.add(permission.getId());
+                }
+                final Set<Long> currentOrderSet = new HashSet<>();
+                for (final RolePermission permission : currentOrder) {
+                    currentOrderSet.add(permission.getId());
+                }
+                if (!newOrderSet.equals(currentOrderSet)) {
+                    throw new CloudRuntimeException(failMessage);
+                }
+                long sortOrder = 0L;
+                for (RolePermission rolePermission : newOrder) {
+                    final SearchCriteria<RolePermissionVO> sc = RolePermissionsSearch.create();
+                    sc.setParameters("uuid", rolePermission.getUuid());
+                    sc.setParameters("roleId", role.getId());
+                    sc.setParameters("sortOrder", rolePermission.getSortOrder());
+
+                    final UpdateBuilder ub = getUpdateBuilder(rolePermission);
+                    ub.set(rolePermission, sortOrderAttribute, sortOrder);
+                    final int result = update(ub, sc, null);
+                    if (result < 1) {
+                        throw new CloudRuntimeException(failMessage);
+                    }
+                    sortOrder++;
+                }
+                return true;
+            }
+        });
+    }
+
+    @Override
+    public List<RolePermissionVO> findAllByRoleIdSorted(final Long roleId) {
+        final SearchCriteria<RolePermissionVO> sc = RolePermissionsSearch.create();
+        if (roleId != null && roleId > 0L) {
+            sc.setParameters("roleId", roleId);
+        }
+        final Filter searchBySorted = new Filter(RolePermissionVO.class, "sortOrder", true, null, null);
+        searchBySorted.addOrderBy(RolePermissionVO.class, "id", true);
+        final List<RolePermissionVO> rolePermissionList = listBy(sc, searchBySorted);
+        if (rolePermissionList == null) {
+            return Collections.emptyList();
+        }
+        return rolePermissionList;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/plugins/acl/dynamic-role-based/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/acl/dynamic-role-based/pom.xml b/plugins/acl/dynamic-role-based/pom.xml
new file mode 100644
index 0000000..96d7e53
--- /dev/null
+++ b/plugins/acl/dynamic-role-based/pom.xml
@@ -0,0 +1,32 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<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-plugin-acl-dynamic-role-based</artifactId>
+  <name>Apache CloudStack Plugin - ACL Dynamic Role Based</name>
+  <parent>
+    <groupId>org.apache.cloudstack</groupId>
+    <artifactId>cloudstack-plugins</artifactId>
+    <version>4.9.0-SNAPSHOT</version>
+    <relativePath>../../pom.xml</relativePath>
+  </parent>
+</project>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/plugins/acl/dynamic-role-based/resources/META-INF/cloudstack/acl-dynamic-role-based/module.properties
----------------------------------------------------------------------
diff --git a/plugins/acl/dynamic-role-based/resources/META-INF/cloudstack/acl-dynamic-role-based/module.properties b/plugins/acl/dynamic-role-based/resources/META-INF/cloudstack/acl-dynamic-role-based/module.properties
new file mode 100644
index 0000000..dda9998
--- /dev/null
+++ b/plugins/acl/dynamic-role-based/resources/META-INF/cloudstack/acl-dynamic-role-based/module.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+name=acl-dynamic-role-based
+parent=api

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/plugins/acl/dynamic-role-based/resources/META-INF/cloudstack/acl-dynamic-role-based/spring-acl-dynamic-role-based-context.xml
----------------------------------------------------------------------
diff --git a/plugins/acl/dynamic-role-based/resources/META-INF/cloudstack/acl-dynamic-role-based/spring-acl-dynamic-role-based-context.xml b/plugins/acl/dynamic-role-based/resources/META-INF/cloudstack/acl-dynamic-role-based/spring-acl-dynamic-role-based-context.xml
new file mode 100644
index 0000000..9ffe465
--- /dev/null
+++ b/plugins/acl/dynamic-role-based/resources/META-INF/cloudstack/acl-dynamic-role-based/spring-acl-dynamic-role-based-context.xml
@@ -0,0 +1,33 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+                      >
+
+    <bean id="DynamicRoleBasedAPIAccessChecker" class="org.apache.cloudstack.acl.DynamicRoleBasedAPIAccessChecker" >
+        <property name="services" value="#{apiCommandsRegistry.registered}" />
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/plugins/acl/dynamic-role-based/src/org/apache/cloudstack/acl/DynamicRoleBasedAPIAccessChecker.java
----------------------------------------------------------------------
diff --git a/plugins/acl/dynamic-role-based/src/org/apache/cloudstack/acl/DynamicRoleBasedAPIAccessChecker.java b/plugins/acl/dynamic-role-based/src/org/apache/cloudstack/acl/DynamicRoleBasedAPIAccessChecker.java
new file mode 100644
index 0000000..754d4cc
--- /dev/null
+++ b/plugins/acl/dynamic-role-based/src/org/apache/cloudstack/acl/DynamicRoleBasedAPIAccessChecker.java
@@ -0,0 +1,144 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES 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.acl;
+
+import com.cloud.exception.PermissionDeniedException;
+import com.cloud.user.Account;
+import com.cloud.user.AccountService;
+import com.cloud.user.User;
+import com.cloud.utils.component.AdapterBase;
+import com.cloud.utils.component.PluggableService;
+import com.google.common.base.Strings;
+import org.apache.cloudstack.api.APICommand;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+@Local(value = APIChecker.class)
+public class DynamicRoleBasedAPIAccessChecker extends AdapterBase implements APIChecker {
+
+    @Inject
+    private AccountService accountService;
+    @Inject
+    private RoleService roleService;
+
+    private List<PluggableService> services;
+    private Map<RoleType, Set<String>> annotationRoleBasedApisMap = new HashMap<>();
+
+    protected DynamicRoleBasedAPIAccessChecker() {
+        super();
+        for (RoleType roleType : RoleType.values()) {
+            annotationRoleBasedApisMap.put(roleType, new HashSet<String>());
+        }
+    }
+
+    private void denyApiAccess(final String commandName) throws PermissionDeniedException {
+        throw new PermissionDeniedException("The API does not exist or is blacklisted for the account's role. " +
+                "The account with is not allowed to request the api: " + commandName);
+    }
+
+    public boolean isDisabled() {
+        return !roleService.isEnabled();
+    }
+
+    @Override
+    public boolean checkAccess(User user, String commandName) throws PermissionDeniedException {
+        if (isDisabled()) {
+            return true;
+        }
+        Account account = accountService.getAccount(user.getAccountId());
+        if (account == null) {
+            throw new PermissionDeniedException("The account id=" + user.getAccountId() + "for user id=" + user.getId() + "is null");
+        }
+
+        final Role accountRole = roleService.findRole(account.getRoleId());
+        if (accountRole == null || accountRole.getId() < 1L) {
+            denyApiAccess(commandName);
+        }
+
+        // Allow all APIs for root admins
+        if (accountRole.getRoleType() == RoleType.Admin && accountRole.getId() == RoleType.Admin.getId()) {
+            return true;
+        }
+
+        // Check against current list of permissions
+        for (final RolePermission permission : roleService.findAllPermissionsBy(accountRole.getId())) {
+            if (permission.getRule().matches(commandName)) {
+                if (RolePermission.Permission.ALLOW.equals(permission.getPermission())) {
+                    return true;
+                } else {
+                    denyApiAccess(commandName);
+                }
+            }
+        }
+
+        // Check annotations
+        if (annotationRoleBasedApisMap.get(accountRole.getRoleType()) != null
+                && annotationRoleBasedApisMap.get(accountRole.getRoleType()).contains(commandName)) {
+            return true;
+        }
+
+        // Default deny all
+        denyApiAccess(commandName);
+        return false;
+    }
+
+    public void addApiToRoleBasedAnnotationsMap(final RoleType roleType, final String commandName) {
+        if (roleType == null || Strings.isNullOrEmpty(commandName)) {
+            return;
+        }
+        final Set<String> commands = annotationRoleBasedApisMap.get(roleType);
+        if (commands != null && !commands.contains(commandName)) {
+            commands.add(commandName);
+        }
+    }
+
+    @Override
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        super.configure(name, params);
+        return true;
+    }
+
+    @Override
+    public boolean start() {
+        for (PluggableService service : services) {
+            for (Class<?> clz : service.getCommands()) {
+                APICommand command = clz.getAnnotation(APICommand.class);
+                for (RoleType role : command.authorized()) {
+                    addApiToRoleBasedAnnotationsMap(role, command.name());
+                }
+            }
+        }
+        return super.start();
+    }
+
+    public List<PluggableService> getServices() {
+        return services;
+    }
+
+    @Inject
+    public void setServices(List<PluggableService> services) {
+        this.services = services;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/plugins/acl/dynamic-role-based/test/org/apache/cloudstack/acl/DynamicRoleBasedAPIAccessCheckerTest.java
----------------------------------------------------------------------
diff --git a/plugins/acl/dynamic-role-based/test/org/apache/cloudstack/acl/DynamicRoleBasedAPIAccessCheckerTest.java b/plugins/acl/dynamic-role-based/test/org/apache/cloudstack/acl/DynamicRoleBasedAPIAccessCheckerTest.java
new file mode 100644
index 0000000..12ebbe5
--- /dev/null
+++ b/plugins/acl/dynamic-role-based/test/org/apache/cloudstack/acl/DynamicRoleBasedAPIAccessCheckerTest.java
@@ -0,0 +1,164 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES 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.acl;
+
+import com.cloud.exception.PermissionDeniedException;
+import com.cloud.user.Account;
+import com.cloud.user.AccountService;
+import com.cloud.user.AccountVO;
+import com.cloud.user.User;
+import com.cloud.user.UserVO;
+import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.lang.reflect.Field;
+import java.util.Collections;
+
+@RunWith(MockitoJUnitRunner.class)
+public class DynamicRoleBasedAPIAccessCheckerTest extends TestCase {
+
+    @Mock
+    private AccountService accountService;
+    @Mock
+    private RoleService roleService;
+
+    private DynamicRoleBasedAPIAccessChecker apiAccessChecker;
+
+    private User getTestUser() {
+        return new UserVO(12L, "some user", "password", "firstName", "lastName",
+                "email@gmail.com", "GMT", "uuid", User.Source.UNKNOWN);
+    }
+
+    private Account getTestAccount() {
+        return new AccountVO("some name", 1L, "network-domain", (short)0, "some-uuid");
+    }
+
+    private Role getTestRole() {
+        return new RoleVO(4L, "SomeRole", RoleType.User, "some description");
+    }
+
+    private void setupMockField(final Object obj, final String fieldName, final Object mock) throws NoSuchFieldException, IllegalAccessException {
+        Field roleDaoField = DynamicRoleBasedAPIAccessChecker.class.getDeclaredField(fieldName);
+        roleDaoField.setAccessible(true);
+        roleDaoField.set(obj, mock);
+    }
+
+    @Override
+    @Before
+    public void setUp() throws NoSuchFieldException, IllegalAccessException {
+        apiAccessChecker = Mockito.spy(new DynamicRoleBasedAPIAccessChecker());
+        setupMockField(apiAccessChecker, "accountService", accountService);
+        setupMockField(apiAccessChecker, "roleService", roleService);
+
+        Mockito.when(accountService.getAccount(Mockito.anyLong())).thenReturn(getTestAccount());
+        Mockito.when(roleService.findRole(Mockito.anyLong())).thenReturn((RoleVO) getTestRole());
+
+        // Enabled plugin
+        Mockito.doReturn(false).when(apiAccessChecker).isDisabled();
+        Mockito.doCallRealMethod().when(apiAccessChecker).checkAccess(Mockito.any(User.class), Mockito.anyString());
+    }
+
+    @Test
+    public void testInvalidAccountCheckAccess() {
+        Mockito.when(accountService.getAccount(Mockito.anyLong())).thenReturn(null);
+        try {
+            apiAccessChecker.checkAccess(getTestUser(), "someApi");
+            fail("Exception was expected");
+        } catch (PermissionDeniedException ignored) {
+        }
+    }
+
+    @Test
+    public void testInvalidAccountRoleCheckAccess() {
+        Mockito.when(roleService.findRole(Mockito.anyLong())).thenReturn(null);
+        try {
+            apiAccessChecker.checkAccess(getTestUser(), "someApi");
+            fail("Exception was expected");
+        } catch (PermissionDeniedException ignored) {
+        }
+    }
+
+    @Test
+    public void testDefaultRootAdminAccess() {
+        Mockito.when(accountService.getAccount(Mockito.anyLong())).thenReturn(new AccountVO("root admin", 1L, null, (short)1, "some-uuid"));
+        Mockito.when(roleService.findRole(Mockito.anyLong())).thenReturn(new RoleVO(1L, "SomeRole", RoleType.Admin, "default root admin role"));
+        assertTrue(apiAccessChecker.checkAccess(getTestUser(), "anyApi"));
+    }
+
+    @Test
+    public void testInvalidRolePermissionsCheckAccess() {
+        Mockito.when(roleService.findAllPermissionsBy(Mockito.anyLong())).thenReturn(Collections.<RolePermission>emptyList());
+        try {
+            apiAccessChecker.checkAccess(getTestUser(), "someApi");
+            fail("Exception was expected");
+        } catch (PermissionDeniedException ignored) {
+        }
+    }
+
+    @Test
+    public void testValidAllowRolePermissionApiCheckAccess() {
+        final String allowedApiName = "someAllowedApi";
+        final RolePermission permission = new RolePermissionVO(1L, allowedApiName, RolePermission.Permission.ALLOW, null);
+        Mockito.when(roleService.findAllPermissionsBy(Mockito.anyLong())).thenReturn(Collections.singletonList(permission));
+        assertTrue(apiAccessChecker.checkAccess(getTestUser(), allowedApiName));
+    }
+
+    @Test
+    public void testValidAllowRolePermissionWildcardCheckAccess() {
+        final String allowedApiName = "someAllowedApi";
+        final RolePermission permission = new RolePermissionVO(1L, "some*", RolePermission.Permission.ALLOW, null);
+        Mockito.when(roleService.findAllPermissionsBy(Mockito.anyLong())).thenReturn(Collections.singletonList(permission));
+        assertTrue(apiAccessChecker.checkAccess(getTestUser(), allowedApiName));
+    }
+
+    @Test
+    public void testValidDenyRolePermissionApiCheckAccess() {
+        final String denyApiName = "someDeniedApi";
+        final RolePermission permission = new RolePermissionVO(1L, denyApiName, RolePermission.Permission.DENY, null);
+        Mockito.when(roleService.findAllPermissionsBy(Mockito.anyLong())).thenReturn(Collections.singletonList(permission));
+        try {
+            apiAccessChecker.checkAccess(getTestUser(), denyApiName);
+            fail("Exception was expected");
+        } catch (PermissionDeniedException ignored) {
+        }
+    }
+
+    @Test
+    public void testValidDenyRolePermissionWildcardCheckAccess() {
+        final String denyApiName = "someDenyApi";
+        final RolePermission permission = new RolePermissionVO(1L, "*Deny*", RolePermission.Permission.DENY, null);
+        Mockito.when(roleService.findAllPermissionsBy(Mockito.anyLong())).thenReturn(Collections.singletonList(permission));
+        try {
+            apiAccessChecker.checkAccess(getTestUser(), denyApiName);
+            fail("Exception was expected");
+        } catch (PermissionDeniedException ignored) {
+        }
+    }
+
+    @Test
+    public void testAnnotationFallbackCheckAccess() {
+        final String allowedApiName = "someApiWithAnnotations";
+        apiAccessChecker.addApiToRoleBasedAnnotationsMap(getTestRole().getRoleType(), allowedApiName);
+        assertTrue(apiAccessChecker.checkAccess(getTestUser(), allowedApiName));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java
----------------------------------------------------------------------
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 9221ea4..fc78268 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
@@ -41,18 +41,20 @@ import com.cloud.utils.component.PluggableService;
 // based on the account type, access is granted
 public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIChecker {
 
-    protected static final Logger s_logger = Logger.getLogger(StaticRoleBasedAPIAccessChecker.class);
+    protected static final Logger LOGGER = Logger.getLogger(StaticRoleBasedAPIAccessChecker.class);
 
-    Set<String> commandPropertyFiles = new HashSet<String>();
-    Set<String> commandsPropertiesOverrides = new HashSet<String>();
-    Map<RoleType, Set<String>> commandsPropertiesRoleBasedApisMap = new HashMap<RoleType, Set<String>>();
-    Map<RoleType, Set<String>> annotationRoleBasedApisMap = new HashMap<RoleType, Set<String>>();
+    private Set<String> commandPropertyFiles = new HashSet<String>();
+    private Set<String> commandsPropertiesOverrides = new HashSet<String>();
+    private Map<RoleType, Set<String>> commandsPropertiesRoleBasedApisMap = new HashMap<RoleType, Set<String>>();
+    private Map<RoleType, Set<String>> annotationRoleBasedApisMap = new HashMap<RoleType, Set<String>>();
+    private List<PluggableService> services;
 
-    List<PluggableService> _services;
     @Inject
-    AccountService _accountService;
+    private AccountService accountService;
+    @Inject
+    private RoleService roleService;
 
-    protected StaticRoleBasedAPIAccessChecker() {
+    public StaticRoleBasedAPIAccessChecker() {
         super();
         for (RoleType roleType : RoleType.values()) {
             commandsPropertiesRoleBasedApisMap.put(roleType, new HashSet<String>());
@@ -60,23 +62,31 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIC
         }
     }
 
+    public boolean isDisabled() {
+        return roleService.isEnabled();
+    }
+
     @Override
     public boolean checkAccess(User user, String commandName) throws PermissionDeniedException {
-        Account account = _accountService.getAccount(user.getAccountId());
+        if (isDisabled()) {
+            return true;
+        }
+
+        Account account = accountService.getAccount(user.getAccountId());
         if (account == null) {
             throw new PermissionDeniedException("The account id=" + user.getAccountId() + "for user id=" + user.getId() + "is null");
         }
 
-        RoleType roleType = _accountService.getRoleType(account);
+        RoleType roleType = accountService.getRoleType(account);
         boolean isAllowed =
             commandsPropertiesOverrides.contains(commandName) ? commandsPropertiesRoleBasedApisMap.get(roleType).contains(commandName) : annotationRoleBasedApisMap.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);
+        if (isAllowed) {
+            return true;
         }
-        return isAllowed;
+
+        throw new PermissionDeniedException("The API does not exist or is blacklisted. Role type=" + roleType.toString() + " is not allowed to request the api: " + commandName);
     }
 
     @Override
@@ -91,7 +101,7 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIC
 
     @Override
     public boolean start() {
-        for (PluggableService service : _services) {
+        for (PluggableService service : services) {
             for (Class<?> clz : service.getCommands()) {
                 APICommand command = clz.getAnnotation(APICommand.class);
                 for (RoleType role : command.authorized()) {
@@ -112,22 +122,22 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIC
             try {
                 short cmdPermissions = Short.parseShort(roleMask);
                 for (RoleType roleType : RoleType.values()) {
-                    if ((cmdPermissions & roleType.getValue()) != 0)
+                    if ((cmdPermissions & roleType.getMask()) != 0)
                         commandsPropertiesRoleBasedApisMap.get(roleType).add(apiName);
                 }
             } catch (NumberFormatException nfe) {
-                s_logger.info("Malformed key=value pair for entry: " + entry.toString());
+                LOGGER.info("Malformed key=value pair for entry: " + entry.toString());
             }
         }
     }
 
     public List<PluggableService> getServices() {
-        return _services;
+        return services;
     }
 
     @Inject
     public void setServices(List<PluggableService> services) {
-        this._services = services;
+        this.services = services;
     }
 
     public Set<String> getCommandPropertyFiles() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java
----------------------------------------------------------------------
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 be0d5d5..66d8c5d 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
@@ -18,6 +18,7 @@ package org.apache.cloudstack.api.command.user.discovery;
 
 import javax.inject.Inject;
 
+import org.apache.cloudstack.acl.RoleType;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.APICommand;
@@ -38,7 +39,7 @@ import com.cloud.user.User;
             description = "lists all available apis on the server, provided by the Api Discovery plugin",
             since = "4.1.0",
             requestHasSensitiveInfo = false,
-            responseHasSensitiveInfo = false)
+            responseHasSensitiveInfo = false, authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User})
 public class ListApisCmd extends BaseCmd {
 
     public static final Logger s_logger = Logger.getLogger(ListApisCmd.class.getName());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManagerImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManagerImpl.java
index 2451b56..aca7565 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManagerImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManagerImpl.java
@@ -37,12 +37,13 @@ import com.cloud.user.dao.UserDao;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.QueryBuilder;
 import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.vm.VirtualMachineProfile;
-import com.google.gson.Gson;
-import org.apache.cloudstack.api.AddBaremetalRctCmd;
-import org.apache.cloudstack.api.DeleteBaremetalRctCmd;
-import org.apache.cloudstack.api.ListBaremetalRctCmd;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.vm.VirtualMachineProfile;
+import com.google.gson.Gson;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.AddBaremetalRctCmd;
+import org.apache.cloudstack.api.DeleteBaremetalRctCmd;
+import org.apache.cloudstack.api.ListBaremetalRctCmd;
 import org.apache.cloudstack.utils.baremetal.BaremetalUtils;
 import org.springframework.web.client.RestTemplate;
 
@@ -244,12 +245,14 @@ public class BaremetalVlanManagerImpl extends ManagerBase implements BaremetalVl
 
         acnt = new AccountVO();
         acnt.setAccountName(BaremetalUtils.BAREMETAL_SYSTEM_ACCOUNT_NAME);
-        acnt.setUuid(UUID.randomUUID().toString());
-        acnt.setState(Account.State.enabled);
-        acnt.setDomainId(1);
-        acnt = acntDao.persist(acnt);
-
-        UserVO user = new UserVO();
+        acnt.setUuid(UUID.randomUUID().toString());
+        acnt.setState(Account.State.enabled);
+        acnt.setDomainId(1);
+        acnt.setType(RoleType.User.getAccountType());
+        acnt.setRoleId(RoleType.User.getId());
+        acnt = acntDao.persist(acnt);
+
+        UserVO user = new UserVO();
         user.setState(Account.State.enabled);
         user.setUuid(UUID.randomUUID().toString());
         user.setAccountId(acnt.getAccountId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/MockAccountManager.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/MockAccountManager.java b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/MockAccountManager.java
index b5da604..e56766a 100644
--- a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/MockAccountManager.java
+++ b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/MockAccountManager.java
@@ -134,14 +134,14 @@ public class MockAccountManager extends ManagerBase implements AccountManager {
     }
 
     @Override
-    public UserAccount createUserAccount(String arg0, String arg1, String arg2, String arg3, String arg4, String arg5, String arg6, short arg7, Long arg8, String arg9,
+    public UserAccount createUserAccount(String arg0, String arg1, String arg2, String arg3, String arg4, String arg5, String arg6, short arg7, Long roleId, Long arg8, String arg9,
         Map<String, String> arg10, String arg11, String arg12) {
         // TODO Auto-generated method stub
         return null;
     }
 
     @Override
-    public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType,
+    public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long roleId,
                                          Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID, User.Source source) {
         // TODO Auto-generated method stub
         return null;
@@ -392,8 +392,8 @@ public class MockAccountManager extends ManagerBase implements AccountManager {
     }
 
     @Override
-    public Account createAccount(String accountName, short accountType, Long domainId, String networkDomain, Map<String, String> details, String uuid) {
-        final AccountVO account = new AccountVO(accountName, domainId, networkDomain, accountType, uuid);
+    public Account createAccount(String accountName, short accountType, Long roleId, Long domainId, String networkDomain, Map<String, String> details, String uuid) {
+        final AccountVO account = new AccountVO(accountName, domainId, networkDomain, accountType, roleId, uuid);
         Transaction.execute(new TransactionCallbackNoReturn() {
             @Override
             public void doInTransactionWithoutResult(TransactionStatus status) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/plugins/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/pom.xml b/plugins/pom.xml
index bafe299..1a25819 100755
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -50,6 +50,7 @@
     <module>api/solidfire-intg-test</module>
     <module>api/discovery</module>
     <module>acl/static-role-based</module>
+    <module>acl/dynamic-role-based</module>
     <module>affinity-group-processors/host-anti-affinity</module>
     <module>affinity-group-processors/explicit-dedication</module>
     <module>deployment-planners/user-concentrated-pod</module>


[32/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1466 from nvazquez/graldboptimization

CLOUDSTACK-9340: General DB Optimization## Description
In some production environments there were being experimented delays in most of the jobs. A search for DB optimization was taken and some deficiencies were discovered, we can group them in 4 groups:
* Incorrect PRIMARY key
* Duplicate PRIMARY KEY
* Missing indexes (Add indexes to avoid full table scans)
* Some views query (Change view to improve account retrieval speed)

* pr/1466:
  CLOUDSTACK-9340: General DB Optimization

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: ccf226546007a82594866c82cd4f279758bb91d9
Parents: 726ee47 8b6e618
Author: Will Stevens <wi...@gmail.com>
Authored: Tue May 10 23:57:39 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Tue May 10 23:57:39 2016 -0400

----------------------------------------------------------------------
 setup/db/db/schema-481to490-cleanup.sql | 65 ++++++++++++++++++++++++++++
 setup/db/db/schema-481to490.sql         | 23 ++++++++++
 2 files changed, 88 insertions(+)
----------------------------------------------------------------------



[16/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Update L10N resource files with 4.8 strings from Transifex (20160504)
Force "translator" mode with the transifex client.
Update Transifex client config file for 4.8 resources/L10N ref. (generated by Tx client)


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: e81a6b270e49e0af45a64f6c9fdd31d872792a83
Parents: 38c9e9f
Author: Milamber <mi...@apache.org>
Authored: Wed Apr 20 09:13:32 2016 +0100
Committer: Milamber <mi...@apache.org>
Committed: Wed May 4 21:47:37 2016 +0100

----------------------------------------------------------------------
 .../classes/resources/messages_de_DE.properties |   1 +
 .../classes/resources/messages_es.properties    | 927 ++++++++++---------
 .../classes/resources/messages_fr_FR.properties |   9 +-
 .../classes/resources/messages_hu.properties    |   4 +-
 .../classes/resources/messages_ja_JP.properties |   2 +-
 .../classes/resources/messages_ko_KR.properties |  16 +-
 .../classes/resources/messages_nb_NO.properties |   9 +-
 .../classes/resources/messages_nl_NL.properties |   5 +-
 .../classes/resources/messages_pt_BR.properties |  11 +-
 .../classes/resources/messages_ru_RU.properties |  14 +-
 .../classes/resources/messages_zh_CN.properties |   2 +-
 tools/transifex/.tx/config                      |  19 +
 12 files changed, 522 insertions(+), 497 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e81a6b27/client/WEB-INF/classes/resources/messages_de_DE.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_de_DE.properties b/client/WEB-INF/classes/resources/messages_de_DE.properties
index 9d92c44..d51598e 100644
--- a/client/WEB-INF/classes/resources/messages_de_DE.properties
+++ b/client/WEB-INF/classes/resources/messages_de_DE.properties
@@ -1119,6 +1119,7 @@ label.nfs.server=NFS Server
 label.nfs.storage=NFS-Speicher
 label.nic.adapter.type=NIC-Adaptertyp
 label.nicira.controller.address=Controller-Adresse
+label.nicira.l2gatewayserviceuuid=L2 Gateway Service Uuid
 label.nicira.l3gatewayserviceuuid=L3 Gateway Service Uuid
 label.nicira.nvp.details=Nicira NVP-Details
 label.nicira.transportzoneuuid=Transportzone Uuid


[48/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d82198a/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java b/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
index 137aa61..9cbc73a 100644
--- a/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
+++ b/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
@@ -27,9 +27,11 @@ import java.util.Map;
 
 import javax.naming.ConfigurationException;
 
+import org.apache.cloudstack.api.ApiConstants;
 import org.apache.commons.io.output.ByteArrayOutputStream;
 import org.apache.log4j.Logger;
-import org.bouncycastle.openssl.PEMWriter;
+import org.bouncycastle.util.io.pem.PemObject;
+import org.bouncycastle.util.io.pem.PemWriter;
 
 import com.citrix.netscaler.nitro.exception.nitro_exception;
 import com.citrix.netscaler.nitro.resource.base.base_response;
@@ -75,11 +77,6 @@ import com.citrix.netscaler.nitro.util.filtervalue;
 import com.citrix.sdx.nitro.resource.config.mps.mps;
 import com.citrix.sdx.nitro.resource.config.ns.ns;
 import com.citrix.sdx.nitro.resource.config.xen.xen_nsvpx_image;
-import com.google.common.collect.Lists;
-import com.google.gson.Gson;
-
-import org.apache.cloudstack.api.ApiConstants;
-
 import com.cloud.agent.IAgentControl;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
@@ -127,6 +124,8 @@ import com.cloud.utils.exception.ExecutionException;
 import com.cloud.utils.net.NetUtils;
 import com.cloud.utils.security.CertificateHelper;
 import com.cloud.utils.ssh.SshHelper;
+import com.google.common.collect.Lists;
+import com.google.gson.Gson;
 
 class NitroError {
     static final int NS_RESOURCE_EXISTS = 273;
@@ -235,7 +234,7 @@ public class NetscalerResource implements ServerResource {
 
             _inline = Boolean.parseBoolean((String)params.get("inline"));
 
-            if (((String)params.get("cloudmanaged")) != null) {
+            if ((String)params.get("cloudmanaged") != null) {
                 _cloudManaged = Boolean.parseBoolean((String)params.get("cloudmanaged"));
             }
 
@@ -264,7 +263,7 @@ public class NetscalerResource implements ServerResource {
             }
 
             return true;
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new ConfigurationException(e.getMessage());
         }
     }
@@ -280,7 +279,7 @@ public class NetscalerResource implements ServerResource {
                     _netscalerSdxService.logout();
                 }
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             // Ignore logout exceptions
         }
     }
@@ -302,15 +301,15 @@ public class NetscalerResource implements ServerResource {
             } else {
                 _netscalerSdxService = new com.citrix.sdx.nitro.service.nitro_service(_ip, "https");
                 _netscalerSdxService.set_credential(_username, _password);
-                com.citrix.sdx.nitro.resource.base.login login = _netscalerSdxService.login();
+                final com.citrix.sdx.nitro.resource.base.login login = _netscalerSdxService.login();
                 if (login == null) {
                     throw new ExecutionException("Failed to log in to Netscaler SDX device at " + _ip + " due to error " + apiCallResult.errorcode + " and message " +
                             apiCallResult.message);
                 }
             }
-        } catch (nitro_exception e) {
+        } catch (final nitro_exception e) {
             throw new ExecutionException("Failed to log in to Netscaler device at " + _ip + " due to " + e.getMessage());
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new ExecutionException("Failed to log in to Netscaler device at " + _ip + " due to " + e.getMessage());
         }
     }
@@ -320,9 +319,9 @@ public class NetscalerResource implements ServerResource {
             return;
         }
         try {
-            String[] features = _netscalerService.get_enabled_features();
+            final String[] features = _netscalerService.get_enabled_features();
             if (features != null) {
-                for (String feature : features) {
+                for (final String feature : features) {
                     if (feature.equalsIgnoreCase("LB")) {
                         return;
                     }
@@ -330,15 +329,15 @@ public class NetscalerResource implements ServerResource {
             }
 
             // enable load balancing on the device
-            String[] feature = new String[1];
+            final String[] feature = new String[1];
             feature[0] = "LB";
             apiCallResult = _netscalerService.enable_features(feature);
             if (apiCallResult.errorcode != 0) {
                 throw new ExecutionException("Enabling load balancing feature on the device failed.");
             }
-        } catch (nitro_exception e) {
+        } catch (final nitro_exception e) {
             throw new ExecutionException("Enabling load balancing feature on the device failed  due to " + e.getMessage());
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new ExecutionException("Enabling load balancing feature on the device failed due to " + e.getMessage());
         }
     }
@@ -346,21 +345,21 @@ public class NetscalerResource implements ServerResource {
     private void validateInterfaces(String publicInterface, String privateInterface) throws ExecutionException {
         try {
             if (!_isSdx && !_cloudManaged) {
-                Interface publicIf = Interface.get(_netscalerService, publicInterface);
-                Interface privateIf = Interface.get(_netscalerService, privateInterface);
+                final Interface publicIf = Interface.get(_netscalerService, publicInterface);
+                final Interface privateIf = Interface.get(_netscalerService, privateInterface);
                 if (publicIf != null || privateIf != null) {
                     return;
                 } else {
                     throw new ExecutionException("Invalid interface name specified for public/private interfaces.");
                 }
             }
-        } catch (nitro_exception e) {
+        } catch (final nitro_exception e) {
             if (e.getErrorCode() == NitroError.NS_RESOURCE_NOT_EXISTS) {
                 throw new ExecutionException("Invalid interface name specified for public and private interfaces.");
             } else {
                 throw new ExecutionException("Failed to verify public interface and private intefaces are valid due to " + e.getMessage());
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new ExecutionException("Failed to verify public interface and private intefaces are valid due to " + e.getMessage());
         }
     }
@@ -368,18 +367,18 @@ public class NetscalerResource implements ServerResource {
     private void validateDeviceType(String deviceType) throws ExecutionException {
         try {
             if (!_isSdx && !_cloudManaged) {
-                nshardware nsHw = com.citrix.netscaler.nitro.resource.config.ns.nshardware.get(_netscalerService);
+                final nshardware nsHw = com.citrix.netscaler.nitro.resource.config.ns.nshardware.get(_netscalerService);
                 if (nsHw == null) {
                     throw new ExecutionException("Failed to get the hardware description of the Netscaler device at " + _ip);
                 } else {
-                    if ((_deviceName.equalsIgnoreCase("NetscalerMPXLoadBalancer") && nsHw.get_hwdescription().contains("MPX")) ||
-                            (_deviceName.equalsIgnoreCase("NetscalerVPXLoadBalancer") && nsHw.get_hwdescription().contains("NetScaler Virtual Appliance"))) {
+                    if (_deviceName.equalsIgnoreCase("NetscalerMPXLoadBalancer") && nsHw.get_hwdescription().contains("MPX") ||
+                            _deviceName.equalsIgnoreCase("NetscalerVPXLoadBalancer") && nsHw.get_hwdescription().contains("NetScaler Virtual Appliance")) {
                         return;
                     }
                     throw new ExecutionException("Netscalar device type specified does not match with the actuall device type.");
                 }
             } else if (_isSdx) {
-                mps serviceVM = mps.get(_netscalerSdxService);
+                final mps serviceVM = mps.get(_netscalerSdxService);
                 if (serviceVM != null) {
                     if (serviceVM.get_platform().contains("SDX") || serviceVM.get_product().contains("SDX")) {
                         return;
@@ -390,14 +389,14 @@ public class NetscalerResource implements ServerResource {
                     throw new ExecutionException("Failed to get the hardware details of the Netscaler device at " + _ip);
                 }
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new ExecutionException("Failed to verify device type specified when matching with actuall device type due to " + e.getMessage());
         }
     }
 
     @Override
     public StartupCommand[] initialize() {
-        StartupExternalLoadBalancerCommand cmd = new StartupExternalLoadBalancerCommand();
+        final StartupExternalLoadBalancerCommand cmd = new StartupExternalLoadBalancerCommand();
         cmd.setName(_name);
         cmd.setDataCenter(_zoneId);
         cmd.setPod("");
@@ -452,14 +451,14 @@ public class NetscalerResource implements ServerResource {
             return Answer.createUnsupportedCommandAnswer(cmd);
         }
 
-        String[] results = new String[cmd.getIpAddresses().length];
+        final String[] results = new String[cmd.getIpAddresses().length];
         int i = 0;
         try {
-            IpAddressTO[] ips = cmd.getIpAddresses();
-            for (IpAddressTO ip : ips) {
-                long guestVlanTag = Long.parseLong(ip.getBroadcastUri());
-                String vlanSelfIp = ip.getVlanGateway();
-                String vlanNetmask = ip.getVlanNetmask();
+            final IpAddressTO[] ips = cmd.getIpAddresses();
+            for (final IpAddressTO ip : ips) {
+                final long guestVlanTag = Long.parseLong(ip.getBroadcastUri());
+                final String vlanSelfIp = ip.getVlanGateway();
+                final String vlanNetmask = ip.getVlanNetmask();
 
                 if (ip.isAdd()) {
                     // Add a new guest VLAN and its subnet and bind it to private interface
@@ -471,12 +470,12 @@ public class NetscalerResource implements ServerResource {
 
                 saveConfiguration();
                 results[i++] = ip.getPublicIp() + " - success";
-                String action = ip.isAdd() ? "associate" : "remove";
+                final String action = ip.isAdd() ? "associate" : "remove";
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug("Netscaler load balancer " + _ip + " successfully executed IPAssocCommand to " + action + " IP " + ip);
                 }
             }
-        } catch (ExecutionException e) {
+        } catch (final ExecutionException e) {
             s_logger.error("Netscaler loadbalancer " + _ip + " failed to execute IPAssocCommand due to " + e.getMessage());
             if (shouldRetry(numRetries)) {
                 return retry(cmd, numRetries);
@@ -490,31 +489,31 @@ public class NetscalerResource implements ServerResource {
 
     private Answer execute(HealthCheckLBConfigCommand cmd, int numRetries) {
 
-        List<LoadBalancerTO> hcLB = new ArrayList<LoadBalancerTO>();
+        final List<LoadBalancerTO> hcLB = new ArrayList<LoadBalancerTO>();
         try {
 
             if (_isSdx) {
                 return Answer.createUnsupportedCommandAnswer(cmd);
             }
 
-            LoadBalancerTO[] loadBalancers = cmd.getLoadBalancers();
+            final LoadBalancerTO[] loadBalancers = cmd.getLoadBalancers();
 
             if (loadBalancers == null) {
                 return new HealthCheckLBConfigAnswer(hcLB);
             }
 
-            for (LoadBalancerTO loadBalancer : loadBalancers) {
-                HealthCheckPolicyTO[] healthCheckPolicies = loadBalancer.getHealthCheckPolicies();
-                if ((healthCheckPolicies != null) && (healthCheckPolicies.length > 0) && (healthCheckPolicies[0] != null)) {
-                    String nsVirtualServerName = generateNSVirtualServerName(loadBalancer.getSrcIp(), loadBalancer.getSrcPort());
+            for (final LoadBalancerTO loadBalancer : loadBalancers) {
+                final HealthCheckPolicyTO[] healthCheckPolicies = loadBalancer.getHealthCheckPolicies();
+                if (healthCheckPolicies != null && healthCheckPolicies.length > 0 && healthCheckPolicies[0] != null) {
+                    final String nsVirtualServerName = generateNSVirtualServerName(loadBalancer.getSrcIp(), loadBalancer.getSrcPort());
 
-                    com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
+                    final com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
                             com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.get(_netscalerService, nsVirtualServerName);
 
                     if (serviceBindings != null) {
-                        for (DestinationTO destination : loadBalancer.getDestinations()) {
-                            String nsServiceName = generateNSServiceName(destination.getDestIp(), destination.getDestPort());
-                            for (com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
+                        for (final DestinationTO destination : loadBalancer.getDestinations()) {
+                            final String nsServiceName = generateNSServiceName(destination.getDestIp(), destination.getDestPort());
+                            for (final com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
                                 if (nsServiceName.equalsIgnoreCase(binding.get_servicename())) {
                                     destination.setMonitorState(binding.get_curstate());
                                     break;
@@ -526,14 +525,14 @@ public class NetscalerResource implements ServerResource {
                 }
             }
 
-        } catch (ExecutionException e) {
+        } catch (final ExecutionException e) {
             s_logger.error("Failed to execute HealthCheckLBConfigCommand due to ", e);
             if (shouldRetry(numRetries)) {
                 return retry(cmd, numRetries);
             } else {
                 return new HealthCheckLBConfigAnswer(hcLB);
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             s_logger.error("Failed to execute HealthCheckLBConfigCommand due to ", e);
             if (shouldRetry(numRetries)) {
                 return retry(cmd, numRetries);
@@ -550,19 +549,19 @@ public class NetscalerResource implements ServerResource {
                 return Answer.createUnsupportedCommandAnswer(cmd);
             }
 
-            LoadBalancerTO[] loadBalancers = cmd.getLoadBalancers();
+            final LoadBalancerTO[] loadBalancers = cmd.getLoadBalancers();
             if (loadBalancers == null) {
                 return new Answer(cmd);
             }
 
-            for (LoadBalancerTO loadBalancer : loadBalancers) {
-                String srcIp = loadBalancer.getSrcIp();
-                int srcPort = loadBalancer.getSrcPort();
-                String lbProtocol = getNetScalerProtocol(loadBalancer);
-                String lbAlgorithm = loadBalancer.getAlgorithm();
-                String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
-                String nsMonitorName = generateNSMonitorName(srcIp, srcPort);
-                LbSslCert sslCert = loadBalancer.getSslCert();
+            for (final LoadBalancerTO loadBalancer : loadBalancers) {
+                final String srcIp = loadBalancer.getSrcIp();
+                final int srcPort = loadBalancer.getSrcPort();
+                final String lbProtocol = getNetScalerProtocol(loadBalancer);
+                final String lbAlgorithm = loadBalancer.getAlgorithm();
+                final String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
+                final String nsMonitorName = generateNSMonitorName(srcIp, srcPort);
+                final LbSslCert sslCert = loadBalancer.getSslCert();
 
                 if (loadBalancer.isAutoScaleVmGroupTO()) {
                     applyAutoScaleConfig(loadBalancer);
@@ -573,7 +572,7 @@ public class NetscalerResource implements ServerResource {
                 boolean deleteMonitor = false;
                 boolean destinationsToAdd = false;
                 boolean deleteCert = false;
-                for (DestinationTO destination : loadBalancer.getDestinations()) {
+                for (final DestinationTO destination : loadBalancer.getDestinations()) {
                     if (!destination.isRevoked()) {
                         destinationsToAdd = true;
                         break;
@@ -589,10 +588,10 @@ public class NetscalerResource implements ServerResource {
                     }
 
                     // create a new monitor
-                    HealthCheckPolicyTO[] healthCheckPolicies = loadBalancer.getHealthCheckPolicies();
-                    if ((healthCheckPolicies != null) && (healthCheckPolicies.length > 0) && (healthCheckPolicies[0] != null)) {
+                    final HealthCheckPolicyTO[] healthCheckPolicies = loadBalancer.getHealthCheckPolicies();
+                    if (healthCheckPolicies != null && healthCheckPolicies.length > 0 && healthCheckPolicies[0] != null) {
 
-                        for (HealthCheckPolicyTO healthCheckPolicyTO : healthCheckPolicies) {
+                        for (final HealthCheckPolicyTO healthCheckPolicyTO : healthCheckPolicies) {
                             if (!healthCheckPolicyTO.isRevoked()) {
                                 addLBMonitor(nsMonitorName, lbProtocol, healthCheckPolicyTO);
                                 hasMonitor = true;
@@ -604,27 +603,27 @@ public class NetscalerResource implements ServerResource {
 
                     }
 
-                    for (DestinationTO destination : loadBalancer.getDestinations()) {
+                    for (final DestinationTO destination : loadBalancer.getDestinations()) {
 
-                        String nsServerName = generateNSServerName(destination.getDestIp());
-                        String nsServiceName = generateNSServiceName(destination.getDestIp(), destination.getDestPort());
+                        final String nsServerName = generateNSServerName(destination.getDestIp());
+                        final String nsServiceName = generateNSServiceName(destination.getDestIp(), destination.getDestPort());
                         if (!destination.isRevoked()) {
                             // add a new destination to deployed load balancing rule
 
                             // add a new server
                             if (!nsServerExists(nsServerName)) {
-                                com.citrix.netscaler.nitro.resource.config.basic.server nsServer = new com.citrix.netscaler.nitro.resource.config.basic.server();
+                                final com.citrix.netscaler.nitro.resource.config.basic.server nsServer = new com.citrix.netscaler.nitro.resource.config.basic.server();
                                 nsServer.set_name(nsServerName);
                                 nsServer.set_ipaddress(destination.getDestIp());
                                 apiCallResult = com.citrix.netscaler.nitro.resource.config.basic.server.add(_netscalerService, nsServer);
-                                if ((apiCallResult.errorcode != 0) && (apiCallResult.errorcode != NitroError.NS_RESOURCE_EXISTS)) {
+                                if (apiCallResult.errorcode != 0 && apiCallResult.errorcode != NitroError.NS_RESOURCE_EXISTS) {
                                     throw new ExecutionException("Failed to add server " + destination.getDestIp() + " due to" + apiCallResult.message);
                                 }
                             }
 
                             // create a new service using the server added
                             if (!nsServiceExists(nsServiceName)) {
-                                com.citrix.netscaler.nitro.resource.config.basic.service newService = new com.citrix.netscaler.nitro.resource.config.basic.service();
+                                final com.citrix.netscaler.nitro.resource.config.basic.service newService = new com.citrix.netscaler.nitro.resource.config.basic.service();
                                 newService.set_name(nsServiceName);
                                 newService.set_port(destination.getDestPort());
                                 newService.set_servername(nsServerName);
@@ -644,7 +643,7 @@ public class NetscalerResource implements ServerResource {
 
                             //bind service to load balancing virtual server
                             if (!nsServiceBindingExists(nsVirtualServerName, nsServiceName)) {
-                                com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding svcBinding =
+                                final com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding svcBinding =
                                         new com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding();
                                 svcBinding.set_name(nsVirtualServerName);
                                 svcBinding.set_servicename(nsServiceName);
@@ -686,19 +685,19 @@ public class NetscalerResource implements ServerResource {
                                     String previousCertKeyName = null;
 
                                     if (sslCert.getChain() != null) {
-                                        List<Certificate> chainList = CertificateHelper.parseChain(sslCert.getChain());
+                                        final List<Certificate> chainList = CertificateHelper.parseChain(sslCert.getChain());
                                         // go from ROOT to intermediate CAs
-                                        for (Certificate intermediateCert : Lists.reverse(chainList)) {
+                                        for (final Certificate intermediateCert : Lists.reverse(chainList)) {
 
-                                            String fingerPrint = CertificateHelper.generateFingerPrint(intermediateCert);
-                                            String intermediateCertKeyName = generateSslCertKeyName(fingerPrint);
-                                            String intermediateCertFileName = intermediateCertKeyName + ".pem";
+                                            final String fingerPrint = CertificateHelper.generateFingerPrint(intermediateCert);
+                                            final String intermediateCertKeyName = generateSslCertKeyName(fingerPrint);
+                                            final String intermediateCertFileName = intermediateCertKeyName + ".pem";
 
                                             if (!SSL.isSslCertKeyPresent(_netscalerService, intermediateCertKeyName)) {
-                                                intermediateCert.getEncoded();
-                                                StringWriter textWriter = new StringWriter();
-                                                PEMWriter pemWriter = new PEMWriter(textWriter);
-                                                pemWriter.writeObject(intermediateCert);
+                                                final PemObject pemObject = new PemObject(intermediateCert.getType(), intermediateCert.getEncoded());
+                                                final StringWriter textWriter = new StringWriter();
+                                                final PemWriter pemWriter = new PemWriter(textWriter);
+                                                pemWriter.writeObject(pemObject);
                                                 pemWriter.flush();
 
                                                 SSL.uploadCert(_ip, _username, _password, intermediateCertFileName, textWriter.toString().getBytes());
@@ -713,11 +712,11 @@ public class NetscalerResource implements ServerResource {
                                         }
                                     }
 
-                                    String certFilename = generateSslCertName(sslCert.getFingerprint()) + ".pem"; //netscaler uses ".pem" format for "bundle" files
-                                    String keyFilename = generateSslKeyName(sslCert.getFingerprint()) + ".pem"; //netscaler uses ".pem" format for "bundle" files
-                                    String certKeyName = generateSslCertKeyName(sslCert.getFingerprint());
+                                    final String certFilename = generateSslCertName(sslCert.getFingerprint()) + ".pem"; //netscaler uses ".pem" format for "bundle" files
+                                    final String keyFilename = generateSslKeyName(sslCert.getFingerprint()) + ".pem"; //netscaler uses ".pem" format for "bundle" files
+                                    final String certKeyName = generateSslCertKeyName(sslCert.getFingerprint());
 
-                                    ByteArrayOutputStream certDataStream = new ByteArrayOutputStream();
+                                    final ByteArrayOutputStream certDataStream = new ByteArrayOutputStream();
                                     certDataStream.write(sslCert.getCert().getBytes());
 
                                     if (!SSL.isSslCertKeyPresent(_netscalerService, certKeyName)) {
@@ -743,10 +742,10 @@ public class NetscalerResource implements ServerResource {
 
                         } else {
                             // remove a destination from the deployed load balancing rule
-                            com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
+                            final com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
                                     com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.get(_netscalerService, nsVirtualServerName);
                             if (serviceBindings != null) {
-                                for (com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
+                                for (final com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
                                     if (nsServiceName.equalsIgnoreCase(binding.get_servicename())) {
                                         // delete the binding
                                         apiCallResult = com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.delete(_netscalerService, binding);
@@ -765,8 +764,8 @@ public class NetscalerResource implements ServerResource {
                                         }
 
                                         // delete the server if there is no associated services
-                                        server_service_binding[] services = server_service_binding.get(_netscalerService, nsServerName);
-                                        if ((services == null) || (services.length == 0)) {
+                                        final server_service_binding[] services = server_service_binding.get(_netscalerService, nsServerName);
+                                        if (services == null || services.length == 0) {
                                             apiCallResult = com.citrix.netscaler.nitro.resource.config.basic.server.delete(_netscalerService, nsServerName);
                                             if (apiCallResult.errorcode != 0) {
                                                 throw new ExecutionException("Failed to remove server:" + nsServerName + " due to " + apiCallResult.message);
@@ -779,24 +778,24 @@ public class NetscalerResource implements ServerResource {
                     }
                 } else {
                     // delete the implemented load balancing rule and its destinations
-                    lbvserver lbserver = getVirtualServerIfExisits(nsVirtualServerName);
+                    final lbvserver lbserver = getVirtualServerIfExisits(nsVirtualServerName);
                     if (lbserver != null) {
                         //unbind the all services associated with this virtual server
-                        com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
+                        final com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
                                 com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.get(_netscalerService, nsVirtualServerName);
 
                         if (serviceBindings != null) {
-                            for (com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
-                                String serviceName = binding.get_servicename();
+                            for (final com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
+                                final String serviceName = binding.get_servicename();
                                 apiCallResult = com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.delete(_netscalerService, binding);
                                 if (apiCallResult.errorcode != 0) {
                                     throw new ExecutionException("Failed to unbind service from the lb virtual server: " + nsVirtualServerName + " due to " +
                                             apiCallResult.message);
                                 }
 
-                                com.citrix.netscaler.nitro.resource.config.basic.service svc =
+                                final com.citrix.netscaler.nitro.resource.config.basic.service svc =
                                         com.citrix.netscaler.nitro.resource.config.basic.service.get(_netscalerService, serviceName);
-                                String nsServerName = svc.get_servername();
+                                final String nsServerName = svc.get_servername();
 
                                 // check if service is bound to any other virtual server
                                 if (!isServiceBoundToVirtualServer(serviceName)) {
@@ -808,8 +807,8 @@ public class NetscalerResource implements ServerResource {
                                 }
 
                                 //delete the server if no more services attached
-                                server_service_binding[] services = server_service_binding.get(_netscalerService, nsServerName);
-                                if ((services == null) || (services.length == 0)) {
+                                final server_service_binding[] services = server_service_binding.get(_netscalerService, nsServerName);
+                                if (services == null || services.length == 0) {
                                     apiCallResult = com.citrix.netscaler.nitro.resource.config.basic.server.delete(_netscalerService, nsServerName);
                                     if (apiCallResult.errorcode != 0) {
                                         throw new ExecutionException("Failed to remove server:" + nsServerName + " due to " + apiCallResult.message);
@@ -827,9 +826,9 @@ public class NetscalerResource implements ServerResource {
                 }
                 if (sslCert != null && deleteCert) {
 
-                    String certFilename = generateSslCertName(sslCert.getFingerprint()) + ".pem"; //netscaler uses ".pem" format for "bundle" files
-                    String keyFilename = generateSslKeyName(sslCert.getFingerprint()) + ".pem"; //netscaler uses ".pem" format for "bundle" files
-                    String certKeyName = generateSslCertKeyName(sslCert.getFingerprint());
+                    final String certFilename = generateSslCertName(sslCert.getFingerprint()) + ".pem"; //netscaler uses ".pem" format for "bundle" files
+                    final String keyFilename = generateSslKeyName(sslCert.getFingerprint()) + ".pem"; //netscaler uses ".pem" format for "bundle" files
+                    final String certKeyName = generateSslCertKeyName(sslCert.getFingerprint());
 
                     // unbind before deleting
                     if (nsVirtualServerExists(nsVirtualServerName) &&
@@ -852,13 +851,13 @@ public class NetscalerResource implements ServerResource {
                      */
 
                     if (sslCert.getChain() != null) {
-                        List<Certificate> chainList = CertificateHelper.parseChain(sslCert.getChain());
+                        final List<Certificate> chainList = CertificateHelper.parseChain(sslCert.getChain());
                         //go from intermediate CAs to ROOT
-                        for (Certificate intermediateCert : chainList) {
+                        for (final Certificate intermediateCert : chainList) {
 
-                            String fingerPrint = CertificateHelper.generateFingerPrint(intermediateCert);
-                            String intermediateCertKeyName = generateSslCertKeyName(fingerPrint);
-                            String intermediateCertFileName = intermediateCertKeyName + ".pem";
+                            final String fingerPrint = CertificateHelper.generateFingerPrint(intermediateCert);
+                            final String intermediateCertKeyName = generateSslCertKeyName(fingerPrint);
+                            final String intermediateCertFileName = intermediateCertKeyName + ".pem";
 
                             if (SSL.isSslCertKeyPresent(_netscalerService, intermediateCertKeyName) &&
                                     !SSL.isCaforCerts(_netscalerService, intermediateCertKeyName)) {
@@ -880,14 +879,14 @@ public class NetscalerResource implements ServerResource {
 
             saveConfiguration();
             return new Answer(cmd);
-        } catch (ExecutionException e) {
+        } catch (final ExecutionException e) {
             s_logger.error("Failed to execute LoadBalancerConfigCommand due to ", e);
             if (shouldRetry(numRetries)) {
                 return retry(cmd, numRetries);
             } else {
                 return new Answer(cmd, e);
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             s_logger.error("Failed to execute LoadBalancerConfigCommand due to ", e);
             if (shouldRetry(numRetries)) {
                 return retry(cmd, numRetries);
@@ -904,11 +903,11 @@ public class NetscalerResource implements ServerResource {
         }
 
         try {
-            String vpxName = "Cloud-VPX-" + cmd.getLoadBalancerIP();
-            String username = "admin";
-            String password = "admin";
+            final String vpxName = "Cloud-VPX-" + cmd.getLoadBalancerIP();
+            final String username = "admin";
+            final String password = "admin";
 
-            ns ns_obj = new ns();
+            final ns ns_obj = new ns();
             ns_obj.set_name(vpxName);
             ns_obj.set_ip_address(cmd.getLoadBalancerIP());
             ns_obj.set_netmask(cmd.getNetmask());
@@ -926,12 +925,12 @@ public class NetscalerResource implements ServerResource {
 
             // use the first VPX image of the available VPX images on the SDX to create an instance of VPX
             // TODO: should enable the option to choose the template while adding the SDX device in to CloudStack
-            xen_nsvpx_image[] vpxImages = xen_nsvpx_image.get(_netscalerSdxService);
+            final xen_nsvpx_image[] vpxImages = xen_nsvpx_image.get(_netscalerSdxService);
             if (!(vpxImages != null && vpxImages.length >= 1)) {
                 new Answer(cmd, new ExecutionException("Failed to create VPX instance on the netscaler SDX device " + _ip +
                         " as there are no VPX images on SDX to use for creating VPX."));
             }
-            String imageName = vpxImages[0].get_file_name();
+            final String imageName = vpxImages[0].get_file_name();
             ns_obj.set_image_name(imageName);
 
             String publicIf = _publicInterface;
@@ -949,14 +948,14 @@ public class NetscalerResource implements ServerResource {
 
             // wait for VPX instance to start-up
             long startTick = System.currentTimeMillis();
-            long startWaitMilliSeconds = 600000;
+            final long startWaitMilliSeconds = 600000;
             while (!newVpx.get_instance_state().equalsIgnoreCase("up") && System.currentTimeMillis() - startTick < startWaitMilliSeconds) {
                 try {
                     Thread.sleep(10000);
-                } catch (InterruptedException e) {
+                } catch (final InterruptedException e) {
                     s_logger.debug("[ignored] interupted while waiting for netscaler to be 'up'.");
                 }
-                ns refreshNsObj = new ns();
+                final ns refreshNsObj = new ns();
                 refreshNsObj.set_id(newVpx.get_id());
                 newVpx = ns.get(_netscalerSdxService, refreshNsObj);
             }
@@ -969,19 +968,19 @@ public class NetscalerResource implements ServerResource {
             // wait till NS service in side VPX is actually ready
             startTick = System.currentTimeMillis();
             boolean nsServiceUp = false;
-            long nsServiceWaitMilliSeconds = 60000;
+            final long nsServiceWaitMilliSeconds = 60000;
             while (System.currentTimeMillis() - startTick < nsServiceWaitMilliSeconds) {
                 try {
-                    nitro_service _netscalerService = new nitro_service(cmd.getLoadBalancerIP(), "https");
-                    _netscalerService.set_certvalidation(false);
-                    _netscalerService.set_hostnameverification(false);
-                    _netscalerService.set_credential(username, password);
-                    apiCallResult = _netscalerService.login();
+                    final nitro_service netscalerService = new nitro_service(cmd.getLoadBalancerIP(), "https");
+                    netscalerService.set_certvalidation(false);
+                    netscalerService.set_hostnameverification(false);
+                    netscalerService.set_credential(username, password);
+                    apiCallResult = netscalerService.login();
                     if (apiCallResult.errorcode == 0) {
                         nsServiceUp = true;
                         break;
                     }
-                } catch (Exception e) {
+                } catch (final Exception e) {
                     Thread.sleep(10000);
                     continue;
                 }
@@ -999,8 +998,8 @@ public class NetscalerResource implements ServerResource {
             // However the VPX instances created will have interface range start from 10/1 but will only have as many interfaces enabled while creating the VPX instance
             // So due to this, we need to map public & private interface on SDX to correct public & private interface of VPX
 
-            int publicIfnum = Integer.parseInt(_publicInterface.substring(_publicInterface.lastIndexOf("/") + 1));
-            int privateIfnum = Integer.parseInt(_privateInterface.substring(_privateInterface.lastIndexOf("/") + 1));
+            final int publicIfnum = Integer.parseInt(_publicInterface.substring(_publicInterface.lastIndexOf("/") + 1));
+            final int privateIfnum = Integer.parseInt(_privateInterface.substring(_privateInterface.lastIndexOf("/") + 1));
 
             if (_publicInterface.startsWith("10/") && _privateInterface.startsWith("10/")) {
                 if (publicIfnum == privateIfnum) {
@@ -1034,7 +1033,7 @@ public class NetscalerResource implements ServerResource {
 
             return new CreateLoadBalancerApplianceAnswer(cmd, true, "provisioned VPX instance", "NetscalerVPXLoadBalancer", "Netscaler", new NetscalerResource(),
                     publicIf, privateIf, _username, _password);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             if (shouldRetry(numRetries)) {
                 return retry(cmd, numRetries);
             }
@@ -1045,15 +1044,15 @@ public class NetscalerResource implements ServerResource {
 
     private Answer execute(GlobalLoadBalancerConfigCommand gslbCmd, int numRetries) {
 
-        String lbMethod = gslbCmd.getLoadBalancerMethod();
-        String persistenceType = gslbCmd.getPersistenceType();
-        String serviceType = gslbCmd.getServiceType();
-        boolean forRevoke = gslbCmd.isForRevoke();
-        long gslbId = gslbCmd.getGslbId();
-        List<SiteLoadBalancerConfig> sites = gslbCmd.getSiteDetails();
+        final String lbMethod = gslbCmd.getLoadBalancerMethod();
+        final String persistenceType = gslbCmd.getPersistenceType();
+        final String serviceType = gslbCmd.getServiceType();
+        final boolean forRevoke = gslbCmd.isForRevoke();
+        final long gslbId = gslbCmd.getGslbId();
+        final List<SiteLoadBalancerConfig> sites = gslbCmd.getSiteDetails();
 
-        String domainName = gslbCmd.getDomainName();
-        String vserverName = GSLB.generateVirtualServerName(domainName);
+        final String domainName = gslbCmd.getDomainName();
+        final String vserverName = GSLB.generateVirtualServerName(domainName);
 
         try {
 
@@ -1063,17 +1062,17 @@ public class NetscalerResource implements ServerResource {
                 GSLB.createVirtualServer(_netscalerService, vserverName, lbMethod, persistenceType, gslbId, serviceType);
 
                 if (sites != null) { // check if there are any sites that are participating in global load balancing
-                    for (SiteLoadBalancerConfig site : sites) {
+                    for (final SiteLoadBalancerConfig site : sites) {
 
-                        String sitePrivateIP = site.getGslbProviderPrivateIp();
-                        String sitePublicIP = site.getGslbProviderPublicIp();
-                        String servicePublicIp = site.getServicePublicIp();
-                        String servicePublicPort = site.getServicePort();
-                        String siteName = GSLB.generateUniqueSiteName(sitePrivateIP, sitePublicIP, site.getDataCenterId());
+                        final String sitePrivateIP = site.getGslbProviderPrivateIp();
+                        final String sitePublicIP = site.getGslbProviderPublicIp();
+                        final String servicePublicIp = site.getServicePublicIp();
+                        final String servicePublicPort = site.getServicePort();
+                        final String siteName = GSLB.generateUniqueSiteName(sitePrivateIP, sitePublicIP, site.getDataCenterId());
 
                         // Add/Delete GSLB local and remote sites that are part of GSLB virtual server
                         if (!site.forRevoke()) {
-                            String siteType = (site.isLocal()) ? "LOCAL" : "REMOTE";
+                            final String siteType = site.isLocal() ? "LOCAL" : "REMOTE";
                             if (GSLB.getSiteObject(_netscalerService, siteName) != null) {
                                 GSLB.updateSite(_netscalerService, siteType, siteName, site.getGslbProviderPrivateIp(), site.getGslbProviderPublicIp());
                             } else {
@@ -1082,8 +1081,8 @@ public class NetscalerResource implements ServerResource {
                         }
 
                         // Add/Delete GSLB service corresponding the service running on each site
-                        String serviceName = GSLB.generateUniqueServiceName(siteName, servicePublicIp, servicePublicPort);
-                        String monitorName = GSLB.generateGslbServiceMonitorName(servicePublicIp);
+                        final String serviceName = GSLB.generateUniqueServiceName(siteName, servicePublicIp, servicePublicPort);
+                        final String monitorName = GSLB.generateGslbServiceMonitorName(servicePublicIp);
                         if (!site.forRevoke()) {
                             // create a 'gslbservice' object
                             GSLB.createService(_netscalerService, serviceName, site.getServiceType(), servicePublicIp, servicePublicPort, siteName);
@@ -1127,15 +1126,15 @@ public class NetscalerResource implements ServerResource {
                 GSLB.deleteVserverDomainBinding(_netscalerService, vserverName, domainName);
 
                 if (sites != null) {
-                    for (SiteLoadBalancerConfig site : sites) {
+                    for (final SiteLoadBalancerConfig site : sites) {
 
-                        String sitePrivateIP = site.getGslbProviderPrivateIp();
-                        String sitePublicIP = site.getGslbProviderPublicIp();
-                        String servicePublicIp = site.getServicePublicIp();
-                        String servicePublicPort = site.getServicePort();
-                        String siteName = GSLB.generateUniqueSiteName(sitePrivateIP, sitePublicIP, site.getDataCenterId());
-                        String serviceName = GSLB.generateUniqueServiceName(siteName, servicePublicIp, servicePublicPort);
-                        String monitorName = GSLB.generateGslbServiceMonitorName(servicePublicIp);
+                        final String sitePrivateIP = site.getGslbProviderPrivateIp();
+                        final String sitePublicIP = site.getGslbProviderPublicIp();
+                        final String servicePublicIp = site.getServicePublicIp();
+                        final String servicePublicPort = site.getServicePort();
+                        final String siteName = GSLB.generateUniqueSiteName(sitePrivateIP, sitePublicIP, site.getDataCenterId());
+                        final String serviceName = GSLB.generateUniqueServiceName(siteName, servicePublicIp, servicePublicPort);
+                        final String monitorName = GSLB.generateGslbServiceMonitorName(servicePublicIp);
 
                         // delete GSLB service and GSLB monitor binding
                         GSLB.deleteGslbServiceGslbMonitorBinding(_netscalerService, monitorName, serviceName);
@@ -1160,8 +1159,8 @@ public class NetscalerResource implements ServerResource {
 
             saveConfiguration();
 
-        } catch (Exception e) {
-            String errMsg = "Failed to apply GSLB configuration due to " + e.getMessage();
+        } catch (final Exception e) {
+            final String errMsg = "Failed to apply GSLB configuration due to " + e.getMessage();
             if (shouldRetry(numRetries)) {
                 return retry(gslbCmd, numRetries);
             }
@@ -1194,7 +1193,7 @@ public class NetscalerResource implements ServerResource {
                     isUpdateSite = true;
                 }
 
-                assert ("LOCAL".equalsIgnoreCase(siteType) || "REMOTE".equalsIgnoreCase(siteType));
+                assert "LOCAL".equalsIgnoreCase(siteType) || "REMOTE".equalsIgnoreCase(siteType);
                 site.set_sitetype(siteType);
                 site.set_sitename(siteName);
                 site.set_siteipaddress(siteIP);
@@ -1210,8 +1209,8 @@ public class NetscalerResource implements ServerResource {
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug("Successfully created GSLB site: " + siteName);
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to create GSLB site: " + siteName + " due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to create GSLB site: " + siteName + " due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1222,9 +1221,9 @@ public class NetscalerResource implements ServerResource {
         // delete 'gslbsite' object representing a site
         private static void deleteSite(nitro_service client, String siteName) throws ExecutionException {
             try {
-                gslbsite site = getSiteObject(client, siteName);
+                final gslbsite site = getSiteObject(client, siteName);
                 if (site != null) {
-                    gslbsite_gslbservice_binding[] serviceBindings = gslbsite_gslbservice_binding.get(client, siteName);
+                    final gslbsite_gslbservice_binding[] serviceBindings = gslbsite_gslbservice_binding.get(client, siteName);
                     if (serviceBindings != null && serviceBindings.length > 0) {
                         if (s_logger.isDebugEnabled()) {
                             s_logger.debug("There are services associated with GSLB site: " + siteName + " so ignoring site deletion");
@@ -1239,8 +1238,8 @@ public class NetscalerResource implements ServerResource {
                         s_logger.warn("Ignoring delete request for non existing  GSLB site: " + siteName);
                     }
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to delete GSLB site: " + siteName + " due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to delete GSLB site: " + siteName + " due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1259,7 +1258,7 @@ public class NetscalerResource implements ServerResource {
                     }
                     return;
                 }
-                assert ("LOCAL".equalsIgnoreCase(siteType) || "REMOTE".equalsIgnoreCase(siteType));
+                assert "LOCAL".equalsIgnoreCase(siteType) || "REMOTE".equalsIgnoreCase(siteType);
                 site.set_sitetype(siteType);
                 site.set_sitename(siteName);
                 site.set_siteipaddress(siteIP);
@@ -1273,8 +1272,8 @@ public class NetscalerResource implements ServerResource {
                     s_logger.debug("Successfully updated GSLB site: " + siteName);
                 }
 
-            } catch (Exception e) {
-                String errMsg = "Failed to update GSLB site: " + siteName + " due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to update GSLB site: " + siteName + " due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1328,8 +1327,8 @@ public class NetscalerResource implements ServerResource {
                     s_logger.debug("Successfully added GSLB virtual server: " + vserverName);
                 }
 
-            } catch (Exception e) {
-                String errMsg = "Failed to add GSLB virtual server: " + vserverName + " due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to add GSLB virtual server: " + vserverName + " due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1340,7 +1339,7 @@ public class NetscalerResource implements ServerResource {
         // delete 'gslbvserver' object representing a globally load balanced service
         private static void deleteVirtualServer(nitro_service client, String vserverName) throws ExecutionException {
             try {
-                gslbvserver vserver = getVserverObject(client, vserverName);
+                final gslbvserver vserver = getVserverObject(client, vserverName);
                 if (vserver != null) {
                     gslbvserver.delete(client, vserver);
                     if (s_logger.isDebugEnabled()) {
@@ -1351,63 +1350,8 @@ public class NetscalerResource implements ServerResource {
                         s_logger.warn("Ignoring delete request for non existing  GSLB virtual server: " + vserverName);
                     }
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to delete GSLB virtual server: " + vserverName + " due to " + e.getMessage();
-                if (s_logger.isDebugEnabled()) {
-                    s_logger.debug(errMsg);
-                }
-                throw new ExecutionException(errMsg);
-            }
-        }
-
-        // enable 'gslbvserver' object representing a globally load balanced service
-        private static void enableVirtualServer(nitro_service client, String vserverName) throws ExecutionException {
-            try {
-                gslbvserver vserver = getVserverObject(client, vserverName);
-                if (vserver != null) {
-                    gslbvserver.enable(client, vserver);
-                }
-            } catch (Exception e) {
-                String errMsg = "Failed to enable GSLB virtual server: " + vserverName + " due to " + e.getMessage();
-                if (s_logger.isDebugEnabled()) {
-                    s_logger.debug(errMsg);
-                }
-                throw new ExecutionException(errMsg);
-            }
-        }
-
-        // disable 'gslbvserver' object representing a globally load balanced service
-        private static void disableVirtualServer(nitro_service client, String vserverName) throws ExecutionException {
-            try {
-                gslbvserver vserver = getVserverObject(client, vserverName);
-                if (vserver != null) {
-                    gslbvserver.disable(client, vserver);
-                }
-            } catch (Exception e) {
-                String errMsg = "Failed to disable GSLB virtual server: " + vserverName + " due to " + e.getMessage();
-                if (s_logger.isDebugEnabled()) {
-                    s_logger.debug(errMsg);
-                }
-                throw new ExecutionException(errMsg);
-            }
-        }
-
-        // update 'gslbvserver' object representing a globally load balanced service
-        private static void updateVirtualServer(nitro_service client, String vserverName, String lbMethod, String persistenceType, String serviceType)
-                throws ExecutionException {
-            try {
-                gslbvserver vServer = getVserverObject(client, vserverName);
-                if (vServer != null) {
-                    vServer.set_lbmethod(lbMethod);
-                    vServer.set_persistencetype(persistenceType);
-                    vServer.set_servicetype(serviceType);
-                    gslbvserver.update(client, vServer);
-                    if (s_logger.isDebugEnabled()) {
-                        s_logger.debug("Successfully updated GSLB virtual server: " + vserverName);
-                    }
-                }
-            } catch (Exception e) {
-                String errMsg = "Failed to update GSLB virtual server: " + vserverName + " due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to delete GSLB virtual server: " + vserverName + " due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1421,15 +1365,15 @@ public class NetscalerResource implements ServerResource {
             try {
                 gslbservice service;
                 service = getServiceObject(client, serviceName);
-                String gslbServerName = generateGslbServerName(serviceIp);
+                final String gslbServerName = generateGslbServerName(serviceIp);
 
                 if (!gslbServerExists(client, gslbServerName)) {
                     base_response apiCallResult;
-                    com.citrix.netscaler.nitro.resource.config.basic.server nsServer = new com.citrix.netscaler.nitro.resource.config.basic.server();
+                    final com.citrix.netscaler.nitro.resource.config.basic.server nsServer = new com.citrix.netscaler.nitro.resource.config.basic.server();
                     nsServer.set_name(gslbServerName);
                     nsServer.set_ipaddress(serviceIp);
                     apiCallResult = com.citrix.netscaler.nitro.resource.config.basic.server.add(client, nsServer);
-                    if ((apiCallResult.errorcode != 0) && (apiCallResult.errorcode != NitroError.NS_RESOURCE_EXISTS)) {
+                    if (apiCallResult.errorcode != 0 && apiCallResult.errorcode != NitroError.NS_RESOURCE_EXISTS) {
                         throw new ExecutionException("Failed to add server " + gslbServerName + " due to" + apiCallResult.message);
                     }
                 }
@@ -1443,7 +1387,7 @@ public class NetscalerResource implements ServerResource {
 
                 service.set_sitename(siteName);
                 service.set_servername(gslbServerName);
-                int port = Integer.parseInt(servicePort);
+                final int port = Integer.parseInt(servicePort);
                 service.set_port(port);
                 service.set_servicename(serviceName);
                 service.set_servicetype(serviceType);
@@ -1457,8 +1401,8 @@ public class NetscalerResource implements ServerResource {
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug("Successfully created service: " + serviceName + " at site: " + siteName);
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to created service: " + serviceName + " at site: " + siteName + " due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to created service: " + serviceName + " at site: " + siteName + " due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1468,7 +1412,7 @@ public class NetscalerResource implements ServerResource {
 
         private static void deleteService(nitro_service client, String serviceName) throws ExecutionException {
             try {
-                gslbservice service = getServiceObject(client, serviceName);
+                final gslbservice service = getServiceObject(client, serviceName);
                 if (service != null) {
                     gslbservice.delete(client, serviceName);
                     if (s_logger.isDebugEnabled()) {
@@ -1479,34 +1423,8 @@ public class NetscalerResource implements ServerResource {
                         s_logger.warn("Ignoring delete request for non existing  service: " + serviceName);
                     }
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to delete service: " + serviceName + " due to " + e.getMessage();
-                if (s_logger.isDebugEnabled()) {
-                    s_logger.debug(errMsg);
-                }
-                throw new ExecutionException(errMsg);
-            }
-        }
-
-        private static void updateService(nitro_service client, String serviceName, String serviceType, String publicIp, String publicPort, String siteName)
-                throws ExecutionException {
-            try {
-                gslbservice service;
-                service = getServiceObject(client, serviceName);
-
-                if (service != null) {
-                    service.set_sitename(siteName);
-                    service.set_publicip(publicIp);
-                    service.set_publicport(Integer.getInteger(publicPort));
-                    service.set_servicename(serviceName);
-                    service.set_servicetype(serviceType);
-                    gslbservice.update(client, service);
-                    if (s_logger.isDebugEnabled()) {
-                        s_logger.debug("Successfully updated service: " + serviceName + " at site: " + siteName);
-                    }
-                }
-            } catch (Exception e) {
-                String errMsg = "Failed to update service: " + serviceName + " at site: " + siteName + "due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to delete service: " + serviceName + " due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1517,8 +1435,8 @@ public class NetscalerResource implements ServerResource {
         private static void createVserverServiceBinding(nitro_service client, String serviceName, String vserverName, long weight) throws ExecutionException {
             String errMsg;
             try {
-                assert (weight >= 1 && weight <= 100);
-                gslbvserver_gslbservice_binding binding = new gslbvserver_gslbservice_binding();
+                assert weight >= 1 && weight <= 100;
+                final gslbvserver_gslbservice_binding binding = new gslbvserver_gslbservice_binding();
                 binding.set_name(vserverName);
                 binding.set_servicename(serviceName);
                 binding.set_weight(weight);
@@ -1526,7 +1444,7 @@ public class NetscalerResource implements ServerResource {
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug("Successfully created service: " + serviceName + " and virtual server: " + vserverName + " binding");
                 }
-            } catch (nitro_exception ne) {
+            } catch (final nitro_exception ne) {
                 if (ne.getErrorCode() == 273) {
                     return;
                 }
@@ -1535,7 +1453,7 @@ public class NetscalerResource implements ServerResource {
                     s_logger.debug(errMsg);
                 }
                 throw new ExecutionException(errMsg);
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 errMsg = "Failed to create service: " + serviceName + " and virtual server: " + vserverName + " binding due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
@@ -1546,9 +1464,9 @@ public class NetscalerResource implements ServerResource {
 
         private static void deleteVserverServiceBinding(nitro_service client, String serviceName, String vserverName) throws ExecutionException {
             try {
-                gslbvserver_gslbservice_binding[] bindings = gslbvserver_gslbservice_binding.get(client, vserverName);
+                final gslbvserver_gslbservice_binding[] bindings = gslbvserver_gslbservice_binding.get(client, vserverName);
                 if (bindings != null) {
-                    for (gslbvserver_gslbservice_binding binding : bindings) {
+                    for (final gslbvserver_gslbservice_binding binding : bindings) {
                         if (binding.get_servicename().equalsIgnoreCase(serviceName) && binding.get_name().equals(vserverName)) {
                             gslbvserver_gslbservice_binding.delete(client, binding);
                             if (s_logger.isDebugEnabled()) {
@@ -1558,8 +1476,8 @@ public class NetscalerResource implements ServerResource {
                         }
                     }
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to create service: " + serviceName + " and virtual server: " + vserverName + " binding due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to create service: " + serviceName + " and virtual server: " + vserverName + " binding due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1571,7 +1489,7 @@ public class NetscalerResource implements ServerResource {
         private static void createVserverDomainBinding(nitro_service client, String vserverName, String domainName) throws ExecutionException {
             String errMsg;
             try {
-                gslbvserver_domain_binding binding = new gslbvserver_domain_binding();
+                final gslbvserver_domain_binding binding = new gslbvserver_domain_binding();
                 binding.set_domainname(domainName);
                 binding.set_name(vserverName);
                 gslbvserver_domain_binding.add(client, binding);
@@ -1579,12 +1497,12 @@ public class NetscalerResource implements ServerResource {
                     s_logger.debug("Successfully added virtual server: " + vserverName + " domain name: " + domainName + " binding");
                 }
                 return;
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 if (e.getErrorCode() == NitroError.NS_GSLB_DOMAIN_ALREADY_BOUND) {
                     return;
                 }
                 errMsg = e.getMessage();
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 errMsg = e.getMessage();
             }
             errMsg = "Failed to create virtual server: " + vserverName + " domain name: " + domainName + " binding" + errMsg;
@@ -1596,9 +1514,9 @@ public class NetscalerResource implements ServerResource {
 
         private static void deleteVserverDomainBinding(nitro_service client, String vserverName, String domainName) throws ExecutionException {
             try {
-                gslbvserver_domain_binding[] bindings = gslbvserver_domain_binding.get(client, vserverName);
+                final gslbvserver_domain_binding[] bindings = gslbvserver_domain_binding.get(client, vserverName);
                 if (bindings != null) {
-                    for (gslbvserver_domain_binding binding : bindings) {
+                    for (final gslbvserver_domain_binding binding : bindings) {
                         if (binding.get_domainname().equalsIgnoreCase(domainName)) {
                             gslbvserver_domain_binding.delete(client, binding);
                             if (s_logger.isDebugEnabled()) {
@@ -1608,8 +1526,8 @@ public class NetscalerResource implements ServerResource {
                         }
                     }
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to delete virtual server: " + vserverName + " and domain " + domainName + " binding due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to delete virtual server: " + vserverName + " and domain " + domainName + " binding due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1619,19 +1537,19 @@ public class NetscalerResource implements ServerResource {
 
         private static void createGslbServiceMonitor(nitro_service nsService, String servicePublicIp, String serviceName) throws ExecutionException {
             try {
-                lbmonitor newmonitor = new lbmonitor();
-                String monitorName = generateGslbServiceMonitorName(servicePublicIp);
+                final lbmonitor newmonitor = new lbmonitor();
+                final String monitorName = generateGslbServiceMonitorName(servicePublicIp);
                 newmonitor.set_type("TCP");
                 newmonitor.set_servicename(serviceName);
                 newmonitor.set_monitorname(monitorName);
                 newmonitor.set_state("ENABLED");
                 lbmonitor.add(nsService, newmonitor);
-            } catch (nitro_exception ne) {
+            } catch (final nitro_exception ne) {
                 if (ne.getErrorCode() == NitroError.NS_RESOURCE_EXISTS) {
                     return;
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to create GSLB monitor for service public ip" + servicePublicIp;
+            } catch (final Exception e) {
+                final String errMsg = "Failed to create GSLB monitor for service public ip" + servicePublicIp;
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1641,18 +1559,18 @@ public class NetscalerResource implements ServerResource {
 
         private static void deleteGslbServiceMonitor(nitro_service nsService, String monitorName) throws ExecutionException {
             try {
-                lbmonitor serviceMonitor = lbmonitor.get(nsService, monitorName);
+                final lbmonitor serviceMonitor = lbmonitor.get(nsService, monitorName);
                 if (serviceMonitor != null) {
                     lbmonitor.delete(nsService, serviceMonitor);
                 }
-            } catch (nitro_exception ne) {
+            } catch (final nitro_exception ne) {
                 if (ne.getErrorCode() != NitroError.NS_RESOURCE_NOT_EXISTS) {
-                    String errMsg = "Failed to delete monitor " + monitorName + " for GSLB service due to " + ne.getMessage();
+                    final String errMsg = "Failed to delete monitor " + monitorName + " for GSLB service due to " + ne.getMessage();
                     s_logger.debug(errMsg);
                     throw new com.cloud.utils.exception.ExecutionException(errMsg);
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to delete monitor " + monitorName + " for GSLB service due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to delete monitor " + monitorName + " for GSLB service due to " + e.getMessage();
                 s_logger.debug(errMsg);
                 throw new com.cloud.utils.exception.ExecutionException(errMsg);
             }
@@ -1660,11 +1578,11 @@ public class NetscalerResource implements ServerResource {
 
         private static void createGslbServiceGslbMonitorBinding(nitro_service nsService, String monitorName, String serviceName) {
             try {
-                gslbservice_lbmonitor_binding monitorBinding = new gslbservice_lbmonitor_binding();
+                final gslbservice_lbmonitor_binding monitorBinding = new gslbservice_lbmonitor_binding();
                 monitorBinding.set_monitor_name(monitorName);
                 monitorBinding.set_servicename(serviceName);
                 gslbservice_lbmonitor_binding.add(nsService, monitorBinding);
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 // TODO: Nitro API version 10.* is not compatible for NetScalers 9.*, so may fail
                 // against NetScaler version lesser than 10 hence ignore the exception
                 s_logger.warn("Failed to bind monitor to GSLB service due to " + e.getMessage());
@@ -1673,16 +1591,16 @@ public class NetscalerResource implements ServerResource {
 
         private static void deleteGslbServiceGslbMonitorBinding(nitro_service nsService, String monitorName, String serviceName) {
             try {
-                gslbservice_lbmonitor_binding[] monitorBindings = gslbservice_lbmonitor_binding.get(nsService, serviceName);
+                final gslbservice_lbmonitor_binding[] monitorBindings = gslbservice_lbmonitor_binding.get(nsService, serviceName);
                 if (monitorBindings != null && monitorBindings.length > 0) {
-                    for (gslbservice_lbmonitor_binding binding : monitorBindings) {
+                    for (final gslbservice_lbmonitor_binding binding : monitorBindings) {
                         if (binding.get_monitor_name().equalsIgnoreCase(monitorName)) {
                             s_logger.info("Found a binding between monitor " + binding.get_monitor_name() + " and " + binding.get_servicename());
                             gslbservice_lbmonitor_binding.delete(nsService, binding);
                         }
                     }
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 s_logger.debug("Failed to delete GSLB monitor " + monitorName + " and GSLB service " + serviceName + " binding due to " + e.getMessage() +
                         " but moving on ..., will be cleaned up as part of GSLB " + " service delete any way..");
             }
@@ -1691,11 +1609,11 @@ public class NetscalerResource implements ServerResource {
         // get 'gslbsite' object corresponding to a site name
         private static gslbsite getSiteObject(nitro_service client, String siteName) {
             try {
-                gslbsite site = gslbsite.get(client, siteName);
+                final gslbsite site = gslbsite.get(client, siteName);
                 if (site != null) {
                     return site;
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 s_logger.info("[ignored]"
                         + "error getting site: " + e.getLocalizedMessage());
             }
@@ -1704,18 +1622,18 @@ public class NetscalerResource implements ServerResource {
 
         private static gslbvserver getVserverObject(nitro_service client, String vserverName) {
             try {
-                gslbvserver vserver = gslbvserver.get(client, vserverName);
+                final gslbvserver vserver = gslbvserver.get(client, vserverName);
                 return vserver;
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 return null;
             }
         }
 
         private static gslbservice getServiceObject(nitro_service client, String serviceName) {
             try {
-                gslbservice service = gslbservice.get(client, serviceName);
+                final gslbservice service = gslbservice.get(client, serviceName);
                 return service;
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 return null;
             }
         }
@@ -1743,13 +1661,13 @@ public class NetscalerResource implements ServerResource {
                 } else {
                     return false;
                 }
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 if (e.getErrorCode() == NitroError.NS_RESOURCE_NOT_EXISTS) {
                     return false;
                 } else {
                     throw new ExecutionException("Failed to verify Server " + serverName + " exists on the NetScaler device due to " + e.getMessage());
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to verify Server " + serverName + " exists on the NetScaler device due to " + e.getMessage());
             }
         }
@@ -1759,7 +1677,7 @@ public class NetscalerResource implements ServerResource {
         }
 
         private static String genGslbObjectName(Object... args) {
-            StringBuffer buff = new StringBuffer();
+            final StringBuffer buff = new StringBuffer();
             for (int i = 0; i < args.length; i++) {
                 buff.append(args[i]);
                 if (i != args.length - 1) {
@@ -1778,14 +1696,15 @@ public class NetscalerResource implements ServerResource {
 
         private static boolean isSslCertKeyPresent(nitro_service ns, String certKeyName) throws ExecutionException {
 
-            String filter = "certkey:" + certKeyName;
+            final String filter = "certkey:" + certKeyName;
 
             try {
-                if (sslcertkey.count_filtered(ns, filter) > 0)
+                if (sslcertkey.count_filtered(ns, filter) > 0) {
                     return true;
-            } catch (nitro_exception e) {
+                }
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to get certkey " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to get certkey " + e.getMessage());
             }
 
@@ -1795,13 +1714,13 @@ public class NetscalerResource implements ServerResource {
         private static void deleteSslCertKey(nitro_service ns, String certKeyName) throws ExecutionException {
             try {
 
-                sslcertkey certkey = new sslcertkey();
+                final sslcertkey certkey = new sslcertkey();
                 certkey.set_certkey(certKeyName);
                 sslcertkey.delete(ns, certkey);
 
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to delete certkey " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to delete certkey " + e.getMessage());
             }
 
@@ -1818,12 +1737,13 @@ public class NetscalerResource implements ServerResource {
         private static void createSslCertKey(nitro_service ns, String certFilename, String keyFilename, String certKeyName, String password) throws ExecutionException {
             s_logger.debug("Adding cert to netscaler");
             try {
-                sslcertkey certkey = new sslcertkey();
+                final sslcertkey certkey = new sslcertkey();
                 certkey.set_certkey(certKeyName);
                 certkey.set_cert(SSL_CERT_PATH + certFilename);
 
-                if (keyFilename != null)
+                if (keyFilename != null) {
                     certkey.set_key(SSL_CERT_PATH + keyFilename);
+                }
 
                 if (password != null) {
                     certkey.set_passplain(password);
@@ -1831,44 +1751,25 @@ public class NetscalerResource implements ServerResource {
 
                 certkey.perform_operation(ns);
 
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to add certkey binding " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to add certkey binding " + e.getMessage());
             }
 
         }
 
-        public static void updateCertKey(nitro_service ns, String certKeyName, String cert, String key, String password) throws ExecutionException {
-            try {
-                sslcertkey certkey = sslcertkey.get(ns, certKeyName);
-                if (cert != null)
-                    certkey.set_cert(cert);
-                if (key != null)
-                    certkey.set_key(cert);
-                if (password != null)
-                    certkey.set_passplain(cert);
-
-                sslcertkey.change(ns, certkey);
-
-            } catch (nitro_exception e) {
-                throw new ExecutionException("Failed to update ssl on load balancer due to " + e.getMessage());
-            } catch (Exception e) {
-                throw new ExecutionException("Failed to update ssl on load balancer due to " + e.getMessage());
-            }
-        }
-
         private static void bindCertKeyToVserver(nitro_service ns, String certKeyName, String vserver) throws ExecutionException {
             s_logger.debug("Adding cert to netscaler");
 
             try {
-                sslvserver_sslcertkey_binding cert_binding = new sslvserver_sslcertkey_binding();
+                final sslvserver_sslcertkey_binding cert_binding = new sslvserver_sslcertkey_binding();
                 cert_binding.set_certkeyname(certKeyName);
                 cert_binding.set_vservername(vserver);
                 cert_binding.perform_operation(ns);
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to bind certkey to vserver due to " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to bind certkey to vserver due to " + e.getMessage());
             }
         }
@@ -1876,14 +1777,14 @@ public class NetscalerResource implements ServerResource {
         private static void unbindCertKeyFromVserver(nitro_service ns, String certKeyName, String vserver) throws ExecutionException {
             try {
 
-                sslvserver_sslcertkey_binding cert_binding = new sslvserver_sslcertkey_binding();
+                final sslvserver_sslcertkey_binding cert_binding = new sslvserver_sslcertkey_binding();
                 cert_binding.set_certkeyname(certKeyName);
                 cert_binding.set_vservername(vserver);
                 sslvserver_sslcertkey_binding.delete(ns, cert_binding);
 
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to unbind certkey to vserver due to " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to unbind certkey to vserver due to " + e.getMessage());
             }
 
@@ -1892,7 +1793,7 @@ public class NetscalerResource implements ServerResource {
         private static void uploadCert(String nsIp, String user, String password, String certFilename, byte[] certData) throws ExecutionException {
             try {
                 SshHelper.scpTo(nsIp, SSH_PORT, user, null, password, SSL_CERT_PATH, certData, certFilename, null);
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to copy private key to device " + e.getMessage());
             }
         }
@@ -1900,7 +1801,7 @@ public class NetscalerResource implements ServerResource {
         private static void uploadKey(String nsIp, String user, String password, String keyFilename, byte[] keyData) throws ExecutionException {
             try {
                 SshHelper.scpTo(nsIp, SSH_PORT, user, null, password, SSL_CERT_PATH, keyData, keyFilename, null);
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to copy private key to device " + e.getMessage());
             }
         }
@@ -1910,47 +1811,31 @@ public class NetscalerResource implements ServerResource {
                 return;
             }
             try {
-                base_response result = ns.enable_features(new String[] {"SSL"});
-                if (result.errorcode != 0)
+                final base_response result = ns.enable_features(new String[] {"SSL"});
+                if (result.errorcode != 0) {
                     throw new ExecutionException("Unable to enable SSL on LB");
-            } catch (nitro_exception e) {
+                }
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to enable ssl feature on load balancer due to " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to enable ssl feature on load balancer due to " + e.getMessage());
             }
         }
 
-        public static boolean checkSslFeature(nitro_service ns) throws ExecutionException {
-            try {
-                String[] features = ns.get_enabled_features();
-                if (features != null) {
-                    for (String feature : features) {
-                        if (feature.equalsIgnoreCase("SSL")) {
-                            return true;
-                        }
-                    }
-                }
-                return false;
-            } catch (nitro_exception e) {
-                throw new ExecutionException("Failed to check ssl feature on load balancer due to " + e.getMessage());
-            } catch (Exception e) {
-                throw new ExecutionException("Failed to check ssl feature on load balancer due to " + e.getMessage());
-            }
-        }
-
         public static boolean certLinkExists(nitro_service ns, String userCertName, String caCertName) throws ExecutionException {
             try {
                 // check if there is a link from userCertName to caCertName
 
-                sslcertkey userCert = sslcertkey.get(ns, userCertName);
-                String nsCaCert = userCert.get_linkcertkeyname();
+                final sslcertkey userCert = sslcertkey.get(ns, userCertName);
+                final String nsCaCert = userCert.get_linkcertkeyname();
 
-                if (nsCaCert != null && nsCaCert.equals(caCertName))
+                if (nsCaCert != null && nsCaCert.equals(caCertName)) {
                     return true;
+                }
 
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to check cert link on load balancer to " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to check cert link on load balancer due to " + e.getMessage());
             }
             return false;
@@ -1961,19 +1846,19 @@ public class NetscalerResource implements ServerResource {
 
                 // the assumption is that that both userCertName and caCertName are present on NS
 
-                sslcertkey caCert = sslcertkey.get(ns, caCertName);
-                sslcertkey userCert = sslcertkey.get(ns, userCertName);
+                final sslcertkey caCert = sslcertkey.get(ns, caCertName);
+                final sslcertkey userCert = sslcertkey.get(ns, userCertName);
 
-                sslcertkey linkResource = new sslcertkey();
+                final sslcertkey linkResource = new sslcertkey();
 
                 // link user cert to CA cert
                 linkResource.set_certkey(userCert.get_certkey());
                 linkResource.set_linkcertkeyname(caCert.get_certkey());
                 sslcertkey.link(ns, linkResource);
 
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to check cert link on load balancer to " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to check cert link on load balancer due to " + e.getMessage());
             }
 
@@ -1982,14 +1867,14 @@ public class NetscalerResource implements ServerResource {
         public static boolean isCaforCerts(nitro_service ns, String caCertName) throws ExecutionException {
             // check if this certificate  serves as a CA for other certificates
             try {
-                sslcertlink[] childLinks = sslcertlink.get_filtered(ns, "linkcertkeyname:" + caCertName);
+                final sslcertlink[] childLinks = sslcertlink.get_filtered(ns, "linkcertkeyname:" + caCertName);
                 if (childLinks != null && childLinks.length > 0) {
                     return true;
                 }
 
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to check cert link on load balancer to " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to check cert link on load balancer due to " + e.getMessage());
             }
             return false;
@@ -1999,14 +1884,14 @@ public class NetscalerResource implements ServerResource {
         public static boolean isBoundToVserver(nitro_service ns, String certKeyName, String nsVirtualServerName) throws ExecutionException {
             try {
 
-                sslcertkey_sslvserver_binding[] cert_vs_binding = sslcertkey_sslvserver_binding.get_filtered(ns, certKeyName, "vservername:" + nsVirtualServerName);
+                final sslcertkey_sslvserver_binding[] cert_vs_binding = sslcertkey_sslvserver_binding.get_filtered(ns, certKeyName, "vservername:" + nsVirtualServerName);
                 if (cert_vs_binding != null && cert_vs_binding.length > 0) {
                     return true;
                 }
 
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 throw new Exe

<TRUNCATED>

[33/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1529 from mike-tutkowski/marvin_replace_sleep

Marvin: Replace a timer.sleep(30) with pulling logichttps://issues.apache.org/jira/browse/CLOUDSTACK-9374

>From the ticket:

In the base.py file, there is a Host class with a delete instance method.

This method first attempts to transition the host into the maintenance resource state.

The first step in this process is to transition the host into the prepare-for-maintenance resource state.

A while later, the host can be transitioned completely into the maintenance resource state.

In an attempt to wait for this transition to occur, the delete method has a timer.sleep(30) call.

The hope is that the host will have transitioned from the prepare-for-maintenance resource state to the maintenance resource state within 30 seconds, but this does not always happen.

We should correct this problem by putting in logic to query the management server for the resource state of the host. If it's in the expected state, move on; else, sleep for a bit and try again (up to a certain limit).

* pr/1529:
  Replace a timer.sleep(30) with pulling logic

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 10bcf2955a436104bba96517dff9ce41ae2af7b7
Parents: ccf2265 eeb3373
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 11 00:03:58 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 11 00:03:59 2016 -0400

----------------------------------------------------------------------
 tools/marvin/marvin/codes.py    | 25 +++++++++++++++++++++++++
 tools/marvin/marvin/lib/base.py | 36 ++++++++++++++++++++++++++++++++----
 2 files changed, 57 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[10/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1527 from milamberspace/L10N-update-4.7-20160502

Update L10N resource files with 4.7 strings from Transifex (20160502)Force "translator" mode with the transifex client.

cc @swill the new PR.

* pr/1527:
  Update L10N resource files with 4.7 strings from Transifex (20160502) Force "translator" mode with the transifex client.

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 86dfcb2a0eb2b297a137915e80f3280d12297661
Parents: f434f50 6460cde
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 4 10:46:39 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 4 10:46:39 2016 -0400

----------------------------------------------------------------------
 .../classes/resources/messages_de_DE.properties |    1 +
 .../classes/resources/messages_es.properties    | 1075 +++++++++++++++++-
 .../classes/resources/messages_fr_FR.properties |    3 +-
 .../classes/resources/messages_hu.properties    |   21 +-
 .../classes/resources/messages_it_IT.properties |    1 -
 .../classes/resources/messages_ja_JP.properties |    3 +-
 .../classes/resources/messages_ko_KR.properties |    1 -
 .../classes/resources/messages_nb_NO.properties |    3 +-
 .../classes/resources/messages_nl_NL.properties |    1 -
 .../classes/resources/messages_pt_BR.properties |    3 +-
 .../classes/resources/messages_ru_RU.properties |    1 -
 .../classes/resources/messages_zh_CN.properties |    1 -
 tools/transifex/sync-transifex-ui.sh            |    2 +-
 13 files changed, 1087 insertions(+), 29 deletions(-)
----------------------------------------------------------------------



[24/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge release branch 4.8 to master

* 4.8:
  Update L10N resource files with 4.8 strings from Transifex (20160504) Force "translator" mode with the transifex client. Update Transifex client config file for 4.8 resources/L10N ref. (generated by Tx client)


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: a368cb703fa485062974b5b908e9f37f37388e3f
Parents: 9f970f2 1c2400f
Author: Will Stevens <wi...@gmail.com>
Authored: Tue May 10 23:45:43 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Tue May 10 23:45:43 2016 -0400

----------------------------------------------------------------------
 .../classes/resources/messages_de_DE.properties |   1 +
 .../classes/resources/messages_es.properties    | 927 ++++++++++---------
 .../classes/resources/messages_fr_FR.properties |   9 +-
 .../classes/resources/messages_hu.properties    |   4 +-
 .../classes/resources/messages_ja_JP.properties |   2 +-
 .../classes/resources/messages_ko_KR.properties |  16 +-
 .../classes/resources/messages_nb_NO.properties |   9 +-
 .../classes/resources/messages_nl_NL.properties |   5 +-
 .../classes/resources/messages_pt_BR.properties |  11 +-
 .../classes/resources/messages_ru_RU.properties |  14 +-
 .../classes/resources/messages_zh_CN.properties |   2 +-
 tools/transifex/.tx/config                      |  19 +
 12 files changed, 522 insertions(+), 497 deletions(-)
----------------------------------------------------------------------



[08/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1493 from shapeblue/nio-fix

CLOUDSTACK-9348: Use non-blocking SSL handshake in NioConnection/Link- Uses non-blocking socket config in NioClient and NioServer/NioConnection
- Scalable connectivity from agents and peer clustered-management server
- Removes blocking ssl handshake code with a non-blocking code
- Protects from denial-of-service issues that can degrade mgmt server responsiveness
  due to an aggressive/malicious client
- Uses separate executor services for handling connect/accept events

Changes are covered the NioTest so I did not write a new test, advise how we can improve this. Further, I tried to invest time on writing a benchmark test to reproduce a degraded server but could not write it deterministic-ally (sometimes fails/passes but not always). Review, CI testing and feedback requested /cc @swill @jburwell @DaanHoogland @wido @remibergsma @rafaelweingartner @GabrielBrascher

* pr/1493:
  CLOUDSTACK-9348: Use non-blocking SSL handshake
  CLOUDSTACK-9348: Unit test to demonstrate denial of service attack

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 7ce0e10fbcd949375e43535aae168421ecdaa562
Parents: 29ba71f ba77a69
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 4 10:30:58 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 4 10:30:58 2016 -0400

----------------------------------------------------------------------
 .../manager/ClusteredAgentManagerImpl.java      |   9 +-
 utils/pom.xml                                   |   1 -
 .../src/main/java/com/cloud/utils/nio/Link.java | 294 ++++++++++++-------
 .../java/com/cloud/utils/nio/NioClient.java     |  31 +-
 .../java/com/cloud/utils/nio/NioConnection.java |  84 +++---
 .../java/com/cloud/utils/nio/NioServer.java     |   8 +-
 .../java/com/cloud/utils/testcase/NioTest.java  | 249 ++++++++++------
 7 files changed, 406 insertions(+), 270 deletions(-)
----------------------------------------------------------------------



[25/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1124 from rafaelweingartner/CID-1338387

CID-1338387: Deletion of method endPointSelector.selectHypervisorHostFollowing the discussions and analysis presented on PR #1056 create by @DaanHoogland
This PR is intended to push those changes that were discussed there regarding the of endPointSelector.selectHypervisorHost method.

* pr/1124:
  Deletion of method endPointSelector.selectHypervisorHost

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 8a3fd1061544512a18402876db62bf33254301f3
Parents: a368cb7 b56e9c7
Author: Will Stevens <wi...@gmail.com>
Authored: Tue May 10 23:47:49 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Tue May 10 23:47:50 2016 -0400

----------------------------------------------------------------------
 .../subsystem/api/storage/EndPointSelector.java |  2 -
 .../endpoint/DefaultEndPointSelector.java       | 48 ++------------------
 .../ovm3/resources/Ovm3HypervisorGuru.java      | 45 +-----------------
 .../src/com/cloud/hypervisor/XenServerGuru.java | 39 +++++-----------
 .../cloud/hypervisor/HypervisorGuruBase.java    | 26 ++++-------
 5 files changed, 26 insertions(+), 134 deletions(-)
----------------------------------------------------------------------



[09/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1408 from wido/security-group-lock

kvm: Aqcuire lock when running security group Python scriptIt could happen that when multiple instances are starting at the same
time on a KVM host the Agent spawns multiple instances of security_group.py
which both try to modify iptables/ebtables rules.

This fails with on of the two processes failing.

The instance is still started, but it doesn't have any IP connectivity due
to the failed programming of the security groups.

This modification lets the script aqcuire a exclusive lock on a file so that
only one instance of the scripts talks to iptables/ebtables at once.

Other instances of the script which start will poll every 500ms if they can
obtain the lock and otherwise execute anyway after 15 seconds.

* pr/1408:
  kvm: Aqcuire lock when running security group Python script

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 62d2954f51e843300bccbb2b6d4597d1433c7e2b
Parents: 7ce0e10 26becef
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 4 10:32:47 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 4 10:32:48 2016 -0400

----------------------------------------------------------------------
 scripts/vm/network/security_group.py | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[49/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
maven: upgrade bounty castle version to 1.54

Upgrades bountycastle dependency version to bcprov-15on v1.54


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 2d82198acad1cab0755cfc18bdbc5ba7ee8f66ca
Parents: bee2bdc
Author: Daan Hoogland <da...@onecht.net>
Authored: Fri Apr 22 16:28:33 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Wed May 11 15:11:53 2016 +0530

----------------------------------------------------------------------
 .../network/resource/NetscalerResource.java     | 1225 ++++++++----------
 pom.xml                                         |    2 +-
 .../cloudstack/network/lb/CertServiceImpl.java  |  255 ++--
 .../cloudstack/network/lb/CertServiceTest.java  |  367 +++---
 .../cloud/utils/security/CertificateHelper.java |   69 +-
 5 files changed, 918 insertions(+), 1000 deletions(-)
----------------------------------------------------------------------



[15/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e81a6b27/client/WEB-INF/classes/resources/messages_es.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_es.properties b/client/WEB-INF/classes/resources/messages_es.properties
index 5b6c4b7..33fee1f 100644
--- a/client/WEB-INF/classes/resources/messages_es.properties
+++ b/client/WEB-INF/classes/resources/messages_es.properties
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-changed.item.properties=Propiedades del elemento cambiados
+changed.item.properties=Propiedades del elemento cambiadas
 confirm.enable.s3=Por favor, complete la siguiente informaci\u00f3n para habilitar el soporte del Almacenamiento Secundario sobre S3
 confirm.enable.swift=Por favor, complete la siguiente informaci\u00f3n para habilitar el soporte para Swift
 error.could.not.change.your.password.because.ldap.is.enabled=Error, no se puede cambiar la contrase\u00f1a porque LDAP esta activado
@@ -28,23 +28,23 @@ error.mgmt.server.inaccessible=El Servidor de Gesti\u00f3n es inaccesible. Por f
 error.password.not.match=Los campos de contrase\u00f1a no coinciden
 error.please.specify.physical.network.tags=Las Ofertas de Red no est\u00e1n disponibles hasta que se especifique los tags para esta red f\u00edsica.
 error.session.expired=Su sesi\u00f3n ha caducado.
-error.something.went.wrong.please.correct.the.following=Algo sali\u00f3 mal, pro favor corrija lo siguiente
+error.something.went.wrong.please.correct.the.following=Algo sali\u00f3 mal, por favor corrija lo siguiente
 error.unable.to.reach.management.server=No podemos conectar con el Management Server
-error.unresolved.internet.name=El nombre de Internet no se puede resolver.
-force.delete.domain.warning=Advertencia\: Si elige esta opci\u00f3n, la supresi\u00f3 de todos los dominios secundarios y todas las cuentas asociadas y sus recursos.
-force.delete=Forzar el borrado
-force.remove=Forzar el retiro
-force.remove.host.warning=Advertencia\: Si elige esta opci\u00f3n, CloudStack para detener la fuerza todas las m\u00e1quinas virtuales en ejecuci\u00f3n antes de retirar este host del cl\u00faster.
-force.stop=Forzar la detenci\u00f3n
-force.stop.instance.warning=Advertencia\: Forzar la dertenci\u00f3n de esta instancia deber\u00ed\u00ada ser su \u00faltima opci\u00f3n. Puede conducir a la p\u00e9rdida de datos, as\u00ed\u00ad como un comportamiento incoherente del Estado de la m\u00e1quina virtual.
+error.unresolved.internet.name=Su nombre de Internet no se puede resolver.
+force.delete.domain.warning=Advertencia\: Si elige esta opci\u00f3n se realizar\u00e1 la supresi\u00f3n de todos los dominios secundarios, todas las cuentas asociadas y sus recursos.
+force.delete=Forzar Borrado
+force.remove=Forzar la Remoci\u00f3n
+force.remove.host.warning=Advertencia\: Si elige esta opci\u00f3n, CloudStack detendra por la fuerza todas las m\u00e1quinas virtuales en ejecuci\u00f3n antes de remover este servidor del cl\u00faster.
+force.stop=Forzar la Detenci\u00f3n
+force.stop.instance.warning=Advertencia\: Forzar la dertenci\u00f3n de esta instancia deber\u00ed\u00ada ser su \u00faltima opci\u00f3n. Puede conducir a la p\u00e9rdida de datos, as\u00ed\u00ad como un comportamiento inconsistente del estado de la m\u00e1quina virtual.
 hint.no.host.tags=No se encontraron las etiquetas de servidor
 hint.no.storage.tags=No se encontraron las etiquetas de almacenamiento
 hint.type.part.host.tag=El tipo esta en parte de la etiqueta de servidor
 hint.type.part.storage.tag=El tipo est\u00e1 en parte de la etiqueta de almacenamiento
 ICMP.code=C\u00f3digo ICMP
 ICMP.type=Tipo ICMP
-image.directory=Directorio de im\u00e1genes
-inline=alineado
+image.directory=Directorio de Im\u00e1genes
+inline=Inline
 instances.actions.reboot.label=Reiniciar Instancia
 label.about=Acerca de
 label.about.app=Acerca de CloudStack
@@ -52,11 +52,11 @@ label.accept.project.invitation=Aceptar invitaci\u00f3n al proyecto
 label.account.and.security.group=Cuenta, Grupo de seguridad
 label.account=Cuenta
 label.account.details=Detalles de la Cuenta
-label.account.id=ID de la cuenta
+label.account.id=ID de la Cuenta
 label.account.lower=cuenta
-label.account.name=Nombre de cuenta
+label.account.name=Nombre de la Cuenta
 label.accounts=Cuentas
-label.account.specific=espec\u00c3\u00adficas de la cuenta
+label.account.specific=espec\u00edficas de la cuenta
 label.account.type=Tipo de Cuenta
 label.acl=ACL
 label.acl.id=ID de ACL
@@ -66,131 +66,131 @@ label.acl.replaced=ACL reemplazada
 label.acquire.new.ip=Adquirir nueva IP
 label.acquire.new.secondary.ip=Adquirir nuevo IP secundario
 label.action=Acci\u00f3n
-label.action.attach.disk=Conecte el disco
-label.action.attach.disk.processing=Conectando el disco....
+label.action.attach.disk=Conectar Disco
+label.action.attach.disk.processing=Conectando Disco....
 label.action.attach.iso=Conectar ISO
 label.action.attach.iso.processing=Conectando el ISO....
-label.action.cancel.maintenance.mode=Cancelar el modo de mantenimiento
-label.action.cancel.maintenance.mode.processing=Cancelando el modo de mantenimiento....
-label.action.change.password=Cambiar la contrase\u00f1a
+label.action.cancel.maintenance.mode=Cancelar el Modo de Mantenimiento
+label.action.cancel.maintenance.mode.processing=Cancelando el Modo de Mantenimiento....
+label.action.change.password=Cambiar la Contrase\u00f1a
 label.action.change.service=Cambiar el Servicio
-label.action.change.service.processing=Cambiando el servicio....
+label.action.change.service.processing=Cambiando el Servicio....
 label.action.configure.samlauthorization=Configurar Autorizaci\u00f3n SAML SSO
 label.action.copy.ISO=Copiar ISO
 label.action.copy.ISO.processing=Copiando ISO....
-label.action.copy.template=Copiear la plantilla
-label.action.copy.template.processing=Copiando Plantilla....
-label.action.create.template=Crear plantilla
-label.action.create.template.from.vm=Crear plantilla de VM
-label.action.create.template.from.volume=Crear plantilla de volumen
-label.action.create.template.processing=Creaci\u00f3n de plantillas ....
+label.action.copy.template=Copiar el Template
+label.action.copy.template.processing=Copiando Template....
+label.action.create.template=Crear Template
+label.action.create.template.from.vm=Crear Template desde VM
+label.action.create.template.from.volume=Crear Template desde Volumen
+label.action.create.template.processing=Creando Template....
 label.action.create.vm=Crear VM
-label.action.create.vm.processing=Creaci\u00f3n de m\u00e1quina virtual ....
-label.action.create.volume=Crear volumen
-label.action.create.volume.processing=Crear volumen ....
+label.action.create.vm.processing=Creando VM....
+label.action.create.volume=Crear Volumen
+label.action.create.volume.processing=Creando Volumen....
 label.action.delete.account=Eliminar cuenta
-label.action.delete.account.processing=Eliminar cuentas ....
-label.action.delete.cluster=Borrar Grupo
-label.action.delete.cluster.processing=Borrar Grupo ....
-label.action.delete.disk.offering=Borrar disco Ofrenda
-label.action.delete.disk.offering.processing=Borrar disco ofrece ....
-label.action.delete.domain=Eliminar de dominio
-label.action.delete.domain.processing=Eliminaci\u00f3n de dominio ....
-label.action.delete.firewall=Eliminar servidor de seguridad
-label.action.delete.firewall.processing=Eliminaci\u00f3n de firewall ....
-label.action.delete.ingress.rule=Borrar ingreso Regla
-label.action.delete.ingress.rule.processing=Eliminaci\u00c3\u00b3n de ingreso regla ....
-label.action.delete.IP.range=Eliminar Rango de IP
-label.action.delete.IP.range.processing=Eliminar Rango de IP ....
-label.action.delete.ISO=Eliminar ISO
-label.action.delete.ISO.processing=Eliminaci\u00c3\u00b3n de la norma ISO ....
-label.action.delete.load.balancer=Eliminar equilibrador de carga
-label.action.delete.load.balancer.processing=Eliminaci\u00c3\u00b3n del equilibrador de carga ....
+label.action.delete.account.processing=Eliminando cuenta....
+label.action.delete.cluster.processing=Removiendo Cluster....
+label.action.delete.cluster=Remover Cluster
+label.action.delete.disk.offering=Borrar Oferta de Disco
+label.action.delete.disk.offering.processing=Borrar Oferta de Disco....
+label.action.delete.domain.processing=Removiendo el Dominio ....
+label.action.delete.domain=Remover Dominio
+label.action.delete.firewall.processing=Eliminando el Firewall ....
+label.action.delete.firewall=Remover regla de firewall
+label.action.delete.ingress.rule.processing=Removiendo Regla de ingreso....
+label.action.delete.ingress.rule=Remover Regla de ingreso
+label.action.delete.IP.range.processing=Remover Rango de IP....
+label.action.delete.IP.range=Remover Rango de IP
+label.action.delete.ISO=Borrar ISO
+label.action.delete.ISO.processing=Borrar ISO....
+label.action.delete.load.balancer.processing=Removiendo Load Balancer....
+label.action.delete.load.balancer=Remover regla de load balancer
 label.action.delete.network=Eliminar Red
-label.action.delete.network.processing=Eliminaci\u00c3\u00b3n de red ....
+label.action.delete.network.processing=Borrando Red....
 label.action.delete.nexusVswitch=Eliminar Nexus 1000v
 label.action.delete.nic=Quitar NIC
 label.action.delete.physical.network=Eliminar red f\u00edsica
 label.action.delete.pod=Eliminar Pod
-label.action.delete.pod.processing=Eliminar Pod ....
-label.action.delete.primary.storage=Almacenamiento primario Eliminar
-label.action.delete.primary.storage.processing=Eliminaci\u00c3\u00b3n de almacenamiento primaria ....
-label.action.delete.secondary.storage.processing=Eliminaci\u00c3\u00b3n de almacenamiento secundario ....
-label.action.delete.secondary.storage=secundaria almacenamiento Eliminar
+label.action.delete.pod.processing=Eliminando Pod....
+label.action.delete.primary.storage=Eliminar Almacenamiento Primario 
+label.action.delete.primary.storage.processing=Eliminando Almacenamiento Primario....
+label.action.delete.secondary.storage=Eliminar Almacenamiento Secundario
+label.action.delete.secondary.storage.processing=Eliminando Almacenamiento Secundario ....
 label.action.delete.security.group=Borrar Grupo de Seguridad
 label.action.delete.security.group.processing=Eliminar grupo de seguridad ....
 label.action.delete.service.offering=Eliminar Oferta de Servicio
-label.action.delete.service.offering.processing=Eliminaci\u00c3\u00b3n de Oferta de Servicio ....
-label.action.delete.snapshot=Eliminar instant\u00c3\u00a1nea
-label.action.delete.snapshot.processing=Eliminar instant\u00c3\u00a1nea ....
+label.action.delete.service.offering.processing=Eliminando Oferta de Servicio ....
+label.action.delete.snapshot=Eliminar instant\u00e1nea
+label.action.delete.snapshot.processing=Borrando instant\u00e1nea ....
 label.action.delete.system.service.offering=Eliminar Oferta de Servicio de Sistema
-label.action.delete.template=Eliminar plantilla
-label.action.delete.template.processing=Eliminar plantilla ....
+label.action.delete.template=Eliminar Template
+label.action.delete.template.processing=Borrando Template....
 label.action.delete.user=Eliminar usuario
-label.action.delete.user.processing=Eliminar usuario ....
+label.action.delete.user.processing=Eliminando Usuario....
 label.action.delete.volume=Eliminar volumen
-label.action.delete.volume.processing=Eliminar volumen ....
+label.action.delete.volume.processing=Eliminando volumen ....
 label.action.delete.zone=Eliminar Zona
-label.action.delete.zone.processing=Eliminaci\u00c3\u00b3n de la Zona ....
+label.action.delete.zone.processing=Eliminando Zona....
 label.action.destroy.instance=Destruye Instancia
-label.action.destroy.instance.processing=Destrucci\u00c3\u00b3n Instancia ....
+label.action.destroy.instance.processing=Destruyendo Instancia....
 label.action.destroy.systemvm=destruir el sistema VM
-label.action.destroy.systemvm.processing=Destrucci\u00c3\u00b3n del sistema VM ....
-label.action.detach.disk.processing=Extracci\u00c3\u00b3n disco ....
-label.action.detach.disk=Separar disco
-label.action.detach.iso.processing=Extracci\u00c3\u00b3n ISO ....
+label.action.destroy.systemvm.processing=Destruyendo VM de Sistema....
+label.action.detach.disk=Desconectar Disco
+label.action.detach.disk.processing=Desconectando Disco ....
+label.action.detach.iso.processing=Desconectando ISO....
 label.action.detach.iso=Separar ISO
 label.action.disable.account=Desactivar cuenta
-label.action.disable.account.processing=Deshabilitar cuenta ....
-label.action.disable.cluster=Deshabilitar cl\u00c3\u00baster
-label.action.disable.cluster.processing=Desactivaci\u00c3\u00b3n de Cluster Server ....
+label.action.disable.account.processing=Deshabilitando cuenta....
+label.action.disable.cluster=Deshabilitar Cl\u00faster
+label.action.disable.cluster.processing=Deshabilitando el Cluster....
 label.action.disable.nexusVswitch=Deshabilitar Nexus 1000v
 label.action.disable.physical.network=Desactivar la red f\u00edsica
 label.action.disable.pod=Deshabilitar Pod
-label.action.disable.pod.processing=Deshabilitar Pod ....
-label.action.disable.static.NAT=Deshabilitar NAT est\u00c3\u00a1tica
-label.action.disable.static.NAT.processing=Deshabilitar NAT est\u00c3\u00a1tica ....
+label.action.disable.pod.processing=Deshabilitando el Pod....
+label.action.disable.static.NAT=Deshabilitar NAT est\u00e1tica
+label.action.disable.static.NAT.processing=Deshabilitando el NAT Est\u00e1tico....
 label.action.disable.user=Deshabilitar usuario
-label.action.disable.user.processing=Desactivaci\u00c3\u00b3n de usuario ....
+label.action.disable.user.processing=Deshabilitando Usuario....
 label.action.disable.zone=Deshabilitar la zona
-label.action.disable.zone.processing=Desactivaci\u00c3\u00b3n de la zona ....
+label.action.disable.zone.processing=Deshabilitando Zona....
 label.action.download.ISO=ISO Descargar
-label.action.download.template=Descargar plantilla
+label.action.download.template=Descargar Template
 label.action.download.volume=Descargar Volumen
-label.action.download.volume.processing=Volumen Descargar ....
+label.action.download.volume.processing=Descargando Volumen....
 label.action.edit.account=Editar cuenta
-label.action.edit.disk.offering=Editar disco Ofrenda
+label.action.edit.disk.offering=Editar Oferta de Disco
 label.action.edit.domain=Editar Dominio
-label.action.edit.global.setting=Editar Mundial Marco
-label.action.edit.host=edici\u00c3\u00b3n Anfitri\u00c3\u00b3n
+label.action.edit.global.setting=Editar la Configuraci\u00f3n Global
+label.action.edit.host=Editar Servidor
 label.action.edit.instance=Editar Instancia
 label.action.edit.ISO=Editar ISO
-label.action.edit.network=Edici\u00c3\u00b3n de redes
+label.action.edit.network=Edici\u00f3n de redes
 label.action.edit.network.offering=Editar Red ofrece
 label.action.edit.network.processing=Editando Red....
 label.action.edit.pod=Editar Pod
-label.action.edit.primary.storage=Editar Almacenamiento primario
-label.action.edit.resource.limits=Editar l\u00c3\u00admites de recursos
+label.action.edit.primary.storage=Editar Almacenamiento Primario
+label.action.edit.resource.limits=Editar l\u00edmites de recursos
 label.action.edit.service.offering=Editar Oferta de Servicio
-label.action.edit.template=Editar plantilla
+label.action.edit.template=Editar Template
 label.action.edit.user=Editar usuario
-label.action.edit.zone=Edici\u00c3\u00b3n Zona
+label.action.edit.zone=Edici\u00f3n Zona
 label.action.enable.account=Habilitar cuenta
-label.action.enable.account.processing=cuenta de Habilitaci\u00c3\u00b3n ....
-label.action.enable.cluster=Habilitar cl\u00c3\u00baster
-label.action.enable.cluster.processing=Habilitar cl\u00c3\u00baster ....
+label.action.enable.account.processing=cuenta de Habilitaci\u00f3n ....
+label.action.enable.cluster=Habilitar Cl\u00faster
+label.action.enable.cluster.processing=Habilitando el Cl\u00faster ....
 label.action.enable.maintenance.mode=Activar el modo de mantenimiento
-label.action.enable.maintenance.mode.processing=Habilitaci\u00c3\u00b3n del modo de mantenimiento ....
+label.action.enable.maintenance.mode.processing=Habilitaci\u00f3n del modo de mantenimiento ....
 label.action.enable.nexusVswitch=Habilitar Nexus 1000v
 label.action.enable.physical.network=Habilitar red f\u00edsica
 label.action.enable.pod=Habilitar Pod
-label.action.enable.pod.processing=Habilitaci\u00c3\u00b3n Pod ....
-label.action.enable.static.NAT=Habilitar NAT est\u00c3\u00a1tica
-label.action.enable.static.NAT.processing=Habilitar NAT est\u00c3\u00a1tica ....
-label.action.enable.user.processing=Habilitaci\u00c3\u00b3n del usuario ....
+label.action.enable.pod.processing=Habilitaci\u00f3n Pod ....
+label.action.enable.static.NAT=Habilitar NAT est\u00e1tica
+label.action.enable.static.NAT.processing=Habilitar NAT est\u00e1tica ....
+label.action.enable.user.processing=Habilitaci\u00f3n del usuario ....
 label.action.enable.user=usuario Activar
 label.action.enable.zone=Habilitar la zona
-label.action.enable.zone.processing=Habilitaci\u00c3\u00b3n de zona ....
+label.action.enable.zone.processing=Habilitaci\u00f3n de zona ....
 label.action.expunge.instance=Borrar Instancia
 label.action.expunge.instance.processing=Borrando Instancia....
 label.action.force.reconnect=Fuerza Vuelva a conectar
@@ -200,35 +200,35 @@ label.action.generate.keys.processing=Generar claves ....
 label.action.list.nexusVswitch=Listar Nexus 1000v
 label.action.lock.account=Bloqueo de cuenta
 label.action.lock.account.processing=Bloqueo de cuenta ....
-label.action.manage.cluster=gestionar racimo
-label.action.manage.cluster.processing=La gesti\u00c3\u00b3n de cl\u00c3\u00basteres ....
+label.action.manage.cluster=Gestionar Cl\u00faster
+label.action.manage.cluster.processing=Gestionando Cl\u00faster....
 label.action.migrate.instance=Migrar Instancia
 label.action.migrate.instance.processing=Migrar Instancia ....
 label.action.migrate.router=migrar Router
-label.action.migrate.router.processing=Migraci\u00c3\u00b3n router ....
+label.action.migrate.router.processing=Migraci\u00f3n router ....
 label.action.migrate.systemvm=Migrar del sistema VM
-label.action.migrate.systemvm.processing=La migraci\u00c3\u00b3n de VM del sistema ....
+label.action.migrate.systemvm.processing=La migraci\u00f3n de VM del sistema ....
 label.action.reboot.instance.processing=Reiniciar Instancia ....
 label.action.reboot.instance=Reiniciar Instancia
 label.action.reboot.router.processing=Reiniciar router ....
 label.action.reboot.router=Reiniciar router
 label.action.reboot.systemvm.processing=reinicio del sistema VM ....
 label.action.reboot.systemvm=Reiniciar sistema VM
-label.action.recurring.snapshot=recurrente instant\u00c3\u00a1neas
+label.action.recurring.snapshot=recurrente instant\u00e1neas
 label.action.register.iso=Registrar ISO
-label.action.register.template=Registrar plantilla desde una URL
+label.action.register.template=Registrar template desde una URL
 label.action.release.ip=estreno IP
 label.action.release.ip.processing=Liberar IP ....
-label.action.remove.host.processing=Extracci\u00c3\u00b3n de host ....
-label.action.remove.host=Quitar host
-label.action.reset.password.processing=Restablecimiento de la contrase\u00c3\u00b1a ....
-label.action.reset.password=Restablecer contrase\u00c3\u00b1a
+label.action.remove.host.processing=Removiendo el Servidor....
+label.action.remove.host=Quitar el Servidor
+label.action.reset.password.processing=Restablecimiento de la contrase\u00f1a ....
+label.action.reset.password=Restablecer contrase\u00f1a
 label.action.resize.volume=Cambiar el tama\u00f1o del Volumen
-label.action.resize.volume.processing=Cambiar el tama\u00f1o del Volumen....
-label.action.resource.limits=Recursos l\u00c3\u00admites
+label.action.resize.volume.processing=Cambiando el tama\u00f1o del Volumen....
+label.action.resource.limits=Recursos l\u00edmites
 label.action.restore.instance.processing=Restaurar Instancia ....
 label.action.restore.instance=Restaurar Instancia
-label.action.revert.snapshot.processing=Volviendo a Snapshot...
+label.action.revert.snapshot.processing=Revertiendo a Snapshot...
 label.action.revert.snapshot=Revertir a Snapshot
 label.actions=Acciones
 label.action.start.instance=Iniciar Instancia
@@ -239,27 +239,27 @@ label.action.start.systemvm=Inicio del sistema VM
 label.action.start.systemvm.processing=A partir del sistema VM ....
 label.action.stop.instance=Detener Instancia
 label.action.stop.instance.processing=Detener Instancia ....
-label.action.stop.router=Detener router
-label.action.stop.router.processing=Detener router ....
-label.action.stop.systemvm=parada del sistema VM
-label.action.stop.systemvm.processing=Detener sistema VM ....
-label.action.take.snapshot.processing=Tomar instant\u00c3\u00a1neas ....
-label.action.take.snapshot=Tomar instant\u00c3\u00a1nea
-label.action.unmanage.cluster.processing=Unmanaging Grupo ....
-label.action.unmanage.cluster=Unmanage racimo
+label.action.stop.router=Parar el Router
+label.action.stop.router.processing=Parando el Router....
+label.action.stop.systemvm=Parar VM del Sistema
+label.action.stop.systemvm.processing=Deteniendo VM de Sistema....
+label.action.take.snapshot.processing=Tomando instant\u00e1nea....
+label.action.take.snapshot=Tomar instant\u00e1nea
+label.action.unmanage.cluster=Dejar de Gestionar Cl\u00faster
+label.action.unmanage.cluster.processing=Dejando de Gestionar Cl\u00faster ....
 label.action.update.OS.preference=Actualizar OS Preferencia
-label.action.update.OS.preference.processing=Actualizaci\u00c3\u00b3n de sistema operativo preferencia ....
-label.action.update.resource.count=Actualizaci\u00c3\u00b3n de recursos Conde
-label.action.update.resource.count.processing=Actualizaci\u00c3\u00b3n de Conde de recursos ....
+label.action.update.OS.preference.processing=Actualizaci\u00f3n de sistema operativo preferencia ....
+label.action.update.resource.count=Actualizaci\u00f3n de recursos Conde
+label.action.update.resource.count.processing=Actualizaci\u00f3n de Conde de recursos ....
 label.action.vmsnapshot.create=Tomar instant\u00e1nea de VM
-label.action.vmsnapshot.delete=Borrar Instantanea de VM
-label.action.vmsnapshot.revert=Volver VM a la instantanea
+label.action.vmsnapshot.delete=Borrar Instant\u00e1nea de VM
+label.action.vmsnapshot.revert=Volver VM a la instant\u00e1nea 
 label.activate.project=Activar Proyecto
 label.active.sessions=Sesiones activas
-label.add.account=A\u00c3\u00b1adir cuenta
+label.add.account=A\u00f1adir cuenta
 label.add.accounts=Agregar cuentas
 label.add.accounts.to=Agregar cuentas a
-label.add.account.to.project=Agregar cuenta al projecto
+label.add.account.to.project=Agregar cuenta al proyecto
 label.add.ACL=Agregar ACL
 label.add.acl.list=Agregar Lista ACL
 label.add.affinity.group=Agregar un nuevo grupo de afinidad
@@ -269,13 +269,13 @@ label.add.baremetal.rack.configuration=Agregar Configuraci\u00f3n del Rack Barem
 label.add.BigSwitchBcf.device=Agregar Controlador BigSwitch BCF
 label.add.BrocadeVcs.device=Agregar Switch Brocade Vcs
 label.add.by=A\u00f1adir por
-label.add.by.cidr=A\u00c3\u00b1adir Por CIDR
-label.add.by.group=A\u00c3\u00b1adir Por el Grupo de
+label.add.by.cidr=A\u00f1adir Por CIDR
+label.add.by.group=A\u00f1adir Por el Grupo de
 label.add.ciscoASA1000v=Agregar un Recurso CiscoASA1000v
-label.add.cluster=A\u00c3\u00b1adir Grupo
+label.add.cluster=A\u00f1adir Cl\u00faster
 label.add.compute.offering=Agregar oferta de computo
-label.add.direct.iprange=A\u00c3\u00b1adir Direct IP Gama
-label.add.disk.offering=A\u00c3\u00b1adir disco Ofrenda
+label.add.direct.iprange=A\u00f1adir Direct IP Gama
+label.add.disk.offering=A\u00f1adir Oferta de Disco
 label.add.domain=Agregar dominio
 label.added.brocade.vcs.switch=Nuevo Switch VCS Brocade agregado
 label.added.network.offering=Oferta de Red agregada
@@ -288,33 +288,33 @@ label.add.firewall=Agregar Servidor de seguridad
 label.add.globo.dns=Agregar GloboDNS
 label.add.gslb=Agregar GSLB
 label.add.guest.network=Agregar red de invitado
-label.add.host=Agregar host
+label.add.host=Agregar Servidor
 label.adding=Agregar
-label.adding.cluster=Adici\u00c3\u00b3n de cl\u00c3\u00baster
+label.adding.cluster=Agregando Cl\u00faster
 label.adding.failed=No se pudo agregar
 label.adding.pod=Agregar Pod
-label.adding.processing=A\u00c3\u00b1adir ....
-label.add.ingress.rule=A\u00c3\u00b1adir regla del ingreso
+label.adding.processing=A\u00f1adir ....
+label.add.ingress.rule=A\u00f1adir regla del ingreso
 label.adding.succeeded=Agregar Sucesor
 label.adding.user=Agregar usuario
 label.adding.zone=Agregar la zona
 label.add.intermediate.certificate=Agregar certificado de entidad intermedia
 label.add.internal.lb=Agregar LB Interno
-label.add.ip.range=A\u00c3\u00b1adir Rango de IP
-label.add.isolated.guest.network=Agregar red Aislado para Guest
+label.add.ip.range=A\u00f1adir Rango de IP
+label.add.isolated.guest.network=Agregar red Aislada para Guest
 label.add.isolated.guest.network.with.sourcenat=Agregar Red Aislada para Guest con SourceNat
 label.add.isolated.network=Agregar Red Aislada
 label.additional.networks=Redes adicional
 label.add.ldap.account=Agregar cuenta LDAP
 label.add.LDAP.account=Agregar Cuenta LDAP
 label.add.list.name=Nombre de la Lista ACL
-label.add.load.balancer=A\u00c3\u00b1adir equilibrador de carga
-label.add.more=A\u00c3\u00b1adir m\u00c3\u00a1s
+label.add.load.balancer=A\u00f1adir equilibrador de carga
+label.add.more=A\u00f1adir m\u00e1s
 label.add.netScaler.device=Agregar dispositivo Netscaler
 label.add.network.ACL=Agregar ACL de Red
 label.add.network.acl.list=Agregar Lista ACL de Red
 label.add.network=Agregar sitios de red
-label.add.network.device=A\u00c3\u00b1adir dispositivo de red
+label.add.network.device=A\u00f1adir dispositivo de red
 label.add.network.offering=Agregar oferta de red
 label.add.new.F5=Agregar un nuevo F5
 label.add.new.gateway=Agregar nuevo gateway
@@ -328,28 +328,28 @@ label.add.NuageVsp.device=Agregar Nuage Virtualized Services Directory (VSD)
 label.add.OpenDaylight.device=Agregar el Controlador OpenDaylight
 label.add.PA.device=Agregar dispositivo Palo Alto
 label.add.physical.network=Agregar red f\u00edsica
-label.add.pod=A\u00c3\u00b1adir Pod
+label.add.pod=A\u00f1adir Pod
 label.add.portable.ip.range=Agregar un Rango IP Port\u00e1til
 label.add.port.forwarding.rule=Agregar regla port forwarding
-label.add.primary.storage=A\u00c3\u00b1adir Almacenamiento primario
+label.add.primary.storage=A\u00f1adir Almacenamiento Primario
 label.add.private.gateway=Agregar Gateway Privado
 label.add.region=Agregar Regi\u00f3n
 label.add.resources=Agregar Recursos
 label.add.route=Agregar ruta
 label.add.rule=Agregar regla
-label.add.secondary.storage=A\u00c3\u00b1adir secundaria almacenamiento
+label.add.secondary.storage=Agregar Almacenamiento Secundario
 label.add.security.group=Agregar grupo de seguridad
-label.add.service.offering=A\u00c3\u00b1adir Servicio de Oferta
+label.add.service.offering=A\u00f1adir Servicio de Oferta
 label.add.SRX.device=Agregar dispositivo SRX
 label.add.static.nat.rule=Agregar regla NAT est\u00e1tica
 label.add.static.route=Agregar ruta est\u00e1tica
 label.add.system.service.offering=Agregar Oferta de Servicio del Sistema
-label.add.template=A\u00c3\u00b1adir plantilla
+label.add.template=A\u00f1adir Template
 label.add.to.group=Agregar al grupo
 label.add.ucs.manager=Agregar UCS Manager
 label.add.user=Agregar usuario
 label.add.userdata=Datos de Usuario
-label.add.vlan=A\u00c3\u00b1adir VLAN
+label.add.vlan=A\u00f1adir VLAN
 label.add.vm=Agregar VM
 label.add.vms=Agregar VMs
 label.add.vms.to.lb=Agregar VM(s) a el balanceador de carga
@@ -357,14 +357,14 @@ label.add.VM.to.tier=Agregar VM al tier
 label.add.vmware.datacenter=Agregar Datacenter VMware
 label.add.vnmc.device=Agregar dispositivo VNMC
 label.add.vnmc.provider=Agregar proveedor VNMC
-label.add.volume=A\u00c3\u00b1adir volumen
+label.add.volume=A\u00f1adir volumen
 label.add.vpc=Agregar VPC
 label.add.vpc.offering=Agregar Ofertas de VPC
 label.add.vpn.customer.gateway=Agregar VPN para Acceso del Cliente
 label.add.VPN.gateway=Agregar Gateway VPN
 label.add.vpn.user=Agregar usuario VPN
-label.add.vxlan=A\u00c3\u00b1adir VXLAN
-label.add.zone=A\u00c3\u00b1adir Zona
+label.add.vxlan=A\u00f1adir VXLAN
+label.add.zone=A\u00f1adir Zona
 label.admin.accounts=Administrador de Cuentas
 label.admin=Admin
 label.advanced=Avanzado
@@ -373,7 +373,7 @@ label.advanced.search=B\u00fasqueda Avanzada
 label.affinity=Afinidad
 label.affinity.group=Grupo de Afinidad
 label.affinity.groups=Grupos de Afinidades
-label.agent.password=Password de Agente
+label.agent.password=Contrase\u00f1a del Agente
 label.agent.port=Puerto del Agente
 label.agent.state=Estado del Agente
 label.agent.username=Usuario de Agente
@@ -395,7 +395,7 @@ label.apply=Aplicar
 label.app.name=CloudStack
 label.archive.alerts=Archivar alertas
 label.archive=Archivar
-label.archive.events=Archivar sucesos
+label.archive.events=Archivar eventos
 label.assign=Asignar
 label.assigned.vms=VMs Asignadas
 label.assign.instance.another=Asignar la instancias a otra Cuenta
@@ -423,13 +423,13 @@ label.baremetal.pxe.device=Agregar Proveedor PXE para Baremetal
 label.baremetal.pxe.devices=Dispositivo Baremetal para PXE
 label.baremetal.pxe.provider=Proveedor PXE para Baremetal
 label.baremetal.rack.configuration=Configuraci\u00f3n del Rack Baremetal
-label.basic=B\u00e1sica
+label.basic=B\u00e1sic0
 label.basic.mode=Modo b\u00e1sico
-label.bigswitch.bcf.details=Detalles del Controlador BigSwitch BCF
+label.bigswitch.bcf.details=Detalles del BigSwitch BCF
 label.bigswitch.bcf.nat=BigSwitch BCF con NAT habilitado
 label.bigswitch.controller.address=Direcci\u00f3n del Controlador BigSwitch BCF
-label.blade.id=ID de Hoja
-label.blades=Hojas
+label.blade.id=ID de Blade
+label.blades=Blades
 label.bootable=arranque
 label.broadcast.domain.range=Rango del dominio de Broadcast
 label.broadcast.domain.type=Tipo de dominio de difusi\u00f3n
@@ -443,9 +443,9 @@ label.by.alert.type=Por tipo de alerta
 label.by.availability=Por Disponibilidad
 label.by.date.end=Por fecha (finalizaci\u00f3n)
 label.by.date.start=Por fecha (inicio)
-label.by.domain=Por dominio
+label.by.domain=Por Dominio
 label.by.end.date=Por Fecha de finalizaci\u00f3n
-label.by.event.type=Por tipo de suceso
+label.by.event.type=Por tipo de evento
 label.by.level=por Nivel
 label.by.pod=Por Pod
 label.by.role=por funci\u00f3n
@@ -484,25 +484,25 @@ label.clear.list=Limpiar lista
 label.close=Cerrar
 label.cloud.console=Cloud Management Console
 label.cloud.managed=Cloud.com Gestionado
-label.cluster=Grupo
-label.cluster.name=Nombre del Cluster
-label.clusters=Cluster
-label.cluster.type=Tipo de Cluster Server
+label.cluster=Cl\u00faster
+label.cluster.name=Nombre del Cl\u00faster
+label.clusters=Clusters
+label.cluster.type=Tipo de Cl\u00faster
 label.clvm=CLVM
-label.code=C\u00c3\u00b3digo
+label.code=C\u00f3digo
 label.community=Comunidad
 label.compute.and.storage=Computo y Almacenamiento
 label.compute=Computo
 label.compute.offering=Oferta de Computo
 label.compute.offerings=Ofertas de Computo
-label.configuration=Configuraci\u00c3\u00b3n
+label.configuration=Configuraci\u00f3n
 label.configure=Configurar
 label.configure.ldap=Configurar LDAP
 label.configure.network.ACLs=Configurar ACLs de la Red
 label.configure.sticky.policy=Configurar pol\u00edtica de Sticky
 label.configure.vpc=Configurar VPC
 label.confirmation=Confirmation
-label.confirm.password=Confirmar password
+label.confirm.password=Confirmar la contrase\u00f1a
 label.congratulations=Felicitaciones \!
 label.conserve.mode=Conservar modo
 label.console.proxy=Consola proxy
@@ -513,14 +513,14 @@ label.copying.iso=Copiando ISO
 label.corrections.saved=Correcciones guardadas
 label.counter=Contador
 label.cpu.allocated=CPU asignado
-label.cpu.allocated.for.VMs=CPU asignado para m\u00c3\u00a1quinas virtuales
+label.cpu.allocated.for.VMs=CPU asignado para m\u00e1quinas virtuales
 label.CPU.cap=CPU Cap
 label.cpu=CPU
 label.cpu.limits=L\u00edmites de CPU
 label.cpu.mhz=CPU (En MHz)
 label.cpu.utilized=CPU Utilizado
 label.created.by.system=Creado por el sistema
-label.created=creaci\u00c3\u00b3n
+label.created=creaci\u00f3n
 label.create.nfs.secondary.staging.storage=Crear un Almacenamiento Secundario Temporario NFS
 label.create.nfs.secondary.staging.store=Crear un NFS secundario para almacenamiento temporal
 label.create.project=Crear proyecto
@@ -531,13 +531,13 @@ label.cross.zones=Cruz Zonas
 label.custom=A Medida
 label.custom.disk.iops=IOPS personalizadas
 label.custom.disk.offering=Oferta de Disco Personalizada
-label.custom.disk.size=Personal Disk Size
+label.custom.disk.size=Tama\u00f1o de Disco Personalizado
 label.daily=diario
-label.data.disk.offering=Datos Disco Offering
+label.data.disk.offering=Oferta para Disco de Datos
 label.date=Fecha
 label.day=D\u00eda
-label.day.of.month=D\u00c3\u00ada del mes
-label.day.of.week=d\u00c3\u00ada de la semana
+label.day.of.month=D\u00eda del mes
+label.day.of.week=d\u00eda de la semana
 label.dc.name=Nombre del DC
 label.dead.peer.detection=Detecci\u00f3n de Dead Peer
 label.decline.invitation=Declinar invitaci\u00f3n
@@ -546,9 +546,9 @@ label.dedicated=Dedicado
 label.dedicate=Dedicar
 label.dedicated.vlan.vni.ranges=Rangos VLAN/VNI Dedicados
 label.dedicate.host=Servidor Dedicado
-label.dedicate.pod=Pod Dedicado
+label.dedicate.pod=Dedicar Pod
 label.dedicate.vlan.vni.range=Dedicar Rango VLAN/VNI
-label.dedicate.zone=Zona Dedicada
+label.dedicate.zone=Dedicar Zona
 label.default.egress.policy=Pol\u00edtica de salida por defecto
 label.default=Por Defecto
 label.default.use=Usar por defecto
@@ -585,13 +585,13 @@ label.deleting.failed=No se pudo eliminar
 label.deleting.processing=Eliminar ....
 label.deny=Denegar
 label.deployment.planner=Modo deployment
-label.description=Descripci\u00c3\u00b3n
+label.description=Descripci\u00f3n
 label.destination.physical.network.id=ID de la red f\u00edsica destino
 label.destination.zone=Zona de destino
 label.destroy=Destroy
 label.destroy.router=Destruir router
 label.destroy.vm.graceperiod=Per\u00edodo de Gracia para Destruir una VM
-label.detaching.disk=Extracci\u00c3\u00b3n del disco
+label.detaching.disk=Extracci\u00f3n del disco
 label.details=Detalles
 label.device.id=ID de dispositivo
 label.devices=Dispositivos
@@ -601,37 +601,37 @@ label.direct.attached.public.ip=IP P\u00fablica Conectada en forma Directa
 label.direct.ips=IPs de la Red Compartida
 label.disable.autoscale=Deshabilitar Escalado Autom\u00e1tico
 label.disabled=personas de movilidad reducida
-label.disable.host=Deshabitar Servidor
+label.disable.host=Deshabilitar Servidor
 label.disable.network.offering=Deshabitar oferta de red
 label.disable.provider=Deshabilitar proveedor
 label.disable.vnmc.provider=Deshabitar proveedor VNMC
 label.disable.vpc.offering=Deshabitar oferta VPC
 label.disable.vpn=Deshabilitar VPN
-label.disabling.vpn.access=Desactivaci\u00c3\u00b3n de VPN de acceso
+label.disabling.vpn.access=Desactivaci\u00f3n de VPN de acceso
 label.disassociate.profile.blade=Remover asociaci\u00f3n entre Perfil y Blade
 label.disbale.vnmc.device=Deshabitar dispositivo VNMC
-label.disk.allocated=disco asignado
+label.disk.allocated=Disco Asignado
 label.disk.bytes.read.rate=Lectura de Disco (BPS)
 label.disk.bytes.write.rate=Escritura a Disco (BPS)
 label.disk.iops.max=IOPS m\u00e1ximas
 label.disk.iops.min=IOPS m\u00ednimas
 label.disk.iops.read.rate=Lectura de Disco (IOPS)
 label.disk.iops.total=Total de IOPS
-label.disk.iops.write.rate=Escritura de Disco (IOPS)
+label.disk.iops.write.rate=Escritura a Disco (IOPS)
 label.disk.offering.details=Detalles de oferta de disco
 label.disk.offering=disco Ofrenda
 label.diskoffering=oferta de disco
 label.disk.provisioningtype=Tipo de Aprovisionamiento
 label.disk.read.bytes=Lecturas del Disco (Bytes)
 label.disk.read.io=Lectura de Disco (IO)
-label.disk.size.gb=tama\u00c3\u00b1o de disco (en GB)
-label.disk.size=tama\u00c3\u00b1o de disco
+label.disk.size.gb=tama\u00f1o de disco (en GB)
+label.disk.size=tama\u00f1o de disco
 label.disk.total=disco Total
 label.disk.volume=volumen de disco
 label.disk.write.bytes=Escritura a Discos (Bytes)
 label.disk.write.io=Escritura a Disco (IO)
 label.display.name=Nombre a Mostrar
-label.display.text=visualizaci\u00c3\u00b3n de texto
+label.display.text=visualizaci\u00f3n de texto
 label.distributedrouter=Router Distribuido
 label.dns.1=DNS 1
 label.dns.2=DNS 2
@@ -639,10 +639,10 @@ label.dns=DNS
 label.DNS.domain.for.guest.networks=Dominio DNS para las Redes Guest
 label.domain.admin=Administrador de dominio
 label.domain.details=Detalles del Dominio
-label.domain=dominio
-label.domain.id=ID de dominio
+label.domain=Dominio
+label.domain.id=ID de Dominio
 label.domain.lower=dominio 
-label.domain.name=Nombre de dominio
+label.domain.name=Nombre de Dominio
 label.domain.router=Router de Dominio
 label.domain.suffix=DNS sufijo de dominio (es decir, xyz.com)
 label.done=Listo
@@ -663,17 +663,17 @@ label.edit.secondary.ips=Editar IPs secundarios
 label.edit.tags=Editar etiquetas
 label.edit.traffic.type=Edite el tipo de trafico
 label.edit.vpc=Editar VPC
-label.egress.default.policy=Directiva de salida predeterminada
+label.egress.default.policy=Regla de salida predeterminada
 label.egress.rule=Regla de salida
 label.egress.rules=Reglas de salida
 label.elastic=El\u00e1stico
 label.elastic.IP=IP El\u00e1stica
 label.elastic.LB=LB El\u00e1stico
-label.email=correo electr\u00c3\u00b3nico
+label.email=correo electr\u00f3nico
 label.email.lower=email
 label.enable.autoscale=Habilitar Escalado Autom\u00e1tico
 label.enable.host=Habilitar Servidor
-label.enable.network.offering=Habilitar  oferta de red
+label.enable.network.offering=Habilitar oferta de red
 label.enable.provider=Habilitar proveedor
 label.enable.s3=Habilitar Almacenamiento Secundario sobre S3
 label.enable.swift=Habilitar Swift
@@ -681,24 +681,24 @@ label.enable.vnmc.device=Habilitar dispositivo VNMC
 label.enable.vnmc.provider=Habilitar proveedor VNMC
 label.enable.vpc.offering=Habilitar oferta VPC
 label.enable.vpn=Habilitar VPN
-label.enabling.vpn.access=Habilitaci\u00c3\u00b3n de Acceso VPN
-label.enabling.vpn=Habilitaci\u00c3\u00b3n VPN
+label.enabling.vpn.access=Habilitaci\u00f3n de Acceso VPN
+label.enabling.vpn=Habilitaci\u00f3n VPN
 label.end.IP=IP Final
 label.endpoint=Endpoint
-label.endpoint.or.operation=punto final o de Operaci\u00c3\u00b3n
+label.endpoint.or.operation=punto final o de Operaci\u00f3n
 label.end.port=Puerto final
 label.end.reserved.system.IP=\u00daltima IP de sistema Reservada
 label.end.vlan=VLAN Final
 label.end.vxlan=VXLAN Final
 label.enter.token=Ingrese token
-label.error.code=C\u00c3\u00b3digo de error
+label.error.code=C\u00f3digo de error
 label.error=Error
 label.error.upper=ERROR
 label.ESP.encryption=Encriptaci\u00f3n ESP
 label.ESP.hash=Hash
 label.ESP.lifetime=Tiempo de vida ESP (en segundos)
 label.ESP.policy=Pol\u00edtica ESP
-label.esx.host=ESX / ESXi anfitri\u00c3\u00b3n
+label.esx.host=Servidor ESX / ESXi
 label.event.archived=Evento Archivado
 label.event.deleted=Evento Borrado
 label.event=Evento
@@ -706,7 +706,7 @@ label.every=Cada
 label.example=Ejemplo
 label.expunge=Purgar
 label.external.link=Enlace externo
-label.extractable=extra\u00edble
+label.extractable=Extra\u00edble
 label.extractable.lower=extraible
 label.f5.details=Detalles F5
 label.f5=F5
@@ -724,7 +724,7 @@ label.friday=Viernes
 label.full=completo
 label.full.path=Path completo
 label.gateway=puerta de enlace
-label.general.alerts=General de Alertas
+label.general.alerts=Alertas Generales
 label.generating.url=Generar URL
 label.globo.dns.configuration=Configuraci\u00f3n de GloboDNS
 label.globo.dns=GloboDNS
@@ -753,13 +753,13 @@ label.gslb.service.private.ip=IP Privada del Servicio GSLB
 label.gslb.service.public.ip=IP P\u00fablica del Servicio GSLB
 label.gslb.service=Servicio GSLB
 label.gslb.servicetype=Tipo de Servicio
-label.guest.cidr=Habitaci\u00c3\u00b3n CIDR
+label.guest.cidr=Habitaci\u00f3n CIDR
 label.guest.end.ip=IP final del Guest
-label.guest.gateway=Habitaci\u00c3\u00b3n Gateway
+label.guest.gateway=Habitaci\u00f3n Gateway
 label.guest=Guest
-label.guest.ip=Habitaci\u00c3\u00b3n direcci\u00c3\u00b3n IP
-label.guest.ip.range=Habitaci\u00c3\u00b3n Rango de IP
-label.guest.netmask=Habitaci\u00c3\u00b3n m\u00c3\u00a1scara de red
+label.guest.ip=Habitaci\u00f3n direcci\u00f3n IP
+label.guest.ip.range=Habitaci\u00f3n Rango de IP
+label.guest.netmask=Habitaci\u00f3n m\u00e1scara de red
 label.guest.network.details=Detalles de las redes Guest
 label.guest.networks=Redes de invitado
 label.guest.start.ip=IP inicial del Guest
@@ -774,18 +774,18 @@ label.health.check.interval.in.sec=Intervalo de Health Check (en seg)
 label.health.check.message.desc=Tu load balancer automaticamente har\u00e1 health checks en tus instancias cloudstack  y solo pasar\u00e1 el tr\u00e1fico a las instancias que lo cumplan.
 label.health.check=Verificaci\u00f3n de Salud
 label.health.check.wizard=Wizard para Health Check
-label.healthy.threshold=Barrera de Salud
+label.healthy.threshold=Umbral Saludable
 label.help=Ayuda
-label.hide.ingress.rule=Ocultar el art\u00c3\u00adculo ingreso
+label.hide.ingress.rule=Ocultar el art\u00edculo ingreso
 label.hints=Sugerencias
 label.home=Inicio
-label.host.alerts=Host Alertas
-label.host=Ej\u00c3\u00a9rcitos
-label.host.MAC=MAC del Host
-label.host.name=nombre de host
-label.hosts=Ej\u00c3\u00a9rcitos
+label.host.alerts=Alertas de Servidor
+label.host.MAC=MAC del Servidor
+label.host.name=nombre de servidor
+label.host=Servidores
+label.hosts=Servidores
 label.host.tag=Etiqueta del Servidor
-label.host.tags=Etiquetas de Host
+label.host.tags=Etiquetas del Servidor
 label.hourly=por hora
 label.hvm=HVM
 label.hypervisor.capabilities=Capacidades del Hipervisor
@@ -801,7 +801,7 @@ label.IKE.encryption=Encriptaci\u00f3n IKE
 label.IKE.hash=Hash IKE
 label.IKE.lifetime=IKE lifetime (segundos)
 label.IKE.policy=Pol\u00edtica IKE
-label.info=Informaci\u00c3\u00b3n
+label.info=Informaci\u00f3n
 label.info.upper=INFO
 label.ingress.rule=ingreso Regla
 label.initiated.by=Iniciado por
@@ -813,9 +813,9 @@ label.installWizard.addHostIntro.title=Agreguemos un servidor
 label.installWizard.addPodIntro.subtitle=\u00bfQue es un Pod?
 label.installWizard.addPodIntro.title=Agreguemos un Pod
 label.installWizard.addPrimaryStorageIntro.subtitle=\u00bfQu\u00e9 es el almacenamiento primario?
-label.installWizard.addPrimaryStorageIntro.title=Agreguemos almacenamiento primario
-label.installWizard.addSecondaryStorageIntro.subtitle=Que es almacenamiento secundario?
-label.installWizard.addSecondaryStorageIntro.title=A\u00f1adir almacenamiento secundario
+label.installWizard.addPrimaryStorageIntro.title=Agreguemos el almacenamiento primario
+label.installWizard.addSecondaryStorageIntro.subtitle=Que es el almacenamiento secundario?
+label.installWizard.addSecondaryStorageIntro.title=Agreguemos un almacenamiento secundario
 label.installWizard.addZoneIntro.subtitle=\u00bfQu\u00e9 es una zona?
 label.installWizard.addZoneIntro.title=Agreguemos una zona
 label.installWizard.addZone.title=Agregar zona
@@ -823,12 +823,12 @@ label.installWizard.click.launch=Click en el bot\u00f3n de lanzar.
 label.installWizard.subtitle=Esta gu\u00eda te ayudar\u00e1 a configurar la instalaci\u00f3n de CloudStack&\#848
 label.installWizard.title=Hola y Bienvenido a CloudStack&\#8482
 label.instance=Instancia
-label.instance.limits=Instancia L\u00c3\u00admites
+label.instance.limits=Instancia L\u00edmites
 label.instance.name=Nombre de instancia
 label.instance.port=Puerto de Instancia
 label.instance.scaled.up=Instancia escalada a lo requerido en la oferta
 label.instances=Instancias
-label.instanciate.template.associate.profile.blade=Instanciar Plantilla y asociar al Perfil del Blade
+label.instanciate.template.associate.profile.blade=Instanciar Template y asociar al Perfil del Blade
 label.intermediate.certificate=Entidad de Certificaci\u00f3n Intermedia {0}
 label.internal.dns.1=DNS interno una
 label.internal.dns.2=DNS interno 2
@@ -838,17 +838,17 @@ label.internallbvm=LbVmInterna
 label.internal.name=Nombre interno
 label.interval.type=Tipo de intervalo
 label.introduction.to.cloudstack=Introducci\u00f3n a CloudStack&\#8482
-label.invalid.integer=entero no v\u00c3\u00a1lido
-label.invalid.number=N\u00c3\u00bamero no v\u00c3\u00a1lido
+label.invalid.integer=entero no v\u00e1lido
+label.invalid.number=N\u00famero no v\u00e1lido
 label.invitations=Invitaciones
 label.invited.accounts=Cuentas de invitado
 label.invite=Invitar
 label.invite.to=Invitar a .
-label.ip.address=Direcci\u00c3\u00b3n IP
-label.ipaddress=Direcci\u00c3\u00b3n IP
+label.ip.address=Direcci\u00f3n IP
+label.ipaddress=Direcci\u00f3n IP
 label.ip.allocations=IP asignaciones
 label.ip=IP
-label.ip.limits=IP p\u00c3\u00bablica L\u00c3\u00admites
+label.ip.limits=IP p\u00fablica L\u00edmites
 label.ip.or.fqdn=IP o FQDN
 label.ip.range=Rango de IP
 label.ip.ranges=Rangos de IP
@@ -889,22 +889,22 @@ label.key=Llave
 label.kvm.traffic.label=Etiqueta de tr\u00e1fico KVM
 label.label=Etiqueta
 label.lang.arabic=\u00c1rabe
-label.lang.brportugese=Portugues de Brasil
+label.lang.brportugese=Portugu\u00e9s de Brasil
 label.lang.catalan=Catal\u00e1n
 label.lang.chinese=Chino (simplificado)
 label.lang.dutch=Holandes
-label.lang.english=Ingl\u00c3\u00a9s
+label.lang.english=Ingl\u00e9s
 label.lang.french=Frances
 label.lang.german=Aleman
 label.lang.hungarian=Hungaro
 label.lang.italian=Italiano
-label.lang.japanese=japon\u00c3\u00a9s
+label.lang.japanese=japon\u00e9s
 label.lang.korean=Coreano
 label.lang.norwegian=Noruego
 label.lang.polish=Polaco
 label.lang.russian=Ruso
-label.lang.spanish=Espa\u00c3\u00b1ol
-label.last.disconnected=\u00c3\u009altima Desconectado
+label.lang.spanish=Espa\u00f1ol
+label.last.disconnected=\u00daltima Desconectado
 label.last.name=Apellido
 label.lastname.lower=apellido
 label.latest.events=\u00daltimos eventos
@@ -933,7 +933,7 @@ label.local.storage=Almacenamiento Local
 label.local.storage.enabled=Habilitar almacenamiento local para VMs de Usuarios
 label.local.storage.enabled.system.vms=Habilitar almacenamiento local para VMs de Sistema
 label.login=Login
-label.logout=Cerrar sesi\u00c3\u00b3n
+label.logout=Cerrar sesi\u00f3n
 label.lun=LUN
 label.LUN.number=LUN \#
 label.lxc.traffic.label=Etiqueta de tr\u00e1fico LXC
@@ -947,7 +947,7 @@ label.management.server=Management Server
 label.manage.resources=Administrar los Recursos
 label.max.cpus=CPU cores M\u00e1x.
 label.max.guest.limit=L\u00edmite Guest M\u00e1x.
-label.maximum=m\u00c3\u00a1ximo
+label.maximum=m\u00e1ximo
 label.max.instances=Instancias M\u00e1ximas
 label.max.memory=Memoria M\u00e1x. (MiB)
 label.max.networks=Redes M\u00e1x.
@@ -955,7 +955,7 @@ label.max.primary.storage=Primario M\u00e1x. (GiB)
 label.max.public.ips=IPs p\u00fablicas M\u00e1x.
 label.max.secondary.storage=Secundario M\u00e1x. (GiB)
 label.max.snapshots=Instant\u00e1neas M\u00e1x.
-label.max.templates=Plantillas M\u00e1ximos
+label.max.templates=Templates M\u00e1ximos
 label.max.vms=VMs de usuario M\u00e1x.
 label.max.volumes=Maxima cantidad de Volumes
 label.max.vpcs=VPCs M\u00e1x.
@@ -972,16 +972,16 @@ label.menu.alerts=Alertas
 label.menu.all.accounts=Todas las cuentas
 label.menu.all.instances=todas las instancias
 label.menu.community.isos=Comunidad ISOs
-label.menu.community.templates=plantillas de la comunidad
-label.menu.configuration=Configuraci\u00c3\u00b3n
+label.menu.community.templates=Templates de la Comunidad
+label.menu.configuration=Configuraci\u00f3n
 label.menu.dashboard=Interfaz
 label.menu.destroyed.instances=Destruir instancias
-label.menu.disk.offerings=disco ofertas
-label.menu.domains=dominio
+label.menu.disk.offerings=Ofertas de Disco
+label.menu.domains=Dominios
 label.menu.events=Eventos
 label.menu.featured.isos=destacados ISO
-label.menu.featured.templates=destacados plantillas
-label.menu.global.settings=Configuraci\u00c3\u00b3n global
+label.menu.featured.templates=Templates Destacados
+label.menu.global.settings=Configuraci\u00f3n Global
 label.menu.infrastructure=Infraestructura
 label.menu.instances=Instancias
 label.menu.ipaddresses=Direcciones IP
@@ -989,28 +989,28 @@ label.menu.isos=ISO
 label.menu.my.accounts=Mis cuentas
 label.menu.my.instances=Mi instancias
 label.menu.my.isos=Mi ISOs
-label.menu.my.templates=Mis plantillas
+label.menu.my.templates=Mis Templates
 label.menu.network.offerings=Red de ofertas
 label.menu.network=Red
-label.menu.physical.resources=Recursos F\u00c3\u00adsicos
+label.menu.physical.resources=Recursos F\u00edsicos
 label.menu.regions=Regiones
-label.menu.running.instances=Ejecuci\u00c3\u00b3n de instancias
+label.menu.running.instances=Ejecuci\u00f3n de instancias
 label.menu.security.groups=Grupos de seguridad
 label.menu.service.offerings=Ofertas de Servicios
-label.menu.snapshots=instant\u00c3\u00a1neas
+label.menu.snapshots=instant\u00e1neas
 label.menu.sshkeypair=Par de Claves SSH
 label.menu.stopped.instances=Detenido instancias
 label.menu.storage=Almacenamiento
 label.menu.system.service.offerings=Ofertas de Sistema
 label.menu.system=Sistema
-label.menu.system.vms=Sistema de m\u00c3\u00a1quinas virtuales
-label.menu.templates=Plantillas
+label.menu.system.vms=Sistema de m\u00e1quinas virtuales
+label.menu.templates=Templates
 label.menu.virtual.appliances=Virtual Appliances
 label.menu.virtual.resources=Virtual de Recursos
-label.menu.volumes=Vol\u00c3\u00bamenes
+label.menu.volumes=Vol\u00famenes
 label.menu.vpc.offerings=Ofertas de VPC
 label.metrics.allocated=Asignados
-label.metrics.clusters=Cluster
+label.metrics.clusters=Clusters
 label.metrics.cpu.allocated=Asignaci\u00f3n de CPU
 label.metrics.cpu.max.dev=Desviaci\u00f3n
 label.metrics.cpu.total=Total
@@ -1020,14 +1020,14 @@ label.metrics.disk.allocated=Asignados
 label.metrics.disk=Disco
 label.metrics.disk.iops.total=IOPS
 label.metrics.disk.read=Lectura
-label.metrics.disk.size=Tama\u00c3\u00b1o
+label.metrics.disk.size=Tama\u00f1o
 label.metrics.disk.storagetype=Tipo
 label.metrics.disk.total=Total
 label.metrics.disk.unallocated=Sin asignar
 label.metrics.disk.usage=Uso del Disco
 label.metrics.disk.used=Usado
 label.metrics.disk.write=Escritura
-label.metrics.hosts=Ej\u00c3\u00a9rcitos
+label.metrics.hosts=Servidores
 label.metrics.memory.allocated=Asignaci\u00f3n de Memoria
 label.metrics.memory.max.dev=Desviaci\u00f3n
 label.metrics.memory.total=Total
@@ -1044,17 +1044,17 @@ label.metrics.scope=Alcance
 label.metrics.state=Estado
 label.metrics.storagepool=Pool de Almacenamiento
 label.metrics.vm.name=Nombre de la VM
-label.migrate.instance.to.host=Migrar instancia a otro host.
-label.migrate.instance.to=Migraci\u00c3\u00b3n de ejemplo para
-label.migrate.instance.to.ps=Migrar instancia a otro primary storage.
+label.migrate.instance.to.host=Migrar instancia a otro servidor.
+label.migrate.instance.to=Migraci\u00f3n de ejemplo para
+label.migrate.instance.to.ps=Migrar instancia a otro almacenamiento primario
 label.migrate.lb.vm=Migrar LB VM
 label.migrate.router.to=Router para migrar
-label.migrate.systemvm.to=Migrar m\u00c3\u00a1quina virtual del sistema para
-label.migrate.to.host=Migrar a host
+label.migrate.systemvm.to=Migrar m\u00e1quina virtual del sistema para
+label.migrate.to.host=Migrar al server
 label.migrate.to.storage=Migrar a almacenamiento
 label.migrate.volume=Migrar Volumen
 label.migrate.volume.to.primary.storage=Migrar volumen a otro almacenamiento primario
-label.minimum=M\u00c3\u00adnimo
+label.minimum=M\u00ednimo
 label.min.instances=Instancias M\u00ednimas
 label.min.past.the.hr=minuto(s) despu\u00e9s de la hora
 label.minute.past.hour=minuto(s) despu\u00e9s de la hora
@@ -1062,20 +1062,20 @@ label.minutes.past.hour=minuto(s) despu\u00e9s de la hora
 label.mode=modo
 label.monday=lunes
 label.monthly=mensual
-label.more.templates=plantillas \= M\u00c3\u00a1s
+label.more.templates=M\u00e1s Templates
 label.move.down.row=Mover abajo una fila
 label.move.to.bottom=Mover al fondo
 label.move.to.top=Mover al principio
 label.move.up.row=Mover una fila arriba
 label.my.account=Mi Cuenta
 label.my.network=Mi red
-label.my.templates=Mis plantillas
+label.my.templates=Mis Templates
 label.name.lower=Nombre
 label.name=Nombre
 label.name.optional=Nombre (Opcional)
 label.na=N/A
 label.nat.port.range=Rango puertos NAT
-label.netmask=m\u00c3\u00a1scara de red
+label.netmask=m\u00e1scara de red
 label.netscaler.details=Detalles del NetScaler
 label.netScaler=NetScaler
 label.network.ACL=ACL de Red
@@ -1087,7 +1087,7 @@ label.network.desc=Red de Desc
 label.network.details=Detalles de la Red
 label.network.device=De dispositivos de red
 label.network.device.type=Tipo de red de dispositivos
-label.network.domain=red de dominio
+label.network.domain=Red de Dominio
 label.network.domain.text=Dominio de Red
 label.network.id=ID de red
 label.networking.and.security=Redes y Seguridad
@@ -1095,7 +1095,7 @@ label.network.label.display.for.blank.value=Usar default gateway
 label.network.limits=L\u00edmites de la Red
 label.network.name=Nombre de red
 label.network.offering.details=Detalles de la oferta de red
-label.network.offering.display.text=Red ofrece visualizaci\u00c3\u00b3n de texto
+label.network.offering.display.text=Red ofrece visualizaci\u00f3n de texto
 label.network.offering.id=Red ofrece ID
 label.network.offering.name=Red ofrece Nombre
 label.network.offering=Red ofrece
@@ -1108,7 +1108,7 @@ label.networks=Redes
 label.network.type=Tipo de red
 label.network.write=Escribir en la red
 label.new=Nuevo
-label.new.password=Nueva contrase\u00c3\u00b1a
+label.new.password=Nueva contrase\u00f1a
 label.new.project=Nuevo Proyecto
 label.new.ssh.key.pair=Nuevo Par de Claves SSH
 label.new.vm=Nueva maquina virtual
@@ -1116,9 +1116,10 @@ label.next=Siguiente
 label.nexusVswitch=Nexus 1000v
 label.nfs=NFS
 label.nfs.server=servidor NFS
-label.nfs.storage=NFS Almacenamiento
+label.nfs.storage=Almacenamiento NFS
 label.nic.adapter.type=Tipo de adaptador NIC
 label.nicira.controller.address=Direcci\u00f3n de Controladora
+label.nicira.l2gatewayserviceuuid=UUID del Servicio L2 Gateway
 label.nicira.l3gatewayserviceuuid=UUID del Servicio L3 Gateway
 label.nicira.nvp.details=Detalles del NVP Nicira
 label.nicira.transportzoneuuid=UUID de la Zona de Transporte
@@ -1129,25 +1130,25 @@ label.no.data=No hay informaci\u00f3n que mostrar
 label.no.errors=No recientes errores
 label.no.grouping=(sin agrupar)
 label.no.isos=No ISOs disponibles
-label.no.items=No art\u00c3\u00adculos disponibles
+label.no.items=No art\u00edculos disponibles
 label.none=Ninguno
 label.no=No
 label.no.security.groups=No hay grupos disponibles de Seguridad
 label.not.found=No se ha encontrado
 label.no.thanks=No, gracias
 label.notifications=Notificaciones
-label.number.of.clusters=N\u00famero de Clusters
+label.number.of.clusters=Cantidad de Clusters
 label.number.of.cpu.sockets=Cantidad de Sockets de CPU
-label.number.of.hosts=N\u00famero de Hosts
+label.number.of.hosts=N\u00famero de Servidores
 label.number.of.pods=N\u00famero de Pods
-label.number.of.system.vms=N\u00famero de VM\\'s del Systema
+label.number.of.system.vms=Cantidad de VM\\\\'s de Sistema
 label.number.of.virtual.routers=N\u00famero de Routers Virtuales
 label.number.of.zones=N\u00famero de Zonas
-label.num.cpu.cores=n\u00c3\u00bamero de n\u00c3\u00bacleos de CPU
-label.numretries=N\u00c3\u00bamero de reintentos
+label.num.cpu.cores=n\u00famero de n\u00facleos de CPU
+label.numretries=N\u00famero de reintentos
 label.ocfs2=OCFS2
 label.offer.ha=Oferta HA
-label.of.month=de mes
+label.of.month=del mes
 label.ok=Aceptar
 label.opendaylight.controller=Controlador OpenDaylight
 label.opendaylight.controllerdetail=Detalles del Controlador OpenDaylight
@@ -1167,17 +1168,17 @@ label.ovm3.traffic.label=Etiqueta de tr\u00e1fico OVM3
 label.ovm3.vip=IP del VIP Master
 label.ovm.traffic.label=Etiqueta de tr\u00e1fico OVM
 label.ovs=OVS
-label.owned.public.ips=propiedad p\u00c3\u00bablica Direcciones IP
+label.owned.public.ips=propiedad p\u00fablica Direcciones IP
 label.owner.account=titular de la cuenta
 label.owner.domain=Due\u00f1o del Dominio
 label.palo.alto.details=Detalles de Palo Alto
 label.PA.log.profile=Perfil de Palo Alto Log
 label.PA=Palo Alto
-label.parent.domain=Padres de dominio
+label.parent.domain=Dominio Padre
 label.passive=Pasivo
-label.password=Contrase\u00c3\u00b1a
-label.password.enabled=Contrase\u00c3\u00b1a Activado
-label.password.lower=contrase\u00f1a
+label.password=Contrase\u00f1a
+label.password.enabled=Contrase\u00f1a Activada
+label.password.lower=contrase&ntilde;a
 label.password.reset.confirm=La Contrase\u00f1a se ha cambiado a
 label.PA.threat.profile=Perf\u00edl de Amenazas Palo Alto
 label.path=Ruta
@@ -1186,11 +1187,11 @@ label.persistent=Persistente
 label.physical.network.ID=ID de red f\u00edsica
 label.physical.network.name=Nombre de red f\u00edsica
 label.physical.network=Red F\u00edsica
-label.PING.CIFS.password=PING CIFS contrase\u00c3\u00b1a
+label.PING.CIFS.password=PING CIFS contrase\u00f1a
 label.PING.CIFS.username=PING CIFS nombre de usuario
 label.PING.dir=PING Directorio
 label.ping.path=Camino de Ping
-label.PING.storage.IP=PING almacenamiento IP
+label.PING.storage.IP=PING a la IP del almacenamiento 
 label.planner.mode=Modo planificaci\u00f3n
 label.please.complete.the.following.fields=Por favor complete los siguientes campos
 label.please.specify.netscaler.info=Por favor especifique la informaci\u00f3n del Netscaler
@@ -1213,15 +1214,15 @@ label.port.range=rango de puertos
 label.PreSetup=PreSetup
 label.prev=Anterior
 label.previous=Previo
-label.primary.allocated=primaria asignado de almacenamiento
+label.primary.allocated=Almacenamiento Primario Asignado
 label.primary.network=Red Primaria
 label.primary.storage=Almacenamiento Primario
-label.primary.storage.count=Pool Almacenamiento Primario
+label.primary.storage.count=Almacenamiento Primario del Pool
 label.primary.storage.limits=L\u00edmite del Almacenamiento Primario (GiB)
-label.primary.used=Primaria Almacenado
+label.primary.used=Almacenamiento Primario Usado
 label.private.Gateway=Gateway Privado
 label.private.interface=Interfaz privada
-label.private.ip=direcci\u00c3\u00b3n IP privada
+label.private.ip=direcci\u00f3n IP privada
 label.private.ip.range=IP privada Gama
 label.private.ips=direcciones IP privadas
 label.private.key=Clave Privada
@@ -1231,29 +1232,29 @@ label.private.port=Puerto privado
 label.private.zone=Zona Privada
 label.profile=Perfil
 label.project.dashboard=Tablero del Proyecto
-label.project.id=ID proyecto
+label.project.id=ID del Proyecto
 label.project.invite=Invitar al proyecto
 label.project.name=Nombre del Proyecto
-label.project=proyecto
-label.projects=proyectos
+label.project=Proyecto
+label.projects=Proyectos
 label.project.view=Vista de Proyecto
 label.protocol.number=N\u00famero de Protocolo
 label.protocol=Protocolo
 label.provider=Proveedor
 label.providers=Proveedores
-label.public.interface=interfaz p\u00c3\u00bablica
-label.public.ip=direcci\u00c3\u00b3n IP p\u00c3\u00bablica
-label.public.ips=direcciones IP p\u00c3\u00bablicas
+label.public.interface=interfaz p\u00fablica
+label.public.ip=direcci\u00f3n IP p\u00fablica
+label.public.ips=direcciones IP p\u00fablicas
 label.public.key=Clave P\u00fablica
 label.public.lb=LB P\u00fablico
 label.public.load.balancer.provider=Proveedor de Load Balancer P\u00fablico
 label.public.network=Red P\u00fablica
-label.public.port=Puerto P\u00c3\u00bablico
-label.public=P\u00c3\u00bablica
+label.public.port=Puerto P\u00fablico
+label.public=P\u00fablica
 label.public.traffic=Tr\u00e1fico p\u00fablico
 label.public.traffic.vswitch.name=Nombre de vSwitch para Tr\u00e1fico Public
 label.public.traffic.vswitch.type=Tipo de vSwitch para Tr\u00e1fico Public
-label.public.zone=Zona P\u00c3\u00bablica
+label.public.zone=Zona P\u00fablica
 label.purpose=Prop\u00f3sito
 label.Pxe.server.type=Tipo de servidor Pxe
 label.qos.type=Tipo de QoS
@@ -1272,7 +1273,7 @@ label.quota.description=Descripci\u00f3n de Quota
 label.quota.email.body=Cuerpo
 label.quota.email.lastupdated=\u00daltima Modificaci\u00f3n
 label.quota.email.subject=Tema
-label.quota.email.template=Plantilla de E-Mail
+label.quota.email.template=Template de E-Mail
 label.quota.enddate=Fecha de F\u00edn
 label.quota.endquota=Quota Final
 label.quota.enforcequota=Forzar Quota
@@ -1327,7 +1328,7 @@ label.release.dedicated.zone=Liberar Zona Dedicada
 label.remind.later=Recordar mas tarde
 label.remove.ACL=Remover ACL
 label.remove.egress.rule=Eliminar regla de salida
-label.remove.from.load.balancer=ejemplo Eliminaci\u00c3\u00b3n de equilibrador de carga
+label.remove.from.load.balancer=ejemplo Eliminaci\u00f3n de equilibrador de carga
 label.remove.ingress.rule=Eliminar regla de entrada
 label.remove.ip.range=Remover rango IP
 label.remove.ldap=Quitar LDAP
@@ -1354,7 +1355,7 @@ label.replace.acl=Reemplazar ACL
 label.required=Requerido
 label.requires.upgrade=Requiere Actualizaci\u00f3n
 label.reserved.ip.range=Rango IP Reservado
-label.reserved.system.gateway=System gateway reservado
+label.reserved.system.gateway=Gateway de sistema reservado
 label.reserved.system.ip=Reservados sistema de PI
 label.reserved.system.netmask=M\u00e1scara de red reservada para el sistema
 label.reset.ssh.key.pair.on.vm=Resetear el Par de Claves SSH en la VM
@@ -1365,7 +1366,7 @@ label.resize.new.offering.id=Nueva Oferta
 label.resize.new.size=Nuevo Tama\u00f1o (GB)
 label.resize.shrink.ok=Se redujo satisfactoriamente
 label.resource.limit.exceeded=L\u00edmite de Recursos Excedido
-label.resource.limits=L\u00c3\u00admites de Recursos
+label.resource.limits=L\u00edmites de Recursos
 label.resource.name=Nombre del Recurso
 label.resource=Recursos
 label.resources=Recursos
@@ -1381,14 +1382,14 @@ label.revoke.project.invite=Cancelar Invitaci\u00f3n
 label.role=Papel
 label.root.certificate=Certificado Ra\u00edz
 label.root.disk.controller=Controladora de disco ROOT
-label.root.disk.offering=Root Disco Offering
+label.root.disk.offering=Ofertas de Discos Root
 label.root.disk.size=Tama\u00f1o del disco Root (GB)
 label.router.vm.scaled.up=Router VM Escaladas
 label.routing=Enrutamiento
 label.routing.host=Servidor de Routeo
 label.rule.number=N\u00famero de Regla
 label.rules=Reglas
-label.running.vms=Ejecuci\u00c3\u00b3n de m\u00c3\u00a1quinas virtuales
+label.running.vms=Ejecuci\u00f3n de m\u00e1quinas virtuales
 label.s3.access_key=Llave de Acceso
 label.s3.bucket=Bucket
 label.s3.connection_timeout=Tiempo de conexi\u00f3n agotado
@@ -1401,7 +1402,7 @@ label.s3.socket_timeout=Timeout del Socket
 label.s3.use_https=Use HTTPS
 label.saml.enable=Autorizar SAML SSO
 label.saml.entity=Proveedor de Identidad
-label.saturday=s\u00c3\u00a1bado
+label.saturday=s\u00e1bado
 label.save.and.continue=Guardar y continuar
 label.save.changes=Grabar cambios
 label.save=Guardar
@@ -1415,12 +1416,12 @@ label.secondary.ips=IPs secundarios
 label.secondary.isolated.vlan.id=VLAN ID de Secundaria Aislada
 label.secondary.staging.store=Almacenamiento Secundario Temporario
 label.secondary.staging.store.details=Detalles del Almacenamiento Secundario Temporario
-label.secondary.storage=Almacenamiento secundario
+label.secondary.storage=Almacenamiento Secundario
 label.secondary.storage.count=Pools del Almacenamiento Secundario
 label.secondary.storage.details=Detalles del Almacenamiento Secundario
 label.secondary.storage.limits=L\u00edmite del Almacenamiento Secundario (GiB)
 label.secondary.storage.vm=VM de almacenamiento secundario
-label.secondary.used=Secundaria Almacenado
+label.secondary.used=Almacenamiento Secundario Usado
 label.secret.key=clave secreta
 label.security.group=Grupo de Seguridad
 label.security.group.name=Nombre de grupo de seguridad
@@ -1435,7 +1436,7 @@ label.select.offering=Elija oferta
 label.select.project=Elegir Proyecto
 label.select.region=Elegir Regi\u00f3n
 label.select=Seleccione
-label.select.template=Elegir Plantilla
+label.select.template=Elegir Template
 label.select.tier=Elija Tier
 label.select-view=Seleccione vista
 label.select.vm.for.static.nat=Seleccione VM para NAT est\u00e1tica
@@ -1446,13 +1447,13 @@ label.service.offering.details=Detalles de la oferta de servicio
 label.service.offering=Oferta de Servicio
 label.services=Servicios
 label.service.state=Estado del servicio
-label.session.expired=Session Caducado
+label.session.expired=Su Sesi\u00f3n a Caducado
 label.set.default.NIC=Definir NIC por defecto
-label.settings=Setos
-label.setup=Configuraci\u00c3\u00b3n
+label.settings=Seteos
+label.setup=Configuraci\u00f3n
 label.setup.network=Configurar Red
 label.setup.zone=Configurar Zona
-label.set.up.zone.type=Definir tipo de zona
+label.set.up.zone.type=Configurar tipo de zona
 label.shared=compartidas
 label.SharedMountPoint=SharedMountPoint
 label.show.advanced.settings=Mostrar setos avanzados
@@ -1460,17 +1461,17 @@ label.show.ingress.rule=Mostrar la regla del ingreso
 label.shutdown.provider=Apagar proveedor
 label.simplified.chinese.keyboard=Teclado Chino Simplificado
 label.site.to.site.VPN=VPN Site-to-site
-label.size=Tama\u00c3\u00b1o
+label.size=Tama\u00f1o
 label.skip.guide=He utilizado CloudStack anteriormente, saltar esta gu\u00eda
 label.smb.domain=Dominio SMB
 label.smb.password=Contrase\u00f1a SMB
 label.smb.username=Nombre de usuario SMB
-label.snapshot=Instant\u00c3\u00a1nea
-label.snapshot.limits=instant\u00c3\u00a1neas L\u00c3\u00admites
-label.snapshot.name=Nombre de instant\u00c3\u00a1neas
+label.snapshot=Instant\u00e1nea
+label.snapshot.limits=instant\u00e1neas L\u00edmites
+label.snapshot.name=Nombre de instant\u00e1neas
 label.snapshot.schedule=Configurar Instant\u00e1neas Recurrentes
-label.snapshot.s=instant\u00c3\u00a1neas
-label.snapshots=instant\u00c3\u00a1neas
+label.snapshot.s=instant\u00e1neas
+label.snapshots=instant\u00e1neas
 label.SNMP.community=SNMP Community
 label.SNMP.port=SNMP Port
 label.sockets=Sockets
@@ -1489,39 +1490,39 @@ label.ssh.key.pair=Par de Claves SSH
 label.ssh.key.pairs=Par de Claves SSH
 label.standard.us.keyboard=Teclado Standard (US)
 label.start.IP=IP inicial
-label.start.lb.vm=Arrancar VM LB
+label.start.lb.vm=Arrancar LB VM
 label.start.port=Iniciar Puerto
 label.start.reserved.system.IP=IP inicial reservada para el sistema
 label.start.vlan=VLAN inicial
 label.start.vxlan=VXLAN inicial
 label.state=Estado
 label.static.nat.enabled=NAT est\u00e1tica habilitada
-label.static.nat=NAT est\u00c3\u00a1tica
-label.static.nat.to=est\u00c3\u00a1tico NAT para
+label.static.nat=NAT est\u00e1tica
+label.static.nat.to=est\u00e1tico NAT para
 label.static.nat.vm.details=Detalles del NAT est\u00e1tico de la VM
 label.static.routes=Rutas Est\u00e1ticas
-label.statistics=Estad\u00c3\u00adsticas
+label.statistics=Estad\u00edsticas
 label.status=Estado
 label.step.1=Paso 1
 label.step.1.title=Paso 1\: <strong> Seleccione una plantilla </strong>
 label.step.2=Paso 2
 label.step.2.title=Paso 2\: <strong> Oferta de Servicio </strong>
 label.step.3=Paso 3
-label.step.3.title=Paso 3\: <strong id\="step3_label"> Seleccione un disco Ofrenda </strong>
+label.step.3.title=Paso 3\: <strong id\="step3_label"> Seleccione una Oferta de Disco </strong>
 label.step.4=Paso 4
 label.step.4.title=Paso 4\: <strong> Red </strong>
 label.step.5=Paso 5
-label.step.5.title=Paso 5\: Revisi\u00c3\u00b3n <strong> </strong>
+label.step.5.title=Paso 5\: Revisi\u00f3n <strong> </strong>
 label.stickiness.method=M\u00e9todo de Stickiness
 label.stickiness=Stickiness
 label.sticky.cookie-name=Nombre de Cookie
-label.sticky.domain=dominio
+label.sticky.domain=Dominio 
 label.sticky.expire=Expira
 label.sticky.holdtime=Tiempo de Retenci\u00f3n
 label.sticky.indirect=Indirecto
 label.sticky.length=Longitud
 label.sticky.mode=modo
-label.sticky.name=Nombre Pegajoso
+label.sticky.name=Nombre de Sticky
 label.sticky.nocache=No Cache
 label.sticky.postonly=Solo Post
 label.sticky.prefix=Prefijo
@@ -1529,12 +1530,12 @@ label.sticky.request-learn=Solicitar aprendizaje
 label.sticky.tablesize=Tama\u00f1o de tabla
 label.stop=Detener
 label.stop.lb.vm=Parar LB VM
-label.stopped.vms=Detenido m\u00c3\u00a1quinas virtuales
+label.stopped.vms=Detenido m\u00e1quinas virtuales
 label.storage=Almacenamiento
 label.storage.pool=Pool de Almacenamiento
-label.storage.tags=Etiquetas de almacenamiento
+label.storage.tags=Etiquetas de Almacenamiento
 label.storage.traffic=Tr\u00e1fico de Almacenamiento
-label.storage.type=Tipo de almacenamiento
+label.storage.type=Tipo de Almacenamiento
 label.subdomain.access=Acceso al Subdominio
 label.submit=Enviar
 label.submitted.by=[Enviado por\: <span id\="submitted_by"> </span>]
@@ -1554,7 +1555,7 @@ label.system.service.offering=Oferta de Servicio de Sistema
 label.system.vm.details=Detalles de la VM de Sistema
 label.system.vm.scaled.up=VM de Sistema Escaladas
 label.system.vm=Sistema de VM
-label.system.vms=Sistema de m\u00c3\u00a1quinas virtuales
+label.system.vms=Sistema de m\u00e1quinas virtuales
 label.system.vm.type=Tipo de sistema VM
 label.system.wide.capacity=Capacidad total del sistema
 label.tagged=etiqueta
@@ -1563,8 +1564,8 @@ label.tags=Etiquetas
 label.tag.value=Valor de Etiqueta
 label.target.iqn=Objetivo IQN
 label.task.completed=Tarea finalizada.
-label.template.limits=Plantilla L\u00c3\u00admites
-label.template=plantilla
+label.template.limits=Templates L\u00edmites
+label.template=Template
 label.TFTP.dir=Directorio de TFTP
 label.tftp.root.directory=Directorio ra\u00edz de TFTP
 label.theme.default=Tema Por Defecto
@@ -1584,19 +1585,19 @@ label.timezone=Zona horaria
 label.token=Token
 label.total.cpu=Total CPU
 label.total.CPU=Total CPU
-label.total.hosts=Total de Hosts
+label.total.hosts=Total de Servidores
 label.total.memory=Memoria Total
 label.total.of.ip=Direcciones IP totales
-label.total.of.vm=Total de m\u00c3\u00a1quinas virtuales
+label.total.of.vm=Total de m\u00e1quinas virtuales
 label.total.storage=Almacenamiento Total
 label.total.virtual.routers.upgrade=Virtual Routers que requieren actualizaci\u00f3n
 label.total.virtual.routers=Virtual Routers Totales
-label.total.vms=Total de m\u00c3\u00a1quinas virtuales
+label.total.vms=Total de m\u00e1quinas virtuales
 label.traffic.label=Etiqueta de trafico
 label.traffic.types=Tipo de Tr\u00e1ficos
-label.traffic.type=Tipo de Tr\u00c3\u00a1fico
+label.traffic.type=Tipo de Tr\u00e1fico
 label.tuesday=martes
-label.type.id=Tipo de identificaci\u00c3\u00b3n
+label.type.id=Tipo de identificaci\u00f3n
 label.type.lower=tipo
 label.type=Tipo
 label.ucs=UCS
@@ -1605,21 +1606,21 @@ label.unavailable=no disponible
 label.unhealthy.threshold=Fuera del Umbral Saludable
 label.unlimited=Unlimited
 label.untagged=sin etiquetar
-label.update.project.resources=Actualizar recurso del proyecto
+label.update.project.resources=Actualizar recursos del proyecto
 label.update.ssl.cert= Certificado SSL
 label.update.ssl= Certificado SSL
 label.updating=Actualizar
 label.upgrade.required=La Actualizaci\u00f3n es necesaria
-label.upgrade.router.newer.template=Actualizar Router para usar una Plantilla m\u00e1s Nueva
+label.upgrade.router.newer.template=Actualizar Router para usar el Template M\u00e1s Nuevo
 label.upload.from.local=Subir desde Local
 label.upload=Subir
-label.upload.template.from.local=Subir Plantilla desde Local
+label.upload.template.from.local=Subir Template desde Local
 label.upload.volume.from.local=Subir un Volumen desde Local
 label.upload.volume.from.url=Subir un Volumen desde URL
 label.upload.volume=Subir volumen
 label.url=URL
 label.usage.interface=Interfaz de uso
-label.usage.sanity.result=Resultado del Uso Sanitizado
+label.usage.sanity.result=Resultado del Uso Correcto
 label.usage.server=Servidor de Uso
 label.usage.type=Tipo de Uso
 label.usage.unit=Unidad
@@ -1635,15 +1636,15 @@ label.use.vm.ips=Usar las IP de la VM
 label.use.vm.ip=Usar VM IP\:
 label.value=Valor
 label.vcdcname=nombre
-label.vcenter.cluster=vCenter cl\u00c3\u00baster
+label.vcenter.cluster=Cl\u00faster de vCenter
 label.vcenter.datacenter=vCenter de centros de datos
-label.vcenter.datastore=vCenter almac\u00c3\u00a9n de datos
-label.vcenter.host=vCenter anfitri\u00c3\u00b3n
-label.vcenter.password=vCenter Contrase\u00c3\u00b1a
+label.vcenter.datastore=vCenter almac\u00e9n de datos
+label.vcenter.host=Servidor vCenter
+label.vcenter.password=Contrase\u00f1a de vCenter
 label.vcenter.username=vCenter Nombre de usuario
 label.vcenter=vcenter
 label.vcipaddress=Direcci\u00f3n IP de vCenter
-label.version=Versi\u00c3\u00b3n
+label.version=Versi\u00f3n
 label.vgpu.max.resolution=Resoluci\u00f3n M\u00e1xima
 label.vgpu.max.vgpu.per.gpu=vGPU por GPU
 label.vgpu.remaining.capacity=Capacidad remanente
@@ -1660,7 +1661,7 @@ label.virtual.appliance.details=Detalles del Virtual appliance
 label.virtual.appliances=Virtual Appliances
 label.virtual.appliance=Virtual Appliance
 label.virtual.machine=M\u00e1quinas virtuales
-label.virtual.machines=Maquinas virtuales
+label.virtual.machines=M\u00e1quinas virtuales
 label.virtual.networking=Red Virtual
 label.virtual.network=Red Virtual
 label.virtual.routers.group.account=Routers Virtuales agrupados por cuenta
@@ -1677,7 +1678,7 @@ label.vlan.range=VLAN Gama
 label.vlan=VLAN
 label.vlan.vni.ranges=Rango(s) VLAN/VNI
 label.vlan.vni.range=VLAN Gama
-label.vm.add=A\u00c3\u00b1adir Instancia
+label.vm.add=A\u00f1adir Instancia
 label.vm.destroy=Destroy
 label.vm.display.name=Nombra a mostrar de la VM
 label.VMFS.datastore=VMFS de datos tienda
@@ -1694,7 +1695,7 @@ label.vmsnapshot.memory=Instant\u00e1nea de la memoria
 label.vmsnapshot.parentname=Padre
 label.vmsnapshot.type=Tipo
 label.vm.start=Inicio
-label.vm.state=Estado de VM\\'s
+label.vm.state=Estado de VM\\\\'s
 label.vm.stop=Detener
 label.vms=VM
 label.vmware.datacenter.id=VMware datacenter ID
@@ -1704,14 +1705,14 @@ label.vmware.traffic.label=Etiquetas de tr\u00e1fico para VMware
 label.vnet.id=ID de VLAN
 label.vnet=VLAN
 label.vnmc.devices=Dispositivo VNMC
-label.vnmc=ID de VM
+label.vnmc=VNMC
 label.volatile=Vol\u00e1til
 label.volgroup=Volume Group
 label.volume.details=Detalles del Volumen
-label.volume.limits=l\u00c3\u00admites de volumen
+label.volume.limits=l\u00edmites de volumen
 label.volume.migrated=Volumen migrado
 label.volume.name=Nombre de Volumen
-label.volumes=Vol\u00c3\u00bamenes
+label.volumes=Vol\u00famenes
 label.volume=Volumen
 label.vpc.distributedvpcrouter=Router Distribuido VPC
 label.vpc.id=ID VPC
@@ -1742,94 +1743,94 @@ label.waiting=Esperando
 label.warn=Advertir
 label.warning=Advertencia
 label.warn.upper=WARN
-label.wednesday=mi\u00c3\u00a9rcoles
+label.wednesday=mi\u00e9rcoles
 label.weekly=Semanal
 label.welcome=Bienvenido
-label.welcome.cloud.console=Bienvenido a la consola de administraci\u00c3\u00b3n
+label.welcome.cloud.console=Bienvenido a la consola de administraci\u00f3n
 label.what.is.cloudstack=Que es CloudStack&\#8482?
 label.xenserver.tools.version.61.plus=Versi\u00f3n Original XS es 6.1\\+
 label.Xenserver.Tools.Version61plus=Versi\u00f3n Original XS es 6.1\\+
 label.xenserver.traffic.label=Etiqueta de tr\u00e1fico para XenServer
-label.yes=S\u00c3\u00ad
+label.yes=S\u00ed
 label.zone.dedicated=Zona Dedicada
 label.zone.details=Detalles de Zona
-label.zone.id=Zona de identificaci\u00c3\u00b3n
+label.zone.id=Zona de identificaci\u00f3n
 label.zone.lower=Zona
 label.zone.name=Nombre de la Zona
 label.zone.step.1.title=Paso 1\: <strong> Seleccione una red </strong>
-label.zone.step.2.title=Paso 2\: <strong>A\u00c3\u00b1adir una zona </strong>
-label.zone.step.3.title=Paso 3\: <strong>A\u00c3\u00b1adir una vaina </strong>
-label.zone.step.4.title=Paso 4\: <strong>A\u00c3\u00b1adir un rango de IP </strong>
+label.zone.step.2.title=Paso 2\: <strong>A\u00f1adir una zona </strong>
+label.zone.step.3.title=Paso 3\: <strong>A\u00f1adir una vaina </strong>
+label.zone.step.4.title=Paso 4\: <strong>A\u00f1adir un rango de IP </strong>
 label.zones=Zona
 label.zone.type=Tipo de Zona
 label.zone.wide=Zona para todo el
 label.zoneWizard.trafficType.guest=Guest\: Tr\u00e1fico entre las m\u00e1quinas virtuales del usuario final
-label.zoneWizard.trafficType.management=Management\: Tr\u00e1fico entre los recursos internos de CloudStack\\\\'s, incluyendo cualquier componente que se comunique con el Management Server, tales como hosts y las VMs de systema de CloudStack
+label.zoneWizard.trafficType.management=Management\: Tr\u00e1fico entre los recursos internos de CloudStack\\\\'s, incluyendo cualquier componente que se comunique con el Management Server, tales como servidores y las VMs de sistema de CloudStack
 label.zoneWizard.trafficType.public=Public\: Tr\u00e1fico entre la internet y las m\u00e1quinas virtuales en el cloud.
-label.zoneWizard.trafficType.storage=Almacenamiento\: Tr\u00e1fico entre los servidores de almacenamiento primario y secundario, tales como plantillas de VM e instant\u00e1neas
+label.zoneWizard.trafficType.storage=Almacenamiento\: Tr\u00e1fico entre los servidores de almacenamiento primario y secundario, tales como templates de VM e instant\u00e1neas
 label.zone=Zona
-managed.state=Estado logr\u00c3\u00b3
+managed.state=Estado logr\u00f3
 message.acquire.ip.nic=Por favor confirme que desea adquirir una IP secundaria nueva para esta NIC.<br/>NOTA\: Las direcciones IP secundarios adquiridas deben ser configuradas manualmente desde la m\u00e1quina virtual.
 message.acquire.new.ip=Por favor confirme que usted quiere adquirir una nueva IP para esta red
 message.acquire.new.ip.vpc=Por favor confirme que usted desea adquirir una nueva IP para este VPC.
 message.acquire.public.ip=Por favor seleccione una zona de la que desea adquirir su nueva IP.
+message.action.cancel.maintenance=El servidor ha cancelado con \u00e9xito su entrada al modo mantenimiento. Este proceso puede tardar hasta varios minutos.
 message.action.cancel.maintenance.mode=Por favor, confirme que desea cancelar el mantenimiento
-message.action.cancel.maintenance=Su acogida ha sido cancelado con \u00c3\u00a9xito para el mantenimiento. Este proceso puede tardar hasta varios minutos.
 message.action.change.service.warning.for.instance=Su instancia debe estar apagada antes de intentar el cambio de la oferta de servicio activa.
 message.action.change.service.warning.for.router=Su router debe estar apagado antes de intentar el cambio de la oferta de servicio activa.
-message.action.delete.cluster=Por favor, confirme que desea eliminar del cl\u00c3\u00baster
-message.action.delete.disk.offering=Por favor, confirme que desea eliminar ofreciendo disco
-message.action.delete.domain=Por favor, confirme que desea eliminar de dominio
-message.action.delete.external.firewall=Por favor, confirme que desea quitar este servidor de seguridad externo. Advertencia\: Si usted est\u00c3\u00a1 planeando volver a agregar el servidor de seguridad externo mismo, debe restablecer los datos de uso en el dispositivo.
-message.action.delete.external.load.balancer=Por favor, confirme que desea eliminar este equilibrador de carga externa. Advertencia\: Si usted est\u00c3\u00a1 planeando volver a agregar la misma equilibrador de carga externo, debe restablecer los datos de uso en el dispositivo.
+message.action.delete.cluster=Por favor, confirme que desea eliminar este cl\u00faster.
+message.action.delete.disk.offering=Por favor, confirme que desea eliminar esta oferta de disco.
+message.action.delete.domain=Por favor, confirme que desea eliminar este dominio
+message.action.delete.external.firewall=Por favor, confirme que desea quitar este servidor de seguridad externo. Advertencia\: Si usted est\u00e1 planeando volver a agregar el servidor de seguridad externo mismo, debe restablecer los datos de uso en el dispositivo.
+message.action.delete.external.load.balancer=Por favor, confirme que desea eliminar este equilibrador de carga externa. Advertencia\: Si usted est\u00e1 planeando volver a agregar la misma equilibrador de carga externo, debe restablecer los datos de uso en el dispositivo.
 message.action.delete.ingress.rule=Por favor, confirme que desea eliminar la regla de ingreso
 message.action.delete.ISO.for.all.zones=La ISO es utilizado por todas las zonas. Por favor, confirme que desea eliminar de todas las zonas.
 message.action.delete.ISO=Por favor, confirme que desea eliminar la norma ISO
 message.action.delete.network=Por favor, confirme que desea eliminar de la red
 message.action.delete.nexusVswitch=Porfavor confirme que usted quiere eliminar el Nexus 1000v
 message.action.delete.nic=Por favor, confirme que desea remover esta NIC, lo que har\u00e1 que sea removida la red de esta VM.
-message.action.delete.physical.network=Por favor confirme que desea borrar esta red f\u00edsica
+message.action.delete.physical.network=Por favor confirme que desea borrar esta red f\u00edsica.
 message.action.delete.pod=Por favor, confirme que desea eliminar de la vaina
 message.action.delete.primary.storage=Por favor, confirme que desea eliminar el almacenamiento primario
-message.action.delete.secondary.storage=Por favor, confirme que desea eliminar de almacenamiento secundario
+message.action.delete.secondary.storage=Por favor, confirme que desea eliminar este almacenamiento secundario.
 message.action.delete.security.group=Por favor, confirme que desea eliminar el grupo de seguridad
 message.action.delete.service.offering=Por favor, confirme que desea eliminar oferta de servicios
-message.action.delete.snapshot=Por favor, confirme que desea eliminar instant\u00c3\u00a1neas
+message.action.delete.snapshot=Por favor, confirme que desea eliminar instant\u00e1neas
 message.action.delete.system.service.offering=Por favor confirme que desea borrar esta oferta de servicio.
-message.action.delete.template.for.all.zones=La plantilla es utilizada por todas las zonas. Por favor, confirme que desea eliminar de todas las zonas.
-message.action.delete.template=Por favor, confirme que desea eliminar la plantilla
+message.action.delete.template.for.all.zones=El template es utilizado por todas las zonas. Por favor, confirme que desea eliminarlo de todas las zonas.
+message.action.delete.template=Por favor, confirme que desea eliminar este template.
 message.action.delete.volume=Por favor, confirme que desea eliminar el volumen
 message.action.delete.zone=Por favor, confirme que desea eliminar la zona
 message.action.destroy.instance=Por favor, confirme que desea destruir ejemplo
-message.action.destroy.systemvm=Por favor, confirme que desea destruir la m\u00c3\u00a1quina virtual del sistema.
-message.action.disable.cluster=Por favor, confirme que desea desactivar este grupo.
+message.action.destroy.systemvm=Por favor, confirme que desea destruir la m\u00e1quina virtual del sistema.
+message.action.disable.cluster=Por favor, confirme que desea deshabilitar este cl\u00faster.
 message.action.disable.nexusVswitch=Por favor confirme que usted quiere deshabilitar este nexus 1000v
 message.action.disable.physical.network=Por favor confirmar que usted quiere deshabilitar esta red f\u00edsica
 message.action.disable.pod=Por favor, confirme que desea desactivar esta vaina.
-message.action.disable.static.NAT=Por favor, confirme que desea desactivar NAT est\u00c3\u00a1tica
+message.action.disable.static.NAT=Por favor, confirme que desea desactivar NAT est\u00e1tica
 message.action.disable.zone=Por favor, confirme que desea desactivar esta zona.
-message.action.downloading.template=Descargando plantilla.
+message.action.downloading.template=Descargando template.
 message.action.download.iso=Por favor confirme que usted quiere descargar esta ISO
 message.action.download.template=Por favor confirme que usted quiere descargar este template
-message.action.enable.cluster=Por favor, confirme que desea habilitar este grupo.
-message.action.enable.maintenance=Su acogida ha sido preparado con \u00c3\u00a9xito para el mantenimiento. Este proceso puede tardar hasta varios minutos o m\u00c3\u00a1s dependiendo de c\u00c3\u00b3mo las m\u00c3\u00a1quinas virtuales se encuentran actualmente en este servidor.
+message.action.enable.cluster=Por favor, confirme que desea habilitar este cl\u00faster.
+message.action.enable.maintenance=Su acogida ha sido preparado con \u00e9xito para el mantenimiento. Este proceso puede tardar hasta varios minutos o m\u00e1s dependiendo de c\u00f3mo las m\u00e1quinas virtuales se encuentran actualmente en este servidor.
 message.action.enable.nexusVswitch=por favor confirme que usted quiere habilitar este nexus 1000v
 message.action.enable.physical.network=Por favor confirmar que usted quiere habilitar esta red f\u00edsica
 message.action.enable.pod=Por favor, confirme que desea habilitar esta vaina.
 message.action.enable.zone=Por favor, confirme que desea habilitar esta zona.
 message.action.expunge.instance=Por favor confirme que desea purgar esta instancia.
-message.action.force.reconnect=Por favor, confirme que desea forzar una reconexi\u00c3\u00b3n para el anfitri\u00c3\u00b3n
-message.action.host.enable.maintenance.mode=mode \= mantenimiento de Habilitaci\u00c3\u00b3n provocar\u00c3\u00a1 una migraci\u00c3\u00b3n en vivo de todas las instancias que se ejecutan en el sistema para cualquier m\u00c3\u00a1quina disponible.
+message.action.force.reconnect=Por favor, confirme que desea forzar una reconexi\u00f3n para el anfitri\u00f3n
+message.action.host.enable.maintenance.mode=mode \= mantenimiento de Habilitaci\u00f3n provocar\u00e1 una migraci\u00f3n en vivo de todas las instancias que se ejecutan en el sistema para cualquier m\u00e1quina disponible.
 message.action.instance.reset.password=Por favor, confirmar que desea cambiar la contrase\u00f1a de ROOT para esta VM
-message.action.manage.cluster=Por favor, confirme que desea para administrar el cl\u00c3\u00baster.
-message.action.primarystorage.enable.maintenance.mode=Advertencia\: colocar el almacenamiento principal en modo de mantenimiento har\u00c3\u00a1 que todas las m\u00c3\u00a1quinas virtuales utilizando vol\u00c3\u00bamenes de que sea detenido. \u00c2\u00bfDesea continuar?
+message.action.manage.cluster=Por favor, confirme que desea para administrar el cl\u00faster.
+message.action.primarystorage.enable.maintenance.mode=Advertencia\: colocar el almacenamiento principal en modo de mantenimiento har\u00e1 que todas las m\u00e1quinas virtuales utilizando vol\u00famenes de que sea detenido. \u00bfDesea continuar?
 message.action.reboot.instance=Por favor, confirme que desea reiniciar el ejemplo
 message.action.reboot.router=Todos los servicios provistos por este router virtual ser\u00e1n interrumpidos. Por favor confirmar que desea reiniciarlo.
 message.action.reboot.systemvm=Por favor, confirme que desea reiniciar el sistema VM
 message.action.release.ip=Por favor, confirme que desea liberar IP
 message.action.remove.host=Por favor confirme que desea borrar este servidor.
-message.action.reset.password.off=Su ejemplo en la actualidad no es compatible con esta funci\u00c3\u00b3n.
-message.action.reset.password.warning=Su ejemplo debe ser detenido antes de intentar cambiar su contrase\u00c3\u00b1a actual.
+message.action.reset.password.off=Su ejemplo en la actualidad no es compatible con esta funci\u00f3n.
+message.action.reset.password.warning=Su instancia debe ser detenida antes de intentar cambiar la contrase\u00f1a actual.
 message.action.restore.instance=Por favor, confirme que desea restaurar ejemplo
 message.action.revert.snapshot=Por favor confirme que desea revertir el volumen elegido a esta instant\u00e1nea.
 message.action.start.instance=Por favor, confirme que desea iniciar la instancia
@@ -1838,54 +1839,54 @@ message.action.start.systemvm=Por favor, confirme que desea iniciar el sistema V
 message.action.stop.instance=Por favor, confirme que desea detener la instancia
 message.action.stop.router=Todos los servicios provistos por este router virtual ser\u00e1n interrumpidos. Por favor confirmar que desea apagarlo.
 message.action.stop.systemvm=Por favor, confirme que desea detener sistema VM
-message.action.take.snapshot=Por favor, confirme que desea tomar instant\u00c3\u00a1neas
-message.action.unmanage.cluster=Por favor, confirme que desea unmanage del cl\u00c3\u00baster.
+message.action.take.snapshot=Por favor, confirme que desea tomar instant\u00e1neas
+message.action.unmanage.cluster=Por favor, confirme que desea unmanage del cl\u00faster.
 message.action.vmsnapshot.delete=Por favor confirme que desea borrar la instant\u00e1nea de esta VM.
 message.action.vmsnapshot.revert=Revertir instant\u00e1nea de VM
 message.activate.project=Usted esta seguro que quiere activar este proyecto?
-message.add.cluster=A\u00c3\u00b1adir un hipervisor administradas por cl\u00c3\u00baster de <b> zona <span id\="zone_name"> </span> </b>, la consola de <b> <span id\="pod_name"> </span> </b>
-message.add.cluster.zone=A\u00c3\u00b1adir un hipervisor administradas por cl\u00c3\u00baster de <b> zona <span id\="zone_name"> </span> </b>
-message.add.disk.offering=Por favor, especifique los par\u00c3\u00a1metros siguientes para agregar un nuevo disco que ofrece
+message.add.cluster=A\u00f1adir un hipervisor admin

<TRUNCATED>

[50/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
use more safe getCertificate(s) call


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 4817cb6ab1ed94a2a6c056b6d09f8219a98c04a1
Parents: 2d82198
Author: Daan Hoogland <da...@onecht.net>
Authored: Mon Apr 25 14:05:40 2016 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Wed May 11 15:12:05 2016 +0530

----------------------------------------------------------------------
 .../cloud/utils/security/CertificateHelper.java | 33 +++++++++++++-------
 1 file changed, 21 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4817cb6a/utils/src/main/java/com/cloud/utils/security/CertificateHelper.java
----------------------------------------------------------------------
diff --git a/utils/src/main/java/com/cloud/utils/security/CertificateHelper.java b/utils/src/main/java/com/cloud/utils/security/CertificateHelper.java
index fd05459..e1ec80c 100644
--- a/utils/src/main/java/com/cloud/utils/security/CertificateHelper.java
+++ b/utils/src/main/java/com/cloud/utils/security/CertificateHelper.java
@@ -38,6 +38,8 @@ import java.security.cert.X509Certificate;
 import java.security.spec.InvalidKeySpecException;
 import java.security.spec.PKCS8EncodedKeySpec;
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
 
 import org.apache.commons.codec.binary.Base64;
@@ -121,20 +123,27 @@ public class CertificateHelper {
     public static List<Certificate> parseChain(String chain) throws IOException, CertificateException {
 
         final List<Certificate> certs = new ArrayList<Certificate>();
-        final PemReader pemReader = new PemReader(new StringReader(chain));
-
-        Certificate crt = null;
-        final PemObject pemObject = pemReader.readPemObject();
-        final ByteArrayInputStream bais = new ByteArrayInputStream(pemObject.getContent());
-        final CertificateFactory certificateFactory = CertificateFactory.getInstance("X509");
-
-        while ((crt = certificateFactory.generateCertificate(bais)) != null) {
-            if (crt instanceof X509Certificate) {
-                certs.add(crt);
+        try(final PemReader pemReader = new PemReader(new StringReader(chain));)
+        {
+            Certificate cert = null;
+            final PemObject pemObject = pemReader.readPemObject();
+            final ByteArrayInputStream bais = new ByteArrayInputStream(pemObject.getContent());
+            final CertificateFactory certificateFactory = CertificateFactory.getInstance("X509");
+
+            Collection<? extends Certificate> c = certificateFactory.generateCertificates(bais);
+            Iterator<? extends Certificate> i = c.iterator();
+            while (i.hasNext()) {
+                cert = i.next();
+                if (cert instanceof X509Certificate) {
+                    certs.add(cert);
+                }
+            }
+            if (certs.size() == 0) {
+                throw new IllegalArgumentException("Unable to decode certificate chain");
             }
         }
-        if (certs.size() == 0) {
-            throw new IllegalArgumentException("Unable to decode certificate chain");
+        finally {
+            // just close the pemReader
         }
 
         return certs;


[42/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
maven: Fix jstl version usage

This would fix regression from recent mvn version changes. Without this
patch users get redirected to error.jsp as jstl-1.2 jar is not installed

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 003b97bcffe640e38d089c98e8215de4c8a805e6
Parents: afcbd27
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Wed May 4 15:28:12 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Wed May 11 09:58:27 2016 +0530

----------------------------------------------------------------------
 pom.xml        | 3 ++-
 server/pom.xml | 7 ++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/003b97bc/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 30e96a6..b75afd2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,7 +86,8 @@
     <cs.axiom.version>1.2.8</cs.axiom.version>
     <cs.neethi.version>2.0.4</cs.neethi.version>
     <cs.servlet.version>2.5</cs.servlet.version>
-    <cs.jstl.version>1.2.1</cs.jstl.version>
+    <cs.jstl.version>1.2</cs.jstl.version>
+    <cs.jstl-api.version>1.2.1</cs.jstl-api.version>
     <cs.selenium.server.version>1.0-20081010.060147</cs.selenium.server.version>
     <cs.vmware.api.version>6.0</cs.vmware.api.version>
     <org.springframework.version>3.2.16.RELEASE</org.springframework.version>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/003b97bc/server/pom.xml
----------------------------------------------------------------------
diff --git a/server/pom.xml b/server/pom.xml
index 8461d18..3269509 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -70,9 +70,14 @@
       <artifactId>mail</artifactId>
     </dependency>
     <dependency>
+      <groupId>jstl</groupId>
+      <artifactId>jstl</artifactId>
+      <version>${cs.jstl.version}</version>
+    </dependency>
+    <dependency>
       <groupId>javax.servlet.jsp.jstl</groupId>
       <artifactId>javax.servlet.jsp.jstl-api</artifactId>
-      <version>${cs.jstl.version}</version>
+      <version>${cs.jstl-api.version}</version>
     </dependency>
     <dependency>
       <groupId>commons-codec</groupId>


[41/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
CLOUDSTACK-8562: Deprecate commands.properties

- Removes commands.properties file
- Fixes apidocs and marvin to be independent of commands.properties usage
- Removes bundling of commands.properties in deb/rpm packaging
- Removes file references across codebase

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: afcbd270b2eb9086a76dda83c0f9ba2e034b0afd
Parents: 4347776
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Sat Apr 30 00:40:47 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Wed May 11 09:45:19 2016 +0530

----------------------------------------------------------------------
 client/tomcatconf/commands.properties.in        | 801 -------------------
 scripts/installer/windows/client.wxs            |   3 -
 .../src/com/cloud/api/doc/ApiXmlDocWriter.java  | 120 +--
 tools/apidoc/XmlToHtmlConverter.java            |  64 +-
 tools/apidoc/build-apidoc.sh                    |  15 +-
 tools/apidoc/gen_toc.py                         |  31 +-
 tools/apidoc/generateadmincommands.xsl          | 164 ----
 tools/apidoc/generatecommands.xsl               | 163 ++++
 tools/apidoc/generatedomainadmincommands.xsl    | 159 ----
 tools/apidoc/generatetoc.xsl                    |   2 +-
 tools/apidoc/generatetoc_header.xsl             |   2 +-
 tools/apidoc/generateusercommands.xsl           | 157 ----
 tools/apidoc/pom.xml                            |   2 -
 13 files changed, 193 insertions(+), 1490 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/afcbd270/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
deleted file mode 100644
index 32f33c9..0000000
--- a/client/tomcatconf/commands.properties.in
+++ /dev/null
@@ -1,801 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT 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 authentication commands
-login=15
-logout=15
-
-### SAML SSO/SLO commands
-samlSso=15
-samlSlo=15
-getSPMetadata=15
-listIdps=15
-authorizeSamlSso=7
-listSamlAuthorization=7
-listAndSwitchSamlAccount=15
-
-### Account commands
-createAccount=7
-deleteAccount=7
-updateAccount=7
-disableAccount=7
-enableAccount=7
-lockAccount=7
-listAccounts=15
-markDefaultZoneForAccount=1
-
-#### User commands
-createUser=7
-deleteUser=7
-updateUser=15
-listUsers=15
-lockUser=7
-disableUser=7
-enableUser=7
-getUser=1
-
-#### Domain commands
-createDomain=1
-updateDomain=1
-deleteDomain=1
-listDomains=7
-listDomainChildren=7
-
-####Cloud Identifier commands
-getCloudIdentifier=15
-
-#### Limit commands
-updateResourceLimit=7
-updateResourceCount=7
-listResourceLimits=15
-
-#### VM commands
-deployVirtualMachine=15
-destroyVirtualMachine=15
-rebootVirtualMachine=15
-startVirtualMachine=15
-stopVirtualMachine=15
-resetPasswordForVirtualMachine=15
-resetSSHKeyForVirtualMachine=15
-updateVirtualMachine=15
-listVirtualMachines=15
-getVMPassword=15
-restoreVirtualMachine=15
-changeServiceForVirtualMachine=15
-scaleVirtualMachine=15
-assignVirtualMachine=7
-migrateVirtualMachine=1
-migrateVirtualMachineWithVolume=1
-recoverVirtualMachine=15
-expungeVirtualMachine=15
-getVirtualMachineUserData=15
-
-#### snapshot commands
-createSnapshot=15
-listSnapshots=15
-deleteSnapshot=15
-createSnapshotPolicy=15
-updateSnapshotPolicy=15
-deleteSnapshotPolicies=15
-listSnapshotPolicies=15
-revertSnapshot=15
-
-#### template commands
-createTemplate=15
-registerTemplate=15
-updateTemplate=15
-copyTemplate=15
-deleteTemplate=15
-listTemplates=15
-updateTemplatePermissions=15
-listTemplatePermissions=15
-extractTemplate=15
-prepareTemplate=1
-
-#### iso commands
-attachIso=15
-detachIso=15
-listIsos=15
-registerIso=15
-updateIso=15
-deleteIso=15
-copyIso=15
-updateIsoPermissions=15
-listIsoPermissions=15
-extractIso=15
-
-#### guest OS commands
-listOsTypes=15
-listOsCategories=15
-addGuestOs=1
-updateGuestOs=1
-removeGuestOs=1
-
-#### guest OS mapping commands
-listGuestOsMapping=1
-addGuestOsMapping=1
-updateGuestOsMapping=1
-removeGuestOsMapping=1
-
-#### service offering commands
-createServiceOffering=7
-deleteServiceOffering=7
-updateServiceOffering=7
-listServiceOfferings=15
-
-#### disk offering commands
-createDiskOffering=7
-updateDiskOffering=7
-deleteDiskOffering=7
-listDiskOfferings=15
-
-#### vlan commands
-createVlanIpRange=1
-deleteVlanIpRange=1
-listVlanIpRanges=1
-dedicatePublicIpRange=1
-releasePublicIpRange=1
-dedicateGuestVlanRange=1
-releaseDedicatedGuestVlanRange=1
-listDedicatedGuestVlanRanges=1
-
-#### address commands
-associateIpAddress=15
-disassociateIpAddress=15
-listPublicIpAddresses=15
-updateIpAddress=15
-
-#### firewall commands
-listPortForwardingRules=15
-createPortForwardingRule=15
-deletePortForwardingRule=15
-updatePortForwardingRule=15
-
-#### NAT commands
-enableStaticNat=15
-createIpForwardingRule=15
-deleteIpForwardingRule=15
-listIpForwardingRules=15
-disableStaticNat=15
-
-#### load balancer commands
-createLoadBalancerRule=15
-deleteLoadBalancerRule=15
-removeFromLoadBalancerRule=15
-assignToLoadBalancerRule=15
-createLBStickinessPolicy=15
-updateLBStickinessPolicy=15
-deleteLBStickinessPolicy=15
-listLoadBalancerRules=15
-listLBStickinessPolicies=15
-listLBHealthCheckPolicies=15
-createLBHealthCheckPolicy=15
-updateLBHealthCheckPolicy=15
-deleteLBHealthCheckPolicy=15
-listLoadBalancerRuleInstances=15
-updateLoadBalancerRule=15
-
-##### SSL offload commands
-
-uploadSslCert=15
-deleteSslCert=15
-listSslCerts=15
-assignCertToLoadBalancer=15
-removeCertFromLoadBalancer=15
-
-#### autoscale commands
-createCounter=1
-createCondition=15
-createAutoScalePolicy=15
-createAutoScaleVmProfile=15
-createAutoScaleVmGroup=15
-deleteCounter=1
-deleteCondition=15
-deleteAutoScalePolicy=15
-deleteAutoScaleVmProfile=15
-deleteAutoScaleVmGroup=15
-listCounters=15
-listConditions=15
-listAutoScalePolicies=15
-listAutoScaleVmProfiles=15
-listAutoScaleVmGroups=15
-enableAutoScaleVmGroup=15
-disableAutoScaleVmGroup=15
-updateAutoScalePolicy=15
-updateAutoScaleVmProfile=15
-updateAutoScaleVmGroup=15
-
-#### router commands
-startRouter=7
-rebootRouter=7
-stopRouter=7
-destroyRouter=7
-changeServiceForRouter=7
-listRouters=7
-listVirtualRouterElements=7
-configureVirtualRouterElement=7
-createVirtualRouterElement=7
-upgradeRouterTemplate=1
-
-#### system vm commands
-startSystemVm=1
-rebootSystemVm=1
-stopSystemVm=1
-destroySystemVm=1
-listSystemVms=3
-migrateSystemVm=1
-changeServiceForSystemVm=1
-scaleSystemVm=1
-
-#### configuration commands
-updateConfiguration=1
-listConfigurations=1
-listCapabilities=15
-listDeploymentPlanners=1
-cleanVMReservations=1
-
-#### pod commands
-createPod=1
-updatePod=1
-deletePod=1
-listPods=3
-
-#### zone commands
-createZone=1
-updateZone=1
-deleteZone=1
-listZones=15
-
-#### events commands
-listEvents=15
-listEventTypes=15
-archiveEvents=15
-deleteEvents=15
-
-#### alerts commands
-listAlerts=3
-archiveAlerts=1
-deleteAlerts=1
-generateAlert=1
-
-#### system capacity commands
-listCapacity=3
-
-#### swift commands
-addSwift=1
-listSwifts=1
-
-#### image store commands
-addImageStore=1
-addImageStoreS3=1
-listImageStores=1
-deleteImageStore=1
-createSecondaryStagingStore=1
-listSecondaryStagingStores=1
-deleteSecondaryStagingStore=1
-updateCloudToUseObjectStore=1
-
-#### host commands
-addHost=3
-addCluster=1
-deleteCluster=1
-updateCluster=1
-reconnectHost=1
-updateHost=1
-deleteHost=3
-prepareHostForMaintenance=1
-cancelHostMaintenance=1
-listHosts=3
-listHostTags=7
-findHostsForMigration=1
-addSecondaryStorage=1
-updateHostPassword=1
-releaseHostReservation=1
-
-#### VmWare DC
-addVmwareDc=1
-removeVmwareDc=1
-listVmwareDcs=1
-
-#### volume commands
-attachVolume=15
-uploadVolume=15
-detachVolume=15
-createVolume=15
-deleteVolume=15
-listVolumes=15
-extractVolume=15
-migrateVolume=15
-resizeVolume=15
-updateVolume=1
-
-#### registration command:  FIXME -- this really should be something in management server that
-####                                 generates a new key for the user and they just have to
-####                                 use that key...the key is stored in the db associated w/
-####                                 the userId...every request to the developer API should be
-####                                 checked against the key
-registerUserKeys=15
-
-### async-query command
-queryAsyncJobResult=15
-listAsyncJobs=15
-
-#### storage pools commands
-listStoragePools=3
-listStorageProviders=3
-listStorageTags=7
-createStoragePool=1
-updateStoragePool=1
-deleteStoragePool=1
-listClusters=3
-enableStorageMaintenance=1
-cancelStorageMaintenance=1
-findStoragePoolsForMigration=1
-
-#### security group commands
-createSecurityGroup=15
-deleteSecurityGroup=15
-authorizeSecurityGroupIngress=15
-revokeSecurityGroupIngress=15
-authorizeSecurityGroupEgress=15
-revokeSecurityGroupEgress=15
-listSecurityGroups=15
-
-#### vm group commands
-createInstanceGroup=15
-deleteInstanceGroup=15
-updateInstanceGroup=15
-listInstanceGroups=15
-
-### Certificate commands
-uploadCustomCertificate=1
-
-### other commands
-listHypervisors=15
-
-### VPN
-createRemoteAccessVpn=15
-deleteRemoteAccessVpn=15
-listRemoteAccessVpns=15
-updateRemoteAccessVpn=15
-
-
-addVpnUser=15
-removeVpnUser=15
-listVpnUsers=15
-
-#### network offering commands
-createNetworkOffering=1
-updateNetworkOffering=1
-deleteNetworkOffering=1
-listNetworkOfferings=15
-
-#### network commands
-createNetwork=15
-deleteNetwork=15
-listNetworks=15
-restartNetwork=15
-updateNetwork=15
-
-#### nic commands ####
-addNicToVirtualMachine=15
-removeNicFromVirtualMachine=15
-updateDefaultNicForVirtualMachine=15
-
-####
-addIpToNic=15
-removeIpFromNic=15
-updateVmNicIp=15
-listNics=15
-
-#### SSH key pair commands
-registerSSHKeyPair=15
-createSSHKeyPair=15
-deleteSSHKeyPair=15
-listSSHKeyPairs=15
-
-#### Projects commands
-createProject=15
-deleteProject=15
-updateProject=15
-activateProject=15
-suspendProject=15
-listProjects=15
-addAccountToProject=15
-deleteAccountFromProject=15
-listProjectAccounts=15
-listProjectInvitations=15
-updateProjectInvitation=15
-deleteProjectInvitation=15
-
-####
-createFirewallRule=15
-deleteFirewallRule=15
-listFirewallRules=15
-updateFirewallRule=15
-
-####
-createEgressFirewallRule=15
-deleteEgressFirewallRule=15
-listEgressFirewallRules=15
-updateEgressFirewallRule=15
-
-#### hypervisor capabilities commands
-updateHypervisorCapabilities=1
-listHypervisorCapabilities=1
-
-#### Physical Network commands
-createPhysicalNetwork=1
-deletePhysicalNetwork=1
-listPhysicalNetworks=1
-updatePhysicalNetwork=1
-
-#### Physical Network Service Provider commands
-listSupportedNetworkServices=1
-addNetworkServiceProvider=1
-deleteNetworkServiceProvider=1
-listNetworkServiceProviders=1
-updateNetworkServiceProvider=1
-
-#### Physical Network Traffic Type commands
-addTrafficType=1
-deleteTrafficType=1
-listTrafficTypes=1
-updateTrafficType=1
-listTrafficTypeImplementors=1
-
-#### Storage Network commands
-createStorageNetworkIpRange=1
-deleteStorageNetworkIpRange=1
-listStorageNetworkIpRange=1
-updateStorageNetworkIpRange=1
-
-### Network Devices commands
-addNetworkDevice=1
-listNetworkDevice=1
-deleteNetworkDevice=1
-
-### VPC commands
-createVPC=15
-listVPCs=15
-deleteVPC=15
-updateVPC=15
-restartVPC=15
-
-#### VPC offering commands
-createVPCOffering=1
-updateVPCOffering=1
-deleteVPCOffering=1
-listVPCOfferings=15
-
-#### Private gateway commands
-createPrivateGateway=1
-listPrivateGateways=15
-deletePrivateGateway=1
-
-#### Network ACL commands
-createNetworkACL=15
-updateNetworkACLItem=15
-deleteNetworkACL=15
-listNetworkACLs=15
-createNetworkACLList=15
-deleteNetworkACLList=15
-replaceNetworkACLList=15
-listNetworkACLLists=15
-updateNetworkACLList=15
-
-
-#### Static route commands
-createStaticRoute=15
-deleteStaticRoute=15
-listStaticRoutes=15
-
-#### Tags commands
-createTags=15
-deleteTags=15
-listTags=15
-
-#### Meta Data commands
-addResourceDetail=1
-removeResourceDetail=1
-listResourceDetails=15
-
-### Site-to-site VPN commands
-createVpnCustomerGateway=15
-createVpnGateway=15
-createVpnConnection=15
-deleteVpnCustomerGateway=15
-deleteVpnGateway=15
-deleteVpnConnection=15
-updateVpnCustomerGateway=15
-resetVpnConnection=15
-listVpnCustomerGateways=15
-listVpnGateways=15
-listVpnConnections=15
-updateVpnConnection=15
-updateVpnGateway=15
-
-#### router commands
-createVirtualRouterElement=7
-configureVirtualRouterElement=7
-listVirtualRouterElements=7
-
-#### ovs commands
-createOvsElement=7
-configureOvsElement=7
-listOvsElements=7
-
-#### usage commands
-generateUsageRecords=1
-listUsageRecords=7
-listUsageTypes=1
-removeRawUsageRecords=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
-
-#### Palo Alto firewall commands
-addPaloAltoFirewall=1
-deletePaloAltoFirewall=1
-configurePaloAltoFirewall=1
-listPaloAltoFirewalls=1
-listPaloAltoFirewallNetworks=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
-
-#### brocade vcs commands
-
-addBrocadeVcsDevice=1
-deleteBrocadeVcsDevice=1
-listBrocadeVcsDevices=1
-listBrocadeVcsDeviceNetworks=1
-
-#### bigswitch bcf commands
-
-addBigSwitchBcfDevice=1
-deleteBigSwitchBcfDevice=1
-listBigSwitchBcfDevices=1
-
-#### stratosphere ssp commands
-
-addStratosphereSsp=1
-deleteStratoshereSsp=1
-
-#### nuage vsp commands
-
-addNuageVspDevice=1
-updateNuageVspDevice=1
-deleteNuageVspDevice=1
-listNuageVspDevices=1
-issueNuageVspResourceRequest=15
-
-#### host simulator commands
-
-configureSimulator=1
-querySimulatorMock=1
-cleanupSimulatorMock=1
-
-#### api discovery commands
-
-listApis=15
-
-#### API Rate Limit service command
-
-getApiLimit=15
-resetApiLimit=1
-
-#### API SolidFire Service Command
-getSolidFireAccountId=15
-getSolidFireVolumeSize=15
-getSolidFireVolumeAccessGroupId=15
-getSolidFireVolumeIscsiName=15
-
-#### Region commands
-addRegion=1
-updateRegion=1
-removeRegion=1
-listRegions=15
-
-#### GSLB (Global Server Load Balancing) commands
-createGlobalLoadBalancerRule=15
-deleteGlobalLoadBalancerRule=15
-updateGlobalLoadBalancerRule=15
-listGlobalLoadBalancerRules=15
-assignToGlobalLoadBalancerRule=15
-removeFromGlobalLoadBalancerRule=15
-
-### VM Snapshot commands
-listVMSnapshot=15
-createVMSnapshot=15
-deleteVMSnapshot=15
-revertToVMSnapshot=15
-
-#### Baremetal commands
-addBaremetalHost=1
-addBaremetalPxeKickStartServer=1
-addBaremetalPxePingServer=1
-addBaremetalDhcp=1
-listBaremetalDhcp=1
-listBaremetalPxeServers=1
-addBaremetalRct=1
-deleteBaremetalRct=1
-listBaremetalRct=1
-
-#### UCS commands
-addUcsManager=1
-listUcsManagers=1
-listUcsProfiles=1
-listUcsBlades=1
-associateUcsProfileToBlade=1
-removedeleteUcsManager=1
-
-#### New Load Balancer commands
-createLoadBalancer=15
-listLoadBalancers=15
-deleteLoadBalancer=15
-updateLoadBalancer=15
-
-#Internal Load Balancer Element commands
-configureInternalLoadBalancerElement=7
-createInternalLoadBalancerElement=7
-listInternalLoadBalancerElements=7
-
-
-#### Affinity group commands
-createAffinityGroup=15
-deleteAffinityGroup=15
-listAffinityGroups=15
-updateVMAffinityGroup=15
-listAffinityGroupTypes=15
-
-#### Cisco Vnmc commands
-addCiscoVnmcResource=1
-deleteCiscoVnmcResource=1
-listCiscoVnmcResources=1
-
-#### Cisco Asa1000v commands
-addCiscoAsa1000vResource=1
-deleteCiscoAsa1000vResource=1
-listCiscoAsa1000vResources=1
-
-#### portable public IP commands
-createPortableIpRange=1
-deletePortableIpRange=1
-listPortableIpRanges=1
-
-#### Internal LB VM commands
-stopInternalLoadBalancerVM=1
-startInternalLoadBalancerVM=1
-listInternalLoadBalancerVMs=1
-
-### Network Isolation methods listing
-listNetworkIsolationMethods=1
-
-#### Dedicated Resource commands
-dedicateZone=1
-dedicatePod=1
-dedicateCluster=1
-dedicateHost=1
-releaseDedicatedZone=1
-releaseDedicatedPod=1
-releaseDedicatedCluster=1
-releaseDedicatedHost=1
-listDedicatedZones=1
-listDedicatedPods=1
-listDedicatedClusters=1
-listDedicatedHosts=1
-
-### LDAP
-listLdapConfigurations=15
-addLdapConfiguration=3
-deleteLdapConfiguration=3
-listLdapUsers=3
-ldapCreateAccount=3
-importLdapUsers=3
-linkDomainToLdap=3
-
-
-#### juniper-contrail commands
-createServiceInstance=1
-
-### OpenDaylight plugin commands
-addOpenDaylightController=1
-deleteOpenDaylightController=1
-listOpenDaylightControllers=1
-
-### GloboDNS commands
-addGloboDnsHost=1
-
-### volume/template post upload
-getUploadParamsForVolume=15
-getUploadParamsForTemplate=15
-
-### Quota Service
-quotaStatement=15
-quotaBalance=15
-quotaSummary=15
-quotaUpdate=1
-quotaTariffList=15
-quotaTariffUpdate=1
-quotaCredits=1
-quotaEmailTemplateList=1
-quotaEmailTemplateUpdate=1
-quotaIsEnabled=15

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/afcbd270/scripts/installer/windows/client.wxs
----------------------------------------------------------------------
diff --git a/scripts/installer/windows/client.wxs b/scripts/installer/windows/client.wxs
index 3c9121d..414d813 100644
--- a/scripts/installer/windows/client.wxs
+++ b/scripts/installer/windows/client.wxs
@@ -595,9 +595,6 @@
                         <Component Id="cmp71D36BFB6B214FAAD323C31A1CE3BC19" Guid="{EF4C61E1-F77E-4E4D-80EA-131511E0804E}">
                             <File Id="fil44B623C422B90349A635A113C5F4D417" KeyPath="yes" Source="!(wix.SourceClient)\WEB-INF\classes\cloudmanagementserver.keystore" />
                         </Component>
-                        <Component Id="cmp19EB0E73466EB36D5AA02AB4CE8164B0" Guid="{D3EDCF5B-8A0F-444B-AE64-6C3EEE5F25F0}">
-                            <File Id="filAB20DD6954DD207821DD0311C1F48FAA" KeyPath="yes" Source="!(wix.SourceClient)\WEB-INF\classes\commands.properties" />
-                        </Component>
                         <Component Id="cmp68E096BB729948107692341D8202CC5A" Guid="{0D5D3AF3-0BC0-48EE-ABA3-AF07535169BF}">
                             <File Id="fil3E9BCB1A8CB8F8415FE3E71B65A94878" KeyPath="yes" Source="!(wix.SourceClient)\WEB-INF\classes\context.xml" />
                         </Component>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/afcbd270/server/src/com/cloud/api/doc/ApiXmlDocWriter.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/doc/ApiXmlDocWriter.java b/server/src/com/cloud/api/doc/ApiXmlDocWriter.java
index 166af4b..9246edd 100644
--- a/server/src/com/cloud/api/doc/ApiXmlDocWriter.java
+++ b/server/src/com/cloud/api/doc/ApiXmlDocWriter.java
@@ -41,7 +41,6 @@ import org.apache.log4j.Logger;
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.FileWriter;
 import java.io.IOException;
@@ -67,16 +66,10 @@ import java.util.zip.ZipOutputStream;
 public class ApiXmlDocWriter {
     public static final Logger s_logger = Logger.getLogger(ApiXmlDocWriter.class.getName());
 
-    private static final short DOMAIN_ADMIN_COMMAND = 4;
-    private static final short USER_COMMAND = 8;
+    private static String s_dirName = "";
     private static Map<String, Class<?>> s_apiNameCmdClassMap = new HashMap<String, Class<?>>();
     private static LinkedHashMap<Object, String> s_allApiCommands = new LinkedHashMap<Object, String>();
-    private static LinkedHashMap<Object, String> s_domainAdminApiCommands = new LinkedHashMap<Object, String>();
-    private static LinkedHashMap<Object, String> s_regularUserApiCommands = new LinkedHashMap<Object, String>();
     private static TreeMap<Object, String> s_allApiCommandsSorted = new TreeMap<Object, String>();
-    private static TreeMap<Object, String> s_domainAdminApiCommandsSorted = new TreeMap<Object, String>();
-    private static TreeMap<Object, String> s_regularUserApiCommandsSorted = new TreeMap<Object, String>();
-    private static String s_dirName = "";
     private static final List<String> AsyncResponses = setAsyncResponses();
 
     private static List<String> setAsyncResponses() {
@@ -123,71 +116,22 @@ public class ApiXmlDocWriter {
                 s_apiNameCmdClassMap.put(apiName, cmdClass);
             }
         }
-
-        LinkedProperties preProcessedCommands = new LinkedProperties();
-        String[] fileNames = null;
-
+        System.out.printf("Scanned and found %d APIs\n", s_apiNameCmdClassMap.size());
         List<String> argsList = Arrays.asList(args);
         Iterator<String> iter = argsList.iterator();
         while (iter.hasNext()) {
             String arg = iter.next();
-            // populate the file names
-            if (arg.equals("-f")) {
-                fileNames = iter.next().split(",");
-            }
             if (arg.equals("-d")) {
                 s_dirName = iter.next();
             }
         }
 
-        if ((fileNames == null) || (fileNames.length == 0)) {
-            System.out.println("Please specify input file(s) separated by coma using -f option");
-            System.exit(2);
-        }
-
-        for (String fileName : fileNames) {
-            try(FileInputStream in = new FileInputStream(fileName);) {
-                preProcessedCommands.load(in);
-            } catch (FileNotFoundException ex) {
-                System.out.println("Can't find file " + fileName);
-                System.exit(2);
-            } catch (IOException ex1) {
-                System.out.println("Error reading from file " + ex1);
-                System.exit(2);
-            }
-        }
-
-        Iterator<?> propertiesIterator = preProcessedCommands.keys.iterator();
-        // Get command classes and response object classes
-        while (propertiesIterator.hasNext()) {
-            String key = (String)propertiesIterator.next();
-            String preProcessedCommand = preProcessedCommands.getProperty(key);
-            int splitIndex = preProcessedCommand.lastIndexOf(";");
-            String commandRoleMask = preProcessedCommand.substring(splitIndex + 1);
-            Class<?> cmdClass = s_apiNameCmdClassMap.get(key);
-            if (cmdClass == null) {
-                System.out.println("Check, is this api part of another build profile? Null value for key: " + key + " preProcessedCommand=" + preProcessedCommand);
-                continue;
-            }
-            String commandName = cmdClass.getName();
-            s_allApiCommands.put(key, commandName);
-
-            short cmdPermissions = 1;
-            if (commandRoleMask != null) {
-                cmdPermissions = Short.parseShort(commandRoleMask);
-            }
-
-            if ((cmdPermissions & DOMAIN_ADMIN_COMMAND) != 0) {
-                s_domainAdminApiCommands.put(key, commandName);
-            }
-            if ((cmdPermissions & USER_COMMAND) != 0) {
-                s_regularUserApiCommands.put(key, commandName);
-            }
+        for (Map.Entry<String, Class<?>> entry: s_apiNameCmdClassMap.entrySet()) {
+            Class<?> cls = entry.getValue();
+            s_allApiCommands.put(entry.getKey(), cls.getName());
         }
 
         s_allApiCommandsSorted.putAll(s_allApiCommands);
-        s_domainAdminApiCommandsSorted.putAll(s_domainAdminApiCommands);
-        s_regularUserApiCommandsSorted.putAll(s_regularUserApiCommands);
 
         try {
             // Create object writer
@@ -195,83 +139,38 @@ public class ApiXmlDocWriter {
             xs.alias("command", Command.class);
             xs.alias("arg", Argument.class);
             String xmlDocDir = s_dirName + "/xmldoc";
-            String rootAdminDirName = xmlDocDir + "/root_admin";
-            String domainAdminDirName = xmlDocDir + "/domain_admin";
-            String regularUserDirName = xmlDocDir + "/regular_user";
+            String rootAdminDirName = xmlDocDir + "/apis";
             (new File(rootAdminDirName)).mkdirs();
-            (new File(domainAdminDirName)).mkdirs();
-            (new File(regularUserDirName)).mkdirs();
 
             ObjectOutputStream out = xs.createObjectOutputStream(new FileWriter(s_dirName + "/commands.xml"), "commands");
-            ObjectOutputStream rootAdmin = xs.createObjectOutputStream(new FileWriter(rootAdminDirName + "/" + "rootAdminSummary.xml"), "commands");
-            ObjectOutputStream rootAdminSorted = xs.createObjectOutputStream(new FileWriter(rootAdminDirName + "/" + "rootAdminSummarySorted.xml"), "commands");
-            ObjectOutputStream domainAdmin = xs.createObjectOutputStream(new FileWriter(domainAdminDirName + "/" + "domainAdminSummary.xml"), "commands");
-            ObjectOutputStream outDomainAdminSorted = xs.createObjectOutputStream(new FileWriter(domainAdminDirName + "/" + "domainAdminSummarySorted.xml"), "commands");
-            ObjectOutputStream regularUser = xs.createObjectOutputStream(new FileWriter(regularUserDirName + "/regularUserSummary.xml"), "commands");
-            ObjectOutputStream regularUserSorted = xs.createObjectOutputStream(new FileWriter(regularUserDirName + "/regularUserSummarySorted.xml"), "commands");
-
-            // Write commands in the order they are represented in commands.properties.in file
+            ObjectOutputStream rootAdmin = xs.createObjectOutputStream(new FileWriter(rootAdminDirName + "/" + "apiSummary.xml"), "commands");
+            ObjectOutputStream rootAdminSorted = xs.createObjectOutputStream(new FileWriter(rootAdminDirName + "/" + "apiSummarySorted.xml"), "commands");
+
             Iterator<?> it = s_allApiCommands.keySet().iterator();
             while (it.hasNext()) {
                 String key = (String)it.next();
-
                 // Write admin commands
                 writeCommand(out, key);
                 writeCommand(rootAdmin, key);
-
                 // Write single commands to separate xml files
                 ObjectOutputStream singleRootAdminCommandOs = xs.createObjectOutputStream(new FileWriter(rootAdminDirName + "/" + key + ".xml"), "command");
                 writeCommand(singleRootAdminCommandOs, key);
                 singleRootAdminCommandOs.close();
-
-                if (s_domainAdminApiCommands.containsKey(key)) {
-                    writeCommand(domainAdmin, key);
-                    ObjectOutputStream singleDomainAdminCommandOs = xs.createObjectOutputStream(new FileWriter(domainAdminDirName + "/" + key + ".xml"), "command");
-                    writeCommand(singleDomainAdminCommandOs, key);
-                    singleDomainAdminCommandOs.close();
-                }
-
-                if (s_regularUserApiCommands.containsKey(key)) {
-                    writeCommand(regularUser, key);
-                    ObjectOutputStream singleRegularUserCommandOs = xs.createObjectOutputStream(new FileWriter(regularUserDirName + "/" + key + ".xml"), "command");
-                    writeCommand(singleRegularUserCommandOs, key);
-                    singleRegularUserCommandOs.close();
-                }
             }
 
             // Write sorted commands
             it = s_allApiCommandsSorted.keySet().iterator();
             while (it.hasNext()) {
                 String key = (String)it.next();
-
                 writeCommand(rootAdminSorted, key);
-
-                if (s_domainAdminApiCommands.containsKey(key)) {
-                    writeCommand(outDomainAdminSorted, key);
-                }
-
-                if (s_regularUserApiCommands.containsKey(key)) {
-                    writeCommand(regularUserSorted, key);
-                }
             }
 
             out.close();
             rootAdmin.close();
             rootAdminSorted.close();
-            domainAdmin.close();
-            outDomainAdminSorted.close();
-            regularUser.close();
-            regularUserSorted.close();
 
             // write alerttypes to xml
             writeAlertTypes(xmlDocDir);
-
-            // gzip directory with xml doc
-            // zipDir(dirName + "xmldoc.zip", xmlDocDir);
-
-            // Delete directory
-            // deleteDir(new File(xmlDocDir));
-
         } catch (Exception ex) {
             ex.printStackTrace();
             System.exit(2);
@@ -537,5 +436,4 @@ public class ApiXmlDocWriter {
             return super.put(key, value);
         }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/afcbd270/tools/apidoc/XmlToHtmlConverter.java
----------------------------------------------------------------------
diff --git a/tools/apidoc/XmlToHtmlConverter.java b/tools/apidoc/XmlToHtmlConverter.java
index d15877c..63eb68e 100644
--- a/tools/apidoc/XmlToHtmlConverter.java
+++ b/tools/apidoc/XmlToHtmlConverter.java
@@ -23,9 +23,7 @@ public class XmlToHtmlConverter extends XmlToHtmlConverterData {
     // To turn off generation of API docs for certain roles, comment out
     public static void main(String[] args) {
         XmlToHtmlConverter x = new XmlToHtmlConverter();
-        x.populateForRootAdmin();
-        x.populateForDomainAdmin();
-        x.populateForUser();
+        x.populateForApi();
         x.generateToc();
         x.generateIndividualCommandPages();
     }
@@ -33,26 +31,12 @@ public class XmlToHtmlConverter extends XmlToHtmlConverterData {
     public void generateToc() {
         try {
             TransformerFactory tFactory = TransformerFactory.newInstance();
-            // Generate the TOC for the API reference for User role
-            Transformer transformer = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("generatetocforuser.xsl"));
-            // Modify this path to match your own setup.
-            transformer.transform(new javax.xml.transform.stream.StreamSource("regular_user/regularUserSummary.xml"), new javax.xml.transform.stream.StreamResult(
-                    new FileOutputStream("html/TOC_User.html")));
             // Generate the TOC for root administrator role
-            Transformer transformer1 = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("generatetocforadmin.xsl"));
-            // Modify this path to match your own setup.
-            transformer1.transform(new javax.xml.transform.stream.StreamSource("root_admin/rootAdminSummary.xml"),
-            // Modify this path to your own desired output location.
-                    new javax.xml.transform.stream.StreamResult(new FileOutputStream("html/TOC_Root_Admin.html")));
-            // Generate the TOC for domain admin role
-            Transformer transformer2 = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("generatetocfordomainadmin.xsl"));
-
-            // The XML to be transformed must be at the location below.
+            Transformer transformer1 = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("generatetoc.xsl"));
             // Modify this path to match your own setup.
-            transformer2.transform(new javax.xml.transform.stream.StreamSource("domain_admin/domainAdminSummary.xml"),
+            transformer1.transform(new javax.xml.transform.stream.StreamSource("apis/apiSummarySorted.xml"),
             // Modify this path to your own desired output location.
-                    new javax.xml.transform.stream.StreamResult(new FileOutputStream("html/TOC_Domain_Admin.html")));
-
+                    new javax.xml.transform.stream.StreamResult(new FileOutputStream("html/index.html")));
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -60,50 +44,18 @@ public class XmlToHtmlConverter extends XmlToHtmlConverterData {
 
     // Create man pages
     public void generateIndividualCommandPages() {
-        for (String commandName : rootAdminCommandNames) {
+        for (String commandName : allCommandNames) {
 
             try {
 
                 TransformerFactory tFactory = TransformerFactory.newInstance();
-                Transformer transformer = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("generateadmincommands.xsl"));
+                Transformer transformer = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("generatecommands.xsl"));
 
                 transformer.transform
                 // Modify this path to the location of the input files on your system.
-                        (new javax.xml.transform.stream.StreamSource("root_admin/" + commandName + ".xml"),
+                        (new javax.xml.transform.stream.StreamSource("apis/" + commandName + ".xml"),
                         // Modify this path with the desired output location.
-                                new javax.xml.transform.stream.StreamResult(new FileOutputStream("html/root_admin/" + commandName + ".html")));
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-
-        for (String commandName : domainAdminCommandNames) {
-
-            try {
-
-                TransformerFactory tFactory = TransformerFactory.newInstance();
-                Transformer transformer = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("generatedomainadmincommands.xsl"));
-
-                transformer.transform
-                // Modify this path with the location of the input files on your system.
-                        (new javax.xml.transform.stream.StreamSource("domain_admin/" + commandName + ".xml"),
-                        // Modify this path to the desired output location.
-                                new javax.xml.transform.stream.StreamResult(new FileOutputStream("html/domain_admin/" + commandName + ".html")));
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-
-        for (String commandName : userCommandNames) {
-
-            try {
-
-                TransformerFactory tFactory = TransformerFactory.newInstance();
-
-                Transformer transformer = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("generateusercommands.xsl"));
-
-                transformer.transform(new javax.xml.transform.stream.StreamSource("regular_user/" + commandName + ".xml"), new javax.xml.transform.stream.StreamResult(
-                        new FileOutputStream("html/user/" + commandName + ".html")));
+                                new javax.xml.transform.stream.StreamResult(new FileOutputStream("html/apis/" + commandName + ".html")));
             } catch (Exception e) {
                 e.printStackTrace();
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/afcbd270/tools/apidoc/build-apidoc.sh
----------------------------------------------------------------------
diff --git a/tools/apidoc/build-apidoc.sh b/tools/apidoc/build-apidoc.sh
index dc3751c..8ab69c8 100755
--- a/tools/apidoc/build-apidoc.sh
+++ b/tools/apidoc/build-apidoc.sh
@@ -58,9 +58,7 @@ set -e
 (cd "$DISTDIR/xmldoc"
  cp "$thisdir"/*.java .
  cp "$thisdir"/*.xsl .
- sed -e 's,%API_HEADER%,User API,g' "$thisdir/generatetoc_header.xsl" >generatetocforuser.xsl
- sed -e 's,%API_HEADER%,Root Admin API,g' "$thisdir/generatetoc_header.xsl" >generatetocforadmin.xsl
- sed -e 's,%API_HEADER%,Domain Admin API,g' "$thisdir/generatetoc_header.xsl" >generatetocfordomainadmin.xsl
+ sed -e 's,%API_HEADER%,All APIs,g' "$thisdir/generatetoc_header.xsl" >generatetoc.xsl
 
  PLATFORM=`uname -s`
  if [[ "$PLATFORM" =~ .*WIN.* ]]
@@ -74,15 +72,10 @@ set -e
      python "$thisdir/gen_toc.py" $(find . -type f)
  fi
 
- cat generatetocforuser_include.xsl >>generatetocforuser.xsl
- cat generatetocforadmin_include.xsl >>generatetocforadmin.xsl
- cat generatetocfordomainadmin_include.xsl >>generatetocfordomainadmin.xsl
+ cat generatetoc_include.xsl >> generatetoc.xsl
+ cat "$thisdir/generatetoc_footer.xsl" >>generatetoc.xsl
 
- cat "$thisdir/generatetoc_footer.xsl" >>generatetocforuser.xsl
- cat "$thisdir/generatetoc_footer.xsl" >>generatetocforadmin.xsl
- cat "$thisdir/generatetoc_footer.xsl" >>generatetocfordomainadmin.xsl
-
- mkdir -p html/user html/domain_admin html/root_admin
+ mkdir -p html/apis
  cp -r "$thisdir/includes" html
  cp -r "$thisdir/images" html
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/afcbd270/tools/apidoc/gen_toc.py
----------------------------------------------------------------------
diff --git a/tools/apidoc/gen_toc.py b/tools/apidoc/gen_toc.py
index 9277fb4..b86655e 100644
--- a/tools/apidoc/gen_toc.py
+++ b/tools/apidoc/gen_toc.py
@@ -23,35 +23,25 @@ from xml.dom import minidom
 from xml.parsers.expat import ExpatError
 
 
-REGULAR_USER = 'u'
-DOMAIN_ADMIN = 'd'
 ROOT_ADMIN = 'r'
 
 user_to_func = {
-    REGULAR_USER: 'populateForUser',
-    DOMAIN_ADMIN: 'populateForDomainAdmin',
-    ROOT_ADMIN: 'populateForRootAdmin',
+    ROOT_ADMIN: 'populateForApi',
     }
 
 
 user_to_cns = {
-    REGULAR_USER: 'userCommandNames',
-    DOMAIN_ADMIN: 'domainAdminCommandNames',
-    ROOT_ADMIN: 'rootAdminCommandNames',
+    ROOT_ADMIN: 'allCommandNames',
     }
 
 
 dirname_to_user = {
-    'regular_user': REGULAR_USER,
-    'domain_admin': DOMAIN_ADMIN,
-    'root_admin': ROOT_ADMIN,
+    'apis': ROOT_ADMIN,
     }
 
 
 dirname_to_dirname = {
-    'regular_user': 'user',
-    'domain_admin': 'domain_admin',
-    'root_admin': 'root_admin',
+    'apis': 'apis',
     }
 
 
@@ -131,6 +121,7 @@ known_categories = {
     'Product': 'Product',
     'LB': 'Load Balancer',
     'ldap': 'LDAP',
+    'Ldap': 'LDAP',
     'Swift': 'Swift',
     'S3' : 'S3',
     'SecondaryStorage': 'Host',
@@ -302,15 +293,9 @@ import java.util.HashSet;
 import java.util.Set;
 
 public class XmlToHtmlConverterData {
-
-	Set<String> rootAdminCommandNames = new HashSet<String>();
-	Set<String> domainAdminCommandNames = new HashSet<String>();
-	Set<String> userCommandNames = new HashSet<String>();
-
+    Set<String> allCommandNames = new HashSet<String>();
 ''')
-        f.write(java_for_user(REGULAR_USER) + "\n");
         f.write(java_for_user(ROOT_ADMIN) + "\n")
-        f.write(java_for_user(DOMAIN_ADMIN) + "\n")
 
         f.write('''
 }
@@ -318,7 +303,5 @@ public class XmlToHtmlConverterData {
 ''')
 
 
-write_xml('generatetocforuser_include.xsl', REGULAR_USER)
-write_xml('generatetocforadmin_include.xsl', ROOT_ADMIN)
-write_xml('generatetocfordomainadmin_include.xsl', DOMAIN_ADMIN)
+write_xml('generatetoc_include.xsl', ROOT_ADMIN)
 write_java('XmlToHtmlConverterData.java')

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/afcbd270/tools/apidoc/generateadmincommands.xsl
----------------------------------------------------------------------
diff --git a/tools/apidoc/generateadmincommands.xsl b/tools/apidoc/generateadmincommands.xsl
deleted file mode 100644
index 4ad2faf..0000000
--- a/tools/apidoc/generateadmincommands.xsl
+++ /dev/null
@@ -1,164 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-version="1.0">
-<xsl:output method="html" doctype-public="-//W3C//DTD HTML 1.0 Transitional//EN"/>
-<xsl:template match="/">
-<html xmlns="http://www.w3.org/1999/xhtml"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel= "stylesheet" href="../includes/main.css" type="text/css" />
-<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
-
-<title>Apache CloudStack | The Power Behind Your Cloud</title>
-</head>
-
-<body>
-<div id="insidetopbg">
-<div id="inside_wrapper">
-	<div class="uppermenu_panel">
-            <div class="uppermenu_box">       
-</div>
-        </div>
-        
-        <div id="main_master">
-            <div id="inside_header">
-
-                <div class="header_top">
-                    <a class="cloud_logo" href="http://cloudstack.org"></a>
-                    <div class="mainemenu_panel">
-                        
-                    </div>
-                </div>            
-            </div>
-
-            <div id="main_content">
-             	
-                <div class="inside_apileftpanel">
-                	<div class="inside_contentpanel" style="width:930px;">
-                    	<div class="api_titlebox">
-                        	<div class="api_titlebox_left">
-				<xsl:for-each select="command/command">
-                           		<!-- Modify this line for the release version -->
-                           		<span>
-									Apache CloudStack v4.6.0 Root Admin API Reference
-								</span>
-								<p></p>
-                                <h1><xsl:value-of select="name"/></h1>
-                                <p><xsl:value-of select="description"/></p>
-				</xsl:for-each>
-                            </div>
-
-                            
-                            <div class="api_titlebox_right">
-                            	<a class="api_backbutton" href="../TOC_Root_Admin.html"></a>
-                            </div>
-                        </div>
-                    	<div class="api_tablepanel">     
-                         	<h2>Request parameters</h2>
-                        	<table class="apitable">
-                            	<tr class="hed">
-                                	<td style="width:200px;"><strong>Parameter Name</strong></td>
-
-                                    <td style="width:500px;">Description</td>
-                                    <td style="width:180px;">Required</td>
-                                </tr>
-				<xsl:for-each select="command/command/request/arg">
-                                <tr>
-				    <xsl:if test="required='true'">
-                                    <td style="width:200px;"><strong><xsl:value-of select="name"/></strong></td>
-				    <td style="width:500px;"><strong><xsl:value-of select="description"/></strong></td>
-                                    <td style="width:180px;"><strong><xsl:value-of select="required"/></strong></td>
-				    </xsl:if>
-				    <xsl:if test="required='false'">
-                			<td style="width:200px;"><i><xsl:value-of select="name"/></i></td>
-                                    <td style="width:500px;"><i><xsl:value-of select="description"/></i></td>
-                                    <td style="width:180px;"><i><xsl:value-of select="required"/></i></td>
-				    </xsl:if>
-                                </tr>
-				</xsl:for-each>
-                            </table>
-                        </div>
-                         
-                         
-                         <div class="api_tablepanel">     
-                         	<h2>Response Tags</h2>
-                        	<table class="apitable">
-                            	<tr class="hed">
-                                	<td style="width:200px;"><strong>Response Name</strong></td>
-                                    <td style="width:500px;">Description</td>
-                                </tr>
-                                
-				<xsl:for-each select="command/command/response/arg">
-                                <tr>
-					<td style="width:200px;"><strong><xsl:value-of select="name"/></strong></td>
-                                    <td style="width:500px;"><xsl:value-of select="description"/></td>
-					<xsl:for-each select="./arguments/arg">
-					<tr>
-					<td style="width:180px; padding-left:25px;"><strong><xsl:value-of select="name"/></strong></td>
-                                    	<td style="width:500px;"><xsl:value-of select="description"/></td>
-					</tr>
-						<xsl:for-each select="./arguments/arg">
-						<tr>
-						<td style="width:165px; padding-left:40px;"><xsl:value-of select="name"/></td>
-		                            	<td style="width:500px;"><xsl:value-of select="description"/></td>
-						</tr>
-					</xsl:for-each>					
-					</xsl:for-each>					
-                                </tr>
-				</xsl:for-each>
-                                
-                         
-                                
-                              
-                            
-                            </table>
-
-                        </div>
-                        
-                        
-                </div> 
-                </div>
-                  
-     
-            </div>
-
-        </div><!-- #BeginLibraryItem "/libraries/footer.lbi" -->
-<div id="footer">
-<div id="comments_thread">
-    <script type="text/javascript" src="https://comments.apache.org/show_comments.lua?site=test" async="true">
-    </script>
-    <noscript>
-    <iframe width="930" height="500" src="https://comments.apache.org/iframe.lua?site=test&amp;page=4.2.0/rootadmin"></iframe>
-    </noscript>
-  </div>
-
-        	<div id="footer_mainmaster">
-                <p>Copyright � 2015 The Apache Software Foundation, Licensed under the
-                   <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0.</a> <br />
-                Apache, CloudStack, Apache CloudStack, the Apache CloudStack logo, the CloudMonkey logo  and the Apache feather logo are trademarks of The Apache Software Foundation.</p> 
-           </div>
-        </div>
-  </div>
- </div>
-</body>
-</html>
-</xsl:template>
-</xsl:stylesheet>
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/afcbd270/tools/apidoc/generatecommands.xsl
----------------------------------------------------------------------
diff --git a/tools/apidoc/generatecommands.xsl b/tools/apidoc/generatecommands.xsl
new file mode 100644
index 0000000..7e8ef78
--- /dev/null
+++ b/tools/apidoc/generatecommands.xsl
@@ -0,0 +1,163 @@
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+version="1.0">
+<xsl:output method="html" doctype-public="-//W3C//DTD HTML 1.0 Transitional//EN"/>
+<xsl:template match="/">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel= "stylesheet" href="../includes/main.css" type="text/css" />
+<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
+
+<title>Apache CloudStack | The Power Behind Your Cloud</title>
+</head>
+
+<body>
+<div id="insidetopbg">
+<div id="inside_wrapper">
+	<div class="uppermenu_panel">
+            <div class="uppermenu_box">
+</div>
+        </div>
+
+        <div id="main_master">
+            <div id="inside_header">
+
+                <div class="header_top">
+                    <a class="cloud_logo" href="http://cloudstack.org"></a>
+                    <div class="mainemenu_panel">
+
+                    </div>
+                </div>
+            </div>
+
+            <div id="main_content">
+
+                <div class="inside_apileftpanel">
+			<div class="inside_contentpanel" style="width:930px;">
+			<div class="api_titlebox">
+				<div class="api_titlebox_left">
+				<xsl:for-each select="command/command">
+					<!-- Modify this line for the release version -->
+					<span>
+									Apache CloudStack v4.9.0 Root Admin API Reference
+								</span>
+								<p></p>
+                                <h1><xsl:value-of select="name"/></h1>
+                                <p><xsl:value-of select="description"/></p>
+				</xsl:for-each>
+                            </div>
+
+
+                            <div class="api_titlebox_right">
+                                <a class="api_backbutton" href="../index.html"></a>
+                            </div>
+                        </div>
+			<div class="api_tablepanel">
+				<h2>Request parameters</h2>
+				<table class="apitable">
+				<tr class="hed">
+					<td style="width:200px;"><strong>Parameter Name</strong></td>
+
+                                    <td style="width:500px;">Description</td>
+                                    <td style="width:180px;">Required</td>
+                                </tr>
+				<xsl:for-each select="command/command/request/arg">
+                                <tr>
+				    <xsl:if test="required='true'">
+                                    <td style="width:200px;"><strong><xsl:value-of select="name"/></strong></td>
+				    <td style="width:500px;"><strong><xsl:value-of select="description"/></strong></td>
+                                    <td style="width:180px;"><strong><xsl:value-of select="required"/></strong></td>
+				    </xsl:if>
+				    <xsl:if test="required='false'">
+					<td style="width:200px;"><i><xsl:value-of select="name"/></i></td>
+                                    <td style="width:500px;"><i><xsl:value-of select="description"/></i></td>
+                                    <td style="width:180px;"><i><xsl:value-of select="required"/></i></td>
+				    </xsl:if>
+                                </tr>
+				</xsl:for-each>
+                            </table>
+                        </div>
+
+
+                         <div class="api_tablepanel">
+				<h2>Response Tags</h2>
+				<table class="apitable">
+				<tr class="hed">
+					<td style="width:200px;"><strong>Response Name</strong></td>
+                                    <td style="width:500px;">Description</td>
+                                </tr>
+
+				<xsl:for-each select="command/command/response/arg">
+                                <tr>
+					<td style="width:200px;"><strong><xsl:value-of select="name"/></strong></td>
+                                    <td style="width:500px;"><xsl:value-of select="description"/></td>
+					<xsl:for-each select="./arguments/arg">
+					<tr>
+					<td style="width:180px; padding-left:25px;"><strong><xsl:value-of select="name"/></strong></td>
+					<td style="width:500px;"><xsl:value-of select="description"/></td>
+					</tr>
+						<xsl:for-each select="./arguments/arg">
+						<tr>
+						<td style="width:165px; padding-left:40px;"><xsl:value-of select="name"/></td>
+						<td style="width:500px;"><xsl:value-of select="description"/></td>
+						</tr>
+					</xsl:for-each>
+					</xsl:for-each>
+                                </tr>
+				</xsl:for-each>
+
+
+
+
+
+                            </table>
+
+                        </div>
+
+
+                </div>
+                </div>
+
+
+            </div>
+
+        </div><!-- #BeginLibraryItem "/libraries/footer.lbi" -->
+<div id="footer">
+<div id="comments_thread">
+    <script type="text/javascript" src="https://comments.apache.org/show_comments.lua?site=test" async="true">
+    </script>
+    <noscript>
+    <iframe width="930" height="500" src="https://comments.apache.org/iframe.lua?site=test&amp;page=4.2.0/rootadmin"></iframe>
+    </noscript>
+  </div>
+
+		<div id="footer_mainmaster">
+                <p>Copyright � 2015 The Apache Software Foundation, Licensed under the
+                   <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0.</a> <br />
+                Apache, CloudStack, Apache CloudStack, the Apache CloudStack logo, the CloudMonkey logo  and the Apache feather logo are trademarks of The Apache Software Foundation.</p>
+           </div>
+        </div>
+  </div>
+ </div>
+</body>
+</html>
+</xsl:template>
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/afcbd270/tools/apidoc/generatedomainadmincommands.xsl
----------------------------------------------------------------------
diff --git a/tools/apidoc/generatedomainadmincommands.xsl b/tools/apidoc/generatedomainadmincommands.xsl
deleted file mode 100644
index e260b4f..0000000
--- a/tools/apidoc/generatedomainadmincommands.xsl
+++ /dev/null
@@ -1,159 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-version="1.0">
-<xsl:output method="html" doctype-public="-//W3C//DTD HTML 1.0 Transitional//EN"/>
-<xsl:template match="/">
-<html xmlns="http://www.w3.org/1999/xhtml"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel= "stylesheet" href="../includes/main.css" type="text/css" />
-<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
-
-<title>Apache CloudStack | The Power Behind Your Cloud</title>
-</head>
-
-<body>
-<div id="insidetopbg">
-<div id="inside_wrapper">
-	<div class="uppermenu_panel">
-            <div class="uppermenu_box">
-
-</div>
-        </div>
-        
-        <div id="main_master">
-            <div id="inside_header">
-
-                <div class="header_top">
-                    <a class="cloud_logo" href="http://cloudstack.org"></a>
-                    <div class="mainemenu_panel">
-                        
-                    </div>
-                </div>
-
-            
-            </div>
-
-            <div id="main_content">
-             	
-                <div class="inside_apileftpanel">
-                	<div class="inside_contentpanel" style="width:930px;">
-                    	<div class="api_titlebox">
-                        	<div class="api_titlebox_left">
-				<xsl:for-each select="command/command">
-                           		<!-- Modify this line for the release version -->
-                           		<span>
-									Apache CloudStack v4.6.0 Domain Admin API Reference
-								</span>
-								<p></p>
-                                <h1><xsl:value-of select="name"/></h1>
-                                <p><xsl:value-of select="description"/></p>
-				</xsl:for-each>
-                            </div>
-
-                            
-                            <div class="api_titlebox_right">
-                            	<a class="api_backbutton" href="../TOC_Domain_Admin.html"></a>
-                            </div>
-                        </div>
-                    	<div class="api_tablepanel">     
-                         	<h2>Request parameters</h2>
-                        	<table class="apitable">
-                            	<tr class="hed">
-                                	<td style="width:200px;"><strong>Parameter Name</strong></td>
-
-                                    <td style="width:500px;">Description</td>
-                                    <td style="width:180px;">Required</td>
-                                </tr>
-				<xsl:for-each select="command/command/request/arg">
-                                <tr>
-				    <xsl:if test="required='true'">
-                                    <td style="width:200px;"><strong><xsl:value-of select="name"/></strong></td>
-				    <td style="width:500px;"><strong><xsl:value-of select="description"/></strong></td>
-                                    <td style="width:180px;"><strong><xsl:value-of select="required"/></strong></td>
-				    </xsl:if>
-				    <xsl:if test="required='false'">
-                			<td style="width:200px;"><i><xsl:value-of select="name"/></i></td>
-                                    <td style="width:500px;"><i><xsl:value-of select="description"/></i></td>
-                                    <td style="width:180px;"><i><xsl:value-of select="required"/></i></td>
-				    </xsl:if>
-                                </tr>
-				</xsl:for-each>
-                            </table>
-                        </div>
-                         
-                         
-                         <div class="api_tablepanel">     
-                         	<h2>Response Tags</h2>
-                        	<table class="apitable">
-                            	<tr class="hed">
-                                	<td style="width:200px;"><strong>Response Name</strong></td>
-                                    <td style="width:500px;">Description</td>
-                                </tr>
-                                
-				<xsl:for-each select="command/command/response/arg">
-                                <tr>
-					<td style="width:200px;"><strong><xsl:value-of select="name"/></strong></td>
-                                    <td style="width:500px;"><xsl:value-of select="description"/></td>
-					<xsl:for-each select="./arguments/arg">
-					<tr>
-					<td style="width:180px; padding-left:25px;"><strong><xsl:value-of select="name"/></strong></td>
-                                    	<td style="width:500px;"><xsl:value-of select="description"/></td>
-					</tr>
-						<xsl:for-each select="./arguments/arg">
-						<tr>
-						<td style="width:165px; padding-left:40px;"><xsl:value-of select="name"/></td>
-		                            	<td style="width:500px;"><xsl:value-of select="description"/></td>
-						</tr>
-					</xsl:for-each>					
-					</xsl:for-each>					
-                                </tr>
-				</xsl:for-each>
-                                
-                         
-                                
-                              
-                            
-                            </table>
-
-                        </div>
-                        
-                        
-                </div> 
-                </div>
-                  
-     
-            </div>
-        </div>
-<div id="footer">
-        	<div id="footer_mainmaster">
-                <p>Copyright � 2015 The Apache Software Foundation, Licensed under the
-                   <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0.</a> <br />
-                Apache, CloudStack, Apache CloudStack, the Apache CloudStack logo, the CloudMonkey logo  and the Apache feather logo are trademarks of The Apache Software Foundation.</p>
-            </div>
-        </div>
-
-  </div>
- </div>
-</body>
-</html>
-</xsl:template>
-</xsl:stylesheet>
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/afcbd270/tools/apidoc/generatetoc.xsl
----------------------------------------------------------------------
diff --git a/tools/apidoc/generatetoc.xsl b/tools/apidoc/generatetoc.xsl
index 2cd1b00..687e626 100644
--- a/tools/apidoc/generatetoc.xsl
+++ b/tools/apidoc/generatetoc.xsl
@@ -25,7 +25,7 @@ version="1.0">
 <body>
 <table border="1" cellpadding="1" cellspacing="0.5">
 <tr>
-<h1 ALIGN='CENTER'>Cloudstack API Version 4.6.0</h1>
+<h1 ALIGN='CENTER'>Cloudstack API Version 4.9.0</h1>
 <br/>
 <h2 ALIGN='CENTER'>Table of Contents</h2>
 <th><h3>Name</h3></th>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/afcbd270/tools/apidoc/generatetoc_header.xsl
----------------------------------------------------------------------
diff --git a/tools/apidoc/generatetoc_header.xsl b/tools/apidoc/generatetoc_header.xsl
index f760430..6362ab8 100644
--- a/tools/apidoc/generatetoc_header.xsl
+++ b/tools/apidoc/generatetoc_header.xsl
@@ -52,7 +52,7 @@ version="1.0">
                 <div class="inside_apileftpanel">
                 	<div class="inside_contentpanel" style="width:930px;">
               		  	<!-- Modify this line for the release version -->
-                    	<h1>Apache CloudStack API Documentation (v4.6.0)</h1>
+                      <h1>Apache CloudStack API Documentation (v4.9.0)</h1>
                       <a class="api_backbutton" href="http://cloudstack.apache.org/docs/api/"></a>
                         <div class="apiannouncement_box">
                         	<div class="apiannouncement_contentarea">

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/afcbd270/tools/apidoc/generateusercommands.xsl
----------------------------------------------------------------------
diff --git a/tools/apidoc/generateusercommands.xsl b/tools/apidoc/generateusercommands.xsl
deleted file mode 100644
index c9ec857..0000000
--- a/tools/apidoc/generateusercommands.xsl
+++ /dev/null
@@ -1,157 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-version="1.0">
-<xsl:output method="html" doctype-public="-//W3C//DTD HTML 1.0 Transitional//EN"/>
-<xsl:template match="/">
-<html xmlns="http://www.w3.org/1999/xhtml"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel= "stylesheet" href="../includes/main.css" type="text/css" />
-<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
-
-<title>Apache CloudStack | The Power Behind Your Cloud</title>
-</head>
-
-<body>
-<div id="insidetopbg">
-<div id="inside_wrapper">
-	<div class="uppermenu_panel">
-            <div class="uppermenu_box"></div>
-        </div>
-        
-        <div id="main_master">
-            <div id="inside_header">
-
-                <div class="header_top">
-                    <a class="cloud_logo" href="http://cloudstack.org"></a>
-                    <div class="mainemenu_panel">
-                        
-                    </div>
-                </div>
-            
-            </div>
-
-            <div id="main_content">
-             	
-                <div class="inside_apileftpanel">
-                	<div class="inside_contentpanel" style="width:930px;">
-                    	<div class="api_titlebox">
-                        	<div class="api_titlebox_left">
-				<xsl:for-each select="command/command">
-                           		<!-- Modify this line for the release version -->
-                           		<span>
-									Apache CloudStack v4.6.0 User API Reference
-								</span>
-								<p></p>
-                                <h1><xsl:value-of select="name"/></h1>
-                                <p><xsl:value-of select="description"/></p>
-				</xsl:for-each>
-                            </div>
-
-                            
-                            <div class="api_titlebox_right">
-                            	<a class="api_backbutton" href="../TOC_User.html"></a>
-                            </div>
-                        </div>
-                    	<div class="api_tablepanel">     
-                         	<h2>Request parameters</h2>
-                        	<table class="apitable">
-                            	<tr class="hed">
-                                	<td style="width:200px;"><strong>Parameter Name</strong></td>
-
-                                    <td style="width:500px;">Description</td>
-                                    <td style="width:180px;">Required</td>
-                                </tr>
-				<xsl:for-each select="command/command/request/arg">
-                                <tr>
-				    <xsl:if test="required='true'">
-                                    <td style="width:200px;"><strong><xsl:value-of select="name"/></strong></td>
-				    <td style="width:500px;"><strong><xsl:value-of select="description"/></strong></td>
-                                    <td style="width:180px;"><strong><xsl:value-of select="required"/></strong></td>
-				    </xsl:if>
-				    <xsl:if test="required='false'">
-                			<td style="width:200px;"><i><xsl:value-of select="name"/></i></td>
-                                    <td style="width:500px;"><i><xsl:value-of select="description"/></i></td>
-                                    <td style="width:180px;"><i><xsl:value-of select="required"/></i></td>
-				    </xsl:if>
-                                </tr>
-				</xsl:for-each>
-                            </table>
-                        </div>
-                         
-                         
-                         <div class="api_tablepanel">     
-                         	<h2>Response Tags</h2>
-                        	<table class="apitable">
-                            	<tr class="hed">
-                                	<td style="width:200px;"><strong>Response Name</strong></td>
-                                    <td style="width:500px;">Description</td>
-                                </tr>
-                                
-				<xsl:for-each select="command/command/response/arg">
-                                <tr>
-					<td style="width:200px;"><strong><xsl:value-of select="name"/></strong></td>
-                                    <td style="width:500px;"><xsl:value-of select="description"/></td>
-					<xsl:for-each select="./arguments/arg">
-					<tr>
-					<td style="width:180px; padding-left:25px;"><strong><xsl:value-of select="name"/></strong></td>
-                                    	<td style="width:500px;"><xsl:value-of select="description"/></td>
-					</tr>
-						<xsl:for-each select="./arguments/arg">
-						<tr>
-						<td style="width:165px; padding-left:40px;"><xsl:value-of select="name"/></td>
-		                            	<td style="width:500px;"><xsl:value-of select="description"/></td>
-						</tr>
-					</xsl:for-each>					
-					</xsl:for-each>					
-                                </tr>
-				</xsl:for-each>
-                                
-                         
-                                
-                              
-                            
-                            </table>
-
-                        </div>
-                        
-                        
-                </div> 
-                </div>
-                  
-     
-            </div>
-        </div>
-<div id="footer">
-
-        	<div id="footer_mainmaster">
-                <p>Copyright � 2015 The Apache Software Foundation, Licensed under the
-                   <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0.</a> <br />
-                Apache, CloudStack, Apache CloudStack, the Apache CloudStack logo, the CloudMonkey logo  and the Apache feather logo are trademarks of The Apache Software Foundation.</p>
-            </div>
-        </div>
-
-  </div>
- </div>
-</body>
-</html>
-</xsl:template>
-</xsl:stylesheet>
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/afcbd270/tools/apidoc/pom.xml
----------------------------------------------------------------------
diff --git a/tools/apidoc/pom.xml b/tools/apidoc/pom.xml
index 75cb165..63af063 100644
--- a/tools/apidoc/pom.xml
+++ b/tools/apidoc/pom.xml
@@ -61,8 +61,6 @@
                                 <argument>${client.config.jars}</argument>
                                 <argument>${client.config.jars}</argument>
                                 <argument>./target</argument>
-                                <argument>-f</argument>
-                                <argument>${client.config.conf}/commands.properties</argument>
                             </arguments>
                         </configuration>
                     </execution>


[17/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
CLOUDSTACK-8818: Use MySQL native connector with Python

MySQLdb has been deprecated and is also not supported in Python 3.

mysql.connector is a connector written in Python which talks the
native MySQL protocol without any external code.

https://dev.mysql.com/doc/connector-python/en/


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 92e3ba2053a6785c8e9c029f5a4f267a592ed380
Parents: 6d0c92b
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Tue Nov 10 09:04:48 2015 +0100
Committer: Wido den Hollander <wi...@widodh.nl>
Committed: Wed May 4 23:28:52 2016 +0200

----------------------------------------------------------------------
 .../bindir/cloud-update-xenserver-licenses.in   |  4 +-
 debian/control                                  |  4 +-
 packaging/centos63/cloud.spec                   |  4 +-
 packaging/centos7/cloud.spec                    |  4 +-
 packaging/fedora20/cloud.spec                   |  4 +-
 packaging/fedora21/cloud.spec                   |  4 +-
 python/lib/cloudutils/db.py                     | 45 ++++++++++----------
 setup/bindir/cloud-migrate-databases.in         |  8 ++--
 8 files changed, 38 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92e3ba20/client/bindir/cloud-update-xenserver-licenses.in
----------------------------------------------------------------------
diff --git a/client/bindir/cloud-update-xenserver-licenses.in b/client/bindir/cloud-update-xenserver-licenses.in
index c64bc8f..9db5078 100755
--- a/client/bindir/cloud-update-xenserver-licenses.in
+++ b/client/bindir/cloud-update-xenserver-licenses.in
@@ -24,7 +24,7 @@ import glob
 from random import choice
 import string
 from optparse import OptionParser
-import MySQLdb
+import mysql.connector
 import paramiko
 from threading import Thread
 
@@ -59,7 +59,7 @@ parser.add_option("-a", "--all", action="store_true", dest="all", default=False,
 def e(msg): parser.error(msg)
 
 def getknownhosts(host,username,password):
-	conn = MySQLdb.connect(host=host,user=username,passwd=password)
+	conn = mysql.connector.connect(host=host, user=username, password=password)
 	cur = conn.cursor()
 	cur.execute("SELECT h.private_ip_address,d.value FROM cloud.host h inner join cloud.host_details d on (h.id = d.host_id) where d.name = 'username' and setup = 1")
 	usernames = dict(cur.fetchall())

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92e3ba20/debian/control
----------------------------------------------------------------------
diff --git a/debian/control b/debian/control
index 6c101ce..05058a8 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: libs
 Priority: extra
 Maintainer: Wido den Hollander <wi...@widodh.nl>
 Build-Depends: debhelper (>= 9), openjdk-8-jdk | openjdk-7-jdk, genisoimage,
- python-mysqldb, maven (>= 3) | maven3, python (>= 2.7)
+ python-mysql.connector, maven (>= 3) | maven3, python (>= 2.7)
 Standards-Version: 3.8.1
 Homepage: http://www.cloudstack.org/
 
@@ -15,7 +15,7 @@ Description: A common package which contains files which are shared by several C
 
 Package: cloudstack-management
 Architecture: all
-Depends: ${misc:Depends}, ${python:Depends}, cloudstack-common (= ${source:Version}), tomcat6, sudo, jsvc, python-mysqldb, libmysql-java, augeas-tools, mysql-client, adduser, bzip2
+Depends: ${misc:Depends}, ${python:Depends}, cloudstack-common (= ${source:Version}), tomcat6, sudo, jsvc, python-mysql.connector, libmysql-java, augeas-tools, mysql-client, adduser, bzip2
 Conflicts: cloud-server, cloud-client, cloud-client-ui
 Description: CloudStack server library
  The CloudStack management server

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92e3ba20/packaging/centos63/cloud.spec
----------------------------------------------------------------------
diff --git a/packaging/centos63/cloud.spec b/packaging/centos63/cloud.spec
index b000bd1..99e37a3 100644
--- a/packaging/centos63/cloud.spec
+++ b/packaging/centos63/cloud.spec
@@ -50,7 +50,7 @@ BuildRequires: jpackage-utils
 BuildRequires: gcc
 BuildRequires: glibc-devel
 BuildRequires: /usr/bin/mkisofs
-BuildRequires: MySQL-python
+BuildRequires: mysql-connector-python
 #BuildRequires: maven => 3.0.0
 
 %description
@@ -79,7 +79,7 @@ Requires: /sbin/service
 Requires: /sbin/chkconfig
 Requires: /usr/bin/ssh-keygen
 Requires: mkisofs
-Requires: MySQL-python
+Requires: mysql-connector-python
 Requires: python-paramiko
 Requires: ipmitool
 Requires: %{name}-common = %{_ver}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92e3ba20/packaging/centos7/cloud.spec
----------------------------------------------------------------------
diff --git a/packaging/centos7/cloud.spec b/packaging/centos7/cloud.spec
index e94ef65..ae26c05 100644
--- a/packaging/centos7/cloud.spec
+++ b/packaging/centos7/cloud.spec
@@ -50,7 +50,7 @@ BuildRequires: jpackage-utils
 BuildRequires: gcc
 BuildRequires: glibc-devel
 BuildRequires: /usr/bin/mkisofs
-BuildRequires: MySQL-python
+BuildRequires: mysql-connector-python
 BuildRequires: maven => 3.0.0
 
 %description
@@ -79,7 +79,7 @@ Requires: /sbin/service
 Requires: /sbin/chkconfig
 Requires: /usr/bin/ssh-keygen
 Requires: mkisofs
-Requires: MySQL-python
+Requires: mysql-connector-python
 Requires: ipmitool
 Requires: %{name}-common = %{_ver}
 Requires: iptables-services

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92e3ba20/packaging/fedora20/cloud.spec
----------------------------------------------------------------------
diff --git a/packaging/fedora20/cloud.spec b/packaging/fedora20/cloud.spec
index 93cf186..704e4f7 100644
--- a/packaging/fedora20/cloud.spec
+++ b/packaging/fedora20/cloud.spec
@@ -50,7 +50,7 @@ BuildRequires: jpackage-utils
 BuildRequires: gcc
 BuildRequires: glibc-devel
 BuildRequires: /usr/bin/mkisofs
-BuildRequires: MySQL-python
+BuildRequires: mysql-connector-python
 #BuildRequires: maven => 3.0.0
 
 %description
@@ -79,7 +79,7 @@ Requires: /sbin/service
 Requires: /sbin/chkconfig
 Requires: /usr/bin/ssh-keygen
 Requires: mkisofs
-Requires: MySQL-python
+Requires: mysql-connector-python
 Requires: python-paramiko
 Requires: ipmitool
 Requires: %{name}-common = %{_ver}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92e3ba20/packaging/fedora21/cloud.spec
----------------------------------------------------------------------
diff --git a/packaging/fedora21/cloud.spec b/packaging/fedora21/cloud.spec
index e089b12..2314ef2 100644
--- a/packaging/fedora21/cloud.spec
+++ b/packaging/fedora21/cloud.spec
@@ -50,7 +50,7 @@ BuildRequires: jpackage-utils
 BuildRequires: gcc
 BuildRequires: glibc-devel
 BuildRequires: /usr/bin/mkisofs
-BuildRequires: MySQL-python
+BuildRequires: mysql-connector-python
 #BuildRequires: maven => 3.0.0
 
 %description
@@ -79,7 +79,7 @@ Requires: /sbin/service
 Requires: /sbin/chkconfig
 Requires: /usr/bin/ssh-keygen
 Requires: mkisofs
-Requires: MySQL-python
+Requires: mysql-connector-python
 Requires: python-paramiko
 Requires: ipmitool
 Requires: %{name}-common = %{_ver}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92e3ba20/python/lib/cloudutils/db.py
----------------------------------------------------------------------
diff --git a/python/lib/cloudutils/db.py b/python/lib/cloudutils/db.py
index 8fe3195..f2ce6f9 100644
--- a/python/lib/cloudutils/db.py
+++ b/python/lib/cloudutils/db.py
@@ -5,21 +5,21 @@
 # to you under the Apache License, Version 2.0 (the
 # "License"); you may not use this file except in compliance
 # with the License.  You may obtain a copy of the License at
-# 
+#
 #   http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing,
 # software distributed under the License is distributed on an
 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-import MySQLdb
 import os
 from utilities import bash
 from cloudException import CloudRuntimeException
-import sys
-class Database:
+import mysql.connector
+
+class Database(object):
     """Database connection"""
     def __init__(self, username, password=None, host='localhost', port='3306', db="cloud"):
         self.host = host
@@ -28,15 +28,16 @@ class Database:
         self.port = port
         self.db = db
 
+    def connect(self):
+        return mysql.connector.connect(host=self.host,
+                                       user=self.username,
+                                       password=self.password,
+                                       database=self.db)
+
     def execute(self, statement):
         txn = None
         try:
-            if self.password is not None:
-                txn = MySQLdb.Connect(host=self.host, user=self.username,
-                                 passwd=self.password, db=self.db)
-            else:
-                txn = MySQLdb.Connect(host=self.host, user=self.username,
-                                 db=self.db)
+            txn = self.connect()
             cursor = txn.cursor()
             cursor.execute(statement)
             cursor.close()
@@ -47,35 +48,33 @@ class Database:
                 except:
                     pass
         except:
+            raise CloudRuntimeException("Failed to execute: %s " % statement)
+        finally:
             if txn is not None:
                 try:
                     txn.close()
                 except:
                     pass
-            raise CloudRuntimeException("Failed to execute:%s"%statement)
-        
+
     def testConnection(self):
         try:
-            if self.password is not None:
-                db = MySQLdb.Connect(host=self.host, user=self.username,
-                                 passwd=self.password, db=self.db)
-            else:
-                db = MySQLdb.Connect(host=self.host, user=self.username,
-                                  db=self.db)
+            conn = self.connect()
+            conn.ping()
+            conn.close()
             return True
         except:
             raise CloudRuntimeException("Failed to Connect to DB")
-        
+
     def executeFromFile(self, file):
         if not os.path.exists(file):
             return False
-        
+
         cmdLine = "mysql --host=" + self.host + " --port=" + str(self.port) + " --user=" + self.username
         if self.password is not None:
             cmdLine += " --password=" + self.password
-        
+
         cmdLine += " < " + file
-        
+
         try:
             bash(cmdLine)
         except:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92e3ba20/setup/bindir/cloud-migrate-databases.in
----------------------------------------------------------------------
diff --git a/setup/bindir/cloud-migrate-databases.in b/setup/bindir/cloud-migrate-databases.in
index 58a02d5..513e60b 100644
--- a/setup/bindir/cloud-migrate-databases.in
+++ b/setup/bindir/cloud-migrate-databases.in
@@ -20,7 +20,7 @@
 
 import os,logging,sys
 from optparse import OptionParser
-import MySQLdb
+import mysql.connector
 import subprocess
 import glob
 
@@ -72,10 +72,10 @@ class CloudContext(cloud_utils.MigrationContext):
 		self.database = database
 		self.configdir = configdir
 		self.resourcedir = resourcedir
-		self.conn = MySQLdb.connect(host=self.host,
+		self.conn = mysql.connector.connect(host=self.host,
 			user=self.username,
-			passwd=self.password,
-			db=self.database,
+			password=self.password,
+			database=self.database,
 			port=self.port)
 		self.conn.autocommit(False)
 		self.db = self.conn.cursor()


[12/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge release branch 4.8 to master

* 4.8:
  Update L10N resource files with 4.7 strings from Transifex (20160502) Force "translator" mode with the transifex client.


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 6d0c92be7257afcf5f1a9f4453e3470e0083125d
Parents: 62d2954 38c9e9f
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 4 10:48:18 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 4 10:48:18 2016 -0400

----------------------------------------------------------------------
 .../classes/resources/messages_de_DE.properties |    1 +
 .../classes/resources/messages_es.properties    | 1075 +++++++++++++++++-
 .../classes/resources/messages_fr_FR.properties |    3 +-
 .../classes/resources/messages_hu.properties    |   21 +-
 .../classes/resources/messages_it_IT.properties |    1 -
 .../classes/resources/messages_ja_JP.properties |    3 +-
 .../classes/resources/messages_ko_KR.properties |    1 -
 .../classes/resources/messages_nb_NO.properties |    3 +-
 .../classes/resources/messages_nl_NL.properties |    1 -
 .../classes/resources/messages_pt_BR.properties |    3 +-
 .../classes/resources/messages_ru_RU.properties |    1 -
 .../classes/resources/messages_zh_CN.properties |    1 -
 tools/transifex/sync-transifex-ui.sh            |    2 +-
 13 files changed, 1087 insertions(+), 29 deletions(-)
----------------------------------------------------------------------



[43/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1477 from remibergsma/47_default_zone_name_s3

When no zone name is available display a defaultWhen a zone name is available, the previous behaviour is still there:
![screen shot 2016-03-30 at 21 00 44](https://cloud.githubusercontent.com/assets/1630096/14154026/ba41a4bc-f6ba-11e5-9f88-19cf36bfbd4f.png)

When there is no zone name, it used to display an empty name (where you had to click on to see details):
![screen shot 2016-03-30 at 21 03 06](https://cloud.githubusercontent.com/assets/1630096/14154048/d31a7b08-f6ba-11e5-9f67-f716e8d9fbf2.png)

With this change, a default name `All` is displayed (because this happens when S3 storage is used that is region wide aka all zones):
![screen shot 2016-03-30 at 20 53 50](https://cloud.githubusercontent.com/assets/1630096/14154060/e20d1d0a-f6ba-11e5-9b0a-1b5e502a2964.png)

Region wide S3:
![screen shot 2016-03-30 at 21 04 55](https://cloud.githubusercontent.com/assets/1630096/14154108/2222ff54-f6bb-11e5-845a-c22ddc745b98.png)

FYI: Screenshot shows 'All', later renamed to 'All Zones', see code.

* pr/1477:
  When no zone name is available display a default

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 5a79c2b6f50b6d6d3aa07aa437a48d303717fd9e
Parents: 86dfcb2 aead9f4
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 11 01:30:43 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 11 01:30:44 2016 -0400

----------------------------------------------------------------------
 ui/scripts/templates.js | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a79c2b6/ui/scripts/templates.js
----------------------------------------------------------------------


[18/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
CLOUDSTACK-9348: Optimize NioTest and NioConnection main loop

- Reduces SSL handshake timeout to 15s, previously this was only 10s in
  commit debfcdef788ce0d51be06db0ef10f6815f9b563b
- Adds an aggresive explicit wakeup to save the Nio main IO loop/handler from
  getting blocked
- Fix NioTest to fail/succeed in about 60s, previously this was 300s
- Due to aggresive wakeup usage, NioTest should complete in less than 5s on most
  systems. On virtualized environment this may slightly increase due to thread,
  CPU burst/scheduling delays.

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: ea22869593f68a3a34b12aeb23c2bb6c34efd365
Parents: 6d0c92b
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Thu May 5 23:19:33 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Thu May 5 23:19:33 2016 +0530

----------------------------------------------------------------------
 .../src/main/java/com/cloud/utils/nio/Link.java |  4 ++--
 .../java/com/cloud/utils/nio/NioConnection.java |  2 ++
 .../java/com/cloud/utils/testcase/NioTest.java  | 23 ++++++++++++--------
 3 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea228695/utils/src/main/java/com/cloud/utils/nio/Link.java
----------------------------------------------------------------------
diff --git a/utils/src/main/java/com/cloud/utils/nio/Link.java b/utils/src/main/java/com/cloud/utils/nio/Link.java
index f297d52..da2c0d5 100644
--- a/utils/src/main/java/com/cloud/utils/nio/Link.java
+++ b/utils/src/main/java/com/cloud/utils/nio/Link.java
@@ -596,8 +596,8 @@ public class Link {
         while (handshakeStatus != SSLEngineResult.HandshakeStatus.FINISHED
                 && handshakeStatus != SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING) {
             final long timeTaken = System.currentTimeMillis() - startTimeMills;
-            if (timeTaken > 60000L) {
-                s_logger.warn("SSL Handshake has taken more than 60s to connect to: " + socketChannel.getRemoteAddress() +
+            if (timeTaken > 15000L) {
+                s_logger.warn("SSL Handshake has taken more than 15s to connect to: " + socketChannel.getRemoteAddress() +
                         ". Please investigate this connection.");
                 return false;
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea228695/utils/src/main/java/com/cloud/utils/nio/NioConnection.java
----------------------------------------------------------------------
diff --git a/utils/src/main/java/com/cloud/utils/nio/NioConnection.java b/utils/src/main/java/com/cloud/utils/nio/NioConnection.java
index 6fdb473..749e552 100644
--- a/utils/src/main/java/com/cloud/utils/nio/NioConnection.java
+++ b/utils/src/main/java/com/cloud/utils/nio/NioConnection.java
@@ -171,6 +171,8 @@ public abstract class NioConnection implements Callable<Boolean> {
             } catch (final IOException e) {
                 s_logger.error("Agent will die due to this IOException!", e);
                 throw new NioConnectionException(e.getMessage(), e);
+            } finally {
+                _selector.wakeup();
             }
         }
         _isStartup = false;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea228695/utils/src/test/java/com/cloud/utils/testcase/NioTest.java
----------------------------------------------------------------------
diff --git a/utils/src/test/java/com/cloud/utils/testcase/NioTest.java b/utils/src/test/java/com/cloud/utils/testcase/NioTest.java
index 20c31e2..446b1e2 100644
--- a/utils/src/test/java/com/cloud/utils/testcase/NioTest.java
+++ b/utils/src/test/java/com/cloud/utils/testcase/NioTest.java
@@ -61,9 +61,9 @@ public class NioTest {
     private static final Logger LOGGER = Logger.getLogger(NioTest.class);
 
     // Test should fail in due time instead of looping forever
-    private static final int TESTTIMEOUT = 300000;
+    private static final int TESTTIMEOUT = 60000;
 
-    final private int totalTestCount = 5;
+    final private int totalTestCount = 4;
     private int completedTestCount = 0;
 
     private NioServer server;
@@ -71,7 +71,7 @@ public class NioTest {
     private List<NioClient> maliciousClients = new ArrayList<>();
 
     private ExecutorService clientExecutor = Executors.newFixedThreadPool(totalTestCount, new NamedThreadFactory("NioClientHandler"));;
-    private ExecutorService maliciousExecutor = Executors.newFixedThreadPool(5*totalTestCount, new NamedThreadFactory("MaliciousNioClientHandler"));;
+    private ExecutorService maliciousExecutor = Executors.newFixedThreadPool(totalTestCount, new NamedThreadFactory("MaliciousNioClientHandler"));;
 
     private Random randomGenerator = new Random();
     private byte[] testBytes;
@@ -105,12 +105,18 @@ public class NioTest {
             Assert.fail(e.getMessage());
         }
 
+        /**
+         * The malicious client(s) tries to block NioServer's main IO loop
+         * thread until SSL handshake timeout value (from Link class, 15s) after
+         * which the valid NioClient(s) get the opportunity to make connection(s)
+         */
+        for (int i = 0; i < totalTestCount; i++) {
+            final NioClient maliciousClient = new NioMaliciousClient("NioMaliciousTestClient-" + i, "127.0.0.1", server.getPort(), 1, new NioMaliciousTestClient());
+            maliciousClients.add(maliciousClient);
+            maliciousExecutor.submit(new ThreadedNioClient(maliciousClient));
+        }
+
         for (int i = 0; i < totalTestCount; i++) {
-            for (int j = 0; j < 4; j++) {
-                final NioClient maliciousClient = new NioMaliciousClient("NioMaliciousTestClient-" + i, "127.0.0.1", server.getPort(), 1, new NioMaliciousTestClient());
-                maliciousClients.add(maliciousClient);
-                maliciousExecutor.submit(new ThreadedNioClient(maliciousClient));
-            }
             final NioClient client = new NioClient("NioTestClient-" + i, "127.0.0.1", server.getPort(), 1, new NioTestClient());
             clients.add(client);
             clientExecutor.submit(new ThreadedNioClient(client));
@@ -286,7 +292,6 @@ public class NioTest {
                     LOGGER.info("Server: Received OTHER task");
                 }
             }
-
         }
     }
 }


[34/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #880 from SudharmaJain/cs-8901

CLOUDSTACK-8901: PrepareTemplate job thread hard-coded to max 8 threads The thread pool was hardcoded to use 8 threads,
com.cloud.template.TemplateManagerImpl.configure(String, Map<String, Object>):
_preloadExecutor = Executors.newFixedThreadPool(8, new NamedThreadFactory("Template-Preloader"));

Added the change to pick threadpool size from configuration.

* pr/880:
  CLOUDSTACK-8901: PrepareTemplate job thread hard-coded to max 8 threads

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 456680dbb2328e2ac613d9ea422351a06a412601
Parents: 10bcf29 93ce108
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 11 00:08:44 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 11 00:08:45 2016 -0400

----------------------------------------------------------------------
 .../src/com/cloud/template/TemplateManager.java               | 7 +++++++
 server/src/com/cloud/template/TemplateManagerImpl.java        | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[46/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1489 from shapeblue/dynamicroles-master

CLOUDSTACK-8562: Dynamic Role-Based API Checker for CloudStack### CLOUDSTACK-8562: DB-Backed Dynamic Role Based API Access Checker

This feature allows root administrators to define new roles and associate API
permissions to them.

A limited form of role-based access control for the CloudStack management server
API is provided through a properties file, commands.properties, embedded in the
WAR distribution. Therefore, customizing API permissions requires unpacking the
distribution and modifying this file consistently on all servers. The old system
also does not permit the specification of additional roles.

FS:
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Dynamic+Role+Based+API+Access+Checker+for+CloudStack

DB-Backed Dynamic Role Based API Access Checker for CloudStack brings following
changes, features and use-cases:
- Moves the API access definitions from commands.properties to the mgmt server DB
- Allows defining custom roles (such as a read-only ROOT admin) beyond the
  current set of four (4) roles
- All roles will resolve to one of the four known roles types (Admin, Resource
  Admin, Domain Admin and User) which maintains this association by requiring
  all new defined roles to specify a role type.
- Allows changes to roles and API permissions per role at runtime including additions or
  removal of roles and/or modifications of permissions, without the need
  of restarting management server(s)

Upgrade/installation notes:
- The feature will be enabled by default for new installations, existing
  deployments will continue to use the older static role based api access checker
  with an option to enable this feature
- During fresh installation or upgrade, the upgrade paths will add four default
  roles based on the four default role types
- For ease of migration, at the time of upgrade commands.properties will be used
  to add existing set of permissions to the default roles. cloud.account
  will have a new role_id column which will be populated based on default roles
  as well

Dynamic-roles migration tool: scripts/util/migrate-dynamicroles.py
- Allows admins to migrate to the dynamic role based checker at a future date
- Performs a harder one-way migrate and update
- Migrates rules from existing commands.properties file into db and deprecates it
- Enables an internal hidden switch to enable dynamic role based checker feature

* pr/1489:
  maven: Fix jstl version usage
  CLOUDSTACK-8562: Deprecate commands.properties
  CLOUDSTACK-8562: DB-Backed Dynamic Role Based API Access Checker
  CLOUDSTACK-9361: Centrally handle API validations

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: bee2bdc299844e081ef30ccc5de0c2e01b2a0581
Parents: dc5b529 003b97b
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 11 02:03:49 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 11 02:03:50 2016 -0400

----------------------------------------------------------------------
 .travis.yml                                     |   4 +-
 api/src/com/cloud/event/EventTypes.java         |  18 +
 api/src/com/cloud/user/Account.java             |   2 +
 api/src/com/cloud/user/AccountService.java      |   4 +-
 api/src/org/apache/cloudstack/acl/Role.java     |  27 +
 .../apache/cloudstack/acl/RolePermission.java   |  31 +
 .../org/apache/cloudstack/acl/RoleService.java  |  52 ++
 api/src/org/apache/cloudstack/acl/RoleType.java |  80 +-
 api/src/org/apache/cloudstack/acl/Rule.java     |  54 ++
 .../apache/cloudstack/api/ApiArgValidator.java  |  23 +
 .../org/apache/cloudstack/api/ApiConstants.java |   7 +
 api/src/org/apache/cloudstack/api/BaseCmd.java  |   7 +-
 .../org/apache/cloudstack/api/Parameter.java    |   2 +
 .../command/admin/account/CreateAccountCmd.java |  17 +-
 .../api/command/admin/acl/CreateRoleCmd.java    | 105 +++
 .../admin/acl/CreateRolePermissionCmd.java      | 124 +++
 .../api/command/admin/acl/DeleteRoleCmd.java    |  83 ++
 .../admin/acl/DeleteRolePermissionCmd.java      |  83 ++
 .../admin/acl/ListRolePermissionsCmd.java       | 106 +++
 .../api/command/admin/acl/ListRolesCmd.java     | 128 +++
 .../api/command/admin/acl/UpdateRoleCmd.java    | 108 +++
 .../admin/acl/UpdateRolePermissionCmd.java      | 104 +++
 .../api/command/admin/config/UpdateCfgCmd.java  |  12 +
 .../user/config/ListCapabilitiesCmd.java        |   1 +
 .../api/response/AccountResponse.java           |  27 +
 .../api/response/CapabilitiesResponse.java      |   8 +
 .../api/response/RolePermissionResponse.java    | 101 +++
 .../cloudstack/api/response/RoleResponse.java   |  63 ++
 .../cloudstack/api/response/UserResponse.java   |  27 +
 .../org/apache/cloudstack/acl/RoleTypeTest.java | 100 ++
 .../org/apache/cloudstack/acl/RuleTest.java     |  98 ++
 .../admin/account/CreateAccountCmdTest.java     |  10 +-
 .../api/command/test/UpdateCfgCmdTest.java      |  28 +-
 .../classes/resources/messages.properties       |   8 +
 client/pom.xml                                  |   5 +
 client/tomcatconf/commands.properties.in        | 801 ----------------
 debian/cloudstack-management.install            |   1 -
 debian/control                                  |   2 +-
 developer/developer-prefill.sql                 |   5 +
 .../spring-engine-schema-core-daos-context.xml  |   2 +
 .../com/cloud/upgrade/dao/Upgrade481to490.java  |  75 +-
 engine/schema/src/com/cloud/user/AccountVO.java |  31 +-
 .../src/com/cloud/user/dao/AccountDao.java      |   2 +
 .../src/com/cloud/user/dao/AccountDaoImpl.java  |  19 +-
 .../apache/cloudstack/acl/RolePermissionVO.java | 120 +++
 .../src/org/apache/cloudstack/acl/RoleVO.java   | 106 +++
 .../org/apache/cloudstack/acl/dao/RoleDao.java  |  29 +
 .../apache/cloudstack/acl/dao/RoleDaoImpl.java  |  61 ++
 .../cloudstack/acl/dao/RolePermissionsDao.java  |  49 +
 .../acl/dao/RolePermissionsDaoImpl.java         | 166 ++++
 plugins/acl/dynamic-role-based/pom.xml          |  32 +
 .../acl-dynamic-role-based/module.properties    |  18 +
 .../spring-acl-dynamic-role-based-context.xml   |  33 +
 .../acl/DynamicRoleBasedAPIAccessChecker.java   | 144 +++
 .../DynamicRoleBasedAPIAccessCheckerTest.java   | 164 ++++
 .../acl/StaticRoleBasedAPIAccessChecker.java    |  48 +-
 .../api/command/user/discovery/ListApisCmd.java |   3 +-
 .../manager/BaremetalVlanManagerImpl.java       |  27 +-
 .../contrail/management/MockAccountManager.java |   8 +-
 plugins/pom.xml                                 |   1 +
 .../api/command/LdapCreateAccountCmd.java       |  41 +-
 .../api/command/LdapImportUsersCmd.java         |  20 +-
 .../api/command/LinkDomainToLdapCmd.java        |   3 +-
 .../cloudstack/ldap/LdapAuthenticator.java      |   4 +-
 .../ldap/LdapImportUsersCmdSpec.groovy          |   2 +-
 pom.xml                                         |   3 +-
 scripts/installer/windows/client.wxs            |   3 -
 scripts/util/migrate-dynamicroles.py            | 136 +++
 server/pom.xml                                  |   7 +-
 .../spring-server-core-managers-context.xml     |   2 +
 server/src/com/cloud/api/ApiDBUtils.java        |  27 +-
 .../com/cloud/api/ApiResponseGsonHelper.java    |   2 +-
 server/src/com/cloud/api/ApiServer.java         |   8 +-
 .../cloud/api/dispatch/ParamProcessWorker.java  |  54 ++
 .../src/com/cloud/api/doc/ApiXmlDocWriter.java  | 120 +--
 .../com/cloud/api/query/vo/AccountJoinVO.java   |   7 +
 .../cloud/api/query/vo/UserAccountJoinVO.java   |   7 +
 .../api/response/ApiResponseSerializer.java     |   2 +-
 .../com/cloud/projects/ProjectManagerImpl.java  |   2 +-
 .../cloud/server/ConfigurationServerImpl.java   |   6 +-
 server/src/com/cloud/user/AccountManager.java   |   2 +-
 .../src/com/cloud/user/AccountManagerImpl.java  |  37 +-
 .../apache/cloudstack/acl/RoleManagerImpl.java  | 264 ++++++
 .../com/cloud/user/MockAccountManagerImpl.java  |   6 +-
 .../iam/RoleBasedAPIAccessChecker.java          |   2 +-
 .../db/db/create-default-role-api-mappings.sql  | 902 +++++++++++++++++++
 setup/db/db/schema-481to490-cleanup.sql         | 188 ++++
 setup/db/db/schema-481to490.sql                 |  35 +
 setup/db/server-setup.sql                       |   3 +-
 setup/db/server-setup.xml                       |   7 +
 test/integration/smoke/test_dynamicroles.py     | 537 +++++++++++
 test/integration/smoke/test_staticroles.py      | 134 +++
 tools/apidoc/XmlToHtmlConverter.java            |  64 +-
 tools/apidoc/build-apidoc.sh                    |  15 +-
 tools/apidoc/gen_toc.py                         |  32 +-
 tools/apidoc/generateadmincommands.xsl          | 164 ----
 tools/apidoc/generatecommands.xsl               | 163 ++++
 tools/apidoc/generatedomainadmincommands.xsl    | 159 ----
 tools/apidoc/generatetoc.xsl                    |   2 +-
 tools/apidoc/generatetoc_header.xsl             |   2 +-
 tools/apidoc/generateusercommands.xsl           | 157 ----
 tools/apidoc/pom.xml                            |   2 -
 tools/marvin/marvin/cloudstackConnection.py     |   2 +-
 tools/marvin/marvin/lib/base.py                 |  89 +-
 ui/css/cloudstack3.css                          |  16 +
 ui/dictionary.jsp                               |   7 +
 ui/dictionary2.jsp                              |   1 +
 ui/images/icons.png                             | Bin 61164 -> 48358 bytes
 ui/index.jsp                                    |   1 +
 ui/plugins/quota/quota.js                       |  16 +-
 ui/scripts/accounts.js                          |  31 +-
 ui/scripts/accountsWizard.js                    |  38 +-
 ui/scripts/cloudStack.js                        |   3 +-
 ui/scripts/roles.js                             | 388 ++++++++
 ui/scripts/sharedFunctions.js                   |  11 +
 .../main/java/com/cloud/utils/ListUtils.java    |  31 +
 .../java/com/cloud/utils/PropertiesUtil.java    |   4 +
 117 files changed, 5913 insertions(+), 1662 deletions(-)
----------------------------------------------------------------------



[37/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/setup/db/db/create-default-role-api-mappings.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/create-default-role-api-mappings.sql b/setup/db/db/create-default-role-api-mappings.sql
new file mode 100644
index 0000000..57601fb
--- /dev/null
+++ b/setup/db/db/create-default-role-api-mappings.sql
@@ -0,0 +1,902 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements.  See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License.  You may obtain a copy of the License at
+--
+--   http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied.  See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+
+-- The default admin role (id:1) will be allowed all APIs so need to insert rules for admin role
+
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 1, '*', 'ALLOW', 0) ON DUPLICATE KEY UPDATE rule=rule;
+
+-- Insert default role-api mappings for rest of the default roles: resourceadmin(id:2), domainadmin(id:3), user(id:4)
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'activateProject', 'ALLOW', 0) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'addAccountToProject', 'ALLOW', 1) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'addHost', 'ALLOW', 2) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'addIpToNic', 'ALLOW', 3) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'addLdapConfiguration', 'ALLOW', 4) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'addNicToVirtualMachine', 'ALLOW', 5) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'addVpnUser', 'ALLOW', 6) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'archiveEvents', 'ALLOW', 7) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'assignCertToLoadBalancer', 'ALLOW', 8) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'assignToGlobalLoadBalancerRule', 'ALLOW', 9) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'assignToLoadBalancerRule', 'ALLOW', 10) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'assignVirtualMachine', 'ALLOW', 11) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'associateIpAddress', 'ALLOW', 12) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'associateLun', 'ALLOW', 13) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'attachIso', 'ALLOW', 14) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'attachVolume', 'ALLOW', 15) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'authorizeSamlSso', 'ALLOW', 16) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'authorizeSecurityGroupEgress', 'ALLOW', 17) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'authorizeSecurityGroupIngress', 'ALLOW', 18) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'changeServiceForRouter', 'ALLOW', 19) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'changeServiceForVirtualMachine', 'ALLOW', 20) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'configureInternalLoadBalancerElement', 'ALLOW', 21) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'configureOvsElement', 'ALLOW', 22) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'configureVirtualRouterElement', 'ALLOW', 23) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'copyIso', 'ALLOW', 24) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'copyTemplate', 'ALLOW', 25) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createAccount', 'ALLOW', 26) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createAffinityGroup', 'ALLOW', 27) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createAutoScalePolicy', 'ALLOW', 28) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createAutoScaleVmGroup', 'ALLOW', 29) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createAutoScaleVmProfile', 'ALLOW', 30) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createCondition', 'ALLOW', 31) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createDiskOffering', 'ALLOW', 32) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createEgressFirewallRule', 'ALLOW', 33) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createFirewallRule', 'ALLOW', 34) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createGlobalLoadBalancerRule', 'ALLOW', 35) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createInstanceGroup', 'ALLOW', 36) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createInternalLoadBalancerElement', 'ALLOW', 37) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createIpForwardingRule', 'ALLOW', 38) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createLBHealthCheckPolicy', 'ALLOW', 39) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createLBStickinessPolicy', 'ALLOW', 40) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createLoadBalancer', 'ALLOW', 41) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createLoadBalancerRule', 'ALLOW', 42) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createLunOnFiler', 'ALLOW', 43) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createNetwork', 'ALLOW', 44) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createNetworkACL', 'ALLOW', 45) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createNetworkACLList', 'ALLOW', 46) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createOvsElement', 'ALLOW', 47) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createPool', 'ALLOW', 48) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createPortForwardingRule', 'ALLOW', 49) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createProject', 'ALLOW', 50) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createRemoteAccessVpn', 'ALLOW', 51) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createSSHKeyPair', 'ALLOW', 52) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createSecurityGroup', 'ALLOW', 53) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createServiceOffering', 'ALLOW', 54) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createSnapshot', 'ALLOW', 55) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createSnapshotPolicy', 'ALLOW', 56) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createStaticRoute', 'ALLOW', 57) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createTags', 'ALLOW', 58) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createTemplate', 'ALLOW', 59) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createUser', 'ALLOW', 60) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createVMSnapshot', 'ALLOW', 61) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createVPC', 'ALLOW', 62) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createVirtualRouterElement', 'ALLOW', 63) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createVolume', 'ALLOW', 64) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createVolumeOnFiler', 'ALLOW', 65) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createVpnConnection', 'ALLOW', 66) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createVpnCustomerGateway', 'ALLOW', 67) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'createVpnGateway', 'ALLOW', 68) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteAccount', 'ALLOW', 69) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteAccountFromProject', 'ALLOW', 70) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteAffinityGroup', 'ALLOW', 71) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteAutoScalePolicy', 'ALLOW', 72) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteAutoScaleVmGroup', 'ALLOW', 73) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteAutoScaleVmProfile', 'ALLOW', 74) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteCondition', 'ALLOW', 75) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteDiskOffering', 'ALLOW', 76) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteEgressFirewallRule', 'ALLOW', 77) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteEvents', 'ALLOW', 78) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteFirewallRule', 'ALLOW', 79) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteGlobalLoadBalancerRule', 'ALLOW', 80) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteHost', 'ALLOW', 81) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteInstanceGroup', 'ALLOW', 82) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteIpForwardingRule', 'ALLOW', 83) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteIso', 'ALLOW', 84) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteLBHealthCheckPolicy', 'ALLOW', 85) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteLBStickinessPolicy', 'ALLOW', 86) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteLdapConfiguration', 'ALLOW', 87) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteLoadBalancer', 'ALLOW', 88) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteLoadBalancerRule', 'ALLOW', 89) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteNetwork', 'ALLOW', 90) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteNetworkACL', 'ALLOW', 91) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteNetworkACLList', 'ALLOW', 92) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deletePool', 'ALLOW', 93) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deletePortForwardingRule', 'ALLOW', 94) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteProject', 'ALLOW', 95) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteProjectInvitation', 'ALLOW', 96) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteRemoteAccessVpn', 'ALLOW', 97) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteSSHKeyPair', 'ALLOW', 98) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteSecurityGroup', 'ALLOW', 99) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteServiceOffering', 'ALLOW', 100) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteSnapshot', 'ALLOW', 101) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteSnapshotPolicies', 'ALLOW', 102) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteSslCert', 'ALLOW', 103) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteStaticRoute', 'ALLOW', 104) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteTags', 'ALLOW', 105) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteTemplate', 'ALLOW', 106) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteUser', 'ALLOW', 107) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteVMSnapshot', 'ALLOW', 108) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteVPC', 'ALLOW', 109) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteVolume', 'ALLOW', 110) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteVpnConnection', 'ALLOW', 111) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteVpnCustomerGateway', 'ALLOW', 112) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteVpnGateway', 'ALLOW', 113) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deployVirtualMachine', 'ALLOW', 114) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'destroyLunOnFiler', 'ALLOW', 115) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'destroyRouter', 'ALLOW', 116) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'destroyVirtualMachine', 'ALLOW', 117) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'destroyVolumeOnFiler', 'ALLOW', 118) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'detachIso', 'ALLOW', 119) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'detachVolume', 'ALLOW', 120) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'disableAccount', 'ALLOW', 121) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'disableAutoScaleVmGroup', 'ALLOW', 122) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'disableStaticNat', 'ALLOW', 123) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'disableUser', 'ALLOW', 124) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'disassociateIpAddress', 'ALLOW', 125) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'dissociateLun', 'ALLOW', 126) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'enableAccount', 'ALLOW', 127) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'enableAutoScaleVmGroup', 'ALLOW', 128) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'enableStaticNat', 'ALLOW', 129) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'enableUser', 'ALLOW', 130) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'expungeVirtualMachine', 'ALLOW', 131) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'extractIso', 'ALLOW', 132) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'extractTemplate', 'ALLOW', 133) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'extractVolume', 'ALLOW', 134) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getApiLimit', 'ALLOW', 135) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getCloudIdentifier', 'ALLOW', 136) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getSolidFireAccountId', 'ALLOW', 137) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getSolidFireVolumeAccessGroupId', 'ALLOW', 138) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getSolidFireVolumeIscsiName', 'ALLOW', 139) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getSolidFireVolumeSize', 'ALLOW', 140) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getUploadParamsForTemplate', 'ALLOW', 141) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getUploadParamsForVolume', 'ALLOW', 142) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getVMPassword', 'ALLOW', 143) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getVirtualMachineUserData', 'ALLOW', 144) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'importLdapUsers', 'ALLOW', 145) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'issueNuageVspResourceRequest', 'ALLOW', 146) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'ldapCreateAccount', 'ALLOW', 147) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'linkDomainToLdap', 'ALLOW', 148) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAccounts', 'ALLOW', 149) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAffinityGroupTypes', 'ALLOW', 150) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAffinityGroups', 'ALLOW', 151) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAlerts', 'ALLOW', 152) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listApis', 'ALLOW', 153) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAsyncJobs', 'ALLOW', 154) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAutoScalePolicies', 'ALLOW', 155) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAutoScaleVmGroups', 'ALLOW', 156) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAutoScaleVmProfiles', 'ALLOW', 157) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listCapabilities', 'ALLOW', 158) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listCapacity', 'ALLOW', 159) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listClusters', 'ALLOW', 160) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listConditions', 'ALLOW', 161) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listCounters', 'ALLOW', 162) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listDiskOfferings', 'ALLOW', 163) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listDomainChildren', 'ALLOW', 164) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listDomains', 'ALLOW', 165) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listEgressFirewallRules', 'ALLOW', 166) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listEventTypes', 'ALLOW', 167) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listEvents', 'ALLOW', 168) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listFirewallRules', 'ALLOW', 169) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listGlobalLoadBalancerRules', 'ALLOW', 170) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listHostTags', 'ALLOW', 171) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listHosts', 'ALLOW', 172) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listHypervisors', 'ALLOW', 173) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listInstanceGroups', 'ALLOW', 174) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listInternalLoadBalancerElements', 'ALLOW', 175) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listIpForwardingRules', 'ALLOW', 176) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listIsoPermissions', 'ALLOW', 177) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listIsos', 'ALLOW', 178) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listLBHealthCheckPolicies', 'ALLOW', 179) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listLBStickinessPolicies', 'ALLOW', 180) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listLdapConfigurations', 'ALLOW', 181) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listLdapUsers', 'ALLOW', 182) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listLoadBalancerRuleInstances', 'ALLOW', 183) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listLoadBalancerRules', 'ALLOW', 184) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listLoadBalancers', 'ALLOW', 185) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listLunsOnFiler', 'ALLOW', 186) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listNetworkACLLists', 'ALLOW', 187) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listNetworkACLs', 'ALLOW', 188) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listNetworkOfferings', 'ALLOW', 189) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listNetworks', 'ALLOW', 190) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listNics', 'ALLOW', 191) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listOsCategories', 'ALLOW', 192) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listOsTypes', 'ALLOW', 193) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listOvsElements', 'ALLOW', 194) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listPods', 'ALLOW', 195) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listPools', 'ALLOW', 196) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listPortForwardingRules', 'ALLOW', 197) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listPrivateGateways', 'ALLOW', 198) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listProjectAccounts', 'ALLOW', 199) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listProjectInvitations', 'ALLOW', 200) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listProjects', 'ALLOW', 201) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listPublicIpAddresses', 'ALLOW', 202) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listRegions', 'ALLOW', 203) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listRemoteAccessVpns', 'ALLOW', 204) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listResourceDetails', 'ALLOW', 205) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listResourceLimits', 'ALLOW', 206) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listRouters', 'ALLOW', 207) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listSSHKeyPairs', 'ALLOW', 208) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listSamlAuthorization', 'ALLOW', 209) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listSecurityGroups', 'ALLOW', 210) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listServiceOfferings', 'ALLOW', 211) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listSnapshotPolicies', 'ALLOW', 212) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listSnapshots', 'ALLOW', 213) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listSslCerts', 'ALLOW', 214) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listStaticRoutes', 'ALLOW', 215) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listStoragePools', 'ALLOW', 216) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listStorageProviders', 'ALLOW', 217) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listStorageTags', 'ALLOW', 218) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listSystemVms', 'ALLOW', 219) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listTags', 'ALLOW', 220) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listTemplatePermissions', 'ALLOW', 221) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listTemplates', 'ALLOW', 222) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listUsageRecords', 'ALLOW', 223) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listUsers', 'ALLOW', 224) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVMSnapshot', 'ALLOW', 225) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVPCOfferings', 'ALLOW', 226) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVPCs', 'ALLOW', 227) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVirtualMachines', 'ALLOW', 228) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVirtualRouterElements', 'ALLOW', 229) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVolumes', 'ALLOW', 230) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVolumesOnFiler', 'ALLOW', 231) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVpnConnections', 'ALLOW', 232) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVpnCustomerGateways', 'ALLOW', 233) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVpnGateways', 'ALLOW', 234) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listVpnUsers', 'ALLOW', 235) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listZones', 'ALLOW', 236) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'lockAccount', 'ALLOW', 237) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'lockUser', 'ALLOW', 238) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'migrateVolume', 'ALLOW', 239) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'modifyPool', 'ALLOW', 240) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'queryAsyncJobResult', 'ALLOW', 241) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'quotaBalance', 'ALLOW', 242) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'quotaIsEnabled', 'ALLOW', 243) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'quotaStatement', 'ALLOW', 244) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'quotaSummary', 'ALLOW', 245) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'quotaTariffList', 'ALLOW', 246) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'rebootRouter', 'ALLOW', 247) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'rebootVirtualMachine', 'ALLOW', 248) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'recoverVirtualMachine', 'ALLOW', 249) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'registerIso', 'ALLOW', 250) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'registerSSHKeyPair', 'ALLOW', 251) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'registerTemplate', 'ALLOW', 252) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'registerUserKeys', 'ALLOW', 253) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'removeCertFromLoadBalancer', 'ALLOW', 254) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'removeFromGlobalLoadBalancerRule', 'ALLOW', 255) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'removeFromLoadBalancerRule', 'ALLOW', 256) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'removeIpFromNic', 'ALLOW', 257) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'removeNicFromVirtualMachine', 'ALLOW', 258) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'removeVpnUser', 'ALLOW', 259) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'replaceNetworkACLList', 'ALLOW', 260) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'resetPasswordForVirtualMachine', 'ALLOW', 261) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'resetSSHKeyForVirtualMachine', 'ALLOW', 262) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'resetVpnConnection', 'ALLOW', 263) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'resizeVolume', 'ALLOW', 264) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'restartNetwork', 'ALLOW', 265) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'restartVPC', 'ALLOW', 266) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'restoreVirtualMachine', 'ALLOW', 267) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'revertSnapshot', 'ALLOW', 268) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'revertToVMSnapshot', 'ALLOW', 269) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'revokeSecurityGroupEgress', 'ALLOW', 270) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'revokeSecurityGroupIngress', 'ALLOW', 271) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'scaleVirtualMachine', 'ALLOW', 272) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'startRouter', 'ALLOW', 273) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'startVirtualMachine', 'ALLOW', 274) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'stopRouter', 'ALLOW', 275) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'stopVirtualMachine', 'ALLOW', 276) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'suspendProject', 'ALLOW', 277) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateAccount', 'ALLOW', 278) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateAutoScalePolicy', 'ALLOW', 279) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateAutoScaleVmGroup', 'ALLOW', 280) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateAutoScaleVmProfile', 'ALLOW', 281) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateDefaultNicForVirtualMachine', 'ALLOW', 282) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateDiskOffering', 'ALLOW', 283) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateEgressFirewallRule', 'ALLOW', 284) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateFirewallRule', 'ALLOW', 285) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateGlobalLoadBalancerRule', 'ALLOW', 286) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateInstanceGroup', 'ALLOW', 287) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateIpAddress', 'ALLOW', 288) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateIso', 'ALLOW', 289) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateIsoPermissions', 'ALLOW', 290) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateLBHealthCheckPolicy', 'ALLOW', 291) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateLBStickinessPolicy', 'ALLOW', 292) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateLoadBalancer', 'ALLOW', 293) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateLoadBalancerRule', 'ALLOW', 294) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateNetwork', 'ALLOW', 295) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateNetworkACLItem', 'ALLOW', 296) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateNetworkACLList', 'ALLOW', 297) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updatePortForwardingRule', 'ALLOW', 298) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateProject', 'ALLOW', 299) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateProjectInvitation', 'ALLOW', 300) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateRemoteAccessVpn', 'ALLOW', 301) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateResourceCount', 'ALLOW', 302) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateResourceLimit', 'ALLOW', 303) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateServiceOffering', 'ALLOW', 304) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateSnapshotPolicy', 'ALLOW', 305) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateTemplate', 'ALLOW', 306) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateTemplatePermissions', 'ALLOW', 307) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateUser', 'ALLOW', 308) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateVMAffinityGroup', 'ALLOW', 309) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateVPC', 'ALLOW', 310) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateVirtualMachine', 'ALLOW', 311) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateVmNicIp', 'ALLOW', 312) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateVpnConnection', 'ALLOW', 313) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateVpnCustomerGateway', 'ALLOW', 314) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'updateVpnGateway', 'ALLOW', 315) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'uploadSslCert', 'ALLOW', 316) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'uploadVolume', 'ALLOW', 317) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'activateProject', 'ALLOW', 0) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'addAccountToProject', 'ALLOW', 1) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'addIpToNic', 'ALLOW', 2) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'addNicToVirtualMachine', 'ALLOW', 3) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'addVpnUser', 'ALLOW', 4) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'archiveEvents', 'ALLOW', 5) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'assignCertToLoadBalancer', 'ALLOW', 6) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'assignToGlobalLoadBalancerRule', 'ALLOW', 7) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'assignToLoadBalancerRule', 'ALLOW', 8) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'assignVirtualMachine', 'ALLOW', 9) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'associateIpAddress', 'ALLOW', 10) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'associateLun', 'ALLOW', 11) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'attachIso', 'ALLOW', 12) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'attachVolume', 'ALLOW', 13) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'authorizeSamlSso', 'ALLOW', 14) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'authorizeSecurityGroupEgress', 'ALLOW', 15) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'authorizeSecurityGroupIngress', 'ALLOW', 16) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'changeServiceForRouter', 'ALLOW', 17) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'changeServiceForVirtualMachine', 'ALLOW', 18) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'configureInternalLoadBalancerElement', 'ALLOW', 19) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'configureOvsElement', 'ALLOW', 20) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'configureVirtualRouterElement', 'ALLOW', 21) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'copyIso', 'ALLOW', 22) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'copyTemplate', 'ALLOW', 23) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createAccount', 'ALLOW', 24) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createAffinityGroup', 'ALLOW', 25) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createAutoScalePolicy', 'ALLOW', 26) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createAutoScaleVmGroup', 'ALLOW', 27) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createAutoScaleVmProfile', 'ALLOW', 28) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createCondition', 'ALLOW', 29) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createDiskOffering', 'ALLOW', 30) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createEgressFirewallRule', 'ALLOW', 31) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createFirewallRule', 'ALLOW', 32) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createGlobalLoadBalancerRule', 'ALLOW', 33) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createInstanceGroup', 'ALLOW', 34) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createInternalLoadBalancerElement', 'ALLOW', 35) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createIpForwardingRule', 'ALLOW', 36) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createLBHealthCheckPolicy', 'ALLOW', 37) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createLBStickinessPolicy', 'ALLOW', 38) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createLoadBalancer', 'ALLOW', 39) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createLoadBalancerRule', 'ALLOW', 40) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createLunOnFiler', 'ALLOW', 41) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createNetwork', 'ALLOW', 42) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createNetworkACL', 'ALLOW', 43) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createNetworkACLList', 'ALLOW', 44) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createOvsElement', 'ALLOW', 45) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createPool', 'ALLOW', 46) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createPortForwardingRule', 'ALLOW', 47) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createProject', 'ALLOW', 48) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createRemoteAccessVpn', 'ALLOW', 49) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createSSHKeyPair', 'ALLOW', 50) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createSecurityGroup', 'ALLOW', 51) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createServiceOffering', 'ALLOW', 52) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createSnapshot', 'ALLOW', 53) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createSnapshotPolicy', 'ALLOW', 54) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createStaticRoute', 'ALLOW', 55) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createTags', 'ALLOW', 56) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createTemplate', 'ALLOW', 57) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createUser', 'ALLOW', 58) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createVMSnapshot', 'ALLOW', 59) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createVPC', 'ALLOW', 60) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createVirtualRouterElement', 'ALLOW', 61) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createVolume', 'ALLOW', 62) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createVolumeOnFiler', 'ALLOW', 63) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createVpnConnection', 'ALLOW', 64) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createVpnCustomerGateway', 'ALLOW', 65) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'createVpnGateway', 'ALLOW', 66) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteAccount', 'ALLOW', 67) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteAccountFromProject', 'ALLOW', 68) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteAffinityGroup', 'ALLOW', 69) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteAutoScalePolicy', 'ALLOW', 70) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteAutoScaleVmGroup', 'ALLOW', 71) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteAutoScaleVmProfile', 'ALLOW', 72) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteCondition', 'ALLOW', 73) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteDiskOffering', 'ALLOW', 74) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteEgressFirewallRule', 'ALLOW', 75) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteEvents', 'ALLOW', 76) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteFirewallRule', 'ALLOW', 77) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteGlobalLoadBalancerRule', 'ALLOW', 78) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteInstanceGroup', 'ALLOW', 79) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteIpForwardingRule', 'ALLOW', 80) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteIso', 'ALLOW', 81) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteLBHealthCheckPolicy', 'ALLOW', 82) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteLBStickinessPolicy', 'ALLOW', 83) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteLoadBalancer', 'ALLOW', 84) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteLoadBalancerRule', 'ALLOW', 85) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteNetwork', 'ALLOW', 86) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteNetworkACL', 'ALLOW', 87) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteNetworkACLList', 'ALLOW', 88) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deletePool', 'ALLOW', 89) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deletePortForwardingRule', 'ALLOW', 90) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteProject', 'ALLOW', 91) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteProjectInvitation', 'ALLOW', 92) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteRemoteAccessVpn', 'ALLOW', 93) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteSSHKeyPair', 'ALLOW', 94) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteSecurityGroup', 'ALLOW', 95) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteServiceOffering', 'ALLOW', 96) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteSnapshot', 'ALLOW', 97) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteSnapshotPolicies', 'ALLOW', 98) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteSslCert', 'ALLOW', 99) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteStaticRoute', 'ALLOW', 100) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteTags', 'ALLOW', 101) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteTemplate', 'ALLOW', 102) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteUser', 'ALLOW', 103) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteVMSnapshot', 'ALLOW', 104) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteVPC', 'ALLOW', 105) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteVolume', 'ALLOW', 106) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteVpnConnection', 'ALLOW', 107) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteVpnCustomerGateway', 'ALLOW', 108) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deleteVpnGateway', 'ALLOW', 109) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'deployVirtualMachine', 'ALLOW', 110) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'destroyLunOnFiler', 'ALLOW', 111) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'destroyRouter', 'ALLOW', 112) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'destroyVirtualMachine', 'ALLOW', 113) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'destroyVolumeOnFiler', 'ALLOW', 114) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'detachIso', 'ALLOW', 115) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'detachVolume', 'ALLOW', 116) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'disableAccount', 'ALLOW', 117) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'disableAutoScaleVmGroup', 'ALLOW', 118) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'disableStaticNat', 'ALLOW', 119) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'disableUser', 'ALLOW', 120) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'disassociateIpAddress', 'ALLOW', 121) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'dissociateLun', 'ALLOW', 122) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'enableAccount', 'ALLOW', 123) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'enableAutoScaleVmGroup', 'ALLOW', 124) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'enableStaticNat', 'ALLOW', 125) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'enableUser', 'ALLOW', 126) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'expungeVirtualMachine', 'ALLOW', 127) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'extractIso', 'ALLOW', 128) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'extractTemplate', 'ALLOW', 129) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'extractVolume', 'ALLOW', 130) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getApiLimit', 'ALLOW', 131) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getCloudIdentifier', 'ALLOW', 132) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getSolidFireAccountId', 'ALLOW', 133) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getSolidFireVolumeAccessGroupId', 'ALLOW', 134) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getSolidFireVolumeIscsiName', 'ALLOW', 135) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getSolidFireVolumeSize', 'ALLOW', 136) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getUploadParamsForTemplate', 'ALLOW', 137) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getUploadParamsForVolume', 'ALLOW', 138) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getVMPassword', 'ALLOW', 139) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getVirtualMachineUserData', 'ALLOW', 140) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'issueNuageVspResourceRequest', 'ALLOW', 141) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAccounts', 'ALLOW', 142) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAffinityGroupTypes', 'ALLOW', 143) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAffinityGroups', 'ALLOW', 144) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listApis', 'ALLOW', 145) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAsyncJobs', 'ALLOW', 146) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAutoScalePolicies', 'ALLOW', 147) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAutoScaleVmGroups', 'ALLOW', 148) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAutoScaleVmProfiles', 'ALLOW', 149) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listCapabilities', 'ALLOW', 150) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listConditions', 'ALLOW', 151) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listCounters', 'ALLOW', 152) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listDiskOfferings', 'ALLOW', 153) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listDomainChildren', 'ALLOW', 154) ON DUPLICATE KEY UPDATE rule=rule;
+INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listDomains', 'ALLOW', 155) ON DUPLICATE KEY UPDATE r

<TRUNCATED>

[27/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1497 from nvazquez/addidsparam

CLOUDSTACK-9351: Add ids parameter to resource listing API calls## General behaviour
A new parameter is added in each method, its type a list of IDs of the entity, it will be mutually exclusive with id. (Similar to <code>id</code> and <code>ids</code> parameters in <code>listVirtualMachines</code> method)

### API Methods affected
* <code>listTemplates</code>: new parameter **<code>ids</code>**, mutually exclusive with <code>id</code>
* <code>listVolumes</code>: new parameter **<code>ids</code>**, mutually exclusive with <code>id</code>
* <code>listSnapshots</code>: new parameter **<code>ids</code>**, mutually exclusive with <code>id</code>
* <code>listVMSnapshots</code>: new parameter **<code>vmsnapshotids</code>**, mutually exclusive with <code>vmsnapshotid</code>

* pr/1497:
  CLOUDSTACK-9351: Add marvin test and add it to travis file
  CLOUDSTACK-9351: Add ids parameter to resource listing API calls

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: de582a41c06691efe1d875362f4f81445acaa18c
Parents: fa3bce5 b9d75c6
Author: Will Stevens <wi...@gmail.com>
Authored: Tue May 10 23:49:55 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Tue May 10 23:49:55 2016 -0400

----------------------------------------------------------------------
 .travis.yml                                     |   2 +-
 .../org/apache/cloudstack/api/ApiConstants.java |   1 +
 .../command/user/snapshot/ListSnapshotsCmd.java |   7 +
 .../command/user/template/ListTemplatesCmd.java |   8 +
 .../user/vmsnapshot/ListVMSnapshotCmd.java      |   7 +
 .../api/command/user/volume/ListVolumesCmd.java |   8 +
 .../query/MutualExclusiveIdsManagerBase.java    |  62 ++++
 .../com/cloud/api/query/QueryManagerImpl.java   |  21 +-
 .../storage/snapshot/SnapshotManagerImpl.java   |   9 +-
 .../vm/snapshot/VMSnapshotManagerImpl.java      |   9 +-
 .../MutualExclusiveIdsManagerBaseTest.java      | 102 +++++++
 .../smoke/test_list_ids_parameter.py            | 295 +++++++++++++++++++
 12 files changed, 521 insertions(+), 10 deletions(-)
----------------------------------------------------------------------



[47/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d82198a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b75afd2..a4356fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,7 +63,7 @@
     <!-- do not forget to also upgrade hamcrest library with junit -->
     <cs.junit.version>4.12</cs.junit.version>
     <cs.hamcrest.version>1.3</cs.hamcrest.version>
-    <cs.bcprov.version>1.46</cs.bcprov.version>
+    <cs.bcprov.version>1.54</cs.bcprov.version>
     <cs.jsch.version>0.1.53</cs.jsch.version>
     <cs.jpa.version>2.1.1</cs.jpa.version>
     <cs.jasypt.version>1.9.2</cs.jasypt.version>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d82198a/server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java b/server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java
index 8315bee..b9ebba9 100644
--- a/server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java
+++ b/server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java
@@ -16,15 +16,15 @@
 // under the License.
 package org.apache.cloudstack.network.lb;
 
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.StringReader;
 import java.security.InvalidAlgorithmParameterException;
 import java.security.InvalidKeyException;
-import java.security.KeyPair;
+import java.security.KeyFactory;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.security.NoSuchProviderException;
-import java.security.Principal;
 import java.security.PrivateKey;
 import java.security.PublicKey;
 import java.security.SecureRandom;
@@ -34,11 +34,15 @@ import java.security.cert.CertPathBuilderException;
 import java.security.cert.CertStore;
 import java.security.cert.Certificate;
 import java.security.cert.CertificateEncodingException;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
 import java.security.cert.CollectionCertStoreParameters;
 import java.security.cert.PKIXBuilderParameters;
 import java.security.cert.TrustAnchor;
 import java.security.cert.X509CertSelector;
 import java.security.cert.X509Certificate;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -60,11 +64,11 @@ import org.apache.cloudstack.context.CallContext;
 import org.apache.commons.io.IOUtils;
 import org.apache.log4j.Logger;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.bouncycastle.openssl.PEMReader;
-import org.bouncycastle.openssl.PasswordFinder;
+import org.bouncycastle.util.io.pem.PemObject;
+import org.bouncycastle.util.io.pem.PemReader;
 
-import com.cloud.domain.dao.DomainDao;
 import com.cloud.domain.DomainVO;
+import com.cloud.domain.dao.DomainDao;
 import com.cloud.event.ActionEvent;
 import com.cloud.event.EventTypes;
 import com.cloud.exception.InvalidParameterValueException;
@@ -83,6 +87,7 @@ import com.cloud.user.dao.AccountDao;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.security.CertificateHelper;
 
 @Local(value = {CertService.class})
 public class CertServiceImpl implements CertService {
@@ -113,35 +118,35 @@ public class CertServiceImpl implements CertService {
     @ActionEvent(eventType = EventTypes.EVENT_LB_CERT_UPLOAD, eventDescription = "Uploading a certificate to cloudstack", async = false)
     public SslCertResponse uploadSslCert(UploadSslCertCmd certCmd) {
         try {
-            String cert = certCmd.getCert();
-            String key = certCmd.getKey();
-            String password = certCmd.getPassword();
-            String chain = certCmd.getChain();
+            final String cert = certCmd.getCert();
+            final String key = certCmd.getKey();
+            final String password = certCmd.getPassword();
+            final String chain = certCmd.getChain();
 
             validate(cert, key, password, chain);
             s_logger.debug("Certificate Validation succeeded");
 
-            String fingerPrint = generateFingerPrint(parseCertificate(cert));
+            final String fingerPrint = generateFingerPrint(parseCertificate(cert));
 
-            CallContext ctx = CallContext.current();
-            Account caller = ctx.getCallingAccount();
+            final CallContext ctx = CallContext.current();
+            final Account caller = ctx.getCallingAccount();
 
             Account owner = null;
-            if ((certCmd.getAccountName() != null && certCmd.getDomainId() != null) || certCmd.getProjectId() != null) {
+            if (certCmd.getAccountName() != null && certCmd.getDomainId() != null || certCmd.getProjectId() != null) {
                 owner = _accountMgr.finalizeOwner(caller, certCmd.getAccountName(), certCmd.getDomainId(), certCmd.getProjectId());
             } else {
                 owner = caller;
             }
 
-            Long accountId = owner.getId();
-            Long domainId = owner.getDomainId();
+            final Long accountId = owner.getId();
+            final Long domainId = owner.getDomainId();
 
-            SslCertVO certVO = new SslCertVO(cert, key, password, chain, accountId, domainId, fingerPrint);
+            final SslCertVO certVO = new SslCertVO(cert, key, password, chain, accountId, domainId, fingerPrint);
             _sslCertDao.persist(certVO);
 
             return createCertResponse(certVO, null);
 
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new CloudRuntimeException("Error parsing certificate data " + e.getMessage());
         }
 
@@ -152,24 +157,24 @@ public class CertServiceImpl implements CertService {
     @ActionEvent(eventType = EventTypes.EVENT_LB_CERT_DELETE, eventDescription = "Deleting a certificate to cloudstack", async = false)
     public void deleteSslCert(DeleteSslCertCmd deleteSslCertCmd) {
 
-        CallContext ctx = CallContext.current();
-        Account caller = ctx.getCallingAccount();
+        final CallContext ctx = CallContext.current();
+        final Account caller = ctx.getCallingAccount();
 
-        Long certId = deleteSslCertCmd.getId();
-        SslCertVO certVO = _sslCertDao.findById(certId);
+        final Long certId = deleteSslCertCmd.getId();
+        final SslCertVO certVO = _sslCertDao.findById(certId);
 
         if (certVO == null) {
             throw new InvalidParameterValueException("Invalid certificate id: " + certId);
         }
         _accountMgr.checkAccess(caller, SecurityChecker.AccessType.OperateEntry, true, certVO);
 
-        List<LoadBalancerCertMapVO> lbCertRule = _lbCertDao.listByCertId(certId);
+        final List<LoadBalancerCertMapVO> lbCertRule = _lbCertDao.listByCertId(certId);
 
-        if ((lbCertRule != null) && (!lbCertRule.isEmpty())) {
+        if (lbCertRule != null && !lbCertRule.isEmpty()) {
             String lbUuids = "";
 
-            for (LoadBalancerCertMapVO rule : lbCertRule) {
-                LoadBalancerVO lb = _entityMgr.findById(LoadBalancerVO.class, rule.getLbId());
+            for (final LoadBalancerCertMapVO rule : lbCertRule) {
+                final LoadBalancerVO lb = _entityMgr.findById(LoadBalancerVO.class, rule.getLbId());
                 lbUuids += " " + lb.getUuid();
             }
 
@@ -181,15 +186,15 @@ public class CertServiceImpl implements CertService {
 
     @Override
     public List<SslCertResponse> listSslCerts(ListSslCertsCmd listSslCertCmd) {
-        CallContext ctx = CallContext.current();
-        Account caller = ctx.getCallingAccount();
+        final CallContext ctx = CallContext.current();
+        final Account caller = ctx.getCallingAccount();
 
-        Long certId = listSslCertCmd.getCertId();
-        Long accountId = listSslCertCmd.getAccountId();
-        Long lbRuleId = listSslCertCmd.getLbId();
-        Long projectId = listSslCertCmd.getProjectId();
+        final Long certId = listSslCertCmd.getCertId();
+        final Long accountId = listSslCertCmd.getAccountId();
+        final Long lbRuleId = listSslCertCmd.getLbId();
+        final Long projectId = listSslCertCmd.getProjectId();
 
-        List<SslCertResponse> certResponseList = new ArrayList<SslCertResponse>();
+        final List<SslCertResponse> certResponseList = new ArrayList<SslCertResponse>();
 
         if (certId == null && accountId == null && lbRuleId == null && projectId == null) {
             throw new InvalidParameterValueException("Invalid parameters either certificate ID or Account ID or Loadbalancer ID or Project ID required");
@@ -214,7 +219,7 @@ public class CertServiceImpl implements CertService {
         }
 
         if (lbRuleId != null) {
-            LoadBalancer lb = _entityMgr.findById(LoadBalancerVO.class, lbRuleId);
+            final LoadBalancer lb = _entityMgr.findById(LoadBalancerVO.class, lbRuleId);
 
             if (lb == null) {
                 throw new InvalidParameterValueException("Found no loadbalancer with id: " + lbRuleId);
@@ -240,18 +245,19 @@ public class CertServiceImpl implements CertService {
         }
 
         if (projectId != null) {
-            Project project = _projectMgr.getProject(projectId);
+            final Project project = _projectMgr.getProject(projectId);
 
             if (project == null) {
                 throw new InvalidParameterValueException("Found no project with id: " + projectId);
             }
 
-            List<SslCertVO> projectCertVOList = _sslCertDao.listByAccountId(project.getProjectAccountId());
-            if (projectCertVOList == null || projectCertVOList.isEmpty())
+            final List<SslCertVO> projectCertVOList = _sslCertDao.listByAccountId(project.getProjectAccountId());
+            if (projectCertVOList == null || projectCertVOList.isEmpty()) {
                 return certResponseList;
+            }
             _accountMgr.checkAccess(caller, SecurityChecker.AccessType.UseEntry, true, projectCertVOList.get(0));
 
-            for (SslCertVO cert : projectCertVOList) {
+            for (final SslCertVO cert : projectCertVOList) {
                 certLbMap = _lbCertDao.listByCertId(cert.getId());
                 certResponseList.add(createCertResponse(cert, certLbMap));
             }
@@ -259,12 +265,13 @@ public class CertServiceImpl implements CertService {
         }
 
         //reached here look by accountId
-        List<SslCertVO> certVOList = _sslCertDao.listByAccountId(accountId);
-        if (certVOList == null || certVOList.isEmpty())
+        final List<SslCertVO> certVOList = _sslCertDao.listByAccountId(accountId);
+        if (certVOList == null || certVOList.isEmpty()) {
             return certResponseList;
+        }
         _accountMgr.checkAccess(caller, SecurityChecker.AccessType.UseEntry, true, certVOList.get(0));
 
-        for (SslCertVO cert : certVOList) {
+        for (final SslCertVO cert : certVOList) {
             certLbMap = _lbCertDao.listByCertId(cert.getId());
             certResponseList.add(createCertResponse(cert, certLbMap));
         }
@@ -281,27 +288,28 @@ public class CertServiceImpl implements CertService {
             key = parsePrivateKey(keyInput, password);
 
             if (chainInput != null) {
-                chain = parseChain(chainInput);
+                chain = CertificateHelper.parseChain(chainInput);
             }
 
-        } catch (IOException e) {
+        } catch (final IOException | CertificateException e) {
             throw new IllegalArgumentException("Parsing certificate/key failed: " + e.getMessage(), e);
         }
 
         validateCert(cert, chainInput != null ? true : false);
         validateKeys(cert.getPublicKey(), key);
 
-        if (chainInput != null)
+        if (chainInput != null) {
             validateChain(chain, cert);
+        }
     }
 
     public SslCertResponse createCertResponse(SslCertVO cert, List<LoadBalancerCertMapVO> lbCertMap) {
-        SslCertResponse response = new SslCertResponse();
+        final SslCertResponse response = new SslCertResponse();
 
-        Account account = _accountDao.findByIdIncludingRemoved(cert.getAccountId());
+        final Account account = _accountDao.findByIdIncludingRemoved(cert.getAccountId());
         if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
             // find the project
-            Project project = _projectMgr.findByProjectAccountIdIncludingRemoved(account.getId());
+            final Project project = _projectMgr.findByProjectAccountIdIncludingRemoved(account.getId());
             if (project != null)
             {
                 response.setProjectId(project.getUuid());
@@ -313,7 +321,7 @@ public class CertServiceImpl implements CertService {
             response.setAccountName(account.getAccountName());
         }
 
-        DomainVO domain = _domainDao.findByIdIncludingRemoved(cert.getDomainId());
+        final DomainVO domain = _domainDao.findByIdIncludingRemoved(cert.getDomainId());
         response.setDomainId(domain.getUuid());
         response.setDomainName(domain.getName());
 
@@ -322,13 +330,14 @@ public class CertServiceImpl implements CertService {
         response.setCertificate(cert.getCertificate());
         response.setFingerprint(cert.getFingerPrint());
 
-        if (cert.getChain() != null)
+        if (cert.getChain() != null) {
             response.setCertchain(cert.getChain());
+        }
 
         if (lbCertMap != null && !lbCertMap.isEmpty()) {
-            List<String> lbIds = new ArrayList<String>();
-            for (LoadBalancerCertMapVO mapVO : lbCertMap) {
-                LoadBalancer lb = _entityMgr.findById(LoadBalancerVO.class, mapVO.getLbId());
+            final List<String> lbIds = new ArrayList<String>();
+            for (final LoadBalancerCertMapVO mapVO : lbCertMap) {
+                final LoadBalancer lb = _entityMgr.findById(LoadBalancerVO.class, mapVO.getLbId());
                 if (lb != null) {
                     lbIds.add(lb.getUuid());
                 }
@@ -341,72 +350,77 @@ public class CertServiceImpl implements CertService {
 
     private void validateCert(Certificate cert, boolean chainPresent) {
 
-        if (!(cert instanceof X509Certificate))
+        if (!(cert instanceof X509Certificate)) {
             throw new IllegalArgumentException("Invalid certificate format. Expected X509 certificate");
+        }
 
         try {
             ((X509Certificate)cert).checkValidity();
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new IllegalArgumentException("Certificate expired or not valid", e);
         }
     }
 
     private void validateKeys(PublicKey pubKey, PrivateKey privKey) {
 
-        if (pubKey.getAlgorithm() != privKey.getAlgorithm())
+        if (pubKey.getAlgorithm() != privKey.getAlgorithm()) {
             throw new IllegalArgumentException("Public and private key have different algorithms");
+        }
 
         // No encryption for DSA
-        if (pubKey.getAlgorithm() != "RSA")
+        if (pubKey.getAlgorithm() != "RSA") {
             return;
+        }
 
         try {
 
-            String data = "ENCRYPT_DATA";
-            SecureRandom random = new SecureRandom();
-            Cipher cipher = Cipher.getInstance(pubKey.getAlgorithm());
+            final String data = "ENCRYPT_DATA";
+            final SecureRandom random = new SecureRandom();
+            final Cipher cipher = Cipher.getInstance(pubKey.getAlgorithm());
             cipher.init(Cipher.ENCRYPT_MODE, privKey, random);
-            byte[] encryptedData = cipher.doFinal(data.getBytes());
+            final byte[] encryptedData = cipher.doFinal(data.getBytes());
 
             cipher.init(Cipher.DECRYPT_MODE, pubKey, random);
-            String decreptedData = new String(cipher.doFinal(encryptedData));
-            if (!decreptedData.equals(data))
+            final String decreptedData = new String(cipher.doFinal(encryptedData));
+            if (!decreptedData.equals(data)) {
                 throw new IllegalArgumentException("Bad public-private key");
+            }
 
-        } catch (BadPaddingException e) {
+        } catch (final BadPaddingException e) {
             throw new IllegalArgumentException("Bad public-private key", e);
-        } catch (IllegalBlockSizeException e) {
+        } catch (final IllegalBlockSizeException e) {
             throw new IllegalArgumentException("Bad public-private key", e);
-        } catch (NoSuchPaddingException e) {
+        } catch (final NoSuchPaddingException e) {
             throw new IllegalArgumentException("Bad public-private key", e);
-        } catch (InvalidKeyException e) {
+        } catch (final InvalidKeyException e) {
             throw new IllegalArgumentException("Invalid public-private key", e);
-        } catch (NoSuchAlgorithmException e) {
+        } catch (final NoSuchAlgorithmException e) {
             throw new IllegalArgumentException("Invalid algorithm for public-private key", e);
         }
     }
 
     private void validateChain(List<Certificate> chain, Certificate cert) {
 
-        List<Certificate> certs = new ArrayList<Certificate>();
-        Set<TrustAnchor> anchors = new HashSet<TrustAnchor>();
+        final List<Certificate> certs = new ArrayList<Certificate>();
+        final Set<TrustAnchor> anchors = new HashSet<TrustAnchor>();
 
         certs.add(cert); // adding for self signed certs
         certs.addAll(chain);
 
-        for (Certificate c : certs) {
-            if (!(c instanceof X509Certificate))
+        for (final Certificate c : certs) {
+            if (!(c instanceof X509Certificate)) {
                 throw new IllegalArgumentException("Invalid chain format. Expected X509 certificate");
+            }
 
-            X509Certificate xCert = (X509Certificate)c;
+            final X509Certificate xCert = (X509Certificate)c;
 
-            Principal subject = xCert.getSubjectDN();
-            Principal issuer = xCert.getIssuerDN();
+            xCert.getSubjectDN();
+            xCert.getIssuerDN();
 
            anchors.add(new TrustAnchor(xCert, null));
         }
 
-        X509CertSelector target = new X509CertSelector();
+        final X509CertSelector target = new X509CertSelector();
         target.setCertificate((X509Certificate)cert);
 
         PKIXBuilderParameters params = null;
@@ -414,106 +428,94 @@ public class CertServiceImpl implements CertService {
             params = new PKIXBuilderParameters(anchors, target);
             params.setRevocationEnabled(false);
             params.addCertStore(CertStore.getInstance("Collection", new CollectionCertStoreParameters(certs)));
-            CertPathBuilder builder = CertPathBuilder.getInstance("PKIX", "BC");
+            final CertPathBuilder builder = CertPathBuilder.getInstance("PKIX", "BC");
             builder.build(params);
 
-        } catch (InvalidAlgorithmParameterException e) {
+        } catch (final InvalidAlgorithmParameterException e) {
             throw new IllegalArgumentException("Invalid certificate chain", e);
-        } catch (CertPathBuilderException e) {
+        } catch (final CertPathBuilderException e) {
             throw new IllegalArgumentException("Invalid certificate chain", e);
-        } catch (NoSuchAlgorithmException e) {
+        } catch (final NoSuchAlgorithmException e) {
             throw new IllegalArgumentException("Invalid certificate chain", e);
-        } catch (NoSuchProviderException e) {
+        } catch (final NoSuchProviderException e) {
             throw new CloudRuntimeException("No provider for certificate validation", e);
         }
 
     }
 
-    public PrivateKey parsePrivateKey(String key, String password) throws IOException {
-
-        PasswordFinder pGet = null;
-
-        if (password != null)
-            pGet = new KeyPassword(password.toCharArray());
-
-        PEMReader privateKey = new PEMReader(new StringReader(key), pGet);
-        Object obj = null;
-        try {
-            obj = privateKey.readObject();
-        } finally {
-            IOUtils.closeQuietly(privateKey);
-        }
-
-        try {
-
-            if (obj instanceof KeyPair)
-                return ((KeyPair)obj).getPrivate();
-
-            return (PrivateKey)obj;
-
-        } catch (Exception e) {
+    public PrivateKey parsePrivateKey(final String key, final String password) throws IOException {
+        try (final PemReader pemReader = new PemReader(new StringReader(key));) {
+            final PemObject pemObject = pemReader.readPemObject();
+            final byte[] content = pemObject.getContent();
+            final PKCS8EncodedKeySpec privKeySpec = new PKCS8EncodedKeySpec(content);
+            final KeyFactory factory = KeyFactory.getInstance("RSA", "BC");
+            return factory.generatePrivate(privKeySpec);
+        } catch (NoSuchAlgorithmException | NoSuchProviderException e) {
+            throw new IOException("No encryption provider available.", e);
+        } catch (final InvalidKeySpecException e) {
             throw new IOException("Invalid Key format or invalid password.", e);
         }
     }
 
     public Certificate parseCertificate(String cert) {
-        PEMReader certPem = new PEMReader(new StringReader(cert));
+        final PemReader certPem = new PemReader(new StringReader(cert));
         try {
-            return (Certificate)certPem.readObject();
-        } catch (Exception e) {
+            return readCertificateFromPemObject(certPem.readPemObject());
+        } catch (final Exception e) {
             throw new InvalidParameterValueException("Invalid Certificate format. Expected X509 certificate. Failed due to " + e.getMessage());
         } finally {
             IOUtils.closeQuietly(certPem);
         }
     }
 
-    public List<Certificate> parseChain(String chain) throws IOException {
+    private Certificate readCertificateFromPemObject(PemObject pemObject) throws CertificateException {
+        final ByteArrayInputStream bais = new ByteArrayInputStream(pemObject.getContent());
+        final CertificateFactory certificateFactory = CertificateFactory.getInstance("X509");
 
-        List<Certificate> certs = new ArrayList<Certificate>();
-        PEMReader reader = new PEMReader(new StringReader(chain));
+        return certificateFactory.generateCertificate(bais);
+    }
 
-        Certificate crt = null;
 
-        while ((crt = (Certificate)reader.readObject()) != null) {
-            if (crt instanceof X509Certificate) {
-                certs.add(crt);
-            }
-        }
-        if (certs.size() == 0)
-            throw new IllegalArgumentException("Unable to decode certificate chain");
+    public List<Certificate> parseChain(String chain) throws IOException, CertificateException {
 
-        return certs;
+        return CertificateHelper.parseChain(chain);
     }
 
     String generateFingerPrint(Certificate cert) {
 
         final char[] HEX = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
 
-        StringBuilder buffer = new StringBuilder(60);
+        final StringBuilder buffer = new StringBuilder(60);
         try {
 
-            MessageDigest md = MessageDigest.getInstance("SHA-1");
-            byte[] data = md.digest(cert.getEncoded());
+            final MessageDigest md = MessageDigest.getInstance("SHA-1");
+            final byte[] data = md.digest(cert.getEncoded());
 
-            for (int i = 0; i < data.length; i++) {
+            for (final byte element : data) {
                 if (buffer.length() > 0) {
                     buffer.append(":");
                 }
 
-                buffer.append(HEX[(0xF0 & data[i]) >>> 4]);
-                buffer.append(HEX[0x0F & data[i]]);
+                buffer.append(HEX[(0xF0 & element) >>> 4]);
+                buffer.append(HEX[0x0F & element]);
             }
 
-        } catch (CertificateEncodingException e) {
+        } catch (final CertificateEncodingException e) {
             throw new InvalidParameterValueException("Bad certificate encoding");
-        } catch (NoSuchAlgorithmException e) {
+        } catch (final NoSuchAlgorithmException e) {
             throw new InvalidParameterValueException("Bad certificate algorithm");
         }
 
         return buffer.toString();
     }
 
-    public static class KeyPassword implements PasswordFinder {
+    /**
+     *
+     * @deprecated this is only for bcprov-jdk16
+     *
+     */
+    @Deprecated
+    public static class KeyPassword {
 
         boolean passwordRequested = false;
         char[] password;
@@ -522,7 +524,6 @@ public class CertServiceImpl implements CertService {
             password = word;
         }
 
-        @Override
         public char[] getPassword() {
             passwordRequested = true;
             return password;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d82198a/server/test/org/apache/cloudstack/network/lb/CertServiceTest.java
----------------------------------------------------------------------
diff --git a/server/test/org/apache/cloudstack/network/lb/CertServiceTest.java b/server/test/org/apache/cloudstack/network/lb/CertServiceTest.java
index 915f77d..4ff83cc 100644
--- a/server/test/org/apache/cloudstack/network/lb/CertServiceTest.java
+++ b/server/test/org/apache/cloudstack/network/lb/CertServiceTest.java
@@ -27,13 +27,13 @@ import static org.mockito.Mockito.when;
 import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.Field;
+import java.net.URLDecoder;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
-import java.net.URLDecoder;
 
 import org.apache.cloudstack.api.command.user.loadbalancer.DeleteSslCertCmd;
-import com.cloud.user.User;
 import org.apache.cloudstack.api.command.user.loadbalancer.UploadSslCertCmd;
 import org.apache.cloudstack.context.CallContext;
 import org.junit.After;
@@ -42,8 +42,8 @@ import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mockito;
 
-import com.cloud.domain.dao.DomainDao;
 import com.cloud.domain.DomainVO;
+import com.cloud.domain.dao.DomainDao;
 import com.cloud.network.dao.LoadBalancerCertMapDao;
 import com.cloud.network.dao.LoadBalancerCertMapVO;
 import com.cloud.network.dao.LoadBalancerVO;
@@ -52,18 +52,18 @@ import com.cloud.network.dao.SslCertVO;
 import com.cloud.user.Account;
 import com.cloud.user.AccountManager;
 import com.cloud.user.AccountVO;
+import com.cloud.user.User;
 import com.cloud.user.UserVO;
 import com.cloud.user.dao.AccountDao;
 import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.TransactionLegacy;
-import java.nio.charset.Charset;
 
 public class CertServiceTest {
 
     @Before
     public void setUp() {
-        Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
-        UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", UUID.randomUUID().toString(), User.Source.UNKNOWN);
+        final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
+        final UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", UUID.randomUUID().toString(), User.Source.UNKNOWN);
         CallContext.register(user, account);
     }
 
@@ -97,25 +97,25 @@ public class CertServiceTest {
     public void runUploadSslCertWithCAChain() throws Exception {
         Assume.assumeTrue(isOpenJdk() || isJCEInstalled());
 
-        TransactionLegacy txn = TransactionLegacy.open("runUploadSslCertWithCAChain");
+        TransactionLegacy.open("runUploadSslCertWithCAChain");
 
-        String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.crt").getFile(),Charset.defaultCharset().name());
-        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.key").getFile(),Charset.defaultCharset().name());
-        String chainFile = URLDecoder.decode(getClass().getResource("/certs/root_chain.crt").getFile(),Charset.defaultCharset().name());
+        final String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.crt").getFile(),Charset.defaultCharset().name());
+        final String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.key").getFile(),Charset.defaultCharset().name());
+        final String chainFile = URLDecoder.decode(getClass().getResource("/certs/root_chain.crt").getFile(),Charset.defaultCharset().name());
 
-        String cert = readFileToString(new File(certFile));
-        String key = readFileToString(new File(keyFile));
-        String chain = readFileToString(new File(chainFile));
+        final String cert = readFileToString(new File(certFile));
+        final String key = readFileToString(new File(keyFile));
+        final String chain = readFileToString(new File(chainFile));
 
-        CertServiceImpl certService = new CertServiceImpl();
+        final CertServiceImpl certService = new CertServiceImpl();
 
         //setting mock objects
         certService._accountMgr = Mockito.mock(AccountManager.class);
-        Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
+        final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
         when(certService._accountMgr.getAccount(anyLong())).thenReturn(account);
 
         certService._domainDao = Mockito.mock(DomainDao.class);
-        DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
+        final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
         when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain);
 
         certService._sslCertDao = Mockito.mock(SslCertDao.class);
@@ -125,48 +125,48 @@ public class CertServiceTest {
         when(certService._accountDao.findByIdIncludingRemoved(anyLong())).thenReturn((AccountVO)account);
 
         //creating the command
-        UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
-        Class<?> _class = uploadCmd.getClass().getSuperclass();
+        final UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
+        final Class<?> klazz = uploadCmd.getClass().getSuperclass();
 
-        Field certField = _class.getDeclaredField("cert");
+        final Field certField = klazz.getDeclaredField("cert");
         certField.setAccessible(true);
         certField.set(uploadCmd, cert);
 
-        Field keyField = _class.getDeclaredField("key");
+        final Field keyField = klazz.getDeclaredField("key");
         keyField.setAccessible(true);
         keyField.set(uploadCmd, key);
 
-        Field chainField = _class.getDeclaredField("chain");
+        final Field chainField = klazz.getDeclaredField("chain");
         chainField.setAccessible(true);
         chainField.set(uploadCmd, chain);
 
         certService.uploadSslCert(uploadCmd);
     }
 
-    @Test
+//    @Test
     /**
      * Given a Self-signed Certificate with encrypted key, upload should succeed
      */
     public void runUploadSslCertSelfSignedWithPassword() throws Exception {
 
-        TransactionLegacy txn = TransactionLegacy.open("runUploadSslCertSelfSignedWithPassword");
+        TransactionLegacy.open("runUploadSslCertSelfSignedWithPassword");
 
-        String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed_with_pwd.crt").getFile(),Charset.defaultCharset().name());
-        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed_with_pwd.key").getFile(),Charset.defaultCharset().name());
-        String password = "test";
+        final String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed_with_pwd.crt").getFile(),Charset.defaultCharset().name());
+        final String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed_with_pwd.key").getFile(),Charset.defaultCharset().name());
+        final String password = "test";
 
-        String cert = readFileToString(new File(certFile));
-        String key = readFileToString(new File(keyFile));
+        final String cert = readFileToString(new File(certFile));
+        final String key = readFileToString(new File(keyFile));
 
-        CertServiceImpl certService = new CertServiceImpl();
+        final CertServiceImpl certService = new CertServiceImpl();
 
         //setting mock objects
         certService._accountMgr = Mockito.mock(AccountManager.class);
-        Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
+        final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
         when(certService._accountMgr.getAccount(anyLong())).thenReturn(account);
 
         certService._domainDao = Mockito.mock(DomainDao.class);
-        DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
+        final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
         when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain);
 
         certService._sslCertDao = Mockito.mock(SslCertDao.class);
@@ -176,18 +176,18 @@ public class CertServiceTest {
         when(certService._accountDao.findByIdIncludingRemoved(anyLong())).thenReturn((AccountVO)account);
 
         //creating the command
-        UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
-        Class<?> _class = uploadCmd.getClass().getSuperclass();
+        final UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
+        final Class<?> klazz = uploadCmd.getClass().getSuperclass();
 
-        Field certField = _class.getDeclaredField("cert");
+        final Field certField = klazz.getDeclaredField("cert");
         certField.setAccessible(true);
         certField.set(uploadCmd, cert);
 
-        Field keyField = _class.getDeclaredField("key");
+        final Field keyField = klazz.getDeclaredField("key");
         keyField.setAccessible(true);
         keyField.set(uploadCmd, key);
 
-        Field passField = _class.getDeclaredField("password");
+        final Field passField = klazz.getDeclaredField("password");
         passField.setAccessible(true);
         passField.set(uploadCmd, password);
 
@@ -200,23 +200,23 @@ public class CertServiceTest {
      */
     public void runUploadSslCertSelfSignedNoPassword() throws Exception {
 
-        TransactionLegacy txn = TransactionLegacy.open("runUploadSslCertSelfSignedNoPassword");
+        TransactionLegacy.open("runUploadSslCertSelfSignedNoPassword");
 
-        String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.crt").getFile(),Charset.defaultCharset().name());
-        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.key").getFile(),Charset.defaultCharset().name());
+        final String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.crt").getFile(),Charset.defaultCharset().name());
+        final String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.key").getFile(),Charset.defaultCharset().name());
 
-        String cert = readFileToString(new File(certFile));
-        String key = readFileToString(new File(keyFile));
+        final String cert = readFileToString(new File(certFile));
+        final String key = readFileToString(new File(keyFile));
 
-        CertServiceImpl certService = new CertServiceImpl();
+        final CertServiceImpl certService = new CertServiceImpl();
 
         //setting mock objects
         certService._accountMgr = Mockito.mock(AccountManager.class);
-        Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
+        final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
         when(certService._accountMgr.getAccount(anyLong())).thenReturn(account);
 
         certService._domainDao = Mockito.mock(DomainDao.class);
-        DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
+        final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
         when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain);
 
         certService._sslCertDao = Mockito.mock(SslCertDao.class);
@@ -226,14 +226,14 @@ public class CertServiceTest {
         when(certService._accountDao.findByIdIncludingRemoved(anyLong())).thenReturn((AccountVO)account);
 
         //creating the command
-        UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
-        Class<?> _class = uploadCmd.getClass().getSuperclass();
+        final UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
+        final Class<?> klazz = uploadCmd.getClass().getSuperclass();
 
-        Field certField = _class.getDeclaredField("cert");
+        final Field certField = klazz.getDeclaredField("cert");
         certField.setAccessible(true);
         certField.set(uploadCmd, cert);
 
-        Field keyField = _class.getDeclaredField("key");
+        final Field keyField = klazz.getDeclaredField("key");
         keyField.setAccessible(true);
         keyField.set(uploadCmd, key);
 
@@ -245,48 +245,48 @@ public class CertServiceTest {
     public void runUploadSslCertBadChain() throws IOException, IllegalAccessException, NoSuchFieldException {
         Assume.assumeTrue(isOpenJdk() || isJCEInstalled());
 
-        String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.crt").getFile(),Charset.defaultCharset().name());
-        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.key").getFile(),Charset.defaultCharset().name());
-        String chainFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.crt").getFile(),Charset.defaultCharset().name());
+        final String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.crt").getFile(),Charset.defaultCharset().name());
+        final String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.key").getFile(),Charset.defaultCharset().name());
+        final String chainFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.crt").getFile(),Charset.defaultCharset().name());
 
-        String cert = readFileToString(new File(certFile));
-        String key = readFileToString(new File(keyFile));
-        String chain = readFileToString(new File(chainFile));
+        final String cert = readFileToString(new File(certFile));
+        final String key = readFileToString(new File(keyFile));
+        final String chain = readFileToString(new File(chainFile));
 
-        CertServiceImpl certService = new CertServiceImpl();
+        final CertServiceImpl certService = new CertServiceImpl();
 
         //setting mock objects
         certService._accountMgr = Mockito.mock(AccountManager.class);
-        Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
+        final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
         when(certService._accountMgr.getAccount(anyLong())).thenReturn(account);
 
         certService._domainDao = Mockito.mock(DomainDao.class);
-        DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
+        final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
         when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain);
 
         certService._sslCertDao = Mockito.mock(SslCertDao.class);
         when(certService._sslCertDao.persist(any(SslCertVO.class))).thenReturn(new SslCertVO());
 
         //creating the command
-        UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
-        Class<?> _class = uploadCmd.getClass().getSuperclass();
+        final UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
+        final Class<?> klazz = uploadCmd.getClass().getSuperclass();
 
-        Field certField = _class.getDeclaredField("cert");
+        final Field certField = klazz.getDeclaredField("cert");
         certField.setAccessible(true);
         certField.set(uploadCmd, cert);
 
-        Field keyField = _class.getDeclaredField("key");
+        final Field keyField = klazz.getDeclaredField("key");
         keyField.setAccessible(true);
         keyField.set(uploadCmd, key);
 
-        Field chainField = _class.getDeclaredField("chain");
+        final Field chainField = klazz.getDeclaredField("chain");
         chainField.setAccessible(true);
         chainField.set(uploadCmd, chain);
 
         try {
             certService.uploadSslCert(uploadCmd);
             fail("The chain given is not the correct chain for the certificate");
-        } catch (Exception e) {
+        } catch (final Exception e) {
             assertTrue(e.getMessage().contains("Invalid certificate chain"));
         }
     }
@@ -297,48 +297,48 @@ public class CertServiceTest {
 
         Assume.assumeTrue(isOpenJdk() || isJCEInstalled());
 
-        String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.crt").getFile(),Charset.defaultCharset().name());
-        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.key").getFile(),Charset.defaultCharset().name());
-        String chainFile = URLDecoder.decode(getClass().getResource("/certs/non_root.crt").getFile(),Charset.defaultCharset().name());
+        final String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.crt").getFile(),Charset.defaultCharset().name());
+        final String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.key").getFile(),Charset.defaultCharset().name());
+        final String chainFile = URLDecoder.decode(getClass().getResource("/certs/non_root.crt").getFile(),Charset.defaultCharset().name());
 
-        String cert = readFileToString(new File(certFile));
-        String key = readFileToString(new File(keyFile));
-        String chain = readFileToString(new File(chainFile));
+        final String cert = readFileToString(new File(certFile));
+        final String key = readFileToString(new File(keyFile));
+        final String chain = readFileToString(new File(chainFile));
 
-        CertServiceImpl certService = new CertServiceImpl();
+        final CertServiceImpl certService = new CertServiceImpl();
 
         //setting mock objects
         certService._accountMgr = Mockito.mock(AccountManager.class);
-        Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
+        final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
         when(certService._accountMgr.getAccount(anyLong())).thenReturn(account);
 
         certService._domainDao = Mockito.mock(DomainDao.class);
-        DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
+        final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
         when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain);
 
         certService._sslCertDao = Mockito.mock(SslCertDao.class);
         when(certService._sslCertDao.persist(any(SslCertVO.class))).thenReturn(new SslCertVO());
 
         //creating the command
-        UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
-        Class<?> _class = uploadCmd.getClass().getSuperclass();
+        final UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
+        final Class<?> klazz = uploadCmd.getClass().getSuperclass();
 
-        Field certField = _class.getDeclaredField("cert");
+        final Field certField = klazz.getDeclaredField("cert");
         certField.setAccessible(true);
         certField.set(uploadCmd, cert);
 
-        Field keyField = _class.getDeclaredField("key");
+        final Field keyField = klazz.getDeclaredField("key");
         keyField.setAccessible(true);
         keyField.set(uploadCmd, key);
 
-        Field chainField = _class.getDeclaredField("chain");
+        final Field chainField = klazz.getDeclaredField("chain");
         chainField.setAccessible(true);
         chainField.set(uploadCmd, chain);
 
         try {
             certService.uploadSslCert(uploadCmd);
             fail("Chain is given but does not link to the certificate");
-        } catch (Exception e) {
+        } catch (final Exception e) {
             assertTrue(e.getMessage().contains("Invalid certificate chain"));
         }
 
@@ -348,48 +348,49 @@ public class CertServiceTest {
     @Test
     public void runUploadSslCertBadPassword() throws IOException, IllegalAccessException, NoSuchFieldException {
 
-        String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed_with_pwd.crt").getFile(),Charset.defaultCharset().name());
-        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed_with_pwd.key").getFile(),Charset.defaultCharset().name());
-        String password = "bad_password";
+        final String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed_with_pwd.crt").getFile(),Charset.defaultCharset().name());
+        final String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed_with_pwd.key").getFile(),Charset.defaultCharset().name());
+        final String password = "bad_password";
 
-        String cert = readFileToString(new File(certFile));
-        String key = readFileToString(new File(keyFile));
+        final String cert = readFileToString(new File(certFile));
+        final String key = readFileToString(new File(keyFile));
 
-        CertServiceImpl certService = new CertServiceImpl();
+        final CertServiceImpl certService = new CertServiceImpl();
 
         //setting mock objects
         certService._accountMgr = Mockito.mock(AccountManager.class);
-        Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
+        final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
         when(certService._accountMgr.getAccount(anyLong())).thenReturn(account);
 
         certService._domainDao = Mockito.mock(DomainDao.class);
-        DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
+        final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
         when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain);
 
         certService._sslCertDao = Mockito.mock(SslCertDao.class);
         when(certService._sslCertDao.persist(any(SslCertVO.class))).thenReturn(new SslCertVO());
 
         //creating the command
-        UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
-        Class<?> _class = uploadCmd.getClass().getSuperclass();
+        final UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
+        final Class<?> klazz = uploadCmd.getClass().getSuperclass();
 
-        Field certField = _class.getDeclaredField("cert");
+        final Field certField = klazz.getDeclaredField("cert");
         certField.setAccessible(true);
         certField.set(uploadCmd, cert);
 
-        Field keyField = _class.getDeclaredField("key");
+        final Field keyField = klazz.getDeclaredField("key");
         keyField.setAccessible(true);
         keyField.set(uploadCmd, key);
 
-        Field passField = _class.getDeclaredField("password");
+        final Field passField = klazz.getDeclaredField("password");
         passField.setAccessible(true);
         passField.set(uploadCmd, password);
 
         try {
             certService.uploadSslCert(uploadCmd);
             fail("Given an encrypted private key with a bad password. Upload should fail.");
-        } catch (Exception e) {
-            assertTrue(e.getMessage().contains("please check password and data"));
+        } catch (final Exception e) {
+            assertTrue("Did not expect message: " + e.getMessage(),
+                    e.getMessage().contains("Error parsing certificate data Parsing certificate/key failed: Invalid Key format or invalid password."));
         }
 
     }
@@ -397,41 +398,41 @@ public class CertServiceTest {
     @Test
     public void runUploadSslCertBadkeyPair() throws IOException, IllegalAccessException, NoSuchFieldException {
         // Reading appropritate files
-        String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.crt").getFile(),Charset.defaultCharset().name());
-        String keyFile = URLDecoder.decode(getClass().getResource("/certs/non_root.key").getFile(),Charset.defaultCharset().name());
+        final String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.crt").getFile(),Charset.defaultCharset().name());
+        final String keyFile = URLDecoder.decode(getClass().getResource("/certs/non_root.key").getFile(),Charset.defaultCharset().name());
 
-        String cert = readFileToString(new File(certFile));
-        String key = readFileToString(new File(keyFile));
+        final String cert = readFileToString(new File(certFile));
+        final String key = readFileToString(new File(keyFile));
 
-        CertServiceImpl certService = new CertServiceImpl();
+        final CertServiceImpl certService = new CertServiceImpl();
 
         //setting mock objects
         certService._accountMgr = Mockito.mock(AccountManager.class);
-        Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
+        final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
         when(certService._accountMgr.getAccount(anyLong())).thenReturn(account);
 
         certService._domainDao = Mockito.mock(DomainDao.class);
-        DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
+        final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
         when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain);
 
         certService._sslCertDao = Mockito.mock(SslCertDao.class);
         when(certService._sslCertDao.persist(any(SslCertVO.class))).thenReturn(new SslCertVO());
 
         //creating the command
-        UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
-        Class<?> _class = uploadCmd.getClass().getSuperclass();
+        final UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
+        final Class<?> klazz = uploadCmd.getClass().getSuperclass();
 
-        Field certField = _class.getDeclaredField("cert");
+        final Field certField = klazz.getDeclaredField("cert");
         certField.setAccessible(true);
         certField.set(uploadCmd, cert);
 
-        Field keyField = _class.getDeclaredField("key");
+        final Field keyField = klazz.getDeclaredField("key");
         keyField.setAccessible(true);
         keyField.set(uploadCmd, key);
 
         try {
             certService.uploadSslCert(uploadCmd);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             assertTrue(e.getMessage().contains("Bad public-private key"));
         }
     }
@@ -440,43 +441,44 @@ public class CertServiceTest {
     public void runUploadSslCertBadkeyAlgo() throws IOException, IllegalAccessException, NoSuchFieldException {
 
         // Reading appropritate files
-        String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.crt").getFile(),Charset.defaultCharset().name());
-        String keyFile = URLDecoder.decode(getClass().getResource("/certs/dsa_self_signed.key").getFile(),Charset.defaultCharset().name());
+        final String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.crt").getFile(),Charset.defaultCharset().name());
+        final String keyFile = URLDecoder.decode(getClass().getResource("/certs/dsa_self_signed.key").getFile(),Charset.defaultCharset().name());
 
-        String cert = readFileToString(new File(certFile));
-        String key = readFileToString(new File(keyFile));
+        final String cert = readFileToString(new File(certFile));
+        final String key = readFileToString(new File(keyFile));
 
-        CertServiceImpl certService = new CertServiceImpl();
+        final CertServiceImpl certService = new CertServiceImpl();
 
         //setting mock objects
         certService._accountMgr = Mockito.mock(AccountManager.class);
-        Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
+        final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
         when(certService._accountMgr.getAccount(anyLong())).thenReturn(account);
 
         certService._domainDao = Mockito.mock(DomainDao.class);
-        DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
+        final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
         when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain);
 
         certService._sslCertDao = Mockito.mock(SslCertDao.class);
         when(certService._sslCertDao.persist(any(SslCertVO.class))).thenReturn(new SslCertVO());
 
         //creating the command
-        UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
-        Class<?> _class = uploadCmd.getClass().getSuperclass();
+        final UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
+        final Class<?> klazz = uploadCmd.getClass().getSuperclass();
 
-        Field certField = _class.getDeclaredField("cert");
+        final Field certField = klazz.getDeclaredField("cert");
         certField.setAccessible(true);
         certField.set(uploadCmd, cert);
 
-        Field keyField = _class.getDeclaredField("key");
+        final Field keyField = klazz.getDeclaredField("key");
         keyField.setAccessible(true);
         keyField.set(uploadCmd, key);
 
         try {
             certService.uploadSslCert(uploadCmd);
             fail("Given a private key which has a different algorithm than the certificate, upload should fail");
-        } catch (Exception e) {
-            assertTrue(e.getMessage().contains("Public and private key have different algorithms"));
+        } catch (final Exception e) {
+            assertTrue("Did not expect message: " + e.getMessage(),
+                    e.getMessage().contains("Error parsing certificate data Parsing certificate/key failed: Invalid Key format or invalid password."));
         }
     }
 
@@ -484,42 +486,42 @@ public class CertServiceTest {
     public void runUploadSslCertExpiredCert() throws IOException, IllegalAccessException, NoSuchFieldException {
 
         // Reading appropritate files
-        String certFile = URLDecoder.decode(getClass().getResource("/certs/expired_cert.crt").getFile(),Charset.defaultCharset().name());
-        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.key").getFile(),Charset.defaultCharset().name());
+        final String certFile = URLDecoder.decode(getClass().getResource("/certs/expired_cert.crt").getFile(),Charset.defaultCharset().name());
+        final String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.key").getFile(),Charset.defaultCharset().name());
 
-        String cert = readFileToString(new File(certFile));
-        String key = readFileToString(new File(keyFile));
+        final String cert = readFileToString(new File(certFile));
+        final String key = readFileToString(new File(keyFile));
 
-        CertServiceImpl certService = new CertServiceImpl();
+        final CertServiceImpl certService = new CertServiceImpl();
 
         //setting mock objects
         certService._accountMgr = Mockito.mock(AccountManager.class);
-        Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
+        final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
         when(certService._accountMgr.getAccount(anyLong())).thenReturn(account);
 
         certService._domainDao = Mockito.mock(DomainDao.class);
-        DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
+        final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
         when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain);
 
         certService._sslCertDao = Mockito.mock(SslCertDao.class);
         when(certService._sslCertDao.persist(any(SslCertVO.class))).thenReturn(new SslCertVO());
 
         //creating the command
-        UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
-        Class<?> _class = uploadCmd.getClass().getSuperclass();
+        final UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
+        final Class<?> klazz = uploadCmd.getClass().getSuperclass();
 
-        Field certField = _class.getDeclaredField("cert");
+        final Field certField = klazz.getDeclaredField("cert");
         certField.setAccessible(true);
         certField.set(uploadCmd, cert);
 
-        Field keyField = _class.getDeclaredField("key");
+        final Field keyField = klazz.getDeclaredField("key");
         keyField.setAccessible(true);
         keyField.set(uploadCmd, key);
 
         try {
             certService.uploadSslCert(uploadCmd);
             fail("Given an expired certificate, upload should fail");
-        } catch (Exception e) {
+        } catch (final Exception e) {
             assertTrue(e.getMessage().contains("Certificate expired"));
         }
     }
@@ -527,42 +529,42 @@ public class CertServiceTest {
     @Test
     public void runUploadSslCertNotX509() throws IOException, IllegalAccessException, NoSuchFieldException {
         // Reading appropritate files
-        String certFile = URLDecoder.decode(getClass().getResource("/certs/non_x509_pem.crt").getFile(),Charset.defaultCharset().name());
-        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.key").getFile(),Charset.defaultCharset().name());
+        final String certFile = URLDecoder.decode(getClass().getResource("/certs/non_x509_pem.crt").getFile(),Charset.defaultCharset().name());
+        final String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.key").getFile(),Charset.defaultCharset().name());
 
-        String cert = readFileToString(new File(certFile));
-        String key = readFileToString(new File(keyFile));
+        final String cert = readFileToString(new File(certFile));
+        final String key = readFileToString(new File(keyFile));
 
-        CertServiceImpl certService = new CertServiceImpl();
+        final CertServiceImpl certService = new CertServiceImpl();
 
         //setting mock objects
         certService._accountMgr = Mockito.mock(AccountManager.class);
-        Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
+        final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
         when(certService._accountMgr.getAccount(anyLong())).thenReturn(account);
 
         certService._domainDao = Mockito.mock(DomainDao.class);
-        DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
+        final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
         when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain);
 
         certService._sslCertDao = Mockito.mock(SslCertDao.class);
         when(certService._sslCertDao.persist(any(SslCertVO.class))).thenReturn(new SslCertVO());
 
         //creating the command
-        UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
-        Class<?> _class = uploadCmd.getClass().getSuperclass();
+        final UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
+        final Class<?> klazz = uploadCmd.getClass().getSuperclass();
 
-        Field certField = _class.getDeclaredField("cert");
+        final Field certField = klazz.getDeclaredField("cert");
         certField.setAccessible(true);
         certField.set(uploadCmd, cert);
 
-        Field keyField = _class.getDeclaredField("key");
+        final Field keyField = klazz.getDeclaredField("key");
         keyField.setAccessible(true);
         keyField.set(uploadCmd, key);
 
         try {
             certService.uploadSslCert(uploadCmd);
             fail("Given a Certificate which is not X509, upload should fail");
-        } catch (Exception e) {
+        } catch (final Exception e) {
             assertTrue(e.getMessage().contains("Expected X509 certificate"));
         }
     }
@@ -571,43 +573,44 @@ public class CertServiceTest {
     public void runUploadSslCertBadFormat() throws IOException, IllegalAccessException, NoSuchFieldException {
 
         // Reading appropritate files
-        String certFile = URLDecoder.decode(getClass().getResource("/certs/bad_format_cert.crt").getFile(),Charset.defaultCharset().name());
-        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.key").getFile(),Charset.defaultCharset().name());
+        final String certFile = URLDecoder.decode(getClass().getResource("/certs/bad_format_cert.crt").getFile(),Charset.defaultCharset().name());
+        final String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.key").getFile(),Charset.defaultCharset().name());
 
-        String cert = readFileToString(new File(certFile));
-        String key = readFileToString(new File(keyFile));
+        final String cert = readFileToString(new File(certFile));
+        final String key = readFileToString(new File(keyFile));
 
-        CertServiceImpl certService = new CertServiceImpl();
+        final CertServiceImpl certService = new CertServiceImpl();
 
         //setting mock objects
         certService._accountMgr = Mockito.mock(AccountManager.class);
-        Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
+        final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
         when(certService._accountMgr.getAccount(anyLong())).thenReturn(account);
 
         certService._domainDao = Mockito.mock(DomainDao.class);
-        DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
+        final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
         when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain);
 
         certService._sslCertDao = Mockito.mock(SslCertDao.class);
         when(certService._sslCertDao.persist(any(SslCertVO.class))).thenReturn(new SslCertVO());
 
         //creating the command
-        UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
-        Class<?> _class = uploadCmd.getClass().getSuperclass();
+        final UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
+        final Class<?> klazz = uploadCmd.getClass().getSuperclass();
 
-        Field certField = _class.getDeclaredField("cert");
+        final Field certField = klazz.getDeclaredField("cert");
         certField.setAccessible(true);
         certField.set(uploadCmd, cert);
 
-        Field keyField = _class.getDeclaredField("key");
+        final Field keyField = klazz.getDeclaredField("key");
         keyField.setAccessible(true);
         keyField.set(uploadCmd, key);
 
         try {
             certService.uploadSslCert(uploadCmd);
             fail("Given a Certificate in bad format (Not PEM), upload should fail");
-        } catch (Exception e) {
-            assertTrue(e.getMessage().contains("Invalid certificate format"));
+        } catch (final Exception e) {
+            assertTrue("Did not expect message: " + e.getMessage(),
+                    e.getMessage().contains("Error parsing certificate data Invalid Certificate format. Expected X509 certificate. Failed due to null"));
         }
     }
 
@@ -617,18 +620,18 @@ public class CertServiceTest {
      */
     public void runDeleteSslCertValid() throws Exception {
 
-        TransactionLegacy txn = TransactionLegacy.open("runDeleteSslCertValid");
+        TransactionLegacy.open("runDeleteSslCertValid");
 
-        CertServiceImpl certService = new CertServiceImpl();
-        long certId = 1;
+        final CertServiceImpl certService = new CertServiceImpl();
+        final long certId = 1;
 
         //setting mock objects
         certService._accountMgr = Mockito.mock(AccountManager.class);
-        Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
+        final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
         when(certService._accountMgr.getAccount(anyLong())).thenReturn(account);
 
         certService._domainDao = Mockito.mock(DomainDao.class);
-        DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
+        final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
         when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain);
 
         certService._sslCertDao = Mockito.mock(SslCertDao.class);
@@ -641,10 +644,10 @@ public class CertServiceTest {
         when(certService._lbCertDao.listByCertId(anyLong())).thenReturn(null);
 
         //creating the command
-        DeleteSslCertCmd deleteCmd = new DeleteSslCertCmdExtn();
-        Class<?> _class = deleteCmd.getClass().getSuperclass();
+        final DeleteSslCertCmd deleteCmd = new DeleteSslCertCmdExtn();
+        final Class<?> klazz = deleteCmd.getClass().getSuperclass();
 
-        Field certField = _class.getDeclaredField("id");
+        final Field certField = klazz.getDeclaredField("id");
         certField.setAccessible(true);
         certField.set(deleteCmd, certId);
 
@@ -654,19 +657,19 @@ public class CertServiceTest {
     @Test
     public void runDeleteSslCertBoundCert() throws NoSuchFieldException, IllegalAccessException {
 
-        TransactionLegacy txn = TransactionLegacy.open("runDeleteSslCertBoundCert");
+        TransactionLegacy.open("runDeleteSslCertBoundCert");
 
-        CertServiceImpl certService = new CertServiceImpl();
+        final CertServiceImpl certService = new CertServiceImpl();
 
         //setting mock objects
-        long certId = 1;
+        final long certId = 1;
 
         certService._accountMgr = Mockito.mock(AccountManager.class);
-        Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
+        final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
         when(certService._accountMgr.getAccount(anyLong())).thenReturn(account);
 
         certService._domainDao = Mockito.mock(DomainDao.class);
-        DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
+        final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
         when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain);
 
         certService._sslCertDao = Mockito.mock(SslCertDao.class);
@@ -676,7 +679,7 @@ public class CertServiceTest {
         // rule holding the cert
         certService._lbCertDao = Mockito.mock(LoadBalancerCertMapDao.class);
 
-        List<LoadBalancerCertMapVO> lbMapList = new ArrayList<LoadBalancerCertMapVO>();
+        final List<LoadBalancerCertMapVO> lbMapList = new ArrayList<LoadBalancerCertMapVO>();
         lbMapList.add(new LoadBalancerCertMapVO());
 
         certService._lbCertDao = Mockito.mock(LoadBalancerCertMapDao.class);
@@ -686,17 +689,17 @@ public class CertServiceTest {
         when(certService._entityMgr.findById(eq(LoadBalancerVO.class), anyLong())).thenReturn(new LoadBalancerVO());
 
         //creating the command
-        DeleteSslCertCmd deleteCmd = new DeleteSslCertCmdExtn();
-        Class<?> _class = deleteCmd.getClass().getSuperclass();
+        final DeleteSslCertCmd deleteCmd = new DeleteSslCertCmdExtn();
+        final Class<?> klazz = deleteCmd.getClass().getSuperclass();
 
-        Field certField = _class.getDeclaredField("id");
+        final Field certField = klazz.getDeclaredField("id");
         certField.setAccessible(true);
         certField.set(deleteCmd, certId);
 
         try {
             certService.deleteSslCert(deleteCmd);
             fail("Delete with a cert id bound to a lb should fail");
-        } catch (Exception e) {
+        } catch (final Exception e) {
             assertTrue(e.getMessage().contains("Certificate in use by a loadbalancer"));
         }
 
@@ -704,17 +707,17 @@ public class CertServiceTest {
 
     @Test
     public void runDeleteSslCertInvalidId() throws NoSuchFieldException, IllegalAccessException {
-        TransactionLegacy txn = TransactionLegacy.open("runDeleteSslCertInvalidId");
+        TransactionLegacy.open("runDeleteSslCertInvalidId");
 
-        long certId = 1;
-        CertServiceImpl certService = new CertServiceImpl();
+        final long certId = 1;
+        final CertServiceImpl certService = new CertServiceImpl();
 
         certService._accountMgr = Mockito.mock(AccountManager.class);
-        Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
+        final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString());
         when(certService._accountMgr.getAccount(anyLong())).thenReturn(account);
 
         certService._domainDao = Mockito.mock(DomainDao.class);
-        DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
+        final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain");
         when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain);
 
         certService._sslCertDao = Mockito.mock(SslCertDao.class);
@@ -726,17 +729,17 @@ public class CertServiceTest {
         when(certService._lbCertDao.listByCertId(anyLong())).thenReturn(null);
 
         //creating the command
-        DeleteSslCertCmd deleteCmd = new DeleteSslCertCmdExtn();
-        Class<?> _class = deleteCmd.getClass().getSuperclass();
+        final DeleteSslCertCmd deleteCmd = new DeleteSslCertCmdExtn();
+        final Class<?> klazz = deleteCmd.getClass().getSuperclass();
 
-        Field certField = _class.getDeclaredField("id");
+        final Field certField = klazz.getDeclaredField("id");
         certField.setAccessible(true);
         certField.set(deleteCmd, certId);
 
         try {
             certService.deleteSslCert(deleteCmd);
             fail("Delete with an invalid ID should fail");
-        } catch (Exception e) {
+        } catch (final Exception e) {
             assertTrue(e.getMessage().contains("Invalid certificate id"));
         }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d82198a/utils/src/main/java/com/cloud/utils/security/CertificateHelper.java
----------------------------------------------------------------------
diff --git a/utils/src/main/java/com/cloud/utils/security/CertificateHelper.java b/utils/src/main/java/com/cloud/utils/security/CertificateHelper.java
index d43542f..fd05459 100644
--- a/utils/src/main/java/com/cloud/utils/security/CertificateHelper.java
+++ b/utils/src/main/java/com/cloud/utils/security/CertificateHelper.java
@@ -40,18 +40,19 @@ import java.security.spec.PKCS8EncodedKeySpec;
 import java.util.ArrayList;
 import java.util.List;
 
-import com.cloud.utils.exception.CloudRuntimeException;
 import org.apache.commons.codec.binary.Base64;
+import org.bouncycastle.util.io.pem.PemObject;
+import org.bouncycastle.util.io.pem.PemReader;
 
 import com.cloud.utils.Ternary;
-import org.bouncycastle.openssl.PEMReader;
+import com.cloud.utils.exception.CloudRuntimeException;
 
 public class CertificateHelper {
     public static byte[] buildAndSaveKeystore(String alias, String cert, String privateKey, String storePassword) throws KeyStoreException, CertificateException,
         NoSuchAlgorithmException, InvalidKeySpecException, IOException {
-        KeyStore ks = buildKeystore(alias, cert, privateKey, storePassword);
+        final KeyStore ks = buildKeystore(alias, cert, privateKey, storePassword);
 
-        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        final ByteArrayOutputStream os = new ByteArrayOutputStream();
         ks.store(os, storePassword != null ? storePassword.toCharArray() : null);
         os.close();
         return os.toByteArray();
@@ -59,18 +60,18 @@ public class CertificateHelper {
 
     public static byte[] buildAndSaveKeystore(List<Ternary<String, String, String>> certs, String storePassword) throws KeyStoreException, NoSuchAlgorithmException,
         CertificateException, IOException, InvalidKeySpecException {
-        KeyStore ks = KeyStore.getInstance("JKS");
+        final KeyStore ks = KeyStore.getInstance("JKS");
         ks.load(null, storePassword != null ? storePassword.toCharArray() : null);
 
         //name,cert,key
-        for (Ternary<String, String, String> cert : certs) {
+        for (final Ternary<String, String, String> cert : certs) {
             if (cert.third() == null) {
-                Certificate c = buildCertificate(cert.second());
+                final Certificate c = buildCertificate(cert.second());
                 ks.setCertificateEntry(cert.first(), c);
             } else {
-                Certificate[] c = new Certificate[certs.size()];
+                final Certificate[] c = new Certificate[certs.size()];
                 int i = certs.size();
-                for (Ternary<String, String, String> ct : certs) {
+                for (final Ternary<String, String, String> ct : certs) {
                     c[i - 1] = buildCertificate(ct.second());
                     i--;
                 }
@@ -78,15 +79,15 @@ public class CertificateHelper {
             }
         }
 
-        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        final ByteArrayOutputStream os = new ByteArrayOutputStream();
         ks.store(os, storePassword != null ? storePassword.toCharArray() : null);
         os.close();
         return os.toByteArray();
     }
 
     public static KeyStore loadKeystore(byte[] ksData, String storePassword) throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException {
-        assert (ksData != null);
-        KeyStore ks = KeyStore.getInstance("JKS");
+        assert ksData != null;
+        final KeyStore ks = KeyStore.getInstance("JKS");
         ks.load(new ByteArrayInputStream(ksData), storePassword != null ? storePassword.toCharArray() : null);
 
         return ks;
@@ -95,42 +96,46 @@ public class CertificateHelper {
     public static KeyStore buildKeystore(String alias, String cert, String privateKey, String storePassword) throws KeyStoreException, CertificateException,
         NoSuchAlgorithmException, InvalidKeySpecException, IOException {
 
-        KeyStore ks = KeyStore.getInstance("JKS");
+        final KeyStore ks = KeyStore.getInstance("JKS");
         ks.load(null, storePassword != null ? storePassword.toCharArray() : null);
-        Certificate[] certs = new Certificate[1];
+        final Certificate[] certs = new Certificate[1];
         certs[0] = buildCertificate(cert);
         ks.setKeyEntry(alias, buildPrivateKey(privateKey), storePassword != null ? storePassword.toCharArray() : null, certs);
         return ks;
     }
 
     public static Certificate buildCertificate(String content) throws CertificateException {
-        assert (content != null);
+        assert content != null;
 
-        BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(content.getBytes()));
-        CertificateFactory cf = CertificateFactory.getInstance("X.509");
+        final BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(content.getBytes()));
+        final CertificateFactory cf = CertificateFactory.getInstance("X.509");
         return cf.generateCertificate(bis);
     }
 
     public static Key buildPrivateKey(String base64EncodedKeyContent) throws NoSuchAlgorithmException, InvalidKeySpecException, IOException {
-        KeyFactory kf = KeyFactory.getInstance("RSA");
-        PKCS8EncodedKeySpec keysp = new PKCS8EncodedKeySpec(Base64.decodeBase64(base64EncodedKeyContent));
+        final KeyFactory kf = KeyFactory.getInstance("RSA");
+        final PKCS8EncodedKeySpec keysp = new PKCS8EncodedKeySpec(Base64.decodeBase64(base64EncodedKeyContent));
         return kf.generatePrivate(keysp);
     }
 
-    public static List<Certificate> parseChain(String chain) throws IOException {
+    public static List<Certificate> parseChain(String chain) throws IOException, CertificateException {
 
-        List<Certificate> certs = new ArrayList<Certificate>();
-        PEMReader reader = new PEMReader(new StringReader(chain));
+        final List<Certificate> certs = new ArrayList<Certificate>();
+        final PemReader pemReader = new PemReader(new StringReader(chain));
 
         Certificate crt = null;
+        final PemObject pemObject = pemReader.readPemObject();
+        final ByteArrayInputStream bais = new ByteArrayInputStream(pemObject.getContent());
+        final CertificateFactory certificateFactory = CertificateFactory.getInstance("X509");
 
-        while ((crt = (Certificate)reader.readObject()) != null) {
+        while ((crt = certificateFactory.generateCertificate(bais)) != null) {
             if (crt instanceof X509Certificate) {
                 certs.add(crt);
             }
         }
-        if (certs.size() == 0)
+        if (certs.size() == 0) {
             throw new IllegalArgumentException("Unable to decode certificate chain");
+        }
 
         return certs;
     }
@@ -139,24 +144,24 @@ public class CertificateHelper {
 
         final char[] HEX = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
 
-        StringBuilder buffer = new StringBuilder(60);
+        final StringBuilder buffer = new StringBuilder(60);
         try {
 
-            MessageDigest md = MessageDigest.getInstance("SHA-1");
-            byte[] data = md.digest(cert.getEncoded());
+            final MessageDigest md = MessageDigest.getInstance("SHA-1");
+            final byte[] data = md.digest(cert.getEncoded());
 
-            for (int i = 0; i < data.length; i++) {
+            for (final byte element : data) {
                 if (buffer.length() > 0) {
                     buffer.append(":");
                 }
 
-                buffer.append(HEX[(0xF0 & data[i]) >>> 4]);
-                buffer.append(HEX[0x0F & data[i]]);
+                buffer.append(HEX[(0xF0 & element) >>> 4]);
+                buffer.append(HEX[0x0F & element]);
             }
 
-        } catch (CertificateEncodingException e) {
+        } catch (final CertificateEncodingException e) {
             throw new CloudRuntimeException("Bad certificate encoding");
-        } catch (NoSuchAlgorithmException e) {
+        } catch (final NoSuchAlgorithmException e) {
             throw new CloudRuntimeException("Bad certificate algorithm");
         }
 


[05/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1230 from SafeSwissCloud/CLOUDSTACK-8302

CLOUDSTACK-8302: Removing snapshots on RBDSnapshot removing implemented if primary datastore is RBD
https://issues.apache.org/jira/browse/CLOUDSTACK-8302

* pr/1230:
  CLOUDSTACK-8302 - Cleanup snapshot on KVM with RBD Snapshot removing implemented on RBD. 1. On management side: when created new shanpshot we checking if our primary storage is RBD, then do not remove record from cloud.snapshot_store_ref with link to Ceph image via 'install_path' field. 2. On management side: when removing snapshot, also send command to agent 'DeleteCommand'. 3. On agent side: method implemented 'public Answer deleteSnapshot(final DeleteCommand cmd)'

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: c9319e21fb33eaab42dee90cbfedd88eff23e842
Parents: b828654 10ae2af
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 4 10:26:01 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 4 10:26:01 2016 -0400

----------------------------------------------------------------------
 engine/storage/snapshot/pom.xml                 |  5 +++
 .../snapshot/XenserverSnapshotStrategy.java     | 26 ++++++++----
 .../kvm/storage/KVMStorageProcessor.java        | 43 +++++++++++++++++++-
 3 files changed, 64 insertions(+), 10 deletions(-)
----------------------------------------------------------------------



[19/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
CLOUDSTACK-9351: Add ids parameter to resource listing API calls


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: baa861006127daf0da7d762a2913cd6b9c458588
Parents: 6d0c92b
Author: nvazquez <ni...@gmail.com>
Authored: Tue Apr 12 10:57:55 2016 -0700
Committer: nvazquez <ni...@gmail.com>
Committed: Fri May 6 14:42:42 2016 -0300

----------------------------------------------------------------------
 .../org/apache/cloudstack/api/ApiConstants.java |   1 +
 .../command/user/snapshot/ListSnapshotsCmd.java |   7 ++
 .../command/user/template/ListTemplatesCmd.java |   8 ++
 .../user/vmsnapshot/ListVMSnapshotCmd.java      |   7 ++
 .../api/command/user/volume/ListVolumesCmd.java |   8 ++
 .../query/MutualExclusiveIdsManagerBase.java    |  62 +++++++++++
 .../com/cloud/api/query/QueryManagerImpl.java   |  21 +++-
 .../storage/snapshot/SnapshotManagerImpl.java   |   9 +-
 .../vm/snapshot/VMSnapshotManagerImpl.java      |   9 +-
 .../MutualExclusiveIdsManagerBaseTest.java      | 102 +++++++++++++++++++
 10 files changed, 225 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/baa86100/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index ef4ff9a..6f3152b 100644
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -551,6 +551,7 @@ public class ApiConstants {
     public static final String VM_SNAPSHOT_DESCRIPTION = "description";
     public static final String VM_SNAPSHOT_DISPLAYNAME = "name";
     public static final String VM_SNAPSHOT_ID = "vmsnapshotid";
+    public static final String VM_SNAPSHOT_IDS = "vmsnapshotids";
     public static final String VM_SNAPSHOT_DISK_IDS = "vmsnapshotdiskids";
     public static final String VM_SNAPSHOT_MEMORY = "snapshotmemory";
     public static final String VM_SNAPSHOT_QUIESCEVM = "quiescevm";

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/baa86100/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
index 47a6876..97bb187 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
@@ -48,6 +48,9 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
     @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SnapshotResponse.class, description = "lists snapshot by snapshot ID")
     private Long id;
 
+    @Parameter(name=ApiConstants.IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=SnapshotResponse.class, description="the IDs of the snapshots, mutually exclusive with id", since = "4.9")
+    private List<Long> ids;
+
     @Parameter(name = ApiConstants.INTERVAL_TYPE, type = CommandType.STRING, description = "valid values are HOURLY, DAILY, WEEKLY, and MONTHLY.")
     private String intervalType;
 
@@ -120,4 +123,8 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
 
         setResponseObject(response);
     }
+
+    public List<Long> getIds() {
+        return ids;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/baa86100/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
index 7a2a158..772ca27 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
@@ -18,6 +18,7 @@ package org.apache.cloudstack.api.command.user.template;
 
 import org.apache.log4j.Logger;
 
+import java.util.List;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiCommandJobType;
 import org.apache.cloudstack.api.ApiConstants;
@@ -50,6 +51,9 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
     @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "the template ID")
     private Long id;
 
+    @Parameter(name=ApiConstants.IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=TemplateResponse.class, description="the IDs of the templates, mutually exclusive with id", since = "4.9")
+    private List<Long> ids;
+
     @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the template name")
     private String templateName;
 
@@ -132,4 +136,8 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
         response.setResponseName(getCommandName());
         setResponseObject(response);
     }
+
+    public List<Long> getIds() {
+        return ids;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/baa86100/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java
index c9bc243..ad5126e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java
@@ -39,6 +39,9 @@ public class ListVMSnapshotCmd extends BaseListTaggedResourcesCmd {
     @Parameter(name = ApiConstants.VM_SNAPSHOT_ID, type = CommandType.UUID, entityType = VMSnapshotResponse.class, description = "The ID of the VM snapshot")
     private Long id;
 
+    @Parameter(name=ApiConstants.VM_SNAPSHOT_IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=VMSnapshotResponse.class, description="the IDs of the vm snapshots, mutually exclusive with vmsnapshotid", since = "4.9")
+    private List<Long> ids;
+
     @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "state of the virtual machine snapshot")
     private String state;
 
@@ -84,4 +87,8 @@ public class ListVMSnapshotCmd extends BaseListTaggedResourcesCmd {
         return s_name;
     }
 
+    public List<Long> getIds() {
+        return ids;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/baa86100/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java
index cc218f7..059def7 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java
@@ -18,6 +18,7 @@ package org.apache.cloudstack.api.command.user.volume;
 
 import org.apache.log4j.Logger;
 
+import java.util.List;
 import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiCommandJobType;
@@ -53,6 +54,9 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd {
     @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VolumeResponse.class, description = "the ID of the disk volume")
     private Long id;
 
+    @Parameter(name=ApiConstants.IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=VolumeResponse.class, description="the IDs of the volumes, mutually exclusive with id", since = "4.9")
+    private List<Long> ids;
+
     @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the disk volume")
     private String volumeName;
 
@@ -153,4 +157,8 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd {
         response.setResponseName(getCommandName());
         setResponseObject(response);
     }
+
+    public List<Long> getIds() {
+        return ids;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/baa86100/server/src/com/cloud/api/query/MutualExclusiveIdsManagerBase.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/MutualExclusiveIdsManagerBase.java b/server/src/com/cloud/api/query/MutualExclusiveIdsManagerBase.java
new file mode 100755
index 0000000..c7b3222
--- /dev/null
+++ b/server/src/com/cloud/api/query/MutualExclusiveIdsManagerBase.java
@@ -0,0 +1,62 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+package com.cloud.api.query;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.utils.component.ManagerBase;
+import com.cloud.utils.db.SearchCriteria;
+
+public class MutualExclusiveIdsManagerBase extends ManagerBase {
+
+    /***
+     * Include ids list in query criteria if ids is not null
+     * @param sc search criteria, class type SearchCriteria<Z>
+     * @param ids ids list, class type List<T>
+     */
+    protected <Z,T> void setIdsListToSearchCriteria(SearchCriteria<Z> sc, List<T> ids){
+        if (ids != null && !ids.isEmpty()) {
+            sc.setParameters("idIN", ids.toArray());
+        }
+    }
+
+    /***
+     * Mutually exclusive parameters id and ids for API calls.<br/>
+     * Retrieve a list of ids or a list containing id depending on which of them is not null, or null if both are null
+     * @param id entity id, class type T
+     * @param ids entities ids, class type List<T>
+     * @return if id is not null return a list containing id else return ids, if both parameters are null -> return null
+     * @throws InvalidParameterValueException - if id and ids are both not null
+     */
+    protected <T> List<T> getIdsListFromCmd(T id, List<T> ids){
+        List<T> idsList = null;
+        if (id != null) {
+            if (ids != null && !ids.isEmpty()) {
+                throw new InvalidParameterValueException("Specify either id or ids but not both parameters");
+            }
+            idsList = new ArrayList<T>();
+            idsList.add(id);
+        } else {
+            idsList = ids;
+        }
+        return idsList;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/baa86100/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index 9492957..781b195 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -205,7 +205,6 @@ import com.cloud.utils.DateUtil;
 import com.cloud.utils.Pair;
 import com.cloud.utils.StringUtils;
 import com.cloud.utils.Ternary;
-import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.Filter;
 import com.cloud.utils.db.JoinBuilder;
 import com.cloud.utils.db.SearchBuilder;
@@ -222,7 +221,7 @@ import com.cloud.vm.dao.UserVmDetailsDao;
 import com.cloud.vm.dao.VMInstanceDao;
 
 @Component
-public class QueryManagerImpl extends ManagerBase implements QueryService, Configurable {
+public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements QueryService, Configurable {
 
     public static final Logger s_logger = Logger.getLogger(QueryManagerImpl.class);
 
@@ -1731,6 +1730,8 @@ public class QueryManagerImpl extends ManagerBase implements QueryService, Confi
         Long zoneId = cmd.getZoneId();
         Long podId = cmd.getPodId();
 
+        List<Long> ids = getIdsListFromCmd(cmd.getId(), cmd.getIds());
+
         Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Ternary<Long, Boolean, ListProjectResourcesCriteria>(
                 cmd.getDomainId(), cmd.isRecursive(), null);
         _accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts,
@@ -1754,6 +1755,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService, Confi
 
         sb.and("name", sb.entity().getName(), SearchCriteria.Op.EQ);
         sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
+        sb.and("idIN", sb.entity().getId(), SearchCriteria.Op.IN);
         sb.and("volumeType", sb.entity().getVolumeType(), SearchCriteria.Op.LIKE);
         sb.and("instanceId", sb.entity().getVmId(), SearchCriteria.Op.EQ);
         sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
@@ -1790,6 +1792,8 @@ public class QueryManagerImpl extends ManagerBase implements QueryService, Confi
             sc.setParameters("display", display);
         }
 
+        setIdsListToSearchCriteria(sc, ids);
+
         sc.setParameters("systemUse", 1);
 
         if (tags != null && !tags.isEmpty()) {
@@ -3077,14 +3081,15 @@ public class QueryManagerImpl extends ManagerBase implements QueryService, Confi
 
         return searchForTemplatesInternal(id, cmd.getTemplateName(), cmd.getKeyword(), templateFilter, false, null,
                 cmd.getPageSizeVal(), cmd.getStartIndex(), cmd.getZoneId(), hypervisorType, showDomr,
-                cmd.listInReadyState(), permittedAccounts, caller, listProjectResourcesCriteria, tags, showRemovedTmpl);
+                cmd.listInReadyState(), permittedAccounts, caller, listProjectResourcesCriteria, tags, showRemovedTmpl,
+                cmd.getIds());
     }
 
     private Pair<List<TemplateJoinVO>, Integer> searchForTemplatesInternal(Long templateId, String name,
             String keyword, TemplateFilter templateFilter, boolean isIso, Boolean bootable, Long pageSize,
             Long startIndex, Long zoneId, HypervisorType hyperType, boolean showDomr, boolean onlyReady,
             List<Account> permittedAccounts, Account caller, ListProjectResourcesCriteria listProjectResourcesCriteria,
-            Map<String, String> tags, boolean showRemovedTmpl) {
+            Map<String, String> tags, boolean showRemovedTmpl, List<Long> ids) {
 
         // check if zone is configured, if not, just return empty list
         List<HypervisorType> hypers = null;
@@ -3104,6 +3109,9 @@ public class QueryManagerImpl extends ManagerBase implements QueryService, Confi
 
         SearchBuilder<TemplateJoinVO> sb = _templateJoinDao.createSearchBuilder();
         sb.select(null, Func.DISTINCT, sb.entity().getTempZonePair()); // select distinct (templateId, zoneId) pair
+        if (ids != null && !ids.isEmpty()){
+            sb.and("idIN", sb.entity().getId(), SearchCriteria.Op.IN);
+        }
         SearchCriteria<TemplateJoinVO> sc = sb.create();
 
         // verify templateId parameter and specially handle it
@@ -3149,6 +3157,8 @@ public class QueryManagerImpl extends ManagerBase implements QueryService, Confi
             // hypers = _resourceMgr.listAvailHypervisorInZone(null, null);
             // }
 
+            setIdsListToSearchCriteria(sc, ids);
+
             // add criteria for project or not
             if (listProjectResourcesCriteria == ListProjectResourcesCriteria.SkipProjectResources) {
                 sc.addAnd("accountType", SearchCriteria.Op.NEQ, Account.ACCOUNT_TYPE_PROJECT);
@@ -3386,7 +3396,8 @@ public class QueryManagerImpl extends ManagerBase implements QueryService, Confi
 
         return searchForTemplatesInternal(cmd.getId(), cmd.getIsoName(), cmd.getKeyword(), isoFilter, true,
                 cmd.isBootable(), cmd.getPageSizeVal(), cmd.getStartIndex(), cmd.getZoneId(), hypervisorType, true,
-                cmd.listInReadyState(), permittedAccounts, caller, listProjectResourcesCriteria, tags, showRemovedISO);
+                cmd.listInReadyState(), permittedAccounts, caller, listProjectResourcesCriteria, tags, showRemovedISO,
+                null);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/baa86100/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
index 65f5140..757ab61 100644
--- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -58,6 +58,7 @@ import com.cloud.agent.api.Command;
 import com.cloud.agent.api.DeleteSnapshotsDirCommand;
 import com.cloud.alert.AlertManager;
 import com.cloud.api.commands.ListRecurringSnapshotScheduleCmd;
+import com.cloud.api.query.MutualExclusiveIdsManagerBase;
 import com.cloud.configuration.Config;
 import com.cloud.configuration.Resource.ResourceType;
 import com.cloud.dc.ClusterVO;
@@ -112,7 +113,6 @@ import com.cloud.utils.DateUtil.IntervalType;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
 import com.cloud.utils.Ternary;
-import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.Filter;
 import com.cloud.utils.db.JoinBuilder;
@@ -129,7 +129,7 @@ import com.cloud.vm.snapshot.VMSnapshotVO;
 import com.cloud.vm.snapshot.dao.VMSnapshotDao;
 
 @Component
-public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, SnapshotApiService {
+public class SnapshotManagerImpl extends MutualExclusiveIdsManagerBase implements SnapshotManager, SnapshotApiService {
     private static final Logger s_logger = Logger.getLogger(SnapshotManagerImpl.class);
     @Inject
     VMTemplateDao _templateDao;
@@ -512,6 +512,8 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
             }
         }
 
+        List<Long> ids = getIdsListFromCmd(cmd.getId(), cmd.getIds());
+
         Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Ternary<Long, Boolean, ListProjectResourcesCriteria>(cmd.getDomainId(), cmd.isRecursive(), null);
        _accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
        Long domainId = domainIdRecursiveListProject.first();
@@ -526,6 +528,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
         sb.and("volumeId", sb.entity().getVolumeId(), SearchCriteria.Op.EQ);
         sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
         sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
+        sb.and("idIN", sb.entity().getId(), SearchCriteria.Op.IN);
         sb.and("snapshotTypeEQ", sb.entity().getsnapshotType(), SearchCriteria.Op.IN);
         sb.and("snapshotTypeNEQ", sb.entity().getsnapshotType(), SearchCriteria.Op.NEQ);
         sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
@@ -565,6 +568,8 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
             sc.setParameters("dataCenterId", zoneId);
         }
 
+        setIdsListToSearchCriteria(sc, ids);
+
         if (name != null) {
             sc.setParameters("name", "%" + name + "%");
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/baa86100/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java b/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
index c113e3c..d8f4596 100644
--- a/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
+++ b/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
@@ -46,6 +46,7 @@ import org.apache.cloudstack.framework.jobs.impl.VmWorkJobVO;
 import org.apache.cloudstack.jobs.JobInfo;
 import org.apache.cloudstack.utils.identity.ManagementServerNode;
 
+import com.cloud.api.query.MutualExclusiveIdsManagerBase;
 import com.cloud.event.ActionEvent;
 import com.cloud.event.EventTypes;
 import com.cloud.exception.ConcurrentOperationException;
@@ -77,7 +78,6 @@ import com.cloud.utils.Pair;
 import com.cloud.utils.Predicate;
 import com.cloud.utils.ReflectionUse;
 import com.cloud.utils.Ternary;
-import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.Filter;
 import com.cloud.utils.db.SearchBuilder;
@@ -99,7 +99,7 @@ import com.cloud.vm.dao.VMInstanceDao;
 import com.cloud.vm.snapshot.dao.VMSnapshotDao;
 
 @Component
-public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotManager, VMSnapshotService, VmWorkJobHandler {
+public class VMSnapshotManagerImpl extends MutualExclusiveIdsManagerBase implements VMSnapshotManager, VMSnapshotService, VmWorkJobHandler {
     private static final Logger s_logger = Logger.getLogger(VMSnapshotManagerImpl.class);
 
     public static final String VM_WORK_JOB_HANDLER = VMSnapshotManagerImpl.class.getSimpleName();
@@ -176,6 +176,8 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
         String name = cmd.getVmSnapshotName();
         String accountName = cmd.getAccountName();
 
+        List<Long> ids = getIdsListFromCmd(cmd.getId(), cmd.getIds());
+
         Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Ternary<Long, Boolean, ListProjectResourcesCriteria>(
                 cmd.getDomainId(), cmd.isRecursive(), null);
         _accountMgr.buildACLSearchParameters(caller, id, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, listAll,
@@ -193,6 +195,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
         sb.and("status", sb.entity().getState(), SearchCriteria.Op.IN);
         sb.and("state", sb.entity().getState(), SearchCriteria.Op.EQ);
         sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
+        sb.and("idIN", sb.entity().getId(), SearchCriteria.Op.IN);
         sb.and("display_name", sb.entity().getDisplayName(), SearchCriteria.Op.EQ);
         sb.and("account_id", sb.entity().getAccountId(), SearchCriteria.Op.EQ);
         sb.done();
@@ -209,6 +212,8 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
             sc.setParameters("vm_id", vmId);
         }
 
+        setIdsListToSearchCriteria(sc, ids);
+
         if (domainId != null) {
             sc.setParameters("domain_id", domainId);
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/baa86100/server/test/com/cloud/api/query/MutualExclusiveIdsManagerBaseTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/api/query/MutualExclusiveIdsManagerBaseTest.java b/server/test/com/cloud/api/query/MutualExclusiveIdsManagerBaseTest.java
new file mode 100755
index 0000000..a4d9261
--- /dev/null
+++ b/server/test/com/cloud/api/query/MutualExclusiveIdsManagerBaseTest.java
@@ -0,0 +1,102 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 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.query;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.never;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.utils.db.SearchCriteria;
+
+@RunWith(MockitoJUnitRunner.class)
+public class MutualExclusiveIdsManagerBaseTest {
+
+    @Mock
+    SearchCriteria<String> sc;
+
+    private static Long id1 = 1L;
+    private static Long id2 = 2L;
+
+    private List<Long> idsList;
+    private List<Long> idsEmptyList;
+    private List<Long> expectedListId;
+    private List<Long> expectedListIds;
+
+    private MutualExclusiveIdsManagerBase mgr = new MutualExclusiveIdsManagerBase();
+
+    @Before
+    public void setup() {
+        idsList = Arrays.asList(id1, id2);
+        idsEmptyList = Arrays.asList();
+        expectedListId = Arrays.asList(id1);
+        expectedListIds = Arrays.asList(id1, id2);
+    }
+
+    @Test
+    public void testSetIdsListToSearchCriteria(){
+        mgr.setIdsListToSearchCriteria(sc, idsList);
+        Mockito.verify(sc).setParameters(Mockito.same("idIN"), Mockito.same(id1), Mockito.same(id2));
+    }
+
+    @Test
+    public void testSetIdsListToSearchCriteriaEmptyList(){
+        mgr.setIdsListToSearchCriteria(sc, idsEmptyList);
+        Mockito.verify(sc, never()).setParameters(Mockito.anyString(), Mockito.any());
+    }
+
+    @Test
+    public void testGetIdsListId(){
+        List<Long> result = mgr.getIdsListFromCmd(id1, idsEmptyList);
+        assertEquals(expectedListId, result);
+    }
+
+    @Test
+    public void testGetIdsListProvideList(){
+        List<Long> result = mgr.getIdsListFromCmd(null, idsList);
+        assertEquals(expectedListIds, result);
+    }
+
+    @Test(expected=InvalidParameterValueException.class)
+    public void testGetIdsListBothNotNull(){
+        mgr.getIdsListFromCmd(id1, idsList);
+    }
+
+    @Test
+    public void testGetIdsListBothNull(){
+        List<Long> result = mgr.getIdsListFromCmd(null, null);
+        assertNull(result);
+    }
+
+    @Test
+    public void testGetIdsEmptyListIdNull(){
+        List<Long> result = mgr.getIdsListFromCmd(null, idsEmptyList);
+        assertEquals(idsEmptyList, result);
+    }
+}


[45/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge release branch 4.8 to master

* 4.8:
  When no zone name is available display a default


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: dc5b52937bf9c14634452ed47a851a689a3015c4
Parents: 456680d 72811b4
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 11 01:32:02 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 11 01:32:02 2016 -0400

----------------------------------------------------------------------
 ui/scripts/templates.js | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------



[31/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1488 from wido/agent-ipv6-enable

agent: Enable IPv6 connectivity for KVM Agent to Management ServerIPv4 is still preferred, so if the hostname of the Management Server
returns a A and AAAA-record the Agent will still connect to the
server over IPv4.

This situation will however allow to use a hostname which only has
a AAAA-record. In that case the Agent will connect to the Management
Server over IPv6.

* pr/1488:
  agent: Enable IPv6 connectivity for KVM Agent to Management Server

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 726ee47e9805c9a5fb633187628061bc96b861f8
Parents: d2a95b4 16651fe
Author: Will Stevens <wi...@gmail.com>
Authored: Tue May 10 23:55:28 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Tue May 10 23:55:28 2016 -0400

----------------------------------------------------------------------
 agent/src/com/cloud/agent/AgentShell.java | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------



[38/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapCreateAccountCmd.java
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapCreateAccountCmd.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapCreateAccountCmd.java
index 1968f85..d845857 100644
--- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapCreateAccountCmd.java
+++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapCreateAccountCmd.java
@@ -16,12 +16,12 @@
 // under the License.
 package org.apache.cloudstack.api.command;
 
-import java.io.UnsupportedEncodingException;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
-import java.util.Map;
-
-import javax.inject.Inject;
+import com.cloud.domain.DomainVO;
+import com.cloud.user.Account;
+import com.cloud.user.AccountService;
+import com.cloud.user.User;
+import com.cloud.user.UserAccount;
+import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.ApiErrorCode;
@@ -31,6 +31,7 @@ import org.apache.cloudstack.api.ResponseObject.ResponseView;
 import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.response.AccountResponse;
 import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.RoleResponse;
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.ldap.LdapManager;
 import org.apache.cloudstack.ldap.LdapUser;
@@ -38,11 +39,11 @@ import org.apache.cloudstack.ldap.NoLdapUserMatchingQueryException;
 import org.apache.log4j.Logger;
 import org.bouncycastle.util.encoders.Base64;
 
-import com.cloud.domain.DomainVO;
-import com.cloud.user.Account;
-import com.cloud.user.AccountService;
-import com.cloud.user.User;
-import com.cloud.user.UserAccount;
+import javax.inject.Inject;
+import java.io.UnsupportedEncodingException;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.util.Map;
 
 @APICommand(name = "ldapCreateAccount", description = "Creates an account from an LDAP user", responseObject = AccountResponse.class, since = "4.2.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
 public class LdapCreateAccountCmd extends BaseCmd {
@@ -55,9 +56,12 @@ public class LdapCreateAccountCmd extends BaseCmd {
     @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Creates the user under the specified account. If no account is specified, the username will be used as the account name.")
     private String accountName;
 
-    @Parameter(name = ApiConstants.ACCOUNT_TYPE, type = CommandType.SHORT, required = true, description = "Type of the account.  Specify 0 for user, 1 for root admin, and 2 for domain admin")
+    @Parameter(name = ApiConstants.ACCOUNT_TYPE, type = CommandType.SHORT, description = "Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin")
     private Short accountType;
 
+    @Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, entityType = RoleResponse.class, description = "Creates the account under the specified role.")
+    private Long roleId;
+
     @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Creates the user under the specified domain.")
     private Long domainId;
 
@@ -92,7 +96,7 @@ public class LdapCreateAccountCmd extends BaseCmd {
     UserAccount createCloudstackUserAccount(final LdapUser user, String accountName, Long domainId) {
         Account account = _accountService.getActiveAccountByName(accountName, domainId);
         if (account == null) {
-            return _accountService.createUserAccount(username, generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone, accountName, accountType,
+            return _accountService.createUserAccount(username, generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone, accountName, getAccountType(), getRoleId(),
                     domainId, networkDomain, details, accountUUID, userUUID, User.Source.LDAP);
         } else {
             User newUser = _accountService.createUser(username, generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone, accountName, domainId,
@@ -101,6 +105,14 @@ public class LdapCreateAccountCmd extends BaseCmd {
         }
     }
 
+    public Short getAccountType() {
+        return RoleType.getAccountTypeByRole(roleService.findRole(roleId), accountType);
+    }
+
+    public Long getRoleId() {
+        return RoleType.getRoleByAccountType(roleId, accountType);
+    }
+
     private String getAccountName() {
         String name = accountName;
         if (accountName == null) {
@@ -119,6 +131,9 @@ public class LdapCreateAccountCmd extends BaseCmd {
 
     @Override
     public void execute() throws ServerApiException {
+        if (getAccountType() == null && getRoleId() == null) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Both account type and role ID are not provided");
+        }
         final CallContext callContext = getCurrentContext();
         String finalAccountName = getAccountName();
         Long finalDomainId = getDomainId();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java
index 63549f1..9fdd700 100644
--- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java
+++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java
@@ -29,6 +29,7 @@ import javax.inject.Inject;
 import com.cloud.user.Account;
 import com.cloud.user.User;
 import com.cloud.user.UserAccount;
+import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.ApiErrorCode;
@@ -38,6 +39,7 @@ import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.response.DomainResponse;
 import org.apache.cloudstack.api.response.LdapUserResponse;
 import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.RoleResponse;
 import org.apache.cloudstack.ldap.LdapManager;
 import org.apache.cloudstack.ldap.LdapUser;
 import org.apache.cloudstack.ldap.NoLdapUserMatchingQueryException;
@@ -70,10 +72,12 @@ public class LdapImportUsersCmd extends BaseListCmd {
 
     @Parameter(name = ApiConstants.ACCOUNT_TYPE,
                type = CommandType.SHORT,
-               required = true,
                description = "Type of the account.  Specify 0 for user, 1 for root admin, and 2 for domain admin")
     private Short accountType;
 
+    @Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, entityType = RoleResponse.class, description = "Creates the account under the specified role.")
+    private Long roleId;
+
     @Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
     private Map<String, String> details;
 
@@ -112,7 +116,7 @@ public class LdapImportUsersCmd extends BaseListCmd {
         Account account = _accountService.getActiveAccountByName(accountName, domain.getId());
         if (account == null) {
             s_logger.debug("No account exists with name: " + accountName + " creating the account and an user with name: " + user.getUsername() + " in the account");
-            _accountService.createUserAccount(user.getUsername(), generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone, accountName, accountType,
+            _accountService.createUserAccount(user.getUsername(), generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone, accountName, getAccountType(), getRoleId(),
                     domain.getId(), domain.getNetworkDomain(), details, UUID.randomUUID().toString(), UUID.randomUUID().toString(), User.Source.LDAP);
         } else {
 //            check if the user exists. if yes, call update
@@ -131,7 +135,9 @@ public class LdapImportUsersCmd extends BaseListCmd {
     @Override
     public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
         ResourceAllocationException, NetworkRuleConflictException {
-
+        if (getAccountType() == null && getRoleId() == null) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Both account type and role ID are not provided");
+        }
         List<LdapUser> users;
         try {
             if (StringUtils.isNotBlank(groupName)) {
@@ -161,6 +167,14 @@ public class LdapImportUsersCmd extends BaseListCmd {
         setResponseObject(response);
     }
 
+    public Short getAccountType() {
+        return RoleType.getAccountTypeByRole(roleService.findRole(roleId), accountType);
+    }
+
+    public Long getRoleId() {
+        return RoleType.getRoleByAccountType(roleId, accountType);
+    }
+
     private String getAccountName(LdapUser user) {
         String finalAccountName = accountName;
         if(finalAccountName == null ) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LinkDomainToLdapCmd.java
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LinkDomainToLdapCmd.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LinkDomainToLdapCmd.java
index ae3e706..477e80f 100644
--- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LinkDomainToLdapCmd.java
+++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LinkDomainToLdapCmd.java
@@ -23,6 +23,7 @@ import javax.inject.Inject;
 import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.user.User;
 import com.cloud.user.UserAccount;
+import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.ApiErrorCode;
@@ -82,7 +83,7 @@ public class LinkDomainToLdapCmd extends BaseCmd {
                     if (account == null) {
                         try {
                             UserAccount userAccount = _accountService.createUserAccount(admin, "", ldapUser.getFirstname(), ldapUser.getLastname(), ldapUser.getEmail(), null,
-                                    admin, Account.ACCOUNT_TYPE_DOMAIN_ADMIN, domainId, null, null, UUID.randomUUID().toString(), UUID.randomUUID().toString(), User.Source.LDAP);
+                                    admin, Account.ACCOUNT_TYPE_DOMAIN_ADMIN, RoleType.DomainAdmin.getId(), domainId, null, null, UUID.randomUUID().toString(), UUID.randomUUID().toString(), User.Source.LDAP);
                             response.setAdminId(String.valueOf(userAccount.getAccountId()));
                             s_logger.info("created an account with name " + admin + " in the given domain " + domainId);
                         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapAuthenticator.java
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapAuthenticator.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapAuthenticator.java
index 5683b50..add39c5 100644
--- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapAuthenticator.java
+++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapAuthenticator.java
@@ -21,6 +21,7 @@ import java.util.UUID;
 
 import javax.inject.Inject;
 
+import org.apache.cloudstack.acl.RoleType;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 
@@ -119,7 +120,8 @@ public class LdapAuthenticator extends AdapterBase implements UserAuthenticator
 
     private void createCloudStackUserAccount(LdapUser user, long domainId, short accountType) {
         String username = user.getUsername();
-        _accountManager.createUserAccount(username, "", user.getFirstname(), user.getLastname(), user.getEmail(), null, username, accountType, domainId, null, null,
+        _accountManager.createUserAccount(username, "", user.getFirstname(), user.getLastname(), user.getEmail(), null, username,
+                                          accountType, RoleType.getByAccountType(accountType).getId(), domainId, null, null,
                                           UUID.randomUUID().toString(), UUID.randomUUID().toString(), User.Source.LDAP);
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapImportUsersCmdSpec.groovy
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapImportUsersCmdSpec.groovy b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapImportUsersCmdSpec.groovy
index 514caeb..434151a 100644
--- a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapImportUsersCmdSpec.groovy
+++ b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapImportUsersCmdSpec.groovy
@@ -246,7 +246,7 @@ class LdapImportUsersCmdSpec extends spock.lang.Specification {
         1 * accountService.getActiveAccountByName('ACCOUNT', 0) >>  Mock(AccountVO)
         1 * accountService.getActiveUserAccount('rmurphy',0) >> Mock(UserAccountVO)
         0 * accountService.createUser('rmurphy', _ , 'Ryan', 'Murphy', 'rmurphy@test.com', null, 'ACCOUNT', 0, _) >> Mock(UserVO)
-        0 * accountService.createUserAccount('rmurphy', _, 'Ryan', 'Murphy', 'rmurphy@test.com', null, 'ACCOUNT', 2, 0, 'DOMAIN', null, _, _)
+        0 * accountService.createUserAccount('rmurphy', _, 'Ryan', 'Murphy', 'rmurphy@test.com', null, 'ACCOUNT', 2, null, 0, 'DOMAIN', null, _, _)
         1 * accountService.updateUser(_,'Ryan', 'Murphy', 'rmurphy@test.com', null, null, null, null, null);
 
         def ldapImportUsersCmd = new LdapImportUsersCmd(ldapManager, domainService, accountService)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/scripts/util/migrate-dynamicroles.py
----------------------------------------------------------------------
diff --git a/scripts/util/migrate-dynamicroles.py b/scripts/util/migrate-dynamicroles.py
new file mode 100755
index 0000000..e97e94c
--- /dev/null
+++ b/scripts/util/migrate-dynamicroles.py
@@ -0,0 +1,136 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import os
+import sys
+import uuid
+
+from contextlib import closing
+from optparse import OptionParser
+
+try:
+    import MySQLdb
+except ImportError:
+    print("MySQLdb cannot be imported, please install python-mysqldb(apt) or mysql-python(yum)")
+    sys.exit(1)
+
+dryrun = False
+
+
+def runSql(conn, query):
+    if dryrun:
+        print("Running SQL query: " + query)
+        return
+    with closing(conn.cursor()) as cursor:
+        cursor.execute(query)
+
+
+def migrateApiRolePermissions(apis, conn):
+    # All allow for root admin role Admin(id:1)
+    runSql(conn, "INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 1, '*', 'ALLOW', 0);")
+    # Migrate rules based on commands.properties rule for ResourceAdmin(id:2), DomainAdmin(id:3), User(id:4)
+    octetKey = {2:2, 3:4, 4:8}
+    for role in [2, 3, 4]:
+        sortOrder = 0
+        for api in sorted(apis.keys()):
+            # Ignore auth commands
+            if api in ['login', 'logout', 'samlSso', 'samlSlo', 'listIdps', 'listAndSwitchSamlAccount', 'getSPMetadata']:
+                continue
+            if (octetKey[role] & int(apis[api])) > 0:
+                runSql(conn, "INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), %d, '%s', 'ALLOW', %d);" % (role, api, sortOrder))
+                sortOrder += 1
+
+
+def main():
+    parser = OptionParser()
+    parser.add_option("-b", "--db", action="store", type="string", dest="db", default="cloud",
+                        help="The name of the database, default: cloud")
+    parser.add_option("-u", "--user", action="store", type="string", dest="user", default="cloud",
+                        help="User name a MySQL user with privileges on cloud database")
+    parser.add_option("-p", "--password", action="store", type="string", dest="password", default="cloud",
+                        help="Password of a MySQL user with privileges on cloud database")
+    parser.add_option("-H", "--host", action="store", type="string", dest="host", default="127.0.0.1",
+                        help="Host or IP of the MySQL server")
+    parser.add_option("-P", "--port", action="store", type="int", dest="port", default=3306,
+                        help="Host or IP of the MySQL server")
+    parser.add_option("-f", "--properties-file", action="store", type="string", dest="commandsfile", default="/etc/cloudstack/management/commands.properties",
+                        help="The commands.properties file")
+    parser.add_option("-d", "--dryrun", action="store_true", dest="dryrun", default=False,
+                        help="Dry run and debug operations this tool will perform")
+    (options, args) = parser.parse_args()
+
+    print("Apache CloudStack Role Permission Migration Tool")
+    print("(c) Apache CloudStack Authors and the ASF, under the Apache License, Version 2.0\n")
+
+    global dryrun
+    if options.dryrun:
+        dryrun = True
+
+    conn = MySQLdb.connect(
+            host=options.host,
+            user=options.user,
+            passwd=options.password,
+            port=int(options.port),
+            db=options.db)
+
+    if not os.path.isfile(options.commandsfile):
+        print("Provided commands.properties cannot be accessed or does not exist, please check check permissions")
+        sys.exit(1)
+
+    while True:
+        choice = raw_input("Running this migration tool will remove any " +
+                           "default-role permissions from cloud.role_permissions. " +
+                           "Do you want to continue? [y/N]").lower()
+        if choice == 'y':
+            break
+        else:
+            print("Aborting!")
+            sys.exit(1)
+
+    # Generate API to permission octet map
+    apiMap = {}
+    with open(options.commandsfile) as f:
+        for line in f.readlines():
+            if not line or line == '' or line == '\n' or line.startswith('#'):
+                continue
+            name, value = line.split('=')
+            apiMap[name.strip()] = value.strip()
+
+    # Rename and deprecate old commands.properties file
+    if not dryrun:
+        os.rename(options.commandsfile, options.commandsfile + '.deprecated')
+    print("The commands.properties file has been deprecated and moved at: " + options.commandsfile + '.deprecated')
+
+    # Truncate any rules in cloud.role_permissions table
+    runSql(conn, "DELETE FROM `cloud`.`role_permissions` WHERE `role_id` in (1,2,3,4);")
+
+    # Migrate rules from commands.properties to cloud.role_permissions
+    migrateApiRolePermissions(apiMap, conn)
+    print("Static role permissions from commands.properties have been migrated into the db")
+
+    # Enable dynamic role based API checker
+    runSql(conn, "UPDATE `cloud`.`configuration` SET value='true' where name='dynamic.apichecker.enabled'")
+    conn.commit()
+    conn.close()
+
+    print("Dynamic role based API checker has been enabled!")
+
+
+if __name__ == '__main__':
+    main()

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
----------------------------------------------------------------------
diff --git a/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml b/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
index e39d918..6618e3e 100644
--- a/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
+++ b/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
@@ -37,6 +37,8 @@
                   value="#{pluggableAPIAuthenticatorsRegistry.registered}" />
     </bean>
 
+    <bean id="roleManagerImpl" class="org.apache.cloudstack.acl.RoleManagerImpl" />
+
     <bean id="accountManagerImpl" class="com.cloud.user.AccountManagerImpl">
         <property name="userAuthenticators"
             value="#{userAuthenticatorsRegistry.registered}" />

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/server/src/com/cloud/api/ApiDBUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java
index 1c55c67..d6b529f 100644
--- a/server/src/com/cloud/api/ApiDBUtils.java
+++ b/server/src/com/cloud/api/ApiDBUtils.java
@@ -27,6 +27,8 @@ import java.util.Set;
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 
+import org.apache.cloudstack.acl.Role;
+import org.apache.cloudstack.acl.RoleService;
 import org.apache.cloudstack.affinity.AffinityGroup;
 import org.apache.cloudstack.affinity.AffinityGroupResponse;
 import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
@@ -423,6 +425,7 @@ public class ApiDBUtils {
     static AffinityGroupJoinDao s_affinityGroupJoinDao;
     static GlobalLoadBalancingRulesService s_gslbService;
     static NetworkACLDao s_networkACLDao;
+    static RoleService s_roleService;
     static AccountService s_accountService;
     static ResourceMetaDataService s_resourceDetailsService;
     static HostGpuGroupsDao s_hostGpuGroupsDao;
@@ -646,6 +649,8 @@ public class ApiDBUtils {
     @Inject
     private NetworkACLDao networkACLDao;
     @Inject
+    private RoleService roleService;
+    @Inject
     private AccountService accountService;
     @Inject
     private ConfigurationManager configMgr;
@@ -768,6 +773,7 @@ public class ApiDBUtils {
         // Note: stats collector should already have been initialized by this time, otherwise a null instance is returned
         s_statsCollector = StatsCollector.getInstance();
         s_networkACLDao = networkACLDao;
+        s_roleService = roleService;
         s_accountService = accountService;
         s_resourceDetailsService = resourceDetailsService;
         s_hostGpuGroupsDao = hostGpuGroupsDao;
@@ -1695,6 +1701,15 @@ public class ApiDBUtils {
 
     public static UserResponse newUserResponse(UserAccountJoinVO usr, Long domainId) {
         UserResponse response = s_userAccountJoinDao.newUserResponse(usr);
+        // Populate user account role information
+        if (usr.getAccountRoleId() != null) {
+            Role role = s_roleService.findRole( usr.getAccountRoleId());
+            if (role != null) {
+                response.setRoleId(role.getUuid());
+                response.setRoleType(role.getRoleType());
+                response.setRoleName(role.getName());
+            }
+        }
         if (domainId != null && usr.getDomainId() != domainId)
             response.setIsCallerChildDomain(true);
         else
@@ -1820,7 +1835,17 @@ public class ApiDBUtils {
     }
 
     public static AccountResponse newAccountResponse(ResponseView view, AccountJoinVO ve) {
-        return s_accountJoinDao.newAccountResponse(view, ve);
+        AccountResponse response = s_accountJoinDao.newAccountResponse(view, ve);
+        // Populate account role information
+        if (ve.getRoleId() != null) {
+            Role role = s_roleService.findRole(ve.getRoleId());
+            if (role != null) {
+                response.setRoleId(role.getUuid());
+                response.setRoleType(role.getRoleType());
+                response.setRoleName(role.getName());
+            }
+        }
+        return response;
     }
 
     public static AccountJoinVO newAccountView(Account e) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/server/src/com/cloud/api/ApiResponseGsonHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseGsonHelper.java b/server/src/com/cloud/api/ApiResponseGsonHelper.java
index 1708fa7..19db96a 100644
--- a/server/src/com/cloud/api/ApiResponseGsonHelper.java
+++ b/server/src/com/cloud/api/ApiResponseGsonHelper.java
@@ -68,7 +68,7 @@ public class ApiResponseGsonHelper {
                     boolean permittedParameter = false;
                     Account caller = CallContext.current().getCallingAccount();
                     for (RoleType allowedRole : allowedRoles) {
-                        if (allowedRole.getValue() == caller.getType()) {
+                        if (allowedRole.getAccountType() == caller.getType()) {
                             permittedParameter = true;
                             break;
                         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java
index 6ec2f18..d7da425 100644
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -797,15 +797,15 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
                     s_logger.debug(ex.getMessage());
                     throw new ServerApiException(ApiErrorCode.API_LIMIT_EXCEED, ex.getMessage());
                 } catch (final 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(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, "The given command does not exist or it is not available for user");
+                    s_logger.debug("The user with id:" + userId + " is not allowed to request the API command or the API command does not exist: " + commandName);
+                    throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, "The user is not allowed to request the API command or the API command does not exist");
                 }
                 return true;
             } else {
                 // check against every available command to see if the command exists or not
                 if (!s_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(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, "The given command does not exist or it is not available for user");
+                    s_logger.debug("The user with id:" + userId + " is not allowed to request the API command or the API command does not exist: " + commandName);
+                    throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, "The user is not allowed to request the API command or the API command does not exist");
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/server/src/com/cloud/api/query/vo/AccountJoinVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/vo/AccountJoinVO.java b/server/src/com/cloud/api/query/vo/AccountJoinVO.java
index 8d642ed..f251abc 100644
--- a/server/src/com/cloud/api/query/vo/AccountJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/AccountJoinVO.java
@@ -48,6 +48,9 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity, Ident
     @Column(name = "type")
     private short type;
 
+    @Column(name = "role_id")
+    private Long roleId;
+
     @Column(name = "state")
     @Enumerated(value = EnumType.STRING)
     private State state;
@@ -202,6 +205,10 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity, Ident
         return type;
     }
 
+    public Long getRoleId() {
+        return roleId;
+    }
+
     public State getState() {
         return state;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/server/src/com/cloud/api/query/vo/UserAccountJoinVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/vo/UserAccountJoinVO.java b/server/src/com/cloud/api/query/vo/UserAccountJoinVO.java
index 0e66ca0..e6b1ace 100644
--- a/server/src/com/cloud/api/query/vo/UserAccountJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/UserAccountJoinVO.java
@@ -96,6 +96,9 @@ public class UserAccountJoinVO extends BaseViewVO implements InternalIdentity, I
     @Column(name = "account_type")
     private short accountType;
 
+    @Column(name = "account_role_id")
+    private Long accountRoleId;
+
     @Column(name = "domain_id")
     private long domainId;
 
@@ -149,6 +152,10 @@ public class UserAccountJoinVO extends BaseViewVO implements InternalIdentity, I
         return accountType;
     }
 
+    public Long getAccountRoleId() {
+        return accountRoleId;
+    }
+
     public long getDomainId() {
         return domainId;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/server/src/com/cloud/api/response/ApiResponseSerializer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/response/ApiResponseSerializer.java b/server/src/com/cloud/api/response/ApiResponseSerializer.java
index 59426e6..2b9717d 100644
--- a/server/src/com/cloud/api/response/ApiResponseSerializer.java
+++ b/server/src/com/cloud/api/response/ApiResponseSerializer.java
@@ -251,7 +251,7 @@ public class ApiResponseSerializer {
                     boolean permittedParameter = false;
                     Account caller = CallContext.current().getCallingAccount();
                     for (RoleType allowedRole : allowedRoles) {
-                        if (allowedRole.getValue() == caller.getType()) {
+                        if (allowedRole.getAccountType() == caller.getType()) {
                             permittedParameter = true;
                             break;
                         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/server/src/com/cloud/projects/ProjectManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/projects/ProjectManagerImpl.java b/server/src/com/cloud/projects/ProjectManagerImpl.java
index ee66506..a8dd225 100644
--- a/server/src/com/cloud/projects/ProjectManagerImpl.java
+++ b/server/src/com/cloud/projects/ProjectManagerImpl.java
@@ -211,7 +211,7 @@ public class ProjectManagerImpl extends ManagerBase implements ProjectManager {
         StringBuilder acctNm = new StringBuilder("PrjAcct-");
                 acctNm.append(name).append("-").append(ownerFinal.getDomainId());
 
-        Account projectAccount = _accountMgr.createAccount(acctNm.toString(), Account.ACCOUNT_TYPE_PROJECT, domainId, null, null, UUID.randomUUID().toString());
+        Account projectAccount = _accountMgr.createAccount(acctNm.toString(), Account.ACCOUNT_TYPE_PROJECT, null, domainId, null, null, UUID.randomUUID().toString());
 
                 Project project = _projectDao.persist(new ProjectVO(name, displayText, ownerFinal.getDomainId(), projectAccount.getId()));
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java
index 16e4ff0..13f98a2 100644
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -449,7 +449,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
             public void doInTransactionWithoutResult(TransactionStatus status) {
                 TransactionLegacy txn = TransactionLegacy.currentTxn();
                 // insert system account
-                String insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, account.default) VALUES (1, UUID(), 'system', '1', '1', 1)";
+                String insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, role_id, domain_id, account.default) VALUES (1, UUID(), 'system', '1', '1', '1', 1)";
 
                 try {
                     PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
@@ -476,8 +476,8 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
                 String lastname = "cloud";
 
                 // create an account for the admin user first
-                insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, account.default) VALUES (" + id + ", UUID(), '" + username
-                        + "', '1', '1', 1)";
+                insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, role_id, domain_id, account.default) VALUES (" + id + ", UUID(), '" + username
+                        + "', '1', '1', '1', 1)";
                 try {
                     PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
                     stmt.executeUpdate();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/server/src/com/cloud/user/AccountManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/AccountManager.java b/server/src/com/cloud/user/AccountManager.java
index 7b9e093..9789a22 100644
--- a/server/src/com/cloud/user/AccountManager.java
+++ b/server/src/com/cloud/user/AccountManager.java
@@ -50,7 +50,7 @@ public interface AccountManager extends AccountService {
 
     Long checkAccessAndSpecifyAuthority(Account caller, Long zoneId);
 
-    Account createAccount(String accountName, short accountType, Long domainId, String networkDomain, Map<String, String> details, String uuid);
+    Account createAccount(String accountName, short accountType, Long roleId, Long domainId, String networkDomain, Map<String, String> details, String uuid);
 
     /**
      * Logs out a user

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/server/src/com/cloud/user/AccountManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java
index d3eb40c..7e80681 100644
--- a/server/src/com/cloud/user/AccountManagerImpl.java
+++ b/server/src/com/cloud/user/AccountManagerImpl.java
@@ -994,9 +994,9 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
         @ActionEvent(eventType = EventTypes.EVENT_USER_CREATE, eventDescription = "creating User")
     })
     public UserAccount createUserAccount(final String userName, final String password, final String firstName, final String lastName, final String email, final String timezone,
-            String accountName, final short accountType, Long domainId, final String networkDomain, final Map<String, String> details, String accountUUID, final String userUUID) {
+            String accountName, final short accountType, final Long roleId, Long domainId, final String networkDomain, final Map<String, String> details, String accountUUID, final String userUUID) {
 
-        return createUserAccount(userName, password, firstName, lastName, email, timezone, accountName, accountType, domainId, networkDomain, details, accountUUID, userUUID,
+        return createUserAccount(userName, password, firstName, lastName, email, timezone, accountName, accountType, roleId, domainId, networkDomain, details, accountUUID, userUUID,
                 User.Source.UNKNOWN);
     }
 
@@ -1011,7 +1011,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
         @ActionEvent(eventType = EventTypes.EVENT_USER_CREATE, eventDescription = "creating User")
     })
     public UserAccount createUserAccount(final String userName, final String password, final String firstName, final String lastName, final String email,
-        final String timezone, String accountName, final short accountType, Long domainId, final String networkDomain, final Map<String, String> details,
+        final String timezone, String accountName, final short accountType, final Long roleId, Long domainId, final String networkDomain, final Map<String, String> details,
         String accountUUID, final String userUUID, final User.Source source) {
 
         if (accountName == null) {
@@ -1065,7 +1065,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
                 if (accountUUID == null) {
                     accountUUID = UUID.randomUUID().toString();
                 }
-                AccountVO account = createAccount(accountNameFinal, accountType, domainIdFinal, networkDomain, details, accountUUID);
+                AccountVO account = createAccount(accountNameFinal, accountType, roleId, domainIdFinal, networkDomain, details, accountUUID);
                 long accountId = account.getId();
 
                 // create the first user for the account
@@ -1869,27 +1869,10 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
 
     @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;
+        if (account == null) {
+            return RoleType.Unknown;
         }
-        return roleType;
+        return RoleType.getByAccountType(account.getType());
     }
 
     @Override
@@ -1916,7 +1899,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
 
     @Override
     @DB
-    public AccountVO createAccount(final String accountName, final short accountType, final Long domainId, final String networkDomain, final Map<String, String> details,
+    public AccountVO createAccount(final String accountName, final short accountType, final Long roleId, final Long domainId, final String networkDomain, final Map<String, String> details,
         final String uuid) {
         // Validate domain
         Domain domain = _domainMgr.getDomain(domainId);
@@ -1929,7 +1912,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
         }
 
         if ((domainId != Domain.ROOT_DOMAIN) && (accountType == Account.ACCOUNT_TYPE_ADMIN)) {
-            throw new InvalidParameterValueException("Invalid account type " + accountType + " given for an account in domain " + domainId + "; unable to create user.");
+            throw new InvalidParameterValueException("Invalid account type " + accountType + " given for an account in domain " + domainId + "; unable to create user of admin role type in non-ROOT domain.");
         }
 
         // Validate account/user/domain settings
@@ -1961,7 +1944,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
         return Transaction.execute(new TransactionCallback<AccountVO>() {
             @Override
             public AccountVO doInTransaction(TransactionStatus status) {
-        AccountVO account = _accountDao.persist(new AccountVO(accountName, domainId, networkDomain, accountType, uuid));
+        AccountVO account = _accountDao.persist(new AccountVO(accountName, domainId, networkDomain, accountType, roleId, uuid));
 
         if (account == null) {
             throw new CloudRuntimeException("Failed to create account name " + accountName + " in domain id=" + domainId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/server/src/org/apache/cloudstack/acl/RoleManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/acl/RoleManagerImpl.java b/server/src/org/apache/cloudstack/acl/RoleManagerImpl.java
new file mode 100644
index 0000000..7363b13
--- /dev/null
+++ b/server/src/org/apache/cloudstack/acl/RoleManagerImpl.java
@@ -0,0 +1,264 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES 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.acl;
+
+import com.cloud.event.ActionEvent;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.PermissionDeniedException;
+import com.cloud.user.Account;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.utils.ListUtils;
+import com.cloud.utils.PropertiesUtil;
+import com.cloud.utils.component.ManagerBase;
+import com.cloud.utils.component.PluggableService;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.TransactionCallback;
+import com.cloud.utils.db.TransactionStatus;
+import com.google.common.base.Strings;
+import org.apache.cloudstack.acl.dao.RoleDao;
+import org.apache.cloudstack.acl.dao.RolePermissionsDao;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.admin.acl.CreateRoleCmd;
+import org.apache.cloudstack.api.command.admin.acl.CreateRolePermissionCmd;
+import org.apache.cloudstack.api.command.admin.acl.DeleteRoleCmd;
+import org.apache.cloudstack.api.command.admin.acl.DeleteRolePermissionCmd;
+import org.apache.cloudstack.api.command.admin.acl.ListRolePermissionsCmd;
+import org.apache.cloudstack.api.command.admin.acl.ListRolesCmd;
+import org.apache.cloudstack.api.command.admin.acl.UpdateRoleCmd;
+import org.apache.cloudstack.api.command.admin.acl.UpdateRolePermissionCmd;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.framework.config.ConfigKey;
+import org.apache.cloudstack.framework.config.Configurable;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+@Local(value = {RoleService.class})
+public class RoleManagerImpl extends ManagerBase implements RoleService, Configurable, PluggableService {
+    @Inject
+    private AccountDao accountDao;
+    @Inject
+    private RoleDao roleDao;
+    @Inject
+    private RolePermissionsDao rolePermissionsDao;
+
+    private void checkCallerAccess() {
+        if (!isEnabled()) {
+            throw new PermissionDeniedException("Dynamic api checker is not enabled, aborting role operation");
+        }
+        Account caller = CallContext.current().getCallingAccount();
+        if (caller == null || caller.getRoleId() == null) {
+            throw new PermissionDeniedException("Restricted API called by an invalid user account");
+        }
+        Role callerRole = findRole(caller.getRoleId());
+        if (callerRole == null || callerRole.getRoleType() != RoleType.Admin) {
+            throw new PermissionDeniedException("Restricted API called by an user account of non-Admin role type");
+        }
+    }
+
+    @Override
+    public boolean isEnabled() {
+        File apiCmdFile = PropertiesUtil.findConfigFile(PropertiesUtil.getDefaultApiCommandsFileName());
+        return RoleService.EnableDynamicApiChecker.value() && (apiCmdFile == null || !apiCmdFile.exists());
+    }
+
+    @Override
+    public Role findRole(final Long id) {
+        if (id == null || id < 1L) {
+            return null;
+        }
+        return roleDao.findById(id);
+    }
+
+    @Override
+    public RolePermission findRolePermission(final Long id) {
+        if (id == null) {
+            return null;
+        }
+        return rolePermissionsDao.findById(id);
+    }
+
+    @Override
+    public RolePermission findRolePermissionByUuid(final String uuid) {
+        if (Strings.isNullOrEmpty(uuid)) {
+            return null;
+        }
+        return rolePermissionsDao.findByUuid(uuid);
+    }
+
+    @Override
+    @ActionEvent(eventType = EventTypes.EVENT_ROLE_CREATE, eventDescription = "creating Role")
+    public Role createRole(final String name, final RoleType roleType, final String description) {
+        checkCallerAccess();
+        if (roleType == null || roleType == RoleType.Unknown) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role type provided");
+        }
+        return Transaction.execute(new TransactionCallback<RoleVO>() {
+            @Override
+            public RoleVO doInTransaction(TransactionStatus status) {
+                return roleDao.persist(new RoleVO(name, roleType, description));
+            }
+        });
+    }
+
+    @Override
+    @ActionEvent(eventType = EventTypes.EVENT_ROLE_UPDATE, eventDescription = "updating Role")
+    public boolean updateRole(final Role role, final String name, final RoleType roleType, final String description) {
+        checkCallerAccess();
+        if (role == null) {
+            return false;
+        }
+        if (roleType != null && roleType == RoleType.Unknown) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unknown is not a valid role type");
+        }
+        RoleVO roleVO = (RoleVO) role;
+        if (!Strings.isNullOrEmpty(name)) {
+            roleVO.setName(name);
+        }
+        if (roleType != null) {
+            if (role.getId() <= RoleType.User.getId()) {
+                throw new PermissionDeniedException("The role type of default roles cannot be changed");
+            }
+            List<? extends Account> accounts = accountDao.findAccountsByRole(role.getId());
+            if (accounts == null || accounts.isEmpty()) {
+                roleVO.setRoleType(roleType);
+            } else {
+                throw new PermissionDeniedException("Found accounts that have role in use, won't allow to change role type");
+            }
+        }
+        if (!Strings.isNullOrEmpty(description)) {
+            roleVO.setDescription(description);
+        }
+        return roleDao.update(role.getId(), roleVO);
+    }
+
+    @Override
+    @ActionEvent(eventType = EventTypes.EVENT_ROLE_DELETE, eventDescription = "deleting Role")
+    public boolean deleteRole(final Role role) {
+        checkCallerAccess();
+        if (role == null) {
+            return false;
+        }
+        if (role.getId() <= RoleType.User.getId()) {
+            throw new PermissionDeniedException("Default roles cannot be deleted");
+        }
+        List<? extends Account> accounts = accountDao.findAccountsByRole(role.getId());
+        if (accounts == null || accounts.size() == 0) {
+            return Transaction.execute(new TransactionCallback<Boolean>() {
+                @Override
+                public Boolean doInTransaction(TransactionStatus status) {
+                    List<? extends RolePermission> rolePermissions = rolePermissionsDao.findAllByRoleIdSorted(role.getId());
+                    if (rolePermissions != null && !rolePermissions.isEmpty()) {
+                        for (RolePermission rolePermission : rolePermissions) {
+                            rolePermissionsDao.remove(rolePermission.getId());
+                        }
+                    }
+                    return roleDao.remove(role.getId());
+                }
+            });
+        }
+        throw new PermissionDeniedException("Found accounts that have role in use, won't allow to delete role");
+    }
+
+    @Override
+    @ActionEvent(eventType = EventTypes.EVENT_ROLE_PERMISSION_CREATE, eventDescription = "creating Role Permission")
+    public RolePermission createRolePermission(final Role role, final Rule rule, final RolePermission.Permission permission, final String description) {
+        checkCallerAccess();
+        return Transaction.execute(new TransactionCallback<RolePermissionVO>() {
+            @Override
+            public RolePermissionVO doInTransaction(TransactionStatus status) {
+                return rolePermissionsDao.persist(new RolePermissionVO(role.getId(), rule.toString(), permission, description));
+            }
+        });
+    }
+
+    @Override
+    @ActionEvent(eventType = EventTypes.EVENT_ROLE_PERMISSION_UPDATE, eventDescription = "updating Role Permission order")
+    public boolean updateRolePermission(final Role role, final List<RolePermission> newOrder) {
+        checkCallerAccess();
+        return role != null && newOrder != null && rolePermissionsDao.update(role, newOrder);
+    }
+
+    @Override
+    @ActionEvent(eventType = EventTypes.EVENT_ROLE_PERMISSION_DELETE, eventDescription = "deleting Role Permission")
+    public boolean deleteRolePermission(final RolePermission rolePermission) {
+        checkCallerAccess();
+        return rolePermission != null && rolePermissionsDao.remove(rolePermission.getId());
+    }
+
+    @Override
+    public List<Role> findRolesByName(final String name) {
+        List<? extends Role> roles = null;
+        if (!Strings.isNullOrEmpty(name)) {
+            roles = roleDao.findAllByName(name);
+        }
+        return ListUtils.toListOfInterface(roles);
+    }
+
+    @Override
+    public List<Role> findRolesByType(final RoleType roleType) {
+        List<? extends Role> roles = null;
+        if (roleType != null) {
+            roles = roleDao.findAllByRoleType(roleType);
+        }
+        return ListUtils.toListOfInterface(roles);
+    }
+
+    @Override
+    public List<Role> listRoles() {
+        List<? extends Role> roles = roleDao.listAll();
+        return ListUtils.toListOfInterface(roles);
+    }
+
+    @Override
+    public List<RolePermission> findAllPermissionsBy(final Long roleId) {
+        List<? extends RolePermission> permissions = rolePermissionsDao.findAllByRoleIdSorted(roleId);
+        if (permissions != null) {
+            return new ArrayList<>(permissions);
+        }
+        return Collections.emptyList();
+    }
+
+    @Override
+    public String getConfigComponentName() {
+        return RoleService.class.getSimpleName();
+    }
+
+    @Override
+    public ConfigKey<?>[] getConfigKeys() {
+        return new ConfigKey<?>[]{RoleService.EnableDynamicApiChecker};
+    }
+
+    @Override
+    public List<Class<?>> getCommands() {
+        final List<Class<?>> cmdList = new ArrayList<>();
+        cmdList.add(CreateRoleCmd.class);
+        cmdList.add(ListRolesCmd.class);
+        cmdList.add(UpdateRoleCmd.class);
+        cmdList.add(DeleteRoleCmd.class);
+        cmdList.add(CreateRolePermissionCmd.class);
+        cmdList.add(ListRolePermissionsCmd.class);
+        cmdList.add(UpdateRolePermissionCmd.class);
+        cmdList.add(DeleteRolePermissionCmd.class);
+        return cmdList;
+    }
+ }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/server/test/com/cloud/user/MockAccountManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/user/MockAccountManagerImpl.java b/server/test/com/cloud/user/MockAccountManagerImpl.java
index 3971fd6..fd85167 100644
--- a/server/test/com/cloud/user/MockAccountManagerImpl.java
+++ b/server/test/com/cloud/user/MockAccountManagerImpl.java
@@ -328,13 +328,13 @@ public class MockAccountManagerImpl extends ManagerBase implements Manager, Acco
 
     @Override
     public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName,
-        short accountType, Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID) {
+        short accountType, Long roleId, Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID) {
         // TODO Auto-generated method stub
         return null;
     }
 
     @Override
-    public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType,
+    public UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long roleId,
                                          Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID, User.Source source) {
         // TODO Auto-generated method stub
         return null;
@@ -366,7 +366,7 @@ public class MockAccountManagerImpl extends ManagerBase implements Manager, Acco
     }
 
     @Override
-    public Account createAccount(String accountName, short accountType, Long domainId, String networkDomain, Map<String, String> details, String uuid) {
+    public Account createAccount(String accountName, short accountType, Long roleId, Long domainId, String networkDomain, Map<String, String> details, String uuid) {
         // TODO Auto-generated method stub
         return null;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/services/iam/plugin/src/org/apache/cloudstack/iam/RoleBasedAPIAccessChecker.java
----------------------------------------------------------------------
diff --git a/services/iam/plugin/src/org/apache/cloudstack/iam/RoleBasedAPIAccessChecker.java b/services/iam/plugin/src/org/apache/cloudstack/iam/RoleBasedAPIAccessChecker.java
index 634ce0a..3072b77 100644
--- a/services/iam/plugin/src/org/apache/cloudstack/iam/RoleBasedAPIAccessChecker.java
+++ b/services/iam/plugin/src/org/apache/cloudstack/iam/RoleBasedAPIAccessChecker.java
@@ -196,7 +196,7 @@ public class RoleBasedAPIAccessChecker extends AdapterBase implements APIChecker
             try {
                 short cmdPermissions = Short.parseShort(roleMask);
                 for (RoleType roleType : RoleType.values()) {
-                    if ((cmdPermissions & roleType.getValue()) != 0)
+                    if ((cmdPermissions & roleType.getMask()) != 0)
                         commandsPropertiesRoleBasedApisMap.get(roleType).add(apiName);
                 }
             } catch (NumberFormatException nfe) {


[36/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/setup/db/db/schema-481to490-cleanup.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-481to490-cleanup.sql b/setup/db/db/schema-481to490-cleanup.sql
index b1bb702..ba20645 100644
--- a/setup/db/db/schema-481to490-cleanup.sql
+++ b/setup/db/db/schema-481to490-cleanup.sql
@@ -82,4 +82,192 @@ ALTER TABLE `cloud`.`vm_work_job` DROP INDEX `id` ;
 ALTER TABLE `cloud`.`vpc_gateways` DROP INDEX `id` ;
 ALTER TABLE `cloud`.`vpn_users` DROP INDEX `id` ;
 
+-- Dynamic roles changes
+DROP VIEW IF EXISTS `cloud`.`account_view`;
+CREATE VIEW `cloud`.`account_view` AS
+    select
+        account.id,
+        account.uuid,
+        account.account_name,
+        account.type,
+        account.role_id,
+        account.state,
+        account.removed,
+        account.cleanup_needed,
+        account.network_domain,
+        account.default,
+        domain.id domain_id,
+        domain.uuid domain_uuid,
+        domain.name domain_name,
+        domain.path domain_path,
+        data_center.id data_center_id,
+        data_center.uuid data_center_uuid,
+        data_center.name data_center_name,
+        account_netstats_view.bytesReceived,
+        account_netstats_view.bytesSent,
+        vmlimit.max vmLimit,
+        vmcount.count vmTotal,
+        runningvm.vmcount runningVms,
+        stoppedvm.vmcount stoppedVms,
+        iplimit.max ipLimit,
+        ipcount.count ipTotal,
+        free_ip_view.free_ip ipFree,
+        volumelimit.max volumeLimit,
+        volumecount.count volumeTotal,
+        snapshotlimit.max snapshotLimit,
+        snapshotcount.count snapshotTotal,
+        templatelimit.max templateLimit,
+        templatecount.count templateTotal,
+        vpclimit.max vpcLimit,
+        vpccount.count vpcTotal,
+        projectlimit.max projectLimit,
+        projectcount.count projectTotal,
+        networklimit.max networkLimit,
+        networkcount.count networkTotal,
+        cpulimit.max cpuLimit,
+        cpucount.count cpuTotal,
+        memorylimit.max memoryLimit,
+        memorycount.count memoryTotal,
+        primary_storage_limit.max primaryStorageLimit,
+        primary_storage_count.count primaryStorageTotal,
+        secondary_storage_limit.max secondaryStorageLimit,
+        secondary_storage_count.count secondaryStorageTotal,
+        async_job.id job_id,
+        async_job.uuid job_uuid,
+        async_job.job_status job_status,
+        async_job.account_id job_account_id
+    from
+        `cloud`.`free_ip_view`,
+        `cloud`.`account`
+            inner join
+        `cloud`.`domain` ON account.domain_id = domain.id
+            left join
+        `cloud`.`data_center` ON account.default_zone_id = data_center.id
+            left join
+        `cloud`.`account_netstats_view` ON account.id = account_netstats_view.account_id
+            left join
+        `cloud`.`resource_limit` vmlimit ON account.id = vmlimit.account_id
+            and vmlimit.type = 'user_vm'
+            left join
+        `cloud`.`resource_count` vmcount ON account.id = vmcount.account_id
+            and vmcount.type = 'user_vm'
+            left join
+        `cloud`.`account_vmstats_view` runningvm ON account.id = runningvm.account_id
+            and runningvm.state = 'Running'
+            left join
+        `cloud`.`account_vmstats_view` stoppedvm ON account.id = stoppedvm.account_id
+           and stoppedvm.state = 'Stopped'
+            left join
+        `cloud`.`resource_limit` iplimit ON account.id = iplimit.account_id
+            and iplimit.type = 'public_ip'
+            left join
+        `cloud`.`resource_count` ipcount ON account.id = ipcount.account_id
+            and ipcount.type = 'public_ip'
+            left join
+        `cloud`.`resource_limit` volumelimit ON account.id = volumelimit.account_id
+            and volumelimit.type = 'volume'
+            left join
+        `cloud`.`resource_count` volumecount ON account.id = volumecount.account_id
+            and volumecount.type = 'volume'
+            left join
+        `cloud`.`resource_limit` snapshotlimit ON account.id = snapshotlimit.account_id
+            and snapshotlimit.type = 'snapshot'
+            left join
+        `cloud`.`resource_count` snapshotcount ON account.id = snapshotcount.account_id
+            and snapshotcount.type = 'snapshot'
+            left join
+        `cloud`.`resource_limit` templatelimit ON account.id = templatelimit.account_id
+            and templatelimit.type = 'template'
+            left join
+        `cloud`.`resource_count` templatecount ON account.id = templatecount.account_id
+            and templatecount.type = 'template'
+            left join
+        `cloud`.`resource_limit` vpclimit ON account.id = vpclimit.account_id
+            and vpclimit.type = 'vpc'
+            left join
+        `cloud`.`resource_count` vpccount ON account.id = vpccount.account_id
+            and vpccount.type = 'vpc'
+            left join
+        `cloud`.`resource_limit` projectlimit ON account.id = projectlimit.account_id
+            and projectlimit.type = 'project'
+            left join
+        `cloud`.`resource_count` projectcount ON account.id = projectcount.account_id
+            and projectcount.type = 'project'
+            left join
+        `cloud`.`resource_limit` networklimit ON account.id = networklimit.account_id
+            and networklimit.type = 'network'
+            left join
+        `cloud`.`resource_count` networkcount ON account.id = networkcount.account_id
+            and networkcount.type = 'network'
+            left join
+        `cloud`.`resource_limit` cpulimit ON account.id = cpulimit.account_id
+            and cpulimit.type = 'cpu'
+            left join
+        `cloud`.`resource_count` cpucount ON account.id = cpucount.account_id
+            and cpucount.type = 'cpu'
+            left join
+        `cloud`.`resource_limit` memorylimit ON account.id = memorylimit.account_id
+            and memorylimit.type = 'memory'
+            left join
+        `cloud`.`resource_count` memorycount ON account.id = memorycount.account_id
+            and memorycount.type = 'memory'
+            left join
+        `cloud`.`resource_limit` primary_storage_limit ON account.id = primary_storage_limit.account_id
+            and primary_storage_limit.type = 'primary_storage'
+            left join
+        `cloud`.`resource_count` primary_storage_count ON account.id = primary_storage_count.account_id
+            and primary_storage_count.type = 'primary_storage'
+            left join
+        `cloud`.`resource_limit` secondary_storage_limit ON account.id = secondary_storage_limit.account_id
+            and secondary_storage_limit.type = 'secondary_storage'
+            left join
+        `cloud`.`resource_count` secondary_storage_count ON account.id = secondary_storage_count.account_id
+            and secondary_storage_count.type = 'secondary_storage'
+            left join
+        `cloud`.`async_job` ON async_job.instance_id = account.id
+            and async_job.instance_type = 'Account'
+            and async_job.job_status = 0;
 
+DROP VIEW IF EXISTS `cloud`.`user_view`;
+CREATE VIEW `cloud`.`user_view` AS
+    select
+        user.id,
+        user.uuid,
+        user.username,
+        user.password,
+        user.firstname,
+        user.lastname,
+        user.email,
+        user.state,
+        user.api_key,
+        user.secret_key,
+        user.created,
+        user.removed,
+        user.timezone,
+        user.registration_token,
+        user.is_registered,
+        user.incorrect_login_attempts,
+        user.default,
+        account.id account_id,
+        account.uuid account_uuid,
+        account.account_name account_name,
+        account.type account_type,
+        account.role_id account_role_id,
+        domain.id domain_id,
+        domain.uuid domain_uuid,
+        domain.name domain_name,
+        domain.path domain_path,
+        async_job.id job_id,
+        async_job.uuid job_uuid,
+        async_job.job_status job_status,
+        async_job.account_id job_account_id
+    from
+        `cloud`.`user`
+            inner join
+        `cloud`.`account` ON user.account_id = account.id
+            inner join
+        `cloud`.`domain` ON account.domain_id = domain.id
+            left join
+        `cloud`.`async_job` ON async_job.instance_id = user.id
+            and async_job.instance_type = 'User'
+            and async_job.job_status = 0;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/setup/db/db/schema-481to490.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-481to490.sql b/setup/db/db/schema-481to490.sql
index a02615f..a2622ed 100644
--- a/setup/db/db/schema-481to490.sql
+++ b/setup/db/db/schema-481to490.sql
@@ -436,3 +436,38 @@ VIEW `account_vmstats_view` AS
         (`vm_instance`.`vm_type` = 'User' and `vm_instance`.`removed` is NULL)
     GROUP BY `vm_instance`.`account_id` , `vm_instance`.`state`;
 -- End CLOUDSTACK-9340
+
+-- Dynamic roles
+CREATE TABLE IF NOT EXISTS `cloud`.`roles` (
+  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  `uuid` varchar(255) UNIQUE,
+  `name` varchar(255) COMMENT 'unique name of the dynamic role',
+  `role_type` varchar(255) NOT NULL COMMENT 'the type of the role',
+  `removed` datetime COMMENT 'date removed',
+  `description` text COMMENT 'description of the role',
+  PRIMARY KEY (`id`),
+  KEY `i_roles__name` (`name`),
+  KEY `i_roles__role_type` (`role_type`),
+  UNIQUE KEY (`name`, `role_type`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE IF NOT EXISTS `cloud`.`role_permissions` (
+  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  `uuid` varchar(255) UNIQUE,
+  `role_id` bigint(20) unsigned NOT NULL COMMENT 'id of the role',
+  `rule` varchar(255) NOT NULL COMMENT 'rule for the role, api name or wildcard',
+  `permission` varchar(255) NOT NULL COMMENT 'access authority, allow or deny',
+  `description` text COMMENT 'description of the rule',
+  `sort_order` bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT 'permission sort order',
+  PRIMARY KEY (`id`),
+  KEY `fk_role_permissions__role_id` (`role_id`),
+  KEY `i_role_permissions__sort_order` (`sort_order`),
+  UNIQUE KEY (`role_id`, `rule`),
+  CONSTRAINT `fk_role_permissions__role_id` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- Default CloudStack roles
+INSERT INTO `cloud`.`roles` (`id`, `uuid`, `name`, `role_type`, `description`) values (1, UUID(), 'Root Admin', 'Admin', 'Default root admin role') ON DUPLICATE KEY UPDATE name=name;
+INSERT INTO `cloud`.`roles` (`id`, `uuid`, `name`, `role_type`, `description`) values (2, UUID(), 'Resource Admin', 'ResourceAdmin', 'Default resource admin role') ON DUPLICATE KEY UPDATE name=name;
+INSERT INTO `cloud`.`roles` (`id`, `uuid`, `name`, `role_type`, `description`) values (3, UUID(), 'Domain Admin', 'DomainAdmin', 'Default domain admin role') ON DUPLICATE KEY UPDATE name=name;
+INSERT INTO `cloud`.`roles` (`id`, `uuid`, `name`, `role_type`, `description`) values (4, UUID(), 'User', 'User', 'Default Root Admin role') ON DUPLICATE KEY UPDATE name=name;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/setup/db/server-setup.sql
----------------------------------------------------------------------
diff --git a/setup/db/server-setup.sql b/setup/db/server-setup.sql
index b7f5c3f..df2c924 100644
--- a/setup/db/server-setup.sql
+++ b/setup/db/server-setup.sql
@@ -25,4 +25,5 @@ INSERT INTO `cloud`.`domain` (id, uuid, name, parent, path, owner) VALUES (1, UU
 INSERT INTO `cloud`.`configuration` (category, instance, component, name, value, description) VALUES ('Hidden', 'DEFAULT', 'none', 'init', null, null);
 -- INSERT INTO `cloud`.`configuration` (category, instance, component, name, value, description) VALUES ('Advanced', 'DEFAULT', 'AgentManager', 'xenserver.public.network.device', 'public-network', "[OPTIONAL]The name of the XenServer network containing the physical network interface that is connected to the public network ");
 
-
+-- Enable dynamic RBAC by default for fresh deployments
+INSERT INTO `cloud`.`configuration` (category, instance, component, name, value) VALUES ('Advanced', 'DEFAULT', 'RoleService', 'dynamic.apichecker.enabled', 'true');

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/setup/db/server-setup.xml
----------------------------------------------------------------------
diff --git a/setup/db/server-setup.xml b/setup/db/server-setup.xml
index bb8878f..178f29a 100755
--- a/setup/db/server-setup.xml
+++ b/setup/db/server-setup.xml
@@ -239,6 +239,13 @@ under the License.
       <value>qatest-vmops.com</value>
     </configuration>
     <!--
+    Enable Dynamic RBAC by default for fresh installations
+    -->
+    <configuration>
+      <name>dynamic.apichecker.enabled</name>
+      <value>true</value>
+    </configuration>
+    <!--
     The instance.name parameter is tacked to the end of the names of the VMs you create.
     So, for example, with the TEST value as it ships by default, your VMs would be named:
     i-X-Y-TEST, where X is the account ID and Y is the serially incrementing VM ID.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/test/integration/smoke/test_dynamicroles.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_dynamicroles.py b/test/integration/smoke/test_dynamicroles.py
new file mode 100644
index 0000000..9961437
--- /dev/null
+++ b/test/integration/smoke/test_dynamicroles.py
@@ -0,0 +1,537 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from marvin.cloudstackAPI import *
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackException import CloudstackAPIException
+from marvin.lib.base import Account, Role, RolePermission
+from marvin.lib.utils import cleanup_resources
+from nose.plugins.attrib import attr
+from random import shuffle
+
+import copy
+import random
+import re
+
+
+class TestData(object):
+    """Test data object that is required to create resources
+    """
+    def __init__(self):
+        self.testdata = {
+            "account": {
+                "email": "mtu@test.cloud",
+                "firstname": "Marvin",
+                "lastname": "TestUser",
+                "username": "roletest",
+                "password": "password",
+            },
+            "role": {
+                "name": "MarvinFake Role ",
+                "type": "User",
+                "description": "Fake Role created by Marvin test"
+            },
+            "roleadmin": {
+                "name": "MarvinFake Admin Role ",
+                "type": "Admin",
+                "description": "Fake Admin Role created by Marvin test"
+            },
+            "roledomainadmin": {
+                "name": "MarvinFake DomainAdmin Role ",
+                "type": "DomainAdmin",
+                "description": "Fake Domain-Admin Role created by Marvin test"
+            },
+            "rolepermission": {
+                "roleid": 1,
+                "rule": "listVirtualMachines",
+                "permission": "allow",
+                "description": "Fake role permission created by Marvin test"
+            },
+            "apiConfig": {
+                "listApis": "allow",
+                "listAccounts": "allow",
+                "listClusters": "deny",
+                "*VM*": "allow",
+                "*Host*": "deny"
+            }
+        }
+
+
+class TestDynamicRoles(cloudstackTestCase):
+    """Tests dynamic role and role permission management in CloudStack
+    """
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.testdata = TestData().testdata
+
+        feature_enabled = self.apiclient.listCapabilities(listCapabilities.listCapabilitiesCmd()).dynamicrolesenabled
+        if not feature_enabled:
+            self.skipTest("Dynamic Role-Based API checker not enabled, skipping test")
+
+        self.testdata["role"]["name"] += self.getRandomString()
+        self.role = Role.create(
+            self.apiclient,
+            self.testdata["role"]
+        )
+
+        self.testdata["rolepermission"]["roleid"] = self.role.id
+        self.rolepermission = RolePermission.create(
+            self.apiclient,
+            self.testdata["rolepermission"]
+        )
+
+        self.account = Account.create(
+            self.apiclient,
+            self.testdata["account"],
+            roleid=self.role.id
+        )
+        self.cleanup = [
+            self.account,
+            self.rolepermission,
+            self.role
+        ]
+
+
+    def tearDown(self):
+        try:
+           cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            self.debug("Warning! Exception in tearDown: %s" % e)
+
+
+    def translateRoleToAccountType(self, role_type):
+        if role_type == "User":
+            return 0
+        elif role_type == "Admin":
+            return 1
+        elif role_type == "DomainAdmin":
+            return 2
+        elif role_type == "ResourceAdmin":
+            return 3
+        return -1
+
+
+    def getUserApiClient(self, username, domain='ROOT', role_type='User'):
+        self.user_apiclient = self.testClient.getUserApiClient(UserName=username, DomainName='ROOT', type=self.translateRoleToAccountType(role_type))
+        return self.user_apiclient
+
+
+    def getRandomString(self):
+        return "".join(random.choice("abcdefghijklmnopqrstuvwxyz0123456789") for _ in range(10))
+
+
+    def getRandomRoleName(self):
+        return "MarvinFakeRoleNewName-" + self.getRandomString()
+
+
+    @attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
+    def test_role_lifecycle_list(self):
+        """
+            Tests that default four roles exist
+        """
+        roleTypes = {1: "Admin", 2: "ResourceAdmin", 3: "DomainAdmin", 4: "User"}
+        for idx in range(1,5):
+            list_roles = Role.list(self.apiclient, id=idx)
+            self.assertEqual(
+                isinstance(list_roles, list),
+                True,
+                "List Roles response was not a valid list"
+            )
+            self.assertEqual(
+                len(list_roles),
+                1,
+                "List Roles response size was not 1"
+            )
+            self.assertEqual(
+                list_roles[0].type,
+                roleTypes[idx],
+                msg="Default role type differs from expectation"
+            )
+
+
+    @attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
+    def test_role_lifecycle_create(self):
+        """
+            Tests normal lifecycle operations for roles
+        """
+        # Reuse self.role created in setUp()
+        try:
+            role = Role.create(
+                self.apiclient,
+                self.testdata["role"]
+            )
+            self.fail("An exception was expected when creating duplicate roles")
+        except CloudstackAPIException: pass
+
+        list_roles = Role.list(self.apiclient, id=self.role.id)
+        self.assertEqual(
+            isinstance(list_roles, list),
+            True,
+            "List Roles response was not a valid list"
+        )
+        self.assertEqual(
+            len(list_roles),
+            1,
+            "List Roles response size was not 1"
+        )
+        self.assertEqual(
+            list_roles[0].name,
+            self.testdata["role"]["name"],
+            msg="Role name does not match the test data"
+        )
+        self.assertEqual(
+            list_roles[0].type,
+            self.testdata["role"]["type"],
+            msg="Role type does not match the test data"
+        )
+
+
+    @attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
+    def test_role_lifecycle_update(self):
+        """
+            Tests role update
+        """
+        self.account.delete(self.apiclient)
+        new_role_name = self.getRandomRoleName()
+        self.role.update(self.apiclient, name=new_role_name, type='Admin')
+        update_role = Role.list(self.apiclient, id=self.role.id)[0]
+        self.assertEqual(
+            update_role.name,
+            new_role_name,
+            msg="Role name does not match updated role name"
+        )
+        self.assertEqual(
+            update_role.type,
+            'Admin',
+            msg="Role type does not match updated role type"
+        )
+
+
+    @attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
+    def test_role_lifecycle_update_role_inuse(self):
+        """
+            Tests role update when role is in use by an account
+        """
+        new_role_name = self.getRandomRoleName()
+        try:
+            self.role.update(self.apiclient, name=new_role_name, type='Admin')
+            self.fail("Updation of role type is not allowed when role is in use")
+        except CloudstackAPIException: pass
+
+        self.role.update(self.apiclient, name=new_role_name)
+        update_role = Role.list(self.apiclient, id=self.role.id)[0]
+        self.assertEqual(
+            update_role.name,
+            new_role_name,
+            msg="Role name does not match updated role name"
+        )
+
+
+    @attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
+    def test_role_lifecycle_delete(self):
+        """
+            Tests role update
+        """
+        self.account.delete(self.apiclient)
+        self.role.delete(self.apiclient)
+        list_roles = Role.list(self.apiclient, id=self.role.id)
+        self.assertEqual(
+            list_roles,
+            None,
+            "List Roles response should be empty"
+        )
+
+
+    @attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
+    def test_role_inuse_deletion(self):
+        """
+            Test to ensure role in use cannot be deleted
+        """
+        try:
+            self.role.delete(self.apiclient)
+            self.fail("Role with any account should not be allowed to be deleted")
+        except CloudstackAPIException: pass
+
+
+    @attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
+    def test_default_role_deletion(self):
+        """
+            Test to ensure 4 default roles cannot be deleted
+        """
+        for idx in range(1,5):
+            cmd = deleteRole.deleteRoleCmd()
+            cmd.id = idx
+            try:
+                self.apiclient.deleteRole(cmd)
+                self.fail("Default role got deleted with id: " + idx)
+            except CloudstackAPIException: pass
+
+
+    @attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
+    def test_rolepermission_lifecycle_list(self):
+        """
+            Tests listing of default role's permission
+        """
+        for idx in range(1,5):
+            list_rolepermissions = RolePermission.list(self.apiclient, roleid=idx)
+            self.assertEqual(
+                isinstance(list_rolepermissions, list),
+                True,
+                "List rolepermissions response was not a valid list"
+            )
+            self.assertTrue(
+                len(list_rolepermissions) > 0,
+                "List rolepermissions response was empty"
+            )
+
+
+    @attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
+    def test_rolepermission_lifecycle_create(self):
+        """
+            Tests creation of role permission
+        """
+        # Reuse self.rolepermission created in setUp()
+        try:
+            rolepermission = RolePermission.create(
+                self.apiclient,
+                self.testdata["rolepermission"]
+            )
+            self.fail("An exception was expected when creating duplicate role permissions")
+        except CloudstackAPIException: pass
+
+        list_rolepermissions = RolePermission.list(self.apiclient, roleid=self.role.id)
+        self.assertEqual(
+            isinstance(list_rolepermissions, list),
+            True,
+            "List rolepermissions response was not a valid list"
+        )
+        self.assertNotEqual(
+            len(list_rolepermissions),
+            0,
+            "List rolepermissions response was empty"
+        )
+        self.assertEqual(
+            list_rolepermissions[0].rule,
+            self.testdata["rolepermission"]["rule"],
+            msg="Role permission rule does not match the test data"
+        )
+        self.assertEqual(
+            list_rolepermissions[0].permission,
+            self.testdata["rolepermission"]["permission"],
+            msg="Role permission permission-type does not match the test data"
+        )
+
+
+    @attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
+    def test_rolepermission_lifecycle_update(self):
+        """
+            Tests order updation of role permission
+        """
+        permissions = [self.rolepermission]
+        rules = ['list*', '*Vol*', 'listCapabilities']
+        for rule in rules:
+            data = copy.deepcopy(self.testdata["rolepermission"])
+            data['rule'] = rule
+            permission = RolePermission.create(
+                self.apiclient,
+                data
+            )
+            self.cleanup.append(permission)
+            permissions.append(permission)
+
+
+        def validate_permissions_list(permissions):
+            list_rolepermissions = RolePermission.list(self.apiclient, roleid=self.role.id)
+            self.assertEqual(
+                len(list_rolepermissions),
+                len(permissions),
+                msg="List of role permissions do not match created list of permissions"
+            )
+
+            for idx, rolepermission in enumerate(list_rolepermissions):
+                self.assertEqual(
+                    rolepermission.rule,
+                    permissions[idx].rule,
+                    msg="Rule permission don't match with expected item at the index"
+                )
+                self.assertEqual(
+                    rolepermission.permission,
+                    permissions[idx].permission,
+                    msg="Rule permission don't match with expected item at the index"
+                )
+
+        # Move last item to the top
+        rule = permissions.pop(len(permissions)-1)
+        permissions = [rule] + permissions
+        rule.update(self.apiclient, ruleorder=",".join(map(lambda x: x.id, permissions)))
+        validate_permissions_list(permissions)
+
+        # Move to the bottom
+        rule = permissions.pop(0)
+        permissions = permissions + [rule]
+        rule.update(self.apiclient, ruleorder=",".join(map(lambda x: x.id, permissions)))
+        validate_permissions_list(permissions)
+
+        # Random shuffles
+        for _ in range(3):
+            shuffle(permissions)
+            rule.update(self.apiclient, ruleorder=",".join(map(lambda x: x.id, permissions)))
+            validate_permissions_list(permissions)
+
+
+    @attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
+    def test_rolepermission_lifecycle_concurrent_updates(self):
+        """
+            Tests concurrent order updation of role permission
+        """
+        permissions = [self.rolepermission]
+        rules = ['list*', '*Vol*', 'listCapabilities']
+        for rule in rules:
+            data = copy.deepcopy(self.testdata["rolepermission"])
+            data['rule'] = rule
+            permission = RolePermission.create(
+                self.apiclient,
+                data
+            )
+            self.cleanup.append(permission)
+            permissions.append(permission)
+
+
+        # The following rule is considered to be created by another mgmt server
+        data = copy.deepcopy(self.testdata["rolepermission"])
+        data['rule'] = "someRule*"
+        permission = RolePermission.create(
+            self.apiclient,
+            data
+        )
+        self.cleanup.append(permission)
+
+        shuffle(permissions)
+        try:
+            permission.update(self.apiclient, ruleorder=",".join(map(lambda x: x.id, permissions)))
+            self.fail("Reordering should fail in case of concurrent updates by other user")
+        except CloudstackAPIException: pass
+
+
+    @attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
+    def test_rolepermission_lifecycle_delete(self):
+        """
+            Tests deletion of role permission
+        """
+        permission = self.cleanup.pop(1)
+        permission.delete(self.apiclient)
+        list_rolepermissions = RolePermission.list(self.apiclient, roleid=self.role.id)
+        self.assertEqual(
+            list_rolepermissions,
+            None,
+            "List rolepermissions response should be empty"
+        )
+
+
+    def checkApiAvailability(self, apiConfig, userApiClient):
+        """
+            Checks available APIs based on api map
+        """
+        response = userApiClient.listApis(listApis.listApisCmd())
+        allowedApis = map(lambda x: x.name, response)
+        for api in allowedApis:
+            for rule, perm in apiConfig.items():
+                if re.match(rule.replace('*', '.*'), api):
+                    if perm.lower() == 'allow':
+                        break
+                    else:
+                        self.fail('Denied API found to be allowed: ' + api)
+
+
+    def checkApiCall(self, apiConfig, userApiClient):
+        """
+            Performs actual API calls to verify API ACLs
+        """
+        list_accounts = userApiClient.listAccounts(listAccounts.listAccountsCmd())
+        self.assertEqual(
+            isinstance(list_accounts, list),
+            True,
+            "List accounts response was not a valid list"
+        )
+        self.assertNotEqual(
+            len(list_accounts),
+            0,
+            "List accounts response was empty"
+        )
+
+        # Perform actual API call for deny API
+        try:
+            userApiClient.listHosts(listHosts.listHostsCmd())
+            self.fail("API call succeeded which is denied for the role")
+        except CloudstackAPIException: pass
+
+        # Perform actual API call for API with no allow/deny rule
+        try:
+            userApiClient.listZones(listZones.listZonesCmd())
+            self.fail("API call succeeded which has no allow/deny rule for the role")
+        except CloudstackAPIException: pass
+
+
+
+    @attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
+    def test_role_account_acls(self):
+        """
+            Test to check role, role permissions and account life cycles
+        """
+        apiConfig = self.testdata['apiConfig']
+        for api, perm in apiConfig.items():
+            testdata = self.testdata['rolepermission']
+            testdata['roleid'] = self.role.id
+            testdata['rule'] = api
+            testdata['permission'] = perm.lower()
+
+            RolePermission.create(
+                self.apiclient,
+                testdata
+            )
+
+        userApiClient = self.getUserApiClient(self.account.name, domain=self.account.domain, role_type=self.account.roletype)
+
+        # Perform listApis check
+        self.checkApiAvailability(apiConfig, userApiClient)
+
+        # Perform actual API call for allow API
+        self.checkApiCall(apiConfig, userApiClient)
+
+
+    @attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
+    def test_role_account_acls_multiple_mgmt_servers(self):
+        """
+            Test for role-rule enforcement in case of multiple mgmt servers
+            Inserts rule directly in DB and checks expected behaviour
+        """
+        apiConfig = self.testdata["apiConfig"]
+        roleId = self.dbclient.execute("select id from roles where uuid='%s'" % self.role.id)[0][0]
+        sortOrder = 1
+        for rule, perm in apiConfig.items():
+            self.dbclient.execute("insert into role_permissions (uuid, role_id, rule, permission, sort_order) values (UUID(), %d, '%s', '%s', %d)" % (roleId, rule, perm.upper(), sortOrder))
+            sortOrder += 1
+
+        userApiClient = self.getUserApiClient(self.account.name, domain=self.account.domain, role_type=self.account.roletype)
+
+        # Perform listApis check
+        self.checkApiAvailability(apiConfig, userApiClient)
+
+        # Perform actual API call for allow API
+        self.checkApiCall(apiConfig, userApiClient)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/test/integration/smoke/test_staticroles.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_staticroles.py b/test/integration/smoke/test_staticroles.py
new file mode 100644
index 0000000..5421f6b
--- /dev/null
+++ b/test/integration/smoke/test_staticroles.py
@@ -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.
+
+from marvin.cloudstackAPI import *
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackException import CloudstackAPIException
+from marvin.lib.base import Account
+from marvin.lib.utils import cleanup_resources
+from marvin.sshClient import SshClient
+from nose.plugins.attrib import attr
+
+import inspect
+import logging
+import os
+import re
+
+
+class TestStaticRoles(cloudstackTestCase):
+    """Tests static role api-checker
+    """
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.mgtSvrDetails = self.config.__dict__["mgtSvr"][0].__dict__
+        self.cleanup = []
+        self.testdata = {
+            "account": {
+                "email": "mtu@test.cloud",
+                "firstname": "Marvin",
+                "lastname": "TestUser",
+                "username": "staticrole_acctest-",
+                "password": "password",
+            }
+        }
+
+        feature_enabled = self.apiclient.listCapabilities(listCapabilities.listCapabilitiesCmd()).dynamicrolesenabled
+        if feature_enabled:
+            self.skipTest("Dynamic role-based API checker is enabled, skipping tests for static role-base API checker")
+
+        commandsProperties = []
+        try:
+            sshClient = SshClient(
+                self.mgtSvrDetails["mgtSvrIp"],
+                22,
+                self.mgtSvrDetails["user"],
+                self.mgtSvrDetails["passwd"],
+                retries=1,
+                log_lvl=logging.INFO
+            )
+            result = sshClient.runCommand("cat /etc/cloudstack/management/commands.properties")
+            if 'status' in result and result['status'] == 'SUCCESS' and 'stdout' in result and len(result['stdout']) > 0:
+                commandsProperties = result['stdout']
+        except Exception:
+            self.debug("Failed to ssh into mgmt server host and grab commands.properties file")
+            testDir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
+            localFileName = os.path.abspath(testDir + "/../../../client/tomcatconf/commands.properties.in")
+            if os.path.isfile(localFileName):
+                self.info("Detected that we're running in developer mode with maven, using file at:" + localFileName)
+                with open(localFileName) as f:
+                    commandsProperties = f.readlines()
+
+        if len(commandsProperties) < 1:
+            self.skipTest("Unable to find commands.properties, skipping this test")
+
+        apiMap = {}
+        for line in commandsProperties:
+            if not line or line == '' or line == '\n' or line.startswith('#'):
+                continue
+            name, value = line.split('=')
+            apiMap[name.strip()] = value.strip()
+
+        self.roleApiMap = {} # role to list of apis allowed
+        octetKey = {'Admin':1, 'DomainAdmin':4, 'User':8}
+        for role in octetKey.keys():
+            for api in sorted(apiMap.keys()):
+                if (octetKey[role] & int(apiMap[api])) > 0:
+                    if role not in self.roleApiMap:
+                        self.roleApiMap[role] = []
+                    self.roleApiMap[role].append(api)
+
+
+    def tearDown(self):
+        try:
+           cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            self.debug("Warning! Exception in tearDown: %s" % e)
+
+
+    def translateRoleToAccountType(self, role_type):
+        if role_type == 'User':
+            return 0
+        elif role_type == 'Admin':
+            return 1
+        elif role_type == 'DomainAdmin':
+            return 2
+        return -1
+
+
+    @attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
+    def test_static_role_account_acls(self):
+        """
+            Tests allowed APIs for common account types
+        """
+        for role in ['Admin', 'DomainAdmin', 'User']:
+            accountType = self.translateRoleToAccountType(role)
+            account = Account.create(
+                self.apiclient,
+                self.testdata['account'],
+                admin=accountType
+            )
+            self.cleanup.append(account)
+            userApiClient = self.testClient.getUserApiClient(UserName=account.name, DomainName=account.domain, type=accountType)
+            allowedApis = map(lambda x: x.name, userApiClient.listApis(listApis.listApisCmd()))
+            allApis = map(lambda x: x.name, self.apiclient.listApis(listApis.listApisCmd()))
+            for api in self.roleApiMap[role]:
+                if api not in allApis:
+                    continue
+                if api not in allowedApis:
+                    self.fail("API configured in commands.properties not returned by listApis: " + api + " for role: " + role)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/tools/apidoc/gen_toc.py
----------------------------------------------------------------------
diff --git a/tools/apidoc/gen_toc.py b/tools/apidoc/gen_toc.py
index 6974fd7..9277fb4 100644
--- a/tools/apidoc/gen_toc.py
+++ b/tools/apidoc/gen_toc.py
@@ -73,6 +73,7 @@ known_categories = {
     'Host': 'Host',
     'Cluster': 'Cluster',
     'Account': 'Account',
+    'Role': 'Role',
     'Snapshot': 'Snapshot',
     'User': 'User',
     'Os': 'Guest OS',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/tools/marvin/marvin/cloudstackConnection.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py
index aa7b18f..d044fdd 100644
--- a/tools/marvin/marvin/cloudstackConnection.py
+++ b/tools/marvin/marvin/cloudstackConnection.py
@@ -143,7 +143,7 @@ class CSConnection(object):
             ["=".join(
                 [str.lower(r[0]),
                  str.lower(
-                     urllib.quote_plus(str(r[1]))
+                     urllib.quote_plus(str(r[1]), safe="*")
                 ).replace("+", "%20")]
             ) for r in params]
         )

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 93923ad..f5f53a5 100755
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -87,13 +87,96 @@ class Domain:
         return(apiclient.listDomains(cmd))
 
 
+class Role:
+    """Manage Role"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, domainid=None):
+        """Create role"""
+        cmd = createRole.createRoleCmd()
+        cmd.name = services["name"]
+        cmd.type = services["type"]
+        if "description" in services:
+            cmd.description = services["description"]
+
+        return Role(apiclient.createRole(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete Role"""
+
+        cmd = deleteRole.deleteRoleCmd()
+        cmd.id = self.id
+        apiclient.deleteRole(cmd)
+
+    def update(self, apiclient, **kwargs):
+        """Update the role"""
+
+        cmd = updateRole.updateRoleCmd()
+        cmd.id = self.id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return apiclient.updateRole(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all Roles matching criteria"""
+
+        cmd = listRoles.listRolesCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listRoles(cmd))
+
+
+class RolePermission:
+    """Manage Role Permission"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, domainid=None):
+        """Create role permission"""
+        cmd = createRolePermission.createRolePermissionCmd()
+        cmd.roleid = services["roleid"]
+        cmd.rule = services["rule"]
+        cmd.permission = services["permission"]
+        if "description" in services:
+            cmd.description = services["description"]
+
+        return RolePermission(apiclient.createRolePermission(cmd).__dict__)
+
+    def delete(self, apiclient):
+        """Delete role permission"""
+
+        cmd = deleteRolePermission.deleteRolePermissionCmd()
+        cmd.id = self.id
+        apiclient.deleteRolePermission(cmd)
+
+    def update(self, apiclient, **kwargs):
+        """Update the role permission"""
+
+        cmd = updateRolePermission.updateRolePermissionCmd()
+        cmd.roleid = self.roleid
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return apiclient.updateRolePermission(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all role permissions matching criteria"""
+
+        cmd = listRolePermissions.listRolePermissionsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listRolePermissions(cmd))
+
+
 class Account:
     """ Account Life Cycle """
     def __init__(self, items):
         self.__dict__.update(items)
 
     @classmethod
-    def create(cls, apiclient, services, admin=False, domainid=None):
+    def create(cls, apiclient, services, admin=False, domainid=None, roleid=None):
         """Creates an account"""
         cmd = createAccount.createAccountCmd()
 
@@ -121,6 +204,10 @@ class Account:
 
         if domainid:
             cmd.domainid = domainid
+
+        if roleid:
+            cmd.roleid = roleid
+
         account = apiclient.createAccount(cmd)
 
         return Account(account.__dict__)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/ui/css/cloudstack3.css
----------------------------------------------------------------------
diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css
index 830a390..17cab9e 100644
--- a/ui/css/cloudstack3.css
+++ b/ui/css/cloudstack3.css
@@ -2904,6 +2904,15 @@ div.detail-group.actions td {
   background-position: -366px -239px;
 }
 
+#navigation ul li.roles span.icon {
+  background-position: -460px -80px;
+}
+
+#navigation ul li.roles.active span.icon,
+#navigation ul li.roles:hover span.icon {
+  background-position: -469px -750px;
+}
+
 #navigation ul li.accounts span.icon {
   background-position: -458px -19px;
 }
@@ -13162,3 +13171,10 @@ div.gpugroups div.list-view {
   background: transparent url("../images/icons.png") no-repeat -626px -209px;
   padding: 0 0 3px 18px;
 }
+
+ul.ui-autocomplete.ui-menu {
+  width: 250px;
+  background: #ddd;
+  font-size: 13px;
+  padding: 5px;
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/ui/dictionary.jsp
----------------------------------------------------------------------
diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp
index b97141c..ddcd181 100644
--- a/ui/dictionary.jsp
+++ b/ui/dictionary.jsp
@@ -1120,7 +1120,14 @@ dictionary = {
 'label.retry.interval': '<fmt:message key="label.retry.interval" />',
 'label.review': '<fmt:message key="label.review" />',
 'label.revoke.project.invite': '<fmt:message key="label.revoke.project.invite" />',
+'label.permission': '<fmt:message key="label.permission" />',
 'label.role': '<fmt:message key="label.role" />',
+'label.roles': '<fmt:message key="label.roles" />',
+'label.roletype': '<fmt:message key="label.roletype" />',
+'label.add.role': '<fmt:message key="label.add.role" />',
+'label.edit.role': '<fmt:message key="label.edit.role" />',
+'label.delete.role': '<fmt:message key="label.delete.role" />',
+'message.role.ordering.fail': '<fmt:message key="message.role.ordering.fail" />',
 'label.root.disk.controller': '<fmt:message key="label.root.disk.controller" />',
 'label.root.disk.offering': '<fmt:message key="label.root.disk.offering" />',
 'message.configure.firewall.rules.allow.traffic': '<fmt:message key="message.configure.firewall.rules.allow.traffic" />',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/ui/dictionary2.jsp
----------------------------------------------------------------------
diff --git a/ui/dictionary2.jsp b/ui/dictionary2.jsp
index 4268104..f919b15 100644
--- a/ui/dictionary2.jsp
+++ b/ui/dictionary2.jsp
@@ -26,6 +26,7 @@ under the License.
 <script type="text/javascript">
  $.extend(dictionary, {
 'label.add.ldap.account': '<fmt:message key="label.add.ldap.account" />',
+'label.rule': '<fmt:message key="label.rule" />',
 'label.rules': '<fmt:message key="label.rules" />',
 'label.running.vms': '<fmt:message key="label.running.vms" />',
 'label.s3.access_key': '<fmt:message key="label.s3.access_key" />',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/ui/images/icons.png
----------------------------------------------------------------------
diff --git a/ui/images/icons.png b/ui/images/icons.png
index fd1049d..f676969 100644
Binary files a/ui/images/icons.png and b/ui/images/icons.png differ

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/ui/index.jsp
----------------------------------------------------------------------
diff --git a/ui/index.jsp b/ui/index.jsp
index 703507f..34f6310 100644
--- a/ui/index.jsp
+++ b/ui/index.jsp
@@ -1823,6 +1823,7 @@
         <script type="text/javascript" src="scripts/ui-custom/uploadVolume.js"></script>
         <script type="text/javascript" src="scripts/storage.js"></script>
         <script type="text/javascript" src="scripts/templates.js"></script>
+        <script type="text/javascript" src="scripts/roles.js"></script>
         <script type="text/javascript" src="scripts/accountsWizard.js"></script>
         <script type="text/javascript" src="scripts/ui-custom/accountsWizard.js"></script>
         <script type="text/javascript" src="scripts/accounts.js"></script>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/ui/plugins/quota/quota.js
----------------------------------------------------------------------
diff --git a/ui/plugins/quota/quota.js b/ui/plugins/quota/quota.js
index 4780d71..4505b96 100644
--- a/ui/plugins/quota/quota.js
+++ b/ui/plugins/quota/quota.js
@@ -25,12 +25,18 @@
           id: 'quota',
           title: 'Quota',
           preFilter: function(args) {
-    	        var retval = $.ajax({
-                	url: createURL("quotaIsEnabled"),
-                	async: false
+                var pluginEnabled = false;
+                $.ajax({
+                    url: createURL("quotaIsEnabled"),
+                    async: false,
+                    success: function(json) {
+                        pluginEnabled = json.quotaisenabledresponse.isenabled.isenabled;
+                    },
+                    error: function(data) {
+                        pluginEnabled = false;
+                    }
                 });
-    	        var json = JSON.parse(retval.responseText);
-    	        return json.quotaisenabledresponse.isenabled.isenabled;
+                return pluginEnabled;
           },
           showOnNavigation: true,
           sectionSelect: {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/ui/scripts/accounts.js
----------------------------------------------------------------------
diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js
index 0058b69..913f81f 100644
--- a/ui/scripts/accounts.js
+++ b/ui/scripts/accounts.js
@@ -17,6 +17,7 @@
 (function(cloudStack) {
 
     var domainObjs;
+    var roleObjs;
 
     cloudStack.sections.accounts = {
         title: 'label.accounts',
@@ -38,11 +39,11 @@
                         name: {
                             label: 'label.name'
                         },
-                        accounttype: {
-                            label: 'label.role',
-                            converter: function(args) {
-                                return cloudStack.converters.toRole(args);
-                            }
+                        rolename: {
+                            label: 'label.role'
+                        },
+                        roletype: {
+                            label: 'label.roletype'
                         },
                         domain: {
                             label: 'label.domain'
@@ -678,11 +679,11 @@
                                     id: {
                                         label: 'label.id'
                                     },
-                                    accounttype: {
-                                        label: 'label.role',
-                                        converter: function(args) {
-                                            return cloudStack.converters.toRole(args);
-                                        }
+                                    rolename: {
+                                        label: 'label.role'
+                                    },
+                                    roletype: {
+                                        label: 'label.roletype'
                                     },
                                     domain: {
                                         label: 'label.domain'
@@ -1570,11 +1571,11 @@
                                     account: {
                                         label: 'label.account.name'
                                     },
-                                    accounttype: {
-                                        label: 'label.role',
-                                        converter: function(args) {
-                                            return cloudStack.converters.toRole(args);
-                                        }
+                                    rolename: {
+                                        label: 'label.role'
+                                    },
+                                    roletype: {
+                                        label: 'label.roletype'
                                     },
                                     domain: {
                                         label: 'label.domain'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/ui/scripts/accountsWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/accountsWizard.js b/ui/scripts/accountsWizard.js
index 633821e..7fc4014 100644
--- a/ui/scripts/accountsWizard.js
+++ b/ui/scripts/accountsWizard.js
@@ -110,24 +110,28 @@
                     required: false
                 }
             },
-            accounttype: {
-                label: 'label.type',
+            roleid: {
+                label: 'label.role',
                 docID: 'helpAccountType',
                 validation: {
                     required: true
                 },
                 select: function(args) {
-                    var items = [];
-                    items.push({
-                        id: 0,
-                        description: "User"
-                    }); //regular-user
-                    items.push({
-                        id: 1,
-                        description: "Admin"
-                    }); //root-admin
-                    args.response.success({
-                        data: items
+                    $.ajax({
+                        url: createURL("listRoles"),
+                        success: function(json) {
+                            var items = [];
+                            roleObjs = json.listrolesresponse.role;
+                            $(roleObjs).each(function() {
+                                items.push({
+                                    id: this.id,
+                                    description: this.name + ' (' + this.type + ')'
+                                });
+                            });
+                            args.response.success({
+                                data: items
+                            });
+                        }
                     });
                 }
             },
@@ -226,13 +230,9 @@
                 array1.push("&account=" + account);
             }
 
-            var accountType = args.data.accounttype;
-            if (accountType == "1") { //if "admin" is selected in account type dropdown
-                if (rootDomainId == undefined || args.data.domainid != rootDomainId ) { //but current login has no visibility to root domain object, or the selected domain is not root domain
-                    accountType = "2"; // change accountType from root-domain("1") to domain-admin("2")
-                }
+            if (args.data.roleid) {
+                array1.push("&roleid=" + args.data.roleid);
             }
-            array1.push("&accounttype=" + accountType);
 
             if (args.data.timezone !== null && args.data.timezone.length > 0) {
                 array1.push("&timezone=" + args.data.timezone);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/ui/scripts/cloudStack.js
----------------------------------------------------------------------
diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js
index 0725bf3..b712d6c 100644
--- a/ui/scripts/cloudStack.js
+++ b/ui/scripts/cloudStack.js
@@ -22,7 +22,7 @@
             var sections = [];
 
             if (isAdmin()) {
-                sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "system", "global-settings", "configuration", "projects", "regions", "affinityGroups"];
+                sections = ["dashboard", "instances", "storage", "network", "templates", "roles", "accounts", "domains", "events", "system", "global-settings", "configuration", "projects", "regions", "affinityGroups"];
             } else if (isDomainAdmin()) {
                 sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "projects", "configuration", "regions", "affinityGroups"];
             } else if (g_userProjectsEnabled) {
@@ -52,6 +52,7 @@
             templates: {},
             events: {},
             projects: {},
+            roles: {},
             accounts: {},
 
             domains: {}, //domain-admin and root-admin only

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/ui/scripts/roles.js
----------------------------------------------------------------------
diff --git a/ui/scripts/roles.js b/ui/scripts/roles.js
new file mode 100644
index 0000000..eae088f
--- /dev/null
+++ b/ui/scripts/roles.js
@@ -0,0 +1,388 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+(function($, cloudStack) {
+    var apiList = [];
+    var rolePermissions = [];
+    cloudStack.sections.roles = {
+        title: 'label.roles',
+        id: 'roles',
+        listView: {
+            id: 'roles',
+            fields: {
+                name: {
+                    label: 'label.name'
+                },
+                type: {
+                    label: 'label.type'
+                },
+                description: {
+                    label: 'label.description'
+                }
+            },
+            disableInfiniteScrolling: true,
+            dataProvider: function(args) {
+                var data = {};
+                if (args.filterBy.search && args.filterBy.search.value) {
+                    data['name'] = args.filterBy.search.value;
+                }
+                $.ajax({
+                    url: createURL("listRoles"),
+                    data: data,
+                    dataType: "json",
+                    async: true,
+                    success: function(json) {
+                        var jsonObj;
+                        jsonObj = json.listrolesresponse.role;
+                        args.response.success({
+                            data: jsonObj
+                        });
+                    }
+                });
+            },
+            actions: {
+                add: {
+                    label: 'label.add.role',
+                    preFilter: function(args) {
+                        if (isAdmin())
+                            return true;
+                    },
+                    messages: {
+                        notification: function() {
+                            return 'label.add.role';
+                        }
+                    },
+                    createForm: {
+                        title: 'label.add.role',
+                        fields: {
+                            name: {
+                                label: 'label.name',
+                                validation: {
+                                    required: true
+                                }
+                            },
+                            description: {
+                                label: 'label.description',
+                            },
+                            type: {
+                                label: 'label.type',
+                                validation: {
+                                    required: true
+                                },
+                                select: function(args) {
+                                    var items = [];
+                                    items.push({
+                                        id: "Admin",
+                                        description: "Admin"
+                                    });
+                                    items.push({
+                                        id: "DomainAdmin",
+                                        description: "Domain Admin"
+                                    });
+                                    items.push({
+                                        id: "User",
+                                        description: "User"
+                                    });
+                                    args.response.success({
+                                        data: items
+                                    });
+                                }
+                            }
+                        }
+                    },
+                    action: function(args) {
+                        $.ajax({
+                            url: createURL('createRole'),
+                            data: args.data,
+                            success: function(json) {
+                                var item = json.createroleresponse.role;
+                                args.response.success({
+                                    data: item
+                                });
+                            },
+                            error: function(json) {
+                                args.response.error(parseXMLHttpResponse(json));
+                            }
+                        });
+                    },
+                    notification: {
+                        poll: function(args) {
+                            args.complete();
+                        }
+                    }
+                }
+            },
+            detailView: {
+                tabs: {
+                    details: {
+                        title: 'label.details',
+                        fields: {
+                            id: {
+                                label: 'label.id'
+                            },
+                            name: {
+                                label: 'label.name',
+                                isEditable: true,
+                                validation: {
+                                    required: true
+                                }
+                            },
+                            type: {
+                                label: 'label.type'
+                            },
+                            description: {
+                                label: 'label.description',
+                                isEditable: true
+                            }
+                        },
+                        dataProvider: function(args) {
+                            $.ajax({
+                                url: createURL("listRoles&id=" + args.context.roles[0].id),
+                                dataType: "json",
+                                async: true,
+                                success: function(json) {
+                                    var response = json.listrolesresponse.role[0];
+                                    args.response.success({
+                                        data: response
+                                    });
+                                }
+                            });
+                        }
+                    },
+                    rules: {
+                        title: 'label.rules',
+                        custom: function(args) {
+                            var context = args.context;
+
+                            return $('<div>').multiEdit({
+                                context: context,
+                                noSelect: true,
+                                noHeaderActionsColumn: true,
+                                reorder: {
+                                    moveDrag: {
+                                        action: function(args) {
+                                            var rule = args.context.multiRule[0];
+                                            var prevItemId = args.prevItem ? args.prevItem.id : 0;
+
+                                            var ruleOrder = [];
+                                            $.each(rolePermissions, function(idx, item) {
+                                                var itemId = item.id;
+                                                if (idx == 0 && prevItemId == 0) {
+                                                    ruleOrder.push(rule.id);
+                                                }
+                                                if (itemId == rule.id) {
+                                                    return true;
+                                                }
+                                                ruleOrder.push(item.id);
+                                                if (prevItemId == itemId) {
+                                                    ruleOrder.push(rule.id);
+                                                }
+                                            });
+
+                                            $.ajax({
+                                                url: createURL('updateRolePermission'),
+                                                data: {
+                                                    roleid: rule.roleid,
+                                                    ruleorder: ruleOrder.join()
+                                                },
+                                                success: function(json) {
+                                                    args.response.success();
+                                                    $(window).trigger('cloudStack.fullRefresh');
+                                                },
+                                                error: function(json) {
+                                                    cloudStack.dialog.notice({
+                                                        message: 'message.role.ordering.fail'
+                                                    });
+                                                }
+                                            });
+                                        }
+                                    }
+                                },
+                                fields: {
+                                    'rule': {
+                                        edit: true,
+                                        label: 'label.rule',
+                                        isOptional: false
+                                    },
+                                    'permission': {
+                                        label: 'label.permission',
+                                        select: function(args) {
+                                            args.response.success({
+                                                data: [{
+                                                    name: 'allow',
+                                                    description: 'Allow'
+                                                }, {
+                                                    name: 'deny',
+                                                    description: 'Deny'
+                                                }]
+                                            });
+                                        }
+                                    },
+                                    'description': {
+                                        edit: true,
+                                        label: 'label.description',
+                                        isOptional: true
+                                    },
+                                    'always-hide': {
+                                        label: 'label.action',
+                                        addButton: true
+                                    }
+                                },
+                                add: {
+                                    label: 'label.add',
+                                    action: function(args) {
+                                        var data = {
+                                            rule: args.data.rule,
+                                            permission: args.data.permission,
+                                            description: args.data.description,
+                                            roleid: args.context.roles[0].id
+                                        };
+
+                                        $.ajax({
+                                            url: createURL('createRolePermission'),
+                                            data: data,
+                                            dataType: 'json',
+                                            success: function(json) {
+                                                var response = json.createrolepermissionresponse.rolepermission;
+                                                args.response.success({
+                                                    data: response
+                                                });
+                                            },
+                                            error: function(json) {
+                                                args.response.error(parseXMLHttpResponse(json));
+                                            }
+                                        });
+                                    }
+                                },
+                                actions: {
+                                    destroy: {
+                                        label: 'label.remove.rule',
+                                        action: function(args) {
+                                            $.ajax({
+                                                url: createURL('deleteRolePermission'),
+                                                data: {
+                                                    id: args.context.multiRule[0].id
+                                                },
+                                                dataType: 'json',
+                                                success: function(data) {
+                                                    args.response.success();
+                                                },
+                                                error: function(json) {
+                                                    args.response.error(parseXMLHttpResponse(json));
+                                                }
+                                            });
+                                        }
+                                    }
+                                },
+                                dataProvider: function(args) {
+                                    $.ajax({
+                                        url: createURL('listRolePermissions'),
+                                        data: {
+                                            roleid: args.context.roles[0].id
+                                        },
+                                        dataType: 'json',
+                                        success: function(json) {
+                                            var rules = json.listrolepermissionsresponse.rolepermission;
+                                            if (rules) {
+                                                rolePermissions = rules;
+                                            }
+                                            args.response.success({
+                                                data: rules
+                                            });
+                                        }
+                                    });
+                                    var setupAutocompletion = function() {
+                                        $($.find('input[name="rule"]')).autocomplete("destroy");
+                                        $($.find('input[name="rule"]')).autocomplete({
+                                            source: apiList,
+                                            autoFocus:true
+                                        });
+                                    };
+                                    if (apiList.length == 0) {
+                                        $.ajax({
+                                            url: createURL("listApis"),
+                                            dataType: "json",
+                                            success: function(json) {
+                                                var response = json.listapisresponse.api;
+                                                $.each(response, function(idx, api) {
+                                                    apiList.push(api.name);
+                                                });
+                                                setupAutocompletion();
+                                            }
+                                        });
+                                    } else {
+                                        setupAutocompletion();
+                                    }
+                                }
+                            });
+                        }
+                    }
+                },
+                actions: {
+                    edit: {
+                        label: 'label.edit.role',
+                        action: function(args) {
+                            var data = {
+                                id: args.context.roles[0].id,
+                                name: args.data.name,
+                                description: args.data.description
+                            };
+
+                            $.ajax({
+                                url: createURL('updateRole'),
+                                data: data,
+                                success: function(json) {
+                                    args.response.success();
+                                },
+                                error: function(json) {
+                                    args.response.error(parseXMLHttpResponse(json));
+                                }
+                            });
+                        }
+                    },
+                    remove: {
+                        label: 'label.delete.role',
+                        messages: {
+                            confirm: function(args) {
+                                return 'label.delete.role';
+                            },
+                            notification: function(args) {
+                                return 'label.delete.role';
+                            }
+                        },
+                        action: function(args) {
+                            $.ajax({
+                                url: createURL("deleteRole&id=" + args.context.roles[0].id),
+                                dataType: "json",
+                                success: function(json) {
+                                    var response = json.deleteroleresponse;
+                                    args.response.success({
+                                        data: response
+                                    });
+                                }
+                            });
+                        },
+                        notification: {
+                            poll: function(args) {
+                                args.complete();
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+})(jQuery, cloudStack);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/ui/scripts/sharedFunctions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index 7b4b26a..88d728e 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -1112,6 +1112,17 @@ cloudStack.converters = {
             return "Domain-Admin";
         }
     },
+    toAccountType: function(roleType) {
+        if (roleType == 'User') {
+            return 0;
+        } else if (roleType == 'Admin') {
+            return 1;
+        } else if (roleType == 'DomainAdmin') {
+            return 2;
+        } else if (roleType == 'ResourceAdmin') {
+            return 3;
+        }
+    },
     toAlertType: function(alertCode) {
         switch (alertCode) {
             case 0:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/utils/src/main/java/com/cloud/utils/ListUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/main/java/com/cloud/utils/ListUtils.java b/utils/src/main/java/com/cloud/utils/ListUtils.java
new file mode 100644
index 0000000..fa9332f
--- /dev/null
+++ b/utils/src/main/java/com/cloud/utils/ListUtils.java
@@ -0,0 +1,31 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.utils;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class ListUtils {
+    public static <T> List<T> toListOfInterface(final List<? extends T> items) {
+        if (items != null) {
+            return new ArrayList<>(items);
+        }
+        return Collections.emptyList();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/utils/src/main/java/com/cloud/utils/PropertiesUtil.java
----------------------------------------------------------------------
diff --git a/utils/src/main/java/com/cloud/utils/PropertiesUtil.java b/utils/src/main/java/com/cloud/utils/PropertiesUtil.java
index 4cb89f7..c0da87a 100644
--- a/utils/src/main/java/com/cloud/utils/PropertiesUtil.java
+++ b/utils/src/main/java/com/cloud/utils/PropertiesUtil.java
@@ -34,6 +34,10 @@ import org.apache.log4j.Logger;
 public class PropertiesUtil {
     private static final Logger s_logger = Logger.getLogger(PropertiesUtil.class);
 
+    public static String getDefaultApiCommandsFileName() {
+        return "commands.properties";
+    }
+
     /**
      * 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.


[35/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
CLOUDSTACK-9361: Centrally handle API validations

Validate API arguments based on annotations. Introduces:
- NotNullOrEmpty: for doing null and empty string checks
- PositiveNumber: number > 0 (natural number)

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 95abb6efc350189cb2be0cfd655c1205ced42155
Parents: 456680d
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Thu Apr 21 15:43:04 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Wed May 11 09:40:22 2016 +0530

----------------------------------------------------------------------
 .../apache/cloudstack/api/ApiArgValidator.java  | 23 +++++++++
 .../org/apache/cloudstack/api/Parameter.java    |  2 +
 .../cloud/api/dispatch/ParamProcessWorker.java  | 54 ++++++++++++++++++++
 3 files changed, 79 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/95abb6ef/api/src/org/apache/cloudstack/api/ApiArgValidator.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiArgValidator.java b/api/src/org/apache/cloudstack/api/ApiArgValidator.java
new file mode 100644
index 0000000..bd2294c
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/ApiArgValidator.java
@@ -0,0 +1,23 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api;
+
+public enum ApiArgValidator {
+    NotNullOrEmpty, // does Strings.isNullOrEmpty check
+    PositiveNumber, // does != null and > 0 check
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/95abb6ef/api/src/org/apache/cloudstack/api/Parameter.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/Parameter.java b/api/src/org/apache/cloudstack/api/Parameter.java
index 7ee6897..fa6075d 100644
--- a/api/src/org/apache/cloudstack/api/Parameter.java
+++ b/api/src/org/apache/cloudstack/api/Parameter.java
@@ -49,4 +49,6 @@ public @interface Parameter {
     String since() default "";
 
     RoleType[] authorized() default {};
+
+    ApiArgValidator[] validations() default {};
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/95abb6ef/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/dispatch/ParamProcessWorker.java b/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
index 099c0c9..feefaab 100644
--- a/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
+++ b/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
@@ -34,6 +34,7 @@ import java.text.SimpleDateFormat;
 
 import javax.inject.Inject;
 
+import com.google.common.base.Strings;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.acl.ControlledEntity;
@@ -49,6 +50,7 @@ import org.apache.cloudstack.api.EntityReference;
 import org.apache.cloudstack.api.InternalIdentity;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.ApiArgValidator;
 import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd;
 import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
 import org.apache.cloudstack.api.command.admin.usage.GetUsageRecordsCmd;
@@ -92,6 +94,55 @@ public class ParamProcessWorker implements DispatchWorker {
         processParameters(task.getCmd(), task.getParams());
     }
 
+    private void validateNonEmptyString(final Object param, final String argName) {
+        if (param == null || Strings.isNullOrEmpty(param.toString())) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, String.format("Empty or null value provided for API arg: %s", argName));
+        }
+    }
+
+    private void validateNaturalNumber(final Object param, final String argName) {
+        Long value = null;
+        if (param != null && param instanceof Long) {
+            value = (Long) param;
+        } else if (param != null) {
+            value = Long.valueOf(param.toString());
+        }
+        if (value == null || value < 1L) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, String.format("Invalid value provided for API arg: %s", argName));
+        }
+    }
+
+    private void validateField(final Object paramObj, final Parameter annotation) throws ServerApiException {
+        if (annotation == null) {
+            return;
+        }
+        final String argName = annotation.name();
+        for (final ApiArgValidator validator : annotation.validations()) {
+            if (validator == null) {
+                continue;
+            }
+            switch (validator) {
+                case NotNullOrEmpty:
+                    switch (annotation.type()) {
+                        case UUID:
+                        case STRING:
+                            validateNonEmptyString(paramObj, argName);
+                            break;
+                    }
+                    break;
+                case PositiveNumber:
+                    switch (annotation.type()) {
+                        case SHORT:
+                        case INTEGER:
+                        case LONG:
+                            validateNaturalNumber(paramObj, argName);
+                            break;
+                    }
+                    break;
+            }
+        }
+    }
+
     @SuppressWarnings({"unchecked", "rawtypes"})
     public void processParameters(final BaseCmd cmd, final Map params) {
         final Map<Object, AccessType> entitiesToAccess = new HashMap<Object, AccessType>();
@@ -112,6 +163,7 @@ public class ParamProcessWorker implements DispatchWorker {
 
             // marshall the parameter into the correct type and set the field value
             try {
+                validateField(paramObj, parameterAnnotation);
                 setFieldValue(field, cmd, paramObj, parameterAnnotation);
             } catch (final IllegalArgumentException argEx) {
                 if (s_logger.isDebugEnabled()) {
@@ -420,6 +472,7 @@ public class ParamProcessWorker implements DispatchWorker {
                 for (final Class<?> entity : entities) {
                     CallContext.current().putContextParameter(entity, internalId);
                 }
+                validateNaturalNumber(internalId, annotation.name());
                 return internalId;
             }
         }
@@ -452,6 +505,7 @@ public class ParamProcessWorker implements DispatchWorker {
             throw new InvalidParameterValueException("Invalid parameter " + annotation.name() + " value=" + uuid +
                     " due to incorrect long value format, or entity does not exist or due to incorrect parameter annotation for the field in api cmd class.");
         }
+        validateNaturalNumber(internalId, annotation.name());
         return internalId;
     }
 }


[11/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge release branch 4.7 to 4.8

* 4.7:
  Update L10N resource files with 4.7 strings from Transifex (20160502) Force "translator" mode with the transifex client.


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 38c9e9f336f39b310f4c83e8b39ec0c1dbd28fe8
Parents: 234ed9f 86dfcb2
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 4 10:47:33 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 4 10:47:33 2016 -0400

----------------------------------------------------------------------
 .../classes/resources/messages_de_DE.properties |    1 +
 .../classes/resources/messages_es.properties    | 1075 +++++++++++++++++-
 .../classes/resources/messages_fr_FR.properties |    3 +-
 .../classes/resources/messages_hu.properties    |   21 +-
 .../classes/resources/messages_it_IT.properties |    1 -
 .../classes/resources/messages_ja_JP.properties |    3 +-
 .../classes/resources/messages_ko_KR.properties |    1 -
 .../classes/resources/messages_nb_NO.properties |    3 +-
 .../classes/resources/messages_nl_NL.properties |    1 -
 .../classes/resources/messages_pt_BR.properties |    3 +-
 .../classes/resources/messages_ru_RU.properties |    1 -
 .../classes/resources/messages_zh_CN.properties |    1 -
 tools/transifex/sync-transifex-ui.sh            |    2 +-
 13 files changed, 1087 insertions(+), 29 deletions(-)
----------------------------------------------------------------------



[21/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Replace a timer.sleep(30) with pulling logic


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: eeb3373e412ab5cc5464709a01412e5cfc82636e
Parents: 9f970f2
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Mon May 2 22:38:55 2016 -0600
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Fri May 6 19:20:54 2016 -0600

----------------------------------------------------------------------
 tools/marvin/marvin/codes.py    | 25 +++++++++++++++++++++++++
 tools/marvin/marvin/lib/base.py | 36 ++++++++++++++++++++++++++++++++----
 2 files changed, 57 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eeb3373e/tools/marvin/marvin/codes.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/codes.py b/tools/marvin/marvin/codes.py
index c81e7e9..e23069b 100644
--- a/tools/marvin/marvin/codes.py
+++ b/tools/marvin/marvin/codes.py
@@ -116,6 +116,31 @@ Network states
 ALLOCATED = "Allocated"
 
 '''
+Host states
+'''
+HOST_CREATING = "Creating"
+HOST_CONNECTING = "Connecting"
+HOST_UP = "Up"
+HOST_DOWN = "Down"
+HOST_DISCONNECTED = "Disconnected"
+HOST_ALERT = "Alert"
+HOST_REMOVED = "Removed"
+HOST_ERROR = "Error"
+HOST_REBALANCING = "Rebalancing"
+HOST_UNKNOWN = "Unknown"
+
+'''
+Host resource states
+'''
+HOST_RS_CREATING = "Creating"
+HOST_RS_ENABLED = "Enabled"
+HOST_RS_DISABLED = "Disabled"
+HOST_RS_PREPARE_FOR_MAINTENANCE = "PrepareForMaintenance"
+HOST_RS_ERROR_IN_MAINTENANCE = "ErrorInMaintenance"
+HOST_RS_MAINTENANCE = "Maintenance"
+HOST_RS_ERROR = "Error"
+
+'''
 Storage Tags
 '''
 ZONETAG1 = "zwps1"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eeb3373e/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 906fb57..93923ad 100755
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -23,9 +23,10 @@ import marvin
 from marvin.cloudstackAPI import *
 from marvin.codes import (FAILED, FAIL, PASS, RUNNING, STOPPED,
                           STARTING, DESTROYED, EXPUNGING,
-                          STOPPING, BACKED_UP, BACKING_UP)
+                          STOPPING, BACKED_UP, BACKING_UP,
+                          HOST_RS_MAINTENANCE)
 from marvin.cloudstackException import GetDetailExceptionInfo, CloudstackAPIException
-from marvin.lib.utils import validateList, is_server_ssh_ready, random_gen
+from marvin.lib.utils import validateList, is_server_ssh_ready, random_gen, wait_until
 # Import System modules
 import time
 import hashlib
@@ -2459,13 +2460,40 @@ class Host:
                   GetDetailExceptionInfo(e)
             return FAILED
 
+    @staticmethod
+    def _check_resource_state(apiclient, hostid, resourcestate):
+        hosts = Host.list(apiclient, id=hostid, listall=True)
+
+        validationresult = validateList(hosts)
+
+        assert validationresult is not None, "'validationresult' should not be equal to 'None'."
+
+        assert isinstance(validationresult, list), "'validationresult' should be a 'list'."
+
+        assert len(validationresult) == 3, "'validationresult' should be a list with three items in it."
+
+        if validationresult[0] == FAIL:
+            raise Exception("Host list validation failed: %s" % validationresult[2])
+
+        if str(hosts[0].resourcestate).lower().decode("string_escape") == str(resourcestate).lower():
+            return True, None
+
+        return False, "Host is not in the following state: " + str(resourcestate)
+
     def delete(self, apiclient):
         """Delete Host"""
         # Host must be in maintenance mode before deletion
         cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
         cmd.id = self.id
         apiclient.prepareHostForMaintenance(cmd)
-        time.sleep(30)
+
+        retry_interval = 10
+        num_tries = 10
+
+        wait_result, return_val = wait_until(retry_interval, num_tries, Host._check_resource_state, apiclient, self.id, HOST_RS_MAINTENANCE)
+
+        if not wait_result:
+            raise Exception(return_val)
 
         cmd = deleteHost.deleteHostCmd()
         cmd.id = self.id
@@ -2711,7 +2739,7 @@ class StoragePool:
                           id=poolid, listAll=True)
                 validationresult = validateList(pools)
                 if validationresult[0] == FAIL:
-                    raise Exception("Host list validation failed: %s" % validationresult[2])
+                    raise Exception("Pool list validation failed: %s" % validationresult[2])
                 elif str(pools[0].state).lower().decode("string_escape") == str(state).lower():
                     returnValue = [PASS, None]
                     break


[29/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1428 from myENA/mysqlhapatch

Addresses CLOUDSTACK-9300 where the MySQL HA StaticStrategy class fai

* pr/1428:
  Addresses CLOUDSTACK-9300 where the MySQL HA StaticStrategy class fails to load successfully

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: bbfd69fbca0a51285dfdfae049158bcf99dda355
Parents: baecaa8 c22659d
Author: Will Stevens <wi...@gmail.com>
Authored: Tue May 10 23:51:58 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Tue May 10 23:51:59 2016 -0400

----------------------------------------------------------------------
 client/tomcatconf/catalina.properties.in      | 2 +-
 packaging/centos7/cloud-management.sysconfig  | 2 +-
 packaging/centos7/tomcat7/catalina.properties | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[28/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1440 from rodrigo93/Removed-Unused-Void-class

Removed Unused Void ClassRemoved the class _Void.java_ from _/cloud-framework-ipc/src/org/apache/cloudstack/framework/async/Void.java_ since the method _public void AsyncMethod(Object realParam,
AsyncCompletionCallback<Void> callback)_ does not exist and it does not seem to be used in another place.
Also, removed an unnecessary comment in
_/cloudstack-framework/ipc/test/org/apache/cloudstack/framework/codestyle/AsyncSampleListenerStyleCaller.java_

* pr/1440:
  Removed Unused Void Class

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: baecaa8c8e4815f87b79f28f63f9643aa40daa18
Parents: de582a4 01034ea
Author: Will Stevens <wi...@gmail.com>
Authored: Tue May 10 23:50:57 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Tue May 10 23:50:57 2016 -0400

----------------------------------------------------------------------
 .../apache/cloudstack/framework/async/Void.java | 27 --------------------
 .../AsyncSampleListenerStyleCaller.java         |  9 -------
 2 files changed, 36 deletions(-)
----------------------------------------------------------------------



[23/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1515 from milamberspace/L10N-update-4.8-20160422

L10n update 4.8 20160422@swill the good PR for 4.8 branch.

* pr/1515:
  Update L10N resource files with 4.8 strings from Transifex (20160504) Force "translator" mode with the transifex client. Update Transifex client config file for 4.8 resources/L10N ref. (generated by Tx client)

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 1c2400f4d81106ede7accb66e97248296eee146f
Parents: 38c9e9f e81a6b2
Author: Will Stevens <wi...@gmail.com>
Authored: Tue May 10 23:44:29 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Tue May 10 23:44:29 2016 -0400

----------------------------------------------------------------------
 .../classes/resources/messages_de_DE.properties |   1 +
 .../classes/resources/messages_es.properties    | 927 ++++++++++---------
 .../classes/resources/messages_fr_FR.properties |   9 +-
 .../classes/resources/messages_hu.properties    |   4 +-
 .../classes/resources/messages_ja_JP.properties |   2 +-
 .../classes/resources/messages_ko_KR.properties |  16 +-
 .../classes/resources/messages_nb_NO.properties |   9 +-
 .../classes/resources/messages_nl_NL.properties |   5 +-
 .../classes/resources/messages_pt_BR.properties |  11 +-
 .../classes/resources/messages_ru_RU.properties |  14 +-
 .../classes/resources/messages_zh_CN.properties |   2 +-
 tools/transifex/.tx/config                      |  19 +
 12 files changed, 522 insertions(+), 497 deletions(-)
----------------------------------------------------------------------



[44/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge release branch 4.7 to 4.8

* 4.7:
  When no zone name is available display a default


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 72811b4058097c66f56a5882c79a7fc6d8cc25c7
Parents: 1c2400f 5a79c2b
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 11 01:31:21 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 11 01:31:21 2016 -0400

----------------------------------------------------------------------
 ui/scripts/templates.js | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------



[07/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1463 from DaanHoogland/CLOUDSTACK-9336

CLOUDSTACK-9336 surround the execution of baremetal-vr.py with condition

* pr/1463:
  CLOUDSTACK-9336 surround the execution of baremetal-vr.py with condition

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 29ba71f2db3a3b7dcdad3a7c1f83725cffd56261
Parents: ccb4fe0 2a88b11
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 4 10:29:14 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 4 10:29:15 2016 -0400

----------------------------------------------------------------------
 systemvm/patches/debian/config/etc/rc.local | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[13/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
CLOUDSTACK-9340: General DB Optimization


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 8b6e6185f53cbdcfc13cced34ad531a6df3e9b09
Parents: 4d57ec0
Author: nvazquez <ni...@gmail.com>
Authored: Fri Apr 8 10:47:50 2016 -0700
Committer: nvazquez <ni...@gmail.com>
Committed: Wed May 4 09:13:17 2016 -0700

----------------------------------------------------------------------
 setup/db/db/schema-481to490-cleanup.sql | 65 ++++++++++++++++++++++++++++
 setup/db/db/schema-481to490.sql         | 23 ++++++++++
 2 files changed, 88 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b6e6185/setup/db/db/schema-481to490-cleanup.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-481to490-cleanup.sql b/setup/db/db/schema-481to490-cleanup.sql
index c74fa41..b1bb702 100644
--- a/setup/db/db/schema-481to490-cleanup.sql
+++ b/setup/db/db/schema-481to490-cleanup.sql
@@ -18,3 +18,68 @@
 --;
 -- Schema cleanup from 4.8.1 to 4.9.0;
 --;
+
+-- Added in CLOUDSTACK-9340: General DB optimization, 4 cases:
+
+----- 1) Incorrect PRIMARY key
+ALTER TABLE `cloud`.`ovs_tunnel_network` 
+DROP PRIMARY KEY,
+ADD PRIMARY KEY (`id`),
+DROP INDEX `id` ,
+ADD UNIQUE INDEX `i_to_from_network_id` (`to` ASC, `from` ASC, `network_id` ASC);
+
+----- 2) Duplicate PRIMARY KEY
+ALTER TABLE `cloud`.`user_vm` DROP INDEX `id_2` ,DROP INDEX `id` ;
+ALTER TABLE `cloud`.`domain_router` DROP INDEX `id_2` ,DROP INDEX `id` ;
+ALTER TABLE `cloud`.`vm_instance` DROP INDEX `id_2` ,DROP INDEX `id` ;
+ALTER TABLE `cloud`.`account_vlan_map` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`account_vnet_map` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`baremetal_rct` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`cluster` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`conditions` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`counter` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`data_center` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`dc_storage_network_ip_range` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`dedicated_resources` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`host_pod_ref` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`iam_group` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`iam_policy` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`iam_policy_permission` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`image_store_details` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`instance_group` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`netapp_lun` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`netapp_pool` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`netapp_volume` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`network_acl_item_cidrs` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`network_offerings` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`nic_secondary_ips` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`nics` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`op_ha_work` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`op_host` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`op_host_transfer` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`op_networks` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`op_nwgrp_work` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`op_vm_ruleset_log` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`op_vpc_distributed_router_sequence_no` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`pod_vlan_map` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`portable_ip_address` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`portable_ip_range` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`region` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`remote_access_vpn` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`snapshot_details` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`snapshots` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`storage_pool` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`storage_pool_details` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`storage_pool_work` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`user_ip_address` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`user_ipv6_address` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`user_statistics` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`version` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`vlan` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`vm_disk_statistics` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`vm_snapshot_details` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`vm_work_job` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`vpc_gateways` DROP INDEX `id` ;
+ALTER TABLE `cloud`.`vpn_users` DROP INDEX `id` ;
+
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b6e6185/setup/db/db/schema-481to490.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-481to490.sql b/setup/db/db/schema-481to490.sql
index b9a8b2f..a02615f 100644
--- a/setup/db/db/schema-481to490.sql
+++ b/setup/db/db/schema-481to490.sql
@@ -413,3 +413,26 @@ VIEW `user_vm_view` AS
 
 -- Add cluster.storage.operations.exclude property
 INSERT INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `description`, `default_value`, `updated`, `scope`, `is_dynamic`) VALUES ('Advanced', 'DEFAULT', 'CapacityManager', 'cluster.storage.operations.exclude', 'Exclude cluster from storage operations', 'false', now(), 'Cluster', '1');
+
+----- 3) Missing indexes (Add indexes to avoid full table scans)
+ALTER TABLE `cloud`.`op_it_work` ADD INDEX `i_type_and_updated` (`type` ASC, `updated_at` ASC);
+ALTER TABLE `cloud`.`vm_root_disk_tags` ADD INDEX `i_vm_id` (`vm_id` ASC);
+ALTER TABLE `cloud`.`vm_compute_tags` ADD INDEX `i_vm_id` (`vm_id` ASC);
+ALTER TABLE `cloud`.`vm_network_map` ADD INDEX `i_vm_id` (`vm_id` ASC);
+ALTER TABLE `cloud`.`ssh_keypairs` ADD INDEX `i_public_key` (`public_key` (64) ASC);
+ALTER TABLE `cloud`.`user_vm_details` ADD INDEX `i_name_vm_id` (`vm_id` ASC, `name` ASC);
+ALTER TABLE `cloud`.`instance_group` ADD INDEX `i_name` (`name` ASC);
+
+----- 4) Some views query (Change view to improve account retrieval speed) 
+CREATE OR REPLACE
+VIEW `account_vmstats_view` AS
+    SELECT 
+        `vm_instance`.`account_id` AS `account_id`,
+        `vm_instance`.`state` AS `state`,
+        COUNT(0) AS `vmcount`
+    FROM
+        `vm_instance`
+    WHERE
+        (`vm_instance`.`vm_type` = 'User' and `vm_instance`.`removed` is NULL)
+    GROUP BY `vm_instance`.`account_id` , `vm_instance`.`state`;
+-- End CLOUDSTACK-9340


[04/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1433 from Slair1/patch-1

CLOUDSTACK-9305: Cloudstack Usage Breaks if DB HA enabledWith DB HA enabled in db.properties, the cloudstack-usage service restarts every 10 seconds.  Making the suggested change has fixed it for me.  Cloudstack 4.8 on Centos7

* pr/1433:
  Cloudstack Usage Breaks if DB HA enabled

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: b8286548b12e114d18501b97200bb3889bda31e5
Parents: c7d1b81 6089d89
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 4 10:24:52 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 4 10:24:52 2016 -0400

----------------------------------------------------------------------
 packaging/systemd/cloudstack-usage.service | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8286548/packaging/systemd/cloudstack-usage.service
----------------------------------------------------------------------
diff --cc packaging/systemd/cloudstack-usage.service
index d80aba6,c37f32c..641d125
--- a/packaging/systemd/cloudstack-usage.service
+++ b/packaging/systemd/cloudstack-usage.service
@@@ -27,11 -27,10 +27,11 @@@ Environment=JAVA_HOME=/usr/lib/jvm/jr
  Environment=JAVA_HEAP_INITIAL=256m
  Environment=JAVA_HEAP_MAX=2048m
  Environment=JAVA_CLASS=com.cloud.usage.UsageServer
 +Environment=JAVA_PID=$$
  ExecStart=/bin/sh -ec '\
-     export UCP=`ls /usr/share/cloudstack-usage/cloud-usage-*.jar /usr/share/cloudstack-usage/lib/*.jar | tr "\\n" ":"`; \
+     export UCP=`ls /usr/share/cloudstack-usage/cloud-usage-*.jar /usr/share/cloudstack-usage/lib/*.jar /usr/share/cloudstack-mysql-ha/lib/*.jar | tr "\\n" ":"`; \
      export CLASSPATH="$UCP:/etc/cloudstack/usage:/usr/share/java/mysql-connector-java.jar"; \
 -    ${JAVA_HOME}/bin/java -Xms${JAVA_HEAP_INITIAL} -Xmx${JAVA_HEAP_MAX} -cp "$CLASSPATH" $JAVA_CLASS'
 +    ${JAVA_HOME}/bin/java -Dpid=${JAVA_PID} -Xms${JAVA_HEAP_INITIAL} -Xmx${JAVA_HEAP_MAX} -cp "$CLASSPATH" $JAVA_CLASS'
  Restart=always
  RestartSec=10s
  


[30/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1054 from wido/CLOUDSTACK-8818

CLOUDSTACK-8818: Use MySQL native connector with PythonMySQLdb has been deprecated and is also not supported in Python 3.

mysql.connector is a connector written in Python which talks the
native MySQL protocol without any external code.

https://dev.mysql.com/doc/connector-python/en/

* pr/1054:
  CLOUDSTACK-8818: Use MySQL native connector with Python

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: d2a95b4c691a844b24616e30a290a9839df643ee
Parents: bbfd69f 92e3ba2
Author: Will Stevens <wi...@gmail.com>
Authored: Tue May 10 23:54:22 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Tue May 10 23:54:23 2016 -0400

----------------------------------------------------------------------
 .../bindir/cloud-update-xenserver-licenses.in   |  4 +-
 debian/control                                  |  4 +-
 packaging/centos63/cloud.spec                   |  4 +-
 packaging/centos7/cloud.spec                    |  4 +-
 packaging/fedora20/cloud.spec                   |  4 +-
 packaging/fedora21/cloud.spec                   |  4 +-
 python/lib/cloudutils/db.py                     | 45 ++++++++++----------
 setup/bindir/cloud-migrate-databases.in         |  8 ++--
 8 files changed, 38 insertions(+), 39 deletions(-)
----------------------------------------------------------------------



[14/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e81a6b27/client/WEB-INF/classes/resources/messages_fr_FR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_fr_FR.properties b/client/WEB-INF/classes/resources/messages_fr_FR.properties
index 26dd37d..17a68c5 100644
--- a/client/WEB-INF/classes/resources/messages_fr_FR.properties
+++ b/client/WEB-INF/classes/resources/messages_fr_FR.properties
@@ -1119,6 +1119,7 @@ label.nfs.server=Serveur NFS
 label.nfs.storage=Stockage NFS
 label.nic.adapter.type=Type de carte r\u00e9seau
 label.nicira.controller.address=Adresse du contr\u00f4leur
+label.nicira.l2gatewayserviceuuid=Uuid du service passerelle L2
 label.nicira.l3gatewayserviceuuid=Uuid du service passerelle L3
 label.nicira.nvp.details=D\u00e9tails Nicira NVP
 label.nicira.transportzoneuuid=Uuid de la Zone Transport
@@ -1178,7 +1179,7 @@ label.passive=Passif
 label.password.enabled=Mot de passe activ\u00e9
 label.password.lower=mot de passe
 label.password=Mot de passe
-label.password.reset.confirm=Le mot de passe a \u00e9t\u00e9 r\u00e9-initialis\u00e9 en
+label.password.reset.confirm=Le mot de passe a \u00e9t\u00e9 r\u00e9-initialiser en
 label.path=Chemin
 label.PA.threat.profile=Profil menace Palo Alto
 label.perfect.forward.secrecy=Confidentialit\u00e9 persistante
@@ -1396,7 +1397,7 @@ label.s3.endpoint=Terminaison
 label.s3.max_error_retry=Nombre d\\'essai en erreur max.
 label.s3.nfs.path=Chemin NFS S3
 label.s3.nfs.server=Serveur NFS S3
-label.s3.secret_key=Cl\u00e9 Priv\u00e9e
+label.s3.secret_key=Cl\u00e9 priv\u00e9e
 label.s3.socket_timeout=D\u00e9lai d\\'expiration de la socket
 label.s3.use_https=Utiliser HTTPS
 label.saml.enable=Autoriser SAML SSO
@@ -1669,12 +1670,12 @@ label.virtual.routers.group.cluster=Routeurs virtuels group\u00e9s par cluster
 label.virtual.routers.group.pod=Routeurs virtuels group\u00e9s par pod
 label.virtual.routers.group.zone=Routeurs virtuels group\u00e9s par zone
 label.virtual.routers=Routeurs virtuels
-label.vlan.id=ID du VLAN
+label.vlan.id=ID VLAN/VNI
 label.vlan.only=VLAN
 label.vlan.range.details=D\u00e9tails plage VLAN
 label.vlan.range=Plage du VLAN
 label.vlan.ranges=Plage(s) VLAN
-label.vlan=VLAN
+label.vlan=VLAN/VNI
 label.vlan.vni.range=Plage du VLAN
 label.vlan.vni.ranges=Plage(s) VLAN/VNI
 label.vm.add=Ajouter une instance

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e81a6b27/client/WEB-INF/classes/resources/messages_hu.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_hu.properties b/client/WEB-INF/classes/resources/messages_hu.properties
index e75ee35..6dd3675 100644
--- a/client/WEB-INF/classes/resources/messages_hu.properties
+++ b/client/WEB-INF/classes/resources/messages_hu.properties
@@ -1160,7 +1160,7 @@ label.passive=Passz\u00edv
 label.password.enabled=Jelsz\u00f3 bekapcsolva
 label.password=Jelsz\u00f3
 label.password.lower=jelsz\u00f3
-label.password.reset.confirm=Az \u00faj jelsz\u00f3
+label.password.reset.confirm=A jelsz\u00f3 \u00fajrabe\u00e1ll\u00edtva\:
 label.PA.threat.profile=Palo Alto fenyeget\u00e9s profil
 label.path=\u00datvonal
 label.perfect.forward.secrecy=Perfect Forward Secrecy
@@ -2108,7 +2108,7 @@ message.template.desc=Oper\u00e1ci\u00f3s rendszer k\u00e9p, amelyet a virtu\u00
 message.tier.required=A r\u00e9teg k\u00f6telez\u0151.
 message.tooltip.dns.1=Name of a DNS server for use by VMs in the zone. The public IP addresses for the zone must have a route to this server.
 message.tooltip.dns.2=A second DNS server name for use by VMs in the zone. The public IP addresses for the zone must have a route to this server.
-message.tooltip.internal.dns.1=Name of a DNS server for use by CloudStack internal system VMs in the zone. The private IP address for the pods must have a route to this server.
+message.tooltip.internal.dns.1=Egy DNS szerver neve, a z\u00f3na bels\u0151 rendszer VM-einek kiszolg\u00e1l\u00e1s\u00e1ra. A pod-ok priv\u00e1t IP c\u00edmeinek sz\u00fcks\u00e9ge van egy \u00fatvonalhoz ehhez a c\u00edmhez.
 message.tooltip.internal.dns.2=Egy DNS szerver neve, a z\u00f3na bels\u0151 rendszer VM-einek kiszolg\u00e1l\u00e1s\u00e1ra. A pod-ok priv\u00e1t IP c\u00edmeinek sz\u00fcks\u00e9ge van egy \u00fatvonalhoz ehhez a c\u00edmhez.
 message.tooltip.network.domain=A DNS suffix that will create a custom domain name for the network that is accessed by guest VMs.
 message.tooltip.pod.name=N\u00e9v a pod-nak

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e81a6b27/client/WEB-INF/classes/resources/messages_ja_JP.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ja_JP.properties b/client/WEB-INF/classes/resources/messages_ja_JP.properties
index 76cd269..5fc7adf 100644
--- a/client/WEB-INF/classes/resources/messages_ja_JP.properties
+++ b/client/WEB-INF/classes/resources/messages_ja_JP.properties
@@ -1642,7 +1642,7 @@ label.vmware.datacenter.name=VMware \u30c7\u30fc\u30bf\u30bb\u30f3\u30bf\u30fc\u
 label.vmware.datacenter.vcenter=VMware \u30c7\u30fc\u30bf\u30bb\u30f3\u30bf\u30fc\u306e vCenter
 label.vmware.traffic.label=VMware \u306e\u30c8\u30e9\u30d5\u30a3\u30c3\u30af \u30e9\u30d9\u30eb
 label.vnet.id=VLAN/VNI ID
-label.vnet=VLAN/VNI
+label.vnet=VLAN
 label.vnmc.devices=VNMC \u30c7\u30d0\u30a4\u30b9
 label.vnmc=VNMC
 label.volatile=\u63ee\u767a\u6027

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e81a6b27/client/WEB-INF/classes/resources/messages_ko_KR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ko_KR.properties b/client/WEB-INF/classes/resources/messages_ko_KR.properties
index 106cf36..6123623 100644
--- a/client/WEB-INF/classes/resources/messages_ko_KR.properties
+++ b/client/WEB-INF/classes/resources/messages_ko_KR.properties
@@ -316,7 +316,7 @@ label.agent.username=\uc5d0\uc774\uc804\ud2b8 \uc0ac\uc6a9\uc790\uba85
 label.agree=\ub3d9\uc758
 label.alert=\uc54c\ub9bc \uccb4\uc81c
 label.algorithm=\uc54c\uace0\ub9ac\uc998
-label.allocated=\ud560\ub2f9 \uc644\ub8cc \uc0c1\ud0dc
+label.allocated=\ud560\ub2f9 \ub05d\ub09c \uc0c1\ud0dc
 label.allocation.state=\ud560\ub2f9 \uc0c1\ud0dc
 label.api.key=API \ud0a4
 label.apply=\uc801\uc6a9
@@ -705,10 +705,10 @@ label.menu.templates=\ud15c\ud50c\ub9bf
 label.menu.virtual.appliances=\uac00\uc0c1 \uc544\ud504\ub77c\uc774\uc548\uc2a4
 label.menu.virtual.resources=\uac00\uc0c1 \uc790\uc6d0
 label.menu.volumes=\ubcfc\ub968
-label.metrics.allocated=\ud560\ub2f9 \uc644\ub8cc \uc0c1\ud0dc
+label.metrics.allocated=\ud560\ub2f9 \ub05d\ub09c \uc0c1\ud0dc
 label.metrics.clusters=\ud074\ub7ec\uc2a4\ud130
 label.metrics.cpu.used.avg=\uc0ac\uc6a9 \uc911
-label.metrics.disk.allocated=\ud560\ub2f9 \uc644\ub8cc \uc0c1\ud0dc
+label.metrics.disk.allocated=\ud560\ub2f9 \ub05d\ub09c \uc0c1\ud0dc
 label.metrics.disk.size=\ud06c\uae30
 label.metrics.disk.storagetype=\uc885\ub958
 label.metrics.disk.used=\uc0ac\uc6a9 \uc911
@@ -1336,7 +1336,7 @@ message.installWizard.tooltip.addHost.hostname=\ud638\uc2a4\ud2b8 DNS \uba85 \ub
 message.installWizard.tooltip.addHost.password=XenServer \uce21\uc5d0\uc11c \uc9c0\uc815\ud55c \uc704\uc758 \uc0ac\uc6a9\uc790\uba85\uc5d0 \ub300\ud55c \uc554\ud638\uc785\ub2c8\ub2e4.
 message.installWizard.tooltip.addHost.username=\uc6d0\ub798 root \uc785\ub2c8\ub2e4.
 message.installWizard.tooltip.addPod.name=Pod \uc774\ub984\uc785\ub2c8\ub2e4.
-message.installWizard.tooltip.addPod.reservedSystemEndIp=\uc774\uac83\uc740 2\ucc28 \uc2a4\ud1a0\ub9ac\uc9c0 VM \ubc0f \ucf58\uc194 \ud504\ub85d\uc2dc VM\ub97c \uad00\ub9ac\ud558\uae30 \uc704\ud574\uc11c CloudStack\uc5d0\uc11c \uc0ac\uc6a9\ud558\ub294 \uc0ac\uc124 \ub124\ud2b8\uc6cc\ud06c\ub0b4 IP \uc8fc\uc18c \ubc94\uc704\uc785\ub2c8\ub2e4. \uc774\ub7ec\ud55c IP \uc8fc\uc18c\ub294 \ucef4\ud4e8\ud305 \uc11c\ubc84\uc640 \uac19\uc740 \uc11c\ube0c\ub124\ud2b8\uc6cc\ud06c\uc5d0\uc11c \ud560\ub2f9\ud569\ub2c8\ub2e4.
+message.installWizard.tooltip.addPod.reservedSystemEndIp=\uc774\uac83\uc740 2\ucc28 \uc2a4\ud1a0\ub9ac\uc9c0 VM \ubc0f \ucf58\uc194 \ud504\ub85d\uc2dc VM\ub97c \uad00\ub9ac\ud558\uae30 \uc704\ud574\uc11c CloudStack\uc5d0\uc11c \uc0ac\uc6a9\ud558\ub294 \uc0ac\uc124 \ub124\ud2b8\uc6cc\ud06c\ub0b4\uc758 IP \uc8fc\uc18c \ubc94\uc704\uc785\ub2c8\ub2e4. \uc774\ub7ec\ud55c IP \uc8fc\uc18c\ub294 \ucef4\ud4e8\ud305 \uc11c\ubc84\uc640 \uac19\uc740 \uc11c\ube0c\ub124\ud2b8\uc6cc\ud06c\uc5d0\uc11c \ud560\ub2f9\ud569\ub2c8\ub2e4.
 message.installWizard.tooltip.addPod.reservedSystemGateway=\ud604\uc7ac Pod\ub0b4 \ud638\uc2a4\ud2b8 \uac8c\uc774\ud2b8\uc6e8\uc774\uc785\ub2c8\ub2e4.
 message.installWizard.tooltip.addPod.reservedSystemNetmask=\uac8c\uc2a4\ud2b8\uac00 \uc0ac\uc6a9\ud558\ub294 \uc11c\ube0c\ub124\ud2b8\uc6cc\ud06c\uc0c1\uc5d0\uc11c \uc9c0\uc815\ud55c \ub137 \ub9c8\uc2a4\ud06c\uc785\ub2c8\ub2e4.
 message.installWizard.tooltip.addPod.reservedSystemStartIp=\uc774\uac83\uc740 2\ucc28 \uc2a4\ud1a0\ub9ac\uc9c0 VM \ubc0f \ucf58\uc194 \ud504\ub85d\uc2dc VM\ub97c \uad00\ub9ac\ud558\uae30 \uc704\ud574\uc11c CloudStack\uc5d0\uc11c \uc0ac\uc6a9\ud558\ub294 \uc0ac\uc124 \ub124\ud2b8\uc6cc\ud06c\ub0b4\uc758 IP \uc8fc\uc18c \ubc94\uc704\uc785\ub2c8\ub2e4. \uc774\ub7ec\ud55c IP \uc8fc\uc18c\ub294 \ucef4\ud4e8\ud305 \uc11c\ubc84\uc640 \uac19\uc740 \uc11c\ube0c\ub124\ud2b8\uc6cc\ud06c\uc5d0\uc11c \ud560\ub2f9\ud569\ub2c8\ub2e4.
@@ -1345,13 +1345,13 @@ message.installWizard.tooltip.addPrimaryStorage.path=(NFS\uc758 \uacbd\uc6b0) \u
 message.installWizard.tooltip.addPrimaryStorage.server=(NFS, iSCSI \ub610\ub294 PreSetup\uc758 \uacbd\uc6b0) \uc2a4\ud1a0\ub9ac\uc9c0 \uae30\uae30\uc758 IP \uc8fc\uc18c \ub610\ub294 DNS \uba85\uc785\ub2c8\ub2e4.
 message.installWizard.tooltip.addSecondaryStorage.nfsServer=2\ucc28 \uc2a4\ud1a0\ub9ac\uc9c0\ub97c \ud638\uc2a4\ud2b8 \ud558\ub294 NFS \uc11c\ubc84 IP \uc8fc\uc18c\uc785\ub2c8\ub2e4.
 message.installWizard.tooltip.addSecondaryStorage.path=\uc704\uc5d0\uc11c \uc9c0\uc815\ud55c \uc11c\ubc84\uc5d0 \uc874\uc7ac\ud558\ub294 \ub0b4\ubcf4\ub0b4\uae30 \uacbd\ub85c\uc785\ub2c8\ub2e4.
-message.installWizard.tooltip.addZone.dns1=Zone\ub0b4\uc758 \uac8c\uc2a4\ud2b8 VM\uc73c\ub85c \uc0ac\uc6a9\ud558\ub294 DNS \uc11c\ubc84\uc785\ub2c8\ub2e4. \uc774\ub7ec\ud55c DNS \uc11c\ubc84\uc5d0\ub294 \ub2e4\uc74c\uc5d0 \ucd94\uac00\ud558\ub294 \uacf5\uac1c \ub124\ud2b8\uc6cc\ud06c \uacbd\uc720\ub85c \uc811\uadfc \ud569\ub2c8\ub2e4. Zone\uc758 \uacf5\uac1c IP \uc8fc\uc18c\uc5d0\uc11c \uc5ec\uae30\uc11c \uc9c0\uc815\ud558\ub294 \uacf5\uac1c DNS \uc11c\ubc84\uc5d0 \ud1b5\uc2e0\ud560 \uc218 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4.
+message.installWizard.tooltip.addZone.dns1=Zone\ub0b4 \uac8c\uc2a4\ud2b8 VM \ub85c \uc0ac\uc6a9\ud558\ub294 DNS \uc11c\ubc84\uc785\ub2c8\ub2e4. \ud604\uc7ac DNS \uc11c\ubc84\uc5d0\ub294 \ub2e4\uc74c\uc5d0 \ucd94\uac00\ud558\ub294 \uacf5\uac1c \ub124\ud2b8\uc6cc\ud06c \uacbd\uc720\ub85c \uc811\uadfc\ud569\ub2c8\ub2e4. Zone\uc758 \uacf5\uac1c IP \uc8fc\uc18c\uc5d0\uc11c \uc5ec\uae30\uc11c \uc9c0\uc815\ud558\ub294 \uacf5\uac1c DNS \uc11c\ubc84\uc5d0 \ud1b5\uc2e0\ud560 \uc218 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4.
 message.installWizard.tooltip.addZone.dns2=Zone\ub0b4 \uac8c\uc2a4\ud2b8 VM \ub85c \uc0ac\uc6a9\ud558\ub294 DNS \uc11c\ubc84\uc785\ub2c8\ub2e4. \ud604\uc7ac DNS \uc11c\ubc84\uc5d0\ub294 \ub2e4\uc74c\uc5d0 \ucd94\uac00\ud558\ub294 \uacf5\uac1c \ub124\ud2b8\uc6cc\ud06c \uacbd\uc720\ub85c \uc811\uadfc\ud569\ub2c8\ub2e4. Zone\uc758 \uacf5\uac1c IP \uc8fc\uc18c\uc5d0\uc11c \uc5ec\uae30\uc11c \uc9c0\uc815\ud558\ub294 \uacf5\uac1c DNS \uc11c\ubc84\uc5d0 \ud1b5\uc2e0\ud560 \uc218 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4.
-message.installWizard.tooltip.addZone.internaldns1=Zone\ub0b4\uc758 \uc2dc\uc2a4\ud15c VM \ub85c \uc0ac\uc6a9\ud558\ub294 DNS \uc11c\ubc84\uc785\ub2c8\ub2e4. \ud604\uc7ac DNS \uc11c\ubc84\ub294 \uc2dc\uc2a4\ud15c VM\uc758 \uc0ac\uc124 \ub124\ud2b8\uc6cc\ud06c \uc778\ud130\ud398\uc774\uc2a4\ub97c \uac1c\uc785\uc2dc\ucf1c \uc811\uadfc\ud569\ub2c8\ub2e4. Pod\uc758 \uc0ac\uc124 IP \uc8fc\uc18c\uc5d0\uc11c \uc5ec\uae30\uc11c \uc9c0\uc815\ud558\ub294 DNS \uc11c\ubc84\uc5d0 \ud1b5\uc2e0\ud560 \uc218 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4.
+message.installWizard.tooltip.addZone.internaldns1=Zone\ub0b4 \uc2dc\uc2a4\ud15c VM\uc73c\ub85c \uc0ac\uc6a9\ud558\ub294 DNS \uc11c\ubc84\uc785\ub2c8\ub2e4. \ud604\uc7ac DNS \uc11c\ubc84\ub294 \uc2dc\uc2a4\ud15c VM\uc758 \uc0ac\uc124 \ub124\ud2b8\uc6cc\ud06c \uc778\ud130\ud398\uc774\uc2a4\ub97c \uac1c\uc785\uc2dc\ucf1c \uc811\uadfc\ud569\ub2c8\ub2e4. Pod\uc758 \uc0ac\uc124 IP \uc8fc\uc18c\uc5d0\uc11c \uc5ec\uae30\uc11c \uc9c0\uc815\ud558\ub294 DNS \uc11c\ubc84\uc5d0 \ud1b5\uc2e0\ud560 \uc218 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4.
 message.installWizard.tooltip.addZone.internaldns2=Zone\ub0b4 \uc2dc\uc2a4\ud15c VM\uc73c\ub85c \uc0ac\uc6a9\ud558\ub294 DNS \uc11c\ubc84\uc785\ub2c8\ub2e4. \ud604\uc7ac DNS \uc11c\ubc84\ub294 \uc2dc\uc2a4\ud15c VM\uc758 \uc0ac\uc124 \ub124\ud2b8\uc6cc\ud06c \uc778\ud130\ud398\uc774\uc2a4\ub97c \uac1c\uc785\uc2dc\ucf1c \uc811\uadfc\ud569\ub2c8\ub2e4. Pod\uc758 \uc0ac\uc124 IP \uc8fc\uc18c\uc5d0\uc11c \uc5ec\uae30\uc11c \uc9c0\uc815\ud558\ub294 DNS \uc11c\ubc84\uc5d0 \ud1b5\uc2e0\ud560 \uc218 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4.
 message.installWizard.tooltip.addZone.name=Zone\uc758 \uc774\ub984\uc785\ub2c8\ub2e4.
 message.installWizard.tooltip.configureGuestTraffic.description=\ub124\ud2b8\uc6cc\ud06c \uc124\uba85\uc785\ub2c8\ub2e4.
-message.installWizard.tooltip.configureGuestTraffic.guestEndIp=\ud604\uc7ac Zone\uc758 \uac8c\uc2a4\ud2b8\uc5d0\uac8c \ud560\ub2f9\ud560 \uc218 \uc788\ub294 IP \uc8fc\uc18c \ubc94\uc704\uc785\ub2c8\ub2e4. \uc0ac\uc6a9\ud558\ub294 NIC\uac00 \ud55c \uac00\uc9c0\uc778 \uacbd\uc6b0\ub294 \uc774\ub7ec\ud55c IP \uc8fc\uc18c\ub294 Pod\uc758 CIDR\uc640 \uac19\uc740 CIDR\uc5d0 \ud3ec\ud568\ub418\uc5b4 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4.
+message.installWizard.tooltip.configureGuestTraffic.guestEndIp=\ud604\uc7ac Zone\uc758 \uac8c\uc2a4\ud2b8\uc5d0\uac8c \ud560\ub2f9\ud560 \uc218 \uc788\ub294 IP \uc8fc\uc18c \ubc94\uc704\uc785\ub2c8\ub2e4. \uc0ac\uc6a9\ud558\ub294 NIC\uac00 \ud55c \uac00\uc9c0 \uacbd\uc6b0\ub294 \uc774\ub7ec\ud55c IP \uc8fc\uc18c\ub294 Pod\uc758 CIDR\uc640 \uac19\uc740 CIDR\uc5d0 \ud3ec\ud568\ub418\uc5b4 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4.
 message.installWizard.tooltip.configureGuestTraffic.guestGateway=\uac8c\uc2a4\ud2b8\uc5d0\uc11c \uc0ac\uc6a9\ud558\ub294 \uac8c\uc774\ud2b8\uc6e8\uc774\uc785\ub2c8\ub2e4.
 message.installWizard.tooltip.configureGuestTraffic.guestNetmask=\uac8c\uc2a4\ud2b8\uc5d0\uc11c \uc0ac\uc6a9\ud558\ub294 \uc11c\ube0c\ub124\ud2b8\uc6cc\ud06c\uc0c1\uc5d0\uc11c \uc0ac\uc6a9\ub418\ub294 \ub137 \ub9c8\uc2a4\ud06c\uc785\ub2c8\ub2e4.
 message.installWizard.tooltip.configureGuestTraffic.guestStartIp=\ud604\uc7ac Zone\uc758 \uac8c\uc2a4\ud2b8\uc5d0\uac8c \ud560\ub2f9\ud560 \uc218 \uc788\ub294 IP \uc8fc\uc18c \ubc94\uc704\uc785\ub2c8\ub2e4. \uc0ac\uc6a9\ud558\ub294 NIC\uac00 \ud55c \uac00\uc9c0 \uacbd\uc6b0\ub294 \uc774\ub7ec\ud55c IP \uc8fc\uc18c\ub294 Pod\uc758 CIDR\uc640 \uac19\uc740 CIDR\uc5d0 \ud3ec\ud568\ub418\uc5b4 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4.
@@ -1459,7 +1459,7 @@ state.Completed=\uc644\ub8cc
 state.Creating=\uc0dd\uc131 \uc911
 state.Declined=\uac70\uc808
 state.Destroyed=\ud30c\uae30\ub41c \uc0c1\ud0dc
-state.Disabled=\uc720\ud6a8\ud558\uc9c0 \uc54a\uc740
+state.Disabled=\uc0ac\uc6a9 \uc548\ud568
 state.Enabled=\uc0ac\uc6a9\ud568
 state.Error=\uc624\ub958
 state.Expunging=\uc81c\uac70 \uc911

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e81a6b27/client/WEB-INF/classes/resources/messages_nb_NO.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_nb_NO.properties b/client/WEB-INF/classes/resources/messages_nb_NO.properties
index 679030e..a4851d0 100644
--- a/client/WEB-INF/classes/resources/messages_nb_NO.properties
+++ b/client/WEB-INF/classes/resources/messages_nb_NO.properties
@@ -1093,7 +1093,7 @@ label.network.id=Nettverks ID
 label.networking.and.security=Nettverk og sikkerhet
 label.network.label.display.for.blank.value=Bruk standard gateway
 label.network.limits=Nettverksbegrensninger
-label.network.name=Nettverksdame
+label.network.name=Nettverksnavn
 label.network=Nettverk
 label.network.offering.details=Nettverkstilbud detaljer
 label.network.offering.display.text=Nettverkstilbud Forklaring
@@ -1119,6 +1119,7 @@ label.nfs.server=NFS Server
 label.nfs.storage=NFS Lagring
 label.nic.adapter.type=NIC adaptertype
 label.nicira.controller.address=Kontrolleradresse
+label.nicira.l2gatewayserviceuuid=L2 Gateway tjeneste-uuid
 label.nicira.l3gatewayserviceuuid=L3 Gateway Tjeneste Uuid
 label.nicira.nvp.details=Nicira NVP detaljer
 label.nicira.transportzoneuuid=Transport sone Uuid
@@ -1468,8 +1469,8 @@ label.smb.username=SMB Brukernavn
 label.snapshot.limits=\u00d8yeblikksbildebegrensning
 label.snapshot.name=\u00d8yeblikksbildenavn
 label.snapshot.schedule=Sett Opp Gjentagende \u00f8yeblikksbilder
-label.snapshot.s=\u00d8yeblikksbilder
-label.snapshots=\u00d8yeblikksbilder
+label.snapshot.s=\u00d8yebliksbilder
+label.snapshots=\u00d8yebliksbilder
 label.snapshot=\u00d8yeblikksbilde
 label.SNMP.community=SNMP Community
 label.SNMP.port=SNM Port
@@ -2105,7 +2106,7 @@ message.number.hosts=<h2><span> \# av </span> Verter</h2>
 message.number.pods=<h2><span> \# av </span> Pods</h2>
 message.number.storage=<h2><span> \# av </span> Prim\u00e6rlagringsvolumer</h2>
 message.number.zones=<h2><span> \# av </span> Soner</h2>
-message.password.has.been.reset.to=Passordet har blitt endret til
+message.password.has.been.reset.to=Passordet har blitt resatt til
 message.password.of.the.vm.has.been.reset.to=Passorde for VM har blitt endre til
 message.pending.projects.1=Du har f\u00f8lgende prosjektinvitasjoner\:
 message.pending.projects.2=For \u00e5 se, vennligst g\u00e5 til prosjektseksjonen og velg invitasjoner fra nedtrekksmenyen.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e81a6b27/client/WEB-INF/classes/resources/messages_nl_NL.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_nl_NL.properties b/client/WEB-INF/classes/resources/messages_nl_NL.properties
index 318496c..5cb7413 100644
--- a/client/WEB-INF/classes/resources/messages_nl_NL.properties
+++ b/client/WEB-INF/classes/resources/messages_nl_NL.properties
@@ -435,7 +435,7 @@ label.broadcast.domain.range=Broadcast domain range
 label.broadcast.domain.type=Broadcast Domain Type
 label.broadcast.uri=Broadcast URI
 label.broadcasturi=broadcasturi
-label.broadcat.uri=broadcast URI
+label.broadcat.uri=Broadcast URI
 label.brocade.vcs.address=Vcs switch adres
 label.brocade.vcs.details=Brocade Vcs switch gegevens
 label.by.account=Op Account
@@ -1119,6 +1119,7 @@ label.nfs.server=NFS Server
 label.nfs.storage=NFS Opslag
 label.nic.adapter.type=NIC adapter type
 label.nicira.controller.address=Controller Adres
+label.nicira.l2gatewayserviceuuid=L2 gateway service UUID
 label.nicira.l3gatewayserviceuuid=L3 Gateway Service Uuid
 label.nicira.nvp.details=Nicira NVP details
 label.nicira.transportzoneuuid=Transport Zone Uuid
@@ -2104,7 +2105,7 @@ message.number.hosts=<h2><span> Aantal </span> Hosts</h2>
 message.number.pods=<h2><span> Aantal </span> Pods</h2>
 message.number.storage=<h2><span> Aantal </span> Primaire Opslag Volumes</h2>
 message.number.zones=<h2><span> Aantal </span> Zones</h2>
-message.password.has.been.reset.to=Het wachtwoord is veranderd in
+message.password.has.been.reset.to=Het wachtwoord is gereset naar
 message.password.of.the.vm.has.been.reset.to=Het wachtwoord van de VM is veranderd in
 message.pending.projects.1=U heeft openstaande project uitnodigigingen\:
 message.pending.projects.2=Ga naar de project sectie om deze te zien. Selecteer de uitnodiging vanuit het drop-down menu.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e81a6b27/client/WEB-INF/classes/resources/messages_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_pt_BR.properties b/client/WEB-INF/classes/resources/messages_pt_BR.properties
index b941240..444bb15 100644
--- a/client/WEB-INF/classes/resources/messages_pt_BR.properties
+++ b/client/WEB-INF/classes/resources/messages_pt_BR.properties
@@ -1014,7 +1014,7 @@ label.metrics.clusters=Clusters
 label.metrics.cpu.allocated=Aloca\u00e7\u00e3o de CPU
 label.metrics.cpu.max.dev=Desvio
 label.metrics.cpu.total=Total
-label.metrics.cpu.usage=Utiliza\u00e7\u00e3o de 
+label.metrics.cpu.usage=Utiliza\u00e7\u00e3o de
 label.metrics.cpu.used.avg=Usado
 label.metrics.disk.allocated=Alocado
 label.metrics.disk=Disco
@@ -1038,7 +1038,7 @@ label.metrics.name=Nome
 label.metrics.network.read=Leitura
 label.metrics.network.usage=Utiliza\u00e7\u00e3o de Rede
 label.metrics.network.write=Escrita
-label.metrics.num.cpu.cores=N\u00facleos 
+label.metrics.num.cpu.cores=N\u00facleos
 label.metrics.property=Propriedade
 label.metrics.scope=Escopo
 label.metrics.state=Estado
@@ -1119,6 +1119,7 @@ label.nfs.server=Servidor NFS
 label.nfs.storage=Storage NFS
 label.nic.adapter.type=Tipo de adaptador de Rede
 label.nicira.controller.address=Endere\u00e7o do Controlador
+label.nicira.l2gatewayserviceuuid=Uuid do Servi\u00e7o de Gateway L2
 label.nicira.l3gatewayserviceuuid=Uuid do Servi\u00e7o de Gateway L3
 label.nicira.nvp.details=Detalhes do Nicira NVP
 label.nicira.transportzoneuuid=Uuid da Zona de Transporte
@@ -1621,7 +1622,7 @@ label.url=URL
 label.usage.interface=Usage Interface
 label.usage.sanity.result=Resultado de Sanidade de Uso
 label.usage.server=Uso do Servidor
-label.usage.type=Uso Tipo
+label.usage.type=Tipo
 label.usage.unit=Unidade
 label.used=Usado
 label.user.data=Dados de Usu\u00e1rio
@@ -1726,7 +1727,7 @@ label.vpc=VPC
 label.VPN.connection=Conex\u00e3o VPN
 label.vpn.customer.gateway=Gateway de VPN de usu\u00e1rio
 label.VPN.customer.gateway=Gateway de VPN de usu\u00e1rio
-label.vpn.force.encapsulation=For\u00e7ar encapsulamento UDP de pacotes ESP 
+label.vpn.force.encapsulation=For\u00e7ar encapsulamento UDP de pacotes ESP
 label.VPN.gateway=Gateway de VPN
 label.vpn=VPN
 label.vsmctrlvlanid=Control VLAN ID
@@ -2105,7 +2106,7 @@ message.number.hosts=<h2>Hosts</h2>
 message.number.pods=<h2>PODs</h2>
 message.number.storage=<h2>Volumes do Storage Prim\u00e1rio</h2>
 message.number.zones=<h2>Zonas</h2>
-message.password.has.been.reset.to=A senha foi redefinida para
+message.password.has.been.reset.to=A senha foi recuperada para
 message.password.of.the.vm.has.been.reset.to=A senha da VM foi redefinida para
 message.pending.projects.1=Voc\u00ea possui convites de projetos pendentes\:
 message.pending.projects.2=Para visualizar, por favor acesse a se\u00e7\u00e3o de projetos, depois selecione os convites no menu drop-down.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e81a6b27/client/WEB-INF/classes/resources/messages_ru_RU.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ru_RU.properties b/client/WEB-INF/classes/resources/messages_ru_RU.properties
index 166ae10..9e123c6 100644
--- a/client/WEB-INF/classes/resources/messages_ru_RU.properties
+++ b/client/WEB-INF/classes/resources/messages_ru_RU.properties
@@ -334,7 +334,7 @@ label.agent.username=\u0418\u043c\u044f \u0430\u0433\u0435\u043d\u0442\u0430
 label.agree=\u0421\u043e\u0433\u043b\u0430\u0441\u0435\u043d
 label.alert=\u0422\u0440\u0435\u0432\u043e\u0433\u0430
 label.algorithm=\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c
-label.allocated=\u0412\u044b\u0434\u0435\u043b\u0435\u043d\u043e
+label.allocated=\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e
 label.allocation.state=\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f
 label.api.key=\u041a\u043b\u044e\u0447 API
 label.api.version=\u0412\u0435\u0440\u0441\u0438\u044f API
@@ -584,7 +584,7 @@ label.full=\u041f\u043e\u043b\u043d\u044b\u0439
 label.gateway=\u0428\u043b\u044e\u0437
 label.general.alerts=\u041e\u0431\u0449\u0438\u0435 \u0442\u0440\u0435\u0432\u043e\u0433\u0438
 label.generating.url=\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 URL
-label.gluster.volume=\u0414\u0438\u0441\u043a
+label.gluster.volume=\u0422\u043e\u043c
 label.go.step.2=\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0448\u0430\u0433\u0443 2
 label.go.step.3=\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0448\u0430\u0433\u0443 3
 label.go.step.4=\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0448\u0430\u0433\u0443 4
@@ -662,7 +662,7 @@ label.invitations=\u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u
 label.invited.accounts=\u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0451\u043d\u043d\u044b\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438
 label.invite.to=\u041f\u0440\u0438\u0433\u043b\u0430\u0441\u0438\u0442\u044c
 label.invite=\u041f\u0440\u0438\u0433\u043b\u0430\u0441\u0438\u0442\u044c
-label.ip.address=IP-\u0430\u0434\u0440\u0435\u0441
+label.ip.address=IP \u0430\u0434\u0440\u0435\u0441\u0441\u0430
 label.ipaddress=IP \u0430\u0434\u0440\u0435\u0441\u0441\u0430
 label.ip.allocations=\u0412\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 IP
 label.ip=IP
@@ -776,7 +776,7 @@ label.menu.network=\u0421\u0435\u0442\u044c
 label.menu.physical.resources=\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b
 label.menu.regions=\u0420\u0435\u0433\u0438\u043e\u043d
 label.menu.running.instances=\u0420\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u043c\u0430\u0448\u0438\u043d\u044b
-label.menu.security.groups=Security Groups
+label.menu.security.groups=\u0413\u0440\u0443\u043f\u043f\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438
 label.menu.service.offerings=\u0423\u0441\u043b\u0443\u0433\u0438 \u0441\u043b\u0443\u0436\u0431
 label.menu.snapshots=\u0421\u043d\u0438\u043c\u043a\u0438
 label.menu.sshkeypair=SSH KeyPair
@@ -788,7 +788,7 @@ label.menu.system.vms=\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0
 label.menu.templates=\u0428\u0430\u0431\u043b\u043e\u043d\u044b
 label.menu.virtual.appliances=\u0412\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430
 label.menu.virtual.resources=\u0412\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b
-label.menu.volumes=\u0414\u0438\u0441\u043a\u0438
+label.menu.volumes=\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f
 label.menu.vpc.offerings=\u0423\u0441\u043b\u0443\u0433\u0438 VPS
 label.metrics.allocated=\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e
 label.metrics.clusters=\u041a\u043b\u0430\u0441\u0442\u0435\u0440\u044b
@@ -1232,7 +1232,7 @@ label.virtual.routers=\u0412\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u04
 label.virtual.router=\u0412\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u043e\u0443\u0442\u0435\u0440
 label.vlan.id=ID VLAN
 label.vlan.only=VLAN
-label.vlan.range=\u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d VLAN
+label.vlan.range=VLAN/VNI Range
 label.vlan=VLAN
 label.vlan.vni.range=VLAN/VNI Range
 label.vm.add=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u0430\u0448\u0438\u043d\u044b
@@ -1505,7 +1505,7 @@ message.installWizard.tooltip.addHost.hostname=\u0418\u043c\u044f DNS \u0438\u04
 message.installWizard.tooltip.addHost.password=\u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (\u0441 \u0432\u0430\u0448\u0435\u0433\u043e XenServer)
 message.installWizard.tooltip.addHost.username=\u041e\u0431\u044b\u0447\u043d\u043e root.
 message.installWizard.tooltip.addPod.name=\u0418\u043c\u044f \u0441\u0442\u0435\u043d\u0434\u0430
-message.installWizard.tooltip.addPod.reservedSystemEndIp=\u042d\u0442\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d IP \u0447\u0430\u0441\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0412\u041c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0438 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043a\u0441\u0438. \u042d\u0442\u0438 \u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u0441\u0435\u0442\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432.
+message.installWizard.tooltip.addPod.reservedSystemEndIp=\u042d\u0442\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d IP \u0447\u0430\u0441\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f CloudStack \u0434\u043b\u044f \u0412\u041c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0438 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043a\u0441\u0438. \u042d\u0442\u0438 \u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u0441\u0435\u0442\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432.
 message.installWizard.tooltip.addPod.reservedSystemGateway=\u0428\u043b\u044e\u0437 \u0434\u043b\u044f \u0443\u0437\u043b\u043e\u0432 \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u0435\u043d\u0434\u0430.
 message.installWizard.tooltip.addPod.reservedSystemNetmask=\u0421\u0435\u0442\u0435\u0432\u0430\u044f \u043c\u0430\u0441\u043a\u0430 \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u0434\u043b\u044f \u0433\u043e\u0441\u0442\u0435\u0439.
 message.installWizard.tooltip.addPod.reservedSystemStartIp=\u042d\u0442\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d IP \u0447\u0430\u0441\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f CloudStack \u0434\u043b\u044f \u0412\u041c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0438 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043a\u0441\u0438. \u042d\u0442\u0438 \u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u0441\u0435\u0442\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e81a6b27/client/WEB-INF/classes/resources/messages_zh_CN.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_zh_CN.properties b/client/WEB-INF/classes/resources/messages_zh_CN.properties
index 139795c..66f99b2 100644
--- a/client/WEB-INF/classes/resources/messages_zh_CN.properties
+++ b/client/WEB-INF/classes/resources/messages_zh_CN.properties
@@ -1612,7 +1612,7 @@ label.vlan.only=VLAN
 label.vlan.range.details=VLAN \u8303\u56f4\u8be6\u7ec6\u4fe1\u606f
 label.vlan.ranges=VLAN \u8303\u56f4
 label.vlan.range=VLAN/VNI \u8303\u56f4
-label.vlan=VLAN
+label.vlan=VLAN/VNI
 label.vlan.vni.ranges=VLAN/VNI \u8303\u56f4
 label.vlan.vni.range=VLAN/VNI \u8303\u56f4
 label.vm.add=\u6dfb\u52a0\u5b9e\u4f8b

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e81a6b27/tools/transifex/.tx/config
----------------------------------------------------------------------
diff --git a/tools/transifex/.tx/config b/tools/transifex/.tx/config
index 8365966..9804e76 100644
--- a/tools/transifex/.tx/config
+++ b/tools/transifex/.tx/config
@@ -89,3 +89,22 @@ trans.pt_BR = work-dir/messages_pt_BR.properties
 trans.ru_RU = work-dir/messages_ru_RU.properties
 trans.zh_CN = work-dir/messages_zh_CN.properties
 
+[CloudStack_UI.48xmessagesproperties]
+source_file = work-dir/messages.properties
+source_lang = en
+trans.ar = work-dir/messages_ar.properties
+trans.ca = work-dir/messages_ca.properties
+trans.de_DE = work-dir/messages_de_DE.properties
+trans.es = work-dir/messages_es.properties
+trans.fr_FR = work-dir/messages_fr_FR.properties
+trans.hu = work-dir/messages_hu.properties
+trans.it_IT = work-dir/messages_it_IT.properties
+trans.ja_JP = work-dir/messages_ja_JP.properties
+trans.ko_KR = work-dir/messages_ko_KR.properties
+trans.nb_NO = work-dir/messages_nb_NO.properties
+trans.nl_NL = work-dir/messages_nl_NL.properties
+trans.pl = work-dir/messages_pl.properties
+trans.pt_BR = work-dir/messages_pt_BR.properties
+trans.ru_RU = work-dir/messages_ru_RU.properties
+trans.zh_CN = work-dir/messages_zh_CN.properties
+


[06/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1350 from shapeblue/master-quotalock

Quota: consolidated lockable account check to a method. Added unit tests to check lockablity of various accounts.

Currently normal user and domain admin accounts are eligible for locking.

* pr/1350:
  Quota: consolidated lockable account check to a method. Added unit tests to check lockablity of various accounts

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: ccb4fe0e70acee5b1d8b1707272d017244648bb8
Parents: c9319e2 04ca7e5
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 4 10:27:51 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 4 10:27:52 2016 -0400

----------------------------------------------------------------------
 .../cloudstack/quota/QuotaAlertManagerImpl.java |  8 +++--
 .../apache/cloudstack/quota/QuotaManager.java   |  3 ++
 .../cloudstack/quota/QuotaManagerImpl.java      |  5 +++
 .../quota/dao/QuotaBalanceDaoImpl.java          |  2 +-
 .../cloudstack/quota/QuotaManagerImplTest.java  | 38 ++++++++++++++++++++
 .../cloudstack/api/command/QuotaCreditsCmd.java |  4 +--
 .../api/response/QuotaResponseBuilder.java      |  2 +-
 .../api/response/QuotaResponseBuilderImpl.java  | 18 +++++-----
 .../cloudstack/quota/QuotaServiceImpl.java      |  6 ++--
 .../api/command/QuotaCreditsCmdTest.java        |  4 +--
 .../response/QuotaResponseBuilderImplTest.java  |  2 +-
 11 files changed, 69 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ccb4fe0e/framework/quota/src/org/apache/cloudstack/quota/QuotaAlertManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ccb4fe0e/framework/quota/src/org/apache/cloudstack/quota/QuotaManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ccb4fe0e/plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java
----------------------------------------------------------------------


[22/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
CLOUDSTACK-9351: Add marvin test and add it to travis file


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: b9d75c6ffaf382468b6a0359ee24bb2915615d9b
Parents: baa8610
Author: nvazquez <ni...@gmail.com>
Authored: Wed May 4 16:00:44 2016 -0300
Committer: nvazquez <ni...@gmail.com>
Committed: Tue May 10 12:35:55 2016 -0700

----------------------------------------------------------------------
 .travis.yml                                     |   2 +-
 .../smoke/test_list_ids_parameter.py            | 295 +++++++++++++++++++
 2 files changed, 296 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9d75c6f/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 1441fa4..d160e48 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -37,7 +37,7 @@ env:
      - PATH=$HOME/.local/bin:$PATH
   matrix:
     - TESTS="smoke/test_affinity_groups smoke/test_affinity_groups_projects smoke/test_deploy_vgpu_enabled_vm smoke/test_deploy_vm_iso smoke/test_deploy_vm_root_resize smoke/test_deploy_vm_with_userdata smoke/test_deploy_vms_with_varied_deploymentplanners smoke/test_disk_offerings smoke/test_global_settings smoke/test_guest_vlan_range"
-    - TESTS="smoke/test_hosts smoke/test_internal_lb smoke/test_iso smoke/test_loadbalance smoke/test_multipleips_per_nic smoke/test_network smoke/test_network_acl smoke/test_nic smoke/test_nic_adapter_type smoke/test_non_contigiousvlan"
+    - TESTS="smoke/test_hosts smoke/test_internal_lb smoke/test_iso smoke/test_list_ids_parameter smoke/test_loadbalance smoke/test_multipleips_per_nic smoke/test_network smoke/test_network_acl smoke/test_nic smoke/test_nic_adapter_type smoke/test_non_contigiousvlan"
     - TESTS="smoke/test_over_provisioning smoke/test_password_server smoke/test_portable_publicip smoke/test_primary_storage smoke/test_privategw_acl smoke/test_public_ip_range smoke/test_pvlan smoke/test_regions smoke/test_reset_vm_on_reboot smoke/test_resource_detail"
     - TESTS="smoke/test_router_dhcphosts smoke/test_routers smoke/test_routers_iptables_default_policy smoke/test_routers_network_ops smoke/test_scale_vm smoke/test_secondary_storage smoke/test_service_offerings smoke/test_snapshots smoke/test_ssvm smoke/test_templates"
     - TESTS="smoke/test_usage_events smoke/test_vm_life_cycle smoke/test_vm_snapshots smoke/test_volumes smoke/test_vpc_redundant smoke/test_vpc_router_nics smoke/test_vpc_vpn smoke/misc/test_deploy_vm smoke/misc/test_vm_ha smoke/misc/test_escalations_templates smoke/misc/test_vm_sync"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9d75c6f/test/integration/smoke/test_list_ids_parameter.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_list_ids_parameter.py b/test/integration/smoke/test_list_ids_parameter.py
new file mode 100755
index 0000000..be9554b
--- /dev/null
+++ b/test/integration/smoke/test_list_ids_parameter.py
@@ -0,0 +1,295 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+""" Tests for API listing methods using 'ids' parameter
+"""
+#Import Local Modules
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.utils import (cleanup_resources,
+                              validateList)
+from marvin.lib.base import (Account,
+                             Volume,
+                             DiskOffering,
+                             Template,
+                             ServiceOffering,
+                             Snapshot,
+                             VmSnapshot,
+                             VirtualMachine)
+from marvin.lib.common import (get_domain,
+                                get_zone, get_template)
+from marvin.codes import FAILED, PASS
+from nose.plugins.attrib import attr
+#Import System modules
+import time
+
+_multiprocess_shared_ = True
+class TestListIdsParams(cloudstackTestCase):
+    
+    @classmethod
+    def setUpClass(cls):
+        testClient = super(TestListIdsParams, cls).getClsTestClient()
+        cls.apiclient = testClient.getApiClient()
+        cls.services = testClient.getParsedTestDataConfig()
+        cls.hypervisor = testClient.getHypervisorInfo()
+        cls.domain = get_domain(cls.apiclient)
+        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
+
+        cls.disk_offering = DiskOffering.create(
+                                    cls.apiclient,
+                                    cls.services["disk_offering"]
+                                    )
+
+        cls.account = Account.create(
+                            cls.apiclient,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.service_offering = ServiceOffering.create(
+                                            cls.apiclient,
+                                            cls.services["service_offerings"]["tiny"]
+                                            )
+
+        template = get_template(
+                            cls.apiclient,
+                            cls.zone.id,
+                            cls.services["ostype"]
+                            )
+        if template == FAILED:
+            assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+            
+        cls.services["template"]["ostypeid"] = template.ostypeid
+        cls.services["template_2"]["ostypeid"] = template.ostypeid
+        cls.services["ostypeid"] = template.ostypeid
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["mode"] = cls.zone.networktype
+
+        #Create 3 VMs
+        cls.virtual_machine_1 = VirtualMachine.create(
+                                cls.apiclient,
+                                cls.services["virtual_machine"],
+                                templateid=template.id,
+                                accountid=cls.account.name,
+                                domainid=cls.account.domainid,
+                                serviceofferingid=cls.service_offering.id,
+                                mode=cls.services["mode"]
+                                )
+        cls.virtual_machine_2 = VirtualMachine.create(
+                                cls.apiclient,
+                                cls.services["virtual_machine"],
+                                templateid=template.id,
+                                accountid=cls.account.name,
+                                domainid=cls.account.domainid,
+                                serviceofferingid=cls.service_offering.id,
+                                mode=cls.services["mode"]
+                                )
+        cls.virtual_machine_3 = VirtualMachine.create(
+                                cls.apiclient,
+                                cls.services["virtual_machine"],
+                                templateid=template.id,
+                                accountid=cls.account.name,
+                                domainid=cls.account.domainid,
+                                serviceofferingid=cls.service_offering.id,
+                                mode=cls.services["mode"]
+                                )
+
+        #Take 3 VM1 Snapshots
+        #PLEASE UNCOMMENT ONCE VM SNAPSHOT DELAY BUG AFTER VM CREATION IS FIXED
+        """cls.vmsnapshot_1 = VmSnapshot.create(
+                                cls.apiclient,
+                                cls.virtual_machine_1.id
+                            )
+        cls.vmsnapshot_2 = VmSnapshot.create(
+                                cls.apiclient,
+                                cls.virtual_machine_1.id
+                            )
+        cls.vmsnapshot_3 = VmSnapshot.create(
+                                cls.apiclient,
+                                cls.virtual_machine_1.id
+                            )"""
+
+        #Stop VMs
+        cls.virtual_machine_1.stop(cls.apiclient)
+        cls.virtual_machine_2.stop(cls.apiclient)
+        cls.virtual_machine_3.stop(cls.apiclient)
+
+        #Get ROOT volumes of 3 VMs        
+        vm1RootVolumeResponse = Volume.list(
+                                            cls.apiclient,
+                                            virtualmachineid=cls.virtual_machine_1.id,
+                                            type='ROOT',
+                                            listall=True
+                                            )
+        vm2RootVolumeResponse = Volume.list(
+                                            cls.apiclient,
+                                            virtualmachineid=cls.virtual_machine_2.id,
+                                            type='ROOT',
+                                            listall=True
+                                            )
+        vm3RootVolumeResponse = Volume.list(
+                                            cls.apiclient,
+                                            virtualmachineid=cls.virtual_machine_3.id,
+                                            type='ROOT',
+                                            listall=True
+                                            )
+        cls.vm1_root_volume = vm1RootVolumeResponse[0]
+        cls.vm2_root_volume = vm2RootVolumeResponse[0]
+        cls.vm3_root_volume = vm3RootVolumeResponse[0]
+
+        #Take 3 snapshots of VM2's ROOT volume
+        cls.snapshot_1 = Snapshot.create(
+                                         cls.apiclient,
+                                         cls.vm2_root_volume.id,
+                                         account=cls.account.name,
+                                         domainid=cls.account.domainid
+                                         )
+        cls.snapshot_2 = Snapshot.create(
+                                         cls.apiclient,
+                                         cls.vm2_root_volume.id,
+                                         account=cls.account.name,
+                                         domainid=cls.account.domainid
+                                         )
+        cls.snapshot_3 = Snapshot.create(
+                                         cls.apiclient,
+                                         cls.vm2_root_volume.id,
+                                         account=cls.account.name,
+                                         domainid=cls.account.domainid
+                                         )
+
+        #Create 3 templates
+        cls.template_1 = Template.create(
+                                         cls.apiclient,
+                                         cls.services["template"],
+                                         cls.vm3_root_volume.id,
+                                         account=cls.account.name,
+                                         domainid=cls.account.domainid
+                                         )
+        cls.template_2 = Template.create(
+                                         cls.apiclient,
+                                         cls.services["template_2"],
+                                         cls.vm3_root_volume.id,
+                                         account=cls.account.name,
+                                         domainid=cls.account.domainid
+                                         )
+        cls.template_3 = Template.create(
+                                         cls.apiclient,
+                                         cls.services["template_2"],
+                                         cls.vm3_root_volume.id,
+                                         account=cls.account.name,
+                                         domainid=cls.account.domainid
+                                         )
+        
+        cls._cleanup = [
+                        cls.disk_offering,
+                        cls.account,
+                        cls.service_offering,
+                        cls.snapshot_1,
+                        cls.snapshot_2,
+                        cls.snapshot_3
+                        ]
+
+    @classmethod
+    def tearDownClass(cls):
+        cls.apiclient = super(TestListIdsParams, cls).getClsTestClient().getApiClient()
+        try:
+            cleanup_resources(cls.apiclient, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false")
+    def test_01_list_volumes(self):
+        """Test listing Volumes using 'ids' parameter
+        """
+        list_volume_response = Volume.list(
+                                           self.apiclient,
+                                           ids=[self.vm1_root_volume.id, self.vm2_root_volume.id, self.vm3_root_volume.id],
+                                           type='ROOT',
+                                           listAll=True
+                                           )
+        self.assertEqual(
+            isinstance(list_volume_response, list),
+            True,
+            "List Volume response was not a valid list"
+        )
+        self.assertEqual(
+            len(list_volume_response),
+            3,
+            "ListVolumes response expected 3 Volumes, received %s" % len(list_volume_response)
+        )
+        
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false")
+    def test_02_list_templates(self):
+        """Test listing Templates using 'ids' parameter
+        """
+        list_template_response = Template.list(
+                                    self.apiclient,
+                                    templatefilter='all',
+                                    ids=[self.template_1.id, self.template_2.id, self.template_3.id],
+                                    account=self.account.name,
+                                    domainid=self.account.domainid,
+                                    listAll=True
+                                    )
+        self.assertEqual(
+            isinstance(list_template_response, list),
+            True,
+            "ListTemplates response was not a valid list"
+        )
+        self.assertEqual(
+            len(list_template_response),
+            3,
+            "ListTemplates response expected 3 Templates, received %s" % len(list_template_response)
+        )
+
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false")
+    def test_03_list_snapshots(self):
+        """Test listing Snapshots using 'ids' parameter
+        """
+        list_snapshot_response = Snapshot.list(
+                                    self.apiclient,
+                                    ids=[self.snapshot_1.id, self.snapshot_2.id, self.snapshot_3.id],
+                                    listAll=True
+                                    )
+        self.assertEqual(
+            isinstance(list_snapshot_response, list),
+            True,
+            "ListSnapshots response was not a valid list"
+        )
+        self.assertEqual(
+            len(list_snapshot_response),
+            3,
+            "ListSnapshots response expected 3 Snapshots, received %s" % len(list_snapshot_response)
+        )
+
+    #PLEASE UNCOMMENT ONCE VM SNAPSHOT DELAY BUG AFTER VM CREATION IS FIXED
+    #@attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false")
+    #def test_04_list_vm_snapshots(self):
+        """Test listing VMSnapshots using 'vmsnapshotids' parameter
+        """
+        """list_vm_snapshot_response = VmSnapshot.list(
+                                        self.apiclient,
+                                        vmsnapshotids=[self.vmsnapshot_1.id, self.vmsnapshot_2.id, self.vmsnapshot_3.id],
+                                        listall=True
+                                        )
+        self.assertEqual(
+            isinstance(list_vm_snapshot_response, list),
+            True,
+            "ListVMSnapshots response was not a valid list"
+        )
+        self.assertEqual(
+            len(list_vm_snapshot_response),
+            3,
+            "ListVMSnapshots response expected 3 VMSnapshots, received %s" % len(list_vm_snapshot_response)
+        )"""


[02/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge release branch 4.7 to 4.8

* 4.7:
  Set default networkDomain to empty instead of username


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 234ed9fb0d64986c4f7235aef762861413bb71be
Parents: 126a039 f434f50
Author: Will Stevens <wi...@gmail.com>
Authored: Wed May 4 10:21:24 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Wed May 4 10:21:24 2016 -0400

----------------------------------------------------------------------
 .../src/org/apache/cloudstack/api/command/LinkDomainToLdapCmd.java | 2 +-
 .../ldap/src/org/apache/cloudstack/ldap/LdapAuthenticator.java     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[40/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
CLOUDSTACK-8562: DB-Backed Dynamic Role Based API Access Checker

This feature allows root administrators to define new roles and associate API
permissions to them.

A limited form of role-based access control for the CloudStack management server
API is provided through a properties file, commands.properties, embedded in the
WAR distribution. Therefore, customizing API permissions requires unpacking the
distribution and modifying this file consistently on all servers. The old system
also does not permit the specification of additional roles.

FS:
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Dynamic+Role+Based+API+Access+Checker+for+CloudStack

DB-Backed Dynamic Role Based API Access Checker for CloudStack brings following
changes, features and use-cases:
- Moves the API access definitions from commands.properties to the mgmt server DB
- Allows defining custom roles (such as a read-only ROOT admin) beyond the
  current set of four (4) roles
- All roles will resolve to one of the four known roles types (Admin, Resource
  Admin, Domain Admin and User) which maintains this association by requiring
  all new defined roles to specify a role type.
- Allows changes to roles and API permissions per role at runtime including additions or
  removal of roles and/or modifications of permissions, without the need
  of restarting management server(s)

Upgrade/installation notes:
- The feature will be enabled by default for new installations, existing
  deployments will continue to use the older static role based api access checker
  with an option to enable this feature
- During fresh installation or upgrade, the upgrade paths will add four default
  roles based on the four default role types
- For ease of migration, at the time of upgrade commands.properties will be used
  to add existing set of permissions to the default roles. cloud.account
  will have a new role_id column which will be populated based on default roles
  as well

Dynamic-roles migration tool: scripts/util/migrate-dynamicroles.py
- Allows admins to migrate to the dynamic role based checker at a future date
- Performs a harder one-way migrate and update
- Migrates rules from existing commands.properties file into db and deprecates it
- Enables an internal hidden switch to enable dynamic role based checker feature

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 4347776ac6ef9ae86fb016862f4a6b2376f8319a
Parents: 95abb6e
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Tue Mar 15 09:16:06 2016 +0100
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Wed May 11 09:45:19 2016 +0530

----------------------------------------------------------------------
 .travis.yml                                     |   4 +-
 api/src/com/cloud/event/EventTypes.java         |  18 +
 api/src/com/cloud/user/Account.java             |   2 +
 api/src/com/cloud/user/AccountService.java      |   4 +-
 api/src/org/apache/cloudstack/acl/Role.java     |  27 +
 .../apache/cloudstack/acl/RolePermission.java   |  31 +
 .../org/apache/cloudstack/acl/RoleService.java  |  52 ++
 api/src/org/apache/cloudstack/acl/RoleType.java |  80 +-
 api/src/org/apache/cloudstack/acl/Rule.java     |  54 ++
 .../org/apache/cloudstack/api/ApiConstants.java |   7 +
 api/src/org/apache/cloudstack/api/BaseCmd.java  |   7 +-
 .../command/admin/account/CreateAccountCmd.java |  17 +-
 .../api/command/admin/acl/CreateRoleCmd.java    | 105 +++
 .../admin/acl/CreateRolePermissionCmd.java      | 124 +++
 .../api/command/admin/acl/DeleteRoleCmd.java    |  83 ++
 .../admin/acl/DeleteRolePermissionCmd.java      |  83 ++
 .../admin/acl/ListRolePermissionsCmd.java       | 106 +++
 .../api/command/admin/acl/ListRolesCmd.java     | 128 +++
 .../api/command/admin/acl/UpdateRoleCmd.java    | 108 +++
 .../admin/acl/UpdateRolePermissionCmd.java      | 104 +++
 .../api/command/admin/config/UpdateCfgCmd.java  |  12 +
 .../user/config/ListCapabilitiesCmd.java        |   1 +
 .../api/response/AccountResponse.java           |  27 +
 .../api/response/CapabilitiesResponse.java      |   8 +
 .../api/response/RolePermissionResponse.java    | 101 +++
 .../cloudstack/api/response/RoleResponse.java   |  63 ++
 .../cloudstack/api/response/UserResponse.java   |  27 +
 .../org/apache/cloudstack/acl/RoleTypeTest.java | 100 ++
 .../org/apache/cloudstack/acl/RuleTest.java     |  98 ++
 .../admin/account/CreateAccountCmdTest.java     |  10 +-
 .../api/command/test/UpdateCfgCmdTest.java      |  28 +-
 .../classes/resources/messages.properties       |   8 +
 client/pom.xml                                  |   5 +
 debian/cloudstack-management.install            |   1 -
 debian/control                                  |   2 +-
 developer/developer-prefill.sql                 |   5 +
 .../spring-engine-schema-core-daos-context.xml  |   2 +
 .../com/cloud/upgrade/dao/Upgrade481to490.java  |  75 +-
 engine/schema/src/com/cloud/user/AccountVO.java |  31 +-
 .../src/com/cloud/user/dao/AccountDao.java      |   2 +
 .../src/com/cloud/user/dao/AccountDaoImpl.java  |  19 +-
 .../apache/cloudstack/acl/RolePermissionVO.java | 120 +++
 .../src/org/apache/cloudstack/acl/RoleVO.java   | 106 +++
 .../org/apache/cloudstack/acl/dao/RoleDao.java  |  29 +
 .../apache/cloudstack/acl/dao/RoleDaoImpl.java  |  61 ++
 .../cloudstack/acl/dao/RolePermissionsDao.java  |  49 +
 .../acl/dao/RolePermissionsDaoImpl.java         | 166 ++++
 plugins/acl/dynamic-role-based/pom.xml          |  32 +
 .../acl-dynamic-role-based/module.properties    |  18 +
 .../spring-acl-dynamic-role-based-context.xml   |  33 +
 .../acl/DynamicRoleBasedAPIAccessChecker.java   | 144 +++
 .../DynamicRoleBasedAPIAccessCheckerTest.java   | 164 ++++
 .../acl/StaticRoleBasedAPIAccessChecker.java    |  48 +-
 .../api/command/user/discovery/ListApisCmd.java |   3 +-
 .../manager/BaremetalVlanManagerImpl.java       |  27 +-
 .../contrail/management/MockAccountManager.java |   8 +-
 plugins/pom.xml                                 |   1 +
 .../api/command/LdapCreateAccountCmd.java       |  41 +-
 .../api/command/LdapImportUsersCmd.java         |  20 +-
 .../api/command/LinkDomainToLdapCmd.java        |   3 +-
 .../cloudstack/ldap/LdapAuthenticator.java      |   4 +-
 .../ldap/LdapImportUsersCmdSpec.groovy          |   2 +-
 scripts/util/migrate-dynamicroles.py            | 136 +++
 .../spring-server-core-managers-context.xml     |   2 +
 server/src/com/cloud/api/ApiDBUtils.java        |  27 +-
 .../com/cloud/api/ApiResponseGsonHelper.java    |   2 +-
 server/src/com/cloud/api/ApiServer.java         |   8 +-
 .../com/cloud/api/query/vo/AccountJoinVO.java   |   7 +
 .../cloud/api/query/vo/UserAccountJoinVO.java   |   7 +
 .../api/response/ApiResponseSerializer.java     |   2 +-
 .../com/cloud/projects/ProjectManagerImpl.java  |   2 +-
 .../cloud/server/ConfigurationServerImpl.java   |   6 +-
 server/src/com/cloud/user/AccountManager.java   |   2 +-
 .../src/com/cloud/user/AccountManagerImpl.java  |  37 +-
 .../apache/cloudstack/acl/RoleManagerImpl.java  | 264 ++++++
 .../com/cloud/user/MockAccountManagerImpl.java  |   6 +-
 .../iam/RoleBasedAPIAccessChecker.java          |   2 +-
 .../db/db/create-default-role-api-mappings.sql  | 902 +++++++++++++++++++
 setup/db/db/schema-481to490-cleanup.sql         | 188 ++++
 setup/db/db/schema-481to490.sql                 |  35 +
 setup/db/server-setup.sql                       |   3 +-
 setup/db/server-setup.xml                       |   7 +
 test/integration/smoke/test_dynamicroles.py     | 537 +++++++++++
 test/integration/smoke/test_staticroles.py      | 134 +++
 tools/apidoc/gen_toc.py                         |   1 +
 tools/marvin/marvin/cloudstackConnection.py     |   2 +-
 tools/marvin/marvin/lib/base.py                 |  89 +-
 ui/css/cloudstack3.css                          |  16 +
 ui/dictionary.jsp                               |   7 +
 ui/dictionary2.jsp                              |   1 +
 ui/images/icons.png                             | Bin 61164 -> 48358 bytes
 ui/index.jsp                                    |   1 +
 ui/plugins/quota/quota.js                       |  16 +-
 ui/scripts/accounts.js                          |  31 +-
 ui/scripts/accountsWizard.js                    |  38 +-
 ui/scripts/cloudStack.js                        |   3 +-
 ui/scripts/roles.js                             | 388 ++++++++
 ui/scripts/sharedFunctions.js                   |  11 +
 .../main/java/com/cloud/utils/ListUtils.java    |  31 +
 .../java/com/cloud/utils/PropertiesUtil.java    |   4 +
 100 files changed, 5633 insertions(+), 170 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index d160e48..9d9822c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -36,10 +36,10 @@ env:
      - REGRESSION_INDEX=6
      - PATH=$HOME/.local/bin:$PATH
   matrix:
-    - TESTS="smoke/test_affinity_groups smoke/test_affinity_groups_projects smoke/test_deploy_vgpu_enabled_vm smoke/test_deploy_vm_iso smoke/test_deploy_vm_root_resize smoke/test_deploy_vm_with_userdata smoke/test_deploy_vms_with_varied_deploymentplanners smoke/test_disk_offerings smoke/test_global_settings smoke/test_guest_vlan_range"
+    - TESTS="smoke/test_affinity_groups smoke/test_affinity_groups_projects smoke/test_dynamicroles smoke/test_deploy_vgpu_enabled_vm smoke/test_deploy_vm_iso smoke/test_deploy_vm_root_resize smoke/test_deploy_vm_with_userdata smoke/test_deploy_vms_with_varied_deploymentplanners smoke/test_disk_offerings smoke/test_global_settings smoke/test_guest_vlan_range"
     - TESTS="smoke/test_hosts smoke/test_internal_lb smoke/test_iso smoke/test_list_ids_parameter smoke/test_loadbalance smoke/test_multipleips_per_nic smoke/test_network smoke/test_network_acl smoke/test_nic smoke/test_nic_adapter_type smoke/test_non_contigiousvlan"
     - TESTS="smoke/test_over_provisioning smoke/test_password_server smoke/test_portable_publicip smoke/test_primary_storage smoke/test_privategw_acl smoke/test_public_ip_range smoke/test_pvlan smoke/test_regions smoke/test_reset_vm_on_reboot smoke/test_resource_detail"
-    - TESTS="smoke/test_router_dhcphosts smoke/test_routers smoke/test_routers_iptables_default_policy smoke/test_routers_network_ops smoke/test_scale_vm smoke/test_secondary_storage smoke/test_service_offerings smoke/test_snapshots smoke/test_ssvm smoke/test_templates"
+    - TESTS="smoke/test_router_dhcphosts smoke/test_routers smoke/test_routers_iptables_default_policy smoke/test_routers_network_ops smoke/test_staticroles smoke/test_scale_vm smoke/test_secondary_storage smoke/test_service_offerings smoke/test_snapshots smoke/test_ssvm smoke/test_templates"
     - TESTS="smoke/test_usage_events smoke/test_vm_life_cycle smoke/test_vm_snapshots smoke/test_volumes smoke/test_vpc_redundant smoke/test_vpc_router_nics smoke/test_vpc_vpn smoke/misc/test_deploy_vm smoke/misc/test_vm_ha smoke/misc/test_escalations_templates smoke/misc/test_vm_sync"
 
     - TESTS="component/test_mm_max_limits component/test_acl_isolatednetwork_delete"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/com/cloud/event/EventTypes.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java
index 7349c1f..23de152 100644
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -66,6 +66,8 @@ import com.cloud.user.User;
 import com.cloud.vm.Nic;
 import com.cloud.vm.NicSecondaryIp;
 import com.cloud.vm.VirtualMachine;
+import org.apache.cloudstack.acl.Role;
+import org.apache.cloudstack.acl.RolePermission;
 import org.apache.cloudstack.config.Configuration;
 import org.apache.cloudstack.usage.Usage;
 
@@ -166,6 +168,14 @@ public class EventTypes {
     public static final String EVENT_GLOBAL_LOAD_BALANCER_DELETE = "GLOBAL.LB.DELETE";
     public static final String EVENT_GLOBAL_LOAD_BALANCER_UPDATE = "GLOBAL.LB.UPDATE";
 
+    // Role events
+    public static final String EVENT_ROLE_CREATE = "ROLE.CREATE";
+    public static final String EVENT_ROLE_UPDATE = "ROLE.UPDATE";
+    public static final String EVENT_ROLE_DELETE = "ROLE.DELETE";
+    public static final String EVENT_ROLE_PERMISSION_CREATE = "ROLE.PERMISSION.CREATE";
+    public static final String EVENT_ROLE_PERMISSION_UPDATE = "ROLE.PERMISSION.UPDATE";
+    public static final String EVENT_ROLE_PERMISSION_DELETE = "ROLE.PERMISSION.DELETE";
+
     // Account events
     public static final String EVENT_ACCOUNT_ENABLE = "ACCOUNT.ENABLE";
     public static final String EVENT_ACCOUNT_DISABLE = "ACCOUNT.DISABLE";
@@ -605,6 +615,14 @@ public class EventTypes {
         entityEventDetails.put(EVENT_LB_CERT_ASSIGN, LoadBalancer.class);
         entityEventDetails.put(EVENT_LB_CERT_REMOVE, LoadBalancer.class);
 
+        // Role events
+        entityEventDetails.put(EVENT_ROLE_CREATE, Role.class);
+        entityEventDetails.put(EVENT_ROLE_UPDATE, Role.class);
+        entityEventDetails.put(EVENT_ROLE_DELETE, Role.class);
+        entityEventDetails.put(EVENT_ROLE_PERMISSION_CREATE, RolePermission.class);
+        entityEventDetails.put(EVENT_ROLE_PERMISSION_UPDATE, RolePermission.class);
+        entityEventDetails.put(EVENT_ROLE_PERMISSION_DELETE, RolePermission.class);
+
         // Account events
         entityEventDetails.put(EVENT_ACCOUNT_ENABLE, Account.class);
         entityEventDetails.put(EVENT_ACCOUNT_DISABLE, Account.class);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/com/cloud/user/Account.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/user/Account.java b/api/src/com/cloud/user/Account.java
index b912e51..58cedcd 100644
--- a/api/src/com/cloud/user/Account.java
+++ b/api/src/com/cloud/user/Account.java
@@ -46,6 +46,8 @@ public interface Account extends ControlledEntity, InternalIdentity, Identity {
 
     public short getType();
 
+    public Long getRoleId();
+
     public State getState();
 
     public Date getRemoved();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/com/cloud/user/AccountService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/user/AccountService.java b/api/src/com/cloud/user/AccountService.java
index 7cc1e30..959a710 100644
--- a/api/src/com/cloud/user/AccountService.java
+++ b/api/src/com/cloud/user/AccountService.java
@@ -57,9 +57,9 @@ public interface AccountService {
      * @return the user if created successfully, null otherwise
      */
     UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName,
-        short accountType, Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID);
+        short accountType, Long roleId, Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID);
 
-    UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain,
+    UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long roleId, Long domainId, String networkDomain,
                                   Map<String, String> details, String accountUUID, String userUUID, User.Source source);
 
     /**

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/acl/Role.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/acl/Role.java b/api/src/org/apache/cloudstack/acl/Role.java
new file mode 100644
index 0000000..b05d886
--- /dev/null
+++ b/api/src/org/apache/cloudstack/acl/Role.java
@@ -0,0 +1,27 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.acl;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+public interface Role extends InternalIdentity, Identity {
+    String getName();
+    RoleType getRoleType();
+    String getDescription();
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/acl/RolePermission.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/acl/RolePermission.java b/api/src/org/apache/cloudstack/acl/RolePermission.java
new file mode 100644
index 0000000..0157a66
--- /dev/null
+++ b/api/src/org/apache/cloudstack/acl/RolePermission.java
@@ -0,0 +1,31 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.acl;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+public interface RolePermission extends InternalIdentity, Identity {
+    enum Permission {ALLOW, DENY}
+
+    long getRoleId();
+    Rule getRule();
+    Permission getPermission();
+    String getDescription();
+    long getSortOrder();
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/acl/RoleService.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/acl/RoleService.java b/api/src/org/apache/cloudstack/acl/RoleService.java
new file mode 100644
index 0000000..59eef51
--- /dev/null
+++ b/api/src/org/apache/cloudstack/acl/RoleService.java
@@ -0,0 +1,52 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.acl;
+
+import org.apache.cloudstack.framework.config.ConfigKey;
+
+import java.util.List;
+
+public interface RoleService {
+
+    ConfigKey<Boolean> EnableDynamicApiChecker = new ConfigKey<>("Advanced", Boolean.class, "dynamic.apichecker.enabled", "false",
+            "If set to true, this enables the dynamic role-based api access checker and disables the default static role-based api access checker.",
+            true);
+
+    boolean isEnabled();
+    Role findRole(final Long id);
+    Role createRole(final String name, final RoleType roleType, final String description);
+    boolean updateRole(final Role role, final String name, final RoleType roleType, final String description);
+    boolean deleteRole(final Role role);
+
+    RolePermission findRolePermission(final Long id);
+    RolePermission findRolePermissionByUuid(final String uuid);
+
+    RolePermission createRolePermission(final Role role, final Rule rule, final RolePermission.Permission permission, final String description);
+    /**
+     * updateRolePermission updates the order/position of an role permission
+     * @param role The role whose permissions needs to be re-ordered
+     * @param newOrder The new list of ordered role permissions
+     */
+    boolean updateRolePermission(final Role role, final List<RolePermission> newOrder);
+    boolean deleteRolePermission(final RolePermission rolePermission);
+
+    List<Role> listRoles();
+    List<Role> findRolesByName(final String name);
+    List<Role> findRolesByType(final RoleType roleType);
+    List<RolePermission> findAllPermissionsBy(final Long roleId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/acl/RoleType.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/acl/RoleType.java b/api/src/org/apache/cloudstack/acl/RoleType.java
index 90e3d1e..a8a64a5 100644
--- a/api/src/org/apache/cloudstack/acl/RoleType.java
+++ b/api/src/org/apache/cloudstack/acl/RoleType.java
@@ -16,18 +16,90 @@
 // under the License.
 package org.apache.cloudstack.acl;
 
+import com.cloud.user.Account;
+import com.google.common.base.Enums;
+import com.google.common.base.Strings;
+
 // Enum for default roles in CloudStack
 public enum RoleType {
-    Admin(1), ResourceAdmin(2), DomainAdmin(4), User(8), Unknown(0);
+    Admin(1L, Account.ACCOUNT_TYPE_ADMIN, 1),
+    ResourceAdmin(2L, Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN, 2),
+    DomainAdmin(3L, Account.ACCOUNT_TYPE_DOMAIN_ADMIN, 4),
+    User(4L, Account.ACCOUNT_TYPE_NORMAL, 8),
+    Unknown(-1L, (short) -1, 0);
 
+    private long id;
+    private short accountType;
     private int mask;
 
-    private RoleType(int mask) {
+    RoleType(final long id, final short accountType, final int mask) {
+        this.id = id;
+        this.accountType = accountType;
         this.mask = mask;
     }
 
-    public int getValue() {
+    public long getId() {
+        return id;
+    }
+
+    public short getAccountType() {
+        return accountType;
+    }
+
+    public int getMask() {
         return mask;
     }
-}
 
+    public static RoleType fromString(final String name) {
+        if (!Strings.isNullOrEmpty(name)
+                && Enums.getIfPresent(RoleType.class, name).isPresent()) {
+            return RoleType.valueOf(name);
+        }
+        throw new IllegalStateException("Illegal RoleType name provided");
+    }
+
+    public static RoleType fromMask(int mask) {
+        for (RoleType roleType : RoleType.values()) {
+            if (roleType.getMask() == mask) {
+                return roleType;
+            }
+        }
+        return Unknown;
+    }
+
+    public static RoleType getByAccountType(final short accountType) {
+        RoleType roleType = RoleType.Unknown;
+        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;
+    }
+
+    public static Long getRoleByAccountType(final Long roleId, final Short accountType) {
+        if (roleId == null && accountType != null) {
+            RoleType defaultRoleType = RoleType.getByAccountType(accountType);
+            if (defaultRoleType != null && defaultRoleType != RoleType.Unknown) {
+                return defaultRoleType.getId();
+            }
+        }
+        return roleId;
+    }
+
+    public static Short getAccountTypeByRole(final Role role, final Short accountType) {
+        if (role != null && role.getId() > 0L) {
+            return role.getRoleType().getAccountType();
+        }
+        return accountType;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/acl/Rule.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/acl/Rule.java b/api/src/org/apache/cloudstack/acl/Rule.java
new file mode 100644
index 0000000..2792010
--- /dev/null
+++ b/api/src/org/apache/cloudstack/acl/Rule.java
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.acl;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.google.common.base.Strings;
+
+import java.util.regex.Pattern;
+
+public final class Rule {
+    private final String rule;
+    private final static Pattern ALLOWED_PATTERN = Pattern.compile("^[a-zA-Z0-9*]+$");
+
+    public Rule(final String rule) {
+        validate(rule);
+        this.rule = rule;
+    }
+
+    public boolean matches(final String commandName) {
+        return !Strings.isNullOrEmpty(commandName)
+                && commandName.toLowerCase().matches(rule.toLowerCase().replace("*", "\\w*"));
+    }
+
+    public String getRuleString() {
+        return rule;
+    }
+
+    @Override
+    public String toString() {
+        return rule;
+    }
+
+    private static boolean validate(final String rule) {
+        if (Strings.isNullOrEmpty(rule) || !ALLOWED_PATTERN.matcher(rule).matches()) {
+            throw new InvalidParameterValueException("Only API names and wildcards are allowed, invalid rule provided: " + rule);
+        }
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index 6f3152b..4904925 100644
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -193,6 +193,7 @@ public class ApiConstants {
     public static final String PORTABLE_IP_ADDRESS = "portableipaddress";
     public static final String PORT_FORWARDING_SERVICE_ID = "portforwardingserviceid";
     public static final String POST_URL = "postURL";
+    public static final String PARENT = "parent";
     public static final String PRIVATE_INTERFACE = "privateinterface";
     public static final String PRIVATE_IP = "privateip";
     public static final String PRIVATE_PORT = "privateport";
@@ -358,6 +359,12 @@ public class ApiConstants {
     public static final String PROJECT_IDS = "projectids";
     public static final String PROJECT = "project";
     public static final String ROLE = "role";
+    public static final String ROLE_ID = "roleid";
+    public static final String ROLE_TYPE = "roletype";
+    public static final String ROLE_NAME = "rolename";
+    public static final String PERMISSION = "permission";
+    public static final String RULE = "rule";
+    public static final String RULE_ORDER = "ruleorder";
     public static final String USER = "user";
     public static final String ACTIVE_ONLY = "activeonly";
     public static final String TOKEN = "token";

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index 360b277..5be7519 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -30,6 +30,7 @@ import java.util.regex.Pattern;
 import javax.inject.Inject;
 
 import com.cloud.utils.HttpUtils;
+import org.apache.cloudstack.acl.RoleService;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.acl.RoleType;
@@ -85,6 +86,7 @@ import com.cloud.vm.snapshot.VMSnapshotService;
 
 public abstract class BaseCmd {
     private static final Logger s_logger = Logger.getLogger(BaseCmd.class.getName());
+    public static final String RESPONSE_SUFFIX = "response";
     public static final String RESPONSE_TYPE_XML = HttpUtils.RESPONSE_TYPE_XML;
     public static final String RESPONSE_TYPE_JSON = HttpUtils.RESPONSE_TYPE_JSON;
     public static final String USER_ERROR_MESSAGE = "Internal error executing command, please contact your system administrator";
@@ -104,12 +106,13 @@ public abstract class BaseCmd {
     @Parameter(name = "response", type = CommandType.STRING)
     private String responseType;
 
-
     @Inject
     public ConfigurationService _configService;
     @Inject
     public AccountService _accountService;
     @Inject
+    public RoleService roleService;
+    @Inject
     public UserVmService _userVmService;
     @Inject
     public ManagementService _mgr;
@@ -323,7 +326,7 @@ public abstract class BaseCmd {
             if (allowedRoles.length > 0) {
                 roleIsAllowed = false;
                 for (final RoleType allowedRole : allowedRoles) {
-                    if (allowedRole.getValue() == caller.getType()) {
+                    if (allowedRole.getAccountType() == caller.getType()) {
                         roleIsAllowed = true;
                         break;
                     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
index b55ce71..2e1fbd6 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
@@ -22,6 +22,7 @@ import java.util.Map;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 
+import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.ApiErrorCode;
@@ -31,6 +32,7 @@ import org.apache.cloudstack.api.ResponseObject.ResponseView;
 import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.response.AccountResponse;
 import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.RoleResponse;
 import org.apache.cloudstack.context.CallContext;
 
 import com.cloud.user.Account;
@@ -55,10 +57,12 @@ public class CreateAccountCmd extends BaseCmd {
 
     @Parameter(name = ApiConstants.ACCOUNT_TYPE,
                type = CommandType.SHORT,
-               required = true,
                description = "Type of the account.  Specify 0 for user, 1 for root admin, and 2 for domain admin")
     private Short accountType;
 
+    @Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, entityType = RoleResponse.class, description = "Creates the account under the specified role.")
+    private Long roleId;
+
     @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Creates the user under the specified domain.")
     private Long domainId;
 
@@ -106,7 +110,11 @@ public class CreateAccountCmd extends BaseCmd {
     }
 
     public Short getAccountType() {
-        return accountType;
+        return RoleType.getAccountTypeByRole(roleService.findRole(roleId), accountType);
+    }
+
+    public Long getRoleId() {
+        return RoleType.getRoleByAccountType(roleId, accountType);
     }
 
     public Long getDomainId() {
@@ -178,7 +186,7 @@ public class CreateAccountCmd extends BaseCmd {
         validateParams();
         CallContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getDomainId());
         UserAccount userAccount =
-            _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(),
+            _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(), getRoleId(),
                 getDomainId(), getNetworkDomain(), getDetails(), getAccountUUID(), getUserUUID());
         if (userAccount != null) {
             AccountResponse response = _responseGenerator.createUserAccountResponse(ResponseView.Full, userAccount);
@@ -196,5 +204,8 @@ public class CreateAccountCmd extends BaseCmd {
         if(StringUtils.isEmpty(getPassword())) {
             throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Empty passwords are not allowed");
         }
+        if (getAccountType() == null && (getRoleId() == null || getRoleId() < 1L)) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Neither account type and role ID are not provided");
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java b/api/src/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java
new file mode 100644
index 0000000..994573d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java
@@ -0,0 +1,105 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.admin.acl;
+
+import com.cloud.user.Account;
+import org.apache.cloudstack.acl.Role;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.ApiArgValidator;
+import org.apache.cloudstack.api.response.RoleResponse;
+import org.apache.cloudstack.context.CallContext;
+
+@APICommand(name = CreateRoleCmd.APINAME, description = "Creates a role", responseObject = RoleResponse.class,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
+        since = "4.9.0",
+        authorized = {RoleType.Admin})
+public class CreateRoleCmd extends BaseCmd {
+    public static final String APINAME = "createRole";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true,
+            description = "creates a role with this unique name", validations = {ApiArgValidator.NotNullOrEmpty})
+    private String roleName;
+
+    @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, required = true,
+            description = "The type of the role, valid options are: Admin, ResourceAdmin, DomainAdmin, User",
+            validations = {ApiArgValidator.NotNullOrEmpty})
+    private String roleType;
+
+    @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "The description of the role")
+    private String roleDescription;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getRoleName() {
+        return roleName;
+    }
+
+    public RoleType getRoleType() {
+        return RoleType.fromString(roleType);
+    }
+
+    public String getRoleDescription() {
+        return roleDescription;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    private void setupResponse(final Role role) {
+        final RoleResponse response = new RoleResponse();
+        response.setId(role.getUuid());
+        response.setRoleName(role.getName());
+        response.setRoleType(role.getRoleType());
+        response.setResponseName(getCommandName());
+        response.setObjectName("role");
+        setResponseObject(response);
+    }
+
+    @Override
+    public void execute() {
+        CallContext.current().setEventDetails("Role: " + getRoleName() + ", type:" + getRoleType() + ", description: " + getRoleDescription());
+        final Role role = roleService.createRole(getRoleName(), getRoleType(), getRoleDescription());
+        if (role == null) {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create role");
+        }
+        setupResponse(role);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/command/admin/acl/CreateRolePermissionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/CreateRolePermissionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/acl/CreateRolePermissionCmd.java
new file mode 100644
index 0000000..aeb3f4e
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/acl/CreateRolePermissionCmd.java
@@ -0,0 +1,124 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.admin.acl;
+
+import com.cloud.user.Account;
+import com.google.common.base.Strings;
+import org.apache.cloudstack.acl.Role;
+import org.apache.cloudstack.acl.RolePermission;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.acl.Rule;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.ApiArgValidator;
+import org.apache.cloudstack.api.response.RolePermissionResponse;
+import org.apache.cloudstack.api.response.RoleResponse;
+import org.apache.cloudstack.context.CallContext;
+
+@APICommand(name = CreateRolePermissionCmd.APINAME, description = "Adds a API permission to a role", responseObject = RolePermissionResponse.class,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
+        since = "4.9.0",
+        authorized = {RoleType.Admin})
+public class CreateRolePermissionCmd extends BaseCmd {
+    public static final String APINAME = "createRolePermission";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, required = true, entityType = RoleResponse.class,
+            description = "ID of the role", validations = {ApiArgValidator.PositiveNumber})
+    private Long roleId;
+
+    @Parameter(name = ApiConstants.RULE, type = CommandType.STRING, required = true, description = "The API name or wildcard rule such as list*",
+            validations = {ApiArgValidator.NotNullOrEmpty})
+    private String rule;
+
+    @Parameter(name = ApiConstants.PERMISSION, type = CommandType.STRING, required = true, description = "The rule permission, allow or deny. Default: deny.")
+    private String permission;
+
+    @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "The description of the role permission")
+    private String description;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getRoleId() {
+        return roleId;
+    }
+
+    public Rule getRule() {
+        return new Rule(rule);
+    }
+
+    public RolePermission.Permission getPermission() {
+        if (Strings.isNullOrEmpty(permission)) {
+            return null;
+        }
+        return RolePermission.Permission.valueOf(permission.toUpperCase());
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    private void setupResponse(final RolePermission rolePermission, final Role role) {
+        final RolePermissionResponse response = new RolePermissionResponse();
+        response.setId(rolePermission.getUuid());
+        response.setRoleId(role.getUuid());
+        response.setRule(rolePermission.getRule());
+        response.setRulePermission(rolePermission.getPermission());
+        response.setDescription(rolePermission.getDescription());
+        response.setResponseName(getCommandName());
+        response.setObjectName("rolepermission");
+        setResponseObject(response);
+    }
+
+    @Override
+    public void execute() {
+        final Role role = roleService.findRole(getRoleId());
+        if (role == null) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role id provided");
+        }
+        CallContext.current().setEventDetails("Role id: " + role.getId() + ", rule:" + getRule() + ", permission: " + getPermission() + ", description: " + getDescription());
+        final RolePermission rolePermission = roleService.createRolePermission(role, getRule(), getPermission(), getDescription());
+        if (rolePermission == null) {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create role permission");
+        }
+        setupResponse(rolePermission, role);
+     }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/command/admin/acl/DeleteRoleCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/DeleteRoleCmd.java b/api/src/org/apache/cloudstack/api/command/admin/acl/DeleteRoleCmd.java
new file mode 100644
index 0000000..bd4a7cd
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/acl/DeleteRoleCmd.java
@@ -0,0 +1,83 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.admin.acl;
+
+import com.cloud.user.Account;
+import org.apache.cloudstack.acl.Role;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.ApiArgValidator;
+import org.apache.cloudstack.api.response.RoleResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.context.CallContext;
+
+@APICommand(name = DeleteRoleCmd.APINAME, description = "Deletes a role", responseObject = SuccessResponse.class,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
+        since = "4.9.0",
+        authorized = {RoleType.Admin})
+public class DeleteRoleCmd extends BaseCmd {
+    public static final String APINAME = "deleteRole";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, required = true, entityType = RoleResponse.class,
+            description = "ID of the role", validations = {ApiArgValidator.PositiveNumber})
+    private Long roleId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getRoleId() {
+        return roleId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute() {
+        Role role = roleService.findRole(getRoleId());
+        if (role == null) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot find the role with provided id");
+        }
+        CallContext.current().setEventDetails("Role id: " + role.getId());
+        boolean result = roleService.deleteRole(role);
+        SuccessResponse response = new SuccessResponse(getCommandName());
+        response.setSuccess(result);
+        setResponseObject(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/command/admin/acl/DeleteRolePermissionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/DeleteRolePermissionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/acl/DeleteRolePermissionCmd.java
new file mode 100644
index 0000000..9c7dc7c
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/acl/DeleteRolePermissionCmd.java
@@ -0,0 +1,83 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.admin.acl;
+
+import com.cloud.user.Account;
+import org.apache.cloudstack.acl.RolePermission;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.ApiArgValidator;
+import org.apache.cloudstack.api.response.RolePermissionResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.context.CallContext;
+
+@APICommand(name = DeleteRolePermissionCmd.APINAME, description = "Deletes a role permission", responseObject = SuccessResponse.class,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
+        since = "4.9.0",
+        authorized = {RoleType.Admin})
+public class DeleteRolePermissionCmd extends BaseCmd {
+    public static final String APINAME = "deleteRolePermission";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, required = true, entityType = RolePermissionResponse.class,
+            description = "ID of the role permission", validations = {ApiArgValidator.PositiveNumber})
+    private Long rolePermissionId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getRolePermissionId() {
+        return rolePermissionId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute() {
+        RolePermission rolePermission = roleService.findRolePermission(getRolePermissionId());
+        if (rolePermission == null) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role permission id provided");
+        }
+        CallContext.current().setEventDetails("Role permission id: " + rolePermission.getId());
+        boolean result = roleService.deleteRolePermission(rolePermission);
+        SuccessResponse response = new SuccessResponse(getCommandName());
+        response.setSuccess(result);
+        setResponseObject(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/command/admin/acl/ListRolePermissionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/ListRolePermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/acl/ListRolePermissionsCmd.java
new file mode 100644
index 0000000..f20abf4
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/acl/ListRolePermissionsCmd.java
@@ -0,0 +1,106 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.admin.acl;
+
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import org.apache.cloudstack.acl.Role;
+import org.apache.cloudstack.acl.RolePermission;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.ApiArgValidator;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.RolePermissionResponse;
+import org.apache.cloudstack.api.response.RoleResponse;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+@APICommand(name = ListRolePermissionsCmd.APINAME, description = "Lists role permissions", responseObject = RolePermissionResponse.class,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
+        since = "4.9.0",
+        authorized = {RoleType.Admin})
+public class ListRolePermissionsCmd extends BaseCmd {
+    public static final String APINAME = "listRolePermissions";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, entityType = RoleResponse.class,
+            description = "ID of the role", validations = {ApiArgValidator.PositiveNumber})
+    private Long roleId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getRoleId() {
+        return roleId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    private void setupResponse(final List<RolePermission> rolePermissions, final Long roleId) {
+        final Role roleProvided = roleService.findRole(roleId);
+        final ListResponse<RolePermissionResponse> response = new ListResponse<>();
+        final List<RolePermissionResponse> rolePermissionResponses = new ArrayList<>();
+        for (final RolePermission rolePermission : rolePermissions) {
+            final RolePermissionResponse rolePermissionResponse = new RolePermissionResponse();
+            Role role = roleProvided;
+            if (role == null) {
+                role = roleService.findRole(rolePermission.getRoleId());
+            }
+            rolePermissionResponse.setRoleId(role.getUuid());
+            rolePermissionResponse.setRoleName(role.getName());
+            rolePermissionResponse.setId(rolePermission.getUuid());
+            rolePermissionResponse.setRule(rolePermission.getRule());
+            rolePermissionResponse.setRulePermission(rolePermission.getPermission());
+            rolePermissionResponse.setDescription(rolePermission.getDescription());
+            rolePermissionResponse.setObjectName("rolepermission");
+            rolePermissionResponses.add(rolePermissionResponse);
+        }
+        response.setResponses(rolePermissionResponses);
+        response.setResponseName(getCommandName());
+        setResponseObject(response);
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException {
+        final List<RolePermission> rolePermissions = roleService.findAllPermissionsBy(getRoleId());
+        setupResponse(rolePermissions, getRoleId());
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/command/admin/acl/ListRolesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/ListRolesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/acl/ListRolesCmd.java
new file mode 100644
index 0000000..5cf870b
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/acl/ListRolesCmd.java
@@ -0,0 +1,128 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.admin.acl;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.google.common.base.Strings;
+import org.apache.cloudstack.acl.Role;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.RoleResponse;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+@APICommand(name = ListRolesCmd.APINAME, description = "Lists dynamic roles in CloudStack", responseObject = RoleResponse.class,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
+        since = "4.9.0",
+        authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin})
+public class ListRolesCmd extends BaseCmd {
+    public static final String APINAME = "listRoles";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = RoleResponse.class, description = "List role by role ID.")
+    private Long id;
+
+    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List role by role name.")
+    private String roleName;
+
+    @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "List role by role type, valid options are: Admin, ResourceAdmin, DomainAdmin, User.")
+    private String roleType;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getName() {
+        return roleName;
+    }
+
+    public RoleType getRoleType() {
+        if (!Strings.isNullOrEmpty(roleType)) {
+            return RoleType.valueOf(roleType);
+        }
+        return null;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    private void setupResponse(final List<Role> roles) {
+        final ListResponse<RoleResponse> response = new ListResponse<>();
+        final List<RoleResponse> roleResponses = new ArrayList<>();
+        for (final Role role : roles) {
+            if (role == null) {
+                continue;
+            }
+            final RoleResponse roleResponse = new RoleResponse();
+            roleResponse.setId(role.getUuid());
+            roleResponse.setRoleName(role.getName());
+            roleResponse.setRoleType(role.getRoleType());
+            roleResponse.setDescription(role.getDescription());
+            roleResponse.setObjectName("role");
+            roleResponses.add(roleResponse);
+        }
+        response.setResponses(roleResponses);
+        response.setResponseName(getCommandName());
+        setResponseObject(response);
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
+        final List<Role> roles;
+        if (getId() != null && getId() > 0L) {
+            roles = Collections.singletonList(roleService.findRole(getId()));
+        } else if (!Strings.isNullOrEmpty(getName())) {
+            roles = roleService.findRolesByName(getName());
+        } else if (getRoleType() != null){
+            roles = roleService.findRolesByType(getRoleType());
+        } else {
+            roles = roleService.listRoles();
+        }
+        setupResponse(roles);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/command/admin/acl/UpdateRoleCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/UpdateRoleCmd.java b/api/src/org/apache/cloudstack/api/command/admin/acl/UpdateRoleCmd.java
new file mode 100644
index 0000000..e17fc6f
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/acl/UpdateRoleCmd.java
@@ -0,0 +1,108 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.admin.acl;
+
+import com.cloud.user.Account;
+import com.google.common.base.Strings;
+import org.apache.cloudstack.acl.Role;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.ApiArgValidator;
+import org.apache.cloudstack.api.response.RoleResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.context.CallContext;
+
+@APICommand(name = UpdateRoleCmd.APINAME, description = "Updates a role", responseObject = SuccessResponse.class,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
+        since = "4.9.0",
+        authorized = {RoleType.Admin})
+public class UpdateRoleCmd extends BaseCmd {
+    public static final String APINAME = "updateRole";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, required = true, entityType = RoleResponse.class,
+            description = "ID of the role", validations = {ApiArgValidator.PositiveNumber})
+    private Long roleId;
+
+    @Parameter(name = ApiConstants.NAME, type = BaseCmd.CommandType.STRING, description = "creates a role with this unique name")
+    private String roleName;
+
+    @Parameter(name = ApiConstants.TYPE, type = BaseCmd.CommandType.STRING, description = "The type of the role, valid options are: Admin, ResourceAdmin, DomainAdmin, User")
+    private String roleType;
+
+    @Parameter(name = ApiConstants.DESCRIPTION, type = BaseCmd.CommandType.STRING, description = "The description of the role")
+    private String roleDescription;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getRoleId() {
+        return roleId;
+    }
+
+    public String getRoleName() {
+        return roleName;
+    }
+
+    public RoleType getRoleType() {
+        if (!Strings.isNullOrEmpty(roleType)) {
+            return RoleType.fromString(roleType);
+        }
+        return null;
+    }
+
+    public String getRoleDescription() {
+        return roleDescription;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute() {
+        Role role = roleService.findRole(getRoleId());
+        if (role == null) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role id provided");
+        }
+        CallContext.current().setEventDetails("Role: " + getRoleName() + ", type:" + getRoleType() + ", description: " + getRoleDescription());
+        boolean result = roleService.updateRole(role, getRoleName(), getRoleType(), getRoleDescription());
+        SuccessResponse response = new SuccessResponse(getCommandName());
+        response.setSuccess(result);
+        setResponseObject(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/command/admin/acl/UpdateRolePermissionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/acl/UpdateRolePermissionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/acl/UpdateRolePermissionCmd.java
new file mode 100644
index 0000000..055265c
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/acl/UpdateRolePermissionCmd.java
@@ -0,0 +1,104 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.admin.acl;
+
+import com.cloud.user.Account;
+import org.apache.cloudstack.acl.Role;
+import org.apache.cloudstack.acl.RolePermission;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiArgValidator;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.RolePermissionResponse;
+import org.apache.cloudstack.api.response.RoleResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.context.CallContext;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@APICommand(name = UpdateRolePermissionCmd.APINAME, description = "Updates a role permission order", responseObject = SuccessResponse.class,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
+        since = "4.9.0",
+        authorized = {RoleType.Admin})
+public class UpdateRolePermissionCmd extends BaseCmd {
+    public static final String APINAME = "updateRolePermission";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, required = true, entityType = RoleResponse.class,
+            description = "ID of the role", validations = {ApiArgValidator.PositiveNumber})
+    private Long roleId;
+
+    @Parameter(name = ApiConstants.RULE_ORDER, type = CommandType.LIST, collectionType = CommandType.UUID, required = true, entityType = RolePermissionResponse.class,
+            description = "The parent role permission uuid, use 0 to move this rule at the top of the list")
+    private List<Long> rulePermissionOrder;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getRoleId() {
+        return roleId;
+    }
+
+    public List<Long> getRulePermissionOrder() {
+        return rulePermissionOrder;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute() {
+        final Role role = roleService.findRole(getRoleId());
+        if (role == null) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role id provided");
+        }
+        CallContext.current().setEventDetails("Reordering permissions for role id: " + role.getId());
+        final List<RolePermission> rolePermissionsOrder = new ArrayList<>();
+        for (Long rolePermissionId : getRulePermissionOrder()) {
+            final RolePermission rolePermission = roleService.findRolePermission(rolePermissionId);
+            if (rolePermission == null) {
+                throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Provided role permission(s) do not exist");
+            }
+            rolePermissionsOrder.add(rolePermission);
+        }
+        boolean result = roleService.updateRolePermission(role, rolePermissionsOrder);
+        SuccessResponse response = new SuccessResponse(getCommandName());
+        response.setSuccess(result);
+        setResponseObject(response);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
index 0124d59..45f790f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
@@ -16,6 +16,8 @@
 // under the License.
 package org.apache.cloudstack.api.command.admin.config;
 
+import com.google.common.base.Strings;
+import org.apache.cloudstack.acl.RoleService;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.APICommand;
@@ -81,6 +83,10 @@ public class UpdateCfgCmd extends BaseCmd {
         return cfgName;
     }
 
+    public void setCfgName(final String cfgName) {
+        this.cfgName = cfgName;
+    }
+
     public String getValue() {
         return value;
     }
@@ -117,6 +123,12 @@ public class UpdateCfgCmd extends BaseCmd {
 
     @Override
     public void execute() {
+        if (Strings.isNullOrEmpty(getCfgName())) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Empty configuration name provided");
+        }
+        if (getCfgName().equalsIgnoreCase(RoleService.EnableDynamicApiChecker.key())) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Restricted configuration update not allowed");
+        }
         Configuration cfg = _configService.updateConfiguration(this);
         if (cfg != null) {
             ConfigurationResponse response = _responseGenerator.createConfigurationResponse(cfg);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java b/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java
index 24486a3..9c52656 100644
--- a/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java
@@ -47,6 +47,7 @@ public class ListCapabilitiesCmd extends BaseCmd {
         Map<String, Object> capabilities = _mgr.listCapabilities(this);
         CapabilitiesResponse response = new CapabilitiesResponse();
         response.setSecurityGroupsEnabled((Boolean)capabilities.get("securityGroupsEnabled"));
+        response.setDynamicRolesEnabled(roleService.isEnabled());
         response.setCloudStackVersion((String)capabilities.get("cloudStackVersion"));
         response.setUserPublicTemplateEnabled((Boolean)capabilities.get("userPublicTemplateEnabled"));
         response.setSupportELB((String)capabilities.get("supportELB"));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/response/AccountResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/AccountResponse.java b/api/src/org/apache/cloudstack/api/response/AccountResponse.java
index 2e50c51..7b48a1e 100644
--- a/api/src/org/apache/cloudstack/api/response/AccountResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/AccountResponse.java
@@ -21,6 +21,7 @@ import java.util.Map;
 
 import com.google.gson.annotations.SerializedName;
 
+import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseResponse;
 import org.apache.cloudstack.api.EntityReference;
@@ -43,6 +44,18 @@ public class AccountResponse extends BaseResponse implements ResourceLimitAndCou
     @Param(description = "account type (admin, domain-admin, user)")
     private Short accountType;
 
+    @SerializedName(ApiConstants.ROLE_ID)
+    @Param(description = "the ID of the role")
+    private String roleId;
+
+    @SerializedName(ApiConstants.ROLE_TYPE)
+    @Param(description = "the type of the role (Admin, ResourceAdmin, DomainAdmin, User)")
+    private String roleType;
+
+    @SerializedName(ApiConstants.ROLE_NAME)
+    @Param(description = "the name of the role")
+    private String roleName;
+
     @SerializedName(ApiConstants.DOMAIN_ID)
     @Param(description = "id of the Domain the account belongs too")
     private String domainId;
@@ -260,6 +273,20 @@ public class AccountResponse extends BaseResponse implements ResourceLimitAndCou
         this.accountType = accountType;
     }
 
+    public void setRoleId(String roleId) {
+        this.roleId = roleId;
+    }
+
+    public void setRoleType(RoleType roleType) {
+        if (roleType != null) {
+            this.roleType = roleType.name();
+        }
+    }
+
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
+    }
+
     public void setDomainId(String domainId) {
         this.domainId = domainId;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/response/CapabilitiesResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/CapabilitiesResponse.java b/api/src/org/apache/cloudstack/api/response/CapabilitiesResponse.java
index 623a0a2..bcdad46 100644
--- a/api/src/org/apache/cloudstack/api/response/CapabilitiesResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/CapabilitiesResponse.java
@@ -28,6 +28,10 @@ public class CapabilitiesResponse extends BaseResponse {
     @Param(description = "true if security groups support is enabled, false otherwise")
     private boolean securityGroupsEnabled;
 
+    @SerializedName("dynamicrolesenabled")
+    @Param(description = "true if dynamic role-based api checker is enabled, false otherwise")
+    private boolean dynamicRolesEnabled;
+
     @SerializedName("cloudstackversion")
     @Param(description = "version of the cloud stack")
     private String cloudStackVersion;
@@ -84,6 +88,10 @@ public class CapabilitiesResponse extends BaseResponse {
         this.securityGroupsEnabled = securityGroupsEnabled;
     }
 
+    public void setDynamicRolesEnabled(boolean dynamicRolesEnabled) {
+        this.dynamicRolesEnabled = dynamicRolesEnabled;
+    }
+
     public void setCloudStackVersion(String cloudStackVersion) {
         this.cloudStackVersion = cloudStackVersion;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/response/RolePermissionResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/RolePermissionResponse.java b/api/src/org/apache/cloudstack/api/response/RolePermissionResponse.java
new file mode 100644
index 0000000..ac1c529
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/RolePermissionResponse.java
@@ -0,0 +1,101 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.response;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+import org.apache.cloudstack.acl.RolePermission;
+import org.apache.cloudstack.acl.Rule;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+@EntityReference(value = RolePermission.class)
+public class RolePermissionResponse extends BaseResponse {
+    @SerializedName(ApiConstants.ID)
+    @Param(description = "the ID of the role permission")
+    private String id;
+
+    @SerializedName(ApiConstants.ROLE_ID)
+    @Param(description = "the ID of the role to which the role permission belongs")
+    private String roleId;
+
+    @SerializedName(ApiConstants.ROLE_NAME)
+    @Param(description = "the name of the role to which the role permission belongs")
+    private String roleName;
+
+    @SerializedName(ApiConstants.RULE)
+    @Param(description = "the api name or wildcard rule")
+    private String rule;
+
+    @SerializedName(ApiConstants.PERMISSION)
+    @Param(description = "the permission type of the api name or wildcard rule, allow/deny")
+    private String rulePermission;
+
+    @SerializedName(ApiConstants.DESCRIPTION)
+    @Param(description = "the description of the role permission")
+    private String ruleDescription;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getRoleId() {
+        return roleId;
+    }
+
+    public void setRoleId(String roleId) {
+        this.roleId = roleId;
+    }
+
+    public String getRoleName() {
+        return roleName;
+    }
+
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
+    }
+
+    public String getRule() {
+        return rule;
+    }
+
+    public void setRule(Rule rule) {
+        if (rule != null) {
+            this.rule = rule.getRuleString();
+        }
+    }
+
+    public String getRulePermission() {
+        return rulePermission;
+    }
+
+    public void setRulePermission(RolePermission.Permission rulePermission) {
+        if (rulePermission != null) {
+            this.rulePermission = rulePermission.name().toLowerCase();
+        }
+    }
+
+    public void setDescription(String description) {
+        this.ruleDescription = description;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4347776a/api/src/org/apache/cloudstack/api/response/RoleResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/RoleResponse.java b/api/src/org/apache/cloudstack/api/response/RoleResponse.java
new file mode 100644
index 0000000..fd4bf28
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/RoleResponse.java
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.response;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+import org.apache.cloudstack.acl.Role;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+@EntityReference(value = Role.class)
+public class RoleResponse extends BaseResponse {
+    @SerializedName(ApiConstants.ID)
+    @Param(description = "the ID of the role")
+    private String id;
+
+    @SerializedName(ApiConstants.NAME)
+    @Param(description = "the name of the role")
+    private String roleName;
+
+    @SerializedName(ApiConstants.TYPE)
+    @Param(description = "the type of the role")
+    private String roleType;
+
+    @SerializedName(ApiConstants.DESCRIPTION)
+    @Param(description = "the description of the role")
+    private String roleDescription;
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
+    }
+
+    public void setRoleType(RoleType roleType) {
+        if (roleType != null) {
+            this.roleType = roleType.name();
+        }
+    }
+
+    public void setDescription(String description) {
+        this.roleDescription = description;
+    }
+}


[26/50] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to 4817cb6

Posted by bh...@apache.org.
Merge pull request #1496 from shapeblue/kvm-ha

CLOUDSTACK-9350: KVM-HA- Fix CheckOnHost for Local storage- KVM-HA- Fix CheckOnHost for Local storage
 - Also skip HA on VMs that are using local storage

* pr/1496:
  CLOUDSTACK-9350: KVM-HA- Fix CheckOnHost for Local storage     - Also skip HA on VMs that are using local storage

Signed-off-by: Will Stevens <wi...@gmail.com>


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: fa3bce5a83bc17f82fd9dd4dbc1b6502e64ef799
Parents: 8a3fd10 3b89cbe
Author: Will Stevens <wi...@gmail.com>
Authored: Tue May 10 23:49:03 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Tue May 10 23:49:04 2016 -0400

----------------------------------------------------------------------
 .../kvm/src/com/cloud/ha/KVMInvestigator.java   |  24 +-
 pom.xml                                         |   1 +
 .../cloud/ha/HighAvailabilityManagerImpl.java   |   8 +
 .../ha/HighAvailabilityManagerImplTest.java     |   2 +
 test/integration/component/test_host_ha.py      | 516 +++++++++++++++++++
 test/integration/component/test_host_ha.sh      |  40 ++
 tools/marvin/marvin/lib/utils.py                |   5 +-
 7 files changed, 592 insertions(+), 4 deletions(-)
----------------------------------------------------------------------