]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Log reply from VMX when powerOps plugin fails to send RPC.
authorOliver Kurth <okurth@vmware.com>
Mon, 20 Aug 2018 19:48:09 +0000 (12:48 -0700)
committerOliver Kurth <okurth@vmware.com>
Mon, 20 Aug 2018 19:48:09 +0000 (12:48 -0700)
The powerOps plugin sends a "tools.os.statechange.status" RPC after
the power scripts are executed.  The reply from VMX for this RPC
is not currently logged.  The reply is very useful to debug
'toolsRunningStatus' issues in FSR workflows.  Modified the code
to log the reply.

open-vm-tools/services/plugins/powerOps/powerOps.c

index 3f7a1bf923df0c8f33a2e3e2acac7b29e96b0bf2..100cba920dbd7d5d87c73a1bc39db537702d8a26 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2008-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 2008-2016,2018 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -177,6 +177,8 @@ PowerOpsStateChangeDone(PowerOpState *state,
                         gboolean success)
 {
    gchar *msg;
+   char *reply = NULL;
+   size_t repLen = 0;
 
    g_debug("State change complete, success = %d.\n", success);
 
@@ -198,10 +200,13 @@ PowerOpsStateChangeDone(PowerOpState *state,
    msg = g_strdup_printf("tools.os.statechange.status %d %d",
                          success,
                          state->stateChgInProgress);
-   if (!RpcChannel_Send(state->ctx->rpc, msg, strlen(msg) + 1, NULL, NULL)) {
-      g_warning("Unable to send the status RPC.");
+   if (!RpcChannel_Send(state->ctx->rpc, msg, strlen(msg) + 1,
+                        &reply, &repLen)) {
+      g_warning("Unable to send the status RPC. Reply: '%s', Reply len: '%" FMTSZ "u'",
+                (reply != NULL) ? reply : "(null)", repLen);
    }
 
+   RpcChannel_Free(reply);
    g_free(msg);
 
    /* Finally, perform the requested operation. */