Yah, you need Eclipse connects to the java agent running on SSVM.
You can use the following steps:
1. login into ssvm, either console proxy or ssh(port 3922)
2. kill all the processes named as(run.sh/_run.sh, and java)
3. cd /usr/local/cloud/systemvm
4. add the " -Xdebug 
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address={8787}" at end of 
"java " in _run.sh
5. ./run.sh, the java agent will start, with debug port 8787 is listened on.
6. allow port 8787 in ssvm, "iptables -I INPUT -I eth1 -p tcp -m state --state 
NEW -m tcp --dport 8787 -j ACCEPT", either eth1 or eth2 is ok.
Then you can connect to agent in ssvm, based on the ip address based on on eth1 
or eth2, and port 8787

Or above steps sound too complicated to you, you can debug resource code 
locally.
For example, There is an unit test code, called, 
LocalNfsSecondaryStorageResourceTest, on 4.2 branch, you can mock the commands 
send to resource, then test it locally, but the requirement is that your local 
machine needs to be able to mount nfs(Both Linux/Mac works, Windows can't).
I'd prefer unit test, as it's easier to test/debug/fix.

> -----Original Message-----
> From: ryanlei750...@gmail.com [mailto:ryanlei750...@gmail.com] On
> Behalf Of Ryan Lei
> Sent: Monday, July 22, 2013 3:10 AM
> To: dev@cloudstack.apache.org
> Subject: Tracing registerTemplate API, is it possible to connect Eclipse
> debugger to System VMs?
> 
> Hi, I've been trying to study how System VMs work in CloudStack code.
> 
> Tracing the creation of SSVM and CPVM was not a problem. It has to do with
> updateZone API (&allocationstate=Enabled) and SystemVmLoadScanner.java
> for both secondary storage and console proxy.
> 
> But the next usage case, registering a template, was not as straightforward.
> Tracing the registerTemplate API lead me to a dead end in the send()
> method in cloud-utils -> com.cloud.utils.nio.Link.java, whose previous step is
> _link.send(req.toBytes()) in cloud-server ->
> com.cloud.agent.manager.ConnectedAgentAttache.java.
> 
> From the MS log, it seems after the DownloadCommand is sent in
> agent.transport.Request, the registerTemplate API ends.
> http://apaste.info/pM1E
> 
> So how do I trace the next Java steps on the SSVM part? Is it possible to
> connect Eclipse debugger to System VMs? Or what is the best way to trace
> the interaction between MS and System VMs that involves an agent
> command?
> 
> Thanks
> 
> -------------------------------------------------------------------------------------------
> Yu-Heng (Ryan) Lei, Associate Reasearcher Chunghwa Telecom Laboratories /
> Cloud Computing Laboratory
> ryan...@cht.com.tw<https://email.cht.com.tw/owa/redir.aspx?C=-
> wE1FEC3G0SWYpVkiWo8SsDdf3ZqO9AIuAPTzRnFYCUi-
> z4YljtI_hyVKkNHfn9F1Bn-vUWJnQ4.&URL=mailto%3aryanlei%40cht.com.tw>
> or
> ryanlei750...@gmail.com

Reply via email to