您的位置:首页 > 运维架构 > Linux

Linux 虚拟机之--KVM的安装和配置(一)

2015-11-25 10:29 615 查看
Linux 虚拟机之--KVM的安装和配置(一)
系统环境:
操作系统: RedHat EL6.4(x86_64)

一、前言 KVM,即Kernel-based Virtual Machine的简称,是一个开源的系统虚拟化模块,自Linux 2.6.20之后集成在Linux的各个主要发行版本中。它使用Linux自身的调度器进行管理,所以相对于Xen,其核心源码很少。KVM目前已成为学术界的主流VMM之一。KVM的虚拟化需要硬件支持(如Intel VT技术或者AMD V技术)。是基于硬件的完全虚拟化。而Xen早期则是基于软件模拟的Para-Virtualization, 新版本则是基于硬件支持的完全虚拟化。但Xen本身有自己的进程调度器,存储管理模块等,所以代码较为庞大。广为流传的商业系统虚拟化软件VMware ESX系列也是基于软件模拟的Para-Virtualization。二、配置环境软件包组:virtualization 提供虚拟机的环境,主要包含qemu-kvmvirtualization-client 管理和安装虚拟机实例的客户端,主要有python-virtinst,virt-manager,virt-viewervirtualization-platform 提供访问和控制虚拟客户端的接口,主要有libvirt,libvirt-clientvirtualization-tools 管理离线虚拟机镜像的工具,主要有libguestfs根据需求选择软件包,一般都安装前三个,也可以只安装个别主要的包。为了减少不必要的麻烦,请关闭防火墙和SELinux# cat /proc/cpuinfo |grep flags 需要全虚拟化支持为vmx(Inter)或svm(AMD)三、安装KVM软件包1、查看主机CPU信息
[root@rh64 ~]# cat /proc/cpuinfo|grep flag
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc up rep_good xtopology nonstop_tsc unfair_spinlock pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm
2、查看系统内核版本[root@rh64 ~]# uname -a
Linux rh64 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux3、通过系统安装盘安装kvm软件包
[root@rh64 ~]# mount /dev/sr0 /media
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@rh64 ~]# yum groupinstall "Virtualization" "Virtualization Client" "Virtualzation Platform"
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
base                                                                                       | 3.9 kB     00:00 ...
Setting up Group Process
base/group_gz                                                                              | 204 kB     00:00 ...
Warning: Group Virtualzation Platform does not exist.
Resolving Dependencies
--> Running transaction check
---> Package hypervkvpd.x86_64 0:0-0.9.el6 will be installed
---> Package python-virtinst.noarch 0:0.600.0-15.el6 will be installed
--> Processing Dependency: libvirt-python >= 0.2.0 for package: python-virtinst-0.600.0-15.el6.noarch
---> Package qemu-kvm.x86_64 2:0.12.1.2-2.355.el6 will be installed
base/filelists_db                                                                          | 3.7 MB     00:00 ...
--> Processing Dependency: qemu-img = 2:0.12.1.2-2.355.el6 for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: seabios >= 0.6.1.2-20.el6 for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: vgabios-vmware for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: vgabios-stdvga for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: vgabios-qxl for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: vgabios for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: libspice-server.so.1(SPICE_SERVER_0.8.3)(64bit) for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: libspice-server.so.1(SPICE_SERVER_0.8.2)(64bit) for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: libspice-server.so.1(SPICE_SERVER_0.8.1)(64bit) for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: libspice-server.so.1(SPICE_SERVER_0.6.0)(64bit) for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: libspice-server.so.1(SPICE_SERVER_0.11.2)(64bit) for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: libspice-server.so.1(SPICE_SERVER_0.10.4)(64bit) for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: /usr/share/sgabios/sgabios.bin for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: /usr/share/gpxe/virtio-net.rom for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: /usr/share/gpxe/rtl8139.rom for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: /usr/share/gpxe/rtl8029.rom for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: /usr/share/gpxe/pcnet32.rom for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: /usr/share/gpxe/e1000-0x100e.rom for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: libusbredirparser.so.1()(64bit) for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
--> Processing Dependency: libspice-server.so.1()(64bit) for package: 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64
---> Package virt-manager.x86_64 0:0.9.0-18.el6 will be installed
--> Processing Dependency: gtk-vnc-python >= 0.3.8 for package: virt-manager-0.9.0-18.el6.x86_64
--> Processing Dependency: gnome-python2-gnomekeyring >= 2.15.4 for package: virt-manager-0.9.0-18.el6.x86_64
--> Processing Dependency: spice-gtk-python for package: virt-manager-0.9.0-18.el6.x86_64
---> Package virt-top.x86_64 0:1.0.4-3.15.el6 will be installed
---> Package virt-viewer.x86_64 0:0.5.2-18.el6 will be installed
--> Processing Dependency: libspice-client-gtk-2.0.so.4(SPICEGTK_1)(64bit) for package: virt-viewer-0.5.2-18.el6.x86_64
--> Processing Dependency: libspice-client-glib-2.0.so.8(SPICEGTK_1)(64bit) for package: virt-viewer-0.5.2-18.el6.x86_64
--> Processing Dependency: libspice-controller.so.0()(64bit) for package: virt-viewer-0.5.2-18.el6.x86_64
--> Processing Dependency: libspice-client-gtk-2.0.so.4()(64bit) for package: virt-viewer-0.5.2-18.el6.x86_64
--> Processing Dependency: libspice-client-glib-2.0.so.8()(64bit) for package: virt-viewer-0.5.2-18.el6.x86_64
--> Processing Dependency: libgtk-vnc-1.0.so.0()(64bit) for package: virt-viewer-0.5.2-18.el6.x86_64
--> Running transaction check
---> Package gnome-python2-gnomekeyring.x86_64 0:2.28.0-4.el6 will be installed
---> Package gpxe-roms-qemu.noarch 0:0.9.7-6.9.el6 will be installed
---> Package gtk-vnc.x86_64 0:0.3.10-3.el6 will be installed
---> Package gtk-vnc-python.x86_64 0:0.3.10-3.el6 will be installed
---> Package libvirt-python.x86_64 0:0.10.2-18.el6 will be installed
---> Package qemu-img.x86_64 2:0.12.1.2-2.355.el6 will be installed
---> Package seabios.x86_64 0:0.6.1.2-26.el6 will be installed
---> Package sgabios-bin.noarch 0:0-0.3.20110621svn.el6 will be installed
---> Package spice-glib.x86_64 0:0.14-7.el6 will be installed
--> Processing Dependency: libcelt051.so.0()(64bit) for package: spice-glib-0.14-7.el6.x86_64
--> Processing Dependency: libcacard.so.0()(64bit) for package: spice-glib-0.14-7.el6.x86_64
---> Package spice-gtk.x86_64 0:0.14-7.el6 will be installed
---> Package spice-gtk-python.x86_64 0:0.14-7.el6 will be installed
---> Package spice-server.x86_64 0:0.12.0-12.el6 will be installed
---> Package usbredir.x86_64 0:0.5.1-1.el6 will be installed
---> Package vgabios.noarch 0:0.6b-3.7.el6 will be installed
--> Running transaction check
---> Package celt051.x86_64 0:0.5.1.3-0.el6 will be installed
---> Package libcacard.x86_64 0:0.15.0-2.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================
Package                               Arch              Version                            Repository       Size
===================================================================================================
Installing:
hypervkvpd                            x86_64            0-0.9.el6                          base             17 k
python-virtinst                       noarch            0.600.0-15.el6                     base            490 k
qemu-kvm                              x86_64            2:0.12.1.2-2.355.el6               base            1.3 M
virt-manager                          x86_64            0.9.0-18.el6                       base            1.0 M
virt-top                              x86_64            1.0.4-3.15.el6                     base            368 k
virt-viewer                           x86_64            0.5.2-18.el6                       base            200 k
Installing for dependencies:
celt051                               x86_64            0.5.1.3-0.el6                      base             50 k
gnome-python2-gnomekeyring            x86_64            2.28.0-4.el6                       base             24 k
gpxe-roms-qemu                        noarch            0.9.7-6.9.el6                      base            219 k
gtk-vnc                               x86_64            0.3.10-3.el6                       base             95 k
gtk-vnc-python                        x86_64            0.3.10-3.el6                       base             17 k
libcacard                             x86_64            0.15.0-2.el6                       base             41 k
libvirt-python                        x86_64            0.10.2-18.el6                      base            457 k
qemu-img                              x86_64            2:0.12.1.2-2.355.el6               base            469 k
seabios                               x86_64            0.6.1.2-26.el6                     base             91 k
sgabios-bin                           noarch            0-0.3.20110621svn.el6              base            6.6 k
spice-glib                            x86_64            0.14-7.el6                         base            291 k
spice-gtk                             x86_64            0.14-7.el6                         base             54 k
spice-gtk-python                      x86_64            0.14-7.el6                         base             22 k
spice-server                          x86_64            0.12.0-12.el6                      base            326 k
usbredir                              x86_64            0.5.1-1.el6                        base             40 k
vgabios                               noarch            0.6b-3.7.el6                       base             42 k
Transaction Summary
===================================================================================================
Install      22 Package(s)
Total download size: 5.6 M
Installed size: 19 M
Is this ok [y/N]:
Downloading Packages:
------------------------------------------------------------------------------------------------------------------
Total                                                                              10 MB/s | 5.6 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
openssl-1.0.1e-42.el6.x86_64 is a duplicate with openssl-1.0.0-27.el6.x86_64
Installing : usbredir-0.5.1-1.el6.x86_64                                                                   1/22
Installing : celt051-0.5.1.3-0.el6.x86_64                                                                  2/22
Installing : libcacard-0.15.0-2.el6.x86_64                                                                 3/22
Installing : spice-glib-0.14-7.el6.x86_64                                                                  4/22
Installing : spice-gtk-0.14-7.el6.x86_64                                                                   5/22
Installing : gtk-vnc-0.3.10-3.el6.x86_64                                                                   6/22
Installing : libvirt-python-0.10.2-18.el6.x86_64                                                           7/22
Installing : python-virtinst-0.600.0-15.el6.noarch                                                         8/22
Installing : gtk-vnc-python-0.3.10-3.el6.x86_64                                                            9/22
Installing : spice-gtk-python-0.14-7.el6.x86_64                                                           10/22
Installing : spice-server-0.12.0-12.el6.x86_64                                                            11/22
Installing : 2:qemu-img-0.12.1.2-2.355.el6.x86_64                                                         12/22
Installing : seabios-0.6.1.2-26.el6.x86_64                                                                13/22
Installing : gpxe-roms-qemu-0.9.7-6.9.el6.noarch                                                          14/22
Installing : sgabios-bin-0-0.3.20110621svn.el6.noarch                                                     15/22
Installing : vgabios-0.6b-3.7.el6.noarch                                                                  16/22
Installing : gnome-python2-gnomekeyring-2.28.0-4.el6.x86_64                                               17/22
Installing : virt-manager-0.9.0-18.el6.x86_64                                                             18/22
Installing : 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64                                                         19/22
Installing : virt-viewer-0.5.2-18.el6.x86_64                                                              20/22
Installing : hypervkvpd-0-0.9.el6.x86_64                                                                  21/22
Installing : virt-top-1.0.4-3.15.el6.x86_64                                                               22/22
Verifying  : gnome-python2-gnomekeyring-2.28.0-4.el6.x86_64                                                1/22
Verifying  : spice-glib-0.14-7.el6.x86_64                                                                  2/22
Verifying  : virt-top-1.0.4-3.15.el6.x86_64                                                                3/22
Verifying  : vgabios-0.6b-3.7.el6.noarch                                                                   4/22
Verifying  : 2:qemu-img-0.12.1.2-2.355.el6.x86_64                                                          5/22
Verifying  : sgabios-bin-0-0.3.20110621svn.el6.noarch                                                      6/22
Verifying  : spice-gtk-0.14-7.el6.x86_64                                                                   7/22
Verifying  : celt051-0.5.1.3-0.el6.x86_64                                                                  8/22
Verifying  : usbredir-0.5.1-1.el6.x86_64                                                                   9/22
Verifying  : hypervkvpd-0-0.9.el6.x86_64                                                                  10/22
Verifying  : gpxe-roms-qemu-0.9.7-6.9.el6.noarch                                                          11/22
Verifying  : libvirt-python-0.10.2-18.el6.x86_64                                                          12/22
Verifying  : spice-server-0.12.0-12.el6.x86_64                                                            13/22
Verifying  : virt-viewer-0.5.2-18.el6.x86_64                                                              14/22
Verifying  : virt-manager-0.9.0-18.el6.x86_64                                                             15/22
Verifying  : libcacard-0.15.0-2.el6.x86_64                                                                16/22
Verifying  : python-virtinst-0.600.0-15.el6.noarch                                                        17/22
Verifying  : seabios-0.6.1.2-26.el6.x86_64                                                                18/22
Verifying  : gtk-vnc-python-0.3.10-3.el6.x86_64                                                           19/22
Verifying  : gtk-vnc-0.3.10-3.el6.x86_64                                                                  20/22
Verifying  : 2:qemu-kvm-0.12.1.2-2.355.el6.x86_64                                                         21/22
Verifying  : spice-gtk-python-0.14-7.el6.x86_64                                                           22/22
Installed:
hypervkvpd.x86_64 0:0-0.9.el6      python-virtinst.noarch 0:0.600.0-15.el6 qemu-kvm.x86_64 2:0.12.1.2-2.355.el6
virt-manager.x86_64 0:0.9.0-18.el6 virt-top.x86_64 0:1.0.4-3.15.el6        virt-viewer.x86_64 0:0.5.2-18.el6
Dependency Installed:
celt051.x86_64 0:0.5.1.3-0.el6                     gnome-python2-gnomekeyring.x86_64 0:2.28.0-4.el6
gpxe-roms-qemu.noarch 0:0.9.7-6.9.el6              gtk-vnc.x86_64 0:0.3.10-3.el6
gtk-vnc-python.x86_64 0:0.3.10-3.el6               libcacard.x86_64 0:0.15.0-2.el6
libvirt-python.x86_64 0:0.10.2-18.el6              qemu-img.x86_64 2:0.12.1.2-2.355.el6
seabios.x86_64 0:0.6.1.2-26.el6                    sgabios-bin.noarch 0:0-0.3.20110621svn.el6
spice-glib.x86_64 0:0.14-7.el6                     spice-gtk.x86_64 0:0.14-7.el6
spice-gtk-python.x86_64 0:0.14-7.el6               spice-server.x86_64 0:0.12.0-12.el6
usbredir.x86_64 0:0.5.1-1.el6                      vgabios.noarch 0:0.6b-3.7.el6

Complete!

四、配置KVM建立虚拟机
[root@rh64 u02]# mkdir /u02/data //建立虚拟机存储空间
通过VNC连接主机,进行配置:1、vnc连接


2、配置KVM


2、KVM安装包


4、提示启动“libvirt service”


[root@rh64 ~]# service libvirtd restart
Stopping libvirtd daemon: [FAILED]
Starting libvirtd daemon: [ OK ]5、KVM虚拟机summary






6、建立虚拟机


7、选择虚拟机的操作系统和安装ISO


8、配置虚拟机Memory和CPU


9、设置虚拟机的Storage


10、虚拟机配置信息汇总


[root@rh64 ~]# service libvirtd status
libvirtd (pid 3163) is running...
查看建立的虚拟机的存储信息:
[root@rh64 ~]# cd /u02/data
[root@rh64 data]# ls
rh6.img
[root@rh64 data]# pwd
/u02/data
[root@rh64 data]# ls -l
total 8396812
-rwxr-xr-x 1 qemu qemu 8589934592 Nov 24 13:08 rh6.img
五、KVM基本的管理命令
[root@rh64 ~]# virsh
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh # help
Grouped commands:
Domain Management (help keyword 'domain'):
attach-device                  attach device from an XML file
attach-disk                    attach disk device
attach-interface               attach network interface
autostart                      autostart a domain
blkdeviotune                   Set or query a block device I/O tuning parameters.
blkiotune                      Get or set blkio parameters
blockcommit                    Start a block commit operation.
blockcopy                      Start a block copy operation.
blockjob                       Manage active block operations
blockpull                      Populate a disk from its backing image.
blockresize                    Resize block device of domain.
change-media                   Change media of CD or floppy drive
console                        connect to the guest console
cpu-baseline                   compute baseline CPU
cpu-compare                    compare host CPU with a CPU described by an XML file
cpu-stats                      show domain cpu statistics
create                         create a domain from an XML file
define                         define (but don't start) a domain from an XML file
desc                           show or set domain's description or title
destroy                        destroy (stop) a domain
detach-device                  detach device from an XML file
detach-disk                    detach disk device
detach-interface               detach network interface
domdisplay                     domain display connection URI
domhostname                    print the domain's hostname
domid                          convert a domain name or UUID to domain id
domif-setlink                  set link state of a virtual interface
domiftune                      get/set parameters of a virtual interface
domjobabort                    abort active domain job
domjobinfo                     domain job information
domname                        convert a domain id or UUID to domain name
dompmsuspend                   suspend a domain gracefully using power management functions
dompmwakeup                    wakeup a domain from pmsuspended state
domuuid                        convert a domain name or id to domain UUID
domxml-from-native             Convert native config to domain XML
domxml-to-native               Convert domain XML to native config
dump                           dump the core of a domain to a file for analysis
dumpxml                        domain information in XML
edit                           edit XML configuration for a domain
inject-nmi                     Inject NMI to the guest
send-key                       Send keycodes to the guest
managedsave                    managed save of a domain state
managedsave-remove             Remove managed save of a domain
maxvcpus                       connection vcpu maximum
memtune                        Get or set memory parameters
migrate                        migrate domain to another host
migrate-setmaxdowntime         set maximum tolerable downtime
migrate-setspeed               Set the maximum migration bandwidth
migrate-getspeed               Get the maximum migration bandwidth
numatune                       Get or set numa parameters
reboot                         reboot a domain
reset                          reset a domain
restore                        restore a domain from a saved state in a file
resume                         resume a domain
save                           save a domain state to a file
save-image-define              redefine the XML for a domain's saved state file
save-image-dumpxml             saved state domain information in XML
save-image-edit                edit XML for a domain's saved state file
schedinfo                      show/set scheduler parameters
screenshot                     take a screenshot of a current domain console and store it into a file
setmaxmem                      change maximum memory limit
setmem                         change memory allocation
setvcpus                       change number of virtual CPUs
shutdown                       gracefully shutdown a domain
start                          start a (previously defined) inactive domain
suspend                        suspend a domain
ttyconsole                     tty console
undefine                       undefine a domain
update-device                  update device from an XML file
vcpucount                      domain vcpu counts
vcpuinfo                       detailed domain vcpu information
vcpupin                        control or query domain vcpu affinity
emulatorpin                    control or query domain emulator affinity
vncdisplay                     vnc display
Domain Monitoring (help keyword 'monitor'):
domblkerror                    Show errors on block devices
domblkinfo                     domain block device size information
domblklist                     list all domain blocks
domblkstat                     get device block stats for a domain
domcontrol                     domain control interface state
domif-getlink                  get link state of a virtual interface
domiflist                      list all domain virtual interfaces
domifstat                      get network interface stats for a domain
dominfo                        domain information
dommemstat                     get memory statistics for a domain
domstate                       domain state
list                           list domains
Host and Hypervisor (help keyword 'host'):
capabilities                   capabilities
connect                        (re)connect to hypervisor
freecell                       NUMA free memory
hostname                       print the hypervisor hostname
node-memory-tune               Get or set node memory parameters
nodecpustats                   Prints cpu stats of the node.
nodeinfo                       node information
nodememstats                   Prints memory stats of the node.
nodesuspend                    suspend the host node for a given time duration
qemu-attach                    QEMU Attach
qemu-monitor-command           QEMU Monitor Command
qemu-agent-command             QEMU Guest Agent Command
sysinfo                        print the hypervisor sysinfo
uri                            print the hypervisor canonical URI
version                        show version
Interface (help keyword 'interface'):
iface-begin                    create a snapshot of current interfaces settings, which can be later committed (iface-commit) or restored (iface-rollback)
iface-bridge                   create a bridge device and attach an existing network device to it
iface-commit                   commit changes made since iface-begin and free restore point
iface-define                   define (but don't start) a physical host interface from an XML file
iface-destroy                  destroy a physical host interface (disable it / "if-down")
iface-dumpxml                  interface information in XML
iface-edit                     edit XML configuration for a physical host interface
iface-list                     list physical host interfaces
iface-mac                      convert an interface name to interface MAC address
iface-name                     convert an interface MAC address to interface name
iface-rollback                 rollback to previous saved configuration created via iface-begin
iface-start                    start a physical host interface (enable it / "if-up")
iface-unbridge                 undefine a bridge device after detaching its slave device
iface-undefine                 undefine a physical host interface (remove it from configuration)
Network Filter (help keyword 'filter'):
nwfilter-define                define or update a network filter from an XML file
nwfilter-dumpxml               network filter information in XML
nwfilter-edit                  edit XML configuration for a network filter
nwfilter-list                  list network filters
nwfilter-undefine              undefine a network filter
Networking (help keyword 'network'):
net-autostart                  autostart a network
net-create                     create a network from an XML file
net-define                     define (but don't start) a network from an XML file
net-destroy                    destroy (stop) a network
net-dumpxml                    network information in XML
net-edit                       edit XML configuration for a network
net-info                       network information
net-list                       list networks
net-name                       convert a network UUID to network name
net-start                      start a (previously defined) inactive network
net-undefine                   undefine an inactive network
net-update                     update parts of an existing network's configuration
net-uuid                       convert a network name to network UUID
Node Device (help keyword 'nodedev'):
nodedev-create                 create a device defined by an XML file on the node
nodedev-destroy                destroy (stop) a device on the node
nodedev-detach                 detach node device from its device driver
nodedev-dumpxml                node device details in XML
nodedev-list                   enumerate devices on this host
nodedev-reattach               reattach node device to its device driver
nodedev-reset                  reset node device
Secret (help keyword 'secret'):
secret-define                  define or modify a secret from an XML file
secret-dumpxml                 secret attributes in XML
secret-get-value               Output a secret value
secret-list                    list secrets
secret-set-value               set a secret value
secret-undefine                undefine a secret
Snapshot (help keyword 'snapshot'):
snapshot-create                Create a snapshot from XML
snapshot-create-as             Create a snapshot from a set of args
snapshot-current               Get or set the current snapshot
snapshot-delete                Delete a domain snapshot
snapshot-dumpxml               Dump XML for a domain snapshot
snapshot-edit                  edit XML for a snapshot
snapshot-info                  snapshot information
snapshot-list                  List snapshots for a domain
snapshot-parent                Get the name of the parent of a snapshot
snapshot-revert                Revert a domain to a snapshot
Storage Pool (help keyword 'pool'):
find-storage-pool-sources-as   find potential storage pool sources
find-storage-pool-sources      discover potential storage pool sources
pool-autostart                 autostart a pool
pool-build                     build a pool
pool-create-as                 create a pool from a set of args
pool-create                    create a pool from an XML file
pool-define-as                 define a pool from a set of args
pool-define                    define (but don't start) a pool from an XML file
pool-delete                    delete a pool
pool-destroy                   destroy (stop) a pool
pool-dumpxml                   pool information in XML
pool-edit                      edit XML configuration for a storage pool
pool-info                      storage pool information
pool-list                      list pools
pool-name                      convert a pool UUID to pool name
pool-refresh                   refresh a pool
pool-start                     start a (previously defined) inactive pool
pool-undefine                  undefine an inactive pool
pool-uuid                      convert a pool name to pool UUID
Storage Volume (help keyword 'volume'):
vol-clone                      clone a volume.
vol-create-as                  create a volume from a set of args
vol-create                     create a vol from an XML file
vol-create-from                create a vol, using another volume as input
vol-delete                     delete a vol
vol-download                   Download a volume to a file
vol-dumpxml                    vol information in XML
vol-info                       storage vol information
vol-key                        returns the volume key for a given volume name or path
vol-list                       list vols
vol-name                       returns the volume name for a given volume key or path
vol-path                       returns the volume path for a given volume name or key
vol-pool                       returns the storage pool for a given volume key or path
vol-resize                     resize a vol
vol-upload                     upload a file into a volume
vol-wipe                       wipe a vol
Virsh itself (help keyword 'virsh'):
cd                             change the current directory
echo                           echo arguments
exit                           quit this interactive terminal
help                           print help
pwd                            print the current directory
quit                           quit this interactive terminal
virsh # start rh6
Domain rh6 started
virsh # list
Id Name State
----------------------------------------------------
1 rh6 running
virsh # console
error: command 'console' requires <domain> option
virsh # console rh6
Connected to domain rh6
Escape character is ^]

本文出自 “天涯客的blog” 博客,请务必保留此出处http://tiany.blog.51cto.com/513694/1716631
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: