Skip to content

Commit

Permalink
Always send VMBACKUP_EVENT_GENERIC_MANIFEST during quiesced snapshots.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
oliverkurth committed Feb 1, 2019
1 parent 0c91747 commit c31710b
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 82 deletions.
49 changes: 38 additions & 11 deletions open-vm-tools/services/plugins/vmbackup/stateMachine.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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.
*/
Expand Down Expand Up @@ -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.
Expand All @@ -1373,7 +1400,7 @@ VmBackupReset(gpointer src,
ToolsAppCtx *ctx,
gpointer data)
{
VmBackup_SyncDriverReset();

}


Expand Down
23 changes: 0 additions & 23 deletions open-vm-tools/services/plugins/vmbackup/syncDriverOps.c
Expand Up @@ -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();
}
47 changes: 6 additions & 41 deletions 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
Expand Down Expand Up @@ -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;


/*
*-----------------------------------------------------------------------------
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
6 changes: 1 addition & 5 deletions 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
Expand Down Expand Up @@ -45,17 +45,13 @@ SyncManifestSend(SyncManifest *manifest);
void
SyncManifestRelease(SyncManifest *manifest);

void
SyncManifestReset(void);

#else /* !defined(__linux__) */

typedef void SyncManifest;

#define SyncNewManifest(s, h) (NULL)
#define SyncManifestSend(m) (TRUE)
#define SyncManifestRelease(m) ASSERT(m == NULL)
#define SyncManifestReset()

#endif /* defined(__linux__) */

Expand Down
7 changes: 5 additions & 2 deletions open-vm-tools/services/plugins/vmbackup/vmBackupInt.h
Expand Up @@ -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_*/

0 comments on commit c31710b

Please sign in to comment.