Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Open Source > Server Development > Cloud Computing &&
Donate
Please sign in before you donate.
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
4 Star 16 Fork 10

Apache/cloudstack

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
main
Branches (675)
Tags (351)
main
4.22
dependabot/github_actions/github-actions-dependencies-9d45b56163
healthcheck-main
4.20
update-dbtype-nwrate
fix-netoff-isolatedNetForm-phytags
dependabot/maven/io.opentelemetry-opentelemetry-api-1.62.0
minor-improvements-clvm
dependabot/github_actions/github-actions-dependencies-2217aebe03
dependabot/maven/plugins/storage/volume/ontap/com.fasterxml.jackson.core-jackson-databind-2.22.0
healthcheck-4.22
dependabot/npm_and_yarn/ui/dompurify-3.4.11
dependabot/github_actions/github-actions-dependencies-8c5b17a95b
DaanHoogland-patch-7
cks-offline-upgrade
fix-vnf-net-select-non-deployasis
dependabot/npm_and_yarn/ui/babel/core-7.29.6
dependabot/npm_and_yarn/ui/multi-03dd045568
dependabot/npm_and_yarn/ui/dompurify-3.4.9
4.22.1.0
4.22.0.1
4.20.3.0
4.22.0.0
4.20.2.0
4.21.0.0
4.20.1.0
4.19.3.0
4.19.2.0
4.20.0.0
4.19.1.3
4.18.2.5
4.19.1.2
4.18.2.4
4.18-wei-pr8846
4.19.1.1
4.18.2.3
4.18.2.2
4.19.1.0
4.19.0.2
main
Branches (675)
Tags (351)
main
4.22
dependabot/github_actions/github-actions-dependencies-9d45b56163
healthcheck-main
4.20
update-dbtype-nwrate
fix-netoff-isolatedNetForm-phytags
dependabot/maven/io.opentelemetry-opentelemetry-api-1.62.0
minor-improvements-clvm
dependabot/github_actions/github-actions-dependencies-2217aebe03
dependabot/maven/plugins/storage/volume/ontap/com.fasterxml.jackson.core-jackson-databind-2.22.0
healthcheck-4.22
dependabot/npm_and_yarn/ui/dompurify-3.4.11
dependabot/github_actions/github-actions-dependencies-8c5b17a95b
DaanHoogland-patch-7
cks-offline-upgrade
fix-vnf-net-select-non-deployasis
dependabot/npm_and_yarn/ui/babel/core-7.29.6
dependabot/npm_and_yarn/ui/multi-03dd045568
dependabot/npm_and_yarn/ui/dompurify-3.4.9
4.22.1.0
4.22.0.1
4.20.3.0
4.22.0.0
4.20.2.0
4.21.0.0
4.20.1.0
4.19.3.0
4.19.2.0
4.20.0.0
4.19.1.3
4.18.2.5
4.19.1.2
4.18.2.4
4.18-wei-pr8846
4.19.1.1
4.18.2.3
4.18.2.2
4.19.1.0
4.19.0.2
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
main
Branches (675)
Tags (351)
main
4.22
dependabot/github_actions/github-actions-dependencies-9d45b56163
healthcheck-main
4.20
update-dbtype-nwrate
fix-netoff-isolatedNetForm-phytags
dependabot/maven/io.opentelemetry-opentelemetry-api-1.62.0
minor-improvements-clvm
dependabot/github_actions/github-actions-dependencies-2217aebe03
dependabot/maven/plugins/storage/volume/ontap/com.fasterxml.jackson.core-jackson-databind-2.22.0
healthcheck-4.22
dependabot/npm_and_yarn/ui/dompurify-3.4.11
dependabot/github_actions/github-actions-dependencies-8c5b17a95b
DaanHoogland-patch-7
cks-offline-upgrade
fix-vnf-net-select-non-deployasis
dependabot/npm_and_yarn/ui/babel/core-7.29.6
dependabot/npm_and_yarn/ui/multi-03dd045568
dependabot/npm_and_yarn/ui/dompurify-3.4.9
4.22.1.0
4.22.0.1
4.20.3.0
4.22.0.0
4.20.2.0
4.21.0.0
4.20.1.0
4.19.3.0
4.19.2.0
4.20.0.0
4.19.1.3
4.18.2.5
4.19.1.2
4.18.2.4
4.18-wei-pr8846
4.19.1.1
4.18.2.3
4.18.2.2
4.19.1.0
4.19.0.2
cloudstack
/
python
/
lib
/
cloudutils
/
utilities.py
cloudstack
/
python
/
lib
/
cloudutils
/
utilities.py
utilities.py 10.12 KB
Copy Edit Raw Blame History
Harikrishna Patnala authored 2025年10月16日 16:09 +08:00 . Merge branch '4.20'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
# 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 .cloudException import CloudRuntimeException, formatExceptionInfo
import logging
from subprocess import PIPE, Popen
from signal import alarm, signal, SIGALRM, SIGKILL
import sys
import os
class bash:
def __init__(self, args, timeout=600):
self.args = args
logging.debug("execute:%s"%args)
self.timeout = timeout
self.process = None
self.success = False
self.run()
def run(self):
class Alarm(Exception):
pass
def alarm_handler(signum, frame):
raise Alarm
try:
self.process = Popen(self.args, shell=True, stdout=PIPE, stderr=PIPE)
if self.timeout != -1:
signal(SIGALRM, alarm_handler)
alarm(self.timeout)
try:
self.stdout, self.stderr = self.process.communicate()
if self.timeout != -1:
alarm(0)
except Alarm:
os.kill(self.process.pid, SIGKILL)
raise CloudRuntimeException("Timeout during command execution")
self.success = self.process.returncode == 0
except:
raise CloudRuntimeException(formatExceptionInfo())
if not self.success:
logging.debug("Failed to execute:" + self.getErrMsg())
def isSuccess(self):
return self.success
def getStdout(self):
return self.stdout.decode('utf-8').strip('\n')
def getLines(self):
return self.stdout.decode('utf-8').strip('\n').split('\n')
def getStderr(self):
return self.stderr.decode('utf-8').strip('\n')
def getErrMsg(self):
if self.isSuccess():
return ""
if self.getStderr() is None or self.getStderr() == "":
return self.getStdout()
else:
return self.getStderr()
def initLoging(logFile=None):
try:
if logFile is None:
logging.basicConfig(level=logging.DEBUG)
else:
logging.basicConfig(filename=logFile, level=logging.DEBUG)
except:
logging.basicConfig(level=logging.DEBUG)
def writeProgressBar(msg, result):
output = "[%-6s]\n"%"Failed"
if msg is not None:
output = "%-30s"%msg
elif result is True:
output = "[%-2s]\n"%"OK"
elif result is False:
output = "[%-6s]\n"%"Failed"
sys.stdout.write(output)
sys.stdout.flush()
class UnknownSystemException(Exception):
"This Exception is raised if the current operating environment is unknown"
pass
class Distribution:
def __init__(self):
self.distro = "Unknown"
self.release = "Unknown"
if os.path.exists("/etc/fedora-release"):
self.distro = "Fedora"
elif os.path.exists("/etc/redhat-release"):
version = open("/etc/redhat-release").readline()
if (version.find("Red Hat Enterprise Linux Server release 6") != -1 or version.find("Scientific Linux release 6") != -1 or
version.find("CentOS Linux release 6") != -1 or version.find("CentOS release 6.") != -1):
self.distro = "RHEL6"
elif (version.find("Red Hat Enterprise Linux Server release 7") != -1 or version.find("Scientific Linux release 7") != -1 or
version.find("CentOS Linux release 7") != -1 or version.find("CentOS release 7.") != -1):
self.distro = "RHEL7"
elif (version.find("Red Hat Enterprise Linux Server release 8") != -1 or version.find("Scientific Linux release 8") != -1 or
version.find("CentOS Linux release 8") != -1 or version.find("CentOS release 8.") != -1 or
version.find("Linux release 8") != -1):
self.distro = "RHEL8"
elif (version.find("Red Hat Enterprise Linux Server release 9") != -1 or version.find("Scientific Linux release 9") != -1 or
version.find("Red Hat Enterprise Linux release 9") != -1 or version.find("Linux release 9.") != -1 or
version.find("Linux release 9") != -1):
self.distro = "RHEL9"
elif (version.find("Red Hat Enterprise Linux Server release 10") != -1 or version.find("Scientific Linux release 10") != -1 or
version.find("Red Hat Enterprise Linux release 10") != -1 or version.find("Linux release 10.") != -1 or
version.find("Linux release 10") != -1):
self.distro = "RHEL10"
elif version.find("CentOS") != -1:
self.distro = "CentOS"
else:
self.distro = "RHEL5"
elif os.path.exists("/etc/legal") and "Ubuntu" in open("/etc/legal").read(-1):
self.distro = "Ubuntu"
kernel = bash("uname -r").getStdout()
if kernel.find("2.6.32") != -1:
self.release = "10.04"
self.arch = bash("uname -m").getStdout()
elif os.path.exists("/usr/bin/lsb_release"):
o = bash("/usr/bin/lsb_release -i")
distributor = o.getStdout().split(":\t")[1]
if "Debian" in distributor:
# This obviously needs a rewrite at some point
self.distro = "Ubuntu"
else:
raise UnknownSystemException(distributor)
elif os.path.exists("/etc/os-release"):
version = open("/etc/os-release").readline()
distributor = version.split("=")[1].replace('"', '').strip()
if "SUSE" in distributor or "SLES" in distributor:
self.distro = "SUSE"
else:
raise UnknownSystemException(distributor)
else:
raise UnknownSystemException
def getVersion(self):
return self.distro
def getRelease(self):
return self.release
def getArch(self):
return self.arch
class serviceOps:
pass
class serviceOpsRedhat(serviceOps):
def isServiceRunning(self, servicename):
try:
o = bash("service " + servicename + " status")
if "running" in o.getStdout() or "start" in o.getStdout() or "Running" in o.getStdout():
return True
else:
return False
except:
return False
def stopService(self, servicename,force=False):
if self.isServiceRunning(servicename) or force:
return bash("service " + servicename +" stop").isSuccess()
return True
def disableService(self, servicename):
result = self.stopService(servicename)
bash("chkconfig --del " + servicename)
return result
def startService(self, servicename,force=False):
if not self.isServiceRunning(servicename) or force:
return bash("service " + servicename + " start").isSuccess()
return True
def enableService(self, servicename,forcestart=False):
bash("chkconfig --level 2345 " + servicename + " on")
return self.startService(servicename,force=forcestart)
def isKVMEnabled(self):
if os.path.exists("/dev/kvm"):
return True
else:
return False
class serviceOpsUbuntu(serviceOps):
def isServiceRunning(self, servicename):
try:
o = bash("sudo /usr/sbin/service " + servicename + " status")
if "not running" in o.getStdout():
return False
else:
return True
except:
return False
def stopService(self, servicename,force=True):
if self.isServiceRunning(servicename) or force:
return bash("sudo /usr/sbin/service " + servicename +" stop").isSuccess()
def disableService(self, servicename):
result = self.stopService(servicename)
bash("sudo update-rc.d -f " + servicename + " remove")
return result
def startService(self, servicename,force=True):
if not self.isServiceRunning(servicename) or force:
return bash("sudo /usr/sbin/service " + servicename + " start").isSuccess()
def enableService(self, servicename,forcestart=True):
bash("sudo update-rc.d -f " + servicename + " remove")
bash("sudo update-rc.d -f " + servicename + " defaults")
return self.startService(servicename,force=forcestart)
def isKVMEnabled(self):
return bash("kvm-ok").isSuccess()
class serviceOpsRedhat7Later(serviceOps):
def isServiceRunning(self, servicename):
try:
o = bash("systemctl is-active " + servicename)
textout = o.getStdout()
return "inactive" not in textout and "failed" not in textout
except:
return False
def stopService(self, servicename,force=False):
if self.isServiceRunning(servicename) or force:
return bash("systemctl stop " + servicename).isSuccess()
return True
def disableService(self, servicename):
result = self.stopService(servicename)
bash("systemctl disable " + servicename)
return result
def startService(self, servicename,force=False):
if not self.isServiceRunning(servicename) or force:
return bash("systemctl start " + servicename).isSuccess()
return True
def enableService(self, servicename,forcestart=False):
bash("systemctl enable " + servicename)
return self.startService(servicename,force=forcestart)
def isKVMEnabled(self):
if os.path.exists("/dev/kvm"):
return True
else:
return False
class serviceOpsSUSE(serviceOpsRedhat7Later):
pass
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

CloudStack是一个开源云计算解决方案
Cancel

Releases

No release

The Open Source Evaluation Index is derived from the OSS Compass evaluation system, which evaluates projects around the following three dimensions

1. Open source ecosystem

  • Productivity: To evaluate the ability of open-source projects to output software artifacts and open-source value.
  • Innovation: Used to evaluate the degree of diversity of open source software and its ecosystem.
  • Robustness: Used to evaluate the ability of open-source projects to resist internal and external interference and self recover in the face of changing development environments.

2. Collaboration, People, Software

  • Collaboration: represents the degree and depth of collaboration in open source development behavior.
  • Observe the influence of core personnel in open source projects, and examine the evaluations of users and developers on open source projects from a third-party perspective.
  • Software: Evaluate the value of products exported from open-source projects and their ultimate destination. It is also a concrete manifestation of "open source software", one of the oldest mainstream directions in open source evaluation.

3. Evaluation model

    Based on the dimensions of "open source ecosystem" and "collaboration, people, and software", identify quantifiable indicators directly or indirectly related to this goal, quantitatively evaluate the health and ecology of open source projects, and ultimately form an open source evaluation index.

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/apache/cloudstack.git
git@gitee.com:apache/cloudstack.git
apache
cloudstack
cloudstack
main
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /