Kvm notes sandbox: различия между версиями

Материал из Toshiba AC100 wiki
Перейти к навигации Перейти к поиску
м (add guest migration)
м (add couple more notes)
Строка 1: Строка 1:
==Good links==
[https://doc.opensuse.org/documentation/leap/virtualization/html/book.virt/book.virt.html openSUSE Guide] <br/>
[https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Administration_Guide/index.html RHEL Guide] <br/>
==Forward kvm host qemu vnc with ssh==
==Forward kvm host qemu vnc with ssh==
<pre>
<pre>
Строка 18: Строка 22:
<pre>
<pre>
virsh create guest-name.xml
virsh create guest-name.xml
</pre>
==Create guest==
<pre>
virt-install --name <name> --connect qemu:///system --virt-type kvm --memory 30720 --vcpus 8 --nodisks \
--os-variant opensuse42 --network bridge=br0 --boot=hd --pxe --vnc --vnclisten=localhost --vncport=5900
</pre>
==Attach block device to guest==
Create xml config for example vda.xml
<pre>
<disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source dev='/dev/sda5'/>
      <target dev='vda' bus='virtio'/>
</disk>
Permanently attach block device to already existing domain
<pre>
# virsh attach-disk <domain-name> vda.xml --persistent
</pre>
</pre>

Версия от 23:09, 23 января 2017

Good links

openSUSE Guide
RHEL Guide

Forward kvm host qemu vnc with ssh

$ ssh -L 5900:localhost:5900 <kvm-host-ip> -N

List all guests even not started

# virsh list --all

Guest migration

Dump config

virsh dumpxml --migratable <guest-name> >guest-name.xml

Restore guest config on new host

virsh create guest-name.xml

Create guest

virt-install --name <name> --connect qemu:///system --virt-type kvm --memory 30720 --vcpus 8 --nodisks \
--os-variant opensuse42 --network bridge=br0 --boot=hd --pxe --vnc --vnclisten=localhost --vncport=5900

Attach block device to guest

Create xml config for example vda.xml

<disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source dev='/dev/sda5'/>
      <target dev='vda' bus='virtio'/>
</disk>

Permanently attach block device to already existing domain
<pre>
# virsh attach-disk <domain-name> vda.xml --persistent