HI All,
I have a problem with some of my VM's in my VCenter:
Few ones of them go in an unknown state and aren't accessible for our users.
When I try to start them via Power CLI I get the error:
Start-VM The operation for the entity VirtualMachine-vm-1280 failed with the following message: "The operation is not allowed in the current state of the host."
At line:1 char:32
+ start-vm <<<<
+ CategoryInfo : NotSpecified: (:) [Start-VM], InvalidHostState
+ FullyQualifiedErrorId :
As I'm very new to the CLI can someone tell me how I can't show the State/InvalidState of a machine via scripting?
Thanks and Regards
crnine
Hello and welcome to the communities.
Note: Discussion successfully moved from VMware vCenter™ to VMware vSphere™ PowerCLI
Could this be due to the fact that the ESX(i) that hosts this VM is in maintenance mode ?
Do a
Get-VM -Name MyVM | Select -ExpandProperty Host | Select Name,ConnectionState,PowerState
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for moving to the right section
@LucD: No, the VM is not in maintenance mode, it is only powered off and on the first side in the VCenter of the machine no VM options(powering of, starting, settings..) are available.
The log says that a file is lock so no actions possible with VM but atm I only try to create a script which can tell me which machine has this problem.
It is a waste of time to check all the machines(around 2000) every hour or so, to find the error ones.
Solving the problem is possible with migrating to another host-server but I also try to find a way in the scripting with this issue
Therefore I thought it could be possible to read the InvalidState of a machine and check for this error.
Then creating a list and do whatever is needed afterwards(migrating, setting in maintenance mode,..).
Unfortunately I'm not really familar with the cmdlets, Data Objects types and Managed Objects types.
Hope this makes it clearer to you.
crnine
No, I don't mean the VM, but the ESXi host on which the VM is located.
Did you try that line above for one of the VMs that you can not start ?
You say that there is a message about a file lock, in which log did you see that message ?
Could you include the complete message ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ah, sry, y, ESXi host is also not in maintenance mode.
I'm at home atm, maybe will try tomorrow from here.
I'm not sure where it was written exactly, maybe in the messages in VM overview...
I'll check tomorrow for this too.
Also a Problem is that this issue occurs randomly, so I must search everytime manually through the machines(we have 2 clusters, each hosting ~1000 machines, only 1 cluster is affected^^) and check for the error.
Ok, the following will list some of the status indicators for a VM.
See if any of the problematic VMs shows a telltale value in any of these
Get-VM | Select Name,PowerState,
@{N="ConnectionState";E={$_.ExtensionData.Runtime.ConnectionState}},
@{N="Question";E={Get-VMQuestion -VM $_ | Select -ExpandProperty Text}},
@{N="Consolidation Needed";E={$_.ExtensionData.RunTime.ConsolidationNeeded}},
@{N="Overall Status";E={$_.ExtensionData.OverallStatus}},
@{N="Config Status";E={$_.ExtensionData.ConfigStatus}},
@{N="Guest Heartbeat Status";E={$_.ExtensionData.OverallStatus}} | ft -AutoSize
But be aware that this a shot in the dark since I have no clue what the actual problem is those VMs are experiencing.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes, will try that tomorrow hopefully.
Thanks for help so far
greets
crnine
Hi,
unfortunately there are checks going on this weekend on the servers so I'm not able to search for a VM with this error.
Will come back to you on monday.
greets
crnine
Hi Again,
atm all machines are powered on to prevent the connection problem so still nothing to test with your script.
As I heard the problem is when the Host recognizes an error with a VM and tries to migrate it.
Due to an unknown error 1 file in the storage of the source Host is still locked from this host, so the destination host can't migrate the VM completely.
The VM stays in unknown error-state and produces the error "BROKER_MACHINE_ASSIGNED_UNAVAILABLE" in the event-Database when an user tries to login.
Maybe you have an idea for this?
thx
crnine
These are obviously View VMs.
Can't you try a refresh or even a recompose in the View Administrator or with the View PowerCLI cmdlet Send-LinkedCloneRecompose
?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
yes, you are right, these are view VMs
Unfortunately I can't check your tips atm because we have management attention and machines shouldn't be touched^^
Now we must send on 4hous basis reports around about connected users and error messages.
Therefore I like to establish a script which extracts the connected and disconnected users and the error messages.
For the messages I found the database table dbo.event but have no clue how to automize the sql-request.
For the dis/-connected users I have nothing.
I tried to check the machines status with the CLI but the respective field(LocalState) is every time blank^^
If I should create a new thread for these questions/issues, pls tell me thanks
greets
crnine
Can you use the View PowerCLI cmdlets ?
The Get-DesktopVM will return some of the information you are looking for.
Normally you would have to run these View cmdlets on one of the Connection servers, but there are ways to run them remotely.
See for example Remote use of VMware.View.Broker PowerCLI
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes,
I have access to view powercli directly but as described I need the information which should be written here:
localState : ________
This field is always blank so I want to get this info out of a database(heard that this info is written in a ldap db???).
All tips are welcome
thx
crnine
Does noone has any help for this problem???
Every hint regarding CLI or databases could be helpful!
thanks and regards
crnine
I had the same issue and the only way to resolve it was to restart the host. My exchange server was in an "invalid" state the vmsevername.vmx file was being locked by a NIC that was not configured to any of the vswitches. The only resolution was to restart the ESXi host. Hope this helps.