Information processing method and electronic device
By establishing protocol stack access paths between different operating systems and synchronizing protocol stack configuration information, it is possible to start containers that support local protocol stacks in the RunV environment, solving the problem of resource waste and improving the security and efficiency of container runtime.
Patent Information
- Application Number
- CN202210976055.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-15
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2042-08-15
AI Technical Summary
Existing technologies require deploying two runtime environments, runc and runv, on different operating systems to start containers, resulting in a waste of resources.
By establishing a protocol stack access path between the first and second electronic devices, the protocol stack configuration information of the first operating system is received and synchronized to create a second protocol stack on the second operating system. This allows containers supporting the local protocol stack to be started in the runv environment, avoiding the need to deploy an additional runc environment.
It saves resources and environment when starting containers, solves the problem of resource waste, and improves the security and efficiency of container runtime.
Smart Images

Figure CN115328616B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the information processing technology in the field of information processing, and in particular to an information processing method and an electronic device. BACKGROUND
[0002] runc and runv are two kinds of container runtime environments; wherein, runc is a runtime environment supporting to start a container using a local protocol stack on a host; runv is a runtime environment based on a virtual machine hypervisor. Wherein, when a virtual machine adopts runv, the virtual machine will have its own independent kernel space and protocol stack, and when starting a container on the virtual machine, the protocol stack of the virtual machine itself will be directly used to start, however, part of the containers need to use the local protocol stack of the host to start, when the virtual machine adopts runv, part of the containers cannot be started, thereby reducing the efficiency of the virtual machine in business processing; based on this, in the related technology, when performing business processing, runv is used to start a container supporting the protocol stack of the virtual machine on the operating system (Operation System, OS) of the virtual machine, and runc is used to start a container supporting the local protocol stack on the local operating system of the host, so as to improve the efficiency of business processing; however, in the related technology, runc and runv, the two kinds of runtime environments, need to be deployed on different operating systems to start the container, which is easy to cause waste of resource environment. SUMMARY
[0003] To solve the above technical problems, the embodiments of the present application expect to provide an information processing method and an electronic device, which solve the problem that in the related technology, runc and runv, the two kinds of runtime environments, need to be deployed on different operating systems to start the container, which is easy to cause waste of resource environment, and save the resource environment when starting the container.
[0004] The technical scheme of the present application is implemented as follows:
[0005] An information processing method applied to a second operating system of a second electronic device, the method comprising:
[0006] establishing a protocol stack access channel between a first operating system of a first electronic device and the second operating system; wherein the protocol stack access channel is used at least for transmitting data related to a protocol stack;
[0007] receiving configuration information of a first protocol stack sent by the first operating system through the protocol stack access channel;
[0008] establishing a second protocol stack of the second operating system based on the configuration information of the first protocol stack;
[0009] start a to-be-run container on the second electronic device based on the second protocol stack; wherein the first electronic device and the second electronic device use different kernel spaces.
[0010] In the above solution, the establishing of the protocol stack access path between the first operating system of the first electronic device and the second operating system comprises:
[0011] loading an agent module;
[0012] establishing the protocol stack access path based on the service module of the first operating system and the agent module;
[0013] In the above solution, the configuration information of the first protocol stack sent by the first operating system is received through the protocol stack access path, and the configuration information of the first protocol layer in the first protocol stack sent by the first operating system is received through the protocol stack access path.
[0014]
[0015] In the above solution, the method further comprises:
[0016] receiving a first update request sent by the first operating system through the protocol stack access path, and updating the configuration information of the first protocol layer in the second protocol stack based on the first update request; wherein the first update request is an update request for the first protocol layer in the first protocol stack;
[0017] In the above solution, the method further comprises:
[0018] establishing a second interception layer in the second protocol stack;
[0019] updating the configuration information of the first protocol layer in the second protocol stack based on a second update request in the case that the second interception layer intercepts the second update request for the first protocol layer in the second protocol stack;
[0020] sending the second update request to the first operating system through the protocol stack access path, so that the first operating system updates the configuration information of the first protocol layer in the first protocol stack based on the second update request.
[0021] In the above solution, the method further comprises:
[0022] in the case that the second interception layer intercepts a state query request for the first protocol layer in the second protocol stack, sending the state query request to the first operating system based on the protocol stack access path;
[0023] access the protocol stack access channel to receive the state information of the first protocol layer in the first protocol stack sent by the first operating system in response to the state query request;
[0024] In the above scheme, the method further comprises:
[0025] In the case that the state information is not received within the target time, transmitting the state query request to the first protocol layer in the second protocol stack through the second interception layer;
[0026] Determine the state information based on the state query request through the first protocol layer in the second protocol stack.
[0027] In the above scheme, the method further comprises:
[0028] Access the protocol stack access channel to receive the change information of the first protocol layer in the first protocol stack sent by the first operating system;
[0029] Update the configuration information of the second protocol stack and / or the state of the second protocol stack based on the change information;
[0030] In the above scheme, the method further comprises:
[0031] Based on the protocol stack access channel, receive the current state information of the first protocol layer in the first protocol stack sent periodically by the first operating system;
[0032] Update the state of the first protocol layer in the second protocol stack based on the current state information.
[0033] An information processing method applied to a first operating system of a first electronic device, the method comprising:
[0034] Load a service module;
[0035] Based on the service module and a proxy module of a second operating system of a second electronic device, establish a protocol stack access channel; wherein the protocol stack access channel is used at least for transmitting data related to a protocol stack;
[0036] Send configuration information of a first protocol stack of the first operating system to the second operating system through the protocol stack access channel, so that the second operating system starts a to-be-run container on the second electronic device based on a second protocol stack; wherein the second protocol stack is established based on the configuration information of the first protocol stack, and the first electronic device and the second electronic device use different kernel spaces.
[0037] In the above scheme, the method further comprises:
[0038] establishing a first interception layer in the first protocol stack;
[0039] updating, by the first interception layer, configuration information of the first protocol layer in the first protocol stack based on a first update request in a case that the first update request is intercepted to the first protocol layer in the first protocol stack;
[0040] sending, by the protocol stack access channel, the first update request to the second operating system, so that the second operating system updates configuration information of the first protocol layer in the second protocol stack based on the first update request;
[0041] The method further comprises:
[0042] receiving, by the protocol stack access channel, a second update request sent by the second operating system, and updating configuration information of the first protocol layer in the first protocol stack based on the second update request; wherein the second update request is an update request for the first protocol layer in the second protocol stack.
[0043] The method further comprises:
[0044] receiving, by the protocol stack access channel, a second update request sent by the second operating system, and updating configuration information of the first protocol layer in the first protocol stack based on the second update request; wherein the second update request is an update request for the first protocol layer in the second protocol stack.
[0045] sending, by the protocol stack access channel, the state information to the second operating system;
[0046] Correspondingly, the method further comprises:
[0047] in a case that the first protocol layer in the first protocol stack changes due to the second protocol layer of the first operating system, obtaining change information of the first protocol layer in the first protocol stack;
[0048] sending, by the protocol stack access channel, the change information to the second operating system, so that the second operating system updates configuration information of the second protocol stack and / or a state of the second protocol stack based on the change information.
[0049] The method further comprises:
[0050] periodically obtaining current state information of the first protocol layer in the first protocol stack;
[0051] sending, by the protocol stack access channel, the current state information to the second operating system, so that the second operating system updates a state of the first protocol layer in the second protocol stack based on the current state information.
[0052] An electronic device, comprising: a processor, a memory and a communication bus;
[0053] The communication bus is used to realize the communication connection between the processor and the memory;
[0054] The processor is used to execute the information processing program in the memory to realize the steps of the above information processing method.
[0055] The information processing method and the electronic device provided by the embodiments of the present application establish a protocol stack access path between the first operating system of the first electronic device and the second operating system of the second electronic device; wherein the protocol stack access path is used at least for transmitting data related to the protocol stack; through the protocol stack access path, the configuration information of the first protocol stack sent by the first operating system is received; the second protocol stack of the second operating system is established based on the configuration information of the first protocol stack; and the to-be-run container on the second electronic device is started based on the second protocol stack; in this way, the configuration information of the first protocol stack can be obtained based on the protocol stack access path, and the second protocol stack can be created on the second operating system of the second electronic device based on the configuration information of the first protocol stack, so that the second protocol stack can be synchronized with the first protocol stack of the first operating system, and the container supporting the local protocol stack can be started when the runv environment is deployed on the second electronic device, without the need to additionally deploy the runc environment on the second operating system to start the container supporting the local protocol stack, thereby saving the resource environment when starting the container, and solving the problem of resource environment waste caused by the need to respectively deploy the runc and runv runtime environments on different operating systems to start the container in the related art. BRIEF DESCRIPTION OF DRAWINGS
[0056] Figure 1 A flowchart of an information processing method provided by an embodiment of the present application;
[0057] Figure 2 A flowchart of another information processing method provided by an embodiment of the present application;
[0058] Figure 3 A flowchart of another information processing method provided by an embodiment of the present application;
[0059] Figure 4 A partial structure diagram of the first protocol stack and the second protocol stack in the information processing method provided by an embodiment of the present application;
[0060] Figure 5 A structure diagram of the first protocol stack and the second protocol stack in the information processing method provided by another embodiment of the present application;
[0061] Figure 6A flowchart of an information processing method provided for another embodiment of the present application is shown in the figure;
[0062] Figure 7 A data flow diagram when a guest OS configuration changes in an information processing method provided for an embodiment of the present application is shown in the figure;
[0063] Figure 8 A data flow diagram when a host OS configuration changes in an information processing method provided for an embodiment of the present application is shown in the figure;
[0064] Figure 9 A data flow diagram when a state is queried in an information processing method provided for an embodiment of the present application is shown in the figure;
[0065] Figure 10 A structural diagram of an electronic device provided for an embodiment of the present application is shown in the figure. DETAILED DESCRIPTION
[0066] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application.
[0067] It should be understood that the specific embodiments described herein are merely intended to explain the present application and not to limit the present application.
[0068] An information processing method is provided in the embodiments of the present application, which is applied to a second operating system of a second electronic device, and with reference to the figure, Figure 1 the method includes the following steps:
[0069] Step 101: Establish a protocol stack access path between a first operating system of a first electronic device and the second operating system.
[0070] The protocol stack access path is at least used for transmitting data related to a protocol stack.
[0071] In the embodiments of the present application, the first electronic device and the second electronic device can both be devices with data processing capability, and it is not required to be a physical device. The first electronic device and the second electronic device can be devices in the following schemes: (1) the first electronic device is a physical machine A, and the second electronic device can be a virtual machine C established on the physical machine A, and the second electronic device can also be a virtual machine D established on a physical machine B; (2) in the above (1), the first electronic device can be a virtual machine E established on the physical machine A in addition to the physical machine A. It should be noted that the first electronic device and the second electronic device use different kernel spaces.
[0072] Correspondingly, the first operating system and the second operating system can be in the same physical machine, for example, the first operating system is a host os of a physical machine 1, and the second operating system is a guest os of a virtual machine on the physical machine 1, or the first operating system is a host os 1 of a virtual machine M on the physical machine 1, and the second operating system is a host os 2 of a virtual machine N on the physical machine 1; of course, the first operating system and the second operating system can also be in different physical machines, for example, the first operating system is a host os of a physical machine 1, and the second operating system is a guest os of a virtual machine on a physical machine 2, or the first operating system is a guest os of a virtual machine on the physical machine 1, and the second operating system is a guest os of a virtual machine on the physical machine 2.
[0073] That is, in a feasible implementation manner, the first operating system can be an operating system locally installed on the first electronic device, and the second operating system can be an operating system installed on a virtual machine running on the same electronic device; of course, the second operating system can also be an operating system of a virtual machine running on another electronic device.
[0074] In the embodiment of the present application, the protocol stack access channel can be that the second operating system initiates a connection request for establishing the protocol stack access channel to the first operating system on the first electronic device before starting the to-be-run container, and the first operating system establishes in response to the connection request after receiving the connection request; of course, the first operating system on the first electronic device can also initiate a connection request for establishing the protocol stack access channel to the second operating system of the second electronic device after starting, and the second operating system establishes in response to the connection request after receiving the connection request.
[0075] In the case where the first operating system is an operating system locally installed on the first electronic device, and the second operating system is an operating system installed on a virtual machine running on the same electronic device, the first operating system can also be referred to as an operating system of a host or a local operating system.
[0076] Step 102, receiving configuration information of a first protocol stack sent by the first operating system through the protocol stack access channel.
[0077] The first protocol stack is the protocol stack of the first operating system, and can also be referred to as a local protocol stack.
[0078] In the embodiment of the present application, the second operating system can access the protocol stack through the access channel, initiate a request for obtaining configuration information of the first protocol stack to the first operating system, and the first operating system can send the configuration information of the first protocol stack to the second operating system based on the request after receiving the request. Of course, the first operating system can also actively send the configuration information of the first protocol stack to the second operating system through the protocol stack access channel after starting. The configuration information of the first protocol stack can include network interface information and routing table information.
[0079] In a possible implementation, the configuration information of the first protocol stack can include at least one of a network interface connected in the first operating system, address resolution protocol (ARP) information, and a state of a socket link established in the first operating system.
[0080] Step 103, establishing a second protocol stack of the second operating system based on the configuration information of the first protocol stack.
[0081] In the embodiment of the present application, the first protocol stack and the second protocol stack can be the same; wherein the second protocol stack can be a mirror image of the first protocol stack initialized by the second operating system according to the configuration information of the first protocol stack. In this way, the second protocol stack of the second operating system of the virtual machine and the first protocol stack of the first operating system of the host can be synchronized, so as to start the to-be-run container later.
[0082] Step 104, starting a to-be-run container on the second electronic device based on the second protocol stack.
[0083] The to-be-run container can include a monitoring pod and a container network interface (Cantainer Network Interface, CNI) pod. The monitoring pod is used to periodically collect network interface statistical data, and the container network CNI pod is used to create a new network namespace and a tun interface. The pod is the smallest deployable computing unit that can be created and managed in kubernetes, and the pod is composed of at least one container. Kubernetes is an open source that is used to manage containerized applications on multiple hosts in a cloud platform, and is abbreviated as k8s.
[0084] In the embodiment of the present application, after the second protocol stack of the virtual machine is synchronized with the first protocol stack, the runv environment can be deployed on the virtual machine to start the container supporting the local protocol stack, which realizes that the virtual machine itself can start the container not supporting the local protocol stack and the container supporting the local protocol stack under the runv environment, and the runc environment does not need to be additionally deployed on the second operating system to start the container supporting the local protocol stack, thereby saving the resource environment when starting the to-be-run container. The second operating system on the virtual machine can also use the host network namespace of the first operating system under the runv.
[0085] The runv environment refers to a container runtime environment in which a virtual machine is started by full virtualization such as qemu / Kernel-based virtual machine (KVM), and a container is started in an independent kernel space in the virtual machine.
[0086] In addition, through the protocol stack access channel between the first operating system and the second operating system, the data synchronization between the first protocol stack of the first operating system and the second protocol stack of the second operating system can be realized, so that the pod using qemu virtualization as the runtime can also use the host network mode in k8s, and the security of the container runtime is improved. The host network mode refers to that the container does not obtain an independent Network Namespace, but uses the Network Namespace of the host, and the container does not virtually output its own network card, configure its own IP, etc., but uses the IP and port of the host.
[0087] The information processing method provided by the embodiments of the present application establishes a protocol stack access path between a first operating system of a first electronic device and a second operating system of a second electronic device; wherein the protocol stack access path is used at least for transmitting data related to a protocol stack; configuration information of a first protocol stack sent by the first operating system is received through the protocol stack access path; a second protocol stack of the second operating system is established based on the configuration information of the first protocol stack; and a to-be-run container on the second electronic device is started based on the second protocol stack; in this way, the configuration information of the first protocol stack can be obtained based on the protocol stack access path, and the second protocol stack can be created on the second operating system of the second electronic device based on the configuration information of the first protocol stack, so that the second protocol stack can be synchronized with the first protocol stack of the first operating system, and the container supporting the local protocol stack can be started when the runv environment is deployed on the second electronic device, without the need to additionally deploy the runc environment on the second operating system to start the container supporting the local protocol stack, thereby saving the resource environment when starting the container, and solving the problem of wasting the resource environment in the related art because the runc and runv runtime environments need to be respectively deployed on different operating systems to start the container.
[0088] Based on the foregoing embodiments, the embodiments of the present application provide an information processing method, which can be applied to a first operating system of a first electronic device, as shown in the following Figure 2 The method can include the following steps:
[0089] Step 201, loading a service module.
[0090] In the embodiments of the present application, the first operating system can add a service module in the first protocol stack, so as to subsequently establish a protocol stack access path between the first operating system and the second operating system through the service module. The service module can be automatically loaded by the first operating system after startup; or the service module can be loaded by the first operating system according to a received first loading instruction after startup; wherein the first loading instruction is an instruction for indicating to load the service module.
[0091] In an implementation manner, the first operating system can be represented as Host OS, and the service module can be represented as server; wherein the server can be added in the first protocol stack of the Host OS.
[0092] Step 202, establishing a protocol stack access path based on the service module and an agent module of the second operating system of the second electronic device.
[0093] The protocol stack access path is used at least for transmitting data related to a protocol stack.
[0094] In the embodiment of the present application, the proxy module can be a module loaded by the second operating system itself; wherein the protocol stack access channel can be that the proxy module initiates a connection request for establishing the protocol stack access channel to the service module, and the service module establishes the target connection with the proxy module after receiving the connection request; of course, the protocol stack access channel can also be that the service module initiates a connection request for establishing the protocol stack access channel to the proxy module on the second operating system after the first operating system is started, and the proxy module establishes the target connection with the service module after receiving the connection request.
[0095] Step 203, sending configuration information of the first protocol stack of the first operating system to the second operating system through the protocol stack access channel, so that the second operating system starts the to-be-run container on the second electronic device based on the second protocol stack.
[0096] Wherein, the second protocol stack is established based on the configuration information of the first protocol stack.
[0097] In the embodiment of the present application, the configuration information of the first protocol stack can be actively sent by the first operating system to the second operating system through the protocol stack access channel; it can also be sent by the first operating system to the second operating system in response to the acquisition request for acquiring the configuration information of the first protocol stack after the first operating system receives the acquisition request sent by the second operating system.
[0098] The information processing method provided by the embodiment of the present application loads the service module; establishes a protocol stack access channel based on the service module and the proxy module of the second operating system; wherein the protocol stack access channel is at least used for transmitting data related to the protocol stack; sends the configuration information of the first protocol stack of the first operating system to the second operating system through the protocol stack access channel, so that the second operating system starts the to-be-run container on the second electronic device based on the second protocol stack; wherein the second protocol stack is established based on the configuration information of the first protocol stack; in this way, the proxy module on the second operating system can acquire the configuration information of the first protocol stack based on the protocol stack access channel, and create the second protocol stack on the second operating system based on the configuration information of the first protocol stack, so that the second protocol stack of the second operating system can be synchronized with the first protocol stack of the first operating system, and the container supporting the local protocol stack can be started when the runv environment is deployed on the virtual machine, without the need to additionally deploy the runc environment on the second operating system to start the container supporting the local protocol stack, thereby saving the resource environment when starting the container, and solving the problem of wasting the resource environment in the related art, which needs to deploy the runc and runv runtime environments on different operating systems to start the container.
[0099] Based on the foregoing embodiment, the embodiment of the present application further provides an information processing method, as shown in Figure 3 The method comprises the following steps:
[0100] Step 301, a first operating system of the first electronic device loads a service module.
[0101] Step 302, a second operating system of the second electronic device loads an agent module.
[0102] In the embodiment of the present application, the agent module can be automatically loaded by the second operating system after starting; or the agent module can be loaded by the second operating system according to a received second loading instruction after starting; wherein the second loading instruction is an instruction for indicating to load the agent module.
[0103] In a feasible implementation manner, the second operating system can represent a guest os, and the agent module can represent an agent; wherein the agent can be added in a first protocol stack of the guest os.
[0104] Step 303, the second operating system of the second electronic device establishes a protocol stack access path based on the service module and the agent module of the first operating system.
[0105] The protocol stack access path is at least used for transmitting data related to the protocol stack.
[0106] In the embodiment of the present application, the agent module can initiate a connection request for establishing the protocol stack access path to the service module, and the service module can respond to the connection request and perform target connection with the agent module of the second operating system to establish the protocol stack access path.
[0107] In a feasible implementation manner, the service module and the agent module can be connected through a tunnel; wherein the target connection includes the tunnel connection.
[0108] Step 304, the first operating system of the first electronic device sends configuration information of a first protocol stack of the first operating system to the second operating system through the protocol stack access path, so that the second operating system starts a to-be-run container on the second electronic device based on a second protocol stack.
[0109] The second protocol stack is established based on the configuration information of the first protocol stack, and the first electronic device and the second electronic device use different kernel spaces.
[0110] Step 305, the second operating system of the second electronic device receives the configuration information of the first protocol stack sent by the first operating system through the protocol stack access path.
[0111] It should be noted that step 305 can be implemented through step a1:
[0112] Step a1: The second operating system of the second electronic device receives the configuration information of the first protocol layer in the first protocol stack sent by the first operating system through the protocol stack access path.
[0113] In this embodiment of the application, the first protocol layer may include at least one of a socket layer, a network layer, a device interface layer, and a driver layer; the configuration information of the first protocol layer includes at least one of the configuration information of the socket layer, the network layer, the device interface layer, and the driver layer.
[0114] Step 306: The second operating system of the second electronic device establishes the second protocol stack of the second operating system based on the configuration information of the first protocol stack.
[0115] In this embodiment of the application, the second operating system can establish a second protocol stack of the second operating system based on the configuration information of the first protocol layer in the first protocol stack; wherein, the first protocol layer in the first protocol stack and the first protocol layer in the second protocol stack are the same.
[0116] like Figure 4 As shown, the host OS includes an application layer, system call interface, socket layer, network layer, device interface layer, driver layer, and physical layer; wherein, the first protocol layer in the first protocol stack includes the socket layer, network layer, device interface layer, and driver layer. The guest OS includes an application layer, system call interface, socket layer, network layer, device interface layer, and driver layer; wherein, the first protocol layer in the second protocol stack also includes the socket layer, network layer, device interface layer, and driver layer.
[0117] Step 307: The second operating system of the second electronic device starts the container to be run on the second electronic device based on the second protocol stack.
[0118] Based on the foregoing embodiments, in other embodiments of this application, the information processing method may include the following steps:
[0119] Step 308: The first operating system of the first electronic device establishes a first interception layer in the first protocol stack.
[0120] In this embodiment, the first interception layer may be established when the first operating system loads the service module; the first operating system may establish the first interception layer between the system call interface and the socket layer in the first protocol stack. The first interception layer is at least used to intercept the first update request targeting the first protocol layer in the first protocol stack.
[0121] In one feasible implementation, when the host OS kernel initializes, the loaded service module establishes a first interception layer between the system call interface and the socket layer in the first protocol stack.
[0122] Step 309, the first operating system of the first electronic device updates the configuration information of the first protocol layer in the first protocol stack based on the first update request in a case that the first interception layer intercepts the first update request for the first protocol layer in the first protocol stack.
[0123] In the embodiment of the present application, when the system call interface in the first protocol stack is called by the application program on the first operating system, the first interception layer can intercept the first update request for the first protocol layer in the first protocol stack, and then update the configuration information of the first protocol layer in the first protocol stack based on the first update request.
[0124] In a feasible implementation, when the host os has a configuration change, such as the system call interface in the first protocol stack of the host os being called by the application program of the first operating system, the first interception layer can update the configuration information of the socket layer, the network layer, the device interface layer and the driver layer in the first protocol stack based on the intercepted first update request.
[0125] Step 310, the first operating system of the first electronic device sends the first update request to the second operating system through the protocol stack access channel, so that the second operating system updates the configuration information of the first protocol layer in the second protocol stack based on the first update request.
[0126] In the embodiment of the present application, when the first interception layer intercepts the first update request, the first update request can be transmitted to the service module, so that the service module sends the first update request to the agent module through the protocol stack access channel, so that the agent module can synchronously update the configuration information of the first protocol layer in the second protocol stack based on the first update request.
[0127] In a feasible implementation, when the first interception layer updates the configuration information of the first protocol layer based on the first update request, the first update request can be sent to the agent of the guest os through the service module based on the protocol stack access channel, so as to realize that the agent synchronously updates the configuration information of the first protocol layer in the second protocol stack.
[0128] Step 311, the second operating system of the second electronic device receives the first update request sent by the first operating system through the protocol stack access channel, and updates the configuration information of the first protocol layer in the second protocol stack based on the first update request.
[0129] The first update request is an update request for the first protocol layer in the first protocol stack.
[0130] In this embodiment of the application, the proxy module in the second operating system can receive the first update request sent by the service module through the protocol stack access path, and transmit the first update request to the second interception layer, so that the second interception layer can update the configuration information of the first protocol layer in the second protocol stack based on the first update request.
[0131] Step 312: The second operating system of the second electronic device establishes a second interception layer in the second protocol stack.
[0132] In this embodiment, the second operating system can establish a second interception layer between the system call interface and the socket layer in the second protocol stack. This second interception layer is used at least to intercept the second update request.
[0133] like Figure 5 As shown, a first interception layer can be established between the system call interface and the socket layer of the first protocol stack in the host OS; similarly, a second interception layer can be established between the system call interface and the socket layer of the second protocol stack in the guest OS.
[0134] In one feasible implementation, such as Figure 6 As shown, during the initialization of the host OS kernel, the server can be loaded and the first interception layer can be established. After that, the guest OS kernel can create an agent. The agent can send a connection request to the server to establish a protocol stack access path. After the protocol stack access path is successfully established, the server can send the configuration information of the first protocol stack to the agent through the protocol stack access path. The agent can establish a second protocol stack based on the received configuration information of the first protocol stack, and then establish a second interception layer.
[0135] Step 313: When the second operating system of the second electronic device intercepts a second update request for the first protocol layer in the second protocol stack through the second interception layer, it updates the configuration information of the first protocol layer in the second protocol stack based on the second update request.
[0136] In this embodiment of the application, when the system call interface in the second protocol stack is called by an application of the second operating system, the second interception layer can intercept the second update request for the first protocol layer in the second protocol stack, and then update the configuration information of the first protocol layer in the second protocol stack based on the second update request.
[0137] In one feasible implementation, such as Figure 7As shown, when the guest OS undergoes configuration changes, such as when a system call interface in the first protocol stack of the guest OS is invoked by an application, the second interception layer can update the configuration information of the socket layer, network layer, device interface layer, and driver layer in the second protocol stack based on the intercepted second update request; among which, Figure 7 The second interception layer refers to the socket layer, network layer, device interface layer, and driver layer in the second protocol stack, indicating that the second interception layer needs to update the configuration information of the socket layer, network layer, device interface layer, and driver layer in the second protocol stack based on the second update request.
[0138] Step 314: The second operating system of the second electronic device sends a second update request to the first operating system through the protocol stack access path, so that the first operating system updates the configuration information of the first protocol layer in the first protocol stack based on the second update request.
[0139] In this embodiment of the application, when the second interception layer intercepts the second update request, the second update request can also be transmitted to the proxy module. The proxy module can send the second update request to the service module through the protocol stack access path, so that the service module can send the second update request to the first interception layer, so that the first interception layer can synchronously update the configuration information of the first protocol layer in the second protocol stack.
[0140] Step 315: The first operating system of the first electronic device receives the second update request sent by the second operating system through the protocol stack access path, and updates the configuration information of the first protocol layer in the first protocol stack based on the second update request.
[0141] The second update request is an update request for the first protocol layer in the second protocol stack.
[0142] In this embodiment of the application, the service module in the first operating system can receive the second update request sent by the proxy module through the protocol stack access path, and transmit the second update request to the first interception layer of the first protocol stack, so that the first interception layer can update the configuration information of the first protocol layer based on the first update request.
[0143] In one feasible implementation, such as Figure 8 As shown, when the server in the first operating system receives the second update request sent by the agent, it sends the second update request to the first interception layer, enabling the first interception layer to update the configuration information of the socket layer, network layer, device interface layer, and driver layer in the first protocol stack based on the second update request; where, Figure 8The first interception layer is directed to a socket layer, a network layer, a device interface layer and a driver layer in the first protocol stack, and indicates that the first interception layer needs to update configuration information of the socket layer, the network layer, the device interface layer and the driver layer in the first protocol stack based on the second update request.
[0144] Step 316, in the case that the second interception layer intercepts a state query request for the first protocol layer in the second protocol stack, the second operating system of the second electronic device sends the state query request to the first operating system based on the protocol stack access channel.
[0145] In the embodiment of the present application, when the system call interface of the second protocol stack receives a state query request initiated by the application layer in the second operating system, the state query request is transmitted to the second interception layer, and the second interception layer transmits the state query request to the proxy module. Then, the proxy module can send the state query request to the service module through the protocol stack access channel.
[0146] Step 317, the first operating system of the first electronic device receives the state query request for the first protocol layer in the second protocol stack sent by the second operating system, and determines the state information of the first protocol layer in the first protocol stack based on the state query request.
[0147] In the embodiment of the present application, the service module can receive the state query request through the protocol stack access channel, and transmit the state query request to the first interception layer. The first interception layer can perform a query operation on the first protocol stack based on the state query request, and obtain the state information of the first protocol layer.
[0148] Step 318, the first operating system of the first electronic device sends the state information to the second operating system through the protocol stack access channel.
[0149] In the embodiment of the present application, the first interception layer can transmit the state information to the service module, so that the service module sends the state information to the proxy module through the protocol stack access channel.
[0150] Step 319, the second operating system of the second electronic device receives the state information of the first protocol layer in the first protocol stack sent by the first operating system in response to the state query request through the protocol stack access channel.
[0151] In the embodiment of the present application, the proxy module of the second operating system can receive the state information sent by the first operating system through the protocol stack access channel, and transmit the state information to the second interception layer. The second interception layer can send the state information to the application layer of the second operating system.
[0152] In a feasible implementation manner, as Figure 9As shown, when the application in the guest OS initiates a state query request for the first protocol layer in the second protocol stack, the second interception layer can intercept the state query request and send the state query request to the agent, and then the agent can send the state query request to the server through the protocol stack access channel, the server can forward the received state query request to the first interception layer, so that the first interception layer can query the first protocol layer based on the state query request to obtain the state information, and then the first interception layer can transmit the state information to the server, the server can transmit the state information to the agent through the protocol stack access channel, and the agent transmits the received state information to the second interception layer, and the second interception layer can transmit the state information to the application layer. Wherein, Figure 9 In the "1-6", the data flow from the application in the guest OS from initiating a state query request to receiving state information; the first interception layer points to the socket layer, the network layer, the device interface layer and the driver layer in the first protocol stack, indicating that the first interception layer needs to query the state of the socket layer, the network layer, the device interface layer and the driver layer in the first protocol stack based on the state query request.
[0153] Step 320, in the case where the state information is not received within the target time, the second operating system of the second electronic device transmits the state query request to the first protocol layer in the second protocol stack through the second interception layer.
[0154] In the embodiment of the application, the target time can be determined according to the time when the agent sends the state query request and the preset time length; when the state information is not received within the target time, the second interception layer can transmit the state query request to the first protocol layer in the second protocol stack to query the protocol stack of the second operating system to obtain the state information.
[0155] Step 321, the second operating system of the second electronic device determines the state information based on the state query request through the first protocol layer in the second protocol stack.
[0156] In the embodiment of the application, the state information can be obtained by feeding back the state of the first protocol layer in the second protocol stack based on the state query request.
[0157] Step 322, in the case where the first protocol layer in the first protocol stack changes due to the second protocol layer of the first operating system, the first operating system of the first electronic device obtains the change information of the first protocol layer in the first protocol stack.
[0158] The second protocol layer can include a physical layer.
[0159] In the embodiments of the present application, the service module can monitor the first protocol stack, and when it is detected that the second protocol layer of the first operating system changes, it is determined that the first protocol layer will also change, and then the change information of the first protocol layer is acquired.
[0160] In step 323, the first operating system of the first electronic device sends the change information to the second operating system through the protocol stack access channel, so that the second operating system updates the configuration information of the second protocol stack and / or the state of the second protocol stack based on the change information.
[0161] In the embodiments of the present application, the service module can send the change information to the agent module through the protocol stack access channel, so that the agent module can synchronously update the configuration information of the first protocol layer in the second protocol stack and / or the state of the first protocol layer in the second protocol stack.
[0162] In a feasible implementation, when the Server detects that the host os physical layer changes, the Server timely sends the change information of the driver layer in the first protocol layer of the host os and the change information of the device interface layer to the agent, and the agent updates the configuration information of the first protocol layer in the second protocol stack.
[0163] In step 324, the second operating system of the second electronic device receives the change information of the first protocol layer in the first protocol stack sent by the first operating system through the protocol stack access channel.
[0164] In the embodiments of the present application, the agent module of the second operating system can receive the change information of the first protocol layer in the first protocol stack through the protocol stack access channel.
[0165] In step 325, the second operating system of the second electronic device updates the configuration information of the second protocol stack and / or the state of the second protocol stack based on the change information.
[0166] In the embodiments of the present application, the agent module can update the configuration information of the first protocol layer in the second protocol stack based on the change information; the agent module can also update the state of the first protocol layer in the second protocol stack based on the change information; the agent module can also simultaneously update the configuration information of the first protocol layer in the second protocol stack and the state of the first protocol layer in the second protocol stack.
[0167] In step 326, the first operating system of the first electronic device periodically acquires the current state information of the first protocol layer in the first protocol stack.
[0168] In the embodiments of the present application, the service module can periodically query the current state information of the first protocol layer in the first protocol stack according to a target preset time length; wherein the target preset time length can be determined according to the historical state change time of the first protocol layer.
[0169] Step 327, the first operating system of the first electronic device sends the current state information to the second operating system through the protocol stack access channel, so that the second operating system updates the state of the first protocol layer in the second protocol stack based on the current state information.
[0170] In the embodiment of the present application, the service module can send the current state information of the first protocol layer in the first protocol stack to the agent module through the protocol stack access channel.
[0171] Step 328, the second operating system of the second electronic device receives the current state information of the first protocol layer in the first protocol stack periodically sent by the first operating system based on the protocol stack access channel.
[0172] In the embodiment of the present application, the agent module can receive the current state information of the first protocol layer periodically sent by the service module through the protocol stack access channel.
[0173] Step 329, the second operating system of the second electronic device updates the state of the first protocol layer in the second protocol stack based on the current state information.
[0174] In the embodiment of the present application, the agent module can update the state of the first protocol layer in the second protocol stack based on the current state information of the first protocol layer in the first protocol stack, so as to realize the state synchronization of the first protocol layer in the first protocol stack and the second protocol layer in the second protocol stack.
[0175] It should be noted that, preferably, the first operating system and the second operating system are in the same electronic device; wherein the first operating system can be an operating system locally installed on the electronic device, and the second operating system can be an operating system of a virtual machine running on the electronic device; in this way, the synchronization of the first protocol stack with the first operating system on the second operating system can reduce network time overhead, ensure the synchronization of the protocol stack between the first operating system and the second operating system, and improve the reliability of the synchronized first protocol stack.
[0176] It should be noted that the same steps and the same content in the embodiment and other embodiments are described with reference to the description of other embodiments, and will not be described here.
[0177] The information processing method provided by the embodiment of the present application can obtain configuration information of the first protocol stack based on the protocol stack access path, create a second protocol stack on the second operating system of the second electronic device based on the configuration information of the first protocol stack, and enable the second protocol stack to be synchronized with the first protocol stack of the first operating system, so that the container supporting the local protocol stack can be started when the runv environment is deployed on the second electronic device, and the runc environment does not need to be additionally deployed on the second operating system to start the container supporting the local protocol stack, thereby saving the resource environment when starting the container, and solving the problem that in the related art, the runc and runv runtime environments need to be respectively deployed on different operating systems to start the container, which is easy to cause waste of the resource environment.
[0178] Based on the foregoing embodiments, the embodiments of the present application provide an electronic device, which includes a first electronic device and a second electronic device, the first electronic device can be applied to Figure 2 and Figure 3 In the information processing method provided by the corresponding embodiments, the second electronic device can be applied to Figure 1 and Figure 3 Corresponding to the information processing method provided by the embodiments, referring to Figure 10 The electronic device 4 can include a processor 41, a memory 42, and a communication bus 43, wherein:
[0179] The communication bus 43 is configured to realize the communication connection between the processor 41 and the memory 42;
[0180] The processor 41 is configured to execute the information processing program in the memory 42, and when the electronic device includes the second electronic device, the above-mentioned Figure 1 and Figure 3 The steps of the information processing method provided by the corresponding embodiments, or when the electronic device includes the first electronic device, the above-mentioned Figure 2 and Figure 3 The steps of the information processing method provided by the corresponding embodiments.
[0181] The electronic device provided by the embodiment of the present application can enable the proxy module on the second operating system of the second electronic device to obtain the configuration information of the first protocol stack based on the protocol stack access channel, and create the second protocol stack on the second operating system of the virtual machine based on the configuration information of the first protocol stack, so that the protocol stack of the second operating system can be synchronized with the protocol stack of the first operating system, and the container supporting the local protocol stack can be started when the runv environment is deployed on the virtual machine, without the need to additionally deploy the runc environment on the second operating system to start the container supporting the local protocol stack, thereby saving the resource environment when starting the container, and solving the problem in the related art that the runc and runv runtime environments need to be respectively deployed on different operating systems to start the container, which is easy to cause waste of the resource environment.
[0182] Based on the foregoing embodiments, the embodiments of the present application provide a computer-readable storage medium storing one or more programs, which can be executed by one or more processors to implement Figures 1-3 The steps of the information processing method provided by the corresponding embodiments.
[0183] It should be noted that the computer-readable storage medium described above 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), a Ferromagnetic Random Access Memory (FRAM), a Flash Memory, a magnetic surface memory, an optical disc, or a Compact Disc Read-Only Memory (CD-ROM), etc. The computer-readable storage medium can also be various electronic devices including one or any combination of the above storage devices, such as a mobile phone, a computer, a tablet device, a personal digital assistant, etc.
[0184] It should be noted that, in the present document, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises a", "comprising", or "comprises" does not, without more constraints, preclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0185] The above-mentioned sequence numbers of the embodiments of the present application are only for description, and do not represent advantages or disadvantages of the embodiments.
[0186] Those skilled in the art can clearly understand the above-mentioned embodiment method by means of software and necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, or optical disc) and includes a plurality of instructions for causing a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device) to execute the methods described in various embodiments of the present application.
[0187] The present application is described with reference to flowcharts and / or block diagrams according to the methods, devices (systems), and computer program products of the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as combinations of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in one or more flows and / or blocks Figure 1 The functions specified in one or more flows and / or blocks
[0188] These computer program instructions can also be stored in a computer-readable storage medium that can direct the computer or other programmable data processing devices to work in a specific manner, so that the instructions stored in the computer-readable storage medium produce a manufactured product including instruction devices that implement the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in one or more flows and / or blocks Figure 1 The functions specified in one or more flows and / or blocks
[0189] These computer program instructions can also be loaded into a computer or other programmable data processing devices, so that a series of operational steps are performed on the computer or other programmable data processing devices to generate a computer-implemented process, so that the instructions executed on the computer or other programmable devices provide a process for implementing the functions specified in the flowchart Figure 1 one flow or multiple flows and / or the functions specified in the block Figure 1 one flow or multiple flows and / or the functions specified in the block
[0190] The above is only the preferred embodiment of the present application, and does not limit the patent scope of the present application, and any equivalent structure or equivalent flow transformation using the content of the specification and drawings of the present application, or direct or indirect application in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. An information processing method, applied to a second operating system of a second electronic device, the method comprising: A protocol stack access path is established between a first operating system and a second operating system of a first electronic device; wherein, the protocol stack access path is at least used for transmitting data related to the protocol stack; The system receives configuration information of the first protocol stack sent by the first operating system through the protocol stack access path. A second protocol stack for the second operating system is established based on the configuration information of the first protocol stack; The container to be run on the second electronic device is started based on the second protocol stack; The first electronic device and the second electronic device use different kernel spaces; a runc environment is deployed on the first operating system; and a runv environment is deployed on the second operating system.
2. The method according to claim 1, wherein establishing a protocol stack access path between the first operating system and the second operating system of the first electronic device includes: Load the proxy module; Based on the service module of the first operating system and the proxy module, establish the protocol stack access path; Accordingly, through the protocol stack access path, the configuration information of the first protocol stack sent by the first operating system is received, including: The system receives configuration information of the first protocol layer in the first protocol stack sent by the first operating system through the protocol stack access path.
3. The method according to claim 1, further comprising: The system receives a first update request sent by the first operating system through the protocol stack access path, and updates the configuration information of the first protocol layer in the second protocol stack based on the first update request; wherein, the first update request is an update request for the first protocol layer in the first protocol stack. Accordingly, the method further includes: Establish a second interception layer in the second protocol stack; When the second interception layer intercepts a second update request for the first protocol layer in the second protocol stack, it updates the configuration information of the first protocol layer in the second protocol stack based on the second update request. The second update request is sent to the first operating system through the protocol stack access path, so that the first operating system updates the configuration information of the first protocol layer in the first protocol stack based on the second update request.
4. The method according to claim 3, further comprising: If the second interception layer intercepts a status query request for the first protocol layer in the second protocol stack, the status query request is sent to the first operating system based on the protocol stack access path. Through the protocol stack access path, the status information of the first protocol layer in the first protocol stack sent by the first operating system in response to the status query request is received; Accordingly, the method further includes: If the status information is not received within the target time, the status query request is transmitted to the first protocol layer in the second protocol stack through the second interception layer. The status information is determined based on the status query request through the first protocol layer in the second protocol stack.
5. The method according to claim 1, further comprising: Through the protocol stack access path, receive change information of the first protocol layer in the first protocol stack sent by the first operating system; Update the configuration information of the second protocol stack and / or the state of the second protocol stack based on the change information; Accordingly, the method further includes: Based on the protocol stack access path, the current status information of the first protocol layer in the first protocol stack is received periodically by the first operating system; Update the state of the first protocol layer in the second protocol stack based on the current state information.
6. An information processing method applied to a first operating system of a first electronic device, the method comprising: Load the service module; Based on the agent module of the second operating system of the service module and the second electronic device, a protocol stack access path is established; wherein, the protocol stack access path is at least used to transmit data related to the protocol stack; The configuration information of the first protocol stack of the first operating system is sent to the second operating system through the protocol stack access path, so that the second operating system can start the container to be run on the second electronic device based on the second protocol stack; wherein, the second protocol stack is built based on the configuration information of the first protocol stack, and the kernel space used by the first electronic device and the second electronic device is different; a runc environment is deployed on the first operating system; and a runv environment is deployed on the second operating system.
7. The method according to claim 6, further comprising: Establish a first interception layer in the first protocol stack; If the first interception layer intercepts a first update request for the first protocol layer in the first protocol stack, it updates the configuration information of the first protocol layer in the first protocol stack based on the first update request. The first update request is sent to the second operating system through the protocol stack access path, so that the second operating system updates the configuration information of the first protocol layer in the second protocol stack based on the first update request; Accordingly, the method further includes: The second update request sent by the second operating system is received through the protocol stack access path, and the configuration information of the first protocol layer in the first protocol stack is updated based on the second update request; wherein, the second update request is an update request for the first protocol layer in the second protocol stack.
8. The method according to claim 6, further comprising: Receive a status query request sent by the second operating system for the first protocol layer in the second protocol stack, and determine the status information of the first protocol layer in the first protocol stack based on the status query request; The status information is sent to the second operating system through the protocol stack access path; Accordingly, the method further includes: When the second protocol layer of the first operating system causes a change in the first protocol layer in the first protocol stack, obtain the change information of the first protocol layer in the first protocol stack; The change information is sent to the second operating system through the protocol stack access path, so that the second operating system updates the configuration information and / or the state of the second protocol stack based on the change information.
9. The method according to claim 6, further comprising: Periodically obtain the current state information of the first protocol layer in the first protocol stack; The current status information is sent to the second operating system through the protocol stack access path, so that the second operating system updates the status of the first protocol layer in the second protocol stack based on the current status information.
10. An electronic device, the electronic device comprising: Processor, memory, and communication bus; The communication bus is used to realize the communication connection between the processor and the memory; The processor is used to execute an information processing program in the memory to implement the steps of the information processing method according to any one of claims 1 to 5 or 6 to 9.
Citation Information
Patent Citations
User protocol stack operation method and device
CN108737465A
Communication control method and device between containers, computer equipment and storage medium
CN113824622A