A USB device management method and system based on cloud platform
By extending the USB device management function of the OpenStack Nova component, the lack of USB device management in the cloud platform is solved, real-time mounting and persistence management of USB devices are realized, simplifying operation and maintenance operations and reducing the risk of errors.
Patent Information
- Application Number
- CN202111612814.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2041-12-27
AI Technical Summary
The OpenStack cloud platform lacks USB device management functions, which means operation and maintenance personnel need to manually log in to the computing nodes to manage USB devices. The operation is complex and error-prone, and the mounted USB devices need to be remounted after the virtual machine is restarted.
Expand Nova service resource update component, API interface and virtual machine management component, add USB device list, detail query and mount/unmount interface, realize real-time mounting and unmounting of USB devices through Libvirt interface, and persist them in the database USB device information.
It simplifies the operation process for operation and maintenance personnel, reduces the risk of errors, and enables persistent mounting of USB devices. The device is still mounted in the virtual machine after the virtual machine is restarted.
Smart Images

Figure CN114327654B
Abstract
Description
Technical Field
[0001] The invention discloses a USB device management method and system based on a cloud platform, and relates to the technical field of USB physical device management. Background Art
[0002] With the rapid development of virtualization technology, more and more customers choose to use cloud platforms to deploy their services. This article mainly focuses on the USB device management requirements in cloud platforms built on OpenStack, and introduces a method to manage USB devices through OpenStack, so as to manage node USB devices through the cloud platform and complete functions such as device uninstallation and mounting to virtual machines.
[0003] OpenStack is an open source cloud computing management platform project jointly developed and initiated by NASA (National Aeronautics and Space Administration) and Rackspace, licensed under the Apache license. OpenStack is an open source project that provides software for the construction and management of public and private clouds. OpenStack supports almost all types of cloud environments. The project goal is to provide a cloud computing management platform that is simple to implement, scalable, rich, and standardized. OpenStack versions are released every 6 months, and the order of each version is sorted according to AZ. Each version release will fix serious bugs in the community code and launch new features. For manufacturers who use openstack as the basic cloud platform, how to synchronize community code, fix important bugs, and launch new features, while also integrating self-developed code and ultimately achieving fast and stable upgrades of the cloud platform has become increasingly important.
[0004] Nova is the core service of OpenStack, which is mainly responsible for maintaining and managing computing resources in the cloud environment. Nova's architecture is relatively complex and contains many components. These components run in the form of sub-services (background deamon processes) and can be divided into the following categories:
[0005] 1. nova-api
[0006] It is the portal of the entire Nova component, receiving and responding to customer API calls. All requests to Nova are first processed by nova-api. nova-api exposes several HTTP REST API interfaces to the outside world.
[0007] 2. nova-scheduler
[0008] The virtual machine scheduling service is responsible for deciding on which computing node to run the virtual machine.
[0009] 3. nova-conductor:
[0010] An intermediate layer when computing nodes access the database, responsible for querying and updating the database service. For security and scalability reasons, nova-compute does not directly access the database, but delegates it to the nova-conductor service to complete the creation, modification, and query of database information.
[0011] Nova-compute
[0012] nova-compute is the core service for managing virtual machines and runs on computing nodes. It implements the lifecycle management of instances on nodes by calling the Hypervisor API. All OpenStack operations on virtual machines are ultimately completed by nova-compute. nova-compute and Hypervisor work together to implement OpenStack's management of the virtual machine lifecycle.
[0013] Libvirt is the most widely used application programming interface for managing KVM virtual machines. As an open source API, background program and management tool for managing virtualization platforms, it can be used to manage KVM, Xen, VMware ESX, QEMU and other virtualization technologies. Taking QEMU-KVM as a hypervisor as an example, by calling the Libvirt API, you can query the USB devices inserted into the computing node, mount the specified USB devices to the virtual machine in real time, and realize basic functions such as USB device mounting and unmounting.
[0014] For virtual machines running on cloud platforms, there are often requirements for software in the virtual machines to be authenticated by inserting a dongle, or for confidential data to be transmitted using a USB device or a mobile hard disk. Due to these issues, OpenStack-based cloud platforms currently do not support the management of USB devices.
[0015] Therefore, a USB device management method and system based on a cloud platform are now invented to solve the above problems. Summary of the invention
[0016] In view of the problems of the prior art, the present invention provides a USB device management method and system based on a cloud platform. The technical solution adopted is: a USB device management method based on a cloud platform, wherein the specific steps of the method are as follows:
[0017] S1 extended Nova service resource update component;
[0018] S2 extends the Nova API interface, adding a new USB device list and USB device details query interface;
[0019] S3 extends Nova API, Conductor, and Compute interfaces, and adds virtual machine mounting and unmounting USB device interfaces.
[0020] The specific steps of the S1 extended Nova service resource update component are as follows:
[0021] Add the method _get_usb_devices() in the S101 computing node initialization logic and the existing computing node periodic resource reporting logic to obtain the node USB information and save it to the usb_devices data table;
[0022] S102 bottom layer obtains USB device implementation logic;
[0023] S103 extracts necessary attributes of the USB device from the initialized extreme node and saves them into the usb_devices table of the database.
[0024] The specific steps of extending the Nova API interface of S2 and adding the USB device list and USB device details query interface are as follows:
[0025] S201Nova API adds a new interface for querying the USB device list, which can obtain all USB devices in available and attached states by querying the database;
[0026] S202 Nova API adds a new interface for querying USB device details, which obtains USB device details of the specified USB device uuid or address address by querying the database.
[0027] The specific steps of extending Nova API, Conductor, and Compute interfaces of S3 and adding virtual machine mounting and unmounting USB device interfaces are as follows:
[0028] S301Nova API receives the request information and checks the status of the virtual machine and USB device;
[0029] S302 uses Nova Conductor to process database query requests;
[0030] S303Nova Compute performs USB device mounting or unmounting actions, obtains corresponding USB information according to the USB bus and device in the request, constructs the device xml, and finally mounts the device to the virtual machine or downloads it from the virtual machine in real time through the attachDeviceFlags in the libvirt interface.
[0031] A USB device management system based on a cloud platform, the system specifically includes a component update module, an interface expansion module and a virtual machine expansion module:
[0032] Component update module: expand Nova service resource update component;
[0033] Interface extension module: expand the Nova API interface, add USB device list and USB device details query interface;
[0034] Virtual machine extension module: extends Nova API, Conductor, and Compute interfaces, and adds virtual machine mounting and unmounting USB device interfaces.
[0035] The component update module specifically includes an information acquisition module, a logic acquisition module and an information storage module:
[0036] Information acquisition module: add the method _get_usb_devices() in the computing node initialization logic and the existing computing node periodic resource reporting logic to obtain the node USB information and save it in the usb_devices data table;
[0037] Logical acquisition module: the underlying logic of acquiring USB devices;
[0038] Information saving module: extracts necessary attributes of USB devices from initialized extreme nodes and saves them into the usb_devices table in the database.
[0039] The interface expansion module specifically includes a status acquisition module and a detail acquisition module:
[0040] Status acquisition module: Nova API adds a new interface for querying the USB device list, which can obtain all USB devices in available and attached states by querying the database;
[0041] Details acquisition module: Nova API adds a new interface for querying USB device details, which obtains USB device details of the specified USB device uuid or address address by querying the database.
[0042] The virtual machine extension module specifically includes a status detection module, a request processing module and a virtual machine processing module:
[0043] Status detection module: Nova API receives request information and checks the status of virtual machines and USB devices;
[0044] Request processing module: Use Nova Conductor to process database query requests;
[0045] Virtual machine processing module: Nova Compute performs USB device mounting or unmounting actions, obtains corresponding USB information according to USBbus and device in the request, constructs device xml, and finally mounts the device to the virtual machine or downloads it from the virtual machine in real time through attachDeviceFlags in the libvirt interface.
[0046] The beneficial effects of the present invention are as follows: the present invention provides a USB device management method based on a cloud platform for the field of USB device management on a cloud platform, improves the functions of an OpenStack cloud management platform, and makes up for the lack of USB device management functions of an OpenStack Nova component; previously, operation and maintenance personnel needed to log in to a computing node where a USB device was inserted, manually execute Linux commands, query USB device information, and construct an XML file of the device to be mounted based on the USB information, and then execute the Libvirt interface to mount the device to a target virtual machine in real time; this process requires the operation and maintenance personnel to have certain business capabilities and directly operate the virtual machine, and problems are likely to occur if the operation is wrong; on the other hand, since this process is to modify the virtual machine configuration XML file in real time, it is not persistently synchronized to the Nova database, and if the virtual machine is restarted, the USB device needs to be re-mounted; in view of the above problems, the method of the present invention can greatly simplify the operation cost of the operation and maintenance personnel and reduce the risk of errors, and at the same time, persistent mounting of USB devices can be achieved, and the device is still mounted on the virtual machine after the virtual machine is restarted. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] 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 some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0048] Figure 1 is a schematic diagram of related functions of a USB device in an embodiment;
[0049] Figure 2 is a management flow chart of a USB device in an embodiment;
[0050] Figure 3 is a schematic diagram illustrating the status of a USB device in an embodiment;
[0051] Figure 4 It is a screenshot of the design interface of the database usb_devices in the embodiment;
[0052] Figure 5 is a flow chart of the method of the present invention. DETAILED DESCRIPTION
[0053] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0054] like Figure 1 As shown in the figure, the basic functions of managing USB devices through the cloud management platform are demonstrated:
[0055] 1. USB Resource Management Engine
[0056] 1) Detect the node USB device when initializing the computing node, and write the device information persistently into the database;
[0057] 2) Periodic tasks detect changes in node USB devices and update the results to the database;
[0058] 2. USB resource query interface
[0059] 1) Obtain all USB device information by querying the database, and support filtering by node ID, name and USB related attributes;
[0060] 2) Obtain information about a single USB device by querying the database;
[0061] 3. USB device mounting interface
[0062] According to the USB device information queried in the second step, the device bus and device are passed in, and the bottom layer calls the libvirt interface to mount the USB device to the virtual machine in real time;
[0063] 4. USB device uninstall interface
[0064] According to the USB device information queried in the second step, the device bus and device are passed in, and the bottom layer calls the libvirt interface to realize the real-time uninstallation of the USB device by the virtual machine;
[0065] like Figure 2 As shown, it shows the flowchart of cloud platform automatic management of USB devices:
[0066] 1. Device Insertion
[0067] When the operation and maintenance personnel receive a request to mount a USB device to a virtual machine, they insert the USB device into the physical computing node in the computer room and use the characteristics of the placement trait to add a USB-specific identifier CUSTOM_<USB device model> to the computing node. If the virtual machine that needs to use the USB device is an existing virtual machine, the USB device can be directly inserted into the computing node where the virtual machine is located, or inserted into any computing node aggregated by the same host, and then the virtual machine is hot migrated to the computing node where the USB device is located; if the virtual machine has not been created, the USB device can be inserted into any computing node aggregated by a compliant host, and the USB device can be mounted after the virtual machine is created;
[0068] II. Resource reporting
[0069] The OpenStack cloud platform periodically updates the USB device information of the computing nodes in the cluster through the ResourceTracker and stores it in the database. On the other hand, for newly initialized computing nodes, the available USB devices of the newly added computing nodes can also be discovered and reported according to the ResourceTracker. And the USB information is stored in the database;
[0070] III. Virtual machine creation
[0071] The operation and maintenance personnel or users can create a virtual machine using the virtual machine specifications with added traits and schedule the virtual machine to the computing node inserted with the specified model through the placement service;
[0072] IV. USB device management
[0073] By calling the nova API, the following functions for managing USB devices can be realized:
[0074] 1. Query and filter all / specified computing node USB devices;
[0075] 2. Mount / unmount USB devices for virtual machines;
[0076] 3. Query the details of a specified USB device;
[0077] V. Virtual machine operations
[0078] For virtual machines that have already mounted USB devices, when performing operations such as cold / hot migration, reconstruction, modification of specifications, and evacuation of virtual machines, since the USB device has already been mounted, the device needs to be unmounted first before performing the above operations;
[0079] As Figure 3 shown, the USB device status description is shown:
[0080] I. Initial state after USB device reporting: available;
[0081] 2. Status of USB device after it is mounted to the virtual machine: allocated;
[0082] 3. Status of the USB device after it is unplugged from the computing node: deleted;
[0083] like Figure 4 As shown, the new database table design of the openstack nova component is shown:
[0084] 1. Device address format: <bus> : <device>, the device can be uniquely identified by address;
[0085] 2. Device label format: label<vendor_id><product_id> ;
[0086] Embodiment 1:
[0087] A USB device management method based on a cloud platform, wherein the specific steps of the method are as follows:
[0088] S1 extended Nova service resource update component;
[0089] S2 extends the Nova API interface, adding a new USB device list and USB device details query interface;
[0090] S3 extends Nova API, Conductor, and Compute interfaces, and adds virtual machine mounting and unmounting USB device interfaces;
[0091] By adding functions to the initialization node and the periodic tasks of the existing computing nodes, the USB device information of the computing nodes is periodically obtained and synchronized to the usb_devices data table of the nova database to persist the data; the underlying libvirt driver calls the list_all_devices(flags) method, passes in flags=8 to obtain the device list of the node type=usb, then adds a whitelist through the class field in the USB list data, returns the USB device type to be reported, and finally, according to the parent field, calls the nodeDeviceLookupByName method of the libvirt driver to obtain the USB device to be mounted, and saves the necessary attributes and stores them in the database;
[0092] By extending the Nova API, a new interface for querying the list of all USB devices is added, and filtering conditions based on the compute node id, compute node name, and USB device attributes are added. At the same time, an interface for querying USB device details based on the specified uuid or device address is added. The above interfaces directly obtain the returned data by querying the database;
[0093] By extending Nova API, Conductor, and Compute interfaces, Nova API is responsible for checking request parameters, NovaConductor is responsible for processing interactions with the database, and Nova Compute mainly completes USB device mounting and unmounting operations. The NovaCompute service obtains the corresponding USB information based on the USB bus and device in the request, constructs the USB device xml, and finally mounts and unmounts the device to the virtual machine in real time through attachDeviceFlags and detachDeviceFlags in the libvirt driver; at the same time, the virtual machine's USB device mounting status is checked when the virtual machine restarts. If there is a mounted USB device, the database is queried to synchronize the USB device information to the virtual machine xml file to ensure that the USB device will not be lost when the virtual machine starts normally; on the other hand, the USB device controller is optimized. When the virtual machine starts, Nova constructs a USB3.0 controller and writes it to the xml file to ensure that the virtual machine can normally identify USB1.0, 2.0, and 3.0 devices;
[0094] The present invention proposes a USB device management method based on a cloud platform, which extends the OpenStackNova component and mainly realizes several functions, including USB resource management, USB resource query interface, USB device mounting and unmounting. Among them, the USB resource management realizes calling the Libvirt interface listAllDevices to detect node devices when initializing computing nodes and for existing computing nodes through periodic tasks, and filtering out USB type devices, writing into a database, and persistently saving USB device information. The USB resource query interface queries the database by extending the Nova API interface to obtain all USB devices and single USB device information. The USB device mounting and unmounting interface calls the underlying Libvirt interface attachDeviceFlags according to the incoming USB device bus and device by extending the Nova API, Conductor, and Compute services, mounts the USB device to the virtual machine in real time, and extends the virtual machine startup interface. If the virtual machine has mounted the USB device, the device information is written into the virtual machine xmlconf object to ensure that the device still exists after the virtual machine is restarted.
[0095] Furthermore, the specific steps of the S1 extension Nova service resource update component are as follows:
[0096] Add the method _get_usb_devices() in the S101 computing node initialization logic and the existing computing node periodic resource reporting logic to obtain the node USB information and save it to the usb_devices data table;
[0097] S102 bottom layer obtains USB device implementation logic;
[0098] S103 extracts necessary attributes of the USB device from the initialized extreme node and saves them into the usb_devices table of the database;
[0099] First, expand the Nova service resource update component, which mainly includes the following parts:
[0100] Add the method _get_usb_devices() in the computing node initialization logic and the existing computing node periodic resource reporting logic to obtain the node USB device information and save it in the usb_devices data table;
[0101] The underlying logic of obtaining USB devices: The Libvirt driver in the Nova component obtains the device list information of the computing node by calling the list_all_devices(flags) method in the existing Host class. Note that this process obtains USB type devices with flag = 8 (VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_INTERFACE). For example, you can get the parent node: device, child nodes: name node (usb name value), path node (usb path), parent node (usb parent node name), driver node (name node containing attribute values), capability node (type attribute, containing number node, class node, subclass node, protocol node); you can select the USB device type we need to report according to the class attribute in the capability in the device information. Here, the result of the class to be filtered can be abstracted to the nova configuration file as a whitelist, and then get the parent attribute of the device, call the existing nodeDeviceLookupByName(name) method in libvirt, get the device information corresponding to the parent attribute, that is, the actual USB device we want to mount, for example: you can get the parent node: device, child nodes: name node (usb name value), path node (usb path), devnode node (dev path, type attribute), parent node (usb parent node name), driver node (including name node carrying attribute value), capability node (type attribute, including bus node, device node, product node, vendor node) xml file; at the same time, for the xml file obtained above, we will use and define objects in python for unified management;
[0102] For the initialized computing node, the necessary attributes of the above USB devices will be extracted and saved in the usb_devices table of the database; for the existing computing nodes, the USB device list of the current node will be obtained according to the execution periodic task, and the USB device information will be checked and updated according to the address information (uniquely identifying the USB device) in the USB device attributes. Note that the mounted USB device will not update the device information. If there is a change, a warning will be thrown, and the operation and maintenance personnel will check the problem node and the corresponding device, uninstall the virtual machine device according to the actual situation, and update it again;
[0103] Furthermore, the specific steps of extending the Nova API interface of S2 and adding a USB device list and USB device details query interface are as follows:
[0104] S201Nova API adds a new interface for querying the USB device list, which can obtain all USB devices in available and attached states by querying the database;
[0105] S202 Nova API adds a new interface for querying USB device details, which can obtain the USB device details of the specified USB device uuid or address address by querying the database;
[0106] 1) Query the USB device list
[0107] Request method: GET
[0108] Request path:
[0109] / os-usbs
[0110] / os-usbs?id=<compute_node_id>
[0111] / os-usbs?name=<compute_node_name>
[0112] / os-usbs? status=<usb_status>
[0113] Return result:
[0114]
[0115] Nova API adds a new interface for querying the USB device list. It queries the database to obtain all USB devices in the available and attached states, and supports filtering by compute node id: compute_node_id, compute node name: compute_node_name, and USB device status: status.
[0116] 2) Query USB device details
[0117] Request method: GET
[0118] Request path:
[0119] / os-usbs / {uuid}
[0120] / os-usbs / {address}
[0121] Returns:
[0122]
[0123]
[0124] Nova API adds a new interface for querying USB device details, which can obtain the USB device details of the specified USB device uuid or address address by querying the database;
[0125] Furthermore, the specific steps of extending the Nova API, Conductor, and Compute interfaces of S3 and adding virtual machine mounting and unmounting USB device interfaces are as follows:
[0126] S301Nova API receives the request information and checks the status of the virtual machine and USB device;
[0127] S302 uses Nova Conductor to process database query requests;
[0128] S303Nova Compute performs USB device mounting or unmounting actions, obtains corresponding USB information according to the USB bus and device in the request, constructs the device XML, and finally mounts the device to the virtual machine or downloads it from the virtual machine in real time through the attachDeviceFlags in the libvirt interface;
[0129] Expand Nova API, Conductor, and Compute interfaces, and add virtual machine mounting and unmounting USB device interfaces. The specific implementation methods are as follows:
[0130] 1) Virtual machine mounts USB device
[0131] Request method: POST
[0132] Request path:
[0133] / servers / {server_id} / os-usb_attachment
[0134] Return result:
[0135]
[0136]
[0137] 1>Nova API accepts request information and checks the status of the virtual machine and USB device
[0138] 2>Nova Conductor processes database query requests
[0139] 3>Nova Compute performs the USB device mounting action, obtains the corresponding USB information according to the USB bus and device in the request, constructs the device xml, and finally mounts the device to the virtual machine in real time through the attachDeviceFlags in the libvirt interface
[0140] 4> Added logic to check whether the virtual machine has mounted the USB device in the virtual machine startup logic. If so, update the device information to the virtual machine xml configuration to ensure that the device is still mounted in the virtual machine when the virtual machine starts.
[0141] 5> By default, the USB controller information is not added to the Nova virtual machine startup logic, and libvirt will add a 1.0 controller:<controller type='usb'index='0'model='piix3-uhci'> However, the 1.0 controller is not compatible with higher-version USB devices. Now the USB 3.0 controller is added to the xml configuration in the Nova virtual machine startup logic. The 3.0 controller is compatible with 1.0 and 2.0 USB devices by default, improving the compatibility of USB device recognition;
[0142] 2) Virtual machine uninstalls USB device
[0143] Request method: POST
[0144] Request path:
[0145] / servers / {server_id} / os-usb_attachment
[0146] Return result:
[0147]
[0148]
[0149] 1>Nova API accepts request information and checks the status of the virtual machine and USB device
[0150] 2>Nova Conductor processes database query requests
[0151] 3>Nova Compute performs the USB device uninstallation action, obtains the corresponding USB information according to the USB bus and device in the request, constructs the device xml, and finally uninstalls the device from the virtual machine in real time through the detachDeviceFlags in the libvirt interface
[0152] 4> Added logic to check whether the virtual machine has mounted the USB device in the virtual machine startup logic. If not, the logic of adding the USB device to xml will not be processed.
[0153] Embodiment 2:
[0154] A USB device management system based on a cloud platform, the system specifically includes a component update module, an interface expansion module and a virtual machine expansion module:
[0155] Component update module: expand Nova service resource update component;
[0156] Interface extension module: expand the Nova API interface, add USB device list and USB device details query interface;
[0157] Virtual machine extension module: expands Nova API, Conductor, and Compute interfaces, and adds virtual machine mounting and unmounting USB device interfaces;
[0158] Furthermore, the component update module specifically includes an information acquisition module, a logic acquisition module and an information storage module:
[0159] Information acquisition module: add the method _get_usb_devices() in the computing node initialization logic and the existing computing node periodic resource reporting logic to obtain the node USB information and save it in the usb_devices data table;
[0160] Logical acquisition module: the underlying logic of acquiring USB devices;
[0161] Information saving module: extracts necessary attributes of USB devices from initialized extreme nodes and saves them into the usb_devices table in the database;
[0162] Furthermore, the interface expansion module specifically includes a status acquisition module and a detail acquisition module:
[0163] Status acquisition module: Nova API adds a new interface for querying the USB device list, which can obtain all USB devices in available and attached states by querying the database;
[0164] Details acquisition module: Nova API adds a new interface for querying USB device details, which can obtain the USB device details of the specified USB device uuid or address address by querying the database;
[0165] Furthermore, the virtual machine extension module specifically includes a status detection module, a request processing module and a virtual machine processing module:
[0166] Status detection module: Nova API receives request information and checks the status of virtual machines and USB devices;
[0167] Request processing module: Use Nova Conductor to process database query requests;
[0168] Virtual machine processing module: Nova Compute performs USB device mounting or unmounting actions, obtains corresponding USB information according to USBbus and device in the request, constructs device xml, and finally mounts the device to the virtual machine or downloads it from the virtual machine in real time through attachDeviceFlags in the libvirt interface.
[0169] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.< / device> < / bus>
Claims
1. A USB device management method based on a cloud platform, characterized in that The specific steps of the method are as follows: S1 extended Nova service resource update component; S2 extends the Nova API interface, adding a new USB device list and USB device details query interface; S3 extends Nova API, Conductor, and Compute interfaces, and adds virtual machine mounting and unmounting USB device interfaces; The specific steps of the S1 extended Nova service resource update component are as follows: Add the method _get_usb_devices() in the S101 computing node initialization logic and the existing computing node periodic resource reporting logic to obtain the node USB information and save it to the usb_devices data table; S102 bottom layer obtains USB device implementation logic; S103 extracts necessary attributes of the USB device from the initialized extreme node and saves them into the usb_devices table of the database; The specific steps of extending the Nova API interface of S2 and adding the USB device list and USB device details query interface are as follows: S201Nova API adds a new interface for querying the USB device list, which can obtain all USB devices in available and attached states by querying the database; S202 Nova API adds a new interface for querying USB device details, which can obtain the USB device details of the specified USB device uuid or address address by querying the database; The specific steps of extending Nova API, Conductor, and Compute interfaces of S3 and adding virtual machine mounting and unmounting USB device interfaces are as follows: S301Nova API receives the request information and checks the status of the virtual machine and USB device; S302 uses Nova Conductor to process database query requests; S303Nova Compute performs USB device mounting or unmounting actions, obtains corresponding USB information according to the USB bus and device in the request, constructs the device xml, and finally mounts the device to the virtual machine or downloads it from the virtual machine in real time through the attachDeviceFlags in the libvirt interface.
2. A USB device management system based on a cloud platform, characterized in that The system specifically includes a component update module, an interface expansion module and a virtual machine expansion module: Component update module: expand Nova service resource update component; Interface extension module: expand the Nova API interface, add USB device list and USB device details query interface; Virtual machine extension module: expands Nova API, Conductor, and Compute interfaces, and adds virtual machine mounting and unmounting USB device interfaces; The component update module specifically includes an information acquisition module, a logic acquisition module and an information storage module: Information acquisition module: add the method _get_usb_devices() in the computing node initialization logic and the existing computing node periodic resource reporting logic to obtain the node USB information and save it in the usb_devices data table; Logical acquisition module: the underlying logic of acquiring USB devices; Information saving module: extracts necessary attributes of USB devices from initialized extreme nodes and saves them into the usb_devices table in the database; The interface expansion module specifically includes a status acquisition module and a detail acquisition module: Status acquisition module: Nova API adds a new interface for querying the USB device list, which can obtain all USB devices in available and attached states by querying the database; Details acquisition module: Nova API adds a new interface for querying USB device details, which can obtain the USB device details of the specified USB device uuid or address address by querying the database; The virtual machine extension module specifically includes a status detection module, a request processing module and a virtual machine processing module: Status detection module: Nova API receives request information and checks the status of virtual machines and USB devices; Request processing module: Use Nova Conductor to process database query requests; Virtual machine processing module: Nova Compute performs USB device mounting or unmounting actions, obtains corresponding USB information according to the USB bus and device in the request, constructs the device xml, and finally mounts the device to the virtual machine or downloads it from the virtual machine in real time through the attachDeviceFlags in the libvirt interface.
Citation Information
Patent Citations
Method and device for configuring USB equipment for KVM virtual machine in OpenStack
CN110245000A
Method and device for managing USB device by virtual machine, and storage medium
CN110413376A
Method for accessing a peripheral device
US20180293182A1
