MCPcopy Create free account
hub / github.com/apache/cloudstack / check

Method check

python/lib/cloudutils/syscfg.py:99–141  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

97 super(sysConfigAgent, self).__init__(env)
98
99 def check(self):
100 if self.env.debug:
101 return True
102
103 if self.env.agentMode == "myCloud":
104 if self.env.distribution.getVersion() != "Ubuntu":
105 raise CloudInternalException("Need to run myCloud agent on an Ubuntu machine\n")
106 elif self.env.distribution.getArch() != "x86_64":
107 raise CloudInternalException("Need to run myCloud agent on an 64bit machine\n")
108 #check free disk space on the local disk
109 if os.path.exists("/var/lib/libvirt/images"):
110 size = -1
111 try:
112 size = int(bash("df -P /var/lib/libvirt/images | tail -1 |awk '{print $4}'").getStdout())
113 except:
114 pass
115
116 if size != -1 and size < (30 * 1024 * 1024):
117 raise CloudRuntimeException("Need at least 30G free disk space under /var/lib/libvirt/images")
118
119 #check memory
120 mem = -1
121 try:
122 mem = int(bash("free -g|grep Mem|awk '{print $2}'").getStdout())
123 except:
124 pass
125
126 if mem != -1 and mem < 1:
127 raise CloudRuntimeException("Need at least 1G memory")
128
129
130 if os.geteuid() != 0:
131 raise CloudInternalException("Need to execute with root permission\n")
132
133 hostname = bash("hostname -f")
134 if not hostname.isSuccess():
135 raise CloudInternalException("Checking hostname ... [Failed]\nPlease edit /etc/hosts, add a Fully Qualified Domain Name as your hostname\n")
136
137 kvmEnabled = self.svo.isKVMEnabled()
138 if not kvmEnabled:
139 raise CloudInternalException("Checking KVM...[Failed]\nPlease enable KVM on this machine\n")
140
141 return True
142
143
144class sysConfigAgentRedhatBase(sysConfigAgent):

Callers

nothing calls this directly

Calls 10

intFunction · 0.85
bashClass · 0.85
getVersionMethod · 0.65
getArchMethod · 0.65
existsMethod · 0.65
isSuccessMethod · 0.65
getStdoutMethod · 0.45
isKVMEnabledMethod · 0.45

Tested by

no test coverage detected