cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [3/4] git commit: updated refs/heads/4.2 to 19bdef0
Date Fri, 19 Jul 2013 12:15:51 GMT
CLOUDSTACK-3452: Created security group for basic mode to allow SSH to vm

Signed-off-by: Prasanna Santhanam <tsp@apache.org>


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

Branch: refs/heads/4.2
Commit: 6a5f13adecf7c073be55ac3d2e11883e148a04e2
Parents: ea5d487
Author: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
Authored: Thu Jul 18 22:48:57 2013 -0400
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Fri Jul 19 17:45:38 2013 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/integration/lib/base.py | 35 ++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a5f13ad/tools/marvin/marvin/integration/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base.py b/tools/marvin/marvin/integration/lib/base.py
index 8b35127..13507bc 100755
--- a/tools/marvin/marvin/integration/lib/base.py
+++ b/tools/marvin/marvin/integration/lib/base.py
@@ -293,6 +293,41 @@ class VirtualMachine:
         if securitygroupids:
             cmd.securitygroupids = [str(sg_id) for sg_id in securitygroupids]
 
+        if mode.lower() == 'basic':
+            list_security_groups = SecurityGroup.list(
+                                                      apiclient,
+                                                      securitygroupname="basic_sec_grp"
+                                                      )
+
+            if not isinstance(list_security_groups, list):
+                basic_mode_security_group = SecurityGroup.create(
+                                                            apiclient,
+                                                            {"name":"basic_sec_grp"}
+                                                            )
+                sec_grp_services = {"protocol": "TCP",
+                                    "startport": 22,
+                                    "endport":22,
+                                    "cidrlist": "0.0.0.0/0"
+                                   }
+
+                #Authorize security group for above ingress rule
+                cmd_auth = authorizeSecurityGroupIngress.authorizeSecurityGroupIngressCmd()
+                cmd_auth.domainid = cmd.domainid
+                cmd_auth.account = cmd.account
+                cmd_auth.securitygroupid = basic_mode_security_group.id
+                cmd_auth.protocol = sec_grp_services["protocol"]
+                cmd_auth.startport = sec_grp_services["startport"]
+                cmd_auth.endport = sec_grp_services["endport"]
+                cmd_auth.cidrlist = sec_grp_services["cidrlist"]
+                apiclient.authorizeSecurityGroupIngress(cmd_auth)
+
+            else:
+                basic_mode_security_group = list_security_groups[0]
+
+            if isinstance(cmd.securitygroupids, list):
+                cmd.securitygroupids.append(basic_mode_security_group.id)
+            else:
+                cmd.securitygroupids = [basic_mode_security_group.id]
 
         if "affinitygroupnames" in services:
             cmd.affinitygroupnames  = services["affinitygroupnames"]


Mime
View raw message