unix:virtualization:virtlib:quickreference
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
unix:virtualization:virtlib:quickreference [2021/03/08 00:33] – rodolico | unix:virtualization:virtlib:quickreference [2022/04/06 01:12] – [New Install of Windows with virtio] rodolico | ||
---|---|---|---|
Line 14: | Line 14: | ||
* **dommemstat //name//** - show allocated RAM | * **dommemstat //name//** - show allocated RAM | ||
* **domstats //name// | grep vcpu.current** - displays number of virtual cpu's assigned | * **domstats //name// | grep vcpu.current** - displays number of virtual cpu's assigned | ||
+ | * **domblklist //name//** - show attached block devices | ||
* **start //name//** - starts the domain named **name** (name from list --all) | * **start //name//** - starts the domain named **name** (name from list --all) | ||
* **reboot //name//** | * **reboot //name//** | ||
Line 25: | Line 26: | ||
* attach-interface --domain pxe --type bridge --source br1 --model virtio --config --live | * attach-interface --domain pxe --type bridge --source br1 --model virtio --config --live | ||
* detach-interface --domain pxe --type bridge --mac 52: | * detach-interface --domain pxe --type bridge --mac 52: | ||
+ | * Remove virtual image (config file only)< | ||
+ | * **change-media //name// //drive//** - Insert or Eject a CDROM | ||
+ | * change-media //name// //drive// --eject | ||
+ | * change-media //name// //drive// // | ||
==== Remove a network from the entire system ==== | ==== Remove a network from the entire system ==== | ||
Line 49: | Line 54: | ||
- Change the drive letter | - Change the drive letter | ||
- Change the target to point to virtio-win.iso | - Change the target to point to virtio-win.iso | ||
- | - run virsh create name_of_xml_file to begin the installation | + | - run <code bash>virsh create name_of_xml_file</ |
+ | - To permanently define after installation | ||
+ | - Edit XML and remove the second CDROM (if desired) | ||
+ | - <code bash> | ||
Line 93: | Line 101: | ||
I did this with a Windows 10 installation on my workstation. Prior to using virtio, it would take, literally, 5-7 minutes after boot before I could do anything, and it was very sluggish after that. Once I used virtio, it was almost bare hardware speeds. | I did this with a Windows 10 installation on my workstation. Prior to using virtio, it would take, literally, 5-7 minutes after boot before I could do anything, and it was very sluggish after that. Once I used virtio, it was almost bare hardware speeds. | ||
+ | |||
+ | ===== Shutdown and restart of Windows guests ===== | ||
+ | |||
+ | ==== Problems shutting down with //virsh// ==== | ||
+ | After installing the win-virtio package, you should see QEMU Guest Agent running as a service. With this running, you can use qemu-guest-agent to manage shutdown and reboot. This is much more reliable than using ACPI. | ||
+ | |||
+ | **Important** Shut down the virtual before doing the following. | ||
+ | |||
+ | Edit the guest | ||
+ | <code bash> | ||
+ | virsh edit DOMAIN | ||
+ | </ | ||
+ | |||
+ | Place the following block under the < | ||
+ | |||
+ | <code xml> | ||
+ | <channel type=" | ||
+ | <source mode=" | ||
+ | <target type=" | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Start the virtual back up. Once that is done you can use the following commands much more reliably. | ||
+ | <code bash> | ||
+ | virsh shutdown DOMAIN | ||
+ | virsh reboot DOMAIN | ||
+ | </ | ||
+ | |||
+ | This also allows you to execute // | ||
+ | |||
+ | ==== Using save/ | ||
+ | |||
+ | An alternative is to use //virsh save// to shut down and //virsh restore// to recover. In this case, use | ||
+ | <code bash> | ||
+ | virsh save domainname / | ||
+ | </ | ||
+ | to save the image. It will suspend the virtual, then save processor/ | ||
+ | |||
+ | Once this is done, you can do whatever you needed to do, then use the following command to restore it. | ||
+ | <code bash> | ||
+ | virsh restore / | ||
+ | </ | ||
+ | |||
+ | ==== Windows servers will not restart ==== | ||
+ | |||
+ | I'm having a problem with Windows virtuals not rebooting. When you issue the restart command, they shut off and don't come back up. As a band aid, I have a script running on the hypervisor with a cron job, every 5 minutes. | ||
+ | |||
+ | This script has been tested on our machines, but I'm sure there are some issues with it. Just do a | ||
+ | <code bash> | ||
+ | virsh list --all | ||
+ | </ | ||
+ | and select the domains you want to ensure are running all the time. Place them in the array that has DOMAIN1 and DOMAIN2 (ie, replace DOMAIN1 with your first choice, etc...). | ||
+ | |||
+ | When called, checkVirtuals will look for each of the domains and see if they are running (using //virsh list//). If they are not running, it will place a flag file in / | ||
+ | |||
+ | I call this every 5 minutes from cron, thus, the max downtime will be 10 minutes, with an average of 5. | ||
+ | |||
+ | **WARNING: | ||
+ | |||
+ | <code perl checkVirtuals> | ||
+ | #! / | ||
+ | |||
+ | use strict; | ||
+ | use warnings; | ||
+ | |||
+ | my @servers = ( | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | |||
+ | my $virsh = '/ | ||
+ | |||
+ | my $output = `virsh list`; | ||
+ | |||
+ | foreach my $server ( @servers ) { | ||
+ | if ( $output =~ m/$server/ ) { | ||
+ | unlink "/ | ||
+ | } else { | ||
+ | if ( -e "/ | ||
+ | print " | ||
+ | | ||
+ | | ||
+ | } else { | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | 1; | ||
+ | |||
+ | </ | ||
===== Replacing Network Interfaces ===== | ===== Replacing Network Interfaces ===== | ||
Line 104: | Line 203: | ||
virsh detach-interface domain --type bridge --mac ##:##:##:##:##:## | virsh detach-interface domain --type bridge --mac ##:##:##:##:##:## | ||
# redefine it. Use values from above command, or change as needed | # redefine it. Use values from above command, or change as needed | ||
- | virsh attach-interface domain --type bridge --source br_private --mac ##:##:##:##:##:## | + | virsh attach-interface domain --type bridge |
</ | </ | ||
Line 115: | Line 214: | ||
* https:// | * https:// | ||
* https:// | * https:// | ||
+ | * https:// | ||
+ | * https:// |
unix/virtualization/virtlib/quickreference.txt · Last modified: 2023/02/26 17:12 by rodolico