Component upgrade method, device, computer storage medium and system in OpenStack
By configuring the container to start the upgraded component in OpenStack and closing its process after the original component processing is completed, the service interruption problem caused by Cinder component upgrade is solved, and the component's hot upgrade and business continuity is achieved.
Patent Information
- Application Number
- CN202011444093.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-08
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2040-12-08
AI Technical Summary
In OpenStack, Cinder components need to be stopped when upgrading, resulting in user service interruption and business processing failure, and the hot upgrade cannot be achieved.
The component is hot upgraded by configuring the container to start the upgraded component during the operation of the original component, and closing its process after the original component has completed all the pending consumer messages.
It effectively solves the problems of business processing interruptions and failures during service upgrade, realizes component thermal upgrades, and ensures business continuity.
Smart Images

Figure CN114610362B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of software upgrade, and in particular to a component upgrade method, device, computer storage medium, and system in OpenStack. Background Art
[0002] OpenStack is a combination of a series of open source tools (or open source projects) that mainly use pooled virtual resources to build and manage private and public clouds. OpenStack includes the Cinder component, which can be used to manage block storage resources in the OpenStack cloud environment.
[0003] In the current related technical solutions, when upgrading the Cinder component, it is usually necessary to stop the operation of the Cinder component first, and then upgrade it through the downloaded upgrade file. During the upgrade process, due to the cessation of the operation of the Cinder component, the various services that the Cinder component is providing to the user will also be stopped, which will cause some user operations to be interrupted and business processing to fail. Summary of the invention
[0004] The present application provides a component upgrade method, device, computer storage medium and system in OpenStack. During the operation of the original component, the upgraded component is started by configuring a container, which can solve the problem of business processing interruption and failure during the service upgrade process and realize hot upgrade of the original component to the upgraded component.
[0005] The technical solution of this application is implemented as follows:
[0006] In a first aspect, an embodiment of the present application provides a component upgrade method in OpenStack, the method comprising:
[0007] Based on the stop signal obtained by the original component, controlling the original component to close the multiple first consumer processes;
[0008] When it is detected that the original component is in a preset state, the original component is shut down to achieve a hot upgrade of the original component to the upgraded component; wherein the preset state indicates that the original component has completed processing of all the acquired consumption messages to be processed.
[0009] In a second aspect, an embodiment of the present application provides a component upgrade device in OpenStack, the component upgrade device comprising a start unit, a stop unit and a close unit, wherein:
[0010] A startup unit, configured to start the upgraded component by configuring a container during the operation of the original component; wherein the original component includes a plurality of first consumer processes, and the plurality of first consumer processes are used to obtain consumption messages to be processed;
[0011] a stopping unit, configured to control the original component to close the plurality of first consumption processes based on the stopping signal acquired by the original component;
[0012] The shut down unit is configured to shut down the original component when it is detected that the original component is in a preset state, so as to realize a hot upgrade of the original component to the upgraded component; wherein the preset state indicates that the original component has completed processing all the acquired pending consumption messages.
[0013] In a third aspect, an embodiment of the present application provides a component upgrade device in OpenStack, the component upgrade device comprising a memory and a processor; wherein:
[0014] The memory is used to store a computer program that can be run on the processor;
[0015] The processor is used to execute the steps of the method described in the first aspect when running the computer program.
[0016] In a fourth aspect, an embodiment of the present application provides a computer storage medium, which stores a computer program, and when the computer program is executed by at least one processor, the steps of the method described in the first aspect are implemented.
[0017] In a fifth aspect, the present application provides an OpenStack system, which OpenStack system at least includes the component upgrading device as described in the second aspect or the third aspect.
[0018] The embodiment of the present application provides a component upgrade method, device, computer storage medium and system in OpenStack, in which during the operation of the original component, the upgraded component is started by configuring a container; wherein the original component includes a plurality of first consumer processes, and the plurality of first consumer processes are used to obtain consumer messages to be processed; based on the stop signal obtained by the original component, the original component is controlled to close the plurality of first consumer processes; when it is detected that the original component is in a preset state, the original component is closed to achieve a hot upgrade from the original component to the upgraded component; wherein the preset state indicates that the original component has completed processing all the consumer messages to be processed that have been obtained. In this way, during the operation of the original component, the upgraded component is started by configuring a container, and the original component will not be closed until the original component has completed processing all the consumer messages to be processed that have been obtained, which will not affect the business being processed, thereby effectively solving the problem of business processing interruption and failure during the service upgrade process, and can achieve a hot upgrade from the original component to the upgraded component. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 A flowchart of a component upgrade method in OpenStack provided in an embodiment of the present application;
[0020] Figure 2 A schematic diagram of an interface of a message queue management tool provided in an embodiment of the present application;
[0021] Figure 3 A schematic diagram of an interface of another message queue management tool provided in an embodiment of the present application;
[0022] Figure 4 A schematic diagram of an interface of another message queue management tool provided in an embodiment of the present application;
[0023] Figure 5 A schematic diagram of an application scenario of a Cinder component provided in an embodiment of the present application;
[0024] Figure 6 A flowchart of another component upgrade method in OpenStack provided in an embodiment of the present application;
[0025] Figure 7 A business process diagram of a component upgrade method in OpenStack provided in an embodiment of the present application;
[0026] Figure 8 A schematic diagram of the structure of a component upgrade device in OpenStack provided in an embodiment of the present application;
[0027] Fig. 9A schematic diagram of the composition structure of another component upgrade device in OpenStack provided in an embodiment of the present application;
[0028] Fig.10 A schematic diagram of a specific hardware structure of a component upgrade device in OpenStack provided in an embodiment of the present application;
[0029] Fig.11 A schematic diagram of the composition structure of an OpenStack system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] The technical solutions 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.
[0031] OpenStack is a combination of a series of open source tools (or open source projects) that use pooled virtual resources to build and manage private and public clouds. Five of the projects are responsible for handling core cloud computing services, including computing, networking, storage, identity, and image services. There are more than a dozen other optional projects that users can bundle and package to create unique, deployable cloud architectures.
[0032] The Cinder component is responsible for the management of block storage resources in the OpenStack cloud environment. It supports all lifecycle activities of volumes and provides storage resources to end users of the computing service (Nova). The Cinder component is mainly composed of four modules: Cinder-API, Cinder-Scheduler, Cinder-Volume, and Cinder-Backup. Each part provides corresponding services to users, so it can also be called Scheduler service, Volume service, and Backup service. Here, the services that these four parts can provide are as follows:
[0033] (1) Cinder-API: provides a REST API interface to the outside world and receives service requests;
[0034] (2) Cinder-Scheduler (hereinafter referred to as Scheduler): Create a new resource scheduling service and select the appropriate backend based on the request conditions;
[0035] (3) Cinder-Volume (hereinafter referred to as Volume): The volume function service entity provides management operations such as volume creation, deletion, mounting, and unmounting;
[0036] (4) Cinder-Backup (hereinafter referred to as Backup): The volume backup service entity provides backup management operations such as volume backup creation, volume backup data recovery, and volume backup deletion.
[0037] In the related art, when services such as Scheduler, Volume, and Backup need to be upgraded, the Scheduler, Volume, and Backup services need to be stopped, which will cause some operations to be interrupted and business processing to fail.
[0038] Based on this, the embodiment of the present application provides a component upgrade method, the basic idea of which is: during the operation of the original component, the upgraded component is started by configuring the container; wherein the original component includes multiple first consumer processes, and the multiple first consumer processes are used to obtain consumer messages to be processed; based on the stop signal obtained by the original component, the original component is controlled to close the multiple first consumer processes; when it is detected that the original component is in a preset state, the original component is closed to achieve a hot upgrade from the original component to the upgraded component; wherein the preset state indicates that the original component has completed processing all the consumer messages to be processed that have been obtained. In this way, during the operation of the original component, the upgraded component is started by configuring the container, and the original component will not be closed until the original component has completed processing all the consumer messages to be processed that have been obtained, which will not affect the business being processed, thereby effectively solving the problem of business processing interruption and failure during the service upgrade process, and can achieve a hot upgrade from the original component to the upgraded component.
[0039] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0040] In one embodiment of the present application, see Figure 1 , which shows a schematic diagram of a process for upgrading components in OpenStack provided by an embodiment of the present application. Figure 1 As shown, the method may include:
[0041] S101: While the original component is running, the upgraded component is started by configuring a container.
[0042] It should be noted that, the original component includes multiple first consumer processes, and the multiple first consumer processes are used to obtain consumption messages to be processed.
[0043] It should be noted that the original component refers to the component before the upgrade (sometimes also referred to as a service or application), and the upgraded component refers to the component after the original component is upgraded.
[0044] In the embodiment of the present application, the upgraded component is deployed in the form of a container (such as Docker). That is, without affecting the original component, the upgraded component can be deployed on the physical machine by configuring the container. In addition, the original component can be non-containerized or already containerized.
[0045] In a specific embodiment, when the original component provides normal services to the user, the configuration container corresponding to the upgraded component provided by the cloud is copied to the local computer by mirroring, and then the upgraded component is started by the configuration container. At this time, for the local computer, there are two running components, namely the original component and the upgraded component started by the configuration container, which provide services to the user at the same time.
[0046] It should be noted that both the original component and the upgraded component are designed using a producer-consumer architecture. Specifically, the producer-consumer architecture includes two functional roles, namely producers and consumers; producers are responsible for generating data, while consumers are responsible for processing data, but producers and consumers do not exchange data directly, but communicate through a buffer, that is, the producer sends the generated data in the form of a message to an independent buffer, and when the consumer listens to the message that needs to be processed, it obtains the message from the buffer for processing. In addition, the buffer is independent of the original component and the upgraded component. The advantage of this is that the producer no longer relies on the processing speed of the consumer and can give full play to the work efficiency of the producer; the coupling between producers and consumers is reduced, and the complexity of system upgrades is reduced. The buffer can be implemented in a variety of forms. In an embodiment of the present application, the buffer is implemented in the form of a message queue cluster.
[0047] Therefore, the original component includes multiple first consumer processes to obtain pending consumer messages, that is, the consumers in the original component need to obtain pending consumer messages from the message queue cluster through the first consumer process, and then process the obtained pending consumer messages.
[0048] Furthermore, in some embodiments, before starting the upgraded component by configuring the container, the method may further include:
[0049] A startup transformation operation is performed on the configuration container so that the configuration container can start the upgraded component during the operation of the original component; wherein the startup transformation operation is used to reset the state value of each of a plurality of storage units according to a preset state value when the configuration container starts the upgraded component, and the plurality of storage units are management objects of the upgraded component.
[0050] It should be noted that the component upgrade method described in the embodiment of the present application can be applied to the cinder component, which is a component used to manage multiple storage units in the system. In the related technical solution, two cinder components cannot be started at the same time, so the cinder component will automatically detect the status values of all storage units after startup. If it is found that some storage units are executing tasks issued by another cinder component, an error will be reported. Therefore, in order to be able to start the upgraded component during the operation of the original component, it is necessary to start the configuration container, that is, reset the status values of multiple storage units to avoid errors.
[0051] S102: Based on the stop signal obtained by the original component, control the original component to close the multiple first consumption processes.
[0052] It should be noted that for the original component, the consumer can obtain the pending consumption message through the first consumption thread, and then execute (or process, consume) the pending consumption message. Therefore, in order to achieve the hot upgrade from the original component to the upgraded component, it is necessary to use the stop signal to shut down multiple first consumption processes in the original component. In this way, the original component can no longer receive new pending consumption messages.
[0053] It should be understood that the stop signal stops the "multiple first consumer processes" in the original component, that is, the process of the original component obtaining pending consumer messages is stopped, while the original component can still process the pending consumer messages obtained before, and the stop signal does not affect the original component sending data to the "buffer". Therefore, although the first consumer process in the original component is closed, the task being processed will not be interrupted.
[0054] Since it takes a certain amount of time to start the upgraded component, in some embodiments, after starting the upgraded component by configuring the container, the method may further include:
[0055] Acquire the total number of consumers; wherein the total number of consumers represents the sum of the number of first consumers included in the original component and the number of second consumers included in the upgraded component;
[0056] When the total number of consumers is equal to twice the number of the first consumers, the step of obtaining multiple process identifiers corresponding to the multiple first consumer processes is performed.
[0057] It should be noted that the original component includes multiple first consumers, and the upgraded component includes multiple second consumers. In theory, the second consumers in the upgraded component correspond one-to-one to the first consumers in the original component. Assuming that there are N first consumers in the original component, after the upgraded component runs normally, there should be (2*N) consumers on the physical machine.
[0058] However, since it takes a certain amount of time to start the upgraded component, that is, the number of second consumers in the upgraded component is gradually increasing, it is necessary to wait until all second consumers in the upgraded component are started before the first consumer process can be shut down by the stop signal. Otherwise, it is possible that a consumer in the upgraded component has not started normally, but the consumer process of the corresponding consumer in the original component has been shut down. In this case, the pending consumer messages belonging to the consumer will be backlogged in the message queue cluster, triggering an alarm.
[0059] In a specific implementation, there are many message queue cluster tools that can manage consumers of the message queue cluster, so the total number of consumers can be monitored to determine whether all second consumers are started normally. When it is found that the number of consumers on the physical machine reaches (2*N), it proves that all consumers in the upgraded component have been started, and multiple first consumer processes in the original component can be shut down.
[0060] Specifically, obtaining the number of consumers can be achieved through a message queue management tool or a command line tool.
[0061] When using message queue management tools to obtain the number of consumers, see Figure 2 , which shows a schematic diagram of the interface of a message queue management tool provided in an embodiment of the present application; see Figure 3 , which shows a schematic diagram of the interface of another message queue management tool provided in an embodiment of the present application. Figure 4 , which shows a schematic diagram of the interface of another message queue management tool provided by an embodiment of the present application. Figure 2 As shown in the figure, the message management tool is Rabbit MQ. First, log in to the message queue management tool using your username and password. Figure 3 As shown, after successful login, you can see all the message queues in the system and select the target message queue (cinder-Backup.cinder-cinder-volume) to enter; Figure 4 As shown, after clicking Open, you can see the number of consumers of the target message queue. Assuming that the number of consumers in the original component is 5, then when the upgraded component starts successfully, the number of consumers will become 10, and then you can proceed to close multiple first consumer processes.
[0062] In addition, when you use the command line tool to obtain the number of consumers, you can get the number of consumers returned by entering the specified command field, for example:
[0063] “
[0064] [root@ct13~]#rabbitmqctl list_consumers|grep cinder-backup.cinder-cinder-volum
[0065] cinder-backup.backup.cinder-cinder-volum<rabbit@ct11.3.21469.107> 2true 0[]
[0066] cinder-backup.backup.cinder-cinder-volum<rabbit@ct12.2.14867.157> 2true 0[]
[0067] cinder-backup.backup.cinder-cinder-volum<rabbit@ct11.3.21448.107> 2true 0[]
[0068] cinder-backup.backup.cinder-cinder-volum<rabbit@ct11.3.21434.107> 2true 0[]
[0069] cinder-backup.backup.cinder-cinder-volum<rabbit@ct11.3.21423.107> 2true 0[]
[0070] [root@ct13~]#”
[0071] From the above returned content, you can get the message queues contained in the current system and the consumers corresponding to each message queue.
[0072] From the above description, it can be seen that the essence of judging "the total number of consumers is equal to twice the number of the first consumers" is to judge "whether the second consumer in the upgraded component has been started normally". Therefore, as long as the technical means can be achieved to judge "whether the second consumer in the upgraded component has been started normally", it can be used to replace the condition "the total number of consumers is equal to twice the number of the first consumers".
[0073] It should also be noted that after the upgraded component is started and before all the second consumers in the upgraded component are started normally, there may be two identical consumers for the message queue cluster. Taking cinder as an example, the cinder before the upgrade (equivalent to the original component) includes the Scheduler module, the Volume module and the Backup module. Assuming that at a certain point in time, the upgraded cinder (equivalent to the upgraded component) only starts the Scheduler module and the Volume module, and the Backup module is still starting, then for the message queue cluster, if there are pending consumption messages sent to the "Scheduler module", then they can be sent to the "Scheduler module" in the cinder before the upgrade, or to the "Scheduler module" in the cinder after the upgrade. In order to avoid conflicts between the two, the distribution mechanism of the message queue cluster is stipulated so that the message queue cluster can randomly distribute the pending consumption messages to the "Scheduler module" in the cinder before the upgrade or the "Scheduler module" in the cinder after the upgrade.
[0074] It should also be noted that for cinder, it includes three nodes: Scheduler module, Volume module and Backup module. So when upgrading cinder, you can upgrade the entire "Scheduler, Volume and Backup" at one time, but this upgrade is stressful and time-consuming, so you can also choose to upgrade in units of "nodes". So in some embodiments, the original component includes a first original node, a second original node and a third original node, and accordingly, the upgraded component includes a first new node, a second new node and a third new node. In this hot upgrade scenario, the specific upgrade steps are as follows:
[0075] While the original component is running, start the upgraded component by configuring the container;
[0076] When the total number of consumers of the first new node is the same as the total number of consumers of the first original node, multiple first consumption processes corresponding to the first original node are stopped by a stop signal, so that the first new node obtains the new consumption message to be processed through the second consumption process;
[0077] When the total number of consumers of the second new node is the same as the total number of consumers of the second original node, multiple second consumption processes corresponding to the second original node are stopped by a stop signal, so that the second new node obtains the new consumption message to be processed through the second consumption process;
[0078] When the total number of consumers of the third new node is the same as the total number of consumers of the third original node, multiple third consumption processes corresponding to the third original node are stopped by a stop signal, so that the third new node obtains the new consumption message to be processed through the second consumption process;
[0079] When it is detected that the original component has finished executing the acquired consumption message to be processed, the original component is closed to achieve hot upgrade of the original component to the upgraded component.
[0080] In this way, by shutting down multiple nodes in sequence, hot upgrading of the original components to the upgraded components is also achieved. This technical solution can be regarded as a refinement of the technical solution recorded in the independent claim in a specific application scenario, and is also within the protection scope of this application.
[0081] Furthermore, in the original component, each first consumer process has its own process identifier, so that the corresponding first consumer process can be accurately closed using the stop signal. Therefore, in some embodiments, the control of the original component to close the multiple first consumer processes based on the stop signal obtained by the original component may include:
[0082] Obtain multiple process identifiers corresponding to the multiple first consumer processes;
[0083] Based on the obtained multiple process identifiers, generating the stop signal;
[0084] Accordingly, controlling the original component to close the plurality of first consumer processes based on the stop signal acquired by the original component may include:
[0085] When the original component obtains the stop signal, the original component is controlled to determine the multiple process identifiers according to the stop signal, and close the multiple first consumer processes according to the multiple process identifiers.
[0086] It should be noted that the stop signal (or stop semaphore) can be understood as a function, which is used to close (kill) the consumer process in the original component. Specifically, multiple process identifiers of multiple first consumer processes are obtained, that is, the process identifiers corresponding to the multiple first consumer processes that need to be closed, and the stop signal is generated according to the obtained multiple process identifiers.
[0087] When the original component obtains the stop signal, multiple process identifiers can be determined according to the stop signal, and then multiple first consumer processes are closed according to the multiple process identifiers.
[0088] The stop signal can be implemented in a variety of ways. In a specific embodiment, a Linux operating system is installed in a physical machine, and a user-editable Linux process standard signal, such as signal 10 ('SIGUSR1'10), can be used as the main body of the stop signal. After obtaining multiple consumer process identifiers, the stop signal is generated using signal 10 and multiple consumer process identifiers. When the original component monitors the stop signal, it will stop the corresponding first consumer process.
[0089] Furthermore, in some embodiments, the upgraded component includes a plurality of second consumer processes; after controlling the original component to close the plurality of first consumer processes, the method may further include:
[0090] When a new consumption message to be processed is received, the upgraded component is controlled to obtain the new consumption message to be processed through the second consumption process, and the upgraded component is controlled to process the new consumption message to be processed.
[0091] It should be noted that the structure of the upgraded component and the original component is basically the same. After the upgraded component is started, the original component can obtain the pending consumption messages from the message queue cluster through the first consumer process. Similarly, the upgraded component can also obtain the pending consumption messages from the message queue cluster through the second consumer process.
[0092] Therefore, after receiving the new pending consumption message, the original component cannot obtain the "new pending consumption message" because the multiple first consumption processes in the original component are closed. Therefore, the upgraded component will obtain the new pending consumption message through the second consumption process and then process it.
[0093] Taking cinder as an example, the cinder before the upgrade (equivalent to the original component) includes several modules including Scheduler, Volume and Backup. Similarly, the upgraded cinder (equivalent to the upgraded component) also includes several modules including Scheduler, Volume and Backup. The upgrade is generally an improvement on the specific functions or processes in the module, rather than deletion or modification at the module level. When both the cinder before the upgrade and the cinder after the upgrade are in operation, if there are pending consumption messages for the "Scheduler module" in the message queue cluster, then the Scheduler node in the original component and the Scheduler module in the upgraded component can obtain the pending consumption messages of this "Scheduler module" through their respective consumption threads. However, since the stop signal stops the first consumer program in the original component, the Scheduler module in the original component cannot obtain the "new pending consumption messages for the Scheduler module", so the "new pending consumption messages for the Scheduler module" will be obtained by the Scheduler module in the upgraded component and executed by the upgraded component.
[0094] Therefore, after the stop signal controls the original component to stop the multiple first consumer processes, new to-be-processed consumer messages will be acquired by the upgraded component through the second consumer process.
[0095] In this way, the stop signal can stop multiple first consumer processes in the original component, so that the original component cannot obtain new consumption messages to be processed, but the ongoing tasks of the original component will not be interrupted.
[0096] S103: When it is detected that the original component is in a preset state, shut down the original component to achieve hot upgrade of the original component to the upgraded component.
[0097] It should be noted that the preset state indicates that the original component has completed processing of all the acquired consumption messages to be processed.
[0098] It should be noted that after step S102, the original component will not receive any new pending consumption messages. Therefore, when the original component finishes executing the previously received pending consumption messages, the original component can be shut down. At this time, only the upgraded component remains on the physical machine, thereby realizing the hot upgrade from the original component to the upgraded component. At the same time, during the entire hot upgrade process, there is no task interruption, and a smooth upgrade can be achieved.
[0099] It should also be noted that for component upgrades, a rollback solution is also required, that is, if the upgraded component cannot work properly due to various reasons, it can be returned to the original component. Therefore, after obtaining the stop signal and controlling the original component to stop multiple first consumer processes based on the stop signal, the method may also include:
[0100] In the case where the upgraded component fails to start, generating an activation signal based on a plurality of process identifiers corresponding to the plurality of first consumer processes;
[0101] When the original component obtains the activation signal, the original component is controlled to start the multiple first consumption processes, so that the original component starts to obtain new consumption messages to be processed.
[0102] It should be noted that, in the event that the upgraded component fails to run, an activation signal can be directly generated based on multiple process identifiers corresponding to multiple first consumer processes, and then the first consumer process can be activated by the activation signal without restarting the original component.
[0103] Similar to the stop signal, the activation signal (or activation semaphore) is also implemented in a variety of forms. In a specific embodiment, a Linux operating system is installed in the physical machine, and a user-editable Linux process standard signal such as signal 12 ('SIGUSR1'12) can be used as the main body of the stop signal. Therefore, the activation signal is generated using signal 12 and the process identifiers of multiple first consumer processes. When the original component listens to the activation signal, the corresponding first consumer process will be stopped.
[0104] In the related art, since the original component cannot be hot-upgraded, the rollback solution is generally to restart the original component, which will cause the task to be interrupted again. In the embodiment of the present application, the "stopped first consumer process" in the original component can be directly activated by an activation signal without restarting the original component, so the task will not be interrupted or failed, thereby providing a better rollback solution.
[0105] Furthermore, in some embodiments, the original component further includes a task list, and the task list records the to-be-processed consumption messages acquired by the original component. The method may further include:
[0106] For one of the pending consumption messages in the task list, controlling the original component to process the one of the pending consumption messages;
[0107] When the processing of one of the pending consumption messages is completed, the one of the pending consumption messages is removed from the task list.
[0108] It should be noted that for the original component, a global task list is maintained. When the original component obtains a pending consumption message, it will record the pending consumption message into the task list; and when the original component completes the execution of the pending consumption message, it will remove the pending consumption message. In other words, the task list records the pending consumption messages that the original component obtains but has not completed, so as to manage the running tasks in the original component.
[0109] Due to the existence of the task list, it is easy to determine whether the original component is in a preset state. In some embodiments, before closing the original component, the method may further include:
[0110] Detect whether the task list is empty;
[0111] When it is detected that the task list is empty, it is determined that the original component is in a preset state.
[0112] It should be noted that when the task list is empty, it proves that the original component has executed all pending consumption messages previously obtained, and the original component can be exited to complete the hot upgrade process of the original component to the upgraded component.
[0113] In summary, in the relevant technical solutions, there is no hot upgrade solution for Scheduler, Volume and Backup modules. When applied to the production environment, when the Cinder component needs to be upgraded, it is necessary to stop the services provided by Scheduler, Volume and Backup modules to users, which will cause some operations to be interrupted and business processing to fail. The embodiment of the present application provides a hot upgrade method for the cinder module, which specifically solves the following technical problems:
[0114] (1) Solve the service hot upgrade problem of Cinder components based on MQ consumption services;
[0115] (2) Stop and activate MQ consumption capability through signals 10 and 12;
[0116] (3) Solve the problem of business processing interruption and failure during component upgrade;
[0117] (4) The original components do not need to be restarted during service upgrade and rollback.
[0118] The embodiment of the present application provides a component upgrade method, which includes: during the operation of the original component, starting the upgraded component by configuring a container; wherein the original component includes multiple first consumer processes, and the multiple first consumer processes are used to obtain pending consumer messages; based on the stop signal obtained by the original component, controlling the original component to close the multiple first consumer processes; when it is detected that the original component is in a preset state, closing the original component to achieve a hot upgrade from the original component to the upgraded component; wherein the preset state indicates that the original component has completed processing all the pending consumer messages that have been obtained. In this way, during the operation of the original component, the upgraded component is started by configuring a container, and the original component will not be closed until the original component has completed processing all the pending consumer messages that have been obtained, which will not affect the business being processed, thereby effectively solving the problem of business processing interruption and failure during the service upgrade process, and can achieve a hot upgrade from the original component to the upgraded component.
[0119] In another embodiment of the present application, the aforementioned component upgrade method is specifically described by taking the Cinder module as an example.
[0120] In the embodiment of the present application, the overall architecture and related codes of the Cinder module need to be modified (see the detailed description below for the specific modification) so that the Cinder module can be upgraded through the aforementioned hot upgrade method. Here, the main purpose of the modification is: (1) to integrate the Scheduler module, Volume module and Backup module in the Cinder module into a container, so as to deploy it on a physical machine, so that the Cinder module can be started through the container; (2) to dynamically control the consumption capacity of the Cinder module through semaphores 10 and semaphores 12 without affecting the business being processed.
[0121] See also Figure 5 , which shows a schematic diagram of an application scenario of a Cinder component 20 provided in an embodiment of the present application. Figure 5 As shown, the overall structure of the Cinder component 20 includes a Cinder-Scheduler module 201, a Cinder-Volume module 202 and a Cinder-Backup module 203, through an application program interface 205 and a structured database (SQL DB).
[0122] The Cinder-Scheduler module 201, the Cinder-Volume module 202 and the CinderBackup module 203 constitute a containerized whole (this containerized whole can be considered as a Cinder module), which is connected to the client 205 via an application program interface 204. At the same time, a structured database (SQL DB) is used to store data generated during business processing.
[0123] For the user, the service request is sent through the client 205, and then the client 205 sends the service request to the Cinder-Scheduler module 201, the Cinder-Volume module 202 and the Cinder-Backup module 203 through the application interface 204 for completion. After that, the Cinder-Scheduler module 201, the Cinder-Volume module 202 and the Cinder-Backup module 203 provide the user with Scheduler service, Volume service and Backup service respectively.
[0124] like Figure 5 As shown, the Cinder-Scheduler module 201, Cinder-Volume module 202, Cinder-Backup module 203 and other service interactions are all implemented through the message queue protocol (AMPQ). The business model of AMPQ consists of producers and consumers, and consumers can dynamically start and stop consumption without stopping the task being processed.
[0125] The transformation of Cinder components is specifically implemented in three aspects: (1) the transformation of the startup process of the Scheduler, Volume, and Backup modules; (2) the transformation of semaphore control MQ consumption capabilities; (3) the containerized deployment of components. Among them, (3) the containerized deployment of components can refer to the relevant technology, and the embodiments of this application will not be described in detail. The specific implementation methods of (1) and (2) will be described below.
[0126] First, the startup process transformation of Scheduler, Volume, and Backup services can include:
[0127] (1) The Scheduler service startup process will detect the volume status and reset the creating status volume to error. If this function entry is blocked, the Scheduler service startup will not affect the existing newly created volumes.
[0128] (2) The Volume service startup process will detect and reset the volume status and block the function entry:
[0129] Volume:
[0130] creating->error
[0131] downloading->error
[0132] uploading->in-use(when attached to instance)
[0133] uploading->available(when not attached)
[0134] deleting->resuming delete on volume
[0135] (3) The Backup service startup process will detect and reset the volume status and block the function entry:
[0136] Volume:
[0137] backing-up->in-use(when attached to instance)
[0138] backing-up->available(when not attached)
[0139] restoring-backup->error_restoring
[0140] Backup:
[0141] creating->error
[0142] restoring->available
[0143] deleting->resuming delete on backup
[0144] Secondly, the transformation of semaphore control MQ consumption capability can include:
[0145] (1) Select signal 10 and signal 12 semaphores;
[0146] Currently, the process signals that can be captured during the startup of the Cinder service are: {'SIGHUP':1,'SIGSYS':31,'SIGQUIT':3,'SIGUSR1':10,'SIGFPE':8,'SIGTSTP':20,'SIGWINCH':28,'SIGCLD':17,'SIGIOT':6,'SIGBUS':7,'SIGXCPU':24,'SIGCONT':18,'SIGPROF':27,'SIGPOLL':29,'SIGKILL':9,'SIGSEGV':11,'SIGINT' :2,'SIGIO':29,'SIGTRAP':5,'SIGILL':4,'SIGUSR2':12,'SIGABRT':6,'SIGALRM':14,'SIGXFSZ':25,'SIGCHLD':17,'SIGPIPE':13,'SIGTERM':15,'SIGVTALRM':26,'SIGRTMIN':34,'SIGRTMAX':64,'SIGURG':23,'SIGPWR':30,'SIGSTOP':19,'SIGTTOU':22,'SIGTTIN':21}. These are all standard semaphores for Linux processes, of which 10 ('SIGUSR1') and 12 ('SIGUSR2') are user-programmable semaphores. Currently, no additional operations are performed on these two semaphores during the operation of the Cinder service, so these two semaphores need to be added as signals for MQ consumption capacity control.
[0147] (2) Scheduler, Volume, and Backup service transformation
[0148] The service transformation goals of this part are: ①SIGUSR1(10): Stop MQ server and do wait. Signal 10 triggers the service of the current process to stop MQ consumption; ②SIGUSR2(12): Start MQ server. Signal 12 triggers the service of the current process to activate MQ consumption.
[0149] There are two ways to start the Scheduler, Volume, and Backup services:
[0150] ①Multi-worker mode (i.e. a service consists of a main process and multiple sub-processes)
[0151] launcher=service.get_launcher()
[0152] launcher.launch_service(server)
[0153] service.ProcessLauncher(CONF,restart_method='mutate')
[0154] ②Single worker mode (i.e. a service consists of one process)
[0155] service.serve(server)
[0156] service.launch(CONF,server,workers=workers)
[0157] ServiceLauncher(conf,restart_method=restart_method)
[0158] Among them, Cinder's own service object Service is the actual business processing object, ProcessLauncher and ServiceLauncher are Service process management objects, which provide services to start, restart, stop and other operations by capturing service signals. The corresponding business transformation is also divided into two parts:
[0159] Service transformation: Add handle_signal_10 and handle_signal_12 methods. These two methods are called when ProcessLauncher and ServiceLauncher capture signals 10 and 12. The specific steps are:
[0160] ① handle_signal_10: Call rpcserver.stop() to stop the consumer's consumption capability. After the method is called, the current process service will stop consuming new RPC requests.
[0161] ②handle_signal_12: Call rpcserver.start() to activate the consumer's consumption capability. After the method is called, the current process service will activate the consumption capability of the RPC request.
[0162] ProcessLauncher and ServiceLauncher transformation: These two base classes belong to the basic components (oslo_service) that serve OpenStack. In order to avoid the modification being too invasive, two new service base classes CMCCProcessLauncher and CMCCServiceLauncher used by Cinder components are added here. These two base classes inherit from the above-mentioned ProcessLauncher and ServiceLauncher respectively.
[0163] For CMCCProcessLauncher, rewrite handle_signal and _child_process_handle_signal, and add _handle_signal_10 and _handle_signal_12. The specific steps are as follows:
[0164] ①handle_signal: used by the main process to capture 10 ('SIGUSR1') and 12 ('SIGUSR2') and call the newly added methods _handle_signal_10 and _handle_signal_12.
[0165] ②_child_process_handle_signal: The child process under the user main process captures 10 ('SIGUSR1') and 12 ('SIGUSR2') and calls the newly added methods _handle_signal_10 and _handle_signal_12.
[0166] ③_handle_signal_10: Call the actual service Service object to stop MQ consumption.
[0167] ④_handle_signal_12: Call the actual service Service object to activate MQ consumption.
[0168] For CMCCServiceLauncher, rewrite handle_signal and add _handle_signal_10 and _handle_signal_12. The specific steps are as follows:
[0169] ①handle_signal: used by the current process to capture 10 ('SIGUSR1') and 12 ('SIGUSR2') and call the newly added methods _handle_signal_10 and _handle_signal_12.
[0170] ②_handle_signal_10: Call the actual service Service object to stop MQ consumption.
[0171] ③_handle_signal_12: Call the actual service Service object to activate MQ consumption.
[0172] According to the above steps, you can complete the transformation of Scheduler, Volume, and Backup services.
[0173] An embodiment of the present application provides a component upgrade method. Through the detailed explanation of the above-mentioned embodiment in this embodiment, it can be seen that during the operation of the original component, the upgraded component is started by configuring the container, and the original component will not be closed until the original component has processed all the acquired pending consumption messages. This will not affect the business being processed, thereby effectively solving the problem of business processing interruption and failure during the service upgrade process, and can realize the hot upgrade of the original component to the upgraded component.
[0174] In another embodiment of the present application, for the modified cinder component, see Figure 6 , which shows a flow chart of another component upgrade method in OpenStack provided by an embodiment of the present application. Figure 6 As shown, the method may include:
[0175] S301: Start the upgraded component by configuring the container. At this time, the total number of consumers of the consumer subject doubles, and new tasks are randomly performed on the original component and the upgraded component.
[0176] It should be noted that after the transformation of the cinder module, the Scheduler service, Volume service, and Backup service are containerized as a whole. Therefore, when upgrading the cinder component, you can copy the configuration container provided by the cloud to the local through the image without affecting the operation of the original component, and then start the upgraded component (or service program) through the configuration container.
[0177] It should also be noted that since the cinder module interacts through the producer-consumer model, that is, both the upgraded component and the original component include consumers, and the number of consumers is the same. Therefore, if the upgraded component is fully started, the current system consumers will double compared to before the upgraded component is started.
[0178] Therefore, the original component and the upgraded component each include a set of consumers. If a new consumption message is received, it will be executed randomly by one of the two.
[0179] S302: Then use kill-10 <service process number, separated by spaces> to stop the MQ consumption of the original component. At this time, you will find that the total number of consumers will gradually decrease, and all new requests will be consumed by the upgraded component.
[0180] It should be noted that the MQ consumption of the original component is stopped by calling the stop semaphore. The specific form of the stop semaphore is kill-10 <service process number, separated by spaces>, and the service process number is used to identify the process to be stopped.
[0181] It should be noted that the service process stopped by kill-10 refers to the process of the consumer obtaining consumption messages from the message queue cluster, while the process of the consumer node processing the previously obtained consumption messages and returning data to the message queue cluster will not be affected.
[0182] In this way, since the MQ consumption of the original component is gradually stopped, the total number of consumers of the original component is gradually reduced. It should be understood that consumers are essentially a functional role. Take the Backup service as an example. The Backup service acts as a consumer in a consumption process. When the consumption process is stopped, the consumer role played by the Backup service in this consumption process also does not exist, but the Backup service itself will not be affected.
[0183] S303: Monitor the original component log and the status of the integrated task processing node. When the original component does not have any ongoing tasks, stop the original component, thereby completing the hot upgrade of the component in the live network.
[0184] It should be noted that when all MQ consumption of the original component is stopped, the original component will no longer receive any new consumption messages, but the original component may still contain previously received consumption messages. Therefore, monitor the original component logs and comprehensively check the status of all task processing nodes (i.e. Scheduler service, Volume service and Backup service). When the original component does not have any ongoing consumption messages, the service can be stopped, thus completing the live network hot upgrade of the cinder component.
[0185] That is to say, the core of this point is to monitor the task status of the original component. When the original component does not have any ongoing tasks (or when all tasks of the original component are completed), the original component is stopped and the original component is offline. In a specific embodiment, the task monitoring of the original component is realized by adding an MQ task management module, which includes the following steps:
[0186] (1) Each component's child process maintains a global MQ service task list in its own process space;
[0187] (2) All consumed MQ tasks will be added to the MQ service task list. When the task is completed, it will be automatically removed from the task list (for example, through the decorator design pattern);
[0188] (3) Each element of the MQ task list is a string consisting of the resource UUID and the name of the called MQ method, which is unique (i.e., the same resource will not call the same method at the same time; even if it is called multiple times (which exists in the failure retry scenario), it needs to be removed multiple times before it can be cleared).
[0189] (4) When the MQ service task list of the child process is empty, it means that all MQ tasks of the child process have been completed; when the MQ service task list of all child processes under a component is empty, it means that all tasks of the component have been completed. At this time, the component is stopped to complete the offline of the original component;
[0190] (5) From the previous step, we can see that a service corresponds to multiple sub-processes, and each sub-process corresponds to an MQ service task list. This relationship can be saved in the database: (a) When each sub-process of the original component executes kill-10 (or systemctl kill --signal=10 <service-name>) operation, the corresponding sub-process service status is marked as starting in the database (indicating the start of MQ consumption interruption), and the MQ service task list is started (a periodic loop to check whether the global list content is empty); (b) When the MQ service task list of the sub-process is not empty, the corresponding sub-process service status is marked as processing in the database (indicating that there are ongoing tasks in the current sub-process); (c) When the MQ service task list of the sub-process is empty, the corresponding sub-process service status is marked as completed in the database (indicating that all tasks of the current sub-process are completed); (d) When each sub-process of the original component executes kill-12 (or systemctl kill --signal=12 <service-name>) operation (upgrade failure, original component online) or stop component (upgrade success, original component offline), the corresponding process status record of the component in the database will be deleted.
[0191] (6) Operation and maintenance personnel can obtain the task status of the node and node process corresponding to the current component through REST API or CLI (command line) request, and the displayed information is the relevant content of the description.
[0192] When the service status of all subprocesses of the component is completed, the command to stop the original component can be triggered to complete the offline of the original component.
[0193] S304: When the upgraded component fails to be upgraded, the MQ consumption of the original component is deactivated through kill-12 <service process number, separated by spaces>.
[0194] It should be noted that there are many reasons for component upgrade failure after the upgrade, such as the new service code in the configuration container has problems and cannot run on the existing network; or the code is incompatible with the actual system environment, etc. In addition, regardless of whether the new container service is available, the existing network upgrade plan must provide a fallback plan for upgrade failure.
[0195] In the embodiment of the present application, the semaphore Kill-10 is used to stop the consumer's consumption, and the semaphore Kill-12 is used to restore the consumer's consumption ability. In other words, if the upgrade fails, the original component does not need to be restarted, and only the stopped consumption process in the original component needs to be restarted.
[0196] An embodiment of the present application provides a component upgrade method, and the specific implementation of the aforementioned embodiment is elaborated in detail through this embodiment. It can be seen that during the operation of the original component, the upgraded component is started by configuring the container, and the original component will not be closed until the original component has processed all the acquired pending consumption messages. This will not affect the business being processed, thereby effectively solving the problem of business processing interruption and failure during the service upgrade process, and can realize the hot upgrade of the original component to the upgraded component.
[0197] In yet another embodiment of the present application, see Figure 7 , which shows a business process diagram of a component upgrade method in OpenStack provided by an embodiment of the present application. Figure 7 In the business process of the hot upgrade method, there are several parts including semaphore (Linux Signal) 401, original service 402, containerized new service 403, message queue (MQ) cluster 404 and new request business flow 405. Among them,
[0198] For semaphore 401, it includes stop semaphore and activation semaphore, which are used to stop consumption process and activate consumption process respectively; for original service 402, it refers to the original component before upgrading, which is equivalent to the aforementioned original component; for containerized new service 403, it is obtained through upgraded Docker containerization, which is equivalent to the aforementioned upgraded component; for message queue cluster 404, it includes multiple consumption messages. Specifically, the producer puts the consumption message after production into the message queue (MQ) 404 cluster, and the corresponding consumer takes the consumption message from the message queue (MQ) 404 cluster for consumption; in addition, the interaction between producer / consumer and message queue cluster is carried out through remote promotion call protocol (RPC); for newly applied business flow, it refers to the business request of the user.
[0199] Based on the above structure, the hot upgrade process can be divided into three stages:
[0200] In the first stage, see the black line part, both the original service 402 and the containerized new service 403 can obtain consumption messages from the message queue cluster 404 and consume them;
[0201] In the second stage, see the gray line part, the consumption capability of the original service 402 is stopped through signal 10 (which can be triggered by kill-10 or systemctl), that is, the original service 402 can no longer obtain consumption messages from the message queue cluster 404. At this time, the task being processed can be returned normally, but task consumption cannot be performed;
[0202] In the third stage, as shown in the black dashed line, new tasks are only consumed by new containers. In this way, the hot upgrade of the original service to the containerized new service is realized.
[0203] It can be seen that the implementation summary of the embodiment of the present application is as follows:
[0204] (1) The Scheduler, Volume, and Backup services are deployed on physical machines instead of containers. This allows multiple identical services to run on the same physical machine.
[0205] (2) After the new service is started, new consumers will be generated. At this time, new requests will be randomly consumed by the old service and the new container service according to the MQ consumption mechanism;
[0206] (3) Get the running process ID of the old service and use the kill-10 signal to trigger the old service's MQ to stop consuming. At this time, the tasks being processed by the old service will not be interrupted.
[0207] (4) Monitor the logs of the old service and stop the old service when all ongoing tasks of the old service are completed.
[0208] (5) After the above 1-4, the new service can be launched and the old service can be taken offline. There will be no restrictions on the upgrade time window, and the tasks being processed by the old service will not be interrupted during the upgrade.
[0209] Through the description of the above contents, this application can solve the following technical problems:
[0210] (1) Solve the service hot upgrade problem of Cinder components based on MQ consumption services;
[0211] (2) Stop and activate MQ consumption capabilities through semaphores 10 and 12;
[0212] (3) Solve the problems of business processing interruption and failure during service upgrade;
[0213] (4) The original service does not need to be restarted during service upgrade and rollback.
[0214] An embodiment of the present application provides a component upgrade method, and the specific implementation of the aforementioned embodiment is elaborated in detail through this embodiment. It can be seen that during the operation of the original component, the upgraded component is started by configuring the container, and the original component will not be closed until the original component has processed all the acquired pending consumption messages. This will not affect the business being processed, thereby effectively solving the problem of business processing interruption and failure during the service upgrade process, and can realize the hot upgrade of the original component to the upgraded component.
[0215] In yet another embodiment of the present application, see Figure 8 , which shows a schematic diagram of the composition structure of a component upgrade device 50 in OpenStack provided in an embodiment of the present application. Figure 8 As shown, the component upgrade device 50 includes a start unit 501, a stop unit 502 and a close unit 503, wherein:
[0216] The startup unit 501 is configured to start the upgraded component by configuring the container during the operation of the original component; wherein the original component includes a plurality of first consumer processes, and the plurality of first consumer processes are used to obtain consumption messages to be processed;
[0217] A stopping unit 502 is configured to control the original component to close the plurality of first consumption processes based on the stop signal acquired by the original component;
[0218] The closing unit 503 is configured to close the original component when it is detected that the original component is in a preset state, so as to realize a hot upgrade of the original component to the upgraded component; wherein the preset state indicates that the original component has completed processing all the acquired pending consumption messages.
[0219] In some embodiments, in some embodiments, as Fig. 9 As shown, the component upgrading device 50 also includes a control unit 504, which is configured to control the upgraded component to obtain the new pending consumption message through the second consumption process when a new pending consumption message is received, and control the upgraded component to process the new pending consumption message.
[0220] In some embodiments, the stop unit 502 is also configured to obtain multiple process identifiers corresponding to the multiple first consumer processes; generate the stop signal based on the obtained multiple process identifiers; when the original component obtains the stop signal, control the original component to determine the multiple process identifiers according to the stop signal, and close the multiple first consumer processes according to the multiple process identifiers.
[0221] In some embodiments, Fig. 9 As shown, the component upgrading device 50 also includes an activation unit 505, which is configured to generate an activation signal based on multiple process identifiers corresponding to the multiple first consumption processes when the upgraded component fails to start; when the original component obtains the activation signal, the original component is controlled to start the multiple first consumption processes so that the original component starts to obtain new consumption messages to be processed.
[0222] In some embodiments, the stop unit 502 is further configured to obtain the total number of consumers; wherein the total number of consumers represents the sum of the number of first consumers included in the original component and the number of second consumers included in the upgraded component; when the total number of consumers is equal to twice the number of the first consumers, the step of obtaining multiple process identifiers corresponding to the multiple first consumer processes is executed.
[0223] In some embodiments, Fig. 9 As shown, the component upgrading device 50 also includes an operating unit 506, which is configured to control the original component to process one of the pending consumption messages in the task list; when the processing of one of the pending consumption messages is completed, remove one of the pending consumption messages from the task list.
[0224] In some embodiments, the original component further includes a task list, and the closing unit 503 is further configured to detect whether the task list is empty; when it is detected that the task list is empty, it is determined that the original component is in a preset state.
[0225] In some embodiments, Fig. 9 As shown, the component upgrading device 50 also includes a transformation unit 507, which is configured to perform a start-up transformation operation on the configuration container so that the configuration container can start the upgraded component during the operation of the original component; wherein the start-up transformation operation is used to reset the respective status values of multiple storage units according to preset status values when the configuration container starts the upgraded component, and the multiple storage units are the management objects of the upgraded component.
[0226] It can be understood that in this embodiment, a "unit" can be a part of a circuit, a part of a processor, a part of a program or software, etc., and can also be a module or a non-modular one. Moreover, each component in this embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional module.
[0227] If the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0228] Therefore, this embodiment provides a computer storage medium, which stores a computer program. When the computer program is executed by at least one processor, the steps of the method described in any one of the above embodiments are implemented.
[0229] Based on the above-mentioned composition of the component upgrade device 50 in OpenStack and the computer storage medium, see Fig.10 , which shows a specific hardware structure diagram of a component upgrade device 50 in OpenStack provided in an embodiment of the present application, such as Fig. 9 As shown, the component upgrade device 50 may include: a communication interface 601, a memory 602 and a processor 603; each component is coupled together through a bus device 604. It is understood that the bus device 604 is used to realize the connection and communication between these components. In addition to the data bus, the bus device 604 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Fig.10 Various buses are labeled as bus devices 604. Among them, the communication interface 601 is used to receive and send signals during the process of sending and receiving information between other external network elements;
[0230] A memory 602, used to store a computer program that can be run on the processor 603;
[0231] The processor 603 is configured to execute, when running the computer program:
[0232] During the operation of the original component, the upgraded component is started by configuring a container; wherein the original component includes a plurality of first consumer processes, and the plurality of first consumer processes are used to obtain consumption messages to be processed;
[0233] Based on the stop signal obtained by the original component, controlling the original component to close the multiple first consumer processes;
[0234] When it is detected that the original component is in a preset state, the original component is shut down to achieve a hot upgrade of the original component to the upgraded component; wherein the preset state indicates that the original component has completed processing of all the acquired consumption messages to be processed.
[0235] It can be understood that the memory 602 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DRRAM). The memory 602 of the apparatus and method described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0236] The processor 603 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 603. The above processor 603 can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (APPlication Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software modules in the decoding processor are combined and executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 602, and the processor 603 reads the information in the memory 602 and completes the steps of the above method in combination with its hardware.
[0237] It is understood that the embodiments described in the present application can be implemented by hardware, software, firmware, middleware, microcode or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the present application or a combination thereof.
[0238] For software implementation, the technology described in this application can be implemented by a module (e.g., a procedure, a function, etc.) that performs the functions described in this application. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.
[0239] Optionally, as another embodiment, the processor 603 is further configured to execute the steps of the method described in any one of the aforementioned embodiments when running the computer program.
[0240] Based on the composition and hardware structure diagram of the component upgrade device 50 in the OpenStack, see Fig.11 , which shows a schematic diagram of the composition structure of an OpenStack system 70 provided in an embodiment of the present application. Fig.11 As shown, the OpenStack system 70 at least includes the component upgrading device 50 described in any one of the aforementioned embodiments.
[0241] For OpenStack system 70, during the operation of the original component, the upgraded component is started by configuring the container, and the original component will not be closed until the original component has processed all the pending consumption messages it has obtained. This will not affect the business being processed, thereby effectively solving the problem of business processing interruption and failure during the service upgrade process, and can realize the hot upgrade of the original component to the upgraded component.
[0242] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application.
[0243] It should be noted that, in this application, the term "includes", "comprising" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0244] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0245] The methods disclosed in several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0246] The features disclosed in several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0247] The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0248] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A component upgrade method in OpenStack, characterized in that: The method comprises: During the operation of the original component, the upgraded component is started by configuring a container; wherein the original component includes a plurality of first consumer processes, and the plurality of first consumer processes are used to obtain consumption messages to be processed; Based on the stop signal obtained by the original component, controlling the original component to close the multiple first consumer processes; When it is detected that the original component is in a preset state, the original component is shut down to achieve a hot upgrade of the original component to the upgraded component; wherein the preset state indicates that the original component has completed processing of all the acquired consumption messages to be processed; Before starting the upgraded component by configuring the container, the method further includes: A startup transformation operation is performed on the configuration container so that the configuration container can start the upgraded component during the operation of the original component; wherein the startup transformation operation is used to reset the state value of each of a plurality of storage units according to a preset state value when the configuration container starts the upgraded component, and the plurality of storage units are management objects of the upgraded component.
2. The component upgrade method according to claim 1, characterized in that: The upgraded component includes a plurality of second consumer processes; after controlling the original component to close the plurality of first consumer processes, the method further includes: When a new consumption message to be processed is received, the upgraded component is controlled to obtain the new consumption message to be processed through the multiple second consumption processes, and the upgraded component is controlled to process the new consumption message to be processed.
3. The component upgrade method according to claim 1, characterized in that: Before the stop signal obtained based on the original component, the method further includes: Obtain multiple process identifiers corresponding to the multiple first consumer processes; Based on the obtained multiple process identifiers, generating the stop signal; Accordingly, controlling the original component to close the plurality of first consumer processes based on the stop signal acquired by the original component includes: When the original component obtains the stop signal, the original component is controlled to determine the multiple process identifiers according to the stop signal, and close the multiple first consumer processes according to the multiple process identifiers.
4. The component upgrade method according to claim 3, characterized in that: After controlling the original component to close the plurality of first consumer processes, the method further includes: In the case where the upgraded component fails to start, generating an activation signal based on a plurality of process identifiers corresponding to the plurality of first consumer processes; When the original component obtains the activation signal, the original component is controlled to start the multiple first consumption processes, so that the original component starts to obtain new consumption messages to be processed.
5. The component upgrade method according to claim 3, characterized in that: After starting the upgraded component by configuring the container, the method further includes: Acquire the total number of consumers; wherein the total number of consumers represents the sum of the number of first consumers included in the original component and the number of second consumers included in the upgraded component; When the total number of consumers is equal to twice the number of the first consumers, the step of obtaining multiple process identifiers corresponding to the multiple first consumer processes is performed.
6. The component upgrade method according to claim 1, characterized in that: The original component also includes a task list, and the task list records the to-be-processed consumption messages acquired by the original component. The method also includes: For one of the pending consumption messages in the task list, controlling the original component to process the one of the pending consumption messages; When the processing of one of the pending consumption messages is completed, the one of the pending consumption messages is removed from the task list.
7. The component upgrade method according to claim 6, characterized in that: The method further comprises: Detect whether the task list is empty; When it is detected that the task list is empty, it is determined that the original component is in a preset state.
8. A component upgrade device in OpenStack, characterized in that: The component upgrading device comprises a starting unit, a stopping unit and a closing unit, wherein: The startup unit is configured to start the upgraded component by configuring the container during the operation of the original component; wherein the original component includes a plurality of first consumer processes, and the plurality of first consumer processes are used to obtain consumption messages to be processed; The stopping unit is configured to control the original component to close the plurality of first consumption processes based on the stopping signal acquired by the original component; The shut down unit is configured to shut down the original component when it is detected that the original component is in a preset state, so as to achieve a hot upgrade of the original component to the upgraded component; wherein the preset state indicates that the original component has completed processing all the acquired consumption messages to be processed; The component upgrade device also includes a transformation unit, which is configured to start a transformation operation on the configuration container so that the configuration container can start the upgraded component during the operation of the original component; wherein the start transformation operation is used to reset the status values of multiple storage units according to preset status values when the configuration container starts the upgraded component, and the multiple storage units are management objects of the upgraded component.
9. A component upgrade device in OpenStack, characterized in that: The component upgrade device includes a memory and a processor; wherein, The memory is used to store a computer program that can be run on the processor; The processor is configured to execute the steps of the method according to any one of claims 1 to 7 when running the computer program.
10. A computer storage medium, characterized in that: The computer storage medium stores a computer program, and when the computer program is executed by at least one processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. An OpenStack system, characterized in that: The OpenStack system at least includes the component upgrading device according to claim 8 or 9.
