日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

KVM虚拟化管理工具之virtsh(一)

發(fā)布時(shí)間:2024/1/1 编程问答 53 豆豆
生活随笔 收集整理的這篇文章主要介紹了 KVM虚拟化管理工具之virtsh(一) 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

一、什么是virsh

virsh 是kvm一個(gè)管理工具包。virsh提供兩種執(zhí)行模式:”直接模式(Direct Mode)”與”互動(dòng)模式(Interactive Mode)”。在直接模式里,你必須在Shell中以參數(shù)、自變量的方式來(lái)執(zhí)行virsh,如果在互動(dòng)模式中,則virsh會(huì)提供一個(gè)提示字符串, 你可以在該提示字符串后,輸入要執(zhí)行的命令。如果執(zhí)行virsh沒(méi)有指定任何參數(shù)或自變量則默認(rèn)就是進(jìn)入互動(dòng)模式。 與xm一樣,COMMAND也是 virsh提供的命令。

二、virsh 語(yǔ)法及參數(shù)

virsh命令有2使用方式,一種是在命令行上 virsh + [COMMAND](指令) +[ARGS…](具體參數(shù))工作;另一種是直接在命令行輸入virsh進(jìn)入控制臺(tái)通過(guò)[COMMAND](指令) +[ARGS…](具體參數(shù))工作。需要注意的是virsh命令只能運(yùn)行在Linux內(nèi)核下的主機(jī)中,不能運(yùn)行在windows操作系統(tǒng)中。

方法一: [root@localhost ~]# virsh version 根據(jù)庫(kù)編譯:libvirt 4.5.0 使用庫(kù):libvirt 4.5.0 使用的 API: QEMU 4.5.0 運(yùn)行管理程序: QEMU 1.5.3 方法二: [root@localhost ~]# virsh 歡迎使用 virsh,虛擬化的交互式終端。 輸入:'help' 來(lái)獲得命令的幫助信息'quit' 退出 virsh # verison 根據(jù)庫(kù)編譯:libvirt 4.5.0 使用庫(kù):libvirt 4.5.0 使用的 API: QEMU 4.5.0 運(yùn)行管理程序: QEMU 1.5.3

三、virsh 命令介紹

virsh 命令包含了domain(工作域),host(宿主機(jī)),interface(接口),network(網(wǎng)絡(luò)), Node Device(節(jié)點(diǎn)設(shè)備),Snapshot(快照),Secret (安全性),Storage Pool (存儲(chǔ)池),Storage Volume(存儲(chǔ)卷)
通過(guò) virsh --help 可以查詢到:

virsh [options]... [<command_string>] virsh [options]... <command> [args...]options:-c | --connect=URI hypervisor connection URI-d | --debug=NUM debug level [0-4]-e | --escape <char> set escape sequence for console-h | --help this help-k | --keepalive-interval=NUMkeepalive interval in seconds, 0 for disable-K | --keepalive-count=NUMnumber of possible missed keepalive messages-l | --log=FILE output logging to file-q | --quiet quiet mode-r | --readonly connect readonly-t | --timing print timing information-v short version-V long version--version[=TYPE] version, TYPE is short or long (default short)commands (non interactive mode):Domain Management (help keyword 'domain')attach-device 從一個(gè)XML文件附加裝置attach-disk 附加磁盤設(shè)備attach-interface 獲得網(wǎng)絡(luò)界面autostart 自動(dòng)開(kāi)始一個(gè)域blkdeviotune 設(shè)定或者查詢塊設(shè)備 I/O 調(diào)節(jié)參數(shù)。blkiotune 獲取或者數(shù)值 blkio 參數(shù)blockcommit 啟動(dòng)塊提交操作。blockcopy 啟動(dòng)塊復(fù)制操作。blockjob 管理活躍塊操作blockpull 使用其后端映像填充磁盤。blockresize 創(chuàng)新定義域塊設(shè)備大小change-media 更改 CD 介質(zhì)或者軟盤驅(qū)動(dòng)器console 連接到客戶會(huì)話cpu-stats 顯示域 cpu 統(tǒng)計(jì)數(shù)據(jù)create 從一個(gè) XML 文件創(chuàng)建一個(gè)域define 從一個(gè) XML 文件定義(但不開(kāi)始)一個(gè)域desc 顯示或者設(shè)定域描述或者標(biāo)題destroy 銷毀(停止)域detach-device 從一個(gè) XML 文件分離設(shè)備detach-device-alias detach device from an aliasdetach-disk 分離磁盤設(shè)備detach-interface 分離網(wǎng)絡(luò)界面domdisplay 域顯示連接 URIdomfsfreeze Freeze domain's mounted filesystems.domfsthaw Thaw domain's mounted filesystems.domfsinfo Get information of domain's mounted filesystems.domfstrim 在域掛載的文件系統(tǒng)中調(diào)用 fstrim。domhostname 輸出域主機(jī)名domid 把一個(gè)域名或 UUID 轉(zhuǎn)換為域 iddomif-setlink 設(shè)定虛擬接口的鏈接狀態(tài)domiftune 獲取/設(shè)定虛擬接口參數(shù)domjobabort 忽略活躍域任務(wù)domjobinfo 域任務(wù)信息domname 將域 id 或 UUID 轉(zhuǎn)換為域名domrename rename a domaindompmsuspend 使用電源管理功能掛起域dompmwakeup 從 pmsuspended 狀態(tài)喚醒域domuuid 把一個(gè)域名或 id 轉(zhuǎn)換為域 UUIDdomxml-from-native 將原始配置轉(zhuǎn)換為域 XMLdomxml-to-native 將域 XML 轉(zhuǎn)換為原始配置dump 把一個(gè)域的內(nèi)核 dump 到一個(gè)文件中以方便分析dumpxml XML 中的域信息edit 編輯某個(gè)域的 XML 配置event Domain Eventsinject-nmi 在虛擬機(jī)中輸入 NMIiothreadinfo view domain IOThreadsiothreadpin control domain IOThread affinityiothreadadd add an IOThread to the guest domainiothreaddel delete an IOThread from the guest domainsend-key 向虛擬機(jī)發(fā)送序列號(hào)send-process-signal 向進(jìn)程發(fā)送信號(hào)lxc-enter-namespace LXC 虛擬機(jī)進(jìn)入名稱空間managedsave 管理域狀態(tài)的保存managedsave-remove 刪除域的管理保存managedsave-edit edit XML for a domain's managed save state filemanagedsave-dumpxml Domain information of managed save state file in XMLmanagedsave-define redefine the XML for a domain's managed save state filememtune 獲取或者數(shù)值內(nèi)存參數(shù)perf Get or set perf eventmetadata show or set domain's custom XML metadatamigrate 將域遷移到另一個(gè)主機(jī)中migrate-setmaxdowntime 設(shè)定最大可耐受故障時(shí)間migrate-getmaxdowntime get maximum tolerable downtimemigrate-compcache 獲取/設(shè)定壓縮緩存大小migrate-setspeed 設(shè)定遷移帶寬的最大值migrate-getspeed 獲取最長(zhǎng)遷移帶寬migrate-postcopy Switch running migration from pre-copy to post-copynumatune 獲取或者數(shù)值 numa 參數(shù)qemu-attach QEMU 附加qemu-monitor-command QEMU 監(jiān)控程序命令qemu-monitor-event QEMU Monitor Eventsqemu-agent-command QEMU 虛擬機(jī)代理命令reboot 重新啟動(dòng)一個(gè)域reset 重新設(shè)定域restore 從一個(gè)存在一個(gè)文件中的狀態(tài)恢復(fù)一個(gè)域resume 重新恢復(fù)一個(gè)域save 把一個(gè)域的狀態(tài)保存到一個(gè)文件save-image-define 為域的保存狀態(tài)文件重新定義 XMLsave-image-dumpxml 在 XML 中保存狀態(tài)域信息save-image-edit 為域保存狀態(tài)文件編輯 XMLschedinfo 顯示/設(shè)置日程安排變量screenshot 提取當(dāng)前域控制臺(tái)快照并保存到文件中set-lifecycle-action change lifecycle actionsset-user-password set the user password inside the domainsetmaxmem 改變最大內(nèi)存限制值setmem 改變內(nèi)存的分配setvcpus 改變虛擬 CPU 的號(hào)shutdown 關(guān)閉一個(gè)域start 開(kāi)始一個(gè)(以前定義的)非活躍的域suspend 掛起一個(gè)域ttyconsole tty 控制臺(tái)undefine 取消定義一個(gè)域update-device 從 XML 文件中關(guān)系設(shè)備vcpucount 域 vcpu 計(jì)數(shù)vcpuinfo 詳細(xì)的域 vcpu 信息vcpupin 控制或者查詢域 vcpu 親和性emulatorpin 控制火車查詢域模擬器親和性vncdisplay vnc 顯示guestvcpus query or modify state of vcpu in the guest (via agent)setvcpu attach/detach vcpu or groups of threadsdomblkthreshold set the threshold for block-threshold event for a given block device or it's backing chain elementDomain Monitoring (help keyword 'monitor')domblkerror 在塊設(shè)備中顯示錯(cuò)誤domblkinfo 域塊設(shè)備大小信息domblklist 列出所有域塊domblkstat 獲得域設(shè)備塊狀態(tài)domcontrol 域控制接口狀態(tài)domif-getlink 獲取虛擬接口鏈接狀態(tài)domifaddr Get network interfaces' addresses for a running domaindomiflist 列出所有域虛擬接口domifstat 獲得域網(wǎng)絡(luò)接口狀態(tài)dominfo 域信息dommemstat 獲取域的內(nèi)存統(tǒng)計(jì)domstate 域狀態(tài)domstats get statistics about one or multiple domainsdomtime domain timelist 列出域Host and Hypervisor (help keyword 'host')allocpages Manipulate pages pool sizecapabilities 性能cpu-baseline 計(jì)算基線 CPUcpu-compare 使用 XML 文件中描述的 CPU 與主機(jī) CPU 進(jìn)行對(duì)比cpu-models CPU modelsdomcapabilities domain capabilitiesfreecell NUMA可用內(nèi)存freepages NUMA free pageshostname 打印管理程序主機(jī)名hypervisor-cpu-baseline compute baseline CPU usable by a specific hypervisorhypervisor-cpu-compare compare a CPU with the CPU created by a hypervisor on the hostmaxvcpus 連接 vcpu 最大值node-memory-tune 獲取或者設(shè)定節(jié)點(diǎn)內(nèi)存參數(shù)nodecpumap 節(jié)點(diǎn) cpu 映射nodecpustats 輸出節(jié)點(diǎn)的 cpu 狀統(tǒng)計(jì)數(shù)據(jù)。nodeinfo 節(jié)點(diǎn)信息nodememstats 輸出節(jié)點(diǎn)的內(nèi)存狀統(tǒng)計(jì)數(shù)據(jù)。nodesuspend 在給定時(shí)間段掛起主機(jī)節(jié)點(diǎn)sysinfo 輸出 hypervisor sysinfouri 打印管理程序典型的URIversion 顯示版本Interface (help keyword 'interface')iface-begin 生成當(dāng)前接口設(shè)置快照,可在今后用于提交 (iface-commit) 或者恢復(fù) (iface-rollback)iface-bridge 生成橋接設(shè)備并為其附加一個(gè)現(xiàn)有網(wǎng)絡(luò)設(shè)備iface-commit 提交 iface-begin 后的更改并釋放恢復(fù)點(diǎn)iface-define define an inactive persistent physical host interface or modify an existing persistent one from an XML fileiface-destroy 刪除物理主機(jī)接口(啟用它請(qǐng)執(zhí)行 "if-down")iface-dumpxml XML 中的接口信息iface-edit 為物理主機(jī)界面編輯 XML 配置iface-list 物理主機(jī)接口列表iface-mac 將接口名稱轉(zhuǎn)換為接口 MAC 地址iface-name 將接口 MAC 地址轉(zhuǎn)換為接口名稱iface-rollback 恢復(fù)到之前保存的使用 iface-begin 生成的更改iface-start 啟動(dòng)物理主機(jī)接口(啟用它請(qǐng)執(zhí)行 "if-up")iface-unbridge 分離其輔助設(shè)備后取消定義橋接設(shè)備iface-undefine 取消定義物理主機(jī)接口(從配置中刪除)Network Filter (help keyword 'filter')nwfilter-define 使用 XML 文件定義或者更新網(wǎng)絡(luò)過(guò)濾器nwfilter-dumpxml XML 中的網(wǎng)絡(luò)過(guò)濾器信息nwfilter-edit 為網(wǎng)絡(luò)過(guò)濾器編輯 XML 配置nwfilter-list 列出網(wǎng)絡(luò)過(guò)濾器nwfilter-undefine 取消定義網(wǎng)絡(luò)過(guò)濾器nwfilter-binding-create create a network filter binding from an XML filenwfilter-binding-delete delete a network filter bindingnwfilter-binding-dumpxml XML 中的網(wǎng)絡(luò)過(guò)濾器信息nwfilter-binding-list list network filter bindingsNetworking (help keyword 'network')net-autostart 自動(dòng)開(kāi)始網(wǎng)絡(luò)net-create 從一個(gè) XML 文件創(chuàng)建一個(gè)網(wǎng)絡(luò)net-define define an inactive persistent virtual network or modify an existing persistent one from an XML filenet-destroy 銷毀(停止)網(wǎng)絡(luò)net-dhcp-leases print lease info for a given networknet-dumpxml XML 中的網(wǎng)絡(luò)信息net-edit 為網(wǎng)絡(luò)編輯 XML 配置net-event Network Eventsnet-info 網(wǎng)絡(luò)信息net-list 列出網(wǎng)絡(luò)net-name 把一個(gè)網(wǎng)絡(luò)UUID 轉(zhuǎn)換為網(wǎng)絡(luò)名net-start 開(kāi)始一個(gè)(以前定義的)不活躍的網(wǎng)絡(luò)net-undefine undefine a persistent networknet-update 更新現(xiàn)有網(wǎng)絡(luò)配置的部分net-uuid 把一個(gè)網(wǎng)絡(luò)名轉(zhuǎn)換為網(wǎng)絡(luò)UUIDNode Device (help keyword 'nodedev')nodedev-create 根據(jù)節(jié)點(diǎn)中的 XML 文件定義生成設(shè)備nodedev-destroy 銷毀(停止)節(jié)點(diǎn)中的設(shè)備nodedev-detach 將節(jié)點(diǎn)設(shè)備與其設(shè)備驅(qū)動(dòng)程序分離nodedev-dumpxml XML 中的節(jié)點(diǎn)設(shè)備詳情nodedev-list 這臺(tái)主機(jī)中中的枚舉設(shè)備nodedev-reattach 重新將節(jié)點(diǎn)設(shè)備附加到他的設(shè)備驅(qū)動(dòng)程序中nodedev-reset 重置節(jié)點(diǎn)設(shè)備nodedev-event Node Device EventsSecret (help keyword 'secret')secret-define 定義或者修改 XML 中的 secretsecret-dumpxml XML 中的 secret 屬性secret-event Secret Eventssecret-get-value secret 值輸出secret-list 列出 secretsecret-set-value 設(shè)定 secret 值secret-undefine 取消定義 secretSnapshot (help keyword 'snapshot')snapshot-create 使用 XML 生成快照snapshot-create-as 使用一組參數(shù)生成快照snapshot-current 獲取或者設(shè)定當(dāng)前快照snapshot-delete 刪除域快照snapshot-dumpxml 為域快照轉(zhuǎn)儲(chǔ) XMLsnapshot-edit 編輯快照 XMLsnapshot-info 快照信息snapshot-list 為域列出快照snapshot-parent 獲取快照的上級(jí)快照名稱snapshot-revert 將域轉(zhuǎn)換為快照Storage Pool (help keyword 'pool')find-storage-pool-sources-as 找到潛在存儲(chǔ)池源find-storage-pool-sources 發(fā)現(xiàn)潛在存儲(chǔ)池源pool-autostart 自動(dòng)啟動(dòng)某個(gè)池pool-build 建立池pool-create-as 從一組變量中創(chuàng)建一個(gè)池pool-create 從一個(gè) XML 文件中創(chuàng)建一個(gè)池pool-define-as 在一組變量中定義池pool-define define an inactive persistent storage pool or modify an existing persistent one from an XML filepool-delete 刪除池pool-destroy 銷毀(刪除)池pool-dumpxml XML 中的池信息pool-edit 為存儲(chǔ)池編輯 XML 配置pool-info 存儲(chǔ)池信息pool-list 列出池pool-name 將池 UUID 轉(zhuǎn)換為池名稱pool-refresh 刷新池pool-start 啟動(dòng)一個(gè)(以前定義的)非活躍的池pool-undefine 取消定義一個(gè)不活躍的池pool-uuid 把一個(gè)池名稱轉(zhuǎn)換為池 UUIDpool-event Storage Pool EventsStorage Volume (help keyword 'volume')vol-clone 克隆卷。vol-create-as 從一組變量中創(chuàng)建卷vol-create 從一個(gè) XML 文件創(chuàng)建一個(gè)卷vol-create-from 生成卷,使用另一個(gè)卷作為輸入。vol-delete 刪除卷vol-download 將卷內(nèi)容下載到文件中vol-dumpxml XML 中的卷信息vol-info 存儲(chǔ)卷信息vol-key 為給定密鑰或者路徑返回卷密鑰vol-list 列出卷vol-name 為給定密鑰或者路徑返回卷名vol-path 為給定密鑰或者路徑返回卷路徑vol-pool 為給定密鑰或者路徑返回存儲(chǔ)池vol-resize 創(chuàng)新定義卷大小vol-upload 將文件內(nèi)容上傳到卷中vol-wipe 擦除卷Virsh itself (help keyword 'virsh')cd 更改當(dāng)前目錄echo echo 參數(shù)exit 退出這個(gè)非交互式終端help 打印幫助pwd 輸出當(dāng)前目錄quit 退出這個(gè)非交互式終端connect 連接(重新連接)到 hypervisor

四、virsh常用命令介紹

4.1 host(宿主機(jī)相關(guān))

4.1.1 hostname

virsh hostname 顯示宿主機(jī)的機(jī)器名

[root@localhost ~] virsh hostname localhost.localdomain

4.1.2 maxvcpus

virsh maxvcpus 顯示宿主機(jī)最大可提供分配的虛擬cpu的總數(shù),也就是一臺(tái)機(jī)器下所有虛擬機(jī)的vcpu個(gè)數(shù)之和不能大于這個(gè)參數(shù)。

[root@localhost ~] virsh maxvcpus 240

4.1.3 version

virsh version 顯示libvirt及qemu對(duì)應(yīng)的版本信息

[root@localhost ~] virsh version 根據(jù)庫(kù)編譯:libvirt 4.5.0 使用庫(kù):libvirt 4.5.0 使用的 API: QEMU 4.5.0 運(yùn)行管理程序: QEMU 1.5.3

4.1.4 sysinfo

virsh sysinfo 顯示宿主機(jī)的硬件信息

[root@localhost ~] virsh sysinfo <sysinfo type='smbios'><bios><entry name='vendor'>American Megatrends Inc.</entry><entry name='version'>0602</entry><entry name='date'>12/09/2014</entry><entry name='release'>4.6</entry></bios><system><entry name='manufacturer'>ASUS</entry><entry name='product'>All Series</entry><entry name='version'>System Version</entry><entry name='serial'>System Serial Number</entry><entry name='uuid'>2198b9a0-d7da-11dd-8b03-086266276416</entry><entry name='sku'>All</entry><entry name='family'>ASUS MB</entry></system><baseBoard><entry name='manufacturer'>ASUSTeK COMPUTER INC.</entry><entry name='product'>Z97-K R2.0</entry><entry name='version'>Rev X.0x</entry><entry name='serial'>141236867304293</entry><entry name='asset'>To be filled by O.E.M.</entry><entry name='location'>To be filled by O.E.M.</entry></baseBoard><chassis><entry name='manufacturer'>To Be Filled By O.E.M.</entry><entry name='version'>To Be Filled By O.E.M.</entry><entry name='serial'>To Be Filled By O.E.M.</entry><entry name='asset'>To Be Filled By O.E.M.</entry><entry name='sku'>To be filled by O.E.M.</entry></chassis><processor><entry name='socket_destination'>SOCKET 1150</entry><entry name='type'>Central Processor</entry><entry name='family'>Other</entry><entry name='manufacturer'>Intel</entry><entry name='version'>Intel(R) Xeon(R) CPU E3-1230 v3 @ 3.30GHz</entry><entry name='external_clock'>100 MHz</entry><entry name='max_speed'>3900 MHz</entry><entry name='status'>Populated, Enabled</entry><entry name='serial_number'>Not Specified</entry><entry name='part_number'>Fill By OEM</entry></processor><memory_device><entry name='size'>4096 MB</entry><entry name='form_factor'>DIMM</entry><entry name='locator'>DIMM_A1</entry><entry name='bank_locator'>BANK 0</entry><entry name='type'>DDR3</entry><entry name='type_detail'>Synchronous</entry><entry name='speed'>1600 MT/s</entry><entry name='manufacturer'>Kingston</entry><entry name='serial_number'>8A3A040F</entry><entry name='part_number'>99P5474-013.A00LF</entry></memory_device><memory_device><entry name='size'>8192 MB</entry><entry name='form_factor'>DIMM</entry><entry name='locator'>DIMM_A2</entry><entry name='bank_locator'>BANK 1</entry><entry name='type'>DDR3</entry><entry name='type_detail'>Synchronous</entry><entry name='speed'>1600 MT/s</entry><entry name='manufacturer'>0622</entry><entry name='serial_number'>00000000</entry><entry name='part_number'>DDR3-1600 CL11 8GB</entry></memory_device><memory_device><entry name='size'>4096 MB</entry><entry name='form_factor'>DIMM</entry><entry name='locator'>DIMM_B1</entry><entry name='bank_locator'>BANK 2</entry><entry name='type'>DDR3</entry><entry name='type_detail'>Synchronous</entry><entry name='speed'>1600 MT/s</entry><entry name='manufacturer'>Kingston</entry><entry name='serial_number'>853A080F</entry><entry name='part_number'>99P5474-013.A00LF</entry></memory_device> </sysinfo>

4.1.5 capabilities

virsh capabilities 以XML文件格式顯示當(dāng)前虛擬環(huán)境的性能參數(shù)

[root@localhost ~] virsh capabilities <capabilities><host> <uuid>2198b9a0-d7da-11dd-8b03-086266276416</uuid> <cpu> <arch>x86_64</arch><model>Haswell-noTSX-IBRS</model><vendor>Intel</vendor><microcode version='39'/><counter name='tsc' frequency='3298088000' scaling='no'/><topology sockets='1' cores='4' threads='2'/><feature name='vme'/><feature name='ds'/><feature name='acpi'/><feature name='ss'/><feature name='ht'/><feature name='tm'/><feature name='pbe'/><feature name='dtes64'/><feature name='monitor'/><feature name='ds_cpl'/><feature name='vmx'/><feature name='smx'/><feature name='est'/><feature name='tm2'/><feature name='xtpr'/><feature name='pdcm'/><feature name='osxsave'/><feature name='f16c'/><feature name='rdrand'/><feature name='arat'/><feature name='tsc_adjust'/><feature name='md-clear'/><feature name='stibp'/><feature name='ssbd'/><feature name='xsaveopt'/><feature name='pdpe1gb'/><feature name='abm'/><feature name='invtsc'/><pages unit='KiB' size='4'/><pages unit='KiB' size='2048'/><pages unit='KiB' size='1048576'/></cpu><power_management> <suspend_mem/><suspend_disk/><suspend_hybrid/></power_management><iommu support='no'/><migration_features> <live/><uri_transports><uri_transport>tcp</uri_transport><uri_transport>rdma</uri_transport></uri_transports></migration_features><topology> <cells num='1'><cell id='0'><memory unit='KiB'>24464364</memory><pages unit='KiB' size='4'>6116091</pages><pages unit='KiB' size='2048'>0</pages><pages unit='KiB' size='1048576'>0</pages><distances><sibling id='0' value='10'/></distances><cpus num='8'><cpu id='0' socket_id='0' core_id='0' siblings='0,4'/><cpu id='1' socket_id='0' core_id='1' siblings='1,5'/><cpu id='2' socket_id='0' core_id='2' siblings='2,6'/><cpu id='3' socket_id='0' core_id='3' siblings='3,7'/><cpu id='4' socket_id='0' core_id='0' siblings='0,4'/><cpu id='5' socket_id='0' core_id='1' siblings='1,5'/><cpu id='6' socket_id='0' core_id='2' siblings='2,6'/><cpu id='7' socket_id='0' core_id='3' siblings='3,7'/></cpus></cell></cells></topology><cache><bank id='0' level='3' type='both' size='8' unit='MiB' cpus='0-7'/></cache><secmodel> <model>none</model><doi>0</doi></secmodel><secmodel><model>dac</model><doi>0</doi><baselabel type='kvm'>+107:+107</baselabel><baselabel type='qemu'>+107:+107</baselabel></secmodel></host><guest><os_type>hvm</os_type> <arch name='i686'> <wordsize>32</wordsize> <emulator>/usr/libexec/qemu-kvm</emulator><machine maxCpus='240'>pc-i440fx-rhel7.0.0</machine><machine canonical='pc-i440fx-rhel7.0.0' maxCpus='240'>pc</machine> <machine maxCpus='240'>rhel6.0.0</machine><machine maxCpus='240'>rhel6.1.0</machine><machine maxCpus='240'>rhel6.2.0</machine><machine maxCpus='240'>rhel6.3.0</machine><machine maxCpus='240'>rhel6.4.0</machine><machine maxCpus='240'>rhel6.5.0</machine><machine maxCpus='240'>rhel6.6.0</machine><domain type='qemu'/> <domain type='kvm'><emulator>/usr/libexec/qemu-kvm</emulator></domain></arch><features><cpuselection/><deviceboot/><disksnapshot default='off' toggle='no'/><acpi default='on' toggle='yes'/><apic default='on' toggle='no'/><pae/><nonpae/></features></guest><guest><os_type>hvm</os_type><arch name='x86_64'><wordsize>64</wordsize><emulator>/usr/libexec/qemu-kvm</emulator><machine maxCpus='240'>pc-i440fx-rhel7.0.0</machine><machine canonical='pc-i440fx-rhel7.0.0' maxCpus='240'>pc</machine><machine maxCpus='240'>rhel6.0.0</machine><machine maxCpus='240'>rhel6.1.0</machine><machine maxCpus='240'>rhel6.2.0</machine><machine maxCpus='240'>rhel6.3.0</machine><machine maxCpus='240'>rhel6.4.0</machine><machine maxCpus='240'>rhel6.5.0</machine><machine maxCpus='240'>rhel6.6.0</machine><domain type='qemu'/><domain type='kvm'><emulator>/usr/libexec/qemu-kvm</emulator></domain></arch><features><cpuselection/><deviceboot/><disksnapshot default='off' toggle='no'/><acpi default='on' toggle='yes'/><apic default='on' toggle='no'/></features></guest> </capabilities>

4.2 capabilities XML文件解釋

4.2.1 host(宿主機(jī)相關(guān)配置)

標(biāo)簽名作用父級(jí)標(biāo)簽
host宿主機(jī)相關(guān)功能元素頂級(jí)標(biāo)簽
guest來(lái)賓相關(guān)功能元素頂級(jí)標(biāo)簽
uuid表明宿主機(jī)的UUIDhost
cpu主機(jī)CPU的體系結(jié)構(gòu)和功能host
power_management主機(jī)是否能夠進(jìn)行內(nèi)存掛起"suspend_mem",磁盤休眠"suspend_disk"或混合掛起"suspend_hybrid"host
migration公開(kāi)有關(guān)虛擬機(jī)管理程序遷移功能的信息host
topology該元素體現(xiàn)了主機(jī)內(nèi)部拓?fù)洹@?#xff0c;由于減少了NUMA之間的節(jié)點(diǎn)傳輸,管理應(yīng)用程序可能希望在組織新的來(lái)賓時(shí)學(xué)習(xí)此信息host
secmodel要找出不同安全模型的默認(rèn)安全標(biāo)簽,您需要解析此元素。與以前的元素相比,對(duì)于libvirt守護(hù)程序當(dāng)前支持的每個(gè)安全模型,都重復(fù)此操作。host
arch操作系統(tǒng)架構(gòu)類型,x86_64、i386、i486、i586、alpha、sparc、arm、m68k、mips、ppc、i686等cpu
modelqemu中cpu虛擬化支持的類型,如果在遷移虛擬機(jī)過(guò)程中,遇到cpu虛擬化支持的類型不匹配會(huì)導(dǎo)致虛擬機(jī)無(wú)法正常啟動(dòng)cpu
vendor生產(chǎn)所屬公司cpu
microcodecpu 微代碼版本號(hào)cpun必備的 詳細(xì)請(qǐng)查閱 microcodecpu
countername=‘tsc’ frequency=‘3298088000’ scaling=‘no’ ,TSC代表是Time Stamp Counter,frequency代表最大計(jì)數(shù)值,scaling 詳見(jiàn)TSC官方文檔cpu
topologyCPU拓?fù)浼敖Y(jié)構(gòu),常常以sockets='1’1、 cores=‘4’ threads=‘2’,sockets代表路,cores代表核,threads代表超線程數(shù)(單顆)cpu
featurecpu支持的一些特性,通常有vme,ss,acpi等cpu
cachecpu緩存相關(guān)配置cpu
pages內(nèi)存頁(yè)所支持的單位大小cpu
iommu輔助虛擬化 vt-x PCI透?jìng)魇欠耖_(kāi)啟host
suspend_mem內(nèi)存掛機(jī)power_management
suspend_disk硬盤休眠power_management
suspend_hybrid混合掛起power_management
live支持在線遷移migration_features
uri_transports支持的遷移方式tcp,rdmamigration_features
topology宿主機(jī)所有CPU及內(nèi)存相關(guān)參數(shù)host
cells實(shí)際CPU的數(shù)量topology
memory宿主機(jī)內(nèi)存總量topology
pages內(nèi)存頁(yè)使用數(shù)topology
distancescpu 之間的NUMA之間訪問(wèn)內(nèi)存的優(yōu)先級(jí)cpus
cpuscpu 總數(shù)量cpus
cpucpu核數(shù)綁定關(guān)系cpus
cachecpu緩存相關(guān)參數(shù)topology
model支持的安全模式secmodel
doi安全表示符secmodel

4.2.2 guest(來(lái)賓相關(guān)配置)

標(biāo)簽名作用父級(jí)標(biāo)簽
os_type管理程序能夠運(yùn)行哪種操作系統(tǒng):xen、linux、xenpvh、hvm、exeguest
arch架構(gòu)類型guest
wordsizeCPU字的大小arch
emulator仿真模擬器的位置arch
machine機(jī)器類型,用于 域XML中os / type元素的機(jī)器屬性。例如,Xen支持xenfvHVM,xenpvPV或xenpvhPVH。arch
domain指定運(yùn)行域所需的系統(tǒng)管理程序的類型arch
features可選元素包含可與所描述類型的來(lái)賓一起使用的可能功能guest
cpuselection如果存在此元素,則管理程序?qū)⒃谟蚨x中支持該元素,以對(duì)提供給來(lái)賓的CPU進(jìn)行細(xì)粒度控制。從0.7.5開(kāi)始features
deviceboot如果存在此元素,則可以在設(shè)備內(nèi)部使用該元素,而不是按類別使用較早的引導(dǎo)規(guī)范。從0.8.8開(kāi)始features
disksnapshot如果存在此元素,則default屬性描述是否支持外部磁盤快照。如果不存在,可能仍支持外部快照,但是它需要嘗試API并檢查錯(cuò)誤以確保確定。從1.2.3開(kāi)始features
acpi如果存在此元素,則default屬性描述默認(rèn)情況下管理程序是否向訪客公開(kāi)ACPI,并且toggle屬性描述用戶是否可以覆蓋此默認(rèn)值。從0.4.1開(kāi)始features
apic如果存在此元素,則該default屬性描述默認(rèn)情況下管理程序是否向訪客公開(kāi)APIC,并且該toggle屬性描述用戶是否可以覆蓋此默認(rèn)值。從0.4.1開(kāi)始features
ia64_be如果存在,則從0.4.1開(kāi)始,IA64 guest虛擬機(jī)可以在大端模式下運(yùn)行。features
pae從0.4.1開(kāi)始,如果存在,則32位guest 虛擬機(jī)可以使用PAE地址空間擴(kuò)展。features
nonpae如果存在,則從0.4.1開(kāi)始,無(wú)需PAE即可運(yùn)行32位guest 虛擬機(jī)。features

4.3 sysinfo XML文件解釋

標(biāo)簽名作用父級(jí)標(biāo)簽
sysinfo設(shè)備信息,type=smbios 表示允許來(lái)賓主機(jī)使用和修改的信息頂級(jí)
biosbios信息sysinfo
system系統(tǒng)信息sysinfo
baseBoard主板信息sysinfo
chassis機(jī)箱信息sysinfo
processor處理器相關(guān)信息sysinfo
memory_device內(nèi)存相關(guān)信息sysinfo

總結(jié)

以上是生活随笔為你收集整理的KVM虚拟化管理工具之virtsh(一)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。