天天看點

libvirtd 學習

virsh 學習

指令 說明
help 列印幫助
attach-device 從一個XML檔案附加裝置
attach-disk 附加磁盤裝置
attach-interface 獲得網絡界面
autostart 自動開始一個域
capabilities 性能
cd change the current directory
connect 連接配接(重新連接配接)到 hypervisor
console 連接配接到客戶會話
cpu-baseline compute baseline CPU
cpu-compare compare host CPU with a CPU described by an XML file
create 從一個 XML 檔案建立一個域
start 開始一個(以前定義的)非活躍的域
destroy 删除一個域
detach-device 從一個 XML 檔案分離裝置
detach-disk 分離磁盤裝置
detach-interface 分離網絡界面
define 從一個 XML 檔案定義(但不開始)一個域
domid 把一個域名或 UUID 轉換為域 id
domuuid 把一個域名或 id 轉換為域 UUID
dominfo 域資訊
domjobinfo domain job information
domjobabort abort active domain job
domname 将域 id 或 UUID 轉換為域名
domstate 域狀态
domblkstat 獲得域裝置塊狀态
domifstat 獲得域網絡接口狀态
dommemstat get memory statistics for a domain
domblkinfo domain block device size information
domxml-from-nati ve Convert native config to domain XML
domxml-to-native Convert domain XML to native config
dumpxml XML 中的域資訊
edit 編輯某個域的 XML 配置
find-storage-poo l-sources 發現潛在存儲池源
find-storage-poo l-sources-as 找到潛在存儲池源
freecell NUMA可用記憶體
hostname 列印管理程式主機名
list 列出域
migrate 将域遷移到另一個主機中
migrate-setmaxdo wntime set maximum tolerable downtime
net-autostart 自動開始網絡
net-create 從一個 XML 檔案建立一個網絡
net-define 從一個 XML 檔案定義(但不開始)一個網絡
net-destroy 删除一個網絡
net-dumpxml XML 中的網絡資訊
net-edit 為網絡編輯 XML 配置
net-list 列出網絡
net-name 把一個網絡UUID 轉換為網絡名
net-start 開始一個(以前定義的)不活躍的網絡
net-undefine 取消定義一個非活躍的網絡
net-uuid 把一個網絡名轉換為網絡UUID
iface-list list physical host interfaces
iface-name convert an interface MAC address to interface name
iface-mac convert an interface name to interface MAC address
iface-dumpxml interface information in XML
iface-define define (but don’t start) a physical host interface from an XML file
iface-undefine undefine a physical host interface (remove it from configuration)
iface-edit edit XML configuration for a physical host interface
iface-start start a physical host interface (enable it / “if-up”)
iface-destroy destroy a physical host interface (disable it / “if-down”)
managedsave managed save of a domain state
nodeinfo 節點資訊
nodedev-list 這台主機中中的枚舉裝置
nodedev-dumpxml XML 中的節點裝置詳情
nodedev-dettach dettach node device from its device driver
nodedev-reattach reattach node device to its device driver
nodedev-reset 重置節點裝置
nodedev-create create a device defined by an XML file on the node
nodedev-destroy destroy a device on the node
nwfilter-define define or update a network filter from an XML file
nwfilter-undefine undefine a network filter
nwfilter-dumpxml network filter information in XML
nwfilter-list list network filters
nwfilter-edit edit XML configuration for a network filter
pool-autostart 自動啟動某個池
pool-build 建立池
pool-create 從一個 XML 檔案中建立一個池
pool-create-as 從一組變量中建立一個池
pool-define 在一個 XML 檔案中定義(但不啟動)一個池
pool-define-as 在一組變量中定義池
pool-destroy 銷毀池
pool-delete 删除池
pool-dumpxml XML 中的池資訊
pool-edit 為存儲池編輯 XML 配置
pool-info 存儲池資訊
pool-list 列出池
pool-name 将池 UUID 轉換為池名稱
pool-refresh 重新整理池
pool-start 啟動一個(以前定義的)非活躍的池
pool-undefine 取消定義一個不活躍的池
pool-uuid 把一個池名稱轉換為池 UUID
secret-define define or modify a secret from an XML file
secret-dumpxml secret attributes in XML
secret-set-value set a secret value
secret-get-value Output a secret value
secret-undefine undefine a secret
secret-list list secrets
pwd print the current directory
quit 退出這個非互動式終端
exit 退出這個非互動式終端
reboot 重新啟動一個域
restore 從一個存在一個檔案中的狀态恢複一個域
resume 重新恢複一個域
save 把一個域的狀态儲存到一個檔案
schedinfo 顯示/設定日程安排變量
dump 把一個域的核心 dump 到一個檔案中以友善分析
shutdown 關閉一個域
setmem 改變記憶體的配置設定
setmaxmem 改變最大記憶體限制值
setvcpus 改變虛拟 CPU 的号
suspend 挂起一個域
ttyconsole tty 控制台
undefine 取消定義一個非活躍的域
update-device update device from an XML file
uri 列印管理程式典型的URI
vol-create 從一個 XML 檔案建立一個卷
vol-create-from create a vol, using another volume as input
vol-create-as 從一組變量中建立卷
vol-clone clone a volume.
vol-delete 删除卷
vol-wipe wipe a vol
vol-dumpxml XML 中的卷資訊
vol-info 存儲卷資訊
vol-list 列出卷
vol-pool returns the storage pool for a given volume key or path
vol-path returns the volume path for a given volume name or key
vol-name returns the volume name for a given volume key or path
vol-key returns the volume key for a given volume name or path
vcpuinfo 域 vcpu 的資訊
vcpupin 控制域 vcpu affinity
version 顯示版本
vncdisplay vnc 顯示
snapshot-create Create a snapshot
snapshot-current Get the current snapshot
snapshot-delete Delete a domain snapshot
snapshot-dumpxml Dump XML for a domain snapshot
snapshot-list List snapshots for a domain
snapshot-revert Revert a domain to a snapshot

virsh define test.xml

virsh list

virsh list --all

virsh edit Id

/etc/libvirt/qemu/         # xml  路徑
/var/lib/libvirt/images/  # image 路徑
           

檢視spice端口

netstat -ntpl | grep qemu

virsh domdisplay --type spice {Id or Name}

建立鏡像:

qemu-img create -f qcow2 ubuntu-14.04.qcow2 20G

qemu-img info ubuntu-14.04.qcow2

鏡像壓縮

qemu-img convert -p -c -O qcow2 source.img destination.qcow2

建立快照

qemu-img create -f qcow2 -b base.qcow2 snapshot.qcow2

resize

qemu-img resize source.qcow2 +10G

連結:

在KVM虛拟機中使用spice

每天5分鐘玩轉 OpenStack

  • 每天5分鐘玩轉 OpenStack (1)
  • 視訊

繼續閱讀