Movatterモバイル変換


[0]ホーム

URL:


CN118312276A - A cloud-native virtual machine GPU device hot-swap management method and system - Google Patents

A cloud-native virtual machine GPU device hot-swap management method and system
Download PDF

Info

Publication number
CN118312276A
CN118312276ACN202410503939.3ACN202410503939ACN118312276ACN 118312276 ACN118312276 ACN 118312276ACN 202410503939 ACN202410503939 ACN 202410503939ACN 118312276 ACN118312276 ACN 118312276A
Authority
CN
China
Prior art keywords
virtual machine
gpu
node
equipment
gpu equipment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410503939.3A
Other languages
Chinese (zh)
Inventor
黄帅康
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongdian Cloud Computing Technology Co ltd
Original Assignee
Zhongdian Cloud Computing Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhongdian Cloud Computing Technology Co ltdfiledCriticalZhongdian Cloud Computing Technology Co ltd
Priority to CN202410503939.3ApriorityCriticalpatent/CN118312276A/en
Publication of CN118312276ApublicationCriticalpatent/CN118312276A/en
Pendinglegal-statusCriticalCurrent

Links

Classifications

Landscapes

Abstract

The invention relates to the technical field of GPU equipment management, and provides a cloud native virtual machine GPU equipment hot plug management method and system, comprising the following steps: creating a virtual machine pod, scheduling an adaptive node to run the created virtual machine pod, distributing idle GPU equipment to the virtual machine pod, updating corresponding node GPU equipment custom resources, and calling a libvirt interface to create the virtual machine; allocating an idle GPU device for the created virtual machine by inquiring GPU device allocation information in node GPU device custom resources, and hot-adding the GPU device for the created virtual machine; and unloading the GPU equipment added to the virtual machine by calling a libvirt pcb equipment heat unloading interface, and updating the node GPU equipment custom resources corresponding to the node where the virtual machine unloading the GPU equipment is located. The invention realizes the online distribution of the GPU equipment, realizes the hot addition and hot unloading of the GPU equipment of the virtual machine, avoids the service interruption caused by restarting the virtual machine due to the addition and the unloading, and improves the utilization rate of the GPU equipment and the service persistence.

Description

Translated fromChinese
一种云原生虚拟机GPU设备热插拔管理方法和系统A cloud-native virtual machine GPU device hot-swap management method and system

技术领域Technical Field

本发明涉及GPU设备管理技术领域,尤其涉及一种云原生虚拟机GPU设备热插拔管理方法和系统。The present invention relates to the technical field of GPU device management, and in particular to a method and system for hot-plugging management of a cloud-native virtual machine GPU device.

背景技术Background technique

随着AI应用、大模型、人工智能、自动驾驶等新兴技术的快速发展,企业面临着越来越多的计算密集型任务和数据处理需求,以CPU为代表的传统计算架构已无法满足企业日益增长的计算需求。此时,以GPU为代表的异构计算因在处理大规模数据、进行复杂计算和实时图形渲染方面具有独特的优势被广泛应用。与此同时,由于缺乏异构资源调度管理等方面的经验和专业的解决方案,导致了GPU设备的资源利用率极低,给企业带来了高昂的AI生产成本。如何降本增效,提高GPU等异构资源的利用效率成为了当前众多企业亟需跨越的一道难题。With the rapid development of emerging technologies such as AI applications, large models, artificial intelligence, and autonomous driving, enterprises are facing more and more computing-intensive tasks and data processing needs. Traditional computing architectures represented by CPUs can no longer meet the growing computing needs of enterprises. At this time, heterogeneous computing represented by GPUs is widely used because of its unique advantages in processing large-scale data, performing complex calculations, and real-time graphics rendering. At the same time, due to the lack of experience and professional solutions in heterogeneous resource scheduling and management, the resource utilization rate of GPU devices is extremely low, which brings high AI production costs to enterprises. How to reduce costs and increase efficiency and improve the utilization efficiency of heterogeneous resources such as GPUs has become a difficult problem that many companies urgently need to overcome.

Kubernetes是一个开源的、先进的容器编排平台,被誉为云原生时代的操作系统。Kubernetes自身架构设计具有松耦合和高扩展的特点,通过CNI、CSI、CRI标准的制定能够实现网络、存储和容器运行时的扩展。同时,Kubernetes对外暴露设备插件接口,能够支持GPU等异构设备资源的调度和管理。Kubernetes通过Device Plugin框架+自定义资源扩展,用于支持异构设备资源。GPU设备厂商按照Device Plugin的接口规范实现自己的DevicePlugin,然后以DaemonSet的形式部署到Node节点。Device Plugin通过和Kubelet交互,实现了GPU设备的发现、健康检测、分配。基于Kubernetes的Device Plugin扩展机制,虚拟机Pod可以像申请使用CPU一样简单申请使用GPU资源,提高了GPU设备资源的利用率。Kubernetes is an open source, advanced container orchestration platform, known as the operating system of the cloud-native era. Kubernetes' own architectural design features loose coupling and high scalability. Through the formulation of CNI, CSI, and CRI standards, it can achieve the expansion of network, storage, and container runtime. At the same time, Kubernetes exposes device plug-in interfaces to support the scheduling and management of heterogeneous device resources such as GPUs. Kubernetes supports heterogeneous device resources through the Device Plugin framework + custom resource extension. GPU device manufacturers implement their own Device Plugin according to the interface specification of the Device Plugin, and then deploy it to the Node node in the form of DaemonSet. The Device Plugin interacts with Kubelet to realize the discovery, health detection, and allocation of GPU devices. Based on the Device Plugin extension mechanism of Kubernetes, virtual machine Pods can apply for GPU resources as easily as applying for CPUs, which improves the utilization rate of GPU device resources.

通过部署GPU设备的Device Plugin插件,GPU设备资源上报到Kubernetes节点后,虚拟机Pod创建时,Kubernetes部署的GPU Device Plugin会把相应的GPU设备资源分配给这个虚拟机Pod并且把GPU设备的pci地址写到虚拟机Pod的环境变量里面。虚拟机启动时会获取到已分配的GPU设备pci地址信息,通过GPU设备的pci地址完成GPU设备直通功能。虚拟机关机时,虚拟机Pod会由Kubernetes删除,已经分配给虚拟机Pod的GPU设备将会被回收。在实际应用中,上述方法存在以下不足:By deploying the Device Plugin of the GPU device, after the GPU device resources are reported to the Kubernetes node, when the virtual machine Pod is created, the GPU Device Plugin deployed by Kubernetes will allocate the corresponding GPU device resources to this virtual machine Pod and write the PCI address of the GPU device to the environment variables of the virtual machine Pod. When the virtual machine starts, it will obtain the allocated GPU device PCI address information, and complete the GPU device pass-through function through the PCI address of the GPU device. When the virtual machine is shut down, the virtual machine Pod will be deleted by Kubernetes, and the GPU device that has been allocated to the virtual machine Pod will be recycled. In actual applications, the above method has the following shortcomings:

1.虚拟机Pod是以GPU设备资源名称和需求数量来申请GPU设备的,一旦集群里面存在两种记录相同GPU资源的节点,这两个节点上记录的GPU资源都是同样的资源名称,无法精确控制虚拟机Pod申请哪种型号的GPU设备资源;1. The virtual machine Pod applies for GPU devices based on the GPU device resource name and required quantity. Once there are two nodes in the cluster that record the same GPU resources, the GPU resources recorded on these two nodes have the same resource name, and it is impossible to accurately control which model of GPU device resources the virtual machine Pod applies for;

2.每个GPU设备厂商会开发自己的Device Plugin,一个集群里面如果存在不同厂商的GPU设备,由于维护多个Device Plugin会增加运维精力与成本;2. Each GPU device manufacturer will develop its own Device Plugin. If there are GPU devices from different manufacturers in a cluster, maintaining multiple Device Plugins will increase operation and maintenance efforts and costs;

3.虚拟机Pod必须停止才可以释放已经分配的GPU设备资源,即不支持GPU设备的热插拔,无法在虚拟机业务不停机的情况下分配与释放GPU设备资源,不能做到GPU设备的随用随放,严重降低GPU设备资源的利用率。3. The virtual machine Pod must be stopped before the allocated GPU device resources can be released. In other words, hot plugging of GPU devices is not supported. GPU device resources cannot be allocated and released without shutting down the virtual machine business. GPU devices cannot be used and released at will, which seriously reduces the utilization rate of GPU device resources.

因此,如何提供更加高效、精确、低成本的GPU设备管理方法,成为亟待解决的技术问题。Therefore, how to provide a more efficient, accurate and low-cost GPU device management method has become a technical problem that needs to be solved urgently.

发明内容Summary of the invention

有鉴于此,为了克服现有技术的不足,本发明旨在提供一种云原生虚拟机GPU设备热插拔管理方法和系统。In view of this, in order to overcome the deficiencies of the prior art, the present invention aims to provide a cloud-native virtual machine GPU device hot-plug management method and system.

根据本发明的第一方面,提供一种云原生虚拟机GPU设备热插拔管理方法,该方法包括:According to a first aspect of the present invention, a method for hot-plugging management of a cloud-native virtual machine GPU device is provided, the method comprising:

创建虚拟机pod,调度适配的节点运行创建的虚拟机pod,将空闲的GPU设备分配给虚拟机pod,更新对应的节点GPU设备自定义资源,调用libvirt接口创建虚拟机;Create a virtual machine pod, schedule the adapted node to run the created virtual machine pod, allocate idle GPU devices to the virtual machine pod, update the corresponding node GPU device custom resources, and call the libvirt interface to create a virtual machine;

通过查询节点GPU设备自定义资源中的GPU设备分配信息,为创建的虚拟机分配一个空闲的GPU设备,并为创建的虚拟机热添加GPU设备;By querying the GPU device allocation information in the node GPU device custom resource, an idle GPU device is allocated to the created virtual machine, and a GPU device is hot-added to the created virtual machine.

通过调用libvirt pci设备热卸载接口卸载添加至虚拟机的GPU设备,更新卸载GPU设备的虚拟机所在节点对应的节点GPU设备自定义资源。The GPU device added to the virtual machine is uninstalled by calling the libvirt pci device hot uninstall interface, and the node GPU device custom resource corresponding to the node where the virtual machine where the GPU device is uninstalled is updated.

优选地,本发明的云原生虚拟机GPU设备热插拔管理方法中,创建虚拟机pod,调度适配的节点运行创建的虚拟机pod,将空闲的GPU设备分配给虚拟机pod,更新对应的节点GPU设备自定义资源,调用libvirt接口创建虚拟机,包括:Preferably, in the cloud-native virtual machine GPU device hot-swap management method of the present invention, a virtual machine pod is created, an adapted node is scheduled to run the created virtual machine pod, an idle GPU device is allocated to the virtual machine pod, a corresponding node GPU device custom resource is updated, and a libvirt interface is called to create a virtual machine, including:

虚拟机管理组件创建虚拟机pod,虚拟机调度组件在检测到创建的虚拟机pod时,查询当前K8s集群内所有的节点GPU设备自定义资源,从GPU设备自定义资源中过滤获得满足虚拟机pod所需GPU设备资源的节点;The virtual machine management component creates a virtual machine pod. When the virtual machine scheduling component detects the created virtual machine pod, it queries all the node GPU device custom resources in the current K8s cluster and filters the GPU device custom resources to obtain the nodes that meet the GPU device resources required by the virtual machine pod.

虚拟机调度组件为过滤获得的节点进行适配度评分,采用适配度评分最高的节点运行虚拟机pod,向节点GPU设备自定义资源控制器组件发送GPU设备申请请求;The virtual machine scheduling component scores the fitness of the filtered nodes, uses the node with the highest fitness score to run the virtual machine pod, and sends a GPU device application request to the node GPU device custom resource controller component;

节点GPU设备自定义资源控制器组件接收到虚拟机调度组件发送的GPU设备申请请求后,将空闲的GPU设备分配给虚拟机pod;After receiving the GPU device application request sent by the virtual machine scheduling component, the node GPU device custom resource controller component allocates the idle GPU device to the virtual machine pod;

节点GPU设备自定义资源控制器组件更新对应的节点GPU设备自定义资源,虚拟机管理组件根据更新的节点GPU设备自定义资源调用libvirt接口创建虚拟机。The node GPU device custom resource controller component updates the corresponding node GPU device custom resources, and the virtual machine management component calls the libvirt interface to create a virtual machine according to the updated node GPU device custom resources.

优选地,本发明的云原生虚拟机GPU设备热插拔管理方法中,节点GPU设备自定义资源控制器组件更新对应的节点GPU设备自定义资源,虚拟机管理组件根据更新的节点GPU设备自定义资源调用libvirt接口创建虚拟机,包括:Preferably, in the cloud native virtual machine GPU device hot plug management method of the present invention, the node GPU device custom resource controller component updates the corresponding node GPU device custom resources, and the virtual machine management component calls the libvirt interface to create a virtual machine according to the updated node GPU device custom resources, including:

节点GPU设备自定义资源控制器组件更新对应的节点GPU设备自定义资源中的GPU设备分配信息;The node GPU device custom resource controller component updates the GPU device allocation information in the corresponding node GPU device custom resource;

虚拟机管理组件通过查询节点GPU设备自定义资源中更新后的GPU设备分配信息,获取分配给虚拟机pod的GPU设备的pci地址信息,将获取的pci地址信息作为参数传递给libvirt接口,调用libvirt接口创建虚拟机。The virtual machine management component obtains the PCI address information of the GPU device assigned to the virtual machine pod by querying the updated GPU device allocation information in the node GPU device custom resource, passes the obtained PCI address information as a parameter to the libvirt interface, and calls the libvirt interface to create a virtual machine.

优选地,本发明的云原生虚拟机GPU设备热插拔管理方法中,通过查询节点GPU设备自定义资源中的GPU设备分配信息,为创建的虚拟机分配一个空闲的GPU设备,并为创建的虚拟机热添加GPU设备,包括:Preferably, in the cloud native virtual machine GPU device hot plug management method of the present invention, by querying the GPU device allocation information in the node GPU device custom resource, an idle GPU device is allocated to the created virtual machine, and a GPU device is hot added to the created virtual machine, including:

虚拟机管理组件在收到用户的GPU设备热添加指令后,向节点GPU设备自定义资源控制器组件发送GPU设备申请请求;After receiving the user's GPU device hot add instruction, the virtual machine management component sends a GPU device application request to the node GPU device custom resource controller component;

节点GPU设备自定义资源控制器组件接收到虚拟机管理组件发送的GPU设备申请请求后,查询节点GPU设备自定义资源中的GPU设备分配信息,根据GPU设备分配信息为创建的虚拟机分配一个空闲的GPU设备,更新对应的节点GPU设备自定义资源中的GPU设备分配信息;After receiving the GPU device application request sent by the virtual machine management component, the node GPU device custom resource controller component queries the GPU device allocation information in the node GPU device custom resource, allocates an idle GPU device to the created virtual machine according to the GPU device allocation information, and updates the GPU device allocation information in the corresponding node GPU device custom resource;

虚拟机管理组件查询节点GPU设备自定义资源中更新的GPU设备分配信息,根据更新的GPU设备分配信息调用libvirt pci设备热添加接口为创建的虚拟机热添加GPU设备。The virtual machine management component queries the node GPU device custom resource for updated GPU device allocation information, and calls the libvirt pci device hot-add interface to hot-add the GPU device to the created virtual machine according to the updated GPU device allocation information.

优选地,本发明的云原生虚拟机GPU设备热插拔管理方法中,通过调用libvirtpci设备热卸载接口卸载添加至虚拟机的GPU设备,更新卸载GPU设备的虚拟机所在节点对应的节点GPU设备自定义资源,包括:Preferably, in the cloud native virtual machine GPU device hot plug management method of the present invention, the GPU device added to the virtual machine is uninstalled by calling the libvirtpci device hot uninstall interface, and the node GPU device custom resource corresponding to the node where the virtual machine where the GPU device is uninstalled is updated, including:

虚拟机管理组件在收到用户的GPU设备热卸载指令后,调用libvirt pci设备热卸载接口卸载添加至虚拟机的GPU设备;After receiving the user's GPU device hot uninstall instruction, the virtual machine management component calls the libvirt pci device hot uninstall interface to uninstall the GPU device added to the virtual machine;

虚拟机管理组件接收到libvirt pci设备热卸载接口返回的卸载成功信息后,向节点GPU设备自定义资源控制器组件发送GPU设备释放请求;After receiving the unloading success information returned by the libvirt pci device hot unloading interface, the virtual machine management component sends a GPU device release request to the node GPU device custom resource controller component;

节点GPU设备自定义资源控制器组件接收到虚拟机管理组件发送的GPU设备释放请求后,更新卸载GPU设备的虚拟机所在节点对应的节点GPU设备自定义资源中的GPU设备分配信息。After receiving the GPU device release request sent by the virtual machine management component, the node GPU device custom resource controller component updates the GPU device allocation information in the node GPU device custom resource corresponding to the node where the virtual machine that uninstalls the GPU device is located.

根据本发明的第二方面,提供一种云原生虚拟机GPU设备热插拔管理系统,该系统包括热插拔管理服务端,该热插拔管理服务端用于:According to a second aspect of the present invention, a cloud native virtual machine GPU device hot plug management system is provided, the system comprising a hot plug management server, the hot plug management server is used to:

创建虚拟机pod,调度适配的节点运行创建的虚拟机pod,将空闲的GPU设备分配给虚拟机pod,更新对应的节点GPU设备自定义资源,调用libvirt接口创建虚拟机;Create a virtual machine pod, schedule the adapted node to run the created virtual machine pod, allocate idle GPU devices to the virtual machine pod, update the corresponding node GPU device custom resources, and call the libvirt interface to create a virtual machine;

通过查询节点GPU设备自定义资源中的GPU设备分配信息,为创建的虚拟机分配一个空闲的GPU设备,并为创建的虚拟机热添加GPU设备;By querying the GPU device allocation information in the node GPU device custom resource, an idle GPU device is allocated to the created virtual machine, and a GPU device is hot-added to the created virtual machine.

通过调用libvirt pci设备热卸载接口卸载添加至虚拟机的GPU设备,更新卸载GPU设备的虚拟机所在节点对应的节点GPU设备自定义资源。The GPU device added to the virtual machine is uninstalled by calling the libvirt pci device hot uninstall interface, and the node GPU device custom resource corresponding to the node where the virtual machine where the GPU device is uninstalled is updated.

优选地,本发明的云原生虚拟机GPU设备热插拔管理系统中,创建虚拟机pod,调度适配的节点运行创建的虚拟机pod,将空闲的GPU设备分配给虚拟机pod,更新对应的节点GPU设备自定义资源,调用libvirt接口创建虚拟机,包括:Preferably, in the cloud-native virtual machine GPU device hot-swap management system of the present invention, a virtual machine pod is created, an adapted node is scheduled to run the created virtual machine pod, an idle GPU device is allocated to the virtual machine pod, a corresponding node GPU device custom resource is updated, and a libvirt interface is called to create a virtual machine, including:

虚拟机管理组件创建虚拟机pod,虚拟机调度组件在检测到创建的虚拟机pod时,查询当前K8s集群内所有的节点GPU设备自定义资源,从GPU设备自定义资源中过滤获得满足虚拟机pod所需GPU设备资源的节点;The virtual machine management component creates a virtual machine pod. When the virtual machine scheduling component detects the created virtual machine pod, it queries all the node GPU device custom resources in the current K8s cluster and filters the GPU device custom resources to obtain the nodes that meet the GPU device resources required by the virtual machine pod.

虚拟机调度组件为过滤获得的节点进行适配度评分,采用适配度评分最高的节点运行虚拟机pod,向节点GPU设备自定义资源控制器组件发送GPU设备申请请求;The virtual machine scheduling component scores the fitness of the filtered nodes, uses the node with the highest fitness score to run the virtual machine pod, and sends a GPU device application request to the node GPU device custom resource controller component;

节点GPU设备自定义资源控制器组件接收到虚拟机调度组件发送的GPU设备申请请求后,将空闲的GPU设备分配给虚拟机pod;After receiving the GPU device application request sent by the virtual machine scheduling component, the node GPU device custom resource controller component allocates the idle GPU device to the virtual machine pod;

节点GPU设备自定义资源控制器组件更新对应的节点GPU设备自定义资源,虚拟机管理组件根据更新的节点GPU设备自定义资源调用libvirt接口创建虚拟机。The node GPU device custom resource controller component updates the corresponding node GPU device custom resources, and the virtual machine management component calls the libvirt interface to create a virtual machine according to the updated node GPU device custom resources.

优选地,本发明的云原生虚拟机GPU设备热插拔管理系统中,节点GPU设备自定义资源控制器组件更新对应的节点GPU设备自定义资源,虚拟机管理组件根据更新的节点GPU设备自定义资源调用libvirt接口创建虚拟机,包括:Preferably, in the cloud native virtual machine GPU device hot plug management system of the present invention, the node GPU device custom resource controller component updates the corresponding node GPU device custom resources, and the virtual machine management component calls the libvirt interface to create a virtual machine according to the updated node GPU device custom resources, including:

节点GPU设备自定义资源控制器组件更新对应的节点GPU设备自定义资源中的GPU设备分配信息;The node GPU device custom resource controller component updates the GPU device allocation information in the corresponding node GPU device custom resource;

虚拟机管理组件通过查询节点GPU设备自定义资源中更新后的GPU设备分配信息,获取分配给虚拟机pod的GPU设备的pci地址信息,将获取的pci地址信息作为参数传递给libvirt接口,调用libvirt接口创建虚拟机。The virtual machine management component obtains the PCI address information of the GPU device assigned to the virtual machine pod by querying the updated GPU device allocation information in the node GPU device custom resource, passes the obtained PCI address information as a parameter to the libvirt interface, and calls the libvirt interface to create a virtual machine.

优选地,本发明的云原生虚拟机GPU设备热插拔管理系统中,通过查询节点GPU设备自定义资源中的GPU设备分配信息,为创建的虚拟机分配一个空闲的GPU设备,并为创建的虚拟机热添加GPU设备,包括:Preferably, in the cloud-native virtual machine GPU device hot-swap management system of the present invention, by querying the GPU device allocation information in the node GPU device custom resource, an idle GPU device is allocated to the created virtual machine, and a GPU device is hot-added to the created virtual machine, including:

虚拟机管理组件在收到用户的GPU设备热添加指令后,向节点GPU设备自定义资源控制器组件发送GPU设备申请请求;After receiving the user's GPU device hot add instruction, the virtual machine management component sends a GPU device application request to the node GPU device custom resource controller component;

节点GPU设备自定义资源控制器组件接收到虚拟机管理组件发送的GPU设备申请请求后,查询节点GPU设备自定义资源中的GPU设备分配信息,根据GPU设备分配信息为创建的虚拟机分配一个空闲的GPU设备,更新对应的节点GPU设备自定义资源中的GPU设备分配信息;After receiving the GPU device application request sent by the virtual machine management component, the node GPU device custom resource controller component queries the GPU device allocation information in the node GPU device custom resource, allocates an idle GPU device to the created virtual machine according to the GPU device allocation information, and updates the GPU device allocation information in the corresponding node GPU device custom resource;

虚拟机管理组件查询节点GPU设备自定义资源中更新的GPU设备分配信息,根据更新的GPU设备分配信息调用libvirt pci设备热添加接口为创建的虚拟机热添加GPU设备。The virtual machine management component queries the node GPU device custom resource for updated GPU device allocation information, and calls the libvirt pci device hot-add interface to hot-add the GPU device to the created virtual machine according to the updated GPU device allocation information.

优选地,本发明的云原生虚拟机GPU设备热插拔管理系统中,通过调用libvirtpci设备热卸载接口卸载添加至虚拟机的GPU设备,更新卸载GPU设备的虚拟机所在节点对应的节点GPU设备自定义资源,包括:Preferably, in the cloud-native virtual machine GPU device hot-swap management system of the present invention, the GPU device added to the virtual machine is uninstalled by calling the libvirtpci device hot-uninstall interface, and the node GPU device custom resource corresponding to the node where the virtual machine where the GPU device is uninstalled is updated, including:

虚拟机管理组件在收到用户的GPU设备热卸载指令后,调用libvirt pci设备热卸载接口卸载添加至虚拟机的GPU设备;After receiving the user's GPU device hot uninstall instruction, the virtual machine management component calls the libvirt pci device hot uninstall interface to uninstall the GPU device added to the virtual machine;

虚拟机管理组件接收到libvirt pci设备热卸载接口返回的卸载成功信息后,向节点GPU设备自定义资源控制器组件发送GPU设备释放请求;After receiving the unloading success information returned by the libvirt pci device hot unloading interface, the virtual machine management component sends a GPU device release request to the node GPU device custom resource controller component;

节点GPU设备自定义资源控制器组件接收到虚拟机管理组件发送的GPU设备释放请求后,更新卸载GPU设备的虚拟机所在节点对应的节点GPU设备自定义资源中的GPU设备分配信息。After receiving the GPU device release request sent by the virtual machine management component, the node GPU device custom resource controller component updates the GPU device allocation information in the node GPU device custom resource corresponding to the node where the virtual machine that uninstalls the GPU device is located.

根据本发明的第三方面,提供一种计算机设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述程序时实现本发明第一方面所述的方法。According to a third aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect of the present invention when executing the program.

本发明的云原生虚拟机GPU设备热插拔管理方法和系统,实现了对GPU设备的在线分配,实现虚拟机GPU设备的热添加和热卸载,避免因为添加、卸载而重启虚拟机带来的业务中断,提高GPU设备的利用率和业务的持续性。The cloud-native virtual machine GPU device hot-swap management method and system of the present invention realize online allocation of GPU devices, hot addition and hot uninstallation of virtual machine GPU devices, avoid business interruption caused by restarting the virtual machine due to addition and uninstallation, and improve the utilization rate of GPU devices and business continuity.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本发明实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

图1为一种适用于本申请实施例的云原生虚拟机GPU设备热插拔管理方法的系统的示意图;FIG1 is a schematic diagram of a system for a hot-swap management method for a cloud-native virtual machine GPU device applicable to an embodiment of the present application;

图2为本发明实施例的云原生虚拟机GPU设备热插拔管理系统的一种架构示例图;FIG2 is an example diagram of an architecture of a hot-swap management system for a cloud-native virtual machine GPU device according to an embodiment of the present invention;

图3为根据本发明示例性实施例的一种云原生虚拟机GPU设备热插拔管理方法的步骤流程图;FIG3 is a flowchart of a method for hot-swapping a cloud-native virtual machine GPU device according to an exemplary embodiment of the present invention;

图4为本发明提供的设备的结构示意图。FIG. 4 is a schematic diagram of the structure of the device provided by the present invention.

具体实施方式Detailed ways

下面结合附图对本发明实施例进行详细描述。The embodiments of the present invention are described in detail below with reference to the accompanying drawings.

需说明的是,在不冲突的情况下,以下实施例及实施例中的特征可以相互组合;并且,基于本公开中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。It should be noted that the following embodiments and features in the embodiments may be combined with each other in the absence of conflict; and, based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making any creative work are within the scope of protection of the present disclosure.

需要说明的是,下文描述在所附权利要求书的范围内的实施例的各种方面。应显而易见,本文中所描述的方面可体现于广泛多种形式中,且本文中所描述的任何特定结构及/或功能仅为说明性的。基于本公开,所属领域的技术人员应了解,本文中所描述的一个方面可与任何其它方面独立地实施,且可以各种方式组合这些方面中的两者或两者以上。举例来说,可使用本文中所阐述的任何数目个方面来实施设备及/或实践方法。另外,可使用除了本文中所阐述的方面中的一或多者之外的其它结构及/或功能性实施此设备及/或实践此方法。It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and/or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and/or practice the method. In addition, other structures and/or functionalities other than one or more of the aspects described herein may be used to implement this device and/or practice this method.

图1为一种适用于本申请实施例的云原生虚拟机GPU设备热插拔管理方法的系统的示意图。如图1所示,该系统可以包括热插拔管理服务端101、通信网络102和/或一个或多个热插拔管理客户端103,图1中示例为多个热插拔管理客户端103。Fig. 1 is a schematic diagram of a system applicable to the hot-plug management method of a cloud-native virtual machine GPU device according to an embodiment of the present application. As shown in Fig. 1, the system may include a hot-plug management server 101, a communication network 102 and/or one or more hot-plug management clients 103, and Fig. 1 shows multiple hot-plug management clients 103.

热插拔管理服务端101可以时用于存储信息、数据、程序和/或任何其他合适类型的内容的任何适当的服务器。在一些实施例中,热插拔管理服务端101可以执行适当的功能。例如,在一些实施例中,热插拔管理服务端101可以用于虚拟机GPU设备热插拔管理。作为可选的示例,在一些实施例中,热插拔管理服务端101可以被用于创建虚拟机pod,调度适配的节点运行创建的虚拟机pod,将空闲的GPU设备分配给虚拟机pod,更新对应的节点GPU设备自定义资源,调用libvirt接口创建虚拟机;通过查询节点GPU设备自定义资源中的GPU设备分配信息,为创建的虚拟机分配一个空闲的GPU设备,并为创建的虚拟机热添加GPU设备;通过调用libvirt pci设备热卸载接口卸载添加至虚拟机的GPU设备,更新卸载GPU设备的虚拟机所在节点对应的节点GPU设备自定义资源。The hot-swap management server 101 can be any appropriate server for storing information, data, programs and/or any other suitable type of content. In some embodiments, the hot-swap management server 101 can perform appropriate functions. For example, in some embodiments, the hot-swap management server 101 can be used for hot-swap management of virtual machine GPU devices. As an optional example, in some embodiments, the hot-swap management server 101 can be used to create a virtual machine pod, schedule an adapted node to run the created virtual machine pod, allocate idle GPU devices to the virtual machine pod, update the corresponding node GPU device custom resources, call the libvirt interface to create a virtual machine; allocate an idle GPU device to the created virtual machine by querying the GPU device allocation information in the node GPU device custom resources, and hot-add a GPU device to the created virtual machine; uninstall the GPU device added to the virtual machine by calling the libvirt pci device hot uninstall interface, and update the node GPU device custom resources corresponding to the node where the virtual machine where the GPU device is uninstalled is located.

图2为本发明实施例的云原生虚拟机GPU设备热插拔管理系统的一种架构示例图。如图2所示,本实施例的云原生虚拟机GPU设备热插拔管理系统包括虚拟机管理组件、虚拟机调度组件和节点GPU设备自定义资源控制器组件。Figure 2 is an example diagram of an architecture of a cloud-native virtual machine GPU device hot-swap management system according to an embodiment of the present invention. As shown in Figure 2, the cloud-native virtual machine GPU device hot-swap management system according to this embodiment includes a virtual machine management component, a virtual machine scheduling component, and a node GPU device custom resource controller component.

本实施例的虚拟机管理组件,用于管理虚拟机生命周期以及响应并处理虚拟机的配置操作,响应处理虚拟机GPU设备的热添加、热卸载接口操作,通过与节点GPU设备自定义资源控制器组件协作完成虚拟机GPU设备记录信息管理,依据节点GPU设备自定义资源控制器组件记录管理的GPU设备信息,通过调用libvirt pci设备热更新接口完成GPU设备的热添加、热卸载。The virtual machine management component of this embodiment is used to manage the virtual machine life cycle and respond to and process the configuration operations of the virtual machine, respond to and process the hot add and hot unload interface operations of the virtual machine GPU device, complete the virtual machine GPU device record information management by collaborating with the node GPU device custom resource controller component, and complete the hot add and hot unload of the GPU device by calling the libvirt pci device hot update interface based on the GPU device information recorded and managed by the node GPU device custom resource controller component.

具体的,本实施例的虚拟机管理组件,用于创建虚拟机pod;根据更新的节点GPU设备自定义资源调用libvirt接口创建虚拟机,具体用于通过查询节点GPU设备自定义资源中更新后的GPU设备分配信息,获取分配给虚拟机pod的GPU设备的pci地址信息,将获取的pci地址信息作为参数传递给libvirt接口,调用libvirt接口创建虚拟机;在收到用户的GPU设备热添加指令后,向节点GPU设备自定义资源控制器组件发送GPU设备申请请求;查询节点GPU设备自定义资源中更新的GPU设备分配信息,根据更新的GPU设备分配信息调用libvirtpci设备热添加接口为创建的虚拟机热添加GPU设备;在收到用户的GPU设备热卸载指令后,调用libvirt pci设备热卸载接口卸载添加至虚拟机的GPU设备;接收到libvirt pci设备热卸载接口返回的卸载成功信息后,向节点GPU设备自定义资源控制器组件发送GPU设备释放请求。Specifically, the virtual machine management component of this embodiment is used to create a virtual machine pod; call the libvirt interface to create a virtual machine according to the updated node GPU device custom resources, specifically to obtain the PCI address information of the GPU device allocated to the virtual machine pod by querying the updated GPU device allocation information in the node GPU device custom resources, pass the obtained PCI address information as a parameter to the libvirt interface, and call the libvirt interface to create a virtual machine; after receiving the user's GPU device hot add instruction, send a GPU device application request to the node GPU device custom resource controller component; query the updated GPU device allocation information in the node GPU device custom resources, and call the libvirtpci device hot add interface to hot add the GPU device to the created virtual machine according to the updated GPU device allocation information; after receiving the user's GPU device hot uninstall instruction, call the libvirt pci device hot uninstall interface to uninstall the GPU device added to the virtual machine; after receiving the uninstall success information returned by the libvirt pci device hot uninstall interface, send a GPU device release request to the node GPU device custom resource controller component.

本实施例的虚拟机调度组件用于在检测到创建的虚拟机pod时,查询当前K8s集群内所有的节点GPU设备自定义资源,从GPU设备自定义资源中过滤获得满足虚拟机pod所需GPU设备资源的节点;为过滤获得的节点进行适配度评分,采用适配度评分最高的节点运行虚拟机pod,向节点GPU设备自定义资源控制器组件发送GPU设备申请请求。The virtual machine scheduling component of this embodiment is used to query all node GPU device custom resources in the current K8s cluster when the created virtual machine pod is detected, and filter out nodes that meet the GPU device resources required by the virtual machine pod from the GPU device custom resources; perform fitness scoring on the filtered nodes, use the node with the highest fitness score to run the virtual machine pod, and send a GPU device application request to the node GPU device custom resource controller component.

作为可选的示例,本实施例的虚拟机调度组件,用于调度虚拟机pod,将虚拟机pod调度到满足其资源需求的节点。举例来说,基于Kubernetes Scheduler Framework调度器框架实现Kubernetes调度器的Filter、Reserve和Permit扩展点。当虚拟机pod创建时,虚拟机调度组件开始调度虚拟机pod,首先采用Filter扩展点,根据虚拟机pod所需的GPU设备资源和各节点对应的节点GPU设备自定义资源记录的GPU设备资源进行节点的过滤,过滤掉不满足GPU设备需求的节点;然后采用Reserve扩展点,向节点GPU设备自定义资源控制器组件发送GPU设备申请请求;最后通过Permit扩展点判断GPU设备申请请求是否处理成功并成功为虚拟机pod分配GPU。经过上述流程,虚拟机pod成功调度到满足GPU资源需求的节点并分配GPU设备。本实施例的虚拟机调度组件实现了虚拟机pod的调度功能,当虚拟机管理组件创建出一个虚拟机pod时,虚拟机调度组件根据当前虚拟机pod的GPU设备需求查找节点GPU设备自定义资源记录的节点GPU设备,之后为虚拟机pod选择满足GPU设备需求的节点并把虚拟机pod调度到当前节点并更新节点GPU设备自定义资源状态,记录GPU设备的分配情况。As an optional example, the virtual machine scheduling component of this embodiment is used to schedule the virtual machine pod and schedule the virtual machine pod to a node that meets its resource requirements. For example, the Filter, Reserve, and Permit extension points of the Kubernetes scheduler are implemented based on the Kubernetes Scheduler Framework scheduler framework. When the virtual machine pod is created, the virtual machine scheduling component starts to schedule the virtual machine pod. First, the Filter extension point is used to filter the nodes according to the GPU device resources required by the virtual machine pod and the GPU device resources recorded by the node GPU device custom resource corresponding to each node, and the nodes that do not meet the GPU device requirements are filtered out; then the Reserve extension point is used to send a GPU device application request to the node GPU device custom resource controller component; finally, the Permit extension point is used to determine whether the GPU device application request is successfully processed and the GPU is successfully allocated to the virtual machine pod. After the above process, the virtual machine pod is successfully scheduled to a node that meets the GPU resource requirements and a GPU device is allocated. The virtual machine scheduling component of this embodiment implements the scheduling function of the virtual machine pod. When the virtual machine management component creates a virtual machine pod, the virtual machine scheduling component searches for the node GPU device recorded in the node GPU device custom resource according to the GPU device requirements of the current virtual machine pod, and then selects a node that meets the GPU device requirements for the virtual machine pod, schedules the virtual machine pod to the current node, updates the node GPU device custom resource status, and records the allocation of the GPU device.

本实施例的节点GPU设备自定义资源控制器组件用于节点GPU设备自定义资源的全生命周期管理,节点GPU设备自定义资源用于记录并存储与之对应节点的GPU设备信息。在实际应用中,节点GPU设备自定义资源控制器组件为每一个节点创建一个对应的节点GPU设备自定义资源,每一个节点GPU设备自定义资源件都会记录对应节点的GPU设备资源类型以及使用情况。节点GPU设备自定义资源控制器组件可以接收虚拟机管理组件发起的GPU设备热添加、热卸载请求,当有GPU设备热添加请求时,节点GPU设备自定义资源控制器组件为虚拟机分配GPU设备,当有GPU设备热卸载请求时,节点GPU设备自定义资源控制器组件回收对应的GPU设备。The node GPU device custom resource controller component of this embodiment is used for the full life cycle management of the node GPU device custom resources, and the node GPU device custom resources are used to record and store the GPU device information of the corresponding node. In actual applications, the node GPU device custom resource controller component creates a corresponding node GPU device custom resource for each node, and each node GPU device custom resource component will record the GPU device resource type and usage of the corresponding node. The node GPU device custom resource controller component can receive GPU device hot add and hot unload requests initiated by the virtual machine management component. When there is a GPU device hot add request, the node GPU device custom resource controller component allocates a GPU device to the virtual machine. When there is a GPU device hot unload request, the node GPU device custom resource controller component recycles the corresponding GPU device.

作为可选的示例,本实施例的节点GPU设备自定义资源控制器组件用于接收到虚拟机调度组件发送的GPU设备申请请求后,将空闲的GPU设备分配给虚拟机pod;更新对应的节点GPU设备自定义资源,具体用于更新对应的节点GPU设备自定义资源中的GPU设备分配信息;接收到虚拟机管理组件发送的GPU设备申请请求后,查询节点GPU设备自定义资源中的GPU设备分配信息,根据GPU设备分配信息为创建的虚拟机分配一个空闲的GPU设备,更新对应的节点GPU设备自定义资源中的GPU设备分配信息;接收到虚拟机管理组件发送的GPU设备释放请求后,更新卸载GPU设备的虚拟机所在节点对应的节点GPU设备自定义资源中的GPU设备分配信息。As an optional example, the node GPU device custom resource controller component of this embodiment is used to allocate an idle GPU device to a virtual machine pod after receiving a GPU device application request sent by a virtual machine scheduling component; update the corresponding node GPU device custom resources, specifically for updating the GPU device allocation information in the corresponding node GPU device custom resources; after receiving a GPU device application request sent by a virtual machine management component, query the GPU device allocation information in the node GPU device custom resources, allocate an idle GPU device to the created virtual machine according to the GPU device allocation information, and update the GPU device allocation information in the corresponding node GPU device custom resources; after receiving a GPU device release request sent by the virtual machine management component, update the GPU device allocation information in the node GPU device custom resources corresponding to the node where the virtual machine that uninstalled the GPU device is located.

作为另一示例,在一些实施例中,热插拔管理服务端101可以根据热插拔管理客户端103的请求,将云原生虚拟机GPU设备热插拔管理方法发送到热插拔管理客户端103供用户使用。As another example, in some embodiments, the hot-plug management server 101 may send the cloud-native virtual machine GPU device hot-plug management method to the hot-plug management client 103 for user use based on the request of the hot-plug management client 103 .

作为可选的示例,在一些实施例中,热插拔管理客户端103用于提供可视化管理界面,该可视化管理界面用于接收用户云原生虚拟机GPU设备热插拔管理的选择输入操作,以及,用于响应于选择输入操作,从热插拔管理服务端101获取与选择输入操作所选择的选项所对应的管理界面并展示管理界面,管理界面中至少展示有云原生虚拟机GPU设备热插拔管理的信息以及针对云原生虚拟机GPU设备热插拔管理的信息的操作选项。As an optional example, in some embodiments, the hot-plug management client 103 is used to provide a visual management interface, which is used to receive a user's selection input operation for hot-plug management of a cloud-native virtual machine GPU device, and, in response to the selection input operation, obtain from the hot-plug management server 101 a management interface corresponding to the option selected by the selection input operation and display the management interface, wherein the management interface displays at least information on hot-plug management of cloud-native virtual machine GPU devices and operation options for the information on hot-plug management of cloud-native virtual machine GPU devices.

在一些实施例中,通信网络102可以是一个或多个有线和/或无线网络的任何适当的组合。例如,通信网络102能够包括以下各项中的任何一种或多种:互联网、内联网、广域网(WAN)、局域网(LAN)、无线网络、数字订户线路(DSL)网络、帧中继网络、异步转移模式(ATM)网络、虚拟专用网(VPN)和/或任何其它合适的通信网络。热插拔管理客户端103能够通过一个或多个通信链路(例如,通信链路104)连接到通信网络102,该通信网络102能够经由一个或多个通信链路(例如,通信链路105)被链接到热插拔管理服务端101。通信链路可以是适合于在热插拔管理客户端103和热插拔管理服务端101之间传送数据的任何通信链路,诸如网络链路、拨号链路、无线链路、硬连线链路、任何其它合适的通信链路或此类链路的任何合适的组合。In some embodiments, the communication network 102 can be any suitable combination of one or more wired and/or wireless networks. For example, the communication network 102 can include any one or more of the following: the Internet, an intranet, a wide area network (WAN), a local area network (LAN), a wireless network, a digital subscriber line (DSL) network, a frame relay network, an asynchronous transfer mode (ATM) network, a virtual private network (VPN), and/or any other suitable communication network. The hot-swap management client 103 can be connected to the communication network 102 via one or more communication links (e.g., communication link 104), and the communication network 102 can be linked to the hot-swap management server 101 via one or more communication links (e.g., communication link 105). The communication link can be any communication link suitable for transmitting data between the hot-swap management client 103 and the hot-swap management server 101, such as a network link, a dial-up link, a wireless link, a hard-wired link, any other suitable communication link, or any suitable combination of such links.

热插拔管理客户端103可以包括通过适当形式呈现与云原生虚拟机GPU设备热插拔管理相关的界面,以供用户使用和操作的任何一个或多个客户端。在一些实施例中,热插拔管理客户端103可以包括任何合适类型的设备。例如,在一些实施例中,热插拔管理客户端103可以包括移动设备、平板计算机、膝上型计算机、台式计算机和/或任何其他合适类型的客户端设备。The hot-swap management client 103 may include any one or more clients that present an interface related to the hot-swap management of the cloud-native virtual machine GPU device in an appropriate form for use and operation by the user. In some embodiments, the hot-swap management client 103 may include any suitable type of device. For example, in some embodiments, the hot-swap management client 103 may include a mobile device, a tablet computer, a laptop computer, a desktop computer, and/or any other suitable type of client device.

尽管将热插拔管理服务端101图示为一个设备,但是在一些实施例中,可以使用任何适当数量的设备来执行由热插拔管理服务端101执行的功能。例如,在一些实施例中,可以使用多个设备来实现由热插拔管理服务端101执行的功能。或者,可使用云服务实现热插拔管理服务端101的功能。Although the hot swap management server 101 is illustrated as one device, in some embodiments, any suitable number of devices may be used to perform the functions performed by the hot swap management server 101. For example, in some embodiments, multiple devices may be used to implement the functions performed by the hot swap management server 101. Alternatively, a cloud service may be used to implement the functions of the hot swap management server 101.

基于上述系统,本申请实施例提供了一种云原生虚拟机GPU设备热插拔管理方法,以下通过以下实施例进行说明。Based on the above system, an embodiment of the present application provides a cloud-native virtual machine GPU device hot-plug management method, which is illustrated by the following embodiments.

图3为根据本发明示例性实施例的一种云原生虚拟机GPU设备热插拔管理方法的步骤流程图。本实施例的云原生虚拟机GPU设备热插拔管理方法可在热插拔管理服务端执行,如图3所示,该云原生虚拟机GPU设备热插拔管理方法包括以下步骤:Figure 3 is a flowchart of the steps of a cloud native virtual machine GPU device hot plug management method according to an exemplary embodiment of the present invention. The cloud native virtual machine GPU device hot plug management method of this embodiment can be executed on the hot plug management server, as shown in Figure 3, the cloud native virtual machine GPU device hot plug management method includes the following steps:

步骤S201:创建虚拟机pod,调度适配的节点运行创建的虚拟机pod,将空闲的GPU设备分配给虚拟机pod,更新对应的节点GPU设备自定义资源,调用libvirt接口创建虚拟机。Step S201: Create a virtual machine pod, schedule an adapted node to run the created virtual machine pod, allocate an idle GPU device to the virtual machine pod, update the corresponding node GPU device custom resources, and call the libvirt interface to create a virtual machine.

作为可选的示例,本实施例中,虚拟机管理组件创建虚拟机pod,虚拟机调度组件在检测到创建的虚拟机pod时,查询当前K8s集群内所有的节点GPU设备自定义资源,从GPU设备自定义资源中过滤获得满足虚拟机pod所需GPU设备资源的节点。As an optional example, in this embodiment, the virtual machine management component creates a virtual machine pod. When the virtual machine scheduling component detects the created virtual machine pod, it queries all the node GPU device custom resources in the current K8s cluster, and filters from the GPU device custom resources to obtain nodes that meet the GPU device resources required by the virtual machine pod.

在过滤获得满足虚拟机pod所需GPU设备资源的节点后,虚拟机调度组件为过滤获得的节点进行适配度评分,采用适配度评分最高的节点运行虚拟机pod,向节点GPU设备自定义资源控制器组件发送GPU设备申请请求。举例来说,本实施例通过调度器打分插件为过滤获得的节点打分,选择得分最高的的节点用于运行虚拟机pod。After filtering to obtain nodes that meet the GPU device resources required by the virtual machine pod, the virtual machine scheduling component scores the fitness of the filtered nodes, uses the node with the highest fitness score to run the virtual machine pod, and sends a GPU device application request to the node GPU device custom resource controller component. For example, in this embodiment, the scheduler scoring plug-in scores the nodes obtained by filtering, and selects the node with the highest score to run the virtual machine pod.

节点GPU设备自定义资源控制器组件接收到虚拟机调度组件发送的GPU设备申请请求后,将空闲的GPU设备分配给虚拟机pod。节点GPU设备自定义资源控制器组件更新对应的节点GPU设备自定义资源,虚拟机管理组件根据更新的节点GPU设备自定义资源调用libvirt接口创建虚拟机。After receiving the GPU device application request sent by the virtual machine scheduling component, the node GPU device custom resource controller component allocates the idle GPU device to the virtual machine pod. The node GPU device custom resource controller component updates the corresponding node GPU device custom resources, and the virtual machine management component calls the libvirt interface to create a virtual machine based on the updated node GPU device custom resources.

举例来说,本实施例中,节点GPU设备自定义资源控制器组件更新对应的节点GPU设备自定义资源中的GPU设备分配信息;虚拟机管理组件通过查询节点GPU设备自定义资源中更新后的GPU设备分配信息,获取分配给虚拟机pod的GPU设备的pci地址信息,将获取的pci地址信息作为参数传递给libvirt接口,调用libvirt接口创建虚拟机。需要注意的是,本实施例方法中,节点GPU设备自定义资源上记录着节点上所有的GPU设备使用情况,当空闲的GPU设备被分配给虚拟机pod时,节点GPU设备自定义资源控制器组件更新节点GPU设备自定义资源,将分配出去的GPU设备由空闲状态改成占用状态。For example, in this embodiment, the node GPU device custom resource controller component updates the GPU device allocation information in the corresponding node GPU device custom resource; the virtual machine management component obtains the PCI address information of the GPU device allocated to the virtual machine pod by querying the updated GPU device allocation information in the node GPU device custom resource, passes the obtained PCI address information as a parameter to the libvirt interface, and calls the libvirt interface to create a virtual machine. It should be noted that in the method of this embodiment, the node GPU device custom resource records the usage of all GPU devices on the node. When an idle GPU device is allocated to a virtual machine pod, the node GPU device custom resource controller component updates the node GPU device custom resource and changes the allocated GPU device from an idle state to an occupied state.

步骤S202:通过查询节点GPU设备自定义资源中的GPU设备分配信息,为创建的虚拟机分配一个空闲的GPU设备,并为创建的虚拟机热添加GPU设备。Step S202: allocate an idle GPU device to the created virtual machine by querying the GPU device allocation information in the node GPU device custom resource, and hot-add the GPU device to the created virtual machine.

作为可选的示例,本实施例方法中,虚拟机管理组件在收到用户的GPU设备热添加指令后,向节点GPU设备自定义资源控制器组件发送GPU设备申请请求;节点GPU设备自定义资源控制器组件接收到虚拟机管理组件发送的GPU设备申请请求后,查询节点GPU设备自定义资源中的GPU设备分配信息,根据GPU设备分配信息为创建的虚拟机分配一个空闲的GPU设备,更新对应的节点GPU设备自定义资源中的GPU设备分配信息;虚拟机管理组件查询节点GPU设备自定义资源中更新的GPU设备分配信息,根据更新的GPU设备分配信息调用libvirt pci设备热添加接口为创建的虚拟机热添加GPU设备。As an optional example, in the method of this embodiment, after receiving the user's GPU device hot-add instruction, the virtual machine management component sends a GPU device application request to the node GPU device custom resource controller component; after receiving the GPU device application request sent by the virtual machine management component, the node GPU device custom resource controller component queries the GPU device allocation information in the node GPU device custom resources, allocates an idle GPU device to the created virtual machine according to the GPU device allocation information, and updates the GPU device allocation information in the corresponding node GPU device custom resources; the virtual machine management component queries the updated GPU device allocation information in the node GPU device custom resources, and calls the libvirt pci device hot-add interface according to the updated GPU device allocation information to hot-add the GPU device to the created virtual machine.

步骤S203:通过调用libvirt pci设备热卸载接口卸载添加至虚拟机的GPU设备,更新卸载GPU设备的虚拟机所在节点对应的节点GPU设备自定义资源。Step S203: uninstall the GPU device added to the virtual machine by calling the libvirt pci device hot uninstall interface, and update the node GPU device custom resource corresponding to the node where the virtual machine where the GPU device is uninstalled is located.

作为可选的示例,虚拟机管理组件在收到用户的GPU设备热卸载指令后,调用libvirt pci设备热卸载接口卸载添加至虚拟机的GPU设备;虚拟机管理组件接收到libvirt pci设备热卸载接口返回的卸载成功信息后,向节点GPU设备自定义资源控制器组件发送GPU设备释放请求;节点GPU设备自定义资源控制器组件接收到虚拟机管理组件发送的GPU设备释放请求后,更新卸载GPU设备的虚拟机所在节点对应的节点GPU设备自定义资源中的GPU设备分配信息。As an optional example, after receiving the user's GPU device hot uninstall instruction, the virtual machine management component calls the libvirt pci device hot uninstall interface to uninstall the GPU device added to the virtual machine; after receiving the uninstall success information returned by the libvirt pci device hot uninstall interface, the virtual machine management component sends a GPU device release request to the node GPU device custom resource controller component; after receiving the GPU device release request sent by the virtual machine management component, the node GPU device custom resource controller component updates the GPU device allocation information in the node GPU device custom resource corresponding to the node where the virtual machine that uninstalled the GPU device is located.

在实际应用中,本实施例的云原生虚拟机GPU设备热插拔管理方法和系统,不再使用Device Plugin完成GPU设备的分配与管理,而是通过云原生方式实现一套代码完成不同厂商、不同类型GPU设备的分配与管理,基于Kubernetes Scheduler Framework框架完成虚拟机Pod的调度与分配。In actual applications, the cloud-native virtual machine GPU device hot-swap management method and system of this embodiment no longer uses Device Plugin to complete the allocation and management of GPU devices. Instead, a set of codes is implemented in a cloud-native manner to complete the allocation and management of GPU devices of different manufacturers and types, and the scheduling and allocation of virtual machine Pods are completed based on the Kubernetes Scheduler Framework framework.

本实施例的云原生虚拟机GPU设备热插拔管理方法和系统,实现了对GPU设备的在线分配,实现虚拟机GPU设备的热添加和热卸载,卸载而重启虚拟机带来的业务中断,提高GPU设备的利用率和业务的持续性。The cloud-native virtual machine GPU device hot-swap management method and system of this embodiment realizes online allocation of GPU devices, hot addition and hot uninstallation of virtual machine GPU devices, and eliminates business interruptions caused by uninstalling and restarting virtual machines, thereby improving GPU device utilization and business continuity.

如图4所示,本发明还提供了一种设备,包括处理器310、通信接口320、用于存储处理器可执行计算机程序的存储器330及通信总线340。其中,处理器310、通信接口320及存储器330通过通信总线340完成相互间的通信。处理器310通过运行可执行计算机程序以实现上述的云原生虚拟机GPU设备热插拔管理方法。As shown in FIG4 , the present invention further provides a device, including a processor 310, a communication interface 320, a memory 330 for storing a processor executable computer program, and a communication bus 340. The processor 310, the communication interface 320, and the memory 330 communicate with each other through the communication bus 340. The processor 310 implements the above-mentioned cloud native virtual machine GPU device hot plug management method by running the executable computer program.

其中,存储器330中的计算机程序可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-OnlyMemory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。Among them, the computer program in the memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

以上所描述的系统实施例仅仅是示意性的,其中作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以基于实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。The system embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected based on actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分的方法。Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM/RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

CN202410503939.3A2024-04-252024-04-25 A cloud-native virtual machine GPU device hot-swap management method and systemPendingCN118312276A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202410503939.3ACN118312276A (en)2024-04-252024-04-25 A cloud-native virtual machine GPU device hot-swap management method and system

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202410503939.3ACN118312276A (en)2024-04-252024-04-25 A cloud-native virtual machine GPU device hot-swap management method and system

Publications (1)

Publication NumberPublication Date
CN118312276Atrue CN118312276A (en)2024-07-09

Family

ID=91725357

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202410503939.3APendingCN118312276A (en)2024-04-252024-04-25 A cloud-native virtual machine GPU device hot-swap management method and system

Country Status (1)

CountryLink
CN (1)CN118312276A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN119718993A (en)*2024-12-122025-03-28浙江大学GPU hot plug method based on Kubernetes architecture and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN107368353A (en)*2017-07-262017-11-21郑州云海信息技术有限公司A kind of method and apparatus for realizing virutal machine memory heat addition
CN112667347A (en)*2020-09-242021-04-16紫光云技术有限公司Method for transmitting GPU (graphics processing Unit) to cloud host for use in public cloud scene
CN116860391A (en)*2023-06-302023-10-10鹏城实验室GPU computing power resource scheduling method, device, equipment and medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN107368353A (en)*2017-07-262017-11-21郑州云海信息技术有限公司A kind of method and apparatus for realizing virutal machine memory heat addition
CN112667347A (en)*2020-09-242021-04-16紫光云技术有限公司Method for transmitting GPU (graphics processing Unit) to cloud host for use in public cloud scene
CN116860391A (en)*2023-06-302023-10-10鹏城实验室GPU computing power resource scheduling method, device, equipment and medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN119718993A (en)*2024-12-122025-03-28浙江大学GPU hot plug method based on Kubernetes architecture and readable storage medium

Similar Documents

PublicationPublication DateTitle
CN111385114B (en)VNF service instantiation method and device
US20230026690A1 (en)Method and system to place resources in a known state to be used in a composed information handling system
CN103064742B (en)A kind of automatic deployment system and method for hadoop cluster
CN103593242B (en)Resource sharing control system based on Yarn frameworks
CN103810023B (en)The intelligent deployment method of Distributed Application and system in a kind of cloud platform
CN103049334B (en)A kind of method of task process and virtual machine
US20190095243A1 (en)Virtual Machine Migration Method and Apparatus, and Virtualization System
CN111741134A (en) A system and method for rapid construction of virtual machines in large-scale scenes of network shooting range
CN111092921B (en) Data acquisition method, device and storage medium
CN113867889B (en)Distributed real-time simulation platform
TW201434300A (en)Service migration across cluster boundaries
JP2024501005A (en) Management method and device for container clusters
WO2022267646A1 (en)Pod deployment method and apparatus
WO2018191849A1 (en)Cloud management platform, virtual machine management method and system thereof
CN114003346B (en) Task processing method, device, storage medium and program product
CN110297670A (en)A kind of method and system improving distributed task scheduling training effectiveness on container cloud
CN105404530B (en)It is a kind of to realize easy deployment and the system and method using private clound
CN118312276A (en) A cloud-native virtual machine GPU device hot-swap management method and system
CN111786810A (en) A method and system for automatic deployment of large-scale test bed nodes
CN113848752B (en)Distributed real-time simulation method
CN115202820A (en) Pod unit creation method, apparatus, device and storage medium
CN119718547A (en)Virtual machine QEMU program hot upgrading method, system and equipment
CN110300192B (en)Method for updating distributed training task connection parameters according to IP distribution table
CN118733275A (en) A server partition migration method, system, device and storage medium
CN117931379A (en)Cluster deployment method, device, system, equipment and medium for edge computing

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination

[8]ページ先頭

©2009-2025 Movatter.jp