Protect Linked-Clone Replicas and show with Replica a desktop is based on
I had a strange behavior in a vSphere Cluster with View Linked-Clones. The problem was that it was not possible to vMotion a Linked-Clone VM to an other host. The error was like:
Cannot open the disk '/vmfs/volumes/11111111-22222222-3333-444444444444/VDI-1/-VDI-1-000001.vmdk' or one of the snapshot disks it depends on.
I could not find any problems by checking snapshot chains. So I investigated Replica-VMs. vCenter allowed tasks like Power On and Editing which is normally not allowed for Replica-VMs. This state of related Replica-VMs seems to prevent vMotion tasks. I took the following steps to solve the problem.
- List VMs and there used Replica-VMs by doing this:
- Log in into a ESXi console and change to a temp-folder
- execute:
find /vmfs/volumes/ \( -size -1500c \) -name *.vmdk -exec grep replica {} -H \; | grep 'parentFileNameHint=' > Replica-temp.txt
andsed s/:/'-->>'/ < Replica-temp.txt >Replica-List.txt.
Now you can find a VM to Replica mapping in Replica-List.txt
- Check that Replica-VMs are in the right vSphere VM folders. These folders are defined in pool settings in View Administrator.
- Log in into a the Windows machine that hosts View Composer and go to directory
C:\Program Files (x86)\VMware\VMware View Composer
usingcmd.exe
- Protect Replica-VMs by executing:
SviConfig.exe -operation=protectentity -DsnName=DSN_of_Composer_DB -VcUrl=https://vCenter/sdk -VcUsername=vCenter_User -VcPassword=password -InventoryPath=/Datacenter/vm/Folder_tree/replica-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee.
- If you do not use Windows authentication for DB login, use additionally parameters for login:
-DbUsername
-DbPassword
- If everything works fine you get an output like:
VC server connection established successfully.
Looking for the entity on the VC server.
VirtualMachine found.
VirtualMachine with MoId vm-3161 sucessfully protected.
and a protected Replica-VM that you cannot edit or power on.
- Test vMotion again.
Notes
- To find unused replicas, you can use
SviConfig.exe -operation=FindUnusedReplica -DsnName=DsnName -Username=username -Password=password -Move=true
.-Move
is optional and moves the unused replicas to the folder UnusedViewComposerReplicaFolder. Furthermore the command creates filesunused-replica-*.txt
that contains unused replica names.