国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 建站經驗 > 正文

KVM虛擬機技術學習總結

2019-11-02 16:17:16
字體:
來源:轉載
供稿:網友

最近在學習KVM,進程不算太快,近期整理了一下KVM虛擬機技術學習筆記,現在就分享給大家,也給大家做個參考。有需要的朋友可以來了解一下。

KVM虛擬機的管理主要是通過virsh命令對虛擬機進行管理。

1.  查看KVM虛擬機配置文件及運行狀態

(1) KVM虛擬機默認配置文件位置: /etc/libvirt/qemu/

autostart目錄是配置kvm虛擬機開機自啟動目錄。  

(2) virsh命令幫助

# virsh -help

或直接virsh命令和,再執行子命令。如下所示。

[root@node1 ~]# virsh  

歡迎使用 virsh,虛擬化的交互式終端。

輸入:'help' 來獲得命令的幫助信息  

'quit' 退出

virsh # help  

……

(3) 查看kvm虛擬機狀態

# virsh list --all

2.  KVM虛擬機開機

# virsh start oeltest01

3. KVM虛擬機關機或斷電

(1) 關機

默認情況下virsh工具不能對linux虛擬機進行關機操作,linux操作系統需要開啟與啟動acpid服務。在安裝KVM linux虛擬機必須配置此服務。

# chkconfig acpid on  

# service acpid restart

virsh關機

# virsh shutdown oeltest01

(2) 強制關閉電源

# virsh destroy wintest01

4. 通過配置文件啟動虛擬機

# virsh create /etc/libvirt/qemu/wintest01.xml

5. 配置開機自啟動虛擬機

# virsh autostart oeltest01

autostart目錄是kvm虛擬機開機自啟動目錄,可以看到該目錄中有KVM配置文件鏈接。

6. 導出KVM虛擬機配置文件

# virsh dumpxml wintest01 > /etc/libvirt/qemu/wintest02.xml

KVM虛擬機配置文件可以通過這種方式進行備份。

7. 添加與刪除KVM虛擬機

(1)  刪除kvm虛擬機

# virsh undefine wintest01

說明:該命令只是刪除wintest01的配置文件,并不刪除虛擬磁盤文件。如下圖所示。

(2)  重新定義虛擬機配置文件

通過導出備份的配置文件恢復原KVM虛擬機的定義,并重新定義虛擬機。

# mv /etc/libvirt/qemu/wintest02.xml /etc/libvirt/qemu/wintest01.xml

# virsh define /etc/libvirt/qemu/wintest01.xml

8. 編輯KVM虛擬機配置文件

# virsh edit wintest01

virsh edit將調用vi命令編輯/etc/libvirt/qemu/wintest01.xml配置文件。也可以直接通過vi命令進行編輯,修改,保存。

可以但不建議直接通過vi編輯。

[root@node1 qemu]# vi /etc/libvirt/qemu/wintest01.xml <!--WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BEOVERWRITTEN AND LOST. Changes to this xml configuration should be made using:virsh edit wintest01or other application using the libvirt API.--><domain type='kvm'><name>wintest01</name><uuid>fe31ea48-7d6a-f3cb-cede-2f9bd9dec2bd</uuid><memory unit='KiB'>524288</memory><currentMemory unit='KiB'>524288</currentMemory><vcpu placement='static'>2</vcpu><os><type arch='x86_64' machine='rhel6.4.0'>hvm</type><boot dev='hd'/></os><features><acpi/><apic/><pae/></features><clock offset='utc'/><on_poweroff>destroy</on_poweroff><on_reboot>restart</on_reboot><on_crash>restart</on_crash><devices><emulator>/usr/libexec/qemu-kvm</emulator><disk type='file' device='disk'><driver name='qemu' type='raw' cache='none'/><source file='/data/wintest01.img'/><target dev='hda' bus='ide'/><address type='drive' controller='0' bus='0' target='0' unit='0'/></disk><disk type='block' device='cdrom'><driver name='qemu' type='raw'/><target dev='hdc' bus='ide'/><readonly/><address type='drive' controller='0' bus='1' target='0' unit='0'/></disk><controller type='usb' index='0'><address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/></controller><controller type='ide' index='0'><address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/></controller><interface type='bridge'><mac address='52:54:00:2b:2f:fe'/><source bridge='br0'/><address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/></interface><serial type='pty'><target port='0'/></serial><console type='pty'><target type='serial' port='0'/></console><input type='mouse' bus='ps2'/><graphics type='vnc' port='5911' autoport='no' listen='0.0.0.0'><listen type='address' address='0.0.0.0'/></graphics><video><model type='cirrus' vram='9216' heads='1'/><address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/></video><memballoon model='virtio'><address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/></memballoon></devices><seclabel type='none'/></domain>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 墨江| 航空| 乌兰县| 昌吉市| 承德县| 临泉县| 博客| 西丰县| 阳西县| 固阳县| 德江县| 翼城县| 安新县| 安西县| 伊吾县| 北川| 女性| 扶绥县| 泉州市| 台东市| 贞丰县| 固始县| 依安县| 柏乡县| 大姚县| 怀化市| 久治县| 天祝| 井陉县| 临沂市| 库车县| 台东市| 库车县| 长武县| 广东省| 临湘市| 连山| 武穴市| 绥滨县| 蒙山县| 阿鲁科尔沁旗|