CN114415952A - Storage space allocation method and device - Google Patents

Storage space allocation method and device Download PDF

Info

Publication number
CN114415952A
CN114415952A CN202210005407.8A CN202210005407A CN114415952A CN 114415952 A CN114415952 A CN 114415952A CN 202210005407 A CN202210005407 A CN 202210005407A CN 114415952 A CN114415952 A CN 114415952A
Authority
CN
China
Prior art keywords
target
network file
storage space
file system
container group
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210005407.8A
Other languages
Chinese (zh)
Inventor
夏旸
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN202210005407.8A priority Critical patent/CN114415952A/en
Publication of CN114415952A publication Critical patent/CN114415952A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0631Configuration or reconfiguration of storage systems by allocating resources to storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/176Support for shared access to files; File sharing support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a storage space distribution method and a storage space distribution device, which relate to the technical field of computers, and the method comprises the following steps: acquiring a storage space allocation request of a target container group in a preset container group cluster; determining a target network file system requested by a target container group according to the designated identifier in the storage space allocation request; judging whether a target network file system exists in the network file systems which are distributed for the preset container group cluster at present; if not, selecting one network file system from the plurality of network file systems which are not distributed currently as a target network file system, and distributing the storage space in the target network file system for the target container group according to the storage space distribution request. The method provided by the invention can dynamically expand the storage space required by the preset container group cluster, and meets the storage requirement of the preset container group cluster.

Description

Storage space allocation method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for allocating a storage space.
Background
Kubernets is a container management tool for managing containerized applications on multiple hosts in a cloud platform. The NFS-Client-provider (Network File System Client provider) plug-in may be configured in kubernets, and is used to manage the storage space of the container in the kubernets. For example, the NFS-Client-provider component may allocate storage space in the NFS for the container.
In the prior art, all container groups in a container group cluster share one NFS, that is, a storage space is provided to all container groups in the container group cluster through one NFS, and with the rapid increase of the storage space requirement of the container group cluster, the storage space capacity of one NFS often cannot meet the storage space requirement of the container group cluster.
Disclosure of Invention
An object of the embodiments of the present invention is to provide a storage space allocation method and apparatus, which can dynamically expand a storage space required by a preset container group cluster according to a storage space allocation request, so as to meet a storage requirement of the preset container group cluster. The specific technical scheme is as follows:
in a first aspect of the present invention, there is provided a storage space allocation method, including:
acquiring a storage space allocation request of a target container group in a preset container group cluster;
determining a target network file system requested by the target container group according to the designated identifier in the storage space allocation request;
judging whether the target network file system exists in the network file systems which are distributed for the preset container group cluster currently;
if the target network file system does not exist in the network file systems which are distributed for the preset container group cluster currently, selecting one network file system from a plurality of network file systems which are not distributed currently as the target network file system, and distributing the storage space in the target network file system for the target container group according to the storage space distribution request.
Optionally, the method further includes:
and if the target network file system exists in the network file system which is currently distributed to the preset container group cluster, distributing the storage space in the target network file system for the target container group according to the storage space distribution request.
Optionally, the storage space allocation request carries a storage type identifier, a target space size, and an access mode identifier;
the allocating storage space in the target network file system for the target container group according to the storage space allocation request comprises:
determining a storage space with the size of the target space in the target network file system as a target storage space;
setting the storage type of the target storage space as the target storage type represented by the storage type identifier, and setting the access mode of the target storage space as the target access mode represented by the access mode identifier;
and binding the set target storage space with the target container group to allocate the target storage space for the target container group.
Optionally, the determining, according to the specified identifier in the storage space allocation request, the target network file system requested by the target container group includes:
judging whether the storage space allocation request carries a network file system identifier or not;
if the storage space allocation request carries a network file system identifier, determining that a target network file system of the target container group request has the network file system identifier;
and if the storage space allocation request does not carry a network file system identifier, determining a target network file system of the target container group request, and corresponding to the name space identifier carried in the storage space allocation request.
Optionally, the obtaining a storage space allocation request of a target container group in a preset container group cluster includes:
analyzing the persistent storage statement corresponding to the target container group to obtain a storage space allocation request of the target container group; wherein the persistent storage declaration is encapsulated when the target container group is created.
In a second aspect of the present invention, there is provided a storage space allocation apparatus, comprising:
the request acquisition module is used for acquiring a storage space allocation request of a target container group in a preset container group cluster;
a target network file system determining module, configured to determine a target network file system requested by the target container group according to the specified identifier in the storage space allocation request;
the judging module is used for judging whether the target network file system exists in the network file system which is currently distributed to the preset container group cluster;
and the storage space allocation module is used for selecting one network file system from a plurality of currently unallocated network file systems as the target network file system if the target network file system does not exist in the network file systems which are currently allocated to the preset container group cluster, and allocating the storage space in the target network file system for the target container group according to the storage space allocation request.
Optionally, the storage space allocation module is further configured to, if the target network file system exists in the network file system that is currently allocated to the preset container group cluster, allocate a storage space in the target network file system to the target container group according to the storage space allocation request.
Optionally, the storage space allocation request carries a storage type identifier, a target space size, and an access mode identifier;
the storage space allocation module is specifically configured to determine a storage space of the size of the target space in the target network file system as a target storage space;
setting the storage type of the target storage space as the target storage type represented by the storage type identifier, and setting the access mode of the target storage space as the target access mode represented by the access mode identifier;
and binding the set target storage space with the target container group to allocate the target storage space for the target container group.
Optionally, the target network file system determining module is specifically configured to determine whether the storage space allocation request carries a network file system identifier;
if the storage space allocation request carries a network file system identifier, determining that a target network file system of the target container group request has the network file system identifier;
and if the storage space allocation request does not carry a network file system identifier, determining a target network file system of the target container group request, and corresponding to the name space identifier carried in the storage space allocation request.
Optionally, the request obtaining module is specifically configured to analyze the persistent storage declaration corresponding to the target container group to obtain a storage space allocation request of the target container group; wherein the persistent storage declaration is encapsulated when the target container group is created.
The embodiment of the invention also provides electronic equipment which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
and a processor for implementing any of the above-described memory space allocation methods when executing the program stored in the memory.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any of the above-mentioned storage space allocation methods.
Embodiments of the present invention further provide a computer program product containing instructions, which when run on a computer, cause the computer to execute any of the above-mentioned storage space allocation methods.
The embodiment of the invention has the following beneficial effects:
the embodiment of the invention provides a storage space allocation method, which comprises the steps of obtaining a storage space allocation request of a target container group in a preset container group cluster; determining a target network file system requested by a target container group according to the designated identifier in the storage space allocation request; judging whether a target network file system exists in the network file systems which are distributed for the preset container group cluster at present; if the target network file system does not exist in the network file systems which are distributed for the preset container group cluster currently, selecting one network file system from a plurality of network file systems which are not distributed currently as the target network file system, and distributing the storage space in the target network file system for the target container group according to the storage space distribution request.
Based on the above processing, if there is no target network file system requested by the target container group in the currently allocated network file system, it indicates that the target container group requests to allocate a new network file system, and therefore, one of the multiple network file systems that are not currently allocated may be selected as the network file system requested by the target container group, and a storage space satisfying the storage space allocation request is allocated for the target container group in the network file system. In other words, the storage space required by the preset container group cluster can be dynamically expanded according to the storage space allocation request, so that the storage requirement of the preset container group cluster is met.
Of course, not all of the advantages described above need to be achieved at the same time in the practice of any one product or method of the invention.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other embodiments can be obtained by referring to these drawings.
Fig. 1 is a flowchart of a storage space allocation method provided in an embodiment of the present invention;
FIG. 2 is a flowchart of another method for allocating memory space according to an embodiment of the present invention;
FIG. 3 is a flowchart of another method for allocating memory space according to an embodiment of the present invention;
FIG. 4 is a flowchart of another method for allocating memory space according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating a method for allocating a storage space according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating a system for creating a network file system according to an embodiment of the present invention;
FIG. 7 is a diagram illustrating creation of storage space in a network file system according to an embodiment of the present invention;
FIG. 8 is a flowchart illustrating the general logic processing of a method for allocating memory space in accordance with an embodiment of the present invention;
fig. 9 is a structural diagram of a storage space allocation apparatus according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of an electronic device provided in an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention are within the scope of the present invention.
An embodiment of the present invention provides a storage space allocation method, referring to fig. 1, where fig. 1 is a flowchart of the storage space allocation method, and the method may include the following steps:
s101: and acquiring a storage space allocation request of a target container group in a preset container group cluster.
S102: and determining the target network file system requested by the target container group according to the specified identifier in the storage space allocation request.
S103: judging whether a target network file system exists in the network file systems which are distributed for the preset container group cluster at present; if not, go to step S104.
S104: and selecting one network file system from a plurality of currently unallocated network file systems as a target network file system.
S105: and allocating the storage space in the target network file system for the target container group according to the storage space allocation request.
In the method provided by the embodiment of the present invention, if there is no target network file system requested by the target container group in the currently allocated network file system, it indicates that the target container group requests to allocate a new network file system, so that one of the multiple network file systems that are not currently allocated may be selected as the network file system requested by the target container group, and a storage space that meets the storage space allocation request is allocated for the target container group in the network file system. In other words, the storage space required by the preset container group cluster can be dynamically expanded according to the storage space allocation request, so that the storage requirement of the preset container group cluster is met.
In one embodiment, the method may be applied to an NFS-Client-provider plug-in (which may be referred to as a target plug-in) in a pre-set cluster of container groups. By improving an open source community tool (namely, a target plug-in) in the prior art, the target plug-in can dynamically add a plurality of network file systems for a container group cluster so as to meet the storage requirement of the container group cluster.
In step S101, in one implementation, the preset container group cluster may be kubernets (k8S), and the target container group may be any Pod (container group) in k 8S.
The k8s is a Google open-source container cluster management system, and provides a series of complete functions such as automatic deployment, resource scheduling, service discovery and dynamic scaling for containerized applications on the basis of Docker (application container engine) technology, so that the convenience of large-scale container cluster management is improved. The Pod is the smallest unit that K8s creates, schedules, and manages, and a Pod may contain one container or multiple related containers. The containers contained within the Pod run on the same host, using the same namespace, IP address, and port, and are able to communicate through a LocalHost. A container is a collection of files for an application (which may be a WEB application or a database application, etc.) and its operating environment (which may include a configuration environment, an operating dependency package, etc.). The application program and the running environment thereof are packaged into a container through a Docker technology, so that the container can realize cross-server and cross-platform deployment.
A preset container group cluster may contain multiple container groups, and for one container group, the container group may specify using a separate network file system or sharing one network file system with other container groups. While for a network file system, the performance of its I/O (Input/Output) interface is fixed. Therefore, for two container groups with different requirements on the I/O performance, the two container groups can respectively request network file systems with different I/O interface performances, and the influence of the container group with higher I/O performance requirements on the container group with lower I/O performance requirements can be effectively avoided.
For step S102, when creating the container group, the specified identifier may be encapsulated in a corresponding PVC (Persistent Volume Claim), so that the storage space allocation request carries the specified identifier, that is, the container group may request a network file system corresponding to the specified identifier to store data.
In one embodiment, referring to fig. 2, on the basis of fig. 1, the step S102 may include the following steps:
s1021: and judging whether the storage space allocation request carries a network file system identifier, if so, executing step S1022, and if not, executing step S1023.
S1022: it is determined that the target network file system of the target container group request has a network file system identification.
S1023: and determining a target network file system requested by the target container group, wherein the target network file system corresponds to the namespace identifier carried in the storage space allocation request.
In one implementation, the network file system identifier may be an Identity Document (ID) of the network file system. For example, when each network file system is allocated to a container group in a preset container group cluster, the target plug-in may set a unique identifier for the network file system as the ID of the network file system. In addition, when the target plug-in allocates a network file system for a container group, it may also record that the network file system corresponds to a NameSpace (NameSpace) to which the container group belongs.
If the storage space allocation request has the network file system identification, the target container group is indicated to be assigned with the required network file system, and the network file system is assigned as the currently allocated network file system. That is, the target container group requests to share a network file system with other container groups, and therefore, the target plug-in takes the allocated network file system having the network file system identifier as the network file system requested by the target container group. In this way, custom allocation of storage space may be achieved.
If the network file system identifier does not exist in the storage space allocation request, which indicates that the target container group does not specify the network file system, the target plug-in may extract the namespace identifier (i.e., the parameter representing the field of the namespace) carried in the storage space allocation request, and determine that the network file system requested by the target container group corresponds to the namespace identifier. Therefore, the container groups in the same name space use the same network file system, namely, the container groups in the same name space are stored and shared, so that the container groups in the same name space can be stored and managed in a centralized manner, and the efficiency of data interaction among the container groups in the same name space is improved.
The target plug-in may apply for a network file system from the storage management device. For example, the storage space management device may be an IaaS (Infrastructure as a Service) Service-based device. IaaS is a service that can be provided to the outside over a network based on network infrastructure, and network infrastructure equipment may include: processing CPU, memory, storage, network and other basic computing resources. The user may then deploy and run software in the network infrastructure provided by IaaS, and the running software may include: an operating system and an application program.
In one implementation, when a network file system is allocated to a cluster of a preset container group, the target plug-in may register the network file system and record information of the network file system. For example, the preset container group cluster may create a network file system resource list, and record network file system identifications and network file system information (including addresses of the network file systems, sizes of storage spaces that the network file systems can provide, and name space identifications corresponding to the network file systems, etc.) of all the allocated network file systems. The target plug-in can judge whether the network file system requested by the target container group exists through the network file system resource list.
For step S103, if the storage space allocation request carries the network file system identifier, the target plug-in may query the network file system having the network file system identifier in the allocated network file system, that is, determine the network file system specified by the target container group from the allocated network file system.
If the storage space allocation request does not carry the network file system identifier, the target plug-in may query whether a network file system corresponding to the namespace identifier in the storage space allocation request exists in the allocated network file system.
In one implementation, if the network file system specified by the target container group does not exist in the allocated network file systems, step S104 is performed. The target plug-in may apply for a new network file system, i.e. select a network file system from a plurality of network file systems that are currently unassigned. Accordingly, the target set of containers may use the network file system, i.e., the target plug-in may allocate storage space for the target set of containers in the storage space of the network file system.
In one embodiment, the step S101 may include: and analyzing the persistent storage statement corresponding to the target container group to obtain a storage space allocation request of the target container group.
And the persistent storage statement corresponding to the target container group is obtained by encapsulation when the target container group is created.
In the embodiment of the present invention, when the preset container group cluster creates the target container group, the persistent storage declaration corresponding to the target container group may be encapsulated. The persistent storage declaration may record information of the target container group, such as a name of the target container group, a namespace identification and creation time of a namespace to which the target container group belongs, and a storage allocation request of the target container group. The storage allocation request may record a storage type identifier, a target space size, an access mode identifier, and the like. Correspondingly, the target plug-in can monitor the persistent storage statement in the preset container group cluster, and when the persistent storage statement of the target container group is monitored, the persistent storage statement of the target container group can be analyzed to obtain the storage space allocation request of the target container group.
For example, the following information may be included in the storage space allocation request:
ObjectMeta{Name:stsbox-stsbox2-0,Namespace:test01,
Annotations:map[string]string{nfs:name}
}
the ObjectMeta indicates the request object metadata of the storage space allocation request, and the information in the following parentheses indicates the specific information carried in the storage space allocation request. Name is a field indicating the Name of the group of containers, and stsbox-stsbox2-0 indicates the specific parameter of the field, i.e., the Name of the group of containers; namespace is a field for representing the name space identification of the name space to which the container group belongs, and test01 represents the specific parameter of the field, namely the name space identification of the name space to which the container group belongs; the Annotations represent annotation information, wherein map [ string ] string { nfs: name } represents a map object corresponding to the network file system identifier defined in the storage space allocation request, and the type of the object is string. nfs is a field representing the network file system identifier, and name represents the specific parameter of the field, i.e., the network file system identifier of the network file system specified by the container group.
In one embodiment, referring to fig. 3, on the basis of fig. 1, after step S103, if there is a target network file system in the network file systems currently allocated for the preset container group cluster, step S105 is directly performed.
In one implementation, if a target network file system requested by a target container group exists in the allocated network file systems, it indicates that the target network file system is already allocated to a preset container group cluster, and the current target container group needs to share the same network file system with other container groups. The target plug-in allocates storage space for the target container group in the storage space of the network file system, and the allocated storage space is storage space other than the storage space that has been previously allocated for other container groups.
In one embodiment, referring to fig. 4, on the basis of fig. 3, step S105 may include:
s1051: and determining a storage space with the size of the target space in the target network file system as a target storage space.
S1052: setting the storage type of the target storage space as the target storage type represented by the storage type identification, and setting the access mode of the target storage space as the target access mode represented by the access mode identification.
S1053: and binding the set target storage space with the target container group to allocate the target storage space for the target container group.
The method of the embodiment of the invention can allocate the storage space matched with the storage type, the size and the access mode indicated by the target container group for the target container group in the target network file system.
In one implementation, the storage space allocation request carries a storage type identifier, a target space size, and an access mode identifier. The storage types may include: SSD (Solid State Disk), Block-Device (Block Device), etc., which are not limited herein. The access patterns may include: data accessor schema, active domain object schema, object relational mapping schema, and the like, are not limited herein.
In one implementation, the set target storage space (hereinafter referred to as Persistent storage (PV)) is bound to the target container group, that is, the PV is bound to the PVC of the target container group.
Referring to fig. 5, fig. 5 is a schematic diagram of a storage space allocation method according to an embodiment of the present invention.
In fig. 5, a persistent storage declaration-Request (PVC-Request), that is, a storage space allocation Request sent by a target container group in the embodiment of the present invention, is shown. After receiving the storage space allocation request, the target plug-in may select the resource pool, that is, determine whether the target network file system requested by the target container group exists in the allocated network file system according to the specified identifier in the storage space allocation request. If not, a resource pool may be created, i.e., one selected from the unallocated network file systems as the target network file system requested by the target container group. The target plug-in then allocates storage resources, i.e. allocates storage space in the target network file system for the target group of containers according to the above-mentioned persistent storage declaration-request, and can get a persistent storage-Location (PV-Location), which represents the address of the allocated target storage space, which is used for the target group of containers to address the target storage space.
Referring to fig. 6, fig. 6 is a schematic diagram of creating a network file system according to an embodiment of the present invention.
The target plug-in (i.e., the network file system client provider plug-in) may record, in the network file system resource list, the network file system identifier of the network file system allocated to the preset container group cluster and the corresponding network file system information. nfs1 and nfs2 represent network file system identifications of the allocated network file systems, and nfs-info represents corresponding network file system information. According to the network file system resource list, the target plug-in can judge whether a target network file system requested by the target container group exists in the network file system which is currently distributed for the preset container group cluster. If the network file system does not exist, the target plug-in can apply for a new network file system from the infrastructure, i.e. the service, as the target network file system, and register the new network file system in the plug-in, i.e. record the network file system identification (i.e. nfs-new) of the newly applied network file system and the corresponding network file system information in the network file system resource list.
Referring to fig. 7, fig. 7 is a schematic diagram of allocating storage space in a network file system according to an embodiment of the present invention.
After determining the target network file system based on the network file system resource list, the target plug-in may allocate, based on the storage space allocation request, a target storage space of a corresponding size in the target network file system to the target container group, and may also obtain an address (i.e., a persistent storage-location) of the target storage space. Then, the storage type of the target storage space and the access mode of the target storage space are set according to the storage space allocation request, and the storage space allocated for the target container group (i.e. persistent storage) is obtained. nfs1 and nfs2 represent network file system identifications of the allocated network file systems, and nfs-info represents corresponding network file system information. nfs-new represents the network file system identification of the newly applied network file system.
Referring to fig. 8, fig. 8 is a flowchart illustrating a general logic process of a method for allocating a storage space according to an embodiment of the present invention.
The target plug-in (i.e., network file system client provider plug-in) may receive the persistent storage claim-request (i.e., storage allocation request) sent by the target container group, and may then determine the target network file system requested by the target container group based on the specified identification in the persistent storage claim-request. That is, if the persistent storage declaration-request carries a network file system identifier, determining that the target network file system of the target container group request has the network file system identifier; and if the network file system identifier is not carried in the persistent storage declaration-request, determining that the target network file system of the target container group request corresponds to the name space identifier carried in the persistent storage declaration-request.
Further, the target plug-in determines whether the target network file system is recorded in the network file system resource list, that is, determines whether the target network file system exists in the currently allocated network file system. In fig. 8, a network file system identifier a, a network file system identifier b, and a network file system identifier c represent network file system identifiers of the allocated network file systems recorded in the network file system resource list.
If not, the target plug-in applies a new network file system to the infrastructure as a service and registers the new network file system in the plug-in. In fig. 8, network file system identifier-new indicates the network file system identifier of the new network file system recorded in the network file system resource list.
A directory is allocated from the new network file system as a source of the persistent storage mount, i.e. the storage space in the new network file system is allocated to the target group of containers according to the persistent storage declaration-request, the address of the allocated storage space being the allocated directory. In turn, a persistent storage declaration-Response (PVC-Response) may be obtained and sent to the target set of containers, with the address of the allocated storage space being carried in the persistent storage declaration-Response.
Based on the same inventive concept, an embodiment of the present invention further provides a storage space allocation apparatus, referring to fig. 9, where fig. 9 is a structural diagram of the storage space allocation apparatus, and the apparatus includes:
a request obtaining module 901, configured to obtain a storage space allocation request of a target container group in a preset container group cluster;
a target network file system determining module 902, configured to determine, according to the specified identifier in the storage space allocation request, a target network file system requested by the target container group;
a determining module 903, configured to determine whether the target network file system exists in the network file systems currently allocated to the preset container group cluster;
a storage space allocation module 904, configured to, if the target network file system does not exist in the network file systems currently allocated to the preset container group cluster, select one network file system from multiple network file systems currently not allocated as the target network file system, and allocate a storage space in the target network file system for the target container group according to the storage space allocation request.
Optionally, the storage space allocation module 904 is further configured to, if the target network file system exists in the network file system currently allocated to the preset container group cluster, allocate a storage space in the target network file system to the target container group according to the storage space allocation request.
Optionally, the storage space allocation request carries a storage type identifier, a target space size, and an access mode identifier;
the storage space allocation module 904 is specifically configured to determine a storage space of the size of the target space in the target network file system as a target storage space;
setting the storage type of the target storage space as the target storage type represented by the storage type identifier, and setting the access mode of the target storage space as the target access mode represented by the access mode identifier;
and binding the set target storage space with the target container group to allocate the target storage space for the target container group.
Optionally, the target network file system determining module 902 is specifically configured to determine whether the storage space allocation request carries a network file system identifier;
if the storage space allocation request carries a network file system identifier, determining that a target network file system of the target container group request has the network file system identifier;
and if the storage space allocation request does not carry a network file system identifier, determining a target network file system of the target container group request, and corresponding to the name space identifier carried in the storage space allocation request.
Optionally, the request obtaining module 901 is specifically configured to analyze the persistent storage declaration corresponding to the target container group to obtain a storage space allocation request of the target container group; wherein the persistent storage declaration is encapsulated when the target container group is created.
The embodiment of the present invention further provides an electronic device, as shown in fig. 10, which includes a processor 1001, a communication interface 1002, a memory 1003 and a communication bus 1004, wherein the processor 1001, the communication interface 1002 and the memory 1003 complete mutual communication through the communication bus 1004,
a memory 1003 for storing a computer program;
the processor 1001 is configured to implement the following steps when executing the program stored in the memory 1003:
acquiring a storage space allocation request of a target container group in a preset container group cluster;
determining a target network file system requested by the target container group according to the designated identifier in the storage space allocation request;
judging whether the target network file system exists in the network file systems which are distributed for the preset container group cluster currently;
if the target network file system does not exist in the network file systems which are distributed for the preset container group cluster currently, selecting one network file system from a plurality of network file systems which are not distributed currently as the target network file system, and distributing the storage space in the target network file system for the target container group according to the storage space distribution request.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In another embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of any of the above-mentioned storage space allocation methods.
In yet another embodiment, a computer program product containing instructions is provided, which when run on a computer causes the computer to perform any of the above-described memory space allocation methods.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus, the electronic device, and the computer-readable storage medium, and the computer program product embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and in relation to them, reference may be made to the partial description of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (12)

1. A method for allocating storage space, the method comprising:
acquiring a storage space allocation request of a target container group in a preset container group cluster;
determining a target network file system requested by the target container group according to the designated identifier in the storage space allocation request;
judging whether the target network file system exists in the network file systems which are distributed for the preset container group cluster currently;
if the target network file system does not exist in the network file systems which are distributed for the preset container group cluster currently, selecting one network file system from a plurality of network file systems which are not distributed currently as the target network file system, and distributing the storage space in the target network file system for the target container group according to the storage space distribution request.
2. The method of claim 1, further comprising:
and if the target network file system exists in the network file system which is currently distributed to the preset container group cluster, distributing the storage space in the target network file system for the target container group according to the storage space distribution request.
3. The method according to claim 1 or 2, wherein the storage space allocation request carries a storage type identifier, a target space size, and an access mode identifier;
the allocating storage space in the target network file system for the target container group according to the storage space allocation request comprises:
determining a storage space with the size of the target space in the target network file system as a target storage space;
setting the storage type of the target storage space as the target storage type represented by the storage type identifier, and setting the access mode of the target storage space as the target access mode represented by the access mode identifier;
and binding the set target storage space with the target container group to allocate the target storage space for the target container group.
4. The method of claim 1, wherein determining the target network file system requested by the target container group according to the specified identifier in the storage allocation request comprises:
judging whether the storage space allocation request carries a network file system identifier or not;
if the storage space allocation request carries a network file system identifier, determining that a target network file system of the target container group request has the network file system identifier;
and if the storage space allocation request does not carry a network file system identifier, determining a target network file system of the target container group request, and corresponding to the name space identifier carried in the storage space allocation request.
5. The method according to claim 1, wherein the obtaining a storage space allocation request of a target container group in a preset container group cluster comprises:
analyzing the persistent storage statement corresponding to the target container group to obtain a storage space allocation request of the target container group; wherein the persistent storage declaration is encapsulated when the target container group is created.
6. A storage space allocation apparatus, the apparatus comprising:
the request acquisition module is used for acquiring a storage space allocation request of a target container group in a preset container group cluster;
a target network file system determining module, configured to determine a target network file system requested by the target container group according to the specified identifier in the storage space allocation request;
the judging module is used for judging whether the target network file system exists in the network file system which is currently distributed to the preset container group cluster;
and the storage space allocation module is used for selecting one network file system from a plurality of currently unallocated network file systems as the target network file system if the target network file system does not exist in the network file systems which are currently allocated to the preset container group cluster, and allocating the storage space in the target network file system for the target container group according to the storage space allocation request.
7. The apparatus according to claim 6, wherein the storage space allocation module is further configured to, if the target network file system exists in the network file systems currently allocated for the preset container group cluster, allocate storage space in the target network file system for the target container group according to the storage space allocation request.
8. The apparatus according to claim 6 or 7, wherein the storage space allocation request carries a storage type identifier, a target space size, and an access mode identifier;
the storage space allocation module is specifically configured to determine a storage space of the size of the target space in the target network file system as a target storage space;
setting the storage type of the target storage space as the target storage type represented by the storage type identifier, and setting the access mode of the target storage space as the target access mode represented by the access mode identifier;
and binding the set target storage space with the target container group to allocate the target storage space for the target container group.
9. The apparatus according to claim 6, wherein the target network file system determining module is specifically configured to determine whether the storage space allocation request carries a network file system identifier;
if the storage space allocation request carries a network file system identifier, determining that a target network file system of the target container group request has the network file system identifier;
and if the storage space allocation request does not carry a network file system identifier, determining a target network file system of the target container group request, and corresponding to the name space identifier carried in the storage space allocation request.
10. The apparatus of claim 6,
the request acquisition module is specifically configured to analyze the persistent storage declaration corresponding to the target container group to obtain a storage space allocation request of the target container group; wherein the persistent storage declaration is encapsulated when the target container group is created.
11. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 5 when executing a program stored in the memory.
12. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 1-5.
CN202210005407.8A 2022-01-04 2022-01-04 Storage space allocation method and device Pending CN114415952A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210005407.8A CN114415952A (en) 2022-01-04 2022-01-04 Storage space allocation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210005407.8A CN114415952A (en) 2022-01-04 2022-01-04 Storage space allocation method and device

Publications (1)

Publication Number Publication Date
CN114415952A true CN114415952A (en) 2022-04-29

Family

ID=81272110

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210005407.8A Pending CN114415952A (en) 2022-01-04 2022-01-04 Storage space allocation method and device

Country Status (1)

Country Link
CN (1) CN114415952A (en)

Similar Documents

Publication Publication Date Title
KR101994021B1 (en) File manipulation method and apparatus
EP3631612B1 (en) File system for shingled magnetic recording (smr)
WO2016180055A1 (en) Method, device and system for storing and reading data
CN107562757B (en) Query and access method, device and system based on distributed file system
US11048591B1 (en) Efficient name space organization in a global name space cluster
US9400792B1 (en) File system inline fine grained tiering
US11301421B2 (en) Scalable multi-tier storage structures and techniques for accessing entries therein
CN111597148B (en) Distributed metadata management method for distributed file system
WO2017016423A1 (en) Real-time new data update method and device
US9940331B1 (en) Proactive scavenging of file system snaps
US8347293B2 (en) Mutual exclusion domains to perform file system processes on stripes
US20170262463A1 (en) Method and system for managing shrinking inode file space consumption using file trim operations
WO2022120522A1 (en) Memory space allocation method and device, and storage medium
US9177034B2 (en) Searchable data in an object storage system
CN108228197B (en) Method and device for installing software in cluster
US10592469B1 (en) Converting files between thinly and thickly provisioned states
US11625192B2 (en) Peer storage compute sharing using memory buffer
CN109947667B (en) Data access prediction method and device
CN101483668A (en) Network storage and access method, device and system for hot spot data
CN114730307A (en) Intelligent data pool
KR20130022093A (en) Apparatus and method for managing compressed image file in cloud computing system
CN114415952A (en) Storage space allocation method and device
WO2021248972A1 (en) Default gateway management method, gateway manager, server, and storage medium
CN114415950A (en) Storage space allocation method and device
CN110347751B (en) Method and device for managing CDN system service attribute

Legal Events

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