]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Internal branch sync. Included in this change:
authorVMware, Inc <>
Fri, 12 Apr 2013 19:53:16 +0000 (12:53 -0700)
committerDmitry Torokhov <dtor@vmware.com>
Wed, 17 Apr 2013 19:16:55 +0000 (12:16 -0700)
. VIX: remove APIs to control FT
. changes in shared code that don't affect open-vm-tools functionality

Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
open-vm-tools/lib/file/filePosix.c
open-vm-tools/lib/foundryMsg/foundryMsg.c
open-vm-tools/lib/include/vixCommands.h

index a5be7803104e11a43c8204a29161fee7da6e3d42..a4ff4a01dbf9e5e4cea8aa02b5ea1bd476c588c3 100644 (file)
@@ -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);
index da06ba91dff19c9547d1c56cfec5c8febe0501de..16e962026ee790e9bfdf8f7b74b5bd8b74f7de8a 100644 (file)
@@ -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,
index d5fdd299b19f43dd700f34a4b77667818512105d..38d911023cf4951aeaef64951f04158fe11523b7 100644 (file)
@@ -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,