unix:virtualization:virtlib:quickreference
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| unix:virtualization:virtlib:quickreference [2022/05/19 17:44] – rodolico | unix:virtualization:virtlib:quickreference [2025/07/27 16:34] (current) – rodolico | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== virt-lib Quick Reference ====== | ====== virt-lib Quick Reference ====== | ||
| + | |||
| + | virtlib stores its configuration for each //domain// (virtual) in / | ||
| + | |||
| + | The xml files are, well, xml. The format is documented at https:// | ||
| ===== virt-top ===== | ===== virt-top ===== | ||
| Line 28: | Line 32: | ||
| * This will attach a new bridge to domain //domain//, using //bridge// defined on hypervisor, called vnet3 on the virtual, with the mac address set to whatever you use. | * This will attach a new bridge to domain //domain//, using //bridge// defined on hypervisor, called vnet3 on the virtual, with the mac address set to whatever you use. | ||
| * detach-interface //domain// --type bridge --mac 00: | * detach-interface //domain// --type bridge --mac 00: | ||
| + | * Attach/ | ||
| + | * <code bash> | ||
| + | * <code bash> | ||
| * Remove virtual image (config file only)< | * Remove virtual image (config file only)< | ||
| * **change-media //name// //drive//** - Insert or Eject a CDROM | * **change-media //name// //drive//** - Insert or Eject a CDROM | ||
| - | * change-media //name// //drive// --eject | + | * <code bash> |
| - | | + | * <code bash> |
| + | * Rename Domain | ||
| + | * <code bash> | ||
| + | |||
| + | ==== Boot from CD ROM ==== | ||
| + | |||
| + | This is actually not intuitive. I'm going to describe how to do this from a pretty complex setup with no GUI; adjust as needed. In this case, we need to boot the virtual myvirt from a gparted cdrom image located in /media/isos/gparted-live-1.3.0-1-amd64.iso so we can modify the partitions. However, we did not have a cdrom image for the installation, | ||
| + | |||
| + | Both assume the virtual has been turned off <code bash> | ||
| + | |||
| + | Some people do not want to manually edit the XML used to configure the virtuals, others prefer it. Some things, like setting a boot menu with a realistic timeout appear to require it; I have not found a way to do it through the virsh command. | ||
| + | |||
| + | I use the --config flag a lot. If you use this flag, any changes you make are written to the config file and will persist across boots. | ||
| + | |||
| + | === without manually editing configuration === | ||
| + | - First, see if there is a cdrom installed. One simple way is to dump the xml and grep for cdrom< | ||
| + | - Once this is done and you have a cdrom, you should be able to tell which one it is with< | ||
| + | - Mount your image on the CDROM | ||
| + | | ||
| + | - If you do not have a CDROM, use<code bash> | ||
| + | |||
| + | === I'm not afraid | ||
| + | - Edit the config file with <code bash> | ||
| + | - Look for something like //<disk type=' | ||
| + | | ||
| + | - Look for the section //< | ||
| + | - <code xml>< | ||
| + | - This will enable the boot menu, and have a wait of 5 seconds (5000 milliseconds) for you to choose. | ||
| + | - If you want, change the boot order by adding <code xml>< | ||
| + | |||
| + | === Starting the virtual === | ||
| + | - Start the virtual with <code bash> | ||
| + | - Immediately make the VNC connection (if you followed the manual edit, you have 5 seconds) | ||
| + | - When prompted, press ESC to choose the CDROM drive (assuming you didn't set it as the default) | ||
| + | === Cleanup === | ||
| + | Do the following if you want to remove the CDROM when you're done. Note: this is likely required if you set the CDROM as the primary boot device. | ||
| + | <code bash> | ||
| + | |||
| ==== Remove a network from the entire system ==== | ==== Remove a network from the entire system ==== | ||
| Line 214: | Line 259: | ||
| In my case, I had built a Windows domain without using virtio, and I wanted to change it. This was actually the simplest way I found to do it. | In my case, I had built a Windows domain without using virtio, and I wanted to change it. This was actually the simplest way I found to do it. | ||
| - | ==== Links ==== | + | |
| + | ===== Naming Network | ||
| + | |||
| + | to give a domain interface a static name when it is run, you can add the following to the interface definition. | ||
| + | <code xml>< | ||
| + | NOTE: the name must not begin with ' | ||
| + | https:// | ||
| + | <code xml> | ||
| + | < | ||
| + | <mac address=' | ||
| + | <source bridge=' | ||
| + | <target dev=' | ||
| + | <model type=' | ||
| + | <address type=' | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | You can now do things like <code bash> | ||
| + | |||
| + | ===== Adding USB Drive Image ===== | ||
| + | |||
| + | Building and using a USB Thumbdrive image is a little weird, but it can be done. See [[software: | ||
| + | |||
| + | ===== Links ===== | ||
| * https:// | * https:// | ||
| Line 221: | Line 289: | ||
| * https:// | * https:// | ||
| * https:// | * https:// | ||
| + | * https:// | ||
| + | |||
unix/virtualization/virtlib/quickreference.1653000255.txt.gz · Last modified: 2022/05/19 17:44 by rodolico
