A connection method and device of a virtual machine, an electronic device, and a storage medium

By switching to the second identified virtual machine corresponding to the data when the virtual machine connection is interrupted through the proxy service device, the problem of connection interruption and data loss of virtual machine remote desktop when the host server fails is solved, and seamless connection continuity and data consistency are achieved.

CN116016641BActive Publication Date: 2026-04-10LENOVO (BEIJING) LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
LENOVO (BEIJING) LTD
Filing Date
2022-12-29
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

In existing technologies, the remote desktop of a virtual machine is unavailable when the host server fails, and the connection can only be restored after the host server recovers, resulting in connection interruption and data loss.

Method used

The system obtains remote desktop connection requests from clients through a proxy service device, establishes a connection with the first identified virtual machine, and switches to the second identified virtual machine corresponding to the data when the connection is interrupted, achieving seamless connection switching and ensuring data consistency and synchronization by utilizing the network file system.

Benefits of technology

When the virtual machine connection is interrupted, the agent service device automatically switches to the second identified virtual machine corresponding to the data, ensuring the continuity of the client connection and the consistency of the data, and avoiding connection interruption and data loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116016641B_ABST
    Figure CN116016641B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a virtual machine connection method and device, electronic equipment and a storage medium, comprising: obtaining a connection request of a remote desktop protocol of a client; sending the connection request to a first identified virtual machine, establishing a connection between the client and the first identified virtual machine, and displaying a remote desktop of the first identified virtual machine through the client; in the case of interruption of the connection with the first identified virtual machine, obtaining connection information of a second identified virtual machine; wherein the data stored in the first identified virtual machine corresponds to the data stored in the second identified virtual machine; based on the connection information, sending the connection request to the second identified virtual machine, establishing a connection between the client and the second identified virtual machine, and enabling the client to display the remote desktop of the first identified virtual machine by accessing the data stored in the second identified virtual machine.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of electronic devices, and relates to a virtual machine connection method and device, an electronic device, and a storage medium. BACKGROUND

[0002] In related technologies, a remote desktop is implemented by establishing a virtual machine on a host server. The stability of the virtual machine depends on the stability of the host server. When the host server fails, the remote desktop of the virtual machine is unavailable. The connection of the remote desktop can be restored by periodically making a snapshot of the virtual machine and applying the snapshot to restore the data in the virtual machine after the host server recovers. However, the above method needs to wait for the host server to recover, and in the case of host server failure, the virtual machine is unavailable and the client disconnects the connection of the virtual machine. SUMMARY

[0003] The present application provides a virtual machine connection method and device, an electronic device, and a storage medium.

[0004] The technical solution of the present application embodiment is implemented as follows:

[0005] The present application provides a virtual machine connection method, which includes: obtaining a connection request of a remote desktop protocol of a client; sending the connection request to a first identified virtual machine, establishing a connection between the client and the first identified virtual machine, and displaying a remote desktop of the first identified virtual machine through the client; in the case of disconnection of the connection with the first identified virtual machine, obtaining connection information of a second identified virtual machine; the data stored in the first identified virtual machine corresponds to the data stored in the second identified virtual machine; based on the connection information, sending the connection request to the second identified virtual machine, establishing a connection between the client and the second identified virtual machine, and enabling the client to display the remote desktop of the first identified virtual machine by accessing the data stored in the second identified virtual machine.

[0006] The embodiment of the present application provides a connection device of a virtual machine, the device comprises: a first acquisition module, configured to acquire a connection request of a remote desktop protocol of a client; a first connection module, configured to send the connection request to a first-identified virtual machine, establish a connection between the client and the first-identified virtual machine, and display a remote desktop of the first-identified virtual machine through the client; a second acquisition module, configured to acquire connection information of a second-identified virtual machine in the case that the connection with the first-identified virtual machine is interrupted; wherein data stored in the first-identified virtual machine corresponds to data stored in the second-identified virtual machine; and a second connection module, configured to send the connection request to the second-identified virtual machine based on the connection information, establish a connection between the client and the second-identified virtual machine, and enable the client to display the remote desktop of the first-identified virtual machine by accessing the data stored in the second-identified virtual machine.

[0007] The embodiment of the present application provides an electronic device, comprising a memory and a processor, the memory stores a computer program which can run on the processor, and the processor implements the steps in the above method when executing the program.

[0008] The embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the steps in the above method.

[0009] The technical scheme provided by the embodiment of the present application has at least the following beneficial effects:

[0010] In the embodiment of the present application, in the case that the connection with the first-identified virtual machine is interrupted, the connection information of the second-identified virtual machine is acquired; wherein the data stored in the first-identified virtual machine corresponds to the data stored in the second-identified virtual machine; the connection request is sent to the second-identified virtual machine based on the connection information, the connection between the client and the second-identified virtual machine is established, and the client displays the remote desktop of the first-identified virtual machine by accessing the data stored in the second-identified virtual machine. In this way, when the client connects the virtual machine, it is not directly connected, but connected through the proxy service device. When the proxy service device senses that the first-identified virtual machine fails or the network fails and becomes unavailable, the connection with the second-identified virtual machine is established to replace the first-identified virtual machine, so that the proxy service device replaces the connection with the virtual machine, but does not disconnect the connection with the client, and realizes the switching of the client to the virtual machine without sensing. BRIEF DESCRIPTION OF DRAWINGS

[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments description. Obviously, the drawings in the following description only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained without creative labor under the premise of the drawings.

[0012] Figure 1 The flowchart of the connection method of the virtual machine provided by the embodiments of the present application is shown in the figure.

[0013] Figure 2 The flowchart of the connection method of the virtual machine provided by the embodiments of the present application is shown in the figure.

[0014] Figure 3 The flowchart of the connection method of the virtual machine provided by the embodiments of the present application is shown in the figure.

[0015] Figure 4 The flowchart of the connection method of the virtual machine provided by the embodiments of the present application is shown in the figure.

[0016] Figure 5 The composition structure diagram of the connection device of the virtual machine provided by the embodiments of the present application is shown in the figure.

[0017] Figure 6 The hardware entity diagram of the electronic device provided by the embodiments of the present application is shown in the figure. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solutions and advantages of the embodiments of the present application more clear, the following will combine the drawings in the embodiments of the present application, and the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are some embodiments of the present application, but not all the embodiments. The following embodiments are used to illustrate the present application, but not to limit the scope of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0019] In the following description, "some embodiments" are described, which describe a subset of all possible embodiments, but it can be understood that "some embodiments" can be the same subset or different subset of all possible embodiments, and can be combined with each other without conflict.

[0020] It should be noted that the terms "first", "second", "third" involved in the embodiments of the present application are only to distinguish similar objects, and do not represent a specific order of the objects. Understandably, "first", "second", "third" can be interchanged in a specific order or sequence as allowed, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0021] Those skilled in the art can understand that, unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meaning as commonly understood by those skilled in the art to which the embodiments of the present application belong. It should also be understood that terms such as those defined in general dictionaries should be understood in the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as such herein.

[0022] To help understand the technical solutions of the embodiments of the present application, the concepts involved in the embodiments of the present application are introduced as follows:

[0023] The network file system (NFS, Network File System) is a directory sharing mechanism. Different virtual machines mounted with the same file directory can operate the shared partition (directory) on the virtual machine as operating a local partition through the support of the network file system.

[0024] To solve the above problems, the present application provides a virtual machine connection method, applied to a proxy service device, Figure 1 A flowchart of a virtual machine connection method provided by the embodiments of the present application is shown in Figure 1 The method comprises at least the following steps:

[0025] Step S101, obtaining a connection request of a remote desktop protocol of a client;

[0026] Here, the proxy service device can be at least one of the following: gateway (Gateway) and background service (Backend Service). Here, the gateway can realize the function of proxy connection. In the process of realizing proxy connection, when the gateway detects that the virtual machine connected by the client is unavailable, another virtual machine will be connected with the client. In this way, the probability of abnormal access can be reduced. In the process of realizing the background service, the proxy service device can realize at least one of the following functions: detecting the running state of the virtual machine, controlling the power on / off of the virtual machine, and modifying the identity of the virtual machine.

[0027] Here, the client accesses the virtual machine through the remote desktop protocol (Remote Desktop Protocol, RDP), and displays the remote desktop of the virtual machine on the client.

[0028] Step S102, sending the connection request to the first identified virtual machine, establishing the connection between the client and the first identified virtual machine, so as to display the remote desktop of the first identified virtual machine through the client;

[0029] Here, the first identified virtual machine can be created using a network file system (NFS) disk, and another virtual machine can mount the same file directory using the same NFS disk, so that the data stored in the first identified virtual machine corresponds to the data stored in the second identified virtual machine.

[0030] Step S103, in the case of interruption of the connection with the first identified virtual machine, obtaining the connection information of the second identified virtual machine; wherein the data stored in the first identified virtual machine corresponds to the data stored in the second identified virtual machine;

[0031] Here, the second identified virtual machine can be a virtual machine of a plurality of host servers, or a plurality of virtual machines in one host server.

[0032] In the case of virtual machine failure, another virtual machine in one host server can be used to connect with the client. In the case of host server failure, a virtual machine in another host server can be used to establish connection with the client.

[0033] Here, the connection information can be the Internet Protocol (IP) address of the second identified virtual machine. Here, when the proxy service device senses the interruption of the connection with the first identified virtual machine, the connection information of the second identified virtual machine is queried, the connection with the second identified virtual machine is established, and the service for the client is continued. Here, the remote desktop connection with the first identified virtual machine through the gateway of the proxy service device and the client can be established.

[0034] Step S104, based on the connection information, sending the connection request to the second identified virtual machine, establishing the connection between the client and the second identified virtual machine, so that the client displays the remote desktop of the first identified virtual machine by accessing the data stored in the second identified virtual machine.

[0035] In the above embodiment, in the case that the connection with the first identified virtual machine is interrupted, connection information of a second identified virtual machine is acquired; the data stored in the first identified virtual machine corresponds to the data stored in the second identified virtual machine; based on the connection information, the connection request is sent to the second identified virtual machine, the connection between the client and the second identified virtual machine is established, so that the client displays the remote desktop of the first identified virtual machine by accessing the data stored in the second identified virtual machine. In this way, when the client connects the virtual machine, it is not directly connected, but connected through the proxy service device. When the proxy service device senses that the first identified virtual machine fails or the network fails and becomes unavailable, the connection with the second identified virtual machine is established to replace the first identified virtual machine, so that the proxy service device replaces the connection with the virtual machine, but does not disconnect the connection with the client, realizing the switching of the client to the virtual machine without sensing.

[0036] The application provides a connection method of a virtual machine, applied to a proxy service device, Figure 2 A flowchart of a connection method of a virtual machine provided by the embodiment of the application is shown in Figure 2 The method at least includes the following steps:

[0037] Step S201, acquiring a connection request of a remote desktop protocol of a client;

[0038] Step S202, sending the connection request to a first identified virtual machine, establishing the connection between the client and the first identified virtual machine, and displaying the remote desktop of the first identified virtual machine through the client;

[0039] Step S203, in the case that the connection with the first identified virtual machine is interrupted, acquiring connection information of a second identified virtual machine; the data stored in the first identified virtual machine corresponds to the data stored in the second identified virtual machine;

[0040] In an implementable manner, the host server where the first identified virtual machine is located is different from the host server where the second identified virtual machine is located;

[0041] The first identified virtual machine and the second identified virtual machine mount the same file directory through a network file system, so that the data stored in the first identified virtual machine corresponds to the data stored in the second identified virtual machine.

[0042] Here, the second identified virtual machine can be created by another host server using the same image as the first identified virtual machine. Here, the second identified virtual machine mounts the NFS disk of the first identified virtual machine. Here, the second identified virtual machine is put into hibernation after creation to save resources. Here, the host server can be a data center for storing data.

[0043] Here, the second identified virtual machine does not occupy CPU and memory resources when in hibernation, but only establishes a memory image on the disk. By way of example, according to a 10% failure rate, an 8-core 16G memory host server can back up 20 virtual machines of 4 cores and 8G. During backup, 160G of disk space is required.

[0044] In the above embodiment, on the one hand, the host server where the first identified virtual machine is located is different from the host server where the second identified virtual machine is located. In this way, the failure of the host server of the first identified virtual machine will not affect the second identified virtual machine, and the second identified virtual machine can continue to be used without waiting for the host server where the first identified virtual machine is located to recover from failure. On the other hand, the first identified virtual machine and the second identified virtual machine mount the same file directory through the network file system, so that the data stored in the first identified virtual machine corresponds to the data stored in the second identified virtual machine. In this way, by mounting the same file directory through the network file system, data consistency is ensured.

[0045] Step S204, based on the connection information, sends the connection request to the second identified virtual machine, establishes a connection between the client and the second identified virtual machine, so that the client displays the remote desktop of the first identified virtual machine by accessing the data stored in the second identified virtual machine.

[0046] In an implementable manner, after the connection between the client and the first identified virtual machine is established in step S202, the method further comprises: obtaining an input / output event stream of the first identified virtual machine; and applying the input / output event stream to the second identified virtual machine, so that the data stored in the first identified virtual machine corresponds to the data stored in the second identified virtual machine.

[0047] Here, the application of the input / output event stream to the second identified virtual machine includes: forwarding the input / output event stream to the host server of the second identified virtual machine, so that the host server of the second identified virtual machine applies the input / output event stream to the second identified virtual machine, so that the data stored in the first identified virtual machine is the same as the data stored in the second identified virtual machine.

[0048] In an implementable manner, after the step S202, the method further comprises: detecting a running state of the first-identified virtual machine according to a preset time length; and determining that the connection with the first-identified virtual machine is interrupted in a case where the running state of the first-identified virtual machine is detected to be abnormal.

[0049] In the above embodiment, on one hand, an input / output event stream of the first-identified virtual machine is acquired, and the input / output event stream is applied to the second-identified virtual machine, so that the data stored in the first-identified virtual machine corresponds to the data stored in the second-identified virtual machine. In this way, the data between different virtual machines can be synchronized in real time, and the data consistency is improved. On the other hand, the running state of the first-identified virtual machine is detected according to a preset time length, and it is determined that the connection with the first-identified virtual machine is interrupted in a case where the running state of the first-identified virtual machine is detected to be abnormal. In this way, by detecting the running state of the first-identified virtual machine in a timely manner, the connection interruption problem caused by the abnormality of the virtual machine can be determined in a timely manner.

[0050] The present application provides a connection method of a virtual machine, applied to a proxy service device, Figure 3 A flowchart of a connection method of a virtual machine provided by the embodiment of the present application is shown in Figure 3 The method comprises the following steps:

[0051] In step S301, a connection request of a remote desktop protocol of a client is acquired.

[0052] In step S302, the connection request is sent to a first-identified virtual machine, and a connection between the client and the first-identified virtual machine is established, so that a remote desktop of the first-identified virtual machine is displayed through the client.

[0053] In step S303, in a case where the connection with the first-identified virtual machine is interrupted, the second-identified virtual machine is started, connection information of the second-identified virtual machine is acquired, the identification of the virtual machine is changed from the second identification to the first identification, and in a case where a connection request of a remote desktop protocol of a client is acquired again, the connection request is sent to the first-identified virtual machine with the changed identification; and the data stored in the first-identified virtual machine corresponds to the data stored in the second-identified virtual machine.

[0054] Step S304, based on the connection information, sending the connection request to the second-identified virtual machine to establish the connection between the client and the second-identified virtual machine, so that the client displays the remote desktop of the first-identified virtual machine by accessing the data stored in the second-identified virtual machine.

[0055] In an implementable manner, the method further comprises: obtaining connection information of the virtual machine changed from the second identification to the first identification; based on the connection information, sending the connection request to the virtual machine changed from the second identification to the first identification to establish the connection between the client and the first-identified virtual machine, so that the remote desktop of the first-identified virtual machine is displayed by the client.

[0056] Here, the identification of the virtual machine can be changed from the second identification to the first identification to establish the connection with the first-identified virtual machine. By changing the identification of the virtual machine, in the process of establishing the connection between the client and the virtual machine, the virtual machine first connected with the client is changed to another virtual machine in the case that the running state of the virtual machine is abnormal.

[0057] In an implementable manner, after the connection request is sent to the virtual machine changed from the second identification to the first identification to establish the connection between the client and the first-identified virtual machine, the method further comprises: obtaining the input and output event stream of the virtual machine changed from the second identification to the first identification; in the case that the virtual machine with the abnormal running state is detected to be normal, changing the identification of the virtual machine from the first identification to the second identification, and applying the input and output event stream in the virtual machine changed from the first identification to the second identification; changing the running state of the virtual machine changed from the first identification to the second identification from the boot state to the hibernation state, so that the connection between the client and the virtual machine changed from the second identification to the first identification is established in the case that the connection is interrupted.

[0058] Here, the second-identified virtual machine sends the memory input and output event stream to the proxy service device. When the proxy service device senses that the first-identified virtual machine is restored, the identification of the first-identified virtual machine is changed to the second identification, and the input and output event stream sent by the second-identified virtual machine during the failure is applied to the first-identified virtual machine, and then the first-identified virtual machine is hibernated.

[0059] Here, the second-identified virtual machine sends the memory input and output event stream to the proxy service device. When the proxy service device senses that the first-identified virtual machine is restored, the identification of the first-identified virtual machine is changed to the second identification, and the input and output event stream sent by the second-identified virtual machine during the failure is applied to the first-identified virtual machine, and then the first-identified virtual machine is hibernated.

[0060] Here, the second-identified virtual machine sends the memory input and output event stream to the proxy service device. When the proxy service device senses that the first-identified virtual machine is restored, the identification of the first-identified virtual machine is changed to the second identification, and the input and output event stream sent by the second-identified virtual machine during the failure is applied to the first-identified virtual machine, and then the first-identified virtual machine is hibernated.

[0061] Here, the second-identified virtual machine sends the memory input and output event stream to the proxy service device. When the proxy service device senses that the first-identified virtual machine is restored, the identification of the first-identified virtual machine is changed to the second identification, and the input and output event stream sent by the second-identified virtual machine during the failure is applied to the first-identified virtual machine, and then the first-identified virtual machine is hibernated.

[0062] In the above embodiment, the running state of the virtual machine whose identifier has been changed from the first identifier to the second identifier is changed from the powered-on state to the hibernation state, so as to establish a connection between the client and the virtual machine whose identifier has been changed from the first identifier to the second identifier even if the connection with the virtual machine whose identifier has been changed from the second identifier to the first identifier is interrupted.

[0063] The connection between machines is such that when a virtual machine is in hibernation, it only occupies hard disk resources, keeping costs under control. Furthermore, the virtual machine with the second identifier (0) can briefly boot from hibernation, and the agent service device automatically switches to the virtual machine with the second identifier, making the fault imperceptible during use.

[0064] Remote desktop access is achieved by creating virtual machines on a host server. The stability of the virtual machines depends on the stability of the host server. When the host server fails, the remote desktop access from the virtual machines becomes unavailable. One approach is to periodically take snapshots of the virtual machines and then restore the data in the virtual machines by applying these snapshots after the host server recovers. However, this method requires waiting for the host server to recover; if the host server fails, the virtual machines will be unavailable. Furthermore, when taking snapshots, data from the point in time after the snapshot creation will be lost, leading to remote desktop access failures.

[0065] To address the aforementioned issues, this application provides a method for connecting virtual machines. Figure 4 This is a flowchart illustrating a virtual machine connection method provided in an embodiment of this application, as shown below. Figure 4 As shown, the method includes at least the following steps:

[0066] Step S401: Create virtual machine 41 with the first identifier.

[0067] Here, the virtual machine identified by the first identifier was created using a Network File System (NFS) disk.

[0068] Step S402: Create a virtual machine 42 with a second identifier.

[0069] Here, the virtual machine with the second identifier can be created on another host server using the same image as the virtual machine with the first identifier. Here, the virtual machine with the second identifier mounts the NFS disk of the virtual machine with the first identifier. Here, after successful creation, the virtual machine with the second identifier is put into a hibernation state to conserve resources. Here, the host server can be a data center.

[0070] In step S403, the first identified virtual machine 41 sends the input / output event stream to the proxy service device 43.

[0071] Here, the step S403 can be executed when the first-identified virtual machine is in a powered-on state. Here, the input / output event stream can be an event stream stored in memory. Here, the proxy service device can include a gateway 431 (Gateway) + a backend service 432 (Backend Service), and the proxy service device can implement a proxy function of the gateway and / or a function of the backend service.

[0072] Step S404, the proxy service device 43 forwards the input / output event stream to the host server where the second-identified virtual machine 42 is located; the host server where the second-identified virtual machine is located applies the input / output event stream to the second-identified virtual machine.

[0073] Step S405, the proxy service device periodically detects the health status of the first-identified virtual machine, and when it is perceived that the first-identified virtual machine is unavailable, powers on the second-identified virtual machine and replaces the first-identified virtual machine.

[0074] Here, the periodic detection of the health status of the first-identified virtual machine can be implemented by the backend service in the proxy service device.

[0075] Step S406, the client 44 establishes a remote desktop connection with the first-identified virtual machine 41 through the proxy service device 43. When the proxy service device 43 perceives that the connection with the first-identified virtual machine 41 is interrupted, it queries the connection information of the second-identified virtual machine 42, establishes a connection with the second-identified virtual machine 42, and continues to provide services for the client 44.

[0076] Here, the remote desktop connection can be established through the gateway 431 of the proxy service device and the first-identified virtual machine by the client. Here, the connection information can be the Internet Protocol (IP) address of the second-identified virtual machine.

[0077] Step S407, the second-identified virtual machine sends the memory input / output event stream to the proxy service device. When the proxy service device perceives that the first-identified virtual machine is restored, it replaces the identification of the first-identified virtual machine with the second-identified virtual machine, applies the input / output event stream sent by the second-identified virtual machine during the failure, and then hibernates the first-identified virtual machine.

[0078] Here, the second-identified virtual machine does not occupy CPU and memory resources when it is in a hibernation state, but only establishes a memory image on the disk. By way of example, according to a 10% failure rate, an 8-core 16G memory host server can back up 20 virtual machines of 4 cores and 8G of memory. During backup, 160G of disk space is required.

[0079] In the above embodiment, in one aspect, a second-identified virtual machine is created, and another host server uses the same image as the first-identified virtual machine to create the second-identified virtual machine, and the second-identified virtual machine mounts the NFS disk of the first-identified virtual machine. In this way, the same disk is mounted through nfs, and the disk data is guaranteed to be consistent. The second-identified virtual machine can synchronize the memory data of the first-identified virtual machine to the second-identified virtual machine in real time, and the memory uses real-time data flow synchronization, avoiding user data loss. In addition, the first-identified and second-identified virtual machines are not on the same host server, and the host server failure of the first-identified virtual machine will not affect the second-identified virtual machine, and the first-identified virtual machine does not need to wait for the host server failure to be recovered to continue to use.

[0080] In another aspect, the client establishes a remote desktop connection with the first-identified virtual machine through the proxy service device. In this way, when connecting the virtual machine, it is not directly connected, but connected through the proxy service device. When the proxy service device senses that the first-identified virtual machine fails or is unavailable due to network failure, a connection is established with the second-identified virtual machine to replace the first-identified virtual machine, so that the proxy service device replaces the connection with the virtual machine, but does not disconnect the connection with the client, realizing that the client is unaware of the switching of the virtual machine.

[0081] In still another aspect, the second-identified virtual machine can be started from a hibernation state for a short time, and the proxy service device automatically switches to the second-identified virtual machine, and the user does not perceive the failure in the use process. In addition, the second-identified virtual machine in the hibernation state only occupies hard disk resources, and the cost is controllable.

[0082] Based on the foregoing embodiments, the embodiments of the present application further provide a virtual machine connection device. The control device includes various modules, which can be implemented by a processor in an electronic device. Of course, it can also be implemented by a specific logic circuit. In the implementation process, the processor can be a central processing unit (CPU), a micro processing unit (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA).

[0083] Figure 5 A schematic diagram of the composition structure of a virtual machine connection device provided by the embodiments of the present application is shown in Figure 5 As shown in the figure, the device 500 includes a first acquisition module 501, a first connection module 502, a second acquisition module 503, and a second connection module 504, wherein:

[0084] The first obtaining module 501 is configured to obtain a connection request of a remote desktop protocol of a client.

[0085] The first connection module 502 is configured to send the connection request to a first-identified virtual machine, establish a connection between the client and the first-identified virtual machine, and display a remote desktop of the first-identified virtual machine through the client.

[0086] The second obtaining module 503 is configured to obtain connection information of a second-identified virtual machine in a case where the connection with the first-identified virtual machine is interrupted, wherein data stored in the first-identified virtual machine corresponds to data stored in the second-identified virtual machine.

[0087] The second connection module 504 is configured to send the connection request to the second-identified virtual machine based on the connection information, establish a connection between the client and the second-identified virtual machine, and enable the client to display the remote desktop of the first-identified virtual machine by accessing the data stored in the second-identified virtual machine.

[0088] In an implementable manner, the host server where the first-identified virtual machine is located is different from the host server where the second-identified virtual machine is located, and the first-identified virtual machine and the second-identified virtual machine mount the same file directory through a network file system, so that the data stored in the first-identified virtual machine corresponds to the data stored in the second-identified virtual machine.

[0089] In an implementable manner, the apparatus 500 further includes a third obtaining module configured to obtain an input / output event stream of the first-identified virtual machine, and a first processing module configured to apply the input / output event stream to the second-identified virtual machine, so that the data stored in the first-identified virtual machine corresponds to the data stored in the second-identified virtual machine.

[0090] In an implementable manner, the apparatus 500 further includes a detection module configured to detect a running state of the first-identified virtual machine according to a preset time length, and a determination module configured to determine that the connection with the first-identified virtual machine is interrupted in a case where it is detected that the running state of the first-identified virtual machine is abnormal.

[0091] In an implementable manner, the apparatus 500 further includes a control module configured to control the second-identified virtual machine to start up in a case where the connection with the first-identified virtual machine is interrupted, change the identification of the virtual machine from the second identification to the first identification, and send the connection request to the first-identified virtual machine with the changed identification in a case where the connection request of the remote desktop protocol of the client is obtained again.

[0092] In an implementable manner, the apparatus 500 further comprises: a fourth obtaining module, configured to obtain connection information of the virtual machine whose second identifier is modified to the first identifier in the case that the connection with the virtual machine of the first identifier is interrupted; and a second processing module, configured to send the connection request to the virtual machine whose second identifier is modified to the first identifier based on the connection information, and establish the connection between the client and the virtual machine of the first identifier to display the remote desktop of the virtual machine of the first identifier through the client.

[0093] In an implementable manner, the apparatus 500 further comprises: a fifth obtaining module, configured to obtain an input / output event stream of the virtual machine whose second identifier is modified to the first identifier; and a third processing module, configured to modify the identifier of the virtual machine from the first identifier to the second identifier in the case that the virtual machine whose running state is abnormal returns to normal, and apply the input / output event stream to the virtual machine whose first identifier is modified to the second identifier; and modify the running state of the virtual machine whose first identifier is modified to the second identifier from the booting state to the hibernation state, so as to establish the connection between the client and the virtual machine whose first identifier is modified to the second identifier in the case that the connection with the virtual machine whose second identifier is modified to the first identifier is interrupted.

[0094] It should be noted that the description of the above apparatus embodiments is similar to that of the above method embodiments, and has similar beneficial effects to the method embodiments. For technical details not disclosed in the apparatus embodiments of the present application, please refer to the description of the method embodiments of the present application.

[0095] It should be noted that, in the embodiments of the present application, if the above method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application can be embodied in the form of a software product, and the computer software product is stored in a storage medium, and includes a plurality of instructions for causing an electronic device to execute all or part of the methods described in the embodiments of the present application. The storage medium mentioned above includes: a U disk, a mobile hard disk, a read only memory (ROM), a magnetic disk or an optical disk, and various media that can store program codes. Therefore, the embodiments of the present application are not limited to any specific hardware and software combination.

[0096] Correspondingly, the embodiments of the present application provide a computer readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the method described in any of the above embodiments are implemented.

[0097] Correspondingly, in this embodiment of the application, a chip is also provided, the chip including programmable logic circuits and / or program instructions, which, when the chip is running, are used to implement the steps in any of the methods described in the above embodiments.

[0098] Correspondingly, in this embodiment of the application, a computer program product is also provided, which, when executed by the processor of an electronic device, is used to implement the steps in any of the methods described in the above embodiments.

[0099] Based on the same technical concept, this application provides an electronic device for implementing the virtual machine connection method described in the above method embodiments. Figure 6 This is a hardware entity diagram of an electronic device provided in an embodiment of this application, such as... Figure 6 As shown, the electronic device 600 includes a memory 610 and a processor 620. The memory 610 stores a computer program that can run on the processor 620. When the processor 620 executes the program, it implements the steps in any of the methods described in the embodiments of this application.

[0100] The memory 610 is configured to store instructions and applications executable by the processor 620, and can also cache data to be processed or already processed by the processor 620 and various modules in the electronic device (e.g., image data, audio data, voice communication data and video communication data), which can be implemented by flash memory or random access memory (RAM).

[0101] The processor 620 executes the steps of the virtual machine linking method described above when executing the program. The processor 620 typically controls the overall operation of the electronic device 600.

[0102] The aforementioned processor can be at least one of the following: Application Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), Central Processing Unit (CPU), Controller, Microcontroller, and Microprocessor. It is understood that other electronic devices can also implement the functions of the aforementioned processor, and this application does not specifically limit the specific implementation.

[0103] The computer storage medium / memory can be a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Ferromagnetic Random Access Memory (FRAM), a Flash Memory, a magnetic surface storage, an optical disc, a Compact Disc Read-Only Memory (CD-ROM), or the like memory; or can be various electronic devices including one or any combination of the above memories, such as a mobile phone, a computer, a tablet device, a personal digital assistant, and the like.

[0104] It is noted that the above description of the storage medium and device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium and device embodiments of the present application, please refer to the description of the method embodiments of the present application.

[0105] It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that the size of the sequence number of each process in various embodiments of the present application does not mean the execution order, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The sequence number of the above embodiments of the present application is only for description, not representing the advantages and disadvantages of the embodiments.

[0106] It should be noted that, in the present document, the terms "comprising", "containing", or any other similar term are intended to encompass non-exclusive inclusions, such that a process, method, article, or apparatus that comprises a list of elements does not necessarily include those elements only, but can include other elements not expressly listed, or can include elements inherent in such process, method, article, or apparatus. Without more limitations, an element defined by the phrase "comprising a" does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0107] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The above-described device embodiments are only illustrative, for example, the division of the units is only a logical functional division, and actual implementation can have another division manner, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed components can be through some interface, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0108] The units described above as separate components can or can not be physically separated, and the components shown as units can or can not be physical units; they can be located in one place or distributed on multiple network units; and part or all of the units can be selected according to actual needs to achieve the purpose of the embodiments of the present application.

[0109] In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the above integrated unit can be realized in the form of hardware or in the form of hardware plus software functional unit.

[0110] Alternatively, the above integrated unit of the present application, if realized in the form of a software function module and sold or used as an independent product, can also be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application can be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of instructions for causing an apparatus to perform all or part of the methods described in the embodiments of the present application. The foregoing storage medium includes: mobile storage devices, ROM, magnetic or optical disks, and various other media that can store program codes.

[0111] The methods disclosed in the several method embodiments provided by the present application can be combined arbitrarily without conflict to obtain new method embodiments.

[0112] The features disclosed in the several method or device embodiments provided by the present application can be combined arbitrarily without conflict to obtain new method embodiments or device embodiments.

[0113] The above merely provides the implementation manners of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A connection method of a virtual machine, applied to a gateway, the method comprising: obtaining a connection request of a remote desktop protocol of a client; sending the connection request to a first identified virtual machine, establishing a connection between the client and the first identified virtual machine, so as to display a remote desktop of the first identified virtual machine through the client; the client is connected with the first identified virtual machine through the gateway; in a case where the connection with the first identified virtual machine is interrupted, obtaining connection information of a second identified virtual machine; wherein data stored in the first identified virtual machine corresponds to data stored in the second identified virtual machine; based on the connection information, sending the connection request to the second identified virtual machine, establishing a connection between the client and the second identified virtual machine, so as to display the remote desktop of the first identified virtual machine by accessing the data stored in the second identified virtual machine; the client is connected with the second identified virtual machine through the gateway. 2.The method of claim 1, wherein the first identified virtual machine is located in a host server different from a host server where the second identified virtual machine is located; the first identified virtual machine and the second identified virtual machine mount a same file directory through a network file system, so that the data stored in the first identified virtual machine corresponds to the data stored in the second identified virtual machine. 3.The method of claim 1, after the establishing the connection between the client and the first identified virtual machine, the method further comprises: obtaining an input and output event stream of the first identified virtual machine; applying the input and output event stream to the second identified virtual machine, so that the data stored in the first identified virtual machine corresponds to the data stored in the second identified virtual machine. 4.The method of claim 1, after the establishing the connection between the client and the first identified virtual machine, the method further comprises: detecting a running state of the first identified virtual machine according to a preset time length; in a case where it is detected that the running state of the first identified virtual machine is abnormal, determining that the connection with the first identified virtual machine is interrupted. 5.The method of claim 1 or 4, the method further comprises: in a case where the connection with the first identified virtual machine is interrupted, controlling the second identified virtual machine to start up, changing the identification of the virtual machine from the second identification to the first identification, so as to, in a case where the connection request of the remote desktop protocol of the client is obtained again, send the connection request to the first identified virtual machine with the changed identification. 6.The method of claim 5, the method further comprises: in a case where the connection with the first identified virtual machine is interrupted, obtaining the connection information of the virtual machine with the changed identification from the second identification to the first identification. sending the connection request to the virtual machine with the first identity based on the connection information, and establishing the connection between the client and the virtual machine with the first identity to display the remote desktop of the virtual machine with the first identity through the client.

7. The method of claim 6, after the sending the connection request to the virtual machine with the first identity and establishing the connection between the client and the virtual machine with the first identity, the method further comprises: acquiring an input and output event stream of the virtual machine with the first identity; in a case that the virtual machine with the abnormal running state is recovered, changing the identity of the virtual machine from the first identity to the second identity, and applying the input and output event stream to the virtual machine with the second identity; changing the running state of the virtual machine with the second identity from the booting state to the hibernation state to establish the connection between the client and the virtual machine with the second identity in a case that the connection with the virtual machine with the first identity is interrupted.

8. A device for connecting a virtual machine, applied to a gateway, the device comprising: a first acquiring module, configured to acquire a connection request of a remote desktop protocol of a client; a first connecting module, configured to send the connection request to a virtual machine with a first identity, and establish the connection between the client and the virtual machine with the first identity to display the remote desktop of the virtual machine with the first identity through the client; the client is connected with the virtual machine with the first identity through the gateway; a second acquiring module, configured to acquire connection information of a virtual machine with a second identity in a case that the connection with the virtual machine with the first identity is interrupted; the data stored in the virtual machine with the first identity corresponds to the data stored in the virtual machine with the second identity; a second connecting module, configured to send the connection request to the virtual machine with the second identity based on the connection information, and establish the connection between the client and the virtual machine with the second identity to enable the client to display the remote desktop of the virtual machine with the first identity by accessing the data stored in the virtual machine with the second identity; the client is connected with the virtual machine with the second identity through the gateway.

9. An electronic device, comprising a memory and a processor, the memory stores a computer program which can be run on the processor, and the processor implements the steps in the method of any one of claims 1 to 7 when executing the program.

10. A computer readable storage medium, storing a computer program which implements the steps in the method of any one of claims 1 to 7 when executed by a processor.

Citation Information

Patent Citations

  • Management of computing sessions

    CN105579960A