CN113687910B - Method, device, equipment and storage medium for managing USB equipment in cluster - Google Patents

Method, device, equipment and storage medium for managing USB equipment in cluster

Info

Publication number
CN113687910B
CN113687910B CN202110864390.7A CN202110864390A CN113687910B CN 113687910 B CN113687910 B CN 113687910B CN 202110864390 A CN202110864390 A CN 202110864390A CN 113687910 B CN113687910 B CN 113687910B
Authority
CN
China
Prior art keywords
usb
virtual machine
cluster
host
available
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110864390.7A
Other languages
Chinese (zh)
Other versions
CN113687910A (en
Inventor
亢宇飞
马豹
郭敬宇
苏广峰
张百林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Inspur Smart Computing Technology Co Ltd
Original Assignee
Guangdong Inspur Smart Computing Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Inspur Smart Computing Technology Co Ltd filed Critical Guangdong Inspur Smart Computing Technology Co Ltd
Priority to CN202110864390.7A priority Critical patent/CN113687910B/en
Publication of CN113687910A publication Critical patent/CN113687910A/en
Application granted granted Critical
Publication of CN113687910B publication Critical patent/CN113687910B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45587Isolation or security of virtual machine instances

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

本申请公开了一种集群内USB设备管理方法、装置、设备及存储介质。该方法包括:获取本地可用USB设备的设备信息,并为每个所述可用USB设备分配一个端口号;获取主机IP,基于所述主机IP和所述端口号得到每个所述可用USB设备对应的唯一编号;将所有所述可用USB设备对应的唯一编号通过网络协议共享至集群数据库,以便所述集群内的任意一个主机根据待挂载USB设备的唯一编号以及目标虚拟机的ID,将所述待挂载USB设备挂载至所述目标虚拟机。解决了传统USB直通方案中USB设备只能挂载到所在主机上的虚拟机的问题,同时也避免了虚拟机挂载USB设备后不能迁移的限制。

This application discloses a method, apparatus, device, and storage medium for managing USB devices within a cluster. The method includes: obtaining device information for locally available USB devices and assigning a port number to each available USB device; obtaining the host IP address and, based on the host IP address and the port number, obtaining a unique number corresponding to each available USB device; and sharing the unique numbers corresponding to all available USB devices to a cluster database via a network protocol, so that any host within the cluster can mount the USB device to a target virtual machine based on the unique number of the USB device to be mounted and the ID of the target virtual machine. This method solves the problem in traditional USB passthrough solutions where USB devices can only be mounted to virtual machines on the host, while also avoiding the limitation that virtual machines cannot migrate after mounting USB devices.

Description

Method, device, equipment and storage medium for managing USB equipment in cluster
Technical Field
The present invention relates to the field of USB device management, and in particular, to a method, an apparatus, a device, and a storage medium for managing USB devices in a cluster.
Background
At present, as virtualization technology is more and more widely applied, in various fields, a virtual machine gradually replaces a physical machine to run some services, and when the running services on the virtual machine are more and more, requirements of people on the virtual machine are higher and higher, on one hand, configuration, performance and the like of the virtual machine are included, on the other hand, people hope to mount some USB mobile devices on the virtual machine for use, so that the virtual machine is very convenient in many aspects. For example, if a user wants to copy a file in the USB disk to the virtual machine, the user needs to plug the USB disk into a USB interface of a host where the virtual machine is located, and then mount the USB disk to the virtual machine, so that the file in the USB disk can be read and written in the virtual machine. However, when the openstack cluster is large, the number of hosts and virtual machines increases, the virtual machines are distributed on different hosts, and this time, it is very troublesome to mount USB devices by using the conventional USB through scheme, because the hosts where the USB devices are located need to be changed back and forth or a large number of USB devices are prepared, and the virtual machines on which the USB devices are mounted cannot be migrated, which is complicated to use and has low efficiency.
Disclosure of Invention
Therefore, the present invention aims to provide a method, an apparatus, a device, and a medium for managing USB devices in a cluster, which can solve the problem that USB devices can only be mounted on a virtual machine on a host, and avoid the limitation that the virtual machine cannot migrate after the USB devices are mounted. The specific scheme is as follows:
In a first aspect, the present application discloses a method for managing USB devices in a cluster, including:
Acquiring equipment information of local available USB equipment, and distributing a port number for each available USB equipment;
acquiring a host IP, and obtaining a unique number corresponding to each available USB device based on the host IP and the port number;
And 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 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.
Optionally, the obtaining device information of the locally available USB device includes:
Inquiring a local USB device list, and filtering 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.
Optionally, the sharing the unique numbers corresponding to all the available USB devices to the cluster database through a network protocol includes:
and uploading the unique numbers corresponding to all the available USB devices and associated parameter information to the cluster database through a transmission control protocol, wherein the parameter information comprises a host name, a device manufacturer identifier and a device product identifier.
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:
the method comprises the steps of receiving a mounting request, wherein the mounting request comprises a unique number of the USB equipment to be mounted and an 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 based on the redirection configuration information, utilizing Libvirt services to mount the USB equipment to be mounted to the target virtual machine.
Optionally, after sharing the unique numbers corresponding to all the available USB devices to the cluster database through a network protocol, the method includes:
uploading the associated information containing the unique number corresponding to all the available USB devices in the cluster database to a cloud management platform;
and adding corresponding parameter information for each USB device through the cloud management platform, wherein the parameter information comprises a device use state and a device use authority.
Optionally, after adding corresponding parameter information to each USB device through the cloud management platform, the method further includes:
and monitoring the use state of the equipment in real time, and automatically updating the use permission of the equipment according to the type of the use state of the equipment.
Optionally, after the USB device to be mounted is mounted to the target virtual machine, the method further includes:
and updating the equipment use state of the USB equipment to be mounted through the cloud management platform, and adding corresponding mounting information, wherein the mounting information comprises attribute information of the target virtual machine.
In a second aspect, the present application discloses a device for managing USB devices in a cluster, including:
the device information acquisition module is used for acquiring device information of local available USB devices and distributing a port number for each available USB device;
the unique number determining module is used for acquiring a host IP and obtaining a unique number corresponding to each available USB device based on the host IP and the port number;
And the sharing module is used for 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 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.
Optionally, the device information obtaining module includes:
And the filtering unit is used for inquiring the local USB device list, and filtering virtual USB devices from the USB device list according to the target parameter field corresponding to each USB device so as to obtain the device information of the available USB devices.
In a third aspect, the present application discloses an electronic device, comprising:
A memory for storing a computer program;
and the processor is used for executing the computer program to realize the method for managing the USB devices in the cluster.
In a fourth aspect, the present application discloses a computer readable storage medium for storing a computer program, where the computer program when executed by a processor implements the foregoing method for managing USB devices in a cluster.
The method comprises the steps of obtaining equipment information of local available USB equipment, distributing a port number for each available USB equipment, obtaining a host IP, obtaining a unique number corresponding to each available USB equipment based on the host IP and the port number, sharing the unique numbers corresponding to all the available USB equipment to a cluster database through a network protocol, so that any host in the cluster can mount the USB equipment to be mounted to a target virtual machine according to the unique number of the USB equipment to be mounted and the ID of the target virtual machine. Therefore, by allocating port numbers to each USB device and then using the host IP and the port numbers as unique numbers to identify one USB device, USB devices on any host in the cluster can be further shared out through a network protocol according to the unique numbers, virtual machines on any host in the cluster can be connected with required USB devices through the host IP and the port numbers, redirection of the USB devices is realized, the problem that the USB devices can only be mounted on the virtual machine on the host in the traditional USB direct scheme is solved, and meanwhile, the limitation that the virtual machines cannot migrate after the USB devices are mounted is avoided.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a method for managing USB devices in a cluster according to the present application;
FIG. 2 is a flowchart of a specific sharing method of USB devices according to the present application;
FIG. 3 is a flowchart of a specific USB device rights management method according to the present application;
FIG. 4 is a schematic diagram of a device for managing USB devices in a cluster according to the present application;
Fig. 5 is a block diagram of an electronic device according to the present application.
Detailed Description
In the prior art, if a user wants to copy files in a USB flash disk to a virtual machine, the user needs to plug the USB flash disk into a USB interface of a host where the virtual machine is located, and then mounts the USB flash disk to the virtual machine, so that the files in the USB flash disk can be read and written in the virtual machine. However, when the openstack cluster is large, the number of hosts and virtual machines increases, the virtual machines are distributed on different hosts, and this time, it is very troublesome to mount USB devices by using the conventional USB through scheme, because the hosts where the USB devices are located need to be changed back and forth or a large number of USB devices are prepared, and the virtual machines on which the USB devices are mounted cannot be migrated, which is complicated to use and has low efficiency. In order to overcome the technical problems, the application provides a management method of USB devices in a cluster, which can solve the problem that the USB devices can only be mounted on a virtual machine on a host machine, and simultaneously avoid the limitation that the virtual machine cannot migrate after the USB devices are mounted.
The embodiment of the application discloses a method for managing USB equipment in a cluster, which is applied to a host in the cluster, and can comprise the following steps as shown in FIG. 1:
Step S11, obtaining equipment information of local available USB equipment, and distributing a port number for each available USB equipment.
In this embodiment, first, device information of locally available USB devices, that is, available USB devices connected to a current physical host, is acquired, and a network port number is allocated to each available USB device.
In this embodiment, the obtaining the device information of the locally available USB device may include querying a local USB device list, and filtering virtual USB devices from the USB device list according to a target parameter field corresponding to each USB device to obtain the device information of the available USB device. That is, the computing service of each host in the cluster actively queries the USB list on the host at the time of starting, and filters out some unavailable virtual USB devices carried by the operating system, so as to obtain the device information of the available USB devices.
And step S12, acquiring a host IP, and obtaining a unique number corresponding to each available USB device based on the host IP and the port number.
In this embodiment, by obtaining the host IP and obtaining the unique number corresponding to each available USB device based on the host IP and the port number, therefore, one USB device is uniquely identified by the host IP and the network port number, and no longer is the conventional vendor ID and productor ID, which can effectively avoid the disadvantage that the cloud platform can only identify one USB device when different USB devices have the same vendor ID (manufacturer identification) or product ID (product identification).
And S13, 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 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.
In this embodiment, for example, as shown in fig. 2, after determining the unique numbers of the available USB devices, the sharing service is started to share the unique numbers of the USB devices through the network protocol. In this embodiment, sharing the unique numbers corresponding to all the available USB devices to the cluster database through the network protocol may include uploading the unique numbers corresponding to all the available USB devices and associated parameter information to the cluster database through a transmission control protocol, where the parameter information includes a host name, a device manufacturer identifier, and a device product identifier. The unique number corresponding to the USB device and the associated parameter information are shared to the cluster database through a transmission control protocol (TCP, transmission Control Protocol) protocol, wherein the parameter information includes, but is not limited to, a host name of a host where the USB device is located, a manufacturer identifier (product ID) of the USB device, and a product identifier (vendor ID) of the USB device, and the data shared to the cluster database may include, but is not limited to, the unique number composed of the host IP and the port number, and the host name, the product ID, and the vendor ID. Each host in the cluster can share the available USB equipment of the host in the mode, so that when any host in the cluster needs data in a certain USB equipment, the USB equipment to be mounted is mounted to the target virtual machine according to the required unique number of the USB equipment to be mounted and the ID of the target virtual machine. Specifically, when the user wants to mount the USB device to be mounted on the virtual machine, the user may select the USB device and the target virtual machine to be mounted from the USB list of the virtual machine device management interface. Therefore, the problem that the USB equipment can only be mounted on the virtual machine on the host computer in the traditional USB through scheme is solved, and meanwhile, the limitation that the virtual machine cannot be migrated after the USB equipment is mounted is avoided. The embodiment is suitable for an OpenStack large-scale cluster scene, wherein OpenStack is an open-source cloud computing management platform project and is a combination of a series of software open-source projects.
In this embodiment, 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, which may include receiving a mounting request, where the mounting 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 mounting the USB device to be mounted to the target virtual machine by using Libvirt service based on the redirection configuration information. Specifically, the computing service of the host may splice redirdev xml files of the device, that is, configuration files, according to 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, libvirt, and mount the USB device to be mounted to the target virtual machine after receiving the request.
In this embodiment, after sharing unique numbers corresponding to all the available USB devices to a cluster database through a network protocol, uploading associated information corresponding to all the available USB devices and including the unique numbers to a cloud management platform, and adding corresponding parameter information to each USB device through the cloud management platform, where the parameter information includes a device use state and a device use permission.
It can be appreciated that all USB devices in the cluster can be managed by the cloud management platform, and bong can improve the security of device sharing by setting the use authority for the USB devices, such as setting that the USB devices can be used by those virtual machines. Specifically, the database can be queried through Api (Application Programming Interface, application program interface) service of the host to obtain all available USB device lists and USB related information in the cluster, including unique numbers composed of host IP and port numbers, host names, product IDs, vendor IDs, etc., and the unique numbers are uploaded to the cloud platform management interface, and the interface uniformly displays the available USB device lists in the cluster, and manages the device use states and device use rights. For example, as shown in fig. 3, an administrator logs in a virtual machine management platform, selects a cloud host from a cloud management platform list, selects a USB device to be mounted from a cloud host operation list, selects a corresponding host, selects a USB device to be mounted from a host USB list, and sets permission to implement sharing control, so that the USB device to be mounted is in a usable state.
In this embodiment, after the USB device to be mounted is mounted to the target virtual machine, updating, by the cloud management platform, a device usage state of the USB device to be mounted, and adding corresponding mounting information, where the mounting information includes attribute information of the target virtual machine. The state of the USB device to be mounted is set to be a use state, and relevant mounting information is added to the USB device to be mounted, wherein the mounting information comprises, but is not limited to, attribute information of a target virtual machine corresponding to the USB device to be mounted, such as a virtual machine ID, a memory and the like, so that information of the virtual machine associated with the USB device can be displayed.
In this embodiment, after adding the corresponding parameter information to each USB device through the cloud management platform, the method may further include monitoring the device usage status in real time, and automatically updating the device usage rights according to the type of the device usage status. When the use state of the equipment is monitored to be the use state, the equipment use permission of the corresponding equipment is automatically updated to be unusable, so that the abnormality caused by excessive equipment connection is avoided.
Therefore, in this embodiment, by allocating a port number to each USB device, and then using the host IP and the port number as the unique numbers to identify one USB device, further sharing the USB device on any host in the cluster according to the unique numbers through the network protocol, so that the virtual machine on any host in the cluster can connect the required USB device through the host IP and the port number, thereby implementing redirection of the USB device, uniformly managing all USB devices in the cluster, and avoiding the limitation that the virtual machine cannot migrate after mounting the USB device.
Correspondingly, the embodiment of the application also discloses a device for managing the USB equipment in the cluster, which is shown in fig. 4, and comprises the following steps:
the device information acquisition module 11 is configured to acquire device information of locally available USB devices, and allocate a port number to each of the available USB devices;
a unique number determining module 12, configured to obtain a host IP, and obtain a unique number corresponding to each of the available USB devices based on the host IP and the port number;
And the sharing module 13 is configured to share 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 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.
From the above, in this embodiment, by acquiring device information of local available USB devices and allocating a port number to each of the available USB devices, acquiring a host IP, obtaining a unique number corresponding to each of the available USB devices based on the host IP 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 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. Therefore, by allocating port numbers to each USB device and then using the host IP and the port numbers as unique numbers to identify one USB device, USB devices on any host in the cluster can be further shared out through a network protocol according to the unique numbers, virtual machines on any host in the cluster can be connected with required USB devices through the host IP and the port numbers, redirection of the USB devices is realized, the problem that the USB devices can only be mounted on the virtual machine on the host in the traditional USB direct scheme is solved, and meanwhile, the limitation that the virtual machines cannot migrate after the USB devices are mounted is avoided.
In some specific embodiments, the device information obtaining module may specifically include:
And the filtering unit is used for inquiring the local USB device list, and filtering virtual USB devices from the USB device list according to the target parameter field corresponding to each USB device so as to obtain the device information of the available USB devices.
In some specific embodiments, the sharing module 13 may specifically include:
And the information uploading unit is used for uploading the unique numbers corresponding to all the available USB devices and the associated parameter information to the cluster database through a transmission control protocol, wherein the parameter information comprises a host name, a device manufacturer identifier and a device product identifier.
In some embodiments, the USB device management apparatus within a cluster may specifically include:
the mounting request receiving unit is used for receiving a mounting request, wherein the mounting request comprises a unique number of the USB equipment to be mounted and an ID of the target virtual machine;
The redirection configuration information generation unit is used for generating redirection configuration information based on the unique number of the USB equipment to be mounted and the ID of the target virtual machine;
And the mounting unit is used for mounting the USB equipment to be mounted to the target virtual machine by utilizing Libvirt services based on the redirection configuration information.
In some embodiments, the USB device management apparatus within a cluster may specifically include:
The information uploading unit is used for uploading the associated information which contains the unique number and corresponds to all the available USB devices in the cluster database to a cloud management platform;
and the permission configuration unit is used for adding corresponding parameter information for each USB device through the cloud management platform, wherein the parameter information comprises a device use state and a device use permission.
In some embodiments, the USB device management apparatus within a cluster may specifically include:
The state monitoring unit is used for monitoring the use state of the equipment in real time and automatically updating the use permission of the equipment according to the type of the use state of the equipment.
In some embodiments, the USB device management apparatus within a cluster may specifically include:
The state updating unit is used for updating the equipment use state of the USB equipment to be mounted through the cloud management platform and adding corresponding mounting information, wherein the mounting information comprises attribute information of the target virtual machine.
Further, the embodiment of the application also discloses an electronic device, and referring to fig. 5, the content in the drawing should not be considered as any limitation on the application scope of the application.
Fig. 5 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present application. The electronic device 20 may include, in particular, 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 configured to store a computer program, where the computer program is loaded and executed by the processor 21 to implement relevant steps in the method for managing USB devices in a cluster disclosed in any of the foregoing embodiments.
In this embodiment, the power supply 23 is configured to provide working voltages for each hardware device on the electronic device 20, the communication interface 24 is capable of creating a data transmission channel with an external device for the electronic device 20, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein, and the input/output interface 25 is configured to obtain external input data or output data to the external device, and the specific interface type of the input/output interface may be selected according to the specific application needs and is not specifically limited herein.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon include an operating system 221, a computer program 222, and data 223 including device information, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and the computer program 222, so as to implement the operation and processing of the processor 21 on the mass data 223 in the memory 22, which may be Windows Server, netware, unix, linux, etc. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the method of managing USB devices within a cluster performed by the electronic device 20 as disclosed in any of the previous embodiments.
Further, the embodiment of the application also discloses a computer storage medium, wherein the computer storage medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by a processor, the method steps of managing the USB devices in the cluster disclosed in any embodiment are realized.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
The foregoing describes the method, apparatus, device and medium for managing USB devices in a cluster in detail, and specific examples are provided herein to illustrate the principles and embodiments of the present invention, and the above description of the embodiments is only for aiding in understanding of the method and core concept of the present invention, and meanwhile, to those skilled in the art, according to the concept of the present invention, there are variations in the specific embodiments and application ranges, so the disclosure should not be construed as limiting the invention.

Claims (5)

1. The method for managing the USB devices in the cluster is characterized by being applied to a host in the cluster and comprising the following steps of:
Acquiring equipment information of local available USB equipment, and distributing a port number for each available USB equipment;
acquiring a host IP, and obtaining a unique number corresponding to each available USB device based on the host IP and the port number;
sharing unique numbers corresponding to all the available USB devices to a cluster database through a network protocol, so that any host in the cluster mounts the USB device to be mounted to a target virtual machine according to the unique number of the USB device to be mounted and the ID of the target virtual machine;
After sharing the unique numbers corresponding to all the available USB devices to the cluster database through the network protocol, the method includes:
uploading the associated information containing the unique number corresponding to all the available USB devices in the cluster database to a cloud management platform;
Adding corresponding parameter information for each USB device through the cloud management platform, wherein the parameter information comprises a device use state and a device use authority, and the device use authority is a use authority for a virtual machine;
The host computer 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, and the method comprises the following steps:
the host selects a USB device to be mounted and a target virtual machine from a USB list of a virtual machine device management interface;
The obtaining the device information of the locally available USB device includes:
Inquiring a local USB device list, and filtering 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 sharing the unique numbers corresponding to all the available USB devices to the cluster database through the network protocol includes:
uploading the unique numbers corresponding to all the available USB devices and associated parameter information to the cluster database through a transmission control protocol, wherein the parameter information comprises a host name, a device manufacturer identifier and a 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:
the method comprises the steps of receiving a mounting request, wherein the mounting request comprises a unique number of the USB equipment to be mounted and an 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;
based on the redirection configuration information, utilizing Libvirt services to mount the USB equipment to be mounted to the target virtual machine;
after the cloud management platform adds the corresponding parameter information for each USB device, the method further includes:
and monitoring the use state of the equipment in real time, and automatically updating the use permission of the equipment according to the type of the use state of the equipment.
2. The method for managing USB devices in a cluster according to claim 1, further comprising, after the USB device to be mounted is mounted to the target virtual machine:
and updating the equipment use state of the USB equipment to be mounted through the cloud management platform, and adding corresponding mounting information, wherein the mounting information comprises attribute information of the target virtual machine.
3. An apparatus for managing USB devices in a cluster, comprising:
the device information acquisition module is used for acquiring device information of local available USB devices and distributing a port number for each available USB device;
the unique number determining module is used for acquiring a host IP and obtaining a unique number corresponding to each available USB device based on the host IP and the port number;
The sharing module is used for 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 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;
the device comprises a cluster database, a cloud management platform, a device management device, a virtual machine and a virtual machine, wherein the USB device management device in the cluster is also used for uploading associated information which contains the unique numbers and corresponds to all the available USB devices to the cloud management platform after sharing the unique numbers corresponding to all the available USB devices to the cluster database through a network protocol;
the device management device in the cluster is further used for selecting a USB device to be mounted and a target virtual machine from a USB list of a virtual machine device management interface by the host;
The device information acquisition module is used for inquiring a local USB device list, and filtering virtual USB devices from the USB device list according to the target parameter field corresponding to each USB device so as to obtain the device information of the available USB devices;
The sharing module is used for uploading the unique numbers corresponding to all the available USB devices and associated parameter information to the cluster database through a transmission control protocol, wherein the parameter information comprises a host name, a device manufacturer identifier and a device product identifier;
The sharing module is used for receiving a mounting request, wherein the mounting request comprises the unique number of the USB equipment to be mounted and the ID of the target virtual machine, and generating redirection configuration information based on the unique number of the USB equipment to be mounted and the ID of the target virtual machine;
The device management device in the cluster is further configured to monitor the device usage status in real time after adding corresponding parameter information to each USB device through the cloud management platform, and automatically update the device usage rights according to the type of the device usage status.
4. An electronic device, comprising:
A memory for storing a computer program;
a processor for executing the computer program to implement the method for managing USB devices within a cluster according to claim 1 or 2.
5. A computer readable storage medium for storing a computer program, wherein the computer program when executed by a processor implements the method for managing USB devices within a cluster according to claim 1 or 2.
CN202110864390.7A 2021-07-29 2021-07-29 Method, device, equipment and storage medium for managing USB equipment in cluster Active CN113687910B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110864390.7A CN113687910B (en) 2021-07-29 2021-07-29 Method, device, equipment and storage medium for managing USB equipment in cluster

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110864390.7A CN113687910B (en) 2021-07-29 2021-07-29 Method, device, equipment and storage medium for managing USB equipment in cluster

Publications (2)

Publication Number Publication Date
CN113687910A CN113687910A (en) 2021-11-23
CN113687910B true CN113687910B (en) 2025-09-19

Family

ID=78578223

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110864390.7A Active CN113687910B (en) 2021-07-29 2021-07-29 Method, device, equipment and storage medium for managing USB equipment in cluster

Country Status (1)

Country Link
CN (1) CN113687910B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114880722B (en) * 2022-04-14 2025-06-27 统信软件技术有限公司 Device mounting method, computing device and readable storage medium
CN116032746B (en) * 2023-03-28 2023-07-14 苏州浪潮智能科技有限公司 Resource pool information processing method and device, storage medium and electronic device

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109144752A (en) * 2018-09-06 2019-01-04 郑州云海信息技术有限公司 Access shared USB device method and apparatus

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9189265B2 (en) * 2006-12-21 2015-11-17 Vmware, Inc. Storage architecture for virtual machines
CN102789432B (en) * 2011-05-19 2016-02-17 中国电信股份有限公司 USB device driving method and system
CN102567074B (en) * 2011-11-29 2015-01-21 中标软件有限公司 USB (universal serial bus) device redirecting method facing virtual machines
CN102523264B (en) * 2011-12-06 2014-07-02 北京航空航天大学 USB (Universal Serial Bus) equipment remote sharing method and system for virtual machine
CN105376278A (en) * 2014-08-25 2016-03-02 北京云巢动脉科技有限公司 Method of realizing control on mobile equipment at different terminal and system thereof
CN105391652B (en) * 2015-12-03 2018-08-31 武汉噢易云计算股份有限公司 The system and method for realizing USB device network share is redirected based on USB
CN107341039A (en) * 2016-04-28 2017-11-10 中兴通讯股份有限公司 Method, main frame and the system being managed under a kind of virtual environment to USB device
CN105871926B (en) * 2016-06-17 2019-07-19 山东大学 A method and system for safe sharing of USB devices based on desktop virtualization
CN109284170B (en) * 2018-09-11 2021-10-26 山东观海数据技术有限公司 USB sharing system and sharing method in local area network
CN111045834B (en) * 2018-10-15 2023-08-08 中兴通讯股份有限公司 Method, device and storage medium for accessing USB storage device under cloud desktop

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109144752A (en) * 2018-09-06 2019-01-04 郑州云海信息技术有限公司 Access shared USB device method and apparatus

Also Published As

Publication number Publication date
CN113687910A (en) 2021-11-23

Similar Documents

Publication Publication Date Title
US11553034B2 (en) Server computer management system for supporting highly available virtual desktops of multiple different tenants
US11082505B2 (en) Dynamic discovery of available storage servers
JP4240930B2 (en) Method and apparatus for unifying temporary transmission of multiple network storages
US8578375B2 (en) Virtual machine administration for data center resource managers
US11249788B2 (en) Cloud management platform, and virtual machine management method and system
TW201843980A (en) Storage system and method for automatic Ethernet storage exploration
US10455028B2 (en) Allocating edge services with large-scale processing framework clusters
CN109085999B (en) Data processing method and processing system
CN109451088A (en) A kind of data access method and device
JP2005332220A5 (en)
US9612766B2 (en) Systems and methods for shadow migration progress estimation
CN103294765A (en) Policy-based approach and system for provisioning and transforming virtual appliances
US11303583B2 (en) Resource trees by management controller
CN110008029B (en) Ceph metadata cluster directory allocation method, system, device and readable storage medium
CN113687910B (en) Method, device, equipment and storage medium for managing USB equipment in cluster
WO2017054533A1 (en) External resource management method, apparatus and system through cloud interworking
CN114640678A (en) Pod management method, device and medium based on SR-IOV
WO2024174717A1 (en) Dynamic storage allocation method and apparatus, electronic device, and storage medium
WO2016202016A1 (en) Device management method, apparatus and system
CN116700626A (en) Resource binding method and device and electronic equipment
CN113687778A (en) Direct disk management method, device, equipment and storage medium
CN113312328B (en) Control method, data processing method, data access method and computing device
CN111857955A (en) A method for automatic construction and update of resource configuration information in heterogeneous cloud environment
CN118819588A (en) System upgrade management method, device, equipment and storage medium
CN114745397B (en) Online storage method and system based on private cloud

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant