VNC resolution adaptive adjustment method and device based on Openstack virtualization
By dynamically adjusting the virtual machine VNC resolution in the OpenStack virtualization environment, the problem of mismatch between the virtual machine desktop and the browser window when the browser window size changes is solved, realizing adaptive adjustment of the browser window and the virtual machine VNC resolution, and improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2026-03-20
AI Technical Summary
In existing technologies, when the browser window size changes, the virtual machine desktop and the browser window cannot match, causing inconvenience for users.
By obtaining the current browser window resolution, the optimal resolution is determined using the OpenStack nova api module and nova compute module, and the virtual machine VNC resolution is dynamically adjusted using the qemu-guest-agent component and xrandr program to adapt to changes in browser window size.
It achieves a high degree of adaptation between the browser window and the VNC virtual machine resolution, improving the convenience of user operation and display effect.
Smart Images

Figure CN121711344A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cloud computing virtualization technology, and in particular to a method and apparatus for adaptive adjustment of VNC resolution based on OpenStack virtualization. Background Technology
[0002] As enterprises increasingly demand lower operation and maintenance costs, cloud computing technology has emerged as a cornerstone of operations in data centers and enterprise server rooms, providing a computing platform that is easy to manage and maintain for various user businesses, thus helping users reduce operation and maintenance costs. The advantage of cloud computing lies in integrating hardware resources and reducing enterprise costs, while virtualization technology is the cornerstone of cloud computing. Virtualization is located at the IaaS layer of cloud computing, abstracting and managing hardware resources. OpenStack is the most widely used virtualization-based management platform today, and noVNC is the most widely used virtual machine access method for OpenStack.
[0003] KVM (Kernel-based Virtual Machine) is an open-source virtualization solution based on Linux, integrated into the Linux Kernel after version 2.6.20. KVM utilizes the Linux kernel's built-in scheduling modules for I / O, network, CPU, and memory, resulting in a small codebase and making it a lightweight virtualization solution compared to Xen. KVM currently supports Intel's VTX and AMD-V hardware virtualization technology. OpenStack (OpenStack Cloud Software) is the most widely used virtualization management platform today. Based on KVM / Qemu virtualization technology, it provides cloud infrastructure services (such as compute instances, network, and storage resources), aiming to provide a flexible and scalable cloud management solution. It consists of a series of sub-projects, each responsible for implementing specific types of cloud computing services. The most famous project is the nova project. The nova project provides users with virtual machine compute instances and allows users to access the virtual machine interface via a browser using noVNC, making the virtual machine appear as if it were a machine on the local machine. noVNC (Web-based VNC) is an open-source remote desktop access client based on the VNC protocol. It does not require any external client programs; a browser is all that is needed to access the remote desktop. In OpenStack nova, noVNC is used to provide browser-based access to the virtual machine console, allowing users to directly access, manage, and operate virtual machine instances from a browser without installing additional VNC client software.
[0004] While existing technologies like noVNC allow client access via a browser, a mismatch occurs when the browser window size changes. For example, only a portion of the virtual machine desktop may be displayed in the browser window, failing to achieve proper alignment. This often results in the virtual machine desktop image appearing too small, making it difficult for users to operate the virtual machine. Therefore, adapting the virtual machine VNC resolution to changes in the browser window size, thereby improving the compatibility between the browser window resolution and the virtual machine VNC resolution and enhancing user convenience, is a pressing technical problem that needs to be solved. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a method and apparatus for adaptive adjustment of VNC resolution based on OpenStack virtualization, so as to eliminate or improve one or more defects existing in the prior art.
[0006] One aspect of the present invention provides a method for adaptive adjustment of VNC resolution based on OpenStack virtualization, the method comprising:
[0007] Get the current browser window resolution;
[0008] The current browser window resolution is sent to the OpenStack nova API module, which then forwards the resolution setting request to the OpenStack nova compute module.
[0009] The OpenStack nova compute module obtains a set of desktop resolutions supported by the virtual machine. Based on the current browser window resolution included in the received resolution setting request, the OpenStack nova compute module determines the optimal resolution from the set of desktop resolutions as the VNC resolution.
[0010] In some embodiments of the present invention, the optimal resolution is the resolution closest to the current browser window resolution.
[0011] In some embodiments of the present invention, the OpenStack nova compute module determines the optimal resolution as the VNC resolution from the set of desktop resolutions based on the current browser window resolution included in the received resolution setting request, including:
[0012] The OpenStack nova compute module iterates through each resolution in the set of desktop resolutions;
[0013] Calculate the difference between each of the resolutions and the current browser window resolution;
[0014] The optimal resolution is determined based on the aforementioned difference values.
[0015] In some embodiments of the present invention, the difference between each of the resolutions and the current browser window resolution is calculated, including...
[0016] Subtract the height and width of the current browser window resolution from the height and width of the resolution respectively to obtain the height difference and width difference;
[0017] Determine the absolute values of the height difference and the width difference;
[0018] The difference value is obtained by adding the absolute values of the height difference and the width difference.
[0019] In some embodiments of the present invention, determining the optimal resolution based on each of the said difference values includes:
[0020] The resolution corresponding to the minimum difference value is taken as the optimal resolution.
[0021] In some embodiments of the present invention, the method further includes:
[0022] Install the qemu-guest-agent component and virtual machine desktop application on the virtual machine image; add a RESTful API interface for setting the resolution size to the OpenStack novaapi module; and / or,
[0023] The optimal resolution is set to VNC resolution by invoking the virtual machine desktop application using the command `virsh qemu-agent-command`.
[0024] In some embodiments of the present invention, the OpenStack nova API module forwards the resolution setting request to the OpenStack nova compute module, including:
[0025] The OpenStack nova API module forwards resolution setting requests to the OpenStack nova compute module based on the RESTful API interface.
[0026] In some embodiments of the present invention, the virtual machine desktop program is the xrandr program.
[0027] According to another aspect of the present invention, a VNC resolution adaptive adjustment system based on OpenStack virtualization is also disclosed. The system includes a processor, a memory, and a computer program stored in the memory. The processor is used to execute the computer program. When the computer program is executed, the system implements the steps of the method as described in any of the above embodiments.
[0028] According to another aspect of the present invention, a computer-readable storage medium is also disclosed, on which a computer program is stored, which, when executed by a processor, implements the steps of the method as described in any of the above embodiments.
[0029] The VNC resolution adaptive adjustment method based on OpenStack virtualization disclosed in the above embodiments can adaptively adjust the virtual machine VNC resolution based on the current browser window resolution when the VNC window size is adjusted or the browser opens VNC, thereby making the browser window resolution highly compatible with the virtual machine VNC resolution, and thus enabling the virtual machine desktop to be better aligned and displayed in the browser window; therefore, the VNC resolution adaptive adjustment method based on OpenStack virtualization of this application improves the adaptability between the browser window resolution and the virtual machine VNC resolution, thereby improving the convenience of user operation.
[0030] Additional advantages, objects, and features of the invention will be set forth in part in the description which follows, and will also become apparent in part to those skilled in the art upon studying the description, or may be learned by practice of the invention. The objects and other advantages of the invention can be realized and obtained by means of the structures specifically pointed out in the description and drawings.
[0031] Those skilled in the art will understand that the objectives and advantages achievable with the present invention are not limited to those specifically described above, and that the above and other objectives achievable with the present invention will become clearer from the following detailed description. Attached Figure Description
[0032] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, are not intended to limit the scope of the invention. The components in the drawings are not drawn to scale but are merely illustrative of the principles of the invention. For ease of illustration and description of certain parts of the invention, corresponding portions in the drawings may be enlarged, i.e., may appear larger relative to other components in an exemplary device actually manufactured according to the invention. In the drawings:
[0033] Figure 1 This is a flowchart illustrating a VNC resolution adaptive adjustment method based on OpenStack virtualization according to an embodiment of this application.
[0034] Figure 2 This is a flowchart illustrating another embodiment of the VNC resolution adaptive adjustment method based on OpenStack virtualization in this application. Detailed Implementation
[0035] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the embodiments and accompanying drawings. Here, the illustrative embodiments and descriptions of this invention are used to explain the invention, but are not intended to limit the invention.
[0036] It should also be noted that, in order to avoid obscuring the invention with unnecessary details, only the structures and / or processing steps closely related to the solution according to the invention are shown in the accompanying drawings, while other details that are not closely related to the invention are omitted.
[0037] It should be emphasized that the term "including / comprises" as used herein refers to the presence of a feature, element, step, or component, but does not exclude the presence or addition of one or more other features, elements, steps, or components.
[0038] It should also be noted that, unless otherwise specified, the term "connection" in this article can refer not only to a direct connection, but also to an indirect connection with an intermediary, and can refer not only to a wired connection, but also to a wireless connection. The specific meaning can be changed based on the actual application scenario.
[0039] Since existing VNC displays cannot adaptively adjust resolution based on the browser window size, this application provides a VNC resolution adaptive adjustment method based on OpenStack virtualization. This method dynamically adjusts the desktop resolution of the VNC virtual machine according to the browser window size when the browser window size changes, thereby facilitating user operation of VNC and convenient use of VNC functions.
[0040] In the following description, embodiments of the invention will be illustrated with reference to the accompanying drawings. In the drawings, the same reference numerals represent the same or similar parts, or the same or similar steps.
[0041] Figure 1 This is a flowchart illustrating an embodiment of the VNC resolution adaptive adjustment method based on OpenStack virtualization according to this application. Figure 1 As shown, the VNC resolution adaptive adjustment method includes at least steps S10 to S30.
[0042] Step S10: Get the current browser window resolution.
[0043] In this step, the resolution of the current browser window is first obtained so that the VNC resolution can be adaptively adjusted based on this resolution. For example, the current browser window resolution can be obtained after listening for a front-end window size change event, such as the browser opening VNC or the browser window resizing. In one embodiment, the noVNC front-end code logic can be modified to listen for front-end window size change events.
[0044] Step S20: Send the current browser window resolution to the OpenStack nova api module, which then forwards the resolution setting request to the OpenStack nova compute module.
[0045] In this step, the current browser window resolution is sent to the OpenStack nova API module. The OpenStack nova API module then determines a resolution setting request that includes the current browser window resolution and forwards the resolution setting request to the OpenStack nova compute module. This allows the OpenStack nova compute module to determine the VNC resolution based on the received resolution setting request, thereby ensuring that the determined VNC resolution is highly compatible with the browser window size.
[0046] Understandably, Nova is the core service of OpenStack, responsible for maintaining and managing the computing resources of the cloud environment. The Nova API is the portal for the entire Nova component, receiving and responding to client API calls; all requests to Nova are first processed by the Nova API. In one embodiment, a RESTful API interface for setting the VNC resolution can be added to the OpenStack Nova API module, allowing the OpenStack Nova API module to forward resolution setting requests to the OpenStack Nova Compute module based on this RESTful API interface. Nova Compute is the core service for managing virtual machines, running on compute nodes. It manages the lifecycle of instances on the node by calling the Hypervisor API. OpenStack's operations on instances are ultimately handled by Nova Compute. In one embodiment, Nova Compute is modified to find the optimal resolution from the set of resolutions supported by the virtual machine based on the resolution the user wants to set (specifically, the current browser window resolution).
[0047] Step S30: The OpenStack nova compute module obtains a set of desktop resolutions supported by the virtual machine. Based on the current browser window resolution included in the received resolution setting request, the OpenStack nova compute module determines the optimal resolution from the set of desktop resolutions as the VNC resolution.
[0048] In this step, the OpenStack nova compute module specifically determines the VNC resolution from the desktop resolution set based on the resolution setting request forwarded by the OpenStack novaapi module, and the resolution that is closest to the current browser window resolution included in the resolution setting request.
[0049] Specifically, when the OpenStack nova compute module receives a request from the OpenStack nova API module to set the VNC resolution, it retrieves the VNC resolution from the request and obtains the set of resolutions supported by the virtual machine's internal desktop. Based on the requested VNC resolution, it selects the most suitable resolution from this set (i.e., the resolution in the set that is closest to the requested resolution) as the final VNC resolution to be set. In this embodiment, the optimal resolution is the one closest to the current browser window resolution; in a more specific embodiment, the OpenStack nova compute module determines the resolution closest to the current browser window resolution from the set of desktop resolutions as the VNC resolution.
[0050] For example, the OpenStack nova compute module determines the optimal resolution as the VNC resolution from the desktop resolution set based on the current browser window resolution included in the received resolution setting request. Specifically, this may include: the OpenStack nova compute module traversing each resolution in the desktop resolution set; calculating the difference between each resolution and the current browser window resolution; and determining the optimal resolution based on each difference value.
[0051] In the above embodiments, the optimal resolution is determined based on the difference between the current browser window resolution and each resolution in the desktop resolution set. The difference value refers to the difference between two resolutions, which is used to evaluate how close the two resolutions are. For example, the smaller the difference value, the closer the two resolutions are.
[0052] For example, when calculating the difference value, the height and width of the current browser window resolution can be subtracted from the height and width of the resolution respectively to obtain the height difference and width difference; the absolute values of the height difference and width difference are determined; and the absolute values of the height difference and width difference are added together to obtain the difference value. The optimal resolution at this point is the resolution with the smallest difference value from the current browser window resolution in the desktop resolution set.
[0053] It is understood that the above embodiments illustrating the determination of the optimal resolution based on the difference between resolutions are merely preferred examples. In other embodiments, other methods can be used to determine the resolution closest to the current browser window resolution from the set of desktop resolutions. For example, the optimal resolution can also be determined based on the cosine similarity calculation method, that is, calculating the distance between each resolution in the set of desktop resolutions and the current browser window resolution, and selecting the resolution with the smallest distance to the current browser window resolution as the optimal resolution for VNC. Alternatively, a distance threshold range can be set, and the resolutions in the set of desktop resolutions whose distance to the browser window resolution falls within the threshold range can be used as the optimal resolution.
[0054] In one specific embodiment, when the OpenStack nova compute module determines the optimal resolution from the set of resolutions supported by the virtual machine, it can iterate through each resolution in the resolution set one by one, subtract the height and width of the resolution to be set by the user (specifically, the resolution of the current browser window) from the height and width of the resolution, and add the absolute values of the height difference and width difference to obtain the difference value of the resolution. Then, the resolution with the smallest difference value in the resolution set is taken as the resolution closest to the resolution of the current browser window.
[0055] In addition, the VNC resolution adaptive adjustment method based on OpenStack virtualization in this application further includes the following steps: installing the qemu-guest-agent component and the virtual machine desktop application on the virtual machine image, and adding a RESTful API interface for setting the resolution size to the OpenStack nova api module. It is understood that the installation method of the qemu-guest-agent component and the method of adding the RESTful API interface can be implemented based on existing technologies, and are not specifically limited here. In this embodiment, the OpenStack nova api module forwards the resolution setting request to the OpenStack novacompute module; specifically, the OpenStack nova api module forwards the resolution setting request to the OpenStack nova compute module based on the RESTful API interface. Furthermore, after the OpenStack nova compute module determines the optimal resolution from the set of desktop resolutions, it further calls the virtual machine desktop application via `virsh qemu-agent-command` to set the optimal resolution as the VNC resolution. For example, the virtual machine desktop application can be the xrandr application; it is understood that in this embodiment, setting the virtual machine desktop application to the xrandr application is only a preferred example, and other virtual machine desktop applications besides the xrandr application can be used in other embodiments.
[0056] In the above embodiments, the qemu-guest-agent component is installed on the virtual machine image that requires adaptive resolution adjustment. The QEMU Guest Agent component is a daemon (qemu-guest-agent.service) running inside the virtual machine, used to assist the hypervisor in managing the guest. QEMU provides a data channel between the host and the virtual machine, with the two ends of this channel being a serial port seen inside the virtual machine and a Unix socket file seen on the host. Communication between the host and the QGA within the virtual machine extends the control capabilities over the virtual machine, such as obtaining the virtual machine's IP address on the host. In this application, the main function of this basic component is to allow the hypervisor to obtain and set the virtual machine resolution outside the virtual machine via `virsh qemu-agent-command`.
[0057] To better demonstrate the advantages of the VNC resolution adaptive adjustment method based on OpenStack virtualization proposed in this application, a specific embodiment will be provided below to illustrate the method:
[0058] First, install the qemu-guest-agent component on the virtual machine image that requires adaptive resolution adjustment. The qemu-guest-agent component enables the hypervisor to obtain and set the virtual machine resolution externally via `virsh qemu-agent-command`. Next, install the xrandr program on the virtual machine image to obtain and set the virtual machine desktop resolution. Further, modify the OpenStack nova API service to add a RESTful API interface for setting the VNC resolution, which can be called by the frontend to set the virtual machine's VNC resolution. Additionally, modify the OpenStack nova compute service to add processing logic for receiving RPC requests from the OpenStack nova API module to set the VNC resolution. When novacompute receives a VNC resolution adjustment request, it retrieves the VNC resolution from the request and executes the command via `virsh qemu-agent-command`. <instance-uuid>The command `--cmd'{"execute":"guest-exec","arguments":{"path":" / usr / bin / xrandr","arg":["-d",":0.0","-q"],"capture-output":true}}` (where `instance-uuid` is the OpenStack virtual machine's UUID) retrieves the set of resolutions supported by the virtual machine's internal desktop. Based on the VNC resolution size requested in the resolution setting request, it selects the most suitable resolution from this set (i.e., the selected resolution size is closest to the requested resolution size) as the final VNC resolution to be set. After obtaining the final VNC resolution through the above steps, it uses `virshqemu-agent-command`... <instance-uuid>The command `--cmd '{"execute":"guest-exec","arguments":{"path":" / usr / bin / xrandr","arg":["-d",":0.0","--output","Virtual-1","--mode","800x600"],"capture-output":true}}'` sets the desktop resolution within the virtual machine. In this embodiment, the noVNC front-end code logic can be modified to listen for events indicating changes in the front-end window size. When the browser window size changes, the front-end logic code calls the provided RESTful API interface for setting the VNC resolution, passing the current browser window resolution to the OpenStack nova API service.
[0059] In the above embodiments, the VNC resolution adaptive adjustment method based on OpenStack virtualization obtains the current browser window resolution from the resolution setting request through the OpenStack nova compute module, obtains the set of resolutions supported by the virtual machine's internal desktop through the virsh qemu-agent-command command, and selects the resolution closest to the current browser window resolution in the resolution setting request from the set as the final VNC resolution to be set. This method ensures that the size of the set VNC resolution is highly adapted to the size of the current browser window resolution, allowing the virtual machine VNC desktop and the browser window to be aligned and displayed, thus facilitating user operation.
[0060] Figure 2 This is a flowchart illustrating another embodiment of the VNC resolution adaptive adjustment method based on OpenStack virtualization in this application, as shown below. Figure 2 As shown, the VNC resolution adaptive adjustment method specifically includes the following steps: receiving an event that triggers a window size change; the front end obtains the current browser window size and uses the current browser window resolution as a parameter to call the Nova API interface; the Nova API interface receives the front end's resolution setting API call and calls the NovaComputer service via RPC; the NovaComputer service receives the desired resolution size, obtains the set of resolutions supported by the virtual machine via the QEMU command, and obtains the optimal resolution as the final resolution based on the desired resolution; finally, the final resolution is set in the virtual machine via the QEMU command. In this embodiment, the event that triggers a window size change can be, for example, a VNC window size adjustment event or a browser opening VNC event; when the browser's VNC window size is dynamically adjusted, the VNC resolution dynamically matches the window size to achieve the best display effect; and when logging into the virtual machine VNC, the VNC resolution matches the browser window size, also achieving the best display effect. In summary, the VNC resolution adaptive adjustment method in this embodiment achieves a high degree of adaptation between the browser window resolution and the virtual machine VNC resolution.
[0061] In the above embodiment, firstly, the qemu-guest-agent program and the xrandr program are installed on the virtual machine image, and the nova API is modified to add an interface for setting the virtual machine resolution. The nova compute RPC interface is also modified to add a virtual machine resolution RPC interface to receive resolution setting RPC calls sent by the nova API. Additionally, novacompute is modified to use `virsh qemu-agent-command` to call the internal xrandr of the virtual machine to obtain the set of resolutions supported by the virtual machine. Then, nova compute is modified to find the optimal resolution from the obtained set of supported resolutions. Finally, nova compute is modified to set the virtual machine resolution using `virsh qemu-agent-command` to call the internal xrandr of the virtual machine.
[0062] In the OpenStack virtualization-based VNC resolution adaptive adjustment method disclosed in the above embodiments, the qemu-guest-agent software is installed on the virtual machine image to support external calls to commands within the virtual machine; the xrandr program is installed in the virtual machine image to obtain and set the resolution; thus, when the VNC window size is adjusted and the browser opens VNC, the resolution of the virtual machine VNC is adaptively adjusted based on the current browser window resolution, thereby making the browser window resolution highly compatible with the virtual machine VNC resolution, and thus the virtual machine desktop can be better aligned and displayed in the browser window; therefore, the OpenStack virtualization-based VNC resolution adaptive adjustment method of this application improves the adaptability between the browser window resolution and the virtual machine VNC resolution, thereby improving the convenience of user operation.
[0063] According to another aspect of the present invention, a VNC resolution adaptive adjustment system based on OpenStack virtualization is also disclosed. The system includes a processor, a memory, and a computer program stored in the memory. The processor is used to execute the computer program. When the computer program is executed, the system implements the steps of the method as described in any of the above embodiments.
[0064] This invention also provides a computer-readable storage medium and a computer program product having a computer program stored thereon, which, when executed by a processor, performs the steps of the method described in any of the above embodiments. The computer-readable storage medium may be a tangible storage medium, such as random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, floppy disk, hard disk, removable storage disk, CD-ROM, or any other form of storage medium known in the art.
[0065] Those skilled in the art will understand that the exemplary components, systems, and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software, or a combination of both. Whether implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this invention. When implemented in hardware, it can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this invention are programs or code segments used to perform the desired tasks. The programs or code segments can be stored in a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried in a carrier wave.
[0066] It should be clarified that the present invention is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of the present invention.
[0067] In this invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with or in place of features of other embodiments.
[0068] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, various modifications and variations of the embodiments of the present invention are possible. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for adaptive adjustment of VNC resolution based on OpenStack virtualization, characterized in that, The method includes: Get the current browser window resolution; The current browser window resolution is sent to the OpenStack nova API module, which then forwards the resolution setting request to the OpenStack nova compute module. The OpenStack nova compute module obtains a set of desktop resolutions supported by the virtual machine. Based on the current browser window resolution included in the received resolution setting request, the OpenStack nova compute module determines the optimal resolution from the set of desktop resolutions as the VNC resolution.
2. The VNC resolution adaptive adjustment method based on OpenStack virtualization according to claim 1, characterized in that, The optimal resolution is the resolution that is closest to the current browser window resolution.
3. The VNC resolution adaptive adjustment method based on OpenStack virtualization according to claim 2, characterized in that, The OpenStack nova compute module determines the optimal resolution as the VNC resolution from the set of desktop resolutions based on the current browser window resolution included in the received resolution setting request, including: The OpenStack nova compute module iterates through each resolution in the set of desktop resolutions; Calculate the difference between each of the aforementioned resolutions and the current browser window resolution; The optimal resolution is determined based on the aforementioned difference values.
4. The VNC resolution adaptive adjustment method based on OpenStack virtualization according to claim 3, characterized in that, Calculate the difference between each of the aforementioned resolutions and the current browser window resolution, including Subtract the height and width of the current browser window resolution from the height and width of the resolution respectively to obtain the height difference and width difference; Determine the absolute values of the height difference and the width difference; The difference value is obtained by adding the absolute values of the height difference and the width difference.
5. The VNC resolution adaptive adjustment method based on OpenStack virtualization according to claim 4, characterized in that, Determining the optimal resolution based on the aforementioned difference values includes: The resolution corresponding to the minimum difference value is taken as the optimal resolution.
6. The VNC resolution adaptive adjustment method based on OpenStack virtualization according to claim 1, characterized in that, The method further includes: Install the qemu-guest-agent component and virtual machine desktop application on the virtual machine image; add a RESTful API interface for setting the resolution size to the OpenStack nova API module; and / or, The optimal resolution is set to VNC resolution by invoking the virtual machine desktop application using the command `virsh qemu-agent-command`.
7. The VNC resolution adaptive adjustment method based on OpenStack virtualization according to claim 6, characterized in that, The OpenStack nova API module forwards the resolution setting request to the OpenStack nova compute module, including: The OpenStack nova API module forwards resolution setting requests to the OpenStack nova compute module based on the RESTful API interface.
8. The VNC resolution adaptive adjustment method based on OpenStack virtualization according to claim 6, characterized in that, The virtual machine desktop program is the xrandr program.
9. A VNC resolution adaptive adjustment system based on OpenStack virtualization, characterized in that, The system includes a processor, a memory, and a computer program stored in the memory, characterized in that the processor is used to execute the computer program, and when the computer program is executed, the system implements the steps of the method as described in any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the method as described in any one of claims 1 to 8.