Dynamic file mounting method, system, computer device and readable storage medium

By configuring the samba user and mount directory in the virtual machine and using the linux file system to link files, the problems of extended virtual machine creation time and waste of disk space are solved, and efficient dynamic file mount is achieved.

CN113961520BActive Publication Date: 2025-08-12HANGZHOU DBAPPSECURITY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111234269.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-22
Publication Date
2025-08-12
Estimated Expiration
2041-10-22

AI Technical Summary

Technical Problem

During the virtual machine creation process, copying large files causes an extended creation time, and the same file is repeatedly copied by multiple virtual machines, wasting disk space.

Method used

By creating a samba user to match the virtual machine and configuring the mount directory in each virtual machine, use the linux file system to link the files to be mounted to the specified directory to avoid duplicate copying.

Benefits of technology

It shortens the creation time of virtual machine, saves disk space, and realizes dynamic file mount.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113961520B_ABST
    Figure CN113961520B_ABST
Patent Text Reader

Abstract

The present application relates to a dynamic file mounting method, system, computer device, and readable storage medium. The method comprises: invoking a proxy device to create n Samba users associated with a virtual machine, each Samba user being configured with corresponding user information; sending file mounting information associated with the virtual machine to the proxy device; and upon receiving the file mounting information, creating a virtual machine mounting directory based on the file mounting information and linking the file to be mounted to the corresponding virtual machine mounting directory. This application solves the problems of prolonged virtual machine creation time when copying large files, and the waste of disk space caused by repeated copying of the same file by different virtual machines. Dynamic mounting is achieved, and the creation time of large file mounting is shortened, while significantly saving disk space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a dynamic file mounting method, system, computer device, and readable storage medium. Background Art

[0002] In the Linux operating system, mounting is to attach a device (usually a storage device) to an existing directory and access the storage device by accessing this directory.

[0003] Currently, major cloud platforms typically use disks to mount files for virtual machines. This involves creating an empty disk before starting the virtual machine, copying the files to be mounted to the disk, and then mounting the disk into the virtual machine when it starts, thus achieving dynamic file mounting. However, this approach clearly has two major drawbacks: First, the virtual machine creation process requires copying files to the empty disk. If there are many large files, the copying process will take a long time, extending the virtual machine creation process. Second, when the same file is mounted by multiple virtual machines, it will be copied multiple times, wasting a certain amount of disk space. Summary of the Invention

[0004] The embodiments of the present application provide a dynamic file mounting method, system, computer device and readable storage medium to at least solve the problem in the related art that when there are many files to be copied and the files are large in size, the creation time of the virtual machine will be prolonged, and during the mounting process, the same file will be repeatedly copied by different virtual machines, resulting in a waste of disk space.

[0005] In a first aspect, an embodiment of the present application provides a dynamic file mounting method, the method comprising:

[0006] Sending a request to create n virtual machines and generate a Samba user for each virtual machine, calling an agent device to create Samba users related to the virtual machines, each Samba user is configured with corresponding user information;

[0007] Sending file mounting information related to the virtual machine to the proxy device, the file mounting information including the file to be mounted in the virtual machine, the virtual machine identifier and the user information;

[0008] After receiving the file mounting information, the proxy device creates a virtual machine mounting directory according to the file mounting information, and links the file to be mounted to the corresponding virtual machine mounting directory.

[0009] In some embodiments, the file to be mounted is linked to the corresponding virtual machine mount directory through a Linux file system.

[0010] In some embodiments, the agent device configures the virtual machine mount directory to control permissions related to the samba user, so that each virtual machine mount directory is accessed through a designated samba client.

[0011] In some embodiments, the user information includes a corresponding Samba user name and password. When n virtual machines are created, the IP information of the Samba server, the Samba user name and password are respectively transferred to the corresponding virtual machines.

[0012] In some embodiments, after receiving the file mounting information, the agent device creates a corresponding virtual machine mounting directory according to the virtual machine identifier.

[0013] In some embodiments, the corresponding user information is read through the startup script of the virtual machine, and the corresponding virtual machine mount directory is mounted.

[0014] In a second aspect, an embodiment of the present application provides a dynamic file mounting system, the system comprising:

[0015] A creation module, configured to issue a request to create n virtual machines and generate a samba user for each virtual machine, and call the proxy device to create a samba user associated with the virtual machine, each samba user being configured with corresponding user information;

[0016] a sending module, configured to send file mounting information related to the virtual machine to the proxy device, wherein the file mounting information includes a file to be mounted in the virtual machine, a virtual machine identifier, and the user information;

[0017] The link module is used to create a virtual machine mount directory according to the file mount information after the agent device receives the file mount information, and link the file to be mounted to the corresponding virtual machine mount directory.

[0018] In some embodiments, the file to be mounted is linked to the corresponding virtual machine mount directory through a Linux file system.

[0019] In a third aspect, an embodiment of the present application provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the dynamic file mounting method as described in the first aspect above is implemented.

[0020] In a fourth aspect, an embodiment of the present application provides a readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the dynamic file mounting method as described in the first aspect above.

[0021] Compared with the related art, the dynamic file mounting method provided by the embodiment of the present application creates a samba user by using a proxy device, and each samba user is matched with a virtual machine, and then a virtual machine mount directory is configured in each virtual machine, and then the file name of the file to be mounted is linked to the specified virtual machine mount directory through the Linux file system. Each file to be mounted can be linked to one or more virtual machine mount directories, which solves the problem that when there are many files to be copied and the file size is large, the creation time of the virtual machine will be extended, and during the mounting process, the same file will be repeatedly copied by different virtual machines, resulting in a waste of disk space. It realizes dynamic mounting and shortens the creation time when large files are mounted. At the same time, when multiple virtual machines mount the same file at the same time, the file link method is used to greatly save disk space.

[0022] The details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0024] Figure 1 is a schematic diagram of the architecture of the proxy device according to an embodiment of the present application;

[0025] Figure 2 is a schematic diagram of the architecture of dynamic file mounting according to an embodiment of the present application;

[0026] Figure 3 is a flow chart of a dynamic file mounting method according to the first embodiment of the present application;

[0027] Figure 4 is a flow chart of a dynamic file mounting method according to the second embodiment of the present application;

[0028] Figure 5 is a structural block diagram of a dynamic file mounting system according to a third embodiment of the present application;

[0029] Figure 6 is a structural block diagram of a dynamic file mounting system according to a fourth embodiment of the present application;

[0030] Figure 7It is a schematic diagram of the hardware structure of a computer device according to the fifth embodiment of the present application. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solutions and advantages of this application more clearly understood, the present application is described and illustrated below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely used to explain this application and are not intended to limit this application. Based on the embodiments provided in this application, all other embodiments obtained by those of ordinary skill in the art without making any creative efforts are within the scope of protection of this application.

[0032] Obviously, the drawings described below are merely examples or embodiments of the present application. Those skilled in the art can, without inventive effort, apply the present application to other similar scenarios based on these drawings. Furthermore, it is also understood that, although the effort involved in such a development process may be complex and lengthy, for those skilled in the art related to the content disclosed in this application, changes in design, manufacturing, or production based on the technical content disclosed in this application are merely conventional technical means and should not be construed as an insufficiency of the content disclosed in this application.

[0033] References to "embodiments" in this application mean that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it refer to independent or alternative embodiments that are mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described in this application may be combined with other embodiments unless there is a conflict.

[0034] Unless otherwise defined, the technical or scientific terms used in this application should have the ordinary meaning understood by a person of ordinary skill in the technical field to which this application belongs. The words "one", "a", "the" and the like used in this application do not indicate a limit on quantity and may indicate the singular or plural. The terms "include", "comprise", "have" and any variations thereof used in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units that are inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like used in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The word "multiple" used in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships can exist. For example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific order for the objects.

[0035] Samba is a free software implementation of the SMB (Server Message Block) protocol for Linux and Unix systems. It consists of both server and client programs. SMB is a communication protocol for sharing files and printers within a local area network (LAN). It provides file and printer sharing services between different computers within the LAN.

[0036] The role of the proxy device is to receive requests from the cloud management system, configure local samba services and link files. Figure 1 The proxy device architecture is shown as follows: The proxy device exposes the RESET API (Application Programming Interface), receives upper-layer requests, and provides three services: samba configuration service, file link service, and user service. The service descriptions are as follows:

[0037] 1. Samba Configuration Service: This service provides functions for adding and removing shared directories and restarting Samba, enabling dynamic Samba configuration. This service updates the / etc / samba / smb.conf file using the read / write file interface provided by Java NIO (Non-blocking Input / Output). After the update, it restarts the Samba service by executing the servicesmbrestart command using the command line interface (CIL).

[0038] 2. File Link Service: Provides soft / hard link functionality for files in Linux, enabling dynamic file linking. This works by executing the ln command through the Shell CIL to link a file to a specified directory.

[0039] 3. User Service: Provides the ability to create and delete Samba users and control the mount permissions of different directories. This function is implemented by executing the useradd and smbpasswd commands through the Shell CIL to add users and set their Samba passwords.

[0040] ShellCLI and JAVA NIO are interfaces for executing samba commands, file link commands, and reading and writing files.

[0041] The present invention provides a dynamic file mounting method, which is a Samba-based dynamic file mounting method, which is applied to a server. The server includes a cloud management system and a cloud. A Samba server is deployed in the cloud, and an agent device is deployed on the Samba server. The agent device is used to receive requests from the cloud management system.

[0042] like Figure 2 The schematic diagram of the architecture of virtual machine mounting files shown in the figure shows that each virtual machine has a dedicated mounting directory, under which are linked files. Each virtual machine has its own file mounting information, and the file mounting information can indicate the mounting of one or more files; or each file can be linked to one or more directories.

[0043] in, Figure 3 is a flow chart of a dynamic file mounting method according to the first embodiment of the present application, such as Figure 3 As shown, the process includes the following steps:

[0044] Step S101, issuing a request to create n virtual machines and generate a samba user for each of the virtual machines, calling an agent device to create a samba user associated with the virtual machine, each of the samba users being configured with corresponding user information;

[0045] Among them, the cloud management system sends a request to the proxy device and uses the proxy device to create a samba user. It should be noted that each samba user matches a virtual machine, and the cloud management system generates user information corresponding to the samba user. It can be understood that the password in the user information is dynamically generated as the cloud management system is started.

[0046] Step S102: sending file mounting information related to the virtual machine to the proxy device, wherein the file mounting information includes the file to be mounted in the virtual machine, the virtual machine identifier, and the user information;

[0047] The file to be mounted includes one or more file names, which exist in the virtual machine as the path to the file to be mounted, equivalent to a shortcut in the Windows system. In other words, a file to be mounted can be linked to one or more virtual machines. It will be understood that in this embodiment, the file name in the virtual machine is used to quickly locate and access the file to be mounted, thereby facilitating file management and saving disk space to address insufficient disk space. The virtual machine identifier refers to the IP address of the virtual machine, and the user information refers to the corresponding Samba username and password.

[0048] Step S103: After receiving the file mounting information, the proxy device creates a virtual machine mounting directory according to the file mounting information, and links the file to be mounted to the corresponding virtual machine mounting directory.

[0049] Among them, each virtual machine mount directory is located in one of the virtual machines. The virtual machine mount directory serves as a data space for storing data, and what is stored is a text file used to point to the location of another file. It should be noted that uploading files through links is helpful in avoiding the problem of repeated copying of the same file when it is mounted by multiple virtual machines, resulting in waste of disk space.

[0050] In this embodiment, the proxy device is used to create a samba user, and each of the samba users is matched with a virtual machine. Then, a virtual machine mount directory is configured in each of the virtual machines, and then one of the file names of the file to be mounted is linked to the specified virtual machine mount directory. Each file to be mounted can be linked to one or more virtual machine mount directories. This solves the problem that when there are many files to be copied and the file size is large, the creation time of the virtual machine is prolonged, and during the mounting process, the same file is repeatedly copied by different virtual machines, resulting in a waste of disk space. Dynamic mounting is achieved, and the creation time of large files is shortened. At the same time, when multiple virtual machines mount the same file at the same time, the file link method is used to greatly save disk space.

[0051] In some other embodiments, the file to be mounted is linked to the corresponding virtual machine mount directory through a Linux file system.

[0052] Files in the Linux file system are collections of data. The file system contains not only the data in the files but also the file system structure, storing all files, directories, soft links, and file protection information visible to Linux users and programs. By using the Linux file system's linking method, when the same file is used by multiple virtual machines, it can be linked to the virtual machine mount directory created above without having to copy the file multiple times, significantly saving disk space.

[0053] In some other embodiments, after receiving the file mounting information, the proxy device creates the corresponding virtual machine mounting directory according to the virtual machine identifier.

[0054] In some other embodiments, the proxy device configures the virtual machine mount directory to control permissions related to the samba user, so that each virtual machine mount directory is accessed through a designated samba client.

[0055] Among them, the proxy device configures the virtual machine mount directory and controls its permissions, such as whether the accessing user can read and write the virtual machine mount directory, whether other users can also access the virtual machine mount directory and perform read and write operations, etc. Through the above configuration, each virtual machine mount directory can only be accessed by a specified client. It should be noted that the configuration content can be modified as needed.

[0056] Figure 4 is a flow chart of another dynamic file mounting method according to the second embodiment of the present application. Figure 4 As shown, the process includes the following steps:

[0057] Step S201, issuing a request to create n virtual machines and generate a samba user for each of the virtual machines, calling an agent device to create a samba user associated with the virtual machine, each of the samba users being configured with corresponding user information;

[0058] Step S202: Sending file mounting information related to the virtual machine to the proxy device, wherein the file mounting information includes the file to be mounted in the virtual machine, the virtual machine identifier, and the user information;

[0059] Step S203: After receiving the file mounting information, the proxy device creates a virtual machine mounting directory according to the file mounting information, and links the file to be mounted to the corresponding virtual machine mounting directory;

[0060] Step S204: read the corresponding user information through the startup script of the virtual machine and mount the corresponding virtual machine mount directory.

[0061] In some other embodiments, the user information includes a corresponding Samba user name and password. When n virtual machines are created, the IP information of the Samba server, the Samba user name and password are respectively transferred to the corresponding virtual machines.

[0062] When the cloud management system creates a virtual machine, the configured samba user name and password and the ip information of the samba server are passed to the virtual machine, and the samba user name and password are read as keywords to realize automatic mounting after the samba server is started.

[0063] The third embodiment of the present invention further provides a dynamic file mounting system, which is used to implement the first embodiment and preferred implementation methods described above, and will not be repeated here. As used below, the terms "module," "unit," "subunit," etc. may refer to a combination of software and / or hardware that implements a predetermined function. Although the systems described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0064] The dynamic file mounting system provided in the third embodiment includes a server, the server including a cloud management system and a cloud, a samba server is deployed in the cloud, and an agent device is deployed on the samba server, the agent device is used to receive a request from the cloud management system, Figure 5 is a structural block diagram of a dynamic file mounting system according to the third embodiment of the present application, such as Figure 5 As shown, the system includes:

[0065] A creation module 10 is configured to issue a request to create n virtual machines and generate a samba user for each virtual machine, and to call an agent device to create a samba user associated with the virtual machine, wherein each samba user is configured with corresponding user information;

[0066] a sending module 20, configured to send file mounting information related to the virtual machine to the proxy device, wherein the file mounting information includes a file to be mounted in the virtual machine, a virtual machine identifier, and the user information;

[0067] The linking module 30 is configured to create a virtual machine mount directory according to the file mount information after the agent device receives the file mount information, and link the file to be mounted to the corresponding virtual machine mount directory.

[0068] The file to be mounted is linked to the corresponding virtual machine mount directory through the Linux file system.

[0069] After receiving the file mounting information, the proxy device creates a corresponding virtual machine mounting directory according to the virtual machine identifier.

[0070] In this embodiment, the proxy device is used to create a samba user, and each of the samba users is matched with a virtual machine. Then, a virtual machine mount directory is configured in each of the virtual machines, and then one of the file names of the file to be mounted is linked to the specified virtual machine mount directory. Each file to be mounted can be linked to multiple virtual machine mount directories. This solves the problem that when there are many files to be copied and the file size is large, the creation time of the virtual machine is prolonged, and during the mounting process, the same file is repeatedly copied by different virtual machines, resulting in a waste of disk space. Dynamic mounting is achieved, and the creation time of large files is shortened. At the same time, when multiple virtual machines mount the same file at the same time, the file link method is used to greatly save disk space.

[0071] In some other embodiments, the system further comprises:

[0072] A configuration module is used for the agent device to configure the virtual machine mounting directory to control the permissions related to the samba user, so that each virtual machine mounting directory is accessed through a specified samba client.

[0073] A fourth embodiment of the present invention further provides a dynamic file mounting system, which is used to implement the second embodiment and preferred implementation scheme described above, and will not be repeated here. As used below, the terms "module," "unit," "subunit," etc. may refer to a combination of software and / or hardware that implements a predetermined function. Although the systems described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0074] Figure 6 is a structural block diagram of a dynamic file mounting system according to the fourth embodiment of the present application, such as Figure 6 As shown, the system includes:

[0075] The creation module 100 is used to issue a request to create n virtual machines and generate a Samba user for each virtual machine, and call an agent device to create a Samba user related to the virtual machine, each Samba user is configured with corresponding user information;

[0076] When n virtual machines are created, the IP information of the samba server, the samba user name and password are respectively transferred to the corresponding virtual machines.

[0077] A sending module 200 is configured to send file mounting information related to the virtual machine to the proxy device, wherein the file mounting information includes a file to be mounted in the virtual machine, a virtual machine identifier, and the user information;

[0078] The linking module 300 is configured to create a virtual machine mount directory according to the file mount information after the agent device receives the file mount information, and link the file to be mounted to the corresponding virtual machine mount directory.

[0079] The reading module 400 reads the corresponding user information through the startup script of the virtual machine and mounts the corresponding virtual machine mount directory.

[0080] It should be noted that the above modules can be functional modules or program modules, and can be implemented through software or hardware. For modules implemented through hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.

[0081] In addition, combined Figure 1 The dynamic file mounting method described in the embodiment of the present application can be implemented by a computer device. Figure 7 Schematic diagram of the hardware structure of a computer device according to an embodiment of the present application.

[0082] The computer device may include a processor 71 and a memory 72 storing computer program instructions.

[0083] Specifically, the processor 72 may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0084] Among them, the memory 73 may include a large-capacity memory 73 for data or instructions. By way of example and not limitation, the memory 73 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 73 may include removable or non-removable (or fixed) media. Where appropriate, the memory 73 may be inside or outside the data processing system. In a specific embodiment, the memory 73 is a non-volatile memory. In a specific embodiment, the memory 73 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically alterable ROM (EAROM) or a flash memory (FLASH), or a combination of two or more of these. Under appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), where the DRAM can be a fast page mode dynamic random access memory (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.

[0085] The memory 73 may be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 72 .

[0086] The processor 72 implements any one of the dynamic file mounting methods in the above embodiments by reading and executing computer program instructions stored in the memory 73.

[0087] In some embodiments, the computer device may further include a communication interface 74 and a bus 71. Figure 7 As shown, the processor 72, the memory 73, and the communication interface 74 are connected via a bus 71 and communicate with each other.

[0088] The communication interface 74 is used to implement communication between the various modules, systems, units, and / or devices in the embodiments of the present application. The communication interface 74 can also implement data communication with other components such as external devices, image / data acquisition devices, databases, external storage, and image / data processing workstations.

[0089] Bus 71 includes hardware, software, or both, and couples components of a computer device to each other. Bus 71 includes, but is not limited to, at least one of the following: a data bus, an address bus, a control bus, an expansion bus, and a local bus. By way of example and not limitation, bus 71 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses 71, or a combination of two or more of these. Where appropriate, bus 71 may include one or more buses. Although the present embodiments describe and illustrate a particular bus 71 , this application contemplates any suitable bus 71 or interconnect.

[0090] The computer device can execute the dynamic file mounting method in the embodiment of the present application based on the acquired computer program, thereby realizing the combination of Figure 1 Describes the dynamic file mounting method.

[0091] In addition, in conjunction with the dynamic file mounting method in the above embodiment, the present application embodiment can provide a readable storage medium for implementation. The readable storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any of the dynamic file mounting methods in the above embodiment is implemented.

[0092] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0093] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.

Claims

1. A dynamic file mounting method, characterized in that: The method is applied to a server, the server including a cloud management system and a cloud, a samba server is deployed in the cloud, and an agent device is deployed on the samba server, the agent device is used to receive requests from the cloud management system; the method includes: Sending a request to create n virtual machines and generate a samba user for each virtual machine through the cloud management system, calling an agent device to create a samba user related to the virtual machine, each samba user is configured with corresponding user information; Sending file mounting information related to the virtual machine to the proxy device, the file mounting information including the file to be mounted in the virtual machine, the virtual machine identifier and the user information; After receiving the file mounting information, the proxy device creates a virtual machine mounting directory according to the virtual machine identifier in the file mounting information, and links the file to be mounted to the corresponding virtual machine mounting directory.

2. The dynamic file mounting method according to claim 1, characterized in that: The file to be mounted is linked to the corresponding virtual machine mount directory through the Linux file system.

3. The dynamic file mounting method according to claim 1, characterized in that: The proxy device configures the virtual machine mount directory to control the permissions related to the samba user, so that each virtual machine mount directory is accessed through a designated samba client.

4. The dynamic file mounting method according to claim 1, wherein: The user information includes a corresponding samba user name and password. When n virtual machines are created, the IP information of the samba server, the samba user name and password are respectively transferred to the corresponding virtual machines.

5. The dynamic file mounting method according to claim 1, characterized in that: The corresponding user information is read through the startup script of the virtual machine, and the corresponding virtual machine mount directory is mounted.

6. A dynamic file mounting system, characterized in that: Applied to a server, the server includes a cloud management system and a cloud, a samba server is deployed in the cloud, and an agent device is deployed on the samba server, the agent device is used to receive requests from the cloud management system; the system includes: A creation module, configured to issue a request to create n virtual machines and generate a Samba user for each virtual machine through the cloud management system, and call an agent device to create Samba users related to the virtual machines, each Samba user being configured with corresponding user information; a sending module, configured to send file mounting information related to the virtual machine to the proxy device, wherein the file mounting information includes a file to be mounted in the virtual machine, a virtual machine identifier, and the user information; The link module is used to create a virtual machine mount directory according to the virtual machine identifier in the file mount information after the agent device receives the file mount information, and link the file to be mounted to the corresponding virtual machine mount directory.

7. The dynamic file mounting system according to claim 6, characterized in that: The file to be mounted is linked to the corresponding virtual machine mount directory through the Linux file system.

8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the dynamic file mounting method according to any one of claims 1 to 5 is implemented.

9. A readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the dynamic file mounting method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Method and device for bidirectionally transmitting file between client and virtual machine

    CN108390927A