Method, device and equipment for realizing metadata service by bare computer gateway and medium
The bare-metal gateway receives and processes metadata requests and generates new IP addresses, which solves the increased operating cost and complexity of dedicated network elements required for the deployment of metadata services in cloud computing, and realizes efficient network address conversion.
Patent Information
- Application Number
- CN202411794246.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-04-25
AI Technical Summary
In cloud computing, the separate deployment of metadata services requires dedicated network elements, which increases operating costs and complexity.
The bare metal gateway receives the client's metadata request, generates identification information, and generates a new IP address based on the pre-configured address translation rules to realize network address translation, avoiding the deployment of dedicated network elements separately.
The problem of source IP address conflict in cloud services was successfully solved, network address translation function was realized, and operation cost and complexity were reduced.
Smart Images

Figure CN119892930A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and medium for implementing metadata services on a bare metal gateway. Background Art
[0002] In cloud computing services, bare metal servers are hardware devices that have the characteristics of traditional physical servers, but also have cloud host service functions. For example, in cloud computing, MetaData services are used to inject some additional initialization information into virtual machines or bare metal machines, so that bare metal machines or virtual machines can have some customized configurations after they are created. In cloud computing, MetaData services can provide host names, collectively referred to as Secure Shell Public Keys (SSH), and initialization information such as system customization to virtual machines or bare metal machines.
[0003] When a user rents a bare metal machine in cloud computing and starts the cloud host system for the first time, the initialization service built into the system image sends a MetaData Restful service request to the MetaData Server. The MetaData Restful service request is processed by the MetaData Restful agent and sent to the MetaData Server. The MetaData Server searches for the MetaData data associated with the cloud host based on the Instance-Id in the service request and returns it to the cloud host. The cloud host initializes the initialization data of the host based on the returned MetaData data.
[0004] MetaData Server is for all tenants of the entire cloud network. MetaData Server is usually deployed in the management network of the cloud network. The IP addresses of cloud hosts allocated to different tenants may be repeated. Therefore, in order to avoid IP address conflicts and other problems, cloud hosts need to perform network address translation (NAT) for tenants when accessing MetaData Server. In addition, it is necessary to ensure that MetaData Restful agent can normally identify that the request after NAT is sent by the tenant's machine.
[0005] From the above introduction, we can see that MetaData services require special NAT and proxy type services, which are usually forwarded to dedicated network elements for such services. Deploying such network elements separately increases the overall operating cost and complexity, which is not suitable in many scenarios. Summary of the invention
[0006] In view of this, the present invention provides a method, apparatus, device and medium for implementing metadata services on a bare metal gateway to solve the problem that metadata services increase overall operating costs and complexity when various network elements are deployed separately.
[0007] In a first aspect, the present invention provides a method for a bare metal gateway to implement metadata services, the method comprising:
[0008] Receive MetaData requests sent by multiple clients;
[0009] Generate corresponding first identification information according to the first MetaData request, and establish a first mapping relationship between the first identification information and a first source IP address, where the first source IP address is a source IP address corresponding to a first client that issues the first MetaData request, and the first client is any one of the multiple clients;
[0010] Encapsulating the first identification information and the first MetaData request to obtain the encapsulated MetaData request;
[0011] Based on the encapsulated MetaData request and the preconfigured address conversion rule, a new IP address is generated, and a second mapping relationship between the first identification information and the new IP address is established;
[0012] Determine the first source IP address according to the new IP address, the first mapping relationship, and the second mapping relationship;
[0013] Acquire, according to the first source IP address, second identification information corresponding to the first client, wherein the first client is a client that issues the first MetaData request;
[0014] The first MetaData request and the second identification information are sent to a target server, where the target server is a server that responds to the MetaData request.
[0015] The method for implementing metadata service by a bare metal gateway provided by the present invention has the following advantages:
[0016] After receiving MetaData requests respectively sent by multiple clients, the method generates corresponding first identification information, establishes a first mapping relationship between the first identification information and the first source IP address, encapsulates the first identification information and the MetaData request, and transmits the encapsulated request to the address conversion service. Based on the encapsulated MetaData request and the preconfigured address conversion rules, a new IP address is generated, and a second mapping relationship between the first identification information and the new IP address is established. Relying on the above mapping relationship, not only the problem of conflict in source IP address allocation of cloud services is successfully solved, but also the network address translation function is realized by using a bare metal gateway, which omits the operating cost and complexity of deploying such network elements separately.
[0017] In an optional implementation, based on the encapsulated MetaData request and the preconfigured address conversion rule, a new IP address is generated, the method comprising:
[0018] Decapsulating the encapsulated MetaData request, and extracting the first identification information from the encapsulated MetaData request;
[0019] Based on the first identification information and the preconfigured address conversion rule, the address conversion operation on the first source IP address information is completed to generate a new IP address.
[0020] Specifically, encapsulating the first identification information and the first MetaData request together for transmission can ensure that the first MetaData request is correctly routed to the address conversion service and reduce the risk of request leakage or tampering. After the encapsulated MetaData request is transmitted to the address conversion service, it is necessary to first decapsulate and extract the first identification information, and based on the first identification information and the pre-configured address conversion rules, complete the address conversion operation of the first source IP address information and generate a new IP address.
[0021] In an optional implementation, based on the first identification information and a preconfigured address conversion rule, completing an address conversion operation on the first source IP address information to generate a new IP address, the method includes:
[0022] Selecting a target IP address from the preconfigured IP addresses according to a preconfigured address translation rule, wherein the preconfigured address translation rule includes the preconfigured IP address;
[0023] A new IP address is generated according to the host address portion of the target IP address and the first identification information.
[0024] Specifically, the pre-configured address conversion rules of the technical solution allow users to customize the IP address category of the pre-configured IP address. Users can flexibly manage IP resources according to business needs. According to the pre-configured address conversion rules, the host address part of the target IP address and the first identification information are selected to generate a new IP address. After the request response is completed, the new IP address can be unbound from the corresponding first identification information. When the business needs to expand horizontally or migrate resources, the new IP address can be unbound from the corresponding first identification information and then re-associated with the new first identification information, thereby improving the reuse rate of network resources and enhancing the stability and reliability of the system.
[0025] In an optional implementation, determining the first source IP address according to the new IP address, the first mapping relationship, and the second mapping relationship specifically includes:
[0026] Determine the first identification information according to the second mapping relationship between the first identification information and the new IP address, and the new IP address;
[0027] Determine the first source IP address according to a first mapping relationship between the first identification information and the first source IP address, and the first identification information;
[0028] The second identification information is obtained based on the first source IP address.
[0029] Specifically, when a bare metal machine registers to access a cloud service, a unique identification information, namely, the second identification information, is generated. The cloud service will also assign a source IP address to the bare metal machine. Therefore, each bare metal machine has a corresponding source IP address, each bare metal machine has a corresponding second identification information, and each source IP address has a unique corresponding second identification information. The cloud service determines the new IP address based on the received second identification information; then determines the first identification information based on the new IP address and the second mapping relationship between the new IP address and the first identification information; then determines the first source IP address based on the first identification information and the mapping relationship between the first identification information and the first source IP address. The new IP address is traced back to the mapping relationship of the corresponding source IP address, ensuring that even in the case of duplicate source IP addresses, each bare metal machine's request can be accurately identified and managed to avoid confusion.
[0030] After receiving the MetaData request and the new IP address, the cloud service determines the first identification information according to the second mapping relationship between the first identification information and the new IP address, and the new IP address, determines the first source IP address according to the first identification information determined by the above mapping relationship, and the first mapping relationship between the first identification information and the first source IP address, and then obtains the second identification information according to the first source IP address. The new IP address, the mapping relationship between the first identification information and the source IP address improves the efficiency of sending requests and receiving responses.
[0031] In an optional embodiment, the method further includes:
[0032] Receive the response information sent by the target server, where the response information is the response information of the MetaData request;
[0033] Acquire a new IP address according to a mapping relationship between the second identification information and the new IP address, and the second identification information;
[0034] Determine the first identification information based on the mapping relationship between the new IP address and the first identification information and the new IP address;
[0035] The response information is sent to the MetaData request corresponding to the first identification information.
[0036] Specifically, after receiving the MetaData request, the target server determines the response information based on the second identification information, obtains the new IP address based on the mapping relationship between the second identification information and the new IP address, and the second identification information, and then determines the first identification information based on the mapping relationship between the new IP address and the first identification information, as well as the new IP address; finally, the response information is sent to the MetaData request corresponding to the first identification information.
[0037] Through the above pre-established mapping relationship, the response information can be quickly routed to the correct client, reducing network latency. In addition, this technical solution is automatically executed by the bare metal gateway, greatly reducing the workload of manual configuration and maintenance.
[0038] In an optional implementation, encapsulating the first identification information and the first MetaData request to obtain the encapsulated MetaData request, the method further includes:
[0039] Generate corresponding encapsulation tunnel identification information, where the encapsulation tunnel identification information is used to indicate the routing information for correctly sending the encapsulated MetaData request to the target service.
[0040] Specifically, encapsulating tunnel identification information, as a standardized way to manage and configure network tunnels, can ensure that MetaData requests are accurately sent to the target service, avoiding situations where requests are misrouted or lost, thereby improving the reliability of network communications.
[0041] In a second aspect, the present invention provides a device for implementing a bare metal gateway metadata service, the device comprising:
[0042] A receiving module, used to receive MetaData requests respectively sent by multiple clients, wherein the MetaData requests include a source IP address;
[0043] A generating module, used to generate corresponding first identification information according to each MetaData request;
[0044] An encapsulation module, used to encapsulate the first identification information and the first MetaData request to obtain the encapsulated MetaData request;
[0045] A processing module, used to establish a first mapping relationship between first identification information and a first source IP address, where the first source IP address is a source IP address corresponding to a first client that issues a first MetaData request, and the first client is any one of a plurality of clients; based on the encapsulated MetaData request and a preconfigured address conversion rule, a new IP address is generated, and a second mapping relationship between the first identification information and the new IP address is established; according to the new IP address, the first mapping relationship, and the second mapping relationship, the first source IP address is determined; according to the first source IP address, second identification information corresponding to the first client is obtained, and a mapping relationship between the second identification information and the new IP address is established, wherein the first client is the client that issues the first MetaData request;
[0046] The sending module is used to send the first MetaData request and the second identification information to a target server, wherein the target server is a server that responds to the MetaData request.
[0047] The device for implementing a bare metal gateway metadata service provided by the present invention has the following advantages:
[0048] The modular design establishes address translation rules to implement the network address translation function, eliminating the operating cost and complexity of deploying such network elements separately. It also generates a mapping table between the MetaData request, the identification information corresponding to the MetaData request, the source IP address, the encapsulated MetaData request, the second identification information, and the new IP address, which not only speeds up the efficiency of mutual transmission of requests and request responses between the source host and the target host, but also solves the problem of conflict in the allocation of IP addresses to the target host.
[0049] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for implementing metadata services by a bare metal gateway of the above-mentioned first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0050] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method for implementing metadata services on a bare metal gateway of the first aspect or any corresponding embodiment thereof.
[0051] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions, wherein the computer instructions are used to enable a computer to execute the method for implementing metadata services on a bare metal gateway according to the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0053] Figure 1 It is a flow chart of a method for implementing metadata service by a bare metal gateway provided by an embodiment of the present invention;
[0054] Figure 2 It is a flow chart of a method for implementing metadata service by a bare metal gateway provided by an embodiment of the present invention;
[0055] Figure 3 It is a flowchart of another method for implementing metadata service by a bare metal gateway provided by an embodiment of the present invention;
[0056] Figure 4 It is a functional diagram of another method for implementing metadata service by a bare metal gateway provided by an embodiment of the present invention;
[0057] Figure 5 yes Figure 4 A partial schematic diagram of a BMGW Server component in a method for implementing metadata services by a bare metal gateway is provided;
[0058] Figure 6 yes Figure 4 A partial schematic diagram of OVS components in another method for implementing metadata services on a bare metal gateway is provided;
[0059] Figure 7 It is a structural block diagram of a device for implementing a bare metal gateway metadata service provided by an embodiment of the present invention;
[0060] Figure 8 It is a schematic diagram of the hardware structure of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0062] In cloud computing services, bare metal servers are hardware devices that have the characteristics of traditional physical servers, but also have cloud host service functions. For example, in cloud computing, MetaData services are used to inject some additional initialization information into virtual machines or bare metals, so that bare metal or virtual machines can have some customized configurations after they are created. In cloud computing, MetaData services can provide initialization information such as host names, SSH public keys (Secure Shell Public Keys, collectively referred to as secure shell protocol public keys), and system customization to virtual machines or bare metals.
[0063] When a user rents a bare metal machine in cloud computing and starts the cloud host system for the first time, the initialization service built into the system image sends a MetaData Restful service request to the MetaData Server. The MetaData Restful service request is processed by the MetaData Restful agent and sent to the MetaData Server. The MetaData Server searches for the MetaData data associated with the cloud host based on the Instance-Id in the service request and returns it to the cloud host. The cloud host initializes the initialization data of the host based on the returned MetaData data.
[0064] MetaData Server is for all tenants of the entire cloud network. MetaData Server is usually deployed in the management network of the cloud network. The IP addresses of cloud hosts allocated to different tenants may be repeated. Therefore, in order to avoid IP address conflicts and other problems when the cloud host accesses MetaData Server, Network Address Translation (NAT) processing is required for the tenants. It is also necessary to ensure that the MetaData Restful agent can normally identify that the request after NAT is sent by the tenant's machine.
[0065] From the above introduction, we can see that MetaData services require special NAT and proxy type services, which are usually forwarded to dedicated network elements for such services. Deploying such network elements separately increases the overall operating cost and complexity, which is not suitable in many scenarios.
[0066] To solve the above problems, an embodiment of the present invention provides an embodiment of a bare metal gateway metadata service implementation. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system (computer device) including a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0067] In this embodiment, a method for implementing metadata service by a bare metal gateway is provided, which can be used for the above-mentioned terminal devices, such as mobile phones, tablet computers, etc. Figure 1 FIG. 1 is a flow chart of a method for implementing metadata service by a bare metal gateway provided by an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0068] Step S101, receiving MetaData requests respectively sent by multiple clients.
[0069] When a bare metal instance starts the cloud host system for the first time, it usually needs to send a MetaData request to a special internal IP address provided by the cloud service to obtain the necessary initialization configuration information. The cloud service will assign a source IP address to each cloud host instance. The source IP addresses assigned to the above multiple bare metal instances may be repeated. Therefore, after receiving MetaData requests sent by multiple clients, it is necessary to establish subsequent address conversion rules to distinguish MetaData requests from clients with the same source IP address.
[0070] Step S102: Generate corresponding first identification information according to the first MetaData request, and establish a first mapping relationship between the first identification information and the first source IP address.
[0071] Specifically, the corresponding constant can be generated as the first identification information according to the order in which the bare metal gateway receives the MetaData requests. Each bare metal will be assigned a source IP address, and each MetaData request corresponds to a bare metal and a first identification information. Based on the above association, a first mapping relationship between the first identification information and the first source IP address can be established to distinguish the MetaData requests issued by the bare metal with the same source IP address.
[0072] The first source IP address is a source IP address corresponding to a first client that issues a first MetaData request, and the first client is any one of a plurality of clients.
[0073] Step S103: encapsulate the first identification information and the first MetaData request to obtain the encapsulated MetaData request.
[0074] Specifically, the first identification information is encapsulated with the first MetaData request, the purpose of which is to transmit the encapsulated MetaData request in isolation, and ensure that each encapsulated request is correctly routed to the destination service. The destination service is a service for address conversion, and the first MetaData request is any one of the multiple MetaData requests.
[0075] Step S104: Generate a new IP address based on the encapsulated MetaData request and the preconfigured address conversion rule, and establish a second mapping relationship between the first identification information and the new IP address.
[0076] The preconfigured address conversion rule generates a new IP address according to the first identification information in the encapsulated MetaData request and the IP address in the preconfigured address conversion rule.
[0077] Specifically, a new IP address is generated based on the preconfigured IP address host address part and the first identification information in the preconfigured address conversion rule, so each new IP address corresponds one-to-one to a first identification information, and a second mapping relationship between the first identification information and the new IP address can be established based on the above correspondence.
[0078] Step S105: determine the first source IP address according to the new IP address, the first mapping relationship, and the second mapping relationship.
[0079] The first mapping relationship is a mapping relationship between the first identification information and the first source IP address, and the second mapping relationship is a mapping relationship between the first identification information and the new IP address.
[0080] Specifically, after the address translation rule service part generates a new IP address and establishes a second mapping relationship between the first identification information and the new IP address, the processor determines the first identification information according to the second mapping relationship and the new IP address, and then determines the first source IP address according to the first mapping relationship between the first identification information and the first source IP address and the first identification information.
[0081] Step S106: Acquire second identification information corresponding to the first client according to the first source IP address, and establish a mapping relationship between the second identification information and the new IP address.
[0082] The first client is a client that issues a first MetaData request.
[0083] Specifically, it is known that the second identification information is automatically generated by the cloud service when creating a bare metal or other cloud host instance, and remains unchanged throughout the life cycle of the instance. In a specific example, the second identification information may include Instance_ID.
[0084] Instance_ID is an identifier used to distinguish different cloud host instances of the same cloud service. The cloud service uses the second identification information to perform various management tasks, including but not limited to initializing and configuring the bare metal instance, starting, stopping, restarting, terminating the bare metal instance, or taking snapshots and backing up the bare metal instance.
[0085] In a specific example, after determining the first source IP address based on the new IP address, the first mapping relationship, and the second mapping relationship, the second identification information of the bare machine can be obtained based on the first source IP address, and a mapping relationship between the second identification information and the new IP address can be established.
[0086] Step S107: Send the first MetaData request and the second identification information to the target server.
[0087] Specifically, after the target server determines the configuration information of the bare metal instance that issues the MetaData request based on the second identification information, it sends the above configuration information to the bare metal instance that issues the MetaData request, and the bare metal instance performs initialization configuration based on the received configuration information.
[0088] The target server is the server that responds to the MetaData request. The configuration information may include user data, security group settings, network configuration, etc. The bare metal instance completes the initialization configuration according to the configuration information.
[0089] The method for implementing metadata service by bare metal gateway provided in this embodiment, after receiving MetaData requests respectively sent by multiple clients, generates corresponding first identification information, establishes a first mapping relationship between the first identification information and the first source IP address, encapsulates the first identification information and the MetaData request, transmits the encapsulated request to the address conversion service, generates a new IP address based on the encapsulated MetaData request and the preconfigured address conversion rules, and establishes a second mapping relationship between the first identification information and the new IP address. Relying on the above mapping relationship, not only the problem of conflict in source IP address allocation of cloud services is successfully solved, but also the network address translation function is realized by bare metal gateway, which omits the operating cost and complexity of separately deploying such network elements.
[0090] In the above embodiment, after receiving MetaData requests sent by multiple clients respectively and generating corresponding first identification information, it is necessary to encapsulate the MetaData request and the first identification information and transmit them to the address conversion service module. The address conversion service module generates a new IP address based on the encapsulated MetaData request and the pre-configured address conversion rules, which specifically includes the following steps:
[0091] Step a1, decapsulate the encapsulated MetaData request, and extract the first identification information from the encapsulated MetaData request.
[0092] Step a2: Based on the first identification information and the preconfigured address conversion rule, the address conversion operation on the first source IP address information is completed to generate a new IP address.
[0093] In the aforementioned embodiment, it is necessary to encapsulate the first identification information of each MetaData request and each MetaData request together, and route the encapsulated MetaData request to the address conversion target service.
[0094] After routing to the address conversion target service, it is necessary to first perform an unpacking operation to obtain the first identification information in the encapsulated MetaData request, and based on the first identification information and the pre-configured address conversion rules, complete the address conversion operation on the first source IP address information to generate a new IP address.
[0095] Specifically, the identification information and MetaData request are encapsulated and transmitted in isolation, which can ensure that the MetaData request is correctly routed to the target service and reduce the risk of request leakage or tampering.
[0096] In this embodiment, another bare metal gateway metadata service implementation method is provided, which can be used for the above-mentioned mobile terminals, such as mobile phones, tablet computers, etc. Figure 2As shown, in an optional embodiment, based on the above embodiment, after the address conversion service module receives the encapsulated MetaData request and the first identification information, it needs to decapsulate them to obtain the first identification information, and based on the first identification information and the pre-configured address conversion rules, complete the address conversion operation of the first source IP address information to generate a new IP address. The process includes the following steps, such as Figure 2 As shown:
[0097] Step S201, selecting a target IP address from preconfigured IP addresses according to a preconfigured address translation rule.
[0098] Specifically, the preconfigured address conversion rule includes the IP address category of the preconfigured IP address, for example, the IP address category can be five categories of A, B, C, D and E in the Internet Protocol version 4 (IPv4) address, each category has its specific address range. After determining the IP address category of the preconfigured IP address, select the target IP address related to the first identification information within its address range.
[0099] Step S202: Generate a new IP address according to the host address portion of the target IP address and the first identification information.
[0100] Specifically, the first identification information may be generated in a manner that uses a constant that increases in sequence.
[0101] The address conversion rule is to select the IP address whose host address part is consistent with the first identification information as the new IP address. For example, if the first identification information is 3, then the IP address whose host address part is 3 in the target IP address is selected as the new IP address.
[0102] In a method for implementing metadata services on a bare metal gateway provided by an embodiment of the present invention, the preconfigured address conversion rules allow users to customize the IP address category of the preconfigured IP address. Users can flexibly manage IP resources according to business needs. According to the preconfigured address conversion rules, the host address part of the target IP address and the first identification information are selected to generate a new IP address. After the request response is completed, the new IP address can be unbound from the corresponding first identification information. When the business needs to expand horizontally or migrate resources, the new IP address can be unbound from the corresponding first identification information and then re-associated with the new first identification information, thereby improving the reuse rate of network resources and enhancing the stability and reliability of the system.
[0103] On the basis of the above-mentioned embodiment, the target server needs to obtain the configuration information corresponding to the bare metal according to the second identification information. The method of obtaining the second identification is to determine the first source IP address according to the new IP address, the first mapping relationship, and the second mapping relationship, and obtain the second identification information based on the first source IP address. The specific method includes the following steps: Figure 3 As shown,
[0104] Step S301, determining the first identification information according to the second mapping relationship between the first identification information and the new IP address, and the new IP address.
[0105] Specifically, based on the second mapping relationship between the first identification information and the new IP address, the second mapping relationship can be established by establishing a mapping relationship table, or by directly obtaining the host address part in the new IP address. Based on the second mapping relationship between the first identification information and the new IP address, as well as the new IP address, the first identification information can be determined.
[0106] Step S302: Determine the first source IP address according to the first mapping relationship between the first identification information and the first source IP address, and the first identification information.
[0107] Specifically, after determining the first identification information, the second mapping relationship can be established by establishing a mapping relationship table based on the first mapping relationship between the first identification information and the first source IP address. Each identification information has a corresponding source IP address, so that the first source IP address can be determined.
[0108] Step S303: Acquire second identification information based on the first source IP address.
[0109] Among them, when each bare metal is created and joined to the cloud service to become an instance of a cloud host, the cloud service will assign a source IP address to the bare metal instance. The cloud service IP address range is limited, so the source IP address may be repeated. Only the second identification information of the source IP address determined based on the first identification information is the bare metal instance that issued the first MetaData request.
[0110] The cloud service obtains the configuration information of the bare metal instance that issued the first MetaData request through the second identification information.
[0111] Specifically, in a cloud environment, a new IP address corresponds to a first identification information, a first identification information corresponds to a MetaData request, and a first identification information corresponds to a source IP address. The source IP address of the bare metal that issues the MetaData request is determined based on the first identification information, and the corresponding second identification information is determined based on the source IP address.
[0112] In a method for implementing metadata service for a bare metal gateway provided by an embodiment of the present invention, the cloud service determines the first identification information based on the received new IP address and the second mapping relationship between the new IP address and the first identification information, and then determines the first source IP address based on the mapping relationship between the first identification information and the first source IP address and the first identification information, and traces back to the mapping relationship of the corresponding source IP address based on the new IP address, ensuring that even in the case of duplicate source IP addresses, each bare metal request can be accurately identified and managed to avoid confusion.
[0113] In an optional embodiment, based on any of the foregoing embodiments, after receiving the MetaData request sent by the bare metal, the cloud service responds to the client that sent the MetaData request with the corresponding configuration information, which specifically includes the following steps:
[0114] Step b1, receiving the response information sent by the target server.
[0115] The target server may be a metadata service in a cloud service, and the response information is the response information of a MetaData request;
[0116] Specifically, after the target server obtains the response information associated with the bare metal instance according to the second identification information, it needs to return the response information to the client. At this time, the bare metal gateway first receives the response information sent by the target server.
[0117] Step b2: acquiring a new IP address according to the mapping relationship between the second identification information and the new IP address and the second identification information.
[0118] Step b3, determining the first identification information based on the mapping relationship between the new IP address and the first identification information, and the new IP address.
[0119] Step b4: Send the response information to the MetaData request corresponding to the first identification information.
[0120] Specifically, after receiving the corresponding information, the gateway returns the response information to the client according to the mapping relationship established in the process of sending the MetaData request to the target server. For example, after obtaining the new IP address based on the mapping relationship between the second identification information and the new IP address, and the second identification information; then based on the mapping relationship between the new IP address and the first identification information, and the new IP address, determine the first identification information; finally, send the response information to the MetaData request corresponding to the first identification information.
[0121] In a method for implementing metadata services by a bare metal gateway provided by an embodiment of the present invention, a pre-established mapping relationship can be used to quickly route response information to the correct client, thereby reducing network delays. The technical solution is automatically executed by the bare metal gateway, greatly reducing the workload of manual configuration and maintenance.
[0122] The following is a specific example to illustrate the overall operation process of the above method of the present application. Figure 4 As shown:
[0123] When multiple users rent bare metal machines in cloud computing and start the cloud host system for the first time, they need to send a MetaData request to the cloud service for initial configuration. The cloud service assigns a source IP address and second identification information to each bare metal machine.
[0124] Figure 4 In the example, the cloud service end is identified by MetaData Server, and the overall function of the bare metal gateway is identified by BMGW-HOST. BMGW-HOST consists of BMGW Server, OVS, and MetaData-Proxy. The client is the BM end, and the first identification information is indicated by BMID. The pre-configured address conversion rule is identified by nat_flow, and the second identification information is identified by Instance-Id ( Figure 4 The encapsulation mode is VXLAN.
[0125] Assuming that the preconfigured IP addresses in nat_flow belong to the Class B range, then IP addresses in the range of 128.0.0.0 to 128.255.255.255.255 can be mapped for routing.
[0126] The BMGW Server receives multiple MetaData requests from the BM end and generates corresponding identification information as BMID, where BMID is a constant that increases in sequence.
[0127] like Figure 5 As shown, Figure 5The association relationship in the process of sending MetaData requests from BMGW Server to OVS service, where Bmgw-ip is the identification information of the bare metal gateway, inner-bm-ip is the source IP address of the BM end, and innermac is the MAC address of the bare metal. After receiving multiple MetaData requests from the BM end, the BMGW Server matches the MetaData route according to the destination IP address MetaData-ip, then encapsulates the MetaData request and the first identification information through the VXLAN protocol, and sends the message to the OVS service in the BMGW-HOST through the kni-port interface associated with the route.
[0128] The mapping relationship after the OVS service converts the address is as follows Figure 6 As shown in the figure, after receiving the message, OVS matches nat_flow, and after matching the rules, it strips the VXLAN header of the message and converts the source IP address to a 128.xxx address. For example, if the BMID is 3, the IP address is 128.0.0.3; if the BMID is 258, the IP address is 128.0.1.3.
[0129] After OVS converts the source IP address to a 128.xxx address, it forwards the message to the MetaData-Proxy service. MetaData-Proxy determines the BMID based on the converted IP address of the message, finds the tenant's source host based on the BMID, and obtains the host's Instance-Id based on the source host information. It adds the Instance-Id to the MetaData request and sends the request to the MetaData Server through the management port mgt.
[0130] MetaData Server searches for the configuration information of the corresponding BM according to Instance-Id, and returns the configuration information in the original way, which will not be described here. BM performs initialization configuration according to the above configuration information.
[0131] In this embodiment, a device for implementing a bare metal gateway metadata service is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated here. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0132] This embodiment provides a device for implementing a bare metal gateway metadata service, such as Figure 7As shown, it includes: a receiving module 701, a generating module 702, an encapsulation module 703, a processing module 704 and a sending module 705.
[0133] The receiving module 701 is used to receive MetaData requests respectively sent by multiple clients, where the MetaData requests include a source IP address;
[0134] A generating module 702, configured to generate corresponding first identification information according to each MetaData request;
[0135] The encapsulation module 703 is used to encapsulate the first identification information and the first MetaData request to obtain the encapsulated MetaData request, wherein the first MetaData request is any one of the multiple MetaData requests;
[0136] Processing module 704 generates a new IP address based on the encapsulated MetaData request and the preconfigured address conversion rule, and establishes a mapping relationship between the first identification information and the new IP address, wherein the first source IP address is the address included in the first MetaData request; obtains the second identification information corresponding to the first client according to the new IP address; and adds the new IP address and the second identification information to the new MetaData request respectively;
[0137] The sending module 705 is used to send the MetaData request after adding the new IP address and the second identification information to the target server. The target server is the server that responds to the MetaData request.
[0138] In an optional embodiment, the processing module 704 is specifically configured to decapsulate the new MetaData request and extract the first identification information from the new MetaData request;
[0139] Based on the first identification information and the preconfigured address conversion rule, the address conversion operation on the first source IP address information is completed to generate a new IP address.
[0140] In an optional embodiment, the processing module 704 is specifically configured to complete the address conversion operation on the first source IP address information based on the first identification information and the preconfigured address conversion rule to generate a new IP address, including:
[0141] Selecting a target IP address from the preconfigured IP addresses according to a preconfigured address translation rule, wherein the preconfigured address translation rule includes the preconfigured IP address;
[0142] A new IP address is generated according to the host address portion of the target IP address and the first identification information.
[0143] In an optional embodiment, the processing module is specifically configured to determine the first source IP address according to the new IP address, the first mapping relationship, and the second mapping relationship, and specifically includes:
[0144] Determine the first identification information according to the second mapping relationship between the first identification information and the new IP address, and the new IP address;
[0145] Determine the first source IP address according to a first mapping relationship between the first identification information and the first source IP address, and the first identification information;
[0146] The second identification information is obtained based on the first source IP address.
[0147] The device for implementing the bare metal gateway metadata service in this embodiment is presented in the form of a functional module, where the module refers to an application specific integrated circuit (ASIC), a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0148] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0149] The embodiment of the present invention provides a device for implementing a bare metal gateway metadata service, which uses a bare metal gateway to establish address translation rules to implement a network address translation function, thereby eliminating the operating cost and complexity of deploying such network elements separately. In addition, a mapping table between a MetaData request, identification information corresponding to the MetaData request, a source IP address, an encapsulated MetaData request, a second identification information, and a new IP address is generated, which not only speeds up the efficiency of mutual transmission of requests and request responses between the source host and the target host, but also solves the problem of conflict in the allocation of IP addresses to the target host.
[0150] An embodiment of the present invention further provides a computer device, Figure 8 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 8As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 8 A processor 10 is taken as an example.
[0151] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include an integrated circuit. The integrated circuit may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0152] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0153] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of a computer device based on the presentation of a small program landing page, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0154] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0155] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 8 The example of connecting through bus is taken in the following.
[0156] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0157] The embodiment of the present invention also provides a computer-readable storage medium. The method provided in the above embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or is implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0158] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0159] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for implementing metadata service by a bare metal gateway, characterized in that: The method is performed by a bare metal gateway, and the method includes: Receive MetaData requests sent by multiple clients; Generate corresponding first identification information according to the first MetaData request, and establish a first mapping relationship between the first identification information and a first source IP address, where the first source IP address is a source IP address corresponding to a first client that issues the first MetaData request, and the first client is any one of the multiple clients; Encapsulating the first identification information and the first MetaData request to obtain the encapsulated MetaData request; Based on the encapsulated MetaData request and the preconfigured address conversion rule, a new IP address is generated, and a second mapping relationship between the first identification information and the new IP address is established; Determine the first source IP address according to the new IP address, the first mapping relationship, and the second mapping relationship; According to the first source IP address, obtain second identification information corresponding to the first client, and establish a mapping relationship between the second identification information and the new IP address, wherein the first client is a client that issues the first MetaData request; The first MetaData request and the second identification information are sent to a target server, wherein the target server is a server that responds to the MetaData request.
2. The method according to claim 1, characterized in that The generating a new IP address based on the encapsulated MetaData request and the preconfigured address conversion rule includes: Decapsulating the encapsulated MetaData request, and extracting the first identification information from the encapsulated MetaData request; Based on the first identification information and the preconfigured address conversion rule, the address conversion operation on the first source IP address information is completed to generate the new IP address.
3. The method according to claim 2, characterized in that The step of completing the address conversion operation on the first source IP address information based on the first identification information and the preconfigured address conversion rule to generate the new IP address includes: According to the preconfigured address translation rule, selecting a target IP address from the preconfigured IP addresses, wherein the preconfigured address translation rule includes the preconfigured IP address; The new IP address is generated according to the host address portion of the target IP address and the first identification information.
4. The method according to any one of claims 1 to 3, characterized in that: The determining the first source IP address according to the new IP address, the first mapping relationship, and the second mapping relationship specifically includes: Determine the first identification information according to a second mapping relationship between the first identification information and the new IP address, and the new IP address; Determine the first source IP address according to a first mapping relationship between the first identification information and the first source IP address, and the first identification information; The second identification information is obtained based on the first source IP address.
5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Receiving response information sent by the target server, wherein the response information is response information of the MetaData request; Acquire the new IP address according to the mapping relationship between the second identification information and the new IP address, and the second identification information; Determine the first identification information based on the mapping relationship between the new IP address and the first identification information, and the new IP address; The response information is sent to the MetaData request corresponding to the first identification information.
6. The method according to any one of claims 1 to 3, characterized in that: After encapsulating the first identification information and the first MetaData request to obtain the encapsulated MetaData request, the method further includes: Generate corresponding encapsulation tunnel identification information, where the encapsulation tunnel identification information is used to indicate routing information for correctly sending the encapsulated MetaData request to the target service.
7. The method according to claim 6, characterized in that The encapsulation method is Virtual Extensible LAN (VXLAN for short).
8. A device for implementing metadata service by a bare metal gateway, characterized in that: The device comprises: A receiving module, used to receive MetaData requests respectively sent by multiple clients, wherein the MetaData requests include a source IP address; A generating module, configured to generate corresponding first identification information according to each MetaData request; An encapsulation module, used to encapsulate the first identification information and the first MetaData request to obtain the encapsulated MetaData request; A processing module, used to establish a first mapping relationship between the first identification information and a first source IP address, where the first source IP address is a source IP address corresponding to a first client that issues the first MetaData request, and the first client is any one of the multiple clients; based on the encapsulated MetaData request and a preconfigured address conversion rule, a new IP address is generated, and a second mapping relationship between the first identification information and the new IP address is established; according to the new IP address, the first mapping relationship, and the second mapping relationship, the first source IP address is determined; according to the first source IP address, second identification information corresponding to the first client is obtained, and a mapping relationship between the second identification information and the new IP address is established, wherein the first client is the client that issues the first MetaData request; A sending module is used to send the first MetaData request and the second identification information to a target server, wherein the target server is a server that responds to the MetaData request.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for implementing metadata services by a bare metal gateway as described in any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method for implementing metadata services for a bare metal gateway according to any one of claims 1 to 7.
Citation Information
Patent Citations
Network system, network working node, network management and control method and network isolation method
CN116846667A
Method for realizing access of virtual machine to metadata service by local agent based on HTTP (Hyper Text Transport Protocol)
CN117857527A
Data transmission method and related equipment
CN118138552A
Systems and methods for implementing address translation services
US20200106737A1
Seamless access to trusted domain protected memory by virtual machine manager using transformer key identifier
US20220014356A1