]> xenbits.xensource.com Git - pvdrivers/win/xeniface.git/commitdiff
[CA-119899] Fix error reporting so that xapi kicks occur correctly
authorBen Chalmers <Ben.Chalmers@citrix.com>
Mon, 4 Nov 2013 16:48:18 +0000 (16:48 +0000)
committerBen Chalmers <Ben.Chalmers@citrix.com>
Mon, 4 Nov 2013 16:48:18 +0000 (16:48 +0000)
src/win32stubagent/WmiAccessor.cpp
src/win32stubagent/XSAccessor.cpp
src/win32stubagent/XService.cpp

index 51d14442c22c87f6504c60ae7cab51fbe5acc96c..7acedcbdb3a6d28888d662053e83a04457a845ca 100644 (file)
@@ -1085,24 +1085,29 @@ int WmiSessionSetEntry(WMIAccessor** wmi,  void **sessionhandle,
     if (FAILED(methodExec(wmi,*session, L"SetValue", inMethodInst, &outMethodInst)))
                goto methodexecfailed;
 
-    if (outMethodInst==NULL)
-        goto sessionExec;
+    if (outMethodInst!=NULL) 
+        outMethodInst->Release();
 
-    outMethodInst->Release();
+       inMethodInst->Release();
+    SysFreeString(vvalue.bstrVal);
+    SysFreeString(vpath.bstrVal);
 
-    err=0;
+    return 0;
 
 methodexecfailed:
-sessionExec:     
+    XsLog("WmiSessionSetEntry:MethodExec Failed");
        inMethodInst->Release();
 
 sessionstart:
+    XsLog("WmiSessionSetEntry:SessionStart Failed");
     SysFreeString(vvalue.bstrVal);
 
 setvvalue:
+    XsLog("WmiSessionSetEntry:SetVValue Failed");
     SysFreeString(vpath.bstrVal);
 
 setvpath:
+    XsLog("WmiSessionSetEntry:SetVPath Failed ");
     return err;
 }
 
index 04df5d454548dff593699754b6ab399ca5d1afee..b6f74b32005cf424b7e690150051bac84ce9c17d 100644 (file)
@@ -40,7 +40,7 @@ static LONG volatile threadcount = 0;
 static __declspec(thread) LONG localthreadcount = 0;
 static __declspec(thread) LONG localwmicount = 0;
 
-static long update_cnt;
+static long update_cnt=0xF0000000;
 #define XENSTORE_MAGIC 0x7e6ec123
 
 void *XsAlloc(size_t size) {
@@ -145,13 +145,16 @@ int XenstorePrintf(const char *path, const char *fmt, ...)
 
 BOOL XenstoreKickXapi()
 {
-    /* Old protocol */
-    if (WmiSessionSetEntry(&wmi, &WmiSessionHandle, "data/updated", "1"))
-               return false;
     /* New protocol */
-    if (XenstorePrintf("data/update_cnt", "%I64d", update_cnt))
+    if (XenstorePrintf("data/update_cnt", "%I64d", update_cnt)){
+        XsLog("New kick failed ");
                return false;
-
+    }
+    /* Old protocol */
+    if (WmiSessionSetEntry(&wmi, &WmiSessionHandle, "data/updated", "1")){
+        XsLog("Old kick failed");
+               return false;
+    }
     update_cnt++;
        return true;
 }
@@ -178,7 +181,7 @@ XenstoreRead(const char* path, char** value)
     size_t len;
     *value =WmiSessionGetEntry(&wmi, &WmiSessionHandle, path, &len);
     if (*value)
-        return len;
+        return (ssize_t)len;
     else
         return -1;
 }
index 6483c4714aab8973bb9f646e16ecbc414383396c..7189fc0b56d56234e8b51c59674d2995e94df878 100644 (file)
@@ -556,6 +556,7 @@ BOOL Run()
     }
    
 
+    XsLogMsg("About to add feature shutdown");
     if (!AddFeature(&features, "control/shutdown", "control/feature-shutdown", 
                                        "shutdown", maybeReboot, NULL, wmierrorEvent)) {
                return exit;
@@ -575,8 +576,9 @@ BOOL Run()
     }
 
 
-
+    XsLogMsg("About to advertise features");
     AdvertiseFeatures(&features);
+    XsLogMsg("About to kick xapi ");
        XenstoreKickXapi();
 
     while (1)
@@ -717,7 +719,6 @@ void WINAPI ServiceMain(int argc, char** argv)
         return;
     }
        BOOL stopping;
-       //InitCom();
 
        do {
                
@@ -731,7 +732,6 @@ void WINAPI ServiceMain(int argc, char** argv)
                }
        } while (!stopping);
        
-       //ReleaseCom();
     XsLog("Guest agent service stopped");
     ShutdownXSAccessor();
        ServiceControlManagerUpdate(0, SERVICE_STOPPED);