diff --git a/CHANGELOG.md b/CHANGELOG.md index f7422ee..3670d78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Refactor: - Replaced the use of `Test-NetConnection` to with `Test-EndpointConnection` from the PowerShell module `PowerValidatedSolutions`. [GH-85](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-power-management/pull/85) - Replaced current if statement `nsxtedgeNodes` to check for Virtual Machines running on Overlay Network. [GH-86] (https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-power-management/pull/86) +- Added Check for vRLI deployment and will shutdown if it exist `Get-vRSLCMEnvironmentVMs` [GH-87] https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-power-management/pull/87 Chore: diff --git a/SampleScripts/PowerManagement-ManagementDomain.ps1 b/SampleScripts/PowerManagement-ManagementDomain.ps1 index 322873b..493db6a 100644 --- a/SampleScripts/PowerManagement-ManagementDomain.ps1 +++ b/SampleScripts/PowerManagement-ManagementDomain.ps1 @@ -493,6 +493,28 @@ if ($PsBoundParameters.ContainsKey("shutdown") -or $PsBoundParameters.ContainsKe Exit } } + # Check if VMware Aria Operations for Logs exists in environment, if so it will shutdown the nodes. + if (Test-VCFConnection -server $server) { + if (Test-VCFAuthentication -server $server -user $user -pass $pass) { + if (($vcfVrslcmDetails = Get-vRSLCMServerDetail -fqdn $server -username $user -password $pass)) { + if (Test-vRSLCMAuthentication -server $vcfVrslcmDetails.fqdn -user $vcfVrslcmDetails.adminUser -pass $vcfVrslcmDetails.adminPass) { + $productid = "vrli" + $vmlist = Get-vRSLCMEnvironmentVMs -server $server -user $user -pass $pass -productid $productid + if ($vmlist -ne $null) { + $domain = Get-VCFWorkloadDomain | Select-Object name, type | Where-Object { $_.type -eq "MANAGEMENT" } + if (($vcfVcenterDetails = Get-vCenterServerDetail -server $server -user $user -pass $pass -domain $domain.name)) { + if (Test-vSphereConnection -server $($vcfVcenterDetails.fqdn)) { + if (Test-vSphereAuthentication -server $vcfVcenterDetails.fqdn -user $vcfVcenterDetails.ssoAdmin -pass $vcfVcenterDetails.ssoAdminPass) { + Write-PowerManagementLogMessage -Type INFO -Message "Stopping the VMware Aria Operations for Logs nodes..." -Colour Green + Stop-CloudComponent -server $vcfVcenterDetails.fqdn -user $vcfVcenterDetails.ssoAdmin -pass $vcfVcenterDetails.ssoAdminPass -nodes $vmlist -timeout 600 + } + } + } + } + } + } + } + } # Check if there are any running Virtual Machines on the Overlay Networks before shutting down Edge Cluster. if ($nsxtEdgeNodes) { @@ -516,7 +538,7 @@ if ($PsBoundParameters.ContainsKey("shutdown") -or $PsBoundParameters.ContainsKe $vmName = $vm.Name $powerState = $vm.PowerState if ($powerState -eq "PoweredOn") { - Write-Output "VM Name: $vmName, Power State: $powerState, Please power off the VM(s) Connect to NSX-T Segments before you shutdown Edge Cluster" + Write-PowerManagementLogMessage -Type Error -Message "VM Name: $vmName, Power State: $powerState, Please power off the virtual machines connected to NSX Segments before you shutdown an NSX Edge Cluster" -Colour Red $stopExecuted = $true } if (-not $stopExecuted) { diff --git a/VMware.CloudFoundation.PowerManagement.psd1 b/VMware.CloudFoundation.PowerManagement.psd1 index f9cbd0e..3bcab8f 100644 --- a/VMware.CloudFoundation.PowerManagement.psd1 +++ b/VMware.CloudFoundation.PowerManagement.psd1 @@ -11,7 +11,7 @@ RootModule = 'VMware.CloudFoundation.PowerManagement.psm1' # Version number of this module. - ModuleVersion = '1.4.1.1001' + ModuleVersion = '1.4.1.1002' # Supported PSEditions # CompatiblePSEditions = @()