At the moment I am dealing with a script aiming to perform the following actions upon UPS detecting power failure.
- shutdown all the VMs in the pool (all of them have xs-tools installed and working)
- shutdown all the hosts in the pool except the pool master (actually only one slave but I could add more in the future and I want my script to be smart enough)
- shutdown the NAS containing the main SR for the pool (iSCSI connected)
- shutdown the pool master
I wrote down the following script but (being in a production environment) I've not been able to test it yet, and in any case before doing it I'd need some clarification as per my followins questions.
1. How can I be sure one command is completed before the next one is processed? In particular for the NAS: when I send the shutdown command I have to be sure the VMs are switched off.
2. Is it safe to shutdown all the VMs, all together, or should I filter at least the Dom0 VMs using param is-control-domain and shutdown them separately?
3. Do you think the sequence is correct? In particular for the NAS. Do I have to wait one instant before shutting down the master (as in my script) or could I send the shutdown command immediately after the VMs are off?
Question
Emanuele Chionetti
Dear all.
I'm trying to setup last things on my new pool.
At the moment I am dealing with a script aiming to perform the following actions upon UPS detecting power failure.
- shutdown all the VMs in the pool (all of them have xs-tools installed and working)
- shutdown all the hosts in the pool except the pool master (actually only one slave but I could add more in the future and I want my script to be smart enough)
- shutdown the NAS containing the main SR for the pool (iSCSI connected)
- shutdown the pool master
I wrote down the following script but (being in a production environment) I've not been able to test it yet, and in any case before doing it I'd need some clarification as per my followins questions.
------------------------------
# Obtain the name of all the VMs in the pool
vm_uuid=`xe vm-list --minimal`
------------------------------
Some questions.
1. How can I be sure one command is completed before the next one is processed? In particular for the NAS: when I send the shutdown command I have to be sure the VMs are switched off.
2. Is it safe to shutdown all the VMs, all together, or should I filter at least the Dom0 VMs using param is-control-domain and shutdown them separately?
3. Do you think the sequence is correct? In particular for the NAS. Do I have to wait one instant before shutting down the master (as in my script) or could I send the shutdown command immediately after the VMs are off?
Many thanks for your help.
EC
Link to comment
10 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now