Cloud desktop connection method and device, electronic equipment and storage medium
By detecting the available status of the cloud virtualization manager cluster in the target controller and obtaining the connection information of the target virtual machine from the pre-stored information, the problem of the client being unable to connect during failover in the main and standby mode is solved, and the problem of "client" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "maintaining" in the "ma Highly reliable cloud desktop connection in case of failure.
Patent Information
- Application Number
- CN202411355192.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-01-17
AI Technical Summary
In public cloud environment, financial field and operator scenarios, when the main node goes down in the main mode, it usually takes 2-5 minutes to switch the backup node to the main switch, which causes the client to be unable to log in and the desktop to be unable to connect, and the user cannot be satisfied. High reliability requirements without any impact on connecting to the desktop.
By receiving client access requests in the target controller, the available status of the cloud virtualization manager cluster is detected. If it is not available, the target cloud virtualization kernel information of the target client is obtained from the pre-stored cloud virtualization kernel information, and the execution Query operations obtain the connection information of the target virtual machine and send it to the client to connect it to the target virtual machine, thereby accessing the cloud desktop.
Even if the cloud virtualization manager cluster fails, it can quickly provide the client with information to connect to the target virtual machine, avoiding the client's inability to log in and the desktop's inability to connect due to the main node downtime and the main switch of the backup node in the main mode. The situation meets the high reliability requirements that have no impact on the user's connection to the desktop during failover.
Smart Images

Figure CN119322649A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a cloud desktop connection method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of virtualization technology, remote desktops and applications are widely used in enterprise operations, greatly improving work efficiency and flexibility. However, in public cloud environments, financial fields, and operator scenarios, system stability and reliability are crucial. The existing mainstream solution adopts the master-slave mode, and the client obtains the user's authorized desktop information by accessing the platform service to connect to the desktop for office work. However, in the master-slave mode, when the primary node goes down, it usually takes 2-5 minutes for the standby node to become the primary node for master-slave switching. During this period, the client cannot log in and the desktop cannot be connected, which cannot meet the high reliability requirements of no impact on user connection to the desktop during the failover. Summary of the invention
[0003] In view of this, embodiments of the present invention provide a cloud desktop connection method, device, electronic device and storage medium to solve the problem of high reliability requirements of the active-standby mode without affecting user connection to the desktop during fault switching.
[0004] In a first aspect, an embodiment of the present invention provides a method for connecting a cloud desktop, the method being applied to a target controller in a service cluster, the target controller being any controller in the service cluster, the method comprising:
[0005] Receive access requests from target clients;
[0006] In response to the access request, detecting whether the cloud virtualization manager cluster is currently in an available state, wherein the cloud virtualization manager cluster includes a plurality of cloud virtualization managers, each cloud virtualization manager is used to manage at least one virtual machine;
[0007] If the cloud virtualization manager cluster is currently in an unavailable state, obtaining target cloud virtualization kernel information corresponding to the target client from pre-stored cloud virtualization kernel information;
[0008] A query operation is performed based on the target virtualization kernel information to obtain connection information of the target virtual machine corresponding to the target client, and the connection information is sent to the target client so that the target client can connect to the target virtual machine according to the connection information and then access the cloud desktop hosted by the target virtual machine.
[0009] Further, the detecting whether the cloud virtualization manager cluster is currently in an available state includes:
[0010] Sending a detection request to a live detection interface provided by the cloud virtualization manager cluster, wherein the live detection interface is used to detect the cluster state of the cloud virtualization manager cluster according to the detection request and generate response information based on the cluster state;
[0011] If response information fed back by the live detection interface is received, parsing the response information to obtain the cluster state of the cloud virtualization manager cluster, and judging whether the cloud virtualization manager cluster is currently in an available state based on the cluster state;
[0012] If no response information fed back by the live detection interface is received, a preset number of retries and a preset time interval are obtained, and a detection request is resent to the live detection interface based on the preset number of retries and the preset time interval.
[0013] Further, the performing a query operation based on the target virtualization kernel information to obtain connection information of the target virtual machine corresponding to the target client includes:
[0014] Sending a startup instruction to the cloud virtualization server based on a secure connection link between the target controller and the cloud virtualization server, so that the cloud virtualization server controls the startup of the target virtual machine based on the startup instruction;
[0015] Receiving the port number of the target virtual machine sent by the cloud virtualization server, wherein the port number is obtained by the cloud virtualization server after the target virtual machine is started;
[0016] The connection information is constructed based on the port number of the target virtual machine and the address information of the host machine where the target virtual machine is located.
[0017] Furthermore, the method further comprises:
[0018] Acquire the address information of the host machine where the target virtual machine is located from the target virtualization kernel information;
[0019] Using the address information, sending a connection request to the cloud virtualization kernel server;
[0020] Receive response information fed back by the cloud virtualization core server based on the connection request, and establish a secure connection link between the target controller and the cloud virtualization server based on the response information.
[0021] Furthermore, when the cloud virtualization manager cluster is currently in an unavailable state, the method further includes:
[0022] Obtaining a log file of the cloud virtualization manager cluster;
[0023] Analyzing the log file to obtain event information that the cloud virtualization manager cluster is in an unavailable state;
[0024] Acquire a target repair strategy hit by the event information from a plurality of pre-configured repair strategies;
[0025] A repair operation is performed on the cloud virtualization manager cluster based on the target repair policy.
[0026] Furthermore, the method further comprises:
[0027] If the cloud virtualization manager cluster is currently in an available state, calling a cloud virtualization interface to start a target virtual machine corresponding to the target client, and monitoring the startup state of the target virtual machine;
[0028] If the startup status of the target virtual machine is successful, the port number of the target virtual machine is obtained and the port number is sent to the target client.
[0029] Further, the performing a query operation based on the target virtualization kernel information to obtain connection information of the target virtual machine corresponding to the target client includes:
[0030] Obtaining a cache data table, wherein the cache data table includes connection information of virtual machines corresponding to different clients;
[0031] Query the cache data table to determine whether there is connection information of the target client corresponding to the target virtual machine;
[0032] If there is connection information of the target virtual machine corresponding to the target client, the connection information is directly obtained from the cache data table; if there is no connection information of the target virtual machine corresponding to the target client, a query operation is performed based on the target virtualization kernel information to obtain the connection information of the target virtual machine corresponding to the target client.
[0033] In a second aspect, an embodiment of the present invention provides a cloud desktop connection device, the device comprising:
[0034] A receiving module, used for receiving an access request from a target client;
[0035] A detection module, configured to respond to the access request and detect whether the cloud virtualization manager cluster is currently in an available state, wherein the cloud virtualization manager cluster includes a plurality of cloud virtualization managers, each of which is configured to manage at least one virtual machine;
[0036] An acquisition module, configured to acquire target cloud virtualization kernel information corresponding to the target client from pre-stored cloud virtualization kernel information if the cloud virtualization manager cluster is currently in an unavailable state;
[0037] The sending module is used to perform a query operation based on the target virtualization kernel information, obtain the connection information of the target virtual machine corresponding to the target client, and send the connection information to the target client, so that the target client can connect to the target virtual machine according to the connection information, and then access the cloud desktop hosted by the target virtual machine.
[0038] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, computer instructions being stored in the memory, and the processor executing the method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0039] In a fourth aspect, an embodiment of 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 of the first aspect or any corresponding embodiment thereof.
[0040] The method provided in the embodiment of the present application responds to the request and detects the available status of the cloud virtualization manager cluster when the target client issues an access request. If the cluster is unavailable, the target cloud virtualization kernel information corresponding to the target client can be obtained from the pre-stored information, and the query operation is performed based on this to obtain the connection information of the target virtual machine and send it to the target client. Even if the cloud virtualization manager cluster fails, the connection information of the target virtual machine can be quickly provided to the target client through the pre-stored information and query operation, avoiding the situation in which the client cannot log in and the desktop cannot be connected due to the main node downtime and the time-consuming switching of the standby node in the active-standby mode, thereby meeting the high reliability requirement of not affecting the user's connection to the desktop during the failover. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] 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.
[0042] Figure 1 is a flowchart of a method for connecting a cloud desktop according to some embodiments of the present invention;
[0043] Figure 2is a schematic diagram of interaction between a client and a service cluster according to some embodiments of the present invention;
[0044] Figure 3 is a flowchart of a method for connecting a cloud desktop according to some embodiments of the present invention;
[0045] Figure 4 is a structural block diagram of a cloud desktop connection device according to an embodiment of the present invention;
[0046] Figure 5 It is a schematic diagram of the hardware structure of the electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0047] 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.
[0048] According to an embodiment of the present invention, a cloud desktop connection method, device, electronic device and storage medium are provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as 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.
[0049] In this embodiment, a method for connecting a cloud desktop is provided. The method is applied to a target controller in a service cluster. The target controller is any controller in the service cluster. Figure 1 is a flow chart of a cloud desktop connection method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0050] Step S101: receiving an access request from a target client.
[0051] In an embodiment of the present application, after a user logs in to a client, the client attempts to connect to a controller in a service cluster. The target client is any one of the clients connected to the service cluster. For example, in an office environment of an enterprise, multiple employees use different computers as clients, and these clients can all connect to the service cluster. When one of the employees logs in to his or her client, the client sends an access request to the controller in the service cluster.
[0052] For example, after employee A logs in using his own computer (target client), he hopes to access his authorized cloud desktop, so the client will send a request to the controller. The request includes the identity information of the client or user, so that the target controller can identify and return the correct desktop-related information.
[0053] After receiving the request from the target client, the target controller will perform a series of operations to meet the client's needs, including detecting the running status of the virtual machine. If the virtual machine is in a shut down state, it will start the virtual machine and obtain the virtual machine port number from the underlying cvk. Then, this information will be returned to the target client so that the target client can connect to the corresponding virtual machine to perform office operations.
[0054] Step S102 , in response to the access request, detecting whether the cloud virtualization manager cluster is currently in an available state, wherein the cloud virtualization manager cluster includes a plurality of cloud virtualization managers, and each cloud virtualization manager is used to manage at least one virtual machine.
[0055] In an embodiment of the present application, detecting whether the cloud virtualization manager cluster is currently in an available state includes the following steps A1-A3:
[0056] Step A1: Send a detection request to a liveness detection interface provided by a cloud virtualization manager cluster, wherein the liveness detection interface is used to detect a cluster state of the cloud virtualization manager cluster according to the detection request and generate response information based on the cluster state.
[0057] Specifically, Figure 2 As shown in the figure, when the cloud virtualization manager cluster is down or switching, when the client accesses the target controller cluster, the target controller needs to determine the status of the cloud virtualization manager cluster (Cloud Virtualization Manager, abbreviated as CVM). The target controller will send a detection request to the detection interface, which is an interface of the cloud virtualization manager cluster specifically used to detect its cluster status. After receiving the detection request, the detection interface will perform a comprehensive detection of the cloud virtualization manager cluster according to the request. The detection content may include but is not limited to the following aspects: ① Check the operating status of each node in the cloud virtualization manager cluster to confirm whether any node has a fault or abnormality. ② Check whether the network connection is normal to ensure smooth communication within the cloud virtualization manager cluster and with the outside. ③ Verify the availability of storage resources to ensure normal data storage of virtual machines.
[0058] The detection interface will generate a response message based on the detection result. This response message will contain key data about the status of the cloud virtualization manager cluster.
[0059] Step A2: Send a startup instruction to the cloud virtualization server based on the secure connection link between the target controller and the cloud virtualization server, so that the cloud virtualization server controls the startup of the target virtual machine based on the startup instruction.
[0060] Specifically, after receiving the response information fed back by the detection interface, the target controller needs to parse the response information to determine the specific status of the cloud virtualization manager cluster. If the response information is a data structure in a specific format, such as JSON format or XML format, the target controller will use the corresponding parsing tool or library to extract key information. For example, if the response is in JSON format, the target controller may use the JSON parsing function to obtain the value of a specific field, which may represent different status indicators of the cloud virtualization manager cluster, such as "normal operation", "partial node failure", "network connection abnormality", etc.
[0061] By parsing the response information, the target controller can accurately understand the current status of the cloud virtualization manager cluster and provide a basis for subsequent decisions.
[0062] Specifically, after parsing the status of the cloud virtualization manager cluster, the target controller needs to determine whether the cloud virtualization manager cluster is currently in an available state based on this status. If the status of the cloud virtualization manager cluster shows that all nodes are running normally, the network connection is stable, and storage resources are available, then the target controller can determine that the cloud virtualization manager cluster is in an available state. In this case, the target controller can call the CVM interface to start the virtual machine and obtain the virtual machine port number information according to the normal process, and then return it to the client.
[0063] However, if the status of the cloud virtualization manager cluster shows problems such as node failure, network connection interruption, or unavailable storage resources, the target controller will determine that the cloud virtualization manager cluster is in an unavailable state. At this time, the target controller needs to take other measures, such as entering the escape mode based on the pre-stored virtualization kernel information of each user-authorized virtual machine, bypassing the CVM service, and directly interacting with the cloud virtualization kernel server to start the virtual machine and obtain the port number information to ensure that the client can continue to access the virtual machine.
[0064] Step A3: if no response information fed back by the live detection interface is received, a preset number of retries and a preset time interval are obtained, and a detection request is resent to the live detection interface based on the preset number of retries and the preset time interval.
[0065] Specifically, if the response information fed back by the live detection interface is not received, corresponding countermeasures will be taken. First, the preset number of retries and the preset time interval are obtained. The preset number of retries is the number of attempts to resend the detection request to the live detection interface set in advance. This is to give a certain opportunity to try to communicate with the live detection interface again when no response is received for the first time to determine the state of the cloud virtualization manager cluster. The preset time interval is the waiting time between two retries to ensure that the request is not sent too frequently to bring too much burden, and also to leave time for possible network fluctuations or short-term fault recovery. Based on the obtained preset number of retries and preset time interval, the detection request will be resent to the live detection interface according to the established rules. For example, if the preset number of retries is 3 times and the preset time interval is 5 seconds, then after the first response is not received, it will wait for 5 seconds and then send the detection request again. If the response is still not received for the second time, wait for another 5 seconds for the third attempt. In this way, when the response information fed back by the live detection interface is not received, there is an opportunity to confirm the state of the cloud virtualization manager cluster again to improve stability and reliability.
[0066] Step S103: if the cloud virtualization manager cluster is currently in an unavailable state, then obtaining target cloud virtualization kernel information corresponding to the target client from pre-stored cloud virtualization kernel information.
[0067] In an embodiment of the present application, when the CVM cluster is unavailable, the client that issues the access request is the target client. Once the target client is determined, the system can obtain the virtual machine information corresponding to the client in a targeted manner. For example: search in the pre-stored cloud virtualization kernel information (Cloud Virtualization Kernel, abbreviated as cvk) to find the information corresponding to the target client. This involves traversing stored data structures, such as database tables, configuration files, or data sets in memory. The basis for the search is usually to match the unique identifier of the target client with the client identifier in the stored cvk information. When the cvk information corresponding to the target client is found, the system extracts the target cvk information. This includes key content such as the address information of the host machine where the target virtual machine is located and the identifier of the virtual machine.
[0068] Step S104, performing a query operation based on the target virtualization kernel information, obtaining connection information of the target virtual machine corresponding to the target client, and sending the connection information to the target client, so that the target client connects to the target virtual machine according to the connection information, and then accesses the cloud desktop hosted by the target virtual machine.
[0069] In the embodiment of the present application, performing a query operation based on the target virtualization kernel information to obtain the connection information of the target virtual machine corresponding to the target client includes the following steps B1-B3:
[0070] Step B1: Send a startup instruction to the cloud virtualization server based on the secure connection link between the target controller and the cloud virtualization server, so that the cloud virtualization server controls the startup of the target virtual machine based on the startup instruction.
[0071] Specifically, when it is detected that the cloud virtualization manager service is unreachable and it is determined that the cloud virtualization manager cluster is currently unavailable, the target controller needs to obtain the target cloud virtualization kernel information corresponding to the target client. Using the target cloud virtualization kernel information, the target controller attempts to establish a secure connection link with the cloud virtualization server (i.e., the host where the target virtual machine is located).
[0072] The process of establishing a secure connection link with the cloud virtualization server (i.e., the host machine where the target virtual machine is located) is as follows: obtain the address information of the host machine where the target virtual machine is located from the target virtualization kernel information. Use the address information to send a connection request to the cloud virtualization kernel server. Receive response information fed back by the cloud virtualization kernel server based on the connection request, and establish a secure connection link between the target controller and the cloud virtualization server based on the response information.
[0073] It should be noted that the target virtualization kernel information is the key data corresponding to the target client that is pre-stored. It contains the important configuration and location information of the target virtual machine in the cloud virtualization environment. The address information of the host where the target virtual machine is located is the key part. It can be an IP address or a domain name, which is used to uniquely identify the physical server where the target virtual machine runs in the network.
[0074] When the system is running normally, the target controller will record the address information of the host machine where the virtual machine corresponding to each client is located. When it is necessary to establish a connection with the target virtual machine when the cloud virtualization manager cluster is unavailable, the address information of the host machine where the target virtual machine is located is extracted from the pre-stored target virtualization kernel information.
[0075] After obtaining the address information of the host where the target virtual machine is located, the target controller is ready to send a connection request to the cloud virtualization kernel server (i.e., the host where the target virtual machine is located). The connection request usually contains some necessary parameters, such as the target address, the purpose of the request (establishing a secure connection), etc.
[0076] The target controller uses the appropriate network communication protocol and method to send a connection request. For example, if the SSH protocol is used, a request is sent to the target address through a specific port. After receiving the connection request, the cloud virtualization core server processes it according to the content of the request and feeds back a response message. The response message contains information about the status of the connection request, whether the connection is accepted, etc.
[0077] The target controller receives the response information, parses it, and processes it. Based on the content of the response information, the target controller determines the next step. If the response information indicates that the connection request is accepted, the target controller will take further measures to establish a secure connection link. Once the secure connection link is successfully established, the target controller can perform subsequent interactions with the cloud virtualization kernel server through this link, such as sending instructions to start the virtual machine, obtaining the port number of the virtual machine, and other operations.
[0078] Once the secure connection link is established successfully, the target controller sends a startup instruction to the cloud virtualization server through this connection. This startup instruction can be in a specific command format, such as using the libvirt command to start the virtual machine. After receiving this instruction, the cloud virtualization server will perform the corresponding operation to start the target virtual machine.
[0079] The cloud virtualization server will check the status of the target virtual machine. If the virtual machine is in a shut down state, it will call the corresponding virtualization technology (such as KVM, etc.) to start the virtual machine.
[0080] Step B2: receiving the port number of the target virtual machine sent by the cloud virtualization server, wherein the port number is obtained by querying the cloud virtualization server after the target virtual machine is started.
[0081] Specifically, after the target virtual machine is successfully started, the cloud virtualization server will query the port number of the target virtual machine. This port number is one of the key information required by the client to connect to the target virtual machine. The cloud virtualization server will send the queried port number back to the target controller.
[0082] Step B3: construct connection information based on the port number of the target virtual machine and the address information of the host machine where the target virtual machine is located.
[0083] Specifically, after receiving the port number of the target virtual machine, the target controller constructs the connection information in combination with the address information of the host machine where the target virtual machine is located. The connection information is a data structure in a specific format, for example, including the host machine address, port number and other connection parameters (such as protocol type, etc.). The target controller sends this connection information back to the target client.
[0084] After receiving the connection information, the target client can establish a connection with the target virtual machine based on the information. Once the connection is successful, the target client can further access the cloud desktop hosted by the target virtual machine. This means that users can interact with the remote cloud desktop through the target client as if they were operating locally, and achieve various work and application needs, which greatly improves the convenience and flexibility of users in using the cloud desktop. Even if the cloud virtualization manager cluster fails, it can ensure that users can successfully access the cloud desktop, ensuring business continuity and stability.
[0085] The method provided in the embodiment of the present application responds to the request and detects the available status of the cloud virtualization manager cluster when the target client issues an access request. If the cluster is unavailable, the target cloud virtualization kernel information corresponding to the target client can be obtained from the pre-stored information, and the query operation is performed based on this to obtain the connection information of the target virtual machine and send it to the target client. Even if the cloud virtualization manager cluster fails, the connection information of the target virtual machine can be quickly provided to the target client through the pre-stored information and query operation, avoiding the situation in which the client cannot log in and the desktop cannot be connected due to the main node downtime and the time-consuming switching of the standby node in the active-standby mode, thereby meeting the high reliability requirement of not affecting the user's connection to the desktop during the failover.
[0086] In the embodiment of the present application, when the cloud virtualization manager cluster is currently in an unavailable state, the method further includes the following steps D1-D4:
[0087] Step D1, obtaining the log file of the cloud virtualization manager cluster.
[0088] Specifically, if the log is stored in a file system, you can use file read operations to obtain the log file. For example, in a programming language, you can use file operation functions or libraries to open and read log files. If the log is stored in a database, you need to use the corresponding database query statement or database access library to obtain the log data. If there is a log management system, you can use the API provided by the system to obtain the log file.
[0089] Step D2: Analyze the log file to obtain event information that the cloud virtualization manager cluster is in an unavailable state.
[0090] Specifically, use log analysis software or write custom scripts for analysis. For example, you can use regular expressions to match specific error messages or exception events. Traverse each line of records in the log file and find information related to the unavailable state of the cloud virtualization manager cluster. Possible event information includes error codes, exception stack traces, key error messages, etc. For example, if messages such as "connection timed out" and "service unavailable" appear in the log, it may indicate that the cloud virtualization manager cluster is in an unavailable state.
[0091] Finally, the extracted event information is sorted and classified for subsequent processing. Event information can be stored in data structures, such as lists, dictionaries, etc., for easy query and analysis.
[0092] Step D3, obtaining a target repair strategy hit by the event information from a plurality of pre-configured repair strategies.
[0093] Specifically, multiple repair strategies for different types of faults are pre-configured. For example, one repair strategy may be to restart a specific service, and another strategy may be to reconfigure network settings. The analyzed event information is matched with the pre-configured repair strategies. For example, a rule engine, a decision tree, or a simple conditional judgment statement is used to achieve the match. If the event information contains a specific error code, the corresponding repair strategy is selected.
[0094] Based on the matching results, determine the target repair strategy applicable to the current fault. If multiple strategies may be applicable, you can select one based on factors such as priority and fault severity.
[0095] Step D4: performing a repair operation on the cloud virtualization manager cluster based on the target repair strategy.
[0096] Specifically, if the repair strategy is to restart the service, you need to determine the service name to be restarted and the restart method. According to the requirements of the repair strategy, perform the corresponding operations to repair the cloud virtualization manager cluster. If you want to restart the service, you can use operating system commands or service management tools to perform the restart operation. If you want to reconfigure the network settings, you can modify the network configuration file and reload the network service.
[0097] After performing the repair operation, you need to verify whether the repair is successful. You can check the status of the cloud virtualization manager cluster again to see whether it is restored. If the repair is unsuccessful, you can consider trying other repair strategies or notify the administrator for manual intervention.
[0098] In an embodiment of the present application, the method also includes: if the cloud virtualization manager cluster is currently in an available state, calling the cloud virtualization interface to start the target virtual machine corresponding to the target client, and monitoring the startup status of the target virtual machine; if the startup status of the target virtual machine is successful, obtaining the port number of the target virtual machine and sending the port number to the target client.
[0099] Specifically, by detecting the live interface provided by the CVM mentioned above, it is determined that the cloud virtualization manager cluster is currently in an available state. For example, it is possible to check whether the returned status code is a specific value indicating normal operation, or to check whether the response contains a keyword indicating that the cluster is normal.
[0100] After determining that the cloud virtualization manager cluster is available, the target controller calls the cloud virtualization interface to start the target virtual machine corresponding to the target client. This requires knowing the identification information of the target virtual machine in order to accurately start the specific virtual machine. The interface call may involve sending a specific command or request to the cloud virtualization manager cluster to instruct it to start the target virtual machine.
[0101] After starting the target virtual machine, the target controller needs to continuously monitor the startup status of the target virtual machine to determine whether the virtual machine has been successfully started. The current status of the target virtual machine can be obtained by regularly querying the virtual machine status interface provided by the cloud virtualization manager cluster. The status may include "starting", "running", "fault", etc. For example, a status query request can be sent every certain period of time (such as a few seconds) until the status of the target virtual machine changes to "running".
[0102] Once the startup status of the target VM is successful, the controller needs to obtain the port number of the target VM. This can be obtained by querying the relevant interface of the CVM cluster or from other storage locations. The port number is one of the necessary information for the target client to connect to the target VM.
[0103] The target controller sends the acquired port number of the target virtual machine to the target client. This can be sent through a communication channel established with the target client, for example, by using a specific network protocol to send the port number as response data to the client. After the target client receives the port number, it can use the port number and other connection information (such as the IP address of the target virtual machine) to connect to the target virtual machine.
[0104] In the embodiments of the present application, Figure 3 As shown, in the above embodiment, the query operation is performed based on the target virtualization kernel information in step S104 to obtain the connection information of the target virtual machine corresponding to the target client, including:
[0105] Step S301: Obtain a cache data table, wherein the cache data table includes connection information of virtual machines corresponding to different clients.
[0106] In the embodiment of the present application, it is first necessary to clarify the storage location and acquisition method of the cache data table. For example, it is a database table, a data structure in memory, or a specific file in a file system. If it is a database table, it is necessary to determine the type of database (such as MySQL, Oracle, etc.) and connection parameters (such as database address, port number, user name, password, etc.). If it is a data structure in memory, it may be necessary to access it through a specific programming interface. If it is a file in a file system, it is necessary to know the path and format of the file.
[0107] According to the determined data source, establish the corresponding connection or read the file. If it is a database, use the database connection library (such as JDBC for Java language) to establish a connection and execute query statements to obtain the data of the cache data table. If it is a data structure in memory, read it through the memory access mechanism provided by the programming language. If it is a file, use the file reading operation (such as Python's built-in function open and file reading method) to read the file content.
[0108] After obtaining the data in the cache data table, you need to parse it according to its format. If the data is in tabular form, you may need to use a specific data parsing library (such as pandas for Python) to convert the data into an easy-to-process format, such as a dictionary list or data frame. For different clients corresponding to the virtual machine connection information, you may need to parse out the client ID, virtual machine ID, and specific connection parameters (such as IP address, port number, etc.).
[0109] Step S302: query the cache data table to determine whether there is connection information of the target client corresponding to the target virtual machine.
[0110] In the embodiment of the present application, the identification information of the target client and the target virtual machine is clearly identified through user input and configuration file reading, and the identification information of the target client and the target virtual machine is extracted so as to be queried in the cache data table.
[0111] Execute query operations based on the structure and storage method of the cache data table. If it is a database table, you can use SQL query statements, such as "SELECT * FROM cache_table WHERE client_id = [target client ID] AND vm_id = [target virtual machine ID]". If it is a data structure in memory, you can use loop traversal and conditional judgment to query. If it is a file, you can read the file content line by line and perform string matching or regular expression matching to find the target connection information.
[0112] After the query operation is executed, the returned result is used to determine whether there is connection information for the target client corresponding to the target virtual machine. If the query result is empty, it means that there is no corresponding connection information; if the query result contains one or more records, it means that there is connection information.
[0113] Step S303: if there is connection information of the target client corresponding to the target virtual machine, directly obtain the connection information from the cache data table. If there is no connection information of the target client corresponding to the target virtual machine, perform a query operation based on the target virtualization kernel information to obtain the connection information of the target virtual machine corresponding to the target client.
[0114] In an embodiment of the present application, when it is detected that there is connection information of the target client corresponding to the target virtual machine, it indicates that the connection between the client and the virtual machine has been established before, and the relevant information is stored in the cache data table. At this time, the connection information can be directly obtained from the cache data table. Since the connection information is already in the cache, there is no need to perform complex query operations. This greatly improves the response speed of the system, especially when the same connection information needs to be obtained frequently, it can significantly reduce the consumption of system resources and time delays.
[0115] If the target client's corresponding target virtual machine's connection information is not found in the cache data table, it means that this may be the first time that the client has established a connection with the virtual machine, or the previous connection information has not been correctly cached for some reason. In this case, it is necessary to perform a query operation based on the target virtualization kernel information. The target virtualization kernel information may include the virtual machine's configuration parameters, operating status, and address information of the host machine where the target virtual machine is located. By analyzing and querying this information, the connection information of the target virtual machine corresponding to the target client can be determined.
[0116] First, determine the scope and direction of the query based on the target virtualization kernel information. For example, if the kernel information contains the network configuration of the virtual machine, you can query from the network level. Once the connection information of the target virtual machine corresponding to the target client is found, it can be stored in the cache data table so that it can be directly obtained from the cache next time it is needed, improving the efficiency of subsequent operations.
[0117] The embodiment of the present application can greatly improve the query efficiency by obtaining a cache data table containing virtual machine connection information corresponding to different clients, and first querying the target connection information therein, thereby avoiding a comprehensive search of the entire system or frequent queries to the underlying virtualization kernel, saving time and system resources. Secondly, when the target connection information is not found in the cache, a query is performed based on the target virtualization kernel information, which provides an alternative query path, enhances the reliability of the system, and ensures that accurate connection information can be obtained as much as possible under various circumstances. At the same time, this method reduces the system load and reduces the resource consumption caused by virtualization kernel queries, allowing the system to run other tasks more efficiently, and also facilitates the management and maintenance of connection information, improving the overall resource utilization and the stability and availability of the system.
[0118] In this embodiment, a connection device for a cloud desktop is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated hereafter. As used below, the term "module" may be a combination of software and / or hardware that implements 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.
[0119] This embodiment provides a connection device for a cloud desktop, such as Figure 4 As shown, including:
[0120] Receiving module 401, used to receive an access request from a target client;
[0121] A detection module 402 is used to respond to the access request and detect whether the cloud virtualization manager cluster is currently in an available state, wherein the cloud virtualization manager cluster includes multiple cloud virtualization managers, each cloud virtualization manager is used to manage at least one virtual machine;
[0122] The acquisition module 403 is used to acquire the target cloud virtualization kernel information corresponding to the target client from the pre-stored cloud virtualization kernel information if the cloud virtualization manager cluster is currently in an unavailable state;
[0123] The sending module 404 is used to perform a query operation based on the target virtualization kernel information, obtain the connection information of the target virtual machine corresponding to the target client, and send the connection information to the target client, so that the target client connects to the target virtual machine according to the connection information, and then accesses the cloud desktop hosted by the target virtual machine.
[0124] In an embodiment of the present application, the detection module 402 is used to send a detection request to a detection interface provided by a cloud virtualization manager cluster, wherein the detection interface is used to detect the cluster status of the cloud virtualization manager cluster according to the detection request, and generate response information based on the cluster status; if response information fed back by the detection interface is received, the response information is parsed to obtain the cluster status of the cloud virtualization manager cluster, and based on the cluster status, it is determined whether the cloud virtualization manager cluster is currently in an available state; if response information fed back by the detection interface is not received, a preset number of retries and a preset time interval are obtained, and a detection request is resent to the detection interface based on the preset number of retries and the preset time interval.
[0125] In an embodiment of the present application, a sending module 404 is used to send a startup instruction to the cloud virtualization server based on a secure connection link between the target controller and the cloud virtualization server, so that the cloud virtualization server controls the startup of the target virtual machine based on the startup instruction; receives the port number of the target virtual machine sent by the cloud virtualization server, wherein the port number is obtained by querying the cloud virtualization server after the target virtual machine is started; and constructs connection information based on the port number of the target virtual machine and the address information of the host machine where the target virtual machine is located.
[0126] In an embodiment of the present application, the device also includes: a construction module for obtaining the address information of the host machine where the target virtual machine is located from the target virtualization kernel information; using the address information to send a connection request to the cloud virtualization kernel server; receiving response information fed back by the cloud virtualization kernel server based on the connection request, and establishing a secure connection link between the target controller and the cloud virtualization server based on the response information.
[0127] In an embodiment of the present application, the device also includes: an analysis module, used to obtain the log file of the cloud virtualization manager cluster; analyze the log file to obtain event information that the cloud virtualization manager cluster is in an unavailable state; obtain a target repair strategy hit by the event information from multiple pre-configured repair strategies; and perform repair operations on the cloud virtualization manager cluster based on the target repair strategy.
[0128] In an embodiment of the present application, the device also includes: a processing module, which is used to call the cloud virtualization interface to start the target virtual machine corresponding to the target client if the cloud virtualization manager cluster is currently in an available state, and monitor the startup status of the target virtual machine; if the startup status of the target virtual machine is successful, obtain the port number of the target virtual machine and send the port number to the target client.
[0129] In an embodiment of the present application, a sending module is used to obtain a cache data table, wherein the cache data table includes connection information of virtual machines corresponding to different clients; query the cache data table to determine whether there is connection information of the target client corresponding to the target virtual machine; if there is connection information of the target client corresponding to the target virtual machine, directly obtain the connection information from the cache data table; if there is no connection information of the target client corresponding to the target virtual machine, perform a query operation based on the target virtualization kernel information to obtain the connection information of the target virtual machine corresponding to the target client.
[0130] See also Figure 5 , Figure 5 is a schematic diagram of the structure of an electronic device provided by an optional embodiment of the present invention, such as Figure 5As shown, the electronic device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The 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 instructions executed in the electronic device, including instructions stored in or on the memory to display 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 electronic 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).
[0131] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip 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.
[0132] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0133] 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 an electronic 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 electronic 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.
[0134] 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.
[0135] The electronic device further comprises a communication interface 30 for the electronic device to communicate with other devices or a communication network.
[0136] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be 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 through a network download, 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.
[0137] 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 connecting a cloud desktop, characterized in that: The method is applied to a target controller in a service cluster, the target controller being any controller in the service cluster, and the method comprises: Receive access requests from target clients; In response to the access request, detecting whether the cloud virtualization manager cluster is currently in an available state, wherein the cloud virtualization manager cluster includes a plurality of cloud virtualization managers, each cloud virtualization manager is used to manage at least one virtual machine; If the cloud virtualization manager cluster is currently in an unavailable state, obtaining target cloud virtualization kernel information corresponding to the target client from pre-stored cloud virtualization kernel information; A query operation is performed based on the target virtualization kernel information to obtain connection information of the target virtual machine corresponding to the target client, and the connection information is sent to the target client so that the target client can connect to the target virtual machine according to the connection information and then access the cloud desktop hosted by the target virtual machine.
2. The method according to claim 1, characterized in that The detecting whether the cloud virtualization manager cluster is currently in an available state includes: Sending a detection request to a live detection interface provided by the cloud virtualization manager cluster, wherein the live detection interface is used to detect the cluster state of the cloud virtualization manager cluster according to the detection request and generate response information based on the cluster state; If response information fed back by the live detection interface is received, parsing the response information to obtain the cluster state of the cloud virtualization manager cluster, and judging whether the cloud virtualization manager cluster is currently in an available state based on the cluster state; If no response information fed back by the live detection interface is received, a preset number of retries and a preset time interval are obtained, and a detection request is resent to the live detection interface based on the preset number of retries and the preset time interval.
3. The method according to claim 1, characterized in that The performing a query operation based on the target virtualization kernel information to obtain connection information of the target virtual machine corresponding to the target client includes: Sending a startup instruction to the cloud virtualization server based on a secure connection link between the target controller and the cloud virtualization server, so that the cloud virtualization server controls the startup of the target virtual machine based on the startup instruction; Receiving the port number of the target virtual machine sent by the cloud virtualization server, wherein the port number is obtained by the cloud virtualization server after the target virtual machine is started; The connection information is constructed based on the port number of the target virtual machine and the address information of the host machine where the target virtual machine is located.
4. The method according to claim 3, characterized in that The method further comprises: Acquire the address information of the host machine where the target virtual machine is located from the target virtualization kernel information; Using the address information, sending a connection request to the cloud virtualization kernel server; Receive response information fed back by the cloud virtualization core server based on the connection request, and establish a secure connection link between the target controller and the cloud virtualization server based on the response information.
5. The method according to claim 3, characterized in that: When the cloud virtualization manager cluster is currently in an unavailable state, the method further includes: Obtaining a log file of the cloud virtualization manager cluster; Analyzing the log file to obtain event information that the cloud virtualization manager cluster is in an unavailable state; Acquire a target repair strategy hit by the event information from a plurality of pre-configured repair strategies; A repair operation is performed on the cloud virtualization manager cluster based on the target repair policy.
6. The method according to claim 1, characterized in that The method further comprises: If the cloud virtualization manager cluster is currently in an available state, calling a cloud virtualization interface to start a target virtual machine corresponding to the target client, and monitoring the startup state of the target virtual machine; If the startup status of the target virtual machine is successful, the port number of the target virtual machine is obtained and the port number is sent to the target client.
7. The method according to claim 1, characterized in that The performing a query operation based on the target virtualization kernel information to obtain connection information of the target virtual machine corresponding to the target client includes: Obtaining a cache data table, wherein the cache data table includes connection information of a virtual machine corresponding to a client; Query the cache data table to determine whether there is connection information of the target client corresponding to the target virtual machine; If there is connection information of the target virtual machine corresponding to the target client, the connection information is directly obtained from the cache data table; if there is no connection information of the target virtual machine corresponding to the target client, a query operation is performed based on the target virtualization kernel information to obtain the connection information of the target virtual machine corresponding to the target client.
8. A connection device for a cloud desktop, characterized in that: The device comprises: A receiving module, used for receiving an access request from a target client; A detection module, configured to respond to the access request and detect whether the cloud virtualization manager cluster is currently in an available state, wherein the cloud virtualization manager cluster includes a plurality of cloud virtualization managers, each of which is configured to manage at least one virtual machine; An acquisition module, configured to acquire target cloud virtualization kernel information corresponding to the target client from pre-stored cloud virtualization kernel information if the cloud virtualization manager cluster is currently in an unavailable state; The sending module is used to perform a query operation based on the target virtualization kernel information, obtain the connection information of the target virtual machine corresponding to the target client, and send the connection information to the target client, so that the target client can connect to the target virtual machine according to the connection information, and then access the cloud desktop hosted by the target virtual machine.
9. An electronic 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 according to 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 according to any one of claims 1 to 7.