A method, device, equipment and storage medium for managing USB devices in a cluster
By assigning port numbers and host IP addresses to USB devices to generate unique numbers, the system implements redirection management of USB devices within the cluster, solving the problem that USB devices can only be mounted on the host where they reside. This improves management efficiency and flexibility and is suitable for large-scale clusters.
Patent Information
- Application Number
- CN202110864390.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-29
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2041-07-29
AI Technical Summary
In an OpenStack cluster, USB devices can only be mounted to the virtual machines on the host, making them inconvenient to use and unable to be migrated. Traditional USB pass-through solutions are inefficient and cannot meet the needs of large-scale clusters.
By assigning a port number to each USB device, generating a unique number based on the host IP, and sharing it to the cluster database using the network protocol, any host can mount the USB device to the target virtual machine based on the unique number and virtual machine ID, thereby realizing the redirection management of USB devices.
This solves the problem that USB devices can only be mounted on the host where they are located, avoids virtual machine migration restrictions, improves the efficiency and flexibility of USB device management, and is suitable for large-scale cluster scenarios.
Smart Images

Figure CN113687910B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of USB device management, and in particular to a method, apparatus, device and storage medium for USB device management within a cluster. Background Art
[0002] With the increasing adoption of virtualization technology, virtual machines (VMs) are gradually replacing physical machines in various fields. As the number of VMs grows, so too are the demands placed on them. These demands include improving VM configuration and performance, as well as enabling the use of USB devices in VMs. This greatly improves convenience in many areas. For example, to copy files from a USB drive to a VM, a user needs to plug the USB drive into a USB port on the VM's host and then mount the USB drive to the VM. This allows the VM to read and write files from the USB drive. However, as OpenStack clusters grow and the number of hosts and VMs increases, VMs are distributed across multiple hosts. Mounting USB devices using traditional USB passthrough solutions becomes cumbersome. This requires constantly changing the host where the USB device resides, or preparing a large number of USB devices. Regardless of the type, this approach is cumbersome and inefficient. Furthermore, VMs with mounted USB devices cannot be migrated. Summary of the Invention
[0003] In view of this, the present invention aims to provide a method, apparatus, device, and medium for managing USB devices within a cluster, which can solve the problem that USB devices can only be mounted to virtual machines on the host computer, while also avoiding the limitation that virtual machines cannot migrate after mounting USB devices. The specific solution is as follows:
[0004] In a first aspect, the present application discloses a method for managing USB devices within a cluster, comprising:
[0005] Obtain device information of locally available USB devices and assign a port number to each of the available USB devices;
[0006] Obtaining a host IP address, and obtaining a unique number corresponding to each available USB device based on the host IP address and the port number;
[0007] The unique numbers corresponding to all the available USB devices are shared to the cluster database through the network protocol, so that any host in the cluster can mount the USB device to be mounted to the target virtual machine according to the unique number of the USB device to be mounted and the ID of the target virtual machine.
[0008] Optionally, obtaining device information of locally available USB devices includes:
[0009] A local USB device list is queried, and virtual USB devices are filtered out from the USB device list according to a target parameter field corresponding to each USB device, so as to obtain device information of the available USB devices.
[0010] Optionally, sharing the unique numbers corresponding to all the available USB devices to a cluster database via a network protocol includes:
[0011] The unique numbers and associated parameter information corresponding to all the available USB devices are uploaded to the cluster database via the transmission control protocol; wherein the parameter information includes the host name, device manufacturer identification and device product identification.
[0012] Optionally, the target virtual machine is a virtual machine created based on Libvirt, and the host mounts the USB device to be mounted to the target virtual machine according to the unique number of the USB device to be mounted and the ID of the target virtual machine, including:
[0013] Receive a mount request; the mount request includes the unique number of the USB device to be mounted and the ID of the target virtual machine;
[0014] Generate redirection configuration information based on the unique number of the USB device to be mounted and the ID of the target virtual machine;
[0015] Based on the redirection configuration information, the USB device to be mounted is mounted to the target virtual machine using the Libvirt service.
[0016] Optionally, after sharing the unique numbers corresponding to all the available USB devices to the cluster database via a network protocol, the method includes:
[0017] Uploading the association information containing the unique number corresponding to all the available USB devices in the cluster database to the cloud management platform;
[0018] Corresponding parameter information is added to each USB device through the cloud management platform; the parameter information includes device usage status and device usage permissions.
[0019] Optionally, after adding corresponding parameter information for each USB device through the cloud management platform, the method further includes:
[0020] The device usage status is monitored in real time, and the device usage permission is automatically updated according to the type of the device usage status.
[0021] Optionally, after mounting the USB device to be mounted to the target virtual machine, the method further includes:
[0022] The device usage status of the USB device to be mounted is updated through the cloud management platform, and corresponding mounting information is added; the mounting information includes attribute information of the target virtual machine.
[0023] In a second aspect, the present application discloses a USB device management device within a cluster, comprising:
[0024] The device information acquisition module is used to obtain the device information of the locally available USB devices and assign a port number to each of the available USB devices;
[0025] A unique number determination module is used to obtain a host IP address and obtain a unique number corresponding to each available USB device based on the host IP address and the port number;
[0026] The sharing module is used to share the unique numbers corresponding to all the available USB devices to the cluster database through the network protocol, so that any host in the cluster can mount the USB device to the target virtual machine according to the unique number of the USB device to be mounted and the ID of the target virtual machine.
[0027] Optionally, the device information acquisition module includes:
[0028] The filtering unit is used to query the local USB device list and filter out the virtual USB device from the USB device list according to the target parameter field corresponding to each USB device to obtain the device information of the available USB devices.
[0029] In a third aspect, the present application discloses an electronic device, comprising:
[0030] Memory, used to store computer programs;
[0031] The processor is configured to execute the computer program to implement the aforementioned method for managing USB devices within a cluster.
[0032] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned method for managing USB devices within a cluster.
[0033] In this application, the device information of locally available USB devices is obtained, and a port number is assigned to each of the available USB devices; the host IP is obtained, and the unique number corresponding to each of the available USB devices is obtained based on the host IP and the port number; the unique numbers corresponding to all the available USB devices are shared to the cluster database through the network protocol, so that any host in the cluster can mount the USB device to be mounted to the target virtual machine based on the unique number of the USB device to be mounted and the ID of the target virtual machine. It can be seen that by assigning a port number to each USB device, and then using the host IP and port number as a unique number to identify a USB device, the USB device on any host in the cluster can be shared through the network protocol based on the above unique number. In this way, the virtual machine on any host in the cluster can connect to the required USB device through the host IP and port number, realizing USB device redirection, solving the problem that USB devices can only be mounted to the virtual machine on the host in the traditional USB pass-through solution, and also avoiding the limitation that the virtual machine cannot migrate after mounting the USB device. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0035] Figure 1 A flow chart of a USB device management method within a cluster provided by this application;
[0036] Figure 2 A flowchart of a specific USB device sharing method provided in this application;
[0037] Figure 3 A flowchart of a specific USB device permissions management method provided by this application;
[0038] Figure 4 A schematic diagram of the structure of a USB device management device within a cluster provided by this application;
[0039] Figure 5 This is a structural diagram of an electronic device provided in this application. DETAILED DESCRIPTION
[0040] In the prior art, if a user wants to copy files from a USB flash drive to a virtual machine, he needs to insert the USB flash drive into the USB interface of the host where the virtual machine is located, and then mount the USB flash drive to the virtual machine. In this way, the files in the USB flash drive can be read and written in the virtual machine. However, when the openstack cluster becomes larger and the number of hosts and virtual machines increases, the virtual machines will be distributed on different hosts. At this time, it is particularly troublesome to use the traditional USB pass-through solution to mount USB devices, because it is necessary to change the host where the USB device is located or to prepare a large number of USB devices, no matter which type, to use them is relatively cumbersome and inefficient. On the other hand, the virtual machine with the USB device mounted cannot be migrated. In order to overcome the above technical problems, the present application proposes a method for managing USB devices within a cluster, which can solve the problem that USB devices can only be mounted to virtual machines on the host where they are located, and also avoids the limitation that virtual machines cannot be migrated after mounting USB devices.
[0041] The present application embodiment discloses a method for managing USB devices in a cluster, which is applied to hosts in the cluster. Figure 1 As shown, the method may include the following steps:
[0042] Step S11: obtaining device information of locally available USB devices, and assigning a port number to each of the available USB devices.
[0043] In this embodiment, the device information of the locally available USB devices is first obtained, that is, the available USB devices currently connected to the physical host, and a network port number is allocated to each available USB device.
[0044] In this embodiment, obtaining device information of locally available USB devices may include querying a local USB device list and, based on a target parameter field corresponding to each USB device, filtering out virtual USB devices from the USB device list to obtain the device information of the available USB devices. Specifically, upon startup, the computing service of each host in the cluster proactively queries the USB list on the host and filters out unavailable virtual USB devices provided by the operating system to obtain the device information of the available USB devices.
[0045] Step S12: Obtain the host IP, and obtain a unique number corresponding to each available USB device based on the host IP and the port number.
[0046] In this embodiment, by obtaining the host IP, a unique number corresponding to each available USB device is obtained based on the above host IP and port number. In this way, a USB device is uniquely identified by the host IP and network port number, instead of the traditional vendor ID and product ID. This can effectively avoid the disadvantage that when different USB devices have the same vendor ID (manufacturer ID) or product ID (product ID), the cloud platform can only identify one USB device.
[0047] Step S13: sharing the unique numbers corresponding to all available USB devices to the cluster database via the network protocol, so that any host in the cluster can mount the USB device to the target virtual machine according to the unique number of the USB device to be mounted and the ID of the target virtual machine.
[0048] In this embodiment, for example Figure 2As shown, after determining the unique number of the available USB device, a sharing service is started to share the unique number of the USB device via a network protocol. In this embodiment, sharing the unique numbers corresponding to all the available USB devices to the cluster database via the network protocol may include: uploading the unique numbers corresponding to all the available USB devices and associated parameter information to the cluster database via the Transmission Control Protocol; wherein the parameter information includes the host name, the device manufacturer ID, and the device product ID. That is, sharing the unique number corresponding to the USB device and the associated parameter information to the cluster database via the Transmission Control Protocol (TCP), wherein the parameter information includes but is not limited to the host name of the host where the USB device is located, the USB device manufacturer ID (product ID), and the USB device product ID (vendor ID). That is, the data shared to the cluster database may specifically include but is not limited to the unique number consisting of the host IP address and port number, as well as the host name, product ID, and vendor ID. Each host in the cluster can share the available USB devices on its local machine in the above manner, so that when any host in the cluster needs data in a certain USB device, it can mount the USB device to the target virtual machine based on the unique number of the required USB device to be mounted and the ID of the target virtual machine. Specifically, when a user wants to mount a USB device to a virtual machine, they can select the USB device and the target virtual machine to mount it from the USB list in the virtual machine device management interface. This not only solves the problem that USB devices can only be mounted to virtual machines on the host in traditional USB pass-through solutions, but also avoids the limitation that virtual machines cannot migrate after mounting USB devices. It is understandable that in the prior art, after a virtual machine migrates from the current host to another host, it can no longer use the USB devices on the original host, which limits the migration of the virtual machine. This embodiment is suitable for large-scale Openstack cluster scenarios. OpenStack is an open source cloud computing management platform project and a combination of a series of software open source projects.
[0049] In this embodiment, the target virtual machine is a virtual machine created based on Libvirt. The host mounts the USB device to be mounted to the target virtual machine based on the unique number of the USB device to be mounted and the ID of the target virtual machine. This process may include: receiving a mount request; the mount request includes the unique number of the USB device to be mounted and the ID of the target virtual machine; generating redirection configuration information based on the unique number of the USB device to be mounted and the ID of the target virtual machine; and using the Libvirt service to mount the USB device to be mounted to the target virtual machine based on the redirection configuration information. Specifically, the host's computing service will splice the redirdev device's xml file, i.e., the configuration file, based on the virtual machine ID selected by the user and the host IP and port number corresponding to the USB device, and send the request to libvirt. After receiving the request, Libvirt will mount the USB device to be mounted to the target virtual machine.
[0050] In this embodiment, after the unique numbers corresponding to all the available USB devices are shared to the cluster database through the network protocol, it can include: uploading the associated information containing the unique numbers corresponding to all the available USB devices in the cluster database to the cloud management platform; adding corresponding parameter information for each of the USB devices through the cloud management platform; the parameter information includes device usage status and device usage permissions.
[0051] It is understandable that all USB devices in the cluster can be managed through the cloud management platform. By setting usage permissions for USB devices, the security of device sharing can be improved, such as setting which virtual machines can use USB devices. Specifically, the host's API (Application Programming Interface) service can be used to query the database to obtain a list of all available USB devices in the cluster and USB-related information, including a unique number consisting of the host IP and port number, as well as the host name, product ID, vendor ID, etc., and upload them to the cloud platform management interface. The interface will uniformly display the list of available USB devices in the cluster and manage the device usage status and device usage permissions. For example Figure 3 As shown, the administrator logs in to the virtual machine management platform, selects the cloud host in the cloud management platform list, selects Mount USB Device in the cloud host operation list, selects the corresponding host, selects the USB device to be mounted in the host USB list, and sets permissions to implement shared control. As a result, the USB device to be mounted is in a usable state.
[0052] In this embodiment, after mounting the USB device to be mounted to the target virtual machine, the method may further include: updating the device usage status of the USB device to be mounted via the cloud management platform and adding corresponding mounting information; the mounting information includes attribute information of the target virtual machine. Specifically, the status of the USB device to be mounted is set to the usage status, and relevant mounting information is added for the USB device to be mounted. The mounting information includes, but is not limited to, attribute information of the target virtual machine corresponding to the USB device to be mounted, such as the virtual machine ID and memory, thereby displaying information about the virtual machine associated with the USB device.
[0053] In this embodiment, after adding corresponding parameter information for each USB device via the cloud management platform, the method may further include: monitoring the device usage status in real time, and automatically updating the device usage permission based on the type of the device usage status. Specifically, when the device usage status is detected as the aforementioned usage status, the device usage permission of the corresponding device is automatically updated to be unavailable, thereby avoiding anomalies caused by excessive device connections.
[0054] As can be seen from the above, in this embodiment, a port number is assigned to each USB device, and then the host IP and port number are used as a unique number to identify a USB device. Further, based on the above unique number, the USB device on any host in the cluster can be shared through the network protocol. In this way, the virtual machine on any host in the cluster can connect to the required USB device through the host IP and port number, realizing USB device redirection and unified management of all USB devices in the cluster. The use of the virtual machine is no longer limited to using only the USB devices of the host. At the same time, it also avoids the limitation that the virtual machine cannot migrate after mounting the USB device, greatly improving work efficiency.
[0055] Correspondingly, the present application also discloses a USB device management device within a cluster, see Figure 4 As shown, the device includes:
[0056] The device information acquisition module 11 is used to acquire the device information of the locally available USB devices and assign a port number to each of the available USB devices;
[0057] A unique number determination module 12 is configured to obtain a host IP address and obtain a unique number corresponding to each available USB device based on the host IP address and the port number;
[0058] The sharing module 13 is used to share the unique numbers corresponding to all the available USB devices to the cluster database through the network protocol, so that any host in the cluster can mount the USB device to the target virtual machine according to the unique number of the USB device to be mounted and the ID of the target virtual machine.
[0059] As can be seen from the above, in this embodiment, the device information of locally available USB devices is obtained, and a port number is assigned to each of the available USB devices; the host IP is obtained, and the unique number corresponding to each of the available USB devices is obtained based on the host IP and the port number; the unique numbers corresponding to all the available USB devices are shared to the cluster database via the network protocol, so that any host in the cluster can mount the USB device to be mounted to the target virtual machine based on the unique number of the USB device to be mounted and the ID of the target virtual machine. It can be seen that by assigning a port number to each USB device, and then using the host IP and port number as a unique number to identify a USB device, the USB device on any host in the cluster can be shared through the network protocol based on the above unique number. In this way, any virtual machine on any host in the cluster can connect to the required USB device through the host IP and port number, realizing USB device redirection, solving the problem that USB devices can only be mounted to virtual machines on the host in the traditional USB pass-through solution, and also avoiding the limitation that virtual machines cannot migrate after mounting USB devices.
[0060] In some specific embodiments, the device information acquisition module may specifically include:
[0061] The filtering unit is used to query the local USB device list and filter out the virtual USB device from the USB device list according to the target parameter field corresponding to each USB device to obtain the device information of the available USB devices.
[0062] In some specific embodiments, the sharing module 13 may specifically include:
[0063] The information uploading unit is used to upload the unique numbers and associated parameter information corresponding to all the available USB devices to the cluster database through the transmission control protocol; wherein the parameter information includes the host name, device manufacturer identification and device product identification.
[0064] In some specific embodiments, the intra-cluster USB device management apparatus may specifically include:
[0065] A mount request receiving unit, configured to receive a mount request; the mount request includes a unique number of the USB device to be mounted and an ID of the target virtual machine;
[0066] A redirection configuration information generating unit, configured to generate redirection configuration information based on the unique number of the USB device to be mounted and the ID of the target virtual machine;
[0067] The mounting unit is configured to mount the USB device to be mounted to the target virtual machine using the Libvirt service based on the redirection configuration information.
[0068] In some specific embodiments, the intra-cluster USB device management apparatus may specifically include:
[0069] An information uploading unit, configured to upload the associated information including the unique number corresponding to all the available USB devices in the cluster database to a cloud management platform;
[0070] The permission configuration unit is used to add corresponding parameter information for each USB device through the cloud management platform; the parameter information includes device usage status and device usage permissions.
[0071] In some specific embodiments, the intra-cluster USB device management apparatus may specifically include:
[0072] The status monitoring unit is used to monitor the device usage status in real time and automatically update the device usage permission according to the type of the device usage status.
[0073] In some specific embodiments, the intra-cluster USB device management apparatus may specifically include:
[0074] A status update unit is used to update the device usage status of the USB device to be mounted through the cloud management platform and add corresponding mounting information; the mounting information includes attribute information of the target virtual machine.
[0075] Furthermore, the present application also discloses an electronic device, see Figure 5 The contents in the drawings should not be considered as any limitation on the scope of use of the present application.
[0076] Figure 5 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps of the intra-cluster USB device management method disclosed in any of the aforementioned embodiments.
[0077] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0078] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon include an operating system 221, a computer program 222 and data 223 including device information, etc. The storage method can be temporary storage or permanent storage.
[0079] The operating system 221 is used to manage and control the hardware devices on the electronic device 20 and the computer program 222, so as to enable the processor 21 to calculate and process the massive data 223 in the memory 22. The operating system 221 can be Windows Server, NetWare, Unix, Linux, etc. In addition to including computer programs capable of implementing the intra-cluster USB device management method executed by the electronic device 20 as disclosed in any of the aforementioned embodiments, the computer program 222 can further include computer programs capable of performing other specific tasks.
[0080] Furthermore, an embodiment of the present application also discloses a computer storage medium, in which computer executable instructions are stored. When the computer executable instructions are loaded and executed by a processor, the steps of the method for managing USB devices in a cluster disclosed in any of the aforementioned embodiments are implemented.
[0081] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.
[0082] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0083] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0084] The above is a detailed introduction to the method, apparatus, equipment and medium for managing USB devices in a cluster provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas. At the same time, for those skilled in the art, according to the ideas of the present invention, there may be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for managing USB devices within a cluster, characterized in that: Applies to hosts in the cluster, including: Obtain device information of locally available USB devices and assign a port number to each of the available USB devices; Obtaining a host IP address, and obtaining a unique number corresponding to each available USB device based on the host IP address and the port number; Sharing the unique numbers corresponding to all the available USB devices to a cluster database through a network protocol, so that any host in the cluster can mount the USB device to the target virtual machine based on the unique number of the USB device to be mounted and the ID of the target virtual machine; The step of sharing the unique numbers corresponding to all the available USB devices to the cluster database via the network protocol includes: Uploading the association information containing the unique number corresponding to all the available USB devices in the cluster database to the cloud management platform; Add corresponding parameter information for each USB device through the cloud management platform; the parameter information includes device usage status and device usage rights; the device usage rights are usage rights for virtual machines; the device usage rights include information about virtual machines that are allowed to use the USB device; The host mounts the USB device to be mounted to the target virtual machine according to the unique number of the USB device to be mounted and the ID of the target virtual machine, including: The host selects the USB device to be mounted and the target virtual machine through the USB list in the virtual machine device management interface; The step of obtaining device information of locally available USB devices includes: Querying a local USB device list, filtering out virtual USB devices from the USB device list according to a target parameter field corresponding to each USB device, to obtain device information of the available USB devices; The step of sharing the unique numbers corresponding to all available USB devices to a cluster database via a network protocol includes: Uploading the unique numbers and associated parameter information corresponding to all available USB devices to the cluster database via the transmission control protocol; wherein the parameter information includes the host name, device manufacturer identifier, and device product identifier; The target virtual machine is a virtual machine created based on Libvirt, and the host mounts the USB device to be mounted to the target virtual machine according to the unique number of the USB device to be mounted and the ID of the target virtual machine, including: Receive a mount request; the mount request includes the unique number of the USB device to be mounted and the ID of the target virtual machine; Generate redirection configuration information based on the unique number of the USB device to be mounted and the ID of the target virtual machine; Mounting the USB device to be mounted to the target virtual machine using the Libvirt service based on the redirection configuration information; Wherein, after adding corresponding parameter information for each USB device through the cloud management platform, the method further includes: The device usage status is monitored in real time, and the device usage permission is automatically updated according to the type of the device usage status.
2. The method for managing USB devices in a cluster according to claim 1, wherein: After mounting the USB device to be mounted to the target virtual machine, the method further includes: The device usage status of the USB device to be mounted is updated through the cloud management platform, and corresponding mounting information is added; the mounting information includes attribute information of the target virtual machine.
3. A USB device management device within a cluster, characterized in that: include: The device information acquisition module is used to obtain the device information of the locally available USB devices and assign a port number to each of the available USB devices; A unique number determination module is used to obtain a host IP address and obtain a unique number corresponding to each available USB device based on the host IP address and the port number; a sharing module, configured to share the unique numbers corresponding to all the available USB devices to a cluster database via a network protocol, so that any host in the cluster can mount the USB device to the target virtual machine based on the unique number of the USB device to be mounted and the ID of the target virtual machine; The USB device management device in the cluster is further configured to upload the associated information including the unique numbers corresponding to all the available USB devices in the cluster database to the cloud management platform after sharing the unique numbers corresponding to all the available USB devices in the cluster database via the network protocol; and to add corresponding parameter information for each of the USB devices via the cloud management platform; the parameter information includes the device usage status and device usage rights; and the device usage rights are usage rights for the virtual machine; The USB device management device in the cluster is further used for the host to select the USB device to be mounted and the target virtual machine through the USB list in the virtual machine device management interface; The device information acquisition module is used to query the local USB device list and filter out virtual USB devices from the USB device list according to the target parameter field corresponding to each USB device to obtain the device information of the available USB devices; The sharing module is used to upload the unique numbers and associated parameter information corresponding to all available USB devices to the cluster database via the transmission control protocol; wherein the parameter information includes the host name, device manufacturer identifier and device product identifier; The shared module is configured to receive a mount request; the mount request includes the unique number of the USB device to be mounted and the ID of the target virtual machine; generate redirection configuration information based on the unique number of the USB device to be mounted and the ID of the target virtual machine; and mount the USB device to be mounted to the target virtual machine using the Libvirt service based on the redirection configuration information; The USB device management device in the cluster is also used to monitor the device usage status in real time after adding corresponding parameter information for each USB device through the cloud management platform, and automatically update the device usage permission according to the type of the device usage status.
4. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor is configured to execute the computer program to implement the method for managing USB devices within a cluster as claimed in claim 1 or 2.
5. A computer-readable storage medium, characterized in that Used to store computer programs; wherein when the computer program is executed by the processor, the method for managing USB devices in a cluster as claimed in claim 1 or 2 is implemented.
Citation Information
Patent Citations
A method and apparatus for accessing a shared USB device
CN109144752A