Question

How to Stop the Nutanix Cluster with Invoke-VMScript

  • 5 December 2020
  • 1 reply
  • 608 views

Hello,

I’m trying to stop the cluster before shutting down and powering off the CVM Nodes. I’m using the following command to attempt to stop the cluster, however, it doesn’t seem to work, the command and the output is pasted, please tell me what am I doing wrong?

$nutanixclusterstatus = Invoke-VMScript -VM $cvms[0] -GuestCredential $nutanixlogincreds -ScriptText {/usr/bin/echo 'I agree' | /usr/local/nutanix/cluster/bin/cluster stop} -ScriptType Bash

 

ScriptOutput
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|  /usr/bin/echo: /usr/bin/echo: cannot execute binary file
|  2020-12-05 04:30:17 INFO zookeeper_session.py:143 cluster is attempting to connect to Zookeeper
|  2020-12-05 04:30:17 INFO cluster:2716 Executing action stop on SVMs 10.65.241.247,10.65.241.248,10.65.241.249,10.65.241.246
|  2020-12-05 04:30:17 WARNING genesis_utils.py:279 Deprecated: use util.cluster.info.get_node_uuid() instead
|  2020-12-05 04:30:17 INFO zookeeper_session.py:143 cluster is attempting to connect to Zookeeper
|  2020-12-05 04:30:17 INFO cluster:2763
|
|  ***** CLUSTER NAME *****
|  lab-prism01
|
|  2020-12-05 04:30:17 ERROR cluster:2900 Failed to execute action stop. Error(EOF when reading a line), Traceback:
|  Traceback (most recent call last):
|    File "/usr/local/nutanix/cluster/bin/cluster", line 2889, in <module>
|      main(args, commands)
|    File "/usr/local/nutanix/cluster/bin/cluster", line 2792, in main
|      confirmation = raw_input(prompt)
|  EOFError: EOF when reading a line
|
|  Exiting...
|  This operation will stop the Nutanix storage services and any VMs using Nutanix storage will become unavailable. Do you want to proceed? (I agree/[N]):
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


1 reply

Userlevel 2
Badge +4

@Clifford Anup  I am not sure about this script you have shared however we already have the command to stop all VMs except CVMs from any CVM, and after that, you can run cluster stop. 

 

https://portal.nutanix.com/page/documents/details?targetId=NX3060G7-Ear-Replacement-AHV:app-cluster-stop-ahv-node-shutdown-t.html

 

There are a couple of old community discussion as well on either stoping all VMs in a cluster ( AHV) 

https://next.nutanix.com/how-it-works-22/script-to-shutdown-all-vms-with-nutanix-clone-37811

https://next.nutanix.com/how-it-works-22/script-to-shutdown-all-vms-with-nutanix-clone-37811

Reply