Desktop cloud equipment shutdown control method and device and electronic equipment

By determining and controlling the target virtual machine in the desktop cloud on the local electronic device, the coordinated shutdown between the virtual machine and the electronic device is solved, and the problem of high complexity in the existing technology is solved, reducing the implementation complexity and avoiding proxy Requirements for program deployment and operating system adaptation.

CN119440742AInactive Publication Date: 2025-02-14ZHONGKE FANGDE SOFTWARE CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510040629.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-10
Publication Date
2025-02-14
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the desktop cloud, the implementation of collaborative shutdown between virtual machines and thin terminals is relatively complex, and it is necessary to deploy agents on each virtual machine and adapt to the operating system.

Method used

By determining the target virtual machine in the shutdown state in the desktop cloud on the local electronic device, and determining whether it is shut down in response to user operations, executing a shutdown command to control the shutdown of the electronic device, achieving a coordinated shutdown between the virtual machine and the electronic device.

Benefits of technology

Reduces the complexity of implementing collaborative shutdown between virtual machines and local electronic devices, and does not require the deployment of agents on virtual machines, avoiding the need for operating system adaptation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440742A_ABST
    Figure CN119440742A_ABST
Patent Text Reader

Abstract

The invention discloses an equipment shutdown control method and device for desktop cloud and electronic equipment, and relates to the field of desktop clouds, and the method comprises the steps: determining a target virtual machine in a shutdown state in the desktop cloud on local electronic equipment; determining whether the target virtual machine is shut down in response to user operation; under the condition that the target virtual machine is shut down in response to the user operation, a shutdown command is executed, and the shutdown command is used for controlling the electronic equipment to be shut down. According to the method and the device, an agent program does not need to be deployed on the virtual machine, the control of collaborative shutdown is realized on the local electronic equipment, so that the operation system of the virtual machine does not need to be adapted, and the complexity of realizing collaborative shutdown can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device and electronic device for controlling shutdown of a desktop cloud device. Background Art

[0002] Currently, in desktop clouds, in order to achieve coordinated shutdown of virtual machines and thin terminals, an agent program needs to be deployed on each virtual machine.

[0003] However, the agent needs to adapt to the operating system of the deployed virtual machine, which makes the implementation of coordinated shutdown more complex. Summary of the invention

[0004] In view of the above problems, the present application provides a method, device and electronic device for controlling the shutdown of a desktop cloud device to achieve the purpose between a thin terminal and a virtual machine. The specific scheme is as follows:

[0005] The first aspect of the present application provides a device shutdown control method for a desktop cloud, the method comprising:

[0006] Determine, on a local electronic device, a target virtual machine in the desktop cloud that is in a shutdown state;

[0007] Determining whether the target virtual machine is shut down in response to a user operation;

[0008] In a case where the target virtual machine is shut down in response to a user operation, a shutdown command is executed, where the shutdown command is used to control the electronic device to shut down.

[0009] In a possible implementation, determining whether the target virtual machine is shut down in response to a user operation includes:

[0010] Obtaining connection channel information between the target virtual machine and the electronic device;

[0011] It is determined whether the target virtual machine is shut down in response to a user operation according to the connection channel information.

[0012] In a possible implementation, determining, according to the connection channel information, whether the target virtual machine is shut down in response to a user operation includes:

[0013] Parsing the connection channel information to determine whether the first channel and at least one second channel are closed;

[0014] The first channel is a channel between the target virtual machine and the electronic device for controlling other channels; the second channel is a channel between the target virtual machine and the electronic device that is different from the first channel;

[0015] In a case where the first channel is closed and the second channel is closed, determining that the target virtual machine is closed in response to a user operation;

[0016] In a case where the first channel is closed and the second channel is not closed, it is determined that the target virtual machine is not closed in response to a user operation.

[0017] In a possible implementation, before executing the shutdown command, the method further includes:

[0018] Determining whether the target virtual machine has a collaborative attribute; the collaborative attribute indicates that the electronic device and the target virtual machine are shut down collaboratively;

[0019] In a case where the target virtual machine has the cooperative attribute, the shutdown command is executed.

[0020] In a possible implementation, a virtual machine list is deployed in the electronic device, and the virtual machine list includes at least one virtual machine identifier, and the virtual machine identifier is used to uniquely identify the corresponding virtual machine;

[0021] Wherein, the method further comprises:

[0022] In response to a setting operation on a target identifier in the virtual machine list, the collaboration attribute is set for the target virtual machine corresponding to the target identifier.

[0023] In a possible implementation, determining a target virtual machine in a shutdown state on a local electronic device includes:

[0024] Sending a status request to a target service in the desktop cloud on the electronic device;

[0025] Receive status data fed back by the target service; the status data includes a virtual machine status of at least one virtual machine in the desktop cloud;

[0026] A virtual machine whose virtual machine status representation is in a shutdown state is determined as a target virtual machine.

[0027] In a possible implementation, the method further includes:

[0028] Determine whether the coordinated shutdown conditions are met;

[0029] When the coordinated shutdown condition is met, determining a target virtual machine in the desktop cloud that is in a shutdown state on the electronic device;

[0030] Wherein, the coordinated shutdown condition is related to an input device on the electronic device.

[0031] In a possible implementation, the coordinated shutdown condition includes:

[0032] The electronic device does not receive any input operation from the input device within the target time period.

[0033] A second aspect of the present application provides a device shutdown control device for a desktop cloud, the device comprising:

[0034] A target determination unit, configured to determine a target virtual machine in the desktop cloud that is in a shutdown state on a local electronic device;

[0035] a shutdown determination unit, configured to determine whether the target virtual machine is shut down in response to a user operation;

[0036] The shutdown execution unit is used to execute a shutdown command when the target virtual machine is shut down in response to a user operation, and the shutdown command is used to control the electronic device to shut down.

[0037] The third aspect of the present application provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the device shutdown control method of the desktop cloud according to the first aspect or any implementation of the first aspect.

[0038] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:

[0039] The memory is used to store computer programs;

[0040] The processor is used to execute the computer program so that the electronic device can implement the device shutdown control method of the desktop cloud according to the first aspect or any implementation manner of the first aspect.

[0041] A fifth aspect of the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can be powered off by the desktop cloud device shutdown control method of the above-mentioned first aspect or any implementation of the first aspect.

[0042] By means of the above technical solution, the present application provides a method, apparatus and electronic device for controlling shutdown of a desktop cloud device, by determining the target virtual machine in the desktop cloud that is in a shutdown state on the local electronic device, so that when it is determined that the target virtual machine is shut down in response to a user operation, the shutdown command is executed, so that the electronic device is controlled to shut down, and the coordinated shutdown between the virtual machine of the desktop cloud and the local electronic device is realized. It can be seen that in the present application, there is no need to deploy an agent program on the virtual machine, but to realize the control of coordinated shutdown on the local electronic device, thereby not needing to adapt the operating system of the virtual machine, and thus the complexity of realizing coordinated shutdown can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0044] Figure 1 A flowchart of a device shutdown control method for a desktop cloud provided in an embodiment of the present application;

[0045] Figure 2 This is an architecture diagram of a virtual machine in an embodiment of the present application;

[0046] Figure 3 A partial flow chart of a method for controlling shutdown of a desktop cloud device provided in an embodiment of the present application;

[0047] Figure 4 Another flow chart of a method for controlling shutdown of a desktop cloud device provided in an embodiment of the present application;

[0048] Figure 5 This is an example diagram of a virtual machine list in an embodiment of the present application;

[0049] Figure 6 Another flow chart of a method for controlling shutdown of a desktop cloud device provided in an embodiment of the present application;

[0050] Figure 7 A schematic diagram of the structure of a device shutdown control device for a desktop cloud provided in an embodiment of the present application;

[0051] Figure 8 Another structural schematic diagram of a device shutdown control device for a desktop cloud provided in an embodiment of the present application;

[0052] Fig. 9 Another structural schematic diagram of a device shutdown control device for a desktop cloud provided in an embodiment of the present application;

[0053] Fig.10Another structural schematic diagram of a device shutdown control device for a desktop cloud provided in an embodiment of the present application;

[0054] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0055] Fig.12 This is a flow chart of realizing coordinated shutdown during use of a virtual machine in an embodiment of the present application;

[0056] Fig.13 This is a flow chart for determining active shutdown conditions in an embodiment of the present application. DETAILED DESCRIPTION

[0057] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0058] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0059] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0060] Reference Figure 1 , is a flowchart of a method for controlling shutdown of a desktop cloud device provided in an embodiment of the present application. The method can be applied to a local electronic device, such as a thin terminal, etc., in which an operating system and a client can be deployed. A user can access a virtual machine deployed on the desktop cloud through the client, such as Figure 2 As shown in , one or more virtual machines may be deployed on the cloud server of the desktop cloud. The technical solution in this embodiment is mainly used to reduce the complexity of realizing the coordinated shutdown between the virtual machine and the local electronic device.

[0061] Specifically, the method in this embodiment may include the following steps:

[0062] Step 101: Determine a target virtual machine in a shutdown state in a desktop cloud on a local electronic device.

[0063] In this embodiment, the target virtual machine in the shutdown state can be determined by detecting the virtual machine state of the virtual machine deployed on the cloud server of the desktop cloud.

[0064] In one implementation, step 101 may be implemented in the following manner:

[0065] First, on the electronic device, a status request is sent to the target service in the desktop cloud, such as a status request based on the Hypertext Transfer Protocol (http).

[0066] Then, the state data fed back by the target service is received. The state data may include: the virtual machine state of at least one virtual machine in the desktop cloud, where the virtual machine state indicates whether the corresponding virtual machine is in a running state or a shutdown state.

[0067] Finally, according to the state data, a virtual machine whose virtual machine state representation is in a shutdown state is determined as a target virtual machine.

[0068] The target service may be a service for managing virtual machines in a virtualization layer on a cloud server, such as a libvirt service. The field value of a specific field of the target service, such as the isActive field, can represent the state of the virtual machine. Based on this, the target service may respond to an http-based state request and, according to the field value of a specific field, feedback state data to the electronic device, including the virtual machine state of each virtual machine deployed on the cloud server.

[0069] Step 102: Determine whether the target virtual machine is shut down in response to a user operation. If the target virtual machine is shut down in response to a user operation, execute step 103.

[0070] Among them, the shutdown of a virtual machine can be divided into two situations: the first is that the virtual machine is shut down in response to a user operation, and the second is that the virtual machine is shut down due to its own failure. For example, in the first case, the user can shut down the accessed virtual machine on the client deployed by the local electronic device to trigger the shutdown of the virtual machine; or, the administrator performs a single or batch shutdown operation on the virtual machine on the management server of the desktop cloud to trigger the shutdown of the virtual machine. In the second case, the virtual machine automatically shuts down due to its own failure, such as a system failure or a hardware failure. Based on this, in this embodiment, the target virtual machine can be shut down to determine whether the target virtual machine is shut down in response to a user operation or due to its own failure.

[0071] Step 103: Execute a shutdown command, where the shutdown command is used to control the electronic device to shut down.

[0072] The shutdown command may be a command in the operating system of the electronic device that can control the shutdown of the electronic device, such as a "poweroff" command in the Linux operating system. For example, if the electronic device is a thin terminal that deploys the Linux operating system, in this embodiment, when it is determined that the target virtual machine in the shutdown state is shut down in response to a user operation, the "poweroff" command can be used to control the shutdown of the thin terminal.

[0073] By means of the above technical solution, in a device shutdown control method of a desktop cloud provided by an embodiment of the present application, a target virtual machine in a shutdown state in the desktop cloud is determined on a local electronic device, so that when it is determined that the target virtual machine is shut down in response to a user operation, a shutdown command is executed, thereby controlling the electronic device to shut down and realizing a coordinated shutdown between the virtual machine of the desktop cloud and the local electronic device. It can be seen that in the present application, there is no need to deploy an agent program on the virtual machine, but to realize the control of coordinated shutdown on the local electronic device, thereby not needing to adapt the operating system of the virtual machine, and thus reducing the complexity of realizing coordinated shutdown.

[0074] In one implementation, the determination in step 102 of whether the target virtual machine is shut down in response to a user operation may be implemented in the following manner: Figure 3 As shown in:

[0075] Step 301: Obtain connection channel information between a target virtual machine and an electronic device.

[0076] The connection channel information may include: at least one data connection channel established between the target virtual machine and the electronic device, such as the channel input_channel for transmitting keyboard and mouse data, the channel display_channel for transmitting display data, the channel main_channel for controlling other channels, etc. The connection channel information may indicate whether these data connection channels are closed.

[0077] Step 302: Determine whether the target virtual machine is shut down in response to a user operation based on the connection channel information.

[0078] Specifically, in this embodiment, whether the target virtual machine is closed in response to a user operation may be determined based on whether at least one data connection channel established between the target virtual machine and the electronic device is closed.

[0079] For example, in step 302, the connection channel information may be parsed to determine whether the first channel and at least one second channel are closed. Then, if the first channel is closed and the second channel is closed, it is determined that the target virtual machine is closed in response to a user operation, and if the first channel is closed and the second channel is not closed, it is determined that the target virtual machine is not shut down in response to a user operation, that is, the target virtual machine is shut down due to its own failure.

[0080] Among them, the first channel is a channel between the target virtual machine and the electronic device for controlling other channels, such as the channel main_channel used to control other channels; the second channel can be a channel between the target virtual machine and the electronic device that is different from the first channel, such as the channel input_channel used to transmit keyboard and mouse data, and the channel display_channel used to transmit display data.

[0081] It can be seen that in this embodiment, whether the target virtual machine is closed in response to a user operation or due to its own failure can be determined based on whether at least one data connection channel between the target virtual machine and the electronic device is closed.

[0082] In one implementation, after determining in step 102 that the target virtual machine is shut down in response to a user operation and before executing the shutdown command in step 103, the method in this embodiment may further include the following steps: Figure 4 As shown in:

[0083] Step 104: Determine whether the target virtual machine has a collaborative attribute. If the target virtual machine has a collaborative attribute, execute step 103. If the target virtual machine does not have a collaborative attribute, end the current process, that is, do not control the electronic device to shut down in response to the target virtual machine being shut down.

[0084] The collaborative attribute represents that the electronic device and the target virtual machine are shut down in coordination, that is, when the target virtual machine is shut down, the electronic device needs to be shut down. It can also be understood as: the electronic device needs to shut down in response to the shut down of the target virtual machine.

[0085] Specifically, the collaborative attribute can be implemented using a flag field, such as a flag field Virtoff_Flag. When the flag field Virtoff_Flag is a first field value such as True, it indicates that the target virtual machine has the collaborative attribute. When the flag field Virtoff_Flag is a second field value such as False, it indicates that the target virtual machine does not have the collaborative attribute. Based on this, in this embodiment, it can be determined whether the flag field corresponding to the target virtual machine is the first field value. If so, it can be determined that the target virtual machine has the collaborative attribute value.

[0086] It can be seen that in this embodiment, a collaborative relationship between the target virtual machine and the thin terminal is established through the collaborative attribute, thereby realizing the control of collaborative shutdown.

[0087] Based on the above implementation, a virtual machine list may be deployed in a local electronic device, the virtual machine list including at least one virtual machine identifier, which is used to uniquely identify the corresponding virtual machine. For example, the virtual machine identifier is represented by a universally unique identifier (uuid).

[0088] Therefore, in this embodiment, in response to a setting operation on a target identifier in the virtual machine list, a coordination attribute can be set for a target virtual machine corresponding to the target identifier.

[0089] For example, Figure 5 As shown in, a virtual machine list can be provided to the user on the client of the thin terminal. The virtual machine list includes the uuids of the virtual machines that the thin terminal can access, such as the uuids of virtual machine 1, virtual machine 2, virtual machine 3 to virtual machine n, where n is the number of virtual machines. The user can perform setting operations for each uuid, such as setting the flag field of one or more virtual machines to the first field value so that the virtual machine has a collaborative attribute.

[0090] In one implementation, before determining in step 101 that the target virtual machine in the desktop cloud is in a shutdown state, the method in this embodiment may further include the following processing, such as Figure 6 As shown in:

[0091] Step 105: Determine whether the coordinated shutdown condition is met. If the coordinated shutdown condition is met, execute step 101. If the coordinated shutdown condition is not met, continue to execute step 105 until the coordinated shutdown condition is met.

[0092] Among them, the coordinated shutdown condition is related to the input device on the electronic device. That is to say, in this embodiment, it can be determined whether to start executing the method in this embodiment based on the situation in which the input device is operated. The processing flow of steps 101 to 103 in this embodiment is executed only when the coordinated shutdown condition is met to achieve coordinated shutdown. If the coordinated shutdown condition is not met, the processing flow of steps 101 to 103 is not executed. Therefore, in this embodiment, the control of coordinated shutdown is triggered by configuring the coordinated shutdown condition, and there is no need to continuously execute the processing flow of steps 101 to 103, so as to avoid excessive occupation of the operating resources of the local electronic device.

[0093] In a specific implementation, the coordinated shutdown condition may be: the electronic device does not receive any input operation from the input device within a target time period.

[0094] The input device may include at least one of a mouse, a keyboard, a touch screen, and a sensor. The sensor may include an image sensor, an infrared sensor, a radar, and the like. In this embodiment, the sensor may be used to recognize user gestures, such as finger movements, body movements, and the like, to obtain input operations.

[0095] Specifically, in this embodiment, on the local electronic device, it is possible to determine once every target time period whether an input operation of the input device is received within the target time period. Once it is determined that no input operation is received within the target time period, it is possible to determine that the coordinated shutdown condition is met, first determine the target virtual machine in the shutdown state, and then determine whether the target virtual machine in the shutdown state is shut down in response to a user operation or due to its own failure. Based on this, in the case where the target virtual machine is shut down in response to a user operation, if the target virtual machine has a collaborative attribute, then a shutdown command can be executed on the local electronic device based on the shut down target virtual machine to achieve coordinated shutdown control between the target virtual machine and the local electronic device.

[0096] refer to Figure 7 , is a schematic diagram of the structure of a device shutdown control device for a desktop cloud provided in an embodiment of the present application. The device can be deployed in a local electronic device, in which an operating system and a client can be deployed. A user can access a virtual machine deployed on the desktop cloud through the client, such as Figure 2 As shown in , one or more virtual machines may be deployed on the cloud server of the desktop cloud. The technical solution in this embodiment is mainly used to reduce the complexity of realizing the coordinated shutdown between the virtual machine and the local electronic device.

[0097] Specifically, the device in this embodiment may include the following units:

[0098] A target determination unit 701 is used to determine a target virtual machine in the desktop cloud that is in a shutdown state on a local electronic device;

[0099] A shutdown determination unit 702, configured to determine whether the target virtual machine is shut down in response to a user operation;

[0100] The shutdown execution unit 703 is used to execute a shutdown command when the target virtual machine is shut down in response to a user operation, and the shutdown command is used to control the electronic device to shut down.

[0101] By means of the above technical solution, in a device shutdown control device for a desktop cloud provided by the present application, a target virtual machine in a shutdown state in the desktop cloud is determined on a local electronic device, so that when it is determined that the target virtual machine is shut down in response to a user operation, a shutdown command is executed, thereby controlling the shutdown of the electronic device and realizing a coordinated shutdown between the virtual machine of the desktop cloud and the local electronic device. It can be seen that in the present application, there is no need to deploy an agent program on the virtual machine, but to realize the control of coordinated shutdown on the local electronic device, thereby not needing to adapt the operating system of the virtual machine, and thus reducing the complexity of realizing coordinated shutdown.

[0102] In one implementation, the shutdown determination unit 702 is specifically configured to: obtain connection channel information between the target virtual machine and the electronic device; and determine, based on the connection channel information, whether the target virtual machine is shut down in response to a user operation.

[0103] Among them, when the shutdown determination unit 702 determines whether the target virtual machine is shut down in response to a user operation based on the connection channel information, it is specifically used to: parse the connection channel information to determine whether a first channel and at least one second channel are closed; wherein the first channel is a channel between the target virtual machine and the electronic device for controlling other channels; the second channel is a channel between the target virtual machine and the electronic device that is different from the first channel; when the first channel is closed and the second channel is closed, it is determined that the target virtual machine is shut down in response to a user operation; when the first channel is closed and the second channel is not closed, it is determined that the target virtual machine is not shut down in response to a user operation.

[0104] In one implementation, the device in this embodiment may further include the following units: Figure 8 As shown in:

[0105] The collaboration judgment unit 704 is used to determine whether the target virtual machine has a collaboration attribute before the shutdown execution unit 703 executes the shutdown command; the collaboration attribute represents that the electronic device and the target virtual machine are shut down in collaboration; when the target virtual machine has the collaboration attribute, the shutdown command is executed.

[0106] Among them, a virtual machine list is deployed in the electronic device, and the virtual machine list includes at least one virtual machine identifier, and the virtual machine identifier is used to uniquely represent the corresponding virtual machine; the device in this embodiment may also include the following units, such as Fig. 9 As shown in:

[0107] The attribute setting unit 705 is configured to set the collaboration attribute for the target virtual machine corresponding to the target identifier in the virtual machine list in response to a setting operation on the target identifier.

[0108] In one implementation, the target determination unit 701 is specifically used to: send a status request to the target service in the desktop cloud on the electronic device; receive status data fed back by the target service; the status data includes the virtual machine status of at least one virtual machine in the desktop cloud; and determine the virtual machine represented by the virtual machine status as being in a shutdown state as the target virtual machine.

[0109] In one implementation, the device in this embodiment may further include the following units: Fig.10 As shown in:

[0110] The condition judgment unit 706 is used to determine whether the coordinated shutdown condition is met; when the coordinated shutdown condition is met, the target determination unit 701 is triggered; wherein the coordinated shutdown condition is related to the input device on the electronic device.

[0111] The coordinated shutdown condition includes: the electronic device does not receive any input operation from the input device within a target time period.

[0112] It should be noted that the specific implementation method of each unit in this embodiment can refer to the corresponding content in the previous text and will not be described in detail here.

[0113] refer to Fig.11 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, and the electronic device may be a local thin terminal that accesses a virtual machine on a cloud server through a client, such as Figure 2 as shown in .

[0114] The electronic device in this embodiment may include the following structure:

[0115] Memory 1101, used to store computer programs and data generated by the execution of the computer programs;

[0116] Processor 1102 is used to execute the computer program to achieve: determining a target virtual machine in a shutdown state in the desktop cloud; determining whether the target virtual machine is shut down in response to a user operation; and when the target virtual machine is shut down in response to a user operation, executing a shutdown command, wherein the shutdown command is used to control the electronic device to shut down.

[0117] By means of the above technical solution, in an electronic device provided by the present application, by determining the target virtual machine in the desktop cloud that is in a shutdown state on the local electronic device, when it is determined that the target virtual machine is shut down in response to a user operation, a shutdown command is executed, thereby controlling the electronic device to shut down, and realizing the coordinated shutdown between the virtual machine of the desktop cloud and the local electronic device. It can be seen that in the present application, there is no need to deploy an agent program on the virtual machine, but to realize the control of the coordinated shutdown on the local electronic device, thereby not needing to adapt the operating system of the virtual machine, and thus the complexity of realizing the coordinated shutdown can be reduced.

[0118] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any desktop cloud device shutdown control method provided in the embodiment of the present application.

[0119] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any desktop cloud device shutdown control method provided in an embodiment of the present application.

[0120] by Figure 2 Taking the desktop cloud architecture shown in the figure as an example, desktop cloud is a technology that provides a desktop operating environment through cloud computing. Users access virtual machines through the network without relying on local computers. When using desktop cloud, users use thin terminals to access virtual machines. Thin terminals are lightweight devices that only have network functions and can connect to remote servers. They usually only contain communication equipment and operating systems. Desktop cloud technology saves users hardware costs, improves maintenance efficiency, and reduces electricity consumption through flexible and scalable configuration and secure and controllable data protection. Thin terminal devices are widely used in industries such as industry, education, and design as login carriers for desktop cloud technology. When users use desktop cloud instead of traditional computers, they usually want to continue their usage habits.

[0121] Based on this, the present application is mainly reflected in that when a user uses the desktop cloud for office work, when the shutdown button in the desktop cloud virtual machine is used to shut down the virtual machine, the thin terminal can be shut down synchronously, which simplifies the user's operation and improves the efficiency of using the desktop cloud. The technical solution of the present application is described below:

[0122] First of all, this application mainly uses the client in the local thin terminal to perform a series of virtual machine status monitoring. After confirming that the active shutdown conditions are met, the client controls the thin terminal physical machine device to shut down. The core is how to judge the shutdown event of the virtual machine on the thin terminal. Since the thin terminal also needs to be shut down after the virtual machine is shut down in this solution, it is very important to stably judge the shutdown event of the virtual machine to avoid the abnormal shutdown of the thin terminal caused by the non-active shutdown of the virtual machine.

[0123] like Fig.12 As shown in , the process of realizing coordinated shutdown during the use of the virtual machine for this application is as follows:

[0124] Step 1201: Configure coordinated shutdown, that is, set the coordinated attributes of the virtual machine as described above.

[0125] Among them, each virtual machine that the client can connect to in the thin terminal has its own unique ID such as uuid. The client can query it in the cloud server. The uuid can be used to define whether the virtual machine is configured to be shut down in coordination with the thin terminal, which is used as one of the conditions for subsequent active shutdown judgment. Each unique uuid corresponds to a separate coordinated shutdown setting flag field Virtoff_Flag as True or False. In the virtual machine list, each virtual machine has a separate setting operation. The corresponding coordinated shutdown configuration in the setting operation corresponds to the unique uuid of this virtual machine. Moreover, the uuid can be used to determine whether the user is operating the virtual machine, that is, whether the virtual machine is in a shutdown state, and each virtual machine does not interfere with each other. When the user uses multiple virtual machines, by setting one or several virtual machines to coordinate with the shutdown of the thin terminal, one or several virtual machines are not associated with the shutdown of the thin terminal, and the virtual machine can be shut down independently, which improves the user's virtual machine experience.

[0126] Step 1202: The user shuts down the virtual machine.

[0127] Among them, the internal shutdown of the virtual machine can be divided into three situations:

[0128] A: Users use the virtual machine through the desktop cloud client and click the shutdown button of the virtual machine operating system after use.

[0129] B: The cloud desktop administrator user connects to the virtual machine through the web on the cloud management platform console and clicks the shutdown button of the virtual machine operating system after use.

[0130] C: The cloud desktop administrator user performs batch shutdown management on the cloud management platform. This operation is implemented through the virtualization layer of cloud desktop management.

[0131] Regardless of which of the above methods is used to shut down, this application considers it an active shutdown, which can trigger the coordinated shutdown control in this application. When the shutdown method is a shutdown caused by the virtual machine crashing due to its own reasons, this application can be considered a passive shutdown, which does not trigger the coordinated shutdown mechanism and returns to the system interface of the thin terminal itself.

[0132] Step 1203: Obtain active shutdown conditions.

[0133] Obtain active shutdown conditions to prepare data for subsequent judgments. The main judgment conditions obtained are:

[0134] a: Mouse and keyboard activity status.

[0135] In order to ensure the stability of judging the shutdown of the virtual machine, this application assists in judging by judging the activity status of the mouse and keyboard. The acquisition method is to capture the keyboard keys, mouse keys, and mouse movements through the event interface key_event, button_event, and motion_event in the data transmitted through the spice connection channel between the virtual machine and the thin terminal. Since the captured data is the content of certain operations during the use of the virtual machine, the activity status of the keyboard and mouse can be used as auxiliary data for shutting down the virtual machine.

[0136] b: Virtual machine running status.

[0137] The client on the thin terminal interacts with the libvirt service deployed on the virtualization layer of the cloud server computing node, and obtains the current uuid status through HTTP status query, whether it is active / shutdown.

[0138] c: Virtual machine connection status.

[0139] Since the virtual machine's network will be disconnected regardless of whether it is shut down actively or passively, it means that the virtual machine is disconnected from the client on the thin terminal. The desktop cloud has a spice connection channel from the virtual machine to the thin terminal. From the data obtained from the connection channel, it can be determined whether the virtual machine is shut down actively or passively.

[0140] Active shutdown: After the virtual machine is disconnected from the thin terminal, the input_channel, display_channel, and main_channel in the spice connection channel are closed and destroyed in sequence (that is, memory space is released).

[0141] Passive shutdown: The main_channel in the spice connection channel is directly closed, and other channels do not have time to disconnect and destruct.

[0142] Step 1204: Confirm active shutdown.

[0143] Because the above condition b needs to interact with libvirt through HTTP to determine the running status of the virtual machine, in order to avoid frequent interactions affecting the normal data operation of the desktop cloud, this application adopts the form of event triggering. Whenever there is no activity on the keyboard and mouse in the virtual machine for more than 30 seconds (that is, the target duration in the previous article), it is preliminarily considered that there is no operation or the user is not operating on the client, that is, it is detected every 30 seconds whether there is keyboard and mouse activity. At this time, a pre-judgment is made and a message is interacted with the virtualization layer once to confirm the active state or the shutdown state or the hang-up state.

[0144] After the pre-judgment conditions are met, the virtual machine connection status is judged. Under this condition, it is judged whether the virtual machine is actively disconnected, that is, actively shut down. After the above judgment is combined to ensure that the virtual machine is manually disconnected, the physical thin terminal is shut down to achieve the purpose of stable coordinated shutdown. The judgment process is as follows Fig.13 As shown in:

[0145] Step 1301: Perform start condition determination, specifically: obtain keyboard and mouse activity status;

[0146] Step 1302: If there is no operation for 30 seconds, i.e., no keyboard or mouse activity, execute step 1303; otherwise, return to continue the start condition determination;

[0147] Step 1303: Obtain the running state of the virtual machine, that is, the shutdown state or the active state;

[0148] Step 1304: determine whether the virtual machine is in a shutdown state, if yes, execute step 1305, otherwise, return to continue to determine the start condition;

[0149] Step 1305: Obtain the virtual machine connection status, such as the connection status of the three connection channels input_channel, display_channel, and main_channel;

[0150] Step 1306: Determine whether the virtual machine is actively disconnected, that is, whether it is actively shut down. If yes, execute step 1307; otherwise, execute step 1308;

[0151] Step 1307: End the process and close the physical thin terminal;

[0152] Step 1308: Return the operating system of the physical thin terminal.

[0153] In the specific implementation, this application creates a data structure to record the keyboard and mouse status:

[0154] Struct

[0155] {

[0156] Key_scan;

[0157] Mouse_button;

[0158] [P]Mouse_motion;[ / P]

[0159] }

[0160] Among them, Key_scan collects the key values ​​of the virtual machine keyboard through key_event. Mouse_button collects the pressing and releasing of the mouse button through button_event. Mouse_motion collects the position movement of the mouse through motion_event. Every 30 seconds, it is judged whether the three conditions Key_scan&&Mouse_button&&Mouse_motion are all 0 (that is, all three values ​​are 0) to pre-judge whether the current virtual machine is active or inactive, triggering the judgment of the running status of the virtual machine.

[0161] In this embodiment, the client installed on the physical thin terminal can initiate an http request, and the isActive field of the cloud server libvirt can be used to determine the virtual machine status of the current uuid. When the virtual machine status is inactive, the current virtual machine is determined to be in a shutdown state. When the virtual machine status is running, since the mouse and keyboard have not been active for 30 seconds, it is determined that the user is hanging up or only watching the scene without operating, and has not shut down. At this time, the keyboard and mouse activities continue to be monitored.

[0162] In addition, no matter what the circumstances are, when the virtual machine running in the desktop cloud is shut down, the connection between the virtual machine and the thin terminal will be disconnected. This application mainly determines the virtual machine connection status as the virtual machine that is actively shut down by the user, and excludes the crash caused by the abnormal state of the virtual machine. The crash caused by the abnormal state should be returned to the operating system of the thin terminal, and the thin terminal should not be shut down in this case.

[0163] Combined with the judgment of the above conditions, the corresponding shutdown conditions are described, as shown in Table 1:

[0164] Table 1 Shutdown conditions Conditional scenario Virtual machine connection status Virtual machine running status Mouse and keyboard activity status Cloud Desktop Shutdown disconnect Not running Active -> Inactive for 30 seconds WebShutdown disconnect Not running Inactive Batch shutdown disconnect Not running Active -> Inactive for 30 seconds Passive shutdown Abnormal disconnection run Inactive

[0165] Based on the above analysis, this application not only ensures the stability of judging the active shutdown of the virtual machine, avoiding the impact of the thin terminal's accidental shutdown on the user experience, but also reduces the communication frequency between the thin terminal and the cloud server through the pre-judgment mechanism of the mouse and keyboard, thereby enhancing the experience of cloud desktop users.

[0166] Step 1205: Execute the thin terminal shutdown.

[0167] After confirming that the virtual machine is shut down actively, query the flag field Virtoff_Flag corresponding to the virtual machine. If Virtoff_Flag is True, execute the "poweroff" command according to the configuration of the Linux system to shut down the thin terminal system and end the solution process.

[0168] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0169] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0170] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0171] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.

Claims

1. A method for controlling shutdown of a desktop cloud device, characterized in that: The method comprises: Determine, on a local electronic device, a target virtual machine in the desktop cloud that is in a shutdown state; Determining whether the target virtual machine is shut down in response to a user operation; In a case where the target virtual machine is shut down in response to a user operation, a shutdown command is executed, where the shutdown command is used to control the electronic device to shut down.

2. The method according to claim 1, characterized in that Determining whether the target virtual machine is shut down in response to a user operation includes: Obtaining connection channel information between the target virtual machine and the electronic device; It is determined whether the target virtual machine is shut down in response to a user operation according to the connection channel information.

3. The method according to claim 2, characterized in that Determining, according to the connection channel information, whether the target virtual machine is shut down in response to a user operation includes: Parsing the connection channel information to determine whether the first channel and at least one second channel are closed; The first channel is a channel between the target virtual machine and the electronic device for controlling other channels; the second channel is a channel between the target virtual machine and the electronic device that is different from the first channel; In a case where the first channel is closed and the second channel is closed, determining that the target virtual machine is closed in response to a user operation; In a case where the first channel is closed and the second channel is not closed, it is determined that the target virtual machine is not closed in response to a user operation.

4. The method according to claim 1 or 2, characterized in that: Before executing the shutdown command, the method further includes: Determining whether the target virtual machine has a collaborative attribute; the collaborative attribute indicates that the electronic device and the target virtual machine are shut down collaboratively; In a case where the target virtual machine has the cooperative attribute, the shutdown command is executed.

5. The method according to claim 4, characterized in that A virtual machine list is deployed in the electronic device, the virtual machine list includes at least one virtual machine identifier, and the virtual machine identifier is used to uniquely identify the corresponding virtual machine; Wherein, the method further comprises: In response to a setting operation on a target identifier in the virtual machine list, the collaboration attribute is set for the target virtual machine corresponding to the target identifier.

6. The method according to claim 1 or 2, characterized in that: Determining a target virtual machine in the desktop cloud that is in a shutdown state on a local electronic device includes: Sending a status request to a target service in the desktop cloud on the electronic device; Receive status data fed back by the target service; the status data includes a virtual machine status of at least one virtual machine in the desktop cloud; A virtual machine whose virtual machine status representation is in a shutdown state is determined as a target virtual machine.

7. The method according to claim 1 or 2, characterized in that: The method further comprises: Determine whether the coordinated shutdown conditions are met; When the coordinated shutdown condition is met, determining the target virtual machine in the desktop cloud that is in a shutdown state on the local electronic device; Wherein, the coordinated shutdown condition is related to an input device on the electronic device.

8. The method according to claim 7, characterized in that The coordinated shutdown conditions include: The electronic device does not receive any input operation from the input device within the target time period.

9. A device shutdown control device for a desktop cloud, characterized in that: The device comprises: A target determination unit, configured to determine a target virtual machine in the desktop cloud that is in a shutdown state on a local electronic device; a shutdown determination unit, configured to determine whether the target virtual machine is shut down in response to a user operation; The shutdown execution unit is used to execute a shutdown command when the target virtual machine is shut down in response to a user operation, and the shutdown command is used to control the electronic device to shut down.

10. An electronic device, characterized in that: include: A memory, used to store a computer program and data generated by the execution of the computer program; The processor is used to execute the computer program to achieve: determining a target virtual machine in a shutdown state in a desktop cloud; determining whether the target virtual machine is shut down in response to a user operation; and executing a shutdown command when the target virtual machine is shut down in response to a user operation, wherein the shutdown command is used to control the electronic device to shut down.

Citation Information

Patent Citations

  • Power-on and power-off method and device

    CN107689873A

  • Method and device of linkage shutdown and client

    CN108804147A

  • Control method and control system of virtual cloud desktop server and electronic equipment

    CN109992343A

  • Method for quickly turning off desktop cloud server

    CN111078310A

  • Cloud desktop running state management and control method and device, electronic equipment and storage medium

    CN116339925A