CN115391277A - Method, device, equipment and medium for detecting directory capacity quota - Google Patents

Method, device, equipment and medium for detecting directory capacity quota Download PDF

Info

Publication number
CN115391277A
CN115391277A CN202211027075.XA CN202211027075A CN115391277A CN 115391277 A CN115391277 A CN 115391277A CN 202211027075 A CN202211027075 A CN 202211027075A CN 115391277 A CN115391277 A CN 115391277A
Authority
CN
China
Prior art keywords
directory
user
creating
cifs
target
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
CN202211027075.XA
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.)
Inspur Jinan data Technology Co ltd
Original Assignee
Inspur Jinan data 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 Inspur Jinan data Technology Co ltd filed Critical Inspur Jinan data Technology Co ltd
Priority to CN202211027075.XA priority Critical patent/CN115391277A/en
Publication of CN115391277A publication Critical patent/CN115391277A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/11File system administration, e.g. details of archiving or snapshots
    • G06F16/122File system administration, e.g. details of archiving or snapshots using management policies
    • 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/16File or folder operations, e.g. details of user interfaces specifically adapted to file 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
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems

Landscapes

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

Abstract

The application discloses a method, a device, equipment and a medium for detecting directory capacity quota, which relate to the technical field of mass distributed storage and comprise the following steps: creating a target directory and an authentication user group, creating a first authentication user and a second authentication user, and setting a directory capacity quota for the target directory; creating a CIFS share at a client, and creating a first target file with a file size of a first preset numerical value, which corresponds to a first authentication user, in a CIFS mount directory; creating a local user group bound with the authentication user group and a local user bound with a second authentication user at the client, creating NFS sharing, and then creating a second target file with the file size corresponding to the local user being a second preset value in an NFS mounting directory; and checking and judging whether the current directory quotas respectively corresponding to the first authentication user and the second authentication user are consistent with a first preset value and a second preset value. The method can support the detection of the target capacity quota and improve the robustness of the system.

Description

Method, device, equipment and medium for detecting directory capacity quota
Technical Field
The present invention relates to the field of mass distributed storage technologies, and in particular, to a method, an apparatus, a device, and a medium for detecting a directory capacity quota.
Background
Automatic operation of mass storage is widely applied in the fields of IT enterprises, cloud computing, big data, virtualization and the like. Meanwhile, the quota scene requirements of the distributed file systems in the fields are higher and higher, and only the functions of the directory capacity quota, the user capacity quota and the user group capacity quota cannot meet the use requirements of users, and the functions such as local multi-user default capacity quota are required for supplement. Because the automatic platform of the current mass storage distributed system lacks the function of supporting the detection of the related operations such as local multi-user default directory capacity quota and soft and hard threshold value alarm, the robustness, usability and function richness of the system are affected, and the competitiveness of the mass storage automatic platform is seriously affected.
In summary, how to detect the directory capacity quota to improve the robustness, usability and function richness of the system is a problem to be solved at present.
Disclosure of Invention
In view of this, an object of the present invention is to provide a method, an apparatus, a device and a medium for detecting a directory capacity quota, which can detect a directory capacity quota, so as to improve robustness, usability and function richness of a system. The specific scheme is as follows:
in a first aspect, the present application discloses a method for detecting a directory capacity quota, including:
creating a target directory and an authentication user group, creating a first authentication user and a second authentication user in the authentication user group, and setting a directory capacity quota for the target directory;
creating a CIFS (common information file system) share based on the target directory at a client, and creating a first target file of which the file size corresponding to the first authentication user is a first preset numerical value in a CIFS mount directory;
creating a local user group bound with the authentication user group and a local user bound with the second authentication user in the local user group at a client, creating NFS sharing based on the target directory, and then creating a second target file with a file size corresponding to the local user as a second preset value in the NFS mounting directory;
and checking and judging whether the current directory quotas respectively corresponding to the first authenticated user and the second authenticated user are consistent with the first preset value and the second preset value.
Optionally, the setting of the directory capacity quota for the target directory includes:
and setting a directory capacity quota comprising a preset soft threshold and a preset hard threshold for the target directory.
Optionally, the creating, at the client, a local user group bound to the authentication user group and creating a local user bound to the second authentication user in the local user group include:
acquiring a user group ID of the authentication user group, creating a local user group at a client based on the user group ID, acquiring a user ID of the second authentication user, and creating a local user at the client based on the user ID;
and distributing the local users to the local user groups.
Optionally, before creating the target directory and authenticating the user group, the method further includes:
judging whether the current environment meets a preset condition or not;
if yes, executing the steps of creating the target directory and authenticating the user group;
if not, adjusting the current environment so that the adjusted current environment meets the preset condition.
Optionally, the determining whether the current environment meets a preset condition includes:
judging whether the current cluster is not configured with an active directory domain, and judging whether a directory capacity quota function option, a CIFS service and an NFS service are started;
correspondingly, if not, adjusting the current environment includes:
if the current cluster is configured with the active directory domain, exiting the active directory domain;
if the directory capacity quota function option, the CIFS service, and the NFS service are not opened, the directory capacity quota function option, the CIFS service, and the NFS service are opened.
Optionally, the creating, at the client, a CIFS share based on the target directory includes:
setting CIFS sharing based on the target directory, the first authentication user and a predefined CIFS sharing name, and verifying whether the setting of the CIFS sharing is successful;
and if the CIFS sharing setting is successful, creating CIFS sharing and setting a CIFS mounting directory.
Optionally, the checking and determining whether the current directory quotas respectively corresponding to the first authenticated user and the second authenticated user are consistent with the first preset value and the second preset value includes:
checking the current directory quota, judging whether the capacity usage of the first authenticated user is consistent with the first preset value or not, and judging whether the capacity usage of the second authenticated user is consistent with the second preset value or not;
and if the contents are inconsistent with the preset contents, prompting error reporting information on a preset directory capacity quota interface.
In a second aspect, the present application discloses a device for detecting a directory capacity quota, including:
the parameter creating module is used for creating a target directory and an authentication user group, creating a first authentication user and a second authentication user in the authentication user group, and setting a directory capacity quota for the target directory;
the CIFS mount module is used for creating a CIFS share on the basis of the target directory at the client side and creating a first target file of which the file size corresponding to the first authentication user is a first preset numerical value in the CIFS mount directory;
the NFS mounting module is used for creating a local user group bound with the authentication user group and a local user bound with the second authentication user in the local user group at a client, creating NFS sharing based on the target directory, and then creating a second target file of which the file size corresponding to the local user is a second preset value in the NFS mounting directory;
and the detection module is used for checking and judging whether the current directory quotas respectively corresponding to the first authenticated user and the second authenticated user are consistent with the first preset value and the second preset value.
In a third aspect, the present application discloses an electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the steps of the directory capacity quota detecting method disclosed in the foregoing.
In a fourth aspect, the present application discloses a computer readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the steps of the directory capacity quota detection method disclosed in the foregoing.
Therefore, a target directory and an authentication user group are created, a first authentication user and a second authentication user in the authentication user group are created, and a directory capacity quota is set for the target directory; creating a CIFS (common information file system) share based on the target directory at a client, and creating a first target file of which the file size corresponding to the first authentication user is a first preset numerical value in a CIFS mount directory; creating a local user group bound with the authentication user group and a local user bound with the second authentication user in the local user group at a client, creating NFS sharing based on the target directory, and then creating a second target file of which the file size corresponding to the local user is a second preset value in the NFS mounting directory; and checking and judging whether the current directory quotas respectively corresponding to the first authenticated user and the second authenticated user are consistent with the first preset value and the second preset value. Therefore, the target directory, the authentication user group, the first authentication user and the second authentication user belonging to the authentication user group are created firstly; then respectively creating CIFS sharing and NFS sharing, writing a first target file with the file size of a first preset value corresponding to a first authenticated user in a CIFS mount directory, and writing a second target file with the file size of a second preset value corresponding to a local user in an NFS mount directory, wherein the local user and the second authenticated user establish a binding relationship, namely the first target file and the second target file respectively belong to the first authenticated user and the second authenticated user; and finally, the current directory quotas corresponding to the first authentication user and the second authentication user can be checked, and whether the current directory quotas are consistent with the first preset value and the second preset value respectively or not can be judged. That is, the technical scheme can support the detection of the directory capacity quota, so as to further improve the robustness, usability and functional richness of the system and improve the competitiveness of the mass storage automation platform.
Drawings
In order to more clearly illustrate the embodiments of the present application 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 embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a directory capacity quota detection method disclosed in the present application;
fig. 2 is a flowchart of a specific directory capacity quota detection method disclosed in the present application;
FIG. 3 is a diagram illustrating a specific directory capacity quota process disclosed herein;
fig. 4 is a schematic structural diagram of a directory capacity quota detection apparatus disclosed in the present application;
fig. 5 is a block diagram of an electronic device disclosed in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The existing automation platform of the mass storage distributed system lacks functions of supporting detection of related operations such as local multi-user default directory capacity quota and soft and hard threshold value alarm, so that the robustness, usability and function richness of the system are affected, and the competitiveness of the mass storage automation platform is seriously affected. Therefore, the embodiment of the application discloses a method, a device, equipment and a medium for detecting the directory capacity quota, which can realize the detection of the directory capacity quota so as to improve the robustness, the usability and the function richness of a system.
Referring to fig. 1, an embodiment of the present application discloses a method for detecting a directory capacity quota, where the method includes:
step S11: creating a target directory and an authentication user group, creating a first authentication user and a second authentication user in the authentication user group, and setting a directory capacity quota for the target directory.
In this embodiment, a target directory is created by using create _ directory ($ DIR _ NAME), then a local authenticated user GROUP of linux is created by using create _ authenticated _ user _ GROUP ($ AUTH _ GROUP), and an authenticated user GROUP ID $ AUTH _ GROUP _ ID is recorded and persistently stored. And creating two local authenticated USERs, specifically creating a first authenticated USER by using create _ authenticated _ USER ($ AUTH _ USER _ 1), and recording a USER ID of the first authenticated USER: $ AUTH _ USER _ ID1 and create a second authenticated USER using create _ authenticated _ USER ($ AUTH _ USER _ 2), and record the USER ID of the second authenticated USER: $ AUTH _ USER _ ID2; wherein the first authenticated user and the second authenticated user belong to an authenticated user group. A target capacity quota is then set for the target directory.
It should be noted that, before creating the target directory and authenticating the user group, the method further includes: judging whether the current environment meets a preset condition or not; if yes, executing the steps of creating the target directory and authenticating the user group; if not, adjusting the current environment so that the adjusted current environment meets the preset condition. That is, the steps of creating the target directory and authenticating the user group are executed only when the current environment meets the preset condition, and if the current environment does not meet the preset condition, the current environment needs to be adjusted so that the adjusted current environment meets the preset condition. Specifically, the above determining whether the current environment meets the preset condition includes: judging whether the current cluster is not configured with an active directory domain, and judging whether a directory capacity quota function option, a CIFS service and an NFS service are started; correspondingly, if not, adjusting the current environment includes: if the current cluster is configured with an active directory domain, exiting the active directory domain; if the directory capacity quota function option, the CIFS service, and the NFS service are not opened, the directory capacity quota function option, the CIFS service, and the NFS service are opened. In a specific embodiment, firstly, whether an active directory domain (namely an AD domain) is configured in a current cluster is judged through get _ all _ AD _ domain _ list (), if the active directory domain is configured, an error is reported, and the domain needs to be manually returned; get _ ctdb _ vir _ IP _ list () is also needed to obtain the trillion ctdb virtual IP of the cluster for later NFS mounting; using get _ default _ quota _ status () to judge whether the default directory capacity quota function option is opened or not, and if not, opening the default directory capacity quota function option; using get _ CIFS _ service _ status () to obtain whether CIFS service is started, otherwise, executing starting operation; then get _ NFS _ service _ status () is used to get whether the NFS service is turned on, otherwise the turn-on operation is performed.
Step S12: and creating a CIFS share based on the target directory at the client, and creating a first target file of which the file size corresponding to the first authentication user is a first preset numerical value in a CIFS mount directory.
In this embodiment, a CIFS share is created at a client based on a target directory, and a first target file having a file size corresponding to a first authenticated user as a first preset value is created in a CIFS mount directory. It should be noted that the first authenticated USER $ AUTH _ USER _1 is used for CIFS shared MOUNT, the shared NAME of CIFS is $ CIFS _ SHARE _ NAME, the USER TYPE of the local authenticated USER is $ USER _ TYPE, the password of the local authenticated USER is $ AUTH _ paswd, the VIRTUAL IP is $ client _ virtualip, the MOUNT directory mounted to the client in the CIFS mode is $ CIFS _ MOUNT _ DIR, the FILE to be created is the first target FILE, the FILE NAME is $ FILE _ NAME _1, the FILE size is the FILE size, i.e. the first preset value is $ capability 1, the USER to which the created FILE belongs is the first authenticated USER $ AUTH _ USER _1, and the authenticated USER GROUP is $ AUTH _ GROUP.
Step S13: and creating a local user group bound with the authentication user group and a local user bound with the second authentication user in the local user group at a client, creating NFS sharing based on the target directory, and then creating a second target file with a file size of a second preset value corresponding to the local user in the NFS mounting directory.
In this embodiment, a local USER GROUP bound to an authenticated USER GROUP is created at the CLIENT and a local USER bound to a second authenticated USER in the local USER GROUP is created, in a specific embodiment, linux local USER GROUP $ CLIENT _ GROUP capable of being bound to an authenticated USER GROUP $ AUTH _ GROUP of a cluster may be created at the CLIENT through GROUP _ add ($ AUTH _ GROUP, $ AUTH _ GROUP _ ID), and linux local USER GROUP $ 2 capable of being bound to an authenticated USER GROUP $ AUTH _ USER _2 of the cluster may be created through USER _ add ($ AUTH _ USER _2, $ AUTH _ USER _ ID 2). And then, creating an NFS share based on the target directory at the client, and creating a second target file with the file size corresponding to the local user being a second preset value in the NFS mount directory. In a specific embodiment, a $ DIR _ NAME shared directory is mounted on a CLIENT through NFS _ MOUNT ($ VIRTUAL _ IP, $ DIR _ NAME, $ NFS _ MOUNT _ DIR), the CLIENT is logged in by using $ CLIENT _ USER _2, and $ FILE _ NAME _2 is written in the mounted directory $ NFS _ MOUNT _ DIR, so that the FILE of the $ FILE _ NAME _2 belongs to the USER of $ CLIENT _ USER _2; it should be noted that, since the second authenticated USER $ AUTH _ USER _2 is bound to the local USER $ CLIENT _ USER _2, which is to be used for NFS MOUNT, the MOUNT directory mounted to the CLIENT in the NFS manner is $ NFS _ MOUNT _ DIR, the FILE to be created is a second target FILE, the FILE NAME is $ FILE _ NAME _2, the FILE size is a second preset value $ capability 2, and then the USER to which the created FILE belongs is the second authenticated USER $ AUTH _ USER _2, and the authentication USER GROUP belongs is $ AUTH _ GROUP.
Step S14: and checking and judging whether the current directory quotas respectively corresponding to the first authenticated user and the second authenticated user are consistent with the first preset value and the second preset value.
In this embodiment, it may be specifically checked on the management software whether the CAPACITY size of the current directory quota corresponding to the first authenticated user and the second authenticated user is a value of the size of the file written in each of the first authenticated user and the second authenticated user, that is, a first preset value $ capability 1 and a second preset value $ capability 2.
Therefore, a target directory and an authentication user group are created, a first authentication user and a second authentication user in the authentication user group are created, and a directory capacity quota is set for the target directory; creating a CIFS (common information file system) share based on the target directory at a client, and creating a first target file of which the file size corresponding to the first authentication user is a first preset numerical value in a CIFS mount directory; creating a local user group bound with the authentication user group and a local user bound with the second authentication user in the local user group at a client, creating NFS sharing based on the target directory, and then creating a second target file of which the file size corresponding to the local user is a second preset value in the NFS mounting directory; and checking and judging whether the current directory quotas respectively corresponding to the first authenticated user and the second authenticated user are consistent with the first preset value and the second preset value. Therefore, the target directory, the authentication user group, the first authentication user and the second authentication user belonging to the authentication user group are created firstly; then respectively creating CIFS sharing and NFS sharing, writing a first target file with the file size of a first preset value corresponding to a first authenticated user in a CIFS mount directory, and writing a second target file with the file size of a second preset value corresponding to a local user in an NFS mount directory, wherein the local user and the second authenticated user establish a binding relationship, namely the first target file and the second target file respectively belong to the first authenticated user and the second authenticated user; and finally, the current directory quotas corresponding to the first authentication user and the second authentication user can be checked, and whether the current directory quotas are consistent with the first preset value and the second preset value respectively or not can be judged. That is, the technical scheme can support the detection of the directory capacity quota, so as to further improve the robustness, the usability and the function richness of the system and improve the competitiveness of the mass storage automation platform.
Referring to fig. 2, an embodiment of the present application discloses a specific method for detecting a directory capacity quota, and this embodiment further describes and optimizes a technical solution with respect to the previous embodiment. The method specifically comprises the following steps:
step S21: creating a target directory and an authentication user group, creating a first authentication user and a second authentication user in the authentication user group, and setting a directory capacity quota comprising a preset soft threshold and a preset hard threshold for the target directory.
In this embodiment, when the directory capacity quota is set for the target directory, a default directory capacity quota may be specifically set using set _ default _ directory _ quota ($ DIR _ NAME, $ AUTH _ GROUP, $ HARD _ VALUE, $ HARD _ UNIT, $ SOFT _ VALUE, $ SOFT _ UNIT); wherein the HARD threshold is $ HARD _ VALUE, and the UNIT is $ HARD _ UNIT; the SOFT threshold is $ SOFT _ VALUE in UNITs of $ SOFT _ UNIT. Wherein, the hard threshold is a threshold which can not be exceeded by the detected data; the soft threshold defines the range of variation of the detected data. Further, as shown in fig. 3, it is also necessary to use search _ default _ directory _ quota ($ DIR _ NAME, $ AUTH _ GROUP) to check whether the setting value of the default directory quota is consistent with the expectation. If the code is consistent with the preset code, the code return value is 1, and the setting is successful; if not, the code return value is 0 and an error is reported, indicating that the setting is failed.
Step S22: and setting CIFS sharing based on the target directory, the first authentication user and a predefined CIFS sharing name, and verifying whether the setting of the CIFS sharing is successful.
In this embodiment, CIFS sharing is set based on a target directory, a first authenticated USER, and a predefined CIFS sharing NAME, specifically, CIFS sharing is set through set _ CIFS _ SHARE ($ DIR _ NAME, $ CIFS _ SHARE _ NAME, $ AUTH _ USER _ 1), and then CIFS sharing success is verified and set through verify that a code return value is 1, setting success is indicated, and if the code return value is 0, CIFS sharing setting failure is indicated.
Step S23: and if the CIFS share setting is successful, creating a CIFS share and setting a CIFS mount directory, and creating a first target file of which the file size corresponding to the first authentication user is a first preset numerical value in the CIFS mount directory.
In this embodiment, if the CIFS sharing is successfully set, a CIFS SHARE is created and a CIFS MOUNT directory is set, specifically, the CIFS SHARE may be created by using CIFS _ MOUNT _ cmd ($ AUTH _ USER _1, $ CIFS _ SHARE _ NAME, $ CIFS _ MOUNT _ DIR), and a first target FILE $ FILE _ NAME _1 with a FILE size of $ capability 1 is written in the MOUNT directory $ CIFS _ mot _ DIR, so as to ensure that a USER to which the first target FILE belongs is $ AUTH _ USER _1.
Step S24: and acquiring a user group ID of the authentication user group, creating a local user group at a client based on the user group ID, acquiring a user ID of the second authentication user, creating a local user at the client based on the user ID, and then distributing the local user to the local user group.
In this embodiment, a User GROUP ID (GROUP ID, GID) of the authenticated User GROUP $ AUTH _ GROUP is acquired as $ AUTH _ GROUP _ ID, a CLIENT local User GROUP $ CLIENT _ GROUP with GID of $ AUTH _ GROUP _ ID and User GROUP name of $ AUTH _ GROUP is created at the CLIENT, a User ID (User ID, UID) of the second authenticated User is acquired, and an unix local User $ CLIENT _ User _2 with the same name as the clustered second authenticated User $ AUTH _ User _2 is created at the CLIENT based on GID. Then $ CLIENT _ USER _2 is distributed to $ CLIENT _ GROUP
Step S25: and creating an NFS share based on the target directory, and then creating a second target file with a file size corresponding to the local user being a second preset value in an NFS mounting directory.
In the embodiment, a local USER $ CLIENT _ USER _2 is used for logging in a CLIENT, NFS is used for mounting $ DIR _ NAME on the CLIENT, and a mounting directory is $ NFS _ MOUNT _ DIR; then create the FILE $ FILE _ NAME _2 in the mount directory at the CLIENT through $ CLIENT _ USER _2, the FILE size is $ capability 2, the USER to which the FILE belongs is $ AUTH _ USER _2, and the USER GROUP is $ AUTH _ GROUP.
Step S26: and checking the current directory quota, judging whether the capacity usage of the first authentication user is consistent with the first preset value or not, judging whether the capacity usage of the second authentication user is consistent with the second preset value or not, and prompting error reporting information on a preset directory capacity quota interface if the capacity usage of the second authentication user is not consistent with the second preset value.
In this embodiment, the current directory quota is checked, specifically, the search _ default _ direction _ quota _ association _ quota ($ AUTH _ GROUP _ ID, $ DIR _ NAME) is used to check the associated default directory quota of each USER in the USER GROUP, check whether the usage amount in $ AUTH _ USER _1 is $ capability 1, check whether the usage amount in $ capability _ USER _2 is $ capability 2, if so, indicate that the setting is successful, continue to perform the next step of determination, if not, prompt error information, and if not, indicate that the actual usage amount is not capability 1 or $ capability 2.
As can be seen, the directory capacity quota set for the target directory in the embodiment of the present application includes a preset soft threshold and a preset hard threshold, and a local user group and a local user with the same ID are created on the client by using the user group ID of the authentication user group and the user ID of the second authentication user, and the types of NFS and CIFS are mounted on the client, respectively, and files with specified sizes are written in the mounted directories by using different users, so that file masters are a first authentication user and a second authentication user, respectively, and the usage amount of each user can be seen on a default directory capacity quota interface. The robustness, the usability and the function richness of the system are improved, and the competitiveness of a mass storage automation platform is improved.
Referring to fig. 4, an embodiment of the present application discloses a method for detecting a directory capacity quota, where the method includes:
the parameter creating module 11 is configured to create a target directory and an authentication user group, create a first authentication user and a second authentication user in the authentication user group, and set a directory capacity quota for the target directory;
a CIFS mount module 12, configured to create, at the client, a CIFS share based on the target directory, and create, in the CIFS mount directory, a first target file having a file size corresponding to the first authenticated user as a first preset numerical value;
the NFS mount module 13 is configured to create, at a client, a local user group bound to the authentication user group and a local user bound to the second authentication user in the local user group, create an NFS share based on the target directory, and then create, in an NFS mount directory, a second target file having a file size corresponding to the local user as a second preset value;
a detecting module 14, configured to check and determine whether current directory quotas respectively corresponding to the first authenticated user and the second authenticated user are consistent with the first preset value and the second preset value.
Therefore, a target directory and an authentication user group are created, a first authentication user and a second authentication user in the authentication user group are created, and a directory capacity quota is set for the target directory; creating a CIFS share based on the target directory at a client, and creating a first target file of which the file size corresponding to the first authentication user is a first preset numerical value in a CIFS mount directory; creating a local user group bound with the authentication user group and a local user bound with the second authentication user in the local user group at a client, creating NFS sharing based on the target directory, and then creating a second target file of which the file size corresponding to the local user is a second preset value in the NFS mounting directory; and checking and judging whether the current directory quotas respectively corresponding to the first authenticated user and the second authenticated user are consistent with the first preset value and the second preset value. Therefore, the target directory, the authentication user group, the first authentication user and the second authentication user belonging to the authentication user group are created firstly; then respectively creating CIFS sharing and NFS sharing, writing a first target file with the file size of a first preset value corresponding to a first authenticated user in a CIFS mount directory, and writing a second target file with the file size of a second preset value corresponding to a local user in an NFS mount directory, wherein the local user and the second authenticated user establish a binding relationship, namely the first target file and the second target file respectively belong to the first authenticated user and the second authenticated user; and finally, the current directory quotas corresponding to the first authentication user and the second authentication user can be checked, and whether the current directory quotas are consistent with the first preset value and the second preset value respectively or not can be judged. That is, the technical scheme can support the detection of the directory capacity quota, so as to further improve the robustness, usability and functional richness of the system and improve the competitiveness of the mass storage automation platform.
In some specific embodiments, the parameter creating module 11 may specifically include:
and the threshold setting unit is used for setting a directory capacity quota comprising a preset soft threshold and a preset hard threshold for the target directory.
In some specific embodiments, the NFS mount module 13 may specifically include:
the user group creating unit is used for acquiring the user group ID of the authentication user group and creating a local user group at the client based on the user group ID;
a local user creating unit, configured to acquire a user ID of the second authenticated user, and create a local user at a client based on the user ID;
and the distribution unit is used for distributing the local users to the local user groups.
In some specific embodiments, before the parameter creating module 11, the method may further include:
the condition judgment module is used for judging whether the current environment meets a preset condition or not;
a first execution module, configured to execute the steps of creating the target directory and authenticating the user group if the target directory is satisfied;
and the second execution module is used for adjusting the current environment if the current environment does not meet the preset conditions, so that the adjusted current environment meets the preset conditions.
In some specific embodiments, the condition determining module may specifically include:
the information determining unit is used for judging whether the current cluster is not configured with an active directory domain and judging whether a directory capacity quota function option, a CIFS service and an NFS service are opened or not;
correspondingly, the second execution module may specifically include:
a domain quitting unit, configured to quit the active directory domain if the active directory domain is configured for the current cluster;
a service starting unit, configured to start the directory capacity quota function option, the CIFS service, and the NFS service if the directory capacity quota function option, the CIFS service, and the NFS service are not started.
In some specific embodiments, the CIFS mount module 12 may specifically include:
a CIFS sharing setting unit, configured to set CIFS sharing based on the target directory, the first authenticated user, and a predefined CIFS sharing name, and verify whether the setting of CIFS sharing is successful;
and the CIFS share creating unit is used for creating CIFS shares and setting a CIFS mount directory if the setting of the CIFS shares is successful.
In some specific embodiments, the detection module 14 may specifically include:
a usage amount determining unit, configured to check a current directory quota, determine whether the volume usage amount of the first authenticated user is consistent with the first preset value, and determine whether the volume usage amount of the second authenticated user is consistent with the second preset value;
and the error reporting prompting unit is used for prompting error reporting information on a preset directory capacity quota interface if the two contents are inconsistent.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The method specifically comprises the following steps: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. Wherein the memory 22 is adapted to store a computer program, which is loaded and executed by the processor 21, to implement the steps of:
creating a target directory and an authentication user group, creating a first authentication user and a second authentication user in the authentication user group, and setting a directory capacity quota for the target directory;
creating a CIFS (common information file system) share based on the target directory at a client, and creating a first target file of which the file size corresponding to the first authentication user is a first preset numerical value in a CIFS mount directory;
creating a local user group bound with the authentication user group and a local user bound with the second authentication user in the local user group at a client, creating NFS sharing based on the target directory, and then creating a second target file with a file size corresponding to the local user as a second preset value in the NFS mounting directory;
and checking and judging whether the current directory quotas respectively corresponding to the first authenticated user and the second authenticated user are consistent with the first preset value and the second preset value.
In some embodiments, the processor, by executing the computer program stored in the memory, may specifically implement the following steps:
and setting a directory capacity quota comprising a preset soft threshold and a preset hard threshold for the target directory.
In some embodiments, the processor may specifically implement the following steps by executing the computer program stored in the memory:
acquiring a user group ID of the authentication user group, creating a local user group at a client based on the user group ID, acquiring a user ID of the second authentication user, and creating a local user at the client based on the user ID;
and distributing the local users to the local user groups.
In some embodiments, the processor may specifically implement the following steps by executing the computer program stored in the memory:
judging whether the current environment meets a preset condition or not;
if yes, executing the steps of creating the target directory and authenticating the user group;
if not, adjusting the current environment so that the adjusted current environment meets the preset condition.
In some embodiments, the processor may specifically implement the following steps by executing the computer program stored in the memory:
judging whether the current cluster is not configured with an active directory domain, and judging whether a directory capacity quota function option, a CIFS service and an NFS service are opened;
correspondingly, if not, adjusting the current environment includes:
if the current cluster is configured with the active directory domain, exiting the active directory domain;
if the directory capacity quota function option, the CIFS service, and the NFS service are not opened, the directory capacity quota function option, the CIFS service, and the NFS service are opened.
In some embodiments, the processor may specifically implement the following steps by executing the computer program stored in the memory:
setting CIFS sharing based on the target directory, the first authentication user and a predefined CIFS sharing name, and verifying whether the setting of the CIFS sharing is successful;
and if the CIFS sharing setting is successful, creating CIFS sharing and setting a CIFS mounting directory.
In some embodiments, the processor may specifically implement the following steps by executing the computer program stored in the memory:
checking the current directory quota, judging whether the capacity usage of the first authenticated user is consistent with the first preset value or not, and judging whether the capacity usage of the second authenticated user is consistent with the second preset value or not;
and if the contents are inconsistent, prompting error information on a preset directory capacity quota interface.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and a communication protocol followed by the communication interface is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited herein; the input/output interface 25 is configured to obtain external input data or output data to the outside, and a specific interface type thereof may be selected according to specific application requirements, which is not specifically limited herein.
The processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 21 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in a wake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 21 may further include an AI (Artificial Intelligence) processor for processing a calculation operation related to machine learning.
In addition, the storage 22 is used as a carrier for storing resources, and may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., the resources stored thereon include an operating system 221, a computer program 222, data 223, etc., and the storage may be a transient storage or a permanent storage.
The operating system 221 is used for managing and controlling each hardware device on the electronic device 20 and the computer program 222, so as to implement the operation and processing of the mass data 223 in the memory 22 by the processor 21, which may be Windows, unix, linux, or the like. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the method for detecting a quota of directory capacity performed by the electronic device 20 disclosed in any of the foregoing embodiments. The data 223 may include data received by the electronic device and transmitted from an external device, or may include data collected by the input/output interface 25 itself.
Further, an embodiment of the present application also discloses a computer-readable storage medium, where a computer program is stored in the storage medium, and when the computer program is loaded and executed by a processor, the method steps executed in the directory capacity quota detecting process disclosed in any of the foregoing embodiments are implemented.
In the present specification, the embodiments are described in a progressive manner, and each embodiment focuses on differences from other embodiments, and the same or similar parts between the embodiments are referred to each other. The device disclosed in the embodiment corresponds to the method disclosed in the embodiment, so that the description is simple, and the relevant points can be referred to the description of the method part.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the components and steps of the various examples have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it should also be 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 phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
The method, the apparatus, the device and the storage medium for detecting the directory capacity quota provided by the present invention are described in detail above, and a specific example is applied in the present document to explain the principle and the implementation of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A method for detecting a directory capacity quota, comprising:
creating a target directory and an authentication user group, creating a first authentication user and a second authentication user in the authentication user group, and setting a directory capacity quota for the target directory;
creating a CIFS share based on the target directory at a client, and creating a first target file of which the file size corresponding to the first authentication user is a first preset numerical value in a CIFS mount directory;
creating a local user group bound with the authentication user group and a local user bound with the second authentication user in the local user group at a client, creating NFS sharing based on the target directory, and then creating a second target file with a file size corresponding to the local user as a second preset value in the NFS mounting directory;
and checking and judging whether the current directory quotas respectively corresponding to the first authenticated user and the second authenticated user are consistent with the first preset value and the second preset value.
2. The method according to claim 1, wherein the setting of the directory capacity quota for the target directory comprises:
and setting a directory capacity quota comprising a preset soft threshold and a preset hard threshold for the target directory.
3. The method of claim 1, wherein the creating, at the client, a local user group bound to the authenticated user group and creating, at the client, a local user of the local user group bound to the second authenticated user comprises:
acquiring a user group ID of the authentication user group, creating a local user group at a client based on the user group ID, acquiring a user ID of the second authentication user, and creating a local user at the client based on the user ID;
and distributing the local users to the local user groups.
4. The method for detecting directory capacity quota according to claim 1, wherein before creating the target directory and authenticating the user group, further comprising:
judging whether the current environment meets a preset condition or not;
if yes, executing the steps of creating the target directory and authenticating the user group;
if not, adjusting the current environment so that the adjusted current environment meets the preset condition.
5. The method according to claim 4, wherein the determining whether the current environment meets a preset condition includes:
judging whether the current cluster is not configured with an active directory domain, and judging whether a directory capacity quota function option, a CIFS service and an NFS service are started;
correspondingly, if not, adjusting the current environment includes:
if the current cluster is configured with an active directory domain, exiting the active directory domain;
if the directory capacity quota function option, the CIFS service and the NFS service are not opened, the directory capacity quota function option, the CIFS service and the NFS service are opened.
6. The method according to claim 1, wherein the creating, at the client, the CIFS share based on the target directory comprises:
setting CIFS sharing based on the target directory, the first authentication user and a predefined CIFS sharing name, and verifying whether the setting of the CIFS sharing is successful;
and if the CIFS sharing setting is successful, creating CIFS sharing and setting a CIFS mounting directory.
7. The method for detecting the directory capacity quota according to claim 1, wherein the checking and determining whether the current directory quota respectively corresponding to the first authenticated user and the second authenticated user is consistent with the first preset value and the second preset value includes:
checking the current directory quota, judging whether the capacity usage of the first authenticated user is consistent with the first preset value or not, and judging whether the capacity usage of the second authenticated user is consistent with the second preset value or not;
and if the contents are inconsistent, prompting error information on a preset directory capacity quota interface.
8. A directory capacity quota detection apparatus, comprising:
the parameter creating module is used for creating a target directory and an authentication user group, creating a first authentication user and a second authentication user in the authentication user group, and setting a directory capacity quota for the target directory;
the CIFS mounting module is used for creating a CIFS share based on the target directory at the client side and creating a first target file of which the file size corresponding to the first authentication user is a first preset numerical value in the CIFS mounting directory;
the NFS mounting module is used for creating a local user group bound with the authentication user group and a local user bound with the second authentication user in the local user group at a client, creating NFS sharing based on the target directory, and then creating a second target file of which the file size corresponding to the local user is a second preset value in the NFS mounting directory;
and the detection module is used for checking and judging whether the current directory quotas respectively corresponding to the first authenticated user and the second authenticated user are consistent with the first preset value and the second preset value.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the steps of the method for detecting a quota of directory capacity as claimed in any of claims 1 to 7.
10. A computer-readable storage medium for storing a computer program; wherein the computer program realizes the steps of the method for detecting a quota of directory capacity according to any of claims 1 to 7 when being executed by a processor.
CN202211027075.XA 2022-08-25 2022-08-25 Method, device, equipment and medium for detecting directory capacity quota Pending CN115391277A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211027075.XA CN115391277A (en) 2022-08-25 2022-08-25 Method, device, equipment and medium for detecting directory capacity quota

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211027075.XA CN115391277A (en) 2022-08-25 2022-08-25 Method, device, equipment and medium for detecting directory capacity quota

Publications (1)

Publication Number Publication Date
CN115391277A true CN115391277A (en) 2022-11-25

Family

ID=84121629

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211027075.XA Pending CN115391277A (en) 2022-08-25 2022-08-25 Method, device, equipment and medium for detecting directory capacity quota

Country Status (1)

Country Link
CN (1) CN115391277A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116701299A (en) * 2022-12-09 2023-09-05 荣耀终端有限公司 Catalog management method and related device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116701299A (en) * 2022-12-09 2023-09-05 荣耀终端有限公司 Catalog management method and related device
CN116701299B (en) * 2022-12-09 2024-03-26 荣耀终端有限公司 Catalog management method and related device

Similar Documents

Publication Publication Date Title
EP2973147B1 (en) Policy-based secure web boot
US8499337B1 (en) Systems and methods for delegation and notification of administration of internet access
CA2650463C (en) System and method for tracking the security enforcement in a grid system
CN109067877B (en) Control method for cloud computing platform deployment, server and storage medium
US8924500B2 (en) Local storage linked to networked storage system
CN106027487A (en) Hardware equipment access management method and system
EP3818674B1 (en) Enhancing security using anomaly detection
CN114826749A (en) Interface access control method, device and medium
CN115391277A (en) Method, device, equipment and medium for detecting directory capacity quota
CN113872991A (en) Method, device, equipment and medium for controlling cloud platform interface authority
CN112000971B (en) File permission recording method, system and related device
CN110365640A (en) A kind of method and apparatus of control single-page application routing
CN109656877A (en) A kind of method, apparatus and distributed file system of user file quota
CN111881103B (en) LDAP domain user ACL authority control method and device based on NFS sharing
US10712957B2 (en) Disk storage capacity reorganization
CN104714626A (en) Information processing method and electronic device
CN115118515B (en) AD domain control method, device and medium based on distributed system
CN115098297B (en) Consistent snapshot generation method and system for cloud primary storage data volume
EP3151154B1 (en) Data access control based on storage validation
CN114817134A (en) Snapshot task monitoring method, device, equipment and medium
CN113743945A (en) Method and device for switching payment verification modes based on risks
CN111610935B (en) Access control method, device, equipment and medium
CN113656355A (en) File processing method and device, nonvolatile storage medium and processor
CN114253905A (en) File writing method, device and equipment based on directory quota
CN111800286A (en) Detection method and device of intranet assets and electronic equipment

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