Last year I created a utility to replicate vDisks between PVS Sites and Farms. I wrote a blog — vDisk Replication Utility — that introduced the utility and provided a ShareFile link to download it.
Both the blog and the utility have been very successful. I get between two and 10 downloads a day, and the blog was one of the most visited for 2018. This shows that there is a definite need for easier vDisk management.
I want to thank all the users of the utility who have helped me debug problems and those who have suggested new features. One Citrix customer, Niek Harmsen, asked for a new feature that I thought was a fantastic idea. He wanted to be able to see “replication status” for all his vDisks on one screen. I didn’t have time to work on this feature when asked, but over the holidays at the end of 2018, we had some rainy days where I got the chance to develop a solution.
The first thing I did was to do some digging in the PVS PowerShell methods. PVS defines vDisks using what is called a “Disk Locator.” Running the command
$DiskLocator = Get-pvsdisklocator -StoreName $Store -SiteName $Site
returns the following (edited).
The “Disk Locator” defines a vDisk Image, including the site and store the vDisk is associated with. A “Disk Locator” then has one-to-many “Disks” associated with it — one for each version of the vDisk on each PVS Server in the PVS Site. You can use the following command to get an array of the “Disks.”
Get-PvsDiskInventory -DiskLocatorId $DiskLocator.DiskLocatorId
The output from this is returned as an array of “Disk” information. If we look at a couple of the “Disk” entries, we see that both the vDisk version and PVS Server are returned.
For our purposes, there is another field returned that is critical — the “State” field.
This is actually the state of vDisk replication. The possible returned states are:
- 0 = up to date
- 1 = version file is missing
- 2 = version file is out of date
- 3 = properties are missing
- 4 = properties are out of date
- 5 = server is not reachable
This is great information and actually much better than I thought we would get. In testing, I found that the replication state is updated almost immediately when a vDisk is changed. Also, as you see from the output, to get the status for all the vDisks on all servers in a PVS Farm, we only need to query a single server in the Farm.
Now that I understood how to get replication status using PVS PowerShell, I created a script that would run against each Master Server defined in the PVS Replication Utility. It would get all the PVS Sites for the Farm and cycle through each PVS Store in the Site to get the replication status of each vDisk. The result is shown below (after more than a little work on the utility UI).
The status screen is broken into sections by Master Server, Site and Store. The vDisk name, Version and each PVS Server assigned to the store are listed. A blue circle indicates the vDisk is replicated to the PVS Server and is up to date. This is what you want for load balanced vDisks. A green hollow circle represents a vDisk that is not load balanced on that PVS Server. The vDisk may or may not be replicated to that server. A red X indicates that the vDisk is not replicated or not up to date.
The great part about the added information we have is that we can show which is the case. So, you will see the actual state field result next to the icon. For example, the Red X with a 5 means that the PVS Server “PVSSERVER76” was not reachable. The Red X with a 1 means that the vDisk is not replicated to “PVSSERVER3.” If you have green circles but you expect all of your vDisks to be load balanced, then you should check the load balancing settings for the vDisk in question. You can change the setting and run the script again to see if the files have already been replicated.
In the utility, the status can be updated when desired by clicking a button. The replication status script also runs whenever the vDisk Replicator script is run. It saves the replication status as an html file called replstatus.html in the config folder. This is actually what you are viewing in the Repl_Status screen shown above. This file will also be emailed with the email bundle. When opened from email, it shows only the status codes because no image (jpg) files are present. To handle the case where the vDisk is not defined for load balancing, I added an extra status of “6.” So, in the report, if you see a 6, it means the same thing as the green circle, which is that the vDisk is not defined to be load balanced to that PVS server.
I would like to thank Niek Harmsen for his great idea. I don’t think I would have thought of it, but after he suggested it, I understood that the feature would be very helpful for all Citrix administrators.
If you want to use it, go to the original blog and download the vDisk Replication Utility. You don’t need to use the replication in order to use the Replication Status. You will have to fill out at least the Master Server list when setting up the utility.
Please let me know if this works well for you. I have only been able to test in my lab, and I need help making sure it works in all environments.
Oh, and happy new year, everyone!
Citrix TechBytes – Created by Citrix Experts, made for Citrix Technologists! Learn from passionate Citrix Experts and gain technical insights into the latest Citrix Technologies.
Want specific TechBytes? Let us know! firstname.lastname@example.org.