cpupin in openstack memo

本文介绍了一种通过绑定VCPU到特定CPU来提升虚拟机(VM)性能的方法,并提出了将其作为OpenStack扩展API的想法。文章详细描述了设置和获取VCPU绑定状态的API请求与响应格式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

As we tested, when VCPU is less than CPU, if we bind vcpu to cpu, the perfromance of VM will be better. So we want to add this into Openstack as extended API.
The following memo is what in my mind now:

API :
1. Set instance vcpupin api:
PUT    v2/{tenant_id}/vcpupin/{instance_id}       Set instance vcpupin

Request parameters JSON:
{
    "vcpupin" : [
        {
             vcpu     : 0                  # VCPU    
             cpulist  : "1,2"              # CPU List , This sample means VCPU0 can run in CPU1 and CPU2
        },
        {
             vcpu     : 1                  # VCPU    
             cpulist  : "3"                # CPU List , This sample means VCPU1 can run in CPU3
        }       
    ]
}


2. Get instance vcpupin api:
GET    v2/{tenant_id}/vcpupin/{instance_id}       Get instance vcpupin status

Response parameters JSON:
{
    "vcpupin" : [
        {
             vcpu       : 0                # VCPU    
             currentcpu : 1                # VCPU is running on which CPU
             state      : "running"        # State
             cputime    : "946.4"          # cpu time, 946.4 means 946.4sec
             cpulist    : "1,2"            # CPU List , This sample means VCPU0 can run in CPU1 and CPU2
        },
        {
             vcpu       : 1                # VCPU    
             currentcpu : 3                # VCPU is running on which CPU
             state      : "running"        # State
             cputime    : "1001.2"         # cpu time, 1001.2 means 1001.2sec
             cpulist    : "3"              # CPU List , This sample means VCPU1 can run in CPU3
        }       
    ]
}


Function:
1. Basic call flow:
api/CLI client ----HTTP call---->nova-api  ----MQ:asyc call----> nova-compute

2. Set instance vcpupin :
In nova-compute, call API/CLI do the thing like following:
Before cpupin:
[root@ci13sjcmp03 ~]# virsh vcpuinfo 1  <---1 is instance domain
VCPU:           0     
CPU:            1   
State:          running 
CPU time:       1.3s
CPU Affinity:   yyyyyyyy      <-- VCPU0 can run on CPU0-CPU8

Run cpupin:
[root@ci13sjcmp03 ~]# virsh  vcpupin 1  0 1  

After cpupin:
[root@ci13sjcmp03 ~]# virsh vcpuinfo 1
VCPU:           0     
CPU:            1   
State:          running 
CPU time:       1.3s
CPU Affinity:   -y------      <-- VCPU0 can only run on CPU1

3. Get instance vcpupin :
In nova-compute, call API/CLI do the thing like following:
[root@ci13sjcmp03 ~]# virsh vcpuinfo 1
VCPU:           0     
CPU:            1   
State:          running 
CPU time:       1.3s
CPU Affinity:   -y------ 






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值