Method, device, equipment, storage medium and program for operating virtual machine
By receiving natural language instructions, generating structured operation commands using a large language model, and monitoring the execution process, the system solves the problems of low efficiency and low security in enterprise-level virtual machine management, and achieves flexible and intelligent virtual machine lifecycle management.
Patent Information
- Application Number
- CN202510935907.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-08
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2045-07-08
AI Technical Summary
Enterprise-level virtual machine management scenarios suffer from inefficient lifecycle management and low security, and existing technologies are insufficient to meet the intelligent and compliant requirements of complex operations.
By receiving natural language instructions, semantic parsing is performed using a large language model trained with deep learning technology to generate structured operation commands. During execution, abnormal data is monitored and rolled back to ensure the stability of the virtual machine state.
It improves the flexibility and intelligence of virtual machine management, enhances the accuracy and security of operations, and solves the limitations of enterprise-level virtual machine management.
Smart Images

Figure CN120429068B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of virtual machine technology, and more specifically, to a method, apparatus, device, storage medium, and program for operating and managing a virtual machine. Background Art
[0002] With the rapid development of cloud computing technology, enterprises are increasingly demanding virtual machine management, especially in large-scale data center environments. Virtual machine management involves numerous stages of the virtual machine lifecycle, including creation, startup, shutdown, configuration, migration, snapshots, recovery, and destruction. Traditionally, these operations are performed through the Command Line Interface (CLI) or Graphical User Interface (GUI), requiring administrators to possess technical knowledge and familiarity with specific command syntax and operational procedures. For example, on enterprise-level virtualization platforms, creating and managing virtual machines typically requires administrators to be proficient in calling specific Application Programming Interfaces (APIs) through the CLI or completing complex, multi-step configuration operations in a graphical interface. Furthermore, related technologies are still underdeveloped in terms of permission management and operation approval, making it difficult to meet enterprise-level security and compliance requirements. The conversion of natural language commands into structured parameter sets often relies on complete user-provided information, lacking intelligent parameter completion and dynamic interaction capabilities. This results in high operation failure rates and a poor user experience. Fault recovery and diagnostic capabilities are also insufficient.
[0003] There are obvious limitations in enterprise-level virtual machine management scenarios in related technologies, which lead to low efficiency and low security in virtual machine lifecycle management. No effective solution has been proposed yet. Summary of the Invention
[0004] The embodiments of the present application provide a method, apparatus, device, storage medium and program for virtual machine operation management, so as to at least solve the obvious limitations in enterprise-level virtual machine management scenarios in related technologies, resulting in low efficiency and low security of virtual machine lifecycle management.
[0005] According to one embodiment of the present application, a method for operating and managing a virtual machine is provided, comprising: receiving a first control instruction for operating the virtual machine issued by a target object, parsing the first control instruction, and obtaining a first operation command, wherein the first control instruction is a natural language instruction for controlling the life cycle of the virtual machine based on a natural language, and the first operation command is an executable virtual machine operation command converted from the natural language instruction; when the first operation command enters execution, monitoring the execution process of the first operation command to obtain a plurality of process data; identifying abnormal data in the plurality of process data, rolling back the process data from the time point when the abnormal data occurs to a time state node before the abnormality occurs according to a predetermined rule, and re-starting to operate and manage the virtual machine based on the target process data corresponding to the time state node.
[0006] According to another embodiment of the present application, an operation and management device for a virtual machine is provided, including: a parsing module for receiving a first control instruction for operating the virtual machine issued by a target object, parsing the first control instruction, and obtaining a first operation command, wherein the first control instruction is a natural language instruction based on natural language for controlling the life cycle of the virtual machine, and the first operation command is an executable virtual machine operation command converted from the natural language instruction; a monitoring module for monitoring the execution process of the first operation command when the first operation command enters execution, and obtaining a plurality of process data; a management module for identifying abnormal data in the plurality of process data, rolling back the process data from the time point when the abnormal data occurs to the time status node before the abnormality occurs according to a predetermined rule, and re-starting to operate and manage the virtual machine based on the target process data corresponding to the time status node.
[0007] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when run.
[0008] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0009] According to another embodiment of the present application, a computer program product is provided, including a computer program, which implements the steps of any of the above method embodiments when executed by a processor.
[0010] This application first receives virtual machine operation instructions expressed in natural language from a target user (such as a cloud platform administrator). Using a large language model trained with deep learning technology, the system performs semantic parsing on these natural language instructions, identifying the operation intent and operation object. Based on the parsing results, the system then generates a corresponding first operation command with a clear operation type and parameters. Once the first operation command is ready, the system calls the virtual machine management platform's API to execute the command. During command execution, the system continuously monitors the execution process and collects process data, such as changes in the virtual machine's power state, CPU and memory usage, and network traffic. By analyzing this collected process data, the system identifies any abnormal data that deviates from normal operating conditions, such as virtual machine startup failures and resource exhaustion. When abnormal data is detected, the system can roll back the virtual machine state to the most recent stable state node before the abnormality, based on a preset rollback strategy. For example, if a startup operation fails due to insufficient resources, the system can automatically roll back the virtual machine state to the shutdown state, re-evaluate the resource allocation plan based on the rolled-back state, and attempt to restart the machine. The above solution improves the flexibility of virtual machine management, enhances the level of operation and maintenance intelligence, and solves the obvious limitations in enterprise-level virtual machine management scenarios, which lead to inefficient and low-security virtual machine lifecycle management. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0012] Figure 1 This is a hardware structure block diagram of a server device for a method for operating and managing a virtual machine according to an embodiment of the present application;
[0013] Figure 2 is a flowchart of a method for operating and managing a virtual machine according to an embodiment of the present application;
[0014] Figure 3 Schematic diagram of the architecture of a virtual machine operation and management system according to an embodiment of the present application;
[0015] Figure 4 This is a structural block diagram of an operation management system for a virtual machine according to an embodiment of the present application;
[0016] Figure 5 is a block diagram of a computer system structure of an electronic device according to an embodiment of the present application;
[0017] Among them, 102 in the above figure is a processor, 104 is a memory, 106 is a transmission device, 108 is an input and output device, 42 is a parsing module, 44 is a monitoring module, 46 is a management module, 800 is a computer system, 801 is a CPU, 802 is a ROM, 803 is a RAM, 804 is a bus, 805 is an I / O interface, 806 is an input part, 807 is an output part, 808 is a storage part, 809 is a communication part, 810 is a drive, and 811 is a removable medium. DETAILED DESCRIPTION
[0018] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0019] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0020] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0021] As an optional implementation method, the method embodiment provided in the embodiment of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 This is a hardware structure diagram of a server device for a method of operating and managing a virtual machine according to an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a microprocessor, a central processing unit, or a processing device such as a programmable logic device FPGA (Field-Programmable Gate Array, FPGA)) and a memory 104 for storing data. The server device may also include a transmission device 106 and an input / output device 108 for communication functions. It will be understood by those skilled in the art that Figure 1The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0022] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for operating and managing a virtual machine in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above-mentioned method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to a server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0023] Transmission device 106 is used to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by a communication provider of the server device. In one embodiment, transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0024] Optionally, in order to better understand the technical solution of the present application, the terms involved in the present application are explained, but this does not limit the present application.
[0025] Model Context Protocol (MCP), a protocol framework for connecting large language models with enterprise systems.
[0026] Large Language Model (LLM) is an AI model used for natural language understanding, parameter generation, and dialogue management.
[0027] Cloud Management Platform (CMP) is a unified management platform for data center resources.
[0028] This application implements virtual machine lifecycle management for an enterprise-level virtualization system (Incloud Sphere).
[0029] Lifecycle control semantic model (Plan-Act-Recover): The lifecycle control semantic model proposed in this application includes three stages: planning, execution, and recovery.
[0030] Retrieval Augmented Generation (RAG) is a technique that enhances LLM output by retrieving relevant information from a knowledge base.
[0031] Identity and Access Management (IAM) is used to control user permissions for virtual machine operations.
[0032] The operation identifier (operate-Identity, OP_ID) is a generated unique identifier used to ensure the idempotence of virtual machine operations.
[0033] Copilot: Embedded in the CMP interface, it serves as an implementation of the Model Context Protocol Host (MCP Host).
[0034] VM (Virtual Machine) lifecycle state context: A core data structure maintained by the Model Context Protocol Client (MCP Client) that records the VM ID, power state, snapshot information, and operation status.
[0035] In this embodiment, a method for operating and managing a virtual machine is provided. Figure 2 is a flow chart of a method for operating and managing a virtual machine according to an embodiment of the present application. Figure 2 As shown, the process includes the following steps:
[0036] Step S202: receiving a first control instruction for operating a virtual machine issued by a target object, parsing the first control instruction to obtain a first operation command, wherein the first control instruction is a natural language instruction for controlling the life cycle of the virtual machine based on a natural language, and the first operation command is an executable virtual machine operation command converted from the natural language instruction;
[0037] Step S204: When the first operation command enters execution, monitor the execution process of the first operation command to obtain a plurality of process data;
[0038] Optionally, once the first operation command is ready, it will enter the execution and monitoring phase to ensure that the instructions can be executed safely and smoothly, collect key data during the execution process, and call the API provided by the cloud management platform (CMP) or virtualization environment to execute the first operation command. For example, for the power_on command mentioned above, the startup interface of the corresponding virtual machine will be called directly. During the execution of the operation command, the execution status is continuously monitored and a series of process data is collected. This data may include changes in the state of the virtual machine (for example, from the shutdown state to the startup state), resource usage (such as CPU, memory usage), network activity (such as data transmission rate), operation time, etc. Real-time acquisition of monitoring data helps to detect problems in a timely manner and provide a basis for possible exception handling in the later stage.
[0039] Step S206, identifying abnormal data in multiple process data, rolling back the process data from the time point when the abnormal data occurred to the time state node before the abnormality occurred according to a predetermined rule, and re-starting operation management of the virtual machine based on the target process data corresponding to the time state node.
[0040] Optionally, if any abnormal conditions are detected during the execution and monitoring process, immediate action is taken to ensure the stability and security of the virtual machine. By analyzing process data, abnormal conditions encountered during operation execution can be identified, such as operation failures, resource limits exceeded, network failures, and image corruption. Once an abnormality is identified, the virtual machine's state is rolled back to the most recent stable state before the abnormality occurred (i.e., the time state node) based on pre-set exception handling rules. For example, if an abnormality occurs during a virtual machine migration, the virtual machine state may be rolled back to the state before the migration to prevent the virtual machine from being in an uncertain or unstable state. After rolling back to the previous stable state, operations are re-evaluated and executed based on the rolled-back state. For example, if a virtual machine fails to start due to insufficient resources, the startup operation may be retried after resources are released or expanded. This mechanism ensures the continuity and robustness of virtual machine operations, allowing for a rapid return to normal operation even in the event of an unexpected situation through intelligent recovery strategies.
[0041] The method first receives virtual machine operation instructions expressed in natural language from a target user (e.g., a cloud platform administrator). Using a large language model trained using deep learning technology, the system performs semantic parsing on these natural language instructions, identifying the operation intent and the operation object. Based on the parsed results, the system then generates a corresponding first operation command with a clear operation type and parameters. Once the first operation command is ready, the system calls the virtual machine management platform's API to execute the command. During command execution, the system continuously monitors the execution process, collecting process data such as virtual machine power state changes, CPU and memory usage, and network traffic. The system analyzes this collected process data to identify any abnormal data that deviates from normal operation, such as virtual machine startup failures and resource exhaustion. When abnormal data is detected, the system can roll back the virtual machine state to the most recent stable state before the abnormality, based on a pre-set rollback strategy. For example, if a startup operation fails due to insufficient resources, the system can automatically roll back the virtual machine state to the shutdown state, re-evaluate resource allocation based on the rolled-back state, and attempt to restart the machine. The above solution improves the flexibility of virtual machine management, enhances the level of operation and maintenance intelligence, and solves the obvious limitations in enterprise-level virtual machine management scenarios, which lead to inefficient and low-security virtual machine lifecycle management.
[0042] In an exemplary embodiment, parsing a first control instruction to obtain a first operation command includes: performing preliminary semantic decomposition of the first control instruction using a large language model; wherein the large language model is a trained model for interacting with a target and identifying intent contained in the control instruction; determining the operation type and operation parameters required by the target object to control the virtual machine based on the preliminary semantic decomposition result; and generating the first operation command based on the operation type and operation parameters.
[0043] In the above embodiment, a pre-trained Large Language Model (LLM) performs deep natural language understanding on the first control instruction input by the user. The LLM, trained on extensive text data, possesses the ability to recognize and parse human language, which is particularly critical for processing natural language instructions. For example, a user might say, "Start the virtual machine named web-server." The LLM needs to understand that "start" is an action instruction and "web-server" is the name of the virtual machine. These two are the core information in the first control instruction. After completing preliminary semantic decomposition, it can identify the type of operation the user intends to perform, such as "start" in the above example, and its associated key parameters, namely the name of the virtual machine "web-server." These operation types cover various basic operations in the virtual machine lifecycle, such as startup, shutdown, capacity expansion, and snapshot creation. Parameters include, but are not limited to, the virtual machine ID, operation target (such as memory size), time point, and snapshot ID. Based on the determined operation type and parameters, a structured first operation command is then constructed. This is typically a specific request that complies with the cloud platform or virtualization environment API specification. The generation of the first operation command ensures accurate interaction with the underlying virtual machine management service and executes the user's true intent.
[0044] Throughout this process, the interaction between the Large Language Model (LLM) and the user is crucial. The LLM not only understands the literal meaning of commands but also infers the underlying intent. For example, "creating a new development environment virtual machine" likely means selecting a specific image, allocating resources, and configuring the appropriate network environment. Based on the LLM's understanding, precise operation commands can be generated, taking into account cloud environment characteristics such as resource quotas and network policies to ensure feasibility and security.
[0045] In short, the initial semantic decomposition through a large language model, identification of operation types and parameters, and generation of structured first operation commands constitute an intelligent conversion process for natural language control of the virtual machine life cycle, which not only improves the user experience, but also ensures the accuracy of operations and security at all levels.
[0046] In an exemplary embodiment, after determining the operation type and operation parameters that the target object needs to control the virtual machine based on the preliminary semantic decomposition results, the above method also includes: when it is determined that the preliminary semantic decomposition results have semantic ambiguity and / or the operation parameters are missing, guiding the large language model to interact with the target object by asking clarifying questions; and performing semantic ambiguity elimination and parameter completion processing on the preliminary semantic decomposition results based on the interactive feedback information.
[0047] In this embodiment, the user's natural language control instructions are first analyzed through preliminary semantic decomposition to understand their basic intent and parameters. However, natural language expressions are often ambiguous or parameters may be incomplete. For example, a user may simply say, "Start that server." In this case, the LLM requires further clarification to accurately identify the virtual machine being referred to and the specific operation the user desires. If the initial analysis results indicate semantic ambiguity or missing operation parameters, the MCP Client does not attempt to perform the operation directly. Instead, the LLM uses natural language to ask clarifying questions to the user to resolve ambiguity and complete the missing parameters. For example, the LLM might ask, "Which server are you referring to? Can you tell me its name?" or "What operation do you want to perform on this server, start or restart?" This interactive process is multi-round, and the LLM can continuously refine its understanding based on the user's answers until all semantic ambiguities are resolved and all necessary parameters are completed. For example, if the user responds, "I want to start web-server-01," the LLM will confirm that web-server-01 is the target virtual machine and determine the operation type as "start." During the parameter completion process, LLM may need to further confirm the user's operational intent or details, such as the VM's power status, image version, and network configuration. It automatically adjusts the questions based on the parameters being completed to cover as much detail as possible. For example, if the user's instruction "Create a VM" doesn't mention specific configurations, LLM will ask, "Which image do you intend to use to create the VM? How much CPU and memory do you need?" This allows LLM to intelligently adjust its questioning strategy based on user input and the requirements of the current MCP Tool Schema. This ensures that all required parameters are fully collected, and the operation is only allowed when all parameters meet the conditions for calling the MCP Server.
[0048] In summary, the system can deeply analyze natural language-based virtual machine control instructions. Even if the initial instructions are semantically ambiguous or parameters are missing, it can dynamically complete the parameters through intelligent interaction with the user, eliminate ambiguity, and ultimately generate accurate and secure operation commands. This process not only improves operational accuracy and efficiency, but also greatly enhances the user experience when using the virtualization management platform.
[0049] In an exemplary embodiment, before performing semantic ambiguity elimination and parameter completion processing on the preliminary semantic decomposition results based on the interactive feedback information, the above method also includes: sending query information to the server associated with the virtual machine; wherein the query information is used to determine the resource status information that the cloud management platform allows the server to provide to the virtual machine and the control permissions allowed for different objects of the virtual machine; receiving feedback results corresponding to the query information; and determining whether the first control instruction issued by the target object is a valid instruction based on the feedback results.
[0050] Optionally, a query is sent to the server associated with the target virtual machine (which may be an MCP server or a component in the CMP responsible for resource management) to obtain information about the resource status that the cloud platform currently allows for the virtual machine. This may include the virtual machine's current configuration (such as allocated CPU and memory), remaining available resources (such as unallocated storage space), and any constraints or restrictions related to virtual machine operations (such as tenant resource quotas, resource usage rules within a specific time period, etc.). In addition to resource status, it is also necessary to determine the control permissions of different users or objects over the virtual machine. This means initiating a query to the identity authentication and access control module (IAM) of the cloud management platform (CMP) to confirm whether the target object (i.e., the user issuing the control instruction) has the permission to perform the requested operation (such as power on, power off, and capacity expansion). This step ensures that only authorized users can modify the virtual machine.
[0051] The system then receives feedback from the query information, which comes from the cloud platform's internal resource management and permission control components. Based on this feedback, it can determine whether the first control instruction issued by the target object is valid. For example, it can evaluate whether the user's requested operation complies with resource allocation rules, that is, whether creating a new virtual machine will cause resource quotas to exceed. Another example is verifying whether the user has permission to perform the requested operation, such as whether the user has been granted permission to shut down a specific virtual machine.
[0052] If the query results indicate that the resource status meets the operational requirements and the target object has permission to perform the specific operation, the first control instruction is considered valid and subsequent semantic disambiguation and parameter completion processing will proceed. Conversely, if resources are insufficient or permission verification fails, the current processing flow will be terminated and an error message will be returned to the user, informing them of the reason for the instruction failure, which may be due to the resource quota being reached or the user not having permission to perform the operation.
[0053] In summary, the query and confirmation process described above serves as a security measure before any operation is executed. It ensures that resource status and user permissions are verified before natural language instructions are translated into specific operation commands. Through in-depth interaction with the cloud management platform, this not only prevents invalid or illegal VM operations but also mitigates resource waste and security risks to a certain extent. This provides an additional layer of security and compliance for natural language control throughout the VM lifecycle, ensuring a safe and controllable operation process.
[0054] In an exemplary embodiment, determining whether the first control instruction is a valid instruction based on the feedback result includes: when the feedback result indicates that the target object does not have the operating authority, determining that the first control instruction is an invalid instruction, and sending an operation prompt message of insufficient authority to the target object; when the feedback result indicates that the target object has the operating authority, determining that the first control instruction is a valid instruction, and configuring the available resources of the virtual machine according to the resource status information.
[0055] First, the permission information for the target object (i.e., the user issuing the instruction) in the feedback result is checked. If the permission information indicates that the target object does not have permission to perform a specific operation (such as starting or shutting down a virtual machine), the first control instruction is immediately deemed invalid. Subsequently, a permission-inadequate operation prompt is sent to the target object, informing the user that they do not have permission to perform the requested operation. This prompt not only enhances interactivity but also provides clear feedback, helping users understand why the instruction was not processed and possible subsequent actions, such as requesting permission or contacting an administrator. The resource status information in the feedback result is further analyzed. This information includes the current resource allocation of the cloud platform, the configuration status of the target virtual machine, and the resource limits associated with the operation (such as tenant quotas). If the resource status information confirms that the target object has permission to perform the operation and the current resource conditions allow the operation (for example, sufficient free storage space, CPU, and memory resources), the first control instruction is deemed valid. Once the first control instruction is confirmed to be valid, the virtual machine's available resources are configured based on the resource status information in the feedback result. For example, if a user requests to create a new virtual machine, we must ensure that: the user's tenant quota has not been exceeded; the new virtual machine's configuration (CPU, memory, storage) is within the platform's resource limits; and the selected image and network configuration are available. Based on these conditions, we allocate specific resources to the virtual machine, including but not limited to the number of CPU cores, memory size, storage type, network interfaces, etc., to ensure that the creation or operation of the virtual machine meets both user needs and complies with the platform's resource management and security policies.
[0056] Through the above process, permission verification and resource status checks are used to ensure the validity and feasibility of instructions. The instant feedback mechanism for invalid instructions helps users promptly understand the scope of their operational permissions, avoiding invalid operation attempts and improving operational efficiency and user experience. The resource allocation process for valid instructions ensures the rationality and security of resource allocation, avoiding resource waste and potential instability.
[0057] In an exemplary embodiment, after parsing the first control instruction and obtaining the first operation command, the above method also includes: if the first operation command contains an approval identifier, sending an approval request prompt message to the target object; receiving approval parameters added by the target object based on the approval request prompt message; generating an operation approval work order based on the approval parameters and the first operation command; and determining whether to continue executing the first operation command based on the approval result of the operation approval work order by the approval object.
[0058] If an approval flag is detected, an approval request prompt is sent to the target entity (i.e., the user). This prompt typically consists of a natural language message explaining the nature of the operation, its potential impact, and why approval is required. Additionally, based on the operation type and cloud platform policies, the user may be asked to provide additional approval parameters. These parameters may include the justification for the operation, the expected business value, and a potential risk assessment, helping the approver fully understand the context and necessity of the operation. Once the necessary approval parameters are collected, an operation approval ticket is generated based on these parameters and the first operation command. A ticket is a document used within the cloud platform to request, approve, and record a specific operation. It contains a detailed description of the operation, the identity of the requester, the reason for the request, and any relevant risk assessments and plans. The ticket then enters the CMP's approval process, which may involve multiple levels of review, such as approval by the immediate supervisor, department head, finance department, or security team, until all approval nodes are met. During the approval process, each approval node has the authority to review and approve or reject the request. Once all approvers have approved the ticket, the first operation command is confirmed as eligible for execution. This means that even operations derived through natural language parsing will not be executed unless all necessary approvals are obtained. This mechanism ensures the compliance and security of high-risk operations and prevents unauthorized changes from adversely affecting the cloud environment.
[0059] In summary, the introduction of an approval process in VM lifecycle management is crucial for ensuring the legitimacy of operations, the proper allocation of resources, and security. This not only prevents inappropriate resource consumption or configuration changes, but also provides traceability and accountability for operations, ensuring that all major decisions are made in a transparent and controlled environment. This approval mechanism establishes a closed-loop control loop from user natural language input to operation execution, effectively balancing intelligent operations with standardized enterprise-level governance. This process embodies the close integration of natural language processing, permission control, and approval processes.
[0060] In an exemplary embodiment, before receiving a first control instruction for operating a virtual machine issued by a target object, parsing the first control instruction, and obtaining a first operation command, the above method further includes: determining multiple operation actions supported by the virtual machine; registering the multiple operation actions as multiple basic functions in a protocol framework server connecting the virtual machine and the cloud management platform, wherein each basic function includes target parameters of the operation action, required parameters of the operation action, and return status of the operation action; and using multiple basic functions to support mapping processing of the first control instruction.
[0061] In this embodiment, it is first necessary to define the various lifecycle operations that a virtual machine can perform. These operations may include, but are not limited to, creation, startup, shutdown, deletion, snapshot creation and restoration, configuration modification, and migration. Determining this series of operations is fundamental to building natural language control capabilities, as each operation corresponds to different parameter requirements and execution logic. To enable the Large Language Model (LLM) to understand and execute these operations, these operations are registered as multiple basic functions in the Model Context Protocol framework server (Model Context Protocol), which connects the virtual machine to the cloud management platform. The definition of each basic function includes: the target parameter of the operation, which is directly related to the result of the specific operation, such as the ID of the created virtual machine and the power state of the virtual machine (on or off); the required parameters of the operation, which are parameters that need to be collected before executing the operation, such as the number of CPU cores required for virtual machine creation, the memory size, the image ID to be used, or the target host ID for virtual machine migration; and the return status of the operation, which is a status code or message returned after the function execution, which informs the caller (e.g., the MCP client) whether the operation was successful and the reason for failure. This status may include successful operation, insufficient resources, restricted permissions, or failed operation. With the above basic function descriptions, these functions can then be used to map the first control instruction issued by the user. When a user expresses a virtual machine operation request through natural language, for example, "Start the virtual machine named web-server," the LLM will parse this instruction, identify the intended power-on operation, and attempt to map this intent to a pre-registered basic function. Specifically, it will find the basic function corresponding to the "power-on" operation and check whether the instruction provides the necessary parameters (such as the virtual machine ID). If not, the LLM will query the user to complete the "required parameters." The accuracy of the mapping process depends on the LLM's powerful natural language understanding capabilities and the completeness of the predefined basic function descriptions. Through this mechanism, the LLM can accurately convert the user's natural language instructions into a function call format understandable to the cloud management platform server MCP Server, ensuring the intelligence and accuracy of the operation.
[0062] Through this implementation, a series of basic functions are registered and described before natural language-based virtual machine control instructions are parsed and executed, ensuring that the LLM understands and executes the correct operations. By mapping virtual machine lifecycle operations to specific functions, not only can user intent be accurately captured, but parameter collection can also be guided, ensuring the smooth execution of subsequent operations. This also lays the foundation for the approval process for high-risk or sensitive operations.
[0063] In an exemplary embodiment, when the first operation command enters execution, the execution process of the first operation command is monitored, and before obtaining multiple process data, the above method also includes: verifying the operation authority of the target object corresponding to the first operation command; when the verification result indicates that the target object has the authority to execute the first operation command, feeding back the execution start data to the target object; when the verification result indicates that the target object does not have the authority to execute the first operation command, terminating the operation management process and feeding back a prompt message of insufficient authority to the target object.
[0064] Optionally, if the result of the permission check indicates that the target object does have the permission to execute the first operation command, the execution start data will be fed back to the target object. The execution start data may include detailed information about the operation, such as the operation type, virtual machine ID, the amount of resources to be allocated, the expected execution time, etc. This feedback step not only enhances the transparency of the operation, but also allows the user to make a final confirmation before the operation is officially carried out to ensure the accuracy of the instructions and the realization of the intention. However, if the result of the permission check indicates that the target object does not have the permission to execute the first operation command, the subsequent operation management process will be terminated immediately to prevent unauthorized operations from being executed. At this time, a prompt message indicating insufficient permissions will be sent to the target object to clearly inform the user that they do not have permission to perform the requested operation. This message may include detailed permission information and possible resolution steps, such as prompting the user to contact the administrator or apply for a higher permission level.
[0065] This example demonstrates how to verify operational permissions before the first operation command enters the execution phase, ensuring that only authorized users can perform specific virtual machine operations. For authorized users, execution start data is provided, allowing final confirmation. For users with insufficient permissions, the operation process is terminated and a notification message indicating insufficient permissions is displayed. This effectively maintains platform order and security while also improving user experience and operational transparency.
[0066] In an exemplary embodiment, when the first operation command enters execution, the execution process of the first operation command is monitored, and before obtaining multiple process data, the above method also includes: when the first operation command carries a demand quota value, comparing the demand quota value with the remaining quota value; when the demand quota value is greater than the remaining quota value, determining that the resource demand of the first operation command cannot be met and sending a first message to increase the quota to the management object; when the demand quota value is less than or equal to the remaining quota value, determining that the resource demand of the first operation command is met, and sending a second message to the management object indicating that the quota remains unchanged.
[0067] In this exemplary embodiment, when the first operation command is about to enter the execution phase, it is additionally checked to see if it carries a specific required quota value. The required quota value refers to the amount of resources required to execute the command, which may include the number of CPU cores, memory size, storage space, etc. This required quota value is then compared with the current remaining quota value of the target object (usually a user or tenant).
[0068] If the comparison shows that the requested quota value is greater than the remaining quota value, this means that the user or tenant does not have sufficient resource quota to perform the operation. In this case, the resource requirements of the first operation command are determined to be unsatisfactory, and the operation is blocked. Subsequently, a first quota increase message is sent to the management entity (which may be the cloud platform administrator or the automated quota management service), requesting additional resource quota. This message may include detailed resource requirements, the expected business value of the operation, and any relevant policy or approval process information.
[0069] Conversely, if the required quota value is less than or equal to the remaining quota value, this indicates that the user or tenant has sufficient resource quota to perform the operation. The resource requirements of the first operation command are determined to be met, and the operation is allowed to proceed. At this point, a second message is sent to the managed object, indicating that the quota remains unchanged, indicating that no resource quota adjustment is required and the operation can proceed.
[0070] It's important to note that both the first and second messages are designed to ensure the feasibility of the operation and to promptly communicate resource quota status to the managed entity. The first message, requesting a quota increase, may trigger the CMP's internal quota adjustment process, which may include automated approval, manual review, and further interaction with the user to confirm the necessity and specific amount of the quota increase. This process may require the user to provide additional information such as the reason for the request and business demand forecasts. The second message confirms that the operation can be performed within the current quota, streamlining the process and avoiding unnecessary quota adjustments.
[0071] In an exemplary embodiment, the first control instruction includes at least one of the following: creating a virtual machine, powering on a virtual machine, shutting down a virtual machine, restarting a virtual machine, migrating a virtual machine, deleting a virtual machine, extending virtual machine resources, changing virtual machine configuration, creating a virtual machine snapshot, and restoring a virtual machine snapshot.
[0072] In an exemplary embodiment, when an approval identifier exists in the first operation command, before sending an approval request prompt message to the target object, the above method also includes: dynamically setting the approval identifier corresponding to different operation commands according to the preset sensitivity threshold corresponding to different virtual machines or the impact degree of the virtual machine operation; and storing the association relationship between the approval identifier and the operation command in the target database corresponding to the cloud management platform.
[0073] In this exemplary embodiment, the approval requirement for virtual machine operation commands is dynamic, determined based on the VM's sensitivity threshold or the impact of the operation. The sensitivity threshold can reflect the importance of the VM's stored data, the scope of its access rights, and its relevance to critical business processes, while the impact of the operation considers the potential resource changes, performance impact, or security risks that the operation may cause. These indicators are used to dynamically determine whether an approval flag should be set for a particular operation command, specifically whether an additional approval process is required to confirm the execution of the operation. If the VM stores highly sensitive or critical business data, or has broad access rights, high-risk operations involving that VM (such as deletion or large-scale configuration changes) may be automatically flagged for approval to prevent accidental or malicious changes. Operations with wide-ranging impacts that could result in resource reallocation or performance fluctuations (such as batch creation of high-performance VMs or changes to network topology) are also flagged for approval to ensure proper review and approval before execution.
[0074] To ensure rapid and accurate determination of whether an operation command requires approval, the association between the approval flag and the corresponding operation command is stored in the CMP database. This database may include, but is not limited to, the following information: the operation command ID or description, the corresponding approval flag status (whether approval is required), the reason for setting the approval flag and the sensitivity threshold, the scope of the operation's impact, and the expected outcome. The storage and indexing of this information allows the database to be immediately queried upon receiving a user instruction to determine whether the operation requires an approval request prompt, thereby determining whether the subsequent operation should be executed directly or await approval.
[0075] If the first operation command is identified by an approval flag, it means that the operation requires additional review before execution. At this point, an approval request prompt will be sent to the target party (the user issuing the command or the tenant administrator), informing them that approval is required and possibly requesting additional details or explanations, such as the legitimacy of the operation, the expected business value, and potential risks. After receiving the prompt, the user can decide whether to submit the approval request based on their needs and platform policies, and provide the corresponding approval parameters.
[0076] In an exemplary embodiment, the execution process of a first operation command is monitored to obtain multiple process data, including: identifying multiple key steps corresponding to the first operation command; determining the execution timestamp corresponding to each key step in the multiple key steps, and obtaining resource change information caused by the execution of each key step and virtual machine status comparison information before and after the execution of each key step; and determining multiple process data based on multiple key steps, execution timestamps, resource change information, and virtual machine status comparison information.
[0077] First, it's necessary to identify the key steps involved in executing the first operation command. These steps may include, but are not limited to, authentication, permission checks, parameter collection (especially through multiple rounds of user conversations), operation execution, status updates, and result feedback. Each step represents a checkpoint or action point in the operation process and is crucial for ensuring transparency and traceability of command execution. The precise start and end timestamps of each key step are recorded. These timestamps provide a timeline of the operation command execution, facilitating subsequent auditing and troubleshooting. For example, if an anomaly is later discovered during the operation, the timestamp can be used to pinpoint the specific time the anomaly occurred, allowing for faster identification of the issue. For each key step, information is collected on resource changes caused by its execution, such as CPU usage, memory consumption, network traffic, and storage usage. Furthermore, a comparison of the virtual machine's state before and after execution is recorded, including power status, running processes, network configuration, and any snapshot updates. This information not only reflects the immediate impact of the operation but also provides visual evidence of the successful execution of the operation command.
[0078] In summary, based on the key steps, execution timestamps, resource change information, and virtual machine state comparison information collected above, multiple process data can be determined during the execution of the first operation command. Detailed records of process data are extremely important for subsequent audit compliance, fault recovery, and performance analysis. For example, audit logs can use process data to track every step of the operation, ensuring that all operations are carried out within the framework of policies and procedures; fault recovery mechanisms can use process data to identify the specific points of operation failure and provide corresponding recovery strategies; and performance analysis tools can use resource change information and state comparison information to evaluate the impact of operations on performance and optimize resource allocation strategies.
[0079] In an exemplary embodiment, during the execution of the first operation command, the method further includes: when entering an operation waiting state, feeding back waiting state information to the target object; wherein the operation waiting state includes at least one of the following: performing resource preparation for the virtual machine, performing network configuration for the virtual machine.
[0080] In an exemplary embodiment, when entering an operation waiting state, after feeding back the waiting state information to the target object, the above method also includes: when the target object indicates that the waiting state duration needs to be reduced, searching for multiple optimization schemes for optimizing the first operation command from preset data, and calculating the waiting time saved by each optimization scheme; generating an optimization adjustment table corresponding to the first operation command based on multiple optimization schemes and waiting times; and displaying the optimization adjustment table to the target object.
[0081] In an exemplary embodiment, after determining whether there are abnormal data in multiple process data, the above method also includes: if there are no abnormal data in the multiple process data, collecting all data records before the first control instruction is successfully executed; and generating a target operation log for participating in subsequent operation analysis based on all data records.
[0082] In an exemplary embodiment, after starting to re-operate and manage the virtual machine based on the target process data corresponding to the time status node, the above method also includes: recording the number of times the same operation command is re-operated and managed; if the number of management times is greater than a preset number, determining that the virtual machine has a hardware abnormality; if the number of management times is less than or equal to the preset number, allowing the previous operation command to be reused to operate and manage the virtual machine.
[0083] The execution entity of the above steps may be a server, a terminal, etc., but is not limited thereto.
[0084] In order to facilitate understanding of the implementation methods of the present application, relevant scenarios are now explained, but this does not limit the present application.
[0085] As an optional implementation, this optional embodiment proposes a natural language control method and system for virtual machine lifecycles based on the Model Context Protocol. This system, built on a cloud management platform (CMP), performs virtual machine lifecycle management for virtualized systems. Specifically, based on the Model Context Protocol (MCP), the Large Language Model (LLM), and lifecycle semantic modeling, a natural language-driven virtual machine lifecycle management system is constructed for enterprise-level virtualization systems.
[0086] Optionally, the abstraction and function modeling of the virtual machine lifecycle operation capability includes: performing various lifecycle operations on virtual machines in an enterprise-level virtualization system. To clearly illustrate the specific content of this implementation, the following five typical operations are used as examples:
[0087] The first type is to create a virtual machine: a new virtual machine instance is generated in the CMP based on the configuration specified by the user (such as CPU, memory, disk, image, etc.).
[0088] The second type, power on: Start a specified enterprise-level virtualization system virtual machine that is in a shut down state.
[0089] The third type, shutdown: shut down the specified running enterprise-level virtualization system virtual machine.
[0090] Category 4, Delete: Permanently remove the specified enterprise-level virtualization system virtual machine and its associated resources in the CMP.
[0091] Category 5: Migrate to another host: Move the specified virtual machine from the current physical host to another specified physical host in the enterprise-level virtualization system cluster, and you can choose whether to keep the virtual machine running during this period.
[0092] Optionally, each lifecycle operation is registered as a standard function capability in the Model Context Protocol (MCP) Server. This function capability is described not in a specific programming language, but rather in a more abstract, structured model. Its core elements include the "operation target" (e.g., creating a VM, powering on a VM), "required parameters" (e.g., VM ID, target host ID, configuration parameter set), and "return status" (e.g., success, failure and reason, insufficient resources, etc.).
[0093] The Model Context Protocol (MCP) Client, serving as the entry point for user natural language requests, dynamically discovers and queries the standard function capabilities registered with the MCP Server. Upon receiving a user's natural language instruction, the MCP Client drives a large language model to perform deep semantic understanding and intent analysis on the instruction, accurately mapping it to one or more registered VM lifecycle operation functions for enterprise-level virtualization systems.
[0094] Optionally, the lifecycle control semantic model is used to ensure that natural language instructions can be accurately and robustly converted into actual operations on the virtual machine. It specifically includes three stages:
[0095] Plan (Planning Phase): The core tasks of this phase are to identify the user's true intentions, clarify the specific goals of lifecycle operations, extract or complete all parameters required to execute operations, and estimate potential resource limitations or constraints of enterprise-level virtualization system clusters.
[0096] Implementation process: When the Model Context Protocol client receives the user's natural language request, it will first work with LLM to perform a preliminary semantic decomposition of the request. With its powerful natural language understanding capabilities, LLM identifies the type of lifecycle operation the user wants to perform and the parameters clearly given in the request. If there are missing parameters or semantic ambiguity, the Model Context Protocol client will guide LLM to generate clarifying questions based on the preset function capability model, and complete the necessary information or eliminate ambiguity through multiple rounds of dialogue with the user. At the same time, the Model Context Protocol client will also query the resource status information (such as host load and storage margin) provided by the cloud management platform CMP through the Model Context Protocol server to assist LLM in determining the feasibility of the operation.
[0097] Act (Execution phase): After completing the collection and confirmation of parameters in the planning phase, the system enters the execution phase.
[0098] Implementation process: The Model Context Protocol client encapsulates the operation target, parameter set, and a unique operation identifier (e.g., OP_ID) into a request in the Remote Procedure Call (JSON-RPC) format and sends it to the Model Context Protocol server. The Model Context Protocol server performs idempotent processing on this operation identifier: If the same operation request (with the same operation identifier) is sent repeatedly due to network retries or multiple rounds of LLM interaction, the Model Context Protocol server will directly return the cached result of the first execution for subsequent repeated requests to ensure that the operation is only executed once on the enterprise-level virtualization system. This mechanism is similar to the client token used when creating resources in the CMP, effectively preventing risks such as duplicate virtual machine creation and deletion. After receiving a valid request, the Model Context Protocol server calls the interface provided by the CMP or directly interacts with the enterprise-level virtualization system's API to perform specific virtual machine operations.
[0099] Recover (recovery phase): This phase mainly handles abnormal return values or failed calls that may occur during the execution process.
[0100] Implementation Process: After the model context protocol server executes an operation, it returns the result to the model context protocol client. If the operation fails, the model context protocol client first checks the error type returned by the model context protocol server. If the error type is marked as BUSY (e.g., the target VM is currently locked by another operation), or RETRYABLE (e.g., non-fatal errors such as transient API throttling or temporary I / O suspension in an enterprise virtualization system), the model context protocol client does not terminate immediately but instead initiates an automatic delayed retry mechanism (optionally with exponential backoff). For other types of failures, or if failure persists after retries, the recovery mechanism is activated. The model context protocol client analyzes the cause of the error in conjunction with the LLM. Specifically, if the current VM lifecycle state context records available snapshots (e.g., in the vm.snapshots field), and the error occurs at a specific stage, such as during guest OS configuration, the model context protocol client will prioritize recommending a system rollback to a known good state or automatically trigger the rollback_to_snapshot function to minimize data loss and downtime, restoring the VM to the last known successful state. This snapshot rollback mechanism is key to achieving a self-healing closed-loop operation and maintenance for conversational AI. If automatic recovery isn't possible or a suitable snapshot isn't available, LLM generates remedial suggestions, such as adjusting parameters and suggesting alternative solutions (such as changing the target host if migration fails), guiding the user through conversation.
[0101] Log Analysis and Self-Healing: When a VM operation fails in an enterprise virtualization system (e.g., create_vm failure), the Model Context Protocol client can be configured to automatically call the log analysis function analyze_log_failure. This function retrieves log data related to the failed task within a specified time window from an integrated logging system (such as ELKStack, Fluentbit, or Promtail cluster deployed within the CMP environment). LLM then performs semantic parsing on these logs to attempt to determine the specific cause of the failure, such as exhaustion of enterprise virtualization system host resources, corruption of the specified image, or network configuration conflicts. If the analysis indicates that the issue can be resolved by adjusting parameters (e.g., increasing disk quotas), the system generates new parameters and automatically calls the corresponding MCP function to retry the operation. If the issue requires manual intervention (e.g., underlying hardware failure), the system automatically creates a ticket in the CMP ticketing system with diagnostic information for platform administrators to address.
[0102] Optional virtual machine lifecycle state context management is primarily used to achieve precise, coherent, and robust natural language control of the virtual machine lifecycle in enterprise-level virtualization systems. This invention designs and maintains a key data structure within the core logic of the Model Context Protocol client: the virtual machine lifecycle state context. This context, as a key component of the overall dialog state (dialog_state) maintained within the Model Context Protocol client, dynamically records and updates core state information related to a specific virtual machine or user intent.
[0103] Optionally, the core data structure and meaning of the state context include: The virtual machine lifecycle state context is represented using simplified structured data (for example, JSON format), and its core fields are as follows:
[0104] "{"vm":{ / / The core status of the virtual machine with current focus;
[0105] "id":"vm-abc-123", / / The unique identifier of the virtual machine in the enterprise virtualization system;
[0106] "power":"ON", / / Current power status (such as ON, OFF);
[0107] "snapshots":[ / / A brief list of existing snapshots of this virtual machine; {"id":"snap-xyz-789","time":"2025-05-19T09:15:00Z"}];
[0108] },"last_op_id":"op-uuid-4567", / / The operation ID of the most recent attempt or success of the model context protocol server call;
[0109] "error":null / / The error object returned by the most recent model context protocol server call, or null if successful;
[0110] }".
[0111] Key Field Functional Description: vm is an object containing the most critical information about the virtual machine targeted by the current conversation or operation. id uniquely identifies the target virtual machine for the operation. This ID is populated after the user specifies or the system creates the virtual machine. Power reflects the virtual machine's power status in real time and is updated by a successful power on / off operation or status query. Snapshots is a list containing only summary information such as the snapshot ID and creation time. This list is used to quickly determine whether a snapshot is available for rollback; detailed snapshot information can be queried separately when needed. last_op_id stores the unique operation identifier of the most recent operation generated by the model context protocol client and used to call the model context protocol server. It is key to implementing idempotence control, ensuring that the same operation is not executed repeatedly. Error records the failure of the most recent call to the model context protocol server. This field stores an error object containing an error code, error message, and possible recovery instructions (such as the RETRYABLE flag). If the operation is successful, it is null.
[0112] As an optional implementation, a virtual machine (VM) lifecycle natural language control system based on a model context protocol (MCP) is provided. Figure 3 This is a schematic diagram of the architecture of a virtual machine operation and management system according to an embodiment of the present application; it includes the following contents:
[0113] The virtual machine operation and management system is mainly composed of three core components: the Model Context Protocol Host (MCP Host), the Model Context Protocol Client (MCP Client), and the Model Context Protocol Server (MCP Server). It is closely integrated with the Large Language Model (LLM), Retrieval Enhancement Generation (RAG) module, the Data Cloud Management Platform (CMP) and its built-in identity authentication (IAM), work order approval, audit log and other modules, as well as the virtualization system enterprise-level virtualization system.
[0114] MCP Host (e.g., Copilot embedded in CMP): Serves as the user interface, typically implemented as an intelligent assistant embedded in the CMP console. It captures the user's natural language commands, the current CMP user identity, and the operation context (e.g., the resource ID being viewed), securely transmits this information to the Model Context Protocol client, and displays the final processing results and natural language responses to the user.
[0115] Model Context Protocol Client: Serves as the semantic coordination and control center of the system and is implemented as a stateful microservice.
[0116] Intent parsing and parameter completion: After receiving a request from the MCP Host, the LLM is linked to understand the user's command semantics, identifying the operation intent (such as mapping to MCPToolSchemas such as create_vm) and preliminary parameters. Through the internal parameter collection state machine, the LLM conducts multiple rounds of dialogue with the user to complete all the parameters required for the operation.
[0117] VM lifecycle state context management: A VM lifecycle state context is maintained internally (including key information such as the VM ID vm.id, VM ID vm.power, VM list vm.snapshots, the unique identifier of the most recently called operation last_op_id, and the error message indicating a failed call). This context is dynamically updated during the conversation to maintain conversation focus, ensure idempotence, assist in fault recovery, and serve as input for LLM decisions. This state data is persistently stored.
[0118] RAG Integration: Integrates RAG technology to retrieve information from the CMP knowledge base (such as virtual machine templates, policy documents, enterprise-level virtualization system best practices, log systems, and operation and maintenance manuals) to enhance LLM's capabilities in parameter recommendation, fault diagnosis, and question-and-answer support.
[0119] Model Context Protocol Server: Serves as the function capability registration center and backend execution engine. It is implemented as a lightweight microservice and deployed in a network environment with trusted access to CMP and enterprise-level virtualization system APIs.
[0120] Function registration and discovery: Pre-register standardized function capabilities (including operation targets, required parameters, and return status) for enterprise-level virtualization system virtual machine lifecycle operations (such as creation, startup, shutdown, deletion, and migration).
[0121] Request processing and execution: Receives a JSON-RPC call from the Model Context Protocol client, carrying a unique operation identifier (op_id) and a complete set of parameters. Server-side parameter validation hooks are executed (e.g., verifying that parameters comply with CMP tenant quotas and the actual constraints of the enterprise virtualization system) to ensure compliance and validity of the operation. Subsequently, the CMP API is called or the enterprise virtualization system API is directly interacted with to perform the specific operation, ensuring idempotence of the operation using the op_id.
[0122] Optionally, the virtual machine (VM) lifecycle natural language control system based on the model context protocol (MCP) can implement the following steps when running:
[0123] Step 1. User interaction and command input. The cloud management platform receives the commands sent by the user. That is, the user enters the virtual machine operation commands using natural language through the Copilot (Model Context Protocol Host) interface embedded in the CMP console.
[0124] Step 2. The cloud management platform transmits the operation instructions and the user's identity information to the model context protocol host.
[0125] Step 3. The model context protocol host sends a forwarding request carrying the user instruction to the model context protocol client, including the model context protocol host capturing the user instruction and attaching the user's identity authentication information in the CMP (such as user ID, session token) and the CMP context of the current operation (such as the resource ID that the user is viewing), and then securely passing this information to the model context protocol client corresponding to the model context protocol.
[0126] Step 4. Semantic Understanding. After receiving the request, the model context protocol client first links the LLM (possibly in conjunction with RAG to retrieve information from the CMP knowledge base) to perform semantic understanding of the user instruction and identify the user's operation intention (e.g., mapping to MCP Tool Schema such as create_vm or delete_vm) and preliminary parameters.
[0127] Step 5: Initial Permission Verification: The Model Context Protocol client, based on the identified MCP Tool and its required permissions, combined with the user identity information obtained from the Model Context Protocol host, initiates a permission verification request to the CMP's IAM module. The IAM module determines whether the current user has permission to perform the intended action based on pre-defined policies. If the user does not have permission, the process terminates and a notification indicating insufficient permissions is returned to the user.
[0128] Step 6. Work Order Approval. If the initial IAM verification passes, the Model Context Protocol client will conduct multiple rounds of dialogue with the user through the LLM to complete all required parameters for the operation. This process utilizes the client-side parameter collection state machine to ensure parameter integrity and validity. If the MCP Tool is marked as requiring approval (requires_approval=true), the Model Context Protocol client will drive the LLM to guide the user to generate a structured approval request and then call the CMP work order system API to create an approval work order. The operation will be paused, waiting for the work order to flow through the CMP system and be approved. The process will not continue until the work order is approved.
[0129] Step 7. Remote Procedure Call: After all preconditions (permission verification, parameter integrity, and ticket approval) are met, the Model Context Protocol client generates a unique operation identifier (op_id) to ensure idempotence. The Model Context Protocol client initiates a secure JSON-RPC call to the Model Context Protocol server, carrying the op_id and the complete parameter set.
[0130] Step 8. Execute the corresponding VM operation. After receiving the request, the Model Context Protocol Server first performs a server-side parameter validation check to ensure that the parameters comply with the actual constraints of the enterprise virtualization system and the tenant quotas of the CMP. Optionally, before executing sensitive operations, the Model Context Protocol Server can invoke an integrated policy engine (such as OPA) for more fine-grained policy compliance checks. If the validation passes, the Model Context Protocol Server invokes the CMP API or directly interacts with the enterprise virtualization system API to execute the specific VM lifecycle operation.
[0131] Step 9. Result return and status update: The model context protocol server returns the execution result (success or failure, and related information) to the model context protocol client.
[0132] Step 10. Result Interpretation and User Feedback: The Model Context Protocol client receives the response from the Model Context Protocol server and updates its internally maintained "VM Lifecycle State Context." The client interprets the execution results and generates a natural language response through the LLM, which is then fed back to the user on the Copilot interface via the MCP Host.
[0133] Step 11. Execution status feedback is provided to the user. In case of failure, recovery and diagnosis are performed. Specifically, if an operation fails, the Model Context Protocol client's Recover mechanism is activated. Depending on the error type, automatic retries may be attempted (for BUSY or RETRYABLE errors). If automatic recovery is not possible, the client, in conjunction with the LLM, analyzes the cause of the error and may recommend a rollback to a snapshot (if available in vm.snapshots ) or call the analyze_log_failure function (in conjunction with RAG to retrieve information from the log system and enterprise virtualization system documentation) for in-depth diagnosis. The client then provides remediation suggestions to the user or automatically creates a work order.
[0134] Step 12. Full-process audit: From the moment a user enters a command to the completion of an enterprise-level virtualization system operation, all key steps and data (including user intent, LLM interaction, op_id, permission verification results, work order status, API call details, execution results, etc.) in the entire call chain are recorded in detail and sent to the CMP's central audit log system to ensure traceability and compliance of operations.
[0135] As an optional implementation, taking a user initiating a virtual machine operation as an example, the implementation process of the natural language control method for the virtual machine lifecycle is as follows:
[0136] 1. User command input and preprocessing: The user enters a natural language command (e.g., "Create a new test VM") through the MCP Host (e.g., Copilot embedded in CMP). The MCP Host captures the command, appends the user's authentication information and the current CMP context, and passes it to the Model Context Protocol client.
[0137] 2. Intent Analysis and Initial Permission Verification (Plan Phase): The Model Context Protocol client uses the LLM to analyze the user's intent, identifying the target MCP tool (such as create_vm) and its initial parameters. The Model Context Protocol client then initiates a permission check with the CMP's IAM module based on the user's identity and the required permissions for the target tool. If the user does not have permission, the process terminates and the user is notified.
[0138] 3. Parameter Completion and Work Order Approval (Core of the Plan Phase): If permission verification passes, the Model Context Protocol Client, through its parameter collection state machine, drives the LLM to engage in multiple rounds of dialogue with the user to complete the required parameters (such as CPU, memory, and image). This process can leverage RAG to recommend configurations from the knowledge base. If the MCPTool is marked as requiring approval (requires_approval=true), the Model Context Protocol Client drives the LLM to guide the user to generate a structured approval request and call the CMP Work Order System API to create an approval work order. Operations are suspended until the work order is approved.
[0139] 4. Action Execution (Act Phase): After all preconditions (permissions, parameters, and approvals) are met, the Model Context Protocol client generates a unique op_id and updates its internal "VM Lifecycle State Context." The Model Context Protocol client carries the op_id and parameter set and initiates a JSON-RPC call to the Model Context Protocol server. The Model Context Protocol server performs server-side validation (parameter constraints, tenant quotas, OPA policy checks, etc.) and, upon successful completion, calls the CMP or enterprise virtualization system API to execute the action.
[0140] 5. Result return and status update: The model context protocol server returns the execution result to the model context protocol client. The model context protocol client updates the "virtual machine lifecycle status context" accordingly (such as the vm.power status, and fills in the error object if failure occurs).
[0141] 6. Result interpretation and user feedback: The model context protocol client interprets the execution results, generates natural language responses through LLM, and feeds back to the user via MCPHost.
[0142] 7. Recovery and Diagnosis (Recover phase, in case of failure): If an operation fails, the model context protocol client's Recover mechanism is activated. Automatic retries are performed based on the error type (for BUSY or RETRYABLE errors). If automatic recovery is not possible, LLM analyzes the error cause using the VM lifecycle state context (specifically, the error message and the vm.snapshots list). It may recommend rolling back a snapshot or call the analyze_log_failure function (in conjunction with RAG to retrieve information from log systems and documents) for in-depth diagnosis. The function then provides remediation suggestions to the user or automatically creates a troubleshooting ticket.
[0143] 8. Full audit: The key steps and data in the entire call chain from user input to operation completion (including user intent, LLM interaction, op_id, permission verification results, work order status, API call details, execution results, etc.) are recorded in detail and sent to CMP's central audit log system.
[0144] As an optional implementation, to ensure the safety and compliance of the operation, the following mechanism is adopted for the above embodiment:
[0145] Permission control: Deeply integrated with CMPIAM to implement MCPTool-level permission control based on user identity and role.
[0146] Approval process: High-risk operations are linked to the CMP work order system to execute the preset approval process.
[0147] LLM hallucination prevention and control: Control is achieved through multi-level mechanisms such as function schema constraints, system-level prompts (SystemPrompt), model context protocol client parameter collection state machine, model context protocol server verification hooks, and LLM output format verification.
[0148] Policy Engine: The Model Context Protocol Server can integrate policy engines such as OPA to perform more fine-grained policy compliance checks before performing sensitive operations.
[0149] Network security: Communication between microservices such as the Model Context Protocol client and Model Context Protocol server follows zero-trust network principles, such as using service mesh to implement mTLS encryption and fine-grained access control.
[0150] Through the above implementation methods, this application can efficiently, securely and reliably convert the natural language instructions input by users into specific life cycle operations for enterprise-level virtualization system virtual machines. At the same time, it incorporates strict permission control, approval process, status management, fault recovery and audit mechanisms, thereby improving the intelligence level of virtual machine management and user experience.
[0151] As an optional implementation, a natural language control method for a virtual machine lifecycle based on a model context protocol is provided, comprising the following steps:
[0152] Step a. The model context protocol client captures the natural language instructions input by the user, the user identity information and the current application context information;
[0153] Step b. The model context protocol client receives the instruction, identity information, and context information, and uses a large language model (LLM) to perform semantic understanding of the natural language instruction and identify the user's operation intention and preliminary parameters;
[0154] Step c. The model context protocol client performs permission verification on the identity authentication module (IAM) of the cloud management platform (CMP) based on the identified operation intention and user identity;
[0155] Step d. If the permission check passes, the Model Context Protocol client conducts multiple rounds of dialogue with the user through the LLM to complete all parameters required for the operation, and guides the user to create an approval work order through the CMP work order system if necessary;
[0156] Step e. After the permissions, parameters, and work order approval (if necessary) are met, the model context protocol client generates a unique operation identifier (op_id) and carries the op_id and complete parameter set to initiate a call request to the model context protocol server;
[0157] Step f. After receiving the request, the model context protocol server performs server-side parameter verification and performs specific virtual machine lifecycle operations by calling CMPAPI or the underlying virtualization platform API, using the op_id to ensure the idempotence of the operation;
[0158] Step g. The model context protocol server returns the execution result to the model context protocol client;
[0159] Step h. The model context protocol client interprets the execution result, generates a natural language response through the LLM, and feeds it back to the user via the model context protocol client.
[0160] Optionally, the model context protocol client internally maintains a virtual machine lifecycle state context, which contains at least the identifier of the current focus virtual machine, power state, snapshot information, op_id of the most recent operation, and error information of the most recent operation.
[0161] Optionally, the virtual machine lifecycle state context is initialized or updated after user intent is identified, and is dynamically updated according to the call results before and after the model context protocol server is called, and serves as input information for LLM to understand intent, complete parameters, and make user interaction decisions.
[0162] Optionally, the model context protocol client adopts the Plan-Act-Recover lifecycle control semantic model, wherein: the Plan phase includes steps b, c, and d, which are used to clarify intentions, complete parameters, and complete pre-verification and approval; the Act phase includes steps e and f, which are used to actually perform operations; the Recover phase is activated after step g when the operation fails, and attempts automatic retry based on the error type, recommends that the user roll back based on the snapshot information in the virtual machine lifecycle status context, or calls the log analysis function for in-depth diagnosis and provides remedial suggestions.
[0163] Optionally, the log analysis function analyze_log_failure in the Recover phase is combined with the Retrieval Enhanced Generation (RAG) technology to retrieve information related to the failed task from the log system and virtualization platform documents to assist the LLM in determining the cause of the failure.
[0164] Optionally, during the parameter completion process, the model context protocol client utilizes an internal parameter collection state machine to ensure that all required parameters are effectively obtained from user input or context before entering the subsequent operation execution phase.
[0165] Optionally, before executing a specific virtual machine operation, the model context protocol server executes a server-side parameter verification hook, including checking whether the parameters comply with the quota limit set by the CMP for the tenant, and whether the parameter format complies with the requirements of the underlying virtualization platform.
[0166] Optionally, the model context protocol client or model context protocol server may call an integrated policy engine (such as OPA) to perform additional policy compliance checks before performing sensitive operations.
[0167] Optionally, the Retrieval Enhanced Generation (RAG) technology can be integrated to retrieve information from a preset knowledge base in at least one of the following scenarios to enhance the generated content of the LLM: parameter recommendations and explanations when creating a virtual machine, log-assisted analysis when the virtual machine creation fails, fault diagnosis and self-recovery planning during virtual machine operation, user FAQs, intelligent screening and comparison of virtual machine images and templates, compliance checks and risk warnings for operations, or generation of work order application reasons.
[0168] Optionally, reduce the risk of hallucination in large language models through at least one of the following mechanisms:
[0169] Mechanism 1: Before calling the model context protocol server function, the model context protocol client strictly verifies according to the predefined parameter mode of the function;
[0170] Mechanism 2: Instruct the system-level instructions for interacting with the LLM to explicitly ask questions to the user when information is insufficient.
[0171] Mechanism 3: The model context protocol client confirms the integrity and validity of the parameters through the internal parameter collection state machine;
[0172] Mechanism 4: The model context protocol server performs a final check on the parameters before executing the operation;
[0173] Mechanism 5: Apply regular expression whitelist or preset template to verify the structured output generated by LLM.
[0174] Optionally, key steps and data in the entire call chain from user input instructions to completion of virtualization platform operations are recorded and sent to the central audit log system of the CMP.
[0175] Through the application of the above implementation methods, the following beneficial effects are achieved: (1) Improved operational convenience of virtual machine management: Users can directly issue instructions through natural language without having to learn complex operation interfaces or APIs, which greatly reduces the operational threshold and complexity of virtual machine management. (2) Enhanced system intelligence: By integrating large language models (LLM) and retrieval-augmented generation (RAG), the system can understand user intentions, automatically complete parameters, recommend configurations, assist in fault diagnosis, and provide an intelligent interactive experience. (3) Guaranteed operational security and compliance: Deeply integrated with CMP's identity authentication, permission control, work order approval, and audit log mechanisms, it ensures that all virtual machine operations initiated through natural language are carried out under strict control and meet enterprise-level security and compliance requirements. (4) Improved operation and maintenance efficiency and reliability: Through the Plan-Act-Recover model, operation idempotence guarantee, state context management, and automated fault recovery suggestions (such as snapshot rollback and log analysis), the efficiency of operation and maintenance work and the reliability of the system are effectively improved. (5) Optimized user experience: Services are provided in the form of CMP embedded Copilot, achieving seamless integration with user-related workflows and providing a smooth and intelligent interactive experience.
[0176] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0177] This embodiment also provides an operation and management device for a virtual machine. This system is used to implement the above-mentioned embodiments and preferred implementations. Details already described will not be repeated here. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0178] Figure 4 is a structural block diagram of a virtual machine operation management device according to an embodiment of the present application, such as Figure 4 As shown, the device includes:
[0179] a parsing module 42 configured to receive a first control instruction for operating a virtual machine issued by a target object, parse the first control instruction, and obtain a first operation command, wherein the first control instruction is a natural language instruction for controlling the life cycle of the virtual machine based on a natural language, and the first operation command is an executable virtual machine operation command converted from the natural language instruction;
[0180] A monitoring module 44 is configured to monitor the execution process of the first operation command and obtain a plurality of process data when the first operation command enters execution;
[0181] The management module 46 is used to identify abnormal data in the multiple process data, roll back the process data from the time point when the abnormal data occurred to the time state node before the abnormality occurred according to predetermined rules, and start to re-operate and manage the virtual machine based on the target process data corresponding to the time state node.
[0182] The above-described device first receives virtual machine operation instructions expressed in natural language from a target user (such as a cloud platform administrator). Using a large language model trained using deep learning technology, the system performs semantic parsing on these natural language instructions, identifying the operation intent and the operation object. Based on the parsed results, the system then generates a corresponding first operation command with a clear operation type and parameters. Once the first operation command is ready, the system calls the virtual machine management platform's API to execute the command. During command execution, the system continuously monitors the execution process and collects process data, such as changes in the virtual machine's power state, CPU and memory usage, and network traffic. By analyzing this collected process data, the system identifies any abnormal data that deviates from normal operation, such as virtual machine startup failures and resource exhaustion. When abnormal data is detected, the system can roll back the virtual machine state to the most recent stable state before the abnormality, based on a preset rollback strategy. For example, if a startup operation fails due to insufficient resources, the system can automatically roll back the virtual machine state to the shutdown state, re-evaluate resource allocation based on the rolled-back state, and attempt to restart the machine. The above solution improves the flexibility of virtual machine management, enhances the level of operation and maintenance intelligence, and solves the obvious limitations in enterprise-level virtual machine management scenarios, which lead to inefficient and low-security virtual machine lifecycle management.
[0183] As an optional implementation, the above-mentioned parsing module is also used to use a large language model to perform preliminary semantic decomposition of the first control instruction; wherein, the large language model is a trained model for interacting with the target and identifying the intention contained in the control instruction; based on the preliminary semantic decomposition results, the operation type and operation parameters required by the target object to control the virtual machine are determined; and the first operation command is generated based on the operation type and the operation parameters.
[0184] As an optional implementation, the above-mentioned parsing module also includes: a processing unit, which is used to determine the operation type and operation parameters that the target object needs to control the virtual machine based on the preliminary semantic decomposition result, and when it is determined that the preliminary semantic decomposition result is semantically ambiguous and / or the operation parameters are missing, guide the large language model to interact with the target object by asking clarification questions; and perform semantic ambiguity elimination and parameter completion processing on the preliminary semantic decomposition result based on the interactive feedback information.
[0185] As an optional implementation, the above-mentioned parsing module also includes: a determination unit, which is used to send query information to the server associated with the virtual machine before performing semantic ambiguity elimination and parameter completion processing on the preliminary semantic decomposition result according to the interactive feedback information; wherein, the query information is used to determine the resource status information that the cloud management platform allows the server to provide to the virtual machine and the control permissions allowed for different objects of the virtual machine; receive the feedback result corresponding to the query information; and determine whether the first control instruction issued by the target object is a valid instruction based on the feedback result.
[0186] As an optional implementation, the above-mentioned determination unit is also used to determine that the first control instruction is an invalid instruction when the feedback result indicates that the target object does not have the operation permission, and send an operation prompt information of insufficient permission to the target object; when the feedback result indicates that the target object has the operation permission, determine that the first control instruction is a valid instruction, and configure the available resources of the virtual machine according to the resource status information.
[0187] As an optional implementation, the above-mentioned device also includes: a determination module, which is used to parse the first control instruction, and after obtaining the first operation command, send an approval request prompt message to the target object if the first operation command has an approval identifier; receive the approval parameters added by the target object based on the approval request prompt message; generate an operation approval work order based on the approval parameters and the first operation command; and determine whether to continue to execute the first operation command based on the approval result of the approval object on the operation approval work order.
[0188] As an optional implementation, the above-mentioned device also includes: a mapping module, which is used to receive a first control instruction for operating a virtual machine issued by a target object, parse the first control instruction, and determine multiple operation actions supported by the virtual machine before obtaining a first operation command; register the multiple operation actions as multiple basic functions in a protocol framework server connecting the virtual machine and a cloud management platform, wherein each basic function includes target parameters of the operation action, required parameters of the operation action, and return status of the operation action; and use the multiple basic functions to support mapping processing of the first control instruction.
[0189] As an optional embodiment, the above-mentioned device also includes: a verification module, which is used to monitor the execution process of the first operation command when the first operation command enters execution, and before obtaining multiple process data, verify the operation permission of the target object corresponding to the first operation command; if the verification result indicates that the target object has the permission to execute the first operation command, feedback the execution start data to the target object; if the verification result indicates that the target object does not have the permission to execute the first operation command, terminate the operation management process, and feedback a prompt message of insufficient permission to the target object.
[0190] As an optional implementation, the above-mentioned device also includes: a message module, which is used to monitor the execution process of the first operation command when the first operation command enters execution, and before obtaining multiple process data, when the first operation command carries a demand quota value, compare the demand quota value with the remaining quota value; when the demand quota value is greater than the remaining quota value, determine that the resource demand of the first operation command cannot be met and send a first message to increase the quota to the management object; when the demand quota value is less than or equal to the remaining quota value, determine that the resource demand of the first operation command is met, and send a second message to the management object indicating that the quota remains unchanged.
[0191] Optionally, the first control instruction includes at least one of the following: creating a virtual machine, powering on a virtual machine, shutting down a virtual machine, restarting a virtual machine, migrating a virtual machine, deleting a virtual machine, extending virtual machine resources, changing virtual machine configuration, creating a virtual machine snapshot, and restoring a virtual machine snapshot.
[0192] As an optional implementation, the above-mentioned determination module also includes: a storage unit, which is used to dynamically set the approval identifier corresponding to different operation commands according to the preset sensitivity threshold corresponding to different virtual machines or the degree of influence of the virtual machine operation before sending the approval request prompt information to the target object when the first operation command has an approval identifier; and store the association relationship between the approval identifier and the operation command in the target database corresponding to the cloud management platform.
[0193] As an optional implementation, the above-mentioned monitoring module is also used to identify multiple key steps corresponding to the first operation command; determine the execution timestamp corresponding to each key step among the multiple key steps, and obtain the resource change information caused by the execution of each key step and the virtual machine status comparison information before and after the execution of each key step; determine the multiple process data based on the multiple key steps, execution timestamps, the resource change information, and the virtual machine status comparison information.
[0194] As an optional implementation, the above-mentioned monitoring module is also used to feedback waiting state information to the target object when entering the operation waiting state during the execution of the first operation command; wherein the operation waiting state includes at least one of the following: performing resource preparation for the virtual machine and performing network configuration for the virtual machine.
[0195] As an optional embodiment, the above-mentioned monitoring module also includes: a display unit, which is used to, after entering the operation waiting state, feedback the waiting state information to the target object, and when the target object indicates that the waiting state time needs to be reduced, search from the preset data for multiple optimization schemes for optimizing the first operation command, and calculate the waiting time saved by each optimization scheme; generate an optimization adjustment table corresponding to the first operation command based on the multiple optimization schemes and waiting time; and display the optimization adjustment table to the target object.
[0196] As an optional embodiment, the above-mentioned device also includes: a generation module, which is used to determine whether there is abnormal data in the multiple process data, and if there is no abnormal data in the multiple process data, collect all data records before the successful execution of the first control instruction; and generate a target operation log for participating in subsequent operation analysis based on all the data records.
[0197] As an optional implementation, the above-mentioned device also includes: a usage module for recording the number of times the same operation command is re-managed after the virtual machine is re-operated and managed based on the target process data corresponding to the time status node; when the number of management times is greater than the preset number, determining that the virtual machine has a hardware abnormality; when the number of management times is less than or equal to the preset number, allowing the previous operation command to be reused to operate and manage the virtual machine.
[0198] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same target processor; or the above modules are located in different target processors in any combination.
[0199] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any of the above method embodiments when run.
[0200] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0201] An embodiment of the present application further provides an electronic device, comprising a target memory and a target processor, wherein the target memory stores a computer program, and the target processor is configured to run the computer program to perform the steps in any one of the above method embodiments.
[0202] Optionally, Figure 5 : is a block diagram of the computer system structure of the electronic device according to the embodiment of the present application. Figure 5 As shown, computer system 800 includes a CPU 801 (Central Processing Unit, CPU), which can perform various appropriate actions and processes based on programs stored in ROM 802 (Read-Only Memory, ROM) or programs loaded from storage 808 into RAM 803 (Random Access Memory, RAM). RAM 803 also stores various programs and data required for system operation. CPU 801, ROM 802, and RAM 803 are interconnected via bus 804. I / O interface 805 (Input / Output interface, also known as I / O interface) is also connected to bus 804.
[0203] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, mouse, and the like; an output section 807 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and speakers; a storage section 808 including a hard disk; and a communication section 809 including a network interface card such as a local area network card or a modem. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. Removable media 811, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 810 as needed, so that computer programs read from the removable media can be installed in the storage section 808 as needed.
[0204] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the central processing unit (CPU 801 ), and the input / output device is connected to the central processing unit (CPU 801 ).
[0205] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0206] An embodiment of the present application further provides another computer program product, comprising a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above method embodiments are implemented.
[0207] An embodiment of the present application also provides a computer program, which includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any of the above method embodiments.
[0208] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail here.
[0209] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0210] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed across a network composed of multiple computing devices, they can be implemented using program code executable by the computing device, and thus, they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be performed in a different order than herein, or they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0211] The above is a detailed introduction to the method, apparatus, equipment, storage medium and program for operating and managing a virtual machine provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A method for operating and managing a virtual machine, characterized in that: include: Receiving a first control instruction for operating a virtual machine issued by a target object, parsing the first control instruction to obtain a first operation command, wherein the first control instruction is a natural language instruction for controlling the life cycle of the virtual machine based on a natural language, and the first operation command is converted from the natural language instruction into an executable virtual machine operation command; When the first operation command enters execution, monitoring the execution process of the first operation command to obtain a plurality of process data; Identifying abnormal data among the plurality of process data, rolling back the process data from a time point at which the abnormal data occurred to a time state node before the abnormality occurred according to a predetermined rule, and re-starting operation management of the virtual machine based on target process data corresponding to the time state node; The monitoring of the execution process of the first operation command to obtain a plurality of process data includes: Identifying multiple key steps corresponding to the first operation command; Determine an execution timestamp corresponding to each of the multiple key steps, and obtain resource change information caused by the execution of each key step and virtual machine state comparison information before and after the execution of each key step; The plurality of process data are determined based on the plurality of key steps, the execution timestamp, the resource change information, and the virtual machine state comparison information.
2. The method for operating and managing a virtual machine according to claim 1, wherein: Parsing the first control instruction to obtain a first operation command includes: Performing preliminary semantic decomposition on the first control instruction using a large language model, wherein the large language model is a trained model for interacting with a target and identifying intent contained in the control instruction; Determine the operation type and operation parameters that the target object needs to control the virtual machine based on the preliminary semantic decomposition result; The first operation command is generated based on the operation type and the operation parameters.
3. The method for operating and managing a virtual machine according to claim 2, wherein: After determining, based on the preliminary semantic decomposition result, the operation type and operation parameters that the target object needs to control the virtual machine, the method further includes: In a case where it is determined that the preliminary semantic decomposition result is semantically ambiguous and / or the operation parameter is missing, guiding the large language model to interact with the target object by asking clarifying questions; The preliminary semantic decomposition result is subjected to semantic ambiguity elimination and parameter completion processing according to the interactive feedback information.
4. The method for operating and managing a virtual machine according to claim 3, wherein: Before performing semantic ambiguity elimination and parameter completion processing on the preliminary semantic decomposition result according to the interactive feedback information, the method further includes: Sending query information to a server associated with the virtual machine, wherein the query information is used to determine resource status information that the cloud management platform allows the server to provide to the virtual machine and the control permissions allowed to control different objects of the virtual machine; Receive feedback results corresponding to the query information; Based on the feedback result, it is determined whether the first control instruction issued by the target object is a valid instruction.
5. The method for operating and managing a virtual machine according to claim 4, wherein: Determining whether the first control instruction is a valid instruction based on the feedback result includes: If the feedback result indicates that the target object does not have the operation authority, determining that the first control instruction is an invalid instruction, and sending an operation prompt message of insufficient authority to the target object; When the feedback result indicates that the target object has the operation permission, the first control instruction is determined to be a valid instruction, and the available resources of the virtual machine are configured according to the resource status information.
6. The method for operating and managing a virtual machine according to claim 1, wherein: After parsing the first control instruction to obtain the first operation command, the method further includes: If the first operation command contains an approval identifier, sending an approval request prompt message to the target object; receiving approval parameters added by the target object based on the approval request prompt information; generating an operation approval work order based on the approval parameter and the first operation command; Determine whether to continue executing the first operation command according to the approval result of the approval object on the operation approval work order.
7. The method for operating and managing a virtual machine according to claim 1, wherein: Before receiving a first control instruction for operating a virtual machine issued by a target object and parsing the first control instruction to obtain a first operation command, the method further includes: Determining multiple operation actions supported by the virtual machine; Registering the multiple operation actions as multiple basic functions in a protocol framework server connecting the virtual machine and the cloud management platform, wherein each basic function includes a target parameter of the operation action, a required parameter of the operation action, and a return status of the operation action; The plurality of basic functions are used to support mapping processing of the first control instruction.
8. The method for operating and managing a virtual machine according to claim 1, wherein: When the first operation command enters execution, monitoring the execution process of the first operation command and obtaining a plurality of process data, the method further includes: Verifying the operation authority of the target object corresponding to the first operation command; If the verification result indicates that the target object has the permission to execute the first operation command, feeding back execution start data to the target object; If the verification result indicates that the target object does not have the authority to execute the first operation command, the operation management process is terminated, and a prompt message indicating insufficient authority is fed back to the target object.
9. The method for operating and managing a virtual machine according to claim 1, wherein: When the first operation command enters execution, monitoring the execution process of the first operation command and obtaining a plurality of process data, the method further includes: In a case where the first operation command carries a required quota value, comparing the required quota value with a remaining quota value; In a case where the required quota value is greater than the remaining quota value, determining that the resource requirement of the first operation command cannot be met, and sending a first message for increasing the quota to the management object; When the required quota value is less than or equal to the remaining quota value, it is determined that the resource requirement of the first operation command is met, and a second message indicating that the quota remains unchanged is sent to the management object.
10. The method for operating and managing a virtual machine according to claim 1, wherein: The first control instruction includes at least one of the following: Create a virtual machine, power on a virtual machine, shut down a virtual machine, restart a virtual machine, migrate a virtual machine, delete a virtual machine, expand virtual machine resources, change virtual machine configuration, create a virtual machine snapshot, and restore a virtual machine snapshot.
11. The method for operating and managing a virtual machine according to claim 6, wherein: When the first operation command includes an approval identifier, before sending the approval request prompt information to the target object, the method further includes: Dynamically set approval flags for different operation commands based on preset sensitivity thresholds corresponding to different virtual machines or the impact of virtual machine operations; The association relationship between the approval identifier and the operation command is stored in a target database corresponding to the cloud management platform.
12. The method for operating and managing a virtual machine according to claim 1, wherein: During the execution of the first operation command, the process further includes: When entering the operation waiting state, waiting state information is fed back to the target object, wherein the operation waiting state includes at least one of the following: performing resource preparation of the virtual machine and performing network configuration of the virtual machine.
13. The method for operating and managing a virtual machine according to claim 12, wherein: In the case of entering the operation waiting state, after feeding back waiting state information to the target object, the method further includes: When the target object indicates that the waiting state duration needs to be reduced, searching for multiple optimization solutions for optimizing the first operation command from preset data, and calculating the waiting time saved by each optimization solution; generating an optimization adjustment table corresponding to the first operation command based on the multiple optimization schemes and the waiting time; The optimization adjustment table is displayed to the target object.
14. The method for operating and managing a virtual machine according to claim 1, wherein: After determining whether the plurality of process data contain abnormal data, the method further includes: In a case where there is no abnormal data in the plurality of process data, collecting all data records before the first control instruction is successfully executed; A target operation log for participating in subsequent operation analysis is generated based on all the data records.
15. The method for operating and managing a virtual machine according to claim 1, wherein: After re-operation management of the virtual machine begins based on the target process data corresponding to the time state node, the method further includes: Record the number of times the same operation command is re-managed; If the number of management times is greater than a preset number, determining that a hardware abnormality exists in the virtual machine; When the number of management times is less than or equal to the preset number, it is allowed to reuse the previous operation command to operate and manage the virtual machine.
16. A device for operating and managing a virtual machine, characterized in that: include: a parsing module, configured to receive a first control instruction for operating a virtual machine issued by a target object, parse the first control instruction, and obtain a first operation command, wherein the first control instruction is a natural language instruction for controlling the life cycle of the virtual machine based on a natural language, and the first operation command is an executable virtual machine operation command converted from the natural language instruction; a monitoring module, configured to monitor the execution process of the first operation command and obtain a plurality of process data when the first operation command enters execution; a management module configured to identify abnormal data among the plurality of process data, roll back the process data from a time point at which the abnormal data occurred to a time state node before the abnormality occurred according to a predetermined rule, and restart operation management of the virtual machine based on target process data corresponding to the time state node; The monitoring module is also used to identify multiple key steps corresponding to the first operation command; determine the execution timestamp corresponding to each of the multiple key steps, and obtain resource change information caused by the execution of each key step and virtual machine status comparison information before and after the execution of each key step; determine the multiple process data based on the multiple key steps, execution timestamps, the resource change information, and the virtual machine status comparison information.
17. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the method for operating and managing a virtual machine as claimed in any one of claims 1 to 15 when executing the computer program.
18. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the method for managing the operation of a virtual machine as claimed in any one of claims 1 to 15 are implemented.
19. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method for managing the operation of a virtual machine as claimed in any one of claims 1 to 15 are implemented.
Citation Information
Patent Citations
Operation approval method and device, communication server and user terminal
CN113886808A
Operation and maintenance management method, device and equipment and readable storage medium
CN118672854A
Virtual machine thermal migration system, method and device used in DPU environment and storage medium
CN119668777A