open-vm-tools/send_vmbackup_event_generic_manifest.patch
Kirk Allan 062860c7b1 Accepting request 672900 from home:kallan:branches:Virtualization:VMware
- Link VGAuthService to libxmlsec1 rather than libxml-security-c in SLE
  products where available. (bsc#1122435)
- Add patches to correct and/or improve handling of certain quiesced snapshot
  failures (bsc#1124397).
  + no_manifest_on_aborted_snapshot.patch
    Don't send a backup manifest when aborting a Linux quiesced snapshot.
  + vmtoolsd_bailout_on_rpc_errors.patch
    Bail out vmtoolsd early when there are RPC errors.
  + send_vmbackup_event_generic_manifest.patch
    Always send VMBACKUP_EVENT_GENERIC_MANIFEST during quiesced snapshots.
  + include_log_h_for_g_info.patch
    Include vmware/tools/log.h to define g_info.

- Update vmtoolsd.service to support cloud-init customization by default  
  by adding "DefaultDependencies=no" and "Before=cloud-init-local.service"
  to the [Unit] section of vmtoolsd.service (bsc#1121964) .
- Copyright year updated in spec file.

OBS-URL: https://build.opensuse.org/request/show/672900
OBS-URL: https://build.opensuse.org/package/show/Virtualization:VMware/open-vm-tools?expand=0&rev=366
2019-02-08 22:36:39 +00:00

292 lines
10 KiB
Diff

commit c31710b3942f48b1c11ebde36f34e7e159d1cbf0
Author: Oliver Kurth <okurth@vmware.com>
Date: Tue Jan 29 17:24:44 2019 -0800
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 28118172..d38187d1 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 1dd98e32..d659f1b4 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 224f7e8a..4586c4c3 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 9e4e9eb3..fd226adb 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 4258ee0a..97fef214 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_*/