开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 0

tqyin/cloudstack

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (258)
标签 (146)
master
4.11
4.11.0.0-RC20180115T1603
4.10
4.9
add_XS_71_72
CLOUDSTACK-10012
GA-4.9.3.0
new-location
cloudearlyinit
4.10.0.0-RC20170703T1006
GA-4.10.0.0
4.10.0.0-RC20170626T1011
4.10.0.0-RC20170620T1023
4.10.0.0-RC20170609T1354
4.10.0.0-RC20170607T1407
4.10.0.0-RC20170509T1030
4.10.0.0-RC20170301T0634
4.8
GA-4.9.2.0
4.9.3.0
4.10.0.0
4.9.2.0
4.9.1.0
4.5.2.2
4.9.0.1
4.8.1.1
4.8.1
4.9.0
4.8.0.1
4.7.1.1
4.6.2.1
4.5.2.1
4.8.0
4.7.1
4.7.0
4.6.2
4.6.1
4.6.0
4.5.2
master
分支 (258)
标签 (146)
master
4.11
4.11.0.0-RC20180115T1603
4.10
4.9
add_XS_71_72
CLOUDSTACK-10012
GA-4.9.3.0
new-location
cloudearlyinit
4.10.0.0-RC20170703T1006
GA-4.10.0.0
4.10.0.0-RC20170626T1011
4.10.0.0-RC20170620T1023
4.10.0.0-RC20170609T1354
4.10.0.0-RC20170607T1407
4.10.0.0-RC20170509T1030
4.10.0.0-RC20170301T0634
4.8
GA-4.9.2.0
4.9.3.0
4.10.0.0
4.9.2.0
4.9.1.0
4.5.2.2
4.9.0.1
4.8.1.1
4.8.1
4.9.0
4.8.0.1
4.7.1.1
4.6.2.1
4.5.2.1
4.8.0
4.7.1
4.7.0
4.6.2
4.6.1
4.6.0
4.5.2
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (258)
标签 (146)
master
4.11
4.11.0.0-RC20180115T1603
4.10
4.9
add_XS_71_72
CLOUDSTACK-10012
GA-4.9.3.0
new-location
cloudearlyinit
4.10.0.0-RC20170703T1006
GA-4.10.0.0
4.10.0.0-RC20170626T1011
4.10.0.0-RC20170620T1023
4.10.0.0-RC20170609T1354
4.10.0.0-RC20170607T1407
4.10.0.0-RC20170509T1030
4.10.0.0-RC20170301T0634
4.8
GA-4.9.2.0
4.9.3.0
4.10.0.0
4.9.2.0
4.9.1.0
4.5.2.2
4.9.0.1
4.8.1.1
4.8.1
4.9.0
4.8.0.1
4.7.1.1
4.6.2.1
4.5.2.1
4.8.0
4.7.1
4.7.0
4.6.2
4.6.1
4.6.0
4.5.2
syscfg.py 8.24 KB
一键复制 编辑 原始数据 按行查看 历史
# 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 utilities import Distribution, serviceOpsRedhat,serviceOpsUbuntu,serviceOpsRedhat7
from serviceConfig import *
class sysConfigFactory:
@staticmethod
def getSysConfigFactory(glbEnv):
if glbEnv.mode == "Agent":
return sysConfigAgentFactory.getAgent(glbEnv)
elif glbEnv.mode == "Server":
return sysConfigServerFactory.getServer(glbEnv)
elif glbEnv.mode == "HttpsServer":
return sysConfigServerFactory.getServer(glbEnv)
elif glbEnv.mode == "Db":
return sysConfigDbFactory.getDb(glbEnv)
else:
raise CloudInternalException("Need to specify which mode are u running: Agent/Server/Db")
class sysConfigAgentFactory:
@staticmethod
def getAgent(glbEnv):
glbEnv.distribution = Distribution()
distribution = glbEnv.distribution.getVersion()
if distribution == "Ubuntu":
return sysConfigAgentUbuntu(glbEnv)
elif distribution == "Fedora" or distribution == "RHEL6":
return sysConfigRedhat6(glbEnv)
elif distribution == "CentOS" or distribution == "RHEL5":
return sysConfigRedhat5(glbEnv)
elif distribution == "RHEL7":
return sysConfigRedhat7(glbEnv)
else:
print "Can't find the distribution version"
return sysConfig()
class sysConfigServerFactory:
@staticmethod
def getServer(glbEnv):
glbEnv.distribution = Distribution()
distribution = glbEnv.distribution.getVersion()
if distribution == "Ubuntu":
return sysConfigServerUbuntu(glbEnv)
elif distribution != "Unknown":
return sysConfigServerRedhat(glbEnv)
else:
print "Can't find the distribution version"
return sysConfig()
class sysConfigDbFactory:
@staticmethod
def getDb(glbEnv):
pass
class sysConfig(object):
def __init__(self, env):
self.env = env
self.services = []
def registerService(self, service):
self.services.append(service(self))
def config(self):
if not self.check():
return False
for service in self.services:
if not service.configration():
raise CloudInternalException("Configuration failed for service %s" % service.serviceName)
def restore(self):
for service in self.services:
service.backup()
def check(self):
return True
class sysConfigAgent(sysConfig):
def __init__(self, env):
super(sysConfigAgent, self).__init__(env)
def check(self):
if self.env.debug:
return True
if self.env.agentMode == "myCloud":
if self.env.distribution.getVersion() != "Ubuntu":
raise CloudInternalException("Need to run myCloud agent on an Ubuntu machine\n")
elif self.env.distribution.getArch() != "x86_64":
raise CloudInternalException("Need to run myCloud agent on an 64bit machine\n")
#check free disk space on the local disk
if os.path.exists("/var/lib/libvirt/images"):
size = -1
try:
size = int(bash("df -P /var/lib/libvirt/images | tail -1 |awk '{print 4ドル}'").getStdout())
except:
pass
if size != -1 and size < (30 * 1024 * 1024):
raise CloudRuntimeException("Need at least 30G free disk space under /var/lib/libvirt/images")
#check memory
mem = -1
try:
mem = int(bash("free -g|grep Mem|awk '{print 2ドル}'").getStdout())
except:
pass
if mem != -1 and mem < 1:
raise CloudRuntimeException("Need at least 1G memory")
if os.geteuid() != 0:
raise CloudInternalException("Need to execute with root permission\n")
hostname = bash("hostname -f")
if not hostname.isSuccess():
raise CloudInternalException("Checking hostname ... [Failed]\nPlease edit /etc/hosts, add a Fully Qualified Domain Name as your hostname\n")
kvmEnabled = self.svo.isKVMEnabled()
if not kvmEnabled:
raise CloudInternalException("Checking KVM...[Failed]\nPlease enable KVM on this machine\n")
return True
class sysConfigAgentRedhatBase(sysConfigAgent):
def __init__(self, env):
self.svo = serviceOpsRedhat()
super(sysConfigAgentRedhatBase, self).__init__(env)
class sysConfigAgentRedhat7Base(sysConfigAgent):
def __init__(self, env):
self.svo = serviceOpsRedhat7()
super(sysConfigAgentRedhat7Base, self).__init__(env)
class sysConfigAgentUbuntu(sysConfigAgent):
def __init__(self, glbEnv):
super(sysConfigAgentUbuntu, self).__init__(glbEnv)
self.svo = serviceOpsUbuntu()
self.services = [securityPolicyConfigUbuntu(self),
networkConfigUbuntu(self),
libvirtConfigUbuntu(self),
firewallConfigUbuntu(self),
nfsConfig(self),
cloudAgentConfig(self)]
#it covers RHEL6/Fedora13/Fedora14
class sysConfigRedhat6(sysConfigAgentRedhatBase):
def __init__(self, glbEnv):
super(sysConfigRedhat6, self).__init__(glbEnv)
self.services = [cgroupConfig(self),
securityPolicyConfigRedhat(self),
networkConfigRedhat(self),
libvirtConfigRedhat(self),
firewallConfigAgent(self),
nfsConfig(self),
cloudAgentConfig(self)]
#It covers RHEL5/CentOS5, the mainly difference is that there is no cgroup
class sysConfigRedhat5(sysConfigAgentRedhatBase):
def __init__(self, glbEnv):
super(sysConfigRedhat5, self).__init__(glbEnv)
self.services = [
securityPolicyConfigRedhat(self),
networkConfigRedhat(self),
libvirtConfigRedhat(self),
firewallConfigAgent(self),
cloudAgentConfig(self)]
#it covers RHEL7
class sysConfigRedhat7(sysConfigAgentRedhat7Base):
def __init__(self, glbEnv):
super(sysConfigRedhat7, self).__init__(glbEnv)
self.services = [securityPolicyConfigRedhat(self),
networkConfigRedhat(self),
libvirtConfigRedhat(self),
firewallConfigAgent(self),
nfsConfig(self),
cloudAgentConfig(self)]
class sysConfigServer(sysConfig):
def check(self):
if os.geteuid() != 0:
raise CloudInternalException("Need to execute with root permission")
hostname = bash("hostname -f")
if not hostname.isSuccess():
raise CloudInternalException("Checking hostname ... [Failed]\nPlease edit /etc/hosts, add a Fully Qualified Domain Name as your hostname\n")
return True
class sysConfigServerRedhat(sysConfigServer):
def __init__(self, glbEnv):
super(sysConfigServerRedhat, self).__init__(glbEnv)
self.svo = serviceOpsRedhat()
self.services = [firewallConfigServer(self)]
class sysConfigServerUbuntu(sysConfigServer):
def __init__(self, glbEnv):
super(sysConfigServerUbuntu, self).__init__(glbEnv)
self.svo = serviceOpsUbuntu()
self.services = [ubuntuFirewallConfigServer(self)]
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

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

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

取消
提交

简介

Mirror of Apache Cloudstack
暂无标签
Apache-2.0
使用 Apache-2.0 开源许可协议
, Apache-2.0
使用 Apache-2.0 开源许可协议
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/zedhs/cloudstack.git
git@gitee.com:zedhs/cloudstack.git
zedhs
cloudstack
cloudstack
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

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