231321 发表于 2016-3-21 08:41:54

kvm调整cpu内存、网卡

调整cpu和内存

virsh editwyp1
修改:内存值和1CPU
<memory unit='KiB'>524288</memory>
<currentMemory unit='KiB'>524288</currentMemory>
<vcpu placement='static'>1</vcpu>

为:内存值和2CPU
<memory unit='KiB'>624288</memory>
<currentMemory unit='KiB'>624288</currentMemory>
<vcpu placement='static'>2</vcpu>


重启虚拟机:直接重启虚拟机不行,必须destroy重新加载虚拟机配置文件才行。
virsh destroy wyp1
virsh start wyp1

然后来查看是否修改成功。
free -m
cat /proc/cpuinfo

不关机临时虚拟机增加网卡
virsh dominfo wyp1   #列出指定虚拟机的网卡设备列表
virsh attach-interface wyp1 --type bridge --source br0   #命令行增加一块网卡,类型桥接
执行ifconfig -a
发现多了一个网卡eth1#在线增加网卡,重启失效。

如果要永久增加网卡,需要编辑配置文件,找到interface type的行,复制粘贴一行。
然后修改mac地址删除address type的行,防止冲突。退出保存。重启虚拟机。

页: [1]
查看完整版本: kvm调整cpu内存、网卡