CLOUDSTACK-4376: fix cloud-early-config to workaround vSwitch stall in VPC 
mode. fix potential NPE in DirectAgentAttache in processing answers from 
resource


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/71b8f606
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/71b8f606
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/71b8f606

Branch: refs/heads/master
Commit: 71b8f6061f187d9b8fb555731c051bc9f074d430
Parents: c528e71
Author: Kelven Yang <[email protected]>
Authored: Tue Aug 20 14:51:50 2013 -0700
Committer: Kelven Yang <[email protected]>
Committed: Wed Sep 4 14:49:45 2013 -0700

----------------------------------------------------------------------
 .../systemvm/debian/config/etc/init.d/cloud-early-config  | 10 ++++++----
 .../src/com/cloud/agent/manager/DirectAgentAttache.java   |  4 ++++
 2 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/71b8f606/patches/systemvm/debian/config/etc/init.d/cloud-early-config
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config 
b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
index 2161333..88ecc11 100755
--- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config
+++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
@@ -196,6 +196,7 @@ patch() {
 
 patch_log4j() {
 log_it "Updating log4j-cloud.xml"
+mkdir -p /usr/local/cloud/systemvm/conf
 cat << "EOF" > /usr/local/cloud/systemvm/conf/temp.xml
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
@@ -936,10 +937,6 @@ setup_router() {
 setup_vpcrouter() {
   log_it "Setting up VPC virtual router system vm"
 
-  if [ "$hyp" == "vmware" ]; then
-    setup_vmware_extra_nics
-  fi
-
   if [ -f /etc/hosts ]; then
     grep -q $NAME /etc/hosts || echo "127.0.0.1 $NAME" >> /etc/hosts;
   fi
@@ -984,6 +981,11 @@ EOF
      if [ "$hyp" == "vmware" ]
      then
          ip route add $MGMTNET via $LOCAL_GW dev eth0
+         
+          # a hacking way to activate vSwitch under VMware
+         ping -n -c 3 $LOCAL_GW &
+         sleep 3
+         pkill ping
      fi
   fi
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/71b8f606/server/src/com/cloud/agent/manager/DirectAgentAttache.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/DirectAgentAttache.java 
b/server/src/com/cloud/agent/manager/DirectAgentAttache.java
index 7a36998..5b5d8d2 100755
--- a/server/src/com/cloud/agent/manager/DirectAgentAttache.java
+++ b/server/src/com/cloud/agent/manager/DirectAgentAttache.java
@@ -184,6 +184,10 @@ public class DirectAgentAttache extends AgentAttache {
                     try {
                         if (resource != null) {
                             answer = resource.executeRequest(cmds[i]);
+                            if(answer == null) {
+                               s_logger.warn("Resource returned null answer!");
+                                answer = new Answer(cmds[i], false, "Resource 
returned null answer");
+                            }
                         } else {
                             answer = new Answer(cmds[i], false, "Agent is 
disconnected");
                         }

Reply via email to