CN113901066A - Method for updating state after instance operation - Google Patents

Method for updating state after instance operation Download PDF

Info

Publication number
CN113901066A
CN113901066A CN202111096993.3A CN202111096993A CN113901066A CN 113901066 A CN113901066 A CN 113901066A CN 202111096993 A CN202111096993 A CN 202111096993A CN 113901066 A CN113901066 A CN 113901066A
Authority
CN
China
Prior art keywords
instance
state
websocket
status
serverstatusresulthandler
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111096993.3A
Other languages
Chinese (zh)
Inventor
侯晓宇
杨继伟
赵美如
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Cloud Information Technology Co Ltd
Original Assignee
Inspur Cloud Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Cloud Information Technology Co Ltd filed Critical Inspur Cloud Information Technology Co Ltd
Priority to CN202111096993.3A priority Critical patent/CN113901066A/en
Publication of CN113901066A publication Critical patent/CN113901066A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2358Change logging, detection, and notification

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The invention relates to the technical field of computers, and particularly provides a method for updating a state after instance operation, which comprises the steps of firstly, carrying out front-end display, namely client display, and synchronously sending an instance operation request to a back end as an initiator; then, the back end receives two kinds of information of the instance state and the operation result which are asynchronously returned through message transfer; and finally, the received state information directly updates the list data through the instance ID, and the received operation result is displayed through a corresponding component. Compared with the prior art, the method does not change Openstack, does not associate Openstack internal components, timely informs the front end of a final execution result through rear-end analysis and processing while ensuring the state of the front end to be displayed in time, and finally displays the operation result to a client in time, so that the method is more favorable for building and running of cloud service products.

Description

Method for updating state after instance operation
Technical Field
The invention relates to the technical field of computers, and particularly provides a method for updating a state after instance operation.
Background
With the popularization of cloud services, more and more manufacturers provide cloud computing services such as ECS (electronic communications systems), bottom cloud platforms on which the products depend comprise products such as Openstack and VMware, the market occupation ratio of the Openstack serving as an open-source cloud platform in the fields such as private cloud is promoted year by year, and open-source communities are gradually grown and become the first choice for cloud platform construction.
Openstack has modules such as computing, storage, network, etc., wherein an instance in the computing module is the most important function of the cloud platform, each cloud service product runs with the instance as a carrier, and other Openstack modules provide basic services such as creation, communication, storage, etc. for the instance during this period, so monitoring of instance states becomes especially important when the instance executes operations.
The operations of the instances in Openstack are very many, and from simple startup and shutdown to complex operations such as virtual machine creation, each operation can change the state of the instance, and how to timely and dynamically display the state of the instance through a front-end service product page becomes important.
Disclosure of Invention
The invention provides a method for updating the state after the instance operation, which has strong practicability and aims at the defects of the prior art.
The technical scheme adopted by the invention for solving the technical problems is as follows:
a method for updating the state after the operation of an example comprises the following steps of firstly, carrying out the display of a front end, namely a client, and synchronously sending an example operation request to a back end as an initiator;
then, the back end receives two kinds of information of the instance state and the operation result which are asynchronously returned through message transfer;
and finally, the received state information directly updates the list data through the instance ID, and the received operation result is displayed through a corresponding component.
Further, the message transfer selects a Websocket protocol according to an actual application scenario, and performs asynchronous transmission from the back end to the front end.
Preferably, the Websocket Handler in the Websocket protocol includes a serverStatusHandler and a serverStatusResultHandler.
Further, the server StatusHandler receives the instance state and updates the front-end implementation display state; and the server StatusResultHandler receives the example operation result and the front end receives and displays the example operation result.
Further, the back end receives the instance operation request, and performs Openstack API call according to the request, where the Openstack instance operation API is an asynchronous interface, and needs to perform subsequent query and analysis on instance details to determine an operation result, and transmit the result to the message transfer and receive the result by the front end.
Further, when the front end displays, the method specifically comprises the following steps:
s101, receiving an incoming instance operation action and an instance ID server Id;
s102, defining the overtime time as 3-7 minutes after the current time, and a blank state status.
Further, when the message is transferred, the method specifically comprises the following steps:
s201, judging whether the time is overtime, and if not, performing the step S202; if yes, sending different information to a serverstatusResultHandler of the websocket according to different conditions;
s202, judging whether the status is ERROR, if not, continuing to step S203; if yes, sending different information to a serverstatusResultHandler of the websocket according to different conditions;
s203, judging whether status is SOFT _ DELETED, if not, continuing to step S204; if yes, sending different information to a serverstatusResultHandler of the websocket according to different conditions;
s204, judging whether the status is DELETED, if not, continuing to the step S205; if yes, sending different information to a serverstatusResultHandler of the websocket according to different conditions;
s205, judging that the operation action is not VERIFY _ RESIZE and judging that the status is VERIFY _ RESIZE, if not, continuing to step S206; if yes, sending different information to a serverstatusResultHandler of the websocket according to different conditions;
s206, sleeping for a plurality of seconds;
s207, inquiring details through the instance ID, if the inquired instance state is different from the status, continuously assigning the instance state to the status, and if the inquired instance state is the same as the status, performing back-end processing;
s208, sending the instance ID, the instance state and the power state information to a serverstatusHandler of the websocket, and receiving and displaying the instance ID, the instance state and the power state information by the front end.
Further, when the back-end operation is performed, the method specifically comprises the following steps:
s301, judging that the operation is REVERT _ RESIZE and the states are not REVERT _ RESIZE and VERIFY _ RESIZE, if yes, sending the message to a serverstatusResultHandler of the websocket, and if the message is that the migration is cancelled and/or the size adjustment is successful, ending the process; if not, continue to step S302;
s302, judging whether the task in the example details is empty and the operation action is not VERIFY _ RESIZE, if so, continuing to execute the step S303, otherwise, jumping to the step S201;
s303, judging that the operation action is CREATE and the status is BUILD, if so, continuing to step S201, and if not, executing step S304;
s304, sending different messages to the serverStatusResultHandler of the websocket according to different conditions.
Compared with the prior art, the method for updating the state after the operation of the embodiment has the following remarkable beneficial effects:
the invention can not change Openstack, does not associate Openstack internal components, ensures the state of the front end to be displayed in time, and informs the front end of a final execution result in time through the analysis and processing of the rear end, and finally displays the operation result to a client in time, thereby being more beneficial to the construction and operation of cloud service products.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flow diagram of a method of updating an example post-operation state (one).
Detailed description of the preferred embodiments
The present invention will be described in further detail with reference to specific embodiments in order to better understand the technical solutions of the present invention. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
A preferred embodiment is given below:
as shown in fig. 1, in the present embodiment, a method for updating an instance post-operation state is provided;
firstly, the front end, namely the client side is displayed and is used as an initiator to synchronously send an example operation request to the back end.
Then, the back end receives two kinds of information of the instance state and the operation result which are asynchronously returned through message transfer;
and the message transfer selects a Websocket protocol according to the actual application scene, and carries out asynchronous transmission from the back end to the front end. Websocket Handler in Websocket protocol contains serverStatusHandler and serverStatusResultHandler. And the server StatusHandler receives the instance state and updates the front-end implementation display state, and the server StatusResultHandler receives the instance operation result and the front-end receives and displays the instance operation result.
And finally, the received state information directly updates the list data through the instance ID, and the received operation result is displayed through a corresponding component.
The back end receives the instance operation request, and performs Openstack API call according to the request, the Openstack instance operation API is an asynchronous interface, the instance details need to be inquired and analyzed subsequently to judge the operation result, and the result is transmitted to the message to be transferred and received by the front end.
Openstack has dozens of example operations, the patent only takes a common example operation as an example, and logic adjustment can be performed according to the increase of the operation during actual application. The following table shows 18 example operations, example states during each example operation, and example states after the operation was successful, and the results of the final operation can be obtained by comparing the operation with the operation success state.
Figure BDA0003269420780000041
Figure BDA0003269420780000051
Figure BDA0003269420780000061
Figure BDA0003269420780000071
When the front-end display is carried out, the method specifically comprises the following steps:
s101, receiving an incoming instance operation action and an instance ID server Id;
s102, defining the overtime time as 3-7 minutes after the current time, and a blank state status.
When the message is transferred, the method specifically comprises the following steps:
s201, judging whether the time is overtime, and if not, performing the step S202; if yes, sending different information to a serverstatusResultHandler of the websocket according to different conditions;
s202, judging whether the status is ERROR, if not, continuing to step S203; if yes, sending different information to a serverstatusResultHandler of the websocket according to different conditions;
s203, judging whether status is SOFT _ DELETED, if not, continuing to step S204; if yes, sending different information to a serverstatusResultHandler of the websocket according to different conditions;
s204, judging whether the status is DELETED, if not, continuing to the step S205; if yes, sending different information to a serverstatusResultHandler of the websocket according to different conditions;
s205, judging that the operation action is not VERIFY _ RESIZE and judging that the status is VERIFY _ RESIZE, if not, continuing to step S206; if yes, sending different information to a serverstatusResultHandler of the websocket according to different conditions;
s206, sleeping for a plurality of seconds;
s207, inquiring details through the instance ID, if the inquired instance state is different from the status, continuously assigning the instance state to the status, and if the inquired instance state is the same as the status, performing back-end processing;
s208, sending the instance ID, the instance state and the power state information to a serverstatusHandler of the websocket, and receiving and displaying the instance ID, the instance state and the power state information by the front end.
When the back end is operated, the method specifically comprises the following steps:
s301, judging that the operation is REVERT _ RESIZE and the states are not REVERT _ RESIZE and VERIFY _ RESIZE, if yes, sending the message to a serverstatusResultHandler of the websocket, and if the message is that the migration is cancelled and/or the size adjustment is successful, ending the process; if not, continue to step S302;
s302, judging whether the task in the example details is empty and the operation action is not VERIFY _ RESIZE, if so, continuing to execute the step S303, otherwise, jumping to the step S201;
s303, judging that the operation action is CREATE and the status is BUILD, if so, continuing to step S201, and if not, executing step S304;
s304, sending different messages to a serverStatusResultHandler of the websocket according to different conditions, wherein the conditions and the information are shown in a table:
Figure BDA0003269420780000081
Figure BDA0003269420780000091
the scheme for updating the instance state in real time is provided on the premise that Openstack is not changed and Openstack internal components (DB and MQ) are not associated, the state of the front end is guaranteed to be displayed in time, the front end is informed of a final execution result in time through rear end analysis processing, and finally, the operation result is displayed to a client in time.
The above embodiments are only specific ones of the present invention, and the scope of the present invention includes but is not limited to the above embodiments, and any appropriate changes or substitutions according to the method claims for updating the post-operation state of the example of the present invention and by any person of ordinary skill in the art described in the above should fall within the scope of the present invention.
Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.

Claims (8)

1. A method for updating the state after the operation of an example is characterized in that firstly, the front end, namely a client is displayed and is used as an initiator to synchronously send an example operation request to a back end;
then, the back end receives two kinds of information of the instance state and the operation result which are asynchronously returned through message transfer;
and finally, the received state information directly updates the list data through the instance ID, and the received operation result is displayed through a corresponding component.
2. The method for updating the post-operation state of the instance according to claim 1, wherein the message relay selects a Websocket protocol according to an actual application scenario to perform asynchronous transmission from a back end to a front end.
3. The method of claim 2, wherein the Websocket Handler in the Websocket protocol comprises a serverStatusHandler and a serverStatusResultHandler.
4. The method of updating an instance post-operation state of claim 3,
the server StatusHandler receives the instance state and updates the front-end implementation display state; and the server StatusResultHandler receives the example operation result and the front end receives and displays the example operation result.
5. The method according to claim 4, wherein the back end receives the instance operation request, and performs Openstack API call according to the request, the Openstack instance operation API is an asynchronous interface, and the subsequent query and analysis on the instance details are required to determine the operation result, and the result is transmitted to the message relay and received by the front end.
6. The method according to claim 5, wherein the front-end presentation specifically comprises the following steps:
s101, receiving an incoming instance operation action and an instance ID server Id;
s102, defining the overtime time as 3-7 minutes after the current time, and a blank state status.
7. The method for updating the post-operation state of the instance according to claim 5, wherein the method specifically comprises the following steps during message forwarding:
s201, judging whether the time is overtime, and if not, performing the step S202; if yes, sending different information to a serverstatusResultHandler of the websocket according to different conditions;
s202, judging whether the status is ERROR, if not, continuing to step S203; if yes, sending different information to a serverstatusResultHandler of the websocket according to different conditions;
s203, judging whether status is SOFT _ DELETED, if not, continuing to step S204; if yes, sending different information to a serverstatusResultHandler of the websocket according to different conditions;
s204, judging whether the status is DELETED, if not, continuing to the step S205; if yes, sending different information to a serverstatusResultHandler of the websocket according to different conditions;
s205, judging that the operation action is not VERIFY _ RESIZE and judging that the status is VERIFY _ RESIZE, if not, continuing to step S206; if yes, sending different information to a serverstatusResultHandler of the websocket according to different conditions;
s206, sleeping for a plurality of seconds;
s207, inquiring details through the instance ID, if the inquired instance state is different from the status, continuously assigning the instance state to the status, and if the inquired instance state is the same as the status, performing back-end processing;
s208, sending the instance ID, the instance state and the power state information to a serverstatusHandler of the websocket, and receiving and displaying the instance ID, the instance state and the power state information by the front end.
8. The method of claim 6, wherein the method for updating the post-operation state of the instance specifically comprises the following steps during backend operation:
s301, judging that the operation is REVERT _ RESIZE and the states are not REVERT _ RESIZE and VERIFY _ RESIZE, if yes, sending the message to a serverstatusResultHandler of the websocket, and if the message is that the migration is cancelled and/or the size adjustment is successful, ending the process; if not, continue to step S302;
s302, judging whether the task in the example details is empty and the operation action is not VERIFY _ RESIZE, if so, continuing to execute the step S303, otherwise, jumping to the step S201;
s303, judging that the operation action is CREATE and the status is BUILD, if so, continuing to step S201, and if not, executing step S304;
s304, sending different messages to the serverStatusResultHandler of the websocket according to different conditions.
CN202111096993.3A 2021-09-18 2021-09-18 Method for updating state after instance operation Pending CN113901066A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111096993.3A CN113901066A (en) 2021-09-18 2021-09-18 Method for updating state after instance operation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111096993.3A CN113901066A (en) 2021-09-18 2021-09-18 Method for updating state after instance operation

Publications (1)

Publication Number Publication Date
CN113901066A true CN113901066A (en) 2022-01-07

Family

ID=79028692

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111096993.3A Pending CN113901066A (en) 2021-09-18 2021-09-18 Method for updating state after instance operation

Country Status (1)

Country Link
CN (1) CN113901066A (en)

Similar Documents

Publication Publication Date Title
CN114025037B (en) Cloud mobile phone overhaul method and device, electronic equipment and storage medium
CN113572833B (en) Cloud mobile phone maintenance method and device, electronic equipment and storage medium
CN112291325A (en) Message processing method and device and computer system
CN115514718B (en) Data interaction method, control layer and equipment based on data transmission system
CN113326192B (en) Application testing method, device, equipment and storage medium for mobile terminal
CN113901066A (en) Method for updating state after instance operation
CN113419880B (en) Cloud mobile phone root authority acquisition method, related device and computer program product
CN115129429A (en) Container application management method and device, electronic equipment and storage medium
CN113691937A (en) Method for determining position information, cloud mobile phone and terminal equipment
CN111818468A (en) Message processing method, system and related equipment
CN113766437B (en) Short message sending method and device
CN114095758B (en) Cloud image intercepting method and related device
CN114237741B (en) Installation-free application interaction method and device
CN113886842B (en) Dynamic intelligent scheduling method and device based on test
CN115658341A (en) Method, device, equipment and medium for reading and writing data by Freeswitch
CN115243274A (en) Network distribution method, device, equipment and storage medium
CN113687845A (en) Service processing method, device and system
CN118018522A (en) Network card configuration method, device, equipment and medium
CN114553894A (en) Data synchronization method, device, system and storage medium
CN117294597A (en) Network card binding configuration method, device, equipment and medium
CN117651078A (en) Data transmission method and device, electronic equipment and storage medium
CN115907779A (en) Transaction proposal verification method, device, server and storage medium
CN116582387A (en) Message sending method, device and equipment
CN116962339A (en) Message pushing method, device, equipment and storage medium
CN117785413A (en) Task forwarding method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination