Determining the Current vSAN On-Disk Format
Before upgrading the vSAN on-disk format, determine the current version of the on-disk format of your vSAN cluster. You must also determine the latest supported format for the ESXi build that the vSAN cluster is running.
In the vSphere Client, you can determine the current on-disk format under on the vSAN cluster.
To determine the
vSAN on-disk
format programmatically, first connect to the cluster:
cluster = getClusterInstance(args.clusterName, si) vcMos = vsanapiutils.GetVsanVcMos(si._stub, context=context) vsanUpgradeSystem = vcMos['vsan-upgrade-systemex'] supportedVersion = vsanUpgradeSystem.RetrieveSupportedVsanFormatVersion(cluster) print 'The highest vSAN disk format version that given cluster supports is {} '.format(supportedVersion)
Next, create a function that compares the current on-disk format version to the latest supported version:
def hasOlderVersionDisks(hostDiskMappings, supportedVersion): for hostDiskMappings in hostDiskMappings: for diskMapping in hostDiskMappings: if diskMapping.ssd.vsanDiskInfo.formatVersion < supportedVersion: return True for disk in diskMapping.nonSsd: if disk.vsanDiskInfo.formatVersion < supportedVersion: return True return False
Finally, gather each of the disk
group member devices into
diskMappings, and then
pass them into the
hasOlderVersionDisks
function to determine if an upgrade is necessary or not:
vsanSystems = CollectMultiple(si.content, cluster.host, ['configManager.vsanSystem']).values() vsanClusterSystem = vcMos['vsan-cluster-config-system'] diskMappings = CollectMultiple( si.content, [vsanSystem['configManager.vsanSystem'] for vsanSystem in vsanSystems], ['config.storageInfo.diskMapping']).values() diskMappings = [ diskMapping['config.storageInfo.diskMapping'] for diskMapping in diskMappings ] needsUpgrade = hasOlderVersionDisks(diskMappings, supportedVersion)