- Community Home
- >
- Storage
- >
- HPE Storage Tech Insiders
- >
- Reload inaccessible or invalid VMs
-
- Forums
-
Blogs
- Alliances
- Around the Storage Block
- Behind the scenes @ Labs
- HPE Careers
- HPE Storage Tech Insiders
- Infrastructure Insights
- Inspiring Progress
- Internet of Things (IoT)
- My Learning Certification
- OEM Solutions
- Servers: The Right Compute
- Shifting to Software-Defined
- Telecom IQ
- Transforming IT
- Infrastructure Solutions German
- L’Avenir de l’IT
- IT e Trasformazione Digitale
- Enterprise Topics
- ИТ для нового стиля бизнеса
- Blogs
-
Quick Links
- Community
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Contact
- Email us
- Tell us what you think
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Enterprise.nxt
- Marketplace
- Aruba Airheads Community
-
Forums
-
Blogs
-
InformationEnglish
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Receive email notifications
- Email to a Friend
- Printer Friendly Page
- Report Inappropriate Content
Reload inaccessible or invalid VMs
Have you ever had a blip in your network, or a temporary network outage? Has your VMware vSphere environment recovered completely after that? Or did you end up in an annoying situation where your network/FC storage (iSCSI, FCoE, NFS, FC) took a little "longer" to come up, as compared to your ESXi servers? In such cases, you may end up with a situation where the VMs in your vSphere environment show up as "inaccessible". One way to remedy the situation is to unregister each VM and re-register the VM's vmx file to vCenter or the ESXi host. But if you have an environment larger than 10 VMs, this can become a tedious, manual task. Within our QA environments, we often end up breaking things and need a fast, automated way to recover.
Inaccessible VMs
Command-line scripts with vim-cmd
VMware KB 1026043 outlines this solution: reload the VM's vmx file on the ESXi host using the vim-cmd commands:
- Get the VM's Vmid with this command, to identify your VM: #vim-cmd vmsvc/getallvms
- Reload the VMX using the reload command: #vim-cmd vmsvc/reload Vmid
A one-liner script combining the two steps above, to be run on each ESXi server in your environment, as root:
for a in $(vim-cmd vmsvc/getallvms 2>&1 | grep invalid | awk '{print $4}' | cut -d \' -f2); do vim-cmd vmsvc/reload $a; done
In large environments, this can be a tedious job. Within a QA environment with 8 servers too, we wanted this automated. An option was indeed to configure password-less root ssh into each ESXi server, and run the script from a central desktop. But we wanted something more secure, less error-prone and with fewer breaking points.
PowerCLI to the rescue
A little more searching fetched us a PowerCLI one-liner solution! Logging in as administrator in your vCenter, you can execute this and it runs on ALL VMs in your inventory, on ALL ESXi servers.
(Get-View -ViewType VirtualMachine) | ?{$_.Runtime.ConnectionState -eq "invalid" -or $_.Runtime.ConnectionState -eq "inaccessible"} | %{$_.reload()}
Source: from techazine or hypervisor.fr
Let's break it down to understand the parts of this one-liner:
- Get-View -ViewType VirtualMachine
Retrieves all VMs in your vCenter inventory. The next part: - ?{$_.Runtime.ConnectionState -eq "invalid" -or $_.Runtime.ConnectionState -eq "inaccessible"}
This filters the VMs and looks for invalid or inaccessible VMs only. The last part: - %{$_.reload()}
This calls the vSphere reload API.
Voila! Just like that, your VMs are all back online and accessible!
- Back to Blog
- Newer Article
- Older Article
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Receive email notifications
- Email to a Friend
- Printer Friendly Page
- Report Inappropriate Content
- HPEStorageGuy on: MSA Best Practices: Upgrading Controller Firmware
- HPEStorageGuy on: What? You’re using a ProLiant DL560 and an MSA Sto...
- HPEStorageGuy on: 3PAR and InfoSight QuickStart guide
- csullivan43 on: Using HPE Predictive Cloud Platform to Address Spl...
- freshcalendar on: Oracle RAC Cloning and Scheduling Snapshots with H...
- commguyaf on: Merged Pool Scale Out with Nimble Connection Mange...
- sleota16 on: Storage Performance Benchmarking Basics
- fgrahn80 on: NOS4 Use Case: Leveraging NWT4 cmdlets for SQL Ser...
- fgrahn80 on: NOS4 Use Case: Rapid Deployment of SQL Developer C...
- jmonger96 on: Nimble OS 4 – Hyper-V VSS Requestor
-
3PAR
14 -
ai predictive analytics
2 -
App Integration
44 -
Cloud Volumes
4 -
Containers
12 -
data protection
3 -
high performance computing
1 -
InfoSight
13 -
MSA
5 -
Nimble Storage
29 -
Oracle
1 -
Oracle Database
6 -
Performance & Data Protection
21 -
SAP HANA
5 -
Setup & Networking
94 -
VMware
13
- « Previous
- Next »
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2019 Hewlett Packard Enterprise Development LP