]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Always send VMBACKUP_EVENT_GENERIC_MANIFEST during quiesced snapshots.
authorOliver Kurth <okurth@vmware.com>
Tue, 19 Feb 2019 20:51:31 +0000 (12:51 -0800)
committerOliver Kurth <okurth@vmware.com>
Tue, 19 Feb 2019 20:51:31 +0000 (12:51 -0800)
vSphere 6.7 added a host-side interface that allows VMTools to send
a "generic" backup manifest during a quiesced snapshot on Linux guests.
VMTools 10.2.0 or later tries to notify the host of the backup manifest
file through a vmbackup event message VMBACKUP_EVENT_GENERIC_MANIFEST.
If the host is unable to field the message, then VMTools logs the
failure and then continues with the quiesced snapshot in the older
fashion, without the backup manifest.

An earlier change attempted to reduce the amount of logging done when
running on older hosts that don't support VMBACKUP_EVENT_GENERIC_MANIFEST
by detecting when sending VMBACKUP_EVENT_GENERIC_MANIFEST fails and
not sending the message again for subsequent quiesced snapshots.
However, subsequent stress testing has uncovered problems with this
approach when running on newer hosts; specifically, errors may sometimes
be encountered on newer hosts when sending VMBACKUP_EVENT_GENERIC_MANIFEST.
Therefore this change backs out that earlier change.

Note that the need to solve the problem that that earlier change was
intended to solve has been reduced because support for
VMBACKUP_EVENT_GENERIC_MANIFEST has been backported to vSphere 6.5
P03, which is available, and vSphere 6.0 P08, which is scheduled for
release later this year.  ESXi 5.5 is out of general support.

This change also addresses an issue that surfaced when testing on a
host without support for VMBACKUP_EVENT_GENERIC_MANIFEST.
If VMTools fails to send VMBACKUP_EVENT_GENERIC_MANIFEST, the quiesced
snapshot operation will be aborted rather than continuing as it should.
To address this, create a new function, VmBackup_SendEventNoAbort,
which does not abort the quiesced snapshot on failure, and call that
function rather than VmBackup_SendEvent when sending
VMBACKUP_EVENT_GENERIC_MANIFEST.

open-vm-tools/services/plugins/vmbackup/stateMachine.c
open-vm-tools/services/plugins/vmbackup/syncDriverOps.c
open-vm-tools/services/plugins/vmbackup/syncManifest.c
open-vm-tools/services/plugins/vmbackup/syncManifest.h
open-vm-tools/services/plugins/vmbackup/vmBackupInt.h

index eb724a89b4a1e7ba50d533ee3c65120fe4c7da6f..8647d97c0397f0274fe5a8df36f8c8330acb475b 100644 (file)
@@ -201,17 +201,19 @@ VmBackupPrivSendMsg(gchar *msg,
  * Sends a command to the VMX asking it to update VMDB about a new backup event.
  * This will restart the keep-alive timer.
  *
+ * As the name implies, does not abort the quiesce operation on failure.
+ *
  * @param[in]  event    The event to set.
  * @param[in]  code     Error code.
- * @param[in]  dest     Error description.
+ * @param[in]  desc     Error description.
  *
  * @return TRUE on success.
  */
 
 Bool
-VmBackup_SendEvent(const char *event,
-                   const uint32 code,
-                   const char *desc)
+VmBackup_SendEventNoAbort(const char *event,
+                          const uint32 code,
+                          const char *desc)
 {
    Bool success;
    char *result = NULL;
@@ -280,11 +282,6 @@ VmBackup_SendEvent(const char *event,
    } else {
       g_warning("Failed to send vmbackup event: %s, result: %s.\n",
                 msg, result);
-      if (gBackupState->rpcState != VMBACKUP_RPC_STATE_IGNORE) {
-         g_debug("Changing rpcState from %d to %d\n",
-                 gBackupState->rpcState, VMBACKUP_RPC_STATE_ERROR);
-         gBackupState->rpcState = VMBACKUP_RPC_STATE_ERROR;
-      }
    }
    vm_free(result);
    g_free(msg);
@@ -293,6 +290,36 @@ VmBackup_SendEvent(const char *event,
 }
 
 
+/**
+ * Sends a command to the VMX asking it to update VMDB about a new backup event.
+ * This will restart the keep-alive timer.
+ *
+ * Aborts the quiesce operation on RPC failure.
+ *
+ * @param[in]  event    The event to set.
+ * @param[in]  code     Error code.
+ * @param[in]  desc     Error description.
+ *
+ * @return TRUE on success.
+ */
+
+Bool
+VmBackup_SendEvent(const char *event,
+                   const uint32 code,
+                   const char *desc)
+{
+   Bool success = VmBackup_SendEventNoAbort(event, code, desc);
+
+   if (!success  && gBackupState->rpcState != VMBACKUP_RPC_STATE_IGNORE) {
+      g_debug("Changing rpcState from %d to %d\n",
+              gBackupState->rpcState, VMBACKUP_RPC_STATE_ERROR);
+      gBackupState->rpcState = VMBACKUP_RPC_STATE_ERROR;
+   }
+
+   return success;
+}
+
+
 /**
  * Cleans up the backup state object and sends a "done" event to the VMX.
  */
@@ -1361,7 +1388,7 @@ VmBackupDumpState(gpointer src,
 
 
 /**
- * Reset callback.
+ * Reset callback.  Currently does nothing.
  *
  * @param[in]  src      The source object.  Unused.
  * @param[in]  ctx      Unused.
@@ -1373,7 +1400,7 @@ VmBackupReset(gpointer src,
               ToolsAppCtx *ctx,
               gpointer data)
 {
-   VmBackup_SyncDriverReset();
+
 }
 
 
index 28fc63c452bf8419cbe09972742c415f3c771690..4245febae515a61135834f926238426f150fff10 100644 (file)
@@ -761,26 +761,3 @@ VmBackup_NewSyncDriverOnlyProvider(void)
 }
 
 #endif
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * VmBackup_SyncDriverReset --
- *
- *    Reset function
- *
- * Results:
- *    None.
- *
- * Side effects:
- *    Whatever are the side effects of what it calls.
- *
- *-----------------------------------------------------------------------------
- */
-
-void
-VmBackup_SyncDriverReset(void)
-{
-   SyncManifestReset();
-}
index 224f7e8aa7016323fcdeec30c450c83f3616cae2..4586c4c344b3a915a1c2f51bfb9bb6be272d8b55 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2017-2018 VMware, Inc. All rights reserved.
+ * Copyright (C) 2017-2019 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
@@ -49,12 +49,6 @@ static const char syncManifestFmt[] = {
  */
 static const char syncManifestSwitch[] = "enableXmlManifest";
 
-/*
- * If TRUE, indicates that VMTools should try to generate the backup
- * manifest and send it to VMX; if FALSE, it won't try to do so.
- */
-static Bool gSyncManifestTrySend = TRUE;
-
 
 /*
  *-----------------------------------------------------------------------------
@@ -95,12 +89,6 @@ SyncNewManifest(VmBackupState *state,          // IN
       return NULL;
    }
 
-   if (!gSyncManifestTrySend) {
-      g_debug("No backup manifest generated since previous"
-              " attempt to send one to host failed.\n");
-      return NULL;
-   }
-
    manifest = g_new0(SyncManifest, 1);
    manifest->path = g_strdup_printf("%s/%s", state->configDir,
                                     syncManifestName);
@@ -173,37 +161,14 @@ SyncManifestSend(SyncManifest *manifest)       // IN
       return FALSE;
    }
 
-   if (!VmBackup_SendEvent(VMBACKUP_EVENT_GENERIC_MANIFEST,
-                           VMBACKUP_SUCCESS, manifest->path)) {
-      g_warning("Host doesn't appear to support backup manifests "
-                "for Linux guests.\n");
-      gSyncManifestTrySend = FALSE;
+   if (!VmBackup_SendEventNoAbort(VMBACKUP_EVENT_GENERIC_MANIFEST,
+                                  VMBACKUP_SUCCESS, manifest->path)) {
+      /* VmBackup_SendEventNoAbort logs the error */
+      g_info("Non-fatal error occurred while sending %s, continuing "
+             "with the operation", VMBACKUP_EVENT_GENERIC_MANIFEST);
       return FALSE;
    }
 
    g_debug("Backup manifest was sent successfully.\n");
    return TRUE;
 }
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * SyncManifestReset --
- *
- *    Reset SyncManifest global state
- *
- * Results:
- *    None
- *
- * Side effects:
- *    None
- *
- *-----------------------------------------------------------------------------
- */
-
-void
-SyncManifestReset(void)
-{
-   gSyncManifestTrySend = TRUE;
-}
index 9e4e9eb3022653183cfdff9ece898e5cd230f3d3..fd226adbd1bd9e16d31ff80733e4e3f44f0357d9 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2017-2018 VMware, Inc. All rights reserved.
+ * Copyright (C) 2017-2019 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
@@ -45,9 +45,6 @@ SyncManifestSend(SyncManifest *manifest);
 void
 SyncManifestRelease(SyncManifest *manifest);
 
-void
-SyncManifestReset(void);
-
 #else /* !defined(__linux__) */
 
 typedef void SyncManifest;
@@ -55,7 +52,6 @@ typedef void SyncManifest;
 #define SyncNewManifest(s, h)            (NULL)
 #define SyncManifestSend(m)              (TRUE)
 #define SyncManifestRelease(m)           ASSERT(m == NULL)
-#define SyncManifestReset()
 
 #endif /* defined(__linux__) */
 
index 948bcb88b94a7ea7f89cd6ab58bde26da03d626f..7fbd3b312d2cfb75b0359f1db0dd90ad1e2941f0 100644 (file)
@@ -303,8 +303,11 @@ VmBackup_SendEvent(const char *event,
                    const uint32 code,
                    const char *desc);
 
-void
-VmBackup_SyncDriverReset(void);
+
+Bool
+VmBackup_SendEventNoAbort(const char *event,
+                          const uint32 code,
+                          const char *desc);
 
 #endif /* _VMBACKUPINT_H_*/