From: Oliver Kurth Date: Tue, 19 Feb 2019 20:51:31 +0000 (-0800) Subject: Always send VMBACKUP_EVENT_GENERIC_MANIFEST during quiesced snapshots. X-Git-Tag: stable-11.0.0~221 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a60e9573885f1ef339cf1bfc19cfb7bc1912122;p=thirdparty%2Fopen-vm-tools.git Always send VMBACKUP_EVENT_GENERIC_MANIFEST during quiesced snapshots. 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. --- diff --git a/open-vm-tools/services/plugins/vmbackup/stateMachine.c b/open-vm-tools/services/plugins/vmbackup/stateMachine.c index eb724a89b..8647d97c0 100644 --- a/open-vm-tools/services/plugins/vmbackup/stateMachine.c +++ b/open-vm-tools/services/plugins/vmbackup/stateMachine.c @@ -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(); + } diff --git a/open-vm-tools/services/plugins/vmbackup/syncDriverOps.c b/open-vm-tools/services/plugins/vmbackup/syncDriverOps.c index 28fc63c45..4245febae 100644 --- a/open-vm-tools/services/plugins/vmbackup/syncDriverOps.c +++ b/open-vm-tools/services/plugins/vmbackup/syncDriverOps.c @@ -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(); -} diff --git a/open-vm-tools/services/plugins/vmbackup/syncManifest.c b/open-vm-tools/services/plugins/vmbackup/syncManifest.c index 224f7e8aa..4586c4c34 100644 --- a/open-vm-tools/services/plugins/vmbackup/syncManifest.c +++ b/open-vm-tools/services/plugins/vmbackup/syncManifest.c @@ -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; -} diff --git a/open-vm-tools/services/plugins/vmbackup/syncManifest.h b/open-vm-tools/services/plugins/vmbackup/syncManifest.h index 9e4e9eb30..fd226adbd 100644 --- a/open-vm-tools/services/plugins/vmbackup/syncManifest.h +++ b/open-vm-tools/services/plugins/vmbackup/syncManifest.h @@ -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__) */ diff --git a/open-vm-tools/services/plugins/vmbackup/vmBackupInt.h b/open-vm-tools/services/plugins/vmbackup/vmBackupInt.h index 948bcb88b..7fbd3b312 100644 --- a/open-vm-tools/services/plugins/vmbackup/vmBackupInt.h +++ b/open-vm-tools/services/plugins/vmbackup/vmBackupInt.h @@ -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_*/