mob_utils.ps1


function Invoke-EnableVMMigrateDeleteMobRequest {
    param(
        [Parameter(Mandatory = $true)]
        [string]$VmMoRefId
    )
    Write-Host "Starting $($MyInvocation.MyCommand)..."

    Write-Host "Constructing the request body for mob API..."

    $bodyDictionary = [System.Collections.Generic.Dictionary[string, string[]]]::new()
    $bodyDictionary.Add("entity", @('<entity type="ManagedEntity" xsi:type="ManagedObjectReference">' + $VmMoRefId + '</entity>'))
    $bodyDictionary.Add("method", @('<method>Destroy_Task</method>',
                                    '<method>RelocateVM_Task</method>',
                                    '<method>MigrateVM_Task</method>',
                                    '<method>UnregisterVM</method>'))

    Write-Host "Constructed the request body for mob API."

    Invoke-AvsVCenterMobRequest -MoId 'AuthorizationManager' -MethodName 'enableMethods' -FormBodyDictionary $bodyDictionary
}

function Invoke-DisableVMMigrateDeleteMobRequest {
    param(
        [Parameter(Mandatory = $true)]
        [string]$VmMoRefId
    )
    Write-Host "Starting $($MyInvocation.MyCommand)..."

    Write-Host "Constructing the request body for mob API..."

    $bodyDictionary = [System.Collections.Generic.Dictionary[string, string[]]]::new()
    $bodyDictionary.Add("entity", @('<entity type="ManagedEntity" xsi:type="ManagedObjectReference">' + $VmMoRefId + '</entity>'))
    $bodyDictionary.Add("method", @('<method><method>Destroy_Task</method></method>',
                                    '<method><method>RelocateVM_Task</method></method>',
                                    '<method><method>MigrateVM_Task</method></method>',
                                    '<method><method>UnregisterVM</method></method>'))
    $bodyDictionary.Add("sourceId", @('Zerto Source'))

    Write-Host "Constructed the request body for mob API."

    Invoke-AvsVCenterMobRequest -MoId 'AuthorizationManager' -MethodName 'disableMethods' -FormBodyDictionary $bodyDictionary
}

function Invoke-AvsVCenterMobRequest {
    param(
        [ValidateNotNullOrEmpty()]
        [string]$MoId,

        [ValidateNotNullOrEmpty()]
        [string]$MethodName,

        [System.Collections.Generic.Dictionary[string, string[]]]$FormBodyDictionary = [System.Collections.Generic.Dictionary[string, string[]]]::new()
    )
    Write-Host "Starting $($MyInvocation.MyCommand)..."

    $RETRY_INTERVAL_SEC = 3
    $MAX_RETRY_COUNT = 5

    try
    {
        $mob3Credentials = $MOB_Connection.session.Credentials

        $securePassword = ConvertTo-SecureString $mob3Credentials.Password -AsPlainText -Force
        $vCenterMobPsCredentials = New-Object System.Management.Automation.PSCredential($mob3Credentials.UserName, $securePassword)
        $vCenterAddress = $MOB_Connection.vc_address

        # $MobPropertyName can be added in future if required
        $mobUrl = "https://$vCenterAddress/mob/?moid=$MoId&method=$MethodName"

        Write-Host "Logging in into '$vCenterAddress' mob..."

        # Use -SkipCertificateCheck for testing purposes
        $loginResult = Invoke-WebRequest -Uri $mobUrl `
            -SessionVariable mobSession `
            -Credential $vCenterMobPsCredentials `
            -Method GET `
            -MaximumRetryCount $MAX_RETRY_COUNT `
            -RetryIntervalSec $RETRY_INTERVAL_SEC `
            -ErrorAction Stop

        Validate-MobResponse -HttpResultObject $loginResult -IsLoginResponse $true

        # The response body should contain a hidden input field with the name "vmware-session-nonce" and a value that is used for subsequent requests.
        if ($loginResult.Content -match 'name="vmware-session-nonce" type="hidden" value="?([^\s^"]+)"') {
            $sessionNonce = $matches[1]
        } else {
            throw "Failed to extract session nonce from vSphere MOB login response."
        }

        Write-Host "Successfully logged in into mob."

        $FormBodyDictionary.Add('vmware-session-nonce', $sessionNonce)
        $requestFormBody = Create-FormBody -BodyDictionary $FormBodyDictionary

        Write-Host "Invoking mob request..."

        # Use -SkipCertificateCheck for testing purposes
        $requestResult = Invoke-WebRequest -Uri $mobUrl `
            -WebSession $mobSession `
            -Method POST `
            -Body $requestFormBody `
            -MaximumRetryCount $MAX_RETRY_COUNT `
            -RetryIntervalSec $RETRY_INTERVAL_SEC `
            -ErrorAction Stop

        Validate-MobResponse -HttpResultObject $requestResult -IsLoginResponse $false

        Write-Host "Finished $($MyInvocation.MyCommand)"
    }
    catch {
        throw "Failed to invoke mob request. Problem: $_"
    }
}

function Create-FormBody {
    param(
        [Parameter(Mandatory = $true)]
        [System.Collections.Generic.Dictionary[string, string[]]]$BodyDictionary
    )
    Write-Host "Starting $($MyInvocation.MyCommand)..."

    $bodyParts = foreach ($key in $BodyDictionary.Keys) {
        $encodedValue = ''
        foreach ($value in $BodyDictionary[$key]) {
            $encodedValue += [Uri]::EscapeDataString($value)
        }
        "$key=$encodedValue"
    }

    return $bodyParts -join '&'
}

function Validate-MobResponse {
    param(
        [Parameter(Mandatory = $true)]
        [Microsoft.PowerShell.Commands.WebResponseObject]$HttpResultObject,

        [Parameter()]
        [bool]$IsLoginResponse
    )
    Write-Host "Starting $($MyInvocation.MyCommand)..."

    $StatusCode = $HttpResultObject.StatusCode
    $Description = $HttpResultObject.StatusDescription

    if ($StatusCode -ne 200) {
        throw "Failed to invoke VC MOB request. Status code: $StatusCode, Message: $Description"
    }

    if ($IsLoginResponse) {
        return
    }

    $Content = $HttpResultObject.Content;
    if ($Content -match 'Method Invocation Result:\s*(?<Result>[^<]+)') {
        $ResultString = $matches['Result'].Trim()
        Write-Host "Extracted Result: $ResultString"
    } else {
        throw "Could not find Method Invocation Result in the MOB response."
    }

    if ($ALL_POSSIBLE_VCENTER_API_FAULTS.Contains($ResultString)) {
        throw "The MOB request failed with the Method Invocation Result '$ResultString'."
    }

    $knownPositiveResultsPattern = ($ALL_KNOWN_VCENTER_API_POSITIVE_RESULTS | ForEach-Object { [regex]::Escape($_) }) -join '|'
    if ($ResultString -match $knownPositiveResultsPattern){
        Write-Host "Successfully invoked VC MOB request."
    }
    else {
        $msgWarning = "Unexpected Method Invocation Result '$ResultString', no known success code found in the MOB response."
        Write-Host $msgWarning
        Write-Warning $msgWarning
    }
}

$ALL_KNOWN_VCENTER_API_POSITIVE_RESULTS = @(
    'MethodInfo',
    'void'
)

#All API faults from the official website:
# https://developer.broadcom.com/xapis/vsphere-web-services-api/latest/api_versions_all_faults.html
$ALL_POSSIBLE_VCENTER_API_FAULTS = [System.Collections.Generic.HashSet[string]]@(
    'ActiveDirectoryFault',
    'ActiveVMsBlockingEVC',
    'AdminDisabled',
    'AdminNotDisabled',
    'AffinityConfigured',
    'AgentInstallFailed',
    'AlreadyBeingManaged',
    'AlreadyConnected',
    'AlreadyExists',
    'AlreadyUpgraded',
    'AnswerFileUpdateFailed',
    'ApplicationQuiesceFault',
    'AuthMinimumAdminPermission',
    'AuthenticationRequired',
    'BackupBlobReadFailure',
    'BackupBlobWriteFailure',
    'BlockedByFirewall',
    'CAMServerRefusedConnection',
    'CannotAccessFile',
    'CannotAccessLocalSource',
    'CannotAccessNetwork',
    'CannotAccessVmComponent',
    'CannotAccessVmConfig',
    'CannotAccessVmDevice',
    'CannotAccessVmDisk',
    'CannotAddHostWithFTVmAsStandalone',
    'CannotAddHostWithFTVmToDifferentCluster',
    'CannotAddHostWithFTVmToNonHACluster',
    'CannotChangeDrsBehaviorForFtSecondary',
    'CannotChangeHaSettingsForFtSecondary',
    'CannotChangeVsanClusterUuid',
    'CannotChangeVsanNodeUuid',
    'CannotComputeFTCompatibleHosts',
    'CannotCreateFile',
    'CannotDecryptPasswords',
    'CannotDeleteFile',
    'CannotDisableDrsOnClustersWithVApps',
    'CannotDisableSnapshot',
    'CannotDisconnectHostWithFaultToleranceVm',
    'CannotEnableVmcpForCluster',
    'CannotModifyConfigCpuRequirements',
    'CannotMoveFaultToleranceVm',
    'CannotMoveHostWithFaultToleranceVm',
    'CannotMoveVmWithDeltaDisk',
    'CannotMoveVmWithNativeDeltaDisk',
    'CannotMoveVsanEnabledHost',
    'CannotPlaceWithoutPrerequisiteMoves',
    'CannotPowerOffVmInCluster',
    'CannotReconfigureVsanWhenHaEnabled',
    'CannotUseNetwork',
    'ClockSkew',
    'CloneFromSnapshotNotSupported',
    'CollectorAddressUnset',
    'ConcurrentAccess',
    'ConflictingConfiguration',
    'ConflictingDatastoreFound',
    'ConnectedIso',
    'CpuCompatibilityUnknown',
    'CpuHotPlugNotSupported',
    'CpuIncompatible',
    'CpuIncompatible1ECX',
    'CpuIncompatible81EDX',
    'CustomizationFault',
    'CustomizationPending',
    'DVPortNotSupported',
    'DasConfigFault',
    'DatabaseError',
    'DatacenterMismatch',
    'DatastoreNotWritableOnHost',
    'DeltaDiskFormatNotSupported',
    'DestinationSwitchFull',
    'DestinationVsanDisabled',
    'DeviceBackingNotSupported',
    'DeviceControllerNotSupported',
    'DeviceHotPlugNotSupported',
    'DeviceNotFound',
    'DeviceNotSupported',
    'DeviceUnsupportedForVmPlatform',
    'DeviceUnsupportedForVmVersion',
    'DigestNotSupported',
    'DirectoryNotEmpty',
    'DisableAdminNotSupported',
    'DisallowedChangeByService',
    'DisallowedDiskModeChange',
    'DisallowedMigrationDeviceAttached',
    'DisallowedOperationOnFailoverHost',
    'DisconnectedHostsBlockingEVC',
    'DiskHasPartitions',
    'DiskIsLastRemainingNonSSD',
    'DiskIsNonLocal',
    'DiskIsUSB',
    'DiskMoveTypeNotSupported',
    'DiskNotSupported',
    'DiskTooSmall',
    'DomainNotFound',
    'DrsDisabledOnVm',
    'DrsVmotionIncompatibleFault',
    'DuplicateDisks',
    'DuplicateName',
    'DuplicateVsanNetworkInterface',
    'DvsApplyOperationFault',
    'DvsFault',
    'DvsNotAuthorized',
    'DvsOperationBulkFault',
    'DvsScopeViolated',
    'EVCAdmissionFailed',
    'EVCAdmissionFailedCPUFeaturesForMode',
    'EVCAdmissionFailedCPUModel',
    'EVCAdmissionFailedCPUModelForMode',
    'EVCAdmissionFailedCPUVendor',
    'EVCAdmissionFailedCPUVendorUnknown',
    'EVCAdmissionFailedHostDisconnected',
    'EVCAdmissionFailedHostSoftware',
    'EVCAdmissionFailedHostSoftwareForMode',
    'EVCAdmissionFailedVmActive',
    'EVCConfigFault',
    'EVCModeIllegalByVendor',
    'EVCModeUnsupportedByHosts',
    'EVCUnsupportedByHostHardware',
    'EVCUnsupportedByHostSoftware',
    'EightHostLimitViolated',
    'EncryptionKeyRequired',
    'ExpiredAddonLicense',
    'ExpiredEditionLicense',
    'ExpiredFeatureLicense',
    'ExtendedFault',
    'FailToEnableSPBM',
    'FailToLockFaultToleranceVMs',
    'FaultToleranceAntiAffinityViolated',
    'FaultToleranceCannotEditMem',
    'FaultToleranceCpuIncompatible',
    'FaultToleranceNeedsThickDisk',
    'FaultToleranceNotLicensed',
    'FaultToleranceNotSameBuild',
    'FaultTolerancePrimaryPowerOnNotAttempted',
    'FaultToleranceVmNotDasProtected',
    'FcoeFault',
    'FcoeFaultPnicHasNoPortSet',
    'FeatureRequirementsNotMet',
    'FileAlreadyExists',
    'FileBackedPortNotSupported',
    'FileFault',
    'FileLocked',
    'FileNameTooLong',
    'FileNotFound',
    'FileNotWritable',
    'FileTooLarge',
    'FilesystemQuiesceFault',
    'FilterInUse',
    'FtIssuesOnHost',
    'FtVmHostRuleViolation',
    'FullStorageVMotionNotSupported',
    'GatewayConnectFault',
    'GatewayHostNotReachable',
    'GatewayNotFound',
    'GatewayNotReachable',
    'GatewayOperationRefused',
    'GatewayToHostAuthFault',
    'GatewayToHostConnectFault',
    'GatewayToHostTrustVerifyFault',
    'GenericDrsFault',
    'GenericVmConfigFault',
    'GuestAuthenticationChallenge',
    'GuestComponentsOutOfDate',
    'GuestMultipleMappings',
    'GuestOperationsFault',
    'GuestOperationsUnavailable',
    'GuestPermissionDenied',
    'GuestProcessNotFound',
    'GuestRegistryFault',
    'GuestRegistryKeyAlreadyExists',
    'GuestRegistryKeyFault',
    'GuestRegistryKeyHasSubkeys',
    'GuestRegistryKeyInvalid',
    'GuestRegistryKeyParentVolatile',
    'GuestRegistryValueFault',
    'GuestRegistryValueNotFound',
    'HAErrorsAtDest',
    'HeterogenousHostsBlockingEVC',
    'HostAccessRestrictedToManagementServer',
    'HostCommunication',
    'HostConfigFailed',
    'HostConfigFault',
    'HostConnectFault',
    'HostHasComponentFailure',
    'HostInDomain',
    'HostIncompatibleForFaultTolerance',
    'HostIncompatibleForRecordReplay',
    'HostInventoryFull',
    'HostNotConnected',
    'HostNotReachable',
    'HostPowerOpFailed',
    'HostSpecificationOperationFailed',
    'HotSnapshotMoveNotSupported',
    'HttpFault',
    'IDEDiskNotSupported',
    'IORMNotSupportedHostOnDatastore',
    'ImportHostAddFailure',
    'ImportOperationBulkFault',
    'InUseFeatureManipulationDisallowed',
    'InaccessibleDatastore',
    'InaccessibleFTMetadataDatastore',
    'InaccessibleVFlashSource',
    'IncompatibleDefaultDevice',
    'IncompatibleHostForFtSecondary',
    'IncompatibleHostForVmReplication',
    'IncompatibleSetting',
    'IncorrectFileType',
    'IncorrectHostInformation',
    'IndependentDiskVMotionNotSupported',
    'InsufficientAgentVmsDeployed',
    'InsufficientCpuResourcesFault',
    'InsufficientDisks',
    'InsufficientFailoverResourcesFault',
    'InsufficientGraphicsResourcesFault',
    'InsufficientHostCapacityFault',
    'InsufficientHostCpuCapacityFault',
    'InsufficientHostMemoryCapacityFault',
    'InsufficientMemoryResourcesFault',
    'InsufficientNetworkCapacity',
    'InsufficientNetworkResourcePoolCapacity',
    'InsufficientPerCpuCapacity',
    'InsufficientResourcesFault',
    'InsufficientStandbyCpuResource',
    'InsufficientStandbyMemoryResource',
    'InsufficientStandbyResource',
    'InsufficientStorageIops',
    'InsufficientStorageSpace',
    'InsufficientVFlashResourcesFault',
    'InvalidAffinitySettingFault',
    'InvalidArgument',
    'InvalidBmcRole',
    'InvalidBundle',
    'InvalidCAMCertificate',
    'InvalidCAMServer',
    'InvalidClientCertificate',
    'InvalidCollectorVersion',
    'InvalidController',
    'InvalidDasConfigArgument',
    'InvalidDasRestartPriorityForFtVm',
    'InvalidDatastore',
    'InvalidDatastorePath',
    'InvalidDatastoreState',
    'InvalidDeviceBacking',
    'InvalidDeviceOperation',
    'InvalidDeviceSpec',
    'InvalidDiskFormat',
    'InvalidDrsBehaviorForFtVm',
    'InvalidEditionLicense',
    'InvalidEvent',
    'InvalidFolder',
    'InvalidFormat',
    'InvalidGuestLogin',
    'InvalidHostConnectionState',
    'InvalidHostName',
    'InvalidHostState',
    'InvalidIndexArgument',
    'InvalidIpfixConfig',
    'InvalidIpmiLoginInfo',
    'InvalidIpmiMacAddress',
    'InvalidLicense',
    'InvalidLocale',
    'InvalidLogin',
    'InvalidName',
    'InvalidNasCredentials',
    'InvalidNetworkInType',
    'InvalidNetworkResource',
    'InvalidOperationOnSecondaryVm',
    'InvalidPowerState',
    'InvalidPrivilege',
    'InvalidProfileReferenceHost',
    'InvalidProperty',
    'InvalidPropertyType',
    'InvalidPropertyValue',
    'InvalidRequest',
    'InvalidResourcePoolStructureFault',
    'InvalidScheduledTask',
    'InvalidSnapshotFormat',
    'InvalidState',
    'InvalidToken',
    'InvalidType',
    'InvalidVmConfig',
    'InvalidVmState',
    'InventoryHasStandardAloneHosts',
    'IpHostnameGeneratorError',
    'IscsiFault',
    'IscsiFaultInvalidVnic',
    'IscsiFaultPnicInUse',
    'IscsiFaultVnicAlreadyBound',
    'IscsiFaultVnicHasActivePaths',
    'IscsiFaultVnicHasMultipleUplinks',
    'IscsiFaultVnicHasNoUplinks',
    'IscsiFaultVnicHasWrongUplink',
    'IscsiFaultVnicInUse',
    'IscsiFaultVnicIsLastPath',
    'IscsiFaultVnicNotBound',
    'IscsiFaultVnicNotFound',
    'KeyNotFound',
    'LargeRDMConversionNotSupported',
    'LargeRDMNotSupportedOnDatastore',
    'LegacyNetworkInterfaceInUse',
    'LicenseAssignmentFailed',
    'LicenseDowngradeDisallowed',
    'LicenseEntityNotFound',
    'LicenseExpired',
    'LicenseKeyEntityMismatch',
    'LicenseRestricted',
    'LicenseServerUnavailable',
    'LicenseSourceUnavailable',
    'LimitExceeded',
    'LinuxVolumeNotClean',
    'LogBundlingFailed',
    'MaintenanceModeFileMove',
    'ManagedObjectNotFound',
    'MemoryFileFormatNotSupportedByDatastore',
    'MemoryHotPlugNotSupported',
    'MemorySizeNotRecommended',
    'MemorySizeNotSupported',
    'MemorySizeNotSupportedByDatastore',
    'MemorySnapshotOnIndependentDisk',
    'MethodAlreadyDisabledFault',
    'MethodDisabled',
    'MethodFault',
    'MethodNotFound',
    'MigrationDisabled',
    'MigrationFault',
    'MigrationFeatureNotSupported',
    'MigrationNotReady',
    'MismatchedBundle',
    'MismatchedNetworkPolicies',
    'MismatchedVMotionNetworkNames',
    'MissingBmcSupport',
    'MissingController',
    'MissingIpPool',
    'MissingLinuxCustResources',
    'MissingNetworkIpConfig',
    'MissingPowerOffConfiguration',
    'MissingPowerOnConfiguration',
    'MissingWindowsCustResources',
    'MksConnectionLimitReached',
    'MountError',
    'MultiWriterNotSupported',
    'MultipleCertificatesVerifyFault',
    'MultipleSnapshotsNotSupported',
    'NamespaceFull',
    'NamespaceLimitReached',
    'NamespaceWriteProtected',
    'NasConfigFault',
    'NasConnectionLimitReached',
    'NasSessionCredentialConflict',
    'NasVolumeNotMounted',
    'NetworkCopyFault',
    'NetworkDisruptedAndConfigRolledBack',
    'NetworkInaccessible',
    'NetworksMayNotBeTheSame',
    'NicSettingMismatch',
    'NoActiveHostInCluster',
    'NoAvailableIp',
    'NoClientCertificate',
    'NoCompatibleDatastore',
    'NoCompatibleHardAffinityHost',
    'NoCompatibleHost',
    'NoCompatibleHostWithAccessToDevice',
    'NoCompatibleSoftAffinityHost',
    'NoConnectedDatastore',
    'NoDiskFound',
    'NoDiskSpace',
    'NoDisksToCustomize',
    'NoGateway',
    'NoGuestHeartbeat',
    'NoHost',
    'NoHostSuitableForFtSecondary',
    'NoLicenseServerConfigured',
    'NoPeerHostFound',
    'NoPermission',
    'NoPermissionOnAD',
    'NoPermissionOnHost',
    'NoPermissionOnNasVolume',
    'NoSubjectName',
    'NoVcManagedIpConfigured',
    'NoVirtualNic',
    'NoVmInVApp',
    'NonADUserRequired',
    'NonHomeRDMVMotionNotSupported',
    'NonPersistentDisksNotSupported',
    'NonVmwareOuiMacNotSupportedHost',
    'NotADirectory',
    'NotAFile',
    'NotAuthenticated',
    'NotEnoughCpus',
    'NotEnoughLicenses',
    'NotEnoughLogicalCpus',
    'NotFound',
    'NotImplemented',
    'NotSupported',
    'NotSupportedDeviceForFT',
    'NotSupportedHost',
    'NotSupportedHostForChecksum',
    'NotSupportedHostForVFlash',
    'NotSupportedHostForVmcp',
    'NotSupportedHostForVmemFile',
    'NotSupportedHostForVsan',
    'NotSupportedHostInCluster',
    'NotSupportedHostInDvs',
    'NotSupportedHostInHACluster',
    'NotUserConfigurableProperty',
    'NumVirtualCoresPerSocketNotSupported',
    'NumVirtualCpusExceedsLimit',
    'NumVirtualCpusIncompatible',
    'NumVirtualCpusNotSupported',
    'OperationDisabledByGuest',
    'OperationDisallowedOnHost',
    'OperationNotSupportedByGuest',
    'OutOfBounds',
    'OvfAttribute',
    'OvfConnectedDevice',
    'OvfConnectedDeviceFloppy',
    'OvfConnectedDeviceIso',
    'OvfConstraint',
    'OvfConsumerCallbackFault',
    'OvfConsumerCommunicationError',
    'OvfConsumerFault',
    'OvfConsumerInvalidSection',
    'OvfConsumerPowerOnFault',
    'OvfConsumerUndeclaredSection',
    'OvfConsumerUndefinedPrefix',
    'OvfConsumerValidationFault',
    'OvfCpuCompatibility',
    'OvfCpuCompatibilityCheckNotSupported',
    'OvfDiskMappingNotFound',
    'OvfDiskOrderConstraint',
    'OvfDuplicateElement',
    'OvfDuplicatedElementBoundary',
    'OvfDuplicatedPropertyIdExport',
    'OvfDuplicatedPropertyIdImport',
    'OvfElement',
    'OvfElementInvalidValue',
    'OvfExport',
    'OvfExportFailed',
    'OvfFault',
    'OvfHardwareCheck',
    'OvfHardwareExport',
    'OvfHostResourceConstraint',
    'OvfHostValueNotParsed',
    'OvfImport',
    'OvfImportFailed',
    'OvfInternalError',
    'OvfInvalidPackage',
    'OvfInvalidValue',
    'OvfInvalidValueConfiguration',
    'OvfInvalidValueEmpty',
    'OvfInvalidValueFormatMalformed',
    'OvfInvalidValueReference',
    'OvfInvalidVmName',
    'OvfMappedOsId',
    'OvfMissingAttribute',
    'OvfMissingElement',
    'OvfMissingElementNormalBoundary',
    'OvfMissingHardware',
    'OvfNetworkMappingNotSupported',
    'OvfNoHostNic',
    'OvfNoSpaceOnController',
    'OvfNoSupportedHardwareFamily',
    'OvfProperty',
    'OvfPropertyExport',
    'OvfPropertyNetwork',
    'OvfPropertyNetworkExport',
    'OvfPropertyQualifier',
    'OvfPropertyQualifierDuplicate',
    'OvfPropertyQualifierIgnored',
    'OvfPropertyType',
    'OvfPropertyValue',
    'OvfSystemFault',
    'OvfToXmlUnsupportedElement',
    'OvfUnableToExportDisk',
    'OvfUnexpectedElement',
    'OvfUnknownDevice',
    'OvfUnknownDeviceBacking',
    'OvfUnknownEntity',
    'OvfUnsupportedAttribute',
    'OvfUnsupportedAttributeValue',
    'OvfUnsupportedDeviceBackingInfo',
    'OvfUnsupportedDeviceBackingOption',
    'OvfUnsupportedDeviceExport',
    'OvfUnsupportedDiskProvisioning',
    'OvfUnsupportedElement',
    'OvfUnsupportedElementValue',
    'OvfUnsupportedPackage',
    'OvfUnsupportedSection',
    'OvfUnsupportedSubType',
    'OvfUnsupportedType',
    'OvfWrongElement',
    'OvfWrongNamespace',
    'OvfXmlFormat',
    'PasswordExpired',
    'PatchAlreadyInstalled',
    'PatchBinariesNotFound',
    'PatchInstallFailed',
    'PatchIntegrityError',
    'PatchMetadataCorrupted',
    'PatchMetadataInvalid',
    'PatchMetadataNotFound',
    'PatchMissingDependencies',
    'PatchNotApplicable',
    'PatchSuperseded',
    'PhysCompatRDMNotSupported',
    'PlatformConfigFault',
    'PowerOnFtSecondaryFailed',
    'PowerOnFtSecondaryTimedout',
    'ProfileUpdateFailed',
    'QuarantineModeFault',
    'QuestionPending',
    'QuiesceDatastoreIOForHAFailed',
    'RDMConversionNotSupported',
    'RDMNotPreserved',
    'RDMNotSupported',
    'RDMNotSupportedOnDatastore',
    'RDMPointsToInaccessibleDisk',
    'RawDiskNotSupported',
    'ReadHostResourcePoolTreeFailed',
    'ReadOnlyDisksWithLegacyDestination',
    'RebootRequired',
    'RecordReplayDisabled',
    'RemoteDeviceNotSupported',
    'RemoveFailed',
    'ReplicationConfigFault',
    'ReplicationDiskConfigFault',
    'ReplicationFault',
    'ReplicationIncompatibleWithFT',
    'ReplicationInvalidOptions',
    'ReplicationNotSupportedOnHost',
    'ReplicationVmConfigFault',
    'ReplicationVmFault',
    'ReplicationVmInProgressFault',
    'RequestCanceled',
    'ResourceInUse',
    'ResourceNotAvailable',
    'RestrictedByAdministrator',
    'RestrictedVersion',
    'RollbackFailure',
    'RuleViolation',
    'RuntimeFault',
    'SSLDisabledFault',
    'SSLVerifyFault',
    'SSPIChallenge',
    'SecondaryVmAlreadyDisabled',
    'SecondaryVmAlreadyEnabled',
    'SecondaryVmAlreadyRegistered',
    'SecondaryVmNotRegistered',
    'SecurityError',
    'SessionNotFound',
    'SharedBusControllerNotSupported',
    'ShrinkDiskFault',
    'SnapshotCloneNotSupported',
    'SnapshotCopyNotSupported',
    'SnapshotDisabled',
    'SnapshotFault',
    'SnapshotIncompatibleDeviceInVm',
    'SnapshotLocked',
    'SnapshotMoveFromNonHomeNotSupported',
    'SnapshotMoveNotSupported',
    'SnapshotMoveToNonHomeNotSupported',
    'SnapshotNoChange',
    'SnapshotRevertIssue',
    'SoftRuleVioCorrectionDisallowed',
    'SoftRuleVioCorrectionImpact',
    'SolutionUserRequired',
    'SsdDiskNotAvailable',
    'StorageDrsCannotMoveDiskInMultiWriterMode',
    'StorageDrsCannotMoveFTVm',
    'StorageDrsCannotMoveIndependentDisk',
    'StorageDrsCannotMoveManuallyPlacedSwapFile',
    'StorageDrsCannotMoveManuallyPlacedVm',
    'StorageDrsCannotMoveSharedDisk',
    'StorageDrsCannotMoveTemplate',
    'StorageDrsCannotMoveVmInUserFolder',
    'StorageDrsCannotMoveVmWithMountedCDROM',
    'StorageDrsCannotMoveVmWithNoFilesInLayout',
    'StorageDrsDatacentersCannotShareDatastore',
    'StorageDrsDisabledOnVm',
    'StorageDrsHbrDiskNotMovable',
    'StorageDrsHmsMoveInProgress',
    'StorageDrsHmsUnreachable',
    'StorageDrsIolbDisabledInternally',
    'StorageDrsRelocateDisabled',
    'StorageDrsStaleHmsCollection',
    'StorageDrsUnableToMoveFiles',
    'StorageVMotionNotSupported',
    'StorageVmotionIncompatible',
    'SuspendedRelocateNotSupported',
    'SwapDatastoreNotWritableOnHost',
    'SwapDatastoreUnset',
    'SwapPlacementOverrideNotSupported',
    'SwitchIpUnset',
    'SwitchNotInUpgradeMode',
    'SystemError',
    'TaskInProgress',
    'ThirdPartyLicenseAssignmentFailed',
    'Timedout',
    'TooManyConcurrentNativeClones',
    'TooManyConsecutiveOverrides',
    'TooManyDevices',
    'TooManyDisksOnLegacyHost',
    'TooManyGuestLogons',
    'TooManyHosts',
    'TooManyNativeCloneLevels',
    'TooManyNativeClonesOnFile',
    'TooManySnapshotLevels',
    'ToolsAlreadyUpgraded',
    'ToolsAutoUpgradeNotSupported',
    'ToolsImageCopyFailed',
    'ToolsImageNotAvailable',
    'ToolsImageSignatureCheckFailed',
    'ToolsInstallationInProgress',
    'ToolsUnavailable',
    'ToolsUpgradeCancelled',
    'UnSupportedDatastoreForVFlash',
    'UncommittedUndoableDisk',
    'UnconfiguredPropertyValue',
    'UncustomizableGuest',
    'UnexpectedCustomizationFault',
    'UnexpectedFault',
    'UnrecognizedHost',
    'UnsharedSwapVMotionNotSupported',
    'UnsupportedDatastore',
    'UnsupportedGuest',
    'UnsupportedVimApiVersion',
    'UnsupportedVmxLocation',
    'UnusedVirtualDiskBlocksNotScrubbed',
    'UserNotFound',
    'VAppConfigFault',
    'VAppNotRunning',
    'VAppOperationInProgress',
    'VAppPropertyFault',
    'VAppTaskInProgress',
    'VFlashCacheHotConfigNotSupported',
    'VFlashModuleNotSupported',
    'VFlashModuleVersionIncompatible',
    'VMINotSupported',
    'VMOnConflictDVPort',
    'VMOnVirtualIntranet',
    'VMotionAcrossNetworkNotSupported',
    'VMotionInterfaceIssue',
    'VMotionLinkCapacityLow',
    'VMotionLinkDown',
    'VMotionNotConfigured',
    'VMotionNotLicensed',
    'VMotionNotSupported',
    'VMotionProtocolIncompatible',
    'VimFault',
    'VirtualDiskBlocksNotFullyProvisioned',
    'VirtualDiskModeNotSupported',
    'VirtualEthernetCardNotSupported',
    'VirtualHardwareCompatibilityIssue',
    'VirtualHardwareVersionNotSupported',
    'VmAlreadyExistsInDatacenter',
    'VmConfigFault',
    'VmConfigIncompatibleForFaultTolerance',
    'VmConfigIncompatibleForRecordReplay',
    'VmFaultToleranceConfigIssue',
    'VmFaultToleranceConfigIssueWrapper',
    'VmFaultToleranceInvalidFileBacking',
    'VmFaultToleranceIssue',
    'VmFaultToleranceOpIssuesList',
    'VmFaultToleranceTooManyFtVcpusOnHost',
    'VmFaultToleranceTooManyVMsOnHost',
    'VmHostAffinityRuleViolation',
    'VmLimitLicense',
    'VmMetadataManagerFault',
    'VmMonitorIncompatibleForFaultTolerance',
    'VmPowerOnDisabled',
    'VmSmpFaultToleranceTooManyVMsOnHost',
    'VmToolsUpgradeFault',
    'VmValidateMaxDevice',
    'VmWwnConflict',
    'VmfsAlreadyMounted',
    'VmfsAmbiguousMount',
    'VmfsMountFault',
    'VmotionInterfaceNotEnabled',
    'VolumeEditorError',
    'VramLimitLicense',
    'VsanClusterUuidMismatch',
    'VsanDiskFault',
    'VsanFault',
    'VsanIncompatibleDiskMapping',
    'VspanDestPortConflict',
    'VspanPortConflict',
    'VspanPortMoveFault',
    'VspanPortPromiscChangeFault',
    'VspanPortgroupPromiscChangeFault',
    'VspanPortgroupTypeChangeFault',
    'VspanPromiscuousPortNotSupported',
    'VspanSameSessionPortConflict',
    'WakeOnLanNotSupported',
    'WakeOnLanNotSupportedByVmotionNIC',
    'WillLoseHAProtection',
    'WillModifyConfigCpuRequirements',
    'WillResetSnapshotDirectory',
    'WipeDiskFault'
)