Application program transplantation method, device, equipment and storage medium
Through containerization technology, the components of the application are decoupled and encapsulated, forming a target virtual object, and running directly on the target object, solving the problems of high difficulty and low efficiency of application transplantation in the existing technology, and achieving high efficiency and low difficulty application porting.
Patent Information
- Application Number
- CN202011233445.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-06
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2040-11-06
AI Technical Summary
The prior art faces high difficulty and inefficiency when porting applications from one operating system to another, and often encounters compilation problems, dependency problems and compatibility problems.
The containerization technology is used to decouple each component of the transplant program, and the decoupled components are encapsulated in a container. The container is connected in series according to the call relationship between components to form a target virtual object, and the virtual object is directly run on the target object. Object.
There is no need to recompile the application on the target object, which avoids the problems caused by compilation, reduces the difficulty of transplantation, and improves the porting efficiency.
Smart Images

Figure CN114443130B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an application program migration method, device, equipment and storage medium. Background Art
[0002] With the development of chip technology and operating systems, many large-scale applications (such as cloud computing platforms) are gradually unable to adapt to the rapid development and changes of the underlying operating system. In practical applications, every time a new operating system appears, it is necessary to port the existing application to the new operating system to adapt the application to the new operating system.
[0003] In the related art, when an existing application is ported to a new operating system, it is usually necessary to recompile the application on the new operating system. In the process of program compilation, many compilation problems, dependency problems and compatibility problems often occur, and the problems faced when porting an application to different operating systems are also very different. It can be seen that using the above program porting method to port an application to a new operating system has a high porting difficulty and low porting efficiency, and various problems will be exposed in the process of program porting. Summary of the invention
[0004] In view of this, the embodiments of the present application provide an application program transplantation method, apparatus, device and storage medium, which can effectively reduce the difficulty of program transplantation and improve the efficiency of program transplantation.
[0005] The first aspect of the present application provides an application program migration method, the method comprising:
[0006] Decoupling each component in the program to be ported, and encapsulating each decoupled component in its corresponding container;
[0007] According to the calling relationship between the components in the program to be transplanted, the containers corresponding to the components are connected in series to obtain the target virtual object;
[0008] When the program to be transplanted needs to be transplanted into the target object, the target virtual object is imported into the target object so as to run the program to be transplanted on the target object.
[0009] Optionally, importing the target virtual object into the target object includes:
[0010] Importing the image file corresponding to the target virtual object into the target object;
[0011] The step of running the program to be transplanted on the target object comprises:
[0012] The containers corresponding to the components connected in series in the target virtual object are respectively run on the target object.
[0013] Optionally, when it is necessary to transplant the program to be transplanted into the target object, the method further includes:
[0014] The disk directory of the disk in the target object is mapped to the container corresponding to the storage component in the target virtual object, so that when the program to be transplanted is run on the target object, the container corresponding to the storage component is allowed to access the disk in the target object.
[0015] Optionally, the method further includes:
[0016] Setting a target communication interface for the target virtual object;
[0017] When it is necessary to transplant the program to be transplanted into the target object, the method further includes:
[0018] Based on the local network information of the target object, the network information corresponding to the target communication interface is set.
[0019] Optionally, when it is necessary to transplant the program to be transplanted into the target object, the method further includes:
[0020] The containers corresponding to the components in the target virtual object are managed through the container orchestration and scheduling engine.
[0021] Optionally, when it is necessary to transplant the program to be transplanted into the target object, the method further includes:
[0022] Allocating system resources of the target object to containers corresponding to respective components in the target virtual object based on the control group;
[0023] Based on the namespace, the access isolation of the system resources is achieved for the containers corresponding to the respective components in the target virtual object.
[0024] Optionally, containers corresponding to the components in the target virtual object communicate via a stateful transfer interface.
[0025] Optionally, the program to be transplanted includes any one of the following: a program corresponding to a cloud computing platform, a program corresponding to an information processing platform, or a program corresponding to a data processing platform;
[0026] The target objects include any of the following: a variety of different operating systems based on innovative information technology chips, and operating systems based on traditional chips.
[0027] A second aspect of the present application provides an application program migration device, the device comprising:
[0028] A decoupling module is used to decouple each component in the program to be transplanted and encapsulate each decoupled component in its corresponding container;
[0029] A series connection module, used to connect containers corresponding to each component in series according to the calling relationship between the components in the program to be transplanted, so as to obtain a target virtual object;
[0030] The import module is used for importing the target virtual object into the target object when the program to be transplanted needs to be transplanted into the target object, so as to run the program to be transplanted on the target object.
[0031] Optionally, the import module is specifically used for:
[0032] Importing the image file corresponding to the target virtual object into the target object;
[0033] The containers corresponding to the components connected in series in the target virtual object are respectively run on the target object.
[0034] Optionally, when it is necessary to transplant the program to be transplanted into a target object, the device further includes:
[0035] The storage mapping module is used to map the disk directory of the disk in the target object to the container corresponding to the storage component in the target virtual object, so that when the program to be transplanted is run on the target object, the container corresponding to the storage component is allowed to access the disk in the target object.
[0036] Optionally, the device further comprises:
[0037] A communication interface setting module, used to set a target communication interface for the target virtual object;
[0038] When it is necessary to transplant the program to be transplanted into the target object, the device further includes:
[0039] The network information setting module is used to set the network information corresponding to the target communication interface based on the local network information of the target object.
[0040] Optionally, when it is necessary to transplant the program to be transplanted into a target object, the device further includes:
[0041] The container management module is used to manage the containers corresponding to the components in the target virtual object through the container orchestration and scheduling engine.
[0042] Optionally, when it is necessary to transplant the program to be transplanted into a target object, the device further includes:
[0043] A resource allocation module, configured to allocate system resources of the target object to containers corresponding to respective components in the target virtual object based on the control group;
[0044] The access isolation module is used to implement access isolation of the system resources based on the namespace for the containers corresponding to the respective components in the target virtual object.
[0045] Optionally, containers corresponding to the components in the target virtual object communicate via a stateful transfer interface.
[0046] Optionally, the program to be transplanted includes any one of the following: a program corresponding to a cloud computing platform, a program corresponding to an information processing platform, or a program corresponding to a data processing platform;
[0047] The target objects include any of the following: a variety of different operating systems based on innovative information technology chips, and operating systems based on traditional chips.
[0048] A third aspect of the present application provides an electronic device, the electronic device comprising:
[0049] Processor and memory:
[0050] The memory is used to store a computer program and transmit the computer program to the processor;
[0051] The processor is used to execute the application program transplantation method described in the first aspect according to the computer program.
[0052] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the application transplantation method described in the first aspect above.
[0053] A fifth aspect of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the application transplantation method described in the first aspect.
[0054] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0055] The embodiment of the present application provides an application transplantation method, which decouples each component in the program to be transplanted, and encapsulates each component after the decoupling process in its respective corresponding container; and according to the call relationship between each component in the program to be transplanted, the containers corresponding to each component are connected in series to obtain a target virtual object; when the program to be transplanted needs to be transplanted to the target object, the target virtual object can be imported into the target object, so that when the program to be transplanted needs to be run on the target object, the containers corresponding to each component in the target virtual object can be directly run. In this way, the present application realizes the transplantation of large-scale applications based on containerization technology, and the components decoupled from the program to be transplanted are containerized, and the containers corresponding to each component are connected in series. When the program to be transplanted needs to be transplanted to the target object, the connected containers can be directly run on the target object. Compared with the related art that each transplantation requires recompiling the program to be transplanted on the target object, the present application does not need to recompile the program, so various problems caused by recompiling the program can be avoided, which greatly reduces the difficulty of application transplantation and improves the efficiency of application transplantation. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 A flowchart of an application program transplantation method provided in an embodiment of the present application;
[0057] Figure 2 A schematic diagram of the transplantation architecture of a cloud computing platform based on relevant technologies;
[0058] Figure 3 A schematic diagram of a transplantation architecture of a cloud computing platform implemented based on the technical solution provided in an embodiment of the present application;
[0059] Figure 4 A schematic diagram of the structure of an application program transplantation device provided in an embodiment of the present application;
[0060] Figure 5 A schematic diagram of the structure of a server provided in an embodiment of the present application;
[0061] Figure 6 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0062] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0063] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0064] With the rapid development of the information technology innovation industry, various new central processing unit (CPU) chips and operating systems adapted to these CPU chips are constantly emerging in the industry. However, every time a new operating system appears, it means that it is necessary to face the problem of application porting related to the operating system, that is, it is necessary to port the existing application to the new operating system and make the application compatible with the new operating system.
[0065] In the related art, when an existing application is ported to a new operating system, it is usually necessary to recompile the application on the new operating system so that the operating system maintains a set of codes for the application. In the process of program compilation, many compilation problems, dependency problems and compatibility problems are often encountered, and the problems that may be encountered for different operating systems are also different. It can be seen that using the application porting method in the related art to port an application to a new operating system and make the application compatible with the new operating system often requires facing and solving a large number of problems, and the porting difficulty is high and the porting efficiency is low.
[0066] In response to the problems existing in the above-mentioned related technologies, an embodiment of the present application provides an application porting method. The method packages the application to be ported based on containerization technology. When a new operating system appears, it is only necessary to import the packaged application into the new operating system for running, without the need to recompile the application in the new operating system. This avoids various problems caused by program compilation, can effectively reduce the difficulty of application porting, improve the efficiency of application porting, and make the application porting technology adapt to the development rhythm of the information technology innovation industry.
[0067] Specifically, in the application transplantation method provided in the embodiment of the present application, each component in the program to be transplanted can be first decoupled, and each component after the decoupling process can be encapsulated in its respective corresponding container. In addition, it is also necessary to connect the containers corresponding to each component in series according to the calling relationship between each component in the program to be transplanted to obtain the target virtual object corresponding to the program to be transplanted. When the program to be transplanted needs to be transplanted into the target object, the target virtual object corresponding to the program to be transplanted can be imported into the target object, so that when the program to be transplanted needs to be run on the target object, the containers corresponding to each component in the target virtual object can be directly run.
[0068] Compared with the implementation method of recompiling the application on a new operating system in the related art, the technical solution provided by the embodiment of the present application realizes the transplantation of the application based on the containerization technology; that is, the components decoupled from the program to be transplanted are encapsulated into the corresponding container, and the corresponding containers of each component are connected in series according to the calling relationship between the components. When the program to be transplanted needs to be transplanted to the target object, the connected containers can be directly imported into the target object, and the connected containers can be run on the target object. In this way, there is no need to recompile the program to be transplanted on the target object, which can avoid a series of problems caused by compiling the program, greatly reducing the difficulty of application transplantation and improving the efficiency of application transplantation.
[0069] It should be noted that the application porting method provided in the embodiment of the present application can be executed by an electronic device that supports containerization technology, for example, it can be executed by a terminal device or a server, and no limitation is made to the execution subject of the application porting method provided in the embodiment of the present application.
[0070] The application program transplantation method provided by the present application is described in detail below through a method embodiment.
[0071] See also Figure 1 , Figure 1 The flowchart of the application program transplantation method provided in the embodiment of the present application is shown in FIG. Figure 1 As shown, the method comprises the following steps:
[0072] Step 101: decoupling each component in the program to be transplanted, and encapsulating each decoupled component in its corresponding container.
[0073] In actual applications, an application is usually composed of several components, and these components are coupled with each other. This coupling relationship can also be understood as a calling relationship between components. During the running of the application, the components in the application cooperate with each other based on the coupling relationship to realize the functions of the application.
[0074] In the method provided in the embodiment of the present application, for a certain application to be ported (i.e., a program to be ported), the various components in the program to be ported can be first decoupled to obtain independent components in the program to be ported, and there is no coupling relationship between these independent components; then, for each independent component obtained after the decoupling process, containerization technology is used to encapsulate it in its corresponding container, for example, each independent component can be encapsulated in its corresponding sandbox.
[0075] For some large-scale programs to be ported, such as a feature-rich and powerful cloud computing platform, the various coupled microservices contained in the cloud computing platform can be regarded as the above-mentioned components, and the various coupled microservices in the cloud computing platform can be decoupled. Each independent microservice obtained after the decoupling process can be encapsulated in its corresponding container using containerization technology.
[0076] It should be understood that in actual applications, the program to be ported in the embodiments of the present application may be other portable programs in addition to the program corresponding to the cloud computing platform, for example, the program corresponding to the information processing platform, the program corresponding to the data processing platform, etc. The present application does not impose any limitation on the program to be ported.
[0077] It should be noted that containerization technology, also known as Linux Container, is a kernel-level lightweight operating system layer virtualization technology that is lightweight, easy to deploy, easy to port, and elastic. Containerization technology is mainly implemented through two mechanisms: control group (Cgroup) and namespace. Among them, Cgroup is mainly used for resource control. Its implementation principle is to place a group of processes in a control group and control the available resources of this group of processes by allocating specified available resources to the control group. Namespace is mainly used for access isolation. Its implementation principle is to abstract a class of resources and encapsulate them together for use in a container. Each container has abstract resources available for its use, and the resources used by each container are invisible to each other, so access isolation can be achieved.
[0078] Step 102: According to the calling relationship between the components in the program to be transplanted, the containers corresponding to the components are connected in series to obtain a target virtual object.
[0079] Since the components in the program to be ported have a coupling relationship (i.e., a calling relationship) with each other before the decoupling process, and the program to be ported also needs to operate normally based on the coupling relationship between the components, therefore, the method provided in the embodiment of the present application, after decoupling the components in the program to be ported and encapsulating each component after the decoupling process in its corresponding container, needs to further connect the containers encapsulating the components in series according to the calling relationship between the components in the program to be ported using a preset communication method. The combination of the containers obtained in this way can be regarded as the target virtual object in the present application.
[0080] In one possible implementation, according to the calling relationship between the components in the program to be ported, when the containers encapsulating the components are connected in series, a remote procedure call (GRPC) communication method can be used to connect the containers encapsulating the components in series, so that each component in the program to be ported can continue to communicate after the decoupling process.
[0081] In another possible implementation, according to the calling relationship between the components in the program to be ported, when the containers encapsulating the components are connected in series, the containers corresponding to the components in the target virtual object can communicate through the restful state transfer interface (restful_api), that is, for the components with calling relationships in the program to be ported, the corresponding containers can communicate through restful_api.
[0082] It should be understood that in actual applications, in addition to communicating through the above-mentioned GRPC communication method and restful_api, the various containers encapsulating various components in the target virtual object can also use other communication methods according to actual needs. This application does not impose any limitations on the communication method between the containers corresponding to the various components in the target virtual object.
[0083] It should be noted that, considering that each component in the program to be transplanted corresponds to the same set of processes, that is, the overall operation process of the program to be transplanted, and after the target virtual object corresponding to the program to be transplanted is transplanted to the target object, the containers corresponding to each component in the target virtual object need to be called by the target object through an interface. Therefore, it is also necessary to set a target communication interface for the target virtual object, so that when the target virtual object is run on the target object, the target object can directly call the containers corresponding to each component in the target virtual object through the target communication interface.
[0084] Step 103: When the program to be transplanted needs to be transplanted into the target object, the target virtual object is imported into the target object so as to run the program to be transplanted on the target object.
[0085] When the program to be transplanted needs to be transplanted into the target object, the target virtual object corresponding to the program to be transplanted constructed in the above step 102 can be imported into the target object. When the program to be transplanted needs to be run in the target object, the target virtual object corresponding to the program to be transplanted can be directly run in the target object, that is, by running each container encapsulating each component in the target virtual object, the function corresponding to the program to be transplanted is realized.
[0086] It should be noted that the above-mentioned target object can be various operating systems that support container operation. Exemplarily, in the environment of rapid development of the information technology innovation industry, the above-mentioned target object can be a variety of different operating systems based on information innovation chips; in other words, through the method provided in the embodiment of the present application, various existing applications can be quickly transplanted to various emerging operating systems without recompiling, so that various existing applications can be quickly adapted to various operating systems based on information innovation chips. Of course, the above-mentioned target object can also be based on a variety of different operating systems of traditional chips, and this application does not make any limitation on the target object.
[0087] Specifically, when the target virtual object corresponding to the program to be transplanted is imported into the target object, the image file corresponding to the target virtual object can be imported into the target object. Accordingly, when the program to be transplanted is run on the target object, the containers corresponding to the components connected in series in the target virtual object can be run on the target object.
[0088] It should be noted that the image file corresponding to the target virtual object can be regarded as a file system composed of multiple image layers superimposed, where each image layer corresponds to a component, and each image layer in the image file is superimposed in the form of pointers. The image file is essentially a unified perspective of a bunch of read-only layers. Except for the bottom layer, each other layer points to its parent layer. The different image layers are integrated into a file system through the unified file system (Union File System) technology, and a unified perspective is provided for these layers, thus hiding the existence of multiple image layers.
[0089] The difference between the target virtual object and its corresponding image file is that the top layer of the target virtual object is readable and writable. When the target virtual object is running in the target object, that is, when the target virtual object is in the running state, it can be regarded as a readable and writable file system (that is, a static target virtual object) plus an isolated process space and the processes running therein.
[0090] That is to say, when the target virtual object needs to be transplanted to the target object, the transplantation of the target virtual object needs to be realized with the help of the image file corresponding to the target virtual object, and the image file includes various containers encapsulating various components, and the various containers therein can communicate with each other through a preset communication technology. When the target virtual object needs to be run on the target object, a readable and writable layer can be added on the basis of the image file corresponding to the target virtual object to obtain the target virtual object, and then the operation of the target virtual object is realized in the kernel of the target object based on the target virtual object, the isolated process space and the process running therein, thereby realizing the function of the program to be transplanted.
[0091] As described above, when the target virtual object corresponding to the program to be ported runs in the target object, the normal operation of the target virtual object can be ensured through the two mechanisms of Cgroup and Namespace. Specifically, when the target virtual object corresponding to the program to be ported runs in the target object, the system resources of the target object can be allocated to the containers corresponding to each component in the target virtual object based on Cgroup, and the access isolation of system resources can be achieved for the containers corresponding to each component in the target virtual object based on Namespace.
[0092] When the system resources of the target object are allocated to the containers corresponding to each component in the target virtual object based on Cgroup, a group of processes of the target virtual object can be placed in a control group, and the purpose of controlling the available system resources of this group of processes can be achieved by allocating specified available system resources to the control group. The Cgroup is a mechanism provided by the Linux kernel that can limit, record, and isolate the system resources used by a process group. Based on this mechanism, the system resources used by a group of processes and future child processes can be limited, controlled, and counted. The system resources here include but are not limited to: CPU resources, storage resources, network resources, etc. Through this Cgroup, the resource usage of a group of processes can be easily limited, and the processes can be monitored in real time, and information related to the group of processes can be counted.
[0093] When implementing access isolation of system resources based on the Namespace for the containers corresponding to each component in the target virtual object, a class of system resources can be abstracted and encapsulated together for use in a container. Since each container has its own available abstract system resources, and the abstract system resources available to the containers are unavailable to each other, access isolation of system resources can be achieved.
[0094] It should be noted that, as described above, after connecting the containers corresponding to the components in series to obtain the target virtual object corresponding to the program to be transplanted, a target communication interface can be set for the target virtual object so as to access the containers corresponding to the components in the target virtual object through the target communication interface. In addition, in order to make the user feel no difference when accessing the target virtual object and the target object, and to give the user the experience that accessing the target virtual object is the same as accessing the target object, the method provided in the embodiment of the present application can also set the network information of the target communication interface of the target virtual object based on the local network information of the target object.
[0095] Exemplarily, the local network information of the target object may include the Internet Protocol Address (IP address) of the target object. Accordingly, when the target virtual object corresponding to the program to be transplanted is transplanted to the target object, the IP address of the target communication interface of the target virtual object can be set to the IP address of the target object, so as to indicate that the target virtual object and the target object are in the same local network through the same IP address.
[0096] Of course, in actual applications, the network information corresponding to the target communication port may also include other information. In a network environment, the target virtual object and the target object may be distinguished by other information.
[0097] It should be noted that when the target virtual object runs on the target object, it often involves the use of the storage space in the target object, for example, reading data from the storage space of the target object, or writing data to the storage space of the target object, etc. In order to facilitate the target virtual object to call the storage space in the target object, the method provided in the embodiment of the present application also includes:
[0098] Map the disk directory of the disk in the target object to the container corresponding to the storage component in the target virtual object, so that when the program to be transplanted is run on the target object, that is, when the target virtual object is run on the target object, the container corresponding to the storage component can be allowed to access the disk in the target object. That is, in the process of importing the target virtual object into the target object, the disk directory of the disk in the target object can be mapped to the container corresponding to the storage component in the target virtual object, and accordingly, when the target virtual object is run on the target object, the container corresponding to the storage component in the target virtual object can access the storage space corresponding to the disk directory on the disk in the target object based on the disk directory.
[0099] It should be noted that, in order to facilitate the target object to better manage and control the container in the target virtual object corresponding to the program to be transplanted, in the method provided in the embodiment of the present application, when the target virtual object corresponding to the program to be transplanted is transplanted to the target object, the container orchestration and scheduling engine can be used to manage the containers corresponding to each component in the target virtual object. Exemplarily, the containers corresponding to each component in the target virtual object can be managed by K8S (kubernetes). As an orchestration and management tool for portable containers created for container services, K8S can help the target object better manage the containers running therein, making application deployment and operation and maintenance more convenient.
[0100] Compared with the implementation method of recompiling the application on a new operating system in the related art, the technical solution provided by the embodiment of the present application realizes the transplantation of the application based on the containerization technology; that is, the components decoupled from the program to be transplanted are encapsulated into the corresponding container, and the corresponding containers of each component are connected in series according to the calling relationship between the components. When the program to be transplanted needs to be transplanted to the target object, the connected containers can be directly imported into the target object, and the connected containers can be run on the target object. In this way, there is no need to recompile the program to be transplanted on the target object, which can avoid a series of problems caused by compiling the program, greatly reducing the difficulty of application transplantation and improving the efficiency of application transplantation.
[0101] The following takes the example of transplanting a cloud computing platform to an operating system based on an information technology innovation chip as an example to compare and introduce the solutions in the related technical techniques and the solutions provided in the embodiments of the present application.
[0102] See also Figure 2 , Figure 2 The following is a schematic diagram of the transplant architecture of the cloud computing platform based on relevant technologies. Figure 2 As shown, it is necessary to recompile the program of the cloud computing platform on the host machine (i.e., the new operating system) so that all services of the cloud computing platform run on the host machine. Once a new operating system appears, the program of the cloud computing platform must be re-edited to make the cloud computing platform compatible with the new operating system.
[0103] See also Figure 3 , Figure 3 Schematic diagram of the transplantation architecture of the cloud computing platform implemented based on the technical solution provided in the embodiment of the present application. Figure 3As shown, the cloud computing platform is packaged by containerization technology, making the cloud computing platform equivalent to a sandbox. Accordingly, when the cloud computing platform is run on the host machine (i.e., the new operating system), the sandbox can be directly run to realize the functions of the cloud computing platform. In this way, there is no need to recompile the cloud computing platform program on the new operating system. For operating systems of various architectures, as long as they can support the operation of the sandbox, the normal implementation of the cloud computing platform functions can be guaranteed.
[0104] The present application embodiment also provides an application program migration device. Figure 4 , Figure 4 A schematic diagram of the structure of the application program transplantation device 400 provided in the embodiment of the present application is shown in FIG. Figure 4 As shown, the application transplantation device 400 includes:
[0105] A decoupling module 401 is used to decouple each component in the program to be transplanted, and encapsulate each decoupled component in its corresponding container;
[0106] A series connection module 402 is used to connect containers corresponding to each component in series according to the calling relationship between the components in the program to be transplanted, so as to obtain a target virtual object;
[0107] The import module 403 is used to import the target virtual object into the target object when the program to be transplanted needs to be transplanted into the target object, so as to run the program to be transplanted on the target object.
[0108] Optionally, the import module 403 is specifically used for:
[0109] Importing the image file corresponding to the target virtual object into the target object;
[0110] The containers corresponding to the components connected in series in the target virtual object are respectively run on the target object.
[0111] Optionally, when it is necessary to transplant the program to be transplanted into a target object, the device further includes:
[0112] The storage mapping module is used to map the disk directory of the disk in the target object to the container corresponding to the storage component in the target virtual object, so that when the program to be transplanted is run on the target object, the container corresponding to the storage component is allowed to access the disk in the target object.
[0113] Optionally, the device further comprises:
[0114] A communication interface setting module, used to set a target communication interface for the target virtual object;
[0115] When it is necessary to transplant the program to be transplanted into the target object, the device further includes:
[0116] The network information setting module is used to set the network information corresponding to the target communication interface based on the local network information of the target object.
[0117] Optionally, when it is necessary to transplant the program to be transplanted into a target object, the device further includes:
[0118] The container management module is used to manage the containers corresponding to the components in the target virtual object through the container orchestration and scheduling engine.
[0119] Optionally, when it is necessary to transplant the program to be transplanted into a target object, the device further includes:
[0120] A resource allocation module, configured to allocate system resources of the target object to containers corresponding to respective components in the target virtual object based on a control group Cgroup;
[0121] The access isolation module is used to implement access isolation of the system resources based on the namespace Namespace for the containers corresponding to the respective components in the target virtual object.
[0122] Optionally, containers corresponding to the components in the target virtual object communicate via a stateful transfer interface.
[0123] Optionally, the program to be transplanted includes any one of the following: a program corresponding to a cloud computing platform, a program corresponding to an information processing platform, or a program corresponding to a data processing platform;
[0124] The target objects include any of the following: a variety of different operating systems based on information technology innovative chips, and a variety of different operating systems based on traditional chips.
[0125] The technical solution provided by the embodiment of the present application is based on containerization technology to achieve the transplantation of application programs; that is, the components decoupled from the program to be transplanted are encapsulated into corresponding containers, and the corresponding containers of each component are connected in series according to the calling relationship between the components. When the program to be transplanted needs to be transplanted to the target object, the connected containers can be directly imported into the target object, and the connected containers can be run on the target object. In this way, there is no need to recompile the program to be transplanted on the target object, which can avoid a series of problems caused by compiling the program, greatly reducing the difficulty of application transplantation and improving the efficiency of application transplantation.
[0126] The embodiment of the present application also provides an electronic device for porting applications, which electronic device may specifically be a server and a terminal device. The server and terminal device provided in the embodiment of the present application will be introduced below from the perspective of hardware instantiation.
[0127] See also Figure 5 , Figure 5 A schematic diagram of the structure of a server 500 provided for an embodiment of the present application. The server 500 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 522 (for example, one or more processors) and a memory 532, and one or more storage media 530 (for example, one or more mass storage devices) storing application programs 542 or data 544. Among them, the memory 532 and the storage medium 530 may be temporary storage or permanent storage. The program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 522 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the server 500.
[0128] The server 500 may also include one or more power supplies 526, one or more wired or wireless network interfaces 550, one or more input and output interfaces 558, and / or one or more operating systems 541, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0129] The steps performed by the server in the above embodiment can be based on the Figure 5 The server structure shown.
[0130] The CPU 522 is used to execute the following steps:
[0131] Decoupling each component in the program to be ported, and encapsulating each decoupled component in its corresponding container;
[0132] According to the calling relationship between the components in the program to be transplanted, the containers corresponding to the components are connected in series to obtain the target virtual object;
[0133] When the program to be transplanted needs to be transplanted into the target object, the target virtual object is imported into the target object so as to run the program to be transplanted on the target object.
[0134] Optionally, the CPU 522 may also be used to execute steps of any implementation of the application program transplantation method provided in the embodiments of the present application.
[0135] See also Figure 6 , Figure 6 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application. For the sake of convenience, only the parts related to the embodiment of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present application. The terminal can be any terminal device including a computer, a tablet computer, a personal digital assistant (English full name: Personal Digital Assistant, English abbreviation: PDA), etc., taking the terminal as a computer as an example:
[0136] Figure 6 FIG. 1 is a block diagram showing a partial structure of a computer related to a terminal provided in an embodiment of the present application. Figure 6 The computer includes: a radio frequency (RF) circuit 610, a memory 620, an input unit 630, a display unit 640, a sensor 650, an audio circuit 660, a wireless fidelity (WiFi) module 670, a processor 680, and a power supply 690. Those skilled in the art will appreciate that Figure 6 The computer structure shown in the figure does not constitute a limitation of the computer, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0137] The memory 620 can be used to store software programs and modules. The processor 680 executes various functional applications and data processing of the computer by running the software programs and modules stored in the memory 620. The memory 620 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the computer (such as audio data, a phone book, etc.), etc. In addition, the memory 620 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0138] The processor 680 is the control center of the computer. It uses various interfaces and lines to connect various parts of the entire computer. It executes various functions of the computer and processes data by running or executing software programs and / or modules stored in the memory 620, and calling data stored in the memory 620, so as to monitor the computer as a whole. Optionally, the processor 680 may include one or more processing units; preferably, the processor 680 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 680.
[0139] In the embodiment of the present application, the processor 680 included in the terminal also has the following functions:
[0140] Decoupling each component in the program to be ported, and encapsulating each decoupled component in its corresponding container;
[0141] According to the calling relationship between the components in the program to be transplanted, the containers corresponding to the components are connected in series to obtain the target virtual object;
[0142] When the program to be transplanted needs to be transplanted into the target object, the target virtual object is imported into the target object so as to run the program to be transplanted on the target object.
[0143] Optionally, the processor 680 is further used to execute steps of any implementation method of the application transplantation method provided in the embodiments of the present application.
[0144] An embodiment of the present application also provides a computer-readable storage medium for storing a computer program, wherein the computer program is used to execute any one of the implementation methods of an application porting method described in the aforementioned embodiments.
[0145] An embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute any one of the implementations of the application program transplantation method described in the aforementioned embodiments.
[0146] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0147] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0148] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0149] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0150] If the integrated unit is implemented in the form of a software functional unit and 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 the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (full name in English: Read-Only Memory, English abbreviation: ROM), random access memory (full name in English: Random Access Memory, English abbreviation: RAM), disk or optical disk and other media that can store computer programs.
[0151] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for transplanting an application program, characterized in that: The method comprises: Decoupling each component in the program to be ported, and encapsulating each decoupled component in its corresponding container; According to the calling relationship between the components in the program to be transplanted, the containers corresponding to the components are connected in series to obtain the target virtual object; When the program to be transplanted needs to be transplanted into a target object, the target virtual object is imported into the target object so as to run the program to be transplanted on the target object; the target object includes any one of the following: a plurality of different operating systems based on an information technology innovation chip, a plurality of different operating systems based on a traditional chip; The importing the target virtual object into the target object comprises: Importing the image file corresponding to the target virtual object into the target object; The step of running the program to be transplanted on the target object comprises: Run the containers corresponding to the components connected in series in the target virtual object on the target object; When it is necessary to transplant the program to be transplanted into the target object, the method further includes: The disk directory of the disk in the target object is mapped to the container corresponding to the storage component in the target virtual object, so that when the program to be transplanted is run on the target object, the container corresponding to the storage component is allowed to access the disk in the target object.
2. The method according to claim 1, characterized in that The method further comprises: Setting a target communication interface for the target virtual object; When it is necessary to transplant the program to be transplanted into the target object, the method further includes: Based on the local network information of the target object, the network information corresponding to the target communication interface is set.
3. The method according to claim 1, characterized in that When it is necessary to transplant the program to be transplanted into the target object, the method further includes: The containers corresponding to the components in the target virtual object are managed through the container orchestration and scheduling engine.
4. The method according to claim 1, characterized in that: When it is necessary to transplant the program to be transplanted into the target object, the method further includes: Allocating system resources of the target object to containers corresponding to respective components in the target virtual object based on the control group; Based on the namespace, the access isolation of the system resources is achieved for the containers corresponding to the respective components in the target virtual object.
5. The method according to claim 1, characterized in that The containers corresponding to the components in the target virtual object communicate via a stateful transfer interface.
6. The method according to any one of claims 1 to 5, characterized in that: The program to be transplanted includes any one of the following: a program corresponding to a cloud computing platform, a program corresponding to an information processing platform, and a program corresponding to a data processing platform.
7. An application program transplantation device, characterized in that: The device comprises: A decoupling module is used to decouple each component in the program to be transplanted and encapsulate each decoupled component in its corresponding container; A series connection module, used to connect containers corresponding to each component in series according to the calling relationship between the components in the program to be transplanted, so as to obtain a target virtual object; An import module, used for importing the target virtual object into the target object when the program to be transplanted needs to be transplanted into the target object, so as to run the program to be transplanted on the target object; the target object includes any one of the following: a plurality of different operating systems based on information technology innovative chips, and a plurality of different operating systems based on traditional chips; The import module is specifically used for: Importing the image file corresponding to the target virtual object into the target object; Run the containers corresponding to the components connected in series in the target virtual object on the target object; When it is necessary to transplant the program to be transplanted into the target object, the device further includes: The storage mapping module is used to map the disk directory of the disk in the target object to the container corresponding to the storage component in the target virtual object, so that when the program to be transplanted is run on the target object, the container corresponding to the storage component is allowed to access the disk in the target object.
8. An electronic device, characterized in that: The electronic device comprises: Processor and memory: The memory is used to store a computer program and transmit the computer program to the processor; The processor is used to execute the application transplantation method according to any one of claims 1 to 6 according to the computer program.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the application migration method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Portable component unit packaging method based on FACE architecture
CN110717268A
Business component calling method and device, terminal and storage medium
CN111580892A