summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVMware, Inc <>2013-09-17 20:38:49 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2013-09-22 22:26:42 -0700
commit63b4fa8d551de8e90101b6de4646d8573f764329 (patch)
treeeec0302459765def044d732041643a20b55c0ae0
parentac4e72c01eec5565d3ac8d0c84cb4072d9e3e08e (diff)
Internal branch sync. Included in this change:
. Support Linux Quiescing for vSphere Replication . changes in shared code that don't affect open-vm-tools functionality Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
-rw-r--r--open-vm-tools/lib/file/file.c49
-rw-r--r--open-vm-tools/lib/include/file.h2
-rw-r--r--open-vm-tools/lib/include/vm_basic_defs.h10
-rw-r--r--open-vm-tools/lib/include/vm_product_versions.h6
-rw-r--r--open-vm-tools/services/plugins/vmbackup/Makefile.am12
-rw-r--r--open-vm-tools/services/plugins/vmbackup/guestQuiesce.x48
-rw-r--r--open-vm-tools/services/plugins/vmbackup/stateMachine.c36
7 files changed, 145 insertions, 18 deletions
diff --git a/open-vm-tools/lib/file/file.c b/open-vm-tools/lib/file/file.c
index 3b9412ce..569e231f 100644
--- a/open-vm-tools/lib/file/file.c
+++ b/open-vm-tools/lib/file/file.c
@@ -689,6 +689,55 @@ File_IsEmptyDirectory(ConstUnicode pathName) // IN:
/*
+ *----------------------------------------------------------------------------
+ *
+ * File_IsOsfsVolumeEmpty --
+ *
+ * Check if specified OSFS volume contains no files.
+ * This method ignore hidden .sf files. *.sf files are VMFS
+ * metadata files.
+ *
+ * OSFS based volumes are considered empty even if they
+ * contain vmfs metadata files. This emptiness can not be
+ * checked by File_IsEmptyDirectory API (PR 1050328).
+ *
+ * Results:
+ * Bool - TRUE -> is vmfs empty directory, FALSE -> not an vmfs
+ * empty directory
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------------
+ */
+
+Bool
+File_IsOsfsVolumeEmpty(ConstUnicode pathName) // IN:
+{
+ int i, numFiles;
+ Unicode *fileList = NULL;
+ static const char vmfsSystemFilesuffix[] = ".sf";
+ Bool onlyVmfsSystemFilesFound = TRUE;
+
+ numFiles = File_ListDirectory(pathName, &fileList);
+ if (numFiles == -1) {
+ return FALSE;
+ }
+
+ for (i = 0; i < numFiles; i++) {
+ if (!Unicode_EndsWith(fileList[i], vmfsSystemFilesuffix)) {
+ onlyVmfsSystemFilesFound = FALSE;
+ break;
+ }
+ }
+
+ Unicode_FreeList(fileList, numFiles);
+
+ return onlyVmfsSystemFilesFound;
+}
+
+
+/*
*----------------------------------------------------------------------
*
* File_IsFile --
diff --git a/open-vm-tools/lib/include/file.h b/open-vm-tools/lib/include/file.h
index 19eb04c2..caa6cfcf 100644
--- a/open-vm-tools/lib/include/file.h
+++ b/open-vm-tools/lib/include/file.h
@@ -183,6 +183,8 @@ Bool File_DeleteDirectoryTree(ConstUnicode pathName);
int File_ListDirectory(ConstUnicode pathName,
Unicode **ids);
+Bool File_IsOsfsVolumeEmpty(ConstUnicode pathName);
+
/*
* Simple file-system walk.
*/
diff --git a/open-vm-tools/lib/include/vm_basic_defs.h b/open-vm-tools/lib/include/vm_basic_defs.h
index 84f4e33d..6f21f033 100644
--- a/open-vm-tools/lib/include/vm_basic_defs.h
+++ b/open-vm-tools/lib/include/vm_basic_defs.h
@@ -297,9 +297,17 @@ Max(int a, int b)
#define MBYTES_2_BYTES(_nbytes) ((uint64)(_nbytes) << 20)
#endif
+#ifndef BYTES_2_GBYTES
+#define BYTES_2_GBYTES(_nbytes) ((_nbytes) >> 30)
+#endif
+
+#ifndef GBYTES_2_BYTES
+#define GBYTES_2_BYTES(_nbytes) ((uint64)(_nbytes) << 30)
+#endif
+
#ifndef VM_PAE_LARGE_PAGE_SHIFT
#define VM_PAE_LARGE_PAGE_SHIFT 21
-#endif
+#endif
#ifndef VM_PAE_LARGE_PAGE_SIZE
#define VM_PAE_LARGE_PAGE_SIZE (1 << VM_PAE_LARGE_PAGE_SHIFT)
diff --git a/open-vm-tools/lib/include/vm_product_versions.h b/open-vm-tools/lib/include/vm_product_versions.h
index a010c223..d14b9998 100644
--- a/open-vm-tools/lib/include/vm_product_versions.h
+++ b/open-vm-tools/lib/include/vm_product_versions.h
@@ -336,7 +336,7 @@
# define PRODUCT_LICENSE_VERSION "0.0"
#else
# if defined(VMX86_SERVER)
-# define PRODUCT_LICENSE_VERSION "5.0"
+# define PRODUCT_LICENSE_VERSION "6.0"
# elif defined(VMX86_WGS_MIGRATION)
# define PRODUCT_LICENSE_VERSION "1.0"
# elif defined(VMX86_WGS)
@@ -350,8 +350,8 @@
# define PRODUCT_LICENSE_VERSION "10.0"
# endif
# elif defined(VMX86_VPX)
-# define PRODUCT_LICENSE_VERSION "5.0"
-# define PRODUCT_LICENSE_FILE_VERSION "5.5.0.1"
+# define PRODUCT_LICENSE_VERSION "6.0"
+# define PRODUCT_LICENSE_FILE_VERSION "6.0.0.0"
# elif defined(VMX86_WBC)
# define PRODUCT_LICENSE_VERSION "1.0"
# elif defined(VMX86_SDK)
diff --git a/open-vm-tools/services/plugins/vmbackup/Makefile.am b/open-vm-tools/services/plugins/vmbackup/Makefile.am
index d78eda6e..2babc4ce 100644
--- a/open-vm-tools/services/plugins/vmbackup/Makefile.am
+++ b/open-vm-tools/services/plugins/vmbackup/Makefile.am
@@ -38,14 +38,26 @@ libvmbackup_la_SOURCES += vmBackupSignals.c
BUILT_SOURCES =
BUILT_SOURCES += vmBackupSignals.c
BUILT_SOURCES += vmBackupSignals.h
+BUILT_SOURCES += guestQuiesce.h
+BUILT_SOURCES += guestQuiesce_xdr.c
CLEANFILES =
CLEANFILES += vmBackupSignals.c
CLEANFILES += vmBackupSignals.h
+CLEANFILES += guestQuiesce.h
+CLEANFILES += guestQuiesce_xdr.c
EXTRA_DIST =
EXTRA_DIST += vmBackupSignals.gm
+libvmbackup_la_SOURCES += guestQuiesce_xdr.c
+
+guestQuiesce.h: guestQuiesce.x
+ @RPCGEN_WRAPPER@ services/plugins/vmbackup/guestQuiesce.x $@
+
+guestQuiesce_xdr.c: guestQuiesce.x guestQuiesce.h
+ @RPCGEN_WRAPPER@ services/plugins/vmbackup/guestQuiesce.x $@
+
vmBackupSignals.c: $(top_srcdir)/services/plugins/vmbackup/vmBackupSignals.gm
glib-genmarshal --body $(top_srcdir)/services/plugins/vmbackup/vmBackupSignals.gm > \
$@ || (rm -f $@ && exit 1)
diff --git a/open-vm-tools/services/plugins/vmbackup/guestQuiesce.x b/open-vm-tools/services/plugins/vmbackup/guestQuiesce.x
new file mode 100644
index 00000000..3aefef8c
--- /dev/null
+++ b/open-vm-tools/services/plugins/vmbackup/guestQuiesce.x
@@ -0,0 +1,48 @@
+/*********************************************************
+ * Copyright (C) 2010 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
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ *********************************************************/
+
+/*
+ * guestQuiesce.x --
+ *
+ * Definition of the data structures used in the GuestRpc commands to
+ * provide information about guest quiescing settings.
+ */
+
+enum GuestQuiesceParamsVersion {
+ GUESTQUIESCEPARAMS_V1 = 1
+};
+
+const GUESTQUIESCE_SCRIPTARG_MAX_LEN = 256;
+const GUESTQUIESCE_DISKUUID_MAX_LEN = 3200; /* (UUID_MAXLEN + 1) * 64 disks */
+
+/* Guest Quiescing parameters. */
+struct GuestQuiesceParamsV1 {
+ Bool createManifest; /* Create manifest describing the operations */
+ Bool quiesceApps; /* Allow application quiescing */
+ Bool quiesceFS; /* Allow file system quiescing */
+ Bool writableSnapshot; /* Assume writable snapshot is allowed */
+ Bool execScripts; /* Run custom scripts created by the users */
+ string scriptArg<GUESTQUIESCE_SCRIPTARG_MAX_LEN>; /* Argument to scripts */
+ uint32 timeout; /* Time out for the quiesce operation*/
+ string diskUuids<GUESTQUIESCE_DISKUUID_MAX_LEN>; /* disk Uuids */
+};
+
+union GuestQuiesceParams switch (GuestQuiesceParamsVersion ver) {
+case GUESTQUIESCEPARAMS_V1:
+ struct GuestQuiesceParamsV1 *guestQuiesceParamsV1;
+};
diff --git a/open-vm-tools/services/plugins/vmbackup/stateMachine.c b/open-vm-tools/services/plugins/vmbackup/stateMachine.c
index a17fda08..bbd6b778 100644
--- a/open-vm-tools/services/plugins/vmbackup/stateMachine.c
+++ b/open-vm-tools/services/plugins/vmbackup/stateMachine.c
@@ -43,9 +43,7 @@
#include "strutil.h"
#include "util.h"
#include "vmBackupSignals.h"
-#if defined(_WIN32)
-#include "vmware/guestrpc/guestQuiesce.h"
-#endif
+#include "guestQuiesce.h"
#include "vmware/tools/utils.h"
#include "vmware/tools/vmbackup.h"
#include "xdrutil.h"
@@ -572,15 +570,17 @@ VmBackupConfigGetBoolean(GKeyFile *config,
* Starts the quiesce operation according to the supplied specification unless
* some unexpected error occurs.
*
- * @param[in] data RPC data.
- * @param[in] forceVss Only allow Vss quiescing or no quiescing.
+ * @param[in] data RPC data.
+ * @param[in] forceQuiesce Only allow Vss quiescing on Windows platform or
+ * SyncDriver quiescing on Linux platform ( only file
+ * system quiescing )
*
* @return TRUE on success.
*/
static gboolean
VmBackupStartCommon(RpcInData *data,
- gboolean forceVss)
+ gboolean forceQuiesce)
{
GError *err = NULL;
ToolsAppCtx *ctx = data->appCtx;
@@ -600,12 +600,24 @@ VmBackupStartCommon(RpcInData *data,
{ VmBackup_NewNullProvider, NULL },
};
- if (forceVss) {
+ if (forceQuiesce) {
if (gBackupState->quiesceApps || gBackupState->quiesceFS) {
- /* If quiescing is requested, only allow VSS provider */
+ /*
+ * If quiescing is requested on windows platform,
+ * only allow VSS provider
+ */
#if defined(_WIN32)
- if (VmBackupConfigGetBoolean(ctx->config, "enableVSS", TRUE)) {
- provider = VmBackup_NewVssProvider();
+ if (VmBackupConfigGetBoolean(ctx->config, "enableVSS", TRUE)) {
+ provider = VmBackup_NewVssProvider();
+ }
+#elif defined(_LINUX) || defined(__linux__)
+ /*
+ * If quiescing is requested on linux platform,
+ * only allow SyncDriver provider
+ */
+ if (gBackupState->quiesceFS &&
+ VmBackupConfigGetBoolean(ctx->config, "enableSyncDriver", TRUE)) {
+ provider = VmBackup_NewSyncDriverProvider();
}
#endif
} else {
@@ -760,7 +772,6 @@ VmBackupStart(RpcInData *data)
return VmBackupStartCommon(data, FALSE);
}
-#if defined(_WIN32)
/**
* Handler for the "vmbackup.startWithOpts" message. Starts processing the
@@ -827,7 +838,6 @@ VmBackupStartWithOpts(RpcInData *data)
return retval;
}
-#endif
/**
* Aborts the current operation if one is active, and stops the backup
@@ -973,11 +983,9 @@ ToolsOnLoad(ToolsAppCtx *ctx)
RpcChannelCallback rpcs[] = {
{ VMBACKUP_PROTOCOL_START, VmBackupStart, NULL, NULL, NULL, 0 },
-#if defined(_WIN32)
/* START_WITH_OPTS command supported only on Windows for now */
{ VMBACKUP_PROTOCOL_START_WITH_OPTS, VmBackupStartWithOpts, NULL,
xdr_GuestQuiesceParams, NULL, sizeof (GuestQuiesceParams) },
-#endif
{ VMBACKUP_PROTOCOL_ABORT, VmBackupAbort, NULL, NULL, NULL, 0 },
{ VMBACKUP_PROTOCOL_SNAPSHOT_DONE, VmBackupSnapshotDone, NULL, NULL, NULL, 0 }
};