1. 程式人生 > >libvirt-qemu-虛擬機器裝置熱插拔實踐

libvirt-qemu-虛擬機器裝置熱插拔實踐

(文章來自作者維護的社群微信公眾號【虛擬化雲端計算】)

cpu熱插拔# virsh setvcpus $domain_name --count 4 --live (--config可寫入配置檔案永久儲存)#前提條件和後續啟用參考《libvirt-qemu-虛擬機器cpu分配和cpu熱插拔》記憶體熱插拔<memory model='dimm'>    <target>        <size unit='KiB'>524287</size>        <node>0</node>    </target></memory>
#和doamin中格式相同# virsh attach-device $domain_name mem.xml (--config可寫入配置檔案永久儲存)#前提條件和後續啟用參考《libvirt-qemu-虛擬機器記憶體分配和記憶體熱插拔》網絡卡熱插拔<interface type='bridge'>      <mac address='52:54:00:2d:ea:aa'/>      <source bridge='br0'/>      <model type='virtio'/></interface>#和doamin中格式相同# virsh attach-device $domain_name interface.xml  (
--config可寫入配置檔案永久儲存)# virsh detach-device $domain_name interface.xml磁碟熱插拔<disk type='file' device='disk'>      <driver name='qemu' type='qcow2'/>      <source file='/tmp/test.img'/>      <target dev='vdd' bus='virtio'/></disk>#和doamin中格式相同# virsh attach-device $domain_name disk.xml 
(--config可寫入配置檔案永久儲存)# virsh detach-device $domain_name disk.xmlUSB裝置<hostdev mode='subsystem' type='usb'>  <source>    <vendor id='0x096e'/>    <product id='0x0405'/>  </source></hostdev>#和doamin中格式相同# virsh attach-device $domain_name usb.xml (--config可寫入配置檔案永久儲存)# virsh detach-device $domain_name usb.xmlPCI裝置熱插拔<hostdev mode='subsystem' type='pci' managed='yes'>    <source>        <address domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>    </source></hostdev>#和doamin中格式相同# virsh attach-device $domain_name pci.xml (--config可寫入配置檔案永久儲存)# virsh detach-device $domain_name pci.xml====================================================================關注微信公眾號【虛擬化雲端計算】,閱讀更多虛擬化雲端計算知識,純技術乾貨更新不停。