}
+/*
+ *----------------------------------------------------------------------------
+ *
+ * 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;
+}
+
+
/*
*----------------------------------------------------------------------
*
int File_ListDirectory(ConstUnicode pathName,
Unicode **ids);
+Bool File_IsOsfsVolumeEmpty(ConstUnicode pathName);
+
/*
* Simple file-system walk.
*/
#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)
# 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)
# 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)
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)
--- /dev/null
+/*********************************************************
+ * 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;
+};
#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"
* 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;
{ 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 {
return VmBackupStartCommon(data, FALSE);
}
-#if defined(_WIN32)
/**
* Handler for the "vmbackup.startWithOpts" message. Starts processing the
return retval;
}
-#endif
/**
* Aborts the current operation if one is active, and stops the backup
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 }
};