调试环境
ubuntu 12.04
JDK1.7
apache-maven-3.10
eclipse 4.2 Juno
mysql 5
源码下载及调试
上面的几个软件在上一篇中已经介绍了。
在新的版本中,整个的编译和调试过程都是基于maven的,而且整个工程的结构也有所变化。
更新git:
sudo apt-get install git-core
安装maven,确认安装的是maven 3
sudo apt-get install maven
skyme@skyme-virtual-machine:~$ mvn -version Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 10:15:32+0800) Maven home: /home/skyme/java/apache-maven-3.1.0 Java version: 1.7.0_21, vendor: Oracle Corporation Java home: /home/skyme/java/jdk1.7.0_21/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.5.0-37-generic", arch: "amd64", family: "unix"
安装配置java
安装mysql并且创建用户,用户名cloud,密码cloud
sudo apt-get install mysql-server-5.5
mysql -u root -p 输入密码 insert into mysql.user(Host,User,Password,ssl_cipher,x509_issuer,x509_sub ject) values("localhost","cloud",password("cloud"),'','',''); grant all privileges on phplampDB.* to cloud@localhost identified by 'cloud'; flush privileges;
安装tomcat6
sudo apt-get install tomcat6
构建步骤
下载源码:
git clone https://git-wip-us.apache.org/repos/asf/cloudstack.git
下载完成后,执行:
mvn clean install
构建完成后,进行测试:
mvn -P developer -pl developer -Ddeploydb
在这里面构建数据库的过程也改成了mvn的方式。
在执行测试的时候:
export MAVEN_OPTS="-XX:MaxPermSize=512M -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
MaxPermSize的值在这里面设置为512M,因为有可能启动jetty的时候会报错
Exception in thread "main" java.lang.OutOfMemoryError: PermGen space。
然后启动jetty。
mvn -pl :cloud-client-ui jetty:run
d788942 INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.network.guru.OvsGuestNetworkGuru_EnhancerByCloudStack_2230f61b INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.template.HypervisorTemplateAdapter_EnhancerByCloudStack_ab1a790f INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.network.guru.StorageNetworkGuru_EnhancerByCloudStack_8d4afb32 INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.network.element.MidoNetElement_EnhancerByCloudStack_bbaedad INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting org.apache.cloudstack.storage.allocator.ClusterScopeStoragePoolAllocator_EnhancerByCloudStack_a26e7930 INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting org.apache.cloudstack.storage.allocator.GarbageCollectingStoragePoolAllocator_EnhancerByCloudStack_3ecf09b5 INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting org.apache.cloudstack.acl.StaticRoleBasedAPIAccessChecker_EnhancerByCloudStack_16619324 INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.ha.KVMFencer_EnhancerByCloudStack_fa0503f3 INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.network.element.VirtualRouterElement_EnhancerByCloudStack_9d6525ff INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.ha.XenServerFencer_EnhancerByCloudStack_bfe5e165 INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.storage.secondary.SecondaryStorageVmDefaultAllocator_EnhancerByCloudStack_feb121d2 INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.server.auth.MD5UserAuthenticator_EnhancerByCloudStack_1500f4a2 INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.network.element.NiciraNvpElement_EnhancerByCloudStack_48e0bcdb INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.hypervisor.XenServerGuru_EnhancerByCloudStack_41a08dc3 INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.ha.XenServerInvestigator_EnhancerByCloudStack_f77a7c2d INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.network.element.ElasticLoadBalancerElement_EnhancerByCloudStack_510d11fa INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.network.guru.NiciraNvpGuestNetworkGuru_EnhancerByCloudStack_9f279c07 INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.baremetal.networkservice.BaremetalPxeElement_EnhancerByCloudStack_ec99bfab INFO [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.server.ManagementServerImpl_EnhancerByCloudStack_550a6c02 INFO [c.c.s.ManagementServerImpl] (Timer-3:null) Startup CloudStack management server... INFO [c.c.c.ClusterServiceServletContainer] (Thread-18:null) Cluster service servlet container listening on port 9090 INFO [c.c.u.d.Merovingian2] (Timer-3:null) Cleaning up locks for 52238372990 INFO [c.c.u.d.Merovingian2] (Timer-3:null) Released 0 locks for 52238372990 INFO [c.c.c.ClusterManagerImpl] (Timer-3:null) register cluster listener class com.cloud.server.LockMasterListener INFO [c.c.c.ClusterManagerImpl] (Cluster-Heartbeat-1:null) We are good, no orphan management server msid in host table is found INFO [c.c.c.ClusterManagerImpl] (Cluster-Heartbeat-1:null) No inactive management server node found WARN [o.a.c.alerts] (Cluster-Notification-1:null) alertType:: 14 // dataCenterId:: 0 // podId:: 0 // clusterId:: null // message:: Management server node 127.0.0.1 is up WARN [c.c.c.ClusterManagerImpl] (Cluster-Notification-1:null) Notifying management server join event took 76 ms
启动成功。
打开浏览器,访问URL:http://localhost:8080/client
输入
用户名:admin
密码:password
可登录。
打开eclipse,我们以远程可调试方式启动cloudstack,回到Eclipse工具中,点菜单“Run”,选择Debug Configurations
在出现的调试配置对话框中,我们点 New 创建一个新的Remote Java Application 配置。
设置eclipse 远程调试run,我们在Connect Tab页中,设置如下
选择远程调试使用的源代码,在Source Tab页中,点Add 按钮,从Java Project中增加源代码
出现的工程中,我们全部选择上。
点Debug.
打上断点,然后运行,就可以进行调试了。
时间: 2024-11-03 18:14:14