1.前端框架:
燕云的前端参考官方的给的Demo。下面是官网的给出的界面截图。
2.后台:
1.1CloudStack 分析
CloudStack是一个开源的具有高可用性及扩展性的云计算平台。支持管理大部分主流的hypervisors,如KVM,XenServer,VMware,OracleVM,Xen等。
CloudStack | |
License | Apache 2.0 授权协议,可免费用于商业模式 |
支持的 Hypervisors | KVM,XEN,OracleVM,VMware,vSphere 和 BareMetal (有限支持 Hyper-V,ESX,PowerVM) |
支持的 Networking Model | OpenFlow,VLAN和 Flat networks |
支持的Storage | NFS,ClusterLVM,Rados Block Device(Ceph),LocalStorage |
客户群 | 不到 60家,包括诺基亚,Zynga,日本电报电话公司,塔塔,阿尔卡特 |
开发语言 | Java 为主 |
兼容亚马逊 EC2 API | 是 |
1.2CloudStack存储
CloudStack把存储分成了主存储(PrimaryStorage)与二级存储(Secondary Storage).根据Hypervisor种类的不同,主存储中的磁盘镜像格式见下表:
类型 | XenServer | ESXi | KVM |
磁盘格式 | VHD | VMDK | QCOW2 |
本地存储 | 支持 | 支持 | 支持 |
NFS | 支持 | 支持 | 支持 |
iSCSI | Clustered LVM | VMFS | via SharedMountPoind |
FC-SAN | via Existing SR | VMFS | via Shared MountPoint |
SharedMountPoint | 不支持 | 不支持 | 支持 |
支持存储超配 | NFS | NFS,iCSCI | NFS |
iSCSI和FC-San存储在Xenserver中被加载为ClusteredLVM格式,此种格式下,不能支持存储的超配。如果存储本身支持XenServer的thin-provisioning,CloudStack也可以支持存储超配
1.3libvirt
Libvirt 库是一种实现 Linux 虚拟化功能的 Linux® API,它支持各种虚拟机监控程序,包括Xen 和 KVM,以及QEMU 和用于其他操作系统的一些虚拟产品。
nternetware-agent、deployable-agent
deployable-agent
ntp
jsvc
bridge-utils
libvirtd
kvm
nfs-utils
Management Server
cloud-client
deployable-server
ntpd、ntp
mysql-server
jsvc
nfs-utils
gcc
make
Python-2.7.3.tgz
tomcat6
cloudstack-management Server
CloudStackAgent
脚本
grant create session,create table,unlimited tablespace tocloud;
setenforce permissive
GRANT CREATE ANY TABLE TO cloud;
GRANT SELECT ANY TABLE TO cloud;
GRANT COMMENT ANY TABLE TO cloud;
GRANT LOCK ANY TABLE TO cloud;
GRANT SELECT ANY DICTIONARY TO cloud;
GRANT CREATE ANY VIEW TO cloud;
GRANT CREATE ANY SEQUENCE TO cloud;
GRANT CREATE PROCEDURE TO cloud;
GRANT CREATE TRIGGER TO cloud;
create database internetwarecloud default charsetutf8;
enforcing=0
6228480602515211418
wget
http://www.ibm.com/developejava-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64
export JAVA_HOME=/usr/local/jdk1.7.0_21
export PATH=$PATH:$JAVA_HOME/bin
exportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
jdk切换
# cd /usr/bin
# ln -s -f /usr/java/jdk1.6.0_24/jre/bin/java
# ln -s -f /usr/java/jdk1.6.0_24/bin/javac
vi /etc/sysconfig/iptables
service iptables restart
service iptables save
rpm -qa | grep java
rpm -e --nodepscloudstack-common-4.1.0-0.el6.x86_64
rpm -e --nodepscloudstack-agent-4.1.0-0.el6.x86_64
cloudstack-setup-databases cloud:cloud@localhost
--deploy-as=root:root
egrep '^flags.*(vmx|svm)' /proc/cpuinfo
lsmod | grep kvm
netstat -apn | grep 8088
kill -9
mvn -pl :cloud-client-ui jetty:run
agent
cloudstack-setup-agent
配置本地yum
错误收集
部署
1nproject cloud-plugin-network-netscaler: Compilationfailure
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile
(default-compile) on project cloud-plugin-network-netscaler:Compilation failure: Compilation failure:
[ERROR]/home/anshul/asfCloudStack/incubator-cloudstack/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java:[31,59]
error: package com.citrix.netscaler.nitro.resource.config.autoscaledoes not exist
[ERROR]/home/anshul/asfCloudStack/incubator-cloudstack/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java:[32,59]
error: package com.citrix.netscaler.nitro.resource.config.autoscaledoes not exist
替换/root/.m2/下面的netscaler-1.0.jar
2 OutOfMemoryError: PermGen space
java.lang.reflect.InvocationTargetException
OutOfMemoryError: PermGen space
执行export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=500m -Xdebug-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
3 Could not transfer artifactcom.ceph:rados:pom:0
[ERROR] Failed to execute goal on projectcloud-plugin-hypervisor-kvm: Could not resolve dependencies forprojectorg.apache.cloudstack:cloud-plugin-hypervisor-kvm:jar:4.2.0-SNAPSHOT:Failed to collect dependencies at com.ceph:rados:jar:0.1.1: Failedto read artifact descriptor for com.ceph:rados:jar:0.1.1: Could nottransfer artifact com.ceph:rados:pom:0.1.1 from/to ceph-com(http://ceph.com/maven): ceph.com: Name or service not known:Unknown host ceph.com: Name or service not known -> [Help1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-runMaven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable fulldebug logging.
[ERROR]
[ERROR] For more information about the errors and possiblesolutions, please read the following articles:
[ERROR] [Help 1]http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume thebuild with the command
[ERROR] mvn-rf :cloud-plugin-hypervisor-kvm
down下来的版本是4.2切换到4.1上面git checkout4.1
4 he requested profile "deps" could not be activatedbecause it does not exist.
[WARNING] The requested profile "deps" could not beactivated because it does not exist.
deps/cloud-iControl.jar
deps/cloud-manageontap.jar
deps/cloud-netscaler-sdx.jar
deps/cloud-netscaler.jar
deps/vmware-apputils.jar
deps/vmware-vim.jar
deps/vmware-vim25.jar
mvn -P developer clean install
Install them to ~/.m2 so maven can get them asdependencies:
5 on project cloud-marvin: Command execution failed. Process exitedwith an error
[ERROR] Failed to execute goalorg.codehaus.mojo:exec-maven-plugin:1.2.1:exec (package) on projectcloud-marvin: Command execution failed. Process exited with anerror: 1 (Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Mavenwith the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debuglogging.
[ERROR]
[ERROR] For more information about the errors and possiblesolutions, please read the following articles:
[ERROR] [Help 1]http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the buildwith the command
[ERROR] mvn-rf :cloud-marvin
cd tools/marvin
mvn install
6 Could not transfer artifactorg.libvirt:libvirt:
-client-ui: Error resolving project artifact: Could nottransfer artifact org.libvirt:libvirt:pom:0.4.9 from/to central(http://repo.maven.apache.org/maven2): repo.maven.apache.org forproject org.libvirt:libvirt:jar:0.4.9: Unknown hostrepo.maven.apache.org -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-runMaven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable fulldebug logging.
[ERROR]
[ERROR] For more information about the errors and possiblesolutions, please read the following articles:
[ERROR] [Help 1]http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume thebuild with the command
[ERROR] mvn-rf :cloud-client-ui
The pid file locates at/var/run/cloudstack-management.pid and lock file at/var/lock/subsys/cloudstack-management.
Starting cloudstack-management will take care of them or you canmanually clean up.
DEBUG:root:execute:chkconfig --level 2345cloudstack-management on
DEBUG:root:execute:service cloudstack-managementstatus
DEBUG:root:Failed to execute:cloudstack-management isstopped
The pid file locates at /var/run/cloudstack-management.pidand lock file at /var/lock/subsys/cloudstack-management.
Starting cloudstack-management will take care of them or you canmanually clean up.
DEBUG:root:execute:service cloudstack-managementstart
Can't connect to local MySQL server through socket'/var/lib/mysql/mysql.sock' (111)
on project cloud-marvin: Command executionfailed.
easy_installpip
Provided file does not existutils/conf/db.properties
测试
1. windows添加磁盘,状态ready但是系统无法发现磁盘。
安装virtio驱动
Bug
4.1的版本有两个地方有bug,一个是kvmclock问题,一个是高级网络的ui
4.1最大的问题还是在ha上,当一个主机down的时候,其上的vm的状态不会自动改变
源代码中vnet的限速功能有bug
这段代码解决当windows使用otherpv时,始终没有指定为rtc导致windows变慢的问题
plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
ClockDef clock = new ClockDef();
if (vmTO.getOs().startsWith("Windows")) {
clock.setClockOffset(ClockDef.ClockOffset.LOCALTIME);
clock.setTimer("rtc", "catchup", null);
} else if {
clock.setTimer("rtc", "catchup", null);
}
这段代码解决vm挂载nfs时,读写速率只有10MB/s的问题,也就是取消了kvm的vnet限速。
plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
public void defBridgeNet(String brName, StringtargetBrName,
String macAddr, nicModel model, Integer networkRateKBps){
_netType = guestNetType.BRIDGE;
_sourceName = brName;
_networkName = targetBrName;
_macAddr = macAddr;
_model = model;
_networkRateKBps = 0;
public void defPrivateNet(String networkName, StringtargetName,
String macAddr, nicModel model, Integer networkRateKBps){
_netType = guestNetType.NETWORK;
_sourceName = networkName;
_networkName = targetName;
_macAddr = macAddr;
_model = model;
_networkRateKBps = 0;
这段代码解决了当host当机以后,server无法侦测到,导致ha失败的问题
cloudstack/server/src/com/cloud/ha/AbstractInvestigatorImpl.java
if(s_logger.isDebugEnabled()) {
s_logger.debug("host (" + testHostIp + ") cannot be pinged,returning null ('I don't know')");
}
return Status.Down;
}
} catch (AgentUnavailableException e) {