CN110543459A - Method, system, terminal and storage medium for acquiring file lock state under NFS - Google Patents

Method, system, terminal and storage medium for acquiring file lock state under NFS Download PDF

Info

Publication number
CN110543459A
CN110543459A CN201910683331.2A CN201910683331A CN110543459A CN 110543459 A CN110543459 A CN 110543459A CN 201910683331 A CN201910683331 A CN 201910683331A CN 110543459 A CN110543459 A CN 110543459A
Authority
CN
China
Prior art keywords
file
file lock
lock state
state
nfs
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.)
Withdrawn
Application number
CN201910683331.2A
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.)
Suzhou Wave Intelligent Technology Co Ltd
Original Assignee
Suzhou Wave Intelligent 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 Suzhou Wave Intelligent Technology Co Ltd filed Critical Suzhou Wave Intelligent Technology Co Ltd
Priority to CN201910683331.2A priority Critical patent/CN110543459A/en
Publication of CN110543459A publication Critical patent/CN110543459A/en
Withdrawn legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/26Functional testing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • 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
    • G06F16/1767Concurrency control, e.g. optimistic or pessimistic approaches
    • G06F16/1774Locking methods, e.g. locking methods for file systems allowing shared and concurrent access to files
    • 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
    • G06F16/1824Distributed file systems implemented using Network-attached Storage [NAS] architecture
    • G06F16/183Provision of network file services by network file servers, e.g. by using NFS, CIFS
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6209Protecting access to data via a platform, e.g. using keys or access control rules to a single file or object, e.g. in a secure envelope, encrypted and accessed using a key, or with access control rules appended to the object itself
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a method, a system, a terminal and a storage medium for acquiring a file lock state under NFS, comprising the following steps: acquiring node IP of all mount nodes shared by NFS; acquiring the file lock state of the mounted node according to the node IP by adopting a time polling mode; and judging whether the file lock state is consistent with the expected state or not, and outputting a judgment result. According to the method and the device, the script is compiled, the file lock test code is executed, the automatic judgment of the state of the file lock and the algorithm of the cyclic waiting are utilized, the automatic operation is carried out after the file enters the protection period, manual intervention is not needed, the judgment of the locking state of the file is automatically carried out, the test time is saved, and the error rate of manual operation is reduced.

Description

Method, system, terminal and storage medium for acquiring file lock state under NFS
Technical Field
The invention belongs to the technical field of server testing, and particularly relates to a method, a system, a terminal and a storage medium for acquiring a file lock state under NFS.
background
with the ever-increasing demand for data storage, businesses are increasingly demanding a need to ensure that their business information and records are accurately and efficiently archived. Data stored by NFS sharing techniques may be lost or modified by various accidents, such as multiple client sharing. This poses a significant risk. The locking mode for shared files is a requirement of many enterprises for long-term secure storage of some important business data. File locking: the function characteristic can realize that different users lock and protect files created by the users, and prevent data in the files from being modified or deleted by others. The file lock function is intended to protect archived data.
in the test work, the lock attribute of the file needs to be judged for many times, whether the folder is in the locking reading, locking writing or overdue state is judged, the file needs to be artificially waited to enter the corresponding state, and then relevant operation is carried out. If the file state is manually executed, the operation is complicated, and the situation of test errors is easy to occur due to the judgment errors of different file states. By utilizing the combination method of automatic time judgment and a circular waiting algorithm, the execution is rapid, and the error rate of manual testing is greatly reduced.
disclosure of Invention
in view of the above-mentioned deficiencies of the prior art, the present invention provides a method, a system, a terminal and a storage medium for acquiring NFS context lock status, so as to solve the above-mentioned technical problems.
in a first aspect, the present invention provides a method for acquiring a file lock state under an NFS, including:
Acquiring node IP of all mount nodes shared by NFS;
Acquiring the file lock state of the mounted node according to the node IP by adopting a time polling mode;
And judging whether the file lock state is consistent with the expected state or not, and outputting a judgment result.
Further, before the acquiring node IP of which NFS shares all mount nodes, the method further includes:
Verifying the operation function of the file in the file lock protection period;
And defining the file lock state to acquire operation related parameters.
Further, the determining whether the file lock state is consistent with the expected state and outputting a determination result includes:
setting an expected state according to the test requirement;
Judging whether the acquired file lock state is consistent with the expected state:
If yes, outputting the file lock state to accord with an expected state;
Otherwise, outputting an abnormal prompt, and continuously performing file lock state acquisition and judgment operation on the file after the file lock state of the corresponding file is modified.
in a second aspect, the present invention provides an NFS lower file lock state acquisition system, including:
The node acquisition unit is configured for acquiring node IPs of all mount nodes shared by the NFS;
the state acquisition unit is configured to acquire the file lock state of the mounted node according to the node IP in a time polling mode;
and the result output unit is configured to judge whether the file lock state is consistent with the expected state or not and output a judgment result.
further, the system further comprises:
the operation verification unit is configured for verifying the operation function of the file in the file lock protection period;
And the parameter definition unit is configured for defining the file lock state acquisition operation related parameters.
Further, the result output unit includes:
an expectation setting module configured to set an expectation state according to the test requirement;
A consistency judging module configured to judge whether the acquired file lock status is consistent with the expected status
The normal output module is configured to output that the file lock state meets an expected state;
And the exception output module is configured to output an exception prompt and continuously perform file lock state acquisition and judgment operation on the corresponding file after the file lock state of the file is modified.
In a third aspect, a terminal is provided, including:
a processor, a memory, wherein,
The memory is used for storing a computer program which,
The processor is used for calling and running the computer program from the memory so as to make the terminal execute the method of the terminal.
In a fourth aspect, a computer storage medium is provided having stored therein instructions that, when executed on a computer, cause the computer to perform the method of the above aspects.
the beneficial effect of the invention is that,
According to the method, the system, the terminal and the storage medium for acquiring the state of the NFS file lock, the file lock test code is executed by compiling the script, the automatic judgment of the state of the file lock and the algorithm of the cyclic waiting are utilized, the automatic operation is carried out after the file enters the protection period, the judgment of the locking state of the file is automatically carried out without manual intervention, the test time is saved, and the error rate of the manual operation is reduced.
In addition, the invention has reliable design principle, simple structure and very wide application prospect.
Drawings
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present invention, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
FIG. 1 is a schematic flow diagram of a method of one embodiment of the invention.
FIG. 2 is a schematic block diagram of a system of one embodiment of the present invention.
fig. 3 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
Detailed Description
in order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly and completely described below with reference to the drawings in the embodiment of the present invention, and it is obvious that the described embodiment is only a part of the embodiment 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 following explains key terms appearing in the present invention.
FIG. 1 is a schematic flow diagram of a method of one embodiment of the invention. The execution body in fig. 1 may be an NFS context lock state acquisition system.
As shown in fig. 1, the method 100 includes:
step 110, acquiring node IPs of all mount nodes shared by the NFS;
step 120, acquiring the file lock state of the mounted node according to the node IP by adopting a time polling mode;
Step 130, judging whether the file lock state is consistent with the expected state, and outputting a judgment result.
Optionally, as an embodiment of the present invention, before the acquiring node IPs of all mount nodes shared by NFS, the method further includes:
verifying the operation function of the file in the file lock protection period;
and defining the file lock state to acquire operation related parameters.
optionally, as an embodiment of the present invention, the determining whether the file lock state is consistent with the expected state, and outputting a determination result includes:
Setting an expected state according to the test requirement;
judging whether the acquired file lock state is consistent with the expected state:
If yes, outputting the file lock state to accord with an expected state;
Otherwise, outputting an abnormal prompt, and continuously performing file lock state acquisition and judgment operation on the file after the file lock state of the corresponding file is modified.
in order to facilitate understanding of the present invention, the method for acquiring the lock state of the NFS lower file provided by the present invention is further described below with reference to the principle of the method for acquiring the lock state of the NFS lower file according to the present invention and the process for acquiring the lock state of the NFS lower file in the embodiment.
specifically, the method for acquiring the file lock state under the NFS includes:
s1, obtaining nfs to share all mount client ip. And performing an operation verification function on the file in the set protection period to ensure that the file lock function of the file operates normally.
relevant parameters are defined, for example:
fuse_point=/mnt/nfs #fuse mountpoint
nfsshare_path=nfsshare #nfs share path
nfs_mount_path=/home/nfs #nfs mount path
and S2, acquiring the file lock state of the mounted node according to the node IP by adopting a time polling mode. The specific method comprises the following steps:
(1) Acquiring the state of the file:
(2) Polling search for nfs to share all clients to determine whether locking exists
(3) Judging the attribute of the file according to the returned information of the polling
And S3, judging whether the file lock state is consistent with the expected state or not, and outputting a judgment result.
and setting the expected state of the file lock by the user according to the requirement of the test type required to be carried out on the state of the file lock. And judging whether the file lock state acquired in the step S2 is consistent with the expected state, outputting a prompt that the file lock state is consistent if the file lock state is consistent with the expected state, outputting an abnormal prompt if the file lock state is inconsistent with the expected state, locking the file with the file lock state inconsistent with the expected state, switching the file lock state of the locked file, continuously acquiring and judging the file lock state of the locked file in the switching process until a judgment result that the file lock state of the locked file is consistent with the expected state is obtained, and terminating the continuous operation. The specific method is exemplified as follows:
As shown in fig. 2, the system 200 includes:
a node obtaining unit 210 configured to obtain node IPs for sharing all mount nodes by the NFS;
The state acquisition unit 220 is configured to acquire the file lock state of the mounted node according to the node IP in a time polling manner;
and a result output unit 230 configured to determine whether the file lock state is consistent with the expected state, and output a determination result.
optionally, as an embodiment of the present invention, the system further includes:
The operation verification unit is configured for verifying the operation function of the file in the file lock protection period;
And the parameter definition unit is configured for defining the file lock state acquisition operation related parameters.
Optionally, as an embodiment of the present invention, the result output unit includes:
An expectation setting module configured to set an expectation state according to the test requirement;
A consistency judging module configured to judge whether the acquired file lock status is consistent with the expected status
the normal output module is configured to output that the file lock state meets an expected state;
and the exception output module is configured to output an exception prompt and continuously perform file lock state acquisition and judgment operation on the corresponding file after the file lock state of the file is modified.
fig. 3 is a schematic structural diagram of a terminal 300 according to an embodiment of the present invention, where the terminal 300 may be used to execute the NFS lower file lock state obtaining method according to the embodiment of the present invention.
among them, the terminal 300 may include: a processor 310, a memory 320, and a communication unit 330. The components communicate via one or more buses, and those skilled in the art will appreciate that the architecture of the servers shown in the figures is not intended to be limiting, and may be a bus architecture, a star architecture, a combination of more or less components than those shown, or a different arrangement of components.
the memory 320 may be used for storing instructions executed by the processor 310, and the memory 320 may be implemented by any type of volatile or non-volatile storage terminal or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The executable instructions in memory 320, when executed by processor 310, enable terminal 300 to perform some or all of the steps in the method embodiments described below.
the processor 310 is a control center of the storage terminal, connects various parts of the entire electronic terminal using various interfaces and lines, and performs various functions of the electronic terminal and/or processes data by operating or executing software programs and/or modules stored in the memory 320 and calling data stored in the memory. The processor may be composed of an Integrated Circuit (IC), for example, a single packaged IC, or a plurality of packaged ICs connected with the same or different functions. For example, the processor 310 may include only a Central Processing Unit (CPU). In the embodiment of the present invention, the CPU may be a single operation core, or may include multiple operation cores.
a communication unit 330, configured to establish a communication channel so that the storage terminal can communicate with other terminals. And receiving user data sent by other terminals or sending the user data to other terminals.
the present invention also provides a computer storage medium, wherein the computer storage medium may store a program, and the program may include some or all of the steps in the embodiments provided by the present invention when executed. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a Random Access Memory (RAM).
Therefore, the invention executes the file lock test code by writing the script, automatically judges the file locking state by utilizing the algorithm of automatic judgment and cyclic waiting of the file lock state, automatically operates after the file enters the protection period, does not need manual intervention, automatically judges the file locking state, saves the test time, reduces the error rate of manual operation, and has the technical effects that the embodiment can refer to the description above and is not repeated herein.
those skilled in the art will readily appreciate that the techniques of the embodiments of the present invention may be implemented as software plus a required general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present invention may be embodied in the form of a software product, where the computer software product is stored in a storage medium, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and the like, and the storage medium can store program codes, and includes instructions for enabling a computer terminal (which may be a personal computer, a server, or a second terminal, a network terminal, and the like) to perform all or part of the steps of the method in the embodiments of the present invention.
the same and similar parts in the various embodiments in this specification may be referred to each other. Especially, for the terminal embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant points can be referred to the description in the method embodiment.
in the embodiments provided by the present invention, it should be understood that the disclosed system, system and method can be implemented in other ways. For example, the above-described system embodiments are merely illustrative, and for example, the division of the units is only one logical functional division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, systems or units, and may be in an electrical, mechanical or other form.
the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
although the present invention has been described in detail by referring to the drawings in connection with the preferred embodiments, the present invention is not limited thereto. Various equivalent modifications or substitutions can be made on the embodiments of the present invention by those skilled in the art without departing from the spirit and scope of the present invention, and these modifications or substitutions are within the scope of the present invention/any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (8)

1. A method for acquiring a file lock state under NFS (network file system) is characterized by comprising the following steps:
Acquiring node IP of all mount nodes shared by NFS;
Acquiring the file lock state of the mounted node according to the node IP by adopting a time polling mode;
And judging whether the file lock state is consistent with the expected state or not, and outputting a judgment result.
2. The method according to claim 1, wherein before the obtaining the node IP of which NFS shares all mount nodes, the method further comprises:
Verifying the operation function of the file in the file lock protection period;
and defining the file lock state to acquire operation related parameters.
3. the method of claim 1, wherein determining whether the file lock status is consistent with the expected status and outputting the determination result comprises:
Setting an expected state according to the test requirement;
judging whether the acquired file lock state is consistent with the expected state:
if yes, outputting the file lock state to accord with an expected state;
Otherwise, outputting an abnormal prompt, and continuously performing file lock state acquisition and judgment operation on the file after the file lock state of the corresponding file is modified.
4. an NFS file lock state acquisition system, comprising:
The node acquisition unit is configured for acquiring node IPs of all mount nodes shared by the NFS;
the state acquisition unit is configured to acquire the file lock state of the mounted node according to the node IP in a time polling mode;
And the result output unit is configured to judge whether the file lock state is consistent with the expected state or not and output a judgment result.
5. The system of claim 4, further comprising:
the operation verification unit is configured for verifying the operation function of the file in the file lock protection period;
and the parameter definition unit is configured for defining the file lock state acquisition operation related parameters.
6. the system of claim 4, wherein the result output unit comprises:
an expectation setting module configured to set an expectation state according to the test requirement;
a consistency judging module configured to judge whether the acquired file lock status is consistent with the expected status
the normal output module is configured to output that the file lock state meets an expected state;
And the exception output module is configured to output an exception prompt and continuously perform file lock state acquisition and judgment operation on the corresponding file after the file lock state of the file is modified.
7. A terminal, comprising:
A processor;
a memory for storing instructions for execution by the processor;
wherein the processor is configured to perform the method of any one of claims 1-3.
8. a computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-3.
CN201910683331.2A 2019-07-26 2019-07-26 Method, system, terminal and storage medium for acquiring file lock state under NFS Withdrawn CN110543459A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910683331.2A CN110543459A (en) 2019-07-26 2019-07-26 Method, system, terminal and storage medium for acquiring file lock state under NFS

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910683331.2A CN110543459A (en) 2019-07-26 2019-07-26 Method, system, terminal and storage medium for acquiring file lock state under NFS

Publications (1)

Publication Number Publication Date
CN110543459A true CN110543459A (en) 2019-12-06

Family

ID=68710313

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910683331.2A Withdrawn CN110543459A (en) 2019-07-26 2019-07-26 Method, system, terminal and storage medium for acquiring file lock state under NFS

Country Status (1)

Country Link
CN (1) CN110543459A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111708744A (en) * 2020-05-15 2020-09-25 苏州浪潮智能科技有限公司 Method, system, device and medium for maintaining file lock based on stateless protocol

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111708744A (en) * 2020-05-15 2020-09-25 苏州浪潮智能科技有限公司 Method, system, device and medium for maintaining file lock based on stateless protocol
CN111708744B (en) * 2020-05-15 2023-01-06 苏州浪潮智能科技有限公司 Method, system, device and medium for maintaining file lock based on stateless protocol

Similar Documents

Publication Publication Date Title
CN110557299A (en) network transmission function batch test method, system, terminal and storage medium
CN110554938B (en) BIOS (basic input output System) testing method, system, terminal and storage medium based on script set
CN111988302A (en) Method, system, terminal and storage medium for detecting rebound program
CN111966551A (en) Method, system, terminal and storage medium for verifying remote command execution result
CN110543459A (en) Method, system, terminal and storage medium for acquiring file lock state under NFS
CN112003730A (en) Method, system, terminal and storage medium for rapid cluster deployment
CN112256532A (en) Test interface generation method and device, computer equipment and readable storage medium
CN112559352A (en) Interface test method, device, equipment and storage medium
CN112214384A (en) Hard disk serial number management method, system, terminal and storage medium
CN111124772A (en) Cloud platform storage performance testing method, system, terminal and storage medium
CN111143347A (en) Object storage data consistency test method, system, terminal and storage medium
CN111966286A (en) Multi-data pool hierarchical migration method and system
CN111291380A (en) Command line reinforcing method, system, terminal and storage medium
CN110597683A (en) SNMP temperature information verification method, system, terminal and storage medium
CN113111378A (en) Terminal, storage medium, annotation method and system, and pre-verification method and system
CN111858198A (en) Multi-scheme memory plugging test method, system, terminal and storage medium
CN110865932A (en) Program internal interface testing method, system, terminal and storage medium
CN111563038A (en) SDK test method, device, computer equipment and computer readable storage medium
CN111240990A (en) ISMCLI command line testing method, system, terminal and storage medium
CN110716863A (en) Method, system, terminal and storage medium for testing mandatory access control rule
CN111984512B (en) Storage system resource competition simulation test method, system, terminal and storage medium
CN111597101A (en) SDK access state detection method, computer device and computer readable storage medium
CN110555090B (en) Method, system, terminal and storage medium for automatically acquiring CPU BUS Number
CN111475481A (en) HDFS resource permission testing method, system, terminal and storage medium
CN109508270B (en) BIOS register checking and testing method and device

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
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20191206