From: Oliver Kurth Date: Tue, 4 Sep 2018 22:40:59 +0000 (-0700) Subject: Reduce quiesced snapshot warning messages when running on older hosts. X-Git-Tag: stable-11.0.0~401 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=542046b5d4aa64e254da832b7d8c1ad6eefe2275;p=thirdparty%2Fopen-vm-tools.git Reduce quiesced snapshot warning messages when running on older hosts. vSphere 6.7 added a new interface on the host side that allows tools to send a "generic" backup manifest during a quiesced snapshot on Linux guests. VMTools 10.2.0 or later will try to send the manifest file and if the host is unable to field it, then VMTools logs this information and continues with the quiesced snapshot in the older fashion. This change reduces the logging that is done in this case. --- diff --git a/open-vm-tools/services/plugins/vmbackup/stateMachine.c b/open-vm-tools/services/plugins/vmbackup/stateMachine.c index 89a907ca5..ebeaf42b6 100644 --- a/open-vm-tools/services/plugins/vmbackup/stateMachine.c +++ b/open-vm-tools/services/plugins/vmbackup/stateMachine.c @@ -1333,9 +1333,9 @@ VmBackupDumpState(gpointer src, /** - * Reset callback. Currently does nothing. + * Reset callback. * - * @param[in] src The source object. + * @param[in] src The source object. Unused. * @param[in] ctx Unused. * @param[in] data Unused. */ @@ -1345,6 +1345,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 65994e7a7..9f5844439 100644 --- a/open-vm-tools/services/plugins/vmbackup/syncDriverOps.c +++ b/open-vm-tools/services/plugins/vmbackup/syncDriverOps.c @@ -642,3 +642,26 @@ 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 e63ae777a..224f7e8aa 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 VMware, Inc. All rights reserved. + * Copyright (C) 2017-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 @@ -49,6 +49,12 @@ 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; + /* *----------------------------------------------------------------------------- @@ -89,6 +95,12 @@ 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); @@ -163,9 +175,35 @@ SyncManifestSend(SyncManifest *manifest) // IN if (!VmBackup_SendEvent(VMBACKUP_EVENT_GENERIC_MANIFEST, VMBACKUP_SUCCESS, manifest->path)) { - g_warning("Error trying to send VMBACKUP_EVENT_GENERIC_MANIFEST.\n"); + g_warning("Host doesn't appear to support backup manifests " + "for Linux guests.\n"); + gSyncManifestTrySend = FALSE; 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 76966ccac..9e4e9eb30 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 VMware, Inc. All rights reserved. + * Copyright (C) 2017-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 @@ -45,6 +45,9 @@ SyncManifestSend(SyncManifest *manifest); void SyncManifestRelease(SyncManifest *manifest); +void +SyncManifestReset(void); + #else /* !defined(__linux__) */ typedef void SyncManifest; @@ -52,6 +55,7 @@ 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 6a5bbcddc..7b819ac15 100644 --- a/open-vm-tools/services/plugins/vmbackup/vmBackupInt.h +++ b/open-vm-tools/services/plugins/vmbackup/vmBackupInt.h @@ -295,5 +295,8 @@ VmBackup_SendEvent(const char *event, const uint32 code, const char *desc); +void +VmBackup_SyncDriverReset(void); + #endif /* _VMBACKUPINT_H_*/