Follow

Attached VHD on NetApp device takes more than 5 min to release file lock.

Product: ProfileUnity

Product Version: 5.7

Expires on: 365 days from publish date

Updated: December 23, 2013

 

Problem:

After logging off  I need to wait between 5-10 minutes before I attempt to (login again) and mount the VHD to a new VM.

 

Symptoms:

The VHD is on an NTFS share on a Netapp SAN. I can see the file locked down:

Example:

netapp2> lock status -f "/vol/vm_repository/kgy/flexapp.vhd" -p cifs

========34d989f3:00000062

CIFS path=\kgy\flexapp.vhd(/vol/vm_repository/kgy/flexapp.vhd) host=192.168.0.1() owner=kgy state=GRANTED mode=RdWr-denyW oplock=None durable_state=DH_NONE

 

Possible Resolution(s):

We are investigating the actual cause of this behaviour with NetApp device. For workaround follow this steps:

Edit ProfileUnity Configuration and create "User Defined Script Setting" pointing to "Unmountv.bat" and set the script to execute "After ProfileUnity at Logoff (Post-Logoff)

Example:

UserDefinedScript.png

Create 2 files inside 'Scripts" folder

A) Unmountv.bat (attached to this KB)

Contents of "Unmountv.bat" (please customize file paths to fit your environment): 

call \\netapp\repository$\scripts\unmountVHD.cmd \\netapp\repository$\%username%\flexapp.vhd
call \\netapp\repository$\scripts\unmountVHD.cmd \\netapp\repository$\%username%\ProfileVHD.vhd

(This example unmounts 2 VHD's: flexapp.vhd and ProfileVHD.vhd)

B) UnmountVHD.cmd (attached to this KB)

Contents of "UnmountVHD.cmd":

 

@echo off
setlocal enabledelayedexpansion

if {%1}=={} (
echo Usage: %~nx0 [vhd]
exit /b 1
)
set vhdPath=%~dpnx1

echo Unmounting !vhdPath!

REM
REM create dispart script
REM
set diskPartScript=%~nx0.diskpart
echo sel vdisk file="!vhdPath!">!diskPartScript!
echo detach vdisk>>!diskPartScript!

REM
REM diskpart
REM
diskpart /s !diskPartScript!
del /q !diskPartScript!

echo Done!

endlocal

 

This script should unmount the VHD immediately after logoff. 

Note: This KB was tested with: NetApp Release 8.1.2 7-Mode: Tue Oct 30 19:56:51 PDT 2012. 

References: https://gist.github.com/nicjansma/9b82f28a77f306b0cfc0 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.