You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pd...@apache.org on 2015/07/26 16:41:19 UTC

[1/6] git commit: updated refs/heads/master to 31b486d

Repository: cloudstack
Updated Branches:
  refs/heads/master ac9c2a224 -> 31b486d38


CLOUDSTACK-8648: Do not configure the ImageFormat Processor when fetching filesize

It will throw an exception and that's needed.

Also, make the log show about which file we are talking about

Signed-off-by: Wido den Hollander <wi...@widodh.nl>
Signed-off-by: Pierre-Luc Dion <pd...@apache.org>


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

Branch: refs/heads/master
Commit: 554f5f9fbbedaeb8c14519d423c042375002d976
Parents: ac9c2a2
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Fri Jul 17 15:16:35 2015 +0200
Committer: Pierre-Luc Dion <pd...@apache.org>
Committed: Sun Jul 26 10:25:05 2015 -0400

----------------------------------------------------------------------
 .../cloudstack/storage/resource/NfsSecondaryStorageResource.java  | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/554f5f9f/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
index a529b87..5c361ed 100644
--- a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
+++ b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
@@ -860,10 +860,9 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
                 return file.length();
             }
 
-            processor.configure("template processor", new HashMap<String, Object>());
             return processor.getVirtualSize(file);
         } catch (Exception e) {
-            s_logger.warn("Failed to get virtual size, returning file size instead:", e);
+            s_logger.warn("Failed to get virtual size of file " + file.getPath() + ", returning file size instead: ", e);
             return file.length();
         }
 


[4/6] git commit: updated refs/heads/master to 31b486d

Posted by pd...@apache.org.
BUG-ID: CLOUDSTACK-8483 - Private template not visible in project added new 'projectId' parameter in createTemplate command and based current user, account and projectid decide the owner of the template.

Signed-off-by: Pierre-Luc Dion <pd...@apache.org>


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

Branch: refs/heads/master
Commit: f8ef13c5e6fe833c923dbcda9d0e61381ded3de5
Parents: 9dbc99c
Author: Sudhansu <su...@citrix.com>
Authored: Fri Mar 13 17:48:47 2015 +0530
Committer: Pierre-Luc Dion <pd...@apache.org>
Committed: Sun Jul 26 10:27:48 2015 -0400

----------------------------------------------------------------------
 .../user/template/CreateTemplateCmd.java        | 50 ++++++++++++--------
 1 file changed, 31 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f8ef13c5/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
index 7be7e62..ae9205f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
@@ -20,6 +20,14 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.cloudstack.acl.SecurityChecker;
+import org.apache.cloudstack.api.response.GuestOSResponse;
+import org.apache.cloudstack.api.response.SnapshotResponse;
+import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
+
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.APICommand;
@@ -30,11 +38,6 @@ import org.apache.cloudstack.api.BaseAsyncCreateCmd;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ResponseObject.ResponseView;
 import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.GuestOSResponse;
-import org.apache.cloudstack.api.response.SnapshotResponse;
-import org.apache.cloudstack.api.response.TemplateResponse;
-import org.apache.cloudstack.api.response.UserVmResponse;
-import org.apache.cloudstack.api.response.VolumeResponse;
 import org.apache.cloudstack.context.CallContext;
 
 import com.cloud.event.EventTypes;
@@ -124,6 +127,9 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
                description = "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
     protected Boolean isDynamicallyScalable;
 
+    @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "create template for the project")
+    private Long projectId;
+
     // ///////////////////////////////////////////////////
     // ///////////////// Accessors ///////////////////////
     // ///////////////////////////////////////////////////
@@ -215,33 +221,39 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
         if (volumeId != null) {
             Volume volume = _entityMgr.findById(Volume.class, volumeId);
             if (volume != null) {
-                accountId = volume.getAccountId();
+                _accountService.checkAccess(CallContext.current().getCallingAccount(), SecurityChecker.AccessType.UseEntry, false, volume);
             } else {
                 throw new InvalidParameterValueException("Unable to find volume by id=" + volumeId);
             }
         } else {
             Snapshot snapshot = _entityMgr.findById(Snapshot.class, snapshotId);
             if (snapshot != null) {
-                accountId = snapshot.getAccountId();
+                _accountService.checkAccess(CallContext.current().getCallingAccount(), SecurityChecker.AccessType.UseEntry, false, snapshot);
             } else {
                 throw new InvalidParameterValueException("Unable to find snapshot by id=" + snapshotId);
             }
         }
 
-        Account account = _accountService.getAccount(accountId);
-        //Can create templates for enabled projects/accounts only
-        if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
-            Project project = _projectService.findByProjectAccountId(accountId);
-            if (project.getState() != Project.State.Active) {
-                PermissionDeniedException ex =
-                    new PermissionDeniedException("Can't add resources to the specified project id in state=" + project.getState() + " as it's no longer active");
-                ex.addProxyObject(project.getUuid(), "projectId");
+        if(projectId != null){
+            final Project project = _projectService.getProject(projectId);
+            if (project != null) {
+                if (project.getState() == Project.State.Active) {
+                    Account projectAccount= _accountService.getAccount(project.getProjectAccountId());
+                    _accountService.checkAccess(CallContext.current().getCallingAccount(), SecurityChecker.AccessType.UseEntry, false, projectAccount);
+                    return project.getProjectAccountId();
+                } else {
+                    final PermissionDeniedException ex =
+                            new PermissionDeniedException("Can't add resources to the project with specified projectId in state=" + project.getState() +
+                                    " as it's no longer active");
+                    ex.addProxyObject(project.getUuid(), "projectId");
+                    throw ex;
+                }
+            } else {
+                throw new InvalidParameterValueException("Unable to find project by id");
             }
-        } else if (account.getState() == Account.State.disabled) {
-            throw new PermissionDeniedException("The owner of template is disabled: " + account);
         }
 
-        return accountId;
+        return CallContext.current().getCallingAccount().getId();
     }
 
     @Override
@@ -267,7 +279,7 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
     public void create() throws ResourceAllocationException {
         VirtualMachineTemplate template = null;
         //TemplateOwner should be the caller https://issues.citrite.net/browse/CS-17530
-        template = _templateService.createPrivateTemplateRecord(this, CallContext.current().getCallingAccount());
+        template = _templateService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
         if (template != null) {
             setEntityId(template.getId());
             setEntityUuid(template.getUuid());


[5/6] git commit: updated refs/heads/master to 31b486d

Posted by pd...@apache.org.
CLOUDSTACK-8634: Made changes to test_security_group.py test suite to support EIP

Signed-off-by: Pierre-Luc Dion <pd...@apache.org>


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

Branch: refs/heads/master
Commit: 7f7026ace59d96e7d38270ec4a2fe1a7076d0e87
Parents: fd17e47
Author: sanjeev <sa...@apache.org>
Authored: Tue Jul 14 17:24:58 2015 +0530
Committer: Pierre-Luc Dion <pd...@apache.org>
Committed: Sun Jul 26 10:39:15 2015 -0400

----------------------------------------------------------------------
 .../component/test_security_groups.py           | 243 ++++++++++++-------
 1 file changed, 157 insertions(+), 86 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7f7026ac/test/integration/component/test_security_groups.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_security_groups.py b/test/integration/component/test_security_groups.py
index f132e3a..f1ac0b6 100755
--- a/test/integration/component/test_security_groups.py
+++ b/test/integration/component/test_security_groups.py
@@ -27,7 +27,8 @@ from marvin.lib.base import (Account,
                              VirtualMachine,
                              SecurityGroup,
                              Router,
-                             Host)
+                             Host,
+                             Network)
 from marvin.lib.common import (get_domain,
                                get_zone,
                                get_template,
@@ -528,6 +529,12 @@ class TestRevokeIngressRule(cloudstackTestCase):
 
         return
 
+    def revokeSGRule(self, sgid):
+        cmd = revokeSecurityGroupIngress.revokeSecurityGroupIngressCmd()
+        cmd.id = sgid
+        self.apiclient.revokeSecurityGroupIngress(cmd)
+        return
+
     @attr(tags=["sg", "eip", "advancedsg"])
     def test_01_revokeIngressRule(self):
         """Test revoke ingress rule
@@ -605,11 +612,21 @@ class TestRevokeIngressRule(cloudstackTestCase):
 
         self.debug("Revoking ingress rule for sec group ID: %s for ssh access"
                    % security_group.id)
-        # Revoke Security group to SSH to VM
-        security_group.revoke(
+        security_groups = SecurityGroup.list(
             self.apiclient,
-            id=ssh_rule["ruleid"]
+            account=self.account.name,
+            domainid=self.account.domainid,
+            listall=True
+        )
+        self.assertEqual(
+            validateList(security_groups)[0],
+            PASS,
+            "Security groups list validation failed"
         )
+        for sg in security_groups:
+            if not sg.ingressrule:
+                continue
+            self.revokeSGRule(sg.ingressrule[0].ruleid)
 
         # SSH Attempt to VM should fail
         with self.assertRaises(Exception):
@@ -617,7 +634,8 @@ class TestRevokeIngressRule(cloudstackTestCase):
             SshClient(self.virtual_machine.ssh_ip,
                       self.virtual_machine.ssh_port,
                       self.virtual_machine.username,
-                      self.virtual_machine.password
+                      self.virtual_machine.password,
+                      retries=5
                       )
         return
 
@@ -1490,32 +1508,45 @@ class TestIngressRule(cloudstackTestCase):
                 security_group.id,
                 self.account.name
             ))
-        result = security_group.revoke(
+        #skip revoke and ping tests in case of EIP/ELB zone
+        vm_res = VirtualMachine.list(
             self.apiclient,
-            id=icmp_rule["ruleid"]
+            id=self.virtual_machine.id
         )
-        self.debug("Revoke ingress rule result: %s" % result)
-        time.sleep(self.testdata["sleep"])
-        # User should not be able to ping VM
-        try:
-            self.debug("Trying to ping VM %s" % self.virtual_machine.ssh_ip)
-            if platform_type == 'windows':
-                result = subprocess.call(
-                    ['ping', '-n', '1', self.virtual_machine.ssh_ip])
-            else:
-                result = subprocess.call(
-                    ['ping', '-c 1', self.virtual_machine.ssh_ip])
-
-            self.debug("Ping result: %s" % result)
-            # if ping successful, then result should be 0
-            self.assertNotEqual(
-                result,
-                0,
-                "Check if ping is successful or not"
+        self.assertEqual(validateList(vm_res)[0], PASS, "invalid vm response")
+        vm_nw = Network.list(
+            self.apiclient,
+            id=vm_res[0].nic[0].networkid
+        )
+        self.assertEqual(validateList(vm_nw)[0], PASS, "invalid network response")
+        vm_nw_off = vm_nw[0].networkofferingname
+        if vm_nw_off != "DefaultSharedNetscalerEIPandELBNetworkOffering":
+            result = security_group.revoke(
+                self.apiclient,
+                id=icmp_rule["ruleid"]
             )
-        except Exception as e:
-            self.fail("Ping failed for ingress rule ID: %s, %s"
-                      % (icmp_rule["ruleid"], e))
+            self.debug("Revoke ingress rule result: %s" % result)
+            time.sleep(self.testdata["sleep"])
+            # User should not be able to ping VM
+            try:
+                self.debug("Trying to ping VM %s" % self.virtual_machine.ssh_ip)
+                if platform_type == 'windows':
+                    result = subprocess.call(
+                        ['ping', '-n', '1', self.virtual_machine.ssh_ip])
+                else:
+                    result = subprocess.call(
+                        ['ping', '-c 1', self.virtual_machine.ssh_ip])
+
+                self.debug("Ping result: %s" % result)
+                # if ping successful, then result should be 0
+                self.assertNotEqual(
+                    result,
+                    0,
+                    "Check if ping is successful or not"
+                )
+            except Exception as e:
+                self.fail("Ping failed for ingress rule ID: %s, %s"
+                          % (icmp_rule["ruleid"], e))
         return
 
     @attr(tags=["sg", "eip", "advancedsg"])
@@ -1754,6 +1785,12 @@ class TestIngressRuleSpecificIpSet(cloudstackTestCase):
             self.debug(response)
         return
 
+    def revokeSGRule(self, sgid):
+        cmd = revokeSecurityGroupIngress.revokeSecurityGroupIngressCmd()
+        cmd.id = sgid
+        self.apiclient.revokeSecurityGroupIngress(cmd)
+        return
+
     @attr(tags=["sg", "eip", "advancedsg"])
     def test_ingress_rules_specific_IP_set(self):
         """Test ingress rules for specific IP set
@@ -1803,18 +1840,20 @@ class TestIngressRuleSpecificIpSet(cloudstackTestCase):
             accountid=self.account.name,
             domainid=self.account.domainid,
             serviceofferingid=self.service_offering.id,
-            securitygroupids=[defaultSecurityGroup.id]
+            securitygroupids=[defaultSecurityGroup.id],
+            mode=self.testdata['mode']
         )
-
+        self.cleanup.append(virtual_machine_1)
         virtual_machine_2 = VirtualMachine.create(
             self.apiclient,
             self.testdata["virtual_machine"],
             accountid=self.account.name,
             domainid=self.account.domainid,
             serviceofferingid=self.service_offering.id,
-            securitygroupids=[defaultSecurityGroup.id]
+            securitygroupids=[defaultSecurityGroup.id],
+            mode=self.testdata['mode']
         )
-
+        self.cleanup.append(virtual_machine_2)
         try:
             SshClient(
                 virtual_machine_1.ssh_ip,
@@ -1823,9 +1862,10 @@ class TestIngressRuleSpecificIpSet(cloudstackTestCase):
                 virtual_machine_1.password
             )
         except Exception as e:
+            self.revokeSGRule(ingress_rule.ingressrule[0].ruleid)
             self.fail("SSH Access failed for %s: %s" %
                       (virtual_machine_1.ipaddress, e)
-                      )
+            )
 
         try:
             SshClient(
@@ -1835,42 +1875,66 @@ class TestIngressRuleSpecificIpSet(cloudstackTestCase):
                 virtual_machine_2.password
             )
         except Exception as e:
+            self.revokeSGRule(ingress_rule.ingressrule[0].ruleid)
             self.fail("SSH Access failed for %s: %s" %
                       (virtual_machine_2.ipaddress, e)
-                      )
-
-        sshClient = SshClient(
-               self.mgtSvrDetails["mgtSvrIp"],
-               22,
-               self.mgtSvrDetails["user"],
-               self.mgtSvrDetails["passwd"]
-        )
-
+            )
+        try:
+            sshClient = SshClient(
+                self.mgtSvrDetails["mgtSvrIp"],
+                22,
+                self.mgtSvrDetails["user"],
+                self.mgtSvrDetails["passwd"]
+            )
+        except Exception as e:
+            self.revokeSGRule(ingress_rule.ingressrule[0].ruleid)
+            self.fail("SSH Access failed for %s: %s" %
+                      (self.mgtSvrDetails["mgtSvrIp"], e)
+            )
         response = sshClient.execute("ssh %s@%s -v" %
-                    (virtual_machine_1.username,
-                        virtual_machine_1.ssh_ip))
+                                     (virtual_machine_1.username,
+                                      virtual_machine_1.ssh_ip))
         self.debug("Response is :%s" % response)
 
         self.assertTrue("connection established" in str(response).lower(),
-                    "SSH to VM at %s failed from external machine ip %s other than test machine" %
-                    (virtual_machine_1.ssh_ip,
-                        self.mgtSvrDetails["mgtSvrIp"]))
+                        "SSH to VM at %s failed from external machine ip %s other than test machine" %
+                        (virtual_machine_1.ssh_ip,
+                         self.mgtSvrDetails["mgtSvrIp"]))
 
         response = sshClient.execute("ssh %s@%s -v" %
-                    (virtual_machine_2.username,
-                        virtual_machine_2.ssh_ip))
+                                     (virtual_machine_2.username,
+                                      virtual_machine_2.ssh_ip))
         self.debug("Response is :%s" % response)
 
         self.assertTrue("connection established" in str(response).lower(),
-                    "SSH to VM at %s failed from external machine ip %s other than test machine" %
-                    (virtual_machine_2.ssh_ip,
-                        self.mgtSvrDetails["mgtSvrIp"]))
-
-
-        cmd = revokeSecurityGroupIngress.revokeSecurityGroupIngressCmd()
-        cmd.id = ingress_rule.ingressrule[0].ruleid
-        self.apiclient.revokeSecurityGroupIngress(cmd)
-
+                        "SSH to VM at %s failed from external machine ip %s other than test machine" %
+                        (virtual_machine_2.ssh_ip,
+                         self.mgtSvrDetails["mgtSvrIp"]))
+        virtual_machine_3 = VirtualMachine.create(
+            self.apiclient,
+            self.testdata["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            securitygroupids=[defaultSecurityGroup.id],
+            mode=self.testdata['mode']
+        )
+        self.cleanup.append(virtual_machine_3)
+        security_groups = SecurityGroup.list(
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            listall=True
+        )
+        self.assertEqual(
+            validateList(security_groups)[0],
+            PASS,
+            "Security groups list validation failed"
+        )
+        for sg in security_groups:
+            if not sg.ingressrule:
+                continue
+            self.revokeSGRule(sg.ingressrule[0].ruleid)
         localMachineIpAddress = self.getLocalMachineIpAddress()
         cidr = localMachineIpAddress + "/32"
 
@@ -1882,16 +1946,6 @@ class TestIngressRuleSpecificIpSet(cloudstackTestCase):
         cmd.endport = 22
         cmd.cidrlist = cidr
         ingress_rule = self.apiclient.authorizeSecurityGroupIngress(cmd)
-
-        virtual_machine_3 = VirtualMachine.create(
-            self.apiclient,
-            self.testdata["virtual_machine"],
-            accountid=self.account.name,
-            domainid=self.account.domainid,
-            serviceofferingid=self.service_offering.id,
-            securitygroupids=[defaultSecurityGroup.id]
-        )
-
         if self.testdata["configurableData"]["setHostConfigurationForIngressRule"]:
             self.setHostConfiguration()
             time.sleep(180)
@@ -1905,28 +1959,28 @@ class TestIngressRuleSpecificIpSet(cloudstackTestCase):
                 virtual_machine_3.ssh_port,
                 virtual_machine_3.username,
                 virtual_machine_3.password
-        )
+            )
         except Exception as e:
             self.fail("SSH Access failed for %s: %s" %
                       (virtual_machine_3.ssh_ip, e)
-                      )
+            )
 
         sshClient = SshClient(
-               self.mgtSvrDetails["mgtSvrIp"],
-               22,
-               self.mgtSvrDetails["user"],
-               self.mgtSvrDetails["passwd"]
+            self.mgtSvrDetails["mgtSvrIp"],
+            22,
+            self.mgtSvrDetails["user"],
+            self.mgtSvrDetails["passwd"]
         )
 
         response = sshClient.execute("ssh %s@%s -v" %
-                    (virtual_machine_3.username,
-                        virtual_machine_3.ssh_ip))
+                                     (virtual_machine_3.username,
+                                      virtual_machine_3.ssh_ip))
         self.debug("Response is :%s" % response)
 
         self.assertFalse("connection established" in str(response).lower(),
-                    "SSH to VM at %s succeeded from external machine ip %s other than test machine" %
-                    (virtual_machine_3.ssh_ip,
-                        self.mgtSvrDetails["mgtSvrIp"]))
+                         "SSH to VM at %s succeeded from external machine ip %s other than test machine" %
+                         (virtual_machine_3.ssh_ip,
+                          self.mgtSvrDetails["mgtSvrIp"]))
         return
 
     @attr(tags=["sg", "eip", "advancedsg"])
@@ -1978,18 +2032,20 @@ class TestIngressRuleSpecificIpSet(cloudstackTestCase):
             accountid=self.account.name,
             domainid=self.account.domainid,
             serviceofferingid=self.service_offering.id,
-            securitygroupids=[defaultSecurityGroup.id]
+            securitygroupids=[defaultSecurityGroup.id],
+            mode=self.testdata['mode']
         )
-
+        self.cleanup.append(virtual_machine_1)
         virtual_machine_2 = VirtualMachine.create(
             self.apiclient,
             self.testdata["virtual_machine"],
             accountid=self.account.name,
             domainid=self.account.domainid,
             serviceofferingid=self.service_offering.id,
-            securitygroupids=[defaultSecurityGroup.id]
+            securitygroupids=[defaultSecurityGroup.id],
+            mode=self.testdata['mode']
         )
-
+        self.cleanup.append(virtual_machine_2)
         try:
             SshClient(
                 virtual_machine_1.ssh_ip,
@@ -2066,9 +2122,10 @@ class TestIngressRuleSpecificIpSet(cloudstackTestCase):
             accountid=self.account.name,
             domainid=self.account.domainid,
             serviceofferingid=self.service_offering.id,
-            securitygroupids=[security_group.id]
+            securitygroupids=[security_group.id],
+            mode=self.testdata['mode']
         )
-
+        self.cleanup.append(virtual_machine_3)
         if self.testdata["configurableData"]["setHostConfigurationForIngressRule"]:
             self.setHostConfiguration()
             time.sleep(180)
@@ -2087,7 +2144,21 @@ class TestIngressRuleSpecificIpSet(cloudstackTestCase):
             self.fail("SSH Access failed for %s: %s" %
                       (virtual_machine_3.ssh_ip, e)
                       )
-
+        security_groups = SecurityGroup.list(
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            listall=True
+        )
+        self.assertEqual(
+            validateList(security_groups)[0],
+            PASS,
+            "Security groups list validation failed"
+        )
+        for sg in security_groups:
+            if sg.id == security_group.id or not sg.ingressrule:
+                continue
+            self.revokeSGRule(sg.ingressrule[0].ruleid)
         sshClient = SshClient(
                self.mgtSvrDetails["mgtSvrIp"],
                22,


[3/6] git commit: updated refs/heads/master to 31b486d

Posted by pd...@apache.org.
BUG-ID: CLOUDSTACK-8483 - Private template not visible in project added new 'projectId' parameter in createTemplate command and based current user, account and projectid decide the owner of the template.

Signed-off-by: Pierre-Luc Dion <pd...@apache.org>


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

Branch: refs/heads/master
Commit: fd17e47e152f161d4d5a66b102dc8832c8858607
Parents: f8ef13c
Author: Sudhansu <su...@citrix.com>
Authored: Fri Mar 13 17:48:47 2015 +0530
Committer: Pierre-Luc Dion <pd...@apache.org>
Committed: Sun Jul 26 10:27:48 2015 -0400

----------------------------------------------------------------------
 .../api/command/user/template/CreateTemplateCmd.java      | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd17e47e/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
index ae9205f..c8d6ce3 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
@@ -217,18 +217,18 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
     public long getEntityOwnerId() {
         Long volumeId = getVolumeId();
         Long snapshotId = getSnapshotId();
-        Long accountId = null;
+        Account callingAccount = CallContext.current().getCallingAccount();
         if (volumeId != null) {
             Volume volume = _entityMgr.findById(Volume.class, volumeId);
             if (volume != null) {
-                _accountService.checkAccess(CallContext.current().getCallingAccount(), SecurityChecker.AccessType.UseEntry, false, volume);
+                _accountService.checkAccess(callingAccount, SecurityChecker.AccessType.UseEntry, false, volume);
             } else {
                 throw new InvalidParameterValueException("Unable to find volume by id=" + volumeId);
             }
         } else {
             Snapshot snapshot = _entityMgr.findById(Snapshot.class, snapshotId);
             if (snapshot != null) {
-                _accountService.checkAccess(CallContext.current().getCallingAccount(), SecurityChecker.AccessType.UseEntry, false, snapshot);
+                _accountService.checkAccess(callingAccount, SecurityChecker.AccessType.UseEntry, false, snapshot);
             } else {
                 throw new InvalidParameterValueException("Unable to find snapshot by id=" + snapshotId);
             }
@@ -239,7 +239,7 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
             if (project != null) {
                 if (project.getState() == Project.State.Active) {
                     Account projectAccount= _accountService.getAccount(project.getProjectAccountId());
-                    _accountService.checkAccess(CallContext.current().getCallingAccount(), SecurityChecker.AccessType.UseEntry, false, projectAccount);
+                    _accountService.checkAccess(callingAccount, SecurityChecker.AccessType.UseEntry, false, projectAccount);
                     return project.getProjectAccountId();
                 } else {
                     final PermissionDeniedException ex =
@@ -253,7 +253,7 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
             }
         }
 
-        return CallContext.current().getCallingAccount().getId();
+        return callingAccount.getId();
     }
 
     @Override


[2/6] git commit: updated refs/heads/master to 31b486d

Posted by pd...@apache.org.
CLOUDSTACK-8648: Pass the proper storage layer when configuring

Signed-off-by: Pierre-Luc Dion <pd...@apache.org>


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

Branch: refs/heads/master
Commit: 9dbc99c6083ac833045713403f794bf3506065b1
Parents: 554f5f9
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Thu Jul 23 23:39:02 2015 +0200
Committer: Pierre-Luc Dion <pd...@apache.org>
Committed: Sun Jul 26 10:25:06 2015 -0400

----------------------------------------------------------------------
 .../cloudstack/storage/resource/NfsSecondaryStorageResource.java  | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9dbc99c6/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
index 5c361ed..be59691 100644
--- a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
+++ b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
@@ -860,6 +860,9 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
                 return file.length();
             }
 
+            Map<String, Object> params = new HashMap<String, Object>();
+            params.put(StorageLayer.InstanceConfigKey, _storage);
+            processor.configure("template processor", params);
             return processor.getVirtualSize(file);
         } catch (Exception e) {
             s_logger.warn("Failed to get virtual size of file " + file.getPath() + ", returning file size instead: ", e);


[6/6] git commit: updated refs/heads/master to 31b486d

Posted by pd...@apache.org.
dummy commit to close PR: close #620, close #606, close #334, close #586


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

Branch: refs/heads/master
Commit: 31b486d38aa300dc39e50ca3294d6d6fa21a08f5
Parents: 7f7026a
Author: Pierre-Luc Dion <pd...@apache.org>
Authored: Sun Jul 26 10:40:50 2015 -0400
Committer: Pierre-Luc Dion <pd...@apache.org>
Committed: Sun Jul 26 10:40:50 2015 -0400

----------------------------------------------------------------------
 CONTRIBUTING.md | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/31b486d3/CONTRIBUTING.md
----------------------------------------------------------------------
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 95d7a85..c4ad197 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -105,4 +105,3 @@ $ git checkout master
 $ git branch -D feature_x
 $ git push origin :feature_x
 ```
-