*
* FileVMFSGetCanonicalPath --
*
- * Given an absolute pathname of a VM directory, return its canonical
+ * Given an absolute pathname of a VM directory/file, return its canonical
* pathname.
*
* Canonical name for a VM directory has a special significance only for
* NFS config VVol. The max number of directory components it'll check
* is MAX_SUBDIR_LEVEL.
*
+ * It can also be called with 'absVMDirName' referring to a file
+ * (typically vmdk) and not a directory. The file can even be non-existent,
+ * f.e. it can correctly resolve
+ * /vmfs/volumes/nfs_pe_2/vvol36/meta_vvol36/DataVVol.vmdk to
+ * /vmfs/volumes/vvol:26acd2ae55ea49c3-87dd47a44e4f327/rfc4122.d140c97a-7208-474e-95c7-a4ee6cac7f15/DataVVol.vmdk
+ * for non-existent file DataVVol.vmdk.
+ * This workflow is typical when a new vmdk is being created
+ * f.e. by diskCreate.
+ *
* Note:
* 'absVMDirName' should not have extra slashes in the name. This will
* be true if we have gotten it from Posix_RealPath or friends.
Unicode currDir = NULL;
/*
* This holds the path fragment after the NFS config VVol. This will be
- * non-empty only in the case when absVMDirName refers to some subdir
- * inside the NFS config VVol directory. We keep collecting the path
- * components as we change currDir one level at a time.
+ * non-empty in the case when absVMDirName refers to some subdir
+ * inside the NFS config VVol directory or it refers to a file (and not
+ * a directory). We keep collecting the path components as we change
+ * currDir one level at a time, and in the end append it to the resolved
+ * pathname before returning to the caller.
*/
Unicode dirPath = NULL;
Unicode canonPath = NULL; /* result */
goto use_same_path;
}
+ /*
+ * If not already a directory, get the containing directory since the
+ * rest of the code works best on the containing directory, for following
+ * reasons:
+ *
+ * 1. File may be non-existent (diskCreate workflow).
+ * 2. File open may fail because of exclusive open by another process.
+ * Directory open does not have this problem.
+ */
+ if (!File_IsDirectory(absVMDirName)) {
+ File_GetPathName(absVMDirName, &currDir, &dirPath);
+ ASSERT(currDir);
+ ASSERT(dirPath);
+ }
+
/*
* Only NFS config vvols can have a canonical name different from the
* absolute pathname provided. This will do the validity check also.
+ * Note that we make use of the fact that a file is on the same filesystem
+ * as it's containing directory.
*/
- if (File_GetVMFSFSType(absVMDirName, -1, &fsType) != 0 ||
+ if (File_GetVMFSFSType(currDir ? currDir : absVMDirName, -1, &fsType) != 0 ||
(fsType != NFSCLIENT_FSTYPENUM && fsType != NFS41CLIENT_FSTYPENUM)) {
goto use_same_path;
}
goto use_same_path;
}
- /*
- * If the user has passed a filename (instead of a dirname) we
- * cannot pass it as-is to the ioctl as it works on a directory
- * name.
- */
- if (!File_IsDirectory(absVMDirName)) {
- File_GetPathName(absVMDirName, &currDir, &dirPath);
- ASSERT(currDir);
- ASSERT(dirPath);
- }
-
/*
* VM directory is on an NFS fileystem. It could be a regular NFS filesystem
* backed storage or an NFS config VVol. We need to check.
Unicode pathname, basename;
Unicode_CopyBytes(getCanonArgs->absNFSPath,
- currDir ? : absVMDirName,
+ currDir ? currDir : absVMDirName,
sizeof(getCanonArgs->absNFSPath),
NULL, STRING_ENCODING_UTF8);
/*
* Try the next level dir.
*/
- File_GetPathName(currDir ? : absVMDirName, &pathname, &basename);
+ File_GetPathName(currDir ? currDir : absVMDirName, &pathname, &basename);
Unicode_Free(currDir);
currDir = pathname;
/*
}
} while (searchDepth-- > 0);
- canonPath = Unicode_Format("%s%s", getCanonArgs->canonPath, dirPath ? : "");
+ canonPath = Unicode_Format("%s%s", getCanonArgs->canonPath,
+ dirPath ? dirPath : "");
done:
close(ctrlfd);
VIX_COMMAND_CATEGORY_ALWAYS_ALLOWED),
VIX_DEFINE_COMMAND_INFO(VIX_COMMAND_SET_GUEST_NETWORKING_CONFIG,
VIX_COMMAND_CATEGORY_ALWAYS_ALLOWED),
- VIX_DEFINE_COMMAND_INFO(VIX_COMMAND_FAULT_TOLERANCE_REGISTER,
- VIX_COMMAND_CATEGORY_PRIVILEGED),
- VIX_DEFINE_COMMAND_INFO(VIX_COMMAND_FAULT_TOLERANCE_UNREGISTER,
- VIX_COMMAND_CATEGORY_PRIVILEGED),
- VIX_DEFINE_COMMAND_INFO(VIX_COMMAND_FAULT_TOLERANCE_CONTROL,
- VIX_COMMAND_CATEGORY_PRIVILEGED),
- VIX_DEFINE_COMMAND_INFO(VIX_COMMAND_FAULT_TOLERANCE_QUERY_SECONDARY,
- VIX_COMMAND_CATEGORY_PRIVILEGED),
+ VIX_DEFINE_UNUSED_COMMAND,
+ VIX_DEFINE_UNUSED_COMMAND,
+ VIX_DEFINE_UNUSED_COMMAND,
+ VIX_DEFINE_UNUSED_COMMAND,
VIX_DEFINE_COMMAND_INFO(VIX_COMMAND_VM_PAUSE,
VIX_COMMAND_CATEGORY_PRIVILEGED),
VIX_DEFINE_COMMAND_INFO(VIX_COMMAND_VM_UNPAUSE,
VIX_RESPONSE_TRUNCATED = 0x0004,
VIX_RESPONSE_FSR = 0x0008,
VIX_RESPONSE_VMDB_NOTIFICATION_POSTED = 0x0010,
+ VIX_RESPONSE_VIGOR_COMMAND = 0x0020,
};
#include "vmware_pack_end.h"
VixMsgDebuggerEvent;
-/*
- * Fault Tolerance Automation
- */
-typedef
-#include "vmware_pack_begin.h"
-struct VixMsgFaultToleranceControlRequest {
- VixCommandRequestHeader requestHeader;
-
- int32 command;
- char uuid[48];
- uint32 vmxPathLen;
- char vmxFilePath[1];
-}
-#include "vmware_pack_end.h"
-VixMsgFaultToleranceControlRequest;
-
-typedef
-#include "vmware_pack_begin.h"
-struct VixFaultToleranceControlResponse {
- VixCommandResponseHeader header;
- uint32 propertyListBufferSize;
- // Followed by a serialized property list containing error context.
-}
-#include "vmware_pack_end.h"
-VixFaultToleranceControlResponse;
-
/*
* **********************************************************
VIX_COMMAND_GET_GUEST_NETWORKING_CONFIG = 116,
VIX_COMMAND_SET_GUEST_NETWORKING_CONFIG = 117,
- VIX_COMMAND_FAULT_TOLERANCE_REGISTER = 118,
- VIX_COMMAND_FAULT_TOLERANCE_UNREGISTER = 119,
- VIX_COMMAND_FAULT_TOLERANCE_CONTROL = 120,
- VIX_COMMAND_FAULT_TOLERANCE_QUERY_SECONDARY = 121,
+ /* DEPRECATED VIX_COMMAND_FAULT_TOLERANCE_REGISTER = 118, */
+ /* DEPRECATED VIX_COMMAND_FAULT_TOLERANCE_UNREGISTER = 119, */
+ /* DEPRECATED VIX_COMMAND_FAULT_TOLERANCE_CONTROL = 120, */
+ /* DEPRECATED VIX_COMMAND_FAULT_TOLERANCE_QUERY_SECONDARY = 121, */
VIX_COMMAND_VM_PAUSE = 122,
VIX_COMMAND_VM_UNPAUSE = 123,