Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix VCLS VM matching #108

Open
joisika opened this issue Aug 14, 2024 · 0 comments
Open

Fix VCLS VM matching #108

joisika opened this issue Aug 14, 2024 · 0 comments
Assignees
Labels
bug Bug
Milestone

Comments

@joisika
Copy link
Contributor

joisika commented Aug 14, 2024

          Maybe more like this here and in similar areas
while ($counter -ne $retries) {
    if (Test-vSphereAuthentication -server $vcfVcenterDetails.fqdn -user $vcfVcenterDetails.ssoAdmin -pass $vcfVcenterDetails.ssoAdminPass) {
        $vclsPoweredOn = (Get-VM -Location $clusterNameExtra | Where-Object { $_.name -match "vCLS" } | Measure-Object).Count
        if ($vclsPoweredOn -gt 0) {
            Write-PowerManagementLogMessage -Type INFO -Message "Some vCLS virtual machines are still running. Sleeping for $sleepTime seconds until the next check..."
            Start-Sleep -s $sleepTime
            Break
        }
    }
}

Additionally, it's termed as powered on, but the powerstate is not requested in the Where-Object. Should it be more like:

$vclsPoweredOn = (Get-VM -Location $clusterNameExtra | Where-Object { $_.name -match "vCLS" -and $_.PowerState -eq "PoweredOn" } | Measure-Object).Count

Another option is to change the scope to focus on the VMs in the "vCLS" folder instead of all VMs in the inventory that have a string match.

$vclsPoweredOn = (Get-VM -Location (Get-Folder -Name "vCLS") | Where-Object { $_.PowerState -eq "PoweredOn" } | Measure-Object).Count

Originally posted by @tenthirtyam in #107 (comment)

@github-actions github-actions bot added the pending-review Pending Review label Aug 14, 2024
@tenthirtyam tenthirtyam added bug Bug and removed pending-review Pending Review labels Aug 14, 2024
@tenthirtyam tenthirtyam added this to the .Next milestone Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug
Projects
None yet
Development

No branches or pull requests

2 participants