当前位置: 首页 > news >正文

PVE的current接口分析笔记

1、收到http的get请求
pve:node的节点名称
100:虚拟机ID
https://192.168.13.130:8006/api2/json/nodes/pve/qemu/100/status/current
2、nodes.pm通过PVE::API2::Qemu引用qemu.pm
__PACKAGE__->register_method({subclass => "PVE::API2::Qemu",path => 'qemu',
});
3、找到status/current注册的函数
代码处理
__PACKAGE__->register_method({name => 'vm_status',path => '{vmid}/status/current',method => 'GET',proxyto => 'node',protected => 1, # qemu pid files are only readable by rootdescription => "Get virtual machine status.",permissions => {check => ['perm', '/vms/{vmid}', ['VM.Audit']],},parameters => {additionalProperties => 0,properties => {node => get_standard_option('pve-node'),vmid => get_standard_option('pve-vmid'),},},returns => {type => 'object',properties => {%$PVE::QemuServer::vmstatus_return_properties,ha => {description => "HA manager service status.",type => 'object',},spice => {description => "QEMU VGA configuration supports spice.",type => 'boolean',optional => 1,},agent => {description => "QEMU Guest Agent is enabled in config.",type => 'boolean',optional => 1,},clipboard => {description => 'Enable a specific clipboard. If not set, depending on'. ' the display type the SPICE one will be added.',type => 'string',enum => ['vnc'],optional => 1,},},},code => sub {my ($param) = @_;# test if VM existsmy $conf = PVE::QemuConfig->load_config($param->{vmid});my $vmstatus = PVE::QemuServer::vmstatus($param->{vmid}, 1);my $status = $vmstatus->{ $param->{vmid} };$status->{ha} = PVE::HA::Config::get_service_status("vm:$param->{vmid}");if ($conf->{vga}) {my $vga = PVE::QemuServer::parse_vga($conf->{vga});my $spice = defined($vga->{type}) && $vga->{type} =~ /^virtio/;$spice ||= PVE::QemuServer::vga_conf_has_spice($conf->{vga});$status->{spice} = 1 if $spice;$status->{clipboard} = $vga->{clipboard};}$status->{agent} = 1 if PVE::QemuServer::get_qga_key($conf, 'enabled');return $status;},
});

返回的内容

{

    "data": {

        "qmpstatus": "stopped",

        "vmid": 100,

        "disk": 0,

        "mem": 0,

        "uptime": 0,

        "maxdisk": 53687091200,

        "status": "stopped",

        "ha": {

            "managed": 0

        },

        "maxmem": 2147483648,

        "diskread": 0,

        "template": 1,

        "cpus": 4,

        "name": "kylin-v10-desktop",

        "netin": 0,

        "cpu": 0,

        "diskwrite": 0,

        "netout": 0

    }

}

http://www.dtcms.com/a/537834.html

相关文章:

  • 有人说做网站赌浙江网站建设哪里有
  • 重庆网站建设哪个平台好做vip的网站好做吗
  • dlib安装不上的问题解决
  • 网站建设亇金手指排名十五网站备案照相怎么照
  • 精品网站建设比较好自己的淘宝网站怎么建设
  • 公司的网站建设 交给谁做更好些自己可以制作微信小程序吗
  • Git 学习打卡Day2-远程仓库高级操作
  • 宝石千莲疗愈师班|让热爱成为专业,让陪伴更有力量
  • Vue3小兔鲜-(一)
  • 清华紫光网站建设app软件制作公司哪家好
  • 3.1.1.1 大数据方法论与实践指南-开源工具说明-Apache NiFi
  • 分享一个自用的AI Coding Prompt
  • C# Office文档操作完整教程
  • HTML 表单控件
  • 基于C#的文档处理
  • 免费网站制作视频教程自适应型网站建设服务电话
  • nacos集群部署配置
  • 从小咖秀到 Sora 2:AI 短视频的商业化演进逻辑
  • 织梦网站程序安装网站开发计划书范文
  • Jackson 常用注解与完整用法总结
  • 浙江江能建设有限公司网站网店怎么推广和宣传
  • 在SCNet DCU异构环境使用Ollama 0.5.7启动deepseek等大模型
  • aspnet网站模板会员可见的网站开发
  • 网站有哪几种类型微信上wordpress
  • SQL语言基础
  • 找能做网站的wordpress 读取用户信息
  • 做网站得基础阿里首个网站开发人员
  • 佛山网站上排名企业培训师资格证报考2023
  • o2o网站建设策划淄博网站建设 很乱
  • 商品网站建设实训报告专业做轴承的网站