User Tools

Site Tools


vrealize:bugs:createdirectoryinguest

makeDirectoryInGuest

If you want to make a directory path in a VM using VMware Guest Operations, I found a rather strange behavior. We had a situasion where the SAN had trouble, resulting in at times slow response, and for some strange reason vRA provisioning failed. After some digging I found the problem, but the underlaying cause is for me unknown. My best guess it's related to race conditions on the ESXi hosts. We make several directories where we want to copy files. It's a complete directory tree, and we used the following code:

                var DestDir = "c:\\Install\\SCOM"
		GuestOperator = VM.sdkConnection.guestOperationsManager;
		guestAuth = new VcNamePasswordAuthentication();
		guestAuth.username = ComputerUserName;
		guestAuth.password = ComputerPassword;
		guestAuth.interactiveSession = false;
 
		fileManager = GuestOperator.fileManager;
 
                fileManager.makeDirectoryInGuest(VM ,guestAuth ,DestDir, true);

Under normal operations, this was working perfectly, but when the SAN had issues, this function failed with Failed to create Directory :C:\\Install\\SCOM Error: InternalError: A general system error occurred: vix error codes = (1, 0).

Notice the last paramater to MakeDirectoryInGuest, it's set to true (meaning create the whole directory tree), from the documentation:

NameTypeDescription
_thisManagedObjectReferenceA reference to the GuestFileManager used to make the method call.
vmVirtualMachineVirtual Machine to perform the operation on.
authGuestAuthenticationThe guest authentication data.
directoryPathxsd:stringThe complete path to the directory to be created.
createParentDirectoriesxsd:booleanWhether any parent directories are to be created.

If we make each directory by it self, this problem did not occour.

                var DestDir = "c:\\Install"
                var DestDir2 = "c:\\Install\\SCOM"
		GuestOperator = VM.sdkConnection.guestOperationsManager;
		guestAuth = new VcNamePasswordAuthentication();
		guestAuth.username = ComputerUserName;
		guestAuth.password = ComputerPassword;
		guestAuth.interactiveSession = false;
 
		fileManager = GuestOperator.fileManager;
 
                fileManager.makeDirectoryInGuest(VM ,guestAuth ,DestDir, false);
                fileManager.makeDirectoryInGuest(VM ,guestAuth ,DestDir2, false;
vrealize/bugs/createdirectoryinguest.txt ยท Last modified: 2018/11/29 14:12 by admin