|
|
| (131 dazwischenliegende Versionen von 7 Benutzern werden nicht angezeigt) |
| Zeile 1: |
Zeile 1: |
| | =Grundlagen= |
| | *[[QEMU,KVM,libvirt]] |
| | *[[KVM Grundlagen]] |
| | =Dokumentation= |
| | *https://libvirt.org/docs.html |
| =Installation= | | =Installation= |
| ==Vorbereitung==
| | *[[KVM Installation]] |
| Testen ob VT Unterstützung der CPU vorhanden ist
| | =Virtual Machine Manager= |
| egrep -c '(vmx|svm)' /proc/cpuinfo
| | *[[Virtual Machine Manager]] |
| 0 bedeutet keine Unterstützung
| |
| 1 (oder mehr) Unterstützung vorhanden
| |
| ==Basis Pakete== | |
| apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils virtinst
| |
| apt-get install ssh-askpass
| |
|
| |
|
| ==Verifizieren der Installation== | | =Virsh= |
| virsh -c qemu:///system list
| | *[[Virsh]] |
| Id Name Status
| |
| ----------------------------------
| |
| ==Installation des Virtmanagers(GUI)==
| |
| apt-get install virt-manager
| |
| ==Installation des Linux capabilities tools==
| |
| apt-get install libcap2-bin
| |
| ==Vergeben der CAP_NET_ADMIN Fähigkeit==
| |
| setcap cap_net_admin=ei /usr/bin/qemu-system-x86_64
| |
| setcap cap_net_admin=ei /usr/bin/qemu-system-i386
| |
|
| |
|
| ==Erlauben der Beerchtigung für den Adminuser==
| |
| echo cap_net_admin xinux >> /etc/security/capability.conf
| |
|
| |
|
| ==Netzwerk mit Bridgefunktion== | | =Virt= |
| auto lo
| | *[[virt-clone]] |
| iface lo inet loopback
| | *[[virt-viewer]] |
|
| | *[[virt-top]] |
| auto eth0
| | *[[libguestfs-tools]] |
| iface eth0 inet manual
| |
|
| |
| auto br0
| |
| iface br0 inet static
| |
| address 192.168.240.101
| |
| netmask 255.255.240.0
| |
| gateway 192.168.240.100
| |
| bridge_ports eth0
| |
| bridge_stp off
| |
| bridge_fd 1
| |
| bridge_maxwait 12
| |
|
| |
|
| Damit libvirt-bin automatisch start muss man in der Datei /etc/default/libvirt-bin die Option start_libvirtd auf "yes" setzen.
| | =Examples= |
| vi /etc/default/libvirt-bin
| | *[[Konvertierung eines VirtualBox Images und anbinden an eine Virtuelle Maschnine]] |
| start_libvirtd="yes"
| |
|
| |
|
| =Domain-Installation= | | =Cluster= |
| | *[[virsh-cluster]] |
| | *[[Libvirt PCS]] |
|
| |
|
| | =Welche Produkte nutzen KVM= |
| | *[[Welche Produkte nutzen KVM]] |
| | =Qemu Agent= |
| | *[[Qemu Agent]] |
| | *[[Virtio Treiber]] |
|
| |
|
| virt-install --connect qemu:///system --name orion --ram 1024 --disk path=/dev/data/orion \
| | =Linux handling= |
| --cdrom /isos/ubuntu-10.04-server-amd64.iso --vnc --noautoconsole --os-type linux --accelerate --network=bridge:br0
| | *[[Linux bridge-utils]] |
| | *[[Libvirt Openvswitch]] |
| | *[[linux vlan]] |
| | *[[macvlan]] |
| | *[[LVM]] |
|
| |
|
| {|border=1
| | =KVM Images= |
| |name
| | *[[KVM Images]] |
| |Name der Domain
| | =Libivirt= |
| |-
| | *[[Libvirt Directories]] |
| |disk
| | *[[Libvirt TLS]] |
| |Diese Images werden in die Domain eingebunden. Es können mehrere Disks eingebunden werden, sowie weitere Optionen getrennt mit Leerzeichen gemacht werden.
| | *[[Libvirt SSH]] |
| |-
| | *[[Libvirt Client]] |
| |ram
| |
| |Zu Verfügung stehender Arbeitspeicher der Domain
| |
| |-
| |
| |os-type
| |
| |linux, windows, solaris etc.
| |
| |-
| |
| |os-variant
| |
| |ubuntukarmic, winxp etc.
| |
| |-
| |
| |hvm
| |
| |Gebraucht full virtualization.
| |
| |-
| |
| |accelerate
| |
| |Benutze kvm oder KQEMU, wenn vorhanden.
| |
| |-
| |
| |import
| |
| |Die Installation ist bereits im Disk-Image enthalten.
| |
| |-
| |
| |vnc
| |
| |Aktiviert VNC-Display und öffnete einen beliebigen Port >5000, falls nicht --vncport angegeben ist.
| |
| |-
| |
| |vncport
| |
| |Setzt den Port für VNC fest.
| |
| |}
| |
|
| |
|
| =Handling=
| |
| This command outputs the guest's XML configuration file to standard out (stdout).
| |
| You can save the data by piping the output to a file. An example of piping the output to a file called guest.xml:
| |
|
| |
|
| virsh dumpxml GuestID > guest.xml
| | =Tools= |
| | *[[qemu-img]] |
| | =Nested Virtualiziation= |
| | *[[How to enable nested virtualization in KVM]] |
| | *[[Proxmox in KVM]] |
| | *[[KVM Nested Client]] |
|
| |
|
| | =KVM Lösungen= |
| | *[[Ganeti]] |
| | *[[Proxmox]] |
| | *[[Ovirt]] |
| | *[[Foreman]] |
| | =KVM loging und debuging= |
| | *[[KVM loging und debugging]] |
|
| |
|
| | =Xming= |
| | *[[Xming]] |
| | =CGroups= |
| | *[[cgroups]] |
| | *https://libvirt.org/cgroups.html |
| | *https://www.berrange.com/posts/2009/12/03/using-cgroups-with-libvirt-and-lxckvm-guests-in-fedora-12/ |
| | =FAQ= |
| | *http://wiki.libvirt.org/page/FAQ |
|
| |
|
| * [[Domain-Administration]]
| | = Links = |
| | | *https://libvirt.org/ |
| = Migration zu neuem Host = | | *https://www.linux-kvm.org/page/Main_Page |
| virsh migrate --live <GuestName> <DestinationURL>
| | *https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Administration_Guide/index.html |
| | |
| Beispiel:
| |
| # virsh migrate --live galactica qemu+ssh://test2.example.com/system
| |
| | |
| =Autostart =
| |
| virsh atutostart <domain>
| |
| virsh atutostart <domain> --disable
| |
| =An/Aus=
| |
| Connecten auf Hypervisor
| |
| virsh -c qemu+ssh://''SERVER''/system
| |
| In Konsole eingeben
| |
| | |
| Zum starten:
| |
| start ''VM''
| |
| Zum virtuellen Stecker rausziehn:
| |
| destroy ''VM''
| |
| Nach Installation von '''acpid''' auf ''VM''
| |
| | |
| Normales herunterfahren:
| |
| shutdown ''VM''
| |
| | |
| =Configure a Serial Console in the Guest=
| |
| ==Enable on the VM==
| |
| | |
| cat /etc/init/ttyS0.conf
| |
| | |
| # ttyS0 - getty
| |
| #
| |
| # This service maintains a getty on ttyS0 from the point the system is
| |
| # started until it is shut down again.
| |
|
| |
| start on stopped rc RUNLEVEL=[2345]
| |
| stop on runlevel [!2345]
| |
|
| |
| respawn
| |
| exec /sbin/getty -L 115200 ttyS0 xterm
| |
| | |
| Run the following command to initiate the Serial Console (or restart the VM):
| |
| | |
| sudo start ttyS0
| |
| | |
| ==Connect on Host to VM==
| |
| | |
| console VM
| |
| 00:50:56:00:31:f9
| |
| | |
| =Virtuelle MACAdresse vergeben=
| |
| | |
| gaius=KVM server
| |
| | |
| virsh console XXXXXXX
| |
| VM: cp /etc/udev/rules./70-persistent.net(cd).rules 70-persistent.net(cd).rules.orig
| |
| VM: herunterfahren...
| |
| gaius: vi /etc/libvirt/qemu/XXXXXX.xml
| |
| | |
| -> MAC eintragen
| |
| | |
| gaius: virsh define XXXXXXXX
| |
| gaius: virsh start XXXXXXXX
| |
| | |
| -> TESTEN
| |
| | |
| =Images umwandeln=
| |
| | |
| qemu-img convert {image_name}.qcow2 {image_name}.raw
| |
| | |
| | |
| ==snapshot==
| |
| http://kashyapc.wordpress.com/2013/01/22/live-backup-with-external-disk-snapshots-and-libvirts-blockpull/
| |
| Huang Wenlong 2011-09-26 03:14:09 EDT
| |
| | |
| Verify it with libvirt-0.9.4-13.el6.x86_64
| |
| | |
| | |
| 1. define a persistent domain named "snap"with qcow2 disks
| |
| 2. create a snapshot for domain snap
| |
| # virsh snapshot-create snap
| |
| 3.
| |
| virsh # snapshot-list snap
| |
| Name Creation Time State
| |
| ------------------------------------------------------------
| |
| 1317020538 2011-09-26 15:02:18 +0800 shutoff
| |
| | |
| 4.virsh # undefine snap
| |
| error: Failed to undefine domain snap
| |
| error: Requested operation is not valid: cannot delete inactive domain with 1 snapshots
| |
| | |
| 5. virsh undefine --snapshots-metadata snap
| |
| Domain snap has been undefined
| |
| | |
| 4. check snapshot metadata (no metadata)
| |
| # ls /var/lib/libvirt/qemu/snapshot/snap
| |
| 5. define a new domain with the same name, but different UUID
| |
| 6. check snapshot for domain test: | |
| # virsh snapshot-list snap
| |
| Name Creation Time State
| |
| ---------------------------------------------------------
| |
| | |
| https://bugzilla.redhat.com/show_bug.cgi?id=735457
| |
| | |
| =Links=
| |
| ==qemu-monitor==
| |
| http://blog.vmsplice.net/2011/03/how-to-access-qemu-monitor-through.html
| |
|
| |
|
| = Links = | | =Misc= |
| * http://wiki.centos.org/HowTos/KVM | | *https://wiki.libvirt.org/page/UbuntuKVMWalkthrough |
| * https://help.ubuntu.com/community/KVM/Access | | *http://rabexc.org/posts/how-to-get-started-with-libvirt-on |
| | *http://blog.loftninjas.org/2008/10/27/mounting-kvm-qcow2-qemu-disk-images/ |
| | *http://doku.corvent.ch/doku.php/linux/kvm |
| | *http://qemu-buch.de/d/Speichermedien/_Konvertieren_von_Image-Dateien |
| | *http://equivocation.org/node/107 |
| | *http://blog.dustinkirkland.com/2008/10/mounting-kvm-disk-image.html |
| | *http://wiki.centos.org/HowTos/KVM |
| | *https://help.ubuntu.com/community/KVM/Access |
| | *http://blog.programster.org/kvm-cheatsheet |