Something about cpu and memory hot plug on kvm

Something about cpu and memory hot plug on kvm

I assume you have basic knowledge about libvirt. If not refer to https://libvirt.org/formatdomain.html to learn some basic concept.

cpu hot plug

First of all, we need to define a vm. It’s OK to use IaaS or define it by yourself.

You can easily get your vm domain-id by this command

virsh list --all

Then execute

virsh edit <domain-id>

Libvirt will open the domain xml file of the vm you defined before. And find cpu tag, you might got something like this

<vcpu placement='static'>2</vcpu>
<cpu>
  <topology sockets='1' cores='2' threads='1'/>
</cpu>

At this point we have to ways to do hot plug.

Solution : setvcpu

Using vpus related virsh command to help with cpu hot plug.

step 1 : shutdown vm

virsh destroy <domain-id>

step 2 : edit the domain xml to ensure hotplug on it

virsh edit <vm name>

in this step, we need to change the vcpu config from

<vcpu placement='static'>1</<
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值