A method for implementing an Openstack virtual machine docking with a CephFS file system
By using the Virtio-FS module in the OpenStack virtual machine to access the Local Cephfs file system, solve the problem of information leakage and single-point bottlenecks in the connection between virtual machines and Cephfs, and achieve higher security and file system performance.
Patent Information
- Application Number
- CN202210063524.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-20
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2042-01-20
AI Technical Summary
There are information leakage and single point bottlenecks in the docking of Openstack virtual machines with CephFS file system, which affects cluster security and file system performance.
Use the CephFS automatic mounting module to automatically mount the CephFS file system on the host, and use the Virtio-fs module to access the locally mounted CephFS file system in the virtual machine, eliminating single point bottlenecks and improving security.
A security access to the Cephfs file system has been realized, the single -point bottleneck is eliminated, the network path is reduced, the data read and writing performance of the file system is improved, and the security risk of the Ceph cluster is reduced.
Smart Images

Figure CN114443225B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cloud computing, in particular to a method for implementing an Openstack virtual machine docking with a CephFS file system. Background Art
[0002] With the rapid development of cloud computing technology, virtual machines are gradually replacing physical machines to run business in various fields. More and more government agencies and enterprises are migrating their business systems from traditional computing centers to cloud center virtual machines. As an open source Openstack cloud computing management platform, it is increasingly widely used and deployed in large quantities in cloud computing centers to provide users with IaaS layer virtual machine management functions.
[0003] With the rapid development of Openstack cloud resource management platform, Ceph distributed storage as its storage base has also achieved rapid development. Ceph has become the standard of distributed storage, supporting object, block and other forms of storage in a friendly and high-performance manner. CephFS is a file system that supports POSFIX interface, which uses Ceph storage cluster to store data. CephFS file system can be easily mounted to the local for client use.
[0004] Currently, when using CephFS in an Openstack virtual machine, CephFS is directly mounted to the virtual machine or exported as an NFS (Network File System) server through tools such as NFS-ganesha, and then mounted locally using the NFS client in the virtual machine. This will expose the relevant information of the Ceph cluster or ganesha cluster to the virtual machine. This may expose the information of the Ceph cluster or ganesha cluster and have a certain impact on the cluster security.
[0005] In addition, exporting CephFS directories based on NFS-ganesha may cause a single point bottleneck. When the number of clients increases and the load increases, it will have a certain impact on the normal business or use of the clients. Summary of the invention
[0006] In view of the needs and shortcomings of current technology development, the present invention provides a method for implementing an Openstack virtual machine docking with a CephFS file system.
[0007] The present invention provides a method for implementing an Openstack virtual machine docking with a CephFS file system, and the technical solution adopted to solve the above technical problems is as follows:
[0008] An implementation method for connecting an Openstack virtual machine to a CephFS file system, based on a CephFS automatic mounting module, a request response module, a node scheduling module, a virtual machine definition module, and a database module, includes the following two stages:
[0009] (1) Mount the CephFS file system locally on the host machine based on the kernel method:
[0010] Start the nova-compute component of Openstack. The CephFS automatic mounting module automatically mounts the CephFS file system on the compute nodes configured by the user, and adds specific features to the compute nodes that mount the CephFS file system for use in subsequent scheduling.
[0011] (2) The virtual machine accesses the locally mounted CephFS file system based on Virtio-fs:
[0012] The user sends a request to create a virtual machine using the CephFS file system.
[0013] The request response module responds to and filters the request.
[0014] The virtual machine definition module modifies the virtual machine Libvirt definition file generation method, adds a Virtio-fs type file system to the virtual machine, and uses the virtual machine shared memory according to the Virtio-fs requirement, and modifies the virtual machine's memory-related definition to shared memory.
[0015] Start the virtual machine, communicate with QEMU through the Virtiofsd process, and map the specified directory of the CephFS file system on the host to the mount label in the virtual machine;
[0016] When executing the above steps, the database module saves the persistence of data throughout the life cycle of the virtual machine, including the persistence of requests, the persistence of virtual machine related devices, and the persistence of virtual machine state changes.
[0017] Optionally, when the CephFS automatic mounting module involved adds specific features to the computing node that mounts CephFS, it is necessary to add the following to the configuration items of the nova-compute component: whether to support the Virtio-fs type file system, the path configuration item where CephFS is mounted in the local file system, the Ceph configuration file path, the user name used, the key, and the CephFS file system name used, and add a feature indicating that the current computing node supports Virtio-fs.
[0018] Further optionally, the CephFS automatic mounting module involved automatically mounts CephFS on the computing node configured by the user. When the computing node is started, the following operations are performed:
[0019] (1) Verify whether the current computing node supports the shared file system of CephFS based on Virtio-fs and whether the configuration item is enabled;
[0020] (2) Verify whether the current versions of QEMU and Libvirt meet the requirements, and add features to the current computing node accordingly;
[0021] (3) Use the Ceph configuration file path, user name, key, and CephFS file system name in the nova-compute component configuration item to mount the corresponding CephFS file system to the CephFS mount path in the configuration item.
[0022] Preferably, the virtual machine kernel version involved is not less than Linux 5.4, the Libvirt version is not less than 6.2, and the QEMU version is not less than 5.0.
[0023] Optionally, in the process of the request response module responding to the user request:
[0024] The interface created by the virtual machine needs to be modified to add recognition and verification of Virtio-fs type file system devices;
[0025] When creating a virtual machine, you need to add and verify the relevant information of the Virtio-fs file system to be mounted. The relevant information includes (a) the actual file system path to be mounted, which is the path in the CephFS file system, and (b) the mount label used when mounting in the virtual machine.
[0026] Further optionally, when creating a virtual machine, if a computing node is specified, it is also necessary to verify whether the specified computing node supports a file system of the Virtio-fs type.
[0027] Optionally, the virtual machine definition module involved needs to use virtual machine shared memory according to Virtio-fs, and the memory-related definition of the virtual machine is modified to shared memory. The following verification process is required in this process:
[0028] (1) Verify whether the requested virtual machine needs to mount a Virtio-fs type file system. If necessary, verify the current versions of QEMU and Libvirt. If the verification is successful, execute the subsequent steps. If the verification fails, report an error and return to the scheduling to try again to select a node.
[0029] (2) Verify whether the virtual machine uses hugepages. If yes, proceed to the next step. If no, change the virtual machine memory definition to shared memory.
[0030] (3) Obtain the mount path and mount label requested, and add a file system device of the Virtio-fs type to the virtual machine;
[0031] (4) After the virtual machine is defined, it is started. The Virtiofsd process will run as the virtual machine starts and is responsible for processing file system requests from users.
[0032] Optionally, the database module involved saves the data persistence throughout the life cycle of the virtual machine. In this process:
[0033] The CephFS automatic mount module needs to save the features added to the computing node to the database module for subsequent scheduling;
[0034] The request response module needs to save the verified virtual machine creation request to the database module for use in subsequent processes;
[0035] The node scheduling module needs to obtain the resource data and feature information of each computing node from the database module for comparison to ensure that the selection of computing nodes is completed;
[0036] The virtual machine definition module needs to update the virtual machine equipment data and resource usage data, and timely update and maintain the virtual machine status and save it to the database module.
[0037] The method for implementing an Openstack virtual machine docking with a CephFS file system of the present invention has the following beneficial effects compared with the prior art:
[0038] (1) On the one hand, the present invention uses Virtio-fs to export the directory in the CephFS file system and mount it in the virtual machine, which will not leak the cluster information. The information used when mounting in the virtual machine is the mount label specified by Virtio-fs in the virtual machine definition file, which can make the CephFS file system more secure. On the other hand, the CephFS file system is mounted on the computing node where each virtual machine is located, which can eliminate the single point bottleneck of exposing the CephFS file system directory based on NFS-ganesha, reduce the network path, and improve the data reading and writing performance of the file system.
[0039] (2) The present invention divides the connection between the virtual machine and the CephFS file system into two stages: the connection between the virtual machine and the host machine, and the connection between the host machine and the CephFS file system. The configuration information of the Ceph cluster is shielded at the host machine layer, which makes the Ceph configuration invisible to tenants and reduces the security risk of the Ceph cluster.
[0040] (3) In the present invention, the host machine mounts the CephFS file system based on the kernel mode, which eliminates the single point bottleneck of exposing the CephFS file system based on NFS-ganesha, reduces the network path, reduces the IO performance consumption caused by protocol conversion, and improves the data reading and writing performance of the CephFS file system;
[0041] (4) The present invention uses shared memory for data access and interaction, which can further improve the data reading and writing performance of the CephFS file system. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Attached Figure 1 It is a connection diagram of the implementation modules of the present invention;
[0043] Attached Figure 2 It is a schematic diagram of the physical architecture of the present invention. DETAILED DESCRIPTION
[0044] In order to make the technical solution, the technical problem solved and the technical effect of the present invention more clearly understood, the technical solution of the present invention is clearly and completely described below in conjunction with specific embodiments.
[0045] Embodiment 1:
[0046] Combined with Figure 1 , 2 This embodiment proposes an implementation method for connecting an Openstack virtual machine to a CephFS file system. The implementation method is based on a CephFS automatic mounting module, a request response module, a node scheduling module, a virtual machine definition module, and a database module, and includes the following two stages:
[0047] (1) Mount the CephFS file system locally on the host machine based on the kernel method:
[0048] Start the nova-compute component of Openstack. The CephFS automatic mounting module automatically mounts the CephFS file system on the user-configured computing nodes and adds specific features to the computing nodes that mount the CephFS file system for use in subsequent scheduling.
[0049] When the CephFS automatic mounting module adds specific features to the compute node that mounts CephFS, you need to add the following to the configuration items of the nova-compute component: whether to support the Virtio-fs type file system, the path configuration item where CephFS is mounted in the local file system, the Ceph configuration file path, the user name and key used, and the CephFS file system name used, and add a feature indicating that the current compute node supports Virtio-fs.
[0050] The CephFS automount module automatically mounts CephFS on the compute node configured by the user. When the compute node is started, it performs the following operations:
[0051] (1) Verify whether the current computing node supports the shared file system of CephFS based on Virtio-fs and whether the configuration item is enabled;
[0052] (2) Verify whether the current versions of QEMU and Libvirt meet the requirements, and add features to the current computing node accordingly;
[0053] (3) Use the Ceph configuration file path, user name, key, and CephFS file system name in the nova-compute component configuration item to mount the corresponding CephFS file system to the CephFS mount path in the configuration item.
[0054] In this embodiment, the virtual machine kernel version is not less than Linux 5.4, the Libvirt version is not less than 6.2, and the QEMU version is not less than 5.0.
[0055] (2) The virtual machine accesses the locally mounted CephFS file system based on Virtio-fs:
[0056] (I) A user issues a request to create a virtual machine that uses the CephFS file system.
[0057] (II) The request response module responds to and filters the request. During this process:
[0058] The interface created by the virtual machine needs to be modified to add recognition and verification of Virtio-fs type file system devices;
[0059] When creating a virtual machine, you need to add and verify the relevant information of the Virtio-fs file system to be mounted. The relevant information includes (a) the actual file system path to be mounted, which is the path in the CephFS file system, and (b) the mount label used when mounting in the virtual machine.
[0060] When creating a virtual machine, if a compute node is specified, you also need to verify whether the specified compute node supports the Virtio-fs file system.
[0061] (III) The virtual machine definition module modifies the virtual machine Libvirt definition file generation method, adds a file system of the Virtio-fs type to the virtual machine, and uses the virtual machine shared memory according to the need of Virtio-fs, and modifies the memory-related definition of the virtual machine to shared memory. In this process, the following verification process is required:
[0062] (1) Verify whether the requested virtual machine needs to mount a Virtio-fs type file system. If necessary, verify the current versions of QEMU and Libvirt. If the verification is successful, execute the subsequent steps. If the verification fails, report an error and return to the scheduling to try again to select a node.
[0063] (2) Verify whether the virtual machine uses hugepages. If yes, proceed to the next step. If no, change the virtual machine memory definition to shared memory.
[0064] (3) Obtain the mount path and mount label requested, and add a file system device of the Virtio-fs type to the virtual machine;
[0065] (4) After the virtual machine is defined, it is started. The Virtiofsd process will run as the virtual machine starts and is responsible for processing file system requests from users.
[0066] (IV) Start the virtual machine, communicate with QEMU through the Virtiofsd process, and map the specified directory of the CephFS file system on the host machine to the mount label in the virtual machine.
[0067] When executing the above steps,
[0068] (i) The CephFS automatic mounting module needs to save the features added to the computing node to the database module for subsequent scheduling;
[0069] (ii) The request response module needs to save the verified virtual machine creation request to the database module for use in subsequent processes;
[0070] (iii) The node scheduling module needs to obtain the resource data and feature information of each computing node from the database module for comparison to ensure that the selection of computing nodes is completed;
[0071] (iv) The virtual machine definition module needs to update the virtual machine device data and resource usage data, and timely update and maintain the virtual machine status and save it to the database module.
[0072] Simply put, the database module saves the persistence of data throughout the life cycle of the virtual machine, including the persistence of requests, the persistence of virtual machine-related devices, and the persistence of virtual machine state changes.
[0073] In summary, the implementation method of the Openstack virtual machine docking with the CephFS file system of the present invention can avoid the leakage of cluster information, eliminate the single point bottleneck of exposing the CephFS file system directory based on NFS-ganesha, reduce the network path, and improve the data reading and writing performance of the file system.
[0074] The above specific examples are used to explain the principles and implementation methods of the present invention in detail. These examples are only used to help understand the core technical content of the present invention. Based on the above specific embodiments of the present invention, any improvements and modifications made by technicians in this technical field without departing from the principles of the present invention should fall within the scope of patent protection of the present invention.
Claims
1. A method for implementing an Openstack virtual machine docking with a CephFS file system, characterized in that ,This implementation method is based on CephFS automatic mounting module, request response module, node scheduling module, virtual machine definition module, and database module, and includes the following two stages: (1) Mount the CephFS file system locally on the host machine based on the kernel method: Start the nova-compute component of Openstack. The CephFS automatic mounting module automatically mounts the CephFS file system on the compute nodes configured by the user, and adds specific features to the compute nodes that mount the CephFS file system for use in subsequent scheduling. (2) The virtual machine accesses the locally mounted CephFS file system based on Virtio-fs: The user sends a request to create a virtual machine using the CephFS file system. The request response module responds to and filters the request. The virtual machine definition module modifies the virtual machine Libvirt definition file generation method, adds a Virtio-fs type file system to the virtual machine, and uses the virtual machine shared memory according to the Virtio-fs requirement, and modifies the virtual machine's memory-related definition to shared memory. Start the virtual machine, communicate with QEMU through the Virtiofsd process, and map the specified directory of the CephFS file system on the host to the mount label in the virtual machine; When executing the above steps, the database module saves the persistence of data throughout the life cycle of the virtual machine, including the persistence of requests, the persistence of virtual machine related devices, and the persistence of virtual machine state changes.
2. The method for implementing an Openstack virtual machine docking with a CephFS file system according to claim 1, characterized in that: When the CephFS automatic mounting module adds specific features to the computing node that mounts CephFS, it is necessary to add the following to the configuration items of the nova-compute component: whether to support the Virtio-fs type file system, the path configuration item where CephFS is mounted in the local file system, the Ceph configuration file path, the user name used, the key, and the CephFS file system name used, and add a feature indicating that the current computing node supports Virtio-fs.
3. The method for implementing an Openstack virtual machine docking with a CephFS file system according to claim 2, characterized in that: The CephFS automatic mounting module automatically mounts CephFS on the computing node configured by the user. When the computing node is started, the following operations are performed: (1) Verify whether the current computing node supports the shared file system of CephFS based on Virtio-fs and whether the configuration item is enabled; (2) Verify whether the current versions of QEMU and Libvirt meet the requirements, and add features to the current computing node accordingly; (3) Use the Ceph configuration file path, user name, key, and CephFS file system name in the nova-compute component configuration item to mount the corresponding CephFS file system to the CephFS mount path in the configuration item.
4. The method for implementing an Openstack virtual machine docking with a CephFS file system according to claim 3, characterized in that: The virtual machine kernel version must be no less than Linux 5.4, the Libvirt version must be no less than 6.2, and the QEMU version must be no less than 5.
0.
5. The method for implementing an Openstack virtual machine docking with a CephFS file system according to claim 1, characterized in that: The request response module responds to user requests during this process: The interface created by the virtual machine needs to be modified to add recognition and verification of Virtio-fs type file system devices; When creating a virtual machine, you need to add and verify the relevant information of the Virtio-fs file system to be mounted. The relevant information includes (a) the file system path to be actually mounted, which is the path in the CephFS file system, and (b) the mount label used when mounting in the virtual machine.
6. The method for implementing an Openstack virtual machine docking with a CephFS file system according to claim 5, characterized in that: When creating a virtual machine, if a compute node is specified, you also need to verify whether the specified compute node supports the Virtio-fs file system.
7. The method for implementing an Openstack virtual machine docking with a CephFS file system according to claim 1, characterized in that: The virtual machine definition module uses the virtual machine shared memory according to the need of Virtio-fs, and modifies the memory-related definition of the virtual machine to shared memory. The following verification process is required in this process: (1) Verify whether the requested virtual machine needs to mount a Virtio-fs type file system. If necessary, verify the current versions of QEMU and Libvirt. If the verification is successful, execute the subsequent steps. If the verification fails, report an error and return to the scheduling to try again to select a node. (2) Verify whether the virtual machine uses hugepages. If yes, proceed to the next step. If no, change the virtual machine memory definition to shared memory. (3) Obtain the mount path and mount label requested, and add a file system device of the Virtio-fs type to the virtual machine; (4) After the virtual machine is defined, it is started. The Virtiofsd process will run as the virtual machine starts and is responsible for processing file system requests from users.
8. The method for implementing an Openstack virtual machine docking with a CephFS file system according to claim 1, characterized in that: The database module stores the persistence of data throughout the life cycle of the virtual machine. During this process: The CephFS automatic mounting module needs to save the features added to the computing node to the database module for subsequent scheduling; The request response module needs to save the verified virtual machine creation request to the database module for use in subsequent processes; The node scheduling module needs to obtain resource data and feature information of each computing node from the database module for comparison to ensure that the selection of computing nodes is completed; The virtual machine definition module needs to update the virtual machine equipment data and resource usage data, and timely update and maintain the virtual machine status, and save it to the database module.
Citation Information
Patent Citations
Small-file storage optimization system based on virtual file system in KUBERNETES user-mode application
AU2021101420A4
Method for implementing openstack high availability based on SAN (Storage Area Networking) storage shared volume
CN109547537A