lesson 12 virtualization KVM libvirtd virt-manager virsh list-all/destroy

find out if my system support Intel – VT / AMD -V hardware virtualization extensions for host CPU using the command line options

[root@svn ~]# egrep 'vmx|svm' /proc/cpuinfo 

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm ida arat epb pln pts dtherm tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt
[root@svn ~]# 



libvirtd - deamon allows to manage KVM virtualization.

Libvirtd allows to communicate with other kinds of virtualization such as linux containers.

virt-manager - GUI management program


virsh - virtualization shell


virt-install - install virtual machines, alternatively we can use virt-manager.

==================== check whether kernel modules are available and loaded
[root@svn ~]# lsmod | grep kvm
kvm_intel             170181  0 
kvm                   554609  1 kvm_intel
irqbypass              13503  1 kvm
[root@svn ~]# 
====================
[root@svn ~]# systemctl status libvirtd
● libvirtd.service - Virtualization daemon
   Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2017-05-21 23:42:29 EEST; 1 months 12 days ago
     Docs: man:libvirtd(8)
           http://libvirt.org
 Main PID: 1079 (libvirtd)
   CGroup: /system.slice/libvirtd.service
           ├─1079 /usr/sbin/libvirtd
           ├─1706 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
           └─1709 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper

Jun 19 23:02:24 svn.localdomain dnsmasq[1706]: using nameserver 192.168.174.2#53

Jun 19 23:35:17 svn.localdomain dnsmasq[1706]: no servers found in /etc/resolv.conf, will retry
Jun 19 23:35:19 svn.localdomain dnsmasq[1706]: reading /etc/resolv.conf
Jun 19 23:35:19 svn.localdomain dnsmasq[1706]: using nameserver 192.168.174.2#53
Jun 30 22:55:59 svn.localdomain dnsmasq[1706]: no servers found in /etc/resolv.conf, will retry
Jun 30 23:07:30 svn.localdomain dnsmasq[1706]: reading /etc/resolv.conf
Jun 30 23:07:30 svn.localdomain dnsmasq[1706]: using nameserver 192.168.174.2#53
Jul 03 22:54:05 svn.localdomain dnsmasq[1706]: no servers found in /etc/resolv.conf, will retry
Jul 03 23:07:51 svn.localdomain dnsmasq[1706]: reading /etc/resolv.conf
Jul 03 23:07:51 svn.localdomain dnsmasq[1706]: using nameserver 192.168.174.2#53
[root@svn ~]# 
====================

[root@svn ~]# ip link show 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether 00:0c:29:e7:8e:ec brd ff:ff:ff:ff:ff:ff
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT qlen 1000
    link/ether 52:54:00:e7:4f:ab brd ff:ff:ff:ff:ff:ff
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN mode DEFAULT qlen 1000
    link/ether 52:54:00:e7:4f:ab brd ff:ff:ff:ff:ff:ff
[root@svn ~]# 

virbr0 - virtual bridge, used to share network connections
====================
[root@svn ~]# arch

x86_64
====================
on libvirtd we can use many applications for virtualization: virt-manager, virsh

Show currently running virtual machines
[root@svn ~]# virsh list
 Id    Name                           State
----------------------------------------------------

Show currently existing machines
[root@svn ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     centos7.0                      shut off

[root@svn ~]# 
====================
[root@svn ~]# virsh start centos7.0
Domain centos7.0 started

[root@svn ~]# virsh list
 Id    Name                           State
----------------------------------------------------
 1     centos7.0                      running

[root@svn ~]# virsh destroy centos7.0
Domain centos7.0 destroyed

[root@svn ~]# virsh list
 Id    Name                           State
----------------------------------------------------

[root@svn ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     centos7.0                      shut off

[root@svn ~]# 
=======================
[root@svn qemu]# cat centos7.0.xml | more
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
  virsh edit centos7.0
or other application using the libvirt API.
-->

<domain type='kvm'>
  <name>centos7.0</name>
  <uuid>d620d75e-e088-45f9-a7b5-9d6378063d64</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
===================
How to change virtual machine configuration file
[root@svn qemu]# virsh edit centos7.0
Domain centos7.0 XML configuration not changed.

[root@svn qemu]# ll
total 8
-rw-------. 1 root root 4358 May  8 23:35 centos7.0.xml
drwx------. 3 root root   42 Mar  3 04:12 networks
[root@svn qemu]# pwd
/etc/libvirt/qemu
[root@svn qemu]# 
===================





Comments

Popular posts from this blog

HAproxy logging

teamcity Automatic Agent Start under Linux

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all