Host machine state reporting method and device, electronic equipment and storage medium

By using the target API to obtain and report target messages in the cloud operating system, the problem that the console needs to poll regularly to obtain the host status is solved, and timely reporting and updating of the host status is achieved.

CN119988049APending Publication Date: 2025-05-13BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311498379.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-10
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

In the prior art, the console needs to timely poll to obtain the status of the exclusive host, resulting in untimely update of the status, which can easily lead to usage deviations.

Method used

The first target message is obtained based on the target API through the first component in the cloud operating system, and after performing the target operation, the second target message is generated and reported, and the target operation is performed.

Benefits of technology

It realizes timely reporting of host status, avoiding the problem of untimely updates caused by timely polling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988049A_ABST
    Figure CN119988049A_ABST
Patent Text Reader

Abstract

The invention relates to a host machine state reporting method and device, electronic equipment and a storage medium, and the method comprises the steps that a first component in a cloud operation system obtains a first target message based on a target API, and the target message represents that a target operation is executed on a host machine; after the first component executes the target operation based on the first target message, the first component generates a second target message and reports the second target message, and the second target message is used for representing that execution of the target operation is completed. According to the method and the device, the message that the target operation is executed is actively reported, so that the state of the host machine can be reported in time, a console does not need to perform timed polling in the prior art, and the problem that the state of the host machine is not updated in time is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and device for reporting a host machine status, an electronic device, and a storage medium. Background Art

[0002] For operations on dedicated hosts, such as: hosts joining dedicated clusters, hosts removing dedicated clusters, dedicated hosts being purchased / released, etc., the prior art is to periodically poll the console side (e.g., once every 5 minutes) to call the underlying interface to obtain the status of the dedicated host. This periodic polling method makes it impossible for the console level to perceive in real time, resulting in untimely updates and easy use deviations. Summary of the invention

[0003] The present application provides a method and device for reporting the status of a host machine, an electronic device and a storage medium, so as to solve the problem in the prior art that a console needs to perform periodic polling, resulting in untimely updates of the host machine status.

[0004] In a first aspect, the present application provides a method for reporting the status of a host machine, comprising: a first component in a cloud operating system obtains a first target message based on a target API, wherein the target message represents the execution of a target operation on the host machine; after the first component completes the execution of the target operation based on the first target message, the first component generates a second target message and reports the second target message, wherein the second target message is used to represent the completion of the execution of the target operation.

[0005] In the second aspect, the present application provides a host machine status reporting device, which is applied to a first component in a cloud operating system, including: an acquisition module, used to obtain a first target message based on a target API, wherein the target message represents the execution of a target operation on the host machine; a first processing module, used to generate a second target message and report the second target message after the first component completes the execution of the target operation based on the first target message, wherein the second target message is used to represent the completion of the execution of the target operation.

[0006] In a third aspect, the present application provides an electronic device comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; and at least one memory connected to the at least one bus, wherein the processor is configured to execute the host machine status reporting method described in the first aspect of the present application.

[0007] In a fourth aspect, the present application further provides a computer storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the method for reporting the host machine status described in the first aspect of the present application.

[0008] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: in the embodiment of the present application, after obtaining the first target message of executing the target operation on the host machine, the target operation is executed, and after the target operation is completed, a report is sent to indicate that the target operation is completed. It can be seen that in the embodiment of the present application, the message of the target operation execution completion is actively reported, so that the host machine status can be reported in time, and there is no need to perform regular polling of the console as in the prior art, so as to avoid the problem of untimely update of the host machine status. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0010] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0011] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0012] Figure 1 A flowchart of a method for reporting host machine status provided in an embodiment of the present application;

[0013] Figure 2 A schematic diagram of the process of purchasing and releasing a host in Openstack provided in an embodiment of the present application;

[0014] Figure 3 A schematic diagram of the message flow in Openstack provided in an embodiment of the present application;

[0015] Figure 4 A schematic diagram of a host machine status reporting device provided in an embodiment of the present application;

[0016] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0017] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0018] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0019] First, the relevant terms involved in the embodiments of the present application are explained;

[0020] Openstack: Open source cloud operating system.

[0021] Nova: The component responsible for the computing part of OpenStack.

[0022] Az (available zone): available zone.

[0023] Nova-api / nova-scheduler / nova-compute: the core components of the nova service.

[0024] Dedicated host: A host dedicated to customers. Other customer virtual machines cannot be created on it.

[0025] Figure 1 A flowchart of a method for reporting host status provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the steps of the method include:

[0026] Step 101: A first component in a cloud operating system obtains a first target message based on a target API, wherein the target message represents execution of a target operation on a host machine;

[0027] In a specific example, the cloud operating system in the embodiment of the present application may be Openstack, and the first component may be Nova in Openstack. In addition, the target API may be OpenAPI in Openstack. The target operation may be to add a host to a dedicated cluster, remove a host from a dedicated cluster, purchase a host, release a host, etc. in Openstack. Taking the target operation of purchasing a host as an example, the content carried in the first target message may include: model: DC1, name: [hostanme], num: 1, availability_zone: ''.

[0028] Step 102: After the first component completes executing the target operation based on the first target message, the first component generates a second target message and reports the second target message to the upper component, wherein the second target message is used to indicate that the target operation is completed.

[0029] Through the above steps 101 and 102, in the embodiment of the present application, after obtaining the first target message for executing the target operation on the host, the target operation is executed, and after the target operation is completed, a message is reported to indicate that the target operation is completed. It can be seen that in the embodiment of the present application, the message of the target operation being completed is actively reported so that the host state can be reported in time, without the need for the console to perform regular polling as in the prior art, thereby avoiding the problem of untimely update of the host state.

[0030] In an optional implementation of an embodiment of the present application, when the target operation is to purchase a host machine, the first target message carries purchase information; the manner in which the first component involved in the embodiment of the present application performs the target operation based on the first target message may further include:

[0031] Step 11, the first component verifies the host unit;

[0032] Step 12: If the verification is successful, the first component purchases a host from the host group based on the purchase information.

[0033] In the specific example, taking the cloud operating system as Openstack and the first component as Nova in Openstack, the first target message in the embodiment of the present application may include model: DC1, name: [hostanme], num: 1, availability_zone: ''. Based on this, the first component in the above steps 11 and 12 is NovaAPI in Nova, that is, NovaAPI verifies the exclusive host group, and updates the corresponding table in the database after the verification is completed and returns the result to each compute node (compute_nodes), and writes files asynchronously (that is, the results are written to each compute_node at the same time). After this, NovaAPI will send a second target message to NovaUnimq in the Nova component, and the second target message can specifically be "(api.create_dedicated_hypenrvisor.end)".

[0034] In another optional implementation of the embodiment of the present application, when the target operation is to release the host machine, the first target message carries release information; the manner in which the first component involved in the embodiment of the present application performs the target operation based on the first target message may further include:

[0035] Step 21, the first component determines the host machine to be released from the database based on the release information;

[0036] Step 22, the first component determines whether there is an instance on the host machine to be released;

[0037] Step 23: When no instance exists on the host machine to be released, the first component deletes the host machine to be released from the database.

[0038] In the specific example, taking the cloud operating system as Openstack and the first component as Nova in Openstack, the first target message in the embodiment of the present application may include "hypervisor_uuid". In the specific example, the first component is NovaAPI in Nova, that is, NovaAPI obtains the corresponding compute_node from the database according to hypervisor_uuid. Then NovaAPI determines whether there is an instance on the compute_node. If not, it continues to execute the release operation, that is, delete the host machine from the database, and asynchronously execute the deletion of files (that is, delete the host machine's files on each compute_node). After this, NovaAPI will send a second target message to NovaUnimq in the Nova component, and the second target message can specifically be "(api.delete_dedicated_hypenvisor.end)".

[0039] For the above steps 11 to 12, and steps 21 to 23, in a specific example, Figure 2 As shown, for the target operation of purchasing a host, the process includes:

[0040] Step 201, OpenAPI obtains a message for purchasing a host machine;

[0041] In a specific example, the message may be model: DC1, name: [hostanme], num: 1, availability_zone: ''.

[0042] Step 202, OpenAPI sends the message to NovaAPI to purchase the host;

[0043] Step 203, verifying the dedicated host group;

[0044] Step 204, update the corresponding verification result in the database and return it to compute_nodes;

[0045] Step 205, asynchronously execute the file writing (i.e., write the result to each compute_node at the same time);

[0046] Step 206, sending a post-purchase usage change notification (api.create_dedicated_hypenrvisor.end) to NovaUnimq.

[0047] like Figure 2 As shown, the process of releasing the host includes:

[0048] Step 207, OpenAPI obtains a message for releasing the host machine;

[0049] In a specific example, the message may be "hypervisor_uuid".

[0050] Step 208, OpenAPI sends the message to NovaAPI to release the host;

[0051] Step 209, NovaAPI obtains the corresponding compute_node in the database according to hypervisor_uuid;

[0052] Step 210, NovaAPI determines whether there is an instance of compute_node, and if not, continues to execute the release operation;

[0053] Step 211, NovaAPI deletes the corresponding host in the database;

[0054] Step 212, asynchronously execute deletion of files (each compute_node);

[0055] Step 213, NovaAPI sends a usage update notification after release (api.delete_dedicated_hypenvisor.end).

[0056] It can be seen that in the embodiment of the present application, the notification message is sent after the purchase process updates the database, and the notification message is sent after the release process deletes the relevant database record. That is, in the embodiment of the present application, the notification message is actively sent after the relevant operation on the host is completed, and other components or devices do not need to poll the host status, so the host status can be obtained in time.

[0057] In an optional implementation manner of the embodiment of the present application, the manner in which the first component generates the second target message and reports the second target message involved in the above step 102 may further include:

[0058] Step 31, the first component sends a second target message to the message queue, and sets a keyword corresponding to the second target message in the remote dictionary service Redis;

[0059] Step 32, after the second target message in the message queue is consumed, the first component deletes the keyword;

[0060] Step 33, the first component periodically scans the keywords in Redis;

[0061] Step 34: When it is determined that the second target message corresponding to the keyword has not been consumed within a preset time period, the first component sends an alarm message.

[0062] Step 35: After the first component sends the alarm information, the first component re-reports the second target message.

[0063] In the embodiment of the present application, a plurality of the second target messages are stored in the message queue. After each second target message is sent by the message queue, it indicates that the second target message has been consumed, that is, the second target message has been received by the receiving end. After the second target message is consumed, the corresponding keyword needs to be deleted. If the keyword has not been deleted, it indicates that the corresponding second target message has timed out and has not been consumed. In this regard, the corresponding automatic retransmission can be performed according to the demand, that is, the second target message can be resent.

[0064] In a specific example, the cloud operating system is Openstack, and the first component is Nova in Openstack. Figure 3 As shown, all messages in Openstack can be sent to rabbitmq by the corresponding components first, and then Novaunimq regularly scans the queue in rabbitmq to obtain the corresponding messages, that is, NovaApi sends the target message to rabbitmq, Novascheduler, Novacompute, Novanovncproxy, and Novaconsoleauth also send messages to rabbitmq first, and then Novaunimq regularly scans the queue in rabbitmq to obtain the corresponding messages. Based on this, for the above steps 31 to 35, the process in the specific example includes the following steps:

[0065] Step 301, after NovaAPI (first component) successfully sends the message to MQ (message queue), it sets a key (keyword) in redis to record the message;

[0066] Step 302, after Novaunimq (the first component) receives the MQ message, it first deletes the key in redis, indicating that the message has been consumed;

[0067] Step 303, Novaunimq periodically scans the key in redis, and if it finds that the message has timed out, it sends an email alert and decides whether to retransmit the message based on the configuration item.

[0068] For the key in the embodiment of the present application, it can be written in the RPC (Remote Procedure Call) message, for example, the following content is written in the RPC message {timestamp: 1577680077, func: call|cast|fanout, host: None|$hostname, msg:$message}. When the message is consumed, the above content is deleted in the RPC message. That is, the process of the above steps 301 to 303 can be: after Nova sends a message to MQ, MQ returns ACK to nova; Nova writes the RPC message record in redis; and then after Nova receives the MQ message, it returns ACK to MQ; Nova deletes the RPC message record in redis.

[0069] Corresponding to the above Figure 1 The embodiment of the present application also provides a host machine status reporting device, which is applied to the first component in the cloud operating system, such as Figure 4 As shown, the device comprises:

[0070] An acquisition module 402 is used to acquire a first target message based on a target API, wherein the target message represents a target operation to be performed on a host machine;

[0071] The first processing module 404 is used to generate a second target message and report the second target message to the upper part after the first component completes executing the target operation based on the first target message, wherein the second target message is used to indicate that the target operation is completed.

[0072] Through the device in the embodiment of the present application, after obtaining the first target message of executing the target operation on the host machine, the target operation is executed, and after the target operation is completed, a message is reported to indicate that the target operation is completed. It can be seen that in the embodiment of the present application, the message of the target operation completion is actively reported so that the host machine status can be reported in time, without the need for the console to perform regular polling as in the prior art, to avoid the problem of untimely update of the host machine status.

[0073] In an optional implementation of an embodiment of the present application, when the target operation is to purchase a host machine, the first target message carries purchase information; the device of the embodiment of the present application may also include: a verification module for verifying the host group; and a purchase module for purchasing a host machine from the host group based on the purchase information when the verification passes.

[0074] In the specific example, taking the cloud operating system as Openstack and the first component as Nova in Openstack, the first target message in the embodiment of the present application may include model: DC1, name: [hostanme], num: 1, availability_zone: ''. Based on this, the first component in the above steps 11 and 12 is NovaAPI in Nova, that is, NovaAPI verifies the exclusive host group, and updates the corresponding table in the database after the verification is completed and returns the result to each compute node (compute_nodes), and writes files asynchronously (that is, the results are written to each compute_node at the same time). After this, NovaAPI will send a second target message to NovaUnimq in the Nova component, and the second target message can specifically be "(api.create_dedicated_hypenrvisor.end)".

[0075] In an optional implementation of an embodiment of the present application, when the target operation is to release the host machine, the first target message carries release information; the device of the embodiment of the present application may also include: a determination module, used to determine the host machine to be released from the database based on the release information; a judgment module, used to judge whether there is an instance on the host machine to be released; and a deletion module, used to delete the host machine to be released from the database if there is no instance on the host machine to be released.

[0076] In the specific example, taking the cloud operating system as Openstack and the first component as Nova in Openstack, the first target message in the embodiment of the present application may include "hypervisor_uuid". In the specific example, the first component is NovaAPI in Nova, that is, NovaAPI obtains the corresponding compute_node from the database according to hypervisor_uuid. Then NovaAPI determines whether there is an instance on the compute_node. If not, it continues to execute the release operation, that is, delete the host machine from the database, and asynchronously execute the deletion of files (that is, delete the host machine's files on each compute_node). After this, NovaAPI will send a second target message to NovaUnimq in the Nova component, and the second target message can specifically be "(api.delete_dedicated_hypenvisor.end)".

[0077] In an optional implementation manner of an embodiment of the present application, the first processing module in the embodiment of the present application may further include: a processing unit, used to send a second target message to the message queue, and set a keyword corresponding to the second target message in the remote dictionary service Redis; a deletion unit, used to delete the keyword after the second target message in the message queue is consumed.

[0078] In an optional implementation of an embodiment of the present application, the device in the embodiment of the present application may also include: a scanning module for periodically scanning keywords in Redis; a sending module for sending an alarm message when it is determined that the second target message corresponding to the keyword has not been consumed within a preset time period.

[0079] In an optional implementation manner of the embodiment of the present application, the device in the embodiment of the present application may also include: a second processing module, which is used for the first component to re-report the second target message after the first component sends the alarm information.

[0080] In the embodiment of the present application, a plurality of the second target messages are stored in the message queue. After each second target message is sent by the message queue, it indicates that the second target message has been consumed, that is, the second target message has been received by the receiving end. After the second target message is consumed, the corresponding keyword needs to be deleted. If the keyword has not been deleted, it indicates that the corresponding second target message has timed out and has not been consumed. In this regard, the corresponding automatic retransmission can be performed according to the demand, that is, the second target message can be resent.

[0081] like Figure 5 As shown, an embodiment of the present application provides an electronic device, including a processor 511, a communication interface 512, a memory 513 and a communication bus 514, wherein the processor 511, the communication interface 512, and the memory 513 communicate with each other through the communication bus 514.

[0082] Memory 513, used for storing computer programs;

[0083] In one embodiment of the present application, the processor 511 is used to implement the host machine status reporting method provided by any of the aforementioned method embodiments when executing the program stored in the memory 513. The functions achieved are similar and will not be repeated here.

[0084] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the host machine status reporting method provided in any of the aforementioned method embodiments are implemented.

[0085] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0086] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0087] It should be understood that the terms used in the text are only for the purpose of describing specific example embodiments, and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used in the text may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.

[0088] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for reporting host machine status, characterized in that: include: A first component in the cloud operating system obtains a first target message based on a target API, wherein the target message represents execution of a target operation on a host machine; After the first component completes executing the target operation based on the first target message, the first component generates a second target message and reports the second target message to an upper level, wherein the second target message is used to indicate that the target operation is completed.

2. The method according to claim 1, characterized in that In the case where the target operation is to purchase the host machine, the first target message carries purchase information; The first component performs the target operation based on the first target message, including: The first component verifies the host group; If the verification is successful, the first component purchases the host machine from the host machine group based on the purchase information.

3. The method according to claim 1, characterized in that In the case where the target operation is to release the host machine, the first target message carries release information; The first component performs the target operation based on the first target message, including: The first component determines a host machine to be released from a database based on the release information; The first component determines whether there is an instance on the host machine to be released; In a case where no instance exists on the host machine to be released, the first component deletes the host machine to be released from the database.

4. The method according to claim 1, characterized in that The first component generates a second target message and reports the second target message, including: The first component sends the second target message to the message queue, and sets a keyword corresponding to the second target message in the remote dictionary service Redis; The first component deletes the keyword after the second target message in the message queue is consumed.

5. The method according to claim 4, characterized in that The method further comprises: The first component periodically scans the keywords in the Redis; When it is determined that the second target message corresponding to the keyword has not been consumed within a preset time period, the first component sends an alarm message.

6. The method according to claim 5, characterized in that The method further comprises: After the first component sends the alarm information, the first component re-reports the second target message.

7. A host machine status reporting device, applied to a first component in a cloud operating system, characterized in that: include: An acquisition module, configured to acquire a first target message based on a target API, wherein the target message represents execution of a target operation on a host machine; The first processing module is used to generate a second target message and report the second target message to an upper level after the first component completes executing the target operation based on the first target message, wherein the second target message is used to indicate that the target operation is completed.

8. The device according to claim 7, characterized in that The first processing module comprises: A processing unit, configured to send the second target message to a message queue, and set a keyword corresponding to the second target message in a remote dictionary service Redis; The deleting unit is used to delete the keyword after the second target message in the message queue is consumed.

9. An electronic device, comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor coupled to the at least one bus; At least one memory connected to the at least one bus, wherein the processor is configured to execute the host machine status reporting method described in any one of claims 1 to 6 of the present application.

10. A computer storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the host machine status reporting method described in any one of claims 1 to 6 of the present application.