unix:virtualization:virtlib:winvirtuals
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
unix:virtualization:virtlib:winvirtuals [2023/05/04 21:53] – rodolico | unix:virtualization:virtlib:winvirtuals [2025/01/18 15:32] (current) – rodolico | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Windows Virtuals ====== | ====== Windows Virtuals ====== | ||
+ | |||
+ | ===== Windows 11 ===== | ||
+ | |||
+ | Windows 11 requires TPM and Secure Boot. See [[microsoft_windows: | ||
===== Shutdown and Reboot don't work ===== | ===== Shutdown and Reboot don't work ===== | ||
Line 33: | Line 37: | ||
Now, running <code bash> | Now, running <code bash> | ||
+ | |||
+ | ===== virtual will not reboot ===== | ||
+ | |||
+ | I have found that some (not all) Windows virtuals will not restart/ | ||
+ | |||
+ | Since this causes many issues, we wrote a Perl script as a work around. The script simply checks to see if virtuals are up and, if not, starts them (with the virsh start command). In our case, we decided that this would occur either when doing maintenance on the machine, or overnight when the virtual decides to reboot itself, so a 10 minute, maximum, downtime was acceptable. | ||
+ | |||
+ | <code perl checkVirtuals> | ||
+ | #! / | ||
+ | |||
+ | use strict; | ||
+ | use warnings; | ||
+ | |||
+ | # list of virtuals which should be turned on if they | ||
+ | # are found to be down. This is the same as that returned | ||
+ | # by virsh list | ||
+ | my @servers = ( | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | |||
+ | # command to start a virtual | ||
+ | my $virsh = '/ | ||
+ | |||
+ | # get a list of running virtuals and put them into | ||
+ | # $output | ||
+ | my $output = `virsh list`; | ||
+ | |||
+ | # check each virtual we are monitoring | ||
+ | foreach my $server ( @servers ) { | ||
+ | if ( $output =~ m/$server/ ) { # the virtual is running | ||
+ | # remove the flag file | ||
+ | unlink "/ | ||
+ | } else { # virtual is not running | ||
+ | if ( -e "/ | ||
+ | print " | ||
+ | # so bring it back up | ||
+ | | ||
+ | # and remove the flag file | ||
+ | | ||
+ | } else { # just went down | ||
+ | # create a flag file so the next pass will start it back up | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | 1; | ||
+ | </ | ||
+ | |||
+ | Every time this script is run, it will check each of the virtuals it is monitoring to see if it is up. The first time it finds one that is not up, it will create a flag file in /tmp, named // | ||
+ | |||
+ | When it finds it is down the second time, it will start it back up. | ||
+ | |||
+ | The following cron file, stored in /etc/cron.d (Devuan/ | ||
+ | |||
+ | <code crontab checkVirtuals.cron> | ||
+ | # Check status of virtuals on this machine and, restart any if down. | ||
+ | PATH=/ | ||
+ | # following may be changed to send failure reports to a different e-mail | ||
+ | # account | ||
+ | MAILTO=root | ||
+ | |||
+ | # check running virtuals every 5 minutes | ||
+ | |||
+ | # m h dom mon dow | ||
+ | */5 * * | ||
+ | |||
+ | # EOF | ||
+ | </ | ||
+ | |||
+ | Save this file to / | ||
===== Links ===== | ===== Links ===== | ||
* https:// | * https:// | ||
* https:// | * https:// |
unix/virtualization/virtlib/winvirtuals.1683255218.txt.gz · Last modified: 2023/05/04 21:53 by rodolico