One to Many vms not showing virtualizationsites/vm

  • In the API, I’ve always used “virtualizationsites/{SITEIDENTIFIER}/vms” to find all of the VMs available to replicate.  Not sure when this occurred, but I noticed on 6.0u2 that this no longer retrieves VMs that would be considered One to Many.  If I pull them up in the web UI I can find the VM in the “Select VMs” One to Many section, but they no longer show up in the API.

    Hi Jason,

    Could you provide the full script so we could take a look at it?


    #Get Unprotected VMs
    function Get-ZertoVM {
    Returns VMs that Zerto can see that are not currently protected
    Return information on specific VMs
    .PARAMETER SiteIdentifier
    Specify the SiteID search
    Get-ZertoVM -SiteIdentifier ab1cd123-ab12-1a23-1a2b-0123ab1234a1
    Return only the ID of the VM
    Get-ZertoVM -VMName COMPUTERNAME -IdOnly
      HelpMessage='Zerto VM Name')]
      [String]$VMName = "null",
      HelpMessage='Zerto Site Identifier, gathered from Get-ZertoSite')]
      [String]$SiteIdentifier = "null",
      HelpMessage='Return only the ID of a single VM VMIdentifier, ignored if no VMName given')]
      [Switch]$IdOnly = $false
    Try {
        if ($SiteIdentifier -eq "null"){$SiteIdentifier = Get-ZertoSite | select SiteIdentifier -ExpandProperty SiteIdentifier}
        $ResultsURL = $global:connZerto.BaseURL+"virtualizationsites/"+$SiteIdentifier+"/vms"
        $ResultsCMD = Invoke-RestMethod -Uri $ResultsURL -TimeoutSec 100 -Headers $global:connZerto.SessionHeader -ContentType "application/JSON"
        if ($VMName -eq "null"){$ResultsCMD}
        elseif ($IDOnly) {$ResultsCMD | where {$_.VMName -like "$VMName"} | select VMIdentifier -ExpandProperty VMIdentifier}
        else {$ResultsCMD | where {$_.VMName -like "$VMName"}}
        } #Try

    Basically the New-ZertoSession function populates the $global:connZerto with the BaseURL and SessionHeader with some predefined credentials and ZVM variables.

    The Remove-ZertoSession removes it.  This way we don’t get a lot of open sessions waiting to time out, though it does flood the ZVM Events with login spam.

    Ok, I think I just figured this out.  It appears that maybe back before Zerto 6, the “virtualizationsites/<SITEIDENTIFIER>/vms” would pull all vms on the vcenter.  Now, it only pulls unprotected vms.  My “Get-ZertoVM” function uses that method to get the vm id to add it to the VPG.  I’ve just got to do a check if I don’t find it with that method and get it from the “vms/<VMIDENTIFIER>” method instead.  A little inconvenient, but doable.

    Ok, I think I just figured this out.  It appears that back before Zerto 6, the “virtualizationsites/<SITEIDENTIFIER>/vms” would pull all vms on the vcenter as long as they have not been placed in a certain number of VPGs.  Now, it only pulls unprotected vms, even though we have the One to Many license.  I could work around this by double checking with the “vms/<VMIDENTIFIER>” method.  Should we be able to get all available vms according to the REST API documentation for 6.0u3 on page 82?  Unless this was fixed in 6.0u3, we are currently on 6.0u2.  Thanks for your help!

You must be logged in to create new topics. Click here to login