update
This commit is contained in:
17
esxi-scripts/iscsi-vm-shutdown-verify.ps1
Executable file
17
esxi-scripts/iscsi-vm-shutdown-verify.ps1
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
|
||||||
|
. /opt/idssys/powerwall/settings.ps1
|
||||||
|
|
||||||
|
Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -Password $ESXiPassword
|
||||||
|
|
||||||
|
Get-Datastore | Where {$_.Name -like '*iSCSI1*' -or $_.Name -like '*iSCSI2*'} | Get-VM | if ($_.PowerState -eq "PoweredOn") {
|
||||||
|
Try{
|
||||||
|
$vm = Get-VM -Name $vmName -ErrorAction Stop
|
||||||
|
switch($vm.PowerState){
|
||||||
|
'poweredon' {
|
||||||
|
sleep 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -366,8 +366,11 @@ SHUTDOWN_SERVERS(){
|
|||||||
echo -en "Stopping iSCSI VM's on: ${ESXIHOST} ... "
|
echo -en "Stopping iSCSI VM's on: ${ESXIHOST} ... "
|
||||||
/opt/idssys/powerwall/esxi-scripts/iscsi-vm-shutdown.ps1 ${ESXIHOST} >/dev/null 2>&1
|
/opt/idssys/powerwall/esxi-scripts/iscsi-vm-shutdown.ps1 ${ESXIHOST} >/dev/null 2>&1
|
||||||
echo "Done"
|
echo "Done"
|
||||||
|
echo -en "Verifying iSCSI VM's stopped on: ${ESXIHOST} ... "
|
||||||
|
/opt/idssys/powerwall/esxi-scripts/iscsi-vm-shutdown-verify.ps1 ${ESXIHOST}
|
||||||
|
echo "Done"
|
||||||
done
|
done
|
||||||
sleep 1m
|
# sleep 1m
|
||||||
for ESXIHOST in "${MAINHOSTS[@]}"; do
|
for ESXIHOST in "${MAINHOSTS[@]}"; do
|
||||||
echo -en "Stopping Remaining VM's on: ${ESXIHOST} ... "
|
echo -en "Stopping Remaining VM's on: ${ESXIHOST} ... "
|
||||||
ssh root@${ESXIHOST} 'esxcli system maintenanceMode set -e true -t 0'
|
ssh root@${ESXIHOST} 'esxcli system maintenanceMode set -e true -t 0'
|
||||||
|
|||||||
Reference in New Issue
Block a user