# virsh  edit centos6.8

1 调整内存大小,要改变最大值和当前值

<memory unit='KiB'>524288</memory>

<currentMemory unit='KiB'>524288</currentMemory>


2 调整CPU核数

<vcpu placement='static'>1</vcpu>


查看调整后的参数

# free 

# grep -i processor /proc/cpuinfo

processor    : 0

processor    : 1


3 调整网卡

3.1 查看网卡

# virsh domiflist centos6.8

Interface  Type       Source     Model       MAC

-------------------------------------------------------

vnet0      bridge     br0        virtio      52:54:00:a6:4b:c9


3.2 增加网卡

# virsh attach-interface centos6.8 --type bridge --source br0

# virsh domiflist centos6.8

Interface  Type       Source     Model       MAC

-------------------------------------------------------

vnet0      bridge     br0        virtio      52:54:00:a6:4b:c9

vnet1      bridge     br0        -           52:54:00:a9:4c:12


3.3 修改虚拟机配置文件

    通过virsh dump可以看到网卡的配置。但还没写入配置文件,此处将其写入配置文件,若不写入,重启虚拟机后,网卡将消失

# virsh dumpxml centos6.8 > /etc/libvirt/qemu/centos6.8.xml


4 启动虚拟机

# ifconfig -a


5 亦可以通过

# virsh edit centos6.8 来修改配置文件

    <interface type='bridge'>

      <mac address='52:54:00:a6:4b:c9'/>

      <source bridge='br0'/>

      <model type='virtio'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>

    </interface>

     <interface type='bridge'>

      <mac address='52:54:00:a6:4b:c8'/>

      <source bridge='br0'/>

      <model type='virtio'/>

# 删除此行

#     <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>

    </interface>






来自为知笔记(Wiz)