From: VMware, Inc <> Date: Fri, 12 Apr 2013 19:53:16 +0000 (-0700) Subject: Internal branch sync. Included in this change: X-Git-Tag: 2013.04.16-1098359~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=55dcd86cc2ac05fedca0098d1e3a767c49375d8b;p=thirdparty%2Fopen-vm-tools.git Internal branch sync. Included in this change: . VIX: remove APIs to control FT . changes in shared code that don't affect open-vm-tools functionality Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/lib/file/filePosix.c b/open-vm-tools/lib/file/filePosix.c index a5be78031..a4ff4a01d 100644 --- a/open-vm-tools/lib/file/filePosix.c +++ b/open-vm-tools/lib/file/filePosix.c @@ -578,7 +578,7 @@ FileStripFwdSlashes(ConstUnicode pathName) // IN: * * 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 @@ -598,6 +598,15 @@ FileStripFwdSlashes(ConstUnicode pathName) // IN: * 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. @@ -638,9 +647,11 @@ FileVMFSGetCanonicalPath(ConstUnicode absVMDirName) // IN 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 */ @@ -652,11 +663,28 @@ FileVMFSGetCanonicalPath(ConstUnicode absVMDirName) // IN 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; } @@ -671,17 +699,6 @@ FileVMFSGetCanonicalPath(ConstUnicode absVMDirName) // IN 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. @@ -703,7 +720,7 @@ FileVMFSGetCanonicalPath(ConstUnicode absVMDirName) // IN Unicode pathname, basename; Unicode_CopyBytes(getCanonArgs->absNFSPath, - currDir ? : absVMDirName, + currDir ? currDir : absVMDirName, sizeof(getCanonArgs->absNFSPath), NULL, STRING_ENCODING_UTF8); @@ -729,7 +746,7 @@ FileVMFSGetCanonicalPath(ConstUnicode absVMDirName) // IN /* * Try the next level dir. */ - File_GetPathName(currDir ? : absVMDirName, &pathname, &basename); + File_GetPathName(currDir ? currDir : absVMDirName, &pathname, &basename); Unicode_Free(currDir); currDir = pathname; /* @@ -753,7 +770,8 @@ FileVMFSGetCanonicalPath(ConstUnicode absVMDirName) // IN } } while (searchDepth-- > 0); - canonPath = Unicode_Format("%s%s", getCanonArgs->canonPath, dirPath ? : ""); + canonPath = Unicode_Format("%s%s", getCanonArgs->canonPath, + dirPath ? dirPath : ""); done: close(ctrlfd); diff --git a/open-vm-tools/lib/foundryMsg/foundryMsg.c b/open-vm-tools/lib/foundryMsg/foundryMsg.c index da06ba91d..16e962026 100644 --- a/open-vm-tools/lib/foundryMsg/foundryMsg.c +++ b/open-vm-tools/lib/foundryMsg/foundryMsg.c @@ -291,14 +291,10 @@ static const VixCommandInfo vixCommandInfoTable[] = { 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, diff --git a/open-vm-tools/lib/include/vixCommands.h b/open-vm-tools/lib/include/vixCommands.h index d5fdd299b..38d911023 100644 --- a/open-vm-tools/lib/include/vixCommands.h +++ b/open-vm-tools/lib/include/vixCommands.h @@ -120,6 +120,7 @@ enum VixResponseFlagsValues { VIX_RESPONSE_TRUNCATED = 0x0004, VIX_RESPONSE_FSR = 0x0008, VIX_RESPONSE_VMDB_NOTIFICATION_POSTED = 0x0010, + VIX_RESPONSE_VIGOR_COMMAND = 0x0020, }; @@ -1153,32 +1154,6 @@ struct VixMsgDebuggerEvent { #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; - /* * ********************************************************** @@ -2318,10 +2293,10 @@ enum { 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,