UPS and vms?


Recommended Posts

Well now ... I've managed to set up my first Win10 vm and quite successfully it appears. My unraid server has a UPS atached but what happens to my vm in the event that it is triggered? I see that i have the option of passing through my UPS to the vm but dont understand whether this is of any use or not. When i tried this, a change now undone, i lost access intermittently to my ups while it 'negotiated'. Just wondering how to handle the ups across any vm?
 
Sent from my LG-D855 using Tapatalk
 
 


Link to comment

If you wish to shut down the VM pro-actively during a power event instead of relying on unraid to stop the VM on its own, you can install the apcupsd software in the VM in network client mode. I do that on all my VM's, and when a power outage is signalled, the VM will shut down on its own before unraid starts its own shutdown sequence.

 

I stagger the shutdowns based on outage time, so the VM's start shutting down after 1 minute on battery, and unraid doesn't start shutting down until 3 minutes on battery. 

  • Upvote 1
Link to comment
2 hours ago, jonathanm said:

If you wish to shut down the VM pro-actively during a power event instead of relying on unraid to stop the VM on its own, you can install the apcupsd software in the VM in network client mode. I do that on all my VM's, and when a power outage is signalled, the VM will shut down on its own before unraid starts its own shutdown sequence.

 

I stagger the shutdowns based on outage time, so the VM's start shutting down after 1 minute on battery, and unraid doesn't start shutting down until 3 minutes on battery. 

This is generally the best route. If any specific VM needs lots of disk accesses to HDD media during the shutdown, then it's also possible to stagger the individual shutdown sequences.

Link to comment
This is generally the best route. If any specific VM needs lots of disk accesses to HDD media during the shutdown, then it's also possible to stagger the individual shutdown sequences.
Thanks to all. Just so i understand it ... i DO tick the box to passthru my UPS to each vm i build. I then need to install APC software within each vm?

Sent from my LG-D855 using Tapatalk

Link to comment

No, you don't need to passthru the UPS - the USB-based interface is only designed for one machine to connect with the UPS.

 

If you use apcupsd, then it can run as either master or as slave (client).

 

So one machine (such as your unRAID machine) can "own" the UPS and connect to the UPS using USB or whatever interface your UPS is supporting.

 

And additional machines (physical or VM) can then have their own apcupsd running in client mode and using networking to talk with the master apcupsd. This means lots of VM or physical machines can have their individual policies when to turn off based on the state reported by the UPS.

 

http://www.apcupsd.org/manual/manual.html

 

 

Link to comment
  • 1 year later...

Help Please 

I have an APC UPS connected via USB to unraid and configured to shut down unraid in the event of a power cut but the problem i'm having is getting the W10 VM to shut down before unraid shuts it down

I have downloaded and installed Apcupsd but when i try to run the program it just quickly flashes on the screen and disappears, I can go to the program folder and run the Apctray then using the unraid ip get the ups status 

image.thumb.png.a9d40c15b9acf9842a64b7d8cd5f4a13.png

 

 

What am I doing wrong as I can not see anywhere to configure the shutdown time for the VM?

 

Should there be a GUI like this?

 

image.thumb.png.0b075ee2a352cd82d4caf8c298087b95.png

 

Thanks 

 

Link to comment
1 hour ago, DGB said:

OK thanks for your help, i'll give it a go.

Right i've edited the config file and restarted, at first i was getting 2 icons in the task bar but I seam to have gotten that sorted but unfortunately it dusen't shutdown the VM, I first tried setting the batt% to 95 and running the UPS below this and then adding TIMEOUT to 10 but both ways it still doesn't shut down

I will attach the config file if someone had time to have a look and see if is setup correctly. 

 

apcupsd.conf

Link to comment
29 minutes ago, jonathanm said:

Nope.

UPSTYPE net

DEVICE 192.168.1.87:3551

Changed the CONFIG and it shut down after 10secs so that worked well but now when I start the VM in unraid it boots up with no display, unraid says its running but the monitor just goes to sleep. 😬

Link to comment
2 hours ago, DGB said:

Changed the CONFIG and it shut down after 10secs so that worked well but now when I start the VM in unraid it boots up with no display, unraid says its running but the monitor just goes to sleep. 😬

Right, I've tried replacing the VM image with an older backup, still does not boot, after several retries it sometimes boots to the windows recovery screen but is unable to repair the startup but the funny thing is i can change the GFX to VNC and it boots up ok, I then passed the sam GFX card through to a different VM, it boots fine and displies on the monitor 😣 so i'm assuming the GFX card is ok? don't know if there any connection but this only happened after if was shut down via apcupsd, I can't understand it as I thought replacing the img file to an older one it would undo any changes I might have made.

I have been using this VM10 as my daily driver for about a year and it's been rock solid, can I start a new vm with the original GFX card and use the old img file so I don't have to start from scratch or does anyone have any suggestions how to repair the broken VM?

Link to comment

OK i've got the VM running again but had to use a backup image, restarting unraid is not enough, the server needs to be shutdown and have the power removed only then will it work with the backup, just replacing the image and restarting the server is not enough, I tried apcupsd again but this time installed not as a service so i could start it manually, but again after apcupsd shut down the VM it lost the GFX and was unable.

Hope this helps anybody else trying the same thing (make a backup first) I can't spend anymore time on this and will just let unraid shutdown the vm as it goes off.

 

Link to comment
16 minutes ago, Squid said:

Wouldn't the simple solution have been to within VM Settings, set unRaid to hibernate the host upon host shutdown and then install the Virtio Client tools within the VM that are on the virtiso disk? 

Hi thanks taking the time to reply

I've done quite a lot with unraid and love it but I am still very much learning and unless I can find a tutorial or the likes sometimes struggle, I'm sure I read somewhere someone suggested that it wasn't a good idea to have them hibernate and after finding apsupsd thought it was the ideal solution, but unfortunately for me for whatever reason it a causes a major problem after auto shutdown. 

I'm still recovering the VM and will look at your suggestion in the future.  

 

Link to comment

IMO, the problem with Windows shutdown, whether initiated by the user directly or via any program is that there's tons of reasons why Windows won't shutdown (Open Dialog Boxes, etc) and just sit there waiting for user input.  Hibernation has no such problems, and is faster than a shutdown.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.