Skip to content

Commit ead9a34

Browse files
authored
Disabling managing firewall - cloudstack-setup-management (#4239)
* Adding message to ensure ports are open * Removing configuring iptables * Fixing merge conflict
1 parent c06e7de commit ead9a34

File tree

3 files changed

+24
-52
lines changed

3 files changed

+24
-52
lines changed

client/bindir/cloud-setup-management.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,14 @@ if __name__ == '__main__':
4545
try:
4646
syscfg = sysConfigFactory.getSysConfigFactory(glbEnv)
4747
except UnknownSystemException:
48-
print(("Error: CloudStack failed to detect your "
49-
"operating system. Exiting."), file=sys.stderr)
48+
print("Error: CloudStack failed to detect your "
49+
"operating system. Exiting.", file=sys.stderr)
5050
sys.exit(1)
5151
try:
5252
syscfg.registerService(cloudManagementConfig)
5353
syscfg.config()
5454
print("CloudStack Management Server setup is Done!")
55+
print("Please ensure the following ports are open for the management server to function properly : 8080 8250 8443 9090")
5556
except (CloudRuntimeException, CloudInternalException) as e:
5657
print(e)
5758
print("Try to restore your system:")

python/lib/cloudutils/serviceConfig.py

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
# to you under the Apache License, Version 2.0 (the
66
# "License"); you may not use this file except in compliance
77
# with the License. You may obtain a copy of the License at
8-
#
8+
#
99
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
10+
#
1111
# Unless required by applicable law or agreed to in writing,
1212
# software distributed under the License is distributed on an
1313
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -775,32 +775,3 @@ def config(self):
775775

776776
def restore(self):
777777
return True
778-
779-
class firewallConfigServer(firewallConfigBase):
780-
def __init__(self, syscfg):
781-
super(firewallConfigServer, self).__init__(syscfg)
782-
#9090 is used for cluster management server
783-
if self.syscfg.env.svrMode == "myCloud":
784-
self.ports = "443 8080 8250 8443 9090".split()
785-
else:
786-
self.ports = "8080 8250 9090".split()
787-
788-
class ubuntuFirewallConfigServer(firewallConfigServer):
789-
def allowPort(self, port):
790-
status = False
791-
try:
792-
status = bash("iptables-save|grep INPUT|grep -w %s"%port).isSuccess()
793-
except:
794-
pass
795-
796-
if not status:
797-
bash("ufw allow %s/tcp"%port)
798-
799-
def config(self):
800-
try:
801-
for port in self.ports:
802-
self.allowPort(port)
803-
804-
return True
805-
except:
806-
raise

python/lib/cloudutils/syscfg.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
# to you under the Apache License, Version 2.0 (the
66
# "License"); you may not use this file except in compliance
77
# with the License. You may obtain a copy of the License at
8-
#
8+
#
99
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
10+
#
1111
# Unless required by applicable law or agreed to in writing,
1212
# software distributed under the License is distributed on an
1313
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -29,7 +29,7 @@ def getSysConfigFactory(glbEnv):
2929
return sysConfigDbFactory.getDb(glbEnv)
3030
else:
3131
raise CloudInternalException("Need to specify which mode are u running: Agent/Server/Db")
32-
32+
3333
class sysConfigAgentFactory:
3434
@staticmethod
3535
def getAgent(glbEnv):
@@ -61,7 +61,7 @@ def getServer(glbEnv):
6161
else:
6262
print("Can't find the distribution version")
6363
return sysConfig()
64-
64+
6565
class sysConfigDbFactory:
6666
@staticmethod
6767
def getDb(glbEnv):
@@ -71,39 +71,39 @@ class sysConfig(object):
7171
def __init__(self, env):
7272
self.env = env
7373
self.services = []
74-
74+
7575
def registerService(self, service):
7676
self.services.append(service(self))
77-
77+
7878
def config(self):
7979
if not self.check():
8080
return False
8181

8282
for service in self.services:
8383
if not service.configration():
8484
raise CloudInternalException("Configuration failed for service %s" % service.serviceName)
85-
85+
8686
def restore(self):
8787
for service in self.services:
8888
service.backup()
89-
89+
9090
def check(self):
9191
return True
92-
92+
9393
class sysConfigAgent(sysConfig):
9494
def __init__(self, env):
9595
super(sysConfigAgent, self).__init__(env)
9696

9797
def check(self):
9898
if self.env.debug:
9999
return True
100-
100+
101101
if self.env.agentMode == "myCloud":
102102
if self.env.distribution.getVersion() != "Ubuntu":
103103
raise CloudInternalException("Need to run myCloud agent on an Ubuntu machine\n")
104104
elif self.env.distribution.getArch() != "x86_64":
105105
raise CloudInternalException("Need to run myCloud agent on an 64bit machine\n")
106-
#check free disk space on the local disk
106+
#check free disk space on the local disk
107107
if os.path.exists("/var/lib/libvirt/images"):
108108
size = -1
109109
try:
@@ -127,18 +127,18 @@ def check(self):
127127

128128
if os.geteuid() != 0:
129129
raise CloudInternalException("Need to execute with root permission\n")
130-
130+
131131
hostname = bash("hostname -f")
132132
if not hostname.isSuccess():
133133
raise CloudInternalException("Checking hostname ... [Failed]\nPlease edit /etc/hosts, add a Fully Qualified Domain Name as your hostname\n")
134134

135135
kvmEnabled = self.svo.isKVMEnabled()
136136
if not kvmEnabled:
137137
raise CloudInternalException("Checking KVM...[Failed]\nPlease enable KVM on this machine\n")
138-
138+
139139
return True
140140

141-
141+
142142
class sysConfigAgentRedhatBase(sysConfigAgent):
143143
def __init__(self, env):
144144
self.svo = serviceOpsRedhat()
@@ -188,7 +188,7 @@ def __init__(self, glbEnv):
188188
libvirtConfigRedhat(self),
189189
firewallConfigAgent(self),
190190
cloudAgentConfig(self)]
191-
191+
192192
#it covers RHEL7
193193
class sysConfigRedhat7(sysConfigAgentRedhat7Base):
194194
def __init__(self, glbEnv):
@@ -219,15 +219,15 @@ def check(self):
219219
if not hostname.isSuccess():
220220
raise CloudInternalException("Checking hostname ... [Failed]\nPlease edit /etc/hosts, add a Fully Qualified Domain Name as your hostname\n")
221221
return True
222-
222+
223223
class sysConfigServerRedhat(sysConfigServer):
224224
def __init__(self, glbEnv):
225225
super(sysConfigServerRedhat, self).__init__(glbEnv)
226226
self.svo = serviceOpsRedhat()
227-
self.services = [firewallConfigServer(self)]
228-
227+
self.services = []
228+
229229
class sysConfigServerUbuntu(sysConfigServer):
230230
def __init__(self, glbEnv):
231231
super(sysConfigServerUbuntu, self).__init__(glbEnv)
232232
self.svo = serviceOpsUbuntu()
233-
self.services = [ubuntuFirewallConfigServer(self)]
233+
self.services = []

0 commit comments

Comments
 (0)