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/01/08 18:03] – [Using KVM with libvirt: start, stop and ACPI] niccolo | doc:appunti:linux:sa:virtualization [2019/08/28 12:09] (current) – [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: | ||
</ | </ | ||
- | 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 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 258: | Line 268: | ||
</ | </ | ||
- | **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 268: | 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.1515431034.txt.gz · Last modified: 2018/01/08 18:03 by niccolo