If there are issues around KVM hypervisor in CloudStack, better to have the following information when reports issues/bugs and or bringing the issue to the mailing lists:

  1. Which KVM host OS is being used? Centos 6.2, 6,1, Ubuntu 10.04/12.04? 
  2. Which version of libvirt is using, "virsh --version"
  3. Turn the agent log level to debug:
    $sed -i 's/INFO/DEBUG/g' /etc/cloudstack/agent/log4j-cloud.xml
    
  4. Reproduce the issue, paste the /var/log/cloudstack/agent/agent.log to a pastebin
  5. If adding kvm host failed, take a look at: /var/log/cloudstack/setupAgent.log
  6. Ensure that virtualization modules are present on your host OS. Following shows KVM modules
    $lsmod | grep kvm
    

Steps to debug the KVM agent  from eclipse:

  • In KVM agent  edit  ‘/usr/libexec/agent-runner ‘,

         add  "-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"   to ‘java -Xms128M -Xmx384M’  line

               java -Xms128M -Xmx384M -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n -cp "$CLASSPATH" "$@" com.cloud.agent.AgentShell $SERVICEARGS &2.

  • Add the firewall rule in KVM host to accept the traffic on 8787 port.

              iptables  --I INPUT --p tcp --dport 8787 --j ACCEPT

  • Then restart cloud-agent.

              service cloud(stack)-agent restart

  • Verify that 8787 port is opened by java using  ‘netstat --napt’ command.
  • Connect from eclipse Debug Configuration to to KVM host 8787 port for debugging.

How to debug the KVM Agent on 4.2 and RHEL 6.3

kvm agent is running with jsvc tool.

To run the kvm agent in debug mode.

in /etc/init.d/cloudstack-agent
start() method
add -Xrunjdwp:transport=dt_socket,address=8787 after $JSVC.

it will be like $JSVC -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n -cp "$CLASSPATH"

add rule to allow 8787 port in kvm host.

iptables  -I INPUT -p tcp --dport 8787 --j ACCEPT (on Rhel 6.3)

restart the management server. check the port 8787 using netstat -atnp | grep jsvc

connect the debugger from eclipse.

  • No labels