分享

虚拟化平台cloudstack—新版本的调试

xioaxu790 发表于 2014-10-30 21:08:17 [显示全部楼层] 只看大图 回帖奖励 阅读模式 关闭右栏 0 11007
本帖最后由 xioaxu790 于 2014-10-30 21:50 编辑
问题导读
1、调试CloudStack,我们需要什么样的环境?
2、安装配置java,有哪些注意?
3、CloudStack源代码如何进行调试?






调试环境
ubuntu 12.04
JDK1.7
apache-maven-3.10
eclipse 4.2 Juno
mysql 5

源码下载及调试
上面的几个软件在上一篇中已经介绍了。

在新的版本中,整个的编译和调试过程都是基于maven的,而且整个工程的结构也有所变化。

更新git:
  1. sudo apt-get install git-core
复制代码



安装maven,确认安装的是maven 3
  1. sudo apt-get install maven
复制代码

  1. skyme@skyme-virtual-machine:~$ mvn -version
  2. Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 10:15:32+0800)
  3. Maven home: /home/skyme/java/apache-maven-3.1.0
  4. Java version: 1.7.0_21, vendor: Oracle Corporation
  5. Java home: /home/skyme/java/jdk1.7.0_21/jre
  6. Default locale: en_US, platform encoding: UTF-8
  7. OS name: "linux", version: "3.5.0-37-generic", arch: "amd64", family: "unix"
复制代码


安装配置java

安装mysql并且创建用户,用户名cloud,密码cloud
  1. sudo apt-get install mysql-server-5.5
  2. mysql -u root -p
  3. 输入密码
  4. insert into mysql.user(Host,User,Password,ssl_cipher,x509_issuer,x509_sub
  5. ject) values("localhost","cloud",password("cloud"),'','','');
  6. grant all privileges on phplampDB.* to cloud@localhost identified by 'cloud';
  7. flush privileges;
复制代码



安装tomcat6
  1. sudo apt-get install tomcat6
复制代码



构建步骤
下载源码:
  1. git clone https://git-wip-us.apache.org/repos/asf/cloudstack.git
复制代码


下载完成后,执行:
  1. mvn clean install
复制代码



构建完成后,进行测试:
  1. mvn -P developer -pl developer -Ddeploydb
复制代码



在这里面构建数据库的过程也改成了mvn的方式。

在执行测试的时候:
  1. export MAVEN_OPTS="-XX:MaxPermSize=512M -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
复制代码


MaxPermSize的值在这里面设置为512M,因为有可能启动jetty的时候会报错
  1. Exception in thread "main" java.lang.OutOfMemoryError: PermGen space。
复制代码

然后启动jetty。
  1. mvn -pl :cloud-client-ui jetty:run
复制代码
  1. d788942
  2. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.network.guru.OvsGuestNetworkGuru_EnhancerByCloudStack_2230f61b
  3. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.template.HypervisorTemplateAdapter_EnhancerByCloudStack_ab1a790f
  4. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.network.guru.StorageNetworkGuru_EnhancerByCloudStack_8d4afb32
  5. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.network.element.MidoNetElement_EnhancerByCloudStack_bbaedad
  6. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting org.apache.cloudstack.storage.allocator.ClusterScopeStoragePoolAllocator_EnhancerByCloudStack_a26e7930
  7. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting org.apache.cloudstack.storage.allocator.GarbageCollectingStoragePoolAllocator_EnhancerByCloudStack_3ecf09b5
  8. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting org.apache.cloudstack.acl.StaticRoleBasedAPIAccessChecker_EnhancerByCloudStack_16619324
  9. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.ha.KVMFencer_EnhancerByCloudStack_fa0503f3
  10. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.network.element.VirtualRouterElement_EnhancerByCloudStack_9d6525ff
  11. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.ha.XenServerFencer_EnhancerByCloudStack_bfe5e165
  12. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.storage.secondary.SecondaryStorageVmDefaultAllocator_EnhancerByCloudStack_feb121d2
  13. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.server.auth.MD5UserAuthenticator_EnhancerByCloudStack_1500f4a2
  14. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.network.element.NiciraNvpElement_EnhancerByCloudStack_48e0bcdb
  15. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.hypervisor.XenServerGuru_EnhancerByCloudStack_41a08dc3
  16. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.ha.XenServerInvestigator_EnhancerByCloudStack_f77a7c2d
  17. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.network.element.ElasticLoadBalancerElement_EnhancerByCloudStack_510d11fa
  18. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.network.guru.NiciraNvpGuestNetworkGuru_EnhancerByCloudStack_9f279c07
  19. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.baremetal.networkservice.BaremetalPxeElement_EnhancerByCloudStack_ec99bfab
  20. INFO  [c.c.u.c.ComponentContext] (Timer-3:null) Starting com.cloud.server.ManagementServerImpl_EnhancerByCloudStack_550a6c02
  21. INFO  [c.c.s.ManagementServerImpl] (Timer-3:null) Startup CloudStack management server...
  22. INFO  [c.c.c.ClusterServiceServletContainer] (Thread-18:null) Cluster service servlet container listening on port 9090
  23. INFO  [c.c.u.d.Merovingian2] (Timer-3:null) Cleaning up locks for 52238372990
  24. INFO  [c.c.u.d.Merovingian2] (Timer-3:null) Released 0 locks for 52238372990
  25. INFO  [c.c.c.ClusterManagerImpl] (Timer-3:null) register cluster listener class com.cloud.server.LockMasterListener
  26. INFO  [c.c.c.ClusterManagerImpl] (Cluster-Heartbeat-1:null) We are good, no orphan management server msid in host table is found
  27. INFO  [c.c.c.ClusterManagerImpl] (Cluster-Heartbeat-1:null) No inactive management server node found
  28. 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
  29. WARN  [c.c.c.ClusterManagerImpl] (Cluster-Notification-1:null) Notifying management server join event took 76 ms
复制代码


启动成功。

打开浏览器,访问URL:http://localhost:8080/client

1.jpg



输入
用户名:admin
密码:password

可登录。

打开eclipse,我们以远程可调试方式启动cloudstack,回到Eclipse工具中,点菜单“Run”,选择Debug Configurations

在出现的调试配置对话框中,我们点 New 创建一个新的Remote Java Application 配置。

设置eclipse 远程调试run,我们在Connect Tab页中,设置如下
1.jpg



选择远程调试使用的源代码,在Source Tab页中,点Add 按钮,从Java Project中增加源代码

出现的工程中,我们全部选择上。

点Debug.

打上断点,然后运行,就可以进行调试了。

没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条