doc:appunti:linux:sa:virtualization
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:appunti:linux:sa:virtualization [2018/03/01 17:43] – niccolo | doc:appunti:linux:sa:virtualization [2019/08/28 12:09] (current) – [Libvirt to manage KVM hosts: install, start, stop] niccolo | ||
|---|---|---|---|
| Line 87: | Line 87: | ||
| La scheda di rete emulata ha bisogno di opportuni driver nella macchina guest. Linux offre nativamente il supporto per tale scheda di rete (virtio-net), | La scheda di rete emulata ha bisogno di opportuni driver nella macchina guest. Linux offre nativamente il supporto per tale scheda di rete (virtio-net), | ||
| + | |||
| ==== Modalità network ==== | ==== Modalità network ==== | ||
| Line 131: | Line 132: | ||
| Dopo aver cambiato il file di configurazione **non basta riavviare** il servizio libvirt-bin, | Dopo aver cambiato il file di configurazione **non basta riavviare** il servizio libvirt-bin, | ||
| + | |||
| ===== Starting a KVM virtual machine on an headless host ===== | ===== Starting a KVM virtual machine on an headless host ===== | ||
| Line 184: | Line 186: | ||
| After the virtual host is running, use **'' | After the virtual host is running, use **'' | ||
| - | ===== Using KVM with libvirt: start, stop and ACPI ===== | + | ===== Libvirt to manage |
| The **libvirt** toolkit allow to manage some virtualization systems (namely **xen**, **qemu** and **kvm**) in a consistent and uniform way. It provides an infrastructure to manage virtual machines: create, start, destroy, shutdown, ... | The **libvirt** toolkit allow to manage some virtualization systems (namely **xen**, **qemu** and **kvm**) in a consistent and uniform way. It provides an infrastructure to manage virtual machines: create, start, destroy, shutdown, ... | ||
| Line 197: | Line 199: | ||
| < | < | ||
| - | virt-install --name=virtual_lenny \ | + | virt-install |
| - | --ram 384 \ | + | |
| - | --file=/ | + | --virt-type kvm \ |
| - | --accelerate | + | --memory 1024 \ |
| + | --disk | ||
| + | | ||
| + | --os-variant auto \ | ||
| + | | ||
| + | | ||
| </ | </ | ||
| + | |||
| + | The disk size is specified in **Gibabytes**, | ||
| See the man page for using a CD-ROM boot image, etc. Now list the existing virtual machines and connect to the VNC console with the viewer (it requires X forward): | See the man page for using a CD-ROM boot image, etc. Now list the existing virtual machines and connect to the VNC console with the viewer (it requires X forward): | ||
| Line 210: | Line 219: | ||
| </ | </ | ||
| - | The **virt-install** | + | The **virt-install** creates |
| + | |||
| + | In the following | ||
| <code xml> | <code xml> | ||
| Line 258: | Line 269: | ||
| **NOTICE**: The attributes **arch** and **machine** of tag **%%< | **NOTICE**: The attributes **arch** and **machine** of tag **%%< | ||
| - | |||
| The VNC port can be assigned automatically (seting it to **'' | The VNC port can be assigned automatically (seting it to **'' | ||
| + | |||
| + | The **%%< | ||
| + | |||
| + | <code xml> | ||
| + | <os> | ||
| + | <type arch=' | ||
| + | </os> | ||
| + | <cpu mode=' | ||
| + | <model fallback=' | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | See the documentation about **[[https:// | ||
| + | |||
| + | You can use a **specific option** if you have an **Intel CPU**: | ||
| + | |||
| + | <code xml> | ||
| + | <cpu mode=' | ||
| + | <model fallback=' | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | or this one if you have an **AMD CPU**: | ||
| + | |||
| + | <code xml> | ||
| + | <cpu mode=' | ||
| + | <model fallback=' | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ===== Libvirt and ACPI ===== | ||
| The nice thing is that you can control automatic start and stop of the virtual machines. Install the **acpid** package on the virtual host and load the **button** kernel module. Then you can start a shutdown sequence on the virtual host issuing the following command on the hosting machine: | The nice thing is that you can control automatic start and stop of the virtual machines. Install the **acpid** package on the virtual host and load the **button** kernel module. Then you can start a shutdown sequence on the virtual host issuing the following command on the hosting machine: | ||
| Line 267: | Line 308: | ||
| virsh shutdown virtual_lenny | virsh shutdown virtual_lenny | ||
| </ | </ | ||
| + | |||
| + | The default shutdown of the host machine, will perform a clean shutdown of the guest machines. | ||
| ==== Connecting to the virtual host ==== | ==== Connecting to the virtual host ==== | ||
doc/appunti/linux/sa/virtualization.1519922629.txt.gz · Last modified: by niccolo
