RSS

Author Archives: Kelvin Wong

PowerCLI: Script to reboot each ESXi hosts

I realized that having done this for a few year, I never really nailed down a script to do this properly. It is very common as a vSphere admin to have to reboot your ESXi hosts after a configuration change or for patching.

Below is a first draft, not pretty code-wise but its a working operational script. I hope to improve on it over time. The basic flow of the script is as follows:

  • You establish a connection to the vCenter server first before running the script
  • You submit an input file which is list of ESXi host names
  • The script reads the list and does the following for each host
    • Sets the host in maintenance mode and counts down to 30 minutes. If the hosts does not get into maintenance mode by then the script terminates and you need to figure out why.
    • If the host goes into maintenance mode, it then force reboots the hosts and waits for 30 minutes again. Again if the host doesn’t come up by 30 minutes, the script terminates and you need to fix the host issue.
    • Lastly, once the host is back online, it sets the host to connected state and works on the next host in the loop.

Read the rest of this entry »

Advertisements
 
Leave a comment

Posted by on November 5, 2017 in powershell, vmware

 

Tags: , ,

NSX: A rookie lesson in packet tracing

Recently we encountered an interesting issue. A particular VM in the cloud be a unpingable sometimes. When the network guy tried to ping this VM from the cloud border routers, there would be no reply from one of the router. Yet on the other router there is no issue. So we had to figure out what happened to the ping packets in the cloud. Read the rest of this entry »

 
Leave a comment

Posted by on November 5, 2017 in Cloud, vmware

 

Tags: , , , , , , ,

vRA network allocation bug with more than 1 networks

Recently the team found a bug in vRA 7.1 and 7.2.

  1. You have  a reservation in vRA with 2 networks (e.g. NW1 and NW2), each assigned to a network profile (e.g. NW-Profile1 and NW-Profile2).
  2. vRA assigns NW1 to the VM
  3. vRA attempts to allocate an IP from the NW-Profile1, but its exhausted
  4. vRA next allocates IP from NW-Profile2 and is successful
  5. vRA does not update the initial network assignment to NW2
  6. The VM is provisioned to the wrong network

You only see this issue if the first network is exhausted. Case was raised to VMware and waiting for their investigation.

 
Leave a comment

Posted by on October 12, 2017 in Cloud, vmware

 

Tags: ,

Cross vCenter NSX failover and failback

So what does NSX cross vCenter failover look like in a real world scenario?

In this setup, we have 2 NSX managers across two sites, with Site A hosting the primary and DR Site hosting the secondary NSX manager. Simulating a DR scenario, the primary NSX manager, all 3 controllers and all the universal DLR control-VMs are shutdown in Site A

Read the rest of this entry »

 
Leave a comment

Posted by on May 21, 2017 in Cloud, vmware

 

Tags: , , ,

PowerCLI: Listing VMs from a bunch of vCenters

I need to grab all the VMs in a list of vCenters, but for each line of VM, I need to know which cluster and ESXi host they sit in. The original script was this;

Get-content .\vc.txt |
% {$vc=$_ ; connect-viserver $vc ; Get-VM |
Select Name, Vmhost, @{Name="Cluster";
Expression={ ((get-vmhost $_.vmhost).parent)}}, Folder,
@{Name="vCenter"; Expression= {$vc}} |
export-csv .\$vc.txt -NoTypeInformation ;
disconnect-viserver $vc –force –confirm:$false }

Even thought the code was straight forward with just a single get-VM execution, it was very slow. The reason was the Cluster field code block, which executes get-vmhost to get the cluster name for each VM, took time to execute.

@{Name="Cluster"; Expression={ ((get-vmhost $_.vmhost).parent)}}

A faster one-line calls each cluster first, then calls each VM in turn.

Get-content .\vc.txt |
% {$vc=$_ ; connect-viserver $vc ; Get-Cluster |
% { $clus=$_.name; Get-VM -Location $Clus |
% { "$($_.name)`t$($_.id)`t$($_.folder)`t$($_.vmhost)`t$Clus`t$vc" |
out-file .\$vc.txt -append }} ;
disconnect-viserver $vc –force –confirm:$false }
 
Leave a comment

Posted by on May 19, 2017 in powershell, vmware

 

Tags: , , ,

RP4VM failover testing network

Updated this article after Peter’s comments and my own testing

During failover of an RP4VM consistency group (CG), you have a few choices of selecting the test network to failover your VMs in. Why is this necessary?

RP4VM_Network

Read the rest of this entry »

 
2 Comments

Posted by on May 18, 2017 in Cloud, vmware

 

Tags: , , ,

RP4VM + vRA: caveats that DELL/VMware may not want to tell you

RecoverPoint for Virtual Machine (RP4VM) allows you to create disaster recovery per Virtual Machine in your vSphere environment. By itself, the application is great because you can pick and choose what VMs to protect, test failover and even restore your production VM at various points in time. However, if you have vRealize Automation (vRA) and the vendor is trying to sell you the miracle of self-service DRaaS that RP4VM+vRA can bring, you may want think harder about it.

Note: this is a review of 4.3, but I didn’t think much changed for 5.0

1. Very limited set of services from vRA blueprint, not true DRaaS

A very limited set of services are exposed to the automation blueprint. As far as I am aware, there are no other means of creating customized workflow if the standard blueprint does not satisfy you requirements for DRaaS. There are no blueprints to perform production failover, test failover nor to manage CGs or protected VMs. The current blueprint only allows a user to create protected VMs. All other administration has to be done from vSphere. Read the rest of this entry »

 
Leave a comment

Posted by on April 26, 2017 in Cloud, vmware

 

Tags: , ,