doc:appunti:linux:sa:virtualization
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
doc:appunti:linux:sa:virtualization [2011/12/14 10:41] – [Modalità network] niccolo | doc:appunti:linux:sa:virtualization [2019/08/28 12:03] – [Libvirt to manage KVM hosts: install, start, stop] niccolo | ||
---|---|---|---|
Line 5: | Line 5: | ||
* [[qemu]] | * [[qemu]] | ||
* [[xen]] | * [[xen]] | ||
- | + | * [[qemu_kvm]] | |
===== Linux kernel KVM ===== | ===== Linux kernel KVM ===== | ||
Line 88: | 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 131: | ||
</ | </ | ||
- | FIXME Pare che la riserva | + | 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 185: | 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 198: | 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 211: | Line 219: | ||
</ | </ | ||
- | The **virt-install** | + | The **virt-install** creates |
+ | |||
+ | In the following | ||
<code xml> | <code xml> | ||
Line 221: | Line 231: | ||
< | < | ||
<os> | <os> | ||
- | < | + | < |
<boot dev=' | <boot dev=' | ||
</os> | </os> | ||
Line 251: | Line 261: | ||
<script path=' | <script path=' | ||
</ | </ | ||
- | < | + | < |
<serial type=" | <serial type=" | ||
</ | </ | ||
Line 257: | Line 267: | ||
</ | </ | ||
</ | </ | ||
+ | |||
+ | **NOTICE**: The attributes **arch** and **machine** of tag **%%< | ||
+ | |||
+ | The VNC port can be assigned automatically (seting it to **'' | ||
+ | |||
+ | The **%%< | ||
+ | |||
+ | <code xml> | ||
+ | <os> | ||
+ | <type arch=' | ||
+ | </os> | ||
+ | <cpu mode=' | ||
+ | <model fallback=' | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | 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 263: | Line 306: | ||
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 ==== | ||
Line 419: | Line 464: | ||
<script path=' | <script path=' | ||
</ | </ | ||
- | < | + | < |
<serial type=" | <serial type=" | ||
</ | </ | ||
Line 503: | Line 548: | ||
* [[https:// | * [[https:// | ||
* [[http:// | * [[http:// | ||
+ | |||
+ | ===== Problema di timeout su disco ===== | ||
+ | |||
+ | Se la piattaforma ospitante è troppo carica (o forse se vengono effettuate operazioni di migrazione della macchina virtuale?), può accadere che il disco virtuale non risponda per diversi secondi. Ecco il messaggio registrato da '' | ||
+ | |||
+ | < | ||
+ | [100449.816153] ata1: lost interrupt (Status 0x50) | ||
+ | [100467.710383] end_request: | ||
+ | [100467.710922] Aborting journal on device sda3-8. | ||
+ | [100467.712097] EXT4-fs error (device sda3): ext4_journal_start_sb: | ||
+ | [100467.712594] EXT4-fs (sda3): Remounting filesystem read-only | ||
+ | [100469.754031] EXT4-fs error (device sda3) in ext4_da_writepages: | ||
+ | [100469.754676] EXT4-fs (sda3): ext4_da_writepages: | ||
+ | </ | ||
+ | |||
+ | In tal caso è possibile incrementare il timeout predefinito di **30 secondi**: | ||
+ | |||
+ | < | ||
+ | echo 180 > / | ||
+ | </ | ||
+ | |||
+ | Per rendere permanente questa modifica in Debian si può installare il pacchetto **sysfsutils** e aggiungere questa riga al file **''/ | ||
+ | |||
+ | < | ||
+ | block/ | ||
+ | </ | ||
+ | |||
+ | C'è chi suggerisce addirittura timeout di 900 secondi. | ||
+ | |||
+ | ===== Virtuozzo ===== | ||
+ | |||
+ | Il software di virtualizzazione [[wp> | ||
+ | |||
+ | ==== Limite | ||
+ | |||
+ | La piattaforma di virtualizzazione pone dei limiti sul numero di regole netfilter che si possono attivare. Per vedere il limite attuale: | ||
+ | |||
+ | < | ||
+ | cat / | ||
+ | </ | ||
+ | |||
+ | Vedere il valore //barrier// e //limit// di **numiptent**. Solo l' | ||
+ | |||
+ | L' | ||
+ | |||
+ | < | ||
+ | iptables-restore: | ||
+ | </ | ||
+ | |||
+ | ===== Virtualbox ===== | ||
+ | |||
+ | Prove fatte su Ubuntu 11.10. Si installa il pacchetto **'' | ||
+ | |||
+ | < | ||
+ | find / | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | In caso di aggiornamento del kernel bisogna ricordarsi di installare anche il pacchetto **'' |
doc/appunti/linux/sa/virtualization.txt · Last modified: 2019/08/28 12:09 by niccolo